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