@shgroup/dsh-serenity-hooks 1.100.0 → 1.102.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "id": "dsh-serenity-hooks",
3
- "version": "1.100.0",
3
+ "version": "1.102.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": {
package/lib/index.js CHANGED
@@ -4,7 +4,7 @@ import { _ as resolveInside, a as findSerenityRoot$1, c as matchBlacklist, d as
4
4
  import { A as namingTitleFor, B as summarize, C as createSession, E as getActiveSessionInfo, F as resolveSessionByTitle, G as readTrajectoryFile, H as useSession, I as sessionEvents, J as localHuman, K as isoLocal, L as sessionsRoot, M as parseTrajectoryCode, O as listActiveTrajectories, P as readTrajectoryUid, R as setActiveSessionInfo, S as clearActiveSessionInfo, T as findSession, U as TRAJECTORY_FILENAME, V as trajectoryDescOf, W as TRAJECTORY_LEGACY_FILENAMES, Y as localIdStamp, b as UID_FILENAME, c as replacesDefaultIdentity, i as listTrajectoryConstraints, j as parseSessionContextFromEvents, k as listSessions, l as trajectoryCodeForSession, n as findDirNameByCode, o as readTrajectoryConstraintAt, q as localFileStamp, r as isTrajectoryConstrained, s as readTrajectoryConstraintByCode, t as TRAJECTORY_CONSTRAINT_FILENAME, u as trajectoryConstraintForSession, v as COGNITIVE_TRAJECTORY_ACTIONS, w as extractSessionMdPathFromText, x as archiveSession, z as showSession } from "./profile-zxakCNXy.js";
5
5
  import { n as checkLocalstoreGitCompliance, o as readStore, s as runLocalStore, t as LOCALSTORE_SCOPES } from "./service-DDmHSglV.js";
6
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-BAMwXu6i.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 deliverToTrajectory, o as trajectoryConstraintMsmGate, p as requireWhitelistedModel, r as ensureWorkspacePromptSection, s as trajectoryConstraintParticipates, t as createTrajectoryAgent, u as workspaceCognitiveTrajectoryLine, v as applyWirePatch, w as FACE_PORTS, x as readAdvancedSettings, y as migrateLegacyLocalstore } from "./session-DFNtReQY.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 deliverToTrajectory, o as trajectoryConstraintMsmGate, p as requireWhitelistedModel, r as ensureWorkspacePromptSection, s as trajectoryConstraintParticipates, t as createTrajectoryAgent, u as workspaceCognitiveTrajectoryLine, v as applyWirePatch, w as FACE_PORTS, x as readAdvancedSettings, y as migrateLegacyLocalstore } from "./session-Dao7X5lR.js";
8
8
  import { i as sessionsRootDir, n as findSessionLog, r as hasSessionLogById } from "./cleanup-CPl1SSaK.js";
9
9
  import { i as runImBridge, n as isImWiredTrajectory, o as readSimpleSettings, r as registerImChannel, s as registerSettingsSection, t as imChannelIds } from "./channels-CuCsUfcY.js";
10
10
  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-DxIKWeN9.js";
@@ -38,7 +38,13 @@ import { isIP } from "node:net";
38
38
  * - cp:目录需 recursive;dst 已存在报错;自动建父目录
39
39
  * - mv:dst 已存在报错;自动建父目录
40
40
  * - list/tree/exists/info/find:输出结构与 osp 一致(JSON 元数据 / 嵌套树 / glob+fuzzy 搜索)
41
- * - touch:存在更新 mtime、不存在创建(自动建父目录);append:自动建父目录 + 返回字节数
41
+ * - touch:存在更新 mtime、不存在创建(自动建父目录)
42
+ * - 🔴 **`append` 已于 v1.101.0 退役**(owner 2026-10-26 令「砍掉 container_fs 的 append」):
43
+ * 它存在的唯一理由曾是"不读全文的追加",但实测该用途几乎没人走(SESSION.md 追加
44
+ * 7,291 次里 append 只有 74 次,占 1.0%)⇒ 留着一个**绕过 fs-observation 锁**的
45
+ * 写通道,收益不足以抵它带来的规则面(写类动作清单、写白名单、两处工具描述都要维护它)。
46
+ * ⚠️ 传 `action:'append'` 现在得到 `PARAMETER_INVALID_VALUE` 并列出合法动作 —— **响亮失败**,
47
+ * 不是静默忽略。
42
48
  * 保留 dsp 增强:win32 reveal 用 spawn+unref(explorer GUI 进程退出码不可靠,fire-and-forget)。
43
49
  */
44
50
  const CC_FS_ACTIONS = [
@@ -53,7 +59,6 @@ const CC_FS_ACTIONS = [
53
59
  "mv",
54
60
  "cp",
55
61
  "touch",
56
- "append",
57
62
  "reveal",
58
63
  "info",
59
64
  "find"
@@ -314,15 +319,6 @@ function runCcFs(root, args) {
314
319
  writeFileSync(absPath, "", "utf-8");
315
320
  return `created empty file: ${args.path}`;
316
321
  }
317
- case "append": {
318
- if (!args.path || args.content === void 0) throw new Error("append requires path + content");
319
- const absPath = validateWritePath(root, args.path);
320
- const parentDir = dirname(absPath);
321
- if (!existsSync(parentDir)) mkdirSync(parentDir, { recursive: true });
322
- const content = args.content;
323
- appendFileSync(absPath, content, "utf-8");
324
- return `appended ${Buffer.byteLength(content, "utf8")} bytes to ${args.path}`;
325
- }
326
322
  case "reveal": {
327
323
  if (!args.path) throw new Error("reveal requires path");
328
324
  const absPath = resolveInside(root, args.path);
@@ -416,7 +412,7 @@ function runCcFs(root, args) {
416
412
  count: matches.length
417
413
  };
418
414
  }
419
- default: throw new Error(`Unknown action: ${a}`);
415
+ default: throw new Error(`Unknown action: ${a}. Valid actions: ${CC_FS_ACTIONS.join("/")}` + (a === "append" ? "(`append` 已于 v1.101.0 退役 —— 改用 edit 或 write)" : ""));
420
416
  }
421
417
  }
422
418
  //#endregion
@@ -435,7 +431,7 @@ function renderText$11(value) {
435
431
  }
436
432
  const ccFsTool = defineTool({
437
433
  name: "container_fs",
438
- description: "Container filesystem operations (the CCC's hull — file operations confined to the container root; path escape blocked automatically). 15 subcommands: root/resolve/exists/list/tree/relative/mkdir/rm/mv/cp/touch/append/reveal/info/find. reveal opens a path in the OS file manager (Linux xdg-open / macOS Finder / Windows Explorer). Complements read/write/edit (structural operations).",
434
+ description: "Container filesystem operations (the CCC's hull — file operations confined to the container root; path escape blocked automatically). 14 subcommands: root/resolve/exists/list/tree/relative/mkdir/rm/mv/cp/touch/reveal/info/find. reveal opens a path in the OS file manager (Linux xdg-open / macOS Finder / Windows Explorer). Complements read/write/edit (structural operations).",
439
435
  parameters: {
440
436
  action: {
441
437
  type: "string",
@@ -445,7 +441,7 @@ const ccFsTool = defineTool({
445
441
  },
446
442
  path: {
447
443
  type: "string",
448
- description: "Primary path argument (single-path ops: resolve/exists/list/tree/relative/touch/append/info/rm)"
444
+ description: "Primary path argument (single-path ops: resolve/exists/list/tree/relative/touch/info/rm)"
449
445
  },
450
446
  paths: {
451
447
  type: "array",
@@ -462,7 +458,7 @@ const ccFsTool = defineTool({
462
458
  },
463
459
  content: {
464
460
  type: "string",
465
- description: "append content"
461
+ description: "Deprecated/ignored — the only consumer was `append`, retired in v1.101.0"
466
462
  },
467
463
  pattern: {
468
464
  type: "string",
@@ -12807,18 +12803,17 @@ const WRITE_TOOLS = /* @__PURE__ */ new Set([
12807
12803
  "str_replace_editor",
12808
12804
  "container_fs",
12809
12805
  "bash",
12810
- "append",
12811
12806
  "touch"
12812
12807
  ]);
12813
- /** container_fs 的写类子命令(mkdir/rm/mv/cp/touch/append);其余 9 子命令(root/resolve/exists/
12814
- * list/tree/relative/reveal/info/find)为只读——只读子命令不查黑名单(同 read 语义) */
12808
+ /** container_fs 的写类子命令(mkdir/rm/mv/cp/touch);其余 9 子命令(root/resolve/exists/
12809
+ * list/tree/relative/reveal/info/find)为只读——只读子命令不查黑名单(同 read 语义)
12810
+ * 🔴 `append` 已于 v1.101.0 退役(owner 2026-10-26),故不在此集合。 */
12815
12811
  const CC_FS_WRITE_ACTIONS = /* @__PURE__ */ new Set([
12816
12812
  "mkdir",
12817
12813
  "rm",
12818
12814
  "mv",
12819
12815
  "cp",
12820
- "touch",
12821
- "append"
12816
+ "touch"
12822
12817
  ]);
12823
12818
  /**
12824
12819
  * 凭据文件硬名单(数据面守卫,v1.26.3,S142 用户:localstore.json 需要在 read 工具的黑名单里):
@@ -20455,7 +20450,6 @@ async function handleInboundEvent(ctx, root, accountId, io, event, preset) {
20455
20450
  */
20456
20451
  releaseLock = await acquireSessionLock(sessionId);
20457
20452
  const existing = getTrajectoryAgent(sessionId);
20458
- const hc = readCheapWorkerConfig(root);
20459
20453
  const ref = existing ? {
20460
20454
  agent: existing,
20461
20455
  sessionId,
@@ -20471,7 +20465,7 @@ async function handleInboundEvent(ctx, root, accountId, io, event, preset) {
20471
20465
  keeper: true,
20472
20466
  rebuild: true
20473
20467
  }
20474
- }, hc?.defaultModel, sessionId);
20468
+ }, sessionId);
20475
20469
  if (!ref.resumed) await io.sendText({
20476
20470
  toUserId: fromUserId,
20477
20471
  text: "(新的对话已开始)",
@@ -1500,7 +1500,7 @@ function toolsBlock() {
1500
1500
  "=== Serenity Tools ===",
1501
1501
  "The ACC (this plugin) provides the following built-in tools:",
1502
1502
  "",
1503
- " container_fs — container filesystem operations (15 subcommands: root/resolve/exists/list/tree/relative/mkdir/rm/mv/cp/touch/append/reveal/info/find)",
1503
+ " container_fs — container filesystem operations (14 subcommands: root/resolve/exists/list/tree/relative/mkdir/rm/mv/cp/touch/reveal/info/find)",
1504
1504
  " cognitive_trajectory — one cognitive trajectory: its persistent body (SESSION.md) + its timeline. Lifecycle: list (inventory + stats) / show / create / use (activate; inline integrity check — silent when fine) / rebuild (clear-and-rebuild this conversation in place, Ship of Theseus); delivery: send-now (deliver one message RIGHT NOW; live target injected immediately, non-live cold-resumed like a direct wake — returns a synchronous receipt) / send-later (one future instant + one message to any cognitive trajectory; fire-and-forget — no receipt, no recall) / cro-guide (the CRO programming guide: how to give THIS cognitive trajectory its own program that decides when it should be woken)",
1505
1505
  " dashboard — always-on container instruments: health (CCC three-principle check + registry integrity) / time (now) / wait (N seconds)",
1506
1506
  " container_git— git operations (status/commit/push/log/pull/diff)",
@@ -2351,9 +2351,9 @@ const TRAJECTORY_PRESET = "standard";
2351
2351
  * @param profile 该 轨迹约束的约束面(来自 `trajectory-constraint.json`)
2352
2352
  * @param sessionId 指定会话 id(可选;微信桥等外部面用固定 id 实现"轨迹 ↔ 会话"长期映射)
2353
2353
  */
2354
- async function createTrajectoryAgent(ctx, root, profile, defaultModel, sessionId) {
2354
+ async function createTrajectoryAgent(ctx, root, profile, sessionId) {
2355
2355
  if (!ctx.agents) throw new Error("trajectory constraint: ctx.agents unavailable");
2356
- const model = profile.model?.trim() || defaultModel || "";
2356
+ const model = profile.model?.trim() ?? "";
2357
2357
  const id = sessionId ?? `轨迹约束-${profile.code}-${randomUUID()}`;
2358
2358
  const setup = async (agentCtx) => {
2359
2359
  try {
@@ -6,11 +6,17 @@
6
6
  * - cp:目录需 recursive;dst 已存在报错;自动建父目录
7
7
  * - mv:dst 已存在报错;自动建父目录
8
8
  * - list/tree/exists/info/find:输出结构与 osp 一致(JSON 元数据 / 嵌套树 / glob+fuzzy 搜索)
9
- * - touch:存在更新 mtime、不存在创建(自动建父目录);append:自动建父目录 + 返回字节数
9
+ * - touch:存在更新 mtime、不存在创建(自动建父目录)
10
+ * - 🔴 **`append` 已于 v1.101.0 退役**(owner 2026-10-26 令「砍掉 container_fs 的 append」):
11
+ * 它存在的唯一理由曾是"不读全文的追加",但实测该用途几乎没人走(SESSION.md 追加
12
+ * 7,291 次里 append 只有 74 次,占 1.0%)⇒ 留着一个**绕过 fs-observation 锁**的
13
+ * 写通道,收益不足以抵它带来的规则面(写类动作清单、写白名单、两处工具描述都要维护它)。
14
+ * ⚠️ 传 `action:'append'` 现在得到 `PARAMETER_INVALID_VALUE` 并列出合法动作 —— **响亮失败**,
15
+ * 不是静默忽略。
10
16
  * 保留 dsp 增强:win32 reveal 用 spawn+unref(explorer GUI 进程退出码不可靠,fire-and-forget)。
11
17
  */
12
18
  import type { JsonValue } from '../../kernel/json.js';
13
- type CcFsAction = 'root' | 'resolve' | 'exists' | 'list' | 'tree' | 'relative' | 'mkdir' | 'rm' | 'mv' | 'cp' | 'touch' | 'append' | 'reveal' | 'info' | 'find';
19
+ type CcFsAction = 'root' | 'resolve' | 'exists' | 'list' | 'tree' | 'relative' | 'mkdir' | 'rm' | 'mv' | 'cp' | 'touch' | 'reveal' | 'info' | 'find';
14
20
  export declare const CC_FS_ACTIONS: readonly CcFsAction[];
15
21
  export interface CcFsArgs {
16
22
  action: CcFsAction;
@@ -100,7 +100,7 @@ interface TrajectoryAgentRef {
100
100
  * @param profile 该 轨迹约束的约束面(来自 `trajectory-constraint.json`)
101
101
  * @param sessionId 指定会话 id(可选;微信桥等外部面用固定 id 实现"轨迹 ↔ 会话"长期映射)
102
102
  */
103
- export declare function createTrajectoryAgent(ctx: Context, root: string, profile: TrajectoryConstraint, defaultModel?: string, sessionId?: string): Promise<TrajectoryAgentRef>;
103
+ export declare function createTrajectoryAgent(ctx: Context, root: string, profile: TrajectoryConstraint, sessionId?: string): Promise<TrajectoryAgentRef>;
104
104
  interface TrajectoryAskResult {
105
105
  answer: string;
106
106
  sessionId: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shgroup/dsh-serenity-hooks",
3
- "version": "1.100.0",
3
+ "version": "1.102.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": {