@fusengine/harness 0.1.79 → 0.1.81

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 (76) hide show
  1. package/README.md +14 -1
  2. package/dist/adapters/claude/index.d.mts +1 -1
  3. package/dist/adapters/claude/index.mjs +1 -1
  4. package/dist/adapters/cline/index.mjs +1 -1
  5. package/dist/adapters/codex/index.d.mts +11 -12
  6. package/dist/adapters/codex/index.mjs +3 -3
  7. package/dist/adapters/cursor/index.d.mts +29 -29
  8. package/dist/adapters/cursor/index.mjs +1 -1
  9. package/dist/adapters/gemini/index.mjs +1 -1
  10. package/dist/adapters/hermes/index.d.mts +22 -23
  11. package/dist/adapters/hermes/index.mjs +1 -1
  12. package/dist/adapters/kimi/index.d.mts +87 -0
  13. package/dist/adapters/kimi/index.mjs +2 -0
  14. package/dist/cache/index.d.mts +1 -1
  15. package/dist/{claude-51RSspJ1.mjs → claude-D93HY8dq.mjs} +2 -2
  16. package/dist/cli/bin.d.mts +1 -1
  17. package/dist/cli/bin.mjs +130 -39
  18. package/dist/cli/index.d.mts +3 -3
  19. package/dist/cli/index.mjs +1 -1
  20. package/dist/config/index.d.mts +2 -2
  21. package/dist/config/index.mjs +4 -4
  22. package/dist/detect/index.d.mts +2 -1
  23. package/dist/detect/index.mjs +1 -1
  24. package/dist/{doc-helpers-CEKzGg2u.d.mts → doc-helpers-BGCzP9VF.d.mts} +12 -12
  25. package/dist/{dotenv-Jj8aL1FL.mjs → dotenv-DoqNlALG.mjs} +31 -3
  26. package/dist/{evaluate-ClfbCDiY.mjs → evaluate-B4-MhOy_.mjs} +322 -32
  27. package/dist/freshness/index.d.mts +2 -2
  28. package/dist/{handle-Dthtlp7Z.mjs → handle-J5r2f_O_.mjs} +665 -164
  29. package/dist/{harness-Cb9xR8dC.mjs → harness-BMuLJ9lm.mjs} +4 -2
  30. package/dist/{hermes-rTmVdhUL.mjs → hermes-1PUEoY8q.mjs} +2 -2
  31. package/dist/{home-state-BXf38Zi1.mjs → home-state-oUGFB4ds.mjs} +4 -2
  32. package/dist/index-84heAAm_.d.mts +12 -0
  33. package/dist/index-CaxrMD1A.d.mts +1 -0
  34. package/dist/index-CigBu4K9.d.mts +14 -0
  35. package/dist/{index-DGxNjXW7.d.mts → index-D4C2-IIc.d.mts} +6 -8
  36. package/dist/index-DBgnIZn9.d.mts +756 -0
  37. package/dist/{index-mmRF3KNp.d.mts → index-DEfz82BP.d.mts} +12 -13
  38. package/dist/{index-BUwEmIK-.d.mts → index-DhmV2MPh.d.mts} +31 -31
  39. package/dist/index-oXXPs2xl.d.mts +119 -0
  40. package/dist/index-p9fLrSOD.d.mts +27 -0
  41. package/dist/index.d.mts +11 -11
  42. package/dist/index.mjs +9 -9
  43. package/dist/init/index.d.mts +8 -9
  44. package/dist/init/index.mjs +1 -1
  45. package/dist/kimi-ChbcU2uI.mjs +94 -0
  46. package/dist/{layout-C0jaaCQC.mjs → layout-KWoE_Mqn.mjs} +1 -0
  47. package/dist/limits-DG5pl-5s.mjs +59 -0
  48. package/dist/memory/index.mjs +1 -1
  49. package/dist/policy/index.d.mts +2 -3
  50. package/dist/policy/index.mjs +4 -4
  51. package/dist/prompt/index.d.mts +2 -1
  52. package/dist/refs/index.d.mts +1 -1
  53. package/dist/{registry-CymilZiZ.mjs → registry-IhHk2KlT.mjs} +1 -1
  54. package/dist/{run-3tyTW9Ud.mjs → run-D_WchZ3R.mjs} +1 -1
  55. package/dist/{run-Do2JltgU.mjs → run-TAXNRSpD.mjs} +1 -1
  56. package/dist/runtime/index.d.mts +455 -446
  57. package/dist/runtime/index.mjs +3 -3
  58. package/dist/{session-state-CY4iohn_.d.mts → session-state-D5gLr66m.d.mts} +29 -30
  59. package/dist/{skill-path-BO2N0XvB.mjs → skill-path-DhBGlQe3.mjs} +3 -3
  60. package/dist/{store-Bcn08y9m.mjs → store-yr_QFsZY.mjs} +101 -13
  61. package/dist/tracking/index.d.mts +22 -13
  62. package/dist/tracking/index.mjs +2 -2
  63. package/dist/{types-DVbIl9md.d.mts → types-C0-igRKr.d.mts} +8 -8
  64. package/dist/types-DvXTI71X.d.mts +15 -0
  65. package/dist/util/index.d.mts +1 -1
  66. package/dist/{validate-DhOX5hDK.mjs → validate-Bf-EsbDh.mjs} +348 -32
  67. package/package.json +163 -158
  68. package/dist/apex-Wdi1nq_w.d.mts +0 -73
  69. package/dist/harness-s1Fce_dL.d.mts +0 -27
  70. package/dist/index-BEMumjOw.d.mts +0 -27
  71. package/dist/index-BIGVNQB8.d.mts +0 -576
  72. package/dist/index-BKZ67WMa.d.mts +0 -1
  73. package/dist/index-BOBXQ91y.d.mts +0 -12
  74. package/dist/index-BVVgDSdq.d.mts +0 -1
  75. package/dist/index-jj_EzZRv.d.mts +0 -96
  76. package/dist/limits-CHn8AIL1.mjs +0 -31
@@ -1,41 +1,40 @@
1
- import { t as Prompt } from "../types-DVbIl9md.mjs";
1
+ import { t as Prompt } from "../types-C0-igRKr.mjs";
2
2
  import { t as RefMeta } from "../types-CY5qT2X1.mjs";
3
- import { t as AgentQuality } from "../session-state-CY4iohn_.mjs";
4
-
3
+ import { t as AgentQuality } from "../session-state-D5gLr66m.mjs";
5
4
  //#region src/runtime/paths.d.ts
6
5
  /**
7
- * Compute a stable 8-char hex hash for a project directory path.
8
- * Delegates to `hashText` (MD5, non-cryptographic — used as a stable dir key only).
9
- *
10
- * @param projectDir - Absolute path to the project root; defaults to CLAUDE_PROJECT_DIR/cwd.
11
- * @returns 8-char lowercase hex string.
12
- */
6
+ * Compute a stable 8-char hex hash for a project directory path.
7
+ * Delegates to `hashText` (MD5, non-cryptographic — used as a stable dir key only).
8
+ *
9
+ * @param projectDir - Absolute path to the project root; defaults to CLAUDE_PROJECT_DIR/cwd.
10
+ * @returns 8-char lowercase hex string.
11
+ */
13
12
  declare function projectHash(projectDir?: string): string;
14
13
  /**
15
- * Canonical base directory for per-project harness state.
16
- * Resolves to: ~/.fuse-harness/state/<projectHash>/
17
- *
18
- * @param projectDir - Optional override for hashing; defaults to CLAUDE_PROJECT_DIR/cwd.
19
- * @returns Absolute directory path (not yet created on disk).
20
- */
14
+ * Canonical base directory for per-project harness state.
15
+ * Resolves to: ~/.fuse-harness/state/<projectHash>/
16
+ *
17
+ * @param projectDir - Optional override for hashing; defaults to CLAUDE_PROJECT_DIR/cwd.
18
+ * @returns Absolute directory path (not yet created on disk).
19
+ */
21
20
  declare function defaultStateDir(projectDir?: string): string;
22
21
  /**
23
- * Absolute path to a session's track JSON file.
24
- *
25
- * The session identifier is sanitised to `[A-Za-z0-9_-]` before use in the filename.
26
- *
27
- * @param sessionId - Claude session identifier (raw value accepted; sanitised internally).
28
- * @param baseDir - Override the base directory. Omit in production; pass an explicit
29
- * temp path in unit tests to avoid touching $HOME.
30
- * @returns Absolute path, e.g. ~/.fuse-harness/state/a1b2c3d4/track-abc123.json
31
- */
22
+ * Absolute path to a session's track JSON file.
23
+ *
24
+ * The session identifier is sanitised to `[A-Za-z0-9_-]` before use in the filename.
25
+ *
26
+ * @param sessionId - Claude session identifier (raw value accepted; sanitised internally).
27
+ * @param baseDir - Override the base directory. Omit in production; pass an explicit
28
+ * temp path in unit tests to avoid touching $HOME.
29
+ * @returns Absolute path, e.g. ~/.fuse-harness/state/a1b2c3d4/track-abc123.json
30
+ */
32
31
  declare function trackFile(sessionId: string, baseDir?: string): string;
33
32
  //#endregion
34
33
  //#region src/runtime/storage.d.ts
35
34
  /**
36
- * The project's single state dir (`<root>/.harness`) — neutral + harness-agnostic,
37
- * derived from {@link projectLayout}. (Was the per-harness `.claude/harness`.)
38
- */
35
+ * The project's single state dir (`<root>/.harness`) — neutral + harness-agnostic,
36
+ * derived from {@link projectLayout}. (Was the per-harness `.claude/harness`.)
37
+ */
39
38
  declare function harnessStateDir(root: string): string;
40
39
  //#endregion
41
40
  //#region src/runtime/record.d.ts
@@ -72,14 +71,14 @@ interface ToolEvent {
72
71
  responseLength?: number;
73
72
  }
74
73
  /**
75
- * Map a live tool-use to the activity to record, or null when nothing is
76
- * tracked. Works across harnesses — tool names are globally distinct:
77
- * - MCP doc calls (`context7` / `exa`, any separator) → `doc`
78
- * - `Task`/`Agent` + `subagent_type` (Claude/Cursor) → `agent` (bare agent name)
79
- * - direct exploration/research (Glob/Grep, explore Bash, web, MCP cache reads)
80
- * → `agent` credited to the matching REQUIRED_AGENTS phase
81
- * - a read tool opening a `.md` reference → `ref`
82
- */
74
+ * Map a live tool-use to the activity to record, or null when nothing is
75
+ * tracked. Works across harnesses — tool names are globally distinct:
76
+ * - MCP doc calls (`context7` / `exa`, any separator) → `doc`
77
+ * - `Task`/`Agent`/`AgentSwarm` + `subagent_type` (Claude/Cursor/Kimi) → `agent` (bare agent name)
78
+ * - direct exploration/research (Glob/Grep, explore Bash, web, MCP cache reads)
79
+ * → `agent` credited to the matching REQUIRED_AGENTS phase
80
+ * - a read tool opening a `.md` reference → `ref`
81
+ */
83
82
  declare function activityFor(event: ToolEvent): Activity[];
84
83
  //#endregion
85
84
  //#region src/runtime/gate-input.d.ts
@@ -112,18 +111,18 @@ interface GateInput {
112
111
  /** Prior agents the freshness gate requires before a code edit. */
113
112
  declare const REQUIRED_AGENTS: ReadonlyArray<string>;
114
113
  /**
115
- * Default freshness window (ms). Matches the plugin's `FUSE_ENFORCE_TTL_SEC`
116
- * default (120s); only a fallback for callers that omit `windowMs` (e.g. tests) —
117
- * the real CLI path always supplies it from `resolveTtlSec()` (`src/config/ttl.ts`).
118
- */
114
+ * Default freshness window (ms). Matches the plugin's `FUSE_ENFORCE_TTL_SEC`
115
+ * default (120s); only a fallback for callers that omit `windowMs` (e.g. tests) —
116
+ * the real CLI path always supplies it from `resolveTtlSec()` (`src/config/ttl.ts`).
117
+ */
119
118
  declare const DEFAULT_WINDOW_MS = 12e4;
120
119
  /** Trivial edits allowed within the window before the full APEX gates apply. */
121
120
  declare const TRIVIAL_BUDGET = 4;
122
121
  /**
123
- * Full gate: {@link runGates} yields the first blocking prompt (or null); the tail
124
- * records the one-shot metric ({@link recordOneShot}, observation-only) then lets
125
- * {@link withDenyLoop} rewrite an identical retried deny (decision unchanged).
126
- */
122
+ * Full gate: {@link runGates} yields the first blocking prompt (or null); the tail
123
+ * records the one-shot metric ({@link recordOneShot}, observation-only) then lets
124
+ * {@link withDenyLoop} rewrite an identical retried deny (decision unchanged).
125
+ */
127
126
  declare function gate(input: GateInput): Promise<Prompt | null>;
128
127
  //#endregion
129
128
  //#region src/runtime/dry.d.ts
@@ -135,18 +134,18 @@ interface DuplicationVerdict {
135
134
  duplicates: string[];
136
135
  }
137
136
  /**
138
- * Grep the codebase for existing declarations of the symbols a write introduces,
139
- * honoring module boundaries (cross-`modules/` matches are ignored). Effectful:
140
- * shells out to `grep`. Fails open (returns no duplicates) on any grep error,
141
- * timeout, or no-match — matching the original Python hook.
142
- */
137
+ * Grep the codebase for existing declarations of the symbols a write introduces,
138
+ * honoring module boundaries (cross-`modules/` matches are ignored). Effectful:
139
+ * shells out to `grep`. Fails open (returns no duplicates) on any grep error,
140
+ * timeout, or no-match — matching the original Python hook.
141
+ */
143
142
  declare function detectDuplication(filePath: string, content: string, cwd: string): DuplicationVerdict;
144
143
  /**
145
- * Prompt when a Write/Edit re-declares an existing symbol: a single match is a
146
- * softer non-blocking "inform" (could be a false positive / same-name coincidence),
147
- * escalating to a hard "block" once 2+ existing declarations are found. Returns
148
- * `null` when no duplicate symbol is found at all.
149
- */
144
+ * Prompt when a Write/Edit re-declares an existing symbol: a single match is a
145
+ * softer non-blocking "inform" (could be a false positive / same-name coincidence),
146
+ * escalating to a hard "block" once 2+ existing declarations are found. Returns
147
+ * `null` when no duplicate symbol is found at all.
148
+ */
150
149
  declare function dryGate(tool: string, filePath: string, content: string | undefined, cwd: string | undefined): Prompt | null;
151
150
  //#endregion
152
151
  //#region src/runtime/precommit.d.ts
@@ -176,57 +175,63 @@ interface NormalizedEvent {
176
175
  /** Harness-resolved permission mode (Claude emits it natively; Codex maps `AskForApproval::Never` to the same "bypassPermissions" string — see adapters/codex/permission-mode.ts). Generic field, Codex-only consumer today. */
177
176
  permissionMode?: string;
178
177
  /**
179
- * Per-file changes when the tool is a multi-file edit primitive (Codex
180
- * `apply_patch`). Present ONLY for `apply_patch`; the file gates OR each
181
- * entry's verdict so one violating hunk blocks the whole envelope. Left
182
- * undefined for every other tool/harness (single-file `filePath`/`content`).
183
- */
178
+ * Per-file changes when the tool is a multi-file edit primitive (Codex
179
+ * `apply_patch`). Present ONLY for `apply_patch`; the file gates OR each
180
+ * entry's verdict so one violating hunk blocks the whole envelope. Left
181
+ * undefined for every other tool/harness (single-file `filePath`/`content`).
182
+ */
184
183
  files?: NormalizedFile[];
185
184
  }
186
185
  /**
187
- * Normalize a harness hook payload into a uniform event. Handles Cline's nested
188
- * `preToolUse`/`postToolUse` shape and the top-level `tool_name`/`tool_input`
189
- * shape used by Claude, Codex, Gemini, and Cursor.
190
- */
186
+ * Normalize a harness hook payload into a uniform event. Handles Cline's nested
187
+ * `preToolUse`/`postToolUse` shape and the top-level `tool_name`/`tool_input`
188
+ * shape used by Claude, Codex, Gemini, and Cursor.
189
+ */
191
190
  declare function normalizeEvent(id: string, payload: Record<string, unknown>): NormalizedEvent;
192
191
  //#endregion
193
192
  //#region src/runtime/respond.d.ts
194
193
  /**
195
- * Map a portable {@link Prompt} to a harness's native hook response, honoring
196
- * all 3 prompt kinds (`block`/`ask`/`inform`) instead of collapsing `ask` and
197
- * `inform` together. Reuses the Claude adapter's `denyResponse`/
198
- * `contextResponse`/`informResponse` builders for claude-code/codex (same hook
199
- * shape) to avoid duplicating the JSON.
200
- * - claude-code/codex: `block` -> deny, `ask` -> interactive
201
- * `permissionDecision:"ask"`, `inform` -> non-blocking `additionalContext`.
202
- * - gemini-cli/cline: their real hook schemas have no interactive "ask"
203
- * state (deny is the only blocking outcome), so `ask` and `inform` already
204
- * both resolve to non-blocking context injection — unchanged.
205
- * - cursor: `ask` keeps its current best-effort `permission:"ask"` shape;
206
- * only `inform` is fixed to a non-blocking `permission:"allow"` note.
207
- * - hermes: delegated to the adapter's `toHermesResponse` — `block` ->
208
- * `{decision:"block",reason}`; `ask`/`inform` degrade to non-blocking
209
- * `{context}` (Hermes has no interactive "ask" state).
210
- *
211
- * User-visible pass notices (`prompt.userMessage`, Python `hook_output.allow_pass`
212
- * / `post_pass` parity), by harness:
213
- * - claude-code/codex: top-level `systemMessage` ("warning message shown to the
214
- * user"); a pure notice (empty `reason`) emits `{systemMessage}` alone. Codex
215
- * consumes the Claude hook schema, so it rides the same field.
216
- * - gemini-cli: common `systemMessage` output field ("displayed immediately to
217
- * the user in the terminal") the notice rides there.
218
- * - cursor: `user_message` is its user-visible channel (see case comment).
219
- * - cline: NO user-visible channel (`cancel`/`contextModification`/
220
- * `errorMessage`-on-cancel only) the notice is dropped silently (a pure
221
- * notice returns "" = plain allow).
222
- * @param id - Harness id.
223
- * @param prompt - The portable prompt to render.
224
- * @param event - The firing hook event name for the claude-code/codex branch
225
- * (defaults to `"PreToolUse"`, the only phase every existing caller but
226
- * `handle-post.ts` renders) — a POST-phase caller MUST pass `"PostToolUse"`
227
- * (or its real raw event name) so `hookEventName` matches the event that
228
- * actually fired instead of a hardcoded, wrong `"PreToolUse"`.
229
- */
194
+ * Map a portable {@link Prompt} to a harness's native hook response, honoring
195
+ * all 3 prompt kinds (`block`/`ask`/`inform`) instead of collapsing `ask` and
196
+ * `inform` together. Reuses the Claude adapter's `denyResponse`/
197
+ * `contextResponse`/`informResponse` builders for claude-code/codex (same hook
198
+ * shape) to avoid duplicating the JSON.
199
+ * - claude-code/codex: `block` -> deny, `ask` -> interactive
200
+ * `permissionDecision:"ask"`, `inform` -> non-blocking `additionalContext`.
201
+ * - gemini-cli/cline: their real hook schemas have no interactive "ask"
202
+ * state (deny is the only blocking outcome), so `ask` and `inform` already
203
+ * both resolve to non-blocking context injection — unchanged.
204
+ * - cursor: `ask` keeps its current best-effort `permission:"ask"` shape;
205
+ * only `inform` is fixed to a non-blocking `permission:"allow"` note.
206
+ * - hermes: delegated to the adapter's `toHermesResponse` — `block` ->
207
+ * `{decision:"block",reason}`; `ask`/`inform` degrade to non-blocking
208
+ * `{context}` (Hermes has no interactive "ask" state).
209
+ * - kimi: delegated to the adapter's `toKimiResponse` — `block`/`ask` ->
210
+ * `hookSpecificOutput.permissionDecision:"deny"` (Kimi Code CLI's hooks
211
+ * contract documents only "deny"; `ask` downgrades with a prefix, mirroring
212
+ * the codex branch above), `inform` -> raw text on stdout (Kimi appends
213
+ * stdout to context on exit 0 no `hookSpecificOutput` envelope documented
214
+ * for non-blocking context injection).
215
+ *
216
+ * User-visible pass notices (`prompt.userMessage`, Python `hook_output.allow_pass`
217
+ * / `post_pass` parity), by harness:
218
+ * - claude-code/codex: top-level `systemMessage` ("warning message shown to the
219
+ * user"); a pure notice (empty `reason`) emits `{systemMessage}` alone. Codex
220
+ * consumes the Claude hook schema, so it rides the same field.
221
+ * - gemini-cli: common `systemMessage` output field ("displayed immediately to
222
+ * the user in the terminal") the notice rides there.
223
+ * - cursor: `user_message` is its user-visible channel (see case comment).
224
+ * - cline: NO user-visible channel (`cancel`/`contextModification`/
225
+ * `errorMessage`-on-cancel only) — the notice is dropped silently (a pure
226
+ * notice returns "" = plain allow).
227
+ * @param id - Harness id.
228
+ * @param prompt - The portable prompt to render.
229
+ * @param event - The firing hook event name for the claude-code/codex branch
230
+ * (defaults to `"PreToolUse"`, the only phase every existing caller but
231
+ * `handle-post.ts` renders) — a POST-phase caller MUST pass `"PostToolUse"`
232
+ * (or its real raw event name) so `hookEventName` matches the event that
233
+ * actually fired instead of a hardcoded, wrong `"PreToolUse"`.
234
+ */
230
235
  declare function respond(id: string, prompt: Prompt, event?: string): string;
231
236
  //#endregion
232
237
  //#region src/runtime/mcp-key.d.ts
@@ -234,15 +239,15 @@ declare function respond(id: string, prompt: Prompt, event?: string): string;
234
239
  declare const MCP_TTL_MS: number;
235
240
  /** WebFetch freshness (ms) from `FUSE_WEBFETCH_TTL_SEC` (default 24h; pages stale faster than docs). */
236
241
  declare const WEBFETCH_TTL_MS: number;
237
- /** MCP doc tools + WebFetch whose calls are cached / verbosity-capped. */
242
+ /** MCP doc tools + WebFetch/FetchURL whose calls are cached / verbosity-capped. */
238
243
  declare function isMcpTool(tool: string): boolean;
239
244
  /** The query/url that keys the cache. */
240
245
  declare function queryOf(input: Record<string, unknown>): string;
241
246
  /**
242
- * The string that keys the cache for `tool`. WebFetch folds `url + "\n" +
243
- * prompt[:500]` (parity with Python) so distinct prompts on the same URL never
244
- * collide; every other tool keys on {@link queryOf}.
245
- */
247
+ * The string that keys the cache for `tool`. WebFetch folds `url + "\n" +
248
+ * prompt[:500]` (parity with Python) so distinct prompts on the same URL never
249
+ * collide; every other tool keys on {@link queryOf}.
250
+ */
246
251
  declare function cacheQueryOf(tool: string, input: Record<string, unknown>): string;
247
252
  //#endregion
248
253
  //#region src/runtime/mcp.d.ts
@@ -252,54 +257,54 @@ interface McpIntercept {
252
257
  docSource?: string;
253
258
  }
254
259
  /**
255
- * Pre-event MCP interception: serve a fresh cache hit (deny + cached content),
256
- * else cap exa verbosity (allow + mutated input), else null to allow normally.
257
- * Harnesses without input-mutation/cache support fall through to null.
258
- */
260
+ * Pre-event MCP interception: serve a fresh cache hit (deny + cached content),
261
+ * else cap exa verbosity (allow + mutated input), else null to allow normally.
262
+ * Harnesses without input-mutation/cache support fall through to null.
263
+ */
259
264
  declare function mcpPreIntercept(id: string, tool: string, input: Record<string, unknown>, dir: string, ttlMs: number, now: number): McpIntercept | null;
260
265
  /**
261
- * Post-event: persist the MCP/WebFetch response (extracted to markdown). MCP docs
262
- * go through {@link mcpCacheWrite} (compact + Jaccard-dedup + `index.json`);
263
- * WebFetch uses {@link webfetchCacheWrite} (compact, exact key, no index).
264
- * @param now - Current epoch ms (timestamp source; defaults to `Date.now()`).
265
- */
266
+ * Post-event: persist the MCP/WebFetch response (extracted to markdown). MCP docs
267
+ * go through {@link mcpCacheWrite} (compact + Jaccard-dedup + `index.json`);
268
+ * WebFetch uses {@link webfetchCacheWrite} (compact, exact key, no index).
269
+ * @param now - Current epoch ms (timestamp source; defaults to `Date.now()`).
270
+ */
266
271
  declare function mcpPostStore(tool: string, input: Record<string, unknown>, response: unknown, dir: string, now?: number): void;
267
272
  //#endregion
268
273
  //#region src/runtime/inject-context.d.ts
269
274
  /**
270
- * Build the {@link oncePerWindow} key for the CLAUDE.md preamble gate. The
271
- * prompt hash keeps two distinct legitimate turns from colliding — even non-dev
272
- * prompts, whose block is prompt-independent (just CLAUDE.md) and would
273
- * otherwise hash-collide within the window — while the content hash still lets a
274
- * same-turn double-fire of an identical block be suppressed. Single source of
275
- * truth so the owner invariant test guards the real production key.
276
- * @param prompt - The raw user prompt.
277
- * @param ctx - The rendered CLAUDE.md (+ optional APEX) block.
278
- * @returns The namespaced dedup key.
279
- */
275
+ * Build the {@link oncePerWindow} key for the CLAUDE.md preamble gate. The
276
+ * prompt hash keeps two distinct legitimate turns from colliding — even non-dev
277
+ * prompts, whose block is prompt-independent (just CLAUDE.md) and would
278
+ * otherwise hash-collide within the window — while the content hash still lets a
279
+ * same-turn double-fire of an identical block be suppressed. Single source of
280
+ * truth so the owner invariant test guards the real production key.
281
+ * @param prompt - The raw user prompt.
282
+ * @param ctx - The rendered CLAUDE.md (+ optional APEX) block.
283
+ * @returns The namespaced dedup key.
284
+ */
280
285
  declare function claudeMdKey(prompt: string, ctx: string): string;
281
286
  /**
282
- * UserPromptSubmit context injection: render the CLAUDE.md (+ optional APEX)
283
- * preamble as a Claude `additionalContext` response, or "" when nothing to emit.
284
- * Guarded by {@link oncePerWindow} via {@link claudeMdKey}: only a
285
- * near-simultaneous double-fire of the SAME turn (identical prompt AND identical
286
- * block, within {@link DEDUP_WINDOW_MS}) is suppressed. The invariant "CLAUDE.md
287
- * is emitted on EVERY message" is thus preserved.
288
- * @param prompt - The raw user prompt.
289
- * @param cwd - Project root (for project-type detection).
290
- * @param id - Harness target id (defaults to "claude-code" — zero-regression default).
291
- * @returns The native hook stdout (possibly empty).
292
- */
287
+ * UserPromptSubmit context injection: render the CLAUDE.md (+ optional APEX)
288
+ * preamble as a Claude `additionalContext` response, or "" when nothing to emit.
289
+ * Guarded by {@link oncePerWindow} via {@link claudeMdKey}: only a
290
+ * near-simultaneous double-fire of the SAME turn (identical prompt AND identical
291
+ * block, within {@link DEDUP_WINDOW_MS}) is suppressed. The invariant "CLAUDE.md
292
+ * is emitted on EVERY message" is thus preserved.
293
+ * @param prompt - The raw user prompt.
294
+ * @param cwd - Project root (for project-type detection).
295
+ * @param id - Harness target id (defaults to "claude-code" — zero-regression default).
296
+ * @returns The native hook stdout (possibly empty).
297
+ */
293
298
  declare function promptSubmitContext(prompt: string, cwd: string, id?: string): string;
294
299
  /**
295
- * PreToolUse Task context injection: render the APEX sub-agent context as a
296
- * Claude `additionalContext` response when `.claude/apex/` exists, else "".
297
- * Harness-produced (not owner CLAUDE.md content), so it is subject to the
298
- * per-fragment {@link capFragment} budget — unlike {@link promptSubmitContext}.
299
- * @param cwd - Fallback project root when `CLAUDE_PROJECT_DIR` is unset.
300
- * @param id - Harness target id (defaults to "claude-code" — zero-regression default).
301
- * @returns The native hook stdout (possibly empty).
302
- */
300
+ * PreToolUse Task context injection: render the APEX sub-agent context as a
301
+ * Claude `additionalContext` response when `.claude/apex/` exists, else "".
302
+ * Harness-produced (not owner CLAUDE.md content), so it is subject to the
303
+ * per-fragment {@link capFragment} budget — unlike {@link promptSubmitContext}.
304
+ * @param cwd - Fallback project root when `CLAUDE_PROJECT_DIR` is unset.
305
+ * @param id - Harness target id (defaults to "claude-code" — zero-regression default).
306
+ * @returns The native hook stdout (possibly empty).
307
+ */
303
308
  declare function taskContext(cwd: string, id?: string): string;
304
309
  //#endregion
305
310
  //#region src/runtime/home-state.d.ts
@@ -336,41 +341,44 @@ declare function gitContext(cwd: string): string[];
336
341
  /** Build the project-type portion (mirrors load-dev-context.py exactly). */
337
342
  declare function projectContext(cwd: string): string[];
338
343
  /**
339
- * Build the SessionStart dev-context block (git + project type), or "" when
340
- * nothing applies. Ports `core-guards/scripts/session-start/load-dev-context.py`.
341
- * @param cwd - Project root to inspect.
342
- * @returns The joined additionalContext text (possibly empty).
343
- */
344
+ * Build the SessionStart dev-context block (git + project type), or "" when
345
+ * nothing applies. Ports `core-guards/scripts/session-start/load-dev-context.py`.
346
+ * @param cwd - Project root to inspect.
347
+ * @returns The joined additionalContext text (possibly empty).
348
+ */
344
349
  declare function devContext(cwd: string): string;
345
350
  //#endregion
346
351
  //#region src/runtime/lifecycle/session-start.d.ts
347
352
  /** Run the legacy SessionStart cleanups (stale states, caches, log trim). */
348
353
  declare function runSessionStartCleanups(home?: string, now?: number): void;
349
354
  /**
350
- * Handle core-guards SessionStart: inject CLAUDE.md + dev context as
351
- * `additionalContext`, then run the cache/state cleanups. Ports the four
352
- * `session-start/*.py` scripts into one harness call.
353
- * @param cwd - Project root for dev-context detection.
354
- * @param home - Home dir (defaults to `~`).
355
- * @param now - Clock for TTL cleanup (defaults to `Date.now()`).
356
- * @returns The native hook stdout (possibly empty).
357
- */
358
- declare function sessionStartCore(cwd: string, home?: string, now?: number): string;
355
+ * Handle core-guards SessionStart: inject CLAUDE.md + dev context as
356
+ * `additionalContext`, then run the cache/state cleanups. Ports the four
357
+ * `session-start/*.py` scripts into one harness call.
358
+ * @param cwd - Project root for dev-context detection.
359
+ * @param home - Home dir (defaults to `~`).
360
+ * @param now - Clock for TTL cleanup (defaults to `Date.now()`).
361
+ * @param id - Harness target id (defaults to "claude-code" — zero-regression default).
362
+ * @returns The native hook stdout (possibly empty).
363
+ */
364
+ declare function sessionStartCore(cwd: string, home?: string, now?: number, id?: string): string;
359
365
  //#endregion
360
366
  //#region src/runtime/lifecycle/inject-rules.d.ts
361
367
  /** Read & concatenate all `*.md` files (sorted) under `rulesDir`. */
362
368
  declare function readRules(rulesDir: string): string;
363
369
  /**
364
- * Build the rules injection for claude-rules (SessionStart, UserPromptSubmit,
365
- * SubagentStart): read `<pluginRoot>/rules/*.md` and emit as `additionalContext`,
366
- * or "" when no rules. Tags the output with the *actual* `hookEventName` — the
367
- * spec requires it to match the firing event (a hardcoded "SessionStart" is
368
- * non-conforming and may be dropped on UserPromptSubmit/SubagentStart).
369
- * @param pluginRoot - `CLAUDE_PLUGIN_ROOT` of the claude-rules plugin.
370
- * @param event - The firing hook event name (e.g. "SessionStart").
371
- * @returns The native hook stdout (possibly empty).
372
- */
373
- declare function injectRules(pluginRoot: string, event: string): string;
370
+ * Build the rules injection for claude-rules (SessionStart, UserPromptSubmit,
371
+ * SubagentStart): read `<pluginRoot>/rules/*.md` and emit via {@link renderInform}
372
+ * (Claude-shaped `additionalContext`, or raw text for kimi). Tags the output
373
+ * with the *actual* `hookEventName` — the spec requires it to match the firing
374
+ * event (a hardcoded "SessionStart" is non-conforming and may be dropped on
375
+ * UserPromptSubmit/SubagentStart).
376
+ * @param pluginRoot - `CLAUDE_PLUGIN_ROOT` of the claude-rules plugin.
377
+ * @param event - The firing hook event name (e.g. "SessionStart").
378
+ * @param id - Harness target id (defaults to "claude-code" — zero-regression default).
379
+ * @returns The native hook stdout (possibly empty).
380
+ */
381
+ declare function injectRules(pluginRoot: string, event: string, id?: string): string;
374
382
  //#endregion
375
383
  //#region src/runtime/lifecycle/solid-detect.d.ts
376
384
  /** A SOLID project profile: type label, per-file line limit, interface dir. */
@@ -382,156 +390,156 @@ interface SolidProfile {
382
390
  /** Detect the SOLID profile for `projectDir`, defaulting to `unknown`. */
383
391
  declare function detectSolidProfile(projectDir: string): SolidProfile;
384
392
  /**
385
- * Handle solid SessionStart: detect the profile, append SOLID_* exports to
386
- * `CLAUDE_ENV_FILE`, and return the `SOLID: …` stdout line (or "" for unknown).
387
- * Ports `solid/scripts/detect-project.py`.
388
- * @param env - Environment (defaults to `process.env`).
389
- * @returns The plain-text stdout line (possibly empty).
390
- */
393
+ * Handle solid SessionStart: detect the profile, append SOLID_* exports to
394
+ * `CLAUDE_ENV_FILE`, and return the `SOLID: …` stdout line (or "" for unknown).
395
+ * Ports `solid/scripts/detect-project.py`.
396
+ * @param env - Environment (defaults to `process.env`).
397
+ * @returns The plain-text stdout line (possibly empty).
398
+ */
391
399
  declare function solidDetectStart(env?: Record<string, string | undefined>): string;
392
400
  //#endregion
393
401
  //#region src/runtime/lifecycle/check-file-size.d.ts
394
402
  /** Count lines of code excluding comments/blanks for `filePath`'s extension (raw length when unmapped). */
395
403
  declare function countLoc(filePath: string, content: string): number;
396
404
  /**
397
- * Warn when a written/edited file exceeds `SOLID_FILE_LIMIT` (default 100).
398
- * Inert when `SOLID_PROJECT_TYPE` is absent/"unknown" (parity: the Python hook
399
- * no-ops outside a detected project).
400
- * @param tool - The tool name (only "Write"/"Edit" are checked).
401
- * @param filePath - The written file's absolute path.
402
- * @param env - Environment (defaults to `process.env`).
403
- * @returns The PostToolUse `additionalContext` response, or `""` when clean/inert.
404
- */
405
+ * Warn when a written/edited file exceeds `SOLID_FILE_LIMIT` (default 100).
406
+ * Inert when `SOLID_PROJECT_TYPE` is absent/"unknown" (parity: the Python hook
407
+ * no-ops outside a detected project).
408
+ * @param tool - The tool name (only "Write"/"Edit" are checked).
409
+ * @param filePath - The written file's absolute path.
410
+ * @param env - Environment (defaults to `process.env`).
411
+ * @returns The PostToolUse `additionalContext` response, or `""` when clean/inert.
412
+ */
405
413
  declare function checkFileSize(tool: string, filePath: string, env?: Record<string, string | undefined>): string;
406
414
  //#endregion
407
415
  //#region src/runtime/lifecycle/validate-solid.d.ts
408
416
  /**
409
- * Deny a Write/Edit that violates the Go/Python interface-location SOLID rule.
410
- * @param tool - The tool name (only "Write"/"Edit" are checked).
411
- * @param filePath - The written file's absolute path.
412
- * @param content - The written/edited content (`new_string` snippet on Edit).
413
- * @param env - Environment (defaults to `process.env`).
414
- * @returns The PreToolUse deny response, or `""` when clean/inert.
415
- */
417
+ * Deny (or advise on) a Write/Edit that violates the Go/Python interface-location SOLID rule.
418
+ * @param tool - The tool name (only "Write"/"Edit" are checked).
419
+ * @param filePath - The written file's absolute path.
420
+ * @param content - The written/edited content (`new_string` snippet on Edit).
421
+ * @param env - Environment (defaults to `process.env`).
422
+ * @returns The PreToolUse response, or `""` when clean/inert.
423
+ */
416
424
  declare function validateSolidGate(tool: string, filePath: string, content: string, env?: Record<string, string | undefined>): string;
417
425
  //#endregion
418
426
  //#region src/runtime/lifecycle/validate-tailwind.d.ts
419
427
  /**
420
- * Validate Tailwind best practices on a just-written file.
421
- * @param tool - The tool name (only "Write"/"Edit" are checked).
422
- * @param filePath - The written file's absolute path.
423
- * @returns The PostToolUse `additionalContext` response, or `""` when clean/inert.
424
- */
428
+ * Validate Tailwind best practices on a just-written file.
429
+ * @param tool - The tool name (only "Write"/"Edit" are checked).
430
+ * @param filePath - The written file's absolute path.
431
+ * @returns The PostToolUse `additionalContext` response, or `""` when clean/inert.
432
+ */
425
433
  declare function validateTailwind(tool: string, filePath: string): string;
426
434
  //#endregion
427
435
  //#region src/runtime/lifecycle/subagent-cache.d.ts
428
436
  /**
429
- * Handle SubagentStart: surface fresh MCP cache entries for the session as
430
- * `additionalContext`. Ports `subagent-start/inject-context-cache.py`.
431
- * @param sessionIdRaw - Raw session id from the payload.
432
- * @param home - Home dir (defaults to `~`).
433
- * @param env - Environment (defaults to `process.env`).
434
- * @param now - Clock (defaults to `Date.now()`).
435
- * @returns The native hook stdout (possibly empty).
436
- */
437
+ * Handle SubagentStart: surface fresh MCP cache entries for the session as
438
+ * `additionalContext`. Ports `subagent-start/inject-context-cache.py`.
439
+ * @param sessionIdRaw - Raw session id from the payload.
440
+ * @param home - Home dir (defaults to `~`).
441
+ * @param env - Environment (defaults to `process.env`).
442
+ * @param now - Clock (defaults to `Date.now()`).
443
+ * @returns The native hook stdout (possibly empty).
444
+ */
437
445
  declare function subagentCacheContext(sessionIdRaw: unknown, home?: string, env?: Record<string, string | undefined>, now?: number): string;
438
446
  //#endregion
439
447
  //#region src/runtime/lifecycle/agent-memory.d.ts
440
448
  /**
441
- * Handle SubagentStop: append the completion to agent-history.jsonl and, for a
442
- * non-skipped agent that touched code, emit the sniper reminder + reset the
443
- * counter. Ports `subagent-stop/track-agent-memory.py`.
444
- * @param data - The raw hook payload.
445
- * @param home - Home dir (defaults to `~`).
446
- * @param now - Clock (defaults to `Date.now()`).
447
- * @returns The native hook stdout (always a JSON message).
448
- */
449
+ * Handle SubagentStop: append the completion to agent-history.jsonl and, for a
450
+ * non-skipped agent that touched code, emit the sniper reminder + reset the
451
+ * counter. Ports `subagent-stop/track-agent-memory.py`.
452
+ * @param data - The raw hook payload.
453
+ * @param home - Home dir (defaults to `~`).
454
+ * @param now - Clock (defaults to `Date.now()`).
455
+ * @returns The native hook stdout (always a JSON message).
456
+ */
449
457
  declare function trackAgentMemory(data: Record<string, unknown>, home?: string, now?: number): string;
450
458
  //#endregion
451
459
  //#region src/runtime/lifecycle/teammate-idle.d.ts
452
460
  /**
453
- * Handle TeammateIdle: when the teammate's session-changes file shows code was
454
- * modified, suggest sniper validation as plain text — TeammateIdle has no
455
- * `additionalContext` channel (rejects `hookSpecificOutput`), so the caller
456
- * ({@link module:teammate-idle-check.teammateIdleContext}) rides this text on
457
- * the `systemMessage` channel instead. Ports `teammate-idle/validate-teammate-output.py`.
458
- * @param data - The raw hook payload.
459
- * @param home - Home dir (defaults to `~`).
460
- * @returns The plain notice text, or "" when no code file was modified.
461
- */
461
+ * Handle TeammateIdle: when the teammate's session-changes file shows code was
462
+ * modified, suggest sniper validation as plain text — TeammateIdle has no
463
+ * `additionalContext` channel (rejects `hookSpecificOutput`), so the caller
464
+ * ({@link module:teammate-idle-check.teammateIdleContext}) rides this text on
465
+ * the `systemMessage` channel instead. Ports `teammate-idle/validate-teammate-output.py`.
466
+ * @param data - The raw hook payload.
467
+ * @param home - Home dir (defaults to `~`).
468
+ * @returns The plain notice text, or "" when no code file was modified.
469
+ */
462
470
  declare function validateTeammateOutput(data: Record<string, unknown>, home?: string): string;
463
471
  //#endregion
464
472
  //#region src/runtime/lifecycle/tool-failure.d.ts
465
473
  /**
466
- * Handle PostToolUseFailure: append a `TOOL_FAILURE` line to
467
- * `~/.claude/logs/tool-failures.log`, skipping user interrupts. Ports
468
- * `post-tool-use/log-tool-failure.py`. No stdout (logging only).
469
- * @param data - The raw hook payload.
470
- * @param home - Home dir (defaults to `~`).
471
- * @param now - Clock (defaults to `Date.now()`).
472
- */
474
+ * Handle PostToolUseFailure: append a `TOOL_FAILURE` line to
475
+ * `~/.claude/logs/tool-failures.log`, skipping user interrupts. Ports
476
+ * `post-tool-use/log-tool-failure.py`. No stdout (logging only).
477
+ * @param data - The raw hook payload.
478
+ * @param home - Home dir (defaults to `~`).
479
+ * @param now - Clock (defaults to `Date.now()`).
480
+ */
473
481
  declare function logToolFailure(data: Record<string, unknown>, home?: string, now?: number): void;
474
482
  //#endregion
475
483
  //#region src/runtime/lifecycle/pre-compact.d.ts
476
484
  /**
477
- * Handle PreCompact: back up the target apex `task.json` (`.claude/apex/`,
478
- * `.codex/apex/`, ...) to `backups/`, keep only the 5 newest, and emit a
479
- * confirmation. Ports `pre-compact/save-apex-state.py`.
480
- * @param cwd - Project root.
481
- * @param now - Clock (defaults to `Date.now()`).
482
- * @param id - Harness target id (defaults to "claude-code" — zero-regression default).
483
- * @returns The native hook stdout (possibly empty when no task.json).
484
- */
485
+ * Handle PreCompact: back up the target apex `task.json` (`.claude/apex/`,
486
+ * `.codex/apex/`, ...) to `backups/`, keep only the 5 newest, and emit a
487
+ * confirmation. Ports `pre-compact/save-apex-state.py`.
488
+ * @param cwd - Project root.
489
+ * @param now - Clock (defaults to `Date.now()`).
490
+ * @param id - Harness target id (defaults to "claude-code" — zero-regression default).
491
+ * @returns The native hook stdout (possibly empty when no task.json).
492
+ */
485
493
  declare function saveApexState(cwd: string, now?: number, id?: string): string;
486
494
  //#endregion
487
495
  //#region src/runtime/lifecycle/session-end.d.ts
488
496
  /**
489
- * Handle SessionEnd: remove stale `*.tmp` (>1h) under `session-tmp/` and stale
490
- * legacy `claude_solid_reads_*` / `claude_session_changes_*` files (>2h) under
491
- * `cache`. Ports `session-end/cleanup-session.py`. No stdout.
492
- * @param home - Home dir (defaults to `~`).
493
- * @param now - Clock (defaults to `Date.now()`).
494
- */
497
+ * Handle SessionEnd: remove stale `*.tmp` (>1h) under `session-tmp/` and stale
498
+ * legacy `claude_solid_reads_*` / `claude_session_changes_*` files (>2h) under
499
+ * `cache`. Ports `session-end/cleanup-session.py`. No stdout.
500
+ * @param home - Home dir (defaults to `~`).
501
+ * @param now - Clock (defaults to `Date.now()`).
502
+ */
495
503
  declare function cleanupSession(home?: string, now?: number): void;
496
504
  //#endregion
497
505
  //#region src/runtime/lifecycle/instructions-loaded.d.ts
498
506
  /**
499
- * Handle InstructionsLoaded: append `load_reason | memory_type | file_path` to
500
- * the per-session debug log. Ports `instructions-loaded/validate-rules-loaded.py`.
501
- * No stdout (logging only; InstructionsLoaded has no decision control).
502
- * @param data - The raw hook payload.
503
- * @param home - Home dir (defaults to `~`).
504
- */
507
+ * Handle InstructionsLoaded: append `load_reason | memory_type | file_path` to
508
+ * the per-session debug log. Ports `instructions-loaded/validate-rules-loaded.py`.
509
+ * No stdout (logging only; InstructionsLoaded has no decision control).
510
+ * @param data - The raw hook payload.
511
+ * @param home - Home dir (defaults to `~`).
512
+ */
505
513
  declare function validateRulesLoaded(data: Record<string, unknown>, home?: string): void;
506
514
  //#endregion
507
515
  //#region src/runtime/lifecycle/track-changes.d.ts
508
516
  /**
509
- * Handle PostToolUse Write/Edit: track the cumulative set of modified code
510
- * files per session and emit the mandatory "SNIPER VALIDATION REQUIRED"
511
- * additionalContext. Ports `post-tool-use/track-session-changes.py`.
512
- * @param sessionIdRaw - Raw session id from the payload.
513
- * @param filePath - The edited file path.
514
- * @param home - Home dir (defaults to `~`).
515
- * @param now - Clock (defaults to `Date.now()`).
516
- * @returns The native hook stdout (possibly empty when not a code file).
517
- */
517
+ * Handle PostToolUse Write/Edit: track the cumulative set of modified code
518
+ * files per session and emit the mandatory "SNIPER VALIDATION REQUIRED"
519
+ * additionalContext. Ports `post-tool-use/track-session-changes.py`.
520
+ * @param sessionIdRaw - Raw session id from the payload.
521
+ * @param filePath - The edited file path.
522
+ * @param home - Home dir (defaults to `~`).
523
+ * @param now - Clock (defaults to `Date.now()`).
524
+ * @returns The native hook stdout (possibly empty when not a code file).
525
+ */
518
526
  declare function trackSessionChanges(sessionIdRaw: unknown, filePath: string, home?: string, now?: number): string;
519
527
  //#endregion
520
528
  //#region src/runtime/lifecycle/post-edit-ts.d.ts
521
529
  /**
522
- * Handle PostToolUse for TS/TSX: report eslint/prettier issues (never fixes) as
523
- * additionalContext. Ports `post-tool-use/post-edit-typescript.py`.
524
- * @param filePath - The edited file path.
525
- * @returns The native hook stdout (possibly empty).
526
- */
530
+ * Handle PostToolUse for TS/TSX: report eslint/prettier issues (never fixes) as
531
+ * additionalContext. Ports `post-tool-use/post-edit-typescript.py`.
532
+ * @param filePath - The edited file path.
533
+ * @returns The native hook stdout (possibly empty).
534
+ */
527
535
  declare function postEditTypescript(filePath: string): string;
528
536
  //#endregion
529
537
  //#region src/runtime/lifecycle/aipilot/dispatch-aipilot.d.ts
530
538
  /**
531
- * Dispatch an ai-pilot-scope lifecycle event. Returns the native stdout, or
532
- * `null` when unhandled (caller falls through to the default pipeline).
533
- * @param home - Home dir for cache resolution (defaults to `~`; injectable for test isolation); `id` selects the harness target (defaults to "claude-code").
534
- */
539
+ * Dispatch an ai-pilot-scope lifecycle event. Returns the native stdout, or
540
+ * `null` when unhandled (caller falls through to the default pipeline).
541
+ * @param home - Home dir for cache resolution (defaults to `~`; injectable for test isolation); `id` selects the harness target (defaults to "claude-code").
542
+ */
535
543
  declare function dispatchAipilot(event: string, payload: Record<string, unknown>, cwd: string, now: number, home?: string, id?: string): Promise<string | null>;
536
544
  /** PostToolUse (Write/Edit SOLID check, else TaskCreate/TaskUpdate sync) for the ai-pilot scope; `id` selects the harness target (defaults to "claude-code"). */
537
545
  declare function aipilotPostToolUse(payload: Record<string, unknown>, cwd: string, id?: string): Promise<string>;
@@ -550,118 +558,118 @@ interface LifecycleInput {
550
558
  id?: string;
551
559
  }
552
560
  /**
553
- * Route a lifecycle/session/context hook event to its ported handler. Returns
554
- * the native stdout when handled, or `null` when the event is not a lifecycle
555
- * event (so the caller falls through to the PreToolUse/PostToolUse pipeline).
556
- * @param input - The dispatch input.
557
- * @returns The native hook stdout, or `null` when unhandled.
558
- */
561
+ * Route a lifecycle/session/context hook event to its ported handler. Returns
562
+ * the native stdout when handled, or `null` when the event is not a lifecycle
563
+ * event (so the caller falls through to the PreToolUse/PostToolUse pipeline).
564
+ * @param input - The dispatch input.
565
+ * @returns The native hook stdout, or `null` when unhandled.
566
+ */
559
567
  declare function dispatchLifecycle(input: LifecycleInput): string | null;
560
568
  //#endregion
561
569
  //#region src/runtime/lifecycle/post-tracking.d.ts
562
570
  /**
563
- * Dispatch the appropriate PostToolUse tracker for the invoking scope. Carto
564
- * persists manual enrichments; security records skill reads + MCP research;
565
- * changelog records watch research; lessons arms the per-project throttle.
566
- * Side-effect only.
567
- * @param scope - The invoking plugin scope.
568
- * @param event - The normalized event.
569
- * @param input - The raw tool input.
570
- * @param now - Clock.
571
- * @param payload - The raw hook payload (for the lessons mark).
572
- * @param cwd - The project root (for the lessons mark).
573
- */
571
+ * Dispatch the appropriate PostToolUse tracker for the invoking scope. Carto
572
+ * persists manual enrichments; security records skill reads + MCP research;
573
+ * changelog records watch research; lessons arms the per-project throttle.
574
+ * Side-effect only.
575
+ * @param scope - The invoking plugin scope.
576
+ * @param event - The normalized event.
577
+ * @param input - The raw tool input.
578
+ * @param now - Clock.
579
+ * @param payload - The raw hook payload (for the lessons mark).
580
+ * @param cwd - The project root (for the lessons mark).
581
+ */
574
582
  declare function postTrackingSideEffects(scope: PluginScope, event: NormalizedEvent, input: Record<string, unknown>, now: number, payload?: Record<string, unknown>, cwd?: string): void;
575
583
  //#endregion
576
584
  //#region src/runtime/lifecycle/changelog-research.d.ts
577
585
  /**
578
- * Append an exa/WebFetch/WebSearch query to today's changelog research log.
579
- * No-op for other tools. No stdout (errors swallowed).
580
- * @param tool - The tool name.
581
- * @param input - The tool input (query/url/prompt).
582
- * @param now - Clock.
583
- * @param home - Home dir.
584
- */
586
+ * Append an exa/WebFetch/WebSearch query to today's changelog research log.
587
+ * No-op for other tools. No stdout (errors swallowed).
588
+ * @param tool - The tool name.
589
+ * @param input - The tool input (query/url/prompt).
590
+ * @param now - Clock.
591
+ * @param home - Home dir.
592
+ */
585
593
  declare function trackWatchResearch(tool: string, input: Record<string, unknown>, now?: number, home?: string): void;
586
594
  //#endregion
587
595
  //#region src/runtime/lifecycle/cartographer/session-start.d.ts
588
596
  /**
589
- * Regenerate the project map + plugin ecosystem map for `cwd` on SessionStart.
590
- * Emits the ecosystem navigation context as additionalContext (or "").
591
- * @param cwd - The working directory.
592
- * @param now - Clock for the ecosystem map banner timestamp.
593
- * @returns The SessionStart additionalContext response, or "".
594
- */
597
+ * Regenerate the project map + plugin ecosystem map for `cwd` on SessionStart.
598
+ * Emits the ecosystem navigation context as additionalContext (or "").
599
+ * @param cwd - The working directory.
600
+ * @param now - Clock for the ecosystem map banner timestamp.
601
+ * @returns The SessionStart additionalContext response, or "".
602
+ */
595
603
  declare function cartoSessionStart(cwd: string, now?: number): string;
596
604
  //#endregion
597
605
  //#region src/runtime/lifecycle/cartographer/project-map.d.ts
598
606
  /**
599
- * True when `dir` looks like a project root (has an indicator file) and is not
600
- * the home directory or filesystem root.
601
- * @param dir - Directory to test.
602
- * @returns Whether `dir` is a project root.
603
- */
607
+ * True when `dir` looks like a project root (has an indicator file) and is not
608
+ * the home directory or filesystem root.
609
+ * @param dir - Directory to test.
610
+ * @returns Whether `dir` is a project root.
611
+ */
604
612
  declare function isProject(dir: string): boolean;
605
613
  /**
606
- * Generate the `.cartographer/project` index tree for `cwd` when it is a real
607
- * project directory. Always returns "" (no additionalContext emitted).
608
- * @param cwd - The working directory.
609
- * @param outputDir - Override for the output tree root.
610
- * @returns "" (side-effect only).
611
- */
614
+ * Generate the `.cartographer/project` index tree for `cwd` when it is a real
615
+ * project directory. Always returns "" (no additionalContext emitted).
616
+ * @param cwd - The working directory.
617
+ * @param outputDir - Override for the output tree root.
618
+ * @returns "" (side-effect only).
619
+ */
612
620
  declare function generateProjectMap(cwd: string, outputDir?: string): string;
613
621
  //#endregion
614
622
  //#region src/runtime/lifecycle/cartographer/track-enrichment.d.ts
615
623
  /**
616
- * Record manually-edited descriptions from a cartographer `index.md` into the
617
- * adjacent `.enriched.json` sidecar. No-op for unrelated paths. No stdout.
618
- * @param filePath - The edited file path.
619
- */
624
+ * Record manually-edited descriptions from a cartographer `index.md` into the
625
+ * adjacent `.enriched.json` sidecar. No-op for unrelated paths. No stdout.
626
+ * @param filePath - The edited file path.
627
+ */
620
628
  declare function trackEnrichment(filePath: string): void;
621
629
  //#endregion
622
630
  //#region src/runtime/lifecycle/cartographer/write-tree.d.ts
623
631
  /**
624
- * Write `index.md` files mirroring `source` under `output`, recursing into
625
- * subdirectories. Directory lines carry a file-count hint; file lines carry a
626
- * derived description and link to the real absolute source path.
627
- * @param source - Absolute source directory.
628
- * @param output - Absolute output directory for the index tree.
629
- * @param back - Relative `← back` link target ("" at the root).
630
- * @param exclude - Directory/name set to skip.
631
- */
632
+ * Write `index.md` files mirroring `source` under `output`, recursing into
633
+ * subdirectories. Directory lines carry a file-count hint; file lines carry a
634
+ * derived description and link to the real absolute source path.
635
+ * @param source - Absolute source directory.
636
+ * @param output - Absolute output directory for the index tree.
637
+ * @param back - Relative `← back` link target ("" at the root).
638
+ * @param exclude - Directory/name set to skip.
639
+ */
632
640
  declare function writeTree(source: string, output: string, back?: string, exclude?: ReadonlySet<string>): void;
633
641
  //#endregion
634
642
  //#region src/runtime/lifecycle/cartographer/merge.d.ts
635
643
  /**
636
- * Load the `.enriched.json` sidecar's `entries` map for an output index.
637
- * @param outputIndexPath - Path to the index.md being written.
638
- * @returns The path→desc enrichment map (possibly empty).
639
- */
644
+ * Load the `.enriched.json` sidecar's `entries` map for an output index.
645
+ * @param outputIndexPath - Path to the index.md being written.
646
+ * @returns The path→desc enrichment map (possibly empty).
647
+ */
640
648
  declare function loadEnriched(outputIndexPath: string): Record<string, string>;
641
649
  /**
642
- * Merge freshly generated lines with prior descriptions: enriched sidecar wins,
643
- * else a longer pre-existing description is preserved.
644
- * @param newLines - The freshly generated index lines.
645
- * @param outputIndexPath - Path to the existing index.md (if any).
646
- * @returns The merged lines.
647
- */
650
+ * Merge freshly generated lines with prior descriptions: enriched sidecar wins,
651
+ * else a longer pre-existing description is preserved.
652
+ * @param newLines - The freshly generated index lines.
653
+ * @param outputIndexPath - Path to the existing index.md (if any).
654
+ * @returns The merged lines.
655
+ */
648
656
  declare function mergeLines(newLines: string[], outputIndexPath: string): string[];
649
657
  //#endregion
650
658
  //#region src/runtime/lifecycle/cartographer/fs-util.d.ts
651
659
  /**
652
- * Read a file and derive its one-line description (frontmatter / heading /
653
- * comment). "" on any error or when nothing is found.
654
- * @param filePath - Absolute path to the file.
655
- * @returns The description, or "".
656
- */
660
+ * Read a file and derive its one-line description (frontmatter / heading /
661
+ * comment). "" on any error or when nothing is found.
662
+ * @param filePath - Absolute path to the file.
663
+ * @returns The description, or "".
664
+ */
657
665
  declare function getFileDesc(filePath: string): string;
658
666
  /**
659
- * Recursively count files whose relative path parts are all visible (no leading
660
- * "." or "_") and none excluded. Best-effort (partial count on errors).
661
- * @param dir - Directory to count under.
662
- * @param exclude - Directory/name set to skip.
663
- * @returns The file count.
664
- */
667
+ * Recursively count files whose relative path parts are all visible (no leading
668
+ * "." or "_") and none excluded. Best-effort (partial count on errors).
669
+ * @param dir - Directory to count under.
670
+ * @param exclude - Directory/name set to skip.
671
+ * @returns The file count.
672
+ */
665
673
  declare function countFiles(dir: string, exclude: ReadonlySet<string>): number;
666
674
  /** Absolute children of `source`, split into dirs/files, sorted by full path. */
667
675
  declare function listChildren(source: string, exclude: ReadonlySet<string>): {
@@ -671,50 +679,50 @@ declare function listChildren(source: string, exclude: ReadonlySet<string>): {
671
679
  //#endregion
672
680
  //#region src/runtime/lifecycle/security/check-skill.d.ts
673
681
  /**
674
- * Build a non-blocking PreToolUse advisory when editing a code file before the
675
- * security skill has been read, "" otherwise. Renders through the shared
676
- * {@link contextResponse} builder (`additionalContext` only) — NEVER a naked
677
- * `permissionDecision: "allow"`, which the Codex adapter's own hook shape
678
- * (`src/adapters/claude/index.ts`) never emits and which Codex rejects.
679
- * @param tool - The tool name (`Write`/`Edit`).
680
- * @param filePath - The target file path.
681
- * @param now - Clock.
682
- * @param home - Home dir.
683
- * @returns The advisory response JSON, or "".
684
- */
682
+ * Build a non-blocking PreToolUse advisory when editing a code file before the
683
+ * security skill has been read, "" otherwise. Renders through the shared
684
+ * {@link contextResponse} builder (`additionalContext` only) — NEVER a naked
685
+ * `permissionDecision: "allow"`, which the Codex adapter's own hook shape
686
+ * (`src/adapters/claude/index.ts`) never emits and which Codex rejects.
687
+ * @param tool - The tool name (`Write`/`Edit`).
688
+ * @param filePath - The target file path.
689
+ * @param now - Clock.
690
+ * @param home - Home dir.
691
+ * @returns The advisory response JSON, or "".
692
+ */
685
693
  declare function securityAdvisory(tool: string, filePath: string, now?: number, home?: string): string;
686
694
  /**
687
- * Multi-file counterpart for a Codex `apply_patch` envelope: evaluate EACH
688
- * add/update file (delete ignored outright; non-code filtered by the same
689
- * `CODE_RE` inside {@link securityAdvisory}) and return the advisory
690
- * triggered by the FIRST qualifying file, or "" once the skill has been read
691
- * or no file qualifies.
692
- * @param files - The patch's per-file changes ({@link NormalizedFile}).
693
- * @param now - Clock.
694
- * @param home - Home dir.
695
- */
695
+ * Multi-file counterpart for a Codex `apply_patch` envelope: evaluate EACH
696
+ * add/update file (delete ignored outright; non-code filtered by the same
697
+ * `CODE_RE` inside {@link securityAdvisory}) and return the advisory
698
+ * triggered by the FIRST qualifying file, or "" once the skill has been read
699
+ * or no file qualifies.
700
+ * @param files - The patch's per-file changes ({@link NormalizedFile}).
701
+ * @param now - Clock.
702
+ * @param home - Home dir.
703
+ */
696
704
  declare function securityAdvisoryForPatch(files: readonly NormalizedFile[], now?: number, home?: string): string;
697
705
  //#endregion
698
706
  //#region src/runtime/lifecycle/security/track-skill-read.d.ts
699
707
  /**
700
- * Mark the security skill as read when a Read hits a security skill reference.
701
- * No-op for other tools/paths. No stdout.
702
- * @param tool - The tool name.
703
- * @param filePath - The read file path.
704
- * @param now - Clock.
705
- * @param home - Home dir.
706
- */
708
+ * Mark the security skill as read when a Read hits a security skill reference.
709
+ * No-op for other tools/paths. No stdout.
710
+ * @param tool - The tool name.
711
+ * @param filePath - The read file path.
712
+ * @param now - Clock.
713
+ * @param home - Home dir.
714
+ */
707
715
  declare function trackSkillRead(tool: string, filePath: string, now?: number, home?: string): void;
708
716
  //#endregion
709
717
  //#region src/runtime/lifecycle/security/track-mcp.d.ts
710
718
  /**
711
- * Append a context7/exa research call to today's security state. No-op for other
712
- * tools. No stdout.
713
- * @param tool - The tool name.
714
- * @param input - The tool input (query/libraryId/libraryName).
715
- * @param now - Clock.
716
- * @param home - Home dir.
717
- */
719
+ * Append a context7/exa research call to today's security state. No-op for other
720
+ * tools. No stdout.
721
+ * @param tool - The tool name.
722
+ * @param input - The tool input (query/libraryId/libraryName).
723
+ * @param now - Clock.
724
+ * @param home - Home dir.
725
+ */
718
726
  declare function trackMcpResearch(tool: string, input: Record<string, unknown>, now?: number, home?: string): void;
719
727
  //#endregion
720
728
  //#region src/runtime/lifecycle/security/skill-state.d.ts
@@ -733,16 +741,17 @@ declare function saveSecurityState(state: Record<string, unknown>, now?: number,
733
741
  //#endregion
734
742
  //#region src/runtime/lifecycle/lessons/dispatch.d.ts
735
743
  /**
736
- * Route a fuse-lessons event to its handler. Returns the native stdout for
737
- * context-injecting events (SessionStart/SubagentStart/UserPromptSubmit inject
738
- * MEMORY/LESSON.md, Stop reminds) or "" for the side-effect-only PostToolUse mark.
739
- * @param event - The raw hook event name.
740
- * @param payload - The raw hook payload.
741
- * @param cwd - Project root for memory injection.
742
- * @param now - Clock.
743
- * @returns The native stdout (possibly empty).
744
- */
745
- declare function dispatchLessons(event: string, payload: Record<string, unknown>, cwd: string, now: number): string;
744
+ * Route a fuse-lessons event to its handler. Returns the native stdout for
745
+ * context-injecting events (SessionStart/SubagentStart/UserPromptSubmit inject
746
+ * MEMORY/LESSON.md, Stop reminds) or "" for the side-effect-only PostToolUse mark.
747
+ * @param event - The raw hook event name.
748
+ * @param payload - The raw hook payload.
749
+ * @param cwd - Project root for memory injection.
750
+ * @param now - Clock.
751
+ * @param id - Harness target id (defaults to "claude-code" — zero-regression default).
752
+ * @returns The native stdout (possibly empty).
753
+ */
754
+ declare function dispatchLessons(event: string, payload: Record<string, unknown>, cwd: string, now: number, id?: string): string;
746
755
  //#endregion
747
756
  //#region src/runtime/lifecycle/lessons/state.d.ts
748
757
  /** Absolute `<root>/MEMORY/LESSON.md` — the curated, committable lessons file. */
@@ -754,90 +763,90 @@ declare function lessonsStateFileFor(root: string): string;
754
763
  //#endregion
755
764
  //#region src/runtime/lifecycle/memory/dispatch.d.ts
756
765
  /**
757
- * Dispatch a memory-scope lifecycle event to its ported handler.
758
- * @param event - Raw hook event name.
759
- * @param payload - Raw hook payload.
760
- * @param cwd - Project root.
761
- * @param now - Clock.
762
- * @returns The native stdout, or `null` when unhandled.
763
- */
766
+ * Dispatch a memory-scope lifecycle event to its ported handler.
767
+ * @param event - Raw hook event name.
768
+ * @param payload - Raw hook payload.
769
+ * @param cwd - Project root.
770
+ * @param now - Clock.
771
+ * @returns The native stdout, or `null` when unhandled.
772
+ */
764
773
  declare function dispatchMemory(event: string, payload: Record<string, unknown>, cwd: string, now: number): Promise<string | null>;
765
774
  //#endregion
766
775
  //#region src/runtime/lifecycle/seo/post-tool-use.d.ts
767
776
  /**
768
- * Validate the edited file's SEO completeness. Returns a block message (for a
769
- * top-level `decision: block` response) when HTML-like, opted-in, and missing
770
- * elements; otherwise `null` (allow).
771
- * @param payload - The raw PostToolUse payload.
772
- * @returns The block reason string, or `null` to allow.
773
- */
777
+ * Validate the edited file's SEO completeness. Returns a block message (for a
778
+ * top-level `decision: block` response) when HTML-like, opted-in, and missing
779
+ * elements; otherwise `null` (allow).
780
+ * @param payload - The raw PostToolUse payload.
781
+ * @returns The block reason string, or `null` to allow.
782
+ */
774
783
  declare function seoPostToolUse(payload: Record<string, unknown>): string | null;
775
784
  /**
776
- * SEO PostToolUse as a ready native response: a top-level `decision: block`
777
- * string when the edited file is missing SEO elements, else `null` (allow).
778
- * PostToolUse ignores `permissionDecision` (PreToolUse-only), so this must use
779
- * the `decision`/`reason` keys to actually feed the failure back to Claude.
780
- * @param payload - The raw PostToolUse payload.
781
- * @returns The block response string, or `null` to allow.
782
- */
785
+ * SEO PostToolUse as a ready native response: a top-level `decision: block`
786
+ * string when the edited file is missing SEO elements, else `null` (allow).
787
+ * PostToolUse ignores `permissionDecision` (PreToolUse-only), so this must use
788
+ * the `decision`/`reason` keys to actually feed the failure back to Claude.
789
+ * @param payload - The raw PostToolUse payload.
790
+ * @returns The block response string, or `null` to allow.
791
+ */
783
792
  declare function seoPostToolUseResponse(payload: Record<string, unknown>): string | null;
784
793
  //#endregion
785
794
  //#region src/runtime/lifecycle/cartographer/ecosystem-map.d.ts
786
795
  /**
787
- * Generate the plugin ecosystem map under `<pluginsDir>/.cartographer`.
788
- * @param now - Clock for the banner timestamp.
789
- * @param pluginsDirOverride - Override for the marketplace plugins directory.
790
- * @returns The map navigation context, or "".
791
- */
796
+ * Generate the plugin ecosystem map under `<pluginsDir>/.cartographer`.
797
+ * @param now - Clock for the banner timestamp.
798
+ * @param pluginsDirOverride - Override for the marketplace plugins directory.
799
+ * @returns The map navigation context, or "".
800
+ */
792
801
  declare function generateEcosystemMap(now: number, pluginsDirOverride?: string): string;
793
802
  //#endregion
794
803
  //#region src/policy/cartographer/build-tree.d.ts
795
804
  /**
796
- * Indented Unicode tree from scanned plugin items — pure text in, markdown out
797
- * (no fs). Ports `build_tree.py`.
798
- */
805
+ * Indented Unicode tree from scanned plugin items — pure text in, markdown out
806
+ * (no fs). Ports `build_tree.py`.
807
+ */
799
808
  /** A scanned `[type, name, desc]` plugin item (agent/skill/command/hooks). */
800
809
  type ScanRow = readonly [type: string, name: string, desc: string];
801
810
  //#endregion
802
811
  //#region src/runtime/lifecycle/cartographer/write-plugin-map.d.ts
803
812
  /**
804
- * Write `<outputDir>/<pluginName>/index.md` (indented linked tree) and recurse
805
- * agents/skills/commands into their own index trees rooted there.
806
- * @param outputDir - The map root directory.
807
- * @param pluginName - Display name of the plugin (the index subfolder).
808
- * @param version - Plugin version ("" to omit).
809
- * @param items - The scanned `[type, name, desc]` rows.
810
- * @param pluginPath - Absolute source plugin directory (for recursion).
811
- */
813
+ * Write `<outputDir>/<pluginName>/index.md` (indented linked tree) and recurse
814
+ * agents/skills/commands into their own index trees rooted there.
815
+ * @param outputDir - The map root directory.
816
+ * @param pluginName - Display name of the plugin (the index subfolder).
817
+ * @param version - Plugin version ("" to omit).
818
+ * @param items - The scanned `[type, name, desc]` rows.
819
+ * @param pluginPath - Absolute source plugin directory (for recursion).
820
+ */
812
821
  declare function writePluginMap(outputDir: string, pluginName: string, version: string, items: ReadonlyArray<ScanRow>, pluginPath: string): void;
813
822
  //#endregion
814
823
  //#region src/runtime/lifecycle-bridge.d.ts
815
824
  /**
816
- * Run the ported lifecycle/session/context hooks (SessionStart, SubagentStart/
817
- * Stop, TeammateIdle, PostToolUseFailure, PreCompact, SessionEnd,
818
- * InstructionsLoaded, rules-scope UserPromptSubmit). Returns the native stdout
819
- * when handled, or `null` to fall through to the tool-use pipeline.
820
- * @param payload - The raw hook payload.
821
- * @param cwd - Project root.
822
- * @param scope - The invoking plugin scope (defaults to `core`).
823
- * @param now - Clock.
824
- * @param id - Harness target id (defaults to "claude-code" — zero-regression default).
825
- * @returns The native stdout, or `null` when unhandled.
826
- */
825
+ * Run the ported lifecycle/session/context hooks (SessionStart, SubagentStart/
826
+ * Stop, TeammateIdle, PostToolUseFailure, PreCompact, SessionEnd,
827
+ * InstructionsLoaded, rules-scope UserPromptSubmit). Returns the native stdout
828
+ * when handled, or `null` to fall through to the tool-use pipeline.
829
+ * @param payload - The raw hook payload.
830
+ * @param cwd - Project root.
831
+ * @param scope - The invoking plugin scope (defaults to `core`).
832
+ * @param now - Clock.
833
+ * @param id - Harness target id (defaults to "claude-code" — zero-regression default).
834
+ * @returns The native stdout, or `null` when unhandled.
835
+ */
827
836
  declare function lifecycleStdout(payload: Record<string, unknown>, cwd: string, scope: PluginScope, now: number, id?: string): string | null;
828
837
  /**
829
- * Post-edit additions for core-scope PostToolUse: auto-document a Read of a
830
- * SKILL.md/README/docs file; else (Write/Edit) track cumulative session
831
- * changes (sniper reminder) AND report eslint/prettier issues — parity
832
- * core-guards hooks.json, which runs both as independent PostToolUse commands
833
- * rather than short-circuiting one on the other. Returns the combined extra
834
- * stdout, or "" when nothing to emit.
835
- * @param scope - The invoking plugin scope.
836
- * @param event - The normalized event.
837
- * @param now - Clock.
838
- * @param id - Harness target id (defaults to "claude-code" — zero-regression default).
839
- * @returns The extra stdout (possibly empty).
840
- */
838
+ * Post-edit additions for core-scope PostToolUse: auto-document a Read of a
839
+ * SKILL.md/README/docs file; else (Write/Edit) track cumulative session
840
+ * changes (sniper reminder) AND report eslint/prettier issues — parity
841
+ * core-guards hooks.json, which runs both as independent PostToolUse commands
842
+ * rather than short-circuiting one on the other. Returns the combined extra
843
+ * stdout, or "" when nothing to emit.
844
+ * @param scope - The invoking plugin scope.
845
+ * @param event - The normalized event.
846
+ * @param now - Clock.
847
+ * @param id - Harness target id (defaults to "claude-code" — zero-regression default).
848
+ * @returns The extra stdout (possibly empty).
849
+ */
841
850
  declare function postEditContext(scope: PluginScope, event: NormalizedEvent, now: number, id?: string): Promise<string>;
842
851
  //#endregion
843
852
  //#region src/runtime/handle-types.d.ts
@@ -860,11 +869,11 @@ interface HandleOutcome {
860
869
  //#endregion
861
870
  //#region src/runtime/handle.d.ts
862
871
  /**
863
- * The full hook handler: on a PRE event it gates the tool-use (stateless guards
864
- * then APEX gates from the session track) and returns the native response; on a
865
- * POST event it records the activity into the track. The loop that makes the
866
- * package behave like the Claude plugin, on any harness.
867
- */
872
+ * The full hook handler: on a PRE event it gates the tool-use (stateless guards
873
+ * then APEX gates from the session track) and returns the native response; on a
874
+ * POST event it records the activity into the track. The loop that makes the
875
+ * package behave like the Claude plugin, on any harness.
876
+ */
868
877
  declare function handleHook(id: string, payload: Record<string, unknown>, opts: HandleOptions): Promise<HandleOutcome>;
869
878
  //#endregion
870
879
  //#region src/runtime/handle-pre.d.ts
@@ -879,10 +888,10 @@ interface PreContext {
879
888
  opts: HandleOptions;
880
889
  }
881
890
  /**
882
- * Run the PreToolUse pipeline: MCP/WebFetch cache intercept, design gate, APEX Task context injection, then the stateless+APEX gate chain, returning the native hook outcome (deny/ask/inject or allow).
883
- * @param ctx - The resolved pre-context.
884
- * @returns The hook outcome.
885
- */
891
+ * Run the PreToolUse pipeline: MCP/WebFetch cache intercept, design gate, APEX Task context injection, then the stateless+APEX gate chain, returning the native hook outcome (deny/ask/inject or allow).
892
+ * @param ctx - The resolved pre-context.
893
+ * @returns The hook outcome.
894
+ */
886
895
  declare function handlePre(ctx: PreContext): Promise<HandleOutcome>;
887
896
  //#endregion
888
897
  export { Activity, DEFAULT_WINDOW_MS, DuplicationVerdict, type GateInput, type HandleOptions, type HandleOutcome, LifecycleInput, MCP_TTL_MS, McpIntercept, NormalizedEvent, NormalizedFile, PluginScope, PreContext, REQUIRED_AGENTS, SolidProfile, TRIVIAL_BUDGET, ToolEvent, WEBFETCH_TTL_MS, activityFor, aipilotPostToolUse, cacheQueryOf, cartoSessionStart, checkFileSize, claudeHome, claudeMdKey, cleanupSession, countFiles, countLoc, defaultStateDir, detectDuplication, detectSolidProfile, devContext, dispatchAipilot, dispatchLessons, dispatchLifecycle, dispatchMemory, dryGate, extractSymbols, fuseHarnessHome, fusengineCache, gate, generateEcosystemMap, generateProjectMap, getFileDesc, gitContext, handleHook, handlePre, harnessStateDir, injectRules, isMcpTool, isProject, isoUtc, lessonsArchiveFileFor, lessonsFileFor, lessonsStateFileFor, lifecycleStdout, listChildren, loadEnriched, loadSecurityState, loadSessionState, logToolFailure, mcpPostStore, mcpPreIntercept, mergeLines, normalizeEvent, postEditContext, postEditTypescript, postTrackingSideEffects, preCommitGate, projectContext, projectHash, promptSubmitContext, pruneEmptyDirs, purgeTtlTree, queryOf, readRules, recordActivity, removeOldFiles, respond, runSessionStartCleanups, sanitizeSessionId, saveApexState, saveSecurityState, saveSessionState, securityAdvisory, securityAdvisoryForPatch, securityStateDir, securityStatePath, seoPostToolUse, seoPostToolUseResponse, sessionStartCore, sessionStatePath, sessionsDir, solidDetectStart, subagentCacheContext, taskContext, todayUtc, trackAgentMemory, trackEnrichment, trackFile, trackMcpResearch, trackSessionChanges, trackSkillRead, trackWatchResearch, trimLogFile, validateRulesLoaded, validateSolidGate, validateTailwind, validateTeammateOutput, writePluginMap, writeTree };