@fusengine/harness 0.1.13 → 0.1.14
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.
- package/README.md +1 -1
- package/dist/adapters/claude/index.mjs +1 -1
- package/dist/adapters/cline/index.mjs +1 -1
- package/dist/adapters/codex/index.mjs +1 -1
- package/dist/adapters/cursor/index.mjs +1 -1
- package/dist/adapters/gemini/index.mjs +1 -1
- package/dist/cache/index.mjs +1 -1
- package/dist/{claude-B3aJwu6O.mjs → claude-BoZuNxXl.mjs} +1 -1
- package/dist/cli/bin.mjs +3 -3
- package/dist/cli/index.mjs +1 -1
- package/dist/config/index.d.mts +2 -2
- package/dist/config/index.mjs +2 -1
- package/dist/{evaluate-DkTgwHNh.mjs → evaluate-qGG2Ul0W.mjs} +1 -1
- package/dist/freshness/index.mjs +1 -1
- package/dist/{freshness-BK9Xg6oG.mjs → freshness-CezohJHo.mjs} +1 -1
- package/dist/{handle-o5np-3T_.mjs → handle-D-DClzB2.mjs} +8 -25
- package/dist/index-C8dk1Alr.d.mts +70 -0
- package/dist/{index-BEM-mQMC.d.mts → index-DLYhervv.d.mts} +3 -1
- package/dist/index.d.mts +3 -3
- package/dist/index.mjs +9 -8
- package/dist/init/index.mjs +1 -1
- package/dist/layout-C0jaaCQC.mjs +30 -0
- package/dist/memory/index.d.mts +2 -2
- package/dist/memory/index.mjs +2 -2
- package/dist/{memory-BVNt4Ary.mjs → memory-BkoEbdec.mjs} +8 -3
- package/dist/policy/index.mjs +2 -2
- package/dist/{run-D2na7Z2Z.mjs → run-B-_9dPR6.mjs} +2 -2
- package/dist/{run-Cdp2Ef9B.mjs → run-D91N4ul1.mjs} +7 -2
- package/dist/runtime/index.d.mts +4 -6
- package/dist/runtime/index.mjs +12 -2
- package/dist/state/index.mjs +1 -1
- package/dist/{state-Bc4wdnCG.mjs → state-Cs0Y0MG_.mjs} +1 -1
- package/dist/{store-gtbP-Bv9.mjs → store-BnHpq2ZB.mjs} +1 -1
- package/dist/tracking/index.mjs +1 -1
- package/dist/util/index.mjs +1 -1
- package/package.json +1 -1
- package/dist/index-B-z0CCiU.d.mts +0 -37
- package/dist/{json-io-RH82El2J.mjs → json-io-xpTDuvtn.mjs} +1 -1
- package/dist/{policy-Djmqxow2.mjs → policy-Cpa5aWek.mjs} +1 -1
- package/dist/{project-root-C4ks_q1G.mjs → project-root-ff0_poWU.mjs} +1 -1
- package/dist/{store-BlaEhjab.mjs → store-DeIsfMg5.mjs} +1 -1
package/README.md
CHANGED
|
@@ -34,7 +34,7 @@ That's it. `init` writes the wiring file for the detected harness
|
|
|
34
34
|
`.gemini/settings.json`, or `.clinerules/hooks/PreToolUse`+`PostToolUse`), each
|
|
35
35
|
pointing at `harness hook <id>`. From then on every tool-use is gated, and the
|
|
36
36
|
session activity (agents run, docs consulted, refs read) is recorded
|
|
37
|
-
automatically under `<harness
|
|
37
|
+
automatically under `<project>/.harness/` (track, cache, memory).
|
|
38
38
|
|
|
39
39
|
### CLI
|
|
40
40
|
|
|
@@ -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-
|
|
1
|
+
import { a as readClaudeInput, i as guard, n as denyResponse, o as toClaudeResponse, r as fileSizeGuard, t as contextResponse } from "../../claude-BoZuNxXl.mjs";
|
|
2
2
|
export { contextResponse, denyResponse, fileSizeGuard, guard, readClaudeInput, toClaudeResponse };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as readClaudeInput, i as guard, n as denyResponse, t as contextResponse } from "../../claude-
|
|
1
|
+
import { a as readClaudeInput, i as guard, n as denyResponse, t as contextResponse } from "../../claude-BoZuNxXl.mjs";
|
|
2
2
|
export { contextResponse, denyResponse, guard, readClaudeInput as readCodexInput };
|
package/dist/cache/index.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { a as queryHash, i as jaccardSimilar, n as summarizeIndex, r as compactMarkdown, t as loadIndex } from "../cache-BzbX-ztL.mjs";
|
|
2
|
-
import { a as extractText, i as mcpCacheKey, n as cachePath, r as cacheStore, t as cacheLookup } from "../store-
|
|
2
|
+
import { a as extractText, i as mcpCacheKey, n as cachePath, r as cacheStore, t as cacheLookup } from "../store-DeIsfMg5.mjs";
|
|
3
3
|
export { cacheLookup, cachePath, cacheStore, compactMarkdown, extractText, jaccardSimilar, loadIndex, mcpCacheKey, queryHash, summarizeIndex };
|
package/dist/cli/bin.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { t as detectHarness } from "../harness-C8Nxxyn_.mjs";
|
|
3
|
-
import { n as stagedContent, r as stagedFiles, t as checkStaged } from "../run-
|
|
4
|
-
import { n as writeInitFile, t as initFor } from "../run-
|
|
5
|
-
import { t as handleHook } from "../handle-
|
|
3
|
+
import { n as stagedContent, r as stagedFiles, t as checkStaged } from "../run-B-_9dPR6.mjs";
|
|
4
|
+
import { n as writeInitFile, t as initFor } from "../run-D91N4ul1.mjs";
|
|
5
|
+
import { t as handleHook } from "../handle-D-DClzB2.mjs";
|
|
6
6
|
//#region src/cli/bin.ts
|
|
7
7
|
/**
|
|
8
8
|
* harness — CLI for @fusengine/harness.
|
package/dist/cli/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as stagedContent, r as stagedFiles, t as checkStaged } from "../run-
|
|
1
|
+
import { n as stagedContent, r as stagedFiles, t as checkStaged } from "../run-B-_9dPR6.mjs";
|
|
2
2
|
export { checkStaged, stagedContent, stagedFiles };
|
package/dist/config/index.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as
|
|
2
|
-
export { DEFAULT_MAX_LINES, DEFAULT_TTL_SEC, MAX_LINES_ENV_KEY, TTL_ENV_KEY, parseEnvInt, resolveMaxLines, resolveTtlSec, splitTarget, ttlLabel };
|
|
1
|
+
import { a as DEFAULT_MAX_LINES, c as splitTarget, d as resolveTtlSec, f as ttlLabel, i as projectLayout, l as DEFAULT_TTL_SEC, n as STATE_GITIGNORE, o as MAX_LINES_ENV_KEY, p as parseEnvInt, r as STATE_ROOT, s as resolveMaxLines, t as ProjectLayout, u as TTL_ENV_KEY } from "../index-C8dk1Alr.mjs";
|
|
2
|
+
export { DEFAULT_MAX_LINES, DEFAULT_TTL_SEC, MAX_LINES_ENV_KEY, ProjectLayout, STATE_GITIGNORE, STATE_ROOT, TTL_ENV_KEY, parseEnvInt, projectLayout, resolveMaxLines, resolveTtlSec, splitTarget, ttlLabel };
|
package/dist/config/index.mjs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import { a as parseEnvInt, i as splitTarget, n as MAX_LINES_ENV_KEY, r as resolveMaxLines, t as DEFAULT_MAX_LINES } from "../limits-CHn8AIL1.mjs";
|
|
2
2
|
import { i as ttlLabel, n as TTL_ENV_KEY, r as resolveTtlSec, t as DEFAULT_TTL_SEC } from "../config-BG55s6HZ.mjs";
|
|
3
|
-
|
|
3
|
+
import { n as STATE_ROOT, r as projectLayout, t as STATE_GITIGNORE } from "../layout-C0jaaCQC.mjs";
|
|
4
|
+
export { DEFAULT_MAX_LINES, DEFAULT_TTL_SEC, MAX_LINES_ENV_KEY, STATE_GITIGNORE, STATE_ROOT, TTL_ENV_KEY, parseEnvInt, projectLayout, resolveMaxLines, resolveTtlSec, splitTarget, ttlLabel };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { i as splitTarget, r as resolveMaxLines } from "./limits-CHn8AIL1.mjs";
|
|
2
|
-
import { t as isCodeFile } from "./project-root-
|
|
2
|
+
import { t as isCodeFile } from "./project-root-ff0_poWU.mjs";
|
|
3
3
|
//#region src/policy/detect-framework.ts
|
|
4
4
|
/**
|
|
5
5
|
* Detect the framework from a file path extension + content patterns.
|
package/dist/freshness/index.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { i as resolveSessions, n as formatDocSatisfactionStatus, r as isDocConsulted, t as formatDocDeny } from "../doc-helpers-Dd_x1-tZ.mjs";
|
|
2
|
-
import { t as incrementTrivialEditCounter } from "../freshness-
|
|
2
|
+
import { t as incrementTrivialEditCounter } from "../freshness-CezohJHo.mjs";
|
|
3
3
|
export { formatDocDeny, formatDocSatisfactionStatus, incrementTrivialEditCounter, isDocConsulted, resolveSessions };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as readJsonFile, r as writeJsonFile, t as ensureDir } from "./json-io-
|
|
1
|
+
import { n as readJsonFile, r as writeJsonFile, t as ensureDir } from "./json-io-xpTDuvtn.mjs";
|
|
2
2
|
import { dirname } from "node:path";
|
|
3
3
|
//#region src/freshness/trivial-edit-counter.ts
|
|
4
4
|
/**
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { r as projectLayout } from "./layout-C0jaaCQC.mjs";
|
|
2
|
+
import { O as detectFramework, t as evaluate } from "./evaluate-qGG2Ul0W.mjs";
|
|
2
3
|
import { n as capVerbosity, o as evaluateApex } from "./verbosity-ZYT7tLCw.mjs";
|
|
3
4
|
import { t as formatPrompt } from "./types-ernB1Dy3.mjs";
|
|
4
|
-
import { a as extractText, r as cacheStore, t as cacheLookup } from "./store-
|
|
5
|
+
import { a as extractText, r as cacheStore, t as cacheLookup } from "./store-DeIsfMg5.mjs";
|
|
5
6
|
import { t as loadRefs } from "./loader-BephwI8n.mjs";
|
|
6
|
-
import { a as recordAgent, c as recordRefRead, l as recordTrivialEdit, n as saveTrack, r as agentsFresh, s as recordDoc, t as loadTrack, u as trivialCount } from "./store-
|
|
7
|
+
import { a as recordAgent, c as recordRefRead, l as recordTrivialEdit, n as saveTrack, r as agentsFresh, s as recordDoc, t as loadTrack, u as trivialCount } from "./store-BnHpq2ZB.mjs";
|
|
7
8
|
import { join } from "node:path";
|
|
8
9
|
import { tmpdir } from "node:os";
|
|
9
10
|
//#region src/runtime/activity.ts
|
|
@@ -229,24 +230,6 @@ function respond(id, prompt) {
|
|
|
229
230
|
}
|
|
230
231
|
}
|
|
231
232
|
//#endregion
|
|
232
|
-
//#region src/runtime/storage.ts
|
|
233
|
-
/** Per-harness config dir (relative to the project root) where state lives. */
|
|
234
|
-
const STATE_DIR = {
|
|
235
|
-
"claude-code": ".claude",
|
|
236
|
-
codex: ".codex",
|
|
237
|
-
cursor: ".cursor",
|
|
238
|
-
"gemini-cli": ".gemini",
|
|
239
|
-
cline: ".clinerules"
|
|
240
|
-
};
|
|
241
|
-
/**
|
|
242
|
-
* Directory where a harness's fuse-harness track files live — under that
|
|
243
|
-
* harness's own config dir (`.claude`, `.codex`, …) so state sits next to its
|
|
244
|
-
* hooks. Falls back to `.fuse-harness` for harnesses without a known config dir.
|
|
245
|
-
*/
|
|
246
|
-
function harnessTrackDir(id, projectRoot) {
|
|
247
|
-
return join(projectRoot, STATE_DIR[id] ?? ".fuse-harness", "harness");
|
|
248
|
-
}
|
|
249
|
-
//#endregion
|
|
250
233
|
//#region src/runtime/handle.ts
|
|
251
234
|
/**
|
|
252
235
|
* The full hook handler: on a PRE event it gates the tool-use (stateless guards
|
|
@@ -256,9 +239,9 @@ function harnessTrackDir(id, projectRoot) {
|
|
|
256
239
|
*/
|
|
257
240
|
async function handleHook(id, payload, opts) {
|
|
258
241
|
const event = normalizeEvent(id, payload);
|
|
259
|
-
const
|
|
260
|
-
const file = trackFile(event.sessionId,
|
|
261
|
-
const mcpDir =
|
|
242
|
+
const layout = projectLayout(opts.cwd);
|
|
243
|
+
const file = trackFile(event.sessionId, layout.trackDir);
|
|
244
|
+
const mcpDir = layout.cacheDir;
|
|
262
245
|
const framework = detectFramework(event.filePath ?? "", event.content ?? "");
|
|
263
246
|
if (event.phase === "post") {
|
|
264
247
|
mcpPostStore(event.tool, event.input, payload.tool_response ?? payload.tool_output, mcpDir);
|
|
@@ -301,4 +284,4 @@ async function handleHook(id, payload, opts) {
|
|
|
301
284
|
};
|
|
302
285
|
}
|
|
303
286
|
//#endregion
|
|
304
|
-
export {
|
|
287
|
+
export { normalizeEvent as a, mcpPostStore as c, DEFAULT_WINDOW_MS as d, REQUIRED_AGENTS as f, activityFor as h, trackFile as i, mcpPreIntercept as l, gate as m, respond as n, MCP_TTL_MS as o, TRIVIAL_BUDGET as p, recordActivity as r, isMcpTool as s, handleHook as t, queryOf as u };
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
//#region src/config/env.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Robust integer-from-env parser.
|
|
4
|
+
* undefined / empty / whitespace / NaN / float / <= 0 all fall back to `fallback`.
|
|
5
|
+
* `Number("")` is 0, so the empty guard is required before `Number()`.
|
|
6
|
+
*/
|
|
7
|
+
declare function parseEnvInt(raw: string | undefined, fallback: number): number;
|
|
8
|
+
//#endregion
|
|
9
|
+
//#region src/config/ttl.d.ts
|
|
10
|
+
/** Default enforcement-freshness window, in seconds (2 minutes). */
|
|
11
|
+
declare const DEFAULT_TTL_SEC = 120;
|
|
12
|
+
/** Default env var name carrying the TTL override. */
|
|
13
|
+
declare const TTL_ENV_KEY = "FUSE_ENFORCE_TTL_SEC";
|
|
14
|
+
/**
|
|
15
|
+
* Resolve the enforcement TTL (seconds) from an env map.
|
|
16
|
+
* @param env - environment map (defaults to `process.env`)
|
|
17
|
+
* @param key - env var name (defaults to `FUSE_ENFORCE_TTL_SEC`)
|
|
18
|
+
*/
|
|
19
|
+
declare function resolveTtlSec(env?: Record<string, string | undefined>, key?: string): number;
|
|
20
|
+
/** Human label for a TTL: 120 -> "2min", 240 -> "4min", 90 -> "90s". */
|
|
21
|
+
declare function ttlLabel(sec: number): string;
|
|
22
|
+
//#endregion
|
|
23
|
+
//#region src/config/limits.d.ts
|
|
24
|
+
/** Default SOLID max lines per file. */
|
|
25
|
+
declare const DEFAULT_MAX_LINES = 100;
|
|
26
|
+
/** Default env var name carrying the max-lines override. */
|
|
27
|
+
declare const MAX_LINES_ENV_KEY = "FUSE_SOLID_MAX_LINES";
|
|
28
|
+
/**
|
|
29
|
+
* Resolve the SOLID max-lines limit from an env map.
|
|
30
|
+
* @param env - environment map (defaults to `process.env`)
|
|
31
|
+
* @param key - env var name (defaults to `FUSE_SOLID_MAX_LINES`)
|
|
32
|
+
*/
|
|
33
|
+
declare function resolveMaxLines(env?: Record<string, string | undefined>, key?: string): number;
|
|
34
|
+
/** Advisory module-split headroom = `maxLines - 10` (never below 1). */
|
|
35
|
+
declare function splitTarget(maxLines: number): number;
|
|
36
|
+
//#endregion
|
|
37
|
+
//#region src/config/layout.d.ts
|
|
38
|
+
/** Top-level project state dir — neutral + harness-agnostic (not `.claude/…`). */
|
|
39
|
+
declare const STATE_ROOT = ".harness";
|
|
40
|
+
/**
|
|
41
|
+
* The selective `.gitignore` for `.harness/`: ignore the machine-local session
|
|
42
|
+
* state (track, cache, throttle) but keep the curated `memory/LESSON.md`.
|
|
43
|
+
*/
|
|
44
|
+
declare const STATE_GITIGNORE = "track/\ncache/\nmemory/state.json\n";
|
|
45
|
+
/** Every project-state path the package uses, derived from one project root. */
|
|
46
|
+
interface ProjectLayout {
|
|
47
|
+
root: string;
|
|
48
|
+
/** `<root>/.harness` — the single state dir. */
|
|
49
|
+
stateDir: string;
|
|
50
|
+
/** `<root>/.harness/track` — session track files. */
|
|
51
|
+
trackDir: string;
|
|
52
|
+
/** `<root>/.harness/cache` — MCP/WebFetch cache. */
|
|
53
|
+
cacheDir: string;
|
|
54
|
+
/** `<root>/.harness/memory` — lessons + throttle. */
|
|
55
|
+
memoryDir: string;
|
|
56
|
+
/** `<root>/.harness/memory/LESSON.md` — curated, committable. */
|
|
57
|
+
lessonsFile: string;
|
|
58
|
+
/** `<root>/.harness/memory/state.json` — machine-local throttle. */
|
|
59
|
+
memoryStateFile: string;
|
|
60
|
+
/** `<root>/.harness/.gitignore`. */
|
|
61
|
+
gitignoreFile: string;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* The single source of truth for where every package file lives under a project
|
|
65
|
+
* root. All modules (runtime storage, memory, init) derive their paths here —
|
|
66
|
+
* nothing hardcodes a directory name elsewhere.
|
|
67
|
+
*/
|
|
68
|
+
declare function projectLayout(root: string): ProjectLayout;
|
|
69
|
+
//#endregion
|
|
70
|
+
export { DEFAULT_MAX_LINES as a, splitTarget as c, resolveTtlSec as d, ttlLabel as f, projectLayout as i, DEFAULT_TTL_SEC as l, STATE_GITIGNORE as n, MAX_LINES_ENV_KEY as o, parseEnvInt as p, STATE_ROOT as r, resolveMaxLines as s, ProjectLayout as t, TTL_ENV_KEY as u };
|
|
@@ -6,6 +6,8 @@ interface ReminderState {
|
|
|
6
6
|
}
|
|
7
7
|
/** Absolute path of the per-project throttle state file. */
|
|
8
8
|
declare function stateFileFor(root: string): string;
|
|
9
|
+
/** Absolute path of the per-project curated lessons file (committable). */
|
|
10
|
+
declare function lessonsFileFor(root: string): string;
|
|
9
11
|
/** Read both throttle timestamps; missing/corrupt fields default to 0. */
|
|
10
12
|
declare function readState(file: string): ReminderState;
|
|
11
13
|
/** Persist one field without clobbering the other (read-modify-write). */
|
|
@@ -27,4 +29,4 @@ declare function addRoot(root: string, home?: string): void;
|
|
|
27
29
|
/** Ensure `<memoryDir>/.gitignore` ignores the machine-local `state.json`. */
|
|
28
30
|
declare function ensureMemoryGitignore(memoryDir: string): void;
|
|
29
31
|
//#endregion
|
|
30
|
-
export { ReminderState as a,
|
|
32
|
+
export { ReminderState as a, readState as c, throttleMs as d, registryFile as i, setStateField as l, addRoot as n, lessonsFileFor as o, readRoots as r, nowStamp as s, ensureMemoryGitignore as t, stateFileFor as u };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { n as PromptKind, r as formatPrompt, t as Prompt } from "./types-D56jSgD9.mjs";
|
|
2
2
|
import { a as extractText, c as summarizeIndex, d as queryHash, i as mcpCacheKey, l as compactMarkdown, n as cachePath, o as IndexSummary, r as cacheStore, s as loadIndex, t as cacheLookup, u as jaccardSimilar } from "./index-DPkCX_AR.mjs";
|
|
3
|
-
import { a as
|
|
3
|
+
import { a as DEFAULT_MAX_LINES, c as splitTarget, d as resolveTtlSec, f as ttlLabel, i as projectLayout, l as DEFAULT_TTL_SEC, n as STATE_GITIGNORE, o as MAX_LINES_ENV_KEY, p as parseEnvInt, r as STATE_ROOT, s as resolveMaxLines, t as ProjectLayout, u as TTL_ENV_KEY } from "./index-C8dk1Alr.mjs";
|
|
4
4
|
import { a as detectHarness, i as HarnessVia, n as HarnessInfo, o as detectMode, r as HarnessMode, s as modeFor, t as HarnessId } from "./harness-DwJskkz_.mjs";
|
|
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
8
|
import { A as evaluateApex, B as matchPatterns, C as Guard, D as ApexGate, E as ApexContext, F as evaluate, G as DEV_KEYWORDS, H as countLines, I as GIT_ASK, J as isApexCommand, K as ProjectType, L as GIT_BLOCKED, M as solidReadGate, N as PolicyContext, O as brainstormGate, P as PolicyResult, R as PROJECT_INSTALL, S as securityGuard, T as APEX_GATES, U as evaluateFileSize, V as FileSizeVerdict, W as detectFramework, _ as bashWriteGuard, a as runGuards, b as ASK_PATTERNS, c as installGuard, d as SWIFT_PROTO_RE, f as TS_DECL_RE, g as CODE_REDIRECT, h as CODE_MUTATORS, i as GUARDS, j as freshnessGate, k as docConsultedGate, l as PHP_DECL_RE, m as ASK_WRITERS, n as capVerbosity, o as PROJECT_INSTALL_RE, p as interfaceSeparationGuard, q as detectProjectType, r as detectCreationIntent, s as SYSTEM_INSTALL_RE, t as MAX_EXA_RESULTS, u as PY_MODEL_RE, v as PROTECTED_FRAGMENTS, w as GuardContext, x as CRITICAL_PATTERNS, y as protectedPathGuard, z as SYSTEM_INSTALL } from "./index-CQOPshSM.mjs";
|
|
9
9
|
import { n as RouteResult, r as ScoredRef, t as RefMeta } from "./types-CY5qT2X1.mjs";
|
|
10
|
-
import { a as ReminderState, c as
|
|
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, PROJECT_INSTALL_RE, PROTECTED_FRAGMENTS, PY_MODEL_RE, Palette, PolicyContext, PolicyResult, ProgressBarOptions, ProjectType, Prompt, PromptKind, RefMeta, ReminderState, RouteResult, SWIFT_PROTO_RE, SYSTEM_INSTALL, SYSTEM_INSTALL_RE, 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, loadIndex, loadRefs, loadState, matchPatterns, mcpCacheKey, modeFor, nowStamp, parseEnvInt, parseFrontmatter, progressiveColor, 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, 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, PROJECT_INSTALL_RE, 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, SYSTEM_INSTALL_RE, 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
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
import { a as parseEnvInt, i as splitTarget, n as MAX_LINES_ENV_KEY, r as resolveMaxLines, t as DEFAULT_MAX_LINES } from "./limits-CHn8AIL1.mjs";
|
|
2
2
|
import { i as ttlLabel, n as TTL_ENV_KEY, r as resolveTtlSec, t as DEFAULT_TTL_SEC } from "./config-BG55s6HZ.mjs";
|
|
3
|
+
import { n as STATE_ROOT, r as projectLayout, t as STATE_GITIGNORE } from "./layout-C0jaaCQC.mjs";
|
|
3
4
|
import { t as compactJson } from "./compact-json-DK2nX-MK.mjs";
|
|
4
|
-
import { n as projectRoot, r as projectRootOrNull, t as isCodeFile } from "./project-root-
|
|
5
|
+
import { n as projectRoot, r as projectRootOrNull, t as isCodeFile } from "./project-root-ff0_poWU.mjs";
|
|
5
6
|
import { n as detectMode, r as modeFor, t as detectHarness } from "./harness-C8Nxxyn_.mjs";
|
|
6
|
-
import { i as isApexCommand, n as DEV_KEYWORDS, r as detectProjectType, t as detectCreationIntent } from "./policy-
|
|
7
|
-
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 SYSTEM_INSTALL_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 PROJECT_INSTALL_RE, l as SWIFT_PROTO_RE, m as CODE_REDIRECT, n as GUARDS, o as installGuard, 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-
|
|
7
|
+
import { i as isApexCommand, n as DEV_KEYWORDS, r as detectProjectType, t as detectCreationIntent } from "./policy-Cpa5aWek.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 SYSTEM_INSTALL_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 PROJECT_INSTALL_RE, l as SWIFT_PROTO_RE, m as CODE_REDIRECT, n as GUARDS, o as installGuard, 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-qGG2Ul0W.mjs";
|
|
8
9
|
import { i as resolveSessions, n as formatDocSatisfactionStatus, r as isDocConsulted, t as formatDocDeny } from "./doc-helpers-Dd_x1-tZ.mjs";
|
|
9
10
|
import { i as parseFrontmatter, n as scoreReferences, r as globToRe, t as routeReferences } from "./router-Dj3AfgBE.mjs";
|
|
10
11
|
import { a as docConsultedGate, c as solidReadGate, i as brainstormGate, n as capVerbosity, o as evaluateApex, r as APEX_GATES, s as freshnessGate, t as MAX_EXA_RESULTS } from "./verbosity-ZYT7tLCw.mjs";
|
|
11
12
|
import { t as formatPrompt } from "./types-ernB1Dy3.mjs";
|
|
12
|
-
import { a as
|
|
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";
|
|
13
14
|
import { a as queryHash, i as jaccardSimilar, n as summarizeIndex, r as compactMarkdown, t as loadIndex } from "./cache-BzbX-ztL.mjs";
|
|
14
|
-
import { a as extractText, i as mcpCacheKey, n as cachePath, r as cacheStore, t as cacheLookup } from "./store-
|
|
15
|
-
import { t as incrementTrivialEditCounter } from "./freshness-
|
|
15
|
+
import { a as extractText, i as mcpCacheKey, n as cachePath, r as cacheStore, t as cacheLookup } from "./store-DeIsfMg5.mjs";
|
|
16
|
+
import { t as incrementTrivialEditCounter } from "./freshness-CezohJHo.mjs";
|
|
16
17
|
import { n as toRefMeta, t as loadRefs } from "./loader-BephwI8n.mjs";
|
|
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-
|
|
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";
|
|
18
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";
|
|
19
|
-
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, PROJECT_INSTALL_RE, PROTECTED_FRAGMENTS, PY_MODEL_RE, SWIFT_PROTO_RE, SYSTEM_INSTALL, SYSTEM_INSTALL_RE, 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, loadIndex, loadRefs, loadState, matchPatterns, mcpCacheKey, modeFor, nowStamp, parseEnvInt, parseFrontmatter, progressiveColor, 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, GRADIENT_BLOCKS, GUARDS, MAX_EXA_RESULTS, MAX_LINES_ENV_KEY, PHP_DECL_RE, PROGRESS_BAR_DEFAULTS, PROGRESS_CHARS, PROJECT_INSTALL, PROJECT_INSTALL_RE, PROTECTED_FRAGMENTS, PY_MODEL_RE, STATE_GITIGNORE, STATE_ROOT, SWIFT_PROTO_RE, SYSTEM_INSTALL, SYSTEM_INSTALL_RE, 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/init/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as codexInit, i as clineInit, n as writeInitFile, o as cursorInit, r as claudeInit, s as geminiInit, t as initFor } from "../run-
|
|
1
|
+
import { a as codexInit, i as clineInit, n as writeInitFile, o as cursorInit, r as claudeInit, s as geminiInit, t as initFor } from "../run-D91N4ul1.mjs";
|
|
2
2
|
export { claudeInit, clineInit, codexInit, cursorInit, geminiInit, initFor, writeInitFile };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { join } from "node:path";
|
|
2
|
+
//#region src/config/layout.ts
|
|
3
|
+
/** Top-level project state dir — neutral + harness-agnostic (not `.claude/…`). */
|
|
4
|
+
const STATE_ROOT = ".harness";
|
|
5
|
+
/**
|
|
6
|
+
* The selective `.gitignore` for `.harness/`: ignore the machine-local session
|
|
7
|
+
* state (track, cache, throttle) but keep the curated `memory/LESSON.md`.
|
|
8
|
+
*/
|
|
9
|
+
const STATE_GITIGNORE = "track/\ncache/\nmemory/state.json\n";
|
|
10
|
+
/**
|
|
11
|
+
* The single source of truth for where every package file lives under a project
|
|
12
|
+
* root. All modules (runtime storage, memory, init) derive their paths here —
|
|
13
|
+
* nothing hardcodes a directory name elsewhere.
|
|
14
|
+
*/
|
|
15
|
+
function projectLayout(root) {
|
|
16
|
+
const stateDir = join(root, STATE_ROOT);
|
|
17
|
+
const memoryDir = join(stateDir, "memory");
|
|
18
|
+
return {
|
|
19
|
+
root,
|
|
20
|
+
stateDir,
|
|
21
|
+
trackDir: join(stateDir, "track"),
|
|
22
|
+
cacheDir: join(stateDir, "cache"),
|
|
23
|
+
memoryDir,
|
|
24
|
+
lessonsFile: join(memoryDir, "LESSON.md"),
|
|
25
|
+
memoryStateFile: join(memoryDir, "state.json"),
|
|
26
|
+
gitignoreFile: join(stateDir, ".gitignore")
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
//#endregion
|
|
30
|
+
export { STATE_ROOT as n, projectLayout as r, STATE_GITIGNORE as t };
|
package/dist/memory/index.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as ReminderState, c as
|
|
2
|
-
export { ReminderState, addRoot, ensureMemoryGitignore, nowStamp, readRoots, readState, registryFile, setStateField, stateFileFor, throttleMs };
|
|
1
|
+
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";
|
|
2
|
+
export { ReminderState, addRoot, ensureMemoryGitignore, lessonsFileFor, nowStamp, readRoots, readState, registryFile, setStateField, stateFileFor, throttleMs };
|
package/dist/memory/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as
|
|
2
|
-
export { addRoot, ensureMemoryGitignore, nowStamp, readRoots, readState, registryFile, setStateField, stateFileFor, throttleMs };
|
|
1
|
+
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";
|
|
2
|
+
export { addRoot, ensureMemoryGitignore, lessonsFileFor, nowStamp, readRoots, readState, registryFile, setStateField, stateFileFor, throttleMs };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { r as projectLayout } from "./layout-C0jaaCQC.mjs";
|
|
2
2
|
import { dirname } from "node:path";
|
|
3
|
+
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
3
4
|
//#region src/memory/gitignore.ts
|
|
4
5
|
/** Ensure `<memoryDir>/.gitignore` ignores the machine-local `state.json`. */
|
|
5
6
|
function ensureMemoryGitignore(memoryDir) {
|
|
@@ -14,7 +15,11 @@ function ensureMemoryGitignore(memoryDir) {
|
|
|
14
15
|
//#region src/memory/state.ts
|
|
15
16
|
/** Absolute path of the per-project throttle state file. */
|
|
16
17
|
function stateFileFor(root) {
|
|
17
|
-
return
|
|
18
|
+
return projectLayout(root).memoryStateFile;
|
|
19
|
+
}
|
|
20
|
+
/** Absolute path of the per-project curated lessons file (committable). */
|
|
21
|
+
function lessonsFileFor(root) {
|
|
22
|
+
return projectLayout(root).lessonsFile;
|
|
18
23
|
}
|
|
19
24
|
function num(v) {
|
|
20
25
|
return typeof v === "number" && Number.isFinite(v) ? v : 0;
|
|
@@ -91,4 +96,4 @@ function addRoot(root, home) {
|
|
|
91
96
|
} catch {}
|
|
92
97
|
}
|
|
93
98
|
//#endregion
|
|
94
|
-
export {
|
|
99
|
+
export { nowStamp as a, stateFileFor as c, lessonsFileFor as i, throttleMs as l, readRoots as n, readState as o, registryFile as r, setStateField as s, addRoot as t, ensureMemoryGitignore as u };
|
package/dist/policy/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as isApexCommand, n as DEV_KEYWORDS, r as detectProjectType, t as detectCreationIntent } from "../policy-
|
|
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 SYSTEM_INSTALL_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 PROJECT_INSTALL_RE, l as SWIFT_PROTO_RE, m as CODE_REDIRECT, n as GUARDS, o as installGuard, 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-
|
|
1
|
+
import { i as isApexCommand, n as DEV_KEYWORDS, r as detectProjectType, t as detectCreationIntent } from "../policy-Cpa5aWek.mjs";
|
|
2
|
+
import { C as PROJECT_INSTALL, D as evaluateFileSize, E as countLines, O as detectFramework, S as GIT_BLOCKED, T as matchPatterns, _ as protectedPathGuard, a as SYSTEM_INSTALL_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 PROJECT_INSTALL_RE, l as SWIFT_PROTO_RE, m as CODE_REDIRECT, n as GUARDS, o as installGuard, 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-qGG2Ul0W.mjs";
|
|
3
3
|
import { a as docConsultedGate, c as solidReadGate, i as brainstormGate, n as capVerbosity, o as evaluateApex, r as APEX_GATES, s as freshnessGate, t as MAX_EXA_RESULTS } from "../verbosity-ZYT7tLCw.mjs";
|
|
4
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, PROJECT_INSTALL_RE, PROTECTED_FRAGMENTS, PY_MODEL_RE, SWIFT_PROTO_RE, SYSTEM_INSTALL, SYSTEM_INSTALL_RE, 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
|
-
import { t as isCodeFile } from "./project-root-
|
|
2
|
-
import { t as evaluate } from "./evaluate-
|
|
1
|
+
import { t as isCodeFile } from "./project-root-ff0_poWU.mjs";
|
|
2
|
+
import { t as evaluate } from "./evaluate-qGG2Ul0W.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,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { n as STATE_ROOT, t as STATE_GITIGNORE } from "./layout-C0jaaCQC.mjs";
|
|
2
2
|
import { dirname, join } from "node:path";
|
|
3
|
+
import { chmodSync, mkdirSync, writeFileSync } from "node:fs";
|
|
3
4
|
//#region src/init/templates.ts
|
|
4
5
|
function json(obj) {
|
|
5
6
|
return `${JSON.stringify(obj, null, 2)}\n`;
|
|
@@ -114,7 +115,11 @@ const RUNNERS = {
|
|
|
114
115
|
*/
|
|
115
116
|
function initFor(id, command = `npx harness hook ${id}`) {
|
|
116
117
|
const make = RUNNERS[id];
|
|
117
|
-
|
|
118
|
+
if (!make) return null;
|
|
119
|
+
return [...make(command), {
|
|
120
|
+
path: `${STATE_ROOT}/.gitignore`,
|
|
121
|
+
content: STATE_GITIGNORE
|
|
122
|
+
}];
|
|
118
123
|
}
|
|
119
124
|
/** Write an {@link InitFile} under `root` (creates dirs; `chmod +x` when executable). */
|
|
120
125
|
function writeInitFile(root, file) {
|
package/dist/runtime/index.d.mts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { t as Prompt } from "../types-D56jSgD9.mjs";
|
|
2
|
-
import { t as HarnessId } from "../harness-DwJskkz_.mjs";
|
|
3
2
|
import { t as RefMeta } from "../types-CY5qT2X1.mjs";
|
|
4
3
|
|
|
5
4
|
//#region src/runtime/paths.d.ts
|
|
@@ -8,11 +7,10 @@ declare function trackFile(sessionId: string, baseDir?: string): string;
|
|
|
8
7
|
//#endregion
|
|
9
8
|
//#region src/runtime/storage.d.ts
|
|
10
9
|
/**
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
* hooks. Falls back to `.fuse-harness` for harnesses without a known config dir.
|
|
10
|
+
* The project's single state dir (`<root>/.harness`) — neutral + harness-agnostic,
|
|
11
|
+
* derived from {@link projectLayout}. (Was the per-harness `.claude/harness`.)
|
|
14
12
|
*/
|
|
15
|
-
declare function
|
|
13
|
+
declare function harnessStateDir(root: string): string;
|
|
16
14
|
//#endregion
|
|
17
15
|
//#region src/runtime/record.d.ts
|
|
18
16
|
/** A unit of session activity to record (discriminated union on `kind`). */
|
|
@@ -142,4 +140,4 @@ interface HandleOutcome {
|
|
|
142
140
|
*/
|
|
143
141
|
declare function handleHook(id: string, payload: Record<string, unknown>, opts: HandleOptions): Promise<HandleOutcome>;
|
|
144
142
|
//#endregion
|
|
145
|
-
export { Activity, DEFAULT_WINDOW_MS, GateInput, HandleOptions, HandleOutcome, MCP_TTL_MS, NormalizedEvent, REQUIRED_AGENTS, TRIVIAL_BUDGET, ToolEvent, activityFor, gate, handleHook,
|
|
143
|
+
export { Activity, DEFAULT_WINDOW_MS, GateInput, HandleOptions, HandleOutcome, MCP_TTL_MS, NormalizedEvent, REQUIRED_AGENTS, TRIVIAL_BUDGET, ToolEvent, activityFor, gate, handleHook, harnessStateDir, isMcpTool, mcpPostStore, mcpPreIntercept, normalizeEvent, queryOf, recordActivity, respond, trackFile };
|
package/dist/runtime/index.mjs
CHANGED
|
@@ -1,2 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
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-D-DClzB2.mjs";
|
|
3
|
+
//#region src/runtime/storage.ts
|
|
4
|
+
/**
|
|
5
|
+
* The project's single state dir (`<root>/.harness`) — neutral + harness-agnostic,
|
|
6
|
+
* derived from {@link projectLayout}. (Was the per-harness `.claude/harness`.)
|
|
7
|
+
*/
|
|
8
|
+
function harnessStateDir(root) {
|
|
9
|
+
return projectLayout(root).stateDir;
|
|
10
|
+
}
|
|
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 };
|
package/dist/state/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
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-
|
|
1
|
+
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";
|
|
2
2
|
export { acquireLock, apexStateDir, ensureStateDir, loadState, saveState, stateFilePath, taskComplete, taskCreate, taskStart };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as readJsonFile, r as writeJsonFile, t as ensureDir } from "./json-io-
|
|
1
|
+
import { n as readJsonFile, r as writeJsonFile, t as ensureDir } from "./json-io-xpTDuvtn.mjs";
|
|
2
2
|
import { mkdir, rmdir } from "node:fs/promises";
|
|
3
3
|
//#region src/state/lock.ts
|
|
4
4
|
const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
|
package/dist/tracking/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as recordAgent, c as recordRefRead, i as emptyTrack, l as recordTrivialEdit, n as saveTrack, o as recordBrainstormRequired, r as agentsFresh, s as recordDoc, t as loadTrack, u as trivialCount } from "../store-
|
|
1
|
+
import { a as recordAgent, c as recordRefRead, i as emptyTrack, 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";
|
|
2
2
|
export { agentsFresh, emptyTrack, loadTrack, recordAgent, recordBrainstormRequired, recordDoc, recordRefRead, recordTrivialEdit, saveTrack, trivialCount };
|
package/dist/util/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { t as compactJson } from "../compact-json-DK2nX-MK.mjs";
|
|
2
|
-
import { n as projectRoot, r as projectRootOrNull, t as isCodeFile } from "../project-root-
|
|
2
|
+
import { n as projectRoot, r as projectRootOrNull, t as isCodeFile } from "../project-root-ff0_poWU.mjs";
|
|
3
3
|
import "../util-la_KkjCS.mjs";
|
|
4
4
|
export { compactJson, isCodeFile, projectRoot, projectRootOrNull };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fusengine/harness",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.14",
|
|
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",
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
//#region src/config/env.d.ts
|
|
2
|
-
/**
|
|
3
|
-
* Robust integer-from-env parser.
|
|
4
|
-
* undefined / empty / whitespace / NaN / float / <= 0 all fall back to `fallback`.
|
|
5
|
-
* `Number("")` is 0, so the empty guard is required before `Number()`.
|
|
6
|
-
*/
|
|
7
|
-
declare function parseEnvInt(raw: string | undefined, fallback: number): number;
|
|
8
|
-
//#endregion
|
|
9
|
-
//#region src/config/ttl.d.ts
|
|
10
|
-
/** Default enforcement-freshness window, in seconds (2 minutes). */
|
|
11
|
-
declare const DEFAULT_TTL_SEC = 120;
|
|
12
|
-
/** Default env var name carrying the TTL override. */
|
|
13
|
-
declare const TTL_ENV_KEY = "FUSE_ENFORCE_TTL_SEC";
|
|
14
|
-
/**
|
|
15
|
-
* Resolve the enforcement TTL (seconds) from an env map.
|
|
16
|
-
* @param env - environment map (defaults to `process.env`)
|
|
17
|
-
* @param key - env var name (defaults to `FUSE_ENFORCE_TTL_SEC`)
|
|
18
|
-
*/
|
|
19
|
-
declare function resolveTtlSec(env?: Record<string, string | undefined>, key?: string): number;
|
|
20
|
-
/** Human label for a TTL: 120 -> "2min", 240 -> "4min", 90 -> "90s". */
|
|
21
|
-
declare function ttlLabel(sec: number): string;
|
|
22
|
-
//#endregion
|
|
23
|
-
//#region src/config/limits.d.ts
|
|
24
|
-
/** Default SOLID max lines per file. */
|
|
25
|
-
declare const DEFAULT_MAX_LINES = 100;
|
|
26
|
-
/** Default env var name carrying the max-lines override. */
|
|
27
|
-
declare const MAX_LINES_ENV_KEY = "FUSE_SOLID_MAX_LINES";
|
|
28
|
-
/**
|
|
29
|
-
* Resolve the SOLID max-lines limit from an env map.
|
|
30
|
-
* @param env - environment map (defaults to `process.env`)
|
|
31
|
-
* @param key - env var name (defaults to `FUSE_SOLID_MAX_LINES`)
|
|
32
|
-
*/
|
|
33
|
-
declare function resolveMaxLines(env?: Record<string, string | undefined>, key?: string): number;
|
|
34
|
-
/** Advisory module-split headroom = `maxLines - 10` (never below 1). */
|
|
35
|
-
declare function splitTarget(maxLines: number): number;
|
|
36
|
-
//#endregion
|
|
37
|
-
export { DEFAULT_TTL_SEC as a, ttlLabel as c, splitTarget as i, parseEnvInt as l, MAX_LINES_ENV_KEY as n, TTL_ENV_KEY as o, resolveMaxLines as r, resolveTtlSec as s, DEFAULT_MAX_LINES as t };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as compactJson } from "./compact-json-DK2nX-MK.mjs";
|
|
2
|
-
import { chmodSync, existsSync, mkdirSync, readFileSync, renameSync, unlinkSync, writeFileSync } from "node:fs";
|
|
3
2
|
import { dirname } from "node:path";
|
|
3
|
+
import { chmodSync, existsSync, mkdirSync, readFileSync, renameSync, unlinkSync, writeFileSync } from "node:fs";
|
|
4
4
|
import { randomUUID } from "node:crypto";
|
|
5
5
|
import { mkdir } from "node:fs/promises";
|
|
6
6
|
//#region src/util/json-io.ts
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { existsSync } from "node:fs";
|
|
2
1
|
import { join } from "node:path";
|
|
2
|
+
import { existsSync } from "node:fs";
|
|
3
3
|
//#region src/policy/detect-project.ts
|
|
4
4
|
/** Keywords that signal a development task (APEX trigger). */
|
|
5
5
|
const DEV_KEYWORDS = /\b(implement|create|build|fix|add|refactor|develop|feature|bug|update|modify|change|write|code)\b/i;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { existsSync } from "node:fs";
|
|
2
1
|
import { dirname, resolve } from "node:path";
|
|
2
|
+
import { existsSync } from "node:fs";
|
|
3
3
|
//#region src/util/project-root.ts
|
|
4
4
|
/** Source-code file extensions worth tracking as "code was written". */
|
|
5
5
|
const CODE_EXT = /\.(ts|tsx|js|jsx|py|php|swift|go|rs|rb|java|vue|svelte|astro|css|kt|dart|cpp|c)$/;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { existsSync, mkdirSync, readFileSync, statSync, writeFileSync } from "node:fs";
|
|
2
1
|
import { dirname, join } from "node:path";
|
|
2
|
+
import { existsSync, mkdirSync, readFileSync, statSync, writeFileSync } from "node:fs";
|
|
3
3
|
//#region src/cache/mcp-response.ts
|
|
4
4
|
const MAX_DEPTH = 5;
|
|
5
5
|
/**
|