dsh-chief 1.4.0 → 1.6.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 +74 -0
- package/README.en.md +68 -54
- package/README.md +69 -54
- package/api-routes.js +204 -3
- package/archive-core.js +136 -8
- package/archive-dossiers.js +450 -20
- package/archive-precipitated.js +115 -36
- package/auto-continue.js +13 -5
- package/board-actions.js +120 -10
- package/board-schema.js +331 -6
- package/chief-approvals.js +176 -11
- package/chief-archives.js +158 -30
- package/chief-commands.js +567 -101
- package/chief-compaction.js +1 -0
- package/chief-models.js +264 -27
- package/chief-review.js +455 -107
- package/chief-state.js +918 -33
- package/chief-view.js +20 -14
- package/client.js +13238 -7190
- package/digest.js +22 -10
- package/idle-guard.js +233 -8
- package/locale/en.json +71 -0
- package/locale/zh.json +71 -0
- package/model-tools.js +21 -6
- package/package.json +11 -4
- package/runtime-hooks.js +358 -20
- package/safety/invariant-guards.js +2 -1
- package/subagent-runtime.js +285 -2
package/chief-view.js
CHANGED
|
@@ -25,6 +25,7 @@ import {
|
|
|
25
25
|
beginChiefActiveWork,
|
|
26
26
|
endChiefActiveWork,
|
|
27
27
|
getChiefActiveWork,
|
|
28
|
+
summarizeLlmLedger,
|
|
28
29
|
} from './chief-state.js'
|
|
29
30
|
import { listChiefModels, callChiefLlm } from './chief-models.js'
|
|
30
31
|
import { collectClusterPeerProgress, listPeerDirectory } from './chief-network.js'
|
|
@@ -263,28 +264,30 @@ function buildNarrativeInput({ board, facts, cluster, targets, peerProgress = []
|
|
|
263
264
|
const dGlob = Array.isArray(archiveDigest.deskGlobalItems) ? archiveDigest.deskGlobalItems : []
|
|
264
265
|
const dFlip = Array.isArray(archiveDigest.deskFlippedItems) ? archiveDigest.deskFlippedItems : []
|
|
265
266
|
const mGlob = Array.isArray(archiveDigest.mountedGlobalItems) ? archiveDigest.mountedGlobalItems : []
|
|
266
|
-
const
|
|
267
|
+
const sAll = Array.isArray(archiveDigest.sessionItems) ? archiveDigest.sessionItems : []
|
|
268
|
+
const gHooks = Array.isArray(archiveDigest.globalHookIndex) ? archiveDigest.globalHookIndex : []
|
|
269
|
+
const recentWatch = Array.isArray(archiveDigest.recentlyUnpinnedWatch) ? archiveDigest.recentlyUnpinnedWatch : []
|
|
267
270
|
const deskAll = [
|
|
268
271
|
...dSess.map(it => `[桌面·本局(主可见)] 《${clamp(it.title, 40)}》:${clamp(it.summary || it.body, 140)}`),
|
|
269
272
|
...dGlob.map(it => `[桌面·全局(主可见)] 《${clamp(it.title, 40)}》:${clamp(it.summary || it.body, 140)}`),
|
|
270
|
-
...dFlip.map(it => `[
|
|
273
|
+
...dFlip.map(it => `[桌面·冷藏已翻牌(主可见)] 《${clamp(it.title, 40)}》:${clamp(it.summary || it.rawBody, 140)}`),
|
|
271
274
|
]
|
|
272
275
|
if (deskAll.length > 0) {
|
|
273
|
-
lines.push('', '
|
|
276
|
+
lines.push('', '【当前认知桌面置顶(主对话与参谋长共同可见)】', ...deskAll.slice(0, 6).map(x => '- ' + x))
|
|
274
277
|
}
|
|
275
278
|
if (mGlob.length > 0) {
|
|
276
|
-
lines.push('', '
|
|
279
|
+
lines.push('', '【参谋长已拉阅的全局档案(主对话不可见)】')
|
|
277
280
|
for (const it of mGlob.slice(0, 5)) {
|
|
278
281
|
lines.push(`- [全局参阅] 《${clamp(it.title, 40)}》:${clamp(it.summary || it.body, 120)}`)
|
|
279
282
|
}
|
|
280
283
|
}
|
|
281
|
-
const
|
|
282
|
-
...(
|
|
283
|
-
...
|
|
284
|
-
...
|
|
284
|
+
const vaultIndexLines = [
|
|
285
|
+
...sAll.filter(it => !it.takenOut).slice(0, 6).map(it => `- [本局档案·参谋随时可读] 《${clamp(it.title, 36)}》${it.hasHook ? '🪝[' + (it.hookKeywords || []).slice(0, 3).join('·') + ']' : '(待织钩)'}:${clamp(it.summary, 90)}`),
|
|
286
|
+
...gHooks.slice(0, 5).map(it => `- [全局钩子·参谋见钩可拉] 《${clamp(it.title, 36)}》🪝[${(it.hookKeywords || []).slice(0, 3).join('·')}] ${clamp(it.hookCue, 60)}`),
|
|
287
|
+
...recentWatch.slice(0, 3).map(w => `- [近期撤下桌面·待观察] 《${clamp(w.title, 36)}》`),
|
|
285
288
|
]
|
|
286
|
-
if (
|
|
287
|
-
lines.push('', '
|
|
289
|
+
if (vaultIndexLines.length > 0) {
|
|
290
|
+
lines.push('', '【参谋长后台档案柜与钩子索引(未置顶桌面,主对话不注入)】', ...vaultIndexLines)
|
|
288
291
|
}
|
|
289
292
|
}
|
|
290
293
|
|
|
@@ -370,7 +373,7 @@ export async function getChiefView(deps, sessionId, { regenerate = false, autoSu
|
|
|
370
373
|
const view = clusterView(state, rootId)
|
|
371
374
|
const modelsInfo = await listChiefModels(deps, false, rootId)
|
|
372
375
|
const effCfgBefore = resolveWorkspaceConfig(state, rootId)
|
|
373
|
-
const
|
|
376
|
+
const runMode = effCfgBefore.runMode || 'off'
|
|
374
377
|
const isConciseBrief = Boolean(effCfgBefore.tacticalModes && effCfgBefore.tacticalModes.conciseBrief)
|
|
375
378
|
const currentSig = view.clusterSig || computeClusterSig(directory.cluster)
|
|
376
379
|
const peerProgress = directory.cluster.length > 1
|
|
@@ -402,7 +405,7 @@ export async function getChiefView(deps, sessionId, { regenerate = false, autoSu
|
|
|
402
405
|
const isFresh = !rawInput || (hasSaved && view.narrative.hash === inputHash)
|
|
403
406
|
const cooledForAuto = Date.now() - lastSummaryAt >= AUTO_SUMMARY_COOLDOWN_MS
|
|
404
407
|
const cooledForChat = Date.now() - lastSummaryAt >= CHAT_OPPORTUNISTIC_SUMMARY_COOLDOWN_MS
|
|
405
|
-
const allowBackgroundSummary =
|
|
408
|
+
const allowBackgroundSummary = runMode === 'managed' && autoSummarize && !isFresh && cooledForAuto
|
|
406
409
|
const allowChatSummary = Boolean(chatTriggered) && !isFresh && cooledForChat
|
|
407
410
|
|
|
408
411
|
// Opportunistically refresh stale narrative in background after Chief chats (60s debounce),
|
|
@@ -417,6 +420,7 @@ export async function getChiefView(deps, sessionId, { regenerate = false, autoSu
|
|
|
417
420
|
: NARRATIVE_SYSTEM
|
|
418
421
|
const res = await callChiefLlm(deps, {
|
|
419
422
|
sessionId: rootId,
|
|
423
|
+
reasonKind: chatTriggered ? 'chat_summary' : 'auto_summary',
|
|
420
424
|
system: sysPrompt,
|
|
421
425
|
prompt: rawInput + (isConciseBrief
|
|
422
426
|
? '\n\n请开启【极简战报模式】:分结构列出多个简明短句,不写具体数字参数,精确概括现状:'
|
|
@@ -500,8 +504,8 @@ export async function getChiefView(deps, sessionId, { regenerate = false, autoSu
|
|
|
500
504
|
!_skipAutoPilotCheck
|
|
501
505
|
&& rootId
|
|
502
506
|
&& rootId !== 'global'
|
|
503
|
-
&& effectiveConfigBeforeStop.autoPilot
|
|
504
|
-
&& effectiveConfigBeforeStop.
|
|
507
|
+
&& (effectiveConfigBeforeStop.autoPilot || effectiveConfigBeforeStop.runMode === 'managed')
|
|
508
|
+
&& effectiveConfigBeforeStop.runMode === 'managed'
|
|
505
509
|
&& !effectiveConfigBeforeStop.stopped
|
|
506
510
|
) {
|
|
507
511
|
if (idleAutoPilotHook) {
|
|
@@ -563,6 +567,8 @@ export async function getChiefView(deps, sessionId, { regenerate = false, autoSu
|
|
|
563
567
|
inquiries: (Array.isArray(ownWs.inquiries) ? ownWs.inquiries : []).slice(-12).reverse(),
|
|
564
568
|
guardWalls: listGuardWalls({ cwd: resolveSessionWorkspaceCwd(deps, rootId) }),
|
|
565
569
|
activeWork: getChiefActiveWork(rootId),
|
|
570
|
+
llmLedger: summarizeLlmLedger(ownWs.llmLedger, effectiveConfig),
|
|
571
|
+
alertEvents: (Array.isArray(ownWs.alertEvents) ? ownWs.alertEvents : []).slice(-12),
|
|
566
572
|
auditLog: (Array.isArray(ownWs.auditLog) ? ownWs.auditLog : []).slice(-50).reverse(),
|
|
567
573
|
}
|
|
568
574
|
}
|