@statelyai/agent 2.0.0-alpha.38 → 2.0.0-alpha.40
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 +59 -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 +142 -97
- package/dist/index.d.cts +97 -141
- package/dist/index.d.mts +97 -141
- package/dist/index.mjs +123 -74
- 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/machine-input-0YTPcnCm.mjs +27 -0
- package/dist/machine-input-DU3owLUr.cjs +32 -0
- 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/{run-agent-DlPzBWj-.d.mts → run-agent-BO9RSb7i.d.cts} +33 -40
- package/dist/{run-agent-30mH2moE.d.cts → run-agent-BxkeuAYR.d.mts} +33 -40
- package/dist/{effects-DDseYtJk.cjs → run-agent-COdR9FpM.cjs} +175 -228
- package/dist/{effects-BT_cSY0j.mjs → run-agent-D3gW9wfd.mjs} +176 -211
- 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-CIu4mqIZ.d.mts} +56 -6
- package/dist/{verify-i9Hiwc5g.d.mts → verify-CTHlmBbh.d.cts} +56 -6
- package/dist/{verify-ChyX6jq0.mjs → verify-Cacz6XSk.mjs} +170 -46
- package/dist/{verify-CwlombbC.cjs → verify-D8UDqU4l.cjs} +170 -46
- 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 +25 -30
- 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 +105 -33
- 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 +54 -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
|
@@ -1002,6 +1002,7 @@ function assertAgentLogEntry(entry) {
|
|
|
1002
1002
|
if (candidate.verification !== void 0 && (candidate.verification === null || typeof candidate.verification !== "object" || typeof candidate.verification.stateHash !== "string" || !candidate.verification.stateHash)) throw new AgentEventLogError("Agent event entry.verification requires a non-empty stateHash string.");
|
|
1003
1003
|
if (candidate.attempts !== void 0) assertLogAttempts(candidate.attempts);
|
|
1004
1004
|
if (candidate.decidedBy !== void 0) requireNonEmptyString(candidate.decidedBy, "entry.decidedBy", " when present");
|
|
1005
|
+
if (candidate.ignored !== void 0 && candidate.ignored !== true) throw new AgentEventLogError("Agent event entry.ignored must be true when present.");
|
|
1005
1006
|
if (candidate.actorPath !== void 0 && (!Array.isArray(candidate.actorPath) || candidate.actorPath.length === 0 || !candidate.actorPath.every((id) => typeof id === "string" && id !== ""))) throw new AgentEventLogError("Agent event entry.actorPath must be a non-empty array of invoke ids when present.");
|
|
1006
1007
|
}
|
|
1007
1008
|
function assertLogAttempts(attempts) {
|
|
@@ -1641,7 +1642,9 @@ function foldLog(machine, entries, options = {}) {
|
|
|
1641
1642
|
* Records a plain `createActor` run as an event log, with no
|
|
1642
1643
|
* `createAgentRuntime`: the init entry (the actor's `input`, or the snapshot
|
|
1643
1644
|
* it was created from), then every event the root machine processed, invoke
|
|
1644
|
-
* completions with their outputs inline.
|
|
1645
|
+
* completions with their outputs inline. A sent event the machine had no
|
|
1646
|
+
* transition for is recorded too, marked `ignored`. Attach it before
|
|
1647
|
+
* `actor.start()`.
|
|
1645
1648
|
*
|
|
1646
1649
|
* @example
|
|
1647
1650
|
* ```ts no-check
|
|
@@ -1660,7 +1663,7 @@ function recordLog(actor) {
|
|
|
1660
1663
|
let fold;
|
|
1661
1664
|
let failure;
|
|
1662
1665
|
const restored = actor._restored ? actor.getPersistedSnapshot() : void 0;
|
|
1663
|
-
const record = (event) => {
|
|
1666
|
+
const record = (event, ignored) => {
|
|
1664
1667
|
if (fold === void 0) {
|
|
1665
1668
|
if (event.type !== "xstate.init") throw new AgentEventLogError("recordLog must be attached before actor.start(): it missed the init event.");
|
|
1666
1669
|
const init = restored ? { snapshot: restored } : { input: event.input };
|
|
@@ -1675,13 +1678,14 @@ function recordLog(actor) {
|
|
|
1675
1678
|
machineVersion,
|
|
1676
1679
|
verification: false
|
|
1677
1680
|
});
|
|
1681
|
+
if (ignored) entry.ignored = true;
|
|
1678
1682
|
entry.verification = { stateHash: getSnapshotStateHash(fold.apply(entry)) };
|
|
1679
1683
|
entries.push(entry);
|
|
1680
1684
|
};
|
|
1681
1685
|
const subscription = actor.system.inspect((inspectionEvent) => {
|
|
1682
1686
|
if (failure !== void 0 || inspectionEvent.type !== "@xstate.transition" || inspectionEvent.actorRef !== actor) return;
|
|
1683
1687
|
try {
|
|
1684
|
-
record(inspectionEvent.event);
|
|
1688
|
+
record(inspectionEvent.event, inspectionEvent.microsteps.length === 0 && !inspectionEvent.event.type.startsWith("xstate."));
|
|
1685
1689
|
} catch (error) {
|
|
1686
1690
|
failure = error;
|
|
1687
1691
|
}
|
|
@@ -1696,4 +1700,4 @@ function recordLog(actor) {
|
|
|
1696
1700
|
};
|
|
1697
1701
|
}
|
|
1698
1702
|
//#endregion
|
|
1699
|
-
export {
|
|
1703
|
+
export { getJsonSchemaSync as $, bindRequestExecutor as A, parseProviderOutput as B, AGENT_USAGE_EVENT_TYPE as C, DECIDE_ACTOR as D, AGENT_USAGE_TOKEN_FIELDS as E, getCallModelCalls as F, getAgentExecutionOptions as G, resolveTextLogicValue as H, getCallUsage as I, missingActor as J, getRegisteredAgentExecutionOptions as K, isTextLogic as L, createTextLogic as M, getAgentOutputMode as N, GENERATE_TEXT_ACTOR as O, getCallFinishReason as P, getJsonSchema as Q, normalizeGeneratorResult as R, validateReplayEntries as S, ACT_ACTOR as T, responseMessagesOf as U, providerOutputSchema as V, executorBoundLogics as W, assistantMessage as X, setAgentExecutionOptions as Y, findNonSerializableContextPaths as Z, getSnapshotStateHash as _, AgentReplayDivergenceError as a, systemMessage as at, recordLog as b, agentCallSite as c, validateSchemaSync as ct, canonicalEventJson as d, isPlainObject as dt, getMessageText as et, createReplayEntry as f, isRecord as ft, getLogExecutionId as g, getDecisionAttempts as h, AgentMachineVersionMismatchError as i, resolveMachineVersion as it, builtinTextActors as j, STREAM_TEXT_ACTOR as k, assertAgentLogEntry as l, canonicalJson as lt, forkEventLog as m, AgentTruncatedError as mt, AGENT_INIT_EVENT_TYPE as n, getStatePath as nt, NonSerializableAgentEventError as o, toolMessage as ot, foldLog as p, AgentError as pt, isUnboundPlaceholder as q, AgentEventLogError as r, isStandardSchema as rt, agentCallOccurrence as s, userMessage as st, AGENT_EVENT_SCHEMA_VERSION as t, getStateMeta as tt, assertJsonSerializable as u, isError as ut, getUsageFromEvents as v, restoreMachineSnapshot as w, replay as x, initEntry as y, parseOutput as z };
|
|
@@ -1002,6 +1002,7 @@ function assertAgentLogEntry(entry) {
|
|
|
1002
1002
|
if (candidate.verification !== void 0 && (candidate.verification === null || typeof candidate.verification !== "object" || typeof candidate.verification.stateHash !== "string" || !candidate.verification.stateHash)) throw new AgentEventLogError("Agent event entry.verification requires a non-empty stateHash string.");
|
|
1003
1003
|
if (candidate.attempts !== void 0) assertLogAttempts(candidate.attempts);
|
|
1004
1004
|
if (candidate.decidedBy !== void 0) requireNonEmptyString(candidate.decidedBy, "entry.decidedBy", " when present");
|
|
1005
|
+
if (candidate.ignored !== void 0 && candidate.ignored !== true) throw new AgentEventLogError("Agent event entry.ignored must be true when present.");
|
|
1005
1006
|
if (candidate.actorPath !== void 0 && (!Array.isArray(candidate.actorPath) || candidate.actorPath.length === 0 || !candidate.actorPath.every((id) => typeof id === "string" && id !== ""))) throw new AgentEventLogError("Agent event entry.actorPath must be a non-empty array of invoke ids when present.");
|
|
1006
1007
|
}
|
|
1007
1008
|
function assertLogAttempts(attempts) {
|
|
@@ -1641,7 +1642,9 @@ function foldLog(machine, entries, options = {}) {
|
|
|
1641
1642
|
* Records a plain `createActor` run as an event log, with no
|
|
1642
1643
|
* `createAgentRuntime`: the init entry (the actor's `input`, or the snapshot
|
|
1643
1644
|
* it was created from), then every event the root machine processed, invoke
|
|
1644
|
-
* completions with their outputs inline.
|
|
1645
|
+
* completions with their outputs inline. A sent event the machine had no
|
|
1646
|
+
* transition for is recorded too, marked `ignored`. Attach it before
|
|
1647
|
+
* `actor.start()`.
|
|
1645
1648
|
*
|
|
1646
1649
|
* @example
|
|
1647
1650
|
* ```ts no-check
|
|
@@ -1660,7 +1663,7 @@ function recordLog(actor) {
|
|
|
1660
1663
|
let fold;
|
|
1661
1664
|
let failure;
|
|
1662
1665
|
const restored = actor._restored ? actor.getPersistedSnapshot() : void 0;
|
|
1663
|
-
const record = (event) => {
|
|
1666
|
+
const record = (event, ignored) => {
|
|
1664
1667
|
if (fold === void 0) {
|
|
1665
1668
|
if (event.type !== "xstate.init") throw new AgentEventLogError("recordLog must be attached before actor.start(): it missed the init event.");
|
|
1666
1669
|
const init = restored ? { snapshot: restored } : { input: event.input };
|
|
@@ -1675,13 +1678,14 @@ function recordLog(actor) {
|
|
|
1675
1678
|
machineVersion,
|
|
1676
1679
|
verification: false
|
|
1677
1680
|
});
|
|
1681
|
+
if (ignored) entry.ignored = true;
|
|
1678
1682
|
entry.verification = { stateHash: getSnapshotStateHash(fold.apply(entry)) };
|
|
1679
1683
|
entries.push(entry);
|
|
1680
1684
|
};
|
|
1681
1685
|
const subscription = actor.system.inspect((inspectionEvent) => {
|
|
1682
1686
|
if (failure !== void 0 || inspectionEvent.type !== "@xstate.transition" || inspectionEvent.actorRef !== actor) return;
|
|
1683
1687
|
try {
|
|
1684
|
-
record(inspectionEvent.event);
|
|
1688
|
+
record(inspectionEvent.event, inspectionEvent.microsteps.length === 0 && !inspectionEvent.event.type.startsWith("xstate."));
|
|
1685
1689
|
} catch (error) {
|
|
1686
1690
|
failure = error;
|
|
1687
1691
|
}
|
|
@@ -1924,12 +1928,6 @@ Object.defineProperty(exports, "getLogExecutionId", {
|
|
|
1924
1928
|
return getLogExecutionId;
|
|
1925
1929
|
}
|
|
1926
1930
|
});
|
|
1927
|
-
Object.defineProperty(exports, "getMachineStructuralHash", {
|
|
1928
|
-
enumerable: true,
|
|
1929
|
-
get: function() {
|
|
1930
|
-
return getMachineStructuralHash;
|
|
1931
|
-
}
|
|
1932
|
-
});
|
|
1933
1931
|
Object.defineProperty(exports, "getMessageText", {
|
|
1934
1932
|
enumerable: true,
|
|
1935
1933
|
get: function() {
|
|
@@ -2038,12 +2036,6 @@ Object.defineProperty(exports, "providerOutputSchema", {
|
|
|
2038
2036
|
return providerOutputSchema;
|
|
2039
2037
|
}
|
|
2040
2038
|
});
|
|
2041
|
-
Object.defineProperty(exports, "rebindActorSession", {
|
|
2042
|
-
enumerable: true,
|
|
2043
|
-
get: function() {
|
|
2044
|
-
return rebindActorSession;
|
|
2045
|
-
}
|
|
2046
|
-
});
|
|
2047
2039
|
Object.defineProperty(exports, "recordLog", {
|
|
2048
2040
|
enumerable: true,
|
|
2049
2041
|
get: function() {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { l as assertAgentLogEntry, m as forkEventLog, pt as AgentError } from "./event-log-CEq_bVXQ.mjs";
|
|
2
2
|
//#region src/event-log-store.ts
|
|
3
3
|
/**
|
|
4
4
|
* Durable storage for {@link AgentLogEntry} logs: the one interface a host
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { B as DecisionAttempt, at as AgentError, t as AgentCallUsage } from "./text-logic-
|
|
1
|
+
import { B as DecisionAttempt, at as AgentError, t as AgentCallUsage } from "./text-logic-x17uLBwA.mjs";
|
|
2
2
|
import { Actor, AnyMachineSnapshot, AnyStateMachine, EventObject, Snapshot, SnapshotFrom } from "xstate";
|
|
3
3
|
//#region src/event-log.d.ts
|
|
4
4
|
/** The durable entry envelope version. */
|
|
@@ -70,6 +70,16 @@ interface AgentLogEntry {
|
|
|
70
70
|
* child's state, not just the root's.
|
|
71
71
|
*/
|
|
72
72
|
actorPath?: string[];
|
|
73
|
+
/**
|
|
74
|
+
* Set when the machine had no transition for an event sent to it, in the
|
|
75
|
+
* state the event arrived in, so the event changed nothing. Never set on an
|
|
76
|
+
* `xstate.*` event: a stop or a child's completion changes the snapshot
|
|
77
|
+
* with no transition. Only {@link recordLog} sets it: a plain actor
|
|
78
|
+
* processes every event it is sent, refused ones included.
|
|
79
|
+
* Omitted otherwise. It records what happened in the live run: replay does
|
|
80
|
+
* not read it, and the fold applies the event like any other.
|
|
81
|
+
*/
|
|
82
|
+
ignored?: true;
|
|
73
83
|
}
|
|
74
84
|
/** The payload of the reserved {@link AGENT_INIT_EVENT_TYPE} first entry. */
|
|
75
85
|
interface AgentInitEvent extends EventObject {
|
|
@@ -284,17 +294,6 @@ interface AgentLogDecisionAttempts {
|
|
|
284
294
|
* Entries with neither are skipped.
|
|
285
295
|
*/
|
|
286
296
|
declare function getDecisionAttempts(entries: readonly AgentLogEntry[]): AgentLogDecisionAttempts[];
|
|
287
|
-
/**
|
|
288
|
-
* Rewrites a journaled `xstate.done.actor`/`xstate.error.actor` event's
|
|
289
|
-
* `sessionId` to the session the CURRENT fold minted for that `actorId`.
|
|
290
|
-
*
|
|
291
|
-
* Session ids are re-minted on every fold, and XState drops a completion event
|
|
292
|
-
* whose `sessionId` does not match the live child — silently, as a no-op
|
|
293
|
-
* transition. Rebinding is what makes a journaled completion replayable at all.
|
|
294
|
-
* `sessions` caches the mapping per fold, so a later event referring to the
|
|
295
|
-
* recorded session of an already-stopped child still resolves.
|
|
296
|
-
*/
|
|
297
|
-
declare function rebindActorSession(event: EventObject, snapshot: AnyMachineSnapshot, sessions: Map<string, string>): EventObject;
|
|
298
297
|
/** Options for {@link replay}. */
|
|
299
298
|
interface ReplayOptions {
|
|
300
299
|
/** Explicit expected machine version; defaults to the machine's resolved version. */
|
|
@@ -340,7 +339,9 @@ interface LogRecorder {
|
|
|
340
339
|
* Records a plain `createActor` run as an event log, with no
|
|
341
340
|
* `createAgentRuntime`: the init entry (the actor's `input`, or the snapshot
|
|
342
341
|
* it was created from), then every event the root machine processed, invoke
|
|
343
|
-
* completions with their outputs inline.
|
|
342
|
+
* completions with their outputs inline. A sent event the machine had no
|
|
343
|
+
* transition for is recorded too, marked `ignored`. Attach it before
|
|
344
|
+
* `actor.start()`.
|
|
344
345
|
*
|
|
345
346
|
* @example
|
|
346
347
|
* ```ts no-check
|
|
@@ -453,4 +454,4 @@ declare class AgentEventLogConflictError extends AgentError {
|
|
|
453
454
|
*/
|
|
454
455
|
declare function createInMemoryEventLogStore(): AgentEventLogStore;
|
|
455
456
|
//#endregion
|
|
456
|
-
export {
|
|
457
|
+
export { recordLog as A, createReplayEntry as C, getSnapshotStateHash as D, getLogExecutionId as E, validateReplayEntries as M, getUsageFromEvents as O, assertJsonSerializable as S, getDecisionAttempts as T, NonSerializableAgentEventError as _, AGENT_INIT_EVENT_TYPE as a, agentCallOccurrence as b, AgentLogEntry as c, AgentMachineVersionMismatchError as d, AgentPersistedSnapshot as f, LogRecorder as g, JsonValue as h, AGENT_EVENT_SCHEMA_VERSION as i, replay as j, initEntry as k, AgentLogInit as l, CreateReplayEntryOptions as m, AgentEventLogStore as n, AgentEventLogError as o, AgentReplayDivergenceError as p, createInMemoryEventLogStore as r, AgentInitEvent as s, AgentEventLogConflictError as t, AgentLogVerification as u, ReplayOptions as v, forkEventLog as w, assertAgentLogEntry as x, ReplayResult as y };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { B as DecisionAttempt, at as AgentError, t as AgentCallUsage } from "./text-logic-
|
|
1
|
+
import { B as DecisionAttempt, at as AgentError, t as AgentCallUsage } from "./text-logic-x17uLBwA.cjs";
|
|
2
2
|
import { Actor, AnyMachineSnapshot, AnyStateMachine, EventObject, Snapshot, SnapshotFrom } from "xstate";
|
|
3
3
|
//#region src/event-log.d.ts
|
|
4
4
|
/** The durable entry envelope version. */
|
|
@@ -70,6 +70,16 @@ interface AgentLogEntry {
|
|
|
70
70
|
* child's state, not just the root's.
|
|
71
71
|
*/
|
|
72
72
|
actorPath?: string[];
|
|
73
|
+
/**
|
|
74
|
+
* Set when the machine had no transition for an event sent to it, in the
|
|
75
|
+
* state the event arrived in, so the event changed nothing. Never set on an
|
|
76
|
+
* `xstate.*` event: a stop or a child's completion changes the snapshot
|
|
77
|
+
* with no transition. Only {@link recordLog} sets it: a plain actor
|
|
78
|
+
* processes every event it is sent, refused ones included.
|
|
79
|
+
* Omitted otherwise. It records what happened in the live run: replay does
|
|
80
|
+
* not read it, and the fold applies the event like any other.
|
|
81
|
+
*/
|
|
82
|
+
ignored?: true;
|
|
73
83
|
}
|
|
74
84
|
/** The payload of the reserved {@link AGENT_INIT_EVENT_TYPE} first entry. */
|
|
75
85
|
interface AgentInitEvent extends EventObject {
|
|
@@ -284,17 +294,6 @@ interface AgentLogDecisionAttempts {
|
|
|
284
294
|
* Entries with neither are skipped.
|
|
285
295
|
*/
|
|
286
296
|
declare function getDecisionAttempts(entries: readonly AgentLogEntry[]): AgentLogDecisionAttempts[];
|
|
287
|
-
/**
|
|
288
|
-
* Rewrites a journaled `xstate.done.actor`/`xstate.error.actor` event's
|
|
289
|
-
* `sessionId` to the session the CURRENT fold minted for that `actorId`.
|
|
290
|
-
*
|
|
291
|
-
* Session ids are re-minted on every fold, and XState drops a completion event
|
|
292
|
-
* whose `sessionId` does not match the live child — silently, as a no-op
|
|
293
|
-
* transition. Rebinding is what makes a journaled completion replayable at all.
|
|
294
|
-
* `sessions` caches the mapping per fold, so a later event referring to the
|
|
295
|
-
* recorded session of an already-stopped child still resolves.
|
|
296
|
-
*/
|
|
297
|
-
declare function rebindActorSession(event: EventObject, snapshot: AnyMachineSnapshot, sessions: Map<string, string>): EventObject;
|
|
298
297
|
/** Options for {@link replay}. */
|
|
299
298
|
interface ReplayOptions {
|
|
300
299
|
/** Explicit expected machine version; defaults to the machine's resolved version. */
|
|
@@ -340,7 +339,9 @@ interface LogRecorder {
|
|
|
340
339
|
* Records a plain `createActor` run as an event log, with no
|
|
341
340
|
* `createAgentRuntime`: the init entry (the actor's `input`, or the snapshot
|
|
342
341
|
* it was created from), then every event the root machine processed, invoke
|
|
343
|
-
* completions with their outputs inline.
|
|
342
|
+
* completions with their outputs inline. A sent event the machine had no
|
|
343
|
+
* transition for is recorded too, marked `ignored`. Attach it before
|
|
344
|
+
* `actor.start()`.
|
|
344
345
|
*
|
|
345
346
|
* @example
|
|
346
347
|
* ```ts no-check
|
|
@@ -453,4 +454,4 @@ declare class AgentEventLogConflictError extends AgentError {
|
|
|
453
454
|
*/
|
|
454
455
|
declare function createInMemoryEventLogStore(): AgentEventLogStore;
|
|
455
456
|
//#endregion
|
|
456
|
-
export {
|
|
457
|
+
export { recordLog as A, createReplayEntry as C, getSnapshotStateHash as D, getLogExecutionId as E, validateReplayEntries as M, getUsageFromEvents as O, assertJsonSerializable as S, getDecisionAttempts as T, NonSerializableAgentEventError as _, AGENT_INIT_EVENT_TYPE as a, agentCallOccurrence as b, AgentLogEntry as c, AgentMachineVersionMismatchError as d, AgentPersistedSnapshot as f, LogRecorder as g, JsonValue as h, AGENT_EVENT_SCHEMA_VERSION as i, replay as j, initEntry as k, AgentLogInit as l, CreateReplayEntryOptions as m, AgentEventLogStore as n, AgentEventLogError as o, AgentReplayDivergenceError as p, createInMemoryEventLogStore as r, AgentInitEvent as s, AgentEventLogConflictError as t, AgentLogVerification as u, ReplayOptions as v, forkEventLog as w, assertAgentLogEntry as x, ReplayResult as y };
|
package/dist/index.cjs
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_event_log = require("./event-log-
|
|
3
|
-
const require_decision = require("./decision-
|
|
4
|
-
const require_act = require("./act-
|
|
5
|
-
const require_setup_agent = require("./setup-agent-
|
|
6
|
-
const
|
|
7
|
-
const
|
|
2
|
+
const require_event_log = require("./event-log-dSOnXHuG.cjs");
|
|
3
|
+
const require_decision = require("./decision-D8bcIGXQ.cjs");
|
|
4
|
+
const require_act = require("./act-B0CVbmo4.cjs");
|
|
5
|
+
const require_setup_agent = require("./setup-agent-Dv5VpuHe.cjs");
|
|
6
|
+
const require_event_log_store = require("./event-log-store-Dey9ufA4.cjs");
|
|
7
|
+
const require_run_agent = require("./run-agent-COdR9FpM.cjs");
|
|
8
|
+
const require_effects = require("./effects-DrWcUGgc.cjs");
|
|
8
9
|
let xstate = require("xstate");
|
|
9
10
|
let acorn = require("acorn");
|
|
10
11
|
//#region src/messages.ts
|
|
@@ -867,76 +868,120 @@ function describeMachine(machine, options = {}) {
|
|
|
867
868
|
return lines.join("\n");
|
|
868
869
|
}
|
|
869
870
|
//#endregion
|
|
870
|
-
//#region src/
|
|
871
|
+
//#region src/generator-bridge.ts
|
|
872
|
+
/** A `runAgent` result that settled with an error. */
|
|
873
|
+
function isFailedRun(value) {
|
|
874
|
+
return typeof value === "object" && value !== null && value.status === "error" && "error" in value;
|
|
875
|
+
}
|
|
871
876
|
/**
|
|
872
|
-
*
|
|
873
|
-
*
|
|
874
|
-
*
|
|
875
|
-
*
|
|
877
|
+
* A backpressured hand-off between an actor and an async generator's
|
|
878
|
+
* consumer, for a loop whose public surface is an `AsyncGenerator`: the
|
|
879
|
+
* machine owns the loop head, each pass is an actor, and the events it
|
|
880
|
+
* yields still reach the consumer one pull at a time.
|
|
876
881
|
*
|
|
877
|
-
*
|
|
878
|
-
* like any other decider's choice. The policy's input must be JSON (it opens
|
|
879
|
-
* the policy run's event log): the default drops keys whose value is
|
|
880
|
-
* `undefined`, and any other value that is not JSON throws before the run. The policy's token usage is reported on the
|
|
881
|
-
* result, and left out when the policy made no model call. A run that does not
|
|
882
|
-
* end `done` with an event throws `AgentError` with code `policy-not-done`.
|
|
882
|
+
* One bridge serves one run.
|
|
883
883
|
*
|
|
884
884
|
* @example
|
|
885
|
-
* ```ts
|
|
886
|
-
*
|
|
887
|
-
*
|
|
885
|
+
* ```ts
|
|
886
|
+
* async function* carvedLoop(input: Input): AsyncGenerator<Event, Result> {
|
|
887
|
+
* const bridge = createGeneratorBridge<Event>();
|
|
888
|
+
* const pass = createAsyncLogic({
|
|
889
|
+
* run: async () => {
|
|
890
|
+
* const step = await bridge.forward(legacyPass(input));
|
|
891
|
+
* return step.closed ? { kind: "closed" } : step.value;
|
|
892
|
+
* },
|
|
893
|
+
* });
|
|
894
|
+
* const result = yield* bridge.stream(runAgent(loopMachine, { input, actors: { pass } }));
|
|
895
|
+
* if (result.status === "error") throw result.error;
|
|
896
|
+
* return toResult(result);
|
|
897
|
+
* }
|
|
888
898
|
* ```
|
|
889
899
|
*/
|
|
890
|
-
function
|
|
891
|
-
const
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
900
|
+
function createGeneratorBridge() {
|
|
901
|
+
const queue = [];
|
|
902
|
+
let wake;
|
|
903
|
+
let ended = false;
|
|
904
|
+
const notify = () => {
|
|
905
|
+
const resume = wake;
|
|
906
|
+
wake = void 0;
|
|
907
|
+
resume?.();
|
|
908
|
+
};
|
|
909
|
+
const put = (value) => {
|
|
910
|
+
if (ended) return Promise.resolve(false);
|
|
911
|
+
return new Promise((pulled, threw) => {
|
|
912
|
+
queue.push({
|
|
913
|
+
value,
|
|
914
|
+
pulled,
|
|
915
|
+
threw
|
|
916
|
+
});
|
|
917
|
+
notify();
|
|
902
918
|
});
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
919
|
+
};
|
|
920
|
+
return {
|
|
921
|
+
put,
|
|
922
|
+
async forward(generator) {
|
|
923
|
+
let closed = false;
|
|
924
|
+
let resumed = false;
|
|
925
|
+
let step = await generator.next();
|
|
926
|
+
while (!step.done) {
|
|
927
|
+
let pulled;
|
|
928
|
+
try {
|
|
929
|
+
pulled = await put(step.value);
|
|
930
|
+
} catch (error) {
|
|
931
|
+
step = await generator.throw(error);
|
|
932
|
+
continue;
|
|
933
|
+
}
|
|
934
|
+
const freshStop = !pulled && (!closed || resumed);
|
|
935
|
+
if (closed) resumed = pulled;
|
|
936
|
+
if (freshStop) {
|
|
937
|
+
closed = true;
|
|
938
|
+
step = await generator.return(void 0);
|
|
939
|
+
} else step = await generator.next();
|
|
940
|
+
}
|
|
941
|
+
return {
|
|
942
|
+
closed: closed && !resumed,
|
|
943
|
+
value: step.value
|
|
944
|
+
};
|
|
945
|
+
},
|
|
946
|
+
stream(settled) {
|
|
947
|
+
const end = () => {
|
|
948
|
+
ended = true;
|
|
949
|
+
for (const item of queue.splice(0)) item.pulled(false);
|
|
950
|
+
notify();
|
|
951
|
+
};
|
|
952
|
+
Promise.resolve(settled).then(end, end);
|
|
953
|
+
const next = async () => {
|
|
954
|
+
while (!queue.length && !ended) await new Promise((resolve) => wake = resolve);
|
|
955
|
+
return queue.shift();
|
|
956
|
+
};
|
|
957
|
+
const loop = async function* (stopped) {
|
|
958
|
+
while (true) {
|
|
959
|
+
const item = await next();
|
|
960
|
+
if (!item) {
|
|
961
|
+
const result = await settled;
|
|
962
|
+
if (stopped && isFailedRun(result)) throw result.error;
|
|
963
|
+
return result;
|
|
964
|
+
}
|
|
965
|
+
let resumed = false;
|
|
966
|
+
try {
|
|
967
|
+
yield item.value;
|
|
968
|
+
resumed = true;
|
|
969
|
+
stopped = false;
|
|
970
|
+
item.pulled(true);
|
|
971
|
+
} catch (error) {
|
|
972
|
+
resumed = true;
|
|
973
|
+
item.threw(error);
|
|
974
|
+
} finally {
|
|
975
|
+
if (!resumed) {
|
|
976
|
+
item.pulled(false);
|
|
977
|
+
return yield* loop(true);
|
|
978
|
+
}
|
|
979
|
+
}
|
|
980
|
+
}
|
|
981
|
+
};
|
|
982
|
+
return loop(false);
|
|
906
983
|
}
|
|
907
|
-
const event = result.output;
|
|
908
|
-
if (!require_event_log.isRecord(event) || typeof event.type !== "string") throw new require_event_log.AgentError("policy-not-done", `policy '${id}' output is not an event: ${JSON.stringify(event)}`);
|
|
909
|
-
const { modelCalls, ...usage } = result.usage;
|
|
910
|
-
return {
|
|
911
|
-
event,
|
|
912
|
-
...modelCalls > 0 ? { usage } : {}
|
|
913
|
-
};
|
|
914
984
|
};
|
|
915
|
-
async function policyThread(request, policyInput, info) {
|
|
916
|
-
if (threadId) return threadId(request, info);
|
|
917
|
-
if (info?.callKey) return `policy:${info.callKey}:${await sha256(require_event_log.canonicalEventJson(policyInput))}`;
|
|
918
|
-
throw new require_event_log.AgentError("missing-thread-id", `policy '${id}' has a store but no threadId, and the decision came with no callKey to derive one from`);
|
|
919
|
-
}
|
|
920
|
-
}
|
|
921
|
-
function defaultInput(request) {
|
|
922
|
-
const facts = request.metadata?.facts;
|
|
923
|
-
return withoutUndefinedKeys({
|
|
924
|
-
facts,
|
|
925
|
-
options: (request.options ?? []).map((option) => option.event),
|
|
926
|
-
system: request.system,
|
|
927
|
-
prompt: request.prompt
|
|
928
|
-
});
|
|
929
|
-
}
|
|
930
|
-
/** A copy of `value` with every object key whose value is `undefined` removed, at any depth. */
|
|
931
|
-
function withoutUndefinedKeys(value) {
|
|
932
|
-
if (Array.isArray(value)) return value.map(withoutUndefinedKeys);
|
|
933
|
-
if (!require_event_log.isRecord(value) || ![Object.prototype, null].includes(Object.getPrototypeOf(value))) return value;
|
|
934
|
-
return Object.fromEntries(Object.entries(value).filter(([, child]) => child !== void 0).map(([key, child]) => [key, withoutUndefinedKeys(child)]));
|
|
935
|
-
}
|
|
936
|
-
/** Hex SHA-256 of `text`, with Web Crypto (Node, browsers, workers). */
|
|
937
|
-
async function sha256(text) {
|
|
938
|
-
const digest = await crypto.subtle.digest("SHA-256", new TextEncoder().encode(text));
|
|
939
|
-
return Array.from(new Uint8Array(digest), (byte) => byte.toString(16).padStart(2, "0")).join("");
|
|
940
985
|
}
|
|
941
986
|
//#endregion
|
|
942
987
|
//#region src/wrap-workflow.ts
|
|
@@ -967,19 +1012,19 @@ function observeEffects(effects, send, signal, redact = (_name, _part, value) =>
|
|
|
967
1012
|
type: "effect.call",
|
|
968
1013
|
name,
|
|
969
1014
|
call,
|
|
970
|
-
args:
|
|
1015
|
+
args: require_run_agent.toJsonValue(redact(name, "args", args)) ?? []
|
|
971
1016
|
});
|
|
972
1017
|
const done = (result) => send({
|
|
973
1018
|
type: "effect.done",
|
|
974
1019
|
name,
|
|
975
1020
|
call,
|
|
976
|
-
result:
|
|
1021
|
+
result: require_run_agent.toJsonValue(redact(name, "result", result)) ?? null
|
|
977
1022
|
});
|
|
978
1023
|
const failed = (error) => send({
|
|
979
1024
|
type: "effect.error",
|
|
980
1025
|
name,
|
|
981
1026
|
call,
|
|
982
|
-
error:
|
|
1027
|
+
error: require_run_agent.toJsonValue(redact(name, "error", error)) ?? null
|
|
983
1028
|
});
|
|
984
1029
|
let result;
|
|
985
1030
|
try {
|
|
@@ -1133,12 +1178,15 @@ function isPlainData(value, seen, hidden) {
|
|
|
1133
1178
|
return !("value" in descriptor) || isPlainData(descriptor.value, seen, hidden);
|
|
1134
1179
|
});
|
|
1135
1180
|
}
|
|
1136
|
-
function workflowLogic(run, effects, runSignal, redact) {
|
|
1181
|
+
function workflowLogic(run, effects, runSignal, redact, live) {
|
|
1137
1182
|
return (0, xstate.createAsyncLogic)({ run: async ({ input: contextInput, self, signal }) => {
|
|
1138
1183
|
const input = typeof contextInput === "object" && contextInput !== null && copiedFrom.has(contextInput) ? copiedFrom.get(contextInput) : contextInput;
|
|
1139
1184
|
const parent = self._parent;
|
|
1140
1185
|
const combined = runSignal ? AbortSignal.any([runSignal, signal]) : signal;
|
|
1141
|
-
return run(ownCopy(input), observeEffects(effects, (event) => parent?.send(event), combined, redact), {
|
|
1186
|
+
return run(ownCopy(input), observeEffects(effects, (event) => parent?.send(event), combined, redact), {
|
|
1187
|
+
signal: combined,
|
|
1188
|
+
live
|
|
1189
|
+
});
|
|
1142
1190
|
} });
|
|
1143
1191
|
}
|
|
1144
1192
|
function createWrappedMachine(id, version, workflow) {
|
|
@@ -1217,18 +1265,19 @@ function wrapWorkflow(config) {
|
|
|
1217
1265
|
const machine = createWrappedMachine(config.id, config.version ?? "1", workflowLogic(config.run, config.effects, void 0, config.redact));
|
|
1218
1266
|
return {
|
|
1219
1267
|
machine,
|
|
1220
|
-
async run(input,
|
|
1221
|
-
const
|
|
1268
|
+
async run(input, ...args) {
|
|
1269
|
+
const options = args[0] ?? {};
|
|
1270
|
+
const { effects: overrides, recorder, recordOptions, live, ...runOptions } = options;
|
|
1222
1271
|
let effects = {
|
|
1223
1272
|
...require_effects.mapEffects(config.effects, (_name, effect) => effect),
|
|
1224
1273
|
...overrides ? require_effects.mapEffects(overrides, (_name, effect) => effect) : {}
|
|
1225
1274
|
};
|
|
1226
|
-
if (recorder) effects = require_effects.mapEffects(effects, (name, effect) => recorder.fn(name, effect));
|
|
1275
|
+
if (recorder) effects = require_effects.mapEffects(effects, (name, effect) => recorder.fn(name, effect, recordOptions?.[name]));
|
|
1227
1276
|
const { signal: _signal, ...agentOptions } = runOptions;
|
|
1228
|
-
const result = await
|
|
1277
|
+
const result = await require_run_agent.runAgent(machine, {
|
|
1229
1278
|
...agentOptions,
|
|
1230
1279
|
input,
|
|
1231
|
-
actors: { workflow: workflowLogic(config.run, effects, options.signal, config.redact) }
|
|
1280
|
+
actors: { workflow: workflowLogic(config.run, effects, options.signal, config.redact, live) }
|
|
1232
1281
|
});
|
|
1233
1282
|
if (result.status === "done") {
|
|
1234
1283
|
const output = result.output;
|
|
@@ -1293,11 +1342,11 @@ function provideExecutors(machine, executors, options = {}) {
|
|
|
1293
1342
|
const provided = options.actors ? withActors(machine, options.actors) : machine;
|
|
1294
1343
|
const effectiveSources = provided.sources.actors;
|
|
1295
1344
|
const wrappedSources = {};
|
|
1296
|
-
const invokedSrcs =
|
|
1345
|
+
const invokedSrcs = require_run_agent.getConfiguredInvokeSrcs(provided);
|
|
1297
1346
|
for (const [key, logic] of Object.entries(effectiveSources)) {
|
|
1298
|
-
if (
|
|
1347
|
+
if (require_run_agent.isStateMachineLogic(logic)) {
|
|
1299
1348
|
if (invokedSrcs.has(key)) assertChildBindable(logic, executors, key, /* @__PURE__ */ new Set([provided]));
|
|
1300
|
-
const rebound =
|
|
1349
|
+
const rebound = require_run_agent.bindChildMachineForProvide(logic, executors, bindOptions, /* @__PURE__ */ new Set([provided]));
|
|
1301
1350
|
if (rebound !== logic) wrappedSources[key] = rebound;
|
|
1302
1351
|
continue;
|
|
1303
1352
|
}
|
|
@@ -1305,7 +1354,7 @@ function provideExecutors(machine, executors, options = {}) {
|
|
|
1305
1354
|
if (!requirement) continue;
|
|
1306
1355
|
const binding = {
|
|
1307
1356
|
...requirement,
|
|
1308
|
-
bind: () => require_act.isActLogic(logic) ?
|
|
1357
|
+
bind: () => require_act.isActLogic(logic) ? require_run_agent.bindActForProvide(provided, executors, bindOptions) : require_decision.isDecisionLogic(logic) ? require_run_agent.bindDecisionForProvide(provided, logic, executors, bindOptions) : require_run_agent.bindTextForProvide(provided, logic, executors, bindOptions)
|
|
1309
1358
|
};
|
|
1310
1359
|
if (require_event_log.executorBoundLogics.has(logic)) continue;
|
|
1311
1360
|
if (!executors[binding.executorKey]) {
|
|
@@ -1344,10 +1393,10 @@ function assertChildBindable(childMachine, executors, path, visited) {
|
|
|
1344
1393
|
if (visited.has(childMachine)) return;
|
|
1345
1394
|
const nextVisited = /* @__PURE__ */ new Set([...visited, childMachine]);
|
|
1346
1395
|
const sources = childMachine.sources.actors;
|
|
1347
|
-
for (const src of
|
|
1396
|
+
for (const src of require_run_agent.getConfiguredInvokeSrcs(childMachine)) {
|
|
1348
1397
|
const logic = sources[src];
|
|
1349
1398
|
if (!logic) continue;
|
|
1350
|
-
if (
|
|
1399
|
+
if (require_run_agent.isStateMachineLogic(logic)) {
|
|
1351
1400
|
assertChildBindable(logic, executors, `${path} > ${src}`, nextVisited);
|
|
1352
1401
|
continue;
|
|
1353
1402
|
}
|
|
@@ -1361,29 +1410,28 @@ function missingExecutorError(src, kind, executor) {
|
|
|
1361
1410
|
}
|
|
1362
1411
|
//#endregion
|
|
1363
1412
|
exports.ACT_STATE_EXITED = require_act.ACT_STATE_EXITED;
|
|
1364
|
-
exports.AGENT_TRACE_SCHEMA_VERSION =
|
|
1413
|
+
exports.AGENT_TRACE_SCHEMA_VERSION = require_run_agent.AGENT_TRACE_SCHEMA_VERSION;
|
|
1365
1414
|
exports.AGENT_USAGE_EVENT_TYPE = require_event_log.AGENT_USAGE_EVENT_TYPE;
|
|
1366
1415
|
exports.AgentDecisionExhaustedError = require_decision.AgentDecisionExhaustedError;
|
|
1367
1416
|
exports.AgentError = require_event_log.AgentError;
|
|
1368
1417
|
exports.AgentEventLogConflictError = require_event_log_store.AgentEventLogConflictError;
|
|
1369
1418
|
exports.AgentInvalidEventPayloadError = require_decision.AgentInvalidEventPayloadError;
|
|
1370
1419
|
exports.AgentMachineVersionMismatchError = require_event_log.AgentMachineVersionMismatchError;
|
|
1371
|
-
exports.AgentMaxModelCallsExceededError =
|
|
1372
|
-
exports.AgentSnapshotDivergedError =
|
|
1420
|
+
exports.AgentMaxModelCallsExceededError = require_run_agent.AgentMaxModelCallsExceededError;
|
|
1421
|
+
exports.AgentSnapshotDivergedError = require_run_agent.AgentSnapshotDivergedError;
|
|
1373
1422
|
exports.AgentTruncatedError = require_event_log.AgentTruncatedError;
|
|
1374
1423
|
exports.DEFAULT_ACT_MAX_STEPS = require_act.DEFAULT_ACT_MAX_STEPS;
|
|
1375
1424
|
exports.GROUPED_EVENT_THRESHOLD = require_decision.GROUPED_EVENT_THRESHOLD;
|
|
1376
1425
|
exports.MAX_FINITE_PAYLOADS = require_decision.MAX_FINITE_PAYLOADS;
|
|
1377
1426
|
exports.assistantMessage = require_event_log.assistantMessage;
|
|
1378
1427
|
exports.bindRequestExecutor = require_event_log.bindRequestExecutor;
|
|
1379
|
-
exports.createAgentInbox =
|
|
1380
|
-
exports.createAgentRuntime =
|
|
1428
|
+
exports.createAgentInbox = require_run_agent.createAgentInbox;
|
|
1429
|
+
exports.createAgentRuntime = require_run_agent.createAgentRuntime;
|
|
1381
1430
|
exports.createAgentSchemas = require_setup_agent.createAgentSchemas;
|
|
1382
1431
|
exports.createDecisionLogic = require_decision.createDecisionLogic;
|
|
1383
1432
|
exports.createDecisionRequest = require_decision.createDecisionRequest;
|
|
1384
|
-
exports.
|
|
1433
|
+
exports.createGeneratorBridge = createGeneratorBridge;
|
|
1385
1434
|
exports.createTextLogic = require_event_log.createTextLogic;
|
|
1386
|
-
exports.decideNext = require_effects.decideNext;
|
|
1387
1435
|
exports.describeMachine = describeMachine;
|
|
1388
1436
|
exports.eventFromInteraction = eventFromInteraction;
|
|
1389
1437
|
exports.getAcceptedEvents = require_decision.getAcceptedEvents;
|
|
@@ -1394,13 +1442,11 @@ exports.getCallUsage = require_event_log.getCallUsage;
|
|
|
1394
1442
|
exports.getInteraction = getInteraction;
|
|
1395
1443
|
exports.getJsonSchema = require_event_log.getJsonSchema;
|
|
1396
1444
|
exports.getJsonSchemaSync = require_event_log.getJsonSchemaSync;
|
|
1397
|
-
exports.getMachineStructuralHash = require_event_log.getMachineStructuralHash;
|
|
1398
1445
|
exports.getMessageText = require_event_log.getMessageText;
|
|
1399
1446
|
exports.getStateMeta = require_event_log.getStateMeta;
|
|
1400
1447
|
exports.getStatePath = require_event_log.getStatePath;
|
|
1401
|
-
exports.inspectTransitions = require_effects.inspectTransitions;
|
|
1402
1448
|
exports.interactionMetaSchema = interactionMetaSchema;
|
|
1403
|
-
exports.isAgentIdle =
|
|
1449
|
+
exports.isAgentIdle = require_run_agent.isAgentIdle;
|
|
1404
1450
|
exports.isAgentMessages = isAgentMessages;
|
|
1405
1451
|
exports.isStandardSchema = require_event_log.isStandardSchema;
|
|
1406
1452
|
exports.messagesSchema = messagesSchema;
|
|
@@ -1411,9 +1457,8 @@ exports.provideExecutors = provideExecutors;
|
|
|
1411
1457
|
exports.providerOutputSchema = require_event_log.providerOutputSchema;
|
|
1412
1458
|
exports.renderDecisionAttempts = require_decision.renderDecisionAttempts;
|
|
1413
1459
|
exports.resolveDecision = require_decision.resolveDecision;
|
|
1414
|
-
exports.runAgent =
|
|
1415
|
-
exports.
|
|
1416
|
-
exports.serializeTraceEvent = require_effects.serializeTraceEvent;
|
|
1460
|
+
exports.runAgent = require_run_agent.runAgent;
|
|
1461
|
+
exports.serializeTraceEvent = require_run_agent.serializeTraceEvent;
|
|
1417
1462
|
Object.defineProperty(exports, "setupAgent", {
|
|
1418
1463
|
enumerable: true,
|
|
1419
1464
|
get: function() {
|
|
@@ -1422,6 +1467,6 @@ Object.defineProperty(exports, "setupAgent", {
|
|
|
1422
1467
|
});
|
|
1423
1468
|
exports.systemMessage = require_event_log.systemMessage;
|
|
1424
1469
|
exports.toolMessage = require_event_log.toolMessage;
|
|
1425
|
-
exports.traceTransitions =
|
|
1470
|
+
exports.traceTransitions = require_run_agent.traceTransitions;
|
|
1426
1471
|
exports.userMessage = require_event_log.userMessage;
|
|
1427
1472
|
exports.wrapWorkflow = wrapWorkflow;
|