@shgroup/dsh-serenity-hooks 1.80.0 → 1.81.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/dsh.plugin.json +1 -1
- package/lib/{ccc-roots-DYJvlQhc.js → ccc-roots-4LwGLCXa.js} +1 -1
- package/lib/index.js +41 -11
- package/lib/{message-source-BYO-FyFP.js → message-source-CfqdGIi2.js} +25 -3
- package/lib/{profile-DmWw2M0q.js → profile-CiRWh2a2.js} +2 -0
- package/lib/{session-sV-kc1gQ.js → session-KBRbYb52.js} +3 -3
- package/lib/{settings-DdYLVK3O.js → settings-Dj4_ppTC.js} +1 -1
- package/lib/trajectory/policy/profile.d.ts +14 -0
- package/lib/trajectory/policy/rules.d.ts +18 -0
- 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.
|
|
3
|
+
"version": "1.81.0",
|
|
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/cheap-worker/localstore/container_admin;另三个 im-bridge/acc-diag/diagram 按配置条件出现)+ 机械约束(安全模式/工作区围墙/密钥守卫)+ 认知轨迹日志与原地重建 + 网页登录入口/IM 桥/认知轨迹唤醒注册表。轨迹声明 = 轨迹目录下的 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": {
|
|
@@ -227,7 +227,7 @@ async function listCccs(ctx, opts = {}) {
|
|
|
227
227
|
if (typeof defaultRoot === "string" && defaultRoot !== "" && !c.roots.includes(defaultRoot)) c.roots.unshift(defaultRoot);
|
|
228
228
|
let rolesOf = null;
|
|
229
229
|
if (opts.withRoles === true) {
|
|
230
|
-
const { listTrajectoryConstraints } = await import("./profile-
|
|
230
|
+
const { listTrajectoryConstraints } = await import("./profile-CiRWh2a2.js").then((n) => n.i);
|
|
231
231
|
rolesOf = (root) => {
|
|
232
232
|
try {
|
|
233
233
|
return listTrajectoryConstraints(root).map((p) => p.code);
|
package/lib/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { i as __toESM, n as __exportAll } from "./rolldown-runtime-B4iAMlE-.js";
|
|
2
|
-
import { c as hostInjected, d as hostSessions, f as hostSettings, h as hostWebServer, i as cccRootForExec, l as hostLlm, m as hostWeb, n as agentCwdFor, o as listCccs, p as hostSubagents, r as cccRootForCwd, s as hostAgents, t as NO_CCC_FROM_AGENT_CWD, u as hostService } from "./ccc-roots-
|
|
2
|
+
import { c as hostInjected, d as hostSessions, f as hostSettings, h as hostWebServer, i as cccRootForExec, l as hostLlm, m as hostWeb, n as agentCwdFor, o as listCccs, p as hostSubagents, r as cccRootForCwd, s as hostAgents, t as NO_CCC_FROM_AGENT_CWD, u as hostService } from "./ccc-roots-4LwGLCXa.js";
|
|
3
3
|
import { _ as resolveInside, a as findSerenityRoot$1, c as matchBlacklist, d as readCccName$1, f as readCheapWorkerConfig, h as readSafeModeHiddenTools, i as findGitRoot, l as pathInside, m as readExclusiveTools, n as SAFE_MODE_MARKER, o as isSafeModeOn, r as classifyPath, s as loadSerenityConfig, t as DEFAULT_SERENITY_CONFIG_PATHS, u as readBlacklist } from "./ccc-CyYJL4F2.js";
|
|
4
|
-
import { A as sessionEvents, B as isoLocal, C as listSessions, E as parseTrajectoryCode, F as trajectoryDescOf, H as localHuman, I as useSession, L as TRAJECTORY_FILENAME, M as setActiveSessionInfo, N as showSession, O as readTrajectoryUid, P as summarize, R as TRAJECTORY_LEGACY_FILENAMES, S as listActiveTrajectories, T as parseSessionContextFromEvents, U as localIdStamp, V as localFileStamp, _ as createSession, a as readTrajectoryConstraintAt, b as getActiveSessionInfo, c as trajectoryConstraintForSession, f as COGNITIVE_TRAJECTORY_ACTIONS, g as clearActiveSessionInfo, h as archiveSession, j as sessionsRoot, k as resolveSessionByTitle, m as UID_FILENAME, n as isTrajectoryConstrained, o as readTrajectoryConstraintByCode, r as listTrajectoryConstraints, s as replacesDefaultIdentity, t as TRAJECTORY_CONSTRAINT_FILENAME, v as extractSessionMdPathFromText, w as namingTitleFor, y as findSession, z as readTrajectoryFile } from "./profile-
|
|
4
|
+
import { A as sessionEvents, B as isoLocal, C as listSessions, E as parseTrajectoryCode, F as trajectoryDescOf, H as localHuman, I as useSession, L as TRAJECTORY_FILENAME, M as setActiveSessionInfo, N as showSession, O as readTrajectoryUid, P as summarize, R as TRAJECTORY_LEGACY_FILENAMES, S as listActiveTrajectories, T as parseSessionContextFromEvents, U as localIdStamp, V as localFileStamp, _ as createSession, a as readTrajectoryConstraintAt, b as getActiveSessionInfo, c as trajectoryConstraintForSession, f as COGNITIVE_TRAJECTORY_ACTIONS, g as clearActiveSessionInfo, h as archiveSession, j as sessionsRoot, k as resolveSessionByTitle, m as UID_FILENAME, n as isTrajectoryConstrained, o as readTrajectoryConstraintByCode, r as listTrajectoryConstraints, s as replacesDefaultIdentity, t as TRAJECTORY_CONSTRAINT_FILENAME, v as extractSessionMdPathFromText, w as namingTitleFor, y as findSession, z as readTrajectoryFile } from "./profile-CiRWh2a2.js";
|
|
5
5
|
import { n as checkLocalstoreGitCompliance, o as readStore, s as runLocalStore, t as LOCALSTORE_SCOPES } from "./service-DDmHSglV.js";
|
|
6
|
-
import { _ as
|
|
7
|
-
import { A as buildResourceIndex, C as verifyPassword, D as recordToolUsage, E as verifyTotpCode, F as hasTrajectoryPrompt, M as isSafeSkillName, N as truncateContent, O as REFERENCE_DIR, P as TRAJECTORY_PROMPT_FILENAME, S as toWire, T as MECHANISM_PORTS, _ as registerEntrySkillSectionGlobal, a as trajectoryConstraintFor, b as projectKnownWorkspaces, c as trajectoryWorkspaceMdPath, d as CHEAP_WORKER_GUIDE, f as providerAvailabilityError, g as registerEntrySkillSection, h as registerCognitiveTrajectorySkillSection, i as getTrajectoryAgent, j as buildResourceNameSuffix, k as SKILL_ONTOLOGY_FILE, l as unregisterTrajectorySession, m as splitModel, n as createTrajectoryAgent, o as trajectoryConstraintMsmGate, p as requireWhitelistedModel, r as ensureWorkspacePromptSection, s as trajectoryConstraintParticipates, t as askTrajectory, u as workspaceCognitiveTrajectoryLine, v as applyWirePatch, w as FACE_PORTS, x as readAdvancedSettings, y as migrateLegacyLocalstore } from "./session-
|
|
6
|
+
import { _ as resolveConstraintSystemPrompt, a as listBoundSessionIds, d as constraintCognitiveTrajectory, f as constraintSystemPromptSource, g as profileWriteWhitelist, h as profileToolWhitelist, i as carrierState, l as TRAJECTORY_CONSTRAINT_HINT, n as PLUGIN_SOURCE, o as readLastBound, r as appendBound, s as resolveSessionCognitiveTrajectoryLabel, t as ACC_MESSAGE_KIND, v as ACC_VERSION, y as findPackageRoot } from "./message-source-CfqdGIi2.js";
|
|
7
|
+
import { A as buildResourceIndex, C as verifyPassword, D as recordToolUsage, E as verifyTotpCode, F as hasTrajectoryPrompt, M as isSafeSkillName, N as truncateContent, O as REFERENCE_DIR, P as TRAJECTORY_PROMPT_FILENAME, S as toWire, T as MECHANISM_PORTS, _ as registerEntrySkillSectionGlobal, a as trajectoryConstraintFor, b as projectKnownWorkspaces, c as trajectoryWorkspaceMdPath, d as CHEAP_WORKER_GUIDE, f as providerAvailabilityError, g as registerEntrySkillSection, h as registerCognitiveTrajectorySkillSection, i as getTrajectoryAgent, j as buildResourceNameSuffix, k as SKILL_ONTOLOGY_FILE, l as unregisterTrajectorySession, m as splitModel, n as createTrajectoryAgent, o as trajectoryConstraintMsmGate, p as requireWhitelistedModel, r as ensureWorkspacePromptSection, s as trajectoryConstraintParticipates, t as askTrajectory, u as workspaceCognitiveTrajectoryLine, v as applyWirePatch, w as FACE_PORTS, x as readAdvancedSettings, y as migrateLegacyLocalstore } from "./session-KBRbYb52.js";
|
|
8
8
|
import { n as hasSessionLogById, r as sessionsRootDir } from "./cleanup-C-92qnDs.js";
|
|
9
|
-
import { n as readSimpleSettings, r as registerSettingsSection } from "./settings-
|
|
9
|
+
import { n as readSimpleSettings, r as registerSettingsSection } from "./settings-Dj4_ppTC.js";
|
|
10
10
|
import { REGISTERED_TOOLS } from "./invariant.js";
|
|
11
11
|
import { a as readFeishuCredential, d as weixinSessionIdForTrajectory, i as matchWeixinRoute, l as sanitizeFileName$1, n as extractWeixinText, o as readWeixinCredential, r as hasVoiceItem, s as readWeixinSettings, t as extractWeixinMedia, u as weixinInboundDir } from "./route-Dr0SFD8A.js";
|
|
12
12
|
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-BMk2w2KY.js";
|
|
@@ -10727,6 +10727,7 @@ becomes a 轨迹约束; delete it and it goes back to being an ordinary trajecto
|
|
|
10727
10727
|
"model": "provider/model", // optional; **不写 = 用会话当前模型**(不回退 cheap-worker;每轮生效)
|
|
10728
10728
|
"tools": ["read","grep","msm",...], // optional; **不写 = 不收窄**。显式 [] = 全隐藏(除 skill)
|
|
10729
10729
|
"msms": ["msm-a","msm-b"], // optional; **不写 = 不收窄**。register/deregister 恒拒
|
|
10730
|
+
"writes": ["AGENT_SESSIONS/<我的目录>/"], // optional; **不写 = 不收窄**。显式 [] = 一个写都落不下
|
|
10730
10731
|
"cognitiveTrajectory": { "session": true, "keeper": true, "rebuild": true }, // 缺省 TRUE(见下)
|
|
10731
10732
|
"resident": { "serves": "..." }, // optional; 对外用途自述(见 trajectory-self 章)
|
|
10732
10733
|
"cro": { "host": "<machine name>" } // optional: which machine may run this trajectory's CRO program
|
|
@@ -10752,6 +10753,20 @@ becomes a 轨迹约束; delete it and it goes back to being an ordinary trajecto
|
|
|
10752
10753
|
🔴 判据是**字段在不在**,不是**数组空不空**(D181)。旧版把两者混成"空 = 全拒",
|
|
10753
10754
|
于是「只想声明常驻」的人被静默锁死 —— 那是本仓实测踩过的坑(D179(b))。
|
|
10754
10755
|
|
|
10756
|
+
── \`writes\`: the THIRD whitelist — the PATH dimension(owner 2026-10-20 令)──
|
|
10757
|
+
\`tools\` 管的是**工具名**,管不了"这个工具能写哪儿":给了 \`write\` 之后,路径守卫只拦
|
|
10758
|
+
「逃出 CCC」与黑名单,**拦不住它去写别人的轨迹或 docs/**。\`writes\` 补的正是这一维。
|
|
10759
|
+
|
|
10760
|
+
- **不写** ⇒ 不收窄(写权限 = 路径守卫那几条,与之前完全一致)
|
|
10761
|
+
- \`"writes": []\` ⇒ **一个写都落不下**(显式意图;只影响写,不影响读)
|
|
10762
|
+
- \`"writes": ["AGENT_SESSIONS/<我的目录>/", "_tmp/"]\` ⇒ 写类工具的**目标路径**必须落在这些前缀内
|
|
10763
|
+
- 条目可以是**相对 CCC 根**的路径,也可以是绝对路径;判定按"目标在这个目录之内(含自身)"
|
|
10764
|
+
- 只管**写类**工具(\`write\` / \`edit\` / \`container_fs\` 的写动作 / \`append\` / \`touch\`),**读不受影响**
|
|
10765
|
+
- 越界拒绝时**会指名允许的前缀与当前目标**(D186:不许不出声;出声必须指对路)
|
|
10766
|
+
|
|
10767
|
+
⇒ 典型用法(两条 IM 轨迹):给 \`write\`/\`edit\` 写自己的身体,同时把写面收窄到自己那一格:
|
|
10768
|
+
\`"tools": ["read","write","edit",...], "writes": ["AGENT_SESSIONS/<code 目录>/"]\`
|
|
10769
|
+
|
|
10755
10770
|
── cognitiveTrajectory: why the defaults are TRUE ──
|
|
10756
10771
|
The workspace of a 轨迹约束 is its own SESSION.md. Setting these to false would cut it off from
|
|
10757
10772
|
its own body, so \`session\`/\`keeper\`/\`rebuild\` all default to true. Set false explicitly only
|
|
@@ -10792,6 +10807,11 @@ function validateTrajectoryConstraint(root) {
|
|
|
10792
10807
|
}
|
|
10793
10808
|
})())) issues.push(`trajectory "${p.code}": no trajectory prompt (add ${TRAJECTORY_PROMPT_FILENAME} in the trajectory dir — recommended — or the legacy systemPromptFile/systemPrompt)`);
|
|
10794
10809
|
for (const m of p.msms ?? []) if (!registered.has(m)) issues.push(`trajectory "${p.code}": msms "${m}" is not registered in mech-registry.json`);
|
|
10810
|
+
for (const w of p.writes ?? []) try {
|
|
10811
|
+
resolveInside(root, w);
|
|
10812
|
+
} catch (err) {
|
|
10813
|
+
issues.push(`trajectory "${p.code}": writes "${w}" is outside the CCC root (${String(err?.message ?? err)}) — a write prefix outside the container can never match; use a path relative to the CCC root`);
|
|
10814
|
+
}
|
|
10795
10815
|
if (p.model && allowedModels && !allowedModels.has(p.model)) issues.push(`trajectory "${p.code}": model "${p.model}" not in cheap-worker.models (${[...allowedModels].join(", ") || "(none)"})`);
|
|
10796
10816
|
}
|
|
10797
10817
|
return {
|
|
@@ -10824,6 +10844,7 @@ function listTrajectoryConstraintSummary(root) {
|
|
|
10824
10844
|
model: p.model ?? "(unchanged)",
|
|
10825
10845
|
msms: wl(p.msms, "(unrestricted)"),
|
|
10826
10846
|
tools: wl(p.tools, "(unrestricted)"),
|
|
10847
|
+
writes: wl(p.writes, "(unrestricted)"),
|
|
10827
10848
|
...p.resident !== void 0 ? { resident: p.resident.serves !== void 0 ? p.resident.serves : "(no serves)" } : {},
|
|
10828
10849
|
cognitiveTrajectory: constraintCognitiveTrajectory(p),
|
|
10829
10850
|
promptSource: constraintSystemPromptSource(p, hasTrajectoryPrompt(root, p.dirName)),
|
|
@@ -10955,6 +10976,7 @@ const TRAJECTORY_SELF_GUIDE = [
|
|
|
10955
10976
|
| \`model\` | 用会话当前的模型(**不会**回退到 cheap-worker) | **每轮**(改文件下一轮即生效) |
|
|
10956
10977
|
| \`tools\` | **不收窄**工具面 | 每轮 |
|
|
10957
10978
|
| \`msms\` | **不收窄** MSM 面 | 每轮 |
|
|
10979
|
+
| \`writes\` | **不收窄**写路径(写权限 = 路径守卫那几条) | 每轮 |
|
|
10958
10980
|
| \`resident\` | 不出现在常驻名单里(不参与"被找") | 每轮 |
|
|
10959
10981
|
| \`cognitiveTrajectory\` | 三项纪律全参与(true) | 每轮 |
|
|
10960
10982
|
| \`systemPromptFile\` / \`systemPrompt\` | 用 ACC 的通用身份(**不替换**) | 保存即生效 |
|
|
@@ -10980,7 +11002,7 @@ const TRAJECTORY_SELF_GUIDE = [
|
|
|
10980
11002
|
章程生效了吗 改 PROMPT.md 后**在同一会话里**看下一轮的系统提示词段是否变化(保存即生效)
|
|
10981
11003
|
注入模式生效了吗 改 trajectory.json 的 prompt 段后,**同一会话下一轮**:replace 下四块消失、
|
|
10982
11004
|
我的章程紧跟身份块;⛔ 不需要重启(这两者都是每轮现读)
|
|
10983
|
-
我声明了什么 container_admin config list —— 逐轨迹列出 model/tools/msms 的**生效值**;
|
|
11005
|
+
我声明了什么 container_admin config list —— 逐轨迹列出 model/tools/msms/writes 的**生效值**;
|
|
10984
11006
|
没写的字段印 \`(unchanged)\` / \`(unrestricted)\`,不是伪装成某个默认值
|
|
10985
11007
|
配置合法吗 container_admin config validate —— msms 均已注册 / model 在可用表里
|
|
10986
11008
|
常驻被看见了吗 cognitive_trajectory action=resident —— 我出现在名单里,且 serves 可读
|
|
@@ -11565,6 +11587,14 @@ function decideGuard(input) {
|
|
|
11565
11587
|
deny: "tool not allowed in this 轨迹约束 trajectory",
|
|
11566
11588
|
kind: "deny"
|
|
11567
11589
|
};
|
|
11590
|
+
const writeScopes = profileWriteWhitelist(profile);
|
|
11591
|
+
if (writeScopes !== null && pathArg !== void 0 && isWriteTool(toolName, action)) {
|
|
11592
|
+
const abs = resolve(root, pathArg);
|
|
11593
|
+
if (!writeScopes.some((scope) => pathInside(resolve(root, scope), abs))) return {
|
|
11594
|
+
deny: `${toolName}: write outside this trajectory's declared write scope (allowed: ${writeScopes.length > 0 ? writeScopes.join(" / ") : "(none — \"writes\" is an empty array)"}); target: ${pathArg} — add the prefix to this trajectory's trajectory.json "writes" if the write is intended`,
|
|
11595
|
+
kind: "deny"
|
|
11596
|
+
};
|
|
11597
|
+
}
|
|
11568
11598
|
}
|
|
11569
11599
|
if (safeModeOn && toolName === "bash") return {
|
|
11570
11600
|
deny: `bash: no such tool`,
|
|
@@ -14118,7 +14148,7 @@ function registerStatusApi(ctx, opts = {}) {
|
|
|
14118
14148
|
});
|
|
14119
14149
|
}
|
|
14120
14150
|
const { saveWeixinRoutes } = await import("./route-Dr0SFD8A.js").then((n) => n.c);
|
|
14121
|
-
const { findDirNameByCode } = await import("./profile-
|
|
14151
|
+
const { findDirNameByCode } = await import("./profile-CiRWh2a2.js").then((n) => n.i);
|
|
14122
14152
|
for (const r of routes) if (findDirNameByCode(root, r.trajectory) === null) {
|
|
14123
14153
|
sendJson$2(res, 400, { error: `unknown trajectory: ${r.trajectory} (no such trajectory code in ${root})` });
|
|
14124
14154
|
return;
|
|
@@ -19115,7 +19145,7 @@ const MEDIA_MAX_BYTES = 20971520;
|
|
|
19115
19145
|
*/
|
|
19116
19146
|
async function resolveCccRootByAlias(ctx, alias) {
|
|
19117
19147
|
try {
|
|
19118
|
-
const { listCccs } = await import("./ccc-roots-
|
|
19148
|
+
const { listCccs } = await import("./ccc-roots-4LwGLCXa.js").then((n) => n.a);
|
|
19119
19149
|
const entries = await listCccs(ctx);
|
|
19120
19150
|
const byName = entries.find((e) => e.name === alias);
|
|
19121
19151
|
if (byName) return byName.root;
|
|
@@ -19183,7 +19213,7 @@ async function resolveInboundTarget(ctx, input) {
|
|
|
19183
19213
|
});
|
|
19184
19214
|
return null;
|
|
19185
19215
|
}
|
|
19186
|
-
const { findDirNameByCode } = await import("./profile-
|
|
19216
|
+
const { findDirNameByCode } = await import("./profile-CiRWh2a2.js").then((n) => n.i);
|
|
19187
19217
|
if (findDirNameByCode(root, target.role) === null) {
|
|
19188
19218
|
const detail = `目标 CCC "${target.ccc}" 内没有编码为 "${target.role}" 的认知轨迹`;
|
|
19189
19219
|
console.error(`[serenity-hooks] ✗ human-channel: ${detail}(account=${input.account} user=${input.user})—— 该消息**未投递**,请改订阅表里的目标编码`);
|
|
@@ -20023,7 +20053,7 @@ function syncHumanChannel(ctx) {
|
|
|
20023
20053
|
(async () => {
|
|
20024
20054
|
try {
|
|
20025
20055
|
stopMachineLoops();
|
|
20026
|
-
const { listCccs } = await import("./ccc-roots-
|
|
20056
|
+
const { listCccs } = await import("./ccc-roots-4LwGLCXa.js").then((n) => n.a);
|
|
20027
20057
|
for (const entry of await listCccs(ctx)) syncCccBridge(ctx, entry.root);
|
|
20028
20058
|
} catch {}
|
|
20029
20059
|
})();
|
|
@@ -20287,7 +20317,7 @@ function matchCcc(input, candidates) {
|
|
|
20287
20317
|
}
|
|
20288
20318
|
/** 组装候选列表(`ccc-roots.listCccs` 投影 + `.serenity` 名;动态 import 保持本模块静态依赖轻量) */
|
|
20289
20319
|
async function collectCandidates(ctx) {
|
|
20290
|
-
const { listCccs } = await import("./ccc-roots-
|
|
20320
|
+
const { listCccs } = await import("./ccc-roots-4LwGLCXa.js").then((n) => n.a);
|
|
20291
20321
|
const entries = await listCccs(ctx, { defaultRoot: process.cwd() });
|
|
20292
20322
|
const seen = /* @__PURE__ */ new Set();
|
|
20293
20323
|
const out = [];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { r as cccRootForCwd } from "./ccc-roots-
|
|
1
|
+
import { r as cccRootForCwd } from "./ccc-roots-4LwGLCXa.js";
|
|
2
2
|
import { _ as resolveInside, g as readUtf8 } from "./ccc-CyYJL4F2.js";
|
|
3
|
-
import { A as sessionEvents, E as parseTrajectoryCode, b as getActiveSessionInfo, j as sessionsRoot, x as getLastActiveSessionInfo } from "./profile-
|
|
3
|
+
import { A as sessionEvents, E as parseTrajectoryCode, b as getActiveSessionInfo, j as sessionsRoot, x as getLastActiveSessionInfo } from "./profile-CiRWh2a2.js";
|
|
4
4
|
import { dirname, join } from "node:path";
|
|
5
5
|
import { existsSync, mkdirSync, readFileSync, readdirSync, renameSync, statSync, writeFileSync } from "node:fs";
|
|
6
6
|
import { fileURLToPath } from "node:url";
|
|
@@ -105,6 +105,28 @@ function profileToolWhitelist(profile) {
|
|
|
105
105
|
function profileMsmWhitelist(profile) {
|
|
106
106
|
return new Set(profile?.msms ?? []);
|
|
107
107
|
}
|
|
108
|
+
/**
|
|
109
|
+
* 该轨迹可**写**的路径前缀(owner 2026-10-20 令:「轨迹设定自己的写白名单」)。
|
|
110
|
+
*
|
|
111
|
+
* 🔴 与 `profileToolWhitelist` 共用同一条判据(D181/D183):**字段在不在,不是数组空不空**。
|
|
112
|
+
*
|
|
113
|
+
* | `writes` | 返回 | 语义 |
|
|
114
|
+
* |---|---|---|
|
|
115
|
+
* | 缺省 | **`null`** | 不收窄(写权限 = 路径守卫那几条,与今天一致) |
|
|
116
|
+
* | `[]` | `[]`(空数组) | **一个写都落不下**(显式意图) |
|
|
117
|
+
* | `['a/']` | `['a/']` | 写目标必须落在 `a/` 之内 |
|
|
118
|
+
*
|
|
119
|
+
* ⛔ **调用方不许把 `null` 当 `[]`** —— 那会把"我没想到这件事"读成"我不许写任何东西",
|
|
120
|
+
* 正是 S196 被静默锁死的形态(D179(b))。
|
|
121
|
+
*
|
|
122
|
+
* ⚠️ 返回的是**原始条目**(相对 CCC 根或绝对路径都可),解析成绝对路径由调用方按自己的 root 做 ——
|
|
123
|
+
* 本模块不持有 root(判据在 `seams/guards.ts`)。
|
|
124
|
+
*/
|
|
125
|
+
function profileWriteWhitelist(profile) {
|
|
126
|
+
if (!profile) return null;
|
|
127
|
+
if (profile.writes === void 0) return null;
|
|
128
|
+
return profile.writes;
|
|
129
|
+
}
|
|
108
130
|
/** 轨迹纪律参与项(`profile` 缺省已在 `readTrajectoryConstraintAt` 归一为全 true) */
|
|
109
131
|
function constraintCognitiveTrajectory(profile) {
|
|
110
132
|
return {
|
|
@@ -799,4 +821,4 @@ const ACC_MESSAGE_KIND = "plugin:dsh-serenity-hooks";
|
|
|
799
821
|
/** ACC 注入消息的统一来源值(各缝共用;需要 `form` 时按 `ContextFormed` 另加字段)。 */
|
|
800
822
|
const PLUGIN_SOURCE = { kind: ACC_MESSAGE_KIND };
|
|
801
823
|
//#endregion
|
|
802
|
-
export {
|
|
824
|
+
export { resolveConstraintSystemPrompt as _, listBoundSessionIds as a, setBindingStore as c, constraintCognitiveTrajectory as d, constraintSystemPromptSource as f, profileWriteWhitelist as g, profileToolWhitelist as h, carrierState as i, TRAJECTORY_CONSTRAINT_HINT as l, profileMsmWhitelist as m, PLUGIN_SOURCE as n, readLastBound as o, createProfilePromptReader as p, appendBound as r, resolveSessionCognitiveTrajectoryLabel as s, ACC_MESSAGE_KIND as t, buildTrajectoryBasePrompt as u, ACC_VERSION as v, findPackageRoot as y };
|
|
@@ -1078,6 +1078,7 @@ function readTrajectoryConstraintAt(trajectoryDir, root) {
|
|
|
1078
1078
|
}
|
|
1079
1079
|
const tools = strListMaybe(obj.tools);
|
|
1080
1080
|
const msms = strListMaybe(obj.msms);
|
|
1081
|
+
const writes = strListMaybe(obj.writes);
|
|
1081
1082
|
/**
|
|
1082
1083
|
* 提示词注入模式(owner 2026-10-20):只搬运,不判决。
|
|
1083
1084
|
*
|
|
@@ -1097,6 +1098,7 @@ function readTrajectoryConstraintAt(trajectoryDir, root) {
|
|
|
1097
1098
|
...model !== void 0 ? { model } : {},
|
|
1098
1099
|
...tools !== void 0 ? { tools } : {},
|
|
1099
1100
|
...msms !== void 0 ? { msms } : {},
|
|
1101
|
+
...writes !== void 0 ? { writes } : {},
|
|
1100
1102
|
...resident !== void 0 ? { resident } : {},
|
|
1101
1103
|
...prompt !== void 0 ? { prompt } : {},
|
|
1102
1104
|
cognitiveTrajectory: {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { n as agentCwdFor, r as cccRootForCwd, s as hostAgents } from "./ccc-roots-
|
|
1
|
+
import { n as agentCwdFor, r as cccRootForCwd, s as hostAgents } from "./ccc-roots-4LwGLCXa.js";
|
|
2
2
|
import { g as readUtf8, o as isSafeModeOn, p as readCognitiveTrajectorySkills, u as readBlacklist } from "./ccc-CyYJL4F2.js";
|
|
3
|
-
import { B as isoLocal, D as readActiveSessionMd, a as readTrajectoryConstraintAt, c as trajectoryConstraintForSession, d as unregisterTrajectorySession$1, j as sessionsRoot, l as registerTrajectorySession$1, p as DEFAULT_SESSION_SCOPE, u as trajectoryDirNameForSession } from "./profile-
|
|
3
|
+
import { B as isoLocal, D as readActiveSessionMd, a as readTrajectoryConstraintAt, c as trajectoryConstraintForSession, d as unregisterTrajectorySession$1, j as sessionsRoot, l as registerTrajectorySession$1, p as DEFAULT_SESSION_SCOPE, u as trajectoryDirNameForSession } from "./profile-CiRWh2a2.js";
|
|
4
4
|
import { a as readGitTrack, i as localstorePath } from "./service-DDmHSglV.js";
|
|
5
|
-
import {
|
|
5
|
+
import { d as constraintCognitiveTrajectory, m as profileMsmWhitelist, n as PLUGIN_SOURCE, o as readLastBound, p as createProfilePromptReader, u as buildTrajectoryBasePrompt, v as ACC_VERSION } from "./message-source-CfqdGIi2.js";
|
|
6
6
|
import { basename, dirname, join, resolve } from "node:path";
|
|
7
7
|
import { chmodSync, existsSync, mkdirSync, readFileSync, readdirSync, renameSync, statSync, writeFileSync } from "node:fs";
|
|
8
8
|
import { createUserMessage } from "@deepseek-ai/dsh-llm";
|
|
@@ -67,6 +67,20 @@ export interface TrajectoryConstraint {
|
|
|
67
67
|
tools?: string[];
|
|
68
68
|
/** MSM 白名单;缺省/空数组语义同 `tools`(D181) */
|
|
69
69
|
msms?: string[];
|
|
70
|
+
/**
|
|
71
|
+
* **写路径白名单**(owner 2026-10-20 令:「ACC 如果支持轨迹设定自己的写白名单就好了」)。
|
|
72
|
+
*
|
|
73
|
+
* `tools` 只管**工具名**,管不了"这个工具能写哪儿"——一旦给了 `write`,路径守卫只拦
|
|
74
|
+
* "逃出 CCC"与黑名单,**拦不住它去写别人的轨迹或 `docs/`**。本字段补的就是这一维。
|
|
75
|
+
*
|
|
76
|
+
* 🔴 判据与 D181 同一条:**字段在不在,不是数组空不空**。
|
|
77
|
+
* - 缺省(`undefined`)⇒ **不收窄**(写权限 = 路径守卫那几条);
|
|
78
|
+
* - `[]` ⇒ **一个写都落不下**(显式意图,不告警);
|
|
79
|
+
* - 非空 ⇒ 写类工具的**目标路径**必须落在这些前缀内(相对 CCC 根,或其绝对路径)。
|
|
80
|
+
*
|
|
81
|
+
* 只约束**写类**工具(`write`/`edit`/`container_fs` 写动作/`append`/`touch`);读不受影响。
|
|
82
|
+
*/
|
|
83
|
+
writes?: string[];
|
|
70
84
|
/** 轨迹纪律参与项(**缺省全 true**,见上方 R↓) */
|
|
71
85
|
cognitiveTrajectory: {
|
|
72
86
|
session: boolean;
|
|
@@ -45,6 +45,24 @@ export declare const TRAJECTORY_CONSTRAINT_HINT = "systemPromptFile hot-reloads
|
|
|
45
45
|
export declare function profileToolWhitelist(profile: TrajectoryConstraint | null | undefined): Set<string> | null;
|
|
46
46
|
/** 该轨迹会话可 exec 的 MSM 白名单(`msm` 工具内部再过滤;独立于工具白名单) */
|
|
47
47
|
export declare function profileMsmWhitelist(profile: TrajectoryConstraint | null | undefined): Set<string>;
|
|
48
|
+
/**
|
|
49
|
+
* 该轨迹可**写**的路径前缀(owner 2026-10-20 令:「轨迹设定自己的写白名单」)。
|
|
50
|
+
*
|
|
51
|
+
* 🔴 与 `profileToolWhitelist` 共用同一条判据(D181/D183):**字段在不在,不是数组空不空**。
|
|
52
|
+
*
|
|
53
|
+
* | `writes` | 返回 | 语义 |
|
|
54
|
+
* |---|---|---|
|
|
55
|
+
* | 缺省 | **`null`** | 不收窄(写权限 = 路径守卫那几条,与今天一致) |
|
|
56
|
+
* | `[]` | `[]`(空数组) | **一个写都落不下**(显式意图) |
|
|
57
|
+
* | `['a/']` | `['a/']` | 写目标必须落在 `a/` 之内 |
|
|
58
|
+
*
|
|
59
|
+
* ⛔ **调用方不许把 `null` 当 `[]`** —— 那会把"我没想到这件事"读成"我不许写任何东西",
|
|
60
|
+
* 正是 S196 被静默锁死的形态(D179(b))。
|
|
61
|
+
*
|
|
62
|
+
* ⚠️ 返回的是**原始条目**(相对 CCC 根或绝对路径都可),解析成绝对路径由调用方按自己的 root 做 ——
|
|
63
|
+
* 本模块不持有 root(判据在 `seams/guards.ts`)。
|
|
64
|
+
*/
|
|
65
|
+
export declare function profileWriteWhitelist(profile: TrajectoryConstraint | null | undefined): string[] | null;
|
|
48
66
|
/** 轨迹纪律参与项(`profile` 缺省已在 `readTrajectoryConstraintAt` 归一为全 true) */
|
|
49
67
|
export declare function constraintCognitiveTrajectory(profile: TrajectoryConstraint | null | undefined): {
|
|
50
68
|
session: boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shgroup/dsh-serenity-hooks",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.81.0",
|
|
4
4
|
"description": "宁静号 ACC harness(Native Cordis 插件)——给 DeepSeek Harness 装一个「AI 工作区」:14 个工具(container_fs/cognitive_trajectory/dashboard/container_git/msm/praxis/ontology/serenity-skill-creator/cheap-worker/localstore/container_admin;另三个 im-bridge/acc-diag/diagram 按配置条件出现)+ 机械约束(安全模式/工作区围墙/密钥守卫/对外输出守卫)+ 认知轨迹日志与原地重建 + 网页登录入口/IM 桥/认知轨迹唤醒注册表。轨迹声明 = 轨迹目录下的 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": {
|