@kiberon-labs/behave-graph-flow 2.0.0 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (251) hide show
  1. package/.storybook/manager.ts +6 -0
  2. package/.storybook/preview.ts +49 -1
  3. package/.storybook/styles.css +9 -3
  4. package/.turbo/turbo-build.log +1 -1
  5. package/CHANGELOG.md +368 -0
  6. package/dist/AnyControlImpl-Ds-CShIB.js +20 -0
  7. package/dist/AnyControlImpl-Ds-CShIB.js.map +1 -0
  8. package/dist/DocumentationBrowserPanelImpl-deZNzFX8.js +166 -0
  9. package/dist/DocumentationBrowserPanelImpl-deZNzFX8.js.map +1 -0
  10. package/dist/index.css +36 -33
  11. package/dist/index.css.map +1 -1
  12. package/dist/index.d.ts +1865 -550
  13. package/dist/index.d.ts.map +1 -1
  14. package/dist/index.js +14357 -11221
  15. package/dist/index.js.map +1 -1
  16. package/dist/noteImpl-KkrrWgJd.js +242 -0
  17. package/dist/noteImpl-KkrrWgJd.js.map +1 -0
  18. package/dist/styles.module-CvmpDkZj.css +3 -0
  19. package/dist/styles.module-CvmpDkZj.css.map +1 -0
  20. package/dist/styles.module-DZxg8aW9.js +271 -0
  21. package/dist/styles.module-DZxg8aW9.js.map +1 -0
  22. package/dist/useChangeNodeData-ChQGK7AI.js +23 -0
  23. package/dist/useChangeNodeData-ChQGK7AI.js.map +1 -0
  24. package/docs/protocol.md +43 -20
  25. package/package.json +5 -9
  26. package/src/components/FloatingToolbar/index.module.css +5 -13
  27. package/src/components/FloatingToolbar/index.tsx +9 -9
  28. package/src/components/Flow.tsx +34 -23
  29. package/src/components/contextMenus/DynamicContextMenu.tsx +85 -0
  30. package/src/components/contextMenus/NodePicker.module.css +13 -13
  31. package/src/components/contextMenus/edge.tsx +9 -95
  32. package/src/components/contextMenus/node.tsx +9 -149
  33. package/src/components/contextMenus/selection.tsx +5 -71
  34. package/src/components/controls/any/AnyControlImpl.tsx +14 -0
  35. package/src/components/controls/any/index.tsx +13 -2
  36. package/src/components/edges/index.tsx +75 -69
  37. package/src/components/layoutController/index.module.css +3 -0
  38. package/src/components/layoutController/index.tsx +24 -1
  39. package/src/components/layoutController/utils.ts +46 -3
  40. package/src/components/menubar/defaults.tsx +55 -19
  41. package/src/components/menubar/menuItem.module.css +18 -3
  42. package/src/components/menubar/menuItem.tsx +34 -1
  43. package/src/components/nodes/behave/NodeContainer.module.css +26 -25
  44. package/src/components/nodes/group/index.tsx +3 -3
  45. package/src/components/nodes/wrapper/styles.module.css +6 -32
  46. package/src/components/panels/alignment/index.module.css +0 -10
  47. package/src/components/panels/alignment/index.tsx +4 -4
  48. package/src/components/panels/base/styles.module.css +2 -2
  49. package/src/components/panels/common/PanelHeader.module.css +24 -0
  50. package/src/components/panels/common/PanelHeader.tsx +22 -0
  51. package/src/components/panels/common/SectionTitle.module.css +13 -0
  52. package/src/components/panels/common/SectionTitle.tsx +10 -0
  53. package/src/components/panels/events/EditEventPanel.tsx +14 -5
  54. package/src/components/panels/events/ManageEventsPanel.tsx +11 -8
  55. package/src/components/panels/events/styles.module.css +6 -64
  56. package/src/components/panels/graphProperties/index.tsx +125 -0
  57. package/src/components/panels/history/index.tsx +2 -2
  58. package/src/components/panels/history/styles.module.css +0 -9
  59. package/src/components/panels/keymaps/index.module.css +3 -13
  60. package/src/components/panels/keymaps/index.tsx +1 -2
  61. package/src/components/panels/layers/index.tsx +20 -15
  62. package/src/components/panels/layers/styles.module.css +9 -12
  63. package/src/components/panels/legend/index.tsx +1 -1
  64. package/src/components/panels/logs/index.module.css +25 -19
  65. package/src/components/panels/logs/index.tsx +7 -7
  66. package/src/components/panels/nodeInputs/InputsGroup.tsx +1 -0
  67. package/src/components/panels/nodeInputs/NodeSettings.tsx +2 -2
  68. package/src/components/panels/nodeInputs/NodeTitleEditor.tsx +1 -1
  69. package/src/components/panels/nodeInputs/OutputsGroup.tsx +2 -12
  70. package/src/components/panels/nodeInputs/index.module.css +99 -75
  71. package/src/components/panels/nodeInputs/index.tsx +21 -11
  72. package/src/components/panels/nodeInputs/useNodeHandlers.ts +2 -2
  73. package/src/components/panels/nodeInputs/useNodeInputsData.ts +23 -43
  74. package/src/components/panels/nodePicker/index.tsx +8 -8
  75. package/src/components/panels/panel/index.module.css +7 -7
  76. package/src/components/panels/search/index.module.css +0 -50
  77. package/src/components/panels/search/index.tsx +2 -2
  78. package/src/components/panels/systemSettings/ConversionsSettings.tsx +203 -0
  79. package/src/components/panels/systemSettings/index.tsx +221 -176
  80. package/src/components/panels/systemSettings/styles.module.css +135 -8
  81. package/src/components/panels/traces/GridLines.tsx +1 -1
  82. package/src/components/panels/traces/TimeGrid.tsx +3 -3
  83. package/src/components/panels/traces/TraceLane.tsx +1 -1
  84. package/src/components/panels/traces/index.module.css +1 -8
  85. package/src/components/panels/traces/index.tsx +8 -4
  86. package/src/components/panels/traces/useDerivedSpans.ts +241 -146
  87. package/src/components/panels/traces/utils.ts +8 -0
  88. package/src/components/panels/variables/CreateVariableScreen.tsx +3 -3
  89. package/src/components/panels/variables/ManageVariablesScreen.tsx +12 -9
  90. package/src/components/panels/variables/index.tsx +2 -2
  91. package/src/components/panels/variables/styles.module.css +4 -91
  92. package/src/components/primitives/icon.module.css +4 -4
  93. package/src/components/sockets/input/index.tsx +9 -2
  94. package/src/components/sockets/input/styles.module.css +2 -3
  95. package/src/components/sockets/output/index.tsx +10 -3
  96. package/src/components/sockets/output/styles.module.css +1 -6
  97. package/src/css/notes.css +135 -0
  98. package/src/css/prosemirror.css +3 -3
  99. package/src/css/rc-dock.css +143 -43
  100. package/src/css/rc-menu.css +56 -55
  101. package/src/css/themes/kiberon.css +127 -0
  102. package/src/css/vars.css +197 -13
  103. package/src/css/vscode-elements.css +124 -0
  104. package/src/generators/CallSubgraphGenerator.tsx +136 -0
  105. package/src/generators/CustomEventOnTriggeredGenerator.tsx +2 -2
  106. package/src/generators/GraphBoundaryGenerator.module.css +32 -0
  107. package/src/generators/GraphBoundaryGenerator.tsx +193 -0
  108. package/src/generators/SequenceGenerator.tsx +2 -2
  109. package/src/generators/SwitchOnIntegerGenerator.tsx +2 -2
  110. package/src/generators/SwitchOnStringGenerator.tsx +2 -2
  111. package/src/generators/callSubgraphSync.ts +126 -0
  112. package/src/generators/registerDefaultGenerators.ts +21 -0
  113. package/src/generators/registerDefaults.ts +26 -0
  114. package/src/hooks/useBehaveGraphFlow.ts +2 -2
  115. package/src/hooks/useFlowHandlers.ts +47 -9
  116. package/src/hooks/useWasdPan.ts +26 -4
  117. package/src/index.css +4 -16
  118. package/src/index.ts +17 -0
  119. package/src/manifest/contributionRegistry.ts +93 -0
  120. package/src/manifest/index.ts +4 -0
  121. package/src/manifest/loadManifest.ts +82 -0
  122. package/src/manifest/manifestPlugin.ts +29 -0
  123. package/src/manifest/passthroughValueType.ts +40 -0
  124. package/src/plugin/alignment/index.ts +22 -12
  125. package/src/plugin/autosave/controller.ts +366 -0
  126. package/src/plugin/autosave/index.tsx +114 -0
  127. package/src/plugin/autosave/panel/BackupPanel.tsx +141 -0
  128. package/src/plugin/autosave/panel/index.tsx +1 -0
  129. package/src/plugin/autosave/panel/styles.module.css +56 -0
  130. package/src/plugin/autosave/settings.ts +65 -0
  131. package/src/plugin/autosave/storage.ts +147 -0
  132. package/src/plugin/docs/index.tsx +2 -4
  133. package/src/plugin/docs/panel/DocumentationBrowserPanelImpl.tsx +200 -0
  134. package/src/plugin/docs/panel/index.tsx +15 -194
  135. package/src/plugin/docs/panel/styles.module.css +8 -8
  136. package/src/plugin/graphrunner/actions.ts +258 -185
  137. package/src/plugin/graphrunner/buttons.tsx +34 -26
  138. package/src/plugin/graphrunner/client.ts +4 -1
  139. package/src/plugin/graphrunner/index.tsx +29 -100
  140. package/src/plugin/graphrunner/panel.tsx +2 -2
  141. package/src/plugin/graphrunner/runController.ts +283 -0
  142. package/src/plugin/graphrunner/runner.ts +21 -192
  143. package/src/plugin/graphrunner/store.ts +14 -24
  144. package/src/plugin/graphrunner/styles.module.css +17 -57
  145. package/src/plugin/graphrunner/transport.ts +26 -0
  146. package/src/plugin/graphrunner/types.ts +21 -0
  147. package/src/plugin/graphrunner-local/execution-utils.ts +260 -80
  148. package/src/plugin/graphrunner-local/index.tsx +8 -2
  149. package/src/plugin/graphrunner-local/panel.tsx +131 -175
  150. package/src/plugin/graphrunner-local/styles.module.css +57 -76
  151. package/src/plugin/graphrunner-local/transport.ts +151 -184
  152. package/src/plugin/graphrunner-webworker/graph-executor.worker.ts +2 -0
  153. package/src/plugin/graphrunner-webworker/index.tsx +4 -10
  154. package/src/plugin/graphrunner-webworker/store.ts +9 -0
  155. package/src/plugin/kitchen-sink/index.ts +38 -0
  156. package/src/{layout/dagre.tsx → plugin/layout/dagre.ts} +17 -5
  157. package/src/{layout → plugin/layout}/elk.ts +22 -6
  158. package/src/plugin/layout/index.ts +80 -0
  159. package/src/plugin/notes/FormatToolbar.tsx +200 -0
  160. package/src/plugin/notes/index.tsx +191 -0
  161. package/src/plugin/notes/nodeActions.ts +100 -0
  162. package/src/plugin/notes/note.tsx +20 -0
  163. package/src/plugin/notes/noteImpl.tsx +89 -0
  164. package/src/plugin/realtime/realtimeRunner.ts +58 -4
  165. package/src/specifics/CustomEventOnTriggeredSpecific.tsx +2 -2
  166. package/src/specifics/CustomEventTriggerSpecific.tsx +2 -2
  167. package/src/specifics/VariableGetSpecific.tsx +2 -2
  168. package/src/specifics/VariableSetSpecific.tsx +2 -2
  169. package/src/store/actions.tsx +5 -5
  170. package/src/store/commands.ts +278 -0
  171. package/src/store/contextMenu.ts +192 -0
  172. package/src/store/conversions.ts +47 -0
  173. package/src/store/flow.tsx +23 -38
  174. package/src/store/graphMeta.ts +39 -0
  175. package/src/store/hotKeys.tsx +301 -260
  176. package/src/store/layers.ts +3 -3
  177. package/src/store/registry.ts +12 -4
  178. package/src/store/selection.ts +3 -3
  179. package/src/store/settings.ts +82 -82
  180. package/src/store/settingsSchema.ts +210 -0
  181. package/src/store/tabs.ts +5 -1
  182. package/src/store/traces.ts +3 -3
  183. package/src/system/graph.ts +11 -14
  184. package/src/system/graphSession.ts +172 -0
  185. package/src/system/index.ts +3 -0
  186. package/src/system/notifications.ts +13 -0
  187. package/src/system/persistence.ts +82 -0
  188. package/src/system/plugin.ts +28 -0
  189. package/src/system/provider.tsx +64 -0
  190. package/src/system/system.ts +518 -88
  191. package/src/system/tabLoader.tsx +70 -32
  192. package/src/system/undoRedo.ts +1 -1
  193. package/src/transformers/Uigraph.ts +5 -4
  194. package/src/transformers/contract.ts +87 -0
  195. package/src/transformers/flowToBehave.ts +13 -5
  196. package/src/types/nodes.ts +8 -3
  197. package/src/types.ts +2 -0
  198. package/src/util/autoConvert.ts +200 -0
  199. package/src/util/isValidConnection.ts +23 -2
  200. package/stories/defaults/defaultStoryProvider.tsx +17 -14
  201. package/stories/defaults/systemGenerator.ts +6 -1
  202. package/stories/{components/nodes/comment.stories.tsx → plugins/notes.stories.tsx} +24 -30
  203. package/tests/autoConvert.test.ts +329 -0
  204. package/tests/autosavePlugin.test.ts +204 -0
  205. package/tests/callSubgraphSync.test.ts +148 -0
  206. package/tests/commandRegistry.test.ts +137 -0
  207. package/tests/contract.test.ts +51 -0
  208. package/tests/contractSerialize.test.ts +62 -0
  209. package/tests/deriveSpans.test.ts +71 -0
  210. package/tests/flowToBehave.test.ts +2 -1
  211. package/tests/hotkeys.test.ts +79 -0
  212. package/tests/keepAliveLifecycle.test.ts +167 -0
  213. package/tests/loadManifest.test.ts +113 -0
  214. package/tests/noteMarkdown.test.ts +65 -0
  215. package/tests/notesPlugin.test.ts +162 -0
  216. package/tests/persistence.test.ts +51 -0
  217. package/tests/saveLoad.test.ts +7 -6
  218. package/tests/settings.test.ts +178 -0
  219. package/tests/traceStore.test.ts +46 -0
  220. package/tests/visual/README.md +2 -2
  221. package/tests/visual/__screenshots__/panels.visual.test.tsx/panel-conversation-chromium-win32.png +0 -0
  222. package/tests/visual/__screenshots__/panels.visual.test.tsx/panel-events-chromium-win32.png +0 -0
  223. package/tests/visual/__screenshots__/panels.visual.test.tsx/panel-history-chromium-win32.png +0 -0
  224. package/tests/visual/__screenshots__/panels.visual.test.tsx/panel-keymaps-chromium-win32.png +0 -0
  225. package/tests/visual/__screenshots__/panels.visual.test.tsx/panel-layers-chromium-win32.png +0 -0
  226. package/tests/visual/__screenshots__/panels.visual.test.tsx/panel-legend-chromium-win32.png +0 -0
  227. package/tests/visual/__screenshots__/panels.visual.test.tsx/panel-localGraphRunner-chromium-win32.png +0 -0
  228. package/tests/visual/__screenshots__/panels.visual.test.tsx/panel-logs-chromium-win32.png +0 -0
  229. package/tests/visual/__screenshots__/panels.visual.test.tsx/panel-nodeInputs-chromium-win32.png +0 -0
  230. package/tests/visual/__screenshots__/panels.visual.test.tsx/panel-nodePicker-chromium-win32.png +0 -0
  231. package/tests/visual/__screenshots__/panels.visual.test.tsx/panel-panel-chromium-win32.png +0 -0
  232. package/tests/visual/__screenshots__/panels.visual.test.tsx/panel-search-chromium-win32.png +0 -0
  233. package/tests/visual/__screenshots__/panels.visual.test.tsx/panel-systemSettings-chromium-win32.png +0 -0
  234. package/tests/visual/__screenshots__/panels.visual.test.tsx/panel-variables-chromium-win32.png +0 -0
  235. package/tests/visual/panels.visual.test.tsx +3 -3
  236. package/tests/wasdPan.test.ts +71 -0
  237. package/vitest.config.ts +1 -1
  238. package/vitest.visual.config.ts +7 -0
  239. package/.storybook/vscode.css +0 -814
  240. package/src/components/nodes/comment/FormatToolbar.tsx +0 -118
  241. package/src/components/nodes/comment/comment.tsx +0 -103
  242. package/src/components/nodes/comment/styles.module.css +0 -150
  243. package/src/components/panels/conversation/index.module.css +0 -151
  244. package/src/components/panels/conversation/index.tsx +0 -162
  245. package/src/components/panels/events/CustomEventsEditor.tsx +0 -384
  246. package/src/css/vscode.css +0 -13
  247. package/src/hooks/useDetachNodes.ts +0 -39
  248. package/src/plugin/graphrunner-webworker/types.ts +0 -17
  249. package/src/specifics/registerDefaultSpecifics.ts +0 -5
  250. package/src/store/chat.ts +0 -73
  251. package/src/store/graphRunnerClient.ts +0 -110
package/src/css/vars.css CHANGED
@@ -1,14 +1,198 @@
1
1
  :root {
2
- --colors-bgCanvas: #1f1f1f;
3
- --colors-bgDefault: #181818;
4
- --colors-bgEmphasis: #444444;
5
- --colors-bgSubtle: #373737;
6
- --colors-bgSurface: #292929;
7
- --colors-borderDefault: #636363;
8
- --colors-borderMuted: #2e2e2e;
9
- --colors-borderSubtle: #454545;
10
- --colors-fg: #fff;
11
- --colors-fgSubtle: #8a8a8a;
12
- --colors-inputBg: red;
13
- --colors-inputBorderRest: red;
14
- }
2
+ /* ───────────────────────────────────────────────────────────────────────
3
+ Theme bridge (--ds-*)
4
+
5
+ These are the design system's *intermediary* tokens. Every component and
6
+ semantic token resolves colors/fonts through this layer — nothing in the
7
+ flow package references `--vscode-*` directly anymore. The values here are
8
+ the canonical (VS Code dark) defaults, so the editor looks right when run
9
+ standalone (Storybook, web, tests).
10
+
11
+ Inside the VS Code extension these tokens are re-declared to point at the
12
+ live `--vscode-*` theme variables (see the extension's theme-bridge.css),
13
+ which makes the whole editor follow the user's active VS Code theme. This
14
+ is the ONLY file that needs to enumerate the design tokens; the extension
15
+ mapping overrides just this layer and everything below cascades.
16
+ ─────────────────────────────────────────────────────────────────────── */
17
+
18
+ /* Fonts */
19
+ --ds-font-ui: "Segoe UI", system-ui, sans-serif;
20
+ --ds-font-mono: "Consolas", "Courier New", monospace;
21
+ --ds-font-mono-size: 14px;
22
+
23
+ /* Foreground */
24
+ --ds-fg: #cccccc;
25
+ --ds-fg-muted: #9d9d9d;
26
+ --ds-icon-fg: #cccccc;
27
+ --ds-editor-fg: #cccccc;
28
+ --ds-widget-fg: #cccccc;
29
+
30
+ /* Surfaces */
31
+ --ds-editor-bg: #1f1f1f;
32
+ --ds-widget-bg: #202020;
33
+ --ds-sidebar-bg: #181818;
34
+ --ds-tabs-bg: #181818;
35
+ --ds-tab-inactive-bg: #181818;
36
+ --ds-section-header-bg: #181818;
37
+ --ds-section-header-fg: #cccccc;
38
+ --ds-section-header-border: #2b2b2b;
39
+
40
+ /* Borders / focus / sashes */
41
+ --ds-border: #313131;
42
+ --ds-border-subtle: #454545;
43
+ --ds-border-muted: rgba(255, 255, 255, 0.09);
44
+ --ds-panel-border: #2b2b2b;
45
+ --ds-focus-border: #0078d4;
46
+ --ds-sash-hover-border: #0078d4;
47
+ --ds-sash-border: #2b2b2b;
48
+
49
+ /* Buttons */
50
+ --ds-button-bg: #0078d4;
51
+ --ds-button-fg: #ffffff;
52
+ --ds-button-hover-bg: #026ec1;
53
+ --ds-button-secondary-bg: #313131;
54
+ --ds-button-border: #313131;
55
+
56
+ /* Inputs */
57
+ --ds-input-bg: #313131;
58
+ --ds-input-border: #3c3c3c;
59
+ --ds-input-fg: #cccccc;
60
+ --ds-input-option-active-bg: rgba(36, 137, 219, 0.51);
61
+ --ds-input-option-active-border: #2488db;
62
+ --ds-input-option-active-fg: #ffffff;
63
+
64
+ /* Lists */
65
+ --ds-list-active-bg: #04395e;
66
+ --ds-list-active-fg: #ffffff;
67
+ --ds-list-hover-bg: #2a2d2e;
68
+
69
+ /* Toolbar / badges */
70
+ --ds-toolbar-active-bg: rgba(99, 102, 103, 0.31);
71
+ --ds-toolbar-hover-bg: rgba(90, 93, 94, 0.31);
72
+ --ds-badge-bg: #616161;
73
+ --ds-badge-fg: #f8f8f8;
74
+
75
+ /* Text variants */
76
+ --ds-preformat-fg: #d0d0d0;
77
+ --ds-blockquote-bg: #2b2b2b;
78
+ --ds-blockquote-border: #616161;
79
+ --ds-code-bg: #2b2b2b;
80
+
81
+ /* Editor / status states */
82
+ --ds-inactive-selection-bg: #3a3d41;
83
+ --ds-find-match-bg: rgba(234, 92, 0, 0.33);
84
+ --ds-error: #f14c4c;
85
+ --ds-warning: #cca700;
86
+ --ds-success: #89d185;
87
+ --ds-error-bg: #5a1d1d;
88
+ --ds-error-border: #be1100;
89
+ --ds-error-fg: #cccccc;
90
+ --ds-info-bg: #063b49;
91
+ --ds-info-border: #007acc;
92
+
93
+ /* Charts / git / terminal accents */
94
+ --ds-chart-blue: #59a4f9;
95
+ --ds-git-added: #81b88b;
96
+ --ds-git-modified: #e2c08d;
97
+ --ds-terminal-cyan: #11a8cd;
98
+
99
+ /* Menus (cascade onto the surfaces above when no host value exists) */
100
+ --ds-menu-bg: var(--ds-widget-bg);
101
+ --ds-menu-fg: var(--ds-fg);
102
+ --ds-menu-border: var(--ds-border);
103
+ --ds-menu-selection-bg: var(--ds-list-hover-bg);
104
+ --ds-menu-selection-fg: var(--ds-fg);
105
+
106
+ /* Graph node category accents + shape (the left-edge bar on a node header,
107
+ keyed by category in util/colors.ts). Default values track the editor's
108
+ syntax-style palette; an alternate theme can recolor these to its own
109
+ palette without touching the node components. */
110
+ --ds-node-red: #d16969;
111
+ --ds-node-green: #89d185;
112
+ --ds-node-lime: #b5cea8;
113
+ --ds-node-purple: #c586c0;
114
+ --ds-node-blue: #4fc1ff;
115
+ --ds-node-radius: 4px;
116
+
117
+ /* ───────────────────────────────────────────────────────────────────────
118
+ Semantic tokens
119
+
120
+ Curated surface/text aliases consumed across the editor. They resolve
121
+ through the bridge layer above, so theming is handled in one place.
122
+ ─────────────────────────────────────────────────────────────────────── */
123
+ --colors-bgCanvas: var(--ds-editor-bg);
124
+ --colors-bgDefault: var(--ds-sidebar-bg);
125
+ --colors-bgPanel: var(--ds-sidebar-bg);
126
+ --colors-bgSecondary: var(--ds-widget-bg);
127
+ --colors-bgEmphasis: var(--ds-toolbar-hover-bg);
128
+ --colors-bgSubtle: var(--ds-widget-bg);
129
+ --colors-bgSurface: var(--ds-widget-bg);
130
+
131
+ --colors-border: var(--ds-border);
132
+ --colors-borderDefault: var(--ds-border);
133
+ --colors-borderMuted: var(--ds-border-muted);
134
+ --colors-borderSubtle: var(--ds-border-subtle);
135
+
136
+ --colors-fg: var(--ds-fg);
137
+ --colors-text: var(--ds-fg);
138
+ --colors-fgSubtle: var(--ds-fg-muted);
139
+
140
+ --colors-inputBg: var(--ds-input-bg);
141
+ --colors-inputBorderRest: var(--ds-input-border);
142
+
143
+ --colors-error: var(--ds-error);
144
+ --colors-success: var(--ds-success);
145
+
146
+ --chip-color: var(--ds-badge-bg);
147
+
148
+ /* Legacy design-system aliases referenced across many components. */
149
+ --color-neutral-stroke-subtle: var(--ds-border-subtle);
150
+ --color-neutral-stroke-default: var(--ds-border);
151
+ --color-neutral-canvas-subtle-bg: var(--ds-tabs-bg);
152
+ --color-neutral-canvas-default-bg: var(--ds-editor-bg);
153
+ --color-neutral-background-strong: var(--ds-code-bg);
154
+ --color-neutral-canvas-minimal-fg-default: var(--ds-fg);
155
+ --color-neutral-canvas-minimal-fg-subtle: var(--ds-fg-muted);
156
+ --color-neutral-canvas-subtle-fg-subtle: rgba(0, 0, 0, 0.36);
157
+ --color-danger-surface-default-idle-bg: var(--ds-error-bg);
158
+ --color-danger-surface-default-idle-fg-default: var(--ds-error);
159
+
160
+ /* ───────────────────────────────────────────────────────────────────────
161
+ Non-themed scale tokens (sizing/spacing/typography ramps). These are not
162
+ host-theme-aware, so they hold literal values.
163
+ ─────────────────────────────────────────────────────────────────────── */
164
+
165
+ /* Shared type scale (compact, VSCode-settings density) */
166
+ --fs-section: 0.7rem; /* uppercase group headers */
167
+ --fs-label: 0.8rem; /* control labels / list rows */
168
+ --fs-desc: 0.72rem; /* secondary descriptions */
169
+ --fs-body: 0.8125rem; /* node + general body text */
170
+
171
+ /* Shared spacing scale */
172
+ --space-0: 0.125rem;
173
+ --space-1: 0.25rem;
174
+ --space-2: 0.5rem;
175
+ --space-3: 0.75rem;
176
+
177
+ /* Component scale */
178
+ --component-spacing-xs: var(--space-1);
179
+ --component-spacing-sm: var(--space-2);
180
+ --component-spacing-md: var(--space-3);
181
+ --component-radii-sm: 4px;
182
+ --component-radii-md: 6px;
183
+ --component-border-width-md: 1px;
184
+
185
+ /* Sizes scale (N × 0.25rem) */
186
+ --sizes-2: 0.5rem;
187
+ --sizes-4: 1rem;
188
+
189
+ /* Font tokens. NOTE: --font-body-* are consumed via the `font:` shorthand,
190
+ so they must be complete font values, not bare sizes. */
191
+ --fontSizes-small: var(--fs-desc, 0.72rem);
192
+ --font-body-sm: 400 0.8rem/1.4 var(--ds-font-ui);
193
+ --font-body-xs: 400 0.72rem/1.4 var(--ds-font-ui);
194
+
195
+ /* Shadows */
196
+ --shadows-contextMenu: 0 2px 8px rgba(0, 0, 0, 0.36);
197
+ --shadows-focus: 0 0 0 1px var(--ds-focus-border);
198
+ }
@@ -0,0 +1,124 @@
1
+ /*
2
+ * @vscode-elements adapter.
3
+ *
4
+ * The editor uses @vscode-elements/react-elements (VscodeButton, VscodeTextfield,
5
+ * VscodeCheckbox, VscodeBadge, VscodeSingleSelect, …). Those web components style
6
+ * themselves from `--vscode-*` custom properties — they don't know about our
7
+ * `--ds-*` tokens. This file feeds them: it expresses our design tokens in the
8
+ * `--vscode-*` vocabulary the components understand, so they follow the active
9
+ * theme (default or an alternate like Kiberon) instead of falling back to their
10
+ * built-in VS Code blue.
11
+ *
12
+ * IMPORTANT — why the selector lists every theme scope:
13
+ * A custom property whose value is `var(--ds-x)` is substituted at the element
14
+ * it's declared on, then that *resolved* value inherits. Declaring the bridge
15
+ * only at `:root` would bake in the default `--ds-*` values and ignore a scoped
16
+ * theme. So the bridge is declared on `:root` AND on each theme container (where
17
+ * `--ds-*` is re-declared), so it re-resolves to that scope's tokens. When you
18
+ * add a new theme under css/themes/, add its scope selector here too.
19
+ *
20
+ * In the real VS Code extension this is inert: VS Code injects `--vscode-*` as
21
+ * inline styles on <html>, which win over these :root rules — so vscode-elements
22
+ * track the user's actual VS Code theme there, as intended.
23
+ */
24
+ :root,
25
+ [data-flow-theme="kiberon"],
26
+ .flow-theme-kiberon {
27
+ /* Type */
28
+ --vscode-font-family: var(--ds-font-ui);
29
+
30
+ /* Foreground / focus / chrome */
31
+ --vscode-foreground: var(--ds-fg);
32
+ --vscode-disabledForeground: var(--ds-fg-muted);
33
+ --vscode-descriptionForeground: var(--ds-fg-muted);
34
+ --vscode-icon-foreground: var(--ds-icon-fg);
35
+ --vscode-focusBorder: var(--ds-focus-border);
36
+ --vscode-widget-border: var(--ds-border);
37
+ --vscode-contrastBorder: var(--ds-border);
38
+
39
+ /* Buttons */
40
+ --vscode-button-background: var(--ds-button-bg);
41
+ --vscode-button-foreground: var(--ds-button-fg);
42
+ --vscode-button-hoverBackground: var(--ds-button-hover-bg);
43
+ --vscode-button-border: var(--ds-button-border);
44
+ --vscode-button-secondaryBackground: var(--ds-button-secondary-bg);
45
+ --vscode-button-secondaryForeground: var(--ds-fg);
46
+ --vscode-button-secondaryHoverBackground: var(--ds-list-hover-bg);
47
+
48
+ /* Text inputs / textarea */
49
+ --vscode-input-background: var(--ds-input-bg);
50
+ --vscode-input-foreground: var(--ds-input-fg);
51
+ --vscode-input-border: var(--ds-input-border);
52
+ --vscode-input-placeholderForeground: var(--ds-fg-muted);
53
+ --vscode-settings-textInputBackground: var(--ds-input-bg);
54
+ --vscode-settings-textInputForeground: var(--ds-input-fg);
55
+ --vscode-settings-textInputBorder: var(--ds-input-border);
56
+
57
+ /* Checkbox */
58
+ --vscode-checkbox-background: var(--ds-input-bg);
59
+ --vscode-checkbox-foreground: var(--ds-fg);
60
+ --vscode-checkbox-border: var(--ds-input-border);
61
+ --vscode-checkbox-selectBackground: var(--ds-button-bg);
62
+ --vscode-checkbox-selectBorder: var(--ds-button-bg);
63
+ --vscode-settings-checkboxBackground: var(--ds-input-bg);
64
+ --vscode-settings-checkboxForeground: var(--ds-fg);
65
+ --vscode-settings-checkboxBorder: var(--ds-input-border);
66
+
67
+ /* Dropdown / single-select */
68
+ --vscode-dropdown-background: var(--ds-widget-bg);
69
+ --vscode-dropdown-foreground: var(--ds-fg);
70
+ --vscode-dropdown-border: var(--ds-input-border);
71
+ --vscode-dropdown-listBackground: var(--ds-widget-bg);
72
+ --vscode-settings-dropdownBackground: var(--ds-widget-bg);
73
+ --vscode-settings-dropdownForeground: var(--ds-fg);
74
+ --vscode-settings-dropdownBorder: var(--ds-input-border);
75
+
76
+ /* Badge */
77
+ --vscode-badge-background: var(--ds-badge-bg);
78
+ --vscode-badge-foreground: var(--ds-badge-fg);
79
+
80
+ /* Lists / trees */
81
+ --vscode-list-activeSelectionBackground: var(--ds-list-active-bg);
82
+ --vscode-list-activeSelectionForeground: var(--ds-list-active-fg);
83
+ --vscode-list-inactiveSelectionBackground: var(--ds-list-hover-bg);
84
+ --vscode-list-hoverBackground: var(--ds-list-hover-bg);
85
+ --vscode-list-hoverForeground: var(--ds-fg);
86
+ --vscode-list-focusBackground: var(--ds-list-active-bg);
87
+ --vscode-list-focusOutline: var(--ds-focus-border);
88
+
89
+ /* Toolbar */
90
+ --vscode-toolbar-hoverBackground: var(--ds-toolbar-hover-bg);
91
+ --vscode-toolbar-activeBackground: var(--ds-toolbar-active-bg);
92
+
93
+ /* Surfaces — collapsible headers, tables, dividers, panels */
94
+ --vscode-editorWidget-background: var(--ds-widget-bg);
95
+ --vscode-editorWidget-foreground: var(--ds-widget-fg);
96
+ --vscode-editorWidget-border: var(--ds-border-subtle);
97
+ --vscode-panel-border: var(--ds-panel-border);
98
+ --vscode-sideBar-background: var(--ds-sidebar-bg);
99
+ --vscode-sideBarSectionHeader-background: var(--ds-section-header-bg);
100
+ --vscode-sideBarSectionHeader-foreground: var(--ds-section-header-fg);
101
+ --vscode-sideBarSectionHeader-border: var(--ds-section-header-border);
102
+ --vscode-settings-headerForeground: var(--ds-fg);
103
+ }
104
+
105
+ /*
106
+ * Native form controls (checkbox / range / radio) tint from `accent-color`,
107
+ * which is a normal property — it re-resolves `var(--ds-*)` per element, so it
108
+ * follows a scoped theme without extra selectors.
109
+ */
110
+ input[type="checkbox"],
111
+ input[type="radio"],
112
+ input[type="range"] {
113
+ accent-color: var(--ds-button-bg);
114
+ }
115
+
116
+ /*
117
+ * Safety: vscode-elements form controls carry an intrinsic default width that can
118
+ * exceed a narrow panel and force horizontal overflow. Cap them to their container.
119
+ */
120
+ vscode-textfield,
121
+ vscode-textarea,
122
+ vscode-single-select {
123
+ max-width: 100%;
124
+ }
@@ -0,0 +1,136 @@
1
+ import React, { useCallback, useEffect, useMemo } from 'react';
2
+ import { useStore } from 'zustand';
3
+ import {
4
+ VscodeOption,
5
+ VscodeSingleSelect
6
+ } from '@vscode-elements/react-elements';
7
+ import { useGraph } from '@/system/provider';
8
+ import type { SocketGeneratorRenderProps } from '@/store/socketGenerator';
9
+ import type { Socket } from '@/types';
10
+ import type { IBehaveNode } from '@/types/nodes.js';
11
+ import type { NodeSpecJSON } from '@kiberon-labs/behave-graph/Graphs/IO/NodeSpecJSON';
12
+ import {
13
+ CALL_SUBGRAPH_TYPE,
14
+ contractToParams,
15
+ deriveContract,
16
+ paramsToSockets,
17
+ type ContractParam
18
+ } from '@/transformers/contract';
19
+
20
+ export function getCallSubgraphGenerator() {
21
+ return {
22
+ name: `${CALL_SUBGRAPH_TYPE}.socketGenerator`,
23
+ check: (spec: NodeSpecJSON) => spec?.type === CALL_SUBGRAPH_TYPE,
24
+ render: CallSubgraphGenerator
25
+ };
26
+ }
27
+
28
+ const toSockets = (params: ContractParam[] | undefined): Socket[] =>
29
+ paramsToSockets(params ?? []);
30
+
31
+ /**
32
+ * Properties-panel editor for a Call Subgraph node: pick which open graph to
33
+ * call. Selecting one copies that graph's contract into the node configuration
34
+ * and mirrors it onto the node's dynamic input/output ports. The `flow` input
35
+ * and the `started` / `completed` flow outputs are static on the core node.
36
+ */
37
+ const CallSubgraphGenerator: React.FC<SocketGeneratorRenderProps> = ({
38
+ node
39
+ }) => {
40
+ const session = useGraph();
41
+ const sessions = useStore(session.editor.activeGraph, (s) => s.sessions);
42
+
43
+ const options = useMemo(
44
+ () =>
45
+ Object.values(sessions)
46
+ .filter((s) => s.id !== session.id)
47
+ .map((s) => ({ id: s.id, name: s.name })),
48
+ [sessions, session.id]
49
+ );
50
+
51
+ const config = node.data.configuration as
52
+ | {
53
+ subgraphId?: string;
54
+ inputs?: ContractParam[];
55
+ outputs?: ContractParam[];
56
+ }
57
+ | undefined;
58
+ const subgraphId = String(config?.subgraphId ?? '');
59
+ const portsKey = JSON.stringify({
60
+ inputs: config?.inputs ?? [],
61
+ outputs: config?.outputs ?? []
62
+ });
63
+
64
+ // Mirror the copied contract onto dynamic ports.
65
+ useEffect(() => {
66
+ const inputs = toSockets(config?.inputs);
67
+ const outputs = toSockets(config?.outputs);
68
+ session.nodeStore.getState().setNodes((prev) =>
69
+ prev.map((n) => {
70
+ if (n.id !== node.id) return n;
71
+ return {
72
+ ...n,
73
+ data: {
74
+ ...n.data,
75
+ dynamicPorts: { ...n.data?.dynamicPorts, inputs, outputs }
76
+ }
77
+ } as IBehaveNode;
78
+ })
79
+ );
80
+ // eslint-disable-next-line react-hooks/exhaustive-deps
81
+ }, [portsKey, node.id, session.nodeStore]);
82
+
83
+ const select = useCallback(
84
+ (nextId: string) => {
85
+ const target = sessions[nextId];
86
+ const contract = target
87
+ ? deriveContract(target.nodeStore.getState().nodes)
88
+ : { graphInputs: [], graphOutputs: [] };
89
+ const inputs = contractToParams(contract.graphInputs);
90
+ const outputs = contractToParams(contract.graphOutputs);
91
+
92
+ session.nodeStore.getState().setNodes((prev) =>
93
+ prev.map((n) => {
94
+ if (n.id !== node.id) return n;
95
+ return {
96
+ ...n,
97
+ data: {
98
+ ...n.data,
99
+ configuration: {
100
+ ...n.data?.configuration,
101
+ subgraphId: nextId,
102
+ inputs,
103
+ outputs
104
+ }
105
+ }
106
+ } as IBehaveNode;
107
+ })
108
+ );
109
+ },
110
+ [node.id, session, sessions]
111
+ );
112
+
113
+ return (
114
+ <div style={{ display: 'flex', flexDirection: 'column', gap: 4 }}>
115
+ <div style={{ fontSize: 12, opacity: 0.9 }}>Subgraph</div>
116
+ <VscodeSingleSelect
117
+ value={subgraphId}
118
+ onChange={(e: any) => select(String(e?.target?.value ?? ''))}
119
+ disabled={options.length === 0}
120
+ >
121
+ {options.length === 0 ? (
122
+ <VscodeOption value="">No other graphs open</VscodeOption>
123
+ ) : (
124
+ <>
125
+ <VscodeOption value="">Select a graph...</VscodeOption>
126
+ {options.map((opt) => (
127
+ <VscodeOption key={opt.id} value={opt.id}>
128
+ {opt.name || opt.id}
129
+ </VscodeOption>
130
+ ))}
131
+ </>
132
+ )}
133
+ </VscodeSingleSelect>
134
+ </div>
135
+ );
136
+ };
@@ -1,6 +1,6 @@
1
1
  import React, { useEffect } from 'react';
2
2
  import { useStore } from 'zustand';
3
- import { useSystem } from '@/system/provider';
3
+ import { useGraph } from '@/system/provider';
4
4
  import type { SocketGeneratorRenderProps } from '@/store/socketGenerator';
5
5
  import type { Socket } from '@/types';
6
6
  import type { IBehaveNode } from '@/types/nodes.js';
@@ -19,7 +19,7 @@ export function getCustomEventOnTriggeredGenerator() {
19
19
  const CustomEventOnTriggeredGenerator: React.FC<SocketGeneratorRenderProps> = ({
20
20
  node
21
21
  }) => {
22
- const system = useSystem();
22
+ const system = useGraph();
23
23
  const customEvents = useStore(system.eventsStore, (s) => s.customEvents);
24
24
 
25
25
  const customEventId = node.data.configuration?.customEventId;
@@ -0,0 +1,32 @@
1
+ .list {
2
+ display: flex;
3
+ flex-direction: column;
4
+ gap: 0.4rem;
5
+ }
6
+
7
+ /* One card per boundary param so the name field gets its own full-width line
8
+ instead of collapsing next to the type select. */
9
+ .param {
10
+ display: flex;
11
+ flex-direction: column;
12
+ gap: 0.3rem;
13
+ padding: 0.4rem;
14
+ border: 1px solid var(--ds-border-subtle, #454545);
15
+ border-radius: var(--component-radii-sm, 4px);
16
+ background: var(--ds-widget-bg, #202020);
17
+ }
18
+
19
+ .topRow {
20
+ display: flex;
21
+ align-items: center;
22
+ gap: 0.3rem;
23
+ }
24
+
25
+ .name {
26
+ flex: 1;
27
+ min-width: 0;
28
+ }
29
+
30
+ .type {
31
+ width: 100%;
32
+ }