dsh-chief 1.6.0 → 1.7.0
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/CHANGELOG.md +31 -0
- package/README.en.md +277 -123
- package/README.md +283 -129
- package/api-routes.js +193 -2
- package/board-actions.js +1452 -2060
- package/board-handoff.js +709 -0
- package/board-schema.js +35 -2
- package/chief-approvals.js +6 -2
- package/chief-commands.js +1884 -3486
- package/chief-executor.js +6 -1
- package/chief-network.js +1098 -869
- package/chief-review.js +193 -3
- package/chief-state.js +1996 -3078
- package/chief-view.js +7 -4
- package/client.js +12237 -8021
- package/command-helpers.js +568 -0
- package/command-ops.js +1226 -0
- package/digest.js +25 -3
- package/index.js +6 -0
- package/locale/en.json +4 -4
- package/locale/zh.json +4 -4
- package/model-tools.js +40 -2
- package/network-harness.js +1047 -0
- package/package.json +8 -2
- package/runtime-hooks.js +69 -2
- package/safety/guard-walls.js +5 -0
- package/safety/invariant-guards.js +125 -6
- package/safety/tool-gate.js +2 -0
- package/state-media.js +173 -0
- package/state-schema.js +1505 -0
- package/subagent-runtime.js +57 -3
package/digest.js
CHANGED
|
@@ -13,6 +13,8 @@
|
|
|
13
13
|
* (`todo_write`, `create_goal`, `update_goal`) into the board.
|
|
14
14
|
*/
|
|
15
15
|
|
|
16
|
+
import { normalizeCursorBlocked } from './board-schema.js'
|
|
17
|
+
|
|
16
18
|
const DIGEST_BUDGET = 2500
|
|
17
19
|
|
|
18
20
|
function ownerName(id) {
|
|
@@ -190,8 +192,27 @@ function subagentHeaderLines(board, extras) {
|
|
|
190
192
|
lines.push('🤖 子代理团队 (' + running.length + ' 运行中 / 共 ' + children.length + ' 个): ' + summary + (restCount > 0 ? ' · 另有 ' + restCount + ' 个空闲成员' : ''))
|
|
191
193
|
}
|
|
192
194
|
}
|
|
195
|
+
const squad = extras && extras.bubbleSquad ? extras.bubbleSquad : null
|
|
193
196
|
if (extras && Number(extras.linkedPeersCount) > 0) {
|
|
194
|
-
lines.push('📡 跨窗口协同已开启: 已与 ' + extras.linkedPeersCount + ' 个外部主对话窗口互通,可用 chief_board({ action: "mail.send", target, text })
|
|
197
|
+
lines.push('📡 跨窗口协同已开启: 已与 ' + extras.linkedPeersCount + ' 个外部主对话窗口互通,可用 chief_board({ action: "mail.send", target, text }) 跨对话递话(target 见下方联动对话)。')
|
|
198
|
+
}
|
|
199
|
+
const enrolledHarnesses = squad && Array.isArray(squad.enrolledHarnesses) ? squad.enrolledHarnesses : []
|
|
200
|
+
if (enrolledHarnesses.length) {
|
|
201
|
+
const harnessDesc = enrolledHarnesses.map(h => {
|
|
202
|
+
const flag = h.running ? '运行中' : (h.configured ? '直连就绪' : '已安装待检')
|
|
203
|
+
return (h.label || h.provider) + '(target="' + h.provider + '", ' + flag + ')'
|
|
204
|
+
}).join(' · ')
|
|
205
|
+
lines.push('🧩 水泡外协 Harness (' + enrolledHarnesses.length + ' 编入' + (squad.locked ? ' · 🔒已锁编队' : '') + '): ' + harnessDesc + ' —— 可调 chief_board({ action: "mail.send", target, text }) 直接派单调用。')
|
|
206
|
+
}
|
|
207
|
+
const standbyCount = squad ? Number(squad.standbySessionsCount) || 0 : 0
|
|
208
|
+
const availHarnesses = squad && Array.isArray(squad.availableHarnesses) ? squad.availableHarnesses : []
|
|
209
|
+
if (standbyCount > 0 || availHarnesses.length > 0) {
|
|
210
|
+
const parts = []
|
|
211
|
+
if (standbyCount > 0) parts.push(standbyCount + ' 个未入泡独立主对话(内容已隔离,需用户手动入泡后方可见)')
|
|
212
|
+
if (availHarnesses.length > 0) {
|
|
213
|
+
parts.push(availHarnesses.length + ' 个已装待命 Harness(' + availHarnesses.slice(0, 4).map(h => h.provider).join('/') + ')')
|
|
214
|
+
}
|
|
215
|
+
lines.push('🪑 队外待命探测: 本机另有 ' + parts.join('、') + ';编队状态可调 team.list / mail.inbox 查询。')
|
|
195
216
|
}
|
|
196
217
|
return lines
|
|
197
218
|
}
|
|
@@ -290,7 +311,7 @@ function cursorLines(board) {
|
|
|
290
311
|
const cursor = board && board.cursor ? board.cursor : null
|
|
291
312
|
const step = clamp(cursor && cursor.step, 120)
|
|
292
313
|
const next = clamp(cursor && cursor.next, 160)
|
|
293
|
-
const blocked = clamp(cursor && cursor.blocked, 120)
|
|
314
|
+
const blocked = clamp(normalizeCursorBlocked(cursor && cursor.blocked), 120)
|
|
294
315
|
if (!step && !next && !blocked) {
|
|
295
316
|
const open = (Array.isArray(board && board.plan) ? board.plan : []).filter(item => !item.done)
|
|
296
317
|
if (!open.length) return []
|
|
@@ -315,10 +336,11 @@ function linkedPeersLines(extras, limit = 4) {
|
|
|
315
336
|
const lines = ['🌐 协同网络共享进度(当前联动 ' + peers.length + ' 个主对话 · 退出协同后自动清零):']
|
|
316
337
|
for (const p of shown) {
|
|
317
338
|
const label = clamp(p.name || ownerName(p.rootId), 26)
|
|
339
|
+
const tgt = p.rootId ? ' target="' + clamp(String(p.rootId), 36) + '"' : ''
|
|
318
340
|
const obj = p.objective ? '目标=' + clamp(p.objective, 52) : '暂无总目标'
|
|
319
341
|
const counts = '任务 ' + (Number(p.doneCount) || 0) + '完/' + (Number(p.doingCount) || 0) + '做/' + (Number(p.blockedCount) || 0) + '阻'
|
|
320
342
|
const cur = p.cursorStep ? ' · 断点=' + clamp(p.cursorStep, 36) : ''
|
|
321
|
-
lines.push(' · [' + label + '] ' + obj + ' | ' + counts + cur)
|
|
343
|
+
lines.push(' · [' + label + tgt + '] ' + obj + ' | ' + counts + cur)
|
|
322
344
|
}
|
|
323
345
|
if (peers.length > shown.length) {
|
|
324
346
|
lines.push(' …另有 ' + (peers.length - shown.length) + ' 个联动对话')
|
package/index.js
CHANGED
|
@@ -28,6 +28,8 @@ const hostState = {
|
|
|
28
28
|
activeRuntime: null,
|
|
29
29
|
// Active host LLM service injected via ctx.inject(['llm'])
|
|
30
30
|
activeLlm: null,
|
|
31
|
+
// Active host subprocess service injected via ctx.inject(['subprocess'])
|
|
32
|
+
activeSubprocess: null,
|
|
31
33
|
// Active Auto-Continue engine instance cleaned up on plugin dispose
|
|
32
34
|
activeAutoContinue: null,
|
|
33
35
|
// Recent idle/loop steer timestamps keyed by `sessionId:turn`
|
|
@@ -36,6 +38,10 @@ const hostState = {
|
|
|
36
38
|
subagentRootMap: new Map(),
|
|
37
39
|
// Cached subagent roster rows keyed by root session id
|
|
38
40
|
subagentTreeCache: new Map(),
|
|
41
|
+
// Dynamically discovered external Harness providers (codex / claude-code / acp / dsh-sdk)
|
|
42
|
+
detectedHarnessProviders: new Map(),
|
|
43
|
+
// In-flight external Harness activations tracked per root session for structural lock & emergency stop
|
|
44
|
+
activeBubbleRuns: new Map(),
|
|
39
45
|
// Monotonic sequence counter for injected handover message envelopes
|
|
40
46
|
handoffSeq: 0,
|
|
41
47
|
}
|
package/locale/en.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"meta": {
|
|
3
3
|
"title": "DSH Chief",
|
|
4
|
-
"description": "
|
|
4
|
+
"description": "Right-sidebar plugin for DSH: tracks task progress, saves notes before context compaction, and asks before editing your workspace. Read-only by default."
|
|
5
5
|
},
|
|
6
6
|
"ui": {
|
|
7
7
|
"brandName": "DSH Chief",
|
|
@@ -28,17 +28,17 @@
|
|
|
28
28
|
"observer": {
|
|
29
29
|
"title": "👁 Read-Only Observer",
|
|
30
30
|
"tag": "L0 · ⏸ Off",
|
|
31
|
-
"desc": "
|
|
31
|
+
"desc": "Read-only: no automatic actions or edits; gives summaries and advice when asked."
|
|
32
32
|
},
|
|
33
33
|
"collab": {
|
|
34
34
|
"title": "🤝 Daily Co-Pilot",
|
|
35
35
|
"tag": "L2 · 🛡 Patrol",
|
|
36
|
-
"desc": "
|
|
36
|
+
"desc": "No background model calls while idle; steps in on errors or blocked walls and asks before important changes."
|
|
37
37
|
},
|
|
38
38
|
"away": {
|
|
39
39
|
"title": "🚀 Away Managed",
|
|
40
40
|
"tag": "L3 · 🤖 Managed",
|
|
41
|
-
"desc": "
|
|
41
|
+
"desc": "Keeps watching progress, auto-compacts at 80%, stops after 30 calls or 300K tokens, and sends alerts at key points."
|
|
42
42
|
}
|
|
43
43
|
},
|
|
44
44
|
"notify": {
|
package/locale/zh.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"meta": {
|
|
3
3
|
"title": "DSH 参谋长",
|
|
4
|
-
"description": "
|
|
4
|
+
"description": "DSH 右侧栏插件:跟踪任务进度,压缩上下文前先存档,模型改工作区前先问你。默认只读。"
|
|
5
5
|
},
|
|
6
6
|
"ui": {
|
|
7
7
|
"brandName": "DSH 参谋长",
|
|
@@ -28,17 +28,17 @@
|
|
|
28
28
|
"observer": {
|
|
29
29
|
"title": "👁 只读旁观",
|
|
30
30
|
"tag": "L0 · ⏸ 关停",
|
|
31
|
-
"desc": "
|
|
31
|
+
"desc": "只看不改:不自动执行任何操作,需要时给摘要和建议。"
|
|
32
32
|
},
|
|
33
33
|
"collab": {
|
|
34
34
|
"title": "🤝 日常协作",
|
|
35
35
|
"tag": "L2 · 🛡 巡检",
|
|
36
|
-
"desc": "
|
|
36
|
+
"desc": "平时不在后台调用模型,报错或撞墙时才介入;重要改动逐项弹窗问你。"
|
|
37
37
|
},
|
|
38
38
|
"away": {
|
|
39
39
|
"title": "🚀 离桌托管",
|
|
40
40
|
"tag": "L3 · 🤖 托管",
|
|
41
|
-
"desc": "
|
|
41
|
+
"desc": "持续盯进度,上下文到 80% 自动压缩,30 次调用或 300K Token 后自动停,关键节点发通知。"
|
|
42
42
|
}
|
|
43
43
|
},
|
|
44
44
|
"notify": {
|
package/model-tools.js
CHANGED
|
@@ -16,6 +16,40 @@ import {
|
|
|
16
16
|
CHIEF_PERMISSION_META,
|
|
17
17
|
} from './chief.js'
|
|
18
18
|
import { normalizePermissionMode } from './chief-executor.js'
|
|
19
|
+
import { computeBubbleState } from './chief-network.js'
|
|
20
|
+
|
|
21
|
+
function summarizeBubbleSnapshot(secDeps, rootId, dir) {
|
|
22
|
+
try {
|
|
23
|
+
const rid = rootId || 'global'
|
|
24
|
+
const b = computeBubbleState(secDeps, rid, null, dir || null)
|
|
25
|
+
const clusterLen = Array.isArray(dir && dir.cluster) ? dir.cluster.length : 0
|
|
26
|
+
const linkedPeersCount = clusterLen > 0
|
|
27
|
+
? Math.max(0, clusterLen - 1)
|
|
28
|
+
: (Array.isArray(dir && dir.targets) ? dir.targets.filter(t => t && t.kind === 'peer-session').length : 0)
|
|
29
|
+
return {
|
|
30
|
+
locked: Boolean(b && b.locked),
|
|
31
|
+
enrolledHarnesses: (Array.isArray(b && b.enrolledHarnesses) ? b.enrolledHarnesses : []).map(h => ({
|
|
32
|
+
provider: h.provider,
|
|
33
|
+
label: h.label || h.provider,
|
|
34
|
+
role: h.role || h.roleHint || '',
|
|
35
|
+
installed: h.installed !== false,
|
|
36
|
+
configured: Boolean(h.configured),
|
|
37
|
+
running: Boolean(h.running),
|
|
38
|
+
})),
|
|
39
|
+
availableHarnesses: (Array.isArray(b && b.availableHarnesses) ? b.availableHarnesses : [])
|
|
40
|
+
.filter(h => h && h.installed !== false)
|
|
41
|
+
.map(h => ({
|
|
42
|
+
provider: h.provider,
|
|
43
|
+
label: h.label || h.provider,
|
|
44
|
+
role: h.role || h.roleHint || '',
|
|
45
|
+
configured: Boolean(h.configured),
|
|
46
|
+
})),
|
|
47
|
+
linkedPeersCount,
|
|
48
|
+
}
|
|
49
|
+
} catch {
|
|
50
|
+
return { locked: false, enrolledHarnesses: [], availableHarnesses: [], linkedPeersCount: 0 }
|
|
51
|
+
}
|
|
52
|
+
}
|
|
19
53
|
import {
|
|
20
54
|
STATUSES,
|
|
21
55
|
PRIORITIES,
|
|
@@ -107,7 +141,7 @@ export function createModelTools(deps) {
|
|
|
107
141
|
'Board operation (MUST be called whenever recording tasks/status/conclusions or relaying messages; plain text alone does NOT update the board or notify peers). '
|
|
108
142
|
+ 'Use "graph.plan" (or "task.batch") to plan a hierarchical/DAG task graph in one call (supports parentId, blockedBy, planStepId, targetPlanStepId, owner/subagent, intent, evidence). '
|
|
109
143
|
+ 'For multi-step workflows, define ordered steps via "plan.set" first and bind tasks/subagents with "planStepId" (and optional "targetPlanStepId") so the workflow topology displays step-by-step progress and subagent return arrows. '
|
|
110
|
-
+ 'Use "task.dispatch" to spawn or message a subagent, "team.steer" to steer a subagent, and "mail.send" to relay messages across lead/subagents/sessions. '
|
|
144
|
+
+ 'Use "task.dispatch" to spawn or message a subagent, "team.steer" to steer a subagent, and "mail.send" to relay messages or dispatch work across lead/subagents/linked sessions/enrolled Bubble harnesses (pass provider id as target). '
|
|
111
145
|
+ 'Use "inquiry.reply" (inquiryId, text) whenever you see a priority [INQUIRY #id] from DSH Chief — answer accurately and continue your current work immediately without stopping. '
|
|
112
146
|
+ 'Use "chief.request" (subject, text) to ask DSH Chief for cross-session coordination, permission elevation, to report exploration & planning results, or when blocked by an insurmountable guard wall that cannot be bypassed safely. '
|
|
113
147
|
+ 'Use "wall.list" (read-only) to inspect currently active persistent guard walls defending high-risk paths/commands. '
|
|
@@ -206,7 +240,7 @@ export function createModelTools(deps) {
|
|
|
206
240
|
},
|
|
207
241
|
step: { type: 'string', description: 'cursor.set: which plan step is open right now, in your own words.' },
|
|
208
242
|
next: { type: 'string', description: 'cursor.set: the very next action — concrete enough to execute without re-reading the transcript.' },
|
|
209
|
-
blocked: { type: 'string', description: 'cursor.set:
|
|
243
|
+
blocked: { type: 'string', description: 'cursor.set: ONLY fill when execution is genuinely stalled/cannot proceed (e.g. missing credentials, permission denied, unresolved error). MUST pass empty string "" when not blocked — NEVER put "无", "none", user preferences/rules, or resolved notes here.' },
|
|
210
244
|
clear: { type: 'boolean', description: 'cursor.set: wipe step / next / blocked instead of overwriting them.' },
|
|
211
245
|
expectedTaskId: { type: 'string', description: 'cursor.set: task id this cursor is working on — the panel highlights that node in the tree.' },
|
|
212
246
|
memoryId: { type: 'string', description: 'Memory entry id for memory.remove.' },
|
|
@@ -426,6 +460,8 @@ export function createModelTools(deps) {
|
|
|
426
460
|
const roster = await refreshSubagentTree(runtime, session, board)
|
|
427
461
|
const svc = runtime.get('agentTeams')
|
|
428
462
|
const rawTeamTasks = (svc && typeof svc.listTasks === 'function' && callerAgent) ? (svc.listTasks(callerAgent) || []) : []
|
|
463
|
+
const secDeps = makeChiefDeps(runtime)
|
|
464
|
+
const dir = await listPeerDirectory(secDeps, session || rawSession).catch(() => null)
|
|
429
465
|
return {
|
|
430
466
|
ok: true,
|
|
431
467
|
subagents: roster,
|
|
@@ -434,6 +470,7 @@ export function createModelTools(deps) {
|
|
|
434
470
|
owner: t.ownerName || '', blockedBy: t.blockedBy || [],
|
|
435
471
|
ready: t.ready, revision: t.revision,
|
|
436
472
|
})),
|
|
473
|
+
bubble: summarizeBubbleSnapshot(secDeps, session || rawSession, dir),
|
|
437
474
|
...summary(board, roster),
|
|
438
475
|
}
|
|
439
476
|
} catch (err) {
|
|
@@ -548,6 +585,7 @@ export function createModelTools(deps) {
|
|
|
548
585
|
ok: true,
|
|
549
586
|
inbox,
|
|
550
587
|
peers: dir.targets,
|
|
588
|
+
bubble: summarizeBubbleSnapshot(secDeps, session || rawSession, dir),
|
|
551
589
|
...summary(board, roster),
|
|
552
590
|
}
|
|
553
591
|
}
|