@shgroup/dsh-serenity-hooks 1.31.12 → 1.32.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 +13 -7
- package/dsh.plugin.json +3 -3
- package/experiments/autopilot-trajectory/SKILL.md +23 -21
- package/lib/autopilot-trajectory.d.ts +15 -5
- package/lib/ccc.d.ts +10 -0
- package/lib/client.js +16 -4
- package/lib/index.js +652 -50
- package/lib/invariant.d.ts +1 -1
- package/lib/invariant.js +1 -1
- package/lib/msm-ops.d.ts +2 -2
- package/lib/{session-bound-BpTayaIS.js → session-bound-NHozeLFc.js} +57 -1
- package/lib/session-bound.d.ts +30 -0
- package/lib/{session-cleanup-PahSNvjI.js → session-cleanup-CMT4mHWt.js} +51 -14
- package/lib/session-cleanup.d.ts +19 -2
- package/lib/{settings-section-01rTVq6v.js → settings-section-Bm-xG-NR.js} +6 -3
- package/lib/settings-section.d.ts +5 -0
- package/lib/{skiff-debug-w2c3UqQk.js → skiff-debug-K2k1JnGj.js} +1 -1
- package/lib/tools/autopilot-trajectory.d.ts +2 -2
- package/lib/wake-registry.d.ts +146 -0
- package/lib/wake-scheduler.d.ts +76 -0
- package/package.json +2 -2
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* wake-scheduler.ts — trajectory 唤醒调度器(D58/D59/D60;S142 2026-09-13)
|
|
3
|
+
*
|
|
4
|
+
* 一个**中心调度器**(5min tick,复用 autopilot 的节律常量),处理 CCC 唤醒注册表里
|
|
5
|
+
* 到期的条目:把「未来时刻 + 一条 message」投递给目标 trajectory,**fire-and-forget**
|
|
6
|
+
* (无阻塞、无等待、无回执——发起方不 await,调度器不替模型结果负责)。
|
|
7
|
+
*
|
|
8
|
+
* 与 autopilot 的关系(D59):**两个 tick 各自独立**。autopilot 是每 CCC 单例的
|
|
9
|
+
* 周期自唤醒,逻辑一行不碰;本模块只处理注册表的一次性唤醒条目。
|
|
10
|
+
*
|
|
11
|
+
* 投递路径(P-1 证据链见 SESSION.md §30.6):
|
|
12
|
+
* 1. target(S### / 目录名)→ 目录名 + SESSION.md
|
|
13
|
+
* 2. 目标 dsh 会话 id:`.bindings.json` 里绑定该目录名的会话(按绑定时间倒序,权威)
|
|
14
|
+
* → 回退:live 会话标题匹配
|
|
15
|
+
* 3. agent:**live 优先**(`ctx.agents.get`)→ 冷会话走 `ctx.sessionController.resolveAgent`
|
|
16
|
+
* (宿主实现:live 优先 + resume 去重 + 由会话元数据恢复 preset)
|
|
17
|
+
* → `sessionController` 缺席(headless profile)⇒ 仅投递 live 目标,**不静默**
|
|
18
|
+
* 4. 投递:`agent.followup(...)`("Queue an ordinary follow-up turn and wake the driver")
|
|
19
|
+
*
|
|
20
|
+
* 守卫(I-4 默认):全局 `trajectoryEnabled`(旧键 `autopilotEnabled` 回退)|
|
|
21
|
+
* 补跑窗口 2h(超窗置 missed 留痕)|同 tick 串行|唤起后维持 live(人类可介入)。
|
|
22
|
+
*/
|
|
23
|
+
import type { Context } from 'cordis';
|
|
24
|
+
import type { Agent } from '@deepseek-ai/dsh-agent';
|
|
25
|
+
import { type WakeEntry } from './wake-registry.js';
|
|
26
|
+
/** 投递结果(写回条目的 lastResult;人读) */
|
|
27
|
+
export interface WakeDeliveryResult {
|
|
28
|
+
ok: boolean;
|
|
29
|
+
detail: string;
|
|
30
|
+
}
|
|
31
|
+
/** 目标定位:目录名 + SESSION.md 绝对路径 */
|
|
32
|
+
interface WakeTarget {
|
|
33
|
+
dirName: string;
|
|
34
|
+
mdPath: string;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* 解析条目的 target(`S###` 或完整目录名)→ 目录名 + SESSION.md 路径。
|
|
38
|
+
* @param root CCC 根
|
|
39
|
+
* @param target 条目里的目标标识
|
|
40
|
+
* @returns 命中返回目录信息,未命中 null
|
|
41
|
+
*/
|
|
42
|
+
export declare function resolveWakeTarget(root: string, target: string): WakeTarget | null;
|
|
43
|
+
/** 全局闸:`trajectoryEnabled` 优先,旧键 `autopilotEnabled` 回退(设置服务不可用 → 关) */
|
|
44
|
+
export declare function wakeSchedulerEnabled(): boolean;
|
|
45
|
+
/**
|
|
46
|
+
* 取目标 agent:live 优先 → 冷会话走 sessionController.resolveAgent → 标题回退。
|
|
47
|
+
* @param ctx 插件上下文
|
|
48
|
+
* @param root CCC 根
|
|
49
|
+
* @param dirName 目标 trajectory 目录名
|
|
50
|
+
* @returns 命中返回 agent 与取得方式(how 进 lastResult,便于诊断);未命中返回原因
|
|
51
|
+
*/
|
|
52
|
+
export declare function acquireWakeAgent(ctx: Context, root: string, dirName: string): Promise<{
|
|
53
|
+
agent: Agent;
|
|
54
|
+
how: string;
|
|
55
|
+
} | {
|
|
56
|
+
error: string;
|
|
57
|
+
}>;
|
|
58
|
+
/** 唤醒消息(唤起即投递正文:身份锚定 + 唤醒信息 + 任务) */
|
|
59
|
+
export declare function buildWakeText(entry: WakeEntry, target: WakeTarget): string;
|
|
60
|
+
/**
|
|
61
|
+
* 投递一条唤醒(fire-and-forget:`followup` 入队即返回,不等模型结果)。
|
|
62
|
+
* @param ctx 插件上下文
|
|
63
|
+
* @param root CCC 根
|
|
64
|
+
* @param entry 唤醒条目
|
|
65
|
+
* @returns 投递结果(写回 lastResult)
|
|
66
|
+
*/
|
|
67
|
+
export declare function deliverWake(ctx: Context, root: string, entry: WakeEntry): Promise<WakeDeliveryResult>;
|
|
68
|
+
/** 一次调度 tick:遍历 live CCC → 到期项串行投递 / 超窗项置 missed;返回人读摘要 */
|
|
69
|
+
export declare function runWakeTick(ctx: Context): Promise<string[]>;
|
|
70
|
+
/**
|
|
71
|
+
* 装配调度器(index.ts apply 调用):5min tick + 生命周期 disposer +
|
|
72
|
+
* 会话出现/settings 变化时热启动(与 autopilot 同款触发面,互不干扰)。
|
|
73
|
+
* @param ctx 插件上下文
|
|
74
|
+
*/
|
|
75
|
+
export declare function registerWakeScheduler(ctx: Context): void;
|
|
76
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shgroup/dsh-serenity-hooks",
|
|
3
|
-
"version": "1.
|
|
4
|
-
"description": "宁静号 ACC harness(Native Cordis 插件)——给 DeepSeek Harness 装一个「AI 工作区」:11 个工具(container_fs/logbook/dashboard/container_git/msm/praxis/handyman/localstore/container_admin/
|
|
3
|
+
"version": "1.32.0",
|
|
4
|
+
"description": "宁静号 ACC harness(Native Cordis 插件)——给 DeepSeek Harness 装一个「AI 工作区」:11 个工具(container_fs/logbook/dashboard/container_git/msm/praxis/handyman/localstore/container_admin/trajectory/im-bridge)+ 机械约束(安全模式/工作区围墙/密钥守卫/对外输出守卫)+ 工作日志与原地重建 + 网页登录入口/微信桥/子角色/对外问答页/trajectory 唤醒注册表。适配 DSH 0.1.5-rc.2。",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|