@statelyai/agent 2.0.0-alpha.31 → 2.0.0-alpha.32

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.
Files changed (60) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/dist/ai-sdk.cjs +3 -3
  3. package/dist/ai-sdk.d.cts +1 -1
  4. package/dist/ai-sdk.d.mts +1 -1
  5. package/dist/ai-sdk.mjs +3 -3
  6. package/dist/{decision-Iys2hzg3.cjs → decision-BPdEaxPf.cjs} +1 -1
  7. package/dist/{decision-DqO018Tp.mjs → decision-CV7WiV5C.mjs} +1 -1
  8. package/dist/{event-log-Bdww2l1D.cjs → event-log-CKWeC7H-.cjs} +22 -3
  9. package/dist/{event-log-DE430ZCa.mjs → event-log-DAqsalT1.mjs} +22 -3
  10. package/dist/{event-log-store-CCWdTPEP.mjs → event-log-store-BGehvVTb.mjs} +2 -2
  11. package/dist/{event-log-store-DTf_OzB-.d.cts → event-log-store-C2NjVlWU.d.mts} +13 -5
  12. package/dist/{event-log-store-BWMLi6oh.cjs → event-log-store-DKyE7JKr.cjs} +2 -2
  13. package/dist/{event-log-store-RziIobdW.d.mts → event-log-store-s73r1Hxf.d.cts} +13 -5
  14. package/dist/index.cjs +5 -5
  15. package/dist/index.d.cts +9 -8
  16. package/dist/index.d.mts +9 -8
  17. package/dist/index.mjs +5 -5
  18. package/dist/log.cjs +40 -5
  19. package/dist/log.d.cts +1 -1
  20. package/dist/log.d.mts +1 -1
  21. package/dist/log.mjs +40 -5
  22. package/dist/machines.cjs +1 -1
  23. package/dist/machines.mjs +1 -1
  24. package/dist/{model-source-DQ7KgJaT.cjs → model-source-BQ97_l1-.cjs} +1 -1
  25. package/dist/{model-source-CXsSZPq0.mjs → model-source-BilDEyqk.mjs} +1 -1
  26. package/dist/openai.cjs +2 -2
  27. package/dist/openai.d.cts +1 -1
  28. package/dist/openai.d.mts +1 -1
  29. package/dist/openai.mjs +2 -2
  30. package/dist/otel.d.cts +1 -1
  31. package/dist/otel.d.mts +1 -1
  32. package/dist/{run-agent-DWZ1uyBJ.mjs → run-agent-2UnSUhDb.mjs} +7 -5
  33. package/dist/{run-agent-D4MwS5GY.d.mts → run-agent-Atu-wEk7.d.mts} +3 -3
  34. package/dist/{run-agent-B5opVUxx.d.cts → run-agent-B5QhabdY.d.cts} +3 -3
  35. package/dist/{run-agent-tmk58M0x.cjs → run-agent-Cg0xd3K-.cjs} +7 -5
  36. package/dist/{setup-agent-yFFVXf5s.d.cts → setup-agent-BiF1N3td.d.cts} +2 -2
  37. package/dist/{setup-agent-BaffhCcM.mjs → setup-agent-CmhB-U5P.mjs} +2 -2
  38. package/dist/{setup-agent-D0L8Anl_.cjs → setup-agent-CwUJyqKB.cjs} +2 -2
  39. package/dist/{setup-agent-CPyg2ic7.d.mts → setup-agent-J9f_Wu5T.d.mts} +2 -2
  40. package/dist/tanstack-ai.cjs +3 -3
  41. package/dist/tanstack-ai.d.cts +1 -1
  42. package/dist/tanstack-ai.d.mts +1 -1
  43. package/dist/tanstack-ai.mjs +3 -3
  44. package/dist/testing.cjs +3 -3
  45. package/dist/testing.d.cts +3 -3
  46. package/dist/testing.d.mts +3 -3
  47. package/dist/testing.mjs +3 -3
  48. package/dist/{text-logic-j9hShB7d.d.cts → text-logic-CYP502VT.d.cts} +5 -3
  49. package/dist/{text-logic-BwdrDpO9.d.mts → text-logic-DuK9HIFM.d.mts} +5 -3
  50. package/dist/{usage-BYqv7VBw.d.cts → usage-D7JKAxLc.d.mts} +1 -1
  51. package/dist/{usage-Bl4nK8D-.d.mts → usage-DVw-646x.d.cts} +1 -1
  52. package/dist/validate.cjs +3 -3
  53. package/dist/validate.d.cts +2 -2
  54. package/dist/validate.d.mts +2 -2
  55. package/dist/validate.mjs +3 -3
  56. package/dist/{verify-tkymWz6X.d.mts → verify-BVz4cURF.d.mts} +1 -1
  57. package/dist/{verify-BH5e0XLK.mjs → verify-CoCvR1eM.mjs} +2 -2
  58. package/dist/{verify-CS_xxvVU.cjs → verify-D_llRCTr.cjs} +2 -2
  59. package/dist/{verify-CPKDPMwY.d.cts → verify-Dk3Vwnha.d.cts} +1 -1
  60. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # @statelyai/agent
2
2
 
3
+ ## 2.0.0-alpha.32
4
+
5
+ ### Patch Changes
6
+
7
+ - [#178](https://github.com/statelyai/agent/pull/178) [`efe9dd0`](https://github.com/statelyai/agent/commit/efe9dd029b1fd4b333010f84997e4568eb760eea) Thanks [@davidkpiano](https://github.com/davidkpiano)! - **A fork is its own lineage.** `forkEventLog` and `store.fork` give the fork's init entry a fresh `metadata.executionId` and `metadata.forkedFrom: { executionId?, logIndex }` (the parent's id, when it has one, and the cutoff). Before, a fork kept its parent's execution id, so a call the fork made at the same site got the same `info.callKey` as the parent's, and a cache keyed on it could return the parent's result.
8
+
9
+ - **A custom store's `fork` must store what `forkEventLog` returns** for the prefix. `assertEventLogStoreConformance` now checks the lineage, and its fixtures start with a real init entry.
10
+ - A snapshot taken on the parent no longer takes the fast path when resuming the fork; the fork's log is folded instead. A version bridge still accepts it while the fork has appended nothing since its cutoff.
11
+ - Explicit `events` for a stored thread must also match its init entry's `executionId`, so a parent's log is refused for its fork's thread.
12
+
3
13
  ## 2.0.0-alpha.31
4
14
 
5
15
  ### Minor Changes
package/dist/ai-sdk.cjs CHANGED
@@ -1,7 +1,7 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_event_log = require("./event-log-Bdww2l1D.cjs");
3
- const require_decision = require("./decision-Iys2hzg3.cjs");
4
- const require_model_source = require("./model-source-DQ7KgJaT.cjs");
2
+ const require_event_log = require("./event-log-CKWeC7H-.cjs");
3
+ const require_decision = require("./decision-BPdEaxPf.cjs");
4
+ const require_model_source = require("./model-source-BQ97_l1-.cjs");
5
5
  let ai = require("ai");
6
6
  //#region src/ai-sdk/mappers.ts
7
7
  /**
package/dist/ai-sdk.d.cts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { s as AgentTools, u as ChosenEvent } from "./types-Dp5_Ru4R.cjs";
2
- import { N as AgentDecisionRequest, c as AgentRequestExecutorInfo, f as AgentTextRequest, r as AgentFinishReason, t as AgentCallUsage } from "./text-logic-j9hShB7d.cjs";
2
+ import { N as AgentDecisionRequest, c as AgentRequestExecutorInfo, f as AgentTextRequest, r as AgentFinishReason, t as AgentCallUsage } from "./text-logic-CYP502VT.cjs";
3
3
  import { Experimental_DecisionModel, FinishReason, LanguageModel, LanguageModelUsage, ModelMessage, ToolSet, TypedToolCall, TypedToolResult, generateText } from "ai";
4
4
  import { AnyStateMachine } from "xstate";
5
5
  //#region src/ai-sdk/mappers.d.ts
package/dist/ai-sdk.d.mts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { s as AgentTools, u as ChosenEvent } from "./types-Dp5_Ru4R.mjs";
2
- import { N as AgentDecisionRequest, c as AgentRequestExecutorInfo, f as AgentTextRequest, r as AgentFinishReason, t as AgentCallUsage } from "./text-logic-BwdrDpO9.mjs";
2
+ import { N as AgentDecisionRequest, c as AgentRequestExecutorInfo, f as AgentTextRequest, r as AgentFinishReason, t as AgentCallUsage } from "./text-logic-DuK9HIFM.mjs";
3
3
  import { AnyStateMachine } from "xstate";
4
4
  import { Experimental_DecisionModel, FinishReason, LanguageModel, LanguageModelUsage, ModelMessage, ToolSet, TypedToolCall, TypedToolResult, generateText } from "ai";
5
5
  //#region src/ai-sdk/mappers.d.ts
package/dist/ai-sdk.mjs CHANGED
@@ -1,6 +1,6 @@
1
- import { R as providerOutputSchema, dt as AgentTruncatedError, j as getAgentOutputMode, lt as isRecord, tt as isStandardSchema } from "./event-log-DE430ZCa.mjs";
2
- import { c as renderDecisionAttempts, o as decisionOptionIds } from "./decision-DqO018Tp.mjs";
3
- import { t as resolveModelSource } from "./model-source-CXsSZPq0.mjs";
1
+ import { R as providerOutputSchema, dt as AgentTruncatedError, j as getAgentOutputMode, lt as isRecord, tt as isStandardSchema } from "./event-log-DAqsalT1.mjs";
2
+ import { c as renderDecisionAttempts, o as decisionOptionIds } from "./decision-CV7WiV5C.mjs";
3
+ import { t as resolveModelSource } from "./model-source-BilDEyqk.mjs";
4
4
  import { InvalidResponseDataError, NoObjectGeneratedError, Output, experimental_decide, generateText, jsonSchema, stepCountIs, streamText, tool } from "ai";
5
5
  //#region src/ai-sdk/mappers.ts
6
6
  /**
@@ -1,4 +1,4 @@
1
- const require_event_log = require("./event-log-Bdww2l1D.cjs");
1
+ const require_event_log = require("./event-log-CKWeC7H-.cjs");
2
2
  let xstate = require("xstate");
3
3
  //#region src/events.ts
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { H as getAgentExecutionOptions, T as DECIDE_ACTOR, V as executorBoundLogics, at as userMessage, lt as isRecord, ot as validateSchemaSync, u as canonicalEventJson, ut as AgentError, z as resolveTextLogicValue } from "./event-log-DE430ZCa.mjs";
1
+ import { H as getAgentExecutionOptions, T as DECIDE_ACTOR, V as executorBoundLogics, at as userMessage, lt as isRecord, ot as validateSchemaSync, u as canonicalEventJson, ut as AgentError, z as resolveTextLogicValue } from "./event-log-DAqsalT1.mjs";
2
2
  import { createAsyncLogic, getNextTransitions } from "xstate";
3
3
  //#region src/events.ts
4
4
  /**
@@ -1239,8 +1239,8 @@ function isSnapshotInitEntry(entry) {
1239
1239
  * Minted once per run and inherited verbatim by every resume of that log, so
1240
1240
  * it names one lineage rather than one process. Entry ids cannot serve this
1241
1241
  * role — the built-in ids are index-derived, so every log's init entry is
1242
- * `evt_00000000`. A fork copies the init entry, so it shares its parent's
1243
- * execution id by construction.
1242
+ * `evt_00000000`. A fork ({@link forkEventLog}, `store.fork`) mints its own
1243
+ * and records the parent's in `metadata.forkedFrom`.
1244
1244
  *
1245
1245
  * Returns `undefined` for a log with no init entry and for one written without
1246
1246
  * the field — callers must treat the id as optional.
@@ -1288,12 +1288,31 @@ function validateReplayEntries(entries, options = {}) {
1288
1288
  /**
1289
1289
  * The prefix `[0, upToIndex)` of a log, as a new log. `upToIndex` is exclusive
1290
1290
  * and must leave the init entry in place, so the fork is still self-contained.
1291
+ *
1292
+ * The fork is its own lineage: its init entry gets a fresh
1293
+ * `metadata.executionId` and `metadata.forkedFrom: { executionId?, logIndex }`:
1294
+ * the cutoff, and the parent's id when it had one. Call keys derive
1295
+ * from the execution id, so a fork's calls never collide with its parent's.
1296
+ * Every other entry is copied as is.
1291
1297
  */
1292
1298
  function forkEventLog(entries, upToIndex) {
1293
1299
  if (!Number.isInteger(upToIndex) || upToIndex < 1 || upToIndex > entries.length) throw new AgentEventLogError(`forkEventLog: upToIndex must be an integer in [1, ${entries.length}]; got ${String(upToIndex)}.`);
1294
1300
  const forked = entries.slice(0, upToIndex);
1295
1301
  if (!isInitEntry(forked[0])) throw new AgentEventLogError(`forkEventLog: the forked prefix must start with the reserved '${AGENT_INIT_EVENT_TYPE}' entry.`);
1296
- return forked;
1302
+ const [init, ...rest] = forked;
1303
+ const parentExecutionId = getLogExecutionId(forked);
1304
+ const forkedFrom = {
1305
+ ...parentExecutionId !== void 0 ? { executionId: parentExecutionId } : {},
1306
+ logIndex: upToIndex
1307
+ };
1308
+ return [{
1309
+ ...init,
1310
+ metadata: {
1311
+ ...init.metadata,
1312
+ executionId: crypto.randomUUID(),
1313
+ forkedFrom
1314
+ }
1315
+ }, ...rest];
1297
1316
  }
1298
1317
  const DONE_ACTOR_EVENT_TYPE = "xstate.done.actor";
1299
1318
  const ERROR_ACTOR_EVENT_TYPE = "xstate.error.actor";
@@ -1239,8 +1239,8 @@ function isSnapshotInitEntry(entry) {
1239
1239
  * Minted once per run and inherited verbatim by every resume of that log, so
1240
1240
  * it names one lineage rather than one process. Entry ids cannot serve this
1241
1241
  * role — the built-in ids are index-derived, so every log's init entry is
1242
- * `evt_00000000`. A fork copies the init entry, so it shares its parent's
1243
- * execution id by construction.
1242
+ * `evt_00000000`. A fork ({@link forkEventLog}, `store.fork`) mints its own
1243
+ * and records the parent's in `metadata.forkedFrom`.
1244
1244
  *
1245
1245
  * Returns `undefined` for a log with no init entry and for one written without
1246
1246
  * the field — callers must treat the id as optional.
@@ -1288,12 +1288,31 @@ function validateReplayEntries(entries, options = {}) {
1288
1288
  /**
1289
1289
  * The prefix `[0, upToIndex)` of a log, as a new log. `upToIndex` is exclusive
1290
1290
  * and must leave the init entry in place, so the fork is still self-contained.
1291
+ *
1292
+ * The fork is its own lineage: its init entry gets a fresh
1293
+ * `metadata.executionId` and `metadata.forkedFrom: { executionId?, logIndex }`:
1294
+ * the cutoff, and the parent's id when it had one. Call keys derive
1295
+ * from the execution id, so a fork's calls never collide with its parent's.
1296
+ * Every other entry is copied as is.
1291
1297
  */
1292
1298
  function forkEventLog(entries, upToIndex) {
1293
1299
  if (!Number.isInteger(upToIndex) || upToIndex < 1 || upToIndex > entries.length) throw new AgentEventLogError(`forkEventLog: upToIndex must be an integer in [1, ${entries.length}]; got ${String(upToIndex)}.`);
1294
1300
  const forked = entries.slice(0, upToIndex);
1295
1301
  if (!isInitEntry(forked[0])) throw new AgentEventLogError(`forkEventLog: the forked prefix must start with the reserved '${AGENT_INIT_EVENT_TYPE}' entry.`);
1296
- return forked;
1302
+ const [init, ...rest] = forked;
1303
+ const parentExecutionId = getLogExecutionId(forked);
1304
+ const forkedFrom = {
1305
+ ...parentExecutionId !== void 0 ? { executionId: parentExecutionId } : {},
1306
+ logIndex: upToIndex
1307
+ };
1308
+ return [{
1309
+ ...init,
1310
+ metadata: {
1311
+ ...init.metadata,
1312
+ executionId: crypto.randomUUID(),
1313
+ forkedFrom
1314
+ }
1315
+ }, ...rest];
1297
1316
  }
1298
1317
  const DONE_ACTOR_EVENT_TYPE = "xstate.done.actor";
1299
1318
  const ERROR_ACTOR_EVENT_TYPE = "xstate.error.actor";
@@ -1,4 +1,4 @@
1
- import { c as assertAgentLogEntry, ut as AgentError } from "./event-log-DE430ZCa.mjs";
1
+ import { c as assertAgentLogEntry, p as forkEventLog, ut as AgentError } from "./event-log-DAqsalT1.mjs";
2
2
  //#region src/event-log-store.ts
3
3
  /**
4
4
  * Durable storage for {@link AgentLogEntry} logs: the one interface a host
@@ -65,7 +65,7 @@ function createInMemoryEventLogStore() {
65
65
  if (!source) throw new Error(`AgentEventLogStore.fork: unknown source thread "${threadId}".`);
66
66
  const upTo = upToIndex ?? source.length;
67
67
  if (!Number.isInteger(upTo) || upTo < 1 || upTo > source.length) throw new Error(`AgentEventLogStore.fork: upToIndex must be an integer in [1, ${source.length}] on thread "${threadId}"; got ${String(upTo)}.`);
68
- threads.set(newThreadId, source.slice(0, upTo).map((entry) => clone(entry)));
68
+ threads.set(newThreadId, forkEventLog(source, upTo).map((entry) => clone(entry)));
69
69
  },
70
70
  async listThreads(options = {}) {
71
71
  const { prefix = "", limit, cursor } = options;
@@ -1,4 +1,4 @@
1
- import { I as DecisionAttempt, Q as AgentError, t as AgentCallUsage } from "./text-logic-j9hShB7d.cjs";
1
+ import { I as DecisionAttempt, Q as AgentError, t as AgentCallUsage } from "./text-logic-DuK9HIFM.mjs";
2
2
  import { Actor, AnyMachineSnapshot, AnyStateMachine, EventObject, Snapshot, SnapshotFrom } from "xstate";
3
3
  //#region src/event-log.d.ts
4
4
  /** The durable entry envelope version. */
@@ -186,8 +186,8 @@ declare function initEntry(machine: AnyStateMachine, init?: AgentLogInit, option
186
186
  * Minted once per run and inherited verbatim by every resume of that log, so
187
187
  * it names one lineage rather than one process. Entry ids cannot serve this
188
188
  * role — the built-in ids are index-derived, so every log's init entry is
189
- * `evt_00000000`. A fork copies the init entry, so it shares its parent's
190
- * execution id by construction.
189
+ * `evt_00000000`. A fork ({@link forkEventLog}, `store.fork`) mints its own
190
+ * and records the parent's in `metadata.forkedFrom`.
191
191
  *
192
192
  * Returns `undefined` for a log with no init entry and for one written without
193
193
  * the field — callers must treat the id as optional.
@@ -210,6 +210,12 @@ declare function validateReplayEntries(entries: readonly AgentLogEntry[], option
210
210
  /**
211
211
  * The prefix `[0, upToIndex)` of a log, as a new log. `upToIndex` is exclusive
212
212
  * and must leave the init entry in place, so the fork is still self-contained.
213
+ *
214
+ * The fork is its own lineage: its init entry gets a fresh
215
+ * `metadata.executionId` and `metadata.forkedFrom: { executionId?, logIndex }`:
216
+ * the cutoff, and the parent's id when it had one. Call keys derive
217
+ * from the execution id, so a fork's calls never collide with its parent's.
218
+ * Every other entry is copied as is.
213
219
  */
214
220
  declare function forkEventLog(entries: readonly AgentLogEntry[], upToIndex: number): AgentLogEntry[];
215
221
  /**
@@ -380,8 +386,10 @@ interface AgentEventLogStore {
380
386
  * init entry and stays a self-contained log. The fork then appends
381
387
  * independently. Rejects (plain `Error`) if `newThreadId` already has
382
388
  * entries, the source is unknown, or `upToIndex` is out of range.
383
- * Implementations may copy-on-write or physically copy; observable behavior
384
- * must match a full copy.
389
+ *
390
+ * The fork is its own lineage: store what {@link forkEventLog} returns for
391
+ * the prefix, whose init entry carries a fresh `metadata.executionId` and
392
+ * `metadata.forkedFrom`. Every other entry must match the source.
385
393
  */
386
394
  fork(input: {
387
395
  threadId: string;
@@ -1,4 +1,4 @@
1
- const require_event_log = require("./event-log-Bdww2l1D.cjs");
1
+ const require_event_log = require("./event-log-CKWeC7H-.cjs");
2
2
  //#region src/event-log-store.ts
3
3
  /**
4
4
  * Durable storage for {@link AgentLogEntry} logs: the one interface a host
@@ -65,7 +65,7 @@ function createInMemoryEventLogStore() {
65
65
  if (!source) throw new Error(`AgentEventLogStore.fork: unknown source thread "${threadId}".`);
66
66
  const upTo = upToIndex ?? source.length;
67
67
  if (!Number.isInteger(upTo) || upTo < 1 || upTo > source.length) throw new Error(`AgentEventLogStore.fork: upToIndex must be an integer in [1, ${source.length}] on thread "${threadId}"; got ${String(upTo)}.`);
68
- threads.set(newThreadId, source.slice(0, upTo).map((entry) => clone(entry)));
68
+ threads.set(newThreadId, require_event_log.forkEventLog(source, upTo).map((entry) => clone(entry)));
69
69
  },
70
70
  async listThreads(options = {}) {
71
71
  const { prefix = "", limit, cursor } = options;
@@ -1,4 +1,4 @@
1
- import { I as DecisionAttempt, Q as AgentError, t as AgentCallUsage } from "./text-logic-BwdrDpO9.mjs";
1
+ import { I as DecisionAttempt, Q as AgentError, t as AgentCallUsage } from "./text-logic-CYP502VT.cjs";
2
2
  import { Actor, AnyMachineSnapshot, AnyStateMachine, EventObject, Snapshot, SnapshotFrom } from "xstate";
3
3
  //#region src/event-log.d.ts
4
4
  /** The durable entry envelope version. */
@@ -186,8 +186,8 @@ declare function initEntry(machine: AnyStateMachine, init?: AgentLogInit, option
186
186
  * Minted once per run and inherited verbatim by every resume of that log, so
187
187
  * it names one lineage rather than one process. Entry ids cannot serve this
188
188
  * role — the built-in ids are index-derived, so every log's init entry is
189
- * `evt_00000000`. A fork copies the init entry, so it shares its parent's
190
- * execution id by construction.
189
+ * `evt_00000000`. A fork ({@link forkEventLog}, `store.fork`) mints its own
190
+ * and records the parent's in `metadata.forkedFrom`.
191
191
  *
192
192
  * Returns `undefined` for a log with no init entry and for one written without
193
193
  * the field — callers must treat the id as optional.
@@ -210,6 +210,12 @@ declare function validateReplayEntries(entries: readonly AgentLogEntry[], option
210
210
  /**
211
211
  * The prefix `[0, upToIndex)` of a log, as a new log. `upToIndex` is exclusive
212
212
  * and must leave the init entry in place, so the fork is still self-contained.
213
+ *
214
+ * The fork is its own lineage: its init entry gets a fresh
215
+ * `metadata.executionId` and `metadata.forkedFrom: { executionId?, logIndex }`:
216
+ * the cutoff, and the parent's id when it had one. Call keys derive
217
+ * from the execution id, so a fork's calls never collide with its parent's.
218
+ * Every other entry is copied as is.
213
219
  */
214
220
  declare function forkEventLog(entries: readonly AgentLogEntry[], upToIndex: number): AgentLogEntry[];
215
221
  /**
@@ -380,8 +386,10 @@ interface AgentEventLogStore {
380
386
  * init entry and stays a self-contained log. The fork then appends
381
387
  * independently. Rejects (plain `Error`) if `newThreadId` already has
382
388
  * entries, the source is unknown, or `upToIndex` is out of range.
383
- * Implementations may copy-on-write or physically copy; observable behavior
384
- * must match a full copy.
389
+ *
390
+ * The fork is its own lineage: store what {@link forkEventLog} returns for
391
+ * the prefix, whose init entry carries a fresh `metadata.executionId` and
392
+ * `metadata.forkedFrom`. Every other entry must match the source.
385
393
  */
386
394
  fork(input: {
387
395
  threadId: string;
package/dist/index.cjs CHANGED
@@ -1,9 +1,9 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_event_log = require("./event-log-Bdww2l1D.cjs");
3
- const require_decision = require("./decision-Iys2hzg3.cjs");
4
- const require_setup_agent = require("./setup-agent-D0L8Anl_.cjs");
5
- const require_event_log_store = require("./event-log-store-BWMLi6oh.cjs");
6
- const require_run_agent = require("./run-agent-tmk58M0x.cjs");
2
+ const require_event_log = require("./event-log-CKWeC7H-.cjs");
3
+ const require_decision = require("./decision-BPdEaxPf.cjs");
4
+ const require_setup_agent = require("./setup-agent-CwUJyqKB.cjs");
5
+ const require_event_log_store = require("./event-log-store-DKyE7JKr.cjs");
6
+ const require_run_agent = require("./run-agent-Cg0xd3K-.cjs");
7
7
  let xstate = require("xstate");
8
8
  //#region src/messages.ts
9
9
  const KNOWN_PART_TYPES = /* @__PURE__ */ new Set([
package/dist/index.d.cts CHANGED
@@ -1,9 +1,9 @@
1
1
  import { C as UserMessage, S as ToolResultPart, _ as StandardSchemaV1, a as AgentToolDescriptor, b as ToolCallPart, c as AllowedEvents, d as EventUnion, f as FilePart, h as InferOutput, i as AgentToolChoice, l as AssistantMessage, m as InferInput, n as AgentMessage, o as AgentToolExecute, p as ImagePart, r as AgentTool, s as AgentTools, u as ChosenEvent, v as SystemMessage, x as ToolMessage, y as TextPart } from "./types-Dp5_Ru4R.cjs";
2
- import { $ as AgentTruncatedError, A as AgentDecisionExhaustedError, B as createDecisionLogic, C as getAgentOutputMode, D as parseProviderOutput, E as parseOutput, F as CreateDecisionRequestOptions, G as AgentInvalidEventPayloadError, H as renderDecisionAttempts, I as DecisionAttempt, J as AgentSchemas, K as AgentRequestOptions, L as DecisionLogic, M as AgentDecisionOption, N as AgentDecisionRequest, O as providerOutputSchema, P as AgentExecutorDecisionRequest, Q as AgentError, R as DecisionLogicConfig, S as createTextLogic, T as getCallUsage, U as resolveDecision, V as createDecisionRequest, W as AgentEventDescriptor, X as getAcceptedEvents, Y as EventFromSnapshot, Z as parseAgentEvent, _ as TextLogic, a as AgentModelRef, b as TextLogicExecutor, c as AgentRequestExecutorInfo, f as AgentTextRequest, g as ProviderStructuredOutput, j as AgentDecisionInput, k as AgentDecisionExecutor, l as AgentRequestExecutorResult, m as AgentUsage, n as AgentExecutorTextRequest, o as AgentOutputMode, p as AgentTextResult, q as AgentRequestSource, r as AgentFinishReason, s as AgentRequestExecutor, t as AgentCallUsage, u as AgentRequestExecutors, v as TextLogicConfig, w as getCallFinishReason, x as bindRequestExecutor, y as TextLogicExecuteArgs, z as ResolveDecisionOptions } from "./text-logic-j9hShB7d.cjs";
3
- import { n as AgentUsageEvent, t as AGENT_USAGE_EVENT_TYPE } from "./usage-BYqv7VBw.cjs";
4
- import { C as AgentInteractionEventMeta, D as getInteraction, E as eventFromInteraction, O as interactionMetaSchema, S as AgentInteractionEvent, T as GetInteractionOptions, _ as FromConfigResult, a as WithAgentUsageEvent, b as AgentInteractionChoice, c as setupAgent, d as AgentWorkflowConfig, f as AgentWorkflowInvokeConfig, g as FromConfigOptions, h as AgentWorkflowTransitionConfig, i as WithAgentEvents, l as AgentWorkflowActionConfig, m as AgentWorkflowStateConfig, n as AgentSchemaPack, o as createAgentSchemas, p as AgentWorkflowRequestConfig, r as AgentUsageEventPayload, s as getAgentSchemas, t as AgentDefaultMeta, u as AgentWorkflowActorConfig, v as SchemaCompiler, w as AgentInteractionMeta, x as AgentInteractionDescriptor, y as AgentInteraction } from "./setup-agent-yFFVXf5s.cjs";
5
- import { C as runAgent, D as AgentRequest, E as traceTransitions, O as AgentStepRequest, S as isAgentIdle, T as serializeTraceEvent, _ as AgentTransitionHandler, a as AgentRunErrorCause, b as createAgentRuntime, c as AgentRunOptions, d as AgentRuntime, f as AgentRuntimeOptions, g as AgentTraceEvent, h as AgentTimerScheduler, i as AgentMaxModelCallsExceededError, l as AgentRunResult, m as AgentTimerEvent, n as AgentEffects, o as AgentRunInit, p as AgentSnapshotDivergedError, r as AgentInputFrom, s as AgentRunMeta, t as AGENT_TRACE_SCHEMA_VERSION, u as AgentRunStart, v as InspectedActorRef, w as runToQuiescence, x as inspectTransitions, y as JsonSerializableTraceEvent } from "./run-agent-B5opVUxx.cjs";
6
- import { c as AgentLogEntry, d as AgentMachineVersionMismatchError, n as AgentEventLogStore, t as AgentEventLogConflictError } from "./event-log-store-DTf_OzB-.cjs";
2
+ import { $ as AgentTruncatedError, A as AgentDecisionExhaustedError, B as createDecisionLogic, C as getAgentOutputMode, D as parseProviderOutput, E as parseOutput, F as CreateDecisionRequestOptions, G as AgentInvalidEventPayloadError, H as renderDecisionAttempts, I as DecisionAttempt, J as AgentSchemas, K as AgentRequestOptions, L as DecisionLogic, M as AgentDecisionOption, N as AgentDecisionRequest, O as providerOutputSchema, P as AgentExecutorDecisionRequest, Q as AgentError, R as DecisionLogicConfig, S as createTextLogic, T as getCallUsage, U as resolveDecision, V as createDecisionRequest, W as AgentEventDescriptor, X as getAcceptedEvents, Y as EventFromSnapshot, Z as parseAgentEvent, _ as TextLogic, a as AgentModelRef, b as TextLogicExecutor, c as AgentRequestExecutorInfo, f as AgentTextRequest, g as ProviderStructuredOutput, j as AgentDecisionInput, k as AgentDecisionExecutor, l as AgentRequestExecutorResult, m as AgentUsage, n as AgentExecutorTextRequest, o as AgentOutputMode, p as AgentTextResult, q as AgentRequestSource, r as AgentFinishReason, s as AgentRequestExecutor, t as AgentCallUsage, u as AgentRequestExecutors, v as TextLogicConfig, w as getCallFinishReason, x as bindRequestExecutor, y as TextLogicExecuteArgs, z as ResolveDecisionOptions } from "./text-logic-CYP502VT.cjs";
3
+ import { n as AgentUsageEvent, t as AGENT_USAGE_EVENT_TYPE } from "./usage-DVw-646x.cjs";
4
+ import { C as AgentInteractionEventMeta, D as getInteraction, E as eventFromInteraction, O as interactionMetaSchema, S as AgentInteractionEvent, T as GetInteractionOptions, _ as FromConfigResult, a as WithAgentUsageEvent, b as AgentInteractionChoice, c as setupAgent, d as AgentWorkflowConfig, f as AgentWorkflowInvokeConfig, g as FromConfigOptions, h as AgentWorkflowTransitionConfig, i as WithAgentEvents, l as AgentWorkflowActionConfig, m as AgentWorkflowStateConfig, n as AgentSchemaPack, o as createAgentSchemas, p as AgentWorkflowRequestConfig, r as AgentUsageEventPayload, s as getAgentSchemas, t as AgentDefaultMeta, u as AgentWorkflowActorConfig, v as SchemaCompiler, w as AgentInteractionMeta, x as AgentInteractionDescriptor, y as AgentInteraction } from "./setup-agent-BiF1N3td.cjs";
5
+ import { C as runAgent, D as AgentRequest, E as traceTransitions, O as AgentStepRequest, S as isAgentIdle, T as serializeTraceEvent, _ as AgentTransitionHandler, a as AgentRunErrorCause, b as createAgentRuntime, c as AgentRunOptions, d as AgentRuntime, f as AgentRuntimeOptions, g as AgentTraceEvent, h as AgentTimerScheduler, i as AgentMaxModelCallsExceededError, l as AgentRunResult, m as AgentTimerEvent, n as AgentEffects, o as AgentRunInit, p as AgentSnapshotDivergedError, r as AgentInputFrom, s as AgentRunMeta, t as AGENT_TRACE_SCHEMA_VERSION, u as AgentRunStart, v as InspectedActorRef, w as runToQuiescence, x as inspectTransitions, y as JsonSerializableTraceEvent } from "./run-agent-B5QhabdY.cjs";
6
+ import { c as AgentLogEntry, d as AgentMachineVersionMismatchError, n as AgentEventLogStore, t as AgentEventLogConflictError } from "./event-log-store-s73r1Hxf.cjs";
7
7
  import { a as getMachineStructuralHash, c as getStatePath, d as toolMessage, f as userMessage, i as getJsonSchemaSync, l as isStandardSchema, n as assistantMessage, o as getMessageText, r as getJsonSchema, s as getStateMeta, u as systemMessage } from "./utils-ebVpCYoF.cjs";
8
8
  import { AnyActorLogic, AnyMachineSnapshot, AnyStateMachine, ContextFrom, DoneActorEvent, EventFromLogic, InputFrom, OutputFrom, SnapshotFrom, StateValueFrom } from "xstate";
9
9
  //#region src/type-helpers.d.ts
@@ -197,9 +197,10 @@ interface PolicyDeciderOptions<TPolicy extends AnyStateMachine> extends Omit<Age
197
197
  * retry of one, needs its own thread: a thread that already has entries is
198
198
  * resumed, so a shared one would return an earlier decision's choice. Default
199
199
  * with a `store`: `policy:${info.callKey}:${hash}`, where `hash` is the
200
- * SHA-256 of the policy input's canonical JSON. The call key is unique per call and attempt and stays the
201
- * same when a crashed run re-issues the call; the hash keeps a fork that asks
202
- * something else at the same call site off the parent's thread. Required
200
+ * SHA-256 of the policy input's canonical JSON. The call key is unique per
201
+ * call and attempt and stays the same when a crashed run re-issues the call;
202
+ * the hash keeps a machine that asks something else at the same call site
203
+ * after a version bridge, which keeps the call key, off the earlier thread. Required
203
204
  * with a `store` when the decider is called without a `callKey`.
204
205
  */
205
206
  threadId?: (request: AgentExecutorDecisionRequest, info?: AgentRequestExecutorInfo) => string;
package/dist/index.d.mts CHANGED
@@ -1,9 +1,9 @@
1
1
  import { C as UserMessage, S as ToolResultPart, _ as StandardSchemaV1, a as AgentToolDescriptor, b as ToolCallPart, c as AllowedEvents, d as EventUnion, f as FilePart, h as InferOutput, i as AgentToolChoice, l as AssistantMessage, m as InferInput, n as AgentMessage, o as AgentToolExecute, p as ImagePart, r as AgentTool, s as AgentTools, u as ChosenEvent, v as SystemMessage, x as ToolMessage, y as TextPart } from "./types-Dp5_Ru4R.mjs";
2
- import { $ as AgentTruncatedError, A as AgentDecisionExhaustedError, B as createDecisionLogic, C as getAgentOutputMode, D as parseProviderOutput, E as parseOutput, F as CreateDecisionRequestOptions, G as AgentInvalidEventPayloadError, H as renderDecisionAttempts, I as DecisionAttempt, J as AgentSchemas, K as AgentRequestOptions, L as DecisionLogic, M as AgentDecisionOption, N as AgentDecisionRequest, O as providerOutputSchema, P as AgentExecutorDecisionRequest, Q as AgentError, R as DecisionLogicConfig, S as createTextLogic, T as getCallUsage, U as resolveDecision, V as createDecisionRequest, W as AgentEventDescriptor, X as getAcceptedEvents, Y as EventFromSnapshot, Z as parseAgentEvent, _ as TextLogic, a as AgentModelRef, b as TextLogicExecutor, c as AgentRequestExecutorInfo, f as AgentTextRequest, g as ProviderStructuredOutput, j as AgentDecisionInput, k as AgentDecisionExecutor, l as AgentRequestExecutorResult, m as AgentUsage, n as AgentExecutorTextRequest, o as AgentOutputMode, p as AgentTextResult, q as AgentRequestSource, r as AgentFinishReason, s as AgentRequestExecutor, t as AgentCallUsage, u as AgentRequestExecutors, v as TextLogicConfig, w as getCallFinishReason, x as bindRequestExecutor, y as TextLogicExecuteArgs, z as ResolveDecisionOptions } from "./text-logic-BwdrDpO9.mjs";
3
- import { n as AgentUsageEvent, t as AGENT_USAGE_EVENT_TYPE } from "./usage-Bl4nK8D-.mjs";
4
- import { C as AgentInteractionEventMeta, D as getInteraction, E as eventFromInteraction, O as interactionMetaSchema, S as AgentInteractionEvent, T as GetInteractionOptions, _ as FromConfigResult, a as WithAgentUsageEvent, b as AgentInteractionChoice, c as setupAgent, d as AgentWorkflowConfig, f as AgentWorkflowInvokeConfig, g as FromConfigOptions, h as AgentWorkflowTransitionConfig, i as WithAgentEvents, l as AgentWorkflowActionConfig, m as AgentWorkflowStateConfig, n as AgentSchemaPack, o as createAgentSchemas, p as AgentWorkflowRequestConfig, r as AgentUsageEventPayload, s as getAgentSchemas, t as AgentDefaultMeta, u as AgentWorkflowActorConfig, v as SchemaCompiler, w as AgentInteractionMeta, x as AgentInteractionDescriptor, y as AgentInteraction } from "./setup-agent-CPyg2ic7.mjs";
5
- import { C as runAgent, D as AgentRequest, E as traceTransitions, O as AgentStepRequest, S as isAgentIdle, T as serializeTraceEvent, _ as AgentTransitionHandler, a as AgentRunErrorCause, b as createAgentRuntime, c as AgentRunOptions, d as AgentRuntime, f as AgentRuntimeOptions, g as AgentTraceEvent, h as AgentTimerScheduler, i as AgentMaxModelCallsExceededError, l as AgentRunResult, m as AgentTimerEvent, n as AgentEffects, o as AgentRunInit, p as AgentSnapshotDivergedError, r as AgentInputFrom, s as AgentRunMeta, t as AGENT_TRACE_SCHEMA_VERSION, u as AgentRunStart, v as InspectedActorRef, w as runToQuiescence, x as inspectTransitions, y as JsonSerializableTraceEvent } from "./run-agent-D4MwS5GY.mjs";
6
- import { c as AgentLogEntry, d as AgentMachineVersionMismatchError, n as AgentEventLogStore, t as AgentEventLogConflictError } from "./event-log-store-RziIobdW.mjs";
2
+ import { $ as AgentTruncatedError, A as AgentDecisionExhaustedError, B as createDecisionLogic, C as getAgentOutputMode, D as parseProviderOutput, E as parseOutput, F as CreateDecisionRequestOptions, G as AgentInvalidEventPayloadError, H as renderDecisionAttempts, I as DecisionAttempt, J as AgentSchemas, K as AgentRequestOptions, L as DecisionLogic, M as AgentDecisionOption, N as AgentDecisionRequest, O as providerOutputSchema, P as AgentExecutorDecisionRequest, Q as AgentError, R as DecisionLogicConfig, S as createTextLogic, T as getCallUsage, U as resolveDecision, V as createDecisionRequest, W as AgentEventDescriptor, X as getAcceptedEvents, Y as EventFromSnapshot, Z as parseAgentEvent, _ as TextLogic, a as AgentModelRef, b as TextLogicExecutor, c as AgentRequestExecutorInfo, f as AgentTextRequest, g as ProviderStructuredOutput, j as AgentDecisionInput, k as AgentDecisionExecutor, l as AgentRequestExecutorResult, m as AgentUsage, n as AgentExecutorTextRequest, o as AgentOutputMode, p as AgentTextResult, q as AgentRequestSource, r as AgentFinishReason, s as AgentRequestExecutor, t as AgentCallUsage, u as AgentRequestExecutors, v as TextLogicConfig, w as getCallFinishReason, x as bindRequestExecutor, y as TextLogicExecuteArgs, z as ResolveDecisionOptions } from "./text-logic-DuK9HIFM.mjs";
3
+ import { n as AgentUsageEvent, t as AGENT_USAGE_EVENT_TYPE } from "./usage-D7JKAxLc.mjs";
4
+ import { C as AgentInteractionEventMeta, D as getInteraction, E as eventFromInteraction, O as interactionMetaSchema, S as AgentInteractionEvent, T as GetInteractionOptions, _ as FromConfigResult, a as WithAgentUsageEvent, b as AgentInteractionChoice, c as setupAgent, d as AgentWorkflowConfig, f as AgentWorkflowInvokeConfig, g as FromConfigOptions, h as AgentWorkflowTransitionConfig, i as WithAgentEvents, l as AgentWorkflowActionConfig, m as AgentWorkflowStateConfig, n as AgentSchemaPack, o as createAgentSchemas, p as AgentWorkflowRequestConfig, r as AgentUsageEventPayload, s as getAgentSchemas, t as AgentDefaultMeta, u as AgentWorkflowActorConfig, v as SchemaCompiler, w as AgentInteractionMeta, x as AgentInteractionDescriptor, y as AgentInteraction } from "./setup-agent-J9f_Wu5T.mjs";
5
+ import { C as runAgent, D as AgentRequest, E as traceTransitions, O as AgentStepRequest, S as isAgentIdle, T as serializeTraceEvent, _ as AgentTransitionHandler, a as AgentRunErrorCause, b as createAgentRuntime, c as AgentRunOptions, d as AgentRuntime, f as AgentRuntimeOptions, g as AgentTraceEvent, h as AgentTimerScheduler, i as AgentMaxModelCallsExceededError, l as AgentRunResult, m as AgentTimerEvent, n as AgentEffects, o as AgentRunInit, p as AgentSnapshotDivergedError, r as AgentInputFrom, s as AgentRunMeta, t as AGENT_TRACE_SCHEMA_VERSION, u as AgentRunStart, v as InspectedActorRef, w as runToQuiescence, x as inspectTransitions, y as JsonSerializableTraceEvent } from "./run-agent-Atu-wEk7.mjs";
6
+ import { c as AgentLogEntry, d as AgentMachineVersionMismatchError, n as AgentEventLogStore, t as AgentEventLogConflictError } from "./event-log-store-C2NjVlWU.mjs";
7
7
  import { a as getMachineStructuralHash, c as getStatePath, d as toolMessage, f as userMessage, i as getJsonSchemaSync, l as isStandardSchema, n as assistantMessage, o as getMessageText, r as getJsonSchema, s as getStateMeta, u as systemMessage } from "./utils-BnXdWih3.mjs";
8
8
  import { AnyActorLogic, AnyMachineSnapshot, AnyStateMachine, ContextFrom, DoneActorEvent, EventFromLogic, InputFrom, OutputFrom, SnapshotFrom, StateValueFrom } from "xstate";
9
9
  //#region src/type-helpers.d.ts
@@ -197,9 +197,10 @@ interface PolicyDeciderOptions<TPolicy extends AnyStateMachine> extends Omit<Age
197
197
  * retry of one, needs its own thread: a thread that already has entries is
198
198
  * resumed, so a shared one would return an earlier decision's choice. Default
199
199
  * with a `store`: `policy:${info.callKey}:${hash}`, where `hash` is the
200
- * SHA-256 of the policy input's canonical JSON. The call key is unique per call and attempt and stays the
201
- * same when a crashed run re-issues the call; the hash keeps a fork that asks
202
- * something else at the same call site off the parent's thread. Required
200
+ * SHA-256 of the policy input's canonical JSON. The call key is unique per
201
+ * call and attempt and stays the same when a crashed run re-issues the call;
202
+ * the hash keeps a machine that asks something else at the same call site
203
+ * after a version bridge, which keeps the call key, off the earlier thread. Required
203
204
  * with a `store` when the decider is called without a `callKey`.
204
205
  */
205
206
  threadId?: (request: AgentExecutorDecisionRequest, info?: AgentRequestExecutorInfo) => string;
package/dist/index.mjs CHANGED
@@ -1,8 +1,8 @@
1
- import { $ as getStateMeta, A as createTextLogic, C as AGENT_USAGE_EVENT_TYPE, H as getAgentExecutionOptions, I as parseOutput, L as parseProviderOutput, M as getCallFinishReason, N as getCallUsage, O as bindRequestExecutor, P as isTextLogic, Q as getMessageText, R as providerOutputSchema, V as executorBoundLogics, X as getJsonSchemaSync, Y as getJsonSchema, Z as getMachineStructuralHash, at as userMessage, dt as AgentTruncatedError, et as getStatePath, i as AgentMachineVersionMismatchError, it as toolMessage, j as getAgentOutputMode, l as assertJsonSerializable, lt as isRecord, q as assistantMessage, rt as systemMessage, tt as isStandardSchema, u as canonicalEventJson, ut as AgentError } from "./event-log-DE430ZCa.mjs";
2
- import { a as createDecisionRequest, c as renderDecisionAttempts, d as getAcceptedEvents, f as getHumanEventTypes, i as createDecisionLogic, l as resolveDecision, m as parseAgentEvent, p as isEventPattern, s as isDecisionLogic, t as AgentDecisionExhaustedError, u as AgentInvalidEventPayloadError } from "./decision-DqO018Tp.mjs";
3
- import { n as getAgentSchemas, r as setupAgent, t as createAgentSchemas } from "./setup-agent-BaffhCcM.mjs";
4
- import { t as AgentEventLogConflictError } from "./event-log-store-CCWdTPEP.mjs";
5
- import { a as bindDecisionForProvide, c as getConfiguredInvokeSrcs, d as isStateMachineLogic, f as runAgent, h as traceTransitions, i as bindChildMachineForProvide, l as inspectTransitions, m as serializeTraceEvent, n as AgentMaxModelCallsExceededError, o as bindTextForProvide, p as runToQuiescence, r as AgentSnapshotDivergedError, s as createAgentRuntime, t as AGENT_TRACE_SCHEMA_VERSION, u as isAgentIdle } from "./run-agent-DWZ1uyBJ.mjs";
1
+ import { $ as getStateMeta, A as createTextLogic, C as AGENT_USAGE_EVENT_TYPE, H as getAgentExecutionOptions, I as parseOutput, L as parseProviderOutput, M as getCallFinishReason, N as getCallUsage, O as bindRequestExecutor, P as isTextLogic, Q as getMessageText, R as providerOutputSchema, V as executorBoundLogics, X as getJsonSchemaSync, Y as getJsonSchema, Z as getMachineStructuralHash, at as userMessage, dt as AgentTruncatedError, et as getStatePath, i as AgentMachineVersionMismatchError, it as toolMessage, j as getAgentOutputMode, l as assertJsonSerializable, lt as isRecord, q as assistantMessage, rt as systemMessage, tt as isStandardSchema, u as canonicalEventJson, ut as AgentError } from "./event-log-DAqsalT1.mjs";
2
+ import { a as createDecisionRequest, c as renderDecisionAttempts, d as getAcceptedEvents, f as getHumanEventTypes, i as createDecisionLogic, l as resolveDecision, m as parseAgentEvent, p as isEventPattern, s as isDecisionLogic, t as AgentDecisionExhaustedError, u as AgentInvalidEventPayloadError } from "./decision-CV7WiV5C.mjs";
3
+ import { n as getAgentSchemas, r as setupAgent, t as createAgentSchemas } from "./setup-agent-CmhB-U5P.mjs";
4
+ import { t as AgentEventLogConflictError } from "./event-log-store-BGehvVTb.mjs";
5
+ import { a as bindDecisionForProvide, c as getConfiguredInvokeSrcs, d as isStateMachineLogic, f as runAgent, h as traceTransitions, i as bindChildMachineForProvide, l as inspectTransitions, m as serializeTraceEvent, n as AgentMaxModelCallsExceededError, o as bindTextForProvide, p as runToQuiescence, r as AgentSnapshotDivergedError, s as createAgentRuntime, t as AGENT_TRACE_SCHEMA_VERSION, u as isAgentIdle } from "./run-agent-2UnSUhDb.mjs";
6
6
  import { getNextTransitions, machineToJSON, transition } from "xstate";
7
7
  //#region src/messages.ts
8
8
  const KNOWN_PART_TYPES = /* @__PURE__ */ new Set([
package/dist/log.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_event_log = require("./event-log-Bdww2l1D.cjs");
3
- const require_event_log_store = require("./event-log-store-BWMLi6oh.cjs");
2
+ const require_event_log = require("./event-log-CKWeC7H-.cjs");
3
+ const require_event_log_store = require("./event-log-store-DKyE7JKr.cjs");
4
4
  //#region src/event-log-store-conformance.ts
5
5
  /**
6
6
  * The runner-agnostic conformance suite for {@link AgentEventLogStore}
@@ -30,8 +30,11 @@ function entry(index, type, metadata) {
30
30
  ...metadata !== void 0 ? { metadata } : {}
31
31
  };
32
32
  }
33
+ function initFixture(executionId = "exec-src") {
34
+ return entry(0, require_event_log.AGENT_INIT_EVENT_TYPE, { executionId });
35
+ }
33
36
  function entriesFrom(start, count) {
34
- return Array.from({ length: count }, (_unused, i) => entry(start + i, `e${start + i}`));
37
+ return Array.from({ length: count }, (_unused, i) => start + i === 0 ? initFixture() : entry(start + i, `e${start + i}`));
35
38
  }
36
39
  function assertJsonEqual(actual, expected, message) {
37
40
  const a = JSON.stringify(actual);
@@ -281,10 +284,42 @@ const cases = [
281
284
  expectedIndex: 1,
282
285
  entries: [entry(1, "branch")]
283
286
  });
284
- assertJsonEqual((await store.read("fork-1")).map((e) => e.event.type), ["e0", "branch"], "a forked thread must append independently from its copied length");
287
+ assertJsonEqual((await store.read("fork-1")).map((e) => e.event.type), [require_event_log.AGENT_INIT_EVENT_TYPE, "branch"], "a forked thread must append independently from its copied length");
285
288
  if (await store.length("src") !== 3) fail("appending to a fork must not touch the source thread");
286
289
  }
287
290
  },
291
+ {
292
+ name: "a fork is its own lineage: a fresh executionId, and forkedFrom naming the parent",
293
+ async run(create) {
294
+ const store = await create();
295
+ const source = entriesFrom(0, 3);
296
+ await store.append({
297
+ threadId: "src",
298
+ expectedIndex: 0,
299
+ entries: source
300
+ });
301
+ await store.fork({
302
+ threadId: "src",
303
+ newThreadId: "fork-a",
304
+ upToIndex: 2
305
+ });
306
+ await store.fork({
307
+ threadId: "src",
308
+ newThreadId: "fork-b",
309
+ upToIndex: 2
310
+ });
311
+ const [a, b] = [await store.read("fork-a"), await store.read("fork-b")];
312
+ const ids = [require_event_log.getLogExecutionId(a), require_event_log.getLogExecutionId(b)];
313
+ if (typeof ids[0] !== "string" || typeof ids[1] !== "string") fail("a fork's init entry must carry a string metadata.executionId");
314
+ if (ids.includes("exec-src") || ids[0] === ids[1]) fail("every fork must mint its own executionId, not reuse the parent's or a sibling's");
315
+ assertJsonEqual(a[0].metadata?.forkedFrom, {
316
+ executionId: "exec-src",
317
+ logIndex: 2
318
+ }, "a fork's init entry must record forkedFrom: { executionId, logIndex }");
319
+ assertJsonEqual(a.slice(1), source.slice(1, 2), "a fork must copy every entry after the init entry unchanged");
320
+ assertJsonEqual(await store.read("src"), source, "forking must not touch the source thread");
321
+ }
322
+ },
288
323
  {
289
324
  name: "fork rejects a non-empty target, an unknown source, and an out-of-range cutoff (0 included)",
290
325
  async run(create) {
@@ -357,7 +392,7 @@ const cases = [
357
392
  ]) await store.append({
358
393
  threadId,
359
394
  expectedIndex: 0,
360
- entries: [entry(0, "start")]
395
+ entries: [initFixture()]
361
396
  });
362
397
  await store.fork({
363
398
  threadId: "user:a",
package/dist/log.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { A as rebindActorSession, C as createReplayEntry, D as getSnapshotStateHash, E as getLogExecutionId, M as replay, N as validateReplayEntries, O as getUsageFromEvents, S as assertJsonSerializable, T as getDecisionAttempts, _ as NonSerializableAgentEventError, a as AGENT_INIT_EVENT_TYPE, b as agentCallOccurrence, c as AgentLogEntry, d as AgentMachineVersionMismatchError, f as AgentPersistedSnapshot, g as LogRecorder, h as JsonValue, i as AGENT_EVENT_SCHEMA_VERSION, j as recordLog, k as initEntry, 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 ReplayOptions, w as forkEventLog, x as assertAgentLogEntry, y as ReplayResult } from "./event-log-store-DTf_OzB-.cjs";
1
+ import { A as rebindActorSession, C as createReplayEntry, D as getSnapshotStateHash, E as getLogExecutionId, M as replay, N as validateReplayEntries, O as getUsageFromEvents, S as assertJsonSerializable, T as getDecisionAttempts, _ as NonSerializableAgentEventError, a as AGENT_INIT_EVENT_TYPE, b as agentCallOccurrence, c as AgentLogEntry, d as AgentMachineVersionMismatchError, f as AgentPersistedSnapshot, g as LogRecorder, h as JsonValue, i as AGENT_EVENT_SCHEMA_VERSION, j as recordLog, k as initEntry, 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 ReplayOptions, w as forkEventLog, x as assertAgentLogEntry, y as ReplayResult } from "./event-log-store-s73r1Hxf.cjs";
2
2
  //#region src/event-log-store-conformance.d.ts
3
3
  /** Produces a fresh, empty store for one case. */
4
4
  type CreateStore = () => Promise<AgentEventLogStore> | AgentEventLogStore;
package/dist/log.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { A as rebindActorSession, C as createReplayEntry, D as getSnapshotStateHash, E as getLogExecutionId, M as replay, N as validateReplayEntries, O as getUsageFromEvents, S as assertJsonSerializable, T as getDecisionAttempts, _ as NonSerializableAgentEventError, a as AGENT_INIT_EVENT_TYPE, b as agentCallOccurrence, c as AgentLogEntry, d as AgentMachineVersionMismatchError, f as AgentPersistedSnapshot, g as LogRecorder, h as JsonValue, i as AGENT_EVENT_SCHEMA_VERSION, j as recordLog, k as initEntry, 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 ReplayOptions, w as forkEventLog, x as assertAgentLogEntry, y as ReplayResult } from "./event-log-store-RziIobdW.mjs";
1
+ import { A as rebindActorSession, C as createReplayEntry, D as getSnapshotStateHash, E as getLogExecutionId, M as replay, N as validateReplayEntries, O as getUsageFromEvents, S as assertJsonSerializable, T as getDecisionAttempts, _ as NonSerializableAgentEventError, a as AGENT_INIT_EVENT_TYPE, b as agentCallOccurrence, c as AgentLogEntry, d as AgentMachineVersionMismatchError, f as AgentPersistedSnapshot, g as LogRecorder, h as JsonValue, i as AGENT_EVENT_SCHEMA_VERSION, j as recordLog, k as initEntry, 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 ReplayOptions, w as forkEventLog, x as assertAgentLogEntry, y as ReplayResult } from "./event-log-store-C2NjVlWU.mjs";
2
2
  //#region src/event-log-store-conformance.d.ts
3
3
  /** Produces a fresh, empty store for one case. */
4
4
  type CreateStore = () => Promise<AgentEventLogStore> | AgentEventLogStore;
package/dist/log.mjs CHANGED
@@ -1,5 +1,5 @@
1
- import { S as validateReplayEntries, _ as getUsageFromEvents, a as AgentReplayDivergenceError, b as recordLog, c as assertAgentLogEntry, d as createReplayEntry, g as getSnapshotStateHash, h as getLogExecutionId, i as AgentMachineVersionMismatchError, l as assertJsonSerializable, m as getDecisionAttempts, n as AGENT_INIT_EVENT_TYPE, o as NonSerializableAgentEventError, p as forkEventLog, r as AgentEventLogError, s as agentCallOccurrence, t as AGENT_EVENT_SCHEMA_VERSION, v as initEntry, x as replay, y as rebindActorSession } from "./event-log-DE430ZCa.mjs";
2
- import { n as createInMemoryEventLogStore, t as AgentEventLogConflictError } from "./event-log-store-CCWdTPEP.mjs";
1
+ import { S as validateReplayEntries, _ as getUsageFromEvents, a as AgentReplayDivergenceError, b as recordLog, c as assertAgentLogEntry, d as createReplayEntry, g as getSnapshotStateHash, h as getLogExecutionId, i as AgentMachineVersionMismatchError, l as assertJsonSerializable, m as getDecisionAttempts, n as AGENT_INIT_EVENT_TYPE, o as NonSerializableAgentEventError, p as forkEventLog, r as AgentEventLogError, s as agentCallOccurrence, t as AGENT_EVENT_SCHEMA_VERSION, v as initEntry, x as replay, y as rebindActorSession } from "./event-log-DAqsalT1.mjs";
2
+ import { n as createInMemoryEventLogStore, t as AgentEventLogConflictError } from "./event-log-store-BGehvVTb.mjs";
3
3
  //#region src/event-log-store-conformance.ts
4
4
  /**
5
5
  * The runner-agnostic conformance suite for {@link AgentEventLogStore}
@@ -29,8 +29,11 @@ function entry(index, type, metadata) {
29
29
  ...metadata !== void 0 ? { metadata } : {}
30
30
  };
31
31
  }
32
+ function initFixture(executionId = "exec-src") {
33
+ return entry(0, AGENT_INIT_EVENT_TYPE, { executionId });
34
+ }
32
35
  function entriesFrom(start, count) {
33
- return Array.from({ length: count }, (_unused, i) => entry(start + i, `e${start + i}`));
36
+ return Array.from({ length: count }, (_unused, i) => start + i === 0 ? initFixture() : entry(start + i, `e${start + i}`));
34
37
  }
35
38
  function assertJsonEqual(actual, expected, message) {
36
39
  const a = JSON.stringify(actual);
@@ -280,10 +283,42 @@ const cases = [
280
283
  expectedIndex: 1,
281
284
  entries: [entry(1, "branch")]
282
285
  });
283
- assertJsonEqual((await store.read("fork-1")).map((e) => e.event.type), ["e0", "branch"], "a forked thread must append independently from its copied length");
286
+ assertJsonEqual((await store.read("fork-1")).map((e) => e.event.type), [AGENT_INIT_EVENT_TYPE, "branch"], "a forked thread must append independently from its copied length");
284
287
  if (await store.length("src") !== 3) fail("appending to a fork must not touch the source thread");
285
288
  }
286
289
  },
290
+ {
291
+ name: "a fork is its own lineage: a fresh executionId, and forkedFrom naming the parent",
292
+ async run(create) {
293
+ const store = await create();
294
+ const source = entriesFrom(0, 3);
295
+ await store.append({
296
+ threadId: "src",
297
+ expectedIndex: 0,
298
+ entries: source
299
+ });
300
+ await store.fork({
301
+ threadId: "src",
302
+ newThreadId: "fork-a",
303
+ upToIndex: 2
304
+ });
305
+ await store.fork({
306
+ threadId: "src",
307
+ newThreadId: "fork-b",
308
+ upToIndex: 2
309
+ });
310
+ const [a, b] = [await store.read("fork-a"), await store.read("fork-b")];
311
+ const ids = [getLogExecutionId(a), getLogExecutionId(b)];
312
+ if (typeof ids[0] !== "string" || typeof ids[1] !== "string") fail("a fork's init entry must carry a string metadata.executionId");
313
+ if (ids.includes("exec-src") || ids[0] === ids[1]) fail("every fork must mint its own executionId, not reuse the parent's or a sibling's");
314
+ assertJsonEqual(a[0].metadata?.forkedFrom, {
315
+ executionId: "exec-src",
316
+ logIndex: 2
317
+ }, "a fork's init entry must record forkedFrom: { executionId, logIndex }");
318
+ assertJsonEqual(a.slice(1), source.slice(1, 2), "a fork must copy every entry after the init entry unchanged");
319
+ assertJsonEqual(await store.read("src"), source, "forking must not touch the source thread");
320
+ }
321
+ },
287
322
  {
288
323
  name: "fork rejects a non-empty target, an unknown source, and an out-of-range cutoff (0 included)",
289
324
  async run(create) {
@@ -356,7 +391,7 @@ const cases = [
356
391
  ]) await store.append({
357
392
  threadId,
358
393
  expectedIndex: 0,
359
- entries: [entry(0, "start")]
394
+ entries: [initFixture()]
360
395
  });
361
396
  await store.fork({
362
397
  threadId: "user:a",
package/dist/machines.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_setup_agent = require("./setup-agent-D0L8Anl_.cjs");
2
+ const require_setup_agent = require("./setup-agent-CwUJyqKB.cjs");
3
3
  //#region src/machines/internal.ts
4
4
  /** The builtin inline text request every preset lowers a request entry to. */
5
5
  const GENERATE_TEXT_SRC = "agent.generateText";
package/dist/machines.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { r as setupAgent } from "./setup-agent-BaffhCcM.mjs";
1
+ import { r as setupAgent } from "./setup-agent-CmhB-U5P.mjs";
2
2
  //#region src/machines/internal.ts
3
3
  /** The builtin inline text request every preset lowers a request entry to. */
4
4
  const GENERATE_TEXT_SRC = "agent.generateText";
@@ -1,4 +1,4 @@
1
- const require_event_log = require("./event-log-Bdww2l1D.cjs");
1
+ const require_event_log = require("./event-log-CKWeC7H-.cjs");
2
2
  //#region src/internal/model-source.ts
3
3
  function hasEntries(value) {
4
4
  return require_event_log.isRecord(value) && Object.keys(value).length > 0;
@@ -1,4 +1,4 @@
1
- import { H as getAgentExecutionOptions, lt as isRecord } from "./event-log-DE430ZCa.mjs";
1
+ import { H as getAgentExecutionOptions, lt as isRecord } from "./event-log-DAqsalT1.mjs";
2
2
  //#region src/internal/model-source.ts
3
3
  function hasEntries(value) {
4
4
  return isRecord(value) && Object.keys(value).length > 0;
package/dist/openai.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_event_log = require("./event-log-Bdww2l1D.cjs");
3
- const require_decision = require("./decision-Iys2hzg3.cjs");
2
+ const require_event_log = require("./event-log-CKWeC7H-.cjs");
3
+ const require_decision = require("./decision-BPdEaxPf.cjs");
4
4
  //#region src/openai/index.ts
5
5
  /** Thrown for a message part Chat Completions cannot carry — dropping it would
6
6
  * silently change what the model sees. */
package/dist/openai.d.cts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { i as AgentToolChoice, n as AgentMessage, s as AgentTools, u as ChosenEvent } from "./types-Dp5_Ru4R.cjs";
2
- import { N as AgentDecisionRequest, W as AgentEventDescriptor, c as AgentRequestExecutorInfo, f as AgentTextRequest, r as AgentFinishReason, t as AgentCallUsage } from "./text-logic-j9hShB7d.cjs";
2
+ import { N as AgentDecisionRequest, W as AgentEventDescriptor, c as AgentRequestExecutorInfo, f as AgentTextRequest, r as AgentFinishReason, t as AgentCallUsage } from "./text-logic-CYP502VT.cjs";
3
3
  import OpenAI from "openai";
4
4
  import { ChatCompletion, ChatCompletionCreateParamsNonStreaming, ChatCompletionMessageParam, ChatCompletionTool } from "openai/resources/chat/completions/completions.js";
5
5
  //#region src/openai/index.d.ts
package/dist/openai.d.mts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { i as AgentToolChoice, n as AgentMessage, s as AgentTools, u as ChosenEvent } from "./types-Dp5_Ru4R.mjs";
2
- import { N as AgentDecisionRequest, W as AgentEventDescriptor, c as AgentRequestExecutorInfo, f as AgentTextRequest, r as AgentFinishReason, t as AgentCallUsage } from "./text-logic-BwdrDpO9.mjs";
2
+ import { N as AgentDecisionRequest, W as AgentEventDescriptor, c as AgentRequestExecutorInfo, f as AgentTextRequest, r as AgentFinishReason, t as AgentCallUsage } from "./text-logic-DuK9HIFM.mjs";
3
3
  import OpenAI from "openai";
4
4
  import { ChatCompletion, ChatCompletionCreateParamsNonStreaming, ChatCompletionMessageParam, ChatCompletionTool } from "openai/resources/chat/completions/completions.js";
5
5
  //#region src/openai/index.d.ts
package/dist/openai.mjs CHANGED
@@ -1,5 +1,5 @@
1
- import { L as parseProviderOutput, R as providerOutputSchema, X as getJsonSchemaSync, Y as getJsonSchema, dt as AgentTruncatedError, j as getAgentOutputMode, tt as isStandardSchema, w as AGENT_USAGE_TOKEN_FIELDS } from "./event-log-DE430ZCa.mjs";
2
- import { c as renderDecisionAttempts } from "./decision-DqO018Tp.mjs";
1
+ import { L as parseProviderOutput, R as providerOutputSchema, X as getJsonSchemaSync, Y as getJsonSchema, dt as AgentTruncatedError, j as getAgentOutputMode, tt as isStandardSchema, w as AGENT_USAGE_TOKEN_FIELDS } from "./event-log-DAqsalT1.mjs";
2
+ import { c as renderDecisionAttempts } from "./decision-CV7WiV5C.mjs";
3
3
  //#region src/openai/index.ts
4
4
  /** Thrown for a message part Chat Completions cannot carry — dropping it would
5
5
  * silently change what the model sees. */
package/dist/otel.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { g as AgentTraceEvent } from "./run-agent-B5opVUxx.cjs";
1
+ import { g as AgentTraceEvent } from "./run-agent-B5QhabdY.cjs";
2
2
  import { Attributes, Tracer, TracerProvider } from "@opentelemetry/api";
3
3
  //#region src/otel/index.d.ts
4
4
  /** Options for {@link createOtelTraceHandler}. */
package/dist/otel.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { g as AgentTraceEvent } from "./run-agent-D4MwS5GY.mjs";
1
+ import { g as AgentTraceEvent } from "./run-agent-Atu-wEk7.mjs";
2
2
  import { Attributes, Tracer, TracerProvider } from "@opentelemetry/api";
3
3
  //#region src/otel/index.d.ts
4
4
  /** Options for {@link createOtelTraceHandler}. */
@@ -1,6 +1,6 @@
1
- import { B as responseMessagesOf, C as AGENT_USAGE_EVENT_TYPE, F as normalizeGeneratorResult, J as findNonSerializableContextPaths, M as getCallFinishReason, N as getCallUsage, P as isTextLogic, S as validateReplayEntries, U as getRegisteredAgentExecutionOptions, V as executorBoundLogics, W as isUnboundPlaceholder, _ as getUsageFromEvents, d as createReplayEntry, f as foldLog, g as getSnapshotStateHash, h as getLogExecutionId, i as AgentMachineVersionMismatchError, l as assertJsonSerializable, nt as resolveMachineVersion, ot as validateSchemaSync, s as agentCallOccurrence, st as canonicalJson, tt as isStandardSchema, u as canonicalEventJson, ut as AgentError, v as initEntry, x as replay } from "./event-log-DE430ZCa.mjs";
2
- import { d as getAcceptedEvents, f as getHumanEventTypes, l as resolveDecision, n as acceptedDecisionOptions, s as isDecisionLogic, t as AgentDecisionExhaustedError } from "./decision-DqO018Tp.mjs";
3
- import { t as AgentEventLogConflictError } from "./event-log-store-CCWdTPEP.mjs";
1
+ import { B as responseMessagesOf, C as AGENT_USAGE_EVENT_TYPE, F as normalizeGeneratorResult, J as findNonSerializableContextPaths, M as getCallFinishReason, N as getCallUsage, P as isTextLogic, S as validateReplayEntries, U as getRegisteredAgentExecutionOptions, V as executorBoundLogics, W as isUnboundPlaceholder, _ as getUsageFromEvents, d as createReplayEntry, f as foldLog, g as getSnapshotStateHash, h as getLogExecutionId, i as AgentMachineVersionMismatchError, l as assertJsonSerializable, nt as resolveMachineVersion, ot as validateSchemaSync, s as agentCallOccurrence, st as canonicalJson, tt as isStandardSchema, u as canonicalEventJson, ut as AgentError, v as initEntry, x as replay } from "./event-log-DAqsalT1.mjs";
2
+ import { d as getAcceptedEvents, f as getHumanEventTypes, l as resolveDecision, n as acceptedDecisionOptions, s as isDecisionLogic, t as AgentDecisionExhaustedError } from "./decision-CV7WiV5C.mjs";
3
+ import { t as AgentEventLogConflictError } from "./event-log-store-BGehvVTb.mjs";
4
4
  import { createAsyncLogic, getNextTransitions, isMachineSnapshot, stopActor } from "xstate";
5
5
  import { createDurable } from "xstate/durable";
6
6
  //#region src/run-agent.ts
@@ -886,7 +886,7 @@ function assertThreadMatchesEvents(threadId, stored, events) {
886
886
  const givenEntry = events[index];
887
887
  const storedHash = storedEntry.verification?.stateHash;
888
888
  const givenHash = givenEntry.verification?.stateHash;
889
- if (!(storedEntry.id === givenEntry.id && storedEntry.index === givenEntry.index && canonicalEventJson(storedEntry.event) === canonicalEventJson(givenEntry.event) && (storedHash === void 0 || givenHash === void 0 || storedHash === givenHash))) throw new AgentError("event-log-conflict", `createAgentRuntime: the given \`events\` diverge from thread "${threadId}" at index ${index} (stored entry '${storedEntry.id}', given '${givenEntry.id}') — the log passed in is not this thread's log.`);
889
+ if (!(storedEntry.id === givenEntry.id && storedEntry.index === givenEntry.index && canonicalEventJson(storedEntry.event) === canonicalEventJson(givenEntry.event) && (storedHash === void 0 || givenHash === void 0 || storedHash === givenHash) && (index > 0 || getLogExecutionId([storedEntry]) === getLogExecutionId([givenEntry])))) throw new AgentError("event-log-conflict", `createAgentRuntime: the given \`events\` diverge from thread "${threadId}" at index ${index} (stored entry '${storedEntry.id}', given '${givenEntry.id}') — the log passed in is not this thread's log.`);
890
890
  }
891
891
  }
892
892
  const QUIESCENT = Symbol("quiescent");
@@ -1407,7 +1407,9 @@ function createAgentRuntime(machine, options = {}) {
1407
1407
  machineVersion: tail.machineVersion
1408
1408
  });
1409
1409
  const bridgeMeta = readAgentMeta(init.snapshot);
1410
- if (inheritedExecutionId === void 0 || bridgeMeta?.logId !== inheritedExecutionId) throw new AgentMachineVersionMismatchError(tail.id, tail.index, {
1410
+ const forkedFrom = resumeEvents[0].metadata?.forkedFrom;
1411
+ const parentCache = forkedFrom?.executionId !== void 0 && bridgeMeta?.logId === forkedFrom.executionId && forkedFrom.logIndex === resumeEvents.length;
1412
+ if (inheritedExecutionId === void 0 || bridgeMeta?.logId !== inheritedExecutionId && !parentCache) throw new AgentMachineVersionMismatchError(tail.id, tail.index, {
1411
1413
  machineId,
1412
1414
  machineVersion
1413
1415
  }, {
@@ -1,7 +1,7 @@
1
1
  import { _ as StandardSchemaV1, m as InferInput, s as AgentTools, w as WithAgentInputSchema } from "./types-Dp5_Ru4R.mjs";
2
- import { I as DecisionAttempt, N as AgentDecisionRequest, Q as AgentError, W as AgentEventDescriptor, d as AgentRequestMode, f as AgentTextRequest, m as AgentUsage, q as AgentRequestSource, r as AgentFinishReason, t as AgentCallUsage, u as AgentRequestExecutors } from "./text-logic-BwdrDpO9.mjs";
3
- import { n as AgentUsageEvent } from "./usage-Bl4nK8D-.mjs";
4
- import { c as AgentLogEntry, h as JsonValue$1, n as AgentEventLogStore } from "./event-log-store-RziIobdW.mjs";
2
+ import { I as DecisionAttempt, N as AgentDecisionRequest, Q as AgentError, W as AgentEventDescriptor, d as AgentRequestMode, f as AgentTextRequest, m as AgentUsage, q as AgentRequestSource, r as AgentFinishReason, t as AgentCallUsage, u as AgentRequestExecutors } from "./text-logic-DuK9HIFM.mjs";
3
+ import { n as AgentUsageEvent } from "./usage-D7JKAxLc.mjs";
4
+ import { c as AgentLogEntry, h as JsonValue$1, n as AgentEventLogStore } from "./event-log-store-C2NjVlWU.mjs";
5
5
  import { AnyActorLogic, AnyActorRef, AnyMachineSnapshot, AnyStateMachine, AsyncActorLogic, EmittedFrom, EventFromLogic, EventObject, InputFrom, InspectionEvent, OutputFrom, Snapshot, SnapshotFrom, StateValue } from "xstate";
6
6
  import { DurableExecution } from "xstate/durable";
7
7
  //#region src/steps.d.ts
@@ -1,7 +1,7 @@
1
1
  import { _ as StandardSchemaV1, m as InferInput, s as AgentTools, w as WithAgentInputSchema } from "./types-Dp5_Ru4R.cjs";
2
- import { I as DecisionAttempt, N as AgentDecisionRequest, Q as AgentError, W as AgentEventDescriptor, d as AgentRequestMode, f as AgentTextRequest, m as AgentUsage, q as AgentRequestSource, r as AgentFinishReason, t as AgentCallUsage, u as AgentRequestExecutors } from "./text-logic-j9hShB7d.cjs";
3
- import { n as AgentUsageEvent } from "./usage-BYqv7VBw.cjs";
4
- import { c as AgentLogEntry, h as JsonValue$1, n as AgentEventLogStore } from "./event-log-store-DTf_OzB-.cjs";
2
+ import { I as DecisionAttempt, N as AgentDecisionRequest, Q as AgentError, W as AgentEventDescriptor, d as AgentRequestMode, f as AgentTextRequest, m as AgentUsage, q as AgentRequestSource, r as AgentFinishReason, t as AgentCallUsage, u as AgentRequestExecutors } from "./text-logic-CYP502VT.cjs";
3
+ import { n as AgentUsageEvent } from "./usage-DVw-646x.cjs";
4
+ import { c as AgentLogEntry, h as JsonValue$1, n as AgentEventLogStore } from "./event-log-store-s73r1Hxf.cjs";
5
5
  import { AnyActorLogic, AnyActorRef, AnyMachineSnapshot, AnyStateMachine, AsyncActorLogic, EmittedFrom, EventFromLogic, EventObject, InputFrom, InspectionEvent, OutputFrom, Snapshot, SnapshotFrom, StateValue } from "xstate";
6
6
  import { DurableExecution } from "xstate/durable";
7
7
  //#region src/steps.d.ts
@@ -1,6 +1,6 @@
1
- const require_event_log = require("./event-log-Bdww2l1D.cjs");
2
- const require_decision = require("./decision-Iys2hzg3.cjs");
3
- const require_event_log_store = require("./event-log-store-BWMLi6oh.cjs");
1
+ const require_event_log = require("./event-log-CKWeC7H-.cjs");
2
+ const require_decision = require("./decision-BPdEaxPf.cjs");
3
+ const require_event_log_store = require("./event-log-store-DKyE7JKr.cjs");
4
4
  let xstate = require("xstate");
5
5
  let xstate_durable = require("xstate/durable");
6
6
  //#region src/run-agent.ts
@@ -886,7 +886,7 @@ function assertThreadMatchesEvents(threadId, stored, events) {
886
886
  const givenEntry = events[index];
887
887
  const storedHash = storedEntry.verification?.stateHash;
888
888
  const givenHash = givenEntry.verification?.stateHash;
889
- if (!(storedEntry.id === givenEntry.id && storedEntry.index === givenEntry.index && require_event_log.canonicalEventJson(storedEntry.event) === require_event_log.canonicalEventJson(givenEntry.event) && (storedHash === void 0 || givenHash === void 0 || storedHash === givenHash))) throw new require_event_log.AgentError("event-log-conflict", `createAgentRuntime: the given \`events\` diverge from thread "${threadId}" at index ${index} (stored entry '${storedEntry.id}', given '${givenEntry.id}') — the log passed in is not this thread's log.`);
889
+ if (!(storedEntry.id === givenEntry.id && storedEntry.index === givenEntry.index && require_event_log.canonicalEventJson(storedEntry.event) === require_event_log.canonicalEventJson(givenEntry.event) && (storedHash === void 0 || givenHash === void 0 || storedHash === givenHash) && (index > 0 || require_event_log.getLogExecutionId([storedEntry]) === require_event_log.getLogExecutionId([givenEntry])))) throw new require_event_log.AgentError("event-log-conflict", `createAgentRuntime: the given \`events\` diverge from thread "${threadId}" at index ${index} (stored entry '${storedEntry.id}', given '${givenEntry.id}') — the log passed in is not this thread's log.`);
890
890
  }
891
891
  }
892
892
  const QUIESCENT = Symbol("quiescent");
@@ -1407,7 +1407,9 @@ function createAgentRuntime(machine, options = {}) {
1407
1407
  machineVersion: tail.machineVersion
1408
1408
  });
1409
1409
  const bridgeMeta = readAgentMeta(init.snapshot);
1410
- if (inheritedExecutionId === void 0 || bridgeMeta?.logId !== inheritedExecutionId) throw new require_event_log.AgentMachineVersionMismatchError(tail.id, tail.index, {
1410
+ const forkedFrom = resumeEvents[0].metadata?.forkedFrom;
1411
+ const parentCache = forkedFrom?.executionId !== void 0 && bridgeMeta?.logId === forkedFrom.executionId && forkedFrom.logIndex === resumeEvents.length;
1412
+ if (inheritedExecutionId === void 0 || bridgeMeta?.logId !== inheritedExecutionId && !parentCache) throw new require_event_log.AgentMachineVersionMismatchError(tail.id, tail.index, {
1411
1413
  machineId,
1412
1414
  machineVersion
1413
1415
  }, {
@@ -1,6 +1,6 @@
1
1
  import { _ as StandardSchemaV1, d as EventUnion, g as NormalizedEventSchemas, h as InferOutput, i as AgentToolChoice, m as InferInput, s as AgentTools, t as AgentEventSchemaInputMap, w as WithAgentInputSchema } from "./types-Dp5_Ru4R.cjs";
2
- import { J as AgentSchemas, Y as EventFromSnapshot, _ as TextLogic, a as AgentModelRef, d as AgentRequestMode, h as BuiltinAgentActors, i as AgentModelMap, v as TextLogicConfig } from "./text-logic-j9hShB7d.cjs";
3
- import { n as AgentUsageEvent, t as AGENT_USAGE_EVENT_TYPE } from "./usage-BYqv7VBw.cjs";
2
+ import { J as AgentSchemas, Y as EventFromSnapshot, _ as TextLogic, a as AgentModelRef, d as AgentRequestMode, h as BuiltinAgentActors, i as AgentModelMap, v as TextLogicConfig } from "./text-logic-CYP502VT.cjs";
3
+ import { n as AgentUsageEvent, t as AGENT_USAGE_EVENT_TYPE } from "./usage-DVw-646x.cjs";
4
4
  import { AnyActorLogic, AnyMachineSnapshot, AnySetupConfig, AnyStateMachine, AsyncActorLogic, EventObject, MachineContext, MetaObject, NonReducibleUnknown, SetupReturnFromConfig, SetupStateSchema } from "xstate";
5
5
  //#region src/interaction.d.ts
6
6
  interface AgentInteractionEvent<TType extends string = string> {
@@ -1,5 +1,5 @@
1
- import { A as createTextLogic, C as AGENT_USAGE_EVENT_TYPE, G as missingActor, H as getAgentExecutionOptions, K as setAgentExecutionOptions, T as DECIDE_ACTOR, ct as isPlainObject, k as builtinTextActors, ot as validateSchemaSync, ut as AgentError } from "./event-log-DE430ZCa.mjs";
2
- import { r as createDecideActor } from "./decision-DqO018Tp.mjs";
1
+ import { A as createTextLogic, C as AGENT_USAGE_EVENT_TYPE, G as missingActor, H as getAgentExecutionOptions, K as setAgentExecutionOptions, T as DECIDE_ACTOR, ct as isPlainObject, k as builtinTextActors, ot as validateSchemaSync, ut as AgentError } from "./event-log-DAqsalT1.mjs";
2
+ import { r as createDecideActor } from "./decision-CV7WiV5C.mjs";
3
3
  import { machineFromJSON, setup } from "xstate";
4
4
  //#region src/workflow-config.ts
5
5
  /**
@@ -1,5 +1,5 @@
1
- const require_event_log = require("./event-log-Bdww2l1D.cjs");
2
- const require_decision = require("./decision-Iys2hzg3.cjs");
1
+ const require_event_log = require("./event-log-CKWeC7H-.cjs");
2
+ const require_decision = require("./decision-BPdEaxPf.cjs");
3
3
  let xstate = require("xstate");
4
4
  //#region src/workflow-config.ts
5
5
  /**
@@ -1,6 +1,6 @@
1
1
  import { _ as StandardSchemaV1, d as EventUnion, g as NormalizedEventSchemas, h as InferOutput, i as AgentToolChoice, m as InferInput, s as AgentTools, t as AgentEventSchemaInputMap, w as WithAgentInputSchema } from "./types-Dp5_Ru4R.mjs";
2
- import { J as AgentSchemas, Y as EventFromSnapshot, _ as TextLogic, a as AgentModelRef, d as AgentRequestMode, h as BuiltinAgentActors, i as AgentModelMap, v as TextLogicConfig } from "./text-logic-BwdrDpO9.mjs";
3
- import { n as AgentUsageEvent, t as AGENT_USAGE_EVENT_TYPE } from "./usage-Bl4nK8D-.mjs";
2
+ import { J as AgentSchemas, Y as EventFromSnapshot, _ as TextLogic, a as AgentModelRef, d as AgentRequestMode, h as BuiltinAgentActors, i as AgentModelMap, v as TextLogicConfig } from "./text-logic-DuK9HIFM.mjs";
3
+ import { n as AgentUsageEvent, t as AGENT_USAGE_EVENT_TYPE } from "./usage-D7JKAxLc.mjs";
4
4
  import { AnyActorLogic, AnyMachineSnapshot, AnySetupConfig, AnyStateMachine, AsyncActorLogic, EventObject, MachineContext, MetaObject, NonReducibleUnknown, SetupReturnFromConfig, SetupStateSchema } from "xstate";
5
5
  //#region src/interaction.d.ts
6
6
  interface AgentInteractionEvent<TType extends string = string> {
@@ -1,7 +1,7 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_event_log = require("./event-log-Bdww2l1D.cjs");
3
- const require_decision = require("./decision-Iys2hzg3.cjs");
4
- const require_model_source = require("./model-source-DQ7KgJaT.cjs");
2
+ const require_event_log = require("./event-log-CKWeC7H-.cjs");
3
+ const require_decision = require("./decision-BPdEaxPf.cjs");
4
+ const require_model_source = require("./model-source-BQ97_l1-.cjs");
5
5
  let _tanstack_ai = require("@tanstack/ai");
6
6
  //#region src/tanstack-ai/index.ts
7
7
  /**
@@ -1,5 +1,5 @@
1
1
  import { i as AgentToolChoice, n as AgentMessage, s as AgentTools, u as ChosenEvent } from "./types-Dp5_Ru4R.cjs";
2
- import { N as AgentDecisionRequest, W as AgentEventDescriptor, c as AgentRequestExecutorInfo, f as AgentTextRequest, r as AgentFinishReason, t as AgentCallUsage } from "./text-logic-j9hShB7d.cjs";
2
+ import { N as AgentDecisionRequest, W as AgentEventDescriptor, c as AgentRequestExecutorInfo, f as AgentTextRequest, r as AgentFinishReason, t as AgentCallUsage } from "./text-logic-CYP502VT.cjs";
3
3
  import { AnyStateMachine } from "xstate";
4
4
  import { AnyTextAdapter, ModelMessage, StreamChunk, TokenUsage, Tool } from "@tanstack/ai";
5
5
  import { TextActivityOptions } from "@tanstack/ai/adapters";
@@ -1,5 +1,5 @@
1
1
  import { i as AgentToolChoice, n as AgentMessage, s as AgentTools, u as ChosenEvent } from "./types-Dp5_Ru4R.mjs";
2
- import { N as AgentDecisionRequest, W as AgentEventDescriptor, c as AgentRequestExecutorInfo, f as AgentTextRequest, r as AgentFinishReason, t as AgentCallUsage } from "./text-logic-BwdrDpO9.mjs";
2
+ import { N as AgentDecisionRequest, W as AgentEventDescriptor, c as AgentRequestExecutorInfo, f as AgentTextRequest, r as AgentFinishReason, t as AgentCallUsage } from "./text-logic-DuK9HIFM.mjs";
3
3
  import { AnyStateMachine } from "xstate";
4
4
  import { AnyTextAdapter, ModelMessage, StreamChunk, TokenUsage, Tool } from "@tanstack/ai";
5
5
  import { TextActivityOptions } from "@tanstack/ai/adapters";
@@ -1,6 +1,6 @@
1
- import { L as parseProviderOutput, R as providerOutputSchema, X as getJsonSchemaSync, Y as getJsonSchema, dt as AgentTruncatedError, j as getAgentOutputMode, tt as isStandardSchema, w as AGENT_USAGE_TOKEN_FIELDS } from "./event-log-DE430ZCa.mjs";
2
- import { c as renderDecisionAttempts } from "./decision-DqO018Tp.mjs";
3
- import { t as resolveModelSource } from "./model-source-CXsSZPq0.mjs";
1
+ import { L as parseProviderOutput, R as providerOutputSchema, X as getJsonSchemaSync, Y as getJsonSchema, dt as AgentTruncatedError, j as getAgentOutputMode, tt as isStandardSchema, w as AGENT_USAGE_TOKEN_FIELDS } from "./event-log-DAqsalT1.mjs";
2
+ import { c as renderDecisionAttempts } from "./decision-CV7WiV5C.mjs";
3
+ import { t as resolveModelSource } from "./model-source-BilDEyqk.mjs";
4
4
  import { chat, maxIterations } from "@tanstack/ai";
5
5
  //#region src/tanstack-ai/index.ts
6
6
  /**
package/dist/testing.cjs CHANGED
@@ -1,7 +1,7 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_event_log = require("./event-log-Bdww2l1D.cjs");
3
- const require_run_agent = require("./run-agent-tmk58M0x.cjs");
4
- const require_verify = require("./verify-CS_xxvVU.cjs");
2
+ const require_event_log = require("./event-log-CKWeC7H-.cjs");
3
+ const require_run_agent = require("./run-agent-Cg0xd3K-.cjs");
4
+ const require_verify = require("./verify-D_llRCTr.cjs");
5
5
  //#region src/trajectory.ts
6
6
  /**
7
7
  * Classifies one item. Event-shaped things (log entries, events) become events;
@@ -1,7 +1,7 @@
1
- import { P as AgentExecutorDecisionRequest, c as AgentRequestExecutorInfo, f as AgentTextRequest, s as AgentRequestExecutor, t as AgentCallUsage, u as AgentRequestExecutors } from "./text-logic-j9hShB7d.cjs";
2
- import { f as AgentRuntimeOptions, l as AgentRunResult, o as AgentRunInit } from "./run-agent-B5opVUxx.cjs";
1
+ import { P as AgentExecutorDecisionRequest, c as AgentRequestExecutorInfo, f as AgentTextRequest, s as AgentRequestExecutor, t as AgentCallUsage, u as AgentRequestExecutors } from "./text-logic-CYP502VT.cjs";
2
+ import { f as AgentRuntimeOptions, l as AgentRunResult, o as AgentRunInit } from "./run-agent-B5QhabdY.cjs";
3
3
  import { t as MetaOfSnapshot } from "./utils-ebVpCYoF.cjs";
4
- import { _ as assertAgentMachine, a as AgentPathTerminal, b as lintAgentMachine, c as CanReachResult, d as ExploreSnapshot, f as LintAgentMachineOptions, g as SimulationTrailEntry, h as SimulationScript, i as AgentPathReport, l as CanReachTarget, m as SimulateAgentResult, n as AgentLintError, o as AgentUnknownStateError, p as SimulateAgentOptions, r as AgentLintSeverity, s as AssertAgentMachineOptions, t as AgentLintDiagnostic, u as ExplorePathsOptions, v as canReach, x as simulateAgent, y as explorePaths } from "./verify-CPKDPMwY.cjs";
4
+ import { _ as assertAgentMachine, a as AgentPathTerminal, b as lintAgentMachine, c as CanReachResult, d as ExploreSnapshot, f as LintAgentMachineOptions, g as SimulationTrailEntry, h as SimulationScript, i as AgentPathReport, l as CanReachTarget, m as SimulateAgentResult, n as AgentLintError, o as AgentUnknownStateError, p as SimulateAgentOptions, r as AgentLintSeverity, s as AssertAgentMachineOptions, t as AgentLintDiagnostic, u as ExplorePathsOptions, v as canReach, x as simulateAgent, y as explorePaths } from "./verify-Dk3Vwnha.cjs";
5
5
  import { AnyStateMachine, EventFromLogic, InputFrom, SnapshotFrom, StateValue } from "xstate";
6
6
  //#region src/trajectory.d.ts
7
7
  /** An event-shaped trajectory item: anything with a string `type`. */
@@ -1,7 +1,7 @@
1
- import { P as AgentExecutorDecisionRequest, c as AgentRequestExecutorInfo, f as AgentTextRequest, s as AgentRequestExecutor, t as AgentCallUsage, u as AgentRequestExecutors } from "./text-logic-BwdrDpO9.mjs";
2
- import { f as AgentRuntimeOptions, l as AgentRunResult, o as AgentRunInit } from "./run-agent-D4MwS5GY.mjs";
1
+ import { P as AgentExecutorDecisionRequest, c as AgentRequestExecutorInfo, f as AgentTextRequest, s as AgentRequestExecutor, t as AgentCallUsage, u as AgentRequestExecutors } from "./text-logic-DuK9HIFM.mjs";
2
+ import { f as AgentRuntimeOptions, l as AgentRunResult, o as AgentRunInit } from "./run-agent-Atu-wEk7.mjs";
3
3
  import { t as MetaOfSnapshot } from "./utils-BnXdWih3.mjs";
4
- import { _ as assertAgentMachine, a as AgentPathTerminal, b as lintAgentMachine, c as CanReachResult, d as ExploreSnapshot, f as LintAgentMachineOptions, g as SimulationTrailEntry, h as SimulationScript, i as AgentPathReport, l as CanReachTarget, m as SimulateAgentResult, n as AgentLintError, o as AgentUnknownStateError, p as SimulateAgentOptions, r as AgentLintSeverity, s as AssertAgentMachineOptions, t as AgentLintDiagnostic, u as ExplorePathsOptions, v as canReach, x as simulateAgent, y as explorePaths } from "./verify-tkymWz6X.mjs";
4
+ import { _ as assertAgentMachine, a as AgentPathTerminal, b as lintAgentMachine, c as CanReachResult, d as ExploreSnapshot, f as LintAgentMachineOptions, g as SimulationTrailEntry, h as SimulationScript, i as AgentPathReport, l as CanReachTarget, m as SimulateAgentResult, n as AgentLintError, o as AgentUnknownStateError, p as SimulateAgentOptions, r as AgentLintSeverity, s as AssertAgentMachineOptions, t as AgentLintDiagnostic, u as ExplorePathsOptions, v as canReach, x as simulateAgent, y as explorePaths } from "./verify-BVz4cURF.mjs";
5
5
  import { AnyStateMachine, EventFromLogic, InputFrom, SnapshotFrom, StateValue } from "xstate";
6
6
  //#region src/trajectory.d.ts
7
7
  /** An event-shaped trajectory item: anything with a string `type`. */
package/dist/testing.mjs CHANGED
@@ -1,6 +1,6 @@
1
- import { $ as getStateMeta, F as normalizeGeneratorResult, N as getCallUsage, lt as isRecord, ut as AgentError } from "./event-log-DE430ZCa.mjs";
2
- import { p as runToQuiescence, s as createAgentRuntime } from "./run-agent-DWZ1uyBJ.mjs";
3
- import { a as explorePaths, i as canReach, n as AgentUnknownStateError, o as lintAgentMachine, r as assertAgentMachine, s as simulateAgent, t as AgentLintError } from "./verify-BH5e0XLK.mjs";
1
+ import { $ as getStateMeta, F as normalizeGeneratorResult, N as getCallUsage, lt as isRecord, ut as AgentError } from "./event-log-DAqsalT1.mjs";
2
+ import { p as runToQuiescence, s as createAgentRuntime } from "./run-agent-2UnSUhDb.mjs";
3
+ import { a as explorePaths, i as canReach, n as AgentUnknownStateError, o as lintAgentMachine, r as assertAgentMachine, s as simulateAgent, t as AgentLintError } from "./verify-CoCvR1eM.mjs";
4
4
  //#region src/trajectory.ts
5
5
  /**
6
6
  * Classifies one item. Event-shaped things (log entries, events) become events;
@@ -818,9 +818,11 @@ interface AgentRequestExecutorInfo {
818
818
  * `a` being the number of prior failed attempts), so a retry never collides
819
819
  * with the rejected attempt it is replacing.
820
820
  *
821
- * It identifies the CALL SITE, not the request: a fork inherits its parent's
822
- * lineage id, so cache on `callKey` together with a fingerprint of the
823
- * request and reuse a cached result only when the request also matches.
821
+ * It identifies the CALL SITE, not the request: a version bridge keeps the
822
+ * lineage id, so a migrated machine can ask something else under the same
823
+ * key. Cache on `callKey` together with a fingerprint of the request and
824
+ * reuse a cached result only when the request also matches. A fork mints
825
+ * its own lineage id, so its keys never match its parent's.
824
826
  *
825
827
  * Undefined off the `createAgentRuntime` path, and for a log with no `executionId`.
826
828
  */
@@ -818,9 +818,11 @@ interface AgentRequestExecutorInfo {
818
818
  * `a` being the number of prior failed attempts), so a retry never collides
819
819
  * with the rejected attempt it is replacing.
820
820
  *
821
- * It identifies the CALL SITE, not the request: a fork inherits its parent's
822
- * lineage id, so cache on `callKey` together with a fingerprint of the
823
- * request and reuse a cached result only when the request also matches.
821
+ * It identifies the CALL SITE, not the request: a version bridge keeps the
822
+ * lineage id, so a migrated machine can ask something else under the same
823
+ * key. Cache on `callKey` together with a fingerprint of the request and
824
+ * reuse a cached result only when the request also matches. A fork mints
825
+ * its own lineage id, so its keys never match its parent's.
824
826
  *
825
827
  * Undefined off the `createAgentRuntime` path, and for a log with no `executionId`.
826
828
  */
@@ -1,4 +1,4 @@
1
- import { t as AgentCallUsage } from "./text-logic-j9hShB7d.cjs";
1
+ import { t as AgentCallUsage } from "./text-logic-DuK9HIFM.mjs";
2
2
  import { EventObject } from "xstate";
3
3
  //#region src/usage.d.ts
4
4
  /** Reserved event delivered after a model call reports token usage. */
@@ -1,4 +1,4 @@
1
- import { t as AgentCallUsage } from "./text-logic-BwdrDpO9.mjs";
1
+ import { t as AgentCallUsage } from "./text-logic-CYP502VT.cjs";
2
2
  import { EventObject } from "xstate";
3
3
  //#region src/usage.d.ts
4
4
  /** Reserved event delivered after a model call reports token usage. */
package/dist/validate.cjs CHANGED
@@ -21,9 +21,9 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
21
21
  enumerable: true
22
22
  }) : target, mod));
23
23
  //#endregion
24
- const require_event_log = require("./event-log-Bdww2l1D.cjs");
25
- const require_setup_agent = require("./setup-agent-D0L8Anl_.cjs");
26
- const require_verify = require("./verify-CS_xxvVU.cjs");
24
+ const require_event_log = require("./event-log-CKWeC7H-.cjs");
25
+ const require_setup_agent = require("./setup-agent-CwUJyqKB.cjs");
26
+ const require_verify = require("./verify-D_llRCTr.cjs");
27
27
  let ajv_dist_2020_js = require("ajv/dist/2020.js");
28
28
  ajv_dist_2020_js = __toESM(ajv_dist_2020_js, 1);
29
29
  //#region schemas/agent-workflow.json
@@ -1,5 +1,5 @@
1
- import { d as AgentWorkflowConfig, g as FromConfigOptions, v as SchemaCompiler } from "./setup-agent-yFFVXf5s.cjs";
2
- import { u as ExplorePathsOptions } from "./verify-CPKDPMwY.cjs";
1
+ import { d as AgentWorkflowConfig, g as FromConfigOptions, v as SchemaCompiler } from "./setup-agent-BiF1N3td.cjs";
2
+ import { u as ExplorePathsOptions } from "./verify-Dk3Vwnha.cjs";
3
3
  import { AnyActorLogic, AnyStateMachine } from "xstate";
4
4
  //#region src/validate/validate-config.d.ts
5
5
  /**
@@ -1,5 +1,5 @@
1
- import { d as AgentWorkflowConfig, g as FromConfigOptions, v as SchemaCompiler } from "./setup-agent-CPyg2ic7.mjs";
2
- import { u as ExplorePathsOptions } from "./verify-tkymWz6X.mjs";
1
+ import { d as AgentWorkflowConfig, g as FromConfigOptions, v as SchemaCompiler } from "./setup-agent-J9f_Wu5T.mjs";
2
+ import { u as ExplorePathsOptions } from "./verify-BVz4cURF.mjs";
3
3
  import { AnyActorLogic, AnyStateMachine } from "xstate";
4
4
  //#region src/validate/validate-config.d.ts
5
5
  /**
package/dist/validate.mjs CHANGED
@@ -1,6 +1,6 @@
1
- import { D as STREAM_TEXT_ACTOR, E as GENERATE_TEXT_ACTOR, T as DECIDE_ACTOR } from "./event-log-DE430ZCa.mjs";
2
- import { i as setupAgentFromConfig } from "./setup-agent-BaffhCcM.mjs";
3
- import { a as explorePaths, o as lintAgentMachine } from "./verify-BH5e0XLK.mjs";
1
+ import { D as STREAM_TEXT_ACTOR, E as GENERATE_TEXT_ACTOR, T as DECIDE_ACTOR } from "./event-log-DAqsalT1.mjs";
2
+ import { i as setupAgentFromConfig } from "./setup-agent-CmhB-U5P.mjs";
3
+ import { a as explorePaths, o as lintAgentMachine } from "./verify-CoCvR1eM.mjs";
4
4
  import Ajv2020 from "ajv/dist/2020.js";
5
5
  //#region schemas/agent-workflow.json
6
6
  var agent_workflow_default = {
@@ -1,5 +1,5 @@
1
1
  import { u as ChosenEvent } from "./types-Dp5_Ru4R.mjs";
2
- import { Q as AgentError } from "./text-logic-BwdrDpO9.mjs";
2
+ import { Q as AgentError } from "./text-logic-DuK9HIFM.mjs";
3
3
  import { AnyMachineSnapshot, AnyStateMachine } from "xstate";
4
4
  //#region src/verify.d.ts
5
5
  /** Severity of an {@link AgentLintDiagnostic}. `error` findings fail CI/the CLI; `warning`s are advisory. */
@@ -1,5 +1,5 @@
1
- import { P as isTextLogic, U as getRegisteredAgentExecutionOptions, V as executorBoundLogics, X as getJsonSchemaSync, lt as isRecord, ut as AgentError } from "./event-log-DE430ZCa.mjs";
2
- import { d as getAcceptedEvents, f as getHumanEventTypes, l as resolveDecision, n as acceptedDecisionOptions, p as isEventPattern, s as isDecisionLogic, t as AgentDecisionExhaustedError } from "./decision-DqO018Tp.mjs";
1
+ import { P as isTextLogic, U as getRegisteredAgentExecutionOptions, V as executorBoundLogics, X as getJsonSchemaSync, lt as isRecord, ut as AgentError } from "./event-log-DAqsalT1.mjs";
2
+ import { d as getAcceptedEvents, f as getHumanEventTypes, l as resolveDecision, n as acceptedDecisionOptions, p as isEventPattern, s as isDecisionLogic, t as AgentDecisionExhaustedError } from "./decision-CV7WiV5C.mjs";
3
3
  import { getNextTransitions, initialTransition, machineToJSON, transition } from "xstate";
4
4
  //#region src/steps.ts
5
5
  /**
@@ -1,5 +1,5 @@
1
- const require_event_log = require("./event-log-Bdww2l1D.cjs");
2
- const require_decision = require("./decision-Iys2hzg3.cjs");
1
+ const require_event_log = require("./event-log-CKWeC7H-.cjs");
2
+ const require_decision = require("./decision-BPdEaxPf.cjs");
3
3
  let xstate = require("xstate");
4
4
  //#region src/steps.ts
5
5
  /**
@@ -1,5 +1,5 @@
1
1
  import { u as ChosenEvent } from "./types-Dp5_Ru4R.cjs";
2
- import { Q as AgentError } from "./text-logic-j9hShB7d.cjs";
2
+ import { Q as AgentError } from "./text-logic-CYP502VT.cjs";
3
3
  import { AnyMachineSnapshot, AnyStateMachine } from "xstate";
4
4
  //#region src/verify.d.ts
5
5
  /** Severity of an {@link AgentLintDiagnostic}. `error` findings fail CI/the CLI; `warning`s are advisory. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@statelyai/agent",
3
- "version": "2.0.0-alpha.31",
3
+ "version": "2.0.0-alpha.32",
4
4
  "description": "Make invalid agent actions impossible. Agent logic as state machines: deterministic, inspectable, resumable, runs anywhere.",
5
5
  "keywords": [
6
6
  "agent",