@statelyai/agent 2.0.0-alpha.37 → 2.0.0-alpha.39

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 (135) hide show
  1. package/CHANGELOG.md +51 -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 +136 -98
  25. package/dist/index.d.cts +73 -134
  26. package/dist/index.d.mts +73 -134
  27. package/dist/index.mjs +117 -75
  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/machines.cjs +1 -719
  35. package/dist/machines.d.cts +2 -424
  36. package/dist/machines.d.mts +2 -424
  37. package/dist/machines.mjs +2 -709
  38. package/dist/{model-source-kjGwqAV8.mjs → model-source-BrsLDvHL.mjs} +1 -1
  39. package/dist/{model-source-B4WQ8Idp.cjs → model-source-YpxjmWuX.cjs} +1 -1
  40. package/dist/openai.cjs +3 -3
  41. package/dist/openai.d.cts +2 -3
  42. package/dist/openai.d.mts +2 -3
  43. package/dist/openai.mjs +3 -3
  44. package/dist/otel.d.cts +1 -1
  45. package/dist/otel.d.mts +1 -1
  46. package/dist/policy.cjs +77 -0
  47. package/dist/policy.d.cts +143 -0
  48. package/dist/policy.d.mts +143 -0
  49. package/dist/policy.mjs +75 -0
  50. package/dist/{effects-BT_cSY0j.mjs → run-agent-BE7DOWD6.mjs} +150 -184
  51. package/dist/{run-agent-DlPzBWj-.d.mts → run-agent-DHlq87G7.d.mts} +18 -34
  52. package/dist/{effects-DDseYtJk.cjs → run-agent-De3xVFGw.cjs} +149 -201
  53. package/dist/{run-agent-30mH2moE.d.cts → run-agent-Dq0oSFRm.d.cts} +18 -34
  54. package/dist/{setup-agent-BDmNr6PC.mjs → setup-agent-CLm6QVGy.mjs} +3 -3
  55. package/dist/{setup-agent-BaNyz6Q3.d.cts → setup-agent-Cv8Hk3mX.d.cts} +12 -11
  56. package/dist/{setup-agent-C1CG_nfX.d.mts → setup-agent-DgFAhaPJ.d.mts} +12 -11
  57. package/dist/{setup-agent-CmEToB8y.cjs → setup-agent-Dv5VpuHe.cjs} +3 -3
  58. package/dist/tanstack-ai.cjs +4 -4
  59. package/dist/tanstack-ai.d.cts +2 -3
  60. package/dist/tanstack-ai.d.mts +2 -3
  61. package/dist/tanstack-ai.mjs +4 -4
  62. package/dist/testing.cjs +122 -996
  63. package/dist/testing.d.cts +36 -695
  64. package/dist/testing.d.mts +36 -695
  65. package/dist/testing.mjs +112 -977
  66. package/dist/{text-logic-BqxalgMr.d.mts → text-logic-x17uLBwA.d.cts} +238 -2
  67. package/dist/{text-logic-CSf9bqpP.d.cts → text-logic-x17uLBwA.d.mts} +238 -2
  68. package/dist/trajectory-BFjXaooB.d.cts +96 -0
  69. package/dist/trajectory-BFjXaooB.d.mts +96 -0
  70. package/dist/trajectory-BUXj_1Ue.mjs +152 -0
  71. package/dist/trajectory-CoZSv4wF.cjs +157 -0
  72. package/dist/{usage-Bm5nvpow.d.cts → usage-B4B-TQSV.d.mts} +1 -1
  73. package/dist/{usage-BnikdOca.d.mts → usage-DvGcoK6x.d.cts} +1 -1
  74. package/dist/{utils-7lSa4H-i.d.cts → utils-B8k-YPYI.d.mts} +23 -17
  75. package/dist/{utils-CBbKw2fM.d.mts → utils-DAclF-kw.d.cts} +23 -17
  76. package/dist/validate.cjs +4 -4
  77. package/dist/validate.d.cts +2 -2
  78. package/dist/validate.d.mts +2 -2
  79. package/dist/validate.mjs +4 -4
  80. package/dist/{verify-DJHfEfm6.d.cts → verify-BM0sGmsf.d.cts} +42 -6
  81. package/dist/{verify-ChyX6jq0.mjs → verify-CWlg3j7B.mjs} +153 -45
  82. package/dist/{verify-CwlombbC.cjs → verify-Dek6gHCS.cjs} +153 -45
  83. package/dist/{verify-i9Hiwc5g.d.mts → verify-H3Pr2gNw.d.mts} +42 -6
  84. package/dist/{with-model-calls-B_WLmOSl.cjs → with-model-calls-D50Ca6qW.cjs} +2 -2
  85. package/dist/{with-model-calls-BkOwdroS.mjs → with-model-calls-uY-KKliA.mjs} +2 -2
  86. package/docs/advanced.md +5 -5
  87. package/docs/choosing-a-run-mode.md +7 -7
  88. package/docs/debugging.md +6 -8
  89. package/docs/decisions.md +6 -5
  90. package/docs/environment-and-policy.md +1 -1
  91. package/docs/evals.md +57 -43
  92. package/docs/event-log.md +14 -16
  93. package/docs/from-a-loop.md +3 -3
  94. package/docs/generate-machines.md +4 -4
  95. package/docs/hosts.md +22 -29
  96. package/docs/human-in-the-loop.md +5 -8
  97. package/docs/index.md +4 -4
  98. package/docs/judgments.md +5 -7
  99. package/docs/langgraph-comparison.md +6 -6
  100. package/docs/machines-as-data.md +12 -17
  101. package/docs/machines-presets.md +17 -120
  102. package/docs/machines.md +13 -13
  103. package/docs/models-and-providers.md +19 -25
  104. package/docs/multi-agent.md +1 -1
  105. package/docs/observability.md +6 -8
  106. package/docs/persistence.md +15 -25
  107. package/docs/quickstart.md +4 -4
  108. package/docs/statechart-policy-examples.md +1 -1
  109. package/docs/steps.md +5 -6
  110. package/docs/strangler-fig.md +72 -7
  111. package/docs/text-requests.md +10 -12
  112. package/docs/thinking-in-state-machines.md +8 -8
  113. package/docs/tools.md +10 -12
  114. package/docs/upgrading.md +1 -1
  115. package/docs/usage-and-budgets.md +51 -56
  116. package/docs/validate-and-repair.md +9 -14
  117. package/docs/verify.md +53 -7
  118. package/docs/xstate-4-and-5-apps.md +19 -28
  119. package/llms.txt +1 -1
  120. package/package.json +31 -6
  121. package/readme.md +32 -24
  122. package/dist/internal-C3Lqu538.d.cts +0 -43
  123. package/dist/internal-DUcdhk-i.d.mts +0 -43
  124. package/dist/types-DQUOOaZO.d.cts +0 -238
  125. package/dist/types-DQUOOaZO.d.mts +0 -238
  126. package/skills/add-evals/SKILL.md +0 -152
  127. package/skills/add-traces/SKILL.md +0 -152
  128. package/skills/build-machine/SKILL.md +0 -84
  129. package/skills/generate-machine/SKILL.md +0 -335
  130. package/skills/graph-engineering/SKILL.md +0 -43
  131. package/skills/improve-machine/SKILL.md +0 -261
  132. package/skills/improve-machine/reference.md +0 -101
  133. package/skills/loop-to-machine/SKILL.md +0 -205
  134. package/skills/loop-to-machine/policy.md +0 -154
  135. package/skills/loop-to-machine/reference.md +0 -260
package/CHANGELOG.md CHANGED
@@ -1,5 +1,56 @@
1
1
  # @statelyai/agent
2
2
 
3
+ ## 2.0.0-alpha.39
4
+
5
+ ### Minor Changes
6
+
7
+ - [#243](https://github.com/statelyai/agent/pull/243) [`5690efd`](https://github.com/statelyai/agent/commit/5690efd0b8125e16a8107ec67710e7eb362f3a0c) Thanks [@davidkpiano](https://github.com/davidkpiano)! - Move the trace analytics from `@statelyai/agent/testing` to a new `@statelyai/agent/evals` subpath: `foldTraces`, `traceCoverage`, `firstDivergence`, `getDecisionRequests`, `repeatRuns`, `summarizeRepeats`, `judgeAgreement`, `proposeApprovalRules`, and `proposeCaps`, with their types. `@statelyai/agent/testing` keeps lint, simulation, exploration, trajectories, seams, crash recovery, and parity. Change the import path; the functions are unchanged.
8
+
9
+ - [#245](https://github.com/statelyai/agent/pull/245) [`23edb29`](https://github.com/statelyai/agent/commit/23edb29b8e2eda9f1b645e994dad75969b2813b9) Thanks [@davidkpiano](https://github.com/davidkpiano)! - Move `decideNext` and `createPolicyDecider`, with `DecideNextOptions`, `DecideNextResult`, and `PolicyDeciderOptions`, from the root export to a new `@statelyai/agent/policy` subpath. The root keeps `agent.decide` and the decision helpers a machine uses. Change the import path; the functions are unchanged.
10
+
11
+ - [#244](https://github.com/statelyai/agent/pull/244) [`b90750b`](https://github.com/statelyai/agent/commit/b90750b027d6115a708c27aa62f96833f557ae96) Thanks [@davidkpiano](https://github.com/davidkpiano)! - `runAgent` is the one blocking runner. `runToQuiescence` is no longer exported: replace `runToQuiescence(createAgentRuntime(machine, options), init)` with `runAgent(machine, { ...options, ...init })`, which runs the same loop. `createAgentRuntime` stays for hosts that drive the transition loop themselves. The docs, examples, and demo now use `runAgent`.
12
+
13
+ - [#242](https://github.com/statelyai/agent/pull/242) [`fdc0a0f`](https://github.com/statelyai/agent/commit/fdc0a0f65266f53e89b691d51d90621dcbed4efa) Thanks [@davidkpiano](https://github.com/davidkpiano)! - The agent skills no longer ship in the package. `graph-engineering`, `loop-to-machine`, `build-machine`, `generate-machine`, `add-traces`, `add-evals`, and `improve-machine` moved to the `stately-agent` plugin in [statelyai/skills](https://github.com/statelyai/skills). Install them with `/plugin install stately-agent@stately` in Claude Code, or `npx skills add statelyai/skills`.
14
+
15
+ - [#241](https://github.com/statelyai/agent/pull/241) [`ca81ebf`](https://github.com/statelyai/agent/commit/ca81ebfd783efed67f7ffd28e7cba4db5639fdbd) Thanks [@davidkpiano](https://github.com/davidkpiano)! - Remove seven preset factories from `@statelyai/agent/machines`: `createToolLoopMachine`, `createSequentialMachine`, `createRouterMachine`, `createParallelMachine`, `createLoopMachine`, `createSupervisorMachine`, and `createHandoffMachine`, with `routeEventType`, `delegateEventType`, `transferEventType`, `FINISH_EVENT_TYPE`, and the `PresetEntry` types. `createApprovalBatchMachine` stays. For the other shapes, copy the matching example (`prompt-chaining`, `agent-supervisor`, `swarm-handoff`, `parallel-streams`, `map-reduce`).
16
+
17
+ Remove `inspectTransitions` and its `InspectedActorRef` type; filter `@xstate.transition` events in your own `inspect` handler, or use `traceTransitions`. `getMachineStructuralHash` and `rebindActorSession` (from `@statelyai/agent/log`) are no longer exported; set `version` on the machine to pin snapshot identity.
18
+
19
+ ### Patch Changes
20
+
21
+ - [#239](https://github.com/statelyai/agent/pull/239) [`2102b67`](https://github.com/statelyai/agent/commit/2102b67c4ffd59b03824bafb5728e40e8f60ba16) Thanks [@davidkpiano](https://github.com/davidkpiano)! - `explorePaths` and `canReach` deliver the completion of a child machine whose initial state is final, with the child's own output, as a live run does. Before, the parent stayed `idle` in every `children` mode.
22
+
23
+ - [#240](https://github.com/statelyai/agent/pull/240) [`19c7390`](https://github.com/statelyai/agent/commit/19c73902b3424e0678bc7e2dd1c926a1fed0e075) Thanks [@davidkpiano](https://github.com/davidkpiano)! - `explorePaths` with `children: "coupled"` delivers a child machine's entry sends before its completion when the child is final at start, also when it is the only child.
24
+
25
+ - [#230](https://github.com/statelyai/agent/pull/230) [`043642e`](https://github.com/statelyai/agent/commit/043642e9e2a77efd9dbd7e7ba6403f0e1dbd62a8) Thanks [@davidkpiano](https://github.com/davidkpiano)! - Require XState 6.0.0-beta.2. Update the demo and host examples to use this beta and Stately SDK 0.47.0. Complete the demo's fallback statechart outlines and show the active state during streamed runs.
26
+
27
+ - [#237](https://github.com/statelyai/agent/pull/237) [`c0ebe59`](https://github.com/statelyai/agent/commit/c0ebe59e9a971c738c7ed2a630357641c1566e22) Thanks [@davidkpiano](https://github.com/davidkpiano)! - `loop-to-machine` skill and strangler-fig docs: extract a mid-method phase at step 0 and call it from the carved actor, instead of copying its lines. Copying stays only for code you can't edit, pinned with a hash test.
28
+
29
+ - [#236](https://github.com/statelyai/agent/pull/236) [`77d1fb9`](https://github.com/statelyai/agent/commit/77d1fb9eddad7d469425777a3939ccbf7ec47295) Thanks [@davidkpiano](https://github.com/davidkpiano)! - Bind live objects per run:
30
+
31
+ - `runAgent` and `createAgentRuntime` take `actions`, merged onto the machine like `actors`. Keys and params are checked against the actions declared in `setupAgent`.
32
+ - `setupAgent` keeps the declared action types, so `actions.name` in a transition is typed and a misspelled name is a type error.
33
+ - `checkParity` takes `setup: (scenario, side) => liveObject`, called once per side; its result is passed to `effects`, `before` and `after`.
34
+
35
+ - [#238](https://github.com/statelyai/agent/pull/238) [`5de19d8`](https://github.com/statelyai/agent/commit/5de19d816b44b574af98dbb0026e7ca87425ab83) Thanks [@davidkpiano](https://github.com/davidkpiano)! - `explorePaths({ steps: true })` records every macrostep on each terminal, with the srcs each step started and settled. `canReach` takes an ordering target, `{ after, reach }`, to prove that something never happens after a trigger ("no turn starts after STOP"). The trigger is part of the `dedupeBy` key, so the proof stays sound.
36
+
37
+ - [#246](https://github.com/statelyai/agent/pull/246) [`9956c61`](https://github.com/statelyai/agent/commit/9956c619b9e199447f94aa9a1acb9a2e199a07a6) Thanks [@davidkpiano](https://github.com/davidkpiano)! - The Evals docs now open the parity section with a table that picks `checkParity`, `createRecorder` with `compareRecordings`, or `compareRuns` by what the code you replace exposes, starting with `checkParity`.
38
+
39
+ - [#233](https://github.com/statelyai/agent/pull/233) [`46aa2b2`](https://github.com/statelyai/agent/commit/46aa2b29ec091ad6d6ca1590a67ec701d8bfe15c) Thanks [@davidkpiano](https://github.com/davidkpiano)! - `recordLog` marks an entry `ignored: true` when the machine had no transition for an event sent to it, in the state the event arrived in. `xstate.*` events are never marked. A refused event can now be read from the log without a replay. `AgentLogEntry` gains the optional `ignored` field, and replay does not read it.
40
+
41
+ - [#235](https://github.com/statelyai/agent/pull/235) [`5d09f67`](https://github.com/statelyai/agent/commit/5d09f67a069575445e928545c4c285764479599f) Thanks [@davidkpiano](https://github.com/davidkpiano)! - Add `createGeneratorBridge` for carving a loop whose public surface is an async generator: an actor forwards each pass's values to the consumer one pull at a time, with `.throw()` and `.return()` forwarded back. `checkParity` and `wrapWorkflow().run` take `recordOptions` per effect (`serialize`, `revive`, `redact`).
42
+
43
+ - [#234](https://github.com/statelyai/agent/pull/234) [`6f32118`](https://github.com/statelyai/agent/commit/6f3211865c3e97de8cb338ecf201838e5d8e3e99) Thanks [@davidkpiano](https://github.com/davidkpiano)! - - `StandardSchemaV1` accepts schemas whose `types` is `| undefined`, so zod 4 schemas keep their types under `exactOptionalPropertyTypes`.
44
+ - A recorded stream that fails replays its chunks, then the error, in `recorder.fn`, `recorder.client`, and the OpenAI seam. An OpenAI stream that fails midway now records the error.
45
+ - Recorded errors keep `cause` and an `AggregateError`'s `errors`; replay restores them. `createRecorder` and `checkParity` take `reviveError` to rebuild error classes for `instanceof` checks.
46
+ - Docs and the loop-to-machine skill cover async generator loops, class seams on both sides of parity, and host cancel registries with `runAgent`'s asynchronous start.
47
+
48
+ ## 2.0.0-alpha.38
49
+
50
+ ### Patch Changes
51
+
52
+ - [#226](https://github.com/statelyai/agent/pull/226) [`11fe8e7`](https://github.com/statelyai/agent/commit/11fe8e75b7ec3255a41cc9b2460abbbdcac5d572) Thanks [@davidkpiano](https://github.com/davidkpiano)! - `describeMachine` separates descriptions with ` - ` instead of an em dash, so its output is plain ASCII.
53
+
3
54
  ## 2.0.0-alpha.37
4
55
 
5
56
  ### Patch Changes
@@ -1,4 +1,4 @@
1
- const require_event_log = require("./event-log-Dkc-yIYu.cjs");
1
+ const require_event_log = require("./event-log-dSOnXHuG.cjs");
2
2
  let xstate = require("xstate");
3
3
  //#region src/act.ts
4
4
  /** The `agent.act` builtin's tool-loop bound when its input sets no `maxSteps`. */
@@ -1,4 +1,4 @@
1
- import { E as ACT_ACTOR } from "./event-log-DkVlk3Rh.mjs";
1
+ import { T as ACT_ACTOR } from "./event-log-CEq_bVXQ.mjs";
2
2
  import { createAsyncLogic } from "xstate";
3
3
  //#region src/act.ts
4
4
  /** The `agent.act` builtin's tool-loop bound when its input sets no `maxSteps`. */
package/dist/ai-sdk.cjs CHANGED
@@ -1,8 +1,8 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_event_log = require("./event-log-Dkc-yIYu.cjs");
3
- const require_decision = require("./decision-CMeuNZ1g.cjs");
4
- const require_model_source = require("./model-source-B4WQ8Idp.cjs");
5
- const require_with_model_calls = require("./with-model-calls-B_WLmOSl.cjs");
2
+ const require_event_log = require("./event-log-dSOnXHuG.cjs");
3
+ const require_decision = require("./decision-D8bcIGXQ.cjs");
4
+ const require_model_source = require("./model-source-YpxjmWuX.cjs");
5
+ const require_with_model_calls = require("./with-model-calls-D50Ca6qW.cjs");
6
6
  let ai = require("ai");
7
7
  //#region src/ai-sdk/mappers.ts
8
8
  /**
package/dist/ai-sdk.d.cts CHANGED
@@ -1,6 +1,5 @@
1
- import { l as AgentTools, p as ChosenEvent } from "./types-DQUOOaZO.cjs";
2
- import { I as AgentDecisionRejection, L as AgentDecisionRequest, c as AgentRequestExecutorInfo, f as AgentTextRequest, r as AgentFinishReason, t as AgentCallUsage } from "./text-logic-CSf9bqpP.cjs";
3
- import { n as DecisionModeOption, t as DecisionMode } from "./decision-object-DBcLWVvv.cjs";
1
+ import { I as AgentDecisionRejection, L as AgentDecisionRequest, c as AgentRequestExecutorInfo, f as AgentTextRequest, ht as AgentTools, r as AgentFinishReason, t as AgentCallUsage, yt as ChosenEvent } from "./text-logic-x17uLBwA.cjs";
2
+ import { n as DecisionModeOption, t as DecisionMode } from "./decision-object-BB8XV5Ec.cjs";
4
3
  import { Experimental_DecisionModel, FinishReason, LanguageModel, LanguageModelUsage, ModelMessage, ToolSet, TypedToolCall, TypedToolResult, generateText } from "ai";
5
4
  import { AnyStateMachine } from "xstate";
6
5
  //#region src/ai-sdk/mappers.d.ts
package/dist/ai-sdk.d.mts CHANGED
@@ -1,6 +1,5 @@
1
- import { l as AgentTools, p as ChosenEvent } from "./types-DQUOOaZO.mjs";
2
- import { I as AgentDecisionRejection, L as AgentDecisionRequest, c as AgentRequestExecutorInfo, f as AgentTextRequest, r as AgentFinishReason, t as AgentCallUsage } from "./text-logic-BqxalgMr.mjs";
3
- import { n as DecisionModeOption, t as DecisionMode } from "./decision-object-B5zGSPFp.mjs";
1
+ import { I as AgentDecisionRejection, L as AgentDecisionRequest, c as AgentRequestExecutorInfo, f as AgentTextRequest, ht as AgentTools, r as AgentFinishReason, t as AgentCallUsage, yt as ChosenEvent } from "./text-logic-x17uLBwA.mjs";
2
+ import { n as DecisionModeOption, t as DecisionMode } from "./decision-object-CH_sE694.mjs";
4
3
  import { AnyStateMachine } from "xstate";
5
4
  import { Experimental_DecisionModel, FinishReason, LanguageModel, LanguageModelUsage, ModelMessage, ToolSet, TypedToolCall, TypedToolResult, generateText } from "ai";
6
5
  //#region src/ai-sdk/mappers.d.ts
package/dist/ai-sdk.mjs CHANGED
@@ -1,7 +1,7 @@
1
- import { H as providerOutputSchema, P as getAgentOutputMode, at as isStandardSchema, gt as AgentTruncatedError, mt as isRecord } from "./event-log-DkVlk3Rh.mjs";
2
- import { c as renderDecisionAttempts, o as decisionOptionIds } from "./decision-m5hGmHpF.mjs";
3
- import { t as resolveModelSource } from "./model-source-kjGwqAV8.mjs";
4
- import { a as multipleCallsRejection, i as fromDecisionObject, n as rejectedAnswer, o as resolveDecisionMode, r as decisionObjectSchema, t as withModelCalls } from "./with-model-calls-BkOwdroS.mjs";
1
+ import { N as getAgentOutputMode, V as providerOutputSchema, ft as isRecord, mt as AgentTruncatedError, rt as isStandardSchema } from "./event-log-CEq_bVXQ.mjs";
2
+ import { c as renderDecisionAttempts, o as decisionOptionIds } from "./decision-B41YBx5U.mjs";
3
+ import { t as resolveModelSource } from "./model-source-BrsLDvHL.mjs";
4
+ import { a as multipleCallsRejection, i as fromDecisionObject, n as rejectedAnswer, o as resolveDecisionMode, r as decisionObjectSchema, t as withModelCalls } from "./with-model-calls-uY-KKliA.mjs";
5
5
  import { InvalidResponseDataError, NoObjectGeneratedError, Output, ToolChoiceViolationError, experimental_decide, generateText, jsonSchema, stepCountIs, streamText, tool } from "ai";
6
6
  //#region src/ai-sdk/mappers.ts
7
7
  /**
@@ -1,4 +1,4 @@
1
- import { G as executorBoundLogics, K as getAgentExecutionOptions, O as DECIDE_ACTOR, U as resolveTextLogicValue, d as canonicalEventJson, et as getJsonSchemaSync, ht as AgentError, lt as userMessage, mt as isRecord, ut as validateSchemaSync } from "./event-log-DkVlk3Rh.mjs";
1
+ import { $ as getJsonSchemaSync, D as DECIDE_ACTOR, G as getAgentExecutionOptions, H as resolveTextLogicValue, W as executorBoundLogics, ct as validateSchemaSync, d as canonicalEventJson, ft as isRecord, pt as AgentError, st as userMessage } from "./event-log-CEq_bVXQ.mjs";
2
2
  import { createAsyncLogic, getNextTransitions } from "xstate";
3
3
  //#region src/events.ts
4
4
  /**
@@ -1,4 +1,4 @@
1
- const require_event_log = require("./event-log-Dkc-yIYu.cjs");
1
+ const require_event_log = require("./event-log-dSOnXHuG.cjs");
2
2
  let xstate = require("xstate");
3
3
  //#region src/events.ts
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { L as AgentDecisionRequest } from "./text-logic-CSf9bqpP.cjs";
1
+ import { L as AgentDecisionRequest } from "./text-logic-x17uLBwA.cjs";
2
2
  //#region src/internal/decision-object.d.ts
3
3
  /**
4
4
  * How a decide executor asks a language model for its one event:
@@ -1,4 +1,4 @@
1
- import { L as AgentDecisionRequest } from "./text-logic-BqxalgMr.mjs";
1
+ import { L as AgentDecisionRequest } from "./text-logic-x17uLBwA.mjs";
2
2
  //#region src/internal/decision-object.d.ts
3
3
  /**
4
4
  * How a decide executor asks a language model for its one event:
@@ -0,0 +1,23 @@
1
+ //#region src/internal/effects.ts
2
+ /**
3
+ * A plain copy of an effects object with every callable effect passed
4
+ * through `wrap`: own and inherited methods alike (a class instance's
5
+ * prototype methods), each bound to the original object so `this` still
6
+ * works. Other own properties are copied as they are.
7
+ */
8
+ function mapEffects(effects, wrap) {
9
+ const source = effects;
10
+ const out = {};
11
+ for (let level = effects; level !== null && level !== Object.prototype; level = Object.getPrototypeOf(level)) for (const name of Object.getOwnPropertyNames(level)) {
12
+ if (name === "constructor" || name in out) continue;
13
+ const value = source[name];
14
+ out[name] = typeof value === "function" ? wrap(name, value.bind(effects)) : value;
15
+ }
16
+ return out;
17
+ }
18
+ /** A stream, as recorders and wrapped effects see one: anything `for await` reads. */
19
+ function isAsyncIterable(value) {
20
+ return value !== null && (typeof value === "object" || typeof value === "function") && typeof value[Symbol.asyncIterator] === "function";
21
+ }
22
+ //#endregion
23
+ export { mapEffects as n, isAsyncIterable as t };
@@ -0,0 +1,34 @@
1
+ //#region src/internal/effects.ts
2
+ /**
3
+ * A plain copy of an effects object with every callable effect passed
4
+ * through `wrap`: own and inherited methods alike (a class instance's
5
+ * prototype methods), each bound to the original object so `this` still
6
+ * works. Other own properties are copied as they are.
7
+ */
8
+ function mapEffects(effects, wrap) {
9
+ const source = effects;
10
+ const out = {};
11
+ for (let level = effects; level !== null && level !== Object.prototype; level = Object.getPrototypeOf(level)) for (const name of Object.getOwnPropertyNames(level)) {
12
+ if (name === "constructor" || name in out) continue;
13
+ const value = source[name];
14
+ out[name] = typeof value === "function" ? wrap(name, value.bind(effects)) : value;
15
+ }
16
+ return out;
17
+ }
18
+ /** A stream, as recorders and wrapped effects see one: anything `for await` reads. */
19
+ function isAsyncIterable(value) {
20
+ return value !== null && (typeof value === "object" || typeof value === "function") && typeof value[Symbol.asyncIterator] === "function";
21
+ }
22
+ //#endregion
23
+ Object.defineProperty(exports, "isAsyncIterable", {
24
+ enumerable: true,
25
+ get: function() {
26
+ return isAsyncIterable;
27
+ }
28
+ });
29
+ Object.defineProperty(exports, "mapEffects", {
30
+ enumerable: true,
31
+ get: function() {
32
+ return mapEffects;
33
+ }
34
+ });