@dxos/plugin-script 0.8.4-main.72ec0f3 → 0.8.4-main.937b3ca

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 (375) hide show
  1. package/dist/lib/browser/DeploymentDialog-GXNRUXF6.mjs +14 -0
  2. package/dist/lib/browser/{NotebookContainer-RTESC4OV.mjs → NotebookContainer-4MM2VAQF.mjs} +267 -239
  3. package/dist/lib/browser/NotebookContainer-4MM2VAQF.mjs.map +7 -0
  4. package/dist/lib/browser/ScriptContainer-X6GCYZZW.mjs +149 -0
  5. package/dist/lib/browser/ScriptContainer-X6GCYZZW.mjs.map +7 -0
  6. package/dist/lib/browser/app-graph-builder-7VO7AUI6.mjs +68 -0
  7. package/dist/lib/browser/app-graph-builder-7VO7AUI6.mjs.map +7 -0
  8. package/dist/lib/browser/blueprint-definition-OSOUYI7A.mjs +17 -0
  9. package/dist/lib/browser/blueprint-definition-OSOUYI7A.mjs.map +7 -0
  10. package/dist/lib/browser/blueprints/index.mjs +8 -0
  11. package/dist/lib/browser/chunk-3O2DQGCP.mjs +113 -0
  12. package/dist/lib/browser/chunk-3O2DQGCP.mjs.map +7 -0
  13. package/dist/lib/browser/chunk-BTWHM6FH.mjs +270 -0
  14. package/dist/lib/browser/chunk-BTWHM6FH.mjs.map +7 -0
  15. package/dist/lib/browser/chunk-F3QKSKSF.mjs +35 -0
  16. package/dist/lib/browser/chunk-F3QKSKSF.mjs.map +7 -0
  17. package/dist/lib/browser/chunk-I7CSE6T3.mjs +110 -0
  18. package/dist/lib/browser/chunk-I7CSE6T3.mjs.map +7 -0
  19. package/dist/lib/browser/chunk-IQRLM6JK.mjs +137 -0
  20. package/dist/lib/browser/chunk-IQRLM6JK.mjs.map +7 -0
  21. package/dist/lib/browser/chunk-NWSK27QB.mjs +606 -0
  22. package/dist/lib/browser/chunk-NWSK27QB.mjs.map +7 -0
  23. package/dist/lib/browser/{chunk-2G2NA6DQ.mjs → chunk-UX4GHJ5E.mjs} +28 -11
  24. package/dist/lib/browser/chunk-UX4GHJ5E.mjs.map +7 -0
  25. package/dist/lib/browser/{chunk-5JSNQYZZ.mjs → chunk-WX2NVNFQ.mjs} +236 -196
  26. package/dist/lib/browser/chunk-WX2NVNFQ.mjs.map +7 -0
  27. package/dist/lib/browser/{chunk-EB6AXFXO.mjs → chunk-WYR4QHPE.mjs} +1 -1
  28. package/dist/lib/browser/chunk-WYR4QHPE.mjs.map +7 -0
  29. package/dist/lib/browser/compiler-XRBFQFXO.mjs +161 -0
  30. package/dist/lib/browser/compiler-XRBFQFXO.mjs.map +7 -0
  31. package/dist/lib/browser/index.mjs +96 -125
  32. package/dist/lib/browser/index.mjs.map +4 -4
  33. package/dist/lib/browser/meta.json +1 -1
  34. package/dist/lib/browser/operation-resolver-MUNR376F.mjs +82 -0
  35. package/dist/lib/browser/operation-resolver-MUNR376F.mjs.map +7 -0
  36. package/dist/lib/browser/{react-surface-QEQ3QUQA.mjs → react-surface-5TEC66UY.mjs} +53 -42
  37. package/dist/lib/browser/react-surface-5TEC66UY.mjs.map +7 -0
  38. package/dist/lib/browser/settings-R4WKREUJ.mjs +35 -0
  39. package/dist/lib/browser/settings-R4WKREUJ.mjs.map +7 -0
  40. package/dist/lib/browser/templates/index.mjs +1 -1
  41. package/dist/lib/browser/types/index.mjs +9 -5
  42. package/dist/lib/node-esm/{DeploymentDialog-GL5AUWMR.mjs → DeploymentDialog-EVFV2VJT.mjs} +6 -6
  43. package/dist/lib/node-esm/DeploymentDialog-EVFV2VJT.mjs.map +7 -0
  44. package/dist/lib/node-esm/{NotebookContainer-SVD3A3D6.mjs → NotebookContainer-QLW5ZYGS.mjs} +267 -239
  45. package/dist/lib/node-esm/NotebookContainer-QLW5ZYGS.mjs.map +7 -0
  46. package/dist/lib/node-esm/ScriptContainer-3DZ3BMHW.mjs +150 -0
  47. package/dist/lib/node-esm/ScriptContainer-3DZ3BMHW.mjs.map +7 -0
  48. package/dist/lib/node-esm/app-graph-builder-NVE3EVBG.mjs +69 -0
  49. package/dist/lib/node-esm/app-graph-builder-NVE3EVBG.mjs.map +7 -0
  50. package/dist/lib/node-esm/blueprint-definition-NC7NNJGI.mjs +18 -0
  51. package/dist/lib/node-esm/blueprint-definition-NC7NNJGI.mjs.map +7 -0
  52. package/dist/lib/node-esm/blueprints/index.mjs +9 -0
  53. package/dist/lib/node-esm/blueprints/index.mjs.map +7 -0
  54. package/dist/lib/node-esm/{chunk-57JA6XL5.mjs → chunk-4F5FJZ36.mjs} +28 -11
  55. package/dist/lib/node-esm/chunk-4F5FJZ36.mjs.map +7 -0
  56. package/dist/lib/node-esm/{chunk-IBV2DR36.mjs → chunk-5HSJPAK7.mjs} +1 -1
  57. package/dist/lib/node-esm/chunk-5HSJPAK7.mjs.map +7 -0
  58. package/dist/lib/node-esm/chunk-KN6SQYUF.mjs +114 -0
  59. package/dist/lib/node-esm/chunk-KN6SQYUF.mjs.map +7 -0
  60. package/dist/lib/node-esm/{chunk-IQTBVH4L.mjs → chunk-MGWKULCD.mjs} +236 -196
  61. package/dist/lib/node-esm/chunk-MGWKULCD.mjs.map +7 -0
  62. package/dist/lib/node-esm/chunk-SLU3KRV3.mjs +112 -0
  63. package/dist/lib/node-esm/chunk-SLU3KRV3.mjs.map +7 -0
  64. package/dist/lib/node-esm/chunk-VWOLKNMO.mjs +271 -0
  65. package/dist/lib/node-esm/chunk-VWOLKNMO.mjs.map +7 -0
  66. package/dist/lib/node-esm/chunk-Y3G5NCTP.mjs +36 -0
  67. package/dist/lib/node-esm/chunk-Y3G5NCTP.mjs.map +7 -0
  68. package/dist/lib/node-esm/chunk-YEWLTVBT.mjs +138 -0
  69. package/dist/lib/node-esm/chunk-YEWLTVBT.mjs.map +7 -0
  70. package/dist/lib/node-esm/chunk-ZQGHFNO3.mjs +607 -0
  71. package/dist/lib/node-esm/chunk-ZQGHFNO3.mjs.map +7 -0
  72. package/dist/lib/node-esm/compiler-ORJAXDN7.mjs +162 -0
  73. package/dist/lib/node-esm/compiler-ORJAXDN7.mjs.map +7 -0
  74. package/dist/lib/node-esm/index.mjs +96 -125
  75. package/dist/lib/node-esm/index.mjs.map +4 -4
  76. package/dist/lib/node-esm/meta.json +1 -1
  77. package/dist/lib/node-esm/operation-resolver-CLE4ZCC5.mjs +83 -0
  78. package/dist/lib/node-esm/operation-resolver-CLE4ZCC5.mjs.map +7 -0
  79. package/dist/lib/node-esm/{react-surface-U77YT7VF.mjs → react-surface-O3UDMKOQ.mjs} +53 -42
  80. package/dist/lib/node-esm/react-surface-O3UDMKOQ.mjs.map +7 -0
  81. package/dist/lib/node-esm/settings-OFIMHU7K.mjs +36 -0
  82. package/dist/lib/node-esm/settings-OFIMHU7K.mjs.map +7 -0
  83. package/dist/lib/node-esm/templates/index.mjs +1 -1
  84. package/dist/lib/node-esm/types/index.mjs +9 -5
  85. package/dist/types/src/ScriptPlugin.d.ts +2 -1
  86. package/dist/types/src/ScriptPlugin.d.ts.map +1 -1
  87. package/dist/types/src/blueprints/index.d.ts +2 -0
  88. package/dist/types/src/blueprints/index.d.ts.map +1 -0
  89. package/dist/types/src/blueprints/script-blueprint.d.ts +22 -0
  90. package/dist/types/src/blueprints/script-blueprint.d.ts.map +1 -0
  91. package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts +6 -0
  92. package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts.map +1 -0
  93. package/dist/types/src/capabilities/app-graph-builder/index.d.ts +3 -0
  94. package/dist/types/src/capabilities/app-graph-builder/index.d.ts.map +1 -0
  95. package/dist/types/src/capabilities/artifact-definition/artifact-definition.d.ts +12 -0
  96. package/dist/types/src/capabilities/artifact-definition/artifact-definition.d.ts.map +1 -0
  97. package/dist/types/src/capabilities/artifact-definition/index.d.ts +3 -0
  98. package/dist/types/src/capabilities/artifact-definition/index.d.ts.map +1 -0
  99. package/dist/types/src/capabilities/blueprint-definition/blueprint-definition.d.ts +9 -0
  100. package/dist/types/src/capabilities/blueprint-definition/blueprint-definition.d.ts.map +1 -0
  101. package/dist/types/src/capabilities/blueprint-definition/index.d.ts +3 -0
  102. package/dist/types/src/capabilities/blueprint-definition/index.d.ts.map +1 -0
  103. package/dist/types/src/capabilities/compiler/compiler.d.ts +6 -0
  104. package/dist/types/src/capabilities/compiler/compiler.d.ts.map +1 -0
  105. package/dist/types/src/capabilities/compiler/index.d.ts +3 -0
  106. package/dist/types/src/capabilities/compiler/index.d.ts.map +1 -0
  107. package/dist/types/src/capabilities/index.d.ts +6 -7
  108. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  109. package/dist/types/src/capabilities/operation-resolver/index.d.ts +3 -0
  110. package/dist/types/src/capabilities/operation-resolver/index.d.ts.map +1 -0
  111. package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts +5 -0
  112. package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts.map +1 -0
  113. package/dist/types/src/capabilities/react-surface/index.d.ts +3 -0
  114. package/dist/types/src/capabilities/react-surface/index.d.ts.map +1 -0
  115. package/dist/types/src/capabilities/react-surface/react-surface.d.ts +5 -0
  116. package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +1 -0
  117. package/dist/types/src/capabilities/settings/index.d.ts +7 -0
  118. package/dist/types/src/capabilities/settings/index.d.ts.map +1 -0
  119. package/dist/types/src/capabilities/settings/settings.d.ts +9 -0
  120. package/dist/types/src/capabilities/settings/settings.d.ts.map +1 -0
  121. package/dist/types/src/compiler/compiler.d.ts +1 -1
  122. package/dist/types/src/compiler/compiler.d.ts.map +1 -1
  123. package/dist/types/src/components/DeploymentDialog/DeploymentDialog.d.ts.map +1 -1
  124. package/dist/types/src/components/DeploymentDialog/DeploymentDialog.stories.d.ts +4 -3
  125. package/dist/types/src/components/DeploymentDialog/DeploymentDialog.stories.d.ts.map +1 -1
  126. package/dist/types/src/components/FrameContainer/FrameContainer.d.ts.map +1 -1
  127. package/dist/types/src/components/NotebookContainer.d.ts +3 -5
  128. package/dist/types/src/components/NotebookContainer.d.ts.map +1 -1
  129. package/dist/types/src/components/NotebookContainer.stories.d.ts +3 -247
  130. package/dist/types/src/components/NotebookContainer.stories.d.ts.map +1 -1
  131. package/dist/types/src/components/NotebookStack/NotebookCell.d.ts +3 -3
  132. package/dist/types/src/components/NotebookStack/NotebookCell.d.ts.map +1 -1
  133. package/dist/types/src/components/NotebookStack/NotebookStack.d.ts +1 -1
  134. package/dist/types/src/components/NotebookStack/NotebookStack.d.ts.map +1 -1
  135. package/dist/types/src/components/NotebookStack/NotebookStack.stories.d.ts +5 -1
  136. package/dist/types/src/components/NotebookStack/NotebookStack.stories.d.ts.map +1 -1
  137. package/dist/types/src/components/QueryEditor/QueryEditor.d.ts +5 -0
  138. package/dist/types/src/components/QueryEditor/QueryEditor.d.ts.map +1 -0
  139. package/dist/types/src/components/QueryEditor/QueryEditor.stories.d.ts +13 -0
  140. package/dist/types/src/components/QueryEditor/QueryEditor.stories.d.ts.map +1 -0
  141. package/dist/types/src/components/QueryEditor/index.d.ts +2 -0
  142. package/dist/types/src/components/QueryEditor/index.d.ts.map +1 -0
  143. package/dist/types/src/components/ScriptContainer.d.ts +4 -5
  144. package/dist/types/src/components/ScriptContainer.d.ts.map +1 -1
  145. package/dist/types/src/components/ScriptToolbar/ScriptToolbar.d.ts +2 -2
  146. package/dist/types/src/components/ScriptToolbar/ScriptToolbar.d.ts.map +1 -1
  147. package/dist/types/src/components/ScriptToolbar/ScriptToolbar.stories.d.ts +5 -1
  148. package/dist/types/src/components/ScriptToolbar/ScriptToolbar.stories.d.ts.map +1 -1
  149. package/dist/types/src/components/Settings/ScriptObjectSettings.d.ts.map +1 -1
  150. package/dist/types/src/components/Settings/ScriptPluginSettings.d.ts +4 -2
  151. package/dist/types/src/components/Settings/ScriptPluginSettings.d.ts.map +1 -1
  152. package/dist/types/src/components/TestPanel/TestContainer.d.ts +1 -1
  153. package/dist/types/src/components/TestPanel/TestContainer.d.ts.map +1 -1
  154. package/dist/types/src/components/TypescriptEditor/TypescriptEditor.d.ts +3 -2
  155. package/dist/types/src/components/TypescriptEditor/TypescriptEditor.d.ts.map +1 -1
  156. package/dist/types/src/components/TypescriptEditor/TypescriptEditor.stories.d.ts +1 -1
  157. package/dist/types/src/components/TypescriptEditor/TypescriptEditor.stories.d.ts.map +1 -1
  158. package/dist/types/src/components/index.d.ts +2 -2
  159. package/dist/types/src/components/index.d.ts.map +1 -1
  160. package/dist/types/src/e2e/ai.test.d.ts +2 -0
  161. package/dist/types/src/e2e/ai.test.d.ts.map +1 -0
  162. package/dist/types/src/e2e/deploy.test.d.ts +2 -0
  163. package/dist/types/src/e2e/deploy.test.d.ts.map +1 -0
  164. package/dist/types/src/hooks/deploy.d.ts +10 -27
  165. package/dist/types/src/hooks/deploy.d.ts.map +1 -1
  166. package/dist/types/src/hooks/format.d.ts +2 -2
  167. package/dist/types/src/hooks/format.d.ts.map +1 -1
  168. package/dist/types/src/hooks/index.d.ts +1 -0
  169. package/dist/types/src/hooks/index.d.ts.map +1 -1
  170. package/dist/types/src/hooks/template.d.ts +2 -2
  171. package/dist/types/src/hooks/template.d.ts.map +1 -1
  172. package/dist/types/src/hooks/useCompiler.d.ts +7 -0
  173. package/dist/types/src/hooks/useCompiler.d.ts.map +1 -0
  174. package/dist/types/src/hooks/useCreateAndDeployScriptTemplates.d.ts.map +1 -1
  175. package/dist/types/src/hooks/useToolbarState.d.ts +8 -1
  176. package/dist/types/src/hooks/useToolbarState.d.ts.map +1 -1
  177. package/dist/types/src/index.d.ts +1 -1
  178. package/dist/types/src/index.d.ts.map +1 -1
  179. package/dist/types/src/meta.d.ts +2 -2
  180. package/dist/types/src/meta.d.ts.map +1 -1
  181. package/dist/types/src/notebook/compute-graph.d.ts +24 -11
  182. package/dist/types/src/notebook/compute-graph.d.ts.map +1 -1
  183. package/dist/types/src/templates/anthropic.d.ts +8 -0
  184. package/dist/types/src/templates/anthropic.d.ts.map +1 -0
  185. package/dist/types/src/templates/chess-bot.d.ts +16 -0
  186. package/dist/types/src/templates/chess-bot.d.ts.map +1 -0
  187. package/dist/types/src/templates/commentary.d.ts +16 -0
  188. package/dist/types/src/templates/commentary.d.ts.map +1 -0
  189. package/dist/types/src/templates/forex-effect.d.ts +4 -1
  190. package/dist/types/src/templates/forex-effect.d.ts.map +1 -1
  191. package/dist/types/src/templates/forex.d.ts +4 -1
  192. package/dist/types/src/templates/forex.d.ts.map +1 -1
  193. package/dist/types/src/templates/index.d.ts +12 -3
  194. package/dist/types/src/templates/index.d.ts.map +1 -1
  195. package/dist/types/src/templates/ping.d.ts +1 -4
  196. package/dist/types/src/templates/ping.d.ts.map +1 -1
  197. package/dist/types/src/testing/simulator.test.d.ts +2 -0
  198. package/dist/types/src/testing/simulator.test.d.ts.map +1 -0
  199. package/dist/types/src/translations.d.ts +2 -0
  200. package/dist/types/src/translations.d.ts.map +1 -1
  201. package/dist/types/src/types/Notebook.d.ts +90 -21
  202. package/dist/types/src/types/Notebook.d.ts.map +1 -1
  203. package/dist/types/src/types/actions.d.ts +30 -44
  204. package/dist/types/src/types/actions.d.ts.map +1 -1
  205. package/dist/types/src/types/capabilities.d.ts +12 -0
  206. package/dist/types/src/types/capabilities.d.ts.map +1 -0
  207. package/dist/types/src/types/events.d.ts +5 -0
  208. package/dist/types/src/types/events.d.ts.map +1 -0
  209. package/dist/types/src/types/index.d.ts +2 -0
  210. package/dist/types/src/types/index.d.ts.map +1 -1
  211. package/dist/types/src/util/deploy.d.ts.map +1 -1
  212. package/dist/types/src/util/functions.d.ts.map +1 -1
  213. package/dist/types/tsconfig.tsbuildinfo +1 -1
  214. package/package.json +113 -87
  215. package/src/ScriptPlugin.tsx +36 -75
  216. package/src/blueprints/index.ts +5 -0
  217. package/src/blueprints/script-blueprint.ts +24 -0
  218. package/src/capabilities/app-graph-builder/app-graph-builder.ts +55 -0
  219. package/src/capabilities/app-graph-builder/index.ts +7 -0
  220. package/src/capabilities/{artifact-definition.ts → artifact-definition/artifact-definition.ts} +97 -94
  221. package/src/capabilities/artifact-definition/index.ts +7 -0
  222. package/src/capabilities/blueprint-definition/blueprint-definition.ts +23 -0
  223. package/src/capabilities/blueprint-definition/index.ts +7 -0
  224. package/src/capabilities/compiler/compiler.ts +103 -0
  225. package/src/capabilities/compiler/index.ts +7 -0
  226. package/src/capabilities/index.ts +6 -10
  227. package/src/capabilities/operation-resolver/index.ts +7 -0
  228. package/src/capabilities/operation-resolver/operation-resolver.ts +74 -0
  229. package/src/capabilities/react-surface/index.ts +7 -0
  230. package/src/capabilities/react-surface/react-surface.tsx +118 -0
  231. package/src/capabilities/settings/index.ts +7 -0
  232. package/src/capabilities/settings/settings.ts +32 -0
  233. package/src/compiler/compiler.ts +10 -3
  234. package/src/components/DeploymentDialog/DeploymentDialog.stories.tsx +27 -23
  235. package/src/components/DeploymentDialog/DeploymentDialog.tsx +22 -42
  236. package/src/components/FrameContainer/FrameContainer.tsx +4 -2
  237. package/src/components/NotebookContainer.stories.tsx +23 -19
  238. package/src/components/NotebookContainer.tsx +54 -47
  239. package/src/components/NotebookStack/NotebookCell.tsx +22 -19
  240. package/src/components/NotebookStack/NotebookStack.stories.tsx +19 -18
  241. package/src/components/NotebookStack/NotebookStack.tsx +4 -4
  242. package/src/components/QueryEditor/QueryEditor.stories.tsx +100 -0
  243. package/src/components/QueryEditor/QueryEditor.tsx +47 -0
  244. package/src/components/QueryEditor/index.ts +5 -0
  245. package/src/components/ScriptContainer.tsx +48 -33
  246. package/src/components/ScriptToolbar/ScriptToolbar.stories.tsx +38 -15
  247. package/src/components/ScriptToolbar/ScriptToolbar.tsx +14 -17
  248. package/src/components/Settings/ScriptObjectSettings.tsx +44 -32
  249. package/src/components/Settings/ScriptPluginSettings.tsx +8 -3
  250. package/src/components/TestPanel/TestContainer.tsx +5 -5
  251. package/src/components/TestPanel/TestPanel.tsx +1 -1
  252. package/src/components/TypescriptEditor/TypescriptEditor.stories.tsx +13 -8
  253. package/src/components/TypescriptEditor/TypescriptEditor.tsx +69 -68
  254. package/src/e2e/ai.test.ts +92 -0
  255. package/src/e2e/deploy.test.ts +64 -0
  256. package/src/hooks/deploy.ts +36 -28
  257. package/src/hooks/format.ts +5 -1
  258. package/src/hooks/index.ts +1 -0
  259. package/src/hooks/template.ts +15 -9
  260. package/src/hooks/useCompiler.ts +24 -0
  261. package/src/hooks/useCreateAndDeployScriptTemplates.ts +13 -19
  262. package/src/hooks/useToolbarState.ts +29 -5
  263. package/src/index.ts +1 -1
  264. package/src/meta.ts +2 -2
  265. package/src/notebook/compute-graph.test.ts +20 -8
  266. package/src/notebook/compute-graph.ts +45 -21
  267. package/src/templates/anthropic.ts +42 -0
  268. package/src/templates/chess-bot.ts +58 -0
  269. package/src/templates/commentary.ts +232 -0
  270. package/src/templates/data-generator.ts +1 -1
  271. package/src/templates/forex-effect.ts +22 -27
  272. package/src/templates/forex.ts +7 -6
  273. package/src/templates/index.ts +18 -5
  274. package/src/templates/ping.ts +14 -5
  275. package/src/testing/simulator.test.ts +40 -0
  276. package/src/translations.ts +2 -0
  277. package/src/types/Notebook.ts +10 -10
  278. package/src/types/actions.ts +17 -25
  279. package/src/types/capabilities.ts +17 -0
  280. package/src/types/events.ts +11 -0
  281. package/src/types/index.ts +2 -0
  282. package/src/types/types.ts +1 -1
  283. package/src/util/deploy.ts +23 -29
  284. package/src/util/functions.ts +27 -24
  285. package/src/vite-env.d.ts +2 -0
  286. package/dist/lib/browser/DeploymentDialog-MZX4T77L.mjs +0 -14
  287. package/dist/lib/browser/NotebookContainer-RTESC4OV.mjs.map +0 -7
  288. package/dist/lib/browser/ScriptContainer-T2BAZDJ4.mjs +0 -147
  289. package/dist/lib/browser/ScriptContainer-T2BAZDJ4.mjs.map +0 -7
  290. package/dist/lib/browser/app-graph-builder-2WR2ATTJ.mjs +0 -66
  291. package/dist/lib/browser/app-graph-builder-2WR2ATTJ.mjs.map +0 -7
  292. package/dist/lib/browser/blueprint-definition-6PZWZM2Y.mjs +0 -30
  293. package/dist/lib/browser/blueprint-definition-6PZWZM2Y.mjs.map +0 -7
  294. package/dist/lib/browser/chunk-2G2NA6DQ.mjs.map +0 -7
  295. package/dist/lib/browser/chunk-3IJASGG5.mjs +0 -155
  296. package/dist/lib/browser/chunk-3IJASGG5.mjs.map +0 -7
  297. package/dist/lib/browser/chunk-4M7U2WVT.mjs +0 -304
  298. package/dist/lib/browser/chunk-4M7U2WVT.mjs.map +0 -7
  299. package/dist/lib/browser/chunk-5JSNQYZZ.mjs.map +0 -7
  300. package/dist/lib/browser/chunk-EB6AXFXO.mjs.map +0 -7
  301. package/dist/lib/browser/chunk-GAFCKEII.mjs +0 -646
  302. package/dist/lib/browser/chunk-GAFCKEII.mjs.map +0 -7
  303. package/dist/lib/browser/chunk-LNNCD2H4.mjs +0 -102
  304. package/dist/lib/browser/chunk-LNNCD2H4.mjs.map +0 -7
  305. package/dist/lib/browser/chunk-M6KJPUJK.mjs +0 -111
  306. package/dist/lib/browser/chunk-M6KJPUJK.mjs.map +0 -7
  307. package/dist/lib/browser/chunk-UOQ6NCH3.mjs +0 -15
  308. package/dist/lib/browser/chunk-UOQ6NCH3.mjs.map +0 -7
  309. package/dist/lib/browser/compiler-4KHRSX7J.mjs +0 -86
  310. package/dist/lib/browser/compiler-4KHRSX7J.mjs.map +0 -7
  311. package/dist/lib/browser/intent-resolver-AFJ575VK.mjs +0 -104
  312. package/dist/lib/browser/intent-resolver-AFJ575VK.mjs.map +0 -7
  313. package/dist/lib/browser/react-surface-QEQ3QUQA.mjs.map +0 -7
  314. package/dist/lib/browser/settings-LNLSTZM4.mjs +0 -26
  315. package/dist/lib/browser/settings-LNLSTZM4.mjs.map +0 -7
  316. package/dist/lib/node-esm/NotebookContainer-SVD3A3D6.mjs.map +0 -7
  317. package/dist/lib/node-esm/ScriptContainer-2CE3H3JJ.mjs +0 -148
  318. package/dist/lib/node-esm/ScriptContainer-2CE3H3JJ.mjs.map +0 -7
  319. package/dist/lib/node-esm/app-graph-builder-NCVLUL5R.mjs +0 -67
  320. package/dist/lib/node-esm/app-graph-builder-NCVLUL5R.mjs.map +0 -7
  321. package/dist/lib/node-esm/blueprint-definition-5R6YCSZZ.mjs +0 -31
  322. package/dist/lib/node-esm/blueprint-definition-5R6YCSZZ.mjs.map +0 -7
  323. package/dist/lib/node-esm/chunk-55JZVM6K.mjs +0 -16
  324. package/dist/lib/node-esm/chunk-55JZVM6K.mjs.map +0 -7
  325. package/dist/lib/node-esm/chunk-57JA6XL5.mjs.map +0 -7
  326. package/dist/lib/node-esm/chunk-HDKR5WCD.mjs +0 -113
  327. package/dist/lib/node-esm/chunk-HDKR5WCD.mjs.map +0 -7
  328. package/dist/lib/node-esm/chunk-IBV2DR36.mjs.map +0 -7
  329. package/dist/lib/node-esm/chunk-IQTBVH4L.mjs.map +0 -7
  330. package/dist/lib/node-esm/chunk-KJKZ4KNO.mjs +0 -647
  331. package/dist/lib/node-esm/chunk-KJKZ4KNO.mjs.map +0 -7
  332. package/dist/lib/node-esm/chunk-NNHWLRHT.mjs +0 -103
  333. package/dist/lib/node-esm/chunk-NNHWLRHT.mjs.map +0 -7
  334. package/dist/lib/node-esm/chunk-RIE676OW.mjs +0 -156
  335. package/dist/lib/node-esm/chunk-RIE676OW.mjs.map +0 -7
  336. package/dist/lib/node-esm/chunk-YRTA4EHU.mjs +0 -305
  337. package/dist/lib/node-esm/chunk-YRTA4EHU.mjs.map +0 -7
  338. package/dist/lib/node-esm/compiler-DU5NQISX.mjs +0 -87
  339. package/dist/lib/node-esm/compiler-DU5NQISX.mjs.map +0 -7
  340. package/dist/lib/node-esm/intent-resolver-A5VVK746.mjs +0 -105
  341. package/dist/lib/node-esm/intent-resolver-A5VVK746.mjs.map +0 -7
  342. package/dist/lib/node-esm/react-surface-U77YT7VF.mjs.map +0 -7
  343. package/dist/lib/node-esm/settings-IUFMOCXY.mjs +0 -27
  344. package/dist/lib/node-esm/settings-IUFMOCXY.mjs.map +0 -7
  345. package/dist/types/src/capabilities/app-graph-builder.d.ts +0 -4
  346. package/dist/types/src/capabilities/app-graph-builder.d.ts.map +0 -1
  347. package/dist/types/src/capabilities/artifact-definition.d.ts +0 -11
  348. package/dist/types/src/capabilities/artifact-definition.d.ts.map +0 -1
  349. package/dist/types/src/capabilities/blueprint-definition.d.ts +0 -5
  350. package/dist/types/src/capabilities/blueprint-definition.d.ts.map +0 -1
  351. package/dist/types/src/capabilities/capabilities.d.ts +0 -5
  352. package/dist/types/src/capabilities/capabilities.d.ts.map +0 -1
  353. package/dist/types/src/capabilities/compiler.d.ts +0 -4
  354. package/dist/types/src/capabilities/compiler.d.ts.map +0 -1
  355. package/dist/types/src/capabilities/intent-resolver.d.ts +0 -4
  356. package/dist/types/src/capabilities/intent-resolver.d.ts.map +0 -1
  357. package/dist/types/src/capabilities/react-surface.d.ts +0 -4
  358. package/dist/types/src/capabilities/react-surface.d.ts.map +0 -1
  359. package/dist/types/src/capabilities/settings.d.ts +0 -4
  360. package/dist/types/src/capabilities/settings.d.ts.map +0 -1
  361. package/dist/types/src/events.d.ts +0 -4
  362. package/dist/types/src/events.d.ts.map +0 -1
  363. package/dist/types/src/templates/chess.d.ts +0 -3
  364. package/dist/types/src/templates/chess.d.ts.map +0 -1
  365. package/src/capabilities/app-graph-builder.ts +0 -65
  366. package/src/capabilities/blueprint-definition.ts +0 -30
  367. package/src/capabilities/capabilities.ts +0 -12
  368. package/src/capabilities/compiler.ts +0 -34
  369. package/src/capabilities/intent-resolver.ts +0 -86
  370. package/src/capabilities/react-surface.tsx +0 -103
  371. package/src/capabilities/settings.ts +0 -21
  372. package/src/events.ts +0 -11
  373. package/src/templates/chess.ts +0 -49
  374. /package/dist/lib/browser/{DeploymentDialog-MZX4T77L.mjs.map → DeploymentDialog-GXNRUXF6.mjs.map} +0 -0
  375. /package/dist/lib/{node-esm/DeploymentDialog-GL5AUWMR.mjs.map → browser/blueprints/index.mjs.map} +0 -0
@@ -6,14 +6,15 @@ import { Octokit } from '@octokit/core';
6
6
  import React, { type ChangeEvent, useCallback, useState } from 'react';
7
7
 
8
8
  import { ToolId } from '@dxos/ai';
9
- import { SettingsAction, createIntent } from '@dxos/app-framework';
10
- import { useIntentDispatcher } from '@dxos/app-framework/react';
9
+ import { SettingsOperation } from '@dxos/app-framework';
10
+ import { useOperationInvoker } from '@dxos/app-framework/react';
11
11
  import { Blueprint, Template } from '@dxos/blueprints';
12
+ import { Filter, Obj, Ref } from '@dxos/echo';
12
13
  import { Function, type Script, getUserFunctionIdInMetadata } from '@dxos/functions';
13
14
  import { getInvocationUrl } from '@dxos/functions-runtime';
14
15
  import { log } from '@dxos/log';
15
16
  import { useClient } from '@dxos/react-client';
16
- import { Filter, Ref, getMeta, getSpace, useQuery } from '@dxos/react-client/echo';
17
+ import { useQuery } from '@dxos/react-client/echo';
17
18
  import { Button, Clipboard, Input, useAsyncEffect, useControlledState, useTranslation } from '@dxos/react-ui';
18
19
  import { AccessToken } from '@dxos/types';
19
20
  import { kebabize } from '@dxos/util';
@@ -43,7 +44,9 @@ export const ScriptProperties = ({ object }: ScriptObjectSettingsProps) => {
43
44
  placeholder={t('description placeholder')}
44
45
  value={object.description ?? ''}
45
46
  onChange={(event) => {
46
- object.description = event.target.value;
47
+ Obj.change(object, (o) => {
48
+ o.description = event.target.value;
49
+ });
47
50
  }}
48
51
  />
49
52
  </Input.Root>
@@ -52,9 +55,9 @@ export const ScriptProperties = ({ object }: ScriptObjectSettingsProps) => {
52
55
 
53
56
  const BlueprintEditor = ({ object }: ScriptObjectSettingsProps) => {
54
57
  const { t } = useTranslation(meta.id);
55
- const space = getSpace(object);
56
- const [fn] = useQuery(space, Filter.type(Function.Function, { source: Ref.make(object) }));
57
- const blueprints = useQuery(space, Filter.type(Blueprint.Blueprint));
58
+ const db = Obj.getDatabase(object);
59
+ const [fn] = useQuery(db, Filter.type(Function.Function, { source: Ref.make(object) }));
60
+ const blueprints = useQuery(db, Filter.type(Blueprint.Blueprint));
58
61
 
59
62
  const [creating, setCreating] = useState(false);
60
63
  const [instructions, setInstructions] = useState<string>(`You can run the script "${object.name ?? 'script'}".`);
@@ -70,7 +73,7 @@ const BlueprintEditor = ({ object }: ScriptObjectSettingsProps) => {
70
73
  }, [existingBlueprint]);
71
74
 
72
75
  const handleSave = useCallback(async () => {
73
- if (!space) {
76
+ if (!db) {
74
77
  return;
75
78
  }
76
79
 
@@ -78,15 +81,19 @@ const BlueprintEditor = ({ object }: ScriptObjectSettingsProps) => {
78
81
  try {
79
82
  if (existingBlueprint) {
80
83
  const text = await existingBlueprint.instructions.source.load();
81
- text.content = instructions;
84
+ Obj.change(text, (t) => {
85
+ t.content = instructions;
86
+ });
82
87
  if (fn?.key) {
83
88
  const toolId = ToolId.make(fn.key);
84
89
  if (!existingBlueprint.tools?.includes(toolId)) {
85
- existingBlueprint.tools = [...(existingBlueprint.tools ?? []), toolId];
90
+ Obj.change(existingBlueprint, (b) => {
91
+ b.tools = [...(b.tools ?? []), toolId];
92
+ });
86
93
  }
87
94
  }
88
95
  } else if (fn?.key) {
89
- space.db.add(
96
+ db.add(
90
97
  Blueprint.make({
91
98
  key: blueprintKey,
92
99
  name: object.name ?? 'Script',
@@ -97,11 +104,11 @@ const BlueprintEditor = ({ object }: ScriptObjectSettingsProps) => {
97
104
  }),
98
105
  );
99
106
  }
100
- await space.db.flush();
107
+ await db.flush();
101
108
  } finally {
102
109
  setCreating(false);
103
110
  }
104
- }, [space, existingBlueprint, fn, blueprintKey, object.name, instructions]);
111
+ }, [db, existingBlueprint, fn, blueprintKey, object.name, instructions]);
105
112
 
106
113
  return (
107
114
  <div className='flex flex-col gap-4 mlb-cardSpacingBlock'>
@@ -141,14 +148,14 @@ const BlueprintEditor = ({ object }: ScriptObjectSettingsProps) => {
141
148
  const Binding = ({ object }: ScriptObjectSettingsProps) => {
142
149
  const { t } = useTranslation(meta.id);
143
150
  const client = useClient();
144
- const space = getSpace(object);
145
- const [fn] = useQuery(space, Filter.type(Function.Function, { source: Ref.make(object) }));
151
+ const db = Obj.getDatabase(object);
152
+ const [fn] = useQuery(db, Filter.type(Function.Function, { source: Ref.make(object) }));
146
153
 
147
- const functionId = fn && getUserFunctionIdInMetadata(getMeta(fn));
154
+ const functionId = fn && getUserFunctionIdInMetadata(Obj.getMeta(fn));
148
155
  const functionUrl =
149
156
  functionId &&
150
157
  getInvocationUrl(functionId, client.config.values.runtime?.services?.edge?.url ?? '', {
151
- spaceId: space?.id,
158
+ spaceId: db?.spaceId,
152
159
  });
153
160
 
154
161
  const [binding, setBinding] = useControlledState(fn?.binding ?? '');
@@ -160,7 +167,9 @@ const Binding = ({ object }: ScriptObjectSettingsProps) => {
160
167
  );
161
168
 
162
169
  const handleBindingBlur = useCallback(() => {
163
- fn.binding = binding;
170
+ Obj.change(fn, (f) => {
171
+ f.binding = binding;
172
+ });
164
173
  }, [fn, binding]);
165
174
 
166
175
  if (!fn || !functionUrl) {
@@ -179,7 +188,9 @@ const Binding = ({ object }: ScriptObjectSettingsProps) => {
179
188
  disabled
180
189
  value={functionUrl}
181
190
  onChange={(event) => {
182
- fn.name = event.target.value;
191
+ Obj.change(fn, (f) => {
192
+ f.name = event.target.value;
193
+ });
183
194
  }}
184
195
  />
185
196
  <Clipboard.IconButton value={functionUrl} />
@@ -204,10 +215,10 @@ const Binding = ({ object }: ScriptObjectSettingsProps) => {
204
215
  // TODO(burdon): Move to separate tab?
205
216
  const Publishing = ({ object }: ScriptObjectSettingsProps) => {
206
217
  const { t } = useTranslation(meta.id);
207
- const { dispatchPromise: dispatch } = useIntentDispatcher();
208
- const space = getSpace(object);
209
- const [githubToken] = useQuery(space, Filter.type(AccessToken.AccessToken, { source: 'github.com' }));
210
- const gistKey = getMeta(object).keys.find(({ source }) => source === 'github.com');
218
+ const { invokePromise } = useOperationInvoker();
219
+ const db = Obj.getDatabase(object);
220
+ const [githubToken] = useQuery(db, Filter.type(AccessToken.AccessToken, { source: 'github.com' }));
221
+ const gistKey = Obj.getMeta(object).keys.find(({ source }) => source === 'github.com');
211
222
  const [gistUrl, setGistUrl] = useState<string | undefined>();
212
223
 
213
224
  useAsyncEffect(async () => {
@@ -232,12 +243,10 @@ const Publishing = ({ object }: ScriptObjectSettingsProps) => {
232
243
 
233
244
  const handleOpenTokenManager = useCallback(
234
245
  () =>
235
- dispatch(
236
- createIntent(SettingsAction.Open, {
237
- plugin: 'dxos.org/plugin/token-manager',
238
- }),
239
- ),
240
- [],
246
+ invokePromise(SettingsOperation.Open, {
247
+ plugin: 'dxos.org/plugin/token-manager',
248
+ }),
249
+ [invokePromise],
241
250
  );
242
251
 
243
252
  const [publishing, setPublishing] = useState(false);
@@ -250,7 +259,7 @@ const Publishing = ({ object }: ScriptObjectSettingsProps) => {
250
259
 
251
260
  try {
252
261
  // TODO(wittjosiah): Factor out to intent.
253
- const meta = getMeta(object);
262
+ const meta = Obj.getMeta(object);
254
263
  const githubKey = meta.keys.find(({ source }) => source === 'github.com');
255
264
  const gistId = githubKey?.id;
256
265
  if (gistId) {
@@ -263,8 +272,11 @@ const Publishing = ({ object }: ScriptObjectSettingsProps) => {
263
272
  public: true,
264
273
  files,
265
274
  });
266
- if (response.data.id) {
267
- meta.keys.push({ source: 'github.com', id: response.data.id });
275
+ const gistId = response.data.id;
276
+ if (gistId) {
277
+ Obj.change(object, (obj) => {
278
+ Obj.getMeta(obj).keys.push({ source: 'github.com', id: gistId });
279
+ });
268
280
  }
269
281
  }
270
282
  } finally {
@@ -6,14 +6,19 @@ import React from 'react';
6
6
 
7
7
  import { useClient } from '@dxos/react-client';
8
8
  import { Button, Select, useTranslation } from '@dxos/react-ui';
9
- import { type EditorInputMode, EditorInputModes } from '@dxos/react-ui-editor';
10
9
  import { ControlGroup, ControlItemInput, ControlPage, ControlSection } from '@dxos/react-ui-form';
10
+ import { type EditorInputMode, EditorInputModes } from '@dxos/ui-editor';
11
11
 
12
12
  import { meta } from '../../meta';
13
13
  import { type ScriptSettings } from '../../types';
14
14
  import { getAccessCredential } from '../../util';
15
15
 
16
- export const ScriptPluginSettings = ({ settings }: { settings: ScriptSettings }) => {
16
+ export type ScriptPluginSettingsComponentProps = {
17
+ settings: ScriptSettings;
18
+ onSettingsChange: (fn: (current: ScriptSettings) => ScriptSettings) => void;
19
+ };
20
+
21
+ export const ScriptPluginSettings = ({ settings, onSettingsChange }: ScriptPluginSettingsComponentProps) => {
17
22
  const { t } = useTranslation(meta.id);
18
23
  const client = useClient();
19
24
 
@@ -36,7 +41,7 @@ export const ScriptPluginSettings = ({ settings }: { settings: ScriptSettings })
36
41
  <Select.Root
37
42
  value={settings.editorInputMode ?? 'default'}
38
43
  onValueChange={(value) => {
39
- settings.editorInputMode = value as EditorInputMode;
44
+ onSettingsChange((s) => ({ ...s, editorInputMode: value as EditorInputMode }));
40
45
  }}
41
46
  >
42
47
  <Select.TriggerButton placeholder={t('select editor input mode placeholder')} />
@@ -5,7 +5,7 @@
5
5
  import React from 'react';
6
6
 
7
7
  import { type Script } from '@dxos/functions';
8
- import { StackItem } from '@dxos/react-ui-stack';
8
+ import { Layout } from '@dxos/react-ui-mosaic';
9
9
 
10
10
  import { useDeployState, useToolbarState } from '../../hooks';
11
11
 
@@ -16,12 +16,12 @@ export type TestContainerProps = {
16
16
  script: Script.Script;
17
17
  };
18
18
 
19
- export const TestContainer = ({ script }: TestContainerProps) => {
19
+ export const TestContainer = ({ role, script }: TestContainerProps) => {
20
20
  const state = useToolbarState();
21
21
  useDeployState({ state, script });
22
22
  return (
23
- <StackItem.Content>
24
- <TestPanel functionUrl={state.functionUrl} />
25
- </StackItem.Content>
23
+ <Layout.Main role={role}>
24
+ <TestPanel functionUrl={state.value.functionUrl} />
25
+ </Layout.Main>
26
26
  );
27
27
  };
@@ -7,7 +7,7 @@ import React, { forwardRef, useEffect, useRef, useState } from 'react';
7
7
  import { log } from '@dxos/log';
8
8
  import { Avatar, Icon, Input, type ThemedClassName, Toolbar, useTranslation } from '@dxos/react-ui';
9
9
  import { SyntaxHighlighter } from '@dxos/react-ui-syntax-highlighter';
10
- import { errorText, mx } from '@dxos/react-ui-theme';
10
+ import { errorText, mx } from '@dxos/ui-theme';
11
11
 
12
12
  import { meta } from '../../meta';
13
13
 
@@ -5,13 +5,13 @@
5
5
  import { type Meta, type StoryObj } from '@storybook/react-vite';
6
6
  import React, { useCallback, useMemo, useState } from 'react';
7
7
 
8
- import { createDocAccessor } from '@dxos/react-client/echo';
8
+ import { createDocAccessor } from '@dxos/echo-db';
9
9
  import { createObject } from '@dxos/react-client/echo';
10
10
  import { Toolbar } from '@dxos/react-ui';
11
11
  import { withLayout, withTheme } from '@dxos/react-ui/testing';
12
- import { createDataExtensions } from '@dxos/react-ui-editor';
13
- import { StackItem } from '@dxos/react-ui-stack';
12
+ import { Layout } from '@dxos/react-ui-mosaic';
14
13
  import { Json } from '@dxos/react-ui-syntax-highlighter';
14
+ import { createDataExtensions } from '@dxos/ui-editor';
15
15
  import { trim } from '@dxos/util';
16
16
 
17
17
  import { TypescriptEditor, type TypescriptEditorProps } from './TypescriptEditor';
@@ -35,7 +35,12 @@ const DefaultStory = (props: TypescriptEditorProps) => {
35
35
  // );
36
36
 
37
37
  const extensions = useMemo(
38
- () => [createDataExtensions({ id: object.id, text: createDocAccessor(object, ['content']) })],
38
+ () => [
39
+ createDataExtensions({
40
+ id: object.id,
41
+ text: createDocAccessor(object, ['content']),
42
+ }),
43
+ ],
39
44
  [],
40
45
  );
41
46
 
@@ -61,16 +66,16 @@ const DefaultStory = (props: TypescriptEditorProps) => {
61
66
  }, [object]);
62
67
 
63
68
  return (
64
- <StackItem.Content toolbar>
69
+ <Layout.Main toolbar>
65
70
  {/* <ScriptToolbar script={script} state={{}} /> */}
66
71
  <Toolbar.Root>
67
72
  <Toolbar.Button onClick={handleRun}>Run</Toolbar.Button>
68
73
  </Toolbar.Root>
69
74
  <div role='none' className='grid grid-rows-[1fr_min-content] bs-full overflow-hidden text-sm'>
70
75
  <TypescriptEditor {...props} initialValue={object.content} extensions={extensions} />
71
- <Json data={result} classNames='shrink-0 p-2 border-t border-subduedSeparator' />
76
+ <Json data={result} classNames='shrink-0 p-2 border-bs border-subduedSeparator' />
72
77
  </div>
73
- </StackItem.Content>
78
+ </Layout.Main>
74
79
  );
75
80
  };
76
81
 
@@ -78,7 +83,7 @@ const meta = {
78
83
  title: 'plugins/plugin-script/TypescriptEditor',
79
84
  component: TypescriptEditor,
80
85
  render: DefaultStory,
81
- decorators: [withTheme, withLayout({ container: 'column', classNames: 'is-prose' })],
86
+ decorators: [withTheme, withLayout({ layout: 'column', classNames: 'is-proseMaxWidth' })],
82
87
  } satisfies Meta<typeof DefaultStory>;
83
88
 
84
89
  export default meta;
@@ -12,20 +12,20 @@ import { tags } from '@lezer/highlight';
12
12
  import { type VirtualTypeScriptEnvironment } from '@typescript/vfs';
13
13
  import { continueKeymap } from '@valtown/codemirror-continue';
14
14
  import { type HoverInfo, tsAutocomplete, tsFacet, tsHover, tsLinter, tsSync } from '@valtown/codemirror-ts';
15
- import React from 'react';
15
+ import React, { memo } from 'react';
16
16
 
17
- import { Domino, type ThemeMode, type ThemedClassName, useThemeContext } from '@dxos/react-ui';
17
+ import { type ThemeMode, type ThemedClassName, useThemeContext } from '@dxos/react-ui';
18
+ import { type UseTextEditorProps, useTextEditor } from '@dxos/react-ui-editor';
19
+ import { Domino } from '@dxos/ui';
18
20
  import {
19
21
  type BasicExtensionsOptions,
20
22
  type EditorInputMode,
21
23
  InputModeExtensions,
22
- type UseTextEditorProps,
23
24
  createBasicExtensions,
24
25
  createThemeExtensions,
25
26
  defaultStyles,
26
- useTextEditor,
27
- } from '@dxos/react-ui-editor';
28
- import { mx } from '@dxos/react-ui-theme';
27
+ } from '@dxos/ui-editor';
28
+ import { mx } from '@dxos/ui-theme';
29
29
  import { isNonNullable } from '@dxos/util';
30
30
 
31
31
  export type TypescriptEditorProps = ThemedClassName<
@@ -39,66 +39,68 @@ export type TypescriptEditorProps = ThemedClassName<
39
39
  } & Pick<UseTextEditorProps, 'initialValue' | 'extensions' | 'scrollTo' | 'selection'>
40
40
  >;
41
41
 
42
- export const TypescriptEditor = ({
43
- classNames,
44
- id,
45
- role = 'article',
46
- inputMode = 'vscode',
47
- env,
48
- options,
49
- initialValue,
50
- extensions,
51
- scrollTo,
52
- selection,
53
- }: TypescriptEditorProps) => {
54
- const { themeMode } = useThemeContext();
55
- const { parentRef, focusAttributes } = useTextEditor(
56
- () => ({
57
- id,
58
- initialValue,
59
- selection,
60
- scrollTo,
61
- extensions: [
62
- extensions,
63
- createBasicExtensions({
64
- highlightActiveLine: true,
65
- indentWithTab: true,
66
- lineNumbers: true,
67
- lineWrapping: false,
68
- scrollPastEnd: role !== 'section',
69
- search: true,
70
- ...options,
71
- }),
72
- createThemeExtensions({
73
- monospace: true,
74
- themeMode,
75
- syntaxHighlighting: true,
76
- }),
77
- InputModeExtensions[inputMode],
42
+ export const TypescriptEditor = memo(
43
+ ({
44
+ classNames,
45
+ id,
46
+ role = 'article',
47
+ inputMode = 'vscode',
48
+ env,
49
+ options,
50
+ initialValue,
51
+ extensions,
52
+ scrollTo,
53
+ selection,
54
+ }: TypescriptEditorProps) => {
55
+ const { themeMode } = useThemeContext();
56
+ const { parentRef, focusAttributes } = useTextEditor(
57
+ () => ({
58
+ id,
59
+ initialValue,
60
+ selection,
61
+ scrollTo,
62
+ extensions: [
63
+ extensions,
64
+ createBasicExtensions({
65
+ highlightActiveLine: true,
66
+ indentWithTab: true,
67
+ lineNumbers: true,
68
+ lineWrapping: false,
69
+ scrollPastEnd: role !== 'section',
70
+ search: true,
71
+ ...options,
72
+ }),
73
+ createThemeExtensions({
74
+ monospace: true,
75
+ themeMode,
76
+ syntaxHighlighting: true,
77
+ }),
78
78
 
79
- javascript({ typescript: true }),
80
- autocompletion({ override: env ? [tsAutocomplete()] : undefined }),
79
+ InputModeExtensions[inputMode],
80
+ javascript({ typescript: true }),
81
+ autocompletion({ override: env ? [tsAutocomplete()] : undefined }),
81
82
 
82
- // Continues block comments when pressing Enter.
83
- Prec.high(keymap.of(continueKeymap)),
84
- keymap.of(completionKeymap),
85
- keymap.of(lintKeymap),
83
+ // Continues block comments when pressing Enter.
84
+ Prec.high(keymap.of(continueKeymap)),
85
+ keymap.of(completionKeymap),
86
+ keymap.of(lintKeymap),
86
87
 
87
- // https://github.com/val-town/codemirror-ts
88
- env && [
89
- tsFacet.of({ env, path: `/src/${id}.ts` }),
90
- tsSync(),
91
- tsLinter(),
92
- tsHover({ renderTooltip: createTooltipRenderer(themeMode) }),
93
- ],
94
- ].filter(isNonNullable),
95
- }),
96
- [id, extensions, themeMode, inputMode, selection, scrollTo],
97
- );
88
+ // https://github.com/val-town/codemirror-ts
89
+ env && [
90
+ // TODO(burdon): Fix type.
91
+ tsFacet.of({ env: env as any, path: `./src/${id}.ts` }),
92
+ tsSync(),
93
+ tsLinter(),
94
+ tsHover({ renderTooltip: createTooltipRenderer(themeMode) }),
95
+ ],
96
+ ].filter(isNonNullable),
97
+ }),
98
+ [themeMode, id, extensions, inputMode, selection, scrollTo, env],
99
+ );
98
100
 
99
- // TODO(brudon): Use react-ui-editor's Editor component.
100
- return <div ref={parentRef} className={mx(classNames)} {...focusAttributes} />;
101
- };
101
+ return <div ref={parentRef} className={mx(classNames)} {...focusAttributes} />;
102
+ },
103
+ );
102
104
 
103
105
  // TODO(burdon): Factor out (react-ui-editor).
104
106
  const createTooltipRenderer = (themeMode: ThemeMode) => {
@@ -121,15 +123,14 @@ const createTooltipRenderer = (themeMode: ThemeMode) => {
121
123
  };
122
124
 
123
125
  return (info: HoverInfo) => {
126
+ const children =
127
+ info.quickInfo?.displayParts?.map(({ kind, text }) =>
128
+ Domino.of('span').classNames(classFromKind(kind)).text(text),
129
+ ) ?? [];
124
130
  return {
125
131
  dom: Domino.of('div')
126
132
  .classNames('xs:max-is-80 max-is-lg p-1 bg-baseSurface rounded border border-separator')
127
- .children(
128
- ...(info.quickInfo?.displayParts?.map(({ kind, text }) =>
129
- Domino.of('span').classNames(classFromKind(kind)).text(text),
130
- ) ?? []),
131
- )
132
- .build(),
133
+ .children(...children).root,
133
134
  };
134
135
  };
135
136
  };
@@ -0,0 +1,92 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import { describe } from '@effect/vitest';
6
+ import { test } from 'vitest';
7
+
8
+ import { Client } from '@dxos/client';
9
+ import { type Space } from '@dxos/client-protocol';
10
+ import { configPreset } from '@dxos/config';
11
+ import { Function } from '@dxos/functions';
12
+ import { FunctionsServiceClient } from '@dxos/functions-runtime/edge';
13
+ import { bundleFunction } from '@dxos/functions-runtime/native';
14
+ import { FunctionRuntimeKind } from '@dxos/protocols';
15
+ import { EdgeReplicationSetting } from '@dxos/protocols/proto/dxos/echo/metadata';
16
+
17
+ // To heavy to run in CI.
18
+ describe.runIf(process.env.DX_TEST_TAGS?.includes('functions-e2e')).skip('Function', () => {
19
+ const config = configPreset({ edge: 'local' });
20
+
21
+ test('bundle anthropic function', { timeout: 120_000 }, async () => {
22
+ await bundleFunction({
23
+ entryPoint: new URL('../templates/anthropic.ts', import.meta.url).pathname,
24
+ verbose: true,
25
+ });
26
+ });
27
+
28
+ test('deploy empty function', { timeout: 120_000 }, async () => {
29
+ const { space, functionsServiceClient } = await setup();
30
+
31
+ await sync(space);
32
+ const func = await deployFunction(
33
+ space,
34
+ functionsServiceClient,
35
+ new URL('../templates/ping.ts', import.meta.url).pathname,
36
+ );
37
+ console.log(func);
38
+ throw new Error('test');
39
+ });
40
+
41
+ test('deploy and invoke anthropic function', { timeout: 120_000 }, async () => {
42
+ const { space, functionsServiceClient } = await setup();
43
+ await sync(space);
44
+ const func = await deployFunction(
45
+ space,
46
+ functionsServiceClient,
47
+ new URL('../templates/anthropic.ts', import.meta.url).pathname,
48
+ );
49
+
50
+ const result = await functionsServiceClient.invoke(func, {
51
+ message: 'Hello, world!',
52
+ });
53
+ console.log(result);
54
+ });
55
+
56
+ const setup = async () => {
57
+ const client = await new Client({ config, types: [Function.Function] }).initialize();
58
+ await client.halo.createIdentity();
59
+
60
+ const space = await client.spaces.create();
61
+ await space.waitUntilReady();
62
+ await space.internal.setEdgeReplicationPreference(EdgeReplicationSetting.ENABLED);
63
+
64
+ const functionsServiceClient = FunctionsServiceClient.fromClient(client);
65
+ return { client, space, functionsServiceClient };
66
+ };
67
+
68
+ const sync = async (space: Space) => {
69
+ await space.db.flush({ indexes: true });
70
+ await space.internal.syncToEdge({
71
+ onProgress: (state) =>
72
+ console.log(state ? `${state.unsyncedDocumentCount} documents syncing...` : 'connecting to edge...'),
73
+ });
74
+ };
75
+
76
+ const deployFunction = async (space: Space, functionsServiceClient: FunctionsServiceClient, entryPoint: string) => {
77
+ const artifact = await bundleFunction({
78
+ entryPoint,
79
+ verbose: true,
80
+ });
81
+ const func = await functionsServiceClient.deploy({
82
+ version: '0.0.1',
83
+ ownerPublicKey: space.key,
84
+ entryPoint: artifact.entryPoint,
85
+ assets: artifact.assets,
86
+ runtime: FunctionRuntimeKind.enums.WORKER_LOADER,
87
+ });
88
+
89
+ space.db.add(func);
90
+ return func;
91
+ };
92
+ });
@@ -0,0 +1,64 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import { readFile } from 'node:fs/promises';
6
+
7
+ import { describe, expect, test } from 'vitest';
8
+
9
+ import { Client, type Config } from '@dxos/client';
10
+ import { createEdgeIdentity } from '@dxos/client/edge';
11
+ import { configPreset } from '@dxos/config';
12
+ import { bundleFunction } from '@dxos/functions-runtime/bundler';
13
+ import { FunctionsServiceClient } from '@dxos/functions-runtime/edge';
14
+ import { invariant } from '@dxos/invariant';
15
+ import { log } from '@dxos/log';
16
+
17
+ describe.runIf(process.env.DX_TEST_TAGS?.includes('functions-e2e'))('Functions deployment', () => {
18
+ test('deploys FOREX (effect) function and invokes it via EDGE (main)', { timeout: 120_000 }, async () => {
19
+ const config = configPreset({ edge: 'main' });
20
+ await testDeploy(config);
21
+ });
22
+
23
+ test('deploys FOREX (effect) function and invokes it via EDGE (production)', { timeout: 120_000 }, async () => {
24
+ const config = configPreset({ edge: 'production' });
25
+ await testDeploy(config);
26
+ });
27
+
28
+ const testDeploy = async (config: Config) => {
29
+ await using client = await new Client({ config }).initialize();
30
+ await client.halo.createIdentity();
31
+
32
+ const space = await client.spaces.create();
33
+ await space.waitUntilReady();
34
+
35
+ // Inline echo function source.
36
+ const source = await readFile(new URL('../templates/forex-effect.ts', import.meta.url), 'utf-8');
37
+
38
+ // Bundle and upload.
39
+ const buildResult = await bundleFunction({ source });
40
+ if ('error' in buildResult) {
41
+ throw buildResult.error ?? new Error('Bundle creation failed');
42
+ }
43
+ const functionsServiceClient = FunctionsServiceClient.fromClient(client);
44
+
45
+ const func = await functionsServiceClient.deploy({
46
+ ownerPublicKey: space.key,
47
+ version: '0.0.1',
48
+ entryPoint: buildResult.entryPoint,
49
+ assets: buildResult.assets,
50
+ });
51
+
52
+ // Invoke deployed function via EDGE directly.
53
+ const edgeClient = client.edge;
54
+ invariant(edgeClient, 'edgeClient is required');
55
+ edgeClient.setIdentity(createEdgeIdentity(client));
56
+
57
+ const input = { from: 'USD', to: 'EUR' };
58
+ const result = await functionsServiceClient.invoke(func, input);
59
+ log.info('>>> result', { result, func });
60
+ const resultNumber = Number(result);
61
+ expect(resultNumber).toBeGreaterThan(0);
62
+ expect(resultNumber).toBeLessThan(100);
63
+ };
64
+ });