stitchkit 0.56.4 → 0.57.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/agent-runtime/events.d.ts +730 -0
- package/dist/agent-runtime/events.d.ts.map +1 -1
- package/dist/agent-runtime/runtime.d.ts +34 -3
- package/dist/agent-runtime/runtime.d.ts.map +1 -1
- package/dist/agent-runtime/schemas.d.ts +73 -0
- package/dist/agent-runtime/schemas.d.ts.map +1 -1
- package/dist/agent-runtime/store-driver.d.ts +406 -0
- package/dist/agent-runtime/store-driver.d.ts.map +1 -0
- package/dist/agent-runtime/store.d.ts +162 -2
- package/dist/agent-runtime/store.d.ts.map +1 -1
- package/dist/agent-runtime.d.ts +4 -3
- package/dist/agent-runtime.d.ts.map +1 -1
- package/dist/agent-runtime.js +851 -445
- package/dist/index-1f4fcj0b.js +160 -0
- package/dist/server/error-hook.d.ts +8 -1
- package/dist/server/error-hook.d.ts.map +1 -1
- package/dist/server/index.js +4 -2
- package/dist/testing/agent-store-conformance.d.ts +7 -0
- package/dist/testing/agent-store-conformance.d.ts.map +1 -0
- package/dist/testing.d.ts +1 -0
- package/dist/testing.d.ts.map +1 -1
- package/dist/testing.js +166 -0
- package/llms-full.txt +102 -23
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../src/agent-runtime/events.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../src/agent-runtime/events.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAcxB,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2BAUlC,CAAC;AAEH,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AACxE,MAAM,MAAM,qBAAqB,GAAG,CAAC,KAAK,EAAE,iBAAiB,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC"}
|
|
@@ -8,8 +8,9 @@ import { type AgentHistoryProjectionOptions } from './history';
|
|
|
8
8
|
import type { AgentResolvedModel } from './models';
|
|
9
9
|
import type { AgentObservability } from './observability';
|
|
10
10
|
import type { ComposedAgentPrompt } from './prompt';
|
|
11
|
-
import { AgentJsonObjectSchema, type AgentMessage, type AgentMessagePart, type AgentRun, type AgentSnapshot, type AgentTerminalReason } from './schemas';
|
|
11
|
+
import { type AgentAssistantPlaceholder, AgentJsonObjectSchema, type AgentMessage, type AgentMessagePart, type AgentRun, type AgentRunMetrics, type AgentSnapshot, type AgentTerminalReason } from './schemas';
|
|
12
12
|
import type { AgentRuntimeStore, AgentStoreMutationResult } from './store';
|
|
13
|
+
import type { AgentRecoverableDescriptor } from './store-driver';
|
|
13
14
|
export interface AgentRuntimeProtocolInput<CONTEXT> {
|
|
14
15
|
parseContext(input: unknown): CONTEXT;
|
|
15
16
|
parseInputMetadata(input: unknown): z.infer<typeof AgentJsonObjectSchema>;
|
|
@@ -29,8 +30,12 @@ export interface AgentRuntimeRecordIds {
|
|
|
29
30
|
assistantMessageId: string;
|
|
30
31
|
}
|
|
31
32
|
export interface AgentRuntimeAdmission {
|
|
33
|
+
inputMessageId: string;
|
|
32
34
|
runId: string;
|
|
33
35
|
assistantMessageId: string;
|
|
36
|
+
input: AgentMessage;
|
|
37
|
+
run: AgentRun;
|
|
38
|
+
assistant: AgentAssistantPlaceholder | AgentMessage;
|
|
34
39
|
snapshotVersion: number;
|
|
35
40
|
}
|
|
36
41
|
export interface AgentRuntimeRecoveryInput {
|
|
@@ -39,6 +44,30 @@ export interface AgentRuntimeRecoveryInput {
|
|
|
39
44
|
context: unknown;
|
|
40
45
|
conversationKey?: string;
|
|
41
46
|
}
|
|
47
|
+
export type AgentRuntimeRecoveryDecision = {
|
|
48
|
+
action: 'resume';
|
|
49
|
+
} | {
|
|
50
|
+
action: 'skip';
|
|
51
|
+
} | {
|
|
52
|
+
action: 'requeue';
|
|
53
|
+
replaySafe: true;
|
|
54
|
+
} | {
|
|
55
|
+
action: 'abandon';
|
|
56
|
+
staleOwner: true;
|
|
57
|
+
};
|
|
58
|
+
export interface AgentRuntimeRecoverOptions<CONTEXT> {
|
|
59
|
+
resolveContext(input: AgentRecoverableDescriptor): CONTEXT | Promise<CONTEXT>;
|
|
60
|
+
decide?(input: AgentRecoverableDescriptor): AgentRuntimeRecoveryDecision | Promise<AgentRuntimeRecoveryDecision>;
|
|
61
|
+
pageSize?: number;
|
|
62
|
+
maxRuns?: number;
|
|
63
|
+
signal?: AbortSignal;
|
|
64
|
+
}
|
|
65
|
+
export interface AgentRuntimeRecoveryOutcome {
|
|
66
|
+
conversationId: string;
|
|
67
|
+
runId: string;
|
|
68
|
+
outcome: 'resumed' | 'requeued' | 'abandoned' | 'skipped' | 'failed';
|
|
69
|
+
error?: unknown;
|
|
70
|
+
}
|
|
42
71
|
export interface AgentRuntimeInterruptInput {
|
|
43
72
|
conversationId: string;
|
|
44
73
|
runId: string;
|
|
@@ -111,8 +140,9 @@ export interface AgentRuntimeResult {
|
|
|
111
140
|
reason: AgentTerminalReason;
|
|
112
141
|
snapshotVersion: number;
|
|
113
142
|
policyName?: string;
|
|
143
|
+
metrics?: AgentRunMetrics;
|
|
114
144
|
}
|
|
115
|
-
export interface AgentRuntime {
|
|
145
|
+
export interface AgentRuntime<CONTEXT = unknown> {
|
|
116
146
|
submit(input: AgentRuntimeInput): {
|
|
117
147
|
accepted: Promise<void>;
|
|
118
148
|
admission: Promise<AgentRuntimeAdmission>;
|
|
@@ -123,8 +153,9 @@ export interface AgentRuntime {
|
|
|
123
153
|
result: Promise<AgentRuntimeResult>;
|
|
124
154
|
};
|
|
125
155
|
interrupt(input: AgentRuntimeInterruptInput): Promise<AgentStoreMutationResult>;
|
|
156
|
+
recover(options: AgentRuntimeRecoverOptions<CONTEXT>): Promise<readonly AgentRuntimeRecoveryOutcome[]>;
|
|
126
157
|
stop(conversationKey: string, reason?: AgentStopReason): boolean;
|
|
127
158
|
close(options?: AgentSessionCloseOptions): Promise<void>;
|
|
128
159
|
}
|
|
129
|
-
export declare function createAgentRuntime<CONTEXT, TOOLS extends ToolSet>(config: AgentRuntimeConfig<CONTEXT, TOOLS>): AgentRuntime
|
|
160
|
+
export declare function createAgentRuntime<CONTEXT, TOOLS extends ToolSet>(config: AgentRuntimeConfig<CONTEXT, TOOLS>): AgentRuntime<CONTEXT>;
|
|
130
161
|
//# sourceMappingURL=runtime.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../src/agent-runtime/runtime.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,aAAa,EAElB,KAAK,YAAY,EACjB,KAAK,mBAAmB,EACxB,KAAK,aAAa,EAGlB,KAAK,OAAO,EACb,MAAM,IAAI,CAAC;AACZ,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAA+B,KAAK,aAAa,EAAE,MAAM,kBAAkB,CAA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
updatedAt: z.ZodISODateTime;
|
|
219
219
|
}, z.core.$strip>;
|
|
220
220
|
export type AgentMessage = z.infer<typeof AgentMessageSchema>;
|
|
221
|
+
export declare const AgentAssistantPlaceholderSchema: z.ZodObject<{
|
|
222
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
223
|
+
id: z.ZodString;
|
|
224
|
+
conversationId: z.ZodString;
|
|
225
|
+
runId: z.ZodString;
|
|
226
|
+
status: z.ZodLiteral<"pending">;
|
|
227
|
+
createdAt: z.ZodISODateTime;
|
|
228
|
+
updatedAt: z.ZodISODateTime;
|
|
229
|
+
}, z.core.$strip>;
|
|
230
|
+
export type AgentAssistantPlaceholder = z.infer<typeof AgentAssistantPlaceholderSchema>;
|
|
221
231
|
export declare const AgentRunStateSchema: z.ZodEnum<{
|
|
222
232
|
abandoned: "abandoned";
|
|
223
233
|
cancelled: "cancelled";
|
|
@@ -467,4 +477,67 @@ export declare const AgentUsageSchema: z.ZodObject<{
|
|
|
467
477
|
}, z.core.$strip>>;
|
|
468
478
|
}, z.core.$strip>;
|
|
469
479
|
export type AgentUsage = z.infer<typeof AgentUsageSchema>;
|
|
480
|
+
export declare const AgentRunMetricsSchema: z.ZodObject<{
|
|
481
|
+
partial: z.ZodBoolean;
|
|
482
|
+
usage: z.ZodOptional<z.ZodObject<{
|
|
483
|
+
inputTokens: z.ZodObject<{
|
|
484
|
+
value: z.ZodOptional<z.ZodNumber>;
|
|
485
|
+
provenance: z.ZodEnum<{
|
|
486
|
+
computed: "computed";
|
|
487
|
+
estimated: "estimated";
|
|
488
|
+
"provider-reported": "provider-reported";
|
|
489
|
+
unavailable: "unavailable";
|
|
490
|
+
}>;
|
|
491
|
+
}, z.core.$strip>;
|
|
492
|
+
outputTokens: z.ZodObject<{
|
|
493
|
+
value: z.ZodOptional<z.ZodNumber>;
|
|
494
|
+
provenance: z.ZodEnum<{
|
|
495
|
+
computed: "computed";
|
|
496
|
+
estimated: "estimated";
|
|
497
|
+
"provider-reported": "provider-reported";
|
|
498
|
+
unavailable: "unavailable";
|
|
499
|
+
}>;
|
|
500
|
+
}, z.core.$strip>;
|
|
501
|
+
reasoningTokens: z.ZodOptional<z.ZodObject<{
|
|
502
|
+
value: z.ZodOptional<z.ZodNumber>;
|
|
503
|
+
provenance: z.ZodEnum<{
|
|
504
|
+
computed: "computed";
|
|
505
|
+
estimated: "estimated";
|
|
506
|
+
"provider-reported": "provider-reported";
|
|
507
|
+
unavailable: "unavailable";
|
|
508
|
+
}>;
|
|
509
|
+
}, z.core.$strip>>;
|
|
510
|
+
cacheReadTokens: z.ZodOptional<z.ZodObject<{
|
|
511
|
+
value: z.ZodOptional<z.ZodNumber>;
|
|
512
|
+
provenance: z.ZodEnum<{
|
|
513
|
+
computed: "computed";
|
|
514
|
+
estimated: "estimated";
|
|
515
|
+
"provider-reported": "provider-reported";
|
|
516
|
+
unavailable: "unavailable";
|
|
517
|
+
}>;
|
|
518
|
+
}, z.core.$strip>>;
|
|
519
|
+
cacheWriteTokens: z.ZodOptional<z.ZodObject<{
|
|
520
|
+
value: z.ZodOptional<z.ZodNumber>;
|
|
521
|
+
provenance: z.ZodEnum<{
|
|
522
|
+
computed: "computed";
|
|
523
|
+
estimated: "estimated";
|
|
524
|
+
"provider-reported": "provider-reported";
|
|
525
|
+
unavailable: "unavailable";
|
|
526
|
+
}>;
|
|
527
|
+
}, z.core.$strip>>;
|
|
528
|
+
cost: z.ZodOptional<z.ZodObject<{
|
|
529
|
+
value: z.ZodOptional<z.ZodNumber>;
|
|
530
|
+
currency: z.ZodOptional<z.ZodString>;
|
|
531
|
+
provenance: z.ZodEnum<{
|
|
532
|
+
computed: "computed";
|
|
533
|
+
estimated: "estimated";
|
|
534
|
+
"provider-reported": "provider-reported";
|
|
535
|
+
unavailable: "unavailable";
|
|
536
|
+
}>;
|
|
537
|
+
}, z.core.$strip>>;
|
|
538
|
+
}, z.core.$strip>>;
|
|
539
|
+
durationMs: z.ZodOptional<z.ZodNumber>;
|
|
540
|
+
ttftMs: z.ZodOptional<z.ZodNumber>;
|
|
541
|
+
}, z.core.$strip>;
|
|
542
|
+
export type AgentRunMetrics = z.infer<typeof AgentRunMetricsSchema>;
|
|
470
543
|
//# sourceMappingURL=schemas.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../src/agent-runtime/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,mBAAmB,aAAoB,CAAC;AACrD,eAAO,MAAM,wBAAwB,UAAwB,CAAC;AAC9D,eAAO,MAAM,oBAAoB,kBAAmC,CAAC;AACrE,eAAO,MAAM,qBAAqB,2CAAiC,CAAC;AAEpE,eAAO,MAAM,2BAA2B;;;;iBAItC,CAAC;AAEH,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC;AAEhF,eAAO,MAAM,mBAAmB;;;iBAG9B,CAAC;AAEH,eAAO,MAAM,wBAAwB;;;;;;;;iBAInC,CAAC;AAEH,eAAO,MAAM,mBAAmB;;;;;iBAK9B,CAAC;AAEH,eAAO,MAAM,qBAAqB;;;;;iBAKhC,CAAC;AAEH,eAAO,MAAM,uBAAuB;;;;;;;;;;iBAMlC,CAAC;AAEH,eAAO,MAAM,yBAAyB;;;;;;;;;;iBAMpC,CAAC;AAEH,eAAO,MAAM,qBAAqB;;;;;;;iBAGhC,CAAC;AAEH,eAAO,MAAM,sBAAsB;;;;;;iBAGjC,CAAC;AAEH,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2BASjC,CAAC;AAEH,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAEtE,eAAO,MAAM,sBAAsB;;;;;EAAqD,CAAC;AACzF,eAAO,MAAM,wBAA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
|
+
import { type AgentMessage } from './schemas';
|
|
3
|
+
import { type AgentRuntimeStore } from './store';
|
|
4
|
+
export declare const AgentAdmissionIdentitySchema: z.ZodObject<{
|
|
5
|
+
idempotencyKey: z.ZodString;
|
|
6
|
+
inputMessageId: z.ZodString;
|
|
7
|
+
runId: z.ZodString;
|
|
8
|
+
assistantMessageId: z.ZodString;
|
|
9
|
+
}, z.core.$strip>;
|
|
10
|
+
export declare const AgentStoredStateSchema: z.ZodObject<{
|
|
11
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
12
|
+
conversationId: z.ZodString;
|
|
13
|
+
version: z.ZodInt;
|
|
14
|
+
runs: z.ZodArray<z.ZodObject<{
|
|
15
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
16
|
+
id: z.ZodString;
|
|
17
|
+
conversationId: z.ZodString;
|
|
18
|
+
inputMessageIds: z.ZodArray<z.ZodString>;
|
|
19
|
+
assistantMessageId: z.ZodString;
|
|
20
|
+
state: z.ZodEnum<{
|
|
21
|
+
abandoned: "abandoned";
|
|
22
|
+
cancelled: "cancelled";
|
|
23
|
+
completed: "completed";
|
|
24
|
+
failed: "failed";
|
|
25
|
+
interrupt_requested: "interrupt_requested";
|
|
26
|
+
interrupted: "interrupted";
|
|
27
|
+
queued: "queued";
|
|
28
|
+
running: "running";
|
|
29
|
+
}>;
|
|
30
|
+
revision: z.ZodInt;
|
|
31
|
+
ownerId: z.ZodOptional<z.ZodString>;
|
|
32
|
+
terminalReason: z.ZodOptional<z.ZodEnum<{
|
|
33
|
+
abandoned: "abandoned";
|
|
34
|
+
cancelled: "cancelled";
|
|
35
|
+
interrupted: "interrupted";
|
|
36
|
+
policy_stop: "policy_stop";
|
|
37
|
+
provider_failure: "provider_failure";
|
|
38
|
+
shutdown: "shutdown";
|
|
39
|
+
success: "success";
|
|
40
|
+
timeout: "timeout";
|
|
41
|
+
tool_failure: "tool_failure";
|
|
42
|
+
}>>;
|
|
43
|
+
terminalPolicyName: z.ZodOptional<z.ZodString>;
|
|
44
|
+
createdAt: z.ZodISODateTime;
|
|
45
|
+
updatedAt: z.ZodISODateTime;
|
|
46
|
+
}, z.core.$strip>>;
|
|
47
|
+
admissions: z.ZodArray<z.ZodObject<{
|
|
48
|
+
idempotencyKey: z.ZodString;
|
|
49
|
+
inputMessageId: z.ZodString;
|
|
50
|
+
runId: z.ZodString;
|
|
51
|
+
assistantMessageId: z.ZodString;
|
|
52
|
+
}, z.core.$strip>>;
|
|
53
|
+
}, z.core.$strip>;
|
|
54
|
+
export type AgentAdmissionIdentity = z.infer<typeof AgentAdmissionIdentitySchema>;
|
|
55
|
+
export type AgentStoredState = z.infer<typeof AgentStoredStateSchema>;
|
|
56
|
+
export declare const AgentHistoryMutationSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
57
|
+
type: z.ZodLiteral<"admit">;
|
|
58
|
+
input: z.ZodObject<{
|
|
59
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
60
|
+
id: z.ZodString;
|
|
61
|
+
conversationId: z.ZodString;
|
|
62
|
+
runId: z.ZodOptional<z.ZodString>;
|
|
63
|
+
role: z.ZodEnum<{
|
|
64
|
+
assistant: "assistant";
|
|
65
|
+
summary: "summary";
|
|
66
|
+
system: "system";
|
|
67
|
+
user: "user";
|
|
68
|
+
}>;
|
|
69
|
+
status: z.ZodEnum<{
|
|
70
|
+
committed: "committed";
|
|
71
|
+
completed: "completed";
|
|
72
|
+
failed: "failed";
|
|
73
|
+
interrupted: "interrupted";
|
|
74
|
+
streaming: "streaming";
|
|
75
|
+
}>;
|
|
76
|
+
parts: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
77
|
+
type: z.ZodLiteral<"text">;
|
|
78
|
+
text: z.ZodString;
|
|
79
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
80
|
+
type: z.ZodLiteral<"reasoning">;
|
|
81
|
+
text: z.ZodString;
|
|
82
|
+
provider: z.ZodOptional<z.ZodObject<{
|
|
83
|
+
schemaVersion: z.ZodInt;
|
|
84
|
+
provider: z.ZodString;
|
|
85
|
+
data: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
|
|
86
|
+
}, z.core.$strip>>;
|
|
87
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
88
|
+
type: z.ZodLiteral<"file">;
|
|
89
|
+
mediaType: z.ZodString;
|
|
90
|
+
reference: z.ZodString;
|
|
91
|
+
filename: z.ZodOptional<z.ZodString>;
|
|
92
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
93
|
+
type: z.ZodLiteral<"source">;
|
|
94
|
+
sourceId: z.ZodString;
|
|
95
|
+
url: z.ZodOptional<z.ZodURL>;
|
|
96
|
+
title: z.ZodOptional<z.ZodString>;
|
|
97
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
98
|
+
type: z.ZodLiteral<"tool-call">;
|
|
99
|
+
callId: z.ZodString;
|
|
100
|
+
toolName: z.ZodString;
|
|
101
|
+
input: z.ZodJSONSchema;
|
|
102
|
+
provider: z.ZodOptional<z.ZodObject<{
|
|
103
|
+
schemaVersion: z.ZodInt;
|
|
104
|
+
provider: z.ZodString;
|
|
105
|
+
data: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
|
|
106
|
+
}, z.core.$strip>>;
|
|
107
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
108
|
+
type: z.ZodLiteral<"tool-result">;
|
|
109
|
+
callId: z.ZodString;
|
|
110
|
+
toolName: z.ZodString;
|
|
111
|
+
outcome: z.ZodEnum<{
|
|
112
|
+
error: "error";
|
|
113
|
+
interrupted: "interrupted";
|
|
114
|
+
success: "success";
|
|
115
|
+
}>;
|
|
116
|
+
output: z.ZodOptional<z.ZodJSONSchema>;
|
|
117
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
118
|
+
type: z.ZodLiteral<"provider">;
|
|
119
|
+
envelope: z.ZodObject<{
|
|
120
|
+
schemaVersion: z.ZodInt;
|
|
121
|
+
provider: z.ZodString;
|
|
122
|
+
data: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
|
|
123
|
+
}, z.core.$strip>;
|
|
124
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
125
|
+
type: z.ZodLiteral<"control">;
|
|
126
|
+
reason: z.ZodEnum<{
|
|
127
|
+
"run-interrupted": "run-interrupted";
|
|
128
|
+
"stale-run": "stale-run";
|
|
129
|
+
}>;
|
|
130
|
+
}, z.core.$strip>], "type">>;
|
|
131
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodJSONSchema>>;
|
|
132
|
+
createdAt: z.ZodISODateTime;
|
|
133
|
+
updatedAt: z.ZodISODateTime;
|
|
134
|
+
}, z.core.$strip>;
|
|
135
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
136
|
+
type: z.ZodLiteral<"upsert-assistant">;
|
|
137
|
+
message: z.ZodObject<{
|
|
138
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
139
|
+
id: z.ZodString;
|
|
140
|
+
conversationId: z.ZodString;
|
|
141
|
+
runId: z.ZodOptional<z.ZodString>;
|
|
142
|
+
role: z.ZodEnum<{
|
|
143
|
+
assistant: "assistant";
|
|
144
|
+
summary: "summary";
|
|
145
|
+
system: "system";
|
|
146
|
+
user: "user";
|
|
147
|
+
}>;
|
|
148
|
+
status: z.ZodEnum<{
|
|
149
|
+
committed: "committed";
|
|
150
|
+
completed: "completed";
|
|
151
|
+
failed: "failed";
|
|
152
|
+
interrupted: "interrupted";
|
|
153
|
+
streaming: "streaming";
|
|
154
|
+
}>;
|
|
155
|
+
parts: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
156
|
+
type: z.ZodLiteral<"text">;
|
|
157
|
+
text: z.ZodString;
|
|
158
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
159
|
+
type: z.ZodLiteral<"reasoning">;
|
|
160
|
+
text: z.ZodString;
|
|
161
|
+
provider: z.ZodOptional<z.ZodObject<{
|
|
162
|
+
schemaVersion: z.ZodInt;
|
|
163
|
+
provider: z.ZodString;
|
|
164
|
+
data: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
|
|
165
|
+
}, z.core.$strip>>;
|
|
166
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
167
|
+
type: z.ZodLiteral<"file">;
|
|
168
|
+
mediaType: z.ZodString;
|
|
169
|
+
reference: z.ZodString;
|
|
170
|
+
filename: z.ZodOptional<z.ZodString>;
|
|
171
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
172
|
+
type: z.ZodLiteral<"source">;
|
|
173
|
+
sourceId: z.ZodString;
|
|
174
|
+
url: z.ZodOptional<z.ZodURL>;
|
|
175
|
+
title: z.ZodOptional<z.ZodString>;
|
|
176
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
177
|
+
type: z.ZodLiteral<"tool-call">;
|
|
178
|
+
callId: z.ZodString;
|
|
179
|
+
toolName: z.ZodString;
|
|
180
|
+
input: z.ZodJSONSchema;
|
|
181
|
+
provider: z.ZodOptional<z.ZodObject<{
|
|
182
|
+
schemaVersion: z.ZodInt;
|
|
183
|
+
provider: z.ZodString;
|
|
184
|
+
data: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
|
|
185
|
+
}, z.core.$strip>>;
|
|
186
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
187
|
+
type: z.ZodLiteral<"tool-result">;
|
|
188
|
+
callId: z.ZodString;
|
|
189
|
+
toolName: z.ZodString;
|
|
190
|
+
outcome: z.ZodEnum<{
|
|
191
|
+
error: "error";
|
|
192
|
+
interrupted: "interrupted";
|
|
193
|
+
success: "success";
|
|
194
|
+
}>;
|
|
195
|
+
output: z.ZodOptional<z.ZodJSONSchema>;
|
|
196
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
197
|
+
type: z.ZodLiteral<"provider">;
|
|
198
|
+
envelope: z.ZodObject<{
|
|
199
|
+
schemaVersion: z.ZodInt;
|
|
200
|
+
provider: z.ZodString;
|
|
201
|
+
data: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
|
|
202
|
+
}, z.core.$strip>;
|
|
203
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
204
|
+
type: z.ZodLiteral<"control">;
|
|
205
|
+
reason: z.ZodEnum<{
|
|
206
|
+
"run-interrupted": "run-interrupted";
|
|
207
|
+
"stale-run": "stale-run";
|
|
208
|
+
}>;
|
|
209
|
+
}, z.core.$strip>], "type">>;
|
|
210
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodJSONSchema>>;
|
|
211
|
+
createdAt: z.ZodISODateTime;
|
|
212
|
+
updatedAt: z.ZodISODateTime;
|
|
213
|
+
}, z.core.$strip>;
|
|
214
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
215
|
+
type: z.ZodLiteral<"replace-compacted-range">;
|
|
216
|
+
replacedMessageIds: z.ZodArray<z.ZodString>;
|
|
217
|
+
summary: z.ZodObject<{
|
|
218
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
219
|
+
id: z.ZodString;
|
|
220
|
+
conversationId: z.ZodString;
|
|
221
|
+
runId: z.ZodOptional<z.ZodString>;
|
|
222
|
+
role: z.ZodEnum<{
|
|
223
|
+
assistant: "assistant";
|
|
224
|
+
summary: "summary";
|
|
225
|
+
system: "system";
|
|
226
|
+
user: "user";
|
|
227
|
+
}>;
|
|
228
|
+
status: z.ZodEnum<{
|
|
229
|
+
committed: "committed";
|
|
230
|
+
completed: "completed";
|
|
231
|
+
failed: "failed";
|
|
232
|
+
interrupted: "interrupted";
|
|
233
|
+
streaming: "streaming";
|
|
234
|
+
}>;
|
|
235
|
+
parts: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
236
|
+
type: z.ZodLiteral<"text">;
|
|
237
|
+
text: z.ZodString;
|
|
238
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
239
|
+
type: z.ZodLiteral<"reasoning">;
|
|
240
|
+
text: z.ZodString;
|
|
241
|
+
provider: z.ZodOptional<z.ZodObject<{
|
|
242
|
+
schemaVersion: z.ZodInt;
|
|
243
|
+
provider: z.ZodString;
|
|
244
|
+
data: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
|
|
245
|
+
}, z.core.$strip>>;
|
|
246
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
247
|
+
type: z.ZodLiteral<"file">;
|
|
248
|
+
mediaType: z.ZodString;
|
|
249
|
+
reference: z.ZodString;
|
|
250
|
+
filename: z.ZodOptional<z.ZodString>;
|
|
251
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
252
|
+
type: z.ZodLiteral<"source">;
|
|
253
|
+
sourceId: z.ZodString;
|
|
254
|
+
url: z.ZodOptional<z.ZodURL>;
|
|
255
|
+
title: z.ZodOptional<z.ZodString>;
|
|
256
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
257
|
+
type: z.ZodLiteral<"tool-call">;
|
|
258
|
+
callId: z.ZodString;
|
|
259
|
+
toolName: z.ZodString;
|
|
260
|
+
input: z.ZodJSONSchema;
|
|
261
|
+
provider: z.ZodOptional<z.ZodObject<{
|
|
262
|
+
schemaVersion: z.ZodInt;
|
|
263
|
+
provider: z.ZodString;
|
|
264
|
+
data: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
|
|
265
|
+
}, z.core.$strip>>;
|
|
266
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
267
|
+
type: z.ZodLiteral<"tool-result">;
|
|
268
|
+
callId: z.ZodString;
|
|
269
|
+
toolName: z.ZodString;
|
|
270
|
+
outcome: z.ZodEnum<{
|
|
271
|
+
error: "error";
|
|
272
|
+
interrupted: "interrupted";
|
|
273
|
+
success: "success";
|
|
274
|
+
}>;
|
|
275
|
+
output: z.ZodOptional<z.ZodJSONSchema>;
|
|
276
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
277
|
+
type: z.ZodLiteral<"provider">;
|
|
278
|
+
envelope: z.ZodObject<{
|
|
279
|
+
schemaVersion: z.ZodInt;
|
|
280
|
+
provider: z.ZodString;
|
|
281
|
+
data: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
|
|
282
|
+
}, z.core.$strip>;
|
|
283
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
284
|
+
type: z.ZodLiteral<"control">;
|
|
285
|
+
reason: z.ZodEnum<{
|
|
286
|
+
"run-interrupted": "run-interrupted";
|
|
287
|
+
"stale-run": "stale-run";
|
|
288
|
+
}>;
|
|
289
|
+
}, z.core.$strip>], "type">>;
|
|
290
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodJSONSchema>>;
|
|
291
|
+
createdAt: z.ZodISODateTime;
|
|
292
|
+
updatedAt: z.ZodISODateTime;
|
|
293
|
+
}, z.core.$strip>;
|
|
294
|
+
}, z.core.$strip>], "type">;
|
|
295
|
+
export type AgentHistoryMutation = z.infer<typeof AgentHistoryMutationSchema>;
|
|
296
|
+
export declare const AgentRecoverableDescriptorSchema: z.ZodObject<{
|
|
297
|
+
conversationId: z.ZodString;
|
|
298
|
+
run: z.ZodObject<{
|
|
299
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
300
|
+
id: z.ZodString;
|
|
301
|
+
conversationId: z.ZodString;
|
|
302
|
+
inputMessageIds: z.ZodArray<z.ZodString>;
|
|
303
|
+
assistantMessageId: z.ZodString;
|
|
304
|
+
state: z.ZodEnum<{
|
|
305
|
+
abandoned: "abandoned";
|
|
306
|
+
cancelled: "cancelled";
|
|
307
|
+
completed: "completed";
|
|
308
|
+
failed: "failed";
|
|
309
|
+
interrupt_requested: "interrupt_requested";
|
|
310
|
+
interrupted: "interrupted";
|
|
311
|
+
queued: "queued";
|
|
312
|
+
running: "running";
|
|
313
|
+
}>;
|
|
314
|
+
revision: z.ZodInt;
|
|
315
|
+
ownerId: z.ZodOptional<z.ZodString>;
|
|
316
|
+
terminalReason: z.ZodOptional<z.ZodEnum<{
|
|
317
|
+
abandoned: "abandoned";
|
|
318
|
+
cancelled: "cancelled";
|
|
319
|
+
interrupted: "interrupted";
|
|
320
|
+
policy_stop: "policy_stop";
|
|
321
|
+
provider_failure: "provider_failure";
|
|
322
|
+
shutdown: "shutdown";
|
|
323
|
+
success: "success";
|
|
324
|
+
timeout: "timeout";
|
|
325
|
+
tool_failure: "tool_failure";
|
|
326
|
+
}>>;
|
|
327
|
+
terminalPolicyName: z.ZodOptional<z.ZodString>;
|
|
328
|
+
createdAt: z.ZodISODateTime;
|
|
329
|
+
updatedAt: z.ZodISODateTime;
|
|
330
|
+
}, z.core.$strip>;
|
|
331
|
+
}, z.core.$strip>;
|
|
332
|
+
export declare const AgentRecoverablePageSchema: z.ZodObject<{
|
|
333
|
+
items: z.ZodArray<z.ZodObject<{
|
|
334
|
+
conversationId: z.ZodString;
|
|
335
|
+
run: z.ZodObject<{
|
|
336
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
337
|
+
id: z.ZodString;
|
|
338
|
+
conversationId: z.ZodString;
|
|
339
|
+
inputMessageIds: z.ZodArray<z.ZodString>;
|
|
340
|
+
assistantMessageId: z.ZodString;
|
|
341
|
+
state: z.ZodEnum<{
|
|
342
|
+
abandoned: "abandoned";
|
|
343
|
+
cancelled: "cancelled";
|
|
344
|
+
completed: "completed";
|
|
345
|
+
failed: "failed";
|
|
346
|
+
interrupt_requested: "interrupt_requested";
|
|
347
|
+
interrupted: "interrupted";
|
|
348
|
+
queued: "queued";
|
|
349
|
+
running: "running";
|
|
350
|
+
}>;
|
|
351
|
+
revision: z.ZodInt;
|
|
352
|
+
ownerId: z.ZodOptional<z.ZodString>;
|
|
353
|
+
terminalReason: z.ZodOptional<z.ZodEnum<{
|
|
354
|
+
abandoned: "abandoned";
|
|
355
|
+
cancelled: "cancelled";
|
|
356
|
+
interrupted: "interrupted";
|
|
357
|
+
policy_stop: "policy_stop";
|
|
358
|
+
provider_failure: "provider_failure";
|
|
359
|
+
shutdown: "shutdown";
|
|
360
|
+
success: "success";
|
|
361
|
+
timeout: "timeout";
|
|
362
|
+
tool_failure: "tool_failure";
|
|
363
|
+
}>>;
|
|
364
|
+
terminalPolicyName: z.ZodOptional<z.ZodString>;
|
|
365
|
+
createdAt: z.ZodISODateTime;
|
|
366
|
+
updatedAt: z.ZodISODateTime;
|
|
367
|
+
}, z.core.$strip>;
|
|
368
|
+
}, z.core.$strip>>;
|
|
369
|
+
nextCursor: z.ZodOptional<z.ZodString>;
|
|
370
|
+
}, z.core.$strip>;
|
|
371
|
+
export type AgentRecoverableDescriptor = z.infer<typeof AgentRecoverableDescriptorSchema>;
|
|
372
|
+
export type AgentRecoverablePage = z.infer<typeof AgentRecoverablePageSchema>;
|
|
373
|
+
export type AgentStoreCompareAndSwapResult = {
|
|
374
|
+
outcome: 'applied';
|
|
375
|
+
} | {
|
|
376
|
+
outcome: 'conflict';
|
|
377
|
+
actualVersion: number;
|
|
378
|
+
};
|
|
379
|
+
export interface AgentRuntimeStoreDriver<TRANSACTION> {
|
|
380
|
+
transaction<RESULT>(work: (transaction: TRANSACTION) => Promise<RESULT>): Promise<RESULT>;
|
|
381
|
+
state: {
|
|
382
|
+
load(transaction: TRANSACTION, conversationId: string): Promise<AgentStoredState | undefined>;
|
|
383
|
+
compareAndSwap(transaction: TRANSACTION, input: {
|
|
384
|
+
conversationId: string;
|
|
385
|
+
expectedVersion: number;
|
|
386
|
+
next: AgentStoredState;
|
|
387
|
+
recoverable: readonly AgentRecoverableDescriptor[];
|
|
388
|
+
}): Promise<AgentStoreCompareAndSwapResult>;
|
|
389
|
+
};
|
|
390
|
+
history: {
|
|
391
|
+
load(transaction: TRANSACTION, conversationId: string): Promise<readonly AgentMessage[]>;
|
|
392
|
+
loadById(transaction: TRANSACTION, input: {
|
|
393
|
+
conversationId: string;
|
|
394
|
+
messageId: string;
|
|
395
|
+
}): Promise<AgentMessage | undefined>;
|
|
396
|
+
apply(transaction: TRANSACTION, mutation: AgentHistoryMutation): Promise<void>;
|
|
397
|
+
};
|
|
398
|
+
scanRecoverable(input: {
|
|
399
|
+
cursor?: string;
|
|
400
|
+
limit: number;
|
|
401
|
+
}): Promise<AgentRecoverablePage>;
|
|
402
|
+
}
|
|
403
|
+
export declare function createAgentRuntimeStore<TRANSACTION>(driver: AgentRuntimeStoreDriver<TRANSACTION>): AgentRuntimeStore;
|
|
404
|
+
/** In-memory reference adapter backed by the same reducer and driver contract as durable stores. */
|
|
405
|
+
export declare function createMemoryAgentRuntimeStore(): AgentRuntimeStore;
|
|
406
|
+
//# sourceMappingURL=store-driver.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"store-driver.d.ts","sourceRoot":"","sources":["../../src/agent-runtime/store-driver.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,KAAK,YAAY,EASlB,MAAM,WAAW,CAAC;AACnB,OAAO,EAKL,KAAK,iBAAiB,EAYvB,MAAM,SAAS,CAAC;AAEjB,eAAO,MAAM,4BAA4B;;;;;iBAKvC,CAAC;AAEH,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAMjC,CAAC;AAEH,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,4BAA4B,CAAC,CAAC;AAClF,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAEtE,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2BAWrC,CAAC;AAEH,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC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