@statelyai/agent 2.0.0-alpha.35 → 2.0.0-alpha.37
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/CHANGELOG.md +138 -0
- package/dist/act-B9hLQls6.mjs +19 -0
- package/dist/act-CrX0JwWY.cjs +42 -0
- package/dist/ai-sdk.cjs +63 -7
- package/dist/ai-sdk.d.cts +13 -3
- package/dist/ai-sdk.d.mts +13 -3
- package/dist/ai-sdk.mjs +63 -7
- package/dist/{decision-BEsATcr1.cjs → decision-CMeuNZ1g.cjs} +262 -4
- package/dist/{decision-COkJNjOW.mjs → decision-m5hGmHpF.mjs} +239 -5
- package/dist/decision-object-B5zGSPFp.d.mts +15 -0
- package/dist/decision-object-DBcLWVvv.d.cts +15 -0
- package/dist/{run-agent-Ct_GZw_f.mjs → effects-BT_cSY0j.mjs} +1003 -109
- package/dist/{run-agent-s5D32w99.cjs → effects-DDseYtJk.cjs} +1037 -107
- package/dist/{event-log-C7jeH0y8.mjs → event-log-DkVlk3Rh.mjs} +30 -15
- package/dist/{event-log-BWSSLUff.cjs → event-log-Dkc-yIYu.cjs} +41 -14
- package/dist/{event-log-store-BzXehP7R.d.cts → event-log-store-BBS8so8a.d.mts} +2 -2
- package/dist/{event-log-store-W49TCJXi.mjs → event-log-store-Brx9tOHt.mjs} +1 -1
- package/dist/{event-log-store-CleWpsp5.cjs → event-log-store-Cl-YWDnq.cjs} +1 -1
- package/dist/{event-log-store-CWjN6lmM.d.mts → event-log-store-bc4ICGcS.d.cts} +2 -2
- package/dist/index.cjs +660 -286
- package/dist/index.d.cts +168 -9
- package/dist/index.d.mts +168 -9
- package/dist/index.mjs +639 -271
- package/dist/internal-C3Lqu538.d.cts +43 -0
- package/dist/internal-DUcdhk-i.d.mts +43 -0
- package/dist/log.cjs +2 -2
- package/dist/log.d.cts +1 -1
- package/dist/log.d.mts +1 -1
- package/dist/log.mjs +2 -2
- package/dist/machines.cjs +457 -41
- package/dist/machines.d.cts +114 -43
- package/dist/machines.d.mts +114 -43
- package/dist/machines.mjs +457 -42
- package/dist/{model-source-DmhTMK39.cjs → model-source-B4WQ8Idp.cjs} +1 -1
- package/dist/{model-source-CK3F4YuU.mjs → model-source-kjGwqAV8.mjs} +1 -1
- package/dist/openai.cjs +149 -36
- package/dist/openai.d.cts +28 -10
- package/dist/openai.d.mts +28 -10
- package/dist/openai.mjs +149 -36
- package/dist/otel.d.cts +1 -1
- package/dist/otel.d.mts +1 -1
- package/dist/{run-agent-BGdx5913.d.mts → run-agent-30mH2moE.d.cts} +91 -9
- package/dist/{run-agent-B1-Eqviq.d.cts → run-agent-DlPzBWj-.d.mts} +91 -9
- package/dist/{setup-agent-05uw4dPZ.mjs → setup-agent-BDmNr6PC.mjs} +9 -3
- package/dist/{setup-agent-BtfeFfF6.d.cts → setup-agent-BaNyz6Q3.d.cts} +4 -4
- package/dist/{setup-agent-C6nqzv_X.d.mts → setup-agent-C1CG_nfX.d.mts} +4 -4
- package/dist/{setup-agent-CXEBURdo.cjs → setup-agent-CmEToB8y.cjs} +9 -3
- package/dist/tanstack-ai.cjs +62 -4
- package/dist/tanstack-ai.d.cts +18 -6
- package/dist/tanstack-ai.d.mts +18 -6
- package/dist/tanstack-ai.mjs +62 -4
- package/dist/testing.cjs +2493 -1502
- package/dist/testing.d.cts +360 -256
- package/dist/testing.d.mts +360 -256
- package/dist/testing.mjs +2489 -1503
- package/dist/{text-logic-CV_4KGr6.d.cts → text-logic-BqxalgMr.d.mts} +87 -4
- package/dist/{text-logic-Ckh-rJFV.d.mts → text-logic-CSf9bqpP.d.cts} +87 -4
- package/dist/{types-Dp5_Ru4R.d.cts → types-DQUOOaZO.d.cts} +1 -1
- package/dist/{types-Dp5_Ru4R.d.mts → types-DQUOOaZO.d.mts} +1 -1
- package/dist/{usage-BDiJKyv9.d.cts → usage-Bm5nvpow.d.cts} +6 -1
- package/dist/{usage-DOoVUGVq.d.mts → usage-BnikdOca.d.mts} +6 -1
- package/dist/utils-7lSa4H-i.d.cts +403 -0
- package/dist/utils-CBbKw2fM.d.mts +403 -0
- package/dist/validate.cjs +44 -12
- package/dist/validate.d.cts +6 -6
- package/dist/validate.d.mts +6 -6
- package/dist/validate.mjs +44 -12
- package/dist/verify-ChyX6jq0.mjs +2306 -0
- package/dist/verify-CwlombbC.cjs +2359 -0
- package/dist/{verify-BQpE8hUz.d.cts → verify-DJHfEfm6.d.cts} +213 -14
- package/dist/{verify-CqeuEmIk.d.mts → verify-i9Hiwc5g.d.mts} +213 -14
- package/dist/with-model-calls-B_WLmOSl.cjs +248 -0
- package/dist/with-model-calls-BkOwdroS.mjs +213 -0
- package/docs/act.md +102 -0
- package/docs/advanced.md +105 -0
- package/docs/any-stack.md +62 -0
- package/docs/choosing-a-run-mode.md +55 -0
- package/docs/debugging.md +29 -0
- package/docs/decisions.md +473 -0
- package/docs/environment-and-policy.md +188 -0
- package/docs/evals.md +509 -0
- package/docs/event-log.md +312 -0
- package/docs/from-a-loop.md +528 -0
- package/docs/generate-machines.md +110 -0
- package/docs/hosts.md +414 -0
- package/docs/human-in-the-loop.md +177 -0
- package/docs/index.md +48 -0
- package/docs/judgments.md +281 -0
- package/docs/langgraph-comparison.md +198 -0
- package/docs/machines-as-data.md +454 -0
- package/docs/machines-presets.md +198 -0
- package/docs/machines.md +497 -0
- package/docs/messages.md +67 -0
- package/docs/meta.json +52 -0
- package/docs/models-and-providers.md +268 -0
- package/docs/multi-agent.md +68 -0
- package/docs/observability.md +109 -0
- package/docs/patterns.md +31 -0
- package/docs/persistence.md +207 -0
- package/docs/quickstart.md +121 -0
- package/docs/roadmap.md +22 -0
- package/docs/scope.md +75 -0
- package/docs/statechart-policy-examples.md +69 -0
- package/docs/steps.md +56 -0
- package/docs/strangler-fig.md +323 -0
- package/docs/text-requests.md +250 -0
- package/docs/thinking-in-state-machines.md +324 -0
- package/docs/tools.md +249 -0
- package/docs/upgrading.md +37 -0
- package/docs/usage-and-budgets.md +518 -0
- package/docs/validate-and-repair.md +253 -0
- package/docs/verify.md +492 -0
- package/docs/xstate-4-and-5-apps.md +161 -0
- package/llms.txt +53 -0
- package/package.json +10 -3
- package/readme.md +30 -15
- package/skills/add-evals/SKILL.md +3 -1
- package/skills/add-traces/SKILL.md +6 -1
- package/skills/build-machine/SKILL.md +84 -0
- package/skills/generate-machine/SKILL.md +1 -1
- package/skills/graph-engineering/SKILL.md +13 -3
- package/skills/improve-machine/SKILL.md +21 -2
- package/skills/loop-to-machine/SKILL.md +147 -192
- package/skills/loop-to-machine/reference.md +260 -0
- package/dist/utils-BnXdWih3.d.mts +0 -108
- package/dist/utils-ebVpCYoF.d.cts +0 -108
- package/dist/verify-Bpahmr34.mjs +0 -1241
- package/dist/verify-DCLZa9R0.cjs +0 -1288
- package/dist/with-model-calls-BXYdBdcu.cjs +0 -45
- package/dist/with-model-calls-Bv4V4EHC.mjs +0 -34
|
@@ -0,0 +1,403 @@
|
|
|
1
|
+
import { A as UserMessage, C as StandardSchemaV1, D as ToolMessage, E as ToolCallPart, T as TextPart, _ as FilePart, f as AssistantMessage, k as ToolResultPart, r as AgentMessage, v as ImagePart, w as SystemMessage } from "./types-DQUOOaZO.mjs";
|
|
2
|
+
import { AnyMachineSnapshot, AnyStateMachine, StateValue } from "xstate";
|
|
3
|
+
//#region src/equivalence.d.ts
|
|
4
|
+
/** An error as recorded: JSON-safe. */
|
|
5
|
+
interface RecordedError {
|
|
6
|
+
name: string;
|
|
7
|
+
message: string;
|
|
8
|
+
code?: unknown;
|
|
9
|
+
/** The error's own number and boolean fields, such as `statusCode` and
|
|
10
|
+
* `isRetryable`; replay restores them. */
|
|
11
|
+
data?: Record<string, number | boolean>;
|
|
12
|
+
/** `Symbol.for` keys set to `true` on the error, such as the AI SDK's
|
|
13
|
+
* `vercel.ai.error.AI_APICallError`; replay restores them, so checks like
|
|
14
|
+
* `APICallError.isInstance` still pass. */
|
|
15
|
+
markers?: string[];
|
|
16
|
+
/** `name` was an own enumerable field, as the AI SDK's errors set it; replay keeps it so. */
|
|
17
|
+
ownName?: true;
|
|
18
|
+
}
|
|
19
|
+
/** One model call. `call` is its 0-based position among model calls. */
|
|
20
|
+
interface RecordedModelCall {
|
|
21
|
+
kind: "model";
|
|
22
|
+
/** Which wrapper saw it. */
|
|
23
|
+
seam: "ai-sdk" | "openai";
|
|
24
|
+
/** `doGenerate`/`doStream`/`doDecide`, or `chat.completions.create`/`responses.create`. */
|
|
25
|
+
method: string;
|
|
26
|
+
call: number;
|
|
27
|
+
/** The call options or params, JSON-safe (abort signals and headers dropped). */
|
|
28
|
+
request: unknown;
|
|
29
|
+
/** The non-streaming result. */
|
|
30
|
+
response?: unknown;
|
|
31
|
+
/** The stream's parts or chunks, in order. */
|
|
32
|
+
stream?: unknown[];
|
|
33
|
+
error?: RecordedError;
|
|
34
|
+
/** In replay, the recorded call (its `call`) whose answer served this one. */
|
|
35
|
+
replayed?: number;
|
|
36
|
+
/** In replay, `translate` adapted the recorded answer to this call. */
|
|
37
|
+
translated?: true;
|
|
38
|
+
/** In replay, no recorded call fit, so `fallback` answered it. */
|
|
39
|
+
unrecorded?: true;
|
|
40
|
+
}
|
|
41
|
+
/** One tool call. `step` is the number of model calls made before it. */
|
|
42
|
+
interface RecordedToolCall {
|
|
43
|
+
kind: "tool";
|
|
44
|
+
name: string;
|
|
45
|
+
step: number;
|
|
46
|
+
input: unknown;
|
|
47
|
+
output?: unknown;
|
|
48
|
+
error?: RecordedError;
|
|
49
|
+
/** The tool returned without a Promise; replay answers synchronously too. */
|
|
50
|
+
sync?: true;
|
|
51
|
+
/** Started while an earlier tool call was still running. Concurrent calls
|
|
52
|
+
* may finish in either order; sequential ones must keep theirs. */
|
|
53
|
+
concurrent?: true;
|
|
54
|
+
/** In replay, no recorded call matched, so `fallback.tools` ran the tool. */
|
|
55
|
+
unrecorded?: true;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* One call to a function wrapped with `recorder.fn` or `recorder.client`.
|
|
59
|
+
* `call` is its 0-based position among calls with the same `name`.
|
|
60
|
+
*/
|
|
61
|
+
interface RecordedCall {
|
|
62
|
+
kind: "call";
|
|
63
|
+
/** The `fn` name, or the client name and method path: `anthropic.messages.create`. */
|
|
64
|
+
name: string;
|
|
65
|
+
call: number;
|
|
66
|
+
/** The arguments, JSON-safe (trailing `undefined` dropped), or what `redact` returned. */
|
|
67
|
+
args: unknown;
|
|
68
|
+
/** The resolved value, JSON-safe, or what `serialize` returned. */
|
|
69
|
+
result?: unknown;
|
|
70
|
+
/** The chunks of a resolved async iterable, in order. */
|
|
71
|
+
stream?: unknown[];
|
|
72
|
+
error?: RecordedError;
|
|
73
|
+
}
|
|
74
|
+
/** Options for `recorder.fn` and `recorder.client`. */
|
|
75
|
+
interface RecordCallOptions {
|
|
76
|
+
/**
|
|
77
|
+
* What to record of the arguments, instead of all of them: drop a secret,
|
|
78
|
+
* or keep only the fields that must match in {@link compareRecordings}.
|
|
79
|
+
*/
|
|
80
|
+
redact?: (args: unknown[]) => unknown;
|
|
81
|
+
/**
|
|
82
|
+
* What to record of a result that is not JSON (a class instance, a
|
|
83
|
+
* `Response`). For an async iterable it maps each chunk.
|
|
84
|
+
*/
|
|
85
|
+
serialize?: (value: unknown) => unknown;
|
|
86
|
+
/**
|
|
87
|
+
* In replay, builds the returned value from the recorded result, or from
|
|
88
|
+
* the recorded chunks of a stream. Default: the result as recorded, or an
|
|
89
|
+
* async iterable of the chunks.
|
|
90
|
+
*/
|
|
91
|
+
revive?: (recorded: unknown) => unknown;
|
|
92
|
+
}
|
|
93
|
+
/** Options for `recorder.client`. */
|
|
94
|
+
interface RecordClientOptions extends RecordCallOptions {
|
|
95
|
+
/** Dot paths of the async methods to record: `["messages.create"]`. */
|
|
96
|
+
methods: readonly string[];
|
|
97
|
+
}
|
|
98
|
+
/** The run's final result. */
|
|
99
|
+
interface RecordedOutput {
|
|
100
|
+
kind: "output";
|
|
101
|
+
value: unknown;
|
|
102
|
+
}
|
|
103
|
+
type RecordedEffect = RecordedModelCall | RecordedToolCall | RecordedCall | RecordedOutput;
|
|
104
|
+
/** A run's effects, in order. JSON-serializable: save it as a golden file. */
|
|
105
|
+
interface Recording {
|
|
106
|
+
version: 1;
|
|
107
|
+
effects: RecordedEffect[];
|
|
108
|
+
}
|
|
109
|
+
/** Options for {@link createRecorder}. Omit for record mode. */
|
|
110
|
+
interface CreateRecorderOptions {
|
|
111
|
+
/** Answer model and tool calls from this recording instead of running them. */
|
|
112
|
+
replay?: Recording;
|
|
113
|
+
/**
|
|
114
|
+
* In replay, `"replay"` (default) returns each tool's recorded result
|
|
115
|
+
* without running it; `"live"` runs the wrapped tool (your stub) and records
|
|
116
|
+
* what it returned.
|
|
117
|
+
*/
|
|
118
|
+
tools?: "replay" | "live";
|
|
119
|
+
/**
|
|
120
|
+
* In replay, which model calls a recorded answer may serve. `"shape"`
|
|
121
|
+
* (default) refuses a call whose offered tools or response format changed,
|
|
122
|
+
* since the recorded answer may not fit it; see {@link ModelCallMatch}.
|
|
123
|
+
*/
|
|
124
|
+
modelCalls?: ModelCallMatch;
|
|
125
|
+
/**
|
|
126
|
+
* In replay, maps the recorded and the new tool call before matching them,
|
|
127
|
+
* like {@link CompareRecordingsOptions.normalize}: redact a generated id in a
|
|
128
|
+
* tool's input so the recorded result still answers it. A dropped
|
|
129
|
+
* (`undefined`) effect matches as recorded.
|
|
130
|
+
*/
|
|
131
|
+
normalize?: NormalizeEffect;
|
|
132
|
+
/**
|
|
133
|
+
* In replay, adapts a recorded answer to a model call you changed on
|
|
134
|
+
* purpose. Called with each unused recorded call, in order, until it
|
|
135
|
+
* returns an answer; that answer serves the call regardless of method and
|
|
136
|
+
* shape, and {@link compareRecordings} counts the pair as the same call.
|
|
137
|
+
* Return `undefined` to leave a recorded call to the usual matching.
|
|
138
|
+
*
|
|
139
|
+
* @example
|
|
140
|
+
* ```ts
|
|
141
|
+
* // The original streamed; the port generates.
|
|
142
|
+
* translate: (recorded, actual) =>
|
|
143
|
+
* actual.method === "doGenerate" && recorded.method === "doStream"
|
|
144
|
+
* ? { response: toGenerateResult(recorded.stream) }
|
|
145
|
+
* : undefined,
|
|
146
|
+
* ```
|
|
147
|
+
*/
|
|
148
|
+
translate?: (recorded: RecordedModelCall, actual: RecordedModelCall) => ModelAnswer | undefined;
|
|
149
|
+
/**
|
|
150
|
+
* In replay, answers what the recording cannot, instead of throwing
|
|
151
|
+
* {@link RecordingDivergenceError}: a model call no recorded call fits (the
|
|
152
|
+
* port's retry or an added call) goes to `model` (AI SDK seam) or `openai`
|
|
153
|
+
* (client seam), and with `tools: true` a tool call no recorded call matches
|
|
154
|
+
* runs the wrapped tool. Such effects are marked `unrecorded` and still
|
|
155
|
+
* count as extra in {@link compareRecordings}.
|
|
156
|
+
*/
|
|
157
|
+
fallback?: {
|
|
158
|
+
model?: RecordableModel;
|
|
159
|
+
openai?: object;
|
|
160
|
+
tools?: boolean;
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
/** A model call's answer: the result, the stream's parts, or an error. */
|
|
164
|
+
interface ModelAnswer {
|
|
165
|
+
response?: unknown;
|
|
166
|
+
stream?: unknown[];
|
|
167
|
+
error?: RecordedError;
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* Maps an effect before matching or comparing; `undefined` drops it.
|
|
171
|
+
* `index` and `effects` are its position in the whole recording, so a repeat
|
|
172
|
+
* of an earlier effect (an idempotent write made again) can be dropped.
|
|
173
|
+
*/
|
|
174
|
+
type NormalizeEffect = (effect: RecordedEffect, index: number, effects: readonly RecordedEffect[]) => RecordedEffect | undefined;
|
|
175
|
+
/**
|
|
176
|
+
* When two model calls count as the same: `"shape"` compares offered tool
|
|
177
|
+
* names and response format, `"none"` only that a call happened, and a
|
|
178
|
+
* function decides per call (allow the changes you made on purpose and fall
|
|
179
|
+
* back to {@link sameModelCallShape}).
|
|
180
|
+
*/
|
|
181
|
+
type ModelCallMatch = "shape" | "none" | ((expected: RecordedModelCall, actual: RecordedModelCall) => boolean);
|
|
182
|
+
/** The structural slice of an AI SDK `LanguageModelV3` the recorder wraps. */
|
|
183
|
+
interface RecordableLanguageModel {
|
|
184
|
+
doGenerate(options: never): PromiseLike<unknown>;
|
|
185
|
+
doStream(options: never): PromiseLike<{
|
|
186
|
+
stream: ReadableStream<unknown>;
|
|
187
|
+
}>;
|
|
188
|
+
}
|
|
189
|
+
/** The structural slice of an AI SDK decision model (`experimental_decide`). */
|
|
190
|
+
interface RecordableDecisionModel {
|
|
191
|
+
doDecide(options: never): PromiseLike<unknown>;
|
|
192
|
+
}
|
|
193
|
+
/** An AI SDK model the recorder can wrap. */
|
|
194
|
+
type RecordableModel = RecordableLanguageModel | RecordableDecisionModel;
|
|
195
|
+
type AnyFunction = (...args: never[]) => unknown;
|
|
196
|
+
/** Records (or replays) the effects of one run. */
|
|
197
|
+
interface Recorder {
|
|
198
|
+
/**
|
|
199
|
+
* Wraps an AI SDK `LanguageModelV3` (`openai("gpt-…")`, `anthropic(…)`) or
|
|
200
|
+
* decision model (`doDecide`), keeping its type. In replay the model is
|
|
201
|
+
* never called, so a provider model built with no API key works.
|
|
202
|
+
*/
|
|
203
|
+
model<TModel extends RecordableModel>(model: TModel): TModel;
|
|
204
|
+
/**
|
|
205
|
+
* Wraps an `openai` client's `chat.completions.create` and
|
|
206
|
+
* `responses.create`, keeping its type. A streamed result is an async
|
|
207
|
+
* iterable only. In replay the client is never called, so
|
|
208
|
+
* `new OpenAI({ apiKey: "replay" })` works.
|
|
209
|
+
*/
|
|
210
|
+
openai<TClient extends object>(client: TClient): TClient;
|
|
211
|
+
/** Wraps one tool function. Its arguments are the recorded input. */
|
|
212
|
+
tool<TFn extends AnyFunction>(name: string, fn: TFn): TFn;
|
|
213
|
+
/** Wraps every `execute` in an AI SDK tool set, named by key. */
|
|
214
|
+
tools<TTools extends Record<string, {
|
|
215
|
+
execute?: AnyFunction;
|
|
216
|
+
}>>(tools: TTools): TTools;
|
|
217
|
+
/**
|
|
218
|
+
* Wraps any async function, keeping its type. Each call is a
|
|
219
|
+
* {@link RecordedCall}. In replay the function is never called: each call
|
|
220
|
+
* gets the next unused recorded result for `name`, in order, whatever its
|
|
221
|
+
* arguments; {@link compareRecordings} reports arguments that differ.
|
|
222
|
+
*/
|
|
223
|
+
fn<TFn extends (...args: never[]) => PromiseLike<unknown>>(name: string, fn: TFn, options?: RecordCallOptions): TFn;
|
|
224
|
+
/**
|
|
225
|
+
* Wraps the async methods at `options.methods` of a client object, keeping
|
|
226
|
+
* its type, as `fn` named `<name>.<path>`. Other members pass through. In
|
|
227
|
+
* replay the client is never called, and missing objects on a method's path
|
|
228
|
+
* are stood in for, so `{} as Anthropic` works.
|
|
229
|
+
*/
|
|
230
|
+
client<TClient extends object>(name: string, client: TClient, options: RecordClientOptions): TClient;
|
|
231
|
+
/** Records the run's final result. */
|
|
232
|
+
output(value: unknown): void;
|
|
233
|
+
/** What this run did so far. */
|
|
234
|
+
readonly recording: Recording;
|
|
235
|
+
}
|
|
236
|
+
/**
|
|
237
|
+
* Thrown in replay when the port asks for something the recording cannot
|
|
238
|
+
* answer: a model call past the last recorded one, or a tool call the original
|
|
239
|
+
* never made. The effect is still recorded, so {@link compareRecordings}
|
|
240
|
+
* reports it.
|
|
241
|
+
*/
|
|
242
|
+
declare class RecordingDivergenceError extends Error {
|
|
243
|
+
name: string;
|
|
244
|
+
}
|
|
245
|
+
/**
|
|
246
|
+
* Creates a {@link Recorder}. With no options it records: every wrapped call
|
|
247
|
+
* runs for real. With `replay` it answers from a recording instead.
|
|
248
|
+
*/
|
|
249
|
+
declare function createRecorder(options?: CreateRecorderOptions): Recorder;
|
|
250
|
+
/** Why two effects differ. */
|
|
251
|
+
type EffectDivergenceReason = "missing-effect" | "extra-effect" | "kind" | "model-method" | "model-call-shape" | "model-error" | "tool-name" | "tool-input" | "tool-result" | "call-name" | "call-args" | "call-result" | "output";
|
|
252
|
+
/** The first effect where two recordings differ. */
|
|
253
|
+
interface EffectDivergence {
|
|
254
|
+
/** Position in the compared (tool-order-normalized) effect lists. */
|
|
255
|
+
index: number;
|
|
256
|
+
reason: EffectDivergenceReason;
|
|
257
|
+
expected?: RecordedEffect;
|
|
258
|
+
actual?: RecordedEffect;
|
|
259
|
+
/** One sentence, for test failures. */
|
|
260
|
+
message: string;
|
|
261
|
+
}
|
|
262
|
+
/** The result of {@link compareRecordings}. */
|
|
263
|
+
interface EquivalenceReport {
|
|
264
|
+
equivalent: boolean;
|
|
265
|
+
/** The first divergence, by position in the original's effects. */
|
|
266
|
+
divergence?: EffectDivergence;
|
|
267
|
+
/** Every divergence, in order. Effects both runs made line up between them. */
|
|
268
|
+
divergences: EffectDivergence[];
|
|
269
|
+
}
|
|
270
|
+
/** Options for {@link compareRecordings}. */
|
|
271
|
+
interface CompareRecordingsOptions {
|
|
272
|
+
/** When two model calls count as the same. Default `"shape"`. */
|
|
273
|
+
modelCalls?: ModelCallMatch;
|
|
274
|
+
/**
|
|
275
|
+
* Maps each effect before comparing, on both sides: redact values that
|
|
276
|
+
* differ on every run (generated ids, timestamps), project a tool's input
|
|
277
|
+
* to the fields that matter, or return `undefined` to drop the effect.
|
|
278
|
+
*/
|
|
279
|
+
normalize?: NormalizeEffect;
|
|
280
|
+
/**
|
|
281
|
+
* Which kinds of effect to compare. Default all. `["tool", "output"]`
|
|
282
|
+
* compares a port that calls the model differently (another protocol, a
|
|
283
|
+
* structured draft instead of a tool loop) by what it did, not how it asked.
|
|
284
|
+
*/
|
|
285
|
+
kinds?: readonly RecordedEffect["kind"][];
|
|
286
|
+
}
|
|
287
|
+
/** True when two model calls offer the same tool names and response format. */
|
|
288
|
+
declare function sameModelCallShape(expected: RecordedModelCall, actual: RecordedModelCall): boolean;
|
|
289
|
+
/**
|
|
290
|
+
* Compares two recordings and reports every effect that differs. `expected`
|
|
291
|
+
* is the original's recording, `actual` the port's. Effects that are the same
|
|
292
|
+
* on both sides are lined up first (longest common subsequence), so one extra
|
|
293
|
+
* call does not shift every effect after it; between them, effects of the same
|
|
294
|
+
* kind pair up and report what changed, and the rest are missing or extra.
|
|
295
|
+
*/
|
|
296
|
+
declare function compareRecordings(expected: Recording, actual: Recording, options?: CompareRecordingsOptions): EquivalenceReport;
|
|
297
|
+
//#endregion
|
|
298
|
+
//#region src/utils.d.ts
|
|
299
|
+
/** Returns the human-readable text carried by a message, ignoring non-text parts. */
|
|
300
|
+
declare function getMessageText(message: AgentMessage): string;
|
|
301
|
+
/**
|
|
302
|
+
* A stable, dependency-free structural fingerprint of a machine — a short hex
|
|
303
|
+
* `djb2` hash over its **structural** config only: state ids/nesting, transition
|
|
304
|
+
* event types and targets, invoke `src`s, `initial`, and any other serializable
|
|
305
|
+
* config fields. Function values (context/output builders, prompts, inline
|
|
306
|
+
* guards/actions) are excluded entirely, so two machines that differ only in
|
|
307
|
+
* their prompts or executors hash identically; adding/removing/retargeting a
|
|
308
|
+
* state or transition changes the hash.
|
|
309
|
+
*
|
|
310
|
+
* Used by {@link createAgentRuntime} to stamp settled snapshots with a `version` and to
|
|
311
|
+
* detect a structurally-edited machine on resume. It is a change detector, not
|
|
312
|
+
* a cryptographic digest — collisions are possible but unlikely for real
|
|
313
|
+
* configs. Declare `createMachine({ version })` to pin an explicit version instead.
|
|
314
|
+
*/
|
|
315
|
+
declare function getMachineStructuralHash(machine: AnyStateMachine): string;
|
|
316
|
+
/** Builds a {@link UserMessage} from a string or multimodal content parts. */
|
|
317
|
+
declare function userMessage(content: string | Array<TextPart | ImagePart | FilePart>): UserMessage;
|
|
318
|
+
/** Builds an {@link AssistantMessage} from a string or content parts (text, files, tool calls/results). */
|
|
319
|
+
declare function assistantMessage(content: string | Array<TextPart | FilePart | ToolCallPart | ToolResultPart>): AssistantMessage;
|
|
320
|
+
/** Builds a {@link SystemMessage}. */
|
|
321
|
+
declare function systemMessage(content: string): SystemMessage;
|
|
322
|
+
/** Builds a {@link ToolMessage} from one or more tool-result parts. */
|
|
323
|
+
declare function toolMessage(content: Array<ToolResultPart>): ToolMessage;
|
|
324
|
+
type MetaOfSnapshot<TSnapshot extends {
|
|
325
|
+
getMeta(): Record<string, unknown>;
|
|
326
|
+
}> = NonNullable<ReturnType<TSnapshot["getMeta"]>[keyof ReturnType<TSnapshot["getMeta"]>]>;
|
|
327
|
+
/**
|
|
328
|
+
* Returns the merged `meta` of a snapshot's active state(s) — the typed
|
|
329
|
+
* replacement for the `Object.values(snapshot.getMeta())[0]` dance.
|
|
330
|
+
*
|
|
331
|
+
* `snapshot.getMeta()` is keyed by state id; a leaf machine has one active
|
|
332
|
+
* state, but parallel/nested machines can have several. This shallow-merges
|
|
333
|
+
* every active state's meta into one object and returns `{}` when no active
|
|
334
|
+
* state declares meta.
|
|
335
|
+
*
|
|
336
|
+
* Merge order is fixed and does not depend on XState's internal node order:
|
|
337
|
+
* entries are sorted by structural depth (the state node's distance from the
|
|
338
|
+
* root, regardless of custom `id` strings), then by state id lexicographically,
|
|
339
|
+
* and merged in that order. So a deeper state's key wins over an ancestor's,
|
|
340
|
+
* and between equal-depth parallel siblings the later state id alphabetically
|
|
341
|
+
* wins.
|
|
342
|
+
*
|
|
343
|
+
* The return type is recovered from the snapshot's own `getMeta()` type, so a
|
|
344
|
+
* schema-typed machine (`setupAgent({ meta })`) yields the meta schema's
|
|
345
|
+
* output type. Pass an explicit `TMeta` to override when the snapshot is
|
|
346
|
+
* untyped (e.g. `AnyMachineSnapshot`).
|
|
347
|
+
*
|
|
348
|
+
* @example HITL: read the current state's interaction protocol off an idle
|
|
349
|
+
* snapshot to render for a human.
|
|
350
|
+
* ```ts
|
|
351
|
+
* const { interaction } = getStateMeta(result.snapshot);
|
|
352
|
+
* ```
|
|
353
|
+
*/
|
|
354
|
+
declare function getStateMeta<TSnapshot extends {
|
|
355
|
+
getMeta(): Record<string, unknown>;
|
|
356
|
+
} = AnyMachineSnapshot, TMeta = MetaOfSnapshot<TSnapshot>>(snapshot: TSnapshot): Partial<TMeta>;
|
|
357
|
+
/**
|
|
358
|
+
* Renders a snapshot's state value as one deterministic string, so a log line,
|
|
359
|
+
* a progress field, or a test assertion reads the same on every run.
|
|
360
|
+
*
|
|
361
|
+
* - An atomic state is its own name: `'writing'`.
|
|
362
|
+
* - A nested state joins with dots: `{ review: { editing: 'draft' } }` →
|
|
363
|
+
* `'review.editing.draft'`.
|
|
364
|
+
* - A parallel state brackets its regions, sorted by region name, so key order
|
|
365
|
+
* never leaks into the string: `{ p: { left: 'x', right: { a: 'b' } } }` →
|
|
366
|
+
* `'p:{left.x,right.a.b}'`.
|
|
367
|
+
*
|
|
368
|
+
* Prefer this over `String(snapshot.value)`, which renders every non-atomic
|
|
369
|
+
* value as `[object Object]`.
|
|
370
|
+
*
|
|
371
|
+
* @example
|
|
372
|
+
* ```ts
|
|
373
|
+
* onTransition: (snapshot) => console.log(getStatePath(snapshot));
|
|
374
|
+
* ```
|
|
375
|
+
*/
|
|
376
|
+
declare function getStatePath(snapshot: {
|
|
377
|
+
value: StateValue;
|
|
378
|
+
status?: string;
|
|
379
|
+
} | StateValue): string;
|
|
380
|
+
/**
|
|
381
|
+
* Structural guard for a {@link StandardSchemaV1}: `true` when `value` carries
|
|
382
|
+
* the `~standard` marker. Used to tell an already-schema'd tool `inputSchema`
|
|
383
|
+
* (a Zod/Valibot/… schema) apart from an SDK-specific schema wrapper that core
|
|
384
|
+
* can't read directly — see the `ai-sdk` tool pass-through.
|
|
385
|
+
*/
|
|
386
|
+
declare function isStandardSchema(value: unknown): value is StandardSchemaV1;
|
|
387
|
+
/**
|
|
388
|
+
* Pulls the JSON Schema off a {@link StandardSchemaV1} via its optional
|
|
389
|
+
* `~standard.jsonSchema.input()` extension (implemented by e.g. Zod v4's
|
|
390
|
+
* `z.toJSONSchema`), awaiting it when the producer is async. Returns
|
|
391
|
+
* `undefined` when the schema doesn't expose the extension. Use this to build
|
|
392
|
+
* a provider request's `response_format`/tool `parameters` from a schema.
|
|
393
|
+
*/
|
|
394
|
+
declare function getJsonSchema(schema?: StandardSchemaV1): Promise<Record<string, unknown> | undefined>;
|
|
395
|
+
/**
|
|
396
|
+
* Synchronous variant of {@link getJsonSchema}, for call sites that can't
|
|
397
|
+
* await (building tool/event descriptors inline). An async JSON Schema
|
|
398
|
+
* producer is treated as absent (returns `undefined`) — in practice Zod's
|
|
399
|
+
* `z.toJSONSchema` resolves synchronously.
|
|
400
|
+
*/
|
|
401
|
+
declare function getJsonSchemaSync(schema?: StandardSchemaV1): Record<string, unknown> | undefined;
|
|
402
|
+
//#endregion
|
|
403
|
+
export { RecordedOutput as A, RecordableDecisionModel as C, RecordedEffect as D, RecordedCall as E, compareRecordings as F, createRecorder as I, sameModelCallShape as L, Recorder as M, Recording as N, RecordedError as O, RecordingDivergenceError as P, RecordClientOptions as S, RecordableModel as T, EquivalenceReport as _, getMachineStructuralHash as a, NormalizeEffect as b, getStatePath as c, toolMessage as d, userMessage as f, EffectDivergenceReason as g, EffectDivergence as h, getJsonSchemaSync as i, RecordedToolCall as j, RecordedModelCall as k, isStandardSchema as l, CreateRecorderOptions as m, assistantMessage as n, getMessageText as o, CompareRecordingsOptions as p, getJsonSchema as r, getStateMeta as s, MetaOfSnapshot as t, systemMessage as u, ModelAnswer as v, RecordableLanguageModel as w, RecordCallOptions as x, ModelCallMatch as y };
|
package/dist/validate.cjs
CHANGED
|
@@ -21,9 +21,10 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
21
21
|
enumerable: true
|
|
22
22
|
}) : target, mod));
|
|
23
23
|
//#endregion
|
|
24
|
-
const require_event_log = require("./event-log-
|
|
25
|
-
const
|
|
26
|
-
const
|
|
24
|
+
const require_event_log = require("./event-log-Dkc-yIYu.cjs");
|
|
25
|
+
const require_decision = require("./decision-CMeuNZ1g.cjs");
|
|
26
|
+
const require_setup_agent = require("./setup-agent-CmEToB8y.cjs");
|
|
27
|
+
const require_verify = require("./verify-CwlombbC.cjs");
|
|
27
28
|
let ajv_dist_2020_js = require("ajv/dist/2020.js");
|
|
28
29
|
ajv_dist_2020_js = __toESM(ajv_dist_2020_js, 1);
|
|
29
30
|
//#region schemas/agent-workflow.json
|
|
@@ -427,6 +428,7 @@ function validateAgentConfig(config) {
|
|
|
427
428
|
//#region src/validate/verify-config.ts
|
|
428
429
|
const BUILTIN_SRCS = [
|
|
429
430
|
require_event_log.DECIDE_ACTOR,
|
|
431
|
+
require_event_log.ACT_ACTOR,
|
|
430
432
|
require_event_log.GENERATE_TEXT_ACTOR,
|
|
431
433
|
require_event_log.STREAM_TEXT_ACTOR
|
|
432
434
|
];
|
|
@@ -441,8 +443,8 @@ const MAX_DETAIL_LINES = 10;
|
|
|
441
443
|
* - `lower`: `setupAgent.fromConfig` (unresolved guards/actions, bad targets).
|
|
442
444
|
* - `lint`: `lintAgentMachine` (errors fail; warnings fail with `lint.warnings`).
|
|
443
445
|
* - `explore`: `explorePaths` from each `explore.inputs` entry; every terminal
|
|
444
|
-
* must be one of `explore.terminals`, no cap (`maxPaths`, `maxNodes`)
|
|
445
|
-
* it short, every event's payloads must be tried (`unexpandedEvents`), and
|
|
446
|
+
* must be one of `explore.terminals`, no cap (`maxPaths`, `maxNodes`) or
|
|
447
|
+
* `budget` may cut it short, every event's payloads must be tried (`unexpandedEvents`), and
|
|
446
448
|
* every reached text request or invoke needs an `explore.outputs` entry.
|
|
447
449
|
*
|
|
448
450
|
* @example
|
|
@@ -483,7 +485,7 @@ async function verifyAgentConfig(config, options) {
|
|
|
483
485
|
record("lower", [errorMessage(error)]);
|
|
484
486
|
return fail({ config: typed });
|
|
485
487
|
}
|
|
486
|
-
record("lower",
|
|
488
|
+
if (!record("lower", checkFillModels(typed, machine))) return fail({ config: typed });
|
|
487
489
|
const diagnostics = require_verify.lintAgentMachine(machine).map((d) => ({
|
|
488
490
|
failing: d.severity === "error" || options.lint?.warnings === true,
|
|
489
491
|
line: `${d.severity} ${d.code} at '${d.path}': ${d.message}`
|
|
@@ -503,6 +505,32 @@ async function verifyAgentConfig(config, options) {
|
|
|
503
505
|
machine
|
|
504
506
|
};
|
|
505
507
|
}
|
|
508
|
+
/**
|
|
509
|
+
* An `agent.decide` invoke whose strategy is `'pick-then-fill'` (explicit, or
|
|
510
|
+
* `'auto'` with a `fillModel`) needs a `fillModel` when any literal
|
|
511
|
+
* candidate event has open payload fields. Omitted `allowedEvents` is resolved
|
|
512
|
+
* from the lowered state's own and ancestor event handlers.
|
|
513
|
+
*/
|
|
514
|
+
function checkFillModels(config, machine) {
|
|
515
|
+
const schemas = config.schemas?.events ?? {};
|
|
516
|
+
const problems = [];
|
|
517
|
+
for (const { path, state } of walkStates(config.states)) for (const invoke of nodes(state.invoke)) {
|
|
518
|
+
if (invoke.src !== "agent.decide" || !isPlainObject(invoke.input)) continue;
|
|
519
|
+
const input = invoke.input;
|
|
520
|
+
if (input.strategy !== "pick-then-fill" || input.fillModel !== void 0) continue;
|
|
521
|
+
if (input.payloads !== void 0) continue;
|
|
522
|
+
const open = (Array.isArray(input.allowedEvents) ? input.allowedEvents : loweredEventTypes(machine, path)).filter((type) => typeof type === "string" && require_decision.payloadNeedsFillModel(schemas[type]));
|
|
523
|
+
if (open.length) problems.push(`state '${path}': agent.decide uses strategy 'pick-then-fill' but ${list(open)} has open payload fields and no fillModel is set`);
|
|
524
|
+
}
|
|
525
|
+
return problems;
|
|
526
|
+
}
|
|
527
|
+
function loweredEventTypes(machine, path) {
|
|
528
|
+
let node = machine.root;
|
|
529
|
+
for (const key of path.split(".")) node = node?.states[key];
|
|
530
|
+
const types = /* @__PURE__ */ new Set();
|
|
531
|
+
for (let current = node; current; current = current.parent) for (const [type, transitions] of current.transitions) if (!transitions.every((t) => t.meta?.actor === "human")) types.add(type);
|
|
532
|
+
return [...types];
|
|
533
|
+
}
|
|
506
534
|
/** A config's `T | T[]` field as a list of objects. */
|
|
507
535
|
const nodes = (value) => (value === void 0 ? [] : Array.isArray(value) ? value : [value]).filter((node) => !!node && typeof node === "object");
|
|
508
536
|
const hasTemplate = (value) => typeof value === "string" && value.includes("{{");
|
|
@@ -575,18 +603,21 @@ function checkVocabulary(config, allow) {
|
|
|
575
603
|
}
|
|
576
604
|
if (!BUILTIN_SRCS.includes(src)) continue;
|
|
577
605
|
const input = invoke.input;
|
|
578
|
-
if ((allow.models || src === "agent.decide" && allow.events) && !isPlainObject(input)) {
|
|
606
|
+
if ((allow.models || (src === "agent.decide" || src === "agent.act") && allow.events) && !isPlainObject(input)) {
|
|
579
607
|
problems.push(`state '${path}': '${src}' input must be a literal object`);
|
|
580
608
|
continue;
|
|
581
609
|
}
|
|
582
610
|
checkModel(`state '${path}': '${src}'`, input?.model);
|
|
583
|
-
|
|
584
|
-
|
|
611
|
+
const fillModel = input?.fillModel;
|
|
612
|
+
if (fillModel !== void 0) checkModel(`state '${path}': '${src}' fillModel`, fillModel);
|
|
613
|
+
if (src !== "agent.decide" && src !== "agent.act" || !allow.events) continue;
|
|
614
|
+
const allowedEvents = input?.allowedEvents;
|
|
615
|
+
if (src === "agent.act" && allowedEvents === void 0) continue;
|
|
585
616
|
if (!Array.isArray(allowedEvents) || allowedEvents.length === 0) {
|
|
586
|
-
problems.push(`state '${path}':
|
|
617
|
+
problems.push(`state '${path}': ${src} needs a literal, non-empty allowedEvents list; allowed: ${list(allow.events)}`);
|
|
587
618
|
continue;
|
|
588
619
|
}
|
|
589
|
-
for (const type of allowedEvents) if (typeof type !== "string" || !allow.events.includes(type)) problems.push(`state '${path}':
|
|
620
|
+
for (const type of allowedEvents) if (typeof type !== "string" || !allow.events.includes(type)) problems.push(`state '${path}': ${src} allowedEvents entry '${String(type)}' is not allowed; allowed: ${list(allow.events)}`);
|
|
590
621
|
}
|
|
591
622
|
const actionsAt = [["entry", state.entry], ["exit", state.exit]];
|
|
592
623
|
for (const transition of transitionsOf(state)) {
|
|
@@ -620,7 +651,7 @@ async function checkExplore(machine, options) {
|
|
|
620
651
|
}
|
|
621
652
|
for (const terminal of report.terminals) {
|
|
622
653
|
if (allowed.includes(terminal.status)) continue;
|
|
623
|
-
const trail = `path [${terminal.path.map((event) => event.type).join(", ")}]`;
|
|
654
|
+
const trail = `path [${terminal.path.map((event) => typeof event.actorId === "string" ? `${event.type}(${event.actorId})` : event.type).join(", ")}]`;
|
|
624
655
|
const state = JSON.stringify(terminal.state);
|
|
625
656
|
switch (terminal.status) {
|
|
626
657
|
case "max-depth":
|
|
@@ -636,6 +667,7 @@ async function checkExplore(machine, options) {
|
|
|
636
667
|
}
|
|
637
668
|
}
|
|
638
669
|
if (report.hitPathCap) problems.add(`${at}a cap (maxPaths ${options.maxPaths ?? 200} or maxNodes ${options.maxNodes ?? 1e5}) cut exploration short; the workflow branches too much to verify`);
|
|
670
|
+
for (const note of report.unexplored) if (note.startsWith("budget-exhausted")) problems.add(`${at}the explore budget ran out (${note}); exploration is incomplete, so raise explore.budget or narrow the workflow`);
|
|
639
671
|
if (report.unexpandedEvents.length > 0) problems.add(`${at}explore did not try every payload of: ${report.unexpandedEvents.join(", ")}; add explore.payloads entries for them`);
|
|
640
672
|
}
|
|
641
673
|
return [...problems];
|
package/dist/validate.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { u as ExplorePathsOptions } from "./verify-
|
|
1
|
+
import { _ as FromConfigOptions, f as AgentWorkflowConfig, y as SchemaCompiler } from "./setup-agent-BaNyz6Q3.cjs";
|
|
2
|
+
import { u as ExplorePathsOptions } from "./verify-DJHfEfm6.cjs";
|
|
3
3
|
import { AnyActorLogic, AnyStateMachine } from "xstate";
|
|
4
4
|
//#region src/validate/validate-config.d.ts
|
|
5
5
|
/**
|
|
@@ -65,7 +65,7 @@ interface AgentConfigVocabulary {
|
|
|
65
65
|
guards?: string[];
|
|
66
66
|
/** Named action types (`{ type: "notify" }`). */
|
|
67
67
|
actions?: string[];
|
|
68
|
-
/** Event types an `agent.decide` invoke may list in `allowedEvents`. */
|
|
68
|
+
/** Event types an `agent.decide`/`agent.act` invoke may list in `allowedEvents`. */
|
|
69
69
|
events?: string[];
|
|
70
70
|
/** Model refs. Each must be a literal string (not a `{{ }}` template) in this set. */
|
|
71
71
|
models?: string[];
|
|
@@ -122,8 +122,8 @@ interface VerifyAgentConfigResult {
|
|
|
122
122
|
* - `lower`: `setupAgent.fromConfig` (unresolved guards/actions, bad targets).
|
|
123
123
|
* - `lint`: `lintAgentMachine` (errors fail; warnings fail with `lint.warnings`).
|
|
124
124
|
* - `explore`: `explorePaths` from each `explore.inputs` entry; every terminal
|
|
125
|
-
* must be one of `explore.terminals`, no cap (`maxPaths`, `maxNodes`)
|
|
126
|
-
* it short, every event's payloads must be tried (`unexpandedEvents`), and
|
|
125
|
+
* must be one of `explore.terminals`, no cap (`maxPaths`, `maxNodes`) or
|
|
126
|
+
* `budget` may cut it short, every event's payloads must be tried (`unexpandedEvents`), and
|
|
127
127
|
* every reached text request or invoke needs an `explore.outputs` entry.
|
|
128
128
|
*
|
|
129
129
|
* @example
|
|
@@ -135,4 +135,4 @@ interface VerifyAgentConfigResult {
|
|
|
135
135
|
*/
|
|
136
136
|
export declare function verifyAgentConfig(config: unknown, options: VerifyAgentConfigOptions): Promise<VerifyAgentConfigResult>;
|
|
137
137
|
//#endregion
|
|
138
|
-
export type { AgentConfigDiagnostic, AgentConfigValidationResult, VerifyAgentConfigOptions, VerifyAgentConfigResult };
|
|
138
|
+
export type { AgentConfigDiagnostic, AgentConfigGate, AgentConfigGateName, AgentConfigValidationResult, AgentConfigVocabulary, VerifyAgentConfigExploreOptions, VerifyAgentConfigOptions, VerifyAgentConfigResult };
|
package/dist/validate.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { u as ExplorePathsOptions } from "./verify-
|
|
1
|
+
import { _ as FromConfigOptions, f as AgentWorkflowConfig, y as SchemaCompiler } from "./setup-agent-C1CG_nfX.mjs";
|
|
2
|
+
import { u as ExplorePathsOptions } from "./verify-i9Hiwc5g.mjs";
|
|
3
3
|
import { AnyActorLogic, AnyStateMachine } from "xstate";
|
|
4
4
|
//#region src/validate/validate-config.d.ts
|
|
5
5
|
/**
|
|
@@ -65,7 +65,7 @@ interface AgentConfigVocabulary {
|
|
|
65
65
|
guards?: string[];
|
|
66
66
|
/** Named action types (`{ type: "notify" }`). */
|
|
67
67
|
actions?: string[];
|
|
68
|
-
/** Event types an `agent.decide` invoke may list in `allowedEvents`. */
|
|
68
|
+
/** Event types an `agent.decide`/`agent.act` invoke may list in `allowedEvents`. */
|
|
69
69
|
events?: string[];
|
|
70
70
|
/** Model refs. Each must be a literal string (not a `{{ }}` template) in this set. */
|
|
71
71
|
models?: string[];
|
|
@@ -122,8 +122,8 @@ interface VerifyAgentConfigResult {
|
|
|
122
122
|
* - `lower`: `setupAgent.fromConfig` (unresolved guards/actions, bad targets).
|
|
123
123
|
* - `lint`: `lintAgentMachine` (errors fail; warnings fail with `lint.warnings`).
|
|
124
124
|
* - `explore`: `explorePaths` from each `explore.inputs` entry; every terminal
|
|
125
|
-
* must be one of `explore.terminals`, no cap (`maxPaths`, `maxNodes`)
|
|
126
|
-
* it short, every event's payloads must be tried (`unexpandedEvents`), and
|
|
125
|
+
* must be one of `explore.terminals`, no cap (`maxPaths`, `maxNodes`) or
|
|
126
|
+
* `budget` may cut it short, every event's payloads must be tried (`unexpandedEvents`), and
|
|
127
127
|
* every reached text request or invoke needs an `explore.outputs` entry.
|
|
128
128
|
*
|
|
129
129
|
* @example
|
|
@@ -135,4 +135,4 @@ interface VerifyAgentConfigResult {
|
|
|
135
135
|
*/
|
|
136
136
|
export declare function verifyAgentConfig(config: unknown, options: VerifyAgentConfigOptions): Promise<VerifyAgentConfigResult>;
|
|
137
137
|
//#endregion
|
|
138
|
-
export type { AgentConfigDiagnostic, AgentConfigValidationResult, VerifyAgentConfigOptions, VerifyAgentConfigResult };
|
|
138
|
+
export type { AgentConfigDiagnostic, AgentConfigGate, AgentConfigGateName, AgentConfigValidationResult, AgentConfigVocabulary, VerifyAgentConfigExploreOptions, VerifyAgentConfigOptions, VerifyAgentConfigResult };
|