@zhixuan92/multi-model-agent-core 3.10.7 → 3.11.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/README.md +3 -3
- package/dist/config/schema.d.ts +15 -0
- package/dist/config/schema.d.ts.map +1 -1
- package/dist/config/schema.js +17 -2
- package/dist/config/schema.js.map +1 -1
- package/dist/diagnostics/types.d.ts +11 -0
- package/dist/diagnostics/types.d.ts.map +1 -1
- package/dist/escalation/fallback.d.ts +16 -0
- package/dist/escalation/fallback.d.ts.map +1 -1
- package/dist/escalation/fallback.js +280 -19
- package/dist/escalation/fallback.js.map +1 -1
- package/dist/executors/audit.d.ts.map +1 -1
- package/dist/executors/audit.js +6 -4
- package/dist/executors/audit.js.map +1 -1
- package/dist/executors/debug.d.ts.map +1 -1
- package/dist/executors/debug.js +5 -3
- package/dist/executors/debug.js.map +1 -1
- package/dist/executors/delegate.d.ts +12 -0
- package/dist/executors/delegate.d.ts.map +1 -1
- package/dist/executors/delegate.js +46 -11
- package/dist/executors/delegate.js.map +1 -1
- package/dist/executors/execute-plan.d.ts.map +1 -1
- package/dist/executors/execute-plan.js +6 -4
- package/dist/executors/execute-plan.js.map +1 -1
- package/dist/executors/retry.d.ts.map +1 -1
- package/dist/executors/retry.js +2 -1
- package/dist/executors/retry.js.map +1 -1
- package/dist/executors/review.d.ts.map +1 -1
- package/dist/executors/review.js +2 -1
- package/dist/executors/review.js.map +1 -1
- package/dist/executors/shared-compute.js +4 -4
- package/dist/executors/shared-compute.js.map +1 -1
- package/dist/executors/types.d.ts +1 -1
- package/dist/executors/types.d.ts.map +1 -1
- package/dist/executors/verify.js +2 -2
- package/dist/executors/verify.js.map +1 -1
- package/dist/heartbeat.d.ts +5 -5
- package/dist/heartbeat.d.ts.map +1 -1
- package/dist/heartbeat.js +21 -17
- package/dist/heartbeat.js.map +1 -1
- package/dist/index.d.ts +4 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -3
- package/dist/index.js.map +1 -1
- package/dist/intake/compilers/audit.d.ts.map +1 -1
- package/dist/intake/compilers/audit.js +5 -2
- package/dist/intake/compilers/audit.js.map +1 -1
- package/dist/intake/compilers/debug.d.ts.map +1 -1
- package/dist/intake/compilers/debug.js +4 -0
- package/dist/intake/compilers/debug.js.map +1 -1
- package/dist/intake/compilers/delegate.d.ts +3 -0
- package/dist/intake/compilers/delegate.d.ts.map +1 -1
- package/dist/intake/compilers/delegate.js +5 -1
- package/dist/intake/compilers/delegate.js.map +1 -1
- package/dist/intake/compilers/execute-plan.d.ts.map +1 -1
- package/dist/intake/compilers/execute-plan.js +5 -0
- package/dist/intake/compilers/execute-plan.js.map +1 -1
- package/dist/intake/compilers/review.d.ts.map +1 -1
- package/dist/intake/compilers/review.js +3 -0
- package/dist/intake/compilers/review.js.map +1 -1
- package/dist/intake/compilers/verify.d.ts.map +1 -1
- package/dist/intake/compilers/verify.js +7 -0
- package/dist/intake/compilers/verify.js.map +1 -1
- package/dist/intake/force-clarification.d.ts +5 -0
- package/dist/intake/force-clarification.d.ts.map +1 -0
- package/dist/intake/force-clarification.js +44 -0
- package/dist/intake/force-clarification.js.map +1 -0
- package/dist/intake/pipeline.d.ts +1 -1
- package/dist/intake/pipeline.d.ts.map +1 -1
- package/dist/intake/pipeline.js +32 -1
- package/dist/intake/pipeline.js.map +1 -1
- package/dist/intake/resolve.d.ts.map +1 -1
- package/dist/intake/resolve.js +0 -1
- package/dist/intake/resolve.js.map +1 -1
- package/dist/observability/bus.d.ts.map +1 -1
- package/dist/observability/bus.js +20 -0
- package/dist/observability/bus.js.map +1 -1
- package/dist/observability/events.d.ts +85 -8
- package/dist/observability/events.d.ts.map +1 -1
- package/dist/observability/events.js +77 -2
- package/dist/observability/events.js.map +1 -1
- package/dist/provider.d.ts +1 -0
- package/dist/provider.d.ts.map +1 -1
- package/dist/provider.js +9 -1
- package/dist/provider.js.map +1 -1
- package/dist/review/diff-review.d.ts +2 -1
- package/dist/review/diff-review.d.ts.map +1 -1
- package/dist/review/diff-review.js +1 -0
- package/dist/review/diff-review.js.map +1 -1
- package/dist/review/quality-reviewer.d.ts +2 -2
- package/dist/review/quality-reviewer.d.ts.map +1 -1
- package/dist/review/quality-reviewer.js +21 -9
- package/dist/review/quality-reviewer.js.map +1 -1
- package/dist/review/spec-reviewer.d.ts +1 -1
- package/dist/review/spec-reviewer.d.ts.map +1 -1
- package/dist/review/spec-reviewer.js +3 -1
- package/dist/review/spec-reviewer.js.map +1 -1
- package/dist/routing/canonical-model-identity.d.ts +9 -0
- package/dist/routing/canonical-model-identity.d.ts.map +1 -0
- package/dist/routing/canonical-model-identity.js +54 -0
- package/dist/routing/canonical-model-identity.js.map +1 -0
- package/dist/run-tasks/execute-task.d.ts.map +1 -1
- package/dist/run-tasks/execute-task.js +2 -1
- package/dist/run-tasks/execute-task.js.map +1 -1
- package/dist/run-tasks/index.d.ts.map +1 -1
- package/dist/run-tasks/index.js +2 -1
- package/dist/run-tasks/index.js.map +1 -1
- package/dist/run-tasks/reviewed-lifecycle.d.ts.map +1 -1
- package/dist/run-tasks/reviewed-lifecycle.js +195 -36
- package/dist/run-tasks/reviewed-lifecycle.js.map +1 -1
- package/dist/runners/base/result-builders.d.ts +13 -2
- package/dist/runners/base/result-builders.d.ts.map +1 -1
- package/dist/runners/base/result-builders.js +30 -1
- package/dist/runners/base/result-builders.js.map +1 -1
- package/dist/runners/base/time-check.d.ts +9 -0
- package/dist/runners/base/time-check.d.ts.map +1 -0
- package/dist/runners/base/time-check.js +18 -0
- package/dist/runners/base/time-check.js.map +1 -0
- package/dist/runners/base/usage-accumulator.d.ts +9 -0
- package/dist/runners/base/usage-accumulator.d.ts.map +1 -0
- package/dist/runners/base/usage-accumulator.js +19 -0
- package/dist/runners/base/usage-accumulator.js.map +1 -0
- package/dist/runners/claude-runner.d.ts.map +1 -1
- package/dist/runners/claude-runner.js +141 -180
- package/dist/runners/claude-runner.js.map +1 -1
- package/dist/runners/codex-runner.d.ts.map +1 -1
- package/dist/runners/codex-runner.js +99 -128
- package/dist/runners/codex-runner.js.map +1 -1
- package/dist/runners/error-classification.d.ts +11 -0
- package/dist/runners/error-classification.d.ts.map +1 -1
- package/dist/runners/error-classification.js +51 -0
- package/dist/runners/error-classification.js.map +1 -1
- package/dist/runners/openai-runner.d.ts.map +1 -1
- package/dist/runners/openai-runner.js +125 -172
- package/dist/runners/openai-runner.js.map +1 -1
- package/dist/runners/supervision.d.ts +0 -49
- package/dist/runners/supervision.d.ts.map +1 -1
- package/dist/runners/supervision.js +0 -67
- package/dist/runners/supervision.js.map +1 -1
- package/dist/runners/types.d.ts +15 -5
- package/dist/runners/types.d.ts.map +1 -1
- package/dist/telemetry/concern-classifier.d.ts +1 -1
- package/dist/telemetry/concern-classifier.d.ts.map +1 -1
- package/dist/telemetry/concern-classifier.js +5 -0
- package/dist/telemetry/concern-classifier.js.map +1 -1
- package/dist/telemetry/event-builder.d.ts.map +1 -1
- package/dist/telemetry/event-builder.js +10 -7
- package/dist/telemetry/event-builder.js.map +1 -1
- package/dist/telemetry/field-coverage.js +2 -2
- package/dist/telemetry/field-coverage.js.map +1 -1
- package/dist/telemetry/types.d.ts +142 -94
- package/dist/telemetry/types.d.ts.map +1 -1
- package/dist/telemetry/types.js +23 -17
- package/dist/telemetry/types.js.map +1 -1
- package/dist/types.d.ts +7 -2
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +5 -2
- package/dist/types.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -28,11 +28,11 @@ const results = await runTasks([
|
|
|
28
28
|
], config);
|
|
29
29
|
|
|
30
30
|
for (const r of results) {
|
|
31
|
-
console.log(r.status, r.usage.costUSD, r.
|
|
31
|
+
console.log(r.status, r.usage.costUSD, r.usage.costDeltaVsParentUSD, r.output);
|
|
32
32
|
}
|
|
33
33
|
```
|
|
34
34
|
|
|
35
|
-
`
|
|
35
|
+
`costDeltaVsParentUSD` is populated when `defaults.parentModel` is set in the config — it's `actualCost − parentCost` (negative = worker cheaper/savings). Use it to surface a `$X saved (Y× ROI)` figure in your own UI.
|
|
36
36
|
|
|
37
37
|
## What's inside
|
|
38
38
|
|
|
@@ -104,7 +104,7 @@ As of 3.4.0 every task-execution event the worker emits to the verbose stderr st
|
|
|
104
104
|
|
|
105
105
|
## What's new
|
|
106
106
|
|
|
107
|
-
Latest: **3.
|
|
107
|
+
Latest: **3.11.1** — Reliability + telemetry-integrity patch on top of 3.11.0. Self-healing flusher drops orphaned `installId` records on next flush (no more permanently-stuck telemetry queues from rotated identities). Exponential backoff actually doubles (5/10/20/40/60-min cap) instead of flat 5 min, dropping per-stuck-install backend load from 12 req/hr to ~1 req/hr. `claude-agent-sdk` 0.2.113+ env-replace handled via `process.env` spread. OpenAI reviewer findings preserve severity end-to-end via `Agent.outputType` (Structured Outputs); `RunResult.parsedFindings: AnnotatedFinding[] | null` is now a required field. 4-tier severity vocabulary `{critical, high, medium, low}` locked in by contract test. Fallback-unavailable preserves implementer salvage via new `RunWithFallbackResult.salvageResult: T | null` (no more `duration_ms=2 / stages=[] / model='custom'` after legitimate work). `mmagent serve` survives a closed parent stdio pipe (EPIPE → clean `exit(0)`). Full history: [CHANGELOG](https://github.com/zhixuan312/multi-model-agent/blob/master/CHANGELOG.md).
|
|
108
108
|
|
|
109
109
|
## Full documentation
|
|
110
110
|
|
package/dist/config/schema.d.ts
CHANGED
|
@@ -12,6 +12,21 @@ export declare const DEFAULT_TASK_TIMEOUT_MS = 3600000;
|
|
|
12
12
|
* Bumped from 10 min in v3.9.0 — the prior value occasionally fired on
|
|
13
13
|
* legitimately slow reviewers (deepseek-v4-pro, large diffs). */
|
|
14
14
|
export declare const DEFAULT_STALL_TIMEOUT_MS = 1200000;
|
|
15
|
+
/** Per-task cost cap in USD. Negative is rejected; zero allows free-agent
|
|
16
|
+
* runs (both input/output price rates set to 0). */
|
|
17
|
+
export declare const DEFAULT_MAX_COST_USD = 10;
|
|
18
|
+
/** Pre-stop threshold ratio for cost — the runtime warns and may refuse
|
|
19
|
+
* new turns when cost reaches DEFAULT_MAX_COST_USD × this ratio ($8).
|
|
20
|
+
* A turn already in flight is allowed to complete, so the worst-case
|
|
21
|
+
* total is DEFAULT_MAX_COST_USD / MAX_COST_PRESTOP_RATIO ($12.50).
|
|
22
|
+
* This is NOT an 80%-overshoot allowance; it is an 80%-of-cap pre-stop.
|
|
23
|
+
* See §3.8 for the rationale. */
|
|
24
|
+
export declare const MAX_COST_PRESTOP_RATIO = 0.8;
|
|
25
|
+
/** Clock counterpart of MAX_COST_PRESTOP_RATIO — same pre-stop semantics
|
|
26
|
+
* applied to wall-clock time: the runtime warns at
|
|
27
|
+
* DEFAULT_TASK_TIMEOUT_MS × this ratio (48 min), with a worst-case
|
|
28
|
+
* total of DEFAULT_TASK_TIMEOUT_MS / MAX_TIME_PRESTOP_RATIO (1.25 h). */
|
|
29
|
+
export declare const MAX_TIME_PRESTOP_RATIO = 0.8;
|
|
15
30
|
/** Raw (possibly compressed) request body cap — 256 KiB. */
|
|
16
31
|
export declare const COMPRESSED_BODY_LIMIT_BYTES: number;
|
|
17
32
|
export declare const serverConfigSchema: z.ZodObject<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/config/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EACV,gBAAgB,EACjB,MAAM,aAAa,CAAC;AAErB;;;;;0BAK0B;AAC1B,eAAO,MAAM,uBAAuB,UAAY,CAAC;AAEjD;;;iEAGiE;AACjE,eAAO,MAAM,wBAAwB,UAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/config/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EACV,gBAAgB,EACjB,MAAM,aAAa,CAAC;AAErB;;;;;0BAK0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K_TIMEOUT_MS = 3_600_000;
|
|
|
11
11
|
* Bumped from 10 min in v3.9.0 — the prior value occasionally fired on
|
|
12
12
|
* legitimately slow reviewers (deepseek-v4-pro, large diffs). */
|
|
13
13
|
export const DEFAULT_STALL_TIMEOUT_MS = 1_200_000;
|
|
14
|
+
/** Per-task cost cap in USD. Negative is rejected; zero allows free-agent
|
|
15
|
+
* runs (both input/output price rates set to 0). */
|
|
16
|
+
export const DEFAULT_MAX_COST_USD = 10;
|
|
17
|
+
/** Pre-stop threshold ratio for cost — the runtime warns and may refuse
|
|
18
|
+
* new turns when cost reaches DEFAULT_MAX_COST_USD × this ratio ($8).
|
|
19
|
+
* A turn already in flight is allowed to complete, so the worst-case
|
|
20
|
+
* total is DEFAULT_MAX_COST_USD / MAX_COST_PRESTOP_RATIO ($12.50).
|
|
21
|
+
* This is NOT an 80%-overshoot allowance; it is an 80%-of-cap pre-stop.
|
|
22
|
+
* See §3.8 for the rationale. */
|
|
23
|
+
export const MAX_COST_PRESTOP_RATIO = 0.80;
|
|
24
|
+
/** Clock counterpart of MAX_COST_PRESTOP_RATIO — same pre-stop semantics
|
|
25
|
+
* applied to wall-clock time: the runtime warns at
|
|
26
|
+
* DEFAULT_TASK_TIMEOUT_MS × this ratio (48 min), with a worst-case
|
|
27
|
+
* total of DEFAULT_TASK_TIMEOUT_MS / MAX_TIME_PRESTOP_RATIO (1.25 h). */
|
|
28
|
+
export const MAX_TIME_PRESTOP_RATIO = 0.80;
|
|
14
29
|
// === Shared field schemas ===
|
|
15
30
|
const effortSchema = z.enum(['none', 'low', 'medium', 'high']);
|
|
16
31
|
const hostedToolsSchema = z.array(z.enum(['web_search', 'image_generation', 'code_interpreter']));
|
|
@@ -71,7 +86,7 @@ const agentConfigSchema = z.discriminatedUnion('type', [
|
|
|
71
86
|
const defaultsSchema = z.object({
|
|
72
87
|
timeoutMs: z.number().int().positive().default(DEFAULT_TASK_TIMEOUT_MS),
|
|
73
88
|
stallTimeoutMs: z.number().int().positive().default(DEFAULT_STALL_TIMEOUT_MS),
|
|
74
|
-
maxCostUSD: z.number().nonnegative().default(
|
|
89
|
+
maxCostUSD: z.number().nonnegative().default(DEFAULT_MAX_COST_USD),
|
|
75
90
|
tools: z.enum(['none', 'readonly', 'no-shell', 'full']).default('full'),
|
|
76
91
|
sandboxPolicy: z.enum(['none', 'cwd-only']).default('cwd-only'),
|
|
77
92
|
largeResponseThresholdChars: z.number().int().positive().optional(),
|
|
@@ -79,7 +94,7 @@ const defaultsSchema = z.object({
|
|
|
79
94
|
}).default(() => ({
|
|
80
95
|
timeoutMs: DEFAULT_TASK_TIMEOUT_MS,
|
|
81
96
|
stallTimeoutMs: DEFAULT_STALL_TIMEOUT_MS,
|
|
82
|
-
maxCostUSD:
|
|
97
|
+
maxCostUSD: DEFAULT_MAX_COST_USD,
|
|
83
98
|
tools: 'full',
|
|
84
99
|
sandboxPolicy: 'cwd-only',
|
|
85
100
|
}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../src/config/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB;;;;;0BAK0B;AAC1B,MAAM,CAAC,MAAM,uBAAuB,GAAG,SAAS,CAAC;AAEjD;;;iEAGiE;AACjE,MAAM,CAAC,MAAM,wBAAwB,GAAG,SAAS,CAAC;AAElD,+BAA+B;AAE/B,MAAM,YAAY,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC,CAAC;AAC/D,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,YAAY,EAAE,kBAAkB,EAAE,kBAAkB,CAAC,CAAC,CAAC,CAAC;AAClG,MAAM,iCAAiC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,YAAY,CAAC,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
44
|
+
fallbackSeparationRespected?: boolean;
|
|
45
|
+
assignedIdentity?: {
|
|
46
|
+
providerType: string;
|
|
47
|
+
normalizedEndpoint: string;
|
|
48
|
+
modelId: string;
|
|
49
|
+
} | null;
|
|
50
|
+
usedIdentity?: {
|
|
51
|
+
providerType: string;
|
|
52
|
+
normalizedEndpoint: string;
|
|
53
|
+
modelId: string;
|
|
54
|
+
} | null;
|
|
44
55
|
}
|
|
45
56
|
export interface FallbackUnavailableEventParams {
|
|
46
57
|
batchId: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/diagnostics/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7C,MAAM,MAAM,aAAa,GACrB,WAAW,GACX,cAAc,GACd,oBAAoB,GACpB,mBAAmB,GACnB,oBAAoB,GACpB,SAAS,GACT,QAAQ,GACR,SAAS,GACT,QAAQ,GACR,SAAS,GACT,kBAAkB,GAClB,uBAAuB,CAAC;AAE5B,MAAM,MAAM,kBAAkB,GAAG,eAAe,GAAG,iBAAiB,GAAG,iBAAiB,GAAG,iBAAiB,GAAG,kBAAkB,CAAC;AAElI,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,CAAC;AAC9D,MAAM,WAAW,SAAS;IAAG,KAAK,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAC;IAAC,CAAC,GAAG,EAAE,MAAM,GAAG,cAAc,GAAG,SAAS,CAAC;CAAE;AAE5H,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG,SAAS,GAAG,MAAM,CAAC;AACnD,MAAM,MAAM,QAAQ,GAAG,aAAa,GAAG,cAAc,GAAG,iBAAiB,GAAG,cAAc,CAAC;AA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CAAC;IAChB,IAAI,EAAE,QAAQ,CAAC;IACf,YAAY,EAAE,SAAS,CAAC;IACxB,QAAQ,EAAE,SAAS,CAAC;IACpB,MAAM,EAAE,UAAU,CAAC;IACnB,gBAAgB,CAAC,EAAE,SAAS,CAAC;IAC7B,kBAAkB,EAAE,OAAO,CAAC;IAC5B,2BAA2B,CAAC,EAAE,OAAO,CAAC;IACtC,gBAAgB,CAAC,EAAE;QAAE,YAAY,EAAE,MAAM,CAAC;QAAC,kBAAkB,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IAChG,YAAY,CAAC,EAAE;QAAE,YAAY,EAAE,MAAM,CAAC;QAAC,kBAAkB,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;CAC7F;AAED,MAAM,WAAW,8BAA8B;IAC7C,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,QAAQ,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,QAAQ,CAAC;IACf,YAAY,EAAE,SAAS,CAAC;IACxB,MAAM,EAAE,UAAU,CAAC;CACpB"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Provider, AgentType, RunResult } from '../types.js';
|
|
2
2
|
import type { RunStatus } from '../runners/types.js';
|
|
3
|
+
import { type CanonicalIdentity } from '../routing/canonical-model-identity.js';
|
|
3
4
|
export declare const TRANSPORT_FAILURES: ReadonlySet<RunStatus>;
|
|
4
5
|
export type FallbackReason = 'transport_failure' | 'not_configured';
|
|
5
6
|
export type UnavailableMap = Map<AgentType, FallbackReason>;
|
|
@@ -22,6 +23,12 @@ export interface RunWithFallbackInput<T> {
|
|
|
22
23
|
getStatus?: (result: T) => RunStatus | undefined;
|
|
23
24
|
makeSyntheticFailure: (assigned: AgentType) => T;
|
|
24
25
|
call: (provider: Provider) => Promise<T>;
|
|
26
|
+
/** Canonical identities to exclude from candidate selection. When a candidate
|
|
27
|
+
* provider's resolved identity matches one in this set, the candidate is skipped
|
|
28
|
+
* as a separation violation. If identity resolution throws on a successfully-constructed
|
|
29
|
+
* provider, the candidate is also skipped (fail-closed). Provider construction
|
|
30
|
+
* failures (providerFor throws/returns undefined) follow the existing unavailable path. */
|
|
31
|
+
forbiddenIdentities?: CanonicalIdentity[];
|
|
25
32
|
}
|
|
26
33
|
export interface RunWithFallbackResult<T> {
|
|
27
34
|
result: T;
|
|
@@ -47,6 +54,15 @@ export interface RunWithFallbackResult<T> {
|
|
|
47
54
|
* fallbackReason set without calling assigned. Distinct from `fallbackReason` so callers
|
|
48
55
|
* can tell "we substituted at the start" vs "we substituted because the assigned call failed". */
|
|
49
56
|
assignedUnavailableReason?: FallbackReason;
|
|
57
|
+
/** True iff the final used tier differs in canonical identity from all forbiddenIdentities.
|
|
58
|
+
* Set only when forbiddenIdentities was provided. */
|
|
59
|
+
fallbackSeparationRespected?: boolean;
|
|
60
|
+
/** Canonical identity of the assigned tier's provider (resolved at selection time). */
|
|
61
|
+
assignedIdentity?: CanonicalIdentity;
|
|
62
|
+
/** Canonical identity of the actually-used tier's provider. */
|
|
63
|
+
usedIdentity?: CanonicalIdentity;
|
|
64
|
+
/** Higher-work-score of firstResult/altResult on bothUnavailable; null when both have zero work. */
|
|
65
|
+
salvageResult: T | null;
|
|
50
66
|
}
|
|
51
67
|
export declare function runWithFallback<T>(input: RunWithFallbackInput<T>): Promise<RunWithFallbackResult<T>>;
|
|
52
68
|
/** Lifecycle helper: builds the synthetic RunResult expected when both tiers are
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fallback.d.ts","sourceRoot":"","sources":["../../src/escalation/fallback.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAClE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,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
1
2
|
export const TRANSPORT_FAILURES = new Set([
|
|
2
3
|
'api_error',
|
|
3
4
|
'network_error',
|
|
@@ -22,34 +23,135 @@ export function providersIdentical(a, b) {
|
|
|
22
23
|
export async function runWithFallback(input) {
|
|
23
24
|
const { assigned, providerFor, unavailableTiers, isTransportFailure, makeSyntheticFailure, call } = input;
|
|
24
25
|
const getStatus = input.getStatus ?? (() => undefined);
|
|
26
|
+
const forbidden = input.forbiddenIdentities ?? [];
|
|
27
|
+
// ── Helpers for identity separation ──
|
|
28
|
+
// Returns { skip: true } when the tier should be skipped due to separation.
|
|
29
|
+
// - providerFor throws → { skip: false } (construction failure, NOT separation)
|
|
30
|
+
// - providerFor returns undefined → { skip: false } (unavailable, NOT separation)
|
|
31
|
+
// - canonicalIdentity throws → { skip: true } (fail-closed: provider exists but identity unresolvable)
|
|
32
|
+
// - identity matches forbiddenIdentities → { skip: true }
|
|
33
|
+
// - identity differs → { skip: false, identity }
|
|
34
|
+
const checkSeparation = (tier) => {
|
|
35
|
+
if (forbidden.length === 0)
|
|
36
|
+
return { skip: false };
|
|
37
|
+
let p;
|
|
38
|
+
try {
|
|
39
|
+
p = providerFor(tier);
|
|
40
|
+
}
|
|
41
|
+
catch {
|
|
42
|
+
return { skip: false };
|
|
43
|
+
}
|
|
44
|
+
if (!p)
|
|
45
|
+
return { skip: false };
|
|
46
|
+
try {
|
|
47
|
+
const id = canonicalIdentity(p.config);
|
|
48
|
+
if (forbidden.some(f => identityEquals(f, id)))
|
|
49
|
+
return { skip: true, identity: id };
|
|
50
|
+
return { skip: false, identity: id };
|
|
51
|
+
}
|
|
52
|
+
catch {
|
|
53
|
+
// Identity unresolvable on a successfully-constructed provider: fail closed.
|
|
54
|
+
return { skip: true };
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
const resolveProviderIdentity = (tier) => {
|
|
58
|
+
let p;
|
|
59
|
+
try {
|
|
60
|
+
p = providerFor(tier);
|
|
61
|
+
}
|
|
62
|
+
catch {
|
|
63
|
+
return null;
|
|
64
|
+
}
|
|
65
|
+
if (!p)
|
|
66
|
+
return null;
|
|
67
|
+
try {
|
|
68
|
+
return canonicalIdentity(p.config);
|
|
69
|
+
}
|
|
70
|
+
catch {
|
|
71
|
+
return null;
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
// ── Resolve assigned identity (before any availability checks) ──
|
|
75
|
+
const assignedIdentity = resolveProviderIdentity(assigned) ?? undefined;
|
|
25
76
|
// ── Step 1: resolve assigned tier (sticky check first, then not-configured) ──
|
|
26
77
|
let usedTier = assigned;
|
|
27
78
|
let fallbackFired = false;
|
|
28
79
|
let fallbackReason;
|
|
29
80
|
let assignedUnavailableReason;
|
|
81
|
+
let skippedDueToSeparation = false;
|
|
82
|
+
let usedIdentity = assignedIdentity;
|
|
30
83
|
if (unavailableTiers.has(assigned)) {
|
|
31
84
|
assignedUnavailableReason = unavailableTiers.get(assigned);
|
|
32
85
|
fallbackReason = assignedUnavailableReason;
|
|
33
86
|
}
|
|
34
|
-
else
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
87
|
+
else {
|
|
88
|
+
let assignedProvider;
|
|
89
|
+
try {
|
|
90
|
+
assignedProvider = providerFor(assigned);
|
|
91
|
+
}
|
|
92
|
+
catch { /* construction failure → treat as unavailable below */ }
|
|
93
|
+
if (assignedProvider === undefined) {
|
|
94
|
+
markUnavailable(unavailableTiers, assigned, 'not_configured');
|
|
95
|
+
assignedUnavailableReason = 'not_configured';
|
|
96
|
+
fallbackReason = 'not_configured';
|
|
97
|
+
}
|
|
98
|
+
else {
|
|
99
|
+
const sep = checkSeparation(assigned);
|
|
100
|
+
if (sep.skip) {
|
|
101
|
+
skippedDueToSeparation = true;
|
|
102
|
+
fallbackReason = 'not_configured';
|
|
103
|
+
}
|
|
104
|
+
else if (sep.identity) {
|
|
105
|
+
usedIdentity = sep.identity;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
38
108
|
}
|
|
39
109
|
if (fallbackReason !== undefined) {
|
|
40
|
-
// Assigned is unavailable up-front. Try the alt tier.
|
|
110
|
+
// Assigned is unavailable up-front (or forbidden). Try the alt tier.
|
|
41
111
|
const alt = otherTier(assigned);
|
|
42
112
|
let altUnavailableReason;
|
|
43
113
|
if (unavailableTiers.has(alt)) {
|
|
44
114
|
altUnavailableReason = unavailableTiers.get(alt);
|
|
45
115
|
}
|
|
46
|
-
else
|
|
47
|
-
|
|
48
|
-
|
|
116
|
+
else {
|
|
117
|
+
let altProv;
|
|
118
|
+
try {
|
|
119
|
+
altProv = providerFor(alt);
|
|
120
|
+
}
|
|
121
|
+
catch { /* construction failure */ }
|
|
122
|
+
if (altProv === undefined) {
|
|
123
|
+
markUnavailable(unavailableTiers, alt, 'not_configured');
|
|
124
|
+
altUnavailableReason = 'not_configured';
|
|
125
|
+
}
|
|
126
|
+
else {
|
|
127
|
+
const altSep = checkSeparation(alt);
|
|
128
|
+
if (altSep.skip) {
|
|
129
|
+
skippedDueToSeparation = true;
|
|
130
|
+
altUnavailableReason = 'not_configured';
|
|
131
|
+
}
|
|
132
|
+
else if (altSep.identity) {
|
|
133
|
+
usedIdentity = altSep.identity;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
49
136
|
}
|
|
50
137
|
if (altUnavailableReason !== undefined) {
|
|
51
|
-
// Both unavailable up-front.
|
|
52
|
-
//
|
|
138
|
+
// Both unavailable up-front. If separation was the blocking reason for
|
|
139
|
+
// either tier, emit the separation error code.
|
|
140
|
+
if (skippedDueToSeparation) {
|
|
141
|
+
return {
|
|
142
|
+
result: makeSyntheticFailure(assigned),
|
|
143
|
+
usedTier: 'none',
|
|
144
|
+
fallbackFired: false,
|
|
145
|
+
bothUnavailable: true,
|
|
146
|
+
fallbackReason,
|
|
147
|
+
assignedUnavailableReason,
|
|
148
|
+
unavailableReason: altUnavailableReason,
|
|
149
|
+
fallbackSeparationRespected: true,
|
|
150
|
+
assignedIdentity,
|
|
151
|
+
usedIdentity: undefined,
|
|
152
|
+
salvageResult: null,
|
|
153
|
+
};
|
|
154
|
+
}
|
|
53
155
|
return {
|
|
54
156
|
result: makeSyntheticFailure(assigned),
|
|
55
157
|
usedTier: 'none',
|
|
@@ -58,16 +160,72 @@ export async function runWithFallback(input) {
|
|
|
58
160
|
fallbackReason,
|
|
59
161
|
assignedUnavailableReason,
|
|
60
162
|
unavailableReason: altUnavailableReason,
|
|
163
|
+
salvageResult: null,
|
|
61
164
|
};
|
|
62
165
|
}
|
|
63
166
|
usedTier = alt;
|
|
64
167
|
fallbackFired = true;
|
|
65
168
|
}
|
|
66
169
|
// ── Step 4: call the chosen provider ──
|
|
67
|
-
|
|
170
|
+
let provider;
|
|
171
|
+
try {
|
|
172
|
+
provider = providerFor(usedTier);
|
|
173
|
+
}
|
|
174
|
+
catch {
|
|
175
|
+
// providerFor threw — construction failure on the chosen tier.
|
|
176
|
+
// If fallback hasn't fired yet, try alt; otherwise both exhausted.
|
|
177
|
+
if (!fallbackFired) {
|
|
178
|
+
const alt = otherTier(usedTier);
|
|
179
|
+
fallbackFired = true;
|
|
180
|
+
usedTier = alt;
|
|
181
|
+
try {
|
|
182
|
+
provider = providerFor(alt);
|
|
183
|
+
}
|
|
184
|
+
catch {
|
|
185
|
+
return {
|
|
186
|
+
result: makeSyntheticFailure(assigned),
|
|
187
|
+
usedTier: 'none',
|
|
188
|
+
fallbackFired: true,
|
|
189
|
+
bothUnavailable: true,
|
|
190
|
+
fallbackReason: 'not_configured',
|
|
191
|
+
assignedUnavailableReason,
|
|
192
|
+
unavailableReason: 'not_configured',
|
|
193
|
+
salvageResult: null,
|
|
194
|
+
...(forbidden.length > 0 ? {
|
|
195
|
+
fallbackSeparationRespected: skippedDueToSeparation || undefined,
|
|
196
|
+
assignedIdentity,
|
|
197
|
+
usedIdentity: undefined,
|
|
198
|
+
} : {}),
|
|
199
|
+
};
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
else {
|
|
203
|
+
return {
|
|
204
|
+
result: makeSyntheticFailure(assigned),
|
|
205
|
+
usedTier: 'none',
|
|
206
|
+
fallbackFired: true,
|
|
207
|
+
bothUnavailable: true,
|
|
208
|
+
fallbackReason,
|
|
209
|
+
assignedUnavailableReason,
|
|
210
|
+
unavailableReason: 'not_configured',
|
|
211
|
+
salvageResult: null,
|
|
212
|
+
...(forbidden.length > 0 ? {
|
|
213
|
+
fallbackSeparationRespected: skippedDueToSeparation || undefined,
|
|
214
|
+
assignedIdentity,
|
|
215
|
+
usedIdentity: undefined,
|
|
216
|
+
} : {}),
|
|
217
|
+
};
|
|
218
|
+
}
|
|
219
|
+
}
|
|
68
220
|
const result = await call(provider);
|
|
69
221
|
if (!isTransportFailure(result)) {
|
|
70
|
-
//
|
|
222
|
+
// Resolve usedIdentity from the actually-used provider if not already set
|
|
223
|
+
if (!usedIdentity) {
|
|
224
|
+
try {
|
|
225
|
+
usedIdentity = canonicalIdentity(provider.config) ?? undefined;
|
|
226
|
+
}
|
|
227
|
+
catch { /* leave undefined */ }
|
|
228
|
+
}
|
|
71
229
|
return {
|
|
72
230
|
result,
|
|
73
231
|
usedTier,
|
|
@@ -75,11 +233,23 @@ export async function runWithFallback(input) {
|
|
|
75
233
|
fallbackReason,
|
|
76
234
|
assignedUnavailableReason,
|
|
77
235
|
bothUnavailable: false,
|
|
236
|
+
salvageResult: null,
|
|
237
|
+
...(forbidden.length > 0 ? {
|
|
238
|
+
fallbackSeparationRespected: skippedDueToSeparation || undefined,
|
|
239
|
+
assignedIdentity,
|
|
240
|
+
usedIdentity,
|
|
241
|
+
} : {}),
|
|
78
242
|
};
|
|
79
243
|
}
|
|
80
244
|
// Transport failure on the called tier. Capture the original triggering status.
|
|
81
245
|
const calledStatus = getStatus(result);
|
|
82
246
|
markUnavailable(unavailableTiers, usedTier, 'transport_failure');
|
|
247
|
+
if (!usedIdentity) {
|
|
248
|
+
try {
|
|
249
|
+
usedIdentity = canonicalIdentity(provider.config) ?? undefined;
|
|
250
|
+
}
|
|
251
|
+
catch { /* leave undefined */ }
|
|
252
|
+
}
|
|
83
253
|
// If the called tier WAS the alt (i.e. we already substituted before calling),
|
|
84
254
|
// there's no further alt to try; we've burned both options.
|
|
85
255
|
if (fallbackFired) {
|
|
@@ -93,6 +263,12 @@ export async function runWithFallback(input) {
|
|
|
93
263
|
bothUnavailable: true,
|
|
94
264
|
unavailableReason: 'transport_failure',
|
|
95
265
|
unavailableTriggeringStatus: calledStatus,
|
|
266
|
+
salvageResult: null,
|
|
267
|
+
...(forbidden.length > 0 ? {
|
|
268
|
+
fallbackSeparationRespected: skippedDueToSeparation || undefined,
|
|
269
|
+
assignedIdentity,
|
|
270
|
+
usedIdentity,
|
|
271
|
+
} : {}),
|
|
96
272
|
};
|
|
97
273
|
}
|
|
98
274
|
// The assigned tier just failed in this call. Promote to fallback path.
|
|
@@ -107,25 +283,50 @@ export async function runWithFallback(input) {
|
|
|
107
283
|
// rework attempt should still be allowed to try.
|
|
108
284
|
const altProviderForSameCheck = providerFor(altOfUsed);
|
|
109
285
|
if (altProviderForSameCheck !== undefined && providersIdentical(provider, altProviderForSameCheck)) {
|
|
286
|
+
// Also check if the same-provider situation constitutes a separation violation
|
|
287
|
+
const sameProviderSep = forbidden.length > 0 ? checkSeparation(usedTier) : { skip: false };
|
|
110
288
|
return {
|
|
111
289
|
result,
|
|
112
290
|
usedTier,
|
|
113
291
|
fallbackFired: false,
|
|
114
292
|
bothUnavailable: false,
|
|
293
|
+
salvageResult: null,
|
|
294
|
+
...(forbidden.length > 0 ? {
|
|
295
|
+
fallbackSeparationRespected: sameProviderSep.skip || skippedDueToSeparation || undefined,
|
|
296
|
+
assignedIdentity,
|
|
297
|
+
usedIdentity,
|
|
298
|
+
} : {}),
|
|
115
299
|
};
|
|
116
300
|
}
|
|
117
|
-
// Check alt availability (sticky first, then not-configured)
|
|
301
|
+
// Check alt availability (sticky first, then not-configured, then separation)
|
|
118
302
|
let altUnavailableReason;
|
|
303
|
+
let altSeparation = false;
|
|
119
304
|
if (unavailableTiers.has(altOfUsed)) {
|
|
120
305
|
altUnavailableReason = unavailableTiers.get(altOfUsed);
|
|
121
306
|
}
|
|
122
|
-
else
|
|
123
|
-
|
|
124
|
-
|
|
307
|
+
else {
|
|
308
|
+
let altProv2;
|
|
309
|
+
try {
|
|
310
|
+
altProv2 = providerFor(altOfUsed);
|
|
311
|
+
}
|
|
312
|
+
catch { /* construction failure */ }
|
|
313
|
+
if (altProv2 === undefined) {
|
|
314
|
+
markUnavailable(unavailableTiers, altOfUsed, 'not_configured');
|
|
315
|
+
altUnavailableReason = 'not_configured';
|
|
316
|
+
}
|
|
317
|
+
else {
|
|
318
|
+
const altSep = checkSeparation(altOfUsed);
|
|
319
|
+
if (altSep.skip) {
|
|
320
|
+
altSeparation = true;
|
|
321
|
+
altUnavailableReason = 'not_configured';
|
|
322
|
+
}
|
|
323
|
+
else if (altSep.identity) {
|
|
324
|
+
usedIdentity = altSep.identity;
|
|
325
|
+
}
|
|
326
|
+
}
|
|
125
327
|
}
|
|
126
328
|
if (altUnavailableReason !== undefined) {
|
|
127
329
|
// Both unavailable mid-call — assigned called and failed; alt unreachable.
|
|
128
|
-
// Return the actual failed result (not synthetic) per Spec Section D step 4b.
|
|
129
330
|
return {
|
|
130
331
|
result,
|
|
131
332
|
usedTier,
|
|
@@ -134,15 +335,54 @@ export async function runWithFallback(input) {
|
|
|
134
335
|
fallbackTriggeringStatus,
|
|
135
336
|
bothUnavailable: true,
|
|
136
337
|
unavailableReason: altUnavailableReason,
|
|
338
|
+
salvageResult: null,
|
|
339
|
+
...(forbidden.length > 0 ? {
|
|
340
|
+
fallbackSeparationRespected: altSeparation || skippedDueToSeparation || undefined,
|
|
341
|
+
assignedIdentity,
|
|
342
|
+
usedIdentity,
|
|
343
|
+
} : {}),
|
|
137
344
|
};
|
|
138
345
|
}
|
|
139
346
|
// Try alt.
|
|
140
|
-
|
|
347
|
+
let altProvider;
|
|
348
|
+
try {
|
|
349
|
+
altProvider = providerFor(altOfUsed);
|
|
350
|
+
}
|
|
351
|
+
catch {
|
|
352
|
+
return {
|
|
353
|
+
result,
|
|
354
|
+
usedTier,
|
|
355
|
+
fallbackFired: true,
|
|
356
|
+
fallbackReason,
|
|
357
|
+
fallbackTriggeringStatus,
|
|
358
|
+
bothUnavailable: true,
|
|
359
|
+
unavailableReason: 'not_configured',
|
|
360
|
+
salvageResult: null,
|
|
361
|
+
...(forbidden.length > 0 ? {
|
|
362
|
+
fallbackSeparationRespected: skippedDueToSeparation || undefined,
|
|
363
|
+
assignedIdentity,
|
|
364
|
+
usedIdentity,
|
|
365
|
+
} : {}),
|
|
366
|
+
};
|
|
367
|
+
}
|
|
141
368
|
const altResult = await call(altProvider);
|
|
369
|
+
// Resolve usedIdentity from the alt provider if not already set
|
|
370
|
+
if (!usedIdentity) {
|
|
371
|
+
try {
|
|
372
|
+
usedIdentity = canonicalIdentity(altProvider.config) ?? undefined;
|
|
373
|
+
}
|
|
374
|
+
catch { /* leave undefined */ }
|
|
375
|
+
}
|
|
142
376
|
const altStatus = getStatus(altResult);
|
|
143
377
|
if (isTransportFailure(altResult)) {
|
|
144
378
|
// Both transport-failed mid-call — preserve BOTH triggering statuses.
|
|
145
379
|
markUnavailable(unavailableTiers, altOfUsed, 'transport_failure');
|
|
380
|
+
const firstWork = scoreWork(result);
|
|
381
|
+
const altWork = scoreWork(altResult);
|
|
382
|
+
const maxWork = Math.max(firstWork, altWork);
|
|
383
|
+
const salvageResult = maxWork > 0
|
|
384
|
+
? (firstWork >= altWork ? result : altResult)
|
|
385
|
+
: null;
|
|
146
386
|
return {
|
|
147
387
|
result: altResult,
|
|
148
388
|
usedTier: altOfUsed,
|
|
@@ -152,6 +392,12 @@ export async function runWithFallback(input) {
|
|
|
152
392
|
bothUnavailable: true,
|
|
153
393
|
unavailableReason: 'transport_failure',
|
|
154
394
|
unavailableTriggeringStatus: altStatus, // alt's failure status (final state)
|
|
395
|
+
salvageResult,
|
|
396
|
+
...(forbidden.length > 0 ? {
|
|
397
|
+
fallbackSeparationRespected: skippedDueToSeparation || undefined,
|
|
398
|
+
assignedIdentity,
|
|
399
|
+
usedIdentity,
|
|
400
|
+
} : {}),
|
|
155
401
|
};
|
|
156
402
|
}
|
|
157
403
|
// Alt succeeded.
|
|
@@ -162,6 +408,12 @@ export async function runWithFallback(input) {
|
|
|
162
408
|
fallbackReason,
|
|
163
409
|
fallbackTriggeringStatus, // assigned's failure status (root cause)
|
|
164
410
|
bothUnavailable: false,
|
|
411
|
+
salvageResult: null,
|
|
412
|
+
...(forbidden.length > 0 ? {
|
|
413
|
+
fallbackSeparationRespected: skippedDueToSeparation || undefined,
|
|
414
|
+
assignedIdentity,
|
|
415
|
+
usedIdentity,
|
|
416
|
+
} : {}),
|
|
165
417
|
};
|
|
166
418
|
}
|
|
167
419
|
/** Lifecycle helper: builds the synthetic RunResult expected when both tiers are
|
|
@@ -182,14 +434,23 @@ export function makeSyntheticRunResult(assigned, errorCode) {
|
|
|
182
434
|
errorCode,
|
|
183
435
|
retryable: false,
|
|
184
436
|
turns: 0,
|
|
185
|
-
usage: { inputTokens: 0, outputTokens: 0, totalTokens: 0, costUSD: 0,
|
|
437
|
+
usage: { inputTokens: 0, outputTokens: 0, totalTokens: 0, costUSD: 0, costDeltaVsParentUSD: 0, cachedTokens: null, reasoningTokens: null },
|
|
186
438
|
filesRead: [],
|
|
187
439
|
filesWritten: [],
|
|
188
440
|
toolCalls: [],
|
|
189
441
|
escalationLog: [],
|
|
442
|
+
parsedFindings: null,
|
|
190
443
|
};
|
|
191
444
|
}
|
|
192
445
|
export function isReviewTransportFailure(r) {
|
|
193
446
|
return r.status === 'api_error' || r.status === 'network_error' || r.status === 'timeout';
|
|
194
447
|
}
|
|
448
|
+
function scoreWork(r) {
|
|
449
|
+
if (!r)
|
|
450
|
+
return 0;
|
|
451
|
+
const usage = r.usage ?? {};
|
|
452
|
+
const turns = r.turns ?? 0;
|
|
453
|
+
const filesWritten = (r.filesWritten ?? []).length ?? 0;
|
|
454
|
+
return turns + filesWritten + (usage.inputTokens ?? 0) / 1000;
|
|
455
|
+
}
|
|
195
456
|
//# sourceMappingURL=fallback.js.map
|