aicrosschat 0.8.8 → 0.8.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -2
- package/bin/crosschat.mjs +15 -1
- package/mcp/server.mjs +24 -0
- package/package.json +1 -1
- package/plugin/lib/index.js +25 -0
package/README.md
CHANGED
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
| 广播的 `note`(自由发言) | **不投递**(仍可用 `team_inbox` 读到) | 投递、只注入 |
|
|
46
46
|
| 与他机相关的事件 | 不投递 | 不投递 |
|
|
47
47
|
|
|
48
|
-
## 模型可见的工具(DSH 端共
|
|
48
|
+
## 模型可见的工具(DSH 端共 12 个)
|
|
49
49
|
|
|
50
50
|
| 工具 | 作用 |
|
|
51
51
|
|---|---|
|
|
@@ -56,6 +56,7 @@
|
|
|
56
56
|
| `team_claim` / `team_done` / `team_tasks` | 任务板:认领 / 完成 / 查看 |
|
|
57
57
|
| `team_profile` / `team_roster` | 能力自述 / 名册 |
|
|
58
58
|
| `team_wait` | 阻塞等一组任务完成(默认 60s,上限 300s) |
|
|
59
|
+
| `team_broadcast` | 主控把「用户决策/全局约束」广播给全员(kind=status,投递但不唤醒) |
|
|
59
60
|
|
|
60
61
|
## 任务板
|
|
61
62
|
|
|
@@ -79,7 +80,7 @@ task ──▶ open ──claim──▶ claimed ──done──▶ done
|
|
|
79
80
|
|
|
80
81
|
| 端 | 工具数 | 说明 |
|
|
81
82
|
|---|---|---|
|
|
82
|
-
| DSH 插件 | **
|
|
83
|
+
| DSH 插件 | **12** | 含 `team_join` / `team_leave`,身份随会话自动恢复 |
|
|
83
84
|
| MCP 桥 | **9** | 无 join/leave(用 `CROSSCHAT_NODE` 固定身份),其余同名同义,含 `team_wait` |
|
|
84
85
|
| CLI | **9** | 子命令 `peers/say/inbox/claim/done/tasks/profile/roster/wait` |
|
|
85
86
|
|
|
@@ -196,6 +197,13 @@ npm run smoke # 16 项,等价于 node relay/smoke.mjs
|
|
|
196
197
|
- 主控收到 `status` 后如无新指令可只记录不回;需要改方向时再 `team_say(kind=task)` 追加。
|
|
197
198
|
- 如果任务预计会超过原估时,先发 status 再继续,别等到超时。
|
|
198
199
|
|
|
200
|
+
### 3. 用户决策的广播:只有"影响所有人"的才广播
|
|
201
|
+
|
|
202
|
+
- 用户原话里**影响全局的约束/决策**(隐私边界、命名、发布口径、账号操作禁止项),由主控用 `team_broadcast` 发一条 `status`(所有成员都会收到,但不唤醒);
|
|
203
|
+
- 单个节点的任务细节、报错、命令输出,用 `team_say` 点名,不进全员上下文;
|
|
204
|
+
- 隐私/账号信息**不要广播**;
|
|
205
|
+
- 广播前先压缩成一句可执行的话,别把聊天原文整段转发。
|
|
206
|
+
|
|
199
207
|
> 这两条是约定而非强制校验:插件不会因为没发 status 拦截你,但审计/复盘会把“静默超时”和“颗粒度过大”当作协作问题记录下来。
|
|
200
208
|
|
|
201
209
|
## 其他客户端接入(非 DSH)
|
package/bin/crosschat.mjs
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* crosschat health
|
|
6
6
|
* crosschat peers
|
|
7
7
|
* crosschat inbox [--since N] [--limit K]
|
|
8
|
-
* crosschat say "正文" [--to node|'*'] [--kind task] [--task T1]
|
|
8
|
+
* crosschat broadcast "正文" [--task T1]\n crosschat say "正文" [--to node|'*'] [--kind task] [--task T1]
|
|
9
9
|
*
|
|
10
10
|
* 连接参数优先级:命令行 flag > 环境变量。
|
|
11
11
|
* --relay / CROSSCHAT_RELAY 默认 http://127.0.0.1:7317
|
|
@@ -192,6 +192,20 @@ try {
|
|
|
192
192
|
? '任务板为空\n'
|
|
193
193
|
: rows.map(t => `${t.id} [${t.state}]${t.owner ? ` @${t.ownerName || t.owner}` : ''} r${t.round}`
|
|
194
194
|
+ `${t.paths?.length ? ` paths=${t.paths.join(',')}` : ''}: ${t.title}`).join('\n') + '\n')
|
|
195
|
+
} else if (command === 'broadcast') {
|
|
196
|
+
const text = flags.text ?? positional.slice(1).join(' ')
|
|
197
|
+
if (!String(text).trim()) {
|
|
198
|
+
process.stderr.write('crosschat broadcast: 正文不能为空\n')
|
|
199
|
+
process.exit(2)
|
|
200
|
+
}
|
|
201
|
+
const receipt = await client.append({
|
|
202
|
+
name,
|
|
203
|
+
kind: 'status',
|
|
204
|
+
to: '*',
|
|
205
|
+
text: String(text),
|
|
206
|
+
...(flags.task ? { taskId: String(flags.task) } : {}),
|
|
207
|
+
})
|
|
208
|
+
process.stdout.write(`已广播给全员 seq=${receipt.seq}\n`)
|
|
195
209
|
} else if (command === 'say') {
|
|
196
210
|
const text = flags.text ?? positional.slice(1).join(' ')
|
|
197
211
|
if (!String(text).trim()) {
|
package/mcp/server.mjs
CHANGED
|
@@ -110,6 +110,18 @@ const TOOLS = [
|
|
|
110
110
|
required: ['taskIds'],
|
|
111
111
|
},
|
|
112
112
|
},
|
|
113
|
+
{
|
|
114
|
+
name: 'team_broadcast',
|
|
115
|
+
description: '把一条用户决策/全局约束广播给全员(kind=status,投递但不唤醒);建议仅主控使用。',
|
|
116
|
+
inputSchema: {
|
|
117
|
+
type: 'object',
|
|
118
|
+
properties: {
|
|
119
|
+
text: { type: 'string', description: '广播内容。' },
|
|
120
|
+
taskId: { type: 'string', description: '可选,关联任务。' },
|
|
121
|
+
},
|
|
122
|
+
required: ['text'],
|
|
123
|
+
},
|
|
124
|
+
},
|
|
113
125
|
{
|
|
114
126
|
name: 'team_peers',
|
|
115
127
|
description: '列出当前在线的协作节点和日志尾部序号。',
|
|
@@ -248,6 +260,18 @@ async function callTool(name, args) {
|
|
|
248
260
|
await new Promise(resolve => setTimeout(resolve, 2000))
|
|
249
261
|
}
|
|
250
262
|
}
|
|
263
|
+
if (name === 'team_broadcast') {
|
|
264
|
+
const text = String(args?.text ?? '').trim()
|
|
265
|
+
if (!text) throw new Error('text 不能为空')
|
|
266
|
+
const receipt = await client.append({
|
|
267
|
+
name: NAME,
|
|
268
|
+
kind: 'status',
|
|
269
|
+
to: '*',
|
|
270
|
+
text,
|
|
271
|
+
...(args?.taskId ? { taskId: String(args.taskId) } : {}),
|
|
272
|
+
})
|
|
273
|
+
return `已广播给全员(seq=${receipt.seq})。`
|
|
274
|
+
}
|
|
251
275
|
if (name === 'team_peers') {
|
|
252
276
|
const page = await client.peers()
|
|
253
277
|
const nodes = (page.peers ?? []).map(p => p.node)
|
package/package.json
CHANGED
package/plugin/lib/index.js
CHANGED
|
@@ -869,6 +869,31 @@ export function apply(ctx, config) {
|
|
|
869
869
|
},
|
|
870
870
|
}))
|
|
871
871
|
|
|
872
|
+
ctx.tools.register(defineTool({
|
|
873
|
+
name: 'team_broadcast',
|
|
874
|
+
description:
|
|
875
|
+
'把一条「用户决策 / 全局约束」广播给所有成员(kind=status:所有成员都会收到上下文,但不唤醒)。'
|
|
876
|
+
+ '仅建议主控使用;过程性信息请用 team_say 点名,避免刷屏。',
|
|
877
|
+
parameters: {
|
|
878
|
+
text: { type: 'string', required: true, description: '要广播的内容(≤8000 字)。' },
|
|
879
|
+
taskId: { type: 'string', description: '可选,关联任务。' },
|
|
880
|
+
},
|
|
881
|
+
output: {
|
|
882
|
+
schema: {
|
|
883
|
+
type: 'object',
|
|
884
|
+
additionalProperties: false,
|
|
885
|
+
properties: { ok: { type: 'boolean', required: true }, seq: { type: 'integer' } },
|
|
886
|
+
},
|
|
887
|
+
render: (_args, value) => [{ type: 'text', text: `已广播给全员(seq=${value.seq ?? '?'})。` }],
|
|
888
|
+
},
|
|
889
|
+
async execute(args) {
|
|
890
|
+
const text = String(args.text ?? '').trim()
|
|
891
|
+
if (!text) throw new Error('text 不能为空')
|
|
892
|
+
const receipt = await append({ kind: 'status', to: '*', text, ...(args.taskId ? { taskId: String(args.taskId) } : {}) })
|
|
893
|
+
return { ok: true, ...(receipt && receipt.seq ? { seq: receipt.seq } : {}) }
|
|
894
|
+
},
|
|
895
|
+
}))
|
|
896
|
+
|
|
872
897
|
ctx.tools.register(defineTool({
|
|
873
898
|
name: 'team_peers',
|
|
874
899
|
description: '列出当前在线的协作节点。',
|