@claudexor/orchestrator 1.0.1 → 2.1.3
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/attemptTelemetry.d.ts +47 -2
- package/dist/attemptTelemetry.d.ts.map +1 -1
- package/dist/attemptTelemetry.js +100 -2
- package/dist/attemptTelemetry.js.map +1 -1
- package/dist/attemptUsage.d.ts +19 -0
- package/dist/attemptUsage.d.ts.map +1 -0
- package/dist/attemptUsage.js +29 -0
- package/dist/attemptUsage.js.map +1 -0
- package/dist/candidateEvidence.d.ts +22 -0
- package/dist/candidateEvidence.d.ts.map +1 -0
- package/dist/candidateEvidence.js +42 -0
- package/dist/candidateEvidence.js.map +1 -0
- package/dist/candidateOutputs.d.ts +43 -0
- package/dist/candidateOutputs.d.ts.map +1 -0
- package/dist/candidateOutputs.js +146 -0
- package/dist/candidateOutputs.js.map +1 -0
- package/dist/contract-gates.d.ts +21 -0
- package/dist/contract-gates.d.ts.map +1 -0
- package/dist/contract-gates.js +93 -0
- package/dist/contract-gates.js.map +1 -0
- package/dist/credential-profiles.d.ts +162 -0
- package/dist/credential-profiles.d.ts.map +1 -0
- package/dist/credential-profiles.js +357 -0
- package/dist/credential-profiles.js.map +1 -0
- package/dist/diffReview.d.ts +12 -1
- package/dist/diffReview.d.ts.map +1 -1
- package/dist/diffReview.js +117 -18
- package/dist/diffReview.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/modelGovernance.d.ts +6 -1
- package/dist/modelGovernance.d.ts.map +1 -1
- package/dist/modelGovernance.js +8 -2
- package/dist/modelGovernance.js.map +1 -1
- package/dist/orchestrateExecutor.d.ts +43 -0
- package/dist/orchestrateExecutor.d.ts.map +1 -0
- package/dist/orchestrateExecutor.js +207 -0
- package/dist/orchestrateExecutor.js.map +1 -0
- package/dist/orchestratePlanner.d.ts.map +1 -1
- package/dist/orchestratePlanner.js.map +1 -1
- package/dist/orchestrator.d.ts +97 -85
- package/dist/orchestrator.d.ts.map +1 -1
- package/dist/orchestrator.js +1056 -1090
- package/dist/orchestrator.js.map +1 -1
- package/dist/outcomeReducer.d.ts +25 -0
- package/dist/outcomeReducer.d.ts.map +1 -0
- package/dist/outcomeReducer.js +121 -0
- package/dist/outcomeReducer.js.map +1 -0
- package/dist/policyFindings.d.ts +18 -0
- package/dist/policyFindings.d.ts.map +1 -0
- package/dist/policyFindings.js +166 -0
- package/dist/policyFindings.js.map +1 -0
- package/dist/requestRequirements.d.ts +38 -0
- package/dist/requestRequirements.d.ts.map +1 -0
- package/dist/requestRequirements.js +127 -0
- package/dist/requestRequirements.js.map +1 -0
- package/dist/reviewerPanel.d.ts +15 -1
- package/dist/reviewerPanel.d.ts.map +1 -1
- package/dist/reviewerPanel.js +85 -2
- package/dist/reviewerPanel.js.map +1 -1
- package/dist/routeContext.d.ts +37 -0
- package/dist/routeContext.d.ts.map +1 -0
- package/dist/routeContext.js +38 -0
- package/dist/routeContext.js.map +1 -0
- package/dist/runSupport.d.ts +37 -21
- package/dist/runSupport.d.ts.map +1 -1
- package/dist/runSupport.js +102 -78
- package/dist/runSupport.js.map +1 -1
- package/dist/runTelemetryWriter.d.ts +20 -0
- package/dist/runTelemetryWriter.d.ts.map +1 -0
- package/dist/runTelemetryWriter.js +68 -0
- package/dist/runTelemetryWriter.js.map +1 -0
- package/dist/runTerminals.d.ts +7 -1
- package/dist/runTerminals.d.ts.map +1 -1
- package/dist/runTerminals.js +42 -4
- package/dist/runTerminals.js.map +1 -1
- package/dist/structuredOutput.d.ts +33 -0
- package/dist/structuredOutput.d.ts.map +1 -0
- package/dist/structuredOutput.js +106 -0
- package/dist/structuredOutput.js.map +1 -0
- package/package.json +19 -18
- package/dist/finalVerifier.d.ts +0 -25
- package/dist/finalVerifier.d.ts.map +0 -1
- package/dist/finalVerifier.js +0 -110
- package/dist/finalVerifier.js.map +0 -1
package/dist/reviewerPanel.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { estimateEffectiveAuthRoute, knownModelIdsForRoute } from "@claudexor/schema";
|
|
1
2
|
import { HarnessUnavailableError, validateModel } from "@claudexor/core";
|
|
2
3
|
import { WorkspaceManager } from "@claudexor/workspace";
|
|
3
4
|
const MODEL_INVENTORY_RETRY_DELAY_MS = 250;
|
|
@@ -38,6 +39,7 @@ export async function resolveExplicitReviewerPanel(deps, panel) {
|
|
|
38
39
|
status: report.status,
|
|
39
40
|
enabledIntents: report.enabled_intents,
|
|
40
41
|
reasons: report.reasons ?? [],
|
|
42
|
+
authSources: report.auth_sources ?? [],
|
|
41
43
|
});
|
|
42
44
|
}
|
|
43
45
|
catch (err) {
|
|
@@ -46,6 +48,7 @@ export async function resolveExplicitReviewerPanel(deps, panel) {
|
|
|
46
48
|
status: "unavailable",
|
|
47
49
|
enabledIntents: [],
|
|
48
50
|
reasons: [err instanceof Error ? err.message : String(err)],
|
|
51
|
+
authSources: [],
|
|
49
52
|
});
|
|
50
53
|
}
|
|
51
54
|
}
|
|
@@ -72,7 +75,7 @@ export async function resolveExplicitReviewerPanel(deps, panel) {
|
|
|
72
75
|
// STRICT: the manifest list is the truth source here; an empty
|
|
73
76
|
// list means the harness cannot verify models and the explicit
|
|
74
77
|
// model is refused (validateModel phrases both refusals).
|
|
75
|
-
const check = validateModel(requestedModel, manifest.capabilities.known_models, "manifest");
|
|
78
|
+
const check = validateModel(requestedModel, knownModelIdsForRoute(manifest.capabilities.known_models, estimateEffectiveAuthRoute(authPreference, status.authSources)), "manifest");
|
|
76
79
|
if (check.status !== "ok") {
|
|
77
80
|
throw new HarnessUnavailableError(`reviewer harness '${entry.harness}' refused requested model '${requestedModel}': ${check.message}; run \`claudexor models --harness ${entry.harness}\``);
|
|
78
81
|
}
|
|
@@ -99,7 +102,9 @@ export async function resolveExplicitReviewerPanel(deps, panel) {
|
|
|
99
102
|
const requestedEffort = entry.effort ?? null;
|
|
100
103
|
if (requestedEffort && !manifest.capabilities.effort_levels.includes(requestedEffort)) {
|
|
101
104
|
const supported = manifest.capabilities.effort_levels.join(", ");
|
|
102
|
-
const suffix = supported
|
|
105
|
+
const suffix = supported
|
|
106
|
+
? ` (supported: ${supported})`
|
|
107
|
+
: " (harness declares no effort controls)";
|
|
103
108
|
throw new HarnessUnavailableError(`reviewer harness '${entry.harness}' does not support requested effort '${requestedEffort}'${suffix}`);
|
|
104
109
|
}
|
|
105
110
|
specs.push({
|
|
@@ -116,6 +121,84 @@ export async function resolveExplicitReviewerPanel(deps, panel) {
|
|
|
116
121
|
}
|
|
117
122
|
return specs;
|
|
118
123
|
}
|
|
124
|
+
/**
|
|
125
|
+
* Auto reviewer-panel selection (no owner-configured panel): pick up to two
|
|
126
|
+
* doctor-ok, readonly-review-capable harnesses from DISTINCT provider
|
|
127
|
+
* families. Eligibility consumes a point-probe in the same scoped read-only
|
|
128
|
+
* env shape the reviewers later run with, and the STRICT model truth gate
|
|
129
|
+
* applies to any per-family/default model override — a doomed reviewer model
|
|
130
|
+
* is refused here, never forwarded to die as an opaque native error
|
|
131
|
+
* mid-review.
|
|
132
|
+
*/
|
|
133
|
+
export async function resolveAutoReviewerPanel(deps, overrides = {}) {
|
|
134
|
+
const { cwd, registry, harnessSettings } = deps;
|
|
135
|
+
const specs = [];
|
|
136
|
+
const seen = new Set();
|
|
137
|
+
const reviewHome = new WorkspaceManager(cwd).readOnlyHomeEnv();
|
|
138
|
+
try {
|
|
139
|
+
for (const adapter of registry.values()) {
|
|
140
|
+
let m = null;
|
|
141
|
+
try {
|
|
142
|
+
m = await adapter.discover();
|
|
143
|
+
}
|
|
144
|
+
catch {
|
|
145
|
+
continue;
|
|
146
|
+
}
|
|
147
|
+
if (!m || m.kind === "fake" || seen.has(m.provider_family))
|
|
148
|
+
continue;
|
|
149
|
+
// Per-harness settings gate reviewers before doctor/model probes: a disabled
|
|
150
|
+
// harness must not spend auth/API-key readiness checks.
|
|
151
|
+
if (harnessSettings[adapter.id]?.enabled === false)
|
|
152
|
+
continue;
|
|
153
|
+
const authPreference = deps.authPreferenceFor(adapter.id);
|
|
154
|
+
let report = null;
|
|
155
|
+
try {
|
|
156
|
+
report = await adapter.doctor({ cwd, env: reviewHome.env, authPreference });
|
|
157
|
+
}
|
|
158
|
+
catch {
|
|
159
|
+
continue;
|
|
160
|
+
}
|
|
161
|
+
if (report.status !== "ok")
|
|
162
|
+
continue; // reviewer eligibility needs scoped doctor-OK.
|
|
163
|
+
if (!report.enabled_intents.includes("review"))
|
|
164
|
+
continue;
|
|
165
|
+
if (!m.capabilities.review || !m.access_profiles_supported.includes("readonly"))
|
|
166
|
+
continue;
|
|
167
|
+
// Explicit per-family override first, then the user's per-harness
|
|
168
|
+
// default model: an explicit model request makes the route provable
|
|
169
|
+
// (accepted_model_arg) on CLIs that never echo their model.
|
|
170
|
+
const requestedModel = overrides.reviewerModels?.[m.provider_family] ??
|
|
171
|
+
harnessSettings[adapter.id]?.default_model ??
|
|
172
|
+
null;
|
|
173
|
+
// STRICT: the auto panel applies the SAME model truth gate as the
|
|
174
|
+
// explicit panel — a doomed reviewer model is refused here, never
|
|
175
|
+
// forwarded to die as an opaque native error mid-review.
|
|
176
|
+
if (requestedModel) {
|
|
177
|
+
const check = validateModel(requestedModel, typeof adapter.models === "function"
|
|
178
|
+
? (await adapter.models({ cwd, env: reviewHome.env, authPreference })).map((x) => x.id)
|
|
179
|
+
: knownModelIdsForRoute(m.capabilities.known_models, estimateEffectiveAuthRoute(authPreference, report.auth_sources)), typeof adapter.models === "function" ? "api" : "manifest");
|
|
180
|
+
if (check.status !== "ok") {
|
|
181
|
+
throw new HarnessUnavailableError(`auto-selected reviewer harness '${adapter.id}' refused model '${requestedModel}': ${check.message}; ` +
|
|
182
|
+
`fix the reviewer model override or harnesses.${adapter.id}.default_model, or run \`claudexor models --harness ${adapter.id}\``);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
seen.add(m.provider_family);
|
|
186
|
+
specs.push({
|
|
187
|
+
adapter,
|
|
188
|
+
providerFamily: m.provider_family,
|
|
189
|
+
requestedModel,
|
|
190
|
+
requestedEffort: overrides.reviewerEfforts?.[m.provider_family] ?? null,
|
|
191
|
+
authPreference,
|
|
192
|
+
});
|
|
193
|
+
if (specs.length >= 2)
|
|
194
|
+
break;
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
finally {
|
|
198
|
+
reviewHome.dispose();
|
|
199
|
+
}
|
|
200
|
+
return specs;
|
|
201
|
+
}
|
|
119
202
|
/** One retry with a short delay: transient inventory hiccups (cold auth,
|
|
120
203
|
* slow first call) must not fail a panel that would succeed a moment later —
|
|
121
204
|
* but a persistently empty/erroring inventory still refuses loudly. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reviewerPanel.js","sourceRoot":"","sources":["../src/reviewerPanel.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"reviewerPanel.js","sourceRoot":"","sources":["../src/reviewerPanel.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAE,0BAA0B,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAEtF,OAAO,EAAE,uBAAuB,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACzE,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAGxD,MAAM,8BAA8B,GAAG,GAAG,CAAC;AAc3C,MAAM,CAAC,KAAK,UAAU,4BAA4B,CAChD,IAAuB,EACvB,KAAkC;IAElC,MAAM,EAAE,GAAG,EAAE,QAAQ,EAAE,eAAe,EAAE,GAAG,IAAI,CAAC;IAChD,MAAM,KAAK,GAAG,CAAC,GAAG,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACrD,MAAM,cAAc,GAAG,IAAI,GAAG,EAAuB,CAAC;IACtD,MAAM,aAAa,GAAG,IAAI,GAAG,EAS1B,CAAC;IACJ,MAAM,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B,cAAc,EAAE,KAAK,CAAC,cAAc;aACrC,CAAC,CAAC;YACH,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;gBACxB,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAC;YAC/C,CAAC;YACD,OAAO,IAAI,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;QAC1C,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,SAAS,GAAG,GAAG,CAAC;YAChB,IAAI,OAAO,KAAK,CAAC,EAAE,CAAC;gBAClB,MAAM,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,8BAA8B,CAAC,CAAC,CAAC;YACtF,CAAC;QACH,CAAC;IACH,CAAC;IACD,MAAM,MAAM,GAAG,SAAS,YAAY,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,SAAS,IAAI,SAAS,CAAC,CAAC;IAC/F,MAAM,IAAI,uBAAuB,CAC/B,qBAAqB,KAAK,CAAC,SAAS,uCAAuC,KAAK,CAAC,cAAc,0DAA0D,MAAM,sCAAsC,KAAK,CAAC,SAAS,IAAI,CACzN,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { AuthPreference } from "@claudexor/schema";
|
|
2
|
+
import type { DoctorSpec } from "@claudexor/core";
|
|
3
|
+
import type { HarnessStatus } from "@claudexor/gateway";
|
|
4
|
+
/**
|
|
5
|
+
* The effective execution context a routed run will actually spawn in,
|
|
6
|
+
* resolved ONCE per run and consumed by BOTH the routing readiness
|
|
7
|
+
* point-probe and the spawned spec (W3.3 / TZ-1 §B). Readiness evidence
|
|
8
|
+
* gathered in one env while the run executes in another is not evidence:
|
|
9
|
+
* the route-admitting probe and the run must share this exact context.
|
|
10
|
+
*/
|
|
11
|
+
export interface ResolvedRouteContext {
|
|
12
|
+
/** Execution root the run (and its readiness point-probe) use as cwd. */
|
|
13
|
+
cwd: string;
|
|
14
|
+
/** Scoped env the run will receive verbatim in `spec.env`. */
|
|
15
|
+
env: Record<string, string>;
|
|
16
|
+
/** Release the scoped state after the run (or a failed routing) ends. */
|
|
17
|
+
dispose: () => void;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Resolve the read-only route context: the scoped throwaway HOME every
|
|
21
|
+
* read-only attempt of this run will spawn with (workspace §6/§7 containment).
|
|
22
|
+
*/
|
|
23
|
+
export declare function resolveReadOnlyRouteContext(execRoot: string): ResolvedRouteContext;
|
|
24
|
+
/**
|
|
25
|
+
* The readiness truth that ADMITS one candidate route. Without a route
|
|
26
|
+
* context this is the host-level statusAll evidence unchanged. With one, the
|
|
27
|
+
* env-sensitive evidence (auth truth, reasons, auth sources) is re-derived by
|
|
28
|
+
* a source-targeted point-probe in the exact env/cwd the run will spawn with,
|
|
29
|
+
* and the ordering map is updated so pool ordering consumes the same truth.
|
|
30
|
+
* Discovery stays host-level: a candidate host discovery dropped is never
|
|
31
|
+
* probed or resurrected here. `fresh` keeps the per-run scoped env (a unique
|
|
32
|
+
* tmp path that would never be hit again) out of the shared doctor cache.
|
|
33
|
+
*/
|
|
34
|
+
export declare function candidateStatusInRouteContext(gateway: {
|
|
35
|
+
routeStatus(id: string, spec: DoctorSpec): Promise<HarnessStatus | null>;
|
|
36
|
+
}, ctx: ResolvedRouteContext | undefined, harnessId: string, authPreference: AuthPreference, statusById: Map<string, HarnessStatus>): Promise<HarnessStatus | undefined>;
|
|
37
|
+
//# sourceMappingURL=routeContext.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"routeContext.d.ts","sourceRoot":"","sources":["../src/routeContext.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAGxD;;;;;;GAMG;AACH,MAAM,WAAW,oBAAoB;IACnC,yEAAyE;IACzE,GAAG,EAAE,MAAM,CAAC;IACZ,8DAA8D;IAC9D,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC5B,yEAAyE;IACzE,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAED;;;GAGG;AACH,wBAAgB,2BAA2B,CAAC,QAAQ,EAAE,MAAM,GAAG,oBAAoB,CAGlF;AAED;;;;;;;;;GASG;AACH,wBAAsB,6BAA6B,CACjD,OAAO,EAAE;IAAE,WAAW,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC,CAAA;CAAE,EACrF,GAAG,EAAE,oBAAoB,GAAG,SAAS,EACrC,SAAS,EAAE,MAAM,EACjB,cAAc,EAAE,cAAc,EAC9B,UAAU,EAAE,GAAG,CAAC,MAAM,EAAE,aAAa,CAAC,GACrC,OAAO,CAAC,aAAa,GAAG,SAAS,CAAC,CAepC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { WorkspaceManager } from "@claudexor/workspace";
|
|
2
|
+
/**
|
|
3
|
+
* Resolve the read-only route context: the scoped throwaway HOME every
|
|
4
|
+
* read-only attempt of this run will spawn with (workspace §6/§7 containment).
|
|
5
|
+
*/
|
|
6
|
+
export function resolveReadOnlyRouteContext(execRoot) {
|
|
7
|
+
const scoped = new WorkspaceManager(execRoot).readOnlyHomeEnv();
|
|
8
|
+
return { cwd: execRoot, env: scoped.env, dispose: scoped.dispose };
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* The readiness truth that ADMITS one candidate route. Without a route
|
|
12
|
+
* context this is the host-level statusAll evidence unchanged. With one, the
|
|
13
|
+
* env-sensitive evidence (auth truth, reasons, auth sources) is re-derived by
|
|
14
|
+
* a source-targeted point-probe in the exact env/cwd the run will spawn with,
|
|
15
|
+
* and the ordering map is updated so pool ordering consumes the same truth.
|
|
16
|
+
* Discovery stays host-level: a candidate host discovery dropped is never
|
|
17
|
+
* probed or resurrected here. `fresh` keeps the per-run scoped env (a unique
|
|
18
|
+
* tmp path that would never be hit again) out of the shared doctor cache.
|
|
19
|
+
*/
|
|
20
|
+
export async function candidateStatusInRouteContext(gateway, ctx, harnessId, authPreference, statusById) {
|
|
21
|
+
const host = statusById.get(harnessId);
|
|
22
|
+
if (!ctx || !host?.manifest)
|
|
23
|
+
return host;
|
|
24
|
+
const scoped = await gateway.routeStatus(harnessId, {
|
|
25
|
+
cwd: ctx.cwd,
|
|
26
|
+
env: ctx.env,
|
|
27
|
+
authPreference,
|
|
28
|
+
fresh: true,
|
|
29
|
+
});
|
|
30
|
+
// Fail CLOSED (release wave sol #1): a null scoped probe is ABSENT evidence
|
|
31
|
+
// for the env this route would actually run in — host readiness must not
|
|
32
|
+
// stand in for it (the W3.3 same-context guarantee).
|
|
33
|
+
if (!scoped)
|
|
34
|
+
return undefined;
|
|
35
|
+
statusById.set(harnessId, scoped);
|
|
36
|
+
return scoped;
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=routeContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"routeContext.js","sourceRoot":"","sources":["../src/routeContext.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAkBxD;;;GAGG;AACH,MAAM,UAAU,2BAA2B,CAAC,QAAgB;IAC1D,MAAM,MAAM,GAAG,IAAI,gBAAgB,CAAC,QAAQ,CAAC,CAAC,eAAe,EAAE,CAAC;IAChE,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,CAAC,GAAG,EAAE,OAAO,EAAE,MAAM,CAAC,OAAO,EAAE,CAAC;AACrE,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,CAAC,KAAK,UAAU,6BAA6B,CACjD,OAAqF,EACrF,GAAqC,EACrC,SAAiB,EACjB,cAA8B,EAC9B,UAAsC;IAEtC,MAAM,IAAI,GAAG,UAAU,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;IACvC,IAAI,CAAC,GAAG,IAAI,CAAC,IAAI,EAAE,QAAQ;QAAE,OAAO,IAAI,CAAC;IACzC,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,WAAW,CAAC,SAAS,EAAE;QAClD,GAAG,EAAE,GAAG,CAAC,GAAG;QACZ,GAAG,EAAE,GAAG,CAAC,GAAG;QACZ,cAAc;QACd,KAAK,EAAE,IAAI;KACZ,CAAC,CAAC;IACH,4EAA4E;IAC5E,yEAAyE;IACzE,qDAAqD;IACrD,IAAI,CAAC,MAAM;QAAE,OAAO,SAAS,CAAC;IAC9B,UAAU,CAAC,GAAG,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;IAClC,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
package/dist/runSupport.d.ts
CHANGED
|
@@ -3,10 +3,35 @@
|
|
|
3
3
|
* prompt constraints, harness-event redaction/payload projection, and the
|
|
4
4
|
* run summary/findings renderers. Pure functions — no orchestrator state.
|
|
5
5
|
*/
|
|
6
|
-
import type { HarnessEvent, ModeKind, ProtectedPathApproval, ReviewFinding } from "@claudexor/schema";
|
|
6
|
+
import type { HarnessEvent, ModeKind, ProtectedPathApproval, ReviewFinding, DecisionRecord, FinalVerifyRecord, RunStatus } from "@claudexor/schema";
|
|
7
7
|
import type { EventLog } from "@claudexor/event-log";
|
|
8
8
|
import type { CandidateEvidence } from "@claudexor/arbitration";
|
|
9
|
+
import { type BudgetLedger } from "@claudexor/budget";
|
|
9
10
|
import type { BudgetObservation, InteractionAnswerSet } from "@claudexor/schema";
|
|
11
|
+
import { ArtifactStore } from "@claudexor/artifact-store";
|
|
12
|
+
/** Typed terminal evidence for a fresh-verified race whose live delivery was refused. */
|
|
13
|
+
export declare function deliveryRefusalDecisionFields(evidenceFacts: string[], reason: string): {
|
|
14
|
+
status: "blocked";
|
|
15
|
+
outcome: "blocked";
|
|
16
|
+
apply_recommendation: "inspect";
|
|
17
|
+
evidence_facts: string[];
|
|
18
|
+
};
|
|
19
|
+
export declare function deliveryRefusalFailure(reason: string, runDir: string): {
|
|
20
|
+
phase: string;
|
|
21
|
+
category: string;
|
|
22
|
+
safeMessage: string;
|
|
23
|
+
rawDetailRef: string;
|
|
24
|
+
runDir: string;
|
|
25
|
+
nextActions: string[];
|
|
26
|
+
};
|
|
27
|
+
export declare function writeRaceDeliveryDecision(store: ArtifactStore, path: string, input: {
|
|
28
|
+
decision: DecisionRecord;
|
|
29
|
+
status: RunStatus;
|
|
30
|
+
reviewVerified: boolean;
|
|
31
|
+
finalVerify: FinalVerifyRecord | null;
|
|
32
|
+
deliveryFailureReason: string | null;
|
|
33
|
+
deliveryReceiptPath: string | null;
|
|
34
|
+
}): void;
|
|
10
35
|
/**
|
|
11
36
|
* Relay cross-share: the prior planners' plans, injected into a later
|
|
12
37
|
* planner's prompt so the harnesses CONVERGE on an aligned plan instead of
|
|
@@ -24,17 +49,11 @@ export interface TransientRetryPolicy {
|
|
|
24
49
|
maxDelayMs: number;
|
|
25
50
|
}
|
|
26
51
|
export declare function transientRetryDelayMs(nativeDelayMs: number | null, policy: TransientRetryPolicy, retryIndex: number): number;
|
|
27
|
-
export declare function gateProtectedPaths(
|
|
52
|
+
export declare function gateProtectedPaths(commandTokens: string[]): string[];
|
|
28
53
|
export declare function promptWithProtectedPathConstraint(prompt: string, protectedPaths: string[], autoProtectedPaths?: string[], approvals?: ProtectedPathApproval[]): string;
|
|
29
54
|
export declare function sleep(ms: number): Promise<void>;
|
|
30
55
|
export declare function redactHarnessEvent(ev: HarnessEvent): HarnessEvent;
|
|
31
56
|
export declare function harnessEventPayload(harnessId: string, attemptId: string, ev: HarnessEvent): Record<string, unknown>;
|
|
32
|
-
/**
|
|
33
|
-
* Deduplicate the known "final result repeats the last streamed message" shape
|
|
34
|
-
* (adjacent only). Legitimately repeated earlier messages are preserved — a
|
|
35
|
-
* whole-array dedupe would silently merge real output.
|
|
36
|
-
*/
|
|
37
|
-
export declare function pushUniqueText(parts: string[], text: string): void;
|
|
38
57
|
export declare function formatFindings(findings: ReviewFinding[]): string;
|
|
39
58
|
export declare function renderSummary(runId: string, mode: ModeKind, decision: {
|
|
40
59
|
winner: string | null;
|
|
@@ -43,8 +62,6 @@ export declare function renderSummary(runId: string, mode: ModeKind, decision: {
|
|
|
43
62
|
why_winner: string;
|
|
44
63
|
apply_recommendation: string;
|
|
45
64
|
}, evidences: CandidateEvidence[], synthReason: string, reviewVerified: boolean): string;
|
|
46
|
-
/** Pure read: a referenced run's decision/work_product status, or null. */
|
|
47
|
-
export declare function readRunStatus(repoRoot: string, runId: string): string | null;
|
|
48
65
|
/** Pure read: a referenced run's recorded patch diff, or null. */
|
|
49
66
|
export declare function readRunPatch(repoRoot: string, runId: string): string | null;
|
|
50
67
|
/** Config-derived runtime knobs (pure projections of ResolvedConfig). */
|
|
@@ -71,10 +88,6 @@ export declare function harnessInactivityTimeoutMs(cfg: ResolvedConfigLike): num
|
|
|
71
88
|
/** Typed auth-switch disclosure: adapters mark auth_switched on a message;
|
|
72
89
|
* the run event log gets the typed route.fallback payload. */
|
|
73
90
|
export declare function observeAuthSwitch(log: EventLog | undefined, harnessId: string, attemptId: string, ev: HarnessEvent): void;
|
|
74
|
-
/** Observe ALL budget/quota signals from one harness event and disclose
|
|
75
|
-
* quota pressure ONCE per attempt (crossing semantics). One owner — the
|
|
76
|
-
* agent, plan, and read-only loops all consume this instead of pasting the
|
|
77
|
-
* loop (critic finding: triplicated logic drifts). */
|
|
78
91
|
export declare function observeBudgetSignals(ledger: {
|
|
79
92
|
observe(o: BudgetObservation): void;
|
|
80
93
|
}, log: {
|
|
@@ -87,7 +100,7 @@ export declare function observeBudgetSignals(ledger: {
|
|
|
87
100
|
* actually moved — STAY (every alternative cooling) is a retry, not a
|
|
88
101
|
* fallback. Returns the (possibly unchanged) idx. */
|
|
89
102
|
export declare function rotateOnStall(poolIds: string[], currentIdx: number, ledger: {
|
|
90
|
-
|
|
103
|
+
bindingPaceSlack(id: string): number | null;
|
|
91
104
|
cooldownActive(id: string): boolean;
|
|
92
105
|
}, tried: ReadonlySet<string>, log: {
|
|
93
106
|
emit(type: string, payload: Record<string, unknown>): unknown;
|
|
@@ -97,18 +110,21 @@ export declare function rotateOnStall(poolIds: string[], currentIdx: number, led
|
|
|
97
110
|
* two strong harnesses and starve a third), then by remaining rate-window
|
|
98
111
|
* headroom, cooldowns excluded, round-robin order among equals. Pure. */
|
|
99
112
|
export declare function pickStallRotationIdx(poolIds: string[], currentIdx: number, ledger: {
|
|
100
|
-
|
|
113
|
+
bindingPaceSlack(id: string): number | null;
|
|
101
114
|
cooldownActive(id: string): boolean;
|
|
102
115
|
}, tried?: ReadonlySet<string>): number;
|
|
103
116
|
/** Routing metrics: one settled sample per CLEAN attempt (advisory input;
|
|
104
117
|
* failures never fail the run). Errored/cancelled attempts are NOT samples —
|
|
105
118
|
* a fast-failing harness must not earn a flattering latency average (the
|
|
106
|
-
* router divides by latency)
|
|
119
|
+
* router divides by latency) — but their DISCLOSED auth route is still route
|
|
120
|
+
* evidence (the quota they burned is real) and refreshes last_auth_mode
|
|
121
|
+
* without counting a sample. Duration = stream time only (gates excluded). */
|
|
107
122
|
export declare function recordCleanAttemptMetrics(configDir: string, harnessId: string, sample: {
|
|
108
123
|
costUsd: number;
|
|
109
124
|
streamMs: number;
|
|
110
125
|
errored: boolean;
|
|
111
126
|
aborted: boolean;
|
|
127
|
+
authMode?: "local_session" | "api_key" | null;
|
|
112
128
|
}): void;
|
|
113
129
|
/** Build the ISOLATED-ENVELOPE sub-run input for an orchestrate SAFE step
|
|
114
130
|
* (start_run/race): inPlace forced false, no thread binding, no nested
|
|
@@ -116,7 +132,7 @@ export declare function recordCleanAttemptMetrics(configDir: string, harnessId:
|
|
|
116
132
|
* asserts the envelope invariant. */
|
|
117
133
|
export declare function buildEnvelopeSubInput<T extends {
|
|
118
134
|
repoRoot: string;
|
|
119
|
-
|
|
135
|
+
routingGoal?: unknown;
|
|
120
136
|
web?: unknown;
|
|
121
137
|
externalContextPolicy?: unknown;
|
|
122
138
|
signal?: AbortSignal;
|
|
@@ -127,14 +143,14 @@ export declare function buildEnvelopeSubInput<T extends {
|
|
|
127
143
|
mode?: string;
|
|
128
144
|
n?: number;
|
|
129
145
|
harness?: string | null;
|
|
130
|
-
},
|
|
146
|
+
}, budgetLedger: BudgetLedger): {
|
|
131
147
|
repoRoot: string;
|
|
132
148
|
prompt: string;
|
|
133
149
|
mode: "agent" | "ask" | "plan" | "audit" | "orchestrate";
|
|
134
150
|
n: number | undefined;
|
|
135
151
|
harnesses: string[] | undefined;
|
|
136
|
-
|
|
137
|
-
|
|
152
|
+
routingGoal: unknown;
|
|
153
|
+
budgetLedger: BudgetLedger;
|
|
138
154
|
web: unknown;
|
|
139
155
|
externalContextPolicy: unknown;
|
|
140
156
|
signal: AbortSignal | undefined;
|
package/dist/runSupport.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runSupport.d.ts","sourceRoot":"","sources":["../src/runSupport.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"runSupport.d.ts","sourceRoot":"","sources":["../src/runSupport.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EACV,YAAY,EACZ,QAAQ,EACR,qBAAqB,EACrB,aAAa,EACb,cAAc,EACd,iBAAiB,EACjB,SAAS,EACV,MAAM,mBAAmB,CAAC;AAK3B,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAErD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAEhE,OAAO,EAA8C,KAAK,YAAY,EAAE,M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