@shgroup/dsh-serenity-hooks 1.32.0 → 1.34.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/README.md +11 -11
- package/dsh.plugin.json +5 -5
- package/experiments/autopilot-trajectory/SKILL.md +12 -12
- package/experiments/autopilot-trajectory/scripts/autopilot-trajectory.ts +69 -45
- package/lib/autopilot-script.d.ts +40 -0
- package/lib/autopilot-trajectory.d.ts +29 -0
- package/lib/{ccc-DAsSHsub.js → ccc-eu_IPF94.js} +17 -1
- package/lib/ccc.d.ts +20 -0
- package/lib/client.js +28 -8
- package/lib/diag-ops.d.ts +61 -0
- package/lib/index.d.ts +1 -1
- package/lib/index.js +3192 -3182
- package/lib/invariant.d.ts +5 -1
- package/lib/invariant.js +7 -3
- package/lib/json.d.ts +1 -1
- package/lib/msm-ops.d.ts +2 -2
- package/lib/output-guard-seam.d.ts +1 -1
- package/lib/rebuild.d.ts +4 -3
- package/lib/seams/guards.d.ts +27 -0
- package/lib/seams/keeper.d.ts +3 -3
- package/lib/{settings-section-Bm-xG-NR.js → settings-section-BuPGQv_H.js} +5 -6
- package/lib/settings-section.d.ts +15 -8
- package/lib/skiff-core.d.ts +1 -1
- package/lib/{skiff-debug-K2k1JnGj.js → skiff-debug-D83-Njy7.js} +7 -7
- package/lib/{skiff-role-BYvNnwv1.js → skiff-role-DAfPb6YQ.js} +1 -1
- package/lib/tools/acc-diag.d.ts +22 -0
- package/lib/tools/container-admin.d.ts +1 -1
- package/lib/tools/{session.d.ts → trajectory.d.ts} +32 -16
- package/lib/{session-bound-NHozeLFc.js → trajectory-bound-C8DUxi6_.js} +21 -276
- package/lib/{session-bound.d.ts → trajectory-bound.d.ts} +2 -2
- package/lib/{session-ops.d.ts → trajectory-ops.d.ts} +24 -28
- package/lib/wake-registry-D0Vj0WXb.js +270 -0
- package/lib/wake-scheduler.d.ts +41 -2
- package/lib/{weixin-route-wWk4AIwV.js → weixin-route-D1ND823E.js} +1 -1
- package/package.json +2 -2
- package/lib/tools/autopilot-trajectory.d.ts +0 -25
package/lib/client.js
CHANGED
|
@@ -4788,13 +4788,15 @@ Instruction-following style:
|
|
|
4788
4788
|
const acpOn = value?.acpEnabled ?? false;
|
|
4789
4789
|
const acpPort = value?.acpHttpPort ?? 3100;
|
|
4790
4790
|
const publicAskOn = value?.publicAskEnabled ?? false;
|
|
4791
|
-
const autopilotOn = value?.autopilotEnabled ?? false;
|
|
4791
|
+
const autopilotOn = value?.autopilotWakeEnabled ?? value?.autopilotEnabled ?? false;
|
|
4792
|
+
const wakeSchedOn = value?.wakeSchedulerEnabled ?? true;
|
|
4792
4793
|
const [openGateway, setOpenGateway] = (0, react.useState)(false);
|
|
4793
4794
|
const [openRebuild, setOpenRebuild] = (0, react.useState)(false);
|
|
4794
4795
|
const [openSkiff, setOpenSkiff] = (0, react.useState)(false);
|
|
4795
4796
|
const [openAcp, setOpenAcp] = (0, react.useState)(false);
|
|
4796
4797
|
const [openPublicAsk, setOpenPublicAsk] = (0, react.useState)(false);
|
|
4797
4798
|
const [openAutopilot, setOpenAutopilot] = (0, react.useState)(false);
|
|
4799
|
+
const [openWakeSched, setOpenWakeSched] = (0, react.useState)(false);
|
|
4798
4800
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
4799
4801
|
className: "ss-section",
|
|
4800
4802
|
children: [
|
|
@@ -4832,7 +4834,7 @@ Instruction-following style:
|
|
|
4832
4834
|
title: "上下文",
|
|
4833
4835
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("li", { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(RowCard, {
|
|
4834
4836
|
title: "超限重建",
|
|
4835
|
-
desc: "上下文接近上限时提示调用
|
|
4837
|
+
desc: "上下文接近上限时提示调用 container_trajectory rebuild 清空重建",
|
|
4836
4838
|
expandable: true,
|
|
4837
4839
|
open: openRebuild,
|
|
4838
4840
|
onToggle: setOpenRebuild,
|
|
@@ -4845,7 +4847,7 @@ Instruction-following style:
|
|
|
4845
4847
|
className: "ss-detailStack",
|
|
4846
4848
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
4847
4849
|
className: "ss-detailIntro",
|
|
4848
|
-
children: "上下文超限自动重建(
|
|
4850
|
+
children: "上下文超限自动重建(container_trajectory rebuild,v1.33 起 logbook 并入 trajectory):\n· 机制:agent 上下文占用达到阈值时,由 LLM 主动调用重建\n· 语义:完全丢弃当前 dsh 会话 + 自动新建 + 注入「继续原 SESSION 的工作」\n· 效果:SESSION.md 原位不动,认知轨迹延续,上下文归零\n· 关闭后:上下文超限时不再提示,可能导致会话卡顿或丢失"
|
|
4849
4851
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(RowCard, {
|
|
4850
4852
|
title: "重建阈值",
|
|
4851
4853
|
desc: "上下文占用达到该 K 数值时提示(单位 K token,默认 400)",
|
|
@@ -4941,22 +4943,40 @@ Instruction-following style:
|
|
|
4941
4943
|
})
|
|
4942
4944
|
}) }),
|
|
4943
4945
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("li", { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(RowCard, {
|
|
4944
|
-
title: "
|
|
4945
|
-
desc: "
|
|
4946
|
+
title: "周期自唤醒(autopilot)",
|
|
4947
|
+
desc: "定时唤起 autopilot 轨迹(全局开关,默认关——只在指定电脑开启)",
|
|
4946
4948
|
expandable: true,
|
|
4947
4949
|
open: openAutopilot,
|
|
4948
4950
|
onToggle: setOpenAutopilot,
|
|
4949
4951
|
control: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Toggle, {
|
|
4950
4952
|
checked: autopilotOn,
|
|
4951
|
-
onChange: (on) => toggle("
|
|
4953
|
+
onChange: (on) => toggle("autopilotWakeEnabled", on)
|
|
4952
4954
|
}),
|
|
4953
4955
|
detail: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
4954
4956
|
className: "ss-detailStack",
|
|
4955
4957
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
4956
4958
|
className: "ss-detailIntro",
|
|
4957
|
-
children: "Autopilot Trajectory
|
|
4959
|
+
children: "周期自唤醒全局闸(v1.34 更名收窄,原 Autopilot Trajectory 全局总开关):\n· 作用:控制本机(本 dsh 实例)是否运行**周期**自动巡航唤起\n· 语义边界:**只管周期自唤醒** —— 关掉它不影响一次性唤醒(wake-later,见下一行)\n· 默认关:未开启即使 CCC 配置 enabled=true 也不启动定时器\n· 定位:多台电脑装 dsp 时,只在指定电脑开启(其余默认关)\n· 双重门控:本开关 AND CCC 级 enabled 都满足才运行\n· CCC 级配置(interval/session/偏见脚本/焦点)不受影响"
|
|
4958
4960
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(AutopilotTrajectoryStatusBlock, { autopilotOn })]
|
|
4959
4961
|
})
|
|
4962
|
+
}) }),
|
|
4963
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("li", { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(RowCard, {
|
|
4964
|
+
title: "唤醒调度器(wake-later)",
|
|
4965
|
+
desc: "投递已登记的“未来时刻 + 一条 message”(全局开关,默认开)",
|
|
4966
|
+
expandable: true,
|
|
4967
|
+
open: openWakeSched,
|
|
4968
|
+
onToggle: setOpenWakeSched,
|
|
4969
|
+
control: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Toggle, {
|
|
4970
|
+
checked: wakeSchedOn,
|
|
4971
|
+
onChange: (on) => toggle("wakeSchedulerEnabled", on)
|
|
4972
|
+
}),
|
|
4973
|
+
detail: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
4974
|
+
className: "ss-detailStack",
|
|
4975
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
4976
|
+
className: "ss-detailIntro",
|
|
4977
|
+
children: "唤醒调度器全局闸(v1.34 新增独立开关):\n· 作用:把 CCC 唤醒注册表(AGENT_SESSIONS/wake-registry.json)里到点的条目投递给目标轨迹\n· 条目来源:`container_trajectory wake-later`(对自己或别的 trajectory 预约未来时刻 + 一条 message)\n· 默认开:条目全部由人类/agent 显式登记,无环境自主性 ⇒ 不需要“默认关”的实验保护\n· 与上一行**互不连带**:关掉周期自唤醒不会关掉本调度器(用户 2026-09-15 裁决)\n· 精度:5min tick;补跑窗口 2h(超窗判 missed 留痕);fire-and-forget 无回执"
|
|
4978
|
+
})
|
|
4979
|
+
})
|
|
4960
4980
|
}) })
|
|
4961
4981
|
]
|
|
4962
4982
|
}),
|
|
@@ -5261,7 +5281,7 @@ Instruction-following style:
|
|
|
5261
5281
|
className: "ss-rowCard",
|
|
5262
5282
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DefList, { items: [{
|
|
5263
5283
|
term: "唤醒注册表",
|
|
5264
|
-
value: wakes.length === 0 ? "无条目(agent 用
|
|
5284
|
+
value: wakes.length === 0 ? "无条目(agent 用 container_trajectory wake-later 登记:未来时刻 + 一条 message)" : `${wakes.filter((w) => w.state === "pending").length} 条在办 / 共 ${wakes.length} 条`
|
|
5265
5285
|
}, ...wakes.slice(0, 5).map((w) => ({
|
|
5266
5286
|
term: w.state === "pending" ? "· 待唤醒" : `· ${w.state}`,
|
|
5267
5287
|
value: `${new Date(w.at).toLocaleString()} → ${w.target}${w.lastResult ? `(${w.lastResult})` : ""}`
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* diag-ops.ts — `acc-diag` 报告装配(v1.33,S142 §32.11)
|
|
3
|
+
*
|
|
4
|
+
* 为什么单独成模块(R↓):工具面(`tools/acc-diag.ts`)只做"取 CCC 根 + 渲染",
|
|
5
|
+
* 装配逻辑放这里 ⇒ 纯函数可单测、不依赖 DSH 工具注册。
|
|
6
|
+
*
|
|
7
|
+
* 为什么**无动作参数**:诊断是低频动作(§32.9 收敛取向),一次调用即出全报告,
|
|
8
|
+
* 不需要子命令面;动作越多,模型选择成本越高。
|
|
9
|
+
*
|
|
10
|
+
* 四段内容(数据来源各自单一真相源,本模块只聚合不复制语义):
|
|
11
|
+
* ① live 运行态 —— 插件进程内 `diagLive(ctx)`(live 会话清单 + 各 autopilot CCC 的
|
|
12
|
+
* 目标命中 / agent 定位诊断)——**脚本侧看不到运行时**,这正是本工具存在的理由
|
|
13
|
+
* ② 面板解析 —— `diagLive.panelResolved`(无参面板请求会落到哪个 CCC)
|
|
14
|
+
* ③ 唤醒注册表 —— `wake-registry.json` 全量条目(state / at / target / lastResult)+ 补跑窗口
|
|
15
|
+
* ④ 唤起条件链 —— 包内脚本 `diag`(`runAutopilotScript(root,'diag')`):逐条件值 + 阻断点 + 修复建议
|
|
16
|
+
*/
|
|
17
|
+
import { type DiagLiveReport, autopilotClockState } from './autopilot-trajectory.js';
|
|
18
|
+
import { wakeSchedulerState } from './wake-scheduler.js';
|
|
19
|
+
import type { Context } from 'cordis';
|
|
20
|
+
/** 进程内时钟状态(唤醒调度器 / autopilot 时钟;判据各自单一真相源) */
|
|
21
|
+
type ClockState = ReturnType<typeof wakeSchedulerState> | ReturnType<typeof autopilotClockState>;
|
|
22
|
+
export interface AccDiagReport {
|
|
23
|
+
/** 调用方会话所属 CCC 根(脚本诊断的目标) */
|
|
24
|
+
ccc: string;
|
|
25
|
+
live: DiagLiveReport;
|
|
26
|
+
/**
|
|
27
|
+
* 进程内两个时钟的武装状态(2026-09-14 F 段缺陷**新暴露面**)。
|
|
28
|
+
* 为什么必须有(R↓):此前"条目为何滞留在 pending"无法从报告回答——④ 段只算**配置**条件,
|
|
29
|
+
* 而真正的原因可能在"时钟根本没在跑"这一层。有了它,同类故障一眼可判。
|
|
30
|
+
*/
|
|
31
|
+
clocks: {
|
|
32
|
+
wake: ClockState;
|
|
33
|
+
autopilot: ClockState;
|
|
34
|
+
};
|
|
35
|
+
wakes: {
|
|
36
|
+
/** 注册表文件路径问题(读不到时非空——不得静默) */
|
|
37
|
+
error: string | null;
|
|
38
|
+
entries: Array<{
|
|
39
|
+
id: string;
|
|
40
|
+
target: string;
|
|
41
|
+
at: string;
|
|
42
|
+
state: string;
|
|
43
|
+
createdBy: string;
|
|
44
|
+
attempts: number;
|
|
45
|
+
lastResult: string | null;
|
|
46
|
+
}>;
|
|
47
|
+
pending: number;
|
|
48
|
+
};
|
|
49
|
+
/** 唤起条件链(脚本输出原文;失败时给出错误文本,不吞) */
|
|
50
|
+
autopilotChain: string;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* 装配报告(一次调用即全报告)。
|
|
54
|
+
* @param ctx 插件上下文(进程内读 sessions/agents)
|
|
55
|
+
* @param root 调用方 CCC 根(脚本诊断目标)
|
|
56
|
+
* @returns 结构化报告(渲染由 {@link renderAccDiag} 负责)
|
|
57
|
+
*/
|
|
58
|
+
export declare function runAccDiag(ctx: Context, root: string): AccDiagReport;
|
|
59
|
+
/** 人读渲染(四段;空段也要显式说明"无",避免"沉默 = 一切正常"的误读) */
|
|
60
|
+
export declare function renderAccDiag(r: AccDiagReport): string;
|
|
61
|
+
export {};
|
package/lib/index.d.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* 形态(DSH 官方 native hook 约定):name / inject / Config / apply,无 default export。
|
|
5
5
|
*
|
|
6
6
|
* 能力:
|
|
7
|
-
* 1. 真实 DSH 工具注册:container_fs(文件系统 15 子命令,含 reveal)、
|
|
7
|
+
* 1. 真实 DSH 工具注册:container_fs(文件系统 15 子命令,含 reveal)、container_trajectory(轨迹生命周期 + 一次性安排,含 rebuild)
|
|
8
8
|
* 2. 拦截缝机械约束:tools/pre-execute + ctx.tools.guard(安全模式/黑名单/路径守卫)
|
|
9
9
|
*
|
|
10
10
|
* 加载:~/.dsh/config.yaml 加 insert 行(免改 DSH 源码),插件包装入 DSH node_modules。
|