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

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 (536) hide show
  1. package/README.md +15 -13
  2. package/dist/lib/browser/DeploymentDialog-6DBF3V6C.mjs +112 -0
  3. package/dist/lib/browser/DeploymentDialog-6DBF3V6C.mjs.map +7 -0
  4. package/dist/lib/browser/{NotebookContainer-4MM2VAQF.mjs → NotebookContainer-RO4NJRYH.mjs} +59 -144
  5. package/dist/lib/browser/NotebookContainer-RO4NJRYH.mjs.map +7 -0
  6. package/dist/lib/browser/ScriptContainer-2OPBAXFB.mjs +79 -0
  7. package/dist/lib/browser/ScriptContainer-2OPBAXFB.mjs.map +7 -0
  8. package/dist/lib/browser/ScriptProperties-NRXG4PBX.mjs +304 -0
  9. package/dist/lib/browser/ScriptProperties-NRXG4PBX.mjs.map +7 -0
  10. package/dist/lib/browser/TestContainer-JNFPLAJX.mjs +44 -0
  11. package/dist/lib/browser/TestContainer-JNFPLAJX.mjs.map +7 -0
  12. package/dist/lib/browser/access-token-created-MSWZWZCT.mjs +37 -0
  13. package/dist/lib/browser/access-token-created-MSWZWZCT.mjs.map +7 -0
  14. package/dist/lib/browser/blueprints/index.mjs +53 -3
  15. package/dist/lib/browser/blueprints/index.mjs.map +4 -4
  16. package/dist/lib/browser/chunk-KF6H7J5N.mjs +81 -0
  17. package/dist/lib/browser/chunk-KF6H7J5N.mjs.map +7 -0
  18. package/dist/lib/browser/chunk-MI6X5CTJ.mjs +336 -0
  19. package/dist/lib/browser/chunk-MI6X5CTJ.mjs.map +7 -0
  20. package/dist/lib/browser/{chunk-UX4GHJ5E.mjs → chunk-NSAF3763.mjs} +29 -29
  21. package/dist/lib/browser/chunk-NSAF3763.mjs.map +7 -0
  22. package/dist/lib/browser/chunk-RQ5LDVFK.mjs +49 -0
  23. package/dist/lib/browser/chunk-RQ5LDVFK.mjs.map +7 -0
  24. package/dist/lib/browser/containers/index.mjs +17 -0
  25. package/dist/lib/browser/containers/index.mjs.map +7 -0
  26. package/dist/lib/browser/create-JDXWBARB.mjs +44 -0
  27. package/dist/lib/browser/create-JDXWBARB.mjs.map +7 -0
  28. package/dist/lib/browser/create-script-Q7B3CFAP.mjs +45 -0
  29. package/dist/lib/browser/create-script-Q7B3CFAP.mjs.map +7 -0
  30. package/dist/lib/browser/delete-PAUWA2QM.mjs +21 -0
  31. package/dist/lib/browser/delete-PAUWA2QM.mjs.map +7 -0
  32. package/dist/lib/browser/deploy-CXVW54JJ.mjs +62 -0
  33. package/dist/lib/browser/deploy-CXVW54JJ.mjs.map +7 -0
  34. package/dist/lib/browser/index.mjs +169 -220
  35. package/dist/lib/browser/index.mjs.map +4 -4
  36. package/dist/lib/browser/inspect-invocations-LEOEP5I2.mjs +59 -0
  37. package/dist/lib/browser/inspect-invocations-LEOEP5I2.mjs.map +7 -0
  38. package/dist/lib/browser/install-function-5N24Q45W.mjs +51 -0
  39. package/dist/lib/browser/install-function-5N24Q45W.mjs.map +7 -0
  40. package/dist/lib/browser/invoke-5QVEZ3X5.mjs +33 -0
  41. package/dist/lib/browser/invoke-5QVEZ3X5.mjs.map +7 -0
  42. package/dist/lib/browser/meta.json +1 -1
  43. package/dist/lib/browser/operations/index.mjs +14 -0
  44. package/dist/lib/browser/operations/index.mjs.map +7 -0
  45. package/dist/lib/browser/query-deployed-functions-FVD7NYPA.mjs +30 -0
  46. package/dist/lib/browser/query-deployed-functions-FVD7NYPA.mjs.map +7 -0
  47. package/dist/lib/browser/read-FFOSK6A3.mjs +26 -0
  48. package/dist/lib/browser/read-FFOSK6A3.mjs.map +7 -0
  49. package/dist/lib/browser/templates/index.mjs +1 -1
  50. package/dist/lib/browser/translations.mjs +104 -0
  51. package/dist/lib/browser/translations.mjs.map +7 -0
  52. package/dist/lib/browser/types/index.mjs +3 -7
  53. package/dist/lib/browser/update-PJS5GG3Y.mjs +63 -0
  54. package/dist/lib/browser/update-PJS5GG3Y.mjs.map +7 -0
  55. package/dist/lib/node-esm/DeploymentDialog-A5BZHUJB.mjs +113 -0
  56. package/dist/lib/node-esm/DeploymentDialog-A5BZHUJB.mjs.map +7 -0
  57. package/dist/lib/node-esm/{NotebookContainer-QLW5ZYGS.mjs → NotebookContainer-DPT65MA7.mjs} +59 -144
  58. package/dist/lib/node-esm/NotebookContainer-DPT65MA7.mjs.map +7 -0
  59. package/dist/lib/node-esm/ScriptContainer-UKD7QORM.mjs +80 -0
  60. package/dist/lib/node-esm/ScriptContainer-UKD7QORM.mjs.map +7 -0
  61. package/dist/lib/node-esm/ScriptProperties-FQXEOJKG.mjs +305 -0
  62. package/dist/lib/node-esm/ScriptProperties-FQXEOJKG.mjs.map +7 -0
  63. package/dist/lib/node-esm/TestContainer-Y4XVV7KQ.mjs +45 -0
  64. package/dist/lib/node-esm/TestContainer-Y4XVV7KQ.mjs.map +7 -0
  65. package/dist/lib/node-esm/access-token-created-DCD6LYQC.mjs +38 -0
  66. package/dist/lib/node-esm/access-token-created-DCD6LYQC.mjs.map +7 -0
  67. package/dist/lib/node-esm/blueprints/index.mjs +53 -3
  68. package/dist/lib/node-esm/blueprints/index.mjs.map +4 -4
  69. package/dist/lib/node-esm/chunk-2DZNF5NG.mjs +82 -0
  70. package/dist/lib/node-esm/chunk-2DZNF5NG.mjs.map +7 -0
  71. package/dist/lib/node-esm/chunk-C55UYWN4.mjs +50 -0
  72. package/dist/lib/node-esm/chunk-C55UYWN4.mjs.map +7 -0
  73. package/dist/lib/node-esm/{chunk-4F5FJZ36.mjs → chunk-EW63XFRQ.mjs} +29 -29
  74. package/dist/lib/node-esm/chunk-EW63XFRQ.mjs.map +7 -0
  75. package/dist/lib/node-esm/chunk-XFM2BEHY.mjs +338 -0
  76. package/dist/lib/node-esm/chunk-XFM2BEHY.mjs.map +7 -0
  77. package/dist/lib/node-esm/containers/index.mjs +18 -0
  78. package/dist/lib/node-esm/containers/index.mjs.map +7 -0
  79. package/dist/lib/node-esm/create-D2JDNXY6.mjs +45 -0
  80. package/dist/lib/node-esm/create-D2JDNXY6.mjs.map +7 -0
  81. package/dist/lib/node-esm/create-script-4AB4G7GQ.mjs +46 -0
  82. package/dist/lib/node-esm/create-script-4AB4G7GQ.mjs.map +7 -0
  83. package/dist/lib/node-esm/delete-YXLT7J27.mjs +22 -0
  84. package/dist/lib/node-esm/delete-YXLT7J27.mjs.map +7 -0
  85. package/dist/lib/node-esm/deploy-MXVZXAUC.mjs +63 -0
  86. package/dist/lib/node-esm/deploy-MXVZXAUC.mjs.map +7 -0
  87. package/dist/lib/node-esm/index.mjs +169 -220
  88. package/dist/lib/node-esm/index.mjs.map +4 -4
  89. package/dist/lib/node-esm/inspect-invocations-TVAKGYX5.mjs +60 -0
  90. package/dist/lib/node-esm/inspect-invocations-TVAKGYX5.mjs.map +7 -0
  91. package/dist/lib/node-esm/install-function-ST3VABJH.mjs +52 -0
  92. package/dist/lib/node-esm/install-function-ST3VABJH.mjs.map +7 -0
  93. package/dist/lib/node-esm/invoke-64WDU55Y.mjs +34 -0
  94. package/dist/lib/node-esm/invoke-64WDU55Y.mjs.map +7 -0
  95. package/dist/lib/node-esm/meta.json +1 -1
  96. package/dist/lib/node-esm/operations/index.mjs +15 -0
  97. package/dist/lib/node-esm/operations/index.mjs.map +7 -0
  98. package/dist/lib/node-esm/query-deployed-functions-2VCNGQ7X.mjs +31 -0
  99. package/dist/lib/node-esm/query-deployed-functions-2VCNGQ7X.mjs.map +7 -0
  100. package/dist/lib/node-esm/read-PECQUAPS.mjs +27 -0
  101. package/dist/lib/node-esm/read-PECQUAPS.mjs.map +7 -0
  102. package/dist/lib/node-esm/templates/index.mjs +1 -1
  103. package/dist/lib/node-esm/translations.mjs +105 -0
  104. package/dist/lib/node-esm/translations.mjs.map +7 -0
  105. package/dist/lib/node-esm/types/index.mjs +3 -7
  106. package/dist/lib/node-esm/update-XDFTGSPP.mjs +64 -0
  107. package/dist/lib/node-esm/update-XDFTGSPP.mjs.map +7 -0
  108. package/dist/types/src/ScriptPlugin.d.ts +1 -0
  109. package/dist/types/src/ScriptPlugin.d.ts.map +1 -1
  110. package/dist/types/src/ScriptPlugin.node.d.ts +4 -0
  111. package/dist/types/src/ScriptPlugin.node.d.ts.map +1 -0
  112. package/dist/types/src/ScriptPlugin.test.d.ts +2 -0
  113. package/dist/types/src/ScriptPlugin.test.d.ts.map +1 -0
  114. package/dist/types/src/blueprints/functions/create.d.ts +11 -0
  115. package/dist/types/src/blueprints/functions/create.d.ts.map +1 -0
  116. package/dist/types/src/blueprints/functions/definitions.d.ts +141 -0
  117. package/dist/types/src/blueprints/functions/definitions.d.ts.map +1 -0
  118. package/dist/types/src/blueprints/functions/delete.d.ts +18 -0
  119. package/dist/types/src/blueprints/functions/delete.d.ts.map +1 -0
  120. package/dist/types/src/blueprints/functions/deploy.d.ts +22 -0
  121. package/dist/types/src/blueprints/functions/deploy.d.ts.map +1 -0
  122. package/dist/types/src/blueprints/functions/index.d.ts +4 -0
  123. package/dist/types/src/blueprints/functions/index.d.ts.map +1 -0
  124. package/dist/types/src/blueprints/functions/inspect-invocations.d.ts +29 -0
  125. package/dist/types/src/blueprints/functions/inspect-invocations.d.ts.map +1 -0
  126. package/dist/types/src/blueprints/functions/install-function.d.ts +11 -0
  127. package/dist/types/src/blueprints/functions/install-function.d.ts.map +1 -0
  128. package/dist/types/src/blueprints/functions/invoke.d.ts +22 -0
  129. package/dist/types/src/blueprints/functions/invoke.d.ts.map +1 -0
  130. package/dist/types/src/blueprints/functions/query-deployed-functions.d.ts +13 -0
  131. package/dist/types/src/blueprints/functions/query-deployed-functions.d.ts.map +1 -0
  132. package/dist/types/src/blueprints/functions/read.d.ts +22 -0
  133. package/dist/types/src/blueprints/functions/read.d.ts.map +1 -0
  134. package/dist/types/src/blueprints/functions/update.d.ts +27 -0
  135. package/dist/types/src/blueprints/functions/update.d.ts.map +1 -0
  136. package/dist/types/src/blueprints/index.d.ts +1 -1
  137. package/dist/types/src/blueprints/index.d.ts.map +1 -1
  138. package/dist/types/src/blueprints/script-blueprint.d.ts +3 -21
  139. package/dist/types/src/blueprints/script-blueprint.d.ts.map +1 -1
  140. package/dist/types/src/capabilities/app-graph-builder.d.ts +6 -0
  141. package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -0
  142. package/dist/types/src/capabilities/{artifact-definition/artifact-definition.d.ts → artifact-definition.d.ts} +1 -1
  143. package/dist/types/src/capabilities/artifact-definition.d.ts.map +1 -0
  144. package/dist/types/src/capabilities/blueprint-definition.d.ts +6 -0
  145. package/dist/types/src/capabilities/blueprint-definition.d.ts.map +1 -0
  146. package/dist/types/src/capabilities/compiler.d.ts +6 -0
  147. package/dist/types/src/capabilities/compiler.d.ts.map +1 -0
  148. package/dist/types/src/capabilities/index.d.ts +8 -6
  149. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  150. package/dist/types/src/capabilities/operation-handler.d.ts +6 -0
  151. package/dist/types/src/capabilities/operation-handler.d.ts.map +1 -0
  152. package/dist/types/src/capabilities/react-surface.d.ts +5 -0
  153. package/dist/types/src/capabilities/react-surface.d.ts.map +1 -0
  154. package/dist/types/src/capabilities/settings.d.ts +7 -0
  155. package/dist/types/src/capabilities/settings.d.ts.map +1 -0
  156. package/dist/types/src/compiler/compiler.d.ts.map +1 -1
  157. package/dist/types/src/components/{FrameContainer/FrameContainer.d.ts → FramePanel/FramePanel.d.ts} +3 -3
  158. package/dist/types/src/components/FramePanel/FramePanel.d.ts.map +1 -0
  159. package/dist/types/src/components/FramePanel/index.d.ts +2 -0
  160. package/dist/types/src/components/FramePanel/index.d.ts.map +1 -0
  161. package/dist/types/src/components/NotebookStack/NotebookCell.d.ts +1 -1
  162. package/dist/types/src/components/NotebookStack/NotebookCell.d.ts.map +1 -1
  163. package/dist/types/src/components/NotebookStack/NotebookMenu.d.ts +1 -1
  164. package/dist/types/src/components/NotebookStack/NotebookMenu.d.ts.map +1 -1
  165. package/dist/types/src/components/NotebookStack/NotebookStack.d.ts +4 -2
  166. package/dist/types/src/components/NotebookStack/NotebookStack.d.ts.map +1 -1
  167. package/dist/types/src/components/NotebookStack/NotebookStack.stories.d.ts +219 -228
  168. package/dist/types/src/components/NotebookStack/NotebookStack.stories.d.ts.map +1 -1
  169. package/dist/types/src/components/QueryEditor/QueryEditor.d.ts.map +1 -1
  170. package/dist/types/src/components/QueryEditor/QueryEditor.stories.d.ts.map +1 -1
  171. package/dist/types/src/components/ScriptPluginSettings/ScriptPluginSettings.d.ts +8 -0
  172. package/dist/types/src/components/ScriptPluginSettings/ScriptPluginSettings.d.ts.map +1 -0
  173. package/dist/types/src/components/ScriptPluginSettings/ScriptPluginSettings.stories.d.ts +241 -0
  174. package/dist/types/src/components/ScriptPluginSettings/ScriptPluginSettings.stories.d.ts.map +1 -0
  175. package/dist/types/src/components/ScriptPluginSettings/index.d.ts +2 -0
  176. package/dist/types/src/components/ScriptPluginSettings/index.d.ts.map +1 -0
  177. package/dist/types/src/components/ScriptToolbar/ScriptToolbar.d.ts +7 -5
  178. package/dist/types/src/components/ScriptToolbar/ScriptToolbar.d.ts.map +1 -1
  179. package/dist/types/src/components/ScriptToolbar/ScriptToolbar.stories.d.ts +219 -228
  180. package/dist/types/src/components/ScriptToolbar/ScriptToolbar.stories.d.ts.map +1 -1
  181. package/dist/types/src/components/TestPanel/TestPanel.d.ts +4 -2
  182. package/dist/types/src/components/TestPanel/TestPanel.d.ts.map +1 -1
  183. package/dist/types/src/components/TestPanel/index.d.ts +0 -1
  184. package/dist/types/src/components/TestPanel/index.d.ts.map +1 -1
  185. package/dist/types/src/components/TypescriptEditor/TypescriptEditor.d.ts +5 -2
  186. package/dist/types/src/components/TypescriptEditor/TypescriptEditor.d.ts.map +1 -1
  187. package/dist/types/src/components/TypescriptEditor/TypescriptEditor.stories.d.ts +3 -1
  188. package/dist/types/src/components/TypescriptEditor/TypescriptEditor.stories.d.ts.map +1 -1
  189. package/dist/types/src/components/index.d.ts +6 -5
  190. package/dist/types/src/components/index.d.ts.map +1 -1
  191. package/dist/types/src/constants.d.ts +2 -0
  192. package/dist/types/src/constants.d.ts.map +1 -0
  193. package/dist/types/src/{components → containers}/DeploymentDialog/DeploymentDialog.d.ts +0 -2
  194. package/dist/types/src/containers/DeploymentDialog/DeploymentDialog.d.ts.map +1 -0
  195. package/dist/types/src/containers/DeploymentDialog/DeploymentDialog.stories.d.ts +240 -0
  196. package/dist/types/src/{components → containers}/DeploymentDialog/DeploymentDialog.stories.d.ts.map +1 -1
  197. package/dist/types/src/containers/DeploymentDialog/index.d.ts +2 -0
  198. package/dist/types/src/containers/DeploymentDialog/index.d.ts.map +1 -0
  199. package/dist/types/src/containers/NotebookContainer/NotebookContainer.d.ts +7 -0
  200. package/dist/types/src/containers/NotebookContainer/NotebookContainer.d.ts.map +1 -0
  201. package/dist/types/src/containers/NotebookContainer/NotebookContainer.stories.d.ts.map +1 -0
  202. package/dist/types/src/containers/NotebookContainer/index.d.ts +2 -0
  203. package/dist/types/src/containers/NotebookContainer/index.d.ts.map +1 -0
  204. package/dist/types/src/containers/ScriptContainer/ScriptContainer.d.ts +10 -0
  205. package/dist/types/src/containers/ScriptContainer/ScriptContainer.d.ts.map +1 -0
  206. package/dist/types/src/containers/ScriptContainer/ScriptContainer.stories.d.ts +242 -0
  207. package/dist/types/src/containers/ScriptContainer/ScriptContainer.stories.d.ts.map +1 -0
  208. package/dist/types/src/containers/ScriptContainer/index.d.ts +2 -0
  209. package/dist/types/src/containers/ScriptContainer/index.d.ts.map +1 -0
  210. package/dist/types/src/containers/ScriptProperties/BlueprintEditor.d.ts +7 -0
  211. package/dist/types/src/containers/ScriptProperties/BlueprintEditor.d.ts.map +1 -0
  212. package/dist/types/src/containers/ScriptProperties/FunctionBinding.d.ts +7 -0
  213. package/dist/types/src/containers/ScriptProperties/FunctionBinding.d.ts.map +1 -0
  214. package/dist/types/src/containers/ScriptProperties/FunctionPublishing.d.ts +7 -0
  215. package/dist/types/src/containers/ScriptProperties/FunctionPublishing.d.ts.map +1 -0
  216. package/dist/types/src/containers/ScriptProperties/ScriptProperties.d.ts +6 -0
  217. package/dist/types/src/containers/ScriptProperties/ScriptProperties.d.ts.map +1 -0
  218. package/dist/types/src/containers/ScriptProperties/ScriptProperties.stories.d.ts +242 -0
  219. package/dist/types/src/containers/ScriptProperties/ScriptProperties.stories.d.ts.map +1 -0
  220. package/dist/types/src/containers/ScriptProperties/index.d.ts +2 -0
  221. package/dist/types/src/containers/ScriptProperties/index.d.ts.map +1 -0
  222. package/dist/types/src/{components/TestPanel → containers/TestContainer}/TestContainer.d.ts +1 -1
  223. package/dist/types/src/containers/TestContainer/TestContainer.d.ts.map +1 -0
  224. package/dist/types/src/containers/TestContainer/index.d.ts +2 -0
  225. package/dist/types/src/containers/TestContainer/index.d.ts.map +1 -0
  226. package/dist/types/src/containers/index.d.ts +7 -0
  227. package/dist/types/src/containers/index.d.ts.map +1 -0
  228. package/dist/types/src/hooks/deploy.d.ts +18 -5
  229. package/dist/types/src/hooks/deploy.d.ts.map +1 -1
  230. package/dist/types/src/hooks/format.d.ts +2 -1
  231. package/dist/types/src/hooks/format.d.ts.map +1 -1
  232. package/dist/types/src/hooks/template.d.ts +2 -1
  233. package/dist/types/src/hooks/template.d.ts.map +1 -1
  234. package/dist/types/src/hooks/useCompiler.d.ts.map +1 -1
  235. package/dist/types/src/hooks/useCreateAndDeployScriptTemplates.d.ts.map +1 -1
  236. package/dist/types/src/hooks/useToolbarState.d.ts.map +1 -1
  237. package/dist/types/src/index.d.ts +2 -2
  238. package/dist/types/src/index.d.ts.map +1 -1
  239. package/dist/types/src/notebook/compute-graph.d.ts +1 -1
  240. package/dist/types/src/notebook/compute-graph.d.ts.map +1 -1
  241. package/dist/types/src/notebook/eval.d.ts.map +1 -1
  242. package/dist/types/src/notebook/vfs-parser.d.ts.map +1 -1
  243. package/dist/types/src/operations/access-token-created.d.ts +5 -0
  244. package/dist/types/src/operations/access-token-created.d.ts.map +1 -0
  245. package/dist/types/src/operations/create-script.d.ts +5 -0
  246. package/dist/types/src/operations/create-script.d.ts.map +1 -0
  247. package/dist/types/src/operations/definitions.d.ts +29 -0
  248. package/dist/types/src/operations/definitions.d.ts.map +1 -0
  249. package/dist/types/src/operations/index.d.ts +4 -0
  250. package/dist/types/src/operations/index.d.ts.map +1 -0
  251. package/dist/types/src/templates/anthropic.d.ts +4 -5
  252. package/dist/types/src/templates/anthropic.d.ts.map +1 -1
  253. package/dist/types/src/templates/chat.d.ts.map +1 -1
  254. package/dist/types/src/templates/chess-bot.d.ts +7 -5
  255. package/dist/types/src/templates/chess-bot.d.ts.map +1 -1
  256. package/dist/types/src/templates/commentary.d.ts +7 -4
  257. package/dist/types/src/templates/commentary.d.ts.map +1 -1
  258. package/dist/types/src/templates/data-generator.d.ts.map +1 -1
  259. package/dist/types/src/templates/discord.d.ts.map +1 -1
  260. package/dist/types/src/templates/email.d.ts.map +1 -1
  261. package/dist/types/src/templates/forex-effect.d.ts +3 -2
  262. package/dist/types/src/templates/forex-effect.d.ts.map +1 -1
  263. package/dist/types/src/templates/forex.d.ts +3 -2
  264. package/dist/types/src/templates/forex.d.ts.map +1 -1
  265. package/dist/types/src/templates/gmail.d.ts.map +1 -1
  266. package/dist/types/src/templates/index.d.ts +29 -29
  267. package/dist/types/src/templates/index.d.ts.map +1 -1
  268. package/dist/types/src/templates/ping.d.ts +2 -1
  269. package/dist/types/src/templates/ping.d.ts.map +1 -1
  270. package/dist/types/src/testing/index.d.ts +2 -1
  271. package/dist/types/src/testing/index.d.ts.map +1 -1
  272. package/dist/types/src/testing/test-notebook.d.ts +3 -0
  273. package/dist/types/src/testing/test-notebook.d.ts.map +1 -0
  274. package/dist/types/src/testing/test-script.d.ts +7 -0
  275. package/dist/types/src/testing/test-script.d.ts.map +1 -0
  276. package/dist/types/src/translations.d.ts +222 -92
  277. package/dist/types/src/translations.d.ts.map +1 -1
  278. package/dist/types/src/types/Notebook.d.ts +65 -49
  279. package/dist/types/src/types/Notebook.d.ts.map +1 -1
  280. package/dist/types/src/types/Settings.d.ts +7 -0
  281. package/dist/types/src/types/Settings.d.ts.map +1 -0
  282. package/dist/types/src/types/capabilities.d.ts +2 -5
  283. package/dist/types/src/types/capabilities.d.ts.map +1 -1
  284. package/dist/types/src/types/events.d.ts.map +1 -1
  285. package/dist/types/src/types/index.d.ts +0 -1
  286. package/dist/types/src/types/index.d.ts.map +1 -1
  287. package/dist/types/src/types/types.d.ts +1 -5
  288. package/dist/types/src/types/types.d.ts.map +1 -1
  289. package/dist/types/src/util/deploy.d.ts +2 -2
  290. package/dist/types/src/util/deploy.d.ts.map +1 -1
  291. package/dist/types/src/util/functions.d.ts +2 -2
  292. package/dist/types/src/util/functions.d.ts.map +1 -1
  293. package/dist/types/tsconfig.tsbuildinfo +1 -1
  294. package/package.json +121 -99
  295. package/src/ScriptPlugin.node.ts +70 -0
  296. package/src/ScriptPlugin.test.ts +31 -0
  297. package/src/ScriptPlugin.tsx +52 -34
  298. package/src/blueprints/functions/create.ts +47 -0
  299. package/src/blueprints/functions/definitions.ts +323 -0
  300. package/src/blueprints/functions/delete.ts +23 -0
  301. package/src/blueprints/functions/deploy.ts +70 -0
  302. package/src/blueprints/functions/index.ts +19 -0
  303. package/src/blueprints/functions/inspect-invocations.ts +56 -0
  304. package/src/blueprints/functions/install-function.ts +56 -0
  305. package/src/blueprints/functions/invoke.ts +35 -0
  306. package/src/blueprints/functions/query-deployed-functions.ts +31 -0
  307. package/src/blueprints/functions/read.ts +29 -0
  308. package/src/blueprints/functions/update.ts +68 -0
  309. package/src/blueprints/index.ts +1 -1
  310. package/src/blueprints/script-blueprint.ts +40 -9
  311. package/src/capabilities/app-graph-builder.ts +47 -0
  312. package/src/capabilities/{artifact-definition/artifact-definition.ts → artifact-definition.ts} +2 -3
  313. package/src/capabilities/blueprint-definition.ts +19 -0
  314. package/src/capabilities/{compiler/compiler.ts → compiler.ts} +17 -9
  315. package/src/capabilities/index.ts +13 -6
  316. package/src/capabilities/operation-handler.ts +21 -0
  317. package/src/capabilities/react-surface.tsx +130 -0
  318. package/src/capabilities/{settings/settings.ts → settings.ts} +7 -6
  319. package/src/compiler/compiler.ts +8 -1
  320. package/src/components/{FrameContainer/FrameContainer.tsx → FramePanel/FramePanel.tsx} +4 -5
  321. package/src/components/{FrameContainer → FramePanel}/index.ts +1 -1
  322. package/src/components/NotebookStack/NotebookCell.tsx +31 -22
  323. package/src/components/NotebookStack/NotebookMenu.tsx +7 -7
  324. package/src/components/NotebookStack/NotebookStack.stories.tsx +7 -9
  325. package/src/components/NotebookStack/NotebookStack.tsx +27 -16
  326. package/src/components/QueryEditor/QueryEditor.stories.tsx +18 -22
  327. package/src/components/ScriptPluginSettings/ScriptPluginSettings.stories.tsx +32 -0
  328. package/src/components/ScriptPluginSettings/ScriptPluginSettings.tsx +42 -0
  329. package/src/components/ScriptPluginSettings/index.ts +5 -0
  330. package/src/components/ScriptToolbar/ScriptToolbar.stories.tsx +8 -9
  331. package/src/components/ScriptToolbar/ScriptToolbar.tsx +24 -26
  332. package/src/components/TestPanel/TestPanel.tsx +110 -194
  333. package/src/components/TestPanel/index.ts +0 -1
  334. package/src/components/TypescriptEditor/TypescriptEditor.stories.tsx +17 -15
  335. package/src/components/TypescriptEditor/TypescriptEditor.tsx +26 -19
  336. package/src/components/index.ts +6 -7
  337. package/src/constants.ts +7 -0
  338. package/src/{components → containers}/DeploymentDialog/DeploymentDialog.stories.tsx +8 -7
  339. package/src/{components → containers}/DeploymentDialog/DeploymentDialog.tsx +33 -37
  340. package/src/containers/DeploymentDialog/index.ts +5 -0
  341. package/src/{components → containers/NotebookContainer}/NotebookContainer.stories.tsx +18 -20
  342. package/src/{components → containers/NotebookContainer}/NotebookContainer.tsx +61 -77
  343. package/src/containers/NotebookContainer/index.ts +5 -0
  344. package/src/containers/ScriptContainer/ScriptContainer.stories.tsx +106 -0
  345. package/src/{components → containers/ScriptContainer}/ScriptContainer.tsx +28 -27
  346. package/src/containers/ScriptContainer/index.ts +5 -0
  347. package/src/containers/ScriptProperties/BlueprintEditor.tsx +101 -0
  348. package/src/containers/ScriptProperties/FunctionBinding.tsx +83 -0
  349. package/src/containers/ScriptProperties/FunctionPublishing.tsx +121 -0
  350. package/src/containers/ScriptProperties/ScriptProperties.stories.tsx +75 -0
  351. package/src/containers/ScriptProperties/ScriptProperties.tsx +24 -0
  352. package/src/containers/ScriptProperties/index.ts +5 -0
  353. package/src/containers/TestContainer/TestContainer.tsx +44 -0
  354. package/src/containers/TestContainer/index.ts +5 -0
  355. package/src/containers/index.ts +11 -0
  356. package/src/e2e/ai.test.ts +7 -6
  357. package/src/e2e/deploy.test.ts +5 -5
  358. package/src/hooks/deploy.ts +15 -13
  359. package/src/hooks/format.ts +6 -5
  360. package/src/hooks/template.ts +9 -8
  361. package/src/hooks/useCompiler.ts +4 -3
  362. package/src/hooks/useCreateAndDeployScriptTemplates.ts +5 -4
  363. package/src/hooks/useToolbarState.ts +7 -6
  364. package/src/index.ts +6 -3
  365. package/src/meta.ts +2 -2
  366. package/src/notebook/compute-graph.test.ts +7 -7
  367. package/src/notebook/compute-graph.ts +1 -1
  368. package/src/notebook/vfs-parser.ts +10 -3
  369. package/src/operations/access-token-created.ts +37 -0
  370. package/src/operations/create-script.ts +46 -0
  371. package/src/operations/definitions.ts +40 -0
  372. package/src/operations/index.ts +12 -0
  373. package/src/templates/anthropic.ts +19 -12
  374. package/src/templates/chat.ts +1 -1
  375. package/src/templates/chess-bot.ts +37 -34
  376. package/src/templates/commentary.ts +178 -162
  377. package/src/templates/data-generator.ts +1 -1
  378. package/src/templates/discord.ts +3 -3
  379. package/src/templates/forex-effect.ts +30 -19
  380. package/src/templates/forex.ts +24 -15
  381. package/src/templates/gmail.ts +4 -4
  382. package/src/templates/index.ts +18 -18
  383. package/src/templates/ping.ts +16 -8
  384. package/src/testing/index.ts +2 -1
  385. package/src/testing/simulator.test.ts +3 -4
  386. package/src/testing/{data.ts → test-notebook.ts} +4 -5
  387. package/src/testing/test-script.ts +29 -0
  388. package/src/translations.ts +86 -87
  389. package/src/types/Notebook.ts +12 -8
  390. package/src/types/Settings.ts +20 -0
  391. package/src/types/capabilities.ts +5 -5
  392. package/src/types/events.ts +2 -2
  393. package/src/types/index.ts +0 -1
  394. package/src/types/types.ts +1 -11
  395. package/src/util/deploy.ts +13 -11
  396. package/src/util/functions.ts +9 -8
  397. package/dist/lib/browser/DeploymentDialog-GXNRUXF6.mjs +0 -14
  398. package/dist/lib/browser/DeploymentDialog-GXNRUXF6.mjs.map +0 -7
  399. package/dist/lib/browser/NotebookContainer-4MM2VAQF.mjs.map +0 -7
  400. package/dist/lib/browser/ScriptContainer-X6GCYZZW.mjs +0 -149
  401. package/dist/lib/browser/ScriptContainer-X6GCYZZW.mjs.map +0 -7
  402. package/dist/lib/browser/app-graph-builder-7VO7AUI6.mjs +0 -68
  403. package/dist/lib/browser/app-graph-builder-7VO7AUI6.mjs.map +0 -7
  404. package/dist/lib/browser/blueprint-definition-OSOUYI7A.mjs +0 -17
  405. package/dist/lib/browser/blueprint-definition-OSOUYI7A.mjs.map +0 -7
  406. package/dist/lib/browser/chunk-3O2DQGCP.mjs +0 -113
  407. package/dist/lib/browser/chunk-3O2DQGCP.mjs.map +0 -7
  408. package/dist/lib/browser/chunk-BTWHM6FH.mjs +0 -270
  409. package/dist/lib/browser/chunk-BTWHM6FH.mjs.map +0 -7
  410. package/dist/lib/browser/chunk-F3QKSKSF.mjs +0 -35
  411. package/dist/lib/browser/chunk-F3QKSKSF.mjs.map +0 -7
  412. package/dist/lib/browser/chunk-I7CSE6T3.mjs +0 -110
  413. package/dist/lib/browser/chunk-I7CSE6T3.mjs.map +0 -7
  414. package/dist/lib/browser/chunk-IQRLM6JK.mjs +0 -137
  415. package/dist/lib/browser/chunk-IQRLM6JK.mjs.map +0 -7
  416. package/dist/lib/browser/chunk-NWSK27QB.mjs +0 -606
  417. package/dist/lib/browser/chunk-NWSK27QB.mjs.map +0 -7
  418. package/dist/lib/browser/chunk-UX4GHJ5E.mjs.map +0 -7
  419. package/dist/lib/browser/chunk-WX2NVNFQ.mjs +0 -557
  420. package/dist/lib/browser/chunk-WX2NVNFQ.mjs.map +0 -7
  421. package/dist/lib/browser/chunk-WYR4QHPE.mjs +0 -31
  422. package/dist/lib/browser/chunk-WYR4QHPE.mjs.map +0 -7
  423. package/dist/lib/browser/compiler-XRBFQFXO.mjs +0 -161
  424. package/dist/lib/browser/compiler-XRBFQFXO.mjs.map +0 -7
  425. package/dist/lib/browser/operation-resolver-MUNR376F.mjs +0 -82
  426. package/dist/lib/browser/operation-resolver-MUNR376F.mjs.map +0 -7
  427. package/dist/lib/browser/react-surface-5TEC66UY.mjs +0 -139
  428. package/dist/lib/browser/react-surface-5TEC66UY.mjs.map +0 -7
  429. package/dist/lib/browser/settings-R4WKREUJ.mjs +0 -35
  430. package/dist/lib/browser/settings-R4WKREUJ.mjs.map +0 -7
  431. package/dist/lib/node-esm/DeploymentDialog-EVFV2VJT.mjs +0 -15
  432. package/dist/lib/node-esm/DeploymentDialog-EVFV2VJT.mjs.map +0 -7
  433. package/dist/lib/node-esm/NotebookContainer-QLW5ZYGS.mjs.map +0 -7
  434. package/dist/lib/node-esm/ScriptContainer-3DZ3BMHW.mjs +0 -150
  435. package/dist/lib/node-esm/ScriptContainer-3DZ3BMHW.mjs.map +0 -7
  436. package/dist/lib/node-esm/app-graph-builder-NVE3EVBG.mjs +0 -69
  437. package/dist/lib/node-esm/app-graph-builder-NVE3EVBG.mjs.map +0 -7
  438. package/dist/lib/node-esm/blueprint-definition-NC7NNJGI.mjs +0 -18
  439. package/dist/lib/node-esm/blueprint-definition-NC7NNJGI.mjs.map +0 -7
  440. package/dist/lib/node-esm/chunk-4F5FJZ36.mjs.map +0 -7
  441. package/dist/lib/node-esm/chunk-5HSJPAK7.mjs +0 -33
  442. package/dist/lib/node-esm/chunk-5HSJPAK7.mjs.map +0 -7
  443. package/dist/lib/node-esm/chunk-KN6SQYUF.mjs +0 -114
  444. package/dist/lib/node-esm/chunk-KN6SQYUF.mjs.map +0 -7
  445. package/dist/lib/node-esm/chunk-MGWKULCD.mjs +0 -558
  446. package/dist/lib/node-esm/chunk-MGWKULCD.mjs.map +0 -7
  447. package/dist/lib/node-esm/chunk-SLU3KRV3.mjs +0 -112
  448. package/dist/lib/node-esm/chunk-SLU3KRV3.mjs.map +0 -7
  449. package/dist/lib/node-esm/chunk-VWOLKNMO.mjs +0 -271
  450. package/dist/lib/node-esm/chunk-VWOLKNMO.mjs.map +0 -7
  451. package/dist/lib/node-esm/chunk-Y3G5NCTP.mjs +0 -36
  452. package/dist/lib/node-esm/chunk-Y3G5NCTP.mjs.map +0 -7
  453. package/dist/lib/node-esm/chunk-YEWLTVBT.mjs +0 -138
  454. package/dist/lib/node-esm/chunk-YEWLTVBT.mjs.map +0 -7
  455. package/dist/lib/node-esm/chunk-ZQGHFNO3.mjs +0 -607
  456. package/dist/lib/node-esm/chunk-ZQGHFNO3.mjs.map +0 -7
  457. package/dist/lib/node-esm/compiler-ORJAXDN7.mjs +0 -162
  458. package/dist/lib/node-esm/compiler-ORJAXDN7.mjs.map +0 -7
  459. package/dist/lib/node-esm/operation-resolver-CLE4ZCC5.mjs +0 -83
  460. package/dist/lib/node-esm/operation-resolver-CLE4ZCC5.mjs.map +0 -7
  461. package/dist/lib/node-esm/react-surface-O3UDMKOQ.mjs +0 -140
  462. package/dist/lib/node-esm/react-surface-O3UDMKOQ.mjs.map +0 -7
  463. package/dist/lib/node-esm/settings-OFIMHU7K.mjs +0 -36
  464. package/dist/lib/node-esm/settings-OFIMHU7K.mjs.map +0 -7
  465. package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts +0 -6
  466. package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts.map +0 -1
  467. package/dist/types/src/capabilities/app-graph-builder/index.d.ts +0 -3
  468. package/dist/types/src/capabilities/app-graph-builder/index.d.ts.map +0 -1
  469. package/dist/types/src/capabilities/artifact-definition/artifact-definition.d.ts.map +0 -1
  470. package/dist/types/src/capabilities/artifact-definition/index.d.ts +0 -3
  471. package/dist/types/src/capabilities/artifact-definition/index.d.ts.map +0 -1
  472. package/dist/types/src/capabilities/blueprint-definition/blueprint-definition.d.ts +0 -9
  473. package/dist/types/src/capabilities/blueprint-definition/blueprint-definition.d.ts.map +0 -1
  474. package/dist/types/src/capabilities/blueprint-definition/index.d.ts +0 -3
  475. package/dist/types/src/capabilities/blueprint-definition/index.d.ts.map +0 -1
  476. package/dist/types/src/capabilities/compiler/compiler.d.ts +0 -6
  477. package/dist/types/src/capabilities/compiler/compiler.d.ts.map +0 -1
  478. package/dist/types/src/capabilities/compiler/index.d.ts +0 -3
  479. package/dist/types/src/capabilities/compiler/index.d.ts.map +0 -1
  480. package/dist/types/src/capabilities/operation-resolver/index.d.ts +0 -3
  481. package/dist/types/src/capabilities/operation-resolver/index.d.ts.map +0 -1
  482. package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts +0 -5
  483. package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts.map +0 -1
  484. package/dist/types/src/capabilities/react-surface/index.d.ts +0 -3
  485. package/dist/types/src/capabilities/react-surface/index.d.ts.map +0 -1
  486. package/dist/types/src/capabilities/react-surface/react-surface.d.ts +0 -5
  487. package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +0 -1
  488. package/dist/types/src/capabilities/settings/index.d.ts +0 -7
  489. package/dist/types/src/capabilities/settings/index.d.ts.map +0 -1
  490. package/dist/types/src/capabilities/settings/settings.d.ts +0 -9
  491. package/dist/types/src/capabilities/settings/settings.d.ts.map +0 -1
  492. package/dist/types/src/components/DeploymentDialog/DeploymentDialog.d.ts.map +0 -1
  493. package/dist/types/src/components/DeploymentDialog/DeploymentDialog.stories.d.ts +0 -249
  494. package/dist/types/src/components/DeploymentDialog/index.d.ts +0 -4
  495. package/dist/types/src/components/DeploymentDialog/index.d.ts.map +0 -1
  496. package/dist/types/src/components/FrameContainer/FrameContainer.d.ts.map +0 -1
  497. package/dist/types/src/components/FrameContainer/frame.d.ts +0 -2
  498. package/dist/types/src/components/FrameContainer/frame.d.ts.map +0 -1
  499. package/dist/types/src/components/FrameContainer/index.d.ts +0 -2
  500. package/dist/types/src/components/FrameContainer/index.d.ts.map +0 -1
  501. package/dist/types/src/components/NotebookContainer.d.ts +0 -8
  502. package/dist/types/src/components/NotebookContainer.d.ts.map +0 -1
  503. package/dist/types/src/components/NotebookContainer.stories.d.ts.map +0 -1
  504. package/dist/types/src/components/ScriptContainer.d.ts +0 -11
  505. package/dist/types/src/components/ScriptContainer.d.ts.map +0 -1
  506. package/dist/types/src/components/Settings/ScriptObjectSettings.d.ts +0 -8
  507. package/dist/types/src/components/Settings/ScriptObjectSettings.d.ts.map +0 -1
  508. package/dist/types/src/components/Settings/ScriptPluginSettings.d.ts +0 -8
  509. package/dist/types/src/components/Settings/ScriptPluginSettings.d.ts.map +0 -1
  510. package/dist/types/src/components/Settings/index.d.ts +0 -3
  511. package/dist/types/src/components/Settings/index.d.ts.map +0 -1
  512. package/dist/types/src/components/TestPanel/TestContainer.d.ts.map +0 -1
  513. package/dist/types/src/testing/data.d.ts +0 -3
  514. package/dist/types/src/testing/data.d.ts.map +0 -1
  515. package/dist/types/src/types/actions.d.ts +0 -40
  516. package/dist/types/src/types/actions.d.ts.map +0 -1
  517. package/src/capabilities/app-graph-builder/app-graph-builder.ts +0 -55
  518. package/src/capabilities/app-graph-builder/index.ts +0 -7
  519. package/src/capabilities/artifact-definition/index.ts +0 -7
  520. package/src/capabilities/blueprint-definition/blueprint-definition.ts +0 -23
  521. package/src/capabilities/blueprint-definition/index.ts +0 -7
  522. package/src/capabilities/compiler/index.ts +0 -7
  523. package/src/capabilities/operation-resolver/index.ts +0 -7
  524. package/src/capabilities/operation-resolver/operation-resolver.ts +0 -74
  525. package/src/capabilities/react-surface/index.ts +0 -7
  526. package/src/capabilities/react-surface/react-surface.tsx +0 -118
  527. package/src/capabilities/settings/index.ts +0 -7
  528. package/src/components/DeploymentDialog/index.ts +0 -9
  529. package/src/components/FrameContainer/frame.html +0 -25
  530. package/src/components/FrameContainer/frame.tsx +0 -51
  531. package/src/components/Settings/ScriptObjectSettings.tsx +0 -309
  532. package/src/components/Settings/ScriptPluginSettings.tsx +0 -66
  533. package/src/components/Settings/index.ts +0 -6
  534. package/src/components/TestPanel/TestContainer.tsx +0 -27
  535. package/src/types/actions.ts +0 -45
  536. /package/dist/types/src/{components → containers/NotebookContainer}/NotebookContainer.stories.d.ts +0 -0
@@ -12,28 +12,31 @@ import * as Option from 'effect/Option';
12
12
  import * as Schema from 'effect/Schema';
13
13
 
14
14
  import { AiService, ConsolePrinter, ToolExecutionService, ToolResolverService } from '@dxos/ai';
15
- import { AiSession, GenerationObserver } from '@dxos/assistant';
15
+ import { AiRequest, GenerationObserver } from '@dxos/assistant';
16
16
  import { ArtifactId } from '@dxos/assistant';
17
- import { Database, Filter, Obj, Ref, Relation, Type } from '@dxos/echo';
17
+ import { Trace, Operation, OperationRegistry } from '@dxos/compute';
18
+ import { Database, Filter, Obj, Ref, Relation } from '@dxos/echo';
19
+ import { Collection } from '@dxos/echo';
18
20
  import { createDocAccessor } from '@dxos/echo-db';
19
- import { TracingService, defineFunction } from '@dxos/functions';
20
21
  import { log } from '@dxos/log';
21
22
  import { Chess } from '@dxos/plugin-chess/types';
22
23
  import { Markdown } from '@dxos/plugin-markdown/types';
23
- import { Collection, Text } from '@dxos/schema';
24
+ import { Text } from '@dxos/schema';
24
25
  import { HasSubject } from '@dxos/types';
25
26
  import { trim } from '@dxos/util';
26
27
 
27
- export default defineFunction({
28
- key: 'dxos.org/function/chess/commentary',
29
- name: 'Commentary',
30
- description: 'Adds commentary about the most recent move to a markdown document associated with the chess game.',
31
- inputSchema: Schema.Struct({
32
- game: Type.Ref(Chess.Game).annotations({
28
+ const Commentary = Operation.make({
29
+ meta: {
30
+ key: 'org.dxos.function.chess.commentary',
31
+ name: 'Commentary',
32
+ description: 'Adds commentary about the most recent move to a markdown document associated with the chess game.',
33
+ },
34
+ input: Schema.Struct({
35
+ game: Ref.Ref(Chess.Game).annotations({
33
36
  description: 'The chess game to comment on.',
34
37
  }),
35
38
  }),
36
- outputSchema: Schema.Union(
39
+ output: Schema.Union(
37
40
  Schema.Struct({
38
41
  documentId: ArtifactId.annotations({
39
42
  description: 'The ID of the markdown document that was updated or created.',
@@ -48,166 +51,179 @@ export default defineFunction({
48
51
  ),
49
52
  types: [Chess.Game, Markdown.Document, Text.Text, HasSubject.HasSubject, Collection.Collection],
50
53
  services: [AiService.AiService, Database.Service],
51
- handler: Effect.fnUntraced(
52
- function* ({ data: { game: gameRef } }) {
53
- // Load the chess game
54
- log.info('load game', { gameRef });
55
- const chessGame = yield* Database.Service.load(gameRef);
56
-
57
- // Load the chess position from PGN or FEN
58
- const chess = new ChessJS();
59
- if (chessGame.pgn) {
60
- chess.loadPgn(chessGame.pgn);
61
- } else if (chessGame.fen) {
62
- chess.load(chessGame.fen);
63
- } else {
64
- log.info('Early return: no pgn or fen');
65
- return;
66
- }
67
-
68
- // Get the most recent move
69
- const history = chess.history({ verbose: true });
70
- if (history.length === 0) {
71
- throw new Error('No moves have been played yet');
72
- }
73
- const lastMove = history[history.length - 1];
74
- const moveNumber = Math.ceil(history.length / 2);
75
- const isWhiteMove = history.length % 2 === 1;
76
- const player = isWhiteMove ? 'White' : 'Black';
77
- const moveNotation = lastMove.san;
78
-
79
- // Generate AI commentary about the move
80
- const result = yield* new AiSession().run({
81
- prompt:
82
- `Comment on this chess move as if you're commentating a live match for an audience:\n\n` +
83
- `Move ${moveNumber}: ${player} plays ${moveNotation} (${lastMove.from} to ${lastMove.to})${lastMove.captured ? `, capturing ${lastMove.captured}` : ''}\n` +
84
- `Current position: ${chess.fen()}\n` +
85
- `${chess.isCheck() ? 'The king is in check! ' : ''}` +
86
- `${chess.isCheckmate() ? 'CHECKMATE! ' : ''}` +
87
- `${chess.isStalemate() ? 'STALEMATE! ' : ''}` +
88
- `\nGame so far:\n${chess.pgn()}`,
89
- system: COMMENTARY_SYSTEM_PROMPT,
90
- history: [],
91
- observer: GenerationObserver.fromPrinter(new ConsolePrinter({ tag: 'chess-commentary' })),
92
- });
93
-
94
- const commentaryText = Function.pipe(
95
- result,
96
- Array.findLast((msg) => msg.sender.role === 'assistant' && msg.blocks.some((block) => block._tag === 'text')),
97
- Option.flatMap((msg) =>
98
- Function.pipe(
99
- msg.blocks,
100
- Array.findLast((block) => block._tag === 'text'),
101
- Option.map((block) => block.text),
102
- ),
103
- ),
104
- Option.getOrThrowWith(() => new Error('No commentary generated')),
105
- );
106
-
107
- const commentary = `## Move ${moveNumber}: ${player} plays ${moveNotation}\n\n${commentaryText}\n\n`;
108
- log.info('commentary', { commentary });
109
-
110
- // TODO(wittjosiah): Functions currently don't support traversals.
111
- // const docs = yield* Database.Service.runQuery(
112
- // Query.select(Filter.id(chessGame.id)).targetOf(HasSubject.HasSubject).source(),
113
- // ).pipe(Effect.map((objects) => objects.filter((object) => Obj.instanceOf(Markdown.Document, object))));
114
- const docs = yield* Database.Service.runQuery(Filter.type(HasSubject.HasSubject)).pipe(
115
- Effect.map((relations) =>
116
- relations.filter((relation) => {
117
- // TODO(wittjosiah): This is a workaround for getTarget not handling deleted objects.
118
- try {
119
- log.info('relation', {
120
- source: Obj.getDXN(Relation.getTarget(relation)).toString(),
121
- game: Obj.getDXN(chessGame).toString(),
122
- });
123
- return Obj.getDXN(Relation.getTarget(relation)).toString() === Obj.getDXN(chessGame).toString();
124
- } catch {
125
- return false;
126
- }
127
- }),
128
- ),
129
- Effect.map((relations) =>
130
- relations
131
- .map((relation) => {
132
- // TODO(wittjosiah): This is a workaround for getSource not handling deleted objects.
133
- try {
134
- return Relation.getSource(relation);
135
- } catch {
136
- return undefined;
137
- }
138
- })
139
- .filter((source) => source !== undefined),
140
- ),
141
- Effect.map((sources) => {
142
- const docs = sources.filter((source) => Obj.instanceOf(Markdown.Document, source));
143
- log.info('docs', { sources, docs });
144
- return docs;
145
- }),
146
- );
147
- log.info('docs', { count: docs.length });
148
-
149
- let document: Markdown.Document;
150
- if (docs.length === 0) {
151
- // TODO(wittjosiah): Deploy fails if `SpaceProperties` schema is imported because its from `client-protocol`.
152
- const [properties] = yield* Database.Service.runQuery(Filter.typename('dxos.org/type/Properties'));
153
- const rootCollection = yield* Database.Service.load<Collection.Collection>(
154
- properties[Collection.Collection.typename],
155
- );
54
+ });
156
55
 
157
- log.info('rootCollection', { rootCollection });
56
+ export default Commentary.pipe(
57
+ Operation.withHandler(
58
+ Effect.fnUntraced(
59
+ function* ({ game: gameRef }) {
60
+ // Load the chess game
61
+ log.info('load game', { gameRef });
62
+ const chessGame = yield* Database.load(gameRef);
63
+
64
+ // Load the chess position from PGN or FEN
65
+ const chess = new ChessJS();
66
+ if (chessGame.pgn) {
67
+ chess.loadPgn(chessGame.pgn);
68
+ } else if (chessGame.fen) {
69
+ chess.load(chessGame.fen);
70
+ } else {
71
+ log.info('Early return: no pgn or fen');
72
+ return;
73
+ }
74
+
75
+ // Get the most recent move
76
+ const history = chess.history({ verbose: true });
77
+ if (history.length === 0) {
78
+ throw new Error('No moves have been played yet');
79
+ }
80
+ const lastMove = history[history.length - 1];
81
+ const moveNumber = Math.ceil(history.length / 2);
82
+ const isWhiteMove = history.length % 2 === 1;
83
+ const player = isWhiteMove ? 'White' : 'Black';
84
+ const moveNotation = lastMove.san;
85
+
86
+ // Generate AI commentary about the move
87
+ const result = yield* new AiRequest({
88
+ observer: GenerationObserver.fromPrinter(new ConsolePrinter({ tag: 'chess-commentary' })),
89
+ }).run({
90
+ prompt:
91
+ `Comment on this chess move as if you're commentating a live match for an audience:\n\n` +
92
+ `Move ${moveNumber}: ${player} plays ${moveNotation} (${lastMove.from} to ${lastMove.to})${lastMove.captured ? `, capturing ${lastMove.captured}` : ''}\n` +
93
+ `Current position: ${chess.fen()}\n` +
94
+ `${chess.isCheck() ? 'The king is in check! ' : ''}` +
95
+ `${chess.isCheckmate() ? 'CHECKMATE! ' : ''}` +
96
+ `${chess.isStalemate() ? 'STALEMATE! ' : ''}` +
97
+ `\nGame so far:\n${chess.pgn()}`,
98
+ system: COMMENTARY_SYSTEM_PROMPT,
99
+ history: [],
100
+ });
158
101
 
159
- // Create a new markdown document
160
- const gameName = chessGame.name || 'Chess Game';
161
- document = yield* Database.Service.add(
162
- Markdown.make({
163
- name: `${gameName} Commentary`,
164
- content: `# ${gameName} Commentary\n\n${commentary}`,
165
- }),
102
+ const commentaryText = Function.pipe(
103
+ result,
104
+ Array.findLast((msg) => msg.sender.role === 'assistant' && msg.blocks.some((block) => block._tag === 'text')),
105
+ Option.flatMap((msg) =>
106
+ Function.pipe(
107
+ msg.blocks,
108
+ Array.findLast((block) => block._tag === 'text'),
109
+ Option.map((block) => block.text),
110
+ ),
111
+ ),
112
+ Option.getOrThrowWith(() => new Error('No commentary generated')),
166
113
  );
167
114
 
168
- const documentRef = Ref.make(document);
169
- Obj.change(rootCollection, (c) => {
170
- c.objects.push(documentRef);
171
- });
172
-
173
- // Create the HasSubject relation
174
- yield* Database.Service.add(
175
- Relation.make(HasSubject.HasSubject, {
176
- [Relation.Source]: document,
177
- [Relation.Target]: chessGame,
178
- completedAt: new Date().toISOString(),
115
+ const commentary = `## Move ${moveNumber}: ${player} plays ${moveNotation}\n\n${commentaryText}\n\n`;
116
+ log.info('commentary', { commentary });
117
+
118
+ // TODO(wittjosiah): Functions currently don't support traversals.
119
+ // const docs = yield* Database.runQuery(
120
+ // Query.select(Filter.id(chessGame.id)).targetOf(HasSubject.HasSubject).source(),
121
+ // ).pipe(Effect.map((objects) => objects.filter((object) => Obj.instanceOf(Markdown.Document, object))));
122
+ const docs = yield* Database.runQuery(Filter.type(HasSubject.HasSubject)).pipe(
123
+ Effect.map((relations) =>
124
+ relations.filter((relation) => {
125
+ // TODO(wittjosiah): This is a workaround for getTarget not handling deleted objects.
126
+ try {
127
+ log.info('relation', {
128
+ source: Obj.getDXN(Relation.getTarget(relation)).toString(),
129
+ game: Obj.getDXN(chessGame).toString(),
130
+ });
131
+ return Obj.getDXN(Relation.getTarget(relation)).toString() === Obj.getDXN(chessGame).toString();
132
+ } catch {
133
+ return false;
134
+ }
135
+ }),
136
+ ),
137
+ Effect.map((relations) =>
138
+ relations
139
+ .map((relation) => {
140
+ // TODO(wittjosiah): This is a workaround for getSource not handling deleted objects.
141
+ try {
142
+ return Relation.getSource(relation);
143
+ } catch {
144
+ return undefined;
145
+ }
146
+ })
147
+ .filter((source) => source !== undefined),
148
+ ),
149
+ Effect.map((sources) => {
150
+ const docs = sources.filter((source) => Obj.instanceOf(Markdown.Document, source));
151
+ log.info('docs', { sources, docs });
152
+ return docs;
179
153
  }),
180
154
  );
181
- } else {
182
- document = docs[0];
183
-
184
- // Load the text content and append the commentary
185
- const text = yield* Database.Service.load(document.content);
186
- const accessor = createDocAccessor(text, ['content']);
187
- accessor.handle.change((doc: A.Doc<Text.Text>) => {
188
- A.splice(doc, accessor.path.slice(), text.content.length, 0, commentary);
189
- });
190
- }
191
-
192
- log.info('result', { documentId: Obj.getDXN(document).toString(), commentary });
193
-
194
- yield* Database.Service.flush();
195
-
196
- return {
197
- documentId: Obj.getDXN(document).toString(),
198
- commentary,
199
- };
200
- },
201
- Effect.provide(
202
- Layer.mergeAll(
203
- AiService.model('@anthropic/claude-haiku-4-5'),
204
- ToolResolverService.layerEmpty,
205
- ToolExecutionService.layerEmpty,
206
- TracingService.layerNoop,
155
+ log.info('docs', { count: docs.length });
156
+
157
+ let document: Markdown.Document;
158
+ if (docs.length === 0) {
159
+ // TODO(wittjosiah): Deploy fails if `SpaceProperties` schema is imported because its from `client-protocol`.
160
+ const [properties] = yield* Database.runQuery(Filter.typename('org.dxos.type.spaceProperties'));
161
+ const rootCollection = yield* Database.load<Collection.Collection>(
162
+ properties[Collection.Collection.typename],
163
+ );
164
+
165
+ log.info('rootCollection', { rootCollection });
166
+
167
+ // Create a new markdown document
168
+ const gameName = chessGame.name || 'Chess Game';
169
+ document = yield* Database.add(
170
+ Markdown.make({
171
+ name: `${gameName} Commentary`,
172
+ content: `# ${gameName} Commentary\n\n${commentary}`,
173
+ }),
174
+ );
175
+
176
+ const documentRef = Ref.make(document);
177
+ Obj.update(rootCollection, (rootCollection) => {
178
+ rootCollection.objects.push(documentRef);
179
+ });
180
+
181
+ // Create the HasSubject relation
182
+ yield* Database.add(
183
+ Relation.make(HasSubject.HasSubject, {
184
+ [Relation.Source]: document,
185
+ [Relation.Target]: chessGame,
186
+ completedAt: new Date().toISOString(),
187
+ }),
188
+ );
189
+ } else {
190
+ document = docs[0];
191
+
192
+ // Load the text content and append the commentary
193
+ const text = yield* Database.load(document.content);
194
+ const accessor = createDocAccessor(text, ['content']);
195
+ accessor.handle.change((doc: A.Doc<Text.Text>) => {
196
+ A.splice(doc, accessor.path.slice(), text.content.length, 0, commentary);
197
+ });
198
+ }
199
+
200
+ log.info('result', { documentId: Obj.getDXN(document).toString(), commentary });
201
+
202
+ yield* Database.flush();
203
+
204
+ return {
205
+ documentId: Obj.getDXN(document).toString(),
206
+ commentary,
207
+ };
208
+ },
209
+ Effect.provide(
210
+ Layer.mergeAll(
211
+ AiService.model('@anthropic/claude-haiku-4-5'),
212
+ ToolResolverService.layerEmpty,
213
+ ToolExecutionService.layerEmpty,
214
+ Trace.writerLayerNoop,
215
+ Database.notAvailable,
216
+ Layer.succeed(Operation.Service, {
217
+ invoke: () => Effect.die('Not available.'),
218
+ schedule: () => Effect.die('Not available.'),
219
+ invokePromise: async () => ({ error: new Error('Not available.') }),
220
+ } as any),
221
+ Layer.succeed(OperationRegistry.Service, { resolve: () => Effect.succeed(undefined) } as any),
222
+ ),
207
223
  ),
208
224
  ),
209
225
  ),
210
- });
226
+ );
211
227
 
212
228
  const COMMENTARY_SYSTEM_PROMPT = trim`
213
229
  You are a professional chess commentator providing live commentary for a chess match.
@@ -8,7 +8,7 @@ import { Expando, S, create, defineFunction } from 'dxos:functions';
8
8
  import { randText } from 'https://esm.sh/@ngneat/falso@7.1.1?bundle=false';
9
9
 
10
10
  export default defineFunction({
11
- key: 'dxos.org/script/data-generator',
11
+ key: 'org.dxos.script.data-generator',
12
12
  name: 'Data Generator',
13
13
  inputSchema: S.Struct({
14
14
  documentAmount: S.optional(S.Number),
@@ -29,7 +29,7 @@ const MessageSchema = S.Struct({
29
29
  content: S.String,
30
30
  }).pipe(
31
31
  EchoObject({
32
- typename: 'example.com/type/Message',
32
+ typename: 'com.example.type.message',
33
33
  version: '0.1.0',
34
34
  }),
35
35
  );
@@ -42,7 +42,7 @@ const generateSnowflake = (unixTimestamp: number): bigint => {
42
42
  };
43
43
 
44
44
  export default defineFunction({
45
- key: 'dxos.org/script/discord',
45
+ key: 'org.dxos.script.discord',
46
46
  name: 'Discord',
47
47
  inputSchema: S.Struct({
48
48
  // TODO(wittjosiah): Remove. This is used to provide a terminal for a cron trigger.
@@ -60,7 +60,7 @@ export default defineFunction({
60
60
  handler: ({ data: { channelId, queueId, after = DEFAULT_AFTER, pageSize = 5 }, context: { space } }: any) =>
61
61
  Effect.gen(function* () {
62
62
  const { token } = yield* Effect.tryPromise({
63
- try: () => space.db.query(Filter.typename('dxos.org/type/AccessToken', { source: 'discord.com' })).first(),
63
+ try: () => space.db.query(Filter.typename('org.dxos.type.accessToken', { source: 'discord.com' })).first(),
64
64
  catch: (e: any) => e,
65
65
  });
66
66
  const { objects } = yield* Effect.tryPromise({
@@ -9,29 +9,40 @@ import * as Effect from 'effect/Effect';
9
9
  import * as Schedule from 'effect/Schedule';
10
10
  import * as Schema from 'effect/Schema';
11
11
 
12
- import { defineFunction } from '@dxos/functions';
12
+ import { Operation } from '@dxos/compute';
13
13
 
14
- export default defineFunction({
15
- key: 'dxos.org/script/forex-effect',
16
- name: 'Forex Effect',
17
- description: 'Returns the exchange rate between two currencies.',
18
-
19
- inputSchema: Schema.Struct({
14
+ const ForexEffect = Operation.make({
15
+ meta: {
16
+ key: 'org.dxos.script.forex-effect',
17
+ name: 'Forex Effect',
18
+ description: 'Returns the exchange rate between two currencies.',
19
+ },
20
+ input: Schema.Struct({
20
21
  from: Schema.String.annotations({ description: 'The source currency' }),
21
22
  to: Schema.String.annotations({ description: 'The target currency' }),
22
23
  }),
24
+ output: Schema.Any,
25
+ });
23
26
 
24
- outputSchema: Schema.String.annotations({ description: 'The exchange rate between the two currencies' }),
27
+ export default ForexEffect.pipe(
28
+ Operation.withHandler(
29
+ Effect.fnUntraced(function* ({ from: rawFrom, to: rawTo }) {
30
+ const from = rawFrom.toUpperCase();
31
+ const to = rawTo.toUpperCase();
32
+ const json: any = yield* HttpClientRequest.get(`https://free.ratesdb.com/v1/rates?from=${from}&to=${to}`).pipe(
33
+ HttpClient.execute,
34
+ Effect.flatMap((response) => response.json),
35
+ Effect.timeout('5 seconds'),
36
+ Effect.retry(Schedule.exponential(1_000).pipe(Schedule.compose(Schedule.recurs(3)))),
37
+ Effect.scoped,
38
+ );
25
39
 
26
- handler: Effect.fnUntraced(function* ({ data: { from, to } }) {
27
- const res = yield* HttpClientRequest.get(`https://free.ratesdb.com/v1/rates?from=${from}&to=${to}`).pipe(
28
- HttpClient.execute,
29
- Effect.flatMap((res: any) => res.json),
30
- Effect.timeout('1 second'),
31
- Effect.retry(Schedule.exponential(1_000).pipe(Schedule.compose(Schedule.recurs(3)))),
32
- Effect.scoped,
33
- );
40
+ const rate = json?.data?.rates?.[to];
41
+ if (rate == null) {
42
+ return yield* Effect.fail(new Error(`No rate found for ${from} -> ${to}`));
43
+ }
34
44
 
35
- return (res as any).data.rates[to].toString();
36
- }, Effect.provide(FetchHttpClient.layer)),
37
- });
45
+ return rate.toString();
46
+ }, Effect.provide(FetchHttpClient.layer)),
47
+ ),
48
+ );
@@ -2,26 +2,35 @@
2
2
  // Copyright 2025 DXOS.org
3
3
  //
4
4
 
5
+ import * as Effect from 'effect/Effect';
5
6
  import * as Schema from 'effect/Schema';
6
7
 
7
- import { defineFunction } from '@dxos/functions';
8
+ import { Operation } from '@dxos/compute';
8
9
 
9
- export default defineFunction({
10
- key: 'dxos.org/script/forex',
11
- name: 'Forex',
12
- description: 'Returns the exchange rate between two currencies.',
13
-
14
- inputSchema: Schema.Struct({
10
+ const Forex = Operation.make({
11
+ meta: {
12
+ key: 'org.dxos.script.forex',
13
+ name: 'Forex',
14
+ description: 'Returns the exchange rate between two currencies.',
15
+ },
16
+ input: Schema.Struct({
15
17
  from: Schema.String.annotations({ description: 'The source currency' }),
16
18
  to: Schema.String.annotations({ description: 'The target currency' }),
17
19
  }),
20
+ output: Schema.Any,
21
+ });
18
22
 
19
- handler: async ({ data: { from, to } }) => {
20
- const res = await fetch(`https://free.ratesdb.com/v1/rates?from=${from}&to=${to}`);
21
- const {
22
- data: { rates },
23
- } = await res.json();
23
+ export default Forex.pipe(
24
+ Operation.withHandler(
25
+ Effect.fn(function* ({ from: rawFrom, to: rawTo }) {
26
+ const from = rawFrom.toUpperCase();
27
+ const to = rawTo.toUpperCase();
28
+ const res = yield* Effect.promise(() => fetch(`https://free.ratesdb.com/v1/rates?from=${from}&to=${to}`));
29
+ const {
30
+ data: { rates },
31
+ } = yield* Effect.promise(() => res.json());
24
32
 
25
- return rates[to].toString();
26
- },
27
- });
33
+ return rates[to].toString();
34
+ }),
35
+ ),
36
+ );
@@ -27,7 +27,7 @@ import * as Schedule from 'https://esm.sh/effect@3.17.0/Schedule?bundle=false';
27
27
  import * as Stream from 'https://esm.sh/effect@3.17.0/Stream?bundle=false';
28
28
 
29
29
  export default defineFunction({
30
- key: 'dxos.org/script/gmail',
30
+ key: 'org.dxos.script.gmail',
31
31
  name: 'Gmail',
32
32
  inputSchema: S.Struct({
33
33
  mailboxId: S.String,
@@ -47,7 +47,7 @@ export default defineFunction({
47
47
  handler: ({ context: { space }, data: { mailboxId, userId, after, pageSize } }: any) =>
48
48
  Effect.gen(function* () {
49
49
  const { token } = yield* Effect.tryPromise({
50
- try: () => space.db.query(Filter.typename('dxos.org/type/AccessToken', { source: 'gmail.com' })).first(),
50
+ try: () => space.db.query(Filter.typename('org.dxos.type.accessToken', { source: 'gmail.com' })).first(),
51
51
  catch: (e: any) => e,
52
52
  });
53
53
 
@@ -216,8 +216,8 @@ const MessageType = S.Struct({
216
216
  ),
217
217
  }).pipe(
218
218
  EchoObject({
219
- typename: 'dxos.org/type/Message',
220
- version: '0.2.0',
219
+ typename: 'org.dxos.type.message',
220
+ version: '0.1.0',
221
221
  }),
222
222
  );
223
223
  type MessageType = S.Schema.Type<typeof MessageType>;
@@ -27,65 +27,65 @@ export type Template = {
27
27
 
28
28
  export const templates = [
29
29
  {
30
- id: 'dxos.org/script/ping',
30
+ id: 'org.dxos.script.ping',
31
31
  name: 'Ping',
32
32
  source: removeHeader(ping),
33
33
  },
34
34
  {
35
- id: 'dxos.org/script/forex',
35
+ id: 'org.dxos.script.forex',
36
36
  name: 'Forex',
37
37
  source: removeHeader(forex),
38
38
  },
39
39
  {
40
- id: 'dxos.org/script/forex-effect',
40
+ id: 'org.dxos.script.forex-effect',
41
41
  name: 'Forex (Effect)',
42
42
  source: removeHeader(forexEffect),
43
43
  },
44
44
  {
45
- id: 'dxos.org/script/gpt',
45
+ id: 'org.dxos.script.gpt',
46
46
  name: 'Gpt',
47
47
  source: removeHeader(chat),
48
- presetId: 'dxos.org/function/gpt',
48
+ presetId: 'org.dxos.function.gpt',
49
49
  },
50
50
  {
51
- id: 'dxos.org/script/chess-bot',
51
+ id: 'org.dxos.script.chess-bot',
52
52
  name: 'Chess Bot',
53
53
  source: removeHeader(chessBot),
54
- presetId: 'dxos.org/function/chess-bot',
54
+ presetId: 'org.dxos.function.chess-bot',
55
55
  },
56
56
  {
57
- id: 'dxos.org/script/email',
57
+ id: 'org.dxos.script.email',
58
58
  name: 'Email',
59
59
  source: removeHeader(email),
60
- presetId: 'dxos.org/function/email',
60
+ presetId: 'org.dxos.function.email',
61
61
  },
62
62
  {
63
- id: 'dxos.org/script/discord',
63
+ id: 'org.dxos.script.discord',
64
64
  name: 'Discord',
65
65
  source: removeHeader(discord),
66
- presetId: 'dxos.org/function/discord',
66
+ presetId: 'org.dxos.function.discord',
67
67
  },
68
68
  {
69
- id: 'dxos.org/script/gmail',
69
+ id: 'org.dxos.script.gmail',
70
70
  name: 'Gmail',
71
71
  source: removeHeader(gmail),
72
- presetId: 'dxos.org/function/gmail',
72
+ presetId: 'org.dxos.function.gmail',
73
73
  },
74
74
  {
75
- id: 'dxos.org/script/data-generator',
75
+ id: 'org.dxos.script.data-generator',
76
76
  name: 'Data Generator',
77
77
  source: removeHeader(dataGenerator),
78
- presetId: 'dxos.org/function/data-generator',
78
+ presetId: 'org.dxos.function.data-generator',
79
79
  },
80
80
  {
81
- id: 'dxos.org/script/anthropic',
81
+ id: 'org.dxos.script.anthropic',
82
82
  name: 'Anthropic',
83
83
  source: removeHeader(anthropic),
84
84
  },
85
85
  {
86
- id: 'dxos.org/script/commentary',
86
+ id: 'org.dxos.script.commentary',
87
87
  name: 'Commentary',
88
88
  source: removeHeader(commentary),
89
- presetId: 'dxos.org/function/chess/commentary',
89
+ presetId: 'org.dxos.function.chess.commentary',
90
90
  },
91
91
  ] as const;