@statelyai/agent 2.0.0-alpha.8 → 2.0.0-alpha.9

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 CHANGED
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_run_agent = require("./run-agent-BQ3vV7UI.cjs");
2
+ const require_run_agent = require("./run-agent-BFMkuI1F.cjs");
3
3
  const require_decision = require("./decision-b-lkcs4L.cjs");
4
4
  let ai = require("ai");
5
5
  //#region src/ai-sdk/index.ts
package/dist/ai-sdk.d.cts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { C as StandardSchemaV1, m as ChosenEvent, n as AgentEventSchemaInputMap, u as AgentTools } from "./types-C9QiMjre.cjs";
2
2
  import { H as AgentEventDescriptor, i as AgentRequestExecutor, j as AgentDecisionRequest, k as AgentDecisionExecutor, l as AgentTextRequest, s as AgentRequestExecutors } from "./text-logic-CZjyACzQ.cjs";
3
- import { E as AgentMachineConfig, T as AgentMachine, c as RunAgentResult, s as RunAgentOptions } from "./run-agent-BzW4emV_.cjs";
3
+ import { D as AgentMachine, O as AgentMachineConfig, l as RunAgentOptions, u as RunAgentResult } from "./run-agent-BVMd--1l.cjs";
4
4
  import * as _$xstate from "xstate";
5
5
  import { FinishReason, LanguageModel, LanguageModelUsage, ModelMessage, Tool, ToolSet, TypedToolCall, TypedToolResult } from "ai";
6
6
 
package/dist/ai-sdk.d.mts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { C as StandardSchemaV1, m as ChosenEvent, n as AgentEventSchemaInputMap, u as AgentTools } from "./types-qm00QF91.mjs";
2
2
  import { H as AgentEventDescriptor, i as AgentRequestExecutor, j as AgentDecisionRequest, k as AgentDecisionExecutor, l as AgentTextRequest, s as AgentRequestExecutors } from "./text-logic-C7WJpCIc.mjs";
3
- import { E as AgentMachineConfig, T as AgentMachine, c as RunAgentResult, s as RunAgentOptions } from "./run-agent-XYjmBxHi.mjs";
3
+ import { D as AgentMachine, O as AgentMachineConfig, l as RunAgentOptions, u as RunAgentResult } from "./run-agent-DzYJb3CK.mjs";
4
4
  import * as _$xstate from "xstate";
5
5
  import { FinishReason, LanguageModel, LanguageModelUsage, ModelMessage, Tool, ToolSet, TypedToolCall, TypedToolResult } from "ai";
6
6
 
package/dist/ai-sdk.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { a as runAgent$1, c as setupAgent } from "./run-agent-7OaHM7SB.mjs";
1
+ import { a as runAgent$1, c as setupAgent } from "./run-agent-BoAOq_0Z.mjs";
2
2
  import { J as isStandardSchema, L as getRegisteredAgentModels, T as getAgentOutputMode, l as renderDecisionAttempts, x as buildEnvelopeSchema } from "./decision-CQdrKc8k.mjs";
3
3
  import { NoObjectGeneratedError, Output, generateText, stepCountIs, streamText, tool } from "ai";
4
4
  //#region src/ai-sdk/index.ts
package/dist/cli.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
- const require_run_agent = require("./run-agent-BQ3vV7UI.cjs");
3
- const require_src = require("./src-CFtSqm-c.cjs");
2
+ const require_run_agent = require("./run-agent-BFMkuI1F.cjs");
3
+ const require_src = require("./src-CdTwCO35.cjs");
4
4
  let node_fs = require("node:fs");
5
5
  //#region src/cli.ts
6
6
  /**
package/dist/cli.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
- import { c as setupAgent } from "./run-agent-7OaHM7SB.mjs";
3
- import { r as lintAgentMachine } from "./src-d-jhiOgP.mjs";
2
+ import { c as setupAgent } from "./run-agent-BoAOq_0Z.mjs";
3
+ import { r as lintAgentMachine } from "./src-BOW6g5zE.mjs";
4
4
  import { readFileSync } from "node:fs";
5
5
  //#region src/cli.ts
6
6
  /**
package/dist/index.cjs CHANGED
@@ -1,7 +1,7 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_run_agent = require("./run-agent-BQ3vV7UI.cjs");
2
+ const require_run_agent = require("./run-agent-BFMkuI1F.cjs");
3
3
  const require_decision = require("./decision-b-lkcs4L.cjs");
4
- const require_src = require("./src-CFtSqm-c.cjs");
4
+ const require_src = require("./src-CdTwCO35.cjs");
5
5
  exports.AgentIdleError = require_run_agent.AgentIdleError;
6
6
  exports.DecisionExhaustedError = require_decision.DecisionExhaustedError;
7
7
  exports.EVENT_TOOL_PREFIX = require_decision.EVENT_TOOL_PREFIX;
package/dist/index.d.cts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { A as UserMessage, C as StandardSchemaV1, D as ToolMessage, E as ToolCallPart, O as ToolResultOutput, S as ProviderOptions, T as TextPart, _ as EventUnion, a as AgentTool, b as InferOutput, c as AgentToolExecute, d as AllowedEventPattern, f as AllowedEvents, g as EventPayload, h as DataContent, i as AgentSnapshotStore, k as ToolResultPart, l as AgentToolSchema, m as ChosenEvent, n as AgentEventSchemaInputMap, o as AgentToolChoice, p as AssistantMessage, r as AgentMessage, s as AgentToolDescriptor, t as AgentEventSchemaInput, u as AgentTools, v as FilePart, w as SystemMessage, x as NormalizedEventSchemas, y as ImagePart } from "./types-C9QiMjre.cjs";
2
2
  import { A as AgentDecisionInput, B as renderDecisionAttempts, C as createTextLogic, D as parseOutput, E as parseModelRef, F as DecisionExhaustedError, G as AgentRequestSource, H as AgentEventDescriptor, I as DecisionLogic, J as matchesEventPattern, K as EVENT_TOOL_PREFIX, L as DecisionLogicConfig, M as AgentPlanInput, N as AgentPlanOutput, O as parseStructuredEnvelope, P as DecisionAttempt, R as PLAN_DONE_EVENT_TYPE, S as buildEnvelopeSchema, T as isStructuredOutputSchema, U as AgentEventToolNameResolver, V as resolveDecision, W as AgentRequestOptions, Y as parseAgentEvent, _ as TextLogicExecuteArgs, a as AgentRequestExecutorInfo, b as TextLogicOutput, c as AgentRequestMode, d as AiSdkShapedStreamResult, f as AiSdkShapedTextResult, g as TextLogicConfig, h as TextLogic, i as AgentRequestExecutor, j as AgentDecisionRequest, k as AgentDecisionExecutor, l as AgentTextRequest, m as StructuredOutputEnvelope, n as AgentModelRef, o as AgentRequestExecutorResult, q as getAcceptedEvents, r as AgentOutputMode, s as AgentRequestExecutors, t as AgentModelMap, u as AgentUserInput, v as TextLogicExecutor, w as getAgentOutputMode, x as bindRequestExecutor, y as TextLogicInput, z as ResolveDecisionOptions } from "./text-logic-CZjyACzQ.cjs";
3
- import { A as AgentStateNarrowing, B as FromConfigOptions, C as resolveAgentStep, D as AgentRequestConfig, E as AgentMachineConfig, F as AgentWorkflowConfig, H as appendMessages, I as AgentWorkflowInvokeConfig, L as AgentWorkflowRequestConfig, M as setupAgent, N as AgentWorkflowActionConfig, O as AgentSchemaPack, P as AgentWorkflowActorConfig, R as AgentWorkflowStateConfig, S as resolveAgentRequests, T as AgentMachine, U as messagesSchema, V as SchemaCompiler, _ as AgentStepRequest, a as InspectedActorRef, b as getAgentRequests, c as RunAgentResult, d as runAgent, f as runAgentToCompletion, g as AgentStep, h as AgentRequest, i as IllegalResumeEventError, j as createAgentSchemas, k as AgentSetupStateSchema, l as SnapshotVersionMismatchError, m as AgentPlanRequest, n as AgentTraceEvent, o as PendingUserInput, p as AgentStateRequest, r as AgentUserInputExecutor, s as RunAgentOptions, t as AgentIdleError, u as inspectTransitions, v as ResolveAgentRequestsOptions, w as transitionAgentStep, x as initialAgentStep, y as executeAgentRequest, z as AgentWorkflowTransitionConfig } from "./run-agent-BzW4emV_.cjs";
3
+ import { A as AgentSchemaPack, B as AgentWorkflowStateConfig, C as initialAgentStep, D as AgentMachine, E as transitionAgentStep, F as AgentWorkflowActionConfig, G as messagesSchema, H as FromConfigOptions, I as AgentWorkflowActorConfig, L as AgentWorkflowConfig, M as AgentStateNarrowing, N as createAgentSchemas, O as AgentMachineConfig, P as setupAgent, R as AgentWorkflowInvokeConfig, S as getAgentRequests, T as resolveAgentStep, U as SchemaCompiler, V as AgentWorkflowTransitionConfig, W as appendMessages, _ as AgentRequest, a as AgentUserInputExecutor, b as ResolveAgentRequestsOptions, c as PendingUserInput, d as SnapshotVersionMismatchError, f as inspectTransitions, g as AgentPlanRequest, h as AgentStateRequest, i as AgentTraceEvent, j as AgentSetupStateSchema, k as AgentRequestConfig, l as RunAgentOptions, m as runAgentToCompletion, n as AgentMessageInfo, o as IllegalResumeEventError, p as runAgent, r as AgentRunMeta, s as InspectedActorRef, t as AgentIdleError, u as RunAgentResult, v as AgentStep, w as resolveAgentRequests, x as executeAgentRequest, y as AgentStepRequest, z as AgentWorkflowRequestConfig } from "./run-agent-BVMd--1l.cjs";
4
4
  import { a as getMachineStructuralHash, c as persistSnapshot, d as userMessage, f as validateSchemaSync, i as getJsonSchemaSync, l as systemMessage, n as getAgentMessages, o as getStateMeta, r as getJsonSchema, s as isStandardSchema, t as assistantMessage, u as toolMessage } from "./utils-Dri7aeEG.cjs";
5
5
  import { AnyMachineSnapshot, AnyStateMachine } from "xstate";
6
6
 
@@ -181,4 +181,4 @@ interface CanReachResult {
181
181
  */
182
182
  declare function canReach(machine: AnyStateMachine, statePath: string, options?: ExplorePathsOptions): Promise<CanReachResult>;
183
183
  //#endregion
184
- export { type AgentDecisionExecutor, type AgentDecisionInput, type AgentDecisionRequest, type AgentEventDescriptor, type AgentEventSchemaInput, type AgentEventSchemaInputMap, type AgentEventToolNameResolver, AgentIdleError, type AgentLintDiagnostic, type AgentLintSeverity, type AgentMachine, type AgentMachineConfig, type AgentMessage, type AgentModelMap, type AgentModelRef, type AgentOutputMode, type AgentPathReport, type AgentPathTerminal, type AgentPlanInput, type AgentPlanOutput, type AgentPlanRequest, type AgentRequest, type AgentRequestConfig, type AgentRequestExecutor, type AgentRequestExecutorInfo, type AgentRequestExecutorResult, type AgentRequestExecutors, type AgentRequestMode, type AgentRequestOptions, type AgentRequestSource, type AgentSchemaPack, type AgentSetupStateSchema, type AgentSnapshotStore, type AgentStateNarrowing, type AgentStateRequest, type AgentStep, type AgentStepRequest, type AgentTextRequest, type AgentTool, type AgentToolChoice, type AgentToolDescriptor, type AgentToolExecute, type AgentToolSchema, type AgentTools, type AgentTraceEvent, type AgentUserInput, type AgentUserInputExecutor, type AgentWorkflowActionConfig, type AgentWorkflowActorConfig, type AgentWorkflowConfig, type AgentWorkflowInvokeConfig, type AgentWorkflowRequestConfig, type AgentWorkflowStateConfig, type AgentWorkflowTransitionConfig, type AiSdkShapedStreamResult, type AiSdkShapedTextResult, type AllowedEventPattern, type AllowedEvents, type AssistantMessage, type CanReachResult, type ChosenEvent, type DataContent, type DecisionAttempt, DecisionExhaustedError, type DecisionLogic, type DecisionLogicConfig, EVENT_TOOL_PREFIX, type EventPayload, type EventUnion, type ExplorePathsOptions, type FilePart, type FromConfigOptions, IllegalResumeEventError, type ImagePart, type InferOutput, type InspectedActorRef, type LintAgentMachineOptions, type NormalizedEventSchemas, PLAN_DONE_EVENT_TYPE, type PendingUserInput, type ProviderOptions, type ResolveAgentRequestsOptions, type ResolveDecisionOptions, type RunAgentOptions, type RunAgentResult, type SchemaCompiler, type SimulateAgentOptions, type SimulateAgentResult, type SimulationScript, type SimulationTrailEntry, SnapshotVersionMismatchError, type StandardSchemaV1, type StructuredOutputEnvelope, type SystemMessage, type TextLogic, type TextLogicConfig, type TextLogicExecuteArgs, type TextLogicExecutor, type TextLogicInput, type TextLogicOutput, type TextPart, type ToolCallPart, type ToolMessage, type ToolResultOutput, type ToolResultPart, type UserMessage, appendMessages, assistantMessage, bindRequestExecutor, buildEnvelopeSchema, canReach, createAgentSchemas, createTextLogic, executeAgentRequest, explorePaths, getAcceptedEvents, getAgentMessages, getAgentOutputMode, getAgentRequests, getJsonSchema, getJsonSchemaSync, getMachineStructuralHash, getStateMeta, initialAgentStep, inspectTransitions, isStandardSchema, isStructuredOutputSchema, lintAgentMachine, matchesEventPattern, messagesSchema, parseAgentEvent, parseModelRef, parseOutput, parseStructuredEnvelope, persistSnapshot, renderDecisionAttempts, resolveAgentRequests, resolveAgentStep, resolveDecision, runAgent, runAgentToCompletion, setupAgent, simulateAgent, systemMessage, toolMessage, transitionAgentStep, userMessage, validateSchemaSync };
184
+ export { type AgentDecisionExecutor, type AgentDecisionInput, type AgentDecisionRequest, type AgentEventDescriptor, type AgentEventSchemaInput, type AgentEventSchemaInputMap, type AgentEventToolNameResolver, AgentIdleError, type AgentLintDiagnostic, type AgentLintSeverity, type AgentMachine, type AgentMachineConfig, type AgentMessage, type AgentMessageInfo, type AgentModelMap, type AgentModelRef, type AgentOutputMode, type AgentPathReport, type AgentPathTerminal, type AgentPlanInput, type AgentPlanOutput, type AgentPlanRequest, type AgentRequest, type AgentRequestConfig, type AgentRequestExecutor, type AgentRequestExecutorInfo, type AgentRequestExecutorResult, type AgentRequestExecutors, type AgentRequestMode, type AgentRequestOptions, type AgentRequestSource, type AgentRunMeta, type AgentSchemaPack, type AgentSetupStateSchema, type AgentSnapshotStore, type AgentStateNarrowing, type AgentStateRequest, type AgentStep, type AgentStepRequest, type AgentTextRequest, type AgentTool, type AgentToolChoice, type AgentToolDescriptor, type AgentToolExecute, type AgentToolSchema, type AgentTools, type AgentTraceEvent, type AgentUserInput, type AgentUserInputExecutor, type AgentWorkflowActionConfig, type AgentWorkflowActorConfig, type AgentWorkflowConfig, type AgentWorkflowInvokeConfig, type AgentWorkflowRequestConfig, type AgentWorkflowStateConfig, type AgentWorkflowTransitionConfig, type AiSdkShapedStreamResult, type AiSdkShapedTextResult, type AllowedEventPattern, type AllowedEvents, type AssistantMessage, type CanReachResult, type ChosenEvent, type DataContent, type DecisionAttempt, DecisionExhaustedError, type DecisionLogic, type DecisionLogicConfig, EVENT_TOOL_PREFIX, type EventPayload, type EventUnion, type ExplorePathsOptions, type FilePart, type FromConfigOptions, IllegalResumeEventError, type ImagePart, type InferOutput, type InspectedActorRef, type LintAgentMachineOptions, type NormalizedEventSchemas, PLAN_DONE_EVENT_TYPE, type PendingUserInput, type ProviderOptions, type ResolveAgentRequestsOptions, type ResolveDecisionOptions, type RunAgentOptions, type RunAgentResult, type SchemaCompiler, type SimulateAgentOptions, type SimulateAgentResult, type SimulationScript, type SimulationTrailEntry, SnapshotVersionMismatchError, type StandardSchemaV1, type StructuredOutputEnvelope, type SystemMessage, type TextLogic, type TextLogicConfig, type TextLogicExecuteArgs, type TextLogicExecutor, type TextLogicInput, type TextLogicOutput, type TextPart, type ToolCallPart, type ToolMessage, type ToolResultOutput, type ToolResultPart, type UserMessage, appendMessages, assistantMessage, bindRequestExecutor, buildEnvelopeSchema, canReach, createAgentSchemas, createTextLogic, executeAgentRequest, explorePaths, getAcceptedEvents, getAgentMessages, getAgentOutputMode, getAgentRequests, getJsonSchema, getJsonSchemaSync, getMachineStructuralHash, getStateMeta, initialAgentStep, inspectTransitions, isStandardSchema, isStructuredOutputSchema, lintAgentMachine, matchesEventPattern, messagesSchema, parseAgentEvent, parseModelRef, parseOutput, parseStructuredEnvelope, persistSnapshot, renderDecisionAttempts, resolveAgentRequests, resolveAgentStep, resolveDecision, runAgent, runAgentToCompletion, setupAgent, simulateAgent, systemMessage, toolMessage, transitionAgentStep, userMessage, validateSchemaSync };
package/dist/index.d.mts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { A as UserMessage, C as StandardSchemaV1, D as ToolMessage, E as ToolCallPart, O as ToolResultOutput, S as ProviderOptions, T as TextPart, _ as EventUnion, a as AgentTool, b as InferOutput, c as AgentToolExecute, d as AllowedEventPattern, f as AllowedEvents, g as EventPayload, h as DataContent, i as AgentSnapshotStore, k as ToolResultPart, l as AgentToolSchema, m as ChosenEvent, n as AgentEventSchemaInputMap, o as AgentToolChoice, p as AssistantMessage, r as AgentMessage, s as AgentToolDescriptor, t as AgentEventSchemaInput, u as AgentTools, v as FilePart, w as SystemMessage, x as NormalizedEventSchemas, y as ImagePart } from "./types-qm00QF91.mjs";
2
2
  import { A as AgentDecisionInput, B as renderDecisionAttempts, C as createTextLogic, D as parseOutput, E as parseModelRef, F as DecisionExhaustedError, G as AgentRequestSource, H as AgentEventDescriptor, I as DecisionLogic, J as matchesEventPattern, K as EVENT_TOOL_PREFIX, L as DecisionLogicConfig, M as AgentPlanInput, N as AgentPlanOutput, O as parseStructuredEnvelope, P as DecisionAttempt, R as PLAN_DONE_EVENT_TYPE, S as buildEnvelopeSchema, T as isStructuredOutputSchema, U as AgentEventToolNameResolver, V as resolveDecision, W as AgentRequestOptions, Y as parseAgentEvent, _ as TextLogicExecuteArgs, a as AgentRequestExecutorInfo, b as TextLogicOutput, c as AgentRequestMode, d as AiSdkShapedStreamResult, f as AiSdkShapedTextResult, g as TextLogicConfig, h as TextLogic, i as AgentRequestExecutor, j as AgentDecisionRequest, k as AgentDecisionExecutor, l as AgentTextRequest, m as StructuredOutputEnvelope, n as AgentModelRef, o as AgentRequestExecutorResult, q as getAcceptedEvents, r as AgentOutputMode, s as AgentRequestExecutors, t as AgentModelMap, u as AgentUserInput, v as TextLogicExecutor, w as getAgentOutputMode, x as bindRequestExecutor, y as TextLogicInput, z as ResolveDecisionOptions } from "./text-logic-C7WJpCIc.mjs";
3
- import { A as AgentStateNarrowing, B as FromConfigOptions, C as resolveAgentStep, D as AgentRequestConfig, E as AgentMachineConfig, F as AgentWorkflowConfig, H as appendMessages, I as AgentWorkflowInvokeConfig, L as AgentWorkflowRequestConfig, M as setupAgent, N as AgentWorkflowActionConfig, O as AgentSchemaPack, P as AgentWorkflowActorConfig, R as AgentWorkflowStateConfig, S as resolveAgentRequests, T as AgentMachine, U as messagesSchema, V as SchemaCompiler, _ as AgentStepRequest, a as InspectedActorRef, b as getAgentRequests, c as RunAgentResult, d as runAgent, f as runAgentToCompletion, g as AgentStep, h as AgentRequest, i as IllegalResumeEventError, j as createAgentSchemas, k as AgentSetupStateSchema, l as SnapshotVersionMismatchError, m as AgentPlanRequest, n as AgentTraceEvent, o as PendingUserInput, p as AgentStateRequest, r as AgentUserInputExecutor, s as RunAgentOptions, t as AgentIdleError, u as inspectTransitions, v as ResolveAgentRequestsOptions, w as transitionAgentStep, x as initialAgentStep, y as executeAgentRequest, z as AgentWorkflowTransitionConfig } from "./run-agent-XYjmBxHi.mjs";
3
+ import { A as AgentSchemaPack, B as AgentWorkflowStateConfig, C as initialAgentStep, D as AgentMachine, E as transitionAgentStep, F as AgentWorkflowActionConfig, G as messagesSchema, H as FromConfigOptions, I as AgentWorkflowActorConfig, L as AgentWorkflowConfig, M as AgentStateNarrowing, N as createAgentSchemas, O as AgentMachineConfig, P as setupAgent, R as AgentWorkflowInvokeConfig, S as getAgentRequests, T as resolveAgentStep, U as SchemaCompiler, V as AgentWorkflowTransitionConfig, W as appendMessages, _ as AgentRequest, a as AgentUserInputExecutor, b as ResolveAgentRequestsOptions, c as PendingUserInput, d as SnapshotVersionMismatchError, f as inspectTransitions, g as AgentPlanRequest, h as AgentStateRequest, i as AgentTraceEvent, j as AgentSetupStateSchema, k as AgentRequestConfig, l as RunAgentOptions, m as runAgentToCompletion, n as AgentMessageInfo, o as IllegalResumeEventError, p as runAgent, r as AgentRunMeta, s as InspectedActorRef, t as AgentIdleError, u as RunAgentResult, v as AgentStep, w as resolveAgentRequests, x as executeAgentRequest, y as AgentStepRequest, z as AgentWorkflowRequestConfig } from "./run-agent-DzYJb3CK.mjs";
4
4
  import { a as getMachineStructuralHash, c as persistSnapshot, d as userMessage, f as validateSchemaSync, i as getJsonSchemaSync, l as systemMessage, n as getAgentMessages, o as getStateMeta, r as getJsonSchema, s as isStandardSchema, t as assistantMessage, u as toolMessage } from "./utils-Y6GDRGGE.mjs";
5
5
  import { AnyMachineSnapshot, AnyStateMachine } from "xstate";
6
6
 
@@ -181,4 +181,4 @@ interface CanReachResult {
181
181
  */
182
182
  declare function canReach(machine: AnyStateMachine, statePath: string, options?: ExplorePathsOptions): Promise<CanReachResult>;
183
183
  //#endregion
184
- export { type AgentDecisionExecutor, type AgentDecisionInput, type AgentDecisionRequest, type AgentEventDescriptor, type AgentEventSchemaInput, type AgentEventSchemaInputMap, type AgentEventToolNameResolver, AgentIdleError, type AgentLintDiagnostic, type AgentLintSeverity, type AgentMachine, type AgentMachineConfig, type AgentMessage, type AgentModelMap, type AgentModelRef, type AgentOutputMode, type AgentPathReport, type AgentPathTerminal, type AgentPlanInput, type AgentPlanOutput, type AgentPlanRequest, type AgentRequest, type AgentRequestConfig, type AgentRequestExecutor, type AgentRequestExecutorInfo, type AgentRequestExecutorResult, type AgentRequestExecutors, type AgentRequestMode, type AgentRequestOptions, type AgentRequestSource, type AgentSchemaPack, type AgentSetupStateSchema, type AgentSnapshotStore, type AgentStateNarrowing, type AgentStateRequest, type AgentStep, type AgentStepRequest, type AgentTextRequest, type AgentTool, type AgentToolChoice, type AgentToolDescriptor, type AgentToolExecute, type AgentToolSchema, type AgentTools, type AgentTraceEvent, type AgentUserInput, type AgentUserInputExecutor, type AgentWorkflowActionConfig, type AgentWorkflowActorConfig, type AgentWorkflowConfig, type AgentWorkflowInvokeConfig, type AgentWorkflowRequestConfig, type AgentWorkflowStateConfig, type AgentWorkflowTransitionConfig, type AiSdkShapedStreamResult, type AiSdkShapedTextResult, type AllowedEventPattern, type AllowedEvents, type AssistantMessage, type CanReachResult, type ChosenEvent, type DataContent, type DecisionAttempt, DecisionExhaustedError, type DecisionLogic, type DecisionLogicConfig, EVENT_TOOL_PREFIX, type EventPayload, type EventUnion, type ExplorePathsOptions, type FilePart, type FromConfigOptions, IllegalResumeEventError, type ImagePart, type InferOutput, type InspectedActorRef, type LintAgentMachineOptions, type NormalizedEventSchemas, PLAN_DONE_EVENT_TYPE, type PendingUserInput, type ProviderOptions, type ResolveAgentRequestsOptions, type ResolveDecisionOptions, type RunAgentOptions, type RunAgentResult, type SchemaCompiler, type SimulateAgentOptions, type SimulateAgentResult, type SimulationScript, type SimulationTrailEntry, SnapshotVersionMismatchError, type StandardSchemaV1, type StructuredOutputEnvelope, type SystemMessage, type TextLogic, type TextLogicConfig, type TextLogicExecuteArgs, type TextLogicExecutor, type TextLogicInput, type TextLogicOutput, type TextPart, type ToolCallPart, type ToolMessage, type ToolResultOutput, type ToolResultPart, type UserMessage, appendMessages, assistantMessage, bindRequestExecutor, buildEnvelopeSchema, canReach, createAgentSchemas, createTextLogic, executeAgentRequest, explorePaths, getAcceptedEvents, getAgentMessages, getAgentOutputMode, getAgentRequests, getJsonSchema, getJsonSchemaSync, getMachineStructuralHash, getStateMeta, initialAgentStep, inspectTransitions, isStandardSchema, isStructuredOutputSchema, lintAgentMachine, matchesEventPattern, messagesSchema, parseAgentEvent, parseModelRef, parseOutput, parseStructuredEnvelope, persistSnapshot, renderDecisionAttempts, resolveAgentRequests, resolveAgentStep, resolveDecision, runAgent, runAgentToCompletion, setupAgent, simulateAgent, systemMessage, toolMessage, transitionAgentStep, userMessage, validateSchemaSync };
184
+ export { type AgentDecisionExecutor, type AgentDecisionInput, type AgentDecisionRequest, type AgentEventDescriptor, type AgentEventSchemaInput, type AgentEventSchemaInputMap, type AgentEventToolNameResolver, AgentIdleError, type AgentLintDiagnostic, type AgentLintSeverity, type AgentMachine, type AgentMachineConfig, type AgentMessage, type AgentMessageInfo, type AgentModelMap, type AgentModelRef, type AgentOutputMode, type AgentPathReport, type AgentPathTerminal, type AgentPlanInput, type AgentPlanOutput, type AgentPlanRequest, type AgentRequest, type AgentRequestConfig, type AgentRequestExecutor, type AgentRequestExecutorInfo, type AgentRequestExecutorResult, type AgentRequestExecutors, type AgentRequestMode, type AgentRequestOptions, type AgentRequestSource, type AgentRunMeta, type AgentSchemaPack, type AgentSetupStateSchema, type AgentSnapshotStore, type AgentStateNarrowing, type AgentStateRequest, type AgentStep, type AgentStepRequest, type AgentTextRequest, type AgentTool, type AgentToolChoice, type AgentToolDescriptor, type AgentToolExecute, type AgentToolSchema, type AgentTools, type AgentTraceEvent, type AgentUserInput, type AgentUserInputExecutor, type AgentWorkflowActionConfig, type AgentWorkflowActorConfig, type AgentWorkflowConfig, type AgentWorkflowInvokeConfig, type AgentWorkflowRequestConfig, type AgentWorkflowStateConfig, type AgentWorkflowTransitionConfig, type AiSdkShapedStreamResult, type AiSdkShapedTextResult, type AllowedEventPattern, type AllowedEvents, type AssistantMessage, type CanReachResult, type ChosenEvent, type DataContent, type DecisionAttempt, DecisionExhaustedError, type DecisionLogic, type DecisionLogicConfig, EVENT_TOOL_PREFIX, type EventPayload, type EventUnion, type ExplorePathsOptions, type FilePart, type FromConfigOptions, IllegalResumeEventError, type ImagePart, type InferOutput, type InspectedActorRef, type LintAgentMachineOptions, type NormalizedEventSchemas, PLAN_DONE_EVENT_TYPE, type PendingUserInput, type ProviderOptions, type ResolveAgentRequestsOptions, type ResolveDecisionOptions, type RunAgentOptions, type RunAgentResult, type SchemaCompiler, type SimulateAgentOptions, type SimulateAgentResult, type SimulationScript, type SimulationTrailEntry, SnapshotVersionMismatchError, type StandardSchemaV1, type StructuredOutputEnvelope, type SystemMessage, type TextLogic, type TextLogicConfig, type TextLogicExecuteArgs, type TextLogicExecutor, type TextLogicInput, type TextLogicOutput, type TextPart, type ToolCallPart, type ToolMessage, type ToolResultOutput, type ToolResultPart, type UserMessage, appendMessages, assistantMessage, bindRequestExecutor, buildEnvelopeSchema, canReach, createAgentSchemas, createTextLogic, executeAgentRequest, explorePaths, getAcceptedEvents, getAgentMessages, getAgentOutputMode, getAgentRequests, getJsonSchema, getJsonSchemaSync, getMachineStructuralHash, getStateMeta, initialAgentStep, inspectTransitions, isStandardSchema, isStructuredOutputSchema, lintAgentMachine, matchesEventPattern, messagesSchema, parseAgentEvent, parseModelRef, parseOutput, parseStructuredEnvelope, persistSnapshot, renderDecisionAttempts, resolveAgentRequests, resolveAgentStep, resolveDecision, runAgent, runAgentToCompletion, setupAgent, simulateAgent, systemMessage, toolMessage, transitionAgentStep, userMessage, validateSchemaSync };
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { a as runAgent, c as setupAgent, i as inspectTransitions, l as appendMessages, n as IllegalResumeEventError, o as runAgentToCompletion, r as SnapshotVersionMismatchError, s as createAgentSchemas, t as AgentIdleError, u as messagesSchema } from "./run-agent-7OaHM7SB.mjs";
1
+ import { a as runAgent, c as setupAgent, i as inspectTransitions, l as appendMessages, n as IllegalResumeEventError, o as runAgentToCompletion, r as SnapshotVersionMismatchError, s as createAgentSchemas, t as AgentIdleError, u as messagesSchema } from "./run-agent-BoAOq_0Z.mjs";
2
2
  import { $ as validateSchemaSync, A as parseOutput, C as createTextLogic, E as isStructuredOutputSchema, G as getJsonSchemaSync, J as isStandardSchema, K as getMachineStructuralHash, Q as userMessage, T as getAgentOutputMode, U as getAgentMessages, V as assistantMessage, W as getJsonSchema, X as systemMessage, Y as persistSnapshot, Z as toolMessage, b as bindRequestExecutor, d as EVENT_TOOL_PREFIX, f as getAcceptedEvents, j as parseStructuredEnvelope, k as parseModelRef, l as renderDecisionAttempts, m as parseAgentEvent, n as PLAN_DONE_EVENT_TYPE, p as matchesEventPattern, q as getStateMeta, t as DecisionExhaustedError, u as resolveDecision, x as buildEnvelopeSchema } from "./decision-CQdrKc8k.mjs";
3
- import { a as executeAgentRequest, c as resolveAgentRequests, i as simulateAgent, l as resolveAgentStep, n as explorePaths, o as getAgentRequests, r as lintAgentMachine, s as initialAgentStep, t as canReach, u as transitionAgentStep } from "./src-d-jhiOgP.mjs";
3
+ import { a as executeAgentRequest, c as resolveAgentRequests, i as simulateAgent, l as resolveAgentStep, n as explorePaths, o as getAgentRequests, r as lintAgentMachine, s as initialAgentStep, t as canReach, u as transitionAgentStep } from "./src-BOW6g5zE.mjs";
4
4
  export { AgentIdleError, DecisionExhaustedError, EVENT_TOOL_PREFIX, IllegalResumeEventError, PLAN_DONE_EVENT_TYPE, SnapshotVersionMismatchError, appendMessages, assistantMessage, bindRequestExecutor, buildEnvelopeSchema, canReach, createAgentSchemas, createTextLogic, executeAgentRequest, explorePaths, getAcceptedEvents, getAgentMessages, getAgentOutputMode, getAgentRequests, getJsonSchema, getJsonSchemaSync, getMachineStructuralHash, getStateMeta, initialAgentStep, inspectTransitions, isStandardSchema, isStructuredOutputSchema, lintAgentMachine, matchesEventPattern, messagesSchema, parseAgentEvent, parseModelRef, parseOutput, parseStructuredEnvelope, persistSnapshot, renderDecisionAttempts, resolveAgentRequests, resolveAgentStep, resolveDecision, runAgent, runAgentToCompletion, setupAgent, simulateAgent, systemMessage, toolMessage, transitionAgentStep, userMessage, validateSchemaSync };
@@ -1171,6 +1171,8 @@ async function runAgent(machine, options) {
1171
1171
  runId,
1172
1172
  seq: ++traceSeq,
1173
1173
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
1174
+ machineId,
1175
+ machineVersion,
1174
1176
  ...event
1175
1177
  });
1176
1178
  };
@@ -1321,7 +1323,14 @@ async function runAgent(machine, options) {
1321
1323
  let interpretSeq = 0;
1322
1324
  const appendToLog = (...items) => {
1323
1325
  messages.push(...items);
1324
- if (options.onMessage) for (const item of items) options.onMessage(item);
1326
+ if (options.onMessage) {
1327
+ const info = {
1328
+ runId,
1329
+ machineId,
1330
+ machineVersion
1331
+ };
1332
+ for (const item of items) options.onMessage(item, info);
1333
+ }
1325
1334
  };
1326
1335
  const runErrorCause = (error) => budgetExceeded ? "max-model-calls" : wrapsDecisionExhausted(error) ? "decision-exhausted" : "machine";
1327
1336
  const settleInterpretError = (error) => {
@@ -700,10 +700,35 @@ declare class AgentIdleError extends Error {
700
700
  interface AgentUserInputExecutor {
701
701
  (input: AgentUserInput): PromiseLike<string>;
702
702
  }
703
+ /**
704
+ * The run's machine identity, stamped onto every settled snapshot's `agentMeta`.
705
+ * `machineId` is the machine's `id`; `version` is
706
+ * {@link RunAgentOptions.machineVersion} or the
707
+ * {@link getMachineStructuralHash} of the machine. Trace events and the
708
+ * `onMessage` info arg carry the same identity flattened, as
709
+ * `machineId`/`machineVersion`.
710
+ */
711
+ interface AgentRunMeta {
712
+ machineId: string;
713
+ version: string;
714
+ }
715
+ /**
716
+ * Second argument passed to {@link RunAgentOptions.onMessage}: the run's
717
+ * identity, carried alongside each live message. Not stamped onto the message
718
+ * itself (messages stay clean model input).
719
+ */
720
+ interface AgentMessageInfo {
721
+ runId: string;
722
+ machineId: string;
723
+ /** {@link RunAgentOptions.machineVersion} or the machine's structural hash. */
724
+ machineVersion: string;
725
+ }
703
726
  type AgentTraceEvent<TMachine extends AnyStateMachine = AnyStateMachine> = {
704
727
  runId: string;
705
728
  seq: number;
706
729
  timestamp: string;
730
+ machineId: string; /** {@link RunAgentOptions.machineVersion} or the machine's structural hash. */
731
+ machineVersion: string;
707
732
  } & ({
708
733
  type: "run.start";
709
734
  input?: InputFrom<TMachine>;
@@ -919,7 +944,7 @@ interface RunAgentOptions<TMachine extends AnyStateMachine> {
919
944
  * {@link onTransition}. Never fires for the seeded history, and never fires
920
945
  * on a default invoke-driven run (nothing appends there).
921
946
  */
922
- onMessage?: (message: AgentMessage) => void;
947
+ onMessage?: (message: AgentMessage, info: AgentMessageInfo) => void;
923
948
  /**
924
949
  * Handlers for events the machine emits (`enq.emit(...)`), keyed by emitted
925
950
  * event type — `'*'` catches all. Typed from the machine's `emitted`
@@ -1075,4 +1100,4 @@ type InspectedActorRef = AnyActorRef & {
1075
1100
  */
1076
1101
  declare function inspectTransitions(handler: (snapshot: AnyMachineSnapshot, actorRef: InspectedActorRef) => void): (inspectionEvent: InspectionEvent) => void;
1077
1102
  //#endregion
1078
- export { AgentStateNarrowing as A, FromConfigOptions as B, resolveAgentStep as C, AgentRequestConfig as D, AgentMachineConfig as E, AgentWorkflowConfig as F, appendMessages as H, AgentWorkflowInvokeConfig as I, AgentWorkflowRequestConfig as L, setupAgent as M, AgentWorkflowActionConfig as N, AgentSchemaPack as O, AgentWorkflowActorConfig as P, AgentWorkflowStateConfig as R, resolveAgentRequests as S, AgentMachine as T, messagesSchema as U, SchemaCompiler as V, AgentStepRequest as _, InspectedActorRef as a, getAgentRequests as b, RunAgentResult as c, runAgent as d, runAgentToCompletion as f, AgentStep as g, AgentRequest as h, IllegalResumeEventError as i, createAgentSchemas as j, AgentSetupStateSchema as k, SnapshotVersionMismatchError as l, AgentPlanRequest as m, AgentTraceEvent as n, PendingUserInput as o, AgentStateRequest as p, AgentUserInputExecutor as r, RunAgentOptions as s, AgentIdleError as t, inspectTransitions as u, ResolveAgentRequestsOptions as v, transitionAgentStep as w, initialAgentStep as x, executeAgentRequest as y, AgentWorkflowTransitionConfig as z };
1103
+ export { AgentSchemaPack as A, AgentWorkflowStateConfig as B, initialAgentStep as C, AgentMachine as D, transitionAgentStep as E, AgentWorkflowActionConfig as F, messagesSchema as G, FromConfigOptions as H, AgentWorkflowActorConfig as I, AgentWorkflowConfig as L, AgentStateNarrowing as M, createAgentSchemas as N, AgentMachineConfig as O, setupAgent as P, AgentWorkflowInvokeConfig as R, getAgentRequests as S, resolveAgentStep as T, SchemaCompiler as U, AgentWorkflowTransitionConfig as V, appendMessages as W, AgentRequest as _, AgentUserInputExecutor as a, ResolveAgentRequestsOptions as b, PendingUserInput as c, SnapshotVersionMismatchError as d, inspectTransitions as f, AgentPlanRequest as g, AgentStateRequest as h, AgentTraceEvent as i, AgentSetupStateSchema as j, AgentRequestConfig as k, RunAgentOptions as l, runAgentToCompletion as m, AgentMessageInfo as n, IllegalResumeEventError as o, runAgent as p, AgentRunMeta as r, InspectedActorRef as s, AgentIdleError as t, RunAgentResult as u, AgentStep as v, resolveAgentRequests as w, executeAgentRequest as x, AgentStepRequest as y, AgentWorkflowRequestConfig as z };
@@ -1171,6 +1171,8 @@ async function runAgent(machine, options) {
1171
1171
  runId,
1172
1172
  seq: ++traceSeq,
1173
1173
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
1174
+ machineId,
1175
+ machineVersion,
1174
1176
  ...event
1175
1177
  });
1176
1178
  };
@@ -1321,7 +1323,14 @@ async function runAgent(machine, options) {
1321
1323
  let interpretSeq = 0;
1322
1324
  const appendToLog = (...items) => {
1323
1325
  messages.push(...items);
1324
- if (options.onMessage) for (const item of items) options.onMessage(item);
1326
+ if (options.onMessage) {
1327
+ const info = {
1328
+ runId,
1329
+ machineId,
1330
+ machineVersion
1331
+ };
1332
+ for (const item of items) options.onMessage(item, info);
1333
+ }
1325
1334
  };
1326
1335
  const runErrorCause = (error) => budgetExceeded ? "max-model-calls" : wrapsDecisionExhausted(error) ? "decision-exhausted" : "machine";
1327
1336
  const settleInterpretError = (error) => {
@@ -700,10 +700,35 @@ declare class AgentIdleError extends Error {
700
700
  interface AgentUserInputExecutor {
701
701
  (input: AgentUserInput): PromiseLike<string>;
702
702
  }
703
+ /**
704
+ * The run's machine identity, stamped onto every settled snapshot's `agentMeta`.
705
+ * `machineId` is the machine's `id`; `version` is
706
+ * {@link RunAgentOptions.machineVersion} or the
707
+ * {@link getMachineStructuralHash} of the machine. Trace events and the
708
+ * `onMessage` info arg carry the same identity flattened, as
709
+ * `machineId`/`machineVersion`.
710
+ */
711
+ interface AgentRunMeta {
712
+ machineId: string;
713
+ version: string;
714
+ }
715
+ /**
716
+ * Second argument passed to {@link RunAgentOptions.onMessage}: the run's
717
+ * identity, carried alongside each live message. Not stamped onto the message
718
+ * itself (messages stay clean model input).
719
+ */
720
+ interface AgentMessageInfo {
721
+ runId: string;
722
+ machineId: string;
723
+ /** {@link RunAgentOptions.machineVersion} or the machine's structural hash. */
724
+ machineVersion: string;
725
+ }
703
726
  type AgentTraceEvent<TMachine extends AnyStateMachine = AnyStateMachine> = {
704
727
  runId: string;
705
728
  seq: number;
706
729
  timestamp: string;
730
+ machineId: string; /** {@link RunAgentOptions.machineVersion} or the machine's structural hash. */
731
+ machineVersion: string;
707
732
  } & ({
708
733
  type: "run.start";
709
734
  input?: InputFrom<TMachine>;
@@ -919,7 +944,7 @@ interface RunAgentOptions<TMachine extends AnyStateMachine> {
919
944
  * {@link onTransition}. Never fires for the seeded history, and never fires
920
945
  * on a default invoke-driven run (nothing appends there).
921
946
  */
922
- onMessage?: (message: AgentMessage) => void;
947
+ onMessage?: (message: AgentMessage, info: AgentMessageInfo) => void;
923
948
  /**
924
949
  * Handlers for events the machine emits (`enq.emit(...)`), keyed by emitted
925
950
  * event type — `'*'` catches all. Typed from the machine's `emitted`
@@ -1075,4 +1100,4 @@ type InspectedActorRef = AnyActorRef & {
1075
1100
  */
1076
1101
  declare function inspectTransitions(handler: (snapshot: AnyMachineSnapshot, actorRef: InspectedActorRef) => void): (inspectionEvent: InspectionEvent) => void;
1077
1102
  //#endregion
1078
- export { AgentStateNarrowing as A, FromConfigOptions as B, resolveAgentStep as C, AgentRequestConfig as D, AgentMachineConfig as E, AgentWorkflowConfig as F, appendMessages as H, AgentWorkflowInvokeConfig as I, AgentWorkflowRequestConfig as L, setupAgent as M, AgentWorkflowActionConfig as N, AgentSchemaPack as O, AgentWorkflowActorConfig as P, AgentWorkflowStateConfig as R, resolveAgentRequests as S, AgentMachine as T, messagesSchema as U, SchemaCompiler as V, AgentStepRequest as _, InspectedActorRef as a, getAgentRequests as b, RunAgentResult as c, runAgent as d, runAgentToCompletion as f, AgentStep as g, AgentRequest as h, IllegalResumeEventError as i, createAgentSchemas as j, AgentSetupStateSchema as k, SnapshotVersionMismatchError as l, AgentPlanRequest as m, AgentTraceEvent as n, PendingUserInput as o, AgentStateRequest as p, AgentUserInputExecutor as r, RunAgentOptions as s, AgentIdleError as t, inspectTransitions as u, ResolveAgentRequestsOptions as v, transitionAgentStep as w, initialAgentStep as x, executeAgentRequest as y, AgentWorkflowTransitionConfig as z };
1103
+ export { AgentSchemaPack as A, AgentWorkflowStateConfig as B, initialAgentStep as C, AgentMachine as D, transitionAgentStep as E, AgentWorkflowActionConfig as F, messagesSchema as G, FromConfigOptions as H, AgentWorkflowActorConfig as I, AgentWorkflowConfig as L, AgentStateNarrowing as M, createAgentSchemas as N, AgentMachineConfig as O, setupAgent as P, AgentWorkflowInvokeConfig as R, getAgentRequests as S, resolveAgentStep as T, SchemaCompiler as U, AgentWorkflowTransitionConfig as V, appendMessages as W, AgentRequest as _, AgentUserInputExecutor as a, ResolveAgentRequestsOptions as b, PendingUserInput as c, SnapshotVersionMismatchError as d, inspectTransitions as f, AgentPlanRequest as g, AgentStateRequest as h, AgentTraceEvent as i, AgentSetupStateSchema as j, AgentRequestConfig as k, RunAgentOptions as l, runAgentToCompletion as m, AgentMessageInfo as n, IllegalResumeEventError as o, runAgent as p, AgentRunMeta as r, InspectedActorRef as s, AgentIdleError as t, RunAgentResult as u, AgentStep as v, resolveAgentRequests as w, executeAgentRequest as x, AgentStepRequest as y, AgentWorkflowRequestConfig as z };
@@ -1,4 +1,4 @@
1
- import "./run-agent-7OaHM7SB.mjs";
1
+ import "./run-agent-BoAOq_0Z.mjs";
2
2
  import { $ as validateSchemaSync, D as isTextLogic, G as getJsonSchemaSync, I as getRegisteredAgentExecutionOptions, P as executorBoundLogics, c as isPlanLogic, f as getAcceptedEvents, h as sanitizeEventToolName, n as PLAN_DONE_EVENT_TYPE, r as advancePlanLedger, s as isDecisionLogic, u as resolveDecision, w as executeAgentTextRequest } from "./decision-CQdrKc8k.mjs";
3
3
  import { initialTransition, transition } from "xstate";
4
4
  //#region src/steps.ts
@@ -1,4 +1,4 @@
1
- require("./run-agent-BQ3vV7UI.cjs");
1
+ require("./run-agent-BFMkuI1F.cjs");
2
2
  const require_decision = require("./decision-b-lkcs4L.cjs");
3
3
  let xstate = require("xstate");
4
4
  //#region src/steps.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@statelyai/agent",
3
- "version": "2.0.0-alpha.8",
3
+ "version": "2.0.0-alpha.9",
4
4
  "description": "State-machine authoring layer for AI agents",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs",