@statelyai/agent 2.0.0-alpha.13 → 2.0.0-alpha.15

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.
Files changed (31) hide show
  1. package/dist/ai-sdk.cjs +1 -1
  2. package/dist/ai-sdk.d.cts +2 -2
  3. package/dist/ai-sdk.d.mts +2 -2
  4. package/dist/ai-sdk.mjs +1 -1
  5. package/dist/{decision-dWGhBh0P.cjs → decision-C0cUKvNt.cjs} +0 -105
  6. package/dist/{decision-BezSD_YC.mjs → decision-D9Zi7Xi5.mjs} +2 -65
  7. package/dist/index.cjs +52 -155
  8. package/dist/index.d.cts +26 -13
  9. package/dist/index.d.mts +26 -13
  10. package/dist/index.mjs +54 -156
  11. package/dist/machines.cjs +1 -1
  12. package/dist/machines.d.cts +1 -1
  13. package/dist/machines.d.mts +1 -1
  14. package/dist/machines.mjs +1 -1
  15. package/dist/otel.cjs +5 -15
  16. package/dist/otel.d.cts +1 -1
  17. package/dist/otel.d.mts +1 -1
  18. package/dist/otel.mjs +5 -15
  19. package/dist/{run-agent-C3mFDGTf.d.mts → run-agent-BWzo4FLv.d.mts} +83 -109
  20. package/dist/{run-agent-DnvtcnTZ.d.cts → run-agent-B_n4Qxye.d.cts} +83 -109
  21. package/dist/{setup-agent-DP95MFrI.cjs → setup-agent-CpK0ZRWV.cjs} +10 -210
  22. package/dist/{setup-agent-DAZZSjDS.mjs → setup-agent-DeHRW-qX.mjs} +11 -205
  23. package/dist/sqlite.d.cts +2 -2
  24. package/dist/sqlite.d.mts +2 -2
  25. package/dist/{text-logic-TkKPw8Aq.d.mts → text-logic-C7anC7qX.d.mts} +8 -94
  26. package/dist/{text-logic-BDxwQNsD.d.cts → text-logic-DZW7XWy9.d.cts} +8 -94
  27. package/dist/{types-QbEfCVny.d.cts → types-CTBhMnFu.d.mts} +30 -3
  28. package/dist/{types-_FXoFBGO.d.mts → types-DFD28AWe.d.cts} +30 -3
  29. package/package.json +1 -1
  30. /package/dist/{event-log-store-CriMgX1D.d.mts → event-log-store-BkUNtyOF.d.mts} +0 -0
  31. /package/dist/{event-log-store-Ruq18mGp.d.cts → event-log-store-CVd2eyRy.d.cts} +0 -0
package/dist/ai-sdk.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_decision = require("./decision-dWGhBh0P.cjs");
2
+ const require_decision = require("./decision-C0cUKvNt.cjs");
3
3
  let ai = require("ai");
4
4
  //#region src/ai-sdk/mappers.ts
5
5
  /**
package/dist/ai-sdk.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import { d as ChosenEvent } from "./types-QbEfCVny.cjs";
2
- import { k as AgentDecisionExecutor, l as AgentRequestExecutors, o as AgentRequestExecutor } from "./text-logic-BDxwQNsD.cjs";
1
+ import { d as ChosenEvent } from "./types-DFD28AWe.cjs";
2
+ import { k as AgentDecisionExecutor, l as AgentRequestExecutors, o as AgentRequestExecutor } from "./text-logic-DZW7XWy9.cjs";
3
3
  import { FinishReason, LanguageModel, LanguageModelUsage, ToolSet, TypedToolCall, TypedToolResult } from "ai";
4
4
 
5
5
  //#region src/ai-sdk/index.d.ts
package/dist/ai-sdk.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import { d as ChosenEvent } from "./types-_FXoFBGO.mjs";
2
- import { k as AgentDecisionExecutor, l as AgentRequestExecutors, o as AgentRequestExecutor } from "./text-logic-TkKPw8Aq.mjs";
1
+ import { d as ChosenEvent } from "./types-CTBhMnFu.mjs";
2
+ import { k as AgentDecisionExecutor, l as AgentRequestExecutors, o as AgentRequestExecutor } from "./text-logic-C7anC7qX.mjs";
3
3
  import { FinishReason, LanguageModel, LanguageModelUsage, ToolSet, TypedToolCall, TypedToolResult } from "ai";
4
4
 
5
5
  //#region src/ai-sdk/index.d.ts
package/dist/ai-sdk.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { J as isStandardSchema, T as getAgentOutputMode, b as buildEnvelopeSchema, l as renderDecisionAttempts } from "./decision-BezSD_YC.mjs";
1
+ import { V as isStandardSchema, i as renderDecisionAttempts, p as buildEnvelopeSchema, v as getAgentOutputMode } from "./decision-D9Zi7Xi5.mjs";
2
2
  import { NoObjectGeneratedError, Output, generateText, stepCountIs, streamText, tool } from "ai";
3
3
  //#region src/ai-sdk/mappers.ts
4
4
  /**
@@ -281,7 +281,6 @@ const USER_INPUT_ACTOR = "agent.userInput";
281
281
  const GENERATE_TEXT_ACTOR = "agent.generateText";
282
282
  const STREAM_TEXT_ACTOR = "agent.streamText";
283
283
  const DECIDE_ACTOR = "agent.decide";
284
- const PLAN_ACTOR = "agent.plan";
285
284
  /** Synthetic `src` stamped on trace requests produced by `getRequests` state interpretation — NOT a registered actor source (nothing is invoked; the pass makes the call directly). */
286
285
  const INTERPRET_SOURCE = "agent.interpret";
287
286
  /**
@@ -882,68 +881,6 @@ function decideActorWithExecutor(execute) {
882
881
  function createDecideActor() {
883
882
  return decideActorWithExecutor();
884
883
  }
885
- /**
886
- * Reserved event type the `agent.plan` builtin adds to every step's
887
- * candidates as the explicit "no further action needed" move. Choosing it
888
- * ends the plan (`stopped: 'done'`); it is never sent to the machine, so
889
- * machines need no no-op sentinel event of their own.
890
- */
891
- const PLAN_DONE_EVENT_TYPE = "agent.plan.done";
892
- function createPlanActor() {
893
- const logic = (0, xstate.createLogic)({
894
- context: ({ input }) => ({
895
- applied: [],
896
- stepsRemaining: input.maxSteps ?? 8,
897
- stopped: null
898
- }),
899
- run: ({ context, event }) => event.type === "plan.applied" ? { context: {
900
- ...context,
901
- applied: [...context.applied, event.event],
902
- stepsRemaining: context.stepsRemaining - 1
903
- } } : event.type === "plan.ended" ? {
904
- context: {
905
- ...context,
906
- stopped: event.stopped
907
- },
908
- status: "done",
909
- output: {
910
- steps: context.applied,
911
- stopped: event.stopped
912
- }
913
- } : void 0
914
- });
915
- return Object.assign(logic, {
916
- kind: "statelyai.planLogic",
917
- maxRetries: 2,
918
- request: decideRequestFromInput,
919
- allowedEventTypes: (input) => resolveAllowedEventTypes(input.allowedEvents, input)
920
- });
921
- }
922
- const PLAN_LEDGER_SCOPE = {
923
- emit: () => {},
924
- self: { id: "agent.plan.ledger" }
925
- };
926
- /**
927
- * Builds a fresh plan ledger snapshot from resolved plan input — the shared
928
- * starting point for BOTH hosts (the step path reads the invoke child's own
929
- * initial snapshot; runAgent seeds a local ledger with this). @internal
930
- */
931
- function initialPlanLedger(logic, input) {
932
- return logic.getInitialSnapshot(PLAN_LEDGER_SCOPE, input);
933
- }
934
- /**
935
- * Advances a plan ledger by one {@link PlanLedgerEvent}, returning the next
936
- * snapshot (unwrapping `createLogic`'s `[snapshot, effects]` tuple). Pure — no
937
- * mutation of the input snapshot. @internal
938
- */
939
- function advancePlanLedger(logic, snapshot, event) {
940
- const result = logic.transition(snapshot, event, PLAN_LEDGER_SCOPE);
941
- return Array.isArray(result) ? result[0] : result;
942
- }
943
- /** Type guard: true for the `agent.plan` builtin logic (checks the `kind` marker). @internal */
944
- function isPlanLogic(logic) {
945
- return !!logic && logic.kind === "statelyai.planLogic";
946
- }
947
884
  function resolveAllowedEventTypes(allowedEvents, input) {
948
885
  if (allowedEvents === void 0) return;
949
886
  const resolved = typeof allowedEvents === "function" ? allowedEvents({ input }) : allowedEvents;
@@ -1087,30 +1024,12 @@ Object.defineProperty(exports, "INTERPRET_SOURCE", {
1087
1024
  return INTERPRET_SOURCE;
1088
1025
  }
1089
1026
  });
1090
- Object.defineProperty(exports, "PLAN_ACTOR", {
1091
- enumerable: true,
1092
- get: function() {
1093
- return PLAN_ACTOR;
1094
- }
1095
- });
1096
- Object.defineProperty(exports, "PLAN_DONE_EVENT_TYPE", {
1097
- enumerable: true,
1098
- get: function() {
1099
- return PLAN_DONE_EVENT_TYPE;
1100
- }
1101
- });
1102
1027
  Object.defineProperty(exports, "USER_INPUT_ACTOR", {
1103
1028
  enumerable: true,
1104
1029
  get: function() {
1105
1030
  return USER_INPUT_ACTOR;
1106
1031
  }
1107
1032
  });
1108
- Object.defineProperty(exports, "advancePlanLedger", {
1109
- enumerable: true,
1110
- get: function() {
1111
- return advancePlanLedger;
1112
- }
1113
- });
1114
1033
  Object.defineProperty(exports, "agentExecutionOptions", {
1115
1034
  enumerable: true,
1116
1035
  get: function() {
@@ -1147,12 +1066,6 @@ Object.defineProperty(exports, "createDecideActor", {
1147
1066
  return createDecideActor;
1148
1067
  }
1149
1068
  });
1150
- Object.defineProperty(exports, "createPlanActor", {
1151
- enumerable: true,
1152
- get: function() {
1153
- return createPlanActor;
1154
- }
1155
- });
1156
1069
  Object.defineProperty(exports, "createTextLogic", {
1157
1070
  enumerable: true,
1158
1071
  get: function() {
@@ -1243,24 +1156,12 @@ Object.defineProperty(exports, "getStateMeta", {
1243
1156
  return getStateMeta;
1244
1157
  }
1245
1158
  });
1246
- Object.defineProperty(exports, "initialPlanLedger", {
1247
- enumerable: true,
1248
- get: function() {
1249
- return initialPlanLedger;
1250
- }
1251
- });
1252
1159
  Object.defineProperty(exports, "isDecisionLogic", {
1253
1160
  enumerable: true,
1254
1161
  get: function() {
1255
1162
  return isDecisionLogic;
1256
1163
  }
1257
1164
  });
1258
- Object.defineProperty(exports, "isPlanLogic", {
1259
- enumerable: true,
1260
- get: function() {
1261
- return isPlanLogic;
1262
- }
1263
- });
1264
1165
  Object.defineProperty(exports, "isStandardSchema", {
1265
1166
  enumerable: true,
1266
1167
  get: function() {
@@ -1345,12 +1246,6 @@ Object.defineProperty(exports, "resolveDecision", {
1345
1246
  return resolveDecision;
1346
1247
  }
1347
1248
  });
1348
- Object.defineProperty(exports, "sanitizeEventToolName", {
1349
- enumerable: true,
1350
- get: function() {
1351
- return sanitizeEventToolName;
1352
- }
1353
- });
1354
1249
  Object.defineProperty(exports, "systemMessage", {
1355
1250
  enumerable: true,
1356
1251
  get: function() {
@@ -1,5 +1,5 @@
1
1
  import { t as AgentError } from "./errors-CeSXQx0v.mjs";
2
- import { createAsyncLogic, createLogic, getNextTransitions } from "xstate";
2
+ import { createAsyncLogic, getNextTransitions } from "xstate";
3
3
  //#region src/utils.ts
4
4
  /**
5
5
  * Deep-clones a snapshot to a plain-JSON value via a `JSON` round-trip, the
@@ -281,7 +281,6 @@ const USER_INPUT_ACTOR = "agent.userInput";
281
281
  const GENERATE_TEXT_ACTOR = "agent.generateText";
282
282
  const STREAM_TEXT_ACTOR = "agent.streamText";
283
283
  const DECIDE_ACTOR = "agent.decide";
284
- const PLAN_ACTOR = "agent.plan";
285
284
  /** Synthetic `src` stamped on trace requests produced by `getRequests` state interpretation — NOT a registered actor source (nothing is invoked; the pass makes the call directly). */
286
285
  const INTERPRET_SOURCE = "agent.interpret";
287
286
  /**
@@ -882,68 +881,6 @@ function decideActorWithExecutor(execute) {
882
881
  function createDecideActor() {
883
882
  return decideActorWithExecutor();
884
883
  }
885
- /**
886
- * Reserved event type the `agent.plan` builtin adds to every step's
887
- * candidates as the explicit "no further action needed" move. Choosing it
888
- * ends the plan (`stopped: 'done'`); it is never sent to the machine, so
889
- * machines need no no-op sentinel event of their own.
890
- */
891
- const PLAN_DONE_EVENT_TYPE = "agent.plan.done";
892
- function createPlanActor() {
893
- const logic = createLogic({
894
- context: ({ input }) => ({
895
- applied: [],
896
- stepsRemaining: input.maxSteps ?? 8,
897
- stopped: null
898
- }),
899
- run: ({ context, event }) => event.type === "plan.applied" ? { context: {
900
- ...context,
901
- applied: [...context.applied, event.event],
902
- stepsRemaining: context.stepsRemaining - 1
903
- } } : event.type === "plan.ended" ? {
904
- context: {
905
- ...context,
906
- stopped: event.stopped
907
- },
908
- status: "done",
909
- output: {
910
- steps: context.applied,
911
- stopped: event.stopped
912
- }
913
- } : void 0
914
- });
915
- return Object.assign(logic, {
916
- kind: "statelyai.planLogic",
917
- maxRetries: 2,
918
- request: decideRequestFromInput,
919
- allowedEventTypes: (input) => resolveAllowedEventTypes(input.allowedEvents, input)
920
- });
921
- }
922
- const PLAN_LEDGER_SCOPE = {
923
- emit: () => {},
924
- self: { id: "agent.plan.ledger" }
925
- };
926
- /**
927
- * Builds a fresh plan ledger snapshot from resolved plan input — the shared
928
- * starting point for BOTH hosts (the step path reads the invoke child's own
929
- * initial snapshot; runAgent seeds a local ledger with this). @internal
930
- */
931
- function initialPlanLedger(logic, input) {
932
- return logic.getInitialSnapshot(PLAN_LEDGER_SCOPE, input);
933
- }
934
- /**
935
- * Advances a plan ledger by one {@link PlanLedgerEvent}, returning the next
936
- * snapshot (unwrapping `createLogic`'s `[snapshot, effects]` tuple). Pure — no
937
- * mutation of the input snapshot. @internal
938
- */
939
- function advancePlanLedger(logic, snapshot, event) {
940
- const result = logic.transition(snapshot, event, PLAN_LEDGER_SCOPE);
941
- return Array.isArray(result) ? result[0] : result;
942
- }
943
- /** Type guard: true for the `agent.plan` builtin logic (checks the `kind` marker). @internal */
944
- function isPlanLogic(logic) {
945
- return !!logic && logic.kind === "statelyai.planLogic";
946
- }
947
884
  function resolveAllowedEventTypes(allowedEvents, input) {
948
885
  if (allowedEvents === void 0) return;
949
886
  const resolved = typeof allowedEvents === "function" ? allowedEvents({ input }) : allowedEvents;
@@ -1063,4 +1000,4 @@ async function resolveDecision(request, executor, options = {}) {
1063
1000
  throw new AgentDecisionExhaustedError(attempts);
1064
1001
  }
1065
1002
  //#endregion
1066
- export { validateSchemaSync as $, parseStructuredEnvelope as A, missingActor as B, executeAgentTextRequest as C, normalizeGeneratorResult as D, isTextLogic as E, getMachineSuspensionPredicate as F, getJsonSchemaSync as G, findNonSerializableContextPaths as H, getRegisteredAgentExecutionOptions as I, isStandardSchema as J, getMachineStructuralHash as K, isUnboundPlaceholder as L, agentExecutionOptions as M, executorBoundLogics as N, parseModelRef as O, getMachineStaticTransitionTargets as P, userMessage as Q, machineStaticTransitionTargets as R, createTextLogic as S, getAgentOutputMode as T, getAgentMessages as U, assistantMessage as V, getJsonSchema as W, systemMessage as X, persistSnapshot as Y, toolMessage as Z, PLAN_ACTOR as _, createPlanActor as a, buildEnvelopeSchema as b, isPlanLogic as c, getAcceptedEvents as d, parseAgentEvent as f, INTERPRET_SOURCE as g, DECIDE_ACTOR as h, createDecideActor as i, userInputActor as j, parseOutput as k, renderDecisionAttempts as l, AGENT_USAGE_TOKEN_FIELDS as m, PLAN_DONE_EVENT_TYPE as n, initialPlanLedger as o, sanitizeEventToolName as p, getStateMeta as q, advancePlanLedger as r, isDecisionLogic as s, AgentDecisionExhaustedError as t, resolveDecision as u, USER_INPUT_ACTOR as v, extractCallUsage as w, builtinTextActors as x, bindRequestExecutor as y, machineSuspensionPredicates as z };
1003
+ export { isUnboundPlaceholder as A, getStateMeta as B, parseStructuredEnvelope as C, getMachineStaticTransitionTargets as D, executorBoundLogics as E, findNonSerializableContextPaths as F, userMessage as G, persistSnapshot as H, getAgentMessages as I, validateSchemaSync as K, getJsonSchema as L, machineSuspensionPredicates as M, missingActor as N, getMachineSuspensionPredicate as O, assistantMessage as P, getJsonSchemaSync as R, parseOutput as S, agentExecutionOptions as T, systemMessage as U, isStandardSchema as V, toolMessage as W, extractCallUsage as _, resolveDecision as a, normalizeGeneratorResult as b, AGENT_USAGE_TOKEN_FIELDS as c, USER_INPUT_ACTOR as d, bindRequestExecutor as f, executeAgentTextRequest as g, createTextLogic as h, renderDecisionAttempts as i, machineStaticTransitionTargets as j, getRegisteredAgentExecutionOptions as k, DECIDE_ACTOR as l, builtinTextActors as m, createDecideActor as n, getAcceptedEvents as o, buildEnvelopeSchema as p, isDecisionLogic as r, parseAgentEvent as s, AgentDecisionExhaustedError as t, INTERPRET_SOURCE as u, getAgentOutputMode as v, userInputActor as w, parseModelRef as x, isTextLogic as y, getMachineStructuralHash as z };