akribes 0.21.17
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 +30 -0
- package/LICENSE +21 -0
- package/README.md +160 -0
- package/dist/client.d.ts +240 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +272 -0
- package/dist/client.js.map +1 -0
- package/dist/errors.d.ts +196 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +274 -0
- package/dist/errors.js.map +1 -0
- package/dist/execution/index.d.ts +3 -0
- package/dist/execution/index.d.ts.map +1 -0
- package/dist/execution/index.js +3 -0
- package/dist/execution/index.js.map +1 -0
- package/dist/execution/replay.d.ts +37 -0
- package/dist/execution/replay.d.ts.map +1 -0
- package/dist/execution/replay.js +59 -0
- package/dist/execution/replay.js.map +1 -0
- package/dist/execution/steps.d.ts +327 -0
- package/dist/execution/steps.d.ts.map +1 -0
- package/dist/execution/steps.js +1068 -0
- package/dist/execution/steps.js.map +1 -0
- package/dist/http.d.ts +53 -0
- package/dist/http.d.ts.map +1 -0
- package/dist/http.js +141 -0
- package/dist/http.js.map +1 -0
- package/dist/index.d.ts +36 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +38 -0
- package/dist/index.js.map +1 -0
- package/dist/runStream.d.ts +176 -0
- package/dist/runStream.d.ts.map +1 -0
- package/dist/runStream.js +408 -0
- package/dist/runStream.js.map +1 -0
- package/dist/sse.d.ts +46 -0
- package/dist/sse.d.ts.map +1 -0
- package/dist/sse.js +218 -0
- package/dist/sse.js.map +1 -0
- package/dist/sub/bench.d.ts +182 -0
- package/dist/sub/bench.d.ts.map +1 -0
- package/dist/sub/bench.js +420 -0
- package/dist/sub/bench.js.map +1 -0
- package/dist/sub/channels.d.ts +22 -0
- package/dist/sub/channels.d.ts.map +1 -0
- package/dist/sub/channels.js +32 -0
- package/dist/sub/channels.js.map +1 -0
- package/dist/sub/clients.d.ts +79 -0
- package/dist/sub/clients.d.ts.map +1 -0
- package/dist/sub/clients.js +190 -0
- package/dist/sub/clients.js.map +1 -0
- package/dist/sub/documents.d.ts +113 -0
- package/dist/sub/documents.d.ts.map +1 -0
- package/dist/sub/documents.js +329 -0
- package/dist/sub/documents.js.map +1 -0
- package/dist/sub/evals.d.ts +71 -0
- package/dist/sub/evals.d.ts.map +1 -0
- package/dist/sub/evals.js +86 -0
- package/dist/sub/evals.js.map +1 -0
- package/dist/sub/events.d.ts +65 -0
- package/dist/sub/events.d.ts.map +1 -0
- package/dist/sub/events.js +154 -0
- package/dist/sub/events.js.map +1 -0
- package/dist/sub/executions.d.ts +255 -0
- package/dist/sub/executions.d.ts.map +1 -0
- package/dist/sub/executions.js +322 -0
- package/dist/sub/executions.js.map +1 -0
- package/dist/sub/mcp.d.ts +51 -0
- package/dist/sub/mcp.d.ts.map +1 -0
- package/dist/sub/mcp.js +42 -0
- package/dist/sub/mcp.js.map +1 -0
- package/dist/sub/projects.d.ts +73 -0
- package/dist/sub/projects.d.ts.map +1 -0
- package/dist/sub/projects.js +101 -0
- package/dist/sub/projects.js.map +1 -0
- package/dist/sub/scripts.d.ts +58 -0
- package/dist/sub/scripts.d.ts.map +1 -0
- package/dist/sub/scripts.js +82 -0
- package/dist/sub/scripts.js.map +1 -0
- package/dist/sub/tokens.d.ts +126 -0
- package/dist/sub/tokens.d.ts.map +1 -0
- package/dist/sub/tokens.js +105 -0
- package/dist/sub/tokens.js.map +1 -0
- package/dist/sub/versions.d.ts +29 -0
- package/dist/sub/versions.d.ts.map +1 -0
- package/dist/sub/versions.js +52 -0
- package/dist/sub/versions.js.map +1 -0
- package/dist/tokenSafety.d.ts +15 -0
- package/dist/tokenSafety.d.ts.map +1 -0
- package/dist/tokenSafety.js +24 -0
- package/dist/tokenSafety.js.map +1 -0
- package/dist/types.d.ts +1147 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +132 -0
- package/dist/types.js.map +1 -0
- package/dist/workflowEvents.d.ts +297 -0
- package/dist/workflowEvents.d.ts.map +1 -0
- package/dist/workflowEvents.js +612 -0
- package/dist/workflowEvents.js.map +1 -0
- package/package.json +57 -0
|
@@ -0,0 +1,327 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared execution step model + event reducer.
|
|
3
|
+
*
|
|
4
|
+
* Folds a stream of `EngineEvent`s (wrapped as `HubEvent`) into a structured
|
|
5
|
+
* list of `ExecutionStep`s that can be rendered by any frontend (React,
|
|
6
|
+
* vanilla DOM, etc.). This is the single source of truth for how raw engine
|
|
7
|
+
* events become user-visible steps — both Studio and the docs `.akr` runner
|
|
8
|
+
* consume it.
|
|
9
|
+
*/
|
|
10
|
+
import type { HubEvent, SuspendTrigger, TypeRef, ValidationErrorWire } from '../types';
|
|
11
|
+
/** Controls where a step is displayed. */
|
|
12
|
+
export type StepVisibility = 'inline' | 'panel-only' | 'hidden';
|
|
13
|
+
/** Token counts attached to a task step (when the engine reports usage). */
|
|
14
|
+
export type StepTokens = {
|
|
15
|
+
input: number;
|
|
16
|
+
output: number;
|
|
17
|
+
cachedInput: number;
|
|
18
|
+
model: string;
|
|
19
|
+
provider: string;
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* Aggregated token totals across every `TaskEnd` inside a single sub-script
|
|
23
|
+
* call. We deliberately don't compute USD client-side: pricing lives in
|
|
24
|
+
* `akribes-server/src/pricing.rs` and would drift if mirrored here. The
|
|
25
|
+
* execution-level USD shown at the top of the panel still covers the run as
|
|
26
|
+
* a whole; per-call USD is a follow-up that needs either a server endpoint
|
|
27
|
+
* or a synced pricing table in the SDK.
|
|
28
|
+
*/
|
|
29
|
+
export type SubScriptTokens = {
|
|
30
|
+
input: number;
|
|
31
|
+
output: number;
|
|
32
|
+
cachedInput: number;
|
|
33
|
+
/** Distinct models seen across the sub-script's `TaskEnd` events.
|
|
34
|
+
* Usually one — multi-task sub-scripts that use different agents will
|
|
35
|
+
* show all of them so the operator can spot model mix at a glance. */
|
|
36
|
+
models: string[];
|
|
37
|
+
};
|
|
38
|
+
/** Structured payload for a `validation_failure` step. Mirrors the wire shape
|
|
39
|
+
* of `EngineEvent::ValidationFailure` (camel-cased on the SDK side). */
|
|
40
|
+
export type ValidationFailurePayload = {
|
|
41
|
+
taskName: string;
|
|
42
|
+
attempt: number;
|
|
43
|
+
modelResponse: string;
|
|
44
|
+
missingFields: string[];
|
|
45
|
+
extraFields: string[];
|
|
46
|
+
typeErrors: string[];
|
|
47
|
+
stopReason: string | null;
|
|
48
|
+
};
|
|
49
|
+
/**
|
|
50
|
+
* Per-task summary surfaced inside a sub-script step's "Timeline" UI section.
|
|
51
|
+
*
|
|
52
|
+
* Each entry corresponds to one wrapped `TaskEnd` (`kind: 'task_end'`) or one
|
|
53
|
+
* wrapped `ValidationFailure` (`kind: 'validation_failure'`) observed on the
|
|
54
|
+
* sub-script's stream. The Studio `SubScriptCard` renders these as a
|
|
55
|
+
* collapsible timeline so operators can see what tasks ran inside a `call(...)`
|
|
56
|
+
* without drilling into the full engine-event log.
|
|
57
|
+
*
|
|
58
|
+
* Intentionally lightweight: we keep per-task rollups (name, duration, tokens,
|
|
59
|
+
* attempt) rather than the streaming `AgentOutput` chunks. Callers that need
|
|
60
|
+
* the full chunk-by-chunk text should request a deeper drill-in (see the
|
|
61
|
+
* sub-script-card brief, "out of scope" section).
|
|
62
|
+
*/
|
|
63
|
+
export type SubScriptTaskSummary = {
|
|
64
|
+
kind: 'task_end';
|
|
65
|
+
/** Task name from the wrapped `TaskEnd.task` field. */
|
|
66
|
+
taskName: string;
|
|
67
|
+
/** Duration in milliseconds. */
|
|
68
|
+
durationMs: number;
|
|
69
|
+
/** 1-indexed attempt number; `> 1` means this task retried. */
|
|
70
|
+
attempt: number;
|
|
71
|
+
/** Token usage when reported by the engine; absent for stdlib calls. */
|
|
72
|
+
tokens?: StepTokens;
|
|
73
|
+
/** Per-task USD cost when reported by the engine (#871). Today the
|
|
74
|
+
* engine doesn't emit cost on `TaskEnd` — pricing is computed
|
|
75
|
+
* server-side at run rollup time — so this field is a placeholder
|
|
76
|
+
* slot. When the server starts attaching `cost_usd` on `TaskEnd`,
|
|
77
|
+
* the reducer will populate this and the UI surfaces it as a
|
|
78
|
+
* per-row badge without further changes. */
|
|
79
|
+
costUsd?: number;
|
|
80
|
+
/** Concatenated `AgentOutput` chunks observed for this task inside its
|
|
81
|
+
* hosting sub-script. Drives the per-task drill-in: clicking the
|
|
82
|
+
* timeline row in `SubScriptCard` expands the streaming text so the
|
|
83
|
+
* operator can see what the LLM actually said inside a nested call.
|
|
84
|
+
* Absent for stdlib tasks (no streaming output) and for any task
|
|
85
|
+
* whose AgentOutput never arrived (e.g. cached / replayed runs that
|
|
86
|
+
* only carry the terminal TaskEnd). */
|
|
87
|
+
streamingOutput?: string;
|
|
88
|
+
} | {
|
|
89
|
+
kind: 'validation_failure';
|
|
90
|
+
/** The task whose output failed validation. */
|
|
91
|
+
taskName: string;
|
|
92
|
+
/** 1-indexed attempt number that failed. */
|
|
93
|
+
attempt: number;
|
|
94
|
+
};
|
|
95
|
+
/** Per-turn aggregate inside a loop step. `toolCalls` mirrors
|
|
96
|
+
* `EngineEvent::LoopTurn.tool_calls` — names of the tools the agent invoked
|
|
97
|
+
* this turn (in dispatch order, includes synthetic `state_get`,
|
|
98
|
+
* `state_update`, `return`, plus user `skills:` entries). */
|
|
99
|
+
export type LoopTurnSummary = {
|
|
100
|
+
turn: number;
|
|
101
|
+
toolCalls: string[];
|
|
102
|
+
};
|
|
103
|
+
export type ExecutionStep = {
|
|
104
|
+
id: string;
|
|
105
|
+
line: number;
|
|
106
|
+
type: 'execution' | 'chat' | 'variable' | 'tool_call' | 'sub_script' | 'validation_failure' | 'loop';
|
|
107
|
+
content: string;
|
|
108
|
+
status?: 'pending' | 'running' | 'success' | 'error';
|
|
109
|
+
variables?: Record<string, any>;
|
|
110
|
+
timestamp: number;
|
|
111
|
+
/** Server-attached monotonic sequence number. Undefined when the server
|
|
112
|
+
* predates the seq plumbing or when the reducer ran on an event from a
|
|
113
|
+
* legacy source (e.g. replay from an older log). */
|
|
114
|
+
seq?: number;
|
|
115
|
+
/** Server-attached epoch-ms timestamp parsed from the `at` field. Distinct
|
|
116
|
+
* from `timestamp` (which is `Date.now()` at reduce time on the client). */
|
|
117
|
+
serverTs?: number;
|
|
118
|
+
/** Set on `validation_failure` steps only — the structured payload from
|
|
119
|
+
* `EngineEvent::ValidationFailure`. */
|
|
120
|
+
validationFailure?: ValidationFailurePayload;
|
|
121
|
+
agent?: string;
|
|
122
|
+
taskId?: string;
|
|
123
|
+
/** Task name from the engine. Distinct from `agent` (which prefers
|
|
124
|
+
* the explicit agent name when one is set). Used by the TaskEnd
|
|
125
|
+
* reducer to merge the structured result back into the streaming
|
|
126
|
+
* chat step instead of producing a duplicate row. */
|
|
127
|
+
taskName?: string;
|
|
128
|
+
schemaType?: string;
|
|
129
|
+
duration?: number;
|
|
130
|
+
prompt?: string;
|
|
131
|
+
nodeId?: number;
|
|
132
|
+
cached?: boolean;
|
|
133
|
+
visibility?: StepVisibility;
|
|
134
|
+
/** Token usage reported on TaskEnd (not set for other step types). */
|
|
135
|
+
tokens?: StepTokens;
|
|
136
|
+
/** Error kind when status === 'error' (from the engine's Error event). */
|
|
137
|
+
errorKind?: string;
|
|
138
|
+
/** Stable AKRIBES-E-XXX code attached to the error event (when present). */
|
|
139
|
+
errorCode?: string;
|
|
140
|
+
/** User-facing message from the error envelope. Render this verbatim
|
|
141
|
+
* in the UI; the developer-oriented `content` already contains the
|
|
142
|
+
* raw `message`. */
|
|
143
|
+
errorUserMessage?: string;
|
|
144
|
+
/** Provider's retry-after hint in milliseconds (when present). UI can
|
|
145
|
+
* surface "retry in N seconds" affordances without re-deriving. */
|
|
146
|
+
errorRetryAfterMs?: number;
|
|
147
|
+
/** Where the error originated. Optional fields — render whichever are
|
|
148
|
+
* present. */
|
|
149
|
+
errorSource?: {
|
|
150
|
+
task?: string;
|
|
151
|
+
agent?: string;
|
|
152
|
+
provider?: string;
|
|
153
|
+
model?: string;
|
|
154
|
+
toolRef?: string;
|
|
155
|
+
script?: string;
|
|
156
|
+
line?: number;
|
|
157
|
+
};
|
|
158
|
+
/** Tool name for tool_call steps (from ToolCallStart/ToolCallEnd events). */
|
|
159
|
+
toolName?: string;
|
|
160
|
+
/** MCP server name for tool_call steps. */
|
|
161
|
+
serverName?: string;
|
|
162
|
+
/** Input passed to the tool call. */
|
|
163
|
+
toolInput?: Record<string, any>;
|
|
164
|
+
/** Output returned by the tool call. */
|
|
165
|
+
toolOutput?: Record<string, any>;
|
|
166
|
+
/** Structured type of the task result value, as reported by the engine on TaskEnd. */
|
|
167
|
+
valueType?: TypeRef | null;
|
|
168
|
+
/** 1-indexed attempt number from TaskEnd (> 1 means a retry occurred). */
|
|
169
|
+
attempt?: number;
|
|
170
|
+
/** Number of validation retries the engine made before suspending. Set
|
|
171
|
+
* when a Suspended event arrives with a `ValidationExhausted` trigger. */
|
|
172
|
+
retryCount?: number;
|
|
173
|
+
/** Raw last-attempt output that failed validation. Set alongside
|
|
174
|
+
* `validationErrors` on `ValidationExhausted` suspensions so the UI can
|
|
175
|
+
* show the author what the model actually produced. */
|
|
176
|
+
lastAttempt?: string;
|
|
177
|
+
/** Per-stage validation errors collected from a `ValidationExhausted`
|
|
178
|
+
* trigger. Each entry carries the stage (`parse`/`schema`/`custom:<rule>`),
|
|
179
|
+
* a human-readable message, and an optional JSON-pointer path. */
|
|
180
|
+
validationErrors?: ValidationErrorWire[];
|
|
181
|
+
/** Name of the `checkpoint` block the engine suspended at. Set on the
|
|
182
|
+
* step produced by a `Suspended` engine event so the UI can scope the
|
|
183
|
+
* resume action to a specific checkpoint. */
|
|
184
|
+
checkpointName?: string;
|
|
185
|
+
/** Why the engine suspended — one of `DagPosition`, `ValidationExhausted`,
|
|
186
|
+
* `AgentUnable`, or a forward-compat `UnknownSuspendTrigger`. Carries the
|
|
187
|
+
* typed payload (task name, unable record, etc.) so the UI can render a
|
|
188
|
+
* trigger-aware checkpoint card or pre-fill the resume modal. */
|
|
189
|
+
suspendTrigger?: SuspendTrigger;
|
|
190
|
+
/** Opaque token the server expects back on `resume_execution`. Set only on
|
|
191
|
+
* steps produced by a `Suspended` event. */
|
|
192
|
+
suspendToken?: string;
|
|
193
|
+
/** Checkpoint prompt text (the `prompt:` property on the `checkpoint`
|
|
194
|
+
* block). Useful for showing the human operator what they're approving. */
|
|
195
|
+
suspendPrompt?: string;
|
|
196
|
+
/** JSON schema describing the expected resume payload. The UI can use
|
|
197
|
+
* this to render a form or validate edits before calling `resume`. */
|
|
198
|
+
suspendSchema?: unknown;
|
|
199
|
+
/** Cross-script `call(...)` metadata for `type === 'sub_script'` steps.
|
|
200
|
+
* Set incrementally as the sub-script's wrapped event stream lands:
|
|
201
|
+
* the parent variable name + script name come from the first envelope,
|
|
202
|
+
* inputs come from the sub-engine's leading `StateUpdate` events,
|
|
203
|
+
* output comes from the wrapped terminal `WorkflowEnd`, and
|
|
204
|
+
* `subScriptTokens` totals every wrapped `TaskEnd`'s usage. */
|
|
205
|
+
subScript?: {
|
|
206
|
+
/** Called script's name as it appears in the `call("…")` site. No
|
|
207
|
+
* channel/version surfaced today — the engine doesn't expose it on the
|
|
208
|
+
* envelope. Follow-up if/when needed. */
|
|
209
|
+
scriptName: string;
|
|
210
|
+
/** Variable on the parent side that received the call result, e.g. `out`
|
|
211
|
+
* in `out = call("foo", x=1)`. `<anonymous>` when the call result was
|
|
212
|
+
* not bound to a name (engine fallback). */
|
|
213
|
+
parentTask: string;
|
|
214
|
+
/** Resolved inputs collected from the sub-engine's input-hydration
|
|
215
|
+
* `StateUpdate` events. Order is engine-emitted (input-block order). */
|
|
216
|
+
inputs: {
|
|
217
|
+
name: string;
|
|
218
|
+
value: unknown;
|
|
219
|
+
}[];
|
|
220
|
+
/** Sub-script's terminal `WorkflowEnd` value. `undefined` while the
|
|
221
|
+
* sub-script is still running; set once we see WorkflowEnd. */
|
|
222
|
+
output?: unknown;
|
|
223
|
+
/** Aggregated token usage across every `TaskEnd` reachable from this
|
|
224
|
+
* sub-script — INCLUDING descendants. Equals `selfTokens` plus the
|
|
225
|
+
* rolled-up `subScriptTokens` of every entry in `children`. The UI
|
|
226
|
+
* shows this as the headline cost figure for the call. */
|
|
227
|
+
subScriptTokens?: SubScriptTokens;
|
|
228
|
+
/** Token usage from `TaskEnd` events that the sub-script ran DIRECTLY,
|
|
229
|
+
* excluding any descendants. The UI uses `subScriptTokens - selfTokens`
|
|
230
|
+
* to render "of which X% from nested calls" so operators can attribute
|
|
231
|
+
* spend to a specific level instead of having to read the call chain. */
|
|
232
|
+
selfTokens?: SubScriptTokens;
|
|
233
|
+
/** Number of nested `TaskEnd` events folded into the totals. Useful for
|
|
234
|
+
* the UI to show "3 tasks" without re-counting child events. */
|
|
235
|
+
nestedTaskCount?: number;
|
|
236
|
+
/** Set true once we observe the sub-script's terminal `WorkflowEnd` (or
|
|
237
|
+
* an `Error`). False while the sub-script is still streaming events.
|
|
238
|
+
* The reducer uses this to decide whether the next SubScript event for
|
|
239
|
+
* the same `parentTask` should accumulate or open a fresh call. */
|
|
240
|
+
closed?: boolean;
|
|
241
|
+
/** Per-task summaries collected from this sub-script's wrapped `TaskEnd`
|
|
242
|
+
* and `ValidationFailure` events. Drives the Studio "Timeline" drill-in
|
|
243
|
+
* in `SubScriptCard`. Only populated for the level that directly hosts
|
|
244
|
+
* the wrapped task event — nested sub-scripts maintain their own
|
|
245
|
+
* summary list under `children[].subScript.taskSummaries`. */
|
|
246
|
+
taskSummaries?: SubScriptTaskSummary[];
|
|
247
|
+
/** Internal buffer: streaming `AgentOutput` chunks per task name, kept
|
|
248
|
+
* in-flight until the matching `TaskEnd` arrives and attaches the
|
|
249
|
+
* concatenated text to the summary as `streamingOutput`. Not part of
|
|
250
|
+
* the wire format; reducer-private state. Underscore-prefixed so
|
|
251
|
+
* consumers know it is implementation detail. */
|
|
252
|
+
_streamingByTask?: Record<string, string>;
|
|
253
|
+
/** Nested sub-script calls (depth > 1). When script A calls B which calls
|
|
254
|
+
* C, the C call lives here on the B step (which itself lives in A's
|
|
255
|
+
* `children`). Each entry is a fully-formed `ExecutionStep` with
|
|
256
|
+
* `type === 'sub_script'`, so the renderer can recurse with the same
|
|
257
|
+
* `SubScriptCard` component. Token totals on the parent already include
|
|
258
|
+
* the rollup from every descendant. */
|
|
259
|
+
children?: ExecutionStep[];
|
|
260
|
+
};
|
|
261
|
+
/** Loop block name (`loop NAME(...) -> Ret`), set on `type === 'loop'`
|
|
262
|
+
* steps from the `EngineEvent::LoopStart.name` field. The reducer keys
|
|
263
|
+
* in-flight loop steps by this name so `LoopTurn`/`LoopEnd` events fold
|
|
264
|
+
* back into the right step. */
|
|
265
|
+
loopName?: string;
|
|
266
|
+
/** Resolved upper-bound turn budget — declared `max_turns:` if set,
|
|
267
|
+
* otherwise the engine's `LOOP_MAX_TURNS_DEFAULT`. Set from
|
|
268
|
+
* `EngineEvent::LoopStart.max_turns`. */
|
|
269
|
+
maxTurns?: number;
|
|
270
|
+
/** One entry per `EngineEvent::LoopTurn` observed, in arrival order. */
|
|
271
|
+
turns?: LoopTurnSummary[];
|
|
272
|
+
/** The agent's submitted return value (from `return(...)`), the final
|
|
273
|
+
* state on a natural `stop_when:` exit, or a `Value::FatalError`-shaped
|
|
274
|
+
* envelope when the loop exhausted its `max_turns` budget. Carried
|
|
275
|
+
* verbatim from `EngineEvent::LoopEnd.value` so the UI can render it
|
|
276
|
+
* through `AkribesValueViewerWithRawToggle` the same way it renders any
|
|
277
|
+
* other task result. */
|
|
278
|
+
loopResult?: unknown;
|
|
279
|
+
};
|
|
280
|
+
/**
|
|
281
|
+
* Mutable ref-like object for tracking active line synchronously.
|
|
282
|
+
* Using a ref avoids the stale-closure problem where React state hasn't
|
|
283
|
+
* re-rendered yet when the next event arrives in the same batch.
|
|
284
|
+
*/
|
|
285
|
+
export type ActiveLineRef = {
|
|
286
|
+
current: number | null;
|
|
287
|
+
};
|
|
288
|
+
/** Mutable ref-like object for tracking the current node id. */
|
|
289
|
+
export type ActiveNodeRef = {
|
|
290
|
+
current: number | null;
|
|
291
|
+
};
|
|
292
|
+
/**
|
|
293
|
+
* Side effects the reducer signals to the caller. The reducer is pure w.r.t.
|
|
294
|
+
* step state but needs to communicate updates to activeLine, globalEnv, and
|
|
295
|
+
* execution lifecycle.
|
|
296
|
+
*/
|
|
297
|
+
export type ReducerSideEffects = {
|
|
298
|
+
setActiveLine?: number | null;
|
|
299
|
+
globalEnvUpdates?: Record<string, any>;
|
|
300
|
+
executionFinished?: boolean;
|
|
301
|
+
refreshHistory?: boolean;
|
|
302
|
+
breakpoint?: {
|
|
303
|
+
nodeId: number;
|
|
304
|
+
token: string;
|
|
305
|
+
envSnapshot: Record<string, any>;
|
|
306
|
+
line: number;
|
|
307
|
+
};
|
|
308
|
+
breakpointResumed?: boolean;
|
|
309
|
+
};
|
|
310
|
+
/**
|
|
311
|
+
* Pure reducer: takes current steps + a hub event, returns new steps + side
|
|
312
|
+
* effects. This is the core event-handling logic shared between Studio's
|
|
313
|
+
* live panel and the docs runner.
|
|
314
|
+
*/
|
|
315
|
+
export declare function reduceExecutionEvent(prev: ExecutionStep[], hubEvt: HubEvent, activeLineRef: ActiveLineRef, activeNodeRef: ActiveNodeRef): {
|
|
316
|
+
steps: ExecutionStep[];
|
|
317
|
+
effects: ReducerSideEffects;
|
|
318
|
+
};
|
|
319
|
+
/**
|
|
320
|
+
* Helper to build run-from-line parameters from a previous execution's steps.
|
|
321
|
+
* Returns null if there's no previous execution to build from.
|
|
322
|
+
*/
|
|
323
|
+
export declare function buildRunFromParams(executionSteps: ExecutionStep[], targetLine: number): {
|
|
324
|
+
seedEnv: Record<string, unknown>;
|
|
325
|
+
skipNodeIds: number[];
|
|
326
|
+
} | null;
|
|
327
|
+
//# sourceMappingURL=steps.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"steps.d.ts","sourceRoot":"","sources":["../../src/execution/steps.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO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