@statelyai/agent 2.0.0-alpha.20 → 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.
- package/dist/ai-sdk.cjs +89 -25
- package/dist/ai-sdk.d.cts +56 -12
- package/dist/ai-sdk.d.mts +56 -12
- package/dist/ai-sdk.mjs +89 -26
- package/dist/{decision-DhsKLYAI.cjs → decision-BnTCsuJv.cjs} +15 -3
- package/dist/{decision-BfhSgCc6.mjs → decision-JWx6n3xR.mjs} +4 -4
- package/dist/index.cjs +202 -41
- package/dist/index.d.cts +138 -18
- package/dist/index.d.mts +138 -18
- package/dist/index.mjs +202 -42
- package/dist/machines.cjs +1 -1
- package/dist/machines.d.cts +1 -1
- package/dist/machines.d.mts +1 -1
- package/dist/machines.mjs +1 -1
- package/dist/otel.d.cts +1 -1
- package/dist/otel.d.mts +1 -1
- package/dist/{run-agent-CwmzAZwj.d.mts → run-agent-DBNI8ETM.d.mts} +3 -3
- package/dist/{run-agent--4bbms-D.d.cts → run-agent-Do094mGu.d.cts} +3 -3
- package/dist/{setup-agent-gISRLxRe.cjs → setup-agent-91FSuZbB.cjs} +2 -15
- package/dist/{setup-agent-BOcSpsIq.mjs → setup-agent-DqqdcdNh.mjs} +3 -10
- package/dist/sqlite.d.cts +1 -1
- package/dist/sqlite.d.mts +1 -1
- package/dist/{text-logic-Er5KkTX6.d.mts → text-logic-BR5twXCv.d.mts} +8 -5
- package/dist/{text-logic-Cavva1W6.d.cts → text-logic-Mmbgb2jy.d.cts} +8 -5
- package/dist/{types-DYpK3QF4.d.mts → types-CvWRGFxP.d.mts} +6 -1
- package/dist/{types-pJ5Hn8fv.d.cts → types-DSdj2tGs.d.cts} +6 -1
- package/dist/validate.cjs +2 -2
- package/dist/validate.mjs +1 -1
- package/package.json +28 -28
- package/readme.md +4 -4
- package/schemas/agent-workflow.json +1 -1
|
@@ -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-
|
|
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
|
-
|
|
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.
|
|
483
|
-
|
|
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" | "
|
|
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-
|
|
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
|
-
|
|
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.
|
|
483
|
-
|
|
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" | "
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
"
|
|
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
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@statelyai/agent",
|
|
3
|
-
"version": "2.0.0-alpha.
|
|
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": "^
|
|
98
|
-
"@anthropic-ai/sdk": "^0.
|
|
99
|
-
"@changesets/changelog-github": "^0.5.
|
|
100
|
-
"@changesets/cli": "^2.
|
|
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.
|
|
103
|
-
"@inquirer/prompts": "^8.
|
|
104
|
-
"@langchain/core": "^1.2.
|
|
105
|
-
"@langchain/openai": "^1.5.
|
|
106
|
-
"@mastra/core": "^1.
|
|
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.
|
|
112
|
+
"@statelyai/sdk": "^0.22.1",
|
|
113
113
|
"@types/express": "^5.0.6",
|
|
114
|
-
"@types/node": "^20.
|
|
115
|
-
"@types/react": "^19.2.
|
|
116
|
-
"ai": "^
|
|
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.
|
|
119
|
-
"dotenv": "^16.
|
|
118
|
+
"braintrust": "^3.28.0",
|
|
119
|
+
"dotenv": "^16.6.1",
|
|
120
120
|
"express": "^5.2.1",
|
|
121
|
-
"hono": "^4.
|
|
121
|
+
"hono": "^4.13.3",
|
|
122
122
|
"knip": "6.24.0",
|
|
123
|
-
"langchain": "^1.5.
|
|
124
|
-
"openai": "^
|
|
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.
|
|
128
|
-
"tsdown": "^0.21.
|
|
129
|
-
"tsx": "^4.
|
|
127
|
+
"react": "^19.2.8",
|
|
128
|
+
"tsdown": "^0.21.10",
|
|
129
|
+
"tsx": "^4.23.12",
|
|
130
130
|
"twoslash": "^0.3.9",
|
|
131
|
-
"typescript": "^5.
|
|
131
|
+
"typescript": "^5.9.3",
|
|
132
132
|
"valibot": "^1.4.2",
|
|
133
|
-
"vitest": "^
|
|
134
|
-
"xstate": "6.0.0-alpha.
|
|
135
|
-
"zod": "^4.3
|
|
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": "^
|
|
139
|
+
"ai": "^7.0.0",
|
|
140
140
|
"ajv": "^8.20.0",
|
|
141
|
-
"xstate": ">=6.0.0-alpha.
|
|
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/
|
|
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@^
|
|
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.
|
|
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@^
|
|
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
|
|