@cuylabs/agent-runtime-dapr 4.8.1 → 4.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +14 -0
- package/dist/{chunk-2TBZCBXE.js → chunk-7VYLWJTB.js} +177 -62
- package/dist/{chunk-6BLY7B7U.js → chunk-BQLQLDWZ.js} +127 -122
- package/dist/{chunk-J3IJLF6U.js → chunk-POIJYTT6.js} +63 -61
- package/dist/{chunk-26RCP3L3.js → chunk-ZX2MACJF.js} +208 -129
- package/dist/{client-UsEIzDF6.d.ts → client-BQj84t2u.d.ts} +15 -1
- package/dist/dispatch/index.d.ts +4 -4
- package/dist/dispatch/index.js +1 -1
- package/dist/execution/index.js +1 -1
- package/dist/host/index.d.ts +4 -4
- package/dist/host/index.js +4 -4
- package/dist/{index-BY0FipV1.d.ts → index-DIpZewhn.d.ts} +4 -3
- package/dist/{index-CFm5LORU.d.ts → index-NFuDUiOD.d.ts} +11 -2
- package/dist/{index-UtePd9on.d.ts → index-u0qPFHJK.d.ts} +21 -20
- package/dist/index.d.ts +9 -9
- package/dist/index.js +8 -4
- package/dist/team/index.d.ts +3 -3
- package/dist/team/index.js +4 -4
- package/dist/{worker-CXq0IFGX.d.ts → worker-CgoEkwKw.d.ts} +1 -1
- package/dist/workflow/index.d.ts +2 -2
- package/dist/workflow/index.js +5 -1
- package/dist/{workflow-host-D6W6fXoL.d.ts → workflow-host-Cxlu5sNv.d.ts} +2 -1
- package/package.json +4 -4
|
@@ -4,7 +4,10 @@ import {
|
|
|
4
4
|
} from "./chunk-HQLQRXU5.js";
|
|
5
5
|
|
|
6
6
|
// src/dispatch/runtime.ts
|
|
7
|
-
import { ensureNonEmpty as
|
|
7
|
+
import { ensureNonEmpty as ensureNonEmpty3, mergeInspection, sleep } from "@cuylabs/agent-core";
|
|
8
|
+
|
|
9
|
+
// src/dispatch/targets.ts
|
|
10
|
+
import { ensureNonEmpty as ensureNonEmpty2 } from "@cuylabs/agent-core";
|
|
8
11
|
|
|
9
12
|
// src/host/invoker.ts
|
|
10
13
|
var DEFAULT_DAPR_HTTP_ENDPOINT = "http://127.0.0.1:3500";
|
|
@@ -163,121 +166,7 @@ async function invokeRemoteAgentRun(invoker, appId, request, methodPath = "agent
|
|
|
163
166
|
return response.data;
|
|
164
167
|
}
|
|
165
168
|
|
|
166
|
-
// src/dispatch/
|
|
167
|
-
var DEFAULT_KEY_PREFIX = "agent-runtime:dispatch:";
|
|
168
|
-
var STORED_KIND = "@cuylabs/agent-runtime-dapr/dispatch-record";
|
|
169
|
-
var STORED_VERSION = 1;
|
|
170
|
-
var DEFAULT_INDEX_UPDATE_RETRIES = 4;
|
|
171
|
-
var DEFAULT_POLL_INTERVAL_MS = 500;
|
|
172
|
-
function cloneRecord(record) {
|
|
173
|
-
return structuredClone(record);
|
|
174
|
-
}
|
|
175
|
-
function toStoredRecord(record) {
|
|
176
|
-
return {
|
|
177
|
-
kind: STORED_KIND,
|
|
178
|
-
version: STORED_VERSION,
|
|
179
|
-
record
|
|
180
|
-
};
|
|
181
|
-
}
|
|
182
|
-
function fromStoredRecord(value) {
|
|
183
|
-
if (!value || typeof value !== "object") {
|
|
184
|
-
return void 0;
|
|
185
|
-
}
|
|
186
|
-
const envelope = value;
|
|
187
|
-
if (envelope.kind !== STORED_KIND || envelope.version !== STORED_VERSION || !envelope.record) {
|
|
188
|
-
return void 0;
|
|
189
|
-
}
|
|
190
|
-
return cloneRecord(envelope.record);
|
|
191
|
-
}
|
|
192
|
-
function normalizeStatuses(status) {
|
|
193
|
-
if (!status) {
|
|
194
|
-
return void 0;
|
|
195
|
-
}
|
|
196
|
-
return new Set(Array.isArray(status) ? status : [status]);
|
|
197
|
-
}
|
|
198
|
-
function createDaprDispatchRecordWriter(options) {
|
|
199
|
-
const client = new DaprSidecarClient(options);
|
|
200
|
-
const agentId = ensureNonEmpty2(options.agentId, "agentId");
|
|
201
|
-
const keyPrefix = ensureNonEmpty2(
|
|
202
|
-
options.keyPrefix ?? DEFAULT_KEY_PREFIX,
|
|
203
|
-
"keyPrefix"
|
|
204
|
-
);
|
|
205
|
-
function recordKey(id) {
|
|
206
|
-
return `${keyPrefix}records/${agentId}/${id}`;
|
|
207
|
-
}
|
|
208
|
-
function globalIndexKey() {
|
|
209
|
-
return `${keyPrefix}record-index/${agentId}`;
|
|
210
|
-
}
|
|
211
|
-
function sessionIndexKey(sessionId) {
|
|
212
|
-
return `${keyPrefix}session-index/${agentId}/${sessionId}`;
|
|
213
|
-
}
|
|
214
|
-
async function readIndex(key) {
|
|
215
|
-
const entry = await client.getStateEntry(key);
|
|
216
|
-
if (entry.value === void 0) {
|
|
217
|
-
return { exists: false };
|
|
218
|
-
}
|
|
219
|
-
if (!Array.isArray(entry.value)) {
|
|
220
|
-
return { ids: [], etag: entry.etag, exists: true };
|
|
221
|
-
}
|
|
222
|
-
return {
|
|
223
|
-
ids: [
|
|
224
|
-
...new Set(
|
|
225
|
-
entry.value.filter(
|
|
226
|
-
(item) => typeof item === "string"
|
|
227
|
-
)
|
|
228
|
-
)
|
|
229
|
-
],
|
|
230
|
-
etag: entry.etag,
|
|
231
|
-
exists: true
|
|
232
|
-
};
|
|
233
|
-
}
|
|
234
|
-
async function writeIndex(key, ids, etag) {
|
|
235
|
-
await client.saveState(key, [...new Set(ids)], {
|
|
236
|
-
...etag ? { etag } : {},
|
|
237
|
-
concurrency: etag ? "first-write" : void 0
|
|
238
|
-
});
|
|
239
|
-
}
|
|
240
|
-
async function updateIndex(key, updater) {
|
|
241
|
-
for (let attempt = 0; attempt < DEFAULT_INDEX_UPDATE_RETRIES; attempt += 1) {
|
|
242
|
-
const current = await readIndex(key);
|
|
243
|
-
const next = updater(current.ids ?? []);
|
|
244
|
-
if (!next) {
|
|
245
|
-
return;
|
|
246
|
-
}
|
|
247
|
-
try {
|
|
248
|
-
await writeIndex(key, next, current.etag);
|
|
249
|
-
return;
|
|
250
|
-
} catch (error) {
|
|
251
|
-
if (isDaprConflictError(error) && attempt + 1 < DEFAULT_INDEX_UPDATE_RETRIES) {
|
|
252
|
-
continue;
|
|
253
|
-
}
|
|
254
|
-
throw error;
|
|
255
|
-
}
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
async function addRecordToIndex(key, id) {
|
|
259
|
-
await updateIndex(key, (ids) => {
|
|
260
|
-
if (ids.includes(id)) {
|
|
261
|
-
return void 0;
|
|
262
|
-
}
|
|
263
|
-
return [...ids, id];
|
|
264
|
-
});
|
|
265
|
-
}
|
|
266
|
-
return {
|
|
267
|
-
async saveStartedRecord(record) {
|
|
268
|
-
await client.saveState(recordKey(record.id), toStoredRecord(record), {
|
|
269
|
-
concurrency: "first-write"
|
|
270
|
-
});
|
|
271
|
-
await addRecordToIndex(globalIndexKey(), record.id);
|
|
272
|
-
if (record.parentSessionId) {
|
|
273
|
-
await addRecordToIndex(
|
|
274
|
-
sessionIndexKey(record.parentSessionId),
|
|
275
|
-
record.id
|
|
276
|
-
);
|
|
277
|
-
}
|
|
278
|
-
}
|
|
279
|
-
};
|
|
280
|
-
}
|
|
169
|
+
// src/dispatch/targets.ts
|
|
281
170
|
function mapWorkflowStatus(status) {
|
|
282
171
|
switch (status) {
|
|
283
172
|
case "COMPLETED":
|
|
@@ -494,10 +383,126 @@ function createRemoteAgentDispatchTarget(options) {
|
|
|
494
383
|
}
|
|
495
384
|
};
|
|
496
385
|
}
|
|
386
|
+
|
|
387
|
+
// src/dispatch/runtime.ts
|
|
388
|
+
var DEFAULT_KEY_PREFIX = "agent-runtime:dispatch:";
|
|
389
|
+
var STORED_KIND = "@cuylabs/agent-runtime-dapr/dispatch-record";
|
|
390
|
+
var STORED_VERSION = 1;
|
|
391
|
+
var DEFAULT_INDEX_UPDATE_RETRIES = 4;
|
|
392
|
+
var DEFAULT_POLL_INTERVAL_MS = 500;
|
|
393
|
+
function cloneRecord(record) {
|
|
394
|
+
return structuredClone(record);
|
|
395
|
+
}
|
|
396
|
+
function toStoredRecord(record) {
|
|
397
|
+
return {
|
|
398
|
+
kind: STORED_KIND,
|
|
399
|
+
version: STORED_VERSION,
|
|
400
|
+
record
|
|
401
|
+
};
|
|
402
|
+
}
|
|
403
|
+
function fromStoredRecord(value) {
|
|
404
|
+
if (!value || typeof value !== "object") {
|
|
405
|
+
return void 0;
|
|
406
|
+
}
|
|
407
|
+
const envelope = value;
|
|
408
|
+
if (envelope.kind !== STORED_KIND || envelope.version !== STORED_VERSION || !envelope.record) {
|
|
409
|
+
return void 0;
|
|
410
|
+
}
|
|
411
|
+
return cloneRecord(envelope.record);
|
|
412
|
+
}
|
|
413
|
+
function normalizeStatuses(status) {
|
|
414
|
+
if (!status) {
|
|
415
|
+
return void 0;
|
|
416
|
+
}
|
|
417
|
+
return new Set(Array.isArray(status) ? status : [status]);
|
|
418
|
+
}
|
|
419
|
+
function createDaprDispatchRecordWriter(options) {
|
|
420
|
+
const client = new DaprSidecarClient(options);
|
|
421
|
+
const agentId = ensureNonEmpty3(options.agentId, "agentId");
|
|
422
|
+
const keyPrefix = ensureNonEmpty3(
|
|
423
|
+
options.keyPrefix ?? DEFAULT_KEY_PREFIX,
|
|
424
|
+
"keyPrefix"
|
|
425
|
+
);
|
|
426
|
+
function recordKey(id) {
|
|
427
|
+
return `${keyPrefix}records/${agentId}/${id}`;
|
|
428
|
+
}
|
|
429
|
+
function globalIndexKey() {
|
|
430
|
+
return `${keyPrefix}record-index/${agentId}`;
|
|
431
|
+
}
|
|
432
|
+
function sessionIndexKey(sessionId) {
|
|
433
|
+
return `${keyPrefix}session-index/${agentId}/${sessionId}`;
|
|
434
|
+
}
|
|
435
|
+
async function readIndex(key) {
|
|
436
|
+
const entry = await client.getStateEntry(key);
|
|
437
|
+
if (entry.value === void 0) {
|
|
438
|
+
return { exists: false };
|
|
439
|
+
}
|
|
440
|
+
if (!Array.isArray(entry.value)) {
|
|
441
|
+
return { ids: [], etag: entry.etag, exists: true };
|
|
442
|
+
}
|
|
443
|
+
return {
|
|
444
|
+
ids: [
|
|
445
|
+
...new Set(
|
|
446
|
+
entry.value.filter(
|
|
447
|
+
(item) => typeof item === "string"
|
|
448
|
+
)
|
|
449
|
+
)
|
|
450
|
+
],
|
|
451
|
+
etag: entry.etag,
|
|
452
|
+
exists: true
|
|
453
|
+
};
|
|
454
|
+
}
|
|
455
|
+
async function writeIndex(key, ids, etag) {
|
|
456
|
+
await client.saveState(key, [...new Set(ids)], {
|
|
457
|
+
...etag ? { etag } : {},
|
|
458
|
+
concurrency: etag ? "first-write" : void 0
|
|
459
|
+
});
|
|
460
|
+
}
|
|
461
|
+
async function updateIndex(key, updater) {
|
|
462
|
+
for (let attempt = 0; attempt < DEFAULT_INDEX_UPDATE_RETRIES; attempt += 1) {
|
|
463
|
+
const current = await readIndex(key);
|
|
464
|
+
const next = updater(current.ids ?? []);
|
|
465
|
+
if (!next) {
|
|
466
|
+
return;
|
|
467
|
+
}
|
|
468
|
+
try {
|
|
469
|
+
await writeIndex(key, next, current.etag);
|
|
470
|
+
return;
|
|
471
|
+
} catch (error) {
|
|
472
|
+
if (isDaprConflictError(error) && attempt + 1 < DEFAULT_INDEX_UPDATE_RETRIES) {
|
|
473
|
+
continue;
|
|
474
|
+
}
|
|
475
|
+
throw error;
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
async function addRecordToIndex(key, id) {
|
|
480
|
+
await updateIndex(key, (ids) => {
|
|
481
|
+
if (ids.includes(id)) {
|
|
482
|
+
return void 0;
|
|
483
|
+
}
|
|
484
|
+
return [...ids, id];
|
|
485
|
+
});
|
|
486
|
+
}
|
|
487
|
+
return {
|
|
488
|
+
async saveStartedRecord(record) {
|
|
489
|
+
await client.saveState(recordKey(record.id), toStoredRecord(record), {
|
|
490
|
+
concurrency: "first-write"
|
|
491
|
+
});
|
|
492
|
+
await addRecordToIndex(globalIndexKey(), record.id);
|
|
493
|
+
if (record.parentSessionId) {
|
|
494
|
+
await addRecordToIndex(
|
|
495
|
+
sessionIndexKey(record.parentSessionId),
|
|
496
|
+
record.id
|
|
497
|
+
);
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
};
|
|
501
|
+
}
|
|
497
502
|
function createDaprDispatchRuntime(options) {
|
|
498
503
|
const client = new DaprSidecarClient(options);
|
|
499
|
-
const agentId =
|
|
500
|
-
const keyPrefix =
|
|
504
|
+
const agentId = ensureNonEmpty3(options.agentId, "agentId");
|
|
505
|
+
const keyPrefix = ensureNonEmpty3(
|
|
501
506
|
options.keyPrefix ?? DEFAULT_KEY_PREFIX,
|
|
502
507
|
"keyPrefix"
|
|
503
508
|
);
|
|
@@ -677,7 +682,7 @@ function createDaprDispatchRuntime(options) {
|
|
|
677
682
|
},
|
|
678
683
|
async start(input) {
|
|
679
684
|
const target = targets.get(
|
|
680
|
-
|
|
685
|
+
ensureNonEmpty3(input.targetType, "targetType")
|
|
681
686
|
);
|
|
682
687
|
if (!target) {
|
|
683
688
|
throw new Error(`Unknown dispatch target "${input.targetType}".`);
|
|
@@ -685,7 +690,7 @@ function createDaprDispatchRuntime(options) {
|
|
|
685
690
|
const id = createId();
|
|
686
691
|
const startedAt = now();
|
|
687
692
|
const title = input.title?.trim() || `Dispatch: ${target.name}`;
|
|
688
|
-
const brief =
|
|
693
|
+
const brief = ensureNonEmpty3(input.brief, "brief");
|
|
689
694
|
const launched = await target.start({
|
|
690
695
|
id,
|
|
691
696
|
brief,
|
|
@@ -736,7 +741,7 @@ function createDaprDispatchRuntime(options) {
|
|
|
736
741
|
`No target registered for dispatch target "${current.targetType}".`
|
|
737
742
|
);
|
|
738
743
|
}
|
|
739
|
-
const nextMessage =
|
|
744
|
+
const nextMessage = ensureNonEmpty3(message, "message");
|
|
740
745
|
await target.redirect({
|
|
741
746
|
record: cloneRecord(current),
|
|
742
747
|
message: nextMessage
|
|
@@ -992,9 +997,9 @@ function createDaprCompositeDispatchExecutor(options) {
|
|
|
992
997
|
export {
|
|
993
998
|
DaprServiceInvoker,
|
|
994
999
|
invokeRemoteAgentRun,
|
|
995
|
-
createDaprDispatchRecordWriter,
|
|
996
1000
|
createWorkflowDispatchTarget,
|
|
997
1001
|
createRemoteAgentDispatchTarget,
|
|
1002
|
+
createDaprDispatchRecordWriter,
|
|
998
1003
|
createDaprDispatchRuntime,
|
|
999
1004
|
readWorkflowCompletion,
|
|
1000
1005
|
createDaprWorkflowDispatchExecutor,
|
|
@@ -3,19 +3,7 @@ import {
|
|
|
3
3
|
isDaprConflictError
|
|
4
4
|
} from "./chunk-HQLQRXU5.js";
|
|
5
5
|
|
|
6
|
-
// src/execution/store.ts
|
|
7
|
-
var DEFAULT_KEY_PREFIX = "agent-runtime:execution:";
|
|
8
|
-
var STORED_EXECUTION_KIND = "@cuylabs/agent-runtime-dapr/execution";
|
|
9
|
-
var STORED_EXECUTION_CHECKPOINT_KIND = "@cuylabs/agent-runtime-dapr/execution-checkpoint";
|
|
10
|
-
var STORED_EXECUTION_VERSION = 1;
|
|
11
|
-
var DEFAULT_INDEX_UPDATE_RETRIES = 4;
|
|
12
|
-
function ensureNonEmpty(input, label) {
|
|
13
|
-
const trimmed = input.trim();
|
|
14
|
-
if (!trimmed) {
|
|
15
|
-
throw new Error(`${label} must not be empty`);
|
|
16
|
-
}
|
|
17
|
-
return trimmed;
|
|
18
|
-
}
|
|
6
|
+
// src/execution/store-serialization.ts
|
|
19
7
|
function cloneRecord(value) {
|
|
20
8
|
return structuredClone(value);
|
|
21
9
|
}
|
|
@@ -86,6 +74,68 @@ function buildCheckpointId(checkpoint) {
|
|
|
86
74
|
);
|
|
87
75
|
return `${safeTimestamp}-${paddedEventCount}-${checkpoint.reason}`;
|
|
88
76
|
}
|
|
77
|
+
function toGenericRunRecord(record) {
|
|
78
|
+
return {
|
|
79
|
+
sessionId: record.sessionId,
|
|
80
|
+
status: record.status,
|
|
81
|
+
startedAt: record.startedAt,
|
|
82
|
+
updatedAt: record.updatedAt,
|
|
83
|
+
completedAt: record.completedAt,
|
|
84
|
+
checkpointCount: record.checkpointCount,
|
|
85
|
+
lastCheckpointReason: record.lastCheckpointReason,
|
|
86
|
+
snapshot: {
|
|
87
|
+
sessionId: record.snapshot.sessionId,
|
|
88
|
+
response: record.snapshot.response,
|
|
89
|
+
usage: { ...record.snapshot.usage },
|
|
90
|
+
toolCalls: record.snapshot.toolCalls.map((tc) => ({ ...tc })),
|
|
91
|
+
eventCount: record.snapshot.eventCount,
|
|
92
|
+
activeStep: record.snapshot.activeStep,
|
|
93
|
+
error: record.snapshot.error,
|
|
94
|
+
startedAt: record.snapshot.startedAt,
|
|
95
|
+
updatedAt: record.snapshot.updatedAt
|
|
96
|
+
},
|
|
97
|
+
result: record.result ? {
|
|
98
|
+
response: record.result.response,
|
|
99
|
+
sessionId: record.result.sessionId,
|
|
100
|
+
usage: { ...record.result.usage },
|
|
101
|
+
toolCalls: record.result.toolCalls.map((tc) => ({ ...tc }))
|
|
102
|
+
} : void 0,
|
|
103
|
+
error: record.error ? { ...record.error } : void 0
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
function toGenericCheckpointRecord(record) {
|
|
107
|
+
return {
|
|
108
|
+
id: record.id,
|
|
109
|
+
sessionId: record.sessionId,
|
|
110
|
+
reason: record.reason,
|
|
111
|
+
snapshot: {
|
|
112
|
+
sessionId: record.snapshot.sessionId,
|
|
113
|
+
response: record.snapshot.response,
|
|
114
|
+
usage: { ...record.snapshot.usage },
|
|
115
|
+
toolCalls: record.snapshot.toolCalls.map((tc) => ({ ...tc })),
|
|
116
|
+
eventCount: record.snapshot.eventCount,
|
|
117
|
+
activeStep: record.snapshot.activeStep,
|
|
118
|
+
error: record.snapshot.error,
|
|
119
|
+
startedAt: record.snapshot.startedAt,
|
|
120
|
+
updatedAt: record.snapshot.updatedAt
|
|
121
|
+
},
|
|
122
|
+
createdAt: record.createdAt
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
// src/execution/store.ts
|
|
127
|
+
var DEFAULT_KEY_PREFIX = "agent-runtime:execution:";
|
|
128
|
+
var STORED_EXECUTION_KIND = "@cuylabs/agent-runtime-dapr/execution";
|
|
129
|
+
var STORED_EXECUTION_CHECKPOINT_KIND = "@cuylabs/agent-runtime-dapr/execution-checkpoint";
|
|
130
|
+
var STORED_EXECUTION_VERSION = 1;
|
|
131
|
+
var DEFAULT_INDEX_UPDATE_RETRIES = 4;
|
|
132
|
+
function ensureNonEmpty(input, label) {
|
|
133
|
+
const trimmed = input.trim();
|
|
134
|
+
if (!trimmed) {
|
|
135
|
+
throw new Error(`${label} must not be empty`);
|
|
136
|
+
}
|
|
137
|
+
return trimmed;
|
|
138
|
+
}
|
|
89
139
|
var DaprExecutionStore = class {
|
|
90
140
|
client;
|
|
91
141
|
keyPrefix;
|
|
@@ -556,54 +606,6 @@ var DaprExecutionStore = class {
|
|
|
556
606
|
return void 0;
|
|
557
607
|
}
|
|
558
608
|
};
|
|
559
|
-
function toGenericRunRecord(record) {
|
|
560
|
-
return {
|
|
561
|
-
sessionId: record.sessionId,
|
|
562
|
-
status: record.status,
|
|
563
|
-
startedAt: record.startedAt,
|
|
564
|
-
updatedAt: record.updatedAt,
|
|
565
|
-
completedAt: record.completedAt,
|
|
566
|
-
checkpointCount: record.checkpointCount,
|
|
567
|
-
lastCheckpointReason: record.lastCheckpointReason,
|
|
568
|
-
snapshot: {
|
|
569
|
-
sessionId: record.snapshot.sessionId,
|
|
570
|
-
response: record.snapshot.response,
|
|
571
|
-
usage: { ...record.snapshot.usage },
|
|
572
|
-
toolCalls: record.snapshot.toolCalls.map((tc) => ({ ...tc })),
|
|
573
|
-
eventCount: record.snapshot.eventCount,
|
|
574
|
-
activeStep: record.snapshot.activeStep,
|
|
575
|
-
error: record.snapshot.error,
|
|
576
|
-
startedAt: record.snapshot.startedAt,
|
|
577
|
-
updatedAt: record.snapshot.updatedAt
|
|
578
|
-
},
|
|
579
|
-
result: record.result ? {
|
|
580
|
-
response: record.result.response,
|
|
581
|
-
sessionId: record.result.sessionId,
|
|
582
|
-
usage: { ...record.result.usage },
|
|
583
|
-
toolCalls: record.result.toolCalls.map((tc) => ({ ...tc }))
|
|
584
|
-
} : void 0,
|
|
585
|
-
error: record.error ? { ...record.error } : void 0
|
|
586
|
-
};
|
|
587
|
-
}
|
|
588
|
-
function toGenericCheckpointRecord(record) {
|
|
589
|
-
return {
|
|
590
|
-
id: record.id,
|
|
591
|
-
sessionId: record.sessionId,
|
|
592
|
-
reason: record.reason,
|
|
593
|
-
snapshot: {
|
|
594
|
-
sessionId: record.snapshot.sessionId,
|
|
595
|
-
response: record.snapshot.response,
|
|
596
|
-
usage: { ...record.snapshot.usage },
|
|
597
|
-
toolCalls: record.snapshot.toolCalls.map((tc) => ({ ...tc })),
|
|
598
|
-
eventCount: record.snapshot.eventCount,
|
|
599
|
-
activeStep: record.snapshot.activeStep,
|
|
600
|
-
error: record.snapshot.error,
|
|
601
|
-
startedAt: record.snapshot.startedAt,
|
|
602
|
-
updatedAt: record.snapshot.updatedAt
|
|
603
|
-
},
|
|
604
|
-
createdAt: record.createdAt
|
|
605
|
-
};
|
|
606
|
-
}
|
|
607
609
|
|
|
608
610
|
// src/execution/observer.ts
|
|
609
611
|
var DaprExecutionObserver = class {
|