feat: add remote channels and richer notes

This commit is contained in:
lofyer
2026-08-09 15:48:52 +08:00
parent 417a9fccb6
commit 6c891f3522
69 changed files with 13012 additions and 499 deletions
@@ -0,0 +1,50 @@
import { describe, expect, it } from 'vitest'
import {
parseRemoteChannelPrompt
} from './remote-channel-routing'
import { projectChannelLabels } from '../../shared/assistant-contracts'
describe('parseRemoteChannelPrompt', () => {
it('uses the channel project default mode without changing the prompt', () => {
expect(
parseRemoteChannelPrompt(' 请整理下载目录 ', 'execute')
).toEqual({
workMode: 'execute',
prompt: '请整理下载目录'
})
expect(parseRemoteChannelPrompt('总结进展', 'plan')).toEqual({
workMode: 'plan',
prompt: '总结进展'
})
})
it.each([
['/ask 请只读分析', 'ask', '请只读分析'],
['/execute: 创建文件', 'execute', '创建文件'],
['/exec 执行测试', 'execute', '执行测试'],
['对话:解释错误', 'ask', '解释错误'],
['执行: 更新依赖', 'execute', '更新依赖']
] as const)(
'parses explicit mode prefix %s',
(text, workMode, prompt) => {
expect(parseRemoteChannelPrompt(text, 'ask')).toEqual({
workMode,
prompt
})
}
)
it('rejects a prefix without a request body', () => {
expect(() => parseRemoteChannelPrompt('/execute', 'ask')).toThrow(
'远程请求内容不能为空'
)
})
it('defines a stable product label for every managed channel', () => {
expect(projectChannelLabels).toEqual({
weixin: '微信 ClawBot',
wecom: '企业微信',
dingtalk: '钉钉'
})
})
})