@statelyai/agent 2.0.0-alpha.33 → 2.0.0-alpha.35

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 (64) hide show
  1. package/CHANGELOG.md +45 -0
  2. package/dist/ai-sdk.cjs +114 -63
  3. package/dist/ai-sdk.d.cts +11 -2
  4. package/dist/ai-sdk.d.mts +11 -2
  5. package/dist/ai-sdk.mjs +115 -64
  6. package/dist/{decision-BPdEaxPf.cjs → decision-BEsATcr1.cjs} +18 -2
  7. package/dist/{decision-CV7WiV5C.mjs → decision-COkJNjOW.mjs} +18 -2
  8. package/dist/{event-log-CKWeC7H-.cjs → event-log-BWSSLUff.cjs} +139 -10
  9. package/dist/{event-log-DAqsalT1.mjs → event-log-C7jeH0y8.mjs} +123 -12
  10. package/dist/{event-log-store-C2NjVlWU.d.mts → event-log-store-BzXehP7R.d.cts} +28 -3
  11. package/dist/{event-log-store-s73r1Hxf.d.cts → event-log-store-CWjN6lmM.d.mts} +28 -3
  12. package/dist/{event-log-store-DKyE7JKr.cjs → event-log-store-CleWpsp5.cjs} +1 -1
  13. package/dist/{event-log-store-BGehvVTb.mjs → event-log-store-W49TCJXi.mjs} +1 -1
  14. package/dist/index.cjs +5 -5
  15. package/dist/index.d.cts +7 -7
  16. package/dist/index.d.mts +7 -7
  17. package/dist/index.mjs +5 -5
  18. package/dist/log.cjs +2 -2
  19. package/dist/log.d.cts +1 -1
  20. package/dist/log.d.mts +1 -1
  21. package/dist/log.mjs +2 -2
  22. package/dist/machines.cjs +1 -1
  23. package/dist/machines.mjs +1 -1
  24. package/dist/{model-source-BilDEyqk.mjs → model-source-CK3F4YuU.mjs} +1 -1
  25. package/dist/{model-source-BQ97_l1-.cjs → model-source-DmhTMK39.cjs} +1 -1
  26. package/dist/openai.cjs +377 -95
  27. package/dist/openai.d.cts +55 -20
  28. package/dist/openai.d.mts +55 -20
  29. package/dist/openai.mjs +375 -96
  30. package/dist/otel.d.cts +1 -1
  31. package/dist/otel.d.mts +1 -1
  32. package/dist/{run-agent-B5QhabdY.d.cts → run-agent-B1-Eqviq.d.cts} +13 -5
  33. package/dist/{run-agent-Atu-wEk7.d.mts → run-agent-BGdx5913.d.mts} +13 -5
  34. package/dist/{run-agent-2UnSUhDb.mjs → run-agent-Ct_GZw_f.mjs} +124 -38
  35. package/dist/{run-agent-Cg0xd3K-.cjs → run-agent-s5D32w99.cjs} +123 -37
  36. package/dist/{setup-agent-CmhB-U5P.mjs → setup-agent-05uw4dPZ.mjs} +2 -2
  37. package/dist/{setup-agent-BiF1N3td.d.cts → setup-agent-BtfeFfF6.d.cts} +2 -2
  38. package/dist/{setup-agent-J9f_Wu5T.d.mts → setup-agent-C6nqzv_X.d.mts} +2 -2
  39. package/dist/{setup-agent-CwUJyqKB.cjs → setup-agent-CXEBURdo.cjs} +2 -2
  40. package/dist/tanstack-ai.cjs +91 -59
  41. package/dist/tanstack-ai.d.cts +13 -2
  42. package/dist/tanstack-ai.d.mts +13 -2
  43. package/dist/tanstack-ai.mjs +91 -59
  44. package/dist/testing.cjs +629 -13
  45. package/dist/testing.d.cts +278 -6
  46. package/dist/testing.d.mts +278 -6
  47. package/dist/testing.mjs +626 -14
  48. package/dist/{text-logic-CYP502VT.d.cts → text-logic-CV_4KGr6.d.cts} +28 -3
  49. package/dist/{text-logic-DuK9HIFM.d.mts → text-logic-Ckh-rJFV.d.mts} +28 -3
  50. package/dist/{usage-D7JKAxLc.d.mts → usage-BDiJKyv9.d.cts} +11 -1
  51. package/dist/{usage-DVw-646x.d.cts → usage-DOoVUGVq.d.mts} +11 -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-Dk3Vwnha.d.cts → verify-BQpE8hUz.d.cts} +1 -1
  57. package/dist/{verify-DgB8P-Wx.mjs → verify-Bpahmr34.mjs} +2 -2
  58. package/dist/{verify-BVz4cURF.d.mts → verify-CqeuEmIk.d.mts} +1 -1
  59. package/dist/{verify-CS_WLRXn.cjs → verify-DCLZa9R0.cjs} +2 -2
  60. package/dist/with-model-calls-BXYdBdcu.cjs +45 -0
  61. package/dist/with-model-calls-Bv4V4EHC.mjs +34 -0
  62. package/package.json +5 -5
  63. package/readme.md +14 -13
  64. package/skills/loop-to-machine/SKILL.md +42 -2
@@ -1,4 +1,4 @@
1
- import { createAsyncLogic, initialTransition, transition } from "xstate";
1
+ import { createAsyncLogic, initialTransition, isMachineSnapshot, transition } from "xstate";
2
2
  //#region src/errors.ts
3
3
  /**
4
4
  * Base class for every error this package throws. Carries a stable, kebab-case
@@ -167,6 +167,7 @@ function getMachineStructuralHash(machine) {
167
167
  function resolveMachineVersion(machine) {
168
168
  return machine.version ?? getMachineStructuralHash(machine);
169
169
  }
170
+ const STRUCTURAL_CACHE_KEYS = /* @__PURE__ */ new Set(["_candidateCache"]);
170
171
  function stableStructuralString(value, seen = /* @__PURE__ */ new WeakSet()) {
171
172
  if (value === null) return "null";
172
173
  const type = typeof value;
@@ -184,7 +185,7 @@ function stableStructuralString(value, seen = /* @__PURE__ */ new WeakSet()) {
184
185
  for (const key of Object.keys(obj).sort()) {
185
186
  const child = obj[key];
186
187
  const childType = typeof child;
187
- if (childType === "function" || childType === "undefined" || childType === "symbol") continue;
188
+ if (childType === "function" || childType === "undefined" || childType === "symbol" || STRUCTURAL_CACHE_KEYS.has(key)) continue;
188
189
  parts.push(`${JSON.stringify(key)}:${stableStructuralString(child, seen)}`);
189
190
  }
190
191
  out = `{${parts.join(",")}}`;
@@ -428,6 +429,11 @@ function getCallFinishReason(raw) {
428
429
  if (value === "error") return "other";
429
430
  return AGENT_FINISH_REASONS.has(value) ? value : void 0;
430
431
  }
432
+ /** Provider calls a raw executor result reports (`modelCalls`, a whole number of at least 1), else 1. @internal */
433
+ function getCallModelCalls(raw) {
434
+ const value = raw?.modelCalls;
435
+ return typeof value === "number" && Number.isInteger(value) && value > 1 ? value : 1;
436
+ }
431
437
  /** The token fields {@link AgentUsage} aggregates. @internal */
432
438
  const AGENT_USAGE_TOKEN_FIELDS = [
433
439
  "inputTokens",
@@ -984,6 +990,8 @@ function assertAgentLogEntry(entry) {
984
990
  if (candidate.metadata !== void 0 && (candidate.metadata === null || typeof candidate.metadata !== "object" || Array.isArray(candidate.metadata))) throw new AgentEventLogError("Agent event entry.metadata must be an object when present.");
985
991
  if (candidate.verification !== void 0 && (candidate.verification === null || typeof candidate.verification !== "object" || typeof candidate.verification.stateHash !== "string" || !candidate.verification.stateHash)) throw new AgentEventLogError("Agent event entry.verification requires a non-empty stateHash string.");
986
992
  if (candidate.attempts !== void 0) assertLogAttempts(candidate.attempts);
993
+ if (candidate.decidedBy !== void 0) requireNonEmptyString(candidate.decidedBy, "entry.decidedBy", " when present");
994
+ if (candidate.actorPath !== void 0 && (!Array.isArray(candidate.actorPath) || candidate.actorPath.length === 0 || !candidate.actorPath.every((id) => typeof id === "string" && id !== ""))) throw new AgentEventLogError("Agent event entry.actorPath must be a non-empty array of invoke ids when present.");
987
995
  }
988
996
  function assertLogAttempts(attempts) {
989
997
  if (!Array.isArray(attempts) || !attempts.every((attempt) => attempt !== null && typeof attempt === "object" && typeof attempt.failure === "string" && typeof attempt.reason === "string")) throw new AgentEventLogError("Agent event entry.attempts requires an array of { failure, reason } objects.");
@@ -1098,7 +1106,7 @@ function canonicalizeForHash(value, seen = /* @__PURE__ */ new WeakSet(), positi
1098
1106
  if (value instanceof Map) return [...value.entries()].map(([key, item]) => [canonicalizeForHash(key, seen, "data"), canonicalizeForHash(item, seen, "data")]).sort(([a], [b]) => stableJson(a).localeCompare(stableJson(b)));
1099
1107
  if (Array.isArray(value)) return value.map((item) => canonicalizeForHash(item, seen, "data"));
1100
1108
  const volatileKeys = position === "snapshot" ? SNAPSHOT_VOLATILE_KEYS : position === "child" ? CHILD_VOLATILE_KEYS : void 0;
1101
- const result = {};
1109
+ const result = Object.create(null);
1102
1110
  for (const key of Object.keys(value).sort()) {
1103
1111
  if (volatileKeys?.has(key)) continue;
1104
1112
  const child = value[key];
@@ -1176,7 +1184,9 @@ function createReplayEntry(machine, entries, event, options = {}) {
1176
1184
  event: normalizeDoneActorEvent(pruneUndefined(normalizeEventErrors(event))),
1177
1185
  ...options.causationId !== void 0 ? { causationId: options.causationId } : {},
1178
1186
  ...options.metadata !== void 0 ? { metadata: options.metadata } : {},
1179
- ...options.attempts !== void 0 && options.attempts.length > 0 ? { attempts: options.attempts } : {}
1187
+ ...options.attempts !== void 0 && options.attempts.length > 0 ? { attempts: options.attempts } : {},
1188
+ ...options.decidedBy !== void 0 ? { decidedBy: options.decidedBy } : {},
1189
+ ...options.actorPath !== void 0 ? { actorPath: [...options.actorPath] } : {}
1180
1190
  };
1181
1191
  assertAgentLogEntry(entry);
1182
1192
  if (entry.attempts !== void 0) entry.attempts = structuredClone(entry.attempts);
@@ -1325,16 +1335,40 @@ function toEvents(history) {
1325
1335
  });
1326
1336
  }
1327
1337
  /**
1338
+ * An invoke site as call keys name it: the invoke ids from the root down,
1339
+ * joined with `/`, each id escaped so an id holding a `/` cannot read as a
1340
+ * child path. @internal
1341
+ */
1342
+ function agentCallSite(actorPath, siteId) {
1343
+ return [...actorPath, siteId].map((id) => id.replaceAll("%", "%25").replaceAll("/", "%2F")).join("/");
1344
+ }
1345
+ /**
1328
1346
  * The 1-based occurrence `n` for the NEXT call at invoke site `siteId`:
1329
1347
  * `1 + completions`, where a completion is a journaled `xstate.done.actor` OR
1330
- * `xstate.error.actor` for that `actorId` (an error is a semantic completion).
1348
+ * `xstate.error.actor` for that `actorId` (an error is a semantic completion),
1349
+ * or a distinct `entry.decidedBy` call at that site: a decision settles by
1350
+ * sending its chosen event, which usually ends the invoke before it completes.
1351
+ * Entries marked `decidedBy` are counted once per call, never as completions.
1352
+ * A site inside an invoked child machine is named by that child's
1353
+ * `actorPath` too, and only entries delivered to that child count.
1331
1354
  * The one counting rule behind every `${siteId}#${n}` call key, so a live run
1332
1355
  * and a replay derive the same `n` by construction.
1333
1356
  */
1334
- function agentCallOccurrence(history, siteId) {
1357
+ function agentCallOccurrence(history, siteId, actorPath = []) {
1335
1358
  let count = 0;
1336
- for (const event of toEvents(history)) if ((event.type === DONE_ACTOR_EVENT_TYPE || event.type === ERROR_ACTOR_EVENT_TYPE) && event.actorId === siteId) count++;
1337
- return count + 1;
1359
+ const decided = /* @__PURE__ */ new Set();
1360
+ const site = agentCallSite(actorPath, siteId);
1361
+ for (const item of history ?? []) {
1362
+ const event = toEvents([item])[0];
1363
+ const entry = event === item ? void 0 : item;
1364
+ if (entry?.decidedBy !== void 0) {
1365
+ const { decidedBy } = entry;
1366
+ if (decidedBy.slice(0, decidedBy.lastIndexOf("#")) === site) decided.add(decidedBy);
1367
+ continue;
1368
+ }
1369
+ if ((event.type === DONE_ACTOR_EVENT_TYPE || event.type === ERROR_ACTOR_EVENT_TYPE) && event.actorId === siteId && (entry?.actorPath ?? []).join("\0") === actorPath.join("\0")) count++;
1370
+ }
1371
+ return count + decided.size + 1;
1338
1372
  }
1339
1373
  /**
1340
1374
  * Folds the reserved `@agent.usage` entries of a log into one cumulative usage
@@ -1446,6 +1480,39 @@ function toError(normalized) {
1446
1480
  error.name = name;
1447
1481
  return Object.assign(error, rest);
1448
1482
  }
1483
+ function countStarts(before, after, path, starts) {
1484
+ const known = /* @__PURE__ */ new Set();
1485
+ const collect = (snapshot) => {
1486
+ for (const ref of Object.values(snapshot.children ?? {})) {
1487
+ if (ref === void 0) continue;
1488
+ known.add(ref.sessionId);
1489
+ const childSnapshot = ref.getSnapshot();
1490
+ if (isMachineSnapshot(childSnapshot)) collect(childSnapshot);
1491
+ }
1492
+ };
1493
+ if (before !== void 0) collect(before);
1494
+ const walk = (snapshot, at) => {
1495
+ for (const [id, ref] of Object.entries(snapshot.children ?? {})) {
1496
+ if (ref === void 0) continue;
1497
+ const site = agentCallSite(at, id);
1498
+ if (!known.has(ref.sessionId)) starts.set(site, (starts.get(site) ?? 0) + 1);
1499
+ const childSnapshot = ref.getSnapshot();
1500
+ if (isMachineSnapshot(childSnapshot)) walk(childSnapshot, [...at, id]);
1501
+ }
1502
+ };
1503
+ walk(after, path);
1504
+ }
1505
+ function collectSessionRemints(before, after, out) {
1506
+ const afterChildren = after.children ?? {};
1507
+ for (const [id, old] of Object.entries(before.children ?? {})) {
1508
+ const now = afterChildren[id];
1509
+ if (old === void 0 || now === void 0) continue;
1510
+ out.set(old.sessionId, now.sessionId);
1511
+ const oldSnapshot = old.getSnapshot();
1512
+ const nowSnapshot = now.getSnapshot();
1513
+ if (oldSnapshot?.children && nowSnapshot?.children) collectSessionRemints(oldSnapshot, nowSnapshot, out);
1514
+ }
1515
+ }
1449
1516
  function verifyEntry(entry, persisted, mode) {
1450
1517
  if (mode === false) return;
1451
1518
  if (!entry.verification) {
@@ -1490,13 +1557,56 @@ function foldLog(machine, entries, options = {}) {
1490
1557
  let snapshot = initEvent.snapshot !== void 0 ? machine.restoreSnapshot(initEvent.snapshot) : initialTransition(machine, initEvent.input)[0];
1491
1558
  let persisted = machine.getPersistedSnapshot(snapshot);
1492
1559
  verifyEntry(entries[0], persisted, options.verify);
1560
+ const starts = /* @__PURE__ */ new Map();
1561
+ countStarts(void 0, snapshot, [], starts);
1493
1562
  const sessions = /* @__PURE__ */ new Map();
1563
+ const sessionsOf = (path) => {
1564
+ const key = path.join("\0");
1565
+ let map = sessions.get(key);
1566
+ if (map === void 0) sessions.set(key, map = /* @__PURE__ */ new Map());
1567
+ return map;
1568
+ };
1494
1569
  const apply = (entry) => {
1495
- const event = restoreJournaledEvent(rebindActorSession(entry.event, snapshot, sessions));
1496
- [snapshot] = transition(machine, snapshot, event);
1570
+ if (entry.actorPath !== void 0) applyToChild(entry, entry.actorPath);
1571
+ else {
1572
+ const event = restoreJournaledEvent(rebindActorSession(entry.event, snapshot, sessionsOf([])));
1573
+ const before = snapshot;
1574
+ [snapshot] = transition(machine, snapshot, event);
1575
+ countStarts(before, snapshot, [], starts);
1576
+ }
1497
1577
  persisted = machine.getPersistedSnapshot(snapshot);
1498
1578
  return persisted;
1499
1579
  };
1580
+ const applyToChild = (entry, path) => {
1581
+ let child;
1582
+ let owner = snapshot;
1583
+ for (const id of path) {
1584
+ child = owner.children[id];
1585
+ const childSnapshot = child?.getSnapshot();
1586
+ if (child === void 0 || !isMachineSnapshot(childSnapshot)) throw new AgentEventLogError(`Agent event entry '${entry.id}' (index ${entry.index}) is addressed to child machine '${path.join(" > ")}', which the fold has no machine actor for at that point.`);
1587
+ owner = childSnapshot;
1588
+ }
1589
+ const event = restoreJournaledEvent(rebindActorSession(entry.event, owner, sessionsOf(path)));
1590
+ let next;
1591
+ try {
1592
+ [next] = transition(child.logic, owner, event);
1593
+ } catch {
1594
+ return;
1595
+ }
1596
+ countStarts(owner, next, path, starts);
1597
+ const root = machine.getPersistedSnapshot(snapshot);
1598
+ let holder = root;
1599
+ for (const id of path.slice(0, -1)) holder = holder.children[id].snapshot;
1600
+ holder.children[path[path.length - 1]].snapshot = child.logic.getPersistedSnapshot(next);
1601
+ const before = snapshot;
1602
+ snapshot = machine.restoreSnapshot(root);
1603
+ const reminted = /* @__PURE__ */ new Map();
1604
+ collectSessionRemints(before, snapshot, reminted);
1605
+ for (const map of sessions.values()) for (const [recorded, current] of map) {
1606
+ const now = reminted.get(current);
1607
+ if (now !== void 0) map.set(recorded, now);
1608
+ }
1609
+ };
1500
1610
  for (let index = 1; index < entries.length; index++) {
1501
1611
  const entry = entries[index];
1502
1612
  verifyEntry(entry, apply(entry), options.verify);
@@ -1508,7 +1618,8 @@ function foldLog(machine, entries, options = {}) {
1508
1618
  get persistedSnapshot() {
1509
1619
  return persisted;
1510
1620
  },
1511
- apply
1621
+ apply,
1622
+ starts: (site) => starts.get(site) ?? 0
1512
1623
  };
1513
1624
  }
1514
1625
  /**
@@ -1570,4 +1681,4 @@ function recordLog(actor) {
1570
1681
  };
1571
1682
  }
1572
1683
  //#endregion
1573
- export { getStateMeta as $, createTextLogic as A, responseMessagesOf as B, AGENT_USAGE_EVENT_TYPE as C, STREAM_TEXT_ACTOR as D, GENERATE_TEXT_ACTOR as E, normalizeGeneratorResult as F, missingActor as G, getAgentExecutionOptions as H, parseOutput as I, findNonSerializableContextPaths as J, setAgentExecutionOptions as K, parseProviderOutput as L, getCallFinishReason as M, getCallUsage as N, bindRequestExecutor as O, isTextLogic as P, getMessageText as Q, providerOutputSchema as R, validateReplayEntries as S, DECIDE_ACTOR as T, getRegisteredAgentExecutionOptions as U, executorBoundLogics as V, isUnboundPlaceholder as W, getJsonSchemaSync as X, getJsonSchema as Y, getMachineStructuralHash as Z, getUsageFromEvents as _, AgentReplayDivergenceError as a, userMessage as at, recordLog as b, assertAgentLogEntry as c, isPlainObject as ct, createReplayEntry as d, AgentTruncatedError as dt, getStatePath as et, foldLog as f, getSnapshotStateHash as g, getLogExecutionId as h, AgentMachineVersionMismatchError as i, toolMessage as it, getAgentOutputMode as j, builtinTextActors as k, assertJsonSerializable as l, isRecord as lt, getDecisionAttempts as m, AGENT_INIT_EVENT_TYPE as n, resolveMachineVersion as nt, NonSerializableAgentEventError as o, validateSchemaSync as ot, forkEventLog as p, assistantMessage as q, AgentEventLogError as r, systemMessage as rt, agentCallOccurrence as s, canonicalJson as st, AGENT_EVENT_SCHEMA_VERSION as t, isStandardSchema as tt, canonicalEventJson as u, AgentError as ut, initEntry as v, AGENT_USAGE_TOKEN_FIELDS as w, replay as x, rebindActorSession as y, resolveTextLogicValue as z };
1684
+ export { getMachineStructuralHash as $, builtinTextActors as A, providerOutputSchema as B, validateReplayEntries as C, GENERATE_TEXT_ACTOR as D, DECIDE_ACTOR as E, getCallUsage as F, getRegisteredAgentExecutionOptions as G, responseMessagesOf as H, isTextLogic as I, setAgentExecutionOptions as J, isUnboundPlaceholder as K, normalizeGeneratorResult as L, getAgentOutputMode as M, getCallFinishReason as N, STREAM_TEXT_ACTOR as O, getCallModelCalls as P, getJsonSchemaSync as Q, parseOutput as R, replay as S, AGENT_USAGE_TOKEN_FIELDS as T, executorBoundLogics as U, resolveTextLogicValue as V, getAgentExecutionOptions as W, findNonSerializableContextPaths as X, assistantMessage as Y, getJsonSchema as Z, getSnapshotStateHash as _, AgentReplayDivergenceError as a, systemMessage as at, rebindActorSession as b, agentCallSite as c, validateSchemaSync as ct, canonicalEventJson as d, isPlainObject as dt, getMessageText as et, createReplayEntry as f, isRecord as ft, getLogExecutionId as g, getDecisionAttempts as h, AgentMachineVersionMismatchError as i, resolveMachineVersion as it, createTextLogic as j, bindRequestExecutor as k, assertAgentLogEntry as l, canonicalJson as lt, forkEventLog as m, AgentTruncatedError as mt, AGENT_INIT_EVENT_TYPE as n, getStatePath as nt, NonSerializableAgentEventError as o, toolMessage as ot, foldLog as p, AgentError as pt, missingActor as q, AgentEventLogError as r, isStandardSchema as rt, agentCallOccurrence as s, userMessage as st, AGENT_EVENT_SCHEMA_VERSION as t, getStateMeta as tt, assertJsonSerializable as u, isError as ut, getUsageFromEvents as v, AGENT_USAGE_EVENT_TYPE as w, recordLog as x, initEntry as y, parseProviderOutput as z };
@@ -1,4 +1,4 @@
1
- import { I as DecisionAttempt, Q as AgentError, t as AgentCallUsage } from "./text-logic-DuK9HIFM.mjs";
1
+ import { $ as AgentError, L as DecisionAttempt, t as AgentCallUsage } from "./text-logic-CV_4KGr6.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. */
@@ -54,6 +54,22 @@ interface AgentLogEntry {
54
54
  * does not change the fold.
55
55
  */
56
56
  attempts?: DecisionAttempt[];
57
+ /**
58
+ * The `agent.decide` call this entry settles, as `${siteId}#${n}` (its call
59
+ * key without the execution id): the chosen event it sent, and its
60
+ * `xstate.done.actor` when the event left the invoke running. A decision
61
+ * that settles by sending its event has no completion of its own, so
62
+ * {@link agentCallOccurrence} counts it from this. Replay-ignored.
63
+ */
64
+ decidedBy?: string;
65
+ /**
66
+ * The invoked child machine this entry was delivered to, as the invoke ids
67
+ * from the root down (`["worker"]`, `["worker", "review"]`). Omitted for an
68
+ * entry the root received. A child's own inputs (events sent to it, its
69
+ * invokes' completions, its timers) are journaled so a fold reproduces the
70
+ * child's state, not just the root's.
71
+ */
72
+ actorPath?: string[];
57
73
  }
58
74
  /** The payload of the reserved {@link AGENT_INIT_EVENT_TYPE} first entry. */
59
75
  interface AgentInitEvent extends EventObject {
@@ -144,6 +160,10 @@ interface CreateReplayEntryOptions {
144
160
  metadata?: Record<string, JsonValue>;
145
161
  /** Rejected decision attempts that preceded `event`; omitted when empty. */
146
162
  attempts?: DecisionAttempt[];
163
+ /** The `agent.decide` call (`${siteId}#${n}`) this entry settles. */
164
+ decidedBy?: string;
165
+ /** The invoked child machine that received `event`; omitted for the root. */
166
+ actorPath?: string[];
147
167
  /** Record `verification.stateHash` (default `true`). */
148
168
  verification?: boolean;
149
169
  /**
@@ -221,11 +241,16 @@ declare function forkEventLog(entries: readonly AgentLogEntry[], upToIndex: numb
221
241
  /**
222
242
  * The 1-based occurrence `n` for the NEXT call at invoke site `siteId`:
223
243
  * `1 + completions`, where a completion is a journaled `xstate.done.actor` OR
224
- * `xstate.error.actor` for that `actorId` (an error is a semantic completion).
244
+ * `xstate.error.actor` for that `actorId` (an error is a semantic completion),
245
+ * or a distinct `entry.decidedBy` call at that site: a decision settles by
246
+ * sending its chosen event, which usually ends the invoke before it completes.
247
+ * Entries marked `decidedBy` are counted once per call, never as completions.
248
+ * A site inside an invoked child machine is named by that child's
249
+ * `actorPath` too, and only entries delivered to that child count.
225
250
  * The one counting rule behind every `${siteId}#${n}` call key, so a live run
226
251
  * and a replay derive the same `n` by construction.
227
252
  */
228
- declare function agentCallOccurrence(history: readonly (EventObject | AgentLogEntry)[] | undefined, siteId: string): number;
253
+ declare function agentCallOccurrence(history: readonly (EventObject | AgentLogEntry)[] | undefined, siteId: string, actorPath?: readonly string[]): number;
229
254
  /**
230
255
  * Folds the reserved `@agent.usage` entries of a log into one cumulative usage
231
256
  * total. The log is the source of truth, so the totals are a pure projection of
@@ -1,4 +1,4 @@
1
- import { I as DecisionAttempt, Q as AgentError, t as AgentCallUsage } from "./text-logic-CYP502VT.cjs";
1
+ import { $ as AgentError, L as DecisionAttempt, t as AgentCallUsage } from "./text-logic-Ckh-rJFV.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. */
@@ -54,6 +54,22 @@ interface AgentLogEntry {
54
54
  * does not change the fold.
55
55
  */
56
56
  attempts?: DecisionAttempt[];
57
+ /**
58
+ * The `agent.decide` call this entry settles, as `${siteId}#${n}` (its call
59
+ * key without the execution id): the chosen event it sent, and its
60
+ * `xstate.done.actor` when the event left the invoke running. A decision
61
+ * that settles by sending its event has no completion of its own, so
62
+ * {@link agentCallOccurrence} counts it from this. Replay-ignored.
63
+ */
64
+ decidedBy?: string;
65
+ /**
66
+ * The invoked child machine this entry was delivered to, as the invoke ids
67
+ * from the root down (`["worker"]`, `["worker", "review"]`). Omitted for an
68
+ * entry the root received. A child's own inputs (events sent to it, its
69
+ * invokes' completions, its timers) are journaled so a fold reproduces the
70
+ * child's state, not just the root's.
71
+ */
72
+ actorPath?: string[];
57
73
  }
58
74
  /** The payload of the reserved {@link AGENT_INIT_EVENT_TYPE} first entry. */
59
75
  interface AgentInitEvent extends EventObject {
@@ -144,6 +160,10 @@ interface CreateReplayEntryOptions {
144
160
  metadata?: Record<string, JsonValue>;
145
161
  /** Rejected decision attempts that preceded `event`; omitted when empty. */
146
162
  attempts?: DecisionAttempt[];
163
+ /** The `agent.decide` call (`${siteId}#${n}`) this entry settles. */
164
+ decidedBy?: string;
165
+ /** The invoked child machine that received `event`; omitted for the root. */
166
+ actorPath?: string[];
147
167
  /** Record `verification.stateHash` (default `true`). */
148
168
  verification?: boolean;
149
169
  /**
@@ -221,11 +241,16 @@ declare function forkEventLog(entries: readonly AgentLogEntry[], upToIndex: numb
221
241
  /**
222
242
  * The 1-based occurrence `n` for the NEXT call at invoke site `siteId`:
223
243
  * `1 + completions`, where a completion is a journaled `xstate.done.actor` OR
224
- * `xstate.error.actor` for that `actorId` (an error is a semantic completion).
244
+ * `xstate.error.actor` for that `actorId` (an error is a semantic completion),
245
+ * or a distinct `entry.decidedBy` call at that site: a decision settles by
246
+ * sending its chosen event, which usually ends the invoke before it completes.
247
+ * Entries marked `decidedBy` are counted once per call, never as completions.
248
+ * A site inside an invoked child machine is named by that child's
249
+ * `actorPath` too, and only entries delivered to that child count.
225
250
  * The one counting rule behind every `${siteId}#${n}` call key, so a live run
226
251
  * and a replay derive the same `n` by construction.
227
252
  */
228
- declare function agentCallOccurrence(history: readonly (EventObject | AgentLogEntry)[] | undefined, siteId: string): number;
253
+ declare function agentCallOccurrence(history: readonly (EventObject | AgentLogEntry)[] | undefined, siteId: string, actorPath?: readonly string[]): number;
229
254
  /**
230
255
  * Folds the reserved `@agent.usage` entries of a log into one cumulative usage
231
256
  * total. The log is the source of truth, so the totals are a pure projection of
@@ -1,4 +1,4 @@
1
- const require_event_log = require("./event-log-CKWeC7H-.cjs");
1
+ const require_event_log = require("./event-log-BWSSLUff.cjs");
2
2
  //#region src/event-log-store.ts
3
3
  /**
4
4
  * Durable storage for {@link AgentLogEntry} logs: the one interface a host
@@ -1,4 +1,4 @@
1
- import { c as assertAgentLogEntry, p as forkEventLog, ut as AgentError } from "./event-log-DAqsalT1.mjs";
1
+ import { l as assertAgentLogEntry, m as forkEventLog, pt as AgentError } from "./event-log-C7jeH0y8.mjs";
2
2
  //#region src/event-log-store.ts
3
3
  /**
4
4
  * Durable storage for {@link AgentLogEntry} logs: the one interface a host
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-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");
2
+ const require_event_log = require("./event-log-BWSSLUff.cjs");
3
+ const require_decision = require("./decision-BEsATcr1.cjs");
4
+ const require_setup_agent = require("./setup-agent-CXEBURdo.cjs");
5
+ const require_event_log_store = require("./event-log-store-CleWpsp5.cjs");
6
+ const require_run_agent = require("./run-agent-s5D32w99.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
- 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-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";
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, g as NormalizedEventSchemas, 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 AgentError, A as AgentDecisionExhaustedError, B as ResolveDecisionOptions, C as getAgentOutputMode, D as parseProviderOutput, E as parseOutput, F as AgentExecutorDecisionRequest, G as AgentEventDescriptor, H as createDecisionRequest, I as CreateDecisionRequestOptions, J as AgentRequestSource, K as AgentInvalidEventPayloadError, L as DecisionAttempt, M as AgentDecisionOption, N as AgentDecisionRejection, O as providerOutputSchema, P as AgentDecisionRequest, Q as parseAgentEvent, R as DecisionLogic, S as createTextLogic, T as getCallUsage, U as renderDecisionAttempts, V as createDecisionLogic, W as resolveDecision, X as EventFromSnapshot, Y as AgentSchemas, Z as getAcceptedEvents, _ as TextLogic, a as AgentModelRef, b as TextLogicExecutor, c as AgentRequestExecutorInfo, et as AgentTruncatedError, 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 AgentRequestOptions, 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 DecisionLogicConfig } from "./text-logic-CV_4KGr6.cjs";
3
+ import { n as AgentUsageEvent, t as AGENT_USAGE_EVENT_TYPE } from "./usage-BDiJKyv9.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-BtfeFfF6.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-B1-Eqviq.cjs";
6
+ import { c as AgentLogEntry, d as AgentMachineVersionMismatchError, n as AgentEventLogStore, t as AgentEventLogConflictError } from "./event-log-store-BzXehP7R.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
@@ -301,4 +301,4 @@ interface ProvideExecutorsOptions<TMachine extends AnyStateMachine = AnyStateMac
301
301
  */
302
302
  export declare function provideExecutors<TMachine extends AnyStateMachine>(machine: TMachine, executors: AgentRequestExecutors, options?: ProvideExecutorsOptions<TMachine>): TMachine;
303
303
  //#endregion
304
- export { AGENT_TRACE_SCHEMA_VERSION, AGENT_USAGE_EVENT_TYPE, type AgentCallUsage, type AgentDecisionExecutor, AgentDecisionExhaustedError, type AgentDecisionInput, type AgentDecisionOption, type AgentDecisionRequest, type AgentDefaultMeta, type AgentEffects, AgentError, type AgentEventDescriptor, AgentEventLogConflictError, type AgentEventLogStore, type AgentExecutorDecisionRequest, type AgentExecutorTextRequest, type AgentFinishReason, type AgentInputFrom, type AgentInteraction, type AgentInteractionChoice, type AgentInteractionDescriptor, type AgentInteractionEvent, type AgentInteractionEventMeta, type AgentInteractionMeta, AgentInvalidEventPayloadError, type AgentLogEntry, AgentMachineVersionMismatchError, AgentMaxModelCallsExceededError, type AgentMessage, type AgentModelRef, type AgentOutputMode, type AgentRequest, type AgentRequestExecutor, type AgentRequestExecutorInfo, type AgentRequestExecutorResult, type AgentRequestExecutors, type AgentRequestOptions, type AgentRequestSource, type AgentRunErrorCause, type AgentRunInit, type AgentRunMeta, type AgentRunOptions, type AgentRunResult, type AgentRunStart, type AgentRuntime, type AgentRuntimeOptions, type AgentSchemaPack, type AgentSchemas, AgentSnapshotDivergedError, type AgentStepRequest, type AgentTextRequest, type AgentTextResult, type AgentTimerEvent, type AgentTimerScheduler, type AgentTool, type AgentToolChoice, type AgentToolDescriptor, type AgentToolExecute, type AgentTools, type AgentTraceEvent, type AgentTransitionHandler, AgentTruncatedError, type AgentUsage, type AgentUsageEvent, type AgentUsageEventPayload, type AgentWorkflowActionConfig, type AgentWorkflowActorConfig, type AgentWorkflowConfig, type AgentWorkflowInvokeConfig, type AgentWorkflowRequestConfig, type AgentWorkflowStateConfig, type AgentWorkflowTransitionConfig, type AllowedEvents, type AssistantMessage, type ChosenEvent, type ContextOf, type CreateDecisionRequestOptions, type DecisionAttempt, type DecisionLogic, type DecisionLogicConfig, type DoneActorEventOf, type EventOf, type FilePart, type FromConfigOptions, type FromConfigResult, type GetInteractionOptions, type ImagePart, type InferInput, type InferOutput, type InputOf, type InspectedActorRef, type JsonSerializableTraceEvent, type MetaOf, type OutputOf, type PolicyDeciderOptions, type ProvideExecutorsOptions, type ProviderStructuredOutput, type RequestNamesOf, type ResolveDecisionOptions, type SchemaCompiler, type SnapshotOf, type StandardSchemaV1, type StateValueOf, type SystemMessage, type TextLogic, type TextLogicConfig, type TextLogicExecuteArgs, type TextLogicExecutor, type TextPart, type ToolCallPart, type ToolMessage, type ToolResultPart, type UserMessage, type WithAgentEvents, type WithAgentUsageEvent, assistantMessage, bindRequestExecutor, createAgentRuntime, createAgentSchemas, createDecisionLogic, createDecisionRequest, createTextLogic, eventFromInteraction, getAcceptedEvents, getAgentOutputMode, getAgentSchemas, getCallFinishReason, getCallUsage, getInteraction, getJsonSchema, getJsonSchemaSync, getMachineStructuralHash, getMessageText, getStateMeta, getStatePath, inspectTransitions, interactionMetaSchema, isAgentIdle, isStandardSchema, parseAgentEvent, parseOutput, parseProviderOutput, providerOutputSchema, renderDecisionAttempts, resolveDecision, runAgent, runToQuiescence, serializeTraceEvent, setupAgent, systemMessage, toolMessage, traceTransitions, userMessage };
304
+ export { AGENT_TRACE_SCHEMA_VERSION, AGENT_USAGE_EVENT_TYPE, type AgentCallUsage, type AgentDecisionExecutor, AgentDecisionExhaustedError, type AgentDecisionInput, type AgentDecisionOption, type AgentDecisionRejection, type AgentDecisionRequest, type AgentDefaultMeta, type AgentEffects, AgentError, type AgentEventDescriptor, AgentEventLogConflictError, type AgentEventLogStore, type AgentExecutorDecisionRequest, type AgentExecutorTextRequest, type AgentFinishReason, type AgentInputFrom, type AgentInteraction, type AgentInteractionChoice, type AgentInteractionDescriptor, type AgentInteractionEvent, type AgentInteractionEventMeta, type AgentInteractionMeta, AgentInvalidEventPayloadError, type AgentLogEntry, AgentMachineVersionMismatchError, AgentMaxModelCallsExceededError, type AgentMessage, type AgentModelRef, type AgentOutputMode, type AgentRequest, type AgentRequestExecutor, type AgentRequestExecutorInfo, type AgentRequestExecutorResult, type AgentRequestExecutors, type AgentRequestOptions, type AgentRequestSource, type AgentRunErrorCause, type AgentRunInit, type AgentRunMeta, type AgentRunOptions, type AgentRunResult, type AgentRunStart, type AgentRuntime, type AgentRuntimeOptions, type AgentSchemaPack, type AgentSchemas, AgentSnapshotDivergedError, type AgentStepRequest, type AgentTextRequest, type AgentTextResult, type AgentTimerEvent, type AgentTimerScheduler, type AgentTool, type AgentToolChoice, type AgentToolDescriptor, type AgentToolExecute, type AgentTools, type AgentTraceEvent, type AgentTransitionHandler, AgentTruncatedError, type AgentUsage, type AgentUsageEvent, type AgentUsageEventPayload, type AgentWorkflowActionConfig, type AgentWorkflowActorConfig, type AgentWorkflowConfig, type AgentWorkflowInvokeConfig, type AgentWorkflowRequestConfig, type AgentWorkflowStateConfig, type AgentWorkflowTransitionConfig, type AllowedEvents, type AssistantMessage, type ChosenEvent, type ContextOf, type CreateDecisionRequestOptions, type DecisionAttempt, type DecisionLogic, type DecisionLogicConfig, type DoneActorEventOf, type EventOf, type FilePart, type FromConfigOptions, type FromConfigResult, type GetInteractionOptions, type ImagePart, type InferInput, type InferOutput, type InputOf, type InspectedActorRef, type JsonSerializableTraceEvent, type MetaOf, type NormalizedEventSchemas, type OutputOf, type PolicyDeciderOptions, type ProvideExecutorsOptions, type ProviderStructuredOutput, type RequestNamesOf, type ResolveDecisionOptions, type SchemaCompiler, type SnapshotOf, type StandardSchemaV1, type StateValueOf, type SystemMessage, type TextLogic, type TextLogicConfig, type TextLogicExecuteArgs, type TextLogicExecutor, type TextPart, type ToolCallPart, type ToolMessage, type ToolResultPart, type UserMessage, type WithAgentEvents, type WithAgentUsageEvent, assistantMessage, bindRequestExecutor, createAgentRuntime, createAgentSchemas, createDecisionLogic, createDecisionRequest, createTextLogic, eventFromInteraction, getAcceptedEvents, getAgentOutputMode, getAgentSchemas, getCallFinishReason, getCallUsage, getInteraction, getJsonSchema, getJsonSchemaSync, getMachineStructuralHash, getMessageText, getStateMeta, getStatePath, inspectTransitions, interactionMetaSchema, isAgentIdle, isStandardSchema, parseAgentEvent, parseOutput, parseProviderOutput, providerOutputSchema, renderDecisionAttempts, resolveDecision, runAgent, runToQuiescence, serializeTraceEvent, setupAgent, systemMessage, toolMessage, traceTransitions, userMessage };
package/dist/index.d.mts CHANGED
@@ -1,9 +1,9 @@
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-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";
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, g as NormalizedEventSchemas, 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 AgentError, A as AgentDecisionExhaustedError, B as ResolveDecisionOptions, C as getAgentOutputMode, D as parseProviderOutput, E as parseOutput, F as AgentExecutorDecisionRequest, G as AgentEventDescriptor, H as createDecisionRequest, I as CreateDecisionRequestOptions, J as AgentRequestSource, K as AgentInvalidEventPayloadError, L as DecisionAttempt, M as AgentDecisionOption, N as AgentDecisionRejection, O as providerOutputSchema, P as AgentDecisionRequest, Q as parseAgentEvent, R as DecisionLogic, S as createTextLogic, T as getCallUsage, U as renderDecisionAttempts, V as createDecisionLogic, W as resolveDecision, X as EventFromSnapshot, Y as AgentSchemas, Z as getAcceptedEvents, _ as TextLogic, a as AgentModelRef, b as TextLogicExecutor, c as AgentRequestExecutorInfo, et as AgentTruncatedError, 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 AgentRequestOptions, 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 DecisionLogicConfig } from "./text-logic-Ckh-rJFV.mjs";
3
+ import { n as AgentUsageEvent, t as AGENT_USAGE_EVENT_TYPE } from "./usage-DOoVUGVq.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-C6nqzv_X.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-BGdx5913.mjs";
6
+ import { c as AgentLogEntry, d as AgentMachineVersionMismatchError, n as AgentEventLogStore, t as AgentEventLogConflictError } from "./event-log-store-CWjN6lmM.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
@@ -301,4 +301,4 @@ interface ProvideExecutorsOptions<TMachine extends AnyStateMachine = AnyStateMac
301
301
  */
302
302
  export declare function provideExecutors<TMachine extends AnyStateMachine>(machine: TMachine, executors: AgentRequestExecutors, options?: ProvideExecutorsOptions<TMachine>): TMachine;
303
303
  //#endregion
304
- export { AGENT_TRACE_SCHEMA_VERSION, AGENT_USAGE_EVENT_TYPE, type AgentCallUsage, type AgentDecisionExecutor, AgentDecisionExhaustedError, type AgentDecisionInput, type AgentDecisionOption, type AgentDecisionRequest, type AgentDefaultMeta, type AgentEffects, AgentError, type AgentEventDescriptor, AgentEventLogConflictError, type AgentEventLogStore, type AgentExecutorDecisionRequest, type AgentExecutorTextRequest, type AgentFinishReason, type AgentInputFrom, type AgentInteraction, type AgentInteractionChoice, type AgentInteractionDescriptor, type AgentInteractionEvent, type AgentInteractionEventMeta, type AgentInteractionMeta, AgentInvalidEventPayloadError, type AgentLogEntry, AgentMachineVersionMismatchError, AgentMaxModelCallsExceededError, type AgentMessage, type AgentModelRef, type AgentOutputMode, type AgentRequest, type AgentRequestExecutor, type AgentRequestExecutorInfo, type AgentRequestExecutorResult, type AgentRequestExecutors, type AgentRequestOptions, type AgentRequestSource, type AgentRunErrorCause, type AgentRunInit, type AgentRunMeta, type AgentRunOptions, type AgentRunResult, type AgentRunStart, type AgentRuntime, type AgentRuntimeOptions, type AgentSchemaPack, type AgentSchemas, AgentSnapshotDivergedError, type AgentStepRequest, type AgentTextRequest, type AgentTextResult, type AgentTimerEvent, type AgentTimerScheduler, type AgentTool, type AgentToolChoice, type AgentToolDescriptor, type AgentToolExecute, type AgentTools, type AgentTraceEvent, type AgentTransitionHandler, AgentTruncatedError, type AgentUsage, type AgentUsageEvent, type AgentUsageEventPayload, type AgentWorkflowActionConfig, type AgentWorkflowActorConfig, type AgentWorkflowConfig, type AgentWorkflowInvokeConfig, type AgentWorkflowRequestConfig, type AgentWorkflowStateConfig, type AgentWorkflowTransitionConfig, type AllowedEvents, type AssistantMessage, type ChosenEvent, type ContextOf, type CreateDecisionRequestOptions, type DecisionAttempt, type DecisionLogic, type DecisionLogicConfig, type DoneActorEventOf, type EventOf, type FilePart, type FromConfigOptions, type FromConfigResult, type GetInteractionOptions, type ImagePart, type InferInput, type InferOutput, type InputOf, type InspectedActorRef, type JsonSerializableTraceEvent, type MetaOf, type OutputOf, type PolicyDeciderOptions, type ProvideExecutorsOptions, type ProviderStructuredOutput, type RequestNamesOf, type ResolveDecisionOptions, type SchemaCompiler, type SnapshotOf, type StandardSchemaV1, type StateValueOf, type SystemMessage, type TextLogic, type TextLogicConfig, type TextLogicExecuteArgs, type TextLogicExecutor, type TextPart, type ToolCallPart, type ToolMessage, type ToolResultPart, type UserMessage, type WithAgentEvents, type WithAgentUsageEvent, assistantMessage, bindRequestExecutor, createAgentRuntime, createAgentSchemas, createDecisionLogic, createDecisionRequest, createTextLogic, eventFromInteraction, getAcceptedEvents, getAgentOutputMode, getAgentSchemas, getCallFinishReason, getCallUsage, getInteraction, getJsonSchema, getJsonSchemaSync, getMachineStructuralHash, getMessageText, getStateMeta, getStatePath, inspectTransitions, interactionMetaSchema, isAgentIdle, isStandardSchema, parseAgentEvent, parseOutput, parseProviderOutput, providerOutputSchema, renderDecisionAttempts, resolveDecision, runAgent, runToQuiescence, serializeTraceEvent, setupAgent, systemMessage, toolMessage, traceTransitions, userMessage };
304
+ export { AGENT_TRACE_SCHEMA_VERSION, AGENT_USAGE_EVENT_TYPE, type AgentCallUsage, type AgentDecisionExecutor, AgentDecisionExhaustedError, type AgentDecisionInput, type AgentDecisionOption, type AgentDecisionRejection, type AgentDecisionRequest, type AgentDefaultMeta, type AgentEffects, AgentError, type AgentEventDescriptor, AgentEventLogConflictError, type AgentEventLogStore, type AgentExecutorDecisionRequest, type AgentExecutorTextRequest, type AgentFinishReason, type AgentInputFrom, type AgentInteraction, type AgentInteractionChoice, type AgentInteractionDescriptor, type AgentInteractionEvent, type AgentInteractionEventMeta, type AgentInteractionMeta, AgentInvalidEventPayloadError, type AgentLogEntry, AgentMachineVersionMismatchError, AgentMaxModelCallsExceededError, type AgentMessage, type AgentModelRef, type AgentOutputMode, type AgentRequest, type AgentRequestExecutor, type AgentRequestExecutorInfo, type AgentRequestExecutorResult, type AgentRequestExecutors, type AgentRequestOptions, type AgentRequestSource, type AgentRunErrorCause, type AgentRunInit, type AgentRunMeta, type AgentRunOptions, type AgentRunResult, type AgentRunStart, type AgentRuntime, type AgentRuntimeOptions, type AgentSchemaPack, type AgentSchemas, AgentSnapshotDivergedError, type AgentStepRequest, type AgentTextRequest, type AgentTextResult, type AgentTimerEvent, type AgentTimerScheduler, type AgentTool, type AgentToolChoice, type AgentToolDescriptor, type AgentToolExecute, type AgentTools, type AgentTraceEvent, type AgentTransitionHandler, AgentTruncatedError, type AgentUsage, type AgentUsageEvent, type AgentUsageEventPayload, type AgentWorkflowActionConfig, type AgentWorkflowActorConfig, type AgentWorkflowConfig, type AgentWorkflowInvokeConfig, type AgentWorkflowRequestConfig, type AgentWorkflowStateConfig, type AgentWorkflowTransitionConfig, type AllowedEvents, type AssistantMessage, type ChosenEvent, type ContextOf, type CreateDecisionRequestOptions, type DecisionAttempt, type DecisionLogic, type DecisionLogicConfig, type DoneActorEventOf, type EventOf, type FilePart, type FromConfigOptions, type FromConfigResult, type GetInteractionOptions, type ImagePart, type InferInput, type InferOutput, type InputOf, type InspectedActorRef, type JsonSerializableTraceEvent, type MetaOf, type NormalizedEventSchemas, type OutputOf, type PolicyDeciderOptions, type ProvideExecutorsOptions, type ProviderStructuredOutput, type RequestNamesOf, type ResolveDecisionOptions, type SchemaCompiler, type SnapshotOf, type StandardSchemaV1, type StateValueOf, type SystemMessage, type TextLogic, type TextLogicConfig, type TextLogicExecuteArgs, type TextLogicExecutor, type TextPart, type ToolCallPart, type ToolMessage, type ToolResultPart, type UserMessage, type WithAgentEvents, type WithAgentUsageEvent, assistantMessage, bindRequestExecutor, createAgentRuntime, createAgentSchemas, createDecisionLogic, createDecisionRequest, createTextLogic, eventFromInteraction, getAcceptedEvents, getAgentOutputMode, getAgentSchemas, getCallFinishReason, getCallUsage, getInteraction, getJsonSchema, getJsonSchemaSync, getMachineStructuralHash, getMessageText, getStateMeta, getStatePath, inspectTransitions, interactionMetaSchema, isAgentIdle, isStandardSchema, parseAgentEvent, parseOutput, parseProviderOutput, providerOutputSchema, renderDecisionAttempts, resolveDecision, runAgent, runToQuiescence, serializeTraceEvent, setupAgent, systemMessage, toolMessage, traceTransitions, userMessage };
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-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";
1
+ import { $ as getMachineStructuralHash, B as providerOutputSchema, F as getCallUsage, I as isTextLogic, M as getAgentOutputMode, N as getCallFinishReason, Q as getJsonSchemaSync, R as parseOutput, U as executorBoundLogics, W as getAgentExecutionOptions, Y as assistantMessage, Z as getJsonSchema, at as systemMessage, d as canonicalEventJson, et as getMessageText, ft as isRecord, i as AgentMachineVersionMismatchError, j as createTextLogic, k as bindRequestExecutor, mt as AgentTruncatedError, nt as getStatePath, ot as toolMessage, pt as AgentError, rt as isStandardSchema, st as userMessage, tt as getStateMeta, u as assertJsonSerializable, w as AGENT_USAGE_EVENT_TYPE, z as parseProviderOutput } from "./event-log-C7jeH0y8.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-COkJNjOW.mjs";
3
+ import { n as getAgentSchemas, r as setupAgent, t as createAgentSchemas } from "./setup-agent-05uw4dPZ.mjs";
4
+ import { t as AgentEventLogConflictError } from "./event-log-store-W49TCJXi.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-Ct_GZw_f.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-CKWeC7H-.cjs");
3
- const require_event_log_store = require("./event-log-store-DKyE7JKr.cjs");
2
+ const require_event_log = require("./event-log-BWSSLUff.cjs");
3
+ const require_event_log_store = require("./event-log-store-CleWpsp5.cjs");
4
4
  //#region src/event-log-store-conformance.ts
5
5
  /**
6
6
  * The runner-agnostic conformance suite for {@link AgentEventLogStore}
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-s73r1Hxf.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-BzXehP7R.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-C2NjVlWU.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-CWjN6lmM.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-DAqsalT1.mjs";
2
- import { n as createInMemoryEventLogStore, t as AgentEventLogConflictError } from "./event-log-store-BGehvVTb.mjs";
1
+ import { C as validateReplayEntries, S as replay, _ as getSnapshotStateHash, a as AgentReplayDivergenceError, b as rebindActorSession, f as createReplayEntry, g as getLogExecutionId, h as getDecisionAttempts, i as AgentMachineVersionMismatchError, l as assertAgentLogEntry, m as forkEventLog, n as AGENT_INIT_EVENT_TYPE, o as NonSerializableAgentEventError, r as AgentEventLogError, s as agentCallOccurrence, t as AGENT_EVENT_SCHEMA_VERSION, u as assertJsonSerializable, v as getUsageFromEvents, x as recordLog, y as initEntry } from "./event-log-C7jeH0y8.mjs";
2
+ import { n as createInMemoryEventLogStore, t as AgentEventLogConflictError } from "./event-log-store-W49TCJXi.mjs";
3
3
  //#region src/event-log-store-conformance.ts
4
4
  /**
5
5
  * The runner-agnostic conformance suite for {@link AgentEventLogStore}
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-CwUJyqKB.cjs");
2
+ const require_setup_agent = require("./setup-agent-CXEBURdo.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-CmhB-U5P.mjs";
1
+ import { r as setupAgent } from "./setup-agent-05uw4dPZ.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
- import { H as getAgentExecutionOptions, lt as isRecord } from "./event-log-DAqsalT1.mjs";
1
+ import { W as getAgentExecutionOptions, ft as isRecord } from "./event-log-C7jeH0y8.mjs";
2
2
  //#region src/internal/model-source.ts
3
3
  function hasEntries(value) {
4
4
  return isRecord(value) && Object.keys(value).length > 0;
@@ -1,4 +1,4 @@
1
- const require_event_log = require("./event-log-CKWeC7H-.cjs");
1
+ const require_event_log = require("./event-log-BWSSLUff.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;