feat: support per-bot workspace switching

This commit is contained in:
xmanrui 2026-08-17 23:56:27 +08:00
parent adcace3512
commit 44dd50216a
64 changed files with 3878 additions and 712 deletions

View file

@ -311,7 +311,14 @@ export class WhatsappController {
if (record.controller.signal.aborted || this.#closed || error?.name === 'AbortError') {
await this.#stopRuntime(botId);
if (previous) await this.#configStore.save(previous).catch(() => undefined);
else await this.#configStore.remove(botId).catch(() => undefined);
else {
const removed = await this.#configStore.remove(botId).catch(() => null);
if (removed) {
await this.#deleteState({ botId, config }).catch((cleanupError) => {
this.#logger.warn?.('[dsh-im:whatsapp] cancelled bot state cleanup failed:', cleanupError);
});
}
}
await this.#deleteAuth(record.authDirectory).catch(() => undefined);
if (previous) await this.#startRuntime(previous).catch(() => undefined);
record.state = 'cancelled';