feat: support compact command across IM channels

This commit is contained in:
xmanrui 2026-08-18 23:20:05 +08:00
parent 4545cfe9c5
commit 1cc7a26f30
40 changed files with 728 additions and 136 deletions

View file

@ -1,4 +1,5 @@
import { runWorkspaceCommand } from '../shared/workspace-command.mjs';
import { runCompactCommand } from '../shared/compact-command.mjs';
import {
harnessAnswerForQuestion,
harnessQuestionText,
@ -14,6 +15,7 @@ const HELP_TEXT = [
'',
'直接发送文字即可继续当前会话。',
'/new 开启一个全新会话',
'/compact 压缩当前会话的较早上下文',
'/workspace 工作区绝对路径 切换工作区',
'/workspacelist 列出工作区绝对路径',
'/sessionlist [工作区序号或绝对路径] 列出会话 ID 和标题',
@ -241,6 +243,18 @@ export class QqHarnessBridge {
await this.#state.markSeen(messageId);
return;
}
const compactCommand = await runCompactCommand(
text,
this.#harness,
this.#state,
key,
{ signal: this.#signal },
);
if (compactCommand) {
await this.#bot.sendText(target, compactCommand.message);
await this.#state.markSeen(messageId);
return;
}
let stream = null;
let streamFinished = false;