@statelyai/agent 2.0.0-alpha.14 → 2.0.0-alpha.16
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 +1 -1
- package/dist/ai-sdk.d.cts +2 -2
- package/dist/ai-sdk.d.mts +2 -2
- package/dist/ai-sdk.mjs +1 -1
- package/dist/{decision-C0cUKvNt.cjs → decision-Ba8qrT8r.cjs} +42 -28
- package/dist/{decision-D9Zi7Xi5.mjs → decision-Bt2HYYRo.mjs} +31 -23
- package/dist/{event-log-store-D7pWtIhb.mjs → event-log-store-B-1fcfkT.mjs} +149 -141
- package/dist/{event-log-store-BkUNtyOF.d.mts → event-log-store-BrC9Q1xW.d.mts} +14 -12
- package/dist/{event-log-store-CVd2eyRy.d.cts → event-log-store-CQJq8_v4.d.cts} +14 -12
- package/dist/{event-log-store-CNT_7F0V.cjs → event-log-store-yquOV1TX.cjs} +148 -140
- package/dist/index.cjs +520 -521
- package/dist/index.d.cts +128 -106
- package/dist/index.d.mts +128 -106
- package/dist/index.mjs +519 -520
- 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-BlqKwHIF.d.cts → run-agent-BxjGaVpL.d.cts} +72 -111
- package/dist/{run-agent-2MnlQTkB.d.mts → run-agent-COHoCgQd.d.mts} +72 -111
- package/dist/{setup-agent-CpK0ZRWV.cjs → setup-agent-BLU77gqr.cjs} +141 -172
- package/dist/{setup-agent-DeHRW-qX.mjs → setup-agent-SbiiSbAU.mjs} +136 -167
- package/dist/sqlite.cjs +1 -1
- package/dist/sqlite.d.cts +2 -2
- package/dist/sqlite.d.mts +2 -2
- package/dist/sqlite.mjs +1 -1
- package/dist/{text-logic-Jkilp1Ie.d.cts → text-logic-BFX5q7fM.d.cts} +26 -3
- package/dist/{text-logic-C5kbjaDz.d.mts → text-logic-DQW8_DWW.d.mts} +26 -3
- package/dist/{types-rMe7x6NR.d.cts → types-DYpK3QF4.d.mts} +35 -7
- package/dist/{types-9Bqg5rZB.d.mts → types-pJ5Hn8fv.d.cts} +35 -7
- package/package.json +28 -28
- package/readme.md +6 -19
- package/schemas/agent-workflow.json +1 -4
package/dist/index.d.cts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { C as
|
|
1
|
+
import { C as ToolResultPart, S as ToolMessage, T as WithAgentInputSchema, _ as NormalizedEventSchemas, a as AgentToolChoice, b as TextPart, c as AgentTools, d as ChosenEvent, f as EventUnion, g as InferOutput, h as InferInput, i as AgentTool, l as AllowedEvents, m as ImagePart, n as AgentMessage, o as AgentToolDescriptor, p as FilePart, r as AgentSnapshotStore, s as AgentToolExecute, t as AgentEventSchemaInputMap, u as AssistantMessage, v as StandardSchemaV1, w as UserMessage, x as ToolCallPart, y as SystemMessage } from "./types-pJ5Hn8fv.cjs";
|
|
2
2
|
import { t as AgentError } from "./errors-BQRk9eiZ.cjs";
|
|
3
|
-
import { A as
|
|
4
|
-
import { a as AgentLogVerification, c as assertAgentLogEntry, d as
|
|
5
|
-
import { A as
|
|
3
|
+
import { A as AgentDecisionExecutor, B as AgentEventToolNameResolver, C as buildEnvelopeSchema, D as parseModelRef, E as getCallUsage, F as DecisionLogicConfig, H as AgentRequestSource, I as ResolveDecisionOptions, L as renderDecisionAttempts, M as AgentDecisionInput, N as AgentDecisionRequest, O as parseOutput, P as DecisionAttempt, R as resolveDecision, S as bindRequestExecutor, T as getAgentOutputMode, U as getAcceptedEvents, V as AgentRequestOptions, W as parseAgentEvent, _ as StructuredOutputEnvelope, a as AgentOutputMode, b as TextLogicExecuteArgs, c as AgentRequestExecutorResult, d as AgentTextRequest, f as AgentUsage, g as BuiltinAgentActors, h as AiSdkShapedTextResult, i as AgentModelRef, j as AgentDecisionExhaustedError, k as parseStructuredEnvelope, l as AgentRequestExecutors, m as AiSdkShapedStreamResult, n as AgentExecutorTextRequest, o as AgentRequestExecutor, p as AgentUserInput, r as AgentModelMap, s as AgentRequestExecutorInfo, t as AgentCallUsage, u as AgentRequestMode, v as TextLogic, w as createTextLogic, x as TextLogicExecutor, y as TextLogicConfig, z as AgentEventDescriptor } from "./text-logic-BFX5q7fM.cjs";
|
|
4
|
+
import { a as AgentLogVerification, c as assertAgentLogEntry, d as assertEventLogStoreConformance, i as AgentLogEntry, l as assertJsonSerializable, n as AgentEventLogConflictError, o as JsonValue, r as AgentEventLogStore, s as NonSerializableAgentEventError, t as AGENT_EVENT_SCHEMA_VERSION, u as createInMemoryEventLogStore } from "./event-log-store-CQJq8_v4.cjs";
|
|
5
|
+
import { A as AgentEffect, B as ReplayResult, C as traceTransitions, D as executeAgentRequest, E as AgentStepRequest, F as AgentReplayMachineMismatchError, G as replay, H as diffEventLogs, I as AgentUsageEvent, K as verifyReplay, L as CreateReplayEntryOptions, M as AgentEventLogDiff, N as AgentLogPatchOperation, O as AGENT_INIT_EVENT_TYPE, P as AgentReplayDivergenceError, R as GetAgentEffectsOptions, S as serializeTraceEvent, T as AgentRequest, U as getAgentEffects, V as createReplayEntry, W as initEntry, _ as RunAgentResult, a as AgentInputFrom, b as inspectTransitions, c as AgentSnapshotVersionMismatchError, d as GenerateResult, f as InspectedActorRef, g as RunAgentOptions, h as RunAgentErrorCause, i as AgentIllegalResumeEventError, j as AgentEffectDiff, k as AGENT_USAGE_EVENT_TYPE, l as AgentTraceEvent, m as PendingUserInput, n as AgentActorSession, o as AgentMessageInfo, p as JsonSerializableTraceEvent, r as AgentIdleError, s as AgentRunMeta, t as AGENT_TRACE_SCHEMA_VERSION, u as AgentUserInputExecutor, v as createAgentActor, w as AgentStateRequest, x as runAgent, y as generateResult, z as ReplayOptions } from "./run-agent-BxjGaVpL.cjs";
|
|
6
6
|
import { AnyActorLogic, AnyMachineSnapshot, AnySetupConfig, AnyStateMachine, AsyncActorLogic, EventFromLogic, EventObject, InputFrom, MachineContext, MetaObject, NonReducibleUnknown, SetupReturnFromConfig, SetupStateSchema, SnapshotFrom, StateValue } from "xstate";
|
|
7
7
|
|
|
8
8
|
//#region src/messages.d.ts
|
|
@@ -309,10 +309,27 @@ type AgentSetupEventsSchema<TEventSchemas extends AgentEventSchemaInputMap> = {
|
|
|
309
309
|
type AgentSetupEmittedSchema<TEmittedSchemas extends Record<string, StandardSchemaV1>> = [keyof TEmittedSchemas] extends [never] ? {} : {
|
|
310
310
|
emitted: TEmittedSchemas;
|
|
311
311
|
};
|
|
312
|
+
/**
|
|
313
|
+
* The input schema as handed to xstate's `setup(...)`, with the machine's input
|
|
314
|
+
* type branded by the schema it came from.
|
|
315
|
+
*
|
|
316
|
+
* XState resolves `schemas.input` to a single type used both by
|
|
317
|
+
* `createActor`'s `input` option and by the `context: ({ input })` factory —
|
|
318
|
+
* and it never validates, so a schema default reads as a required field at the
|
|
319
|
+
* call site while being absent at runtime. `runAgent` validates the input
|
|
320
|
+
* (filling defaults) and reads this brand back through `AgentInputFrom` to
|
|
321
|
+
* accept the schema's looser *input* side, while the factory keeps seeing the
|
|
322
|
+
* validated *output* side.
|
|
323
|
+
*
|
|
324
|
+
* Only object-shaped input is branded: with no declared input schema the
|
|
325
|
+
* resolved type is xstate's `NonReducibleUnknown` (a union including `null`),
|
|
326
|
+
* and intersecting a brand into that collapses members to `never`.
|
|
327
|
+
*/
|
|
328
|
+
type BrandedInputSchema<TInputSchema extends StandardSchemaV1> = InferOutput<TInputSchema> extends Record<string, unknown> ? StandardSchemaV1<InferInput<TInputSchema>, InferOutput<TInputSchema> & WithAgentInputSchema<TInputSchema>> : TInputSchema;
|
|
312
329
|
type AgentSetupXStateConfig<TContextSchema extends StandardSchemaV1<Record<string, unknown>>, TEventSchemas extends AgentEventSchemaInputMap, TActors extends { [K in keyof TActors]: AnyActorLogic }, TRequestSchemas extends AgentRequestSchemaMap, TInputSchema extends StandardSchemaV1, TOutputSchema extends StandardSchemaV1, TMetaSchema extends StandardSchemaV1, TModels extends AgentModelMap, TEmittedSchemas extends Record<string, StandardSchemaV1> = {}, TStateSchemas extends Record<string, SetupStateSchema> = Record<string, SetupStateSchema>> = {
|
|
313
330
|
schemas: {
|
|
314
331
|
context: TContextSchema;
|
|
315
|
-
input: TInputSchema
|
|
332
|
+
input: BrandedInputSchema<TInputSchema>;
|
|
316
333
|
output: TOutputSchema;
|
|
317
334
|
meta: TMetaSchema;
|
|
318
335
|
} & AgentSetupEventsSchema<TEventSchemas> & AgentSetupEmittedSchema<TEmittedSchemas>;
|
|
@@ -606,7 +623,7 @@ interface ProvideExecutorsOptions<TMachine extends AnyStateMachine = AnyStateMac
|
|
|
606
623
|
* Throws at bind time if a source needs an executor kind that `executors` does
|
|
607
624
|
* not provide.
|
|
608
625
|
*
|
|
609
|
-
*
|
|
626
|
+
* `provideExecutors` does not descend into invoked child state machines: a string-keyed child
|
|
610
627
|
* machine source is left untouched, so a child with its own agent invokes needs
|
|
611
628
|
* its own `provideExecutors(...)` (or `runAgent`, which does rebind children).
|
|
612
629
|
*/
|
|
@@ -860,7 +877,10 @@ interface TrajectoryMatch {
|
|
|
860
877
|
matchedCount: number;
|
|
861
878
|
/** `expected.length`, so a scorer can compute its own ratio. */
|
|
862
879
|
expectedCount: number;
|
|
863
|
-
/**
|
|
880
|
+
/**
|
|
881
|
+
* Partial credit, 0..1. `1` for an empty expectation. Denominator is
|
|
882
|
+
* `max(expectedCount, actual.length)` in `exact` mode, `expectedCount` otherwise.
|
|
883
|
+
*/
|
|
864
884
|
score: number;
|
|
865
885
|
/** Absent when `matched`. */
|
|
866
886
|
firstMiss?: TrajectoryMiss;
|
|
@@ -910,7 +930,6 @@ type ScriptedDecisionValue = ChosenEvent | {
|
|
|
910
930
|
event: ChosenEvent;
|
|
911
931
|
reason?: string;
|
|
912
932
|
usage?: AgentCallUsage;
|
|
913
|
-
[key: string]: unknown;
|
|
914
933
|
};
|
|
915
934
|
/**
|
|
916
935
|
* One entry in the `decisions` queue: a scripted answer, or a function of the
|
|
@@ -970,6 +989,101 @@ interface ScriptedExecutorsScript {
|
|
|
970
989
|
*/
|
|
971
990
|
declare function createScriptedExecutors(script?: ScriptedExecutorsScript): Required<AgentRequestExecutors>;
|
|
972
991
|
//#endregion
|
|
992
|
+
//#region src/utils.d.ts
|
|
993
|
+
/**
|
|
994
|
+
* Deep-clones a snapshot to a plain-JSON value via a `JSON` round-trip, the
|
|
995
|
+
* shape you persist and later feed back to `runAgent({ snapshot })`. Asserts
|
|
996
|
+
* JSON-serializability: functions, `undefined`, and other non-JSON values are
|
|
997
|
+
* dropped or throw exactly as `JSON.stringify`/`JSON.parse` would. Returns a
|
|
998
|
+
* plain-JSON deep clone, not a live snapshot.
|
|
999
|
+
*/
|
|
1000
|
+
declare function persistSnapshot<TSnapshot>(snapshot: TSnapshot): TSnapshot;
|
|
1001
|
+
/**
|
|
1002
|
+
* A stable, dependency-free structural fingerprint of a machine — a short hex
|
|
1003
|
+
* `djb2` hash over its **structural** config only: state ids/nesting, transition
|
|
1004
|
+
* event types and targets, invoke `src`s, `initial`, and any other serializable
|
|
1005
|
+
* config fields. Function values (context/output builders, prompts, inline
|
|
1006
|
+
* guards/actions) are excluded entirely, so two machines that differ only in
|
|
1007
|
+
* their prompts or executors hash identically; adding/removing/retargeting a
|
|
1008
|
+
* state or transition changes the hash.
|
|
1009
|
+
*
|
|
1010
|
+
* Used by {@link runAgent} to stamp settled snapshots with a `version` and to
|
|
1011
|
+
* detect a structurally-edited machine on resume. It is a change detector, not
|
|
1012
|
+
* a cryptographic digest — collisions are possible but unlikely for real
|
|
1013
|
+
* configs. Pass an explicit `machineVersion` to `runAgent` to override it.
|
|
1014
|
+
*/
|
|
1015
|
+
declare function getMachineStructuralHash(machine: AnyStateMachine): string;
|
|
1016
|
+
/** Builds a {@link UserMessage} from a string or multimodal content parts. */
|
|
1017
|
+
declare function userMessage(content: string | Array<TextPart | ImagePart | FilePart>): UserMessage;
|
|
1018
|
+
/** Builds an {@link AssistantMessage} from a string or content parts (text, files, tool calls/results). */
|
|
1019
|
+
declare function assistantMessage(content: string | Array<TextPart | FilePart | ToolCallPart | ToolResultPart>): AssistantMessage;
|
|
1020
|
+
/** Builds a {@link SystemMessage}. */
|
|
1021
|
+
declare function systemMessage(content: string): SystemMessage;
|
|
1022
|
+
/** Builds a {@link ToolMessage} from one or more tool-result parts. */
|
|
1023
|
+
declare function toolMessage(content: Array<ToolResultPart>): ToolMessage;
|
|
1024
|
+
type MetaOfSnapshot<TSnapshot extends {
|
|
1025
|
+
getMeta(): Record<string, unknown>;
|
|
1026
|
+
}> = NonNullable<ReturnType<TSnapshot["getMeta"]>[keyof ReturnType<TSnapshot["getMeta"]>]>;
|
|
1027
|
+
/**
|
|
1028
|
+
* Returns the merged `meta` of a snapshot's active state(s) — the typed
|
|
1029
|
+
* replacement for the `Object.values(snapshot.getMeta())[0]` dance.
|
|
1030
|
+
*
|
|
1031
|
+
* `snapshot.getMeta()` is keyed by state id; a leaf machine has one active
|
|
1032
|
+
* state, but parallel/nested machines can have several. This shallow-merges
|
|
1033
|
+
* every active state's meta into one object (later/deeper entries win) and
|
|
1034
|
+
* returns `{}` when no active state declares meta.
|
|
1035
|
+
*
|
|
1036
|
+
* The return type is recovered from the snapshot's own `getMeta()` type, so a
|
|
1037
|
+
* schema-typed machine (`setupAgent({ meta })`) yields the meta schema's
|
|
1038
|
+
* output type. Pass an explicit `TMeta` to override when the snapshot is
|
|
1039
|
+
* untyped (e.g. `AnyMachineSnapshot`).
|
|
1040
|
+
*
|
|
1041
|
+
* @example HITL: read the current state's interaction protocol off an idle
|
|
1042
|
+
* snapshot to render for a human.
|
|
1043
|
+
* ```ts
|
|
1044
|
+
* const { interaction } = getStateMeta(result.snapshot);
|
|
1045
|
+
* ```
|
|
1046
|
+
*/
|
|
1047
|
+
declare function getStateMeta<TSnapshot extends {
|
|
1048
|
+
getMeta(): Record<string, unknown>;
|
|
1049
|
+
} = AnyMachineSnapshot, TMeta = MetaOfSnapshot<TSnapshot>>(snapshot: TSnapshot): Partial<TMeta>;
|
|
1050
|
+
/**
|
|
1051
|
+
* Reads the run-owned message log off a snapshot settled by a `runAgent` call
|
|
1052
|
+
* that used `getRequests` (or `options.messages`) — the typed replacement for
|
|
1053
|
+
* the `(snapshot as { messages?: AgentMessage[] }).messages` cast. runAgent
|
|
1054
|
+
* stamps the log as a plain enumerable `messages` property (like `agentMeta`),
|
|
1055
|
+
* so it survives a JSON persist/resume round-trip; this accessor works on the
|
|
1056
|
+
* live settled snapshot and on a JSON-parsed persisted one alike. Returns `[]`
|
|
1057
|
+
* when no log was stamped (e.g. a default invoke-driven run).
|
|
1058
|
+
*
|
|
1059
|
+
* The write path is `runAgent(..., { messages })`: an explicit seed that
|
|
1060
|
+
* overrides the resume snapshot's stamped log (fold in a user reply on
|
|
1061
|
+
* resume, or start a run with prior history).
|
|
1062
|
+
*/
|
|
1063
|
+
declare function getAgentMessages(snapshot: unknown): AgentMessage[];
|
|
1064
|
+
/**
|
|
1065
|
+
* Structural guard for a {@link StandardSchemaV1}: `true` when `value` carries
|
|
1066
|
+
* the `~standard` marker. Used to tell an already-schema'd tool `inputSchema`
|
|
1067
|
+
* (a Zod/Valibot/… schema) apart from an SDK-specific schema wrapper that core
|
|
1068
|
+
* can't read directly — see the `ai-sdk` tool pass-through.
|
|
1069
|
+
*/
|
|
1070
|
+
declare function isStandardSchema(value: unknown): value is StandardSchemaV1;
|
|
1071
|
+
/**
|
|
1072
|
+
* Pulls the JSON Schema off a {@link StandardSchemaV1} via its optional
|
|
1073
|
+
* `~standard.jsonSchema.input()` extension (implemented by e.g. Zod v4's
|
|
1074
|
+
* `z.toJSONSchema`), awaiting it when the producer is async. Returns
|
|
1075
|
+
* `undefined` when the schema doesn't expose the extension. Use this to build
|
|
1076
|
+
* a provider request's `response_format`/tool `parameters` from a schema.
|
|
1077
|
+
*/
|
|
1078
|
+
declare function getJsonSchema(schema?: StandardSchemaV1): Promise<Record<string, unknown> | undefined>;
|
|
1079
|
+
/**
|
|
1080
|
+
* Synchronous variant of {@link getJsonSchema}, for call sites that can't
|
|
1081
|
+
* await (building tool/event descriptors inline). An async JSON Schema
|
|
1082
|
+
* producer is treated as absent (returns `undefined`) — in practice Zod's
|
|
1083
|
+
* `z.toJSONSchema` resolves synchronously.
|
|
1084
|
+
*/
|
|
1085
|
+
declare function getJsonSchemaSync(schema?: StandardSchemaV1): Record<string, unknown> | undefined;
|
|
1086
|
+
//#endregion
|
|
973
1087
|
//#region src/seam.d.ts
|
|
974
1088
|
/**
|
|
975
1089
|
* Which model call is under test: the Nth call addressed either by request
|
|
@@ -997,8 +1111,11 @@ interface SeamTurn<TMachine extends AnyStateMachine> {
|
|
|
997
1111
|
snapshot: SnapshotFrom<TMachine>;
|
|
998
1112
|
/** Its state value, for a `switch` on flat machines. */
|
|
999
1113
|
state: StateValue;
|
|
1000
|
-
/**
|
|
1001
|
-
|
|
1114
|
+
/**
|
|
1115
|
+
* The merged `meta` of the active state(s), e.g. a declared `interaction`.
|
|
1116
|
+
* Typed from the machine's own meta schema (`setupAgent({ meta })`).
|
|
1117
|
+
*/
|
|
1118
|
+
meta: Partial<MetaOfSnapshot<SnapshotFrom<TMachine>>>;
|
|
1002
1119
|
/** 0-based index of this pause within the run. */
|
|
1003
1120
|
turn: number;
|
|
1004
1121
|
/** The `idle` result that produced the pause. */
|
|
@@ -1103,99 +1220,4 @@ interface RunSeamResult<TMachine extends AnyStateMachine> {
|
|
|
1103
1220
|
*/
|
|
1104
1221
|
declare function runSeam<TMachine extends AnyStateMachine>(machine: TMachine, options: RunSeamOptions<TMachine>): Promise<RunSeamResult<TMachine>>;
|
|
1105
1222
|
//#endregion
|
|
1106
|
-
|
|
1107
|
-
/**
|
|
1108
|
-
* Deep-clones a snapshot to a plain-JSON value via a `JSON` round-trip, the
|
|
1109
|
-
* shape you persist and later feed back to `runAgent({ snapshot })`. Asserts
|
|
1110
|
-
* JSON-serializability: functions, `undefined`, and other non-JSON values are
|
|
1111
|
-
* dropped or throw exactly as `JSON.stringify`/`JSON.parse` would. Returns a
|
|
1112
|
-
* plain-JSON deep clone, not a live snapshot.
|
|
1113
|
-
*/
|
|
1114
|
-
declare function persistSnapshot<TSnapshot>(snapshot: TSnapshot): TSnapshot;
|
|
1115
|
-
/**
|
|
1116
|
-
* A stable, dependency-free structural fingerprint of a machine — a short hex
|
|
1117
|
-
* `djb2` hash over its **structural** config only: state ids/nesting, transition
|
|
1118
|
-
* event types and targets, invoke `src`s, `initial`, and any other serializable
|
|
1119
|
-
* config fields. Function values (context/output builders, prompts, inline
|
|
1120
|
-
* guards/actions) are excluded entirely, so two machines that differ only in
|
|
1121
|
-
* their prompts or executors hash identically; adding/removing/retargeting a
|
|
1122
|
-
* state or transition changes the hash.
|
|
1123
|
-
*
|
|
1124
|
-
* Used by {@link runAgent} to stamp settled snapshots with a `version` and to
|
|
1125
|
-
* detect a structurally-edited machine on resume. It is a change detector, not
|
|
1126
|
-
* a cryptographic digest — collisions are possible but unlikely for real
|
|
1127
|
-
* configs. Pass an explicit `machineVersion` to `runAgent` to override it.
|
|
1128
|
-
*/
|
|
1129
|
-
declare function getMachineStructuralHash(machine: AnyStateMachine): string;
|
|
1130
|
-
/** Builds a {@link UserMessage} from a string or multimodal content parts. */
|
|
1131
|
-
declare function userMessage(content: string | Array<TextPart | ImagePart | FilePart>): UserMessage;
|
|
1132
|
-
/** Builds an {@link AssistantMessage} from a string or content parts (text, files, tool calls/results). */
|
|
1133
|
-
declare function assistantMessage(content: string | Array<TextPart | FilePart | ToolCallPart | ToolResultPart>): AssistantMessage;
|
|
1134
|
-
/** Builds a {@link SystemMessage}. */
|
|
1135
|
-
declare function systemMessage(content: string): SystemMessage;
|
|
1136
|
-
/** Builds a {@link ToolMessage} from one or more tool-result parts. */
|
|
1137
|
-
declare function toolMessage(content: Array<ToolResultPart>): ToolMessage;
|
|
1138
|
-
type MetaOfSnapshot<TSnapshot extends {
|
|
1139
|
-
getMeta(): Record<string, unknown>;
|
|
1140
|
-
}> = NonNullable<ReturnType<TSnapshot["getMeta"]>[keyof ReturnType<TSnapshot["getMeta"]>]>;
|
|
1141
|
-
/**
|
|
1142
|
-
* Returns the merged `meta` of a snapshot's active state(s) — the typed
|
|
1143
|
-
* replacement for the `Object.values(snapshot.getMeta())[0]` dance.
|
|
1144
|
-
*
|
|
1145
|
-
* `snapshot.getMeta()` is keyed by state id; a leaf machine has one active
|
|
1146
|
-
* state, but parallel/nested machines can have several. This shallow-merges
|
|
1147
|
-
* every active state's meta into one object (later/deeper entries win) and
|
|
1148
|
-
* returns `{}` when no active state declares meta.
|
|
1149
|
-
*
|
|
1150
|
-
* The return type is recovered from the snapshot's own `getMeta()` type, so a
|
|
1151
|
-
* schema-typed machine (`setupAgent({ meta })`) yields the meta schema's
|
|
1152
|
-
* output type. Pass an explicit `TMeta` to override when the snapshot is
|
|
1153
|
-
* untyped (e.g. `AnyMachineSnapshot`).
|
|
1154
|
-
*
|
|
1155
|
-
* @example HITL: read the current state's interaction protocol off an idle
|
|
1156
|
-
* snapshot to render for a human.
|
|
1157
|
-
* ```ts
|
|
1158
|
-
* const { interaction } = getStateMeta(result.snapshot);
|
|
1159
|
-
* ```
|
|
1160
|
-
*/
|
|
1161
|
-
declare function getStateMeta<TSnapshot extends {
|
|
1162
|
-
getMeta(): Record<string, unknown>;
|
|
1163
|
-
} = AnyMachineSnapshot, TMeta = MetaOfSnapshot<TSnapshot>>(snapshot: TSnapshot): Partial<TMeta>;
|
|
1164
|
-
/**
|
|
1165
|
-
* Reads the run-owned message log off a snapshot settled by a `runAgent` call
|
|
1166
|
-
* that used `getRequests` (or `options.messages`) — the typed replacement for
|
|
1167
|
-
* the `(snapshot as { messages?: AgentMessage[] }).messages` cast. runAgent
|
|
1168
|
-
* stamps the log as a plain enumerable `messages` property (like `agentMeta`),
|
|
1169
|
-
* so it survives a JSON persist/resume round-trip; this accessor works on the
|
|
1170
|
-
* live settled snapshot and on a JSON-parsed persisted one alike. Returns `[]`
|
|
1171
|
-
* when no log was stamped (e.g. a default invoke-driven run).
|
|
1172
|
-
*
|
|
1173
|
-
* The write path is `runAgent(..., { messages })`: an explicit seed that
|
|
1174
|
-
* overrides the resume snapshot's stamped log (fold in a user reply on
|
|
1175
|
-
* resume, or start a run with prior history).
|
|
1176
|
-
*/
|
|
1177
|
-
declare function getAgentMessages(snapshot: unknown): AgentMessage[];
|
|
1178
|
-
/**
|
|
1179
|
-
* Structural guard for a {@link StandardSchemaV1}: `true` when `value` carries
|
|
1180
|
-
* the `~standard` marker. Used to tell an already-schema'd tool `inputSchema`
|
|
1181
|
-
* (a Zod/Valibot/… schema) apart from an SDK-specific schema wrapper that core
|
|
1182
|
-
* can't read directly — see the `ai-sdk` tool pass-through.
|
|
1183
|
-
*/
|
|
1184
|
-
declare function isStandardSchema(value: unknown): value is StandardSchemaV1;
|
|
1185
|
-
/**
|
|
1186
|
-
* Pulls the JSON Schema off a {@link StandardSchemaV1} via its optional
|
|
1187
|
-
* `~standard.jsonSchema.input()` extension (implemented by e.g. Zod v4's
|
|
1188
|
-
* `z.toJSONSchema`), awaiting it when the producer is async. Returns
|
|
1189
|
-
* `undefined` when the schema doesn't expose the extension. Use this to build
|
|
1190
|
-
* a provider request's `response_format`/tool `parameters` from a schema.
|
|
1191
|
-
*/
|
|
1192
|
-
declare function getJsonSchema(schema?: StandardSchemaV1): Promise<Record<string, unknown> | undefined>;
|
|
1193
|
-
/**
|
|
1194
|
-
* Synchronous variant of {@link getJsonSchema}, for call sites that can't
|
|
1195
|
-
* await (building tool/event descriptors inline). An async JSON Schema
|
|
1196
|
-
* producer is treated as absent (returns `undefined`) — in practice Zod's
|
|
1197
|
-
* `z.toJSONSchema` resolves synchronously.
|
|
1198
|
-
*/
|
|
1199
|
-
declare function getJsonSchemaSync(schema?: StandardSchemaV1): Record<string, unknown> | undefined;
|
|
1200
|
-
//#endregion
|
|
1201
|
-
export { AGENT_EVENT_SCHEMA_VERSION, AGENT_INIT_EVENT_TYPE, AGENT_TRACE_SCHEMA_VERSION, AGENT_USAGE_EVENT_TYPE, type AgentActorSession, type AgentCallUsage, type AgentDecisionExecutor, AgentDecisionExhaustedError, type AgentDecisionInput, type AgentDecisionRequest, type AgentEffect, type AgentEffectDiff, AgentError, type AgentEventDescriptor, AgentEventLogConflictError, type AgentEventLogDiff, type AgentEventLogStore, type AgentEventToolNameResolver, type AgentExecutorTextRequest, AgentIdleError, AgentIllegalResumeEventError, type AgentLintDiagnostic, AgentLintError, type AgentLintSeverity, type AgentLogEntry, type AgentLogPatchOperation, type AgentLogVerification, type AgentMessage, type AgentMessageInfo, type AgentModelRef, type AgentOutputMode, type AgentPathReport, type AgentPathTerminal, AgentReplayDivergenceError, AgentReplayMachineMismatchError, type AgentRequest, type AgentRequestExecutor, type AgentRequestExecutorInfo, type AgentRequestExecutorResult, type AgentRequestExecutors, type AgentRequestOptions, type AgentRequestSource, type AgentRun, type AgentRunMeta, type AgentSchemaPack, type AgentSnapshotStore, AgentSnapshotVersionMismatchError, type AgentStateRequest, type AgentStepRequest, type AgentTextRequest, type AgentTool, type AgentToolChoice, type AgentToolDescriptor, type AgentToolExecute, type AgentTools, type AgentTraceEvent, type AgentUsage, type AgentUsageEvent, type AgentUsageEventPayload, type AgentUserInput, type AgentUserInputExecutor, type AgentWorkflowActionConfig, type AgentWorkflowActorConfig, type AgentWorkflowConfig, type AgentWorkflowInvokeConfig, type AgentWorkflowRequestConfig, type AgentWorkflowStateConfig, type AgentWorkflowTransitionConfig, type AiSdkShapedStreamResult, type AiSdkShapedTextResult, type AllowedEvents, type AssertAgentMachineOptions, type AssistantMessage, type CanReachResult, type ChosenEvent, type CreateReplayEntryOptions, type DecisionAttempt, type DecisionLogicConfig, type ExplorePathsOptions, type FilePart, type FromConfigOptions, type FromConfigResult, type GenerateResult, type GetAgentEffectsOptions, type ImagePart, type InferOutput, type InspectedActorRef, type JsonSerializableTraceEvent, type JsonValue, type LintAgentMachineOptions, type MatchTrajectoryOptions, NonSerializableAgentEventError, type PendingUserInput, type ProvideExecutorsOptions, type ReplayOptions, type ReplayResult, type ResolveDecisionOptions, type RunAgentErrorCause, type RunAgentOptions, type RunAgentResult, type RunSeamOptions, type RunSeamResult, type SchemaCompiler, type ScriptedDecisionEntry, type ScriptedDecisionValue, type ScriptedExecutorsScript, type ScriptedTextEntry, type SeamRef, type SeamSlice, type SeamTurn, type SimulateAgentOptions, type SimulateAgentResult, type SimulationScript, type SimulationTrailEntry, type StandardSchemaV1, type StructuredOutputEnvelope, type SystemMessage, type TextLogic, type TextLogicConfig, type TextLogicExecuteArgs, type TextLogicExecutor, type TextPart, type ToolCallPart, type ToolMessage, type ToolResultPart, type TrajectoryEvent, type TrajectoryItem, type TrajectoryMatch, type TrajectoryMiss, type UserMessage, type WithAgentUsageEvent, appendMessages, assertAgentLogEntry, assertAgentMachine, assertEventLogStoreConformance, assertJsonSerializable, assistantMessage, bindRequestExecutor, buildEnvelopeSchema, canReach, createAgentActor, createAgentRun, createAgentSchemas, createInMemoryEventLogStore, createReplayEntry, createScriptedExecutors, createTextLogic, diffEventLogs, executeAgentRequest, explorePaths, generateResult, getAcceptedEvents, getAgentEffects, getAgentMessages, getAgentOutputMode, getCallUsage, getJsonSchema, getJsonSchemaSync, getMachineStructuralHash, getStateMeta, initEntry, inspectTransitions, isStandardSchema, lintAgentMachine, matchesTrajectory, messagesSchema, parseAgentEvent, parseModelRef, parseOutput, parseStructuredEnvelope, persistSnapshot, provideExecutors, renderDecisionAttempts, replay, resolveDecision, runAgent, runSeam, serializeTraceEvent, setupAgent, simulateAgent, systemMessage, toolMessage, traceTransitions, userMessage, verifyReplay };
|
|
1223
|
+
export { AGENT_EVENT_SCHEMA_VERSION, AGENT_INIT_EVENT_TYPE, AGENT_TRACE_SCHEMA_VERSION, AGENT_USAGE_EVENT_TYPE, type AgentActorSession, type AgentCallUsage, type AgentDecisionExecutor, AgentDecisionExhaustedError, type AgentDecisionInput, type AgentDecisionRequest, type AgentEffect, type AgentEffectDiff, AgentError, type AgentEventDescriptor, AgentEventLogConflictError, type AgentEventLogDiff, type AgentEventLogStore, type AgentEventToolNameResolver, type AgentExecutorTextRequest, AgentIdleError, AgentIllegalResumeEventError, type AgentInputFrom, type AgentLintDiagnostic, AgentLintError, type AgentLintSeverity, type AgentLogEntry, type AgentLogPatchOperation, type AgentLogVerification, type AgentMessage, type AgentMessageInfo, type AgentModelRef, type AgentOutputMode, type AgentPathReport, type AgentPathTerminal, AgentReplayDivergenceError, AgentReplayMachineMismatchError, type AgentRequest, type AgentRequestExecutor, type AgentRequestExecutorInfo, type AgentRequestExecutorResult, type AgentRequestExecutors, type AgentRequestOptions, type AgentRequestSource, type AgentRun, type AgentRunMeta, type AgentSchemaPack, type AgentSnapshotStore, AgentSnapshotVersionMismatchError, type AgentStateRequest, type AgentStepRequest, type AgentTextRequest, type AgentTool, type AgentToolChoice, type AgentToolDescriptor, type AgentToolExecute, type AgentTools, type AgentTraceEvent, type AgentUsage, type AgentUsageEvent, type AgentUsageEventPayload, type AgentUserInput, type AgentUserInputExecutor, type AgentWorkflowActionConfig, type AgentWorkflowActorConfig, type AgentWorkflowConfig, type AgentWorkflowInvokeConfig, type AgentWorkflowRequestConfig, type AgentWorkflowStateConfig, type AgentWorkflowTransitionConfig, type AiSdkShapedStreamResult, type AiSdkShapedTextResult, type AllowedEvents, type AssertAgentMachineOptions, type AssistantMessage, type CanReachResult, type ChosenEvent, type CreateReplayEntryOptions, type DecisionAttempt, type DecisionLogicConfig, type ExplorePathsOptions, type FilePart, type FromConfigOptions, type FromConfigResult, type GenerateResult, type GetAgentEffectsOptions, type ImagePart, type InferInput, type InferOutput, type InspectedActorRef, type JsonSerializableTraceEvent, type JsonValue, type LintAgentMachineOptions, type MatchTrajectoryOptions, NonSerializableAgentEventError, type PendingUserInput, type ProvideExecutorsOptions, type ReplayOptions, type ReplayResult, type ResolveDecisionOptions, type RunAgentErrorCause, type RunAgentOptions, type RunAgentResult, type RunSeamOptions, type RunSeamResult, type SchemaCompiler, type ScriptedDecisionEntry, type ScriptedDecisionValue, type ScriptedExecutorsScript, type ScriptedTextEntry, type SeamRef, type SeamSlice, type SeamTurn, type SimulateAgentOptions, type SimulateAgentResult, type SimulationScript, type SimulationTrailEntry, type StandardSchemaV1, type StructuredOutputEnvelope, type SystemMessage, type TextLogic, type TextLogicConfig, type TextLogicExecuteArgs, type TextLogicExecutor, type TextPart, type ToolCallPart, type ToolMessage, type ToolResultPart, type TrajectoryEvent, type TrajectoryItem, type TrajectoryMatch, type TrajectoryMiss, type UserMessage, type WithAgentUsageEvent, appendMessages, assertAgentLogEntry, assertAgentMachine, assertEventLogStoreConformance, assertJsonSerializable, assistantMessage, bindRequestExecutor, buildEnvelopeSchema, canReach, createAgentActor, createAgentRun, createAgentSchemas, createInMemoryEventLogStore, createReplayEntry, createScriptedExecutors, createTextLogic, diffEventLogs, executeAgentRequest, explorePaths, generateResult, getAcceptedEvents, getAgentEffects, getAgentMessages, getAgentOutputMode, getCallUsage, getJsonSchema, getJsonSchemaSync, getMachineStructuralHash, getStateMeta, initEntry, inspectTransitions, isStandardSchema, lintAgentMachine, matchesTrajectory, messagesSchema, parseAgentEvent, parseModelRef, parseOutput, parseStructuredEnvelope, persistSnapshot, provideExecutors, renderDecisionAttempts, replay, resolveDecision, runAgent, runSeam, serializeTraceEvent, setupAgent, simulateAgent, systemMessage, toolMessage, traceTransitions, userMessage, verifyReplay };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { C as
|
|
1
|
+
import { C as ToolResultPart, S as ToolMessage, T as WithAgentInputSchema, _ as NormalizedEventSchemas, a as AgentToolChoice, b as TextPart, c as AgentTools, d as ChosenEvent, f as EventUnion, g as InferOutput, h as InferInput, i as AgentTool, l as AllowedEvents, m as ImagePart, n as AgentMessage, o as AgentToolDescriptor, p as FilePart, r as AgentSnapshotStore, s as AgentToolExecute, t as AgentEventSchemaInputMap, u as AssistantMessage, v as StandardSchemaV1, w as UserMessage, x as ToolCallPart, y as SystemMessage } from "./types-DYpK3QF4.mjs";
|
|
2
2
|
import { t as AgentError } from "./errors-C9rxnWbX.mjs";
|
|
3
|
-
import { A as
|
|
4
|
-
import { a as AgentLogVerification, c as assertAgentLogEntry, d as
|
|
5
|
-
import { A as
|
|
3
|
+
import { A as AgentDecisionExecutor, B as AgentEventToolNameResolver, C as buildEnvelopeSchema, D as parseModelRef, E as getCallUsage, F as DecisionLogicConfig, H as AgentRequestSource, I as ResolveDecisionOptions, L as renderDecisionAttempts, M as AgentDecisionInput, N as AgentDecisionRequest, O as parseOutput, P as DecisionAttempt, R as resolveDecision, S as bindRequestExecutor, T as getAgentOutputMode, U as getAcceptedEvents, V as AgentRequestOptions, W as parseAgentEvent, _ as StructuredOutputEnvelope, a as AgentOutputMode, b as TextLogicExecuteArgs, c as AgentRequestExecutorResult, d as AgentTextRequest, f as AgentUsage, g as BuiltinAgentActors, h as AiSdkShapedTextResult, i as AgentModelRef, j as AgentDecisionExhaustedError, k as parseStructuredEnvelope, l as AgentRequestExecutors, m as AiSdkShapedStreamResult, n as AgentExecutorTextRequest, o as AgentRequestExecutor, p as AgentUserInput, r as AgentModelMap, s as AgentRequestExecutorInfo, t as AgentCallUsage, u as AgentRequestMode, v as TextLogic, w as createTextLogic, x as TextLogicExecutor, y as TextLogicConfig, z as AgentEventDescriptor } from "./text-logic-DQW8_DWW.mjs";
|
|
4
|
+
import { a as AgentLogVerification, c as assertAgentLogEntry, d as assertEventLogStoreConformance, i as AgentLogEntry, l as assertJsonSerializable, n as AgentEventLogConflictError, o as JsonValue, r as AgentEventLogStore, s as NonSerializableAgentEventError, t as AGENT_EVENT_SCHEMA_VERSION, u as createInMemoryEventLogStore } from "./event-log-store-BrC9Q1xW.mjs";
|
|
5
|
+
import { A as AgentEffect, B as ReplayResult, C as traceTransitions, D as executeAgentRequest, E as AgentStepRequest, F as AgentReplayMachineMismatchError, G as replay, H as diffEventLogs, I as AgentUsageEvent, K as verifyReplay, L as CreateReplayEntryOptions, M as AgentEventLogDiff, N as AgentLogPatchOperation, O as AGENT_INIT_EVENT_TYPE, P as AgentReplayDivergenceError, R as GetAgentEffectsOptions, S as serializeTraceEvent, T as AgentRequest, U as getAgentEffects, V as createReplayEntry, W as initEntry, _ as RunAgentResult, a as AgentInputFrom, b as inspectTransitions, c as AgentSnapshotVersionMismatchError, d as GenerateResult, f as InspectedActorRef, g as RunAgentOptions, h as RunAgentErrorCause, i as AgentIllegalResumeEventError, j as AgentEffectDiff, k as AGENT_USAGE_EVENT_TYPE, l as AgentTraceEvent, m as PendingUserInput, n as AgentActorSession, o as AgentMessageInfo, p as JsonSerializableTraceEvent, r as AgentIdleError, s as AgentRunMeta, t as AGENT_TRACE_SCHEMA_VERSION, u as AgentUserInputExecutor, v as createAgentActor, w as AgentStateRequest, x as runAgent, y as generateResult, z as ReplayOptions } from "./run-agent-COHoCgQd.mjs";
|
|
6
6
|
import { AnyActorLogic, AnyMachineSnapshot, AnySetupConfig, AnyStateMachine, AsyncActorLogic, EventFromLogic, EventObject, InputFrom, MachineContext, MetaObject, NonReducibleUnknown, SetupReturnFromConfig, SetupStateSchema, SnapshotFrom, StateValue } from "xstate";
|
|
7
7
|
|
|
8
8
|
//#region src/messages.d.ts
|
|
@@ -309,10 +309,27 @@ type AgentSetupEventsSchema<TEventSchemas extends AgentEventSchemaInputMap> = {
|
|
|
309
309
|
type AgentSetupEmittedSchema<TEmittedSchemas extends Record<string, StandardSchemaV1>> = [keyof TEmittedSchemas] extends [never] ? {} : {
|
|
310
310
|
emitted: TEmittedSchemas;
|
|
311
311
|
};
|
|
312
|
+
/**
|
|
313
|
+
* The input schema as handed to xstate's `setup(...)`, with the machine's input
|
|
314
|
+
* type branded by the schema it came from.
|
|
315
|
+
*
|
|
316
|
+
* XState resolves `schemas.input` to a single type used both by
|
|
317
|
+
* `createActor`'s `input` option and by the `context: ({ input })` factory —
|
|
318
|
+
* and it never validates, so a schema default reads as a required field at the
|
|
319
|
+
* call site while being absent at runtime. `runAgent` validates the input
|
|
320
|
+
* (filling defaults) and reads this brand back through `AgentInputFrom` to
|
|
321
|
+
* accept the schema's looser *input* side, while the factory keeps seeing the
|
|
322
|
+
* validated *output* side.
|
|
323
|
+
*
|
|
324
|
+
* Only object-shaped input is branded: with no declared input schema the
|
|
325
|
+
* resolved type is xstate's `NonReducibleUnknown` (a union including `null`),
|
|
326
|
+
* and intersecting a brand into that collapses members to `never`.
|
|
327
|
+
*/
|
|
328
|
+
type BrandedInputSchema<TInputSchema extends StandardSchemaV1> = InferOutput<TInputSchema> extends Record<string, unknown> ? StandardSchemaV1<InferInput<TInputSchema>, InferOutput<TInputSchema> & WithAgentInputSchema<TInputSchema>> : TInputSchema;
|
|
312
329
|
type AgentSetupXStateConfig<TContextSchema extends StandardSchemaV1<Record<string, unknown>>, TEventSchemas extends AgentEventSchemaInputMap, TActors extends { [K in keyof TActors]: AnyActorLogic }, TRequestSchemas extends AgentRequestSchemaMap, TInputSchema extends StandardSchemaV1, TOutputSchema extends StandardSchemaV1, TMetaSchema extends StandardSchemaV1, TModels extends AgentModelMap, TEmittedSchemas extends Record<string, StandardSchemaV1> = {}, TStateSchemas extends Record<string, SetupStateSchema> = Record<string, SetupStateSchema>> = {
|
|
313
330
|
schemas: {
|
|
314
331
|
context: TContextSchema;
|
|
315
|
-
input: TInputSchema
|
|
332
|
+
input: BrandedInputSchema<TInputSchema>;
|
|
316
333
|
output: TOutputSchema;
|
|
317
334
|
meta: TMetaSchema;
|
|
318
335
|
} & AgentSetupEventsSchema<TEventSchemas> & AgentSetupEmittedSchema<TEmittedSchemas>;
|
|
@@ -606,7 +623,7 @@ interface ProvideExecutorsOptions<TMachine extends AnyStateMachine = AnyStateMac
|
|
|
606
623
|
* Throws at bind time if a source needs an executor kind that `executors` does
|
|
607
624
|
* not provide.
|
|
608
625
|
*
|
|
609
|
-
*
|
|
626
|
+
* `provideExecutors` does not descend into invoked child state machines: a string-keyed child
|
|
610
627
|
* machine source is left untouched, so a child with its own agent invokes needs
|
|
611
628
|
* its own `provideExecutors(...)` (or `runAgent`, which does rebind children).
|
|
612
629
|
*/
|
|
@@ -860,7 +877,10 @@ interface TrajectoryMatch {
|
|
|
860
877
|
matchedCount: number;
|
|
861
878
|
/** `expected.length`, so a scorer can compute its own ratio. */
|
|
862
879
|
expectedCount: number;
|
|
863
|
-
/**
|
|
880
|
+
/**
|
|
881
|
+
* Partial credit, 0..1. `1` for an empty expectation. Denominator is
|
|
882
|
+
* `max(expectedCount, actual.length)` in `exact` mode, `expectedCount` otherwise.
|
|
883
|
+
*/
|
|
864
884
|
score: number;
|
|
865
885
|
/** Absent when `matched`. */
|
|
866
886
|
firstMiss?: TrajectoryMiss;
|
|
@@ -910,7 +930,6 @@ type ScriptedDecisionValue = ChosenEvent | {
|
|
|
910
930
|
event: ChosenEvent;
|
|
911
931
|
reason?: string;
|
|
912
932
|
usage?: AgentCallUsage;
|
|
913
|
-
[key: string]: unknown;
|
|
914
933
|
};
|
|
915
934
|
/**
|
|
916
935
|
* One entry in the `decisions` queue: a scripted answer, or a function of the
|
|
@@ -970,6 +989,101 @@ interface ScriptedExecutorsScript {
|
|
|
970
989
|
*/
|
|
971
990
|
declare function createScriptedExecutors(script?: ScriptedExecutorsScript): Required<AgentRequestExecutors>;
|
|
972
991
|
//#endregion
|
|
992
|
+
//#region src/utils.d.ts
|
|
993
|
+
/**
|
|
994
|
+
* Deep-clones a snapshot to a plain-JSON value via a `JSON` round-trip, the
|
|
995
|
+
* shape you persist and later feed back to `runAgent({ snapshot })`. Asserts
|
|
996
|
+
* JSON-serializability: functions, `undefined`, and other non-JSON values are
|
|
997
|
+
* dropped or throw exactly as `JSON.stringify`/`JSON.parse` would. Returns a
|
|
998
|
+
* plain-JSON deep clone, not a live snapshot.
|
|
999
|
+
*/
|
|
1000
|
+
declare function persistSnapshot<TSnapshot>(snapshot: TSnapshot): TSnapshot;
|
|
1001
|
+
/**
|
|
1002
|
+
* A stable, dependency-free structural fingerprint of a machine — a short hex
|
|
1003
|
+
* `djb2` hash over its **structural** config only: state ids/nesting, transition
|
|
1004
|
+
* event types and targets, invoke `src`s, `initial`, and any other serializable
|
|
1005
|
+
* config fields. Function values (context/output builders, prompts, inline
|
|
1006
|
+
* guards/actions) are excluded entirely, so two machines that differ only in
|
|
1007
|
+
* their prompts or executors hash identically; adding/removing/retargeting a
|
|
1008
|
+
* state or transition changes the hash.
|
|
1009
|
+
*
|
|
1010
|
+
* Used by {@link runAgent} to stamp settled snapshots with a `version` and to
|
|
1011
|
+
* detect a structurally-edited machine on resume. It is a change detector, not
|
|
1012
|
+
* a cryptographic digest — collisions are possible but unlikely for real
|
|
1013
|
+
* configs. Pass an explicit `machineVersion` to `runAgent` to override it.
|
|
1014
|
+
*/
|
|
1015
|
+
declare function getMachineStructuralHash(machine: AnyStateMachine): string;
|
|
1016
|
+
/** Builds a {@link UserMessage} from a string or multimodal content parts. */
|
|
1017
|
+
declare function userMessage(content: string | Array<TextPart | ImagePart | FilePart>): UserMessage;
|
|
1018
|
+
/** Builds an {@link AssistantMessage} from a string or content parts (text, files, tool calls/results). */
|
|
1019
|
+
declare function assistantMessage(content: string | Array<TextPart | FilePart | ToolCallPart | ToolResultPart>): AssistantMessage;
|
|
1020
|
+
/** Builds a {@link SystemMessage}. */
|
|
1021
|
+
declare function systemMessage(content: string): SystemMessage;
|
|
1022
|
+
/** Builds a {@link ToolMessage} from one or more tool-result parts. */
|
|
1023
|
+
declare function toolMessage(content: Array<ToolResultPart>): ToolMessage;
|
|
1024
|
+
type MetaOfSnapshot<TSnapshot extends {
|
|
1025
|
+
getMeta(): Record<string, unknown>;
|
|
1026
|
+
}> = NonNullable<ReturnType<TSnapshot["getMeta"]>[keyof ReturnType<TSnapshot["getMeta"]>]>;
|
|
1027
|
+
/**
|
|
1028
|
+
* Returns the merged `meta` of a snapshot's active state(s) — the typed
|
|
1029
|
+
* replacement for the `Object.values(snapshot.getMeta())[0]` dance.
|
|
1030
|
+
*
|
|
1031
|
+
* `snapshot.getMeta()` is keyed by state id; a leaf machine has one active
|
|
1032
|
+
* state, but parallel/nested machines can have several. This shallow-merges
|
|
1033
|
+
* every active state's meta into one object (later/deeper entries win) and
|
|
1034
|
+
* returns `{}` when no active state declares meta.
|
|
1035
|
+
*
|
|
1036
|
+
* The return type is recovered from the snapshot's own `getMeta()` type, so a
|
|
1037
|
+
* schema-typed machine (`setupAgent({ meta })`) yields the meta schema's
|
|
1038
|
+
* output type. Pass an explicit `TMeta` to override when the snapshot is
|
|
1039
|
+
* untyped (e.g. `AnyMachineSnapshot`).
|
|
1040
|
+
*
|
|
1041
|
+
* @example HITL: read the current state's interaction protocol off an idle
|
|
1042
|
+
* snapshot to render for a human.
|
|
1043
|
+
* ```ts
|
|
1044
|
+
* const { interaction } = getStateMeta(result.snapshot);
|
|
1045
|
+
* ```
|
|
1046
|
+
*/
|
|
1047
|
+
declare function getStateMeta<TSnapshot extends {
|
|
1048
|
+
getMeta(): Record<string, unknown>;
|
|
1049
|
+
} = AnyMachineSnapshot, TMeta = MetaOfSnapshot<TSnapshot>>(snapshot: TSnapshot): Partial<TMeta>;
|
|
1050
|
+
/**
|
|
1051
|
+
* Reads the run-owned message log off a snapshot settled by a `runAgent` call
|
|
1052
|
+
* that used `getRequests` (or `options.messages`) — the typed replacement for
|
|
1053
|
+
* the `(snapshot as { messages?: AgentMessage[] }).messages` cast. runAgent
|
|
1054
|
+
* stamps the log as a plain enumerable `messages` property (like `agentMeta`),
|
|
1055
|
+
* so it survives a JSON persist/resume round-trip; this accessor works on the
|
|
1056
|
+
* live settled snapshot and on a JSON-parsed persisted one alike. Returns `[]`
|
|
1057
|
+
* when no log was stamped (e.g. a default invoke-driven run).
|
|
1058
|
+
*
|
|
1059
|
+
* The write path is `runAgent(..., { messages })`: an explicit seed that
|
|
1060
|
+
* overrides the resume snapshot's stamped log (fold in a user reply on
|
|
1061
|
+
* resume, or start a run with prior history).
|
|
1062
|
+
*/
|
|
1063
|
+
declare function getAgentMessages(snapshot: unknown): AgentMessage[];
|
|
1064
|
+
/**
|
|
1065
|
+
* Structural guard for a {@link StandardSchemaV1}: `true` when `value` carries
|
|
1066
|
+
* the `~standard` marker. Used to tell an already-schema'd tool `inputSchema`
|
|
1067
|
+
* (a Zod/Valibot/… schema) apart from an SDK-specific schema wrapper that core
|
|
1068
|
+
* can't read directly — see the `ai-sdk` tool pass-through.
|
|
1069
|
+
*/
|
|
1070
|
+
declare function isStandardSchema(value: unknown): value is StandardSchemaV1;
|
|
1071
|
+
/**
|
|
1072
|
+
* Pulls the JSON Schema off a {@link StandardSchemaV1} via its optional
|
|
1073
|
+
* `~standard.jsonSchema.input()` extension (implemented by e.g. Zod v4's
|
|
1074
|
+
* `z.toJSONSchema`), awaiting it when the producer is async. Returns
|
|
1075
|
+
* `undefined` when the schema doesn't expose the extension. Use this to build
|
|
1076
|
+
* a provider request's `response_format`/tool `parameters` from a schema.
|
|
1077
|
+
*/
|
|
1078
|
+
declare function getJsonSchema(schema?: StandardSchemaV1): Promise<Record<string, unknown> | undefined>;
|
|
1079
|
+
/**
|
|
1080
|
+
* Synchronous variant of {@link getJsonSchema}, for call sites that can't
|
|
1081
|
+
* await (building tool/event descriptors inline). An async JSON Schema
|
|
1082
|
+
* producer is treated as absent (returns `undefined`) — in practice Zod's
|
|
1083
|
+
* `z.toJSONSchema` resolves synchronously.
|
|
1084
|
+
*/
|
|
1085
|
+
declare function getJsonSchemaSync(schema?: StandardSchemaV1): Record<string, unknown> | undefined;
|
|
1086
|
+
//#endregion
|
|
973
1087
|
//#region src/seam.d.ts
|
|
974
1088
|
/**
|
|
975
1089
|
* Which model call is under test: the Nth call addressed either by request
|
|
@@ -997,8 +1111,11 @@ interface SeamTurn<TMachine extends AnyStateMachine> {
|
|
|
997
1111
|
snapshot: SnapshotFrom<TMachine>;
|
|
998
1112
|
/** Its state value, for a `switch` on flat machines. */
|
|
999
1113
|
state: StateValue;
|
|
1000
|
-
/**
|
|
1001
|
-
|
|
1114
|
+
/**
|
|
1115
|
+
* The merged `meta` of the active state(s), e.g. a declared `interaction`.
|
|
1116
|
+
* Typed from the machine's own meta schema (`setupAgent({ meta })`).
|
|
1117
|
+
*/
|
|
1118
|
+
meta: Partial<MetaOfSnapshot<SnapshotFrom<TMachine>>>;
|
|
1002
1119
|
/** 0-based index of this pause within the run. */
|
|
1003
1120
|
turn: number;
|
|
1004
1121
|
/** The `idle` result that produced the pause. */
|
|
@@ -1103,99 +1220,4 @@ interface RunSeamResult<TMachine extends AnyStateMachine> {
|
|
|
1103
1220
|
*/
|
|
1104
1221
|
declare function runSeam<TMachine extends AnyStateMachine>(machine: TMachine, options: RunSeamOptions<TMachine>): Promise<RunSeamResult<TMachine>>;
|
|
1105
1222
|
//#endregion
|
|
1106
|
-
|
|
1107
|
-
/**
|
|
1108
|
-
* Deep-clones a snapshot to a plain-JSON value via a `JSON` round-trip, the
|
|
1109
|
-
* shape you persist and later feed back to `runAgent({ snapshot })`. Asserts
|
|
1110
|
-
* JSON-serializability: functions, `undefined`, and other non-JSON values are
|
|
1111
|
-
* dropped or throw exactly as `JSON.stringify`/`JSON.parse` would. Returns a
|
|
1112
|
-
* plain-JSON deep clone, not a live snapshot.
|
|
1113
|
-
*/
|
|
1114
|
-
declare function persistSnapshot<TSnapshot>(snapshot: TSnapshot): TSnapshot;
|
|
1115
|
-
/**
|
|
1116
|
-
* A stable, dependency-free structural fingerprint of a machine — a short hex
|
|
1117
|
-
* `djb2` hash over its **structural** config only: state ids/nesting, transition
|
|
1118
|
-
* event types and targets, invoke `src`s, `initial`, and any other serializable
|
|
1119
|
-
* config fields. Function values (context/output builders, prompts, inline
|
|
1120
|
-
* guards/actions) are excluded entirely, so two machines that differ only in
|
|
1121
|
-
* their prompts or executors hash identically; adding/removing/retargeting a
|
|
1122
|
-
* state or transition changes the hash.
|
|
1123
|
-
*
|
|
1124
|
-
* Used by {@link runAgent} to stamp settled snapshots with a `version` and to
|
|
1125
|
-
* detect a structurally-edited machine on resume. It is a change detector, not
|
|
1126
|
-
* a cryptographic digest — collisions are possible but unlikely for real
|
|
1127
|
-
* configs. Pass an explicit `machineVersion` to `runAgent` to override it.
|
|
1128
|
-
*/
|
|
1129
|
-
declare function getMachineStructuralHash(machine: AnyStateMachine): string;
|
|
1130
|
-
/** Builds a {@link UserMessage} from a string or multimodal content parts. */
|
|
1131
|
-
declare function userMessage(content: string | Array<TextPart | ImagePart | FilePart>): UserMessage;
|
|
1132
|
-
/** Builds an {@link AssistantMessage} from a string or content parts (text, files, tool calls/results). */
|
|
1133
|
-
declare function assistantMessage(content: string | Array<TextPart | FilePart | ToolCallPart | ToolResultPart>): AssistantMessage;
|
|
1134
|
-
/** Builds a {@link SystemMessage}. */
|
|
1135
|
-
declare function systemMessage(content: string): SystemMessage;
|
|
1136
|
-
/** Builds a {@link ToolMessage} from one or more tool-result parts. */
|
|
1137
|
-
declare function toolMessage(content: Array<ToolResultPart>): ToolMessage;
|
|
1138
|
-
type MetaOfSnapshot<TSnapshot extends {
|
|
1139
|
-
getMeta(): Record<string, unknown>;
|
|
1140
|
-
}> = NonNullable<ReturnType<TSnapshot["getMeta"]>[keyof ReturnType<TSnapshot["getMeta"]>]>;
|
|
1141
|
-
/**
|
|
1142
|
-
* Returns the merged `meta` of a snapshot's active state(s) — the typed
|
|
1143
|
-
* replacement for the `Object.values(snapshot.getMeta())[0]` dance.
|
|
1144
|
-
*
|
|
1145
|
-
* `snapshot.getMeta()` is keyed by state id; a leaf machine has one active
|
|
1146
|
-
* state, but parallel/nested machines can have several. This shallow-merges
|
|
1147
|
-
* every active state's meta into one object (later/deeper entries win) and
|
|
1148
|
-
* returns `{}` when no active state declares meta.
|
|
1149
|
-
*
|
|
1150
|
-
* The return type is recovered from the snapshot's own `getMeta()` type, so a
|
|
1151
|
-
* schema-typed machine (`setupAgent({ meta })`) yields the meta schema's
|
|
1152
|
-
* output type. Pass an explicit `TMeta` to override when the snapshot is
|
|
1153
|
-
* untyped (e.g. `AnyMachineSnapshot`).
|
|
1154
|
-
*
|
|
1155
|
-
* @example HITL: read the current state's interaction protocol off an idle
|
|
1156
|
-
* snapshot to render for a human.
|
|
1157
|
-
* ```ts
|
|
1158
|
-
* const { interaction } = getStateMeta(result.snapshot);
|
|
1159
|
-
* ```
|
|
1160
|
-
*/
|
|
1161
|
-
declare function getStateMeta<TSnapshot extends {
|
|
1162
|
-
getMeta(): Record<string, unknown>;
|
|
1163
|
-
} = AnyMachineSnapshot, TMeta = MetaOfSnapshot<TSnapshot>>(snapshot: TSnapshot): Partial<TMeta>;
|
|
1164
|
-
/**
|
|
1165
|
-
* Reads the run-owned message log off a snapshot settled by a `runAgent` call
|
|
1166
|
-
* that used `getRequests` (or `options.messages`) — the typed replacement for
|
|
1167
|
-
* the `(snapshot as { messages?: AgentMessage[] }).messages` cast. runAgent
|
|
1168
|
-
* stamps the log as a plain enumerable `messages` property (like `agentMeta`),
|
|
1169
|
-
* so it survives a JSON persist/resume round-trip; this accessor works on the
|
|
1170
|
-
* live settled snapshot and on a JSON-parsed persisted one alike. Returns `[]`
|
|
1171
|
-
* when no log was stamped (e.g. a default invoke-driven run).
|
|
1172
|
-
*
|
|
1173
|
-
* The write path is `runAgent(..., { messages })`: an explicit seed that
|
|
1174
|
-
* overrides the resume snapshot's stamped log (fold in a user reply on
|
|
1175
|
-
* resume, or start a run with prior history).
|
|
1176
|
-
*/
|
|
1177
|
-
declare function getAgentMessages(snapshot: unknown): AgentMessage[];
|
|
1178
|
-
/**
|
|
1179
|
-
* Structural guard for a {@link StandardSchemaV1}: `true` when `value` carries
|
|
1180
|
-
* the `~standard` marker. Used to tell an already-schema'd tool `inputSchema`
|
|
1181
|
-
* (a Zod/Valibot/… schema) apart from an SDK-specific schema wrapper that core
|
|
1182
|
-
* can't read directly — see the `ai-sdk` tool pass-through.
|
|
1183
|
-
*/
|
|
1184
|
-
declare function isStandardSchema(value: unknown): value is StandardSchemaV1;
|
|
1185
|
-
/**
|
|
1186
|
-
* Pulls the JSON Schema off a {@link StandardSchemaV1} via its optional
|
|
1187
|
-
* `~standard.jsonSchema.input()` extension (implemented by e.g. Zod v4's
|
|
1188
|
-
* `z.toJSONSchema`), awaiting it when the producer is async. Returns
|
|
1189
|
-
* `undefined` when the schema doesn't expose the extension. Use this to build
|
|
1190
|
-
* a provider request's `response_format`/tool `parameters` from a schema.
|
|
1191
|
-
*/
|
|
1192
|
-
declare function getJsonSchema(schema?: StandardSchemaV1): Promise<Record<string, unknown> | undefined>;
|
|
1193
|
-
/**
|
|
1194
|
-
* Synchronous variant of {@link getJsonSchema}, for call sites that can't
|
|
1195
|
-
* await (building tool/event descriptors inline). An async JSON Schema
|
|
1196
|
-
* producer is treated as absent (returns `undefined`) — in practice Zod's
|
|
1197
|
-
* `z.toJSONSchema` resolves synchronously.
|
|
1198
|
-
*/
|
|
1199
|
-
declare function getJsonSchemaSync(schema?: StandardSchemaV1): Record<string, unknown> | undefined;
|
|
1200
|
-
//#endregion
|
|
1201
|
-
export { AGENT_EVENT_SCHEMA_VERSION, AGENT_INIT_EVENT_TYPE, AGENT_TRACE_SCHEMA_VERSION, AGENT_USAGE_EVENT_TYPE, type AgentActorSession, type AgentCallUsage, type AgentDecisionExecutor, AgentDecisionExhaustedError, type AgentDecisionInput, type AgentDecisionRequest, type AgentEffect, type AgentEffectDiff, AgentError, type AgentEventDescriptor, AgentEventLogConflictError, type AgentEventLogDiff, type AgentEventLogStore, type AgentEventToolNameResolver, type AgentExecutorTextRequest, AgentIdleError, AgentIllegalResumeEventError, type AgentLintDiagnostic, AgentLintError, type AgentLintSeverity, type AgentLogEntry, type AgentLogPatchOperation, type AgentLogVerification, type AgentMessage, type AgentMessageInfo, type AgentModelRef, type AgentOutputMode, type AgentPathReport, type AgentPathTerminal, AgentReplayDivergenceError, AgentReplayMachineMismatchError, type AgentRequest, type AgentRequestExecutor, type AgentRequestExecutorInfo, type AgentRequestExecutorResult, type AgentRequestExecutors, type AgentRequestOptions, type AgentRequestSource, type AgentRun, type AgentRunMeta, type AgentSchemaPack, type AgentSnapshotStore, AgentSnapshotVersionMismatchError, type AgentStateRequest, type AgentStepRequest, type AgentTextRequest, type AgentTool, type AgentToolChoice, type AgentToolDescriptor, type AgentToolExecute, type AgentTools, type AgentTraceEvent, type AgentUsage, type AgentUsageEvent, type AgentUsageEventPayload, type AgentUserInput, type AgentUserInputExecutor, type AgentWorkflowActionConfig, type AgentWorkflowActorConfig, type AgentWorkflowConfig, type AgentWorkflowInvokeConfig, type AgentWorkflowRequestConfig, type AgentWorkflowStateConfig, type AgentWorkflowTransitionConfig, type AiSdkShapedStreamResult, type AiSdkShapedTextResult, type AllowedEvents, type AssertAgentMachineOptions, type AssistantMessage, type CanReachResult, type ChosenEvent, type CreateReplayEntryOptions, type DecisionAttempt, type DecisionLogicConfig, type ExplorePathsOptions, type FilePart, type FromConfigOptions, type FromConfigResult, type GenerateResult, type GetAgentEffectsOptions, type ImagePart, type InferOutput, type InspectedActorRef, type JsonSerializableTraceEvent, type JsonValue, type LintAgentMachineOptions, type MatchTrajectoryOptions, NonSerializableAgentEventError, type PendingUserInput, type ProvideExecutorsOptions, type ReplayOptions, type ReplayResult, type ResolveDecisionOptions, type RunAgentErrorCause, type RunAgentOptions, type RunAgentResult, type RunSeamOptions, type RunSeamResult, type SchemaCompiler, type ScriptedDecisionEntry, type ScriptedDecisionValue, type ScriptedExecutorsScript, type ScriptedTextEntry, type SeamRef, type SeamSlice, type SeamTurn, type SimulateAgentOptions, type SimulateAgentResult, type SimulationScript, type SimulationTrailEntry, type StandardSchemaV1, type StructuredOutputEnvelope, type SystemMessage, type TextLogic, type TextLogicConfig, type TextLogicExecuteArgs, type TextLogicExecutor, type TextPart, type ToolCallPart, type ToolMessage, type ToolResultPart, type TrajectoryEvent, type TrajectoryItem, type TrajectoryMatch, type TrajectoryMiss, type UserMessage, type WithAgentUsageEvent, appendMessages, assertAgentLogEntry, assertAgentMachine, assertEventLogStoreConformance, assertJsonSerializable, assistantMessage, bindRequestExecutor, buildEnvelopeSchema, canReach, createAgentActor, createAgentRun, createAgentSchemas, createInMemoryEventLogStore, createReplayEntry, createScriptedExecutors, createTextLogic, diffEventLogs, executeAgentRequest, explorePaths, generateResult, getAcceptedEvents, getAgentEffects, getAgentMessages, getAgentOutputMode, getCallUsage, getJsonSchema, getJsonSchemaSync, getMachineStructuralHash, getStateMeta, initEntry, inspectTransitions, isStandardSchema, lintAgentMachine, matchesTrajectory, messagesSchema, parseAgentEvent, parseModelRef, parseOutput, parseStructuredEnvelope, persistSnapshot, provideExecutors, renderDecisionAttempts, replay, resolveDecision, runAgent, runSeam, serializeTraceEvent, setupAgent, simulateAgent, systemMessage, toolMessage, traceTransitions, userMessage, verifyReplay };
|
|
1223
|
+
export { AGENT_EVENT_SCHEMA_VERSION, AGENT_INIT_EVENT_TYPE, AGENT_TRACE_SCHEMA_VERSION, AGENT_USAGE_EVENT_TYPE, type AgentActorSession, type AgentCallUsage, type AgentDecisionExecutor, AgentDecisionExhaustedError, type AgentDecisionInput, type AgentDecisionRequest, type AgentEffect, type AgentEffectDiff, AgentError, type AgentEventDescriptor, AgentEventLogConflictError, type AgentEventLogDiff, type AgentEventLogStore, type AgentEventToolNameResolver, type AgentExecutorTextRequest, AgentIdleError, AgentIllegalResumeEventError, type AgentInputFrom, type AgentLintDiagnostic, AgentLintError, type AgentLintSeverity, type AgentLogEntry, type AgentLogPatchOperation, type AgentLogVerification, type AgentMessage, type AgentMessageInfo, type AgentModelRef, type AgentOutputMode, type AgentPathReport, type AgentPathTerminal, AgentReplayDivergenceError, AgentReplayMachineMismatchError, type AgentRequest, type AgentRequestExecutor, type AgentRequestExecutorInfo, type AgentRequestExecutorResult, type AgentRequestExecutors, type AgentRequestOptions, type AgentRequestSource, type AgentRun, type AgentRunMeta, type AgentSchemaPack, type AgentSnapshotStore, AgentSnapshotVersionMismatchError, type AgentStateRequest, type AgentStepRequest, type AgentTextRequest, type AgentTool, type AgentToolChoice, type AgentToolDescriptor, type AgentToolExecute, type AgentTools, type AgentTraceEvent, type AgentUsage, type AgentUsageEvent, type AgentUsageEventPayload, type AgentUserInput, type AgentUserInputExecutor, type AgentWorkflowActionConfig, type AgentWorkflowActorConfig, type AgentWorkflowConfig, type AgentWorkflowInvokeConfig, type AgentWorkflowRequestConfig, type AgentWorkflowStateConfig, type AgentWorkflowTransitionConfig, type AiSdkShapedStreamResult, type AiSdkShapedTextResult, type AllowedEvents, type AssertAgentMachineOptions, type AssistantMessage, type CanReachResult, type ChosenEvent, type CreateReplayEntryOptions, type DecisionAttempt, type DecisionLogicConfig, type ExplorePathsOptions, type FilePart, type FromConfigOptions, type FromConfigResult, type GenerateResult, type GetAgentEffectsOptions, type ImagePart, type InferInput, type InferOutput, type InspectedActorRef, type JsonSerializableTraceEvent, type JsonValue, type LintAgentMachineOptions, type MatchTrajectoryOptions, NonSerializableAgentEventError, type PendingUserInput, type ProvideExecutorsOptions, type ReplayOptions, type ReplayResult, type ResolveDecisionOptions, type RunAgentErrorCause, type RunAgentOptions, type RunAgentResult, type RunSeamOptions, type RunSeamResult, type SchemaCompiler, type ScriptedDecisionEntry, type ScriptedDecisionValue, type ScriptedExecutorsScript, type ScriptedTextEntry, type SeamRef, type SeamSlice, type SeamTurn, type SimulateAgentOptions, type SimulateAgentResult, type SimulationScript, type SimulationTrailEntry, type StandardSchemaV1, type StructuredOutputEnvelope, type SystemMessage, type TextLogic, type TextLogicConfig, type TextLogicExecuteArgs, type TextLogicExecutor, type TextPart, type ToolCallPart, type ToolMessage, type ToolResultPart, type TrajectoryEvent, type TrajectoryItem, type TrajectoryMatch, type TrajectoryMiss, type UserMessage, type WithAgentUsageEvent, appendMessages, assertAgentLogEntry, assertAgentMachine, assertEventLogStoreConformance, assertJsonSerializable, assistantMessage, bindRequestExecutor, buildEnvelopeSchema, canReach, createAgentActor, createAgentRun, createAgentSchemas, createInMemoryEventLogStore, createReplayEntry, createScriptedExecutors, createTextLogic, diffEventLogs, executeAgentRequest, explorePaths, generateResult, getAcceptedEvents, getAgentEffects, getAgentMessages, getAgentOutputMode, getCallUsage, getJsonSchema, getJsonSchemaSync, getMachineStructuralHash, getStateMeta, initEntry, inspectTransitions, isStandardSchema, lintAgentMachine, matchesTrajectory, messagesSchema, parseAgentEvent, parseModelRef, parseOutput, parseStructuredEnvelope, persistSnapshot, provideExecutors, renderDecisionAttempts, replay, resolveDecision, runAgent, runSeam, serializeTraceEvent, setupAgent, simulateAgent, systemMessage, toolMessage, traceTransitions, userMessage, verifyReplay };
|