@fusengine/harness 0.1.17 → 0.1.19

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.
@@ -1,2 +1,2 @@
1
- import { a as readClaudeInput, i as guard, n as denyResponse, o as toClaudeResponse, r as fileSizeGuard, t as contextResponse } from "../../claude-DH4B1kOe.mjs";
1
+ import { a as readClaudeInput, i as guard, n as denyResponse, o as toClaudeResponse, r as fileSizeGuard, t as contextResponse } from "../../claude-Bzx_v9y1.mjs";
2
2
  export { contextResponse, denyResponse, fileSizeGuard, guard, readClaudeInput, toClaudeResponse };
@@ -1,4 +1,4 @@
1
- import { t as evaluate } from "../../evaluate-BmPDUtND.mjs";
1
+ import { t as evaluate } from "../../evaluate-CpBKZ6G-.mjs";
2
2
  import { t as formatPrompt } from "../../types-ernB1Dy3.mjs";
3
3
  //#region src/adapters/cline/index.ts
4
4
  /**
@@ -1,2 +1,2 @@
1
- import { a as readClaudeInput, i as guard, n as denyResponse, t as contextResponse } from "../../claude-DH4B1kOe.mjs";
1
+ import { a as readClaudeInput, i as guard, n as denyResponse, t as contextResponse } from "../../claude-Bzx_v9y1.mjs";
2
2
  export { contextResponse, denyResponse, guard, readClaudeInput as readCodexInput };
@@ -1,4 +1,4 @@
1
- import { t as evaluate } from "../../evaluate-BmPDUtND.mjs";
1
+ import { t as evaluate } from "../../evaluate-CpBKZ6G-.mjs";
2
2
  import { t as formatPrompt } from "../../types-ernB1Dy3.mjs";
3
3
  //#region src/adapters/cursor/index.ts
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { t as evaluate } from "../../evaluate-BmPDUtND.mjs";
1
+ import { t as evaluate } from "../../evaluate-CpBKZ6G-.mjs";
2
2
  import { t as formatPrompt } from "../../types-ernB1Dy3.mjs";
3
3
  //#region src/adapters/gemini/index.ts
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { t as evaluate } from "./evaluate-BmPDUtND.mjs";
1
+ import { t as evaluate } from "./evaluate-CpBKZ6G-.mjs";
2
2
  import { t as formatPrompt } from "./types-ernB1Dy3.mjs";
3
3
  //#region src/adapters/claude/index.ts
4
4
  /**
package/dist/cli/bin.mjs CHANGED
@@ -1,9 +1,9 @@
1
1
  #!/usr/bin/env node
2
2
  import { r as resolveTtlSec } from "../ttl-BG55s6HZ.mjs";
3
3
  import { t as detectHarness } from "../harness-C8Nxxyn_.mjs";
4
- import { n as stagedContent, r as stagedFiles, t as checkStaged } from "../run-BCvtbPca.mjs";
4
+ import { n as stagedContent, r as stagedFiles, t as checkStaged } from "../run-_Cy9-Tgv.mjs";
5
5
  import { n as writeInitFile, t as initFor } from "../run-D91N4ul1.mjs";
6
- import { t as handleHook } from "../handle-BycRtJ0S.mjs";
6
+ import { t as handleHook } from "../handle-DYF2Fju8.mjs";
7
7
  //#region src/cli/bin.ts
8
8
  /**
9
9
  * harness — CLI for @fusengine/harness.
@@ -1,2 +1,2 @@
1
- import { n as stagedContent, r as stagedFiles, t as checkStaged } from "../run-BCvtbPca.mjs";
1
+ import { n as stagedContent, r as stagedFiles, t as checkStaged } from "../run-_Cy9-Tgv.mjs";
2
2
  export { checkStaged, stagedContent, stagedFiles };
@@ -316,9 +316,11 @@ function evaluate(ctx) {
316
316
  actions: ["Approve if this git operation is intended"]
317
317
  }
318
318
  };
319
- if (ctx.filePath && isCodeFile(ctx.filePath) && ctx.content !== void 0) {
320
- const verdict = evaluateFileSize(countLines(ctx.content), ctx.maxLines);
321
- if (!verdict.ok) return {
319
+ if (ctx.filePath && isCodeFile(ctx.filePath) && ctx.agentType !== "Explore" && ctx.agentType !== "Plan") {
320
+ const incoming = ctx.content !== void 0 ? countLines(ctx.content) : 0;
321
+ const lines = ctx.tool === "Edit" ? Math.max(incoming, ctx.existingLines ?? 0) : incoming || (ctx.existingLines ?? 0);
322
+ const verdict = evaluateFileSize(lines, ctx.maxLines);
323
+ if (lines > 0 && !verdict.ok) return {
322
324
  decision: "deny",
323
325
  message: verdict.message,
324
326
  prompt: {
@@ -328,7 +330,7 @@ function evaluate(ctx) {
328
330
  actions: [`Split into modules under ${verdict.max} lines (Single Responsibility)`, "Then re-run the write"]
329
331
  },
330
332
  meta: {
331
- framework: detectFramework(ctx.filePath, ctx.content),
333
+ framework: detectFramework(ctx.filePath, ctx.content ?? ""),
332
334
  lines: verdict.lines,
333
335
  max: verdict.max
334
336
  }
@@ -1,11 +1,12 @@
1
1
  import { r as projectLayout } from "./layout-C0jaaCQC.mjs";
2
- import { O as detectFramework, t as evaluate } from "./evaluate-BmPDUtND.mjs";
2
+ import { O as detectFramework, t as evaluate } from "./evaluate-CpBKZ6G-.mjs";
3
3
  import { c as evaluateApex, i as detectCreationIntent, r as capVerbosity } from "./verbosity-D82yP4WD.mjs";
4
4
  import { t as formatPrompt } from "./types-ernB1Dy3.mjs";
5
5
  import { a as extractText, r as cacheStore, t as cacheLookup } from "./store-DeIsfMg5.mjs";
6
6
  import { t as loadRefs } from "./loader-BephwI8n.mjs";
7
7
  import { a as recordAgent, c as recordRefRead, l as recordTrivialEdit, n as saveTrack, o as recordBrainstormRequired, r as agentsFresh, s as recordDoc, t as loadTrack, u as trivialCount } from "./store-BnHpq2ZB.mjs";
8
8
  import { join } from "node:path";
9
+ import { existsSync, readFileSync } from "node:fs";
9
10
  import { tmpdir } from "node:os";
10
11
  //#region src/runtime/activity.ts
11
12
  /** Min response length (chars) for a lead agent call to count as `sufficient`. */
@@ -62,6 +63,15 @@ const REQUIRED_AGENTS = ["explore-codebase", "research-expert"];
62
63
  const DEFAULT_WINDOW_MS = 12e4;
63
64
  /** Trivial edits allowed within the window before the full APEX gates apply. */
64
65
  const TRIVIAL_BUDGET = 4;
66
+ /** Line count of the existing on-disk file (undefined if absent/unreadable). */
67
+ function existingLineCount(path) {
68
+ if (!path) return void 0;
69
+ try {
70
+ return existsSync(path) ? readFileSync(path, "utf8").split("\n").length : void 0;
71
+ } catch {
72
+ return;
73
+ }
74
+ }
65
75
  /**
66
76
  * Full gate: the stateless guards (file-size, git, security...) first, then a
67
77
  * trivial-edit fast path, then the stateful APEX gates fed from the session
@@ -72,7 +82,9 @@ async function gate(input) {
72
82
  tool: input.tool,
73
83
  filePath: input.filePath,
74
84
  content: input.content,
75
- command: input.command
85
+ command: input.command,
86
+ agentType: input.agentType,
87
+ existingLines: existingLineCount(input.filePath)
76
88
  });
77
89
  if (quick.decision !== "allow" && quick.prompt) return quick.prompt;
78
90
  if (!input.filePath) return null;
@@ -130,6 +142,11 @@ function mutateWith(id, input) {
130
142
  if (id === "gemini-cli") return JSON.stringify({ hookSpecificOutput: { tool_input: input } });
131
143
  return "";
132
144
  }
145
+ /** The doc provider a served cache-hit satisfies (`exa`/`context7`), else undefined. */
146
+ function docSourceOf(tool) {
147
+ if (/exa/i.test(tool)) return "exa";
148
+ if (/context7/i.test(tool)) return "context7";
149
+ }
133
150
  /**
134
151
  * Pre-event MCP interception: serve a fresh cache hit (deny + cached content),
135
152
  * else cap exa verbosity (allow + mutated input), else null to allow normally.
@@ -140,12 +157,15 @@ function mcpPreIntercept(id, tool, input, dir, ttlMs, now) {
140
157
  const cached = cacheLookup(dir, tool, queryOf(input), ttlMs, now);
141
158
  if (cached) {
142
159
  const served = denyWith(id, cached);
143
- if (served) return served;
160
+ if (served) return {
161
+ stdout: served,
162
+ docSource: docSourceOf(tool)
163
+ };
144
164
  }
145
165
  const capped = capVerbosity(tool, input);
146
166
  if (capped) {
147
167
  const mutated = mutateWith(id, capped);
148
- if (mutated) return mutated;
168
+ if (mutated) return { stdout: mutated };
149
169
  }
150
170
  return null;
151
171
  }
@@ -188,7 +208,8 @@ function normalizeEvent(id, payload) {
188
208
  sessionId: str(payload.session_id) ?? str(payload.conversation_id) ?? "",
189
209
  filePath: str(input.file_path) ?? str(input.path) ?? str(payload.file_path),
190
210
  content: str(input.content) ?? str(input.new_string),
191
- command: str(input.command) ?? str(payload.command)
211
+ command: str(input.command) ?? str(payload.command),
212
+ agentType: str(payload.agent_type) ?? str(input.subagent_type)
192
213
  };
193
214
  }
194
215
  //#endregion
@@ -278,10 +299,18 @@ async function handleHook(id, payload, opts) {
278
299
  };
279
300
  }
280
301
  const intercept = mcpPreIntercept(id, event.tool, event.input, mcpDir, MCP_TTL_MS, opts.now);
281
- if (intercept !== null) return {
282
- stdout: intercept,
283
- exit: 0
284
- };
302
+ if (intercept !== null) {
303
+ if (intercept.docSource) await recordActivity(file, {
304
+ kind: "doc",
305
+ framework,
306
+ sessionId: event.sessionId,
307
+ source: intercept.docSource
308
+ });
309
+ return {
310
+ stdout: intercept.stdout,
311
+ exit: 0
312
+ };
313
+ }
285
314
  const prompt = await gate({
286
315
  sessionId: event.sessionId,
287
316
  framework,
@@ -291,6 +320,7 @@ async function handleHook(id, payload, opts) {
291
320
  command: event.command,
292
321
  refs: opts.refsDir ? await loadRefs(opts.refsDir) : void 0,
293
322
  isReplaceAll: event.input.replace_all === true,
323
+ agentType: event.agentType,
294
324
  windowMs: opts.windowMs,
295
325
  now: opts.now,
296
326
  trackFile: file
@@ -64,6 +64,10 @@ interface PolicyContext {
64
64
  command?: string;
65
65
  /** Optional override for the SOLID max-lines limit. */
66
66
  maxLines?: number;
67
+ /** Subagent type — `Explore`/`Plan` are exempt from the file-size gate. */
68
+ agentType?: string;
69
+ /** Line count of the existing on-disk file (so an Edit on an oversized file blocks). */
70
+ existingLines?: number;
67
71
  }
68
72
  /** Harness-agnostic policy decision (+ a portable prompt for adapters to render). */
69
73
  interface PolicyResult {
package/dist/index.d.mts CHANGED
@@ -5,7 +5,7 @@ import { a as detectHarness, i as HarnessVia, n as HarnessInfo, o as detectMode,
5
5
  import { a as isDocConsulted, i as formatDocSatisfactionStatus, n as DocSatisfactionStatus, o as resolveSessions, r as formatDocDeny, t as AuthEntry } from "./doc-helpers-CG1nuf-c.mjs";
6
6
  import { t as incrementTrivialEditCounter } from "./index-BOBXQ91y.mjs";
7
7
  import { i as compactJson, n as projectRoot, r as projectRootOrNull, t as isCodeFile } from "./index-C1vLIMwN.mjs";
8
- import { A as docConsultedGate, B as SYSTEM_INSTALL, C as securityGuard, D as ApexContext, E as APEX_GATES, F as PolicyResult, G as detectFramework, H as FileSizeVerdict, I as evaluate, J as detectProjectType, K as DEV_KEYWORDS, L as GIT_ASK, M as freshnessGate, N as solidReadGate, O as ApexGate, P as PolicyContext, R as GIT_BLOCKED, S as CRITICAL_PATTERNS, T as GuardContext, U as countLines, V as matchPatterns, W as evaluateFileSize, Y as isApexCommand, _ as CODE_REDIRECT, a as GUARDS, b as protectedPathGuard, c as GO_DECL_RE, d as PY_MODEL_RE, f as SWIFT_PROTO_RE, g as CODE_MUTATORS, h as ASK_WRITERS, i as detectCreationIntent, j as evaluateApex, k as brainstormGate, l as JAVA_DECL_RE, m as interfaceSeparationGuard, n as MAX_TOKENS, o as runGuards, p as TS_DECL_RE, q as ProjectType, r as capVerbosity, s as installGuard, t as MAX_EXA_RESULTS, u as PHP_DECL_RE, v as bashWriteGuard, w as Guard, x as ASK_PATTERNS, y as PROTECTED_FRAGMENTS, z as PROJECT_INSTALL } from "./index-Dz55GnvV.mjs";
8
+ import { A as docConsultedGate, B as SYSTEM_INSTALL, C as securityGuard, D as ApexContext, E as APEX_GATES, F as PolicyResult, G as detectFramework, H as FileSizeVerdict, I as evaluate, J as detectProjectType, K as DEV_KEYWORDS, L as GIT_ASK, M as freshnessGate, N as solidReadGate, O as ApexGate, P as PolicyContext, R as GIT_BLOCKED, S as CRITICAL_PATTERNS, T as GuardContext, U as countLines, V as matchPatterns, W as evaluateFileSize, Y as isApexCommand, _ as CODE_REDIRECT, a as GUARDS, b as protectedPathGuard, c as GO_DECL_RE, d as PY_MODEL_RE, f as SWIFT_PROTO_RE, g as CODE_MUTATORS, h as ASK_WRITERS, i as detectCreationIntent, j as evaluateApex, k as brainstormGate, l as JAVA_DECL_RE, m as interfaceSeparationGuard, n as MAX_TOKENS, o as runGuards, p as TS_DECL_RE, q as ProjectType, r as capVerbosity, s as installGuard, t as MAX_EXA_RESULTS, u as PHP_DECL_RE, v as bashWriteGuard, w as Guard, x as ASK_PATTERNS, y as PROTECTED_FRAGMENTS, z as PROJECT_INSTALL } from "./index-oco-cH5T.mjs";
9
9
  import { n as RouteResult, r as ScoredRef, t as RefMeta } from "./types-CY5qT2X1.mjs";
10
10
  import { a as ReminderState, c as readState, d as throttleMs, i as registryFile, l as setStateField, n as addRoot, o as lessonsFileFor, r as readRoots, s as nowStamp, t as ensureMemoryGitignore, u as stateFileFor } from "./index-DLYhervv.mjs";
11
11
  import { a as globToRe, i as scoreReferences, n as toRefMeta, o as parseFrontmatter, r as routeReferences, t as loadRefs } from "./index-hL_r6tlc.mjs";
package/dist/index.mjs CHANGED
@@ -5,7 +5,7 @@ import { t as compactJson } from "./compact-json-DK2nX-MK.mjs";
5
5
  import { n as projectRoot, r as projectRootOrNull, t as isCodeFile } from "./project-root-ff0_poWU.mjs";
6
6
  import { n as detectMode, r as modeFor, t as detectHarness } from "./harness-C8Nxxyn_.mjs";
7
7
  import { n as detectProjectType, r as isApexCommand, t as DEV_KEYWORDS } from "./policy-EuVJ_5hS.mjs";
8
- import { C as PROJECT_INSTALL, D as evaluateFileSize, E as countLines, O as detectFramework, S as GIT_BLOCKED, T as matchPatterns, _ as protectedPathGuard, a as GO_DECL_RE, b as securityGuard, c as PY_MODEL_RE, d as interfaceSeparationGuard, f as ASK_WRITERS, g as PROTECTED_FRAGMENTS, h as bashWriteGuard, i as installGuard, l as SWIFT_PROTO_RE, m as CODE_REDIRECT, n as GUARDS, o as JAVA_DECL_RE, p as CODE_MUTATORS, r as runGuards, s as PHP_DECL_RE, t as evaluate, u as TS_DECL_RE, v as ASK_PATTERNS, w as SYSTEM_INSTALL, x as GIT_ASK, y as CRITICAL_PATTERNS } from "./evaluate-BmPDUtND.mjs";
8
+ import { C as PROJECT_INSTALL, D as evaluateFileSize, E as countLines, O as detectFramework, S as GIT_BLOCKED, T as matchPatterns, _ as protectedPathGuard, a as GO_DECL_RE, b as securityGuard, c as PY_MODEL_RE, d as interfaceSeparationGuard, f as ASK_WRITERS, g as PROTECTED_FRAGMENTS, h as bashWriteGuard, i as installGuard, l as SWIFT_PROTO_RE, m as CODE_REDIRECT, n as GUARDS, o as JAVA_DECL_RE, p as CODE_MUTATORS, r as runGuards, s as PHP_DECL_RE, t as evaluate, u as TS_DECL_RE, v as ASK_PATTERNS, w as SYSTEM_INSTALL, x as GIT_ASK, y as CRITICAL_PATTERNS } from "./evaluate-CpBKZ6G-.mjs";
9
9
  import { i as resolveSessions, n as formatDocSatisfactionStatus, r as isDocConsulted, t as formatDocDeny } from "./doc-helpers-Dd_x1-tZ.mjs";
10
10
  import { i as parseFrontmatter, n as scoreReferences, r as globToRe, t as routeReferences } from "./router-Dj3AfgBE.mjs";
11
11
  import { a as APEX_GATES, c as evaluateApex, i as detectCreationIntent, l as freshnessGate, n as MAX_TOKENS, o as brainstormGate, r as capVerbosity, s as docConsultedGate, t as MAX_EXA_RESULTS, u as solidReadGate } from "./verbosity-D82yP4WD.mjs";
@@ -1,2 +1,2 @@
1
- import { A as docConsultedGate, B as SYSTEM_INSTALL, C as securityGuard, D as ApexContext, E as APEX_GATES, F as PolicyResult, G as detectFramework, H as FileSizeVerdict, I as evaluate, J as detectProjectType, K as DEV_KEYWORDS, L as GIT_ASK, M as freshnessGate, N as solidReadGate, O as ApexGate, P as PolicyContext, R as GIT_BLOCKED, S as CRITICAL_PATTERNS, T as GuardContext, U as countLines, V as matchPatterns, W as evaluateFileSize, Y as isApexCommand, _ as CODE_REDIRECT, a as GUARDS, b as protectedPathGuard, c as GO_DECL_RE, d as PY_MODEL_RE, f as SWIFT_PROTO_RE, g as CODE_MUTATORS, h as ASK_WRITERS, i as detectCreationIntent, j as evaluateApex, k as brainstormGate, l as JAVA_DECL_RE, m as interfaceSeparationGuard, n as MAX_TOKENS, o as runGuards, p as TS_DECL_RE, q as ProjectType, r as capVerbosity, s as installGuard, t as MAX_EXA_RESULTS, u as PHP_DECL_RE, v as bashWriteGuard, w as Guard, x as ASK_PATTERNS, y as PROTECTED_FRAGMENTS, z as PROJECT_INSTALL } from "../index-Dz55GnvV.mjs";
1
+ import { A as docConsultedGate, B as SYSTEM_INSTALL, C as securityGuard, D as ApexContext, E as APEX_GATES, F as PolicyResult, G as detectFramework, H as FileSizeVerdict, I as evaluate, J as detectProjectType, K as DEV_KEYWORDS, L as GIT_ASK, M as freshnessGate, N as solidReadGate, O as ApexGate, P as PolicyContext, R as GIT_BLOCKED, S as CRITICAL_PATTERNS, T as GuardContext, U as countLines, V as matchPatterns, W as evaluateFileSize, Y as isApexCommand, _ as CODE_REDIRECT, a as GUARDS, b as protectedPathGuard, c as GO_DECL_RE, d as PY_MODEL_RE, f as SWIFT_PROTO_RE, g as CODE_MUTATORS, h as ASK_WRITERS, i as detectCreationIntent, j as evaluateApex, k as brainstormGate, l as JAVA_DECL_RE, m as interfaceSeparationGuard, n as MAX_TOKENS, o as runGuards, p as TS_DECL_RE, q as ProjectType, r as capVerbosity, s as installGuard, t as MAX_EXA_RESULTS, u as PHP_DECL_RE, v as bashWriteGuard, w as Guard, x as ASK_PATTERNS, y as PROTECTED_FRAGMENTS, z as PROJECT_INSTALL } from "../index-oco-cH5T.mjs";
2
2
  export { APEX_GATES, ASK_PATTERNS, ASK_WRITERS, ApexContext, ApexGate, CODE_MUTATORS, CODE_REDIRECT, CRITICAL_PATTERNS, DEV_KEYWORDS, FileSizeVerdict, GIT_ASK, GIT_BLOCKED, GO_DECL_RE, GUARDS, Guard, GuardContext, JAVA_DECL_RE, MAX_EXA_RESULTS, MAX_TOKENS, PHP_DECL_RE, PROJECT_INSTALL, PROTECTED_FRAGMENTS, PY_MODEL_RE, PolicyContext, PolicyResult, ProjectType, SWIFT_PROTO_RE, SYSTEM_INSTALL, TS_DECL_RE, bashWriteGuard, brainstormGate, capVerbosity, countLines, detectCreationIntent, detectFramework, detectProjectType, docConsultedGate, evaluate, evaluateApex, evaluateFileSize, freshnessGate, installGuard, interfaceSeparationGuard, isApexCommand, matchPatterns, protectedPathGuard, runGuards, securityGuard, solidReadGate };
@@ -1,4 +1,4 @@
1
1
  import { n as detectProjectType, r as isApexCommand, t as DEV_KEYWORDS } from "../policy-EuVJ_5hS.mjs";
2
- import { C as PROJECT_INSTALL, D as evaluateFileSize, E as countLines, O as detectFramework, S as GIT_BLOCKED, T as matchPatterns, _ as protectedPathGuard, a as GO_DECL_RE, b as securityGuard, c as PY_MODEL_RE, d as interfaceSeparationGuard, f as ASK_WRITERS, g as PROTECTED_FRAGMENTS, h as bashWriteGuard, i as installGuard, l as SWIFT_PROTO_RE, m as CODE_REDIRECT, n as GUARDS, o as JAVA_DECL_RE, p as CODE_MUTATORS, r as runGuards, s as PHP_DECL_RE, t as evaluate, u as TS_DECL_RE, v as ASK_PATTERNS, w as SYSTEM_INSTALL, x as GIT_ASK, y as CRITICAL_PATTERNS } from "../evaluate-BmPDUtND.mjs";
2
+ import { C as PROJECT_INSTALL, D as evaluateFileSize, E as countLines, O as detectFramework, S as GIT_BLOCKED, T as matchPatterns, _ as protectedPathGuard, a as GO_DECL_RE, b as securityGuard, c as PY_MODEL_RE, d as interfaceSeparationGuard, f as ASK_WRITERS, g as PROTECTED_FRAGMENTS, h as bashWriteGuard, i as installGuard, l as SWIFT_PROTO_RE, m as CODE_REDIRECT, n as GUARDS, o as JAVA_DECL_RE, p as CODE_MUTATORS, r as runGuards, s as PHP_DECL_RE, t as evaluate, u as TS_DECL_RE, v as ASK_PATTERNS, w as SYSTEM_INSTALL, x as GIT_ASK, y as CRITICAL_PATTERNS } from "../evaluate-CpBKZ6G-.mjs";
3
3
  import { a as APEX_GATES, c as evaluateApex, i as detectCreationIntent, l as freshnessGate, n as MAX_TOKENS, o as brainstormGate, r as capVerbosity, s as docConsultedGate, t as MAX_EXA_RESULTS, u as solidReadGate } from "../verbosity-D82yP4WD.mjs";
4
4
  export { APEX_GATES, ASK_PATTERNS, ASK_WRITERS, CODE_MUTATORS, CODE_REDIRECT, CRITICAL_PATTERNS, DEV_KEYWORDS, GIT_ASK, GIT_BLOCKED, GO_DECL_RE, GUARDS, JAVA_DECL_RE, MAX_EXA_RESULTS, MAX_TOKENS, PHP_DECL_RE, PROJECT_INSTALL, PROTECTED_FRAGMENTS, PY_MODEL_RE, SWIFT_PROTO_RE, SYSTEM_INSTALL, TS_DECL_RE, bashWriteGuard, brainstormGate, capVerbosity, countLines, detectCreationIntent, detectFramework, detectProjectType, docConsultedGate, evaluate, evaluateApex, evaluateFileSize, freshnessGate, installGuard, interfaceSeparationGuard, isApexCommand, matchPatterns, protectedPathGuard, runGuards, securityGuard, solidReadGate };
@@ -1,5 +1,5 @@
1
1
  import { t as isCodeFile } from "./project-root-ff0_poWU.mjs";
2
- import { t as evaluate } from "./evaluate-BmPDUtND.mjs";
2
+ import { t as evaluate } from "./evaluate-CpBKZ6G-.mjs";
3
3
  import { t as formatPrompt } from "./types-ernB1Dy3.mjs";
4
4
  import { execSync } from "node:child_process";
5
5
  //#region src/cli/run.ts
@@ -73,6 +73,7 @@ interface GateInput {
73
73
  trackFile: string;
74
74
  windowMs?: number;
75
75
  isReplaceAll?: boolean;
76
+ agentType?: string;
76
77
  }
77
78
  /**
78
79
  * Full gate: the stateless guards (file-size, git, security...) first, then a
@@ -91,6 +92,8 @@ interface NormalizedEvent {
91
92
  filePath?: string;
92
93
  content?: string;
93
94
  command?: string;
95
+ /** Subagent type, if the tool-use came from one (Explore/Plan are file-size-exempt). */
96
+ agentType?: string;
94
97
  }
95
98
  /**
96
99
  * Normalize a harness hook payload into a uniform event. Handles Cline's nested
@@ -114,12 +117,17 @@ declare const MCP_TTL_MS = 1728e5;
114
117
  declare function isMcpTool(tool: string): boolean;
115
118
  /** The query/url that keys the cache. */
116
119
  declare function queryOf(input: Record<string, unknown>): string;
120
+ /** A pre-event MCP interception: the native response + any doc source it satisfied. */
121
+ interface McpIntercept {
122
+ stdout: string;
123
+ docSource?: string;
124
+ }
117
125
  /**
118
126
  * Pre-event MCP interception: serve a fresh cache hit (deny + cached content),
119
127
  * else cap exa verbosity (allow + mutated input), else null to allow normally.
120
128
  * Harnesses without input-mutation/cache support fall through to null.
121
129
  */
122
- declare function mcpPreIntercept(id: string, tool: string, input: Record<string, unknown>, dir: string, ttlMs: number, now: number): string | null;
130
+ declare function mcpPreIntercept(id: string, tool: string, input: Record<string, unknown>, dir: string, ttlMs: number, now: number): McpIntercept | null;
123
131
  /** Post-event: store the MCP/WebFetch response (extracted to markdown) in the cache. */
124
132
  declare function mcpPostStore(tool: string, input: Record<string, unknown>, response: unknown, dir: string): void;
125
133
  //#endregion
@@ -146,4 +154,4 @@ interface HandleOutcome {
146
154
  */
147
155
  declare function handleHook(id: string, payload: Record<string, unknown>, opts: HandleOptions): Promise<HandleOutcome>;
148
156
  //#endregion
149
- export { Activity, DEFAULT_WINDOW_MS, GateInput, HandleOptions, HandleOutcome, MCP_TTL_MS, NormalizedEvent, REQUIRED_AGENTS, TRIVIAL_BUDGET, ToolEvent, activityFor, gate, handleHook, harnessStateDir, isMcpTool, mcpPostStore, mcpPreIntercept, normalizeEvent, queryOf, recordActivity, respond, trackFile };
157
+ export { Activity, DEFAULT_WINDOW_MS, GateInput, HandleOptions, HandleOutcome, MCP_TTL_MS, McpIntercept, NormalizedEvent, REQUIRED_AGENTS, TRIVIAL_BUDGET, ToolEvent, activityFor, gate, handleHook, harnessStateDir, isMcpTool, mcpPostStore, mcpPreIntercept, normalizeEvent, queryOf, recordActivity, respond, trackFile };
@@ -1,5 +1,5 @@
1
1
  import { r as projectLayout } from "../layout-C0jaaCQC.mjs";
2
- import { a as normalizeEvent, c as mcpPostStore, d as DEFAULT_WINDOW_MS, f as REQUIRED_AGENTS, h as activityFor, i as trackFile, l as mcpPreIntercept, m as gate, n as respond, o as MCP_TTL_MS, p as TRIVIAL_BUDGET, r as recordActivity, s as isMcpTool, t as handleHook, u as queryOf } from "../handle-BycRtJ0S.mjs";
2
+ import { a as normalizeEvent, c as mcpPostStore, d as DEFAULT_WINDOW_MS, f as REQUIRED_AGENTS, h as activityFor, i as trackFile, l as mcpPreIntercept, m as gate, n as respond, o as MCP_TTL_MS, p as TRIVIAL_BUDGET, r as recordActivity, s as isMcpTool, t as handleHook, u as queryOf } from "../handle-DYF2Fju8.mjs";
3
3
  //#region src/runtime/storage.ts
4
4
  /**
5
5
  * The project's single state dir (`<root>/.harness`) — neutral + harness-agnostic,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fusengine/harness",
3
- "version": "0.1.17",
3
+ "version": "0.1.19",
4
4
  "description": "Harness-agnostic toolkit for AI coding agents: runtime harness detection (Claude Code, Codex, Cursor, Cline, Gemini, Aider...), pure policy core (env config, project/framework detection, SOLID/file-size limits, APEX freshness, guard patterns, portable prompts), cache, project memory, ref routing, state/locks, statusline, per-harness adapters (Claude/Cursor/Cline/Gemini) and a cli-mode harness-check binary. Bun-native, with a built dist for Node + bundlers.",
5
5
  "type": "module",
6
6
  "module": "src/index.ts",