@fusengine/harness 0.1.27 → 0.1.28

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-CeNVUGku.mjs";
1
+ import { a as readClaudeInput, i as guard, n as denyResponse, o as toClaudeResponse, r as fileSizeGuard, t as contextResponse } from "../../claude-phC5Uh_W.mjs";
2
2
  export { contextResponse, denyResponse, fileSizeGuard, guard, readClaudeInput, toClaudeResponse };
@@ -1,4 +1,4 @@
1
- import { t as evaluate } from "../../evaluate-BIK60lOR.mjs";
1
+ import { t as evaluate } from "../../evaluate-CFYPF3re.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-CeNVUGku.mjs";
1
+ import { a as readClaudeInput, i as guard, n as denyResponse, t as contextResponse } from "../../claude-phC5Uh_W.mjs";
2
2
  export { contextResponse, denyResponse, guard, readClaudeInput as readCodexInput };
@@ -1,4 +1,4 @@
1
- import { t as evaluate } from "../../evaluate-BIK60lOR.mjs";
1
+ import { t as evaluate } from "../../evaluate-CFYPF3re.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-BIK60lOR.mjs";
1
+ import { t as evaluate } from "../../evaluate-CFYPF3re.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-BIK60lOR.mjs";
1
+ import { t as evaluate } from "./evaluate-CFYPF3re.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-BdcSLer0.mjs";
4
+ import { n as stagedContent, r as stagedFiles, t as checkStaged } from "../run-B8n-H5hA.mjs";
5
5
  import { n as writeInitFile, t as initFor } from "../run-D91N4ul1.mjs";
6
- import { t as handleHook } from "../handle-BJ2xdeA-.mjs";
6
+ import { t as handleHook } from "../handle-DnOw05K8.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-BdcSLer0.mjs";
1
+ import { n as stagedContent, r as stagedFiles, t as checkStaged } from "../run-B8n-H5hA.mjs";
2
2
  export { checkStaged, stagedContent, stagedFiles };
@@ -118,7 +118,7 @@ const CRITICAL_PATTERNS = [
118
118
  /\b(?:curl|wget)\b[^|]*\|\s*(?:sudo\s+)?(?:ba|z|da|k)?sh\b/,
119
119
  /\bchmod\s+(?:-[a-zA-Z]+\s+)*777\s+\//,
120
120
  /\bmkfs(?:\.[a-z0-9]+)?\b/,
121
- /\bdd\b[^\n]*\bof=\/dev\/(?:disk|sd|hd|nvme|mmcblk|vd)/i,
121
+ /\bdd\b[^\n]*\bof=\/dev\/(?:r?disk|sd|hd|nvme|mmcblk|vd|xvd)/i,
122
122
  /\bshred\b/,
123
123
  /\bfdisk\b/,
124
124
  /\bdiskutil\s+(?:erase|partitionDisk)/i,
@@ -139,9 +139,26 @@ const ASK_PATTERNS = [
139
139
  /\bunlink\s/,
140
140
  /\bdel\s/
141
141
  ];
142
- /** Strip heredoc bodies so their content isn't matched as a command (false positives). */
142
+ /**
143
+ * Strip heredoc bodies so their content isn't matched as a command (false positives).
144
+ * Two-phase scan: a backreference-free opener regex finds `<<[-]DELIM`, then the body
145
+ * is cut up to the closing delimiter via `indexOf` — O(n), no catastrophic backtracking.
146
+ */
143
147
  function stripHeredoc(cmd) {
144
- return cmd.replace(/<<-?\s*['"]?(\w+)['"]?[\s\S]*?\n[ \t]*\1\b/g, " ");
148
+ const opener = /<<-?\s*['"]?(\w+)['"]?/g;
149
+ let out = cmd;
150
+ let m;
151
+ while ((m = opener.exec(out)) !== null) {
152
+ const delim = m[1] ?? "";
153
+ const closer = new RegExp(`\\n[ \\t]*${delim}\\b`);
154
+ const rest = out.slice(m.index + m[0].length);
155
+ const hit = closer.exec(rest);
156
+ if (!hit || hit.index === void 0) break;
157
+ const end = m.index + m[0].length + hit.index + hit[0].length;
158
+ out = `${out.slice(0, m.index)} ${out.slice(end)}`;
159
+ opener.lastIndex = m.index;
160
+ }
161
+ return out;
145
162
  }
146
163
  /** Guards against dangerous Bash commands (critical → block, sensitive → ask). */
147
164
  function securityGuard(ctx) {
@@ -1,5 +1,5 @@
1
1
  import { r as projectLayout } from "./layout-C0jaaCQC.mjs";
2
- import { j as detectFramework, n as FAIL_CLOSED, t as evaluate } from "./evaluate-BIK60lOR.mjs";
2
+ import { j as detectFramework, n as FAIL_CLOSED, t as evaluate } from "./evaluate-CFYPF3re.mjs";
3
3
  import { c as evaluateApex, i as detectCreationIntent, r as capVerbosity } from "./verbosity-CXpf3aQQ.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";
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 { 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";
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-CFYPF3re.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
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";
@@ -1,4 +1,4 @@
1
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";
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-CFYPF3re.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-CXpf3aQQ.mjs";
4
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,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-CFYPF3re.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
@@ -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 { 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-DnOw05K8.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.27",
3
+ "version": "0.1.28",
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",