stitchkit 0.57.0 → 0.59.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/compaction.d.ts +3 -0
- package/dist/agent-runtime/compaction.d.ts.map +1 -1
- package/dist/agent-runtime/events.d.ts +40 -0
- package/dist/agent-runtime/events.d.ts.map +1 -1
- package/dist/agent-runtime/history.d.ts +13 -0
- package/dist/agent-runtime/history.d.ts.map +1 -1
- package/dist/agent-runtime/managed-tools.d.ts +1 -0
- package/dist/agent-runtime/managed-tools.d.ts.map +1 -1
- package/dist/agent-runtime/models.d.ts +39 -3
- package/dist/agent-runtime/models.d.ts.map +1 -1
- package/dist/agent-runtime/observability.d.ts +3 -0
- package/dist/agent-runtime/observability.d.ts.map +1 -1
- package/dist/agent-runtime/prompt.d.ts +21 -0
- package/dist/agent-runtime/prompt.d.ts.map +1 -1
- package/dist/agent-runtime/runtime.d.ts +9 -1
- package/dist/agent-runtime/runtime.d.ts.map +1 -1
- package/dist/agent-runtime/schemas.d.ts +2 -0
- package/dist/agent-runtime/schemas.d.ts.map +1 -1
- package/dist/agent-runtime/store-driver.d.ts +202 -24
- package/dist/agent-runtime/store-driver.d.ts.map +1 -1
- package/dist/agent-runtime/store.d.ts +229 -0
- package/dist/agent-runtime/store.d.ts.map +1 -1
- package/dist/agent-runtime/testing.d.ts +10 -1
- package/dist/agent-runtime/testing.d.ts.map +1 -1
- package/dist/agent-runtime.d.ts +5 -5
- package/dist/agent-runtime.d.ts.map +1 -1
- package/dist/agent-runtime.js +629 -200
- package/dist/{index-1f4fcj0b.js → index-vtjgx3vv.js} +1 -0
- package/dist/testing/agent-store-conformance.d.ts.map +1 -1
- package/dist/testing.d.ts +1 -0
- package/dist/testing.d.ts.map +1 -1
- package/dist/testing.js +198 -4
- package/llms-full.txt +156 -36
- package/package.json +1 -1
|
@@ -121,6 +121,7 @@ var AgentRunSchema = z.object({
|
|
|
121
121
|
state: AgentRunStateSchema,
|
|
122
122
|
revision: AgentRecordVersionSchema,
|
|
123
123
|
ownerId: z.string().min(1).optional(),
|
|
124
|
+
fencingToken: AgentRecordVersionSchema.optional(),
|
|
124
125
|
terminalReason: AgentTerminalReasonSchema.optional(),
|
|
125
126
|
terminalPolicyName: z.string().min(1).optional(),
|
|
126
127
|
createdAt: AgentTimestampSchema,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-store-conformance.d.ts","sourceRoot":"","sources":["../../src/testing/agent-store-conformance.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAEhE,MAAM,WAAW,2BAA2B;IAC1C,WAAW,IAAI,iBAAiB,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;CAC/D;AAwCD,gFAAgF;AAChF,wBAAsB,wBAAwB,CAC5C,MAAM,EAAE,2BAA2B,GAClC,OAAO,CAAC,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"agent-store-conformance.d.ts","sourceRoot":"","sources":["../../src/testing/agent-store-conformance.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAEhE,MAAM,WAAW,2BAA2B;IAC1C,WAAW,IAAI,iBAAiB,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;CAC/D;AAwCD,gFAAgF;AAChF,wBAAsB,wBAAwB,CAC5C,MAAM,EAAE,2BAA2B,GAClC,OAAO,CAAC,IAAI,CAAC,CAmRf"}
|
package/dist/testing.d.ts
CHANGED
|
@@ -31,6 +31,7 @@ export declare function createHandlerTestClient<T extends Record<string, Endpoin
|
|
|
31
31
|
export declare function createHandlerTestClients<T extends Record<string, ContractDef<Record<string, EndpointDef>, string>>, TServer = unknown, const K extends string = never>(config: HandlerTestClientsConfig<T, TServer, K>): {
|
|
32
32
|
[P in keyof T]: ScopedHttpClient<T[P]['endpoints'], ScopedKeys<K>>;
|
|
33
33
|
};
|
|
34
|
+
export { type AgentRaceBarrier, type AgentRaceDriver, type AgentRaceTrace, type AgentRaceTraceEntry, createAgentRaceBarrier, createAgentRaceDriver, createAgentRaceTrace, } from './agent-runtime/testing';
|
|
34
35
|
export { type AgentStoreConformanceConfig, runAgentStoreConformance, } from './testing/agent-store-conformance';
|
|
35
36
|
export { assertSurfaceDiscovery, type ConformanceTransport, type CreateRealtimeProbeDriverConfig, createRealtimeProbeDriver, type DefineRealtimeProbeConfig, defineRealtimeProbe, type RealtimeDisconnectObservation, RealtimeDisconnectObservationSchema, type RealtimeProbeAdapter, type RealtimeProbeFixture, type RealtimeProbeScenario, type RealtimeRejectionObservation, RealtimeRejectionObservationSchema, type RunSurfaceProbesConfig, runSurfaceProbes, type SurfaceDiscoveryObservation, type SurfaceProbe, type SurfaceProbeDriver, type SurfaceRealtimeDiscoveryObservation, type SurfaceToolDiscoveryObservation, type TransportObservation, TransportObservationSchema, } from './testing/surface-conformance';
|
|
36
37
|
export { assertSurfaceManifestSnapshot, buildSurfaceManifest, type IncompatibleSchemaPolicy, type McpSchemaValidationConfig, type SurfaceAgentProjection, type SurfaceManifest, type SurfaceManifestConfig, type SurfaceManifestExtension, SurfaceManifestExtensionSchema, type SurfaceManifestOperation, SurfaceManifestOperationSchema, type SurfaceManifestRealtimeEvent, SurfaceManifestRealtimeEventSchema, SurfaceManifestSchema, type SurfaceManifestTool, SurfaceManifestToolSchema, type SurfaceManifestToolSurface, SurfaceManifestToolSurfaceSchema, type SurfaceMcpPreparation, SurfaceRealtimeSchemaPairSchema, type SurfaceRuntimeToolDefinition, SurfaceSchemaDigestsSchema, type SurfaceToolDefinition, type SurfaceToolExtension, serializeSurfaceValue, } from './testing/surface-manifest';
|
package/dist/testing.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"testing.d.ts","sourceRoot":"","sources":["../src/testing.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACL,KAAK,YAAY,EAE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EAC/B,KAAK,4BAA4B,EACjC,0BAA0B,EAC1B,KAAK,qBAAqB,EAC1B,KAAK,oBAAoB,EACzB,qBAAqB,GACtB,MAAM,4BAA4B,CAAC"}
|
package/dist/testing.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
AgentMessageSchema,
|
|
3
3
|
AgentRunSchema
|
|
4
|
-
} from "./index-
|
|
4
|
+
} from "./index-vtjgx3vv.js";
|
|
5
5
|
import {
|
|
6
6
|
RealtimeRequestDisconnectedError,
|
|
7
7
|
RealtimeRequestInvalidAcknowledgementError,
|
|
@@ -27,6 +27,81 @@ import {
|
|
|
27
27
|
} from "./index-smpbdg6k.js";
|
|
28
28
|
import"./index-1bx83sw4.js";
|
|
29
29
|
|
|
30
|
+
// src/agent-runtime/testing.ts
|
|
31
|
+
function createAgentRaceBarrier(timeoutMs = 5000) {
|
|
32
|
+
if (!Number.isSafeInteger(timeoutMs) || timeoutMs < 1) {
|
|
33
|
+
throw new TypeError("Agent race barrier timeoutMs must be a positive safe integer");
|
|
34
|
+
}
|
|
35
|
+
const reached = Promise.withResolvers();
|
|
36
|
+
const released = Promise.withResolvers();
|
|
37
|
+
let announced = false;
|
|
38
|
+
return {
|
|
39
|
+
reached: reached.promise,
|
|
40
|
+
async wait() {
|
|
41
|
+
if (!announced) {
|
|
42
|
+
announced = true;
|
|
43
|
+
reached.resolve();
|
|
44
|
+
}
|
|
45
|
+
let timer;
|
|
46
|
+
try {
|
|
47
|
+
await Promise.race([
|
|
48
|
+
released.promise,
|
|
49
|
+
new Promise((_resolve, reject) => {
|
|
50
|
+
timer = setTimeout(() => reject(new Error(`Agent race barrier exceeded ${timeoutMs}ms teardown bound`)), timeoutMs);
|
|
51
|
+
})
|
|
52
|
+
]);
|
|
53
|
+
} finally {
|
|
54
|
+
if (timer !== undefined)
|
|
55
|
+
clearTimeout(timer);
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
release: released.resolve
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
function createAgentRaceTrace() {
|
|
62
|
+
const recorded = [];
|
|
63
|
+
return {
|
|
64
|
+
record(name) {
|
|
65
|
+
const entry = { name, sequence: recorded.length };
|
|
66
|
+
recorded.push(entry);
|
|
67
|
+
return entry;
|
|
68
|
+
},
|
|
69
|
+
entries: () => recorded.map((entry) => ({ ...entry })),
|
|
70
|
+
assertBefore(first, second) {
|
|
71
|
+
const firstEntry = recorded.find((entry) => entry.name === first);
|
|
72
|
+
const secondEntry = recorded.find((entry) => entry.name === second);
|
|
73
|
+
if (!firstEntry || !secondEntry || firstEntry.sequence >= secondEntry.sequence) {
|
|
74
|
+
throw new Error(`Expected ${first} before ${second}`);
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
assertSequence(names) {
|
|
78
|
+
const actual = recorded.map((entry) => entry.name);
|
|
79
|
+
if (actual.length !== names.length || actual.some((name, index) => name !== names[index])) {
|
|
80
|
+
throw new Error(`Expected trace ${names.join(" -> ")}, received ${actual.join(" -> ")}`);
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
count: (name) => recorded.filter((entry) => entry.name === name).length
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
function createAgentRaceDriver(timeoutMs = 5000) {
|
|
87
|
+
const trace = createAgentRaceTrace();
|
|
88
|
+
const barriers = new Map;
|
|
89
|
+
return {
|
|
90
|
+
trace,
|
|
91
|
+
barrier(name) {
|
|
92
|
+
const existing = barriers.get(name);
|
|
93
|
+
if (existing)
|
|
94
|
+
return existing;
|
|
95
|
+
const created = createAgentRaceBarrier(timeoutMs);
|
|
96
|
+
barriers.set(name, created);
|
|
97
|
+
return created;
|
|
98
|
+
},
|
|
99
|
+
releaseAll() {
|
|
100
|
+
for (const barrier of barriers.values())
|
|
101
|
+
barrier.release();
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
}
|
|
30
105
|
// src/testing/agent-store-conformance.ts
|
|
31
106
|
function userMessage(conversationId, id) {
|
|
32
107
|
return AgentMessageSchema.parse({
|
|
@@ -175,15 +250,131 @@ async function runAgentStoreConformance(config) {
|
|
|
175
250
|
})
|
|
176
251
|
});
|
|
177
252
|
requireOutcome(stale, "conflict");
|
|
178
|
-
|
|
253
|
+
await store.recoverRun({
|
|
179
254
|
conversationId,
|
|
180
255
|
runId: running.id,
|
|
181
256
|
expectedRevision: running.revision,
|
|
257
|
+
action: "requeue"
|
|
258
|
+
}).then(() => {
|
|
259
|
+
throw new Error("Acquired recovery replayed without explicit safety evidence");
|
|
260
|
+
}, (error) => {
|
|
261
|
+
if (!(error instanceof TypeError))
|
|
262
|
+
throw error;
|
|
263
|
+
});
|
|
264
|
+
const checkpoint = await store.checkpointRunAssistant({
|
|
265
|
+
conversationId,
|
|
266
|
+
runId: running.id,
|
|
267
|
+
expectedRevision: running.revision,
|
|
268
|
+
ownerId: "conformance-owner",
|
|
269
|
+
assistant: AgentMessageSchema.parse({
|
|
270
|
+
schemaVersion: 1,
|
|
271
|
+
id: running.assistantMessageId,
|
|
272
|
+
conversationId,
|
|
273
|
+
runId: running.id,
|
|
274
|
+
role: "assistant",
|
|
275
|
+
status: "streaming",
|
|
276
|
+
parts: [{ type: "text", text: "checkpoint" }],
|
|
277
|
+
createdAt: "2026-08-22T00:00:00.000Z",
|
|
278
|
+
updatedAt: "2026-08-22T00:00:01.000Z"
|
|
279
|
+
})
|
|
280
|
+
});
|
|
281
|
+
requireOutcome(checkpoint, "applied");
|
|
282
|
+
const checkpointedRun = checkpoint.snapshot.runs.find((run) => run.id === running.id);
|
|
283
|
+
if (!checkpointedRun)
|
|
284
|
+
throw new Error("Checkpointed run disappeared");
|
|
285
|
+
const terminalAssistant = AgentMessageSchema.parse({
|
|
286
|
+
schemaVersion: 1,
|
|
287
|
+
id: running.assistantMessageId,
|
|
288
|
+
conversationId,
|
|
289
|
+
runId: running.id,
|
|
290
|
+
role: "assistant",
|
|
291
|
+
status: "completed",
|
|
292
|
+
parts: [{ type: "text", text: "done" }],
|
|
293
|
+
createdAt: "2026-08-22T00:00:00.000Z",
|
|
294
|
+
updatedAt: "2026-08-22T00:00:02.000Z"
|
|
295
|
+
});
|
|
296
|
+
const terminalResults = await Promise.all([
|
|
297
|
+
store.commitRunTerminal({
|
|
298
|
+
conversationId,
|
|
299
|
+
runId: running.id,
|
|
300
|
+
expectedRevision: checkpointedRun.revision,
|
|
301
|
+
ownerId: "conformance-owner",
|
|
302
|
+
assistant: terminalAssistant,
|
|
303
|
+
reason: "success"
|
|
304
|
+
}),
|
|
305
|
+
store.commitRunTerminal({
|
|
306
|
+
conversationId,
|
|
307
|
+
runId: running.id,
|
|
308
|
+
expectedRevision: checkpointedRun.revision,
|
|
309
|
+
ownerId: "conformance-owner",
|
|
310
|
+
assistant: terminalAssistant,
|
|
311
|
+
reason: "success"
|
|
312
|
+
})
|
|
313
|
+
]);
|
|
314
|
+
const terminalOutcomes = terminalResults.map((result) => result.outcome).sort();
|
|
315
|
+
if (terminalOutcomes.join(",") !== "applied,conflict") {
|
|
316
|
+
throw new Error(`Terminal race was not linearized: ${terminalOutcomes.join(",")}`);
|
|
317
|
+
}
|
|
318
|
+
const terminalApplied = terminalResults.find((result) => result.outcome === "applied");
|
|
319
|
+
if (terminalApplied?.outcome !== "applied") {
|
|
320
|
+
throw new Error("Terminal race produced no applied result");
|
|
321
|
+
}
|
|
322
|
+
const compactedTerminal = await store.replaceCompactedRange({
|
|
323
|
+
conversationId,
|
|
324
|
+
expectedVersion: terminalApplied.snapshot.version,
|
|
325
|
+
replacedMessageIds: ["summary-1", terminalAssistant.id],
|
|
326
|
+
summary: AgentMessageSchema.parse({
|
|
327
|
+
schemaVersion: 1,
|
|
328
|
+
id: "summary-2",
|
|
329
|
+
conversationId,
|
|
330
|
+
role: "summary",
|
|
331
|
+
status: "committed",
|
|
332
|
+
parts: [{ type: "text", text: "terminal history" }],
|
|
333
|
+
createdAt: "2026-08-22T00:00:03.000Z",
|
|
334
|
+
updatedAt: "2026-08-22T00:00:03.000Z"
|
|
335
|
+
})
|
|
336
|
+
});
|
|
337
|
+
requireOutcome(compactedTerminal, "applied");
|
|
338
|
+
const duplicateTerminal = await store.acceptInputAndAssignRun({
|
|
339
|
+
idempotencyKey: "request-1",
|
|
340
|
+
input: userMessage(conversationId, "discarded-terminal-input"),
|
|
341
|
+
run: queuedRun(conversationId, "discarded-terminal-input", "discarded-terminal-run")
|
|
342
|
+
});
|
|
343
|
+
requireOutcome(duplicateTerminal, "duplicate");
|
|
344
|
+
if (duplicateTerminal.run.terminalReason !== "success" || JSON.stringify(duplicateTerminal.assistant) !== JSON.stringify(terminalAssistant)) {
|
|
345
|
+
throw new Error("Compaction discarded the canonical duplicate terminal result");
|
|
346
|
+
}
|
|
347
|
+
const recoveryConversationId = `${conversationId}-recovery`;
|
|
348
|
+
const recoveryInput = userMessage(recoveryConversationId, "recovery-input");
|
|
349
|
+
const recoveryRun = queuedRun(recoveryConversationId, recoveryInput.id, "recovery-run");
|
|
350
|
+
const recoveryAccepted = await store.acceptInputAndAssignRun({
|
|
351
|
+
idempotencyKey: "recovery-request",
|
|
352
|
+
input: recoveryInput,
|
|
353
|
+
run: recoveryRun
|
|
354
|
+
});
|
|
355
|
+
requireOutcome(recoveryAccepted, "applied");
|
|
356
|
+
const recoveryAssigned = recoveryAccepted.snapshot.runs.find((run) => run.id === recoveryRun.id);
|
|
357
|
+
if (!recoveryAssigned)
|
|
358
|
+
throw new Error("Recovery run disappeared after admission");
|
|
359
|
+
const recoveryAcquired = await store.acquireRun({
|
|
360
|
+
conversationId: recoveryConversationId,
|
|
361
|
+
runId: recoveryAssigned.id,
|
|
362
|
+
expectedRevision: recoveryAssigned.revision,
|
|
363
|
+
ownerId: "abandoned-owner"
|
|
364
|
+
});
|
|
365
|
+
requireOutcome(recoveryAcquired, "applied");
|
|
366
|
+
const abandonedRun = recoveryAcquired.snapshot.runs.find((run) => run.id === recoveryRun.id);
|
|
367
|
+
if (!abandonedRun)
|
|
368
|
+
throw new Error("Recovery run disappeared after acquisition");
|
|
369
|
+
const abandoned = await store.recoverRun({
|
|
370
|
+
conversationId: recoveryConversationId,
|
|
371
|
+
runId: abandonedRun.id,
|
|
372
|
+
expectedRevision: abandonedRun.revision,
|
|
182
373
|
action: "abandon"
|
|
183
374
|
});
|
|
184
375
|
requireOutcome(abandoned, "applied");
|
|
185
|
-
const terminalRun = abandoned.snapshot.runs.find((run) => run.id ===
|
|
186
|
-
const terminalMessage = abandoned.snapshot.messages.find((message) => message.id ===
|
|
376
|
+
const terminalRun = abandoned.snapshot.runs.find((run) => run.id === abandonedRun.id);
|
|
377
|
+
const terminalMessage = abandoned.snapshot.messages.find((message) => message.id === abandonedRun.assistantMessageId);
|
|
187
378
|
if (terminalRun?.state !== "abandoned" || terminalMessage?.status !== "failed") {
|
|
188
379
|
throw new Error("Abandon recovery did not atomically terminalize its assistant record");
|
|
189
380
|
}
|
|
@@ -905,6 +1096,9 @@ export {
|
|
|
905
1096
|
assertSurfaceDiscovery,
|
|
906
1097
|
assertSurfaceManifestSnapshot,
|
|
907
1098
|
buildSurfaceManifest,
|
|
1099
|
+
createAgentRaceBarrier,
|
|
1100
|
+
createAgentRaceDriver,
|
|
1101
|
+
createAgentRaceTrace,
|
|
908
1102
|
createHandlerTestClient,
|
|
909
1103
|
createHandlerTestClients,
|
|
910
1104
|
createRealtimeProbeDriver,
|
package/llms-full.txt
CHANGED
|
@@ -3427,7 +3427,10 @@ const prompt = composeAgentPrompt([
|
|
|
3427
3427
|
const runtime = createAgentRuntime({
|
|
3428
3428
|
protocol,
|
|
3429
3429
|
store: createMemoryAgentRuntimeStore(),
|
|
3430
|
-
models: {
|
|
3430
|
+
models: {
|
|
3431
|
+
preflight: () => models.preflight('fast', ['tools']),
|
|
3432
|
+
resolve: () => models.resolve('fast', ['tools']),
|
|
3433
|
+
},
|
|
3431
3434
|
prompt: ({ context, signal, model }) =>
|
|
3432
3435
|
prompt({
|
|
3433
3436
|
context,
|
|
@@ -3497,29 +3500,40 @@ provide one database transaction driver:
|
|
|
3497
3500
|
```ts
|
|
3498
3501
|
const store = createAgentRuntimeStore({
|
|
3499
3502
|
transaction: work => db.transaction(tx => work(tx)),
|
|
3500
|
-
|
|
3501
|
-
load: (tx, conversationId) =>
|
|
3502
|
-
compareAndSwap: (tx, operation) =>
|
|
3503
|
+
head: {
|
|
3504
|
+
load: (tx, conversationId) => loadRuntimeHead(tx, conversationId),
|
|
3505
|
+
compareAndSwap: (tx, operation) => casRuntimeHead(tx, operation),
|
|
3506
|
+
},
|
|
3507
|
+
runs: {
|
|
3508
|
+
load: (tx, identity) => loadRun(tx, identity),
|
|
3509
|
+
loadByAssistantMessageId: (tx, identity) => loadRunByAssistant(tx, identity),
|
|
3510
|
+
loadMany: (tx, identities) => loadRuns(tx, identities),
|
|
3511
|
+
listActive: (tx, conversationId) => listActiveRuns(tx, conversationId),
|
|
3512
|
+
save: (tx, record) => saveRun(tx, record),
|
|
3513
|
+
},
|
|
3514
|
+
admissions: {
|
|
3515
|
+
load: (tx, identity) => loadAdmission(tx, identity),
|
|
3516
|
+
loadByInputMessageId: (tx, identity) => loadAdmissionByInput(tx, identity),
|
|
3517
|
+
create: (tx, receipt) => createAdmission(tx, receipt),
|
|
3503
3518
|
},
|
|
3504
3519
|
history: {
|
|
3505
3520
|
load: (tx, conversationId) => loadCanonicalMessages(tx, conversationId),
|
|
3506
|
-
loadById: (tx, identity) => loadActiveOrArchivedMessage(tx, identity),
|
|
3507
3521
|
apply: (tx, mutation) => applyCanonicalHistoryMutation(tx, mutation),
|
|
3508
3522
|
},
|
|
3509
3523
|
scanRecoverable: page => scanRecoverableRuns(page),
|
|
3510
3524
|
})
|
|
3511
3525
|
```
|
|
3512
3526
|
|
|
3513
|
-
The same opaque `tx` reaches
|
|
3527
|
+
The same opaque `tx` reaches head, run, admission and history callbacks. The adapter maps rows
|
|
3514
3528
|
and supplies atomicity; Stitchkit owns transition validation and revision
|
|
3515
3529
|
arithmetic. The executable reference is
|
|
3516
3530
|
[`examples/agent-store-prisma/adapter.ts`](../../examples/agent-store-prisma/adapter.ts).
|
|
3517
3531
|
`compareAndSwap` returns either `{ outcome: 'applied' }` or
|
|
3518
|
-
`{ outcome: 'conflict', actualVersion }
|
|
3519
|
-
|
|
3520
|
-
|
|
3521
|
-
|
|
3522
|
-
|
|
3532
|
+
`{ outcome: 'conflict', actualVersion }`. The head contains only schema version,
|
|
3533
|
+
conversation identity and monotonic version. Runs and admission receipts are normalized records;
|
|
3534
|
+
recovery queries active run states directly instead of maintaining a second projection.
|
|
3535
|
+
An admission receipt retains its canonical input, and a terminal run retains its canonical
|
|
3536
|
+
assistant, so physical product-history compaction cannot break idempotent retries.
|
|
3523
3537
|
|
|
3524
3538
|
## Durable order
|
|
3525
3539
|
|
|
@@ -3577,6 +3591,10 @@ Every mutation carries an expected run revision or snapshot version. Input
|
|
|
3577
3591
|
assignment additionally carries an idempotency identity. A conflict is a
|
|
3578
3592
|
control outcome; stale data is never silently overwritten.
|
|
3579
3593
|
|
|
3594
|
+
Acquisition increments an optional monotonic `fencingToken`. The managed runtime carries it through
|
|
3595
|
+
checkpoint/terminal CAS and tool context, so a distributed adapter can reject an old owner even if
|
|
3596
|
+
an owner label is reused. Lease expiry and renewal remain application-owned.
|
|
3597
|
+
|
|
3580
3598
|
On startup, `runtime.recover({ resolveContext })` consumes bounded lightweight
|
|
3581
3599
|
pages. Its safe default resumes queued runs and reports acquired or
|
|
3582
3600
|
`interrupt_requested` runs as skipped. A policy may requeue acquired work only
|
|
@@ -3613,6 +3631,12 @@ These are post-commit notifications, not a transactional outbox: a process can
|
|
|
3613
3631
|
crash between the database commit and `publish`. Reconnect should load canonical
|
|
3614
3632
|
state. Exactly-once external delivery remains an application-owned outbox.
|
|
3615
3633
|
|
|
3634
|
+
Durable event IDs are derived from run, event type and snapshot version. Use
|
|
3635
|
+
`advanceAgentRuntimeEventCursor` to classify accepted, duplicate and gap delivery; a gap triggers a
|
|
3636
|
+
snapshot reload. `createAgentRuntimeEventSink` adds a bounded failure-isolated lifecycle and typed
|
|
3637
|
+
projection/redaction hook. `onPublishError` records direct publisher failures without changing the
|
|
3638
|
+
already committed run.
|
|
3639
|
+
|
|
3616
3640
|
A named custom stop condition terminalizes with `policy_stop`; its `policyName`
|
|
3617
3641
|
is persisted on the run and included in the terminal event/result. `max-steps`
|
|
3618
3642
|
is the reserved built-in policy name. `loop.prepareStep` is the controlled AI
|
|
@@ -3643,6 +3667,14 @@ effect must be replay-safe.
|
|
|
3643
3667
|
`projectAgentHistory` converts canonical engine records into provider-valid AI
|
|
3644
3668
|
SDK messages and pairs tool calls/results. Provider-required metadata is kept
|
|
3645
3669
|
in a versioned opaque envelope and omitted from product delivery by default.
|
|
3670
|
+
`projectAgentHistoryDetailed` additionally returns one inspectable decision per canonical record;
|
|
3671
|
+
leading assistant records, crash drafts and unmatched tool chronology are never silently passed to
|
|
3672
|
+
the provider.
|
|
3673
|
+
|
|
3674
|
+
`selectAgentHistory` is the non-destructive context-window selector. It removes only whole oldest
|
|
3675
|
+
complete turns, protects system/summary, incomplete and configured recent turns, and reports every
|
|
3676
|
+
keep/remove reason with measured/estimated/unavailable token provenance. An oversized protected turn
|
|
3677
|
+
returns `oversized`; unavailable accounting returns `unavailable` without invented arithmetic.
|
|
3646
3678
|
|
|
3647
3679
|
`ComposedAgentPrompt.instructions` accepts the AI SDK `Instructions` contract.
|
|
3648
3680
|
Use `adaptInstructions` when a provider needs metadata on the system message:
|
|
@@ -3679,22 +3711,32 @@ provider system message. The consumer supplies the structured summary schema
|
|
|
3679
3711
|
and prompt. Pass `previousSummary` for a direct call, or configure
|
|
3680
3712
|
`readPreviousSummary` for runtime-managed compaction, to merge and atomically
|
|
3681
3713
|
replace a leading summary on the next compaction.
|
|
3714
|
+
Set `maxAttempts` to allow bounded conflict recovery. Every retry reloads the snapshot, reselects the
|
|
3715
|
+
eligible range and recomputes the summary; the stale summary is never retried.
|
|
3682
3716
|
|
|
3683
3717
|
## Observability
|
|
3684
3718
|
|
|
3685
3719
|
`createAgentObservability` emits a separate operator-only `AgentRunEvent`. It
|
|
3686
3720
|
reuses the same bounded sink lifecycle as request/tool observability without
|
|
3687
3721
|
sending new event kinds to existing request sinks. Product events omit provider
|
|
3688
|
-
causes
|
|
3689
|
-
|
|
3722
|
+
causes. Operator `internalCause` is also redacted by default; an operator-only sink must explicitly
|
|
3723
|
+
set `includeInternalCause` and own its retention policy.
|
|
3690
3724
|
|
|
3691
3725
|
Usage values carry `provider-reported`, `computed`, `estimated` or
|
|
3692
3726
|
`unavailable` provenance. Cost additionally carries an ISO currency code;
|
|
3693
3727
|
OpenRouter-reported cost is normalized as USD. Missing values remain absent,
|
|
3694
3728
|
never zero-filled.
|
|
3695
3729
|
|
|
3696
|
-
|
|
3697
|
-
|
|
3730
|
+
The sink deduplicates stable event IDs by default. Cross-crash exactly-once still requires a durable
|
|
3731
|
+
outbox.
|
|
3732
|
+
|
|
3733
|
+
## Deterministic race and adapter proof
|
|
3734
|
+
|
|
3735
|
+
`stitchkit/testing` exports `createAgentRaceBarrier`, `createAgentRaceDriver` and
|
|
3736
|
+
`createAgentRaceTrace`. Barriers have bounded teardown, traces assert exact partial order, and the
|
|
3737
|
+
helpers are exercised from packed Bun and Node consumers. `runAgentStoreConformance` runs duplicate,
|
|
3738
|
+
coalescing, collision, stale checkpoint, replay safety, terminal race, compaction and recovery
|
|
3739
|
+
invariants against any fresh durable adapter.
|
|
3698
3740
|
|
|
3699
3741
|
|
|
3700
3742
|
==============================================================================
|
|
@@ -6545,33 +6587,43 @@ current one *up to* your target, and apply each snippet.
|
|
|
6545
6587
|
runtime): bootstrap the server, one HTTP request, and any feature you rely on
|
|
6546
6588
|
(Socket.IO connect, an MCP tool call, a multipart upload, …).
|
|
6547
6589
|
|
|
6548
|
-
## Unreleased migration:
|
|
6590
|
+
## Unreleased migration: normalized agent runtime persistence
|
|
6549
6591
|
|
|
6550
|
-
|
|
6551
|
-
|
|
6592
|
+
`AgentRuntimeStoreDriver` no longer reads and rewrites a lifetime `AgentStoredState` JSON
|
|
6593
|
+
aggregate. Migrate that row and its recoverable/archive projections once:
|
|
6594
|
+
|
|
6595
|
+
1. Copy `conversationId` and `version` into the bounded runtime head.
|
|
6596
|
+
2. Write every `AgentStoredState.runs[]` entry as one normalized run record.
|
|
6597
|
+
3. Write every `AgentStoredState.admissions[]` entry as one admission receipt and copy its
|
|
6598
|
+
canonical input into that receipt.
|
|
6599
|
+
4. For terminal runs, retain the canonical assistant on the run record before deleting any old
|
|
6600
|
+
history/archive rows.
|
|
6601
|
+
5. Replace the recoverable projection with an index over normalized run `state`.
|
|
6602
|
+
6. Cut the adapter over atomically; there is no compatibility driver or dual-write mode.
|
|
6552
6603
|
|
|
6553
6604
|
```ts
|
|
6554
6605
|
// before
|
|
6555
|
-
|
|
6606
|
+
createAgentRuntimeStore({
|
|
6607
|
+
state: { load, compareAndSwap },
|
|
6608
|
+
history: { load, loadById, apply },
|
|
6609
|
+
scanRecoverable,
|
|
6610
|
+
})
|
|
6556
6611
|
|
|
6557
6612
|
// after
|
|
6558
|
-
|
|
6613
|
+
createAgentRuntimeStore({
|
|
6614
|
+
head: { load, compareAndSwap },
|
|
6615
|
+
runs: { load, loadByAssistantMessageId, loadMany, listActive, save },
|
|
6616
|
+
admissions: { load, loadByInputMessageId, create },
|
|
6617
|
+
history: { load, apply },
|
|
6618
|
+
scanRecoverable,
|
|
6619
|
+
})
|
|
6559
6620
|
```
|
|
6560
6621
|
|
|
6561
|
-
|
|
6562
|
-
|
|
6563
|
-
|
|
6564
|
-
|
|
6565
|
-
|
|
6566
|
-
`AgentRuntimeEvent` also adds a post-commit `admission` variant. Add it to any
|
|
6567
|
-
exhaustive publisher switch. Its `assistant` is either the pending placeholder
|
|
6568
|
-
for a new assignment or the canonical persisted assistant for a duplicate:
|
|
6569
|
-
|
|
6570
|
-
```ts
|
|
6571
|
-
case 'admission':
|
|
6572
|
-
await persistProductProjection(event.input, event.run, event.assistant)
|
|
6573
|
-
break
|
|
6574
|
-
```
|
|
6622
|
+
`AgentRuntimeHeadSchema`, `AgentStoredRunSchema` and `AgentAdmissionReceiptSchema` replace
|
|
6623
|
+
`AgentStoredStateSchema` and `AgentAdmissionIdentitySchema`. Run
|
|
6624
|
+
`runAgentStoreConformance()` against the migrated adapter before switching production traffic.
|
|
6625
|
+
If an application implements `AgentRuntimeStore` directly, its duplicate result must also include
|
|
6626
|
+
the canonical `run` and the retained `assistant` for a terminal run.
|
|
6575
6627
|
|
|
6576
6628
|
## Released migration: 0.56.0
|
|
6577
6629
|
|
|
@@ -8013,8 +8065,10 @@ Server-only optional application runtime. See the
|
|
|
8013
8065
|
| `AgentMessageSchema` / `AgentRunSchema` / `AgentSnapshotSchema` | schema | versioned canonical engine records |
|
|
8014
8066
|
| `AgentRuntimeStore` | _type_ | aggregate CAS transaction boundary for message, run and compaction mutations |
|
|
8015
8067
|
| `createAgentRuntimeStore` | function | build the aggregate store from one coherent transaction driver; framework owns every state transition |
|
|
8016
|
-
| `AgentRuntimeStoreDriver` | _type_ | ORM-neutral
|
|
8017
|
-
| `
|
|
8068
|
+
| `AgentRuntimeStoreDriver` | _type_ | ORM-neutral transaction over a bounded head, normalized runs/admissions, product history and indexed run recovery |
|
|
8069
|
+
| `AgentRuntimeHeadSchema` | schema | constant-size conversation identity plus monotonic runtime version |
|
|
8070
|
+
| `AgentStoredRunSchema` | schema | canonical normalized run with an optional retained terminal assistant |
|
|
8071
|
+
| `AgentAdmissionReceiptSchema` | schema | durable idempotency receipt with canonical input and assigned run/assistant identities |
|
|
8018
8072
|
| `AgentHistoryMutationSchema` | schema | typed canonical message mutation applied inside the winning state transaction |
|
|
8019
8073
|
| `RecoverAgentRunSchema` | schema | explicit abandon/requeue recovery decision; acquired runs require replay-safe evidence |
|
|
8020
8074
|
| `createMemoryAgentRuntimeStore` | function | process-local reference adapter, not production durability |
|
|
@@ -8036,6 +8090,70 @@ Server-only optional application runtime. See the
|
|
|
8036
8090
|
| `AgentRuntimeEventSchema` | schema | transient stream lifecycle plus post-commit admission/checkpoint/run-state/terminal projections |
|
|
8037
8091
|
| `createAgentObservability` | function | separate agent-run sink over the shared bounded observability lifecycle |
|
|
8038
8092
|
|
|
8093
|
+
### Complete runtime inventory
|
|
8094
|
+
|
|
8095
|
+
The entrypoint deliberately exports the schemas beside their inferred types so persistence and
|
|
8096
|
+
transport adapters validate the same records. Runtime composition types are `AgentRuntime`,
|
|
8097
|
+
`AgentRuntimeConfig`, `AgentRuntimeInput`, `AgentRuntimeProtocolInput`, `AgentRuntimeRunContext`,
|
|
8098
|
+
`AgentRuntimeResult`, `AgentRuntimeInterruptInput`, `AgentRuntimeRecoveryInput`,
|
|
8099
|
+
`AgentRuntimeRecoveryDecision`, `AgentRuntimeRecoveryOutcome`, `AgentRuntimePublisher`,
|
|
8100
|
+
`AgentInputPolicy`, `AgentStopReason`, `AgentCoordinatedRun`, `AgentRunTicket`,
|
|
8101
|
+
`AgentSessionCoordinator`, `AgentCompactionContext`, `AgentCompactionResult` and
|
|
8102
|
+
`StructuredCompactionConfig`.
|
|
8103
|
+
|
|
8104
|
+
Canonical protocol exports are `AgentProtocol`, `AgentProtocolConfig`, `AgentRecordIdSchema`, `AgentRecordVersionSchema`,
|
|
8105
|
+
`AgentTimestampSchema`, `AgentJsonObjectSchema`, `AgentProviderEnvelopeSchema`,
|
|
8106
|
+
`AgentProviderEnvelope`, `AgentMessagePartSchema`, `AgentMessagePart`, `AgentTextPartSchema`,
|
|
8107
|
+
`AgentReasoningPartSchema`, `AgentFilePartSchema`, `AgentSourcePartSchema`,
|
|
8108
|
+
`AgentToolCallPartSchema`, `AgentToolResultPartSchema`, `AgentOpaquePartSchema`,
|
|
8109
|
+
`AgentControlPartSchema`, `AgentMessageRoleSchema`, `AgentMessageStatusSchema`, `AgentMessage`,
|
|
8110
|
+
`AgentAssistantPlaceholderSchema`, `AgentAssistantPlaceholder`, `AgentRunStateSchema`,
|
|
8111
|
+
`AgentTerminalReasonSchema`, `AgentTerminalReason`, `AgentRun`, `AgentSnapshot`,
|
|
8112
|
+
`AgentUsageValueSchema`, `AgentCostValueSchema`, `AgentUsageSchema`, `AgentUsage` and
|
|
8113
|
+
`AgentRunMetrics`.
|
|
8114
|
+
|
|
8115
|
+
Store command/result exports are `AcceptInputAndAssignRun`, `AcceptInputAndAssignRunSchema`,
|
|
8116
|
+
`AcquireAgentRun`, `AcquireAgentRunSchema`, `CheckpointRunAssistant`,
|
|
8117
|
+
`CheckpointRunAssistantSchema`, `CommitRunTerminal`, `CommitRunTerminalSchema`,
|
|
8118
|
+
`RequestRunInterrupt`, `RequestRunInterruptSchema`, `RecoverAgentRun`, `ReplaceCompactedRange`,
|
|
8119
|
+
`ReplaceCompactedRangeSchema`, `AgentStoreMutationResult`, `AgentStoreMutationResultSchema`,
|
|
8120
|
+
`AgentStoreAppliedSchema`, `AgentStoreConflictSchema`, `AgentStoreDuplicateSchema`,
|
|
8121
|
+
`AgentStoreNotFoundSchema`, `AgentAdmissionReceipt`, `AgentAdmissionReceiptSchema`,
|
|
8122
|
+
`AgentRuntimeHead`, `AgentStoredRun`, `AgentStoreCompareAndSwapResult`, `AgentHistoryMutation`,
|
|
8123
|
+
`AgentRecoverableDescriptor`, `AgentRecoverableDescriptorSchema`, `AgentRecoverablePage` and
|
|
8124
|
+
`AgentRecoverablePageSchema`.
|
|
8125
|
+
|
|
8126
|
+
History and context-budget exports are `projectAgentHistoryDetailed`,
|
|
8127
|
+
`AgentHistoryProjectionDecision`, `AgentHistoryProjectionResult`, `selectAgentHistory`,
|
|
8128
|
+
`SelectAgentHistoryOptions`, `AgentHistoryBudgetDecision`, `AgentHistoryBudgetResult`,
|
|
8129
|
+
`AgentPromptBudget`, `AgentPromptSection`, `AgentPromptSectionContext`, `AgentTokenCount`,
|
|
8130
|
+
`AgentTokenCountSchema`, `ComposeAgentPromptOptions` and `ComposedAgentPrompt`. Whole-turn history
|
|
8131
|
+
selection never splits a tool chronology and reports why every canonical record was retained or
|
|
8132
|
+
removed.
|
|
8133
|
+
|
|
8134
|
+
Model exports are `AgentLanguageModelProvider`, `AgentModelCapability`,
|
|
8135
|
+
`AgentModelCapabilitySchema`, `AgentModelDeclaration`, `AgentModelDescriptor`,
|
|
8136
|
+
`AgentModelDescriptorSchema`, `AgentModelRegistry`, `AgentModelRegistryConfig`,
|
|
8137
|
+
`AgentModelRegistrySnapshot`, `AgentModelRegistrySnapshotSchema`, `AgentModelSnapshotPolicy`,
|
|
8138
|
+
`AgentResolvedModel` and `validateAgentModelSnapshot`. Registry `preflight` validates availability,
|
|
8139
|
+
provider and required capabilities without constructing the model; runtime `models.preflight`
|
|
8140
|
+
runs before durable admission.
|
|
8141
|
+
|
|
8142
|
+
Delivery exports are `AgentAdmissionEventSchema`, `AgentCheckpointEventSchema`,
|
|
8143
|
+
`AgentRunStateEventSchema`, `AgentTerminalEventSchema`, `AgentTransientDeltaEventSchema`,
|
|
8144
|
+
`AgentReasoningStartEventSchema`, `AgentReasoningDeltaEventSchema`,
|
|
8145
|
+
`AgentReasoningEndEventSchema`, `AgentToolStatusEventSchema`, `AgentRuntimeEvent`,
|
|
8146
|
+
`AgentRuntimeEventCursor`, `AgentRuntimeEventCursorSchema`, `AgentRuntimeCursorAdvance`,
|
|
8147
|
+
`advanceAgentRuntimeEventCursor`, `agentDurableEventId`, `AgentRuntimeEventSink`,
|
|
8148
|
+
`AgentRuntimeEventSinkConfig` and `createAgentRuntimeEventSink`. Cursor gaps require a canonical
|
|
8149
|
+
snapshot reload; the bounded sink isolates transport failure and supports a typed projection step.
|
|
8150
|
+
|
|
8151
|
+
Managed effects and operator telemetry additionally export `AgentToolFenceConfig`,
|
|
8152
|
+
`AgentToolFenceContext`, `AgentObservability`, `AgentRunEvent`, `AgentRunEventSchema`,
|
|
8153
|
+
`AgentRunSinkConfig`, `AgentRunSinkDrop` and `AgentRunSinkError`. A monotonic run `fencingToken`
|
|
8154
|
+
may accompany checkpoint/terminal writes and tool context; internal causes are redacted unless an
|
|
8155
|
+
operator-only observability sink explicitly opts in.
|
|
8156
|
+
|
|
8039
8157
|
## `stitchkit/agent-runtime/openrouter`
|
|
8040
8158
|
|
|
8041
8159
|
| Export | Kind | Summary |
|
|
@@ -8373,6 +8491,8 @@ handler pipeline without opening a TCP port.
|
|
|
8373
8491
|
| `createHandlerTestClients` | function | exact contract-registry batch form |
|
|
8374
8492
|
| `runAgentStoreConformance` | function | reusable black-box duplicate/coalescing/stale/recovery contract for durable agent-store adapters |
|
|
8375
8493
|
| `AgentStoreConformanceConfig` | _type_ | factory configuration for running the same contract against a fresh adapter |
|
|
8494
|
+
| `createAgentRaceBarrier` / `createAgentRaceDriver` / `createAgentRaceTrace` | function | bounded named barriers and exact partial-order traces for deterministic runtime race probes |
|
|
8495
|
+
| `AgentRaceBarrier` / `AgentRaceDriver` / `AgentRaceTrace` / `AgentRaceTraceEntry` | _type_ | public packed-consumer types for the deterministic race harness |
|
|
8376
8496
|
| `HandlerTestClientDefaults` | _type_ | ordinary bare-client defaults with handler-owned `baseUrl` and `fetch` removed |
|
|
8377
8497
|
| `HandlerTestClientConfig` | _type_ | handler, contract, path prefix, scoped config and client request defaults |
|
|
8378
8498
|
| `HandlerTestClientsConfig` | _type_ | batch helper configuration |
|
package/package.json
CHANGED