@dzhechkov/harness-core 0.4.5 → 0.5.1
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/.dz-manifest.json +489 -105
- package/README.md +116 -5
- package/dist/agents-policy.d.ts +67 -0
- package/dist/agents-policy.d.ts.map +1 -0
- package/dist/agents-policy.js +258 -0
- package/dist/agents-policy.js.map +1 -0
- package/dist/codex-hooks-assets.d.ts +47 -0
- package/dist/codex-hooks-assets.d.ts.map +1 -0
- package/dist/codex-hooks-assets.js +324 -0
- package/dist/codex-hooks-assets.js.map +1 -0
- package/dist/codex-hooks-verify.d.ts +95 -0
- package/dist/codex-hooks-verify.d.ts.map +1 -0
- package/dist/codex-hooks-verify.js +169 -0
- package/dist/codex-hooks-verify.js.map +1 -0
- package/dist/codex-hooks.d.ts +341 -0
- package/dist/codex-hooks.d.ts.map +1 -0
- package/dist/codex-hooks.js +541 -0
- package/dist/codex-hooks.js.map +1 -0
- package/dist/discrimination-gate.d.ts +88 -15
- package/dist/discrimination-gate.d.ts.map +1 -1
- package/dist/discrimination-gate.js +343 -51
- package/dist/discrimination-gate.js.map +1 -1
- package/dist/feature-adr-checkpoints.d.ts +22 -0
- package/dist/feature-adr-checkpoints.d.ts.map +1 -1
- package/dist/feature-adr-checkpoints.js +42 -0
- package/dist/feature-adr-checkpoints.js.map +1 -1
- package/dist/feature-adr-routing.d.ts +218 -5
- package/dist/feature-adr-routing.d.ts.map +1 -1
- package/dist/feature-adr-routing.js +583 -54
- package/dist/feature-adr-routing.js.map +1 -1
- package/dist/guard.d.ts +13 -0
- package/dist/guard.d.ts.map +1 -1
- package/dist/guard.js +25 -1
- package/dist/guard.js.map +1 -1
- package/dist/index.d.ts +23 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +37 -4
- package/dist/index.js.map +1 -1
- package/dist/loop-blobs.generated.d.ts +1 -1
- package/dist/loop-blobs.generated.d.ts.map +1 -1
- package/dist/loop-blobs.generated.js +12 -3
- package/dist/loop-blobs.generated.js.map +1 -1
- package/dist/loop-plan.d.ts +70 -0
- package/dist/loop-plan.d.ts.map +1 -1
- package/dist/loop-plan.js +103 -0
- package/dist/loop-plan.js.map +1 -1
- package/dist/loop-render.d.ts.map +1 -1
- package/dist/loop-render.js +37 -129
- package/dist/loop-render.js.map +1 -1
- package/dist/loop-run-semantics.d.ts +130 -0
- package/dist/loop-run-semantics.d.ts.map +1 -0
- package/dist/loop-run-semantics.js +257 -0
- package/dist/loop-run-semantics.js.map +1 -0
- package/dist/loop-trace.d.ts +31 -2
- package/dist/loop-trace.d.ts.map +1 -1
- package/dist/loop-trace.js +89 -12
- package/dist/loop-trace.js.map +1 -1
- package/dist/managed-hooks.d.ts +86 -0
- package/dist/managed-hooks.d.ts.map +1 -0
- package/dist/managed-hooks.js +101 -0
- package/dist/managed-hooks.js.map +1 -0
- package/dist/mutation-gate.d.ts +14 -0
- package/dist/mutation-gate.d.ts.map +1 -1
- package/dist/mutation-gate.js +25 -2
- package/dist/mutation-gate.js.map +1 -1
- package/dist/named-lock.d.ts +57 -0
- package/dist/named-lock.d.ts.map +1 -0
- package/dist/named-lock.js +247 -0
- package/dist/named-lock.js.map +1 -0
- package/dist/operations.d.ts +229 -0
- package/dist/operations.d.ts.map +1 -1
- package/dist/operations.js +880 -26
- package/dist/operations.js.map +1 -1
- package/dist/parity.d.ts +106 -1
- package/dist/parity.d.ts.map +1 -1
- package/dist/parity.js +209 -5
- package/dist/parity.js.map +1 -1
- package/dist/qe-bridge.d.ts +291 -0
- package/dist/qe-bridge.d.ts.map +1 -0
- package/dist/qe-bridge.js +538 -0
- package/dist/qe-bridge.js.map +1 -0
- package/dist/recall-usage.d.ts +53 -0
- package/dist/recall-usage.d.ts.map +1 -1
- package/dist/recall-usage.js +125 -2
- package/dist/recall-usage.js.map +1 -1
- package/dist/score.d.ts.map +1 -1
- package/dist/score.js +43 -9
- package/dist/score.js.map +1 -1
- package/dist/setup.d.ts.map +1 -1
- package/dist/setup.js +14 -26
- package/dist/setup.js.map +1 -1
- package/dist/shell-veto-policy.d.ts +53 -0
- package/dist/shell-veto-policy.d.ts.map +1 -0
- package/dist/shell-veto-policy.js +103 -0
- package/dist/shell-veto-policy.js.map +1 -0
- package/dist/skills.d.ts +86 -1
- package/dist/skills.d.ts.map +1 -1
- package/dist/skills.js +116 -1
- package/dist/skills.js.map +1 -1
- package/dist/targets.d.ts +75 -0
- package/dist/targets.d.ts.map +1 -1
- package/dist/targets.js +160 -0
- package/dist/targets.js.map +1 -1
- package/dist/workflow-run-dispatch.d.ts +230 -0
- package/dist/workflow-run-dispatch.d.ts.map +1 -0
- package/dist/workflow-run-dispatch.js +363 -0
- package/dist/workflow-run-dispatch.js.map +1 -0
- package/dist/workflow-run.d.ts +498 -0
- package/dist/workflow-run.d.ts.map +1 -0
- package/dist/workflow-run.js +1359 -0
- package/dist/workflow-run.js.map +1 -0
- package/package.json +6 -5
- package/sbom.json +1099 -139
- package/src/agents-policy.ts +338 -0
- package/src/codex-hooks-assets.ts +328 -0
- package/src/codex-hooks-verify.ts +237 -0
- package/src/codex-hooks.ts +723 -0
- package/src/discrimination-gate.ts +456 -58
- package/src/feature-adr-checkpoints.ts +38 -0
- package/src/feature-adr-routing.ts +697 -75
- package/src/guard.ts +36 -1
- package/src/index.ts +162 -2
- package/src/loop-blobs.generated.ts +12 -3
- package/src/loop-plan.ts +185 -0
- package/src/loop-render.ts +37 -127
- package/src/loop-run-semantics.ts +278 -0
- package/src/loop-trace.ts +84 -10
- package/src/managed-hooks.ts +150 -0
- package/src/mutation-gate.ts +24 -2
- package/src/named-lock.ts +277 -0
- package/src/operations.ts +1121 -29
- package/src/parity.ts +295 -6
- package/src/qe-bridge.ts +737 -0
- package/src/recall-usage.ts +184 -1
- package/src/score.ts +50 -9
- package/src/setup.ts +26 -27
- package/src/shell-veto-policy.ts +119 -0
- package/src/skills.ts +174 -1
- package/src/targets.ts +189 -0
- package/src/workflow-run-dispatch.ts +459 -0
- package/src/workflow-run.ts +1743 -0
package/dist/targets.js
CHANGED
|
@@ -36,4 +36,164 @@ export const TARGET_NAMES = Object.keys(TARGETS);
|
|
|
36
36
|
export function isTargetName(value) {
|
|
37
37
|
return Object.prototype.hasOwnProperty.call(TARGETS, value);
|
|
38
38
|
}
|
|
39
|
+
// ---------------------------------------------------------------------------
|
|
40
|
+
// `--target` resolution — alias table + did-you-mean (feature dz-cli-defects, D3)
|
|
41
|
+
//
|
|
42
|
+
// `isTargetName`, `TARGETS` and `TARGET_NAMES` above are UNCHANGED: `boundaries.json`
|
|
43
|
+
// names `isTargetName` as the scanned validation boundary for `--target`, and every
|
|
44
|
+
// resolution below ends in exactly that guard, so the security boundary is preserved
|
|
45
|
+
// rather than relocated (ADR-002 / architecture §3.1).
|
|
46
|
+
// ---------------------------------------------------------------------------
|
|
47
|
+
/** `TARGET_NAMES` sorted alphabetically, for display in error messages. */
|
|
48
|
+
export const TARGET_NAMES_SORTED = [...TARGET_NAMES].sort();
|
|
49
|
+
/**
|
|
50
|
+
* Semantic `--target` aliases — DATA, not branching logic. Adding a row is one line
|
|
51
|
+
* and zero control flow (ADR-002 §Rationale D5).
|
|
52
|
+
*
|
|
53
|
+
* Purely typographic variants (`Claude_Code`, `claudecode`, `agents.md`) are handled by
|
|
54
|
+
* normalisation, not by rows; the rows below carry only meanings normalisation cannot
|
|
55
|
+
* derive (`claude` ≠ `claude-code` by any string rule — it is an owner decision).
|
|
56
|
+
*/
|
|
57
|
+
export const TARGET_ALIASES = {
|
|
58
|
+
claude: 'claude-code',
|
|
59
|
+
cc: 'claude-code',
|
|
60
|
+
agents: 'agents-md',
|
|
61
|
+
gpt: 'codex',
|
|
62
|
+
openai: 'codex',
|
|
63
|
+
};
|
|
64
|
+
/** Levenshtein suggestions are only offered at or below this edit distance. */
|
|
65
|
+
export const TARGET_SUGGESTION_MAX_DISTANCE = 3;
|
|
66
|
+
/**
|
|
67
|
+
* Normalise a `--target` token for matching: byte-level lowercase (never
|
|
68
|
+
* `toLocaleLowerCase` — behaviour must not vary with the host locale), trimmed, with
|
|
69
|
+
* every separator dropped so `Claude_Code`, `claude-code` and `claudecode` collapse.
|
|
70
|
+
*
|
|
71
|
+
* Exported so the alias-REACHABILITY test can ask the production normaliser whether a
|
|
72
|
+
* proposed alias row is already carried by precedence step 2, instead of keeping a
|
|
73
|
+
* second copy of this rule in the test file (fix round 1, QE F7).
|
|
74
|
+
*/
|
|
75
|
+
export function normalizeTargetToken(value) {
|
|
76
|
+
return value.trim().toLowerCase().replace(/[-_.\s]/g, '');
|
|
77
|
+
}
|
|
78
|
+
/** Iterative two-row Levenshtein. No dependency: harness-core ships no fuzzy matcher. */
|
|
79
|
+
function levenshtein(a, b) {
|
|
80
|
+
if (a === b)
|
|
81
|
+
return 0;
|
|
82
|
+
if (a.length === 0)
|
|
83
|
+
return b.length;
|
|
84
|
+
if (b.length === 0)
|
|
85
|
+
return a.length;
|
|
86
|
+
let prev = Array.from({ length: b.length + 1 }, (_, i) => i);
|
|
87
|
+
let curr = new Array(b.length + 1).fill(0);
|
|
88
|
+
for (let i = 1; i <= a.length; i += 1) {
|
|
89
|
+
curr[0] = i;
|
|
90
|
+
for (let j = 1; j <= b.length; j += 1) {
|
|
91
|
+
const cost = a[i - 1] === b[j - 1] ? 0 : 1;
|
|
92
|
+
curr[j] = Math.min((curr[j - 1] ?? 0) + 1, (prev[j] ?? 0) + 1, (prev[j - 1] ?? 0) + cost);
|
|
93
|
+
}
|
|
94
|
+
const swap = prev;
|
|
95
|
+
prev = curr;
|
|
96
|
+
curr = swap;
|
|
97
|
+
}
|
|
98
|
+
return prev[b.length] ?? 0;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Suggest a canonical target for an input that did not resolve.
|
|
102
|
+
*
|
|
103
|
+
* Two legs, in order, and each closes a case the other cannot:
|
|
104
|
+
*
|
|
105
|
+
* - **unique normalised prefix** — carries `clau → claude-code`, which is edit distance 5
|
|
106
|
+
* and therefore unreachable by any sane Levenshtein threshold. An input that prefixes
|
|
107
|
+
* TWO OR MORE canonical names is AMBIGUOUS and terminates with **no** suggestion
|
|
108
|
+
* (`co` → `codex`/`copilot`): guessing between two live targets is worse than a
|
|
109
|
+
* round-trip, and the fall-through would otherwise hand `co` to `codex` on a distance
|
|
110
|
+
* of 3 — a confident answer to a question the user has not yet decided.
|
|
111
|
+
* - **Levenshtein ≤ 3, strictly better than the runner-up** — carries the typo case
|
|
112
|
+
* `clade-code → claude-code`. A tie yields `null` for the same reason.
|
|
113
|
+
*/
|
|
114
|
+
function suggestTargetName(normalized) {
|
|
115
|
+
if (normalized.length === 0)
|
|
116
|
+
return null;
|
|
117
|
+
const prefixHits = TARGET_NAMES_SORTED.filter((name) => normalizeTargetToken(name).startsWith(normalized));
|
|
118
|
+
if (prefixHits.length === 1)
|
|
119
|
+
return prefixHits[0] ?? null;
|
|
120
|
+
// Ambiguous prefix is TERMINAL, not a fall-through (see doc comment).
|
|
121
|
+
if (prefixHits.length > 1)
|
|
122
|
+
return null;
|
|
123
|
+
let best = null;
|
|
124
|
+
let bestDistance = Number.POSITIVE_INFINITY;
|
|
125
|
+
let runnerUpDistance = Number.POSITIVE_INFINITY;
|
|
126
|
+
for (const name of TARGET_NAMES_SORTED) {
|
|
127
|
+
const distance = levenshtein(normalized, normalizeTargetToken(name));
|
|
128
|
+
if (distance < bestDistance) {
|
|
129
|
+
runnerUpDistance = bestDistance;
|
|
130
|
+
bestDistance = distance;
|
|
131
|
+
best = name;
|
|
132
|
+
}
|
|
133
|
+
else if (distance < runnerUpDistance) {
|
|
134
|
+
runnerUpDistance = distance;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
if (best === null)
|
|
138
|
+
return null;
|
|
139
|
+
if (bestDistance > TARGET_SUGGESTION_MAX_DISTANCE)
|
|
140
|
+
return null;
|
|
141
|
+
// Strictly better than the runner-up — a tie is not a suggestion.
|
|
142
|
+
if (bestDistance === runnerUpDistance)
|
|
143
|
+
return null;
|
|
144
|
+
return best;
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Resolve a user-supplied `--target` value to a canonical {@link TargetName}.
|
|
148
|
+
*
|
|
149
|
+
* Total, pure, no I/O. Precedence (fixed and tested):
|
|
150
|
+
*
|
|
151
|
+
* 1. exact canonical hit → `{kind:'ok', via:'canonical'}` (`isTargetName` semantics);
|
|
152
|
+
* 2. normalised canonical hit → `{kind:'ok', via:'alias'}` (`Claude_Code`, `agentsmd`);
|
|
153
|
+
* 3. explicit {@link TARGET_ALIASES} row → `{kind:'ok', via:'alias'}`;
|
|
154
|
+
* 4. unique normalised prefix → `{kind:'unknown', suggestion}`;
|
|
155
|
+
* 5. Levenshtein ≤ 3 strictly better than the runner-up → `{kind:'unknown', suggestion}`;
|
|
156
|
+
* 6. otherwise → `{kind:'unknown', suggestion:null}`.
|
|
157
|
+
*
|
|
158
|
+
* **Aliases ACCEPT; prefix and Levenshtein only SUGGEST.** An alias row is an owner
|
|
159
|
+
* decision recorded in data; a fuzzy match is a guess, and silently installing to the
|
|
160
|
+
* wrong target on a guess is worse than one round-trip.
|
|
161
|
+
*/
|
|
162
|
+
export function resolveTargetName(value) {
|
|
163
|
+
if (isTargetName(value))
|
|
164
|
+
return { kind: 'ok', target: value, via: 'canonical' };
|
|
165
|
+
const normalized = normalizeTargetToken(value);
|
|
166
|
+
for (const name of TARGET_NAMES) {
|
|
167
|
+
if (normalizeTargetToken(name) === normalized) {
|
|
168
|
+
return { kind: 'ok', target: name, via: 'alias' };
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
const aliased = Object.prototype.hasOwnProperty.call(TARGET_ALIASES, normalized)
|
|
172
|
+
? TARGET_ALIASES[normalized]
|
|
173
|
+
: Object.prototype.hasOwnProperty.call(TARGET_ALIASES, value.trim().toLowerCase())
|
|
174
|
+
? TARGET_ALIASES[value.trim().toLowerCase()]
|
|
175
|
+
: undefined;
|
|
176
|
+
if (aliased !== undefined)
|
|
177
|
+
return { kind: 'ok', target: aliased, via: 'alias' };
|
|
178
|
+
return { kind: 'unknown', input: value, suggestion: suggestTargetName(normalized) };
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Render the two-line failure for an unresolvable `--target`.
|
|
182
|
+
*
|
|
183
|
+
* Line 2 keeps the literal substring `--target must be one of:` — three shipped
|
|
184
|
+
* assertions (`test/cli.test.ts`) pin it, and keeping the shape additive is what makes
|
|
185
|
+
* the D3 change prove itself with NEW tests instead of rewriting old ones. The values
|
|
186
|
+
* are {@link TARGET_NAMES_SORTED} (alphabetical), which the pre-change message was not.
|
|
187
|
+
*/
|
|
188
|
+
export function formatTargetProblem(command, resolution) {
|
|
189
|
+
const suggestion = resolution.suggestion !== null ? ` — did you mean ${JSON.stringify(resolution.suggestion)}?` : '';
|
|
190
|
+
return [
|
|
191
|
+
`${command}: unknown --target ${JSON.stringify(resolution.input)}${suggestion}`,
|
|
192
|
+
` --target must be one of: ${TARGET_NAMES_SORTED.join(', ')}`,
|
|
193
|
+
];
|
|
194
|
+
}
|
|
195
|
+
/** The one-line diagnostic emitted (on stderr) when an alias was accepted. */
|
|
196
|
+
export function formatTargetAliasNote(command, input, target) {
|
|
197
|
+
return `${command}: --target ${JSON.stringify(input)} → ${target} (alias)`;
|
|
198
|
+
}
|
|
39
199
|
//# sourceMappingURL=targets.js.map
|
package/dist/targets.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"targets.js","sourceRoot":"","sources":["../src/targets.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAE,aAAa,E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C,CAAC,cAAc,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;YAC5C,CAAC,CAAC,SAAS,CAAC;IAClB,IAAI,OAAO,KAAK,SAAS;QAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,CAAC;IAEhF,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,iBAAiB,CAAC,UAAU,CAAC,EAAE,CAAC;AACtF,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,mBAAmB,CACjC,OAAe,EACf,UAA0D;IAE1D,MAAM,UAAU,GACd,UAAU,CAAC,UAAU,KAAK,IAAI,CAAC,CAAC,CAAC,mBAAmB,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;IACpG,OAAO;QACL,GAAG,OAAO,sBAAsB,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,KAAK,CAAC,GAAG,UAAU,EAAE;QAC/E,8BAA8B,mBAAmB,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;KAC/D,CAAC;AACJ,CAAC;AAED,8EAA8E;AAC9E,MAAM,UAAU,qBAAqB,CAAC,OAAe,EAAE,KAAa,EAAE,MAAkB;IACtF,OAAO,GAAG,OAAO,cAAc,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,MAAM,MAAM,UAAU,CAAC;AAC7E,CAAC"}
|
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `workflow-run-dispatch` — the DISPATCHER SEAM of `dz workflow run` (ADR-002 O1).
|
|
3
|
+
*
|
|
4
|
+
* Why a seam at all: the two runtimes disagree about almost everything that matters (stdin open vs
|
|
5
|
+
* closed, envelope shape, where a deliverable appears, what a clean exit means), and the scheduler
|
|
6
|
+
* must not know any of it. What it knows is: ask for a dispatch, get back a typed outcome whose
|
|
7
|
+
* failure reason is a member of ONE list.
|
|
8
|
+
*
|
|
9
|
+
* Everything below the contract is CONVENTION — and every convention here is a MEASURED lesson, not
|
|
10
|
+
* a preference. Each one is named at its definition with the observation that produced it, because
|
|
11
|
+
* a convention whose reason is lost is the next thing somebody "cleans up".
|
|
12
|
+
*/
|
|
13
|
+
import type { Deliverable } from './loop-plan.js';
|
|
14
|
+
import { type BridgeFamily } from './qe-bridge.js';
|
|
15
|
+
import type { WfRunReason } from './workflow-run.js';
|
|
16
|
+
/** The dispatch REQUEST — every field resolved by the scheduler, so an adapter never re-decides. */
|
|
17
|
+
export interface DispatchRequest {
|
|
18
|
+
stepId: string;
|
|
19
|
+
/** The fanout member key, or null for a top-level step. */
|
|
20
|
+
itemKey: string | null;
|
|
21
|
+
/** 1-based; INCLUDES the initial attempt. */
|
|
22
|
+
attempt: number;
|
|
23
|
+
/** Fully assembled (USER prompt + shared contract lines + item binding), ingress-defanged. */
|
|
24
|
+
prompt: string;
|
|
25
|
+
/** Resolved at preflight (AM-8) — TOTAL, never inferred inside the adapter. */
|
|
26
|
+
family: BridgeFamily;
|
|
27
|
+
/** The PROBED id, never the requested spec: an allowlist says a name is spellable, only a probe
|
|
28
|
+
* says it answers. */
|
|
29
|
+
resolvedModelId: string;
|
|
30
|
+
deliverable: Deliverable;
|
|
31
|
+
/** Declared reads — the input paths a file-mode step is asked to OPEN. They travel so the adapter
|
|
32
|
+
* (and the scheduler's dispatch-time containment re-check) can hold them to the SAME realpath /
|
|
33
|
+
* symlinked-ancestor discipline as writes: a read that escapes the root is not safer than a write
|
|
34
|
+
* that does (Step-8 re-QE R3-A). */
|
|
35
|
+
expectedReads: string[];
|
|
36
|
+
/** Declared writes. The scheduler owns the landed barrier (it snapshots the baseline); the
|
|
37
|
+
* adapter only needs to know the step is in file mode. */
|
|
38
|
+
expectedWrites: string[];
|
|
39
|
+
timeoutMs: number;
|
|
40
|
+
/** Target tree for file mode; ignored by a return-value claude dispatch (isolated temp cwd). */
|
|
41
|
+
cwd: string;
|
|
42
|
+
}
|
|
43
|
+
export interface DispatchFailure {
|
|
44
|
+
reason: WfRunReason;
|
|
45
|
+
detail: string;
|
|
46
|
+
}
|
|
47
|
+
export interface DispatchResult {
|
|
48
|
+
/** Pinned to the trace settle vocabulary (`loop-trace.ts` settle outcomes) — one word, two planes. */
|
|
49
|
+
outcome: 'ok' | 'null' | 'error';
|
|
50
|
+
/** Envelope-extracted text; null on null/error. */
|
|
51
|
+
text: string | null;
|
|
52
|
+
family: BridgeFamily;
|
|
53
|
+
modelUsed: string | null;
|
|
54
|
+
wallMs: number;
|
|
55
|
+
/** null when the runtime did not report a count — NEVER 0, never estimated (ADR-004 C4). */
|
|
56
|
+
tokensIn: number | null;
|
|
57
|
+
tokensOut: number | null;
|
|
58
|
+
tokensSource: 'claude-envelope' | 'codex-stderr' | null;
|
|
59
|
+
failure?: DispatchFailure;
|
|
60
|
+
}
|
|
61
|
+
export interface ProbeOutcome {
|
|
62
|
+
/** The id that ANSWERED, or null when no candidate did. */
|
|
63
|
+
id: string | null;
|
|
64
|
+
wallMs: number;
|
|
65
|
+
detail: string;
|
|
66
|
+
}
|
|
67
|
+
export interface Dispatcher {
|
|
68
|
+
/** Once per run per family; the result is cached by the SCHEDULER and persisted into run-state
|
|
69
|
+
* (AM-8), so a resume compares against the id that actually ran. */
|
|
70
|
+
probe(candidates: string[]): Promise<ProbeOutcome>;
|
|
71
|
+
dispatch(req: DispatchRequest): Promise<DispatchResult>;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* The 4 reasons an ADAPTER may produce — the producer PARTITION of the one 22-member
|
|
75
|
+
* `WF_RUN_REASONS` list (K3). There is no second taxonomy: the type stays `WfRunReason`, and this
|
|
76
|
+
* array is the data a test uses to assert who is allowed to produce what. The other 18 members have
|
|
77
|
+
* preflight, scheduler or state-plane producers.
|
|
78
|
+
*/
|
|
79
|
+
export declare const DISPATCH_REASONS: readonly ["dispatch-timeout", "dispatch-dead", "prompt-over-ceiling", "probe-failed"];
|
|
80
|
+
export type DispatchReason = (typeof DISPATCH_REASONS)[number];
|
|
81
|
+
/** Measured 2026-08-12: a codex `exec` at xhigh effort needs this much wall clock at the far end of
|
|
82
|
+
* its distribution. Used as the scheduler's DEFAULT per-stage timeout when the operator gives none. */
|
|
83
|
+
export declare const CODEX_EXEC_XHIGH_TIMEOUT_MS = 560000;
|
|
84
|
+
export interface ChildRun {
|
|
85
|
+
stdout: string;
|
|
86
|
+
stderr: string;
|
|
87
|
+
exitCode: number | null;
|
|
88
|
+
timedOut: boolean;
|
|
89
|
+
spawnError: string | null;
|
|
90
|
+
}
|
|
91
|
+
export type ChildRunner = (bin: string, argv: string[], opts: {
|
|
92
|
+
stdinText: string | null;
|
|
93
|
+
timeoutMs: number;
|
|
94
|
+
cwd: string;
|
|
95
|
+
detached: boolean;
|
|
96
|
+
}) => Promise<ChildRun>;
|
|
97
|
+
/**
|
|
98
|
+
* W1 — the timeout/dead discriminator, decided on the WRAPPER'S OWN FIELDS and nothing else.
|
|
99
|
+
*
|
|
100
|
+
* The distinction is load-bearing because the two have different retry semantics and different
|
|
101
|
+
* operator meanings: a timeout says "it was still working", a dead dispatch says "nothing came
|
|
102
|
+
* back". Deciding it from stderr text would make the verdict depend on a runtime's phrasing.
|
|
103
|
+
*
|
|
104
|
+
* • `timedOut === true` ⇒ `timeout` — the deadline timer FIRED, full stop;
|
|
105
|
+
* • a spawn error, or `exitCode === null` WITHOUT a timeout ⇒ `dead` (the process never ran, or
|
|
106
|
+
* vanished);
|
|
107
|
+
* • anything else ⇒ `exited`, and the FAMILY parser decides. A clean exit with no parseable
|
|
108
|
+
* envelope is ALSO dead — the "spawned but mute" case — but that call belongs to the parser
|
|
109
|
+
* that knows what an envelope looks like, not to this function.
|
|
110
|
+
*/
|
|
111
|
+
export declare function classifyChildRun(run: ChildRun): {
|
|
112
|
+
kind: 'timeout';
|
|
113
|
+
} | {
|
|
114
|
+
kind: 'dead';
|
|
115
|
+
detail: string;
|
|
116
|
+
} | {
|
|
117
|
+
kind: 'exited';
|
|
118
|
+
exitCode: number;
|
|
119
|
+
};
|
|
120
|
+
/**
|
|
121
|
+
* Prepended to a RETURN-VALUE codex dispatch. Codex `exec` is an agent with a workspace, not a
|
|
122
|
+
* completion endpoint: without this it will happily start reading files to answer a question whose
|
|
123
|
+
* whole answer is in the prompt. Paired with `--sandbox read-only`, which makes the instruction
|
|
124
|
+
* enforceable rather than advisory.
|
|
125
|
+
*/
|
|
126
|
+
export declare const CODEX_SCOPING_PREFIX = "Answer directly from this prompt text alone; no commands, no files, no tools.";
|
|
127
|
+
/**
|
|
128
|
+
* The REAL prompt ceiling for `codex exec`.
|
|
129
|
+
*
|
|
130
|
+
* The folk value 1200 is refuted history: it came from an era when the prompt travelled through a
|
|
131
|
+
* fire-and-forget wrapper. Over-ceiling ⇒ a LOUD `prompt-over-ceiling`, never truncation — a
|
|
132
|
+
* truncated prompt produces a confident answer to a question nobody asked.
|
|
133
|
+
*/
|
|
134
|
+
export declare const CODEX_EXEC_PROMPT_CEILING_CHARS = 24000;
|
|
135
|
+
/**
|
|
136
|
+
* argv for one codex dispatch. The prompt travels as ONE argv element (no shell, no quoting), and
|
|
137
|
+
* `stdinText` is ALWAYS null for codex — MEASURED this session: with stdin left open, codex-cli
|
|
138
|
+
* 0.148.0 prints `Reading additional input from stdin...` and waits. `< /dev/null` is not a style
|
|
139
|
+
* choice; it is the difference between a 5.7 s answer and a hang.
|
|
140
|
+
*
|
|
141
|
+
* Return-value mode gets the scoping prefix AND `--sandbox read-only`. File mode gets NEITHER: the
|
|
142
|
+
* step's whole deliverable is a file it must be able to write.
|
|
143
|
+
*/
|
|
144
|
+
export declare function codexExecArgv(modelId: string, prompt: string, deliverable: Deliverable): string[];
|
|
145
|
+
/** The liveness probe: an allowlist says an id is SPELLABLE, only a probe says it ANSWERS. */
|
|
146
|
+
export declare function codexProbeArgv(candidateId: string): string[];
|
|
147
|
+
/** Word-bounded `OK` on a clean exit — the `interpretClaudeProbe` twin. */
|
|
148
|
+
export declare function interpretCodexProbe(out: {
|
|
149
|
+
stdout: string;
|
|
150
|
+
exitCode: number | null;
|
|
151
|
+
}): boolean;
|
|
152
|
+
/**
|
|
153
|
+
* Best-effort token extraction from codex stderr — null when absent, NEVER 0 and never estimated.
|
|
154
|
+
*
|
|
155
|
+
* MEASURED (codex-cli 0.148.0, this session): the trailer is a TOTAL only —
|
|
156
|
+
* `tokens used\n9,820` — with no input/output split. `wf-budget-1` has no field for a total, and
|
|
157
|
+
* attributing a total to either half would be a fabrication, so this returns BOTH nulls for that
|
|
158
|
+
* shape and the row's `tokensSource` stays null. The split branch below exists because some
|
|
159
|
+
* builds/configs do print one; it is tested, not assumed. (Named consequence: codex runs report no
|
|
160
|
+
* token counts today. That is the honest state, not a bug to paper over — see the manifest.)
|
|
161
|
+
*/
|
|
162
|
+
export declare function extractCodexTokens(stderr: string): {
|
|
163
|
+
tokensIn: number | null;
|
|
164
|
+
tokensOut: number | null;
|
|
165
|
+
};
|
|
166
|
+
/**
|
|
167
|
+
* The claude `--output-format json` USAGE fields, pinned to the LIVE envelope shape.
|
|
168
|
+
*
|
|
169
|
+
* MEASURED this session (`claude -p --output-format json`, sonnet):
|
|
170
|
+
* `usage.input_tokens = 2`, `usage.output_tokens = 4`, alongside `cache_read_input_tokens` and
|
|
171
|
+
* `cache_creation_input_tokens`. Only the two plain counters are reported — cache tokens are a
|
|
172
|
+
* SEPARATE dimension `wf-budget-1` has no field for, and silently folding them into `tokensIn`
|
|
173
|
+
* would inflate every cached run's cost picture. Added to the architecture's export list; see the
|
|
174
|
+
* manifest.
|
|
175
|
+
*/
|
|
176
|
+
export declare function extractClaudeUsage(stdout: string): {
|
|
177
|
+
tokensIn: number | null;
|
|
178
|
+
tokensOut: number | null;
|
|
179
|
+
};
|
|
180
|
+
/**
|
|
181
|
+
* The codex adapter. Conventions, each a Confirmation-1 assertion:
|
|
182
|
+
* stdin ALWAYS closed; the prompt as one argv element; scoping prefix + `--sandbox read-only` on
|
|
183
|
+
* return-value and NEITHER on file mode; `detached: true` on every spawn (AM-10).
|
|
184
|
+
*/
|
|
185
|
+
export declare function makeCodexExecDispatcher(run: ChildRunner, opts?: {
|
|
186
|
+
bin?: string;
|
|
187
|
+
ceilingChars?: number;
|
|
188
|
+
isolatedCwd?: () => string;
|
|
189
|
+
monotonicMs?: () => number;
|
|
190
|
+
}): Dispatcher;
|
|
191
|
+
/**
|
|
192
|
+
* The claude adapter. Return-value mode is the `dz qe-bridge` ISOLATION discipline verbatim:
|
|
193
|
+
* `claudeReviewArgs(model)` (which carries `CLAUDE_ISOLATION_ARGS`: `--output-format json`,
|
|
194
|
+
* `--safe-mode`, `--strict-mcp-config`, `--tools ''`, `--no-session-persistence`), an EMPTY temp
|
|
195
|
+
* cwd so no project state leaks in, the prompt on STDIN (no ARG_MAX ceiling, no shell), and a
|
|
196
|
+
* LAST-anchored envelope parse so anything a customization printed first is structurally outside
|
|
197
|
+
* the reviewed text.
|
|
198
|
+
*
|
|
199
|
+
* File mode drops `--tools ''` and `--safe-mode` (the step's deliverable is a file it must write)
|
|
200
|
+
* and runs in `req.cwd`, but keeps `--output-format json` and the envelope parse — and the
|
|
201
|
+
* scheduler's landed barrier still has the last word.
|
|
202
|
+
*/
|
|
203
|
+
export declare function makeClaudePDispatcher(run: ChildRunner, opts?: {
|
|
204
|
+
bin?: string;
|
|
205
|
+
isolatedCwd?: () => string;
|
|
206
|
+
monotonicMs?: () => number;
|
|
207
|
+
}): Dispatcher;
|
|
208
|
+
/**
|
|
209
|
+
* FILE-mode claude argv: the isolation set MINUS the two flags that would make writing impossible
|
|
210
|
+
* (`--tools ''` and `--safe-mode`). Everything that makes the reply READABLE stays — the envelope
|
|
211
|
+
* is how the runner tells an answer from a banner, in either mode.
|
|
212
|
+
*/
|
|
213
|
+
export declare function claudeFileArgs(model: string): string[] | null;
|
|
214
|
+
/**
|
|
215
|
+
* Neutralize anchored `GATE: PASS|FAIL` lines inside UPSTREAM text before it is spliced into a
|
|
216
|
+
* DOWNSTREAM prompt.
|
|
217
|
+
*
|
|
218
|
+
* Why this exists as a second defence, when `gateVerdict` is already LAST-anchored: the two attacks
|
|
219
|
+
* are different. The egress parser stops a single reply from smuggling a verdict past its own
|
|
220
|
+
* terminal line. This stops a reply that legitimately CONTAINS a verdict — an upstream gate's own
|
|
221
|
+
* answer — from becoming the terminal line of a DOWNSTREAM step's reply once the model quotes its
|
|
222
|
+
* input back. Without it, "please review the previous verdict" is a working exploit against a plan
|
|
223
|
+
* that never did anything wrong.
|
|
224
|
+
*
|
|
225
|
+
* NEUTRALIZATION, not deletion: the words survive so the downstream model can still read what the
|
|
226
|
+
* upstream said. Only the ANCHORED grammar is broken. Idempotent — defanging twice is defanging
|
|
227
|
+
* once, so a value that travels through three steps is not progressively mangled.
|
|
228
|
+
*/
|
|
229
|
+
export declare function defangGateEchoes(text: string): string;
|
|
230
|
+
//# sourceMappingURL=workflow-run-dispatch.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workflow-run-dispatch.d.ts","sourceRoot":"","sources":["../src/workflow-run-dispatch.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAgF,KAAK,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACjI,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErD,oGAAoG;AACpG,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,2DAA2D;IAC3D,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,6CAA6C;IAC7C,OAAO,EAAE,MAAM,CAAC;IAChB,8FAA8F;IAC9F,MAAM,EAAE,MAAM,CAAC;IACf,+EAA+E;IAC/E,MAAM,EAAE,YAAY,CAAC;IACrB;0BACsB;IACtB,eAAe,EAAE,MAAM,C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