@fusengine/harness 0.1.36 → 0.1.37
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/dist/cli/bin.mjs +2 -1
- package/dist/config/index.d.mts +2 -2
- package/dist/config/index.mjs +2 -2
- package/dist/dotenv-TLNMiSjP.mjs +74 -0
- package/dist/{index-C8dk1Alr.d.mts → index-DLUfyYmU.d.mts} +19 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +2 -2
- package/package.json +1 -1
- package/dist/ttl-BG55s6HZ.mjs +0 -20
package/dist/cli/bin.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
2
|
+
import { n as loadDotenv, o as resolveTtlSec } from "../dotenv-TLNMiSjP.mjs";
|
|
3
3
|
import { t as detectHarness } from "../harness-C8Nxxyn_.mjs";
|
|
4
4
|
import { n as stagedContent, r as stagedFiles, t as checkStaged } from "../run-CUL70W0k.mjs";
|
|
5
5
|
import { n as writeInitFile, t as initFor } from "../run-Do2JltgU.mjs";
|
|
@@ -98,6 +98,7 @@ async function readStdin() {
|
|
|
98
98
|
const cmd = process.argv[2];
|
|
99
99
|
if (cmd === "hook") {
|
|
100
100
|
const id = process.argv[3] ?? detectHarness().id;
|
|
101
|
+
loadDotenv(id);
|
|
101
102
|
const scopeArg = process.argv[4];
|
|
102
103
|
const scope = scopeArg !== void 0 && (/* @__PURE__ */ new Set([
|
|
103
104
|
"solid",
|
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, ProjectLayout, STATE_GITIGNORE, STATE_ROOT, TTL_ENV_KEY, parseEnvInt, projectLayout, resolveMaxLines, resolveTtlSec, splitTarget, ttlLabel };
|
|
1
|
+
import { a as STATE_GITIGNORE, c as DEFAULT_MAX_LINES, d as splitTarget, f as DEFAULT_TTL_SEC, g as parseEnvInt, h as ttlLabel, i as ProjectLayout, l as MAX_LINES_ENV_KEY, m as resolveTtlSec, n as loadDotenv, o as STATE_ROOT, p as TTL_ENV_KEY, r as parseEnvFile, s as projectLayout, t as envCandidates, u as resolveMaxLines } from "../index-DLUfyYmU.mjs";
|
|
2
|
+
export { DEFAULT_MAX_LINES, DEFAULT_TTL_SEC, MAX_LINES_ENV_KEY, ProjectLayout, STATE_GITIGNORE, STATE_ROOT, TTL_ENV_KEY, envCandidates, loadDotenv, parseEnvFile, parseEnvInt, projectLayout, resolveMaxLines, resolveTtlSec, splitTarget, ttlLabel };
|
package/dist/config/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
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
|
-
import { i as
|
|
2
|
+
import { a as TTL_ENV_KEY, i as DEFAULT_TTL_SEC, n as loadDotenv, o as resolveTtlSec, r as parseEnvFile, s as ttlLabel, t as envCandidates } from "../dotenv-TLNMiSjP.mjs";
|
|
3
3
|
import { n as STATE_ROOT, r as projectLayout, t as STATE_GITIGNORE } from "../layout-C0jaaCQC.mjs";
|
|
4
4
|
import "../config-la_KkjCS.mjs";
|
|
5
|
-
export { DEFAULT_MAX_LINES, DEFAULT_TTL_SEC, MAX_LINES_ENV_KEY, STATE_GITIGNORE, STATE_ROOT, TTL_ENV_KEY, parseEnvInt, projectLayout, resolveMaxLines, resolveTtlSec, splitTarget, ttlLabel };
|
|
5
|
+
export { DEFAULT_MAX_LINES, DEFAULT_TTL_SEC, MAX_LINES_ENV_KEY, STATE_GITIGNORE, STATE_ROOT, TTL_ENV_KEY, envCandidates, loadDotenv, parseEnvFile, parseEnvInt, projectLayout, resolveMaxLines, resolveTtlSec, splitTarget, ttlLabel };
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { a as parseEnvInt } from "./limits-CHn8AIL1.mjs";
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
4
|
+
import { homedir } from "node:os";
|
|
5
|
+
//#region src/config/ttl.ts
|
|
6
|
+
/** Default enforcement-freshness window, in seconds (2 minutes). */
|
|
7
|
+
const DEFAULT_TTL_SEC = 120;
|
|
8
|
+
/** Default env var name carrying the TTL override. */
|
|
9
|
+
const TTL_ENV_KEY = "FUSE_ENFORCE_TTL_SEC";
|
|
10
|
+
/**
|
|
11
|
+
* Resolve the enforcement TTL (seconds) from an env map.
|
|
12
|
+
* @param env - environment map (defaults to `process.env`)
|
|
13
|
+
* @param key - env var name (defaults to `FUSE_ENFORCE_TTL_SEC`)
|
|
14
|
+
*/
|
|
15
|
+
function resolveTtlSec(env = process.env, key = TTL_ENV_KEY) {
|
|
16
|
+
return parseEnvInt(env[key], 120);
|
|
17
|
+
}
|
|
18
|
+
/** Human label for a TTL: 120 -> "2min", 240 -> "4min", 90 -> "90s". */
|
|
19
|
+
function ttlLabel(sec) {
|
|
20
|
+
return sec % 60 === 0 ? `${sec / 60}min` : `${sec}s`;
|
|
21
|
+
}
|
|
22
|
+
//#endregion
|
|
23
|
+
//#region src/config/dotenv.ts
|
|
24
|
+
/**
|
|
25
|
+
* Native .env loader. Ports the claude-plugins `services/env-file.ts`
|
|
26
|
+
* (`loadEnvFile`) into the engine so a hook run hydrates `process.env` from the
|
|
27
|
+
* harness home `.env` (`~/.claude/.env`, `~/.codex/.env`, …) plus the project
|
|
28
|
+
* `<cwd>/.env`, instead of relying on Bun auto-dotenv or `BASH_ENV`. A value
|
|
29
|
+
* already present in the environment always wins (the file never overwrites it).
|
|
30
|
+
*/
|
|
31
|
+
/** Home config dir holding the `.env` for each harness (defaults to `.claude`). */
|
|
32
|
+
const HOME_DIR = {
|
|
33
|
+
"claude-code": ".claude",
|
|
34
|
+
codex: ".codex",
|
|
35
|
+
cursor: ".cursor",
|
|
36
|
+
cline: ".clinerules",
|
|
37
|
+
"gemini-cli": ".gemini",
|
|
38
|
+
opencode: ".opencode"
|
|
39
|
+
};
|
|
40
|
+
/** Parse a `.env` file into a key→value map (`export KEY="v"` or `KEY=v`). */
|
|
41
|
+
function parseEnvFile(path) {
|
|
42
|
+
if (!existsSync(path)) return {};
|
|
43
|
+
let content = "";
|
|
44
|
+
try {
|
|
45
|
+
content = readFileSync(path, "utf-8");
|
|
46
|
+
} catch {
|
|
47
|
+
return {};
|
|
48
|
+
}
|
|
49
|
+
const out = {};
|
|
50
|
+
for (const line of content.split(/\r?\n/)) {
|
|
51
|
+
if (line.trimStart().startsWith("#")) continue;
|
|
52
|
+
const m = line.match(/^\s*(?:export\s+)?(\w+)\s*=\s*["']?([^"'\n]*)["']?\s*$/);
|
|
53
|
+
if (m?.[1]) out[m[1]] = m[2] ?? "";
|
|
54
|
+
}
|
|
55
|
+
return out;
|
|
56
|
+
}
|
|
57
|
+
/** The `.env` paths probed for a harness: home `.env` then `<cwd>/.env`. */
|
|
58
|
+
function envCandidates(id, home = homedir(), cwd = process.cwd()) {
|
|
59
|
+
return [join(home, HOME_DIR[id] ?? ".claude", ".env"), join(cwd, ".env")];
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Load `.env` files into `env` without overwriting existing keys. Reads the
|
|
63
|
+
* harness home `.env` then `<cwd>/.env`. Best-effort (missing/unreadable files
|
|
64
|
+
* are skipped) so a hook never fails on env loading.
|
|
65
|
+
* @param id - Detected harness id (selects the home dir).
|
|
66
|
+
* @param env - Target environment (defaults to `process.env`).
|
|
67
|
+
* @param home - Home dir.
|
|
68
|
+
* @param cwd - Project root.
|
|
69
|
+
*/
|
|
70
|
+
function loadDotenv(id, env = process.env, home = homedir(), cwd = process.cwd()) {
|
|
71
|
+
for (const path of envCandidates(id, home, cwd)) for (const [k, v] of Object.entries(parseEnvFile(path))) if (env[k] === void 0) env[k] = v;
|
|
72
|
+
}
|
|
73
|
+
//#endregion
|
|
74
|
+
export { TTL_ENV_KEY as a, DEFAULT_TTL_SEC as i, loadDotenv as n, resolveTtlSec as o, parseEnvFile as r, ttlLabel as s, envCandidates as t };
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { t as HarnessId } from "./harness-DwJskkz_.mjs";
|
|
2
|
+
|
|
1
3
|
//#region src/config/env.d.ts
|
|
2
4
|
/**
|
|
3
5
|
* Robust integer-from-env parser.
|
|
@@ -67,4 +69,20 @@ interface ProjectLayout {
|
|
|
67
69
|
*/
|
|
68
70
|
declare function projectLayout(root: string): ProjectLayout;
|
|
69
71
|
//#endregion
|
|
70
|
-
|
|
72
|
+
//#region src/config/dotenv.d.ts
|
|
73
|
+
/** Parse a `.env` file into a key→value map (`export KEY="v"` or `KEY=v`). */
|
|
74
|
+
declare function parseEnvFile(path: string): Record<string, string>;
|
|
75
|
+
/** The `.env` paths probed for a harness: home `.env` then `<cwd>/.env`. */
|
|
76
|
+
declare function envCandidates(id: HarnessId, home?: string, cwd?: string): string[];
|
|
77
|
+
/**
|
|
78
|
+
* Load `.env` files into `env` without overwriting existing keys. Reads the
|
|
79
|
+
* harness home `.env` then `<cwd>/.env`. Best-effort (missing/unreadable files
|
|
80
|
+
* are skipped) so a hook never fails on env loading.
|
|
81
|
+
* @param id - Detected harness id (selects the home dir).
|
|
82
|
+
* @param env - Target environment (defaults to `process.env`).
|
|
83
|
+
* @param home - Home dir.
|
|
84
|
+
* @param cwd - Project root.
|
|
85
|
+
*/
|
|
86
|
+
declare function loadDotenv(id: HarnessId, env?: NodeJS.ProcessEnv, home?: string, cwd?: string): void;
|
|
87
|
+
//#endregion
|
|
88
|
+
export { STATE_GITIGNORE as a, DEFAULT_MAX_LINES as c, splitTarget as d, DEFAULT_TTL_SEC as f, parseEnvInt as g, ttlLabel as h, ProjectLayout as i, MAX_LINES_ENV_KEY as l, resolveTtlSec as m, loadDotenv as n, STATE_ROOT as o, TTL_ENV_KEY as p, parseEnvFile as r, projectLayout as s, envCandidates as t, resolveMaxLines as u };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
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 STATE_GITIGNORE, c as DEFAULT_MAX_LINES, d as splitTarget, f as DEFAULT_TTL_SEC, g as parseEnvInt, h as ttlLabel, i as ProjectLayout, l as MAX_LINES_ENV_KEY, m as resolveTtlSec, n as loadDotenv, o as STATE_ROOT, p as TTL_ENV_KEY, r as parseEnvFile, s as projectLayout, t as envCandidates, u as resolveMaxLines } from "./index-DLUfyYmU.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";
|
|
@@ -11,4 +11,4 @@ import { a as ReminderState, c as readState, d as throttleMs, i as registryFile,
|
|
|
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, ApexTaskState, AuthEntry, CODE_MUTATORS, CODE_REDIRECT, COLOR_THRESHOLDS, CRITICAL_PATTERNS, ColorFn, DEFAULT_MAX_LINES, DEFAULT_TTL_SEC, DEV_KEYWORDS, DEV_VERBS, DocSatisfactionStatus, EXCLUDE_DIRS, 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_INDICATORS, 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, TreeEntry, acquireLock, addRoot, apexStateDir, bashWriteGuard, brainstormGate, buildApexInstruction, buildApexTaskContext, buildApexTaskInjection, buildClaudeMdContext, cacheLookup, cachePath, cacheStore, capVerbosity, clearUserGuards, colors, compactJson, compactMarkdown, countLines, descFromText, detectClaudeMdProjectType, detectCreationIntent, detectFramework, detectHarness, detectMode, detectModularArchitecture, detectProjectType, detectRequiredSkills, docConsultedGate, ensureMemoryGitignore, ensureStateDir, evaluate, evaluateApex, evaluateFileSize, extractText, firstComment, firstHeading, formatBasename, formatCost, formatDocDeny, formatDocSatisfactionStatus, formatPath, formatPrompt, formatTimeLeft, formatTokens, frameworkSolidGate, freshnessGate, generateGradientBar, generateProgressBar, globToRe, incrementTrivialEditCounter, installGuard, interfaceSeparationGuard, isApexCommand, isCodeFile, isDocConsulted, isHtmlLike, jaccardSimilar, lessonsFileFor, loadApexTaskState, loadIndex, loadRefs, loadState, matchPatterns, mcpCacheKey, missingSeoElements, modeFor, nowStamp, parseBodyDesc, parseEnrichment, parseEntry, parseEnvInt, parseField, 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, walkUpFor };
|
|
14
|
+
export { APEX_GATES, ASK_PATTERNS, ASK_WRITERS, ApexContext, ApexGate, ApexState, ApexTask, ApexTaskFile, ApexTaskState, AuthEntry, CODE_MUTATORS, CODE_REDIRECT, COLOR_THRESHOLDS, CRITICAL_PATTERNS, ColorFn, DEFAULT_MAX_LINES, DEFAULT_TTL_SEC, DEV_KEYWORDS, DEV_VERBS, DocSatisfactionStatus, EXCLUDE_DIRS, 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_INDICATORS, 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, TreeEntry, acquireLock, addRoot, apexStateDir, bashWriteGuard, brainstormGate, buildApexInstruction, buildApexTaskContext, buildApexTaskInjection, buildClaudeMdContext, cacheLookup, cachePath, cacheStore, capVerbosity, clearUserGuards, colors, compactJson, compactMarkdown, countLines, descFromText, detectClaudeMdProjectType, detectCreationIntent, detectFramework, detectHarness, detectMode, detectModularArchitecture, detectProjectType, detectRequiredSkills, docConsultedGate, ensureMemoryGitignore, ensureStateDir, envCandidates, evaluate, evaluateApex, evaluateFileSize, extractText, firstComment, firstHeading, formatBasename, formatCost, formatDocDeny, formatDocSatisfactionStatus, formatPath, formatPrompt, formatTimeLeft, formatTokens, frameworkSolidGate, freshnessGate, generateGradientBar, generateProgressBar, globToRe, incrementTrivialEditCounter, installGuard, interfaceSeparationGuard, isApexCommand, isCodeFile, isDocConsulted, isHtmlLike, jaccardSimilar, lessonsFileFor, loadApexTaskState, loadDotenv, loadIndex, loadRefs, loadState, matchPatterns, mcpCacheKey, missingSeoElements, modeFor, nowStamp, parseBodyDesc, parseEnrichment, parseEntry, parseEnvFile, parseEnvInt, parseField, 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, walkUpFor };
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
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
|
-
import { i as
|
|
2
|
+
import { a as TTL_ENV_KEY, i as DEFAULT_TTL_SEC, n as loadDotenv, o as resolveTtlSec, r as parseEnvFile, s as ttlLabel, t as envCandidates } from "./dotenv-TLNMiSjP.mjs";
|
|
3
3
|
import { n as STATE_ROOT, r as projectLayout, t as STATE_GITIGNORE } from "./layout-C0jaaCQC.mjs";
|
|
4
4
|
import { t as compactJson } from "./compact-json-DK2nX-MK.mjs";
|
|
5
5
|
import { i as walkUpFor, n as projectRoot, r as projectRootOrNull, t as isCodeFile } from "./project-root-3kk7gCOp.mjs";
|
|
@@ -16,4 +16,4 @@ import { t as incrementTrivialEditCounter } from "./freshness-43gxYpiX.mjs";
|
|
|
16
16
|
import { n as toRefMeta, t as loadRefs } from "./loader-CyAoJv2W.mjs";
|
|
17
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-BthKK4Jj.mjs";
|
|
18
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";
|
|
19
|
-
export { APEX_GATES, ASK_PATTERNS, ASK_WRITERS, CODE_MUTATORS, CODE_REDIRECT, COLOR_THRESHOLDS, CRITICAL_PATTERNS, DEFAULT_MAX_LINES, DEFAULT_TTL_SEC, DEV_KEYWORDS, DEV_VERBS, EXCLUDE_DIRS, 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_INDICATORS, 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, buildApexInstruction, buildApexTaskContext, buildApexTaskInjection, buildClaudeMdContext, cacheLookup, cachePath, cacheStore, capVerbosity, clearUserGuards, colors, compactJson, compactMarkdown, countLines, descFromText, detectClaudeMdProjectType, detectCreationIntent, detectFramework, detectHarness, detectMode, detectModularArchitecture, detectProjectType, detectRequiredSkills, docConsultedGate, ensureMemoryGitignore, ensureStateDir, evaluate, evaluateApex, evaluateFileSize, extractText, firstComment, firstHeading, formatBasename, formatCost, formatDocDeny, formatDocSatisfactionStatus, formatPath, formatPrompt, formatTimeLeft, formatTokens, frameworkSolidGate, freshnessGate, generateGradientBar, generateProgressBar, globToRe, incrementTrivialEditCounter, installGuard, interfaceSeparationGuard, isApexCommand, isCodeFile, isDocConsulted, isHtmlLike, jaccardSimilar, lessonsFileFor, loadApexTaskState, loadIndex, loadRefs, loadState, matchPatterns, mcpCacheKey, missingSeoElements, modeFor, nowStamp, parseBodyDesc, parseEnrichment, parseEntry, parseEnvInt, parseField, 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, walkUpFor };
|
|
19
|
+
export { APEX_GATES, ASK_PATTERNS, ASK_WRITERS, CODE_MUTATORS, CODE_REDIRECT, COLOR_THRESHOLDS, CRITICAL_PATTERNS, DEFAULT_MAX_LINES, DEFAULT_TTL_SEC, DEV_KEYWORDS, DEV_VERBS, EXCLUDE_DIRS, 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_INDICATORS, 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, buildApexInstruction, buildApexTaskContext, buildApexTaskInjection, buildClaudeMdContext, cacheLookup, cachePath, cacheStore, capVerbosity, clearUserGuards, colors, compactJson, compactMarkdown, countLines, descFromText, detectClaudeMdProjectType, detectCreationIntent, detectFramework, detectHarness, detectMode, detectModularArchitecture, detectProjectType, detectRequiredSkills, docConsultedGate, ensureMemoryGitignore, ensureStateDir, envCandidates, evaluate, evaluateApex, evaluateFileSize, extractText, firstComment, firstHeading, formatBasename, formatCost, formatDocDeny, formatDocSatisfactionStatus, formatPath, formatPrompt, formatTimeLeft, formatTokens, frameworkSolidGate, freshnessGate, generateGradientBar, generateProgressBar, globToRe, incrementTrivialEditCounter, installGuard, interfaceSeparationGuard, isApexCommand, isCodeFile, isDocConsulted, isHtmlLike, jaccardSimilar, lessonsFileFor, loadApexTaskState, loadDotenv, loadIndex, loadRefs, loadState, matchPatterns, mcpCacheKey, missingSeoElements, modeFor, nowStamp, parseBodyDesc, parseEnrichment, parseEntry, parseEnvFile, parseEnvInt, parseField, 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, walkUpFor };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fusengine/harness",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.37",
|
|
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",
|
package/dist/ttl-BG55s6HZ.mjs
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { a as parseEnvInt } from "./limits-CHn8AIL1.mjs";
|
|
2
|
-
//#region src/config/ttl.ts
|
|
3
|
-
/** Default enforcement-freshness window, in seconds (2 minutes). */
|
|
4
|
-
const DEFAULT_TTL_SEC = 120;
|
|
5
|
-
/** Default env var name carrying the TTL override. */
|
|
6
|
-
const TTL_ENV_KEY = "FUSE_ENFORCE_TTL_SEC";
|
|
7
|
-
/**
|
|
8
|
-
* Resolve the enforcement TTL (seconds) from an env map.
|
|
9
|
-
* @param env - environment map (defaults to `process.env`)
|
|
10
|
-
* @param key - env var name (defaults to `FUSE_ENFORCE_TTL_SEC`)
|
|
11
|
-
*/
|
|
12
|
-
function resolveTtlSec(env = process.env, key = TTL_ENV_KEY) {
|
|
13
|
-
return parseEnvInt(env[key], 120);
|
|
14
|
-
}
|
|
15
|
-
/** Human label for a TTL: 120 -> "2min", 240 -> "4min", 90 -> "90s". */
|
|
16
|
-
function ttlLabel(sec) {
|
|
17
|
-
return sec % 60 === 0 ? `${sec / 60}min` : `${sec}s`;
|
|
18
|
-
}
|
|
19
|
-
//#endregion
|
|
20
|
-
export { ttlLabel as i, TTL_ENV_KEY as n, resolveTtlSec as r, DEFAULT_TTL_SEC as t };
|