@fusengine/harness 0.1.27 → 0.1.29

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.
@@ -9,6 +9,26 @@ type ProjectType = "nextjs" | "nuxt" | "angular" | "svelte" | "vue" | "react" |
9
9
  declare const DEV_KEYWORDS: RegExp;
10
10
  /** True when the prompt invokes the /apex command. */
11
11
  declare function isApexCommand(prompt: string): boolean;
12
+ /** Modular architecture variants layered on top of the framework. */
13
+ type ModularArchitecture = "fusecore" | "nextjs-modular" | null;
14
+ /**
15
+ * Detect a project-internal modular architecture (a sub-architecture the
16
+ * framework-level {@link detectProjectType} doesn't capture): Fusengine's
17
+ * FuseCore (Laravel) or a `modules/`-based Next.js layout.
18
+ */
19
+ declare function detectModularArchitecture(dir: string): ModularArchitecture;
20
+ /**
21
+ * Resolve the skill a detected modular architecture forces.
22
+ *
23
+ * Ports the Python `check-nextjs-skill.py` / `check-laravel-skill.py` gates:
24
+ * when the project is detected on disk as a modular architecture, a specific
25
+ * skill is required ('solid-nextjs' for nextjs-modular, 'fusecore' for
26
+ * fusecore). Returns `null` when no modular architecture is detected.
27
+ *
28
+ * @param cwd - Project root directory to scan.
29
+ * @returns The forced skill name, or `null` when none applies.
30
+ */
31
+ declare function requiredArchSkill(cwd: string): string | null;
12
32
  /** Detect the project type by scanning config files in `dir`. */
13
33
  declare function detectProjectType(dir: string): ProjectType;
14
34
  //#endregion
@@ -28,7 +48,12 @@ interface FileSizeVerdict {
28
48
  max: number;
29
49
  message: string | null;
30
50
  }
31
- /** Count lines in file content (empty string = 0). */
51
+ /**
52
+ * Count substantive (code-only) lines — blank lines and comment-only lines
53
+ * (`//`, `*`, `/*` block-comment bodies) don't count toward the SOLID limit, so a
54
+ * well-documented file isn't penalized for its JSDoc. (`#` is intentionally NOT
55
+ * skipped: it is code in Rust `#[derive]` and C `#include`, not a comment.)
56
+ */
32
57
  declare function countLines(content: string): number;
33
58
  /**
34
59
  * Evaluate a file's line count against the SOLID limit.
@@ -224,4 +249,48 @@ declare const MAX_TOKENS = 2e3;
224
249
  */
225
250
  declare function capVerbosity(tool: string, input: Record<string, unknown>): Record<string, unknown> | null;
226
251
  //#endregion
227
- export { ApexContext as A, GIT_ASK as B, protectedPathGuard as C, Guard as D, securityGuard as E, freshnessGate as F, FileSizeVerdict as G, PROJECT_INSTALL as H, solidReadGate as I, detectFramework as J, countLines as K, PolicyContext as L, brainstormGate as M, docConsultedGate as N, GuardContext as O, evaluateApex as P, isApexCommand as Q, PolicyResult as R, PROTECTED_FRAGMENTS as S, CRITICAL_PATTERNS as T, SYSTEM_INSTALL as U, GIT_BLOCKED as V, matchPatterns as W, ProjectType as X, DEV_KEYWORDS as Y, detectProjectType as Z, interfaceSeparationGuard as _, FAIL_CLOSED as a, CODE_REDIRECT as b, registerGuard as c, GO_DECL_RE as d, JAVA_DECL_RE as f, TS_DECL_RE as g, SWIFT_PROTO_RE as h, detectCreationIntent as i, ApexGate as j, APEX_GATES as k, runGuards as l, PY_MODEL_RE as m, MAX_TOKENS as n, GUARDS as o, PHP_DECL_RE as p, evaluateFileSize as q, capVerbosity as r, clearUserGuards as s, MAX_EXA_RESULTS as t, installGuard as u, ASK_WRITERS as v, ASK_PATTERNS as w, bashWriteGuard as x, CODE_MUTATORS as y, evaluate as z };
252
+ //#region src/policy/framework-solid.d.ts
253
+ /**
254
+ * Framework-specific SOLID gate. Dispatches by extension/path to the matching
255
+ * validator (React, Next.js, Laravel, Swift) and returns a blocking
256
+ * {@link Prompt} when any BLOCKING rule fires, or `null` when clean. Excluded
257
+ * build/dependency paths (node_modules, dist, build, .next, vendor, .build,
258
+ * DerivedData, Pods) early-return `null` to avoid false positives.
259
+ * @param filePath - absolute path of the file being written/edited
260
+ * @param content - the file (or new) content under validation
261
+ * @param fileLines - full on-disk line count (set on Edit so a partial
262
+ * `new_string` snippet still judges the whole file, mirroring the base
263
+ * file-size guard / Python `get_full_file_content`). Omit on Write.
264
+ */
265
+ declare function frameworkSolidGate(filePath: string, content: string, fileLines?: number): Prompt | null;
266
+ //#endregion
267
+ //#region src/policy/skill-trigger-patterns.d.ts
268
+ /** Map of required sub-skill name → triggering code patterns, keyed by framework. */
269
+ declare const SKILL_TRIGGERS: Readonly<Record<string, Readonly<Record<string, ReadonlyArray<string>>>>>;
270
+ //#endregion
271
+ //#region src/policy/skill-triggers.d.ts
272
+ /**
273
+ * Detect which sub-skills the written `content` requires for a `framework`.
274
+ * Faithful to the Python `detect_required_skills`: first matching pattern per
275
+ * skill wins. Most frameworks match case-insensitively (source `re.IGNORECASE`);
276
+ * `swift` matches case-sensitively (see {@link CASE_SENSITIVE_FRAMEWORKS}).
277
+ * @param framework - "react" | "nextjs" | "laravel" | "swift".
278
+ * @param content - the code being written.
279
+ * @returns required sub-skill names (empty when framework unknown / no match).
280
+ */
281
+ declare function detectRequiredSkills(framework: string, content: string): string[];
282
+ /**
283
+ * Block when a required sub-skill's `skills/<name>/` path is absent from
284
+ * `refsRead`. Mirrors `specific_skill_consulted`, which confirms a skill was
285
+ * read by checking the tracking file contains `skills/<name>/`.
286
+ * @param framework - "react" | "nextjs" | "laravel".
287
+ * @param content - the code being written.
288
+ * @param refsRead - in-session read reference paths.
289
+ * @param forcedSkill - a skill the detected modular architecture forces (optional).
290
+ * @param cwd - project root; when set and not a shadcn project, `*-shadcn`
291
+ * requirements are skipped (ports the Python `is_shadcn_project` filter).
292
+ * @returns a `block` Prompt naming the missing sub-skills, or `null` when satisfied.
293
+ */
294
+ declare function skillTriggerGate(framework: string, content: string, refsRead: string[], forcedSkill?: string | null, cwd?: string): Prompt | null;
295
+ //#endregion
296
+ export { DEV_KEYWORDS as $, securityGuard as A, solidReadGate as B, CODE_MUTATORS as C, protectedPathGuard as D, PROTECTED_FRAGMENTS as E, ApexGate as F, GIT_BLOCKED as G, PolicyResult as H, brainstormGate as I, matchPatterns as J, PROJECT_INSTALL as K, docConsultedGate as L, GuardContext as M, APEX_GATES as N, ASK_PATTERNS as O, ApexContext as P, detectFramework as Q, evaluateApex as R, ASK_WRITERS as S, bashWriteGuard as T, evaluate as U, PolicyContext as V, GIT_ASK as W, countLines as X, FileSizeVerdict as Y, evaluateFileSize as Z, PHP_DECL_RE as _, MAX_EXA_RESULTS as a, requiredArchSkill as at, TS_DECL_RE as b, detectCreationIntent as c, clearUserGuards as d, ModularArchitecture as et, registerGuard as f, JAVA_DECL_RE as g, GO_DECL_RE as h, frameworkSolidGate as i, isApexCommand as it, Guard as j, CRITICAL_PATTERNS as k, FAIL_CLOSED as l, installGuard as m, skillTriggerGate as n, detectModularArchitecture as nt, MAX_TOKENS as o, runGuards as p, SYSTEM_INSTALL as q, SKILL_TRIGGERS as r, detectProjectType as rt, capVerbosity as s, detectRequiredSkills as t, ProjectType as tt, GUARDS as u, PY_MODEL_RE as v, CODE_REDIRECT as w, interfaceSeparationGuard as x, SWIFT_PROTO_RE as y, freshnessGate 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 ApexContext, B as GIT_ASK, C as protectedPathGuard, D as Guard, E as securityGuard, F as freshnessGate, G as FileSizeVerdict, H as PROJECT_INSTALL, I as solidReadGate, J as detectFramework, K as countLines, L as PolicyContext, M as brainstormGate, N as docConsultedGate, O as GuardContext, P as evaluateApex, Q as isApexCommand, R as PolicyResult, S as PROTECTED_FRAGMENTS, T as CRITICAL_PATTERNS, U as SYSTEM_INSTALL, V as GIT_BLOCKED, W as matchPatterns, X as ProjectType, Y as DEV_KEYWORDS, Z as detectProjectType, _ as interfaceSeparationGuard, a as FAIL_CLOSED, b as CODE_REDIRECT, c as registerGuard, d as GO_DECL_RE, f as JAVA_DECL_RE, g as TS_DECL_RE, h as SWIFT_PROTO_RE, i as detectCreationIntent, j as ApexGate, k as APEX_GATES, l as runGuards, m as PY_MODEL_RE, n as MAX_TOKENS, o as GUARDS, p as PHP_DECL_RE, q as evaluateFileSize, r as capVerbosity, s as clearUserGuards, t as MAX_EXA_RESULTS, u as installGuard, v as ASK_WRITERS, w as ASK_PATTERNS, x as bashWriteGuard, y as CODE_MUTATORS, z as evaluate } from "./index-DNAzITvw.mjs";
8
+ import { $ as DEV_KEYWORDS, A as securityGuard, B as solidReadGate, C as CODE_MUTATORS, D as protectedPathGuard, E as PROTECTED_FRAGMENTS, F as ApexGate, G as GIT_BLOCKED, H as PolicyResult, I as brainstormGate, J as matchPatterns, K as PROJECT_INSTALL, L as docConsultedGate, M as GuardContext, N as APEX_GATES, O as ASK_PATTERNS, P as ApexContext, Q as detectFramework, R as evaluateApex, S as ASK_WRITERS, T as bashWriteGuard, U as evaluate, V as PolicyContext, W as GIT_ASK, X as countLines, Y as FileSizeVerdict, Z as evaluateFileSize, _ as PHP_DECL_RE, a as MAX_EXA_RESULTS, at as requiredArchSkill, b as TS_DECL_RE, c as detectCreationIntent, d as clearUserGuards, et as ModularArchitecture, f as registerGuard, g as JAVA_DECL_RE, h as GO_DECL_RE, i as frameworkSolidGate, it as isApexCommand, j as Guard, k as CRITICAL_PATTERNS, l as FAIL_CLOSED, m as installGuard, n as skillTriggerGate, nt as detectModularArchitecture, o as MAX_TOKENS, p as runGuards, q as SYSTEM_INSTALL, r as SKILL_TRIGGERS, rt as detectProjectType, s as capVerbosity, t as detectRequiredSkills, tt as ProjectType, u as GUARDS, v as PY_MODEL_RE, w as CODE_REDIRECT, x as interfaceSeparationGuard, y as SWIFT_PROTO_RE, z as freshnessGate } from "./index-BqdCjaT9.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-DL8MxjuP.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, FAIL_CLOSED, 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, clearUserGuards, 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, registerGuard, 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, FAIL_CLOSED, 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, ModularArchitecture, 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, SKILL_TRIGGERS, 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, clearUserGuards, colors, compactJson, compactMarkdown, countLines, detectCreationIntent, detectFramework, detectHarness, detectMode, detectModularArchitecture, detectProjectType, detectRequiredSkills, docConsultedGate, ensureMemoryGitignore, ensureStateDir, evaluate, evaluateApex, evaluateFileSize, extractText, formatBasename, formatCost, formatDocDeny, formatDocSatisfactionStatus, formatPath, formatPrompt, formatTimeLeft, formatTokens, frameworkSolidGate, 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, registerGuard, registryFile, requiredArchSkill, resolveMaxLines, resolveSessions, resolveTtlSec, routeReferences, runGuards, saveState, scoreReferences, securityGuard, setStateField, skillTriggerGate, solidReadGate, splitTarget, stateFileFor, stateFilePath, summarizeIndex, taskComplete, taskCreate, taskStart, throttleMs, toRefMeta, ttlLabel };
package/dist/index.mjs CHANGED
@@ -4,11 +4,10 @@ import { n as STATE_ROOT, r as projectLayout, t as STATE_GITIGNORE } from "./lay
4
4
  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
- import { n as detectProjectType, r as isApexCommand, t as DEV_KEYWORDS } from "./policy-EuVJ_5hS.mjs";
8
- import { A as evaluateFileSize, C as securityGuard, D as SYSTEM_INSTALL, E as PROJECT_INSTALL, O as matchPatterns, S as CRITICAL_PATTERNS, T as GIT_BLOCKED, _ as CODE_REDIRECT, a as registerGuard, 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 clearUserGuards, j as detectFramework, k as countLines, l as JAVA_DECL_RE, m as interfaceSeparationGuard, n as FAIL_CLOSED, o as runGuards, p as TS_DECL_RE, r as GUARDS, s as installGuard, t as evaluate, u as PHP_DECL_RE, v as bashWriteGuard, w as GIT_ASK, x as ASK_PATTERNS, y as PROTECTED_FRAGMENTS } from "./evaluate-BIK60lOR.mjs";
7
+ import { _ as detectProjectType, a as MAX_EXA_RESULTS, c as detectCreationIntent, d as docConsultedGate, f as evaluateApex, g as detectModularArchitecture, h as DEV_KEYWORDS, i as frameworkSolidGate, l as APEX_GATES, m as solidReadGate, n as skillTriggerGate, o as MAX_TOKENS, p as freshnessGate, r as SKILL_TRIGGERS, s as capVerbosity, t as detectRequiredSkills, u as brainstormGate, v as isApexCommand, y as requiredArchSkill } from "./skill-triggers-BZxov1es.mjs";
8
+ import { A as evaluateFileSize, C as securityGuard, D as SYSTEM_INSTALL, E as PROJECT_INSTALL, O as matchPatterns, S as CRITICAL_PATTERNS, T as GIT_BLOCKED, _ as CODE_REDIRECT, a as registerGuard, 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 clearUserGuards, j as detectFramework, k as countLines, l as JAVA_DECL_RE, m as interfaceSeparationGuard, n as FAIL_CLOSED, o as runGuards, p as TS_DECL_RE, r as GUARDS, s as installGuard, t as evaluate, u as PHP_DECL_RE, v as bashWriteGuard, w as GIT_ASK, x as ASK_PATTERNS, y as PROTECTED_FRAGMENTS } from "./evaluate-j3gRJ_ng.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-D8cVrI-s.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-CXpf3aQQ.mjs";
12
11
  import { t as formatPrompt } from "./types-ernB1Dy3.mjs";
13
12
  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
13
  import { a as queryHash, i as jaccardSimilar, n as summarizeIndex, r as compactMarkdown, t as loadIndex } from "./cache-BzbX-ztL.mjs";
@@ -17,4 +16,4 @@ import { t as incrementTrivialEditCounter } from "./freshness-CezohJHo.mjs";
17
16
  import { n as toRefMeta, t as loadRefs } from "./loader-CyAoJv2W.mjs";
18
17
  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
18
  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, FAIL_CLOSED, 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, clearUserGuards, 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, registerGuard, registryFile, resolveMaxLines, resolveSessions, resolveTtlSec, routeReferences, runGuards, saveState, scoreReferences, securityGuard, setStateField, solidReadGate, splitTarget, stateFileFor, stateFilePath, summarizeIndex, taskComplete, taskCreate, taskStart, throttleMs, toRefMeta, ttlLabel };
19
+ export { APEX_GATES, ASK_PATTERNS, ASK_WRITERS, CODE_MUTATORS, CODE_REDIRECT, COLOR_THRESHOLDS, CRITICAL_PATTERNS, DEFAULT_MAX_LINES, DEFAULT_TTL_SEC, DEV_KEYWORDS, FAIL_CLOSED, 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, SKILL_TRIGGERS, 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, clearUserGuards, colors, compactJson, compactMarkdown, countLines, detectCreationIntent, detectFramework, detectHarness, detectMode, detectModularArchitecture, detectProjectType, detectRequiredSkills, docConsultedGate, ensureMemoryGitignore, ensureStateDir, evaluate, evaluateApex, evaluateFileSize, extractText, formatBasename, formatCost, formatDocDeny, formatDocSatisfactionStatus, formatPath, formatPrompt, formatTimeLeft, formatTokens, frameworkSolidGate, 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, registerGuard, registryFile, requiredArchSkill, resolveMaxLines, resolveSessions, resolveTtlSec, routeReferences, runGuards, saveState, scoreReferences, securityGuard, setStateField, skillTriggerGate, solidReadGate, splitTarget, stateFileFor, stateFilePath, summarizeIndex, taskComplete, taskCreate, taskStart, throttleMs, toRefMeta, ttlLabel };
@@ -1,2 +1,2 @@
1
- import { A as ApexContext, B as GIT_ASK, C as protectedPathGuard, D as Guard, E as securityGuard, F as freshnessGate, G as FileSizeVerdict, H as PROJECT_INSTALL, I as solidReadGate, J as detectFramework, K as countLines, L as PolicyContext, M as brainstormGate, N as docConsultedGate, O as GuardContext, P as evaluateApex, Q as isApexCommand, R as PolicyResult, S as PROTECTED_FRAGMENTS, T as CRITICAL_PATTERNS, U as SYSTEM_INSTALL, V as GIT_BLOCKED, W as matchPatterns, X as ProjectType, Y as DEV_KEYWORDS, Z as detectProjectType, _ as interfaceSeparationGuard, a as FAIL_CLOSED, b as CODE_REDIRECT, c as registerGuard, d as GO_DECL_RE, f as JAVA_DECL_RE, g as TS_DECL_RE, h as SWIFT_PROTO_RE, i as detectCreationIntent, j as ApexGate, k as APEX_GATES, l as runGuards, m as PY_MODEL_RE, n as MAX_TOKENS, o as GUARDS, p as PHP_DECL_RE, q as evaluateFileSize, r as capVerbosity, s as clearUserGuards, t as MAX_EXA_RESULTS, u as installGuard, v as ASK_WRITERS, w as ASK_PATTERNS, x as bashWriteGuard, y as CODE_MUTATORS, z as evaluate } from "../index-DNAzITvw.mjs";
2
- export { APEX_GATES, ASK_PATTERNS, ASK_WRITERS, ApexContext, ApexGate, CODE_MUTATORS, CODE_REDIRECT, CRITICAL_PATTERNS, DEV_KEYWORDS, FAIL_CLOSED, 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, clearUserGuards, countLines, detectCreationIntent, detectFramework, detectProjectType, docConsultedGate, evaluate, evaluateApex, evaluateFileSize, freshnessGate, installGuard, interfaceSeparationGuard, isApexCommand, matchPatterns, protectedPathGuard, registerGuard, runGuards, securityGuard, solidReadGate };
1
+ import { $ as DEV_KEYWORDS, A as securityGuard, B as solidReadGate, C as CODE_MUTATORS, D as protectedPathGuard, E as PROTECTED_FRAGMENTS, F as ApexGate, G as GIT_BLOCKED, H as PolicyResult, I as brainstormGate, J as matchPatterns, K as PROJECT_INSTALL, L as docConsultedGate, M as GuardContext, N as APEX_GATES, O as ASK_PATTERNS, P as ApexContext, Q as detectFramework, R as evaluateApex, S as ASK_WRITERS, T as bashWriteGuard, U as evaluate, V as PolicyContext, W as GIT_ASK, X as countLines, Y as FileSizeVerdict, Z as evaluateFileSize, _ as PHP_DECL_RE, a as MAX_EXA_RESULTS, at as requiredArchSkill, b as TS_DECL_RE, c as detectCreationIntent, d as clearUserGuards, et as ModularArchitecture, f as registerGuard, g as JAVA_DECL_RE, h as GO_DECL_RE, i as frameworkSolidGate, it as isApexCommand, j as Guard, k as CRITICAL_PATTERNS, l as FAIL_CLOSED, m as installGuard, n as skillTriggerGate, nt as detectModularArchitecture, o as MAX_TOKENS, p as runGuards, q as SYSTEM_INSTALL, r as SKILL_TRIGGERS, rt as detectProjectType, s as capVerbosity, t as detectRequiredSkills, tt as ProjectType, u as GUARDS, v as PY_MODEL_RE, w as CODE_REDIRECT, x as interfaceSeparationGuard, y as SWIFT_PROTO_RE, z as freshnessGate } from "../index-BqdCjaT9.mjs";
2
+ export { APEX_GATES, ASK_PATTERNS, ASK_WRITERS, ApexContext, ApexGate, CODE_MUTATORS, CODE_REDIRECT, CRITICAL_PATTERNS, DEV_KEYWORDS, FAIL_CLOSED, FileSizeVerdict, GIT_ASK, GIT_BLOCKED, GO_DECL_RE, GUARDS, Guard, GuardContext, JAVA_DECL_RE, MAX_EXA_RESULTS, MAX_TOKENS, ModularArchitecture, PHP_DECL_RE, PROJECT_INSTALL, PROTECTED_FRAGMENTS, PY_MODEL_RE, PolicyContext, PolicyResult, ProjectType, SKILL_TRIGGERS, SWIFT_PROTO_RE, SYSTEM_INSTALL, TS_DECL_RE, bashWriteGuard, brainstormGate, capVerbosity, clearUserGuards, countLines, detectCreationIntent, detectFramework, detectModularArchitecture, detectProjectType, detectRequiredSkills, docConsultedGate, evaluate, evaluateApex, evaluateFileSize, frameworkSolidGate, freshnessGate, installGuard, interfaceSeparationGuard, isApexCommand, matchPatterns, protectedPathGuard, registerGuard, requiredArchSkill, runGuards, securityGuard, skillTriggerGate, solidReadGate };
@@ -1,4 +1,4 @@
1
- import { n as detectProjectType, r as isApexCommand, t as DEV_KEYWORDS } from "../policy-EuVJ_5hS.mjs";
2
- import { A as evaluateFileSize, C as securityGuard, D as SYSTEM_INSTALL, E as PROJECT_INSTALL, O as matchPatterns, S as CRITICAL_PATTERNS, T as GIT_BLOCKED, _ as CODE_REDIRECT, a as registerGuard, 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 clearUserGuards, j as detectFramework, k as countLines, l as JAVA_DECL_RE, m as interfaceSeparationGuard, n as FAIL_CLOSED, o as runGuards, p as TS_DECL_RE, r as GUARDS, s as installGuard, t as evaluate, u as PHP_DECL_RE, v as bashWriteGuard, w as GIT_ASK, x as ASK_PATTERNS, y as PROTECTED_FRAGMENTS } from "../evaluate-BIK60lOR.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-CXpf3aQQ.mjs";
4
- export { APEX_GATES, ASK_PATTERNS, ASK_WRITERS, CODE_MUTATORS, CODE_REDIRECT, CRITICAL_PATTERNS, DEV_KEYWORDS, FAIL_CLOSED, 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, clearUserGuards, countLines, detectCreationIntent, detectFramework, detectProjectType, docConsultedGate, evaluate, evaluateApex, evaluateFileSize, freshnessGate, installGuard, interfaceSeparationGuard, isApexCommand, matchPatterns, protectedPathGuard, registerGuard, runGuards, securityGuard, solidReadGate };
1
+ import { _ as detectProjectType, a as MAX_EXA_RESULTS, c as detectCreationIntent, d as docConsultedGate, f as evaluateApex, g as detectModularArchitecture, h as DEV_KEYWORDS, i as frameworkSolidGate, l as APEX_GATES, m as solidReadGate, n as skillTriggerGate, o as MAX_TOKENS, p as freshnessGate, r as SKILL_TRIGGERS, s as capVerbosity, t as detectRequiredSkills, u as brainstormGate, v as isApexCommand, y as requiredArchSkill } from "../skill-triggers-BZxov1es.mjs";
2
+ import { A as evaluateFileSize, C as securityGuard, D as SYSTEM_INSTALL, E as PROJECT_INSTALL, O as matchPatterns, S as CRITICAL_PATTERNS, T as GIT_BLOCKED, _ as CODE_REDIRECT, a as registerGuard, 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 clearUserGuards, j as detectFramework, k as countLines, l as JAVA_DECL_RE, m as interfaceSeparationGuard, n as FAIL_CLOSED, o as runGuards, p as TS_DECL_RE, r as GUARDS, s as installGuard, t as evaluate, u as PHP_DECL_RE, v as bashWriteGuard, w as GIT_ASK, x as ASK_PATTERNS, y as PROTECTED_FRAGMENTS } from "../evaluate-j3gRJ_ng.mjs";
3
+ import "../policy-la_KkjCS.mjs";
4
+ export { APEX_GATES, ASK_PATTERNS, ASK_WRITERS, CODE_MUTATORS, CODE_REDIRECT, CRITICAL_PATTERNS, DEV_KEYWORDS, FAIL_CLOSED, 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, SKILL_TRIGGERS, SWIFT_PROTO_RE, SYSTEM_INSTALL, TS_DECL_RE, bashWriteGuard, brainstormGate, capVerbosity, clearUserGuards, countLines, detectCreationIntent, detectFramework, detectModularArchitecture, detectProjectType, detectRequiredSkills, docConsultedGate, evaluate, evaluateApex, evaluateFileSize, frameworkSolidGate, freshnessGate, installGuard, interfaceSeparationGuard, isApexCommand, matchPatterns, protectedPathGuard, registerGuard, requiredArchSkill, runGuards, securityGuard, skillTriggerGate, solidReadGate };
@@ -0,0 +1 @@
1
+ export {};
@@ -1,5 +1,5 @@
1
1
  import { t as isCodeFile } from "./project-root-ff0_poWU.mjs";
2
- import { t as evaluate } from "./evaluate-BIK60lOR.mjs";
2
+ import { t as evaluate } from "./evaluate-j3gRJ_ng.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
@@ -53,13 +53,7 @@ interface ToolEvent {
53
53
  */
54
54
  declare function activityFor(event: ToolEvent): Activity | null;
55
55
  //#endregion
56
- //#region src/runtime/gate.d.ts
57
- /** Prior agents the freshness gate requires before a code edit. */
58
- declare const REQUIRED_AGENTS: ReadonlyArray<string>;
59
- /** Default freshness window for {@link REQUIRED_AGENTS} (2 min — matches the plugin's `FUSE_ENFORCE_TTL_SEC` default). */
60
- declare const DEFAULT_WINDOW_MS = 12e4;
61
- /** Trivial edits allowed within the window before the full APEX gates apply. */
62
- declare const TRIVIAL_BUDGET = 4;
56
+ //#region src/runtime/gate-input.d.ts
63
57
  /** A tool-use to gate, plus the session pointers needed for the stateful gates. */
64
58
  interface GateInput {
65
59
  sessionId: string;
@@ -68,6 +62,7 @@ interface GateInput {
68
62
  filePath?: string;
69
63
  content?: string;
70
64
  command?: string;
65
+ cwd?: string;
71
66
  refs?: RefMeta[];
72
67
  now: number;
73
68
  trackFile: string;
@@ -75,6 +70,14 @@ interface GateInput {
75
70
  isReplaceAll?: boolean;
76
71
  agentType?: string;
77
72
  }
73
+ //#endregion
74
+ //#region src/runtime/gate.d.ts
75
+ /** Prior agents the freshness gate requires before a code edit. */
76
+ declare const REQUIRED_AGENTS: ReadonlyArray<string>;
77
+ /** Default freshness window for {@link REQUIRED_AGENTS} (2 min — matches the plugin's `FUSE_ENFORCE_TTL_SEC` default). */
78
+ declare const DEFAULT_WINDOW_MS = 12e4;
79
+ /** Trivial edits allowed within the window before the full APEX gates apply. */
80
+ declare const TRIVIAL_BUDGET = 4;
78
81
  /**
79
82
  * Full gate: the stateless guards (file-size, git, security...) first, then a
80
83
  * trivial-edit fast path, then the stateful APEX gates fed from the session
@@ -82,6 +85,28 @@ interface GateInput {
82
85
  */
83
86
  declare function gate(input: GateInput): Promise<Prompt | null>;
84
87
  //#endregion
88
+ //#region src/runtime/dry.d.ts
89
+ /** Extract long (>12 char) declared symbol names from new file content. */
90
+ declare function extractSymbols(content: string, ext: string): string[];
91
+ /** Verdict from {@link detectDuplication}. */
92
+ interface DuplicationVerdict {
93
+ names: string[];
94
+ duplicates: string[];
95
+ }
96
+ /**
97
+ * Grep the codebase for existing declarations of the symbols a write introduces,
98
+ * honoring module boundaries (cross-`modules/` matches are ignored). Effectful:
99
+ * shells out to `grep`. Fails open (returns no duplicates) on any grep error,
100
+ * timeout, or no-match — matching the original Python hook.
101
+ */
102
+ declare function detectDuplication(filePath: string, content: string, cwd: string): DuplicationVerdict;
103
+ /** Blocking prompt when a Write/Edit re-declares 2+ existing symbols, else null. */
104
+ declare function dryGate(tool: string, filePath: string, content: string | undefined, cwd: string | undefined): Prompt | null;
105
+ //#endregion
106
+ //#region src/runtime/precommit.d.ts
107
+ /** Block a `git commit` when linters fail (effectful: runs eslint/tsc/prettier/ruff, never auto-fixes). */
108
+ declare function preCommitGate(tool: string, command: string | undefined, cwd: string | undefined): Prompt | null;
109
+ //#endregion
85
110
  //#region src/runtime/normalize.d.ts
86
111
  /** A hook event normalized across harnesses. */
87
112
  interface NormalizedEvent {
@@ -154,4 +179,4 @@ interface HandleOutcome {
154
179
  */
155
180
  declare function handleHook(id: string, payload: Record<string, unknown>, opts: HandleOptions): Promise<HandleOutcome>;
156
181
  //#endregion
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 };
182
+ export { Activity, DEFAULT_WINDOW_MS, DuplicationVerdict, type GateInput, HandleOptions, HandleOutcome, MCP_TTL_MS, McpIntercept, NormalizedEvent, REQUIRED_AGENTS, TRIVIAL_BUDGET, ToolEvent, activityFor, detectDuplication, dryGate, extractSymbols, gate, handleHook, harnessStateDir, isMcpTool, mcpPostStore, mcpPreIntercept, normalizeEvent, preCommitGate, 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-BJ2xdeA-.mjs";
2
+ import { _ as dryGate, a as normalizeEvent, c as mcpPostStore, d as DEFAULT_WINDOW_MS, f as REQUIRED_AGENTS, g as detectDuplication, h as preCommitGate, 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, v as extractSymbols, y as activityFor } from "../handle-nu3GYVek.mjs";
3
3
  //#region src/runtime/storage.ts
4
4
  /**
5
5
  * The project's single state dir (`<root>/.harness`) — neutral + harness-agnostic,
@@ -9,4 +9,4 @@ function harnessStateDir(root) {
9
9
  return projectLayout(root).stateDir;
10
10
  }
11
11
  //#endregion
12
- export { DEFAULT_WINDOW_MS, MCP_TTL_MS, REQUIRED_AGENTS, TRIVIAL_BUDGET, activityFor, gate, handleHook, harnessStateDir, isMcpTool, mcpPostStore, mcpPreIntercept, normalizeEvent, queryOf, recordActivity, respond, trackFile };
12
+ export { DEFAULT_WINDOW_MS, MCP_TTL_MS, REQUIRED_AGENTS, TRIVIAL_BUDGET, activityFor, detectDuplication, dryGate, extractSymbols, gate, handleHook, harnessStateDir, isMcpTool, mcpPostStore, mcpPreIntercept, normalizeEvent, preCommitGate, queryOf, recordActivity, respond, trackFile };