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

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.
@@ -1,4 +1,4 @@
1
- const require_decision = require("./decision-BnATHy0W.cjs");
1
+ const require_decision = require("./decision-b-lkcs4L.cjs");
2
2
  let xstate = require("xstate");
3
3
  //#region src/messages.ts
4
4
  function addMessages(resolve) {
@@ -260,6 +260,16 @@ function setupAgentFromConfig(config, options) {
260
260
  }
261
261
  //#endregion
262
262
  //#region src/setup-agent.ts
263
+ const emptyEventSchema = { "~standard": {
264
+ version: 1,
265
+ vendor: "statelyai-agent",
266
+ validate(value) {
267
+ return value !== null && typeof value === "object" && Object.keys(value).length === 0 ? { value: {} } : { issues: [{ message: "Expected an empty event payload" }] };
268
+ }
269
+ } };
270
+ function normalizeEventSchemas(events) {
271
+ return Object.fromEntries(Object.entries(events).map(([type, schema]) => [type, schema && typeof schema === "object" && "~standard" in schema ? schema : emptyEventSchema]));
272
+ }
263
273
  /**
264
274
  * Builds a machine's {@link AgentSchemaPack} from a partial schema
265
275
  * declaration — only `context` is required; `events`/`input`/`output`/`meta`
@@ -271,7 +281,7 @@ function setupAgentFromConfig(config, options) {
271
281
  function createAgentSchemas(schemas) {
272
282
  return {
273
283
  context: schemas.context,
274
- events: schemas.events ?? {},
284
+ events: normalizeEventSchemas(schemas.events ?? {}),
275
285
  input: schemas.input,
276
286
  output: schemas.output,
277
287
  meta: schemas.meta,
@@ -395,7 +405,12 @@ function createRequestActors(requests) {
395
405
  }));
396
406
  }
397
407
  function normalizeAgentSchemas(config) {
398
- return "schemas" in config ? config.schemas : createAgentSchemas(config);
408
+ if ("schemas" in config && config.schemas) return config.schemas;
409
+ const loose = config;
410
+ return createAgentSchemas({
411
+ ...loose,
412
+ context: loose.context
413
+ });
399
414
  }
400
415
  function normalizeAgentRequestInput(requests) {
401
416
  return requests ?? {};
@@ -468,11 +483,12 @@ function createSetupAgent(config) {
468
483
  const actorSources = createAgentActorSources(config.actorSources, requestActors);
469
484
  const base = (0, xstate.setup)(createAgentSetupConfig(schemas, actorSources, config));
470
485
  const createBaseMachine = base.createMachine.bind(base);
486
+ const models = config.models ?? {};
471
487
  const machineOptions = {
472
488
  schemas,
473
- actorSources
489
+ actorSources,
490
+ models
474
491
  };
475
- const models = config.models ?? {};
476
492
  return Object.assign(base, {
477
493
  createMachine(machineConfig) {
478
494
  const machine = createBaseMachine(withRootOutputFromSingleFinal(machineConfig));
@@ -492,381 +508,6 @@ function createSetupAgent(config) {
492
508
  });
493
509
  }
494
510
  //#endregion
495
- //#region src/steps.ts
496
- /**
497
- * The step path: durable, per-model-call-checkpoint hosting of an agent
498
- * machine. Public vocabulary — `initialAgentStep`, `transitionAgentStep`,
499
- * `resolveAgentStep`, `getAgentRequests`, `executeAgentRequest`,
500
- * `resolveAgentRequests`.
501
- * @module
502
- */
503
- /** @internal Normalizes current and legacy XState invoke effect shapes. */
504
- function getInvokeEffectMetadata(action) {
505
- if (action.type === "@xstate.spawn") return action;
506
- if (action.type === "xstate.spawnChild") {
507
- const params = action.params;
508
- return params ? {
509
- ...params,
510
- logic: action.logic
511
- } : void 0;
512
- }
513
- if (action.type === "@xstate.start" && typeof action.src === "string") return action;
514
- }
515
- /**
516
- * Scans a set of executable actions (as returned by xstate's `transition`/
517
- * `initialTransition`) for spawned `TextLogic`/`DecisionLogic` invokes and
518
- * lowers each into an {@link AgentStepRequest}. The hand-passed-schemas
519
- * implementation detail behind the public {@link getAgentRequests} — it needs
520
- * `schemas`/`actorSources` passed explicitly, whereas `getAgentRequests`
521
- * pre-fills them from the machine's registered `setupAgent` options.
522
- * `options.snapshot` is required to resolve a decision's candidate events
523
- * (intersecting declared `allowedEvents` with what's currently legal) — omit
524
- * it and decision requests report an empty `events` list.
525
- *
526
- * @internal
527
- */
528
- function getAgentRequestsWith(actions, options = {}) {
529
- return [...actions.flatMap((action) => {
530
- const params = getInvokeEffectMetadata(action);
531
- if (!params || typeof params.src !== "string") return [];
532
- if (typeof params.id !== "string" || params.id.length === 0) throw new Error(`Agent invoke '${params.src}' must define a durable string id.`);
533
- const registeredLogic = require_decision.isTextLogic(params.logic) || require_decision.isDecisionLogic(params.logic) ? params.logic : options.actorSources?.[params.src];
534
- if (require_decision.isDecisionLogic(registeredLogic)) {
535
- const decisionRequest = registeredLogic.request(params.input);
536
- const allowedEventTypes = registeredLogic.allowedEventTypes?.(params.input);
537
- const events = options.snapshot ? require_decision.getAcceptedEvents(options.snapshot, {
538
- events: options.events,
539
- schemas: options.schemas,
540
- eventTypes: allowedEventTypes,
541
- eventToolName: options.eventToolName
542
- }) : [];
543
- return [{
544
- ...decisionRequest,
545
- id: params.id,
546
- events
547
- }];
548
- }
549
- const textLogic = require_decision.isTextLogic(registeredLogic) ? registeredLogic : void 0;
550
- const input = textLogic ? textLogic.request(params.input) : void 0;
551
- if (!input) return [];
552
- return [{
553
- kind: "text",
554
- id: params.id,
555
- src: params.src,
556
- ...textLogic ? { mode: textLogic.mode } : {},
557
- input,
558
- tools: input.tools ?? {},
559
- events: []
560
- }];
561
- }), ...getActivePlanRequests(options)];
562
- }
563
- /**
564
- * Scans the live snapshot's children for active `agent.plan` (plan-logic)
565
- * invokes and lowers each into an {@link AgentPlanRequest} — the re-surfacing
566
- * half of plan discovery. Reads the applied-event trail and remaining budget
567
- * from the child's own ledger `context` ({@link PlanLedgerContext}), recomputes
568
- * the currently-legal candidates (∩ declared `allowedEvents`) plus the reserved
569
- * `agent.plan.done` move, and takes `stepsRemaining` from the ledger (falling
570
- * back to `maxSteps - applied.length` for a snapshot with no context yet).
571
- * Returns `[]` when no snapshot is available (candidates need a live snapshot).
572
- *
573
- * @internal
574
- */
575
- function getActivePlanRequests(options) {
576
- const snapshot = options.snapshot;
577
- if (!snapshot) return [];
578
- const children = snapshot.children;
579
- if (!children) return [];
580
- const requests = [];
581
- for (const [id, child] of Object.entries(children)) {
582
- const ref = child;
583
- if (typeof ref?.getSnapshot !== "function") continue;
584
- const src = typeof ref.src === "string" ? ref.src : void 0;
585
- const logic = (src ? options.actorSources?.[src] : void 0) ?? ref.logic;
586
- if (!require_decision.isPlanLogic(logic)) continue;
587
- const childSnapshot = ref.getSnapshot();
588
- if (childSnapshot?.status !== "active") continue;
589
- const input = childSnapshot.input ?? {};
590
- const maxSteps = input.maxSteps ?? 8;
591
- const ledger = childSnapshot.context ?? {};
592
- const applied = ledger.applied ?? [];
593
- const stepsRemaining = ledger.stepsRemaining ?? maxSteps - applied.length;
594
- const machineEvents = require_decision.getAcceptedEvents(snapshot, {
595
- events: options.events,
596
- schemas: options.schemas,
597
- eventTypes: logic.allowedEventTypes(input) ?? void 0,
598
- eventToolName: options.eventToolName
599
- });
600
- const events = machineEvents.some((event) => event.type === "agent.plan.done") ? machineEvents : [...machineEvents, {
601
- type: require_decision.PLAN_DONE_EVENT_TYPE,
602
- toolName: require_decision.sanitizeEventToolName(require_decision.PLAN_DONE_EVENT_TYPE)
603
- }];
604
- requests.push({
605
- kind: "plan",
606
- id,
607
- src: src ?? "",
608
- input,
609
- events,
610
- applied,
611
- stepsRemaining: Math.max(0, stepsRemaining)
612
- });
613
- }
614
- return requests;
615
- }
616
- /**
617
- * Builds the synthetic `xstate.done.actor.<id>` event xstate's `transition()`
618
- * expects to resolve a spawned invoke — the event {@link resolveAgentStep}
619
- * applies internally.
620
- *
621
- * @internal
622
- */
623
- function doneEvent(request, output) {
624
- return {
625
- type: `xstate.done.actor.${typeof request === "string" ? request : request.id}`,
626
- output
627
- };
628
- }
629
- /**
630
- * Applies a request's `output` as a done event via `transition(...)`,
631
- * returning the raw `[snapshot, actions]` tuple. Lower-level than
632
- * {@link resolveAgentStep} — that helper wraps this and also runs
633
- * {@link getAgentRequests} to produce the next {@link AgentStep}.
634
- *
635
- * @internal
636
- */
637
- function transitionResult(logic, snapshot, request, output) {
638
- const event = doneEvent(request, output);
639
- const result = (0, xstate.transition)(logic, snapshot, event);
640
- applyFinalStateOutput(logic, result[0], event);
641
- return result;
642
- }
643
- /**
644
- * Starts a machine and returns its first {@link AgentStep} — the step-path
645
- * equivalent of `initialTransition` plus request discovery. Begins the
646
- * durable/per-model-call-checkpoint loop: resolve each `step.requests` entry
647
- * (via {@link executeAgentRequest} for `kind: 'text'`, or
648
- * {@link resolveDecision} for `kind: 'decision'`), then advance with
649
- * {@link resolveAgentStep} or {@link transitionAgentStep}.
650
- */
651
- function initialAgentStep(machine, input, options) {
652
- const [snapshot, actions] = (0, xstate.initialTransition)(machine, input);
653
- return createAgentStep(machine, snapshot, actions, require_decision.getRegisteredAgentExecutionOptions(machine, options));
654
- }
655
- /**
656
- * Applies an externally-sent event (e.g. a decision's chosen event, or a
657
- * human's reply) and returns the next {@link AgentStep}. Accepts **either**
658
- * a raw snapshot **or** a prior `AgentStep` as the second argument —
659
- * `.snapshot` is unwrapped automatically, so callers can thread the whole
660
- * step object through without manually plucking the snapshot out.
661
- */
662
- function transitionAgentStep(machine, snapshotOrStep, event, options) {
663
- const [nextSnapshot, actions] = (0, xstate.transition)(machine, isAgentStep(snapshotOrStep) ? snapshotOrStep.snapshot : snapshotOrStep, event);
664
- return createAgentStep(machine, nextSnapshot, actions, require_decision.getRegisteredAgentExecutionOptions(machine, options));
665
- }
666
- /**
667
- * Applies a resolved text request's output (a `kind: 'text'`
668
- * {@link AgentRequest} — not a decision) as a done event and returns the
669
- * next {@link AgentStep}. For decisions, resolve with `resolveDecision`
670
- * (which returns a {@link ChosenEvent}) and apply it with
671
- * {@link transitionAgentStep} instead — a decision has no output value of
672
- * its own to feed here.
673
- */
674
- function resolveAgentStep(machine, step, request, output, options) {
675
- const [snapshot, actions] = transitionResult(machine, step.snapshot, request, output);
676
- return createAgentStep(machine, snapshot, actions, require_decision.getRegisteredAgentExecutionOptions(machine, options));
677
- }
678
- /**
679
- * Snapshot in, requests out: scans executable actions for spawned agent
680
- * invokes and lowers each into an {@link AgentStepRequest}, pre-filled with
681
- * the machine's registered `setupAgent` schemas/actorSources (so callers
682
- * don't pass them by hand each call) — merged with any `options` passed here,
683
- * which take precedence. The step path's public discovery primitive;
684
- * `initialAgentStep`/`transitionAgentStep`/`resolveAgentStep` call it
685
- * internally to populate `AgentStep.requests`.
686
- */
687
- function getAgentRequests(machine, actions, snapshot, options = {}) {
688
- return getAgentRequestsWith(actions, {
689
- ...require_decision.getRegisteredAgentExecutionOptions(machine, options),
690
- ...options,
691
- snapshot
692
- });
693
- }
694
- async function executeAgentRequest(request, executors, options) {
695
- if (request.kind === "decision") throw new Error("executeAgentRequest(...) is text-only. Resolve a 'decision' request with resolveDecision(request, executors.decide, ...) instead.");
696
- assertTextExecutor(request, executors);
697
- const { output, raw } = await require_decision.executeAgentTextRequest(request.mode ?? "generate", request.id, request.input, executors, request.tools);
698
- const normalizedOutput = request.input.outputSchema ? require_decision.validateSchemaSync(request.input.outputSchema, output) : output;
699
- return options?.verbose ? {
700
- output: normalizedOutput,
701
- raw
702
- } : normalizedOutput;
703
- }
704
- /**
705
- * Resolves the current step's pending requests and returns the next
706
- * {@link AgentStep} — one iteration of the durable step loop, collapsing the
707
- * manual `request.kind` dispatch a host would otherwise write by hand.
708
- *
709
- * For each pending request, in order: a `kind: 'text'` request is run with
710
- * {@link executeAgentRequest} then fed back via {@link resolveAgentStep}; a
711
- * `kind: 'decision'` request is resolved with `resolveDecision` (wiring
712
- * `canTake` to `step.snapshot.can` so guard-rejected choices retry) then
713
- * applied with {@link transitionAgentStep}. The **current** step is re-read
714
- * after each application — the machine may advance and its `requests` change —
715
- * so this always resolves against the live step, never a stale list.
716
- *
717
- * A `kind: 'plan'` request (`agent.plan`) is resolved natively too: one plan
718
- * step per call. It resolves a single decision from `request.events` (wiring
719
- * `canTake` to `step.snapshot.can`, exempting the reserved `agent.plan.done`
720
- * move and `stopOn` events), then either applies the chosen machine event and
721
- * lets the next step re-surface the plan, or completes the plan (feeding its
722
- * `{ steps, stopped }` output back) on the done move / a `stopOn` event / an
723
- * exhausted budget / no legal events. The plan's applied trail is carried in
724
- * the invoke child's snapshot, so persisting the step between calls resumes the
725
- * plan identically.
726
- *
727
- * Missing the executor a request needs throws a clear error
728
- * (`generateText`/`streamText` for text, `decide` for decisions and plans).
729
- *
730
- * A complete durable host is two lines:
731
- *
732
- * ```ts
733
- * let step = initialAgentStep(machine, input);
734
- * while (!step.done) step = await resolveAgentRequests(machine, step, executors);
735
- * ```
736
- *
737
- * All pending **text** requests of a step are resolved in parallel
738
- * (`Promise.all`) — parallel statechart regions are genuinely concurrent, so
739
- * their model calls run concurrently — then their outputs apply in
740
- * **request-array order** (deterministic for durable replay regardless of which
741
- * call finishes first). Decisions and plans stay **one at a time**: applying
742
- * either changes the set of legal candidates for what follows, so they cannot be
743
- * resolved against a stale snapshot. A host that instead wants strictly
744
- * sequential text resolution loops the manual per-request helpers
745
- * ({@link executeAgentRequest} + {@link resolveAgentStep}) one at a time.
746
- */
747
- async function resolveAgentRequests(machine, step, executors, options) {
748
- const [request] = step.requests;
749
- if (!request) return step;
750
- if (request.kind === "decision") {
751
- if (!executors.decide) throw new Error(`this step's decision request '${request.id}' needs a 'decide' executor but none was provided.`);
752
- return transitionAgentStep(machine, step, await require_decision.resolveDecision(request, executors.decide, {
753
- canTake: (event) => step.snapshot.can(event),
754
- maxRetries: options?.maxRetries
755
- }), options);
756
- }
757
- if (request.kind === "plan") return resolvePlanRequest(machine, step, request, executors, options);
758
- const textRequests = step.requests.filter((candidate) => candidate.kind === "text");
759
- for (const textRequest of textRequests) assertTextExecutor(textRequest, executors);
760
- const outputs = await Promise.all(textRequests.map((textRequest) => executeAgentRequest(textRequest, executors)));
761
- let next = step;
762
- for (let index = 0; index < textRequests.length; index++) next = resolveAgentStep(machine, next, textRequests[index], outputs[index], options);
763
- return next;
764
- }
765
- function assertTextExecutor(request, executors) {
766
- const mode = request.mode ?? "generate";
767
- const kind = mode === "stream" ? "streamText" : "generateText";
768
- if (!(mode === "stream" ? executors.streamText : executors.generateText)) throw new Error(`this step's text request '${request.src}' needs a '${kind}' executor but none was provided.`);
769
- }
770
- async function resolvePlanRequest(machine, step, request, executors, options) {
771
- if (!executors.decide) throw new Error(`this step's plan request '${request.src}' needs a 'decide' executor but none was provided.`);
772
- const stopOn = new Set(request.input.stopOn ?? []);
773
- if (request.stepsRemaining <= 0) return completePlan(machine, step, request.id, request.applied, "max-steps", options);
774
- if (request.events.filter((event) => event.type !== "agent.plan.done").length === 0) return completePlan(machine, step, request.id, request.applied, "no-legal-events", options);
775
- const chosen = await require_decision.resolveDecision(planStepDecisionRequest(request), executors.decide, {
776
- maxRetries: options?.maxRetries,
777
- canTake: (event) => {
778
- if (event.type === "agent.plan.done" || stopOn.has(event.type)) return true;
779
- return step.snapshot.can(event);
780
- }
781
- });
782
- if (chosen.type === "agent.plan.done") return completePlan(machine, step, request.id, request.applied, "done", options);
783
- const applied = [...request.applied, chosen];
784
- advancePlanChildLedger(step.snapshot, request.id, {
785
- type: "plan.applied",
786
- event: chosen
787
- });
788
- const next = transitionAgentStep(machine, step, chosen, options);
789
- if (stopOn.has(chosen.type)) {
790
- if (isPlanActive(next.snapshot, request.id)) return completePlan(machine, next, request.id, applied, "stop-event", options);
791
- }
792
- return next;
793
- }
794
- function completePlan(machine, step, id, steps, stopped, options) {
795
- return resolveAgentStep(machine, step, { id }, {
796
- steps,
797
- stopped
798
- }, options);
799
- }
800
- function planStepDecisionRequest(request) {
801
- const { input, applied, events, id } = request;
802
- const trail = applied.length === 0 ? "" : `\n\nEvents already applied in this plan, in order:\n${applied.map((step) => JSON.stringify(step)).join("\n")}\nContinue from here; do not repeat applied events.`;
803
- const doneHint = `\n\nWhen the request is fully handled (or no action is needed), choose '${require_decision.PLAN_DONE_EVENT_TYPE}'.`;
804
- return {
805
- kind: "decision",
806
- id: `${id}[${applied.length}]`,
807
- model: input.model,
808
- system: input.system,
809
- prompt: `${input.prompt ?? ""}${trail}${doneHint}`,
810
- messages: input.messages,
811
- events,
812
- attempts: [],
813
- temperature: input.temperature,
814
- maxOutputTokens: input.maxOutputTokens,
815
- topP: input.topP,
816
- topK: input.topK,
817
- seed: input.seed,
818
- stopSequences: input.stopSequences,
819
- metadata: input.metadata
820
- };
821
- }
822
- function advancePlanChildLedger(snapshot, id, event) {
823
- const child = snapshot.children?.[id];
824
- const childSnapshot = child?.getSnapshot?.();
825
- if (!require_decision.isPlanLogic(child?.logic) || !childSnapshot || typeof childSnapshot !== "object") return;
826
- Object.assign(childSnapshot, require_decision.advancePlanLedger(child.logic, childSnapshot, event));
827
- }
828
- function isPlanActive(snapshot, id) {
829
- return (snapshot.children?.[id])?.getSnapshot?.()?.status === "active";
830
- }
831
- function createAgentStep(machine, snapshot, actions, options) {
832
- applyFinalStateOutput(machine, snapshot);
833
- return {
834
- snapshot,
835
- actions,
836
- requests: getAgentRequestsWith(actions, {
837
- ...options,
838
- snapshot
839
- }),
840
- done: snapshot.status === "done"
841
- };
842
- }
843
- function resolveStateValueConfig(config, value) {
844
- if (typeof value === "string") return config.states?.[value];
845
- if (!value || typeof value !== "object") return;
846
- for (const [key, childValue] of Object.entries(value)) {
847
- const childConfig = config.states?.[key];
848
- if (!childConfig) continue;
849
- if (childConfig.type === "final") return childConfig;
850
- const nested = resolveStateValueConfig(childConfig, childValue);
851
- if (nested) return nested;
852
- }
853
- }
854
- function applyFinalStateOutput(logic, snapshot, event) {
855
- const machineSnapshot = snapshot;
856
- if (machineSnapshot.status !== "done" || machineSnapshot.output !== void 0 || !("config" in logic)) return;
857
- const config = logic.config;
858
- if (!config) return;
859
- const output = resolveStateValueConfig(config, machineSnapshot.value)?.output;
860
- if (output === void 0) return;
861
- machineSnapshot.output = typeof output === "function" ? output({
862
- context: machineSnapshot.context,
863
- event
864
- }) : output;
865
- }
866
- function isAgentStep(value) {
867
- return !!value && typeof value === "object" && "snapshot" in value && "actions" in value && "requests" in value;
868
- }
869
- //#endregion
870
511
  //#region src/internal/state-request-pass.ts
871
512
  async function runTextPhase(stateRequest, baseMessages, deps) {
872
513
  const { model, system } = stateRequest;
@@ -1887,611 +1528,6 @@ function collectPendingUserInputs(snapshot) {
1887
1528
  return pending;
1888
1529
  }
1889
1530
  //#endregion
1890
- //#region src/verify.ts
1891
- const DECIDE_SRC = "agent.decide";
1892
- const PLAN_SRC = "agent.plan";
1893
- function normalizeInvokes(invoke) {
1894
- if (invoke === void 0 || invoke === null) return [];
1895
- return Array.isArray(invoke) ? invoke : [invoke];
1896
- }
1897
- function buildStateIndex(rootConfig) {
1898
- const index = /* @__PURE__ */ new Map();
1899
- const walk = (states, parentPath) => {
1900
- for (const [name, config] of Object.entries(states ?? {})) {
1901
- const path = parentPath ? `${parentPath}.${name}` : name;
1902
- const hasChildren = !!config.states && Object.keys(config.states).length > 0;
1903
- index.set(path, {
1904
- path,
1905
- name,
1906
- config,
1907
- parentPath,
1908
- type: config.type,
1909
- isFinal: config.type === "final",
1910
- isParallel: config.type === "parallel",
1911
- isCompound: hasChildren && config.type !== "parallel",
1912
- invokes: normalizeInvokes(config.invoke)
1913
- });
1914
- if (hasChildren) walk(config.states, path);
1915
- }
1916
- };
1917
- walk(rootConfig.states, "");
1918
- return index;
1919
- }
1920
- function childrenOf(index, parentPath) {
1921
- const out = [];
1922
- for (const node of index.values()) if (node.parentPath === parentPath) out.push(node);
1923
- return out;
1924
- }
1925
- function collectTransitionTargets(value, fromNode, index, out) {
1926
- if (value === void 0 || value === null) return;
1927
- if (Array.isArray(value)) {
1928
- for (const item of value) collectTransitionTargets(item, fromNode, index, out);
1929
- return;
1930
- }
1931
- if (typeof value === "function") {
1932
- out.opaque = true;
1933
- return;
1934
- }
1935
- if (typeof value === "string") {
1936
- resolveTargetString(value, fromNode, index, out);
1937
- return;
1938
- }
1939
- if (typeof value === "object") {
1940
- const target = value.target;
1941
- if (target !== void 0) collectTransitionTargets(target, fromNode, index, out);
1942
- }
1943
- }
1944
- function resolveTargetString(target, fromNode, index, out) {
1945
- if (target.startsWith("#")) {
1946
- out.opaque = true;
1947
- return;
1948
- }
1949
- const resolved = target.startsWith(".") ? `${fromNode.path}.${target.slice(1)}` : fromNode.parentPath ? `${fromNode.parentPath}.${target}` : target;
1950
- if (index.has(resolved)) out.targets.push(resolved);
1951
- else out.opaque = true;
1952
- }
1953
- function outgoingTargets(node, index) {
1954
- const out = {
1955
- targets: [],
1956
- opaque: false
1957
- };
1958
- const { config } = node;
1959
- for (const value of Object.values(config.on ?? {})) collectTransitionTargets(value, node, index, out);
1960
- collectTransitionTargets(config.always, node, index, out);
1961
- collectTransitionTargets(config.choice, node, index, out);
1962
- for (const value of Object.values(config.after ?? {})) collectTransitionTargets(value, node, index, out);
1963
- collectTransitionTargets(config.onDone, node, index, out);
1964
- for (const invoke of node.invokes) {
1965
- collectTransitionTargets(invoke.onDone, node, index, out);
1966
- collectTransitionTargets(invoke.onError, node, index, out);
1967
- }
1968
- return out;
1969
- }
1970
- function computeReachable(rootConfig, index) {
1971
- const reachable = /* @__PURE__ */ new Set();
1972
- const queue = [];
1973
- const markAncestors = (path) => {
1974
- let parent = index.get(path)?.parentPath ?? "";
1975
- while (parent) {
1976
- reachable.add(parent);
1977
- parent = index.get(parent)?.parentPath ?? "";
1978
- }
1979
- };
1980
- const enter = (path) => {
1981
- if (reachable.has(path)) return;
1982
- const node = index.get(path);
1983
- if (!node) return;
1984
- reachable.add(path);
1985
- queue.push(path);
1986
- markAncestors(path);
1987
- if (node.isParallel) for (const child of childrenOf(index, path)) enter(child.path);
1988
- else if (node.isCompound && node.config.initial) enter(`${path}.${node.config.initial}`);
1989
- };
1990
- if (rootConfig.type === "parallel") for (const child of childrenOf(index, "")) enter(child.path);
1991
- else if (rootConfig.initial) enter(rootConfig.initial);
1992
- while (queue.length > 0) {
1993
- const node = index.get(queue.shift());
1994
- if (!node) continue;
1995
- const { targets, opaque } = outgoingTargets(node, index);
1996
- for (const target of targets) enter(target);
1997
- if (opaque) for (const sibling of childrenOf(index, node.parentPath)) enter(sibling.path);
1998
- }
1999
- return reachable;
2000
- }
2001
- function ancestorChain(node, index) {
2002
- const chain = [];
2003
- let parent = node.parentPath;
2004
- while (parent) {
2005
- const parentNode = index.get(parent);
2006
- if (!parentNode) break;
2007
- chain.push(parentNode);
2008
- parent = parentNode.parentPath;
2009
- }
2010
- return chain;
2011
- }
2012
- function hasNonEmptyOn(config) {
2013
- return !!config.on && Object.keys(config.on).length > 0;
2014
- }
2015
- function decisionKindOf(src, actorSources) {
2016
- if (typeof src === "string") {
2017
- if (src === DECIDE_SRC) return "decision";
2018
- if (src === PLAN_SRC) return "plan";
2019
- const logic = actorSources[src];
2020
- if (require_decision.isDecisionLogic(logic)) return "decision";
2021
- if (require_decision.isPlanLogic(logic)) return "plan";
2022
- return;
2023
- }
2024
- if (require_decision.isDecisionLogic(src)) return "decision";
2025
- if (require_decision.isPlanLogic(src)) return "plan";
2026
- }
2027
- function isAgentLogicNeedingBinding(src) {
2028
- return (require_decision.isTextLogic(src) || require_decision.isDecisionLogic(src) || require_decision.isPlanLogic(src)) && !require_decision.executorBoundLogics.has(src);
2029
- }
2030
- function schemaExposesJson(schema) {
2031
- if (!schema) return false;
2032
- try {
2033
- return require_decision.getJsonSchemaSync(schema) !== void 0;
2034
- } catch {
2035
- return false;
2036
- }
2037
- }
2038
- function isDeclaredOutputSchema(schema) {
2039
- if (!schema) return false;
2040
- let json;
2041
- try {
2042
- json = require_decision.getJsonSchemaSync(schema);
2043
- } catch {
2044
- return false;
2045
- }
2046
- if (!json) return false;
2047
- const properties = json.properties;
2048
- const required = json.required;
2049
- return json.type === "object" && !!properties && Object.keys(properties).length > 0 || Array.isArray(required) && required.length > 0;
2050
- }
2051
- function checkUnreachableStates(ctx) {
2052
- const out = [];
2053
- for (const node of ctx.index.values()) if (!ctx.reachable.has(node.path)) out.push({
2054
- code: "unreachable-state",
2055
- severity: "error",
2056
- path: node.path,
2057
- message: `State '${node.path}' is unreachable: no transition, always, onDone, or onError target (from any reachable state) leads to it. Remove it or add a transition.`
2058
- });
2059
- return out;
2060
- }
2061
- function checkDecideWithoutEvents(ctx) {
2062
- const out = [];
2063
- for (const node of ctx.index.values()) for (const invoke of node.invokes) {
2064
- const kind = decisionKindOf(invoke.src, ctx.actorSources);
2065
- if (!kind) continue;
2066
- const selfHandles = hasNonEmptyOn(node.config);
2067
- const ancestorHandles = ancestorChain(node, ctx.index).some((ancestor) => hasNonEmptyOn(ancestor.config));
2068
- const invokeObserves = invoke.onDone !== void 0;
2069
- if (selfHandles || ancestorHandles || invokeObserves) continue;
2070
- const srcName = typeof invoke.src === "string" ? invoke.src : "(inline logic)";
2071
- out.push({
2072
- code: "decide-without-events",
2073
- severity: "error",
2074
- path: node.path,
2075
- message: `State '${node.path}' invokes ${kind} source '${srcName}', but neither it nor any ancestor handles any event (no 'on:'), so the ${kind}'s chosen event can never be delivered. Add an 'on:' handler for the candidate events.`
2076
- });
2077
- }
2078
- return out;
2079
- }
2080
- function checkUnserializableContext(ctx) {
2081
- const contextSchema = ctx.schemas?.context;
2082
- if (!contextSchema) return [];
2083
- if (schemaExposesJson(contextSchema)) return [];
2084
- return [{
2085
- code: "unserializable-context",
2086
- severity: "warning",
2087
- path: "context",
2088
- message: "The context schema does not expose a JSON schema (e.g. a `z.custom` without a `jsonSchema` extension, such as a messages array), so its fields cannot be statically checked for JSON persist/resume round-tripping. This is expected for message transcripts; verify any other custom-typed context is JSON-serializable."
2089
- }];
2090
- }
2091
- function checkDirectObjectSrc(ctx) {
2092
- const out = [];
2093
- for (const node of ctx.index.values()) for (const invoke of node.invokes) {
2094
- const src = invoke.src;
2095
- if (typeof src === "string" || !src || typeof src !== "object") continue;
2096
- if (!isAgentLogicNeedingBinding(src)) continue;
2097
- out.push({
2098
- code: "direct-object-src",
2099
- severity: "warning",
2100
- path: node.path,
2101
- message: `State '${node.path}' invokes a direct-object agent logic. Direct-object invoke srcs cannot be rebound by runAgent, so they inherit no host executors — call '.withExecutor(...)' on the logic, or register it as a string-keyed actor source (machine.provide({ actorSources: { name: logic } })) and invoke it by name.`
2102
- });
2103
- }
2104
- return out;
2105
- }
2106
- function checkFinalWithoutOutput(ctx) {
2107
- if (!isDeclaredOutputSchema(ctx.schemas?.output)) return [];
2108
- if (ctx.config.output !== void 0) return [];
2109
- const out = [];
2110
- for (const node of ctx.index.values()) {
2111
- if (node.parentPath !== "" || !node.isFinal) continue;
2112
- if (node.config.output === void 0) out.push({
2113
- code: "final-without-output",
2114
- severity: "error",
2115
- path: node.path,
2116
- message: `The machine declares an output schema, but top-level final state '${node.path}' has no 'output'. Its snapshot output will be undefined and fail the schema. Add an 'output' to this final state (or a root 'output').`
2117
- });
2118
- }
2119
- return out;
2120
- }
2121
- function outputFnReadsEvent(fn) {
2122
- return /\bevent\s*(?:\.|\?\.|\[)/.test(fn.toString());
2123
- }
2124
- function checkFinalOutputReadsEvent(ctx) {
2125
- const out = [];
2126
- for (const node of ctx.index.values()) {
2127
- if (node.parentPath !== "" || !node.isFinal) continue;
2128
- const output = node.config.output;
2129
- if (typeof output !== "function") continue;
2130
- if (!outputFnReadsEvent(output)) continue;
2131
- out.push({
2132
- code: "final-output-reads-event",
2133
- severity: "warning",
2134
- path: node.path,
2135
- message: `Final state '${node.path}' has an 'output' function that reads 'event'. Final-state 'output' functions are evaluated more than once with different events (the entering event, then the machine-done computation) under current xstate behavior, so 'event' is unreliable here. Read 'context' only; capture what you need from the entering event into context in the transition that targets this state. (This guard can relax if xstate guarantees a stable entering event across evaluations.)`
2136
- });
2137
- }
2138
- return out;
2139
- }
2140
- function checkMissingFinal(ctx) {
2141
- for (const node of ctx.index.values()) if (node.isFinal && ctx.reachable.has(node.path)) return [];
2142
- return [{
2143
- code: "missing-final",
2144
- severity: "warning",
2145
- path: "(root)",
2146
- message: "The machine has no reachable final state, so a run can never settle 'done' (only idle/looping). This is legal for agents that only idle, but verify it is intended."
2147
- }];
2148
- }
2149
- const LINT_CHECKS = [
2150
- checkUnreachableStates,
2151
- checkDecideWithoutEvents,
2152
- checkUnserializableContext,
2153
- checkDirectObjectSrc,
2154
- checkFinalWithoutOutput,
2155
- checkFinalOutputReadsEvent,
2156
- checkMissingFinal
2157
- ];
2158
- /**
2159
- * Runs static structural checks over a built agent machine and returns the
2160
- * findings ({@link AgentLintDiagnostic}[], empty when clean). Works for
2161
- * TS-authored (`setupAgent(...).createMachine(...)`) and
2162
- * `setupAgent.fromConfig(...)`-compiled machines alike, reading `machine.config`
2163
- * plus the schemas/actor sources the library already retains per machine.
2164
- *
2165
- * No model calls, no API keys — a coding agent that emits an agent machine can
2166
- * call this to catch dead states, undeliverable decisions, un-rebindable
2167
- * invoke srcs, and output-contract gaps before ever running it.
2168
- *
2169
- * @example
2170
- * ```ts
2171
- * const errors = lintAgentMachine(machine).filter((d) => d.severity === 'error');
2172
- * if (errors.length) throw new Error(errors.map((e) => `${e.path}: ${e.message}`).join('\n'));
2173
- * ```
2174
- */
2175
- function lintAgentMachine(machine, options = {}) {
2176
- const config = machine.config ?? {};
2177
- const index = buildStateIndex(config);
2178
- const reachable = computeReachable(config, index);
2179
- const registered = require_decision.getRegisteredAgentExecutionOptions(machine);
2180
- const ctx = {
2181
- machine,
2182
- config,
2183
- index,
2184
- reachable,
2185
- schemas: registered.schemas,
2186
- actorSources: registered.actorSources ?? machine.implementations?.actorSources ?? {}
2187
- };
2188
- const disabled = new Set(options.disable ?? []);
2189
- return LINT_CHECKS.flatMap((check) => check(ctx)).filter((d) => !disabled.has(d.code));
2190
- }
2191
- function pendingInvokes(step) {
2192
- const out = [];
2193
- for (const action of step.actions) {
2194
- const metadata = getInvokeEffectMetadata(action);
2195
- if (typeof metadata?.src === "string" && typeof metadata.id === "string") out.push({
2196
- id: metadata.id,
2197
- src: metadata.src
2198
- });
2199
- }
2200
- return out;
2201
- }
2202
- function takeFromQueue(channel, src) {
2203
- const queue = channel?.[src];
2204
- if (queue && queue.length > 0) return {
2205
- found: true,
2206
- value: queue.shift()
2207
- };
2208
- return { found: false };
2209
- }
2210
- /**
2211
- * Deterministically plays a machine through, resolving each request from a
2212
- * {@link SimulationScript} instead of a model — no API keys, no model calls.
2213
- * Runs on the pure step path ({@link initialAgentStep} etc.), so it exercises
2214
- * the real transition logic. Returns the terminal `status`, final `snapshot`,
2215
- * and a `trail` of every step taken.
2216
- *
2217
- * Throws a descriptive error when the script runs dry mid-request, naming the
2218
- * pending request's kind, src, and id so the missing scripted response is
2219
- * obvious.
2220
- *
2221
- * @example
2222
- * ```ts
2223
- * const { status, snapshot } = simulateAgent(machine, {
2224
- * input: { topic: 'state machines' },
2225
- * script: { decisions: { 'agent.decide': [{ type: 'END' }] } },
2226
- * });
2227
- * ```
2228
- */
2229
- async function simulateAgent(machine, options) {
2230
- const maxSteps = options.maxSteps ?? 100;
2231
- const script = {
2232
- text: { ...options.script.text },
2233
- decisions: mapValues(options.script.decisions ?? {}, (arr) => [...arr]),
2234
- userInput: mapValues(options.script.userInput ?? {}, (arr) => [...arr])
2235
- };
2236
- let step = initialAgentStep(machine, options.input);
2237
- const trail = [];
2238
- for (let i = 0; i < maxSteps; i++) {
2239
- if (step.done) return {
2240
- status: "done",
2241
- snapshot: step.snapshot,
2242
- trail
2243
- };
2244
- const request = step.requests[0];
2245
- if (request) {
2246
- if (request.kind === "decision") {
2247
- const decisionSrc = new Map(pendingInvokes(step).map((invoke) => [invoke.id, invoke.src])).get(request.id) ?? request.id;
2248
- const taken = takeFromQueue(script.decisions, decisionSrc);
2249
- if (!taken.found) throw scriptDryError("decision", decisionSrc, request.id, request);
2250
- step = transitionAgentStep(machine, step, taken.value);
2251
- trail.push({
2252
- state: step.snapshot.value,
2253
- appliedEvent: taken.value
2254
- });
2255
- continue;
2256
- }
2257
- if (request.kind === "plan") {
2258
- const taken = takeFromQueue(script.decisions, request.src);
2259
- if (!taken.found) throw scriptDryError("decision", request.src, request.id, request);
2260
- const event = taken.value;
2261
- step = await resolveAgentRequests(machine, step, { decide: async () => ({ event }) });
2262
- trail.push({
2263
- state: step.snapshot.value,
2264
- appliedEvent: taken.value
2265
- });
2266
- continue;
2267
- }
2268
- const taken = takeFromQueue(script.text, request.src);
2269
- if (!taken.found) throw scriptDryError("text", request.src, request.id);
2270
- step = resolveAgentStep(machine, step, request, taken.value);
2271
- trail.push({
2272
- state: step.snapshot.value,
2273
- resolvedRequest: {
2274
- kind: "text",
2275
- src: request.src,
2276
- id: request.id
2277
- }
2278
- });
2279
- continue;
2280
- }
2281
- const [invoke] = pendingInvokes(step);
2282
- if (invoke) {
2283
- const taken = takeFromQueue(script.userInput, invoke.src);
2284
- if (!taken.found) throw scriptDryError("userInput", invoke.src, invoke.id);
2285
- step = resolveAgentStep(machine, step, invoke.id, taken.value);
2286
- trail.push({
2287
- state: step.snapshot.value,
2288
- resolvedRequest: {
2289
- kind: "userInput",
2290
- src: invoke.src,
2291
- id: invoke.id
2292
- }
2293
- });
2294
- continue;
2295
- }
2296
- return {
2297
- status: "idle",
2298
- snapshot: step.snapshot,
2299
- trail
2300
- };
2301
- }
2302
- return {
2303
- status: "exhausted",
2304
- snapshot: step.snapshot,
2305
- trail
2306
- };
2307
- }
2308
- function mapValues(obj, fn) {
2309
- return Object.fromEntries(Object.entries(obj).map(([key, value]) => [key, fn(value)]));
2310
- }
2311
- function scriptDryError(kind, src, id, request) {
2312
- const events = request?.kind === "decision" ? ` Candidate events: ${request.events.map((e) => e.type).join(", ") || "(none)"}.` : "";
2313
- return /* @__PURE__ */ new Error(`simulateAgent: script ran dry on a pending ${kind} request for src '${src}' (id '${id}'). Add a '${kind}' entry for '${src}' to the script.${events}`);
2314
- }
2315
- async function explore(machine, options, stopWhen) {
2316
- const maxDepth = options.maxDepth ?? 8;
2317
- const maxPaths = options.maxPaths ?? 200;
2318
- const textOutputs = options.textOutputs ?? {};
2319
- const reachedStates = /* @__PURE__ */ new Set();
2320
- const reachedValues = [];
2321
- const terminals = [];
2322
- const unexplored = [];
2323
- let prunedByGuard = 0;
2324
- let pathsExplored = 0;
2325
- let hitPathCap = false;
2326
- let witness;
2327
- const recordState = (snapshot) => {
2328
- const key = JSON.stringify(snapshot.value);
2329
- if (!reachedStates.has(key)) {
2330
- reachedStates.add(key);
2331
- reachedValues.push(snapshot.value);
2332
- }
2333
- };
2334
- const initial = initialAgentStep(machine, options.input);
2335
- recordState(initial.snapshot);
2336
- if (stopWhen?.(initial.snapshot)) witness = [];
2337
- const advance = (step) => {
2338
- let current = step;
2339
- for (let i = 0; i < 1e3; i++) {
2340
- if (current.done) return { step: current };
2341
- const request = current.requests[0];
2342
- if (request && request.kind === "text") {
2343
- if (!(request.src in textOutputs)) return {
2344
- step: current,
2345
- blockedSrc: request.src
2346
- };
2347
- current = resolveAgentStep(machine, current, request, textOutputs[request.src]);
2348
- recordState(current.snapshot);
2349
- continue;
2350
- }
2351
- if (request && (request.kind === "decision" || request.kind === "plan")) return { step: current };
2352
- const [invoke] = pendingInvokes(current);
2353
- if (invoke) {
2354
- if (!(invoke.src in textOutputs)) return {
2355
- step: current,
2356
- blockedSrc: invoke.src
2357
- };
2358
- current = resolveAgentStep(machine, current, invoke.id, textOutputs[invoke.src]);
2359
- recordState(current.snapshot);
2360
- continue;
2361
- }
2362
- return { step: current };
2363
- }
2364
- return { step: current };
2365
- };
2366
- const visit = async (step, path, depth) => {
2367
- if (witness !== void 0) return;
2368
- if (pathsExplored >= maxPaths) {
2369
- hitPathCap = true;
2370
- return;
2371
- }
2372
- const { step: settled, blockedSrc } = advance(step);
2373
- if (stopWhen?.(settled.snapshot)) {
2374
- witness = path;
2375
- return;
2376
- }
2377
- if (blockedSrc) {
2378
- pathsExplored++;
2379
- terminals.push({
2380
- status: "needs-output",
2381
- path,
2382
- state: settled.snapshot.value,
2383
- missingSrc: blockedSrc
2384
- });
2385
- unexplored.push(`needs-output: no canned output for src '${blockedSrc}' at path [${path.map((e) => e.type).join(", ")}]`);
2386
- return;
2387
- }
2388
- if (settled.done) {
2389
- pathsExplored++;
2390
- terminals.push({
2391
- status: "done",
2392
- path,
2393
- state: settled.snapshot.value
2394
- });
2395
- return;
2396
- }
2397
- const request = settled.requests[0];
2398
- const isPlan = request?.kind === "plan";
2399
- const branchEvents = request?.kind === "decision" || request?.kind === "plan" ? request.events.map((descriptor) => ({ type: descriptor.type })) : require_decision.getAcceptedEvents(settled.snapshot).map((descriptor) => ({ type: descriptor.type }));
2400
- if (branchEvents.length === 0) {
2401
- pathsExplored++;
2402
- terminals.push({
2403
- status: "idle",
2404
- path,
2405
- state: settled.snapshot.value
2406
- });
2407
- return;
2408
- }
2409
- if (depth >= maxDepth) {
2410
- pathsExplored++;
2411
- terminals.push({
2412
- status: "max-depth",
2413
- path,
2414
- state: settled.snapshot.value
2415
- });
2416
- unexplored.push(`max-depth: stopped at path [${path.map((e) => e.type).join(", ")}]`);
2417
- return;
2418
- }
2419
- for (const event of branchEvents) {
2420
- if (witness !== void 0 || pathsExplored >= maxPaths) {
2421
- if (pathsExplored >= maxPaths) hitPathCap = true;
2422
- return;
2423
- }
2424
- if (!(isPlan && event.type === "agent.plan.done") && !settled.snapshot.can(event)) {
2425
- prunedByGuard++;
2426
- continue;
2427
- }
2428
- const next = isPlan ? await resolveAgentRequests(machine, settled, { decide: async () => ({ event }) }) : transitionAgentStep(machine, settled, event);
2429
- recordState(next.snapshot);
2430
- await visit(next, [...path, event], depth + 1);
2431
- }
2432
- };
2433
- if (witness === void 0) await visit(initial, [], 0);
2434
- return {
2435
- report: {
2436
- reachedStates: reachedValues,
2437
- terminals,
2438
- prunedByGuard,
2439
- unexplored,
2440
- pathsExplored,
2441
- hitPathCap
2442
- },
2443
- witness
2444
- };
2445
- }
2446
- /**
2447
- * Enumerates a machine's decision and external-event branches to a bounded
2448
- * depth, model-free, and reports which states are reached and how each path
2449
- * terminates. At each decision request it forks one branch per candidate event
2450
- * (guard-rejected candidates are counted in `prunedByGuard`, not explored); at
2451
- * an idle wait it forks per externally-accepted event. A `agent.plan` request
2452
- * forks the same way — one branch per candidate, including the reserved
2453
- * `agent.plan.done` move — advancing each branch through the real plan protocol
2454
- * (`resolveAgentRequests`), so a plan can consume several depth units. Text/`userInput` invokes
2455
- * are resolved from `textOutputs` (a by-src canned-output map) — a missing src
2456
- * halts that branch with a `needs-output` terminal rather than throwing.
2457
- *
2458
- * Combinatorics are bounded by `maxDepth` (default 8) and `maxPaths` (default
2459
- * 200, reported via `hitPathCap`).
2460
- *
2461
- * @example
2462
- * ```ts
2463
- * const report = await explorePaths(refundMachine, { input: { request: 'x', amount: 5000 } });
2464
- * // report.terminals → both 'refunded' and 'denied'; report.prunedByGuard → 1
2465
- * ```
2466
- */
2467
- async function explorePaths(machine, options = {}) {
2468
- return (await explore(machine, options)).report;
2469
- }
2470
- /**
2471
- * Answers "can the machine reach `statePath`?" by exploring its branches (a
2472
- * thin wrapper over {@link explorePaths}). Returns `{ canReach: true, witness }`
2473
- * with the event sequence that reaches it, or `{ canReach: false }`.
2474
- *
2475
- * @example
2476
- * ```ts
2477
- * const { canReach, witness } = await canReach(refundMachine, 'denied', { input: { request: 'x', amount: 5000 } });
2478
- * // canReach → true; witness → [{ type: 'NEEDS_REVIEW' }, { type: 'DENY' }]
2479
- * ```
2480
- */
2481
- async function canReach(machine, statePath, options = {}) {
2482
- const { witness } = await explore(machine, options, (snapshot) => {
2483
- try {
2484
- return snapshot.matches(statePath);
2485
- } catch {
2486
- return false;
2487
- }
2488
- });
2489
- return witness !== void 0 ? {
2490
- canReach: true,
2491
- witness
2492
- } : { canReach: false };
2493
- }
2494
- //#endregion
2495
1531
  Object.defineProperty(exports, "AgentIdleError", {
2496
1532
  enumerable: true,
2497
1533
  get: function() {
@@ -2516,72 +1552,24 @@ Object.defineProperty(exports, "appendMessages", {
2516
1552
  return appendMessages;
2517
1553
  }
2518
1554
  });
2519
- Object.defineProperty(exports, "canReach", {
2520
- enumerable: true,
2521
- get: function() {
2522
- return canReach;
2523
- }
2524
- });
2525
1555
  Object.defineProperty(exports, "createAgentSchemas", {
2526
1556
  enumerable: true,
2527
1557
  get: function() {
2528
1558
  return createAgentSchemas;
2529
1559
  }
2530
1560
  });
2531
- Object.defineProperty(exports, "executeAgentRequest", {
2532
- enumerable: true,
2533
- get: function() {
2534
- return executeAgentRequest;
2535
- }
2536
- });
2537
- Object.defineProperty(exports, "explorePaths", {
2538
- enumerable: true,
2539
- get: function() {
2540
- return explorePaths;
2541
- }
2542
- });
2543
- Object.defineProperty(exports, "getAgentRequests", {
2544
- enumerable: true,
2545
- get: function() {
2546
- return getAgentRequests;
2547
- }
2548
- });
2549
- Object.defineProperty(exports, "initialAgentStep", {
2550
- enumerable: true,
2551
- get: function() {
2552
- return initialAgentStep;
2553
- }
2554
- });
2555
1561
  Object.defineProperty(exports, "inspectTransitions", {
2556
1562
  enumerable: true,
2557
1563
  get: function() {
2558
1564
  return inspectTransitions;
2559
1565
  }
2560
1566
  });
2561
- Object.defineProperty(exports, "lintAgentMachine", {
2562
- enumerable: true,
2563
- get: function() {
2564
- return lintAgentMachine;
2565
- }
2566
- });
2567
1567
  Object.defineProperty(exports, "messagesSchema", {
2568
1568
  enumerable: true,
2569
1569
  get: function() {
2570
1570
  return messagesSchema;
2571
1571
  }
2572
1572
  });
2573
- Object.defineProperty(exports, "resolveAgentRequests", {
2574
- enumerable: true,
2575
- get: function() {
2576
- return resolveAgentRequests;
2577
- }
2578
- });
2579
- Object.defineProperty(exports, "resolveAgentStep", {
2580
- enumerable: true,
2581
- get: function() {
2582
- return resolveAgentStep;
2583
- }
2584
- });
2585
1573
  Object.defineProperty(exports, "runAgent", {
2586
1574
  enumerable: true,
2587
1575
  get: function() {
@@ -2600,15 +1588,3 @@ Object.defineProperty(exports, "setupAgent", {
2600
1588
  return setupAgent;
2601
1589
  }
2602
1590
  });
2603
- Object.defineProperty(exports, "simulateAgent", {
2604
- enumerable: true,
2605
- get: function() {
2606
- return simulateAgent;
2607
- }
2608
- });
2609
- Object.defineProperty(exports, "transitionAgentStep", {
2610
- enumerable: true,
2611
- get: function() {
2612
- return transitionAgentStep;
2613
- }
2614
- });