@fusengine/harness 0.1.28 → 0.1.30
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/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 +2 -2
- package/dist/{cache-BzbX-ztL.mjs → cache-C9z9LclL.mjs} +1 -31
- package/dist/{claude-phC5Uh_W.mjs → claude-B9FYp0Yw.mjs} +1 -1
- package/dist/cli/bin.mjs +14 -4
- package/dist/cli/index.mjs +1 -1
- package/dist/describe-CPtgUzFS.mjs +1038 -0
- package/dist/{evaluate-CFYPF3re.mjs → evaluate-j3gRJ_ng.mjs} +14 -2
- package/dist/freshness/index.mjs +1 -1
- package/dist/{freshness-CezohJHo.mjs → freshness-otdUpuvP.mjs} +1 -1
- package/dist/handle-USWK4NSE.mjs +2300 -0
- package/dist/index-mISsk0ff.d.mts +438 -0
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +7 -8
- package/dist/{json-io-xpTDuvtn.mjs → json-io-CAn72gI4.mjs} +1 -1
- package/dist/policy/index.d.mts +2 -2
- package/dist/policy/index.mjs +4 -4
- package/dist/policy-la_KkjCS.mjs +1 -0
- package/dist/{run-B8n-H5hA.mjs → run-CXsV-wIJ.mjs} +1 -1
- package/dist/runtime/index.d.mts +454 -8
- package/dist/runtime/index.mjs +2 -2
- package/dist/state/index.mjs +1 -1
- package/dist/{state-Cs0Y0MG_.mjs → state-ByhLeKyD.mjs} +1 -1
- package/dist/{store-BnHpq2ZB.mjs → store-D-ge2ZPI.mjs} +1 -1
- package/dist/{store-DeIsfMg5.mjs → store-PrNPm6So.mjs} +30 -1
- package/dist/tracking/index.mjs +1 -1
- package/package.json +10 -3
- package/dist/handle-DnOw05K8.mjs +0 -347
- package/dist/index-DNAzITvw.d.mts +0 -227
- package/dist/policy-EuVJ_5hS.mjs +0 -33
- package/dist/verbosity-CXpf3aQQ.mjs +0 -98
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
import { r as isDocConsulted, t as formatDocDeny } from "./doc-helpers-Dd_x1-tZ.mjs";
|
|
2
|
-
import { t as routeReferences } from "./router-D8cVrI-s.mjs";
|
|
3
|
-
//#region src/policy/apex.ts
|
|
4
|
-
/** Gate: Context7 + Exa must have been consulted this session. */
|
|
5
|
-
const docConsultedGate = (ctx) => isDocConsulted(ctx.authorizations, ctx.sessionId) ? null : {
|
|
6
|
-
kind: "block",
|
|
7
|
-
title: "APEX: documentation not consulted",
|
|
8
|
-
reason: formatDocDeny(ctx.framework),
|
|
9
|
-
actions: ["Call mcp__context7__query-docs", "Call mcp__exa__web_search_exa"]
|
|
10
|
-
};
|
|
11
|
-
/** Gate: the routed SOLID references for this edit must have been read. */
|
|
12
|
-
const solidReadGate = (ctx) => {
|
|
13
|
-
if (!ctx.refs?.length) return null;
|
|
14
|
-
const routed = routeReferences(ctx.refs, ctx.filePath, ctx.content);
|
|
15
|
-
if (!routed) return null;
|
|
16
|
-
const read = new Set(ctx.refsRead ?? []);
|
|
17
|
-
const missing = routed.required.map((r) => r.meta.filePath).filter((p) => !read.has(p));
|
|
18
|
-
if (missing.length === 0) return null;
|
|
19
|
-
return {
|
|
20
|
-
kind: "block",
|
|
21
|
-
title: `APEX: read SOLID references for ${ctx.framework}`,
|
|
22
|
-
reason: `Read these before editing ${ctx.filePath}:`,
|
|
23
|
-
actions: missing
|
|
24
|
-
};
|
|
25
|
-
};
|
|
26
|
-
/** Gate: the required prior agents (explore + research) must have run within the window. */
|
|
27
|
-
const freshnessGate = (ctx) => ctx.agentsFresh === false ? {
|
|
28
|
-
kind: "block",
|
|
29
|
-
title: "APEX: explore + research required",
|
|
30
|
-
reason: `Run explore-codebase and research-expert (within the freshness window) before editing ${ctx.framework}.`,
|
|
31
|
-
actions: ["Launch the explore-codebase agent", "Launch the research-expert agent"]
|
|
32
|
-
} : null;
|
|
33
|
-
/** Gate: brainstorming must precede creating new files when flagged. */
|
|
34
|
-
const brainstormGate = (ctx) => ctx.brainstormRequired && ctx.brainstormFresh === false ? {
|
|
35
|
-
kind: "block",
|
|
36
|
-
title: "APEX: brainstorm first",
|
|
37
|
-
reason: `Creation intent detected — brainstorm before creating new ${ctx.framework} files.`,
|
|
38
|
-
actions: ["Launch the brainstorming agent"]
|
|
39
|
-
} : null;
|
|
40
|
-
/** Default APEX gate chain (brainstorm, freshness, docs, SOLID refs). */
|
|
41
|
-
const APEX_GATES = [
|
|
42
|
-
brainstormGate,
|
|
43
|
-
freshnessGate,
|
|
44
|
-
docConsultedGate,
|
|
45
|
-
solidReadGate
|
|
46
|
-
];
|
|
47
|
-
/**
|
|
48
|
-
* Run the APEX gates (chain-of-responsibility): the first failing gate's prompt
|
|
49
|
-
* wins; null means every gate passed (allow).
|
|
50
|
-
*/
|
|
51
|
-
function evaluateApex(ctx, gates = APEX_GATES) {
|
|
52
|
-
return gates.reduce((hit, gate) => hit ?? gate(ctx), null);
|
|
53
|
-
}
|
|
54
|
-
//#endregion
|
|
55
|
-
//#region src/policy/creation-intent.ts
|
|
56
|
-
const CREATE_RE = /\b(?:create|implement|add|build|new|feature|component|generate|make|develop|scaffold)\b/i;
|
|
57
|
-
const SKIP_RE = /\b(?:fix|bug|debug|update|refactor|rename|move|delete|remove|commit|push|edit|modify|change)\b/i;
|
|
58
|
-
/**
|
|
59
|
-
* True when a prompt expresses creation intent (a new feature/component) and is
|
|
60
|
-
* not a fix/refactor — the signal that brainstorming should precede creation.
|
|
61
|
-
* The harness calls this on UserPromptSubmit, then `recordBrainstormRequired`.
|
|
62
|
-
*/
|
|
63
|
-
function detectCreationIntent(prompt) {
|
|
64
|
-
return CREATE_RE.test(prompt) && !SKIP_RE.test(prompt);
|
|
65
|
-
}
|
|
66
|
-
//#endregion
|
|
67
|
-
//#region src/policy/verbosity.ts
|
|
68
|
-
/** Exa MCP tools whose result count + token budget are capped. */
|
|
69
|
-
const EXA_TOOLS = /exa__web_search|exa__get_code_context|exa_web_search|exa_get_code_context/i;
|
|
70
|
-
/** Context7 doc tool whose token budget is capped. */
|
|
71
|
-
const CONTEXT7_TOOLS = /context7__query-docs|context7_query-docs|query-docs/i;
|
|
72
|
-
/** Max results an exa MCP call may request. */
|
|
73
|
-
const MAX_EXA_RESULTS = 3;
|
|
74
|
-
/** Max token budget for exa `tokensNum` / context7 `tokens`. */
|
|
75
|
-
const MAX_TOKENS = 2e3;
|
|
76
|
-
/**
|
|
77
|
-
* Cap an MCP call's verbosity — exa `numResults` ≤ 3 (+ `tokensNum` ≤ 2000),
|
|
78
|
-
* Context7 `tokens` ≤ 2000. Returns the capped input (a mutation for the harness
|
|
79
|
-
* to apply) when a change is needed, else null.
|
|
80
|
-
*/
|
|
81
|
-
function capVerbosity(tool, input) {
|
|
82
|
-
const out = { ...input };
|
|
83
|
-
let changed = false;
|
|
84
|
-
const cap = (key, max, force) => {
|
|
85
|
-
const v = out[key];
|
|
86
|
-
if (typeof v === "number" && v > max || force && typeof v !== "number") {
|
|
87
|
-
out[key] = max;
|
|
88
|
-
changed = true;
|
|
89
|
-
}
|
|
90
|
-
};
|
|
91
|
-
if (EXA_TOOLS.test(tool)) {
|
|
92
|
-
cap("numResults", 3, true);
|
|
93
|
-
cap("tokensNum", MAX_TOKENS, false);
|
|
94
|
-
} else if (CONTEXT7_TOOLS.test(tool)) cap("tokens", MAX_TOKENS, false);
|
|
95
|
-
return changed ? out : null;
|
|
96
|
-
}
|
|
97
|
-
//#endregion
|
|
98
|
-
export { APEX_GATES as a, evaluateApex as c, detectCreationIntent as i, freshnessGate as l, MAX_TOKENS as n, brainstormGate as o, capVerbosity as r, docConsultedGate as s, MAX_EXA_RESULTS as t, solidReadGate as u };
|