@dxos/plugin-script 0.8.4-main.ae835ea → 0.8.4-main.bcb3aa67d6

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 (510) hide show
  1. package/README.md +15 -13
  2. package/dist/lib/browser/DeploymentDialog-WUND47NK.mjs +115 -0
  3. package/dist/lib/browser/DeploymentDialog-WUND47NK.mjs.map +7 -0
  4. package/dist/lib/browser/{NotebookContainer-C36N7AFF.mjs → NotebookContainer-TGHMYWWK.mjs} +275 -254
  5. package/dist/lib/browser/NotebookContainer-TGHMYWWK.mjs.map +7 -0
  6. package/dist/lib/browser/ScriptContainer-BOCXMLNN.mjs +82 -0
  7. package/dist/lib/browser/ScriptContainer-BOCXMLNN.mjs.map +7 -0
  8. package/dist/lib/browser/ScriptObjectSettings-QKJFTSLS.mjs +295 -0
  9. package/dist/lib/browser/ScriptObjectSettings-QKJFTSLS.mjs.map +7 -0
  10. package/dist/lib/browser/ScriptPluginSettings-AMWZF7LZ.mjs +47 -0
  11. package/dist/lib/browser/ScriptPluginSettings-AMWZF7LZ.mjs.map +7 -0
  12. package/dist/lib/browser/ScriptProperties-VBOIIRJJ.mjs +26 -0
  13. package/dist/lib/browser/ScriptProperties-VBOIIRJJ.mjs.map +7 -0
  14. package/dist/lib/browser/TestContainer-5VNOC6I3.mjs +50 -0
  15. package/dist/lib/browser/TestContainer-5VNOC6I3.mjs.map +7 -0
  16. package/dist/lib/browser/access-token-created-XR7LB2XV.mjs +37 -0
  17. package/dist/lib/browser/access-token-created-XR7LB2XV.mjs.map +7 -0
  18. package/dist/lib/browser/blueprints/index.mjs +58 -0
  19. package/dist/lib/browser/blueprints/index.mjs.map +7 -0
  20. package/dist/lib/browser/chunk-AE5EX2VP.mjs +78 -0
  21. package/dist/lib/browser/chunk-AE5EX2VP.mjs.map +7 -0
  22. package/dist/lib/browser/chunk-DL37UOJE.mjs +105 -0
  23. package/dist/lib/browser/chunk-DL37UOJE.mjs.map +7 -0
  24. package/dist/lib/browser/chunk-TXVJW26E.mjs +50 -0
  25. package/dist/lib/browser/chunk-TXVJW26E.mjs.map +7 -0
  26. package/dist/lib/browser/chunk-ZLF66W2O.mjs +337 -0
  27. package/dist/lib/browser/chunk-ZLF66W2O.mjs.map +7 -0
  28. package/dist/lib/browser/create-V3MRNIUS.mjs +45 -0
  29. package/dist/lib/browser/create-V3MRNIUS.mjs.map +7 -0
  30. package/dist/lib/browser/create-script-IEY3HJ33.mjs +46 -0
  31. package/dist/lib/browser/create-script-IEY3HJ33.mjs.map +7 -0
  32. package/dist/lib/browser/delete-7QKDZ2QS.mjs +21 -0
  33. package/dist/lib/browser/delete-7QKDZ2QS.mjs.map +7 -0
  34. package/dist/lib/browser/deploy-SM2V6SNL.mjs +65 -0
  35. package/dist/lib/browser/deploy-SM2V6SNL.mjs.map +7 -0
  36. package/dist/lib/browser/index.mjs +1179 -232
  37. package/dist/lib/browser/index.mjs.map +4 -4
  38. package/dist/lib/browser/inspect-invocations-L4GAXXT3.mjs +55 -0
  39. package/dist/lib/browser/inspect-invocations-L4GAXXT3.mjs.map +7 -0
  40. package/dist/lib/browser/install-function-YDAA5EB6.mjs +54 -0
  41. package/dist/lib/browser/install-function-YDAA5EB6.mjs.map +7 -0
  42. package/dist/lib/browser/invoke-OKJMYOZB.mjs +36 -0
  43. package/dist/lib/browser/invoke-OKJMYOZB.mjs.map +7 -0
  44. package/dist/lib/browser/meta.json +1 -1
  45. package/dist/lib/browser/operations/index.mjs +14 -0
  46. package/dist/lib/browser/operations/index.mjs.map +7 -0
  47. package/dist/lib/browser/query-deployed-functions-L3SIQHB5.mjs +33 -0
  48. package/dist/lib/browser/query-deployed-functions-L3SIQHB5.mjs.map +7 -0
  49. package/dist/lib/browser/read-YL7TNJC7.mjs +26 -0
  50. package/dist/lib/browser/read-YL7TNJC7.mjs.map +7 -0
  51. package/dist/lib/browser/templates/index.mjs +1 -1
  52. package/dist/lib/browser/types/index.mjs +7 -7
  53. package/dist/lib/browser/update-4RC6QH62.mjs +63 -0
  54. package/dist/lib/browser/update-4RC6QH62.mjs.map +7 -0
  55. package/dist/lib/node-esm/DeploymentDialog-XMR2CKP6.mjs +116 -0
  56. package/dist/lib/node-esm/DeploymentDialog-XMR2CKP6.mjs.map +7 -0
  57. package/dist/lib/node-esm/{NotebookContainer-FOVFGJQR.mjs → NotebookContainer-YUVZF6IS.mjs} +275 -254
  58. package/dist/lib/node-esm/NotebookContainer-YUVZF6IS.mjs.map +7 -0
  59. package/dist/lib/node-esm/ScriptContainer-G4D2YSFE.mjs +83 -0
  60. package/dist/lib/node-esm/ScriptContainer-G4D2YSFE.mjs.map +7 -0
  61. package/dist/lib/node-esm/ScriptObjectSettings-XIOE66BL.mjs +296 -0
  62. package/dist/lib/node-esm/ScriptObjectSettings-XIOE66BL.mjs.map +7 -0
  63. package/dist/lib/node-esm/ScriptPluginSettings-SDWEDLUU.mjs +48 -0
  64. package/dist/lib/node-esm/ScriptPluginSettings-SDWEDLUU.mjs.map +7 -0
  65. package/dist/lib/node-esm/ScriptProperties-5H2Z4XRF.mjs +27 -0
  66. package/dist/lib/node-esm/ScriptProperties-5H2Z4XRF.mjs.map +7 -0
  67. package/dist/lib/node-esm/TestContainer-SEFC4F2O.mjs +51 -0
  68. package/dist/lib/node-esm/TestContainer-SEFC4F2O.mjs.map +7 -0
  69. package/dist/lib/node-esm/access-token-created-AZEUHFPA.mjs +38 -0
  70. package/dist/lib/node-esm/access-token-created-AZEUHFPA.mjs.map +7 -0
  71. package/dist/lib/node-esm/blueprints/index.mjs +59 -0
  72. package/dist/lib/node-esm/blueprints/index.mjs.map +7 -0
  73. package/dist/lib/node-esm/chunk-ELIPYPNQ.mjs +79 -0
  74. package/dist/lib/node-esm/chunk-ELIPYPNQ.mjs.map +7 -0
  75. package/dist/lib/node-esm/chunk-QZMVI6AH.mjs +339 -0
  76. package/dist/lib/node-esm/chunk-QZMVI6AH.mjs.map +7 -0
  77. package/dist/lib/node-esm/chunk-U2LUPXPK.mjs +51 -0
  78. package/dist/lib/node-esm/chunk-U2LUPXPK.mjs.map +7 -0
  79. package/dist/lib/node-esm/chunk-ZLTGO4XB.mjs +107 -0
  80. package/dist/lib/node-esm/chunk-ZLTGO4XB.mjs.map +7 -0
  81. package/dist/lib/node-esm/create-XQAER3WF.mjs +46 -0
  82. package/dist/lib/node-esm/create-XQAER3WF.mjs.map +7 -0
  83. package/dist/lib/node-esm/create-script-2CGVQ3AU.mjs +47 -0
  84. package/dist/lib/node-esm/create-script-2CGVQ3AU.mjs.map +7 -0
  85. package/dist/lib/node-esm/delete-JA2S3K6Z.mjs +22 -0
  86. package/dist/lib/node-esm/delete-JA2S3K6Z.mjs.map +7 -0
  87. package/dist/lib/node-esm/deploy-FILYYRWE.mjs +66 -0
  88. package/dist/lib/node-esm/deploy-FILYYRWE.mjs.map +7 -0
  89. package/dist/lib/node-esm/index.mjs +1179 -232
  90. package/dist/lib/node-esm/index.mjs.map +4 -4
  91. package/dist/lib/node-esm/inspect-invocations-PLSHQCFM.mjs +56 -0
  92. package/dist/lib/node-esm/inspect-invocations-PLSHQCFM.mjs.map +7 -0
  93. package/dist/lib/node-esm/install-function-4TVXEWYF.mjs +55 -0
  94. package/dist/lib/node-esm/install-function-4TVXEWYF.mjs.map +7 -0
  95. package/dist/lib/node-esm/invoke-J4Z7CS44.mjs +37 -0
  96. package/dist/lib/node-esm/invoke-J4Z7CS44.mjs.map +7 -0
  97. package/dist/lib/node-esm/meta.json +1 -1
  98. package/dist/lib/node-esm/operations/index.mjs +15 -0
  99. package/dist/lib/node-esm/operations/index.mjs.map +7 -0
  100. package/dist/lib/node-esm/query-deployed-functions-JBYIJGLW.mjs +34 -0
  101. package/dist/lib/node-esm/query-deployed-functions-JBYIJGLW.mjs.map +7 -0
  102. package/dist/lib/node-esm/read-HDE5XOGZ.mjs +27 -0
  103. package/dist/lib/node-esm/read-HDE5XOGZ.mjs.map +7 -0
  104. package/dist/lib/node-esm/templates/index.mjs +1 -1
  105. package/dist/lib/node-esm/types/index.mjs +7 -7
  106. package/dist/lib/node-esm/update-6O53SY6U.mjs +64 -0
  107. package/dist/lib/node-esm/update-6O53SY6U.mjs.map +7 -0
  108. package/dist/types/src/ScriptPlugin.d.ts +2 -1
  109. package/dist/types/src/ScriptPlugin.d.ts.map +1 -1
  110. package/dist/types/src/blueprints/functions/create.d.ts +11 -0
  111. package/dist/types/src/blueprints/functions/create.d.ts.map +1 -0
  112. package/dist/types/src/blueprints/functions/definitions.d.ts +142 -0
  113. package/dist/types/src/blueprints/functions/definitions.d.ts.map +1 -0
  114. package/dist/types/src/blueprints/functions/delete.d.ts +18 -0
  115. package/dist/types/src/blueprints/functions/delete.d.ts.map +1 -0
  116. package/dist/types/src/blueprints/functions/deploy.d.ts +22 -0
  117. package/dist/types/src/blueprints/functions/deploy.d.ts.map +1 -0
  118. package/dist/types/src/blueprints/functions/index.d.ts +4 -0
  119. package/dist/types/src/blueprints/functions/index.d.ts.map +1 -0
  120. package/dist/types/src/blueprints/functions/inspect-invocations.d.ts +30 -0
  121. package/dist/types/src/blueprints/functions/inspect-invocations.d.ts.map +1 -0
  122. package/dist/types/src/blueprints/functions/install-function.d.ts +11 -0
  123. package/dist/types/src/blueprints/functions/install-function.d.ts.map +1 -0
  124. package/dist/types/src/blueprints/functions/invoke.d.ts +22 -0
  125. package/dist/types/src/blueprints/functions/invoke.d.ts.map +1 -0
  126. package/dist/types/src/blueprints/functions/query-deployed-functions.d.ts +13 -0
  127. package/dist/types/src/blueprints/functions/query-deployed-functions.d.ts.map +1 -0
  128. package/dist/types/src/blueprints/functions/read.d.ts +22 -0
  129. package/dist/types/src/blueprints/functions/read.d.ts.map +1 -0
  130. package/dist/types/src/blueprints/functions/update.d.ts +27 -0
  131. package/dist/types/src/blueprints/functions/update.d.ts.map +1 -0
  132. package/dist/types/src/blueprints/index.d.ts +2 -0
  133. package/dist/types/src/blueprints/index.d.ts.map +1 -0
  134. package/dist/types/src/blueprints/script-blueprint.d.ts +4 -0
  135. package/dist/types/src/blueprints/script-blueprint.d.ts.map +1 -0
  136. package/dist/types/src/capabilities/app-graph-builder.d.ts +4 -2
  137. package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
  138. package/dist/types/src/capabilities/artifact-definition.d.ts +3 -2
  139. package/dist/types/src/capabilities/artifact-definition.d.ts.map +1 -1
  140. package/dist/types/src/capabilities/blueprint-definition.d.ts +5 -4
  141. package/dist/types/src/capabilities/blueprint-definition.d.ts.map +1 -1
  142. package/dist/types/src/capabilities/compiler.d.ts +3 -1
  143. package/dist/types/src/capabilities/compiler.d.ts.map +1 -1
  144. package/dist/types/src/capabilities/index.d.ts +12 -7
  145. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  146. package/dist/types/src/capabilities/operation-handler.d.ts +6 -0
  147. package/dist/types/src/capabilities/operation-handler.d.ts.map +1 -0
  148. package/dist/types/src/capabilities/react-surface.d.ts +3 -2
  149. package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
  150. package/dist/types/src/capabilities/settings.d.ts +8 -2
  151. package/dist/types/src/capabilities/settings.d.ts.map +1 -1
  152. package/dist/types/src/compiler/compiler.d.ts +1 -1
  153. package/dist/types/src/compiler/compiler.d.ts.map +1 -1
  154. package/dist/types/src/components/FramePanel/FramePanel.d.ts +12 -0
  155. package/dist/types/src/components/FramePanel/FramePanel.d.ts.map +1 -0
  156. package/dist/types/src/components/FramePanel/index.d.ts +2 -0
  157. package/dist/types/src/components/FramePanel/index.d.ts.map +1 -0
  158. package/dist/types/src/components/NotebookStack/NotebookCell.d.ts +4 -4
  159. package/dist/types/src/components/NotebookStack/NotebookCell.d.ts.map +1 -1
  160. package/dist/types/src/components/NotebookStack/NotebookMenu.d.ts +1 -1
  161. package/dist/types/src/components/NotebookStack/NotebookMenu.d.ts.map +1 -1
  162. package/dist/types/src/components/NotebookStack/NotebookStack.d.ts +9 -3
  163. package/dist/types/src/components/NotebookStack/NotebookStack.d.ts.map +1 -1
  164. package/dist/types/src/components/NotebookStack/NotebookStack.stories.d.ts +242 -226
  165. package/dist/types/src/components/NotebookStack/NotebookStack.stories.d.ts.map +1 -1
  166. package/dist/types/src/components/QueryEditor/QueryEditor.d.ts +5 -0
  167. package/dist/types/src/components/QueryEditor/QueryEditor.d.ts.map +1 -0
  168. package/dist/types/src/components/QueryEditor/QueryEditor.stories.d.ts +13 -0
  169. package/dist/types/src/components/QueryEditor/QueryEditor.stories.d.ts.map +1 -0
  170. package/dist/types/src/components/QueryEditor/index.d.ts +2 -0
  171. package/dist/types/src/components/QueryEditor/index.d.ts.map +1 -0
  172. package/dist/types/src/components/ScriptPluginSettings/ScriptPluginSettings.d.ts +8 -0
  173. package/dist/types/src/components/ScriptPluginSettings/ScriptPluginSettings.d.ts.map +1 -0
  174. package/dist/types/src/components/ScriptPluginSettings/ScriptPluginSettings.stories.d.ts +262 -0
  175. package/dist/types/src/components/ScriptPluginSettings/ScriptPluginSettings.stories.d.ts.map +1 -0
  176. package/dist/types/src/components/ScriptPluginSettings/index.d.ts +3 -0
  177. package/dist/types/src/components/ScriptPluginSettings/index.d.ts.map +1 -0
  178. package/dist/types/src/components/ScriptToolbar/ScriptToolbar.d.ts +11 -5
  179. package/dist/types/src/components/ScriptToolbar/ScriptToolbar.d.ts.map +1 -1
  180. package/dist/types/src/components/ScriptToolbar/ScriptToolbar.stories.d.ts +242 -226
  181. package/dist/types/src/components/ScriptToolbar/ScriptToolbar.stories.d.ts.map +1 -1
  182. package/dist/types/src/components/TestPanel/TestPanel.d.ts +8 -2
  183. package/dist/types/src/components/TestPanel/TestPanel.d.ts.map +1 -1
  184. package/dist/types/src/components/TestPanel/index.d.ts +0 -1
  185. package/dist/types/src/components/TestPanel/index.d.ts.map +1 -1
  186. package/dist/types/src/components/TypescriptEditor/TypescriptEditor.d.ts +9 -2
  187. package/dist/types/src/components/TypescriptEditor/TypescriptEditor.d.ts.map +1 -1
  188. package/dist/types/src/components/TypescriptEditor/TypescriptEditor.stories.d.ts +7 -1
  189. package/dist/types/src/components/TypescriptEditor/TypescriptEditor.stories.d.ts.map +1 -1
  190. package/dist/types/src/components/index.d.ts +6 -5
  191. package/dist/types/src/components/index.d.ts.map +1 -1
  192. package/dist/types/src/constants.d.ts +2 -0
  193. package/dist/types/src/constants.d.ts.map +1 -0
  194. package/dist/types/src/{components → containers}/DeploymentDialog/DeploymentDialog.d.ts +2 -4
  195. package/dist/types/src/containers/DeploymentDialog/DeploymentDialog.d.ts.map +1 -0
  196. package/dist/types/src/containers/DeploymentDialog/DeploymentDialog.stories.d.ts +261 -0
  197. package/dist/types/src/containers/DeploymentDialog/DeploymentDialog.stories.d.ts.map +1 -0
  198. package/dist/types/src/containers/DeploymentDialog/index.d.ts +3 -0
  199. package/dist/types/src/containers/DeploymentDialog/index.d.ts.map +1 -0
  200. package/dist/types/src/containers/NotebookContainer/NotebookContainer.d.ts +7 -0
  201. package/dist/types/src/containers/NotebookContainer/NotebookContainer.d.ts.map +1 -0
  202. package/dist/types/src/containers/NotebookContainer/NotebookContainer.stories.d.ts +7 -0
  203. package/dist/types/src/containers/NotebookContainer/NotebookContainer.stories.d.ts.map +1 -0
  204. package/dist/types/src/containers/NotebookContainer/index.d.ts +3 -0
  205. package/dist/types/src/containers/NotebookContainer/index.d.ts.map +1 -0
  206. package/dist/types/src/containers/ScriptContainer/ScriptContainer.d.ts +10 -0
  207. package/dist/types/src/containers/ScriptContainer/ScriptContainer.d.ts.map +1 -0
  208. package/dist/types/src/containers/ScriptContainer/index.d.ts +3 -0
  209. package/dist/types/src/containers/ScriptContainer/index.d.ts.map +1 -0
  210. package/dist/types/src/{components/Settings → containers/ScriptObjectSettings}/ScriptObjectSettings.d.ts +0 -1
  211. package/dist/types/src/containers/ScriptObjectSettings/ScriptObjectSettings.d.ts.map +1 -0
  212. package/dist/types/src/containers/ScriptObjectSettings/index.d.ts +3 -0
  213. package/dist/types/src/containers/ScriptObjectSettings/index.d.ts.map +1 -0
  214. package/dist/types/src/containers/ScriptProperties/ScriptProperties.d.ts +7 -0
  215. package/dist/types/src/containers/ScriptProperties/ScriptProperties.d.ts.map +1 -0
  216. package/dist/types/src/containers/ScriptProperties/index.d.ts +3 -0
  217. package/dist/types/src/containers/ScriptProperties/index.d.ts.map +1 -0
  218. package/dist/types/src/{components/TestPanel → containers/TestContainer}/TestContainer.d.ts +1 -1
  219. package/dist/types/src/containers/TestContainer/TestContainer.d.ts.map +1 -0
  220. package/dist/types/src/containers/TestContainer/index.d.ts +3 -0
  221. package/dist/types/src/containers/TestContainer/index.d.ts.map +1 -0
  222. package/dist/types/src/containers/index.d.ts +8 -0
  223. package/dist/types/src/containers/index.d.ts.map +1 -0
  224. package/dist/types/src/e2e/ai.test.d.ts +2 -0
  225. package/dist/types/src/e2e/ai.test.d.ts.map +1 -0
  226. package/dist/types/src/e2e/deploy.test.d.ts +2 -0
  227. package/dist/types/src/e2e/deploy.test.d.ts.map +1 -0
  228. package/dist/types/src/hooks/deploy.d.ts +25 -26
  229. package/dist/types/src/hooks/deploy.d.ts.map +1 -1
  230. package/dist/types/src/hooks/format.d.ts +3 -2
  231. package/dist/types/src/hooks/format.d.ts.map +1 -1
  232. package/dist/types/src/hooks/index.d.ts +1 -0
  233. package/dist/types/src/hooks/index.d.ts.map +1 -1
  234. package/dist/types/src/hooks/template.d.ts +3 -2
  235. package/dist/types/src/hooks/template.d.ts.map +1 -1
  236. package/dist/types/src/hooks/useCompiler.d.ts +7 -0
  237. package/dist/types/src/hooks/useCompiler.d.ts.map +1 -0
  238. package/dist/types/src/hooks/useCreateAndDeployScriptTemplates.d.ts.map +1 -1
  239. package/dist/types/src/hooks/useToolbarState.d.ts +8 -1
  240. package/dist/types/src/hooks/useToolbarState.d.ts.map +1 -1
  241. package/dist/types/src/index.d.ts +2 -1
  242. package/dist/types/src/index.d.ts.map +1 -1
  243. package/dist/types/src/meta.d.ts +2 -2
  244. package/dist/types/src/meta.d.ts.map +1 -1
  245. package/dist/types/src/notebook/compute-graph.d.ts +25 -12
  246. package/dist/types/src/notebook/compute-graph.d.ts.map +1 -1
  247. package/dist/types/src/operations/access-token-created.d.ts +5 -0
  248. package/dist/types/src/operations/access-token-created.d.ts.map +1 -0
  249. package/dist/types/src/operations/create-script.d.ts +5 -0
  250. package/dist/types/src/operations/create-script.d.ts.map +1 -0
  251. package/dist/types/src/operations/definitions.d.ts +29 -0
  252. package/dist/types/src/operations/definitions.d.ts.map +1 -0
  253. package/dist/types/src/operations/index.d.ts +4 -0
  254. package/dist/types/src/operations/index.d.ts.map +1 -0
  255. package/dist/types/src/templates/anthropic.d.ts +7 -0
  256. package/dist/types/src/templates/anthropic.d.ts.map +1 -0
  257. package/dist/types/src/templates/chess-bot.d.ts +18 -0
  258. package/dist/types/src/templates/chess-bot.d.ts.map +1 -0
  259. package/dist/types/src/templates/commentary.d.ts +19 -0
  260. package/dist/types/src/templates/commentary.d.ts.map +1 -0
  261. package/dist/types/src/templates/forex-effect.d.ts +5 -1
  262. package/dist/types/src/templates/forex-effect.d.ts.map +1 -1
  263. package/dist/types/src/templates/forex.d.ts +5 -1
  264. package/dist/types/src/templates/forex.d.ts.map +1 -1
  265. package/dist/types/src/templates/index.d.ts +25 -16
  266. package/dist/types/src/templates/index.d.ts.map +1 -1
  267. package/dist/types/src/templates/ping.d.ts +2 -4
  268. package/dist/types/src/templates/ping.d.ts.map +1 -1
  269. package/dist/types/src/testing/data.d.ts +1 -1
  270. package/dist/types/src/testing/data.d.ts.map +1 -1
  271. package/dist/types/src/testing/simulator.test.d.ts +2 -0
  272. package/dist/types/src/testing/simulator.test.d.ts.map +1 -0
  273. package/dist/types/src/translations.d.ts +91 -84
  274. package/dist/types/src/translations.d.ts.map +1 -1
  275. package/dist/types/src/types/Notebook.d.ts +108 -23
  276. package/dist/types/src/types/Notebook.d.ts.map +1 -1
  277. package/dist/types/src/types/Settings.d.ts +6 -0
  278. package/dist/types/src/types/Settings.d.ts.map +1 -0
  279. package/dist/types/src/types/capabilities.d.ts +12 -0
  280. package/dist/types/src/types/capabilities.d.ts.map +1 -0
  281. package/dist/types/src/types/events.d.ts +5 -0
  282. package/dist/types/src/types/events.d.ts.map +1 -0
  283. package/dist/types/src/types/index.d.ts +2 -1
  284. package/dist/types/src/types/index.d.ts.map +1 -1
  285. package/dist/types/src/types/types.d.ts +1 -5
  286. package/dist/types/src/types/types.d.ts.map +1 -1
  287. package/dist/types/src/util/deploy.d.ts +3 -2
  288. package/dist/types/src/util/deploy.d.ts.map +1 -1
  289. package/dist/types/src/util/functions.d.ts +3 -2
  290. package/dist/types/src/util/functions.d.ts.map +1 -1
  291. package/dist/types/tsconfig.tsbuildinfo +1 -1
  292. package/package.json +136 -86
  293. package/src/ScriptPlugin.tsx +64 -86
  294. package/src/blueprints/functions/create.ts +48 -0
  295. package/src/blueprints/functions/definitions.ts +324 -0
  296. package/src/blueprints/functions/delete.ts +23 -0
  297. package/src/blueprints/functions/deploy.ts +70 -0
  298. package/src/blueprints/functions/index.ts +19 -0
  299. package/src/blueprints/functions/inspect-invocations.ts +55 -0
  300. package/src/blueprints/functions/install-function.ts +56 -0
  301. package/src/blueprints/functions/invoke.ts +35 -0
  302. package/src/blueprints/functions/query-deployed-functions.ts +31 -0
  303. package/src/blueprints/functions/read.ts +30 -0
  304. package/src/blueprints/functions/update.ts +69 -0
  305. package/src/blueprints/index.ts +5 -0
  306. package/src/blueprints/script-blueprint.ts +56 -0
  307. package/src/capabilities/app-graph-builder.ts +39 -57
  308. package/src/capabilities/artifact-definition.ts +97 -95
  309. package/src/capabilities/blueprint-definition.ts +11 -24
  310. package/src/capabilities/compiler.ts +92 -23
  311. package/src/capabilities/index.ts +11 -9
  312. package/src/capabilities/operation-handler.ts +20 -0
  313. package/src/capabilities/react-surface.tsx +132 -82
  314. package/src/capabilities/settings.ts +26 -14
  315. package/src/compiler/compiler.ts +10 -3
  316. package/src/components/{FrameContainer/FrameContainer.tsx → FramePanel/FramePanel.tsx} +8 -7
  317. package/src/components/{FrameContainer → FramePanel}/index.ts +1 -1
  318. package/src/components/NotebookStack/NotebookCell.tsx +40 -33
  319. package/src/components/NotebookStack/NotebookMenu.tsx +7 -7
  320. package/src/components/NotebookStack/NotebookStack.stories.tsx +21 -22
  321. package/src/components/NotebookStack/NotebookStack.tsx +30 -19
  322. package/src/components/QueryEditor/QueryEditor.stories.tsx +96 -0
  323. package/src/components/QueryEditor/QueryEditor.tsx +47 -0
  324. package/src/components/QueryEditor/index.ts +5 -0
  325. package/src/components/ScriptPluginSettings/ScriptPluginSettings.stories.tsx +32 -0
  326. package/src/components/ScriptPluginSettings/ScriptPluginSettings.tsx +64 -0
  327. package/src/components/ScriptPluginSettings/index.ts +7 -0
  328. package/src/components/ScriptToolbar/ScriptToolbar.stories.tsx +39 -17
  329. package/src/components/ScriptToolbar/ScriptToolbar.tsx +39 -44
  330. package/src/components/TestPanel/TestPanel.tsx +121 -178
  331. package/src/components/TestPanel/index.ts +0 -1
  332. package/src/components/TypescriptEditor/TypescriptEditor.stories.tsx +25 -18
  333. package/src/components/TypescriptEditor/TypescriptEditor.tsx +73 -66
  334. package/src/components/index.ts +7 -8
  335. package/src/constants.ts +7 -0
  336. package/src/{components → containers}/DeploymentDialog/DeploymentDialog.stories.tsx +30 -25
  337. package/src/containers/DeploymentDialog/DeploymentDialog.tsx +98 -0
  338. package/src/containers/DeploymentDialog/index.ts +7 -0
  339. package/src/{components → containers/NotebookContainer}/NotebookContainer.stories.tsx +30 -29
  340. package/src/{components → containers/NotebookContainer}/NotebookContainer.tsx +97 -92
  341. package/src/containers/NotebookContainer/index.ts +7 -0
  342. package/src/containers/ScriptContainer/ScriptContainer.tsx +85 -0
  343. package/src/containers/ScriptContainer/index.ts +7 -0
  344. package/src/{components/Settings → containers/ScriptObjectSettings}/ScriptObjectSettings.tsx +84 -75
  345. package/src/containers/ScriptObjectSettings/index.ts +7 -0
  346. package/src/containers/ScriptProperties/ScriptProperties.tsx +33 -0
  347. package/src/containers/ScriptProperties/index.ts +7 -0
  348. package/src/containers/TestContainer/TestContainer.tsx +45 -0
  349. package/src/containers/TestContainer/index.ts +7 -0
  350. package/src/containers/index.ts +12 -0
  351. package/src/e2e/ai.test.ts +93 -0
  352. package/src/e2e/deploy.test.ts +65 -0
  353. package/src/hooks/deploy.ts +44 -35
  354. package/src/hooks/format.ts +8 -3
  355. package/src/hooks/index.ts +1 -0
  356. package/src/hooks/template.ts +17 -11
  357. package/src/hooks/useCompiler.ts +24 -0
  358. package/src/hooks/useCreateAndDeployScriptTemplates.ts +13 -15
  359. package/src/hooks/useToolbarState.ts +29 -4
  360. package/src/index.ts +2 -1
  361. package/src/meta.ts +4 -4
  362. package/src/notebook/compute-graph.test.ts +21 -9
  363. package/src/notebook/compute-graph.ts +46 -22
  364. package/src/operations/access-token-created.ts +36 -0
  365. package/src/operations/create-script.ts +47 -0
  366. package/src/operations/definitions.ts +40 -0
  367. package/src/operations/index.ts +12 -0
  368. package/src/templates/anthropic.ts +49 -0
  369. package/src/templates/chat.ts +1 -1
  370. package/src/templates/chess-bot.ts +61 -0
  371. package/src/templates/commentary.ts +244 -0
  372. package/src/templates/data-generator.ts +2 -2
  373. package/src/templates/discord.ts +3 -3
  374. package/src/templates/forex-effect.ts +35 -29
  375. package/src/templates/forex.ts +27 -17
  376. package/src/templates/gmail.ts +5 -6
  377. package/src/templates/index.ts +31 -18
  378. package/src/templates/ping.ts +22 -5
  379. package/src/testing/data.ts +8 -8
  380. package/src/testing/simulator.test.ts +40 -0
  381. package/src/translations.ts +92 -84
  382. package/src/types/Notebook.ts +19 -15
  383. package/src/types/Settings.ts +17 -0
  384. package/src/types/capabilities.ts +17 -0
  385. package/src/types/events.ts +11 -0
  386. package/src/types/index.ts +2 -1
  387. package/src/types/types.ts +1 -11
  388. package/src/util/deploy.ts +28 -32
  389. package/src/util/functions.ts +31 -26
  390. package/src/vite-env.d.ts +2 -0
  391. package/dist/lib/browser/DeploymentDialog-E5NXT4UQ.mjs +0 -14
  392. package/dist/lib/browser/DeploymentDialog-E5NXT4UQ.mjs.map +0 -7
  393. package/dist/lib/browser/NotebookContainer-C36N7AFF.mjs.map +0 -7
  394. package/dist/lib/browser/ScriptContainer-4YPRUM3C.mjs +0 -148
  395. package/dist/lib/browser/ScriptContainer-4YPRUM3C.mjs.map +0 -7
  396. package/dist/lib/browser/app-graph-builder-LEOPGBJD.mjs +0 -66
  397. package/dist/lib/browser/app-graph-builder-LEOPGBJD.mjs.map +0 -7
  398. package/dist/lib/browser/blueprint-definition-6PZWZM2Y.mjs +0 -30
  399. package/dist/lib/browser/blueprint-definition-6PZWZM2Y.mjs.map +0 -7
  400. package/dist/lib/browser/chunk-5S5YQNJZ.mjs +0 -304
  401. package/dist/lib/browser/chunk-5S5YQNJZ.mjs.map +0 -7
  402. package/dist/lib/browser/chunk-A5K3TXYA.mjs +0 -269
  403. package/dist/lib/browser/chunk-A5K3TXYA.mjs.map +0 -7
  404. package/dist/lib/browser/chunk-EB6AXFXO.mjs +0 -31
  405. package/dist/lib/browser/chunk-EB6AXFXO.mjs.map +0 -7
  406. package/dist/lib/browser/chunk-HCURXADW.mjs +0 -102
  407. package/dist/lib/browser/chunk-HCURXADW.mjs.map +0 -7
  408. package/dist/lib/browser/chunk-HHTOAI2J.mjs +0 -644
  409. package/dist/lib/browser/chunk-HHTOAI2J.mjs.map +0 -7
  410. package/dist/lib/browser/chunk-IQMYIWHG.mjs +0 -153
  411. package/dist/lib/browser/chunk-IQMYIWHG.mjs.map +0 -7
  412. package/dist/lib/browser/chunk-LI4P25M5.mjs +0 -111
  413. package/dist/lib/browser/chunk-LI4P25M5.mjs.map +0 -7
  414. package/dist/lib/browser/chunk-Q2DGRQRN.mjs +0 -255
  415. package/dist/lib/browser/chunk-Q2DGRQRN.mjs.map +0 -7
  416. package/dist/lib/browser/chunk-ST3ACVUC.mjs +0 -88
  417. package/dist/lib/browser/chunk-ST3ACVUC.mjs.map +0 -7
  418. package/dist/lib/browser/chunk-UOQ6NCH3.mjs +0 -15
  419. package/dist/lib/browser/chunk-UOQ6NCH3.mjs.map +0 -7
  420. package/dist/lib/browser/compiler-Q4UY2COU.mjs +0 -86
  421. package/dist/lib/browser/compiler-Q4UY2COU.mjs.map +0 -7
  422. package/dist/lib/browser/intent-resolver-AMMHATM7.mjs +0 -105
  423. package/dist/lib/browser/intent-resolver-AMMHATM7.mjs.map +0 -7
  424. package/dist/lib/browser/react-surface-X4NATU6B.mjs +0 -128
  425. package/dist/lib/browser/react-surface-X4NATU6B.mjs.map +0 -7
  426. package/dist/lib/browser/settings-6UXY7F7D.mjs +0 -26
  427. package/dist/lib/browser/settings-6UXY7F7D.mjs.map +0 -7
  428. package/dist/lib/node-esm/DeploymentDialog-OSHHSEBH.mjs +0 -15
  429. package/dist/lib/node-esm/DeploymentDialog-OSHHSEBH.mjs.map +0 -7
  430. package/dist/lib/node-esm/NotebookContainer-FOVFGJQR.mjs.map +0 -7
  431. package/dist/lib/node-esm/ScriptContainer-EW24D5II.mjs +0 -149
  432. package/dist/lib/node-esm/ScriptContainer-EW24D5II.mjs.map +0 -7
  433. package/dist/lib/node-esm/app-graph-builder-XJ3MY5BM.mjs +0 -67
  434. package/dist/lib/node-esm/app-graph-builder-XJ3MY5BM.mjs.map +0 -7
  435. package/dist/lib/node-esm/blueprint-definition-5R6YCSZZ.mjs +0 -31
  436. package/dist/lib/node-esm/blueprint-definition-5R6YCSZZ.mjs.map +0 -7
  437. package/dist/lib/node-esm/chunk-2GVTWESW.mjs +0 -90
  438. package/dist/lib/node-esm/chunk-2GVTWESW.mjs.map +0 -7
  439. package/dist/lib/node-esm/chunk-55JZVM6K.mjs +0 -16
  440. package/dist/lib/node-esm/chunk-55JZVM6K.mjs.map +0 -7
  441. package/dist/lib/node-esm/chunk-EJLYOSD7.mjs +0 -113
  442. package/dist/lib/node-esm/chunk-EJLYOSD7.mjs.map +0 -7
  443. package/dist/lib/node-esm/chunk-GA27XSEY.mjs +0 -270
  444. package/dist/lib/node-esm/chunk-GA27XSEY.mjs.map +0 -7
  445. package/dist/lib/node-esm/chunk-IBV2DR36.mjs +0 -33
  446. package/dist/lib/node-esm/chunk-IBV2DR36.mjs.map +0 -7
  447. package/dist/lib/node-esm/chunk-N2XLVOFB.mjs +0 -103
  448. package/dist/lib/node-esm/chunk-N2XLVOFB.mjs.map +0 -7
  449. package/dist/lib/node-esm/chunk-O7HXE72S.mjs +0 -256
  450. package/dist/lib/node-esm/chunk-O7HXE72S.mjs.map +0 -7
  451. package/dist/lib/node-esm/chunk-OZ6LCME4.mjs +0 -645
  452. package/dist/lib/node-esm/chunk-OZ6LCME4.mjs.map +0 -7
  453. package/dist/lib/node-esm/chunk-TUGLYZDT.mjs +0 -305
  454. package/dist/lib/node-esm/chunk-TUGLYZDT.mjs.map +0 -7
  455. package/dist/lib/node-esm/chunk-UEGPBCSF.mjs +0 -154
  456. package/dist/lib/node-esm/chunk-UEGPBCSF.mjs.map +0 -7
  457. package/dist/lib/node-esm/compiler-I6A4KE6E.mjs +0 -87
  458. package/dist/lib/node-esm/compiler-I6A4KE6E.mjs.map +0 -7
  459. package/dist/lib/node-esm/intent-resolver-YKLZQR7U.mjs +0 -106
  460. package/dist/lib/node-esm/intent-resolver-YKLZQR7U.mjs.map +0 -7
  461. package/dist/lib/node-esm/react-surface-LVGLBSTE.mjs +0 -129
  462. package/dist/lib/node-esm/react-surface-LVGLBSTE.mjs.map +0 -7
  463. package/dist/lib/node-esm/settings-O4EZPUE3.mjs +0 -27
  464. package/dist/lib/node-esm/settings-O4EZPUE3.mjs.map +0 -7
  465. package/dist/types/src/capabilities/capabilities.d.ts +0 -5
  466. package/dist/types/src/capabilities/capabilities.d.ts.map +0 -1
  467. package/dist/types/src/capabilities/intent-resolver.d.ts +0 -4
  468. package/dist/types/src/capabilities/intent-resolver.d.ts.map +0 -1
  469. package/dist/types/src/components/DeploymentDialog/DeploymentDialog.d.ts.map +0 -1
  470. package/dist/types/src/components/DeploymentDialog/DeploymentDialog.stories.d.ts +0 -248
  471. package/dist/types/src/components/DeploymentDialog/DeploymentDialog.stories.d.ts.map +0 -1
  472. package/dist/types/src/components/DeploymentDialog/index.d.ts +0 -4
  473. package/dist/types/src/components/DeploymentDialog/index.d.ts.map +0 -1
  474. package/dist/types/src/components/FrameContainer/FrameContainer.d.ts +0 -12
  475. package/dist/types/src/components/FrameContainer/FrameContainer.d.ts.map +0 -1
  476. package/dist/types/src/components/FrameContainer/frame.d.ts +0 -2
  477. package/dist/types/src/components/FrameContainer/frame.d.ts.map +0 -1
  478. package/dist/types/src/components/FrameContainer/index.d.ts +0 -2
  479. package/dist/types/src/components/FrameContainer/index.d.ts.map +0 -1
  480. package/dist/types/src/components/NotebookContainer.d.ts +0 -10
  481. package/dist/types/src/components/NotebookContainer.d.ts.map +0 -1
  482. package/dist/types/src/components/NotebookContainer.stories.d.ts +0 -251
  483. package/dist/types/src/components/NotebookContainer.stories.d.ts.map +0 -1
  484. package/dist/types/src/components/ScriptContainer.d.ts +0 -12
  485. package/dist/types/src/components/ScriptContainer.d.ts.map +0 -1
  486. package/dist/types/src/components/Settings/ScriptObjectSettings.d.ts.map +0 -1
  487. package/dist/types/src/components/Settings/ScriptPluginSettings.d.ts +0 -6
  488. package/dist/types/src/components/Settings/ScriptPluginSettings.d.ts.map +0 -1
  489. package/dist/types/src/components/Settings/index.d.ts +0 -3
  490. package/dist/types/src/components/Settings/index.d.ts.map +0 -1
  491. package/dist/types/src/components/TestPanel/TestContainer.d.ts.map +0 -1
  492. package/dist/types/src/events.d.ts +0 -4
  493. package/dist/types/src/events.d.ts.map +0 -1
  494. package/dist/types/src/templates/chess.d.ts +0 -3
  495. package/dist/types/src/templates/chess.d.ts.map +0 -1
  496. package/dist/types/src/types/actions.d.ts +0 -54
  497. package/dist/types/src/types/actions.d.ts.map +0 -1
  498. package/src/capabilities/capabilities.ts +0 -12
  499. package/src/capabilities/intent-resolver.ts +0 -86
  500. package/src/components/DeploymentDialog/DeploymentDialog.tsx +0 -106
  501. package/src/components/DeploymentDialog/index.ts +0 -9
  502. package/src/components/FrameContainer/frame.html +0 -25
  503. package/src/components/FrameContainer/frame.tsx +0 -51
  504. package/src/components/ScriptContainer.tsx +0 -69
  505. package/src/components/Settings/ScriptPluginSettings.tsx +0 -61
  506. package/src/components/Settings/index.ts +0 -6
  507. package/src/components/TestPanel/TestContainer.tsx +0 -27
  508. package/src/events.ts +0 -11
  509. package/src/templates/chess.ts +0 -49
  510. package/src/types/actions.ts +0 -53
@@ -0,0 +1,69 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import { next as A, type Doc } from '@automerge/automerge';
6
+ import * as Effect from 'effect/Effect';
7
+
8
+ import { Database, Obj } from '@dxos/echo';
9
+ import { DocAccessor, createDocAccessor } from '@dxos/echo-db';
10
+ import { type Script } from '@dxos/functions';
11
+ import { Operation } from '@dxos/operation';
12
+
13
+ import { Update } from './definitions';
14
+
15
+ export default Update.pipe(
16
+ Operation.withHandler(
17
+ Effect.fn(function* ({ function: fn, name, description, edits }) {
18
+ const loaded = yield* Database.load(fn);
19
+ if (!loaded.source) {
20
+ return yield* Effect.fail(new Error('Function has no source script.'));
21
+ }
22
+ const script = (yield* Database.load(loaded.source)) as Script.Script;
23
+
24
+ if (name !== undefined || description !== undefined) {
25
+ Obj.change(script, (draft) => {
26
+ if (name !== undefined) {
27
+ draft.name = name;
28
+ }
29
+ if (description !== undefined) {
30
+ draft.description = description;
31
+ }
32
+ });
33
+ }
34
+
35
+ if (edits && edits.length > 0) {
36
+ const text = yield* Database.load(script.source);
37
+ const accessor = createDocAccessor(text, ['content']);
38
+
39
+ for (const edit of edits) {
40
+ accessor.handle.change((doc: Doc<typeof text>) => {
41
+ const source = DocAccessor.getValue<string>(accessor);
42
+ if (edit.replaceAll) {
43
+ let idx = source.indexOf(edit.oldString);
44
+ while (idx !== -1) {
45
+ A.splice(doc, accessor.path as A.Prop[], idx, edit.oldString.length, edit.newString);
46
+ const updated = DocAccessor.getValue<string>(accessor);
47
+ idx = updated.indexOf(edit.oldString, idx + edit.newString.length);
48
+ }
49
+ } else {
50
+ const idx = source.indexOf(edit.oldString);
51
+ if (idx === -1) {
52
+ throw new Error(`Edit not found: ${JSON.stringify(edit.oldString)}`);
53
+ }
54
+ A.splice(doc, accessor.path as A.Prop[], idx, edit.oldString.length, edit.newString);
55
+ }
56
+ });
57
+ }
58
+
59
+ Obj.change(script, (draft) => {
60
+ draft.changed = true;
61
+ });
62
+ }
63
+
64
+ return {
65
+ function: Obj.getDXN(loaded).toString(),
66
+ };
67
+ }),
68
+ ),
69
+ );
@@ -0,0 +1,5 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ export { default as ScriptBlueprint } from './script-blueprint';
@@ -0,0 +1,56 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import { type AppCapabilities } from '@dxos/app-toolkit';
6
+ import { Blueprint, Template } from '@dxos/blueprints';
7
+ import { trim } from '@dxos/util';
8
+
9
+ import {
10
+ Create,
11
+ Read,
12
+ Update,
13
+ Delete,
14
+ Deploy,
15
+ Invoke,
16
+ InspectInvocations,
17
+ QueryDeployedFunctions,
18
+ InstallFunction,
19
+ } from './functions';
20
+
21
+ const BLUEPRINT_KEY = 'org.dxos.blueprint.script';
22
+
23
+ const make = () =>
24
+ Blueprint.make({
25
+ key: BLUEPRINT_KEY,
26
+ name: 'Script',
27
+ agentCanEnable: true,
28
+ tools: Blueprint.toolDefinitions({
29
+ operations: [
30
+ Create,
31
+ Read,
32
+ Update,
33
+ Delete,
34
+ Deploy,
35
+ Invoke,
36
+ InspectInvocations,
37
+ QueryDeployedFunctions,
38
+ InstallFunction,
39
+ ],
40
+ }),
41
+ instructions: Template.make({
42
+ source: trim`
43
+ You can create, read, update, and delete scripts which contain TypeScript code.
44
+ You can deploy scripts to the Edge runtime and invoke deployed scripts.
45
+ You can inspect the invocation history of a deployed script.
46
+ You can query all functions deployed to the EDGE runtime and install them into the current space.
47
+ `,
48
+ }),
49
+ });
50
+
51
+ const blueprint: AppCapabilities.BlueprintDefinition = {
52
+ key: BLUEPRINT_KEY,
53
+ make,
54
+ };
55
+
56
+ export default blueprint;
@@ -2,64 +2,46 @@
2
2
  // Copyright 2025 DXOS.org
3
3
  //
4
4
 
5
- import { Rx } from '@effect-rx/rx-react';
6
- import * as Function from 'effect/Function';
7
- import * as Option from 'effect/Option';
5
+ import * as Effect from 'effect/Effect';
8
6
 
9
- import { Capabilities, type PluginContext, contributes } from '@dxos/app-framework';
10
- import { Obj } from '@dxos/echo';
7
+ import { Capability } from '@dxos/app-framework';
8
+ import { AppCapabilities, AppNode } from '@dxos/app-toolkit';
11
9
  import { Script } from '@dxos/functions';
12
- import { ATTENDABLE_PATH_SEPARATOR, PLANK_COMPANION_TYPE } from '@dxos/plugin-deck/types';
13
- import { createExtension } from '@dxos/plugin-graph';
10
+ import { GraphBuilder } from '@dxos/plugin-graph';
14
11
 
15
- import { meta } from '../meta';
12
+ import { meta } from '#meta';
16
13
 
17
- export default (context: PluginContext) =>
18
- contributes(Capabilities.AppGraphBuilder, [
19
- createExtension({
20
- id: `${meta.id}/execute`,
21
- connector: (node) =>
22
- Rx.make((get) =>
23
- Function.pipe(
24
- get(node),
25
- Option.flatMap((node) => (Obj.instanceOf(Script.Script, node.data) ? Option.some(node) : Option.none())),
26
- Option.map((node) => [
27
- {
28
- id: [node.id, 'execute'].join(ATTENDABLE_PATH_SEPARATOR),
29
- type: PLANK_COMPANION_TYPE,
30
- data: 'execute',
31
- properties: {
32
- label: ['script test label', { ns: meta.id }],
33
- icon: 'ph--terminal--regular',
34
- disposition: 'hidden',
35
- },
36
- },
37
- ]),
38
- Option.getOrElse(() => []),
39
- ),
40
- ),
41
- }),
42
- createExtension({
43
- id: `${meta.id}/logs`,
44
- connector: (node) =>
45
- Rx.make((get) =>
46
- Function.pipe(
47
- get(node),
48
- Option.flatMap((node) => (Obj.instanceOf(Script.Script, node.data) ? Option.some(node) : Option.none())),
49
- Option.map((node) => [
50
- {
51
- id: [node.id, 'logs'].join(ATTENDABLE_PATH_SEPARATOR),
52
- type: PLANK_COMPANION_TYPE,
53
- data: 'logs',
54
- properties: {
55
- label: ['script logs label', { ns: meta.id }],
56
- icon: 'ph--clock-countdown--regular',
57
- disposition: 'hidden',
58
- },
59
- },
60
- ]),
61
- Option.getOrElse(() => []),
62
- ),
63
- ),
64
- }),
65
- ]);
14
+ export default Capability.makeModule(
15
+ Effect.fnUntraced(function* () {
16
+ const extensions = yield* Effect.all([
17
+ GraphBuilder.createTypeExtension({
18
+ id: `${meta.id}.execute`,
19
+ type: Script.Script,
20
+ connector: () =>
21
+ Effect.succeed([
22
+ AppNode.makeCompanion({
23
+ id: 'execute',
24
+ label: ['script-test.label', { ns: meta.id }],
25
+ icon: 'ph--terminal--regular',
26
+ data: 'execute',
27
+ }),
28
+ ]),
29
+ }),
30
+ GraphBuilder.createTypeExtension({
31
+ id: `${meta.id}.logs`,
32
+ type: Script.Script,
33
+ connector: () =>
34
+ Effect.succeed([
35
+ AppNode.makeCompanion({
36
+ id: 'logs',
37
+ label: ['script-logs.label', { ns: meta.id }],
38
+ icon: 'ph--clock-countdown--regular',
39
+ data: 'logs',
40
+ }),
41
+ ]),
42
+ }),
43
+ ]);
44
+
45
+ return Capability.contributes(AppCapabilities.AppGraphBuilder, extensions);
46
+ }),
47
+ );
@@ -5,10 +5,11 @@
5
5
  // ISSUE(burdon): defineArtifact
6
6
  // @ts-nocheck
7
7
 
8
+ import * as Effect from 'effect/Effect';
8
9
  import * as Schema from 'effect/Schema';
9
10
 
10
11
  import { ToolResult, createTool } from '@dxos/ai';
11
- import { Capabilities, type PromiseIntentDispatcher, contributes, createIntent } from '@dxos/app-framework';
12
+ import { Capabilities, Capability, type PromiseIntentDispatcher, createIntent } from '@dxos/app-framework';
12
13
  import { ArtifactId, createArtifactElement } from '@dxos/assistant';
13
14
  import { defineArtifact } from '@dxos/blueprints';
14
15
  import { Filter, Obj, Ref } from '@dxos/echo';
@@ -16,9 +17,8 @@ import { ScriptType } from '@dxos/functions';
16
17
  import { invariant } from '@dxos/invariant';
17
18
  import { SpaceAction } from '@dxos/plugin-space/types';
18
19
  import { type Space } from '@dxos/react-client/echo';
19
- import { DataType } from '@dxos/schema';
20
20
 
21
- import { meta } from '../meta';
21
+ import { meta } from '#meta';
22
22
 
23
23
  // TODO(burdon): Factor out.
24
24
  declare global {
@@ -28,14 +28,15 @@ declare global {
28
28
  }
29
29
  }
30
30
 
31
- export default () => {
32
- const definition = defineArtifact({
33
- id: `artifact:${meta.id}`,
34
- name: meta.name,
35
- // TODO(dmaretskyi): Since writing scripts requires a lot of domain knowledge,
36
- // we should offload the work of synthesizing the code to a separate model.
37
- // The main reasoning model will give it a concrete task and the script model will synthesize the code, knowing all the docs.
38
- instructions: `
31
+ export default Capability.makeModule(() =>
32
+ Effect.sync(() => {
33
+ const definition = defineArtifact({
34
+ id: `artifact:${meta.id}`,
35
+ name: meta.name,
36
+ // TODO(dmaretskyi): Since writing scripts requires a lot of domain knowledge,
37
+ // we should offload the work of synthesizing the code to a separate model.
38
+ // The main reasoning model will give it a concrete task and the script model will synthesize the code, knowing all the docs.
39
+ instructions: `
39
40
  If the user explicitly requests you to write a script, you can create one.
40
41
  If the user requests you to change one of the existing script, you can update it.
41
42
  You must not create a script unless the user explicitly requests it.
@@ -55,7 +56,7 @@ export default () => {
55
56
  The description is used by AI to understand the script and its purpose.
56
57
  The description must provide cases on when the script should be used.
57
58
 
58
- Schema:
59
+ Schema:
59
60
  The schema is defined using a schema-DSL library called Effect Schema.
60
61
  The input schema describes the arguments that the script accepts.
61
62
  The output schema describes the result that the script produces.
@@ -76,18 +77,18 @@ export default () => {
76
77
  - Detailed output schema
77
78
 
78
79
  <apis>
79
- export function defineFunction(params: {
80
- description: string,
81
- inputSchema: Schema.Schema,
82
- outputSchema: Schema.Schema,
83
- handler: (params: { event: { data: TInput } }) => Promise<TOutput>
80
+ export function defineFunction(params: {
81
+ description: string,
82
+ inputSchema: Schema.Schema,
83
+ outputSchema: Schema.Schema,
84
+ handler: (params: { event: { data: TInput } }) => Promise<TOutput>
84
85
  }): FunctionDefinition
85
86
  /**
86
87
  * Effect Schema
87
88
  */
88
- export const Schema;
89
+ export const Schema;
89
90
 
90
- // Examples:
91
+ // Examples:
91
92
 
92
93
  Schema.String
93
94
  Schema.Number
@@ -105,7 +106,7 @@ export default () => {
105
106
  <handler_function>
106
107
  Async function that takes the argument in the form of:
107
108
 
108
- type HandlerFunctionParam = {
109
+ type HandlerFunctionProp = {
109
110
  event: {
110
111
  data: T // The input schema
111
112
  },
@@ -113,7 +114,7 @@ export default () => {
113
114
 
114
115
  The function must return the result that matches the output schema.
115
116
  </handler_function>
116
-
117
+
117
118
  <example>
118
119
  import { defineFunction, S } from 'dxos:functions';
119
120
 
@@ -144,82 +145,83 @@ export default () => {
144
145
  });
145
146
  </example>
146
147
  `,
147
- schema: ScriptType,
148
- tools: [
149
- createTool(meta.id, {
150
- name: 'create',
151
- description: 'Create a new script. Returns the artifact definition for the script',
152
- caption: 'Creating script...',
153
- schema: Schema.Struct({
154
- name: Schema.String.annotations({ description: 'The name of the script' }),
155
- code: Schema.String.annotations({
156
- description: 'The full code of the script in JavaScript or TypeScript. Must be valid executable code.',
148
+ schema: ScriptType,
149
+ tools: [
150
+ createTool(meta.id, {
151
+ name: 'create',
152
+ description: 'Create a new script. Returns the artifact definition for the script',
153
+ caption: 'Creating script...',
154
+ schema: Schema.Struct({
155
+ name: Schema.String.annotations({ description: 'The name of the script' }),
156
+ code: Schema.String.annotations({
157
+ description: 'The full code of the script in JavaScript or TypeScript. Must be valid executable code.',
158
+ }),
157
159
  }),
160
+ execute: async ({ name, code }, { extensions }) => {
161
+ invariant(extensions?.space, 'No space');
162
+ invariant(extensions?.dispatch, 'No intent dispatcher');
163
+ const script = Obj.make(ScriptType, { name, source: Ref.make(Text.make(code)) });
164
+ extensions.space.db.add(script);
165
+ await extensions.space.db.flush();
166
+
167
+ const intent = createIntent(SpaceAction.AddObject, { target: extensions.space, object: script });
168
+ const { data, error } = await extensions.dispatch(intent);
169
+ if (!data || error) {
170
+ return ToolResult.Error(error?.message ?? 'Failed to create chess game');
171
+ }
172
+
173
+ return ToolResult.Success(createArtifactElement(script.id));
174
+ },
158
175
  }),
159
- execute: async ({ name, code }, { extensions }) => {
160
- invariant(extensions?.space, 'No space');
161
- invariant(extensions?.dispatch, 'No intent dispatcher');
162
- const script = Obj.make(ScriptType, { name, source: Ref.make(DataType.makeText(code)) });
163
- extensions.space.db.add(script);
164
- await extensions.space.db.flush();
165
-
166
- const intent = createIntent(SpaceAction.AddObject, { target: extensions.space, object: script });
167
- const { data, error } = await extensions.dispatch(intent);
168
- if (!data || error) {
169
- return ToolResult.Error(error?.message ?? 'Failed to create chess game');
170
- }
171
-
172
- return ToolResult.Success(createArtifactElement(script.id));
173
- },
174
- }),
175
- createTool(meta.id, {
176
- name: 'inspect',
177
- description: 'Inspect a script. Returns the artifact definition for the script',
178
- caption: 'Inspecting script...',
179
- schema: Schema.Struct({
180
- id: ArtifactId,
176
+ createTool(meta.id, {
177
+ name: 'inspect',
178
+ description: 'Inspect a script. Returns the artifact definition for the script',
179
+ caption: 'Inspecting script...',
180
+ schema: Schema.Struct({
181
+ id: ArtifactId,
182
+ }),
183
+ execute: async ({ id }, { extensions }) => {
184
+ invariant(extensions?.space, 'No space');
185
+
186
+ const script = (await extensions.space.db.query(Filter.id(id)).first()) as ScriptType;
187
+ const { content } = await script.source.load();
188
+
189
+ return ToolResult.Success({
190
+ name: script.name,
191
+ code: content,
192
+ });
193
+ },
181
194
  }),
182
- execute: async ({ id }, { extensions }) => {
183
- invariant(extensions?.space, 'No space');
184
-
185
- const script = (await extensions.space.db.query(Filter.ids(id)).first()) as ScriptType;
186
- const { content } = await script.source.load();
187
-
188
- return ToolResult.Success({
189
- name: script.name,
190
- code: content,
191
- });
192
- },
193
- }),
194
- createTool(meta.id, {
195
- name: 'update',
196
- description: 'Update a script. Returns the artifact definition for the script',
197
- caption: 'Updating script...',
198
- schema: Schema.Struct({
199
- id: ArtifactId,
200
- code: Schema.String.annotations({
201
- description: 'The full code of the script in JavaScript or TypeScript. Must be valid executable code.',
195
+ createTool(meta.id, {
196
+ name: 'update',
197
+ description: 'Update a script. Returns the artifact definition for the script',
198
+ caption: 'Updating script...',
199
+ schema: Schema.Struct({
200
+ id: ArtifactId,
201
+ code: Schema.String.annotations({
202
+ description: 'The full code of the script in JavaScript or TypeScript. Must be valid executable code.',
203
+ }),
202
204
  }),
205
+ execute: async ({ id, code }, { extensions }) => {
206
+ invariant(extensions?.space, 'No space');
207
+
208
+ const script = (await extensions.space.db.query(Filter.id(id)).first()) as ScriptType;
209
+ const source = await script.source.load();
210
+ if (!source) {
211
+ return ToolResult.Error('Script not found');
212
+ }
213
+
214
+ source.content = code;
215
+ await extensions.space?.db.flush();
216
+
217
+ return ToolResult.Success({
218
+ name: script.name,
219
+ });
220
+ },
203
221
  }),
204
- execute: async ({ id, code }, { extensions }) => {
205
- invariant(extensions?.space, 'No space');
206
-
207
- const script = (await extensions.space.db.query(Filter.ids(id)).first()) as ScriptType;
208
- const source = await script.source.load();
209
- if (!source) {
210
- return ToolResult.Error('Script not found');
211
- }
212
-
213
- source.content = code;
214
- await extensions.space?.db.flush();
215
-
216
- return ToolResult.Success({
217
- name: script.name,
218
- });
219
- },
220
- }),
221
- ],
222
- });
223
-
224
- return contributes(Capabilities.ArtifactDefinition, definition);
225
- };
222
+ ],
223
+ });
224
+
225
+ return Capability.contributes(Capabilities.ArtifactDefinition, definition);
226
+ }),
227
+ );
@@ -2,29 +2,16 @@
2
2
  // Copyright 2025 DXOS.org
3
3
  //
4
4
 
5
- import { Capabilities, contributes } from '@dxos/app-framework';
6
- import { Blueprint, Template } from '@dxos/blueprints';
7
- import { type FunctionDefinition } from '@dxos/functions';
8
- import { trim } from '@dxos/util';
5
+ import * as Effect from 'effect/Effect';
9
6
 
10
- const functions: FunctionDefinition[] = [];
11
- const tools: string[] = [];
7
+ import { Capability } from '@dxos/app-framework';
8
+ import { AppCapabilities } from '@dxos/app-toolkit';
12
9
 
13
- export default () => {
14
- return [
15
- contributes(Capabilities.Functions, functions),
16
- contributes(
17
- Capabilities.BlueprintDefinition,
18
- Blueprint.make({
19
- key: 'dxos.org/blueprint/script',
20
- name: 'Script',
21
- tools: Blueprint.toolDefinitions({ functions, tools }),
22
- instructions: Template.make({
23
- source: trim`
24
- You can create and update scripts which contain Typescript code.
25
- `,
26
- }),
27
- }),
28
- ),
29
- ];
30
- };
10
+ import { ScriptBlueprint } from '#blueprints';
11
+
12
+ const blueprintDefinition = Capability.makeModule<
13
+ [],
14
+ Capability.Capability<typeof AppCapabilities.BlueprintDefinition>[]
15
+ >(() => Effect.succeed([Capability.contributes(AppCapabilities.BlueprintDefinition, ScriptBlueprint)]));
16
+
17
+ export default blueprintDefinition;
@@ -2,33 +2,102 @@
2
2
  // Copyright 2025 DXOS.org
3
3
  //
4
4
 
5
- // @ts-ignore
5
+ import * as FetchHttpClient from '@effect/platform/FetchHttpClient';
6
+ import * as HttpClient from '@effect/platform/HttpClient';
7
+ import * as Effect from 'effect/Effect';
8
+ import * as Schedule from 'effect/Schedule';
9
+ import * as Schema from 'effect/Schema';
6
10
  import wasmUrl from 'esbuild-wasm/esbuild.wasm?url';
11
+ import * as ts from 'typescript';
7
12
 
8
- import { contributes } from '@dxos/app-framework';
9
- import { initializeBundler } from '@dxos/functions/bundler';
13
+ import { Capability } from '@dxos/app-framework';
14
+ import { initializeBundler } from '@dxos/functions-runtime/bundler';
15
+ import { log } from '@dxos/log';
16
+ import { trim } from '@dxos/util';
10
17
 
11
18
  import { Compiler } from '../compiler';
19
+ import { ScriptCapabilities } from '#types';
12
20
 
13
- import { ScriptCapabilities } from './capabilities';
14
-
15
- export default async () => {
16
- const compiler = new Compiler();
17
-
18
- await compiler.initialize();
19
- // TODO(wittjosiah): Fetch types for https modules.
20
- compiler.setFile('/src/typings.d.ts', "declare module 'https://*';");
21
- // TODO(wittjosiah): Proper function handler types.
22
- // TODO(wittjosiah): Remove.
23
- compiler.setFile(
24
- '/src/runtime.ts',
25
- `
26
- export const Filter: any = {};
27
- export type FunctionHandler = ({ event, context }: { event: any; context: any }) => Promise<Response>;
28
- export const functionHandler = (handler: FunctionHandler) => handler;
29
- `,
21
+ // TODO(burdon): Document.
22
+ const SCRIPT_PACKAGES_BUCKET = 'https://pub-5745ae82e450484aa28f75fc6a175935.r2.dev/dev/';
23
+ const DECLARATION_EXTS = ['.d.ts', '.d.mts'];
24
+ const NO_TYPES = true; // Types temopararly disabled due to compiler erorrs.
25
+
26
+ export default Capability.makeModule(() =>
27
+ Effect.gen(function* () {
28
+ yield* Effect.tryPromise(() => initializeBundler({ wasmUrl }));
29
+
30
+ const runtimeModules = yield* fetchRuntimeModules().pipe(Effect.provide(FetchHttpClient.layer));
31
+
32
+ const compiler = new Compiler({
33
+ skipLibCheck: true,
34
+ moduleResolution: ts.ModuleResolutionKind.Bundler,
35
+ allowImportingTsExtensions: true,
36
+ noEmit: true,
37
+ strict: true,
38
+ esModuleInterop: true,
39
+ paths: Object.fromEntries(runtimeModules.map((mod: any) => [mod.moduleName, [`./src/${mod.filename}`]])),
40
+ });
41
+
42
+ yield* Effect.tryPromise(() =>
43
+ compiler.initialize(trim`
44
+ declare module 'https://*';
45
+ ${NO_TYPES ? '' : 'declare module "*";'}
46
+ `),
47
+ );
48
+ if (!NO_TYPES) {
49
+ for (const mod of runtimeModules) {
50
+ compiler.setFile(`/src/${mod.filename}`, mod.content);
51
+ }
52
+ }
53
+
54
+ return Capability.contributes(ScriptCapabilities.Compiler, compiler);
55
+ }),
56
+ );
57
+
58
+ const fetchRuntimeModules = Effect.fnUntraced(function* () {
59
+ // { key, size, contentType }
60
+ const manifest = yield* HttpClient.get(new URL('manifest.json', SCRIPT_PACKAGES_BUCKET)).pipe(
61
+ Effect.flatMap((_) => _.json),
62
+ Effect.flatMap(
63
+ Schema.decodeUnknown(
64
+ Schema.Struct({
65
+ files: Schema.Array(
66
+ Schema.Struct({
67
+ key: Schema.String,
68
+ }),
69
+ ),
70
+ }),
71
+ ),
72
+ ),
73
+ Effect.map((manifest) => ({ ...manifest, files: manifest.files.map((f) => f.key) })),
74
+ );
75
+
76
+ const declarationFiles = manifest.files.filter((file) => DECLARATION_EXTS.some((ext) => file.endsWith(ext)));
77
+
78
+ let fetched = 0;
79
+ const modules = yield* Effect.forEach(
80
+ declarationFiles,
81
+ Effect.fnUntraced(
82
+ function* (filename) {
83
+ const response = yield* HttpClient.get(new URL(filename, SCRIPT_PACKAGES_BUCKET)).pipe(
84
+ Effect.retry(Schedule.exponential(1_000).pipe(Schedule.compose(Schedule.recurs(3)))),
85
+ );
86
+ const content = yield* response.text;
87
+ const moduleName = filename.replace(/\.d\.(ts|mts)$/, '');
88
+ fetched++;
89
+
90
+ return {
91
+ moduleName,
92
+ filename,
93
+ content,
94
+ };
95
+ },
96
+ Effect.retry(Schedule.exponential(1_000).pipe(Schedule.compose(Schedule.recurs(3)))),
97
+ ),
98
+ { concurrency: 20 },
30
99
  );
31
- await initializeBundler({ wasmUrl });
32
100
 
33
- return contributes(ScriptCapabilities.Compiler, compiler);
34
- };
101
+ log.info('runtime modules', { manifest: manifest.files.length, files: declarationFiles.length, fetched });
102
+ return modules;
103
+ });