@kiberon-labs/behave-graph-flow 1.0.0 → 2.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.
Files changed (314) hide show
  1. package/.fallowrc.json +16 -0
  2. package/.storybook/main.ts +32 -0
  3. package/.storybook/preview.ts +16 -0
  4. package/.storybook/styles.css +10 -0
  5. package/.storybook/vscode.css +814 -0
  6. package/.turbo/turbo-build.log +7 -0
  7. package/LICENSE +6 -0
  8. package/README.md +2 -2
  9. package/data/Polynomial.json +510 -0
  10. package/data/sequence.json +337 -0
  11. package/data/trigger-event.json +241 -0
  12. package/data/variable-change.json +210 -0
  13. package/dist/entry.css +4 -0
  14. package/dist/index.css +39 -0
  15. package/dist/index.css.map +1 -0
  16. package/dist/index.d.ts +2282 -0
  17. package/dist/index.d.ts.map +1 -0
  18. package/dist/index.js +14873 -0
  19. package/dist/index.js.map +1 -0
  20. package/docs/notifications.md +246 -0
  21. package/docs/protocol.md +679 -0
  22. package/docs/specifics.md +191 -0
  23. package/package.json +85 -21
  24. package/postcss.config.ts +3 -4
  25. package/src/annotations/index.ts +32 -0
  26. package/src/components/FloatingToolbar/index.module.css +45 -0
  27. package/src/components/FloatingToolbar/index.tsx +256 -0
  28. package/src/components/Flow.tsx +276 -75
  29. package/src/components/contextMenus/NodePicker.module.css +274 -0
  30. package/src/components/contextMenus/NodePicker.tsx +481 -0
  31. package/src/components/contextMenus/edge.tsx +108 -0
  32. package/src/components/contextMenus/node.tsx +155 -0
  33. package/src/components/contextMenus/selection.tsx +77 -0
  34. package/src/components/controls/any/index.tsx +8 -0
  35. package/src/components/controls/boolean/index.tsx +13 -0
  36. package/src/components/controls/colorPicker/InputPopover.module.css +100 -0
  37. package/src/components/controls/colorPicker/InputPopover.tsx +31 -0
  38. package/src/components/controls/colorPicker/index.module.css +18 -0
  39. package/src/components/controls/colorPicker/index.tsx +61 -0
  40. package/src/components/controls/number/index.tsx +35 -0
  41. package/src/components/controls/string/index.tsx +16 -0
  42. package/src/components/edges/index.tsx +469 -0
  43. package/src/components/edges/offsetBezier.ts +134 -0
  44. package/src/components/hotKeys.tsx +20 -0
  45. package/src/components/layoutController/index.module.css +10 -0
  46. package/src/components/layoutController/index.tsx +117 -0
  47. package/src/components/layoutController/utils.ts +205 -0
  48. package/src/components/menubar/defaults.tsx +480 -0
  49. package/src/components/menubar/index.tsx +49 -0
  50. package/src/components/menubar/menuItem.module.css +16 -0
  51. package/src/components/menubar/menuItem.tsx +32 -0
  52. package/src/components/nodes/behave/Node.module.css +23 -0
  53. package/src/components/nodes/behave/Node.tsx +176 -0
  54. package/src/components/nodes/behave/NodeContainer.module.css +87 -0
  55. package/src/components/nodes/behave/NodeContainer.tsx +46 -0
  56. package/src/components/nodes/behave/index.tsx +14 -0
  57. package/src/components/nodes/comment/FormatToolbar.tsx +118 -0
  58. package/src/components/nodes/comment/comment.tsx +103 -0
  59. package/src/components/nodes/comment/styles.module.css +150 -0
  60. package/src/components/nodes/group/index.tsx +109 -0
  61. package/src/components/nodes/wrapper/index.tsx +73 -0
  62. package/src/components/nodes/wrapper/styles.module.css +113 -0
  63. package/src/components/notifications/NotificationProvider.tsx +81 -0
  64. package/src/components/notifications/index.ts +2 -0
  65. package/src/components/notifications/utils.ts +71 -0
  66. package/src/components/panels/alignment/index.module.css +20 -0
  67. package/src/components/panels/alignment/index.tsx +244 -0
  68. package/src/components/panels/base/index.tsx +5 -0
  69. package/src/components/panels/base/styles.module.css +12 -0
  70. package/src/components/panels/conversation/index.module.css +151 -0
  71. package/src/components/panels/conversation/index.tsx +162 -0
  72. package/src/components/panels/events/CustomEventsEditor.tsx +384 -0
  73. package/src/components/panels/events/EditEventPanel.tsx +315 -0
  74. package/src/components/panels/events/ManageEventsPanel.tsx +98 -0
  75. package/src/components/panels/events/index.tsx +23 -0
  76. package/src/components/panels/events/styles.module.css +236 -0
  77. package/src/components/panels/history/index.tsx +92 -0
  78. package/src/components/panels/history/styles.module.css +106 -0
  79. package/src/components/panels/keymaps/index.module.css +78 -0
  80. package/src/components/panels/keymaps/index.tsx +167 -0
  81. package/src/components/panels/layers/index.tsx +240 -0
  82. package/src/components/panels/layers/styles.module.css +110 -0
  83. package/src/components/panels/legend/index.module.css +6 -0
  84. package/src/components/panels/legend/index.tsx +76 -0
  85. package/src/components/panels/logs/index.module.css +212 -0
  86. package/src/components/panels/logs/index.tsx +288 -0
  87. package/src/components/panels/nodeInputs/InputControl.tsx +63 -0
  88. package/src/components/panels/nodeInputs/InputsGroup.tsx +64 -0
  89. package/src/components/panels/nodeInputs/MultipleNodesView.tsx +37 -0
  90. package/src/components/panels/nodeInputs/NodeSettings.tsx +92 -0
  91. package/src/components/panels/nodeInputs/NodeTitleEditor.tsx +125 -0
  92. package/src/components/panels/nodeInputs/OutputsGroup.tsx +65 -0
  93. package/src/components/panels/nodeInputs/SocketGenerators.tsx +32 -0
  94. package/src/components/panels/nodeInputs/index.module.css +284 -0
  95. package/src/components/panels/nodeInputs/index.tsx +339 -0
  96. package/src/components/panels/nodeInputs/useNodeHandlers.ts +76 -0
  97. package/src/components/panels/nodeInputs/useNodeInputsData.ts +173 -0
  98. package/src/components/panels/nodePicker/index.tsx +115 -0
  99. package/src/components/panels/panel/index.module.css +66 -0
  100. package/src/components/panels/panel/index.tsx +88 -0
  101. package/src/components/panels/search/index.module.css +66 -0
  102. package/src/components/panels/search/index.tsx +215 -0
  103. package/src/components/panels/systemSettings/index.tsx +206 -0
  104. package/src/components/panels/systemSettings/styles.module.css +11 -0
  105. package/src/components/panels/traces/GridLines.tsx +38 -0
  106. package/src/components/panels/traces/TimeGrid.tsx +48 -0
  107. package/src/components/panels/traces/TraceLane.tsx +62 -0
  108. package/src/components/panels/traces/TraceTooltip.tsx +22 -0
  109. package/src/components/panels/traces/TracesHeader.tsx +56 -0
  110. package/src/components/panels/traces/index.module.css +166 -0
  111. package/src/components/panels/traces/index.tsx +294 -0
  112. package/src/components/panels/traces/types.ts +48 -0
  113. package/src/components/panels/traces/useDerivedSpans.ts +212 -0
  114. package/src/components/panels/traces/utils.ts +25 -0
  115. package/src/components/panels/variables/CreateVariableScreen.tsx +162 -0
  116. package/src/components/panels/variables/ManageVariablesScreen.tsx +144 -0
  117. package/src/components/panels/variables/index.tsx +125 -0
  118. package/src/components/panels/variables/styles.module.css +236 -0
  119. package/src/components/primitives/icon.module.css +45 -0
  120. package/src/components/primitives/icon.tsx +38 -0
  121. package/src/components/sockets/input/index.tsx +76 -0
  122. package/src/components/sockets/input/styles.module.css +27 -0
  123. package/src/components/sockets/output/index.tsx +61 -0
  124. package/src/components/sockets/output/styles.module.css +27 -0
  125. package/src/css/prosemirror.css +57 -0
  126. package/src/css/rc-dock.css +112 -0
  127. package/src/css/rc-menu.css +100 -0
  128. package/src/css/vars.css +14 -0
  129. package/src/css/vscode.css +13 -0
  130. package/src/entry.css +4 -0
  131. package/src/generators/CustomEventOnTriggeredGenerator.tsx +85 -0
  132. package/src/generators/SequenceGenerator.tsx +104 -0
  133. package/src/generators/SwitchOnIntegerGenerator.tsx +256 -0
  134. package/src/generators/SwitchOnStringGenerator.tsx +263 -0
  135. package/src/generators/registerDefaultGenerators.ts +34 -0
  136. package/src/hooks/useBehaveGraphFlow.ts +17 -16
  137. package/src/hooks/useDetachNodes.ts +39 -0
  138. package/src/hooks/useFlowHandlers.ts +115 -29
  139. package/src/hooks/useWasdPan.ts +188 -0
  140. package/src/index.css +146 -0
  141. package/src/index.ts +36 -18
  142. package/src/layout/dagre.tsx +119 -0
  143. package/src/layout/elk.ts +200 -0
  144. package/src/plugin/alignment/index.ts +81 -0
  145. package/src/plugin/docs/index.tsx +299 -0
  146. package/src/plugin/docs/panel/index.tsx +200 -0
  147. package/src/plugin/docs/panel/styles.module.css +174 -0
  148. package/src/plugin/graphrunner/actions.ts +253 -0
  149. package/src/plugin/graphrunner/buttons.tsx +87 -0
  150. package/src/plugin/graphrunner/client.ts +704 -0
  151. package/src/plugin/graphrunner/index.tsx +255 -0
  152. package/src/plugin/graphrunner/panel.tsx +386 -0
  153. package/src/plugin/graphrunner/runner.ts +358 -0
  154. package/src/plugin/graphrunner/session.ts +243 -0
  155. package/src/plugin/graphrunner/store.ts +206 -0
  156. package/src/plugin/graphrunner/styles.module.css +211 -0
  157. package/src/plugin/graphrunner/transport.ts +224 -0
  158. package/src/plugin/graphrunner/types.ts +672 -0
  159. package/src/plugin/graphrunner-local/execution-utils.ts +457 -0
  160. package/src/plugin/graphrunner-local/index.tsx +166 -0
  161. package/src/plugin/graphrunner-local/panel.tsx +231 -0
  162. package/src/plugin/graphrunner-local/store.ts +41 -0
  163. package/src/plugin/graphrunner-local/styles.module.css +101 -0
  164. package/src/plugin/graphrunner-local/transport.ts +1372 -0
  165. package/src/plugin/graphrunner-local/types.ts +10 -0
  166. package/src/plugin/graphrunner-webworker/graph-executor.worker.ts +633 -0
  167. package/src/plugin/graphrunner-webworker/index.tsx +146 -0
  168. package/src/plugin/graphrunner-webworker/panel.tsx +173 -0
  169. package/src/plugin/graphrunner-webworker/store.ts +89 -0
  170. package/src/plugin/graphrunner-webworker/types.ts +17 -0
  171. package/src/plugin/graphrunner-webworker/worker-transport.ts +123 -0
  172. package/src/plugin/realtime/realtimeRunner.ts +570 -0
  173. package/src/specifics/CustomEventOnTriggeredSpecific.tsx +92 -0
  174. package/src/specifics/CustomEventTriggerSpecific.tsx +141 -0
  175. package/src/specifics/VariableGetSpecific.tsx +110 -0
  176. package/src/specifics/VariableSetSpecific.tsx +110 -0
  177. package/src/specifics/registerDefaultSpecifics.ts +5 -0
  178. package/src/store/actions.tsx +698 -0
  179. package/src/store/chat.ts +73 -0
  180. package/src/store/controls.tsx +62 -0
  181. package/src/store/documentation.tsx +69 -0
  182. package/src/store/events.tsx +116 -0
  183. package/src/store/flow.tsx +245 -0
  184. package/src/store/graphRunnerClient.ts +110 -0
  185. package/src/store/hotKeys.tsx +323 -0
  186. package/src/store/layers.ts +259 -0
  187. package/src/store/legend.tsx +76 -0
  188. package/src/store/logs.ts +28 -0
  189. package/src/store/menubar.ts +41 -0
  190. package/src/store/refs.ts +84 -0
  191. package/src/store/registry.ts +43 -0
  192. package/src/store/selection.ts +22 -0
  193. package/src/store/settings.ts +99 -0
  194. package/src/store/socketGenerator.tsx +54 -0
  195. package/src/store/specific.tsx +75 -0
  196. package/src/store/specs.tsx +35 -0
  197. package/src/store/tabs.ts +278 -0
  198. package/src/store/toolbar.tsx +45 -0
  199. package/src/store/traces.ts +240 -0
  200. package/src/store/variables.ts +37 -0
  201. package/src/system/graph.ts +134 -0
  202. package/src/system/index.ts +3 -0
  203. package/src/system/notifications.ts +98 -0
  204. package/src/system/plugin.ts +27 -0
  205. package/src/system/provider.tsx +22 -0
  206. package/src/system/pubsub.ts +323 -0
  207. package/src/system/system.ts +223 -0
  208. package/src/system/tabLoader.tsx +265 -0
  209. package/src/system/undoRedo.ts +103 -0
  210. package/src/transformers/Uigraph.ts +60 -0
  211. package/src/transformers/behaveToFlow.ts +16 -4
  212. package/src/transformers/flowToBehave.ts +32 -12
  213. package/src/types/NodeMetadata.ts +27 -0
  214. package/src/types/graph.ts +49 -0
  215. package/src/types/nodes.ts +45 -0
  216. package/src/types.ts +16 -0
  217. package/src/util/colors.ts +1 -29
  218. package/src/util/downloadJson.ts +18 -0
  219. package/src/util/extractNodeMetadata.ts +16 -0
  220. package/src/util/getPickerFilters.ts +1 -1
  221. package/src/util/isBehaveNode.ts +6 -0
  222. package/src/util/isValidConnection.ts +28 -15
  223. package/src/util/mergeSockets.ts +29 -0
  224. package/src/util/serializeVariables.ts +66 -0
  225. package/src/util/sockets.ts +43 -0
  226. package/stories/apex/layoutController/example-graph.worker.ts +39 -0
  227. package/stories/apex/layoutController/index.stories.tsx +48 -0
  228. package/stories/apex/layoutController/webworker.stories.tsx +103 -0
  229. package/stories/apex/menubar/menubar.stories.tsx +19 -0
  230. package/stories/components/colorpicker/index.stories.tsx +20 -0
  231. package/stories/components/contextMenus/edge.stories.tsx +32 -0
  232. package/stories/components/contextMenus/node.stories.tsx +26 -0
  233. package/stories/components/contextMenus/nodePicker.stories.tsx +115 -0
  234. package/stories/components/controls/any/index.stories.tsx +19 -0
  235. package/stories/components/controls/boolean/index.stories.tsx +19 -0
  236. package/stories/components/controls/colorPicker/index.stories.tsx +49 -0
  237. package/stories/components/controls/number/index.stories.tsx +19 -0
  238. package/stories/components/controls/string/index.stories.tsx +19 -0
  239. package/stories/components/nodes/behaveNode.stories.tsx +108 -0
  240. package/stories/components/nodes/comment.stories.tsx +106 -0
  241. package/stories/components/panels/alignment.stories.tsx +24 -0
  242. package/stories/components/panels/events.stories.tsx +38 -0
  243. package/stories/components/panels/graphRunner.stories.tsx +317 -0
  244. package/stories/components/panels/history.stories.tsx +37 -0
  245. package/stories/components/panels/keymaps.stories.tsx +21 -0
  246. package/stories/components/panels/legend.stories.tsx +37 -0
  247. package/stories/components/panels/logs.stories.tsx +24 -0
  248. package/stories/components/panels/nodeInputs.stories.tsx +21 -0
  249. package/stories/components/panels/nodePicker.stories.tsx +37 -0
  250. package/stories/components/panels/panel.stories.tsx +39 -0
  251. package/stories/components/panels/search.stories.tsx +24 -0
  252. package/stories/components/panels/systemSettings.stories.tsx +26 -0
  253. package/stories/components/panels/traces.stories.tsx +225 -0
  254. package/stories/components/panels/variables.stories.tsx +24 -0
  255. package/stories/defaults/defaultStoryProvider.tsx +167 -0
  256. package/stories/defaults/systemGenerator.ts +38 -0
  257. package/tests/components/edges/offsetBezier.test.ts +51 -0
  258. package/tests/components/layoutController/utils.test.ts +68 -0
  259. package/tests/components/panels/traces/utils.test.ts +52 -0
  260. package/tests/flowToBehave.test.ts +26 -4
  261. package/tests/notifications.test.ts +87 -0
  262. package/tests/saveLoad.test.ts +372 -0
  263. package/tests/util/calculateNewEdge.test.ts +98 -0
  264. package/tests/util/getSocketsByNodeTypeAndHandleType.test.ts +31 -0
  265. package/tests/util/hasPositionMetaData.test.ts +33 -0
  266. package/tests/util/isBehaveNode.test.ts +22 -0
  267. package/tests/util/isHandleConnected.test.ts +37 -0
  268. package/tests/util/mergeSockets.test.ts +43 -0
  269. package/tests/visual/README.md +64 -0
  270. package/tests/visual/__screenshots__/panels.visual.test.tsx/panel-alignment-chromium-win32.png +0 -0
  271. package/tests/visual/__screenshots__/panels.visual.test.tsx/panel-conversation-chromium-win32.png +0 -0
  272. package/tests/visual/__screenshots__/panels.visual.test.tsx/panel-events-chromium-win32.png +0 -0
  273. package/tests/visual/__screenshots__/panels.visual.test.tsx/panel-history-chromium-win32.png +0 -0
  274. package/tests/visual/__screenshots__/panels.visual.test.tsx/panel-keymaps-chromium-win32.png +0 -0
  275. package/tests/visual/__screenshots__/panels.visual.test.tsx/panel-layers-chromium-win32.png +0 -0
  276. package/tests/visual/__screenshots__/panels.visual.test.tsx/panel-legend-chromium-win32.png +0 -0
  277. package/tests/visual/__screenshots__/panels.visual.test.tsx/panel-logs-chromium-win32.png +0 -0
  278. package/tests/visual/__screenshots__/panels.visual.test.tsx/panel-nodeInputs-chromium-win32.png +0 -0
  279. package/tests/visual/__screenshots__/panels.visual.test.tsx/panel-nodePicker-chromium-win32.png +0 -0
  280. package/tests/visual/__screenshots__/panels.visual.test.tsx/panel-panel-chromium-win32.png +0 -0
  281. package/tests/visual/__screenshots__/panels.visual.test.tsx/panel-search-chromium-win32.png +0 -0
  282. package/tests/visual/__screenshots__/panels.visual.test.tsx/panel-systemSettings-chromium-win32.png +0 -0
  283. package/tests/visual/__screenshots__/panels.visual.test.tsx/panel-traces-chromium-win32.png +0 -0
  284. package/tests/visual/__screenshots__/panels.visual.test.tsx/panel-variables-chromium-win32.png +0 -0
  285. package/tests/visual/panels.visual.test.tsx +76 -0
  286. package/tsconfig.base.json +39 -0
  287. package/tsconfig.json +18 -59
  288. package/tsconfig.prod.json +23 -0
  289. package/tsdown.config.ts +15 -3
  290. package/typedoc.json +7 -7
  291. package/vite.config.js +7 -0
  292. package/vitest.config.ts +5 -2
  293. package/vitest.visual.config.ts +48 -0
  294. package/src/components/AutoSizeInput.tsx +0 -65
  295. package/src/components/Controls.tsx +0 -87
  296. package/src/components/InputSocket.tsx +0 -142
  297. package/src/components/Node.tsx +0 -68
  298. package/src/components/NodeContainer.tsx +0 -46
  299. package/src/components/NodePicker.tsx +0 -77
  300. package/src/components/OutputSocket.tsx +0 -58
  301. package/src/components/modals/ClearModal.tsx +0 -40
  302. package/src/components/modals/HelpModal.tsx +0 -36
  303. package/src/components/modals/LoadModal.tsx +0 -96
  304. package/src/components/modals/Modal.tsx +0 -64
  305. package/src/components/modals/SaveModal.tsx +0 -60
  306. package/src/hooks/useCustomNodeTypes.tsx +0 -31
  307. package/src/hooks/useGraphRunner.ts +0 -104
  308. package/src/hooks/useMergeMap.ts +0 -14
  309. package/src/hooks/useNodeSpecJson.ts +0 -20
  310. package/src/hooks/useQueriableDefinitions.ts +0 -22
  311. package/src/styles.css +0 -8
  312. package/tailwind.config.ts +0 -19
  313. package/tests/tsconfig.json +0 -10
  314. /package/src/{types.d.ts → types-declarations.d.ts} +0 -0
@@ -0,0 +1,2282 @@
1
+ import React$1, { ComponentType, MouseEvent as MouseEvent$1, ReactNode } from "react";
2
+ import * as reactflow0 from "reactflow";
3
+ import { Connection, ConnectionStatus, Edge, EdgeChange, EdgeProps, Node as Node$1, NodeChange, NodeProps, OnConnectStartParams, ReactFlowInstance, Viewport, XYPosition } from "reactflow";
4
+ import * as react_jsx_runtime0 from "react/jsx-runtime";
5
+ import * as zustand5 from "zustand";
6
+ import { StoreApi } from "zustand";
7
+ import * as _kiberon_labs_behave_graph0 from "@kiberon-labs/behave-graph";
8
+ import { ChoiceJSON, CustomEventJSON, CustomEventParameterJSON, Engine, GraphJSON, INode, IRegistry, InputSocketSpecJSON, LogSeverity, NodeSpecJSON, OutputSocketSpecJSON, VariableJSON as VariableJSON$1 } from "@kiberon-labs/behave-graph";
9
+ import { Item } from "rc-menu";
10
+ import { LayoutBase, TabBase, TabData } from "rc-dock";
11
+ import { Renderable, Toast } from "react-hot-toast";
12
+
13
+ //#region src/components/sockets/input/index.d.ts
14
+ type InputSocketProps = {
15
+ hide: boolean;
16
+ hideName?: boolean;
17
+ connected: boolean;
18
+ value: any | undefined;
19
+ onChange: (key: string, value: any) => void;
20
+ specJSON: NodeSpecJSON[];
21
+ } & InputSocketSpecJSON;
22
+ //#endregion
23
+ //#region src/types.d.ts
24
+ interface SocketBase {
25
+ name: string;
26
+ key: string;
27
+ choices?: ChoiceJSON;
28
+ valueType: string;
29
+ defaultValue?: any;
30
+ }
31
+ interface DynamicPorts {
32
+ inputs?: SocketBase[];
33
+ outputs?: SocketBase[];
34
+ }
35
+ //#endregion
36
+ //#region src/types/nodes.d.ts
37
+ /**
38
+ * These are the behave nodes in the scene
39
+ */
40
+ type IBehaveNode = Omit<Node$1, 'data' | 'type'> & {
41
+ type: 'behaveNode';
42
+ data: {
43
+ annotations?: Record<string, any>;
44
+ type: string;
45
+ dynamicPorts: DynamicPorts;
46
+ ports?: Record<string, any>;
47
+ configuration: Record<string, any>;
48
+ };
49
+ };
50
+ //#endregion
51
+ //#region src/components/nodes/behave/Node.d.ts
52
+ type BehaveNodeProps = NodeProps<IBehaveNode['data']> & {
53
+ spec: NodeSpecJSON;
54
+ allSpecs: NodeSpecJSON[];
55
+ };
56
+ declare const Node: ({
57
+ id,
58
+ data,
59
+ spec,
60
+ selected,
61
+ allSpecs
62
+ }: BehaveNodeProps) => react_jsx_runtime0.JSX.Element | null;
63
+ //#endregion
64
+ //#region src/components/Flow.d.ts
65
+ declare const Flow: React$1.FC;
66
+ //#endregion
67
+ //#region src/components/FloatingToolbar/index.d.ts
68
+ declare const FloatingToolbar: React$1.FC;
69
+ //#endregion
70
+ //#region src/store/documentation.d.ts
71
+ /**
72
+ * Documentation metadata for a node type
73
+ */
74
+ type NodeDocumentation = {
75
+ /** The node type this documentation applies to */
76
+ type: string;
77
+ /** Optional icon to display for the node */
78
+ icon?: React$1.ReactNode;
79
+ /** Short description (one line) */
80
+ shortDescription?: string;
81
+ /** Tags for categorization and search */
82
+ tags?: string[];
83
+ /** Long rich markdown description */
84
+ markdownDescription?: string;
85
+ };
86
+ type DocumentationStore = {
87
+ /** Map of node type to documentation */
88
+ docs: Map<string, NodeDocumentation>;
89
+ /** Set documentation for a specific node type */
90
+ setDocumentation: (type: string, doc: Omit<NodeDocumentation, 'type'>) => void;
91
+ /** Set documentation for multiple node types at once */
92
+ setMultipleDocumentation: (docs: NodeDocumentation[]) => void;
93
+ /** Get documentation for a specific node type */
94
+ getDocumentation: (type: string) => NodeDocumentation | undefined;
95
+ /** Clear all documentation */
96
+ clearDocumentation: () => void;
97
+ /** Remove documentation for a specific type */
98
+ removeDocumentation: (type: string) => void;
99
+ };
100
+ declare const documentationStoreFactory: () => zustand5.UseBoundStore<zustand5.StoreApi<DocumentationStore>>;
101
+ //#endregion
102
+ //#region src/components/contextMenus/NodePicker.d.ts
103
+ type NodePickerFilters = {
104
+ handleType: 'source' | 'target';
105
+ valueType: string;
106
+ };
107
+ type NodePickerViewMode = 'list' | 'grid' | 'tree';
108
+ type ExtendedNodeSpecJSON = NodeSpecJSON & {
109
+ nodeType?: string;
110
+ description?: string;
111
+ icon?: React$1.ReactNode;
112
+ tags?: string[];
113
+ markdownDescription?: string;
114
+ };
115
+ type NodePickerProps = {
116
+ position: XYPosition;
117
+ filters?: NodePickerFilters;
118
+ onPickNode: (node: ExtendedNodeSpecJSON, position: XYPosition) => void;
119
+ onClose: () => void;
120
+ specJSON: ExtendedNodeSpecJSON[];
121
+ documentation?: Map<string, NodeDocumentation>;
122
+ onShowDocumentation?: (nodeType: string) => void;
123
+ defaultViewMode?: NodePickerViewMode;
124
+ };
125
+ declare const NodePicker: React$1.FC<NodePickerProps>;
126
+ //#endregion
127
+ //#region src/components/sockets/output/index.d.ts
128
+ type OutputSocketProps = {
129
+ connected: boolean;
130
+ hide?: boolean;
131
+ specJSON: NodeSpecJSON[];
132
+ } & OutputSocketSpecJSON;
133
+ //#endregion
134
+ //#region src/components/menubar/menuItem.d.ts
135
+ type IMenuItemElement = React$1.ComponentProps<typeof Item> & {
136
+ icon?: React$1.ReactNode;
137
+ /**
138
+ * Needed to hack into the inner part of the menu item
139
+ */
140
+ inner?: (children: React$1.ReactNode) => React$1.ReactNode;
141
+ };
142
+ /**
143
+ * You must provide a unique key for each item
144
+ */
145
+ declare const MenuItemElement: ({
146
+ inner,
147
+ children,
148
+ ...rest
149
+ }: IMenuItemElement) => react_jsx_runtime0.JSX.Element;
150
+ //#endregion
151
+ //#region src/hooks/useChangeNodeData.d.ts
152
+ declare const useChangeNodeData: (id: string) => (key: string, value: any) => void;
153
+ //#endregion
154
+ //#region src/hooks/useOnPressKey.d.ts
155
+ declare const useOnPressKey: (key: string, callback: (e: KeyboardEvent) => void) => void;
156
+ //#endregion
157
+ //#region src/hooks/useBehaveGraphFlow.d.ts
158
+ /**
159
+ * Hook that returns the nodes and edges for react-flow, and the graphJson for the behave-graph.
160
+ * If nodes or edges are changes, the graph json is updated automatically.
161
+ * The graph json can be set manually, in which case the nodes and edges are updated to match the graph json.
162
+ * @param param0
163
+ * @returns
164
+ */
165
+ declare const useBehaveGraphFlow: ({
166
+ initialGraphJson,
167
+ specJson
168
+ }: {
169
+ initialGraphJson: GraphJSON;
170
+ specJson: NodeSpecJSON[] | undefined;
171
+ }) => {
172
+ nodes: reactflow0.Node[];
173
+ edges: reactflow0.Edge[];
174
+ onEdgesChange: (changes: reactflow0.EdgeChange[]) => void;
175
+ onNodesChange: (changes: reactflow0.NodeChange[]) => void;
176
+ setGraphJson: (graphJson: GraphJSON) => void;
177
+ graphJson: GraphJSON | undefined;
178
+ };
179
+ //#endregion
180
+ //#region src/hooks/useFlowHandlers.d.ts
181
+ type BehaveGraphFlow = ReturnType<typeof useBehaveGraphFlow>;
182
+ declare const useFlowHandlers: ({
183
+ onEdgesChange,
184
+ onNodesChange,
185
+ nodes,
186
+ specJSON
187
+ }: Pick<BehaveGraphFlow, "onEdgesChange" | "onNodesChange"> & {
188
+ nodes: Node$1[];
189
+ specJSON: NodeSpecJSON[] | undefined;
190
+ }) => {
191
+ onConnect: (connection: Connection) => void;
192
+ handleStartConnect: (e: MouseEvent$1, params: OnConnectStartParams) => void;
193
+ handleStopConnect: (e: MouseEvent, _connectionState: ConnectionStatus) => void;
194
+ handlePaneClick: () => void;
195
+ handlePaneContextMenu: (e: MouseEvent$1) => void;
196
+ lastConnectStart: OnConnectStartParams | undefined;
197
+ nodePickerVisibility: XYPosition | undefined;
198
+ handleAddNode: (spec: ExtendedNodeSpecJSON, position: XYPosition) => void;
199
+ closeNodePicker: () => void;
200
+ nodePickFilters: NodePickerFilters | undefined;
201
+ };
202
+ //#endregion
203
+ //#region src/transformers/behaveToFlow.d.ts
204
+ declare const behaveToFlow: (graph: GraphJSON) => [Node$1[], Edge[]];
205
+ //#endregion
206
+ //#region src/system/undoRedo.d.ts
207
+ interface Command {
208
+ name: string;
209
+ execute(): void;
210
+ undo(): void;
211
+ /**
212
+ * Optional redo method if different from execute
213
+ */
214
+ redo?(): void;
215
+ }
216
+ type UndoStackEntry = {
217
+ name: string;
218
+ };
219
+ type UndoStore = {
220
+ canUndo: boolean;
221
+ canRedo: boolean;
222
+ history: UndoStackEntry[];
223
+ redoStack: UndoStackEntry[];
224
+ setSnapshot: (snapshot: {
225
+ canUndo: boolean;
226
+ canRedo: boolean;
227
+ history: UndoStackEntry[];
228
+ redoStack: UndoStackEntry[];
229
+ }) => void;
230
+ };
231
+ declare class UndoManager {
232
+ private history;
233
+ private stack;
234
+ private limit;
235
+ store: zustand5.UseBoundStore<zustand5.StoreApi<UndoStore>>;
236
+ constructor();
237
+ private syncStore;
238
+ execute(command: Command): void;
239
+ undo(): void;
240
+ redo(): void;
241
+ canUndo(): boolean;
242
+ canRedo(): boolean;
243
+ clear(): void;
244
+ }
245
+ //#endregion
246
+ //#region src/store/tabs.d.ts
247
+ type TabStore = {
248
+ currentPanel?: string;
249
+ layout: LayoutBase;
250
+ setLayout: (layout: LayoutBase) => void;
251
+ setCurrentPanel: (currentPanel: string) => void;
252
+ openTab: (tabId: string, options?: {
253
+ panelId?: string;
254
+ }) => void;
255
+ };
256
+ //#endregion
257
+ //#region src/system/tabLoader.d.ts
258
+ declare class TabLoader {
259
+ readonly tabs: Record<string, () => TabData>;
260
+ constructor(_system: System);
261
+ load(tab: TabBase): TabData | undefined;
262
+ register(id: string, loader: () => TabData): void;
263
+ }
264
+ //#endregion
265
+ //#region src/store/settings.d.ts
266
+ declare const EDGE_TYPE: {
267
+ readonly bezier: "Bezier";
268
+ readonly smoothStep: "Smooth step";
269
+ readonly straight: "Straight";
270
+ readonly simpleBezier: "Simple Bezier";
271
+ };
272
+ type EdgeType = (typeof EDGE_TYPE)[keyof typeof EDGE_TYPE];
273
+ declare const LAYOUT_TYPE: {
274
+ readonly dagre: "Dagre";
275
+ readonly elkForce: "Elk - Force";
276
+ readonly elkRect: "Elk - Rect";
277
+ readonly elkLayered: "Elk - Layered";
278
+ };
279
+ type LayoutType = (typeof LAYOUT_TYPE)[keyof typeof LAYOUT_TYPE];
280
+ type GeneratorLocation = 'inline' | 'panel';
281
+ type SystemSettingsStore = {
282
+ debugMode: boolean;
283
+ showTimings: boolean;
284
+ showMinimap: boolean;
285
+ showGrid: boolean;
286
+ showSearch: boolean;
287
+ showMenu: boolean;
288
+ edgeType: EdgeType;
289
+ layoutType: LayoutType;
290
+ delayedUpdate: boolean;
291
+ inlineTypes: boolean;
292
+ inlineValues: boolean;
293
+ connectOnClick: boolean;
294
+ snapGrid: boolean;
295
+ gridSize: number;
296
+ generatorLocation: GeneratorLocation;
297
+ setDebugMode: (debugMode: boolean) => void;
298
+ setShowTimings: (showTimings: boolean) => void;
299
+ setShowMinimap: (showMinimap: boolean) => void;
300
+ setShowGrid: (showGrid: boolean) => void;
301
+ setShowSearch: (showSearch: boolean) => void;
302
+ setEdgeType: (edgeType: EdgeType) => void;
303
+ setLayoutType: (layoutType: LayoutType) => void;
304
+ setDelayedUpdate: (delayedUpdate: boolean) => void;
305
+ setInlineTypes: (inlineTypes: boolean) => void;
306
+ setInlineValues: (inlineValues: boolean) => void;
307
+ setConnectOnClick: (connectOnClick: boolean) => void;
308
+ setSnapGrid: (snapGrid: boolean) => void;
309
+ setGridSize: (gridSize: number) => void;
310
+ setGeneratorLocation: (generatorLocation: GeneratorLocation) => void;
311
+ };
312
+ //#endregion
313
+ //#region src/store/logs.d.ts
314
+ interface ILogMessage {
315
+ message: string;
316
+ }
317
+ interface ILog {
318
+ data: ILogMessage;
319
+ time: Date;
320
+ type: LogSeverity;
321
+ }
322
+ type LogStore = {
323
+ logs: ILog[];
324
+ append: (log: ILog) => void;
325
+ clear: () => void;
326
+ };
327
+ //#endregion
328
+ //#region src/store/legend.d.ts
329
+ type LegendStore = {
330
+ icons: Record<string, React.ComponentType>;
331
+ defaultIcon: React.ComponentType;
332
+ valueTypeColors: Record<string, string>;
333
+ categoryColors: Record<string, string>;
334
+ setIcon: (key: string, icon: React.ComponentType) => void;
335
+ setValueTypeColor: (key: string, color: string) => void;
336
+ setCategoryColor: (key: string, color: string) => void;
337
+ };
338
+ //#endregion
339
+ //#region src/store/menubar.d.ts
340
+ type IMenuItem = {
341
+ name: string;
342
+ render: (rest: {
343
+ [key: string]: any;
344
+ }) => React.ReactNode;
345
+ };
346
+ type ISubMenu = {
347
+ title: string;
348
+ name: string;
349
+ items: (IMenuItem | Seperator)[];
350
+ };
351
+ declare class Seperator {}
352
+ type MenuBarStore = {
353
+ show: boolean;
354
+ setShow: (show: boolean) => void;
355
+ items: ISubMenu[];
356
+ setItems: (items: ISubMenu[]) => void;
357
+ setSubMenuItems: (menuName: string, items: (IMenuItem | Seperator)[]) => void;
358
+ };
359
+ //#endregion
360
+ //#region src/system/provider.d.ts
361
+ declare const SystemContext: React$1.Context<System | undefined>;
362
+ type SystemProviderProps = {
363
+ children: ReactNode;
364
+ value: System;
365
+ };
366
+ declare function SystemProvider({
367
+ children,
368
+ value
369
+ }: SystemProviderProps): react_jsx_runtime0.JSX.Element;
370
+ declare function useSystem(): System;
371
+ //#endregion
372
+ //#region src/store/refs.d.ts
373
+ type Refs = {
374
+ reactflow: ReactFlowInstance;
375
+ nodePickerPosition?: XYPosition;
376
+ selectedDocumentationType?: string;
377
+ };
378
+ type RefStore = {
379
+ refs: Refs;
380
+ setRef: <T extends keyof Refs>(key: T, ref: Refs[T]) => void;
381
+ getRef: <T extends keyof Refs>(key: T) => Refs[T] | undefined;
382
+ removeRef: (key: keyof Refs) => void;
383
+ hasRef: (key: keyof Refs) => boolean;
384
+ };
385
+ /**
386
+ * Subscribe to changes of a specific ref
387
+ * @param store - The ref store
388
+ * @param key - The key of the ref to watch
389
+ * @param callback - Callback fired when the ref changes
390
+ * @returns Unsubscribe function
391
+ */
392
+ declare function subscribeToRef<T extends keyof Refs>(store: StoreApi<RefStore>, key: T, callback: (ref: Refs[T] | undefined) => void): () => void;
393
+ /**
394
+ * Hook to access the current value of a ref from the store
395
+ * @param store - The ref store
396
+ * @param key - The key of the ref
397
+ * @returns The current value of the ref or null
398
+ */
399
+ declare function useRefFromStore<T extends keyof Refs>(store: StoreApi<RefStore>, key: T): Refs[T] | undefined;
400
+ //#endregion
401
+ //#region src/store/hotKeys.d.ts
402
+ type Handler = (e?: KeyboardEvent) => any;
403
+ type HotkeyStore = {
404
+ keymap: Record<string, string | string[]>;
405
+ handlers: Record<string, Handler>;
406
+ descriptions: Record<string, string>;
407
+ register(val: {
408
+ action: string;
409
+ trigger: string | string[];
410
+ description?: string;
411
+ handler?: Handler;
412
+ }): void;
413
+ registerDescription(action: string, description: string): void;
414
+ registerHandler(action: string, handler: Handler): void;
415
+ };
416
+ //#endregion
417
+ //#region src/system/pubsub.d.ts
418
+ interface TopicEvents {
419
+ [topic: string]: any;
420
+ }
421
+ type Subscriber<Events extends TopicEvents, K extends keyof Events> = (message: K, data: Events[K]) => void;
422
+ type AnySubscriber = (message: string, data: any) => void;
423
+ declare class PubSub<Events extends TopicEvents = TopicEvents> {
424
+ private messages;
425
+ private lastUid;
426
+ private static readonly ALL_SUBSCRIBING_MSG;
427
+ private hasKeys;
428
+ private throwException;
429
+ private callSubscriberWithDelayedExceptions;
430
+ private callSubscriberWithImmediateExceptions;
431
+ private deliverMessage;
432
+ private createDeliveryFunction;
433
+ private hasDirectSubscribersFor;
434
+ private messageHasSubscribers;
435
+ private internalPublish;
436
+ publishHook<K extends keyof Events & string>(message: K, data: Events[K]): boolean;
437
+ publish<K extends keyof Events & string>(message: K, data: Events[K]): boolean;
438
+ publishSync<K extends keyof Events & string>(message: K, data: Events[K]): boolean;
439
+ subscribe<K extends keyof Events & string>(message: K, func: Subscriber<Events, K>): string | false;
440
+ subscribeAll(func: AnySubscriber): string | false;
441
+ subscribeOnce<K extends keyof Events & string>(message: K, func: Subscriber<Events, K>): this;
442
+ clearAllSubscriptions(): void;
443
+ clearSubscriptions(topic: string): void;
444
+ countSubscriptions(topic: string): number;
445
+ getSubscriptions(topic: string): string[];
446
+ private descendantTopicExists;
447
+ unsubscribe(value: string | Function): boolean | string;
448
+ }
449
+ //#endregion
450
+ //#region src/store/flow.d.ts
451
+ type FlowStore = {
452
+ graphJson: GraphJSON | null;
453
+ setGraph: (graph: GraphJSON, options?: {
454
+ skipLayout?: boolean;
455
+ }) => void;
456
+ getGraph: () => GraphJSON;
457
+ nodeTypes: Record<string, React.ComponentType<NodeProps>>;
458
+ edgeTypes: Record<string, React.ComponentType<EdgeProps>>;
459
+ invalidateCache: () => void;
460
+ registerNodeType: (type: string, component: React.ComponentType<NodeProps>) => void;
461
+ registerEdgeType: (type: string, component: React.ComponentType<EdgeProps>) => void;
462
+ };
463
+ type NodeStore = {
464
+ nodes: Node$1[];
465
+ addNode: (node: Node$1) => void;
466
+ setNodes: (nodes: Node$1[] | ((existing: Node$1[]) => Node$1[])) => void;
467
+ clearNodes: () => void;
468
+ applyNodeChanges: (changes: NodeChange[]) => void;
469
+ };
470
+ type EdgeStore = {
471
+ edges: Edge[];
472
+ addEdge: (edge: Edge) => void;
473
+ setEdges: (edges: Edge[]) => void;
474
+ clearEdges: () => void;
475
+ applyEdgeChanges: (changes: EdgeChange[]) => void;
476
+ };
477
+ //#endregion
478
+ //#region src/store/controls.d.ts
479
+ interface ControlProps<T = any> {
480
+ value: T;
481
+ onChange: (value: T) => void;
482
+ valueType?: string;
483
+ }
484
+ type ControlComponent<T = any> = React.FC<ControlProps<T>>;
485
+ type ControlsStore = {
486
+ icons: Record<string, React.ComponentType>;
487
+ controls: Record<string, React.FC<ControlProps>>;
488
+ defaultControl: React.FC<ControlProps>;
489
+ registerControl: (name: string, control: React.FC<ControlProps>) => void;
490
+ };
491
+ declare const controlsStoreFactory: () => zustand5.UseBoundStore<zustand5.StoreApi<ControlsStore>>;
492
+ //#endregion
493
+ //#region src/store/variables.d.ts
494
+ type GraphVariables = {
495
+ [key: string]: VariableJSON$1;
496
+ };
497
+ type VariableStore = {
498
+ variables: GraphVariables;
499
+ setVariable: (key: string, value: VariableJSON$1) => void;
500
+ setVariables: (variables: GraphVariables) => void;
501
+ removeVariable: (key: string) => void;
502
+ };
503
+ //#endregion
504
+ //#region src/store/selection.d.ts
505
+ type SelectionStore = {
506
+ selectedNodeId: string | null;
507
+ setSelectedNodeId: (nodeId: string | null) => void;
508
+ };
509
+ //#endregion
510
+ //#region src/store/layers.d.ts
511
+ type Layer = {
512
+ id: string;
513
+ name: string;
514
+ visible: boolean;
515
+ opacity: number;
516
+ };
517
+ type SerializedLayers = {
518
+ defaultLayerId: string;
519
+ layers: Layer[];
520
+ nodeLayers: Record<string, string>;
521
+ };
522
+ type LayerStore = {
523
+ defaultLayerId: string;
524
+ layers: Record<string, Layer>;
525
+ nodeLayers: Record<string, string>;
526
+ createLayer: (name: string) => string;
527
+ renameLayer: (layerId: string, name: string) => void;
528
+ setLayerVisibility: (layerId: string, visible: boolean) => void;
529
+ setLayerOpacity: (layerId: string, opacity: number) => void;
530
+ removeLayer: (layerId: string) => void;
531
+ setNodeLayer: (nodeId: string, layerId: string) => void;
532
+ clearNodeLayer: (nodeId: string) => void;
533
+ getNodeLayer: (nodeId: string) => Layer;
534
+ serialize: () => SerializedLayers;
535
+ deserialize: (serialized?: SerializedLayers) => void;
536
+ pruneNodeAssignments: (nodeIds: string[]) => void;
537
+ };
538
+ //#endregion
539
+ //#region src/types/graph.d.ts
540
+ type UIGraphData = Record<string, unknown> & {
541
+ layers?: SerializedLayers;
542
+ };
543
+ type UIGraphJSON = {
544
+ /**
545
+ * Version of the graph
546
+ */
547
+ v: string;
548
+ name: string;
549
+ /**
550
+ * Graph annotations as metadata
551
+ */
552
+ annotations: Record<string, unknown>;
553
+ /** User specific */
554
+ user?: {
555
+ viewport: {
556
+ x: number;
557
+ y: number;
558
+ zoom: number;
559
+ };
560
+ /**
561
+ * Saved viewports for multiple positions
562
+ */
563
+ viewports?: {
564
+ x: number;
565
+ y: number;
566
+ zoom: number;
567
+ }[];
568
+ };
569
+ /**
570
+ * Arbitrary data associated with the graph.
571
+ * Expected to be used with plugins/extensions. This is seperate from graph annotations
572
+ */
573
+ data: UIGraphData;
574
+ /**
575
+ * The serialized graph data.
576
+ * This is currently the embedded JSON format from behave-graph
577
+ */
578
+ flow: GraphJSON;
579
+ nodes: Node$1[];
580
+ edges: Edge[];
581
+ };
582
+ //#endregion
583
+ //#region src/system/graph.d.ts
584
+ /**
585
+ * This is our internal graph representation that we use to perform transformations on
586
+ * It represents the general graph structure, not the underlying behavior graph instance
587
+ */
588
+ declare class Graph {
589
+ readonly viewports: Viewport[];
590
+ private sys;
591
+ protected annotations: {
592
+ [key: string]: any;
593
+ };
594
+ constructor(system: System);
595
+ setViewport(index: number, viewport: Viewport): void;
596
+ /**
597
+ * Clears the graph
598
+ */
599
+ clear(): void;
600
+ /**
601
+ * Return all edges that point into the nodes inputs.
602
+ * O(m) the amount of edges
603
+ */
604
+ inEdges(nodeId: string, sourceHandle?: string): Edge[];
605
+ /**
606
+ * Return all edges that are pointed out by node v.
607
+ * O(m) the amount of edges
608
+ */
609
+ outEdges(nodeId: string, targetHandle?: string): Edge[];
610
+ serialize(): UIGraphJSON;
611
+ getAnnotations(): {
612
+ [key: string]: any;
613
+ };
614
+ setAnnotations(annotations: {
615
+ [key: string]: any;
616
+ }): void;
617
+ deseralize(data: UIGraphJSON): void;
618
+ }
619
+ //#endregion
620
+ //#region src/store/actions.d.ts
621
+ /**
622
+ * Extend or modify this interface to add more actions as needed.
623
+ */
624
+ interface Actions {
625
+ traceUpstream: (nodeId: string) => void;
626
+ traceDownstream: (nodeId: string) => void;
627
+ focusNode: (nodeId: string) => void;
628
+ resetTrace: () => void;
629
+ addBehaveNode: (nodeType: string, position: XYPosition) => void;
630
+ copySelectionToClipboard: () => void;
631
+ pasteFromClipboard: () => Promise<void>;
632
+ toggleNodeHidden: (nodeId: string) => void;
633
+ toggleNodePinned: (nodeId: string) => void;
634
+ groupNodes: () => void;
635
+ ungroupNodes: (groupId: string) => void;
636
+ deleteNodes: (nodeIds: string[]) => void;
637
+ updateGroupColor: (groupId: string, color: string) => void;
638
+ save: () => Promise<UIGraphJSON>;
639
+ }
640
+ type ActionStore = {
641
+ actions: Actions;
642
+ setAction: <K extends keyof Actions>(key: K, action: Actions[K]) => void;
643
+ getAction: <K extends keyof Actions>(key: K) => Actions[K] | undefined;
644
+ };
645
+ //#endregion
646
+ //#region src/types/NodeMetadata.d.ts
647
+ interface ValueTypeMetadata {
648
+ name: string;
649
+ creator: () => any;
650
+ deserialize?: (value: any) => any;
651
+ serialize?: (value: any) => any;
652
+ lerp?: (start: any, end: any, t: number) => any;
653
+ equals?: (a: any, b: any) => boolean;
654
+ clone?: (value: any) => any;
655
+ }
656
+ /**
657
+ * Pure metadata registry - no execution capabilities
658
+ * Used by the visual graph editor for rendering nodes
659
+ */
660
+ interface INodeRegistry {
661
+ readonly values: Record<string, ValueTypeMetadata>;
662
+ readonly specs: NodeSpecJSON[];
663
+ }
664
+ type NodeMetadata = Record<string, string>;
665
+ //#endregion
666
+ //#region src/store/registry.d.ts
667
+ type RegistryStore = {
668
+ readonly values: Record<string, ValueTypeMetadata>;
669
+ readonly specs: NodeSpecJSON[];
670
+ getRegistry: () => INodeRegistry;
671
+ updateRegistry: (registry: INodeRegistry) => void;
672
+ updateValues: (values: Record<string, ValueTypeMetadata>) => void;
673
+ updateSpecs: (specs: NodeSpecJSON[]) => void;
674
+ };
675
+ //#endregion
676
+ //#region src/store/specs.d.ts
677
+ type SpecsStore = {
678
+ specs: NodeSpecJSON[];
679
+ specDict: Record<string, NodeSpecJSON>;
680
+ setSpecs: (specs: NodeSpecJSON[]) => void;
681
+ };
682
+ //#endregion
683
+ //#region src/store/traces.d.ts
684
+ type TraceSpan = {
685
+ id: number;
686
+ nodeId: string;
687
+ name: string;
688
+ start: number;
689
+ end: number;
690
+ lane: number;
691
+ };
692
+ type SpanCollector = {
693
+ capacity: number;
694
+ spans: TraceSpan[];
695
+ writeIndex: number;
696
+ size: number;
697
+ nextId: number;
698
+ openByNodeId: Map<string, number[]>;
699
+ laneOpen: boolean[];
700
+ };
701
+ type TraceStore = {
702
+ version: number;
703
+ collector: SpanCollector;
704
+ clear: () => void;
705
+ connectEngine: (engine?: Engine) => void;
706
+ recordNodeStart: (node: INode, startTime?: number) => void;
707
+ recordNodeEnd: (node: INode, endTime?: number) => void;
708
+ addSpan: (span: Omit<TraceSpan, 'id'>) => void;
709
+ updateSpan: (nodeId: string, updates: Partial<TraceSpan>) => void;
710
+ };
711
+ //#endregion
712
+ //#region src/store/specific.d.ts
713
+ type SpecificNode = {
714
+ id: string;
715
+ data: IBehaveNode['data'];
716
+ spec: NodeSpecJSON;
717
+ selected: boolean;
718
+ };
719
+ type SpecificRenderProps = {
720
+ node: SpecificNode;
721
+ };
722
+ type Specific = {
723
+ name: string;
724
+ check: (spec: NodeSpecJSON) => boolean;
725
+ render: ComponentType<SpecificRenderProps>;
726
+ };
727
+ type SpecificStore = {
728
+ specifics: Specific[];
729
+ titleBarActions: Record<string, React.ReactElement>;
730
+ registerSpecific: (specific: Specific) => void;
731
+ unregisterSpecific: (name: string) => void;
732
+ registryTitleBarAction: (name: string, action: React.ReactElement) => void;
733
+ };
734
+ declare const specificStoreFactory: () => zustand5.UseBoundStore<zustand5.StoreApi<SpecificStore>>;
735
+ //#endregion
736
+ //#region src/store/socketGenerator.d.ts
737
+ type SocketGeneratorNode = {
738
+ id: string;
739
+ data: IBehaveNode['data'];
740
+ spec: NodeSpecJSON;
741
+ selected: boolean;
742
+ };
743
+ type SocketGeneratorRenderProps = {
744
+ node: SocketGeneratorNode;
745
+ };
746
+ type SocketGenerator = {
747
+ name: string;
748
+ check: (spec: NodeSpecJSON) => boolean;
749
+ render: ComponentType<SocketGeneratorRenderProps>;
750
+ };
751
+ type SocketGeneratorStore = {
752
+ generators: SocketGenerator[];
753
+ registerGenerator: (generator: SocketGenerator) => void;
754
+ unregisterGenerator: (name: string) => void;
755
+ };
756
+ declare const socketGeneratorStoreFactory: () => zustand5.UseBoundStore<zustand5.StoreApi<SocketGeneratorStore>>;
757
+ //#endregion
758
+ //#region src/store/events.d.ts
759
+ type ExtendedCustomEventJSON = CustomEventJSON & {
760
+ readonly?: boolean;
761
+ };
762
+ type EventsStore = {
763
+ customEvents: Record<string, ExtendedCustomEventJSON>;
764
+ setCustomEvents: (customEvents: Record<string, ExtendedCustomEventJSON>) => void;
765
+ getCustomEvents: () => ExtendedCustomEventJSON[];
766
+ addCustomEvent: (customEvent: ExtendedCustomEventJSON) => void;
767
+ removeCustomEvent: (id: string) => void;
768
+ addParameter: (eventId: string, parameter?: Partial<CustomEventParameterJSON>) => void;
769
+ updateParameter: (eventId: string, index: number, patch: Partial<CustomEventParameterJSON>) => void;
770
+ removeParameter: (eventId: string, index: number) => void;
771
+ };
772
+ //#endregion
773
+ //#region src/store/toolbar.d.ts
774
+ type ToolbarButtonGroup = {
775
+ id: string;
776
+ label?: string;
777
+ buttons: (ToolbarButton | React$1.ReactNode)[];
778
+ };
779
+ type ToolbarButton = {
780
+ id: string;
781
+ icon: React$1.ReactNode;
782
+ label: string;
783
+ onClick: () => void;
784
+ disabled?: boolean | (() => boolean);
785
+ };
786
+ type ToolbarStore = {
787
+ visible: boolean;
788
+ setVisible: (visible: boolean) => void;
789
+ groups: ToolbarButtonGroup[];
790
+ setGroups: (groups: ToolbarButtonGroup[]) => void;
791
+ addGroup: (group: ToolbarButtonGroup) => void;
792
+ removeGroup: (groupId: string) => void;
793
+ updateGroup: (groupId: string, group: Partial<ToolbarButtonGroup>) => void;
794
+ };
795
+ declare const toolbarStoreFactory: () => zustand5.StoreApi<ToolbarStore>;
796
+ //#endregion
797
+ //#region src/system/plugin.d.ts
798
+ /**
799
+ * Plugin initialization function type
800
+ * @template TOptions - Type of options object passed to the plugin
801
+ */
802
+ interface Plugin<TOptions = void> {
803
+ (system: System, options: TOptions): void | Promise<void>;
804
+ }
805
+ type PluginOpts = {
806
+ name: string;
807
+ };
808
+ type LoadablePlugin<TOptions = void> = {
809
+ loader: Plugin<TOptions>;
810
+ opts: PluginOpts;
811
+ };
812
+ declare const plugin: <TOptions = void>(registerfunc: Plugin<TOptions>, opts: PluginOpts) => LoadablePlugin<TOptions>;
813
+ //#endregion
814
+ //#region src/plugin/alignment/index.d.ts
815
+ type AlignmentAxis = 'x' | 'y';
816
+ type AlignmentType = 'start' | 'center' | 'end';
817
+ declare module '@/system/system' {
818
+ interface PubSys {
819
+ 'alignment:align': {
820
+ type: AlignmentType;
821
+ axis: AlignmentAxis;
822
+ };
823
+ 'alignment:distribute': {
824
+ type: AlignmentType;
825
+ axis: AlignmentAxis;
826
+ };
827
+ }
828
+ }
829
+ //#endregion
830
+ //#region src/system/notifications.d.ts
831
+ type NotificationType$1 = 'info' | 'success' | 'error' | 'loading';
832
+ interface NotificationOptions {
833
+ /**
834
+ * Toast ID for programmatic dismissal
835
+ */
836
+ id?: string;
837
+ /**
838
+ * Duration in milliseconds. Set to Infinity to persist until manually dismissed
839
+ */
840
+ duration?: number;
841
+ /**
842
+ * Position on screen
843
+ */
844
+ position?: Toast['position'];
845
+ /**
846
+ * Custom icon
847
+ */
848
+ icon?: Renderable;
849
+ /**
850
+ * Custom styles
851
+ */
852
+ style?: React.CSSProperties;
853
+ /**
854
+ * Custom class name
855
+ */
856
+ className?: string;
857
+ /**
858
+ * Accessible aria-live value
859
+ */
860
+ ariaLive?: Toast['ariaProps'];
861
+ }
862
+ declare class Notifications {
863
+ private readonly system;
864
+ constructor(system: System);
865
+ /**
866
+ * Dismiss a specific toast or all toasts
867
+ */
868
+ dismissNotification(toastId?: string): void;
869
+ /**
870
+ * Show a notification toast
871
+ */
872
+ notify(message: string, type?: NotificationType$1, options?: NotificationOptions): void;
873
+ /**
874
+ * Show a success notification
875
+ */
876
+ success(message: string, options?: NotificationOptions): void;
877
+ /**
878
+ * Show an error notification
879
+ */
880
+ error(message: string, options?: NotificationOptions): void;
881
+ /**
882
+ * Show a loading notification
883
+ */
884
+ loading(message: string, options?: NotificationOptions): void;
885
+ /**
886
+ * Show an info notification
887
+ */
888
+ info(message: string, options?: NotificationOptions): void;
889
+ /**
890
+ * Dismiss a specific toast or all toasts
891
+ */
892
+ dismiss(toastId?: string): void;
893
+ }
894
+ //#endregion
895
+ //#region src/store/chat.d.ts
896
+ interface AgentConfig {
897
+ model?: string;
898
+ systemPrompt?: string;
899
+ }
900
+ interface ChatMessage {
901
+ id: string;
902
+ role: 'user' | 'assistant' | 'system';
903
+ content: string;
904
+ timestamp: Date;
905
+ isStreaming?: boolean;
906
+ }
907
+ type ChatStore = {
908
+ messages: ChatMessage[];
909
+ agent: AgentConfig | undefined;
910
+ isStreaming: boolean;
911
+ inputValue: string;
912
+ setAgent: (agent: AgentConfig) => void;
913
+ clearAgent: () => void;
914
+ addMessage: (message: ChatMessage) => void;
915
+ updateStreamingMessage: (id: string, content: string) => void;
916
+ finalizeStreamingMessage: (id: string) => void;
917
+ setIsStreaming: (streaming: boolean) => void;
918
+ setInputValue: (value: string) => void;
919
+ clearMessages: () => void;
920
+ };
921
+ //#endregion
922
+ //#region src/system/system.d.ts
923
+ type NotificationType = 'info' | 'success' | 'error' | 'loading';
924
+ interface NotificationData {
925
+ type: NotificationType;
926
+ message: string;
927
+ options?: {
928
+ id?: string;
929
+ duration?: number;
930
+ position?: any;
931
+ icon?: Renderable;
932
+ style?: React.CSSProperties;
933
+ className?: string;
934
+ ariaLive?: any;
935
+ };
936
+ }
937
+ interface PubSys {
938
+ 'edge:added': Edge;
939
+ 'node:added': Node$1;
940
+ 'edge:removed': Edge;
941
+ 'node:removed': Node$1;
942
+ graphAnnotationsChanged: {
943
+ [key: string]: any;
944
+ };
945
+ 'aiNode:trigger': {
946
+ nodeId: string;
947
+ };
948
+ saveViewport: {
949
+ index: number;
950
+ viewport: Viewport;
951
+ };
952
+ missingViewPort: {
953
+ index: number;
954
+ };
955
+ notification: NotificationData;
956
+ 'notification:dismiss': {
957
+ toastId?: string;
958
+ };
959
+ 'layout:saved': LayoutBase;
960
+ 'graph:saved': UIGraphJSON;
961
+ 'graph:inner:saved': GraphJSON;
962
+ 'chat:userMessage': {
963
+ content: string;
964
+ };
965
+ }
966
+ /**
967
+ * Use this to extend the System interface when adding plugins
968
+ */
969
+ interface ISystem {}
970
+ declare class System implements ISystem {
971
+ readonly actionStore: StoreApi<ActionStore>;
972
+ readonly pubsub: PubSub<PubSys>;
973
+ readonly undoManager: UndoManager;
974
+ readonly flowStore: StoreApi<FlowStore>;
975
+ readonly controlStore: StoreApi<ControlsStore>;
976
+ readonly variableStore: StoreApi<VariableStore>;
977
+ readonly selectionStore: StoreApi<SelectionStore>;
978
+ readonly refStore: StoreApi<RefStore>;
979
+ readonly tabStore: StoreApi<TabStore>;
980
+ protected deps: Record<string, unknown>;
981
+ readonly registry: StoreApi<RegistryStore>;
982
+ readonly tabLoader: TabLoader;
983
+ readonly systemSettings: StoreApi<SystemSettingsStore>;
984
+ readonly logsStore: StoreApi<LogStore>;
985
+ readonly legendStore: StoreApi<LegendStore>;
986
+ readonly hotKeyStore: StoreApi<HotkeyStore>;
987
+ readonly edgeStore: StoreApi<EdgeStore>;
988
+ readonly nodeStore: StoreApi<NodeStore>;
989
+ readonly specStore: StoreApi<SpecsStore>;
990
+ readonly specificStore: StoreApi<SpecificStore>;
991
+ readonly socketGeneratorStore: StoreApi<SocketGeneratorStore>;
992
+ readonly eventsStore: StoreApi<EventsStore>;
993
+ readonly documentationStore: StoreApi<DocumentationStore>;
994
+ readonly toolbarStore: StoreApi<ToolbarStore>;
995
+ readonly layerStore: StoreApi<LayerStore>;
996
+ readonly menubarStore: StoreApi<MenuBarStore>;
997
+ readonly graph: Graph;
998
+ readonly traceStore: StoreApi<TraceStore>;
999
+ readonly chatStore: StoreApi<ChatStore>;
1000
+ readonly notifications: Notifications;
1001
+ /**
1002
+ * Create a new System instance
1003
+ * @param registry - INodeRegistry containing nodes and values metadata
1004
+ */
1005
+ constructor(registry?: INodeRegistry);
1006
+ /**
1007
+ * Adds a new dependency to the system
1008
+ * @param name
1009
+ * @param val
1010
+ */
1011
+ decorate(name: keyof System, val: any): void;
1012
+ /**
1013
+ * Load a plugin into the system
1014
+ * @param pluginInit - Plugin initialization function
1015
+ * @param options - Optional configuration options for the plugin
1016
+ * @template TOptions - Type of options object
1017
+ *
1018
+ * @example
1019
+ * // Plugin without options
1020
+ * system.registerPlugin(docsPlugin);
1021
+ *
1022
+ * @example
1023
+ * // Plugin with typed options
1024
+ * interface MyPluginOptions {
1025
+ * enabled: boolean;
1026
+ * apiKey: string;
1027
+ * }
1028
+ *
1029
+ * const myPlugin: Plugin<MyPluginOptions> = (system, options) => {
1030
+ * console.log('Plugin enabled:', options.enabled);
1031
+ * };
1032
+ *
1033
+ * system.registerPlugin(myPlugin, { enabled: true, apiKey: 'secret' });
1034
+ */
1035
+ registerPlugin<TOptions = void>(plugin: LoadablePlugin<TOptions>, options?: TOptions): Promise<void>;
1036
+ }
1037
+ //#endregion
1038
+ //#region src/transformers/flowToBehave.d.ts
1039
+ declare const flowToBehave: (system: System, nodes: Node$1[], edges: Edge[], nodeSpecJSON: NodeSpecJSON[]) => GraphJSON;
1040
+ //#endregion
1041
+ //#region src/util/autoLayout.d.ts
1042
+ declare const autoLayout: (nodes: Node$1[], _edges: Edge[]) => void;
1043
+ //#endregion
1044
+ //#region src/util/calculateNewEdge.d.ts
1045
+ declare const calculateNewEdge: (originNode: Node$1, destinationNodeType: string, destinationNodeId: string, connection: OnConnectStartParams, specJSON: NodeSpecJSON[]) => {
1046
+ id: string;
1047
+ source: string;
1048
+ sourceHandle: string | null;
1049
+ target: string;
1050
+ targetHandle: string | undefined;
1051
+ } | {
1052
+ id: string;
1053
+ target: string;
1054
+ targetHandle: string | null;
1055
+ source: string;
1056
+ sourceHandle: string | undefined;
1057
+ };
1058
+ //#endregion
1059
+ //#region src/util/colors.d.ts
1060
+ declare const categoryColorMap: Record<NodeSpecJSON['category'], string>;
1061
+ //#endregion
1062
+ //#region src/util/getPickerFilters.d.ts
1063
+ declare const getNodePickerFilters: (nodes: Node$1[], params: OnConnectStartParams | undefined, specJSON: NodeSpecJSON[] | undefined) => NodePickerFilters | undefined;
1064
+ //#endregion
1065
+ //#region src/util/getSocketsByNodeTypeAndHandleType.d.ts
1066
+ declare const getSocketsByNodeTypeAndHandleType: (nodes: NodeSpecJSON[], nodeType: string | undefined, handleType: "source" | "target" | null) => _kiberon_labs_behave_graph0.OutputSocketSpecJSON[] | undefined;
1067
+ //#endregion
1068
+ //#region src/util/hasPositionMetaData.d.ts
1069
+ declare const hasPositionMetaData: (graph: GraphJSON) => boolean;
1070
+ //#endregion
1071
+ //#region src/util/isHandleConnected.d.ts
1072
+ declare const isHandleConnected: (edges: Edge[], nodeId: string, handleId: string, type: "source" | "target") => boolean;
1073
+ //#endregion
1074
+ //#region src/util/isValidConnection.d.ts
1075
+ declare const isValidConnection: (connection: Connection, instance: ReactFlowInstance, specJSON: NodeSpecJSON[]) => boolean;
1076
+ //#endregion
1077
+ //#region src/util/sleep.d.ts
1078
+ declare function sleep(durationInSeconds: number): Promise<unknown>;
1079
+ //#endregion
1080
+ //#region src/util/serializeVariables.d.ts
1081
+ interface VariableJSON {
1082
+ id: string;
1083
+ name: string;
1084
+ valueTypeName: string;
1085
+ initialValue: any;
1086
+ label?: string;
1087
+ metadata?: Record<string, any>;
1088
+ }
1089
+ interface Variable {
1090
+ id: string;
1091
+ name: string;
1092
+ valueTypeName: string;
1093
+ initialValue: any;
1094
+ label?: string;
1095
+ metadata?: Record<string, any>;
1096
+ }
1097
+ /**
1098
+ * Serialize a single variable to JSON
1099
+ */
1100
+ declare function serializeVariable(variable: Variable, registry: INodeRegistry): VariableJSON;
1101
+ /**
1102
+ * Serialize multiple variables to JSON array
1103
+ */
1104
+ declare function writeVariablesToJSON(registry: INodeRegistry, variables: Record<string, Variable>): VariableJSON[];
1105
+ //#endregion
1106
+ //#region src/util/downloadJson.d.ts
1107
+ /**
1108
+ * 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.
1109
+ * @param filename
1110
+ * @param data
1111
+ */
1112
+ declare function downloadJson(filename: string, data: unknown): void;
1113
+ //#endregion
1114
+ //#region src/util/extractNodeMetadata.d.ts
1115
+ /**
1116
+ * Extract pure node metadata from a behave-graph registry.
1117
+ * Used by the visual graph editor to initialize a System without execution dependencies.
1118
+ */
1119
+ declare function extractNodeMetadata(registry: IRegistry): INodeRegistry;
1120
+ //#endregion
1121
+ //#region src/components/layoutController/index.d.ts
1122
+ declare const LayoutController: (props: {}) => react_jsx_runtime0.JSX.Element;
1123
+ //#endregion
1124
+ //#region src/annotations/index.d.ts
1125
+ /**
1126
+ * Indicates that the port can be completely deleted
1127
+ */
1128
+ declare const nonDeletable = "ui.nonDeletable";
1129
+ /**
1130
+ * Indicates that the port can be reset to its default value / type
1131
+ */
1132
+ declare const resetable = "ui.resetable";
1133
+ /**
1134
+ * Indicates that the port cannot be edited
1135
+ */
1136
+ declare const readonly = "ui.readonly";
1137
+ /**
1138
+ * Indicates that the port is hidden from the user
1139
+ */
1140
+ declare const hidden = "ui.hidden";
1141
+ declare const annotatedTitle = "ui.title";
1142
+ declare const description = "ui.description";
1143
+ declare const executing = "ui.executing";
1144
+ declare const pinned = "ui.pinned";
1145
+ declare const layerId = "ui.layerId";
1146
+ declare const uiVersion = "ui.version";
1147
+ declare const realtime = "ui.realtime";
1148
+ declare const AnnotatedOutput = "ui.annotatedOutput";
1149
+ //#endregion
1150
+ //#region src/plugin/docs/index.d.ts
1151
+ /**
1152
+ * This is a plugin that sets up default documentation for core behave-graph nodes.
1153
+ * It uses the documentation store to add rich markdown descriptions,
1154
+ * short descriptions, and tags for various node types.
1155
+ * @param sys
1156
+ */
1157
+ declare const docsPluginLoader: (sys: System, _options: void) => void;
1158
+ declare const docsPlugin: LoadablePlugin<void>;
1159
+ //#endregion
1160
+ //#region src/plugin/graphrunner/transport.d.ts
1161
+ type TransportState = 'disconnected' | 'connecting' | 'connected' | 'error';
1162
+ interface TransportConfig {
1163
+ url: string;
1164
+ reconnectInterval?: number;
1165
+ heartbeatInterval?: number;
1166
+ }
1167
+ interface ITransport<Send = ServerGraphRunnerMessage | GraphRunnerMessage, Receive = GraphRunnerMessage | ServerGraphRunnerMessage> {
1168
+ /**
1169
+ * Get current connection state
1170
+ */
1171
+ getState(): TransportState;
1172
+ /**
1173
+ * Connect to the server
1174
+ */
1175
+ connect(): Promise<void>;
1176
+ /**
1177
+ * Disconnect from the server
1178
+ */
1179
+ disconnect(): void;
1180
+ /**
1181
+ * Send a message to the server
1182
+ */
1183
+ send(message: Send): void;
1184
+ /**
1185
+ * Register a message handler
1186
+ */
1187
+ onMessage(handler: (message: Receive) => void): void;
1188
+ /**
1189
+ * Register a connection state change handler
1190
+ */
1191
+ onStateChange(handler: (state: TransportState) => void): void;
1192
+ /**
1193
+ * Register an error handler
1194
+ */
1195
+ onError(handler: (error: Error) => void): void;
1196
+ /**
1197
+ * Remove all handlers
1198
+ */
1199
+ removeAllHandlers(): void;
1200
+ }
1201
+ /**
1202
+ * WebSocket transport implementation
1203
+ */
1204
+ declare class WebSocketTransport implements ITransport<GraphRunnerMessage, ServerGraphRunnerMessage> {
1205
+ private ws;
1206
+ private config;
1207
+ private state;
1208
+ private messageHandlers;
1209
+ private stateChangeHandlers;
1210
+ private errorHandlers;
1211
+ private reconnectTimeout;
1212
+ private heartbeatInterval;
1213
+ constructor(config: TransportConfig);
1214
+ getState(): TransportState;
1215
+ connect(): Promise<void>;
1216
+ disconnect(): void;
1217
+ send(message: GraphRunnerMessage): void;
1218
+ onMessage(handler: (message: ServerGraphRunnerMessage) => void): void;
1219
+ onStateChange(handler: (state: TransportState) => void): void;
1220
+ onError(handler: (error: Error) => void): void;
1221
+ removeAllHandlers(): void;
1222
+ private setState;
1223
+ private notifyError;
1224
+ private handleMessage;
1225
+ private handleDisconnect;
1226
+ private reconnect;
1227
+ private startHeartbeat;
1228
+ }
1229
+ //#endregion
1230
+ //#region src/plugin/graphrunner/types.d.ts
1231
+ type RunStatus = 'pending' | 'running' | 'completed' | 'stopped' | 'error';
1232
+ 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';
1233
+ interface GraphRunnerCapabilities {
1234
+ trace: boolean;
1235
+ validation?: boolean;
1236
+ graphRegistry?: boolean;
1237
+ eventFiltering?: boolean;
1238
+ batchOperations?: boolean;
1239
+ runHistory?: boolean;
1240
+ runtimeMetadata?: boolean;
1241
+ maxConcurrentRuns?: number;
1242
+ /**
1243
+ * Can the graph be modified in realtime?
1244
+ */
1245
+ realtime?: boolean;
1246
+ maxConcurrentDynamicRuns?: number;
1247
+ updateGranularity?: 'node' | 'socket' | 'full';
1248
+ }
1249
+ interface RunPerformance {
1250
+ nodesExecuted: number;
1251
+ eventsEmitted: number;
1252
+ variableChanges: number;
1253
+ }
1254
+ interface EventFilter {
1255
+ eventTypes?: string[];
1256
+ variableNames?: string[];
1257
+ eventNames?: string[];
1258
+ }
1259
+ interface ServerVariable extends VariableJSON$1 {
1260
+ readonly: boolean;
1261
+ description?: string;
1262
+ }
1263
+ interface ServerEvent extends CustomEventJSON {
1264
+ readonly: boolean;
1265
+ description?: string;
1266
+ payloadSchema?: unknown;
1267
+ }
1268
+ interface SocketConstraint {
1269
+ type: 'enum' | 'range' | 'pattern' | 'custom';
1270
+ choices?: Array<{
1271
+ value: unknown;
1272
+ label: string;
1273
+ }>;
1274
+ min?: number;
1275
+ max?: number;
1276
+ pattern?: string;
1277
+ validator?: string;
1278
+ }
1279
+ interface NodeSocket {
1280
+ name: string;
1281
+ valueType: string;
1282
+ required?: boolean;
1283
+ hasConstraints?: boolean;
1284
+ }
1285
+ interface AuthCredentials {
1286
+ type: 'bearer' | 'apiKey' | 'none';
1287
+ token?: string;
1288
+ key?: string;
1289
+ }
1290
+ interface ServerPongMessage {
1291
+ type: 'pong';
1292
+ timestamp: number;
1293
+ }
1294
+ interface ServerWelcomeMessage {
1295
+ type: 'welcome';
1296
+ protocolVersion: string;
1297
+ serverId: string;
1298
+ authenticated: boolean;
1299
+ userId?: string;
1300
+ }
1301
+ interface CapabilitiesMessage {
1302
+ type: 'capabilities';
1303
+ capabilities: GraphRunnerCapabilities;
1304
+ }
1305
+ interface SessionCreatedMessage {
1306
+ type: 'sessionCreated';
1307
+ sessionId: string;
1308
+ expiresAt: number;
1309
+ }
1310
+ interface SessionResumedMessage {
1311
+ type: 'sessionResumed';
1312
+ sessionId: string;
1313
+ activeRuns: string[];
1314
+ }
1315
+ interface SessionClosedMessage {
1316
+ type: 'sessionClosed';
1317
+ sessionId: string;
1318
+ }
1319
+ interface ServerVariablesMessage {
1320
+ type: 'serverVariables';
1321
+ variables: ServerVariable[];
1322
+ }
1323
+ interface ServerEventsMessage {
1324
+ type: 'serverEvents';
1325
+ events: ServerEvent[];
1326
+ }
1327
+ interface SocketConstraintsMessage {
1328
+ type: 'socketConstraints';
1329
+ nodeType: string;
1330
+ socketName: string;
1331
+ valueType: string;
1332
+ constraints: SocketConstraint;
1333
+ }
1334
+ interface NodeTypesMessage {
1335
+ type: 'nodeTypes';
1336
+ nodes: NodeSpecJSON[];
1337
+ }
1338
+ interface RunStartedMessage {
1339
+ type: 'runStarted';
1340
+ runId: string;
1341
+ graphId: string;
1342
+ startedAt: number;
1343
+ }
1344
+ interface ServerGraphRegisteredMessage {
1345
+ type: 'graphRegistered';
1346
+ graphId: string;
1347
+ }
1348
+ interface ServerGraphListMessage {
1349
+ type: 'graphList';
1350
+ graphs: Array<{
1351
+ graphId: string;
1352
+ registeredAt: number;
1353
+ }>;
1354
+ }
1355
+ interface ValidationResultMessage {
1356
+ type: 'validationResult';
1357
+ graphId: string;
1358
+ valid: boolean;
1359
+ errors: Array<{
1360
+ nodeId: string;
1361
+ message: string;
1362
+ severity: string;
1363
+ }>;
1364
+ warnings: Array<{
1365
+ nodeId: string;
1366
+ message: string;
1367
+ severity: string;
1368
+ }>;
1369
+ }
1370
+ interface TraceMessage {
1371
+ type: 'trace';
1372
+ runId: string;
1373
+ graphId: string;
1374
+ nodeId: string;
1375
+ event: string;
1376
+ data: unknown;
1377
+ timestamp: number;
1378
+ }
1379
+ interface LogMessage {
1380
+ type: 'log';
1381
+ runId: string;
1382
+ graphId: string;
1383
+ level: string;
1384
+ message: string;
1385
+ data?: unknown;
1386
+ }
1387
+ interface VariableChangedMessage {
1388
+ type: 'variableChanged';
1389
+ runId: string;
1390
+ graphId: string;
1391
+ variableName: string;
1392
+ oldValue: unknown;
1393
+ newValue: unknown;
1394
+ nodeId?: string;
1395
+ }
1396
+ interface CompletedMessage {
1397
+ type: 'completed';
1398
+ runId: string;
1399
+ graphId: string;
1400
+ completedAt: number;
1401
+ elapsedMs: number;
1402
+ result: unknown;
1403
+ performance: RunPerformance;
1404
+ }
1405
+ interface StoppedMessage {
1406
+ type: 'stopped';
1407
+ runId: string;
1408
+ graphId: string;
1409
+ reason: string;
1410
+ }
1411
+ interface StatusMessage {
1412
+ type: 'status';
1413
+ runId: string;
1414
+ graphId: string;
1415
+ status: RunStatus;
1416
+ startedAt: number;
1417
+ elapsedMs: number;
1418
+ currentNodeId?: string;
1419
+ startedGraphs: Array<{
1420
+ runId: string;
1421
+ graphId: string;
1422
+ status: RunStatus;
1423
+ }>;
1424
+ performance: RunPerformance;
1425
+ }
1426
+ interface BatchStatusMessage {
1427
+ type: 'batchStatus';
1428
+ statuses: Array<{
1429
+ runId: string;
1430
+ status: RunStatus;
1431
+ elapsedMs: number;
1432
+ }>;
1433
+ }
1434
+ interface ErrorMessage {
1435
+ type: 'error';
1436
+ code: ErrorCode;
1437
+ message: string;
1438
+ runId?: string;
1439
+ graphId?: string;
1440
+ nodeId?: string;
1441
+ details?: unknown;
1442
+ supportedVersions?: string[];
1443
+ }
1444
+ interface RunHistoryMessage {
1445
+ type: 'runHistory';
1446
+ runs: Array<{
1447
+ runId: string;
1448
+ graphId: string;
1449
+ status: RunStatus;
1450
+ startedAt: number;
1451
+ completedAt?: number;
1452
+ elapsedMs: number;
1453
+ result?: unknown;
1454
+ }>;
1455
+ }
1456
+ type ServerGraphRunnerMessage = ServerPongMessage | ServerWelcomeMessage | CapabilitiesMessage | SessionCreatedMessage | SessionResumedMessage | SessionClosedMessage | ServerVariablesMessage | ServerEventsMessage | SocketConstraintsMessage | NodeTypesMessage | RunStartedMessage | ServerGraphRegisteredMessage | ServerGraphListMessage | ValidationResultMessage | TraceMessage | LogMessage | VariableChangedMessage | CompletedMessage | NodeAddedMessage | StoppedMessage | StatusMessage | BatchStatusMessage | ErrorMessage | NodeRemovedMessage | LinkCreatedMessage | LinkRemovedMessage | NodeParamUpdatedMessage | AffectedNodesMessage | RunHistoryMessage;
1457
+ interface HelloMessage {
1458
+ type: 'hello';
1459
+ protocolVersion: string;
1460
+ auth: AuthCredentials;
1461
+ }
1462
+ interface WelcomeMessage {
1463
+ type: 'welcome';
1464
+ protocolVersion: string;
1465
+ serverId: string;
1466
+ authenticated: boolean;
1467
+ userId?: string;
1468
+ }
1469
+ interface PingMessage {
1470
+ type: 'ping';
1471
+ timestamp: number;
1472
+ }
1473
+ interface PongMessage {
1474
+ type: 'pong';
1475
+ timestamp: number;
1476
+ }
1477
+ interface CreateSessionMessage {
1478
+ type: 'createSession';
1479
+ metadata?: Record<string, unknown>;
1480
+ }
1481
+ interface ResumeSessionMessage {
1482
+ type: 'resumeSession';
1483
+ sessionId: string;
1484
+ }
1485
+ interface CloseSessionMessage {
1486
+ type: 'closeSession';
1487
+ sessionId: string;
1488
+ }
1489
+ interface GetCapabilitiesMessage {
1490
+ type: 'getCapabilities';
1491
+ }
1492
+ interface GetServerVariablesMessage {
1493
+ type: 'getServerVariables';
1494
+ sessionId: string;
1495
+ }
1496
+ interface GetServerEventsMessage {
1497
+ type: 'getServerEvents';
1498
+ sessionId: string;
1499
+ }
1500
+ interface GetSocketConstraintsMessage {
1501
+ type: 'getSocketConstraints';
1502
+ sessionId: string;
1503
+ nodeType: string;
1504
+ socketName: string;
1505
+ }
1506
+ interface GetNodeTypesMessage {
1507
+ type: 'getNodeTypes';
1508
+ sessionId: string;
1509
+ }
1510
+ interface RegisterGraphMessage {
1511
+ type: 'registerGraph';
1512
+ sessionId: string;
1513
+ graphId: string;
1514
+ graph: GraphJSON;
1515
+ }
1516
+ interface GraphRegisteredMessage {
1517
+ type: 'graphRegistered';
1518
+ graphId: string;
1519
+ }
1520
+ interface GraphListMessage {
1521
+ type: 'graphList';
1522
+ graphs: Array<{
1523
+ graphId: string;
1524
+ registeredAt: number;
1525
+ }>;
1526
+ }
1527
+ interface ValidateGraphMessage {
1528
+ type: 'validateGraph';
1529
+ sessionId: string;
1530
+ graphId: string;
1531
+ graph: unknown;
1532
+ }
1533
+ interface RunGraphMessage {
1534
+ type: 'runGraph';
1535
+ sessionId: string;
1536
+ graphId: string;
1537
+ graph: GraphJSON;
1538
+ inputs?: unknown;
1539
+ options?: {
1540
+ autoEnd?: boolean;
1541
+ trace?: boolean;
1542
+ eventFilter?: EventFilter;
1543
+ maxExecutionTimeMs?: number;
1544
+ autoExecMode?: 'new' | 'current';
1545
+ allowDynamicChanges?: boolean;
1546
+ streamDeltas?: boolean;
1547
+ };
1548
+ }
1549
+ interface ListGraphsMessage {
1550
+ type: 'listGraphs';
1551
+ sessionId: string;
1552
+ }
1553
+ interface BatchRunStartedMessage {
1554
+ type: 'batchRunStarted';
1555
+ runs: Array<{
1556
+ runId: string;
1557
+ graphId: string;
1558
+ }>;
1559
+ }
1560
+ interface StopGraphMessage {
1561
+ type: 'stopGraph';
1562
+ sessionId: string;
1563
+ runId: string;
1564
+ }
1565
+ interface GetStatusMessage {
1566
+ type: 'getStatus';
1567
+ sessionId: string;
1568
+ runId: string;
1569
+ }
1570
+ interface BatchGetStatusMessage {
1571
+ type: 'batchGetStatus';
1572
+ sessionId: string;
1573
+ runIds: string[];
1574
+ }
1575
+ interface SubscribeMessage {
1576
+ type: 'subscribe';
1577
+ sessionId: string;
1578
+ runId: string;
1579
+ filter?: EventFilter;
1580
+ }
1581
+ interface UnsubscribeMessage {
1582
+ type: 'unsubscribe';
1583
+ sessionId: string;
1584
+ runId: string;
1585
+ }
1586
+ interface EventEmittedMessage {
1587
+ type: 'eventEmitted';
1588
+ runId: string;
1589
+ graphId: string;
1590
+ eventName: string;
1591
+ payload: unknown;
1592
+ nodeId?: string;
1593
+ }
1594
+ interface NodeAddedMessage {
1595
+ type: 'nodeAdded';
1596
+ runId: string;
1597
+ graphId: string;
1598
+ nodeId: string;
1599
+ nodeType: string;
1600
+ nodeData?: unknown;
1601
+ }
1602
+ interface GetRunHistoryMessage {
1603
+ type: 'getRunHistory';
1604
+ sessionId: string;
1605
+ limit?: number;
1606
+ graphId?: string;
1607
+ }
1608
+ interface AddNodeMessage {
1609
+ type: 'addNode';
1610
+ sessionId: string;
1611
+ runId: string;
1612
+ nodeId: string;
1613
+ nodeType: string;
1614
+ nodeData?: Record<string, unknown>;
1615
+ position?: {
1616
+ x: number;
1617
+ y: number;
1618
+ };
1619
+ }
1620
+ interface RemoveNodeMessage {
1621
+ type: 'removeNode';
1622
+ sessionId: string;
1623
+ runId: string;
1624
+ nodeId: string;
1625
+ }
1626
+ interface UpdateSocketValueMessage {
1627
+ type: 'updateSocketValue';
1628
+ sessionId: string;
1629
+ runId: string;
1630
+ nodeId: string;
1631
+ socketName: string;
1632
+ value: unknown;
1633
+ }
1634
+ interface UpdateNodeParamMessage {
1635
+ type: 'updateNodeParam';
1636
+ sessionId: string;
1637
+ runId: string;
1638
+ nodeId: string;
1639
+ paramName: string;
1640
+ value: unknown;
1641
+ }
1642
+ interface CreateLinkMessage {
1643
+ type: 'createLink';
1644
+ sessionId: string;
1645
+ runId: string;
1646
+ fromNodeId: string;
1647
+ fromSocket: string;
1648
+ toNodeId: string;
1649
+ toSocket: string;
1650
+ }
1651
+ interface RemoveLinkMessage {
1652
+ type: 'removeLink';
1653
+ sessionId: string;
1654
+ runId: string;
1655
+ fromNodeId: string;
1656
+ fromSocket: string;
1657
+ toNodeId: string;
1658
+ toSocket: string;
1659
+ }
1660
+ interface DirectExecuteNodeMessage {
1661
+ type: 'directExecuteNode';
1662
+ sessionId: string;
1663
+ runId: string;
1664
+ nodeId: string;
1665
+ inputSocketName: string;
1666
+ inputValue: unknown;
1667
+ autoExecMode?: 'new' | 'current';
1668
+ }
1669
+ interface NodeRemovedMessage {
1670
+ type: 'nodeRemoved';
1671
+ runId: string;
1672
+ graphId: string;
1673
+ nodeId: string;
1674
+ }
1675
+ interface LinkCreatedMessage {
1676
+ type: 'linkCreated';
1677
+ runId: string;
1678
+ graphId: string;
1679
+ fromNodeId: string;
1680
+ fromSocket: string;
1681
+ toNodeId: string;
1682
+ toSocket: string;
1683
+ }
1684
+ interface LinkRemovedMessage {
1685
+ type: 'linkRemoved';
1686
+ runId: string;
1687
+ graphId: string;
1688
+ fromNodeId: string;
1689
+ fromSocket: string;
1690
+ toNodeId: string;
1691
+ toSocket: string;
1692
+ }
1693
+ interface NodeParamUpdatedMessage {
1694
+ type: 'nodeParamUpdated';
1695
+ runId: string;
1696
+ graphId: string;
1697
+ nodeId: string;
1698
+ paramName: string;
1699
+ oldValue: unknown;
1700
+ newValue: unknown;
1701
+ }
1702
+ interface AffectedNodesMessage {
1703
+ type: 'affectedNodes';
1704
+ runId: string;
1705
+ graphId: string;
1706
+ nodeIds: string[];
1707
+ reason: 'direct-execution' | 'socket-value-update' | 'param-update' | 'link-change';
1708
+ }
1709
+ 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;
1710
+ interface GraphRunnerClientConfig {
1711
+ url?: string;
1712
+ auth?: AuthCredentials;
1713
+ protocolVersion?: string;
1714
+ autoReconnect?: boolean;
1715
+ reconnectInterval?: number;
1716
+ heartbeatInterval?: number;
1717
+ metadata?: Record<string, unknown>;
1718
+ transport?: ITransport;
1719
+ trace?: boolean;
1720
+ eventFilter?: EventFilter;
1721
+ maxExecutionTimeMs?: number;
1722
+ allowDynamicChanges?: boolean;
1723
+ autoExecMode?: 'new' | 'current';
1724
+ streamDeltas?: boolean;
1725
+ onMessageActivity?: (direction: 'sent' | 'received', message: GraphRunnerMessage) => void;
1726
+ }
1727
+ //#endregion
1728
+ //#region src/plugin/graphrunner/client.d.ts
1729
+ /**
1730
+ * Extract message type by its 'type' field
1731
+ */
1732
+ type ExtractMessage<T extends string> = Extract<ServerGraphRunnerMessage, {
1733
+ type: T;
1734
+ }>;
1735
+ /**
1736
+ * Handler for messages received from the server
1737
+ * Generic type parameter ensures the handler receives the correct message type
1738
+ */
1739
+ type ServerMessageHandler<T extends ServerGraphRunnerMessage['type']> = (message: ExtractMessage<T>) => void;
1740
+ /**
1741
+ * Client for the Behave-Graph Execution Protocol
1742
+ * Supports multiple transport implementations (WebSocket, HTTP, etc.)
1743
+ */
1744
+ declare class GraphRunnerClient {
1745
+ transport: ITransport;
1746
+ private config;
1747
+ private messageHandlers;
1748
+ private sessionId;
1749
+ private capabilities;
1750
+ private serverId;
1751
+ private authenticated;
1752
+ private userId;
1753
+ private pendingRequests;
1754
+ private connectionState;
1755
+ constructor(config: GraphRunnerClientConfig);
1756
+ connect(): Promise<void>;
1757
+ disconnect(): void;
1758
+ createSession(metadata?: Record<string, unknown>): Promise<string>;
1759
+ resumeSession(sessionId: string): Promise<string[]>;
1760
+ closeSession(): Promise<void>;
1761
+ getCapabilities(): Promise<GraphRunnerCapabilities>;
1762
+ getServerVariables(): Promise<ServerVariable[]>;
1763
+ getServerEvents(): Promise<ServerEvent[]>;
1764
+ getSocketConstraints(nodeType: string, socketName: string): Promise<{
1765
+ valueType: string;
1766
+ constraints: SocketConstraint;
1767
+ }>;
1768
+ getNodeTypes(): Promise<NodeSpecJSON[]>;
1769
+ registerGraph(graphId: string, graph: GraphJSON): Promise<void>;
1770
+ listGraphs(): Promise<Array<{
1771
+ graphId: string;
1772
+ registeredAt: number;
1773
+ }>>;
1774
+ validateGraph(graphId: string, graph: unknown): Promise<{
1775
+ valid: boolean;
1776
+ errors: Array<{
1777
+ nodeId: string;
1778
+ message: string;
1779
+ severity: string;
1780
+ }>;
1781
+ warnings: Array<{
1782
+ nodeId: string;
1783
+ message: string;
1784
+ severity: string;
1785
+ }>;
1786
+ }>;
1787
+ runGraph(graphId: string, options?: {
1788
+ graph?: unknown;
1789
+ inputs?: unknown;
1790
+ trace?: boolean;
1791
+ }): Promise<string>;
1792
+ stopGraph(runId: string): Promise<void>;
1793
+ getStatus(runId: string): Promise<StatusMessage>;
1794
+ batchGetStatus(runIds: string[]): Promise<Array<{
1795
+ runId: string;
1796
+ status: RunStatus;
1797
+ elapsedMs: number;
1798
+ }>>;
1799
+ subscribe(runId: string, filter?: EventFilter): Promise<void>;
1800
+ unsubscribe(runId: string): Promise<void>;
1801
+ /**
1802
+ * Send a nodeAdded event
1803
+ * Used to notify the server when a node is added to the graph during execution
1804
+ */
1805
+ sendNodeAdded(runId: string, graphId: string, nodeId: string, nodeType: string, nodeData?: unknown): void;
1806
+ getRunHistory(options?: {
1807
+ limit?: number;
1808
+ graphId?: string;
1809
+ }): Promise<Array<{
1810
+ runId: string;
1811
+ graphId: string;
1812
+ status: RunStatus;
1813
+ startedAt: number;
1814
+ completedAt?: number;
1815
+ elapsedMs: number;
1816
+ result?: unknown;
1817
+ }>>;
1818
+ addNode(runId: string, nodeId: string, nodeType: string, nodeData?: Record<string, unknown>, position?: {
1819
+ x: number;
1820
+ y: number;
1821
+ }): void;
1822
+ removeNode(runId: string, nodeId: string): void;
1823
+ updateSocketValue(runId: string, nodeId: string, socketName: string, value: unknown): void;
1824
+ updateNodeParam(runId: string, nodeId: string, paramName: string, value: unknown): void;
1825
+ createLink(runId: string, fromNodeId: string, fromSocket: string, toNodeId: string, toSocket: string): void;
1826
+ removeLink(runId: string, fromNodeId: string, fromSocket: string, toNodeId: string, toSocket: string): void;
1827
+ directExecuteNode(runId: string, nodeId: string, inputSocketName: string, inputValue: unknown, autoExecMode?: 'new' | 'current'): void;
1828
+ on<T extends ServerGraphRunnerMessage['type']>(messageType: T, handler: ServerMessageHandler<T>): void;
1829
+ off<T extends ServerGraphRunnerMessage['type']>(messageType: T, handler: ServerMessageHandler<T>): void;
1830
+ getConnectionState(): 'disconnected' | 'connecting' | 'authenticating' | 'connected';
1831
+ getSessionId(): string | null;
1832
+ getCachedCapabilities(): GraphRunnerCapabilities | null;
1833
+ isAuthenticated(): boolean;
1834
+ getUserId(): string | null;
1835
+ getServerId(): string | null;
1836
+ isConnected(): boolean;
1837
+ private send;
1838
+ private handleMessage;
1839
+ private handleTransportStateChange;
1840
+ private handleTransportError;
1841
+ private request;
1842
+ private ensureSession;
1843
+ private generateRequestId;
1844
+ private getExpectedResponseType;
1845
+ }
1846
+ //#endregion
1847
+ //#region src/plugin/graphrunner/store.d.ts
1848
+ interface MessageActivity {
1849
+ id: string;
1850
+ timestamp: number;
1851
+ direction: 'sent' | 'received';
1852
+ message: GraphRunnerMessage;
1853
+ }
1854
+ interface ConnectionConfig {
1855
+ url: string;
1856
+ auth: AuthCredentials;
1857
+ autoReconnect: boolean;
1858
+ }
1859
+ interface ConnectionInfo {
1860
+ serverId: string | null;
1861
+ userId: string | null;
1862
+ sessionId: string | null;
1863
+ authenticated: boolean;
1864
+ capabilities: GraphRunnerCapabilities | null;
1865
+ }
1866
+ interface GraphRunnerClientStore {
1867
+ connectionState: 'disconnected' | 'connecting' | 'authenticating' | 'connected';
1868
+ connectionConfig: ConnectionConfig;
1869
+ connectionInfo: ConnectionInfo;
1870
+ error: string | null;
1871
+ client: GraphRunnerClient | null;
1872
+ serverVariables: ServerVariable[];
1873
+ serverEvents: ServerEvent[];
1874
+ nodeTypes: NodeSpecJSON[];
1875
+ messageActivity: MessageActivity[];
1876
+ maxActivityMessages: number;
1877
+ currentRunId: string | null;
1878
+ currentGraphId: string | null;
1879
+ isExecuting: boolean;
1880
+ isPaused: boolean;
1881
+ clearLogsOnRun: boolean;
1882
+ clearTracesOnRun: boolean;
1883
+ enableTracing: boolean;
1884
+ setConnectionConfig: (config: Partial<ConnectionConfig>) => void;
1885
+ setClient: (client: GraphRunnerClient | null) => void;
1886
+ setConnectionState: (state: 'disconnected' | 'connecting' | 'authenticating' | 'connected') => void;
1887
+ setConnectionInfo: (info: Partial<ConnectionInfo>) => void;
1888
+ setError: (error: string | null) => void;
1889
+ setServerVariables: (variables: ServerVariable[]) => void;
1890
+ setServerEvents: (events: ServerEvent[]) => void;
1891
+ setNodeTypes: (nodeTypes: NodeSpecJSON[]) => void;
1892
+ clearServerMetadata: () => void;
1893
+ addMessageActivity: (direction: 'sent' | 'received', message: GraphRunnerMessage) => void;
1894
+ clearMessageActivity: () => void;
1895
+ setCurrentRunId: (runId: string | null) => void;
1896
+ setCurrentGraphId: (graphId: string | null) => void;
1897
+ setIsExecuting: (isExecuting: boolean) => void;
1898
+ setIsPaused: (isPaused: boolean) => void;
1899
+ setClearLogsOnRun: (clear: boolean) => void;
1900
+ setClearTracesOnRun: (clear: boolean) => void;
1901
+ setEnableTracing: (enable: boolean) => void;
1902
+ }
1903
+ declare const graphRunnerClientStoreFactory: (system: System) => StoreApi<GraphRunnerClientStore>;
1904
+ //#endregion
1905
+ //#region src/plugin/graphrunner/panel.d.ts
1906
+ interface GraphRunnerPanelProps {
1907
+ system: System;
1908
+ }
1909
+ declare const GraphRunnerPanel: React$1.FC<GraphRunnerPanelProps>;
1910
+ //#endregion
1911
+ //#region src/plugin/graphrunner/runner.d.ts
1912
+ declare module '@/system/system' {
1913
+ interface System {
1914
+ runner: GraphRunner;
1915
+ }
1916
+ }
1917
+ declare class GraphRunner {
1918
+ private system;
1919
+ readonly store: StoreApi<GraphRunnerClientStore>;
1920
+ constructor(system: System, store: StoreApi<GraphRunnerClientStore>);
1921
+ /**
1922
+ * Connect to the graph runner server
1923
+ */
1924
+ connect(): Promise<void>;
1925
+ /**
1926
+ * Disconnect from the graph runner server
1927
+ */
1928
+ disconnect(): Promise<void>;
1929
+ /**
1930
+ * Refresh server metadata (variables, events, node types)
1931
+ */
1932
+ refreshMetadata(): Promise<void>;
1933
+ /**
1934
+ * Run a graph remotely
1935
+ */
1936
+ runRemotely(graphId: string, options?: {
1937
+ graph?: unknown;
1938
+ inputs?: unknown;
1939
+ }): Promise<void>;
1940
+ /**
1941
+ * Stop the current graph execution
1942
+ */
1943
+ stop(): Promise<void>;
1944
+ /**
1945
+ * Play the current graph
1946
+ */
1947
+ play(): Promise<void>;
1948
+ /**
1949
+ * Pause the current graph execution
1950
+ */
1951
+ pause(): Promise<void>;
1952
+ /**
1953
+ * Resume paused execution
1954
+ */
1955
+ resume(): Promise<void>;
1956
+ /**
1957
+ * Execute one step forward
1958
+ */
1959
+ step(): Promise<void>;
1960
+ }
1961
+ //#endregion
1962
+ //#region src/plugin/graphrunner/session.d.ts
1963
+ /**
1964
+ * Session configuration for graph execution
1965
+ */
1966
+ interface SessionConfig {
1967
+ /** Custom metadata attached to the session */
1968
+ metadata?: Record<string, unknown>;
1969
+ /** Default execution options for all runs in this session */
1970
+ defaultExecutionOptions?: {
1971
+ autoEnd?: boolean;
1972
+ trace?: boolean;
1973
+ eventFilter?: EventFilter;
1974
+ maxExecutionTimeMs?: number;
1975
+ };
1976
+ /** Session-level execution settings */
1977
+ executionSettings?: {
1978
+ /** Delay between execution steps in milliseconds */
1979
+ stepDelay?: number;
1980
+ /** Execution speed multiplier (0.1 to 2.0) */
1981
+ executionSpeed?: number;
1982
+ /** Interval between tick events in milliseconds */
1983
+ tickInterval?: number;
1984
+ /** Maximum number of concurrent runs allowed */
1985
+ maxConcurrentRuns?: number;
1986
+ };
1987
+ /** Custom hook for handling tick timing/delays */
1988
+ tickStrategy?: () => Promise<void>;
1989
+ /** Custom registry overrides for this session */
1990
+ registryOverrides?: Partial<IRegistry>;
1991
+ /** Session lifecycle hooks */
1992
+ hooks?: SessionHooks;
1993
+ /** Session-specific capabilities override */
1994
+ capabilities?: Partial<GraphRunnerCapabilities>;
1995
+ }
1996
+ /**
1997
+ * Lifecycle hooks for session events
1998
+ */
1999
+ interface SessionHooks {
2000
+ /** Called when the session is created */
2001
+ onSessionCreated?: (session: Session) => void | Promise<void>;
2002
+ /** Called when a run starts in this session */
2003
+ onRunStarted?: (session: Session, runId: string, graphId: string) => void | Promise<void>;
2004
+ /** Called when a run completes in this session */
2005
+ onRunCompleted?: (session: Session, runId: string, graphId: string, result: unknown) => void | Promise<void>;
2006
+ /** Called when a run fails in this session */
2007
+ onRunError?: (session: Session, runId: string, graphId: string, error: Error) => void | Promise<void>;
2008
+ /** Called when the session is closed */
2009
+ onSessionClosed?: (session: Session) => void | Promise<void>;
2010
+ }
2011
+ /**
2012
+ * Session state
2013
+ */
2014
+ interface Session {
2015
+ /** Unique session identifier */
2016
+ readonly sessionId: string;
2017
+ /** Session expiration timestamp */
2018
+ readonly expiresAt: number;
2019
+ /** Session creation timestamp */
2020
+ readonly createdAt: number;
2021
+ /** Session configuration */
2022
+ readonly config: SessionConfig;
2023
+ /** Active run IDs in this session */
2024
+ readonly activeRuns: Set<string>;
2025
+ /** Custom session state (user-definable) */
2026
+ state: Record<string, unknown>;
2027
+ /** Session metadata */
2028
+ metadata: Record<string, unknown>;
2029
+ }
2030
+ /**
2031
+ * Factory for creating sessions with custom configuration
2032
+ */
2033
+ interface SessionFactory {
2034
+ /**
2035
+ * Create a new session with optional configuration
2036
+ */
2037
+ createSession(sessionId: string, config?: SessionConfig): Session;
2038
+ }
2039
+ /**
2040
+ * Default session factory implementation
2041
+ */
2042
+ declare class DefaultSessionFactory implements SessionFactory {
2043
+ private defaultConfig?;
2044
+ constructor(defaultConfig?: SessionConfig);
2045
+ createSession(sessionId: string, config?: SessionConfig): Session;
2046
+ }
2047
+ /**
2048
+ * Session manager to track and manage multiple sessions
2049
+ */
2050
+ declare class SessionManager {
2051
+ private sessions;
2052
+ private sessionFactory;
2053
+ constructor(sessionFactory?: SessionFactory);
2054
+ /**
2055
+ * Create a new session
2056
+ */
2057
+ createSession(sessionId: string, config?: SessionConfig): Session;
2058
+ /**
2059
+ * Get an existing session
2060
+ */
2061
+ getSession(sessionId: string): Session | undefined;
2062
+ /**
2063
+ * Check if a session exists
2064
+ */
2065
+ hasSession(sessionId: string): boolean;
2066
+ /**
2067
+ * Close and remove a session
2068
+ */
2069
+ closeSession(sessionId: string): Promise<void>;
2070
+ /**
2071
+ * Add a run to a session
2072
+ */
2073
+ addRunToSession(sessionId: string, runId: string): void;
2074
+ /**
2075
+ * Remove a run from a session
2076
+ */
2077
+ removeRunFromSession(sessionId: string, runId: string): void;
2078
+ /**
2079
+ * Get all active sessions
2080
+ */
2081
+ getActiveSessions(): Session[];
2082
+ /**
2083
+ * Clean up expired sessions
2084
+ */
2085
+ cleanupExpiredSessions(): void;
2086
+ }
2087
+ //#endregion
2088
+ //#region src/plugin/graphrunner/index.d.ts
2089
+ /**
2090
+ * Options for the GraphRunner plugin
2091
+ */
2092
+ interface GraphRunnerClientPluginOptions {
2093
+ /**
2094
+ * Preconfigured GraphRunner client instance.
2095
+ * If provided, the plugin will use this client instead of creating a new one.
2096
+ * Useful when the client is already connected via a custom transport (e.g., VSCode IPC).
2097
+ */
2098
+ client?: GraphRunnerClient;
2099
+ /**
2100
+ * Preconfigured store instance.
2101
+ * If provided, the plugin will use this store instead of creating a new one.
2102
+ * Useful for sharing state with external components.
2103
+ */
2104
+ store?: StoreApi<GraphRunnerClientStore>;
2105
+ /**
2106
+ * Whether to skip automatic connection.
2107
+ * Default: false (will attempt to connect if client is not provided or not connected)
2108
+ */
2109
+ skipAutoConnect?: boolean;
2110
+ /**
2111
+ * Whether to add the menu item to the Window menu.
2112
+ * Default: true
2113
+ */
2114
+ addMenuItem?: boolean;
2115
+ }
2116
+ /**
2117
+ * Plugin initialization function
2118
+ * Registers the GraphRunnerClient store and actions with the system
2119
+ */
2120
+ declare function graphRunnerClientPluginLoader(system: System, options?: GraphRunnerClientPluginOptions): Promise<void>;
2121
+ declare const graphRunnerClientPlugin: LoadablePlugin<GraphRunnerClientPluginOptions | undefined>;
2122
+ //#endregion
2123
+ //#region src/plugin/graphrunner-local/store.d.ts
2124
+ interface LocalGraphRunnerStore {
2125
+ executionSpeed: number;
2126
+ stepDelay: number;
2127
+ tickInterval: number;
2128
+ isExecuting: boolean;
2129
+ isPaused: boolean;
2130
+ activeRuns: number;
2131
+ setExecutionSpeed: (speed: number) => void;
2132
+ setStepDelay: (delay: number) => void;
2133
+ setTickInterval: (interval: number) => void;
2134
+ setIsExecuting: (isExecuting: boolean) => void;
2135
+ setIsPaused: (isPaused: boolean) => void;
2136
+ setActiveRuns: (count: number) => void;
2137
+ }
2138
+ declare const localGraphRunnerStoreFactory: () => zustand5.StoreApi<LocalGraphRunnerStore>;
2139
+ //#endregion
2140
+ //#region src/plugin/graphrunner-local/transport.d.ts
2141
+ /**
2142
+ * Local transport that executes graphs in the browser using the Engine
2143
+ */
2144
+ declare class LocalTransport implements ITransport {
2145
+ private state;
2146
+ private messageHandlers;
2147
+ private stateChangeHandlers;
2148
+ private errorHandlers;
2149
+ private registry;
2150
+ private sessionManager;
2151
+ private activeRuns;
2152
+ private store;
2153
+ private variables;
2154
+ private serverEvents;
2155
+ constructor(registry: IRegistry, options?: {
2156
+ store?: StoreApi<LocalGraphRunnerStore>;
2157
+ variables?: ServerVariable[];
2158
+ serverEvents?: ServerEvent[];
2159
+ sessionFactory?: SessionFactory;
2160
+ });
2161
+ /**
2162
+ * Create a logger that forwards log messages to the client
2163
+ */
2164
+ private createTransportLogger;
2165
+ getState(): TransportState;
2166
+ connect(): Promise<void>;
2167
+ disconnect(): void;
2168
+ send(message: GraphRunnerMessage): void;
2169
+ onMessage(handler: (message: ServerGraphRunnerMessage) => void): void;
2170
+ onStateChange(handler: (state: TransportState) => void): void;
2171
+ onError(handler: (error: Error) => void): void;
2172
+ removeAllHandlers(): void;
2173
+ private setState;
2174
+ private notifyError;
2175
+ private notifyMessage;
2176
+ updateStoreActiveRuns(): void;
2177
+ private updateStoreExecutionState;
2178
+ private getExecutionDelay;
2179
+ private getExecutionStepLimit;
2180
+ private getTickInterval;
2181
+ /**
2182
+ * Get the default sleep-based tick strategy
2183
+ */
2184
+ private createSleepTickStrategy;
2185
+ private generateId;
2186
+ private handleMessage;
2187
+ private handleHello;
2188
+ private handleCreateSession;
2189
+ private handleGetCapabilities;
2190
+ private handleGetServerVariables;
2191
+ private handleGetServerEvents;
2192
+ private handleGetSocketConstraints;
2193
+ private handleGetNodeTypes;
2194
+ private handleRunGraph;
2195
+ private executeGraph;
2196
+ /**
2197
+ * Execute engine with pause support - executes one step at a time with configurable delay
2198
+ */
2199
+ private executeWithPauseSupport;
2200
+ /**
2201
+ * Pause execution of a running graph
2202
+ */
2203
+ pauseExecution(runId: string): void;
2204
+ /**
2205
+ * Resume execution of a paused graph
2206
+ */
2207
+ resumeExecution(runId: string): Promise<void>;
2208
+ /**
2209
+ * Step forward one execution step
2210
+ */
2211
+ stepExecution(runId: string): Promise<void>;
2212
+ /**
2213
+ * Check if a run is currently paused
2214
+ */
2215
+ isPaused(runId: string): boolean;
2216
+ private handleStopGraph;
2217
+ private handleGetStatus;
2218
+ private handleCloseSession;
2219
+ private sendError;
2220
+ private handleAddNode;
2221
+ private handleRemoveNode;
2222
+ private handleUpdateSocketValue;
2223
+ private handleUpdateNodeParam;
2224
+ private handleCreateLink;
2225
+ private handleRemoveLink;
2226
+ private handleDirectExecuteNode;
2227
+ private getDownstreamNodes;
2228
+ }
2229
+ //#endregion
2230
+ //#region src/plugin/graphrunner-local/panel.d.ts
2231
+ declare const LocalGraphRunnerPanel: () => react_jsx_runtime0.JSX.Element;
2232
+ //#endregion
2233
+ //#region src/plugin/graphrunner-local/types.d.ts
2234
+ /**
2235
+ * Extend the System interface to include the local graph runner store
2236
+ */
2237
+ declare module '@/system/system' {
2238
+ interface System {
2239
+ localGraphRunnerStore: ReturnType<typeof localGraphRunnerStoreFactory>;
2240
+ }
2241
+ }
2242
+ //# sourceMappingURL=types.d.ts.map
2243
+
2244
+ //#endregion
2245
+ //#region src/plugin/graphrunner-local/index.d.ts
2246
+ /**
2247
+ * Options for the local graph runner plugin
2248
+ */
2249
+ interface LocalGraphRunnerPluginOptions {
2250
+ /**
2251
+ * Node registry with registered nodes, values, and dependencies.
2252
+ * Required for graph execution.
2253
+ */
2254
+ registry: IRegistry;
2255
+ variables?: ServerVariable[];
2256
+ events?: ServerEvent[];
2257
+ sessionFactory?: SessionFactory;
2258
+ /**
2259
+ * Custom tick strategy hook for controlling timing between tick events.
2260
+ * If not provided, defaults to requestAnimationFrame for smooth browser refresh sync.
2261
+ */
2262
+ tickStrategy?: () => Promise<void>;
2263
+ /**
2264
+ * Whether to skip automatic connection.
2265
+ * Default: false (will attempt to connect immediately)
2266
+ */
2267
+ skipAutoConnect?: boolean;
2268
+ /**
2269
+ * Whether to add the menu item to the Window menu.
2270
+ * Default: true
2271
+ */
2272
+ addMenuItem?: boolean;
2273
+ }
2274
+ /**
2275
+ * Plugin initialization function for local graph execution
2276
+ * Registers a GraphRunnerClient with a local transport that executes graphs in-browser
2277
+ */
2278
+ declare function localGraphRunnerPluginLoader(system: System, options: LocalGraphRunnerPluginOptions): Promise<void>;
2279
+ declare const localGraphRunnerPlugin: LoadablePlugin<LocalGraphRunnerPluginOptions>;
2280
+ //#endregion
2281
+ export { AddNodeMessage, AffectedNodesMessage, AnnotatedOutput, AuthCredentials, BatchGetStatusMessage, BatchRunStartedMessage, BatchStatusMessage, BehaveNodeProps, CapabilitiesMessage, CloseSessionMessage, CompletedMessage, ConnectionConfig, ConnectionInfo, ControlComponent, ControlProps, ControlsStore, CreateLinkMessage, CreateSessionMessage, DefaultSessionFactory, DirectExecuteNodeMessage, DocumentationStore, ErrorCode, ErrorMessage, EventEmittedMessage, EventFilter, ExtendedNodeSpecJSON, FloatingToolbar, Flow, GetCapabilitiesMessage, GetNodeTypesMessage, GetRunHistoryMessage, GetServerEventsMessage, GetServerVariablesMessage, GetSocketConstraintsMessage, GetStatusMessage, GraphListMessage, GraphRegisteredMessage, GraphRunner, GraphRunnerCapabilities, GraphRunnerClient, GraphRunnerClientConfig, GraphRunnerClientPluginOptions, GraphRunnerClientStore, GraphRunnerMessage, GraphRunnerPanel, HelloMessage, IMenuItemElement, INodeRegistry, ISystem, ITransport, InputSocketProps, LayoutController, LinkCreatedMessage, LinkRemovedMessage, ListGraphsMessage, LoadablePlugin, LocalGraphRunnerPanel, LocalGraphRunnerPluginOptions, LocalGraphRunnerStore, LocalTransport, LogMessage, MenuItemElement, MessageActivity, Node, NodeAddedMessage, NodeDocumentation, NodeMetadata, NodeParamUpdatedMessage, NodePicker, NodePickerFilters, NodePickerProps, NodePickerViewMode, NodeRemovedMessage, NodeSocket, NodeTypesMessage, NotificationData, NotificationType, OutputSocketProps, PingMessage, Plugin, PluginOpts, PongMessage, PubSys, RegisterGraphMessage, RemoveLinkMessage, RemoveNodeMessage, ResumeSessionMessage, RunGraphMessage, RunHistoryMessage, RunPerformance, RunStartedMessage, RunStatus, ServerEvent, ServerEventsMessage, ServerGraphListMessage, ServerGraphRegisteredMessage, ServerGraphRunnerMessage, ServerPongMessage, ServerVariable, ServerVariablesMessage, ServerWelcomeMessage, Session, SessionClosedMessage, SessionConfig, SessionCreatedMessage, SessionFactory, SessionHooks, SessionManager, SessionResumedMessage, SocketConstraint, SocketConstraintsMessage, SocketGenerator, SocketGeneratorNode, SocketGeneratorRenderProps, SocketGeneratorStore, Specific, SpecificNode, SpecificRenderProps, SpecificStore, StatusMessage, StopGraphMessage, StoppedMessage, SubscribeMessage, System, SystemContext, SystemProvider, SystemProviderProps, ToolbarButton, ToolbarButtonGroup, ToolbarStore, TraceMessage, TransportConfig, TransportState, UIGraphData, UIGraphJSON, UnsubscribeMessage, UpdateNodeParamMessage, UpdateSocketValueMessage, ValidateGraphMessage, ValidationResultMessage, ValueTypeMetadata, Variable, VariableChangedMessage, VariableJSON, WebSocketTransport, WelcomeMessage, annotatedTitle, autoLayout, behaveToFlow, calculateNewEdge, categoryColorMap, controlsStoreFactory, description, docsPlugin, docsPluginLoader, documentationStoreFactory, downloadJson, executing, extractNodeMetadata, flowToBehave, getNodePickerFilters, getSocketsByNodeTypeAndHandleType, graphRunnerClientPlugin, graphRunnerClientPluginLoader, graphRunnerClientStoreFactory, hasPositionMetaData, hidden, isHandleConnected, isValidConnection, layerId, localGraphRunnerPlugin, localGraphRunnerPluginLoader, localGraphRunnerStoreFactory, nonDeletable, pinned, plugin, readonly, realtime, resetable, serializeVariable, sleep, socketGeneratorStoreFactory, specificStoreFactory, subscribeToRef, toolbarStoreFactory, uiVersion, useBehaveGraphFlow, useChangeNodeData, useFlowHandlers, useOnPressKey, useRefFromStore, useSystem, writeVariablesToJSON };
2282
+ //# sourceMappingURL=index.d.ts.map