@sixb/app 0.1.10 → 0.1.12

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 (580) hide show
  1. package/LICENSE +2 -0
  2. package/README.md +25 -19
  3. package/assets/connector-icons/README.md +29 -0
  4. package/assets/connector-icons/ace-iot.ico +0 -0
  5. package/assets/connector-icons/companycam.png +0 -0
  6. package/assets/connector-icons/exa.png +0 -0
  7. package/assets/connector-icons/github.svg +1 -0
  8. package/assets/connector-icons/google.ico +0 -0
  9. package/assets/connector-icons/googleads.svg +29 -0
  10. package/assets/connector-icons/linkedin.svg +1 -0
  11. package/assets/connector-icons/mercury.svg +1 -0
  12. package/assets/connector-icons/meta.svg +1 -0
  13. package/assets/connector-icons/microsoft.ico +0 -0
  14. package/assets/connector-icons/notion.svg +1 -0
  15. package/assets/connector-icons/pandadoc.png +0 -0
  16. package/assets/connector-icons/pennylane.ico +0 -0
  17. package/assets/connector-icons/pipedrive.png +0 -0
  18. package/assets/connector-icons/plaud.png +0 -0
  19. package/assets/connector-icons/quickbooks.svg +1 -0
  20. package/assets/connector-icons/stripe.svg +1 -0
  21. package/assets/connector-icons/teamleader.ico +0 -0
  22. package/assets/connector-icons/tiktok.svg +1 -0
  23. package/assets/connector-icons/unipile.png +0 -0
  24. package/dist/agent/activity-label.d.ts +5 -0
  25. package/dist/agent/activity-label.d.ts.map +1 -0
  26. package/dist/agent/agent-chat.d.ts +24 -0
  27. package/dist/agent/agent-chat.d.ts.map +1 -0
  28. package/dist/agent/agent-context-provider.d.ts +9 -0
  29. package/dist/agent/agent-context-provider.d.ts.map +1 -0
  30. package/dist/agent/agent-execution-trace.d.ts +9 -0
  31. package/dist/agent/agent-execution-trace.d.ts.map +1 -0
  32. package/dist/agent/agent-panel.d.ts +27 -0
  33. package/dist/agent/agent-panel.d.ts.map +1 -0
  34. package/dist/agent/agent-surface-state.d.ts +22 -0
  35. package/dist/agent/agent-surface-state.d.ts.map +1 -0
  36. package/dist/agent/agent-surface.d.ts +46 -0
  37. package/dist/agent/agent-surface.d.ts.map +1 -0
  38. package/dist/agent/bash/bash-tool-view.d.ts +17 -0
  39. package/dist/agent/bash/bash-tool-view.d.ts.map +1 -0
  40. package/dist/agent/bash/data.d.ts +35 -0
  41. package/dist/agent/bash/data.d.ts.map +1 -0
  42. package/dist/agent/bash/interpret.d.ts +84 -0
  43. package/dist/agent/bash/interpret.d.ts.map +1 -0
  44. package/dist/agent/bash/renderers.d.ts +31 -0
  45. package/dist/agent/bash/renderers.d.ts.map +1 -0
  46. package/dist/agent/bash/shell.d.ts +16 -0
  47. package/dist/agent/bash/shell.d.ts.map +1 -0
  48. package/dist/agent/components/activity-status.d.ts +13 -0
  49. package/dist/agent/components/activity-status.d.ts.map +1 -0
  50. package/dist/agent/components/agent-thread-switcher.d.ts +16 -0
  51. package/dist/agent/components/agent-thread-switcher.d.ts.map +1 -0
  52. package/dist/agent/components/composer.d.ts +47 -0
  53. package/dist/agent/components/composer.d.ts.map +1 -0
  54. package/dist/agent/components/context-chips.d.ts +7 -0
  55. package/dist/agent/components/context-chips.d.ts.map +1 -0
  56. package/dist/agent/components/context-picker.d.ts +16 -0
  57. package/dist/agent/components/context-picker.d.ts.map +1 -0
  58. package/dist/agent/components/conversation-panel.d.ts +82 -0
  59. package/dist/agent/components/conversation-panel.d.ts.map +1 -0
  60. package/dist/agent/components/file-attachment-card.d.ts +8 -0
  61. package/dist/agent/components/file-attachment-card.d.ts.map +1 -0
  62. package/dist/agent/components/message-parts.d.ts +13 -0
  63. package/dist/agent/components/message-parts.d.ts.map +1 -0
  64. package/dist/agent/components/message-view.d.ts +58 -0
  65. package/dist/agent/components/message-view.d.ts.map +1 -0
  66. package/dist/agent/components/model-controls.d.ts +20 -0
  67. package/dist/agent/components/model-controls.d.ts.map +1 -0
  68. package/dist/agent/components/model-picker-row.d.ts +8 -0
  69. package/dist/agent/components/model-picker-row.d.ts.map +1 -0
  70. package/dist/agent/components/provider-logo.d.ts +6 -0
  71. package/dist/agent/components/provider-logo.d.ts.map +1 -0
  72. package/dist/agent/components/provider-logos.d.ts +3 -0
  73. package/dist/agent/components/provider-logos.d.ts.map +1 -0
  74. package/dist/agent/components/reasoning-effort-slider.d.ts +11 -0
  75. package/dist/agent/components/reasoning-effort-slider.d.ts.map +1 -0
  76. package/dist/agent/components/sandbox-recovery.d.ts +6 -0
  77. package/dist/agent/components/sandbox-recovery.d.ts.map +1 -0
  78. package/dist/agent/components/transcript.d.ts +36 -0
  79. package/dist/agent/components/transcript.d.ts.map +1 -0
  80. package/dist/agent/components/web-fetch-tool-view.d.ts +5 -0
  81. package/dist/agent/components/web-fetch-tool-view.d.ts.map +1 -0
  82. package/dist/agent/components/web-search-tool-view.d.ts +5 -0
  83. package/dist/agent/components/web-search-tool-view.d.ts.map +1 -0
  84. package/dist/agent/components/web-sources.d.ts +9 -0
  85. package/dist/agent/components/web-sources.d.ts.map +1 -0
  86. package/dist/agent/document-preview/classify.d.ts +4 -0
  87. package/dist/agent/document-preview/classify.d.ts.map +1 -0
  88. package/dist/agent/document-preview/content-policy.d.ts +10 -0
  89. package/dist/agent/document-preview/content-policy.d.ts.map +1 -0
  90. package/dist/agent/document-preview/content.d.ts +26 -0
  91. package/dist/agent/document-preview/content.d.ts.map +1 -0
  92. package/dist/agent/document-preview/delimited.d.ts +19 -0
  93. package/dist/agent/document-preview/delimited.d.ts.map +1 -0
  94. package/dist/agent/document-preview/document-preview-root.d.ts +24 -0
  95. package/dist/agent/document-preview/document-preview-root.d.ts.map +1 -0
  96. package/dist/agent/document-preview/file-size.d.ts +3 -0
  97. package/dist/agent/document-preview/file-size.d.ts.map +1 -0
  98. package/dist/agent/document-preview/html.d.ts +9 -0
  99. package/dist/agent/document-preview/html.d.ts.map +1 -0
  100. package/dist/agent/document-preview/persistence.d.ts +6 -0
  101. package/dist/agent/document-preview/persistence.d.ts.map +1 -0
  102. package/dist/agent/document-preview/presentation.d.ts +3 -0
  103. package/dist/agent/document-preview/presentation.d.ts.map +1 -0
  104. package/dist/agent/document-preview/rendering.d.ts +14 -0
  105. package/dist/agent/document-preview/rendering.d.ts.map +1 -0
  106. package/dist/agent/document-preview/source.d.ts +13 -0
  107. package/dist/agent/document-preview/source.d.ts.map +1 -0
  108. package/dist/agent/document-preview/state.d.ts +27 -0
  109. package/dist/agent/document-preview/state.d.ts.map +1 -0
  110. package/dist/agent/document-preview/types.d.ts +33 -0
  111. package/dist/agent/document-preview/types.d.ts.map +1 -0
  112. package/dist/agent/format.d.ts +12 -0
  113. package/dist/agent/format.d.ts.map +1 -0
  114. package/dist/agent/hooks/use-agent-conversation.d.ts +338 -0
  115. package/dist/agent/hooks/use-agent-conversation.d.ts.map +1 -0
  116. package/dist/agent/hooks/use-thread-stream.d.ts +22 -0
  117. package/dist/agent/hooks/use-thread-stream.d.ts.map +1 -0
  118. package/dist/agent/i18n/en.d.ts +589 -0
  119. package/dist/agent/i18n/en.d.ts.map +1 -0
  120. package/dist/agent/i18n/fr.d.ts +4 -0
  121. package/dist/agent/i18n/fr.d.ts.map +1 -0
  122. package/dist/agent/i18n/index.d.ts +1161 -0
  123. package/dist/agent/i18n/index.d.ts.map +1 -0
  124. package/dist/agent/live-run.d.ts +48 -0
  125. package/dist/agent/live-run.d.ts.map +1 -0
  126. package/dist/agent/model-selection.d.ts +33 -0
  127. package/dist/agent/model-selection.d.ts.map +1 -0
  128. package/dist/agent/object-context-title.d.ts +22 -0
  129. package/dist/agent/object-context-title.d.ts.map +1 -0
  130. package/dist/agent/parts.d.ts +42 -0
  131. package/dist/agent/parts.d.ts.map +1 -0
  132. package/dist/agent/react-router.d.ts +8 -0
  133. package/dist/agent/react-router.d.ts.map +1 -0
  134. package/dist/agent/read/interpret.d.ts +24 -0
  135. package/dist/agent/read/interpret.d.ts.map +1 -0
  136. package/dist/agent/read/read-tool-view.d.ts +5 -0
  137. package/dist/agent/read/read-tool-view.d.ts.map +1 -0
  138. package/dist/agent/requester-settings.d.ts +15 -0
  139. package/dist/agent/requester-settings.d.ts.map +1 -0
  140. package/dist/agent/run-presentation.d.ts +70 -0
  141. package/dist/agent/run-presentation.d.ts.map +1 -0
  142. package/dist/agent/thread-navigation.d.ts +5 -0
  143. package/dist/agent/thread-navigation.d.ts.map +1 -0
  144. package/dist/agent/types.d.ts +22 -0
  145. package/dist/agent/types.d.ts.map +1 -0
  146. package/dist/agent/utils/context-display.d.ts +5 -0
  147. package/dist/agent/utils/context-display.d.ts.map +1 -0
  148. package/dist/agent/utils/context-mention.d.ts +12 -0
  149. package/dist/agent/utils/context-mention.d.ts.map +1 -0
  150. package/dist/agent/utils/web-fetch.d.ts +4 -0
  151. package/dist/agent/utils/web-fetch.d.ts.map +1 -0
  152. package/dist/agent/utils/web-search.d.ts +20 -0
  153. package/dist/agent/utils/web-search.d.ts.map +1 -0
  154. package/dist/agent/view-file/interpret.d.ts +9 -0
  155. package/dist/agent/view-file/interpret.d.ts.map +1 -0
  156. package/dist/agent/view-file/view-file-tool-view.d.ts +9 -0
  157. package/dist/agent/view-file/view-file-tool-view.d.ts.map +1 -0
  158. package/dist/agent/workspace.d.ts +11 -0
  159. package/dist/agent/workspace.d.ts.map +1 -0
  160. package/dist/chunk-3a99tmwg.js +176 -0
  161. package/dist/chunk-3a99tmwg.js.map +10 -0
  162. package/dist/chunk-48pkffj6.js +20 -0
  163. package/dist/chunk-48pkffj6.js.map +10 -0
  164. package/dist/chunk-6n5pdqp0.js +115 -0
  165. package/dist/chunk-6n5pdqp0.js.map +11 -0
  166. package/dist/chunk-j97e06rg.js +10668 -0
  167. package/dist/chunk-j97e06rg.js.map +80 -0
  168. package/dist/chunk-md3p7qdt.js +379 -0
  169. package/dist/chunk-md3p7qdt.js.map +10 -0
  170. package/dist/chunk-shmw3f8t.js +251 -0
  171. package/dist/chunk-shmw3f8t.js.map +10 -0
  172. package/dist/chunk-yvhzn4ye.js +98 -0
  173. package/dist/chunk-yvhzn4ye.js.map +10 -0
  174. package/dist/chunk-zcxrt24m.js +148 -0
  175. package/dist/chunk-zcxrt24m.js.map +10 -0
  176. package/dist/codegen.d.ts +6 -4
  177. package/dist/codegen.d.ts.map +1 -1
  178. package/dist/createCustomApp.d.ts +14 -7
  179. package/dist/createCustomApp.d.ts.map +1 -1
  180. package/dist/index.d.ts +33 -3
  181. package/dist/index.d.ts.map +1 -1
  182. package/dist/index.js +955 -2784
  183. package/dist/index.js.map +14 -13
  184. package/dist/locale-messages.d.ts +103 -0
  185. package/dist/locale-messages.d.ts.map +1 -0
  186. package/dist/locale.d.ts +111 -0
  187. package/dist/locale.d.ts.map +1 -0
  188. package/dist/locale.js +15 -0
  189. package/dist/{auth.js.map → locale.js.map} +1 -1
  190. package/dist/metadata.d.ts.map +1 -1
  191. package/dist/pages/data/connectors.d.ts +5 -0
  192. package/dist/pages/data/connectors.d.ts.map +1 -0
  193. package/dist/pages/data/datasets.d.ts +30 -0
  194. package/dist/pages/data/datasets.d.ts.map +1 -0
  195. package/dist/pages/data/live-updates.d.ts +13 -0
  196. package/dist/pages/data/live-updates.d.ts.map +1 -0
  197. package/dist/pages/data/messages.d.ts +354 -0
  198. package/dist/pages/data/messages.d.ts.map +1 -0
  199. package/dist/pages/data/pipeline-canvas.d.ts +34 -0
  200. package/dist/pages/data/pipeline-canvas.d.ts.map +1 -0
  201. package/dist/pages/data/pipelines.d.ts +9 -0
  202. package/dist/pages/data/pipelines.d.ts.map +1 -0
  203. package/dist/pages/data/projections.d.ts +10 -0
  204. package/dist/pages/data/projections.d.ts.map +1 -0
  205. package/dist/pages/data/schema.d.ts +20 -0
  206. package/dist/pages/data/schema.d.ts.map +1 -0
  207. package/dist/pages/data/shared.d.ts +13 -0
  208. package/dist/pages/data/shared.d.ts.map +1 -0
  209. package/dist/pages/data/sync-button.d.ts +15 -0
  210. package/dist/pages/data/sync-button.d.ts.map +1 -0
  211. package/dist/pages/data/syncs.d.ts +5 -0
  212. package/dist/pages/data/syncs.d.ts.map +1 -0
  213. package/dist/pages/home.d.ts +6 -0
  214. package/dist/pages/home.d.ts.map +1 -0
  215. package/dist/pages/mosaic.d.ts +5 -0
  216. package/dist/pages/mosaic.d.ts.map +1 -0
  217. package/dist/pages/observability/action-run.d.ts +19 -0
  218. package/dist/pages/observability/action-run.d.ts.map +1 -0
  219. package/dist/pages/observability/ai-usage/calls.d.ts +27 -0
  220. package/dist/pages/observability/ai-usage/calls.d.ts.map +1 -0
  221. package/dist/pages/observability/ai-usage/charts.d.ts +23 -0
  222. package/dist/pages/observability/ai-usage/charts.d.ts.map +1 -0
  223. package/dist/pages/observability/ai-usage/format.d.ts +101 -0
  224. package/dist/pages/observability/ai-usage/format.d.ts.map +1 -0
  225. package/dist/pages/observability/ai-usage/limits.d.ts +12 -0
  226. package/dist/pages/observability/ai-usage/limits.d.ts.map +1 -0
  227. package/dist/pages/observability/ai-usage/messages.d.ts +431 -0
  228. package/dist/pages/observability/ai-usage/messages.d.ts.map +1 -0
  229. package/dist/pages/observability/ai-usage/page.d.ts +6 -0
  230. package/dist/pages/observability/ai-usage/page.d.ts.map +1 -0
  231. package/dist/pages/observability/live-updates.d.ts +3 -0
  232. package/dist/pages/observability/live-updates.d.ts.map +1 -0
  233. package/dist/pages/observability/logs.d.ts +11 -0
  234. package/dist/pages/observability/logs.d.ts.map +1 -0
  235. package/dist/pages/observability/messages.d.ts +329 -0
  236. package/dist/pages/observability/messages.d.ts.map +1 -0
  237. package/dist/pages/observability/runs.d.ts +7 -0
  238. package/dist/pages/observability/runs.d.ts.map +1 -0
  239. package/dist/pages/observability/workflow-run.d.ts +6 -0
  240. package/dist/pages/observability/workflow-run.d.ts.map +1 -0
  241. package/dist/pages/ontology/actions.d.ts +3 -0
  242. package/dist/pages/ontology/actions.d.ts.map +1 -0
  243. package/dist/pages/ontology/components/action-button.d.ts +12 -0
  244. package/dist/pages/ontology/components/action-button.d.ts.map +1 -0
  245. package/dist/pages/ontology/components/action-param-null-control.d.ts +7 -0
  246. package/dist/pages/ontology/components/action-param-null-control.d.ts.map +1 -0
  247. package/dist/pages/ontology/components/collection-toolbar.d.ts +21 -0
  248. package/dist/pages/ontology/components/collection-toolbar.d.ts.map +1 -0
  249. package/dist/pages/ontology/components/common.d.ts +16 -0
  250. package/dist/pages/ontology/components/common.d.ts.map +1 -0
  251. package/dist/pages/ontology/components/file-ref-upload-field.d.ts +13 -0
  252. package/dist/pages/ontology/components/file-ref-upload-field.d.ts.map +1 -0
  253. package/dist/pages/ontology/components/object-filter-popover.d.ts +9 -0
  254. package/dist/pages/ontology/components/object-filter-popover.d.ts.map +1 -0
  255. package/dist/pages/ontology/components/object-icon.d.ts +7 -0
  256. package/dist/pages/ontology/components/object-icon.d.ts.map +1 -0
  257. package/dist/pages/ontology/components/object-query-bar.d.ts +21 -0
  258. package/dist/pages/ontology/components/object-query-bar.d.ts.map +1 -0
  259. package/dist/pages/ontology/components/telemetry-chart.d.ts +18 -0
  260. package/dist/pages/ontology/components/telemetry-chart.d.ts.map +1 -0
  261. package/dist/pages/ontology/components/telemetry-grid.d.ts +19 -0
  262. package/dist/pages/ontology/components/telemetry-grid.d.ts.map +1 -0
  263. package/dist/pages/ontology/components/telemetry-tile.d.ts +18 -0
  264. package/dist/pages/ontology/components/telemetry-tile.d.ts.map +1 -0
  265. package/dist/pages/ontology/components/telemetry-value.d.ts +10 -0
  266. package/dist/pages/ontology/components/telemetry-value.d.ts.map +1 -0
  267. package/dist/pages/ontology/components/usage-bar.d.ts +12 -0
  268. package/dist/pages/ontology/components/usage-bar.d.ts.map +1 -0
  269. package/dist/pages/ontology/graph.d.ts +6 -0
  270. package/dist/pages/ontology/graph.d.ts.map +1 -0
  271. package/dist/pages/ontology/hooks/object-live-updates.d.ts +5 -0
  272. package/dist/pages/ontology/hooks/object-live-updates.d.ts.map +1 -0
  273. package/dist/pages/ontology/hooks/object-telemetry-updates.d.ts +8 -0
  274. package/dist/pages/ontology/hooks/object-telemetry-updates.d.ts.map +1 -0
  275. package/dist/pages/ontology/hooks/object-type-counts.d.ts +5 -0
  276. package/dist/pages/ontology/hooks/object-type-counts.d.ts.map +1 -0
  277. package/dist/pages/ontology/hooks/rule-live-updates.d.ts +9 -0
  278. package/dist/pages/ontology/hooks/rule-live-updates.d.ts.map +1 -0
  279. package/dist/pages/ontology/hooks/workflow-live-updates.d.ts +6 -0
  280. package/dist/pages/ontology/hooks/workflow-live-updates.d.ts.map +1 -0
  281. package/dist/pages/ontology/lib/action-params.d.ts +55 -0
  282. package/dist/pages/ontology/lib/action-params.d.ts.map +1 -0
  283. package/dist/pages/ontology/lib/format-value.d.ts +3 -0
  284. package/dist/pages/ontology/lib/format-value.d.ts.map +1 -0
  285. package/dist/pages/ontology/lib/labels.d.ts +3 -0
  286. package/dist/pages/ontology/lib/labels.d.ts.map +1 -0
  287. package/dist/pages/ontology/lib/live-update-keys.d.ts +15 -0
  288. package/dist/pages/ontology/lib/live-update-keys.d.ts.map +1 -0
  289. package/dist/pages/ontology/lib/object-query.d.ts +72 -0
  290. package/dist/pages/ontology/lib/object-query.d.ts.map +1 -0
  291. package/dist/pages/ontology/lib/ontology-graph-layout.d.ts +68 -0
  292. package/dist/pages/ontology/lib/ontology-graph-layout.d.ts.map +1 -0
  293. package/dist/pages/ontology/lib/ontology-graph-links.d.ts +4 -0
  294. package/dist/pages/ontology/lib/ontology-graph-links.d.ts.map +1 -0
  295. package/dist/pages/ontology/lib/telemetry-history.d.ts +10 -0
  296. package/dist/pages/ontology/lib/telemetry-history.d.ts.map +1 -0
  297. package/dist/pages/ontology/lib/time.d.ts +3 -0
  298. package/dist/pages/ontology/lib/time.d.ts.map +1 -0
  299. package/dist/pages/ontology/lib/user-preferences.d.ts +8 -0
  300. package/dist/pages/ontology/lib/user-preferences.d.ts.map +1 -0
  301. package/dist/pages/ontology/object-page.d.ts +7 -0
  302. package/dist/pages/ontology/object-page.d.ts.map +1 -0
  303. package/dist/pages/ontology/object-type.d.ts +3 -0
  304. package/dist/pages/ontology/object-type.d.ts.map +1 -0
  305. package/dist/pages/ontology/object-types.d.ts +7 -0
  306. package/dist/pages/ontology/object-types.d.ts.map +1 -0
  307. package/dist/pages/ontology/objects.d.ts +6 -0
  308. package/dist/pages/ontology/objects.d.ts.map +1 -0
  309. package/dist/pages/ontology/rules.d.ts +32 -0
  310. package/dist/pages/ontology/rules.d.ts.map +1 -0
  311. package/dist/pages/ontology/workflow.d.ts +6 -0
  312. package/dist/pages/ontology/workflow.d.ts.map +1 -0
  313. package/dist/pages/ontology/workflows/agent-execution-panel.d.ts +17 -0
  314. package/dist/pages/ontology/workflows/agent-execution-panel.d.ts.map +1 -0
  315. package/dist/pages/ontology/workflows/intervention-panel.d.ts +5 -0
  316. package/dist/pages/ontology/workflows/intervention-panel.d.ts.map +1 -0
  317. package/dist/pages/ontology/workflows/node-execution-panel.d.ts +11 -0
  318. package/dist/pages/ontology/workflows/node-execution-panel.d.ts.map +1 -0
  319. package/dist/pages/ontology/workflows/request-run-dialog.d.ts +5 -0
  320. package/dist/pages/ontology/workflows/request-run-dialog.d.ts.map +1 -0
  321. package/dist/pages/ontology/workflows/run-debug-section.d.ts +11 -0
  322. package/dist/pages/ontology/workflows/run-debug-section.d.ts.map +1 -0
  323. package/dist/pages/ontology/workflows/run-input-form.d.ts +18 -0
  324. package/dist/pages/ontology/workflows/run-input-form.d.ts.map +1 -0
  325. package/dist/pages/ontology/workflows/run-progress.d.ts +15 -0
  326. package/dist/pages/ontology/workflows/run-progress.d.ts.map +1 -0
  327. package/dist/pages/ontology/workflows/schema-shape.d.ts +10 -0
  328. package/dist/pages/ontology/workflows/schema-shape.d.ts.map +1 -0
  329. package/dist/pages/ontology/workflows/status-badge.d.ts +5 -0
  330. package/dist/pages/ontology/workflows/status-badge.d.ts.map +1 -0
  331. package/dist/pages/ontology/workflows/utils.d.ts +29 -0
  332. package/dist/pages/ontology/workflows/utils.d.ts.map +1 -0
  333. package/dist/pages/ontology/workflows/workflow-card.d.ts +5 -0
  334. package/dist/pages/ontology/workflows/workflow-card.d.ts.map +1 -0
  335. package/dist/pages/ontology/workflows.d.ts +3 -0
  336. package/dist/pages/ontology/workflows.d.ts.map +1 -0
  337. package/dist/pages/routes.d.ts +19 -0
  338. package/dist/pages/routes.d.ts.map +1 -0
  339. package/dist/pages/section-page.d.ts +91 -0
  340. package/dist/pages/section-page.d.ts.map +1 -0
  341. package/dist/pages/section-ui.d.ts +211 -0
  342. package/dist/pages/section-ui.d.ts.map +1 -0
  343. package/dist/pages/settings/controls.d.ts +94 -0
  344. package/dist/pages/settings/controls.d.ts.map +1 -0
  345. package/dist/pages/settings/developers.d.ts +3 -0
  346. package/dist/pages/settings/developers.d.ts.map +1 -0
  347. package/dist/pages/settings/members.d.ts +3 -0
  348. package/dist/pages/settings/members.d.ts.map +1 -0
  349. package/dist/pages/settings/messages.d.ts +538 -0
  350. package/dist/pages/settings/messages.d.ts.map +1 -0
  351. package/dist/pages/settings/personal.d.ts +6 -0
  352. package/dist/pages/settings/personal.d.ts.map +1 -0
  353. package/dist/pages/settings/service-accounts.d.ts +3 -0
  354. package/dist/pages/settings/service-accounts.d.ts.map +1 -0
  355. package/dist/pages/settings/sessions.d.ts +3 -0
  356. package/dist/pages/settings/sessions.d.ts.map +1 -0
  357. package/dist/pages/values.d.ts +77 -0
  358. package/dist/pages/values.d.ts.map +1 -0
  359. package/dist/pages.d.ts +42 -0
  360. package/dist/pages.d.ts.map +1 -0
  361. package/dist/pages.js +23931 -0
  362. package/dist/pages.js.map +85 -0
  363. package/dist/runtime.d.ts +0 -2
  364. package/dist/runtime.d.ts.map +1 -1
  365. package/dist/sections/catalog.d.ts +37 -0
  366. package/dist/sections/catalog.d.ts.map +1 -0
  367. package/dist/sections/counts.d.ts +7 -0
  368. package/dist/sections/counts.d.ts.map +1 -0
  369. package/dist/sections/sections.d.ts +67 -0
  370. package/dist/sections/sections.d.ts.map +1 -0
  371. package/dist/server.d.ts +8 -0
  372. package/dist/server.d.ts.map +1 -0
  373. package/dist/server.js +2983 -0
  374. package/dist/server.js.map +19 -0
  375. package/dist/session.d.ts +18 -0
  376. package/dist/session.d.ts.map +1 -0
  377. package/dist/shell/agent-dock.d.ts +7 -0
  378. package/dist/shell/agent-dock.d.ts.map +1 -0
  379. package/dist/shell/app-shell.d.ts +42 -0
  380. package/dist/shell/app-shell.d.ts.map +1 -0
  381. package/dist/shell/brand.d.ts +15 -0
  382. package/dist/shell/brand.d.ts.map +1 -0
  383. package/dist/shell/nav-items.d.ts +34 -0
  384. package/dist/shell/nav-items.d.ts.map +1 -0
  385. package/dist/shell/search-command.d.ts +12 -0
  386. package/dist/shell/search-command.d.ts.map +1 -0
  387. package/dist/shell/section-nav.d.ts +13 -0
  388. package/dist/shell/section-nav.d.ts.map +1 -0
  389. package/dist/shell/user-menu.d.ts +25 -0
  390. package/dist/shell/user-menu.d.ts.map +1 -0
  391. package/dist/tailwind.d.ts +4 -4
  392. package/dist/tailwind.d.ts.map +1 -1
  393. package/package.json +29 -20
  394. package/src/agent/activity-label.ts +63 -0
  395. package/src/agent/agent-chat.tsx +237 -0
  396. package/src/agent/agent-context-provider.tsx +92 -0
  397. package/src/agent/agent-execution-trace.tsx +316 -0
  398. package/src/agent/agent-panel.tsx +79 -0
  399. package/src/agent/agent-surface-state.ts +113 -0
  400. package/src/agent/agent-surface.tsx +363 -0
  401. package/src/agent/agent.css +231 -0
  402. package/src/agent/bash/bash-tool-view.tsx +288 -0
  403. package/src/agent/bash/data.ts +137 -0
  404. package/src/agent/bash/interpret.ts +769 -0
  405. package/src/agent/bash/renderers.tsx +503 -0
  406. package/src/agent/bash/shell.ts +195 -0
  407. package/src/agent/components/activity-status.tsx +86 -0
  408. package/src/agent/components/agent-thread-switcher.tsx +346 -0
  409. package/src/agent/components/composer.tsx +870 -0
  410. package/src/agent/components/context-chips.tsx +63 -0
  411. package/src/agent/components/context-picker.tsx +88 -0
  412. package/src/agent/components/conversation-panel.tsx +352 -0
  413. package/src/agent/components/file-attachment-card.tsx +137 -0
  414. package/src/agent/components/message-parts.tsx +280 -0
  415. package/src/agent/components/message-view.tsx +428 -0
  416. package/src/agent/components/model-controls.tsx +204 -0
  417. package/src/agent/components/model-picker-row.tsx +136 -0
  418. package/src/agent/components/provider-logo.tsx +31 -0
  419. package/src/agent/components/provider-logos.ts +24 -0
  420. package/src/agent/components/reasoning-effort-slider.tsx +121 -0
  421. package/src/agent/components/sandbox-recovery.tsx +49 -0
  422. package/src/agent/components/transcript.tsx +239 -0
  423. package/src/agent/components/web-fetch-tool-view.tsx +69 -0
  424. package/src/agent/components/web-search-tool-view.tsx +37 -0
  425. package/src/agent/components/web-sources.tsx +159 -0
  426. package/src/agent/document-preview/classify.ts +55 -0
  427. package/src/agent/document-preview/content-policy.ts +37 -0
  428. package/src/agent/document-preview/content.ts +82 -0
  429. package/src/agent/document-preview/delimited.ts +118 -0
  430. package/src/agent/document-preview/document-preview-root.tsx +1017 -0
  431. package/src/agent/document-preview/file-size.ts +26 -0
  432. package/src/agent/document-preview/html.ts +67 -0
  433. package/src/agent/document-preview/persistence.ts +115 -0
  434. package/src/agent/document-preview/presentation.ts +13 -0
  435. package/src/agent/document-preview/rendering.ts +48 -0
  436. package/src/agent/document-preview/source.ts +48 -0
  437. package/src/agent/document-preview/state.ts +77 -0
  438. package/src/agent/document-preview/types.ts +36 -0
  439. package/src/agent/format.ts +60 -0
  440. package/src/agent/hooks/use-agent-conversation.ts +536 -0
  441. package/src/agent/hooks/use-thread-stream.ts +121 -0
  442. package/src/agent/i18n/en.ts +542 -0
  443. package/src/agent/i18n/fr.ts +574 -0
  444. package/src/agent/i18n/index.ts +14 -0
  445. package/src/agent/live-run.ts +257 -0
  446. package/src/agent/model-selection.ts +88 -0
  447. package/src/agent/object-context-title.ts +57 -0
  448. package/src/agent/parts.ts +119 -0
  449. package/src/agent/react-router.tsx +84 -0
  450. package/src/agent/read/interpret.ts +101 -0
  451. package/src/agent/read/read-tool-view.tsx +92 -0
  452. package/src/agent/requester-settings.ts +55 -0
  453. package/src/agent/run-presentation.ts +211 -0
  454. package/src/agent/thread-navigation.ts +11 -0
  455. package/src/agent/types.ts +37 -0
  456. package/src/agent/utils/context-display.ts +72 -0
  457. package/src/agent/utils/context-mention.ts +28 -0
  458. package/src/agent/utils/web-fetch.ts +20 -0
  459. package/src/agent/utils/web-search.ts +106 -0
  460. package/src/agent/view-file/interpret.ts +22 -0
  461. package/src/agent/view-file/view-file-tool-view.tsx +120 -0
  462. package/src/{agents.ts → agent/workspace.ts} +4 -19
  463. package/src/codegen.ts +187 -103
  464. package/src/createCustomApp.ts +155 -67
  465. package/src/index.ts +52 -16
  466. package/src/locale-messages.ts +181 -0
  467. package/src/locale.ts +23 -0
  468. package/src/metadata.ts +35 -1
  469. package/src/pages/canvas.css +43 -0
  470. package/src/pages/data/connectors.tsx +317 -0
  471. package/src/pages/data/datasets.tsx +731 -0
  472. package/src/pages/data/live-updates.ts +71 -0
  473. package/src/pages/data/messages.ts +349 -0
  474. package/src/pages/data/pipeline-canvas.tsx +288 -0
  475. package/src/pages/data/pipelines.tsx +710 -0
  476. package/src/pages/data/projections.tsx +482 -0
  477. package/src/pages/data/schema.tsx +62 -0
  478. package/src/pages/data/shared.tsx +78 -0
  479. package/src/pages/data/sync-button.tsx +103 -0
  480. package/src/pages/data/syncs.tsx +326 -0
  481. package/src/pages/home.tsx +64 -0
  482. package/src/pages/mosaic.tsx +97 -0
  483. package/src/pages/observability/action-run.tsx +229 -0
  484. package/src/pages/observability/ai-usage/calls.tsx +541 -0
  485. package/src/pages/observability/ai-usage/charts.tsx +126 -0
  486. package/src/pages/observability/ai-usage/format.ts +276 -0
  487. package/src/pages/observability/ai-usage/limits.tsx +629 -0
  488. package/src/pages/observability/ai-usage/messages.ts +446 -0
  489. package/src/pages/observability/ai-usage/page.tsx +814 -0
  490. package/src/pages/observability/live-updates.ts +19 -0
  491. package/src/pages/observability/logs.tsx +617 -0
  492. package/src/pages/observability/messages.ts +336 -0
  493. package/src/pages/observability/runs.tsx +732 -0
  494. package/src/pages/observability/workflow-run.tsx +323 -0
  495. package/src/pages/ontology/actions.tsx +749 -0
  496. package/src/pages/ontology/components/action-button.tsx +355 -0
  497. package/src/pages/ontology/components/action-param-null-control.tsx +35 -0
  498. package/src/pages/ontology/components/collection-toolbar.tsx +61 -0
  499. package/src/pages/ontology/components/common.tsx +60 -0
  500. package/src/pages/ontology/components/file-ref-upload-field.tsx +279 -0
  501. package/src/pages/ontology/components/object-filter-popover.tsx +311 -0
  502. package/src/pages/ontology/components/object-icon.tsx +133 -0
  503. package/src/pages/ontology/components/object-query-bar.tsx +217 -0
  504. package/src/pages/ontology/components/telemetry-chart.tsx +392 -0
  505. package/src/pages/ontology/components/telemetry-grid.tsx +137 -0
  506. package/src/pages/ontology/components/telemetry-tile.tsx +164 -0
  507. package/src/pages/ontology/components/telemetry-value.tsx +91 -0
  508. package/src/pages/ontology/components/usage-bar.tsx +64 -0
  509. package/src/pages/ontology/graph.tsx +1283 -0
  510. package/src/pages/ontology/hooks/object-live-updates.ts +53 -0
  511. package/src/pages/ontology/hooks/object-telemetry-updates.ts +45 -0
  512. package/src/pages/ontology/hooks/object-type-counts.ts +27 -0
  513. package/src/pages/ontology/hooks/rule-live-updates.ts +28 -0
  514. package/src/pages/ontology/hooks/workflow-live-updates.ts +20 -0
  515. package/src/pages/ontology/lib/action-params.ts +231 -0
  516. package/src/pages/ontology/lib/format-value.ts +34 -0
  517. package/src/pages/ontology/lib/labels.ts +50 -0
  518. package/src/pages/ontology/lib/live-update-keys.ts +62 -0
  519. package/src/pages/ontology/lib/object-query.ts +372 -0
  520. package/src/pages/ontology/lib/ontology-graph-layout.ts +1004 -0
  521. package/src/pages/ontology/lib/ontology-graph-links.ts +15 -0
  522. package/src/pages/ontology/lib/telemetry-history.ts +56 -0
  523. package/src/pages/ontology/lib/time.ts +23 -0
  524. package/src/pages/ontology/lib/user-preferences.ts +52 -0
  525. package/src/pages/ontology/object-page.tsx +1029 -0
  526. package/src/pages/ontology/object-type.tsx +910 -0
  527. package/src/pages/ontology/object-types.tsx +240 -0
  528. package/src/pages/ontology/objects.tsx +938 -0
  529. package/src/pages/ontology/rules.tsx +805 -0
  530. package/src/pages/ontology/workflow.tsx +1485 -0
  531. package/src/pages/ontology/workflows/agent-execution-panel.tsx +340 -0
  532. package/src/pages/ontology/workflows/intervention-panel.tsx +261 -0
  533. package/src/pages/ontology/workflows/node-execution-panel.tsx +86 -0
  534. package/src/pages/ontology/workflows/request-run-dialog.tsx +197 -0
  535. package/src/pages/ontology/workflows/run-debug-section.tsx +54 -0
  536. package/src/pages/ontology/workflows/run-input-form.tsx +900 -0
  537. package/src/pages/ontology/workflows/run-progress.tsx +83 -0
  538. package/src/pages/ontology/workflows/schema-shape.tsx +206 -0
  539. package/src/pages/ontology/workflows/status-badge.tsx +15 -0
  540. package/src/pages/ontology/workflows/utils.ts +107 -0
  541. package/src/pages/ontology/workflows/workflow-card.tsx +48 -0
  542. package/src/pages/ontology/workflows.tsx +143 -0
  543. package/src/pages/routes.ts +48 -0
  544. package/src/pages/section-page.tsx +272 -0
  545. package/src/pages/section-ui.tsx +771 -0
  546. package/src/pages/settings/controls.tsx +721 -0
  547. package/src/pages/settings/developers.tsx +163 -0
  548. package/src/pages/settings/members.tsx +1018 -0
  549. package/src/pages/settings/messages.ts +551 -0
  550. package/src/pages/settings/personal.tsx +97 -0
  551. package/src/pages/settings/service-accounts.tsx +623 -0
  552. package/src/pages/settings/sessions.tsx +183 -0
  553. package/src/pages/values.tsx +700 -0
  554. package/src/pages.ts +56 -0
  555. package/src/runtime.ts +0 -3
  556. package/src/sections/catalog.ts +181 -0
  557. package/src/sections/counts.ts +33 -0
  558. package/src/sections/sections.tsx +257 -0
  559. package/src/server.ts +19 -0
  560. package/src/session.ts +29 -0
  561. package/src/shell/agent-dock.tsx +32 -0
  562. package/src/shell/app-shell.tsx +142 -0
  563. package/src/shell/brand.tsx +47 -0
  564. package/src/shell/nav-items.tsx +136 -0
  565. package/src/shell/search-command.tsx +158 -0
  566. package/src/shell/section-nav.tsx +61 -0
  567. package/src/shell/user-menu.tsx +206 -0
  568. package/src/tailwind.ts +4 -4
  569. package/dist/agents.d.ts +0 -11
  570. package/dist/agents.d.ts.map +0 -1
  571. package/dist/agents.js +0 -41
  572. package/dist/agents.js.map +0 -10
  573. package/dist/auth.js +0 -3
  574. package/dist/browser.d.ts +0 -3
  575. package/dist/browser.d.ts.map +0 -1
  576. package/dist/browser.js +0 -9
  577. package/dist/browser.js.map +0 -9
  578. package/dist/chunk-e1gj8c1a.js +0 -8
  579. package/dist/chunk-e1gj8c1a.js.map +0 -10
  580. package/src/browser.ts +0 -2
@@ -0,0 +1,1485 @@
1
+ import {
2
+ getWorkflowAgentNodeExecutionOptions,
3
+ getWorkflowOptions,
4
+ getWorkflowRunOptions,
5
+ listWorkflowRunsOptions,
6
+ } from "@sixb/client/hooks"
7
+ import { Badge, Button } from "@sixb/ui/components"
8
+ import { cn } from "@sixb/ui/lib/utils"
9
+ import { useQuery } from "@tanstack/react-query"
10
+ import {
11
+ Background,
12
+ BackgroundVariant,
13
+ Controls,
14
+ Handle,
15
+ type Node,
16
+ type NodeProps,
17
+ type NodeTypes,
18
+ Position,
19
+ ReactFlow,
20
+ ReactFlowProvider,
21
+ useEdgesState,
22
+ useNodesState,
23
+ useReactFlow,
24
+ type Edge as XYEdge,
25
+ } from "@xyflow/react"
26
+ import {
27
+ ArrowDownToLine,
28
+ ArrowUpFromLine,
29
+ Bot,
30
+ Box,
31
+ CalendarClock,
32
+ ChevronLeft,
33
+ Crosshair,
34
+ GitBranch,
35
+ History,
36
+ Loader2,
37
+ Play,
38
+ SlidersHorizontal,
39
+ UserCheck,
40
+ Webhook,
41
+ Workflow,
42
+ X,
43
+ Zap,
44
+ } from "lucide-react"
45
+ import { type ReactNode, useEffect, useMemo } from "react"
46
+ import { Navigate, useNavigate, useParams, useSearchParams } from "react-router-dom"
47
+ import { DetailFallback, SectionWorkspace } from "../section-page"
48
+ import {
49
+ CopyButton,
50
+ FailureSummary,
51
+ isUnrecorded,
52
+ RunStatusPill,
53
+ UnrecordedHistory,
54
+ } from "../section-ui"
55
+ import {
56
+ fieldRecordSchema,
57
+ useValueTypes,
58
+ type ValueSchema,
59
+ ValueTree,
60
+ type ValueTypeSchemas,
61
+ valueSchema,
62
+ workflowRunFileLinks,
63
+ workflowStepFileLinks,
64
+ } from "../values"
65
+ import { useWorkflowLiveUpdates } from "./hooks/workflow-live-updates"
66
+ import { formatRelativeTime } from "./lib/time"
67
+ import { AgentExecutionPanel } from "./workflows/agent-execution-panel"
68
+ import { WorkflowInterventionPanel } from "./workflows/intervention-panel"
69
+ import { WorkflowNodeExecutionPanel } from "./workflows/node-execution-panel"
70
+ import { RequestWorkflowRunDialog } from "./workflows/request-run-dialog"
71
+ import { RunProgress } from "./workflows/run-progress"
72
+ import { SchemaShape } from "./workflows/schema-shape"
73
+ import { WorkflowRunStatusIcon } from "./workflows/status-badge"
74
+ import {
75
+ formatDate,
76
+ formatNodeDuration,
77
+ formatRunDuration,
78
+ formatRunStartedDate,
79
+ isActiveRunStatus,
80
+ runTimeLabel,
81
+ type WorkflowDetail,
82
+ type WorkflowNode,
83
+ type WorkflowNodeStatus,
84
+ type WorkflowRunDetail,
85
+ type WorkflowRunNode,
86
+ type WorkflowRunStatus,
87
+ workflowNodeIoSchemas,
88
+ workflowSchemas,
89
+ } from "./workflows/utils"
90
+
91
+ type WorkflowTrigger = WorkflowDetail["triggers"][number]
92
+
93
+ // --------------------------------------------------------------------------
94
+ // Page
95
+ // --------------------------------------------------------------------------
96
+
97
+ /**
98
+ * One workflow as a canvas of its steps. A run selected from Runs overlays each step's status; a
99
+ * step opens its definition, or for a run what it read and wrote, and answers a waiting one.
100
+ */
101
+ export function OntologyWorkflowPage() {
102
+ const { workflowId = "" } = useParams()
103
+ const navigate = useNavigate()
104
+ const [searchParams, setSearchParams] = useSearchParams()
105
+
106
+ // Panel state lives in the URL so runs are deep-linkable and the browser's
107
+ // back/forward buttons move between views.
108
+ const activeRunId = searchParams.get("run")
109
+ const selectedNodeId = searchParams.get("node")
110
+ const runsListOpen = searchParams.get("tab") === "runs"
111
+
112
+ useWorkflowLiveUpdates({ workflowId, enabled: workflowId.length > 0 })
113
+
114
+ const workflowQuery = useQuery({
115
+ ...getWorkflowOptions({ path: { workflowId } }),
116
+ enabled: workflowId.length > 0,
117
+ retry: false,
118
+ })
119
+
120
+ const runQuery = useQuery({
121
+ ...getWorkflowRunOptions({ path: { runId: activeRunId ?? "" } }),
122
+ enabled: activeRunId !== null,
123
+ })
124
+ const runDetail = activeRunId ? runQuery.data : undefined
125
+ useWorkflowLiveUpdates({
126
+ runId: activeRunId ?? undefined,
127
+ enabled: activeRunId !== null && (runDetail ? isActiveRunStatus(runDetail.run.status) : true),
128
+ })
129
+
130
+ const declaredSchemas = useMemo(
131
+ () => (workflowQuery.data ? workflowSchemas(workflowQuery.data) : []),
132
+ [workflowQuery.data]
133
+ )
134
+ const valueTypes = useValueTypes(declaredSchemas)
135
+
136
+ const runNodesByFlowId = useMemo(() => {
137
+ const map = new Map<string, WorkflowRunNode>()
138
+ for (const node of runDetail?.nodes ?? []) {
139
+ map.set(`node:${node.nodeId}`, node)
140
+ }
141
+ return map
142
+ }, [runDetail])
143
+
144
+ const runStatusByFlowId = useMemo(() => {
145
+ if (!runDetail) return null
146
+ const map = new Map<string, WorkflowNodeStatus>()
147
+ for (const [id, node] of runNodesByFlowId) {
148
+ map.set(id, node.status)
149
+ }
150
+ return map
151
+ }, [runDetail, runNodesByFlowId])
152
+
153
+ if (!workflowId) {
154
+ return <Navigate to="/ontology/workflows" replace />
155
+ }
156
+
157
+ if (!workflowQuery.data) {
158
+ return (
159
+ <DetailFallback
160
+ section="ontology"
161
+ page="workflows"
162
+ back={{ href: "/ontology/workflows", label: "Workflows" }}
163
+ name={workflowId}
164
+ id={workflowId}
165
+ icon={GitBranch}
166
+ error={workflowQuery.error}
167
+ />
168
+ )
169
+ }
170
+
171
+ const workflow = workflowQuery.data
172
+ const latestRun = workflow.latestRun
173
+
174
+ const updateParams = (mutate: (params: URLSearchParams) => void) => {
175
+ setSearchParams(
176
+ (prev) => {
177
+ const next = new URLSearchParams(prev)
178
+ mutate(next)
179
+ return next
180
+ },
181
+ { replace: false }
182
+ )
183
+ }
184
+
185
+ const closeAll = () =>
186
+ updateParams((p) => {
187
+ p.delete("run")
188
+ p.delete("node")
189
+ p.delete("tab")
190
+ })
191
+ const selectRun = (runId: string) =>
192
+ updateParams((p) => {
193
+ p.set("run", runId)
194
+ p.delete("node")
195
+ p.delete("tab")
196
+ })
197
+ const backToRunsList = () =>
198
+ updateParams((p) => {
199
+ p.delete("run")
200
+ p.delete("node")
201
+ p.set("tab", "runs")
202
+ })
203
+ const toggleRunsList = () =>
204
+ updateParams((p) => {
205
+ p.delete("node")
206
+ if (p.get("run")) {
207
+ p.delete("run")
208
+ p.set("tab", "runs")
209
+ return
210
+ }
211
+ if (p.get("tab") === "runs") p.delete("tab")
212
+ else p.set("tab", "runs")
213
+ })
214
+ const handleSelect = (id: string | null) =>
215
+ updateParams((p) => {
216
+ p.delete("tab")
217
+ if (id === null || p.get("node") === id) p.delete("node")
218
+ else p.set("node", id)
219
+ })
220
+ const closeNode = () => updateParams((p) => p.delete("node"))
221
+ const closeRunsList = () => updateParams((p) => p.delete("tab"))
222
+
223
+ const panelContent = renderPanel({
224
+ workflow,
225
+ valueTypes,
226
+ activeRunId,
227
+ runQuery: { isLoading: runQuery.isLoading, isError: runQuery.isError, data: runDetail },
228
+ runNodesByFlowId,
229
+ selectedNodeId,
230
+ runsListOpen,
231
+ onSelectRun: selectRun,
232
+ onBackToRuns: backToRunsList,
233
+ onClose: closeAll,
234
+ onCloseNode: closeNode,
235
+ onCloseRunsList: closeRunsList,
236
+ })
237
+ const panelOpen = panelContent !== null
238
+ const runsActive = runsListOpen || activeRunId !== null
239
+
240
+ return (
241
+ <SectionWorkspace section="ontology" page="workflows">
242
+ <div className="flex min-h-0 w-full flex-1 overflow-hidden">
243
+ <ReactFlowProvider>
244
+ <div className="relative min-w-0 flex-1">
245
+ <WorkflowCanvas
246
+ workflow={workflow}
247
+ selectedNodeId={selectedNodeId}
248
+ runStatusByFlowId={runStatusByFlowId}
249
+ onSelect={handleSelect}
250
+ panelOpen={panelOpen}
251
+ />
252
+
253
+ {/* Floating header */}
254
+ <div className="pointer-events-none absolute left-4 right-4 top-4 z-10 flex flex-wrap items-start justify-between gap-3">
255
+ <div className="pointer-events-auto min-w-0 max-w-full overflow-hidden rounded-lg border border-border bg-card shadow-sm">
256
+ <div className="flex items-center gap-3 px-3 py-2">
257
+ <Button
258
+ type="button"
259
+ variant="ghost"
260
+ size="icon-sm"
261
+ onClick={() => navigate("/ontology/workflows")}
262
+ aria-label="Back to workflows"
263
+ >
264
+ <ChevronLeft />
265
+ </Button>
266
+ <div className="min-w-0">
267
+ <p className="text-[10px] font-semibold uppercase tracking-wider text-muted-foreground">
268
+ Workflow
269
+ </p>
270
+ <h1 className="truncate text-sm font-medium text-foreground">{workflow.id}</h1>
271
+ </div>
272
+ </div>
273
+ <div className="flex flex-wrap items-center gap-x-3 gap-y-1 border-t border-border bg-background/30 px-3 py-1.5 text-[11px] text-muted-foreground">
274
+ {activeRunId && runDetail ? (
275
+ <>
276
+ <span className="inline-flex items-center gap-1.5 text-foreground">
277
+ <span
278
+ className={cn(
279
+ "h-1.5 w-1.5 rounded-full",
280
+ STATUS_DOT[runDetail.run.status]
281
+ )}
282
+ />
283
+ Viewing run
284
+ <span className="font-mono text-muted-foreground">
285
+ {shortRunId(runDetail.run.id)}
286
+ </span>
287
+ </span>
288
+ <button
289
+ type="button"
290
+ onClick={closeAll}
291
+ className="border-l border-border pl-3 text-muted-foreground underline-offset-2 hover:text-foreground hover:underline"
292
+ >
293
+ Exit run view
294
+ </button>
295
+ </>
296
+ ) : (
297
+ <>
298
+ <span>{summaryLine(workflow)}</span>
299
+ {latestRun ? (
300
+ <button
301
+ type="button"
302
+ onClick={() => selectRun(latestRun.id)}
303
+ className="inline-flex items-center gap-1 border-l border-border pl-3 text-muted-foreground hover:text-foreground"
304
+ >
305
+ <History className="h-3 w-3" />
306
+ {runTimeLabel(latestRun)}
307
+ </button>
308
+ ) : null}
309
+ </>
310
+ )}
311
+ </div>
312
+ </div>
313
+
314
+ <div className="pointer-events-auto flex items-center gap-2 rounded-lg border border-border bg-card p-1.5 shadow-sm">
315
+ <Button
316
+ type="button"
317
+ variant={runsActive ? "secondary" : "ghost"}
318
+ size="sm"
319
+ onClick={toggleRunsList}
320
+ aria-expanded={runsActive}
321
+ >
322
+ <History />
323
+ Runs
324
+ </Button>
325
+ <RequestWorkflowRunDialog workflow={workflow} />
326
+ </div>
327
+ </div>
328
+ </div>
329
+
330
+ <WorkflowSidePanel open={panelOpen} wide={runNodesByFlowId.has(selectedNodeId ?? "")}>
331
+ {panelContent}
332
+ </WorkflowSidePanel>
333
+ </ReactFlowProvider>
334
+ </div>
335
+ </SectionWorkspace>
336
+ )
337
+ }
338
+
339
+ function summaryLine(workflow: WorkflowDetail): string {
340
+ const nodeCount = workflow.nodes.length
341
+ const triggerCount = workflow.triggers.length
342
+ const inputCount = fieldCount(workflow.input)
343
+ return [
344
+ `${nodeCount} ${nodeCount === 1 ? "node" : "nodes"}`,
345
+ `${triggerCount} ${triggerCount === 1 ? "trigger" : "triggers"}`,
346
+ `${inputCount} input ${inputCount === 1 ? "field" : "fields"}`,
347
+ ].join(" · ")
348
+ }
349
+
350
+ function shortRunId(runId: string): string {
351
+ const withoutPrefix = runId.startsWith("run_") ? runId.slice(4) : runId
352
+ if (withoutPrefix.length <= 17) return withoutPrefix
353
+ return `${withoutPrefix.slice(0, 8)}…${withoutPrefix.slice(-6)}`
354
+ }
355
+
356
+ // --------------------------------------------------------------------------
357
+ // Graph model
358
+ // --------------------------------------------------------------------------
359
+
360
+ const NODE_GAP_Y = 132
361
+
362
+ interface BaseNodeData extends Record<string, unknown> {
363
+ runStatus?: WorkflowNodeStatus
364
+ runActive?: boolean
365
+ }
366
+ interface StartNodeData extends BaseNodeData {
367
+ kind: "start"
368
+ inputCount: number
369
+ }
370
+ interface StepNodeData extends BaseNodeData {
371
+ kind: "step"
372
+ index: number
373
+ label: string
374
+ inputCount: number
375
+ outputCount: number
376
+ }
377
+ interface ActionNodeData extends BaseNodeData {
378
+ kind: "action"
379
+ index: number
380
+ label: string
381
+ global: boolean
382
+ scopeLabel: string
383
+ }
384
+ interface InterventionNodeData extends BaseNodeData {
385
+ kind: "intervention"
386
+ index: number
387
+ label: string
388
+ inputCount: number
389
+ responseCount: number
390
+ }
391
+ interface AgentNodeData extends BaseNodeData {
392
+ kind: "agent"
393
+ index: number
394
+ label: string
395
+ inputCount: number
396
+ outputCount: number
397
+ }
398
+
399
+ type WorkflowNodeData =
400
+ | StartNodeData
401
+ | StepNodeData
402
+ | ActionNodeData
403
+ | InterventionNodeData
404
+ | AgentNodeData
405
+ type WorkflowFlowNode = Node<WorkflowNodeData>
406
+
407
+ function fieldCount(shape: Readonly<Record<string, unknown>> | undefined): number {
408
+ return Object.keys(shape ?? {}).length
409
+ }
410
+
411
+ function toNodeData(node: WorkflowNode, index: number): WorkflowNodeData {
412
+ if (node.type === "action") {
413
+ const global = node.objectTypeId === undefined
414
+ return {
415
+ kind: "action",
416
+ index,
417
+ label: node.key,
418
+ global,
419
+ scopeLabel: node.objectTypeId ?? "global",
420
+ }
421
+ }
422
+ if (node.type === "intervention") {
423
+ return {
424
+ kind: "intervention",
425
+ index,
426
+ label: node.key,
427
+ inputCount: fieldCount(node.input),
428
+ responseCount: fieldCount(node.response),
429
+ }
430
+ }
431
+ if (node.type === "agent") {
432
+ return {
433
+ kind: "agent",
434
+ index,
435
+ label: node.key,
436
+ inputCount: fieldCount(node.input),
437
+ outputCount: fieldCount(node.output),
438
+ }
439
+ }
440
+ return {
441
+ kind: "step",
442
+ index,
443
+ label: node.key,
444
+ inputCount: fieldCount(node.input),
445
+ outputCount: fieldCount(node.output),
446
+ }
447
+ }
448
+
449
+ function buildWorkflowGraph(workflow: WorkflowDetail): {
450
+ nodes: WorkflowFlowNode[]
451
+ edges: XYEdge[]
452
+ } {
453
+ const nodes: WorkflowFlowNode[] = [
454
+ {
455
+ id: "start",
456
+ type: "wf",
457
+ position: { x: 0, y: 0 },
458
+ data: {
459
+ kind: "start",
460
+ inputCount: fieldCount(workflow.input),
461
+ },
462
+ draggable: true,
463
+ },
464
+ ]
465
+ const edges: XYEdge[] = []
466
+
467
+ workflow.nodes.forEach((node, index) => {
468
+ const id = `node:${node.id}`
469
+ nodes.push({
470
+ id,
471
+ type: "wf",
472
+ position: { x: 0, y: (index + 1) * NODE_GAP_Y },
473
+ data: toNodeData(node, index),
474
+ draggable: true,
475
+ })
476
+ const sourceId = index === 0 ? "start" : `node:${workflow.nodes[index - 1].id}`
477
+ edges.push({ id: `e:${sourceId}->${id}`, source: sourceId, target: id })
478
+ })
479
+
480
+ return { nodes, edges }
481
+ }
482
+
483
+ // --------------------------------------------------------------------------
484
+ // Canvas
485
+ // --------------------------------------------------------------------------
486
+
487
+ const RUN_ACCENT: Record<WorkflowNodeStatus, string> = {
488
+ running: "border-amber-500/60",
489
+ waiting: "border-violet-500/60",
490
+ succeeded: "border-emerald-500/60",
491
+ failed: "border-red-500/60",
492
+ cancelled: "border-zinc-500/50",
493
+ }
494
+ const RUN_ICON_COLOR: Record<WorkflowNodeStatus, string> = {
495
+ running: "text-amber-500",
496
+ waiting: "text-violet-500",
497
+ succeeded: "text-emerald-500",
498
+ failed: "text-red-500",
499
+ cancelled: "text-zinc-500",
500
+ }
501
+ const STATUS_DOT: Record<WorkflowRunStatus, string> = {
502
+ queued: "bg-sky-500",
503
+ running: "bg-amber-500",
504
+ waiting: "bg-violet-500",
505
+ succeeded: "bg-emerald-500",
506
+ failed: "bg-red-500",
507
+ cancelled: "bg-zinc-500",
508
+ }
509
+
510
+ function WorkflowFlowCard({ data, selected }: NodeProps<WorkflowFlowNode>) {
511
+ const isStart = data.kind === "start"
512
+ const runStatus = data.runStatus
513
+ const dimmed = Boolean(data.runActive) && !runStatus && !isStart
514
+
515
+ return (
516
+ <div
517
+ className={cn(
518
+ "w-[190px] cursor-pointer rounded-xl border bg-card px-3 py-2.5 shadow-sm transition-all hover:border-foreground/20",
519
+ runStatus ? RUN_ACCENT[runStatus] : "border-border",
520
+ dimmed && "opacity-55",
521
+ selected && "border-primary/50 ring-2 ring-primary/30"
522
+ )}
523
+ >
524
+ {!isStart ? (
525
+ <Handle
526
+ type="target"
527
+ position={Position.Top}
528
+ className="!h-2 !w-2 !border-0 !bg-muted-foreground/40"
529
+ />
530
+ ) : null}
531
+
532
+ <div className="flex items-center gap-1.5">
533
+ <NodeKindIcon kind={data.kind} />
534
+ <span className="text-[10px] font-semibold uppercase tracking-wider text-muted-foreground">
535
+ {kindLabel(data.kind)}
536
+ </span>
537
+ <span className="ml-auto flex items-center gap-1">
538
+ {runStatus ? (
539
+ <span className={RUN_ICON_COLOR[runStatus]}>
540
+ <WorkflowRunStatusIcon status={runStatus} />
541
+ </span>
542
+ ) : null}
543
+ {!isStart ? (
544
+ <span className="rounded bg-muted px-1.5 font-mono text-[10px] tabular-nums text-muted-foreground">
545
+ {data.index + 1}
546
+ </span>
547
+ ) : null}
548
+ </span>
549
+ </div>
550
+
551
+ <p className="mt-1.5 truncate text-[13px] font-medium text-foreground">{cardTitle(data)}</p>
552
+ <NodeMetaLine data={data} />
553
+
554
+ <Handle
555
+ type="source"
556
+ position={Position.Bottom}
557
+ className="!h-2 !w-2 !border-0 !bg-muted-foreground/40"
558
+ />
559
+ </div>
560
+ )
561
+ }
562
+
563
+ function NodeMetaLine({ data }: { data: WorkflowNodeData }) {
564
+ if (data.kind === "start") {
565
+ return (
566
+ <p className="mt-0.5 truncate text-[11px] text-muted-foreground">
567
+ {data.inputCount} input {data.inputCount === 1 ? "field" : "fields"}
568
+ </p>
569
+ )
570
+ }
571
+ if (data.kind === "action") {
572
+ return (
573
+ <p className="mt-1 flex items-center gap-1 text-[11px] text-muted-foreground">
574
+ <span>{data.global ? "scope" : "targets"}</span>
575
+ <span className="inline-flex min-w-0 items-center gap-1 rounded bg-muted/70 px-1.5 py-0.5 font-medium text-foreground">
576
+ <Box className="h-3 w-3 shrink-0 text-emerald-600 dark:text-emerald-400" />
577
+ <span className="truncate">{data.scopeLabel}</span>
578
+ </span>
579
+ </p>
580
+ )
581
+ }
582
+ if (data.kind === "intervention") {
583
+ return (
584
+ <p className="mt-0.5 truncate text-[11px] tabular-nums text-muted-foreground">
585
+ {data.inputCount} in · {data.responseCount} resp
586
+ </p>
587
+ )
588
+ }
589
+ if (data.kind === "agent") {
590
+ return (
591
+ <p className="mt-0.5 truncate text-[11px] tabular-nums text-muted-foreground">
592
+ {data.inputCount} in · {data.outputCount} out
593
+ </p>
594
+ )
595
+ }
596
+ return (
597
+ <p className="mt-0.5 truncate text-[11px] tabular-nums text-muted-foreground">
598
+ {data.inputCount} in · {data.outputCount} out
599
+ </p>
600
+ )
601
+ }
602
+
603
+ function cardTitle(data: WorkflowNodeData): string {
604
+ return data.kind === "start" ? "Workflow input" : data.label
605
+ }
606
+
607
+ function kindLabel(kind: WorkflowNodeData["kind"]): string {
608
+ if (kind === "start") return "Start"
609
+ if (kind === "action") return "Action"
610
+ if (kind === "intervention") return "Human"
611
+ if (kind === "agent") return "Agent"
612
+ return "Step"
613
+ }
614
+
615
+ function NodeKindIcon({ kind }: { kind: WorkflowNodeData["kind"] }) {
616
+ const className = "h-3 w-3 text-muted-foreground"
617
+ if (kind === "start") return <Play className={className} />
618
+ if (kind === "action") return <Zap className={className} />
619
+ if (kind === "intervention") return <UserCheck className={className} />
620
+ if (kind === "agent") return <Bot className={className} />
621
+ return <Workflow className={className} />
622
+ }
623
+
624
+ const nodeTypes = { wf: WorkflowFlowCard } as unknown as NodeTypes
625
+
626
+ function WorkflowCanvas({
627
+ workflow,
628
+ selectedNodeId,
629
+ runStatusByFlowId,
630
+ onSelect,
631
+ panelOpen,
632
+ }: {
633
+ workflow: WorkflowDetail
634
+ selectedNodeId: string | null
635
+ runStatusByFlowId: Map<string, WorkflowNodeStatus> | null
636
+ onSelect: (id: string | null) => void
637
+ panelOpen: boolean
638
+ }) {
639
+ const built = useMemo(() => buildWorkflowGraph(workflow), [workflow])
640
+ const [nodes, setNodes, onNodesChange] = useNodesState<WorkflowFlowNode>(built.nodes)
641
+ const [edges, setEdges, onEdgesChange] = useEdgesState<XYEdge>(built.edges)
642
+ const { fitView } = useReactFlow()
643
+
644
+ // Edges only depend on the graph shape.
645
+ useEffect(() => {
646
+ setEdges(built.edges)
647
+ }, [built, setEdges])
648
+
649
+ // Rebuild nodes from the graph while preserving dragged positions, and apply
650
+ // selection + run-status decorations.
651
+ useEffect(() => {
652
+ setNodes((current) => {
653
+ const positionById = new Map(current.map((node) => [node.id, node.position]))
654
+ return built.nodes.map((node) => ({
655
+ ...node,
656
+ position: positionById.get(node.id) ?? node.position,
657
+ selected: node.id === selectedNodeId,
658
+ data: {
659
+ ...node.data,
660
+ runStatus: runStatusByFlowId?.get(node.id),
661
+ runActive: runStatusByFlowId != null,
662
+ },
663
+ }))
664
+ })
665
+ }, [built, selectedNodeId, runStatusByFlowId, setNodes])
666
+
667
+ // Re-fit when the detail panel opens/closes so nodes stay in view.
668
+ useEffect(() => {
669
+ const timer = setTimeout(() => {
670
+ fitView({ duration: 320, padding: panelOpen ? 0.2 : 0.28, maxZoom: 1.1 })
671
+ }, 320)
672
+ return () => clearTimeout(timer)
673
+ }, [panelOpen, fitView])
674
+
675
+ return (
676
+ <ReactFlow
677
+ className="sixb-canvas"
678
+ nodes={nodes}
679
+ edges={edges}
680
+ onNodesChange={onNodesChange}
681
+ onEdgesChange={onEdgesChange}
682
+ onNodeClick={(_event, node) => onSelect(node.id)}
683
+ onPaneClick={() => onSelect(null)}
684
+ nodeTypes={nodeTypes}
685
+ fitView
686
+ fitViewOptions={{ padding: 0.24, maxZoom: 1.1 }}
687
+ minZoom={0.3}
688
+ maxZoom={1.6}
689
+ proOptions={{ hideAttribution: true }}
690
+ panOnScroll
691
+ zoomOnPinch
692
+ nodesConnectable={false}
693
+ defaultEdgeOptions={{
694
+ type: "smoothstep",
695
+ style: { stroke: "rgb(148 163 184 / 0.55)", strokeWidth: 1.25 },
696
+ }}
697
+ >
698
+ <Background variant={BackgroundVariant.Dots} gap={18} size={1} className="opacity-50" />
699
+ <Controls
700
+ className="!rounded-xl !border !border-border !bg-card !shadow-sm"
701
+ showInteractive={false}
702
+ />
703
+ </ReactFlow>
704
+ )
705
+ }
706
+
707
+ // --------------------------------------------------------------------------
708
+ // Side panel — shell + router
709
+ // --------------------------------------------------------------------------
710
+
711
+ function WorkflowSidePanel({
712
+ open,
713
+ wide,
714
+ children,
715
+ }: {
716
+ open: boolean
717
+ wide: boolean
718
+ children: ReactNode
719
+ }) {
720
+ const width = wide ? "w-[36rem]" : "w-[22rem]"
721
+ return (
722
+ <aside
723
+ className={cn(
724
+ "h-full shrink-0 overflow-hidden border-l border-border bg-card transition-[width] duration-300 ease-out",
725
+ open ? width : "w-0",
726
+ "max-w-[calc(100vw-1rem)]"
727
+ )}
728
+ aria-hidden={!open}
729
+ >
730
+ <div className={cn("flex h-full max-w-[calc(100vw-1rem)] flex-col", width)}>{children}</div>
731
+ </aside>
732
+ )
733
+ }
734
+
735
+ type RunResult = { run: WorkflowRunDetail; nodes: readonly WorkflowRunNode[] }
736
+
737
+ function renderPanel(props: {
738
+ workflow: WorkflowDetail
739
+ valueTypes: ValueTypeSchemas
740
+ activeRunId: string | null
741
+ runQuery: { isLoading: boolean; isError: boolean; data: RunResult | undefined }
742
+ runNodesByFlowId: Map<string, WorkflowRunNode>
743
+ selectedNodeId: string | null
744
+ runsListOpen: boolean
745
+ onSelectRun: (runId: string) => void
746
+ onBackToRuns: () => void
747
+ onClose: () => void
748
+ onCloseNode: () => void
749
+ onCloseRunsList: () => void
750
+ }): ReactNode {
751
+ const {
752
+ workflow,
753
+ valueTypes,
754
+ activeRunId,
755
+ runNodesByFlowId,
756
+ selectedNodeId,
757
+ runsListOpen,
758
+ onSelectRun,
759
+ onBackToRuns,
760
+ onClose,
761
+ onCloseNode,
762
+ onCloseRunsList,
763
+ } = props
764
+ const runData = props.runQuery.data
765
+
766
+ if (activeRunId) {
767
+ if (props.runQuery.isLoading || !runData) {
768
+ return (
769
+ <>
770
+ <PanelHeader
771
+ icon={<History className={PANEL_ICON} />}
772
+ eyebrow="Run"
773
+ title={shortRunId(activeRunId)}
774
+ copyValue={activeRunId}
775
+ onBack={onBackToRuns}
776
+ onClose={onClose}
777
+ />
778
+ <div className="flex flex-1 items-center justify-center">
779
+ {props.runQuery.isError ? (
780
+ <p className="px-6 text-center text-sm text-muted-foreground">
781
+ Could not load this run.
782
+ </p>
783
+ ) : (
784
+ <Loader2 className="h-5 w-5 animate-spin text-muted-foreground" />
785
+ )}
786
+ </div>
787
+ </>
788
+ )
789
+ }
790
+
791
+ if (selectedNodeId === "start") {
792
+ return (
793
+ <RunStartPanel
794
+ run={runData.run}
795
+ inputSchema={valueSchema(fieldRecordSchema(workflow.input), valueTypes)}
796
+ onBack={onCloseNode}
797
+ onClose={onClose}
798
+ />
799
+ )
800
+ }
801
+
802
+ if (selectedNodeId) {
803
+ const index = workflow.nodes.findIndex((node) => `node:${node.id}` === selectedNodeId)
804
+ const definitionNode = index === -1 ? undefined : workflow.nodes[index]
805
+ return (
806
+ <RunNodePanel
807
+ runNode={runNodesByFlowId.get(selectedNodeId)}
808
+ definitionNode={definitionNode}
809
+ valueTypes={valueTypes}
810
+ index={index}
811
+ onBack={onCloseNode}
812
+ onClose={onClose}
813
+ />
814
+ )
815
+ }
816
+
817
+ return (
818
+ <RunSummaryPanel
819
+ run={runData.run}
820
+ nodes={runData.nodes}
821
+ totalSteps={workflow.nodes.length}
822
+ onBack={onBackToRuns}
823
+ onClose={onClose}
824
+ />
825
+ )
826
+ }
827
+
828
+ if (selectedNodeId) {
829
+ const selection = resolveSelection(workflow, selectedNodeId)
830
+ if (selection) {
831
+ return <DefinitionNodePanel selection={selection} onClose={onCloseNode} />
832
+ }
833
+ }
834
+
835
+ if (runsListOpen) {
836
+ return (
837
+ <RunsListPanel workflowId={workflow.id} onSelectRun={onSelectRun} onClose={onCloseRunsList} />
838
+ )
839
+ }
840
+
841
+ return null
842
+ }
843
+
844
+ const PANEL_ICON = "h-3.5 w-3.5 text-muted-foreground"
845
+
846
+ function PanelHeader({
847
+ icon,
848
+ eyebrow,
849
+ badge,
850
+ title,
851
+ description,
852
+ copyValue,
853
+ onBack,
854
+ onClose,
855
+ }: {
856
+ icon: ReactNode
857
+ eyebrow: string
858
+ badge?: ReactNode
859
+ title: string
860
+ description?: string
861
+ /** When set, the title renders as a monospace identifier with a copy button. */
862
+ copyValue?: string
863
+ onBack?: () => void
864
+ onClose: () => void
865
+ }) {
866
+ return (
867
+ <div className="flex items-start gap-2 border-b border-border px-3 py-3.5">
868
+ {onBack ? (
869
+ <Button
870
+ type="button"
871
+ variant="ghost"
872
+ size="icon-sm"
873
+ onClick={onBack}
874
+ aria-label="Back"
875
+ className="mt-0.5 shrink-0"
876
+ >
877
+ <ChevronLeft />
878
+ </Button>
879
+ ) : null}
880
+ <div className="min-w-0 flex-1 px-1">
881
+ <div className="flex flex-wrap items-center gap-2">
882
+ {icon}
883
+ <span className="text-[10px] font-semibold uppercase tracking-wider text-muted-foreground">
884
+ {eyebrow}
885
+ </span>
886
+ {badge}
887
+ </div>
888
+ <div className="mt-1 flex items-center gap-1">
889
+ <h2
890
+ className={cn(
891
+ "min-w-0 truncate text-sm font-medium text-foreground",
892
+ copyValue && "font-mono"
893
+ )}
894
+ title={copyValue ?? undefined}
895
+ >
896
+ {title}
897
+ </h2>
898
+ {copyValue ? <CopyButton value={copyValue} compact /> : null}
899
+ </div>
900
+ {description ? <p className="mt-0.5 text-xs text-muted-foreground">{description}</p> : null}
901
+ </div>
902
+ <Button
903
+ type="button"
904
+ variant="ghost"
905
+ size="icon-sm"
906
+ onClick={onClose}
907
+ aria-label="Close"
908
+ className="-mr-1 shrink-0"
909
+ >
910
+ <X />
911
+ </Button>
912
+ </div>
913
+ )
914
+ }
915
+
916
+ function PanelScroll({ children }: { children: ReactNode }) {
917
+ return (
918
+ <div className="min-h-0 flex-1 space-y-4 overflow-y-auto p-4 [scrollbar-width:thin]">
919
+ {children}
920
+ </div>
921
+ )
922
+ }
923
+
924
+ // --------------------------------------------------------------------------
925
+ // Definition node detail
926
+ // --------------------------------------------------------------------------
927
+
928
+ type Selection =
929
+ | { kind: "start"; workflow: WorkflowDetail }
930
+ | { kind: "node"; node: WorkflowNode; index: number }
931
+
932
+ function resolveSelection(
933
+ workflow: WorkflowDetail,
934
+ selectedNodeId: string | null
935
+ ): Selection | null {
936
+ if (!selectedNodeId) return null
937
+ if (selectedNodeId === "start") return { kind: "start", workflow }
938
+ const index = workflow.nodes.findIndex((node) => `node:${node.id}` === selectedNodeId)
939
+ if (index === -1) return null
940
+ return { kind: "node", node: workflow.nodes[index], index }
941
+ }
942
+
943
+ function DefinitionNodePanel({
944
+ selection,
945
+ onClose,
946
+ }: {
947
+ selection: Selection
948
+ onClose: () => void
949
+ }) {
950
+ const header =
951
+ selection.kind === "start"
952
+ ? {
953
+ title: "Workflow input",
954
+ kind: "start" as const,
955
+ description: "Data required before this workflow can run.",
956
+ }
957
+ : nodeHeader(selection.node)
958
+
959
+ return (
960
+ <>
961
+ <PanelHeader
962
+ icon={<NodeKindIcon kind={header.kind} />}
963
+ eyebrow={kindLabel(header.kind)}
964
+ badge={
965
+ selection.kind === "node" ? (
966
+ <Badge
967
+ variant="secondary"
968
+ className="rounded px-1.5 py-0 font-mono text-[10px] tabular-nums"
969
+ >
970
+ #{selection.index + 1}
971
+ </Badge>
972
+ ) : null
973
+ }
974
+ title={header.title}
975
+ description={header.description}
976
+ onClose={onClose}
977
+ />
978
+ <PanelScroll>
979
+ {selection.kind === "start" ? (
980
+ <StartPanelSections workflow={selection.workflow} />
981
+ ) : (
982
+ <NodePanelSections node={selection.node} />
983
+ )}
984
+ </PanelScroll>
985
+ </>
986
+ )
987
+ }
988
+
989
+ function nodeHeader(node: WorkflowNode): {
990
+ title: string
991
+ kind: WorkflowNodeData["kind"]
992
+ description?: string
993
+ } {
994
+ if (node.type === "action") {
995
+ return {
996
+ title: node.key,
997
+ kind: "action",
998
+ description:
999
+ node.objectTypeId === undefined
1000
+ ? "Sends a global action request."
1001
+ : `Sends an action request to ${node.objectTypeId}.`,
1002
+ }
1003
+ }
1004
+ if (node.type === "intervention") {
1005
+ return {
1006
+ title: node.key,
1007
+ kind: "intervention",
1008
+ description: node.description ?? "Waits for a human response.",
1009
+ }
1010
+ }
1011
+ if (node.type === "agent") {
1012
+ return {
1013
+ title: node.key,
1014
+ kind: "agent",
1015
+ description: "Runs an agent task with structured output.",
1016
+ }
1017
+ }
1018
+ return { title: node.key, kind: "step", description: "Transforms workflow data." }
1019
+ }
1020
+
1021
+ function StartPanelSections({ workflow }: { workflow: WorkflowDetail }) {
1022
+ return (
1023
+ <>
1024
+ <PanelBlock
1025
+ label="Input fields"
1026
+ count={fieldCount(workflow.input)}
1027
+ icon={<ArrowDownToLine className={SECTION_ICON} />}
1028
+ >
1029
+ <SchemaShape fields={workflow.input} emptyLabel="No input required" />
1030
+ </PanelBlock>
1031
+ <PanelBlock label="Start conditions" icon={<Zap className={SECTION_ICON} />}>
1032
+ {workflow.triggers.length === 0 ? (
1033
+ <div className="space-y-1">
1034
+ <p className="text-sm text-foreground">Manual or API start</p>
1035
+ <p className="text-xs text-muted-foreground">
1036
+ Runs begin when a person, app, or API invokes this workflow.
1037
+ </p>
1038
+ </div>
1039
+ ) : (
1040
+ <ul className="divide-y divide-border/40">
1041
+ {workflow.triggers.map((trigger, index) => (
1042
+ <TriggerRow key={`${trigger.type}:${index}`} trigger={trigger} />
1043
+ ))}
1044
+ </ul>
1045
+ )}
1046
+ </PanelBlock>
1047
+ </>
1048
+ )
1049
+ }
1050
+
1051
+ function NodePanelSections({ node }: { node: WorkflowNode }) {
1052
+ if (node.type === "action") {
1053
+ return (
1054
+ <>
1055
+ <PanelBlock label="Scope" icon={<Crosshair className={SECTION_ICON} />}>
1056
+ <span className="inline-flex items-center gap-1.5 rounded-md bg-muted/60 px-2 py-1 text-xs font-medium text-foreground">
1057
+ <Box className="h-3.5 w-3.5 text-emerald-600 dark:text-emerald-400" />
1058
+ {node.objectTypeId ?? "global"}
1059
+ </span>
1060
+ </PanelBlock>
1061
+ <PanelBlock
1062
+ label="Params"
1063
+ count={fieldCount(node.params)}
1064
+ icon={<SlidersHorizontal className={SECTION_ICON} />}
1065
+ >
1066
+ <SchemaShape fields={node.params} emptyLabel="No params" />
1067
+ </PanelBlock>
1068
+ </>
1069
+ )
1070
+ }
1071
+ if (node.type === "intervention") {
1072
+ return (
1073
+ <>
1074
+ <PanelBlock
1075
+ label="Input"
1076
+ count={fieldCount(node.input)}
1077
+ icon={<ArrowDownToLine className={SECTION_ICON} />}
1078
+ >
1079
+ <SchemaShape fields={node.input} emptyLabel="No input fields" />
1080
+ </PanelBlock>
1081
+ <PanelBlock
1082
+ label="Response"
1083
+ count={fieldCount(node.response)}
1084
+ icon={<ArrowUpFromLine className={SECTION_ICON} />}
1085
+ >
1086
+ <SchemaShape fields={node.response} emptyLabel="No response fields" />
1087
+ </PanelBlock>
1088
+ </>
1089
+ )
1090
+ }
1091
+ if (node.type === "agent") {
1092
+ return (
1093
+ <>
1094
+ <PanelBlock
1095
+ label="Input"
1096
+ count={fieldCount(node.input)}
1097
+ icon={<ArrowDownToLine className={SECTION_ICON} />}
1098
+ >
1099
+ <SchemaShape fields={node.input} emptyLabel="No input fields" />
1100
+ </PanelBlock>
1101
+ <PanelBlock
1102
+ label="Structured output"
1103
+ count={fieldCount(node.output)}
1104
+ icon={<ArrowUpFromLine className={SECTION_ICON} />}
1105
+ >
1106
+ <SchemaShape fields={node.output} emptyLabel="No output fields" />
1107
+ </PanelBlock>
1108
+ </>
1109
+ )
1110
+ }
1111
+ return (
1112
+ <>
1113
+ <PanelBlock
1114
+ label="Input"
1115
+ count={fieldCount(node.input)}
1116
+ icon={<ArrowDownToLine className={SECTION_ICON} />}
1117
+ >
1118
+ <SchemaShape fields={node.input} emptyLabel="No input fields" />
1119
+ </PanelBlock>
1120
+ <PanelBlock
1121
+ label="Output"
1122
+ count={fieldCount(node.output)}
1123
+ icon={<ArrowUpFromLine className={SECTION_ICON} />}
1124
+ >
1125
+ <SchemaShape fields={node.output} emptyLabel="No output fields" />
1126
+ </PanelBlock>
1127
+ </>
1128
+ )
1129
+ }
1130
+
1131
+ const SECTION_ICON = "h-3.5 w-3.5 text-muted-foreground"
1132
+
1133
+ function PanelBlock({
1134
+ label,
1135
+ count,
1136
+ icon,
1137
+ children,
1138
+ }: {
1139
+ label: string
1140
+ count?: number
1141
+ icon?: ReactNode
1142
+ children: ReactNode
1143
+ }) {
1144
+ return (
1145
+ <div className="overflow-hidden rounded-lg border border-border/60 bg-background/30">
1146
+ <div className="flex items-center justify-between gap-3 border-b border-border/60 bg-muted/20 px-3 py-2">
1147
+ <div className="flex items-center gap-1.5">
1148
+ {icon}
1149
+ <p className="text-[11px] font-semibold uppercase tracking-wider text-muted-foreground">
1150
+ {label}
1151
+ </p>
1152
+ </div>
1153
+ {typeof count === "number" ? (
1154
+ <span className="text-xs tabular-nums text-muted-foreground">
1155
+ {count} {count === 1 ? "field" : "fields"}
1156
+ </span>
1157
+ ) : null}
1158
+ </div>
1159
+ <div className="px-3 py-2.5">{children}</div>
1160
+ </div>
1161
+ )
1162
+ }
1163
+
1164
+ function TriggerRow({ trigger }: { trigger: WorkflowTrigger }) {
1165
+ const isSchedule = trigger.type === "schedule"
1166
+ return (
1167
+ <li className="flex items-center gap-3 py-2 first:pt-0 last:pb-0">
1168
+ <span className="flex h-7 w-7 shrink-0 items-center justify-center rounded-full bg-muted/60 text-muted-foreground">
1169
+ {isSchedule ? (
1170
+ <CalendarClock className="h-3.5 w-3.5" />
1171
+ ) : (
1172
+ <Webhook className="h-3.5 w-3.5" />
1173
+ )}
1174
+ </span>
1175
+ <div className="min-w-0">
1176
+ <p className="text-sm font-medium text-foreground">
1177
+ {isSchedule ? "Schedule" : trigger.type}
1178
+ </p>
1179
+ {isSchedule ? (
1180
+ <p className="truncate font-mono text-xs text-muted-foreground">{trigger.scheduleId}</p>
1181
+ ) : null}
1182
+ </div>
1183
+ </li>
1184
+ )
1185
+ }
1186
+
1187
+ // --------------------------------------------------------------------------
1188
+ // Runs list panel
1189
+ // --------------------------------------------------------------------------
1190
+
1191
+ function RunsListPanel({
1192
+ workflowId,
1193
+ onSelectRun,
1194
+ onClose,
1195
+ }: {
1196
+ workflowId: string
1197
+ onSelectRun: (runId: string) => void
1198
+ onClose: () => void
1199
+ }) {
1200
+ const runsQuery = useQuery(
1201
+ listWorkflowRunsOptions({ query: { workflowId, limit: "50", order: "desc" } })
1202
+ )
1203
+ const runs = runsQuery.data?.runs ?? []
1204
+
1205
+ return (
1206
+ <>
1207
+ <PanelHeader
1208
+ icon={<History className={PANEL_ICON} />}
1209
+ eyebrow="Runs"
1210
+ badge={
1211
+ runs.length > 0 ? (
1212
+ <Badge variant="secondary" className="rounded px-1.5 py-0 text-[10px] tabular-nums">
1213
+ {runs.length}
1214
+ </Badge>
1215
+ ) : null
1216
+ }
1217
+ title="Run history"
1218
+ description="Select a run to inspect it on the canvas."
1219
+ onClose={onClose}
1220
+ />
1221
+ <div className="min-h-0 flex-1 overflow-y-auto [scrollbar-width:thin]">
1222
+ {runsQuery.isLoading ? (
1223
+ <div className="flex items-center gap-3 px-4 py-8 text-muted-foreground">
1224
+ <Loader2 className="h-5 w-5 animate-spin" />
1225
+ <span className="text-sm">Loading runs...</span>
1226
+ </div>
1227
+ ) : isUnrecorded(runsQuery.error) ? (
1228
+ <UnrecordedHistory what="Workflow runs" />
1229
+ ) : runsQuery.isError ? (
1230
+ <p className="px-4 py-8 text-center text-sm text-muted-foreground">
1231
+ Could not load runs for this workflow.
1232
+ </p>
1233
+ ) : runs.length === 0 ? (
1234
+ <p className="px-4 py-8 text-center text-xs text-muted-foreground">
1235
+ No runs yet. Trigger one with the Run workflow button.
1236
+ </p>
1237
+ ) : (
1238
+ <ul className="divide-y divide-border/40">
1239
+ {runs.map((run) => (
1240
+ <li key={run.id}>
1241
+ <button
1242
+ type="button"
1243
+ onClick={() => onSelectRun(run.id)}
1244
+ className="flex w-full items-start justify-between gap-2 px-4 py-3 text-left transition-colors hover:bg-muted/40"
1245
+ >
1246
+ <div className="min-w-0">
1247
+ <p className="truncate font-mono text-[11px] text-foreground">{run.id}</p>
1248
+ <p className="mt-0.5 text-[11px] text-muted-foreground">
1249
+ {runTimeLabel(run)} · {formatRunDuration(run)}
1250
+ </p>
1251
+ {run.error ? (
1252
+ <div className="mt-1">
1253
+ <FailureSummary failure={run.error} compact />
1254
+ </div>
1255
+ ) : null}
1256
+ </div>
1257
+ <RunStatusPill status={run.status} />
1258
+ </button>
1259
+ </li>
1260
+ ))}
1261
+ </ul>
1262
+ )}
1263
+ </div>
1264
+ </>
1265
+ )
1266
+ }
1267
+
1268
+ // --------------------------------------------------------------------------
1269
+ // Run summary + run node detail
1270
+ // --------------------------------------------------------------------------
1271
+
1272
+ function RunSummaryPanel({
1273
+ run,
1274
+ nodes,
1275
+ totalSteps,
1276
+ onBack,
1277
+ onClose,
1278
+ }: {
1279
+ run: WorkflowRunDetail
1280
+ nodes: readonly WorkflowRunNode[]
1281
+ totalSteps: number
1282
+ onBack: () => void
1283
+ onClose: () => void
1284
+ }) {
1285
+ return (
1286
+ <>
1287
+ <PanelHeader
1288
+ icon={<History className={PANEL_ICON} />}
1289
+ eyebrow="Run"
1290
+ badge={<RunStatusPill status={run.status} />}
1291
+ title={shortRunId(run.id)}
1292
+ copyValue={run.id}
1293
+ description={runTimeLabel(run)}
1294
+ onBack={onBack}
1295
+ onClose={onClose}
1296
+ />
1297
+ <PanelScroll>
1298
+ <div className="grid grid-cols-2 gap-2">
1299
+ <RunStat label="Duration" value={formatRunDuration(run)} />
1300
+ <RunStat label="Started" value={formatRunStartedDate(run)} />
1301
+ <RunStat label="Finished" value={formatDate(run.finishedAt)} />
1302
+ <RunStat label="Queued" value={formatDate(run.queuedAt)} />
1303
+ </div>
1304
+
1305
+ <RunProgress status={run.status} nodes={nodes} totalSteps={totalSteps} />
1306
+
1307
+ {run.error ? (
1308
+ <div className="rounded-lg border border-destructive/30 bg-destructive/10 p-3">
1309
+ <FailureSummary failure={run.error} />
1310
+ </div>
1311
+ ) : null}
1312
+
1313
+ <p className="rounded-lg bg-muted/30 p-3 text-xs text-muted-foreground">
1314
+ Select a node on the canvas to inspect its input, output, and errors for this run.
1315
+ </p>
1316
+ </PanelScroll>
1317
+ </>
1318
+ )
1319
+ }
1320
+
1321
+ function RunStat({ label, value }: { label: string; value: string }) {
1322
+ return (
1323
+ <div className="rounded-lg border border-border/60 bg-background/30 px-3 py-2">
1324
+ <p className="text-[10px] font-semibold uppercase tracking-wider text-muted-foreground">
1325
+ {label}
1326
+ </p>
1327
+ <p className="mt-0.5 truncate text-sm text-foreground">{value}</p>
1328
+ </div>
1329
+ )
1330
+ }
1331
+
1332
+ function RunStartPanel({
1333
+ run,
1334
+ inputSchema,
1335
+ onBack,
1336
+ onClose,
1337
+ }: {
1338
+ run: WorkflowRunDetail
1339
+ inputSchema: ValueSchema
1340
+ onBack: () => void
1341
+ onClose: () => void
1342
+ }) {
1343
+ const fileLinks = workflowRunFileLinks(run.id, "input")
1344
+
1345
+ return (
1346
+ <>
1347
+ <PanelHeader
1348
+ icon={<Play className={PANEL_ICON} />}
1349
+ eyebrow="Start"
1350
+ badge={
1351
+ <Badge variant="secondary" className="rounded px-1.5 py-0 font-mono text-[10px]">
1352
+ start
1353
+ </Badge>
1354
+ }
1355
+ title="Run input"
1356
+ description="Values this run was started with."
1357
+ onBack={onBack}
1358
+ onClose={onClose}
1359
+ />
1360
+ <PanelScroll>
1361
+ <PanelBlock label="Input" icon={<ArrowDownToLine className={SECTION_ICON} />}>
1362
+ <ValueTree
1363
+ value={run.input}
1364
+ schema={inputSchema}
1365
+ emptyLabel="No input"
1366
+ fileLinks={fileLinks}
1367
+ />
1368
+ </PanelBlock>
1369
+ </PanelScroll>
1370
+ </>
1371
+ )
1372
+ }
1373
+
1374
+ function RunNodePanel({
1375
+ runNode,
1376
+ definitionNode,
1377
+ valueTypes,
1378
+ index,
1379
+ onBack,
1380
+ onClose,
1381
+ }: {
1382
+ runNode: WorkflowRunNode | undefined
1383
+ definitionNode: WorkflowNode | undefined
1384
+ valueTypes: ValueTypeSchemas
1385
+ index: number
1386
+ onBack: () => void
1387
+ onClose: () => void
1388
+ }) {
1389
+ const kind: WorkflowNodeData["kind"] = definitionNode ? definitionNode.type : "step"
1390
+ // A node missing from the current definition has nothing declaring its IO,
1391
+ // so its recorded values render as open values.
1392
+ const io = definitionNode ? workflowNodeIoSchemas(definitionNode) : null
1393
+ const inputSchema = io ? valueSchema(io.input, valueTypes) : undefined
1394
+ const outputSchema = io?.output ? valueSchema(io.output, valueTypes) : undefined
1395
+ const title = runNode?.nodeKey ?? definitionNode?.key ?? "Node"
1396
+ const fileLinkForRoot = (root: "input" | "output") =>
1397
+ runNode ? workflowStepFileLinks(runNode.workflowRunId, runNode.nodeKey, root) : () => null
1398
+ const agentExecutionQuery = useQuery({
1399
+ ...getWorkflowAgentNodeExecutionOptions({
1400
+ path: {
1401
+ runId: runNode?.workflowRunId ?? "",
1402
+ nodeKey: runNode?.nodeKey ?? "",
1403
+ },
1404
+ }),
1405
+ enabled: runNode?.nodeType === "agent",
1406
+ })
1407
+
1408
+ return (
1409
+ <>
1410
+ <PanelHeader
1411
+ icon={<NodeKindIcon kind={kind} />}
1412
+ eyebrow={kindLabel(kind)}
1413
+ badge={
1414
+ <span className="flex items-center gap-1.5">
1415
+ {index >= 0 ? (
1416
+ <Badge
1417
+ variant="secondary"
1418
+ className="rounded px-1.5 py-0 font-mono text-[10px] tabular-nums"
1419
+ >
1420
+ #{index + 1}
1421
+ </Badge>
1422
+ ) : null}
1423
+ {runNode ? <RunStatusPill status={runNode.status} /> : null}
1424
+ </span>
1425
+ }
1426
+ title={title}
1427
+ onBack={onBack}
1428
+ onClose={onClose}
1429
+ />
1430
+ <PanelScroll>
1431
+ {runNode ? (
1432
+ <>
1433
+ <div className="flex flex-wrap gap-x-3 gap-y-1 text-xs text-muted-foreground">
1434
+ <span>Started {formatRelativeTime(runNode.startedAt)}</span>
1435
+ <span>{formatNodeDuration(runNode)}</span>
1436
+ {runNode.finishedAt ? (
1437
+ <span>Finished {formatRelativeTime(runNode.finishedAt)}</span>
1438
+ ) : null}
1439
+ </div>
1440
+
1441
+ {runNode.nodeType === "agent" ? (
1442
+ <AgentExecutionPanel
1443
+ summary={runNode.agentExecution}
1444
+ execution={agentExecutionQuery.data}
1445
+ nodeInput={runNode.input}
1446
+ nodeOutput={runNode.output}
1447
+ inputSchema={inputSchema}
1448
+ outputSchema={outputSchema}
1449
+ nodeError={runNode.error}
1450
+ inputFileLinks={fileLinkForRoot("input")}
1451
+ outputFileLinks={fileLinkForRoot("output")}
1452
+ loading={agentExecutionQuery.isLoading}
1453
+ failed={agentExecutionQuery.isError}
1454
+ />
1455
+ ) : null}
1456
+
1457
+ {runNode.nodeType === "intervention" && runNode.status === "waiting" ? (
1458
+ <WorkflowInterventionPanel node={runNode} />
1459
+ ) : null}
1460
+
1461
+ {runNode.nodeType === "agent" ? null : (
1462
+ <WorkflowNodeExecutionPanel
1463
+ node={runNode}
1464
+ inputSchema={inputSchema}
1465
+ outputSchema={outputSchema}
1466
+ inputFileLinks={fileLinkForRoot("input")}
1467
+ outputFileLinks={fileLinkForRoot("output")}
1468
+ />
1469
+ )}
1470
+ </>
1471
+ ) : (
1472
+ <>
1473
+ <div className="rounded-lg border border-border/60 bg-muted/20 p-3">
1474
+ <p className="text-sm text-foreground">Not run yet</p>
1475
+ <p className="mt-1 text-xs text-muted-foreground">
1476
+ This node did not execute in this run. Its defined shape is shown below.
1477
+ </p>
1478
+ </div>
1479
+ {definitionNode ? <NodePanelSections node={definitionNode} /> : null}
1480
+ </>
1481
+ )}
1482
+ </PanelScroll>
1483
+ </>
1484
+ )
1485
+ }