@statelyai/agent 2.0.0-alpha.29 → 2.0.0-alpha.30

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 (68) hide show
  1. package/dist/ai-sdk.cjs +4 -4
  2. package/dist/ai-sdk.d.cts +5 -5
  3. package/dist/ai-sdk.d.mts +5 -5
  4. package/dist/ai-sdk.mjs +4 -4
  5. package/dist/{decision-Bl_rKQnU.mjs → decision-BHkvuImD.mjs} +2 -2
  6. package/dist/{decision-oevZnkBe.cjs → decision-CIb7ddIv.cjs} +2 -2
  7. package/dist/{event-log-Dtb16p1p.cjs → event-log-BZRfBRd7.cjs} +1 -1
  8. package/dist/{event-log-GPZO9p7_.mjs → event-log-DJCMHek_.mjs} +1 -1
  9. package/dist/{event-log-store-CN9ygggF.d.cts → event-log-store-CIIJohjj.d.mts} +1 -1
  10. package/dist/{event-log-store-DS836wch.d.mts → event-log-store-CLAC9q2Y.d.cts} +1 -1
  11. package/dist/{event-log-store-bCdskPNS.cjs → event-log-store-DZR4IIWe.cjs} +1 -1
  12. package/dist/{event-log-store-yalq8C77.mjs → event-log-store-DsP6GCRh.mjs} +1 -1
  13. package/dist/index.cjs +12 -7
  14. package/dist/index.d.cts +5 -5
  15. package/dist/index.d.mts +5 -5
  16. package/dist/index.mjs +12 -7
  17. package/dist/log.cjs +2 -2
  18. package/dist/log.d.cts +1 -1
  19. package/dist/log.d.mts +1 -1
  20. package/dist/log.mjs +2 -2
  21. package/dist/machines.cjs +1 -1
  22. package/dist/machines.mjs +1 -1
  23. package/dist/{model-source-DjJPjGSP.cjs → model-source-BCKg4qJ1.cjs} +2 -2
  24. package/dist/{model-source-C7FFP2Sj.mjs → model-source-BaHwJ1wK.mjs} +2 -2
  25. package/dist/openai.cjs +3 -3
  26. package/dist/openai.d.cts +2 -2
  27. package/dist/openai.d.mts +2 -2
  28. package/dist/openai.mjs +3 -3
  29. package/dist/otel.d.cts +1 -1
  30. package/dist/otel.d.mts +1 -1
  31. package/dist/{run-agent-CuQT1xSS.mjs → run-agent-BpHqkaZw.mjs} +14 -5
  32. package/dist/{run-agent-CxSyZmIE.d.mts → run-agent-CAVt5R-r.d.mts} +11 -3
  33. package/dist/{run-agent-C9ubX8Tx.d.cts → run-agent-CTlMc3Jb.d.cts} +11 -3
  34. package/dist/{run-agent-cToZ3K42.cjs → run-agent-ctLCvNgL.cjs} +14 -5
  35. package/dist/{setup-agent-DniLvDu7.mjs → setup-agent-7rV_cujV.mjs} +2 -2
  36. package/dist/{setup-agent-tsc3vm5I.d.mts → setup-agent-CGELn1qZ.d.mts} +2 -2
  37. package/dist/{setup-agent-DlbgwsIJ.d.cts → setup-agent-CLPCkXsu.d.cts} +2 -2
  38. package/dist/{setup-agent-DTF3NQg3.cjs → setup-agent-DoUk7EdC.cjs} +2 -2
  39. package/dist/tanstack-ai.cjs +3 -3
  40. package/dist/tanstack-ai.d.cts +2 -2
  41. package/dist/tanstack-ai.d.mts +2 -2
  42. package/dist/tanstack-ai.mjs +3 -3
  43. package/dist/testing.cjs +110 -4
  44. package/dist/testing.d.cts +85 -4
  45. package/dist/testing.d.mts +85 -4
  46. package/dist/testing.mjs +110 -5
  47. package/dist/{text-logic-BDbGjYMh.d.mts → text-logic-BRYOPWvY.d.mts} +2 -2
  48. package/dist/{text-logic-9fv1i9aK.d.cts → text-logic-DmciuVUQ.d.cts} +2 -2
  49. package/dist/{usage-D8UphgEA.d.mts → usage-BkM3z02Y.d.mts} +1 -1
  50. package/dist/{usage-R1NTmLxY.d.cts → usage-Cm_ovz9V.d.cts} +1 -1
  51. package/dist/validate.cjs +3 -3
  52. package/dist/validate.d.cts +2 -2
  53. package/dist/validate.d.mts +2 -2
  54. package/dist/validate.mjs +3 -3
  55. package/dist/{verify-B5qGC5WN.mjs → verify-COFWyprJ.mjs} +2 -2
  56. package/dist/{verify-Cqghu4gz.cjs → verify-CVlsTZ-V.cjs} +2 -2
  57. package/dist/{verify-CBuYIpsa.d.mts → verify-Cn86rT8l.d.mts} +1 -1
  58. package/dist/{verify-DYH_2VzU.d.cts → verify-Dzwd4Mvk.d.cts} +1 -1
  59. package/package.json +1 -1
  60. package/readme.md +3 -3
  61. package/skills/add-evals/SKILL.md +129 -0
  62. package/skills/add-traces/SKILL.md +135 -0
  63. package/skills/generate-machine/SKILL.md +5 -5
  64. package/skills/graph-engineering/SKILL.md +33 -0
  65. package/skills/improve-machine/SKILL.md +70 -19
  66. package/skills/improve-machine/reference.md +12 -7
  67. package/skills/loop-to-machine/SKILL.md +183 -0
  68. package/skills/loop-to-machine/policy.md +158 -0
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-Dtb16p1p.cjs");
3
- const require_decision = require("./decision-oevZnkBe.cjs");
4
- const require_model_source = require("./model-source-DjJPjGSP.cjs");
2
+ const require_event_log = require("./event-log-BZRfBRd7.cjs");
3
+ const require_decision = require("./decision-CIb7ddIv.cjs");
4
+ const require_model_source = require("./model-source-BCKg4qJ1.cjs");
5
5
  let ai = require("ai");
6
6
  //#region src/ai-sdk/mappers.ts
7
7
  /**
@@ -250,7 +250,7 @@ function isDecisionModel(model) {
250
250
  }
251
251
  /**
252
252
  * Splits a portable `"provider/model-id"` model ref (the convention JSON
253
- * workflows and registry-less hosts use, e.g. `"openai/gpt-5.4-mini"`) into
253
+ * workflows and registry-less hosts use, e.g. `"openai/gpt-6-luna"`) into
254
254
  * its parts. A ref with no `/` has no provider — `modelId` is the whole ref.
255
255
  * The standard building block for a host's `resolveModel`:
256
256
  *
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-9fv1i9aK.cjs";
2
+ import { N as AgentDecisionRequest, c as AgentRequestExecutorInfo, f as AgentTextRequest, r as AgentFinishReason, t as AgentCallUsage } from "./text-logic-DmciuVUQ.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
@@ -28,7 +28,7 @@ export type AiSdkModelEntry = LanguageModel | AiSdkDecisionModel | {
28
28
  type AiSdkDecisionModel = Exclude<Experimental_DecisionModel, string>;
29
29
  /**
30
30
  * Splits a portable `"provider/model-id"` model ref (the convention JSON
31
- * workflows and registry-less hosts use, e.g. `"openai/gpt-5.4-mini"`) into
31
+ * workflows and registry-less hosts use, e.g. `"openai/gpt-6-luna"`) into
32
32
  * its parts. A ref with no `/` has no provider — `modelId` is the whole ref.
33
33
  * The standard building block for a host's `resolveModel`:
34
34
  *
@@ -57,7 +57,7 @@ export type AiSdkCallSettings = Omit<Parameters<typeof generateText>[0], "model"
57
57
  /**
58
58
  * Options for {@link createAiSdkExecutors}: either a static `models` map
59
59
  * (model refs resolved by lookup), a `resolveModel` function (refs resolved
60
- * dynamically, e.g. `"openai/gpt-5.4-mini"` → `openai('gpt-5.4-mini')`), or
60
+ * dynamically, e.g. `"openai/gpt-6-luna"` → `openai('gpt-6-luna')`), or
61
61
  * both — `resolveModel` takes precedence when both are supplied.
62
62
  *
63
63
  * `settings` carries provider knobs that are the HOST's business rather than
@@ -159,10 +159,10 @@ export interface AiSdkExecutors {
159
159
  *
160
160
  * @example
161
161
  * ```ts
162
- * const agentSetup = setupAgent({ models: { quick: openai('gpt-5.4-mini') }, ... });
162
+ * const agentSetup = setupAgent({ models: { quick: openai('gpt-6-luna') }, ... });
163
163
  * const machine = agentSetup.createMachine({ ... });
164
164
  * const result = await runAgent(machine, { input, executors: createAiSdkExecutors(machine) });
165
- * // Or explicitly: createAiSdkExecutors({ models: { quick: openai('gpt-5.4-mini') } })
165
+ * // Or explicitly: createAiSdkExecutors({ models: { quick: openai('gpt-6-luna') } })
166
166
  * ```
167
167
  */
168
168
  export declare function createAiSdkExecutors<TModels extends AiSdkModelMap>(options: CreateAiSdkExecutorsOptions<TModels>): AiSdkExecutors;
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-BDbGjYMh.mjs";
2
+ import { N as AgentDecisionRequest, c as AgentRequestExecutorInfo, f as AgentTextRequest, r as AgentFinishReason, t as AgentCallUsage } from "./text-logic-BRYOPWvY.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
@@ -28,7 +28,7 @@ export type AiSdkModelEntry = LanguageModel | AiSdkDecisionModel | {
28
28
  type AiSdkDecisionModel = Exclude<Experimental_DecisionModel, string>;
29
29
  /**
30
30
  * Splits a portable `"provider/model-id"` model ref (the convention JSON
31
- * workflows and registry-less hosts use, e.g. `"openai/gpt-5.4-mini"`) into
31
+ * workflows and registry-less hosts use, e.g. `"openai/gpt-6-luna"`) into
32
32
  * its parts. A ref with no `/` has no provider — `modelId` is the whole ref.
33
33
  * The standard building block for a host's `resolveModel`:
34
34
  *
@@ -57,7 +57,7 @@ export type AiSdkCallSettings = Omit<Parameters<typeof generateText>[0], "model"
57
57
  /**
58
58
  * Options for {@link createAiSdkExecutors}: either a static `models` map
59
59
  * (model refs resolved by lookup), a `resolveModel` function (refs resolved
60
- * dynamically, e.g. `"openai/gpt-5.4-mini"` → `openai('gpt-5.4-mini')`), or
60
+ * dynamically, e.g. `"openai/gpt-6-luna"` → `openai('gpt-6-luna')`), or
61
61
  * both — `resolveModel` takes precedence when both are supplied.
62
62
  *
63
63
  * `settings` carries provider knobs that are the HOST's business rather than
@@ -159,10 +159,10 @@ export interface AiSdkExecutors {
159
159
  *
160
160
  * @example
161
161
  * ```ts
162
- * const agentSetup = setupAgent({ models: { quick: openai('gpt-5.4-mini') }, ... });
162
+ * const agentSetup = setupAgent({ models: { quick: openai('gpt-6-luna') }, ... });
163
163
  * const machine = agentSetup.createMachine({ ... });
164
164
  * const result = await runAgent(machine, { input, executors: createAiSdkExecutors(machine) });
165
- * // Or explicitly: createAiSdkExecutors({ models: { quick: openai('gpt-5.4-mini') } })
165
+ * // Or explicitly: createAiSdkExecutors({ models: { quick: openai('gpt-6-luna') } })
166
166
  * ```
167
167
  */
168
168
  export declare function createAiSdkExecutors<TModels extends AiSdkModelMap>(options: CreateAiSdkExecutorsOptions<TModels>): AiSdkExecutors;
package/dist/ai-sdk.mjs CHANGED
@@ -1,6 +1,6 @@
1
- import { R as providerOutputSchema, ct as AgentTruncatedError, j as getAgentOutputMode, tt as isStandardSchema } from "./event-log-GPZO9p7_.mjs";
2
- import { c as renderDecisionAttempts, m as isRecord, o as decisionOptionIds } from "./decision-Bl_rKQnU.mjs";
3
- import { t as resolveModelSource } from "./model-source-C7FFP2Sj.mjs";
1
+ import { R as providerOutputSchema, ct as AgentTruncatedError, j as getAgentOutputMode, tt as isStandardSchema } from "./event-log-DJCMHek_.mjs";
2
+ import { c as renderDecisionAttempts, m as isRecord, o as decisionOptionIds } from "./decision-BHkvuImD.mjs";
3
+ import { t as resolveModelSource } from "./model-source-BaHwJ1wK.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
  /**
@@ -249,7 +249,7 @@ function isDecisionModel(model) {
249
249
  }
250
250
  /**
251
251
  * Splits a portable `"provider/model-id"` model ref (the convention JSON
252
- * workflows and registry-less hosts use, e.g. `"openai/gpt-5.4-mini"`) into
252
+ * workflows and registry-less hosts use, e.g. `"openai/gpt-6-luna"`) into
253
253
  * its parts. A ref with no `/` has no provider — `modelId` is the whole ref.
254
254
  * The standard building block for a host's `resolveModel`:
255
255
  *
@@ -1,4 +1,4 @@
1
- import { H as getAgentExecutionOptions, T as DECIDE_ACTOR, V as executorBoundLogics, at as userMessage, ot as validateSchemaSync, st as AgentError, u as canonicalEventJson, z as resolveTextLogicValue } from "./event-log-GPZO9p7_.mjs";
1
+ import { H as getAgentExecutionOptions, T as DECIDE_ACTOR, V as executorBoundLogics, at as userMessage, ot as validateSchemaSync, st as AgentError, u as canonicalEventJson, z as resolveTextLogicValue } from "./event-log-DJCMHek_.mjs";
2
2
  import { createAsyncLogic, getNextTransitions } from "xstate";
3
3
  //#region src/internal/is-record.ts
4
4
  /** True for a plain object-like value (arrays excluded). @internal */
@@ -273,7 +273,7 @@ function resolveAllowedEventTypes(allowedEvents, input) {
273
273
  *
274
274
  * export const chooseMove = createDecisionLogic({
275
275
  * schemas: { input: z.object({ playerHp: z.number(), enemyHp: z.number() }) },
276
- * model: 'openai/gpt-5.4-mini',
276
+ * model: 'openai/gpt-6-luna',
277
277
  * system: 'You are playing a turn-based game. Choose exactly one legal move.',
278
278
  * prompt: ({ input }) => `Player HP: ${input.playerHp}\nEnemy HP: ${input.enemyHp}`,
279
279
  * allowedEvents: ({ input }) =>
@@ -1,4 +1,4 @@
1
- const require_event_log = require("./event-log-Dtb16p1p.cjs");
1
+ const require_event_log = require("./event-log-BZRfBRd7.cjs");
2
2
  let xstate = require("xstate");
3
3
  //#region src/internal/is-record.ts
4
4
  /** True for a plain object-like value (arrays excluded). @internal */
@@ -273,7 +273,7 @@ function resolveAllowedEventTypes(allowedEvents, input) {
273
273
  *
274
274
  * export const chooseMove = createDecisionLogic({
275
275
  * schemas: { input: z.object({ playerHp: z.number(), enemyHp: z.number() }) },
276
- * model: 'openai/gpt-5.4-mini',
276
+ * model: 'openai/gpt-6-luna',
277
277
  * system: 'You are playing a turn-based game. Choose exactly one legal move.',
278
278
  * prompt: ({ input }) => `Player HP: ${input.playerHp}\nEnemy HP: ${input.enemyHp}`,
279
279
  * allowedEvents: ({ input }) =>
@@ -577,7 +577,7 @@ function resolveTextLogicValue(value, args) {
577
577
  * export const tellJoke = createTextLogic({
578
578
  * mode: 'stream',
579
579
  * schemas: { input: z.object({ topic: z.string() }), output: z.string() },
580
- * model: 'openai/gpt-5.4-mini',
580
+ * model: 'openai/gpt-6-luna',
581
581
  * system: 'You tell short, punchy jokes.',
582
582
  * prompt: ({ input }) => `Tell a joke about ${input.topic}.`,
583
583
  * });
@@ -577,7 +577,7 @@ function resolveTextLogicValue(value, args) {
577
577
  * export const tellJoke = createTextLogic({
578
578
  * mode: 'stream',
579
579
  * schemas: { input: z.object({ topic: z.string() }), output: z.string() },
580
- * model: 'openai/gpt-5.4-mini',
580
+ * model: 'openai/gpt-6-luna',
581
581
  * system: 'You tell short, punchy jokes.',
582
582
  * prompt: ({ input }) => `Tell a joke about ${input.topic}.`,
583
583
  * });
@@ -1,4 +1,4 @@
1
- import { I as DecisionAttempt, Q as AgentError, t as AgentCallUsage } from "./text-logic-9fv1i9aK.cjs";
1
+ import { I as DecisionAttempt, Q as AgentError, t as AgentCallUsage } from "./text-logic-BRYOPWvY.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. */
@@ -1,4 +1,4 @@
1
- import { I as DecisionAttempt, Q as AgentError, t as AgentCallUsage } from "./text-logic-BDbGjYMh.mjs";
1
+ import { I as DecisionAttempt, Q as AgentError, t as AgentCallUsage } from "./text-logic-DmciuVUQ.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. */
@@ -1,4 +1,4 @@
1
- const require_event_log = require("./event-log-Dtb16p1p.cjs");
1
+ const require_event_log = require("./event-log-BZRfBRd7.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, st as AgentError } from "./event-log-GPZO9p7_.mjs";
1
+ import { c as assertAgentLogEntry, st as AgentError } from "./event-log-DJCMHek_.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-Dtb16p1p.cjs");
3
- const require_decision = require("./decision-oevZnkBe.cjs");
4
- const require_setup_agent = require("./setup-agent-DTF3NQg3.cjs");
5
- const require_event_log_store = require("./event-log-store-bCdskPNS.cjs");
6
- const require_run_agent = require("./run-agent-cToZ3K42.cjs");
2
+ const require_event_log = require("./event-log-BZRfBRd7.cjs");
3
+ const require_decision = require("./decision-CIb7ddIv.cjs");
4
+ const require_setup_agent = require("./setup-agent-DoUk7EdC.cjs");
5
+ const require_event_log_store = require("./event-log-store-DZR4IIWe.cjs");
6
+ const require_run_agent = require("./run-agent-ctLCvNgL.cjs");
7
7
  let xstate = require("xstate");
8
8
  //#region src/messages.ts
9
9
  const KNOWN_PART_TYPES = /* @__PURE__ */ new Set([
@@ -452,8 +452,13 @@ function guardText(guard) {
452
452
  if (isObject(decoded) && typeof decoded.type === "string") return decoded.type.startsWith("__fromConfigGuard") ? "guarded" : decoded.type;
453
453
  return "guarded";
454
454
  }
455
- /** True when a transition function's source has a path that returns no transition, so it may not be taken. */
456
- const mayDecline = (code) => /\bundefined\b|\bnull\b|\breturn\s*;|\bif\s*\(|\s\?\s|&&/.test(code);
455
+ /**
456
+ * True when a transition function's source has a path that returns no
457
+ * transition, so it may not be taken. Matches minified source too: `void 0`
458
+ * for `undefined`, and a ternary `?` with no spaces (but not `?.` or `??`).
459
+ * String and template literals are blanked first, so their text never counts.
460
+ */
461
+ const mayDecline = (code) => /\bundefined\b|\bnull\b|\bvoid 0\b|\breturn\s*;|\bif\s*\(|(?<!\?)\?(?![.?])|&&/.test(code.replace(/(["'`])(?:\\.|(?!\1)[^\\])*\1/g, "\"\""));
457
462
  /**
458
463
  * Where a transition written as a function goes: every string literal after a
459
464
  * `target:` that names a real state node, `(conditional)` when it may decline
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-9fv1i9aK.cjs";
3
- import { n as AgentUsageEvent, t as AGENT_USAGE_EVENT_TYPE } from "./usage-R1NTmLxY.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-DlbgwsIJ.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-C9ubX8Tx.cjs";
6
- import { c as AgentLogEntry, d as AgentMachineVersionMismatchError, n as AgentEventLogStore, t as AgentEventLogConflictError } from "./event-log-store-CN9ygggF.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-DmciuVUQ.cjs";
3
+ import { n as AgentUsageEvent, t as AGENT_USAGE_EVENT_TYPE } from "./usage-Cm_ovz9V.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-CLPCkXsu.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-CTlMc3Jb.cjs";
6
+ import { c as AgentLogEntry, d as AgentMachineVersionMismatchError, n as AgentEventLogStore, t as AgentEventLogConflictError } from "./event-log-store-CLAC9q2Y.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
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-BDbGjYMh.mjs";
3
- import { n as AgentUsageEvent, t as AGENT_USAGE_EVENT_TYPE } from "./usage-D8UphgEA.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-tsc3vm5I.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-CxSyZmIE.mjs";
6
- import { c as AgentLogEntry, d as AgentMachineVersionMismatchError, n as AgentEventLogStore, t as AgentEventLogConflictError } from "./event-log-store-DS836wch.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-BRYOPWvY.mjs";
3
+ import { n as AgentUsageEvent, t as AGENT_USAGE_EVENT_TYPE } from "./usage-BkM3z02Y.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-CGELn1qZ.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-CAVt5R-r.mjs";
6
+ import { c as AgentLogEntry, d as AgentMachineVersionMismatchError, n as AgentEventLogStore, t as AgentEventLogConflictError } from "./event-log-store-CIIJohjj.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
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, ct as AgentTruncatedError, et as getStatePath, i as AgentMachineVersionMismatchError, it as toolMessage, j as getAgentOutputMode, q as assistantMessage, rt as systemMessage, st as AgentError, tt as isStandardSchema, u as canonicalEventJson } from "./event-log-GPZO9p7_.mjs";
2
- import { a as createDecisionRequest, c as renderDecisionAttempts, d as getAcceptedEvents, f as isEventPattern, i as createDecisionLogic, l as resolveDecision, m as isRecord, p as parseAgentEvent, s as isDecisionLogic, t as AgentDecisionExhaustedError, u as AgentInvalidEventPayloadError } from "./decision-Bl_rKQnU.mjs";
3
- import { n as getAgentSchemas, r as setupAgent, t as createAgentSchemas } from "./setup-agent-DniLvDu7.mjs";
4
- import { t as AgentEventLogConflictError } from "./event-log-store-yalq8C77.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-CuQT1xSS.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, ct as AgentTruncatedError, et as getStatePath, i as AgentMachineVersionMismatchError, it as toolMessage, j as getAgentOutputMode, q as assistantMessage, rt as systemMessage, st as AgentError, tt as isStandardSchema, u as canonicalEventJson } from "./event-log-DJCMHek_.mjs";
2
+ import { a as createDecisionRequest, c as renderDecisionAttempts, d as getAcceptedEvents, f as isEventPattern, i as createDecisionLogic, l as resolveDecision, m as isRecord, p as parseAgentEvent, s as isDecisionLogic, t as AgentDecisionExhaustedError, u as AgentInvalidEventPayloadError } from "./decision-BHkvuImD.mjs";
3
+ import { n as getAgentSchemas, r as setupAgent, t as createAgentSchemas } from "./setup-agent-7rV_cujV.mjs";
4
+ import { t as AgentEventLogConflictError } from "./event-log-store-DsP6GCRh.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-BpHqkaZw.mjs";
6
6
  import { getNextTransitions, machineToJSON, transition } from "xstate";
7
7
  //#region src/messages.ts
8
8
  const KNOWN_PART_TYPES = /* @__PURE__ */ new Set([
@@ -451,8 +451,13 @@ function guardText(guard) {
451
451
  if (isObject(decoded) && typeof decoded.type === "string") return decoded.type.startsWith("__fromConfigGuard") ? "guarded" : decoded.type;
452
452
  return "guarded";
453
453
  }
454
- /** True when a transition function's source has a path that returns no transition, so it may not be taken. */
455
- const mayDecline = (code) => /\bundefined\b|\bnull\b|\breturn\s*;|\bif\s*\(|\s\?\s|&&/.test(code);
454
+ /**
455
+ * True when a transition function's source has a path that returns no
456
+ * transition, so it may not be taken. Matches minified source too: `void 0`
457
+ * for `undefined`, and a ternary `?` with no spaces (but not `?.` or `??`).
458
+ * String and template literals are blanked first, so their text never counts.
459
+ */
460
+ const mayDecline = (code) => /\bundefined\b|\bnull\b|\bvoid 0\b|\breturn\s*;|\bif\s*\(|(?<!\?)\?(?![.?])|&&/.test(code.replace(/(["'`])(?:\\.|(?!\1)[^\\])*\1/g, "\"\""));
456
461
  /**
457
462
  * Where a transition written as a function goes: every string literal after a
458
463
  * `target:` that names a real state node, `(conditional)` when it may decline
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-Dtb16p1p.cjs");
3
- const require_event_log_store = require("./event-log-store-bCdskPNS.cjs");
2
+ const require_event_log = require("./event-log-BZRfBRd7.cjs");
3
+ const require_event_log_store = require("./event-log-store-DZR4IIWe.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-CN9ygggF.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-CLAC9q2Y.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-DS836wch.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-CIIJohjj.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-GPZO9p7_.mjs";
2
- import { n as createInMemoryEventLogStore, t as AgentEventLogConflictError } from "./event-log-store-yalq8C77.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-DJCMHek_.mjs";
2
+ import { n as createInMemoryEventLogStore, t as AgentEventLogConflictError } from "./event-log-store-DsP6GCRh.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-DTF3NQg3.cjs");
2
+ const require_setup_agent = require("./setup-agent-DoUk7EdC.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-DniLvDu7.mjs";
1
+ import { r as setupAgent } from "./setup-agent-7rV_cujV.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,5 +1,5 @@
1
- const require_event_log = require("./event-log-Dtb16p1p.cjs");
2
- const require_decision = require("./decision-oevZnkBe.cjs");
1
+ const require_event_log = require("./event-log-BZRfBRd7.cjs");
2
+ const require_decision = require("./decision-CIb7ddIv.cjs");
3
3
  //#region src/internal/model-source.ts
4
4
  function hasEntries(value) {
5
5
  return require_decision.isRecord(value) && Object.keys(value).length > 0;
@@ -1,5 +1,5 @@
1
- import { H as getAgentExecutionOptions } from "./event-log-GPZO9p7_.mjs";
2
- import { m as isRecord } from "./decision-Bl_rKQnU.mjs";
1
+ import { H as getAgentExecutionOptions } from "./event-log-DJCMHek_.mjs";
2
+ import { m as isRecord } from "./decision-BHkvuImD.mjs";
3
3
  //#region src/internal/model-source.ts
4
4
  function hasEntries(value) {
5
5
  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-Dtb16p1p.cjs");
3
- const require_decision = require("./decision-oevZnkBe.cjs");
2
+ const require_event_log = require("./event-log-BZRfBRd7.cjs");
3
+ const require_decision = require("./decision-CIb7ddIv.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. */
@@ -284,7 +284,7 @@ function toToolContent(output) {
284
284
  * ```ts
285
285
  * const executors = createOpenAiExecutors({
286
286
  * client: new OpenAI(),
287
- * resolveModel: () => 'gpt-5.4-mini',
287
+ * resolveModel: () => 'gpt-6-luna',
288
288
  * });
289
289
  * const result = await runToQuiescence(createAgentRuntime(machine, { executors }), { input });
290
290
  * ```
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-9fv1i9aK.cjs";
2
+ import { N as AgentDecisionRequest, W as AgentEventDescriptor, c as AgentRequestExecutorInfo, f as AgentTextRequest, r as AgentFinishReason, t as AgentCallUsage } from "./text-logic-DmciuVUQ.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
@@ -170,7 +170,7 @@ export declare function addAgentCallUsage(total: AgentCallUsage | undefined, nex
170
170
  * ```ts
171
171
  * const executors = createOpenAiExecutors({
172
172
  * client: new OpenAI(),
173
- * resolveModel: () => 'gpt-5.4-mini',
173
+ * resolveModel: () => 'gpt-6-luna',
174
174
  * });
175
175
  * const result = await runToQuiescence(createAgentRuntime(machine, { executors }), { input });
176
176
  * ```
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-BDbGjYMh.mjs";
2
+ import { N as AgentDecisionRequest, W as AgentEventDescriptor, c as AgentRequestExecutorInfo, f as AgentTextRequest, r as AgentFinishReason, t as AgentCallUsage } from "./text-logic-BRYOPWvY.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
@@ -170,7 +170,7 @@ export declare function addAgentCallUsage(total: AgentCallUsage | undefined, nex
170
170
  * ```ts
171
171
  * const executors = createOpenAiExecutors({
172
172
  * client: new OpenAI(),
173
- * resolveModel: () => 'gpt-5.4-mini',
173
+ * resolveModel: () => 'gpt-6-luna',
174
174
  * });
175
175
  * const result = await runToQuiescence(createAgentRuntime(machine, { executors }), { input });
176
176
  * ```
package/dist/openai.mjs CHANGED
@@ -1,5 +1,5 @@
1
- import { L as parseProviderOutput, R as providerOutputSchema, X as getJsonSchemaSync, Y as getJsonSchema, ct as AgentTruncatedError, j as getAgentOutputMode, tt as isStandardSchema, w as AGENT_USAGE_TOKEN_FIELDS } from "./event-log-GPZO9p7_.mjs";
2
- import { c as renderDecisionAttempts } from "./decision-Bl_rKQnU.mjs";
1
+ import { L as parseProviderOutput, R as providerOutputSchema, X as getJsonSchemaSync, Y as getJsonSchema, ct as AgentTruncatedError, j as getAgentOutputMode, tt as isStandardSchema, w as AGENT_USAGE_TOKEN_FIELDS } from "./event-log-DJCMHek_.mjs";
2
+ import { c as renderDecisionAttempts } from "./decision-BHkvuImD.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. */
@@ -283,7 +283,7 @@ function toToolContent(output) {
283
283
  * ```ts
284
284
  * const executors = createOpenAiExecutors({
285
285
  * client: new OpenAI(),
286
- * resolveModel: () => 'gpt-5.4-mini',
286
+ * resolveModel: () => 'gpt-6-luna',
287
287
  * });
288
288
  * const result = await runToQuiescence(createAgentRuntime(machine, { executors }), { input });
289
289
  * ```
package/dist/otel.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { g as AgentTraceEvent } from "./run-agent-C9ubX8Tx.cjs";
1
+ import { g as AgentTraceEvent } from "./run-agent-CTlMc3Jb.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-CxSyZmIE.mjs";
1
+ import { g as AgentTraceEvent } from "./run-agent-CAVt5R-r.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 AgentError, tt as isStandardSchema, u as canonicalEventJson, v as initEntry, x as replay } from "./event-log-GPZO9p7_.mjs";
2
- import { d as getAcceptedEvents, l as resolveDecision, n as acceptedDecisionOptions, s as isDecisionLogic, t as AgentDecisionExhaustedError } from "./decision-Bl_rKQnU.mjs";
3
- import { t as AgentEventLogConflictError } from "./event-log-store-yalq8C77.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 AgentError, tt as isStandardSchema, u as canonicalEventJson, v as initEntry, x as replay } from "./event-log-DJCMHek_.mjs";
2
+ import { d as getAcceptedEvents, l as resolveDecision, n as acceptedDecisionOptions, s as isDecisionLogic, t as AgentDecisionExhaustedError } from "./decision-BHkvuImD.mjs";
3
+ import { t as AgentEventLogConflictError } from "./event-log-store-DsP6GCRh.mjs";
4
4
  import { createAsyncLogic, getNextTransitions, isMachineSnapshot, stopActor } from "xstate";
5
5
  import { createDurable } from "xstate/durable";
6
6
  //#region src/run-agent.ts
@@ -918,6 +918,8 @@ function createAgentRuntime(machine, options = {}) {
918
918
  let traceSeq = 0;
919
919
  const machineId = machine.config.id ?? machine.id ?? "(machine)";
920
920
  const machineVersion = resolveMachineVersion(machine);
921
+ if (options.metadata !== void 0) assertJsonSerializable(options.metadata, "metadata");
922
+ const initMetadata = options.metadata === void 0 ? void 0 : structuredClone(options.metadata);
921
923
  const onTrace = createTraceDispatch({
922
924
  onTrace: (payload) => {
923
925
  options.onTrace?.({
@@ -1370,16 +1372,23 @@ function createAgentRuntime(machine, options = {}) {
1370
1372
  logIndex: resumeEvents.length
1371
1373
  };
1372
1374
  seedInitEntry = () => appendInitEntry(snapshotInitCandidates(), {
1375
+ ...initMetadata,
1373
1376
  ...logExecutionId !== void 0 ? { executionId: logExecutionId } : {},
1374
1377
  migratedFrom
1375
1378
  });
1376
1379
  }
1377
1380
  } else if (init.snapshot !== void 0) {
1378
1381
  logExecutionId = crypto.randomUUID();
1379
- seedInitEntry = () => appendInitEntry(snapshotInitCandidates(), { executionId: logExecutionId });
1382
+ seedInitEntry = () => appendInitEntry(snapshotInitCandidates(), {
1383
+ ...initMetadata,
1384
+ executionId: logExecutionId
1385
+ });
1380
1386
  } else {
1381
1387
  logExecutionId = crypto.randomUUID();
1382
- seedInitEntry = () => appendInitEntry([resolvedInput !== void 0 ? { input: resolvedInput } : {}], { executionId: logExecutionId });
1388
+ seedInitEntry = () => appendInitEntry([resolvedInput !== void 0 ? { input: resolvedInput } : {}], {
1389
+ ...initMetadata,
1390
+ executionId: logExecutionId
1391
+ });
1383
1392
  }
1384
1393
  const resumedHistory = [...logEntries];
1385
1394
  const siteCallCounts = /* @__PURE__ */ new Map();
@@ -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-BDbGjYMh.mjs";
3
- import { n as AgentUsageEvent } from "./usage-D8UphgEA.mjs";
4
- import { c as AgentLogEntry, n as AgentEventLogStore } from "./event-log-store-DS836wch.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-BRYOPWvY.mjs";
3
+ import { n as AgentUsageEvent } from "./usage-BkM3z02Y.mjs";
4
+ import { c as AgentLogEntry, h as JsonValue$1, n as AgentEventLogStore } from "./event-log-store-CIIJohjj.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
@@ -251,6 +251,14 @@ interface AgentRuntimeOptions<TMachine extends AnyStateMachine> {
251
251
  * the same state. Set `false` for a smaller, unverifiable log.
252
252
  */
253
253
  verification?: boolean;
254
+ /**
255
+ * Host-owned JSON stored on the log's `@agent.init` entry when this run
256
+ * starts a log: what produced the run, such as a policy version, the model
257
+ * ids, or the scenario. A resume keeps the stamp of the run that started
258
+ * the log; a version bridge, which opens a new log segment, takes this
259
+ * run's. `executionId` and `migratedFrom` are reserved and cannot be set here.
260
+ */
261
+ metadata?: Record<string, JsonValue$1>;
254
262
  /** Actor source implementations, merged onto the machine before binding — sugar for `machine.provide({ actors })` ahead of the run. */
255
263
  actors?: Record<string, AnyActorLogic>;
256
264
  /**
@@ -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-9fv1i9aK.cjs";
3
- import { n as AgentUsageEvent } from "./usage-R1NTmLxY.cjs";
4
- import { c as AgentLogEntry, n as AgentEventLogStore } from "./event-log-store-CN9ygggF.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-DmciuVUQ.cjs";
3
+ import { n as AgentUsageEvent } from "./usage-Cm_ovz9V.cjs";
4
+ import { c as AgentLogEntry, h as JsonValue$1, n as AgentEventLogStore } from "./event-log-store-CLAC9q2Y.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
@@ -251,6 +251,14 @@ interface AgentRuntimeOptions<TMachine extends AnyStateMachine> {
251
251
  * the same state. Set `false` for a smaller, unverifiable log.
252
252
  */
253
253
  verification?: boolean;
254
+ /**
255
+ * Host-owned JSON stored on the log's `@agent.init` entry when this run
256
+ * starts a log: what produced the run, such as a policy version, the model
257
+ * ids, or the scenario. A resume keeps the stamp of the run that started
258
+ * the log; a version bridge, which opens a new log segment, takes this
259
+ * run's. `executionId` and `migratedFrom` are reserved and cannot be set here.
260
+ */
261
+ metadata?: Record<string, JsonValue$1>;
254
262
  /** Actor source implementations, merged onto the machine before binding — sugar for `machine.provide({ actors })` ahead of the run. */
255
263
  actors?: Record<string, AnyActorLogic>;
256
264
  /**