@statelyai/agent 2.0.0-alpha.19 → 2.0.0-alpha.21

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.
@@ -1,5 +1,5 @@
1
1
  import { t as AgentError } from "./errors-CeSXQx0v.mjs";
2
- import { F as djb2Hex, M as machineStaticTransitionTargets, N as missingActor, T as agentExecutionOptions, U as resolveMachineVersion, d as USER_INPUT_ACTOR, g as executeAgentTextRequest, h as createTextLogic, j as machineIdlePredicates, k as getRegisteredAgentExecutionOptions, l as DECIDE_ACTOR, m as builtinTextActors, n as createDecideActor, o as getAcceptedEvents, q as validateSchemaSync, r as isDecisionLogic, w as userInputActor, y as isTextLogic } from "./decision-DsIkEuHz.mjs";
2
+ import { D as agentExecutionOptions, E as userInputActor, F as missingActor, G as resolveMachineVersion, L as djb2Hex, N as machineIdlePredicates, P as machineStaticTransitionTargets, Y as validateSchemaSync, _ as createTextLogic, g as builtinTextActors, j as getRegisteredAgentExecutionOptions, l as DECIDE_ACTOR, n as createDecideActor, o as getAcceptedEvents, p as USER_INPUT_ACTOR, r as isDecisionLogic, v as executeAgentTextRequest, x as isTextLogic } from "./decision-JWx6n3xR.mjs";
3
3
  import { a as assertJsonSerializable, i as assertAgentLogEntry } from "./event-log-store-DmIDosD6.mjs";
4
4
  import { createMachineFromConfig, initialTransition, setup, transition } from "xstate";
5
5
  //#region src/messages.ts
@@ -918,7 +918,7 @@ function createRequestsFromWorkflowConfig(config, compileSchema) {
918
918
  messages: resolver(request.messages),
919
919
  tools: request.tools,
920
920
  toolChoice: request.toolChoice,
921
- reasoning: request.reasoning,
921
+ includeReasoning: request.includeReasoning,
922
922
  temperature: resolver(request.temperature),
923
923
  maxOutputTokens: resolver(request.maxOutputTokens),
924
924
  topP: resolver(request.topP),
package/dist/sqlite.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { r as AgentSnapshotStore } from "./types-pJ5Hn8fv.cjs";
1
+ import { r as AgentSnapshotStore } from "./types-DSdj2tGs.cjs";
2
2
  import { r as AgentEventLogStore } from "./event-log-store-Bz7HDBkE.cjs";
3
3
 
4
4
  //#region src/sqlite/index.d.ts
package/dist/sqlite.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { r as AgentSnapshotStore } from "./types-DYpK3QF4.mjs";
1
+ import { r as AgentSnapshotStore } from "./types-CvWRGFxP.mjs";
2
2
  import { r as AgentEventLogStore } from "./event-log-store-hrA1vqtN.mjs";
3
3
 
4
4
  //#region src/sqlite/index.d.ts
@@ -1,4 +1,4 @@
1
- import { a as AgentToolChoice, c as AgentTools, d as ChosenEvent, g as InferOutput, l as AllowedEvents, n as AgentMessage, v as StandardSchemaV1 } from "./types-DYpK3QF4.mjs";
1
+ import { a as AgentToolChoice, c as AgentTools, d as ChosenEvent, g as InferOutput, l as AllowedEvents, n as AgentMessage, v as StandardSchemaV1 } from "./types-CvWRGFxP.mjs";
2
2
  import { t as AgentError } from "./errors-C9rxnWbX.mjs";
3
3
  import { AnyMachineSnapshot, AsyncActorLogic, EventObject, MachineSnapshot } from "xstate";
4
4
 
@@ -342,8 +342,11 @@ interface AgentTextRequest<TMetadata = Record<string, unknown>> {
342
342
  * structured-output envelope schema, nudging the model to reason before
343
343
  * committing to the result. The reasoning is surfaced on the executor's raw
344
344
  * result (never in machine context/output). Ignored for text-mode requests.
345
+ *
346
+ * Not a provider setting: reasoning EFFORT belongs to the host, which owns
347
+ * how hard a model thinks. See `createAiSdkExecutors({ settings })`.
345
348
  */
346
- reasoning?: boolean;
349
+ includeReasoning?: boolean;
347
350
  temperature?: number;
348
351
  /**
349
352
  * Maximum number of output tokens to generate. Named `maxOutputTokens` (not
@@ -479,8 +482,8 @@ interface TextLogicConfig<TInputSchema extends StandardSchemaV1 = StandardSchema
479
482
  messages?: ResolveTextLogicValue<AgentMessage[] | undefined, InferOutput<TInputSchema>>;
480
483
  tools?: ResolveTextLogicValue<AgentTools | undefined, InferOutput<TInputSchema>>;
481
484
  toolChoice?: ResolveTextLogicValue<AgentToolChoice | undefined, InferOutput<TInputSchema>>;
482
- /** Opt into the structured-output envelope's `reasoning` field (see {@link AgentTextRequest.reasoning}). */
483
- reasoning?: ResolveTextLogicValue<boolean | undefined, InferOutput<TInputSchema>>;
485
+ /** Opt into the structured-output envelope's `reasoning` field (see {@link AgentTextRequest.includeReasoning}). */
486
+ includeReasoning?: ResolveTextLogicValue<boolean | undefined, InferOutput<TInputSchema>>;
484
487
  temperature?: ResolveTextLogicValue<number | undefined, InferOutput<TInputSchema>>;
485
488
  maxOutputTokens?: ResolveTextLogicValue<number | undefined, InferOutput<TInputSchema>>;
486
489
  topP?: ResolveTextLogicValue<number | undefined, InferOutput<TInputSchema>>;
@@ -739,6 +742,6 @@ declare function buildEnvelopeSchema(inner: StandardSchemaV1, options?: {
739
742
  * Pair with {@link buildEnvelopeSchema} (which produced the schema the
740
743
  * provider was asked to satisfy).
741
744
  */
742
- declare function parseStructuredEnvelope(request: Pick<AgentTextRequest, "outputSchema" | "reasoning">, value: unknown): StructuredOutputEnvelope;
745
+ declare function parseStructuredEnvelope(request: Pick<AgentTextRequest, "outputSchema" | "includeReasoning">, value: unknown): StructuredOutputEnvelope;
743
746
  //#endregion
744
747
  export { AgentDecisionExecutor as A, AgentEventToolNameResolver as B, buildEnvelopeSchema as C, parseModelRef as D, getCallUsage as E, DecisionLogicConfig as F, parseAgentEvent as G, AgentRequestSource as H, ResolveDecisionOptions as I, renderDecisionAttempts as L, AgentDecisionInput as M, AgentDecisionRequest as N, parseOutput as O, DecisionAttempt as P, resolveDecision as R, bindRequestExecutor as S, getAgentOutputMode as T, AgentSchemas as U, AgentRequestOptions as V, getAcceptedEvents as W, StructuredOutputEnvelope as _, AgentOutputMode as a, TextLogicExecuteArgs as b, AgentRequestExecutorResult as c, AgentTextRequest as d, AgentUsage as f, BuiltinAgentActors as g, AiSdkShapedTextResult as h, AgentModelRef as i, AgentDecisionExhaustedError as j, parseStructuredEnvelope as k, AgentRequestExecutors as l, AiSdkShapedStreamResult as m, AgentExecutorTextRequest as n, AgentRequestExecutor as o, AgentUserInput as p, AgentModelMap as r, AgentRequestExecutorInfo as s, AgentCallUsage as t, AgentRequestMode as u, TextLogic as v, createTextLogic as w, TextLogicExecutor as x, TextLogicConfig as y, AgentEventDescriptor as z };
@@ -1,4 +1,4 @@
1
- import { a as AgentToolChoice, c as AgentTools, d as ChosenEvent, g as InferOutput, l as AllowedEvents, n as AgentMessage, v as StandardSchemaV1 } from "./types-pJ5Hn8fv.cjs";
1
+ import { a as AgentToolChoice, c as AgentTools, d as ChosenEvent, g as InferOutput, l as AllowedEvents, n as AgentMessage, v as StandardSchemaV1 } from "./types-DSdj2tGs.cjs";
2
2
  import { t as AgentError } from "./errors-BQRk9eiZ.cjs";
3
3
  import { AnyMachineSnapshot, AsyncActorLogic, EventObject, MachineSnapshot } from "xstate";
4
4
 
@@ -342,8 +342,11 @@ interface AgentTextRequest<TMetadata = Record<string, unknown>> {
342
342
  * structured-output envelope schema, nudging the model to reason before
343
343
  * committing to the result. The reasoning is surfaced on the executor's raw
344
344
  * result (never in machine context/output). Ignored for text-mode requests.
345
+ *
346
+ * Not a provider setting: reasoning EFFORT belongs to the host, which owns
347
+ * how hard a model thinks. See `createAiSdkExecutors({ settings })`.
345
348
  */
346
- reasoning?: boolean;
349
+ includeReasoning?: boolean;
347
350
  temperature?: number;
348
351
  /**
349
352
  * Maximum number of output tokens to generate. Named `maxOutputTokens` (not
@@ -479,8 +482,8 @@ interface TextLogicConfig<TInputSchema extends StandardSchemaV1 = StandardSchema
479
482
  messages?: ResolveTextLogicValue<AgentMessage[] | undefined, InferOutput<TInputSchema>>;
480
483
  tools?: ResolveTextLogicValue<AgentTools | undefined, InferOutput<TInputSchema>>;
481
484
  toolChoice?: ResolveTextLogicValue<AgentToolChoice | undefined, InferOutput<TInputSchema>>;
482
- /** Opt into the structured-output envelope's `reasoning` field (see {@link AgentTextRequest.reasoning}). */
483
- reasoning?: ResolveTextLogicValue<boolean | undefined, InferOutput<TInputSchema>>;
485
+ /** Opt into the structured-output envelope's `reasoning` field (see {@link AgentTextRequest.includeReasoning}). */
486
+ includeReasoning?: ResolveTextLogicValue<boolean | undefined, InferOutput<TInputSchema>>;
484
487
  temperature?: ResolveTextLogicValue<number | undefined, InferOutput<TInputSchema>>;
485
488
  maxOutputTokens?: ResolveTextLogicValue<number | undefined, InferOutput<TInputSchema>>;
486
489
  topP?: ResolveTextLogicValue<number | undefined, InferOutput<TInputSchema>>;
@@ -739,6 +742,6 @@ declare function buildEnvelopeSchema(inner: StandardSchemaV1, options?: {
739
742
  * Pair with {@link buildEnvelopeSchema} (which produced the schema the
740
743
  * provider was asked to satisfy).
741
744
  */
742
- declare function parseStructuredEnvelope(request: Pick<AgentTextRequest, "outputSchema" | "reasoning">, value: unknown): StructuredOutputEnvelope;
745
+ declare function parseStructuredEnvelope(request: Pick<AgentTextRequest, "outputSchema" | "includeReasoning">, value: unknown): StructuredOutputEnvelope;
743
746
  //#endregion
744
747
  export { AgentDecisionExecutor as A, AgentEventToolNameResolver as B, buildEnvelopeSchema as C, parseModelRef as D, getCallUsage as E, DecisionLogicConfig as F, parseAgentEvent as G, AgentRequestSource as H, ResolveDecisionOptions as I, renderDecisionAttempts as L, AgentDecisionInput as M, AgentDecisionRequest as N, parseOutput as O, DecisionAttempt as P, resolveDecision as R, bindRequestExecutor as S, getAgentOutputMode as T, AgentSchemas as U, AgentRequestOptions as V, getAcceptedEvents as W, StructuredOutputEnvelope as _, AgentOutputMode as a, TextLogicExecuteArgs as b, AgentRequestExecutorResult as c, AgentTextRequest as d, AgentUsage as f, BuiltinAgentActors as g, AiSdkShapedTextResult as h, AgentModelRef as i, AgentDecisionExhaustedError as j, parseStructuredEnvelope as k, AgentRequestExecutors as l, AiSdkShapedStreamResult as m, AgentExecutorTextRequest as n, AgentRequestExecutor as o, AgentUserInput as p, AgentModelMap as r, AgentRequestExecutorInfo as s, AgentCallUsage as t, AgentRequestMode as u, TextLogic as v, createTextLogic as w, TextLogicExecutor as x, TextLogicConfig as y, AgentEventDescriptor as z };
@@ -203,7 +203,12 @@ type AgentToolSchema = object;
203
203
  * SDK you built the tool with owns its precise input typing.
204
204
  */
205
205
  interface AgentToolDescriptor {
206
- description?: string;
206
+ /**
207
+ * Text shown to the model. Typed loosely enough to accept an SDK tool whose
208
+ * description is computed per call (the AI SDK v7 `tool({ description })`
209
+ * accepts a function of the call's context); core never reads it.
210
+ */
211
+ description?: string | ((...args: any[]) => string);
207
212
  inputSchema?: AgentToolSchema;
208
213
  outputSchema?: AgentToolSchema;
209
214
  execute?: (...args: any[]) => unknown;
@@ -203,7 +203,12 @@ type AgentToolSchema = object;
203
203
  * SDK you built the tool with owns its precise input typing.
204
204
  */
205
205
  interface AgentToolDescriptor {
206
- description?: string;
206
+ /**
207
+ * Text shown to the model. Typed loosely enough to accept an SDK tool whose
208
+ * description is computed per call (the AI SDK v7 `tool({ description })`
209
+ * accepts a function of the call's context); core never reads it.
210
+ */
211
+ description?: string | ((...args: any[]) => string);
207
212
  inputSchema?: AgentToolSchema;
208
213
  outputSchema?: AgentToolSchema;
209
214
  execute?: (...args: any[]) => unknown;
package/dist/validate.cjs CHANGED
@@ -22,7 +22,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
22
22
  }) : target, mod));
23
23
  //#endregion
24
24
  let ajv_dist_2020_js = require("ajv/dist/2020.js");
25
- ajv_dist_2020_js = __toESM(ajv_dist_2020_js);
25
+ ajv_dist_2020_js = __toESM(ajv_dist_2020_js, 1);
26
26
  //#region schemas/agent-workflow.json
27
27
  var agent_workflow_default = {
28
28
  $schema: "https://json-schema.org/draft/2020-12/schema",
@@ -221,7 +221,7 @@ var agent_workflow_default = {
221
221
  "additionalProperties": false
222
222
  }]
223
223
  },
224
- "reasoning": {
224
+ "includeReasoning": {
225
225
  "description": "Opt into the structured-output envelope's `reasoning` field.",
226
226
  "type": "boolean"
227
227
  },
package/dist/validate.mjs CHANGED
@@ -197,7 +197,7 @@ var agent_workflow_default = {
197
197
  "additionalProperties": false
198
198
  }]
199
199
  },
200
- "reasoning": {
200
+ "includeReasoning": {
201
201
  "description": "Opt into the structured-output envelope's `reasoning` field.",
202
202
  "type": "boolean"
203
203
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@statelyai/agent",
3
- "version": "2.0.0-alpha.19",
3
+ "version": "2.0.0-alpha.21",
4
4
  "description": "Make invalid agent actions impossible. Agent logic as state machines: deterministic, inspectable, resumable, runs anywhere.",
5
5
  "keywords": [
6
6
  "agent",
@@ -94,51 +94,51 @@
94
94
  "access": "public"
95
95
  },
96
96
  "devDependencies": {
97
- "@ai-sdk/openai": "^3.0.25",
98
- "@anthropic-ai/sdk": "^0.109.1",
99
- "@changesets/changelog-github": "^0.5.0",
100
- "@changesets/cli": "^2.27.9",
97
+ "@ai-sdk/openai": "^4.0.0",
98
+ "@anthropic-ai/sdk": "^0.120.0",
99
+ "@changesets/changelog-github": "^0.5.2",
100
+ "@changesets/cli": "^2.31.1",
101
101
  "@earendil-works/pi-ai": "0.83.0",
102
- "@flue/runtime": "2.0.0",
103
- "@inquirer/prompts": "^8.5.2",
104
- "@langchain/core": "^1.2.4",
105
- "@langchain/openai": "^1.5.5",
106
- "@mastra/core": "^1.54.0",
102
+ "@flue/runtime": "2.0.3",
103
+ "@inquirer/prompts": "^8.6.0",
104
+ "@langchain/core": "^1.2.9",
105
+ "@langchain/openai": "^1.5.10",
106
+ "@mastra/core": "^1.61.0",
107
107
  "@opentelemetry/api": "^1.9.1",
108
108
  "@opentelemetry/context-async-hooks": "^2.10.0",
109
109
  "@opentelemetry/exporter-trace-otlp-http": "^0.221.0",
110
110
  "@opentelemetry/sdk-trace-base": "^2.10.0",
111
111
  "@opentelemetry/sdk-trace-node": "^2.10.0",
112
- "@statelyai/sdk": "^0.16.2",
112
+ "@statelyai/sdk": "^0.22.1",
113
113
  "@types/express": "^5.0.6",
114
- "@types/node": "^20.16.10",
115
- "@types/react": "^19.2.17",
116
- "ai": "^6.0.67",
114
+ "@types/node": "^20.19.43",
115
+ "@types/react": "^19.2.18",
116
+ "ai": "^7.0.0",
117
117
  "ajv": "^8.20.0",
118
- "braintrust": "^3.25.0",
119
- "dotenv": "^16.4.5",
118
+ "braintrust": "^3.28.0",
119
+ "dotenv": "^16.6.1",
120
120
  "express": "^5.2.1",
121
- "hono": "^4.12.30",
121
+ "hono": "^4.13.3",
122
122
  "knip": "6.24.0",
123
- "langchain": "^1.5.4",
124
- "openai": "^6.45.0",
123
+ "langchain": "^1.5.10",
124
+ "openai": "^7.5.0",
125
125
  "oxfmt": "0.57.0",
126
126
  "oxlint": "1.72.0",
127
- "react": "^19.2.7",
128
- "tsdown": "^0.21.7",
129
- "tsx": "^4.21.0",
127
+ "react": "^19.2.8",
128
+ "tsdown": "^0.21.10",
129
+ "tsx": "^4.23.12",
130
130
  "twoslash": "^0.3.9",
131
- "typescript": "^5.6.2",
131
+ "typescript": "^5.9.3",
132
132
  "valibot": "^1.4.2",
133
- "vitest": "^3.2.6",
134
- "xstate": "6.0.0-alpha.25",
135
- "zod": "^4.3.6"
133
+ "vitest": "^4.1.11",
134
+ "xstate": "6.0.0-alpha.48",
135
+ "zod": "^4.4.3"
136
136
  },
137
137
  "peerDependencies": {
138
138
  "@opentelemetry/api": "^1",
139
- "ai": "^6.0.67",
139
+ "ai": "^7.0.0",
140
140
  "ajv": "^8.20.0",
141
- "xstate": ">=6.0.0-alpha.25 <6.0.0"
141
+ "xstate": ">=6.0.0-alpha.46 <6.0.0"
142
142
  },
143
143
  "peerDependenciesMeta": {
144
144
  "@opentelemetry/api": {
package/readme.md CHANGED
@@ -12,7 +12,7 @@ Stately Agent adds model requests and decisions to XState:
12
12
 
13
13
  Stately Agent 2 is in alpha. APIs may change before the stable release.
14
14
 
15
- [Documentation](https://stately.ai/docs/agents) · [Examples](examples/README.md) · [XState](https://github.com/statelyai/xstate)
15
+ [Documentation](https://stately.ai/docs/packages/agent) · [Examples](examples/README.md) · [XState](https://github.com/statelyai/xstate)
16
16
 
17
17
  ## Three starting points
18
18
 
@@ -25,14 +25,14 @@ Stately Agent 2 is in alpha. APIs may change before the stable release.
25
25
  <!-- install command matching the package prerelease channel and package.json peers -->
26
26
 
27
27
  ```sh
28
- pnpm add @statelyai/agent@alpha xstate@alpha zod ai@^6 @ai-sdk/openai@^3
28
+ pnpm add @statelyai/agent@alpha xstate@alpha zod ai@^7 @ai-sdk/openai@^4
29
29
  ```
30
30
 
31
31
  Requirements:
32
32
 
33
- - Node 22.18 or newer, and XState v6 alpha.25 or newer.
33
+ - Node 22.18 or newer, and XState v6 alpha.46 or newer.
34
34
  - The package is ESM-first. CommonJS builds are published too, so `require()` works.
35
- - Provider packages must match your `ai` major: `@ai-sdk/openai@^3` pairs with `ai@^6`. A bare `@ai-sdk/openai` resolves to `@latest`, which can mismatch the `ai` peer.
35
+ - Provider packages must match your `ai` major: `@ai-sdk/openai@^4` pairs with `ai@^7`. A bare `@ai-sdk/openai` resolves to `@latest`, which can mismatch the `ai` peer.
36
36
 
37
37
  ## Quick start
38
38
 
@@ -273,7 +273,7 @@
273
273
  }
274
274
  ]
275
275
  },
276
- "reasoning": {
276
+ "includeReasoning": {
277
277
  "description": "Opt into the structured-output envelope's `reasoning` field.",
278
278
  "type": "boolean"
279
279
  },