@inflexa-ai/harness 0.43.1 → 0.45.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/dist/agents/report-session-agent.d.ts +1 -1
- package/dist/app/approve-plan.d.ts +48 -0
- package/dist/app/approve-plan.js +84 -0
- package/dist/app/data-profile-view.d.ts +1 -1
- package/dist/app/run-activity.js +4 -6
- package/dist/app/synthesize-run.js +1 -1
- package/dist/contracts/chat-events.d.ts +2 -0
- package/dist/contracts/chat-frame.d.ts +7 -0
- package/dist/contracts/chat-frame.js +18 -4
- package/dist/contracts/chat-parts.d.ts +73 -2
- package/dist/contracts/chat-parts.js +3 -1
- package/dist/contracts/index.d.ts +3 -1
- package/dist/contracts/index.js +1 -0
- package/dist/contracts/part-registry.js +3 -0
- package/dist/contracts/schemas/chat-events.d.ts +13 -0
- package/dist/contracts/schemas/chat-events.js +1 -0
- package/dist/contracts/schemas/chat-parts.d.ts +200 -15
- package/dist/contracts/schemas/chat-parts.js +63 -12
- package/dist/contracts/schemas/index.d.ts +1 -1
- package/dist/contracts/schemas/index.js +1 -1
- package/dist/contracts/subagent-activity.d.ts +12 -0
- package/dist/contracts/subagent-activity.js +76 -0
- package/dist/execution/artifact-metadata.js +1 -3
- package/dist/execution/post-step-pipeline.js +1 -1
- package/dist/execution/run-canceler.js +1 -1
- package/dist/execution/run-event-parts.d.ts +6 -5
- package/dist/execution/run-event-parts.js +6 -5
- package/dist/execution/run-event-stream.d.ts +18 -6
- package/dist/execution/run-event-stream.js +67 -17
- package/dist/execution/run-synthesis.d.ts +21 -0
- package/dist/execution/run-synthesis.js +77 -3
- package/dist/index.d.ts +24 -10
- package/dist/index.js +17 -3
- package/dist/lib/hooks.d.ts +1 -1
- package/dist/lib/metrics.d.ts +2 -2
- package/dist/loop/run-agent.js +1 -0
- package/dist/loop/types.d.ts +2 -0
- package/dist/memory/card-builders.d.ts +11 -0
- package/dist/memory/card-builders.js +35 -21
- package/dist/memory/conversation-display-recorder.d.ts +2 -0
- package/dist/memory/conversation-display-recorder.js +10 -1
- package/dist/memory/conversation-display-storage.d.ts +9 -2
- package/dist/memory/conversation-display-storage.js +18 -3
- package/dist/memory/thread-history.d.ts +8 -1
- package/dist/memory/thread-history.js +13 -3
- package/dist/memory/thread-store.d.ts +13 -0
- package/dist/memory/thread-store.js +15 -1
- package/dist/prompts/conversation.d.ts +1 -1
- package/dist/prompts/conversation.js +3 -1
- package/dist/provenance/seam.d.ts +16 -5
- package/dist/providers/ai-sdk.js +6 -4
- package/dist/reference-data/receipt.d.ts +16 -4
- package/dist/reference-data/receipt.js +20 -3
- package/dist/report-model/pin-snapshot.d.ts +1 -1
- package/dist/report-model/pin-snapshot.js +4 -52
- package/dist/runtime/assemble.d.ts +9 -2
- package/dist/runtime/assemble.js +13 -2
- package/dist/runtime/boot.d.ts +3 -0
- package/dist/runtime/boot.js +10 -1
- package/dist/sandbox/client.d.ts +1 -1
- package/dist/sandbox/create-sandbox.js +1 -1
- package/dist/sandbox/docker-client.js +1 -1
- package/dist/sandbox/k8s-client.js +5 -5
- package/dist/sandbox/sandbox-step-translate.d.ts +23 -0
- package/dist/sandbox/sandbox-step-translate.js +24 -0
- package/dist/schemas/artifact-manifest.d.ts +1 -1
- package/dist/schemas/artifact-manifest.js +11 -9
- package/dist/schemas/plan-schemas.d.ts +18 -18
- package/dist/schemas/run-synthesis.d.ts +2 -2
- package/dist/state/analyses-metrics.d.ts +79 -7
- package/dist/state/analyses-metrics.js +141 -6
- package/dist/state/artifacts.d.ts +50 -3
- package/dist/state/artifacts.js +67 -7
- package/dist/state/data-profile.d.ts +4 -2
- package/dist/state/data-profile.js +7 -5
- package/dist/state/index.d.ts +9 -8
- package/dist/state/index.js +5 -5
- package/dist/state/migrations/20261012120000_index_the_runs_by_start.d.ts +8 -0
- package/dist/state/migrations/20261012120000_index_the_runs_by_start.js +12 -0
- package/dist/state/migrations/20261013120000_index_the_ended_runs_and_the_recent_threads.d.ts +8 -0
- package/dist/state/migrations/20261013120000_index_the_ended_runs_and_the_recent_threads.js +13 -0
- package/dist/state/migrations/20261013180000_narrow_the_active_run_index.d.ts +8 -0
- package/dist/state/migrations/20261013180000_narrow_the_active_run_index.js +13 -0
- package/dist/state/migrations/20261014120000_index_the_plans_by_parent_and_the_runs_by_plan.d.ts +8 -0
- package/dist/state/migrations/20261014120000_index_the_plans_by_parent_and_the_runs_by_plan.js +13 -0
- package/dist/state/migrations/index.js +8 -0
- package/dist/state/plans.d.ts +21 -0
- package/dist/state/plans.js +25 -0
- package/dist/state/runs.d.ts +36 -5
- package/dist/state/runs.js +65 -19
- package/dist/state/schema.d.ts +2 -0
- package/dist/tasks/data-profile-activity.d.ts +7 -1
- package/dist/tasks/data-profile-activity.js +18 -9
- package/dist/tasks/data-profile.d.ts +15 -1
- package/dist/tasks/data-profile.js +18 -13
- package/dist/tools/approval/gateway.js +28 -5
- package/dist/tools/display/show-user.d.ts +1 -1
- package/dist/tools/execute-analysis.d.ts +51 -0
- package/dist/tools/execute-analysis.js +241 -109
- package/dist/tools/report-session/derive-table.js +1 -1
- package/dist/tools/report-session/examine-page.js +1 -1
- package/dist/tools/report-session/list-artifacts.js +2 -2
- package/dist/tools/report-session/preview-report.d.ts +1 -1
- package/dist/tools/report-session/preview-report.js +6 -6
- package/dist/tools/report-session/record-version.d.ts +1 -1
- package/dist/tools/report-session/record-version.js +4 -4
- package/dist/tools/research/inspect-data-profile.d.ts +1 -1
- package/dist/tools/research/inspect-run.d.ts +1 -1
- package/dist/tools/research/inspect-run.js +7 -7
- package/dist/tools/workspace/mutator.js +2 -2
- package/dist/workflows/execute-analysis.d.ts +4 -3
- package/dist/workflows/execute-analysis.js +38 -25
- package/dist/workflows/plan/graph.d.ts +16 -0
- package/dist/workflows/plan/graph.js +36 -0
- package/dist/workflows/sandbox-step.d.ts +2 -2
- package/dist/workflows/sandbox-step.js +16 -14
- package/dist/workspace/filesystem.js +18 -22
- package/dist/workspace/paths.d.ts +7 -4
- package/package.json +4 -4
|
@@ -91,6 +91,7 @@ export declare const PlanPartSchema: z.ZodObject<{
|
|
|
91
91
|
type: z.ZodLiteral<"data-plan">;
|
|
92
92
|
id: z.ZodString;
|
|
93
93
|
planId: z.ZodString;
|
|
94
|
+
parentPlanId: z.ZodOptional<z.ZodString>;
|
|
94
95
|
title: z.ZodOptional<z.ZodString>;
|
|
95
96
|
steps: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
96
97
|
id: z.ZodString;
|
|
@@ -124,6 +125,12 @@ export declare const RunCardPartSchema: z.ZodObject<{
|
|
|
124
125
|
title: z.ZodString;
|
|
125
126
|
stepCount: z.ZodNumber;
|
|
126
127
|
}, z.core.$strip>;
|
|
128
|
+
export declare const PlanApprovalPartSchema: z.ZodObject<{
|
|
129
|
+
type: z.ZodLiteral<"data-plan-approval">;
|
|
130
|
+
planId: z.ZodString;
|
|
131
|
+
runId: z.ZodString;
|
|
132
|
+
approvedAt: z.ZodISODateTime;
|
|
133
|
+
}, z.core.$strip>;
|
|
127
134
|
export declare const FileReferenceEntrySchema: z.ZodObject<{
|
|
128
135
|
path: z.ZodString;
|
|
129
136
|
runId: z.ZodOptional<z.ZodString>;
|
|
@@ -159,6 +166,11 @@ export declare const AskPartSchema: z.ZodObject<{
|
|
|
159
166
|
rejected: "rejected";
|
|
160
167
|
expired: "expired";
|
|
161
168
|
}>;
|
|
169
|
+
reply: z.ZodOptional<z.ZodEnum<{
|
|
170
|
+
once: "once";
|
|
171
|
+
always: "always";
|
|
172
|
+
reject: "reject";
|
|
173
|
+
}>>;
|
|
162
174
|
}, z.core.$strip>;
|
|
163
175
|
export declare const RunStartedPartSchema: z.ZodObject<{
|
|
164
176
|
type: z.ZodLiteral<"data-run-started">;
|
|
@@ -217,6 +229,18 @@ export declare const DagStatePartSchema: z.ZodObject<{
|
|
|
217
229
|
error: z.ZodOptional<z.ZodString>;
|
|
218
230
|
}, z.core.$strict>>;
|
|
219
231
|
}, z.core.$strict>;
|
|
232
|
+
export declare const SynthesisPhaseSchema: z.ZodEnum<{
|
|
233
|
+
failed: "failed";
|
|
234
|
+
skipped: "skipped";
|
|
235
|
+
complete: "complete";
|
|
236
|
+
indexing: "indexing";
|
|
237
|
+
persisting: "persisting";
|
|
238
|
+
starting: "starting";
|
|
239
|
+
researching: "researching";
|
|
240
|
+
drafting: "drafting";
|
|
241
|
+
validating: "validating";
|
|
242
|
+
refining: "refining";
|
|
243
|
+
}>;
|
|
220
244
|
export declare const StepPhaseSchema: z.ZodEnum<{
|
|
221
245
|
failed: "failed";
|
|
222
246
|
complete: "complete";
|
|
@@ -247,6 +271,38 @@ export declare const StepActivityPartSchema: z.ZodObject<{
|
|
|
247
271
|
warning: "warning";
|
|
248
272
|
}>;
|
|
249
273
|
activity: z.ZodString;
|
|
274
|
+
at: z.ZodOptional<z.ZodString>;
|
|
275
|
+
}, z.core.$strip>;
|
|
276
|
+
export declare const ActivityEntryPartSchema: z.ZodObject<{
|
|
277
|
+
type: z.ZodLiteral<"data-activity-entry">;
|
|
278
|
+
id: z.ZodString;
|
|
279
|
+
runId: z.ZodString;
|
|
280
|
+
stepId: z.ZodString;
|
|
281
|
+
phase: z.ZodUnion<readonly [z.ZodEnum<{
|
|
282
|
+
failed: "failed";
|
|
283
|
+
complete: "complete";
|
|
284
|
+
"sandbox-init": "sandbox-init";
|
|
285
|
+
executing: "executing";
|
|
286
|
+
"generating-metadata": "generating-metadata";
|
|
287
|
+
"generating-summary": "generating-summary";
|
|
288
|
+
indexing: "indexing";
|
|
289
|
+
persisting: "persisting";
|
|
290
|
+
retrying: "retrying";
|
|
291
|
+
warning: "warning";
|
|
292
|
+
}>, z.ZodEnum<{
|
|
293
|
+
failed: "failed";
|
|
294
|
+
skipped: "skipped";
|
|
295
|
+
complete: "complete";
|
|
296
|
+
indexing: "indexing";
|
|
297
|
+
persisting: "persisting";
|
|
298
|
+
starting: "starting";
|
|
299
|
+
researching: "researching";
|
|
300
|
+
drafting: "drafting";
|
|
301
|
+
validating: "validating";
|
|
302
|
+
refining: "refining";
|
|
303
|
+
}>]>;
|
|
304
|
+
activity: z.ZodString;
|
|
305
|
+
at: z.ZodString;
|
|
250
306
|
}, z.core.$strip>;
|
|
251
307
|
export declare const FileTreeEntrySchema: z.ZodObject<{
|
|
252
308
|
path: z.ZodString;
|
|
@@ -373,6 +429,17 @@ export declare const RunCompletedPartSchema: z.ZodObject<{
|
|
|
373
429
|
reasoningTokens: z.ZodOptional<z.ZodNumber>;
|
|
374
430
|
}, z.core.$strip>>;
|
|
375
431
|
}, z.core.$strip>;
|
|
432
|
+
export declare const FindingReferenceSchema: z.ZodObject<{
|
|
433
|
+
pmid: z.ZodString;
|
|
434
|
+
citation: z.ZodString;
|
|
435
|
+
relevance: z.ZodString;
|
|
436
|
+
concordance: z.ZodEnum<{
|
|
437
|
+
supports: "supports";
|
|
438
|
+
contradicts: "contradicts";
|
|
439
|
+
extends: "extends";
|
|
440
|
+
contextualizes: "contextualizes";
|
|
441
|
+
}>;
|
|
442
|
+
}, z.core.$strip>;
|
|
376
443
|
export declare const SynthesizedFindingSchema: z.ZodObject<{
|
|
377
444
|
stepId: z.ZodString;
|
|
378
445
|
title: z.ZodString;
|
|
@@ -383,13 +450,24 @@ export declare const SynthesizedFindingSchema: z.ZodObject<{
|
|
|
383
450
|
high: "high";
|
|
384
451
|
}>;
|
|
385
452
|
noveltyStatus: z.ZodEnum<{
|
|
386
|
-
expected: "expected";
|
|
387
453
|
novel: "novel";
|
|
388
454
|
confirmed: "confirmed";
|
|
389
455
|
partially_confirmed: "partially_confirmed";
|
|
390
456
|
contradicted: "contradicted";
|
|
457
|
+
expected: "expected";
|
|
391
458
|
}>;
|
|
392
459
|
literatureInterpretation: z.ZodString;
|
|
460
|
+
references: z.ZodArray<z.ZodObject<{
|
|
461
|
+
pmid: z.ZodString;
|
|
462
|
+
citation: z.ZodString;
|
|
463
|
+
relevance: z.ZodString;
|
|
464
|
+
concordance: z.ZodEnum<{
|
|
465
|
+
supports: "supports";
|
|
466
|
+
contradicts: "contradicts";
|
|
467
|
+
extends: "extends";
|
|
468
|
+
contextualizes: "contextualizes";
|
|
469
|
+
}>;
|
|
470
|
+
}, z.core.$strip>>;
|
|
393
471
|
}, z.core.$strip>;
|
|
394
472
|
export declare const BiologicalThemeSchema: z.ZodObject<{
|
|
395
473
|
name: z.ZodString;
|
|
@@ -415,13 +493,24 @@ export declare const RunSynthesisPartSchema: z.ZodObject<{
|
|
|
415
493
|
high: "high";
|
|
416
494
|
}>;
|
|
417
495
|
noveltyStatus: z.ZodEnum<{
|
|
418
|
-
expected: "expected";
|
|
419
496
|
novel: "novel";
|
|
420
497
|
confirmed: "confirmed";
|
|
421
498
|
partially_confirmed: "partially_confirmed";
|
|
422
499
|
contradicted: "contradicted";
|
|
500
|
+
expected: "expected";
|
|
423
501
|
}>;
|
|
424
502
|
literatureInterpretation: z.ZodString;
|
|
503
|
+
references: z.ZodArray<z.ZodObject<{
|
|
504
|
+
pmid: z.ZodString;
|
|
505
|
+
citation: z.ZodString;
|
|
506
|
+
relevance: z.ZodString;
|
|
507
|
+
concordance: z.ZodEnum<{
|
|
508
|
+
supports: "supports";
|
|
509
|
+
contradicts: "contradicts";
|
|
510
|
+
extends: "extends";
|
|
511
|
+
contextualizes: "contextualizes";
|
|
512
|
+
}>;
|
|
513
|
+
}, z.core.$strip>>;
|
|
425
514
|
}, z.core.$strip>>;
|
|
426
515
|
themes: z.ZodArray<z.ZodObject<{
|
|
427
516
|
name: z.ZodString;
|
|
@@ -438,18 +527,6 @@ export declare const RunSynthesisPartSchema: z.ZodObject<{
|
|
|
438
527
|
description: z.ZodString;
|
|
439
528
|
}, z.core.$strip>>;
|
|
440
529
|
}, z.core.$strip>;
|
|
441
|
-
export declare const SynthesisPhaseSchema: z.ZodEnum<{
|
|
442
|
-
failed: "failed";
|
|
443
|
-
skipped: "skipped";
|
|
444
|
-
complete: "complete";
|
|
445
|
-
indexing: "indexing";
|
|
446
|
-
persisting: "persisting";
|
|
447
|
-
starting: "starting";
|
|
448
|
-
researching: "researching";
|
|
449
|
-
drafting: "drafting";
|
|
450
|
-
validating: "validating";
|
|
451
|
-
refining: "refining";
|
|
452
|
-
}>;
|
|
453
530
|
export declare const SynthesisProgressPartSchema: z.ZodObject<{
|
|
454
531
|
type: z.ZodLiteral<"data-synthesis-progress">;
|
|
455
532
|
id: z.ZodString;
|
|
@@ -467,6 +544,7 @@ export declare const SynthesisProgressPartSchema: z.ZodObject<{
|
|
|
467
544
|
refining: "refining";
|
|
468
545
|
}>;
|
|
469
546
|
activity: z.ZodString;
|
|
547
|
+
at: z.ZodOptional<z.ZodString>;
|
|
470
548
|
delegationCount: z.ZodOptional<z.ZodNumber>;
|
|
471
549
|
reason: z.ZodOptional<z.ZodString>;
|
|
472
550
|
error: z.ZodOptional<z.ZodString>;
|
|
@@ -505,6 +583,40 @@ export declare const CompactionPartSchema: z.ZodObject<{
|
|
|
505
583
|
"mid-turn": "mid-turn";
|
|
506
584
|
}>>;
|
|
507
585
|
}, z.core.$strip>;
|
|
586
|
+
export declare const SubAgentActivityEntrySchema: z.ZodObject<{
|
|
587
|
+
agentId: z.ZodString;
|
|
588
|
+
callPath: z.ZodArray<z.ZodString>;
|
|
589
|
+
tool: z.ZodString;
|
|
590
|
+
label: z.ZodOptional<z.ZodString>;
|
|
591
|
+
startedAt: z.ZodString;
|
|
592
|
+
endedAt: z.ZodOptional<z.ZodString>;
|
|
593
|
+
outcome: z.ZodOptional<z.ZodEnum<{
|
|
594
|
+
error: "error";
|
|
595
|
+
ok: "ok";
|
|
596
|
+
denied: "denied";
|
|
597
|
+
incomplete: "incomplete";
|
|
598
|
+
}>>;
|
|
599
|
+
}, z.core.$strip>;
|
|
600
|
+
export declare const SubAgentActivityPartSchema: z.ZodObject<{
|
|
601
|
+
type: z.ZodLiteral<"data-subagent-activity">;
|
|
602
|
+
id: z.ZodString;
|
|
603
|
+
toolCallId: z.ZodString;
|
|
604
|
+
entries: z.ZodArray<z.ZodObject<{
|
|
605
|
+
agentId: z.ZodString;
|
|
606
|
+
callPath: z.ZodArray<z.ZodString>;
|
|
607
|
+
tool: z.ZodString;
|
|
608
|
+
label: z.ZodOptional<z.ZodString>;
|
|
609
|
+
startedAt: z.ZodString;
|
|
610
|
+
endedAt: z.ZodOptional<z.ZodString>;
|
|
611
|
+
outcome: z.ZodOptional<z.ZodEnum<{
|
|
612
|
+
error: "error";
|
|
613
|
+
ok: "ok";
|
|
614
|
+
denied: "denied";
|
|
615
|
+
incomplete: "incomplete";
|
|
616
|
+
}>>;
|
|
617
|
+
}, z.core.$strip>>;
|
|
618
|
+
dropped: z.ZodNumber;
|
|
619
|
+
}, z.core.$strip>;
|
|
508
620
|
export declare const ChatPartSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
509
621
|
type: z.ZodLiteral<"data-presentation">;
|
|
510
622
|
id: z.ZodString;
|
|
@@ -543,6 +655,7 @@ export declare const ChatPartSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
543
655
|
type: z.ZodLiteral<"data-plan">;
|
|
544
656
|
id: z.ZodString;
|
|
545
657
|
planId: z.ZodString;
|
|
658
|
+
parentPlanId: z.ZodOptional<z.ZodString>;
|
|
546
659
|
title: z.ZodOptional<z.ZodString>;
|
|
547
660
|
steps: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
548
661
|
id: z.ZodString;
|
|
@@ -574,6 +687,11 @@ export declare const ChatPartSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
574
687
|
planId: z.ZodString;
|
|
575
688
|
title: z.ZodString;
|
|
576
689
|
stepCount: z.ZodNumber;
|
|
690
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
691
|
+
type: z.ZodLiteral<"data-plan-approval">;
|
|
692
|
+
planId: z.ZodString;
|
|
693
|
+
runId: z.ZodString;
|
|
694
|
+
approvedAt: z.ZodISODateTime;
|
|
577
695
|
}, z.core.$strip>, z.ZodObject<{
|
|
578
696
|
type: z.ZodLiteral<"data-file-reference">;
|
|
579
697
|
id: z.ZodString;
|
|
@@ -596,6 +714,11 @@ export declare const ChatPartSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
596
714
|
rejected: "rejected";
|
|
597
715
|
expired: "expired";
|
|
598
716
|
}>;
|
|
717
|
+
reply: z.ZodOptional<z.ZodEnum<{
|
|
718
|
+
once: "once";
|
|
719
|
+
always: "always";
|
|
720
|
+
reject: "reject";
|
|
721
|
+
}>>;
|
|
599
722
|
}, z.core.$strip>, z.ZodObject<{
|
|
600
723
|
type: z.ZodLiteral<"data-run-started">;
|
|
601
724
|
runId: z.ZodString;
|
|
@@ -642,6 +765,56 @@ export declare const ChatPartSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
642
765
|
warning: "warning";
|
|
643
766
|
}>;
|
|
644
767
|
activity: z.ZodString;
|
|
768
|
+
at: z.ZodOptional<z.ZodString>;
|
|
769
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
770
|
+
type: z.ZodLiteral<"data-activity-entry">;
|
|
771
|
+
id: z.ZodString;
|
|
772
|
+
runId: z.ZodString;
|
|
773
|
+
stepId: z.ZodString;
|
|
774
|
+
phase: z.ZodUnion<readonly [z.ZodEnum<{
|
|
775
|
+
failed: "failed";
|
|
776
|
+
complete: "complete";
|
|
777
|
+
"sandbox-init": "sandbox-init";
|
|
778
|
+
executing: "executing";
|
|
779
|
+
"generating-metadata": "generating-metadata";
|
|
780
|
+
"generating-summary": "generating-summary";
|
|
781
|
+
indexing: "indexing";
|
|
782
|
+
persisting: "persisting";
|
|
783
|
+
retrying: "retrying";
|
|
784
|
+
warning: "warning";
|
|
785
|
+
}>, z.ZodEnum<{
|
|
786
|
+
failed: "failed";
|
|
787
|
+
skipped: "skipped";
|
|
788
|
+
complete: "complete";
|
|
789
|
+
indexing: "indexing";
|
|
790
|
+
persisting: "persisting";
|
|
791
|
+
starting: "starting";
|
|
792
|
+
researching: "researching";
|
|
793
|
+
drafting: "drafting";
|
|
794
|
+
validating: "validating";
|
|
795
|
+
refining: "refining";
|
|
796
|
+
}>]>;
|
|
797
|
+
activity: z.ZodString;
|
|
798
|
+
at: z.ZodString;
|
|
799
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
800
|
+
type: z.ZodLiteral<"data-subagent-activity">;
|
|
801
|
+
id: z.ZodString;
|
|
802
|
+
toolCallId: z.ZodString;
|
|
803
|
+
entries: z.ZodArray<z.ZodObject<{
|
|
804
|
+
agentId: z.ZodString;
|
|
805
|
+
callPath: z.ZodArray<z.ZodString>;
|
|
806
|
+
tool: z.ZodString;
|
|
807
|
+
label: z.ZodOptional<z.ZodString>;
|
|
808
|
+
startedAt: z.ZodString;
|
|
809
|
+
endedAt: z.ZodOptional<z.ZodString>;
|
|
810
|
+
outcome: z.ZodOptional<z.ZodEnum<{
|
|
811
|
+
error: "error";
|
|
812
|
+
ok: "ok";
|
|
813
|
+
denied: "denied";
|
|
814
|
+
incomplete: "incomplete";
|
|
815
|
+
}>>;
|
|
816
|
+
}, z.core.$strip>>;
|
|
817
|
+
dropped: z.ZodNumber;
|
|
645
818
|
}, z.core.$strip>, z.ZodObject<{
|
|
646
819
|
type: z.ZodLiteral<"data-step-file-tree">;
|
|
647
820
|
id: z.ZodString;
|
|
@@ -722,13 +895,24 @@ export declare const ChatPartSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
722
895
|
high: "high";
|
|
723
896
|
}>;
|
|
724
897
|
noveltyStatus: z.ZodEnum<{
|
|
725
|
-
expected: "expected";
|
|
726
898
|
novel: "novel";
|
|
727
899
|
confirmed: "confirmed";
|
|
728
900
|
partially_confirmed: "partially_confirmed";
|
|
729
901
|
contradicted: "contradicted";
|
|
902
|
+
expected: "expected";
|
|
730
903
|
}>;
|
|
731
904
|
literatureInterpretation: z.ZodString;
|
|
905
|
+
references: z.ZodArray<z.ZodObject<{
|
|
906
|
+
pmid: z.ZodString;
|
|
907
|
+
citation: z.ZodString;
|
|
908
|
+
relevance: z.ZodString;
|
|
909
|
+
concordance: z.ZodEnum<{
|
|
910
|
+
supports: "supports";
|
|
911
|
+
contradicts: "contradicts";
|
|
912
|
+
extends: "extends";
|
|
913
|
+
contextualizes: "contextualizes";
|
|
914
|
+
}>;
|
|
915
|
+
}, z.core.$strip>>;
|
|
732
916
|
}, z.core.$strip>>;
|
|
733
917
|
themes: z.ZodArray<z.ZodObject<{
|
|
734
918
|
name: z.ZodString;
|
|
@@ -761,6 +945,7 @@ export declare const ChatPartSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
761
945
|
refining: "refining";
|
|
762
946
|
}>;
|
|
763
947
|
activity: z.ZodString;
|
|
948
|
+
at: z.ZodOptional<z.ZodString>;
|
|
764
949
|
delegationCount: z.ZodOptional<z.ZodNumber>;
|
|
765
950
|
reason: z.ZodOptional<z.ZodString>;
|
|
766
951
|
error: z.ZodOptional<z.ZodString>;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* Zod schemas for chat data parts — validation at boundaries.
|
|
3
3
|
*/
|
|
4
4
|
import { z } from "zod";
|
|
5
|
+
import { ToolCallOutcomeSchema } from "./chat-events.js";
|
|
5
6
|
import { TokenUsageRollupSchema } from "./usage.js";
|
|
6
7
|
// ── Presentation ────────────────────────────────────────────────────
|
|
7
8
|
export const PlanStepSchema = z.object({
|
|
@@ -65,6 +66,10 @@ export const PlanPartSchema = z.object({
|
|
|
65
66
|
type: z.literal("data-plan"),
|
|
66
67
|
id: z.string(),
|
|
67
68
|
planId: z.string().regex(/^pln-[a-f0-9]{8}$/),
|
|
69
|
+
parentPlanId: z
|
|
70
|
+
.string()
|
|
71
|
+
.regex(/^pln-[a-f0-9]{8}$/)
|
|
72
|
+
.optional(),
|
|
68
73
|
title: z.string().optional(),
|
|
69
74
|
steps: z.array(PlanStepSchema).optional(),
|
|
70
75
|
analytical_narrative: z.string().optional(),
|
|
@@ -80,6 +85,13 @@ export const RunCardPartSchema = z.object({
|
|
|
80
85
|
title: z.string(),
|
|
81
86
|
stepCount: z.number(),
|
|
82
87
|
});
|
|
88
|
+
// ── Plan approval ───────────────────────────────────────────────────
|
|
89
|
+
export const PlanApprovalPartSchema = z.object({
|
|
90
|
+
type: z.literal("data-plan-approval"),
|
|
91
|
+
planId: z.string().regex(/^pln-[a-f0-9]{8}$/),
|
|
92
|
+
runId: z.string(),
|
|
93
|
+
approvedAt: z.iso.datetime(),
|
|
94
|
+
});
|
|
83
95
|
// ── File reference ──────────────────────────────────────────────────
|
|
84
96
|
export const FileReferenceEntrySchema = z.object({
|
|
85
97
|
path: z.string().min(1),
|
|
@@ -101,6 +113,7 @@ export const AskPartSchema = z.object({
|
|
|
101
113
|
command: z.string(),
|
|
102
114
|
detail: z.string().optional(),
|
|
103
115
|
status: AskStatusSchema,
|
|
116
|
+
reply: z.enum(["once", "always", "reject"]).optional(),
|
|
104
117
|
});
|
|
105
118
|
// ── Run Started ─────────────────────────────────────────────────────
|
|
106
119
|
export const RunStartedPartSchema = z.object({
|
|
@@ -134,6 +147,18 @@ export const DagStatePartSchema = z
|
|
|
134
147
|
})
|
|
135
148
|
.strict();
|
|
136
149
|
// ── Step Activity ───────────────────────────────────────────────────
|
|
150
|
+
export const SynthesisPhaseSchema = z.enum([
|
|
151
|
+
"starting",
|
|
152
|
+
"researching",
|
|
153
|
+
"drafting",
|
|
154
|
+
"validating",
|
|
155
|
+
"refining",
|
|
156
|
+
"indexing",
|
|
157
|
+
"persisting",
|
|
158
|
+
"complete",
|
|
159
|
+
"skipped",
|
|
160
|
+
"failed",
|
|
161
|
+
]);
|
|
137
162
|
export const StepPhaseSchema = z.enum([
|
|
138
163
|
"sandbox-init",
|
|
139
164
|
"executing",
|
|
@@ -153,6 +178,16 @@ export const StepActivityPartSchema = z.object({
|
|
|
153
178
|
stepId: z.string(),
|
|
154
179
|
phase: StepPhaseSchema,
|
|
155
180
|
activity: z.string(),
|
|
181
|
+
at: z.string().optional(),
|
|
182
|
+
});
|
|
183
|
+
export const ActivityEntryPartSchema = z.object({
|
|
184
|
+
type: z.literal("data-activity-entry"),
|
|
185
|
+
id: z.string(),
|
|
186
|
+
runId: z.string(),
|
|
187
|
+
stepId: z.string(),
|
|
188
|
+
phase: z.union([StepPhaseSchema, SynthesisPhaseSchema]),
|
|
189
|
+
activity: z.string(),
|
|
190
|
+
at: z.string(),
|
|
156
191
|
});
|
|
157
192
|
// ── Step File Tree ──────────────────────────────────────────────────
|
|
158
193
|
export const FileTreeEntrySchema = z.object({
|
|
@@ -230,6 +265,12 @@ export const RunCompletedPartSchema = z.object({
|
|
|
230
265
|
usage: TokenUsageRollupSchema.optional(),
|
|
231
266
|
});
|
|
232
267
|
// ── Run Synthesis ──────────────────────────────────────────────────
|
|
268
|
+
export const FindingReferenceSchema = z.object({
|
|
269
|
+
pmid: z.string(),
|
|
270
|
+
citation: z.string(),
|
|
271
|
+
relevance: z.string(),
|
|
272
|
+
concordance: z.enum(["supports", "contradicts", "extends", "contextualizes"]),
|
|
273
|
+
});
|
|
233
274
|
export const SynthesizedFindingSchema = z.object({
|
|
234
275
|
stepId: z.string(),
|
|
235
276
|
title: z.string(),
|
|
@@ -237,6 +278,7 @@ export const SynthesizedFindingSchema = z.object({
|
|
|
237
278
|
confidence: z.enum(["high", "medium", "low"]),
|
|
238
279
|
noveltyStatus: z.enum(["novel", "confirmed", "partially_confirmed", "contradicted", "expected"]),
|
|
239
280
|
literatureInterpretation: z.string(),
|
|
281
|
+
references: z.array(FindingReferenceSchema),
|
|
240
282
|
});
|
|
241
283
|
export const BiologicalThemeSchema = z.object({
|
|
242
284
|
name: z.string(),
|
|
@@ -259,24 +301,13 @@ export const RunSynthesisPartSchema = z.object({
|
|
|
259
301
|
})),
|
|
260
302
|
});
|
|
261
303
|
// ── Synthesis Progress ─────────────────────────────────────────────
|
|
262
|
-
export const SynthesisPhaseSchema = z.enum([
|
|
263
|
-
"starting",
|
|
264
|
-
"researching",
|
|
265
|
-
"drafting",
|
|
266
|
-
"validating",
|
|
267
|
-
"refining",
|
|
268
|
-
"indexing",
|
|
269
|
-
"persisting",
|
|
270
|
-
"complete",
|
|
271
|
-
"skipped",
|
|
272
|
-
"failed",
|
|
273
|
-
]);
|
|
274
304
|
export const SynthesisProgressPartSchema = z.object({
|
|
275
305
|
type: z.literal("data-synthesis-progress"),
|
|
276
306
|
id: z.string(),
|
|
277
307
|
runId: z.string(),
|
|
278
308
|
phase: SynthesisPhaseSchema,
|
|
279
309
|
activity: z.string(),
|
|
310
|
+
at: z.string().optional(),
|
|
280
311
|
delegationCount: z.number().int().nonnegative().optional(),
|
|
281
312
|
reason: z.string().optional(),
|
|
282
313
|
error: z.string().optional(),
|
|
@@ -314,16 +345,36 @@ export const CompactionPartSchema = z.object({
|
|
|
314
345
|
durationMs: z.number().int().nonnegative().optional(),
|
|
315
346
|
trigger: z.enum(["turn-start", "mid-turn"]).optional(),
|
|
316
347
|
});
|
|
348
|
+
// ── Sub-agent activity ──────────────────────────────────────────────
|
|
349
|
+
export const SubAgentActivityEntrySchema = z.object({
|
|
350
|
+
agentId: z.string(),
|
|
351
|
+
callPath: z.array(z.string()),
|
|
352
|
+
tool: z.string(),
|
|
353
|
+
label: z.string().optional(),
|
|
354
|
+
startedAt: z.string(),
|
|
355
|
+
endedAt: z.string().optional(),
|
|
356
|
+
outcome: ToolCallOutcomeSchema.optional(),
|
|
357
|
+
});
|
|
358
|
+
export const SubAgentActivityPartSchema = z.object({
|
|
359
|
+
type: z.literal("data-subagent-activity"),
|
|
360
|
+
id: z.string(),
|
|
361
|
+
toolCallId: z.string(),
|
|
362
|
+
entries: z.array(SubAgentActivityEntrySchema),
|
|
363
|
+
dropped: z.number().int().nonnegative(),
|
|
364
|
+
});
|
|
317
365
|
// ── Union ───────────────────────────────────────────────────────────
|
|
318
366
|
export const ChatPartSchema = z.discriminatedUnion("type", [
|
|
319
367
|
PresentationPartSchema,
|
|
320
368
|
PlanPartSchema,
|
|
321
369
|
RunCardPartSchema,
|
|
370
|
+
PlanApprovalPartSchema,
|
|
322
371
|
FileReferencePartSchema,
|
|
323
372
|
AskPartSchema,
|
|
324
373
|
RunStartedPartSchema,
|
|
325
374
|
DagStatePartSchema,
|
|
326
375
|
StepActivityPartSchema,
|
|
376
|
+
ActivityEntryPartSchema,
|
|
377
|
+
SubAgentActivityPartSchema,
|
|
327
378
|
StepFileTreePartSchema,
|
|
328
379
|
StepOutputPartSchema,
|
|
329
380
|
StepSummaryPartSchema,
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { PlanStepSchema, PresentationContentSchema, PresentationPartSchema, PlanPartSchema, RunCardPartSchema, FileReferenceEntrySchema, FileReferencePartSchema, RunStartedPartSchema, StepStatusSchema, DagStepStateSchema, DagStatePartSchema, StepPhaseSchema, StepActivityPartSchema, FileTreeEntrySchema, StepFileTreePartSchema, StepOutputFileSchema, StepOutputPartSchema, StepSummaryPartSchema, StepUsagePartSchema, StepBlockedPartSchema, SynthesizedFindingSchema, BiologicalThemeSchema, RunSynthesisPartSchema, SynthesisPhaseSchema, SynthesisProgressPartSchema, RunCompletedFindingSchema, RunCompletedPartSchema, RunFailedPartSchema, ChatPartSchema, } from "./chat-parts.js";
|
|
1
|
+
export { PlanStepSchema, PresentationContentSchema, PresentationPartSchema, PlanPartSchema, RunCardPartSchema, PlanApprovalPartSchema, FileReferenceEntrySchema, FileReferencePartSchema, RunStartedPartSchema, StepStatusSchema, DagStepStateSchema, DagStatePartSchema, StepPhaseSchema, StepActivityPartSchema, ActivityEntryPartSchema, SubAgentActivityEntrySchema, SubAgentActivityPartSchema, FileTreeEntrySchema, StepFileTreePartSchema, StepOutputFileSchema, StepOutputPartSchema, StepSummaryPartSchema, StepUsagePartSchema, StepBlockedPartSchema, FindingReferenceSchema, SynthesizedFindingSchema, BiologicalThemeSchema, RunSynthesisPartSchema, SynthesisPhaseSchema, SynthesisProgressPartSchema, RunCompletedFindingSchema, RunCompletedPartSchema, RunFailedPartSchema, ChatPartSchema, } from "./chat-parts.js";
|
|
2
2
|
export { EventSourceSchema, TextDeltaEventSchema, IterationEventSchema, ToolStartedEventSchema, ToolFinishedEventSchema, FinishEventSchema, ChatErrorEventSchema, ChatEventSchema, } from "./chat-events.js";
|
|
3
3
|
export { TokenUsageRollupSchema } from "./usage.js";
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { PlanStepSchema, PresentationContentSchema, PresentationPartSchema, PlanPartSchema, RunCardPartSchema, FileReferenceEntrySchema, FileReferencePartSchema, RunStartedPartSchema, StepStatusSchema, DagStepStateSchema, DagStatePartSchema, StepPhaseSchema, StepActivityPartSchema, FileTreeEntrySchema, StepFileTreePartSchema, StepOutputFileSchema, StepOutputPartSchema, StepSummaryPartSchema, StepUsagePartSchema, StepBlockedPartSchema, SynthesizedFindingSchema, BiologicalThemeSchema, RunSynthesisPartSchema, SynthesisPhaseSchema, SynthesisProgressPartSchema, RunCompletedFindingSchema, RunCompletedPartSchema, RunFailedPartSchema, ChatPartSchema, } from "./chat-parts.js";
|
|
1
|
+
export { PlanStepSchema, PresentationContentSchema, PresentationPartSchema, PlanPartSchema, RunCardPartSchema, PlanApprovalPartSchema, FileReferenceEntrySchema, FileReferencePartSchema, RunStartedPartSchema, StepStatusSchema, DagStepStateSchema, DagStatePartSchema, StepPhaseSchema, StepActivityPartSchema, ActivityEntryPartSchema, SubAgentActivityEntrySchema, SubAgentActivityPartSchema, FileTreeEntrySchema, StepFileTreePartSchema, StepOutputFileSchema, StepOutputPartSchema, StepSummaryPartSchema, StepUsagePartSchema, StepBlockedPartSchema, FindingReferenceSchema, SynthesizedFindingSchema, BiologicalThemeSchema, RunSynthesisPartSchema, SynthesisPhaseSchema, SynthesisProgressPartSchema, RunCompletedFindingSchema, RunCompletedPartSchema, RunFailedPartSchema, ChatPartSchema, } from "./chat-parts.js";
|
|
2
2
|
export { EventSourceSchema, TextDeltaEventSchema, IterationEventSchema, ToolStartedEventSchema, ToolFinishedEventSchema, FinishEventSchema, ChatErrorEventSchema, ChatEventSchema, } from "./chat-events.js";
|
|
3
3
|
export { TokenUsageRollupSchema } from "./usage.js";
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ChatFrame, ChatPartFrame } from "./chat-events.js";
|
|
2
|
+
/** The most entries that one root tool call holds. Each later call of its sub-agents only adds to `dropped`. */
|
|
3
|
+
export declare const SUBAGENT_ACTIVITY_MAX_ENTRIES = 200;
|
|
4
|
+
export interface SubAgentActivityTracker {
|
|
5
|
+
/**
|
|
6
|
+
* Read one frame of the turn, from the root agent or from a sub-agent, with the time of its receipt in
|
|
7
|
+
* milliseconds. Gives the new `data-subagent-activity` part frame (no source) when the frame changes the activity
|
|
8
|
+
* of a root tool call, else `null`.
|
|
9
|
+
*/
|
|
10
|
+
track(frame: ChatFrame, nowMs: number): ChatPartFrame | null;
|
|
11
|
+
}
|
|
12
|
+
export declare function createSubAgentActivityTracker(): SubAgentActivityTracker;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
// The sub-agent activity of a chat turn, beside `applyChatFrame`. Browser-safe: each import from outside `contracts/` is a type import.
|
|
2
|
+
/** The most entries that one root tool call holds. Each later call of its sub-agents only adds to `dropped`. */
|
|
3
|
+
export const SUBAGENT_ACTIVITY_MAX_ENTRIES = 200;
|
|
4
|
+
// A call id is unique only inside the loop that made the call, thus the call path of that loop is part of the key.
|
|
5
|
+
// The path is the lineage of the sub-agent, the same read as `isRootFrame`. No control flow of the harness uses it.
|
|
6
|
+
function callKey(loopPath, callId) {
|
|
7
|
+
return JSON.stringify([loopPath, callId]);
|
|
8
|
+
}
|
|
9
|
+
export function createSubAgentActivityTracker() {
|
|
10
|
+
// A dropped call stays in the map, thus a deeper call below it still counts in `dropped`.
|
|
11
|
+
const calls = new Map();
|
|
12
|
+
const records = new Map();
|
|
13
|
+
const partOf = (rootId, record) => ({
|
|
14
|
+
type: "data-subagent-activity",
|
|
15
|
+
id: `subagent-activity-${rootId}`,
|
|
16
|
+
toolCallId: rootId,
|
|
17
|
+
entries: record.entries.map((entry) => ({ ...entry, callPath: [...entry.callPath] })),
|
|
18
|
+
dropped: record.dropped,
|
|
19
|
+
});
|
|
20
|
+
return {
|
|
21
|
+
track(frame, nowMs) {
|
|
22
|
+
if (frame.type !== "tool-started" && frame.type !== "tool-finished")
|
|
23
|
+
return null;
|
|
24
|
+
const { source } = frame;
|
|
25
|
+
if (frame.type === "tool-started") {
|
|
26
|
+
if (source.callPath.length <= 1) {
|
|
27
|
+
calls.set(callKey(source.callPath, frame.toolUseId), { rootId: frame.toolUseId, startedMs: nowMs });
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
30
|
+
if (source.invocationId === undefined)
|
|
31
|
+
return null;
|
|
32
|
+
const parent = calls.get(callKey(source.callPath.slice(0, -1), source.invocationId));
|
|
33
|
+
if (parent === undefined)
|
|
34
|
+
return null;
|
|
35
|
+
let record = records.get(parent.rootId);
|
|
36
|
+
if (record === undefined) {
|
|
37
|
+
record = { entries: [], dropped: 0 };
|
|
38
|
+
records.set(parent.rootId, record);
|
|
39
|
+
}
|
|
40
|
+
if (record.entries.length >= SUBAGENT_ACTIVITY_MAX_ENTRIES) {
|
|
41
|
+
record.dropped += 1;
|
|
42
|
+
calls.set(callKey(source.callPath, frame.toolUseId), { rootId: parent.rootId, startedMs: nowMs });
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
record.entries.push({
|
|
46
|
+
agentId: source.agentId,
|
|
47
|
+
callPath: [...source.callPath],
|
|
48
|
+
tool: frame.name,
|
|
49
|
+
...(frame.detail === undefined ? {} : { label: frame.detail }),
|
|
50
|
+
startedAt: new Date(nowMs).toISOString(),
|
|
51
|
+
});
|
|
52
|
+
calls.set(callKey(source.callPath, frame.toolUseId), {
|
|
53
|
+
rootId: parent.rootId,
|
|
54
|
+
entryIndex: record.entries.length - 1,
|
|
55
|
+
startedMs: nowMs,
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
return partOf(parent.rootId, record);
|
|
59
|
+
}
|
|
60
|
+
if (source.callPath.length <= 1)
|
|
61
|
+
return null;
|
|
62
|
+
const call = calls.get(callKey(source.callPath, frame.toolUseId));
|
|
63
|
+
if (call?.entryIndex === undefined)
|
|
64
|
+
return null;
|
|
65
|
+
const record = records.get(call.rootId);
|
|
66
|
+
const entry = record?.entries[call.entryIndex];
|
|
67
|
+
if (record === undefined || entry === undefined)
|
|
68
|
+
return null;
|
|
69
|
+
entry.outcome = frame.outcome;
|
|
70
|
+
if (frame.detail !== undefined)
|
|
71
|
+
entry.label = frame.detail;
|
|
72
|
+
entry.endedAt = new Date(frame.durationMs === undefined ? nowMs : call.startedMs + frame.durationMs).toISOString();
|
|
73
|
+
return partOf(call.rootId, record);
|
|
74
|
+
},
|
|
75
|
+
};
|
|
76
|
+
}
|
|
@@ -78,9 +78,7 @@ function fileExtension(displayPath) {
|
|
|
78
78
|
* composed from facts already on disk so search still finds the file.
|
|
79
79
|
*/
|
|
80
80
|
function fallbackEntry(artifact, extra) {
|
|
81
|
-
|
|
82
|
-
// on a working-directory-relative display path.
|
|
83
|
-
const fileType = inferArtifactType(`/${artifact.displayPath}`);
|
|
81
|
+
const fileType = inferArtifactType(artifact.displayPath);
|
|
84
82
|
const format = fileExtension(artifact.displayPath);
|
|
85
83
|
const sizePart = artifact.sizeBytes != null ? `, ${artifact.sizeBytes} bytes` : "";
|
|
86
84
|
const description = `${artifact.displayPath} — ${fileType} file (${format}${sizePart}); automated description unavailable.`;
|
|
@@ -116,7 +116,7 @@ export function describeStepRegistrationFailure(failure) {
|
|
|
116
116
|
export async function reconcileAndRegisterStepArtifacts(deps, postCtx, manifest) {
|
|
117
117
|
const { input, session, lineageCollector } = postCtx;
|
|
118
118
|
const reconciled = await reconcileManifestWithDisk({
|
|
119
|
-
workspaceRoot: deps.resolveWorkspaceRoot(input.analysisId),
|
|
119
|
+
workspaceRoot: await deps.resolveWorkspaceRoot(input.analysisId),
|
|
120
120
|
resourceId: input.analysisId,
|
|
121
121
|
runId: input.runId,
|
|
122
122
|
stepId: input.stepId,
|
|
@@ -36,7 +36,7 @@ export class UnknownRunError extends Error {
|
|
|
36
36
|
this.name = "UnknownRunError";
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
|
-
const TERMINAL = new Set(["completed", "partial", "failed", "canceled"]);
|
|
39
|
+
const TERMINAL = new Set(["completed", "partial", "failed", "canceled", "suspended_insufficient_funds"]);
|
|
40
40
|
export function createRunCanceler(deps) {
|
|
41
41
|
const { pool, runCharge, runAuthorizer } = deps;
|
|
42
42
|
const logger = (deps.logger ?? createNoopLogger()).named("run-canceler");
|
|
@@ -19,11 +19,12 @@ import type { ChatPart } from "../contracts/chat-parts.js";
|
|
|
19
19
|
* newer than the reader.
|
|
20
20
|
*
|
|
21
21
|
* The registry is keyed by the discriminant alone, so this validates `type` and
|
|
22
|
-
* trusts the producer for the payload.
|
|
23
|
-
*
|
|
24
|
-
* ends of this stream are typed against
|
|
25
|
-
* the discriminant is the boundary that can
|
|
26
|
-
* something else entirely) and
|
|
22
|
+
* trusts the producer for the payload. The part schemas in `contracts/schemas/`
|
|
23
|
+
* are for a consumer at the edge of the package, which parses what it receives.
|
|
24
|
+
* Both ends of this stream are typed against the same union inside this package,
|
|
25
|
+
* so the discriminant is the boundary that can drift (a producer that emits
|
|
26
|
+
* something else entirely), and a part that fails its schema still reaches the
|
|
27
|
+
* consumer for its own check.
|
|
27
28
|
*/
|
|
28
29
|
export declare function parseRunEventPart(value: unknown): ChatPart | null;
|
|
29
30
|
/**
|