@sixb/app 0.2.1 → 0.2.4

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 (494) hide show
  1. package/dist/agent/activity-label.d.ts.map +1 -1
  2. package/dist/agent/agent-chat.d.ts +9 -2
  3. package/dist/agent/agent-chat.d.ts.map +1 -1
  4. package/dist/agent/agent-panel.d.ts +9 -1
  5. package/dist/agent/agent-panel.d.ts.map +1 -1
  6. package/dist/agent/agent-surface.d.ts.map +1 -1
  7. package/dist/agent/artifact-card.d.ts +3 -1
  8. package/dist/agent/artifact-card.d.ts.map +1 -1
  9. package/dist/agent/artifact-panel.d.ts +7 -1
  10. package/dist/agent/artifact-panel.d.ts.map +1 -1
  11. package/dist/agent/background/background-tool-row.d.ts.map +1 -1
  12. package/dist/agent/background/interpret.d.ts +1 -1
  13. package/dist/agent/background/interpret.d.ts.map +1 -1
  14. package/dist/agent/components/composer-place.d.ts +3 -1
  15. package/dist/agent/components/composer-place.d.ts.map +1 -1
  16. package/dist/agent/components/composer.d.ts +20 -1
  17. package/dist/agent/components/composer.d.ts.map +1 -1
  18. package/dist/agent/components/context-chips.d.ts.map +1 -1
  19. package/dist/agent/components/context-meter.d.ts +1 -1
  20. package/dist/agent/components/conversation-panel.d.ts +7 -2
  21. package/dist/agent/components/conversation-panel.d.ts.map +1 -1
  22. package/dist/agent/components/message-parts.d.ts +3 -1
  23. package/dist/agent/components/message-parts.d.ts.map +1 -1
  24. package/dist/agent/components/thread-artifacts-menu.d.ts.map +1 -1
  25. package/dist/agent/components/transcript.d.ts +5 -0
  26. package/dist/agent/components/transcript.d.ts.map +1 -1
  27. package/dist/agent/composer-insertion.d.ts +24 -0
  28. package/dist/agent/composer-insertion.d.ts.map +1 -0
  29. package/dist/agent/delegation/agent-exchange.d.ts +16 -0
  30. package/dist/agent/delegation/agent-exchange.d.ts.map +1 -0
  31. package/dist/agent/delegation/child-card.d.ts +3 -3
  32. package/dist/agent/delegation/child-card.d.ts.map +1 -1
  33. package/dist/agent/delegation/child-parts.d.ts +1 -10
  34. package/dist/agent/delegation/child-parts.d.ts.map +1 -1
  35. package/dist/agent/delegation/child-work.d.ts.map +1 -1
  36. package/dist/agent/delegation/interpret.d.ts +4 -10
  37. package/dist/agent/delegation/interpret.d.ts.map +1 -1
  38. package/dist/agent/delegation/use-children.d.ts +5 -5
  39. package/dist/agent/delegation/use-children.d.ts.map +1 -1
  40. package/dist/agent/file-edits/file-edit-tool-view.d.ts +10 -0
  41. package/dist/agent/file-edits/file-edit-tool-view.d.ts.map +1 -0
  42. package/dist/agent/file-edits/interpret.d.ts +25 -0
  43. package/dist/agent/file-edits/interpret.d.ts.map +1 -0
  44. package/dist/agent/hooks/use-agent-conversation.d.ts +16 -4
  45. package/dist/agent/hooks/use-agent-conversation.d.ts.map +1 -1
  46. package/dist/agent/hooks/use-new-thread-place.d.ts +39 -17
  47. package/dist/agent/hooks/use-new-thread-place.d.ts.map +1 -1
  48. package/dist/agent/hooks/use-thread-lists.d.ts.map +1 -1
  49. package/dist/agent/i18n/en.d.ts +59 -4
  50. package/dist/agent/i18n/en.d.ts.map +1 -1
  51. package/dist/agent/i18n/fr.d.ts.map +1 -1
  52. package/dist/agent/i18n/index.d.ts +96 -8
  53. package/dist/agent/i18n/index.d.ts.map +1 -1
  54. package/dist/agent/message-agent/interpret.d.ts +2 -2
  55. package/dist/agent/message-agent/interpret.d.ts.map +1 -1
  56. package/dist/agent/publish-artifact/interpret.d.ts +8 -2
  57. package/dist/agent/publish-artifact/interpret.d.ts.map +1 -1
  58. package/dist/agent/publish-artifact/open-artifact-tool-view.d.ts +9 -0
  59. package/dist/agent/publish-artifact/open-artifact-tool-view.d.ts.map +1 -0
  60. package/dist/agent/publish-artifact/publish-artifact-tool-view.d.ts +4 -2
  61. package/dist/agent/publish-artifact/publish-artifact-tool-view.d.ts.map +1 -1
  62. package/dist/agent/publish-artifact/use-live-publishes.d.ts +3 -3
  63. package/dist/agent/publish-artifact/use-live-publishes.d.ts.map +1 -1
  64. package/dist/agent/questions/interpret.d.ts +31 -0
  65. package/dist/agent/questions/interpret.d.ts.map +1 -0
  66. package/dist/agent/questions/question-card.d.ts +16 -0
  67. package/dist/agent/questions/question-card.d.ts.map +1 -0
  68. package/dist/agent/questions/question-composer.d.ts +15 -0
  69. package/dist/agent/questions/question-composer.d.ts.map +1 -0
  70. package/dist/agent/read/interpret.d.ts +8 -1
  71. package/dist/agent/read/interpret.d.ts.map +1 -1
  72. package/dist/agent/read/read-tool-view.d.ts.map +1 -1
  73. package/dist/agent/tool-views/built-in.d.ts.map +1 -1
  74. package/dist/agent/types.d.ts +3 -1
  75. package/dist/agent/types.d.ts.map +1 -1
  76. package/dist/agent/waits.d.ts +14 -0
  77. package/dist/agent/waits.d.ts.map +1 -0
  78. package/dist/artifacts/artifact-page.d.ts.map +1 -1
  79. package/dist/artifacts/artifact-viewer.d.ts +16 -0
  80. package/dist/artifacts/artifact-viewer.d.ts.map +1 -0
  81. package/dist/artifacts/card-details.d.ts +1 -1
  82. package/dist/artifacts/card-details.d.ts.map +1 -1
  83. package/dist/artifacts/card-preview.d.ts.map +1 -1
  84. package/dist/artifacts/comments-context.d.ts +48 -0
  85. package/dist/artifacts/comments-context.d.ts.map +1 -0
  86. package/dist/artifacts/edit-session.d.ts +17 -7
  87. package/dist/artifacts/edit-session.d.ts.map +1 -1
  88. package/dist/artifacts/file-source.d.ts.map +1 -1
  89. package/dist/artifacts/frame.d.ts +10 -2
  90. package/dist/artifacts/frame.d.ts.map +1 -1
  91. package/dist/artifacts/guest-badge.d.ts +8 -0
  92. package/dist/artifacts/guest-badge.d.ts.map +1 -0
  93. package/dist/artifacts/held-artifact.d.ts +19 -0
  94. package/dist/artifacts/held-artifact.d.ts.map +1 -0
  95. package/dist/artifacts/holders.d.ts +10 -0
  96. package/dist/artifacts/holders.d.ts.map +1 -0
  97. package/dist/artifacts/live/boards.d.ts +15 -0
  98. package/dist/artifacts/live/boards.d.ts.map +1 -0
  99. package/dist/artifacts/live/canvas.d.ts +79 -0
  100. package/dist/artifacts/live/canvas.d.ts.map +1 -0
  101. package/dist/artifacts/live/header.d.ts +29 -0
  102. package/dist/artifacts/live/header.d.ts.map +1 -0
  103. package/dist/artifacts/live/hooks.d.ts +21 -0
  104. package/dist/artifacts/live/hooks.d.ts.map +1 -0
  105. package/dist/artifacts/live/presence.d.ts +32 -0
  106. package/dist/artifacts/live/presence.d.ts.map +1 -0
  107. package/dist/artifacts/live/session.d.ts +130 -0
  108. package/dist/artifacts/live/session.d.ts.map +1 -0
  109. package/dist/artifacts/live/view.d.ts +28 -0
  110. package/dist/artifacts/live/view.d.ts.map +1 -0
  111. package/dist/artifacts/messages.d.ts +476 -14
  112. package/dist/artifacts/messages.d.ts.map +1 -1
  113. package/dist/artifacts/page-queries.d.ts +2 -2
  114. package/dist/artifacts/page-queries.d.ts.map +1 -1
  115. package/dist/artifacts/page-state.d.ts.map +1 -1
  116. package/dist/artifacts/publish-edit.d.ts +24 -14
  117. package/dist/artifacts/publish-edit.d.ts.map +1 -1
  118. package/dist/artifacts/queries.d.ts +490 -9
  119. package/dist/artifacts/queries.d.ts.map +1 -1
  120. package/dist/artifacts/references/references.d.ts.map +1 -1
  121. package/dist/artifacts/renderers/canvas/arrows.d.ts +0 -18
  122. package/dist/artifacts/renderers/canvas/arrows.d.ts.map +1 -1
  123. package/dist/artifacts/renderers/canvas/board-editor.d.ts +50 -0
  124. package/dist/artifacts/renderers/canvas/board-editor.d.ts.map +1 -0
  125. package/dist/artifacts/renderers/canvas/board-properties.d.ts +37 -0
  126. package/dist/artifacts/renderers/canvas/board-properties.d.ts.map +1 -0
  127. package/dist/artifacts/renderers/canvas/board-source.d.ts +18 -0
  128. package/dist/artifacts/renderers/canvas/board-source.d.ts.map +1 -0
  129. package/dist/artifacts/renderers/canvas/board.d.ts +77 -20
  130. package/dist/artifacts/renderers/canvas/board.d.ts.map +1 -1
  131. package/dist/artifacts/renderers/canvas/canvas.d.ts +14 -4
  132. package/dist/artifacts/renderers/canvas/canvas.d.ts.map +1 -1
  133. package/dist/artifacts/renderers/canvas/comment-pins.d.ts +84 -0
  134. package/dist/artifacts/renderers/canvas/comment-pins.d.ts.map +1 -0
  135. package/dist/artifacts/renderers/canvas/commenting.d.ts +58 -0
  136. package/dist/artifacts/renderers/canvas/commenting.d.ts.map +1 -0
  137. package/dist/artifacts/renderers/canvas/comments-panel.d.ts +27 -0
  138. package/dist/artifacts/renderers/canvas/comments-panel.d.ts.map +1 -0
  139. package/dist/artifacts/renderers/canvas/comments.d.ts +56 -0
  140. package/dist/artifacts/renderers/canvas/comments.d.ts.map +1 -0
  141. package/dist/artifacts/renderers/canvas/controls.d.ts +15 -4
  142. package/dist/artifacts/renderers/canvas/controls.d.ts.map +1 -1
  143. package/dist/artifacts/renderers/canvas/draft.d.ts +7 -6
  144. package/dist/artifacts/renderers/canvas/draft.d.ts.map +1 -1
  145. package/dist/artifacts/renderers/canvas/edit-mode.d.ts +19 -2
  146. package/dist/artifacts/renderers/canvas/edit-mode.d.ts.map +1 -1
  147. package/dist/artifacts/renderers/canvas/focus.d.ts +54 -5
  148. package/dist/artifacts/renderers/canvas/focus.d.ts.map +1 -1
  149. package/dist/artifacts/renderers/canvas/gestures.d.ts +46 -0
  150. package/dist/artifacts/renderers/canvas/gestures.d.ts.map +1 -0
  151. package/dist/artifacts/renderers/canvas/items.d.ts +47 -4
  152. package/dist/artifacts/renderers/canvas/items.d.ts.map +1 -1
  153. package/dist/artifacts/renderers/canvas/layout.d.ts +5 -8
  154. package/dist/artifacts/renderers/canvas/layout.d.ts.map +1 -1
  155. package/dist/artifacts/renderers/canvas/page-resize.d.ts +21 -0
  156. package/dist/artifacts/renderers/canvas/page-resize.d.ts.map +1 -0
  157. package/dist/artifacts/renderers/canvas/page-size-controls.d.ts +21 -0
  158. package/dist/artifacts/renderers/canvas/page-size-controls.d.ts.map +1 -0
  159. package/dist/artifacts/renderers/canvas/page-size.d.ts +93 -0
  160. package/dist/artifacts/renderers/canvas/page-size.d.ts.map +1 -0
  161. package/dist/artifacts/renderers/canvas/page-zoom.d.ts +64 -0
  162. package/dist/artifacts/renderers/canvas/page-zoom.d.ts.map +1 -0
  163. package/dist/artifacts/renderers/canvas/presence.d.ts +21 -0
  164. package/dist/artifacts/renderers/canvas/presence.d.ts.map +1 -0
  165. package/dist/artifacts/renderers/canvas/previews.d.ts +54 -0
  166. package/dist/artifacts/renderers/canvas/previews.d.ts.map +1 -0
  167. package/dist/artifacts/renderers/canvas/renderer.d.ts +11 -2
  168. package/dist/artifacts/renderers/canvas/renderer.d.ts.map +1 -1
  169. package/dist/artifacts/renderers/canvas/shown-size.d.ts +26 -0
  170. package/dist/artifacts/renderers/canvas/shown-size.d.ts.map +1 -0
  171. package/dist/artifacts/renderers/canvas/thumbnail.d.ts +5 -2
  172. package/dist/artifacts/renderers/canvas/thumbnail.d.ts.map +1 -1
  173. package/dist/artifacts/version-menu.d.ts +19 -0
  174. package/dist/artifacts/version-menu.d.ts.map +1 -0
  175. package/dist/artifacts/view-context.d.ts +43 -0
  176. package/dist/artifacts/view-context.d.ts.map +1 -0
  177. package/dist/artifacts/viewer.d.ts.map +1 -1
  178. package/dist/build.d.ts +5 -0
  179. package/dist/build.d.ts.map +1 -1
  180. package/dist/chunk-00wggsst.js +7 -0
  181. package/dist/chunk-00wggsst.js.map +10 -0
  182. package/dist/{chunk-q69001w3.js → chunk-694m74s7.js} +7 -1
  183. package/dist/{chunk-q69001w3.js.map → chunk-694m74s7.js.map} +3 -3
  184. package/dist/{chunk-7fj9cfkw.js → chunk-970s5nkn.js} +1 -1
  185. package/dist/{chunk-4mprsd2n.js → chunk-fg6thecb.js} +25 -1
  186. package/dist/chunk-fg6thecb.js.map +10 -0
  187. package/dist/{chunk-ytadd0b5.js → chunk-kymx9y5e.js} +8126 -4257
  188. package/dist/chunk-kymx9y5e.js.map +211 -0
  189. package/dist/{chunk-j8g956dt.js → chunk-pxd07kvx.js} +1 -1
  190. package/dist/{chunk-kwbw4dyk.js → chunk-ryed2jq8.js} +1 -1
  191. package/dist/chunk-yrcm1pbg.js +5975 -0
  192. package/dist/chunk-yrcm1pbg.js.map +34 -0
  193. package/dist/codegen.d.ts.map +1 -1
  194. package/dist/createCustomApp.d.ts.map +1 -1
  195. package/dist/index.d.ts +9 -1
  196. package/dist/index.d.ts.map +1 -1
  197. package/dist/index.js +932 -309
  198. package/dist/index.js.map +15 -10
  199. package/dist/locale-messages.d.ts +12 -0
  200. package/dist/locale-messages.d.ts.map +1 -1
  201. package/dist/locale.d.ts +12 -0
  202. package/dist/locale.d.ts.map +1 -1
  203. package/dist/locale.js +1 -1
  204. package/dist/metadata.d.ts +8 -0
  205. package/dist/metadata.d.ts.map +1 -1
  206. package/dist/pages/console/action-run.d.ts.map +1 -1
  207. package/dist/pages/console/data/connectors.d.ts.map +1 -1
  208. package/dist/pages/console/data/datasets.d.ts.map +1 -1
  209. package/dist/pages/console/data/lake-health.d.ts +3 -0
  210. package/dist/pages/console/data/lake-health.d.ts.map +1 -0
  211. package/dist/pages/console/data/messages.d.ts +98 -2
  212. package/dist/pages/console/data/messages.d.ts.map +1 -1
  213. package/dist/pages/console/data/pipelines.d.ts.map +1 -1
  214. package/dist/pages/console/data/projections.d.ts.map +1 -1
  215. package/dist/pages/console/data/syncs.d.ts.map +1 -1
  216. package/dist/pages/console/ontology/action-runs.d.ts.map +1 -1
  217. package/dist/pages/console/ontology/actions.d.ts.map +1 -1
  218. package/dist/pages/console/ontology/components/action-button.d.ts.map +1 -1
  219. package/dist/pages/console/ontology/components/artifact-picker.d.ts +36 -0
  220. package/dist/pages/console/ontology/components/artifact-picker.d.ts.map +1 -0
  221. package/dist/pages/console/ontology/components/object-query-bar.d.ts.map +1 -1
  222. package/dist/pages/console/ontology/lib/action-params.d.ts +2 -0
  223. package/dist/pages/console/ontology/lib/action-params.d.ts.map +1 -1
  224. package/dist/pages/console/ontology/lineage/properties-panel.d.ts +2 -1
  225. package/dist/pages/console/ontology/lineage/properties-panel.d.ts.map +1 -1
  226. package/dist/pages/console/ontology/object-page.d.ts.map +1 -1
  227. package/dist/pages/console/ontology/object-type.d.ts.map +1 -1
  228. package/dist/pages/console/ontology/object-types.d.ts.map +1 -1
  229. package/dist/pages/console/ontology/objects.d.ts.map +1 -1
  230. package/dist/pages/console/ontology/rules.d.ts.map +1 -1
  231. package/dist/pages/console/ontology/workflow.d.ts.map +1 -1
  232. package/dist/pages/console/ontology/workflows/run-input-form.d.ts.map +1 -1
  233. package/dist/pages/console/ontology/workflows/schema-shape.d.ts.map +1 -1
  234. package/dist/pages/console/ontology/workflows.d.ts.map +1 -1
  235. package/dist/pages/console/skeletons.d.ts +30 -0
  236. package/dist/pages/console/skeletons.d.ts.map +1 -0
  237. package/dist/pages/console/workflow-run.d.ts.map +1 -1
  238. package/dist/pages/section-page.d.ts +11 -1
  239. package/dist/pages/section-page.d.ts.map +1 -1
  240. package/dist/pages/section-ui.d.ts +25 -3
  241. package/dist/pages/section-ui.d.ts.map +1 -1
  242. package/dist/pages/settings/activity/calendar.d.ts.map +1 -1
  243. package/dist/pages/settings/activity/connections.d.ts.map +1 -1
  244. package/dist/pages/settings/activity/page.d.ts.map +1 -1
  245. package/dist/pages/settings/activity/thread.d.ts.map +1 -1
  246. package/dist/pages/settings/activity/timeline.d.ts +2 -0
  247. package/dist/pages/settings/activity/timeline.d.ts.map +1 -1
  248. package/dist/pages/settings/controls.d.ts +4 -0
  249. package/dist/pages/settings/controls.d.ts.map +1 -1
  250. package/dist/pages/settings/members.d.ts.map +1 -1
  251. package/dist/pages/settings/memory-history.d.ts +2 -0
  252. package/dist/pages/settings/memory-history.d.ts.map +1 -1
  253. package/dist/pages/settings/memory.d.ts.map +1 -1
  254. package/dist/pages/settings/service-accounts.d.ts.map +1 -1
  255. package/dist/pages/settings/sessions.d.ts.map +1 -1
  256. package/dist/pages/settings/usage/breakdown.d.ts.map +1 -1
  257. package/dist/pages/settings/usage/limits.d.ts.map +1 -1
  258. package/dist/pages/settings/usage/messages.d.ts +0 -2
  259. package/dist/pages/settings/usage/messages.d.ts.map +1 -1
  260. package/dist/pages/settings/usage/runs.d.ts +8 -2
  261. package/dist/pages/settings/usage/runs.d.ts.map +1 -1
  262. package/dist/pages/settings/usage/spend-chart.d.ts.map +1 -1
  263. package/dist/pages/settings/usage/spend-model.d.ts +5 -0
  264. package/dist/pages/settings/usage/spend-model.d.ts.map +1 -1
  265. package/dist/pages/values.d.ts +6 -0
  266. package/dist/pages/values.d.ts.map +1 -1
  267. package/dist/pages.d.ts +4 -0
  268. package/dist/pages.d.ts.map +1 -1
  269. package/dist/pages.js +8188 -4841
  270. package/dist/pages.js.map +56 -47
  271. package/dist/sections/catalog.d.ts.map +1 -1
  272. package/dist/sections/sections.d.ts.map +1 -1
  273. package/dist/server.js +294 -23
  274. package/dist/server.js.map +8 -7
  275. package/dist/service-worker.d.ts +39 -0
  276. package/dist/service-worker.d.ts.map +1 -0
  277. package/dist/shared-session.d.ts +25 -0
  278. package/dist/shared-session.d.ts.map +1 -0
  279. package/dist/shell/app-return.d.ts +35 -0
  280. package/dist/shell/app-return.d.ts.map +1 -0
  281. package/dist/shell/app-shell.d.ts +1 -1
  282. package/dist/shell/app-shell.d.ts.map +1 -1
  283. package/dist/shell/nav-items.d.ts +2 -0
  284. package/dist/shell/nav-items.d.ts.map +1 -1
  285. package/dist/shell/phone/back.d.ts +6 -0
  286. package/dist/shell/phone/back.d.ts.map +1 -0
  287. package/dist/shell/phone/launch.d.ts +7 -0
  288. package/dist/shell/phone/launch.d.ts.map +1 -0
  289. package/dist/shell/phone/more-sheet.d.ts +36 -0
  290. package/dist/shell/phone/more-sheet.d.ts.map +1 -0
  291. package/dist/shell/phone/phone-foundations.d.ts +9 -0
  292. package/dist/shell/phone/phone-foundations.d.ts.map +1 -0
  293. package/dist/shell/phone/pull-to-refresh.d.ts +9 -0
  294. package/dist/shell/phone/pull-to-refresh.d.ts.map +1 -0
  295. package/dist/shell/phone/routes.d.ts +12 -0
  296. package/dist/shell/phone/routes.d.ts.map +1 -0
  297. package/dist/shell/phone/screen-motion.d.ts +11 -0
  298. package/dist/shell/phone/screen-motion.d.ts.map +1 -0
  299. package/dist/shell/phone/scroll-restoration.d.ts +7 -0
  300. package/dist/shell/phone/scroll-restoration.d.ts.map +1 -0
  301. package/dist/shell/phone/startup-image.d.ts +17 -0
  302. package/dist/shell/phone/startup-image.d.ts.map +1 -0
  303. package/dist/shell/phone/tab-bar.d.ts +14 -0
  304. package/dist/shell/phone/tab-bar.d.ts.map +1 -0
  305. package/dist/shell/phone/top-bar.d.ts +24 -0
  306. package/dist/shell/phone/top-bar.d.ts.map +1 -0
  307. package/dist/shell/search-command.d.ts +3 -1
  308. package/dist/shell/search-command.d.ts.map +1 -1
  309. package/dist/shell/user-menu.d.ts +2 -0
  310. package/dist/shell/user-menu.d.ts.map +1 -1
  311. package/package.json +8 -5
  312. package/src/agent/activity-label.ts +6 -1
  313. package/src/agent/agent-chat.tsx +52 -8
  314. package/src/agent/agent-panel.tsx +12 -0
  315. package/src/agent/agent-surface.tsx +4 -0
  316. package/src/agent/artifact-card.tsx +84 -16
  317. package/src/agent/artifact-panel.tsx +63 -43
  318. package/src/agent/background/background-tool-row.tsx +24 -10
  319. package/src/agent/background/interpret.ts +60 -51
  320. package/src/agent/components/agent-message-body.tsx +1 -1
  321. package/src/agent/components/composer-place.tsx +77 -53
  322. package/src/agent/components/composer.tsx +92 -7
  323. package/src/agent/components/context-chips.tsx +72 -2
  324. package/src/agent/components/conversation-panel.tsx +30 -10
  325. package/src/agent/components/message-parts.tsx +29 -6
  326. package/src/agent/components/thread-artifacts-menu.tsx +22 -5
  327. package/src/agent/components/transcript.tsx +45 -27
  328. package/src/agent/composer-insertion.ts +36 -0
  329. package/src/agent/delegation/agent-exchange.tsx +53 -0
  330. package/src/agent/delegation/child-card.tsx +6 -40
  331. package/src/agent/delegation/child-parts.tsx +1 -84
  332. package/src/agent/delegation/child-work.tsx +19 -5
  333. package/src/agent/delegation/interpret.ts +33 -54
  334. package/src/agent/delegation/model.ts +1 -1
  335. package/src/agent/file-edits/file-edit-tool-view.tsx +126 -0
  336. package/src/agent/file-edits/interpret.ts +120 -0
  337. package/src/agent/hooks/use-agent-conversation.ts +61 -10
  338. package/src/agent/hooks/use-new-thread-place.ts +149 -25
  339. package/src/agent/i18n/en.ts +60 -4
  340. package/src/agent/i18n/fr.ts +51 -4
  341. package/src/agent/message-agent/interpret.ts +4 -3
  342. package/src/agent/publish-artifact/interpret.ts +37 -6
  343. package/src/agent/publish-artifact/open-artifact-tool-view.tsx +49 -0
  344. package/src/agent/publish-artifact/publish-artifact-tool-view.tsx +14 -8
  345. package/src/agent/publish-artifact/use-live-publishes.ts +7 -11
  346. package/src/agent/questions/interpret.ts +90 -0
  347. package/src/agent/questions/question-card.tsx +57 -0
  348. package/src/agent/questions/question-composer.tsx +257 -0
  349. package/src/agent/react-router.tsx +2 -2
  350. package/src/agent/read/interpret.ts +34 -1
  351. package/src/agent/read/read-tool-view.tsx +20 -4
  352. package/src/agent/tool-views/built-in.tsx +22 -8
  353. package/src/agent/types.ts +4 -0
  354. package/src/agent/waits.ts +50 -0
  355. package/src/artifacts/artifact-page.tsx +42 -17
  356. package/src/artifacts/artifact-viewer.tsx +56 -0
  357. package/src/artifacts/artifacts.css +116 -0
  358. package/src/artifacts/card-details.ts +2 -2
  359. package/src/artifacts/card-preview.tsx +17 -3
  360. package/src/artifacts/comments-context.ts +125 -0
  361. package/src/artifacts/edit-session.tsx +21 -7
  362. package/src/artifacts/file-source.ts +10 -3
  363. package/src/artifacts/frame.tsx +53 -14
  364. package/src/artifacts/gallery.tsx +9 -11
  365. package/src/artifacts/guest-badge.tsx +21 -0
  366. package/src/artifacts/held-artifact.tsx +241 -0
  367. package/src/artifacts/holders.tsx +170 -0
  368. package/src/artifacts/live/boards.ts +95 -0
  369. package/src/artifacts/live/canvas.ts +402 -0
  370. package/src/artifacts/live/header.tsx +137 -0
  371. package/src/artifacts/live/hooks.ts +94 -0
  372. package/src/artifacts/live/presence.ts +147 -0
  373. package/src/artifacts/live/session.ts +520 -0
  374. package/src/artifacts/live/view.ts +81 -0
  375. package/src/artifacts/messages.ts +469 -24
  376. package/src/artifacts/page-queries.ts +2 -3
  377. package/src/artifacts/page-state.ts +16 -7
  378. package/src/artifacts/publish-edit.ts +50 -22
  379. package/src/artifacts/queries.ts +108 -10
  380. package/src/artifacts/references/references.tsx +6 -9
  381. package/src/artifacts/renderers/canvas/arrows.tsx +12 -39
  382. package/src/artifacts/renderers/canvas/board-editor.tsx +839 -0
  383. package/src/artifacts/renderers/canvas/board-properties.tsx +488 -0
  384. package/src/artifacts/renderers/canvas/board-source.ts +110 -0
  385. package/src/artifacts/renderers/canvas/board.tsx +373 -35
  386. package/src/artifacts/renderers/canvas/canvas.tsx +441 -75
  387. package/src/artifacts/renderers/canvas/comment-pins.tsx +465 -0
  388. package/src/artifacts/renderers/canvas/commenting.tsx +319 -0
  389. package/src/artifacts/renderers/canvas/comments-panel.tsx +574 -0
  390. package/src/artifacts/renderers/canvas/comments.ts +225 -0
  391. package/src/artifacts/renderers/canvas/controls.tsx +64 -30
  392. package/src/artifacts/renderers/canvas/draft.ts +41 -50
  393. package/src/artifacts/renderers/canvas/edit-mode.tsx +145 -20
  394. package/src/artifacts/renderers/canvas/focus.tsx +321 -26
  395. package/src/artifacts/renderers/canvas/gestures.ts +265 -0
  396. package/src/artifacts/renderers/canvas/items.tsx +179 -52
  397. package/src/artifacts/renderers/canvas/layout.ts +99 -47
  398. package/src/artifacts/renderers/canvas/page-resize.tsx +542 -0
  399. package/src/artifacts/renderers/canvas/page-size-controls.tsx +193 -0
  400. package/src/artifacts/renderers/canvas/page-size.ts +218 -0
  401. package/src/artifacts/renderers/canvas/page-zoom.ts +280 -0
  402. package/src/artifacts/renderers/canvas/presence.tsx +184 -0
  403. package/src/artifacts/renderers/canvas/previews.ts +127 -0
  404. package/src/artifacts/renderers/canvas/renderer.tsx +87 -22
  405. package/src/artifacts/renderers/canvas/shown-size.ts +105 -0
  406. package/src/artifacts/renderers/canvas/thumbnail.tsx +56 -15
  407. package/src/artifacts/renderers/canvas/toolbar.tsx +1 -1
  408. package/src/artifacts/renderers/slides/slides.tsx +1 -1
  409. package/src/artifacts/version-menu.tsx +438 -0
  410. package/src/artifacts/view-context.ts +102 -0
  411. package/src/artifacts/viewer.tsx +219 -147
  412. package/src/build.ts +96 -11
  413. package/src/codegen.ts +83 -5
  414. package/src/createCustomApp.ts +20 -7
  415. package/src/index.ts +14 -0
  416. package/src/locale-messages.ts +24 -0
  417. package/src/metadata.ts +12 -0
  418. package/src/pages/console/action-run.tsx +20 -0
  419. package/src/pages/console/data/connectors.tsx +27 -3
  420. package/src/pages/console/data/datasets.tsx +30 -1
  421. package/src/pages/console/data/lake-health.tsx +299 -0
  422. package/src/pages/console/data/messages.ts +143 -2
  423. package/src/pages/console/data/pipelines.tsx +91 -3
  424. package/src/pages/console/data/projections.tsx +23 -4
  425. package/src/pages/console/data/syncs.tsx +39 -2
  426. package/src/pages/console/ontology/action-runs.tsx +8 -2
  427. package/src/pages/console/ontology/actions.tsx +39 -15
  428. package/src/pages/console/ontology/components/action-button.tsx +10 -0
  429. package/src/pages/console/ontology/components/artifact-picker.tsx +522 -0
  430. package/src/pages/console/ontology/components/object-query-bar.tsx +21 -5
  431. package/src/pages/console/ontology/lib/action-params.ts +10 -0
  432. package/src/pages/console/ontology/lineage/properties-panel.tsx +32 -24
  433. package/src/pages/console/ontology/object-page.tsx +2 -0
  434. package/src/pages/console/ontology/object-type.tsx +73 -14
  435. package/src/pages/console/ontology/object-types.tsx +56 -7
  436. package/src/pages/console/ontology/objects.tsx +167 -19
  437. package/src/pages/console/ontology/rules.tsx +186 -30
  438. package/src/pages/console/ontology/workflow.tsx +130 -74
  439. package/src/pages/console/ontology/workflows/run-input-form.tsx +21 -2
  440. package/src/pages/console/ontology/workflows/schema-shape.tsx +3 -0
  441. package/src/pages/console/ontology/workflows.tsx +34 -21
  442. package/src/pages/console/skeletons.tsx +99 -0
  443. package/src/pages/console/workflow-run.tsx +20 -0
  444. package/src/pages/section-page.tsx +37 -7
  445. package/src/pages/section-ui.tsx +96 -13
  446. package/src/pages/settings/activity/calendar.tsx +13 -6
  447. package/src/pages/settings/activity/connections.tsx +26 -9
  448. package/src/pages/settings/activity/page.tsx +31 -4
  449. package/src/pages/settings/activity/thread.tsx +32 -18
  450. package/src/pages/settings/activity/timeline.tsx +39 -0
  451. package/src/pages/settings/controls.tsx +19 -1
  452. package/src/pages/settings/developers.tsx +2 -2
  453. package/src/pages/settings/members.tsx +42 -9
  454. package/src/pages/settings/memory-history.tsx +76 -10
  455. package/src/pages/settings/memory.tsx +47 -5
  456. package/src/pages/settings/service-accounts.tsx +7 -2
  457. package/src/pages/settings/sessions.tsx +6 -2
  458. package/src/pages/settings/usage/breakdown.tsx +62 -2
  459. package/src/pages/settings/usage/limits.tsx +45 -3
  460. package/src/pages/settings/usage/messages.ts +0 -2
  461. package/src/pages/settings/usage/page.tsx +99 -52
  462. package/src/pages/settings/usage/runs.tsx +105 -8
  463. package/src/pages/settings/usage/spend-chart.tsx +79 -45
  464. package/src/pages/settings/usage/spend-model.ts +16 -0
  465. package/src/pages/values.tsx +72 -6
  466. package/src/pages.ts +4 -0
  467. package/src/sections/catalog.ts +6 -0
  468. package/src/sections/sections.tsx +2 -0
  469. package/src/service-worker.ts +176 -0
  470. package/src/shared-session.ts +73 -0
  471. package/src/shell/app-return.ts +115 -0
  472. package/src/shell/app-shell.tsx +125 -27
  473. package/src/shell/nav-items.tsx +2 -0
  474. package/src/shell/phone/back.ts +16 -0
  475. package/src/shell/phone/launch.ts +6 -0
  476. package/src/shell/phone/more-sheet.tsx +249 -0
  477. package/src/shell/phone/phone-foundations.tsx +43 -0
  478. package/src/shell/phone/phone.css +660 -0
  479. package/src/shell/phone/pull-to-refresh.tsx +201 -0
  480. package/src/shell/phone/routes.ts +34 -0
  481. package/src/shell/phone/screen-motion.ts +292 -0
  482. package/src/shell/phone/scroll-restoration.tsx +70 -0
  483. package/src/shell/phone/startup-image.ts +119 -0
  484. package/src/shell/phone/tab-bar.tsx +95 -0
  485. package/src/shell/phone/top-bar.tsx +195 -0
  486. package/src/shell/search-command.tsx +30 -14
  487. package/src/shell/user-menu.tsx +2 -1
  488. package/dist/chunk-4j3c3p72.js +0 -1487
  489. package/dist/chunk-4j3c3p72.js.map +0 -18
  490. package/dist/chunk-4mprsd2n.js.map +0 -10
  491. package/dist/chunk-ytadd0b5.js.map +0 -188
  492. /package/dist/{chunk-7fj9cfkw.js.map → chunk-970s5nkn.js.map} +0 -0
  493. /package/dist/{chunk-j8g956dt.js.map → chunk-pxd07kvx.js.map} +0 -0
  494. /package/dist/{chunk-kwbw4dyk.js.map → chunk-ryed2jq8.js.map} +0 -0
@@ -1,72 +1,195 @@
1
- import { createContext, type ReactNode, useContext } from "react"
2
- import { ArtifactFrame } from "../../frame"
1
+ import { CANVAS_FILE, parseFrameEvent } from "@sixb/core/artifacts"
2
+ import { cn } from "@sixb/ui/lib/utils"
3
+ import { useStoreApi } from "@xyflow/react"
4
+ import type { LucideIcon } from "lucide-react"
5
+ import {
6
+ createContext,
7
+ type ReactNode,
8
+ type RefObject,
9
+ useContext,
10
+ useEffect,
11
+ useRef,
12
+ useState,
13
+ useSyncExternalStore,
14
+ } from "react"
15
+ import { ArtifactFrame, type ArtifactFrameHandle } from "../../frame"
3
16
  import type { ArtifactVersion } from "../../queries"
17
+ import type { BoardGestures } from "./gestures"
18
+ import type { BoardPreviews } from "./previews"
4
19
 
5
- /** The most boards live at once: each is a page running in its own frame. */
6
- export const MAX_LIVE_BOARDS = 12
20
+ /** The most boards and embeds live at once: each board is a page running in its own frame. */
21
+ export const MAX_LIVE_BOARDS = 8
7
22
  /**
8
- * How wide on screen a board is before it starts running: narrower, it is its outline. One already
9
- * running keeps running however small, so zooming out never reloads it.
23
+ * A board starts running once the view shows it at half its size, where its page's text still
24
+ * reads. Smaller, its picture shows as much, so it is its tile.
10
25
  */
11
- export const MIN_LIVE_WIDTH = 48
26
+ export const LIVE_FROM_SCALE = 0.5
27
+ /**
28
+ * Or, while it has no picture, once it is this wide on screen, a phone's width, where a wide
29
+ * board's layout reads: its outline shows nothing of it.
30
+ */
31
+ export const LIVE_FROM_WIDTH = 360
12
32
 
13
- /** A board's place on the canvas. */
33
+ /** A board's or an embed's place on the canvas. */
14
34
  export interface BoardPlace {
15
35
  readonly id: string
16
36
  readonly x: number
17
37
  readonly y: number
18
38
  readonly w: number
19
39
  readonly h: number
40
+ /** Whether its tile is a picture of it: a board's ready preview. */
41
+ readonly pictured?: boolean
42
+ }
43
+
44
+ /** Where the board view is: React Flow's transform, the pan then the zoom, and its size. */
45
+ export interface BoardView {
46
+ readonly transform: readonly [number, number, number]
47
+ readonly width: number
48
+ readonly height: number
20
49
  }
21
50
 
22
51
  /**
23
- * The boards to run, from where the board view is: those on screen and at least
24
- * {@link MIN_LIVE_WIDTH} wide there, or running already, at most {@link MAX_LIVE_BOARDS}. Those
25
- * running come first, so a pan doesn't swap one page for another, then the nearest the middle of
26
- * the view. The others show their outline until the view comes to them.
52
+ * The boards and embeds to run, from where the board view is: those on screen and large enough
53
+ * there, or running already, at most {@link MAX_LIVE_BOARDS}. One running keeps running however
54
+ * small while it is on screen, so zooming out never reloads it. Those running come first, so a
55
+ * pan doesn't swap one page for another, then the nearest the middle of the view. The others show
56
+ * their tile until the view comes to them.
27
57
  */
28
58
  export function liveBoards(
29
59
  boards: readonly BoardPlace[],
30
- view: {
31
- /** React Flow's transform: the pan, then the zoom. */
32
- readonly transform: readonly [number, number, number]
33
- readonly width: number
34
- readonly height: number
35
- },
60
+ view: BoardView,
36
61
  running: ReadonlySet<string> = new Set()
37
62
  ): ReadonlySet<string> {
38
63
  const [panX, panY, zoom] = view.transform
39
64
  const centerX = view.width / 2
40
65
  const centerY = view.height / 2
66
+
41
67
  const candidates = boards.flatMap((board) => {
42
68
  const left = board.x * zoom + panX
43
69
  const top = board.y * zoom + panY
44
70
  const width = board.w * zoom
45
71
  const height = board.h * zoom
46
72
  const onScreen = left < view.width && left + width > 0 && top < view.height && top + height > 0
73
+ const half = board.w * LIVE_FROM_SCALE
74
+ const large = width >= (board.pictured ? half : Math.min(half, LIVE_FROM_WIDTH))
47
75
  const kept = running.has(board.id)
48
- if (!onScreen || (width < MIN_LIVE_WIDTH && !kept)) return []
76
+ if (!onScreen || (!large && !kept)) return []
77
+
49
78
  const distance = Math.hypot(left + width / 2 - centerX, top + height / 2 - centerY)
50
79
  return [{ id: board.id, kept, distance }]
51
80
  })
81
+
52
82
  candidates.sort((a, b) => Number(b.kept) - Number(a.kept) || a.distance - b.distance)
53
83
  return new Set(candidates.slice(0, MAX_LIVE_BOARDS).map((candidate) => candidate.id))
54
84
  }
55
85
 
86
+ /**
87
+ * The boards and embeds running, kept as the view moves. Each item reads whether it is one of
88
+ * them, so a change draws again only the items it starts or stops, and a pan draws nothing.
89
+ */
90
+ export interface LiveSet {
91
+ readonly has: (id: string) => boolean
92
+ readonly subscribe: (listener: () => void) => () => void
93
+ }
94
+
95
+ /** The live set of these boards and embeds, worked out again as React Flow's view changes. */
96
+ export function useLiveSet(places: readonly BoardPlace[]): LiveSet {
97
+ const store = useStoreApi()
98
+ const [live] = useState(createLiveSet)
99
+
100
+ useEffect(() => {
101
+ let last: BoardView | null = null
102
+ const update = () => {
103
+ const { transform, width, height, fitViewQueued } = store.getState()
104
+ // Until the view is fitted, it is not where the reader will see it: a board there would
105
+ // start only to be seen small.
106
+ if (fitViewQueued) return
107
+
108
+ // The store changes for more than the view: what doesn't move it changes nothing here.
109
+ if (
110
+ last &&
111
+ last.width === width &&
112
+ last.height === height &&
113
+ last.transform.every((value, index) => value === transform[index])
114
+ ) {
115
+ return
116
+ }
117
+
118
+ last = { transform, width, height }
119
+ live.set(liveBoards(places, last, live.current()))
120
+ }
121
+
122
+ update()
123
+ return store.subscribe(update)
124
+ }, [store, places, live])
125
+
126
+ return live
127
+ }
128
+
129
+ function createLiveSet(): LiveSet & {
130
+ readonly current: () => ReadonlySet<string>
131
+ readonly set: (next: ReadonlySet<string>) => void
132
+ } {
133
+ let current: ReadonlySet<string> = new Set()
134
+ const listeners = new Set<() => void>()
135
+
136
+ return {
137
+ has: (id) => current.has(id),
138
+ current: () => current,
139
+ set: (next) => {
140
+ if (next.size === current.size && [...next].every((id) => current.has(id))) return
141
+
142
+ current = next
143
+ for (const listener of listeners) listener()
144
+ },
145
+ subscribe: (listener) => {
146
+ listeners.add(listener)
147
+ return () => listeners.delete(listener)
148
+ },
149
+ }
150
+ }
151
+
152
+ const NOTHING_LIVE: LiveSet = { has: () => false, subscribe: () => () => {} }
153
+
56
154
  interface LiveBoards {
57
155
  readonly version: ArtifactVersion | null
58
- readonly live: ReadonlySet<string>
156
+ readonly live: LiveSet
157
+ /** Whether each board's picture is ready, and the mode the reader sees it in. */
158
+ readonly previews: BoardPreviews
159
+ readonly mode: "light" | "dark"
59
160
  /** Opens a board over the canvas. */
60
161
  readonly open?: (id: string) => void
162
+ /**
163
+ * Whether the reader uses the running boards' pages in place: while they read the canvas, not
164
+ * while they edit it or place a comment.
165
+ */
166
+ readonly interactive?: boolean
167
+ /** What the canvas does with what a running board's page hands it. */
168
+ readonly gestures?: BoardGestures | null
61
169
  }
62
170
 
63
- const LiveBoardsContext = createContext<LiveBoards>({ version: null, live: new Set() })
171
+ const LiveBoardsContext = createContext<LiveBoards>({
172
+ version: null,
173
+ live: NOTHING_LIVE,
174
+ previews: {},
175
+ mode: "light",
176
+ })
64
177
 
65
- /** The board view's version, the boards it runs, and how to open one. */
178
+ /** The board view's version, the boards it runs, their pictures, and how to open one. */
66
179
  export function useLiveBoards(): LiveBoards {
67
180
  return useContext(LiveBoardsContext)
68
181
  }
69
182
 
183
+ /** Whether a board or an embed runs now: it draws again only as that changes. */
184
+ export function useLive(id: string): boolean {
185
+ const { live } = useContext(LiveBoardsContext)
186
+ return useSyncExternalStore(
187
+ live.subscribe,
188
+ () => live.has(id),
189
+ () => false
190
+ )
191
+ }
192
+
70
193
  export function LiveBoardsProvider({
71
194
  value,
72
195
  children,
@@ -78,9 +201,160 @@ export function LiveBoardsProvider({
78
201
  }
79
202
 
80
203
  /**
81
- * A board's page, running, when the view shows it large enough: otherwise, and until it is ready,
82
- * its tile. On the board a frame takes no clicks, so dragging across it pans; it is a picture
83
- * until the reader opens it.
204
+ * What a board or an embed shows while it doesn't run: a picture of it when there is one, else
205
+ * its outline, the icon of what it is in the middle, breathing while its picture is on its way.
206
+ * A board that changes keeps its last picture, breathing, until the new one is ready. A picture
207
+ * that can't be loaded gives way to its fallback, then to the outline. The name above says which
208
+ * it is.
209
+ */
210
+ export function ItemTile({
211
+ icon: Icon,
212
+ preview,
213
+ fallback,
214
+ pending = false,
215
+ onFail,
216
+ }: {
217
+ readonly icon: LucideIcon
218
+ /** A picture of the item, the size of its box. */
219
+ readonly preview?: string
220
+ /** Another picture of it, for when that one can't be loaded. */
221
+ readonly fallback?: string
222
+ readonly pending?: boolean
223
+ /** A picture could not be had: what the tile knows of its pictures may be out of date. */
224
+ readonly onFail?: () => void
225
+ }) {
226
+ const picture = usePicture(preview, fallback, pending, onFail)
227
+
228
+ if (picture.src) {
229
+ return (
230
+ <img
231
+ src={picture.src}
232
+ alt=""
233
+ decoding="async"
234
+ loading="lazy"
235
+ draggable={false}
236
+ onError={picture.fail}
237
+ // From the top at the item's width: a board taller than its picture, which stops 4000
238
+ // pixels down, shows the rest empty rather than a picture zoomed to fill it.
239
+ className={cn(
240
+ "block size-full object-contain object-top",
241
+ pending && "motion-safe:animate-pulse"
242
+ )}
243
+ {...(pending ? { "aria-busy": true } : {})}
244
+ />
245
+ )
246
+ }
247
+ return (
248
+ <div
249
+ className="flex size-full items-center justify-center bg-card"
250
+ {...(pending ? { "aria-busy": true } : {})}
251
+ >
252
+ {/*
253
+ * The icon breathes, not the tile, and only while the board is near enough to see it
254
+ * (artifacts.css): a hundred tiles breathing are a hundred repaints a frame.
255
+ */}
256
+ <Icon
257
+ className={cn("size-12 text-muted-foreground/30", pending && "motion-safe:animate-pulse")}
258
+ strokeWidth={1}
259
+ aria-hidden="true"
260
+ />
261
+ </div>
262
+ )
263
+ }
264
+
265
+ const NOTHING_FAILED: ReadonlySet<string> = new Set()
266
+
267
+ /**
268
+ * The picture to show of `preview`, else of `fallback` once it fails, without going blank as it
269
+ * changes: the one shown stays until the next has decoded, so a sharper picture, or one in the
270
+ * other mode, takes its place in one frame. While the next is `pending`, the one shown stays too:
271
+ * a board that changed shows its last picture until the new one is rendered. Nothing is shown
272
+ * before the first one, which loads in place, as an image does.
273
+ */
274
+ function usePicture(
275
+ preview: string | undefined,
276
+ fallback: string | undefined,
277
+ pending: boolean,
278
+ onFail: (() => void) | undefined
279
+ ): { readonly src: string | null; readonly fail: () => void } {
280
+ const [failed, setFailed] = useState(NOTHING_FAILED)
281
+ const onFailRef = useRef(onFail)
282
+ onFailRef.current = onFail
283
+ const wanted = [preview, fallback].find((src) => src !== undefined && !failed.has(src)) ?? null
284
+ const [shown, setShown] = useState(wanted)
285
+ const showing = shown !== null && !failed.has(shown)
286
+
287
+ useEffect(() => {
288
+ if (wanted === shown) return
289
+
290
+ // The next one is on its way: the one shown stays until it is ready.
291
+ if (!wanted && pending && showing) return
292
+
293
+ // Nothing worth keeping on screen, or nothing to come: the next one loads in place.
294
+ if (!wanted || !showing) {
295
+ setShown(wanted)
296
+ return
297
+ }
298
+
299
+ let current = true
300
+ const next = new Image()
301
+ next.src = wanted
302
+ next.decode().then(
303
+ () => {
304
+ if (current) setShown(wanted)
305
+ },
306
+ () => {
307
+ if (!current) return
308
+
309
+ setFailed((all) => new Set(all).add(wanted))
310
+ onFailRef.current?.()
311
+ }
312
+ )
313
+ return () => {
314
+ current = false
315
+ }
316
+ }, [wanted, shown, showing, pending])
317
+
318
+ return {
319
+ src: showing ? shown : wanted,
320
+ fail: () => {
321
+ const src = showing ? shown : wanted
322
+ if (!src) return
323
+
324
+ setFailed((all) => new Set(all).add(src))
325
+ onFailRef.current?.()
326
+ },
327
+ }
328
+ }
329
+
330
+ /**
331
+ * The version a board's frame runs, kept as long as the pages it holds are the same: a canvas
332
+ * edited live is written again every few seconds, moving its revision, while only `canvas.json`
333
+ * changes. Its boards then keep running as they were rather than load again, and load the next
334
+ * revision only once a page, or a file one loads, changed.
335
+ */
336
+ function usePagesVersion(version: ArtifactVersion | null): ArtifactVersion | null {
337
+ const kept = useRef<{ readonly version: ArtifactVersion; readonly pages: string } | null>(null)
338
+ if (!version) return null
339
+
340
+ const pages = `${version.artifactId}@${version.version}\n${version.files
341
+ .filter((file) => file.path !== CANVAS_FILE)
342
+ .map((file) => `${file.path}:${file.file.digest}`)
343
+ .join("\n")}`
344
+ if (kept.current?.pages !== pages) kept.current = { version, pages }
345
+ return kept.current.version
346
+ }
347
+
348
+ /**
349
+ * A board's page, running, when the view shows it large enough, over its tile: the tile stays
350
+ * under the frame while it fades in, once its page is ready, so a board never flashes blank as it
351
+ * starts or stops; then the tile goes, so nothing of it shows through a page drawn on the board's
352
+ * own surface.
353
+ *
354
+ * While the reader reads the canvas, a running page is theirs to use in place: its clicks, keys,
355
+ * text and cursor are its own, and its frame hands the canvas what moves it, as `gestures.ts`
356
+ * says. Editing the canvas or placing a comment, or until it runs, it takes no clicks: a drag
357
+ * across it pans, as across its picture.
84
358
  */
85
359
  export function LiveBoard({
86
360
  id,
@@ -93,16 +367,80 @@ export function LiveBoard({
93
367
  readonly title: string
94
368
  readonly tile: ReactNode
95
369
  }) {
96
- const { version, live } = useContext(LiveBoardsContext)
97
- if (!version || !live.has(id)) return <>{tile}</>
370
+ const { version, interactive = false, gestures = null } = useContext(LiveBoardsContext)
371
+ const live = useLive(id)
372
+ const pages = usePagesVersion(version)
373
+ // The pages whose frame said it is ready: a frame that runs other pages, or stops, shows the
374
+ // tile again until it is.
375
+ const [ready, setReady] = useState<ArtifactVersion | null>(null)
376
+ const running = live && pages !== null && ready === pages
377
+ const usable = running && interactive
378
+
379
+ const page = useRef<HTMLDivElement | null>(null)
380
+ const handle = useRef<ArtifactFrameHandle | null>(null)
381
+ /** Each load the frame said it is ready, for its port to be handed over again. */
382
+ const [loads, setLoads] = useState(0)
383
+ useCanvasPort(id, gestures, handle, loads, page)
384
+
98
385
  return (
99
- <ArtifactFrame
100
- version={version}
101
- entry={file}
102
- title={title}
103
- decorative
104
- className="size-full overflow-hidden rounded-[10px]"
105
- fallback={tile}
106
- />
386
+ <div
387
+ ref={page}
388
+ className="group/board relative size-full"
389
+ data-running={running ? "" : undefined}
390
+ data-interactive={usable ? "" : undefined}
391
+ >
392
+ {/* Gone once the frame has faded in over it: as long as the fade, then not drawn at all. */}
393
+ <div className="size-full transition-[visibility] delay-300 group-data-[running]/board:invisible">
394
+ {tile}
395
+ </div>
396
+ {pages && live ? (
397
+ <ArtifactFrame
398
+ version={pages}
399
+ entry={file}
400
+ title={title}
401
+ decorative={!usable}
402
+ handle={handle}
403
+ className="absolute inset-0 overflow-hidden rounded-[10px]"
404
+ onEvent={(event) => {
405
+ if (event.event !== "ready") return
406
+ setReady(pages)
407
+ setLoads((count) => count + 1)
408
+ }}
409
+ />
410
+ ) : null}
411
+ </div>
107
412
  )
108
413
  }
414
+
415
+ /**
416
+ * Each load of a running board's frame, a port of its own, handed over with its first `canvas`
417
+ * request: what moves the canvas comes through it alone, never through the window, where the
418
+ * page's scripts post too. The frame hears from then on whether the canvas pans by the wheel.
419
+ */
420
+ function useCanvasPort(
421
+ id: string,
422
+ gestures: BoardGestures | null,
423
+ handle: RefObject<ArtifactFrameHandle | null>,
424
+ loads: number,
425
+ page: RefObject<HTMLElement | null>
426
+ ): void {
427
+ useEffect(() => {
428
+ if (loads === 0 || !gestures) return
429
+
430
+ const channel = new MessageChannel()
431
+ channel.port1.onmessage = (message: MessageEvent) => {
432
+ const event = parseFrameEvent(message.data)
433
+ if (event) gestures.receive(id, event, page.current)
434
+ }
435
+ const tell = (moving: boolean, transfer: Transferable[] = []) => {
436
+ handle.current?.send("canvas", { moving }, transfer).catch(() => {})
437
+ }
438
+
439
+ tell(gestures.moving(), [channel.port2])
440
+ const stop = gestures.onMoving((moving) => tell(moving))
441
+ return () => {
442
+ stop()
443
+ channel.port1.close()
444
+ }
445
+ }, [id, gestures, handle, loads, page])
446
+ }