@sudocode-ai/local-server 0.1.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/README.md +19 -0
- package/dist/cli.d.ts +7 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +105 -0
- package/dist/cli.js.map +7 -0
- package/dist/execution/engine/engine.d.ts +103 -0
- package/dist/execution/engine/engine.d.ts.map +1 -0
- package/dist/execution/engine/simple-engine.d.ts +190 -0
- package/dist/execution/engine/simple-engine.d.ts.map +1 -0
- package/dist/execution/engine/types.d.ts +116 -0
- package/dist/execution/engine/types.d.ts.map +1 -0
- package/dist/execution/output/ag-ui-adapter.d.ts +176 -0
- package/dist/execution/output/ag-ui-adapter.d.ts.map +1 -0
- package/dist/execution/output/ag-ui-integration.d.ts +96 -0
- package/dist/execution/output/ag-ui-integration.d.ts.map +1 -0
- package/dist/execution/output/claude-code-output-processor.d.ts +321 -0
- package/dist/execution/output/claude-code-output-processor.d.ts.map +1 -0
- package/dist/execution/output/index.d.ts +18 -0
- package/dist/execution/output/index.d.ts.map +1 -0
- package/dist/execution/output/types.d.ts +421 -0
- package/dist/execution/output/types.d.ts.map +1 -0
- package/dist/execution/process/builders/claude.d.ts +86 -0
- package/dist/execution/process/builders/claude.d.ts.map +1 -0
- package/dist/execution/process/index.d.ts +15 -0
- package/dist/execution/process/index.d.ts.map +1 -0
- package/dist/execution/process/manager.d.ts +133 -0
- package/dist/execution/process/manager.d.ts.map +1 -0
- package/dist/execution/process/simple-manager.d.ts +102 -0
- package/dist/execution/process/simple-manager.d.ts.map +1 -0
- package/dist/execution/process/types.d.ts +105 -0
- package/dist/execution/process/types.d.ts.map +1 -0
- package/dist/execution/process/utils.d.ts +53 -0
- package/dist/execution/process/utils.d.ts.map +1 -0
- package/dist/execution/resilience/circuit-breaker.d.ts +170 -0
- package/dist/execution/resilience/circuit-breaker.d.ts.map +1 -0
- package/dist/execution/resilience/executor.d.ts +109 -0
- package/dist/execution/resilience/executor.d.ts.map +1 -0
- package/dist/execution/resilience/index.d.ts +14 -0
- package/dist/execution/resilience/index.d.ts.map +1 -0
- package/dist/execution/resilience/resilient-executor.d.ts +86 -0
- package/dist/execution/resilience/resilient-executor.d.ts.map +1 -0
- package/dist/execution/resilience/retry.d.ts +161 -0
- package/dist/execution/resilience/retry.d.ts.map +1 -0
- package/dist/execution/resilience/types.d.ts +226 -0
- package/dist/execution/resilience/types.d.ts.map +1 -0
- package/dist/execution/transport/event-buffer.d.ts +119 -0
- package/dist/execution/transport/event-buffer.d.ts.map +1 -0
- package/dist/execution/transport/index.d.ts +10 -0
- package/dist/execution/transport/index.d.ts.map +1 -0
- package/dist/execution/transport/sse-transport.d.ts +146 -0
- package/dist/execution/transport/sse-transport.d.ts.map +1 -0
- package/dist/execution/transport/transport-manager.d.ts +176 -0
- package/dist/execution/transport/transport-manager.d.ts.map +1 -0
- package/dist/execution/workflow/index.d.ts +13 -0
- package/dist/execution/workflow/index.d.ts.map +1 -0
- package/dist/execution/workflow/linear-orchestrator.d.ts +216 -0
- package/dist/execution/workflow/linear-orchestrator.d.ts.map +1 -0
- package/dist/execution/workflow/memory-storage.d.ts +54 -0
- package/dist/execution/workflow/memory-storage.d.ts.map +1 -0
- package/dist/execution/workflow/orchestrator.d.ts +158 -0
- package/dist/execution/workflow/orchestrator.d.ts.map +1 -0
- package/dist/execution/workflow/types.d.ts +172 -0
- package/dist/execution/workflow/types.d.ts.map +1 -0
- package/dist/execution/workflow/utils.d.ts +89 -0
- package/dist/execution/workflow/utils.d.ts.map +1 -0
- package/dist/execution/worktree/config.d.ts +74 -0
- package/dist/execution/worktree/config.d.ts.map +1 -0
- package/dist/execution/worktree/git-cli.d.ts +151 -0
- package/dist/execution/worktree/git-cli.d.ts.map +1 -0
- package/dist/execution/worktree/index.d.ts +16 -0
- package/dist/execution/worktree/index.d.ts.map +1 -0
- package/dist/execution/worktree/manager.d.ts +184 -0
- package/dist/execution/worktree/manager.d.ts.map +1 -0
- package/dist/execution/worktree/types.d.ts +90 -0
- package/dist/execution/worktree/types.d.ts.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +104 -0
- package/dist/index.js.map +7 -0
- package/dist/public/assets/index-C4SmlXoo.js +568 -0
- package/dist/public/assets/index-C4SmlXoo.js.map +1 -0
- package/dist/public/assets/index-DE59j7ti.css +1 -0
- package/dist/public/assets/react-vendor-LX0UoTxg.js +60 -0
- package/dist/public/assets/react-vendor-LX0UoTxg.js.map +1 -0
- package/dist/public/assets/ui-vendor-_cxVHaqZ.js +54 -0
- package/dist/public/assets/ui-vendor-_cxVHaqZ.js.map +1 -0
- package/dist/public/favicon.ico +0 -0
- package/dist/public/index.html +16 -0
- package/dist/public/logo.png +0 -0
- package/dist/routes/executions-stream.d.ts +24 -0
- package/dist/routes/executions-stream.d.ts.map +1 -0
- package/dist/routes/executions.d.ts +19 -0
- package/dist/routes/executions.d.ts.map +1 -0
- package/dist/routes/feedback.d.ts +7 -0
- package/dist/routes/feedback.d.ts.map +1 -0
- package/dist/routes/issues.d.ts +7 -0
- package/dist/routes/issues.d.ts.map +1 -0
- package/dist/routes/relationships.d.ts +7 -0
- package/dist/routes/relationships.d.ts.map +1 -0
- package/dist/routes/specs.d.ts +7 -0
- package/dist/routes/specs.d.ts.map +1 -0
- package/dist/services/db.d.ts +33 -0
- package/dist/services/db.d.ts.map +1 -0
- package/dist/services/execution-lifecycle.d.ts +108 -0
- package/dist/services/execution-lifecycle.d.ts.map +1 -0
- package/dist/services/execution-service.d.ts +185 -0
- package/dist/services/execution-service.d.ts.map +1 -0
- package/dist/services/executions.d.ts +59 -0
- package/dist/services/executions.d.ts.map +1 -0
- package/dist/services/export.d.ts +24 -0
- package/dist/services/export.d.ts.map +1 -0
- package/dist/services/feedback.d.ts +40 -0
- package/dist/services/feedback.d.ts.map +1 -0
- package/dist/services/issues.d.ts +27 -0
- package/dist/services/issues.d.ts.map +1 -0
- package/dist/services/prompt-template-engine.d.ts +108 -0
- package/dist/services/prompt-template-engine.d.ts.map +1 -0
- package/dist/services/prompt-templates.d.ts +97 -0
- package/dist/services/prompt-templates.d.ts.map +1 -0
- package/dist/services/relationships.d.ts +35 -0
- package/dist/services/relationships.d.ts.map +1 -0
- package/dist/services/specs.d.ts +27 -0
- package/dist/services/specs.d.ts.map +1 -0
- package/dist/services/watcher.d.ts +50 -0
- package/dist/services/watcher.d.ts.map +1 -0
- package/dist/services/websocket.d.ts +127 -0
- package/dist/services/websocket.d.ts.map +1 -0
- package/dist/utils/sudocode-dir.d.ts +6 -0
- package/dist/utils/sudocode-dir.d.ts.map +1 -0
- package/package.json +74 -0
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Transport Manager
|
|
3
|
+
*
|
|
4
|
+
* Coordinates between AG-UI adapter and SSE transport layer.
|
|
5
|
+
* Acts as a facade that routes adapter events to appropriate transport methods.
|
|
6
|
+
*
|
|
7
|
+
* @module execution/transport/transport-manager
|
|
8
|
+
*/
|
|
9
|
+
import type { AgUiEventAdapter } from "../output/ag-ui-adapter.js";
|
|
10
|
+
import type { RunStartedEvent, RunFinishedEvent, RunErrorEvent, StepStartedEvent, StepFinishedEvent, ToolCallStartEvent, ToolCallArgsEvent, ToolCallEndEvent, ToolCallResultEvent, TextMessageStartEvent, TextMessageContentEvent, TextMessageEndEvent, StateDeltaEvent, StateSnapshotEvent, CustomEvent } from "@ag-ui/core";
|
|
11
|
+
import { SseTransport } from "./sse-transport.js";
|
|
12
|
+
/**
|
|
13
|
+
* Union type for all AG-UI events
|
|
14
|
+
*/
|
|
15
|
+
export type AgUiEvent = RunStartedEvent | RunFinishedEvent | RunErrorEvent | StepStartedEvent | StepFinishedEvent | ToolCallStartEvent | ToolCallArgsEvent | ToolCallEndEvent | ToolCallResultEvent | TextMessageStartEvent | TextMessageContentEvent | TextMessageEndEvent | StateDeltaEvent | StateSnapshotEvent | CustomEvent;
|
|
16
|
+
/**
|
|
17
|
+
* TransportManager - Coordinates AG-UI events with SSE transport
|
|
18
|
+
*
|
|
19
|
+
* Manages the connection between AG-UI adapters and SSE transport,
|
|
20
|
+
* routing events to appropriate broadcast methods based on run filtering.
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```typescript
|
|
24
|
+
* const manager = new TransportManager();
|
|
25
|
+
* const adapter = new AgUiEventAdapter('run-123');
|
|
26
|
+
*
|
|
27
|
+
* // Connect adapter to transport
|
|
28
|
+
* manager.connectAdapter(adapter, 'run-123');
|
|
29
|
+
*
|
|
30
|
+
* // Events from adapter are now automatically broadcast via SSE
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
export declare class TransportManager {
|
|
34
|
+
private sseTransport;
|
|
35
|
+
private eventBuffer;
|
|
36
|
+
private adapterListeners;
|
|
37
|
+
private pruneInterval;
|
|
38
|
+
/**
|
|
39
|
+
* Create a new transport manager
|
|
40
|
+
*
|
|
41
|
+
* Initializes the SSE transport layer and event buffer
|
|
42
|
+
*/
|
|
43
|
+
constructor();
|
|
44
|
+
/**
|
|
45
|
+
* Connect AG-UI adapter to SSE transport
|
|
46
|
+
*
|
|
47
|
+
* Subscribes to adapter's event stream and routes events to SSE transport.
|
|
48
|
+
* If runId is provided, events are broadcast only to clients watching that run.
|
|
49
|
+
* Otherwise, events are broadcast to all connected clients.
|
|
50
|
+
*
|
|
51
|
+
* @param adapter - AG-UI event adapter to connect
|
|
52
|
+
* @param runId - Optional run ID for filtering events
|
|
53
|
+
*
|
|
54
|
+
* @example
|
|
55
|
+
* ```typescript
|
|
56
|
+
* const adapter = new AgUiEventAdapter('run-123');
|
|
57
|
+
* manager.connectAdapter(adapter, 'run-123');
|
|
58
|
+
* ```
|
|
59
|
+
*/
|
|
60
|
+
connectAdapter(adapter: AgUiEventAdapter, runId?: string): void;
|
|
61
|
+
/**
|
|
62
|
+
* Disconnect AG-UI adapter from transport
|
|
63
|
+
*
|
|
64
|
+
* Removes the adapter's event listener and stops broadcasting its events.
|
|
65
|
+
*
|
|
66
|
+
* @param adapter - AG-UI event adapter to disconnect
|
|
67
|
+
* @returns true if adapter was disconnected, false if not found
|
|
68
|
+
*/
|
|
69
|
+
disconnectAdapter(adapter: AgUiEventAdapter): boolean;
|
|
70
|
+
/**
|
|
71
|
+
* Broadcast event to all connected clients
|
|
72
|
+
*
|
|
73
|
+
* @param event - AG-UI event to broadcast
|
|
74
|
+
* @returns Number of clients that received the event
|
|
75
|
+
*
|
|
76
|
+
* @example
|
|
77
|
+
* ```typescript
|
|
78
|
+
* manager.broadcast({
|
|
79
|
+
* type: EventType.RUN_STARTED,
|
|
80
|
+
* runId: 'run-123',
|
|
81
|
+
* threadId: 'run-123',
|
|
82
|
+
* timestamp: Date.now()
|
|
83
|
+
* });
|
|
84
|
+
* ```
|
|
85
|
+
*/
|
|
86
|
+
broadcast(event: AgUiEvent): number;
|
|
87
|
+
/**
|
|
88
|
+
* Broadcast event to clients watching a specific run
|
|
89
|
+
*
|
|
90
|
+
* @param runId - Target run ID
|
|
91
|
+
* @param event - AG-UI event to broadcast
|
|
92
|
+
* @returns Number of clients that received the event
|
|
93
|
+
*
|
|
94
|
+
* @example
|
|
95
|
+
* ```typescript
|
|
96
|
+
* manager.broadcastToRun('run-123', {
|
|
97
|
+
* type: EventType.TOOL_CALL_START,
|
|
98
|
+
* toolCallId: 'tool-1',
|
|
99
|
+
* toolCallName: 'Read',
|
|
100
|
+
* timestamp: Date.now()
|
|
101
|
+
* });
|
|
102
|
+
* ```
|
|
103
|
+
*/
|
|
104
|
+
broadcastToRun(runId: string, event: AgUiEvent): number;
|
|
105
|
+
/**
|
|
106
|
+
* Get underlying SSE transport
|
|
107
|
+
*
|
|
108
|
+
* Provides access to the SSE transport for route handlers
|
|
109
|
+
* that need to manage client connections.
|
|
110
|
+
*
|
|
111
|
+
* @returns SSE transport instance
|
|
112
|
+
*
|
|
113
|
+
* @example
|
|
114
|
+
* ```typescript
|
|
115
|
+
* const transport = manager.getSseTransport();
|
|
116
|
+
*
|
|
117
|
+
* // Handle SSE connection in route
|
|
118
|
+
* app.get('/api/events', (req, res) => {
|
|
119
|
+
* transport.handleConnection(clientId, res, runId);
|
|
120
|
+
* });
|
|
121
|
+
* ```
|
|
122
|
+
*/
|
|
123
|
+
getSseTransport(): SseTransport;
|
|
124
|
+
/**
|
|
125
|
+
* Get number of connected adapters
|
|
126
|
+
*
|
|
127
|
+
* @returns Number of active adapter connections
|
|
128
|
+
*/
|
|
129
|
+
getAdapterCount(): number;
|
|
130
|
+
/**
|
|
131
|
+
* Get buffered events for an execution
|
|
132
|
+
*
|
|
133
|
+
* Returns all events that have been buffered for the specified execution.
|
|
134
|
+
* Useful for replaying events to late-joining clients.
|
|
135
|
+
*
|
|
136
|
+
* @param runId - Target run ID
|
|
137
|
+
* @param fromSequence - Optional: only return events >= this sequence number
|
|
138
|
+
* @returns Array of buffered events
|
|
139
|
+
*
|
|
140
|
+
* @example
|
|
141
|
+
* ```typescript
|
|
142
|
+
* const events = manager.getBufferedEvents('run-123');
|
|
143
|
+
* for (const buffered of events) {
|
|
144
|
+
* console.log(buffered.event.type, buffered.sequenceNumber);
|
|
145
|
+
* }
|
|
146
|
+
* ```
|
|
147
|
+
*/
|
|
148
|
+
getBufferedEvents(runId: string, fromSequence?: number): import("./event-buffer.js").BufferedEvent[];
|
|
149
|
+
/**
|
|
150
|
+
* Check if events are buffered for an execution
|
|
151
|
+
*
|
|
152
|
+
* @param runId - Target run ID
|
|
153
|
+
* @returns true if events are buffered
|
|
154
|
+
*/
|
|
155
|
+
hasBufferedEvents(runId: string): boolean;
|
|
156
|
+
/**
|
|
157
|
+
* Get buffer statistics
|
|
158
|
+
*
|
|
159
|
+
* @returns Buffer statistics
|
|
160
|
+
*/
|
|
161
|
+
getBufferStats(): {
|
|
162
|
+
bufferCount: number;
|
|
163
|
+
totalEvents: number;
|
|
164
|
+
avgEventsPerBuffer: number;
|
|
165
|
+
oldestBuffer: number | null;
|
|
166
|
+
newestBuffer: number | null;
|
|
167
|
+
};
|
|
168
|
+
/**
|
|
169
|
+
* Shutdown transport manager
|
|
170
|
+
*
|
|
171
|
+
* Disconnects all adapters and shuts down SSE transport.
|
|
172
|
+
* Closes all client connections and releases resources.
|
|
173
|
+
*/
|
|
174
|
+
shutdown(): void;
|
|
175
|
+
}
|
|
176
|
+
//# sourceMappingURL=transport-manager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transport-manager.d.ts","sourceRoot":"","sources":["../../../src/execution/transport/transport-manager.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,KAAK,EACV,eAAe,EACf,gBAAgB,EAChB,aAAa,EACb,gBAAgB,EAChB,iBAAiB,EACjB,kBAAkB,EAClB,iBAAiB,EACjB,gBAAgB,EAChB,mBAAmB,EACnB,qBAAqB,EACrB,uBAAuB,EACvB,mBAAmB,EACnB,eAAe,EACf,kBAAkB,EAClB,WAAW,EACZ,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAGlD;;GAEG;AACH,MAAM,MAAM,SAAS,GACjB,eAAe,GACf,gBAAgB,GAChB,aAAa,GACb,gBAAgB,GAChB,iBAAiB,GACjB,kBAAkB,GAClB,iBAAiB,GACjB,gBAAgB,GAChB,mBAAmB,GACnB,qBAAqB,GACrB,uBAAuB,GACvB,mBAAmB,GACnB,eAAe,GACf,kBAAkB,GAClB,WAAW,CAAC;AAEhB;;;;;;;;;;;;;;;;GAgBG;AACH,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,YAAY,CAAe;IACnC,OAAO,CAAC,WAAW,CAAc;IACjC,OAAO,CAAC,gBAAgB,CACZ;IACZ,OAAO,CAAC,aAAa,CAA+B;IAEpD;;;;OAIG;;IAcH;;;;;;;;;;;;;;;OAeG;IACH,cAAc,CAAC,OAAO,EAAE,gBAAgB,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI;IAmB/D;;;;;;;OAOG;IACH,iBAAiB,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO;IAWrD;;;;;;;;;;;;;;;OAeG;IACH,SAAS,CAAC,KAAK,EAAE,SAAS,GAAG,MAAM;IAOnC;;;;;;;;;;;;;;;;OAgBG;IACH,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,GAAG,MAAM;IAQvD;;;;;;;;;;;;;;;;;OAiBG;IACH,eAAe,IAAI,YAAY;IAI/B;;;;OAIG;IACH,eAAe,IAAI,MAAM;IAIzB;;;;;;;;;;;;;;;;;OAiBG;IACH,iBAAiB,CAAC,KAAK,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,MAAM;IAItD;;;;;OAKG;IACH,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO;IAIzC;;;;OAIG;IACH,cAAc;;;;;;;IAId;;;;;OAKG;IACH,QAAQ,IAAI,IAAI;CAkBjB"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Workflow Layer Exports
|
|
3
|
+
*
|
|
4
|
+
* Layer 4: Task Execution Layer - Workflow Orchestration & State Management
|
|
5
|
+
*
|
|
6
|
+
* @module execution/workflow
|
|
7
|
+
*/
|
|
8
|
+
export type { WorkflowDefinition, WorkflowStep, WorkflowExecution, WorkflowStatus, WorkflowCheckpoint, WorkflowResult, StepStatus, WorkflowStartHandler, WorkflowCompleteHandler, WorkflowFailedHandler, StepStartHandler, StepCompleteHandler, StepFailedHandler, WorkflowCheckpointHandler, WorkflowResumeHandler, WorkflowPauseHandler, WorkflowCancelHandler, } from './types.js';
|
|
9
|
+
export type { IWorkflowOrchestrator, IWorkflowStorage } from './orchestrator.js';
|
|
10
|
+
export { generateId, renderTemplate, extractValue, mergeContext, evaluateCondition, createContext, } from './utils.js';
|
|
11
|
+
export { LinearOrchestrator } from './linear-orchestrator.js';
|
|
12
|
+
export { InMemoryWorkflowStorage } from './memory-storage.js';
|
|
13
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/execution/workflow/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,YAAY,EACV,kBAAkB,EAClB,YAAY,EACZ,iBAAiB,EACjB,cAAc,EACd,kBAAkB,EAClB,cAAc,EACd,UAAU,EACV,oBAAoB,EACpB,uBAAuB,EACvB,qBAAqB,EACrB,gBAAgB,EAChB,mBAAmB,EACnB,iBAAiB,EACjB,yBAAyB,EACzB,qBAAqB,EACrB,oBAAoB,EACpB,qBAAqB,GACtB,MAAM,YAAY,CAAC;AAGpB,YAAY,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAGjF,OAAO,EACL,UAAU,EACV,cAAc,EACd,YAAY,EACZ,YAAY,EACZ,iBAAiB,EACjB,aAAa,GACd,MAAM,YAAY,CAAC;AAGpB,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Linear Workflow Orchestrator Implementation
|
|
3
|
+
*
|
|
4
|
+
* Executes workflow steps sequentially with state management and checkpointing.
|
|
5
|
+
*
|
|
6
|
+
* @module execution/workflow/linear-orchestrator
|
|
7
|
+
*/
|
|
8
|
+
import type { IWorkflowOrchestrator, IWorkflowStorage } from "./orchestrator.js";
|
|
9
|
+
import type { IResilientExecutor } from "../resilience/executor.js";
|
|
10
|
+
import type { WorkflowDefinition, WorkflowExecution, WorkflowCheckpoint, StepStatus, WorkflowStartHandler, WorkflowCompleteHandler, WorkflowFailedHandler, StepStartHandler, StepCompleteHandler, StepFailedHandler, WorkflowCheckpointHandler, WorkflowResumeHandler, WorkflowPauseHandler, WorkflowCancelHandler } from "./types.js";
|
|
11
|
+
import type { AgUiEventAdapter } from "../output/ag-ui-adapter.js";
|
|
12
|
+
import type { ExecutionLifecycleService } from "../../services/execution-lifecycle.js";
|
|
13
|
+
/**
|
|
14
|
+
* LinearOrchestrator - Sequential workflow execution with state management
|
|
15
|
+
*
|
|
16
|
+
* Implements the IWorkflowOrchestrator interface to provide:
|
|
17
|
+
* - Sequential step execution
|
|
18
|
+
* - State persistence via checkpoints
|
|
19
|
+
* - Crash recovery and resumption
|
|
20
|
+
* - Event-driven monitoring
|
|
21
|
+
*/
|
|
22
|
+
export declare class LinearOrchestrator implements IWorkflowOrchestrator {
|
|
23
|
+
private _executions;
|
|
24
|
+
private _cleanedUpExecutions;
|
|
25
|
+
private _storage?;
|
|
26
|
+
private _executor;
|
|
27
|
+
private _agUiAdapter?;
|
|
28
|
+
private _lifecycleService?;
|
|
29
|
+
private _workflowStartHandlers;
|
|
30
|
+
private _workflowCompleteHandlers;
|
|
31
|
+
private _workflowFailedHandlers;
|
|
32
|
+
private _stepStartHandlers;
|
|
33
|
+
private _stepCompleteHandlers;
|
|
34
|
+
private _stepFailedHandlers;
|
|
35
|
+
private _checkpointHandlers;
|
|
36
|
+
private _resumeHandlers;
|
|
37
|
+
private _pauseHandlers;
|
|
38
|
+
private _cancelHandlers;
|
|
39
|
+
/**
|
|
40
|
+
* Create a new LinearOrchestrator
|
|
41
|
+
*
|
|
42
|
+
* @param executor - Resilient executor for running tasks
|
|
43
|
+
* @param storage - Optional storage for checkpoints
|
|
44
|
+
* @param agUiAdapter - Optional AG-UI event adapter for real-time event streaming
|
|
45
|
+
* @param lifecycleService - Optional execution lifecycle service for worktree management
|
|
46
|
+
*/
|
|
47
|
+
constructor(executor: IResilientExecutor, storage?: IWorkflowStorage, agUiAdapter?: AgUiEventAdapter, lifecycleService?: ExecutionLifecycleService);
|
|
48
|
+
/**
|
|
49
|
+
* Start a new workflow execution
|
|
50
|
+
*
|
|
51
|
+
* @param workflow - Workflow definition to execute
|
|
52
|
+
* @param workDir - Working directory for task execution
|
|
53
|
+
* @param options - Execution options (executionId is required)
|
|
54
|
+
* @returns Promise resolving to execution ID
|
|
55
|
+
*/
|
|
56
|
+
startWorkflow(workflow: WorkflowDefinition, workDir: string, options: {
|
|
57
|
+
executionId: string;
|
|
58
|
+
checkpointInterval?: number;
|
|
59
|
+
initialContext?: Record<string, any>;
|
|
60
|
+
}): Promise<string>;
|
|
61
|
+
/**
|
|
62
|
+
* Resume a workflow from a checkpoint
|
|
63
|
+
*
|
|
64
|
+
* @param executionId - Execution ID to resume
|
|
65
|
+
* @param options - Resume options
|
|
66
|
+
* @returns Promise resolving to execution ID
|
|
67
|
+
*/
|
|
68
|
+
resumeWorkflow(executionId: string, options?: {
|
|
69
|
+
checkpointInterval?: number;
|
|
70
|
+
}): Promise<string>;
|
|
71
|
+
/**
|
|
72
|
+
* Pause a running workflow
|
|
73
|
+
*
|
|
74
|
+
* @param executionId - Execution ID to pause
|
|
75
|
+
*/
|
|
76
|
+
pauseWorkflow(executionId: string): Promise<void>;
|
|
77
|
+
/**
|
|
78
|
+
* Cancel a running workflow
|
|
79
|
+
*
|
|
80
|
+
* @param executionId - Execution ID to cancel
|
|
81
|
+
*/
|
|
82
|
+
cancelWorkflow(executionId: string): Promise<void>;
|
|
83
|
+
/**
|
|
84
|
+
* Get current execution state
|
|
85
|
+
*
|
|
86
|
+
* @param executionId - Execution ID to query
|
|
87
|
+
* @returns Execution state or null if not found
|
|
88
|
+
*/
|
|
89
|
+
getExecution(executionId: string): WorkflowExecution | null;
|
|
90
|
+
/**
|
|
91
|
+
* Get status of a specific step
|
|
92
|
+
*
|
|
93
|
+
* @param executionId - Execution ID
|
|
94
|
+
* @param stepId - Step ID to query
|
|
95
|
+
* @returns Step status or null if not found
|
|
96
|
+
*/
|
|
97
|
+
getStepStatus(executionId: string, stepId: string): StepStatus | null;
|
|
98
|
+
/**
|
|
99
|
+
* Wait for workflow to complete
|
|
100
|
+
*
|
|
101
|
+
* @param executionId - Execution ID to wait for
|
|
102
|
+
* @returns Promise resolving to workflow execution
|
|
103
|
+
*/
|
|
104
|
+
waitForWorkflow(executionId: string): Promise<WorkflowExecution>;
|
|
105
|
+
/**
|
|
106
|
+
* List all checkpoints for a workflow
|
|
107
|
+
*
|
|
108
|
+
* @param workflowId - Optional workflow ID to filter by
|
|
109
|
+
* @returns Promise resolving to list of checkpoints
|
|
110
|
+
*/
|
|
111
|
+
listCheckpoints(workflowId?: string): Promise<WorkflowCheckpoint[]>;
|
|
112
|
+
/**
|
|
113
|
+
* Register handler for workflow start events
|
|
114
|
+
*/
|
|
115
|
+
onWorkflowStart(handler: WorkflowStartHandler): void;
|
|
116
|
+
/**
|
|
117
|
+
* Register handler for workflow completion events
|
|
118
|
+
*/
|
|
119
|
+
onWorkflowComplete(handler: WorkflowCompleteHandler): void;
|
|
120
|
+
/**
|
|
121
|
+
* Register handler for workflow failure events
|
|
122
|
+
*/
|
|
123
|
+
onWorkflowFailed(handler: WorkflowFailedHandler): void;
|
|
124
|
+
/**
|
|
125
|
+
* Register handler for step start events
|
|
126
|
+
*/
|
|
127
|
+
onStepStart(handler: StepStartHandler): void;
|
|
128
|
+
/**
|
|
129
|
+
* Register handler for step completion events
|
|
130
|
+
*/
|
|
131
|
+
onStepComplete(handler: StepCompleteHandler): void;
|
|
132
|
+
/**
|
|
133
|
+
* Register handler for step failure events
|
|
134
|
+
*/
|
|
135
|
+
onStepFailed(handler: StepFailedHandler): void;
|
|
136
|
+
/**
|
|
137
|
+
* Register handler for checkpoint events
|
|
138
|
+
*/
|
|
139
|
+
onCheckpoint(handler: WorkflowCheckpointHandler): void;
|
|
140
|
+
/**
|
|
141
|
+
* Register handler for resume events
|
|
142
|
+
*/
|
|
143
|
+
onResume(handler: WorkflowResumeHandler): void;
|
|
144
|
+
/**
|
|
145
|
+
* Register handler for pause events
|
|
146
|
+
*/
|
|
147
|
+
onPause(handler: WorkflowPauseHandler): void;
|
|
148
|
+
/**
|
|
149
|
+
* Register handler for cancel events
|
|
150
|
+
*/
|
|
151
|
+
onCancel(handler: WorkflowCancelHandler): void;
|
|
152
|
+
/**
|
|
153
|
+
* Execute workflow (main execution loop)
|
|
154
|
+
*
|
|
155
|
+
* @param workflow - Workflow definition
|
|
156
|
+
* @param execution - Workflow execution state
|
|
157
|
+
* @param workDir - Working directory for task execution
|
|
158
|
+
* @param checkpointInterval - Optional checkpoint interval (in steps)
|
|
159
|
+
* @returns Promise that resolves when workflow completes
|
|
160
|
+
* @private
|
|
161
|
+
*/
|
|
162
|
+
private _executeWorkflow;
|
|
163
|
+
/**
|
|
164
|
+
* Save checkpoint to storage
|
|
165
|
+
*
|
|
166
|
+
* @param execution - Workflow execution to checkpoint
|
|
167
|
+
* @private
|
|
168
|
+
*/
|
|
169
|
+
private _saveCheckpoint;
|
|
170
|
+
/**
|
|
171
|
+
* Clean up execution resources (worktree)
|
|
172
|
+
* Ensures cleanup is called only once per execution
|
|
173
|
+
*
|
|
174
|
+
* @param execution - Workflow execution to cleanup
|
|
175
|
+
* @private
|
|
176
|
+
*/
|
|
177
|
+
private _cleanupExecution;
|
|
178
|
+
/**
|
|
179
|
+
* Execute a single workflow step
|
|
180
|
+
*
|
|
181
|
+
* @param step - Workflow step to execute
|
|
182
|
+
* @param execution - Current workflow execution state
|
|
183
|
+
* @param workDir - Working directory for task execution
|
|
184
|
+
* @returns Promise resolving to execution result
|
|
185
|
+
* @private
|
|
186
|
+
*/
|
|
187
|
+
private _executeStep;
|
|
188
|
+
/**
|
|
189
|
+
* Apply output mapping from step result to workflow context
|
|
190
|
+
*
|
|
191
|
+
* @param step - Workflow step with output mapping
|
|
192
|
+
* @param result - Execution result from step
|
|
193
|
+
* @param context - Workflow context to update
|
|
194
|
+
* @private
|
|
195
|
+
*/
|
|
196
|
+
private _applyOutputMapping;
|
|
197
|
+
/**
|
|
198
|
+
* Check if all step dependencies are met
|
|
199
|
+
*
|
|
200
|
+
* @param step - Workflow step to check
|
|
201
|
+
* @param execution - Current workflow execution state
|
|
202
|
+
* @returns True if all dependencies are met, false otherwise
|
|
203
|
+
* @private
|
|
204
|
+
*/
|
|
205
|
+
private _areDependenciesMet;
|
|
206
|
+
/**
|
|
207
|
+
* Evaluate a step condition
|
|
208
|
+
*
|
|
209
|
+
* @param step - Workflow step with condition
|
|
210
|
+
* @param context - Workflow context
|
|
211
|
+
* @returns True if condition evaluates to true or no condition exists
|
|
212
|
+
* @private
|
|
213
|
+
*/
|
|
214
|
+
private _shouldExecuteStep;
|
|
215
|
+
}
|
|
216
|
+
//# sourceMappingURL=linear-orchestrator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"linear-orchestrator.d.ts","sourceRoot":"","sources":["../../../src/execution/workflow/linear-orchestrator.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EACV,qBAAqB,EACrB,gBAAgB,EACjB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAGpE,OAAO,KAAK,EACV,kBAAkB,EAElB,iBAAiB,EACjB,kBAAkB,EAElB,UAAU,EACV,oBAAoB,EACpB,uBAAuB,EACvB,qBAAqB,EACrB,gBAAgB,EAChB,mBAAmB,EACnB,iBAAiB,EACjB,yBAAyB,EACzB,qBAAqB,EACrB,oBAAoB,EACpB,qBAAqB,EACtB,MAAM,YAAY,CAAC;AAOpB,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,uCAAuC,CAAC;AAEvF;;;;;;;;GAQG;AACH,qBAAa,kBAAmB,YAAW,qBAAqB;IAE9D,OAAO,CAAC,WAAW,CAAwC;IAC3D,OAAO,CAAC,oBAAoB,CAAqB;IACjD,OAAO,CAAC,QAAQ,CAAC,CAAmB;IACpC,OAAO,CAAC,SAAS,CAAqB;IACtC,OAAO,CAA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
|
+
/**
|
|
2
|
+
* In-Memory Workflow Storage Implementation
|
|
3
|
+
*
|
|
4
|
+
* Simple in-memory implementation of IWorkflowStorage for testing and development.
|
|
5
|
+
*
|
|
6
|
+
* @module execution/workflow/memory-storage
|
|
7
|
+
*/
|
|
8
|
+
import type { IWorkflowStorage } from './orchestrator.js';
|
|
9
|
+
import type { WorkflowCheckpoint } from './types.js';
|
|
10
|
+
/**
|
|
11
|
+
* InMemoryWorkflowStorage - In-memory checkpoint storage
|
|
12
|
+
*
|
|
13
|
+
* Simple implementation that stores checkpoints in a Map.
|
|
14
|
+
* Suitable for testing and single-process workflows.
|
|
15
|
+
* Not suitable for production use with multiple processes.
|
|
16
|
+
*/
|
|
17
|
+
export declare class InMemoryWorkflowStorage implements IWorkflowStorage {
|
|
18
|
+
_checkpoints: Map<string, WorkflowCheckpoint>;
|
|
19
|
+
/**
|
|
20
|
+
* Save a checkpoint to memory
|
|
21
|
+
*
|
|
22
|
+
* @param checkpoint - Checkpoint to save
|
|
23
|
+
*/
|
|
24
|
+
saveCheckpoint(checkpoint: WorkflowCheckpoint): Promise<void>;
|
|
25
|
+
/**
|
|
26
|
+
* Load a checkpoint from memory
|
|
27
|
+
*
|
|
28
|
+
* @param executionId - Execution ID to load
|
|
29
|
+
* @returns Checkpoint or null if not found
|
|
30
|
+
*/
|
|
31
|
+
loadCheckpoint(executionId: string): Promise<WorkflowCheckpoint | null>;
|
|
32
|
+
/**
|
|
33
|
+
* List all checkpoints, optionally filtered by workflow ID
|
|
34
|
+
*
|
|
35
|
+
* @param workflowId - Optional workflow ID to filter by
|
|
36
|
+
* @returns Array of checkpoints
|
|
37
|
+
*/
|
|
38
|
+
listCheckpoints(workflowId?: string): Promise<WorkflowCheckpoint[]>;
|
|
39
|
+
/**
|
|
40
|
+
* Delete a checkpoint from memory
|
|
41
|
+
*
|
|
42
|
+
* @param executionId - Execution ID to delete
|
|
43
|
+
*/
|
|
44
|
+
deleteCheckpoint(executionId: string): Promise<void>;
|
|
45
|
+
/**
|
|
46
|
+
* Clear all checkpoints (useful for testing)
|
|
47
|
+
*/
|
|
48
|
+
clear(): void;
|
|
49
|
+
/**
|
|
50
|
+
* Get the number of stored checkpoints (useful for testing)
|
|
51
|
+
*/
|
|
52
|
+
size(): number;
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=memory-storage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"memory-storage.d.ts","sourceRoot":"","sources":["../../../src/execution/workflow/memory-storage.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAErD;;;;;;GAMG;AACH,qBAAa,uBAAwB,YAAW,gBAAgB;IACvD,YAAY,kCAAyC;IAE5D;;;;OAIG;IACG,cAAc,CAAC,UAAU,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC;IAInE;;;;;OAKG;IACG,cAAc,CAClB,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC,kBAAkB,GAAG,IAAI,CAAC;IAIrC;;;;;OAKG;IACG,eAAe,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,EAAE,CAAC;IAQzE;;;;OAIG;IACG,gBAAgB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAI1D;;OAEG;IACH,KAAK,IAAI,IAAI;IAIb;;OAEG;IACH,IAAI,IAAI,MAAM;CAGf"}
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Workflow Orchestrator Interface
|
|
3
|
+
*
|
|
4
|
+
* Defines the contract for workflow orchestration implementations.
|
|
5
|
+
*
|
|
6
|
+
* @module execution/workflow/orchestrator
|
|
7
|
+
*/
|
|
8
|
+
import type { WorkflowDefinition, WorkflowExecution, WorkflowCheckpoint, StepStatus, WorkflowStartHandler, WorkflowCompleteHandler, WorkflowFailedHandler, StepStartHandler, StepCompleteHandler, StepFailedHandler, WorkflowCheckpointHandler, WorkflowResumeHandler, WorkflowPauseHandler, WorkflowCancelHandler } from './types.js';
|
|
9
|
+
/**
|
|
10
|
+
* IWorkflowOrchestrator - Core interface for workflow orchestration
|
|
11
|
+
*
|
|
12
|
+
* Implementations of this interface coordinate the execution of multi-step
|
|
13
|
+
* workflows, managing state, checkpointing, and resumption.
|
|
14
|
+
*/
|
|
15
|
+
export interface IWorkflowOrchestrator {
|
|
16
|
+
/**
|
|
17
|
+
* Start a new workflow execution
|
|
18
|
+
*
|
|
19
|
+
* @param workflow - Workflow definition to execute
|
|
20
|
+
* @param workDir - Working directory for task execution
|
|
21
|
+
* @param options - Execution options
|
|
22
|
+
* @returns Promise resolving to execution ID
|
|
23
|
+
*/
|
|
24
|
+
startWorkflow(workflow: WorkflowDefinition, workDir: string, options?: {
|
|
25
|
+
checkpointInterval?: number;
|
|
26
|
+
initialContext?: Record<string, any>;
|
|
27
|
+
}): Promise<string>;
|
|
28
|
+
/**
|
|
29
|
+
* Resume a workflow from a checkpoint
|
|
30
|
+
*
|
|
31
|
+
* @param executionId - Execution ID to resume
|
|
32
|
+
* @param options - Resume options
|
|
33
|
+
* @returns Promise resolving to execution ID
|
|
34
|
+
*/
|
|
35
|
+
resumeWorkflow(executionId: string, options?: {
|
|
36
|
+
checkpointInterval?: number;
|
|
37
|
+
}): Promise<string>;
|
|
38
|
+
/**
|
|
39
|
+
* Pause a running workflow
|
|
40
|
+
*
|
|
41
|
+
* @param executionId - Execution ID to pause
|
|
42
|
+
* @returns Promise that resolves when paused
|
|
43
|
+
*/
|
|
44
|
+
pauseWorkflow(executionId: string): Promise<void>;
|
|
45
|
+
/**
|
|
46
|
+
* Cancel a running workflow
|
|
47
|
+
*
|
|
48
|
+
* @param executionId - Execution ID to cancel
|
|
49
|
+
* @returns Promise that resolves when cancelled
|
|
50
|
+
*/
|
|
51
|
+
cancelWorkflow(executionId: string): Promise<void>;
|
|
52
|
+
/**
|
|
53
|
+
* Get current execution state
|
|
54
|
+
*
|
|
55
|
+
* @param executionId - Execution ID to query
|
|
56
|
+
* @returns Execution state or null if not found
|
|
57
|
+
*/
|
|
58
|
+
getExecution(executionId: string): WorkflowExecution | null;
|
|
59
|
+
/**
|
|
60
|
+
* Get status of a specific step
|
|
61
|
+
*
|
|
62
|
+
* @param executionId - Execution ID
|
|
63
|
+
* @param stepId - Step ID to query
|
|
64
|
+
* @returns Step status or null if not found
|
|
65
|
+
*/
|
|
66
|
+
getStepStatus(executionId: string, stepId: string): StepStatus | null;
|
|
67
|
+
/**
|
|
68
|
+
* Wait for workflow to complete
|
|
69
|
+
*
|
|
70
|
+
* @param executionId - Execution ID to wait for
|
|
71
|
+
* @returns Promise resolving to workflow result
|
|
72
|
+
*/
|
|
73
|
+
waitForWorkflow(executionId: string): Promise<WorkflowExecution>;
|
|
74
|
+
/**
|
|
75
|
+
* List all checkpoints for a workflow
|
|
76
|
+
*
|
|
77
|
+
* @param workflowId - Optional workflow ID to filter by
|
|
78
|
+
* @returns Promise resolving to list of checkpoints
|
|
79
|
+
*/
|
|
80
|
+
listCheckpoints(workflowId?: string): Promise<WorkflowCheckpoint[]>;
|
|
81
|
+
/**
|
|
82
|
+
* Register handler for workflow start events
|
|
83
|
+
*/
|
|
84
|
+
onWorkflowStart(handler: WorkflowStartHandler): void;
|
|
85
|
+
/**
|
|
86
|
+
* Register handler for workflow completion events
|
|
87
|
+
*/
|
|
88
|
+
onWorkflowComplete(handler: WorkflowCompleteHandler): void;
|
|
89
|
+
/**
|
|
90
|
+
* Register handler for workflow failure events
|
|
91
|
+
*/
|
|
92
|
+
onWorkflowFailed(handler: WorkflowFailedHandler): void;
|
|
93
|
+
/**
|
|
94
|
+
* Register handler for step start events
|
|
95
|
+
*/
|
|
96
|
+
onStepStart(handler: StepStartHandler): void;
|
|
97
|
+
/**
|
|
98
|
+
* Register handler for step completion events
|
|
99
|
+
*/
|
|
100
|
+
onStepComplete(handler: StepCompleteHandler): void;
|
|
101
|
+
/**
|
|
102
|
+
* Register handler for step failure events
|
|
103
|
+
*/
|
|
104
|
+
onStepFailed(handler: StepFailedHandler): void;
|
|
105
|
+
/**
|
|
106
|
+
* Register handler for checkpoint events
|
|
107
|
+
*/
|
|
108
|
+
onCheckpoint(handler: WorkflowCheckpointHandler): void;
|
|
109
|
+
/**
|
|
110
|
+
* Register handler for resume events
|
|
111
|
+
*/
|
|
112
|
+
onResume(handler: WorkflowResumeHandler): void;
|
|
113
|
+
/**
|
|
114
|
+
* Register handler for pause events
|
|
115
|
+
*/
|
|
116
|
+
onPause(handler: WorkflowPauseHandler): void;
|
|
117
|
+
/**
|
|
118
|
+
* Register handler for cancel events
|
|
119
|
+
*/
|
|
120
|
+
onCancel(handler: WorkflowCancelHandler): void;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* IWorkflowStorage - Interface for workflow checkpoint storage
|
|
124
|
+
*
|
|
125
|
+
* Implementations provide persistence for workflow checkpoints,
|
|
126
|
+
* enabling crash recovery and workflow resumption.
|
|
127
|
+
*/
|
|
128
|
+
export interface IWorkflowStorage {
|
|
129
|
+
/**
|
|
130
|
+
* Save a workflow checkpoint
|
|
131
|
+
*
|
|
132
|
+
* @param checkpoint - Checkpoint to save
|
|
133
|
+
* @returns Promise that resolves when saved
|
|
134
|
+
*/
|
|
135
|
+
saveCheckpoint(checkpoint: WorkflowCheckpoint): Promise<void>;
|
|
136
|
+
/**
|
|
137
|
+
* Load a workflow checkpoint
|
|
138
|
+
*
|
|
139
|
+
* @param executionId - Execution ID to load
|
|
140
|
+
* @returns Promise resolving to checkpoint or null if not found
|
|
141
|
+
*/
|
|
142
|
+
loadCheckpoint(executionId: string): Promise<WorkflowCheckpoint | null>;
|
|
143
|
+
/**
|
|
144
|
+
* List all checkpoints for a workflow
|
|
145
|
+
*
|
|
146
|
+
* @param workflowId - Optional workflow ID to filter by
|
|
147
|
+
* @returns Promise resolving to list of checkpoints
|
|
148
|
+
*/
|
|
149
|
+
listCheckpoints(workflowId?: string): Promise<WorkflowCheckpoint[]>;
|
|
150
|
+
/**
|
|
151
|
+
* Delete a checkpoint
|
|
152
|
+
*
|
|
153
|
+
* @param executionId - Execution ID to delete
|
|
154
|
+
* @returns Promise that resolves when deleted
|
|
155
|
+
*/
|
|
156
|
+
deleteCheckpoint(executionId: string): Promise<void>;
|
|
157
|
+
}
|
|
158
|
+
//# sourceMappingURL=orchestrator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"orchestrator.d.ts","sourceRoot":"","sources":["../../../src/execution/workflow/orchestrator.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EACV,kBAAkB,EAClB,iBAAiB,EACjB,kBAAkB,EAClB,UAAU,EACV,oBAAoB,EACpB,uBAAuB,EACvB,qBAAqB,EACrB,gBAAgB,EAChB,mBAAmB,EACnB,iBAAiB,EACjB,yBAAyB,EACzB,qBAAqB,EACrB,oBAAoB,EACpB,qBAAqB,EACtB,MAAM,YAAY,CAAC;AAEpB;;;;;GAKG;AACH,MAAM,WAAW,qBAAqB;IACpC;;;;;;;OAOG;IACH,aAAa,CACX,QAAQ,EAAE,kBAAkB,EAC5B,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE;QACR,kBAAkB,CAAC,EAAE,MAAM,CAAC;QAC5B,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;KACtC,GACA,OAAO,CAAC,MAAM,CAAC,CAAC;IAEnB;;;;;;OAMG;IACH,cAAc,CACZ,WAAW,EAAE,MAAM,EACnB,OAAO,CAAC,EAAE;QACR,kBAAkB,CAAC,EAAE,MAAM,CAAC;KAC7B,GACA,OAAO,CAAC,MAAM,CAAC,CAAC;IAEnB;;;;;OAKG;IACH,aAAa,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,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