@fusengine/harness 0.1.16 → 0.1.18

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-0DB5pb4d.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-urGmc24B.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-0DB5pb4d.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-urGmc24B.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-urGmc24B.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-urGmc24B.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-CsWHdBJp.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-Sq-byRft.mjs";
6
+ import { t as handleHook } from "../handle-SPlcCQYl.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-CsWHdBJp.mjs";
1
+ import { n as stagedContent, r as stagedFiles, t as checkStaged } from "../run-_Cy9-Tgv.mjs";
2
2
  export { checkStaged, stagedContent, stagedFiles };
@@ -74,7 +74,10 @@ const GIT_ASK = [
74
74
  /git mv/,
75
75
  /git restore/,
76
76
  /git revert/,
77
- /git cherry-pick/
77
+ /git cherry-pick/,
78
+ /git commit/,
79
+ /git add/,
80
+ /git branch -d/
78
81
  ];
79
82
  /** System-level package installs (need confirmation). */
80
83
  const SYSTEM_INSTALL = [
@@ -115,7 +118,12 @@ const CRITICAL_PATTERNS = [
115
118
  /\b(?:curl|wget)\b[^|]*\|\s*(?:sudo\s+)?(?:ba|z|da|k)?sh\b/,
116
119
  /\bchmod\s+(?:-[a-zA-Z]+\s+)*777\s+\//,
117
120
  /\bmkfs(?:\.[a-z0-9]+)?\b/,
118
- /\bdd\b[^\n]*\bif=\/dev\/zero\b[^\n]*\bof=\/dev\//
121
+ /\bdd\b[^\n]*\bif=\/dev\/zero\b[^\n]*\bof=\/dev\//,
122
+ /\bshred\b/,
123
+ /\bfdisk\b/,
124
+ /\bdiskutil\s+(?:erase|partitionDisk)/i,
125
+ /(?:>|>>)\s*\/dev\/(?:sda|hda|nvme)/,
126
+ /\brm\s+(?:-[a-z]*\s+)*-[a-z]*[rf][a-z]*\s+(?:-[a-z]+\s+)*\/(?:etc|usr|var|bin|sbin|boot|lib)\b/
119
127
  ];
120
128
  /** Patterns that warrant explicit confirmation before running. */
121
129
  const ASK_PATTERNS = [
@@ -123,7 +131,12 @@ const ASK_PATTERNS = [
123
131
  /\bchmod\s+(?:-[a-zA-Z]+\s+)*777\b/,
124
132
  /\bchown\s+-R\b/,
125
133
  /\beval\s/,
126
- /(?:>|>>|\btee\b)\s*\/etc\//
134
+ /(?:>|>>|\btee\b)\s*\/etc\//,
135
+ /\bsu\s/,
136
+ /\bdoas\s/,
137
+ /\bpasswd\b/,
138
+ /\brm\s/,
139
+ /\bunlink\s/
127
140
  ];
128
141
  /** Guards against dangerous Bash commands (critical → block, sensitive → ask). */
129
142
  function securityGuard(ctx) {
@@ -206,6 +219,10 @@ const PY_MODEL_RE = /^\s*class\s+\w+\((BaseModel|TypedDict|Protocol)\)/m;
206
219
  const PHP_DECL_RE = /^\s*(interface|abstract class)\b/m;
207
220
  /** Swift views: top-level `protocol Foo`. */
208
221
  const SWIFT_PROTO_RE = /^\s*protocol\s+[A-Z]/m;
222
+ /** Go handlers/controllers: top-level `type Foo interface`. */
223
+ const GO_DECL_RE = /^\s*type\s+[A-Z]\w*\s+interface\b/m;
224
+ /** Java/Kotlin controllers/handlers: top-level `interface`/`record`. */
225
+ const JAVA_DECL_RE = /^\s*(?:public\s+|private\s+|protected\s+|internal\s+)?(?:interface|record)\s+[A-Z]/m;
209
226
  /**
210
227
  * Blocks top-level interface/type/protocol declarations in component, view or
211
228
  * controller files (Interface Segregation). Fires only when BOTH the path
@@ -222,10 +239,13 @@ function interfaceSeparationGuard(ctx) {
222
239
  reason: "Top-level interface/type/protocol declarations belong in their own file, not in a component/view/controller.",
223
240
  actions: ["Move the interface/type to its own file (Interface Segregation)"]
224
241
  };
242
+ const inAny = (...frags) => frags.some((f) => path.includes(f));
225
243
  if (/\.(tsx|jsx|vue|svelte)$/.test(path) && TS_DECL_RE.test(content)) return block;
226
- if (path.includes("views/") && /\.py$/.test(path) && PY_MODEL_RE.test(content)) return block;
227
- if (path.includes("Controllers/") && /\.php$/.test(path) && PHP_DECL_RE.test(content)) return block;
228
- if (path.includes("Views/") && /\.swift$/.test(path) && SWIFT_PROTO_RE.test(content)) return block;
244
+ if (/\.py$/.test(path) && inAny("views/", "controllers/", "routes/") && PY_MODEL_RE.test(content)) return block;
245
+ if (/\.go$/.test(path) && inAny("handlers/", "controllers/") && GO_DECL_RE.test(content)) return block;
246
+ if (/\.(java|kt)$/.test(path) && inAny("controllers/", "handlers/") && JAVA_DECL_RE.test(content)) return block;
247
+ if (/\.php$/.test(path) && inAny("Controllers/", "Handlers/") && PHP_DECL_RE.test(content)) return block;
248
+ if (/\.swift$/.test(path) && inAny("Views/", "Components/") && SWIFT_PROTO_RE.test(content)) return block;
229
249
  return null;
230
250
  }
231
251
  //#endregion
@@ -296,9 +316,11 @@ function evaluate(ctx) {
296
316
  actions: ["Approve if this git operation is intended"]
297
317
  }
298
318
  };
299
- if (ctx.filePath && isCodeFile(ctx.filePath) && ctx.content !== void 0) {
300
- const verdict = evaluateFileSize(countLines(ctx.content), ctx.maxLines);
301
- 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 {
302
324
  decision: "deny",
303
325
  message: verdict.message,
304
326
  prompt: {
@@ -308,7 +330,7 @@ function evaluate(ctx) {
308
330
  actions: [`Split into modules under ${verdict.max} lines (Single Responsibility)`, "Then re-run the write"]
309
331
  },
310
332
  meta: {
311
- framework: detectFramework(ctx.filePath, ctx.content),
333
+ framework: detectFramework(ctx.filePath, ctx.content ?? ""),
312
334
  lines: verdict.lines,
313
335
  max: verdict.max
314
336
  }
@@ -320,4 +342,4 @@ function evaluate(ctx) {
320
342
  };
321
343
  }
322
344
  //#endregion
323
- export { matchPatterns as C, detectFramework as E, SYSTEM_INSTALL as S, evaluateFileSize as T, CRITICAL_PATTERNS as _, PHP_DECL_RE as a, GIT_BLOCKED as b, TS_DECL_RE as c, CODE_MUTATORS as d, CODE_REDIRECT as f, ASK_PATTERNS as g, protectedPathGuard as h, installGuard as i, interfaceSeparationGuard as l, PROTECTED_FRAGMENTS as m, GUARDS as n, PY_MODEL_RE as o, bashWriteGuard as p, runGuards as r, SWIFT_PROTO_RE as s, evaluate as t, ASK_WRITERS as u, securityGuard as v, countLines as w, PROJECT_INSTALL as x, GIT_ASK as y };
345
+ export { PROJECT_INSTALL as C, evaluateFileSize as D, countLines as E, detectFramework as O, GIT_BLOCKED as S, matchPatterns as T, protectedPathGuard as _, GO_DECL_RE as a, securityGuard as b, PY_MODEL_RE as c, interfaceSeparationGuard as d, ASK_WRITERS as f, PROTECTED_FRAGMENTS as g, bashWriteGuard as h, installGuard as i, SWIFT_PROTO_RE as l, CODE_REDIRECT as m, GUARDS as n, JAVA_DECL_RE as o, CODE_MUTATORS as p, runGuards as r, PHP_DECL_RE as s, evaluate as t, TS_DECL_RE as u, ASK_PATTERNS as v, SYSTEM_INSTALL as w, GIT_ASK as x, CRITICAL_PATTERNS as y };
@@ -1,11 +1,12 @@
1
1
  import { r as projectLayout } from "./layout-C0jaaCQC.mjs";
2
- import { E as detectFramework, t as evaluate } from "./evaluate-urGmc24B.mjs";
3
- import { n as capVerbosity, r as detectCreationIntent, s as evaluateApex } from "./verbosity-BqM4C7_V.mjs";
2
+ import { O as detectFramework, t as evaluate } from "./evaluate-CpBKZ6G-.mjs";
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;
@@ -188,7 +200,8 @@ function normalizeEvent(id, payload) {
188
200
  sessionId: str(payload.session_id) ?? str(payload.conversation_id) ?? "",
189
201
  filePath: str(input.file_path) ?? str(input.path) ?? str(payload.file_path),
190
202
  content: str(input.content) ?? str(input.new_string),
191
- command: str(input.command) ?? str(payload.command)
203
+ command: str(input.command) ?? str(payload.command),
204
+ agentType: str(payload.agent_type) ?? str(input.subagent_type)
192
205
  };
193
206
  }
194
207
  //#endregion
@@ -291,6 +304,7 @@ async function handleHook(id, payload, opts) {
291
304
  command: event.command,
292
305
  refs: opts.refsDir ? await loadRefs(opts.refsDir) : void 0,
293
306
  isReplaceAll: event.input.replace_all === true,
307
+ agentType: event.agentType,
294
308
  windowMs: opts.windowMs,
295
309
  now: opts.now,
296
310
  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 {
@@ -169,6 +173,10 @@ declare const PY_MODEL_RE: RegExp;
169
173
  declare const PHP_DECL_RE: RegExp;
170
174
  /** Swift views: top-level `protocol Foo`. */
171
175
  declare const SWIFT_PROTO_RE: RegExp;
176
+ /** Go handlers/controllers: top-level `type Foo interface`. */
177
+ declare const GO_DECL_RE: RegExp;
178
+ /** Java/Kotlin controllers/handlers: top-level `interface`/`record`. */
179
+ declare const JAVA_DECL_RE: RegExp;
172
180
  /**
173
181
  * Blocks top-level interface/type/protocol declarations in component, view or
174
182
  * controller files (Interface Segregation). Fires only when BOTH the path
@@ -197,10 +205,13 @@ declare function detectCreationIntent(prompt: string): boolean;
197
205
  //#region src/policy/verbosity.d.ts
198
206
  /** Max results an exa MCP call may request. */
199
207
  declare const MAX_EXA_RESULTS = 3;
208
+ /** Max token budget for exa `tokensNum` / context7 `tokens`. */
209
+ declare const MAX_TOKENS = 2e3;
200
210
  /**
201
- * Cap an exa MCP call to {@link MAX_EXA_RESULTS} results. Returns the capped
202
- * input (a mutation for the harness to apply) when a cap is needed, else null.
211
+ * Cap an MCP call's verbosity exa `numResults` 3 (+ `tokensNum` ≤ 2000),
212
+ * Context7 `tokens` 2000. Returns the capped input (a mutation for the harness
213
+ * to apply) when a change is needed, else null.
203
214
  */
204
215
  declare function capVerbosity(tool: string, input: Record<string, unknown>): Record<string, unknown> | null;
205
216
  //#endregion
206
- export { solidReadGate as A, countLines as B, APEX_GATES as C, docConsultedGate as D, brainstormGate as E, GIT_BLOCKED as F, detectProjectType as G, detectFramework as H, PROJECT_INSTALL as I, isApexCommand as K, SYSTEM_INSTALL as L, PolicyResult as M, evaluate as N, evaluateApex as O, GIT_ASK as P, matchPatterns as R, GuardContext as S, ApexGate as T, DEV_KEYWORDS as U, evaluateFileSize as V, ProjectType as W, protectedPathGuard as _, runGuards as a, securityGuard as b, PY_MODEL_RE as c, interfaceSeparationGuard as d, ASK_WRITERS as f, PROTECTED_FRAGMENTS as g, bashWriteGuard as h, GUARDS as i, PolicyContext as j, freshnessGate as k, SWIFT_PROTO_RE as l, CODE_REDIRECT as m, capVerbosity as n, installGuard as o, CODE_MUTATORS as p, detectCreationIntent as r, PHP_DECL_RE as s, MAX_EXA_RESULTS as t, TS_DECL_RE as u, ASK_PATTERNS as v, ApexContext as w, Guard as x, CRITICAL_PATTERNS as y, FileSizeVerdict as z };
217
+ export { docConsultedGate as A, SYSTEM_INSTALL as B, securityGuard as C, ApexContext as D, APEX_GATES as E, PolicyResult as F, detectFramework as G, FileSizeVerdict as H, evaluate as I, detectProjectType as J, DEV_KEYWORDS as K, GIT_ASK as L, freshnessGate as M, solidReadGate as N, ApexGate as O, PolicyContext as P, GIT_BLOCKED as R, CRITICAL_PATTERNS as S, GuardContext as T, countLines as U, matchPatterns as V, evaluateFileSize as W, isApexCommand as Y, CODE_REDIRECT as _, GUARDS as a, protectedPathGuard as b, GO_DECL_RE as c, PY_MODEL_RE as d, SWIFT_PROTO_RE as f, CODE_MUTATORS as g, ASK_WRITERS as h, detectCreationIntent as i, evaluateApex as j, brainstormGate as k, JAVA_DECL_RE as l, interfaceSeparationGuard as m, MAX_TOKENS as n, runGuards as o, TS_DECL_RE as p, ProjectType as q, capVerbosity as r, installGuard as s, MAX_EXA_RESULTS as t, PHP_DECL_RE as u, bashWriteGuard as v, Guard as w, ASK_PATTERNS as x, PROTECTED_FRAGMENTS as y, PROJECT_INSTALL as z };
package/dist/index.d.mts CHANGED
@@ -5,10 +5,10 @@ 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 solidReadGate, B as countLines, C as APEX_GATES, D as docConsultedGate, E as brainstormGate, F as GIT_BLOCKED, G as detectProjectType, H as detectFramework, I as PROJECT_INSTALL, K as isApexCommand, L as SYSTEM_INSTALL, M as PolicyResult, N as evaluate, O as evaluateApex, P as GIT_ASK, R as matchPatterns, S as GuardContext, T as ApexGate, U as DEV_KEYWORDS, V as evaluateFileSize, W as ProjectType, _ as protectedPathGuard, a as runGuards, b as securityGuard, c as PY_MODEL_RE, d as interfaceSeparationGuard, f as ASK_WRITERS, g as PROTECTED_FRAGMENTS, h as bashWriteGuard, i as GUARDS, j as PolicyContext, k as freshnessGate, l as SWIFT_PROTO_RE, m as CODE_REDIRECT, n as capVerbosity, o as installGuard, p as CODE_MUTATORS, r as detectCreationIntent, s as PHP_DECL_RE, t as MAX_EXA_RESULTS, u as TS_DECL_RE, v as ASK_PATTERNS, w as ApexContext, x as Guard, y as CRITICAL_PATTERNS, z as FileSizeVerdict } from "./index-BKSKTgnV.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";
12
12
  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-CPoF_hLP.mjs";
13
13
  import { _ as TIME_INTERVALS, a as formatCost, c as formatTokens, d as colors, f as progressiveColor, g as PROGRESS_CHARS, h as PROGRESS_BAR_DEFAULTS, i as formatBasename, l as ColorFn, m as GRADIENT_BLOCKS, n as generateGradientBar, o as formatPath, p as COLOR_THRESHOLDS, r as generateProgressBar, s as formatTimeLeft, t as ProgressBarOptions, u as Palette } from "./index-BWK8slRi.mjs";
14
- export { APEX_GATES, ASK_PATTERNS, ASK_WRITERS, ApexContext, ApexGate, ApexState, ApexTask, ApexTaskFile, AuthEntry, CODE_MUTATORS, CODE_REDIRECT, COLOR_THRESHOLDS, CRITICAL_PATTERNS, ColorFn, DEFAULT_MAX_LINES, DEFAULT_TTL_SEC, DEV_KEYWORDS, DocSatisfactionStatus, FileSizeVerdict, GIT_ASK, GIT_BLOCKED, GRADIENT_BLOCKS, GUARDS, Guard, GuardContext, HarnessId, HarnessInfo, HarnessMode, HarnessVia, IndexSummary, MAX_EXA_RESULTS, MAX_LINES_ENV_KEY, PHP_DECL_RE, PROGRESS_BAR_DEFAULTS, PROGRESS_CHARS, PROJECT_INSTALL, PROTECTED_FRAGMENTS, PY_MODEL_RE, Palette, PolicyContext, PolicyResult, ProgressBarOptions, ProjectLayout, ProjectType, Prompt, PromptKind, RefMeta, ReminderState, RouteResult, STATE_GITIGNORE, STATE_ROOT, SWIFT_PROTO_RE, SYSTEM_INSTALL, ScoredRef, TIME_INTERVALS, TS_DECL_RE, TTL_ENV_KEY, acquireLock, addRoot, apexStateDir, bashWriteGuard, brainstormGate, cacheLookup, cachePath, cacheStore, capVerbosity, colors, compactJson, compactMarkdown, countLines, detectCreationIntent, detectFramework, detectHarness, detectMode, detectProjectType, docConsultedGate, ensureMemoryGitignore, ensureStateDir, evaluate, evaluateApex, evaluateFileSize, extractText, formatBasename, formatCost, formatDocDeny, formatDocSatisfactionStatus, formatPath, formatPrompt, formatTimeLeft, formatTokens, freshnessGate, generateGradientBar, generateProgressBar, globToRe, incrementTrivialEditCounter, installGuard, interfaceSeparationGuard, isApexCommand, isCodeFile, isDocConsulted, jaccardSimilar, lessonsFileFor, loadIndex, loadRefs, loadState, matchPatterns, mcpCacheKey, modeFor, nowStamp, parseEnvInt, parseFrontmatter, progressiveColor, projectLayout, projectRoot, projectRootOrNull, protectedPathGuard, queryHash, readRoots, readState, registryFile, resolveMaxLines, resolveSessions, resolveTtlSec, routeReferences, runGuards, saveState, scoreReferences, securityGuard, setStateField, solidReadGate, splitTarget, stateFileFor, stateFilePath, summarizeIndex, taskComplete, taskCreate, taskStart, throttleMs, toRefMeta, ttlLabel };
14
+ export { APEX_GATES, ASK_PATTERNS, ASK_WRITERS, ApexContext, ApexGate, ApexState, ApexTask, ApexTaskFile, AuthEntry, CODE_MUTATORS, CODE_REDIRECT, COLOR_THRESHOLDS, CRITICAL_PATTERNS, ColorFn, DEFAULT_MAX_LINES, DEFAULT_TTL_SEC, DEV_KEYWORDS, DocSatisfactionStatus, FileSizeVerdict, GIT_ASK, GIT_BLOCKED, GO_DECL_RE, GRADIENT_BLOCKS, GUARDS, Guard, GuardContext, HarnessId, HarnessInfo, HarnessMode, HarnessVia, IndexSummary, JAVA_DECL_RE, MAX_EXA_RESULTS, MAX_LINES_ENV_KEY, MAX_TOKENS, PHP_DECL_RE, PROGRESS_BAR_DEFAULTS, PROGRESS_CHARS, PROJECT_INSTALL, PROTECTED_FRAGMENTS, PY_MODEL_RE, Palette, PolicyContext, PolicyResult, ProgressBarOptions, ProjectLayout, ProjectType, Prompt, PromptKind, RefMeta, ReminderState, RouteResult, STATE_GITIGNORE, STATE_ROOT, SWIFT_PROTO_RE, SYSTEM_INSTALL, ScoredRef, TIME_INTERVALS, TS_DECL_RE, TTL_ENV_KEY, acquireLock, addRoot, apexStateDir, bashWriteGuard, brainstormGate, cacheLookup, cachePath, cacheStore, capVerbosity, colors, compactJson, compactMarkdown, countLines, detectCreationIntent, detectFramework, detectHarness, detectMode, detectProjectType, docConsultedGate, ensureMemoryGitignore, ensureStateDir, evaluate, evaluateApex, evaluateFileSize, extractText, formatBasename, formatCost, formatDocDeny, formatDocSatisfactionStatus, formatPath, formatPrompt, formatTimeLeft, formatTokens, freshnessGate, generateGradientBar, generateProgressBar, globToRe, incrementTrivialEditCounter, installGuard, interfaceSeparationGuard, isApexCommand, isCodeFile, isDocConsulted, jaccardSimilar, lessonsFileFor, loadIndex, loadRefs, loadState, matchPatterns, mcpCacheKey, modeFor, nowStamp, parseEnvInt, parseFrontmatter, progressiveColor, projectLayout, projectRoot, projectRootOrNull, protectedPathGuard, queryHash, readRoots, readState, registryFile, resolveMaxLines, resolveSessions, resolveTtlSec, routeReferences, runGuards, saveState, scoreReferences, securityGuard, setStateField, solidReadGate, splitTarget, stateFileFor, stateFilePath, summarizeIndex, taskComplete, taskCreate, taskStart, throttleMs, toRefMeta, ttlLabel };
package/dist/index.mjs CHANGED
@@ -5,10 +5,10 @@ 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 matchPatterns, E as detectFramework, S as SYSTEM_INSTALL, T as evaluateFileSize, _ as CRITICAL_PATTERNS, a as PHP_DECL_RE, b as GIT_BLOCKED, c as TS_DECL_RE, d as CODE_MUTATORS, f as CODE_REDIRECT, g as ASK_PATTERNS, h as protectedPathGuard, i as installGuard, l as interfaceSeparationGuard, m as PROTECTED_FRAGMENTS, n as GUARDS, o as PY_MODEL_RE, p as bashWriteGuard, r as runGuards, s as SWIFT_PROTO_RE, t as evaluate, u as ASK_WRITERS, v as securityGuard, w as countLines, x as PROJECT_INSTALL, y as GIT_ASK } from "./evaluate-urGmc24B.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
- import { a as brainstormGate, c as freshnessGate, i as APEX_GATES, l as solidReadGate, n as capVerbosity, o as docConsultedGate, r as detectCreationIntent, s as evaluateApex, t as MAX_EXA_RESULTS } from "./verbosity-BqM4C7_V.mjs";
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";
12
12
  import { t as formatPrompt } from "./types-ernB1Dy3.mjs";
13
13
  import { a as nowStamp, c as stateFileFor, i as lessonsFileFor, l as throttleMs, n as readRoots, o as readState, r as registryFile, s as setStateField, t as addRoot, u as ensureMemoryGitignore } from "./memory-BkoEbdec.mjs";
14
14
  import { a as queryHash, i as jaccardSimilar, n as summarizeIndex, r as compactMarkdown, t as loadIndex } from "./cache-BzbX-ztL.mjs";
@@ -17,4 +17,4 @@ import { t as incrementTrivialEditCounter } from "./freshness-CezohJHo.mjs";
17
17
  import { n as toRefMeta, t as loadRefs } from "./loader-BephwI8n.mjs";
18
18
  import { a as ensureStateDir, c as stateFilePath, i as apexStateDir, l as acquireLock, n as taskCreate, o as loadState, r as taskStart, s as saveState, t as taskComplete } from "./state-Cs0Y0MG_.mjs";
19
19
  import { a as formatPath, c as colors, d as GRADIENT_BLOCKS, f as PROGRESS_BAR_DEFAULTS, i as formatCost, l as progressiveColor, m as TIME_INTERVALS, n as generateProgressBar, o as formatTimeLeft, p as PROGRESS_CHARS, r as formatBasename, s as formatTokens, t as generateGradientBar, u as COLOR_THRESHOLDS } from "./statusline-D87eUNXl.mjs";
20
- export { APEX_GATES, ASK_PATTERNS, ASK_WRITERS, CODE_MUTATORS, CODE_REDIRECT, COLOR_THRESHOLDS, CRITICAL_PATTERNS, DEFAULT_MAX_LINES, DEFAULT_TTL_SEC, DEV_KEYWORDS, GIT_ASK, GIT_BLOCKED, GRADIENT_BLOCKS, GUARDS, MAX_EXA_RESULTS, MAX_LINES_ENV_KEY, PHP_DECL_RE, PROGRESS_BAR_DEFAULTS, PROGRESS_CHARS, PROJECT_INSTALL, PROTECTED_FRAGMENTS, PY_MODEL_RE, STATE_GITIGNORE, STATE_ROOT, SWIFT_PROTO_RE, SYSTEM_INSTALL, TIME_INTERVALS, TS_DECL_RE, TTL_ENV_KEY, acquireLock, addRoot, apexStateDir, bashWriteGuard, brainstormGate, cacheLookup, cachePath, cacheStore, capVerbosity, colors, compactJson, compactMarkdown, countLines, detectCreationIntent, detectFramework, detectHarness, detectMode, detectProjectType, docConsultedGate, ensureMemoryGitignore, ensureStateDir, evaluate, evaluateApex, evaluateFileSize, extractText, formatBasename, formatCost, formatDocDeny, formatDocSatisfactionStatus, formatPath, formatPrompt, formatTimeLeft, formatTokens, freshnessGate, generateGradientBar, generateProgressBar, globToRe, incrementTrivialEditCounter, installGuard, interfaceSeparationGuard, isApexCommand, isCodeFile, isDocConsulted, jaccardSimilar, lessonsFileFor, loadIndex, loadRefs, loadState, matchPatterns, mcpCacheKey, modeFor, nowStamp, parseEnvInt, parseFrontmatter, progressiveColor, projectLayout, projectRoot, projectRootOrNull, protectedPathGuard, queryHash, readRoots, readState, registryFile, resolveMaxLines, resolveSessions, resolveTtlSec, routeReferences, runGuards, saveState, scoreReferences, securityGuard, setStateField, solidReadGate, splitTarget, stateFileFor, stateFilePath, summarizeIndex, taskComplete, taskCreate, taskStart, throttleMs, toRefMeta, ttlLabel };
20
+ export { APEX_GATES, ASK_PATTERNS, ASK_WRITERS, CODE_MUTATORS, CODE_REDIRECT, COLOR_THRESHOLDS, CRITICAL_PATTERNS, DEFAULT_MAX_LINES, DEFAULT_TTL_SEC, DEV_KEYWORDS, GIT_ASK, GIT_BLOCKED, GO_DECL_RE, GRADIENT_BLOCKS, GUARDS, JAVA_DECL_RE, MAX_EXA_RESULTS, MAX_LINES_ENV_KEY, MAX_TOKENS, PHP_DECL_RE, PROGRESS_BAR_DEFAULTS, PROGRESS_CHARS, PROJECT_INSTALL, PROTECTED_FRAGMENTS, PY_MODEL_RE, STATE_GITIGNORE, STATE_ROOT, SWIFT_PROTO_RE, SYSTEM_INSTALL, TIME_INTERVALS, TS_DECL_RE, TTL_ENV_KEY, acquireLock, addRoot, apexStateDir, bashWriteGuard, brainstormGate, cacheLookup, cachePath, cacheStore, capVerbosity, colors, compactJson, compactMarkdown, countLines, detectCreationIntent, detectFramework, detectHarness, detectMode, detectProjectType, docConsultedGate, ensureMemoryGitignore, ensureStateDir, evaluate, evaluateApex, evaluateFileSize, extractText, formatBasename, formatCost, formatDocDeny, formatDocSatisfactionStatus, formatPath, formatPrompt, formatTimeLeft, formatTokens, freshnessGate, generateGradientBar, generateProgressBar, globToRe, incrementTrivialEditCounter, installGuard, interfaceSeparationGuard, isApexCommand, isCodeFile, isDocConsulted, jaccardSimilar, lessonsFileFor, loadIndex, loadRefs, loadState, matchPatterns, mcpCacheKey, modeFor, nowStamp, parseEnvInt, parseFrontmatter, progressiveColor, projectLayout, projectRoot, projectRootOrNull, protectedPathGuard, queryHash, readRoots, readState, registryFile, resolveMaxLines, resolveSessions, resolveTtlSec, routeReferences, runGuards, saveState, scoreReferences, securityGuard, setStateField, solidReadGate, splitTarget, stateFileFor, stateFilePath, summarizeIndex, taskComplete, taskCreate, taskStart, throttleMs, toRefMeta, ttlLabel };
@@ -1,2 +1,2 @@
1
- import { A as solidReadGate, B as countLines, C as APEX_GATES, D as docConsultedGate, E as brainstormGate, F as GIT_BLOCKED, G as detectProjectType, H as detectFramework, I as PROJECT_INSTALL, K as isApexCommand, L as SYSTEM_INSTALL, M as PolicyResult, N as evaluate, O as evaluateApex, P as GIT_ASK, R as matchPatterns, S as GuardContext, T as ApexGate, U as DEV_KEYWORDS, V as evaluateFileSize, W as ProjectType, _ as protectedPathGuard, a as runGuards, b as securityGuard, c as PY_MODEL_RE, d as interfaceSeparationGuard, f as ASK_WRITERS, g as PROTECTED_FRAGMENTS, h as bashWriteGuard, i as GUARDS, j as PolicyContext, k as freshnessGate, l as SWIFT_PROTO_RE, m as CODE_REDIRECT, n as capVerbosity, o as installGuard, p as CODE_MUTATORS, r as detectCreationIntent, s as PHP_DECL_RE, t as MAX_EXA_RESULTS, u as TS_DECL_RE, v as ASK_PATTERNS, w as ApexContext, x as Guard, y as CRITICAL_PATTERNS, z as FileSizeVerdict } from "../index-BKSKTgnV.mjs";
2
- export { APEX_GATES, ASK_PATTERNS, ASK_WRITERS, ApexContext, ApexGate, CODE_MUTATORS, CODE_REDIRECT, CRITICAL_PATTERNS, DEV_KEYWORDS, FileSizeVerdict, GIT_ASK, GIT_BLOCKED, GUARDS, Guard, GuardContext, MAX_EXA_RESULTS, 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
+ 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
+ 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 matchPatterns, E as detectFramework, S as SYSTEM_INSTALL, T as evaluateFileSize, _ as CRITICAL_PATTERNS, a as PHP_DECL_RE, b as GIT_BLOCKED, c as TS_DECL_RE, d as CODE_MUTATORS, f as CODE_REDIRECT, g as ASK_PATTERNS, h as protectedPathGuard, i as installGuard, l as interfaceSeparationGuard, m as PROTECTED_FRAGMENTS, n as GUARDS, o as PY_MODEL_RE, p as bashWriteGuard, r as runGuards, s as SWIFT_PROTO_RE, t as evaluate, u as ASK_WRITERS, v as securityGuard, w as countLines, x as PROJECT_INSTALL, y as GIT_ASK } from "../evaluate-urGmc24B.mjs";
3
- import { a as brainstormGate, c as freshnessGate, i as APEX_GATES, l as solidReadGate, n as capVerbosity, o as docConsultedGate, r as detectCreationIntent, s as evaluateApex, t as MAX_EXA_RESULTS } from "../verbosity-BqM4C7_V.mjs";
4
- export { APEX_GATES, ASK_PATTERNS, ASK_WRITERS, CODE_MUTATORS, CODE_REDIRECT, CRITICAL_PATTERNS, DEV_KEYWORDS, GIT_ASK, GIT_BLOCKED, GUARDS, MAX_EXA_RESULTS, 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 };
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
+ 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
+ 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-urGmc24B.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
@@ -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-Sq-byRft.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-SPlcCQYl.mjs";
3
3
  //#region src/runtime/storage.ts
4
4
  /**
5
5
  * The project's single state dir (`<root>/.harness`) — neutral + harness-agnostic,
@@ -65,22 +65,34 @@ function detectCreationIntent(prompt) {
65
65
  }
66
66
  //#endregion
67
67
  //#region src/policy/verbosity.ts
68
- /** Exa MCP tools whose result count is capped (Context7 has no verbosity knob). */
68
+ /** Exa MCP tools whose result count + token budget are capped. */
69
69
  const EXA_TOOLS = /exa__web_search|exa__get_code_context|exa_web_search|exa_get_code_context/i;
70
+ /** Context7 doc tool whose token budget is capped. */
71
+ const CONTEXT7_TOOLS = /context7__query-docs|context7_query-docs|query-docs/i;
70
72
  /** Max results an exa MCP call may request. */
71
73
  const MAX_EXA_RESULTS = 3;
74
+ /** Max token budget for exa `tokensNum` / context7 `tokens`. */
75
+ const MAX_TOKENS = 2e3;
72
76
  /**
73
- * Cap an exa MCP call to {@link MAX_EXA_RESULTS} results. Returns the capped
74
- * input (a mutation for the harness to apply) when a cap is needed, else null.
77
+ * Cap an MCP call's verbosity exa `numResults` 3 (+ `tokensNum` ≤ 2000),
78
+ * Context7 `tokens` 2000. Returns the capped input (a mutation for the harness
79
+ * to apply) when a change is needed, else null.
75
80
  */
76
81
  function capVerbosity(tool, input) {
77
- if (!EXA_TOOLS.test(tool)) return null;
78
- const n = input.numResults;
79
- if (typeof n === "number" && n <= 3) return null;
80
- return {
81
- ...input,
82
- numResults: 3
82
+ const out = { ...input };
83
+ let changed = false;
84
+ const cap = (key, max, force) => {
85
+ const v = out[key];
86
+ if (typeof v === "number" && v > max || force && typeof v !== "number") {
87
+ out[key] = max;
88
+ changed = true;
89
+ }
83
90
  };
91
+ if (EXA_TOOLS.test(tool)) {
92
+ cap("numResults", 3, true);
93
+ cap("tokensNum", MAX_TOKENS, false);
94
+ } else if (CONTEXT7_TOOLS.test(tool)) cap("tokens", MAX_TOKENS, false);
95
+ return changed ? out : null;
84
96
  }
85
97
  //#endregion
86
- export { brainstormGate as a, freshnessGate as c, APEX_GATES as i, solidReadGate as l, capVerbosity as n, docConsultedGate as o, detectCreationIntent as r, evaluateApex as s, MAX_EXA_RESULTS as t };
98
+ export { APEX_GATES as a, evaluateApex as c, detectCreationIntent as i, freshnessGate as l, MAX_TOKENS as n, brainstormGate as o, capVerbosity as r, docConsultedGate as s, MAX_EXA_RESULTS as t, solidReadGate as u };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fusengine/harness",
3
- "version": "0.1.16",
3
+ "version": "0.1.18",
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",