@flowdrop/flowdrop 2.0.0-beta.1 → 2.0.0-beta.11
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 +210 -0
- package/MIGRATION-2.0.md +173 -3
- package/README.md +5 -5
- package/dist/adapters/WorkflowAdapter.js +4 -5
- package/dist/adapters/agentspec/AgentSpecAdapter.js +3 -3
- package/dist/adapters/agentspec/defaultNodeTypes.js +9 -9
- package/dist/api/enhanced-client.js +6 -11
- package/dist/chat/batchFeedback.js +1 -1
- package/dist/chat/commandClassifier.d.ts +11 -0
- package/dist/chat/commandClassifier.js +20 -0
- package/dist/chat/historyBuilder.d.ts +39 -0
- package/dist/chat/historyBuilder.js +82 -0
- package/dist/chat/index.d.ts +2 -1
- package/dist/chat/index.js +2 -1
- package/dist/chat/responseParser.js +16 -12
- package/dist/commands/executor.js +51 -26
- package/dist/commands/parser.d.ts +12 -0
- package/dist/commands/parser.js +33 -6
- package/dist/commands/storeIntegration.svelte.js +11 -1
- package/dist/commands/types.js +5 -5
- package/dist/components/App.svelte +547 -386
- package/dist/components/App.svelte.d.ts +16 -8
- package/dist/components/Button.stories.svelte +65 -0
- package/dist/components/Button.stories.svelte.d.ts +19 -0
- package/dist/components/Button.svelte +62 -0
- package/dist/components/Button.svelte.d.ts +24 -0
- package/dist/components/CanvasIconButton.svelte +76 -0
- package/dist/components/CanvasIconButton.svelte.d.ts +18 -0
- package/dist/components/ConfigForm.svelte +194 -565
- package/dist/components/ConfigForm.svelte.d.ts +24 -7
- package/dist/components/ConfigModal.svelte +9 -1
- package/dist/components/ConfigPanel.svelte +234 -15
- package/dist/components/ConfigPanel.svelte.d.ts +6 -0
- package/dist/components/EditorStatusBar.stories.svelte +44 -0
- package/dist/components/EditorStatusBar.stories.svelte.d.ts +27 -0
- package/dist/components/EditorStatusBar.svelte +99 -0
- package/dist/components/EditorStatusBar.svelte.d.ts +15 -0
- package/dist/components/IconButton.svelte +80 -0
- package/dist/components/IconButton.svelte.d.ts +30 -0
- package/dist/components/Input.svelte +74 -0
- package/dist/components/Input.svelte.d.ts +17 -0
- package/dist/components/LogoWordmark.svelte +113 -0
- package/dist/components/LogoWordmark.svelte.d.ts +26 -0
- package/dist/components/Navbar.svelte +17 -63
- package/dist/components/Navbar.svelte.d.ts +3 -0
- package/dist/components/NodeSidebar.svelte +21 -126
- package/dist/components/NodeSwapPicker.svelte +12 -30
- package/dist/components/PipelineStatus.svelte +6 -1
- package/dist/components/PipelineStatus.svelte.d.ts +3 -0
- package/dist/components/PortMappingRow.svelte +0 -2
- package/dist/components/SchemaForm.svelte +4 -14
- package/dist/components/Select.svelte +53 -0
- package/dist/components/Select.svelte.d.ts +15 -0
- package/dist/components/SettingsModal.svelte +0 -5
- package/dist/components/SettingsPanel.svelte +33 -6
- package/dist/components/Textarea.svelte +39 -0
- package/dist/components/Textarea.svelte.d.ts +12 -0
- package/dist/components/ThemeToggle.svelte +15 -94
- package/dist/components/UniversalNode.svelte +36 -4
- package/dist/components/UniversalNode.svelte.d.ts +1 -1
- package/dist/components/WorkflowEditor.svelte +71 -54
- package/dist/components/WorkflowEditor.svelte.d.ts +21 -0
- package/dist/components/chat/AIChatPanel.svelte +49 -8
- package/dist/components/chat/CommandPreview.svelte +10 -1
- package/dist/components/console/ConsoleAutocomplete.svelte +1 -1
- package/dist/components/console/ConsoleInput.svelte +3 -3
- package/dist/components/console/ConsoleOutput.svelte +2 -2
- package/dist/components/form/FormArray.svelte +37 -173
- package/dist/components/form/FormAutocomplete.svelte +18 -15
- package/dist/components/form/FormCheckboxGroup.svelte +1 -5
- package/dist/components/form/FormCodeEditor.svelte +9 -7
- package/dist/components/form/FormField.svelte +18 -42
- package/dist/components/form/FormFieldLight.svelte +52 -48
- package/dist/components/form/FormFieldLight.svelte.d.ts +12 -0
- package/dist/components/form/FormFieldset.svelte +45 -11
- package/dist/components/form/FormMarkdownEditor.svelte +8 -5
- package/dist/components/form/FormNumberField.svelte +4 -36
- package/dist/components/form/FormPorts.svelte +280 -0
- package/dist/components/form/FormPorts.svelte.d.ts +13 -0
- package/dist/components/form/FormRangeField.svelte +63 -30
- package/dist/components/form/FormSelect.svelte +13 -75
- package/dist/components/form/FormTemplateEditor.svelte +6 -4
- package/dist/components/form/FormTextField.svelte +3 -35
- package/dist/components/form/FormTextarea.svelte +4 -39
- package/dist/components/form/FormToggle.svelte +27 -6
- package/dist/components/form/FormToggle.svelte.d.ts +5 -0
- package/dist/components/form/FormUISchemaRenderer.svelte +3 -1
- package/dist/components/form/resolveFieldType.d.ts +24 -0
- package/dist/components/form/resolveFieldType.js +55 -0
- package/dist/components/icons/CloseIcon.svelte +6 -0
- package/dist/components/icons/CloseIcon.svelte.d.ts +26 -0
- package/dist/components/icons/CommandLineIcon.svelte +15 -0
- package/dist/components/icons/CommandLineIcon.svelte.d.ts +26 -0
- package/dist/components/icons/MenuIcon.svelte +4 -0
- package/dist/components/icons/MenuIcon.svelte.d.ts +26 -0
- package/dist/components/icons/MenuOpenIcon.svelte +6 -0
- package/dist/components/icons/MenuOpenIcon.svelte.d.ts +26 -0
- package/dist/components/interrupt/ChoicePrompt.svelte +0 -10
- package/dist/components/interrupt/ConfirmationPrompt.svelte +0 -5
- package/dist/components/interrupt/InterruptBubble.svelte +11 -12
- package/dist/components/interrupt/ReviewPrompt.svelte +0 -20
- package/dist/components/interrupt/TextInputPrompt.svelte +0 -6
- package/dist/components/layouts/MainLayout.svelte +4 -5
- package/dist/components/nodes/AtomNode.svelte +62 -76
- package/dist/components/nodes/AtomNode.svelte.d.ts +1 -1
- package/dist/components/nodes/GatewayNode.svelte +117 -164
- package/dist/components/nodes/GatewayNode.svelte.d.ts +1 -1
- package/dist/components/nodes/IdeaNode.svelte +72 -98
- package/dist/components/nodes/IdeaNode.svelte.d.ts +8 -4
- package/dist/components/nodes/NodeConfigButton.svelte +86 -0
- package/dist/components/nodes/NodeConfigButton.svelte.d.ts +15 -0
- package/dist/components/nodes/NotesNode.svelte +76 -85
- package/dist/components/nodes/NotesNode.svelte.d.ts +8 -4
- package/dist/components/nodes/SimpleNode.svelte +59 -133
- package/dist/components/nodes/SimpleNode.svelte.d.ts +4 -4
- package/dist/components/nodes/SquareNode.svelte +110 -164
- package/dist/components/nodes/SquareNode.svelte.d.ts +4 -4
- package/dist/components/nodes/TerminalNode.svelte +62 -124
- package/dist/components/nodes/TerminalNode.svelte.d.ts +4 -4
- package/dist/components/nodes/ToolNode.svelte +92 -103
- package/dist/components/nodes/ToolNode.svelte.d.ts +6 -6
- package/dist/components/nodes/WorkflowNode.svelte +132 -191
- package/dist/components/nodes/WorkflowNode.svelte.d.ts +1 -1
- package/dist/components/playground/ChatInput.svelte +316 -27
- package/dist/components/playground/ChatInput.svelte.d.ts +31 -1
- package/dist/components/playground/ControlPanel.svelte +22 -0
- package/dist/components/playground/ControlPanel.svelte.d.ts +13 -0
- package/dist/components/playground/InputCollector.svelte +11 -48
- package/dist/components/playground/PipelineKanbanView.svelte +6 -4
- package/dist/components/playground/PipelineKanbanView.svelte.d.ts +2 -0
- package/dist/components/playground/PipelinePanel.svelte +20 -3
- package/dist/components/playground/PipelinePanel.svelte.d.ts +2 -0
- package/dist/components/playground/PipelineTableView.svelte +6 -4
- package/dist/components/playground/PipelineTableView.svelte.d.ts +2 -0
- package/dist/components/playground/Playground.svelte +292 -28
- package/dist/components/playground/Playground.svelte.d.ts +3 -0
- package/dist/components/playground/PlaygroundApp.svelte +6 -1
- package/dist/components/playground/PlaygroundApp.svelte.d.ts +3 -0
- package/dist/components/playground/PlaygroundModal.svelte +5 -0
- package/dist/components/playground/PlaygroundModal.svelte.d.ts +3 -0
- package/dist/components/playground/PlaygroundStudio.svelte +7 -6
- package/dist/components/playground/PlaygroundStudio.svelte.d.ts +3 -0
- package/dist/components/playground/pipelineViewUtils.svelte.d.ts +2 -1
- package/dist/components/playground/pipelineViewUtils.svelte.js +2 -2
- package/dist/components/surfaces/SurfaceOverlay.svelte +153 -0
- package/dist/components/surfaces/SurfaceOverlay.svelte.d.ts +14 -0
- package/dist/components/surfaces/TabbedSurface.svelte +133 -0
- package/dist/components/surfaces/TabbedSurface.svelte.d.ts +27 -0
- package/dist/config/endpoints.d.ts +71 -1
- package/dist/config/endpoints.js +46 -5
- package/dist/core/index.d.ts +2 -3
- package/dist/core/index.js +2 -6
- package/dist/display/index.d.ts +6 -1
- package/dist/display/index.js +9 -1
- package/dist/editor/index.d.ts +1 -1
- package/dist/editor/index.js +1 -1
- package/dist/form/full.d.ts +2 -1
- package/dist/form/full.js +4 -1
- package/dist/form/index.d.ts +0 -1
- package/dist/form/index.js +3 -2
- package/dist/helpers/workflowEditorHelper.d.ts +4 -2
- package/dist/helpers/workflowEditorHelper.js +8 -8
- package/dist/messages/defaults.d.ts +98 -0
- package/dist/messages/defaults.js +58 -1
- package/dist/messages/index.d.ts +1 -1
- package/dist/messages/index.js +1 -1
- package/dist/openapi/v1/openapi.yaml +35 -23
- package/dist/playground/commands/args.d.ts +32 -0
- package/dist/playground/commands/args.js +50 -0
- package/dist/playground/commands/dispatch.d.ts +143 -0
- package/dist/playground/commands/dispatch.js +162 -0
- package/dist/playground/commands/index.d.ts +14 -0
- package/dist/playground/commands/index.js +10 -0
- package/dist/playground/commands/parser.d.ts +38 -0
- package/dist/playground/commands/parser.js +163 -0
- package/dist/playground/commands/registry.d.ts +42 -0
- package/dist/playground/commands/registry.js +122 -0
- package/dist/playground/commands/suggest.d.ts +37 -0
- package/dist/playground/commands/suggest.js +46 -0
- package/dist/playground/commands/types.d.ts +111 -0
- package/dist/playground/commands/types.js +15 -0
- package/dist/playground/index.d.ts +21 -2
- package/dist/playground/index.js +27 -2
- package/dist/playground/mount.d.ts +19 -5
- package/dist/playground/mount.js +16 -8
- package/dist/playground/runAction.d.ts +48 -0
- package/dist/playground/runAction.js +31 -0
- package/dist/registry/builtinNodeTypes.d.ts +53 -0
- package/dist/registry/builtinNodeTypes.js +67 -0
- package/dist/registry/builtinNodes.d.ts +2 -39
- package/dist/registry/builtinNodes.js +6 -53
- package/dist/registry/nodeComponentRegistry.d.ts +2 -1
- package/dist/schemas/v1/workflow.schema.json +16 -14
- package/dist/services/agentSpecExecutionService.d.ts +0 -2
- package/dist/services/agentSpecExecutionService.js +0 -2
- package/dist/services/apiVariableService.js +12 -26
- package/dist/services/categoriesApi.js +3 -6
- package/dist/services/chatService.d.ts +4 -3
- package/dist/services/chatService.js +13 -18
- package/dist/services/dynamicSchemaService.d.ts +31 -4
- package/dist/services/dynamicSchemaService.js +62 -33
- package/dist/services/historyService.d.ts +30 -8
- package/dist/services/historyService.js +51 -15
- package/dist/services/interruptService.d.ts +7 -6
- package/dist/services/interruptService.js +19 -21
- package/dist/services/pipelineSignalService.d.ts +97 -0
- package/dist/services/pipelineSignalService.js +94 -0
- package/dist/services/playgroundService.d.ts +21 -8
- package/dist/services/playgroundService.js +45 -25
- package/dist/services/portConfigApi.js +3 -6
- package/dist/services/settingsService.d.ts +9 -4
- package/dist/services/settingsService.js +23 -12
- package/dist/services/workflowLaunchService.d.ts +74 -0
- package/dist/services/workflowLaunchService.js +74 -0
- package/dist/skins/drafter.d.ts +30 -0
- package/dist/skins/drafter.js +198 -0
- package/dist/skins/index.d.ts +2 -1
- package/dist/skins/index.js +4 -2
- package/dist/stores/apiContext.d.ts +11 -0
- package/dist/stores/apiContext.js +15 -0
- package/dist/stores/categoriesStore.svelte.js +0 -1
- package/dist/stores/historyStore.svelte.d.ts +17 -3
- package/dist/stores/historyStore.svelte.js +30 -3
- package/dist/stores/instanceContainer.svelte.js +5 -0
- package/dist/stores/playgroundStore.svelte.js +1 -3
- package/dist/stores/settingsStore.svelte.d.ts +13 -0
- package/dist/stores/settingsStore.svelte.js +32 -0
- package/dist/stores/workflowStore.svelte.d.ts +42 -5
- package/dist/stores/workflowStore.svelte.js +109 -32
- package/dist/styles/base.css +285 -14
- package/dist/styles/tokens.css +60 -2
- package/dist/svelte-app.d.ts +18 -1
- package/dist/svelte-app.js +75 -110
- package/dist/themes/drafter.d.ts +2 -0
- package/dist/themes/drafter.js +15 -0
- package/dist/themes/index.d.ts +2 -1
- package/dist/themes/index.js +8 -2
- package/dist/types/auth.d.ts +9 -51
- package/dist/types/auth.js +4 -54
- package/dist/types/chat.d.ts +5 -1
- package/dist/types/events.d.ts +18 -0
- package/dist/types/events.js +2 -1
- package/dist/types/index.d.ts +84 -29
- package/dist/types/index.js +0 -1
- package/dist/types/settings.d.ts +28 -1
- package/dist/types/settings.js +6 -3
- package/dist/types/skin.d.ts +1 -1
- package/dist/types/theme.d.ts +16 -2
- package/dist/types/uischema.d.ts +5 -0
- package/dist/utils/canvasSelection.d.ts +25 -0
- package/dist/utils/canvasSelection.js +37 -0
- package/dist/utils/colors.d.ts +27 -0
- package/dist/utils/colors.js +23 -0
- package/dist/utils/connections.js +20 -56
- package/dist/utils/edgeStyling.js +9 -5
- package/dist/utils/fetchWithAuth.d.ts +36 -15
- package/dist/utils/fetchWithAuth.js +53 -23
- package/dist/utils/nodeFormSchema.d.ts +51 -0
- package/dist/utils/nodeFormSchema.js +87 -0
- package/dist/utils/nodeIds.d.ts +1 -1
- package/dist/utils/nodeIds.js +1 -1
- package/dist/utils/nodeSwap.js +3 -6
- package/dist/utils/nodeTypes.js +1 -1
- package/dist/utils/portUtils.d.ts +47 -11
- package/dist/utils/portUtils.js +67 -14
- package/dist/utils/portal.d.ts +18 -0
- package/dist/utils/portal.js +34 -0
- package/dist/utils/schemaMerge.d.ts +25 -0
- package/dist/utils/schemaMerge.js +61 -0
- package/package.json +2 -1
|
@@ -18,6 +18,13 @@ import { logger } from '../utils/logger.js';
|
|
|
18
18
|
* a complete copy of the workflow state. This trades memory for simplicity
|
|
19
19
|
* and reliability.
|
|
20
20
|
*
|
|
21
|
+
* Snapshot model: the undo stack holds *committed* states, and its **top is the
|
|
22
|
+
* current live state**. `initialize()` seeds it with the starting state, and each
|
|
23
|
+
* mutation pushes the state *after* the change. One `undo()` moves the top back by
|
|
24
|
+
* exactly one committed change, and `redo()` restores the state that was undone.
|
|
25
|
+
* (Callers must push the post-change state — pushing pre-change snapshots makes a
|
|
26
|
+
* single undo skip a step once there are ≥2 sequential edits; see issue #39.)
|
|
27
|
+
*
|
|
21
28
|
* @example
|
|
22
29
|
* ```typescript
|
|
23
30
|
* const historyService = new HistoryService();
|
|
@@ -25,7 +32,7 @@ import { logger } from '../utils/logger.js';
|
|
|
25
32
|
* // Initialize with current workflow
|
|
26
33
|
* historyService.initialize(workflow);
|
|
27
34
|
*
|
|
28
|
-
* // Push state
|
|
35
|
+
* // Push state AFTER making changes (the new committed state)
|
|
29
36
|
* historyService.push(workflow, { description: "Add node" });
|
|
30
37
|
*
|
|
31
38
|
* // Undo/Redo
|
|
@@ -82,12 +89,13 @@ export class HistoryService {
|
|
|
82
89
|
this.notifyChange();
|
|
83
90
|
}
|
|
84
91
|
/**
|
|
85
|
-
* Push
|
|
92
|
+
* Push a new committed state to history
|
|
86
93
|
*
|
|
87
|
-
* Call this
|
|
94
|
+
* Call this AFTER modifying the workflow, with the resulting ("after") state:
|
|
95
|
+
* the stack top is the current live state, so one undo == one committed change.
|
|
88
96
|
* The redo stack is cleared when new changes are pushed.
|
|
89
97
|
*
|
|
90
|
-
* @param workflow - The
|
|
98
|
+
* @param workflow - The workflow state after the change
|
|
91
99
|
* @param options - Options for this history entry
|
|
92
100
|
*/
|
|
93
101
|
push(workflow, options = {}) {
|
|
@@ -109,6 +117,15 @@ export class HistoryService {
|
|
|
109
117
|
* @returns The previous workflow state, or null if cannot undo
|
|
110
118
|
*/
|
|
111
119
|
undo() {
|
|
120
|
+
// A transaction is the store's to finalize (it holds the live state), and it
|
|
121
|
+
// must do so BEFORE calling undo — the facade and command dispatch both
|
|
122
|
+
// finalize first, and the editor's blur commits earlier still. If one is
|
|
123
|
+
// still open here, the caller violated that contract; abandon it (rather than
|
|
124
|
+
// guess a snapshot to commit) so the flag can't wedge future pushes, and warn.
|
|
125
|
+
if (this.inTransaction) {
|
|
126
|
+
logger.warn('HistoryService: undo() called with an open transaction; finalize the edit session first. Abandoning it.');
|
|
127
|
+
this.clearTransaction();
|
|
128
|
+
}
|
|
112
129
|
// Need at least 2 entries to undo (initial + 1 change)
|
|
113
130
|
if (this.undoStack.length <= 1) {
|
|
114
131
|
return null;
|
|
@@ -131,6 +148,13 @@ export class HistoryService {
|
|
|
131
148
|
* @returns The next workflow state, or null if cannot redo
|
|
132
149
|
*/
|
|
133
150
|
redo() {
|
|
151
|
+
// Same contract as undo(): the caller must finalize any open edit session
|
|
152
|
+
// first. A dangling transaction here is a caller bug — abandon it and warn
|
|
153
|
+
// rather than committing a state we don't have.
|
|
154
|
+
if (this.inTransaction) {
|
|
155
|
+
logger.warn('HistoryService: redo() called with an open transaction; finalize the edit session first. Abandoning it.');
|
|
156
|
+
this.clearTransaction();
|
|
157
|
+
}
|
|
134
158
|
if (this.redoStack.length === 0) {
|
|
135
159
|
return null;
|
|
136
160
|
}
|
|
@@ -147,9 +171,13 @@ export class HistoryService {
|
|
|
147
171
|
* Start a transaction for grouping multiple changes
|
|
148
172
|
*
|
|
149
173
|
* All changes made during a transaction are combined into a single undo entry.
|
|
150
|
-
* Useful for operations like "delete node" which also removes connected edges
|
|
174
|
+
* Useful for operations like "delete node" which also removes connected edges,
|
|
175
|
+
* or coalescing a burst of live config edits into one step. While open, `push()`
|
|
176
|
+
* is suppressed; `commitTransaction()` records a single post-change entry.
|
|
151
177
|
*
|
|
152
|
-
* @param workflow - The current workflow state
|
|
178
|
+
* @param workflow - The current workflow state at transaction start. Retained so
|
|
179
|
+
* {@link cancelTransaction} can restore it; the committed entry is the *final*
|
|
180
|
+
* state passed to {@link commitTransaction}, not this snapshot.
|
|
153
181
|
* @param description - Description for the combined change
|
|
154
182
|
*/
|
|
155
183
|
startTransaction(workflow, description) {
|
|
@@ -164,19 +192,23 @@ export class HistoryService {
|
|
|
164
192
|
/**
|
|
165
193
|
* Commit the current transaction
|
|
166
194
|
*
|
|
167
|
-
*
|
|
195
|
+
* Records the transaction's *post-change* state as a single history entry, so
|
|
196
|
+
* one undo reverts the whole grouped operation and redo restores its result.
|
|
197
|
+
*
|
|
198
|
+
* The final state is required: the transaction's owner (the store) holds the
|
|
199
|
+
* live workflow and must supply it. There is deliberately no "commit whatever
|
|
200
|
+
* you captured at start" fallback — that would silently record a pre-change
|
|
201
|
+
* snapshot and reintroduce the off-by-one this model exists to prevent (#39).
|
|
202
|
+
*
|
|
203
|
+
* @param finalWorkflow - The workflow state after the grouped change.
|
|
168
204
|
*/
|
|
169
|
-
commitTransaction() {
|
|
205
|
+
commitTransaction(finalWorkflow) {
|
|
170
206
|
if (!this.inTransaction || !this.transactionSnapshot) {
|
|
171
207
|
logger.warn('HistoryService: No transaction in progress, ignoring commitTransaction');
|
|
172
208
|
return;
|
|
173
209
|
}
|
|
174
|
-
|
|
175
|
-
this.
|
|
176
|
-
// Clear transaction state
|
|
177
|
-
this.inTransaction = false;
|
|
178
|
-
this.transactionSnapshot = null;
|
|
179
|
-
this.transactionDescription = null;
|
|
210
|
+
this.pushInternal(finalWorkflow, this.transactionDescription ?? undefined);
|
|
211
|
+
this.clearTransaction();
|
|
180
212
|
}
|
|
181
213
|
/**
|
|
182
214
|
* Cancel the current transaction without committing
|
|
@@ -187,10 +219,14 @@ export class HistoryService {
|
|
|
187
219
|
*/
|
|
188
220
|
cancelTransaction() {
|
|
189
221
|
const snapshot = this.transactionSnapshot;
|
|
222
|
+
this.clearTransaction();
|
|
223
|
+
return snapshot;
|
|
224
|
+
}
|
|
225
|
+
/** Reset the in-progress transaction bookkeeping. */
|
|
226
|
+
clearTransaction() {
|
|
190
227
|
this.inTransaction = false;
|
|
191
228
|
this.transactionSnapshot = null;
|
|
192
229
|
this.transactionDescription = null;
|
|
193
|
-
return snapshot;
|
|
194
230
|
}
|
|
195
231
|
/**
|
|
196
232
|
* Clear all history
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
*/
|
|
10
10
|
import type { Interrupt, InterruptPollingConfig } from '../types/interrupt.js';
|
|
11
11
|
import type { EndpointConfig } from '../config/endpoints.js';
|
|
12
|
+
import type { AuthProvider } from '../types/auth.js';
|
|
12
13
|
/**
|
|
13
14
|
* Interrupt Service class
|
|
14
15
|
*
|
|
@@ -75,7 +76,7 @@ export declare class InterruptService {
|
|
|
75
76
|
* @param interruptId - The interrupt UUID
|
|
76
77
|
* @returns The interrupt details
|
|
77
78
|
*/
|
|
78
|
-
getInterrupt(endpointConfig: EndpointConfig | null, interruptId: string): Promise<Interrupt>;
|
|
79
|
+
getInterrupt(endpointConfig: EndpointConfig | null, interruptId: string, authProvider?: AuthProvider): Promise<Interrupt>;
|
|
79
80
|
/**
|
|
80
81
|
* Resolve an interrupt with user response
|
|
81
82
|
*
|
|
@@ -83,28 +84,28 @@ export declare class InterruptService {
|
|
|
83
84
|
* @param value - The user's response value
|
|
84
85
|
* @returns The updated interrupt
|
|
85
86
|
*/
|
|
86
|
-
resolveInterrupt(endpointConfig: EndpointConfig | null, interruptId: string, value: unknown): Promise<Interrupt>;
|
|
87
|
+
resolveInterrupt(endpointConfig: EndpointConfig | null, interruptId: string, value: unknown, authProvider?: AuthProvider): Promise<Interrupt>;
|
|
87
88
|
/**
|
|
88
89
|
* Cancel a pending interrupt
|
|
89
90
|
*
|
|
90
91
|
* @param interruptId - The interrupt UUID
|
|
91
92
|
* @returns The updated interrupt
|
|
92
93
|
*/
|
|
93
|
-
cancelInterrupt(endpointConfig: EndpointConfig | null, interruptId: string): Promise<Interrupt>;
|
|
94
|
+
cancelInterrupt(endpointConfig: EndpointConfig | null, interruptId: string, authProvider?: AuthProvider): Promise<Interrupt>;
|
|
94
95
|
/**
|
|
95
96
|
* List interrupts for a playground session
|
|
96
97
|
*
|
|
97
98
|
* @param sessionId - The session UUID
|
|
98
99
|
* @returns Array of interrupts for the session
|
|
99
100
|
*/
|
|
100
|
-
listSessionInterrupts(endpointConfig: EndpointConfig | null, sessionId: string): Promise<Interrupt[]>;
|
|
101
|
+
listSessionInterrupts(endpointConfig: EndpointConfig | null, sessionId: string, authProvider?: AuthProvider): Promise<Interrupt[]>;
|
|
101
102
|
/**
|
|
102
103
|
* List interrupts for a pipeline
|
|
103
104
|
*
|
|
104
105
|
* @param pipelineId - The pipeline UUID
|
|
105
106
|
* @returns Array of interrupts for the pipeline
|
|
106
107
|
*/
|
|
107
|
-
listPipelineInterrupts(endpointConfig: EndpointConfig | null, pipelineId: string): Promise<Interrupt[]>;
|
|
108
|
+
listPipelineInterrupts(endpointConfig: EndpointConfig | null, pipelineId: string, authProvider?: AuthProvider): Promise<Interrupt[]>;
|
|
108
109
|
/**
|
|
109
110
|
* Start polling for interrupts in a session
|
|
110
111
|
*
|
|
@@ -114,7 +115,7 @@ export declare class InterruptService {
|
|
|
114
115
|
* @param sessionId - The session UUID to poll
|
|
115
116
|
* @param callback - Callback function to handle new interrupts
|
|
116
117
|
*/
|
|
117
|
-
startPolling(endpointConfig: EndpointConfig | null, sessionId: string, callback: (interrupts: Interrupt[]) => void): void;
|
|
118
|
+
startPolling(endpointConfig: EndpointConfig | null, sessionId: string, callback: (interrupts: Interrupt[]) => void, authProvider?: AuthProvider): void;
|
|
118
119
|
/**
|
|
119
120
|
* Stop polling for interrupts
|
|
120
121
|
*/
|
|
@@ -8,7 +8,8 @@
|
|
|
8
8
|
* @module services/interruptService
|
|
9
9
|
*/
|
|
10
10
|
import { defaultInterruptPollingConfig } from '../types/interrupt.js';
|
|
11
|
-
import { buildEndpointUrl
|
|
11
|
+
import { buildEndpointUrl } from '../config/endpoints.js';
|
|
12
|
+
import { authenticatedFetch } from '../utils/fetchWithAuth.js';
|
|
12
13
|
import { logger } from '../utils/logger.js';
|
|
13
14
|
/**
|
|
14
15
|
* Interrupt Service class
|
|
@@ -92,14 +93,11 @@ export class InterruptService {
|
|
|
92
93
|
* @param options - Fetch options
|
|
93
94
|
* @returns The parsed JSON response
|
|
94
95
|
*/
|
|
95
|
-
async request(config, url, options = {}) {
|
|
96
|
-
const
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
...headers,
|
|
101
|
-
...options.headers
|
|
102
|
-
}
|
|
96
|
+
async request(config, url, options = {}, authProvider) {
|
|
97
|
+
const response = await authenticatedFetch(url, options, {
|
|
98
|
+
config,
|
|
99
|
+
endpointKey: 'interrupts',
|
|
100
|
+
authProvider
|
|
103
101
|
});
|
|
104
102
|
if (!response.ok) {
|
|
105
103
|
const errorData = await response.json().catch(() => ({}));
|
|
@@ -119,12 +117,12 @@ export class InterruptService {
|
|
|
119
117
|
* @param interruptId - The interrupt UUID
|
|
120
118
|
* @returns The interrupt details
|
|
121
119
|
*/
|
|
122
|
-
async getInterrupt(endpointConfig, interruptId) {
|
|
120
|
+
async getInterrupt(endpointConfig, interruptId, authProvider) {
|
|
123
121
|
const config = this.getConfig(endpointConfig);
|
|
124
122
|
const url = buildEndpointUrl(config, config.endpoints.interrupts.get, {
|
|
125
123
|
interruptId
|
|
126
124
|
});
|
|
127
|
-
const response = await this.request(config, url);
|
|
125
|
+
const response = await this.request(config, url, {}, authProvider);
|
|
128
126
|
if (!response.data) {
|
|
129
127
|
throw new Error('Interrupt not found');
|
|
130
128
|
}
|
|
@@ -137,7 +135,7 @@ export class InterruptService {
|
|
|
137
135
|
* @param value - The user's response value
|
|
138
136
|
* @returns The updated interrupt
|
|
139
137
|
*/
|
|
140
|
-
async resolveInterrupt(endpointConfig, interruptId, value) {
|
|
138
|
+
async resolveInterrupt(endpointConfig, interruptId, value, authProvider) {
|
|
141
139
|
const config = this.getConfig(endpointConfig);
|
|
142
140
|
const url = buildEndpointUrl(config, config.endpoints.interrupts.resolve, {
|
|
143
141
|
interruptId
|
|
@@ -146,7 +144,7 @@ export class InterruptService {
|
|
|
146
144
|
const response = await this.request(config, url, {
|
|
147
145
|
method: 'POST',
|
|
148
146
|
body: JSON.stringify(resolution)
|
|
149
|
-
});
|
|
147
|
+
}, authProvider);
|
|
150
148
|
if (!response.data) {
|
|
151
149
|
throw new Error('Failed to resolve interrupt: No data returned');
|
|
152
150
|
}
|
|
@@ -158,14 +156,14 @@ export class InterruptService {
|
|
|
158
156
|
* @param interruptId - The interrupt UUID
|
|
159
157
|
* @returns The updated interrupt
|
|
160
158
|
*/
|
|
161
|
-
async cancelInterrupt(endpointConfig, interruptId) {
|
|
159
|
+
async cancelInterrupt(endpointConfig, interruptId, authProvider) {
|
|
162
160
|
const config = this.getConfig(endpointConfig);
|
|
163
161
|
const url = buildEndpointUrl(config, config.endpoints.interrupts.cancel, {
|
|
164
162
|
interruptId
|
|
165
163
|
});
|
|
166
164
|
const response = await this.request(config, url, {
|
|
167
165
|
method: 'POST'
|
|
168
|
-
});
|
|
166
|
+
}, authProvider);
|
|
169
167
|
if (!response.data) {
|
|
170
168
|
throw new Error('Failed to cancel interrupt: No data returned');
|
|
171
169
|
}
|
|
@@ -177,12 +175,12 @@ export class InterruptService {
|
|
|
177
175
|
* @param sessionId - The session UUID
|
|
178
176
|
* @returns Array of interrupts for the session
|
|
179
177
|
*/
|
|
180
|
-
async listSessionInterrupts(endpointConfig, sessionId) {
|
|
178
|
+
async listSessionInterrupts(endpointConfig, sessionId, authProvider) {
|
|
181
179
|
const config = this.getConfig(endpointConfig);
|
|
182
180
|
const url = buildEndpointUrl(config, config.endpoints.interrupts.listBySession, {
|
|
183
181
|
sessionId
|
|
184
182
|
});
|
|
185
|
-
const response = await this.request(config, url);
|
|
183
|
+
const response = await this.request(config, url, {}, authProvider);
|
|
186
184
|
return response.data ?? [];
|
|
187
185
|
}
|
|
188
186
|
/**
|
|
@@ -191,12 +189,12 @@ export class InterruptService {
|
|
|
191
189
|
* @param pipelineId - The pipeline UUID
|
|
192
190
|
* @returns Array of interrupts for the pipeline
|
|
193
191
|
*/
|
|
194
|
-
async listPipelineInterrupts(endpointConfig, pipelineId) {
|
|
192
|
+
async listPipelineInterrupts(endpointConfig, pipelineId, authProvider) {
|
|
195
193
|
const config = this.getConfig(endpointConfig);
|
|
196
194
|
const url = buildEndpointUrl(config, config.endpoints.interrupts.listByPipeline, {
|
|
197
195
|
pipelineId
|
|
198
196
|
});
|
|
199
|
-
const response = await this.request(config, url);
|
|
197
|
+
const response = await this.request(config, url, {}, authProvider);
|
|
200
198
|
return response.data ?? [];
|
|
201
199
|
}
|
|
202
200
|
// =========================================================================
|
|
@@ -211,7 +209,7 @@ export class InterruptService {
|
|
|
211
209
|
* @param sessionId - The session UUID to poll
|
|
212
210
|
* @param callback - Callback function to handle new interrupts
|
|
213
211
|
*/
|
|
214
|
-
startPolling(endpointConfig, sessionId, callback) {
|
|
212
|
+
startPolling(endpointConfig, sessionId, callback, authProvider) {
|
|
215
213
|
if (!this.pollingConfig.enabled) {
|
|
216
214
|
logger.warn('[InterruptService] Polling is disabled. Enable via setPollingConfig().');
|
|
217
215
|
return;
|
|
@@ -225,7 +223,7 @@ export class InterruptService {
|
|
|
225
223
|
return;
|
|
226
224
|
}
|
|
227
225
|
try {
|
|
228
|
-
const interrupts = await this.listSessionInterrupts(endpointConfig, sessionId);
|
|
226
|
+
const interrupts = await this.listSessionInterrupts(endpointConfig, sessionId, authProvider);
|
|
229
227
|
const pendingInterrupts = interrupts.filter((i) => i.status === 'pending');
|
|
230
228
|
// Reset backoff on successful request
|
|
231
229
|
this.currentBackoff = this.pollingConfig.interval ?? defaultInterruptPollingConfig.interval;
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pipeline Signal Service
|
|
3
|
+
*
|
|
4
|
+
* Operator signals *into* a running pipeline — pause, resume, cancel.
|
|
5
|
+
*
|
|
6
|
+
* The opposite direction from `interruptService`: an interrupt is raised by a
|
|
7
|
+
* node inside a run and awaits an answer, while a signal is raised by an
|
|
8
|
+
* external party and acts on a run that never asked.
|
|
9
|
+
*
|
|
10
|
+
* ## Why this returns a result instead of throwing
|
|
11
|
+
*
|
|
12
|
+
* Every refusal here is an ordinary, expected outcome the composer must render
|
|
13
|
+
* differently — a run that already finished, a duplicate signal, a resume with
|
|
14
|
+
* nothing to resume. Turning those into exceptions would force every caller to
|
|
15
|
+
* re-parse HTTP status codes out of message strings. Only genuine transport
|
|
16
|
+
* failures reject.
|
|
17
|
+
*
|
|
18
|
+
* ## Accepted is not applied
|
|
19
|
+
*
|
|
20
|
+
* A successful pause or cancel returns `accepted`, never `applied`. Backends
|
|
21
|
+
* are expected to observe signals cooperatively — the reference implementation
|
|
22
|
+
* polls between job steps, so the in-flight step always finishes first. Callers
|
|
23
|
+
* must render "pause requested", not "paused", and let a status poll confirm.
|
|
24
|
+
*
|
|
25
|
+
* @module services/pipelineSignalService
|
|
26
|
+
*/
|
|
27
|
+
import type { EndpointConfig } from '../config/endpoints.js';
|
|
28
|
+
import type { AuthProvider } from '../types/auth.js';
|
|
29
|
+
/**
|
|
30
|
+
* Signals a pipeline can be sent.
|
|
31
|
+
*
|
|
32
|
+
* Open by design: this is the set the reference backend implements today, but
|
|
33
|
+
* the direction is a general concept and other backends may define more. Widen
|
|
34
|
+
* with care — the client must never offer a signal nothing implements.
|
|
35
|
+
*/
|
|
36
|
+
export type SignalType = 'pause' | 'resume' | 'cancel' | (string & {});
|
|
37
|
+
/** Why a signal was refused. Maps onto distinct, user-visible explanations. */
|
|
38
|
+
export type SignalRefusal =
|
|
39
|
+
/** The run already finished — nothing left to signal. */
|
|
40
|
+
'terminal'
|
|
41
|
+
/** A signal is already pending on this pipeline; the backend rejects a second. */
|
|
42
|
+
| 'duplicate'
|
|
43
|
+
/** Resume with no pause outstanding. */
|
|
44
|
+
| 'not-paused'
|
|
45
|
+
/** No such pipeline. */
|
|
46
|
+
| 'not-found'
|
|
47
|
+
/** Caller lacks permission for this pipeline. */
|
|
48
|
+
| 'forbidden'
|
|
49
|
+
/** Refused for a reason this client does not model. */
|
|
50
|
+
| 'rejected';
|
|
51
|
+
export type SignalResult =
|
|
52
|
+
/**
|
|
53
|
+
* The backend accepted the signal. It has *not* necessarily taken effect —
|
|
54
|
+
* see the module docblock.
|
|
55
|
+
*/
|
|
56
|
+
{
|
|
57
|
+
status: 'accepted';
|
|
58
|
+
signal: SignalType;
|
|
59
|
+
pipelineId: string;
|
|
60
|
+
} | {
|
|
61
|
+
status: 'refused';
|
|
62
|
+
reason: SignalRefusal;
|
|
63
|
+
message: string;
|
|
64
|
+
} | {
|
|
65
|
+
status: 'unsupported';
|
|
66
|
+
};
|
|
67
|
+
/** Options accepted by every signal. */
|
|
68
|
+
export interface SendSignalOptions {
|
|
69
|
+
/**
|
|
70
|
+
* Free-text audit note recorded against the signal.
|
|
71
|
+
*
|
|
72
|
+
* Note this is an audit field, not an execution-control one. In the reference
|
|
73
|
+
* backend a pipeline's *paused reason* is a separate, enumerated concept that
|
|
74
|
+
* governs auto-resume, and an operator pause deliberately carries none — the
|
|
75
|
+
* absence is what keeps a human-initiated pause from resuming itself. Sending
|
|
76
|
+
* a note here must not populate that field.
|
|
77
|
+
*/
|
|
78
|
+
reason?: string;
|
|
79
|
+
}
|
|
80
|
+
declare class PipelineSignalService {
|
|
81
|
+
#private;
|
|
82
|
+
/**
|
|
83
|
+
* True when this configuration exposes a signal plane at all.
|
|
84
|
+
*
|
|
85
|
+
* Callers gate on this rather than assuming: a backend without signals is a
|
|
86
|
+
* supported configuration, not an error.
|
|
87
|
+
*/
|
|
88
|
+
isSupported(config: EndpointConfig | null): boolean;
|
|
89
|
+
/** Pause a running pipeline. */
|
|
90
|
+
pause(config: EndpointConfig | null, pipelineId: string, options?: SendSignalOptions, authProvider?: AuthProvider): Promise<SignalResult>;
|
|
91
|
+
/** Resume a paused pipeline. */
|
|
92
|
+
resume(config: EndpointConfig | null, pipelineId: string, options?: SendSignalOptions, authProvider?: AuthProvider): Promise<SignalResult>;
|
|
93
|
+
/** Cancel a running pipeline. Terminal and durable — it cannot be undone. */
|
|
94
|
+
cancel(config: EndpointConfig | null, pipelineId: string, options?: SendSignalOptions, authProvider?: AuthProvider): Promise<SignalResult>;
|
|
95
|
+
}
|
|
96
|
+
export declare const pipelineSignalService: PipelineSignalService;
|
|
97
|
+
export { PipelineSignalService };
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pipeline Signal Service
|
|
3
|
+
*
|
|
4
|
+
* Operator signals *into* a running pipeline — pause, resume, cancel.
|
|
5
|
+
*
|
|
6
|
+
* The opposite direction from `interruptService`: an interrupt is raised by a
|
|
7
|
+
* node inside a run and awaits an answer, while a signal is raised by an
|
|
8
|
+
* external party and acts on a run that never asked.
|
|
9
|
+
*
|
|
10
|
+
* ## Why this returns a result instead of throwing
|
|
11
|
+
*
|
|
12
|
+
* Every refusal here is an ordinary, expected outcome the composer must render
|
|
13
|
+
* differently — a run that already finished, a duplicate signal, a resume with
|
|
14
|
+
* nothing to resume. Turning those into exceptions would force every caller to
|
|
15
|
+
* re-parse HTTP status codes out of message strings. Only genuine transport
|
|
16
|
+
* failures reject.
|
|
17
|
+
*
|
|
18
|
+
* ## Accepted is not applied
|
|
19
|
+
*
|
|
20
|
+
* A successful pause or cancel returns `accepted`, never `applied`. Backends
|
|
21
|
+
* are expected to observe signals cooperatively — the reference implementation
|
|
22
|
+
* polls between job steps, so the in-flight step always finishes first. Callers
|
|
23
|
+
* must render "pause requested", not "paused", and let a status poll confirm.
|
|
24
|
+
*
|
|
25
|
+
* @module services/pipelineSignalService
|
|
26
|
+
*/
|
|
27
|
+
import { buildEndpointUrl } from '../config/endpoints.js';
|
|
28
|
+
import { authenticatedFetch } from '../utils/fetchWithAuth.js';
|
|
29
|
+
import { logger } from '../utils/logger.js';
|
|
30
|
+
/** Map a refusal HTTP status + payload onto a modelled reason. */
|
|
31
|
+
function classifyRefusal(status, message) {
|
|
32
|
+
if (status === 404)
|
|
33
|
+
return 'not-found';
|
|
34
|
+
if (status === 403 || status === 401)
|
|
35
|
+
return 'forbidden';
|
|
36
|
+
if (status === 409) {
|
|
37
|
+
const text = message.toLowerCase();
|
|
38
|
+
if (text.includes('terminal'))
|
|
39
|
+
return 'terminal';
|
|
40
|
+
if (text.includes('already pending') || text.includes('already'))
|
|
41
|
+
return 'duplicate';
|
|
42
|
+
if (text.includes('no active pause') || text.includes('pause'))
|
|
43
|
+
return 'not-paused';
|
|
44
|
+
return 'rejected';
|
|
45
|
+
}
|
|
46
|
+
return 'rejected';
|
|
47
|
+
}
|
|
48
|
+
class PipelineSignalService {
|
|
49
|
+
/**
|
|
50
|
+
* True when this configuration exposes a signal plane at all.
|
|
51
|
+
*
|
|
52
|
+
* Callers gate on this rather than assuming: a backend without signals is a
|
|
53
|
+
* supported configuration, not an error.
|
|
54
|
+
*/
|
|
55
|
+
isSupported(config) {
|
|
56
|
+
return config?.endpoints?.signals != null;
|
|
57
|
+
}
|
|
58
|
+
/** Pause a running pipeline. */
|
|
59
|
+
async pause(config, pipelineId, options = {}, authProvider) {
|
|
60
|
+
return this.#send(config, 'pause', pipelineId, options, authProvider);
|
|
61
|
+
}
|
|
62
|
+
/** Resume a paused pipeline. */
|
|
63
|
+
async resume(config, pipelineId, options = {}, authProvider) {
|
|
64
|
+
return this.#send(config, 'resume', pipelineId, options, authProvider);
|
|
65
|
+
}
|
|
66
|
+
/** Cancel a running pipeline. Terminal and durable — it cannot be undone. */
|
|
67
|
+
async cancel(config, pipelineId, options = {}, authProvider) {
|
|
68
|
+
return this.#send(config, 'cancel', pipelineId, options, authProvider);
|
|
69
|
+
}
|
|
70
|
+
async #send(config, signal, pipelineId, options, authProvider) {
|
|
71
|
+
const signals = config?.endpoints?.signals;
|
|
72
|
+
if (!config || !signals)
|
|
73
|
+
return { status: 'unsupported' };
|
|
74
|
+
const url = buildEndpointUrl(config, signals[signal], { pipelineId }, signals.baseUrl);
|
|
75
|
+
const response = await authenticatedFetch(url, {
|
|
76
|
+
method: 'POST',
|
|
77
|
+
headers: { 'Content-Type': 'application/json' },
|
|
78
|
+
body: JSON.stringify(options.reason ? { reason: options.reason } : {})
|
|
79
|
+
}, { config, endpointKey: 'signals', authProvider });
|
|
80
|
+
if (response.ok) {
|
|
81
|
+
return { status: 'accepted', signal, pipelineId };
|
|
82
|
+
}
|
|
83
|
+
const payload = (await response.json().catch(() => ({})));
|
|
84
|
+
const message = payload.error ?? payload.message ?? `HTTP ${response.status}: ${response.statusText}`;
|
|
85
|
+
logger.warn(`Pipeline signal "${signal}" refused for ${pipelineId}:`, message);
|
|
86
|
+
return {
|
|
87
|
+
status: 'refused',
|
|
88
|
+
reason: classifyRefusal(response.status, message),
|
|
89
|
+
message
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
export const pipelineSignalService = new PipelineSignalService();
|
|
94
|
+
export { PipelineSignalService };
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
*/
|
|
9
9
|
import type { PlaygroundSession, PlaygroundMessage, PlaygroundMessagesApiResponse, PlaygroundSessionStatus } from '../types/playground.js';
|
|
10
10
|
import type { EndpointConfig } from '../config/endpoints.js';
|
|
11
|
+
import type { AuthProvider } from '../types/auth.js';
|
|
11
12
|
/**
|
|
12
13
|
* Pagination options for {@link PlaygroundService.getMessages}.
|
|
13
14
|
* `since`, `before`, and `latest` are mutually exclusive.
|
|
@@ -70,7 +71,7 @@ export declare class PlaygroundService {
|
|
|
70
71
|
listSessions(endpointConfig: EndpointConfig | null, workflowId: string, options?: {
|
|
71
72
|
limit?: number;
|
|
72
73
|
offset?: number;
|
|
73
|
-
}): Promise<PlaygroundSession[]>;
|
|
74
|
+
}, authProvider?: AuthProvider): Promise<PlaygroundSession[]>;
|
|
74
75
|
/**
|
|
75
76
|
* Create a new playground session
|
|
76
77
|
*
|
|
@@ -79,20 +80,20 @@ export declare class PlaygroundService {
|
|
|
79
80
|
* @param metadata - Optional session metadata
|
|
80
81
|
* @returns The created session
|
|
81
82
|
*/
|
|
82
|
-
createSession(endpointConfig: EndpointConfig | null, workflowId: string, name?: string, metadata?: Record<string, unknown
|
|
83
|
+
createSession(endpointConfig: EndpointConfig | null, workflowId: string, name?: string, metadata?: Record<string, unknown>, authProvider?: AuthProvider): Promise<PlaygroundSession>;
|
|
83
84
|
/**
|
|
84
85
|
* Get a playground session by ID
|
|
85
86
|
*
|
|
86
87
|
* @param sessionId - The session UUID
|
|
87
88
|
* @returns The session details
|
|
88
89
|
*/
|
|
89
|
-
getSession(endpointConfig: EndpointConfig | null, sessionId: string): Promise<PlaygroundSession>;
|
|
90
|
+
getSession(endpointConfig: EndpointConfig | null, sessionId: string, authProvider?: AuthProvider): Promise<PlaygroundSession>;
|
|
90
91
|
/**
|
|
91
92
|
* Delete a playground session
|
|
92
93
|
*
|
|
93
94
|
* @param sessionId - The session UUID
|
|
94
95
|
*/
|
|
95
|
-
deleteSession(endpointConfig: EndpointConfig | null, sessionId: string): Promise<void>;
|
|
96
|
+
deleteSession(endpointConfig: EndpointConfig | null, sessionId: string, authProvider?: AuthProvider): Promise<void>;
|
|
96
97
|
/**
|
|
97
98
|
* Get messages from a playground session.
|
|
98
99
|
*
|
|
@@ -106,7 +107,7 @@ export declare class PlaygroundService {
|
|
|
106
107
|
* @param options - Pagination options
|
|
107
108
|
* @returns Messages and session status
|
|
108
109
|
*/
|
|
109
|
-
getMessages(endpointConfig: EndpointConfig | null, sessionId: string, options?: GetMessagesOptions): Promise<PlaygroundMessagesApiResponse>;
|
|
110
|
+
getMessages(endpointConfig: EndpointConfig | null, sessionId: string, options?: GetMessagesOptions, authProvider?: AuthProvider): Promise<PlaygroundMessagesApiResponse>;
|
|
110
111
|
/**
|
|
111
112
|
* Send a message to a playground session
|
|
112
113
|
*
|
|
@@ -115,13 +116,25 @@ export declare class PlaygroundService {
|
|
|
115
116
|
* @param inputs - Optional additional inputs for workflow nodes
|
|
116
117
|
* @returns The created message
|
|
117
118
|
*/
|
|
118
|
-
sendMessage(endpointConfig: EndpointConfig | null, sessionId: string, content: string, inputs?: Record<string, unknown
|
|
119
|
+
sendMessage(endpointConfig: EndpointConfig | null, sessionId: string, content: string, inputs?: Record<string, unknown>, authProvider?: AuthProvider): Promise<PlaygroundMessage>;
|
|
119
120
|
/**
|
|
120
121
|
* Stop execution in a playground session
|
|
121
122
|
*
|
|
122
123
|
* @param sessionId - The session UUID
|
|
123
124
|
*/
|
|
124
|
-
stopExecution(endpointConfig: EndpointConfig | null, sessionId: string): Promise<void>;
|
|
125
|
+
stopExecution(endpointConfig: EndpointConfig | null, sessionId: string, authProvider?: AuthProvider): Promise<void>;
|
|
126
|
+
/**
|
|
127
|
+
* Reset a stuck session to idle, cancelling pending messages and clearing
|
|
128
|
+
* interrupt state.
|
|
129
|
+
*
|
|
130
|
+
* The endpoint is optional in {@link EndpointConfig} — a backend that cannot
|
|
131
|
+
* reset omits it. Callers should check availability first (the slash-command
|
|
132
|
+
* registry does); calling without a configured endpoint throws rather than
|
|
133
|
+
* silently hitting a wrong URL.
|
|
134
|
+
*
|
|
135
|
+
* @param sessionId - The session UUID
|
|
136
|
+
*/
|
|
137
|
+
resetSession(endpointConfig: EndpointConfig | null, sessionId: string, authProvider?: AuthProvider): Promise<void>;
|
|
125
138
|
/**
|
|
126
139
|
* Start polling for new messages
|
|
127
140
|
*
|
|
@@ -131,7 +144,7 @@ export declare class PlaygroundService {
|
|
|
131
144
|
* @param shouldStopPolling - Optional override for stop conditions (default: defaultShouldStopPolling)
|
|
132
145
|
* @param initialSequenceNumber - Optional sequence number to seed polling from (avoids re-fetching already loaded messages)
|
|
133
146
|
*/
|
|
134
|
-
startPolling(endpointConfig: EndpointConfig | null, sessionId: string, callback: (response: PlaygroundMessagesApiResponse) => void, interval?: number, shouldStopPolling?: (status: PlaygroundSessionStatus) => boolean, initialSequenceNumber?: number | null): void;
|
|
147
|
+
startPolling(endpointConfig: EndpointConfig | null, sessionId: string, callback: (response: PlaygroundMessagesApiResponse) => void, interval?: number, shouldStopPolling?: (status: PlaygroundSessionStatus) => boolean, initialSequenceNumber?: number | null, authProvider?: AuthProvider): void;
|
|
135
148
|
/**
|
|
136
149
|
* Stop polling for messages
|
|
137
150
|
*/
|