@kiberon-labs/behave-graph-flow 1.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/.fallowrc.json +16 -0
- package/.storybook/main.ts +32 -0
- package/.storybook/manager.ts +6 -0
- package/.storybook/preview.ts +64 -0
- package/.storybook/styles.css +16 -0
- package/.turbo/turbo-build.log +7 -0
- package/CHANGELOG.md +368 -0
- package/LICENSE +6 -0
- package/README.md +2 -2
- package/data/Polynomial.json +510 -0
- package/data/sequence.json +337 -0
- package/data/trigger-event.json +241 -0
- package/data/variable-change.json +210 -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/entry.css +4 -0
- package/dist/index.css +42 -0
- package/dist/index.css.map +1 -0
- package/dist/index.d.ts +3597 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +18009 -0
- package/dist/index.js.map +1 -0
- 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/notifications.md +246 -0
- package/docs/protocol.md +702 -0
- package/docs/specifics.md +191 -0
- package/package.json +82 -22
- package/postcss.config.ts +3 -4
- package/src/annotations/index.ts +32 -0
- package/src/components/FloatingToolbar/index.module.css +37 -0
- package/src/components/FloatingToolbar/index.tsx +256 -0
- package/src/components/Flow.tsx +287 -75
- package/src/components/contextMenus/DynamicContextMenu.tsx +85 -0
- package/src/components/contextMenus/NodePicker.module.css +274 -0
- package/src/components/contextMenus/NodePicker.tsx +481 -0
- package/src/components/contextMenus/edge.tsx +22 -0
- package/src/components/contextMenus/node.tsx +15 -0
- package/src/components/contextMenus/selection.tsx +11 -0
- package/src/components/controls/any/AnyControlImpl.tsx +14 -0
- package/src/components/controls/any/index.tsx +19 -0
- package/src/components/controls/boolean/index.tsx +13 -0
- package/src/components/controls/colorPicker/InputPopover.module.css +100 -0
- package/src/components/controls/colorPicker/InputPopover.tsx +31 -0
- package/src/components/controls/colorPicker/index.module.css +18 -0
- package/src/components/controls/colorPicker/index.tsx +61 -0
- package/src/components/controls/number/index.tsx +35 -0
- package/src/components/controls/string/index.tsx +16 -0
- package/src/components/edges/index.tsx +475 -0
- package/src/components/edges/offsetBezier.ts +134 -0
- package/src/components/hotKeys.tsx +20 -0
- package/src/components/layoutController/index.module.css +13 -0
- package/src/components/layoutController/index.tsx +140 -0
- package/src/components/layoutController/utils.ts +248 -0
- package/src/components/menubar/defaults.tsx +516 -0
- package/src/components/menubar/index.tsx +49 -0
- package/src/components/menubar/menuItem.module.css +31 -0
- package/src/components/menubar/menuItem.tsx +65 -0
- package/src/components/nodes/behave/Node.module.css +23 -0
- package/src/components/nodes/behave/Node.tsx +176 -0
- package/src/components/nodes/behave/NodeContainer.module.css +88 -0
- package/src/components/nodes/behave/NodeContainer.tsx +46 -0
- package/src/components/nodes/behave/index.tsx +14 -0
- package/src/components/nodes/group/index.tsx +109 -0
- package/src/components/nodes/wrapper/index.tsx +73 -0
- package/src/components/nodes/wrapper/styles.module.css +87 -0
- package/src/components/notifications/NotificationProvider.tsx +81 -0
- package/src/components/notifications/index.ts +2 -0
- package/src/components/notifications/utils.ts +71 -0
- package/src/components/panels/alignment/index.module.css +10 -0
- package/src/components/panels/alignment/index.tsx +244 -0
- package/src/components/panels/base/index.tsx +5 -0
- package/src/components/panels/base/styles.module.css +12 -0
- 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 +324 -0
- package/src/components/panels/events/ManageEventsPanel.tsx +101 -0
- package/src/components/panels/events/index.tsx +23 -0
- package/src/components/panels/events/styles.module.css +178 -0
- package/src/components/panels/graphProperties/index.tsx +125 -0
- package/src/components/panels/history/index.tsx +92 -0
- package/src/components/panels/history/styles.module.css +97 -0
- package/src/components/panels/keymaps/index.module.css +68 -0
- package/src/components/panels/keymaps/index.tsx +166 -0
- package/src/components/panels/layers/index.tsx +245 -0
- package/src/components/panels/layers/styles.module.css +107 -0
- package/src/components/panels/legend/index.module.css +6 -0
- package/src/components/panels/legend/index.tsx +76 -0
- package/src/components/panels/logs/index.module.css +218 -0
- package/src/components/panels/logs/index.tsx +288 -0
- package/src/components/panels/nodeInputs/InputControl.tsx +63 -0
- package/src/components/panels/nodeInputs/InputsGroup.tsx +65 -0
- package/src/components/panels/nodeInputs/MultipleNodesView.tsx +37 -0
- package/src/components/panels/nodeInputs/NodeSettings.tsx +92 -0
- package/src/components/panels/nodeInputs/NodeTitleEditor.tsx +125 -0
- package/src/components/panels/nodeInputs/OutputsGroup.tsx +55 -0
- package/src/components/panels/nodeInputs/SocketGenerators.tsx +32 -0
- package/src/components/panels/nodeInputs/index.module.css +308 -0
- package/src/components/panels/nodeInputs/index.tsx +349 -0
- package/src/components/panels/nodeInputs/useNodeHandlers.ts +76 -0
- package/src/components/panels/nodeInputs/useNodeInputsData.ts +153 -0
- package/src/components/panels/nodePicker/index.tsx +115 -0
- package/src/components/panels/panel/index.module.css +66 -0
- package/src/components/panels/panel/index.tsx +88 -0
- package/src/components/panels/search/index.module.css +16 -0
- package/src/components/panels/search/index.tsx +215 -0
- package/src/components/panels/systemSettings/ConversionsSettings.tsx +203 -0
- package/src/components/panels/systemSettings/index.tsx +251 -0
- package/src/components/panels/systemSettings/styles.module.css +138 -0
- package/src/components/panels/traces/GridLines.tsx +38 -0
- package/src/components/panels/traces/TimeGrid.tsx +48 -0
- package/src/components/panels/traces/TraceLane.tsx +62 -0
- package/src/components/panels/traces/TraceTooltip.tsx +22 -0
- package/src/components/panels/traces/TracesHeader.tsx +56 -0
- package/src/components/panels/traces/index.module.css +159 -0
- package/src/components/panels/traces/index.tsx +298 -0
- package/src/components/panels/traces/types.ts +48 -0
- package/src/components/panels/traces/useDerivedSpans.ts +307 -0
- package/src/components/panels/traces/utils.ts +33 -0
- package/src/components/panels/variables/CreateVariableScreen.tsx +162 -0
- package/src/components/panels/variables/ManageVariablesScreen.tsx +147 -0
- package/src/components/panels/variables/index.tsx +125 -0
- package/src/components/panels/variables/styles.module.css +149 -0
- package/src/components/primitives/icon.module.css +45 -0
- package/src/components/primitives/icon.tsx +38 -0
- package/src/components/sockets/input/index.tsx +83 -0
- package/src/components/sockets/input/styles.module.css +26 -0
- package/src/components/sockets/output/index.tsx +68 -0
- package/src/components/sockets/output/styles.module.css +22 -0
- package/src/css/notes.css +135 -0
- package/src/css/prosemirror.css +57 -0
- package/src/css/rc-dock.css +212 -0
- package/src/css/rc-menu.css +101 -0
- package/src/css/themes/kiberon.css +127 -0
- package/src/css/vars.css +198 -0
- package/src/css/vscode-elements.css +124 -0
- package/src/entry.css +4 -0
- package/src/generators/CallSubgraphGenerator.tsx +136 -0
- package/src/generators/CustomEventOnTriggeredGenerator.tsx +85 -0
- package/src/generators/GraphBoundaryGenerator.module.css +32 -0
- package/src/generators/GraphBoundaryGenerator.tsx +193 -0
- package/src/generators/SequenceGenerator.tsx +104 -0
- package/src/generators/SwitchOnIntegerGenerator.tsx +256 -0
- package/src/generators/SwitchOnStringGenerator.tsx +263 -0
- package/src/generators/callSubgraphSync.ts +126 -0
- package/src/generators/registerDefaultGenerators.ts +55 -0
- package/src/generators/registerDefaults.ts +26 -0
- package/src/hooks/useBehaveGraphFlow.ts +17 -16
- package/src/hooks/useFlowHandlers.ts +154 -30
- package/src/hooks/useWasdPan.ts +210 -0
- package/src/index.css +134 -0
- package/src/index.ts +53 -18
- 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 +91 -0
- 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 +297 -0
- package/src/plugin/docs/panel/DocumentationBrowserPanelImpl.tsx +200 -0
- package/src/plugin/docs/panel/index.tsx +21 -0
- package/src/plugin/docs/panel/styles.module.css +174 -0
- package/src/plugin/graphrunner/actions.ts +326 -0
- package/src/plugin/graphrunner/buttons.tsx +95 -0
- package/src/plugin/graphrunner/client.ts +707 -0
- package/src/plugin/graphrunner/index.tsx +184 -0
- package/src/plugin/graphrunner/panel.tsx +386 -0
- package/src/plugin/graphrunner/runController.ts +283 -0
- package/src/plugin/graphrunner/runner.ts +187 -0
- package/src/plugin/graphrunner/session.ts +243 -0
- package/src/plugin/graphrunner/store.ts +196 -0
- package/src/plugin/graphrunner/styles.module.css +171 -0
- package/src/plugin/graphrunner/transport.ts +250 -0
- package/src/plugin/graphrunner/types.ts +693 -0
- package/src/plugin/graphrunner-local/execution-utils.ts +637 -0
- package/src/plugin/graphrunner-local/index.tsx +172 -0
- package/src/plugin/graphrunner-local/panel.tsx +187 -0
- package/src/plugin/graphrunner-local/store.ts +41 -0
- package/src/plugin/graphrunner-local/styles.module.css +82 -0
- package/src/plugin/graphrunner-local/transport.ts +1339 -0
- package/src/plugin/graphrunner-local/types.ts +10 -0
- package/src/plugin/graphrunner-webworker/graph-executor.worker.ts +635 -0
- package/src/plugin/graphrunner-webworker/index.tsx +140 -0
- package/src/plugin/graphrunner-webworker/panel.tsx +173 -0
- package/src/plugin/graphrunner-webworker/store.ts +98 -0
- package/src/plugin/graphrunner-webworker/worker-transport.ts +123 -0
- package/src/plugin/kitchen-sink/index.ts +38 -0
- package/src/plugin/layout/dagre.ts +131 -0
- package/src/plugin/layout/elk.ts +216 -0
- 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 +624 -0
- package/src/specifics/CustomEventOnTriggeredSpecific.tsx +92 -0
- package/src/specifics/CustomEventTriggerSpecific.tsx +141 -0
- package/src/specifics/VariableGetSpecific.tsx +110 -0
- package/src/specifics/VariableSetSpecific.tsx +110 -0
- package/src/store/actions.tsx +698 -0
- package/src/store/commands.ts +278 -0
- package/src/store/contextMenu.ts +192 -0
- package/src/store/controls.tsx +62 -0
- package/src/store/conversions.ts +47 -0
- package/src/store/documentation.tsx +69 -0
- package/src/store/events.tsx +116 -0
- package/src/store/flow.tsx +230 -0
- package/src/store/graphMeta.ts +39 -0
- package/src/store/hotKeys.tsx +364 -0
- package/src/store/layers.ts +259 -0
- package/src/store/legend.tsx +76 -0
- package/src/store/logs.ts +28 -0
- package/src/store/menubar.ts +41 -0
- package/src/store/refs.ts +84 -0
- package/src/store/registry.ts +51 -0
- package/src/store/selection.ts +22 -0
- package/src/store/settings.ts +99 -0
- package/src/store/settingsSchema.ts +210 -0
- package/src/store/socketGenerator.tsx +54 -0
- package/src/store/specific.tsx +75 -0
- package/src/store/specs.tsx +35 -0
- package/src/store/tabs.ts +282 -0
- package/src/store/toolbar.tsx +45 -0
- package/src/store/traces.ts +240 -0
- package/src/store/variables.ts +37 -0
- package/src/system/graph.ts +131 -0
- package/src/system/graphSession.ts +172 -0
- package/src/system/index.ts +6 -0
- package/src/system/notifications.ts +111 -0
- package/src/system/persistence.ts +82 -0
- package/src/system/plugin.ts +55 -0
- package/src/system/provider.tsx +86 -0
- package/src/system/pubsub.ts +323 -0
- package/src/system/system.ts +653 -0
- package/src/system/tabLoader.tsx +303 -0
- package/src/system/undoRedo.ts +103 -0
- package/src/transformers/Uigraph.ts +61 -0
- package/src/transformers/behaveToFlow.ts +16 -4
- package/src/transformers/contract.ts +87 -0
- package/src/transformers/flowToBehave.ts +40 -12
- package/src/types/NodeMetadata.ts +27 -0
- package/src/types/graph.ts +49 -0
- package/src/types/nodes.ts +50 -0
- package/src/types.ts +18 -0
- package/src/util/autoConvert.ts +200 -0
- package/src/util/colors.ts +1 -29
- package/src/util/downloadJson.ts +18 -0
- package/src/util/extractNodeMetadata.ts +16 -0
- package/src/util/getPickerFilters.ts +1 -1
- package/src/util/isBehaveNode.ts +6 -0
- package/src/util/isValidConnection.ts +51 -17
- package/src/util/mergeSockets.ts +29 -0
- package/src/util/serializeVariables.ts +66 -0
- package/src/util/sockets.ts +43 -0
- package/stories/apex/layoutController/example-graph.worker.ts +39 -0
- package/stories/apex/layoutController/index.stories.tsx +48 -0
- package/stories/apex/layoutController/webworker.stories.tsx +103 -0
- package/stories/apex/menubar/menubar.stories.tsx +19 -0
- package/stories/components/colorpicker/index.stories.tsx +20 -0
- package/stories/components/contextMenus/edge.stories.tsx +32 -0
- package/stories/components/contextMenus/node.stories.tsx +26 -0
- package/stories/components/contextMenus/nodePicker.stories.tsx +115 -0
- package/stories/components/controls/any/index.stories.tsx +19 -0
- package/stories/components/controls/boolean/index.stories.tsx +19 -0
- package/stories/components/controls/colorPicker/index.stories.tsx +49 -0
- package/stories/components/controls/number/index.stories.tsx +19 -0
- package/stories/components/controls/string/index.stories.tsx +19 -0
- package/stories/components/nodes/behaveNode.stories.tsx +108 -0
- package/stories/components/panels/alignment.stories.tsx +24 -0
- package/stories/components/panels/events.stories.tsx +38 -0
- package/stories/components/panels/graphRunner.stories.tsx +317 -0
- package/stories/components/panels/history.stories.tsx +37 -0
- package/stories/components/panels/keymaps.stories.tsx +21 -0
- package/stories/components/panels/legend.stories.tsx +37 -0
- package/stories/components/panels/logs.stories.tsx +24 -0
- package/stories/components/panels/nodeInputs.stories.tsx +21 -0
- package/stories/components/panels/nodePicker.stories.tsx +37 -0
- package/stories/components/panels/panel.stories.tsx +39 -0
- package/stories/components/panels/search.stories.tsx +24 -0
- package/stories/components/panels/systemSettings.stories.tsx +26 -0
- package/stories/components/panels/traces.stories.tsx +225 -0
- package/stories/components/panels/variables.stories.tsx +24 -0
- package/stories/defaults/defaultStoryProvider.tsx +170 -0
- package/stories/defaults/systemGenerator.ts +43 -0
- package/stories/plugins/notes.stories.tsx +100 -0
- 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/components/edges/offsetBezier.test.ts +51 -0
- package/tests/components/layoutController/utils.test.ts +68 -0
- package/tests/components/panels/traces/utils.test.ts +52 -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 +27 -4
- 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/notifications.test.ts +87 -0
- package/tests/persistence.test.ts +51 -0
- package/tests/saveLoad.test.ts +373 -0
- package/tests/settings.test.ts +178 -0
- package/tests/traceStore.test.ts +46 -0
- package/tests/util/calculateNewEdge.test.ts +98 -0
- package/tests/util/getSocketsByNodeTypeAndHandleType.test.ts +31 -0
- package/tests/util/hasPositionMetaData.test.ts +33 -0
- package/tests/util/isBehaveNode.test.ts +22 -0
- package/tests/util/isHandleConnected.test.ts +37 -0
- package/tests/util/mergeSockets.test.ts +43 -0
- package/tests/visual/README.md +64 -0
- package/tests/visual/__screenshots__/panels.visual.test.tsx/panel-alignment-chromium-win32.png +0 -0
- 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-traces-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 +76 -0
- package/tests/wasdPan.test.ts +71 -0
- package/tsconfig.base.json +39 -0
- package/tsconfig.json +18 -59
- package/tsconfig.prod.json +23 -0
- package/tsdown.config.ts +15 -3
- package/typedoc.json +7 -7
- package/vite.config.js +7 -0
- package/vitest.config.ts +5 -2
- package/vitest.visual.config.ts +55 -0
- package/src/components/AutoSizeInput.tsx +0 -65
- package/src/components/Controls.tsx +0 -87
- package/src/components/InputSocket.tsx +0 -142
- package/src/components/Node.tsx +0 -68
- package/src/components/NodeContainer.tsx +0 -46
- package/src/components/NodePicker.tsx +0 -77
- package/src/components/OutputSocket.tsx +0 -58
- package/src/components/modals/ClearModal.tsx +0 -40
- package/src/components/modals/HelpModal.tsx +0 -36
- package/src/components/modals/LoadModal.tsx +0 -96
- package/src/components/modals/Modal.tsx +0 -64
- package/src/components/modals/SaveModal.tsx +0 -60
- package/src/hooks/useCustomNodeTypes.tsx +0 -31
- package/src/hooks/useGraphRunner.ts +0 -104
- package/src/hooks/useMergeMap.ts +0 -14
- package/src/hooks/useNodeSpecJson.ts +0 -20
- package/src/hooks/useQueriableDefinitions.ts +0 -22
- package/src/styles.css +0 -8
- package/tailwind.config.ts +0 -19
- package/tests/tsconfig.json +0 -10
- /package/src/{types.d.ts → types-declarations.d.ts} +0 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,3597 @@
|
|
|
1
|
+
import * as react0 from "react";
|
|
2
|
+
import React$1, { ComponentType, FC, MouseEvent as MouseEvent$1, ReactNode } from "react";
|
|
3
|
+
import * as reactflow0 from "reactflow";
|
|
4
|
+
import { Connection, ConnectionStatus, Edge, EdgeChange, EdgeProps, Node as Node$1, NodeChange, NodeProps, OnConnectStartParams, ReactFlowInstance, Viewport, XYPosition } from "reactflow";
|
|
5
|
+
import * as zustand5 from "zustand";
|
|
6
|
+
import { StoreApi } from "zustand";
|
|
7
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
8
|
+
import * as _kiberon_labs_behave_graph0 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";
|
|
11
|
+
import { Item } from "rc-menu";
|
|
12
|
+
import { LayoutBase, TabBase, TabData } from "rc-dock";
|
|
13
|
+
import { Renderable, Toast } from "react-hot-toast";
|
|
14
|
+
|
|
15
|
+
//#region src/components/sockets/input/index.d.ts
|
|
16
|
+
type InputSocketProps = {
|
|
17
|
+
hide: boolean;
|
|
18
|
+
hideName?: boolean;
|
|
19
|
+
connected: boolean;
|
|
20
|
+
value: any | undefined;
|
|
21
|
+
label?: string;
|
|
22
|
+
onChange: (key: string, value: any) => void;
|
|
23
|
+
specJSON: NodeSpecJSON[];
|
|
24
|
+
} & InputSocketSpecJSON;
|
|
25
|
+
//#endregion
|
|
26
|
+
//#region src/types.d.ts
|
|
27
|
+
interface SocketBase {
|
|
28
|
+
name: string;
|
|
29
|
+
key: string;
|
|
30
|
+
/** Optional display label; falls back to `name` when absent. */
|
|
31
|
+
label?: string;
|
|
32
|
+
choices?: ChoiceJSON;
|
|
33
|
+
valueType: string;
|
|
34
|
+
defaultValue?: any;
|
|
35
|
+
}
|
|
36
|
+
interface DynamicPorts {
|
|
37
|
+
inputs?: SocketBase[];
|
|
38
|
+
outputs?: SocketBase[];
|
|
39
|
+
}
|
|
40
|
+
//#endregion
|
|
41
|
+
//#region src/types/nodes.d.ts
|
|
42
|
+
/**
|
|
43
|
+
* These are the behave nodes in the scene
|
|
44
|
+
*/
|
|
45
|
+
type IBehaveNode = Omit<Node$1, 'data' | 'type'> & {
|
|
46
|
+
type: 'behaveNode';
|
|
47
|
+
data: {
|
|
48
|
+
annotations?: Record<string, any>;
|
|
49
|
+
type: string;
|
|
50
|
+
dynamicPorts: DynamicPorts;
|
|
51
|
+
ports?: Record<string, any>;
|
|
52
|
+
configuration: Record<string, any>;
|
|
53
|
+
};
|
|
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
|
+
};
|
|
68
|
+
//#endregion
|
|
69
|
+
//#region src/components/nodes/behave/Node.d.ts
|
|
70
|
+
type BehaveNodeProps = NodeProps<IBehaveNode['data']> & {
|
|
71
|
+
spec: NodeSpecJSON;
|
|
72
|
+
allSpecs: NodeSpecJSON[];
|
|
73
|
+
};
|
|
74
|
+
declare const Node: ({
|
|
75
|
+
id,
|
|
76
|
+
data,
|
|
77
|
+
spec,
|
|
78
|
+
selected,
|
|
79
|
+
allSpecs
|
|
80
|
+
}: BehaveNodeProps) => react_jsx_runtime0.JSX.Element | null;
|
|
81
|
+
//#endregion
|
|
82
|
+
//#region src/components/Flow.d.ts
|
|
83
|
+
declare const Flow: React$1.FC;
|
|
84
|
+
//#endregion
|
|
85
|
+
//#region src/components/FloatingToolbar/index.d.ts
|
|
86
|
+
declare const FloatingToolbar: React$1.FC;
|
|
87
|
+
//#endregion
|
|
88
|
+
//#region src/store/documentation.d.ts
|
|
89
|
+
/**
|
|
90
|
+
* Documentation metadata for a node type
|
|
91
|
+
*/
|
|
92
|
+
type NodeDocumentation = {
|
|
93
|
+
/** The node type this documentation applies to */
|
|
94
|
+
type: string;
|
|
95
|
+
/** Optional icon to display for the node */
|
|
96
|
+
icon?: React$1.ReactNode;
|
|
97
|
+
/** Short description (one line) */
|
|
98
|
+
shortDescription?: string;
|
|
99
|
+
/** Tags for categorization and search */
|
|
100
|
+
tags?: string[];
|
|
101
|
+
/** Long rich markdown description */
|
|
102
|
+
markdownDescription?: string;
|
|
103
|
+
};
|
|
104
|
+
type DocumentationStore = {
|
|
105
|
+
/** Map of node type to documentation */
|
|
106
|
+
docs: Map<string, NodeDocumentation>;
|
|
107
|
+
/** Set documentation for a specific node type */
|
|
108
|
+
setDocumentation: (type: string, doc: Omit<NodeDocumentation, 'type'>) => void;
|
|
109
|
+
/** Set documentation for multiple node types at once */
|
|
110
|
+
setMultipleDocumentation: (docs: NodeDocumentation[]) => void;
|
|
111
|
+
/** Get documentation for a specific node type */
|
|
112
|
+
getDocumentation: (type: string) => NodeDocumentation | undefined;
|
|
113
|
+
/** Clear all documentation */
|
|
114
|
+
clearDocumentation: () => void;
|
|
115
|
+
/** Remove documentation for a specific type */
|
|
116
|
+
removeDocumentation: (type: string) => void;
|
|
117
|
+
};
|
|
118
|
+
declare const documentationStoreFactory: () => zustand5.UseBoundStore<zustand5.StoreApi<DocumentationStore>>;
|
|
119
|
+
//#endregion
|
|
120
|
+
//#region src/components/contextMenus/NodePicker.d.ts
|
|
121
|
+
type NodePickerFilters = {
|
|
122
|
+
handleType: 'source' | 'target';
|
|
123
|
+
valueType: string;
|
|
124
|
+
};
|
|
125
|
+
type NodePickerViewMode = 'list' | 'grid' | 'tree';
|
|
126
|
+
type ExtendedNodeSpecJSON = NodeSpecJSON & {
|
|
127
|
+
nodeType?: string;
|
|
128
|
+
description?: string;
|
|
129
|
+
icon?: React$1.ReactNode;
|
|
130
|
+
tags?: string[];
|
|
131
|
+
markdownDescription?: string;
|
|
132
|
+
};
|
|
133
|
+
type NodePickerProps = {
|
|
134
|
+
position: XYPosition;
|
|
135
|
+
filters?: NodePickerFilters;
|
|
136
|
+
onPickNode: (node: ExtendedNodeSpecJSON, position: XYPosition) => void;
|
|
137
|
+
onClose: () => void;
|
|
138
|
+
specJSON: ExtendedNodeSpecJSON[];
|
|
139
|
+
documentation?: Map<string, NodeDocumentation>;
|
|
140
|
+
onShowDocumentation?: (nodeType: string) => void;
|
|
141
|
+
defaultViewMode?: NodePickerViewMode;
|
|
142
|
+
};
|
|
143
|
+
declare const NodePicker: React$1.FC<NodePickerProps>;
|
|
144
|
+
//#endregion
|
|
145
|
+
//#region src/components/sockets/output/index.d.ts
|
|
146
|
+
type OutputSocketProps = {
|
|
147
|
+
connected: boolean;
|
|
148
|
+
hide?: boolean;
|
|
149
|
+
label?: string;
|
|
150
|
+
specJSON: NodeSpecJSON[];
|
|
151
|
+
} & OutputSocketSpecJSON;
|
|
152
|
+
//#endregion
|
|
153
|
+
//#region src/components/menubar/menuItem.d.ts
|
|
154
|
+
type IMenuItemElement = React$1.ComponentProps<typeof Item> & {
|
|
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;
|
|
166
|
+
/**
|
|
167
|
+
* Needed to hack into the inner part of the menu item
|
|
168
|
+
*/
|
|
169
|
+
inner?: (children: React$1.ReactNode) => React$1.ReactNode;
|
|
170
|
+
};
|
|
171
|
+
/**
|
|
172
|
+
* You must provide a unique key for each item
|
|
173
|
+
*/
|
|
174
|
+
declare const MenuItemElement: ({
|
|
175
|
+
inner,
|
|
176
|
+
children,
|
|
177
|
+
keybinding,
|
|
178
|
+
commandId,
|
|
179
|
+
...rest
|
|
180
|
+
}: IMenuItemElement) => react_jsx_runtime0.JSX.Element;
|
|
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
|
|
200
|
+
//#region src/hooks/useChangeNodeData.d.ts
|
|
201
|
+
declare const useChangeNodeData: (id: string) => (key: string, value: any) => void;
|
|
202
|
+
//#endregion
|
|
203
|
+
//#region src/hooks/useOnPressKey.d.ts
|
|
204
|
+
declare const useOnPressKey: (key: string, callback: (e: KeyboardEvent) => void) => void;
|
|
205
|
+
//#endregion
|
|
206
|
+
//#region src/hooks/useBehaveGraphFlow.d.ts
|
|
207
|
+
/**
|
|
208
|
+
* Hook that returns the nodes and edges for react-flow, and the graphJson for the behave-graph.
|
|
209
|
+
* If nodes or edges are changes, the graph json is updated automatically.
|
|
210
|
+
* The graph json can be set manually, in which case the nodes and edges are updated to match the graph json.
|
|
211
|
+
* @param param0
|
|
212
|
+
* @returns
|
|
213
|
+
*/
|
|
214
|
+
declare const useBehaveGraphFlow: ({
|
|
215
|
+
initialGraphJson,
|
|
216
|
+
specJson
|
|
217
|
+
}: {
|
|
218
|
+
initialGraphJson: GraphJSON;
|
|
219
|
+
specJson: NodeSpecJSON[] | undefined;
|
|
220
|
+
}) => {
|
|
221
|
+
nodes: reactflow0.Node[];
|
|
222
|
+
edges: reactflow0.Edge[];
|
|
223
|
+
onEdgesChange: (changes: reactflow0.EdgeChange[]) => void;
|
|
224
|
+
onNodesChange: (changes: reactflow0.NodeChange[]) => void;
|
|
225
|
+
setGraphJson: (graphJson: GraphJSON) => void;
|
|
226
|
+
graphJson: GraphJSON | undefined;
|
|
227
|
+
};
|
|
228
|
+
//#endregion
|
|
229
|
+
//#region src/hooks/useFlowHandlers.d.ts
|
|
230
|
+
type BehaveGraphFlow = ReturnType<typeof useBehaveGraphFlow>;
|
|
231
|
+
declare const useFlowHandlers: ({
|
|
232
|
+
onEdgesChange,
|
|
233
|
+
onNodesChange,
|
|
234
|
+
nodes,
|
|
235
|
+
specJSON
|
|
236
|
+
}: Pick<BehaveGraphFlow, "onEdgesChange" | "onNodesChange"> & {
|
|
237
|
+
nodes: Node$1[];
|
|
238
|
+
specJSON: NodeSpecJSON[] | undefined;
|
|
239
|
+
}) => {
|
|
240
|
+
onConnect: (connection: Connection) => void;
|
|
241
|
+
handleStartConnect: (e: MouseEvent$1, params: OnConnectStartParams) => void;
|
|
242
|
+
handleStopConnect: (e: MouseEvent, _connectionState: ConnectionStatus) => void;
|
|
243
|
+
handlePaneClick: () => void;
|
|
244
|
+
handlePaneContextMenu: (e: MouseEvent$1) => void;
|
|
245
|
+
lastConnectStart: OnConnectStartParams | undefined;
|
|
246
|
+
nodePickerVisibility: XYPosition | undefined;
|
|
247
|
+
handleAddNode: (spec: ExtendedNodeSpecJSON, position: XYPosition) => void;
|
|
248
|
+
closeNodePicker: () => void;
|
|
249
|
+
nodePickFilters: NodePickerFilters | undefined;
|
|
250
|
+
};
|
|
251
|
+
//#endregion
|
|
252
|
+
//#region src/transformers/behaveToFlow.d.ts
|
|
253
|
+
declare const behaveToFlow: (graph: GraphJSON) => [Node$1[], Edge[]];
|
|
254
|
+
//#endregion
|
|
255
|
+
//#region src/store/tabs.d.ts
|
|
256
|
+
type TabStore = {
|
|
257
|
+
currentPanel?: string;
|
|
258
|
+
layout: LayoutBase;
|
|
259
|
+
setLayout: (layout: LayoutBase) => void;
|
|
260
|
+
setCurrentPanel: (currentPanel: string) => void;
|
|
261
|
+
openTab: (tabId: string, options?: {
|
|
262
|
+
panelId?: string;
|
|
263
|
+
}) => void;
|
|
264
|
+
};
|
|
265
|
+
//#endregion
|
|
266
|
+
//#region src/system/tabLoader.d.ts
|
|
267
|
+
declare class TabLoader {
|
|
268
|
+
readonly tabs: Record<string, () => TabData>;
|
|
269
|
+
private readonly system;
|
|
270
|
+
constructor(system: System);
|
|
271
|
+
load(tab: TabBase): TabData | undefined;
|
|
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;
|
|
279
|
+
}
|
|
280
|
+
//#endregion
|
|
281
|
+
//#region src/store/settings.d.ts
|
|
282
|
+
declare const EDGE_TYPE: {
|
|
283
|
+
readonly bezier: "Bezier";
|
|
284
|
+
readonly smoothStep: "Smooth step";
|
|
285
|
+
readonly straight: "Straight";
|
|
286
|
+
readonly simpleBezier: "Simple Bezier";
|
|
287
|
+
};
|
|
288
|
+
type EdgeType = (typeof EDGE_TYPE)[keyof typeof EDGE_TYPE];
|
|
289
|
+
type GeneratorLocation = 'inline' | 'panel';
|
|
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;
|
|
366
|
+
};
|
|
367
|
+
type SystemSettingsStore = SettingsState & SettingsSetters & SettingsDynamicAccess;
|
|
368
|
+
//#endregion
|
|
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;
|
|
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>;
|
|
452
|
+
//#endregion
|
|
453
|
+
//#region src/store/legend.d.ts
|
|
454
|
+
type LegendStore = {
|
|
455
|
+
icons: Record<string, React.ComponentType>;
|
|
456
|
+
defaultIcon: React.ComponentType;
|
|
457
|
+
valueTypeColors: Record<string, string>;
|
|
458
|
+
categoryColors: Record<string, string>;
|
|
459
|
+
setIcon: (key: string, icon: React.ComponentType) => void;
|
|
460
|
+
setValueTypeColor: (key: string, color: string) => void;
|
|
461
|
+
setCategoryColor: (key: string, color: string) => void;
|
|
462
|
+
};
|
|
463
|
+
//#endregion
|
|
464
|
+
//#region src/store/menubar.d.ts
|
|
465
|
+
type IMenuItem = {
|
|
466
|
+
name: string;
|
|
467
|
+
render: (rest: {
|
|
468
|
+
[key: string]: any;
|
|
469
|
+
}) => React.ReactNode;
|
|
470
|
+
};
|
|
471
|
+
type ISubMenu = {
|
|
472
|
+
title: string;
|
|
473
|
+
name: string;
|
|
474
|
+
items: (IMenuItem | Seperator)[];
|
|
475
|
+
};
|
|
476
|
+
declare class Seperator {}
|
|
477
|
+
type MenuBarStore = {
|
|
478
|
+
show: boolean;
|
|
479
|
+
setShow: (show: boolean) => void;
|
|
480
|
+
items: ISubMenu[];
|
|
481
|
+
setItems: (items: ISubMenu[]) => void;
|
|
482
|
+
setSubMenuItems: (menuName: string, items: (IMenuItem | Seperator)[]) => void;
|
|
483
|
+
};
|
|
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
|
|
590
|
+
//#region src/system/provider.d.ts
|
|
591
|
+
declare const SystemContext: React$1.Context<System | undefined>;
|
|
592
|
+
type SystemProviderProps = {
|
|
593
|
+
children: ReactNode;
|
|
594
|
+
value: System;
|
|
595
|
+
};
|
|
596
|
+
/**
|
|
597
|
+
* Provides the editor-level {@link System} to the React tree.
|
|
598
|
+
*/
|
|
599
|
+
declare function SystemProvider({
|
|
600
|
+
children,
|
|
601
|
+
value
|
|
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
|
+
*/
|
|
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>;
|
|
676
|
+
//#endregion
|
|
677
|
+
//#region src/store/refs.d.ts
|
|
678
|
+
type Refs = {
|
|
679
|
+
reactflow: ReactFlowInstance;
|
|
680
|
+
nodePickerPosition?: XYPosition;
|
|
681
|
+
selectedDocumentationType?: string;
|
|
682
|
+
};
|
|
683
|
+
type RefStore = {
|
|
684
|
+
refs: Refs;
|
|
685
|
+
setRef: <T extends keyof Refs>(key: T, ref: Refs[T]) => void;
|
|
686
|
+
getRef: <T extends keyof Refs>(key: T) => Refs[T] | undefined;
|
|
687
|
+
removeRef: (key: keyof Refs) => void;
|
|
688
|
+
hasRef: (key: keyof Refs) => boolean;
|
|
689
|
+
};
|
|
690
|
+
/**
|
|
691
|
+
* Subscribe to changes of a specific ref
|
|
692
|
+
* @param store - The ref store
|
|
693
|
+
* @param key - The key of the ref to watch
|
|
694
|
+
* @param callback - Callback fired when the ref changes
|
|
695
|
+
* @returns Unsubscribe function
|
|
696
|
+
*/
|
|
697
|
+
declare function subscribeToRef<T extends keyof Refs>(store: StoreApi<RefStore>, key: T, callback: (ref: Refs[T] | undefined) => void): () => void;
|
|
698
|
+
/**
|
|
699
|
+
* Hook to access the current value of a ref from the store
|
|
700
|
+
* @param store - The ref store
|
|
701
|
+
* @param key - The key of the ref
|
|
702
|
+
* @returns The current value of the ref or null
|
|
703
|
+
*/
|
|
704
|
+
declare function useRefFromStore<T extends keyof Refs>(store: StoreApi<RefStore>, key: T): Refs[T] | undefined;
|
|
705
|
+
//#endregion
|
|
706
|
+
//#region src/store/hotKeys.d.ts
|
|
707
|
+
type Handler = (e?: KeyboardEvent) => any;
|
|
708
|
+
type HotkeyStore = {
|
|
709
|
+
keymap: Record<string, string | string[]>;
|
|
710
|
+
handlers: Record<string, Handler>;
|
|
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>;
|
|
715
|
+
register(val: {
|
|
716
|
+
action: string;
|
|
717
|
+
trigger: string | string[];
|
|
718
|
+
description?: string;
|
|
719
|
+
handler?: Handler;
|
|
720
|
+
/** Command id this binding invokes; enables shortcut hints in menus. */
|
|
721
|
+
command?: string;
|
|
722
|
+
}): void;
|
|
723
|
+
registerDescription(action: string, description: string): void;
|
|
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;
|
|
730
|
+
};
|
|
731
|
+
//#endregion
|
|
732
|
+
//#region src/system/pubsub.d.ts
|
|
733
|
+
interface TopicEvents {
|
|
734
|
+
[topic: string]: any;
|
|
735
|
+
}
|
|
736
|
+
type Subscriber<Events extends TopicEvents, K$1 extends keyof Events> = (message: K$1, data: Events[K$1]) => void;
|
|
737
|
+
type AnySubscriber = (message: string, data: any) => void;
|
|
738
|
+
declare class PubSub<Events extends TopicEvents = TopicEvents> {
|
|
739
|
+
private messages;
|
|
740
|
+
private lastUid;
|
|
741
|
+
private static readonly ALL_SUBSCRIBING_MSG;
|
|
742
|
+
private hasKeys;
|
|
743
|
+
private throwException;
|
|
744
|
+
private callSubscriberWithDelayedExceptions;
|
|
745
|
+
private callSubscriberWithImmediateExceptions;
|
|
746
|
+
private deliverMessage;
|
|
747
|
+
private createDeliveryFunction;
|
|
748
|
+
private hasDirectSubscribersFor;
|
|
749
|
+
private messageHasSubscribers;
|
|
750
|
+
private internalPublish;
|
|
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;
|
|
755
|
+
subscribeAll(func: AnySubscriber): string | false;
|
|
756
|
+
subscribeOnce<K$1 extends keyof Events & string>(message: K$1, func: Subscriber<Events, K$1>): this;
|
|
757
|
+
clearAllSubscriptions(): void;
|
|
758
|
+
clearSubscriptions(topic: string): void;
|
|
759
|
+
countSubscriptions(topic: string): number;
|
|
760
|
+
getSubscriptions(topic: string): string[];
|
|
761
|
+
private descendantTopicExists;
|
|
762
|
+
unsubscribe(value: string | Function): boolean | string;
|
|
763
|
+
}
|
|
764
|
+
//#endregion
|
|
765
|
+
//#region src/store/controls.d.ts
|
|
766
|
+
interface ControlProps<T = any> {
|
|
767
|
+
value: T;
|
|
768
|
+
onChange: (value: T) => void;
|
|
769
|
+
valueType?: string;
|
|
770
|
+
}
|
|
771
|
+
type ControlComponent<T = any> = React.FC<ControlProps<T>>;
|
|
772
|
+
type ControlsStore = {
|
|
773
|
+
icons: Record<string, React.ComponentType>;
|
|
774
|
+
controls: Record<string, React.FC<ControlProps>>;
|
|
775
|
+
defaultControl: React.FC<ControlProps>;
|
|
776
|
+
registerControl: (name: string, control: React.FC<ControlProps>) => void;
|
|
777
|
+
};
|
|
778
|
+
declare const controlsStoreFactory: () => zustand5.UseBoundStore<zustand5.StoreApi<ControlsStore>>;
|
|
779
|
+
//#endregion
|
|
780
|
+
//#region src/store/selection.d.ts
|
|
781
|
+
type SelectionStore = {
|
|
782
|
+
selectedNodeId: string | null;
|
|
783
|
+
setSelectedNodeId: (nodeId: string | null) => void;
|
|
784
|
+
};
|
|
785
|
+
//#endregion
|
|
786
|
+
//#region src/types/NodeMetadata.d.ts
|
|
787
|
+
interface ValueTypeMetadata {
|
|
788
|
+
name: string;
|
|
789
|
+
creator: () => any;
|
|
790
|
+
deserialize?: (value: any) => any;
|
|
791
|
+
serialize?: (value: any) => any;
|
|
792
|
+
lerp?: (start: any, end: any, t: number) => any;
|
|
793
|
+
equals?: (a: any, b: any) => boolean;
|
|
794
|
+
clone?: (value: any) => any;
|
|
795
|
+
}
|
|
796
|
+
/**
|
|
797
|
+
* Pure metadata registry - no execution capabilities
|
|
798
|
+
* Used by the visual graph editor for rendering nodes
|
|
799
|
+
*/
|
|
800
|
+
interface INodeRegistry {
|
|
801
|
+
readonly values: Record<string, ValueTypeMetadata>;
|
|
802
|
+
readonly specs: NodeSpecJSON[];
|
|
803
|
+
}
|
|
804
|
+
type NodeMetadata = Record<string, string>;
|
|
805
|
+
//#endregion
|
|
806
|
+
//#region src/store/registry.d.ts
|
|
807
|
+
type RegistryStore = {
|
|
808
|
+
readonly values: Record<string, ValueTypeMetadata>;
|
|
809
|
+
readonly specs: NodeSpecJSON[];
|
|
810
|
+
getRegistry: () => INodeRegistry;
|
|
811
|
+
updateRegistry: (registry: INodeRegistry) => void;
|
|
812
|
+
updateValues: (values: Record<string, ValueTypeMetadata>) => void;
|
|
813
|
+
updateSpecs: (specs: NodeSpecJSON[]) => void;
|
|
814
|
+
};
|
|
815
|
+
//#endregion
|
|
816
|
+
//#region src/store/specs.d.ts
|
|
817
|
+
type SpecsStore = {
|
|
818
|
+
specs: NodeSpecJSON[];
|
|
819
|
+
specDict: Record<string, NodeSpecJSON>;
|
|
820
|
+
setSpecs: (specs: NodeSpecJSON[]) => void;
|
|
821
|
+
};
|
|
822
|
+
//#endregion
|
|
823
|
+
//#region src/store/specific.d.ts
|
|
824
|
+
type SpecificNode = {
|
|
825
|
+
id: string;
|
|
826
|
+
data: IBehaveNode['data'];
|
|
827
|
+
spec: NodeSpecJSON;
|
|
828
|
+
selected: boolean;
|
|
829
|
+
};
|
|
830
|
+
type SpecificRenderProps = {
|
|
831
|
+
node: SpecificNode;
|
|
832
|
+
};
|
|
833
|
+
type Specific = {
|
|
834
|
+
name: string;
|
|
835
|
+
check: (spec: NodeSpecJSON) => boolean;
|
|
836
|
+
render: ComponentType<SpecificRenderProps>;
|
|
837
|
+
};
|
|
838
|
+
type SpecificStore = {
|
|
839
|
+
specifics: Specific[];
|
|
840
|
+
titleBarActions: Record<string, React.ReactElement>;
|
|
841
|
+
registerSpecific: (specific: Specific) => void;
|
|
842
|
+
unregisterSpecific: (name: string) => void;
|
|
843
|
+
registryTitleBarAction: (name: string, action: React.ReactElement) => void;
|
|
844
|
+
};
|
|
845
|
+
declare const specificStoreFactory: () => zustand5.UseBoundStore<zustand5.StoreApi<SpecificStore>>;
|
|
846
|
+
//#endregion
|
|
847
|
+
//#region src/store/socketGenerator.d.ts
|
|
848
|
+
type SocketGeneratorNode = {
|
|
849
|
+
id: string;
|
|
850
|
+
data: IBehaveNode['data'];
|
|
851
|
+
spec: NodeSpecJSON;
|
|
852
|
+
selected: boolean;
|
|
853
|
+
};
|
|
854
|
+
type SocketGeneratorRenderProps = {
|
|
855
|
+
node: SocketGeneratorNode;
|
|
856
|
+
};
|
|
857
|
+
type SocketGenerator = {
|
|
858
|
+
name: string;
|
|
859
|
+
check: (spec: NodeSpecJSON) => boolean;
|
|
860
|
+
render: ComponentType<SocketGeneratorRenderProps>;
|
|
861
|
+
};
|
|
862
|
+
type SocketGeneratorStore = {
|
|
863
|
+
generators: SocketGenerator[];
|
|
864
|
+
registerGenerator: (generator: SocketGenerator) => void;
|
|
865
|
+
unregisterGenerator: (name: string) => void;
|
|
866
|
+
};
|
|
867
|
+
declare const socketGeneratorStoreFactory: () => zustand5.UseBoundStore<zustand5.StoreApi<SocketGeneratorStore>>;
|
|
868
|
+
//#endregion
|
|
869
|
+
//#region src/store/toolbar.d.ts
|
|
870
|
+
type ToolbarButtonGroup = {
|
|
871
|
+
id: string;
|
|
872
|
+
label?: string;
|
|
873
|
+
buttons: (ToolbarButton | React$1.ReactNode)[];
|
|
874
|
+
};
|
|
875
|
+
type ToolbarButton = {
|
|
876
|
+
id: string;
|
|
877
|
+
icon: React$1.ReactNode;
|
|
878
|
+
label: string;
|
|
879
|
+
onClick: () => void;
|
|
880
|
+
disabled?: boolean | (() => boolean);
|
|
881
|
+
};
|
|
882
|
+
type ToolbarStore = {
|
|
883
|
+
visible: boolean;
|
|
884
|
+
setVisible: (visible: boolean) => void;
|
|
885
|
+
groups: ToolbarButtonGroup[];
|
|
886
|
+
setGroups: (groups: ToolbarButtonGroup[]) => void;
|
|
887
|
+
addGroup: (group: ToolbarButtonGroup) => void;
|
|
888
|
+
removeGroup: (groupId: string) => void;
|
|
889
|
+
updateGroup: (groupId: string, group: Partial<ToolbarButtonGroup>) => void;
|
|
890
|
+
};
|
|
891
|
+
declare const toolbarStoreFactory: () => zustand5.StoreApi<ToolbarStore>;
|
|
892
|
+
//#endregion
|
|
893
|
+
//#region src/store/conversions.d.ts
|
|
894
|
+
/**
|
|
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).
|
|
899
|
+
*/
|
|
900
|
+
type ConversionRule = {
|
|
901
|
+
from: string;
|
|
902
|
+
to: string;
|
|
903
|
+
nodeType: string;
|
|
904
|
+
inputKey?: string;
|
|
905
|
+
outputKey?: string;
|
|
906
|
+
};
|
|
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;
|
|
914
|
+
};
|
|
915
|
+
declare const conversionStoreFactory: () => StoreApi<ConversionStore>;
|
|
916
|
+
//#endregion
|
|
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;
|
|
1471
|
+
}
|
|
1472
|
+
//#endregion
|
|
1473
|
+
//#region src/system/notifications.d.ts
|
|
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
|
+
}
|
|
1488
|
+
interface NotificationOptions {
|
|
1489
|
+
/**
|
|
1490
|
+
* Toast ID for programmatic dismissal
|
|
1491
|
+
*/
|
|
1492
|
+
id?: string;
|
|
1493
|
+
/**
|
|
1494
|
+
* Duration in milliseconds. Set to Infinity to persist until manually dismissed
|
|
1495
|
+
*/
|
|
1496
|
+
duration?: number;
|
|
1497
|
+
/**
|
|
1498
|
+
* Position on screen
|
|
1499
|
+
*/
|
|
1500
|
+
position?: Toast['position'];
|
|
1501
|
+
/**
|
|
1502
|
+
* Custom icon
|
|
1503
|
+
*/
|
|
1504
|
+
icon?: Renderable;
|
|
1505
|
+
/**
|
|
1506
|
+
* Custom styles
|
|
1507
|
+
*/
|
|
1508
|
+
style?: React.CSSProperties;
|
|
1509
|
+
/**
|
|
1510
|
+
* Custom class name
|
|
1511
|
+
*/
|
|
1512
|
+
className?: string;
|
|
1513
|
+
/**
|
|
1514
|
+
* Accessible aria-live value
|
|
1515
|
+
*/
|
|
1516
|
+
ariaLive?: Toast['ariaProps'];
|
|
1517
|
+
}
|
|
1518
|
+
declare class Notifications {
|
|
1519
|
+
private readonly system;
|
|
1520
|
+
constructor(system: System);
|
|
1521
|
+
/**
|
|
1522
|
+
* Dismiss a specific toast or all toasts
|
|
1523
|
+
*/
|
|
1524
|
+
dismissNotification(toastId?: string): void;
|
|
1525
|
+
/**
|
|
1526
|
+
* Show a notification toast
|
|
1527
|
+
*/
|
|
1528
|
+
notify(message: string, type?: NotificationType, options?: NotificationOptions): void;
|
|
1529
|
+
/**
|
|
1530
|
+
* Show a success notification
|
|
1531
|
+
*/
|
|
1532
|
+
success(message: string, options?: NotificationOptions): void;
|
|
1533
|
+
/**
|
|
1534
|
+
* Show an error notification
|
|
1535
|
+
*/
|
|
1536
|
+
error(message: string, options?: NotificationOptions): void;
|
|
1537
|
+
/**
|
|
1538
|
+
* Show a loading notification
|
|
1539
|
+
*/
|
|
1540
|
+
loading(message: string, options?: NotificationOptions): void;
|
|
1541
|
+
/**
|
|
1542
|
+
* Show an info notification
|
|
1543
|
+
*/
|
|
1544
|
+
info(message: string, options?: NotificationOptions): void;
|
|
1545
|
+
/**
|
|
1546
|
+
* Dismiss a specific toast or all toasts
|
|
1547
|
+
*/
|
|
1548
|
+
dismiss(toastId?: string): void;
|
|
1549
|
+
}
|
|
1550
|
+
//#endregion
|
|
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;
|
|
1568
|
+
};
|
|
1569
|
+
//#endregion
|
|
1570
|
+
//#region src/system/graphSession.d.ts
|
|
1571
|
+
/**
|
|
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
|
+
* }
|
|
1583
|
+
*/
|
|
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>;
|
|
1610
|
+
readonly undoManager: UndoManager;
|
|
1611
|
+
/** Display name, used as the graph tab title. Backed by {@link metaStore}. */
|
|
1612
|
+
get name(): string;
|
|
1613
|
+
set name(value: string);
|
|
1614
|
+
readonly controlStore: StoreApi<ControlsStore>;
|
|
1615
|
+
readonly variableStore: StoreApi<VariableStore>;
|
|
1616
|
+
readonly refStore: StoreApi<RefStore>;
|
|
1617
|
+
readonly logsStore: StoreApi<LogStore>;
|
|
1618
|
+
readonly eventsStore: StoreApi<EventsStore>;
|
|
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>;
|
|
1624
|
+
readonly layerStore: StoreApi<LayerStore>;
|
|
1625
|
+
readonly traceStore: StoreApi<TraceStore>;
|
|
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);
|
|
1630
|
+
/**
|
|
1631
|
+
* Convenience access to the shared editor notifications service.
|
|
1632
|
+
*/
|
|
1633
|
+
get notifications(): Notifications;
|
|
1634
|
+
/**
|
|
1635
|
+
* Attach a plugin-contributed property to this session. The companion to the
|
|
1636
|
+
* {@link IGraphSession} augmentation; mirrors {@link System.decorate}.
|
|
1637
|
+
*/
|
|
1638
|
+
decorate<K$1 extends keyof IGraphSession>(name: K$1, val: IGraphSession[K$1]): void;
|
|
1639
|
+
/**
|
|
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.
|
|
1643
|
+
*/
|
|
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;
|
|
1652
|
+
}
|
|
1653
|
+
//#endregion
|
|
1654
|
+
//#region src/transformers/flowToBehave.d.ts
|
|
1655
|
+
declare const flowToBehave: (session: GraphSession, nodes: Node$1[], edges: Edge[], nodeSpecJSON: NodeSpecJSON[]) => GraphJSON;
|
|
1656
|
+
//#endregion
|
|
1657
|
+
//#region src/util/autoLayout.d.ts
|
|
1658
|
+
declare const autoLayout: (nodes: Node$1[], _edges: Edge[]) => void;
|
|
1659
|
+
//#endregion
|
|
1660
|
+
//#region src/util/calculateNewEdge.d.ts
|
|
1661
|
+
declare const calculateNewEdge: (originNode: Node$1, destinationNodeType: string, destinationNodeId: string, connection: OnConnectStartParams, specJSON: NodeSpecJSON[]) => {
|
|
1662
|
+
id: string;
|
|
1663
|
+
source: string;
|
|
1664
|
+
sourceHandle: string | null;
|
|
1665
|
+
target: string;
|
|
1666
|
+
targetHandle: string | undefined;
|
|
1667
|
+
} | {
|
|
1668
|
+
id: string;
|
|
1669
|
+
target: string;
|
|
1670
|
+
targetHandle: string | null;
|
|
1671
|
+
source: string;
|
|
1672
|
+
sourceHandle: string | undefined;
|
|
1673
|
+
};
|
|
1674
|
+
//#endregion
|
|
1675
|
+
//#region src/util/colors.d.ts
|
|
1676
|
+
declare const categoryColorMap: Record<NodeSpecJSON['category'], string>;
|
|
1677
|
+
//#endregion
|
|
1678
|
+
//#region src/util/getPickerFilters.d.ts
|
|
1679
|
+
declare const getNodePickerFilters: (nodes: Node$1[], params: OnConnectStartParams | undefined, specJSON: NodeSpecJSON[] | undefined) => NodePickerFilters | undefined;
|
|
1680
|
+
//#endregion
|
|
1681
|
+
//#region src/util/getSocketsByNodeTypeAndHandleType.d.ts
|
|
1682
|
+
declare const getSocketsByNodeTypeAndHandleType: (nodes: NodeSpecJSON[], nodeType: string | undefined, handleType: "source" | "target" | null) => _kiberon_labs_behave_graph0.OutputSocketSpecJSON[] | undefined;
|
|
1683
|
+
//#endregion
|
|
1684
|
+
//#region src/util/hasPositionMetaData.d.ts
|
|
1685
|
+
declare const hasPositionMetaData: (graph: GraphJSON) => boolean;
|
|
1686
|
+
//#endregion
|
|
1687
|
+
//#region src/util/isHandleConnected.d.ts
|
|
1688
|
+
declare const isHandleConnected: (edges: Edge[], nodeId: string, handleId: string, type: "source" | "target") => boolean;
|
|
1689
|
+
//#endregion
|
|
1690
|
+
//#region src/util/isValidConnection.d.ts
|
|
1691
|
+
declare const isValidConnection: (connection: Connection, instance: ReactFlowInstance, specJSON: NodeSpecJSON[], options?: {
|
|
1692
|
+
autoConvert?: boolean;
|
|
1693
|
+
conversions?: ConversionRule[];
|
|
1694
|
+
}) => boolean;
|
|
1695
|
+
//#endregion
|
|
1696
|
+
//#region src/util/sleep.d.ts
|
|
1697
|
+
declare function sleep(durationInSeconds: number): Promise<unknown>;
|
|
1698
|
+
//#endregion
|
|
1699
|
+
//#region src/util/serializeVariables.d.ts
|
|
1700
|
+
interface VariableJSON {
|
|
1701
|
+
id: string;
|
|
1702
|
+
name: string;
|
|
1703
|
+
valueTypeName: string;
|
|
1704
|
+
initialValue: any;
|
|
1705
|
+
label?: string;
|
|
1706
|
+
metadata?: Record<string, any>;
|
|
1707
|
+
}
|
|
1708
|
+
interface Variable {
|
|
1709
|
+
id: string;
|
|
1710
|
+
name: string;
|
|
1711
|
+
valueTypeName: string;
|
|
1712
|
+
initialValue: any;
|
|
1713
|
+
label?: string;
|
|
1714
|
+
metadata?: Record<string, any>;
|
|
1715
|
+
}
|
|
1716
|
+
/**
|
|
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.
|
|
1891
|
+
*/
|
|
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
|
|
1906
|
+
/**
|
|
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.
|
|
1910
|
+
*/
|
|
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];
|
|
1918
|
+
/**
|
|
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.
|
|
1921
|
+
*/
|
|
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>;
|
|
1937
|
+
//#endregion
|
|
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";
|
|
1944
|
+
/**
|
|
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.
|
|
1947
|
+
*/
|
|
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;
|
|
1958
|
+
//#endregion
|
|
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
|
+
}
|
|
2024
|
+
//#endregion
|
|
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
|
+
};
|
|
2035
|
+
/**
|
|
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.
|
|
2044
|
+
*/
|
|
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
|
|
2103
|
+
/**
|
|
2104
|
+
* Setting keys owned by the autosave plugin. Namespaced (`autosave.*`) so they
|
|
2105
|
+
* never collide with the built-in flat setting keys.
|
|
2106
|
+
*/
|
|
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;
|
|
2118
|
+
/**
|
|
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.
|
|
2123
|
+
*/
|
|
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
|
+
}
|
|
2146
|
+
/**
|
|
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.
|
|
2163
|
+
*/
|
|
2164
|
+
declare const autosavePlugin: LoadablePlugin<AutosavePluginOptions | undefined>;
|
|
2165
|
+
//#endregion
|
|
2166
|
+
//#region src/plugin/kitchen-sink/index.d.ts
|
|
2167
|
+
/**
|
|
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.
|
|
2186
|
+
*/
|
|
2187
|
+
declare const kitchenSinkPlugin: LoadablePlugin<void>;
|
|
2188
|
+
//#endregion
|
|
2189
|
+
//#region src/plugin/graphrunner/transport.d.ts
|
|
2190
|
+
type TransportState = 'disconnected' | 'connecting' | 'connected' | 'error';
|
|
2191
|
+
interface TransportConfig {
|
|
2192
|
+
url: string;
|
|
2193
|
+
reconnectInterval?: number;
|
|
2194
|
+
heartbeatInterval?: number;
|
|
2195
|
+
}
|
|
2196
|
+
interface ITransport<Send = ServerGraphRunnerMessage | GraphRunnerMessage, Receive = GraphRunnerMessage | ServerGraphRunnerMessage> {
|
|
2197
|
+
/**
|
|
2198
|
+
* Get current connection state
|
|
2199
|
+
*/
|
|
2200
|
+
getState(): TransportState;
|
|
2201
|
+
/**
|
|
2202
|
+
* Connect to the server
|
|
2203
|
+
*/
|
|
2204
|
+
connect(): Promise<void>;
|
|
2205
|
+
/**
|
|
2206
|
+
* Disconnect from the server
|
|
2207
|
+
*/
|
|
2208
|
+
disconnect(): void;
|
|
2209
|
+
/**
|
|
2210
|
+
* Send a message to the server
|
|
2211
|
+
*/
|
|
2212
|
+
send(message: Send): void;
|
|
2213
|
+
/**
|
|
2214
|
+
* Register a message handler
|
|
2215
|
+
*/
|
|
2216
|
+
onMessage(handler: (message: Receive) => void): void;
|
|
2217
|
+
/**
|
|
2218
|
+
* Register a connection state change handler
|
|
2219
|
+
*/
|
|
2220
|
+
onStateChange(handler: (state: TransportState) => void): void;
|
|
2221
|
+
/**
|
|
2222
|
+
* Register an error handler
|
|
2223
|
+
*/
|
|
2224
|
+
onError(handler: (error: Error) => void): void;
|
|
2225
|
+
/**
|
|
2226
|
+
* Remove all handlers
|
|
2227
|
+
*/
|
|
2228
|
+
removeAllHandlers(): void;
|
|
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;
|
|
2244
|
+
/**
|
|
2245
|
+
* WebSocket transport implementation
|
|
2246
|
+
*/
|
|
2247
|
+
declare class WebSocketTransport implements ITransport<GraphRunnerMessage, ServerGraphRunnerMessage> {
|
|
2248
|
+
private ws;
|
|
2249
|
+
private config;
|
|
2250
|
+
private state;
|
|
2251
|
+
private messageHandlers;
|
|
2252
|
+
private stateChangeHandlers;
|
|
2253
|
+
private errorHandlers;
|
|
2254
|
+
private reconnectTimeout;
|
|
2255
|
+
private heartbeatInterval;
|
|
2256
|
+
constructor(config: TransportConfig);
|
|
2257
|
+
getState(): TransportState;
|
|
2258
|
+
connect(): Promise<void>;
|
|
2259
|
+
disconnect(): void;
|
|
2260
|
+
send(message: GraphRunnerMessage): void;
|
|
2261
|
+
onMessage(handler: (message: ServerGraphRunnerMessage) => void): void;
|
|
2262
|
+
onStateChange(handler: (state: TransportState) => void): void;
|
|
2263
|
+
onError(handler: (error: Error) => void): void;
|
|
2264
|
+
removeAllHandlers(): void;
|
|
2265
|
+
private setState;
|
|
2266
|
+
private notifyError;
|
|
2267
|
+
private handleMessage;
|
|
2268
|
+
private handleDisconnect;
|
|
2269
|
+
private reconnect;
|
|
2270
|
+
private startHeartbeat;
|
|
2271
|
+
}
|
|
2272
|
+
//#endregion
|
|
2273
|
+
//#region src/plugin/graphrunner/types.d.ts
|
|
2274
|
+
type RunStatus = 'pending' | 'running' | 'completed' | 'stopped' | 'error';
|
|
2275
|
+
type ErrorCode = 'PROTOCOL_VERSION_MISMATCH' | 'PROTOCOL_VIOLATION' | 'AUTHENTICATION_FAILED' | 'AUTHENTICATION_REQUIRED' | 'SESSION_NOT_FOUND' | 'SESSION_EXPIRED' | 'INVALID_GRAPH' | 'VALIDATION_FAILED' | 'RUN_NOT_FOUND' | 'NODE_EXECUTION_ERROR' | 'TIMEOUT' | 'CONCURRENT_LIMIT_EXCEEDED' | 'PERMISSION_DENIED';
|
|
2276
|
+
interface GraphRunnerCapabilities {
|
|
2277
|
+
trace: boolean;
|
|
2278
|
+
validation?: boolean;
|
|
2279
|
+
graphRegistry?: boolean;
|
|
2280
|
+
eventFiltering?: boolean;
|
|
2281
|
+
batchOperations?: boolean;
|
|
2282
|
+
runHistory?: boolean;
|
|
2283
|
+
runtimeMetadata?: boolean;
|
|
2284
|
+
maxConcurrentRuns?: number;
|
|
2285
|
+
/**
|
|
2286
|
+
* Can the graph be modified in realtime?
|
|
2287
|
+
*/
|
|
2288
|
+
realtime?: boolean;
|
|
2289
|
+
maxConcurrentDynamicRuns?: number;
|
|
2290
|
+
updateGranularity?: 'node' | 'socket' | 'full';
|
|
2291
|
+
}
|
|
2292
|
+
interface RunPerformance {
|
|
2293
|
+
nodesExecuted: number;
|
|
2294
|
+
eventsEmitted: number;
|
|
2295
|
+
variableChanges: number;
|
|
2296
|
+
}
|
|
2297
|
+
interface EventFilter {
|
|
2298
|
+
eventTypes?: string[];
|
|
2299
|
+
variableNames?: string[];
|
|
2300
|
+
eventNames?: string[];
|
|
2301
|
+
}
|
|
2302
|
+
interface ServerVariable extends VariableJSON$1 {
|
|
2303
|
+
readonly: boolean;
|
|
2304
|
+
description?: string;
|
|
2305
|
+
}
|
|
2306
|
+
interface ServerEvent extends CustomEventJSON {
|
|
2307
|
+
readonly: boolean;
|
|
2308
|
+
description?: string;
|
|
2309
|
+
payloadSchema?: unknown;
|
|
2310
|
+
}
|
|
2311
|
+
interface SocketConstraint {
|
|
2312
|
+
type: 'enum' | 'range' | 'pattern' | 'custom';
|
|
2313
|
+
choices?: Array<{
|
|
2314
|
+
value: unknown;
|
|
2315
|
+
label: string;
|
|
2316
|
+
}>;
|
|
2317
|
+
min?: number;
|
|
2318
|
+
max?: number;
|
|
2319
|
+
pattern?: string;
|
|
2320
|
+
validator?: string;
|
|
2321
|
+
}
|
|
2322
|
+
interface NodeSocket {
|
|
2323
|
+
name: string;
|
|
2324
|
+
valueType: string;
|
|
2325
|
+
required?: boolean;
|
|
2326
|
+
hasConstraints?: boolean;
|
|
2327
|
+
}
|
|
2328
|
+
interface AuthCredentials {
|
|
2329
|
+
type: 'bearer' | 'apiKey' | 'none';
|
|
2330
|
+
token?: string;
|
|
2331
|
+
key?: string;
|
|
2332
|
+
}
|
|
2333
|
+
interface ServerPongMessage {
|
|
2334
|
+
type: 'pong';
|
|
2335
|
+
timestamp: number;
|
|
2336
|
+
}
|
|
2337
|
+
interface ServerWelcomeMessage {
|
|
2338
|
+
type: 'welcome';
|
|
2339
|
+
protocolVersion: string;
|
|
2340
|
+
serverId: string;
|
|
2341
|
+
authenticated: boolean;
|
|
2342
|
+
userId?: string;
|
|
2343
|
+
}
|
|
2344
|
+
interface CapabilitiesMessage {
|
|
2345
|
+
type: 'capabilities';
|
|
2346
|
+
capabilities: GraphRunnerCapabilities;
|
|
2347
|
+
}
|
|
2348
|
+
interface SessionCreatedMessage {
|
|
2349
|
+
type: 'sessionCreated';
|
|
2350
|
+
sessionId: string;
|
|
2351
|
+
expiresAt: number;
|
|
2352
|
+
}
|
|
2353
|
+
interface SessionResumedMessage {
|
|
2354
|
+
type: 'sessionResumed';
|
|
2355
|
+
sessionId: string;
|
|
2356
|
+
activeRuns: string[];
|
|
2357
|
+
}
|
|
2358
|
+
interface SessionClosedMessage {
|
|
2359
|
+
type: 'sessionClosed';
|
|
2360
|
+
sessionId: string;
|
|
2361
|
+
}
|
|
2362
|
+
interface ServerVariablesMessage {
|
|
2363
|
+
type: 'serverVariables';
|
|
2364
|
+
variables: ServerVariable[];
|
|
2365
|
+
}
|
|
2366
|
+
interface ServerEventsMessage {
|
|
2367
|
+
type: 'serverEvents';
|
|
2368
|
+
events: ServerEvent[];
|
|
2369
|
+
}
|
|
2370
|
+
interface SocketConstraintsMessage {
|
|
2371
|
+
type: 'socketConstraints';
|
|
2372
|
+
nodeType: string;
|
|
2373
|
+
socketName: string;
|
|
2374
|
+
valueType: string;
|
|
2375
|
+
constraints: SocketConstraint;
|
|
2376
|
+
}
|
|
2377
|
+
interface NodeTypesMessage {
|
|
2378
|
+
type: 'nodeTypes';
|
|
2379
|
+
nodes: NodeSpecJSON[];
|
|
2380
|
+
}
|
|
2381
|
+
interface RunStartedMessage {
|
|
2382
|
+
type: 'runStarted';
|
|
2383
|
+
runId: string;
|
|
2384
|
+
graphId: string;
|
|
2385
|
+
startedAt: number;
|
|
2386
|
+
}
|
|
2387
|
+
interface ServerGraphRegisteredMessage {
|
|
2388
|
+
type: 'graphRegistered';
|
|
2389
|
+
graphId: string;
|
|
2390
|
+
}
|
|
2391
|
+
interface ServerGraphListMessage {
|
|
2392
|
+
type: 'graphList';
|
|
2393
|
+
graphs: Array<{
|
|
2394
|
+
graphId: string;
|
|
2395
|
+
registeredAt: number;
|
|
2396
|
+
}>;
|
|
2397
|
+
}
|
|
2398
|
+
interface ValidationResultMessage {
|
|
2399
|
+
type: 'validationResult';
|
|
2400
|
+
graphId: string;
|
|
2401
|
+
valid: boolean;
|
|
2402
|
+
errors: Array<{
|
|
2403
|
+
nodeId: string;
|
|
2404
|
+
message: string;
|
|
2405
|
+
severity: string;
|
|
2406
|
+
}>;
|
|
2407
|
+
warnings: Array<{
|
|
2408
|
+
nodeId: string;
|
|
2409
|
+
message: string;
|
|
2410
|
+
severity: string;
|
|
2411
|
+
}>;
|
|
2412
|
+
}
|
|
2413
|
+
interface TraceMessage {
|
|
2414
|
+
type: 'trace';
|
|
2415
|
+
runId: string;
|
|
2416
|
+
graphId: string;
|
|
2417
|
+
nodeId: string;
|
|
2418
|
+
event: string;
|
|
2419
|
+
data: unknown;
|
|
2420
|
+
timestamp: number;
|
|
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
|
+
}
|
|
2440
|
+
interface LogMessage {
|
|
2441
|
+
type: 'log';
|
|
2442
|
+
runId: string;
|
|
2443
|
+
graphId: string;
|
|
2444
|
+
level: string;
|
|
2445
|
+
message: string;
|
|
2446
|
+
data?: unknown;
|
|
2447
|
+
}
|
|
2448
|
+
interface VariableChangedMessage {
|
|
2449
|
+
type: 'variableChanged';
|
|
2450
|
+
runId: string;
|
|
2451
|
+
graphId: string;
|
|
2452
|
+
variableName: string;
|
|
2453
|
+
oldValue: unknown;
|
|
2454
|
+
newValue: unknown;
|
|
2455
|
+
nodeId?: string;
|
|
2456
|
+
}
|
|
2457
|
+
interface CompletedMessage {
|
|
2458
|
+
type: 'completed';
|
|
2459
|
+
runId: string;
|
|
2460
|
+
graphId: string;
|
|
2461
|
+
completedAt: number;
|
|
2462
|
+
elapsedMs: number;
|
|
2463
|
+
result: unknown;
|
|
2464
|
+
performance: RunPerformance;
|
|
2465
|
+
}
|
|
2466
|
+
interface StoppedMessage {
|
|
2467
|
+
type: 'stopped';
|
|
2468
|
+
runId: string;
|
|
2469
|
+
graphId: string;
|
|
2470
|
+
reason: string;
|
|
2471
|
+
}
|
|
2472
|
+
interface StatusMessage {
|
|
2473
|
+
type: 'status';
|
|
2474
|
+
runId: string;
|
|
2475
|
+
graphId: string;
|
|
2476
|
+
status: RunStatus;
|
|
2477
|
+
startedAt: number;
|
|
2478
|
+
elapsedMs: number;
|
|
2479
|
+
currentNodeId?: string;
|
|
2480
|
+
startedGraphs: Array<{
|
|
2481
|
+
runId: string;
|
|
2482
|
+
graphId: string;
|
|
2483
|
+
status: RunStatus;
|
|
2484
|
+
}>;
|
|
2485
|
+
performance: RunPerformance;
|
|
2486
|
+
}
|
|
2487
|
+
interface BatchStatusMessage {
|
|
2488
|
+
type: 'batchStatus';
|
|
2489
|
+
statuses: Array<{
|
|
2490
|
+
runId: string;
|
|
2491
|
+
status: RunStatus;
|
|
2492
|
+
elapsedMs: number;
|
|
2493
|
+
}>;
|
|
2494
|
+
}
|
|
2495
|
+
interface ErrorMessage {
|
|
2496
|
+
type: 'error';
|
|
2497
|
+
code: ErrorCode;
|
|
2498
|
+
message: string;
|
|
2499
|
+
runId?: string;
|
|
2500
|
+
graphId?: string;
|
|
2501
|
+
nodeId?: string;
|
|
2502
|
+
details?: unknown;
|
|
2503
|
+
supportedVersions?: string[];
|
|
2504
|
+
}
|
|
2505
|
+
interface RunHistoryMessage {
|
|
2506
|
+
type: 'runHistory';
|
|
2507
|
+
runs: Array<{
|
|
2508
|
+
runId: string;
|
|
2509
|
+
graphId: string;
|
|
2510
|
+
status: RunStatus;
|
|
2511
|
+
startedAt: number;
|
|
2512
|
+
completedAt?: number;
|
|
2513
|
+
elapsedMs: number;
|
|
2514
|
+
result?: unknown;
|
|
2515
|
+
}>;
|
|
2516
|
+
}
|
|
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;
|
|
2518
|
+
interface HelloMessage {
|
|
2519
|
+
type: 'hello';
|
|
2520
|
+
protocolVersion: string;
|
|
2521
|
+
auth: AuthCredentials;
|
|
2522
|
+
}
|
|
2523
|
+
interface WelcomeMessage {
|
|
2524
|
+
type: 'welcome';
|
|
2525
|
+
protocolVersion: string;
|
|
2526
|
+
serverId: string;
|
|
2527
|
+
authenticated: boolean;
|
|
2528
|
+
userId?: string;
|
|
2529
|
+
}
|
|
2530
|
+
interface PingMessage {
|
|
2531
|
+
type: 'ping';
|
|
2532
|
+
timestamp: number;
|
|
2533
|
+
}
|
|
2534
|
+
interface PongMessage {
|
|
2535
|
+
type: 'pong';
|
|
2536
|
+
timestamp: number;
|
|
2537
|
+
}
|
|
2538
|
+
interface CreateSessionMessage {
|
|
2539
|
+
type: 'createSession';
|
|
2540
|
+
metadata?: Record<string, unknown>;
|
|
2541
|
+
}
|
|
2542
|
+
interface ResumeSessionMessage {
|
|
2543
|
+
type: 'resumeSession';
|
|
2544
|
+
sessionId: string;
|
|
2545
|
+
}
|
|
2546
|
+
interface CloseSessionMessage {
|
|
2547
|
+
type: 'closeSession';
|
|
2548
|
+
sessionId: string;
|
|
2549
|
+
}
|
|
2550
|
+
interface GetCapabilitiesMessage {
|
|
2551
|
+
type: 'getCapabilities';
|
|
2552
|
+
}
|
|
2553
|
+
interface GetServerVariablesMessage {
|
|
2554
|
+
type: 'getServerVariables';
|
|
2555
|
+
sessionId: string;
|
|
2556
|
+
}
|
|
2557
|
+
interface GetServerEventsMessage {
|
|
2558
|
+
type: 'getServerEvents';
|
|
2559
|
+
sessionId: string;
|
|
2560
|
+
}
|
|
2561
|
+
interface GetSocketConstraintsMessage {
|
|
2562
|
+
type: 'getSocketConstraints';
|
|
2563
|
+
sessionId: string;
|
|
2564
|
+
nodeType: string;
|
|
2565
|
+
socketName: string;
|
|
2566
|
+
}
|
|
2567
|
+
interface GetNodeTypesMessage {
|
|
2568
|
+
type: 'getNodeTypes';
|
|
2569
|
+
sessionId: string;
|
|
2570
|
+
}
|
|
2571
|
+
interface RegisterGraphMessage {
|
|
2572
|
+
type: 'registerGraph';
|
|
2573
|
+
sessionId: string;
|
|
2574
|
+
graphId: string;
|
|
2575
|
+
graph: GraphJSON;
|
|
2576
|
+
}
|
|
2577
|
+
interface GraphRegisteredMessage {
|
|
2578
|
+
type: 'graphRegistered';
|
|
2579
|
+
graphId: string;
|
|
2580
|
+
}
|
|
2581
|
+
interface GraphListMessage {
|
|
2582
|
+
type: 'graphList';
|
|
2583
|
+
graphs: Array<{
|
|
2584
|
+
graphId: string;
|
|
2585
|
+
registeredAt: number;
|
|
2586
|
+
}>;
|
|
2587
|
+
}
|
|
2588
|
+
interface ValidateGraphMessage {
|
|
2589
|
+
type: 'validateGraph';
|
|
2590
|
+
sessionId: string;
|
|
2591
|
+
graphId: string;
|
|
2592
|
+
graph: unknown;
|
|
2593
|
+
}
|
|
2594
|
+
interface RunGraphMessage {
|
|
2595
|
+
type: 'runGraph';
|
|
2596
|
+
sessionId: string;
|
|
2597
|
+
graphId: string;
|
|
2598
|
+
graph: GraphJSON;
|
|
2599
|
+
inputs?: unknown;
|
|
2600
|
+
options?: {
|
|
2601
|
+
autoEnd?: boolean;
|
|
2602
|
+
trace?: boolean;
|
|
2603
|
+
eventFilter?: EventFilter;
|
|
2604
|
+
maxExecutionTimeMs?: number;
|
|
2605
|
+
autoExecMode?: 'new' | 'current';
|
|
2606
|
+
allowDynamicChanges?: boolean;
|
|
2607
|
+
streamDeltas?: boolean;
|
|
2608
|
+
};
|
|
2609
|
+
}
|
|
2610
|
+
interface ListGraphsMessage {
|
|
2611
|
+
type: 'listGraphs';
|
|
2612
|
+
sessionId: string;
|
|
2613
|
+
}
|
|
2614
|
+
interface BatchRunStartedMessage {
|
|
2615
|
+
type: 'batchRunStarted';
|
|
2616
|
+
runs: Array<{
|
|
2617
|
+
runId: string;
|
|
2618
|
+
graphId: string;
|
|
2619
|
+
}>;
|
|
2620
|
+
}
|
|
2621
|
+
interface StopGraphMessage {
|
|
2622
|
+
type: 'stopGraph';
|
|
2623
|
+
sessionId: string;
|
|
2624
|
+
runId: string;
|
|
2625
|
+
}
|
|
2626
|
+
interface GetStatusMessage {
|
|
2627
|
+
type: 'getStatus';
|
|
2628
|
+
sessionId: string;
|
|
2629
|
+
runId: string;
|
|
2630
|
+
}
|
|
2631
|
+
interface BatchGetStatusMessage {
|
|
2632
|
+
type: 'batchGetStatus';
|
|
2633
|
+
sessionId: string;
|
|
2634
|
+
runIds: string[];
|
|
2635
|
+
}
|
|
2636
|
+
interface SubscribeMessage {
|
|
2637
|
+
type: 'subscribe';
|
|
2638
|
+
sessionId: string;
|
|
2639
|
+
runId: string;
|
|
2640
|
+
filter?: EventFilter;
|
|
2641
|
+
}
|
|
2642
|
+
interface UnsubscribeMessage {
|
|
2643
|
+
type: 'unsubscribe';
|
|
2644
|
+
sessionId: string;
|
|
2645
|
+
runId: string;
|
|
2646
|
+
}
|
|
2647
|
+
interface EventEmittedMessage {
|
|
2648
|
+
type: 'eventEmitted';
|
|
2649
|
+
runId: string;
|
|
2650
|
+
graphId: string;
|
|
2651
|
+
eventName: string;
|
|
2652
|
+
payload: unknown;
|
|
2653
|
+
nodeId?: string;
|
|
2654
|
+
}
|
|
2655
|
+
interface NodeAddedMessage {
|
|
2656
|
+
type: 'nodeAdded';
|
|
2657
|
+
runId: string;
|
|
2658
|
+
graphId: string;
|
|
2659
|
+
nodeId: string;
|
|
2660
|
+
nodeType: string;
|
|
2661
|
+
nodeData?: unknown;
|
|
2662
|
+
}
|
|
2663
|
+
interface GetRunHistoryMessage {
|
|
2664
|
+
type: 'getRunHistory';
|
|
2665
|
+
sessionId: string;
|
|
2666
|
+
limit?: number;
|
|
2667
|
+
graphId?: string;
|
|
2668
|
+
}
|
|
2669
|
+
interface AddNodeMessage {
|
|
2670
|
+
type: 'addNode';
|
|
2671
|
+
sessionId: string;
|
|
2672
|
+
runId: string;
|
|
2673
|
+
nodeId: string;
|
|
2674
|
+
nodeType: string;
|
|
2675
|
+
nodeData?: Record<string, unknown>;
|
|
2676
|
+
position?: {
|
|
2677
|
+
x: number;
|
|
2678
|
+
y: number;
|
|
2679
|
+
};
|
|
2680
|
+
}
|
|
2681
|
+
interface RemoveNodeMessage {
|
|
2682
|
+
type: 'removeNode';
|
|
2683
|
+
sessionId: string;
|
|
2684
|
+
runId: string;
|
|
2685
|
+
nodeId: string;
|
|
2686
|
+
}
|
|
2687
|
+
interface UpdateSocketValueMessage {
|
|
2688
|
+
type: 'updateSocketValue';
|
|
2689
|
+
sessionId: string;
|
|
2690
|
+
runId: string;
|
|
2691
|
+
nodeId: string;
|
|
2692
|
+
socketName: string;
|
|
2693
|
+
value: unknown;
|
|
2694
|
+
}
|
|
2695
|
+
interface UpdateNodeParamMessage {
|
|
2696
|
+
type: 'updateNodeParam';
|
|
2697
|
+
sessionId: string;
|
|
2698
|
+
runId: string;
|
|
2699
|
+
nodeId: string;
|
|
2700
|
+
paramName: string;
|
|
2701
|
+
value: unknown;
|
|
2702
|
+
}
|
|
2703
|
+
interface CreateLinkMessage {
|
|
2704
|
+
type: 'createLink';
|
|
2705
|
+
sessionId: string;
|
|
2706
|
+
runId: string;
|
|
2707
|
+
fromNodeId: string;
|
|
2708
|
+
fromSocket: string;
|
|
2709
|
+
toNodeId: string;
|
|
2710
|
+
toSocket: string;
|
|
2711
|
+
}
|
|
2712
|
+
interface RemoveLinkMessage {
|
|
2713
|
+
type: 'removeLink';
|
|
2714
|
+
sessionId: string;
|
|
2715
|
+
runId: string;
|
|
2716
|
+
fromNodeId: string;
|
|
2717
|
+
fromSocket: string;
|
|
2718
|
+
toNodeId: string;
|
|
2719
|
+
toSocket: string;
|
|
2720
|
+
}
|
|
2721
|
+
interface DirectExecuteNodeMessage {
|
|
2722
|
+
type: 'directExecuteNode';
|
|
2723
|
+
sessionId: string;
|
|
2724
|
+
runId: string;
|
|
2725
|
+
nodeId: string;
|
|
2726
|
+
inputSocketName: string;
|
|
2727
|
+
inputValue: unknown;
|
|
2728
|
+
autoExecMode?: 'new' | 'current';
|
|
2729
|
+
}
|
|
2730
|
+
interface NodeRemovedMessage {
|
|
2731
|
+
type: 'nodeRemoved';
|
|
2732
|
+
runId: string;
|
|
2733
|
+
graphId: string;
|
|
2734
|
+
nodeId: string;
|
|
2735
|
+
}
|
|
2736
|
+
interface LinkCreatedMessage {
|
|
2737
|
+
type: 'linkCreated';
|
|
2738
|
+
runId: string;
|
|
2739
|
+
graphId: string;
|
|
2740
|
+
fromNodeId: string;
|
|
2741
|
+
fromSocket: string;
|
|
2742
|
+
toNodeId: string;
|
|
2743
|
+
toSocket: string;
|
|
2744
|
+
}
|
|
2745
|
+
interface LinkRemovedMessage {
|
|
2746
|
+
type: 'linkRemoved';
|
|
2747
|
+
runId: string;
|
|
2748
|
+
graphId: string;
|
|
2749
|
+
fromNodeId: string;
|
|
2750
|
+
fromSocket: string;
|
|
2751
|
+
toNodeId: string;
|
|
2752
|
+
toSocket: string;
|
|
2753
|
+
}
|
|
2754
|
+
interface NodeParamUpdatedMessage {
|
|
2755
|
+
type: 'nodeParamUpdated';
|
|
2756
|
+
runId: string;
|
|
2757
|
+
graphId: string;
|
|
2758
|
+
nodeId: string;
|
|
2759
|
+
paramName: string;
|
|
2760
|
+
oldValue: unknown;
|
|
2761
|
+
newValue: unknown;
|
|
2762
|
+
}
|
|
2763
|
+
interface AffectedNodesMessage {
|
|
2764
|
+
type: 'affectedNodes';
|
|
2765
|
+
runId: string;
|
|
2766
|
+
graphId: string;
|
|
2767
|
+
nodeIds: string[];
|
|
2768
|
+
reason: 'direct-execution' | 'socket-value-update' | 'param-update' | 'link-change';
|
|
2769
|
+
}
|
|
2770
|
+
type GraphRunnerMessage = HelloMessage | WelcomeMessage | PingMessage | PongMessage | CreateSessionMessage | ResumeSessionMessage | CloseSessionMessage | GetCapabilitiesMessage | GetServerVariablesMessage | GetServerEventsMessage | GetSocketConstraintsMessage | GetNodeTypesMessage | RegisterGraphMessage | GraphRegisteredMessage | GraphListMessage | ValidateGraphMessage | RunGraphMessage | ListGraphsMessage | BatchRunStartedMessage | StopGraphMessage | GetStatusMessage | BatchGetStatusMessage | SubscribeMessage | UnsubscribeMessage | EventEmittedMessage | NodeAddedMessage | AddNodeMessage | RemoveNodeMessage | UpdateSocketValueMessage | UpdateNodeParamMessage | CreateLinkMessage | RemoveLinkMessage | DirectExecuteNodeMessage | NodeRemovedMessage | LinkCreatedMessage | LinkRemovedMessage | NodeParamUpdatedMessage | AffectedNodesMessage | GetRunHistoryMessage;
|
|
2771
|
+
interface GraphRunnerClientConfig {
|
|
2772
|
+
url?: string;
|
|
2773
|
+
auth?: AuthCredentials;
|
|
2774
|
+
protocolVersion?: string;
|
|
2775
|
+
autoReconnect?: boolean;
|
|
2776
|
+
reconnectInterval?: number;
|
|
2777
|
+
heartbeatInterval?: number;
|
|
2778
|
+
metadata?: Record<string, unknown>;
|
|
2779
|
+
transport?: ITransport;
|
|
2780
|
+
trace?: boolean;
|
|
2781
|
+
eventFilter?: EventFilter;
|
|
2782
|
+
maxExecutionTimeMs?: number;
|
|
2783
|
+
allowDynamicChanges?: boolean;
|
|
2784
|
+
autoExecMode?: 'new' | 'current';
|
|
2785
|
+
streamDeltas?: boolean;
|
|
2786
|
+
onMessageActivity?: (direction: 'sent' | 'received', message: GraphRunnerMessage) => void;
|
|
2787
|
+
}
|
|
2788
|
+
//#endregion
|
|
2789
|
+
//#region src/plugin/graphrunner/client.d.ts
|
|
2790
|
+
/**
|
|
2791
|
+
* Extract message type by its 'type' field
|
|
2792
|
+
*/
|
|
2793
|
+
type ExtractMessage<T extends string> = Extract<ServerGraphRunnerMessage, {
|
|
2794
|
+
type: T;
|
|
2795
|
+
}>;
|
|
2796
|
+
/**
|
|
2797
|
+
* Handler for messages received from the server
|
|
2798
|
+
* Generic type parameter ensures the handler receives the correct message type
|
|
2799
|
+
*/
|
|
2800
|
+
type ServerMessageHandler<T extends ServerGraphRunnerMessage['type']> = (message: ExtractMessage<T>) => void;
|
|
2801
|
+
/**
|
|
2802
|
+
* Client for the Behave-Graph Execution Protocol
|
|
2803
|
+
* Supports multiple transport implementations (WebSocket, HTTP, etc.)
|
|
2804
|
+
*/
|
|
2805
|
+
declare class GraphRunnerClient {
|
|
2806
|
+
transport: ITransport;
|
|
2807
|
+
private config;
|
|
2808
|
+
private messageHandlers;
|
|
2809
|
+
private sessionId;
|
|
2810
|
+
private capabilities;
|
|
2811
|
+
private serverId;
|
|
2812
|
+
private authenticated;
|
|
2813
|
+
private userId;
|
|
2814
|
+
private pendingRequests;
|
|
2815
|
+
private connectionState;
|
|
2816
|
+
constructor(config: GraphRunnerClientConfig);
|
|
2817
|
+
connect(): Promise<void>;
|
|
2818
|
+
disconnect(): void;
|
|
2819
|
+
createSession(metadata?: Record<string, unknown>): Promise<string>;
|
|
2820
|
+
resumeSession(sessionId: string): Promise<string[]>;
|
|
2821
|
+
closeSession(): Promise<void>;
|
|
2822
|
+
getCapabilities(): Promise<GraphRunnerCapabilities>;
|
|
2823
|
+
getServerVariables(): Promise<ServerVariable[]>;
|
|
2824
|
+
getServerEvents(): Promise<ServerEvent[]>;
|
|
2825
|
+
getSocketConstraints(nodeType: string, socketName: string): Promise<{
|
|
2826
|
+
valueType: string;
|
|
2827
|
+
constraints: SocketConstraint;
|
|
2828
|
+
}>;
|
|
2829
|
+
getNodeTypes(): Promise<NodeSpecJSON[]>;
|
|
2830
|
+
registerGraph(graphId: string, graph: GraphJSON): Promise<void>;
|
|
2831
|
+
listGraphs(): Promise<Array<{
|
|
2832
|
+
graphId: string;
|
|
2833
|
+
registeredAt: number;
|
|
2834
|
+
}>>;
|
|
2835
|
+
validateGraph(graphId: string, graph: unknown): Promise<{
|
|
2836
|
+
valid: boolean;
|
|
2837
|
+
errors: Array<{
|
|
2838
|
+
nodeId: string;
|
|
2839
|
+
message: string;
|
|
2840
|
+
severity: string;
|
|
2841
|
+
}>;
|
|
2842
|
+
warnings: Array<{
|
|
2843
|
+
nodeId: string;
|
|
2844
|
+
message: string;
|
|
2845
|
+
severity: string;
|
|
2846
|
+
}>;
|
|
2847
|
+
}>;
|
|
2848
|
+
runGraph(graphId: string, options?: {
|
|
2849
|
+
graph?: unknown;
|
|
2850
|
+
inputs?: unknown;
|
|
2851
|
+
trace?: boolean;
|
|
2852
|
+
}): Promise<string>;
|
|
2853
|
+
stopGraph(runId: string): Promise<void>;
|
|
2854
|
+
getStatus(runId: string): Promise<StatusMessage>;
|
|
2855
|
+
batchGetStatus(runIds: string[]): Promise<Array<{
|
|
2856
|
+
runId: string;
|
|
2857
|
+
status: RunStatus;
|
|
2858
|
+
elapsedMs: number;
|
|
2859
|
+
}>>;
|
|
2860
|
+
subscribe(runId: string, filter?: EventFilter): Promise<void>;
|
|
2861
|
+
unsubscribe(runId: string): Promise<void>;
|
|
2862
|
+
/**
|
|
2863
|
+
* Send a nodeAdded event
|
|
2864
|
+
* Used to notify the server when a node is added to the graph during execution
|
|
2865
|
+
*/
|
|
2866
|
+
sendNodeAdded(runId: string, graphId: string, nodeId: string, nodeType: string, nodeData?: unknown): void;
|
|
2867
|
+
getRunHistory(options?: {
|
|
2868
|
+
limit?: number;
|
|
2869
|
+
graphId?: string;
|
|
2870
|
+
}): Promise<Array<{
|
|
2871
|
+
runId: string;
|
|
2872
|
+
graphId: string;
|
|
2873
|
+
status: RunStatus;
|
|
2874
|
+
startedAt: number;
|
|
2875
|
+
completedAt?: number;
|
|
2876
|
+
elapsedMs: number;
|
|
2877
|
+
result?: unknown;
|
|
2878
|
+
}>>;
|
|
2879
|
+
addNode(runId: string, nodeId: string, nodeType: string, nodeData?: Record<string, unknown>, position?: {
|
|
2880
|
+
x: number;
|
|
2881
|
+
y: number;
|
|
2882
|
+
}): void;
|
|
2883
|
+
removeNode(runId: string, nodeId: string): void;
|
|
2884
|
+
updateSocketValue(runId: string, nodeId: string, socketName: string, value: unknown): void;
|
|
2885
|
+
updateNodeParam(runId: string, nodeId: string, paramName: string, value: unknown): void;
|
|
2886
|
+
createLink(runId: string, fromNodeId: string, fromSocket: string, toNodeId: string, toSocket: string): void;
|
|
2887
|
+
removeLink(runId: string, fromNodeId: string, fromSocket: string, toNodeId: string, toSocket: string): void;
|
|
2888
|
+
directExecuteNode(runId: string, nodeId: string, inputSocketName: string, inputValue: unknown, autoExecMode?: 'new' | 'current'): void;
|
|
2889
|
+
on<T extends ServerGraphRunnerMessage['type']>(messageType: T, handler: ServerMessageHandler<T>): void;
|
|
2890
|
+
off<T extends ServerGraphRunnerMessage['type']>(messageType: T, handler: ServerMessageHandler<T>): void;
|
|
2891
|
+
getConnectionState(): 'disconnected' | 'connecting' | 'authenticating' | 'connected';
|
|
2892
|
+
getSessionId(): string | null;
|
|
2893
|
+
getCachedCapabilities(): GraphRunnerCapabilities | null;
|
|
2894
|
+
isAuthenticated(): boolean;
|
|
2895
|
+
getUserId(): string | null;
|
|
2896
|
+
getServerId(): string | null;
|
|
2897
|
+
isConnected(): boolean;
|
|
2898
|
+
private send;
|
|
2899
|
+
private handleMessage;
|
|
2900
|
+
private handleTransportStateChange;
|
|
2901
|
+
private handleTransportError;
|
|
2902
|
+
private request;
|
|
2903
|
+
private ensureSession;
|
|
2904
|
+
private generateRequestId;
|
|
2905
|
+
private getExpectedResponseType;
|
|
2906
|
+
}
|
|
2907
|
+
//#endregion
|
|
2908
|
+
//#region src/plugin/graphrunner/store.d.ts
|
|
2909
|
+
interface MessageActivity {
|
|
2910
|
+
id: string;
|
|
2911
|
+
timestamp: number;
|
|
2912
|
+
direction: 'sent' | 'received';
|
|
2913
|
+
message: GraphRunnerMessage;
|
|
2914
|
+
}
|
|
2915
|
+
interface ConnectionConfig {
|
|
2916
|
+
url: string;
|
|
2917
|
+
auth: AuthCredentials;
|
|
2918
|
+
autoReconnect: boolean;
|
|
2919
|
+
}
|
|
2920
|
+
interface ConnectionInfo {
|
|
2921
|
+
serverId: string | null;
|
|
2922
|
+
userId: string | null;
|
|
2923
|
+
sessionId: string | null;
|
|
2924
|
+
authenticated: boolean;
|
|
2925
|
+
capabilities: GraphRunnerCapabilities | null;
|
|
2926
|
+
}
|
|
2927
|
+
interface GraphRunnerClientStore {
|
|
2928
|
+
connectionState: 'disconnected' | 'connecting' | 'authenticating' | 'connected';
|
|
2929
|
+
connectionConfig: ConnectionConfig;
|
|
2930
|
+
connectionInfo: ConnectionInfo;
|
|
2931
|
+
error: string | null;
|
|
2932
|
+
client: GraphRunnerClient | null;
|
|
2933
|
+
serverVariables: ServerVariable[];
|
|
2934
|
+
serverEvents: ServerEvent[];
|
|
2935
|
+
nodeTypes: NodeSpecJSON[];
|
|
2936
|
+
messageActivity: MessageActivity[];
|
|
2937
|
+
maxActivityMessages: number;
|
|
2938
|
+
clearLogsOnRun: boolean;
|
|
2939
|
+
clearTracesOnRun: boolean;
|
|
2940
|
+
enableTracing: boolean;
|
|
2941
|
+
setConnectionConfig: (config: Partial<ConnectionConfig>) => void;
|
|
2942
|
+
setClient: (client: GraphRunnerClient | null) => void;
|
|
2943
|
+
setConnectionState: (state: 'disconnected' | 'connecting' | 'authenticating' | 'connected') => void;
|
|
2944
|
+
setConnectionInfo: (info: Partial<ConnectionInfo>) => void;
|
|
2945
|
+
setError: (error: string | null) => void;
|
|
2946
|
+
setServerVariables: (variables: ServerVariable[]) => void;
|
|
2947
|
+
setServerEvents: (events: ServerEvent[]) => void;
|
|
2948
|
+
setNodeTypes: (nodeTypes: NodeSpecJSON[]) => void;
|
|
2949
|
+
clearServerMetadata: () => void;
|
|
2950
|
+
addMessageActivity: (direction: 'sent' | 'received', message: GraphRunnerMessage) => void;
|
|
2951
|
+
clearMessageActivity: () => void;
|
|
2952
|
+
setClearLogsOnRun: (clear: boolean) => void;
|
|
2953
|
+
setClearTracesOnRun: (clear: boolean) => void;
|
|
2954
|
+
setEnableTracing: (enable: boolean) => void;
|
|
2955
|
+
}
|
|
2956
|
+
declare const graphRunnerClientStoreFactory: (system: System) => StoreApi<GraphRunnerClientStore>;
|
|
2957
|
+
//#endregion
|
|
2958
|
+
//#region src/plugin/graphrunner/panel.d.ts
|
|
2959
|
+
interface GraphRunnerPanelProps {
|
|
2960
|
+
system: System;
|
|
2961
|
+
}
|
|
2962
|
+
declare const GraphRunnerPanel: React$1.FC<GraphRunnerPanelProps>;
|
|
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
|
|
3017
|
+
//#region src/plugin/graphrunner/runner.d.ts
|
|
3018
|
+
declare module '@/system/system' {
|
|
3019
|
+
interface System {
|
|
3020
|
+
runner: GraphRunner;
|
|
3021
|
+
}
|
|
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
|
+
*/
|
|
3030
|
+
declare class GraphRunner {
|
|
3031
|
+
private system;
|
|
3032
|
+
readonly store: StoreApi<GraphRunnerClientStore>;
|
|
3033
|
+
/** runId -> the controller that started it. */
|
|
3034
|
+
readonly runIndex: Map<string, GraphRunController>;
|
|
3035
|
+
constructor(system: System, store: StoreApi<GraphRunnerClientStore>);
|
|
3036
|
+
registerRun(runId: string, controller: GraphRunController): void;
|
|
3037
|
+
unregisterRun(runId: string): void;
|
|
3038
|
+
/**
|
|
3039
|
+
* Connect to the graph runner server
|
|
3040
|
+
*/
|
|
3041
|
+
connect(): Promise<void>;
|
|
3042
|
+
/**
|
|
3043
|
+
* Disconnect from the graph runner server
|
|
3044
|
+
*/
|
|
3045
|
+
disconnect(): Promise<void>;
|
|
3046
|
+
/**
|
|
3047
|
+
* Refresh server metadata (variables, events, node types)
|
|
3048
|
+
*/
|
|
3049
|
+
refreshMetadata(): Promise<void>;
|
|
3050
|
+
}
|
|
3051
|
+
//#endregion
|
|
3052
|
+
//#region src/plugin/graphrunner/session.d.ts
|
|
3053
|
+
/**
|
|
3054
|
+
* Session configuration for graph execution
|
|
3055
|
+
*/
|
|
3056
|
+
interface SessionConfig {
|
|
3057
|
+
/** Custom metadata attached to the session */
|
|
3058
|
+
metadata?: Record<string, unknown>;
|
|
3059
|
+
/** Default execution options for all runs in this session */
|
|
3060
|
+
defaultExecutionOptions?: {
|
|
3061
|
+
autoEnd?: boolean;
|
|
3062
|
+
trace?: boolean;
|
|
3063
|
+
eventFilter?: EventFilter;
|
|
3064
|
+
maxExecutionTimeMs?: number;
|
|
3065
|
+
};
|
|
3066
|
+
/** Session-level execution settings */
|
|
3067
|
+
executionSettings?: {
|
|
3068
|
+
/** Delay between execution steps in milliseconds */
|
|
3069
|
+
stepDelay?: number;
|
|
3070
|
+
/** Execution speed multiplier (0.1 to 2.0) */
|
|
3071
|
+
executionSpeed?: number;
|
|
3072
|
+
/** Interval between tick events in milliseconds */
|
|
3073
|
+
tickInterval?: number;
|
|
3074
|
+
/** Maximum number of concurrent runs allowed */
|
|
3075
|
+
maxConcurrentRuns?: number;
|
|
3076
|
+
};
|
|
3077
|
+
/** Custom hook for handling tick timing/delays */
|
|
3078
|
+
tickStrategy?: () => Promise<void>;
|
|
3079
|
+
/** Custom registry overrides for this session */
|
|
3080
|
+
registryOverrides?: Partial<IRegistry>;
|
|
3081
|
+
/** Session lifecycle hooks */
|
|
3082
|
+
hooks?: SessionHooks;
|
|
3083
|
+
/** Session-specific capabilities override */
|
|
3084
|
+
capabilities?: Partial<GraphRunnerCapabilities>;
|
|
3085
|
+
}
|
|
3086
|
+
/**
|
|
3087
|
+
* Lifecycle hooks for session events
|
|
3088
|
+
*/
|
|
3089
|
+
interface SessionHooks {
|
|
3090
|
+
/** Called when the session is created */
|
|
3091
|
+
onSessionCreated?: (session: Session) => void | Promise<void>;
|
|
3092
|
+
/** Called when a run starts in this session */
|
|
3093
|
+
onRunStarted?: (session: Session, runId: string, graphId: string) => void | Promise<void>;
|
|
3094
|
+
/** Called when a run completes in this session */
|
|
3095
|
+
onRunCompleted?: (session: Session, runId: string, graphId: string, result: unknown) => void | Promise<void>;
|
|
3096
|
+
/** Called when a run fails in this session */
|
|
3097
|
+
onRunError?: (session: Session, runId: string, graphId: string, error: Error) => void | Promise<void>;
|
|
3098
|
+
/** Called when the session is closed */
|
|
3099
|
+
onSessionClosed?: (session: Session) => void | Promise<void>;
|
|
3100
|
+
}
|
|
3101
|
+
/**
|
|
3102
|
+
* Session state
|
|
3103
|
+
*/
|
|
3104
|
+
interface Session {
|
|
3105
|
+
/** Unique session identifier */
|
|
3106
|
+
readonly sessionId: string;
|
|
3107
|
+
/** Session expiration timestamp */
|
|
3108
|
+
readonly expiresAt: number;
|
|
3109
|
+
/** Session creation timestamp */
|
|
3110
|
+
readonly createdAt: number;
|
|
3111
|
+
/** Session configuration */
|
|
3112
|
+
readonly config: SessionConfig;
|
|
3113
|
+
/** Active run IDs in this session */
|
|
3114
|
+
readonly activeRuns: Set<string>;
|
|
3115
|
+
/** Custom session state (user-definable) */
|
|
3116
|
+
state: Record<string, unknown>;
|
|
3117
|
+
/** Session metadata */
|
|
3118
|
+
metadata: Record<string, unknown>;
|
|
3119
|
+
}
|
|
3120
|
+
/**
|
|
3121
|
+
* Factory for creating sessions with custom configuration
|
|
3122
|
+
*/
|
|
3123
|
+
interface SessionFactory {
|
|
3124
|
+
/**
|
|
3125
|
+
* Create a new session with optional configuration
|
|
3126
|
+
*/
|
|
3127
|
+
createSession(sessionId: string, config?: SessionConfig): Session;
|
|
3128
|
+
}
|
|
3129
|
+
/**
|
|
3130
|
+
* Default session factory implementation
|
|
3131
|
+
*/
|
|
3132
|
+
declare class DefaultSessionFactory implements SessionFactory {
|
|
3133
|
+
private defaultConfig?;
|
|
3134
|
+
constructor(defaultConfig?: SessionConfig);
|
|
3135
|
+
createSession(sessionId: string, config?: SessionConfig): Session;
|
|
3136
|
+
}
|
|
3137
|
+
/**
|
|
3138
|
+
* Session manager to track and manage multiple sessions
|
|
3139
|
+
*/
|
|
3140
|
+
declare class SessionManager {
|
|
3141
|
+
private sessions;
|
|
3142
|
+
private sessionFactory;
|
|
3143
|
+
constructor(sessionFactory?: SessionFactory);
|
|
3144
|
+
/**
|
|
3145
|
+
* Create a new session
|
|
3146
|
+
*/
|
|
3147
|
+
createSession(sessionId: string, config?: SessionConfig): Session;
|
|
3148
|
+
/**
|
|
3149
|
+
* Get an existing session
|
|
3150
|
+
*/
|
|
3151
|
+
getSession(sessionId: string): Session | undefined;
|
|
3152
|
+
/**
|
|
3153
|
+
* Check if a session exists
|
|
3154
|
+
*/
|
|
3155
|
+
hasSession(sessionId: string): boolean;
|
|
3156
|
+
/**
|
|
3157
|
+
* Close and remove a session
|
|
3158
|
+
*/
|
|
3159
|
+
closeSession(sessionId: string): Promise<void>;
|
|
3160
|
+
/**
|
|
3161
|
+
* Add a run to a session
|
|
3162
|
+
*/
|
|
3163
|
+
addRunToSession(sessionId: string, runId: string): void;
|
|
3164
|
+
/**
|
|
3165
|
+
* Remove a run from a session
|
|
3166
|
+
*/
|
|
3167
|
+
removeRunFromSession(sessionId: string, runId: string): void;
|
|
3168
|
+
/**
|
|
3169
|
+
* Get all active sessions
|
|
3170
|
+
*/
|
|
3171
|
+
getActiveSessions(): Session[];
|
|
3172
|
+
/**
|
|
3173
|
+
* Clean up expired sessions
|
|
3174
|
+
*/
|
|
3175
|
+
cleanupExpiredSessions(): void;
|
|
3176
|
+
}
|
|
3177
|
+
//#endregion
|
|
3178
|
+
//#region src/plugin/graphrunner/index.d.ts
|
|
3179
|
+
/**
|
|
3180
|
+
* Options for the GraphRunner plugin
|
|
3181
|
+
*/
|
|
3182
|
+
interface GraphRunnerClientPluginOptions {
|
|
3183
|
+
/**
|
|
3184
|
+
* Preconfigured GraphRunner client instance.
|
|
3185
|
+
* If provided, the plugin will use this client instead of creating a new one.
|
|
3186
|
+
* Useful when the client is already connected via a custom transport (e.g., VSCode IPC).
|
|
3187
|
+
*/
|
|
3188
|
+
client?: GraphRunnerClient;
|
|
3189
|
+
/**
|
|
3190
|
+
* Preconfigured store instance.
|
|
3191
|
+
* If provided, the plugin will use this store instead of creating a new one.
|
|
3192
|
+
* Useful for sharing state with external components.
|
|
3193
|
+
*/
|
|
3194
|
+
store?: StoreApi<GraphRunnerClientStore>;
|
|
3195
|
+
/**
|
|
3196
|
+
* Whether to skip automatic connection.
|
|
3197
|
+
* Default: false (will attempt to connect if client is not provided or not connected)
|
|
3198
|
+
*/
|
|
3199
|
+
skipAutoConnect?: boolean;
|
|
3200
|
+
/**
|
|
3201
|
+
* Whether to add the menu item to the Window menu.
|
|
3202
|
+
* Default: true
|
|
3203
|
+
*/
|
|
3204
|
+
addMenuItem?: boolean;
|
|
3205
|
+
}
|
|
3206
|
+
/**
|
|
3207
|
+
* Plugin initialization function
|
|
3208
|
+
* Registers the GraphRunnerClient store and actions with the system
|
|
3209
|
+
*/
|
|
3210
|
+
declare function graphRunnerClientPluginLoader(system: System, options?: GraphRunnerClientPluginOptions): Promise<void>;
|
|
3211
|
+
declare const graphRunnerClientPlugin: LoadablePlugin<GraphRunnerClientPluginOptions | undefined>;
|
|
3212
|
+
//#endregion
|
|
3213
|
+
//#region src/plugin/graphrunner-local/store.d.ts
|
|
3214
|
+
interface LocalGraphRunnerStore {
|
|
3215
|
+
executionSpeed: number;
|
|
3216
|
+
stepDelay: number;
|
|
3217
|
+
tickInterval: number;
|
|
3218
|
+
isExecuting: boolean;
|
|
3219
|
+
isPaused: boolean;
|
|
3220
|
+
activeRuns: number;
|
|
3221
|
+
setExecutionSpeed: (speed: number) => void;
|
|
3222
|
+
setStepDelay: (delay: number) => void;
|
|
3223
|
+
setTickInterval: (interval: number) => void;
|
|
3224
|
+
setIsExecuting: (isExecuting: boolean) => void;
|
|
3225
|
+
setIsPaused: (isPaused: boolean) => void;
|
|
3226
|
+
setActiveRuns: (count: number) => void;
|
|
3227
|
+
}
|
|
3228
|
+
declare const localGraphRunnerStoreFactory: () => zustand5.StoreApi<LocalGraphRunnerStore>;
|
|
3229
|
+
//#endregion
|
|
3230
|
+
//#region src/plugin/graphrunner-local/transport.d.ts
|
|
3231
|
+
/**
|
|
3232
|
+
* Local transport that executes graphs in the browser using the Engine
|
|
3233
|
+
*/
|
|
3234
|
+
declare class LocalTransport implements ITransport, IExecutionControl {
|
|
3235
|
+
private state;
|
|
3236
|
+
private messageHandlers;
|
|
3237
|
+
private stateChangeHandlers;
|
|
3238
|
+
private errorHandlers;
|
|
3239
|
+
private registry;
|
|
3240
|
+
private sessionManager;
|
|
3241
|
+
private activeRuns;
|
|
3242
|
+
private store;
|
|
3243
|
+
private variables;
|
|
3244
|
+
private serverEvents;
|
|
3245
|
+
private resolveGraph?;
|
|
3246
|
+
constructor(registry: IRegistry, options?: {
|
|
3247
|
+
store?: StoreApi<LocalGraphRunnerStore>;
|
|
3248
|
+
variables?: ServerVariable[];
|
|
3249
|
+
serverEvents?: ServerEvent[];
|
|
3250
|
+
sessionFactory?: SessionFactory;
|
|
3251
|
+
/**
|
|
3252
|
+
* Resolve a referenced graph's JSON by id, enabling Call Subgraph nodes.
|
|
3253
|
+
*/
|
|
3254
|
+
resolveGraph?: (id: string) => GraphJSON | undefined;
|
|
3255
|
+
});
|
|
3256
|
+
/**
|
|
3257
|
+
* Create a logger that forwards log messages to the client
|
|
3258
|
+
*/
|
|
3259
|
+
private createTransportLogger;
|
|
3260
|
+
getState(): TransportState;
|
|
3261
|
+
connect(): Promise<void>;
|
|
3262
|
+
disconnect(): void;
|
|
3263
|
+
send(message: GraphRunnerMessage): void;
|
|
3264
|
+
onMessage(handler: (message: ServerGraphRunnerMessage) => void): void;
|
|
3265
|
+
onStateChange(handler: (state: TransportState) => void): void;
|
|
3266
|
+
onError(handler: (error: Error) => void): void;
|
|
3267
|
+
removeAllHandlers(): void;
|
|
3268
|
+
private setState;
|
|
3269
|
+
private notifyError;
|
|
3270
|
+
private notifyMessage;
|
|
3271
|
+
updateStoreActiveRuns(): void;
|
|
3272
|
+
private updateStoreExecutionState;
|
|
3273
|
+
private getExecutionDelay;
|
|
3274
|
+
private getExecutionStepLimit;
|
|
3275
|
+
private getTickInterval;
|
|
3276
|
+
/**
|
|
3277
|
+
* Get the default sleep-based tick strategy
|
|
3278
|
+
*/
|
|
3279
|
+
private createSleepTickStrategy;
|
|
3280
|
+
private generateId;
|
|
3281
|
+
private handleMessage;
|
|
3282
|
+
private handleHello;
|
|
3283
|
+
private handleCreateSession;
|
|
3284
|
+
private handleGetCapabilities;
|
|
3285
|
+
private handleGetServerVariables;
|
|
3286
|
+
private handleGetServerEvents;
|
|
3287
|
+
private handleGetSocketConstraints;
|
|
3288
|
+
private handleGetNodeTypes;
|
|
3289
|
+
private handleRunGraph;
|
|
3290
|
+
private executeGraph;
|
|
3291
|
+
/**
|
|
3292
|
+
* Execute engine with pause support - executes one step at a time with configurable delay
|
|
3293
|
+
*/
|
|
3294
|
+
private executeWithPauseSupport;
|
|
3295
|
+
/**
|
|
3296
|
+
* Pause execution of a running graph
|
|
3297
|
+
*/
|
|
3298
|
+
pauseExecution(runId: string): void;
|
|
3299
|
+
/**
|
|
3300
|
+
* Resume execution of a paused graph
|
|
3301
|
+
*/
|
|
3302
|
+
resumeExecution(runId: string): Promise<void>;
|
|
3303
|
+
/**
|
|
3304
|
+
* Step forward one execution step
|
|
3305
|
+
*/
|
|
3306
|
+
stepExecution(runId: string): Promise<void>;
|
|
3307
|
+
/**
|
|
3308
|
+
* Check if a run is currently paused
|
|
3309
|
+
*/
|
|
3310
|
+
isPaused(runId: string): boolean;
|
|
3311
|
+
private handleStopGraph;
|
|
3312
|
+
private handleGetStatus;
|
|
3313
|
+
private handleCloseSession;
|
|
3314
|
+
private sendError;
|
|
3315
|
+
private handleAddNode;
|
|
3316
|
+
private handleRemoveNode;
|
|
3317
|
+
private handleUpdateSocketValue;
|
|
3318
|
+
private handleUpdateNodeParam;
|
|
3319
|
+
private handleCreateLink;
|
|
3320
|
+
private handleRemoveLink;
|
|
3321
|
+
private handleDirectExecuteNode;
|
|
3322
|
+
private getDownstreamNodes;
|
|
3323
|
+
}
|
|
3324
|
+
//#endregion
|
|
3325
|
+
//#region src/plugin/graphrunner-local/panel.d.ts
|
|
3326
|
+
declare const LocalGraphRunnerPanel: () => react_jsx_runtime0.JSX.Element;
|
|
3327
|
+
//#endregion
|
|
3328
|
+
//#region src/plugin/graphrunner-local/types.d.ts
|
|
3329
|
+
/**
|
|
3330
|
+
* Extend the System interface to include the local graph runner store
|
|
3331
|
+
*/
|
|
3332
|
+
declare module '@/system/system' {
|
|
3333
|
+
interface System {
|
|
3334
|
+
localGraphRunnerStore: ReturnType<typeof localGraphRunnerStoreFactory>;
|
|
3335
|
+
}
|
|
3336
|
+
}
|
|
3337
|
+
//# sourceMappingURL=types.d.ts.map
|
|
3338
|
+
|
|
3339
|
+
//#endregion
|
|
3340
|
+
//#region src/plugin/graphrunner-local/index.d.ts
|
|
3341
|
+
/**
|
|
3342
|
+
* Options for the local graph runner plugin
|
|
3343
|
+
*/
|
|
3344
|
+
interface LocalGraphRunnerPluginOptions {
|
|
3345
|
+
/**
|
|
3346
|
+
* Node registry with registered nodes, values, and dependencies.
|
|
3347
|
+
* Required for graph execution.
|
|
3348
|
+
*/
|
|
3349
|
+
registry: IRegistry;
|
|
3350
|
+
variables?: ServerVariable[];
|
|
3351
|
+
events?: ServerEvent[];
|
|
3352
|
+
sessionFactory?: SessionFactory;
|
|
3353
|
+
/**
|
|
3354
|
+
* Custom tick strategy hook for controlling timing between tick events.
|
|
3355
|
+
* If not provided, defaults to requestAnimationFrame for smooth browser refresh sync.
|
|
3356
|
+
*/
|
|
3357
|
+
tickStrategy?: () => Promise<void>;
|
|
3358
|
+
/**
|
|
3359
|
+
* Whether to skip automatic connection.
|
|
3360
|
+
* Default: false (will attempt to connect immediately)
|
|
3361
|
+
*/
|
|
3362
|
+
skipAutoConnect?: boolean;
|
|
3363
|
+
/**
|
|
3364
|
+
* Whether to add the menu item to the Window menu.
|
|
3365
|
+
* Default: true
|
|
3366
|
+
*/
|
|
3367
|
+
addMenuItem?: boolean;
|
|
3368
|
+
}
|
|
3369
|
+
/**
|
|
3370
|
+
* Plugin initialization function for local graph execution
|
|
3371
|
+
* Registers a GraphRunnerClient with a local transport that executes graphs in-browser
|
|
3372
|
+
*/
|
|
3373
|
+
declare function localGraphRunnerPluginLoader(system: System, options: LocalGraphRunnerPluginOptions): Promise<void>;
|
|
3374
|
+
declare const localGraphRunnerPlugin: LoadablePlugin<LocalGraphRunnerPluginOptions>;
|
|
3375
|
+
//#endregion
|
|
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 };
|
|
3597
|
+
//# sourceMappingURL=index.d.ts.map
|