@fusengine/harness 0.1.43 → 0.1.45

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 (47) hide show
  1. package/dist/adapters/claude/index.d.mts +2 -2
  2. package/dist/adapters/claude/index.mjs +2 -2
  3. package/dist/adapters/cline/index.mjs +1 -1
  4. package/dist/adapters/codex/index.d.mts +1 -1
  5. package/dist/adapters/codex/index.mjs +1 -1
  6. package/dist/adapters/cursor/index.mjs +1 -1
  7. package/dist/adapters/gemini/index.mjs +1 -1
  8. package/dist/cache/index.d.mts +2 -2
  9. package/dist/cache/index.mjs +2 -2
  10. package/dist/{claude-CeRYMOaG.mjs → claude-DLh0fHWM.mjs} +6 -2
  11. package/dist/cli/bin.mjs +227 -7
  12. package/dist/cli/index.mjs +1 -1
  13. package/dist/config/index.d.mts +1 -1
  14. package/dist/config/index.mjs +1 -2
  15. package/dist/{doc-helpers-D14nkD5D.d.mts → doc-helpers-BNfYWvYv.d.mts} +9 -1
  16. package/dist/{doc-helpers-BhzDmJ18.mjs → doc-helpers-CWZegVdR.mjs} +14 -5
  17. package/dist/{dotenv-DGyLln7U.mjs → dotenv-B9nM4cuQ.mjs} +26 -1
  18. package/dist/evaluate-d7Pp8XJH.mjs +784 -0
  19. package/dist/freshness/index.d.mts +1 -1
  20. package/dist/freshness/index.mjs +1 -1
  21. package/dist/{handle-BTHcKWQ5.mjs → handle-DJaaD2BT.mjs} +849 -395
  22. package/dist/home-state-mKZxP4oZ.mjs +52 -0
  23. package/dist/{index-D7GpOmkl.d.mts → index-BA-SqNR7.d.mts} +1 -1
  24. package/dist/{index-BX-xcvhY.d.mts → index-BUwEmIK-.d.mts} +10 -1
  25. package/dist/{index-DXQfL1u8.d.mts → index-BXPySPxE.d.mts} +7 -1
  26. package/dist/{index-CwOdFBOr.d.mts → index-BxjzFraL.d.mts} +3 -1
  27. package/dist/{index-DN4cZDbU.d.mts → index-CVhw7eA0.d.mts} +111 -23
  28. package/dist/index.d.mts +6 -6
  29. package/dist/index.mjs +8 -9
  30. package/dist/{loader-Bn-DbZmt.mjs → loader-AGz4nK7d.mjs} +1 -1
  31. package/dist/{mcp-store-CnsW9oFj.mjs → mcp-store-BkBDmuxN.mjs} +22 -5
  32. package/dist/policy/index.d.mts +2 -2
  33. package/dist/policy/index.mjs +3 -3
  34. package/dist/refs/index.mjs +2 -2
  35. package/dist/{router-BfX0hJg8.mjs → router-PKVNBHge.mjs} +11 -1
  36. package/dist/{run-jgivVDv6.mjs → run-DLXtA5DH.mjs} +1 -1
  37. package/dist/runtime/index.d.mts +71 -14
  38. package/dist/runtime/index.mjs +3 -3
  39. package/dist/{session-state-Dzq6yrw7.d.mts → session-state-D4F_Dub6.d.mts} +1 -1
  40. package/dist/state/index.d.mts +1 -1
  41. package/dist/{store-CdWOQ9zD.mjs → store-CNjFenWe.mjs} +3 -50
  42. package/dist/tracking/index.d.mts +1 -1
  43. package/dist/tracking/index.mjs +1 -1
  44. package/dist/{validate-xi-zc-22.mjs → validate-DcQaKzau.mjs} +538 -84
  45. package/package.json +1 -1
  46. package/dist/evaluate-CeivW6G0.mjs +0 -477
  47. package/dist/ttl-BG55s6HZ.mjs +0 -20
@@ -1,6 +1,6 @@
1
1
  import { t as Prompt } from "../types-D56jSgD9.mjs";
2
2
  import { t as RefMeta } from "../types-CY5qT2X1.mjs";
3
- import { t as AgentQuality } from "../session-state-Dzq6yrw7.mjs";
3
+ import { t as AgentQuality } from "../session-state-D4F_Dub6.mjs";
4
4
 
5
5
  //#region src/runtime/paths.d.ts
6
6
  /**
@@ -103,7 +103,12 @@ interface GateInput {
103
103
  //#region src/runtime/gate.d.ts
104
104
  /** Prior agents the freshness gate requires before a code edit. */
105
105
  declare const REQUIRED_AGENTS: ReadonlyArray<string>;
106
- /** Default freshness window for {@link REQUIRED_AGENTS} (2 min — matches the plugin's `FUSE_ENFORCE_TTL_SEC` default). */
106
+ /**
107
+ * Default freshness window for {@link REQUIRED_AGENTS}, in ms. Matches the
108
+ * plugin's `FUSE_ENFORCE_TTL_SEC` default (120s). Only a fallback for direct
109
+ * programmatic callers that omit `windowMs` (e.g. tests) — the real CLI path
110
+ * always supplies `windowMs` from `resolveTtlSec()` (`src/config/ttl.ts`).
111
+ */
107
112
  declare const DEFAULT_WINDOW_MS = 12e4;
108
113
  /** Trivial edits allowed within the window before the full APEX gates apply. */
109
114
  declare const TRIVIAL_BUDGET = 4;
@@ -129,7 +134,12 @@ interface DuplicationVerdict {
129
134
  * timeout, or no-match — matching the original Python hook.
130
135
  */
131
136
  declare function detectDuplication(filePath: string, content: string, cwd: string): DuplicationVerdict;
132
- /** Blocking prompt when a Write/Edit re-declares 2+ existing symbols, else null. */
137
+ /**
138
+ * Prompt when a Write/Edit re-declares an existing symbol: a single match is a
139
+ * softer non-blocking "inform" (could be a false positive / same-name coincidence),
140
+ * escalating to a hard "block" once 2+ existing declarations are found. Returns
141
+ * `null` when no duplicate symbol is found at all.
142
+ */
133
143
  declare function dryGate(tool: string, filePath: string, content: string | undefined, cwd: string | undefined): Prompt | null;
134
144
  //#endregion
135
145
  //#region src/runtime/precommit.d.ts
@@ -158,9 +168,20 @@ declare function normalizeEvent(id: string, payload: Record<string, unknown>): N
158
168
  //#endregion
159
169
  //#region src/runtime/respond.d.ts
160
170
  /**
161
- * Map a portable {@link Prompt} to a harness's native hook response. `block`
162
- * denies; anything else asks/injects context. (Codex/Cursor parse but ignore
163
- * `ask` they only honor deny.)
171
+ * Map a portable {@link Prompt} to a harness's native hook response, honoring
172
+ * all 3 prompt kinds (`block`/`ask`/`inform`) instead of collapsing `ask` and
173
+ * `inform` together. Reuses the Claude adapter's `denyResponse`/
174
+ * `contextResponse` builders for claude-code/codex (same hook shape) to avoid
175
+ * duplicating the JSON.
176
+ * - claude-code/codex: `block` -> deny, `ask` -> interactive
177
+ * `permissionDecision:"ask"`, `inform` -> non-blocking `additionalContext`.
178
+ * - gemini-cli/cline: their real hook schemas have no interactive "ask"
179
+ * state (deny is the only blocking outcome), so `ask` and `inform` already
180
+ * both resolve to non-blocking context injection — unchanged.
181
+ * - cursor: `ask` keeps its current best-effort `permission:"ask"` shape
182
+ * (unverified against Cursor's exact hook docs); only `inform` is fixed to
183
+ * a non-blocking `permission:"allow"` note, since it was wrongly conflated
184
+ * with `ask` before.
164
185
  */
165
186
  declare function respond(id: string, prompt: Prompt): string;
166
187
  //#endregion
@@ -303,6 +324,40 @@ declare function detectSolidProfile(projectDir: string): SolidProfile;
303
324
  */
304
325
  declare function solidDetectStart(env?: Record<string, string | undefined>): string;
305
326
  //#endregion
327
+ //#region src/runtime/lifecycle/check-file-size.d.ts
328
+ /** Count lines of code excluding comments/blanks for `filePath`'s extension (raw length when unmapped). */
329
+ declare function countLoc(filePath: string, content: string): number;
330
+ /**
331
+ * Warn when a written/edited file exceeds `SOLID_FILE_LIMIT` (default 100).
332
+ * Inert when `SOLID_PROJECT_TYPE` is absent/"unknown" (parity: the Python hook
333
+ * no-ops outside a detected project).
334
+ * @param tool - The tool name (only "Write"/"Edit" are checked).
335
+ * @param filePath - The written file's absolute path.
336
+ * @param env - Environment (defaults to `process.env`).
337
+ * @returns The PostToolUse `additionalContext` response, or `""` when clean/inert.
338
+ */
339
+ declare function checkFileSize(tool: string, filePath: string, env?: Record<string, string | undefined>): string;
340
+ //#endregion
341
+ //#region src/runtime/lifecycle/validate-solid.d.ts
342
+ /**
343
+ * Deny a Write/Edit that violates the Go/Python interface-location SOLID rule.
344
+ * @param tool - The tool name (only "Write"/"Edit" are checked).
345
+ * @param filePath - The written file's absolute path.
346
+ * @param content - The written/edited content (`new_string` snippet on Edit).
347
+ * @param env - Environment (defaults to `process.env`).
348
+ * @returns The PreToolUse deny response, or `""` when clean/inert.
349
+ */
350
+ declare function validateSolidGate(tool: string, filePath: string, content: string, env?: Record<string, string | undefined>): string;
351
+ //#endregion
352
+ //#region src/runtime/lifecycle/validate-tailwind.d.ts
353
+ /**
354
+ * Validate Tailwind best practices on a just-written file.
355
+ * @param tool - The tool name (only "Write"/"Edit" are checked).
356
+ * @param filePath - The written file's absolute path.
357
+ * @returns The PostToolUse `additionalContext` response, or `""` when clean/inert.
358
+ */
359
+ declare function validateTailwind(tool: string, filePath: string): string;
360
+ //#endregion
306
361
  //#region src/runtime/lifecycle/subagent-cache.d.ts
307
362
  /**
308
363
  * Handle SubagentStart: surface fresh MCP cache entries for the session as
@@ -407,12 +462,12 @@ declare function postEditTypescript(filePath: string): string;
407
462
  * `null` when unhandled (caller falls through to the default pipeline).
408
463
  */
409
464
  declare function dispatchAipilot(event: string, payload: Record<string, unknown>, cwd: string, now: number): Promise<string | null>;
410
- /** PostToolUse (TaskCreate/TaskUpdate) sync for the ai-pilot scope. */
465
+ /** PostToolUse (Write/Edit SOLID check, else TaskCreate/TaskUpdate sync) for the ai-pilot scope. */
411
466
  declare function aipilotPostToolUse(payload: Record<string, unknown>, cwd: string): Promise<string>;
412
467
  //#endregion
413
468
  //#region src/runtime/lifecycle/dispatch.d.ts
414
469
  /** Which plugin's hooks.json invoked the harness (selects SessionStart behavior). */
415
- type PluginScope = "core" | "solid" | "rules" | "carto" | "security" | "changelog" | "aipilot" | "lessons" | "seo" | "memory";
470
+ type PluginScope = "core" | "solid" | "rules" | "carto" | "security" | "changelog" | "aipilot" | "lessons" | "seo" | "memory" | "tailwindcss";
416
471
  /** Inputs the lifecycle dispatcher needs (clock + roots injected). */
417
472
  interface LifecycleInput {
418
473
  event: string;
@@ -681,16 +736,18 @@ declare function writePluginMap(outputDir: string, pluginName: string, version:
681
736
  */
682
737
  declare function lifecycleStdout(payload: Record<string, unknown>, cwd: string, scope: PluginScope, now: number): string | null;
683
738
  /**
684
- * Post-edit additions for core-scope PostToolUse Write/Edit: track cumulative
685
- * session changes (sniper reminder) + report eslint/prettier issues. Returns the
686
- * combined extra stdout (track-changes wins; lint appended only when no track
687
- * output), or "" when nothing to emit.
739
+ * Post-edit additions for core-scope PostToolUse: auto-document a Read of a
740
+ * SKILL.md/README/docs file; else (Write/Edit) track cumulative session
741
+ * changes (sniper reminder) AND report eslint/prettier issues parity
742
+ * core-guards hooks.json, which runs both as independent PostToolUse commands
743
+ * rather than short-circuiting one on the other. Returns the combined extra
744
+ * stdout, or "" when nothing to emit.
688
745
  * @param scope - The invoking plugin scope.
689
746
  * @param event - The normalized event.
690
747
  * @param now - Clock.
691
748
  * @returns The extra stdout (possibly empty).
692
749
  */
693
- declare function postEditContext(scope: PluginScope, event: NormalizedEvent, now: number): string;
750
+ declare function postEditContext(scope: PluginScope, event: NormalizedEvent, now: number): Promise<string>;
694
751
  //#endregion
695
752
  //#region src/runtime/handle.d.ts
696
753
  /** Options for {@link handleHook} (caller supplies the clock + project root). */
@@ -737,4 +794,4 @@ interface PreContext {
737
794
  */
738
795
  declare function handlePre(ctx: PreContext): Promise<HandleOutcome>;
739
796
  //#endregion
740
- export { Activity, DEFAULT_WINDOW_MS, DuplicationVerdict, type GateInput, HandleOptions, HandleOutcome, LifecycleInput, MCP_TTL_MS, McpIntercept, NormalizedEvent, PluginScope, PreContext, REQUIRED_AGENTS, SolidProfile, TRIVIAL_BUDGET, ToolEvent, WEBFETCH_TTL_MS, activityFor, aipilotPostToolUse, cacheQueryOf, cartoSessionStart, claudeHome, cleanupSession, countFiles, defaultStateDir, detectDuplication, detectSolidProfile, devContext, dispatchAipilot, dispatchLessons, dispatchLifecycle, dispatchMemory, dryGate, extractSymbols, fuseHarnessHome, fusengineCache, gate, generateEcosystemMap, generateProjectMap, getFileDesc, gitContext, handleHook, handlePre, harnessStateDir, injectRules, isMcpTool, isProject, isoUtc, 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, securityStateDir, securityStatePath, seoPostToolUse, seoPostToolUseResponse, sessionStartCore, sessionStatePath, sessionsDir, solidDetectStart, subagentCacheContext, taskContext, todayUtc, trackAgentMemory, trackEnrichment, trackFile, trackMcpResearch, trackSessionChanges, trackSkillRead, trackWatchResearch, trimLogFile, validateRulesLoaded, validateTeammateOutput, writePluginMap, writeTree };
797
+ export { Activity, DEFAULT_WINDOW_MS, DuplicationVerdict, type GateInput, HandleOptions, HandleOutcome, LifecycleInput, MCP_TTL_MS, McpIntercept, NormalizedEvent, PluginScope, PreContext, REQUIRED_AGENTS, SolidProfile, TRIVIAL_BUDGET, ToolEvent, WEBFETCH_TTL_MS, activityFor, aipilotPostToolUse, cacheQueryOf, cartoSessionStart, checkFileSize, claudeHome, 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, 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, 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 };
@@ -1,6 +1,6 @@
1
1
  import { r as projectLayout } from "../layout-C0jaaCQC.mjs";
2
- import { _ as saveSessionState, f as claudeHome, g as sanitizeSessionId, h as loadSessionState, m as fusengineCache, p as fuseHarnessHome, v as sessionStatePath, y as sessionsDir } from "../store-CdWOQ9zD.mjs";
3
- import { $ as saveApexState, A as trackSkillRead, B as writePluginMap, C as seoPostToolUse, Ct as isoUtc, D as postTrackingSideEffects, Dt as securityStatePath, E as securityAdvisory, Et as securityStateDir, F as dispatchLessons, G as mergeLines, H as isProject, I as lessonsFileFor, J as listChildren, K as countFiles, L as lessonsStateFileFor, M as dispatchLifecycle, N as aipilotPostToolUse, O as trackWatchResearch, Ot as todayUtc, P as dispatchAipilot, Q as cleanupSession, R as cartoSessionStart, S as postEditContext, St as normalizeEvent, T as dispatchMemory, Tt as saveSecurityState, U as writeTree, V as generateProjectMap, W as loadEnriched, X as trackSessionChanges, Y as postEditTypescript, Z as validateRulesLoaded, _ as preCommitGate, _t as promptSubmitContext, a as recordActivity, at as solidDetectStart, b as extractSymbols, bt as projectHash, c as MCP_TTL_MS, ct as runSessionStartCleanups, d as isMcpTool, dt as purgeTtlTree, et as logToolFailure, f as queryOf, ft as removeOldFiles, g as gate, gt as projectContext, h as TRIVIAL_BUDGET, ht as gitContext, i as respond, it as detectSolidProfile, j as trackEnrichment, k as trackMcpResearch, l as WEBFETCH_TTL_MS, lt as sessionStartCore, m as REQUIRED_AGENTS, mt as devContext, n as activityFor, nt as trackAgentMemory, o as mcpPostStore, ot as injectRules, p as DEFAULT_WINDOW_MS, pt as trimLogFile, q as getFileDesc, r as handlePre, rt as subagentCacheContext, s as mcpPreIntercept, st as readRules, t as handleHook, tt as validateTeammateOutput, u as cacheQueryOf, ut as pruneEmptyDirs, v as detectDuplication, vt as taskContext, w as seoPostToolUseResponse, wt as loadSecurityState, x as lifecycleStdout, xt as trackFile, y as dryGate, yt as defaultStateDir, z as generateEcosystemMap } from "../handle-BTHcKWQ5.mjs";
2
+ import { a as sanitizeSessionId, c as sessionsDir, i as loadSessionState, n as fuseHarnessHome, o as saveSessionState, r as fusengineCache, s as sessionStatePath, t as claudeHome } from "../home-state-mKZxP4oZ.mjs";
3
+ import { $ as saveApexState, A as trackSkillRead, At as securityStateDir, B as writePluginMap, C as seoPostToolUse, Ct as defaultStateDir, D as postTrackingSideEffects, Dt as isoUtc, E as securityAdvisory, Et as normalizeEvent, F as dispatchLessons, G as mergeLines, H as isProject, I as lessonsFileFor, J as listChildren, K as countFiles, L as lessonsStateFileFor, M as dispatchLifecycle, Mt as todayUtc, N as aipilotPostToolUse, O as trackWatchResearch, Ot as loadSecurityState, P as dispatchAipilot, Q as cleanupSession, R as cartoSessionStart, S as postEditContext, St as taskContext, T as dispatchMemory, Tt as trackFile, U as writeTree, V as generateProjectMap, W as loadEnriched, X as trackSessionChanges, Y as postEditTypescript, Z as validateRulesLoaded, _ as preCommitGate, _t as trimLogFile, a as recordActivity, at as validateSolidGate, b as extractSymbols, bt as projectContext, c as MCP_TTL_MS, ct as detectSolidProfile, d as isMcpTool, dt as readRules, et as logToolFailure, f as queryOf, ft as runSessionStartCleanups, g as gate, gt as removeOldFiles, h as TRIVIAL_BUDGET, ht as purgeTtlTree, i as respond, it as validateTailwind, j as trackEnrichment, jt as securityStatePath, k as trackMcpResearch, kt as saveSecurityState, l as WEBFETCH_TTL_MS, lt as solidDetectStart, m as REQUIRED_AGENTS, mt as pruneEmptyDirs, n as activityFor, nt as trackAgentMemory, o as mcpPostStore, ot as checkFileSize, p as DEFAULT_WINDOW_MS, pt as sessionStartCore, q as getFileDesc, r as handlePre, rt as subagentCacheContext, s as mcpPreIntercept, st as countLoc, t as handleHook, tt as validateTeammateOutput, u as cacheQueryOf, ut as injectRules, v as detectDuplication, vt as devContext, w as seoPostToolUseResponse, wt as projectHash, x as lifecycleStdout, xt as promptSubmitContext, y as dryGate, yt as gitContext, z as generateEcosystemMap } from "../handle-DJaaD2BT.mjs";
4
4
  //#region src/runtime/storage.ts
5
5
  /**
6
6
  * The project's single state dir (`<root>/.harness`) — neutral + harness-agnostic,
@@ -10,4 +10,4 @@ function harnessStateDir(root) {
10
10
  return projectLayout(root).stateDir;
11
11
  }
12
12
  //#endregion
13
- export { DEFAULT_WINDOW_MS, MCP_TTL_MS, REQUIRED_AGENTS, TRIVIAL_BUDGET, WEBFETCH_TTL_MS, activityFor, aipilotPostToolUse, cacheQueryOf, cartoSessionStart, claudeHome, cleanupSession, countFiles, defaultStateDir, detectDuplication, detectSolidProfile, devContext, dispatchAipilot, dispatchLessons, dispatchLifecycle, dispatchMemory, dryGate, extractSymbols, fuseHarnessHome, fusengineCache, gate, generateEcosystemMap, generateProjectMap, getFileDesc, gitContext, handleHook, handlePre, harnessStateDir, injectRules, isMcpTool, isProject, isoUtc, 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, securityStateDir, securityStatePath, seoPostToolUse, seoPostToolUseResponse, sessionStartCore, sessionStatePath, sessionsDir, solidDetectStart, subagentCacheContext, taskContext, todayUtc, trackAgentMemory, trackEnrichment, trackFile, trackMcpResearch, trackSessionChanges, trackSkillRead, trackWatchResearch, trimLogFile, validateRulesLoaded, validateTeammateOutput, writePluginMap, writeTree };
13
+ export { DEFAULT_WINDOW_MS, MCP_TTL_MS, REQUIRED_AGENTS, TRIVIAL_BUDGET, WEBFETCH_TTL_MS, activityFor, aipilotPostToolUse, cacheQueryOf, cartoSessionStart, checkFileSize, claudeHome, 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, 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, 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 };
@@ -1,4 +1,4 @@
1
- import { t as AuthEntry } from "./doc-helpers-D14nkD5D.mjs";
1
+ import { t as AuthEntry } from "./doc-helpers-BNfYWvYv.mjs";
2
2
 
3
3
  //#region src/tracking/session-state.d.ts
4
4
  /** Quality of a recorded agent call (the freshness gate ignores insufficient ones). */
@@ -1,2 +1,2 @@
1
- import { a as taskStart, c as ensureStateDir, d as stateFilePath, f as acquireLock, i as taskCreate, l as loadState, n as ApexTaskFile, o as ApexState, r as taskComplete, s as apexStateDir, t as ApexTask, u as saveState } from "../index-D7GpOmkl.mjs";
1
+ import { a as taskStart, c as ensureStateDir, d as stateFilePath, f as acquireLock, i as taskCreate, l as loadState, n as ApexTaskFile, o as ApexState, r as taskComplete, s as apexStateDir, t as ApexTask, u as saveState } from "../index-BA-SqNR7.mjs";
2
2
  export { ApexState, ApexTask, ApexTaskFile, acquireLock, apexStateDir, ensureStateDir, loadState, saveState, stateFilePath, taskComplete, taskCreate, taskStart };
@@ -1,55 +1,8 @@
1
- import { a as writeJsonFile, i as readJsonFile, t as atomicWrite } from "./json-io-DisYd2fb.mjs";
1
+ import { a as writeJsonFile, i as readJsonFile } from "./json-io-DisYd2fb.mjs";
2
+ import { n as fuseHarnessHome } from "./home-state-mKZxP4oZ.mjs";
2
3
  import { join } from "node:path";
3
4
  import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
4
- import { homedir } from "node:os";
5
5
  import { createHmac, randomBytes } from "node:crypto";
6
- //#region src/runtime/home-state.ts
7
- /** Home `~/.claude` dir — per-harness config (CLAUDE.md, logs, plugins). */
8
- function claudeHome(home = homedir()) {
9
- return join(home, ".claude");
10
- }
11
- /** Neutral, harness-agnostic home for fuse-harness's OWN cache/state: `~/.fuse-harness`. */
12
- function fuseHarnessHome(home = homedir()) {
13
- return join(home, ".fuse-harness");
14
- }
15
- /** `~/.fuse-harness/cache` base dir for session/cache state (shared across harnesses). */
16
- function fusengineCache(home = homedir()) {
17
- return join(fuseHarnessHome(home), "cache");
18
- }
19
- /** `~/.fuse-harness/cache/sessions` — per-session JSON state dir. */
20
- function sessionsDir(home = homedir()) {
21
- return join(fusengineCache(home), "sessions");
22
- }
23
- const SID_RE = /^[a-zA-Z0-9_-]{1,128}$/;
24
- /** Validate a session id (1-128 url-safe chars); null when invalid. */
25
- function sanitizeSessionId(sid) {
26
- const s = String(sid ?? "").trim();
27
- return SID_RE.test(s) ? s : null;
28
- }
29
- /** Unified per-session state file path: `sessions/session-<sid>.json`. */
30
- function sessionStatePath(sid, home = homedir()) {
31
- return join(sessionsDir(home), `session-${sid}.json`);
32
- }
33
- /** Load a session-state dict, or `{}` when missing/corrupt (mirrors Python). */
34
- function loadSessionState(sid, home = homedir()) {
35
- const path = sessionStatePath(sid, home);
36
- try {
37
- if (!existsSync(path)) return {};
38
- const data = JSON.parse(readFileSync(path, "utf-8"));
39
- return typeof data === "object" && data !== null && !Array.isArray(data) ? data : {};
40
- } catch {
41
- return {};
42
- }
43
- }
44
- /** Atomically persist a session-state dict (0o600 via atomicWrite, indent 2). */
45
- function saveSessionState(sid, state, home = homedir()) {
46
- mkdirSync(sessionsDir(home), {
47
- recursive: true,
48
- mode: 448
49
- });
50
- atomicWrite(sessionStatePath(sid, home), JSON.stringify(state, null, 2));
51
- }
52
- //#endregion
53
6
  //#region src/tracking/session-state.ts
54
7
  /** A fresh, empty track. */
55
8
  function emptyTrack() {
@@ -228,4 +181,4 @@ async function saveTrack(file, track) {
228
181
  writeLastNonce(envelope.nonce);
229
182
  }
230
183
  //#endregion
231
- export { saveSessionState as _, emptyTrack as a, recordDoc as c, trivialCount as d, claudeHome as f, sanitizeSessionId as g, loadSessionState as h, agentsFresh as i, recordRefRead as l, fusengineCache as m, saveTrack as n, recordAgent as o, fuseHarnessHome as p, verifyTrack as r, recordBrainstormRequired as s, loadTrack as t, recordTrivialEdit as u, sessionStatePath as v, sessionsDir as y };
184
+ export { emptyTrack as a, recordDoc as c, trivialCount as d, agentsFresh as i, recordRefRead as l, saveTrack as n, recordAgent as o, verifyTrack as r, recordBrainstormRequired as s, loadTrack as t, recordTrivialEdit as u };
@@ -1,4 +1,4 @@
1
- import { a as recordAgent, c as recordRefRead, i as emptyTrack, l as recordTrivialEdit, n as SessionTrack, o as recordBrainstormRequired, r as agentsFresh, s as recordDoc, t as AgentQuality, u as trivialCount } from "../session-state-Dzq6yrw7.mjs";
1
+ import { a as recordAgent, c as recordRefRead, i as emptyTrack, l as recordTrivialEdit, n as SessionTrack, o as recordBrainstormRequired, r as agentsFresh, s as recordDoc, t as AgentQuality, u as trivialCount } from "../session-state-D4F_Dub6.mjs";
2
2
 
3
3
  //#region src/tracking/store.d.ts
4
4
  /**
@@ -1,2 +1,2 @@
1
- import { a as emptyTrack, c as recordDoc, d as trivialCount, i as agentsFresh, l as recordRefRead, n as saveTrack, o as recordAgent, s as recordBrainstormRequired, t as loadTrack, u as recordTrivialEdit } from "../store-CdWOQ9zD.mjs";
1
+ import { a as emptyTrack, c as recordDoc, d as trivialCount, i as agentsFresh, l as recordRefRead, n as saveTrack, o as recordAgent, s as recordBrainstormRequired, t as loadTrack, u as recordTrivialEdit } from "../store-CNjFenWe.mjs";
2
2
  export { agentsFresh, emptyTrack, loadTrack, recordAgent, recordBrainstormRequired, recordDoc, recordRefRead, recordTrivialEdit, saveTrack, trivialCount };