@kiberon-labs/behave-graph-flow 2.0.0 → 3.0.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/.storybook/manager.ts +6 -0
- package/.storybook/preview.ts +49 -1
- package/.storybook/styles.css +9 -3
- package/.turbo/turbo-build.log +1 -1
- package/CHANGELOG.md +368 -0
- package/dist/AnyControlImpl-Ds-CShIB.js +20 -0
- package/dist/AnyControlImpl-Ds-CShIB.js.map +1 -0
- package/dist/DocumentationBrowserPanelImpl-deZNzFX8.js +166 -0
- package/dist/DocumentationBrowserPanelImpl-deZNzFX8.js.map +1 -0
- package/dist/index.css +36 -33
- package/dist/index.css.map +1 -1
- package/dist/index.d.ts +1865 -550
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +14357 -11221
- package/dist/index.js.map +1 -1
- package/dist/noteImpl-KkrrWgJd.js +242 -0
- package/dist/noteImpl-KkrrWgJd.js.map +1 -0
- package/dist/styles.module-CvmpDkZj.css +3 -0
- package/dist/styles.module-CvmpDkZj.css.map +1 -0
- package/dist/styles.module-DZxg8aW9.js +271 -0
- package/dist/styles.module-DZxg8aW9.js.map +1 -0
- package/dist/useChangeNodeData-ChQGK7AI.js +23 -0
- package/dist/useChangeNodeData-ChQGK7AI.js.map +1 -0
- package/docs/protocol.md +43 -20
- package/package.json +5 -9
- package/src/components/FloatingToolbar/index.module.css +5 -13
- package/src/components/FloatingToolbar/index.tsx +9 -9
- package/src/components/Flow.tsx +34 -23
- package/src/components/contextMenus/DynamicContextMenu.tsx +85 -0
- package/src/components/contextMenus/NodePicker.module.css +13 -13
- package/src/components/contextMenus/edge.tsx +9 -95
- package/src/components/contextMenus/node.tsx +9 -149
- package/src/components/contextMenus/selection.tsx +5 -71
- package/src/components/controls/any/AnyControlImpl.tsx +14 -0
- package/src/components/controls/any/index.tsx +13 -2
- package/src/components/edges/index.tsx +75 -69
- package/src/components/layoutController/index.module.css +3 -0
- package/src/components/layoutController/index.tsx +24 -1
- package/src/components/layoutController/utils.ts +46 -3
- package/src/components/menubar/defaults.tsx +55 -19
- package/src/components/menubar/menuItem.module.css +18 -3
- package/src/components/menubar/menuItem.tsx +34 -1
- package/src/components/nodes/behave/NodeContainer.module.css +26 -25
- package/src/components/nodes/group/index.tsx +3 -3
- package/src/components/nodes/wrapper/styles.module.css +6 -32
- package/src/components/panels/alignment/index.module.css +0 -10
- package/src/components/panels/alignment/index.tsx +4 -4
- package/src/components/panels/base/styles.module.css +2 -2
- package/src/components/panels/common/PanelHeader.module.css +24 -0
- package/src/components/panels/common/PanelHeader.tsx +22 -0
- package/src/components/panels/common/SectionTitle.module.css +13 -0
- package/src/components/panels/common/SectionTitle.tsx +10 -0
- package/src/components/panels/events/EditEventPanel.tsx +14 -5
- package/src/components/panels/events/ManageEventsPanel.tsx +11 -8
- package/src/components/panels/events/styles.module.css +6 -64
- package/src/components/panels/graphProperties/index.tsx +125 -0
- package/src/components/panels/history/index.tsx +2 -2
- package/src/components/panels/history/styles.module.css +0 -9
- package/src/components/panels/keymaps/index.module.css +3 -13
- package/src/components/panels/keymaps/index.tsx +1 -2
- package/src/components/panels/layers/index.tsx +20 -15
- package/src/components/panels/layers/styles.module.css +9 -12
- package/src/components/panels/legend/index.tsx +1 -1
- package/src/components/panels/logs/index.module.css +25 -19
- package/src/components/panels/logs/index.tsx +7 -7
- package/src/components/panels/nodeInputs/InputsGroup.tsx +1 -0
- package/src/components/panels/nodeInputs/NodeSettings.tsx +2 -2
- package/src/components/panels/nodeInputs/NodeTitleEditor.tsx +1 -1
- package/src/components/panels/nodeInputs/OutputsGroup.tsx +2 -12
- package/src/components/panels/nodeInputs/index.module.css +99 -75
- package/src/components/panels/nodeInputs/index.tsx +21 -11
- package/src/components/panels/nodeInputs/useNodeHandlers.ts +2 -2
- package/src/components/panels/nodeInputs/useNodeInputsData.ts +23 -43
- package/src/components/panels/nodePicker/index.tsx +8 -8
- package/src/components/panels/panel/index.module.css +7 -7
- package/src/components/panels/search/index.module.css +0 -50
- package/src/components/panels/search/index.tsx +2 -2
- package/src/components/panels/systemSettings/ConversionsSettings.tsx +203 -0
- package/src/components/panels/systemSettings/index.tsx +221 -176
- package/src/components/panels/systemSettings/styles.module.css +135 -8
- package/src/components/panels/traces/GridLines.tsx +1 -1
- package/src/components/panels/traces/TimeGrid.tsx +3 -3
- package/src/components/panels/traces/TraceLane.tsx +1 -1
- package/src/components/panels/traces/index.module.css +1 -8
- package/src/components/panels/traces/index.tsx +8 -4
- package/src/components/panels/traces/useDerivedSpans.ts +241 -146
- package/src/components/panels/traces/utils.ts +8 -0
- package/src/components/panels/variables/CreateVariableScreen.tsx +3 -3
- package/src/components/panels/variables/ManageVariablesScreen.tsx +12 -9
- package/src/components/panels/variables/index.tsx +2 -2
- package/src/components/panels/variables/styles.module.css +4 -91
- package/src/components/primitives/icon.module.css +4 -4
- package/src/components/sockets/input/index.tsx +9 -2
- package/src/components/sockets/input/styles.module.css +2 -3
- package/src/components/sockets/output/index.tsx +10 -3
- package/src/components/sockets/output/styles.module.css +1 -6
- package/src/css/notes.css +135 -0
- package/src/css/prosemirror.css +3 -3
- package/src/css/rc-dock.css +143 -43
- package/src/css/rc-menu.css +56 -55
- package/src/css/themes/kiberon.css +127 -0
- package/src/css/vars.css +197 -13
- package/src/css/vscode-elements.css +124 -0
- package/src/generators/CallSubgraphGenerator.tsx +136 -0
- package/src/generators/CustomEventOnTriggeredGenerator.tsx +2 -2
- package/src/generators/GraphBoundaryGenerator.module.css +32 -0
- package/src/generators/GraphBoundaryGenerator.tsx +193 -0
- package/src/generators/SequenceGenerator.tsx +2 -2
- package/src/generators/SwitchOnIntegerGenerator.tsx +2 -2
- package/src/generators/SwitchOnStringGenerator.tsx +2 -2
- package/src/generators/callSubgraphSync.ts +126 -0
- package/src/generators/registerDefaultGenerators.ts +21 -0
- package/src/generators/registerDefaults.ts +26 -0
- package/src/hooks/useBehaveGraphFlow.ts +2 -2
- package/src/hooks/useFlowHandlers.ts +47 -9
- package/src/hooks/useWasdPan.ts +26 -4
- package/src/index.css +4 -16
- package/src/index.ts +17 -0
- package/src/manifest/contributionRegistry.ts +93 -0
- package/src/manifest/index.ts +4 -0
- package/src/manifest/loadManifest.ts +82 -0
- package/src/manifest/manifestPlugin.ts +29 -0
- package/src/manifest/passthroughValueType.ts +40 -0
- package/src/plugin/alignment/index.ts +22 -12
- package/src/plugin/autosave/controller.ts +366 -0
- package/src/plugin/autosave/index.tsx +114 -0
- package/src/plugin/autosave/panel/BackupPanel.tsx +141 -0
- package/src/plugin/autosave/panel/index.tsx +1 -0
- package/src/plugin/autosave/panel/styles.module.css +56 -0
- package/src/plugin/autosave/settings.ts +65 -0
- package/src/plugin/autosave/storage.ts +147 -0
- package/src/plugin/docs/index.tsx +2 -4
- package/src/plugin/docs/panel/DocumentationBrowserPanelImpl.tsx +200 -0
- package/src/plugin/docs/panel/index.tsx +15 -194
- package/src/plugin/docs/panel/styles.module.css +8 -8
- package/src/plugin/graphrunner/actions.ts +258 -185
- package/src/plugin/graphrunner/buttons.tsx +34 -26
- package/src/plugin/graphrunner/client.ts +4 -1
- package/src/plugin/graphrunner/index.tsx +29 -100
- package/src/plugin/graphrunner/panel.tsx +2 -2
- package/src/plugin/graphrunner/runController.ts +283 -0
- package/src/plugin/graphrunner/runner.ts +21 -192
- package/src/plugin/graphrunner/store.ts +14 -24
- package/src/plugin/graphrunner/styles.module.css +17 -57
- package/src/plugin/graphrunner/transport.ts +26 -0
- package/src/plugin/graphrunner/types.ts +21 -0
- package/src/plugin/graphrunner-local/execution-utils.ts +260 -80
- package/src/plugin/graphrunner-local/index.tsx +8 -2
- package/src/plugin/graphrunner-local/panel.tsx +131 -175
- package/src/plugin/graphrunner-local/styles.module.css +57 -76
- package/src/plugin/graphrunner-local/transport.ts +151 -184
- package/src/plugin/graphrunner-webworker/graph-executor.worker.ts +2 -0
- package/src/plugin/graphrunner-webworker/index.tsx +4 -10
- package/src/plugin/graphrunner-webworker/store.ts +9 -0
- package/src/plugin/kitchen-sink/index.ts +38 -0
- package/src/{layout/dagre.tsx → plugin/layout/dagre.ts} +17 -5
- package/src/{layout → plugin/layout}/elk.ts +22 -6
- package/src/plugin/layout/index.ts +80 -0
- package/src/plugin/notes/FormatToolbar.tsx +200 -0
- package/src/plugin/notes/index.tsx +191 -0
- package/src/plugin/notes/nodeActions.ts +100 -0
- package/src/plugin/notes/note.tsx +20 -0
- package/src/plugin/notes/noteImpl.tsx +89 -0
- package/src/plugin/realtime/realtimeRunner.ts +58 -4
- package/src/specifics/CustomEventOnTriggeredSpecific.tsx +2 -2
- package/src/specifics/CustomEventTriggerSpecific.tsx +2 -2
- package/src/specifics/VariableGetSpecific.tsx +2 -2
- package/src/specifics/VariableSetSpecific.tsx +2 -2
- package/src/store/actions.tsx +5 -5
- package/src/store/commands.ts +278 -0
- package/src/store/contextMenu.ts +192 -0
- package/src/store/conversions.ts +47 -0
- package/src/store/flow.tsx +23 -38
- package/src/store/graphMeta.ts +39 -0
- package/src/store/hotKeys.tsx +301 -260
- package/src/store/layers.ts +3 -3
- package/src/store/registry.ts +12 -4
- package/src/store/selection.ts +3 -3
- package/src/store/settings.ts +82 -82
- package/src/store/settingsSchema.ts +210 -0
- package/src/store/tabs.ts +5 -1
- package/src/store/traces.ts +3 -3
- package/src/system/graph.ts +11 -14
- package/src/system/graphSession.ts +172 -0
- package/src/system/index.ts +3 -0
- package/src/system/notifications.ts +13 -0
- package/src/system/persistence.ts +82 -0
- package/src/system/plugin.ts +28 -0
- package/src/system/provider.tsx +64 -0
- package/src/system/system.ts +518 -88
- package/src/system/tabLoader.tsx +70 -32
- package/src/system/undoRedo.ts +1 -1
- package/src/transformers/Uigraph.ts +5 -4
- package/src/transformers/contract.ts +87 -0
- package/src/transformers/flowToBehave.ts +13 -5
- package/src/types/nodes.ts +8 -3
- package/src/types.ts +2 -0
- package/src/util/autoConvert.ts +200 -0
- package/src/util/isValidConnection.ts +23 -2
- package/stories/defaults/defaultStoryProvider.tsx +17 -14
- package/stories/defaults/systemGenerator.ts +6 -1
- package/stories/{components/nodes/comment.stories.tsx → plugins/notes.stories.tsx} +24 -30
- package/tests/autoConvert.test.ts +329 -0
- package/tests/autosavePlugin.test.ts +204 -0
- package/tests/callSubgraphSync.test.ts +148 -0
- package/tests/commandRegistry.test.ts +137 -0
- package/tests/contract.test.ts +51 -0
- package/tests/contractSerialize.test.ts +62 -0
- package/tests/deriveSpans.test.ts +71 -0
- package/tests/flowToBehave.test.ts +2 -1
- package/tests/hotkeys.test.ts +79 -0
- package/tests/keepAliveLifecycle.test.ts +167 -0
- package/tests/loadManifest.test.ts +113 -0
- package/tests/noteMarkdown.test.ts +65 -0
- package/tests/notesPlugin.test.ts +162 -0
- package/tests/persistence.test.ts +51 -0
- package/tests/saveLoad.test.ts +7 -6
- package/tests/settings.test.ts +178 -0
- package/tests/traceStore.test.ts +46 -0
- package/tests/visual/README.md +2 -2
- package/tests/visual/__screenshots__/panels.visual.test.tsx/panel-conversation-chromium-win32.png +0 -0
- package/tests/visual/__screenshots__/panels.visual.test.tsx/panel-events-chromium-win32.png +0 -0
- package/tests/visual/__screenshots__/panels.visual.test.tsx/panel-history-chromium-win32.png +0 -0
- package/tests/visual/__screenshots__/panels.visual.test.tsx/panel-keymaps-chromium-win32.png +0 -0
- package/tests/visual/__screenshots__/panels.visual.test.tsx/panel-layers-chromium-win32.png +0 -0
- package/tests/visual/__screenshots__/panels.visual.test.tsx/panel-legend-chromium-win32.png +0 -0
- package/tests/visual/__screenshots__/panels.visual.test.tsx/panel-localGraphRunner-chromium-win32.png +0 -0
- package/tests/visual/__screenshots__/panels.visual.test.tsx/panel-logs-chromium-win32.png +0 -0
- package/tests/visual/__screenshots__/panels.visual.test.tsx/panel-nodeInputs-chromium-win32.png +0 -0
- package/tests/visual/__screenshots__/panels.visual.test.tsx/panel-nodePicker-chromium-win32.png +0 -0
- package/tests/visual/__screenshots__/panels.visual.test.tsx/panel-panel-chromium-win32.png +0 -0
- package/tests/visual/__screenshots__/panels.visual.test.tsx/panel-search-chromium-win32.png +0 -0
- package/tests/visual/__screenshots__/panels.visual.test.tsx/panel-systemSettings-chromium-win32.png +0 -0
- package/tests/visual/__screenshots__/panels.visual.test.tsx/panel-variables-chromium-win32.png +0 -0
- package/tests/visual/panels.visual.test.tsx +3 -3
- package/tests/wasdPan.test.ts +71 -0
- package/vitest.config.ts +1 -1
- package/vitest.visual.config.ts +7 -0
- package/.storybook/vscode.css +0 -814
- package/src/components/nodes/comment/FormatToolbar.tsx +0 -118
- package/src/components/nodes/comment/comment.tsx +0 -103
- package/src/components/nodes/comment/styles.module.css +0 -150
- package/src/components/panels/conversation/index.module.css +0 -151
- package/src/components/panels/conversation/index.tsx +0 -162
- package/src/components/panels/events/CustomEventsEditor.tsx +0 -384
- package/src/css/vscode.css +0 -13
- package/src/hooks/useDetachNodes.ts +0 -39
- package/src/plugin/graphrunner-webworker/types.ts +0 -17
- package/src/specifics/registerDefaultSpecifics.ts +0 -5
- package/src/store/chat.ts +0 -73
- package/src/store/graphRunnerClient.ts +0 -110
package/dist/index.d.ts
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as react0 from "react";
|
|
2
|
+
import React$1, { ComponentType, FC, MouseEvent as MouseEvent$1, ReactNode } from "react";
|
|
2
3
|
import * as reactflow0 from "reactflow";
|
|
3
4
|
import { Connection, ConnectionStatus, Edge, EdgeChange, EdgeProps, Node as Node$1, NodeChange, NodeProps, OnConnectStartParams, ReactFlowInstance, Viewport, XYPosition } from "reactflow";
|
|
4
|
-
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
5
5
|
import * as zustand5 from "zustand";
|
|
6
6
|
import { StoreApi } from "zustand";
|
|
7
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
7
8
|
import * as _kiberon_labs_behave_graph0 from "@kiberon-labs/behave-graph";
|
|
8
|
-
import { ChoiceJSON, CustomEventJSON, CustomEventParameterJSON, Engine, GraphJSON, INode, IRegistry, InputSocketSpecJSON, LogSeverity, NodeSpecJSON, OutputSocketSpecJSON, VariableJSON as VariableJSON$1 } from "@kiberon-labs/behave-graph";
|
|
9
|
+
import { ChoiceJSON, ContributionSpec, CustomEventJSON, CustomEventParameterJSON, Engine, GraphJSON, INode, IRegistry, InputSocketSpecJSON, LogSeverity, ManifestJSON, NodeSpecJSON, OutputSocketSpecJSON, PackageRequirement, ValueTypeSpecJSON, VariableJSON as VariableJSON$1 } from "@kiberon-labs/behave-graph";
|
|
10
|
+
import { StoreApi as StoreApi$1 } from "zustand/vanilla";
|
|
9
11
|
import { Item } from "rc-menu";
|
|
10
12
|
import { LayoutBase, TabBase, TabData } from "rc-dock";
|
|
11
13
|
import { Renderable, Toast } from "react-hot-toast";
|
|
@@ -16,6 +18,7 @@ type InputSocketProps = {
|
|
|
16
18
|
hideName?: boolean;
|
|
17
19
|
connected: boolean;
|
|
18
20
|
value: any | undefined;
|
|
21
|
+
label?: string;
|
|
19
22
|
onChange: (key: string, value: any) => void;
|
|
20
23
|
specJSON: NodeSpecJSON[];
|
|
21
24
|
} & InputSocketSpecJSON;
|
|
@@ -24,6 +27,8 @@ type InputSocketProps = {
|
|
|
24
27
|
interface SocketBase {
|
|
25
28
|
name: string;
|
|
26
29
|
key: string;
|
|
30
|
+
/** Optional display label; falls back to `name` when absent. */
|
|
31
|
+
label?: string;
|
|
27
32
|
choices?: ChoiceJSON;
|
|
28
33
|
valueType: string;
|
|
29
34
|
defaultValue?: any;
|
|
@@ -47,6 +52,19 @@ type IBehaveNode = Omit<Node$1, 'data' | 'type'> & {
|
|
|
47
52
|
configuration: Record<string, any>;
|
|
48
53
|
};
|
|
49
54
|
};
|
|
55
|
+
/**
|
|
56
|
+
* Presentational markdown note, contributed by the notes plugin
|
|
57
|
+
* (`@/plugin/notes`). `commentNode` is the legacy type string notes carried
|
|
58
|
+
* when they lived in the core editor.
|
|
59
|
+
*/
|
|
60
|
+
type INoteNode = Omit<Node$1, 'data' | 'type'> & {
|
|
61
|
+
type: 'noteNode' | 'commentNode';
|
|
62
|
+
data: {
|
|
63
|
+
annotations?: Record<string, any>;
|
|
64
|
+
text: string;
|
|
65
|
+
fontSize?: string;
|
|
66
|
+
};
|
|
67
|
+
};
|
|
50
68
|
//#endregion
|
|
51
69
|
//#region src/components/nodes/behave/Node.d.ts
|
|
52
70
|
type BehaveNodeProps = NodeProps<IBehaveNode['data']> & {
|
|
@@ -128,12 +146,23 @@ declare const NodePicker: React$1.FC<NodePickerProps>;
|
|
|
128
146
|
type OutputSocketProps = {
|
|
129
147
|
connected: boolean;
|
|
130
148
|
hide?: boolean;
|
|
149
|
+
label?: string;
|
|
131
150
|
specJSON: NodeSpecJSON[];
|
|
132
151
|
} & OutputSocketSpecJSON;
|
|
133
152
|
//#endregion
|
|
134
153
|
//#region src/components/menubar/menuItem.d.ts
|
|
135
154
|
type IMenuItemElement = React$1.ComponentProps<typeof Item> & {
|
|
136
155
|
icon?: React$1.ReactNode;
|
|
156
|
+
/**
|
|
157
|
+
* Explicit shortcut hint (e.g. `'Ctrl+S'`). Overrides the auto-detected one.
|
|
158
|
+
*/
|
|
159
|
+
keybinding?: string;
|
|
160
|
+
/**
|
|
161
|
+
* Command id this item runs. When provided, the shortcut hint is detected
|
|
162
|
+
* automatically from the live keymap, so a menu item shows its shortcut just
|
|
163
|
+
* by naming the command it dispatches.
|
|
164
|
+
*/
|
|
165
|
+
commandId?: string;
|
|
137
166
|
/**
|
|
138
167
|
* Needed to hack into the inner part of the menu item
|
|
139
168
|
*/
|
|
@@ -145,9 +174,29 @@ type IMenuItemElement = React$1.ComponentProps<typeof Item> & {
|
|
|
145
174
|
declare const MenuItemElement: ({
|
|
146
175
|
inner,
|
|
147
176
|
children,
|
|
177
|
+
keybinding,
|
|
178
|
+
commandId,
|
|
148
179
|
...rest
|
|
149
180
|
}: IMenuItemElement) => react_jsx_runtime0.JSX.Element;
|
|
150
181
|
//#endregion
|
|
182
|
+
//#region src/components/panels/base/index.d.ts
|
|
183
|
+
declare const BasePanel: ({
|
|
184
|
+
children
|
|
185
|
+
}: {
|
|
186
|
+
children: React.ReactNode;
|
|
187
|
+
}) => react_jsx_runtime0.JSX.Element;
|
|
188
|
+
//#endregion
|
|
189
|
+
//#region src/components/primitives/icon.d.ts
|
|
190
|
+
interface IconProps extends React$1.HTMLAttributes<HTMLButtonElement> {
|
|
191
|
+
children: React$1.ReactNode;
|
|
192
|
+
onClick?: (e: React$1.MouseEvent<HTMLButtonElement>) => void;
|
|
193
|
+
title?: string;
|
|
194
|
+
disabled?: boolean;
|
|
195
|
+
className?: string;
|
|
196
|
+
size?: 'small' | 'medium' | 'large';
|
|
197
|
+
}
|
|
198
|
+
declare const Icon: React$1.FC<IconProps>;
|
|
199
|
+
//#endregion
|
|
151
200
|
//#region src/hooks/useChangeNodeData.d.ts
|
|
152
201
|
declare const useChangeNodeData: (id: string) => (key: string, value: any) => void;
|
|
153
202
|
//#endregion
|
|
@@ -203,46 +252,6 @@ declare const useFlowHandlers: ({
|
|
|
203
252
|
//#region src/transformers/behaveToFlow.d.ts
|
|
204
253
|
declare const behaveToFlow: (graph: GraphJSON) => [Node$1[], Edge[]];
|
|
205
254
|
//#endregion
|
|
206
|
-
//#region src/system/undoRedo.d.ts
|
|
207
|
-
interface Command {
|
|
208
|
-
name: string;
|
|
209
|
-
execute(): void;
|
|
210
|
-
undo(): void;
|
|
211
|
-
/**
|
|
212
|
-
* Optional redo method if different from execute
|
|
213
|
-
*/
|
|
214
|
-
redo?(): void;
|
|
215
|
-
}
|
|
216
|
-
type UndoStackEntry = {
|
|
217
|
-
name: string;
|
|
218
|
-
};
|
|
219
|
-
type UndoStore = {
|
|
220
|
-
canUndo: boolean;
|
|
221
|
-
canRedo: boolean;
|
|
222
|
-
history: UndoStackEntry[];
|
|
223
|
-
redoStack: UndoStackEntry[];
|
|
224
|
-
setSnapshot: (snapshot: {
|
|
225
|
-
canUndo: boolean;
|
|
226
|
-
canRedo: boolean;
|
|
227
|
-
history: UndoStackEntry[];
|
|
228
|
-
redoStack: UndoStackEntry[];
|
|
229
|
-
}) => void;
|
|
230
|
-
};
|
|
231
|
-
declare class UndoManager {
|
|
232
|
-
private history;
|
|
233
|
-
private stack;
|
|
234
|
-
private limit;
|
|
235
|
-
store: zustand5.UseBoundStore<zustand5.StoreApi<UndoStore>>;
|
|
236
|
-
constructor();
|
|
237
|
-
private syncStore;
|
|
238
|
-
execute(command: Command): void;
|
|
239
|
-
undo(): void;
|
|
240
|
-
redo(): void;
|
|
241
|
-
canUndo(): boolean;
|
|
242
|
-
canRedo(): boolean;
|
|
243
|
-
clear(): void;
|
|
244
|
-
}
|
|
245
|
-
//#endregion
|
|
246
255
|
//#region src/store/tabs.d.ts
|
|
247
256
|
type TabStore = {
|
|
248
257
|
currentPanel?: string;
|
|
@@ -257,9 +266,16 @@ type TabStore = {
|
|
|
257
266
|
//#region src/system/tabLoader.d.ts
|
|
258
267
|
declare class TabLoader {
|
|
259
268
|
readonly tabs: Record<string, () => TabData>;
|
|
260
|
-
|
|
269
|
+
private readonly system;
|
|
270
|
+
constructor(system: System);
|
|
261
271
|
load(tab: TabBase): TabData | undefined;
|
|
262
272
|
register(id: string, loader: () => TabData): void;
|
|
273
|
+
/**
|
|
274
|
+
* Build the TabData for a graph tab, resolving (or lazily creating) its
|
|
275
|
+
* session and wrapping the canvas in a {@link GraphProvider} so it stays bound
|
|
276
|
+
* to its own graph regardless of which tab is focused.
|
|
277
|
+
*/
|
|
278
|
+
private buildGraphTab;
|
|
263
279
|
}
|
|
264
280
|
//#endregion
|
|
265
281
|
//#region src/store/settings.d.ts
|
|
@@ -270,60 +286,169 @@ declare const EDGE_TYPE: {
|
|
|
270
286
|
readonly simpleBezier: "Simple Bezier";
|
|
271
287
|
};
|
|
272
288
|
type EdgeType = (typeof EDGE_TYPE)[keyof typeof EDGE_TYPE];
|
|
273
|
-
declare const LAYOUT_TYPE: {
|
|
274
|
-
readonly dagre: "Dagre";
|
|
275
|
-
readonly elkForce: "Elk - Force";
|
|
276
|
-
readonly elkRect: "Elk - Rect";
|
|
277
|
-
readonly elkLayered: "Elk - Layered";
|
|
278
|
-
};
|
|
279
|
-
type LayoutType = (typeof LAYOUT_TYPE)[keyof typeof LAYOUT_TYPE];
|
|
280
289
|
type GeneratorLocation = 'inline' | 'panel';
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
290
|
+
/**
|
|
291
|
+
* Single source of truth for editor settings. Each entry's `default` defines the
|
|
292
|
+
* value (and its type); `persist: false` excludes it from the saved settings.
|
|
293
|
+
* The store shape, setters, and the persisted-key list are all derived from this
|
|
294
|
+
* , adding a setting here is the only edit needed (no setter boilerplate, no
|
|
295
|
+
* separate persist allow-list to keep in sync).
|
|
296
|
+
*/
|
|
297
|
+
declare const SETTINGS: {
|
|
298
|
+
edgeType: {
|
|
299
|
+
default: EdgeType;
|
|
300
|
+
};
|
|
301
|
+
debugMode: {
|
|
302
|
+
default: boolean;
|
|
303
|
+
};
|
|
304
|
+
showMenu: {
|
|
305
|
+
default: boolean;
|
|
306
|
+
};
|
|
307
|
+
showTimings: {
|
|
308
|
+
default: boolean;
|
|
309
|
+
};
|
|
310
|
+
showMinimap: {
|
|
311
|
+
default: boolean;
|
|
312
|
+
};
|
|
313
|
+
showGrid: {
|
|
314
|
+
default: boolean;
|
|
315
|
+
};
|
|
316
|
+
showSearch: {
|
|
317
|
+
default: boolean;
|
|
318
|
+
persist: false;
|
|
319
|
+
};
|
|
320
|
+
/** Delay applying a node value change until the user commits it. */
|
|
321
|
+
delayedUpdate: {
|
|
322
|
+
default: boolean;
|
|
323
|
+
};
|
|
324
|
+
/** Show value types inline on nodes. */
|
|
325
|
+
inlineTypes: {
|
|
326
|
+
default: boolean;
|
|
327
|
+
};
|
|
328
|
+
/** Show values inline on nodes. */
|
|
329
|
+
inlineValues: {
|
|
330
|
+
default: boolean;
|
|
331
|
+
};
|
|
332
|
+
connectOnClick: {
|
|
333
|
+
default: boolean;
|
|
334
|
+
};
|
|
335
|
+
/**
|
|
336
|
+
* When connecting sockets of different-but-convertible value types,
|
|
337
|
+
* automatically insert a conversion node between them.
|
|
338
|
+
*/
|
|
339
|
+
autoConvert: {
|
|
340
|
+
default: boolean;
|
|
341
|
+
};
|
|
342
|
+
snapGrid: {
|
|
343
|
+
default: boolean;
|
|
344
|
+
};
|
|
345
|
+
gridSize: {
|
|
346
|
+
default: number;
|
|
347
|
+
};
|
|
348
|
+
generatorLocation: {
|
|
349
|
+
default: GeneratorLocation;
|
|
350
|
+
};
|
|
351
|
+
};
|
|
352
|
+
type SettingsSchema = typeof SETTINGS;
|
|
353
|
+
type SettingsState = { [K in keyof SettingsSchema]: SettingsSchema[K]['default'] };
|
|
354
|
+
type SettingsSetters = { [K in keyof SettingsSchema as `set${Capitalize<K & string>}`]: (value: SettingsSchema[K]['default']) => void };
|
|
355
|
+
/**
|
|
356
|
+
* Generic accessors so plugin-contributed settings (dynamic keys not in the
|
|
357
|
+
* static {@link SETTINGS} schema) live in the same store as the typed built-ins.
|
|
358
|
+
* The auto-generated panel writes every row through {@link SystemSettingsStore.setSetting};
|
|
359
|
+
* the typed per-key setters above remain for existing typed consumers.
|
|
360
|
+
*/
|
|
361
|
+
type SettingsDynamicAccess = {
|
|
362
|
+
/** Dynamic plugin-contributed setting values, keyed by descriptor key. */
|
|
363
|
+
[key: string]: unknown;
|
|
364
|
+
/** Set any setting by key (used by the schema-driven panel + plugins). */
|
|
365
|
+
setSetting: (key: string, value: unknown) => void;
|
|
311
366
|
};
|
|
367
|
+
type SystemSettingsStore = SettingsState & SettingsSetters & SettingsDynamicAccess;
|
|
312
368
|
//#endregion
|
|
313
|
-
//#region src/store/
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
369
|
+
//#region src/store/settingsSchema.d.ts
|
|
370
|
+
/**
|
|
371
|
+
* Schema-driven settings.
|
|
372
|
+
*
|
|
373
|
+
* The Settings panel is auto-generated from a registry of {@link SettingDescriptor}s
|
|
374
|
+
* rather than hand-coded JSX. Built-in settings are seeded as {@link DEFAULT_SETTINGS};
|
|
375
|
+
* plugins contribute their own via `system.registerSetting(...)`, and the panel
|
|
376
|
+
* renders them the same way — so a plugin can surface settings without forking
|
|
377
|
+
* the panel.
|
|
378
|
+
*
|
|
379
|
+
* Descriptors are intentionally plain data (everything except `render`/`when` is
|
|
380
|
+
* JSON-serializable), so a future declarative manifest `contributes.configuration`
|
|
381
|
+
* section can feed this same registry.
|
|
382
|
+
*/
|
|
383
|
+
type SettingEnumOption = {
|
|
384
|
+
value: string;
|
|
385
|
+
label: string;
|
|
386
|
+
};
|
|
387
|
+
/** Live values bag passed to a descriptor's {@link SettingDescriptorBase.when}. */
|
|
388
|
+
type SettingsValues = Record<string, unknown>;
|
|
389
|
+
/** Props handed to a `type: 'custom'` descriptor's `render` component. */
|
|
390
|
+
type SettingControlProps = {
|
|
391
|
+
value: unknown;
|
|
392
|
+
setValue: (value: unknown) => void;
|
|
393
|
+
descriptor: SettingDescriptor;
|
|
394
|
+
};
|
|
395
|
+
type SettingDescriptorBase = {
|
|
396
|
+
/**
|
|
397
|
+
* Unique key. Built-ins are flat (`edgeType`) and match the value-store keys
|
|
398
|
+
* 1:1; plugin settings should be namespaced (`graphRunner.autoStart`) to avoid
|
|
399
|
+
* collisions.
|
|
400
|
+
*/
|
|
401
|
+
key: string;
|
|
402
|
+
/** Category heading the row is grouped under, e.g. `"Layout"`. */
|
|
403
|
+
section: string;
|
|
404
|
+
/** Sort order within the section (falls back to registration order). */
|
|
405
|
+
order?: number;
|
|
406
|
+
/** Row label. */
|
|
407
|
+
title?: string;
|
|
408
|
+
/** Secondary description text under the label. */
|
|
409
|
+
description?: string;
|
|
410
|
+
/** Excluded from persisted settings when `false`. Defaults to `true`. */
|
|
411
|
+
persist?: boolean;
|
|
412
|
+
/** Hide the row unless this returns true for the current values. */
|
|
413
|
+
when?: (values: SettingsValues) => boolean;
|
|
414
|
+
};
|
|
415
|
+
type SettingDescriptor = (SettingDescriptorBase & {
|
|
416
|
+
type: 'boolean';
|
|
417
|
+
default: boolean;
|
|
418
|
+
}) | (SettingDescriptorBase & {
|
|
419
|
+
type: 'number';
|
|
420
|
+
default: number;
|
|
421
|
+
min?: number;
|
|
422
|
+
max?: number;
|
|
423
|
+
step?: number;
|
|
424
|
+
}) | (SettingDescriptorBase & {
|
|
425
|
+
type: 'string';
|
|
426
|
+
default: string;
|
|
427
|
+
placeholder?: string;
|
|
428
|
+
}) | (SettingDescriptorBase & {
|
|
429
|
+
type: 'enum';
|
|
430
|
+
default: string;
|
|
431
|
+
options: SettingEnumOption[];
|
|
432
|
+
}) | (SettingDescriptorBase & {
|
|
433
|
+
type: 'custom';
|
|
434
|
+
default?: unknown;
|
|
435
|
+
render: FC<SettingControlProps>;
|
|
436
|
+
});
|
|
437
|
+
type SettingsSchemaStore = {
|
|
438
|
+
/** Registered descriptors, in registration order. */
|
|
439
|
+
settings: SettingDescriptor[];
|
|
440
|
+
/** Section names in first-seen order, for stable display grouping. */
|
|
441
|
+
sectionOrder: string[];
|
|
442
|
+
registerSetting: (descriptor: SettingDescriptor) => void;
|
|
443
|
+
registerSettings: (descriptors: SettingDescriptor[]) => void;
|
|
326
444
|
};
|
|
445
|
+
/**
|
|
446
|
+
* Built-in editor settings, mirroring the previously hand-coded panel. Keys
|
|
447
|
+
* match the value-store keys in {@link file://./settings.ts} exactly, so typed
|
|
448
|
+
* consumers (`settings.edgeType`, …) are unaffected.
|
|
449
|
+
*/
|
|
450
|
+
declare const DEFAULT_SETTINGS: SettingDescriptor[];
|
|
451
|
+
declare const settingsSchemaStoreFactory: (initial?: SettingDescriptor[]) => StoreApi$1<SettingsSchemaStore>;
|
|
327
452
|
//#endregion
|
|
328
453
|
//#region src/store/legend.d.ts
|
|
329
454
|
type LegendStore = {
|
|
@@ -357,17 +482,197 @@ type MenuBarStore = {
|
|
|
357
482
|
setSubMenuItems: (menuName: string, items: (IMenuItem | Seperator)[]) => void;
|
|
358
483
|
};
|
|
359
484
|
//#endregion
|
|
485
|
+
//#region src/store/layers.d.ts
|
|
486
|
+
type Layer = {
|
|
487
|
+
id: string;
|
|
488
|
+
name: string;
|
|
489
|
+
visible: boolean;
|
|
490
|
+
opacity: number;
|
|
491
|
+
};
|
|
492
|
+
type SerializedLayers = {
|
|
493
|
+
defaultLayerId: string;
|
|
494
|
+
layers: Layer[];
|
|
495
|
+
nodeLayers: Record<string, string>;
|
|
496
|
+
};
|
|
497
|
+
type LayerStore = {
|
|
498
|
+
defaultLayerId: string;
|
|
499
|
+
layers: Record<string, Layer>;
|
|
500
|
+
nodeLayers: Record<string, string>;
|
|
501
|
+
createLayer: (name: string) => string;
|
|
502
|
+
renameLayer: (layerId: string, name: string) => void;
|
|
503
|
+
setLayerVisibility: (layerId: string, visible: boolean) => void;
|
|
504
|
+
setLayerOpacity: (layerId: string, opacity: number) => void;
|
|
505
|
+
removeLayer: (layerId: string) => void;
|
|
506
|
+
setNodeLayer: (nodeId: string, layerId: string) => void;
|
|
507
|
+
clearNodeLayer: (nodeId: string) => void;
|
|
508
|
+
getNodeLayer: (nodeId: string) => Layer;
|
|
509
|
+
serialize: () => SerializedLayers;
|
|
510
|
+
deserialize: (serialized?: SerializedLayers) => void;
|
|
511
|
+
pruneNodeAssignments: (nodeIds: string[]) => void;
|
|
512
|
+
};
|
|
513
|
+
//#endregion
|
|
514
|
+
//#region src/types/graph.d.ts
|
|
515
|
+
type UIGraphData = Record<string, unknown> & {
|
|
516
|
+
layers?: SerializedLayers;
|
|
517
|
+
};
|
|
518
|
+
type UIGraphJSON = {
|
|
519
|
+
/**
|
|
520
|
+
* Version of the graph
|
|
521
|
+
*/
|
|
522
|
+
v: string;
|
|
523
|
+
name: string;
|
|
524
|
+
/**
|
|
525
|
+
* Graph annotations as metadata
|
|
526
|
+
*/
|
|
527
|
+
annotations: Record<string, unknown>;
|
|
528
|
+
/** User specific */
|
|
529
|
+
user?: {
|
|
530
|
+
viewport: {
|
|
531
|
+
x: number;
|
|
532
|
+
y: number;
|
|
533
|
+
zoom: number;
|
|
534
|
+
};
|
|
535
|
+
/**
|
|
536
|
+
* Saved viewports for multiple positions
|
|
537
|
+
*/
|
|
538
|
+
viewports?: {
|
|
539
|
+
x: number;
|
|
540
|
+
y: number;
|
|
541
|
+
zoom: number;
|
|
542
|
+
}[];
|
|
543
|
+
};
|
|
544
|
+
/**
|
|
545
|
+
* Arbitrary data associated with the graph.
|
|
546
|
+
* Expected to be used with plugins/extensions. This is seperate from graph annotations
|
|
547
|
+
*/
|
|
548
|
+
data: UIGraphData;
|
|
549
|
+
/**
|
|
550
|
+
* The serialized graph data.
|
|
551
|
+
* This is currently the embedded JSON format from behave-graph
|
|
552
|
+
*/
|
|
553
|
+
flow: GraphJSON;
|
|
554
|
+
nodes: Node$1[];
|
|
555
|
+
edges: Edge[];
|
|
556
|
+
};
|
|
557
|
+
//#endregion
|
|
558
|
+
//#region src/system/persistence.d.ts
|
|
559
|
+
/**
|
|
560
|
+
* Sinks invoked when the editor emits its save events. Each entry maps one
|
|
561
|
+
* editor-level pubsub topic to the side effect that persists it (write the JSON
|
|
562
|
+
* somewhere). Override any subset to redirect where saved data goes; sinks left
|
|
563
|
+
* unspecified keep the built-in file-download behaviour.
|
|
564
|
+
*
|
|
565
|
+
* Loading is not represented here: the menubar's "Load" items already read a
|
|
566
|
+
* file from disk and deserialize it into the focused graph by default, so there
|
|
567
|
+
* is nothing host-specific to wire for the common case.
|
|
568
|
+
*/
|
|
569
|
+
interface PersistenceAdapter {
|
|
570
|
+
/** Persist a full UI graph save (`graph:saved`). */
|
|
571
|
+
saveGraph: (graph: UIGraphJSON) => void;
|
|
572
|
+
/** Persist a raw inner behave-graph save (`graph:inner:saved`). */
|
|
573
|
+
saveInnerGraph: (graph: GraphJSON) => void;
|
|
574
|
+
/** Persist a dock layout save (`layout:saved`). */
|
|
575
|
+
saveLayout: (layout: LayoutBase) => void;
|
|
576
|
+
}
|
|
577
|
+
/**
|
|
578
|
+
* The built-in persistence: saving triggers a browser download of the
|
|
579
|
+
* corresponding JSON file. This is the default so a freshly constructed editor
|
|
580
|
+
* has working Save actions without any per-host or per-story wiring.
|
|
581
|
+
*/
|
|
582
|
+
declare const defaultPersistenceAdapter: PersistenceAdapter;
|
|
583
|
+
/**
|
|
584
|
+
* Subscribe the given (or default) persistence sinks to the editor's save
|
|
585
|
+
* topics. Any sink not provided falls back to {@link defaultPersistenceAdapter}.
|
|
586
|
+
* Returns a disposer that removes every subscription it added.
|
|
587
|
+
*/
|
|
588
|
+
declare function installPersistence(system: System, adapter?: Partial<PersistenceAdapter>): () => void;
|
|
589
|
+
//#endregion
|
|
360
590
|
//#region src/system/provider.d.ts
|
|
361
591
|
declare const SystemContext: React$1.Context<System | undefined>;
|
|
362
592
|
type SystemProviderProps = {
|
|
363
593
|
children: ReactNode;
|
|
364
594
|
value: System;
|
|
365
595
|
};
|
|
596
|
+
/**
|
|
597
|
+
* Provides the editor-level {@link System} to the React tree.
|
|
598
|
+
*/
|
|
366
599
|
declare function SystemProvider({
|
|
367
600
|
children,
|
|
368
601
|
value
|
|
369
602
|
}: SystemProviderProps): react_jsx_runtime0.JSX.Element;
|
|
603
|
+
/** Alias for {@link SystemProvider} expressing its editor-level role. */
|
|
604
|
+
declare const EditorProvider: typeof SystemProvider;
|
|
605
|
+
/**
|
|
606
|
+
* Access the editor-level {@link System}.
|
|
607
|
+
*/
|
|
370
608
|
declare function useSystem(): System;
|
|
609
|
+
/** Alias for {@link useSystem}. */
|
|
610
|
+
declare const useEditor: typeof useSystem;
|
|
611
|
+
type GraphProviderProps = {
|
|
612
|
+
children: ReactNode;
|
|
613
|
+
value: GraphSession;
|
|
614
|
+
};
|
|
615
|
+
/**
|
|
616
|
+
* Provides a single {@link GraphSession} to the subtree rendered inside a graph
|
|
617
|
+
* tab. Components within use {@link useGraph} to read per-graph state bound to
|
|
618
|
+
* their own tab, regardless of which tab is currently focused.
|
|
619
|
+
*/
|
|
620
|
+
declare function GraphProvider({
|
|
621
|
+
children,
|
|
622
|
+
value
|
|
623
|
+
}: GraphProviderProps): react_jsx_runtime0.JSX.Element;
|
|
624
|
+
/**
|
|
625
|
+
* Access the {@link GraphSession} of the surrounding graph tab.
|
|
626
|
+
*/
|
|
627
|
+
declare function useGraph(): GraphSession;
|
|
628
|
+
/**
|
|
629
|
+
* Access the currently focused {@link GraphSession}, or undefined when no graph
|
|
630
|
+
* is open. Subscribes to the editor's active-graph store, so panels rendered
|
|
631
|
+
* outside of a graph tab re-render when the focused graph changes.
|
|
632
|
+
*/
|
|
633
|
+
declare function useActiveGraph(): GraphSession | undefined;
|
|
634
|
+
//#endregion
|
|
635
|
+
//#region src/system/plugin.d.ts
|
|
636
|
+
/**
|
|
637
|
+
* Plugin initialization function type
|
|
638
|
+
* @template TOptions - Type of options object passed to the plugin
|
|
639
|
+
*/
|
|
640
|
+
interface Plugin<TOptions = void> {
|
|
641
|
+
(system: System, options: TOptions): void | Promise<void>;
|
|
642
|
+
}
|
|
643
|
+
/**
|
|
644
|
+
* Cleanup returned by a {@link SessionExtension}. Run when the session it was
|
|
645
|
+
* applied to is disposed (its tab closed).
|
|
646
|
+
*/
|
|
647
|
+
type SessionExtensionCleanup = () => void;
|
|
648
|
+
/**
|
|
649
|
+
* Extends a single {@link GraphSession}. Registered at the editor level via
|
|
650
|
+
* `system.registerSessionExtension(...)`, it runs against every graph , those
|
|
651
|
+
* already open at registration time and any created afterwards , so an editor
|
|
652
|
+
* plugin can attach per-graph state (extra stores, controllers, pubsub
|
|
653
|
+
* subscriptions) to each new graph instance.
|
|
654
|
+
*
|
|
655
|
+
* Return a cleanup to tear that per-graph state down when the session is
|
|
656
|
+
* disposed.
|
|
657
|
+
*
|
|
658
|
+
* @example
|
|
659
|
+
* system.registerSessionExtension((session) => {
|
|
660
|
+
* const controller = new MyController(session);
|
|
661
|
+
* session.decorate('myController', controller);
|
|
662
|
+
* return () => controller.dispose();
|
|
663
|
+
* });
|
|
664
|
+
*/
|
|
665
|
+
interface SessionExtension {
|
|
666
|
+
(session: GraphSession): void | SessionExtensionCleanup;
|
|
667
|
+
}
|
|
668
|
+
type PluginOpts = {
|
|
669
|
+
name: string;
|
|
670
|
+
};
|
|
671
|
+
type LoadablePlugin<TOptions = void> = {
|
|
672
|
+
loader: Plugin<TOptions>;
|
|
673
|
+
opts: PluginOpts;
|
|
674
|
+
};
|
|
675
|
+
declare const plugin: <TOptions = void>(registerfunc: Plugin<TOptions>, opts: PluginOpts) => LoadablePlugin<TOptions>;
|
|
371
676
|
//#endregion
|
|
372
677
|
//#region src/store/refs.d.ts
|
|
373
678
|
type Refs = {
|
|
@@ -404,21 +709,31 @@ type HotkeyStore = {
|
|
|
404
709
|
keymap: Record<string, string | string[]>;
|
|
405
710
|
handlers: Record<string, Handler>;
|
|
406
711
|
descriptions: Record<string, string>;
|
|
712
|
+
/** Reverse map: command id -> keymap action, so any UI surface that runs a
|
|
713
|
+
* command can look up its live shortcut without knowing the action name. */
|
|
714
|
+
commandToAction: Record<string, string>;
|
|
407
715
|
register(val: {
|
|
408
716
|
action: string;
|
|
409
717
|
trigger: string | string[];
|
|
410
718
|
description?: string;
|
|
411
719
|
handler?: Handler;
|
|
720
|
+
/** Command id this binding invokes; enables shortcut hints in menus. */
|
|
721
|
+
command?: string;
|
|
412
722
|
}): void;
|
|
413
723
|
registerDescription(action: string, description: string): void;
|
|
414
724
|
registerHandler(action: string, handler: Handler): void;
|
|
725
|
+
/**
|
|
726
|
+
* Formatted shortcut hint for a command id (e.g. `'Ctrl+Shift+←'`), derived
|
|
727
|
+
* live from the keymap, or undefined if the command has no bound key.
|
|
728
|
+
*/
|
|
729
|
+
getCommandKeybinding(commandId: string): string | undefined;
|
|
415
730
|
};
|
|
416
731
|
//#endregion
|
|
417
732
|
//#region src/system/pubsub.d.ts
|
|
418
733
|
interface TopicEvents {
|
|
419
734
|
[topic: string]: any;
|
|
420
735
|
}
|
|
421
|
-
type Subscriber<Events extends TopicEvents, K extends keyof Events> = (message: K, data: Events[K]) => void;
|
|
736
|
+
type Subscriber<Events extends TopicEvents, K$1 extends keyof Events> = (message: K$1, data: Events[K$1]) => void;
|
|
422
737
|
type AnySubscriber = (message: string, data: any) => void;
|
|
423
738
|
declare class PubSub<Events extends TopicEvents = TopicEvents> {
|
|
424
739
|
private messages;
|
|
@@ -433,12 +748,12 @@ declare class PubSub<Events extends TopicEvents = TopicEvents> {
|
|
|
433
748
|
private hasDirectSubscribersFor;
|
|
434
749
|
private messageHasSubscribers;
|
|
435
750
|
private internalPublish;
|
|
436
|
-
publishHook<K extends keyof Events & string>(message: K, data: Events[K]): boolean;
|
|
437
|
-
publish<K extends keyof Events & string>(message: K, data: Events[K]): boolean;
|
|
438
|
-
publishSync<K extends keyof Events & string>(message: K, data: Events[K]): boolean;
|
|
439
|
-
subscribe<K extends keyof Events & string>(message: K, func: Subscriber<Events, K>): string | false;
|
|
751
|
+
publishHook<K$1 extends keyof Events & string>(message: K$1, data: Events[K$1]): boolean;
|
|
752
|
+
publish<K$1 extends keyof Events & string>(message: K$1, data: Events[K$1]): boolean;
|
|
753
|
+
publishSync<K$1 extends keyof Events & string>(message: K$1, data: Events[K$1]): boolean;
|
|
754
|
+
subscribe<K$1 extends keyof Events & string>(message: K$1, func: Subscriber<Events, K$1>): string | false;
|
|
440
755
|
subscribeAll(func: AnySubscriber): string | false;
|
|
441
|
-
subscribeOnce<K extends keyof Events & string>(message: K, func: Subscriber<Events, K>): this;
|
|
756
|
+
subscribeOnce<K$1 extends keyof Events & string>(message: K$1, func: Subscriber<Events, K$1>): this;
|
|
442
757
|
clearAllSubscriptions(): void;
|
|
443
758
|
clearSubscriptions(topic: string): void;
|
|
444
759
|
countSubscriptions(topic: string): number;
|
|
@@ -447,34 +762,6 @@ declare class PubSub<Events extends TopicEvents = TopicEvents> {
|
|
|
447
762
|
unsubscribe(value: string | Function): boolean | string;
|
|
448
763
|
}
|
|
449
764
|
//#endregion
|
|
450
|
-
//#region src/store/flow.d.ts
|
|
451
|
-
type FlowStore = {
|
|
452
|
-
graphJson: GraphJSON | null;
|
|
453
|
-
setGraph: (graph: GraphJSON, options?: {
|
|
454
|
-
skipLayout?: boolean;
|
|
455
|
-
}) => void;
|
|
456
|
-
getGraph: () => GraphJSON;
|
|
457
|
-
nodeTypes: Record<string, React.ComponentType<NodeProps>>;
|
|
458
|
-
edgeTypes: Record<string, React.ComponentType<EdgeProps>>;
|
|
459
|
-
invalidateCache: () => void;
|
|
460
|
-
registerNodeType: (type: string, component: React.ComponentType<NodeProps>) => void;
|
|
461
|
-
registerEdgeType: (type: string, component: React.ComponentType<EdgeProps>) => void;
|
|
462
|
-
};
|
|
463
|
-
type NodeStore = {
|
|
464
|
-
nodes: Node$1[];
|
|
465
|
-
addNode: (node: Node$1) => void;
|
|
466
|
-
setNodes: (nodes: Node$1[] | ((existing: Node$1[]) => Node$1[])) => void;
|
|
467
|
-
clearNodes: () => void;
|
|
468
|
-
applyNodeChanges: (changes: NodeChange[]) => void;
|
|
469
|
-
};
|
|
470
|
-
type EdgeStore = {
|
|
471
|
-
edges: Edge[];
|
|
472
|
-
addEdge: (edge: Edge) => void;
|
|
473
|
-
setEdges: (edges: Edge[]) => void;
|
|
474
|
-
clearEdges: () => void;
|
|
475
|
-
applyEdgeChanges: (changes: EdgeChange[]) => void;
|
|
476
|
-
};
|
|
477
|
-
//#endregion
|
|
478
765
|
//#region src/store/controls.d.ts
|
|
479
766
|
interface ControlProps<T = any> {
|
|
480
767
|
value: T;
|
|
@@ -490,159 +777,12 @@ type ControlsStore = {
|
|
|
490
777
|
};
|
|
491
778
|
declare const controlsStoreFactory: () => zustand5.UseBoundStore<zustand5.StoreApi<ControlsStore>>;
|
|
492
779
|
//#endregion
|
|
493
|
-
//#region src/store/variables.d.ts
|
|
494
|
-
type GraphVariables = {
|
|
495
|
-
[key: string]: VariableJSON$1;
|
|
496
|
-
};
|
|
497
|
-
type VariableStore = {
|
|
498
|
-
variables: GraphVariables;
|
|
499
|
-
setVariable: (key: string, value: VariableJSON$1) => void;
|
|
500
|
-
setVariables: (variables: GraphVariables) => void;
|
|
501
|
-
removeVariable: (key: string) => void;
|
|
502
|
-
};
|
|
503
|
-
//#endregion
|
|
504
780
|
//#region src/store/selection.d.ts
|
|
505
781
|
type SelectionStore = {
|
|
506
782
|
selectedNodeId: string | null;
|
|
507
783
|
setSelectedNodeId: (nodeId: string | null) => void;
|
|
508
784
|
};
|
|
509
785
|
//#endregion
|
|
510
|
-
//#region src/store/layers.d.ts
|
|
511
|
-
type Layer = {
|
|
512
|
-
id: string;
|
|
513
|
-
name: string;
|
|
514
|
-
visible: boolean;
|
|
515
|
-
opacity: number;
|
|
516
|
-
};
|
|
517
|
-
type SerializedLayers = {
|
|
518
|
-
defaultLayerId: string;
|
|
519
|
-
layers: Layer[];
|
|
520
|
-
nodeLayers: Record<string, string>;
|
|
521
|
-
};
|
|
522
|
-
type LayerStore = {
|
|
523
|
-
defaultLayerId: string;
|
|
524
|
-
layers: Record<string, Layer>;
|
|
525
|
-
nodeLayers: Record<string, string>;
|
|
526
|
-
createLayer: (name: string) => string;
|
|
527
|
-
renameLayer: (layerId: string, name: string) => void;
|
|
528
|
-
setLayerVisibility: (layerId: string, visible: boolean) => void;
|
|
529
|
-
setLayerOpacity: (layerId: string, opacity: number) => void;
|
|
530
|
-
removeLayer: (layerId: string) => void;
|
|
531
|
-
setNodeLayer: (nodeId: string, layerId: string) => void;
|
|
532
|
-
clearNodeLayer: (nodeId: string) => void;
|
|
533
|
-
getNodeLayer: (nodeId: string) => Layer;
|
|
534
|
-
serialize: () => SerializedLayers;
|
|
535
|
-
deserialize: (serialized?: SerializedLayers) => void;
|
|
536
|
-
pruneNodeAssignments: (nodeIds: string[]) => void;
|
|
537
|
-
};
|
|
538
|
-
//#endregion
|
|
539
|
-
//#region src/types/graph.d.ts
|
|
540
|
-
type UIGraphData = Record<string, unknown> & {
|
|
541
|
-
layers?: SerializedLayers;
|
|
542
|
-
};
|
|
543
|
-
type UIGraphJSON = {
|
|
544
|
-
/**
|
|
545
|
-
* Version of the graph
|
|
546
|
-
*/
|
|
547
|
-
v: string;
|
|
548
|
-
name: string;
|
|
549
|
-
/**
|
|
550
|
-
* Graph annotations as metadata
|
|
551
|
-
*/
|
|
552
|
-
annotations: Record<string, unknown>;
|
|
553
|
-
/** User specific */
|
|
554
|
-
user?: {
|
|
555
|
-
viewport: {
|
|
556
|
-
x: number;
|
|
557
|
-
y: number;
|
|
558
|
-
zoom: number;
|
|
559
|
-
};
|
|
560
|
-
/**
|
|
561
|
-
* Saved viewports for multiple positions
|
|
562
|
-
*/
|
|
563
|
-
viewports?: {
|
|
564
|
-
x: number;
|
|
565
|
-
y: number;
|
|
566
|
-
zoom: number;
|
|
567
|
-
}[];
|
|
568
|
-
};
|
|
569
|
-
/**
|
|
570
|
-
* Arbitrary data associated with the graph.
|
|
571
|
-
* Expected to be used with plugins/extensions. This is seperate from graph annotations
|
|
572
|
-
*/
|
|
573
|
-
data: UIGraphData;
|
|
574
|
-
/**
|
|
575
|
-
* The serialized graph data.
|
|
576
|
-
* This is currently the embedded JSON format from behave-graph
|
|
577
|
-
*/
|
|
578
|
-
flow: GraphJSON;
|
|
579
|
-
nodes: Node$1[];
|
|
580
|
-
edges: Edge[];
|
|
581
|
-
};
|
|
582
|
-
//#endregion
|
|
583
|
-
//#region src/system/graph.d.ts
|
|
584
|
-
/**
|
|
585
|
-
* This is our internal graph representation that we use to perform transformations on
|
|
586
|
-
* It represents the general graph structure, not the underlying behavior graph instance
|
|
587
|
-
*/
|
|
588
|
-
declare class Graph {
|
|
589
|
-
readonly viewports: Viewport[];
|
|
590
|
-
private sys;
|
|
591
|
-
protected annotations: {
|
|
592
|
-
[key: string]: any;
|
|
593
|
-
};
|
|
594
|
-
constructor(system: System);
|
|
595
|
-
setViewport(index: number, viewport: Viewport): void;
|
|
596
|
-
/**
|
|
597
|
-
* Clears the graph
|
|
598
|
-
*/
|
|
599
|
-
clear(): void;
|
|
600
|
-
/**
|
|
601
|
-
* Return all edges that point into the nodes inputs.
|
|
602
|
-
* O(m) the amount of edges
|
|
603
|
-
*/
|
|
604
|
-
inEdges(nodeId: string, sourceHandle?: string): Edge[];
|
|
605
|
-
/**
|
|
606
|
-
* Return all edges that are pointed out by node v.
|
|
607
|
-
* O(m) the amount of edges
|
|
608
|
-
*/
|
|
609
|
-
outEdges(nodeId: string, targetHandle?: string): Edge[];
|
|
610
|
-
serialize(): UIGraphJSON;
|
|
611
|
-
getAnnotations(): {
|
|
612
|
-
[key: string]: any;
|
|
613
|
-
};
|
|
614
|
-
setAnnotations(annotations: {
|
|
615
|
-
[key: string]: any;
|
|
616
|
-
}): void;
|
|
617
|
-
deseralize(data: UIGraphJSON): void;
|
|
618
|
-
}
|
|
619
|
-
//#endregion
|
|
620
|
-
//#region src/store/actions.d.ts
|
|
621
|
-
/**
|
|
622
|
-
* Extend or modify this interface to add more actions as needed.
|
|
623
|
-
*/
|
|
624
|
-
interface Actions {
|
|
625
|
-
traceUpstream: (nodeId: string) => void;
|
|
626
|
-
traceDownstream: (nodeId: string) => void;
|
|
627
|
-
focusNode: (nodeId: string) => void;
|
|
628
|
-
resetTrace: () => void;
|
|
629
|
-
addBehaveNode: (nodeType: string, position: XYPosition) => void;
|
|
630
|
-
copySelectionToClipboard: () => void;
|
|
631
|
-
pasteFromClipboard: () => Promise<void>;
|
|
632
|
-
toggleNodeHidden: (nodeId: string) => void;
|
|
633
|
-
toggleNodePinned: (nodeId: string) => void;
|
|
634
|
-
groupNodes: () => void;
|
|
635
|
-
ungroupNodes: (groupId: string) => void;
|
|
636
|
-
deleteNodes: (nodeIds: string[]) => void;
|
|
637
|
-
updateGroupColor: (groupId: string, color: string) => void;
|
|
638
|
-
save: () => Promise<UIGraphJSON>;
|
|
639
|
-
}
|
|
640
|
-
type ActionStore = {
|
|
641
|
-
actions: Actions;
|
|
642
|
-
setAction: <K extends keyof Actions>(key: K, action: Actions[K]) => void;
|
|
643
|
-
getAction: <K extends keyof Actions>(key: K) => Actions[K] | undefined;
|
|
644
|
-
};
|
|
645
|
-
//#endregion
|
|
646
786
|
//#region src/types/NodeMetadata.d.ts
|
|
647
787
|
interface ValueTypeMetadata {
|
|
648
788
|
name: string;
|
|
@@ -680,35 +820,6 @@ type SpecsStore = {
|
|
|
680
820
|
setSpecs: (specs: NodeSpecJSON[]) => void;
|
|
681
821
|
};
|
|
682
822
|
//#endregion
|
|
683
|
-
//#region src/store/traces.d.ts
|
|
684
|
-
type TraceSpan = {
|
|
685
|
-
id: number;
|
|
686
|
-
nodeId: string;
|
|
687
|
-
name: string;
|
|
688
|
-
start: number;
|
|
689
|
-
end: number;
|
|
690
|
-
lane: number;
|
|
691
|
-
};
|
|
692
|
-
type SpanCollector = {
|
|
693
|
-
capacity: number;
|
|
694
|
-
spans: TraceSpan[];
|
|
695
|
-
writeIndex: number;
|
|
696
|
-
size: number;
|
|
697
|
-
nextId: number;
|
|
698
|
-
openByNodeId: Map<string, number[]>;
|
|
699
|
-
laneOpen: boolean[];
|
|
700
|
-
};
|
|
701
|
-
type TraceStore = {
|
|
702
|
-
version: number;
|
|
703
|
-
collector: SpanCollector;
|
|
704
|
-
clear: () => void;
|
|
705
|
-
connectEngine: (engine?: Engine) => void;
|
|
706
|
-
recordNodeStart: (node: INode, startTime?: number) => void;
|
|
707
|
-
recordNodeEnd: (node: INode, endTime?: number) => void;
|
|
708
|
-
addSpan: (span: Omit<TraceSpan, 'id'>) => void;
|
|
709
|
-
updateSpan: (nodeId: string, updates: Partial<TraceSpan>) => void;
|
|
710
|
-
};
|
|
711
|
-
//#endregion
|
|
712
823
|
//#region src/store/specific.d.ts
|
|
713
824
|
type SpecificNode = {
|
|
714
825
|
id: string;
|
|
@@ -755,21 +866,6 @@ type SocketGeneratorStore = {
|
|
|
755
866
|
};
|
|
756
867
|
declare const socketGeneratorStoreFactory: () => zustand5.UseBoundStore<zustand5.StoreApi<SocketGeneratorStore>>;
|
|
757
868
|
//#endregion
|
|
758
|
-
//#region src/store/events.d.ts
|
|
759
|
-
type ExtendedCustomEventJSON = CustomEventJSON & {
|
|
760
|
-
readonly?: boolean;
|
|
761
|
-
};
|
|
762
|
-
type EventsStore = {
|
|
763
|
-
customEvents: Record<string, ExtendedCustomEventJSON>;
|
|
764
|
-
setCustomEvents: (customEvents: Record<string, ExtendedCustomEventJSON>) => void;
|
|
765
|
-
getCustomEvents: () => ExtendedCustomEventJSON[];
|
|
766
|
-
addCustomEvent: (customEvent: ExtendedCustomEventJSON) => void;
|
|
767
|
-
removeCustomEvent: (id: string) => void;
|
|
768
|
-
addParameter: (eventId: string, parameter?: Partial<CustomEventParameterJSON>) => void;
|
|
769
|
-
updateParameter: (eventId: string, index: number, patch: Partial<CustomEventParameterJSON>) => void;
|
|
770
|
-
removeParameter: (eventId: string, index: number) => void;
|
|
771
|
-
};
|
|
772
|
-
//#endregion
|
|
773
869
|
//#region src/store/toolbar.d.ts
|
|
774
870
|
type ToolbarButtonGroup = {
|
|
775
871
|
id: string;
|
|
@@ -794,41 +890,601 @@ type ToolbarStore = {
|
|
|
794
890
|
};
|
|
795
891
|
declare const toolbarStoreFactory: () => zustand5.StoreApi<ToolbarStore>;
|
|
796
892
|
//#endregion
|
|
797
|
-
//#region src/
|
|
893
|
+
//#region src/store/conversions.d.ts
|
|
798
894
|
/**
|
|
799
|
-
*
|
|
800
|
-
*
|
|
895
|
+
* A user/plugin-defined automatic type conversion: "when connecting a `from`
|
|
896
|
+
* socket to a `to` socket, splice in `nodeType`". `inputKey`/`outputKey` name
|
|
897
|
+
* the converter's value sockets; when omitted they're resolved from the node
|
|
898
|
+
* spec (first non-flow input/output).
|
|
801
899
|
*/
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
900
|
+
type ConversionRule = {
|
|
901
|
+
from: string;
|
|
902
|
+
to: string;
|
|
903
|
+
nodeType: string;
|
|
904
|
+
inputKey?: string;
|
|
905
|
+
outputKey?: string;
|
|
807
906
|
};
|
|
808
|
-
type
|
|
809
|
-
|
|
810
|
-
|
|
907
|
+
type ConversionStore = {
|
|
908
|
+
conversions: ConversionRule[];
|
|
909
|
+
/** Add (or replace the existing rule for the same from→to pair). */
|
|
910
|
+
registerConversion: (rule: ConversionRule) => void;
|
|
911
|
+
removeConversion: (from: string, to: string) => void;
|
|
912
|
+
setConversions: (rules: ConversionRule[]) => void;
|
|
913
|
+
findConversion: (from: string, to: string) => ConversionRule | undefined;
|
|
811
914
|
};
|
|
812
|
-
declare const
|
|
915
|
+
declare const conversionStoreFactory: () => StoreApi<ConversionStore>;
|
|
813
916
|
//#endregion
|
|
814
|
-
//#region src/
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
917
|
+
//#region src/store/commands.d.ts
|
|
918
|
+
/**
|
|
919
|
+
* Context handed to a command when it runs. Carries the editor + the graph it
|
|
920
|
+
* acts on, plus optional targets so the same command works from a context menu,
|
|
921
|
+
* a hotkey, or a toolbar button.
|
|
922
|
+
*/
|
|
923
|
+
type CommandContext = {
|
|
924
|
+
editor: System;
|
|
925
|
+
session: GraphSession;
|
|
926
|
+
nodeId?: string;
|
|
927
|
+
edgeId?: string;
|
|
928
|
+
sourceId?: string;
|
|
929
|
+
targetId?: string;
|
|
930
|
+
position?: XYPosition;
|
|
931
|
+
};
|
|
932
|
+
/**
|
|
933
|
+
* A named, dispatchable action. Decouples *what* (id) from *how* (run), so UI
|
|
934
|
+
* surfaces (context menus, hotkeys, menubar, toolbar) reference commands by id
|
|
935
|
+
* instead of reaching into concrete stores.
|
|
936
|
+
*/
|
|
937
|
+
type Command = {
|
|
938
|
+
id: string;
|
|
939
|
+
title?: string;
|
|
940
|
+
/** When present and false, the command is treated as unavailable. */
|
|
941
|
+
isEnabled?: (ctx: CommandContext) => boolean;
|
|
942
|
+
run: (ctx: CommandContext) => void | Promise<void>;
|
|
943
|
+
};
|
|
944
|
+
type CommandStore = {
|
|
945
|
+
commands: Map<string, Command>;
|
|
946
|
+
/** Register (or replace) a command. Returns an unregister disposer. */
|
|
947
|
+
register: (command: Command) => () => void;
|
|
948
|
+
unregister: (id: string) => void;
|
|
949
|
+
get: (id: string) => Command | undefined;
|
|
950
|
+
list: () => Command[];
|
|
951
|
+
/** Run a command by id; no-ops (with a warning) if unknown or disabled. */
|
|
952
|
+
run: (id: string, ctx: CommandContext) => void | Promise<void>;
|
|
953
|
+
};
|
|
954
|
+
declare const commandStoreFactory: () => StoreApi<CommandStore>;
|
|
955
|
+
/**
|
|
956
|
+
* Register the built-in editor commands. Hosts may override any of them by
|
|
957
|
+
* re-registering with the same id, or add their own.
|
|
958
|
+
*/
|
|
959
|
+
declare const registerDefaultCommands: (store: StoreApi<CommandStore>) => void;
|
|
960
|
+
//#endregion
|
|
961
|
+
//#region src/store/contextMenu.d.ts
|
|
962
|
+
/** Which canvas target a context-menu item applies to. */
|
|
963
|
+
type ContextMenuTarget = 'node' | 'edge' | 'selection' | 'pane';
|
|
964
|
+
/**
|
|
965
|
+
* A registrable context-menu entry. Items dispatch either a registered command
|
|
966
|
+
* (`commandId`) or an inline `onSelect`. `group` controls separator placement;
|
|
967
|
+
* `order` controls position within a target. `when` hides the item dynamically.
|
|
968
|
+
*/
|
|
969
|
+
type ContextMenuItem = {
|
|
970
|
+
id: string;
|
|
971
|
+
target: ContextMenuTarget;
|
|
972
|
+
/** Static text, or a function for state-dependent labels (e.g. Pin/Unpin). */
|
|
973
|
+
label: string | ((ctx: CommandContext) => string);
|
|
974
|
+
keybinding?: string;
|
|
975
|
+
/** Ascending sort within the target. */
|
|
976
|
+
order?: number;
|
|
977
|
+
/** Items with different adjacent groups get a separator between them. */
|
|
978
|
+
group?: string | number;
|
|
979
|
+
when?: (ctx: CommandContext) => boolean;
|
|
980
|
+
/** Dispatch a registered command by id. */
|
|
981
|
+
commandId?: string;
|
|
982
|
+
/** Or run inline (takes precedence over commandId). */
|
|
983
|
+
onSelect?: (ctx: CommandContext) => void;
|
|
984
|
+
};
|
|
985
|
+
type ContextMenuStore = {
|
|
986
|
+
items: ContextMenuItem[];
|
|
987
|
+
/** Register (or replace by id) an item. Returns an unregister disposer. */
|
|
988
|
+
register: (item: ContextMenuItem) => () => void;
|
|
989
|
+
unregister: (id: string) => void;
|
|
990
|
+
/** Items for a target, sorted by `order`. Filtering by `when` is the caller's. */
|
|
991
|
+
getItems: (target: ContextMenuTarget) => ContextMenuItem[];
|
|
992
|
+
};
|
|
993
|
+
declare const contextMenuStoreFactory: () => StoreApi<ContextMenuStore>;
|
|
994
|
+
/**
|
|
995
|
+
* Register the built-in context-menu items, dispatching the default commands.
|
|
996
|
+
* Hosts can add/remove/replace items by id without forking the menu components.
|
|
997
|
+
*/
|
|
998
|
+
declare const registerDefaultContextMenu: (store: StoreApi<ContextMenuStore>) => void;
|
|
999
|
+
//#endregion
|
|
1000
|
+
//#region src/store/flow.d.ts
|
|
1001
|
+
type FlowStore = {
|
|
1002
|
+
graphJson: GraphJSON | null;
|
|
1003
|
+
setGraph: (graph: GraphJSON, options?: {
|
|
1004
|
+
skipLayout?: boolean;
|
|
1005
|
+
}) => void;
|
|
1006
|
+
getGraph: () => GraphJSON;
|
|
1007
|
+
nodeTypes: Record<string, React.ComponentType<NodeProps>>;
|
|
1008
|
+
edgeTypes: Record<string, React.ComponentType<EdgeProps>>;
|
|
1009
|
+
invalidateCache: () => void;
|
|
1010
|
+
registerNodeType: (type: string, component: React.ComponentType<NodeProps>) => void;
|
|
1011
|
+
registerEdgeType: (type: string, component: React.ComponentType<EdgeProps>) => void;
|
|
1012
|
+
};
|
|
1013
|
+
type NodeStore = {
|
|
1014
|
+
nodes: Node$1[];
|
|
1015
|
+
addNode: (node: Node$1) => void;
|
|
1016
|
+
setNodes: (nodes: Node$1[] | ((existing: Node$1[]) => Node$1[])) => void;
|
|
1017
|
+
clearNodes: () => void;
|
|
1018
|
+
applyNodeChanges: (changes: NodeChange[]) => void;
|
|
1019
|
+
};
|
|
1020
|
+
type EdgeStore = {
|
|
1021
|
+
edges: Edge[];
|
|
1022
|
+
addEdge: (edge: Edge) => void;
|
|
1023
|
+
setEdges: (edges: Edge[]) => void;
|
|
1024
|
+
clearEdges: () => void;
|
|
1025
|
+
applyEdgeChanges: (changes: EdgeChange[]) => void;
|
|
1026
|
+
};
|
|
1027
|
+
//#endregion
|
|
1028
|
+
//#region src/store/variables.d.ts
|
|
1029
|
+
type GraphVariables = {
|
|
1030
|
+
[key: string]: VariableJSON$1;
|
|
1031
|
+
};
|
|
1032
|
+
type VariableStore = {
|
|
1033
|
+
variables: GraphVariables;
|
|
1034
|
+
setVariable: (key: string, value: VariableJSON$1) => void;
|
|
1035
|
+
setVariables: (variables: GraphVariables) => void;
|
|
1036
|
+
removeVariable: (key: string) => void;
|
|
1037
|
+
};
|
|
1038
|
+
//#endregion
|
|
1039
|
+
//#region src/store/actions.d.ts
|
|
1040
|
+
/**
|
|
1041
|
+
* Extend or modify this interface to add more actions as needed.
|
|
1042
|
+
*/
|
|
1043
|
+
interface Actions {
|
|
1044
|
+
traceUpstream: (nodeId: string) => void;
|
|
1045
|
+
traceDownstream: (nodeId: string) => void;
|
|
1046
|
+
focusNode: (nodeId: string) => void;
|
|
1047
|
+
resetTrace: () => void;
|
|
1048
|
+
addBehaveNode: (nodeType: string, position: XYPosition) => void;
|
|
1049
|
+
copySelectionToClipboard: () => void;
|
|
1050
|
+
pasteFromClipboard: () => Promise<void>;
|
|
1051
|
+
toggleNodeHidden: (nodeId: string) => void;
|
|
1052
|
+
toggleNodePinned: (nodeId: string) => void;
|
|
1053
|
+
groupNodes: () => void;
|
|
1054
|
+
ungroupNodes: (groupId: string) => void;
|
|
1055
|
+
deleteNodes: (nodeIds: string[]) => void;
|
|
1056
|
+
updateGroupColor: (groupId: string, color: string) => void;
|
|
1057
|
+
save: () => Promise<UIGraphJSON>;
|
|
1058
|
+
}
|
|
1059
|
+
type ActionStore = {
|
|
1060
|
+
actions: Actions;
|
|
1061
|
+
setAction: <K$1 extends keyof Actions>(key: K$1, action: Actions[K$1]) => void;
|
|
1062
|
+
getAction: <K$1 extends keyof Actions>(key: K$1) => Actions[K$1] | undefined;
|
|
1063
|
+
};
|
|
1064
|
+
//#endregion
|
|
1065
|
+
//#region src/store/traces.d.ts
|
|
1066
|
+
type TraceSpan = {
|
|
1067
|
+
id: number;
|
|
1068
|
+
nodeId: string;
|
|
1069
|
+
name: string;
|
|
1070
|
+
start: number;
|
|
1071
|
+
end: number;
|
|
1072
|
+
lane: number;
|
|
1073
|
+
};
|
|
1074
|
+
type SpanCollector = {
|
|
1075
|
+
capacity: number;
|
|
1076
|
+
spans: TraceSpan[];
|
|
1077
|
+
writeIndex: number;
|
|
1078
|
+
size: number;
|
|
1079
|
+
nextId: number;
|
|
1080
|
+
openByNodeId: Map<string, number[]>;
|
|
1081
|
+
laneOpen: boolean[];
|
|
1082
|
+
};
|
|
1083
|
+
type TraceStore = {
|
|
1084
|
+
version: number;
|
|
1085
|
+
collector: SpanCollector;
|
|
1086
|
+
clear: () => void;
|
|
1087
|
+
connectEngine: (engine?: Engine) => void;
|
|
1088
|
+
recordNodeStart: (node: INode, startTime?: number) => void;
|
|
1089
|
+
recordNodeEnd: (node: INode, endTime?: number) => void;
|
|
1090
|
+
addSpan: (span: Omit<TraceSpan, 'id' | 'lane'> & {
|
|
1091
|
+
lane?: number;
|
|
1092
|
+
}) => void;
|
|
1093
|
+
updateSpan: (nodeId: string, updates: Partial<TraceSpan>) => void;
|
|
1094
|
+
};
|
|
1095
|
+
//#endregion
|
|
1096
|
+
//#region src/store/events.d.ts
|
|
1097
|
+
type ExtendedCustomEventJSON = CustomEventJSON & {
|
|
1098
|
+
readonly?: boolean;
|
|
1099
|
+
};
|
|
1100
|
+
type EventsStore = {
|
|
1101
|
+
customEvents: Record<string, ExtendedCustomEventJSON>;
|
|
1102
|
+
setCustomEvents: (customEvents: Record<string, ExtendedCustomEventJSON>) => void;
|
|
1103
|
+
getCustomEvents: () => ExtendedCustomEventJSON[];
|
|
1104
|
+
addCustomEvent: (customEvent: ExtendedCustomEventJSON) => void;
|
|
1105
|
+
removeCustomEvent: (id: string) => void;
|
|
1106
|
+
addParameter: (eventId: string, parameter?: Partial<CustomEventParameterJSON>) => void;
|
|
1107
|
+
updateParameter: (eventId: string, index: number, patch: Partial<CustomEventParameterJSON>) => void;
|
|
1108
|
+
removeParameter: (eventId: string, index: number) => void;
|
|
1109
|
+
};
|
|
1110
|
+
//#endregion
|
|
1111
|
+
//#region src/store/logs.d.ts
|
|
1112
|
+
interface ILogMessage {
|
|
1113
|
+
message: string;
|
|
1114
|
+
}
|
|
1115
|
+
interface ILog {
|
|
1116
|
+
data: ILogMessage;
|
|
1117
|
+
time: Date;
|
|
1118
|
+
type: LogSeverity;
|
|
1119
|
+
}
|
|
1120
|
+
type LogStore = {
|
|
1121
|
+
logs: ILog[];
|
|
1122
|
+
append: (log: ILog) => void;
|
|
1123
|
+
clear: () => void;
|
|
1124
|
+
};
|
|
1125
|
+
//#endregion
|
|
1126
|
+
//#region src/system/undoRedo.d.ts
|
|
1127
|
+
interface Command$1 {
|
|
1128
|
+
name: string;
|
|
1129
|
+
execute(): void;
|
|
1130
|
+
undo(): void;
|
|
1131
|
+
/**
|
|
1132
|
+
* Optional redo method if different from execute
|
|
1133
|
+
*/
|
|
1134
|
+
redo?(): void;
|
|
1135
|
+
}
|
|
1136
|
+
type UndoStackEntry = {
|
|
1137
|
+
name: string;
|
|
1138
|
+
};
|
|
1139
|
+
type UndoStore = {
|
|
1140
|
+
canUndo: boolean;
|
|
1141
|
+
canRedo: boolean;
|
|
1142
|
+
history: UndoStackEntry[];
|
|
1143
|
+
redoStack: UndoStackEntry[];
|
|
1144
|
+
setSnapshot: (snapshot: {
|
|
1145
|
+
canUndo: boolean;
|
|
1146
|
+
canRedo: boolean;
|
|
1147
|
+
history: UndoStackEntry[];
|
|
1148
|
+
redoStack: UndoStackEntry[];
|
|
1149
|
+
}) => void;
|
|
1150
|
+
};
|
|
1151
|
+
declare class UndoManager {
|
|
1152
|
+
private history;
|
|
1153
|
+
private stack;
|
|
1154
|
+
private limit;
|
|
1155
|
+
store: zustand5.UseBoundStore<zustand5.StoreApi<UndoStore>>;
|
|
1156
|
+
constructor();
|
|
1157
|
+
private syncStore;
|
|
1158
|
+
execute(command: Command$1): void;
|
|
1159
|
+
undo(): void;
|
|
1160
|
+
redo(): void;
|
|
1161
|
+
canUndo(): boolean;
|
|
1162
|
+
canRedo(): boolean;
|
|
1163
|
+
clear(): void;
|
|
1164
|
+
}
|
|
1165
|
+
//#endregion
|
|
1166
|
+
//#region src/system/graph.d.ts
|
|
1167
|
+
/**
|
|
1168
|
+
* This is our internal graph representation that we use to perform transformations on
|
|
1169
|
+
* It represents the general graph structure, not the underlying behavior graph instance
|
|
1170
|
+
*/
|
|
1171
|
+
declare class Graph {
|
|
1172
|
+
readonly viewports: Viewport[];
|
|
1173
|
+
private sys;
|
|
1174
|
+
constructor(session: GraphSession);
|
|
1175
|
+
setViewport(index: number, viewport: Viewport): void;
|
|
1176
|
+
/**
|
|
1177
|
+
* Clears the graph
|
|
1178
|
+
*/
|
|
1179
|
+
clear(): void;
|
|
1180
|
+
/**
|
|
1181
|
+
* Return all edges that point into the nodes inputs.
|
|
1182
|
+
* O(m) the amount of edges
|
|
1183
|
+
*/
|
|
1184
|
+
inEdges(nodeId: string, sourceHandle?: string): Edge[];
|
|
1185
|
+
/**
|
|
1186
|
+
* Return all edges that are pointed out by node v.
|
|
1187
|
+
* O(m) the amount of edges
|
|
1188
|
+
*/
|
|
1189
|
+
outEdges(nodeId: string, targetHandle?: string): Edge[];
|
|
1190
|
+
serialize(): UIGraphJSON;
|
|
1191
|
+
getAnnotations(): {
|
|
1192
|
+
[x: string]: any;
|
|
1193
|
+
};
|
|
1194
|
+
setAnnotations(annotations: {
|
|
1195
|
+
[key: string]: any;
|
|
1196
|
+
}): void;
|
|
1197
|
+
deseralize(data: UIGraphJSON): void;
|
|
1198
|
+
}
|
|
1199
|
+
//#endregion
|
|
1200
|
+
//#region src/system/system.d.ts
|
|
1201
|
+
/**
|
|
1202
|
+
* Editor-level pubsub topics. These are global to the editor and shared across
|
|
1203
|
+
* every open graph. Augment this interface (not {@link GraphPubSys}) for events
|
|
1204
|
+
* that are not tied to a specific graph.
|
|
1205
|
+
*/
|
|
1206
|
+
interface EditorPubSys {
|
|
1207
|
+
notification: NotificationData;
|
|
1208
|
+
'notification:dismiss': {
|
|
1209
|
+
toastId?: string;
|
|
1210
|
+
};
|
|
1211
|
+
'layout:saved': LayoutBase;
|
|
1212
|
+
'graph:saved': UIGraphJSON;
|
|
1213
|
+
'graph:inner:saved': GraphJSON;
|
|
1214
|
+
}
|
|
1215
|
+
/**
|
|
1216
|
+
* Per-graph pubsub topics. Each {@link GraphSession} owns its own bus typed with
|
|
1217
|
+
* this interface, so events stay isolated to the graph that produced them.
|
|
1218
|
+
* Augment this interface for events that belong to a single graph.
|
|
1219
|
+
*/
|
|
1220
|
+
interface GraphPubSys {
|
|
1221
|
+
'edge:added': Edge;
|
|
1222
|
+
'node:added': Node$1;
|
|
1223
|
+
'edge:removed': Edge;
|
|
1224
|
+
'node:removed': Node$1;
|
|
1225
|
+
graphAnnotationsChanged: {
|
|
1226
|
+
[key: string]: any;
|
|
1227
|
+
};
|
|
1228
|
+
saveViewport: {
|
|
1229
|
+
index: number;
|
|
1230
|
+
viewport: Viewport;
|
|
1231
|
+
};
|
|
1232
|
+
}
|
|
1233
|
+
/**
|
|
1234
|
+
* Combined pubsub surface kept for backwards compatibility. Prefer the split
|
|
1235
|
+
* {@link EditorPubSys} / {@link GraphPubSys} interfaces.
|
|
1236
|
+
*/
|
|
1237
|
+
interface PubSys extends EditorPubSys, GraphPubSys {}
|
|
1238
|
+
/**
|
|
1239
|
+
* Use this to extend the System interface when adding plugins
|
|
1240
|
+
*/
|
|
1241
|
+
interface ISystem {}
|
|
1242
|
+
/** Minimal storage adapter for persisting editor settings. */
|
|
1243
|
+
type SettingsStorage = {
|
|
1244
|
+
getItem: (key: string) => string | null;
|
|
1245
|
+
setItem: (key: string, value: string) => void;
|
|
1246
|
+
};
|
|
1247
|
+
/** Serialized editor-level settings (UI toggles + custom type conversions). */
|
|
1248
|
+
type EditorSettingsJSON = {
|
|
1249
|
+
settings?: Record<string, any>;
|
|
1250
|
+
conversions?: ConversionRule[];
|
|
1251
|
+
};
|
|
1252
|
+
/**
|
|
1253
|
+
* Observable registry of open graph sessions plus the currently focused one.
|
|
1254
|
+
* Backed by a zustand store so panels rendered outside of a graph tab can
|
|
1255
|
+
* subscribe and re-render when the active graph changes.
|
|
1256
|
+
*/
|
|
1257
|
+
type ActiveGraphStore = {
|
|
1258
|
+
activeGraphId: string | null;
|
|
1259
|
+
sessions: Record<string, GraphSession>;
|
|
1260
|
+
setActiveGraph: (id: string | null) => void;
|
|
1261
|
+
addSession: (session: GraphSession) => void;
|
|
1262
|
+
removeSession: (id: string) => void;
|
|
1263
|
+
getActive: () => GraphSession | undefined;
|
|
1264
|
+
};
|
|
1265
|
+
/**
|
|
1266
|
+
* The editor-level system. Holds state that is shared across every open graph
|
|
1267
|
+
* (settings, registry, specs, menubar, tabs, ...) plus an observable registry of
|
|
1268
|
+
* per-graph {@link GraphSession} instances. Per-graph state itself lives on the
|
|
1269
|
+
* sessions, not here.
|
|
1270
|
+
*
|
|
1271
|
+
* The class is intentionally still named `System` so existing `declare module`
|
|
1272
|
+
* augmentations (`interface System { ... }`) keep merging and the public API is
|
|
1273
|
+
* stable; `EditorSystem` is exported as an alias for new code.
|
|
1274
|
+
*/
|
|
1275
|
+
declare class System implements ISystem {
|
|
1276
|
+
readonly pubsub: PubSub<EditorPubSys>;
|
|
1277
|
+
readonly tabStore: StoreApi<TabStore>;
|
|
1278
|
+
readonly tabLoader: TabLoader;
|
|
1279
|
+
readonly systemSettings: StoreApi<SystemSettingsStore>;
|
|
1280
|
+
/** Registry of setting descriptors driving the auto-generated Settings panel. */
|
|
1281
|
+
readonly settingsSchema: StoreApi<SettingsSchemaStore>;
|
|
1282
|
+
readonly legendStore: StoreApi<LegendStore>;
|
|
1283
|
+
readonly menubarStore: StoreApi<MenuBarStore>;
|
|
1284
|
+
readonly hotKeyStore: StoreApi<HotkeyStore>;
|
|
1285
|
+
readonly registry: StoreApi<RegistryStore>;
|
|
1286
|
+
readonly specStore: StoreApi<SpecsStore>;
|
|
1287
|
+
readonly specificStore: StoreApi<SpecificStore>;
|
|
1288
|
+
readonly socketGeneratorStore: StoreApi<SocketGeneratorStore>;
|
|
1289
|
+
readonly documentationStore: StoreApi<DocumentationStore>;
|
|
1290
|
+
readonly toolbarStore: StoreApi<ToolbarStore>;
|
|
1291
|
+
readonly controlStore: StoreApi<ControlsStore>;
|
|
1292
|
+
/** User/plugin-defined automatic type conversions for auto-convert. */
|
|
1293
|
+
readonly conversionStore: StoreApi<ConversionStore>;
|
|
1294
|
+
/** Named, dispatchable commands shared across hotkeys/menus/toolbar. */
|
|
1295
|
+
readonly commandStore: StoreApi<CommandStore>;
|
|
1296
|
+
/** Per-target context-menu item registry (node/edge/selection/pane). */
|
|
1297
|
+
readonly contextMenuStore: StoreApi<ContextMenuStore>;
|
|
1298
|
+
readonly notifications: Notifications;
|
|
1299
|
+
/** Observable registry of open graph sessions + the focused one. */
|
|
1300
|
+
readonly activeGraph: StoreApi<ActiveGraphStore>;
|
|
1301
|
+
/** Editor-level extensions applied to every graph session on creation. */
|
|
1302
|
+
private readonly sessionExtensions;
|
|
1303
|
+
/** Disposer for the currently installed graph/layout save handlers. */
|
|
1304
|
+
private persistenceDisposer;
|
|
1305
|
+
protected deps: Record<string, unknown>;
|
|
1306
|
+
/**
|
|
1307
|
+
* Create a new editor System instance
|
|
1308
|
+
* @param registry - INodeRegistry containing nodes and values metadata
|
|
1309
|
+
*/
|
|
1310
|
+
constructor(registry?: INodeRegistry);
|
|
1311
|
+
/**
|
|
1312
|
+
* The currently focused graph session, if any.
|
|
1313
|
+
*/
|
|
1314
|
+
get session(): GraphSession | undefined;
|
|
1315
|
+
/**
|
|
1316
|
+
* Create a new graph session, register it and (by default) make it active.
|
|
1317
|
+
*/
|
|
1318
|
+
createSession(id?: string, options?: {
|
|
1319
|
+
activate?: boolean;
|
|
1320
|
+
name?: string;
|
|
1321
|
+
}): GraphSession;
|
|
1322
|
+
/**
|
|
1323
|
+
* Look up an existing session by id, creating an empty one if missing.
|
|
1324
|
+
*/
|
|
1325
|
+
getOrCreateSession(id: string): GraphSession;
|
|
1326
|
+
/**
|
|
1327
|
+
* Create a brand new, empty graph in its own tab and focus it.
|
|
1328
|
+
*/
|
|
1329
|
+
newGraph(name?: string): GraphSession;
|
|
1330
|
+
/**
|
|
1331
|
+
* Dispose a graph session and remove it from the registry. Called when its
|
|
1332
|
+
* tab is closed.
|
|
1333
|
+
*/
|
|
1334
|
+
disposeSession(id: string): void;
|
|
1335
|
+
get flowStore(): StoreApi<FlowStore>;
|
|
1336
|
+
get nodeStore(): StoreApi<NodeStore>;
|
|
1337
|
+
get edgeStore(): StoreApi<EdgeStore>;
|
|
1338
|
+
get variableStore(): StoreApi<VariableStore>;
|
|
1339
|
+
get selectionStore(): StoreApi<SelectionStore>;
|
|
1340
|
+
get refStore(): StoreApi<RefStore>;
|
|
1341
|
+
get actionStore(): StoreApi<ActionStore>;
|
|
1342
|
+
get traceStore(): StoreApi<TraceStore>;
|
|
1343
|
+
get eventsStore(): StoreApi<EventsStore>;
|
|
1344
|
+
get logsStore(): StoreApi<LogStore>;
|
|
1345
|
+
get layerStore(): StoreApi<LayerStore>;
|
|
1346
|
+
get graph(): Graph;
|
|
1347
|
+
get undoManager(): UndoManager;
|
|
1348
|
+
/**
|
|
1349
|
+
* Adds a new dependency to the system
|
|
1350
|
+
* @param name
|
|
1351
|
+
* @param val
|
|
1352
|
+
*/
|
|
1353
|
+
decorate(name: keyof System, val: any): void;
|
|
1354
|
+
/**
|
|
1355
|
+
* Load a plugin into the system
|
|
1356
|
+
* @param pluginInit - Plugin initialization function
|
|
1357
|
+
* @param options - Optional configuration options for the plugin
|
|
1358
|
+
* @template TOptions - Type of options object
|
|
1359
|
+
*
|
|
1360
|
+
* @example
|
|
1361
|
+
* // Plugin without options
|
|
1362
|
+
* system.registerPlugin(docsPlugin);
|
|
1363
|
+
*
|
|
1364
|
+
* @example
|
|
1365
|
+
* // Plugin with typed options
|
|
1366
|
+
* interface MyPluginOptions {
|
|
1367
|
+
* enabled: boolean;
|
|
1368
|
+
* apiKey: string;
|
|
1369
|
+
* }
|
|
1370
|
+
*
|
|
1371
|
+
* const myPlugin: Plugin<MyPluginOptions> = (system, options) => {
|
|
1372
|
+
* console.log('Plugin enabled:', options.enabled);
|
|
1373
|
+
* };
|
|
1374
|
+
*
|
|
1375
|
+
* system.registerPlugin(myPlugin, { enabled: true, apiKey: 'secret' });
|
|
1376
|
+
*/
|
|
1377
|
+
registerPlugin<TOptions = void>(plugin: LoadablePlugin<TOptions>, options?: TOptions): Promise<void>;
|
|
1378
|
+
/**
|
|
1379
|
+
* Register an extension applied to every {@link GraphSession}. It runs against
|
|
1380
|
+
* each graph already open at registration time and against every graph created
|
|
1381
|
+
* afterwards (via {@link createSession}), so a plugin can attach per-graph
|
|
1382
|
+
* state to new graph instances from a single editor-level registration.
|
|
1383
|
+
*
|
|
1384
|
+
* If the extension returns a cleanup it is wired to the session's
|
|
1385
|
+
* {@link GraphSession.onDispose} and runs when that graph's tab is closed.
|
|
1386
|
+
*
|
|
1387
|
+
* @returns an unregister function that stops the extension from applying to
|
|
1388
|
+
* sessions created later. It does not retroactively tear down sessions already
|
|
1389
|
+
* extended (those clean up on their own dispose).
|
|
1390
|
+
*/
|
|
1391
|
+
registerSessionExtension(extension: SessionExtension): () => void;
|
|
1392
|
+
/** Run a single session extension, wiring any returned cleanup to dispose. */
|
|
1393
|
+
private applySessionExtension;
|
|
1394
|
+
/**
|
|
1395
|
+
* Register a custom automatic type conversion (e.g. from a profile plugin) so
|
|
1396
|
+
* auto-convert can splice in the given node for that type pair.
|
|
1397
|
+
*/
|
|
1398
|
+
registerConversion(rule: ConversionRule): void;
|
|
1399
|
+
/**
|
|
1400
|
+
* Contribute a setting to the schema-driven Settings panel. The panel
|
|
1401
|
+
* auto-generates a row for it (grouped under `descriptor.section`), and its
|
|
1402
|
+
* default value is seeded into the settings store if not already present.
|
|
1403
|
+
* Built-in settings are registered the same way at construction.
|
|
1404
|
+
*
|
|
1405
|
+
* @example
|
|
1406
|
+
* system.registerSetting({
|
|
1407
|
+
* key: 'graphRunner.autoStart', section: 'Graph Runner', type: 'boolean',
|
|
1408
|
+
* default: false, title: 'Auto-start runner'
|
|
1409
|
+
* });
|
|
1410
|
+
*/
|
|
1411
|
+
registerSetting(descriptor: SettingDescriptor): void;
|
|
1412
|
+
/** Contribute several settings at once. */
|
|
1413
|
+
registerSettings(descriptors: SettingDescriptor[]): void;
|
|
1414
|
+
/** Read a setting value by key (built-in or plugin-contributed). */
|
|
1415
|
+
getSetting<T = unknown>(key: string): T;
|
|
1416
|
+
/** Set a setting value by key. Persists if the descriptor allows it. */
|
|
1417
|
+
setSetting(key: string, value: unknown): void;
|
|
1418
|
+
/**
|
|
1419
|
+
* Dispatch a registered command against the focused graph (or a supplied
|
|
1420
|
+
* session). Convenience used by hotkeys, the menubar and the toolbar so they
|
|
1421
|
+
* share one dispatch path. No-ops if there is no graph to act on.
|
|
1422
|
+
*/
|
|
1423
|
+
runCommand(id: string, ctx?: Partial<CommandContext>): void | Promise<void>;
|
|
1424
|
+
/**
|
|
1425
|
+
* Override where the editor's Save actions send their data. The editor
|
|
1426
|
+
* publishes `graph:saved`, `graph:inner:saved` and `layout:saved`; by default
|
|
1427
|
+
* each triggers a JSON file download. Pass an adapter to redirect any subset
|
|
1428
|
+
* of those to your own sink (write to disk, POST to a backend, ...); topics
|
|
1429
|
+
* you omit keep the file-download default. Replaces any previously installed
|
|
1430
|
+
* handlers and returns a disposer.
|
|
1431
|
+
*
|
|
1432
|
+
* This governs graph/layout saving only; editor *settings* persistence is
|
|
1433
|
+
* separate , see {@link enableSettingsPersistence}.
|
|
1434
|
+
*
|
|
1435
|
+
* @example
|
|
1436
|
+
* // Persist graphs to a backend, keep the default layout download.
|
|
1437
|
+
* system.enablePersistence({
|
|
1438
|
+
* saveGraph: (graph) => api.put('/graphs/current', graph)
|
|
1439
|
+
* });
|
|
1440
|
+
*/
|
|
1441
|
+
enablePersistence(adapter?: Partial<PersistenceAdapter>): () => void;
|
|
1442
|
+
/**
|
|
1443
|
+
* Remove the default (or custom) graph/layout save handlers entirely. Use this
|
|
1444
|
+
* when the host handles saving through a channel of its own and the built-in
|
|
1445
|
+
* file download would be redundant (e.g. the VS Code extension).
|
|
1446
|
+
*/
|
|
1447
|
+
disablePersistence(): void;
|
|
1448
|
+
/**
|
|
1449
|
+
* Serialize the persistable editor settings , the UI toggles plus any custom
|
|
1450
|
+
* type conversions , to a plain JSON object.
|
|
1451
|
+
*/
|
|
1452
|
+
serializeSettings(): EditorSettingsJSON;
|
|
1453
|
+
/**
|
|
1454
|
+
* Keys round-tripped to persisted storage: the built-in persisted keys plus
|
|
1455
|
+
* every plugin-contributed descriptor that opts in (`persist !== false`).
|
|
1456
|
+
* Custom descriptors carry no backing value, so they are excluded.
|
|
1457
|
+
*/
|
|
1458
|
+
private persistedSettingKeys;
|
|
1459
|
+
/**
|
|
1460
|
+
* Apply previously-serialized editor settings (toggles + conversions).
|
|
1461
|
+
* Unknown keys are ignored.
|
|
1462
|
+
*/
|
|
1463
|
+
applySettings(json: EditorSettingsJSON | undefined): void;
|
|
1464
|
+
/**
|
|
1465
|
+
* Persist editor settings + conversions to a storage adapter (localStorage by
|
|
1466
|
+
* default). Applies any saved state immediately, then saves (debounced) on
|
|
1467
|
+
* change. Returns a disposer. A host can pass its own storage adapter (e.g.
|
|
1468
|
+
* one backed by VS Code workspace state) instead of localStorage.
|
|
1469
|
+
*/
|
|
1470
|
+
enableSettingsPersistence(storage?: SettingsStorage | undefined): () => void;
|
|
828
1471
|
}
|
|
829
1472
|
//#endregion
|
|
830
1473
|
//#region src/system/notifications.d.ts
|
|
831
|
-
type NotificationType
|
|
1474
|
+
type NotificationType = 'info' | 'success' | 'error' | 'loading';
|
|
1475
|
+
interface NotificationData {
|
|
1476
|
+
type: NotificationType;
|
|
1477
|
+
message: string;
|
|
1478
|
+
options?: {
|
|
1479
|
+
id?: string;
|
|
1480
|
+
duration?: number;
|
|
1481
|
+
position?: any;
|
|
1482
|
+
icon?: Renderable;
|
|
1483
|
+
style?: React.CSSProperties;
|
|
1484
|
+
className?: string;
|
|
1485
|
+
ariaLive?: any;
|
|
1486
|
+
};
|
|
1487
|
+
}
|
|
832
1488
|
interface NotificationOptions {
|
|
833
1489
|
/**
|
|
834
1490
|
* Toast ID for programmatic dismissal
|
|
@@ -869,7 +1525,7 @@ declare class Notifications {
|
|
|
869
1525
|
/**
|
|
870
1526
|
* Show a notification toast
|
|
871
1527
|
*/
|
|
872
|
-
notify(message: string, type?: NotificationType
|
|
1528
|
+
notify(message: string, type?: NotificationType, options?: NotificationOptions): void;
|
|
873
1529
|
/**
|
|
874
1530
|
* Show a success notification
|
|
875
1531
|
*/
|
|
@@ -892,151 +1548,111 @@ declare class Notifications {
|
|
|
892
1548
|
dismiss(toastId?: string): void;
|
|
893
1549
|
}
|
|
894
1550
|
//#endregion
|
|
895
|
-
//#region src/store/
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
setAgent: (agent: AgentConfig) => void;
|
|
913
|
-
clearAgent: () => void;
|
|
914
|
-
addMessage: (message: ChatMessage) => void;
|
|
915
|
-
updateStreamingMessage: (id: string, content: string) => void;
|
|
916
|
-
finalizeStreamingMessage: (id: string) => void;
|
|
917
|
-
setIsStreaming: (streaming: boolean) => void;
|
|
918
|
-
setInputValue: (value: string) => void;
|
|
919
|
-
clearMessages: () => void;
|
|
1551
|
+
//#region src/store/graphMeta.d.ts
|
|
1552
|
+
/**
|
|
1553
|
+
* Reactive graph-level properties for a single {@link GraphSession}: the display
|
|
1554
|
+
* name (also the tab title) and an arbitrary metadata bag (the graph
|
|
1555
|
+
* annotations). Backed by a store so the Graph Properties panel, the tab title
|
|
1556
|
+
* and anything else stay in sync.
|
|
1557
|
+
*/
|
|
1558
|
+
type GraphMetaStore = {
|
|
1559
|
+
name: string;
|
|
1560
|
+
metadata: Record<string, any>;
|
|
1561
|
+
setName: (name: string) => void;
|
|
1562
|
+
/** Replace the whole metadata bag. */
|
|
1563
|
+
setMetadata: (metadata: Record<string, any>) => void;
|
|
1564
|
+
/** Shallow-merge into the metadata bag. */
|
|
1565
|
+
mergeMetadata: (partial: Record<string, any>) => void;
|
|
1566
|
+
setMetadataValue: (key: string, value: any) => void;
|
|
1567
|
+
removeMetadataKey: (key: string) => void;
|
|
920
1568
|
};
|
|
921
1569
|
//#endregion
|
|
922
|
-
//#region src/system/
|
|
923
|
-
type NotificationType = 'info' | 'success' | 'error' | 'loading';
|
|
924
|
-
interface NotificationData {
|
|
925
|
-
type: NotificationType;
|
|
926
|
-
message: string;
|
|
927
|
-
options?: {
|
|
928
|
-
id?: string;
|
|
929
|
-
duration?: number;
|
|
930
|
-
position?: any;
|
|
931
|
-
icon?: Renderable;
|
|
932
|
-
style?: React.CSSProperties;
|
|
933
|
-
className?: string;
|
|
934
|
-
ariaLive?: any;
|
|
935
|
-
};
|
|
936
|
-
}
|
|
937
|
-
interface PubSys {
|
|
938
|
-
'edge:added': Edge;
|
|
939
|
-
'node:added': Node$1;
|
|
940
|
-
'edge:removed': Edge;
|
|
941
|
-
'node:removed': Node$1;
|
|
942
|
-
graphAnnotationsChanged: {
|
|
943
|
-
[key: string]: any;
|
|
944
|
-
};
|
|
945
|
-
'aiNode:trigger': {
|
|
946
|
-
nodeId: string;
|
|
947
|
-
};
|
|
948
|
-
saveViewport: {
|
|
949
|
-
index: number;
|
|
950
|
-
viewport: Viewport;
|
|
951
|
-
};
|
|
952
|
-
missingViewPort: {
|
|
953
|
-
index: number;
|
|
954
|
-
};
|
|
955
|
-
notification: NotificationData;
|
|
956
|
-
'notification:dismiss': {
|
|
957
|
-
toastId?: string;
|
|
958
|
-
};
|
|
959
|
-
'layout:saved': LayoutBase;
|
|
960
|
-
'graph:saved': UIGraphJSON;
|
|
961
|
-
'graph:inner:saved': GraphJSON;
|
|
962
|
-
'chat:userMessage': {
|
|
963
|
-
content: string;
|
|
964
|
-
};
|
|
965
|
-
}
|
|
1570
|
+
//#region src/system/graphSession.d.ts
|
|
966
1571
|
/**
|
|
967
|
-
*
|
|
1572
|
+
* Augmentable surface for per-graph state contributed by plugins. Mirrors
|
|
1573
|
+
* {@link ISystem} at the editor level: a plugin adds typed properties to every
|
|
1574
|
+
* graph by augmenting this interface and assigning them via
|
|
1575
|
+
* {@link GraphSession.decorate} from inside a session extension.
|
|
1576
|
+
*
|
|
1577
|
+
* @example
|
|
1578
|
+
* declare module '@/system/graphSession' {
|
|
1579
|
+
* interface IGraphSession {
|
|
1580
|
+
* myController?: MyController;
|
|
1581
|
+
* }
|
|
1582
|
+
* }
|
|
968
1583
|
*/
|
|
969
|
-
interface
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
1584
|
+
interface IGraphSession {}
|
|
1585
|
+
/**
|
|
1586
|
+
* Merge the augmentable surface into the class instance type. Declaration
|
|
1587
|
+
* merging (same-named interface + class) makes plugin-added members , set via
|
|
1588
|
+
* {@link GraphSession.decorate} , readable as `session.x`, which `implements`
|
|
1589
|
+
* alone would NOT provide.
|
|
1590
|
+
*/
|
|
1591
|
+
interface GraphSession extends IGraphSession {}
|
|
1592
|
+
/**
|
|
1593
|
+
* A single open graph. Owns all per-graph state , nodes, edges, variables,
|
|
1594
|
+
* selection, traces, layers, logs, undo history and a private pubsub , so that
|
|
1595
|
+
* multiple graphs can be open simultaneously in complete isolation.
|
|
1596
|
+
*
|
|
1597
|
+
* Shared, editor-level resources (registry, specs, settings, notifications, ...)
|
|
1598
|
+
* are reached through {@link GraphSession.editor}.
|
|
1599
|
+
*
|
|
1600
|
+
* Per-graph state contributed by editor plugins is attached on creation via
|
|
1601
|
+
* session extensions (`system.registerSessionExtension`), which may register
|
|
1602
|
+
* teardown through {@link GraphSession.onDispose}.
|
|
1603
|
+
*/
|
|
1604
|
+
declare class GraphSession {
|
|
1605
|
+
readonly id: string;
|
|
1606
|
+
readonly editor: System;
|
|
1607
|
+
/** Reactive graph-level properties (name + metadata). */
|
|
1608
|
+
readonly metaStore: StoreApi<GraphMetaStore>;
|
|
1609
|
+
readonly pubsub: PubSub<GraphPubSys>;
|
|
973
1610
|
readonly undoManager: UndoManager;
|
|
974
|
-
|
|
1611
|
+
/** Display name, used as the graph tab title. Backed by {@link metaStore}. */
|
|
1612
|
+
get name(): string;
|
|
1613
|
+
set name(value: string);
|
|
975
1614
|
readonly controlStore: StoreApi<ControlsStore>;
|
|
976
1615
|
readonly variableStore: StoreApi<VariableStore>;
|
|
977
|
-
readonly selectionStore: StoreApi<SelectionStore>;
|
|
978
1616
|
readonly refStore: StoreApi<RefStore>;
|
|
979
|
-
readonly tabStore: StoreApi<TabStore>;
|
|
980
|
-
protected deps: Record<string, unknown>;
|
|
981
|
-
readonly registry: StoreApi<RegistryStore>;
|
|
982
|
-
readonly tabLoader: TabLoader;
|
|
983
|
-
readonly systemSettings: StoreApi<SystemSettingsStore>;
|
|
984
1617
|
readonly logsStore: StoreApi<LogStore>;
|
|
985
|
-
readonly legendStore: StoreApi<LegendStore>;
|
|
986
|
-
readonly hotKeyStore: StoreApi<HotkeyStore>;
|
|
987
|
-
readonly edgeStore: StoreApi<EdgeStore>;
|
|
988
|
-
readonly nodeStore: StoreApi<NodeStore>;
|
|
989
|
-
readonly specStore: StoreApi<SpecsStore>;
|
|
990
|
-
readonly specificStore: StoreApi<SpecificStore>;
|
|
991
|
-
readonly socketGeneratorStore: StoreApi<SocketGeneratorStore>;
|
|
992
1618
|
readonly eventsStore: StoreApi<EventsStore>;
|
|
993
|
-
readonly
|
|
994
|
-
readonly
|
|
1619
|
+
readonly nodeStore: StoreApi<NodeStore>;
|
|
1620
|
+
readonly edgeStore: StoreApi<EdgeStore>;
|
|
1621
|
+
readonly flowStore: StoreApi<FlowStore>;
|
|
1622
|
+
readonly selectionStore: StoreApi<SelectionStore>;
|
|
1623
|
+
readonly actionStore: StoreApi<ActionStore>;
|
|
995
1624
|
readonly layerStore: StoreApi<LayerStore>;
|
|
996
|
-
readonly menubarStore: StoreApi<MenuBarStore>;
|
|
997
|
-
readonly graph: Graph;
|
|
998
1625
|
readonly traceStore: StoreApi<TraceStore>;
|
|
999
|
-
readonly
|
|
1000
|
-
|
|
1626
|
+
readonly graph: Graph;
|
|
1627
|
+
/** Cleanups registered by session extensions, run (LIFO) on {@link dispose}. */
|
|
1628
|
+
private readonly disposers;
|
|
1629
|
+
constructor(editor: System, id?: string, name?: string);
|
|
1001
1630
|
/**
|
|
1002
|
-
*
|
|
1003
|
-
* @param registry - INodeRegistry containing nodes and values metadata
|
|
1631
|
+
* Convenience access to the shared editor notifications service.
|
|
1004
1632
|
*/
|
|
1005
|
-
|
|
1633
|
+
get notifications(): Notifications;
|
|
1006
1634
|
/**
|
|
1007
|
-
*
|
|
1008
|
-
* @
|
|
1009
|
-
* @param val
|
|
1635
|
+
* Attach a plugin-contributed property to this session. The companion to the
|
|
1636
|
+
* {@link IGraphSession} augmentation; mirrors {@link System.decorate}.
|
|
1010
1637
|
*/
|
|
1011
|
-
decorate(name:
|
|
1638
|
+
decorate<K$1 extends keyof IGraphSession>(name: K$1, val: IGraphSession[K$1]): void;
|
|
1012
1639
|
/**
|
|
1013
|
-
*
|
|
1014
|
-
*
|
|
1015
|
-
*
|
|
1016
|
-
* @template TOptions - Type of options object
|
|
1017
|
-
*
|
|
1018
|
-
* @example
|
|
1019
|
-
* // Plugin without options
|
|
1020
|
-
* system.registerPlugin(docsPlugin);
|
|
1021
|
-
*
|
|
1022
|
-
* @example
|
|
1023
|
-
* // Plugin with typed options
|
|
1024
|
-
* interface MyPluginOptions {
|
|
1025
|
-
* enabled: boolean;
|
|
1026
|
-
* apiKey: string;
|
|
1027
|
-
* }
|
|
1028
|
-
*
|
|
1029
|
-
* const myPlugin: Plugin<MyPluginOptions> = (system, options) => {
|
|
1030
|
-
* console.log('Plugin enabled:', options.enabled);
|
|
1031
|
-
* };
|
|
1032
|
-
*
|
|
1033
|
-
* system.registerPlugin(myPlugin, { enabled: true, apiKey: 'secret' });
|
|
1640
|
+
* Register a cleanup to run when this session is disposed. Session extensions
|
|
1641
|
+
* use this (via their returned cleanup) to tear down per-graph state they
|
|
1642
|
+
* attached. Cleanups run in reverse registration order.
|
|
1034
1643
|
*/
|
|
1035
|
-
|
|
1644
|
+
onDispose(cleanup: () => void): void;
|
|
1645
|
+
serialize(): UIGraphJSON;
|
|
1646
|
+
/**
|
|
1647
|
+
* Tear down this session's reactive wiring. Called when its tab is closed so
|
|
1648
|
+
* its pubsub subscriptions and trace flush loop don't leak. Extension-supplied
|
|
1649
|
+
* cleanups run first (LIFO), then the built-in teardown.
|
|
1650
|
+
*/
|
|
1651
|
+
dispose(): void;
|
|
1036
1652
|
}
|
|
1037
1653
|
//#endregion
|
|
1038
1654
|
//#region src/transformers/flowToBehave.d.ts
|
|
1039
|
-
declare const flowToBehave: (
|
|
1655
|
+
declare const flowToBehave: (session: GraphSession, nodes: Node$1[], edges: Edge[], nodeSpecJSON: NodeSpecJSON[]) => GraphJSON;
|
|
1040
1656
|
//#endregion
|
|
1041
1657
|
//#region src/util/autoLayout.d.ts
|
|
1042
1658
|
declare const autoLayout: (nodes: Node$1[], _edges: Edge[]) => void;
|
|
@@ -1072,7 +1688,10 @@ declare const hasPositionMetaData: (graph: GraphJSON) => boolean;
|
|
|
1072
1688
|
declare const isHandleConnected: (edges: Edge[], nodeId: string, handleId: string, type: "source" | "target") => boolean;
|
|
1073
1689
|
//#endregion
|
|
1074
1690
|
//#region src/util/isValidConnection.d.ts
|
|
1075
|
-
declare const isValidConnection: (connection: Connection, instance: ReactFlowInstance, specJSON: NodeSpecJSON[]
|
|
1691
|
+
declare const isValidConnection: (connection: Connection, instance: ReactFlowInstance, specJSON: NodeSpecJSON[], options?: {
|
|
1692
|
+
autoConvert?: boolean;
|
|
1693
|
+
conversions?: ConversionRule[];
|
|
1694
|
+
}) => boolean;
|
|
1076
1695
|
//#endregion
|
|
1077
1696
|
//#region src/util/sleep.d.ts
|
|
1078
1697
|
declare function sleep(durationInSeconds: number): Promise<unknown>;
|
|
@@ -1095,67 +1714,477 @@ interface Variable {
|
|
|
1095
1714
|
metadata?: Record<string, any>;
|
|
1096
1715
|
}
|
|
1097
1716
|
/**
|
|
1098
|
-
* Serialize a single variable to JSON
|
|
1717
|
+
* Serialize a single variable to JSON
|
|
1718
|
+
*/
|
|
1719
|
+
declare function serializeVariable(variable: Variable, registry: INodeRegistry): VariableJSON;
|
|
1720
|
+
/**
|
|
1721
|
+
* Serialize multiple variables to JSON array
|
|
1722
|
+
*/
|
|
1723
|
+
declare function writeVariablesToJSON(registry: INodeRegistry, variables: Record<string, Variable>): VariableJSON[];
|
|
1724
|
+
//#endregion
|
|
1725
|
+
//#region src/util/downloadJson.d.ts
|
|
1726
|
+
/**
|
|
1727
|
+
* Use this on a subscription to the graph:save event to trigger a download of the graph JSON data. This is useful for users who want to keep a local backup of their graphs, or for debugging purposes.
|
|
1728
|
+
* @param filename
|
|
1729
|
+
* @param data
|
|
1730
|
+
*/
|
|
1731
|
+
declare function downloadJson(filename: string, data: unknown): void;
|
|
1732
|
+
//#endregion
|
|
1733
|
+
//#region src/util/extractNodeMetadata.d.ts
|
|
1734
|
+
/**
|
|
1735
|
+
* Extract pure node metadata from a behave-graph registry.
|
|
1736
|
+
* Used by the visual graph editor to initialize a System without execution dependencies.
|
|
1737
|
+
*/
|
|
1738
|
+
declare function extractNodeMetadata(registry: IRegistry): INodeRegistry;
|
|
1739
|
+
//#endregion
|
|
1740
|
+
//#region src/components/layoutController/index.d.ts
|
|
1741
|
+
declare const LayoutController: (props: {}) => react_jsx_runtime0.JSX.Element;
|
|
1742
|
+
//#endregion
|
|
1743
|
+
//#region src/generators/registerDefaults.d.ts
|
|
1744
|
+
/**
|
|
1745
|
+
* Register the editor's built-in content , the default socket generators and the
|
|
1746
|
+
* call-subgraph contract sync , on an editor instance.
|
|
1747
|
+
*
|
|
1748
|
+
* Idempotent per editor: safe to call from every graph-canvas mount (multiple
|
|
1749
|
+
* tabs) without double-registering. The default content is editor-lifetime; the
|
|
1750
|
+
* subgraph sync's per-session subscriptions clean themselves up on session
|
|
1751
|
+
* dispose.
|
|
1752
|
+
*
|
|
1753
|
+
* A host that wants a blank or fully custom editor can simply not rely on the
|
|
1754
|
+
* canvas's auto-call and register its own content instead.
|
|
1755
|
+
*/
|
|
1756
|
+
declare function registerDefaults(editor: System): void;
|
|
1757
|
+
//#endregion
|
|
1758
|
+
//#region src/annotations/index.d.ts
|
|
1759
|
+
/**
|
|
1760
|
+
* Indicates that the port can be completely deleted
|
|
1761
|
+
*/
|
|
1762
|
+
declare const nonDeletable = "ui.nonDeletable";
|
|
1763
|
+
/**
|
|
1764
|
+
* Indicates that the port can be reset to its default value / type
|
|
1765
|
+
*/
|
|
1766
|
+
declare const resetable = "ui.resetable";
|
|
1767
|
+
/**
|
|
1768
|
+
* Indicates that the port cannot be edited
|
|
1769
|
+
*/
|
|
1770
|
+
declare const readonly = "ui.readonly";
|
|
1771
|
+
/**
|
|
1772
|
+
* Indicates that the port is hidden from the user
|
|
1773
|
+
*/
|
|
1774
|
+
declare const hidden = "ui.hidden";
|
|
1775
|
+
declare const annotatedTitle = "ui.title";
|
|
1776
|
+
declare const description = "ui.description";
|
|
1777
|
+
declare const executing = "ui.executing";
|
|
1778
|
+
declare const pinned = "ui.pinned";
|
|
1779
|
+
declare const layerId = "ui.layerId";
|
|
1780
|
+
declare const uiVersion = "ui.version";
|
|
1781
|
+
declare const realtime = "ui.realtime";
|
|
1782
|
+
declare const AnnotatedOutput = "ui.annotatedOutput";
|
|
1783
|
+
//#endregion
|
|
1784
|
+
//#region src/manifest/passthroughValueType.d.ts
|
|
1785
|
+
/**
|
|
1786
|
+
* Build a function-bearing {@link ValueTypeMetadata} from a function-free
|
|
1787
|
+
* {@link ValueTypeSpecJSON} carried in a manifest.
|
|
1788
|
+
*
|
|
1789
|
+
* The editor calls `creator`/`serialize`/`deserialize` at author time (creating
|
|
1790
|
+
* variables, editing events, deserializing a graph's variables). A manifest can
|
|
1791
|
+
* only ship JSON, so we synthesise pass-through behaviour: the value is already
|
|
1792
|
+
* its own JSON form, so (de)serialize are identity and `creator` returns a clone
|
|
1793
|
+
* of the declared default. This keeps every existing UI call site working with
|
|
1794
|
+
* **zero code execution**. When the package is later trusted-loaded, a
|
|
1795
|
+
* `valueType` contribution can replace this with the real implementation.
|
|
1796
|
+
*/
|
|
1797
|
+
declare function passthroughValueType(spec: ValueTypeSpecJSON): ValueTypeMetadata;
|
|
1798
|
+
//#endregion
|
|
1799
|
+
//#region src/manifest/contributionRegistry.d.ts
|
|
1800
|
+
/**
|
|
1801
|
+
* Registers a single resolved contribution into the right editor store. `value`
|
|
1802
|
+
* is whatever the host's resolver loaded for the contribution's `export` (its
|
|
1803
|
+
* concrete shape depends on the kind).
|
|
1804
|
+
*/
|
|
1805
|
+
type ContributionApplier = (system: System, contribution: ContributionSpec, value: unknown) => void;
|
|
1806
|
+
/** Dispatch table mapping each {@link ContributionKind} to its store action. */
|
|
1807
|
+
declare const contributionAppliers: Record<string, ContributionApplier>;
|
|
1808
|
+
/** Apply a resolved contribution, warning (not throwing) on an unknown kind. */
|
|
1809
|
+
declare function applyContribution(system: System, contribution: ContributionSpec, value: unknown): void;
|
|
1810
|
+
//#endregion
|
|
1811
|
+
//#region src/manifest/loadManifest.d.ts
|
|
1812
|
+
/**
|
|
1813
|
+
* Resolves a contribution's declarative `export` (e.g. `"./ui.js#ImageControl"`)
|
|
1814
|
+
* to its actual value. The host owns this because a bundler must know the
|
|
1815
|
+
* concrete module — so loading code contributions is always host-mediated and
|
|
1816
|
+
* gated behind {@link LoadManifestOptions.trust}.
|
|
1817
|
+
*/
|
|
1818
|
+
type ContributionResolver = (contribution: ContributionSpec, manifest: ManifestJSON) => unknown | Promise<unknown>;
|
|
1819
|
+
type LoadManifestOptions = {
|
|
1820
|
+
/**
|
|
1821
|
+
* Gate for executing code contributions. Default `false`: only nodes and
|
|
1822
|
+
* pass-through value types load (no package code runs). Set true together
|
|
1823
|
+
* with {@link LoadManifestOptions.resolve} once the package is trusted.
|
|
1824
|
+
*/
|
|
1825
|
+
trust?: boolean;
|
|
1826
|
+
/** Required to load contributions; without it only the static parts load. */
|
|
1827
|
+
resolve?: ContributionResolver;
|
|
1828
|
+
/**
|
|
1829
|
+
* Called for each declared host requirement (persistent backend, config,
|
|
1830
|
+
* ...). Lets the host surface a badge or run a backend. No code executes here.
|
|
1831
|
+
*/
|
|
1832
|
+
onRequirement?: (requirement: PackageRequirement, manifest: ManifestJSON) => void;
|
|
1833
|
+
};
|
|
1834
|
+
/**
|
|
1835
|
+
* Load a package manifest into the editor.
|
|
1836
|
+
*
|
|
1837
|
+
* Always (no code execution): registers the node specs and pass-through value
|
|
1838
|
+
* types, so the palette is fully populated from JSON alone. Only under explicit
|
|
1839
|
+
* `trust` + a `resolve`r does it import and register the package's code
|
|
1840
|
+
* contributions. Declared host requirements are surfaced via `onRequirement`.
|
|
1841
|
+
*/
|
|
1842
|
+
declare function loadManifest(system: System, manifest: ManifestJSON, options?: LoadManifestOptions): Promise<void>;
|
|
1843
|
+
//#endregion
|
|
1844
|
+
//#region src/manifest/manifestPlugin.d.ts
|
|
1845
|
+
interface ManifestPluginOptions extends LoadManifestOptions {
|
|
1846
|
+
/** Manifests to load, in order (later ones override earlier node types). */
|
|
1847
|
+
manifests: ManifestJSON[];
|
|
1848
|
+
}
|
|
1849
|
+
declare function manifestPluginLoader(system: System, options: ManifestPluginOptions): Promise<void>;
|
|
1850
|
+
/**
|
|
1851
|
+
* Register one or more package manifests as a single plugin. The static parts
|
|
1852
|
+
* (nodes + value types) always load; code contributions load only under
|
|
1853
|
+
* `trust` + `resolve` (see {@link LoadManifestOptions}).
|
|
1854
|
+
*/
|
|
1855
|
+
declare const manifestPlugin: LoadablePlugin<ManifestPluginOptions>;
|
|
1856
|
+
//#endregion
|
|
1857
|
+
//#region src/plugin/docs/index.d.ts
|
|
1858
|
+
/**
|
|
1859
|
+
* This is a plugin that sets up default documentation for core behave-graph nodes.
|
|
1860
|
+
* It uses the documentation store to add rich markdown descriptions,
|
|
1861
|
+
* short descriptions, and tags for various node types.
|
|
1862
|
+
* @param sys
|
|
1863
|
+
*/
|
|
1864
|
+
declare const docsPluginLoader: (sys: System, _options: void) => void;
|
|
1865
|
+
declare const docsPlugin: LoadablePlugin<void>;
|
|
1866
|
+
//#endregion
|
|
1867
|
+
//#region src/plugin/alignment/index.d.ts
|
|
1868
|
+
type AlignmentAxis = 'x' | 'y';
|
|
1869
|
+
type AlignmentType = 'start' | 'center' | 'end';
|
|
1870
|
+
declare module '@/system/system' {
|
|
1871
|
+
interface GraphPubSys {
|
|
1872
|
+
'alignment:align': {
|
|
1873
|
+
type: AlignmentType;
|
|
1874
|
+
axis: AlignmentAxis;
|
|
1875
|
+
};
|
|
1876
|
+
'alignment:distribute': {
|
|
1877
|
+
type: AlignmentType;
|
|
1878
|
+
axis: AlignmentAxis;
|
|
1879
|
+
};
|
|
1880
|
+
}
|
|
1881
|
+
}
|
|
1882
|
+
declare const setupSessionActions: (session: GraphSession) => void;
|
|
1883
|
+
/**
|
|
1884
|
+
* Adds node alignment + distribution to the editor. The behaviour is opt-in: it
|
|
1885
|
+
* subscribes each graph's pubsub (via a session extension, so it covers graphs
|
|
1886
|
+
* already open and any opened later) to the `alignment:align` /
|
|
1887
|
+
* `alignment:distribute` events the FloatingToolbar and Alignment panel publish.
|
|
1888
|
+
*
|
|
1889
|
+
* Register it directly or via the kitchen-sink plugin. Without it those events
|
|
1890
|
+
* have no subscriber and the alignment controls simply no-op.
|
|
1099
1891
|
*/
|
|
1100
|
-
declare
|
|
1892
|
+
declare const alignmentPlugin: LoadablePlugin<void>;
|
|
1893
|
+
//#endregion
|
|
1894
|
+
//#region src/plugin/layout/dagre.d.ts
|
|
1895
|
+
type Direction = 'TB' | 'LR' | 'RL' | 'BT';
|
|
1896
|
+
type Options = {
|
|
1897
|
+
direction: Direction;
|
|
1898
|
+
};
|
|
1899
|
+
declare function applyDagreLayout(system: System, options?: Options | undefined): Promise<void>;
|
|
1900
|
+
//#endregion
|
|
1901
|
+
//#region src/plugin/layout/elk.d.ts
|
|
1902
|
+
type LayoutAlgorithm = 'org.eclipse.elk.layered' | 'org.eclipse.elk.force' | 'org.eclipse.elk.rectpacking';
|
|
1903
|
+
declare const applyElkLayout: (sys: System, algorithm: LayoutAlgorithm) => Promise<void>;
|
|
1904
|
+
//#endregion
|
|
1905
|
+
//#region src/plugin/layout/index.d.ts
|
|
1101
1906
|
/**
|
|
1102
|
-
*
|
|
1907
|
+
* Available auto-layout engines. `Dagre` is a small, synchronous layered layout;
|
|
1908
|
+
* the `Elk - *` options use elkjs (~1.4 MB, loaded lazily on first use) for
|
|
1909
|
+
* higher-quality layouts.
|
|
1103
1910
|
*/
|
|
1104
|
-
declare
|
|
1105
|
-
|
|
1106
|
-
|
|
1911
|
+
declare const LAYOUT_TYPE: {
|
|
1912
|
+
readonly dagre: "Dagre";
|
|
1913
|
+
readonly elkForce: "Elk - Force";
|
|
1914
|
+
readonly elkRect: "Elk - Rect";
|
|
1915
|
+
readonly elkLayered: "Elk - Layered";
|
|
1916
|
+
};
|
|
1917
|
+
type LayoutType = (typeof LAYOUT_TYPE)[keyof typeof LAYOUT_TYPE];
|
|
1107
1918
|
/**
|
|
1108
|
-
*
|
|
1109
|
-
*
|
|
1110
|
-
* @param data
|
|
1919
|
+
* Run the currently-selected auto-layout engine against the focused graph.
|
|
1920
|
+
* Reads the `layoutType` setting (registered by this plugin) to pick the engine.
|
|
1111
1921
|
*/
|
|
1112
|
-
declare
|
|
1922
|
+
declare const applyAutoLayout: (system: System) => void;
|
|
1923
|
+
/**
|
|
1924
|
+
* Adds graph auto-layout (Dagre + ELK) to the editor. elkjs and dagre are heavy
|
|
1925
|
+
* dependencies that not every host needs, so they live here rather than in the
|
|
1926
|
+
* core editor — register this plugin (directly or via the kitchen-sink plugin)
|
|
1927
|
+
* to opt in.
|
|
1928
|
+
*
|
|
1929
|
+
* The plugin:
|
|
1930
|
+
* - registers the `layoutType` setting (the engine picker in the Settings panel);
|
|
1931
|
+
* - registers the `editor.autoLayout` command that the "Auto Layout" hotkey and
|
|
1932
|
+
* menu dispatch to.
|
|
1933
|
+
*
|
|
1934
|
+
* Without it, `editor.autoLayout` is simply unregistered (the hotkey no-ops).
|
|
1935
|
+
*/
|
|
1936
|
+
declare const layoutPlugin: LoadablePlugin<void>;
|
|
1113
1937
|
//#endregion
|
|
1114
|
-
//#region src/
|
|
1938
|
+
//#region src/plugin/notes/note.d.ts
|
|
1939
|
+
declare const NoteNode: react0.MemoExoticComponent<(props: NodeProps<INoteNode["data"]>) => react_jsx_runtime0.JSX.Element>;
|
|
1940
|
+
//#endregion
|
|
1941
|
+
//#region src/plugin/notes/nodeActions.d.ts
|
|
1942
|
+
/** Node type registered for notes created by this plugin. */
|
|
1943
|
+
declare const NOTE_NODE_TYPE = "noteNode";
|
|
1115
1944
|
/**
|
|
1116
|
-
*
|
|
1117
|
-
*
|
|
1945
|
+
* Type string notes used while they lived in the core editor as "comment"
|
|
1946
|
+
* nodes. Registered as an alias so graphs saved before the move still render.
|
|
1118
1947
|
*/
|
|
1119
|
-
declare
|
|
1948
|
+
declare const LEGACY_COMMENT_NODE_TYPE = "commentNode";
|
|
1949
|
+
declare const isNoteNode: (node: Node$1 | undefined) => node is Node$1;
|
|
1950
|
+
declare const noteAt: (ctx: CommandContext) => Node$1 | undefined;
|
|
1951
|
+
declare const duplicateNote: (session: GraphSession, note: Node$1) => void;
|
|
1952
|
+
declare const deleteNote: (session: GraphSession, note: Node$1) => void;
|
|
1953
|
+
/**
|
|
1954
|
+
* Move a note within the nodes array: React Flow paints later nodes on top, so
|
|
1955
|
+
* array order is z-order.
|
|
1956
|
+
*/
|
|
1957
|
+
declare const reorderNote: (session: GraphSession, note: Node$1, to: "front" | "back") => void;
|
|
1120
1958
|
//#endregion
|
|
1121
|
-
//#region src/
|
|
1122
|
-
|
|
1959
|
+
//#region src/plugin/notes/index.d.ts
|
|
1960
|
+
/**
|
|
1961
|
+
* Adds markdown note nodes to the editor. Notes are purely presentational:
|
|
1962
|
+
* they never appear in the compiled behave graph (only behave nodes do), but
|
|
1963
|
+
* they persist with the UI graph JSON like any other canvas node.
|
|
1964
|
+
*
|
|
1965
|
+
* The note editor embeds tiptap/prosemirror, a heavy dependency most hosts do
|
|
1966
|
+
* not need, so notes live here rather than in the core editor — register this
|
|
1967
|
+
* plugin (directly or via the kitchen-sink plugin) to opt in.
|
|
1968
|
+
*
|
|
1969
|
+
* The plugin:
|
|
1970
|
+
* - registers the `noteNode` component on every graph session (plus the legacy
|
|
1971
|
+
* `commentNode` alias for graphs saved before notes moved here);
|
|
1972
|
+
* - registers the `notes.addNote` command, an "Add Note" button on the
|
|
1973
|
+
* floating toolbar, and a `Shift+N` hotkey that dispatch it;
|
|
1974
|
+
* - registers note-specific node commands + context-menu items
|
|
1975
|
+
* (duplicate / delete / bring to front / send to back).
|
|
1976
|
+
*/
|
|
1977
|
+
declare const notesPlugin: LoadablePlugin<void>;
|
|
1978
|
+
//#endregion
|
|
1979
|
+
//#region src/plugin/autosave/storage.d.ts
|
|
1980
|
+
/** Single local-storage key holding every graph's backup ring. */
|
|
1981
|
+
declare const AUTOSAVE_STORAGE_KEY = "behave-graph:autosave";
|
|
1982
|
+
/** A single point-in-time copy of one graph. */
|
|
1983
|
+
type BackupSnapshot = {
|
|
1984
|
+
/** Unique id for this snapshot (used by the panel to restore/delete). */
|
|
1985
|
+
id: string;
|
|
1986
|
+
/** Session id of the graph this snapshot came from. */
|
|
1987
|
+
graphId: string;
|
|
1988
|
+
/** Graph display name captured at snapshot time (for the panel list). */
|
|
1989
|
+
name: string;
|
|
1990
|
+
/** Epoch milliseconds when the snapshot was taken. */
|
|
1991
|
+
timestamp: number;
|
|
1992
|
+
/** Node count, shown in the panel without deserializing the whole graph. */
|
|
1993
|
+
nodeCount: number;
|
|
1994
|
+
/** The full, restorable graph document. */
|
|
1995
|
+
graph: UIGraphJSON;
|
|
1996
|
+
};
|
|
1997
|
+
/**
|
|
1998
|
+
* Thin persistence wrapper over the single backup key. Kept storage-agnostic
|
|
1999
|
+
* (any get/set adapter) so hosts can back it with something other than
|
|
2000
|
+
* localStorage and tests can inject an in-memory map.
|
|
2001
|
+
*/
|
|
2002
|
+
declare class BackupStorage {
|
|
2003
|
+
private readonly storage;
|
|
2004
|
+
constructor(storage?: SettingsStorage | undefined);
|
|
2005
|
+
/** Whether a backing store is available (false in SSR / sandboxed contexts). */
|
|
2006
|
+
get available(): boolean;
|
|
2007
|
+
/** All snapshots across every graph, newest first. */
|
|
2008
|
+
listAll(): BackupSnapshot[];
|
|
2009
|
+
/** Find one snapshot by id (across all graphs). */
|
|
2010
|
+
find(id: string): BackupSnapshot | undefined;
|
|
2011
|
+
/**
|
|
2012
|
+
* Append a snapshot to its graph's ring and trim to `maxCopies` (oldest
|
|
2013
|
+
* dropped). `name` refreshes the stored graph label so the panel tracks
|
|
2014
|
+
* renames.
|
|
2015
|
+
*/
|
|
2016
|
+
append(snapshot: BackupSnapshot, maxCopies: number): void;
|
|
2017
|
+
/** Remove a single snapshot; prunes the graph entry once it is empty. */
|
|
2018
|
+
remove(id: string): void;
|
|
2019
|
+
/** Drop every snapshot for a single graph. */
|
|
2020
|
+
removeGraph(graphId: string): void;
|
|
2021
|
+
/** Wipe all backups. */
|
|
2022
|
+
clear(): void;
|
|
2023
|
+
}
|
|
1123
2024
|
//#endregion
|
|
1124
|
-
//#region src/
|
|
2025
|
+
//#region src/plugin/autosave/controller.d.ts
|
|
2026
|
+
/** Reactive slice the backup panel subscribes to. */
|
|
2027
|
+
type BackupControllerStore = {
|
|
2028
|
+
/** All snapshots across every graph, newest first. */
|
|
2029
|
+
snapshots: BackupSnapshot[];
|
|
2030
|
+
/** Whether the timer is currently running. */
|
|
2031
|
+
running: boolean;
|
|
2032
|
+
/** Epoch ms of the last successful capture, or null. */
|
|
2033
|
+
lastBackupAt: number | null;
|
|
2034
|
+
};
|
|
1125
2035
|
/**
|
|
1126
|
-
*
|
|
2036
|
+
* Drives periodic, consistency-checked backups of every open graph into local
|
|
2037
|
+
* storage, and restores from them. Owned by the autosave plugin and exposed on
|
|
2038
|
+
* the editor as `system.backups` so panels and other plugins can drive it.
|
|
2039
|
+
*
|
|
2040
|
+
* Snapshots are only written when a graph has actually changed, has settled
|
|
2041
|
+
* (see {@link QUIESCE_MS}), is internally consistent, and is not empty , and
|
|
2042
|
+
* never while a caller has the controller suspended. Timer cadence, copy count
|
|
2043
|
+
* and the on/off switch are read live from the editor settings.
|
|
1127
2044
|
*/
|
|
1128
|
-
declare
|
|
2045
|
+
declare class BackupController {
|
|
2046
|
+
readonly store: StoreApi$1<BackupControllerStore>;
|
|
2047
|
+
private readonly system;
|
|
2048
|
+
private readonly backups;
|
|
2049
|
+
private timer;
|
|
2050
|
+
/** Nesting counter: > 0 means "unsafe to snapshot right now". */
|
|
2051
|
+
private suspendDepth;
|
|
2052
|
+
private readonly watches;
|
|
2053
|
+
private readonly disposers;
|
|
2054
|
+
constructor(system: System, storage?: SettingsStorage);
|
|
2055
|
+
/** Mark the start of a region where a snapshot would be unsafe. */
|
|
2056
|
+
suspend(): void;
|
|
2057
|
+
/** End a region opened by {@link suspend}. */
|
|
2058
|
+
resume(): void;
|
|
2059
|
+
/** Whether snapshots are currently suspended. */
|
|
2060
|
+
get suspended(): boolean;
|
|
2061
|
+
/**
|
|
2062
|
+
* Run `fn` with snapshots suspended, resuming even if it throws. Use this to
|
|
2063
|
+
* bracket bulk mutations (loads, imports, programmatic rewrites) so an
|
|
2064
|
+
* autosave tick can never capture the graph mid-transition.
|
|
2065
|
+
*/
|
|
2066
|
+
runExclusive<T>(fn: () => T): T;
|
|
2067
|
+
private intervalMs;
|
|
2068
|
+
private maxCopies;
|
|
2069
|
+
/** (Re)start or stop the timer to match the current settings. */
|
|
2070
|
+
private applySettings;
|
|
2071
|
+
private start;
|
|
2072
|
+
private stop;
|
|
2073
|
+
/** One scheduler pass: try to capture each open, dirty, settled graph. */
|
|
2074
|
+
private tick;
|
|
2075
|
+
/**
|
|
2076
|
+
* Snapshot one graph now if it is worth it: changed, settled, non-empty,
|
|
2077
|
+
* consistent and not a duplicate of the last capture. Returns the snapshot on
|
|
2078
|
+
* success, or null when it was skipped.
|
|
2079
|
+
*/
|
|
2080
|
+
captureSession(session: GraphSession, force?: boolean): BackupSnapshot | null;
|
|
2081
|
+
/** Force an immediate backup of the focused graph (the "Back up now" action). */
|
|
2082
|
+
backupNow(): BackupSnapshot | null;
|
|
2083
|
+
/**
|
|
2084
|
+
* Restore a snapshot into a brand-new graph tab, leaving all currently open
|
|
2085
|
+
* graphs untouched , the safe choice when recovering from a bad state.
|
|
2086
|
+
* Returns the new session, or undefined if the snapshot is gone.
|
|
2087
|
+
*/
|
|
2088
|
+
restore(snapshotId: string): GraphSession | undefined;
|
|
2089
|
+
/** Delete one snapshot. */
|
|
2090
|
+
deleteSnapshot(id: string): void;
|
|
2091
|
+
/** Delete every snapshot. */
|
|
2092
|
+
clearAll(): void;
|
|
2093
|
+
/** Re-read storage into the reactive store (after an external change). */
|
|
2094
|
+
refresh(): void;
|
|
2095
|
+
/** Add watches for newly opened sessions, drop them for closed ones. */
|
|
2096
|
+
private syncSessions;
|
|
2097
|
+
private watchSession;
|
|
2098
|
+
/** Tear down timers and subscriptions. */
|
|
2099
|
+
dispose(): void;
|
|
2100
|
+
}
|
|
2101
|
+
//#endregion
|
|
2102
|
+
//#region src/plugin/autosave/settings.d.ts
|
|
1129
2103
|
/**
|
|
1130
|
-
*
|
|
2104
|
+
* Setting keys owned by the autosave plugin. Namespaced (`autosave.*`) so they
|
|
2105
|
+
* never collide with the built-in flat setting keys.
|
|
1131
2106
|
*/
|
|
1132
|
-
declare const
|
|
2107
|
+
declare const AUTOSAVE_ENABLED = "autosave.enabled";
|
|
2108
|
+
declare const AUTOSAVE_INTERVAL_SECONDS = "autosave.intervalSeconds";
|
|
2109
|
+
declare const AUTOSAVE_MAX_COPIES = "autosave.maxCopies";
|
|
2110
|
+
/** Shipped defaults, also used by the controller when a value is missing. */
|
|
2111
|
+
declare const AUTOSAVE_DEFAULTS: {
|
|
2112
|
+
readonly enabled: false;
|
|
2113
|
+
readonly intervalSeconds: 60;
|
|
2114
|
+
readonly maxCopies: 20;
|
|
2115
|
+
};
|
|
2116
|
+
/** Lower bound on the timer so a typo can't spin the loop every frame. */
|
|
2117
|
+
declare const MIN_INTERVAL_SECONDS = 5;
|
|
1133
2118
|
/**
|
|
1134
|
-
*
|
|
2119
|
+
* The Settings-panel rows this plugin contributes. Registered via
|
|
2120
|
+
* `system.registerSettings(...)`, which also seeds each default into the value
|
|
2121
|
+
* store, so `system.getSetting(AUTOSAVE_*)` is populated the moment the plugin
|
|
2122
|
+
* loads.
|
|
1135
2123
|
*/
|
|
1136
|
-
declare const
|
|
2124
|
+
declare const AUTOSAVE_SETTINGS: SettingDescriptor[];
|
|
2125
|
+
//#endregion
|
|
2126
|
+
//#region src/plugin/autosave/index.d.ts
|
|
2127
|
+
declare module '@/system/system' {
|
|
2128
|
+
interface System {
|
|
2129
|
+
/** Local backup controller, present when the autosave plugin is loaded. */
|
|
2130
|
+
backups?: BackupController;
|
|
2131
|
+
}
|
|
2132
|
+
}
|
|
2133
|
+
/** Tab id for the backup browser panel. */
|
|
2134
|
+
declare const BACKUP_PANEL_TAB_ID = "autosaveBackups";
|
|
2135
|
+
/** Options for {@link autosavePlugin}. */
|
|
2136
|
+
interface AutosavePluginOptions {
|
|
2137
|
+
/**
|
|
2138
|
+
* Storage adapter for the backups. Defaults to `localStorage`. Provide your
|
|
2139
|
+
* own (e.g. backed by VS Code workspace state) to persist elsewhere; pass a
|
|
2140
|
+
* throwaway map in tests.
|
|
2141
|
+
*/
|
|
2142
|
+
storage?: SettingsStorage;
|
|
2143
|
+
/** Add the "Local Backups" item to the Window menu. Default: true. */
|
|
2144
|
+
addMenuItem?: boolean;
|
|
2145
|
+
}
|
|
1137
2146
|
/**
|
|
1138
|
-
*
|
|
2147
|
+
* Client-side automatic graph backups.
|
|
2148
|
+
*
|
|
2149
|
+
* Periodically snapshots every open graph into local storage so a crash or a
|
|
2150
|
+
* bad edit during development is recoverable, and adds a panel to browse and
|
|
2151
|
+
* restore those copies. Everything stays in the browser , no backend.
|
|
2152
|
+
*
|
|
2153
|
+
* The plugin:
|
|
2154
|
+
* - contributes the `Autosave` settings (on/off, frequency, copies-to-keep);
|
|
2155
|
+
* - installs a {@link BackupController} on the editor as `system.backups`,
|
|
2156
|
+
* which runs the consistency-checked capture loop and honours the settings;
|
|
2157
|
+
* - registers the `autosaveBackups` panel plus `autosave.openBackups` /
|
|
2158
|
+
* `autosave.backupNow` commands and a Window-menu entry.
|
|
2159
|
+
*
|
|
2160
|
+
* Snapshots are only taken when a graph changed, settled, is consistent and is
|
|
2161
|
+
* not empty; callers can bracket bulk mutations with
|
|
2162
|
+
* `system.backups.runExclusive(...)` to guarantee no copy is taken mid-change.
|
|
1139
2163
|
*/
|
|
1140
|
-
declare const
|
|
1141
|
-
declare const annotatedTitle = "ui.title";
|
|
1142
|
-
declare const description = "ui.description";
|
|
1143
|
-
declare const executing = "ui.executing";
|
|
1144
|
-
declare const pinned = "ui.pinned";
|
|
1145
|
-
declare const layerId = "ui.layerId";
|
|
1146
|
-
declare const uiVersion = "ui.version";
|
|
1147
|
-
declare const realtime = "ui.realtime";
|
|
1148
|
-
declare const AnnotatedOutput = "ui.annotatedOutput";
|
|
2164
|
+
declare const autosavePlugin: LoadablePlugin<AutosavePluginOptions | undefined>;
|
|
1149
2165
|
//#endregion
|
|
1150
|
-
//#region src/plugin/
|
|
2166
|
+
//#region src/plugin/kitchen-sink/index.d.ts
|
|
1151
2167
|
/**
|
|
1152
|
-
*
|
|
1153
|
-
*
|
|
1154
|
-
*
|
|
1155
|
-
*
|
|
2168
|
+
* Batteries-included bundle of the standard editor plugins. Register this once
|
|
2169
|
+
* instead of wiring each plugin by hand:
|
|
2170
|
+
*
|
|
2171
|
+
* ```ts
|
|
2172
|
+
* const system = new System(registry);
|
|
2173
|
+
* system.registerPlugin(kitchenSinkPlugin);
|
|
2174
|
+
* ```
|
|
2175
|
+
*
|
|
2176
|
+
* It currently pulls in:
|
|
2177
|
+
* - {@link docsPlugin} — the in-editor node documentation browser;
|
|
2178
|
+
* - {@link alignmentPlugin} — node alignment + distribution;
|
|
2179
|
+
* - {@link layoutPlugin} — Dagre/ELK auto-layout (heavy deps, opt-in);
|
|
2180
|
+
* - {@link notesPlugin} — markdown note nodes (tiptap/prosemirror, opt-in);
|
|
2181
|
+
* - {@link autosavePlugin} — client-side local backups of open graphs.
|
|
2182
|
+
*
|
|
2183
|
+
* It intentionally does **not** register a graph runner: runners
|
|
2184
|
+
* ({@link localGraphRunnerPlugin}, the remote client, ...) need host-specific
|
|
2185
|
+
* options (a node registry, transport, ...) so hosts wire those themselves.
|
|
1156
2186
|
*/
|
|
1157
|
-
declare const
|
|
1158
|
-
declare const docsPlugin: LoadablePlugin<void>;
|
|
2187
|
+
declare const kitchenSinkPlugin: LoadablePlugin<void>;
|
|
1159
2188
|
//#endregion
|
|
1160
2189
|
//#region src/plugin/graphrunner/transport.d.ts
|
|
1161
2190
|
type TransportState = 'disconnected' | 'connecting' | 'connected' | 'error';
|
|
@@ -1198,6 +2227,20 @@ interface ITransport<Send = ServerGraphRunnerMessage | GraphRunnerMessage, Recei
|
|
|
1198
2227
|
*/
|
|
1199
2228
|
removeAllHandlers(): void;
|
|
1200
2229
|
}
|
|
2230
|
+
/**
|
|
2231
|
+
* Optional capability: a transport that can interactively control a run
|
|
2232
|
+
* (pause / resume / step). Remote transports may not support it; the client
|
|
2233
|
+
* detects support via {@link supportsExecutionControl} rather than reaching into
|
|
2234
|
+
* transport internals.
|
|
2235
|
+
*/
|
|
2236
|
+
interface IExecutionControl {
|
|
2237
|
+
pauseExecution(runId: string): void;
|
|
2238
|
+
resumeExecution(runId: string): Promise<void>;
|
|
2239
|
+
stepExecution(runId: string): Promise<void>;
|
|
2240
|
+
isPaused(runId: string): boolean;
|
|
2241
|
+
}
|
|
2242
|
+
/** Type guard: does this transport implement {@link IExecutionControl}? */
|
|
2243
|
+
declare function supportsExecutionControl(transport: unknown): transport is IExecutionControl;
|
|
1201
2244
|
/**
|
|
1202
2245
|
* WebSocket transport implementation
|
|
1203
2246
|
*/
|
|
@@ -1376,6 +2419,24 @@ interface TraceMessage {
|
|
|
1376
2419
|
data: unknown;
|
|
1377
2420
|
timestamp: number;
|
|
1378
2421
|
}
|
|
2422
|
+
/** A single node-execution event inside a {@link TraceBatchMessage}. */
|
|
2423
|
+
interface TraceBatchEvent {
|
|
2424
|
+
nodeId: string;
|
|
2425
|
+
event: string;
|
|
2426
|
+
data?: unknown;
|
|
2427
|
+
timestamp: number;
|
|
2428
|
+
}
|
|
2429
|
+
/**
|
|
2430
|
+
* Coalesced trace events for one run. Runners buffer per-node execution events
|
|
2431
|
+
* and flush them roughly once per frame, so a tick that executes hundreds of
|
|
2432
|
+
* nodes costs one message instead of hundreds.
|
|
2433
|
+
*/
|
|
2434
|
+
interface TraceBatchMessage {
|
|
2435
|
+
type: 'traceBatch';
|
|
2436
|
+
runId: string;
|
|
2437
|
+
graphId: string;
|
|
2438
|
+
events: TraceBatchEvent[];
|
|
2439
|
+
}
|
|
1379
2440
|
interface LogMessage {
|
|
1380
2441
|
type: 'log';
|
|
1381
2442
|
runId: string;
|
|
@@ -1453,7 +2514,7 @@ interface RunHistoryMessage {
|
|
|
1453
2514
|
result?: unknown;
|
|
1454
2515
|
}>;
|
|
1455
2516
|
}
|
|
1456
|
-
type ServerGraphRunnerMessage = ServerPongMessage | ServerWelcomeMessage | CapabilitiesMessage | SessionCreatedMessage | SessionResumedMessage | SessionClosedMessage | ServerVariablesMessage | ServerEventsMessage | SocketConstraintsMessage | NodeTypesMessage | RunStartedMessage | ServerGraphRegisteredMessage | ServerGraphListMessage | ValidationResultMessage | TraceMessage | LogMessage | VariableChangedMessage | CompletedMessage | NodeAddedMessage | StoppedMessage | StatusMessage | BatchStatusMessage | ErrorMessage | NodeRemovedMessage | LinkCreatedMessage | LinkRemovedMessage | NodeParamUpdatedMessage | AffectedNodesMessage | RunHistoryMessage;
|
|
2517
|
+
type ServerGraphRunnerMessage = ServerPongMessage | ServerWelcomeMessage | CapabilitiesMessage | SessionCreatedMessage | SessionResumedMessage | SessionClosedMessage | ServerVariablesMessage | ServerEventsMessage | SocketConstraintsMessage | NodeTypesMessage | RunStartedMessage | ServerGraphRegisteredMessage | ServerGraphListMessage | ValidationResultMessage | TraceMessage | TraceBatchMessage | LogMessage | VariableChangedMessage | CompletedMessage | NodeAddedMessage | StoppedMessage | StatusMessage | BatchStatusMessage | ErrorMessage | NodeRemovedMessage | LinkCreatedMessage | LinkRemovedMessage | NodeParamUpdatedMessage | AffectedNodesMessage | RunHistoryMessage;
|
|
1457
2518
|
interface HelloMessage {
|
|
1458
2519
|
type: 'hello';
|
|
1459
2520
|
protocolVersion: string;
|
|
@@ -1874,10 +2935,6 @@ interface GraphRunnerClientStore {
|
|
|
1874
2935
|
nodeTypes: NodeSpecJSON[];
|
|
1875
2936
|
messageActivity: MessageActivity[];
|
|
1876
2937
|
maxActivityMessages: number;
|
|
1877
|
-
currentRunId: string | null;
|
|
1878
|
-
currentGraphId: string | null;
|
|
1879
|
-
isExecuting: boolean;
|
|
1880
|
-
isPaused: boolean;
|
|
1881
2938
|
clearLogsOnRun: boolean;
|
|
1882
2939
|
clearTracesOnRun: boolean;
|
|
1883
2940
|
enableTracing: boolean;
|
|
@@ -1892,10 +2949,6 @@ interface GraphRunnerClientStore {
|
|
|
1892
2949
|
clearServerMetadata: () => void;
|
|
1893
2950
|
addMessageActivity: (direction: 'sent' | 'received', message: GraphRunnerMessage) => void;
|
|
1894
2951
|
clearMessageActivity: () => void;
|
|
1895
|
-
setCurrentRunId: (runId: string | null) => void;
|
|
1896
|
-
setCurrentGraphId: (graphId: string | null) => void;
|
|
1897
|
-
setIsExecuting: (isExecuting: boolean) => void;
|
|
1898
|
-
setIsPaused: (isPaused: boolean) => void;
|
|
1899
2952
|
setClearLogsOnRun: (clear: boolean) => void;
|
|
1900
2953
|
setClearTracesOnRun: (clear: boolean) => void;
|
|
1901
2954
|
setEnableTracing: (enable: boolean) => void;
|
|
@@ -1908,16 +2961,80 @@ interface GraphRunnerPanelProps {
|
|
|
1908
2961
|
}
|
|
1909
2962
|
declare const GraphRunnerPanel: React$1.FC<GraphRunnerPanelProps>;
|
|
1910
2963
|
//#endregion
|
|
2964
|
+
//#region src/plugin/graphrunner/runController.d.ts
|
|
2965
|
+
declare module '@/system/graphSession' {
|
|
2966
|
+
interface IGraphSession {
|
|
2967
|
+
runController?: GraphRunController;
|
|
2968
|
+
}
|
|
2969
|
+
}
|
|
2970
|
+
/**
|
|
2971
|
+
* Per-run state for a single graph. Each {@link GraphSession} owns one of these,
|
|
2972
|
+
* so multiple graphs can run independently and concurrently.
|
|
2973
|
+
*/
|
|
2974
|
+
interface RunControllerStore {
|
|
2975
|
+
currentRunId: string | null;
|
|
2976
|
+
currentGraphId: string | null;
|
|
2977
|
+
isExecuting: boolean;
|
|
2978
|
+
isPaused: boolean;
|
|
2979
|
+
setCurrentRunId: (runId: string | null) => void;
|
|
2980
|
+
setCurrentGraphId: (graphId: string | null) => void;
|
|
2981
|
+
setIsExecuting: (isExecuting: boolean) => void;
|
|
2982
|
+
setIsPaused: (isPaused: boolean) => void;
|
|
2983
|
+
}
|
|
2984
|
+
/**
|
|
2985
|
+
* Drives execution for a single graph session. Run lifecycle and run state are
|
|
2986
|
+
* per-session; the underlying connection/client is shared via {@link GraphRunner}.
|
|
2987
|
+
* Incoming server messages are routed back to the originating controller by run
|
|
2988
|
+
* id (see `GraphRunner.runIndex`).
|
|
2989
|
+
*/
|
|
2990
|
+
declare class GraphRunController {
|
|
2991
|
+
readonly session: GraphSession;
|
|
2992
|
+
readonly runner: GraphRunner;
|
|
2993
|
+
readonly store: StoreApi<RunControllerStore>;
|
|
2994
|
+
private readonly disposers;
|
|
2995
|
+
constructor(session: GraphSession, runner: GraphRunner);
|
|
2996
|
+
private get notifications();
|
|
2997
|
+
/** Run the graph for this session. */
|
|
2998
|
+
play(): Promise<void>;
|
|
2999
|
+
runRemotely(graphId: string, options?: {
|
|
3000
|
+
graph?: unknown;
|
|
3001
|
+
inputs?: unknown;
|
|
3002
|
+
}): Promise<void>;
|
|
3003
|
+
stop(): Promise<void>;
|
|
3004
|
+
pause(): Promise<void>;
|
|
3005
|
+
resume(): Promise<void>;
|
|
3006
|
+
step(): Promise<void>;
|
|
3007
|
+
/** Reset run state after completion/stop/error and unregister the run. */
|
|
3008
|
+
finishRun(): void;
|
|
3009
|
+
/**
|
|
3010
|
+
* Forward live graph edits to the server while this graph is running, tagged
|
|
3011
|
+
* with this controller's run id so concurrent graphs stay isolated.
|
|
3012
|
+
*/
|
|
3013
|
+
private setupRealtimeForwarding;
|
|
3014
|
+
dispose(): void;
|
|
3015
|
+
}
|
|
3016
|
+
//#endregion
|
|
1911
3017
|
//#region src/plugin/graphrunner/runner.d.ts
|
|
1912
3018
|
declare module '@/system/system' {
|
|
1913
3019
|
interface System {
|
|
1914
3020
|
runner: GraphRunner;
|
|
1915
3021
|
}
|
|
1916
3022
|
}
|
|
3023
|
+
/**
|
|
3024
|
+
* Shared connection to the graph runner server. Owns the client, connection
|
|
3025
|
+
* lifecycle and server metadata; per-graph run state and run lifecycle live on
|
|
3026
|
+
* {@link GraphRunController}. Incoming server messages are dispatched back to the
|
|
3027
|
+
* owning controller via {@link GraphRunner.runIndex}, keyed by run id, so
|
|
3028
|
+
* multiple graphs can run concurrently and independently.
|
|
3029
|
+
*/
|
|
1917
3030
|
declare class GraphRunner {
|
|
1918
3031
|
private system;
|
|
1919
3032
|
readonly store: StoreApi<GraphRunnerClientStore>;
|
|
3033
|
+
/** runId -> the controller that started it. */
|
|
3034
|
+
readonly runIndex: Map<string, GraphRunController>;
|
|
1920
3035
|
constructor(system: System, store: StoreApi<GraphRunnerClientStore>);
|
|
3036
|
+
registerRun(runId: string, controller: GraphRunController): void;
|
|
3037
|
+
unregisterRun(runId: string): void;
|
|
1921
3038
|
/**
|
|
1922
3039
|
* Connect to the graph runner server
|
|
1923
3040
|
*/
|
|
@@ -1930,33 +3047,6 @@ declare class GraphRunner {
|
|
|
1930
3047
|
* Refresh server metadata (variables, events, node types)
|
|
1931
3048
|
*/
|
|
1932
3049
|
refreshMetadata(): Promise<void>;
|
|
1933
|
-
/**
|
|
1934
|
-
* Run a graph remotely
|
|
1935
|
-
*/
|
|
1936
|
-
runRemotely(graphId: string, options?: {
|
|
1937
|
-
graph?: unknown;
|
|
1938
|
-
inputs?: unknown;
|
|
1939
|
-
}): Promise<void>;
|
|
1940
|
-
/**
|
|
1941
|
-
* Stop the current graph execution
|
|
1942
|
-
*/
|
|
1943
|
-
stop(): Promise<void>;
|
|
1944
|
-
/**
|
|
1945
|
-
* Play the current graph
|
|
1946
|
-
*/
|
|
1947
|
-
play(): Promise<void>;
|
|
1948
|
-
/**
|
|
1949
|
-
* Pause the current graph execution
|
|
1950
|
-
*/
|
|
1951
|
-
pause(): Promise<void>;
|
|
1952
|
-
/**
|
|
1953
|
-
* Resume paused execution
|
|
1954
|
-
*/
|
|
1955
|
-
resume(): Promise<void>;
|
|
1956
|
-
/**
|
|
1957
|
-
* Execute one step forward
|
|
1958
|
-
*/
|
|
1959
|
-
step(): Promise<void>;
|
|
1960
3050
|
}
|
|
1961
3051
|
//#endregion
|
|
1962
3052
|
//#region src/plugin/graphrunner/session.d.ts
|
|
@@ -2141,7 +3231,7 @@ declare const localGraphRunnerStoreFactory: () => zustand5.StoreApi<LocalGraphRu
|
|
|
2141
3231
|
/**
|
|
2142
3232
|
* Local transport that executes graphs in the browser using the Engine
|
|
2143
3233
|
*/
|
|
2144
|
-
declare class LocalTransport implements ITransport {
|
|
3234
|
+
declare class LocalTransport implements ITransport, IExecutionControl {
|
|
2145
3235
|
private state;
|
|
2146
3236
|
private messageHandlers;
|
|
2147
3237
|
private stateChangeHandlers;
|
|
@@ -2152,11 +3242,16 @@ declare class LocalTransport implements ITransport {
|
|
|
2152
3242
|
private store;
|
|
2153
3243
|
private variables;
|
|
2154
3244
|
private serverEvents;
|
|
3245
|
+
private resolveGraph?;
|
|
2155
3246
|
constructor(registry: IRegistry, options?: {
|
|
2156
3247
|
store?: StoreApi<LocalGraphRunnerStore>;
|
|
2157
3248
|
variables?: ServerVariable[];
|
|
2158
3249
|
serverEvents?: ServerEvent[];
|
|
2159
3250
|
sessionFactory?: SessionFactory;
|
|
3251
|
+
/**
|
|
3252
|
+
* Resolve a referenced graph's JSON by id, enabling Call Subgraph nodes.
|
|
3253
|
+
*/
|
|
3254
|
+
resolveGraph?: (id: string) => GraphJSON | undefined;
|
|
2160
3255
|
});
|
|
2161
3256
|
/**
|
|
2162
3257
|
* Create a logger that forwards log messages to the client
|
|
@@ -2278,5 +3373,225 @@ interface LocalGraphRunnerPluginOptions {
|
|
|
2278
3373
|
declare function localGraphRunnerPluginLoader(system: System, options: LocalGraphRunnerPluginOptions): Promise<void>;
|
|
2279
3374
|
declare const localGraphRunnerPlugin: LoadablePlugin<LocalGraphRunnerPluginOptions>;
|
|
2280
3375
|
//#endregion
|
|
2281
|
-
|
|
3376
|
+
//#region src/plugin/graphrunner-webworker/worker-transport.d.ts
|
|
3377
|
+
/**
|
|
3378
|
+
* Web Worker transport that delegates graph execution to a worker thread
|
|
3379
|
+
*/
|
|
3380
|
+
declare class WorkerTransport implements ITransport {
|
|
3381
|
+
private state;
|
|
3382
|
+
private messageHandlers;
|
|
3383
|
+
private stateChangeHandlers;
|
|
3384
|
+
private errorHandlers;
|
|
3385
|
+
private worker;
|
|
3386
|
+
constructor(worker: Worker);
|
|
3387
|
+
getState(): TransportState;
|
|
3388
|
+
connect(): Promise<void>;
|
|
3389
|
+
disconnect(): void;
|
|
3390
|
+
send(message: GraphRunnerMessage): void;
|
|
3391
|
+
onMessage(handler: (message: GraphRunnerMessage) => void): void;
|
|
3392
|
+
onStateChange(handler: (state: TransportState) => void): void;
|
|
3393
|
+
onError(handler: (error: Error) => void): void;
|
|
3394
|
+
removeAllHandlers(): void;
|
|
3395
|
+
private setState;
|
|
3396
|
+
private notifyError;
|
|
3397
|
+
private notifyMessage;
|
|
3398
|
+
private handleWorkerMessage;
|
|
3399
|
+
}
|
|
3400
|
+
//#endregion
|
|
3401
|
+
//#region src/plugin/graphrunner-webworker/store.d.ts
|
|
3402
|
+
type WebWorkerGraphRunnerStore = {
|
|
3403
|
+
/**
|
|
3404
|
+
* Number of active graph runs in the worker
|
|
3405
|
+
*/
|
|
3406
|
+
activeRuns: number;
|
|
3407
|
+
/**
|
|
3408
|
+
* Whether a graph is currently executing
|
|
3409
|
+
*/
|
|
3410
|
+
isExecuting: boolean;
|
|
3411
|
+
/**
|
|
3412
|
+
* Whether execution is paused
|
|
3413
|
+
*/
|
|
3414
|
+
isPaused: boolean;
|
|
3415
|
+
/**
|
|
3416
|
+
* Tick interval in milliseconds (for tick events)
|
|
3417
|
+
* Default: 50ms
|
|
3418
|
+
*/
|
|
3419
|
+
tickInterval: number;
|
|
3420
|
+
/**
|
|
3421
|
+
* Step delay in milliseconds (between execution steps)
|
|
3422
|
+
* Default: 0ms (no delay)
|
|
3423
|
+
*/
|
|
3424
|
+
stepDelay: number;
|
|
3425
|
+
/**
|
|
3426
|
+
* Execution speed multiplier
|
|
3427
|
+
* 1.0 = normal speed, 0.5 = half speed, 2.0 = double speed
|
|
3428
|
+
* Default: 1.0
|
|
3429
|
+
*/
|
|
3430
|
+
executionSpeed: number;
|
|
3431
|
+
/**
|
|
3432
|
+
* Set the number of active runs
|
|
3433
|
+
*/
|
|
3434
|
+
setActiveRuns: (count: number) => void;
|
|
3435
|
+
/**
|
|
3436
|
+
* Set execution state
|
|
3437
|
+
*/
|
|
3438
|
+
setIsExecuting: (isExecuting: boolean) => void;
|
|
3439
|
+
/**
|
|
3440
|
+
* Set pause state
|
|
3441
|
+
*/
|
|
3442
|
+
setIsPaused: (isPaused: boolean) => void;
|
|
3443
|
+
/**
|
|
3444
|
+
* Set tick interval
|
|
3445
|
+
*/
|
|
3446
|
+
setTickInterval: (interval: number) => void;
|
|
3447
|
+
/**
|
|
3448
|
+
* Set step delay
|
|
3449
|
+
*/
|
|
3450
|
+
setStepDelay: (delay: number) => void;
|
|
3451
|
+
/**
|
|
3452
|
+
* Set execution speed
|
|
3453
|
+
*/
|
|
3454
|
+
setExecutionSpeed: (speed: number) => void;
|
|
3455
|
+
};
|
|
3456
|
+
declare const webWorkerGraphRunnerStoreFactory: () => StoreApi<WebWorkerGraphRunnerStore>;
|
|
3457
|
+
declare module '@/system/system' {
|
|
3458
|
+
interface System {
|
|
3459
|
+
/**
|
|
3460
|
+
* Web Worker Graph Runner store
|
|
3461
|
+
*/
|
|
3462
|
+
webWorkerGraphRunnerStore: StoreApi<WebWorkerGraphRunnerStore>;
|
|
3463
|
+
}
|
|
3464
|
+
}
|
|
3465
|
+
//# sourceMappingURL=store.d.ts.map
|
|
3466
|
+
//#endregion
|
|
3467
|
+
//#region src/plugin/graphrunner-webworker/panel.d.ts
|
|
3468
|
+
/**
|
|
3469
|
+
* Panel component for Web Worker Graph Runner
|
|
3470
|
+
*/
|
|
3471
|
+
declare function WebWorkerGraphRunnerPanel(): react_jsx_runtime0.JSX.Element;
|
|
3472
|
+
//#endregion
|
|
3473
|
+
//#region src/plugin/graphrunner-webworker/index.d.ts
|
|
3474
|
+
/**
|
|
3475
|
+
* Options for the Web Worker graph runner plugin
|
|
3476
|
+
*/
|
|
3477
|
+
interface WebWorkerGraphRunnerPluginOptions {
|
|
3478
|
+
/**
|
|
3479
|
+
* Pre-configured Web Worker instance.
|
|
3480
|
+
* The worker should be set up with the necessary registry and message handlers.
|
|
3481
|
+
* The registry MUST be defined inside the worker file itself.
|
|
3482
|
+
*
|
|
3483
|
+
* Example:
|
|
3484
|
+
* ```ts
|
|
3485
|
+
* const worker = new Worker(new URL('./my-graph-worker.ts', import.meta.url), { type: 'module' });
|
|
3486
|
+
* ```
|
|
3487
|
+
*/
|
|
3488
|
+
worker: Worker;
|
|
3489
|
+
/**
|
|
3490
|
+
* Whether to skip automatic connection.
|
|
3491
|
+
* Default: false (will attempt to connect immediately)
|
|
3492
|
+
*/
|
|
3493
|
+
skipAutoConnect?: boolean;
|
|
3494
|
+
/**
|
|
3495
|
+
* Whether to add the menu item to the Window menu.
|
|
3496
|
+
* Default: true
|
|
3497
|
+
*/
|
|
3498
|
+
addMenuItem?: boolean;
|
|
3499
|
+
}
|
|
3500
|
+
/**
|
|
3501
|
+
* Plugin initialization function for Web Worker graph execution
|
|
3502
|
+
* Registers a GraphRunnerClient with a worker transport that executes graphs in a Web Worker
|
|
3503
|
+
*/
|
|
3504
|
+
declare function webWorkerGraphRunnerPluginLoader(system: System, options: WebWorkerGraphRunnerPluginOptions): Promise<void>;
|
|
3505
|
+
declare const webWorkerGraphRunnerPlugin: LoadablePlugin<WebWorkerGraphRunnerPluginOptions>;
|
|
3506
|
+
//#endregion
|
|
3507
|
+
//#region src/plugin/realtime/realtimeRunner.d.ts
|
|
3508
|
+
type RealtimeRunnerStore = {
|
|
3509
|
+
engine?: Engine;
|
|
3510
|
+
/** Live output values published for UI consumers (keyed by nodeId -> outputName) */
|
|
3511
|
+
outputs: Record<string, Record<string, unknown>>;
|
|
3512
|
+
setEngine: (engine?: Engine) => void;
|
|
3513
|
+
setOutputs: (updates: Array<{
|
|
3514
|
+
nodeId: string;
|
|
3515
|
+
outputName: string;
|
|
3516
|
+
value: unknown;
|
|
3517
|
+
}>) => void;
|
|
3518
|
+
};
|
|
3519
|
+
/**
|
|
3520
|
+
* RealtimeRunner keeps a small preview Engine up-to-date with the current graph.
|
|
3521
|
+
* It is designed for UI previews (e.g. live node output thumbnails) and does not
|
|
3522
|
+
* replace the existing `GraphRunner`.
|
|
3523
|
+
*/
|
|
3524
|
+
declare class RealtimeRunner {
|
|
3525
|
+
private system;
|
|
3526
|
+
private executionRegistry?;
|
|
3527
|
+
private graphInstance?;
|
|
3528
|
+
private engine?;
|
|
3529
|
+
private scheduled;
|
|
3530
|
+
private tickRafHandle?;
|
|
3531
|
+
private tickTimeoutHandle?;
|
|
3532
|
+
private tickLoopActive;
|
|
3533
|
+
private tickInProgress;
|
|
3534
|
+
private lastTickAtMs;
|
|
3535
|
+
private readonly tickIntervalMs;
|
|
3536
|
+
private unsubscribers;
|
|
3537
|
+
private watched;
|
|
3538
|
+
private lastPublished;
|
|
3539
|
+
private lastGraphSignature?;
|
|
3540
|
+
private annotatedOutputNodeIds;
|
|
3541
|
+
readonly store: StoreApi<RealtimeRunnerStore>;
|
|
3542
|
+
constructor(system: System, executionRegistry?: IRegistry);
|
|
3543
|
+
getEngine(): Engine | undefined;
|
|
3544
|
+
/**
|
|
3545
|
+
* Get a value from a node's output socket, if available.
|
|
3546
|
+
*/
|
|
3547
|
+
getNodeOutputValue(nodeId: string, outputName: string): unknown;
|
|
3548
|
+
/**
|
|
3549
|
+
* Register interest in a particular node output. Used to keep the preview runner efficient.
|
|
3550
|
+
*/
|
|
3551
|
+
watchNodeOutput(nodeId: string, outputName: string): () => void;
|
|
3552
|
+
start(): void;
|
|
3553
|
+
stop(): void;
|
|
3554
|
+
triggerNode(nodeId: string): void;
|
|
3555
|
+
private ensureTicking;
|
|
3556
|
+
private nowMs;
|
|
3557
|
+
private startTickLoop;
|
|
3558
|
+
private stopTickLoop;
|
|
3559
|
+
private scheduleNextTick;
|
|
3560
|
+
private scheduleEvaluate;
|
|
3561
|
+
private stripNonSemanticMetadata;
|
|
3562
|
+
private computeGraphSignature;
|
|
3563
|
+
private mergeNodeAnnotationsIntoMetadata;
|
|
3564
|
+
private isRealtimeOutputNode;
|
|
3565
|
+
private rebuildAnnotatedOutputNodeCache;
|
|
3566
|
+
private resolveSocketValueForPreview;
|
|
3567
|
+
private recalculateAnnotatedOutputNodes;
|
|
3568
|
+
/**
|
|
3569
|
+
* Evaluate every node that a UI consumer is actively watching.
|
|
3570
|
+
*
|
|
3571
|
+
* Pure function graphs (e.g. the image nodes) never run during
|
|
3572
|
+
* `executeAllSync()` because nothing pushes a flow fiber through them. They
|
|
3573
|
+
* are normally pulled lazily when a downstream flow/event node reads their
|
|
3574
|
+
* value. In the editor preview there is no such consumer, so the act of a
|
|
3575
|
+
* component calling `watchNodeOutput()` is what drives evaluation: we resolve
|
|
3576
|
+
* the node's upstream function graph and execute the node itself so its
|
|
3577
|
+
* sockets hold a fresh value for `publishWatchedOutputs()` to read.
|
|
3578
|
+
*
|
|
3579
|
+
* This intentionally does not depend on the `ui.realtime` annotation , any
|
|
3580
|
+
* watched output is evaluated.
|
|
3581
|
+
*/
|
|
3582
|
+
private recalculateWatchedOutputs;
|
|
3583
|
+
/**
|
|
3584
|
+
* Resolve a single function node's inputs (recursively executing its upstream
|
|
3585
|
+
* function graph) and execute it. Non-function nodes keep whatever value their
|
|
3586
|
+
* last real execution produced. Resilient: a failure on one node is logged and
|
|
3587
|
+
* does not abort evaluation of the others.
|
|
3588
|
+
*/
|
|
3589
|
+
private evaluateNodeForPreview;
|
|
3590
|
+
private rebuildEngine;
|
|
3591
|
+
private publishWatchedOutputs;
|
|
3592
|
+
private evaluate;
|
|
3593
|
+
private tick;
|
|
3594
|
+
}
|
|
3595
|
+
//#endregion
|
|
3596
|
+
export { AUTOSAVE_DEFAULTS, AUTOSAVE_ENABLED, AUTOSAVE_INTERVAL_SECONDS, AUTOSAVE_MAX_COPIES, AUTOSAVE_SETTINGS, AUTOSAVE_STORAGE_KEY, ActiveGraphStore, AddNodeMessage, AffectedNodesMessage, AlignmentAxis, AlignmentType, AnnotatedOutput, AuthCredentials, AutosavePluginOptions, BACKUP_PANEL_TAB_ID, BackupController, BackupControllerStore, BackupSnapshot, BackupStorage, BasePanel, BatchGetStatusMessage, BatchRunStartedMessage, BatchStatusMessage, BehaveNodeProps, CapabilitiesMessage, CloseSessionMessage, Command, CommandContext, CommandStore, CompletedMessage, ConnectionConfig, ConnectionInfo, ContextMenuItem, ContextMenuStore, ContextMenuTarget, ContributionApplier, ContributionResolver, ControlComponent, ControlProps, ControlsStore, ConversionRule, ConversionStore, CreateLinkMessage, CreateSessionMessage, DEFAULT_SETTINGS, DefaultSessionFactory, DirectExecuteNodeMessage, Direction, DocumentationStore, EditorProvider, EditorPubSys, EditorSettingsJSON, System as EditorSystem, System, ErrorCode, ErrorMessage, EventEmittedMessage, EventFilter, ExtendedNodeSpecJSON, FloatingToolbar, Flow, GetCapabilitiesMessage, GetNodeTypesMessage, GetRunHistoryMessage, GetServerEventsMessage, GetServerVariablesMessage, GetSocketConstraintsMessage, GetStatusMessage, GraphListMessage, GraphProvider, GraphProviderProps, GraphPubSys, GraphRegisteredMessage, GraphRunController, GraphRunner, GraphRunnerCapabilities, GraphRunnerClient, GraphRunnerClientConfig, GraphRunnerClientPluginOptions, GraphRunnerClientStore, GraphRunnerMessage, GraphRunnerPanel, GraphSession, HelloMessage, IExecutionControl, IGraphSession, IMenuItemElement, INodeRegistry, ISystem, ITransport, Icon, InputSocketProps, LAYOUT_TYPE, LEGACY_COMMENT_NODE_TYPE, LayoutAlgorithm, LayoutController, LayoutType, LinkCreatedMessage, LinkRemovedMessage, ListGraphsMessage, LoadManifestOptions, LoadablePlugin, LocalGraphRunnerPanel, LocalGraphRunnerPluginOptions, LocalGraphRunnerStore, LocalTransport, LogMessage, MIN_INTERVAL_SECONDS, ManifestPluginOptions, MenuItemElement, MessageActivity, NOTE_NODE_TYPE, Node, NodeAddedMessage, NodeDocumentation, NodeMetadata, NodeParamUpdatedMessage, NodePicker, NodePickerFilters, NodePickerProps, NodePickerViewMode, NodeRemovedMessage, NodeSocket, NodeTypesMessage, NoteNode, Options, OutputSocketProps, PersistenceAdapter, PingMessage, Plugin, PluginOpts, PongMessage, PubSys, RealtimeRunner, RealtimeRunnerStore, RegisterGraphMessage, RemoveLinkMessage, RemoveNodeMessage, ResumeSessionMessage, RunControllerStore, RunGraphMessage, RunHistoryMessage, RunPerformance, RunStartedMessage, RunStatus, ServerEvent, ServerEventsMessage, ServerGraphListMessage, ServerGraphRegisteredMessage, ServerGraphRunnerMessage, ServerPongMessage, ServerVariable, ServerVariablesMessage, ServerWelcomeMessage, Session, SessionClosedMessage, SessionConfig, SessionCreatedMessage, SessionExtension, SessionExtensionCleanup, SessionFactory, SessionHooks, SessionManager, SessionResumedMessage, SettingControlProps, SettingDescriptor, SettingEnumOption, SettingsSchemaStore, SettingsStorage, SettingsValues, SocketConstraint, SocketConstraintsMessage, SocketGenerator, SocketGeneratorNode, SocketGeneratorRenderProps, SocketGeneratorStore, Specific, SpecificNode, SpecificRenderProps, SpecificStore, StatusMessage, StopGraphMessage, StoppedMessage, SubscribeMessage, SystemContext, SystemProvider, SystemProviderProps, ToolbarButton, ToolbarButtonGroup, ToolbarStore, TraceBatchEvent, TraceBatchMessage, TraceMessage, TransportConfig, TransportState, UIGraphData, UIGraphJSON, UnsubscribeMessage, UpdateNodeParamMessage, UpdateSocketValueMessage, ValidateGraphMessage, ValidationResultMessage, ValueTypeMetadata, Variable, VariableChangedMessage, VariableJSON, WebSocketTransport, WebWorkerGraphRunnerPanel, WebWorkerGraphRunnerPluginOptions, WebWorkerGraphRunnerStore, WelcomeMessage, WorkerTransport, alignmentPlugin, annotatedTitle, applyAutoLayout, applyContribution, applyDagreLayout, applyElkLayout, autoLayout, autosavePlugin, behaveToFlow, calculateNewEdge, categoryColorMap, commandStoreFactory, contextMenuStoreFactory, contributionAppliers, controlsStoreFactory, conversionStoreFactory, defaultPersistenceAdapter, deleteNote, description, docsPlugin, docsPluginLoader, documentationStoreFactory, downloadJson, duplicateNote, executing, extractNodeMetadata, flowToBehave, getNodePickerFilters, getSocketsByNodeTypeAndHandleType, graphRunnerClientPlugin, graphRunnerClientPluginLoader, graphRunnerClientStoreFactory, hasPositionMetaData, hidden, installPersistence, isHandleConnected, isNoteNode, isValidConnection, kitchenSinkPlugin, layerId, layoutPlugin, loadManifest, localGraphRunnerPlugin, localGraphRunnerPluginLoader, localGraphRunnerStoreFactory, manifestPlugin, manifestPluginLoader, nonDeletable, noteAt, notesPlugin, passthroughValueType, pinned, plugin, readonly, realtime, registerDefaultCommands, registerDefaultContextMenu, registerDefaults, reorderNote, resetable, serializeVariable, settingsSchemaStoreFactory, setupSessionActions, sleep, socketGeneratorStoreFactory, specificStoreFactory, subscribeToRef, supportsExecutionControl, toolbarStoreFactory, uiVersion, useActiveGraph, useBehaveGraphFlow, useChangeNodeData, useEditor, useFlowHandlers, useGraph, useOnPressKey, useRefFromStore, useSystem, webWorkerGraphRunnerPlugin, webWorkerGraphRunnerPluginLoader, webWorkerGraphRunnerStoreFactory, writeVariablesToJSON };
|
|
2282
3597
|
//# sourceMappingURL=index.d.ts.map
|