@shgroup/dsh-serenity-hooks 1.137.2 → 1.137.4
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/dsh.plugin.json +1 -1
- package/lib/{ccc-roots-Bg4Eq2X3.js → ccc-roots-B6dJON2X.js} +1 -1
- package/lib/index.js +31 -23
- package/lib/{injection-BVKPD4Yf.js → injection-ME-aoZVl.js} +1 -1
- package/lib/{observation-BIpcL_F3.js → observation-DiD_yJjS.js} +2 -2
- package/lib/{profile-RuvXAGBX.js → profile-CRcW3ifg.js} +34 -1
- package/lib/{rebuild-zCm04DGI.js → rebuild-BjOT8IDK.js} +4 -4
- package/lib/{scheduler-DMF2hKeT.js → scheduler-pOtONqPy.js} +3 -3
- package/lib/seams/cognitive-trajectory-lifecycle.d.ts +9 -1
- package/lib/{service-TiJlHI6n.js → service-mYmQXFFT.js} +5 -5
- package/lib/{session-BUyOHV12.js → session-Bi6owHoL.js} +3 -3
- package/lib/{settings-zIGSzPPG.js → settings-YC-csZus.js} +1 -1
- package/lib/{status-8oXxyBw6.js → status-BwfDsakn.js} +2 -2
- package/lib/{subscriptions-DLLyoLSW.js → subscriptions-DBoO0GSO.js} +3 -3
- package/lib/trajectory/reconstruct.d.ts +0 -8
- package/package.json +1 -1
package/dsh.plugin.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"id": "dsh-serenity-hooks",
|
|
3
|
-
"version": "1.137.
|
|
3
|
+
"version": "1.137.4",
|
|
4
4
|
"main": "lib/index.js",
|
|
5
5
|
"description": "宁静号 ACC harness(Native Cordis 插件):给 DSH 装一个「AI 工作区」——14 个工具(container_fs/cognitive_trajectory/dashboard/container_git/msm/praxis/ontology/serenity-skill-creator/localstore/container_admin/browser_slot;另三个 im-bridge/diagram/reconstruct 按条件出现)+ 机械约束(安全模式/工作区围墙/密钥守卫)+ 认知轨迹日志与原地重建 + 网页登录入口/IM 桥/认知轨迹唤醒注册表 + 浏览器槽位管理(≤20 个独立 profile 的 Chrome 槽位,带占用归属与异常时向所属会话反向注入提醒)。轨迹声明 = 轨迹目录下的 trajectory.json(约束面 + 旧标识 uid + CRO 机器绑定 cro.host;旧名 trajectory-constraint.json / skiff.json 仍在读取族里);轨迹提示词 = 轨迹目录下的 PROMPT.md(一条轨迹「是谁、按什么章程工作」,所有轨迹通用,追加在容器层与质量层之后,不替换它们)。适配 DSH 0.1.7-rc.1 / 0.2.0-rc.1 / 0.2.1-rc.1(三档,deepseek-ai/deepseek-harness)。",
|
|
6
6
|
"engines": {
|
|
@@ -235,7 +235,7 @@ async function listCccs(ctx, opts = {}) {
|
|
|
235
235
|
if (typeof defaultRoot === "string" && defaultRoot !== "" && !c.roots.includes(defaultRoot)) c.roots.unshift(defaultRoot);
|
|
236
236
|
let rolesOf = null;
|
|
237
237
|
if (opts.withRoles === true) {
|
|
238
|
-
const { listTrajectoryConstraints } = await import("./profile-
|
|
238
|
+
const { listTrajectoryConstraints } = await import("./profile-CRcW3ifg.js").then((n) => n.a);
|
|
239
239
|
rolesOf = (root) => {
|
|
240
240
|
try {
|
|
241
241
|
return listTrajectoryConstraints(root).map((p) => p.code);
|
package/lib/index.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import { i as __toESM, n as __exportAll } from "./rolldown-runtime-B4iAMlE-.js";
|
|
2
|
-
import { d as hostSessions, f as hostSettings, i as cccRootForExec, m as hostWebServer, n as agentCwdFor, o as listCccs, p as hostWeb, r as cccRootForCwd, t as NO_CCC_FROM_AGENT_CWD, u as hostService } from "./ccc-roots-
|
|
2
|
+
import { d as hostSessions, f as hostSettings, i as cccRootForExec, m as hostWebServer, n as agentCwdFor, o as listCccs, p as hostWeb, r as cccRootForCwd, t as NO_CCC_FROM_AGENT_CWD, u as hostService } from "./ccc-roots-B6dJON2X.js";
|
|
3
3
|
import { a as findSerenityRoot$1, d as readCccName, g as resolveInside, l as pathInside, m as readUserQuotesEnabled, p as readTrajectorySubscriptions, s as loadSerenityConfig, t as DEFAULT_SERENITY_CONFIG_PATHS } from "./ccc-DSMqTrRU.js";
|
|
4
4
|
import { A as useSession, C as resolveSessionByTitle, D as showSession, E as setActiveSessionInfo, F as isoLocal, I as localFileStamp, M as TRAJECTORY_LEGACY_FILENAMES, O as summarize, S as readTrajectoryUid, T as sessionsRoot, _ as listSessions, b as parseTrajectoryCode, c as UID_FILENAME, d as createSession, j as TRAJECTORY_FILENAME, k as trajectoryDescOf, l as archiveSession, m as getActiveSessionInfo, o as COGNITIVE_TRAJECTORY_ACTIONS, p as findSession, u as clearActiveSessionInfo, v as namingTitleFor, w as sessionEvents, y as parseSessionContextFromEvents } from "./bind-file-Dy6Qmm7z.js";
|
|
5
5
|
import { n as checkLocalstoreGitCompliance, o as readStore, s as runLocalStore, t as LOCALSTORE_SCOPES } from "./service-BRUHmVFn.js";
|
|
6
6
|
import { d as findPackageRoot, i as constraintSystemPromptSource, l as resolveConstraintSystemPrompt, r as constraintCognitiveTrajectory, t as TRAJECTORY_CONSTRAINT_HINT, u as ACC_VERSION } from "./rules-BYeykzys.js";
|
|
7
7
|
import { a as loadMsmEntries, c as docsPointer, i as findEntry, l as setWeixinSendEndpoint, n as CCC_CONFIG_REFERENCE, o as runMsm, s as runMsmAsync, t as ACC_CATALOG } from "./service-DF23HvHY.js";
|
|
8
|
-
import { c as replacesDefaultIdentity, i as listTrajectoryConstraints, l as trajectoryCodeForSession, n as findDirNameByCode, o as readTrajectoryConstraintAt, r as isTrajectoryConstrained, s as readTrajectoryConstraintByCode, t as TRAJECTORY_CONSTRAINT_FILENAME } from "./profile-
|
|
9
|
-
import { A as TRAJECTORY_PROMPT_FILENAME, C as recordToolUsage, D as buildResourceNameSuffix, E as buildResourceIndex, O as isSafeSkillName, S as verifyTotpCode, T as SKILL_ONTOLOGY_FILE, _ as projectKnownWorkspaces, a as trajectoryConstraintFor, b as FACE_PORTS, c as trajectoryWorkspaceMdPath, d as splitModel, f as registerCognitiveTrajectorySkillSection, g as migrateLegacyLocalstore, h as applyWirePatch, i as getTrajectoryAgent, j as hasTrajectoryPrompt, k as truncateContent, l as unregisterTrajectorySession, m as registerEntrySkillSectionGlobal, n as deliverToTrajectory, o as trajectoryConstraintMsmGate, p as registerEntrySkillSection, r as ensureWorkspacePromptSection, s as trajectoryConstraintParticipates, t as createTrajectoryAgent, u as workspaceCognitiveTrajectoryLine, v as readAdvancedSettings, w as REFERENCE_DIR, x as MECHANISM_PORTS, y as toWire } from "./session-
|
|
10
|
-
import { d as readLastBound, f as resolveSessionCognitiveTrajectoryLabel, i as toMessage, l as findTrajectoryOfSession, n as deliver, o as PLUGIN_SOURCE, r as makeInjection, s as appendBound, u as listBoundSessionIds } from "./injection-
|
|
11
|
-
import { c as buildCroSnapshot, d as WAKE_CATCH_UP_MS, f as addWake, i as sendToCognitiveTrajectory, n as registerWakeScheduler, o as registerCroTurnTracking, s as registerDisposer, t as createAndBindTarget, u as CARRIER_OPENING_MARK } from "./scheduler-
|
|
12
|
-
import { i as hostAliveProbe, n as readSimpleSettings, r as registerSettingsSection } from "./settings-
|
|
8
|
+
import { c as replacesDefaultIdentity, i as listTrajectoryConstraints, l as trajectoryCodeForSession, n as findDirNameByCode, o as readTrajectoryConstraintAt, r as isTrajectoryConstrained, s as readTrajectoryConstraintByCode, t as TRAJECTORY_CONSTRAINT_FILENAME } from "./profile-CRcW3ifg.js";
|
|
9
|
+
import { A as TRAJECTORY_PROMPT_FILENAME, C as recordToolUsage, D as buildResourceNameSuffix, E as buildResourceIndex, O as isSafeSkillName, S as verifyTotpCode, T as SKILL_ONTOLOGY_FILE, _ as projectKnownWorkspaces, a as trajectoryConstraintFor, b as FACE_PORTS, c as trajectoryWorkspaceMdPath, d as splitModel, f as registerCognitiveTrajectorySkillSection, g as migrateLegacyLocalstore, h as applyWirePatch, i as getTrajectoryAgent, j as hasTrajectoryPrompt, k as truncateContent, l as unregisterTrajectorySession, m as registerEntrySkillSectionGlobal, n as deliverToTrajectory, o as trajectoryConstraintMsmGate, p as registerEntrySkillSection, r as ensureWorkspacePromptSection, s as trajectoryConstraintParticipates, t as createTrajectoryAgent, u as workspaceCognitiveTrajectoryLine, v as readAdvancedSettings, w as REFERENCE_DIR, x as MECHANISM_PORTS, y as toWire } from "./session-Bi6owHoL.js";
|
|
10
|
+
import { d as readLastBound, f as resolveSessionCognitiveTrajectoryLabel, i as toMessage, l as findTrajectoryOfSession, n as deliver, o as PLUGIN_SOURCE, r as makeInjection, s as appendBound, u as listBoundSessionIds } from "./injection-ME-aoZVl.js";
|
|
11
|
+
import { c as buildCroSnapshot, d as WAKE_CATCH_UP_MS, f as addWake, i as sendToCognitiveTrajectory, n as registerWakeScheduler, o as registerCroTurnTracking, s as registerDisposer, t as createAndBindTarget, u as CARRIER_OPENING_MARK } from "./scheduler-pOtONqPy.js";
|
|
12
|
+
import { i as hostAliveProbe, n as readSimpleSettings, r as registerSettingsSection } from "./settings-YC-csZus.js";
|
|
13
13
|
import { a as readFeishuCredential, c as readWeixinSettings, d as weixinInboundDir, f as weixinSessionIdForTrajectory, i as matchWeixinRoute, n as extractWeixinText, r as hasVoiceItem, s as readWeixinCredential, t as extractWeixinMedia, u as sanitizeFileName$1 } from "./route-DcUo9alz.js";
|
|
14
14
|
import { i as runImBridge, n as isImWiredTrajectory, r as registerImChannel, t as imChannelIds } from "./channels-Covd8vLQ.js";
|
|
15
|
-
import { a as loadOpencodeSkill, c as summarizeHostContract, f as forgetNonCccToolVisibility, g as forgetToolVisibility, h as syncToolVisibility, i as listOpencodeSkillDirs, m as registerGuards, n as readDshVersion, o as compareSemver, r as setSafeMode, s as hostContractReport, t as getStatus } from "./status-
|
|
16
|
-
import { a as ACK_PREFIX, c as eventToken, i as resolveSessionMdPath, l as DEFAULT_FAKE_INITIAL_MESSAGES, o as ASSISTANT_PREFIX, r as registerRebuildTurnHook, s as LOG_FILE_REL, t as buildRebuildAnchor, u as registerBootstrap } from "./rebuild-
|
|
17
|
-
import { i as subscriptionStats, n as registerTrajectorySubscriptions, r as subscriptionEval, t as defaultSubscriptionDeps } from "./subscriptions-
|
|
15
|
+
import { a as loadOpencodeSkill, c as summarizeHostContract, f as forgetNonCccToolVisibility, g as forgetToolVisibility, h as syncToolVisibility, i as listOpencodeSkillDirs, m as registerGuards, n as readDshVersion, o as compareSemver, r as setSafeMode, s as hostContractReport, t as getStatus } from "./status-BwfDsakn.js";
|
|
16
|
+
import { a as ACK_PREFIX, c as eventToken, i as resolveSessionMdPath, l as DEFAULT_FAKE_INITIAL_MESSAGES, o as ASSISTANT_PREFIX, r as registerRebuildTurnHook, s as LOG_FILE_REL, t as buildRebuildAnchor, u as registerBootstrap } from "./rebuild-BjOT8IDK.js";
|
|
17
|
+
import { i as subscriptionStats, n as registerTrajectorySubscriptions, r as subscriptionEval, t as defaultSubscriptionDeps } from "./subscriptions-DBoO0GSO.js";
|
|
18
18
|
import { c as sendTextMessage, i as getUpdates, l as sendTyping, n as downloadMedia, o as markdownToPlainText, r as getConfig, s as sendFileMessage, t as TypingStatus, u as sniffImageExt } from "./ilink-CsZ-f64q.js";
|
|
19
19
|
import { a as registerImAccountImpl, i as normalizeAccountChannel, n as getImAccountImpl, r as imAccountChannels } from "./accounts-BHQbakUh.js";
|
|
20
20
|
import { createRequire } from "node:module";
|
|
@@ -515,7 +515,7 @@ const KIT_ACTIONS = [
|
|
|
515
515
|
async function runKit(root, args, hostCtx) {
|
|
516
516
|
switch (args.action) {
|
|
517
517
|
case "health": {
|
|
518
|
-
const { containerStatus } = await import("./observation-
|
|
518
|
+
const { containerStatus } = await import("./observation-DiD_yJjS.js");
|
|
519
519
|
const s = containerStatus({
|
|
520
520
|
root,
|
|
521
521
|
hostCtx
|
|
@@ -561,7 +561,7 @@ async function runKit(root, args, hostCtx) {
|
|
|
561
561
|
}
|
|
562
562
|
case "diag": {
|
|
563
563
|
if (hostCtx === void 0) throw new Error("diag requires the plugin context (live session data unavailable without it)");
|
|
564
|
-
const { runDiag, renderDiag } = await import("./service-
|
|
564
|
+
const { runDiag, renderDiag } = await import("./service-mYmQXFFT.js");
|
|
565
565
|
return renderDiag(await runDiag(hostCtx, root ?? ""));
|
|
566
566
|
}
|
|
567
567
|
default: throw new Error(`Unknown action: ${args.action}`);
|
|
@@ -6668,7 +6668,7 @@ function createCognitiveTrajectoryTool(ctx) {
|
|
|
6668
6668
|
};
|
|
6669
6669
|
}
|
|
6670
6670
|
} catch {}
|
|
6671
|
-
const { queueRebuild } = await import("./rebuild-
|
|
6671
|
+
const { queueRebuild } = await import("./rebuild-BjOT8IDK.js").then((n) => n.n);
|
|
6672
6672
|
const result = await queueRebuild(ctx, {
|
|
6673
6673
|
root,
|
|
6674
6674
|
note: args.note,
|
|
@@ -8236,7 +8236,8 @@ function reminderText(code) {
|
|
|
8236
8236
|
* 理由见该常量的头注(持久文件 vs 只用一次的交界材料必须分家)。
|
|
8237
8237
|
*/
|
|
8238
8238
|
/**
|
|
8239
|
-
* 交接提醒(**rebuild 与 reconstruct 共用同一条文案**,2026-11-16 owner
|
|
8239
|
+
* 交接提醒(**rebuild 与 reconstruct 共用同一条文案**,2026-11-16 owner 裁定;
|
|
8240
|
+
* 2026-11-17 owner 再裁 **1.A:文案统一指名 `rebuild`**)。
|
|
8240
8241
|
*
|
|
8241
8242
|
* 🔴 为什么必须无差别:`rebuild`(原地清空、会话 id 不变)与 `reconstruct`
|
|
8242
8243
|
* (另开日志、旧会话归档)对**会话本身**做的是同一件事——**把它换掉**。
|
|
@@ -8244,6 +8245,13 @@ function reminderText(code) {
|
|
|
8244
8245
|
* 让模型看见两条不同文案 ⇒ 它要判断"我该调哪个" ⇒ 把一个机械决定变成一次思考,
|
|
8245
8246
|
* 既浪费注意力,又可能选错。
|
|
8246
8247
|
*
|
|
8248
|
+
* 🔴🔴 **1.A 的落地(2026-11-17)**:本函数**只指名 `rebuild`**,绝不出现 `reconstruct`。
|
|
8249
|
+
* 理由是执行面已经接好了:`cognitive-trajectory.ts` 的 `case 'rebuild'` 会在
|
|
8250
|
+
* **累计量 ≥ `RECONSTRUCT_TOKEN_THRESHOLD`** 时把它**机械改道**成 `reconstruct`。
|
|
8251
|
+
* ⇒ 模型只需知道**一个**动作名;"哪条路"由 ACC 算,不由模型猜。
|
|
8252
|
+
* ⚠️ 这条裁定同时废止了 `trajectory/reconstruct.ts` 的 `reconstructReminderText()`
|
|
8253
|
+
* (它自 v1.121.0 起**从未接线**,一直是死代码)——已随本版删除。
|
|
8254
|
+
*
|
|
8247
8255
|
* 选路由本文件的 `registerKeeper` 一侧机械完成(`selectHandoverPath` 只是纯函数),规则见那里的注释。
|
|
8248
8256
|
*
|
|
8249
8257
|
* ⚠️ 便签落点 = `LOG/LOG.md` 的 `## Handover note` 节(2026-11-16 裁定):
|
|
@@ -8408,15 +8416,15 @@ function registerKeeper(ctx, opts = {}) {
|
|
|
8408
8416
|
const thresholdK = readSimpleSettings().rebuildThresholdK;
|
|
8409
8417
|
const pressure = readContextPressure(ctx, session);
|
|
8410
8418
|
const contextOver = pressure !== null && pressure.projectedTokens > 0 && pressure.projectedTokens >= thresholdK * 1e3;
|
|
8411
|
-
|
|
8412
|
-
try {
|
|
8413
|
-
totalOver = shouldOfferReconstruct(ctx, session);
|
|
8414
|
-
} catch {}
|
|
8415
|
-
if (contextOver || totalOver) {
|
|
8419
|
+
if (contextOver) {
|
|
8416
8420
|
const key = exec.agent?.session?.id ?? "global";
|
|
8417
8421
|
const st = rebuildReminderStates.get(key) ?? { consecutive: 0 };
|
|
8418
8422
|
st.consecutive += 1;
|
|
8419
8423
|
rebuildReminderStates.set(key, st);
|
|
8424
|
+
let totalOver = false;
|
|
8425
|
+
try {
|
|
8426
|
+
totalOver = shouldOfferReconstruct(ctx, session);
|
|
8427
|
+
} catch {}
|
|
8420
8428
|
st.path = selectHandoverPath({
|
|
8421
8429
|
contextOver,
|
|
8422
8430
|
totalOver
|
|
@@ -9686,7 +9694,7 @@ function registerStatusApi(ctx, opts = {}) {
|
|
|
9686
9694
|
});
|
|
9687
9695
|
}
|
|
9688
9696
|
const { saveWeixinRoutes } = await import("./route-DcUo9alz.js").then((n) => n.l);
|
|
9689
|
-
const { findDirNameByCode } = await import("./profile-
|
|
9697
|
+
const { findDirNameByCode } = await import("./profile-CRcW3ifg.js").then((n) => n.a);
|
|
9690
9698
|
for (const r of routes) if (findDirNameByCode(root, r.trajectory) === null) {
|
|
9691
9699
|
sendJson$2(res, 400, { error: `unknown trajectory: ${r.trajectory} (no such trajectory code in ${root})` });
|
|
9692
9700
|
return;
|
|
@@ -14137,7 +14145,7 @@ const MEDIA_MAX_BYTES = 20971520;
|
|
|
14137
14145
|
*/
|
|
14138
14146
|
async function resolveCccRootByAlias(ctx, alias) {
|
|
14139
14147
|
try {
|
|
14140
|
-
const { listCccs } = await import("./ccc-roots-
|
|
14148
|
+
const { listCccs } = await import("./ccc-roots-B6dJON2X.js").then((n) => n.a);
|
|
14141
14149
|
const entries = await listCccs(ctx);
|
|
14142
14150
|
const byName = entries.find((e) => e.name === alias);
|
|
14143
14151
|
if (byName) return byName.root;
|
|
@@ -14205,7 +14213,7 @@ async function resolveInboundTarget(ctx, input) {
|
|
|
14205
14213
|
});
|
|
14206
14214
|
return null;
|
|
14207
14215
|
}
|
|
14208
|
-
const { findDirNameByCode } = await import("./profile-
|
|
14216
|
+
const { findDirNameByCode } = await import("./profile-CRcW3ifg.js").then((n) => n.a);
|
|
14209
14217
|
if (findDirNameByCode(root, target.role) === null) {
|
|
14210
14218
|
const detail = `目标 CCC "${target.ccc}" 内没有编码为 "${target.role}" 的认知轨迹`;
|
|
14211
14219
|
console.error(`[serenity-hooks] ✗ human-channel: ${detail}(account=${input.account} user=${input.user})—— 该消息**未投递**,请改订阅表里的目标编码`);
|
|
@@ -15215,7 +15223,7 @@ function syncHumanChannel(ctx) {
|
|
|
15215
15223
|
(async () => {
|
|
15216
15224
|
try {
|
|
15217
15225
|
stopMachineLoops();
|
|
15218
|
-
const { listCccs } = await import("./ccc-roots-
|
|
15226
|
+
const { listCccs } = await import("./ccc-roots-B6dJON2X.js").then((n) => n.a);
|
|
15219
15227
|
for (const entry of await listCccs(ctx)) syncCccBridge(ctx, entry.root);
|
|
15220
15228
|
} catch {}
|
|
15221
15229
|
})();
|
|
@@ -15508,7 +15516,7 @@ function matchCcc(input, candidates) {
|
|
|
15508
15516
|
}
|
|
15509
15517
|
/** 组装候选列表(`ccc-roots.listCccs` 投影 + `.serenity` 名;动态 import 保持本模块静态依赖轻量) */
|
|
15510
15518
|
async function collectCandidates(ctx) {
|
|
15511
|
-
const { listCccs } = await import("./ccc-roots-
|
|
15519
|
+
const { listCccs } = await import("./ccc-roots-B6dJON2X.js").then((n) => n.a);
|
|
15512
15520
|
const entries = await listCccs(ctx, { defaultRoot: process.cwd() });
|
|
15513
15521
|
const seen = /* @__PURE__ */ new Set();
|
|
15514
15522
|
const out = [];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as cccRootForCwd } from "./ccc-roots-
|
|
1
|
+
import { r as cccRootForCwd } from "./ccc-roots-B6dJON2X.js";
|
|
2
2
|
import { T as sessionsRoot, a as readBindDeclaration, b as parseTrajectoryCode, h as getLastActiveSessionInfo, i as listBindDeclarations, m as getActiveSessionInfo, n as findTrajectoryHolding, r as isBindUsable, t as claimBinding, w as sessionEvents } from "./bind-file-Dy6Qmm7z.js";
|
|
3
3
|
import { join } from "node:path";
|
|
4
4
|
import { createUserMessage } from "@deepseek-ai/dsh-llm";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { d as readCccName, i as findGitRoot, l as pathInside, s as loadSerenityConfig, t as DEFAULT_SERENITY_CONFIG_PATHS } from "./ccc-DSMqTrRU.js";
|
|
2
2
|
import { u as ACC_VERSION } from "./rules-BYeykzys.js";
|
|
3
3
|
import { r as checkRegistryQuality } from "./service-DF23HvHY.js";
|
|
4
|
-
import { a as wakeSchedulerState, p as listWakes } from "./scheduler-
|
|
5
|
-
import { n as readDshVersion, s as hostContractReport } from "./status-
|
|
4
|
+
import { a as wakeSchedulerState, p as listWakes } from "./scheduler-pOtONqPy.js";
|
|
5
|
+
import { n as readDshVersion, s as hostContractReport } from "./status-BwfDsakn.js";
|
|
6
6
|
import { resolve } from "node:path";
|
|
7
7
|
import { existsSync, readFileSync, statSync } from "node:fs";
|
|
8
8
|
//#region src/surface/observation.ts
|
|
@@ -245,10 +245,43 @@ function findDirNameByCode(root, code) {
|
|
|
245
245
|
* @returns 约束面;不是 轨迹约束会话 → `null`
|
|
246
246
|
*/
|
|
247
247
|
function trajectoryConstraintForSession(root, sessionId, boundDirName) {
|
|
248
|
-
const dirName = boundDirName ??
|
|
248
|
+
const dirName = boundDirName ?? resolveDirNameForSession(root, sessionId);
|
|
249
249
|
if (dirName === null || dirName === "") return null;
|
|
250
250
|
return readTrajectoryConstraintAt(join(sessionsRoot(root), dirName), root);
|
|
251
251
|
}
|
|
252
|
+
/**
|
|
253
|
+
* **会话 → 轨迹目录名**(两来源并取,本文件内唯一入口)。
|
|
254
|
+
*
|
|
255
|
+
* 🔴🔴 **2026-11-17 真机缺陷(某条长期存活轨迹拿到白名单外的工具)—— 这一格曾经只取 ①**:
|
|
256
|
+
*
|
|
257
|
+
* 旧实现是 `boundDirName ?? registeredDirName(sessionId)` —— **只读进程内内存表**
|
|
258
|
+
* (`policy/window.ts` 的 `trajectorySessions`)。而 `window.ts` 的文件头**逐字承诺**
|
|
259
|
+
* 「两个来源并取,都不中才判不是」,`trajectoryCodeForSession` 也是照那条承诺写的
|
|
260
|
+
* ⇒ **只有本函数漏了 ②**。后果不是"少一条兜底",是**权限面静默松开**:
|
|
261
|
+
*
|
|
262
|
+
* | 步 | 发生什么 |
|
|
263
|
+
* |---|---|
|
|
264
|
+
* | 1 | 宿主进程重启(每次发版装机会发生)⇒ 内存 Map 清空 |
|
|
265
|
+
* | 2 | `registerTrajectorySession` 全仓**只有一处调用**(`trajectory/session.ts:374`,建/恢复轨迹会话时) |
|
|
266
|
+
* | 3 | **长期存活**的载体会话没有任何路径重新登记它 |
|
|
267
|
+
* | 4 | 本函数返回 `null` ⇒ `computeVisibilitySources` 第 ⑥ 源贡献 `deny: []` |
|
|
268
|
+
* | 5 | **工具白名单整个不生效**,模型看得到全部工具 |
|
|
269
|
+
*
|
|
270
|
+
* 而这一点在当时**没有任何读数信号**:诊断 Map 也是空的,配置读起来完全正确。
|
|
271
|
+
* ⇒ 判据:**任何"内存 + 持久"双来源的设计,两处都必须真的取两个**;
|
|
272
|
+
* 只写在一处的注释不能替代另一处的实现(D151 同族:文档承诺与实现脱节)。
|
|
273
|
+
*
|
|
274
|
+
* @returns 轨迹目录名;两来源都不中 ⇒ `null`(= 这条会话不属任何轨迹)
|
|
275
|
+
*/
|
|
276
|
+
function resolveDirNameForSession(root, sessionId) {
|
|
277
|
+
const fromMemory = registeredDirName(sessionId);
|
|
278
|
+
if (fromMemory !== null && fromMemory !== "") return fromMemory;
|
|
279
|
+
if (typeof sessionId !== "string" || sessionId === "") return null;
|
|
280
|
+
try {
|
|
281
|
+
for (const { dirName, decl } of listBindDeclarations(sessionsRoot(root))) if (decl.sessionId === sessionId) return dirName;
|
|
282
|
+
} catch {}
|
|
283
|
+
return null;
|
|
284
|
+
}
|
|
252
285
|
/** 内存登记的轨迹目录名(注册表单一真相源在 `./registry.ts`;此处只做一次转发) */
|
|
253
286
|
function registeredDirName(sessionId) {
|
|
254
287
|
if (typeof sessionId !== "string" || sessionId === "") return null;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { n as __exportAll } from "./rolldown-runtime-B4iAMlE-.js";
|
|
2
|
-
import { n as agentCwdFor, r as cccRootForCwd, u as hostService } from "./ccc-roots-
|
|
2
|
+
import { n as agentCwdFor, r as cccRootForCwd, u as hostService } from "./ccc-roots-B6dJON2X.js";
|
|
3
3
|
import { F as isoLocal, b as parseTrajectoryCode, f as extractSessionMdPathFromText, m as getActiveSessionInfo, v as namingTitleFor, w as sessionEvents, y as parseSessionContextFromEvents } from "./bind-file-Dy6Qmm7z.js";
|
|
4
|
-
import { c as replacesDefaultIdentity } from "./profile-
|
|
5
|
-
import { a as trajectoryConstraintFor } from "./session-
|
|
6
|
-
import { a as ACC_MESSAGE_KIND, d as readLastBound, n as deliver, r as makeInjection, s as appendBound } from "./injection-
|
|
4
|
+
import { c as replacesDefaultIdentity } from "./profile-CRcW3ifg.js";
|
|
5
|
+
import { a as trajectoryConstraintFor } from "./session-Bi6owHoL.js";
|
|
6
|
+
import { a as ACC_MESSAGE_KIND, d as readLastBound, n as deliver, r as makeInjection, s as appendBound } from "./injection-ME-aoZVl.js";
|
|
7
7
|
import { basename, dirname, join, resolve } from "node:path";
|
|
8
8
|
import { existsSync, mkdirSync, readFileSync, readdirSync, renameSync, statSync, writeFileSync } from "node:fs";
|
|
9
9
|
import { deriveEventMessage } from "@deepseek-ai/dsh-session";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { n as __exportAll } from "./rolldown-runtime-B4iAMlE-.js";
|
|
2
|
-
import { c as hostAgents, o as listCccs, u as hostService } from "./ccc-roots-
|
|
2
|
+
import { c as hostAgents, o as listCccs, u as hostService } from "./ccc-roots-B6dJON2X.js";
|
|
3
3
|
import { g as resolveInside } from "./ccc-DSMqTrRU.js";
|
|
4
4
|
import { F as isoLocal, L as localHuman, P as readTrajectoryFile, R as localIdStamp, T as sessionsRoot, b as parseTrajectoryCode, j as TRAJECTORY_FILENAME, k as trajectoryDescOf, p as findSession, v as namingTitleFor } from "./bind-file-Dy6Qmm7z.js";
|
|
5
|
-
import { c as carrierState, i as toMessage, n as deliver, r as makeInjection, s as appendBound, t as assertInjection, u as listBoundSessionIds } from "./injection-
|
|
5
|
+
import { c as carrierState, i as toMessage, n as deliver, r as makeInjection, s as appendBound, t as assertInjection, u as listBoundSessionIds } from "./injection-ME-aoZVl.js";
|
|
6
6
|
import { i as sessionsRootDir, n as findSessionLog } from "./cleanup-CPl1SSaK.js";
|
|
7
|
-
import { i as hostAliveProbe, n as readSimpleSettings } from "./settings-
|
|
7
|
+
import { i as hostAliveProbe, n as readSimpleSettings } from "./settings-YC-csZus.js";
|
|
8
8
|
import { basename, dirname, join } from "node:path";
|
|
9
9
|
import { closeSync, existsSync, mkdirSync, openSync, readFileSync, readSync, readdirSync, realpathSync, renameSync, statSync, writeFileSync } from "node:fs";
|
|
10
10
|
import { spawn } from "node:child_process";
|
|
@@ -65,7 +65,8 @@ export declare function reminderText(code: string): string;
|
|
|
65
65
|
* 理由见该常量的头注(持久文件 vs 只用一次的交界材料必须分家)。
|
|
66
66
|
*/
|
|
67
67
|
/**
|
|
68
|
-
* 交接提醒(**rebuild 与 reconstruct 共用同一条文案**,2026-11-16 owner
|
|
68
|
+
* 交接提醒(**rebuild 与 reconstruct 共用同一条文案**,2026-11-16 owner 裁定;
|
|
69
|
+
* 2026-11-17 owner 再裁 **1.A:文案统一指名 `rebuild`**)。
|
|
69
70
|
*
|
|
70
71
|
* 🔴 为什么必须无差别:`rebuild`(原地清空、会话 id 不变)与 `reconstruct`
|
|
71
72
|
* (另开日志、旧会话归档)对**会话本身**做的是同一件事——**把它换掉**。
|
|
@@ -73,6 +74,13 @@ export declare function reminderText(code: string): string;
|
|
|
73
74
|
* 让模型看见两条不同文案 ⇒ 它要判断"我该调哪个" ⇒ 把一个机械决定变成一次思考,
|
|
74
75
|
* 既浪费注意力,又可能选错。
|
|
75
76
|
*
|
|
77
|
+
* 🔴🔴 **1.A 的落地(2026-11-17)**:本函数**只指名 `rebuild`**,绝不出现 `reconstruct`。
|
|
78
|
+
* 理由是执行面已经接好了:`cognitive-trajectory.ts` 的 `case 'rebuild'` 会在
|
|
79
|
+
* **累计量 ≥ `RECONSTRUCT_TOKEN_THRESHOLD`** 时把它**机械改道**成 `reconstruct`。
|
|
80
|
+
* ⇒ 模型只需知道**一个**动作名;"哪条路"由 ACC 算,不由模型猜。
|
|
81
|
+
* ⚠️ 这条裁定同时废止了 `trajectory/reconstruct.ts` 的 `reconstructReminderText()`
|
|
82
|
+
* (它自 v1.121.0 起**从未接线**,一直是死代码)——已随本版删除。
|
|
83
|
+
*
|
|
76
84
|
* 选路由本文件的 `registerKeeper` 一侧机械完成(`selectHandoverPath` 只是纯函数),规则见那里的注释。
|
|
77
85
|
*
|
|
78
86
|
* ⚠️ 便签落点 = `LOG/LOG.md` 的 `## Handover note` 节(2026-11-16 裁定):
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { d as hostSessions, r as cccRootForCwd } from "./ccc-roots-
|
|
1
|
+
import { d as hostSessions, r as cccRootForCwd } from "./ccc-roots-B6dJON2X.js";
|
|
2
2
|
import { p as readTrajectorySubscriptions } from "./ccc-DSMqTrRU.js";
|
|
3
3
|
import { F as isoLocal, w as sessionEvents } from "./bind-file-Dy6Qmm7z.js";
|
|
4
|
-
import { d as WAKE_CATCH_UP_MS, l as listCroCognitiveTrajectories } from "./scheduler-
|
|
5
|
-
import { n as readSimpleSettings } from "./settings-
|
|
6
|
-
import { i as subscriptionStats, r as subscriptionEval } from "./subscriptions-
|
|
7
|
-
import { containerClocks, containerWakes } from "./observation-
|
|
4
|
+
import { d as WAKE_CATCH_UP_MS, l as listCroCognitiveTrajectories } from "./scheduler-pOtONqPy.js";
|
|
5
|
+
import { n as readSimpleSettings } from "./settings-YC-csZus.js";
|
|
6
|
+
import { i as subscriptionStats, r as subscriptionEval } from "./subscriptions-DBoO0GSO.js";
|
|
7
|
+
import { containerClocks, containerWakes } from "./observation-DiD_yJjS.js";
|
|
8
8
|
//#region src/trajectory/live.ts
|
|
9
9
|
/**
|
|
10
10
|
* trajectory/live.ts — 进程内 live 会话取数 + 精简诊断
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { c as hostAgents, n as agentCwdFor, r as cccRootForCwd, s as hostAgentDefaultModel } from "./ccc-roots-
|
|
1
|
+
import { c as hostAgents, n as agentCwdFor, r as cccRootForCwd, s as hostAgentDefaultModel } from "./ccc-roots-B6dJON2X.js";
|
|
2
2
|
import { f as readCognitiveTrajectorySkills, h as readUtf8, o as isSafeModeOn, u as readBlacklist } from "./ccc-DSMqTrRU.js";
|
|
3
3
|
import { F as isoLocal, T as sessionsRoot, s as DEFAULT_SESSION_SCOPE, x as readActiveSessionMd } from "./bind-file-Dy6Qmm7z.js";
|
|
4
4
|
import { a as readGitTrack, i as localstorePath } from "./service-BRUHmVFn.js";
|
|
5
5
|
import { a as createProfilePromptReader, n as buildTrajectoryBasePrompt, o as profileMsmWhitelist, r as constraintCognitiveTrajectory, u as ACC_VERSION } from "./rules-BYeykzys.js";
|
|
6
|
-
import { d as registerTrajectorySession$1, f as trajectoryDirNameForSession, o as readTrajectoryConstraintAt, p as unregisterTrajectorySession$1, u as trajectoryConstraintForSession } from "./profile-
|
|
7
|
-
import { d as readLastBound, i as toMessage, r as makeInjection } from "./injection-
|
|
6
|
+
import { d as registerTrajectorySession$1, f as trajectoryDirNameForSession, o as readTrajectoryConstraintAt, p as unregisterTrajectorySession$1, u as trajectoryConstraintForSession } from "./profile-CRcW3ifg.js";
|
|
7
|
+
import { d as readLastBound, i as toMessage, r as makeInjection } from "./injection-ME-aoZVl.js";
|
|
8
8
|
import { basename, dirname, join, resolve } from "node:path";
|
|
9
9
|
import { chmodSync, existsSync, mkdirSync, readFileSync, readdirSync, renameSync, statSync, writeFileSync } from "node:fs";
|
|
10
10
|
import { createHmac, randomBytes, randomUUID, scryptSync } from "node:crypto";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { c as hostAgents, f as hostSettings, u as hostService } from "./ccc-roots-
|
|
1
|
+
import { c as hostAgents, f as hostSettings, u as hostService } from "./ccc-roots-B6dJON2X.js";
|
|
2
2
|
import { i as sessionsRootDir, r as hasSessionLogById } from "./cleanup-CPl1SSaK.js";
|
|
3
3
|
//#region src/trajectory/alive.ts
|
|
4
4
|
/**
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { l as hostInjected, r as cccRootForCwd, u as hostService } from "./ccc-roots-
|
|
1
|
+
import { l as hostInjected, r as cccRootForCwd, u as hostService } from "./ccc-roots-B6dJON2X.js";
|
|
2
2
|
import { c as matchBlacklist, d as readCccName, l as pathInside, n as SAFE_MODE_MARKER, o as isSafeModeOn, s as loadSerenityConfig, t as DEFAULT_SERENITY_CONFIG_PATHS, u as readBlacklist } from "./ccc-DSMqTrRU.js";
|
|
3
3
|
import { F as isoLocal, g as listActiveTrajectories } from "./bind-file-Dy6Qmm7z.js";
|
|
4
4
|
import { c as profileWriteWhitelist, s as profileToolWhitelist, u as ACC_VERSION } from "./rules-BYeykzys.js";
|
|
5
|
-
import { l as trajectoryCodeForSession, u as trajectoryConstraintForSession } from "./profile-
|
|
5
|
+
import { l as trajectoryCodeForSession, u as trajectoryConstraintForSession } from "./profile-CRcW3ifg.js";
|
|
6
6
|
import { n as isImWiredTrajectory } from "./channels-Covd8vLQ.js";
|
|
7
7
|
import { REGISTERED_TOOLS } from "./invariant.js";
|
|
8
8
|
import { basename, dirname, join, relative, resolve } from "node:path";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { r as cccRootForCwd } from "./ccc-roots-
|
|
1
|
+
import { r as cccRootForCwd } from "./ccc-roots-B6dJON2X.js";
|
|
2
2
|
import { p as readTrajectorySubscriptions } from "./ccc-DSMqTrRU.js";
|
|
3
3
|
import { L as localHuman, n as findTrajectoryHolding } from "./bind-file-Dy6Qmm7z.js";
|
|
4
|
-
import { s as registerDisposer } from "./scheduler-
|
|
4
|
+
import { s as registerDisposer } from "./scheduler-pOtONqPy.js";
|
|
5
5
|
//#region src/trajectory/subscriptions.ts
|
|
6
6
|
/**
|
|
7
7
|
* trajectory/subscriptions.ts — 轨迹消息订阅(v1.107.0,owner 2026-11-01 令)
|
|
@@ -306,7 +306,7 @@ function defaultSubscriptionDeps(ctx) {
|
|
|
306
306
|
readSubs: (root) => readTrajectorySubscriptions(root),
|
|
307
307
|
dirForSession: (root, sessionId) => findTrajectoryHolding(`${root}/AGENT_SESSIONS`, sessionId),
|
|
308
308
|
deliver: async (root, target, message) => {
|
|
309
|
-
const { sendToCognitiveTrajectory } = await import("./scheduler-
|
|
309
|
+
const { sendToCognitiveTrajectory } = await import("./scheduler-pOtONqPy.js").then((n) => n.r);
|
|
310
310
|
const res = await sendToCognitiveTrajectory(ctx, root, target, message, "trajectory-subscription");
|
|
311
311
|
return {
|
|
312
312
|
ok: res.ok,
|
|
@@ -142,14 +142,6 @@ export declare function selectHandoverPath(input: {
|
|
|
142
142
|
contextOver: boolean;
|
|
143
143
|
totalOver: boolean;
|
|
144
144
|
}): HandoverPath | null;
|
|
145
|
-
/**
|
|
146
|
-
* 达到阈值时注入的那句话(owner 给的语义,逐要素保留:**会话 id + "过于庞大" + 动作名**)。
|
|
147
|
-
*
|
|
148
|
-
* 🔴 与 `rebuildReminderText` 同一门禁口径(D64):**不给 token 数值**——
|
|
149
|
-
* "当前有多大"是模型无法据以行动的信息,"该调用 reconstruct"才是。
|
|
150
|
-
* ⚠️ 会话 id **必须给**:owner 原话里就有它,且它是唯一能让模型分辨"说的是哪条"的锚。
|
|
151
|
-
*/
|
|
152
|
-
export declare function reconstructReminderText(dshSessionId: string): string;
|
|
153
145
|
interface ReconstructDiagState {
|
|
154
146
|
lastTs: string;
|
|
155
147
|
lastSessionId: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shgroup/dsh-serenity-hooks",
|
|
3
|
-
"version": "1.137.
|
|
3
|
+
"version": "1.137.4",
|
|
4
4
|
"description": "宁静号 ACC harness(Native Cordis 插件)——给 DeepSeek Harness 装一个「AI 工作区」:14 个工具(container_fs/cognitive_trajectory/dashboard/container_git/msm/praxis/ontology/serenity-skill-creator/localstore/container_admin/browser_slot;另三个 im-bridge/diagram/reconstruct 按条件出现)+ 机械约束(安全模式/工作区围墙/密钥守卫/对外输出守卫)+ 认知轨迹日志与原地重建 + 网页登录入口/IM 桥/认知轨迹唤醒注册表 + 浏览器槽位管理(≤20 个独立 profile 的 Chrome 槽位,带占用归属与异常时向所属会话反向注入提醒)。轨迹声明 = 轨迹目录下的 trajectory.json(约束面 + 旧标识 uid + CRO 机器绑定 cro.host;旧名 trajectory-constraint.json / skiff.json 仍在读取族里);轨迹提示词 = 轨迹目录下的 PROMPT.md(一条轨迹「是谁、按什么章程工作」,所有轨迹通用,追加在容器层与质量层之后,不替换它们)。适配 DSH 0.1.7-rc.1 / 0.2.0-rc.1 / 0.2.1-rc.1(三档)。",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|