@superdurable/dex-agents 0.0.0-stage → 0.2.0
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/LICENSE +105 -0
- package/README.md +1981 -2
- package/dist/src/agent-built-in-tools.d.ts +81 -0
- package/dist/src/agent-built-in-tools.js +246 -0
- package/dist/src/agent-built-in-tools.js.map +1 -0
- package/dist/src/agent-context-compaction.d.ts +108 -0
- package/dist/src/agent-context-compaction.js +39 -0
- package/dist/src/agent-context-compaction.js.map +1 -0
- package/dist/src/agent-event-writer.d.ts +26 -0
- package/dist/src/agent-event-writer.js +110 -0
- package/dist/src/agent-event-writer.js.map +1 -0
- package/dist/src/agent-framework-runner.d.ts +808 -0
- package/dist/src/agent-framework-runner.js +82 -0
- package/dist/src/agent-framework-runner.js.map +1 -0
- package/dist/src/agent-plans.d.ts +48 -0
- package/dist/src/agent-plans.js +86 -0
- package/dist/src/agent-plans.js.map +1 -0
- package/dist/src/agent-session-cancellation-steps.d.ts +28 -0
- package/dist/src/agent-session-cancellation-steps.js +154 -0
- package/dist/src/agent-session-cancellation-steps.js.map +1 -0
- package/dist/src/agent-session-codecs.d.ts +105 -0
- package/dist/src/agent-session-codecs.js +689 -0
- package/dist/src/agent-session-codecs.js.map +1 -0
- package/dist/src/agent-session-flow.d.ts +416 -0
- package/dist/src/agent-session-flow.js +623 -0
- package/dist/src/agent-session-flow.js.map +1 -0
- package/dist/src/agent-session-persistence.d.ts +133 -0
- package/dist/src/agent-session-persistence.js +74 -0
- package/dist/src/agent-session-persistence.js.map +1 -0
- package/dist/src/agent-session-settings.d.ts +58 -0
- package/dist/src/agent-session-settings.js +81 -0
- package/dist/src/agent-session-settings.js.map +1 -0
- package/dist/src/agent-session-step-options.d.ts +27 -0
- package/dist/src/agent-session-step-options.js +39 -0
- package/dist/src/agent-session-step-options.js.map +1 -0
- package/dist/src/agent-session-step-types.d.ts +20 -0
- package/dist/src/agent-session-step-types.js +28 -0
- package/dist/src/agent-session-step-types.js.map +1 -0
- package/dist/src/agent-session-steps.d.ts +179 -0
- package/dist/src/agent-session-steps.js +1272 -0
- package/dist/src/agent-session-steps.js.map +1 -0
- package/dist/src/agent-session-tracer.d.ts +61 -0
- package/dist/src/agent-session-tracer.js +608 -0
- package/dist/src/agent-session-tracer.js.map +1 -0
- package/dist/src/agent-session-transitions.d.ts +224 -0
- package/dist/src/agent-session-transitions.js +850 -0
- package/dist/src/agent-session-transitions.js.map +1 -0
- package/dist/src/agent-session-values.d.ts +998 -0
- package/dist/src/agent-session-values.js +162 -0
- package/dist/src/agent-session-values.js.map +1 -0
- package/dist/src/agent-session-wait-steps.d.ts +53 -0
- package/dist/src/agent-session-wait-steps.js +389 -0
- package/dist/src/agent-session-wait-steps.js.map +1 -0
- package/dist/src/agent-tracing-options.d.ts +107 -0
- package/dist/src/agent-tracing-options.js +20 -0
- package/dist/src/agent-tracing-options.js.map +1 -0
- package/dist/src/ai-sdk/ai-sdk-model-client.d.ts +40 -0
- package/dist/src/ai-sdk/ai-sdk-model-client.js +235 -0
- package/dist/src/ai-sdk/ai-sdk-model-client.js.map +1 -0
- package/dist/src/ai-sdk/index.d.ts +1 -0
- package/dist/src/ai-sdk/index.js +9 -0
- package/dist/src/ai-sdk/index.js.map +1 -0
- package/dist/src/index.d.ts +10 -0
- package/dist/src/index.js +17 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/mcp/index.d.ts +3 -0
- package/dist/src/mcp/index.js +10 -0
- package/dist/src/mcp/index.js.map +1 -0
- package/dist/src/mcp/mcp-resource-and-prompt-tools.d.ts +29 -0
- package/dist/src/mcp/mcp-resource-and-prompt-tools.js +185 -0
- package/dist/src/mcp/mcp-resource-and-prompt-tools.js.map +1 -0
- package/dist/src/mcp/mcp-server-config.d.ts +86 -0
- package/dist/src/mcp/mcp-server-config.js +38 -0
- package/dist/src/mcp/mcp-server-config.js.map +1 -0
- package/dist/src/mcp/mcp-tool-source.d.ts +470 -0
- package/dist/src/mcp/mcp-tool-source.js +1204 -0
- package/dist/src/mcp/mcp-tool-source.js.map +1 -0
- package/dist/src/stepwise/agent-definition.d.ts +158 -0
- package/dist/src/stepwise/agent-definition.js +9 -0
- package/dist/src/stepwise/agent-definition.js.map +1 -0
- package/dist/src/stepwise/function-tool.d.ts +130 -0
- package/dist/src/stepwise/function-tool.js +75 -0
- package/dist/src/stepwise/function-tool.js.map +1 -0
- package/dist/src/stepwise/index.d.ts +7 -0
- package/dist/src/stepwise/index.js +12 -0
- package/dist/src/stepwise/index.js.map +1 -0
- package/dist/src/stepwise/json-schema-validation.d.ts +9 -0
- package/dist/src/stepwise/json-schema-validation.js +141 -0
- package/dist/src/stepwise/json-schema-validation.js.map +1 -0
- package/dist/src/stepwise/model-client.d.ts +194 -0
- package/dist/src/stepwise/model-client.js +9 -0
- package/dist/src/stepwise/model-client.js.map +1 -0
- package/dist/src/stepwise/scripted-model-client.d.ts +99 -0
- package/dist/src/stepwise/scripted-model-client.js +156 -0
- package/dist/src/stepwise/scripted-model-client.js.map +1 -0
- package/dist/src/stepwise/stepwise-agent-runner.d.ts +189 -0
- package/dist/src/stepwise/stepwise-agent-runner.js +804 -0
- package/dist/src/stepwise/stepwise-agent-runner.js.map +1 -0
- package/dist/src/stepwise/stepwise-agent-session-flow.d.ts +35 -0
- package/dist/src/stepwise/stepwise-agent-session-flow.js +56 -0
- package/dist/src/stepwise/stepwise-agent-session-flow.js.map +1 -0
- package/dist/src/stepwise/stepwise-input-items.d.ts +12 -0
- package/dist/src/stepwise/stepwise-input-items.js +172 -0
- package/dist/src/stepwise/stepwise-input-items.js.map +1 -0
- package/dist/src/stepwise/tool-source.d.ts +103 -0
- package/dist/src/stepwise/tool-source.js +9 -0
- package/dist/src/stepwise/tool-source.js.map +1 -0
- package/dist/src/testing/agent-session-test-client.d.ts +205 -0
- package/dist/src/testing/agent-session-test-client.js +290 -0
- package/dist/src/testing/agent-session-test-client.js.map +1 -0
- package/dist/src/testing/agent-test-environment.d.ts +52 -0
- package/dist/src/testing/agent-test-environment.js +86 -0
- package/dist/src/testing/agent-test-environment.js.map +1 -0
- package/dist/src/testing/agent-worker-process.d.ts +91 -0
- package/dist/src/testing/agent-worker-process.js +150 -0
- package/dist/src/testing/agent-worker-process.js.map +1 -0
- package/dist/src/testing/child-process-group.d.ts +33 -0
- package/dist/src/testing/child-process-group.js +164 -0
- package/dist/src/testing/child-process-group.js.map +1 -0
- package/dist/src/testing/coordination.d.ts +99 -0
- package/dist/src/testing/coordination.js +155 -0
- package/dist/src/testing/coordination.js.map +1 -0
- package/dist/src/testing/index.d.ts +8 -0
- package/dist/src/testing/index.js +16 -0
- package/dist/src/testing/index.js.map +1 -0
- package/dist/src/testing/polling.d.ts +31 -0
- package/dist/src/testing/polling.js +51 -0
- package/dist/src/testing/polling.js.map +1 -0
- package/dist/src/testing/private-dex-engine.d.ts +101 -0
- package/dist/src/testing/private-dex-engine.js +223 -0
- package/dist/src/testing/private-dex-engine.js.map +1 -0
- package/dist/src/testing/scripted-model-client.d.ts +1 -0
- package/dist/src/testing/scripted-model-client.js +10 -0
- package/dist/src/testing/scripted-model-client.js.map +1 -0
- package/dist/src/testing/step-history.d.ts +40 -0
- package/dist/src/testing/step-history.js +59 -0
- package/dist/src/testing/step-history.js.map +1 -0
- package/dist/src/ui-stream/agent-event-json.d.ts +30 -0
- package/dist/src/ui-stream/agent-event-json.js +64 -0
- package/dist/src/ui-stream/agent-event-json.js.map +1 -0
- package/dist/src/ui-stream/agent-event-sse.d.ts +154 -0
- package/dist/src/ui-stream/agent-event-sse.js +159 -0
- package/dist/src/ui-stream/agent-event-sse.js.map +1 -0
- package/dist/src/ui-stream/agent-event-stream-positions.d.ts +42 -0
- package/dist/src/ui-stream/agent-event-stream-positions.js +153 -0
- package/dist/src/ui-stream/agent-event-stream-positions.js.map +1 -0
- package/dist/src/ui-stream/agent-session-record-reader.d.ts +72 -0
- package/dist/src/ui-stream/agent-session-record-reader.js +241 -0
- package/dist/src/ui-stream/agent-session-record-reader.js.map +1 -0
- package/dist/src/ui-stream/agent-ui-message-stream-responses.d.ts +219 -0
- package/dist/src/ui-stream/agent-ui-message-stream-responses.js +440 -0
- package/dist/src/ui-stream/agent-ui-message-stream-responses.js.map +1 -0
- package/dist/src/ui-stream/agent-ui-message-stream.d.ts +138 -0
- package/dist/src/ui-stream/agent-ui-message-stream.js +681 -0
- package/dist/src/ui-stream/agent-ui-message-stream.js.map +1 -0
- package/dist/src/ui-stream/agent-ui-message-types.d.ts +238 -0
- package/dist/src/ui-stream/agent-ui-message-types.js +57 -0
- package/dist/src/ui-stream/agent-ui-message-types.js.map +1 -0
- package/dist/src/ui-stream/agent-ui-messages.d.ts +66 -0
- package/dist/src/ui-stream/agent-ui-messages.js +220 -0
- package/dist/src/ui-stream/agent-ui-messages.js.map +1 -0
- package/dist/src/ui-stream/agent-ui-stream-cursor.d.ts +64 -0
- package/dist/src/ui-stream/agent-ui-stream-cursor.js +186 -0
- package/dist/src/ui-stream/agent-ui-stream-cursor.js.map +1 -0
- package/dist/src/ui-stream/index.d.ts +14 -0
- package/dist/src/ui-stream/index.js +22 -0
- package/dist/src/ui-stream/index.js.map +1 -0
- package/dist/src/ui-stream/server-sent-event-responses.d.ts +6 -0
- package/dist/src/ui-stream/server-sent-event-responses.js +34 -0
- package/dist/src/ui-stream/server-sent-event-responses.js.map +1 -0
- package/package.json +86 -4
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-session-flow.js","sourceRoot":"","sources":["../../src/agent-session-flow.ts"],"names":[],"mappings":"AAAA,yCAAyC;AACzC,EAAE;AACF,kDAAkD;AAClD,mEAAmE;AACnE,+CAA+C;AAC/C,EAAE;AACF,0DAA0D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE1D,OAAO,EACL,QAAQ,EACR,OAAO,EACP,YAAY,EACZ,GAAG,GAMJ,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAoB,MAAM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|
|
2
|
+
import type { AgentEvent, AgentInterrupt, AgentInterruptResolution, AgentMessage, AgentMessageChunk, AgentMessageIndex, AgentPlan, AgentState, AgentToolCallRecord, AgentUsage, AgentUserMessage, PlanExecutionRequest, ContextSummary, SessionSettings, TurnReplySequence, TurnSessionSettings, ToolCallCancellation, ToolCallCompleted, TurnCancellationRequest, TurnControlRequest } from "./agent-session-values.js";
|
|
3
|
+
/** Default byte budget of the `AgentEvents` Stream: 10 MiB. */
|
|
4
|
+
export declare const defaultAgentEventsCapacityBytes: number;
|
|
5
|
+
/**
|
|
6
|
+
* Persistence definitions registered by one agent session Flow.
|
|
7
|
+
*
|
|
8
|
+
* Every Flow returned by {@link createAgentSessionFlow} owns its own definition objects, available as
|
|
9
|
+
* properties of the Flow. Pass them to `Client.getAttributes`, `Client.readStream`, or
|
|
10
|
+
* `Client.listStreamMessages` to read a session from outside the Flow. The persisted names are wire
|
|
11
|
+
* contracts shared with the Python core.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```ts
|
|
15
|
+
* const [state, usage] = await client.getAttributes(sessionId, flow.agentState, flow.agentUsage);
|
|
16
|
+
* const page = await client.listStreamMessages(sessionId, flow.agentEvents, 50);
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
export interface AgentSessionPersistence {
|
|
20
|
+
/** The `AgentState` Attribute. It is always set after `StartAgentSession`. */
|
|
21
|
+
readonly agentState: Attribute<AgentState>;
|
|
22
|
+
/**
|
|
23
|
+
* The `AgentMessages` AttributeMap: the window of the newest messages, one instance per message, keyed by
|
|
24
|
+
* {@link messageSequenceKey}. Older messages are in {@link agentMessageChunks}; see {@link agentMessageIndex}.
|
|
25
|
+
*/
|
|
26
|
+
readonly agentMessages: AttributeMap<AgentMessage>;
|
|
27
|
+
/**
|
|
28
|
+
* The `AgentMessageChunks` AttributeMap: immutable archive chunks of older messages, keyed by
|
|
29
|
+
* {@link messageSequenceKey} of each chunk's first sequence.
|
|
30
|
+
*/
|
|
31
|
+
readonly agentMessageChunks: AttributeMap<AgentMessageChunk>;
|
|
32
|
+
/**
|
|
33
|
+
* The `AgentMessageIndex` Attribute: where the window and the retained chunks start. A session that a 0.1.0
|
|
34
|
+
* Worker wrote has none until its first write on this version.
|
|
35
|
+
*/
|
|
36
|
+
readonly agentMessageIndex: Attribute<AgentMessageIndex>;
|
|
37
|
+
/** The `FrameworkRunState` Attribute: opaque framework JSON, set only while a turn is suspended. */
|
|
38
|
+
readonly frameworkRunState: Attribute<string>;
|
|
39
|
+
/** The `AgentToolCalls` AttributeMap, keyed by tool call ID; holds only the active turn's records. */
|
|
40
|
+
readonly agentToolCalls: AttributeMap<AgentToolCallRecord>;
|
|
41
|
+
/** The `PendingInterrupts` Attribute: interrupts that `resolve_interrupt` still accepts. */
|
|
42
|
+
readonly pendingInterrupts: Attribute<readonly AgentInterrupt[]>;
|
|
43
|
+
/** The `AgentUsage` Attribute: cumulative usage of every turn. */
|
|
44
|
+
readonly agentUsage: Attribute<AgentUsage>;
|
|
45
|
+
/** The `QueuedUserMessages` Channel; `send_user_message` publishes and `AwaitUserMessage` consumes. */
|
|
46
|
+
readonly queuedUserMessages: Channel<AgentUserMessage>;
|
|
47
|
+
/** The `InterruptResolutions` ChannelMap, keyed by interrupt ID. */
|
|
48
|
+
readonly interruptResolutions: ChannelMap<AgentInterruptResolution>;
|
|
49
|
+
/**
|
|
50
|
+
* The internal `ToolCallResults` Channel. Every tool call of a batch publishes one message when its
|
|
51
|
+
* record becomes final, and `ResumeTurn` consumes them. Applications never publish to it.
|
|
52
|
+
*/
|
|
53
|
+
readonly toolCallResults: Channel<ToolCallCompleted>;
|
|
54
|
+
/** The `SteeredUserMessages` Channel; `steer_user_message` publishes and `ApplyTurnControl` consumes. */
|
|
55
|
+
readonly steeredUserMessages: Channel<AgentUserMessage>;
|
|
56
|
+
/**
|
|
57
|
+
* The internal `TurnControlRequests` Channel. `steer_user_message` and `cancel_turn` publish to it, and its
|
|
58
|
+
* messages only wake `ResumeTurn` or `AwaitUserMessage`.
|
|
59
|
+
*/
|
|
60
|
+
readonly turnControlRequests: Channel<TurnControlRequest>;
|
|
61
|
+
/** The `TurnCancellationRequest` Attribute: the latest `cancel_turn` request. Only `cancel_turn` writes it. */
|
|
62
|
+
readonly turnCancellationRequest: Attribute<TurnCancellationRequest>;
|
|
63
|
+
/**
|
|
64
|
+
* The internal `ToolCallCancellations` ChannelMap, keyed by tool call ID. `ResumeTurn` publishes to it to wake
|
|
65
|
+
* the Step that waits on a call of a steered or cancelled turn.
|
|
66
|
+
*/
|
|
67
|
+
readonly toolCallCancellations: ChannelMap<ToolCallCancellation>;
|
|
68
|
+
/** The best-effort `AgentEvents` Stream. Rebuild durable state with `get_agent_snapshot`. */
|
|
69
|
+
readonly agentEvents: Stream<AgentEvent>;
|
|
70
|
+
/**
|
|
71
|
+
* The `AgentTraceContext` Attribute: the W3C `traceparent` of the current activation's root span when
|
|
72
|
+
* that span has a valid context, sampled or not; an activation whose root has none, such as one without
|
|
73
|
+
* an OpenTelemetry SDK, deletes it. `RunModel` reads it to join the activation's trace.
|
|
74
|
+
*/
|
|
75
|
+
readonly agentTraceContext: Attribute<string>;
|
|
76
|
+
/** The `AgentPlan` Attribute: the session's plan, unset until `write_todos` first succeeds. */
|
|
77
|
+
readonly agentPlan: Attribute<AgentPlan>;
|
|
78
|
+
/**
|
|
79
|
+
* The `PlanExecutions` ChannelMap, keyed by {@link planExecutionKey}: approved plan executions that
|
|
80
|
+
* `execute_plan` publishes and `AwaitUserMessage` consumes.
|
|
81
|
+
*/
|
|
82
|
+
readonly planExecutions: ChannelMap<PlanExecutionRequest>;
|
|
83
|
+
/**
|
|
84
|
+
* The `PendingPlanExecution` Attribute: the execution `execute_plan` accepted and `AwaitUserMessage` has
|
|
85
|
+
* not consumed yet.
|
|
86
|
+
*/
|
|
87
|
+
readonly pendingPlanExecution: Attribute<PlanExecutionRequest>;
|
|
88
|
+
/**
|
|
89
|
+
* The `ContextSummary` Attribute: the summary that replaces the earlier messages in the model input,
|
|
90
|
+
* set once the session compacts. Only `CompactContext` writes it.
|
|
91
|
+
*/
|
|
92
|
+
readonly contextSummary: Attribute<ContextSummary>;
|
|
93
|
+
/**
|
|
94
|
+
* The `SessionSettings` Attribute: the settings the next turn starts with, from the start input and then each
|
|
95
|
+
* `update_session_settings`. Unset when the session has none.
|
|
96
|
+
*/
|
|
97
|
+
readonly sessionSettings: Attribute<SessionSettings>;
|
|
98
|
+
/**
|
|
99
|
+
* The `TurnSessionSettings` Attribute: the settings a turn started with, tagged with its turn, copied from
|
|
100
|
+
* `SessionSettings` when the turn began. A copy from an earlier turn reads as no settings.
|
|
101
|
+
*/
|
|
102
|
+
readonly turnSessionSettings: Attribute<TurnSessionSettings>;
|
|
103
|
+
/**
|
|
104
|
+
* The `TurnReplySequence` Attribute: where the latest turn's replies start, tagged with its turn. The Step
|
|
105
|
+
* that starts a turn writes it; turn events count the replies from it.
|
|
106
|
+
*/
|
|
107
|
+
readonly turnReplySequence: Attribute<TurnReplySequence>;
|
|
108
|
+
}
|
|
109
|
+
export declare function createAgentSessionPersistence(agentEventsCapacityBytes: number): AgentSessionPersistence;
|
|
110
|
+
/**
|
|
111
|
+
* Returns the `AgentMessages` map instance of a message sequence, which is also the `AgentMessageChunks`
|
|
112
|
+
* instance of a chunk that starts at that sequence.
|
|
113
|
+
*
|
|
114
|
+
* A message stays in `AgentMessages` only while it is in the window; read older ones from their chunk, or
|
|
115
|
+
* page through all of them with `list_agent_messages`.
|
|
116
|
+
*
|
|
117
|
+
* @example
|
|
118
|
+
* ```ts
|
|
119
|
+
* const [message] = await client.getAttributes(sessionId, flow.agentMessages.instance(messageSequenceKey(7)));
|
|
120
|
+
* ```
|
|
121
|
+
* @param sequence - Positive message sequence.
|
|
122
|
+
* @returns The sequence as a 12-digit zero-padded decimal, such as `"000000000007"`.
|
|
123
|
+
* @throws {RangeError} When `sequence` is not a positive safe integer.
|
|
124
|
+
*/
|
|
125
|
+
export declare function messageSequenceKey(sequence: number): string;
|
|
126
|
+
/**
|
|
127
|
+
* Returns the `PlanExecutions` map instance of a plan revision.
|
|
128
|
+
*
|
|
129
|
+
* @param revision - Positive {@link AgentPlan.revision}.
|
|
130
|
+
* @returns The revision as a decimal, such as `"3"`.
|
|
131
|
+
* @throws {RangeError} When `revision` is not a positive safe integer.
|
|
132
|
+
*/
|
|
133
|
+
export declare function planExecutionKey(revision: number): string;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
// Copyright (c) 2026 Super Durable, Inc.
|
|
2
|
+
//
|
|
3
|
+
// Licensed under the Sustainable Use License 1.0.
|
|
4
|
+
// You may not use this file except in compliance with the License.
|
|
5
|
+
// See the LICENSE file in the repository root.
|
|
6
|
+
//
|
|
7
|
+
// SPDX-License-Identifier: LicenseRef-Sustainable-Use-1.0
|
|
8
|
+
import { Attribute, AttributeMap, Channel, ChannelMap, Stream, stringCodec } from "@superdurable/dex";
|
|
9
|
+
import { agentEventCodec, agentInterruptListCodec, agentInterruptResolutionCodec, agentMessageChunkCodec, agentMessageCodec, agentMessageIndexCodec, agentPlanCodec, agentStateCodec, agentToolCallCodec, agentUsageCodec, agentUserMessageCodec, planExecutionRequestCodec, contextSummaryCodec, sessionSettingsCodec, turnSessionSettingsCodec, turnReplySequenceCodec, toolCallCancellationCodec, toolCallCompletedCodec, turnCancellationRequestCodec, turnControlRequestCodec, } from "./agent-session-codecs.js";
|
|
10
|
+
/** Default byte budget of the `AgentEvents` Stream: 10 MiB. */
|
|
11
|
+
export const defaultAgentEventsCapacityBytes = 10 * 1024 * 1024;
|
|
12
|
+
export function createAgentSessionPersistence(agentEventsCapacityBytes) {
|
|
13
|
+
return {
|
|
14
|
+
agentState: new Attribute("AgentState", agentStateCodec),
|
|
15
|
+
agentMessages: new AttributeMap("AgentMessages", agentMessageCodec),
|
|
16
|
+
agentMessageChunks: new AttributeMap("AgentMessageChunks", agentMessageChunkCodec),
|
|
17
|
+
agentMessageIndex: new Attribute("AgentMessageIndex", agentMessageIndexCodec),
|
|
18
|
+
frameworkRunState: new Attribute("FrameworkRunState", stringCodec),
|
|
19
|
+
agentToolCalls: new AttributeMap("AgentToolCalls", agentToolCallCodec),
|
|
20
|
+
pendingInterrupts: new Attribute("PendingInterrupts", agentInterruptListCodec),
|
|
21
|
+
agentUsage: new Attribute("AgentUsage", agentUsageCodec),
|
|
22
|
+
queuedUserMessages: new Channel("QueuedUserMessages", agentUserMessageCodec),
|
|
23
|
+
interruptResolutions: new ChannelMap("InterruptResolutions", agentInterruptResolutionCodec),
|
|
24
|
+
toolCallResults: new Channel("ToolCallResults", toolCallCompletedCodec),
|
|
25
|
+
steeredUserMessages: new Channel("SteeredUserMessages", agentUserMessageCodec),
|
|
26
|
+
turnControlRequests: new Channel("TurnControlRequests", turnControlRequestCodec),
|
|
27
|
+
turnCancellationRequest: new Attribute("TurnCancellationRequest", turnCancellationRequestCodec),
|
|
28
|
+
toolCallCancellations: new ChannelMap("ToolCallCancellations", toolCallCancellationCodec),
|
|
29
|
+
agentEvents: new Stream("AgentEvents", agentEventCodec, agentEventsCapacityBytes),
|
|
30
|
+
agentTraceContext: new Attribute("AgentTraceContext", stringCodec),
|
|
31
|
+
agentPlan: new Attribute("AgentPlan", agentPlanCodec),
|
|
32
|
+
planExecutions: new ChannelMap("PlanExecutions", planExecutionRequestCodec),
|
|
33
|
+
pendingPlanExecution: new Attribute("PendingPlanExecution", planExecutionRequestCodec),
|
|
34
|
+
contextSummary: new Attribute("ContextSummary", contextSummaryCodec),
|
|
35
|
+
sessionSettings: new Attribute("SessionSettings", sessionSettingsCodec),
|
|
36
|
+
turnSessionSettings: new Attribute("TurnSessionSettings", turnSessionSettingsCodec),
|
|
37
|
+
turnReplySequence: new Attribute("TurnReplySequence", turnReplySequenceCodec),
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Returns the `AgentMessages` map instance of a message sequence, which is also the `AgentMessageChunks`
|
|
42
|
+
* instance of a chunk that starts at that sequence.
|
|
43
|
+
*
|
|
44
|
+
* A message stays in `AgentMessages` only while it is in the window; read older ones from their chunk, or
|
|
45
|
+
* page through all of them with `list_agent_messages`.
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* ```ts
|
|
49
|
+
* const [message] = await client.getAttributes(sessionId, flow.agentMessages.instance(messageSequenceKey(7)));
|
|
50
|
+
* ```
|
|
51
|
+
* @param sequence - Positive message sequence.
|
|
52
|
+
* @returns The sequence as a 12-digit zero-padded decimal, such as `"000000000007"`.
|
|
53
|
+
* @throws {RangeError} When `sequence` is not a positive safe integer.
|
|
54
|
+
*/
|
|
55
|
+
export function messageSequenceKey(sequence) {
|
|
56
|
+
if (!Number.isSafeInteger(sequence) || sequence <= 0) {
|
|
57
|
+
throw new RangeError(`message sequence must be a positive integer: ${sequence}`);
|
|
58
|
+
}
|
|
59
|
+
return String(sequence).padStart(12, "0");
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Returns the `PlanExecutions` map instance of a plan revision.
|
|
63
|
+
*
|
|
64
|
+
* @param revision - Positive {@link AgentPlan.revision}.
|
|
65
|
+
* @returns The revision as a decimal, such as `"3"`.
|
|
66
|
+
* @throws {RangeError} When `revision` is not a positive safe integer.
|
|
67
|
+
*/
|
|
68
|
+
export function planExecutionKey(revision) {
|
|
69
|
+
if (!Number.isSafeInteger(revision) || revision <= 0) {
|
|
70
|
+
throw new RangeError(`plan revision must be a positive integer: ${revision}`);
|
|
71
|
+
}
|
|
72
|
+
return String(revision);
|
|
73
|
+
}
|
|
74
|
+
//# sourceMappingURL=agent-session-persistence.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-session-persistence.js","sourceRoot":"","sources":["../../src/agent-session-persistence.ts"],"names":[],"mappings":"AAAA,yCAAyC;AACzC,EAAE;AACF,kDAAkD;AAClD,mEAAmE;AACnE,+CAA+C;AAC/C,EAAE;AACF,0DAA0D;AAE1D,OAAO,EAAE,SAAS,EAAE,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G,CAAC,CAAC;AAC5C,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,gBAAgB,CAAC,QAAgB;IAC/C,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,QAAQ,CAAC,IAAI,QAAQ,IAAI,CAAC,EAAE,CAAC;QACrD,MAAM,IAAI,UAAU,CAAC,6CAA6C,QAAQ,EAAE,CAAC,CAAC;IAChF,CAAC;IACD,OAAO,MAAM,CAAC,QAAQ,CAAC,CAAC;AAC1B,CAAC"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import type { SessionSettings } from "./agent-session-values.js";
|
|
2
|
+
/** Largest {@link SessionSettings}, as the UTF-8 bytes of their compact JSON text: 16 KiB. Same in every core. */
|
|
3
|
+
export declare const MAX_SESSION_SETTINGS_BYTES: number;
|
|
4
|
+
/**
|
|
5
|
+
* Extra bytes the session's own Steps and RPC accept over {@link MAX_SESSION_SETTINGS_BYTES}.
|
|
6
|
+
*
|
|
7
|
+
* The cores write some numbers and characters differently, so settings that one core's Client accepted can
|
|
8
|
+
* measure a few bytes more in another core's Worker. The tolerance keeps that from failing a session.
|
|
9
|
+
* {@link validateSessionSettings} checks the exact limit.
|
|
10
|
+
*/
|
|
11
|
+
export declare const SESSION_SETTINGS_SIZE_TOLERANCE_BYTES = 1024;
|
|
12
|
+
/**
|
|
13
|
+
* Returns the size of session settings that {@link MAX_SESSION_SETTINGS_BYTES} limits.
|
|
14
|
+
*
|
|
15
|
+
* The size is the UTF-8 byte length of `JSON.stringify(sessionSettings)`: compact, with characters outside ASCII
|
|
16
|
+
* written as themselves. The Python and Go cores measure their own JSON text, which is the same for strings,
|
|
17
|
+
* integers, booleans, `null`, objects, and arrays, with two exceptions: Python writes floats in their shortest
|
|
18
|
+
* form, such as `1.0` and `1e+16`, where this core writes `1` and `10000000000000000`, and Go escapes U+2028
|
|
19
|
+
* and U+2029. So sizes can differ by a few bytes per float or per such character. The session's Steps and RPC
|
|
20
|
+
* accept {@link SESSION_SETTINGS_SIZE_TOLERANCE_BYTES} more than the limit, so settings that another core's
|
|
21
|
+
* Client accepted never fail a session.
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```ts
|
|
25
|
+
* sessionSettingsSize({ model: "gpt-5-mini" }); // 22
|
|
26
|
+
* ```
|
|
27
|
+
* @param sessionSettings - The settings.
|
|
28
|
+
* @returns The size in bytes.
|
|
29
|
+
* @throws {TypeError} When the settings cannot be written as JSON, such as with a cycle or a `bigint`.
|
|
30
|
+
*/
|
|
31
|
+
export declare function sessionSettingsSize(sessionSettings: SessionSettings): number;
|
|
32
|
+
/**
|
|
33
|
+
* Checks that a value can be a session's settings: a JSON object whose compact JSON text fits in
|
|
34
|
+
* {@link MAX_SESSION_SETTINGS_BYTES}.
|
|
35
|
+
*
|
|
36
|
+
* Call it before `Client.startFlow` or the `update_session_settings` RPC, such as in a form handler. A start whose
|
|
37
|
+
* settings the session refuses fails the session at once, and the RPC returns `false`.
|
|
38
|
+
* `AgentSessionTestClient.startSession` calls it.
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* ```ts
|
|
42
|
+
* validateSessionSettings({ model: "gpt-5-mini" });
|
|
43
|
+
* await client.startFlow(flow, sessionId, { initialMessage: null, sessionSettings: { model: "gpt-5-mini" } });
|
|
44
|
+
* ```
|
|
45
|
+
* @param sessionSettings - The candidate settings.
|
|
46
|
+
* @throws {TypeError} When the value is not a plain JSON object or cannot be written as JSON.
|
|
47
|
+
* @throws {RangeError} When its compact JSON text is larger than {@link MAX_SESSION_SETTINGS_BYTES}.
|
|
48
|
+
*/
|
|
49
|
+
export declare function validateSessionSettings(sessionSettings: unknown): asserts sessionSettings is SessionSettings;
|
|
50
|
+
/**
|
|
51
|
+
* Checks settings as the session's Steps and RPC do: {@link validateSessionSettings} with a limit of
|
|
52
|
+
* {@link MAX_SESSION_SETTINGS_BYTES} plus {@link SESSION_SETTINGS_SIZE_TOLERANCE_BYTES}.
|
|
53
|
+
*
|
|
54
|
+
* @param sessionSettings - The candidate settings.
|
|
55
|
+
* @throws {TypeError} When the value is not a plain JSON object or cannot be written as JSON.
|
|
56
|
+
* @throws {RangeError} When its compact JSON text is larger than the session's limit.
|
|
57
|
+
*/
|
|
58
|
+
export declare function checkStoredSessionSettings(sessionSettings: unknown): asserts sessionSettings is SessionSettings;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
// Copyright (c) 2026 Super Durable, Inc.
|
|
2
|
+
//
|
|
3
|
+
// Licensed under the Sustainable Use License 1.0.
|
|
4
|
+
// You may not use this file except in compliance with the License.
|
|
5
|
+
// See the LICENSE file in the repository root.
|
|
6
|
+
//
|
|
7
|
+
// SPDX-License-Identifier: LicenseRef-Sustainable-Use-1.0
|
|
8
|
+
/** Largest {@link SessionSettings}, as the UTF-8 bytes of their compact JSON text: 16 KiB. Same in every core. */
|
|
9
|
+
export const MAX_SESSION_SETTINGS_BYTES = 16 * 1024;
|
|
10
|
+
/**
|
|
11
|
+
* Extra bytes the session's own Steps and RPC accept over {@link MAX_SESSION_SETTINGS_BYTES}.
|
|
12
|
+
*
|
|
13
|
+
* The cores write some numbers and characters differently, so settings that one core's Client accepted can
|
|
14
|
+
* measure a few bytes more in another core's Worker. The tolerance keeps that from failing a session.
|
|
15
|
+
* {@link validateSessionSettings} checks the exact limit.
|
|
16
|
+
*/
|
|
17
|
+
export const SESSION_SETTINGS_SIZE_TOLERANCE_BYTES = 1024;
|
|
18
|
+
const utf8Encoder = new TextEncoder();
|
|
19
|
+
/**
|
|
20
|
+
* Returns the size of session settings that {@link MAX_SESSION_SETTINGS_BYTES} limits.
|
|
21
|
+
*
|
|
22
|
+
* The size is the UTF-8 byte length of `JSON.stringify(sessionSettings)`: compact, with characters outside ASCII
|
|
23
|
+
* written as themselves. The Python and Go cores measure their own JSON text, which is the same for strings,
|
|
24
|
+
* integers, booleans, `null`, objects, and arrays, with two exceptions: Python writes floats in their shortest
|
|
25
|
+
* form, such as `1.0` and `1e+16`, where this core writes `1` and `10000000000000000`, and Go escapes U+2028
|
|
26
|
+
* and U+2029. So sizes can differ by a few bytes per float or per such character. The session's Steps and RPC
|
|
27
|
+
* accept {@link SESSION_SETTINGS_SIZE_TOLERANCE_BYTES} more than the limit, so settings that another core's
|
|
28
|
+
* Client accepted never fail a session.
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```ts
|
|
32
|
+
* sessionSettingsSize({ model: "gpt-5-mini" }); // 22
|
|
33
|
+
* ```
|
|
34
|
+
* @param sessionSettings - The settings.
|
|
35
|
+
* @returns The size in bytes.
|
|
36
|
+
* @throws {TypeError} When the settings cannot be written as JSON, such as with a cycle or a `bigint`.
|
|
37
|
+
*/
|
|
38
|
+
export function sessionSettingsSize(sessionSettings) {
|
|
39
|
+
return utf8Encoder.encode(JSON.stringify(sessionSettings)).length;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Checks that a value can be a session's settings: a JSON object whose compact JSON text fits in
|
|
43
|
+
* {@link MAX_SESSION_SETTINGS_BYTES}.
|
|
44
|
+
*
|
|
45
|
+
* Call it before `Client.startFlow` or the `update_session_settings` RPC, such as in a form handler. A start whose
|
|
46
|
+
* settings the session refuses fails the session at once, and the RPC returns `false`.
|
|
47
|
+
* `AgentSessionTestClient.startSession` calls it.
|
|
48
|
+
*
|
|
49
|
+
* @example
|
|
50
|
+
* ```ts
|
|
51
|
+
* validateSessionSettings({ model: "gpt-5-mini" });
|
|
52
|
+
* await client.startFlow(flow, sessionId, { initialMessage: null, sessionSettings: { model: "gpt-5-mini" } });
|
|
53
|
+
* ```
|
|
54
|
+
* @param sessionSettings - The candidate settings.
|
|
55
|
+
* @throws {TypeError} When the value is not a plain JSON object or cannot be written as JSON.
|
|
56
|
+
* @throws {RangeError} When its compact JSON text is larger than {@link MAX_SESSION_SETTINGS_BYTES}.
|
|
57
|
+
*/
|
|
58
|
+
export function validateSessionSettings(sessionSettings) {
|
|
59
|
+
checkSessionSettings(sessionSettings, MAX_SESSION_SETTINGS_BYTES);
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Checks settings as the session's Steps and RPC do: {@link validateSessionSettings} with a limit of
|
|
63
|
+
* {@link MAX_SESSION_SETTINGS_BYTES} plus {@link SESSION_SETTINGS_SIZE_TOLERANCE_BYTES}.
|
|
64
|
+
*
|
|
65
|
+
* @param sessionSettings - The candidate settings.
|
|
66
|
+
* @throws {TypeError} When the value is not a plain JSON object or cannot be written as JSON.
|
|
67
|
+
* @throws {RangeError} When its compact JSON text is larger than the session's limit.
|
|
68
|
+
*/
|
|
69
|
+
export function checkStoredSessionSettings(sessionSettings) {
|
|
70
|
+
checkSessionSettings(sessionSettings, MAX_SESSION_SETTINGS_BYTES + SESSION_SETTINGS_SIZE_TOLERANCE_BYTES);
|
|
71
|
+
}
|
|
72
|
+
function checkSessionSettings(sessionSettings, limitBytes) {
|
|
73
|
+
if (typeof sessionSettings !== "object" || sessionSettings === null || Array.isArray(sessionSettings)) {
|
|
74
|
+
throw new TypeError("session settings must be a JSON object");
|
|
75
|
+
}
|
|
76
|
+
const size = sessionSettingsSize(sessionSettings);
|
|
77
|
+
if (size > limitBytes) {
|
|
78
|
+
throw new RangeError(`session settings are ${size} bytes, more than the ${limitBytes} allowed`);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
//# sourceMappingURL=agent-session-settings.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-session-settings.js","sourceRoot":"","sources":["../../src/agent-session-settings.ts"],"names":[],"mappings":"AAAA,yCAAyC;AACzC,EAAE;AACF,kDAAkD;AAClD,mEAAmE;AACnE,+CAA+C;AAC/C,EAAE;AACF,0DAA0D;AAI1D,kHAAkH;AAClH,MAAM,CAAC,MAAM,0BAA0B,GAAG,EAAE,GAAG,IAAI,CAAC;AAEpD;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,qCAAqC,GAAG,IAAI,CAAC;AAE1D,MAAM,WAAW,GAAG,IAAI,WAAW,EAAE,CAAC;AAEtC;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,UAAU,mBAAmB,CAAC,eAAgC;IAClE,OAAO,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,eAAe,CAAC,CAAC,CAAC,MAAM,CAAC;AACpE,CAAC;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,uBAAuB,CAAC,eAAwB;IAC9D,oBAAoB,CAAC,eAAe,EAAE,0BAA0B,CAAC,CAAC;AACpE,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,0BAA0B,CAAC,eAAwB;IACjE,oBAAoB,CAAC,eAAe,EAAE,0BAA0B,GAAG,qCAAqC,CAAC,CAAC;AAC5G,CAAC;AAED,SAAS,oBAAoB,CAAC,eAAwB,EAAE,UAAkB;IACxE,IAAI,OAAO,eAAe,KAAK,QAAQ,IAAI,eAAe,KAAK,IAAI,IAAI,KAAK,CAAC,OAAO,CAAC,eAAe,CAAC,EAAE,CAAC;QACtG,MAAM,IAAI,SAAS,CAAC,wCAAwC,CAAC,CAAC;IAChE,CAAC;IACD,MAAM,IAAI,GAAG,mBAAmB,CAAC,eAAkC,CAAC,CAAC;IACrE,IAAI,IAAI,GAAG,UAAU,EAAE,CAAC;QACtB,MAAM,IAAI,UAAU,CAAC,wBAAwB,IAAI,yBAAyB,UAAU,UAAU,CAAC,CAAC;IAClG,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { ExecuteFailure, type AttributeMapLoad, type RetryPolicy, type StepOptions } from "@superdurable/dex";
|
|
2
|
+
import type { AgentSessionPersistence } from "./agent-session-persistence.js";
|
|
3
|
+
export declare const minuteMs = 60000;
|
|
4
|
+
export declare const modelCallStepOptions: {
|
|
5
|
+
readonly executeMethodTimeoutMs: number;
|
|
6
|
+
readonly heartbeatTimeoutMs: number;
|
|
7
|
+
readonly executeRetry: {
|
|
8
|
+
readonly maximumAttempts: 3;
|
|
9
|
+
readonly totalDurationMs: number;
|
|
10
|
+
};
|
|
11
|
+
readonly executeFailure: ExecuteFailure;
|
|
12
|
+
};
|
|
13
|
+
export declare const recoveryRetry: RetryPolicy;
|
|
14
|
+
export declare const syncDurability: {
|
|
15
|
+
readonly waitForDurability: "sync";
|
|
16
|
+
readonly executeDurability: "sync";
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* The archive chunks a Step reads on top of the whole `AgentMessages` window: exact instances, or every chunk
|
|
20
|
+
* when the model input covers them all.
|
|
21
|
+
*/
|
|
22
|
+
export interface MessageChunkLoads {
|
|
23
|
+
readonly isWholeMap: boolean;
|
|
24
|
+
readonly instances: readonly AttributeMapLoad[];
|
|
25
|
+
}
|
|
26
|
+
/** Returns the options of a Step that reads model input and stores messages, with its chunk loads. */
|
|
27
|
+
export declare function messageStepOptions(persistence: AgentSessionPersistence, stepType: string, chunkLoads: MessageChunkLoads): StepOptions;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// Copyright (c) 2026 Super Durable, Inc.
|
|
2
|
+
//
|
|
3
|
+
// Licensed under the Sustainable Use License 1.0.
|
|
4
|
+
// You may not use this file except in compliance with the License.
|
|
5
|
+
// See the LICENSE file in the repository root.
|
|
6
|
+
//
|
|
7
|
+
// SPDX-License-Identifier: LicenseRef-Sustainable-Use-1.0
|
|
8
|
+
import { ExecuteFailure, StepRef } from "@superdurable/dex";
|
|
9
|
+
import { agentSessionStepTypes } from "./agent-session-step-types.js";
|
|
10
|
+
export const minuteMs = 60_000;
|
|
11
|
+
// CompactContext makes one model call, so it shares RunModel's timeouts and retries.
|
|
12
|
+
export const modelCallStepOptions = {
|
|
13
|
+
executeMethodTimeoutMs: 15 * minuteMs,
|
|
14
|
+
heartbeatTimeoutMs: 2 * minuteMs,
|
|
15
|
+
executeRetry: { maximumAttempts: 3, totalDurationMs: 30 * minuteMs },
|
|
16
|
+
executeFailure: ExecuteFailure.proceedTo(new StepRef(agentSessionStepTypes.recordTurnFailure)),
|
|
17
|
+
};
|
|
18
|
+
// Recovery Steps must eventually run; cap their backoff so a returning Worker picks them up quickly.
|
|
19
|
+
export const recoveryRetry = { maximumIntervalMs: 5_000 };
|
|
20
|
+
// An ASYNC FlowConfig could replay a committed result after a Server failover, re-running a write.
|
|
21
|
+
export const syncDurability = { waitForDurability: "sync", executeDurability: "sync" };
|
|
22
|
+
/** Returns the options of a Step that reads model input and stores messages, with its chunk loads. */
|
|
23
|
+
export function messageStepOptions(persistence, stepType, chunkLoads) {
|
|
24
|
+
const loads = {
|
|
25
|
+
executeLoadAttributeMaps: chunkLoads.isWholeMap
|
|
26
|
+
? [persistence.agentMessages, persistence.agentToolCalls, persistence.agentMessageChunks]
|
|
27
|
+
: [persistence.agentMessages, persistence.agentToolCalls],
|
|
28
|
+
...(chunkLoads.instances.length === 0 ? {} : { executeLoadAttributeMapInstances: chunkLoads.instances }),
|
|
29
|
+
};
|
|
30
|
+
switch (stepType) {
|
|
31
|
+
case agentSessionStepTypes.runModel:
|
|
32
|
+
return { ...syncDurability, ...modelCallStepOptions, ...loads };
|
|
33
|
+
case agentSessionStepTypes.applyTurnControl:
|
|
34
|
+
return { ...syncDurability, executeRetry: recoveryRetry, ...loads };
|
|
35
|
+
default:
|
|
36
|
+
throw new TypeError(`Step type ${stepType} does not read the model input`);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=agent-session-step-options.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-session-step-options.js","sourceRoot":"","sources":["../../src/agent-session-step-options.ts"],"names":[],"mappings":"AAAA,yCAAyC;AACzC,EAAE;AACF,kDAAkD;AAClD,mEAAmE;AACnE,+CAA+C;AAC/C,EAAE;AACF,0DAA0D;AAE1D,OAAO,EAAE,cAAc,EAAE,OAAO,EAA6D,MAAM,mBAAmB,CAAC;AAGvH,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AAEtE,MAAM,CAAC,MAAM,Q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EAAE,GAAG,cAAc,EAAE,YAAY,EAAE,aAAa,EAAE,GAAG,KAAK,EAAE,CAAC;QACtE;YACE,MAAM,IAAI,SAAS,CAAC,aAAa,QAAQ,gCAAgC,CAAC,CAAC;IAC/E,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/** Step types of every agent session Flow, shared with the Python core. */
|
|
2
|
+
export declare const agentSessionStepTypes: {
|
|
3
|
+
readonly startAgentSession: "StartAgentSession";
|
|
4
|
+
readonly awaitUserMessage: "AwaitUserMessage";
|
|
5
|
+
readonly runModel: "RunModel";
|
|
6
|
+
readonly compactContext: "CompactContext";
|
|
7
|
+
readonly awaitToolApproval: "AwaitToolApproval";
|
|
8
|
+
readonly awaitQuestionAnswer: "AwaitQuestionAnswer";
|
|
9
|
+
readonly awaitTimer: "AwaitTimer";
|
|
10
|
+
readonly callTool: "CallTool";
|
|
11
|
+
readonly callSingleAttemptTool: "CallSingleAttemptTool";
|
|
12
|
+
readonly pollToolTask: "PollToolTask";
|
|
13
|
+
readonly recordToolFailure: "RecordToolFailure";
|
|
14
|
+
readonly recordToolOutcomeUnknown: "RecordToolOutcomeUnknown";
|
|
15
|
+
readonly resumeTurn: "ResumeTurn";
|
|
16
|
+
readonly applyTurnControl: "ApplyTurnControl";
|
|
17
|
+
readonly recordTurnFailure: "RecordTurnFailure";
|
|
18
|
+
readonly finishTurnCancellation: "FinishTurnCancellation";
|
|
19
|
+
readonly cancelToolTask: "CancelToolTask";
|
|
20
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// Copyright (c) 2026 Super Durable, Inc.
|
|
2
|
+
//
|
|
3
|
+
// Licensed under the Sustainable Use License 1.0.
|
|
4
|
+
// You may not use this file except in compliance with the License.
|
|
5
|
+
// See the LICENSE file in the repository root.
|
|
6
|
+
//
|
|
7
|
+
// SPDX-License-Identifier: LicenseRef-Sustainable-Use-1.0
|
|
8
|
+
/** Step types of every agent session Flow, shared with the Python core. */
|
|
9
|
+
export const agentSessionStepTypes = {
|
|
10
|
+
startAgentSession: "StartAgentSession",
|
|
11
|
+
awaitUserMessage: "AwaitUserMessage",
|
|
12
|
+
runModel: "RunModel",
|
|
13
|
+
compactContext: "CompactContext",
|
|
14
|
+
awaitToolApproval: "AwaitToolApproval",
|
|
15
|
+
awaitQuestionAnswer: "AwaitQuestionAnswer",
|
|
16
|
+
awaitTimer: "AwaitTimer",
|
|
17
|
+
callTool: "CallTool",
|
|
18
|
+
callSingleAttemptTool: "CallSingleAttemptTool",
|
|
19
|
+
pollToolTask: "PollToolTask",
|
|
20
|
+
recordToolFailure: "RecordToolFailure",
|
|
21
|
+
recordToolOutcomeUnknown: "RecordToolOutcomeUnknown",
|
|
22
|
+
resumeTurn: "ResumeTurn",
|
|
23
|
+
applyTurnControl: "ApplyTurnControl",
|
|
24
|
+
recordTurnFailure: "RecordTurnFailure",
|
|
25
|
+
finishTurnCancellation: "FinishTurnCancellation",
|
|
26
|
+
cancelToolTask: "CancelToolTask",
|
|
27
|
+
};
|
|
28
|
+
//# sourceMappingURL=agent-session-step-types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-session-step-types.js","sourceRoot":"","sources":["../../src/agent-session-step-types.ts"],"names":[],"mappings":"AAAA,yCAAyC;AACzC,EAAE;AACF,kDAAkD;AAClD,mEAAmE;AACnE,+CAA+C;AAC/C,EAAE;AACF,0DAA0D;AAE1D,2EAA2E;AAC3E,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACnC,iBAAiB,EAAE,mBAAmB;IACtC,gBAAgB,EAAE,kBAAkB;IACpC,QAAQ,EAAE,UAAU;IACpB,cAAc,EAAE,gBAAgB;IAChC,iBAAiB,EAAE,mBAAmB;IACtC,mBAAmB,EAAE,qBAAqB;IAC1C,UAAU,EAAE,YAAY;IACxB,QAAQ,EAAE,UAAU;IACpB,qBAAqB,EAAE,uBAAuB;IAC9C,YAAY,EAAE,cAAc;IAC5B,iBAAiB,EAAE,mBAAmB;IACtC,wBAAwB,EAAE,0BAA0B;IACpD,UAAU,EAAE,YAAY;IACxB,gBAAgB,EAAE,kBAAkB;IACpC,iBAAiB,EAAE,mBAAmB;IACtC,sBAAsB,EAAE,wBAAwB;IAChD,cAAc,EAAE,gBAAgB;CACxB,CAAC"}
|