feat: /status 通用状态显示 + /compact 手动压缩;HTML 兼容渲染默认化

- /status:绑定会话/会话 ID/工作区/当前模型/思考强度/上下文长度/
  首 token 平均/输出速率/输入输出 tokens —— 与 Web 底部统计条同源
  同算法(sessionProjections: sessionStats/tokenUsage/contextPressure),
  投影插件缺失时逐组优雅降级;冷会话不强制 resume
- /compact:复用 ctx.compaction.compactNow 手动压缩绑定会话历史,
  异步执行不阻塞轮询,完成/失败均中文通知,同会话去重,
  桥停止/热重载自动中止进行中的压缩
- 全部用户可见文案不使用 emoji
- rendering 默认改 html(兼容优先)+ userQuestions/approval 双通道等
  既有修改一并合入(此前已上线确认)
- tests:+6 覆盖 /status 全字段与 /compact 各分支(51 全绿)
This commit is contained in:
RRRosmontis
2026-09-05 17:24:41 +08:00
parent 20898d5d21
commit d712fb3494
15 changed files with 1695 additions and 72 deletions
+20
View File
@@ -18,6 +18,20 @@ test('parse slash commands for remote control', () => {
assert.equal(parseCommand('hello').type, 'plain')
})
test('parse /rich with optional mode argument', () => {
const bare = parseCommand('/rich')
assert.equal(bare.type, 'rich')
assert.equal(bare.type === 'rich' ? bare.arg : 'x', undefined)
const on = parseCommand('/rich on')
assert.equal(on.type, 'rich')
assert.equal(on.type === 'rich' ? on.arg : 'x', 'on')
assert.equal(parseCommand('/rich off').type === 'rich' && parseCommand('/rich off').arg, 'off')
assert.equal(parseCommand('/rich ON').type === 'rich' && parseCommand('/rich ON').arg, 'on')
assert.equal(parseCommand('/render auto').type === 'rich' && parseCommand('/render auto').arg, 'auto')
assert.equal(parseCommand('/setting').type, 'rich')
assert.equal(parseCommand('/setting html').type === 'rich' && parseCommand('/setting html').arg, 'html')
})
test('Chinese copy mentions sessions and bind', () => {
assert.ok(MSG.DENIED.includes('权限') || MSG.DENIED.includes('授权'))
assert.ok(MSG.HELP.includes('/sessions'))
@@ -26,3 +40,9 @@ test('Chinese copy mentions sessions and bind', () => {
assert.ok(MSG.NEED_BIND.includes('/sessions'))
assert.ok(MSG.WELCOME.includes('Web') || MSG.WELCOME.includes('遥控器'))
})
test('parse /compact', () => {
assert.equal(parseCommand('/compact').type, 'compact')
assert.equal(parseCommand('/compact@MyBot').type, 'compact')
assert.equal(parseCommand('/compact now').type, 'compact')
})