@flowdrop/flowdrop 1.15.0 → 2.0.0-beta.2
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 +508 -0
- package/MIGRATION-2.0.md +629 -0
- package/README.md +23 -23
- package/dist/adapters/WorkflowAdapter.d.ts +1 -1
- package/dist/adapters/WorkflowAdapter.js +14 -8
- package/dist/adapters/agentspec/AgentSpecAdapter.js +7 -7
- package/dist/api/enhanced-client.js +6 -11
- package/dist/chat/batchFeedback.d.ts +39 -0
- package/dist/chat/batchFeedback.js +51 -0
- package/dist/commands/executor.js +15 -1
- package/dist/commands/storeIntegration.svelte.d.ts +4 -1
- package/dist/commands/storeIntegration.svelte.js +26 -21
- package/dist/commands/types.d.ts +2 -0
- package/dist/components/App.svelte +163 -192
- package/dist/components/App.svelte.d.ts +47 -8
- package/dist/components/ConfigForm.svelte +77 -49
- package/dist/components/ConfigModal.svelte +7 -2
- package/dist/components/ConnectionLine.svelte +4 -2
- package/dist/components/Navbar.svelte +61 -1
- package/dist/components/NodeSidebar.svelte +27 -45
- package/dist/components/NodeStatusOverlay.svelte +94 -6
- package/dist/components/NodeSwapPicker.svelte +10 -8
- package/dist/components/PipelineStatus.svelte +22 -68
- package/dist/components/PipelineStatus.svelte.d.ts +3 -0
- package/dist/components/PortCoordinateTracker.svelte +5 -6
- package/dist/components/SchemaForm.stories.svelte +1 -3
- package/dist/components/SchemaForm.svelte +22 -27
- package/dist/components/SchemaForm.svelte.d.ts +0 -8
- package/dist/components/SettingsModal.svelte +8 -3
- package/dist/components/SettingsPanel.svelte +20 -4
- package/dist/components/SwapMappingEditor.svelte +67 -49
- package/dist/components/SwapMappingEditor.svelte.d.ts +0 -2
- package/dist/components/UniversalNode.svelte +9 -7
- package/dist/components/WorkflowEditor.svelte +121 -111
- package/dist/components/WorkflowEditor.svelte.d.ts +21 -10
- package/dist/components/chat/AIChatPanel.svelte +98 -89
- package/dist/components/chat/AIChatPanel.svelte.d.ts +0 -4
- package/dist/components/chat/CommandPreview.svelte +2 -1
- package/dist/components/console/CommandConsole.svelte +7 -5
- package/dist/components/console/ConsoleAutocomplete.svelte +10 -11
- package/dist/components/console/ConsoleAutocomplete.svelte.d.ts +6 -0
- package/dist/components/console/ConsoleInput.svelte +15 -6
- package/dist/components/console/ConsoleOutput.svelte +2 -1
- package/dist/components/form/FormArray.svelte +5 -9
- package/dist/components/form/FormArray.svelte.d.ts +2 -1
- package/dist/components/form/FormAutocomplete.svelte +16 -15
- package/dist/components/form/FormField.svelte +4 -2
- package/dist/components/form/FormFieldLight.svelte +34 -3
- package/dist/components/form/FormFieldLight.svelte.d.ts +12 -0
- package/dist/components/form/FormMarkdownEditor.svelte +9 -4
- package/dist/components/form/FormRangeField.svelte +1 -0
- package/dist/components/form/FormTemplateEditor.svelte +11 -3
- package/dist/components/form/FormToggle.svelte +5 -12
- package/dist/components/form/FormToggle.svelte.d.ts +4 -2
- package/dist/components/form/FormUISchemaRenderer.svelte +3 -1
- package/dist/components/form/templateAutocomplete.js +1 -5
- package/dist/components/form/types.d.ts +1 -14
- package/dist/components/interrupt/FormPrompt.svelte +3 -2
- package/dist/components/interrupt/InterruptBubble.svelte +25 -17
- package/dist/components/interrupt/ReviewPrompt.svelte +10 -3
- package/dist/components/interrupt/TextInputPrompt.svelte +2 -1
- package/dist/components/layouts/MainLayout.svelte +20 -13
- package/dist/components/layouts/MainLayout.svelte.d.ts +4 -0
- package/dist/components/nodes/AtomNode.svelte +17 -5
- package/dist/components/nodes/GatewayNode.svelte +19 -10
- package/dist/components/nodes/IdeaNode.svelte +7 -0
- package/dist/components/nodes/SimpleNode.svelte +11 -6
- package/dist/components/nodes/SquareNode.svelte +15 -8
- package/dist/components/nodes/TerminalNode.svelte +9 -4
- package/dist/components/nodes/ToolNode.svelte +7 -1
- package/dist/components/nodes/WorkflowNode.svelte +16 -7
- package/dist/components/playground/ChatInput.svelte +11 -14
- package/dist/components/playground/ChatPanel.svelte +6 -49
- package/dist/components/playground/ChatPanel.svelte.d.ts +0 -14
- package/dist/components/playground/ControlPanel.svelte +134 -123
- package/dist/components/playground/ControlPanel.svelte.d.ts +3 -0
- package/dist/components/playground/ExecutionLogs.svelte +11 -9
- package/dist/components/playground/InputCollector.svelte +11 -9
- package/dist/components/playground/MessageStream.svelte +17 -23
- package/dist/components/playground/PipelineKanbanView.svelte +69 -8
- package/dist/components/playground/PipelineKanbanView.svelte.d.ts +2 -0
- package/dist/components/playground/PipelinePanel.svelte +31 -8
- package/dist/components/playground/PipelinePanel.svelte.d.ts +2 -0
- package/dist/components/playground/PipelineTableView.svelte +188 -44
- package/dist/components/playground/PipelineTableView.svelte.d.ts +2 -0
- package/dist/components/playground/Playground.svelte +154 -105
- package/dist/components/playground/Playground.svelte.d.ts +5 -0
- package/dist/components/playground/PlaygroundApp.svelte +11 -1
- package/dist/components/playground/PlaygroundApp.svelte.d.ts +6 -0
- package/dist/components/playground/PlaygroundModal.svelte +18 -3
- package/dist/components/playground/PlaygroundModal.svelte.d.ts +6 -0
- package/dist/components/playground/PlaygroundStudio.svelte +40 -32
- package/dist/components/playground/PlaygroundStudio.svelte.d.ts +6 -0
- package/dist/components/playground/SessionManager.svelte +9 -12
- package/dist/components/playground/pipelineViewUtils.svelte.d.ts +30 -1
- package/dist/components/playground/pipelineViewUtils.svelte.js +40 -3
- package/dist/config/endpoints.d.ts +23 -7
- package/dist/config/endpoints.js +30 -10
- package/dist/core/index.d.ts +5 -6
- package/dist/core/index.js +8 -12
- package/dist/display/index.d.ts +6 -3
- package/dist/display/index.js +7 -5
- package/dist/editor/index.d.ts +20 -21
- package/dist/editor/index.js +26 -36
- package/dist/form/code.d.ts +25 -15
- package/dist/form/code.js +44 -41
- package/dist/form/fieldRegistry.d.ts +17 -13
- package/dist/form/fieldRegistry.js +32 -12
- package/dist/form/full.d.ts +19 -14
- package/dist/form/full.js +26 -28
- package/dist/form/index.d.ts +3 -4
- package/dist/form/index.js +6 -5
- package/dist/form/markdown.d.ts +13 -8
- package/dist/form/markdown.js +22 -23
- package/dist/helpers/proximityConnect.d.ts +3 -2
- package/dist/helpers/proximityConnect.js +2 -5
- package/dist/helpers/workflowEditorHelper.d.ts +14 -5
- package/dist/helpers/workflowEditorHelper.js +28 -25
- package/dist/index.d.ts +28 -24
- package/dist/index.js +27 -50
- package/dist/messages/defaults.d.ts +2 -5
- package/dist/messages/defaults.js +3 -6
- package/dist/messages/index.d.ts +0 -1
- package/dist/messages/index.js +0 -1
- package/dist/mocks/app-forms.d.ts +6 -2
- package/dist/mocks/app-forms.js +11 -4
- package/dist/openapi/v1/openapi.yaml +3 -3
- package/dist/playground/index.d.ts +4 -5
- package/dist/playground/index.js +4 -32
- package/dist/playground/mount.d.ts +25 -0
- package/dist/playground/mount.js +50 -20
- package/dist/registry/{BaseRegistry.d.ts → BaseRegistry.svelte.d.ts} +22 -1
- package/dist/registry/{BaseRegistry.js → BaseRegistry.svelte.js} +37 -1
- package/dist/registry/builtinFormats.d.ts +9 -18
- package/dist/registry/builtinFormats.js +9 -39
- package/dist/registry/builtinNodeTypes.d.ts +53 -0
- package/dist/registry/builtinNodeTypes.js +67 -0
- package/dist/registry/builtinNodes.d.ts +2 -64
- package/dist/registry/builtinNodes.js +7 -103
- package/dist/registry/index.d.ts +3 -4
- package/dist/registry/index.js +4 -6
- package/dist/registry/nodeComponentRegistry.d.ts +182 -15
- package/dist/registry/nodeComponentRegistry.js +235 -17
- package/dist/registry/workflowFormatRegistry.d.ts +14 -9
- package/dist/registry/workflowFormatRegistry.js +24 -8
- package/dist/{schema → schemas}/index.d.ts +2 -2
- package/dist/{schema → schemas}/index.js +2 -2
- package/dist/schemas/v1/workflow.schema.json +3 -3
- package/dist/services/agentSpecExecutionService.d.ts +0 -2
- package/dist/services/agentSpecExecutionService.js +0 -3
- package/dist/services/apiVariableService.d.ts +2 -1
- package/dist/services/apiVariableService.js +16 -47
- package/dist/services/autoSaveService.d.ts +7 -0
- package/dist/services/autoSaveService.js +6 -4
- package/dist/services/categoriesApi.js +3 -6
- package/dist/services/chatService.d.ts +9 -4
- package/dist/services/chatService.js +23 -28
- package/dist/services/draftStorage.d.ts +129 -13
- package/dist/services/draftStorage.js +185 -37
- package/dist/services/dynamicSchemaService.d.ts +2 -1
- package/dist/services/dynamicSchemaService.js +5 -22
- package/dist/services/globalSave.d.ts +13 -12
- package/dist/services/globalSave.js +29 -51
- package/dist/services/historyService.d.ts +9 -3
- package/dist/services/historyService.js +9 -3
- package/dist/services/interruptService.d.ts +15 -9
- package/dist/services/interruptService.js +35 -37
- package/dist/services/nodeExecutionService.d.ts +18 -3
- package/dist/services/nodeExecutionService.js +71 -45
- package/dist/services/playgroundService.d.ts +16 -10
- package/dist/services/playgroundService.js +42 -43
- 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/variableService.d.ts +2 -1
- package/dist/services/variableService.js +2 -2
- package/dist/services/workflowStorage.js +6 -6
- package/dist/stores/apiContext.d.ts +56 -0
- package/dist/stores/apiContext.js +80 -0
- package/dist/stores/categoriesStore.svelte.d.ts +28 -23
- package/dist/stores/categoriesStore.svelte.js +69 -64
- package/dist/stores/getInstance.svelte.d.ts +39 -0
- package/dist/stores/getInstance.svelte.js +65 -0
- package/dist/stores/historyStore.svelte.d.ts +77 -93
- package/dist/stores/historyStore.svelte.js +134 -160
- package/dist/stores/instanceContainer.svelte.d.ts +111 -0
- package/dist/stores/instanceContainer.svelte.js +114 -0
- package/dist/stores/interruptStore.svelte.d.ts +112 -82
- package/dist/stores/interruptStore.svelte.js +253 -226
- package/dist/stores/pipelinePanelStore.svelte.d.ts +27 -3
- package/dist/stores/pipelinePanelStore.svelte.js +61 -14
- package/dist/stores/playgroundStore.svelte.d.ts +169 -222
- package/dist/stores/playgroundStore.svelte.js +513 -580
- package/dist/stores/portCoordinateStore.svelte.d.ts +57 -51
- package/dist/stores/portCoordinateStore.svelte.js +109 -98
- package/dist/stores/settingsStore.svelte.d.ts +4 -1
- package/dist/stores/settingsStore.svelte.js +47 -12
- package/dist/stores/workflowStore.svelte.d.ts +178 -213
- package/dist/stores/workflowStore.svelte.js +449 -501
- package/dist/stories/EdgeDecorator.svelte +5 -2
- package/dist/stories/NodeDecorator.svelte +5 -3
- package/dist/svelte-app.d.ts +60 -10
- package/dist/svelte-app.js +159 -54
- package/dist/types/auth.d.ts +9 -51
- package/dist/types/auth.js +4 -54
- package/dist/types/events.d.ts +6 -3
- package/dist/types/index.d.ts +37 -5
- package/dist/types/index.js +0 -1
- package/dist/types/navbar.d.ts +7 -0
- package/dist/types/playground.d.ts +18 -3
- package/dist/types/settings.d.ts +13 -0
- package/dist/types/settings.js +1 -0
- package/dist/utils/colors.d.ts +47 -21
- package/dist/utils/colors.js +69 -68
- package/dist/utils/connections.d.ts +9 -15
- package/dist/utils/connections.js +13 -32
- package/dist/utils/duration.d.ts +13 -0
- package/dist/utils/duration.js +45 -0
- 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/icons.d.ts +5 -2
- package/dist/utils/icons.js +6 -5
- package/dist/utils/nodeSwap.d.ts +6 -2
- package/dist/utils/nodeSwap.js +62 -126
- package/dist/utils/nodeTypes.d.ts +17 -8
- package/dist/utils/nodeTypes.js +27 -20
- package/dist/utils/performanceUtils.js +7 -0
- package/package.json +7 -5
- package/dist/messages/deprecation.d.ts +0 -20
- package/dist/messages/deprecation.js +0 -33
- package/dist/registry/plugin.d.ts +0 -215
- package/dist/registry/plugin.js +0 -249
- package/dist/services/api.d.ts +0 -129
- package/dist/services/api.js +0 -217
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* FlowDrop Instance Container
|
|
3
|
+
*
|
|
4
|
+
* Holds all per-instance state for one FlowDrop editor: workflow state,
|
|
5
|
+
* undo/redo history, playground sessions, interrupts, port coordinates,
|
|
6
|
+
* categories, and pipeline panel state. Creating one container per mount is
|
|
7
|
+
* what allows multiple FlowDrop editors to coexist on a single page.
|
|
8
|
+
*
|
|
9
|
+
* The container is provided to the component tree via Svelte context (see
|
|
10
|
+
* `getInstance.svelte.ts`). A lazily-created, browser-only default instance
|
|
11
|
+
* backs the legacy module-level store APIs so existing single-instance
|
|
12
|
+
* consumers keep working unchanged.
|
|
13
|
+
*
|
|
14
|
+
* @module stores/instanceContainer
|
|
15
|
+
*/
|
|
16
|
+
import { HistoryService, historyService } from '../services/historyService.js';
|
|
17
|
+
import { WorkflowStore } from './workflowStore.svelte.js';
|
|
18
|
+
import { HistoryStore } from './historyStore.svelte.js';
|
|
19
|
+
import { PlaygroundStore } from './playgroundStore.svelte.js';
|
|
20
|
+
import { InterruptStore } from './interruptStore.svelte.js';
|
|
21
|
+
import { CategoriesStore } from './categoriesStore.svelte.js';
|
|
22
|
+
import { PortCoordinateStore } from './portCoordinateStore.svelte.js';
|
|
23
|
+
import { PipelinePanelStore } from './pipelinePanelStore.svelte.js';
|
|
24
|
+
import { ApiContext } from './apiContext.js';
|
|
25
|
+
import { PortCompatibilityChecker } from '../utils/connections.js';
|
|
26
|
+
import { DEFAULT_PORT_CONFIG } from '../config/defaultPortConfig.js';
|
|
27
|
+
import { NodeComponentRegistry } from '../registry/nodeComponentRegistry.js';
|
|
28
|
+
import { FieldComponentRegistry } from '../form/fieldRegistry.js';
|
|
29
|
+
import { WorkflowFormatRegistry } from '../registry/workflowFormatRegistry.js';
|
|
30
|
+
import { BUILTIN_NODE_COMPONENTS } from '../registry/builtinNodes.js';
|
|
31
|
+
import { getBuiltinFormatAdapters } from '../registry/builtinFormats.js';
|
|
32
|
+
/** Storage key prefix shared by the default instance and legacy consumers. */
|
|
33
|
+
export const DEFAULT_DRAFT_PREFIX = 'flowdrop:draft';
|
|
34
|
+
// Feeds auto-generated ids only (`fd-1`, `fd-2`, …) — cosmetic monotonicity.
|
|
35
|
+
// Incrementing across SSR requests is harmless; no state hangs off the value.
|
|
36
|
+
let instanceCounter = 0;
|
|
37
|
+
/**
|
|
38
|
+
* Create a fully wired FlowDrop instance.
|
|
39
|
+
*
|
|
40
|
+
* Creation order matters: history first, then stores that depend on it
|
|
41
|
+
* (constructor injection — no module-singleton imports).
|
|
42
|
+
*/
|
|
43
|
+
export function createFlowDropInstance(options = {}) {
|
|
44
|
+
const isDefault = options.isDefault ?? false;
|
|
45
|
+
const id = options.id ?? (isDefault ? 'default' : `fd-${++instanceCounter}`);
|
|
46
|
+
// Every instance gets an id-scoped prefix — the default instance's 1.x bare
|
|
47
|
+
// keys are migrated on first read (see migrateLegacyDraftKey / PipelinePanelStore.init).
|
|
48
|
+
const storagePrefix = `${DEFAULT_DRAFT_PREFIX}:${id}`;
|
|
49
|
+
// The default instance reuses the exported singleton (public API via
|
|
50
|
+
// `@flowdrop/flowdrop/editor`) so external `historyService.undo()` etc.
|
|
51
|
+
// keep operating on the default editor's history stack.
|
|
52
|
+
const history = isDefault ? historyService : new HistoryService();
|
|
53
|
+
const workflow = new WorkflowStore(history);
|
|
54
|
+
const historyBindings = new HistoryStore(history);
|
|
55
|
+
// Default wiring: undo/redo restores into this instance's workflow store.
|
|
56
|
+
// WorkflowEditor overrides this with a richer callback while mounted.
|
|
57
|
+
historyBindings.setOnRestoreCallback((restored) => workflow.restoreFromHistory(restored));
|
|
58
|
+
const playground = new PlaygroundStore();
|
|
59
|
+
const cleanups = [
|
|
60
|
+
() => historyBindings.cleanup(),
|
|
61
|
+
() => historyBindings.setOnRestoreCallback(null),
|
|
62
|
+
() => workflow.setOnDirtyStateChange(null),
|
|
63
|
+
() => workflow.setOnWorkflowChange(null),
|
|
64
|
+
() => playground.dispose()
|
|
65
|
+
];
|
|
66
|
+
return {
|
|
67
|
+
id,
|
|
68
|
+
storagePrefix,
|
|
69
|
+
isDefault,
|
|
70
|
+
history,
|
|
71
|
+
workflow,
|
|
72
|
+
historyBindings,
|
|
73
|
+
playground,
|
|
74
|
+
interrupts: new InterruptStore(),
|
|
75
|
+
api: new ApiContext(),
|
|
76
|
+
nodes: new NodeComponentRegistry({
|
|
77
|
+
registrations: BUILTIN_NODE_COMPONENTS,
|
|
78
|
+
defaultType: 'workflowNode'
|
|
79
|
+
}),
|
|
80
|
+
fields: new FieldComponentRegistry(),
|
|
81
|
+
formats: new WorkflowFormatRegistry(getBuiltinFormatAdapters()),
|
|
82
|
+
categories: new CategoriesStore(),
|
|
83
|
+
portCoordinates: new PortCoordinateStore(),
|
|
84
|
+
portCompatibility: new PortCompatibilityChecker(DEFAULT_PORT_CONFIG),
|
|
85
|
+
// The default instance keeps the legacy bare localStorage key.
|
|
86
|
+
pipelinePanel: new PipelinePanelStore(id),
|
|
87
|
+
destroy() {
|
|
88
|
+
while (cleanups.length > 0) {
|
|
89
|
+
cleanups.pop()?.();
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
// =========================================================================
|
|
95
|
+
// Default instance (backward compatibility)
|
|
96
|
+
// =========================================================================
|
|
97
|
+
let defaultInstance = null;
|
|
98
|
+
/**
|
|
99
|
+
* Get the page-default FlowDrop instance, creating it on first access.
|
|
100
|
+
*
|
|
101
|
+
* **Browser-only.** Reactive per-user state must never live at module scope
|
|
102
|
+
* on the server — a module-level default would leak between SvelteKit
|
|
103
|
+
* requests. Server renders must provide an instance via context instead
|
|
104
|
+
* (`<App>` and `<WorkflowEditor>` do this automatically).
|
|
105
|
+
*/
|
|
106
|
+
export function getDefaultInstance() {
|
|
107
|
+
if (typeof window === 'undefined') {
|
|
108
|
+
throw new Error('[flowdrop] The default FlowDrop instance is browser-only to prevent ' +
|
|
109
|
+
'cross-request state leakage during SSR. Render inside <App> or ' +
|
|
110
|
+
'<WorkflowEditor> (which provide an instance via context), or pass ' +
|
|
111
|
+
'an explicit instance.');
|
|
112
|
+
}
|
|
113
|
+
return (defaultInstance ??= createFlowDropInstance({ isDefault: true }));
|
|
114
|
+
}
|
|
@@ -4,6 +4,9 @@
|
|
|
4
4
|
* Rune-based reactive state for managing interrupt state using a lightweight state machine.
|
|
5
5
|
* Ensures valid state transitions and prevents deadlocks.
|
|
6
6
|
*
|
|
7
|
+
* The reactive state lives in the {@link InterruptStore} class — one per
|
|
8
|
+
* FlowDrop instance, resolved in components via `getInstance().interrupts`.
|
|
9
|
+
*
|
|
7
10
|
* @module stores/interruptStore
|
|
8
11
|
*/
|
|
9
12
|
import { SvelteMap } from 'svelte/reactivity';
|
|
@@ -17,46 +20,73 @@ export interface InterruptWithState extends Interrupt {
|
|
|
17
20
|
machineState: InterruptState;
|
|
18
21
|
}
|
|
19
22
|
/**
|
|
20
|
-
*
|
|
21
|
-
* Use this in components within $derived() for reactivity.
|
|
22
|
-
*/
|
|
23
|
-
export declare function getInterruptsMap(): SvelteMap<string, InterruptWithState>;
|
|
24
|
-
/**
|
|
25
|
-
* Get pending interrupt IDs (interrupts not in a terminal state)
|
|
26
|
-
*/
|
|
27
|
-
export declare function getPendingInterruptIds(): string[];
|
|
28
|
-
/**
|
|
29
|
-
* Get pending interrupts array (interrupts not in a terminal state)
|
|
30
|
-
*/
|
|
31
|
-
export declare function getPendingInterrupts(): InterruptWithState[];
|
|
32
|
-
/**
|
|
33
|
-
* Get count of pending interrupts
|
|
34
|
-
*/
|
|
35
|
-
export declare function getPendingInterruptCount(): number;
|
|
36
|
-
/**
|
|
37
|
-
* Get resolved interrupts array
|
|
23
|
+
* Interrupt store actions for modifying state.
|
|
38
24
|
*/
|
|
39
|
-
export
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
25
|
+
export interface InterruptStoreActions {
|
|
26
|
+
addInterrupt: (interrupt: Interrupt) => void;
|
|
27
|
+
addInterrupts: (interruptList: Interrupt[]) => void;
|
|
28
|
+
startSubmit: (interruptId: string, value: unknown) => TransitionResult;
|
|
29
|
+
startCancel: (interruptId: string) => TransitionResult;
|
|
30
|
+
submitSuccess: (interruptId: string) => TransitionResult;
|
|
31
|
+
submitFailure: (interruptId: string, error: string) => TransitionResult;
|
|
32
|
+
retry: (interruptId: string) => TransitionResult;
|
|
33
|
+
resetInterrupt: (interruptId: string) => TransitionResult;
|
|
34
|
+
resolveInterrupt: (interruptId: string, value: unknown) => void;
|
|
35
|
+
cancelInterrupt: (interruptId: string) => void;
|
|
36
|
+
removeInterrupt: (interruptId: string) => void;
|
|
37
|
+
clearSessionInterrupts: (sessionId: string) => void;
|
|
38
|
+
clearInterrupts: () => void;
|
|
39
|
+
reset: () => void;
|
|
40
|
+
}
|
|
44
41
|
/**
|
|
45
|
-
*
|
|
42
|
+
* Per-instance interrupt state, managed via a lightweight state machine.
|
|
43
|
+
*
|
|
44
|
+
* Reads go through getter methods backed by a {@link SvelteMap}, so reading
|
|
45
|
+
* them inside a component template or `$derived` tracks reactively, exactly
|
|
46
|
+
* like the legacy module-level functions did.
|
|
46
47
|
*/
|
|
47
|
-
export declare
|
|
48
|
+
export declare class InterruptStore {
|
|
49
|
+
#private;
|
|
50
|
+
/** Bound mutation facade — see {@link InterruptStoreActions}. */
|
|
51
|
+
readonly actions: InterruptStoreActions;
|
|
52
|
+
constructor();
|
|
53
|
+
/**
|
|
54
|
+
* Get the reactive interrupts map.
|
|
55
|
+
* Use this in components within $derived() for reactivity.
|
|
56
|
+
*/
|
|
57
|
+
getMap(): SvelteMap<string, InterruptWithState>;
|
|
58
|
+
/**
|
|
59
|
+
* Get pending interrupt IDs (interrupts not in a terminal state)
|
|
60
|
+
*/
|
|
61
|
+
getPendingIds(): string[];
|
|
62
|
+
/**
|
|
63
|
+
* Get pending interrupts array (interrupts not in a terminal state)
|
|
64
|
+
*/
|
|
65
|
+
getPending(): InterruptWithState[];
|
|
66
|
+
/**
|
|
67
|
+
* Get count of pending interrupts
|
|
68
|
+
*/
|
|
69
|
+
getPendingCount(): number;
|
|
70
|
+
/**
|
|
71
|
+
* Get resolved interrupts array
|
|
72
|
+
*/
|
|
73
|
+
getResolved(): InterruptWithState[];
|
|
74
|
+
/**
|
|
75
|
+
* Check if any interrupt is currently submitting
|
|
76
|
+
*/
|
|
77
|
+
getIsAnySubmitting(): boolean;
|
|
48
78
|
/**
|
|
49
79
|
* Add or update an interrupt in the store
|
|
50
80
|
*
|
|
51
81
|
* @param interrupt - The interrupt to add or update
|
|
52
82
|
*/
|
|
53
|
-
addInterrupt
|
|
83
|
+
addInterrupt(interrupt: Interrupt): void;
|
|
54
84
|
/**
|
|
55
85
|
* Add multiple interrupts to the store
|
|
56
86
|
*
|
|
57
87
|
* @param interruptList - Array of interrupts to add
|
|
58
88
|
*/
|
|
59
|
-
addInterrupts
|
|
89
|
+
addInterrupts(interruptList: Interrupt[]): void;
|
|
60
90
|
/**
|
|
61
91
|
* Start submitting an interrupt (user clicked submit)
|
|
62
92
|
*
|
|
@@ -64,21 +94,21 @@ export declare const interruptActions: {
|
|
|
64
94
|
* @param value - The value being submitted
|
|
65
95
|
* @returns Transition result
|
|
66
96
|
*/
|
|
67
|
-
startSubmit
|
|
97
|
+
startSubmit(interruptId: string, value: unknown): TransitionResult;
|
|
68
98
|
/**
|
|
69
99
|
* Start cancelling an interrupt (user clicked cancel)
|
|
70
100
|
*
|
|
71
101
|
* @param interruptId - The interrupt ID
|
|
72
102
|
* @returns Transition result
|
|
73
103
|
*/
|
|
74
|
-
startCancel
|
|
104
|
+
startCancel(interruptId: string): TransitionResult;
|
|
75
105
|
/**
|
|
76
106
|
* Mark submission as successful
|
|
77
107
|
*
|
|
78
108
|
* @param interruptId - The interrupt ID
|
|
79
109
|
* @returns Transition result
|
|
80
110
|
*/
|
|
81
|
-
submitSuccess
|
|
111
|
+
submitSuccess(interruptId: string): TransitionResult;
|
|
82
112
|
/**
|
|
83
113
|
* Mark submission as failed
|
|
84
114
|
*
|
|
@@ -86,94 +116,94 @@ export declare const interruptActions: {
|
|
|
86
116
|
* @param error - Error message
|
|
87
117
|
* @returns Transition result
|
|
88
118
|
*/
|
|
89
|
-
submitFailure
|
|
119
|
+
submitFailure(interruptId: string, error: string): TransitionResult;
|
|
90
120
|
/**
|
|
91
121
|
* Retry a failed submission
|
|
92
122
|
*
|
|
93
123
|
* @param interruptId - The interrupt ID
|
|
94
124
|
* @returns Transition result
|
|
95
125
|
*/
|
|
96
|
-
retry
|
|
126
|
+
retry(interruptId: string): TransitionResult;
|
|
97
127
|
/**
|
|
98
128
|
* Reset an interrupt to idle state
|
|
99
129
|
*
|
|
100
130
|
* @param interruptId - The interrupt ID
|
|
101
131
|
* @returns Transition result
|
|
102
132
|
*/
|
|
103
|
-
resetInterrupt
|
|
133
|
+
resetInterrupt(interruptId: string): TransitionResult;
|
|
104
134
|
/**
|
|
105
135
|
* Mark an interrupt as resolved with the user's response
|
|
106
136
|
*
|
|
107
137
|
* @param interruptId - The interrupt ID
|
|
108
138
|
* @param value - The resolved value
|
|
109
139
|
*/
|
|
110
|
-
resolveInterrupt
|
|
140
|
+
resolveInterrupt(interruptId: string, value: unknown): void;
|
|
111
141
|
/**
|
|
112
142
|
* Mark an interrupt as cancelled
|
|
113
143
|
*
|
|
114
144
|
* @param interruptId - The interrupt ID
|
|
115
145
|
*/
|
|
116
|
-
cancelInterrupt
|
|
146
|
+
cancelInterrupt(interruptId: string): void;
|
|
117
147
|
/**
|
|
118
148
|
* Remove an interrupt from the store
|
|
119
149
|
*
|
|
120
150
|
* @param interruptId - The interrupt ID to remove
|
|
121
151
|
*/
|
|
122
|
-
removeInterrupt
|
|
152
|
+
removeInterrupt(interruptId: string): void;
|
|
123
153
|
/**
|
|
124
154
|
* Clear all interrupts for a specific session
|
|
125
155
|
*
|
|
126
156
|
* @param sessionId - The session ID to clear interrupts for
|
|
127
157
|
*/
|
|
128
|
-
clearSessionInterrupts
|
|
158
|
+
clearSessionInterrupts(sessionId: string): void;
|
|
129
159
|
/**
|
|
130
160
|
* Alias for clearSessionInterrupts
|
|
131
161
|
*/
|
|
132
|
-
clearInterrupts
|
|
162
|
+
clearInterrupts(): void;
|
|
133
163
|
/**
|
|
134
164
|
* Reset all interrupt state
|
|
135
165
|
*/
|
|
136
|
-
reset
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
166
|
+
reset(): void;
|
|
167
|
+
/**
|
|
168
|
+
* Get an interrupt by ID
|
|
169
|
+
*
|
|
170
|
+
* @param interruptId - The interrupt ID
|
|
171
|
+
* @returns The interrupt or undefined
|
|
172
|
+
*/
|
|
173
|
+
getInterrupt(interruptId: string): InterruptWithState | undefined;
|
|
174
|
+
/**
|
|
175
|
+
* Check if an interrupt is pending (not resolved or cancelled)
|
|
176
|
+
*
|
|
177
|
+
* @param interruptId - The interrupt ID
|
|
178
|
+
* @returns True if the interrupt exists and is pending
|
|
179
|
+
*/
|
|
180
|
+
isPending(interruptId: string): boolean;
|
|
181
|
+
/**
|
|
182
|
+
* Check if an interrupt is currently submitting
|
|
183
|
+
*
|
|
184
|
+
* @param interruptId - The interrupt ID
|
|
185
|
+
* @returns True if the interrupt is being submitted
|
|
186
|
+
*/
|
|
187
|
+
isSubmitting(interruptId: string): boolean;
|
|
188
|
+
/**
|
|
189
|
+
* Get the error for an interrupt
|
|
190
|
+
*
|
|
191
|
+
* @param interruptId - The interrupt ID
|
|
192
|
+
* @returns The error message or undefined
|
|
193
|
+
*/
|
|
194
|
+
getError(interruptId: string): string | undefined;
|
|
195
|
+
/**
|
|
196
|
+
* Get an interrupt by its associated message ID
|
|
197
|
+
*
|
|
198
|
+
* @param messageId - The message ID
|
|
199
|
+
* @returns The interrupt or undefined
|
|
200
|
+
*/
|
|
201
|
+
getByMessageId(messageId: string): InterruptWithState | undefined;
|
|
202
|
+
/**
|
|
203
|
+
* Check if an interrupt has an error
|
|
204
|
+
*
|
|
205
|
+
* @param interruptId - The interrupt ID
|
|
206
|
+
* @returns True if the interrupt has an error
|
|
207
|
+
*/
|
|
208
|
+
hasError(interruptId: string): boolean;
|
|
209
|
+
}
|