@statelyai/agent 2.0.0-alpha.38 → 2.0.0-alpha.40

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 (137) hide show
  1. package/CHANGELOG.md +59 -0
  2. package/dist/{act-CrX0JwWY.cjs → act-B0CVbmo4.cjs} +1 -1
  3. package/dist/{act-B9hLQls6.mjs → act-Bsz-hUfD.mjs} +1 -1
  4. package/dist/ai-sdk.cjs +4 -4
  5. package/dist/ai-sdk.d.cts +2 -3
  6. package/dist/ai-sdk.d.mts +2 -3
  7. package/dist/ai-sdk.mjs +4 -4
  8. package/dist/{decision-m5hGmHpF.mjs → decision-B41YBx5U.mjs} +1 -1
  9. package/dist/{decision-CMeuNZ1g.cjs → decision-D8bcIGXQ.cjs} +1 -1
  10. package/dist/{decision-object-DBcLWVvv.d.cts → decision-object-BB8XV5Ec.d.cts} +1 -1
  11. package/dist/{decision-object-B5zGSPFp.d.mts → decision-object-CH_sE694.d.mts} +1 -1
  12. package/dist/effects-B9IvUPVh.mjs +23 -0
  13. package/dist/effects-DrWcUGgc.cjs +34 -0
  14. package/dist/evals.cjs +810 -0
  15. package/dist/evals.d.cts +595 -0
  16. package/dist/evals.d.mts +595 -0
  17. package/dist/evals.mjs +801 -0
  18. package/dist/{event-log-DkVlk3Rh.mjs → event-log-CEq_bVXQ.mjs} +8 -4
  19. package/dist/{event-log-Dkc-yIYu.cjs → event-log-dSOnXHuG.cjs} +7 -15
  20. package/dist/{event-log-store-Brx9tOHt.mjs → event-log-store-DLAfNM34.mjs} +1 -1
  21. package/dist/{event-log-store-BBS8so8a.d.mts → event-log-store-DYun526m.d.mts} +15 -14
  22. package/dist/{event-log-store-Cl-YWDnq.cjs → event-log-store-Dey9ufA4.cjs} +1 -1
  23. package/dist/{event-log-store-bc4ICGcS.d.cts → event-log-store-aFXK6yZX.d.cts} +15 -14
  24. package/dist/index.cjs +142 -97
  25. package/dist/index.d.cts +97 -141
  26. package/dist/index.d.mts +97 -141
  27. package/dist/index.mjs +123 -74
  28. package/dist/internal-BzlpzSux.d.cts +14 -0
  29. package/dist/internal-BzlpzSux.d.mts +14 -0
  30. package/dist/log.cjs +2 -3
  31. package/dist/log.d.cts +2 -2
  32. package/dist/log.d.mts +2 -2
  33. package/dist/log.mjs +3 -3
  34. package/dist/machine-input-0YTPcnCm.mjs +27 -0
  35. package/dist/machine-input-DU3owLUr.cjs +32 -0
  36. package/dist/machines.cjs +1 -719
  37. package/dist/machines.d.cts +2 -424
  38. package/dist/machines.d.mts +2 -424
  39. package/dist/machines.mjs +2 -709
  40. package/dist/{model-source-kjGwqAV8.mjs → model-source-BrsLDvHL.mjs} +1 -1
  41. package/dist/{model-source-B4WQ8Idp.cjs → model-source-YpxjmWuX.cjs} +1 -1
  42. package/dist/openai.cjs +3 -3
  43. package/dist/openai.d.cts +2 -3
  44. package/dist/openai.d.mts +2 -3
  45. package/dist/openai.mjs +3 -3
  46. package/dist/otel.d.cts +1 -1
  47. package/dist/otel.d.mts +1 -1
  48. package/dist/policy.cjs +77 -0
  49. package/dist/policy.d.cts +143 -0
  50. package/dist/policy.d.mts +143 -0
  51. package/dist/policy.mjs +75 -0
  52. package/dist/{run-agent-DlPzBWj-.d.mts → run-agent-BO9RSb7i.d.cts} +33 -40
  53. package/dist/{run-agent-30mH2moE.d.cts → run-agent-BxkeuAYR.d.mts} +33 -40
  54. package/dist/{effects-DDseYtJk.cjs → run-agent-COdR9FpM.cjs} +175 -228
  55. package/dist/{effects-BT_cSY0j.mjs → run-agent-D3gW9wfd.mjs} +176 -211
  56. package/dist/{setup-agent-BDmNr6PC.mjs → setup-agent-CLm6QVGy.mjs} +3 -3
  57. package/dist/{setup-agent-BaNyz6Q3.d.cts → setup-agent-Cv8Hk3mX.d.cts} +12 -11
  58. package/dist/{setup-agent-C1CG_nfX.d.mts → setup-agent-DgFAhaPJ.d.mts} +12 -11
  59. package/dist/{setup-agent-CmEToB8y.cjs → setup-agent-Dv5VpuHe.cjs} +3 -3
  60. package/dist/tanstack-ai.cjs +4 -4
  61. package/dist/tanstack-ai.d.cts +2 -3
  62. package/dist/tanstack-ai.d.mts +2 -3
  63. package/dist/tanstack-ai.mjs +4 -4
  64. package/dist/testing.cjs +122 -996
  65. package/dist/testing.d.cts +36 -695
  66. package/dist/testing.d.mts +36 -695
  67. package/dist/testing.mjs +112 -977
  68. package/dist/{text-logic-BqxalgMr.d.mts → text-logic-x17uLBwA.d.cts} +238 -2
  69. package/dist/{text-logic-CSf9bqpP.d.cts → text-logic-x17uLBwA.d.mts} +238 -2
  70. package/dist/trajectory-BFjXaooB.d.cts +96 -0
  71. package/dist/trajectory-BFjXaooB.d.mts +96 -0
  72. package/dist/trajectory-BUXj_1Ue.mjs +152 -0
  73. package/dist/trajectory-CoZSv4wF.cjs +157 -0
  74. package/dist/{usage-Bm5nvpow.d.cts → usage-B4B-TQSV.d.mts} +1 -1
  75. package/dist/{usage-BnikdOca.d.mts → usage-DvGcoK6x.d.cts} +1 -1
  76. package/dist/{utils-7lSa4H-i.d.cts → utils-B8k-YPYI.d.mts} +23 -17
  77. package/dist/{utils-CBbKw2fM.d.mts → utils-DAclF-kw.d.cts} +23 -17
  78. package/dist/validate.cjs +4 -4
  79. package/dist/validate.d.cts +2 -2
  80. package/dist/validate.d.mts +2 -2
  81. package/dist/validate.mjs +4 -4
  82. package/dist/{verify-DJHfEfm6.d.cts → verify-CIu4mqIZ.d.mts} +56 -6
  83. package/dist/{verify-i9Hiwc5g.d.mts → verify-CTHlmBbh.d.cts} +56 -6
  84. package/dist/{verify-ChyX6jq0.mjs → verify-Cacz6XSk.mjs} +170 -46
  85. package/dist/{verify-CwlombbC.cjs → verify-D8UDqU4l.cjs} +170 -46
  86. package/dist/{with-model-calls-B_WLmOSl.cjs → with-model-calls-D50Ca6qW.cjs} +2 -2
  87. package/dist/{with-model-calls-BkOwdroS.mjs → with-model-calls-uY-KKliA.mjs} +2 -2
  88. package/docs/advanced.md +5 -5
  89. package/docs/choosing-a-run-mode.md +7 -7
  90. package/docs/debugging.md +6 -8
  91. package/docs/decisions.md +5 -4
  92. package/docs/environment-and-policy.md +1 -1
  93. package/docs/evals.md +57 -43
  94. package/docs/event-log.md +13 -15
  95. package/docs/from-a-loop.md +3 -3
  96. package/docs/generate-machines.md +4 -4
  97. package/docs/hosts.md +25 -30
  98. package/docs/human-in-the-loop.md +5 -8
  99. package/docs/index.md +4 -4
  100. package/docs/judgments.md +5 -7
  101. package/docs/langgraph-comparison.md +6 -6
  102. package/docs/machines-as-data.md +7 -12
  103. package/docs/machines-presets.md +17 -120
  104. package/docs/machines.md +13 -13
  105. package/docs/models-and-providers.md +19 -25
  106. package/docs/multi-agent.md +1 -1
  107. package/docs/observability.md +6 -8
  108. package/docs/persistence.md +10 -20
  109. package/docs/quickstart.md +3 -3
  110. package/docs/statechart-policy-examples.md +1 -1
  111. package/docs/steps.md +5 -6
  112. package/docs/strangler-fig.md +105 -33
  113. package/docs/text-requests.md +10 -12
  114. package/docs/thinking-in-state-machines.md +8 -8
  115. package/docs/tools.md +10 -12
  116. package/docs/upgrading.md +1 -1
  117. package/docs/usage-and-budgets.md +51 -56
  118. package/docs/validate-and-repair.md +9 -14
  119. package/docs/verify.md +54 -7
  120. package/docs/xstate-4-and-5-apps.md +19 -28
  121. package/llms.txt +1 -1
  122. package/package.json +31 -6
  123. package/readme.md +32 -24
  124. package/dist/internal-C3Lqu538.d.cts +0 -43
  125. package/dist/internal-DUcdhk-i.d.mts +0 -43
  126. package/dist/types-DQUOOaZO.d.cts +0 -238
  127. package/dist/types-DQUOOaZO.d.mts +0 -238
  128. package/skills/add-evals/SKILL.md +0 -152
  129. package/skills/add-traces/SKILL.md +0 -152
  130. package/skills/build-machine/SKILL.md +0 -84
  131. package/skills/generate-machine/SKILL.md +0 -335
  132. package/skills/graph-engineering/SKILL.md +0 -43
  133. package/skills/improve-machine/SKILL.md +0 -261
  134. package/skills/improve-machine/reference.md +0 -101
  135. package/skills/loop-to-machine/SKILL.md +0 -205
  136. package/skills/loop-to-machine/policy.md +0 -154
  137. package/skills/loop-to-machine/reference.md +0 -260
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-Dkc-yIYu.cjs");
3
- const require_event_log_store = require("./event-log-store-Cl-YWDnq.cjs");
2
+ const require_event_log = require("./event-log-dSOnXHuG.cjs");
3
+ const require_event_log_store = require("./event-log-store-Dey9ufA4.cjs");
4
4
  //#region src/event-log-store-conformance.ts
5
5
  /**
6
6
  * The runner-agnostic conformance suite for {@link AgentEventLogStore}
@@ -478,7 +478,6 @@ exports.getLogExecutionId = require_event_log.getLogExecutionId;
478
478
  exports.getSnapshotStateHash = require_event_log.getSnapshotStateHash;
479
479
  exports.getUsageFromEvents = require_event_log.getUsageFromEvents;
480
480
  exports.initEntry = require_event_log.initEntry;
481
- exports.rebindActorSession = require_event_log.rebindActorSession;
482
481
  exports.recordLog = require_event_log.recordLog;
483
482
  exports.replay = require_event_log.replay;
484
483
  exports.validateReplayEntries = require_event_log.validateReplayEntries;
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-bc4ICGcS.cjs";
1
+ import { A as recordLog, C as createReplayEntry, D as getSnapshotStateHash, E as getLogExecutionId, M 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 replay, 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-aFXK6yZX.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;
@@ -29,4 +29,4 @@ interface EventLogStoreConformanceHarness {
29
29
  */
30
30
  export declare function assertEventLogStoreConformance(create: CreateStore, harness?: EventLogStoreConformanceHarness): Promise<void>;
31
31
  //#endregion
32
- export { AGENT_EVENT_SCHEMA_VERSION, AGENT_INIT_EVENT_TYPE, AgentEventLogConflictError, AgentEventLogError, type AgentEventLogStore, type AgentInitEvent, type AgentLogEntry, type AgentLogInit, type AgentLogVerification, AgentMachineVersionMismatchError, type AgentPersistedSnapshot, AgentReplayDivergenceError, type CreateReplayEntryOptions, type EventLogStoreConformanceHarness, type JsonValue, type LogRecorder, NonSerializableAgentEventError, type ReplayOptions, type ReplayResult, agentCallOccurrence, assertAgentLogEntry, assertJsonSerializable, createInMemoryEventLogStore, createReplayEntry, forkEventLog, getDecisionAttempts, getLogExecutionId, getSnapshotStateHash, getUsageFromEvents, initEntry, rebindActorSession, recordLog, replay, validateReplayEntries };
32
+ export { AGENT_EVENT_SCHEMA_VERSION, AGENT_INIT_EVENT_TYPE, AgentEventLogConflictError, AgentEventLogError, type AgentEventLogStore, type AgentInitEvent, type AgentLogEntry, type AgentLogInit, type AgentLogVerification, AgentMachineVersionMismatchError, type AgentPersistedSnapshot, AgentReplayDivergenceError, type CreateReplayEntryOptions, type EventLogStoreConformanceHarness, type JsonValue, type LogRecorder, NonSerializableAgentEventError, type ReplayOptions, type ReplayResult, agentCallOccurrence, assertAgentLogEntry, assertJsonSerializable, createInMemoryEventLogStore, createReplayEntry, forkEventLog, getDecisionAttempts, getLogExecutionId, getSnapshotStateHash, getUsageFromEvents, initEntry, recordLog, replay, validateReplayEntries };
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-BBS8so8a.mjs";
1
+ import { A as recordLog, C as createReplayEntry, D as getSnapshotStateHash, E as getLogExecutionId, M 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 replay, 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-DYun526m.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;
@@ -29,4 +29,4 @@ interface EventLogStoreConformanceHarness {
29
29
  */
30
30
  export declare function assertEventLogStoreConformance(create: CreateStore, harness?: EventLogStoreConformanceHarness): Promise<void>;
31
31
  //#endregion
32
- export { AGENT_EVENT_SCHEMA_VERSION, AGENT_INIT_EVENT_TYPE, AgentEventLogConflictError, AgentEventLogError, type AgentEventLogStore, type AgentInitEvent, type AgentLogEntry, type AgentLogInit, type AgentLogVerification, AgentMachineVersionMismatchError, type AgentPersistedSnapshot, AgentReplayDivergenceError, type CreateReplayEntryOptions, type EventLogStoreConformanceHarness, type JsonValue, type LogRecorder, NonSerializableAgentEventError, type ReplayOptions, type ReplayResult, agentCallOccurrence, assertAgentLogEntry, assertJsonSerializable, createInMemoryEventLogStore, createReplayEntry, forkEventLog, getDecisionAttempts, getLogExecutionId, getSnapshotStateHash, getUsageFromEvents, initEntry, rebindActorSession, recordLog, replay, validateReplayEntries };
32
+ export { AGENT_EVENT_SCHEMA_VERSION, AGENT_INIT_EVENT_TYPE, AgentEventLogConflictError, AgentEventLogError, type AgentEventLogStore, type AgentInitEvent, type AgentLogEntry, type AgentLogInit, type AgentLogVerification, AgentMachineVersionMismatchError, type AgentPersistedSnapshot, AgentReplayDivergenceError, type CreateReplayEntryOptions, type EventLogStoreConformanceHarness, type JsonValue, type LogRecorder, NonSerializableAgentEventError, type ReplayOptions, type ReplayResult, agentCallOccurrence, assertAgentLogEntry, assertJsonSerializable, createInMemoryEventLogStore, createReplayEntry, forkEventLog, getDecisionAttempts, getLogExecutionId, getSnapshotStateHash, getUsageFromEvents, initEntry, recordLog, replay, validateReplayEntries };
package/dist/log.mjs CHANGED
@@ -1,5 +1,5 @@
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-DkVlk3Rh.mjs";
2
- import { n as createInMemoryEventLogStore, t as AgentEventLogConflictError } from "./event-log-store-Brx9tOHt.mjs";
1
+ import { S as validateReplayEntries, _ as getSnapshotStateHash, a as AgentReplayDivergenceError, b as recordLog, 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 replay, y as initEntry } from "./event-log-CEq_bVXQ.mjs";
2
+ import { n as createInMemoryEventLogStore, t as AgentEventLogConflictError } from "./event-log-store-DLAfNM34.mjs";
3
3
  //#region src/event-log-store-conformance.ts
4
4
  /**
5
5
  * The runner-agnostic conformance suite for {@link AgentEventLogStore}
@@ -458,4 +458,4 @@ async function assertEventLogStoreConformance(create, harness) {
458
458
  for (const testCase of cases) await testCase.run(create);
459
459
  }
460
460
  //#endregion
461
- export { AGENT_EVENT_SCHEMA_VERSION, AGENT_INIT_EVENT_TYPE, AgentEventLogConflictError, AgentEventLogError, AgentMachineVersionMismatchError, AgentReplayDivergenceError, NonSerializableAgentEventError, agentCallOccurrence, assertAgentLogEntry, assertEventLogStoreConformance, assertJsonSerializable, createInMemoryEventLogStore, createReplayEntry, forkEventLog, getDecisionAttempts, getLogExecutionId, getSnapshotStateHash, getUsageFromEvents, initEntry, rebindActorSession, recordLog, replay, validateReplayEntries };
461
+ export { AGENT_EVENT_SCHEMA_VERSION, AGENT_INIT_EVENT_TYPE, AgentEventLogConflictError, AgentEventLogError, AgentMachineVersionMismatchError, AgentReplayDivergenceError, NonSerializableAgentEventError, agentCallOccurrence, assertAgentLogEntry, assertEventLogStoreConformance, assertJsonSerializable, createInMemoryEventLogStore, createReplayEntry, forkEventLog, getDecisionAttempts, getLogExecutionId, getSnapshotStateHash, getUsageFromEvents, initEntry, recordLog, replay, validateReplayEntries };
@@ -0,0 +1,27 @@
1
+ import { K as getRegisteredAgentExecutionOptions, ct as validateSchemaSync, pt as AgentError, rt as isStandardSchema } from "./event-log-CEq_bVXQ.mjs";
2
+ //#region src/internal/machine-input.ts
3
+ /**
4
+ * Validates `input` against the machine's registered input schema, returning
5
+ * the schema's output, so defaults are filled and transforms applied before
6
+ * the value reaches `createActor`, the replayable event log, or a search.
7
+ *
8
+ * Standard Schema only (no validation library is referenced), so this works for
9
+ * whatever the machine was declared with. Omitted input stays omitted rather
10
+ * than being validated as `{}`: "started with no input" keeps meaning what it
11
+ * has always meant, instead of newly failing schemas with required fields.
12
+ * `caller` names the public function in the error message.
13
+ *
14
+ * @internal
15
+ */
16
+ function resolveMachineInput(machine, input, caller) {
17
+ if (input === void 0) return input;
18
+ const schema = getRegisteredAgentExecutionOptions(machine).schemas?.input;
19
+ if (!isStandardSchema(schema)) return input;
20
+ try {
21
+ return validateSchemaSync(schema, input);
22
+ } catch (error) {
23
+ throw new AgentError("invalid-machine-input", `${caller}: machine input failed validation against the declared input schema: ${error instanceof Error ? error.message : String(error)}`, { cause: error });
24
+ }
25
+ }
26
+ //#endregion
27
+ export { resolveMachineInput as t };
@@ -0,0 +1,32 @@
1
+ const require_event_log = require("./event-log-dSOnXHuG.cjs");
2
+ //#region src/internal/machine-input.ts
3
+ /**
4
+ * Validates `input` against the machine's registered input schema, returning
5
+ * the schema's output, so defaults are filled and transforms applied before
6
+ * the value reaches `createActor`, the replayable event log, or a search.
7
+ *
8
+ * Standard Schema only (no validation library is referenced), so this works for
9
+ * whatever the machine was declared with. Omitted input stays omitted rather
10
+ * than being validated as `{}`: "started with no input" keeps meaning what it
11
+ * has always meant, instead of newly failing schemas with required fields.
12
+ * `caller` names the public function in the error message.
13
+ *
14
+ * @internal
15
+ */
16
+ function resolveMachineInput(machine, input, caller) {
17
+ if (input === void 0) return input;
18
+ const schema = require_event_log.getRegisteredAgentExecutionOptions(machine).schemas?.input;
19
+ if (!require_event_log.isStandardSchema(schema)) return input;
20
+ try {
21
+ return require_event_log.validateSchemaSync(schema, input);
22
+ } catch (error) {
23
+ throw new require_event_log.AgentError("invalid-machine-input", `${caller}: machine input failed validation against the declared input schema: ${error instanceof Error ? error.message : String(error)}`, { cause: error });
24
+ }
25
+ }
26
+ //#endregion
27
+ Object.defineProperty(exports, "resolveMachineInput", {
28
+ enumerable: true,
29
+ get: function() {
30
+ return resolveMachineInput;
31
+ }
32
+ });