@zhixuan92/multi-model-agent-core 0.1.0 → 0.2.0
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 +0 -6
- package/dist/config/schema.d.ts +27 -0
- package/dist/config/schema.d.ts.map +1 -1
- package/dist/config/schema.js +13 -0
- package/dist/config/schema.js.map +1 -1
- package/dist/context/context-block-store.d.ts +75 -0
- package/dist/context/context-block-store.d.ts.map +1 -0
- package/dist/context/context-block-store.js +82 -0
- package/dist/context/context-block-store.js.map +1 -0
- package/dist/context/expand-context-blocks.d.ts +20 -0
- package/dist/context/expand-context-blocks.d.ts.map +1 -0
- package/dist/context/expand-context-blocks.js +46 -0
- package/dist/context/expand-context-blocks.js.map +1 -0
- package/dist/delegate-with-escalation.d.ts +34 -0
- package/dist/delegate-with-escalation.d.ts.map +1 -0
- package/dist/delegate-with-escalation.js +168 -0
- package/dist/delegate-with-escalation.js.map +1 -0
- package/dist/index.d.ts +4 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/model-profiles.json +8 -4
- package/dist/provider.d.ts.map +1 -1
- package/dist/provider.js +7 -1
- package/dist/provider.js.map +1 -1
- package/dist/routing/model-profiles.d.ts +1 -0
- package/dist/routing/model-profiles.d.ts.map +1 -1
- package/dist/routing/model-profiles.js +4 -0
- package/dist/routing/model-profiles.js.map +1 -1
- package/dist/run-tasks.d.ts +26 -2
- package/dist/run-tasks.d.ts.map +1 -1
- package/dist/run-tasks.js +61 -19
- package/dist/run-tasks.js.map +1 -1
- package/dist/runners/claude-runner.d.ts.map +1 -1
- package/dist/runners/claude-runner.js +643 -32
- 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 +473 -48
- package/dist/runners/codex-runner.js.map +1 -1
- package/dist/runners/error-classification.d.ts +30 -0
- package/dist/runners/error-classification.d.ts.map +1 -0
- package/dist/runners/error-classification.js +72 -0
- package/dist/runners/error-classification.js.map +1 -0
- package/dist/runners/injection-type.d.ts +17 -0
- package/dist/runners/injection-type.d.ts.map +1 -0
- package/dist/runners/injection-type.js +27 -0
- package/dist/runners/injection-type.js.map +1 -0
- package/dist/runners/openai-runner.d.ts +5 -0
- package/dist/runners/openai-runner.d.ts.map +1 -1
- package/dist/runners/openai-runner.js +508 -36
- package/dist/runners/openai-runner.js.map +1 -1
- package/dist/runners/prevention.d.ts +41 -0
- package/dist/runners/prevention.d.ts.map +1 -0
- package/dist/runners/prevention.js +68 -0
- package/dist/runners/prevention.js.map +1 -0
- package/dist/runners/supervision.d.ts +130 -0
- package/dist/runners/supervision.d.ts.map +1 -0
- package/dist/runners/supervision.js +238 -0
- package/dist/runners/supervision.js.map +1 -0
- package/dist/tools/claude-adapter.d.ts.map +1 -1
- package/dist/tools/claude-adapter.js +6 -3
- package/dist/tools/claude-adapter.js.map +1 -1
- package/dist/tools/definitions.d.ts +3 -1
- package/dist/tools/definitions.d.ts.map +1 -1
- package/dist/tools/definitions.js +56 -5
- package/dist/tools/definitions.js.map +1 -1
- package/dist/tools/openai-adapter.d.ts.map +1 -1
- package/dist/tools/openai-adapter.js +6 -3
- package/dist/tools/openai-adapter.js.map +1 -1
- package/dist/tools/scratchpad.d.ts +28 -0
- package/dist/tools/scratchpad.d.ts.map +1 -0
- package/dist/tools/scratchpad.js +49 -0
- package/dist/tools/scratchpad.js.map +1 -0
- package/dist/tools/tracker.d.ts +38 -2
- package/dist/tools/tracker.d.ts.map +1 -1
- package/dist/tools/tracker.js +54 -5
- package/dist/tools/tracker.js.map +1 -1
- package/dist/types.d.ts +184 -2
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +17 -1
- package/dist/types.js.map +1 -1
- package/package.json +9 -15
package/README.md
CHANGED
|
@@ -10,12 +10,6 @@ This is the building-block library. If you just want to run the MCP server, inst
|
|
|
10
10
|
npm install @zhixuan92/multi-model-agent-core
|
|
11
11
|
```
|
|
12
12
|
|
|
13
|
-
If you plan to use `openai-compatible` providers, also install the optional peer dependencies:
|
|
14
|
-
|
|
15
|
-
```bash
|
|
16
|
-
npm install @openai/agents openai
|
|
17
|
-
```
|
|
18
|
-
|
|
19
13
|
Requires Node `>= 22`. ESM only.
|
|
20
14
|
|
|
21
15
|
## What's exported
|
package/dist/config/schema.d.ts
CHANGED
|
@@ -26,6 +26,9 @@ export declare const codexProviderConfigSchema: z.ZodObject<{
|
|
|
26
26
|
high: "high";
|
|
27
27
|
free: "free";
|
|
28
28
|
}>>;
|
|
29
|
+
inputCostPerMTok: z.ZodOptional<z.ZodNumber>;
|
|
30
|
+
outputCostPerMTok: z.ZodOptional<z.ZodNumber>;
|
|
31
|
+
inputTokenSoftLimit: z.ZodOptional<z.ZodNumber>;
|
|
29
32
|
}, z.core.$strip>;
|
|
30
33
|
export declare const claudeProviderConfigSchema: z.ZodObject<{
|
|
31
34
|
type: z.ZodLiteral<"claude">;
|
|
@@ -53,6 +56,9 @@ export declare const claudeProviderConfigSchema: z.ZodObject<{
|
|
|
53
56
|
high: "high";
|
|
54
57
|
free: "free";
|
|
55
58
|
}>>;
|
|
59
|
+
inputCostPerMTok: z.ZodOptional<z.ZodNumber>;
|
|
60
|
+
outputCostPerMTok: z.ZodOptional<z.ZodNumber>;
|
|
61
|
+
inputTokenSoftLimit: z.ZodOptional<z.ZodNumber>;
|
|
56
62
|
}, z.core.$strip>;
|
|
57
63
|
export declare const openAICompatibleProviderConfigSchema: z.ZodObject<{
|
|
58
64
|
type: z.ZodLiteral<"openai-compatible">;
|
|
@@ -83,6 +89,9 @@ export declare const openAICompatibleProviderConfigSchema: z.ZodObject<{
|
|
|
83
89
|
high: "high";
|
|
84
90
|
free: "free";
|
|
85
91
|
}>>;
|
|
92
|
+
inputCostPerMTok: z.ZodOptional<z.ZodNumber>;
|
|
93
|
+
outputCostPerMTok: z.ZodOptional<z.ZodNumber>;
|
|
94
|
+
inputTokenSoftLimit: z.ZodOptional<z.ZodNumber>;
|
|
86
95
|
}, z.core.$strip>;
|
|
87
96
|
export declare const providerConfigSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
88
97
|
type: z.ZodLiteral<"codex">;
|
|
@@ -110,6 +119,9 @@ export declare const providerConfigSchema: z.ZodDiscriminatedUnion<[z.ZodObject<
|
|
|
110
119
|
high: "high";
|
|
111
120
|
free: "free";
|
|
112
121
|
}>>;
|
|
122
|
+
inputCostPerMTok: z.ZodOptional<z.ZodNumber>;
|
|
123
|
+
outputCostPerMTok: z.ZodOptional<z.ZodNumber>;
|
|
124
|
+
inputTokenSoftLimit: z.ZodOptional<z.ZodNumber>;
|
|
113
125
|
}, z.core.$strip>, z.ZodObject<{
|
|
114
126
|
type: z.ZodLiteral<"claude">;
|
|
115
127
|
model: z.ZodString;
|
|
@@ -136,6 +148,9 @@ export declare const providerConfigSchema: z.ZodDiscriminatedUnion<[z.ZodObject<
|
|
|
136
148
|
high: "high";
|
|
137
149
|
free: "free";
|
|
138
150
|
}>>;
|
|
151
|
+
inputCostPerMTok: z.ZodOptional<z.ZodNumber>;
|
|
152
|
+
outputCostPerMTok: z.ZodOptional<z.ZodNumber>;
|
|
153
|
+
inputTokenSoftLimit: z.ZodOptional<z.ZodNumber>;
|
|
139
154
|
}, z.core.$strip>, z.ZodObject<{
|
|
140
155
|
type: z.ZodLiteral<"openai-compatible">;
|
|
141
156
|
model: z.ZodString;
|
|
@@ -165,6 +180,9 @@ export declare const providerConfigSchema: z.ZodDiscriminatedUnion<[z.ZodObject<
|
|
|
165
180
|
high: "high";
|
|
166
181
|
free: "free";
|
|
167
182
|
}>>;
|
|
183
|
+
inputCostPerMTok: z.ZodOptional<z.ZodNumber>;
|
|
184
|
+
outputCostPerMTok: z.ZodOptional<z.ZodNumber>;
|
|
185
|
+
inputTokenSoftLimit: z.ZodOptional<z.ZodNumber>;
|
|
168
186
|
}, z.core.$strip>], "type">;
|
|
169
187
|
export declare const multiModelConfigSchema: z.ZodObject<{
|
|
170
188
|
providers: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
@@ -193,6 +211,9 @@ export declare const multiModelConfigSchema: z.ZodObject<{
|
|
|
193
211
|
high: "high";
|
|
194
212
|
free: "free";
|
|
195
213
|
}>>;
|
|
214
|
+
inputCostPerMTok: z.ZodOptional<z.ZodNumber>;
|
|
215
|
+
outputCostPerMTok: z.ZodOptional<z.ZodNumber>;
|
|
216
|
+
inputTokenSoftLimit: z.ZodOptional<z.ZodNumber>;
|
|
196
217
|
}, z.core.$strip>, z.ZodObject<{
|
|
197
218
|
type: z.ZodLiteral<"claude">;
|
|
198
219
|
model: z.ZodString;
|
|
@@ -219,6 +240,9 @@ export declare const multiModelConfigSchema: z.ZodObject<{
|
|
|
219
240
|
high: "high";
|
|
220
241
|
free: "free";
|
|
221
242
|
}>>;
|
|
243
|
+
inputCostPerMTok: z.ZodOptional<z.ZodNumber>;
|
|
244
|
+
outputCostPerMTok: z.ZodOptional<z.ZodNumber>;
|
|
245
|
+
inputTokenSoftLimit: z.ZodOptional<z.ZodNumber>;
|
|
222
246
|
}, z.core.$strip>, z.ZodObject<{
|
|
223
247
|
type: z.ZodLiteral<"openai-compatible">;
|
|
224
248
|
model: z.ZodString;
|
|
@@ -248,6 +272,9 @@ export declare const multiModelConfigSchema: z.ZodObject<{
|
|
|
248
272
|
high: "high";
|
|
249
273
|
free: "free";
|
|
250
274
|
}>>;
|
|
275
|
+
inputCostPerMTok: z.ZodOptional<z.ZodNumber>;
|
|
276
|
+
outputCostPerMTok: z.ZodOptional<z.ZodNumber>;
|
|
277
|
+
inputTokenSoftLimit: z.ZodOptional<z.ZodNumber>;
|
|
251
278
|
}, z.core.$strip>], "type">>>;
|
|
252
279
|
defaults: z.ZodDefault<z.ZodObject<{
|
|
253
280
|
maxTurns: z.ZodDefault<z.ZodNumber>;
|
|
@@ -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,EAGV,gBAAgB,EAGjB,MAAM,aAAa,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,EAGV,gBAAgB,EAGjB,MAAM,aAAa,CAAC;AAarB,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAYpC,CAAC;AAEH,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAYrC,CAAC;AAEH,eAAO,MAAM,oCAAoC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAe/C,CAAC;AAEH,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2BAI/B,CAAC;AAUH,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAGjC,CAAC;AAEH,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,gBAAgB,CAAA;IACxB,OAAO,EAAE,IAAI,CAAA;CACd;AAED,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE,KAAK,CAAA;IACd,KAAK,EAAE,MAAM,CAAA;CACd;AAED,MAAM,MAAM,iBAAiB,GAAG,mBAAmB,GAAG,mBAAmB,CAAA;AAEzE;;;GAGG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,OAAO,GAAG,gBAAgB,CAE1D"}
|
package/dist/config/schema.js
CHANGED
|
@@ -4,6 +4,10 @@ const effortSchema = z.enum(['none', 'low', 'medium', 'high']);
|
|
|
4
4
|
const costTierSchema = z.enum(['free', 'low', 'medium', 'high']);
|
|
5
5
|
const hostedToolsSchema = z.array(z.enum(['web_search', 'image_generation', 'code_interpreter']));
|
|
6
6
|
const sandboxPolicySchema = z.enum(['none', 'cwd-only']).optional();
|
|
7
|
+
// Per-million-token pricing for cost computation. Must be non-negative; zero
|
|
8
|
+
// is allowed (free providers can set both rates to 0 to get a deterministic
|
|
9
|
+
// costUSD: 0 instead of null).
|
|
10
|
+
const tokenCostSchema = z.number().nonnegative().finite().optional();
|
|
7
11
|
export const codexProviderConfigSchema = z.object({
|
|
8
12
|
type: z.literal('codex'),
|
|
9
13
|
model: z.string(),
|
|
@@ -13,6 +17,9 @@ export const codexProviderConfigSchema = z.object({
|
|
|
13
17
|
sandboxPolicy: sandboxPolicySchema,
|
|
14
18
|
hostedTools: hostedToolsSchema.optional(),
|
|
15
19
|
costTier: costTierSchema.optional(),
|
|
20
|
+
inputCostPerMTok: tokenCostSchema,
|
|
21
|
+
outputCostPerMTok: tokenCostSchema,
|
|
22
|
+
inputTokenSoftLimit: z.number().int().positive().optional(),
|
|
16
23
|
});
|
|
17
24
|
export const claudeProviderConfigSchema = z.object({
|
|
18
25
|
type: z.literal('claude'),
|
|
@@ -23,6 +30,9 @@ export const claudeProviderConfigSchema = z.object({
|
|
|
23
30
|
sandboxPolicy: sandboxPolicySchema,
|
|
24
31
|
hostedTools: hostedToolsSchema.optional(),
|
|
25
32
|
costTier: costTierSchema.optional(),
|
|
33
|
+
inputCostPerMTok: tokenCostSchema,
|
|
34
|
+
outputCostPerMTok: tokenCostSchema,
|
|
35
|
+
inputTokenSoftLimit: z.number().int().positive().optional(),
|
|
26
36
|
});
|
|
27
37
|
export const openAICompatibleProviderConfigSchema = z.object({
|
|
28
38
|
type: z.literal('openai-compatible'),
|
|
@@ -36,6 +46,9 @@ export const openAICompatibleProviderConfigSchema = z.object({
|
|
|
36
46
|
sandboxPolicy: sandboxPolicySchema,
|
|
37
47
|
hostedTools: hostedToolsSchema.optional(),
|
|
38
48
|
costTier: costTierSchema.optional(),
|
|
49
|
+
inputCostPerMTok: tokenCostSchema,
|
|
50
|
+
outputCostPerMTok: tokenCostSchema,
|
|
51
|
+
inputTokenSoftLimit: z.number().int().positive().optional(),
|
|
39
52
|
});
|
|
40
53
|
export const providerConfigSchema = z.discriminatedUnion('type', [
|
|
41
54
|
codexProviderConfigSchema,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../src/config/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AASxB,mCAAmC;AAEnC,MAAM,YAAY,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC,CAAC;AAC/D,MAAM,cAAc,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC,CAAC;AACjE,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,YAAY,EAAE,kBAAkB,EAAE,kBAAkB,CAAC,CAAC,CAAC,CAAC;AAClG,MAAM,mBAAmB,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../src/config/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AASxB,mCAAmC;AAEnC,MAAM,YAAY,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC,CAAC;AAC/D,MAAM,cAAc,GAAG,CAAC,CAAC,IAAI,CAAC,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AM,UAAU,WAAW,CAAC,GAAY;IACtC,OAAO,sBAAsB,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;AAC3C,CAAC"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Metadata describing a successful `register(...)` call. The orchestrator
|
|
3
|
+
* and MCP tool surfaces return this to the caller so they can reference
|
|
4
|
+
* the stored block later (by id) and independently verify its content
|
|
5
|
+
* (via sha256).
|
|
6
|
+
*/
|
|
7
|
+
export interface RegisteredBlock {
|
|
8
|
+
id: string;
|
|
9
|
+
lengthChars: number;
|
|
10
|
+
sha256: string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Minimal store contract for reusable context blocks.
|
|
14
|
+
*
|
|
15
|
+
* The intent is to let a caller register a large brief once, then reference
|
|
16
|
+
* it by id from many subsequent dispatches without re-transmitting the
|
|
17
|
+
* content on every call. See `expandContextBlocks` for the resolution
|
|
18
|
+
* step that turns `TaskSpec.contextBlockIds` into prompt text.
|
|
19
|
+
*/
|
|
20
|
+
export interface ContextBlockStore {
|
|
21
|
+
/** Store `content` under an explicit id (idempotent replace) or a new
|
|
22
|
+
* UUID. Returns the id, length, and sha256 hash. */
|
|
23
|
+
register(content: string, opts?: {
|
|
24
|
+
id?: string;
|
|
25
|
+
}): RegisteredBlock;
|
|
26
|
+
/** Fetch content by id. Returns `undefined` if the id is unknown or
|
|
27
|
+
* the entry has expired. Touches the LRU access time on success. */
|
|
28
|
+
get(id: string): string | undefined;
|
|
29
|
+
/** Delete an entry. Returns `true` if the entry existed. */
|
|
30
|
+
delete(id: string): boolean;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Thrown by `expandContextBlocks` when a task references a block id that
|
|
34
|
+
* cannot be resolved against the store (missing, expired, or evicted).
|
|
35
|
+
* Callers are expected to surface this to the user so they can re-register
|
|
36
|
+
* the block and retry.
|
|
37
|
+
*/
|
|
38
|
+
export declare class ContextBlockNotFoundError extends Error {
|
|
39
|
+
readonly id: string;
|
|
40
|
+
constructor(id: string);
|
|
41
|
+
}
|
|
42
|
+
export interface InMemoryContextBlockStoreOptions {
|
|
43
|
+
/** TTL in milliseconds. Defaults to 30 minutes. */
|
|
44
|
+
ttlMs?: number;
|
|
45
|
+
/** Max number of entries before LRU eviction. Defaults to 100. */
|
|
46
|
+
maxEntries?: number;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* In-memory implementation with two bounds:
|
|
50
|
+
* 1. A TTL (time-to-live) from `addedAtMs` — checked lazily on `get`.
|
|
51
|
+
* 2. An LRU cap on entry count — enforced eagerly after every `register`.
|
|
52
|
+
*
|
|
53
|
+
* Both bounds are intentional: the TTL prevents stale briefs from lingering
|
|
54
|
+
* after a long-running session; the LRU cap prevents memory growth from a
|
|
55
|
+
* chatty caller that never explicitly deletes anything. The eviction loop
|
|
56
|
+
* is O(n) per insertion but `n <= maxEntries` (defaults to 100), so we
|
|
57
|
+
* keep the implementation simple.
|
|
58
|
+
*
|
|
59
|
+
* `Date.now()` is read directly (not through a clock abstraction) so tests
|
|
60
|
+
* can drive time forward with Vitest's fake timers.
|
|
61
|
+
*/
|
|
62
|
+
export declare class InMemoryContextBlockStore implements ContextBlockStore {
|
|
63
|
+
private entries;
|
|
64
|
+
private ttlMs;
|
|
65
|
+
private maxEntries;
|
|
66
|
+
private tick;
|
|
67
|
+
constructor(opts?: InMemoryContextBlockStoreOptions);
|
|
68
|
+
register(content: string, opts?: {
|
|
69
|
+
id?: string;
|
|
70
|
+
}): RegisteredBlock;
|
|
71
|
+
get(id: string): string | undefined;
|
|
72
|
+
delete(id: string): boolean;
|
|
73
|
+
private evictIfOverBound;
|
|
74
|
+
}
|
|
75
|
+
//# sourceMappingURL=context-block-store.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context-block-store.d.ts","sourceRoot":"","sources":["../../src/context/context-block-store.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,MAAM,WAA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
3
|
+
* Thrown by `expandContextBlocks` when a task references a block id that
|
|
4
|
+
* cannot be resolved against the store (missing, expired, or evicted).
|
|
5
|
+
* Callers are expected to surface this to the user so they can re-register
|
|
6
|
+
* the block and retry.
|
|
7
|
+
*/
|
|
8
|
+
export class ContextBlockNotFoundError extends Error {
|
|
9
|
+
id;
|
|
10
|
+
constructor(id) {
|
|
11
|
+
super(`context block "${id}" is unknown or expired`);
|
|
12
|
+
this.id = id;
|
|
13
|
+
this.name = 'ContextBlockNotFoundError';
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* In-memory implementation with two bounds:
|
|
18
|
+
* 1. A TTL (time-to-live) from `addedAtMs` — checked lazily on `get`.
|
|
19
|
+
* 2. An LRU cap on entry count — enforced eagerly after every `register`.
|
|
20
|
+
*
|
|
21
|
+
* Both bounds are intentional: the TTL prevents stale briefs from lingering
|
|
22
|
+
* after a long-running session; the LRU cap prevents memory growth from a
|
|
23
|
+
* chatty caller that never explicitly deletes anything. The eviction loop
|
|
24
|
+
* is O(n) per insertion but `n <= maxEntries` (defaults to 100), so we
|
|
25
|
+
* keep the implementation simple.
|
|
26
|
+
*
|
|
27
|
+
* `Date.now()` is read directly (not through a clock abstraction) so tests
|
|
28
|
+
* can drive time forward with Vitest's fake timers.
|
|
29
|
+
*/
|
|
30
|
+
export class InMemoryContextBlockStore {
|
|
31
|
+
entries = new Map();
|
|
32
|
+
ttlMs;
|
|
33
|
+
maxEntries;
|
|
34
|
+
tick = 0;
|
|
35
|
+
constructor(opts = {}) {
|
|
36
|
+
this.ttlMs = opts.ttlMs ?? 30 * 60 * 1000;
|
|
37
|
+
this.maxEntries = opts.maxEntries ?? 100;
|
|
38
|
+
}
|
|
39
|
+
register(content, opts = {}) {
|
|
40
|
+
const id = opts.id ?? randomUUID();
|
|
41
|
+
const now = Date.now();
|
|
42
|
+
this.entries.set(id, { content, addedAtMs: now, lastAccessTick: ++this.tick });
|
|
43
|
+
this.evictIfOverBound();
|
|
44
|
+
return {
|
|
45
|
+
id,
|
|
46
|
+
lengthChars: content.length,
|
|
47
|
+
sha256: createHash('sha256').update(content).digest('hex'),
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
get(id) {
|
|
51
|
+
const entry = this.entries.get(id);
|
|
52
|
+
if (!entry)
|
|
53
|
+
return undefined;
|
|
54
|
+
const now = Date.now();
|
|
55
|
+
if (now - entry.addedAtMs > this.ttlMs) {
|
|
56
|
+
this.entries.delete(id);
|
|
57
|
+
return undefined;
|
|
58
|
+
}
|
|
59
|
+
entry.lastAccessTick = ++this.tick;
|
|
60
|
+
return entry.content;
|
|
61
|
+
}
|
|
62
|
+
delete(id) {
|
|
63
|
+
return this.entries.delete(id);
|
|
64
|
+
}
|
|
65
|
+
evictIfOverBound() {
|
|
66
|
+
while (this.entries.size > this.maxEntries) {
|
|
67
|
+
let oldestId;
|
|
68
|
+
let oldestTick = Infinity;
|
|
69
|
+
for (const [id, entry] of this.entries) {
|
|
70
|
+
if (entry.lastAccessTick < oldestTick) {
|
|
71
|
+
oldestTick = entry.lastAccessTick;
|
|
72
|
+
oldestId = id;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
if (oldestId)
|
|
76
|
+
this.entries.delete(oldestId);
|
|
77
|
+
else
|
|
78
|
+
break;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
//# sourceMappingURL=context-block-store.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context-block-store.js","sourceRoot":"","sources":["../../src/context/context-block-store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAiCrD;;;;;GAKG;AACH,MAAM,OAAO,yBAA0B,SAAQ,KAAK;IACtB;IAA5B,YAA4B,EAAU;QACpC,KAAK,CAAC,kBAAkB,EAAE,yBAAyB,CAAC,CAAC;QAD3B,OAAE,GAAF,EAAE,CAAQ;Q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K,EAAE,CAAC;YACvC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;YACxB,OAAO,SAAS,CAAC;QACnB,CAAC;QACD,KAAK,CAAC,cAAc,GAAG,EAAE,IAAI,CAAC,IAAI,CAAC;QACnC,OAAO,KAAK,CAAC,OAAO,CAAC;IACvB,CAAC;IAED,MAAM,CAAC,EAAU;QACf,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;IACjC,CAAC;IAEO,gBAAgB;QACtB,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC,UAAU,EAAE,CAAC;YAC3C,IAAI,QAA4B,CAAC;YACjC,IAAI,UAAU,GAAG,QAAQ,CAAC;YAC1B,KAAK,MAAM,CAAC,EAAE,EAAE,KAAK,CAAC,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;gBACvC,IAAI,KAAK,CAAC,cAAc,GAAG,UAAU,EAAE,CAAC;oBACtC,UAAU,GAAG,KAAK,CAAC,cAAc,CAAC;oBAClC,QAAQ,GAAG,EAAE,CAAC;gBAChB,CAAC;YACH,CAAC;YACD,IAAI,QAAQ;gBAAE,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;;gBACvC,MAAM;QACb,CAAC;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { type ContextBlockStore } from './context-block-store.js';
|
|
2
|
+
import type { TaskSpec } from '../types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Expands a task's `contextBlockIds` against a `ContextBlockStore`,
|
|
5
|
+
* returning a NEW `TaskSpec` whose `prompt` has the resolved blocks
|
|
6
|
+
* prepended (in the order they appear in `contextBlockIds`) with
|
|
7
|
+
* `SEPARATOR` between each block and before the original prompt.
|
|
8
|
+
*
|
|
9
|
+
* The returned task has `contextBlockIds` removed so downstream code
|
|
10
|
+
* cannot accidentally double-expand.
|
|
11
|
+
*
|
|
12
|
+
* If the task has no `contextBlockIds` (or the array is empty), or if
|
|
13
|
+
* no store is provided, the task is returned unchanged — the caller
|
|
14
|
+
* does not have to special-case the no-op path.
|
|
15
|
+
*
|
|
16
|
+
* Throws `ContextBlockNotFoundError` synchronously on the first missing
|
|
17
|
+
* id so the caller gets a clear error pointing to the offending block.
|
|
18
|
+
*/
|
|
19
|
+
export declare function expandContextBlocks(task: TaskSpec, store: ContextBlockStore | undefined): TaskSpec;
|
|
20
|
+
//# sourceMappingURL=expand-context-blocks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"expand-context-blocks.d.ts","sourceRoot":"","sources":["../../src/context/expand-context-blocks.ts"],"names":[],"mappings":"AAAA,OAAO,EAA6B,KAAK,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7F,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAU5C;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,QAAQ,EACd,KAAK,EAAE,iBAAiB,GAAG,SAAS,GACnC,QAAQ,CAoBV"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { ContextBlockNotFoundError } from './context-block-store.js';
|
|
2
|
+
/**
|
|
3
|
+
* Separator inserted between resolved blocks and between the last block
|
|
4
|
+
* and the original prompt. Exact string is load-bearing — tests assert on
|
|
5
|
+
* it, and the hash inputs in `onInitialRequest` depend on the rendered
|
|
6
|
+
* prompt being byte-stable across dispatches.
|
|
7
|
+
*/
|
|
8
|
+
const SEPARATOR = '\n\n---\n\n';
|
|
9
|
+
/**
|
|
10
|
+
* Expands a task's `contextBlockIds` against a `ContextBlockStore`,
|
|
11
|
+
* returning a NEW `TaskSpec` whose `prompt` has the resolved blocks
|
|
12
|
+
* prepended (in the order they appear in `contextBlockIds`) with
|
|
13
|
+
* `SEPARATOR` between each block and before the original prompt.
|
|
14
|
+
*
|
|
15
|
+
* The returned task has `contextBlockIds` removed so downstream code
|
|
16
|
+
* cannot accidentally double-expand.
|
|
17
|
+
*
|
|
18
|
+
* If the task has no `contextBlockIds` (or the array is empty), or if
|
|
19
|
+
* no store is provided, the task is returned unchanged — the caller
|
|
20
|
+
* does not have to special-case the no-op path.
|
|
21
|
+
*
|
|
22
|
+
* Throws `ContextBlockNotFoundError` synchronously on the first missing
|
|
23
|
+
* id so the caller gets a clear error pointing to the offending block.
|
|
24
|
+
*/
|
|
25
|
+
export function expandContextBlocks(task, store) {
|
|
26
|
+
if (!task.contextBlockIds || task.contextBlockIds.length === 0)
|
|
27
|
+
return task;
|
|
28
|
+
if (!store)
|
|
29
|
+
return task;
|
|
30
|
+
const blocks = [];
|
|
31
|
+
for (const id of task.contextBlockIds) {
|
|
32
|
+
const content = store.get(id);
|
|
33
|
+
if (content === undefined) {
|
|
34
|
+
throw new ContextBlockNotFoundError(id);
|
|
35
|
+
}
|
|
36
|
+
blocks.push(content);
|
|
37
|
+
}
|
|
38
|
+
const expanded = blocks.join(SEPARATOR) + SEPARATOR + task.prompt;
|
|
39
|
+
// Strip contextBlockIds from the returned task so a second pass through
|
|
40
|
+
// expandContextBlocks is a no-op (defence in depth against double-
|
|
41
|
+
// expansion if runtime-plumbing calls it twice).
|
|
42
|
+
const { contextBlockIds, ...rest } = task;
|
|
43
|
+
void contextBlockIds;
|
|
44
|
+
return { ...rest, prompt: expanded };
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=expand-context-blocks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"expand-context-blocks.js","sourceRoot":"","sources":["../../src/context/expand-context-blocks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAA0B,MAAM,0BAA0B,CAAC;AAG7F;;;;;GAKG;AACH,MAAM,SAAS,GAAG,aAAa,CAAC;AAEhC;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,mBAAmB,CACjC,IAAc,EACd,KAAoC;IAEpC,IAAI,CAAC,IAAI,CAAC,eAAe,IAAI,IAAI,CAAC,eAAe,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IAC5E,IAAI,CAAC,KAAK;QAAE,OAAO,IAAI,CAAC;IAExB,MAAM,MAAM,GAAa,EAAE,CAAC;IAC5B,KAAK,MAAM,EAAE,IAAI,IAAI,CAAC,eAAe,EAAE,CAAC;QACtC,MAAM,OAAO,GAAG,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QAC9B,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;YAC1B,MAAM,IAAI,yBAAyB,CAAC,EAAE,CAAC,CAAC;QAC1C,CAAC;QACD,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACvB,CAAC;IAED,MAAM,QAAQ,GAAG,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,SAAS,GAAG,IAAI,CAAC,MAAM,CAAC;IAClE,wEAAwE;IACxE,mEAAmE;IACnE,iDAAiD;IACjD,MAAM,EAAE,eAAe,EAAE,GAAG,IAAI,EAAE,GAAG,IAAI,CAAC;IAC1C,KAAK,eAAe,CAAC;IACrB,OAAO,EAAE,GAAG,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC;AACvC,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { TaskSpec, RunResult, Provider, MultiModelConfig, ProgressEvent } from './types.js';
|
|
2
|
+
export interface DelegateOptions {
|
|
3
|
+
/** When true, the orchestrator does not walk the chain on failure —
|
|
4
|
+
* the first (and only) provider's result is returned as-is. */
|
|
5
|
+
explicitlyPinned?: boolean;
|
|
6
|
+
/** Optional in-flight progress sink. When provided, it is threaded into
|
|
7
|
+
* every `provider.run(...)` call so runners can emit turn/tool/injection
|
|
8
|
+
* events, and the orchestrator itself emits one `escalation_start` event
|
|
9
|
+
* between attempts whenever it hops to the next provider in the chain.
|
|
10
|
+
* The callback MUST NOT throw. See `ProgressEvent` for variants. */
|
|
11
|
+
onProgress?: (event: ProgressEvent) => void;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Build the escalation chain for an auto-routed task. Returns all eligible
|
|
15
|
+
* providers sorted cheapest-first with alphabetical tiebreak — this mirrors
|
|
16
|
+
* `selectProviderForTask`'s ordering so the first element of the chain is the
|
|
17
|
+
* same provider auto-routing would have picked.
|
|
18
|
+
*
|
|
19
|
+
* Eligibility (capability + tier filters) is handled entirely by
|
|
20
|
+
* `getProviderEligibility`; we just drop the ineligible entries.
|
|
21
|
+
*/
|
|
22
|
+
export declare function buildEscalationChain(task: TaskSpec, config: MultiModelConfig): Provider[];
|
|
23
|
+
/**
|
|
24
|
+
* Walks the provider chain for an auto-routed task. Returns the first
|
|
25
|
+
* successful result; if all attempts fail, returns the best salvageable
|
|
26
|
+
* output (longest non-empty) with status 'incomplete' and the full
|
|
27
|
+
* escalation log.
|
|
28
|
+
*
|
|
29
|
+
* For explicitly-pinned tasks, the chain has length 1 and there is no
|
|
30
|
+
* walking — the pinned provider's result is returned as-is. See spec
|
|
31
|
+
* Part A.4.
|
|
32
|
+
*/
|
|
33
|
+
export declare function delegateWithEscalation(task: TaskSpec, chain: Provider[], options?: DelegateOptions): Promise<RunResult>;
|
|
34
|
+
//# sourceMappingURL=delegate-with-escalation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delegate-with-escalation.d.ts","sourceRoot":"","sources":["../src/delegate-with-escalation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,QAAQ,EACR,SAAS,EACT,QAAQ,EAER,gBAAgB,EAEhB,aAAa,EACd,MAAM,YAAY,CAAC;AAKpB,MAAM,WAAW,eAAe;IAC9B;oEACgE;IAChE,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B;;;;yEAIqE;IACrE,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,CAAC;CAC7C;AASD;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,QAAQ,EACd,MAAM,EAAE,gBAAgB,GACvB,QAAQ,EAAE,CAYZ;AAED;;;;;;;;;GASG;AACH,wBAAsB,sBAAsB,CAC1C,IAAI,EAAE,QAAQ,EACd,KAAK,EAAE,QAAQ,EAAE,EACjB,OAAO,GAAE,eAAoB,GAC5B,OAAO,CAAC,SAAS,CAAC,CA4IpB"}
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
import { createProvider } from './provider.js';
|
|
2
|
+
import { getProviderEligibility } from './routing/get-provider-eligibility.js';
|
|
3
|
+
import { getEffectiveCostTier } from './routing/model-profiles.js';
|
|
4
|
+
// NOTE: must stay byte-identical to the ordering in
|
|
5
|
+
// routing/select-provider-for-task.ts so the head of the escalation chain is
|
|
6
|
+
// the same provider auto-routing would have picked. If you change one, change
|
|
7
|
+
// both.
|
|
8
|
+
const COST_ORDER = { free: 0, low: 1, medium: 2, high: 3 };
|
|
9
|
+
/**
|
|
10
|
+
* Build the escalation chain for an auto-routed task. Returns all eligible
|
|
11
|
+
* providers sorted cheapest-first with alphabetical tiebreak — this mirrors
|
|
12
|
+
* `selectProviderForTask`'s ordering so the first element of the chain is the
|
|
13
|
+
* same provider auto-routing would have picked.
|
|
14
|
+
*
|
|
15
|
+
* Eligibility (capability + tier filters) is handled entirely by
|
|
16
|
+
* `getProviderEligibility`; we just drop the ineligible entries.
|
|
17
|
+
*/
|
|
18
|
+
export function buildEscalationChain(task, config) {
|
|
19
|
+
const eligibility = getProviderEligibility(task, config);
|
|
20
|
+
const eligible = eligibility.filter((e) => e.eligible);
|
|
21
|
+
eligible.sort((a, b) => {
|
|
22
|
+
const aTier = COST_ORDER[getEffectiveCostTier(a.config)] ?? 3;
|
|
23
|
+
const bTier = COST_ORDER[getEffectiveCostTier(b.config)] ?? 3;
|
|
24
|
+
if (aTier !== bTier)
|
|
25
|
+
return aTier - bTier;
|
|
26
|
+
return a.name.localeCompare(b.name);
|
|
27
|
+
});
|
|
28
|
+
return eligible.map((e) => createProvider(e.name, config));
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Walks the provider chain for an auto-routed task. Returns the first
|
|
32
|
+
* successful result; if all attempts fail, returns the best salvageable
|
|
33
|
+
* output (longest non-empty) with status 'incomplete' and the full
|
|
34
|
+
* escalation log.
|
|
35
|
+
*
|
|
36
|
+
* For explicitly-pinned tasks, the chain has length 1 and there is no
|
|
37
|
+
* walking — the pinned provider's result is returned as-is. See spec
|
|
38
|
+
* Part A.4.
|
|
39
|
+
*/
|
|
40
|
+
export async function delegateWithEscalation(task, chain, options = {}) {
|
|
41
|
+
if (chain.length === 0) {
|
|
42
|
+
throw new Error('delegateWithEscalation called with empty chain');
|
|
43
|
+
}
|
|
44
|
+
// Wrap the user-supplied sink with try/catch so a throwing callback can
|
|
45
|
+
// never corrupt a task. The contract says callbacks MUST NOT throw, but
|
|
46
|
+
// Tasks 9-11 will call this from hot runner loops — defense in depth.
|
|
47
|
+
// This wrapper is also the callback handed to `provider.run`, so runner
|
|
48
|
+
// emissions are covered by the same guard.
|
|
49
|
+
const safeSink = options.onProgress
|
|
50
|
+
? (event) => {
|
|
51
|
+
try {
|
|
52
|
+
options.onProgress(event);
|
|
53
|
+
}
|
|
54
|
+
catch {
|
|
55
|
+
// Swallow — a broken sink must not affect dispatch.
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
: undefined;
|
|
59
|
+
const attempts = [];
|
|
60
|
+
for (let i = 0; i < chain.length; i++) {
|
|
61
|
+
const provider = chain[i];
|
|
62
|
+
// Emit one `escalation_start` between attempts (never before the first).
|
|
63
|
+
// The previous attempt's record is guaranteed to exist here because i>0.
|
|
64
|
+
if (i > 0 && safeSink) {
|
|
65
|
+
const prev = attempts[attempts.length - 1].record;
|
|
66
|
+
safeSink({
|
|
67
|
+
kind: 'escalation_start',
|
|
68
|
+
previousProvider: prev.provider,
|
|
69
|
+
previousReason: prev.reason ?? `status=${prev.status}`,
|
|
70
|
+
nextProvider: provider.name,
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
// Per-attempt metadata captured via the runner's `onInitialRequest`
|
|
74
|
+
// callback. Reset inside the loop so a subsequent escalation hop
|
|
75
|
+
// starts fresh. The runner invokes this exactly once per attempt
|
|
76
|
+
// (Task 12). We wrap assignment in try/catch at the runner site, but
|
|
77
|
+
// assigning to these locals cannot itself throw.
|
|
78
|
+
let initialPromptLengthChars = 0;
|
|
79
|
+
let initialPromptHash = '';
|
|
80
|
+
const result = await provider.run(task.prompt, {
|
|
81
|
+
tools: task.tools,
|
|
82
|
+
maxTurns: task.maxTurns,
|
|
83
|
+
timeoutMs: task.timeoutMs,
|
|
84
|
+
cwd: task.cwd,
|
|
85
|
+
effort: task.effort,
|
|
86
|
+
sandboxPolicy: task.sandboxPolicy,
|
|
87
|
+
onProgress: safeSink,
|
|
88
|
+
onInitialRequest: (meta) => {
|
|
89
|
+
initialPromptLengthChars = meta.lengthChars;
|
|
90
|
+
initialPromptHash = meta.sha256;
|
|
91
|
+
},
|
|
92
|
+
});
|
|
93
|
+
const record = {
|
|
94
|
+
provider: provider.name,
|
|
95
|
+
status: result.status,
|
|
96
|
+
turns: result.turns,
|
|
97
|
+
inputTokens: result.usage.inputTokens,
|
|
98
|
+
outputTokens: result.usage.outputTokens,
|
|
99
|
+
costUSD: result.usage.costUSD,
|
|
100
|
+
initialPromptLengthChars,
|
|
101
|
+
initialPromptHash,
|
|
102
|
+
// Use `||` (not `??`) so an empty-string error falls through to the
|
|
103
|
+
// status sentinel — an empty `reason` would be indistinguishable from
|
|
104
|
+
// an `ok` row in the escalation log.
|
|
105
|
+
reason: result.status === 'ok'
|
|
106
|
+
? undefined
|
|
107
|
+
: (result.error || `status=${result.status}`),
|
|
108
|
+
};
|
|
109
|
+
attempts.push({ result, record });
|
|
110
|
+
if (result.status === 'ok') {
|
|
111
|
+
return {
|
|
112
|
+
...result,
|
|
113
|
+
escalationLog: attempts.map((a) => a.record),
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
// Pinned: stop after the first attempt regardless of status.
|
|
117
|
+
if (options.explicitlyPinned) {
|
|
118
|
+
return {
|
|
119
|
+
...result,
|
|
120
|
+
escalationLog: attempts.map((a) => a.record),
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
// All providers failed. Return the best salvageable output.
|
|
125
|
+
//
|
|
126
|
+
// Two-tier selection based on `RunResult.outputIsDiagnostic`:
|
|
127
|
+
//
|
|
128
|
+
// Tier 1 (preferred): attempts whose `output` contains real
|
|
129
|
+
// model-produced content — a clean final answer (on `ok`, but
|
|
130
|
+
// `ok` short-circuits above so we never see one here) or
|
|
131
|
+
// `scratchpad.latest()` text that the runner actually buffered
|
|
132
|
+
// before termination. These are flagged `outputIsDiagnostic: false`.
|
|
133
|
+
//
|
|
134
|
+
// Tier 2 (fallback): attempts whose `output` is a runner-synthesized
|
|
135
|
+
// diagnostic template (`"Sub-agent error: …"`, `"Agent timed out…"`,
|
|
136
|
+
// `buildXxxIncompleteDiagnostic(...)`, etc.) because the scratchpad
|
|
137
|
+
// was empty at termination. These are `outputIsDiagnostic: true`.
|
|
138
|
+
//
|
|
139
|
+
// Why: status alone is NOT enough. Two `incomplete` attempts can both
|
|
140
|
+
// exist where one has genuine scratchpad content and the other has
|
|
141
|
+
// just the diagnostic template — picking by raw output length would
|
|
142
|
+
// silently discard the real work in favor of a longer diagnostic.
|
|
143
|
+
// Likewise a late `api_error` attempt with a long
|
|
144
|
+
// `"Sub-agent error: <stack trace>"` would beat an earlier
|
|
145
|
+
// `incomplete` attempt with a shorter genuine partial.
|
|
146
|
+
//
|
|
147
|
+
// Within each tier we still pick the longest output, because a
|
|
148
|
+
// longer genuine salvage is usually more useful than a shorter one,
|
|
149
|
+
// and among pure-diagnostic attempts a longer diagnostic usually
|
|
150
|
+
// carries more debugging signal than a shorter one.
|
|
151
|
+
//
|
|
152
|
+
// Note: the `ok` short-circuit above means every entry here is non-ok,
|
|
153
|
+
// so the status-remap below is defensive only.
|
|
154
|
+
const realContentAttempts = attempts.filter((a) => !a.result.outputIsDiagnostic);
|
|
155
|
+
const pool = realContentAttempts.length > 0 ? realContentAttempts : attempts;
|
|
156
|
+
let best = pool[0].result;
|
|
157
|
+
for (const a of pool) {
|
|
158
|
+
if (a.result.output.length > best.output.length) {
|
|
159
|
+
best = a.result;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
return {
|
|
163
|
+
...best,
|
|
164
|
+
status: best.status === 'ok' ? 'incomplete' : best.status,
|
|
165
|
+
escalationLog: attempts.map((a) => a.record),
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
//# sourceMappingURL=delegate-with-escalation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delegate-with-escalation.js","sourceRoot":"","sources":["../src/delegate-with-escalation.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,sBAAsB,EAAE,MAAM,uCAAuC,CAAC;AAC/E,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AAcnE,oDAAoD;AACpD,6EAA6E;AAC7E,8EAA8E;AAC9E,QAAQ;AACR,MAAM,UAAU,GAA6B,EAAE,IAAI,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC;AAGrF;;;;;;;;GAQG;AACH,MAAM,UAAU,oBAAoB,CAClC,IAAc,EACd,MAAwB;IAExB,MAAM,WAAW,GAAG,sBAAsB,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IACzD,MAAM,QAAQ,GAAG,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC;IAEvD,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE;QACrB,M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IACpD,EAAE;IACF,uEAAuE;IACvE,+CAA+C;IAC/C,MAAM,mBAAmB,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,kBAAkB,CAAC,CAAC;IACjF,MAAM,IAAI,GAAG,mBAAmB,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,mBAAmB,CAAC,CAAC,CAAC,QAAQ,CAAC;IAE7E,IAAI,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;IAC1B,KAAK,MAAM,CAAC,IAAI,IAAI,EAAE,CAAC;QACrB,IAAI,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC;YAChD,IAAI,GAAG,CAAC,CAAC,MAAM,CAAC;QAClB,CAAC;IACH,CAAC;IAED,OAAO;QACL,GAAG,IAAI;QACP,MAAM,EAAE,IAAI,CAAC,MAAM,KAAK,IAAI,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM;QACzD,aAAa,EAAE,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC;KAC7C,CAAC;AACJ,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
export { loadConfigFromFile } from './config/load.js';
|
|
2
2
|
export { parseConfig, multiModelConfigSchema } from './config/schema.js';
|
|
3
|
-
export type { Tier, Capability, ToolMode, SandboxPolicy, Effort, CostTier, RunStatus, TaskSpec, ProviderConfig, CodexProviderConfig, ClaudeProviderConfig, OpenAICompatibleProviderConfig, MultiModelConfig, TokenUsage, RunResult, Provider, RunOptions, EligibilityFailureCheck, EligibilityFailure, ProviderEligibility, } from './types.js';
|
|
3
|
+
export type { Tier, Capability, ToolMode, SandboxPolicy, Effort, CostTier, RunStatus, TaskSpec, ProviderConfig, CodexProviderConfig, ClaudeProviderConfig, OpenAICompatibleProviderConfig, MultiModelConfig, TokenUsage, RunResult, Provider, RunOptions, RunTasksRuntime, ProgressEvent, EligibilityFailureCheck, EligibilityFailure, ProviderEligibility, } from './types.js';
|
|
4
|
+
export { InMemoryContextBlockStore, ContextBlockNotFoundError, } from './context/context-block-store.js';
|
|
5
|
+
export type { ContextBlockStore, RegisteredBlock, InMemoryContextBlockStoreOptions, } from './context/context-block-store.js';
|
|
6
|
+
export { expandContextBlocks } from './context/expand-context-blocks.js';
|
|
4
7
|
export { createProvider } from './provider.js';
|
|
5
8
|
export { runTasks } from './run-tasks.js';
|
|
6
9
|
export { getBaseCapabilities } from './routing/capabilities.js';
|