@statelyai/agent 2.0.0-alpha.24 → 2.0.0-alpha.26
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/ai-sdk.cjs +30 -34
- package/dist/ai-sdk.d.cts +27 -31
- package/dist/ai-sdk.d.mts +27 -31
- package/dist/ai-sdk.mjs +27 -31
- package/dist/decision-CM9CYZ6t.cjs +519 -0
- package/dist/decision-DzSv1NpD.mjs +453 -0
- package/dist/event-log-store-Ba2fsc4E.mjs +576 -0
- package/dist/event-log-store-DQmImLYk.cjs +702 -0
- package/dist/event-log-store-DvOcs10J.d.cts +338 -0
- package/dist/event-log-store-DxyVgnas.d.mts +338 -0
- package/dist/index.cjs +429 -4272
- package/dist/index.d.cts +104 -1005
- package/dist/index.d.mts +104 -1005
- package/dist/index.mjs +389 -4202
- package/dist/log.cjs +392 -0
- package/dist/log.d.cts +32 -0
- package/dist/log.d.mts +32 -0
- package/dist/log.mjs +371 -0
- package/dist/machines.cjs +27 -16
- package/dist/machines.d.cts +1 -1
- package/dist/machines.d.mts +1 -1
- package/dist/machines.mjs +27 -16
- package/dist/openai.cjs +16 -15
- package/dist/openai.d.cts +9 -9
- package/dist/openai.d.mts +9 -9
- package/dist/openai.mjs +10 -9
- package/dist/otel.d.cts +1 -1
- package/dist/otel.d.mts +1 -1
- package/dist/{run-agent-Ck7Sa3Tb.d.mts → run-agent-BOfoJg5B.d.cts} +86 -387
- package/dist/{run-agent-DWqA8KiI.d.cts → run-agent-CG343kFs.d.mts} +86 -387
- package/dist/run-agent-Cb1-LS5P.cjs +1783 -0
- package/dist/run-agent-DvDQd4If.mjs +1669 -0
- package/dist/{setup-agent-CeO2fARv.mjs → setup-agent-CFW-jPI8.mjs} +9 -20
- package/dist/{setup-agent-Dl2VELLi.cjs → setup-agent-CPf7MxnG.cjs} +20 -37
- package/dist/testing.cjs +1088 -0
- package/dist/testing.d.cts +617 -0
- package/dist/testing.d.mts +617 -0
- package/dist/testing.mjs +1079 -0
- package/dist/{text-logic-DJBK3LbG.d.mts → text-logic-BFEOxyxv.d.cts} +71 -147
- package/dist/text-logic-Bl_ZRxDi.mjs +833 -0
- package/dist/text-logic-C8xyr6Ag.cjs +1091 -0
- package/dist/{text-logic-C7bSnH_B.d.cts → text-logic-hZSiRUo1.d.mts} +71 -147
- package/dist/{types-CjHk5OdH.d.cts → types-B1Qs2q3q.d.cts} +2 -1
- package/dist/{types-DWA6X9R-.d.mts → types-tA3SdczG.d.mts} +2 -1
- package/dist/usage-BdEjFuIi.mjs +5 -0
- package/dist/usage-efOQPdf_.cjs +10 -0
- package/dist/utils-C2DPqomn.d.mts +109 -0
- package/dist/utils-ceStNCOh.d.cts +109 -0
- package/package.json +26 -5
- package/readme.md +5 -3
- package/skills/generate-machine/SKILL.md +4 -6
- package/dist/decision-BBZ2jMO1.mjs +0 -1490
- package/dist/decision-Cv6SfNWl.cjs +0 -1856
package/dist/log.cjs
ADDED
|
@@ -0,0 +1,392 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_event_log_store = require("./event-log-store-DQmImLYk.cjs");
|
|
3
|
+
//#region src/event-log-store-conformance.ts
|
|
4
|
+
/**
|
|
5
|
+
* The runner-agnostic conformance suite for {@link AgentEventLogStore}
|
|
6
|
+
* implementations. Split out of `event-log-store.ts` so the store contract and
|
|
7
|
+
* the reference implementation stay readable.
|
|
8
|
+
*
|
|
9
|
+
* Every case throws a descriptive `Error` on the first violation, so any test
|
|
10
|
+
* runner (or a plain script) can drive it against its own store. Pass a
|
|
11
|
+
* `{ describe, it }` harness to register one test per case instead.
|
|
12
|
+
* @module
|
|
13
|
+
*/
|
|
14
|
+
function fail(message) {
|
|
15
|
+
throw new Error(`event-log-store conformance: ${message}`);
|
|
16
|
+
}
|
|
17
|
+
function entry(index, type, metadata) {
|
|
18
|
+
return {
|
|
19
|
+
schemaVersion: 1,
|
|
20
|
+
id: `evt_${index}`,
|
|
21
|
+
index,
|
|
22
|
+
recordedAt: "2026-01-01T00:00:00.000Z",
|
|
23
|
+
machineId: "conformance",
|
|
24
|
+
machineVersion: "v1",
|
|
25
|
+
event: {
|
|
26
|
+
type,
|
|
27
|
+
seq: index
|
|
28
|
+
},
|
|
29
|
+
...metadata !== void 0 ? { metadata } : {}
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
function entriesFrom(start, count) {
|
|
33
|
+
return Array.from({ length: count }, (_unused, i) => entry(start + i, `e${start + i}`));
|
|
34
|
+
}
|
|
35
|
+
function assertJsonEqual(actual, expected, message) {
|
|
36
|
+
const a = JSON.stringify(actual);
|
|
37
|
+
const b = JSON.stringify(expected);
|
|
38
|
+
if (a !== b) fail(`${message} (expected ${b}, got ${a})`);
|
|
39
|
+
}
|
|
40
|
+
const cases = [
|
|
41
|
+
{
|
|
42
|
+
name: "an unknown thread reads empty and has length 0",
|
|
43
|
+
async run(create) {
|
|
44
|
+
const store = await create();
|
|
45
|
+
assertJsonEqual(await store.read("missing"), [], "read of an unknown thread must be empty");
|
|
46
|
+
if (await store.length("missing") !== 0) fail("length of an unknown thread must be 0");
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
name: "a single append reads back verbatim",
|
|
51
|
+
async run(create) {
|
|
52
|
+
const store = await create();
|
|
53
|
+
const e = entry(0, "start", { label: "first" });
|
|
54
|
+
await store.append({
|
|
55
|
+
threadId: "t",
|
|
56
|
+
expectedIndex: 0,
|
|
57
|
+
entries: [e]
|
|
58
|
+
});
|
|
59
|
+
assertJsonEqual(await store.read("t"), [e], "read must return the appended entry");
|
|
60
|
+
if (await store.length("t") !== 1) fail("length after a single append must be 1");
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
name: "a second append extends the log in order",
|
|
65
|
+
async run(create) {
|
|
66
|
+
const store = await create();
|
|
67
|
+
await store.append({
|
|
68
|
+
threadId: "t",
|
|
69
|
+
expectedIndex: 0,
|
|
70
|
+
entries: entriesFrom(0, 3)
|
|
71
|
+
});
|
|
72
|
+
await store.append({
|
|
73
|
+
threadId: "t",
|
|
74
|
+
expectedIndex: 3,
|
|
75
|
+
entries: entriesFrom(3, 2)
|
|
76
|
+
});
|
|
77
|
+
if (await store.length("t") !== 5) fail("length after appending 3 then 2 entries must be 5");
|
|
78
|
+
assertJsonEqual((await store.read("t")).map((e) => e.index), [
|
|
79
|
+
0,
|
|
80
|
+
1,
|
|
81
|
+
2,
|
|
82
|
+
3,
|
|
83
|
+
4
|
|
84
|
+
], "reads must return entries in contiguous log order");
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
name: "a non-contiguous entry.index is misuse, not a race",
|
|
89
|
+
async run(create) {
|
|
90
|
+
const store = await create();
|
|
91
|
+
let caught;
|
|
92
|
+
try {
|
|
93
|
+
await store.append({
|
|
94
|
+
threadId: "t",
|
|
95
|
+
expectedIndex: 0,
|
|
96
|
+
entries: [entry(1, "gap")]
|
|
97
|
+
});
|
|
98
|
+
} catch (error) {
|
|
99
|
+
caught = error;
|
|
100
|
+
}
|
|
101
|
+
if (!(caught instanceof Error) || caught instanceof require_event_log_store.AgentEventLogConflictError) fail("a non-contiguous entry.index must throw a plain Error, not a conflict");
|
|
102
|
+
}
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
name: "a stale expectedIndex conflicts with correct fields",
|
|
106
|
+
async run(create) {
|
|
107
|
+
const store = await create();
|
|
108
|
+
await store.append({
|
|
109
|
+
threadId: "t",
|
|
110
|
+
expectedIndex: 0,
|
|
111
|
+
entries: [entry(0, "a")]
|
|
112
|
+
});
|
|
113
|
+
let caught;
|
|
114
|
+
try {
|
|
115
|
+
await store.append({
|
|
116
|
+
threadId: "t",
|
|
117
|
+
expectedIndex: 0,
|
|
118
|
+
entries: [entry(0, "b")]
|
|
119
|
+
});
|
|
120
|
+
} catch (error) {
|
|
121
|
+
caught = error;
|
|
122
|
+
}
|
|
123
|
+
if (!(caught instanceof require_event_log_store.AgentEventLogConflictError)) fail("a stale expectedIndex must throw AgentEventLogConflictError");
|
|
124
|
+
if (caught.threadId !== "t" || caught.expectedIndex !== 0 || caught.actualIndex !== 1) fail("conflict error must carry threadId, expectedIndex, and the actual index");
|
|
125
|
+
}
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
name: "entry ids are unique within a thread",
|
|
129
|
+
async run(create) {
|
|
130
|
+
const store = await create();
|
|
131
|
+
await store.append({
|
|
132
|
+
threadId: "t",
|
|
133
|
+
expectedIndex: 0,
|
|
134
|
+
entries: [entry(0, "a")]
|
|
135
|
+
});
|
|
136
|
+
let caught;
|
|
137
|
+
try {
|
|
138
|
+
await store.append({
|
|
139
|
+
threadId: "t",
|
|
140
|
+
expectedIndex: 1,
|
|
141
|
+
entries: [{
|
|
142
|
+
...entry(1, "b"),
|
|
143
|
+
id: "evt_0"
|
|
144
|
+
}]
|
|
145
|
+
});
|
|
146
|
+
} catch (error) {
|
|
147
|
+
caught = error;
|
|
148
|
+
}
|
|
149
|
+
if (!(caught instanceof Error) || caught instanceof require_event_log_store.AgentEventLogConflictError) fail("a duplicate event id within a thread must throw a plain Error");
|
|
150
|
+
}
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
name: "concurrent appends at the same index have exactly one winner",
|
|
154
|
+
async run(create) {
|
|
155
|
+
const store = await create();
|
|
156
|
+
await store.append({
|
|
157
|
+
threadId: "t",
|
|
158
|
+
expectedIndex: 0,
|
|
159
|
+
entries: [entry(0, "a")]
|
|
160
|
+
});
|
|
161
|
+
const results = await Promise.allSettled([store.append({
|
|
162
|
+
threadId: "t",
|
|
163
|
+
expectedIndex: 1,
|
|
164
|
+
entries: [entry(1, "w-a")]
|
|
165
|
+
}), store.append({
|
|
166
|
+
threadId: "t",
|
|
167
|
+
expectedIndex: 1,
|
|
168
|
+
entries: [entry(1, "w-b")]
|
|
169
|
+
})]);
|
|
170
|
+
const winners = results.filter((r) => r.status === "fulfilled");
|
|
171
|
+
const conflicts = results.filter((r) => r.status === "rejected" && r.reason instanceof require_event_log_store.AgentEventLogConflictError);
|
|
172
|
+
if (winners.length !== 1) fail(`exactly one racing append must win, got ${winners.length}`);
|
|
173
|
+
if (conflicts.length !== 1) fail(`exactly one racing append must reject with a conflict, got ${conflicts.length}`);
|
|
174
|
+
if (await store.length("t") !== 2) fail("after the race the log length must be 2");
|
|
175
|
+
}
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
name: "read({ from }) is incrementally correct",
|
|
179
|
+
async run(create) {
|
|
180
|
+
const store = await create();
|
|
181
|
+
await store.append({
|
|
182
|
+
threadId: "t",
|
|
183
|
+
expectedIndex: 0,
|
|
184
|
+
entries: entriesFrom(0, 5)
|
|
185
|
+
});
|
|
186
|
+
assertJsonEqual((await store.read("t", { from: 2 })).map((e) => e.index), [
|
|
187
|
+
2,
|
|
188
|
+
3,
|
|
189
|
+
4
|
|
190
|
+
], "read({ from }) must skip entries below `from`");
|
|
191
|
+
assertJsonEqual(await store.read("t", { from: 5 }), [], "read({ from }) at the log length must be empty");
|
|
192
|
+
}
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
name: "threads are isolated and grow independently",
|
|
196
|
+
async run(create) {
|
|
197
|
+
const store = await create();
|
|
198
|
+
await store.append({
|
|
199
|
+
threadId: "a",
|
|
200
|
+
expectedIndex: 0,
|
|
201
|
+
entries: [entry(0, "x")]
|
|
202
|
+
});
|
|
203
|
+
if (await store.length("b") !== 0) fail("an append to one thread must not create another");
|
|
204
|
+
await store.append({
|
|
205
|
+
threadId: "b",
|
|
206
|
+
expectedIndex: 0,
|
|
207
|
+
entries: entriesFrom(0, 2)
|
|
208
|
+
});
|
|
209
|
+
if (await store.length("a") !== 1 || await store.length("b") !== 2) fail("threads must grow independently");
|
|
210
|
+
}
|
|
211
|
+
},
|
|
212
|
+
{
|
|
213
|
+
name: "metadata round-trips verbatim",
|
|
214
|
+
async run(create) {
|
|
215
|
+
const store = await create();
|
|
216
|
+
const metadata = {
|
|
217
|
+
source: "user",
|
|
218
|
+
nested: { attempt: 2 },
|
|
219
|
+
tags: ["x", "y"]
|
|
220
|
+
};
|
|
221
|
+
await store.append({
|
|
222
|
+
threadId: "t",
|
|
223
|
+
expectedIndex: 0,
|
|
224
|
+
entries: [entry(0, "e", metadata)]
|
|
225
|
+
});
|
|
226
|
+
assertJsonEqual((await store.read("t"))[0].metadata, metadata, "metadata must round-trip verbatim");
|
|
227
|
+
}
|
|
228
|
+
},
|
|
229
|
+
{
|
|
230
|
+
name: "stored entries are isolated from caller mutation",
|
|
231
|
+
async run(create) {
|
|
232
|
+
const store = await create();
|
|
233
|
+
const e = entry(0, "e", { tags: ["a"] });
|
|
234
|
+
await store.append({
|
|
235
|
+
threadId: "t",
|
|
236
|
+
expectedIndex: 0,
|
|
237
|
+
entries: [e]
|
|
238
|
+
});
|
|
239
|
+
e.metadata.tags.push("mutated-after-append");
|
|
240
|
+
e.event.seq = 999;
|
|
241
|
+
const read = await store.read("t");
|
|
242
|
+
read[0].metadata.tags.push("mutated-after-read");
|
|
243
|
+
read[0].event.seq = 888;
|
|
244
|
+
const reread = await store.read("t");
|
|
245
|
+
assertJsonEqual(reread[0].metadata, { tags: ["a"] }, "stored entry must be isolated from post-append and post-read mutation");
|
|
246
|
+
assertJsonEqual(reread[0].event, {
|
|
247
|
+
type: "e",
|
|
248
|
+
seq: 0
|
|
249
|
+
}, "stored event must be isolated from mutation of an appended or read copy");
|
|
250
|
+
}
|
|
251
|
+
},
|
|
252
|
+
{
|
|
253
|
+
name: "fork copies a prefix and then diverges independently",
|
|
254
|
+
async run(create) {
|
|
255
|
+
const store = await create();
|
|
256
|
+
await store.append({
|
|
257
|
+
threadId: "src",
|
|
258
|
+
expectedIndex: 0,
|
|
259
|
+
entries: entriesFrom(0, 3)
|
|
260
|
+
});
|
|
261
|
+
await store.fork({
|
|
262
|
+
threadId: "src",
|
|
263
|
+
newThreadId: "fork-full"
|
|
264
|
+
});
|
|
265
|
+
if (await store.length("fork-full") !== 3) fail("fork with the default upToIndex must copy the full log");
|
|
266
|
+
await store.fork({
|
|
267
|
+
threadId: "src",
|
|
268
|
+
newThreadId: "fork-1",
|
|
269
|
+
upToIndex: 1
|
|
270
|
+
});
|
|
271
|
+
assertJsonEqual((await store.read("fork-1")).map((e) => e.index), [0], "fork with upToIndex 1 must copy only entry 0");
|
|
272
|
+
await store.fork({
|
|
273
|
+
threadId: "src",
|
|
274
|
+
newThreadId: "fork-2",
|
|
275
|
+
upToIndex: 2
|
|
276
|
+
});
|
|
277
|
+
assertJsonEqual((await store.read("fork-2")).map((e) => e.id), ["evt_0", "evt_1"], "fork with upToIndex 2 must copy entries 0 and 1 only");
|
|
278
|
+
await store.append({
|
|
279
|
+
threadId: "fork-1",
|
|
280
|
+
expectedIndex: 1,
|
|
281
|
+
entries: [entry(1, "branch")]
|
|
282
|
+
});
|
|
283
|
+
assertJsonEqual((await store.read("fork-1")).map((e) => e.event.type), ["e0", "branch"], "a forked thread must append independently from its copied length");
|
|
284
|
+
if (await store.length("src") !== 3) fail("appending to a fork must not touch the source thread");
|
|
285
|
+
}
|
|
286
|
+
},
|
|
287
|
+
{
|
|
288
|
+
name: "fork rejects a non-empty target, an unknown source, and an out-of-range cutoff (0 included)",
|
|
289
|
+
async run(create) {
|
|
290
|
+
const store = await create();
|
|
291
|
+
await store.append({
|
|
292
|
+
threadId: "src",
|
|
293
|
+
expectedIndex: 0,
|
|
294
|
+
entries: entriesFrom(0, 3)
|
|
295
|
+
});
|
|
296
|
+
await store.fork({
|
|
297
|
+
threadId: "src",
|
|
298
|
+
newThreadId: "fork-full"
|
|
299
|
+
});
|
|
300
|
+
let caughtExisting;
|
|
301
|
+
try {
|
|
302
|
+
await store.fork({
|
|
303
|
+
threadId: "src",
|
|
304
|
+
newThreadId: "fork-full"
|
|
305
|
+
});
|
|
306
|
+
} catch (error) {
|
|
307
|
+
caughtExisting = error;
|
|
308
|
+
}
|
|
309
|
+
if (!(caughtExisting instanceof Error) || caughtExisting instanceof require_event_log_store.AgentEventLogConflictError) fail("forking onto a non-empty thread must reject with a plain Error");
|
|
310
|
+
let caughtUnknown;
|
|
311
|
+
try {
|
|
312
|
+
await store.fork({
|
|
313
|
+
threadId: "nope",
|
|
314
|
+
newThreadId: "fork-nope"
|
|
315
|
+
});
|
|
316
|
+
} catch (error) {
|
|
317
|
+
caughtUnknown = error;
|
|
318
|
+
}
|
|
319
|
+
if (!(caughtUnknown instanceof Error) || caughtUnknown instanceof require_event_log_store.AgentEventLogConflictError) fail("forking an unknown source thread must reject with a plain Error");
|
|
320
|
+
let caughtRange;
|
|
321
|
+
try {
|
|
322
|
+
await store.fork({
|
|
323
|
+
threadId: "src",
|
|
324
|
+
newThreadId: "fork-range",
|
|
325
|
+
upToIndex: 99
|
|
326
|
+
});
|
|
327
|
+
} catch (error) {
|
|
328
|
+
caughtRange = error;
|
|
329
|
+
}
|
|
330
|
+
if (!(caughtRange instanceof Error) || caughtRange instanceof require_event_log_store.AgentEventLogConflictError) fail("forking past the source length must reject with a plain Error");
|
|
331
|
+
let caughtZero;
|
|
332
|
+
try {
|
|
333
|
+
await store.fork({
|
|
334
|
+
threadId: "src",
|
|
335
|
+
newThreadId: "fork-zero",
|
|
336
|
+
upToIndex: 0
|
|
337
|
+
});
|
|
338
|
+
} catch (error) {
|
|
339
|
+
caughtZero = error;
|
|
340
|
+
}
|
|
341
|
+
if (!(caughtZero instanceof Error) || caughtZero instanceof require_event_log_store.AgentEventLogConflictError) fail("forking with upToIndex 0 must reject with a plain Error");
|
|
342
|
+
if (await store.length("fork-zero") !== 0) fail("a rejected fork must not create the target thread");
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
];
|
|
346
|
+
/**
|
|
347
|
+
* Validates a store against the reference's semantics: empty read + zero length
|
|
348
|
+
* for unknown threads; single and multi-entry append; contiguity misuse guard;
|
|
349
|
+
* stale-`expectedIndex` conflict with correct fields; an interleaved concurrent
|
|
350
|
+
* append race (exactly one winner); entry-id uniqueness; `read({ from })`
|
|
351
|
+
* incremental correctness; thread isolation; metadata round-trip; deep-copy
|
|
352
|
+
* isolation on append and read; and the full fork contract.
|
|
353
|
+
*
|
|
354
|
+
* Without a `harness`, every case runs in sequence and the first violation
|
|
355
|
+
* throws. With one, each case is registered as its own test:
|
|
356
|
+
*
|
|
357
|
+
* ```ts
|
|
358
|
+
* import { describe, it } from 'vitest';
|
|
359
|
+
* assertEventLogStoreConformance(createMyStore, { describe, it });
|
|
360
|
+
* ```
|
|
361
|
+
*/
|
|
362
|
+
async function assertEventLogStoreConformance(create, harness) {
|
|
363
|
+
if (harness) {
|
|
364
|
+
harness.describe("AgentEventLogStore conformance", () => {
|
|
365
|
+
for (const testCase of cases) harness.it(testCase.name, () => testCase.run(create));
|
|
366
|
+
});
|
|
367
|
+
return;
|
|
368
|
+
}
|
|
369
|
+
for (const testCase of cases) await testCase.run(create);
|
|
370
|
+
}
|
|
371
|
+
//#endregion
|
|
372
|
+
exports.AGENT_EVENT_SCHEMA_VERSION = require_event_log_store.AGENT_EVENT_SCHEMA_VERSION;
|
|
373
|
+
exports.AGENT_INIT_EVENT_TYPE = require_event_log_store.AGENT_INIT_EVENT_TYPE;
|
|
374
|
+
exports.AgentEventLogConflictError = require_event_log_store.AgentEventLogConflictError;
|
|
375
|
+
exports.AgentEventLogError = require_event_log_store.AgentEventLogError;
|
|
376
|
+
exports.AgentMachineVersionMismatchError = require_event_log_store.AgentMachineVersionMismatchError;
|
|
377
|
+
exports.AgentReplayDivergenceError = require_event_log_store.AgentReplayDivergenceError;
|
|
378
|
+
exports.NonSerializableAgentEventError = require_event_log_store.NonSerializableAgentEventError;
|
|
379
|
+
exports.agentCallOccurrence = require_event_log_store.agentCallOccurrence;
|
|
380
|
+
exports.assertAgentLogEntry = require_event_log_store.assertAgentLogEntry;
|
|
381
|
+
exports.assertEventLogStoreConformance = assertEventLogStoreConformance;
|
|
382
|
+
exports.assertJsonSerializable = require_event_log_store.assertJsonSerializable;
|
|
383
|
+
exports.createInMemoryEventLogStore = require_event_log_store.createInMemoryEventLogStore;
|
|
384
|
+
exports.createReplayEntry = require_event_log_store.createReplayEntry;
|
|
385
|
+
exports.forkEventLog = require_event_log_store.forkEventLog;
|
|
386
|
+
exports.getLogExecutionId = require_event_log_store.getLogExecutionId;
|
|
387
|
+
exports.getSnapshotStateHash = require_event_log_store.getSnapshotStateHash;
|
|
388
|
+
exports.getUsageFromEvents = require_event_log_store.getUsageFromEvents;
|
|
389
|
+
exports.initEntry = require_event_log_store.initEntry;
|
|
390
|
+
exports.rebindActorSession = require_event_log_store.rebindActorSession;
|
|
391
|
+
exports.replay = require_event_log_store.replay;
|
|
392
|
+
exports.validateReplayEntries = require_event_log_store.validateReplayEntries;
|
package/dist/log.d.cts
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { A as validateReplayEntries, C as forkEventLog, D as initEntry, E as getUsageFromEvents, O as rebindActorSession, S as createReplayEntry, T as getSnapshotStateHash, _ as ReplayOptions, a as AGENT_INIT_EVENT_TYPE, b as assertAgentLogEntry, c as AgentLogEntry, d as AgentMachineVersionMismatchError, f as AgentPersistedSnapshot, g as NonSerializableAgentEventError, h as JsonValue, i as AGENT_EVENT_SCHEMA_VERSION, k as replay, l as AgentLogInit, m as CreateReplayEntryOptions, n as AgentEventLogStore, o as AgentEventLogError, p as AgentReplayDivergenceError, r as createInMemoryEventLogStore, s as AgentInitEvent, t as AgentEventLogConflictError, u as AgentLogVerification, v as ReplayResult, w as getLogExecutionId, x as assertJsonSerializable, y as agentCallOccurrence } from "./event-log-store-DvOcs10J.cjs";
|
|
2
|
+
|
|
3
|
+
//#region src/event-log-store-conformance.d.ts
|
|
4
|
+
/** Produces a fresh, empty store for one case. */
|
|
5
|
+
type CreateStore = () => Promise<AgentEventLogStore> | AgentEventLogStore;
|
|
6
|
+
/**
|
|
7
|
+
* A test runner's registration functions. Every case asserts by throwing, so
|
|
8
|
+
* the suite stays runner-agnostic.
|
|
9
|
+
*/
|
|
10
|
+
interface EventLogStoreConformanceHarness {
|
|
11
|
+
describe: (name: string, register: () => void) => void;
|
|
12
|
+
it: (name: string, run: () => Promise<void>) => void;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Validates a store against the reference's semantics: empty read + zero length
|
|
16
|
+
* for unknown threads; single and multi-entry append; contiguity misuse guard;
|
|
17
|
+
* stale-`expectedIndex` conflict with correct fields; an interleaved concurrent
|
|
18
|
+
* append race (exactly one winner); entry-id uniqueness; `read({ from })`
|
|
19
|
+
* incremental correctness; thread isolation; metadata round-trip; deep-copy
|
|
20
|
+
* isolation on append and read; and the full fork contract.
|
|
21
|
+
*
|
|
22
|
+
* Without a `harness`, every case runs in sequence and the first violation
|
|
23
|
+
* throws. With one, each case is registered as its own test:
|
|
24
|
+
*
|
|
25
|
+
* ```ts
|
|
26
|
+
* import { describe, it } from 'vitest';
|
|
27
|
+
* assertEventLogStoreConformance(createMyStore, { describe, it });
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
declare function assertEventLogStoreConformance(create: CreateStore, harness?: EventLogStoreConformanceHarness): Promise<void>;
|
|
31
|
+
//#endregion
|
|
32
|
+
export { AGENT_EVENT_SCHEMA_VERSION, AGENT_INIT_EVENT_TYPE, AgentEventLogConflictError, AgentEventLogError, type AgentEventLogStore, type AgentInitEvent, type AgentLogEntry, type AgentLogInit, type AgentLogVerification, AgentMachineVersionMismatchError, type AgentPersistedSnapshot, AgentReplayDivergenceError, type CreateReplayEntryOptions, type EventLogStoreConformanceHarness, type JsonValue, NonSerializableAgentEventError, type ReplayOptions, type ReplayResult, agentCallOccurrence, assertAgentLogEntry, assertEventLogStoreConformance, assertJsonSerializable, createInMemoryEventLogStore, createReplayEntry, forkEventLog, getLogExecutionId, getSnapshotStateHash, getUsageFromEvents, initEntry, rebindActorSession, replay, validateReplayEntries };
|
package/dist/log.d.mts
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { A as validateReplayEntries, C as forkEventLog, D as initEntry, E as getUsageFromEvents, O as rebindActorSession, S as createReplayEntry, T as getSnapshotStateHash, _ as ReplayOptions, a as AGENT_INIT_EVENT_TYPE, b as assertAgentLogEntry, c as AgentLogEntry, d as AgentMachineVersionMismatchError, f as AgentPersistedSnapshot, g as NonSerializableAgentEventError, h as JsonValue, i as AGENT_EVENT_SCHEMA_VERSION, k as replay, l as AgentLogInit, m as CreateReplayEntryOptions, n as AgentEventLogStore, o as AgentEventLogError, p as AgentReplayDivergenceError, r as createInMemoryEventLogStore, s as AgentInitEvent, t as AgentEventLogConflictError, u as AgentLogVerification, v as ReplayResult, w as getLogExecutionId, x as assertJsonSerializable, y as agentCallOccurrence } from "./event-log-store-DxyVgnas.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/event-log-store-conformance.d.ts
|
|
4
|
+
/** Produces a fresh, empty store for one case. */
|
|
5
|
+
type CreateStore = () => Promise<AgentEventLogStore> | AgentEventLogStore;
|
|
6
|
+
/**
|
|
7
|
+
* A test runner's registration functions. Every case asserts by throwing, so
|
|
8
|
+
* the suite stays runner-agnostic.
|
|
9
|
+
*/
|
|
10
|
+
interface EventLogStoreConformanceHarness {
|
|
11
|
+
describe: (name: string, register: () => void) => void;
|
|
12
|
+
it: (name: string, run: () => Promise<void>) => void;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Validates a store against the reference's semantics: empty read + zero length
|
|
16
|
+
* for unknown threads; single and multi-entry append; contiguity misuse guard;
|
|
17
|
+
* stale-`expectedIndex` conflict with correct fields; an interleaved concurrent
|
|
18
|
+
* append race (exactly one winner); entry-id uniqueness; `read({ from })`
|
|
19
|
+
* incremental correctness; thread isolation; metadata round-trip; deep-copy
|
|
20
|
+
* isolation on append and read; and the full fork contract.
|
|
21
|
+
*
|
|
22
|
+
* Without a `harness`, every case runs in sequence and the first violation
|
|
23
|
+
* throws. With one, each case is registered as its own test:
|
|
24
|
+
*
|
|
25
|
+
* ```ts
|
|
26
|
+
* import { describe, it } from 'vitest';
|
|
27
|
+
* assertEventLogStoreConformance(createMyStore, { describe, it });
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
declare function assertEventLogStoreConformance(create: CreateStore, harness?: EventLogStoreConformanceHarness): Promise<void>;
|
|
31
|
+
//#endregion
|
|
32
|
+
export { AGENT_EVENT_SCHEMA_VERSION, AGENT_INIT_EVENT_TYPE, AgentEventLogConflictError, AgentEventLogError, type AgentEventLogStore, type AgentInitEvent, type AgentLogEntry, type AgentLogInit, type AgentLogVerification, AgentMachineVersionMismatchError, type AgentPersistedSnapshot, AgentReplayDivergenceError, type CreateReplayEntryOptions, type EventLogStoreConformanceHarness, type JsonValue, NonSerializableAgentEventError, type ReplayOptions, type ReplayResult, agentCallOccurrence, assertAgentLogEntry, assertEventLogStoreConformance, assertJsonSerializable, createInMemoryEventLogStore, createReplayEntry, forkEventLog, getLogExecutionId, getSnapshotStateHash, getUsageFromEvents, initEntry, rebindActorSession, replay, validateReplayEntries };
|