@shgroup/dsh-serenity-hooks 1.34.0 → 1.34.2

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.
Files changed (96) hide show
  1. package/README.md +1 -0
  2. package/dsh.plugin.json +1 -1
  3. package/lib/acp-core.d.ts +2 -22
  4. package/lib/acp-http.d.ts +8 -0
  5. package/lib/api.d.ts +12 -4
  6. package/lib/autopilot-chain.d.ts +76 -0
  7. package/lib/autopilot-core-DCRkiWEe.js +229 -0
  8. package/lib/autopilot-core.d.ts +132 -0
  9. package/lib/autopilot-ops.d.ts +48 -0
  10. package/lib/autopilot-trajectory-D9Znxo75.js +782 -0
  11. package/lib/autopilot-trajectory.d.ts +64 -97
  12. package/lib/ccc-roots-Bd_SjEs7.js +152 -0
  13. package/lib/ccc-roots.d.ts +105 -0
  14. package/lib/ccc.d.ts +3 -6
  15. package/lib/client.js +2 -2
  16. package/lib/clock-runtime.d.ts +197 -0
  17. package/lib/config-ops.d.ts +9 -14
  18. package/lib/constants.d.ts +0 -2
  19. package/lib/container-status.d.ts +183 -0
  20. package/lib/diag-ops.d.ts +25 -10
  21. package/lib/face-host.d.ts +110 -0
  22. package/lib/fs-ops.d.ts +3 -2
  23. package/lib/gateway-auth.d.ts +2 -5
  24. package/lib/gateway.d.ts +0 -34
  25. package/lib/git-ops.d.ts +3 -2
  26. package/lib/handyman-ops.d.ts +3 -2
  27. package/lib/handyman-preset-inherit.d.ts +2 -1
  28. package/lib/host/access.d.ts +8 -7
  29. package/lib/host/contract.d.ts +29 -6
  30. package/lib/host/type-contract.d.ts +1 -2
  31. package/lib/im-bridge.d.ts +6 -5
  32. package/lib/index.js +8336 -5607
  33. package/lib/invariant.d.ts +0 -15
  34. package/lib/invariant.js +1 -1
  35. package/lib/kit-ops.d.ts +11 -31
  36. package/lib/localstore-ops.d.ts +3 -17
  37. package/lib/msm-ops.d.ts +34 -52
  38. package/lib/opencode-provider.d.ts +4 -5
  39. package/lib/output-guard-seam.d.ts +0 -3
  40. package/lib/output-guard.d.ts +12 -3
  41. package/lib/ports.d.ts +59 -0
  42. package/lib/rebuild.d.ts +1 -1
  43. package/lib/seams/bootstrap.d.ts +4 -3
  44. package/lib/seams/compact.d.ts +2 -1
  45. package/lib/seams/context.d.ts +2 -4
  46. package/lib/seams/env.d.ts +2 -1
  47. package/lib/seams/guards.d.ts +4 -43
  48. package/lib/seams/keeper.d.ts +1 -1
  49. package/lib/seams/system-prompt.d.ts +1 -5
  50. package/lib/session-cleanup.d.ts +3 -2
  51. package/lib/{settings-section-BuPGQv_H.js → settings-section-DTYZjwUs.js} +65 -9
  52. package/lib/settings-section.d.ts +3 -31
  53. package/lib/skiff-core.d.ts +4 -9
  54. package/lib/skiff-debug.d.ts +15 -21
  55. package/lib/skiff-registry-FTjoWQTQ.js +25 -0
  56. package/lib/skiff-registry.d.ts +2 -1
  57. package/lib/{skiff-role-DAfPb6YQ.js → skiff-role-CEHL5cek.js} +1 -1
  58. package/lib/skiff-role.d.ts +2 -2
  59. package/lib/skills/opencode-scan.d.ts +3 -2
  60. package/lib/skills-discovery.d.ts +15 -2
  61. package/lib/status.d.ts +2 -1
  62. package/lib/tools/cce.d.ts +1 -2
  63. package/lib/tools/container-admin.d.ts +7 -3
  64. package/lib/tools/eap.d.ts +2 -3
  65. package/lib/tools/handyman.d.ts +0 -29
  66. package/lib/tools/msm.d.ts +0 -4
  67. package/lib/tools/neat.d.ts +1 -2
  68. package/lib/tools/praxis.d.ts +0 -1
  69. package/lib/tools/skiff-admin.d.ts +2 -2
  70. package/lib/tools/trajectory.d.ts +7 -15
  71. package/lib/totp.d.ts +0 -4
  72. package/lib/trajectory-assistant.d.ts +2 -1
  73. package/lib/trajectory-bound-Cax1p9ut.js +190 -0
  74. package/lib/trajectory-bound.d.ts +3 -4
  75. package/lib/{trajectory-bound-C8DUxi6_.js → trajectory-ops-mrXK0H0I.js} +2 -159
  76. package/lib/trajectory-ops.d.ts +4 -9
  77. package/lib/trajectory-skills.d.ts +71 -0
  78. package/lib/{wake-registry-D0Vj0WXb.js → wake-registry-CYxIb484.js} +7 -20
  79. package/lib/wake-registry.d.ts +3 -11
  80. package/lib/wake-scheduler.d.ts +13 -49
  81. package/lib/web-fetch-provider.d.ts +0 -21
  82. package/lib/{weixin-api-PjEhmjlZ.js → weixin-api-CtFYm53S.js} +3 -9
  83. package/lib/weixin-api.d.ts +6 -37
  84. package/lib/weixin-bridge.d.ts +5 -24
  85. package/lib/weixin-hook.d.ts +6 -12
  86. package/lib/weixin-output-guard.d.ts +2 -1
  87. package/lib/{weixin-route-D1ND823E.js → weixin-route-B2ajFypI.js} +4 -5
  88. package/lib/weixin-route.d.ts +0 -2
  89. package/lib/weixin-send-api.d.ts +15 -6
  90. package/package.json +2 -4
  91. package/experiments/autopilot-trajectory/SKILL.md +0 -115
  92. package/experiments/autopilot-trajectory/scripts/autopilot-trajectory.ts +0 -546
  93. package/lib/autopilot-script.d.ts +0 -40
  94. package/lib/skiff-debug-D83-Njy7.js +0 -2867
  95. package/lib/{ccc-eu_IPF94.js → ccc-NlLr_sxy.js} +1 -1
  96. package/lib/{session-cleanup-CMT4mHWt.js → session-cleanup-B6IHZgww.js} +1 -1
package/lib/fs-ops.d.ts CHANGED
@@ -10,7 +10,7 @@
10
10
  * 保留 dsp 增强:win32 reveal 用 spawn+unref(explorer GUI 进程退出码不可靠,fire-and-forget)。
11
11
  */
12
12
  import type { JsonValue } from './json.js';
13
- export type CcFsAction = 'root' | 'resolve' | 'exists' | 'list' | 'tree' | 'relative' | 'mkdir' | 'rm' | 'mv' | 'cp' | 'touch' | 'append' | 'reveal' | 'info' | 'find';
13
+ type CcFsAction = 'root' | 'resolve' | 'exists' | 'list' | 'tree' | 'relative' | 'mkdir' | 'rm' | 'mv' | 'cp' | 'touch' | 'append' | 'reveal' | 'info' | 'find';
14
14
  export declare const CC_FS_ACTIONS: readonly CcFsAction[];
15
15
  export interface CcFsArgs {
16
16
  action: CcFsAction;
@@ -32,5 +32,6 @@ export interface CcFsArgs {
32
32
  /** 对齐 osp:find 最大递归深度(缺省不限) */
33
33
  maxDepth?: number;
34
34
  }
35
- export type CcFsResult = JsonValue;
35
+ type CcFsResult = JsonValue;
36
36
  export declare function runCcFs(root: string, args: CcFsArgs): CcFsResult;
37
+ export {};
@@ -37,7 +37,7 @@ export declare const FAIL_LOCK_THRESHOLD = 5;
37
37
  export declare const FAIL_LOCK_BASE_MS: number;
38
38
  /** 锁定时长指数退避上限 */
39
39
  export declare const FAIL_LOCK_MAX_MS: number;
40
- export interface FailState {
40
+ interface FailState {
41
41
  /** 连续失败计数(成功登录后清零) */
42
42
  count: number;
43
43
  /** 当前锁定截止时间(0 = 未锁定) */
@@ -55,10 +55,6 @@ export declare function isAccountLocked(user: string): boolean;
55
55
  export declare function recordLoginFailure(user: string): number;
56
56
  /** 剩余锁定毫秒(0 = 未锁定) */
57
57
  export declare function accountLockRemaining(user: string): number;
58
- /** CSRF token 有效期(毫秒):10 分钟窗口(扫码/多标签场景留足时间) */
59
- export declare const CSRF_TTL_MS: number;
60
- /** CSRF token 集合上限(防内存膨胀;超限清理最旧) */
61
- export declare const CSRF_MAX_TOKENS = 50;
62
58
  /** 生成 CSRF token(随机 32B hex)并入集合 */
63
59
  export declare function newCsrfToken(): string;
64
60
  /** token 是否有效(在集合且未过期;过期自动清理) */
@@ -87,3 +83,4 @@ export declare function cookieValue(header: string | undefined, name: string): s
87
83
  * @param csrf - CSRF token(隐藏字段随表单双提交;无 = 旧调用方兼容)
88
84
  */
89
85
  export declare function loginPageHtml(extra: string, csrf?: string): string;
86
+ export {};
package/lib/gateway.d.ts CHANGED
@@ -26,7 +26,6 @@
26
26
  * 保持既有 import 面兼容(tests/gateway.test.ts 直接 import 两模块导出)。
27
27
  */
28
28
  import type { Context } from 'cordis';
29
- import { type Server } from 'node:http';
30
29
  export { RANDOM_UUID_POLYFILL, injectPolyfillHtml, filterWorkspaceList, workspaceAllowed, workspaceDenyResponse, isWorkspaceCreatePath, parseWorkspaceCreateBody, buildProxyHeaders, transformHtmlForProxy, } from './gateway-proxy.js';
31
30
  export { loginPageHtml, verifyGatewayLogin, SESSION_TTL_MS, issueToken, revokeToken, validateToken, FAIL_LOCK_THRESHOLD, FAIL_LOCK_BASE_MS, FAIL_LOCK_MAX_MS, getFailState, resetFailState, isAccountLocked, recordLoginFailure, accountLockRemaining, newCsrfToken, isCsrfValid, csrfFromRequest, safeEqual, originAllowed, cookieValue, } from './gateway-auth.js';
32
31
  declare module 'cordis' {
@@ -37,39 +36,6 @@ declare module 'cordis' {
37
36
  'serenity/settings-changed'(): void;
38
37
  }
39
38
  }
40
- export interface GatewayConfig {
41
- host: string;
42
- port: number;
43
- /** 登录态 cookie 名 */
44
- cookieName: string;
45
- /** 主端口(ctx.webServer.port) */
46
- mainPort: number;
47
- /** 登录失败后的重定向延迟(秒) */
48
- loginDelayMs: number;
49
- /** 外部可访问的工作区路径前缀白名单(v1.22;空 = 全部允许) */
50
- allowWorkspaces?: string[];
51
- /** Cookie Secure 属性(v1.22.4;反代 TLS 时开启;明文 HTTP 下必须关,否则 cookie 不落) */
52
- cookieSecure?: boolean;
53
- /** 允许外部新建工作区(v1.22.4;false = workspace.create 一律 403 RPC error) */
54
- allowWorkspaceCreate?: boolean;
55
- /** 启用 Authenticator 第二因素(v1.22.4;false = TOTP 完全禁用) */
56
- totpEnabled?: boolean;
57
- }
58
- /**
59
- * 启动第二监听器。返回 { server, dispose }——dispose 关 server(**不清 token**:
60
- * token 模块级,进程重启自然清空;热重建清 token → 已登录用户 WS 断 + 重连 cookie 无效)。
61
- * @param config - 监听/代理配置。
62
- * @param getAccounts - 运行时读取账号列表(plugin 全局文件;gateway.enabled 开关在调用方判)。
63
- */
64
- export declare function startGateway(config: GatewayConfig, getAccounts: () => readonly {
65
- id: string;
66
- user: string;
67
- passHash: string;
68
- totpSecret?: string;
69
- }[], getDshCookie?: () => string | undefined): {
70
- server: Server;
71
- dispose: () => void;
72
- };
73
39
  /** 注册 gateway(index.ts apply 调用)。
74
40
  * 归属原则(v1.22):gateway 是 plugin 全局能力——enabled 开关读 DSH settings
75
41
  * (readSimpleSettings().gatewayEnabled),host/port/accounts 读 plugin 全局文件
package/lib/git-ops.d.ts CHANGED
@@ -11,9 +11,9 @@
11
11
  * 保留 dsp 增强:localstore git 合规联动(S134:deny 且 .gitignore 未覆盖 → status 提示 / commit 拒绝)。
12
12
  */
13
13
  import type { JsonValue } from './json.js';
14
- export type GitAction = 'status' | 'commit' | 'push' | 'log' | 'pull' | 'diff';
14
+ type GitAction = 'status' | 'commit' | 'push' | 'log' | 'pull' | 'diff';
15
15
  export declare const GIT_ACTIONS: readonly GitAction[];
16
- export interface GitArgs {
16
+ interface GitArgs {
17
17
  action: GitAction;
18
18
  message?: string;
19
19
  /** log 条数(对齐 osp 参数 n,默认 10,max 100) */
@@ -26,3 +26,4 @@ export interface GitArgs {
26
26
  path?: string;
27
27
  }
28
28
  export declare function runGit(root: string, args: GitArgs): JsonValue;
29
+ export {};
@@ -5,7 +5,7 @@
5
5
  * 进度文件(handyman-<label>.md/.json)、续跑、轮次 prompt 结构、stop token。
6
6
  * 不兼容旧 loop- 进度文件(用户拍板:仅新 handyman- 前缀)。
7
7
  */
8
- export interface HandymanProgress {
8
+ interface HandymanProgress {
9
9
  round: number;
10
10
  done: boolean;
11
11
  label: string;
@@ -56,7 +56,7 @@ export declare function buildRoundPrompt(opts: {
56
56
  */
57
57
  export declare const HANDYMAN_GUIDE = "# handyman \u2014 Scale-Up Usage Guide (guide)\n\n## Two modes (v1.31.3; default = foreground)\n| | foreground (default) | background |\n|---|---|---|\n| What | one serial child agent runs the task ONCE and returns its final text | loop-validated worker: hard while-loop + random completion code |\n| Use when | you need exactly one result back now (per-case testers, single conversions) | long/unattended work needing anti-early-finish, resumability, or parallel jobs |\n| Loop / validation | none | stop-token is the ONLY completion condition; round cap (default 100); auto-restart (\u2264100) |\n| Progress file | none | AGENT_SESSIONS/handyman-<label>.md/.json (same label resumes) |\n| Parallel jobs | no (call once per task) | yes (jobs=[...], handyman.maxParallel default 10) |\n| Mechanism | host delegation service ctx.subagents.start(\"spawn\") + agentOptions | ctx.agents.create + internal while-loop |\n| Model source | CCC handyman.models whitelist (same for both) | same |\n\n## \u26A0\uFE0F Before using: load eap and design the plan\nBefore calling handyman, load eap (acc-eap skill) and design the \"scale-up handyman plan\" based on the EAP framework.\n\n### 1. Task decomposition (E\u2191 Explicit)\n- Split large tasks into explicit subtasks: each subtask defines goal / input / boundaries (what to do, what not to do) / acceptance criteria\n- Make dependencies explicit: dependent tasks run serially, independent ones can run in parallel (background mode)\n\n### 2. Prompt design (handyman's task parameter)\n- task must be detailed, fixed, and EAP-compliant: clear goal, drawn boundaries, decidable acceptance criteria\n- foreground mode: the child does NOT share your conversation \u2014 restate everything it needs in task\n- Anti-example \"handle this file\" \u2014 ambiguous; good example \"read <path>, extract all rows of the\u300C\u5173\u952E\u51B3\u7B56\u300Dtable,\n output a JSON array (fields id/conclusion/evidence), do not modify the original file\"\n- Reading/curating or text-writing work (extracting from files, summarizing, writing docs, generating text, etc.):\n the handyman-internal agent is also required to load eap and organize output per the EAP standard\n\n### 3. Model whitelist (CCC-configured, mandatory)\n- handyman only uses models listed in .opencode/serenity.json \"handyman.models\" \u2014 never arbitrary models\n- The CCC is expected to point this whitelist at LOW-COST models: handyman is the bulk-execution channel\n- background mode: recursive subagents inside a worker inherit the worker's model automatically (DSH native)\n- foreground mode: the child is started through the host delegation service with the resolved model\n\n### 4. Parallel strategy (background mode only)\n- Independent subtasks can run in parallel via handyman(mode=\"background\", jobs=[...]): each job gets its own label + task + stop token + progress file\n- Concurrency safety guaranteed: unique sessionId (handyman-<label>-<uuid>), progress files isolated per label\n (AGENT_SESSIONS/handyman-<label>.json) \u2014 same label resumes, different labels never interfere\n- Parallel cap: handyman.maxParallel (default 10 \u2014 cheap models are cheap)\n- Aggregation: after each parallel job produces progress, the main agent merges (or spawns one aggregation handyman)\n- For programmable pipeline/phase orchestration at scale, use the platform's workflow tool instead\n\n## Completion criteria\n- foreground: the child's run settles; done=true only when stopReason=\"completed\" (otherwise read diagnostic)\n- background (osp loop standard): the only completion condition = the worker echoes this round's random verification\n code (stop token); dialogue round cap (default 100, osp fail-safe, forced stop beyond the cap, resumable);\n automatic restart on abnormal agent stop (\u2264100 restarts, anti-infinite-loop)\n\n## Waiting UI\n- The WebUI session-header Serenity detail card shows running background handymen's progress\n (label / round / last response), one line per parallel job, ~3s refresh (foreground mode writes no progress)\n";
58
58
  /** handyman 运行状态(进度文件摘要;WebUI 等待界面数据源) */
59
- export interface HandymanRunInfo {
59
+ interface HandymanRunInfo {
60
60
  label: string;
61
61
  round: number;
62
62
  done: boolean;
@@ -66,3 +66,4 @@ export interface HandymanRunInfo {
66
66
  }
67
67
  /** 列出 AGENT_SESSIONS/handyman-*.json 的全部进度(按 updated 倒序;坏文件跳过) */
68
68
  export declare function listActiveHandymen(root: string): HandymanRunInfo[];
69
+ export {};
@@ -20,7 +20,7 @@
20
20
  */
21
21
  import type { Context } from 'cordis';
22
22
  /** 从父 agent ctx 解析 preset 继承的创建期组合。 */
23
- export interface HandymanPresetInheritance {
23
+ interface HandymanPresetInheritance {
24
24
  /** 父 agent 的 preset id(写入子 session meta.agentPreset,供持久化重建);无则不写。 */
25
25
  readonly agentPreset?: string;
26
26
  /** 创建 setup 钩子:子 scope join 父的 standing preset + deny handyman 工具;无 preset 继承时仅 deny。 */
@@ -32,3 +32,4 @@ export interface HandymanPresetInheritance {
32
32
  * @returns 继承结果:meta 用的 agentPreset 与创建 setup 钩子。
33
33
  */
34
34
  export declare function handymanPresetInheritance(parentCtx: Context | undefined): HandymanPresetInheritance;
35
+ export {};
@@ -33,7 +33,7 @@ export declare function hostService<T = unknown>(ctx: unknown, name: string): T
33
33
  * (宿主对插件 apply 抛错 = 整个 dsh 启动失败)。读取失败 = 服务不可用,等价于缺失。
34
34
  */
35
35
  export declare function hostInjected<T = unknown>(ctx: unknown, name: string): T | undefined;
36
- export interface HostSessionLike {
36
+ interface HostSessionLike {
37
37
  id?: string;
38
38
  header?: {
39
39
  cwd?: string;
@@ -41,25 +41,25 @@ export interface HostSessionLike {
41
41
  };
42
42
  snapshotEvents?: () => unknown[];
43
43
  }
44
- export interface HostSessions {
44
+ interface HostSessions {
45
45
  list?: () => HostSessionLike[];
46
46
  get?: (id: unknown) => HostSessionLike | undefined;
47
47
  create?: (...args: unknown[]) => unknown;
48
48
  }
49
- export interface HostAgents {
49
+ interface HostAgents {
50
50
  create?: (...args: unknown[]) => unknown;
51
51
  get?: (id: string) => unknown;
52
52
  resume?: (...args: unknown[]) => unknown;
53
53
  }
54
- export interface HostWebServer {
54
+ interface HostWebServer {
55
55
  register?: (registration: unknown) => unknown;
56
56
  port?: number;
57
57
  }
58
- export interface HostSettings {
58
+ interface HostSettings {
59
59
  installSection?: (...args: unknown[]) => unknown;
60
60
  }
61
61
  /** `ctx.web`(injected;v1.30.12:fetch provider 注册通道) */
62
- export interface HostWeb {
62
+ interface HostWeb {
63
63
  registerFetchProvider?: (provider: unknown) => unknown;
64
64
  registerSearchProvider?: (provider: unknown) => unknown;
65
65
  }
@@ -82,9 +82,10 @@ export declare function hostWeb(ctx: unknown): HostWeb | undefined;
82
82
  * 注(v1.31.4):本服务**不在** dsp 的 `inject` 列表内,因此走 `hostInjected` 的
83
83
  * 回落分支(`ctx.get`)——见 `hostInjected` 的 v1.31.4 说明与真实 cordis 用例。
84
84
  */
85
- export interface HostSubagents {
85
+ interface HostSubagents {
86
86
  start?: (name: string, request: unknown) => Promise<unknown>;
87
87
  }
88
88
  export declare function hostSubagents(ctx: unknown): HostSubagents | undefined;
89
89
  /** 会话 cwd 列表(live 会话;形状不符时返回空数组而非抛错) */
90
90
  export declare function hostSessionCwds(ctx: unknown): string[];
91
+ export {};
@@ -19,12 +19,12 @@
19
19
  * 宿主类型断言),此处只登记清单供文档/测试共用。
20
20
  * - **缺失分级**:`required` = 缺失即 ACC 核心能力失效;否则为可降级能力。
21
21
  */
22
- export type HostAccess = 'injected' | 'lazy';
23
- export interface HostMember {
22
+ type HostAccess = 'injected' | 'lazy';
23
+ interface HostMember {
24
24
  name: string;
25
25
  kind: 'function' | 'value';
26
26
  }
27
- export interface HostServiceContract {
27
+ interface HostServiceContract {
28
28
  /** 稳定标识(报告用) */
29
29
  id: string;
30
30
  /** 服务名(`ctx.get(name)` 或 `ctx.<name>`) */
@@ -40,7 +40,7 @@ export interface HostServiceContract {
40
40
  }
41
41
  /** dsp 依赖的宿主服务与成员(对照 `_tmp/host-0.1.5-rc.1/`(`dsh-develop host-fetch` 产物)逐一核对) */
42
42
  export declare const HOST_SERVICES: readonly HostServiceContract[];
43
- export interface HostEventContract {
43
+ interface HostEventContract {
44
44
  name: HostEventName;
45
45
  /** 订阅方(文件) */
46
46
  site: string;
@@ -56,14 +56,14 @@ export interface HostEventContract {
56
56
  * 该 import 为 type-only,编译期擦除,不产生运行时依赖。
57
57
  */
58
58
  export declare const HOST_EVENT_NAMES: readonly ["agent/session-start", "agent/pre-step", "agent/turn-stopping", "agent/status", "agent/inbox/inserted", "agent/disposed", "session/event", "session/created", "session/disposed", "settings/updated", "tools/pre-execute", "tools/post-execute", "system-prompt/assemble"];
59
- export type HostEventName = (typeof HOST_EVENT_NAMES)[number];
59
+ type HostEventName = (typeof HOST_EVENT_NAMES)[number];
60
60
  /**
61
61
  * dsp 订阅的宿主事件清单(与 HOST_EVENT_NAMES 同源;impact/site 供 health 报告与文档)。
62
62
  */
63
63
  export declare const HOST_EVENTS: readonly HostEventContract[];
64
64
  /** dsp 被验证过的宿主版本范围(与 package.json peerDependencies 同源,单一真相源) */
65
65
  export declare const REQUIRED_HOST_RANGE = "^0.1.5-rc.2";
66
- export interface HostContractIssue {
66
+ interface HostContractIssue {
67
67
  id: string;
68
68
  kind: 'service' | 'member' | 'version';
69
69
  detail: string;
@@ -100,5 +100,28 @@ export declare function checkHostVersion(version: string | null): {
100
100
  * @returns 报告(`ok:false` 时 `issues` 逐条给出缺失项与后果)
101
101
  */
102
102
  export declare function probeHostContract(ctx: unknown, hostVersion?: string | null): HostContractReport;
103
+ /**
104
+ * 取宿主契约报告——**每次调用现探**(`ctx` 决定"问谁",**不缓存"答案"**)。
105
+ *
106
+ * 为什么**不缓存**(R↓:一个被实测推翻的设计,留档以免重犯):
107
+ * v1.34.1 曾把 `apply()` 时的探针结果存为模块级快照,理由是"两者对**同一个已装载的宿主**
108
+ * 问同一个问题,第二次计算的答案**不可能不同**,成本却是一次全服务遍历"。
109
+ * **该前提被实测证伪**(本机 2026-09-15,v1.34.1 部署后):
110
+ * - `apply()` 跑在装载早期,表中 `access:'lazy'` 的服务**尚未实例化**(`ctx.get` 返回 undefined)
111
+ * ⇒ 启动探针把它们记为 `not available (lazy)`;
112
+ * - 到 `dashboard health` 被调用时它们早已可用 ⇒ **现探给的是相反结论**。
113
+ * - 实测差异:快照 = `checked 36 / issues 3`(含 `workspaceRegistry not available` + 后果
114
+ * "工作区白名单下拉为空"),而**同一时刻** `GET /serenity/cccs` 正常返回 **4 个工作区**
115
+ * (含 3 个无 live 会话的冷 CCC)⇒ 快照渲染出的是**假阴性**。
116
+ * ⇒ 「两次探针」**不是重复计算,问的是两个时刻**;缓存答案 = 把装载瞬间的观测冒充运行态事实。
117
+ *
118
+ * 保留统一入口的收益(这才是 C5 的正确部分):取数口唯一——`container-status` / `kit-ops`
119
+ * 只问这一个函数;将来若要"筛掉装载期噪声",只需改这一处。
120
+ *
121
+ * @param ctx 宿主上下文;**未给** ⇒ 返回 `null`(不猜、不暗跑探针)
122
+ * @param hostVersion 运行中宿主版本(`readDshVersion()`;null = 未知)
123
+ */
124
+ export declare function hostContractReport(ctx?: unknown, hostVersion?: string | null): HostContractReport | null;
103
125
  /** 单行摘要(启动告警用) */
104
126
  export declare function summarizeHostContract(report: HostContractReport): string;
127
+ export {};
@@ -40,5 +40,4 @@
40
40
  *
41
41
  * 注:本文件**没有任何运行时语句**,编译产物只有 `export {}`,不影响包体行为。
42
42
  */
43
- /** 哨兵:确保本模块不是空文件被 tree-shake 掉(无运行时副作用,值为类型) */
44
- export type HostTypeContractSatisfied = true;
43
+ export {};
@@ -32,7 +32,7 @@ export type ImUserEntry = {
32
32
  id: string;
33
33
  };
34
34
  /** 文本发送输入(通道实现负责凭据解析与记录) */
35
- export interface ImSendInput {
35
+ interface ImSendInput {
36
36
  root: string;
37
37
  /** 通道内用户 id(别名已由本模块解析) */
38
38
  userId: string;
@@ -40,14 +40,14 @@ export interface ImSendInput {
40
40
  accountId?: string;
41
41
  }
42
42
  /** 文本发送结果(与既有主动发送返回一致,便于记录/诊断) */
43
- export interface ImSendResult {
43
+ interface ImSendResult {
44
44
  accountId: string;
45
45
  userId: string;
46
46
  sessionId: string;
47
47
  role: string;
48
48
  }
49
49
  /** 文件发送输入(`data` 由本模块读盘并校验后传入——通道不碰 CCC 路径) */
50
- export interface ImSendFileInput {
50
+ interface ImSendFileInput {
51
51
  root: string;
52
52
  userId: string;
53
53
  data: Buffer;
@@ -95,7 +95,7 @@ export type ImJson = null | boolean | number | string | ImJson[] | {
95
95
  [key: string]: ImJson;
96
96
  };
97
97
  /** 分发结果(工具面直接渲染;错误码稳定,便于模型与日志消费) */
98
- export type ImToolResult = {
98
+ type ImToolResult = {
99
99
  ok: true;
100
100
  channel: string;
101
101
  action: string;
@@ -106,7 +106,7 @@ export type ImToolResult = {
106
106
  error: string;
107
107
  remediation?: string;
108
108
  };
109
- export interface ImToolRequest {
109
+ interface ImToolRequest {
110
110
  channel?: string;
111
111
  action?: string;
112
112
  user?: string;
@@ -125,3 +125,4 @@ export interface ImToolRequest {
125
125
  * @param req 工具参数
126
126
  */
127
127
  export declare function runImBridge(root: string, req: ImToolRequest): Promise<ImToolResult>;
128
+ export {};