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/subagent-runtime.js
CHANGED
|
@@ -17,6 +17,7 @@ import {
|
|
|
17
17
|
deliverCrossMessage,
|
|
18
18
|
} from './chief.js'
|
|
19
19
|
import { resolveAlignedModelEffort } from './chief-state.js'
|
|
20
|
+
import { computeBubbleState } from './chief-network.js'
|
|
20
21
|
import {
|
|
21
22
|
API,
|
|
22
23
|
newId,
|
|
@@ -840,16 +841,68 @@ export function createSubagentRuntime(deps) {
|
|
|
840
841
|
}
|
|
841
842
|
|
|
842
843
|
function linkedPeersForSession(runtime, rootId) {
|
|
843
|
-
|
|
844
|
+
const emptyBubble = {
|
|
845
|
+
locked: false,
|
|
846
|
+
enrolledHarnesses: [],
|
|
847
|
+
availableHarnesses: [],
|
|
848
|
+
standbySessionsCount: 0,
|
|
849
|
+
}
|
|
850
|
+
if (!rootId) return { linkedPeersCount: 0, linkedPeersProgress: [], bubbleSquad: emptyBubble }
|
|
851
|
+
const rt = runtime || deps.hostState.activeRuntime
|
|
844
852
|
const state = loadChiefState()
|
|
845
853
|
const cluster = getLinkedCluster(state, rootId)
|
|
854
|
+
let bubbleState = null
|
|
855
|
+
try {
|
|
856
|
+
bubbleState = computeBubbleState({ runtime: rt, hostState: deps.hostState }, rootId, state)
|
|
857
|
+
} catch {}
|
|
858
|
+
const enrolledHarnesses = (Array.isArray(bubbleState && bubbleState.enrolledHarnesses) ? bubbleState.enrolledHarnesses : [])
|
|
859
|
+
.filter(h => h && (h.installed !== false || h.running))
|
|
860
|
+
.map(h => ({
|
|
861
|
+
provider: String(h.provider || ''),
|
|
862
|
+
label: String(h.label || h.provider || ''),
|
|
863
|
+
role: String(h.role || h.roleHint || ''),
|
|
864
|
+
running: Boolean(h.running),
|
|
865
|
+
configured: Boolean(h.configured),
|
|
866
|
+
}))
|
|
867
|
+
const availableHarnesses = (Array.isArray(bubbleState && bubbleState.availableHarnesses) ? bubbleState.availableHarnesses : [])
|
|
868
|
+
.filter(h => h && h.installed !== false)
|
|
869
|
+
.map(h => ({
|
|
870
|
+
provider: String(h.provider || ''),
|
|
871
|
+
label: String(h.label || h.provider || ''),
|
|
872
|
+
role: String(h.role || h.roleHint || ''),
|
|
873
|
+
configured: Boolean(h.configured),
|
|
874
|
+
}))
|
|
875
|
+
const linkedSet = new Set(Array.isArray(cluster) ? cluster.map(id => String(id)) : [])
|
|
876
|
+
linkedSet.add(String(rootId))
|
|
877
|
+
let standbySessionsCount = 0
|
|
878
|
+
try {
|
|
879
|
+
const agentsSvc = rt && typeof rt.get === 'function' ? rt.get('agents') : null
|
|
880
|
+
const rawAgents = agentsSvc && typeof agentsSvc.list === 'function' ? agentsSvc.list() : []
|
|
881
|
+
const standbyRoots = new Set()
|
|
882
|
+
for (const ag of Array.isArray(rawAgents) ? rawAgents : []) {
|
|
883
|
+
if (!ag || !ag.id || ag.parentId) continue
|
|
884
|
+
const kind = String(ag.kind || ag.agentKind || '').toLowerCase()
|
|
885
|
+
if (kind === 'subagent') continue
|
|
886
|
+
const agRoot = resolveRootSessionId(ag.id, ag)
|
|
887
|
+
if (!agRoot || agRoot !== String(ag.id)) continue
|
|
888
|
+
if (!linkedSet.has(agRoot)) standbyRoots.add(agRoot)
|
|
889
|
+
}
|
|
890
|
+
standbySessionsCount = standbyRoots.size
|
|
891
|
+
} catch {}
|
|
892
|
+
const bubbleSquad = {
|
|
893
|
+
locked: Boolean(bubbleState && bubbleState.locked),
|
|
894
|
+
enrolledHarnesses,
|
|
895
|
+
availableHarnesses,
|
|
896
|
+
standbySessionsCount,
|
|
897
|
+
}
|
|
846
898
|
if (!Array.isArray(cluster) || cluster.length <= 1) {
|
|
847
|
-
return { linkedPeersCount: 0, linkedPeersProgress: [] }
|
|
899
|
+
return { linkedPeersCount: 0, linkedPeersProgress: [], bubbleSquad }
|
|
848
900
|
}
|
|
849
|
-
const linkedPeersProgress = collectClusterPeerProgress(makeChiefDeps(
|
|
901
|
+
const linkedPeersProgress = collectClusterPeerProgress(makeChiefDeps(rt), cluster, rootId)
|
|
850
902
|
return {
|
|
851
903
|
linkedPeersCount: Math.max(0, cluster.length - 1),
|
|
852
904
|
linkedPeersProgress,
|
|
905
|
+
bubbleSquad,
|
|
853
906
|
}
|
|
854
907
|
}
|
|
855
908
|
|
|
@@ -920,6 +973,7 @@ export function createSubagentRuntime(deps) {
|
|
|
920
973
|
const rt = runtime || deps.hostState.activeRuntime
|
|
921
974
|
return {
|
|
922
975
|
runtime: rt,
|
|
976
|
+
hostState: deps.hostState,
|
|
923
977
|
getLlm: () => deps.hostState.activeLlm || (rt ? rt.get('llm') : null),
|
|
924
978
|
getAttachments: () => safe(() => (rt ? rt.get('attachments') : null), null),
|
|
925
979
|
getSessionCwd: (sid) => getSessionCwd(rt, sid),
|