@statelyai/agent 2.0.0-alpha.38 → 2.0.0-alpha.39
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +45 -0
- package/dist/{act-CrX0JwWY.cjs → act-B0CVbmo4.cjs} +1 -1
- package/dist/{act-B9hLQls6.mjs → act-Bsz-hUfD.mjs} +1 -1
- package/dist/ai-sdk.cjs +4 -4
- package/dist/ai-sdk.d.cts +2 -3
- package/dist/ai-sdk.d.mts +2 -3
- package/dist/ai-sdk.mjs +4 -4
- package/dist/{decision-m5hGmHpF.mjs → decision-B41YBx5U.mjs} +1 -1
- package/dist/{decision-CMeuNZ1g.cjs → decision-D8bcIGXQ.cjs} +1 -1
- package/dist/{decision-object-DBcLWVvv.d.cts → decision-object-BB8XV5Ec.d.cts} +1 -1
- package/dist/{decision-object-B5zGSPFp.d.mts → decision-object-CH_sE694.d.mts} +1 -1
- package/dist/effects-B9IvUPVh.mjs +23 -0
- package/dist/effects-DrWcUGgc.cjs +34 -0
- package/dist/evals.cjs +810 -0
- package/dist/evals.d.cts +595 -0
- package/dist/evals.d.mts +595 -0
- package/dist/evals.mjs +801 -0
- package/dist/{event-log-DkVlk3Rh.mjs → event-log-CEq_bVXQ.mjs} +8 -4
- package/dist/{event-log-Dkc-yIYu.cjs → event-log-dSOnXHuG.cjs} +7 -15
- package/dist/{event-log-store-Brx9tOHt.mjs → event-log-store-DLAfNM34.mjs} +1 -1
- package/dist/{event-log-store-BBS8so8a.d.mts → event-log-store-DYun526m.d.mts} +15 -14
- package/dist/{event-log-store-Cl-YWDnq.cjs → event-log-store-Dey9ufA4.cjs} +1 -1
- package/dist/{event-log-store-bc4ICGcS.d.cts → event-log-store-aFXK6yZX.d.cts} +15 -14
- package/dist/index.cjs +131 -93
- package/dist/index.d.cts +73 -134
- package/dist/index.d.mts +73 -134
- package/dist/index.mjs +112 -70
- package/dist/internal-BzlpzSux.d.cts +14 -0
- package/dist/internal-BzlpzSux.d.mts +14 -0
- package/dist/log.cjs +2 -3
- package/dist/log.d.cts +2 -2
- package/dist/log.d.mts +2 -2
- package/dist/log.mjs +3 -3
- package/dist/machines.cjs +1 -719
- package/dist/machines.d.cts +2 -424
- package/dist/machines.d.mts +2 -424
- package/dist/machines.mjs +2 -709
- package/dist/{model-source-kjGwqAV8.mjs → model-source-BrsLDvHL.mjs} +1 -1
- package/dist/{model-source-B4WQ8Idp.cjs → model-source-YpxjmWuX.cjs} +1 -1
- package/dist/openai.cjs +3 -3
- package/dist/openai.d.cts +2 -3
- package/dist/openai.d.mts +2 -3
- package/dist/openai.mjs +3 -3
- package/dist/otel.d.cts +1 -1
- package/dist/otel.d.mts +1 -1
- package/dist/policy.cjs +77 -0
- package/dist/policy.d.cts +143 -0
- package/dist/policy.d.mts +143 -0
- package/dist/policy.mjs +75 -0
- package/dist/{effects-BT_cSY0j.mjs → run-agent-BE7DOWD6.mjs} +150 -184
- package/dist/{run-agent-DlPzBWj-.d.mts → run-agent-DHlq87G7.d.mts} +18 -34
- package/dist/{effects-DDseYtJk.cjs → run-agent-De3xVFGw.cjs} +149 -201
- package/dist/{run-agent-30mH2moE.d.cts → run-agent-Dq0oSFRm.d.cts} +18 -34
- package/dist/{setup-agent-BDmNr6PC.mjs → setup-agent-CLm6QVGy.mjs} +3 -3
- package/dist/{setup-agent-BaNyz6Q3.d.cts → setup-agent-Cv8Hk3mX.d.cts} +12 -11
- package/dist/{setup-agent-C1CG_nfX.d.mts → setup-agent-DgFAhaPJ.d.mts} +12 -11
- package/dist/{setup-agent-CmEToB8y.cjs → setup-agent-Dv5VpuHe.cjs} +3 -3
- package/dist/tanstack-ai.cjs +4 -4
- package/dist/tanstack-ai.d.cts +2 -3
- package/dist/tanstack-ai.d.mts +2 -3
- package/dist/tanstack-ai.mjs +4 -4
- package/dist/testing.cjs +122 -996
- package/dist/testing.d.cts +36 -695
- package/dist/testing.d.mts +36 -695
- package/dist/testing.mjs +112 -977
- package/dist/{text-logic-BqxalgMr.d.mts → text-logic-x17uLBwA.d.cts} +238 -2
- package/dist/{text-logic-CSf9bqpP.d.cts → text-logic-x17uLBwA.d.mts} +238 -2
- package/dist/trajectory-BFjXaooB.d.cts +96 -0
- package/dist/trajectory-BFjXaooB.d.mts +96 -0
- package/dist/trajectory-BUXj_1Ue.mjs +152 -0
- package/dist/trajectory-CoZSv4wF.cjs +157 -0
- package/dist/{usage-Bm5nvpow.d.cts → usage-B4B-TQSV.d.mts} +1 -1
- package/dist/{usage-BnikdOca.d.mts → usage-DvGcoK6x.d.cts} +1 -1
- package/dist/{utils-7lSa4H-i.d.cts → utils-B8k-YPYI.d.mts} +23 -17
- package/dist/{utils-CBbKw2fM.d.mts → utils-DAclF-kw.d.cts} +23 -17
- package/dist/validate.cjs +4 -4
- package/dist/validate.d.cts +2 -2
- package/dist/validate.d.mts +2 -2
- package/dist/validate.mjs +4 -4
- package/dist/{verify-DJHfEfm6.d.cts → verify-BM0sGmsf.d.cts} +42 -6
- package/dist/{verify-ChyX6jq0.mjs → verify-CWlg3j7B.mjs} +153 -45
- package/dist/{verify-CwlombbC.cjs → verify-Dek6gHCS.cjs} +153 -45
- package/dist/{verify-i9Hiwc5g.d.mts → verify-H3Pr2gNw.d.mts} +42 -6
- package/dist/{with-model-calls-B_WLmOSl.cjs → with-model-calls-D50Ca6qW.cjs} +2 -2
- package/dist/{with-model-calls-BkOwdroS.mjs → with-model-calls-uY-KKliA.mjs} +2 -2
- package/docs/advanced.md +5 -5
- package/docs/choosing-a-run-mode.md +7 -7
- package/docs/debugging.md +6 -8
- package/docs/decisions.md +5 -4
- package/docs/environment-and-policy.md +1 -1
- package/docs/evals.md +57 -43
- package/docs/event-log.md +13 -15
- package/docs/from-a-loop.md +3 -3
- package/docs/generate-machines.md +4 -4
- package/docs/hosts.md +20 -27
- package/docs/human-in-the-loop.md +5 -8
- package/docs/index.md +4 -4
- package/docs/judgments.md +5 -7
- package/docs/langgraph-comparison.md +6 -6
- package/docs/machines-as-data.md +7 -12
- package/docs/machines-presets.md +17 -120
- package/docs/machines.md +13 -13
- package/docs/models-and-providers.md +19 -25
- package/docs/multi-agent.md +1 -1
- package/docs/observability.md +6 -8
- package/docs/persistence.md +10 -20
- package/docs/quickstart.md +3 -3
- package/docs/statechart-policy-examples.md +1 -1
- package/docs/steps.md +5 -6
- package/docs/strangler-fig.md +72 -7
- package/docs/text-requests.md +10 -12
- package/docs/thinking-in-state-machines.md +8 -8
- package/docs/tools.md +10 -12
- package/docs/upgrading.md +1 -1
- package/docs/usage-and-budgets.md +51 -56
- package/docs/validate-and-repair.md +9 -14
- package/docs/verify.md +53 -7
- package/docs/xstate-4-and-5-apps.md +19 -28
- package/llms.txt +1 -1
- package/package.json +31 -6
- package/readme.md +32 -24
- package/dist/internal-C3Lqu538.d.cts +0 -43
- package/dist/internal-DUcdhk-i.d.mts +0 -43
- package/dist/types-DQUOOaZO.d.cts +0 -238
- package/dist/types-DQUOOaZO.d.mts +0 -238
- package/skills/add-evals/SKILL.md +0 -152
- package/skills/add-traces/SKILL.md +0 -152
- package/skills/build-machine/SKILL.md +0 -84
- package/skills/generate-machine/SKILL.md +0 -335
- package/skills/graph-engineering/SKILL.md +0 -43
- package/skills/improve-machine/SKILL.md +0 -261
- package/skills/improve-machine/reference.md +0 -101
- package/skills/loop-to-machine/SKILL.md +0 -205
- package/skills/loop-to-machine/policy.md +0 -154
- package/skills/loop-to-machine/reference.md +0 -260
package/dist/index.mjs
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { $ as
|
|
2
|
-
import { a as createDecisionRequest, c as renderDecisionAttempts, d as GROUPED_EVENT_THRESHOLD, f as MAX_FINITE_PAYLOADS, h as getAcceptedEvents, i as createDecisionLogic, m as AgentInvalidEventPayloadError, s as isDecisionLogic, t as AgentDecisionExhaustedError, u as resolveDecision, v as parseAgentEvent } from "./decision-
|
|
3
|
-
import { i as isActLogic, n as DEFAULT_ACT_MAX_STEPS, t as ACT_STATE_EXITED } from "./act-
|
|
4
|
-
import { n as getAgentSchemas, r as setupAgent, t as createAgentSchemas } from "./setup-agent-
|
|
5
|
-
import {
|
|
6
|
-
import { t as
|
|
1
|
+
import { $ as getJsonSchemaSync, A as bindRequestExecutor, B as parseProviderOutput, C as AGENT_USAGE_EVENT_TYPE, G as getAgentExecutionOptions, I as getCallUsage, L as isTextLogic, M as createTextLogic, N as getAgentOutputMode, P as getCallFinishReason, Q as getJsonSchema, V as providerOutputSchema, W as executorBoundLogics, X as assistantMessage, at as systemMessage, et as getMessageText, i as AgentMachineVersionMismatchError, mt as AgentTruncatedError, nt as getStatePath, ot as toolMessage, pt as AgentError, rt as isStandardSchema, st as userMessage, tt as getStateMeta, z as parseOutput } from "./event-log-CEq_bVXQ.mjs";
|
|
2
|
+
import { a as createDecisionRequest, c as renderDecisionAttempts, d as GROUPED_EVENT_THRESHOLD, f as MAX_FINITE_PAYLOADS, h as getAcceptedEvents, i as createDecisionLogic, m as AgentInvalidEventPayloadError, s as isDecisionLogic, t as AgentDecisionExhaustedError, u as resolveDecision, v as parseAgentEvent } from "./decision-B41YBx5U.mjs";
|
|
3
|
+
import { i as isActLogic, n as DEFAULT_ACT_MAX_STEPS, t as ACT_STATE_EXITED } from "./act-Bsz-hUfD.mjs";
|
|
4
|
+
import { n as getAgentSchemas, r as setupAgent, t as createAgentSchemas } from "./setup-agent-CLm6QVGy.mjs";
|
|
5
|
+
import { t as AgentEventLogConflictError } from "./event-log-store-DLAfNM34.mjs";
|
|
6
|
+
import { _ as traceTransitions, a as bindChildMachineForProvide, c as createAgentInbox, d as isAgentIdle, f as isStateMachineLogic, g as toJsonValue, h as serializeTraceEvent, i as bindActForProvide, l as createAgentRuntime, n as AgentMaxModelCallsExceededError, o as bindDecisionForProvide, p as runAgent, r as AgentSnapshotDivergedError, s as bindTextForProvide, t as AGENT_TRACE_SCHEMA_VERSION, u as getConfiguredInvokeSrcs } from "./run-agent-BE7DOWD6.mjs";
|
|
7
|
+
import { n as mapEffects, t as isAsyncIterable } from "./effects-B9IvUPVh.mjs";
|
|
7
8
|
import { createAsyncLogic, machineToJSON } from "xstate";
|
|
8
9
|
import { parse } from "acorn";
|
|
9
10
|
//#region src/messages.ts
|
|
@@ -866,76 +867,117 @@ function describeMachine(machine, options = {}) {
|
|
|
866
867
|
return lines.join("\n");
|
|
867
868
|
}
|
|
868
869
|
//#endregion
|
|
869
|
-
//#region src/
|
|
870
|
+
//#region src/generator-bridge.ts
|
|
871
|
+
/** A `runAgent` result that settled with an error. */
|
|
872
|
+
function isFailedRun(value) {
|
|
873
|
+
return typeof value === "object" && value !== null && value.status === "error" && "error" in value;
|
|
874
|
+
}
|
|
870
875
|
/**
|
|
871
|
-
*
|
|
872
|
-
*
|
|
873
|
-
*
|
|
874
|
-
*
|
|
876
|
+
* A backpressured hand-off between an actor and an async generator's
|
|
877
|
+
* consumer, for a loop whose public surface is an `AsyncGenerator`: the
|
|
878
|
+
* machine owns the loop head, each pass is an actor, and the events it
|
|
879
|
+
* yields still reach the consumer one pull at a time.
|
|
875
880
|
*
|
|
876
|
-
*
|
|
877
|
-
* like any other decider's choice. The policy's input must be JSON (it opens
|
|
878
|
-
* the policy run's event log): the default drops keys whose value is
|
|
879
|
-
* `undefined`, and any other value that is not JSON throws before the run. The policy's token usage is reported on the
|
|
880
|
-
* result, and left out when the policy made no model call. A run that does not
|
|
881
|
-
* end `done` with an event throws `AgentError` with code `policy-not-done`.
|
|
881
|
+
* One bridge serves one run.
|
|
882
882
|
*
|
|
883
883
|
* @example
|
|
884
|
-
* ```ts
|
|
885
|
-
*
|
|
886
|
-
*
|
|
884
|
+
* ```ts
|
|
885
|
+
* async function* carvedLoop(input: Input): AsyncGenerator<Event, Result> {
|
|
886
|
+
* const bridge = createGeneratorBridge<Event>();
|
|
887
|
+
* const pass = createAsyncLogic({
|
|
888
|
+
* run: async () => {
|
|
889
|
+
* const step = await bridge.forward(legacyPass(input));
|
|
890
|
+
* return step.closed ? { kind: "closed" } : step.value;
|
|
891
|
+
* },
|
|
892
|
+
* });
|
|
893
|
+
* const result = yield* bridge.stream(runAgent(loopMachine, { input, actors: { pass } }));
|
|
894
|
+
* if (result.status === "error") throw result.error;
|
|
895
|
+
* return toResult(result);
|
|
896
|
+
* }
|
|
887
897
|
* ```
|
|
888
898
|
*/
|
|
889
|
-
function
|
|
890
|
-
const
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
899
|
+
function createGeneratorBridge() {
|
|
900
|
+
const queue = [];
|
|
901
|
+
let wake;
|
|
902
|
+
let ended = false;
|
|
903
|
+
const notify = () => {
|
|
904
|
+
const resume = wake;
|
|
905
|
+
wake = void 0;
|
|
906
|
+
resume?.();
|
|
907
|
+
};
|
|
908
|
+
const put = (value) => {
|
|
909
|
+
if (ended) return Promise.resolve(false);
|
|
910
|
+
return new Promise((pulled, threw) => {
|
|
911
|
+
queue.push({
|
|
912
|
+
value,
|
|
913
|
+
pulled,
|
|
914
|
+
threw
|
|
915
|
+
});
|
|
916
|
+
notify();
|
|
901
917
|
});
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
918
|
+
};
|
|
919
|
+
return {
|
|
920
|
+
put,
|
|
921
|
+
async forward(generator) {
|
|
922
|
+
let closed = false;
|
|
923
|
+
let step = await generator.next();
|
|
924
|
+
while (!step.done) {
|
|
925
|
+
let pulled;
|
|
926
|
+
try {
|
|
927
|
+
pulled = await put(step.value);
|
|
928
|
+
} catch (error) {
|
|
929
|
+
step = await generator.throw(error);
|
|
930
|
+
continue;
|
|
931
|
+
}
|
|
932
|
+
if (pulled || closed) step = await generator.next();
|
|
933
|
+
else {
|
|
934
|
+
closed = true;
|
|
935
|
+
step = await generator.return(void 0);
|
|
936
|
+
}
|
|
937
|
+
}
|
|
938
|
+
return {
|
|
939
|
+
closed,
|
|
940
|
+
value: step.value
|
|
941
|
+
};
|
|
942
|
+
},
|
|
943
|
+
stream(settled) {
|
|
944
|
+
const end = () => {
|
|
945
|
+
ended = true;
|
|
946
|
+
for (const item of queue.splice(0)) item.pulled(false);
|
|
947
|
+
notify();
|
|
948
|
+
};
|
|
949
|
+
Promise.resolve(settled).then(end, end);
|
|
950
|
+
const next = async () => {
|
|
951
|
+
while (!queue.length && !ended) await new Promise((resolve) => wake = resolve);
|
|
952
|
+
return queue.shift();
|
|
953
|
+
};
|
|
954
|
+
const loop = async function* (stopped) {
|
|
955
|
+
while (true) {
|
|
956
|
+
const item = await next();
|
|
957
|
+
if (!item) {
|
|
958
|
+
const result = await settled;
|
|
959
|
+
if (stopped && isFailedRun(result)) throw result.error;
|
|
960
|
+
return result;
|
|
961
|
+
}
|
|
962
|
+
let resumed = false;
|
|
963
|
+
try {
|
|
964
|
+
yield item.value;
|
|
965
|
+
resumed = true;
|
|
966
|
+
item.pulled(true);
|
|
967
|
+
} catch (error) {
|
|
968
|
+
resumed = true;
|
|
969
|
+
item.threw(error);
|
|
970
|
+
} finally {
|
|
971
|
+
if (!resumed) {
|
|
972
|
+
item.pulled(false);
|
|
973
|
+
return yield* loop(true);
|
|
974
|
+
}
|
|
975
|
+
}
|
|
976
|
+
}
|
|
977
|
+
};
|
|
978
|
+
return loop(false);
|
|
905
979
|
}
|
|
906
|
-
const event = result.output;
|
|
907
|
-
if (!isRecord(event) || typeof event.type !== "string") throw new AgentError("policy-not-done", `policy '${id}' output is not an event: ${JSON.stringify(event)}`);
|
|
908
|
-
const { modelCalls, ...usage } = result.usage;
|
|
909
|
-
return {
|
|
910
|
-
event,
|
|
911
|
-
...modelCalls > 0 ? { usage } : {}
|
|
912
|
-
};
|
|
913
980
|
};
|
|
914
|
-
async function policyThread(request, policyInput, info) {
|
|
915
|
-
if (threadId) return threadId(request, info);
|
|
916
|
-
if (info?.callKey) return `policy:${info.callKey}:${await sha256(canonicalEventJson(policyInput))}`;
|
|
917
|
-
throw new AgentError("missing-thread-id", `policy '${id}' has a store but no threadId, and the decision came with no callKey to derive one from`);
|
|
918
|
-
}
|
|
919
|
-
}
|
|
920
|
-
function defaultInput(request) {
|
|
921
|
-
const facts = request.metadata?.facts;
|
|
922
|
-
return withoutUndefinedKeys({
|
|
923
|
-
facts,
|
|
924
|
-
options: (request.options ?? []).map((option) => option.event),
|
|
925
|
-
system: request.system,
|
|
926
|
-
prompt: request.prompt
|
|
927
|
-
});
|
|
928
|
-
}
|
|
929
|
-
/** A copy of `value` with every object key whose value is `undefined` removed, at any depth. */
|
|
930
|
-
function withoutUndefinedKeys(value) {
|
|
931
|
-
if (Array.isArray(value)) return value.map(withoutUndefinedKeys);
|
|
932
|
-
if (!isRecord(value) || ![Object.prototype, null].includes(Object.getPrototypeOf(value))) return value;
|
|
933
|
-
return Object.fromEntries(Object.entries(value).filter(([, child]) => child !== void 0).map(([key, child]) => [key, withoutUndefinedKeys(child)]));
|
|
934
|
-
}
|
|
935
|
-
/** Hex SHA-256 of `text`, with Web Crypto (Node, browsers, workers). */
|
|
936
|
-
async function sha256(text) {
|
|
937
|
-
const digest = await crypto.subtle.digest("SHA-256", new TextEncoder().encode(text));
|
|
938
|
-
return Array.from(new Uint8Array(digest), (byte) => byte.toString(16).padStart(2, "0")).join("");
|
|
939
981
|
}
|
|
940
982
|
//#endregion
|
|
941
983
|
//#region src/wrap-workflow.ts
|
|
@@ -1217,12 +1259,12 @@ function wrapWorkflow(config) {
|
|
|
1217
1259
|
return {
|
|
1218
1260
|
machine,
|
|
1219
1261
|
async run(input, options = {}) {
|
|
1220
|
-
const { effects: overrides, recorder, ...runOptions } = options;
|
|
1262
|
+
const { effects: overrides, recorder, recordOptions, ...runOptions } = options;
|
|
1221
1263
|
let effects = {
|
|
1222
1264
|
...mapEffects(config.effects, (_name, effect) => effect),
|
|
1223
1265
|
...overrides ? mapEffects(overrides, (_name, effect) => effect) : {}
|
|
1224
1266
|
};
|
|
1225
|
-
if (recorder) effects = mapEffects(effects, (name, effect) => recorder.fn(name, effect));
|
|
1267
|
+
if (recorder) effects = mapEffects(effects, (name, effect) => recorder.fn(name, effect, recordOptions?.[name]));
|
|
1226
1268
|
const { signal: _signal, ...agentOptions } = runOptions;
|
|
1227
1269
|
const result = await runAgent(machine, {
|
|
1228
1270
|
...agentOptions,
|
|
@@ -1359,4 +1401,4 @@ function missingExecutorError(src, kind, executor) {
|
|
|
1359
1401
|
return /* @__PURE__ */ new Error(`provideExecutors: actor source '${src}' is a ${kind} source but no '${executor}' executor was provided. Add it to the executors object, or bind the source with its own executor (logic.withExecutor(...)) before calling provideExecutors.`);
|
|
1360
1402
|
}
|
|
1361
1403
|
//#endregion
|
|
1362
|
-
export { ACT_STATE_EXITED, AGENT_TRACE_SCHEMA_VERSION, AGENT_USAGE_EVENT_TYPE, AgentDecisionExhaustedError, AgentError, AgentEventLogConflictError, AgentInvalidEventPayloadError, AgentMachineVersionMismatchError, AgentMaxModelCallsExceededError, AgentSnapshotDivergedError, AgentTruncatedError, DEFAULT_ACT_MAX_STEPS, GROUPED_EVENT_THRESHOLD, MAX_FINITE_PAYLOADS, assistantMessage, bindRequestExecutor, createAgentInbox, createAgentRuntime, createAgentSchemas, createDecisionLogic, createDecisionRequest,
|
|
1404
|
+
export { ACT_STATE_EXITED, AGENT_TRACE_SCHEMA_VERSION, AGENT_USAGE_EVENT_TYPE, AgentDecisionExhaustedError, AgentError, AgentEventLogConflictError, AgentInvalidEventPayloadError, AgentMachineVersionMismatchError, AgentMaxModelCallsExceededError, AgentSnapshotDivergedError, AgentTruncatedError, DEFAULT_ACT_MAX_STEPS, GROUPED_EVENT_THRESHOLD, MAX_FINITE_PAYLOADS, assistantMessage, bindRequestExecutor, createAgentInbox, createAgentRuntime, createAgentSchemas, createDecisionLogic, createDecisionRequest, createGeneratorBridge, createTextLogic, describeMachine, eventFromInteraction, getAcceptedEvents, getAgentOutputMode, getAgentSchemas, getCallFinishReason, getCallUsage, getInteraction, getJsonSchema, getJsonSchemaSync, getMessageText, getStateMeta, getStatePath, interactionMetaSchema, isAgentIdle, isAgentMessages, isStandardSchema, messagesSchema, parseAgentEvent, parseOutput, parseProviderOutput, provideExecutors, providerOutputSchema, renderDecisionAttempts, resolveDecision, runAgent, serializeTraceEvent, setupAgent, systemMessage, toolMessage, traceTransitions, userMessage, wrapWorkflow };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { AnyActorRef, EventObject, MachineContext, MetaObject, StateMachine, StateSchema, StateValue } from "xstate";
|
|
2
|
+
//#region src/machines/internal.d.ts
|
|
3
|
+
/**
|
|
4
|
+
* The machine type a preset factory returns: its context, event union, input
|
|
5
|
+
* and output are all concrete, so callers get typed run input and
|
|
6
|
+
* output instead of `AnyStateMachine`. The remaining slots (children, state
|
|
7
|
+
* value/tags/config, source maps) are left permissive — a preset builds its
|
|
8
|
+
* states dynamically, so there is no literal state schema to infer.
|
|
9
|
+
*
|
|
10
|
+
* @internal
|
|
11
|
+
*/
|
|
12
|
+
type PresetMachine<TContext extends MachineContext, TInput, TOutput, TEvent extends EventObject = EventObject> = StateMachine<TContext, TEvent, Record<string, AnyActorRef | undefined>, StateValue, string, TInput, TOutput, EventObject, MetaObject, StateSchema, any, any, any, any>;
|
|
13
|
+
//#endregion
|
|
14
|
+
export { PresetMachine as t };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { AnyActorRef, EventObject, MachineContext, MetaObject, StateMachine, StateSchema, StateValue } from "xstate";
|
|
2
|
+
//#region src/machines/internal.d.ts
|
|
3
|
+
/**
|
|
4
|
+
* The machine type a preset factory returns: its context, event union, input
|
|
5
|
+
* and output are all concrete, so callers get typed run input and
|
|
6
|
+
* output instead of `AnyStateMachine`. The remaining slots (children, state
|
|
7
|
+
* value/tags/config, source maps) are left permissive — a preset builds its
|
|
8
|
+
* states dynamically, so there is no literal state schema to infer.
|
|
9
|
+
*
|
|
10
|
+
* @internal
|
|
11
|
+
*/
|
|
12
|
+
type PresetMachine<TContext extends MachineContext, TInput, TOutput, TEvent extends EventObject = EventObject> = StateMachine<TContext, TEvent, Record<string, AnyActorRef | undefined>, StateValue, string, TInput, TOutput, EventObject, MetaObject, StateSchema, any, any, any, any>;
|
|
13
|
+
//#endregion
|
|
14
|
+
export { PresetMachine as t };
|
package/dist/log.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_event_log = require("./event-log-
|
|
3
|
-
const require_event_log_store = require("./event-log-store-
|
|
2
|
+
const require_event_log = require("./event-log-dSOnXHuG.cjs");
|
|
3
|
+
const require_event_log_store = require("./event-log-store-Dey9ufA4.cjs");
|
|
4
4
|
//#region src/event-log-store-conformance.ts
|
|
5
5
|
/**
|
|
6
6
|
* The runner-agnostic conformance suite for {@link AgentEventLogStore}
|
|
@@ -478,7 +478,6 @@ exports.getLogExecutionId = require_event_log.getLogExecutionId;
|
|
|
478
478
|
exports.getSnapshotStateHash = require_event_log.getSnapshotStateHash;
|
|
479
479
|
exports.getUsageFromEvents = require_event_log.getUsageFromEvents;
|
|
480
480
|
exports.initEntry = require_event_log.initEntry;
|
|
481
|
-
exports.rebindActorSession = require_event_log.rebindActorSession;
|
|
482
481
|
exports.recordLog = require_event_log.recordLog;
|
|
483
482
|
exports.replay = require_event_log.replay;
|
|
484
483
|
exports.validateReplayEntries = require_event_log.validateReplayEntries;
|
package/dist/log.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as
|
|
1
|
+
import { A as recordLog, C as createReplayEntry, D as getSnapshotStateHash, E as getLogExecutionId, M as validateReplayEntries, O as getUsageFromEvents, S as assertJsonSerializable, T as getDecisionAttempts, _ as NonSerializableAgentEventError, a as AGENT_INIT_EVENT_TYPE, b as agentCallOccurrence, c as AgentLogEntry, d as AgentMachineVersionMismatchError, f as AgentPersistedSnapshot, g as LogRecorder, h as JsonValue, i as AGENT_EVENT_SCHEMA_VERSION, j as replay, k as initEntry, l as AgentLogInit, m as CreateReplayEntryOptions, n as AgentEventLogStore, o as AgentEventLogError, p as AgentReplayDivergenceError, r as createInMemoryEventLogStore, s as AgentInitEvent, t as AgentEventLogConflictError, u as AgentLogVerification, v as ReplayOptions, w as forkEventLog, x as assertAgentLogEntry, y as ReplayResult } from "./event-log-store-aFXK6yZX.cjs";
|
|
2
2
|
//#region src/event-log-store-conformance.d.ts
|
|
3
3
|
/** Produces a fresh, empty store for one case. */
|
|
4
4
|
type CreateStore = () => Promise<AgentEventLogStore> | AgentEventLogStore;
|
|
@@ -29,4 +29,4 @@ interface EventLogStoreConformanceHarness {
|
|
|
29
29
|
*/
|
|
30
30
|
export declare function assertEventLogStoreConformance(create: CreateStore, harness?: EventLogStoreConformanceHarness): Promise<void>;
|
|
31
31
|
//#endregion
|
|
32
|
-
export { AGENT_EVENT_SCHEMA_VERSION, AGENT_INIT_EVENT_TYPE, AgentEventLogConflictError, AgentEventLogError, type AgentEventLogStore, type AgentInitEvent, type AgentLogEntry, type AgentLogInit, type AgentLogVerification, AgentMachineVersionMismatchError, type AgentPersistedSnapshot, AgentReplayDivergenceError, type CreateReplayEntryOptions, type EventLogStoreConformanceHarness, type JsonValue, type LogRecorder, NonSerializableAgentEventError, type ReplayOptions, type ReplayResult, agentCallOccurrence, assertAgentLogEntry, assertJsonSerializable, createInMemoryEventLogStore, createReplayEntry, forkEventLog, getDecisionAttempts, getLogExecutionId, getSnapshotStateHash, getUsageFromEvents, initEntry,
|
|
32
|
+
export { AGENT_EVENT_SCHEMA_VERSION, AGENT_INIT_EVENT_TYPE, AgentEventLogConflictError, AgentEventLogError, type AgentEventLogStore, type AgentInitEvent, type AgentLogEntry, type AgentLogInit, type AgentLogVerification, AgentMachineVersionMismatchError, type AgentPersistedSnapshot, AgentReplayDivergenceError, type CreateReplayEntryOptions, type EventLogStoreConformanceHarness, type JsonValue, type LogRecorder, NonSerializableAgentEventError, type ReplayOptions, type ReplayResult, agentCallOccurrence, assertAgentLogEntry, assertJsonSerializable, createInMemoryEventLogStore, createReplayEntry, forkEventLog, getDecisionAttempts, getLogExecutionId, getSnapshotStateHash, getUsageFromEvents, initEntry, recordLog, replay, validateReplayEntries };
|
package/dist/log.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as
|
|
1
|
+
import { A as recordLog, C as createReplayEntry, D as getSnapshotStateHash, E as getLogExecutionId, M as validateReplayEntries, O as getUsageFromEvents, S as assertJsonSerializable, T as getDecisionAttempts, _ as NonSerializableAgentEventError, a as AGENT_INIT_EVENT_TYPE, b as agentCallOccurrence, c as AgentLogEntry, d as AgentMachineVersionMismatchError, f as AgentPersistedSnapshot, g as LogRecorder, h as JsonValue, i as AGENT_EVENT_SCHEMA_VERSION, j as replay, k as initEntry, l as AgentLogInit, m as CreateReplayEntryOptions, n as AgentEventLogStore, o as AgentEventLogError, p as AgentReplayDivergenceError, r as createInMemoryEventLogStore, s as AgentInitEvent, t as AgentEventLogConflictError, u as AgentLogVerification, v as ReplayOptions, w as forkEventLog, x as assertAgentLogEntry, y as ReplayResult } from "./event-log-store-DYun526m.mjs";
|
|
2
2
|
//#region src/event-log-store-conformance.d.ts
|
|
3
3
|
/** Produces a fresh, empty store for one case. */
|
|
4
4
|
type CreateStore = () => Promise<AgentEventLogStore> | AgentEventLogStore;
|
|
@@ -29,4 +29,4 @@ interface EventLogStoreConformanceHarness {
|
|
|
29
29
|
*/
|
|
30
30
|
export declare function assertEventLogStoreConformance(create: CreateStore, harness?: EventLogStoreConformanceHarness): Promise<void>;
|
|
31
31
|
//#endregion
|
|
32
|
-
export { AGENT_EVENT_SCHEMA_VERSION, AGENT_INIT_EVENT_TYPE, AgentEventLogConflictError, AgentEventLogError, type AgentEventLogStore, type AgentInitEvent, type AgentLogEntry, type AgentLogInit, type AgentLogVerification, AgentMachineVersionMismatchError, type AgentPersistedSnapshot, AgentReplayDivergenceError, type CreateReplayEntryOptions, type EventLogStoreConformanceHarness, type JsonValue, type LogRecorder, NonSerializableAgentEventError, type ReplayOptions, type ReplayResult, agentCallOccurrence, assertAgentLogEntry, assertJsonSerializable, createInMemoryEventLogStore, createReplayEntry, forkEventLog, getDecisionAttempts, getLogExecutionId, getSnapshotStateHash, getUsageFromEvents, initEntry,
|
|
32
|
+
export { AGENT_EVENT_SCHEMA_VERSION, AGENT_INIT_EVENT_TYPE, AgentEventLogConflictError, AgentEventLogError, type AgentEventLogStore, type AgentInitEvent, type AgentLogEntry, type AgentLogInit, type AgentLogVerification, AgentMachineVersionMismatchError, type AgentPersistedSnapshot, AgentReplayDivergenceError, type CreateReplayEntryOptions, type EventLogStoreConformanceHarness, type JsonValue, type LogRecorder, NonSerializableAgentEventError, type ReplayOptions, type ReplayResult, agentCallOccurrence, assertAgentLogEntry, assertJsonSerializable, createInMemoryEventLogStore, createReplayEntry, forkEventLog, getDecisionAttempts, getLogExecutionId, getSnapshotStateHash, getUsageFromEvents, initEntry, recordLog, replay, validateReplayEntries };
|
package/dist/log.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { n as createInMemoryEventLogStore, t as AgentEventLogConflictError } from "./event-log-store-
|
|
1
|
+
import { S as validateReplayEntries, _ as getSnapshotStateHash, a as AgentReplayDivergenceError, b as recordLog, f as createReplayEntry, g as getLogExecutionId, h as getDecisionAttempts, i as AgentMachineVersionMismatchError, l as assertAgentLogEntry, m as forkEventLog, n as AGENT_INIT_EVENT_TYPE, o as NonSerializableAgentEventError, r as AgentEventLogError, s as agentCallOccurrence, t as AGENT_EVENT_SCHEMA_VERSION, u as assertJsonSerializable, v as getUsageFromEvents, x as replay, y as initEntry } from "./event-log-CEq_bVXQ.mjs";
|
|
2
|
+
import { n as createInMemoryEventLogStore, t as AgentEventLogConflictError } from "./event-log-store-DLAfNM34.mjs";
|
|
3
3
|
//#region src/event-log-store-conformance.ts
|
|
4
4
|
/**
|
|
5
5
|
* The runner-agnostic conformance suite for {@link AgentEventLogStore}
|
|
@@ -458,4 +458,4 @@ async function assertEventLogStoreConformance(create, harness) {
|
|
|
458
458
|
for (const testCase of cases) await testCase.run(create);
|
|
459
459
|
}
|
|
460
460
|
//#endregion
|
|
461
|
-
export { AGENT_EVENT_SCHEMA_VERSION, AGENT_INIT_EVENT_TYPE, AgentEventLogConflictError, AgentEventLogError, AgentMachineVersionMismatchError, AgentReplayDivergenceError, NonSerializableAgentEventError, agentCallOccurrence, assertAgentLogEntry, assertEventLogStoreConformance, assertJsonSerializable, createInMemoryEventLogStore, createReplayEntry, forkEventLog, getDecisionAttempts, getLogExecutionId, getSnapshotStateHash, getUsageFromEvents, initEntry,
|
|
461
|
+
export { AGENT_EVENT_SCHEMA_VERSION, AGENT_INIT_EVENT_TYPE, AgentEventLogConflictError, AgentEventLogError, AgentMachineVersionMismatchError, AgentReplayDivergenceError, NonSerializableAgentEventError, agentCallOccurrence, assertAgentLogEntry, assertEventLogStoreConformance, assertJsonSerializable, createInMemoryEventLogStore, createReplayEntry, forkEventLog, getDecisionAttempts, getLogExecutionId, getSnapshotStateHash, getUsageFromEvents, initEntry, recordLog, replay, validateReplayEntries };
|