@superdurable/dex-agents 0.0.0-stage → 0.1.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/LICENSE +105 -0
- package/README.md +475 -2
- package/dist/src/agent-event-writer.d.ts +26 -0
- package/dist/src/agent-event-writer.js +110 -0
- package/dist/src/agent-event-writer.js.map +1 -0
- package/dist/src/agent-framework-runner.d.ts +368 -0
- package/dist/src/agent-framework-runner.js +81 -0
- package/dist/src/agent-framework-runner.js.map +1 -0
- package/dist/src/agent-session-codecs.d.ts +44 -0
- package/dist/src/agent-session-codecs.js +355 -0
- package/dist/src/agent-session-codecs.js.map +1 -0
- package/dist/src/agent-session-flow.d.ts +148 -0
- package/dist/src/agent-session-flow.js +276 -0
- package/dist/src/agent-session-flow.js.map +1 -0
- package/dist/src/agent-session-persistence.d.ts +56 -0
- package/dist/src/agent-session-persistence.js +43 -0
- package/dist/src/agent-session-persistence.js.map +1 -0
- package/dist/src/agent-session-steps.d.ts +86 -0
- package/dist/src/agent-session-steps.js +533 -0
- package/dist/src/agent-session-steps.js.map +1 -0
- package/dist/src/agent-session-transitions.d.ts +61 -0
- package/dist/src/agent-session-transitions.js +202 -0
- package/dist/src/agent-session-transitions.js.map +1 -0
- package/dist/src/agent-session-values.d.ts +337 -0
- package/dist/src/agent-session-values.js +127 -0
- package/dist/src/agent-session-values.js.map +1 -0
- package/dist/src/index.d.ts +4 -0
- package/dist/src/index.js +12 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/testing/agent-session-test-client.d.ts +148 -0
- package/dist/src/testing/agent-session-test-client.js +217 -0
- package/dist/src/testing/agent-session-test-client.js.map +1 -0
- package/dist/src/testing/agent-test-environment.d.ts +52 -0
- package/dist/src/testing/agent-test-environment.js +86 -0
- package/dist/src/testing/agent-test-environment.js.map +1 -0
- package/dist/src/testing/agent-worker-process.d.ts +91 -0
- package/dist/src/testing/agent-worker-process.js +150 -0
- package/dist/src/testing/agent-worker-process.js.map +1 -0
- package/dist/src/testing/child-process-group.d.ts +33 -0
- package/dist/src/testing/child-process-group.js +164 -0
- package/dist/src/testing/child-process-group.js.map +1 -0
- package/dist/src/testing/coordination.d.ts +99 -0
- package/dist/src/testing/coordination.js +155 -0
- package/dist/src/testing/coordination.js.map +1 -0
- package/dist/src/testing/index.d.ts +7 -0
- package/dist/src/testing/index.js +15 -0
- package/dist/src/testing/index.js.map +1 -0
- package/dist/src/testing/polling.d.ts +31 -0
- package/dist/src/testing/polling.js +51 -0
- package/dist/src/testing/polling.js.map +1 -0
- package/dist/src/testing/private-dex-engine.d.ts +92 -0
- package/dist/src/testing/private-dex-engine.js +215 -0
- package/dist/src/testing/private-dex-engine.js.map +1 -0
- package/dist/src/testing/step-history.d.ts +40 -0
- package/dist/src/testing/step-history.js +59 -0
- package/dist/src/testing/step-history.js.map +1 -0
- package/package.json +50 -4
|
@@ -0,0 +1,355 @@
|
|
|
1
|
+
// Copyright (c) 2026 Super Durable, Inc.
|
|
2
|
+
//
|
|
3
|
+
// Licensed under the Sustainable Use License 1.0.
|
|
4
|
+
// You may not use this file except in compliance with the License.
|
|
5
|
+
// See the LICENSE file in the repository root.
|
|
6
|
+
//
|
|
7
|
+
// SPDX-License-Identifier: LicenseRef-Sustainable-Use-1.0
|
|
8
|
+
import { jsonCodec } from "@superdurable/dex";
|
|
9
|
+
// Wire values are snake_case JSON shared with the Python core; TypeScript values are camelCase.
|
|
10
|
+
const agentSessionStatuses = [
|
|
11
|
+
"waiting_for_user_message",
|
|
12
|
+
"running_model",
|
|
13
|
+
"running_tools",
|
|
14
|
+
];
|
|
15
|
+
const agentMessageRoles = ["user", "assistant", "tool"];
|
|
16
|
+
const toolEffects = [
|
|
17
|
+
"read",
|
|
18
|
+
"idempotent_write",
|
|
19
|
+
"non_idempotent_write",
|
|
20
|
+
"unclassified",
|
|
21
|
+
];
|
|
22
|
+
const agentToolCallStatuses = [
|
|
23
|
+
"awaiting_approval",
|
|
24
|
+
"approved",
|
|
25
|
+
"rejected",
|
|
26
|
+
"succeeded",
|
|
27
|
+
"failed",
|
|
28
|
+
"outcome_unknown",
|
|
29
|
+
];
|
|
30
|
+
class WireRecordReader {
|
|
31
|
+
typeName;
|
|
32
|
+
record;
|
|
33
|
+
constructor(value, typeName) {
|
|
34
|
+
this.typeName = typeName;
|
|
35
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
36
|
+
throw new TypeError(`${typeName} must be a JSON object`);
|
|
37
|
+
}
|
|
38
|
+
this.record = value;
|
|
39
|
+
}
|
|
40
|
+
readString(field) {
|
|
41
|
+
const value = this.record[field];
|
|
42
|
+
if (typeof value !== "string") {
|
|
43
|
+
throw new TypeError(`${this.typeName}.${field} must be a string`);
|
|
44
|
+
}
|
|
45
|
+
return value;
|
|
46
|
+
}
|
|
47
|
+
readNullableString(field) {
|
|
48
|
+
const value = this.record[field];
|
|
49
|
+
if (value === undefined || value === null) {
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
52
|
+
if (typeof value !== "string") {
|
|
53
|
+
throw new TypeError(`${this.typeName}.${field} must be a string or null`);
|
|
54
|
+
}
|
|
55
|
+
return value;
|
|
56
|
+
}
|
|
57
|
+
readInteger(field) {
|
|
58
|
+
const value = this.record[field];
|
|
59
|
+
if (typeof value !== "number" || !Number.isSafeInteger(value)) {
|
|
60
|
+
throw new TypeError(`${this.typeName}.${field} must be an integer`);
|
|
61
|
+
}
|
|
62
|
+
return value;
|
|
63
|
+
}
|
|
64
|
+
readIntegerOrDefault(field, defaultValue) {
|
|
65
|
+
const value = this.record[field];
|
|
66
|
+
return value === undefined || value === null ? defaultValue : this.readInteger(field);
|
|
67
|
+
}
|
|
68
|
+
readNullableInteger(field) {
|
|
69
|
+
const value = this.record[field];
|
|
70
|
+
if (value === undefined || value === null) {
|
|
71
|
+
return null;
|
|
72
|
+
}
|
|
73
|
+
return this.readInteger(field);
|
|
74
|
+
}
|
|
75
|
+
readBoolean(field) {
|
|
76
|
+
const value = this.record[field];
|
|
77
|
+
if (typeof value !== "boolean") {
|
|
78
|
+
throw new TypeError(`${this.typeName}.${field} must be a boolean`);
|
|
79
|
+
}
|
|
80
|
+
return value;
|
|
81
|
+
}
|
|
82
|
+
readEnum(field, allowed) {
|
|
83
|
+
const value = this.readString(field);
|
|
84
|
+
if (!allowed.includes(value)) {
|
|
85
|
+
throw new TypeError(`${this.typeName}.${field} has unknown value ${value}`);
|
|
86
|
+
}
|
|
87
|
+
return value;
|
|
88
|
+
}
|
|
89
|
+
readArray(field) {
|
|
90
|
+
const value = this.record[field];
|
|
91
|
+
if (!Array.isArray(value)) {
|
|
92
|
+
throw new TypeError(`${this.typeName}.${field} must be an array`);
|
|
93
|
+
}
|
|
94
|
+
return value;
|
|
95
|
+
}
|
|
96
|
+
readObject(field) {
|
|
97
|
+
return this.record[field];
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
export function encodeAgentSessionStartInput(value) {
|
|
101
|
+
return { initial_message: value.initialMessage };
|
|
102
|
+
}
|
|
103
|
+
export function decodeAgentSessionStartInput(value) {
|
|
104
|
+
if (value === null || value === undefined) {
|
|
105
|
+
return { initialMessage: null };
|
|
106
|
+
}
|
|
107
|
+
const reader = new WireRecordReader(value, "AgentSessionStartInput");
|
|
108
|
+
return { initialMessage: reader.readNullableString("initial_message") };
|
|
109
|
+
}
|
|
110
|
+
export function encodeAgentState(value) {
|
|
111
|
+
return {
|
|
112
|
+
status: value.status,
|
|
113
|
+
turn_count: value.turnCount,
|
|
114
|
+
active_turn_id: value.activeTurnId,
|
|
115
|
+
next_message_sequence: value.nextMessageSequence,
|
|
116
|
+
last_turn_error: value.lastTurnError,
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
export function decodeAgentState(value) {
|
|
120
|
+
const reader = new WireRecordReader(value, "AgentState");
|
|
121
|
+
return {
|
|
122
|
+
status: reader.readEnum("status", agentSessionStatuses),
|
|
123
|
+
turnCount: reader.readInteger("turn_count"),
|
|
124
|
+
activeTurnId: reader.readNullableString("active_turn_id"),
|
|
125
|
+
nextMessageSequence: reader.readInteger("next_message_sequence"),
|
|
126
|
+
lastTurnError: reader.readNullableString("last_turn_error"),
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
export function encodeAgentMessage(value) {
|
|
130
|
+
return {
|
|
131
|
+
sequence: value.sequence,
|
|
132
|
+
turn_id: value.turnId,
|
|
133
|
+
role: value.role,
|
|
134
|
+
text: value.text,
|
|
135
|
+
tool_call_id: value.toolCallId,
|
|
136
|
+
tool_name: value.toolName,
|
|
137
|
+
tool_arguments: value.toolArguments,
|
|
138
|
+
tool_output: value.toolOutput,
|
|
139
|
+
framework_item: value.frameworkItem,
|
|
140
|
+
created_at: value.createdAt,
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
export function decodeAgentMessage(value) {
|
|
144
|
+
const reader = new WireRecordReader(value, "AgentMessage");
|
|
145
|
+
return {
|
|
146
|
+
sequence: reader.readInteger("sequence"),
|
|
147
|
+
turnId: reader.readString("turn_id"),
|
|
148
|
+
role: reader.readEnum("role", agentMessageRoles),
|
|
149
|
+
text: reader.readNullableString("text"),
|
|
150
|
+
toolCallId: reader.readNullableString("tool_call_id"),
|
|
151
|
+
toolName: reader.readNullableString("tool_name"),
|
|
152
|
+
toolArguments: reader.readNullableString("tool_arguments"),
|
|
153
|
+
toolOutput: reader.readNullableString("tool_output"),
|
|
154
|
+
frameworkItem: reader.readString("framework_item"),
|
|
155
|
+
createdAt: reader.readString("created_at"),
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
export function encodeAgentToolCall(value) {
|
|
159
|
+
return {
|
|
160
|
+
tool_call_id: value.toolCallId,
|
|
161
|
+
turn_id: value.turnId,
|
|
162
|
+
tool_name: value.toolName,
|
|
163
|
+
arguments: value.arguments,
|
|
164
|
+
effect: value.effect,
|
|
165
|
+
requires_approval: value.requiresApproval,
|
|
166
|
+
status: value.status,
|
|
167
|
+
output: value.output,
|
|
168
|
+
error: value.error,
|
|
169
|
+
rejection_message: value.rejectionMessage,
|
|
170
|
+
deferral_order: value.deferralOrder,
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
export function decodeAgentToolCall(value) {
|
|
174
|
+
const reader = new WireRecordReader(value, "AgentToolCall");
|
|
175
|
+
return {
|
|
176
|
+
toolCallId: reader.readString("tool_call_id"),
|
|
177
|
+
turnId: reader.readString("turn_id"),
|
|
178
|
+
toolName: reader.readString("tool_name"),
|
|
179
|
+
arguments: reader.readString("arguments"),
|
|
180
|
+
effect: reader.readEnum("effect", toolEffects),
|
|
181
|
+
requiresApproval: reader.readBoolean("requires_approval"),
|
|
182
|
+
status: reader.readEnum("status", agentToolCallStatuses),
|
|
183
|
+
output: reader.readNullableString("output"),
|
|
184
|
+
error: reader.readNullableString("error"),
|
|
185
|
+
rejectionMessage: reader.readNullableString("rejection_message"),
|
|
186
|
+
deferralOrder: reader.readIntegerOrDefault("deferral_order", 0),
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
export function encodeAgentInterrupt(value) {
|
|
190
|
+
return {
|
|
191
|
+
interrupt_id: value.interruptId,
|
|
192
|
+
kind: value.kind,
|
|
193
|
+
tool_call_id: value.toolCallId,
|
|
194
|
+
tool_name: value.toolName,
|
|
195
|
+
arguments: value.arguments,
|
|
196
|
+
created_at: value.createdAt,
|
|
197
|
+
deadline: value.deadline,
|
|
198
|
+
};
|
|
199
|
+
}
|
|
200
|
+
export function decodeAgentInterrupt(value) {
|
|
201
|
+
const reader = new WireRecordReader(value, "AgentInterrupt");
|
|
202
|
+
return {
|
|
203
|
+
interruptId: reader.readString("interrupt_id"),
|
|
204
|
+
kind: reader.readEnum("kind", ["tool_approval"]),
|
|
205
|
+
toolCallId: reader.readString("tool_call_id"),
|
|
206
|
+
toolName: reader.readString("tool_name"),
|
|
207
|
+
arguments: reader.readString("arguments"),
|
|
208
|
+
createdAt: reader.readString("created_at"),
|
|
209
|
+
deadline: reader.readNullableString("deadline"),
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
export function encodeAgentInterruptResolution(value) {
|
|
213
|
+
return { approved: value.approved, rejection_message: value.rejectionMessage };
|
|
214
|
+
}
|
|
215
|
+
export function decodeAgentInterruptResolution(value) {
|
|
216
|
+
const reader = new WireRecordReader(value, "AgentInterruptResolution");
|
|
217
|
+
return {
|
|
218
|
+
approved: reader.readBoolean("approved"),
|
|
219
|
+
rejectionMessage: reader.readNullableString("rejection_message"),
|
|
220
|
+
};
|
|
221
|
+
}
|
|
222
|
+
export function encodeAgentUsage(value) {
|
|
223
|
+
return {
|
|
224
|
+
model_calls: value.modelCalls,
|
|
225
|
+
input_tokens: value.inputTokens,
|
|
226
|
+
output_tokens: value.outputTokens,
|
|
227
|
+
cached_input_tokens: value.cachedInputTokens,
|
|
228
|
+
reasoning_tokens: value.reasoningTokens,
|
|
229
|
+
};
|
|
230
|
+
}
|
|
231
|
+
export function decodeAgentUsage(value) {
|
|
232
|
+
const reader = new WireRecordReader(value, "AgentUsage");
|
|
233
|
+
return {
|
|
234
|
+
modelCalls: reader.readInteger("model_calls"),
|
|
235
|
+
inputTokens: reader.readInteger("input_tokens"),
|
|
236
|
+
outputTokens: reader.readInteger("output_tokens"),
|
|
237
|
+
cachedInputTokens: reader.readInteger("cached_input_tokens"),
|
|
238
|
+
reasoningTokens: reader.readInteger("reasoning_tokens"),
|
|
239
|
+
};
|
|
240
|
+
}
|
|
241
|
+
export function encodeAgentUserMessage(value) {
|
|
242
|
+
return { text: value.text };
|
|
243
|
+
}
|
|
244
|
+
export function decodeAgentUserMessage(value) {
|
|
245
|
+
const reader = new WireRecordReader(value, "AgentUserMessage");
|
|
246
|
+
return { text: reader.readString("text") };
|
|
247
|
+
}
|
|
248
|
+
export function encodeToolCallCompleted(value) {
|
|
249
|
+
return { tool_call_id: value.toolCallId };
|
|
250
|
+
}
|
|
251
|
+
export function decodeToolCallCompleted(value) {
|
|
252
|
+
const reader = new WireRecordReader(value, "ToolCallCompleted");
|
|
253
|
+
return { toolCallId: reader.readString("tool_call_id") };
|
|
254
|
+
}
|
|
255
|
+
export function encodeAgentEvent(value) {
|
|
256
|
+
return {
|
|
257
|
+
type: value.type,
|
|
258
|
+
turn_id: value.turnId,
|
|
259
|
+
attempt: value.attempt,
|
|
260
|
+
step_execution_id: value.stepExecutionId,
|
|
261
|
+
payload: value.payload,
|
|
262
|
+
};
|
|
263
|
+
}
|
|
264
|
+
export function decodeAgentEvent(value) {
|
|
265
|
+
const reader = new WireRecordReader(value, "AgentEvent");
|
|
266
|
+
return {
|
|
267
|
+
type: reader.readString("type"),
|
|
268
|
+
turnId: reader.readNullableString("turn_id"),
|
|
269
|
+
attempt: reader.readInteger("attempt"),
|
|
270
|
+
stepExecutionId: reader.readNullableString("step_execution_id") ?? "",
|
|
271
|
+
payload: reader.readString("payload"),
|
|
272
|
+
};
|
|
273
|
+
}
|
|
274
|
+
export function encodeResolveInterruptInput(value) {
|
|
275
|
+
return {
|
|
276
|
+
interrupt_id: value.interruptId,
|
|
277
|
+
approved: value.approved,
|
|
278
|
+
rejection_message: value.rejectionMessage,
|
|
279
|
+
};
|
|
280
|
+
}
|
|
281
|
+
export function decodeResolveInterruptInput(value) {
|
|
282
|
+
const reader = new WireRecordReader(value, "ResolveInterruptInput");
|
|
283
|
+
return {
|
|
284
|
+
interruptId: reader.readString("interrupt_id"),
|
|
285
|
+
approved: reader.readBoolean("approved"),
|
|
286
|
+
rejectionMessage: reader.readNullableString("rejection_message"),
|
|
287
|
+
};
|
|
288
|
+
}
|
|
289
|
+
export function encodeAgentSnapshot(value) {
|
|
290
|
+
return {
|
|
291
|
+
state: value.state === null ? null : encodeAgentState(value.state),
|
|
292
|
+
messages: value.messages.map(encodeAgentMessage),
|
|
293
|
+
pending_interrupts: value.pendingInterrupts.map(encodeAgentInterrupt),
|
|
294
|
+
tool_calls: value.toolCalls.map(encodeAgentToolCall),
|
|
295
|
+
usage: encodeAgentUsage(value.usage),
|
|
296
|
+
queued_message_count: value.queuedMessageCount,
|
|
297
|
+
};
|
|
298
|
+
}
|
|
299
|
+
export function decodeAgentSnapshot(value) {
|
|
300
|
+
const reader = new WireRecordReader(value, "AgentSnapshot");
|
|
301
|
+
return {
|
|
302
|
+
state: reader.readObject("state") == null ? null : decodeAgentState(reader.readObject("state")),
|
|
303
|
+
messages: reader.readArray("messages").map(decodeAgentMessage),
|
|
304
|
+
pendingInterrupts: reader.readArray("pending_interrupts").map(decodeAgentInterrupt),
|
|
305
|
+
toolCalls: reader.readArray("tool_calls").map(decodeAgentToolCall),
|
|
306
|
+
usage: decodeAgentUsage(reader.readObject("usage")),
|
|
307
|
+
queuedMessageCount: reader.readIntegerOrDefault("queued_message_count", 0),
|
|
308
|
+
};
|
|
309
|
+
}
|
|
310
|
+
export function encodeListAgentMessagesInput(value) {
|
|
311
|
+
return { before_sequence: value.beforeSequence, limit: value.limit };
|
|
312
|
+
}
|
|
313
|
+
export function decodeListAgentMessagesInput(value) {
|
|
314
|
+
const reader = new WireRecordReader(value, "ListAgentMessagesInput");
|
|
315
|
+
return {
|
|
316
|
+
beforeSequence: reader.readNullableInteger("before_sequence"),
|
|
317
|
+
limit: reader.readIntegerOrDefault("limit", 50),
|
|
318
|
+
};
|
|
319
|
+
}
|
|
320
|
+
export function encodeAgentMessagesPage(value) {
|
|
321
|
+
return {
|
|
322
|
+
messages: value.messages.map(encodeAgentMessage),
|
|
323
|
+
next_before_sequence: value.nextBeforeSequence,
|
|
324
|
+
};
|
|
325
|
+
}
|
|
326
|
+
export function decodeAgentMessagesPage(value) {
|
|
327
|
+
const reader = new WireRecordReader(value, "AgentMessagesPage");
|
|
328
|
+
return {
|
|
329
|
+
messages: reader.readArray("messages").map(decodeAgentMessage),
|
|
330
|
+
nextBeforeSequence: reader.readNullableInteger("next_before_sequence"),
|
|
331
|
+
};
|
|
332
|
+
}
|
|
333
|
+
function snakeCaseJsonCodec(typeName, encode, decode) {
|
|
334
|
+
return jsonCodec({ typeName, encode, decode });
|
|
335
|
+
}
|
|
336
|
+
export const agentSessionStartInputCodec = snakeCaseJsonCodec("AgentSessionStartInput", encodeAgentSessionStartInput, decodeAgentSessionStartInput);
|
|
337
|
+
export const agentStateCodec = snakeCaseJsonCodec("AgentState", encodeAgentState, decodeAgentState);
|
|
338
|
+
export const agentMessageCodec = snakeCaseJsonCodec("AgentMessage", encodeAgentMessage, decodeAgentMessage);
|
|
339
|
+
export const agentToolCallCodec = snakeCaseJsonCodec("AgentToolCall", encodeAgentToolCall, decodeAgentToolCall);
|
|
340
|
+
export const agentInterruptListCodec = snakeCaseJsonCodec("AgentInterruptList", (value) => value.map(encodeAgentInterrupt), (value) => {
|
|
341
|
+
if (!Array.isArray(value)) {
|
|
342
|
+
throw new TypeError("PendingInterrupts must be a JSON array");
|
|
343
|
+
}
|
|
344
|
+
return value.map(decodeAgentInterrupt);
|
|
345
|
+
});
|
|
346
|
+
export const agentInterruptResolutionCodec = snakeCaseJsonCodec("AgentInterruptResolution", encodeAgentInterruptResolution, decodeAgentInterruptResolution);
|
|
347
|
+
export const agentUsageCodec = snakeCaseJsonCodec("AgentUsage", encodeAgentUsage, decodeAgentUsage);
|
|
348
|
+
export const agentUserMessageCodec = snakeCaseJsonCodec("AgentUserMessage", encodeAgentUserMessage, decodeAgentUserMessage);
|
|
349
|
+
export const toolCallCompletedCodec = snakeCaseJsonCodec("ToolCallCompleted", encodeToolCallCompleted, decodeToolCallCompleted);
|
|
350
|
+
export const agentEventCodec = snakeCaseJsonCodec("AgentEvent", encodeAgentEvent, decodeAgentEvent);
|
|
351
|
+
export const resolveInterruptInputCodec = snakeCaseJsonCodec("ResolveInterruptInput", encodeResolveInterruptInput, decodeResolveInterruptInput);
|
|
352
|
+
export const agentSnapshotCodec = snakeCaseJsonCodec("AgentSnapshot", encodeAgentSnapshot, decodeAgentSnapshot);
|
|
353
|
+
export const listAgentMessagesInputCodec = snakeCaseJsonCodec("ListAgentMessagesInput", encodeListAgentMessagesInput, decodeListAgentMessagesInput);
|
|
354
|
+
export const agentMessagesPageCodec = snakeCaseJsonCodec("AgentMessagesPage", encodeAgentMessagesPage, decodeAgentMessagesPage);
|
|
355
|
+
//# sourceMappingURL=agent-session-codecs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-session-codecs.js","sourceRoot":"","sources":["../../src/agent-session-codecs.ts"],"names":[],"mappings":"AAAA,yCAAyC;AACzC,EAAE;AACF,kDAAkD;AAClD,mEAAmE;AACnE,+CAA+C;AAC/C,EAAE;AACF,0DAA0D;AAE1D,OAAO,EAAE,SAAS,EAAc,MAAM,mBAAmB,CAAC;AAuB1D,gGAAgG;AAEhG,MAAM,oBAAoB,GAAkC;IAC1D,0BAA0B;IAC1B,eAAe;IACf,eAAe;CAChB,CAAC;AACF,MAAM,iBAAiB,GAAgC,CAAC,MAAM,EAAE,WAAW,EAAE,MAAM,CAAC,CAAC;AACrF,MAAM,WAAW,GAA0B;IACzC,MAAM;IACN,kBAAkB;IAClB,sBAAsB;IACtB,cAAc;CACf,CAAC;AACF,MAAM,qBAAqB,GAAmC;IAC5D,mBAAmB;IACnB,UAAU;IACV,UAAU;IACV,WAAW;IACX,QAAQ;IACR,iBAAiB;CAClB,CAAC;AAEF,MAAM,gBAAgB;IAKD;IAJF,MAAM,CAAoC;IAE3D,YACE,KAAc,EACG,QAAgB;QAAhB,aAAQ,GAAR,QAAQ,CAAQ;QAEjC,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;YACxE,MAAM,IAAI,SAAS,CAAC,GAAG,QAAQ,wBAAwB,CAAC,CAAC;QAC3D,CAAC;QACD,IAAI,CAAC,MAAM,GAAG,KAA0C,CAAC;IAC3D,CAAC;IAEM,UAAU,CAAC,KAAa;QAC7B,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QACjC,IAAI,OAAO,KAAK,KAAK,QAAQ,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M,kBAAkB,GAAG,kBAAkB,CAClD,eAAe,EACf,mBAAmB,EACnB,mBAAmB,CACpB,CAAC;AACF,MAAM,CAAC,MAAM,2BAA2B,GAAG,kBAAkB,CAC3D,wBAAwB,EACxB,4BAA4B,EAC5B,4BAA4B,CAC7B,CAAC;AACF,MAAM,CAAC,MAAM,sBAAsB,GAAG,kBAAkB,CACtD,mBAAmB,EACnB,uBAAuB,EACvB,uBAAuB,CACxB,CAAC"}
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import { type Context, type Flow, type RPCResult } from "@superdurable/dex";
|
|
2
|
+
import type { AgentFrameworkRunner, ToolPolicy } from "./agent-framework-runner.js";
|
|
3
|
+
import { type AgentSessionPersistence } from "./agent-session-persistence.js";
|
|
4
|
+
import type { AgentMessagesPage, AgentSessionStartInput, AgentSnapshot, AgentUserMessage, ListAgentMessagesInput, ResolveInterruptInput, ToolEffect } from "./agent-session-values.js";
|
|
5
|
+
/** Tool policies, live events, and approval deadline of one agent, passed to {@link createAgentSessionFlow}. */
|
|
6
|
+
export interface AgentSessionOptions {
|
|
7
|
+
/**
|
|
8
|
+
* Policies by tool name. A policy overrides framework metadata and {@link defaultToolEffect}.
|
|
9
|
+
* Defaults to none.
|
|
10
|
+
*/
|
|
11
|
+
readonly toolPolicies?: Readonly<Record<string, ToolPolicy>>;
|
|
12
|
+
/**
|
|
13
|
+
* Effect of a tool without a policy or framework metadata. Defaults to `"unclassified"`, so unknown
|
|
14
|
+
* tools run once and need approval.
|
|
15
|
+
*/
|
|
16
|
+
readonly defaultToolEffect?: ToolEffect;
|
|
17
|
+
/**
|
|
18
|
+
* Approximate byte budget of the `AgentEvents` Stream, shared by every session of the Flow type.
|
|
19
|
+
* Defaults to 10 MiB.
|
|
20
|
+
*/
|
|
21
|
+
readonly eventStreamCapacityBytes?: number;
|
|
22
|
+
/**
|
|
23
|
+
* Milliseconds an approval may stay pending before `AwaitToolApproval` rejects it with
|
|
24
|
+
* `"approval deadline passed"`. Defaults to no deadline: approvals wait indefinitely.
|
|
25
|
+
*/
|
|
26
|
+
readonly interruptDeadlineMs?: number;
|
|
27
|
+
}
|
|
28
|
+
/** Options applied by an {@link AgentSessionFlow}, with every default filled in. */
|
|
29
|
+
export interface ResolvedAgentSessionOptions {
|
|
30
|
+
/** Policies by tool name. */
|
|
31
|
+
readonly toolPolicies: Readonly<Record<string, ToolPolicy>>;
|
|
32
|
+
/** Effect of a tool without a policy or framework metadata. */
|
|
33
|
+
readonly defaultToolEffect: ToolEffect;
|
|
34
|
+
/** Byte budget of the `AgentEvents` Stream. */
|
|
35
|
+
readonly eventStreamCapacityBytes: number;
|
|
36
|
+
/** Approval deadline in milliseconds, or `undefined` for none. */
|
|
37
|
+
readonly interruptDeadlineMs: number | undefined;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Durable agent session Flow: one Flow execution is one agent session, and its Flow ID is the session ID.
|
|
41
|
+
*
|
|
42
|
+
* Create one per agent with {@link createAgentSessionFlow}, register it in the process `Registry`, and
|
|
43
|
+
* call its RPCs with `Client.invokeRPC`. The RPC names are `send_user_message`, `resolve_interrupt`,
|
|
44
|
+
* `get_agent_snapshot`, and `list_agent_messages`, the same as the Python core. The session never
|
|
45
|
+
* completes on its own: it waits for the next user message after every turn. Stop it with
|
|
46
|
+
* `Client.stopFlow`.
|
|
47
|
+
*
|
|
48
|
+
* The Flow's persistence definitions are properties of the Flow; pass them to `Client.getAttributes`
|
|
49
|
+
* or the Stream reads.
|
|
50
|
+
*
|
|
51
|
+
* @example
|
|
52
|
+
* ```ts
|
|
53
|
+
* const flow = createAgentSessionFlow(runner, "SupportAgent");
|
|
54
|
+
* const registry = new Registry([flow]);
|
|
55
|
+
* // ... start a Worker and a Client with this registry ...
|
|
56
|
+
* await client.startFlow(flow, sessionId, { initialMessage: null });
|
|
57
|
+
* await client.invokeRPC(flow.sendUserMessage, sessionId, { text: "Where is order 42?" });
|
|
58
|
+
* const snapshot = await client.invokeRPC(flow.getAgentSnapshot, sessionId);
|
|
59
|
+
* for (const interrupt of snapshot.pendingInterrupts) {
|
|
60
|
+
* await client.invokeRPC(flow.resolveInterrupt, sessionId, {
|
|
61
|
+
* interruptId: interrupt.interruptId, approved: true, rejectionMessage: null });
|
|
62
|
+
* }
|
|
63
|
+
* ```
|
|
64
|
+
*/
|
|
65
|
+
export interface AgentSessionFlow extends Flow<AgentSessionStartInput>, AgentSessionPersistence {
|
|
66
|
+
/** The framework runner passed to {@link createAgentSessionFlow}. */
|
|
67
|
+
readonly runner: AgentFrameworkRunner;
|
|
68
|
+
/** The options this Flow applies, with defaults filled in. */
|
|
69
|
+
readonly options: ResolvedAgentSessionOptions;
|
|
70
|
+
/**
|
|
71
|
+
* RPC `send_user_message`: queues one user message.
|
|
72
|
+
*
|
|
73
|
+
* The session starts one turn per queued message, in order, after the current turn ends.
|
|
74
|
+
* The RPC requires a running session.
|
|
75
|
+
*
|
|
76
|
+
* @param context - RPC Context supplied by Dex.
|
|
77
|
+
* @param message - Message to queue.
|
|
78
|
+
* @returns `true` when queued; `false` when the text is blank.
|
|
79
|
+
*/
|
|
80
|
+
sendUserMessage(context: Context, message: AgentUserMessage): RPCResult<boolean>;
|
|
81
|
+
/**
|
|
82
|
+
* RPC `resolve_interrupt`: approves or rejects one pending interrupt.
|
|
83
|
+
*
|
|
84
|
+
* It removes the interrupt from `PendingInterrupts` and publishes the answer in one commit, so only
|
|
85
|
+
* one call succeeds per interrupt. It locks `PendingInterrupts`, so a call that races
|
|
86
|
+
* `AwaitToolApproval` can fail with `RpcLockConflictError`, which is safe to retry. The
|
|
87
|
+
* rejection message is dropped when `approved` is `true`.
|
|
88
|
+
*
|
|
89
|
+
* @param context - RPC Context supplied by Dex.
|
|
90
|
+
* @param input - Interrupt ID and decision.
|
|
91
|
+
* @returns `true` when the interrupt was pending and is now resolved; `false` when it is unknown,
|
|
92
|
+
* already resolved, or past its deadline.
|
|
93
|
+
*/
|
|
94
|
+
resolveInterrupt(context: Context, input: ResolveInterruptInput): RPCResult<boolean>;
|
|
95
|
+
/**
|
|
96
|
+
* RPC `get_agent_snapshot`: returns the durable session view a UI renders.
|
|
97
|
+
*
|
|
98
|
+
* It reads committed state without locks, so it also serves a retained closed session. It loads the
|
|
99
|
+
* whole `AgentMessages` map.
|
|
100
|
+
*
|
|
101
|
+
* @param context - RPC Context supplied by Dex.
|
|
102
|
+
* @returns State, the last 200 messages, pending interrupts, the active turn's tool calls, usage,
|
|
103
|
+
* and the queued message count. Before `StartAgentSession` commits, `state` is `null` and the lists
|
|
104
|
+
* are empty.
|
|
105
|
+
*/
|
|
106
|
+
getAgentSnapshot(context: Context): RPCResult<AgentSnapshot>;
|
|
107
|
+
/**
|
|
108
|
+
* RPC `list_agent_messages`: returns one page of stored messages, oldest first.
|
|
109
|
+
*
|
|
110
|
+
* Start with `beforeSequence` `null` for the newest page, then pass each page's
|
|
111
|
+
* `nextBeforeSequence` to walk back. It also serves a retained closed session.
|
|
112
|
+
*
|
|
113
|
+
* @param context - RPC Context supplied by Dex.
|
|
114
|
+
* @param input - Exclusive upper sequence bound, or `null`, and a page size clamped to 1..200.
|
|
115
|
+
* @returns Up to `limit` messages below `beforeSequence` in ascending order, and the bound of the
|
|
116
|
+
* next older page, or `null` when the page starts at the first message.
|
|
117
|
+
*/
|
|
118
|
+
listAgentMessages(context: Context, input: ListAgentMessagesInput): RPCResult<AgentMessagesPage>;
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Creates the shared agent session Flow for one agent and its framework runner.
|
|
122
|
+
*
|
|
123
|
+
* Construct it once per agent at application startup and pass the same object to the Registry and
|
|
124
|
+
* every Client call. Each call creates a distinct Flow with its own Step instances, persistence
|
|
125
|
+
* definitions, and RPC methods, so one Registry can hold several agents under different Flow types.
|
|
126
|
+
* Adapter packages wrap this function; applications usually call the adapter's factory instead.
|
|
127
|
+
*
|
|
128
|
+
* It is a function rather than a class because the Dex Client identifies an RPC by its method
|
|
129
|
+
* function, and two Flows of one class would share their RPC methods.
|
|
130
|
+
*
|
|
131
|
+
* @example
|
|
132
|
+
* ```ts
|
|
133
|
+
* const triage = createAgentSessionFlow(triageRunner, "TriageAgent", {
|
|
134
|
+
* toolPolicies: { lookup_customer: { effect: "read" } },
|
|
135
|
+
* interruptDeadlineMs: 24 * 60 * 60 * 1000,
|
|
136
|
+
* });
|
|
137
|
+
* const billing = createAgentSessionFlow(billingRunner, "BillingAgent");
|
|
138
|
+
* const registry = new Registry([triage, billing]);
|
|
139
|
+
* ```
|
|
140
|
+
* @param runner - Framework runner; the Flow owns no other dependency.
|
|
141
|
+
* @param flowType - Flow type, unique within the Registry, such as `"TriageAgent"`. Keep it stable:
|
|
142
|
+
* running sessions resume by it.
|
|
143
|
+
* @param options - Tool policies, Stream capacity, and approval deadline. Defaults to all defaults.
|
|
144
|
+
* @returns A new Flow to register in one Registry.
|
|
145
|
+
* @throws {TypeError} When `flowType` is blank, the runner is incomplete, or an effect is unknown.
|
|
146
|
+
* @throws {RangeError} When `eventStreamCapacityBytes` or `interruptDeadlineMs` is not positive.
|
|
147
|
+
*/
|
|
148
|
+
export declare function createAgentSessionFlow(runner: AgentFrameworkRunner, flowType: string, options?: AgentSessionOptions): AgentSessionFlow;
|