@dxos/plugin-script 0.9.1-staging.ee54ba693a → 0.11.0

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 (295) hide show
  1. package/dist/lib/ScriptPlugin.mjs +25 -0
  2. package/dist/lib/ScriptPlugin.mjs.map +1 -0
  3. package/dist/lib/ScriptPlugin.node.mjs +11 -0
  4. package/dist/lib/ScriptPlugin.node.mjs.map +1 -0
  5. package/dist/lib/ScriptPlugin.workerd.mjs +11 -0
  6. package/dist/lib/ScriptPlugin.workerd.mjs.map +1 -0
  7. package/dist/lib/capabilities/node.mjs +11 -0
  8. package/dist/lib/capabilities/node.mjs.map +1 -0
  9. package/dist/lib/capabilities.mjs +13 -0
  10. package/dist/lib/capabilities.mjs.map +1 -0
  11. package/dist/lib/chunk-DeploymentDialog.mjs +85 -0
  12. package/dist/lib/chunk-DeploymentDialog.mjs.map +1 -0
  13. package/dist/lib/chunk-NotebookArticle.mjs +719 -0
  14. package/dist/lib/chunk-NotebookArticle.mjs.map +1 -0
  15. package/dist/lib/chunk-ScriptArticle.mjs +67 -0
  16. package/dist/lib/chunk-ScriptArticle.mjs.map +1 -0
  17. package/dist/lib/chunk-ScriptProperties.mjs +240 -0
  18. package/dist/lib/chunk-ScriptProperties.mjs.map +1 -0
  19. package/dist/lib/chunk-ScriptSettings.mjs +40 -0
  20. package/dist/lib/chunk-ScriptSettings.mjs.map +1 -0
  21. package/dist/lib/chunk-TestContainer.mjs +40 -0
  22. package/dist/lib/chunk-TestContainer.mjs.map +1 -0
  23. package/dist/lib/chunk-app-graph-builder.mjs +33 -0
  24. package/dist/lib/chunk-app-graph-builder.mjs.map +1 -0
  25. package/dist/lib/chunk-compiler.mjs +60 -0
  26. package/dist/lib/chunk-compiler.mjs.map +1 -0
  27. package/dist/lib/chunk-compiler2.mjs +76 -0
  28. package/dist/lib/chunk-compiler2.mjs.map +1 -0
  29. package/dist/lib/chunk-create-object.mjs +36 -0
  30. package/dist/lib/chunk-create-object.mjs.map +1 -0
  31. package/dist/lib/chunk-create-script.mjs +32 -0
  32. package/dist/lib/chunk-create-script.mjs.map +1 -0
  33. package/dist/lib/chunk-create.mjs +34 -0
  34. package/dist/lib/chunk-create.mjs.map +1 -0
  35. package/dist/lib/chunk-delete.mjs +15 -0
  36. package/dist/lib/chunk-delete.mjs.map +1 -0
  37. package/dist/lib/chunk-deploy.mjs +53 -0
  38. package/dist/lib/chunk-deploy.mjs.map +1 -0
  39. package/dist/lib/chunk-functions.mjs +238 -0
  40. package/dist/lib/chunk-functions.mjs.map +1 -0
  41. package/dist/lib/chunk-inspect-invocations.mjs +42 -0
  42. package/dist/lib/chunk-inspect-invocations.mjs.map +1 -0
  43. package/dist/lib/chunk-install-function.mjs +40 -0
  44. package/dist/lib/chunk-install-function.mjs.map +1 -0
  45. package/dist/lib/chunk-invoke.mjs +25 -0
  46. package/dist/lib/chunk-invoke.mjs.map +1 -0
  47. package/dist/lib/chunk-meta.mjs +33 -0
  48. package/dist/lib/chunk-meta.mjs.map +1 -0
  49. package/dist/lib/chunk-operation-handler.mjs +13 -0
  50. package/dist/lib/chunk-operation-handler.mjs.map +1 -0
  51. package/dist/lib/chunk-query-deployed-functions.mjs +31 -0
  52. package/dist/lib/chunk-query-deployed-functions.mjs.map +1 -0
  53. package/dist/lib/chunk-react-surface.mjs +140 -0
  54. package/dist/lib/chunk-react-surface.mjs.map +1 -0
  55. package/dist/lib/chunk-read.mjs +20 -0
  56. package/dist/lib/chunk-read.mjs.map +1 -0
  57. package/dist/lib/chunk-settings.mjs +23 -0
  58. package/dist/lib/chunk-settings.mjs.map +1 -0
  59. package/dist/lib/chunk-skill-definition.mjs +10 -0
  60. package/dist/lib/chunk-skill-definition.mjs.map +1 -0
  61. package/dist/lib/chunk-skills.mjs +35 -0
  62. package/dist/lib/chunk-skills.mjs.map +1 -0
  63. package/dist/lib/{neutral/chunk-WAGQ77UQ.mjs → chunk-templates.mjs} +82 -84
  64. package/dist/lib/chunk-templates.mjs.map +1 -0
  65. package/dist/lib/chunk-types.mjs +90 -0
  66. package/dist/lib/chunk-types.mjs.map +1 -0
  67. package/dist/lib/chunk-update.mjs +27 -0
  68. package/dist/lib/chunk-update.mjs.map +1 -0
  69. package/dist/lib/chunk-util.mjs +146 -0
  70. package/dist/lib/chunk-util.mjs.map +1 -0
  71. package/dist/lib/components.mjs +618 -0
  72. package/dist/lib/components.mjs.map +1 -0
  73. package/dist/lib/containers.mjs +12 -0
  74. package/dist/lib/containers.mjs.map +1 -0
  75. package/dist/lib/hooks.mjs +307 -0
  76. package/dist/lib/hooks.mjs.map +1 -0
  77. package/dist/lib/index.mjs +5 -0
  78. package/dist/lib/meta.mjs +2 -0
  79. package/dist/lib/operations.mjs +7 -0
  80. package/dist/lib/operations.mjs.map +1 -0
  81. package/dist/lib/plugin.mjs +9 -0
  82. package/dist/lib/plugin.mjs.map +1 -0
  83. package/dist/lib/skills.mjs +2 -0
  84. package/dist/lib/templates.mjs +2 -0
  85. package/dist/lib/testing.mjs +75 -0
  86. package/dist/lib/testing.mjs.map +1 -0
  87. package/dist/lib/translations.mjs +98 -0
  88. package/dist/lib/translations.mjs.map +1 -0
  89. package/dist/lib/types.mjs +2 -0
  90. package/dist/types/src/capabilities/ScriptSurfaces.d.ts +28 -0
  91. package/dist/types/src/capabilities/ScriptSurfaces.d.ts.map +1 -0
  92. package/dist/types/src/capabilities/app-graph-builder.d.ts +1 -1
  93. package/dist/types/src/capabilities/compiler.d.ts +1 -1
  94. package/dist/types/src/capabilities/create-object.d.ts +1 -1
  95. package/dist/types/src/capabilities/operation-handler.d.ts +1 -1
  96. package/dist/types/src/capabilities/react-surface.d.ts +1 -1
  97. package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
  98. package/dist/types/src/capabilities/settings.d.ts +1 -1
  99. package/dist/types/src/components/NotebookStack/NotebookStack.d.ts +1 -1
  100. package/dist/types/src/components/NotebookStack/NotebookStack.d.ts.map +1 -1
  101. package/dist/types/src/components/NotebookStack/NotebookStack.stories.d.ts.map +1 -1
  102. package/dist/types/src/components/QueryEditor/QueryEditor.d.ts.map +1 -1
  103. package/dist/types/src/components/ScriptToolbar/ScriptToolbar.d.ts +1 -1
  104. package/dist/types/src/components/ScriptToolbar/ScriptToolbar.d.ts.map +1 -1
  105. package/dist/types/src/components/TestPanel/TestPanel.d.ts +1 -1
  106. package/dist/types/src/components/TestPanel/TestPanel.d.ts.map +1 -1
  107. package/dist/types/src/components/TypescriptEditor/TypescriptEditor.d.ts +1 -1
  108. package/dist/types/src/components/TypescriptEditor/TypescriptEditor.d.ts.map +1 -1
  109. package/dist/types/src/components/TypescriptEditor/TypescriptEditor.stories.d.ts +1 -1
  110. package/dist/types/src/containers/DeploymentDialog/DeploymentDialog.d.ts +5 -2
  111. package/dist/types/src/containers/DeploymentDialog/DeploymentDialog.d.ts.map +1 -1
  112. package/dist/types/src/containers/NotebookArticle/NotebookArticle.d.ts +4 -1
  113. package/dist/types/src/containers/NotebookArticle/NotebookArticle.d.ts.map +1 -1
  114. package/dist/types/src/containers/ScriptArticle/ScriptArticle.d.ts +4 -1
  115. package/dist/types/src/containers/ScriptArticle/ScriptArticle.d.ts.map +1 -1
  116. package/dist/types/src/containers/ScriptArticle/ScriptArticle.stories.d.ts.map +1 -1
  117. package/dist/types/src/containers/ScriptProperties/FunctionBinding.d.ts +4 -1
  118. package/dist/types/src/containers/ScriptProperties/FunctionBinding.d.ts.map +1 -1
  119. package/dist/types/src/containers/ScriptProperties/FunctionPublishing.d.ts +4 -1
  120. package/dist/types/src/containers/ScriptProperties/FunctionPublishing.d.ts.map +1 -1
  121. package/dist/types/src/containers/ScriptProperties/ScriptProperties.d.ts +4 -1
  122. package/dist/types/src/containers/ScriptProperties/ScriptProperties.d.ts.map +1 -1
  123. package/dist/types/src/containers/ScriptProperties/ScriptProperties.stories.d.ts.map +1 -1
  124. package/dist/types/src/containers/ScriptProperties/SkillEditor.d.ts +4 -1
  125. package/dist/types/src/containers/ScriptProperties/SkillEditor.d.ts.map +1 -1
  126. package/dist/types/src/containers/ScriptSettings/ScriptSettings.d.ts +4 -1
  127. package/dist/types/src/containers/ScriptSettings/ScriptSettings.d.ts.map +1 -1
  128. package/dist/types/src/containers/ScriptSettings/ScriptSettings.stories.d.ts +4 -1
  129. package/dist/types/src/containers/ScriptSettings/ScriptSettings.stories.d.ts.map +1 -1
  130. package/dist/types/src/containers/TestContainer/TestContainer.d.ts +4 -1
  131. package/dist/types/src/containers/TestContainer/TestContainer.d.ts.map +1 -1
  132. package/dist/types/src/hooks/deploy.d.ts +2 -35
  133. package/dist/types/src/hooks/deploy.d.ts.map +1 -1
  134. package/dist/types/src/hooks/format.d.ts +2 -23
  135. package/dist/types/src/hooks/format.d.ts.map +1 -1
  136. package/dist/types/src/hooks/template.d.ts +2 -18
  137. package/dist/types/src/hooks/template.d.ts.map +1 -1
  138. package/dist/types/src/hooks/useToolbarState.d.ts +1 -1
  139. package/dist/types/src/hooks/useToolbarState.d.ts.map +1 -1
  140. package/dist/types/src/notebook/compute-graph.d.ts +1 -1
  141. package/dist/types/src/notebook/compute-graph.d.ts.map +1 -1
  142. package/dist/types/src/skills/functions/deploy.d.ts.map +1 -1
  143. package/dist/types/src/skills/functions/inspect-invocations.d.ts.map +1 -1
  144. package/dist/types/src/templates/chess-bot.d.ts +2 -2
  145. package/dist/types/src/templates/chess-bot.d.ts.map +1 -1
  146. package/dist/types/src/templates/commentary.d.ts +2 -2
  147. package/dist/types/src/templates/commentary.d.ts.map +1 -1
  148. package/dist/types/src/types/ScriptCapabilities.d.ts +1 -1
  149. package/dist/types/src/types/ScriptCapabilities.d.ts.map +1 -1
  150. package/dist/types/tsconfig.tsbuildinfo +1 -1
  151. package/package.json +88 -82
  152. package/src/capabilities/ScriptSurfaces.tsx +96 -0
  153. package/src/capabilities/app-graph-builder.ts +2 -2
  154. package/src/capabilities/compiler.ts +1 -1
  155. package/src/capabilities/react-surface.ts +82 -0
  156. package/src/components/NotebookStack/NotebookCell.tsx +9 -2
  157. package/src/components/NotebookStack/NotebookStack.stories.tsx +2 -0
  158. package/src/components/NotebookStack/NotebookStack.tsx +22 -14
  159. package/src/components/QueryEditor/QueryEditor.stories.tsx +1 -1
  160. package/src/components/QueryEditor/QueryEditor.tsx +1 -0
  161. package/src/components/ScriptToolbar/ScriptToolbar.stories.tsx +1 -1
  162. package/src/components/ScriptToolbar/ScriptToolbar.tsx +1 -1
  163. package/src/components/TestPanel/TestPanel.tsx +2 -2
  164. package/src/components/TypescriptEditor/TypescriptEditor.tsx +1 -1
  165. package/src/containers/DeploymentDialog/DeploymentDialog.stories.tsx +1 -1
  166. package/src/containers/DeploymentDialog/DeploymentDialog.tsx +3 -1
  167. package/src/containers/NotebookArticle/NotebookArticle.stories.tsx +1 -1
  168. package/src/containers/NotebookArticle/NotebookArticle.tsx +4 -2
  169. package/src/containers/ScriptArticle/ScriptArticle.stories.tsx +2 -1
  170. package/src/containers/ScriptArticle/ScriptArticle.tsx +3 -1
  171. package/src/containers/ScriptProperties/FunctionBinding.tsx +5 -3
  172. package/src/containers/ScriptProperties/FunctionPublishing.tsx +4 -2
  173. package/src/containers/ScriptProperties/ScriptProperties.stories.tsx +2 -1
  174. package/src/containers/ScriptProperties/ScriptProperties.tsx +2 -0
  175. package/src/containers/ScriptProperties/SkillEditor.tsx +3 -1
  176. package/src/containers/ScriptSettings/ScriptSettings.tsx +2 -0
  177. package/src/containers/TestContainer/TestContainer.tsx +4 -2
  178. package/src/e2e/ai.test.ts +2 -2
  179. package/src/e2e/deploy.test.ts +2 -2
  180. package/src/hooks/deploy.ts +13 -4
  181. package/src/hooks/format.ts +2 -2
  182. package/src/hooks/template.ts +3 -3
  183. package/src/hooks/useToolbarState.ts +1 -1
  184. package/src/notebook/compute-graph.test.ts +1 -1
  185. package/src/notebook/compute-graph.ts +1 -1
  186. package/src/skills/functions/deploy.ts +5 -6
  187. package/src/skills/functions/inspect-invocations.ts +2 -2
  188. package/src/skills/functions/install-function.ts +1 -1
  189. package/src/skills/functions/invoke.ts +1 -1
  190. package/src/skills/functions/query-deployed-functions.ts +1 -1
  191. package/src/templates/chess-bot.ts +3 -3
  192. package/src/templates/commentary.ts +3 -3
  193. package/src/testing/simulator.test.ts +1 -1
  194. package/src/types/ScriptCapabilities.ts +1 -1
  195. package/src/util/deploy.ts +3 -3
  196. package/src/util/functions.ts +2 -2
  197. package/dist/lib/neutral/DeploymentDialog-7OIIL7LB.mjs +0 -114
  198. package/dist/lib/neutral/DeploymentDialog-7OIIL7LB.mjs.map +0 -7
  199. package/dist/lib/neutral/NotebookArticle-AOBB3XGD.mjs +0 -745
  200. package/dist/lib/neutral/NotebookArticle-AOBB3XGD.mjs.map +0 -7
  201. package/dist/lib/neutral/ScriptArticle-I3DOJARR.mjs +0 -79
  202. package/dist/lib/neutral/ScriptArticle-I3DOJARR.mjs.map +0 -7
  203. package/dist/lib/neutral/ScriptPlugin.mjs +0 -51
  204. package/dist/lib/neutral/ScriptPlugin.mjs.map +0 -7
  205. package/dist/lib/neutral/ScriptPlugin.node.mjs +0 -27
  206. package/dist/lib/neutral/ScriptPlugin.node.mjs.map +0 -7
  207. package/dist/lib/neutral/ScriptPlugin.workerd.mjs +0 -21
  208. package/dist/lib/neutral/ScriptPlugin.workerd.mjs.map +0 -7
  209. package/dist/lib/neutral/ScriptProperties-RHDQGMGT.mjs +0 -296
  210. package/dist/lib/neutral/ScriptProperties-RHDQGMGT.mjs.map +0 -7
  211. package/dist/lib/neutral/ScriptSettings-NS3ZY7ZR.mjs +0 -35
  212. package/dist/lib/neutral/ScriptSettings-NS3ZY7ZR.mjs.map +0 -7
  213. package/dist/lib/neutral/TestContainer-AFVTBYSJ.mjs +0 -44
  214. package/dist/lib/neutral/TestContainer-AFVTBYSJ.mjs.map +0 -7
  215. package/dist/lib/neutral/app-graph-builder-POP3CX6G.mjs +0 -52
  216. package/dist/lib/neutral/app-graph-builder-POP3CX6G.mjs.map +0 -7
  217. package/dist/lib/neutral/capabilities/index.mjs +0 -21
  218. package/dist/lib/neutral/capabilities/index.mjs.map +0 -7
  219. package/dist/lib/neutral/capabilities/node.mjs +0 -17
  220. package/dist/lib/neutral/capabilities/node.mjs.map +0 -7
  221. package/dist/lib/neutral/chunk-2REUEDUA.mjs +0 -56
  222. package/dist/lib/neutral/chunk-2REUEDUA.mjs.map +0 -7
  223. package/dist/lib/neutral/chunk-652CIABA.mjs +0 -124
  224. package/dist/lib/neutral/chunk-652CIABA.mjs.map +0 -7
  225. package/dist/lib/neutral/chunk-6DOWVKIW.mjs +0 -344
  226. package/dist/lib/neutral/chunk-6DOWVKIW.mjs.map +0 -7
  227. package/dist/lib/neutral/chunk-CHNFYLKW.mjs +0 -52
  228. package/dist/lib/neutral/chunk-CHNFYLKW.mjs.map +0 -7
  229. package/dist/lib/neutral/chunk-INFWOSTM.mjs +0 -156
  230. package/dist/lib/neutral/chunk-INFWOSTM.mjs.map +0 -7
  231. package/dist/lib/neutral/chunk-J5LGTIGS.mjs +0 -10
  232. package/dist/lib/neutral/chunk-J5LGTIGS.mjs.map +0 -7
  233. package/dist/lib/neutral/chunk-KSVKXCTX.mjs +0 -8
  234. package/dist/lib/neutral/chunk-KSVKXCTX.mjs.map +0 -7
  235. package/dist/lib/neutral/chunk-NVV5UYY4.mjs +0 -50
  236. package/dist/lib/neutral/chunk-NVV5UYY4.mjs.map +0 -7
  237. package/dist/lib/neutral/chunk-USJ44FIU.mjs +0 -8
  238. package/dist/lib/neutral/chunk-USJ44FIU.mjs.map +0 -7
  239. package/dist/lib/neutral/chunk-WAGQ77UQ.mjs.map +0 -7
  240. package/dist/lib/neutral/compiler-ODK4UA2N.mjs +0 -101
  241. package/dist/lib/neutral/compiler-ODK4UA2N.mjs.map +0 -7
  242. package/dist/lib/neutral/components/index.mjs +0 -695
  243. package/dist/lib/neutral/components/index.mjs.map +0 -7
  244. package/dist/lib/neutral/containers/index.mjs +0 -19
  245. package/dist/lib/neutral/containers/index.mjs.map +0 -7
  246. package/dist/lib/neutral/create-SGHWWTET.mjs +0 -46
  247. package/dist/lib/neutral/create-SGHWWTET.mjs.map +0 -7
  248. package/dist/lib/neutral/create-object-QW66KQWS.mjs +0 -43
  249. package/dist/lib/neutral/create-object-QW66KQWS.mjs.map +0 -7
  250. package/dist/lib/neutral/create-script-CIEJOBIU.mjs +0 -45
  251. package/dist/lib/neutral/create-script-CIEJOBIU.mjs.map +0 -7
  252. package/dist/lib/neutral/delete-72RXVLVI.mjs +0 -21
  253. package/dist/lib/neutral/delete-72RXVLVI.mjs.map +0 -7
  254. package/dist/lib/neutral/deploy-PJTJAQZY.mjs +0 -67
  255. package/dist/lib/neutral/deploy-PJTJAQZY.mjs.map +0 -7
  256. package/dist/lib/neutral/hooks/index.mjs +0 -369
  257. package/dist/lib/neutral/hooks/index.mjs.map +0 -7
  258. package/dist/lib/neutral/index.mjs +0 -41
  259. package/dist/lib/neutral/index.mjs.map +0 -7
  260. package/dist/lib/neutral/inspect-invocations-ZUXVUAML.mjs +0 -59
  261. package/dist/lib/neutral/inspect-invocations-ZUXVUAML.mjs.map +0 -7
  262. package/dist/lib/neutral/install-function-YFDZLVMJ.mjs +0 -49
  263. package/dist/lib/neutral/install-function-YFDZLVMJ.mjs.map +0 -7
  264. package/dist/lib/neutral/invoke-CDRBQ2WA.mjs +0 -32
  265. package/dist/lib/neutral/invoke-CDRBQ2WA.mjs.map +0 -7
  266. package/dist/lib/neutral/meta.json +0 -1
  267. package/dist/lib/neutral/meta.mjs +0 -10
  268. package/dist/lib/neutral/meta.mjs.map +0 -7
  269. package/dist/lib/neutral/operation-handler-M3B6IRMV.mjs +0 -18
  270. package/dist/lib/neutral/operation-handler-M3B6IRMV.mjs.map +0 -7
  271. package/dist/lib/neutral/operations/index.mjs +0 -8
  272. package/dist/lib/neutral/operations/index.mjs.map +0 -7
  273. package/dist/lib/neutral/plugin.mjs +0 -16
  274. package/dist/lib/neutral/plugin.mjs.map +0 -7
  275. package/dist/lib/neutral/query-deployed-functions-RBQMGON2.mjs +0 -34
  276. package/dist/lib/neutral/query-deployed-functions-RBQMGON2.mjs.map +0 -7
  277. package/dist/lib/neutral/react-surface-GEXOZLBC.mjs +0 -120
  278. package/dist/lib/neutral/react-surface-GEXOZLBC.mjs.map +0 -7
  279. package/dist/lib/neutral/read-OY3K5R3V.mjs +0 -26
  280. package/dist/lib/neutral/read-OY3K5R3V.mjs.map +0 -7
  281. package/dist/lib/neutral/settings-FD7HXEY6.mjs +0 -30
  282. package/dist/lib/neutral/settings-FD7HXEY6.mjs.map +0 -7
  283. package/dist/lib/neutral/skill-definition-JZ7UYBT7.mjs +0 -15
  284. package/dist/lib/neutral/skill-definition-JZ7UYBT7.mjs.map +0 -7
  285. package/dist/lib/neutral/skills/index.mjs +0 -10
  286. package/dist/lib/neutral/skills/index.mjs.map +0 -7
  287. package/dist/lib/neutral/templates/index.mjs +0 -10
  288. package/dist/lib/neutral/templates/index.mjs.map +0 -7
  289. package/dist/lib/neutral/translations.mjs +0 -104
  290. package/dist/lib/neutral/translations.mjs.map +0 -7
  291. package/dist/lib/neutral/types/index.mjs +0 -17
  292. package/dist/lib/neutral/types/index.mjs.map +0 -7
  293. package/dist/lib/neutral/update-Z5VGOLBN.mjs +0 -44
  294. package/dist/lib/neutral/update-Z5VGOLBN.mjs.map +0 -7
  295. package/src/capabilities/react-surface.tsx +0 -132
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chunk-functions.mjs","names":[],"sources":["../../src/skills/functions/definitions.ts","../../src/skills/functions/index.ts"],"sourcesContent":["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Schema from 'effect/Schema';\n\nimport { ClientService } from '@dxos/client';\nimport { Operation } from '@dxos/compute';\nimport { Database, DXN, Ref } from '@dxos/echo';\nimport { trim } from '@dxos/util';\n\nconst FunctionRef = Ref.Ref(Operation.PersistentOperation).annotations({\n description: 'The ID of the function.',\n});\n\nconst FunctionId = Schema.String.annotations({\n description: 'The ID of the function. Can be passed as the function parameter to other operations.',\n});\n\nconst FUNCTION_FORMAT = trim`\n IMPORTANT: Every function MUST follow this exact pattern — define an Operation, then export default the handler:\n\n \\`\\`\\`typescript\n import * as Effect from 'effect/Effect';\n import * as Schema from 'effect/Schema';\n\n import { Operation } from '@dxos/compute';\n\n const MyFunction = Operation.make({\n meta: {\n key: DXN.make('org.dxos.script.myFunction'),\n name: 'My Function',\n },\n input: Schema.Struct({\n city: Schema.String.annotations({ description: 'City name' }),\n }),\n output: Schema.Any,\n });\n\n export default MyFunction.pipe(\n Operation.withHandler(\n Effect.fn(function* ({ city }) {\n const res = yield* Effect.promise(() =>\n fetch(\\`https://wttr.in/\\${city}?format=j1\\`)\n );\n const data = yield* Effect.promise(() => res.json());\n return data;\n }),\n ),\n );\n \\`\\`\\`\n\n Key rules:\n - The file MUST have a single \\`export default\\` of Operation.pipe(Operation.withHandler(...)).\n - Use \\`Effect.fn(function* (...) { ... })\\` for the handler body.\n - Wrap async calls with \\`yield* Effect.promise(() => ...)\\`.\n - Do NOT use top-level await; do NOT export named functions; do NOT use module.exports.\n`;\n\nconst AVAILABLE_PACKAGES = trim`\n Scripts run in an Edge runtime (Cloudflare Workers) with the following pre-bundled packages:\n\n DXOS SDK:\n - \\`@dxos/echo\\` — Reactive local-first database: query, filter, and mutate ECHO objects in spaces.\n - \\`@dxos/functions\\` — Edge function framework: triggers, queues, and function definitions.\n - \\`@dxos/ai\\` — AI/LLM integration via AiService (access models like Claude, GPT).\n - \\`@dxos/schema\\` — Schema utilities and built-in DXOS types.\n - \\`@dxos/types\\` — DXOS type definitions.\n - \\`@dxos/operation\\` — Define and handle typed operations with input/output schemas.\n - \\`@dxos/util\\` — General utility functions.\n - \\`@dxos/log\\` — Structured logging.\n\n Effect-TS (functional programming toolkit):\n - \\`effect\\` — Core effect system with sub-modules: Effect, Schema, Stream, Schedule, Array, Record, Option, Either, Match, etc.\n - \\`@effect/platform\\` — HTTP client (\\`HttpClient\\`), platform abstractions for making typed API requests.\n\n Data format parsing & querying:\n - \\`jsonata\\` — Powerful query and transformation expressions for JSON data (filter, sort, group, aggregate, reshape).\n - \\`yaml\\` — Parse and stringify YAML documents.\n - \\`fast-xml-parser\\` — Fast XML parser and builder; convert between XML and JSON.\n - \\`papaparse\\` — CSV parsing and serialization; stream large files, auto-detect delimiters.\n\n Text & markup processing:\n - \\`turndown\\` — HTML to Markdown converter (useful for feeding web content to LLMs).\n\n HTML/DOM parsing:\n - \\`linkedom\\` — Lightweight DOM parser for worker environments; parse and query HTML documents.\n\n Data processing & utilities:\n - \\`date-fns\\` — Comprehensive date utility library: parsing, formatting, comparison, arithmetic, time zones.\n\n Other:\n - \\`@automerge/automerge\\` — CRDT library for conflict-free collaborative data structures.\n - \\`chess.js\\` — Chess game logic, move generation, and validation.\n`;\n\nexport const Create = Operation.make({\n meta: {\n key: DXN.make('org.dxos.function.script.create'),\n name: 'Create',\n description: `Creates a new function with TypeScript source code and adds it to the space. ${FUNCTION_FORMAT} ${AVAILABLE_PACKAGES}`,\n icon: 'ph--code--regular',\n },\n input: Schema.Struct({\n name: Schema.String.annotations({\n description: 'Name of the function.',\n }),\n source: Schema.optional(Schema.String).annotations({\n description: 'TypeScript source code for the function.',\n }),\n templateId: Schema.optional(Schema.String).annotations({\n description: 'ID of a template to use as the initial source.',\n }),\n }),\n output: Schema.Struct({\n function: FunctionId,\n }),\n services: [Database.Service],\n});\n\nexport const Read = Operation.make({\n meta: {\n key: DXN.make('org.dxos.function.script.read'),\n name: 'Read',\n description: 'Reads the source code and metadata of a function.',\n icon: 'ph--file-text--regular',\n },\n input: Schema.Struct({\n function: FunctionRef,\n }),\n output: Schema.Struct({\n name: Schema.optional(Schema.String),\n source: Schema.String,\n description: Schema.optional(Schema.String),\n }),\n services: [Database.Service],\n});\n\n// The edit descriptions feed the script skill's LLM tool definition (and its memoized\n// fixtures), so the schema stays local and context-tuned; the apply logic is shared via `Doc.applyEdits`.\nconst Edit = Schema.Struct({\n oldString: Schema.String.annotations({\n description: 'The text to find in the source.',\n }),\n newString: Schema.String.annotations({\n description: 'The text to replace it with.',\n }),\n replaceAll: Schema.optional(Schema.Boolean).annotations({\n description: 'If true, replaces all occurrences. Defaults to false (first occurrence only).',\n }),\n});\n\nexport const Update = Operation.make({\n meta: {\n key: DXN.make('org.dxos.function.script.update'),\n name: 'Update',\n description: `Updates the source code or metadata of a function. ${FUNCTION_FORMAT}`,\n icon: 'ph--pencil--regular',\n },\n input: Schema.Struct({\n function: FunctionRef,\n name: Schema.optional(Schema.String).annotations({\n description: 'New name for the function.',\n }),\n description: Schema.optional(Schema.String).annotations({\n description: 'New description for the function.',\n }),\n edits: Schema.optional(Schema.Array(Edit)).annotations({\n description: 'Edits to apply to the source. Each edit finds oldString and replaces it with newString.',\n }),\n }),\n output: Schema.Struct({\n function: FunctionId,\n }),\n services: [Database.Service],\n});\n\nexport const Delete = Operation.make({\n meta: {\n key: DXN.make('org.dxos.function.script.delete'),\n name: 'Delete',\n description: 'Deletes a function and its source from the space.',\n icon: 'ph--trash--regular',\n },\n input: Schema.Struct({\n function: FunctionRef,\n }),\n output: Schema.Void,\n services: [Database.Service],\n});\n\nexport const Deploy = Operation.make({\n meta: {\n key: DXN.make('org.dxos.function.script.deploy'),\n name: 'Deploy',\n description: `Deploys a function to the Edge runtime. The function source must follow the required format: a single export default of Operation.pipe(Operation.withHandler(Effect.fn(function* (...) { ... }))). See the Create operation description for a full example.`,\n icon: 'ph--rocket-launch--regular',\n },\n input: Schema.Struct({\n function: FunctionRef,\n }),\n output: Schema.Struct({\n function: FunctionId,\n functionUrl: Schema.optional(Schema.String).annotations({\n description: 'The URL of the deployed function.',\n }),\n }),\n services: [Database.Service, ClientService],\n});\n\nexport const Invoke = Operation.make({\n meta: {\n key: DXN.make('org.dxos.function.script.invoke'),\n name: 'Invoke',\n description: 'Invokes a deployed Edge function with the given payload.',\n icon: 'ph--play--regular',\n },\n input: Schema.Struct({\n function: FunctionRef,\n payload: Schema.optional(Schema.Unknown).annotations({\n description: 'The input payload to pass to the function.',\n }),\n }),\n output: Schema.Struct({\n response: Schema.Unknown.annotations({\n description: 'The response from the function.',\n }),\n }),\n services: [Database.Service, ClientService],\n});\n\nconst InvocationSpanSchema = Schema.Struct({\n id: Schema.String.annotations({\n description: 'The invocation ID.',\n }),\n timestamp: Schema.Number.annotations({\n description: 'Start time of the invocation (epoch ms).',\n }),\n duration: Schema.Number.annotations({\n description: 'Duration in milliseconds.',\n }),\n outcome: Schema.String.annotations({\n description: 'Invocation outcome: success, failure, or pending.',\n }),\n input: Schema.Object.annotations({\n description: 'The input payload passed to the function.',\n }),\n error: Schema.optional(Schema.Object).annotations({\n description: 'Error details if the invocation failed.',\n }),\n});\n\nexport const InspectInvocations = Operation.make({\n meta: {\n key: DXN.make('org.dxos.function.script.inspectInvocations'),\n name: 'InspectInvocations',\n description: 'Queries the invocation trace feed for a function, returning its invocation history.',\n icon: 'ph--magnifying-glass--regular',\n },\n input: Schema.Struct({\n function: FunctionRef,\n limit: Schema.optional(Schema.Number).annotations({\n description: 'Maximum number of invocations to return. Defaults to 20.',\n }),\n }),\n output: Schema.Struct({\n invocations: Schema.Array(InvocationSpanSchema).annotations({\n description: 'List of invocation spans, most recent first.',\n }),\n total: Schema.Number.annotations({\n description: 'Total number of invocations found.',\n }),\n }),\n services: [Database.Service],\n});\n\nconst DeployedFunctionSchema = Schema.Struct({\n key: Schema.optional(Schema.String).annotations({\n description: 'Unique key identifying the function. Pass to InstallFunction to install it.',\n }),\n name: Schema.String.annotations({\n description: 'Display name of the function.',\n }),\n version: Schema.String.annotations({\n description: 'Semantic version of the deployed function.',\n }),\n description: Schema.optional(Schema.String).annotations({\n description: 'Description of what the function does.',\n }),\n updated: Schema.optional(Schema.String).annotations({\n description: 'ISO timestamp of the last deployment.',\n }),\n});\n\nexport const QueryDeployedFunctions = Operation.make({\n meta: {\n key: DXN.make('org.dxos.function.script.queryDeployed'),\n name: 'QueryDeployedFunctions',\n description: 'Lists all functions deployed to the EDGE runtime. Use InstallFunction to add one to the space.',\n icon: 'ph--list--regular',\n },\n input: Schema.Void,\n output: Schema.Struct({\n functions: Schema.Array(DeployedFunctionSchema).annotations({\n description: 'List of deployed functions.',\n }),\n }),\n services: [ClientService],\n});\n\nexport const InstallFunction = Operation.make({\n meta: {\n key: DXN.make('org.dxos.function.script.install'),\n name: 'InstallFunction',\n description:\n 'Installs a deployed EDGE function into the current space by key. The returned function ID can be passed directly to Invoke.',\n icon: 'ph--download--regular',\n },\n input: Schema.Struct({\n key: Schema.String.annotations({\n description: 'The unique key of the deployed function to install (from QueryDeployedFunctions).',\n }),\n }),\n output: Schema.Struct({\n function: FunctionId,\n name: Schema.String.annotations({\n description: 'Name of the installed function.',\n }),\n version: Schema.String.annotations({\n description: 'Version of the installed function.',\n }),\n }),\n services: [ClientService],\n});\n","//\n// Copyright 2025 DXOS.org\n//\n\nimport { OperationHandlerSet } from '@dxos/compute';\n\nexport * from './definitions';\n\nexport const ScriptHandlers = OperationHandlerSet.lazy(\n () => import('./create'),\n () => import('./read'),\n () => import('./update'),\n () => import('./delete'),\n () => import('./deploy'),\n () => import('./invoke'),\n () => import('./inspect-invocations'),\n () => import('./query-deployed-functions'),\n () => import('./install-function'),\n);\n"],"mappings":"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"}
@@ -0,0 +1,42 @@
1
+ import { a as InspectInvocations } from "./chunk-functions.mjs";
2
+ import { Operation } from "@dxos/compute";
3
+ import { Database, Feed, Filter, Obj, Query } from "@dxos/echo";
4
+ import { InvocationTraceEndEvent, InvocationTraceStartEvent, createInvocationSpans, getUserFunctionIdInMetadata } from "@dxos/compute-runtime";
5
+ import * as Effect from "effect/Effect";
6
+ import { SpaceProperties } from "@dxos/client-protocol";
7
+ //#region src/skills/functions/inspect-invocations.ts
8
+ var inspect_invocations_default = InspectInvocations.pipe(Operation.withHandler(Effect.fn(function* ({ function: fn, limit }) {
9
+ const loaded = yield* Database.load(fn);
10
+ const maxResults = limit ?? 20;
11
+ const [properties] = yield* Database.query(Query.type(SpaceProperties)).run;
12
+ if (!properties?.invocationTraceFeed) return {
13
+ invocations: [],
14
+ total: 0
15
+ };
16
+ const feed = yield* Database.load(properties.invocationTraceFeed);
17
+ const startEvents = yield* Feed.query(feed, Filter.type(InvocationTraceStartEvent)).run;
18
+ const endEvents = yield* Feed.query(feed, Filter.type(InvocationTraceEndEvent)).run;
19
+ const allSpans = createInvocationSpans([...startEvents, ...endEvents]);
20
+ const functionId = getUserFunctionIdInMetadata(Obj.getMeta(loaded));
21
+ const filtered = allSpans.filter((span) => {
22
+ if (!span.invocationTarget || !functionId) return false;
23
+ return span.invocationTarget.uri.split(":").pop() === functionId;
24
+ });
25
+ filtered.sort((a, b) => b.timestamp - a.timestamp);
26
+ const total = filtered.length;
27
+ return {
28
+ invocations: filtered.slice(0, maxResults).map((span) => ({
29
+ id: span.id,
30
+ timestamp: span.timestamp,
31
+ duration: span.duration,
32
+ outcome: `${span.outcome}`,
33
+ input: span.input !== null && typeof span.input === "object" ? span.input : { value: span.input },
34
+ error: span.error ? span.error : void 0
35
+ })),
36
+ total
37
+ };
38
+ })));
39
+ //#endregion
40
+ export { inspect_invocations_default as default };
41
+
42
+ //# sourceMappingURL=chunk-inspect-invocations.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chunk-inspect-invocations.mjs","names":[],"sources":["../../src/skills/functions/inspect-invocations.ts"],"sourcesContent":["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\n\nimport { SpaceProperties } from '@dxos/client-protocol';\nimport { Operation } from '@dxos/compute';\nimport { getUserFunctionIdInMetadata } from '@dxos/compute-runtime';\nimport { InvocationTraceEndEvent, InvocationTraceStartEvent, createInvocationSpans } from '@dxos/compute-runtime';\nimport { Database, Feed, Filter, Obj, Query } from '@dxos/echo';\n\nimport { InspectInvocations } from './definitions';\n\nexport default InspectInvocations.pipe(\n Operation.withHandler(\n Effect.fn(function* ({ function: fn, limit }) {\n const loaded = yield* Database.load(fn);\n const maxResults = limit ?? 20;\n\n const [properties] = yield* Database.query(Query.type(SpaceProperties)).run;\n if (!properties?.invocationTraceFeed) {\n return { invocations: [], total: 0 };\n }\n\n const feed = yield* Database.load(properties.invocationTraceFeed);\n const startEvents = yield* Feed.query(feed, Filter.type(InvocationTraceStartEvent)).run;\n const endEvents = yield* Feed.query(feed, Filter.type(InvocationTraceEndEvent)).run;\n const allSpans = createInvocationSpans([...startEvents, ...endEvents]);\n\n const functionId = getUserFunctionIdInMetadata(Obj.getMeta(loaded));\n\n const filtered = allSpans.filter((span) => {\n if (!span.invocationTarget || !functionId) {\n return false;\n }\n const targetDxn = span.invocationTarget.uri;\n const uuidPart = targetDxn.split(':').pop();\n return uuidPart === functionId;\n });\n\n filtered.sort((a, b) => b.timestamp - a.timestamp);\n const total = filtered.length;\n const invocations = filtered.slice(0, maxResults).map((span) => ({\n id: span.id,\n timestamp: span.timestamp,\n duration: span.duration,\n outcome: `${span.outcome}`,\n input: span.input !== null && typeof span.input === 'object' ? span.input : { value: span.input },\n error: span.error ? (span.error as object) : undefined,\n }));\n\n return { invocations, total };\n }),\n ),\n);\n"],"mappings":";;;;;;;AAcA,IAAA,8BAAe,mBAAmB,KAChC,UAAU,YACR,OAAO,GAAG,WAAW,EAAE,UAAU,IAAI,SAAS;CAC5C,MAAM,SAAS,OAAO,SAAS,KAAK,EAAE;CACtC,MAAM,aAAa,SAAS;CAE5B,MAAM,CAAC,cAAc,OAAO,SAAS,MAAM,MAAM,KAAK,eAAe,CAAC,CAAC,CAAC;CACxE,IAAI,CAAC,YAAY,qBACf,OAAO;EAAE,aAAa,CAAC;EAAG,OAAO;CAAE;CAGrC,MAAM,OAAO,OAAO,SAAS,KAAK,WAAW,mBAAmB;CAChE,MAAM,cAAc,OAAO,KAAK,MAAM,MAAM,OAAO,KAAK,yBAAyB,CAAC,CAAC,CAAC;CACpF,MAAM,YAAY,OAAO,KAAK,MAAM,MAAM,OAAO,KAAK,uBAAuB,CAAC,CAAC,CAAC;CAChF,MAAM,WAAW,sBAAsB,CAAC,GAAG,aAAa,GAAG,SAAS,CAAC;CAErE,MAAM,aAAa,4BAA4B,IAAI,QAAQ,MAAM,CAAC;CAElE,MAAM,WAAW,SAAS,QAAQ,SAAS;EACzC,IAAI,CAAC,KAAK,oBAAoB,CAAC,YAC7B,OAAO;EAIT,OAFkB,KAAK,iBAAiB,IACb,MAAM,GAAG,CAAC,CAAC,IAC/B,MAAa;CACtB,CAAC;CAED,SAAS,MAAM,GAAG,MAAM,EAAE,YAAY,EAAE,SAAS;CACjD,MAAM,QAAQ,SAAS;CAUvB,OAAO;EAAE,aATW,SAAS,MAAM,GAAG,UAAU,CAAC,CAAC,KAAK,UAAU;GAC/D,IAAI,KAAK;GACT,WAAW,KAAK;GAChB,UAAU,KAAK;GACf,SAAS,GAAG,KAAK;GACjB,OAAO,KAAK,UAAU,QAAQ,OAAO,KAAK,UAAU,WAAW,KAAK,QAAQ,EAAE,OAAO,KAAK,MAAM;GAChG,OAAO,KAAK,QAAS,KAAK,QAAmB,KAAA;EAC/C,EAES;EAAa;CAAM;AAC9B,CAAC,CACH,CACF"}
@@ -0,0 +1,40 @@
1
+ import { o as InstallFunction } from "./chunk-functions.mjs";
2
+ import { Operation } from "@dxos/compute";
3
+ import { ClientService } from "@dxos/client";
4
+ import { Filter, Obj } from "@dxos/echo";
5
+ import { Context } from "@dxos/context";
6
+ import { FunctionsServiceClient } from "@dxos/edge-compute";
7
+ import * as Effect from "effect/Effect";
8
+ //#region src/skills/functions/install-function.ts
9
+ var __dxlog_file = "/__w/dxos/dxos/packages/plugins/plugin-script/src/skills/functions/install-function.ts";
10
+ var install_function_default = InstallFunction.pipe(Operation.withHandler(Effect.fn(function* ({ key }) {
11
+ const client = yield* ClientService;
12
+ const functionsService = FunctionsServiceClient.fromClient(client);
13
+ const fn = (yield* Effect.promise(() => functionsService.query(Context.default(void 0, {
14
+ "~LogMeta": "~LogMeta",
15
+ F: __dxlog_file,
16
+ L: 20
17
+ })))).findLast((entry) => Obj.getMeta(entry).key === key);
18
+ if (!fn) return yield* Effect.fail(/* @__PURE__ */ new Error(`No deployed function found with key: ${key}`));
19
+ const space = client.spaces.get()[0];
20
+ if (!space) return yield* Effect.fail(/* @__PURE__ */ new Error("No space available"));
21
+ yield* Effect.promise(() => client.addTypes([Operation.PersistentOperation]));
22
+ const existingFunctions = yield* Effect.promise(() => space.db.query(Filter.and(Filter.type(Operation.PersistentOperation), Filter.key(key))).run());
23
+ let installed;
24
+ if (existingFunctions.length > 0) {
25
+ installed = existingFunctions[0];
26
+ for (const existing of existingFunctions) Operation.setFrom(existing, fn);
27
+ } else {
28
+ installed = Obj.clone(fn);
29
+ space.db.add(installed);
30
+ }
31
+ return {
32
+ function: Obj.getURI(installed),
33
+ name: fn.name ?? "Unnamed function",
34
+ version: Obj.getMeta(fn).version ?? "0.0.0"
35
+ };
36
+ })));
37
+ //#endregion
38
+ export { install_function_default as default };
39
+
40
+ //# sourceMappingURL=chunk-install-function.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chunk-install-function.mjs","names":[],"sources":["../../src/skills/functions/install-function.ts"],"sourcesContent":["//\n// Copyright 2026 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\n\nimport { ClientService } from '@dxos/client';\nimport { Operation } from '@dxos/compute';\nimport { Context } from '@dxos/context';\nimport { Filter, Obj } from '@dxos/echo';\nimport { FunctionsServiceClient } from '@dxos/edge-compute';\n\nimport { InstallFunction } from './definitions';\n\nexport default InstallFunction.pipe(\n Operation.withHandler(\n Effect.fn(function* ({ key }) {\n const client = yield* ClientService;\n const functionsService = FunctionsServiceClient.fromClient(client);\n const deployed = yield* Effect.promise(() => functionsService.query(Context.default()));\n\n const fn = deployed.findLast((entry) => Obj.getMeta(entry).key === key);\n if (!fn) {\n return yield* Effect.fail(new Error(`No deployed function found with key: ${key}`));\n }\n\n const space = client.spaces.get()[0];\n if (!space) {\n return yield* Effect.fail(new Error('No space available'));\n }\n\n yield* Effect.promise(() => client.addTypes([Operation.PersistentOperation]));\n\n const existingFunctions = yield* Effect.promise(() =>\n space.db.query(Filter.and(Filter.type(Operation.PersistentOperation), Filter.key(key))).run(),\n );\n\n let installed: Operation.PersistentOperation;\n if (existingFunctions.length > 0) {\n installed = existingFunctions[0];\n for (const existing of existingFunctions) {\n Operation.setFrom(existing, fn);\n }\n } else {\n installed = Obj.clone(fn);\n space.db.add(installed);\n }\n\n return {\n function: Obj.getURI(installed),\n name: fn.name ?? 'Unnamed function',\n version: Obj.getMeta(fn).version ?? '0.0.0',\n };\n }),\n ),\n);\n"],"mappings":";;;;;;;;;AAcA,IAAA,2BAAe,gBAAgB,KAC7B,UAAU,YACR,OAAO,GAAG,WAAW,EAAE,OAAO;CAC5B,MAAM,SAAS,OAAO;CACtB,MAAM,mBAAmB,uBAAuB,WAAW,MAAM;CAGjE,MAAM,MAAK,OAFa,OAAO,cAAc,iBAAiB,MAAM,QAAQ,QAAO,KAAA,GAAA;EAAA,YAAA;EAAA,GAAA;EAAA,GAAA;CAAA,CAAC,CAAC,CAAC,EAAA,CAElE,UAAU,UAAU,IAAI,QAAQ,KAAK,CAAC,CAAC,QAAQ,GAAG;CACtE,IAAI,CAAC,IACH,OAAO,OAAO,OAAO,qBAAK,IAAI,MAAM,wCAAwC,KAAK,CAAC;CAGpF,MAAM,QAAQ,OAAO,OAAO,IAAI,CAAC,CAAC;CAClC,IAAI,CAAC,OACH,OAAO,OAAO,OAAO,qBAAK,IAAI,MAAM,oBAAoB,CAAC;CAG3D,OAAO,OAAO,cAAc,OAAO,SAAS,CAAC,UAAU,mBAAmB,CAAC,CAAC;CAE5E,MAAM,oBAAoB,OAAO,OAAO,cACtC,MAAM,GAAG,MAAM,OAAO,IAAI,OAAO,KAAK,UAAU,mBAAmB,GAAG,OAAO,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAC9F;CAEA,IAAI;CACJ,IAAI,kBAAkB,SAAS,GAAG;EAChC,YAAY,kBAAkB;EAC9B,KAAK,MAAM,YAAY,mBACrB,UAAU,QAAQ,UAAU,EAAE;CAElC,OAAO;EACL,YAAY,IAAI,MAAM,EAAE;EACxB,MAAM,GAAG,IAAI,SAAS;CACxB;CAEA,OAAO;EACL,UAAU,IAAI,OAAO,SAAS;EAC9B,MAAM,GAAG,QAAQ;EACjB,SAAS,IAAI,QAAQ,EAAE,CAAC,CAAC,WAAW;CACtC;AACF,CAAC,CACH,CACF"}
@@ -0,0 +1,25 @@
1
+ import { s as Invoke } from "./chunk-functions.mjs";
2
+ import { Operation } from "@dxos/compute";
3
+ import { ClientService } from "@dxos/client";
4
+ import { Database, Obj } from "@dxos/echo";
5
+ import { Context } from "@dxos/context";
6
+ import { FunctionsServiceClient } from "@dxos/edge-compute";
7
+ import * as Effect from "effect/Effect";
8
+ //#region src/skills/functions/invoke.ts
9
+ var __dxlog_file = "/__w/dxos/dxos/packages/plugins/plugin-script/src/skills/functions/invoke.ts";
10
+ var invoke_default = Invoke.pipe(Operation.withHandler(Effect.fn(function* ({ function: fn, payload }) {
11
+ const loaded = yield* Database.load(fn);
12
+ const client = yield* ClientService;
13
+ const spaceId = Obj.getDatabase(loaded)?.spaceId;
14
+ if (!spaceId) return yield* Effect.fail(/* @__PURE__ */ new Error("Function is not in a space."));
15
+ const functionsService = FunctionsServiceClient.fromClient(client);
16
+ return { response: yield* Effect.promise(() => functionsService.invoke(Context.default(void 0, {
17
+ "~LogMeta": "~LogMeta",
18
+ F: __dxlog_file,
19
+ L: 28
20
+ }), loaded, payload ?? {}, { spaceId })) };
21
+ })));
22
+ //#endregion
23
+ export { invoke_default as default };
24
+
25
+ //# sourceMappingURL=chunk-invoke.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chunk-invoke.mjs","names":[],"sources":["../../src/skills/functions/invoke.ts"],"sourcesContent":["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\n\nimport { ClientService } from '@dxos/client';\nimport { Operation } from '@dxos/compute';\nimport { Context } from '@dxos/context';\nimport { Database, Obj } from '@dxos/echo';\nimport { FunctionsServiceClient } from '@dxos/edge-compute';\n\nimport { Invoke } from './definitions';\n\nexport default Invoke.pipe(\n Operation.withHandler(\n Effect.fn(function* ({ function: fn, payload }) {\n const loaded = yield* Database.load(fn);\n const client = yield* ClientService;\n\n const spaceId = Obj.getDatabase(loaded)?.spaceId;\n if (!spaceId) {\n return yield* Effect.fail(new Error('Function is not in a space.'));\n }\n\n const functionsService = FunctionsServiceClient.fromClient(client);\n const result = yield* Effect.promise(() =>\n functionsService.invoke(Context.default(), loaded, payload ?? {}, { spaceId }),\n );\n\n return { response: result };\n }),\n ),\n);\n"],"mappings":";;;;;;;;;AAcA,IAAA,iBAAe,OAAO,KACpB,UAAU,YACR,OAAO,GAAG,WAAW,EAAE,UAAU,IAAI,WAAW;CAC9C,MAAM,SAAS,OAAO,SAAS,KAAK,EAAE;CACtC,MAAM,SAAS,OAAO;CAEtB,MAAM,UAAU,IAAI,YAAY,MAAM,CAAC,EAAE;CACzC,IAAI,CAAC,SACH,OAAO,OAAO,OAAO,qBAAK,IAAI,MAAM,6BAA6B,CAAC;CAGpE,MAAM,mBAAmB,uBAAuB,WAAW,MAAM;CAKjE,OAAO,EAAE,UAAU,OAJG,OAAO,cAC3B,iBAAiB,OAAO,QAAQ,QAAO,KAAA,GAAA;EAAA,YAAA;EAAA,GAAA;EAAA,GAAA;CAAA,CAAC,GAAG,QAAQ,WAAW,CAAC,GAAG,EAAE,QAAQ,CAAC,CAC/E,EAE0B;AAC5B,CAAC,CACH,CACF"}
@@ -0,0 +1,33 @@
1
+ import { trim } from "@dxos/util";
2
+ import { Plugin } from "@dxos/app-framework";
3
+ import { DXN } from "@dxos/keys";
4
+ import { Config2 } from "@dxos/app-framework/config";
5
+ //#region dx.config.ts
6
+ var dx_config_default = Config2.make({ plugin: {
7
+ key: "org.dxos.plugin.script",
8
+ name: "Scripts",
9
+ author: "DXOS",
10
+ description: trim`
11
+ Write, deploy, and run custom TypeScript functions as ECHO objects directly inside your Composer spaces.
12
+ Scripts execute on the Cloudflare Workers-based EDGE runtime and have access to the full DXOS SDK,
13
+ Effect-TS, and a curated set of third-party libraries including HTTP, JSON, CSV, and date utilities.
14
+ An AI Script assistant wires CRUD, deploy, invoke, and invocation-inspection operations as tools
15
+ so an agent can scaffold, iterate, and test functions entirely within a chat session.
16
+ `,
17
+ icon: {
18
+ key: "ph--code--regular",
19
+ hue: "sky"
20
+ },
21
+ source: "https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-explorer",
22
+ spec: "PLUGIN.mdl",
23
+ tags: ["labs"],
24
+ screenshots: [{ dark: "https://dxos.network/plugin-details-scripts-dark.png" }]
25
+ } });
26
+ //#endregion
27
+ //#region src/meta.ts
28
+ var meta = Plugin.getMetaFromConfig(dx_config_default);
29
+ var defaultScriptsForIntegration = { "gmail.com": [DXN.make("org.dxos.script.gmail")] };
30
+ //#endregion
31
+ export { meta as n, defaultScriptsForIntegration as t };
32
+
33
+ //# sourceMappingURL=chunk-meta.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chunk-meta.mjs","names":[],"sources":["../../dx.config.ts","../../src/meta.ts"],"sourcesContent":["//\n// Copyright 2025 DXOS.org\n//\n\nimport { Config2 } from '@dxos/app-framework/config';\nimport { trim } from '@dxos/util';\n\nexport default Config2.make({\n plugin: {\n key: 'org.dxos.plugin.script',\n name: 'Scripts',\n author: 'DXOS',\n description: trim`\n Write, deploy, and run custom TypeScript functions as ECHO objects directly inside your Composer spaces.\n Scripts execute on the Cloudflare Workers-based EDGE runtime and have access to the full DXOS SDK,\n Effect-TS, and a curated set of third-party libraries including HTTP, JSON, CSV, and date utilities.\n An AI Script assistant wires CRUD, deploy, invoke, and invocation-inspection operations as tools\n so an agent can scaffold, iterate, and test functions entirely within a chat session.\n `,\n icon: { key: 'ph--code--regular', hue: 'sky' },\n source: 'https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-explorer',\n spec: 'PLUGIN.mdl',\n tags: ['labs'],\n screenshots: [{ dark: 'https://dxos.network/plugin-details-scripts-dark.png' }],\n },\n});\n","//\n// Copyright 2023 DXOS.org\n//\n\nimport { Plugin } from '@dxos/app-framework';\nimport { DXN } from '@dxos/keys';\n\nimport config from '../dx.config';\n\nexport const meta = Plugin.getMetaFromConfig(config);\n\n// TODO(ZaymonFC): Configure by scopes?\nexport const defaultScriptsForIntegration: Record<string, string[]> = {\n // TODO(wittjosiah): Also include content extraction scripts in the default set.\n 'gmail.com': [DXN.make('org.dxos.script.gmail')],\n};\n"],"mappings":";;;;;AAOA,IAAA,oBAAe,QAAQ,KAAK,EAC1B,QAAQ;CACN,KAAK;CACL,MAAM;CACN,QAAQ;CACR,aAAa,IAAI;;;;;;;CAOjB,MAAM;EAAE,KAAK;EAAqB,KAAK;CAAM;CAC7C,QAAQ;CACR,MAAM;CACN,MAAM,CAAC,MAAM;CACb,aAAa,CAAC,EAAE,MAAM,uDAAuD,CAAC;AAChF,EACF,CAAC;;;AChBD,IAAa,OAAO,OAAO,kBAAkB,iBAAM;AAGnD,IAAa,+BAAyD,EAEpE,aAAa,CAAC,IAAI,KAAK,uBAAuB,CAAC,EACjD"}
@@ -0,0 +1,13 @@
1
+ import { t as ScriptHandlers } from "./chunk-functions.mjs";
2
+ import { OperationHandlerSet } from "@dxos/compute";
3
+ import { Capabilities, Capability } from "@dxos/app-framework";
4
+ import * as Effect from "effect/Effect";
5
+ import { ScriptOperationHandlerSet } from "#operations";
6
+ //#region src/capabilities/operation-handler.ts
7
+ var operation_handler_default = Capability.makeModule(Effect.fnUntraced(function* () {
8
+ return Capability.contributes(Capabilities.OperationHandler, OperationHandlerSet.merge(ScriptOperationHandlerSet, ScriptHandlers));
9
+ }));
10
+ //#endregion
11
+ export { operation_handler_default as default };
12
+
13
+ //# sourceMappingURL=chunk-operation-handler.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chunk-operation-handler.mjs","names":[],"sources":["../../src/capabilities/operation-handler.ts"],"sourcesContent":["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\n\nimport { Capabilities, Capability } from '@dxos/app-framework';\nimport { OperationHandlerSet } from '@dxos/compute';\n\nimport { ScriptOperationHandlerSet } from '#operations';\n\nimport { ScriptHandlers } from '../skills/functions';\n\nexport default Capability.makeModule<OperationHandlerSet.OperationHandlerSet>(\n Effect.fnUntraced(function* () {\n return Capability.contributes(\n Capabilities.OperationHandler,\n OperationHandlerSet.merge(ScriptOperationHandlerSet, ScriptHandlers),\n );\n }),\n);\n"],"mappings":";;;;;;AAaA,IAAA,4BAAe,WAAW,WACxB,OAAO,WAAW,aAAa;CAC7B,OAAO,WAAW,YAChB,aAAa,kBACb,oBAAoB,MAAM,2BAA2B,cAAc,CACrE;AACF,CAAC,CACH"}
@@ -0,0 +1,31 @@
1
+ import { c as QueryDeployedFunctions } from "./chunk-functions.mjs";
2
+ import { Operation } from "@dxos/compute";
3
+ import { ClientService } from "@dxos/client";
4
+ import { Obj } from "@dxos/echo";
5
+ import { Context } from "@dxos/context";
6
+ import { FunctionsServiceClient } from "@dxos/edge-compute";
7
+ import * as Effect from "effect/Effect";
8
+ //#region src/skills/functions/query-deployed-functions.ts
9
+ var __dxlog_file = "/__w/dxos/dxos/packages/plugins/plugin-script/src/skills/functions/query-deployed-functions.ts";
10
+ var query_deployed_functions_default = QueryDeployedFunctions.pipe(Operation.withHandler(Effect.fn(function* () {
11
+ const client = yield* ClientService;
12
+ const functionsService = FunctionsServiceClient.fromClient(client);
13
+ return { functions: (yield* Effect.promise(() => functionsService.query(Context.default(void 0, {
14
+ "~LogMeta": "~LogMeta",
15
+ F: __dxlog_file,
16
+ L: 20
17
+ })))).map((fn) => {
18
+ const meta = Obj.getMeta(fn);
19
+ return {
20
+ key: meta.key,
21
+ name: fn.name ?? "Unnamed function",
22
+ version: meta.version ?? "0.0.0",
23
+ description: fn.description,
24
+ updated: fn.updated
25
+ };
26
+ }) };
27
+ })));
28
+ //#endregion
29
+ export { query_deployed_functions_default as default };
30
+
31
+ //# sourceMappingURL=chunk-query-deployed-functions.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chunk-query-deployed-functions.mjs","names":[],"sources":["../../src/skills/functions/query-deployed-functions.ts"],"sourcesContent":["//\n// Copyright 2026 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\n\nimport { ClientService } from '@dxos/client';\nimport { Operation } from '@dxos/compute';\nimport { Context } from '@dxos/context';\nimport { Obj } from '@dxos/echo';\nimport { FunctionsServiceClient } from '@dxos/edge-compute';\n\nimport { QueryDeployedFunctions } from './definitions';\n\nexport default QueryDeployedFunctions.pipe(\n Operation.withHandler(\n Effect.fn(function* () {\n const client = yield* ClientService;\n const functionsService = FunctionsServiceClient.fromClient(client);\n const deployed = yield* Effect.promise(() => functionsService.query(Context.default()));\n return {\n functions: deployed.map((fn) => {\n const meta = Obj.getMeta(fn);\n return {\n key: meta.key,\n name: fn.name ?? 'Unnamed function',\n version: meta.version ?? '0.0.0',\n description: fn.description,\n updated: fn.updated,\n };\n }),\n };\n }),\n ),\n);\n"],"mappings":";;;;;;;;;AAcA,IAAA,mCAAe,uBAAuB,KACpC,UAAU,YACR,OAAO,GAAG,aAAa;CACrB,MAAM,SAAS,OAAO;CACtB,MAAM,mBAAmB,uBAAuB,WAAW,MAAM;CAEjE,OAAO,EACL,YAAW,OAFW,OAAO,cAAc,iBAAiB,MAAM,QAAQ,QAAO,KAAA,GAAA;EAAA,YAAA;EAAA,GAAA;EAAA,GAAA;CAAA,CAAC,CAAC,CAAC,EAAA,CAEhE,KAAK,OAAO;EAC9B,MAAM,OAAO,IAAI,QAAQ,EAAE;EAC3B,OAAO;GACL,KAAK,KAAK;GACV,MAAM,GAAG,QAAQ;GACjB,SAAS,KAAK,WAAW;GACzB,aAAa,GAAG;GAChB,SAAS,GAAG;EACd;CACF,CAAC,EACH;AACF,CAAC,CACH,CACF"}
@@ -0,0 +1,140 @@
1
+ import { t as getAccessCredential } from "./chunk-util.mjs";
2
+ import { Script } from "@dxos/compute";
3
+ import { Feed } from "@dxos/echo";
4
+ import { Capabilities, Capability } from "@dxos/app-framework";
5
+ import { DXN as DXN$1 } from "@dxos/keys";
6
+ import { meta } from "#meta";
7
+ import { Notebook, ScriptCapabilities } from "#types";
8
+ import "react";
9
+ import { Panel } from "@dxos/react-ui";
10
+ import { jsx } from "react/jsx-runtime";
11
+ import { Surface, useAtomCapability, useSettingsState } from "@dxos/app-framework/ui";
12
+ import { AppSurface } from "@dxos/app-toolkit/ui";
13
+ import { useCompiler } from "#hooks";
14
+ import { useClient } from "@dxos/react-client";
15
+ import { getSpace } from "@dxos/react-client/echo";
16
+ import * as Effect from "effect/Effect";
17
+ import { DeploymentDialog, NotebookArticle, ScriptArticle, ScriptProperties, ScriptSettings, TestContainer } from "#containers";
18
+ import { InvocationTraceContainer } from "@dxos/devtools";
19
+ //#region src/constants.ts
20
+ var DEPLOYMENT_DIALOG = DXN$1.make(`${meta.profile.key}.deploymentDialog`);
21
+ //#endregion
22
+ //#region src/capabilities/ScriptSurfaces.tsx
23
+ var ScriptSettingsSurface = ({ subject }) => {
24
+ const { settings, updateSettings } = useSettingsState(subject.atom);
25
+ const client = useClient();
26
+ const handleAuthenticate = async () => {
27
+ const identity = client.halo.identity.get();
28
+ if (!identity) return;
29
+ await client.halo.writeCredentials([getAccessCredential(identity.identityKey)]);
30
+ };
31
+ return /* @__PURE__ */ jsx(ScriptSettings, {
32
+ settings,
33
+ onSettingsChange: updateSettings,
34
+ onAuthenticate: handleAuthenticate
35
+ });
36
+ };
37
+ /** The compiler environment and settings are ambient, so they are resolved here rather than mapped. */
38
+ var ScriptArticleSurface = ({ role, subject, attendableId }) => {
39
+ const compiler = useCompiler();
40
+ return /* @__PURE__ */ jsx(ScriptArticle, {
41
+ role,
42
+ subject,
43
+ attendableId,
44
+ settings: useAtomCapability(ScriptCapabilities.Settings),
45
+ env: compiler?.environment
46
+ });
47
+ };
48
+ var NotebookArticleSurface = ({ role, subject, attendableId }) => {
49
+ return /* @__PURE__ */ jsx(NotebookArticle, {
50
+ role,
51
+ subject,
52
+ attendableId,
53
+ env: useCompiler()?.environment
54
+ });
55
+ };
56
+ /** Resolves the space's invocation-trace feed for the selected script. */
57
+ var ScriptLogsSurface = ({ role, script }) => {
58
+ const space = getSpace(script);
59
+ const feed = space?.properties.invocationTraceFeed?.target;
60
+ const feedDXN = feed ? Feed.getFeedUri(feed) : void 0;
61
+ return /* @__PURE__ */ jsx(Panel.Root, {
62
+ role,
63
+ children: /* @__PURE__ */ jsx(Panel.Content, {
64
+ asChild: true,
65
+ children: /* @__PURE__ */ jsx(InvocationTraceContainer, {
66
+ db: space?.db,
67
+ feedDXN,
68
+ target: script,
69
+ detailAxis: "block"
70
+ })
71
+ })
72
+ });
73
+ };
74
+ //#endregion
75
+ //#region src/capabilities/react-surface.ts
76
+ var react_surface_default = Capability.makeModule(() => Effect.succeed(Capability.contributes(Capabilities.ReactSurface, [
77
+ Surface.create({
78
+ id: "pluginSettings",
79
+ filter: AppSurface.settings(AppSurface.Article, meta.profile.key),
80
+ component: ScriptSettingsSurface,
81
+ props: ({ data: { subject } }) => ({ subject })
82
+ }),
83
+ Surface.create({
84
+ id: "script.article",
85
+ filter: AppSurface.oneOf(AppSurface.object(AppSurface.Article, Script.Script), AppSurface.object(AppSurface.Section, Script.Script)),
86
+ component: ScriptArticleSurface,
87
+ props: ({ role, data: { subject, attendableId } }) => ({
88
+ role,
89
+ subject,
90
+ attendableId
91
+ })
92
+ }),
93
+ Surface.create({
94
+ id: "notebook.article",
95
+ filter: AppSurface.object(AppSurface.Article, Notebook.Notebook),
96
+ component: NotebookArticleSurface,
97
+ props: ({ role, data: { subject, attendableId } }) => ({
98
+ role,
99
+ subject,
100
+ attendableId
101
+ })
102
+ }),
103
+ Surface.create({
104
+ id: "objectProperties",
105
+ filter: AppSurface.object(AppSurface.ObjectProperties, Script.Script),
106
+ component: ScriptProperties,
107
+ props: ({ role, data: { subject } }) => ({
108
+ role,
109
+ subject
110
+ })
111
+ }),
112
+ Surface.create({
113
+ id: "companion.execute",
114
+ filter: AppSurface.allOf(AppSurface.literal(AppSurface.Article, "execute"), AppSurface.companion(AppSurface.Article, Script.Script)),
115
+ component: TestContainer,
116
+ props: ({ role, data: { companionTo } }) => ({
117
+ role,
118
+ script: companionTo
119
+ })
120
+ }),
121
+ Surface.create({
122
+ id: "companion.logs",
123
+ filter: AppSurface.allOf(AppSurface.literal(AppSurface.Article, "logs"), AppSurface.companion(AppSurface.Article, Script.Script)),
124
+ component: ScriptLogsSurface,
125
+ props: ({ role, data: { companionTo } }) => ({
126
+ role,
127
+ script: companionTo
128
+ })
129
+ }),
130
+ Surface.create({
131
+ id: DEPLOYMENT_DIALOG,
132
+ filter: AppSurface.component(AppSurface.Dialog, DEPLOYMENT_DIALOG),
133
+ component: DeploymentDialog,
134
+ props: ({ data: { props } }) => ({ ...props })
135
+ })
136
+ ])));
137
+ //#endregion
138
+ export { react_surface_default as default };
139
+
140
+ //# sourceMappingURL=chunk-react-surface.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chunk-react-surface.mjs","names":[],"sources":["../../src/constants.ts","../../src/capabilities/ScriptSurfaces.tsx","../../src/capabilities/react-surface.ts"],"sourcesContent":["//\n// Copyright 2025 DXOS.org\n//\n\nimport { DXN } from '@dxos/keys';\n\nimport { meta } from '#meta';\n\nexport const DEPLOYMENT_DIALOG = DXN.make(`${meta.profile.key}.deploymentDialog`);\n","//\n// Copyright 2025 DXOS.org\n//\n\n// Surface components that cannot be expressed as a `props` mapper, because they call hooks.\n\nimport React from 'react';\n\nimport { useAtomCapability, useSettingsState } from '@dxos/app-framework/ui';\nimport { type AppCapabilities } from '@dxos/app-toolkit';\nimport { type Script } from '@dxos/compute';\nimport { InvocationTraceContainer } from '@dxos/devtools';\nimport { Feed } from '@dxos/echo';\nimport { useClient } from '@dxos/react-client';\nimport { getSpace } from '@dxos/react-client/echo';\nimport { Panel } from '@dxos/react-ui';\n\nimport { NotebookArticle, ScriptArticle, ScriptSettings } from '#containers';\nimport { useCompiler } from '#hooks';\nimport { type Notebook, ScriptCapabilities, type Settings } from '#types';\n\nimport { getAccessCredential } from '../util';\n\nexport type ScriptSettingsSurfaceProps = {\n subject: AppCapabilities.Settings;\n};\n\nexport const ScriptSettingsSurface = ({ subject }: ScriptSettingsSurfaceProps) => {\n const { settings, updateSettings } = useSettingsState<Settings.Settings>(subject.atom);\n const client = useClient();\n // TODO(burdon): Check token.\n const handleAuthenticate = async () => {\n const identity = client.halo.identity.get();\n if (!identity) {\n return;\n }\n\n await client.halo.writeCredentials([getAccessCredential(identity.identityKey)]);\n };\n\n return <ScriptSettings settings={settings} onSettingsChange={updateSettings} onAuthenticate={handleAuthenticate} />;\n};\n\nexport type ScriptArticleSurfaceProps = {\n role: string;\n subject: Script.Script;\n attendableId?: string;\n};\n\n/** The compiler environment and settings are ambient, so they are resolved here rather than mapped. */\nexport const ScriptArticleSurface = ({ role, subject, attendableId }: ScriptArticleSurfaceProps) => {\n const compiler = useCompiler();\n const settings = useAtomCapability(ScriptCapabilities.Settings);\n\n return (\n <ScriptArticle\n role={role}\n subject={subject}\n attendableId={attendableId}\n settings={settings}\n env={compiler?.environment}\n />\n );\n};\n\nexport type NotebookArticleSurfaceProps = {\n role: string;\n subject: Notebook.Notebook;\n attendableId?: string;\n};\n\nexport const NotebookArticleSurface = ({ role, subject, attendableId }: NotebookArticleSurfaceProps) => {\n const compiler = useCompiler();\n\n return <NotebookArticle role={role} subject={subject} attendableId={attendableId} env={compiler?.environment} />;\n};\n\nexport type ScriptLogsSurfaceProps = {\n role: string;\n script: Script.Script;\n};\n\n/** Resolves the space's invocation-trace feed for the selected script. */\nexport const ScriptLogsSurface = ({ role, script }: ScriptLogsSurfaceProps) => {\n const space = getSpace(script);\n const feed = space?.properties.invocationTraceFeed?.target;\n const feedDXN = feed ? Feed.getFeedUri(feed) : undefined;\n\n return (\n <Panel.Root role={role}>\n <Panel.Content asChild>\n <InvocationTraceContainer db={space?.db} feedDXN={feedDXN} target={script} detailAxis='block' />\n </Panel.Content>\n </Panel.Root>\n );\n};\n","//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\nimport { type ComponentProps } from 'react';\n\nimport { Capabilities, Capability } from '@dxos/app-framework';\nimport { Surface } from '@dxos/app-framework/ui';\nimport { AppSurface } from '@dxos/app-toolkit/ui';\nimport { Script } from '@dxos/compute';\n\nimport { DeploymentDialog, ScriptProperties, TestContainer } from '#containers';\nimport { meta } from '#meta';\nimport { Notebook } from '#types';\n\nimport { DEPLOYMENT_DIALOG } from '../constants';\nimport {\n NotebookArticleSurface,\n ScriptArticleSurface,\n ScriptLogsSurface,\n ScriptSettingsSurface,\n} from './ScriptSurfaces';\n\nexport default Capability.makeModule(() =>\n Effect.succeed(\n Capability.contributes(Capabilities.ReactSurface, [\n Surface.create({\n id: 'pluginSettings',\n filter: AppSurface.settings(AppSurface.Article, meta.profile.key),\n component: ScriptSettingsSurface,\n props: ({ data: { subject } }) => ({ subject }),\n }),\n Surface.create({\n id: 'script.article',\n // TODO(wittjosiah): Split into multiple surfaces if this filter proves too strict for non-article roles.\n filter: AppSurface.oneOf(\n AppSurface.object(AppSurface.Article, Script.Script),\n AppSurface.object(AppSurface.Section, Script.Script),\n ),\n component: ScriptArticleSurface,\n props: ({ role, data: { subject, attendableId } }) => ({ role, subject, attendableId }),\n }),\n Surface.create({\n id: 'notebook.article',\n filter: AppSurface.object(AppSurface.Article, Notebook.Notebook),\n component: NotebookArticleSurface,\n props: ({ role, data: { subject, attendableId } }) => ({ role, subject, attendableId }),\n }),\n Surface.create({\n id: 'objectProperties',\n filter: AppSurface.object(AppSurface.ObjectProperties, Script.Script),\n component: ScriptProperties,\n props: ({ role, data: { subject } }) => ({ role, subject }),\n }),\n Surface.create({\n id: 'companion.execute',\n filter: AppSurface.allOf(\n AppSurface.literal(AppSurface.Article, 'execute'),\n AppSurface.companion(AppSurface.Article, Script.Script),\n ),\n component: TestContainer,\n props: ({ role, data: { companionTo } }) => ({ role, script: companionTo }),\n }),\n Surface.create({\n id: 'companion.logs',\n filter: AppSurface.allOf(\n AppSurface.literal(AppSurface.Article, 'logs'),\n AppSurface.companion(AppSurface.Article, Script.Script),\n ),\n component: ScriptLogsSurface,\n props: ({ role, data: { companionTo } }) => ({ role, script: companionTo }),\n }),\n Surface.create({\n id: DEPLOYMENT_DIALOG,\n filter: AppSurface.component<ComponentProps<typeof DeploymentDialog>>(AppSurface.Dialog, DEPLOYMENT_DIALOG),\n component: DeploymentDialog,\n props: ({ data: { props } }) => ({ ...props }),\n }),\n ]),\n ),\n);\n"],"mappings":"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"}
@@ -0,0 +1,20 @@
1
+ import { l as Read } from "./chunk-functions.mjs";
2
+ import { Operation } from "@dxos/compute";
3
+ import { Database } from "@dxos/echo";
4
+ import * as Effect from "effect/Effect";
5
+ //#region src/skills/functions/read.ts
6
+ var read_default = Read.pipe(Operation.withHandler(Effect.fn(function* ({ function: fn }) {
7
+ const loaded = yield* Database.load(fn);
8
+ if (!loaded.source) return yield* Effect.fail(/* @__PURE__ */ new Error("Function has no source script."));
9
+ const script = yield* Database.load(loaded.source);
10
+ const text = yield* Database.load(script.source);
11
+ return {
12
+ name: script.name,
13
+ source: text.content,
14
+ description: script.description
15
+ };
16
+ })));
17
+ //#endregion
18
+ export { read_default as default };
19
+
20
+ //# sourceMappingURL=chunk-read.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chunk-read.mjs","names":[],"sources":["../../src/skills/functions/read.ts"],"sourcesContent":["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\n\nimport { Operation, type Script } from '@dxos/compute';\nimport { Database } from '@dxos/echo';\n\nimport { Read } from './definitions';\n\nexport default Read.pipe(\n Operation.withHandler(\n Effect.fn(function* ({ function: fn }) {\n const loaded = yield* Database.load(fn);\n if (!loaded.source) {\n return yield* Effect.fail(new Error('Function has no source script.'));\n }\n const script = (yield* Database.load(loaded.source)) as Script.Script;\n const text = yield* Database.load(script.source);\n\n return {\n name: script.name,\n source: text.content,\n description: script.description,\n };\n }),\n ),\n);\n"],"mappings":";;;;;AAWA,IAAA,eAAe,KAAK,KAClB,UAAU,YACR,OAAO,GAAG,WAAW,EAAE,UAAU,MAAM;CACrC,MAAM,SAAS,OAAO,SAAS,KAAK,EAAE;CACtC,IAAI,CAAC,OAAO,QACV,OAAO,OAAO,OAAO,qBAAK,IAAI,MAAM,gCAAgC,CAAC;CAEvE,MAAM,SAAU,OAAO,SAAS,KAAK,OAAO,MAAM;CAClD,MAAM,OAAO,OAAO,SAAS,KAAK,OAAO,MAAM;CAE/C,OAAO;EACL,MAAM,OAAO;EACb,QAAQ,KAAK;EACb,aAAa,OAAO;CACtB;AACF,CAAC,CACH,CACF"}
@@ -0,0 +1,23 @@
1
+ import { Capability } from "@dxos/app-framework";
2
+ import { meta } from "#meta";
3
+ import { AppCapabilities } from "@dxos/app-toolkit";
4
+ import { ScriptCapabilities, Settings } from "#types";
5
+ import { createKvsStore } from "@dxos/effect";
6
+ import * as Effect from "effect/Effect";
7
+ //#region src/capabilities/settings.ts
8
+ var settings_default = Capability.makeModule(() => Effect.sync(() => {
9
+ const settingsAtom = createKvsStore({
10
+ key: meta.profile.key,
11
+ schema: Settings.Settings,
12
+ defaultValue: () => ({ editorInputMode: "vscode" })
13
+ });
14
+ return [Capability.contributes(ScriptCapabilities.Settings, settingsAtom), Capability.contributes(AppCapabilities.Settings, {
15
+ prefix: meta.profile.key,
16
+ schema: Settings.Settings,
17
+ atom: settingsAtom
18
+ })];
19
+ }));
20
+ //#endregion
21
+ export { settings_default as default };
22
+
23
+ //# sourceMappingURL=chunk-settings.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chunk-settings.mjs","names":[],"sources":["../../src/capabilities/settings.ts"],"sourcesContent":["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\n\nimport { Capability } from '@dxos/app-framework';\nimport { AppCapabilities } from '@dxos/app-toolkit';\nimport { createKvsStore } from '@dxos/effect';\n\nimport { meta } from '#meta';\nimport { ScriptCapabilities, Settings } from '#types';\n\nexport default Capability.makeModule(() =>\n Effect.sync(() => {\n const settingsAtom = createKvsStore({\n key: meta.profile.key,\n schema: Settings.Settings,\n defaultValue: () => ({\n editorInputMode: 'vscode' as const,\n }),\n });\n\n return [\n Capability.contributes(ScriptCapabilities.Settings, settingsAtom),\n Capability.contributes(AppCapabilities.Settings, {\n prefix: meta.profile.key,\n schema: Settings.Settings,\n atom: settingsAtom,\n }),\n ];\n }),\n);\n"],"mappings":";;;;;;;AAaA,IAAA,mBAAe,WAAW,iBACxB,OAAO,WAAW;CAChB,MAAM,eAAe,eAAe;EAClC,KAAK,KAAK,QAAQ;EAClB,QAAQ,SAAS;EACjB,qBAAqB,EACnB,iBAAiB,SACnB;CACF,CAAC;CAED,OAAO,CACL,WAAW,YAAY,mBAAmB,UAAU,YAAY,GAChE,WAAW,YAAY,gBAAgB,UAAU;EAC/C,QAAQ,KAAK,QAAQ;EACrB,QAAQ,SAAS;EACjB,MAAM;CACR,CAAC,CACH;AACF,CAAC,CACH"}
@@ -0,0 +1,10 @@
1
+ import { Capability } from "@dxos/app-framework";
2
+ import { AppCapabilities } from "@dxos/app-toolkit";
3
+ import * as Effect from "effect/Effect";
4
+ import { ScriptSkill } from "#skills";
5
+ //#region src/capabilities/skill-definition.ts
6
+ var skillDefinition = () => Effect.succeed([Capability.contributes(AppCapabilities.SkillDefinition, ScriptSkill)]);
7
+ //#endregion
8
+ export { skillDefinition as default };
9
+
10
+ //# sourceMappingURL=chunk-skill-definition.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chunk-skill-definition.mjs","names":[],"sources":["../../src/capabilities/skill-definition.ts"],"sourcesContent":["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\n\nimport { Capability } from '@dxos/app-framework';\nimport { AppCapabilities } from '@dxos/app-toolkit';\n\nimport { ScriptSkill } from '#skills';\n\nconst skillDefinition = () => Effect.succeed([Capability.contributes(AppCapabilities.SkillDefinition, ScriptSkill)]);\n\nexport default skillDefinition;\n"],"mappings":";;;;;AAWA,IAAM,wBAAwB,OAAO,QAAQ,CAAC,WAAW,YAAY,gBAAgB,iBAAiB,WAAW,CAAC,CAAC"}
@@ -0,0 +1,35 @@
1
+ import { a as InspectInvocations, c as QueryDeployedFunctions, i as Deploy, l as Read, n as Create, o as InstallFunction, r as Delete, s as Invoke, u as Update } from "./chunk-functions.mjs";
2
+ import { Skill, Template } from "@dxos/compute";
3
+ import { trim } from "@dxos/util";
4
+ //#region src/skills/script-skill.ts
5
+ var SKILL_KEY = "org.dxos.skill.script";
6
+ var make = () => Skill.make({
7
+ key: SKILL_KEY,
8
+ name: "Script",
9
+ agentCanEnable: true,
10
+ tools: Skill.toolDefinitions({ operations: [
11
+ Create,
12
+ Read,
13
+ Update,
14
+ Delete,
15
+ Deploy,
16
+ Invoke,
17
+ InspectInvocations,
18
+ QueryDeployedFunctions,
19
+ InstallFunction
20
+ ] }),
21
+ instructions: Template.make({ source: trim`
22
+ You can create, read, update, and delete scripts which contain TypeScript code.
23
+ You can deploy scripts to the Edge runtime and invoke deployed scripts.
24
+ You can inspect the invocation history of a deployed script.
25
+ You can query all functions deployed to the EDGE runtime and install them into the current space.
26
+ ` })
27
+ });
28
+ var skill = {
29
+ key: SKILL_KEY,
30
+ make
31
+ };
32
+ //#endregion
33
+ export { skill as t };
34
+
35
+ //# sourceMappingURL=chunk-skills.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chunk-skills.mjs","names":[],"sources":["../../src/skills/script-skill.ts"],"sourcesContent":["//\n// Copyright 2025 DXOS.org\n//\n\nimport { Skill, Template } from '@dxos/compute';\nimport { trim } from '@dxos/util';\n\nimport {\n Create,\n Delete,\n Deploy,\n InspectInvocations,\n InstallFunction,\n Invoke,\n QueryDeployedFunctions,\n Read,\n Update,\n} from './functions';\n\nconst SKILL_KEY = 'org.dxos.skill.script';\n\nconst make = () =>\n Skill.make({\n key: SKILL_KEY,\n name: 'Script',\n agentCanEnable: true,\n tools: Skill.toolDefinitions({\n operations: [\n Create,\n Read,\n Update,\n Delete,\n Deploy,\n Invoke,\n InspectInvocations,\n QueryDeployedFunctions,\n InstallFunction,\n ],\n }),\n instructions: Template.make({\n source: trim`\n You can create, read, update, and delete scripts which contain TypeScript code.\n You can deploy scripts to the Edge runtime and invoke deployed scripts.\n You can inspect the invocation history of a deployed script.\n You can query all functions deployed to the EDGE runtime and install them into the current space.\n `,\n }),\n });\n\nconst skill: Skill.Definition = {\n key: SKILL_KEY,\n make,\n};\n\nexport default skill;\n"],"mappings":";;;;AAmBA,IAAM,YAAY;AAElB,IAAM,aACJ,MAAM,KAAK;CACT,KAAK;CACL,MAAM;CACN,gBAAgB;CAChB,OAAO,MAAM,gBAAgB,EAC3B,YAAY;EACV;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF,EACF,CAAC;CACD,cAAc,SAAS,KAAK,EAC1B,QAAQ,IAAI;;;;;QAMd,CAAC;AACH,CAAC;AAEH,IAAM,QAA0B;CAC9B,KAAK;CACL;AACF"}