@dxos/plugin-script 0.12.0-next-73daef452f1464b62efdbca75fb0067c1066f264 → 0.13.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 (329) hide show
  1. package/PLUGIN.mdl +93 -17
  2. package/README.md +1 -1
  3. package/dist/lib/Notebook.mjs +4 -5
  4. package/dist/lib/Notebook.mjs.map +1 -1
  5. package/dist/lib/ScriptCapabilities.mjs.map +1 -1
  6. package/dist/lib/ScriptOperation.mjs +1 -1
  7. package/dist/lib/ScriptOperation.mjs.map +1 -1
  8. package/dist/lib/ScriptOperationHandlerSet.mjs.map +1 -1
  9. package/dist/lib/ScriptSkill.mjs +1 -1
  10. package/dist/lib/ScriptSkill.mjs.map +1 -1
  11. package/dist/lib/capabilities.browser.mjs +51 -0
  12. package/dist/lib/capabilities.browser.mjs.map +1 -0
  13. package/dist/lib/capabilities.mjs +17 -7
  14. package/dist/lib/capabilities.mjs.map +1 -1
  15. package/dist/lib/capabilities.node.mjs +16 -4
  16. package/dist/lib/capabilities.node.mjs.map +1 -1
  17. package/dist/lib/capabilities.tauri.mjs +51 -0
  18. package/dist/lib/capabilities.tauri.mjs.map +1 -0
  19. package/dist/lib/capabilities.workerd.mjs +1 -1
  20. package/dist/lib/capabilities.workerd.mjs.map +1 -1
  21. package/dist/lib/chunk-DeploymentDialog.mjs +12 -9
  22. package/dist/lib/chunk-DeploymentDialog.mjs.map +1 -1
  23. package/dist/lib/chunk-NotebookArticle.mjs +37 -36
  24. package/dist/lib/chunk-NotebookArticle.mjs.map +1 -1
  25. package/dist/lib/chunk-PLUGIN.mjs +6 -0
  26. package/dist/lib/chunk-PLUGIN.mjs.map +1 -0
  27. package/dist/lib/chunk-ScriptArticle.mjs +14 -15
  28. package/dist/lib/chunk-ScriptArticle.mjs.map +1 -1
  29. package/dist/lib/chunk-ScriptProperties.mjs +91 -94
  30. package/dist/lib/chunk-ScriptProperties.mjs.map +1 -1
  31. package/dist/lib/chunk-ScriptSettings.mjs +11 -8
  32. package/dist/lib/chunk-ScriptSettings.mjs.map +1 -1
  33. package/dist/lib/chunk-TestContainer.mjs +5 -5
  34. package/dist/lib/chunk-TestContainer.mjs.map +1 -1
  35. package/dist/lib/chunk-app-graph-builder.mjs +2 -0
  36. package/dist/lib/chunk-app-graph-builder.mjs.map +1 -1
  37. package/dist/lib/chunk-compiler.mjs +87 -4
  38. package/dist/lib/chunk-compiler.mjs.map +1 -1
  39. package/dist/lib/chunk-create-object.mjs +1 -1
  40. package/dist/lib/chunk-create-script.mjs.map +1 -1
  41. package/dist/lib/chunk-create.mjs +4 -4
  42. package/dist/lib/chunk-create.mjs.map +1 -1
  43. package/dist/lib/chunk-definitions.mjs +246 -0
  44. package/dist/lib/chunk-definitions.mjs.map +1 -0
  45. package/dist/lib/chunk-delete.mjs +2 -2
  46. package/dist/lib/chunk-delete.mjs.map +1 -1
  47. package/dist/lib/chunk-deploy.mjs +16 -12
  48. package/dist/lib/chunk-deploy.mjs.map +1 -1
  49. package/dist/lib/chunk-errors.mjs +8 -0
  50. package/dist/lib/chunk-errors.mjs.map +1 -0
  51. package/dist/lib/chunk-functions.mjs +66 -246
  52. package/dist/lib/chunk-functions.mjs.map +1 -1
  53. package/dist/lib/chunk-inspect-invocations.mjs +3 -3
  54. package/dist/lib/chunk-inspect-invocations.mjs.map +1 -1
  55. package/dist/lib/chunk-install-function.mjs +11 -11
  56. package/dist/lib/chunk-install-function.mjs.map +1 -1
  57. package/dist/lib/chunk-invoke.mjs +6 -6
  58. package/dist/lib/chunk-invoke.mjs.map +1 -1
  59. package/dist/lib/chunk-operation-handler.mjs +16 -2
  60. package/dist/lib/chunk-operation-handler.mjs.map +1 -1
  61. package/dist/lib/chunk-query-deployed-functions.mjs +5 -6
  62. package/dist/lib/chunk-query-deployed-functions.mjs.map +1 -1
  63. package/dist/lib/chunk-react-surface.mjs +14 -10
  64. package/dist/lib/chunk-react-surface.mjs.map +1 -1
  65. package/dist/lib/chunk-read.mjs +4 -3
  66. package/dist/lib/chunk-read.mjs.map +1 -1
  67. package/dist/lib/chunk-settings.mjs +2 -2
  68. package/dist/lib/chunk-settings.mjs.map +1 -1
  69. package/dist/lib/chunk-skill-definition.mjs +1 -1
  70. package/dist/lib/chunk-templates.mjs +3 -3
  71. package/dist/lib/chunk-update.mjs +4 -3
  72. package/dist/lib/chunk-update.mjs.map +1 -1
  73. package/dist/lib/components.mjs +114 -123
  74. package/dist/lib/components.mjs.map +1 -1
  75. package/dist/lib/containers.mjs.map +1 -1
  76. package/dist/lib/hooks.mjs +96 -16
  77. package/dist/lib/hooks.mjs.map +1 -1
  78. package/dist/lib/index.mjs +5 -3
  79. package/dist/lib/meta.mjs.map +1 -1
  80. package/dist/lib/ns/ScriptFunction.mjs +12 -0
  81. package/dist/lib/ns/ScriptFunction.mjs.map +1 -0
  82. package/dist/lib/ns/Templates.mjs +11 -0
  83. package/dist/lib/ns/Templates.mjs.map +1 -0
  84. package/dist/lib/testing.mjs +1 -1
  85. package/dist/lib/translations.mjs +2 -1
  86. package/dist/lib/translations.mjs.map +1 -1
  87. package/dist/types/src/ScriptFunction.d.ts +2 -0
  88. package/dist/types/src/ScriptFunction.d.ts.map +1 -0
  89. package/dist/types/src/Templates.d.ts +2 -0
  90. package/dist/types/src/Templates.d.ts.map +1 -0
  91. package/dist/types/src/capabilities/ScriptSurfaces.d.ts.map +1 -1
  92. package/dist/types/src/capabilities/compiler.d.ts +2 -1
  93. package/dist/types/src/capabilities/compiler.d.ts.map +1 -1
  94. package/dist/types/src/capabilities/errors.d.ts +33 -0
  95. package/dist/types/src/capabilities/errors.d.ts.map +1 -0
  96. package/dist/types/src/capabilities/gen/browser.d.ts +12 -0
  97. package/dist/types/src/capabilities/gen/browser.d.ts.map +1 -0
  98. package/dist/types/src/capabilities/gen/node.d.ts.map +1 -1
  99. package/dist/types/src/capabilities/gen/tauri.d.ts +12 -0
  100. package/dist/types/src/capabilities/gen/tauri.d.ts.map +1 -0
  101. package/dist/types/src/capabilities/gen/workerd.d.ts.map +1 -1
  102. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  103. package/dist/types/src/compiler/index.d.ts +1 -1
  104. package/dist/types/src/compiler/index.d.ts.map +1 -1
  105. package/dist/types/src/components/NotebookStack/NotebookCell.d.ts +3 -3
  106. package/dist/types/src/components/NotebookStack/NotebookCell.d.ts.map +1 -1
  107. package/dist/types/src/components/NotebookStack/NotebookMenu.d.ts.map +1 -1
  108. package/dist/types/src/components/NotebookStack/NotebookStack.d.ts +4 -4
  109. package/dist/types/src/components/NotebookStack/NotebookStack.d.ts.map +1 -1
  110. package/dist/types/src/components/NotebookStack/NotebookStack.stories.d.ts +10 -0
  111. package/dist/types/src/components/NotebookStack/NotebookStack.stories.d.ts.map +1 -1
  112. package/dist/types/src/components/NotebookStack/index.d.ts +2 -2
  113. package/dist/types/src/components/NotebookStack/index.d.ts.map +1 -1
  114. package/dist/types/src/components/ScriptToolbar/ScriptToolbar.d.ts +2 -2
  115. package/dist/types/src/components/ScriptToolbar/ScriptToolbar.d.ts.map +1 -1
  116. package/dist/types/src/components/ScriptToolbar/ScriptToolbar.stories.d.ts +10 -0
  117. package/dist/types/src/components/ScriptToolbar/ScriptToolbar.stories.d.ts.map +1 -1
  118. package/dist/types/src/components/ScriptToolbar/index.d.ts +1 -1
  119. package/dist/types/src/components/ScriptToolbar/index.d.ts.map +1 -1
  120. package/dist/types/src/components/TestPanel/TestPanel.d.ts +2 -2
  121. package/dist/types/src/components/TestPanel/TestPanel.d.ts.map +1 -1
  122. package/dist/types/src/components/TestPanel/index.d.ts +1 -1
  123. package/dist/types/src/components/TestPanel/index.d.ts.map +1 -1
  124. package/dist/types/src/components/TypescriptEditor/TypescriptEditor.d.ts +2 -2
  125. package/dist/types/src/components/TypescriptEditor/TypescriptEditor.d.ts.map +1 -1
  126. package/dist/types/src/components/TypescriptEditor/TypescriptEditor.stories.d.ts +1 -1
  127. package/dist/types/src/components/TypescriptEditor/TypescriptEditor.stories.d.ts.map +1 -1
  128. package/dist/types/src/components/TypescriptEditor/index.d.ts +1 -1
  129. package/dist/types/src/components/TypescriptEditor/index.d.ts.map +1 -1
  130. package/dist/types/src/components/index.d.ts +4 -5
  131. package/dist/types/src/components/index.d.ts.map +1 -1
  132. package/dist/types/src/containers/DeploymentDialog/DeploymentDialog.d.ts +1 -1
  133. package/dist/types/src/containers/DeploymentDialog/DeploymentDialog.d.ts.map +1 -1
  134. package/dist/types/src/containers/DeploymentDialog/DeploymentDialog.stories.d.ts +10 -0
  135. package/dist/types/src/containers/DeploymentDialog/DeploymentDialog.stories.d.ts.map +1 -1
  136. package/dist/types/src/containers/DeploymentDialog/index.d.ts +1 -1
  137. package/dist/types/src/containers/DeploymentDialog/index.d.ts.map +1 -1
  138. package/dist/types/src/containers/NotebookArticle/NotebookArticle.d.ts +1 -1
  139. package/dist/types/src/containers/NotebookArticle/NotebookArticle.d.ts.map +1 -1
  140. package/dist/types/src/containers/NotebookArticle/NotebookArticle.stories.d.ts +1 -1
  141. package/dist/types/src/containers/NotebookArticle/NotebookArticle.stories.d.ts.map +1 -1
  142. package/dist/types/src/containers/NotebookArticle/index.d.ts +1 -1
  143. package/dist/types/src/containers/NotebookArticle/index.d.ts.map +1 -1
  144. package/dist/types/src/containers/ScriptArticle/ScriptArticle.d.ts +1 -1
  145. package/dist/types/src/containers/ScriptArticle/ScriptArticle.d.ts.map +1 -1
  146. package/dist/types/src/containers/ScriptArticle/ScriptArticle.stories.d.ts +10 -0
  147. package/dist/types/src/containers/ScriptArticle/ScriptArticle.stories.d.ts.map +1 -1
  148. package/dist/types/src/containers/ScriptArticle/index.d.ts +1 -1
  149. package/dist/types/src/containers/ScriptArticle/index.d.ts.map +1 -1
  150. package/dist/types/src/containers/ScriptProperties/FunctionBinding.d.ts.map +1 -1
  151. package/dist/types/src/containers/ScriptProperties/FunctionPublishing.d.ts.map +1 -1
  152. package/dist/types/src/containers/ScriptProperties/ScriptProperties.d.ts +1 -1
  153. package/dist/types/src/containers/ScriptProperties/ScriptProperties.d.ts.map +1 -1
  154. package/dist/types/src/containers/ScriptProperties/ScriptProperties.stories.d.ts +10 -0
  155. package/dist/types/src/containers/ScriptProperties/ScriptProperties.stories.d.ts.map +1 -1
  156. package/dist/types/src/containers/ScriptProperties/SkillEditor.d.ts.map +1 -1
  157. package/dist/types/src/containers/ScriptProperties/index.d.ts +1 -1
  158. package/dist/types/src/containers/ScriptProperties/index.d.ts.map +1 -1
  159. package/dist/types/src/containers/ScriptSettings/ScriptSettings.d.ts +2 -2
  160. package/dist/types/src/containers/ScriptSettings/ScriptSettings.d.ts.map +1 -1
  161. package/dist/types/src/containers/ScriptSettings/ScriptSettings.stories.d.ts +11 -1
  162. package/dist/types/src/containers/ScriptSettings/ScriptSettings.stories.d.ts.map +1 -1
  163. package/dist/types/src/containers/ScriptSettings/index.d.ts +1 -1
  164. package/dist/types/src/containers/ScriptSettings/index.d.ts.map +1 -1
  165. package/dist/types/src/containers/TestContainer/index.d.ts +1 -1
  166. package/dist/types/src/containers/TestContainer/index.d.ts.map +1 -1
  167. package/dist/types/src/containers/index.d.ts.map +1 -1
  168. package/dist/types/src/hooks/deploy.d.ts +3 -3
  169. package/dist/types/src/hooks/deploy.d.ts.map +1 -1
  170. package/dist/types/src/hooks/index.d.ts +6 -6
  171. package/dist/types/src/hooks/index.d.ts.map +1 -1
  172. package/dist/types/src/hooks/useCompiler.d.ts +1 -1
  173. package/dist/types/src/hooks/useCompiler.d.ts.map +1 -1
  174. package/dist/types/src/hooks/useCreateAndDeployScriptTemplates.d.ts +1 -1
  175. package/dist/types/src/hooks/useCreateAndDeployScriptTemplates.d.ts.map +1 -1
  176. package/dist/types/src/hooks/useToolbarState.d.ts +2 -2
  177. package/dist/types/src/hooks/useToolbarState.d.ts.map +1 -1
  178. package/dist/types/src/index.d.ts +5 -3
  179. package/dist/types/src/index.d.ts.map +1 -1
  180. package/dist/types/src/notebook/compute-graph.d.ts +3 -3
  181. package/dist/types/src/notebook/compute-graph.d.ts.map +1 -1
  182. package/dist/types/src/notebook/index.d.ts +1 -1
  183. package/dist/types/src/notebook/index.d.ts.map +1 -1
  184. package/dist/types/src/operations/ScriptOperationHandlerSet.d.ts.map +1 -1
  185. package/dist/types/src/operations/index.d.ts +1 -1
  186. package/dist/types/src/operations/index.d.ts.map +1 -1
  187. package/dist/types/src/skills/ScriptSkill.d.ts.map +1 -1
  188. package/dist/types/src/skills/functions/definitions.d.ts +8 -6
  189. package/dist/types/src/skills/functions/definitions.d.ts.map +1 -1
  190. package/dist/types/src/skills/functions/deploy.d.ts +4 -2
  191. package/dist/types/src/skills/functions/deploy.d.ts.map +1 -1
  192. package/dist/types/src/skills/functions/errors.d.ts +33 -0
  193. package/dist/types/src/skills/functions/errors.d.ts.map +1 -0
  194. package/dist/types/src/skills/functions/index.d.ts +1 -1
  195. package/dist/types/src/skills/functions/index.d.ts.map +1 -1
  196. package/dist/types/src/skills/functions/install-function.d.ts +3 -2
  197. package/dist/types/src/skills/functions/install-function.d.ts.map +1 -1
  198. package/dist/types/src/skills/functions/invoke.d.ts +2 -2
  199. package/dist/types/src/skills/functions/invoke.d.ts.map +1 -1
  200. package/dist/types/src/skills/functions/query-deployed-functions.d.ts +2 -2
  201. package/dist/types/src/skills/functions/query-deployed-functions.d.ts.map +1 -1
  202. package/dist/types/src/skills/index.d.ts +1 -1
  203. package/dist/types/src/skills/index.d.ts.map +1 -1
  204. package/dist/types/src/templates/forex-effect.d.ts.map +1 -1
  205. package/dist/types/src/testing/index.d.ts +2 -2
  206. package/dist/types/src/testing/index.d.ts.map +1 -1
  207. package/dist/types/src/translations.d.ts +10 -0
  208. package/dist/types/src/translations.d.ts.map +1 -1
  209. package/dist/types/src/types/Notebook.d.ts.map +1 -1
  210. package/dist/types/src/types/ScriptCapabilities.d.ts +3 -3
  211. package/dist/types/src/types/ScriptCapabilities.d.ts.map +1 -1
  212. package/dist/types/src/types/index.d.ts +5 -5
  213. package/dist/types/src/types/index.d.ts.map +1 -1
  214. package/dist/types/src/util/deploy.d.ts +6 -3
  215. package/dist/types/src/util/deploy.d.ts.map +1 -1
  216. package/dist/types/src/util/functions.d.ts +1 -1
  217. package/dist/types/src/util/functions.d.ts.map +1 -1
  218. package/dist/types/src/util/index.d.ts +2 -2
  219. package/dist/types/src/util/index.d.ts.map +1 -1
  220. package/dist/types/tsconfig.tsbuildinfo +1 -1
  221. package/package.json +106 -96
  222. package/src/ScriptFunction.ts +7 -0
  223. package/src/Templates.ts +7 -0
  224. package/src/capabilities/ScriptSurfaces.tsx +19 -10
  225. package/src/capabilities/app-graph-builder.ts +2 -0
  226. package/src/capabilities/compiler.ts +6 -5
  227. package/src/capabilities/errors.ts +8 -0
  228. package/src/capabilities/gen/browser.ts +62 -0
  229. package/src/capabilities/gen/node.ts +10 -10
  230. package/src/capabilities/gen/tauri.ts +62 -0
  231. package/src/capabilities/gen/workerd.ts +4 -4
  232. package/src/capabilities/index.ts +11 -11
  233. package/src/capabilities/operation-handler.ts +1 -1
  234. package/src/capabilities/react-surface.ts +4 -4
  235. package/src/capabilities/settings.ts +2 -2
  236. package/src/compiler/compiler.browser.test.ts +1 -1
  237. package/src/compiler/index.ts +1 -1
  238. package/src/components/NotebookStack/NotebookCell.tsx +35 -29
  239. package/src/components/NotebookStack/NotebookMenu.tsx +27 -26
  240. package/src/components/NotebookStack/NotebookStack.stories.tsx +3 -3
  241. package/src/components/NotebookStack/NotebookStack.tsx +20 -17
  242. package/src/components/NotebookStack/index.ts +2 -2
  243. package/src/components/ScriptToolbar/ScriptToolbar.stories.tsx +5 -5
  244. package/src/components/ScriptToolbar/ScriptToolbar.tsx +14 -15
  245. package/src/components/ScriptToolbar/index.ts +1 -1
  246. package/src/components/TestPanel/TestPanel.tsx +29 -23
  247. package/src/components/TestPanel/index.ts +1 -1
  248. package/src/components/TypescriptEditor/TypescriptEditor.stories.tsx +10 -8
  249. package/src/components/TypescriptEditor/TypescriptEditor.tsx +11 -7
  250. package/src/components/TypescriptEditor/index.ts +1 -1
  251. package/src/components/index.ts +4 -5
  252. package/src/containers/DeploymentDialog/DeploymentDialog.stories.tsx +5 -7
  253. package/src/containers/DeploymentDialog/DeploymentDialog.tsx +18 -15
  254. package/src/containers/DeploymentDialog/index.ts +1 -1
  255. package/src/containers/NotebookArticle/NotebookArticle.stories.tsx +6 -6
  256. package/src/containers/NotebookArticle/NotebookArticle.tsx +25 -21
  257. package/src/containers/NotebookArticle/index.ts +1 -1
  258. package/src/containers/ScriptArticle/ScriptArticle.stories.tsx +3 -3
  259. package/src/containers/ScriptArticle/ScriptArticle.tsx +13 -11
  260. package/src/containers/ScriptArticle/index.ts +1 -1
  261. package/src/containers/ScriptProperties/FunctionBinding.tsx +18 -18
  262. package/src/containers/ScriptProperties/FunctionPublishing.tsx +22 -22
  263. package/src/containers/ScriptProperties/ScriptProperties.stories.tsx +3 -3
  264. package/src/containers/ScriptProperties/ScriptProperties.tsx +10 -10
  265. package/src/containers/ScriptProperties/SkillEditor.tsx +16 -14
  266. package/src/containers/ScriptProperties/index.ts +1 -1
  267. package/src/containers/ScriptSettings/ScriptSettings.stories.tsx +1 -1
  268. package/src/containers/ScriptSettings/ScriptSettings.tsx +16 -11
  269. package/src/containers/ScriptSettings/index.ts +1 -1
  270. package/src/containers/TestContainer/TestContainer.tsx +4 -4
  271. package/src/containers/TestContainer/index.ts +1 -1
  272. package/src/containers/index.ts +6 -6
  273. package/src/e2e/ai.test.ts +1 -1
  274. package/src/hooks/deploy.ts +12 -5
  275. package/src/hooks/index.ts +6 -6
  276. package/src/hooks/template.ts +1 -1
  277. package/src/hooks/useCompiler.ts +8 -7
  278. package/src/hooks/useCreateAndDeployScriptTemplates.ts +10 -5
  279. package/src/hooks/useToolbarState.ts +4 -4
  280. package/src/index.ts +5 -3
  281. package/src/meta.ts +1 -1
  282. package/src/notebook/compute-graph.test.ts +2 -2
  283. package/src/notebook/compute-graph.ts +4 -4
  284. package/src/notebook/index.ts +1 -1
  285. package/src/notebook/vfs-parser.test.ts +1 -1
  286. package/src/notebook/vfs-parser.ts +1 -1
  287. package/src/operations/ScriptOperationHandlerSet.ts +3 -1
  288. package/src/operations/create-script.ts +1 -1
  289. package/src/operations/index.ts +1 -1
  290. package/src/plugin.test.ts +2 -2
  291. package/src/skills/ScriptSkill.ts +3 -1
  292. package/src/skills/functions/create.ts +4 -4
  293. package/src/skills/functions/definitions.ts +8 -6
  294. package/src/skills/functions/delete.ts +1 -1
  295. package/src/skills/functions/deploy.ts +13 -9
  296. package/src/skills/functions/errors.ts +8 -0
  297. package/src/skills/functions/index.ts +11 -11
  298. package/src/skills/functions/inspect-invocations.ts +1 -1
  299. package/src/skills/functions/install-function.ts +11 -14
  300. package/src/skills/functions/invoke.ts +5 -5
  301. package/src/skills/functions/query-deployed-functions.ts +3 -4
  302. package/src/skills/functions/read.ts +3 -2
  303. package/src/skills/functions/update.ts +3 -2
  304. package/src/skills/index.ts +1 -1
  305. package/src/templates/anthropic.ts +2 -2
  306. package/src/templates/commentary.ts +1 -1
  307. package/src/templates/forex-effect.ts +7 -4
  308. package/src/testing/index.ts +2 -2
  309. package/src/translations.ts +4 -2
  310. package/src/types/Notebook.ts +6 -4
  311. package/src/types/ScriptCapabilities.ts +3 -3
  312. package/src/types/ScriptOperation.ts +1 -1
  313. package/src/types/index.ts +5 -5
  314. package/src/util/deploy.ts +10 -7
  315. package/src/util/functions.ts +24 -15
  316. package/src/util/index.ts +2 -2
  317. package/dist/lib/chunk-compiler2.mjs +0 -76
  318. package/dist/lib/chunk-compiler2.mjs.map +0 -1
  319. package/dist/lib/chunk-util.mjs +0 -146
  320. package/dist/lib/chunk-util.mjs.map +0 -1
  321. package/dist/types/src/components/QueryEditor/QueryEditor.d.ts +0 -5
  322. package/dist/types/src/components/QueryEditor/QueryEditor.d.ts.map +0 -1
  323. package/dist/types/src/components/QueryEditor/QueryEditor.stories.d.ts +0 -14
  324. package/dist/types/src/components/QueryEditor/QueryEditor.stories.d.ts.map +0 -1
  325. package/dist/types/src/components/QueryEditor/index.d.ts +0 -2
  326. package/dist/types/src/components/QueryEditor/index.d.ts.map +0 -1
  327. package/src/components/QueryEditor/QueryEditor.stories.tsx +0 -91
  328. package/src/components/QueryEditor/QueryEditor.tsx +0 -50
  329. package/src/components/QueryEditor/index.ts +0 -5
@@ -1,249 +1,69 @@
1
- import { trim } from "@dxos/util";
2
- import * as Operation from "@dxos/compute/Operation";
3
- import * as OperationHandlerSet from "@dxos/compute/OperationHandlerSet";
4
- import * as Schema from "effect/Schema";
5
- import { ClientService } from "@dxos/client";
6
- import { DXN, Database, Ref } from "@dxos/echo";
7
- //#region src/skills/functions/definitions.ts
8
- var FunctionRef = Ref.Ref(Operation.PersistentOperation).annotate({ description: "The ID of the function." });
9
- var FunctionId = Schema.String.annotate({ description: "The ID of the function. Can be passed as the function parameter to other operations." });
10
- var FUNCTION_FORMAT = trim`
11
- IMPORTANT: Every function MUST follow this exact pattern — define an Operation, then export default the handler:
12
-
13
- \`\`\`typescript
14
- import * as Effect from 'effect/Effect';
15
- import * as Schema from 'effect/Schema';
16
-
17
- import { Operation } from '@dxos/compute';
18
-
19
- const MyFunction = Operation.make({
20
- meta: {
21
- key: DXN.make('com.example.operation.example.myFunction'),
22
- name: 'My Function',
23
- },
24
- input: Schema.Struct({
25
- city: Schema.String.annotate({ description: 'City name' }),
26
- }),
27
- output: Schema.Any,
28
- });
29
-
30
- export default MyFunction.pipe(
31
- Operation.withHandler(
32
- Effect.fn(function* ({ city }) {
33
- const res = yield* Effect.promise(() =>
34
- fetch(\`https://wttr.in/\${city}?format=j1\`)
35
- );
36
- const data = yield* Effect.promise(() => res.json());
37
- return data;
38
- }),
39
- ),
40
- );
41
- \`\`\`
42
-
43
- Key rules:
44
- - The file MUST have a single \`export default\` of Operation.pipe(Operation.withHandler(...)).
45
- - Use \`Effect.fn(function* (...) { ... })\` for the handler body.
46
- - Wrap async calls with \`yield* Effect.promise(() => ...)\`.
47
- - Do NOT use top-level await; do NOT export named functions; do NOT use module.exports.
48
- `;
49
- var AVAILABLE_PACKAGES = trim`
50
- Scripts run in an Edge runtime (Cloudflare Workers) with the following pre-bundled packages:
51
-
52
- DXOS SDK:
53
- - \`@dxos/echo\` — Reactive local-first database: query, filter, and mutate ECHO objects in spaces.
54
- - \`@dxos/functions\` — Edge function framework: triggers, queues, and function definitions.
55
- - \`@dxos/ai\` — AI/LLM integration via AiService (access models like Claude, GPT).
56
- - \`@dxos/schema\` — Schema utilities and built-in DXOS types.
57
- - \`@dxos/types\` — DXOS type definitions.
58
- - \`@dxos/operation\` — Define and handle typed operations with input/output schemas.
59
- - \`@dxos/util\` — General utility functions.
60
- - \`@dxos/log\` — Structured logging.
61
-
62
- Effect-TS (functional programming toolkit):
63
- - \`effect\` — Core effect system with sub-modules: Effect, Schema, Stream, Schedule, Array, Record, Option, Either, Match, etc.
64
- - \`@effect/platform\` — HTTP client (\`HttpClient\`), platform abstractions for making typed API requests.
65
-
66
- Data format parsing & querying:
67
- - \`jsonata\` — Powerful query and transformation expressions for JSON data (filter, sort, group, aggregate, reshape).
68
- - \`yaml\` — Parse and stringify YAML documents.
69
- - \`fast-xml-parser\` — Fast XML parser and builder; convert between XML and JSON.
70
- - \`papaparse\` — CSV parsing and serialization; stream large files, auto-detect delimiters.
71
-
72
- Text & markup processing:
73
- - \`turndown\` — HTML to Markdown converter (useful for feeding web content to LLMs).
74
-
75
- HTML/DOM parsing:
76
- - \`linkedom\` — Lightweight DOM parser for worker environments; parse and query HTML documents.
77
-
78
- Data processing & utilities:
79
- - \`date-fns\` — Comprehensive date utility library: parsing, formatting, comparison, arithmetic, time zones.
80
-
81
- Other:
82
- - \`@automerge/automerge\` — CRDT library for conflict-free collaborative data structures.
83
- - \`chess.js\` — Chess game logic, move generation, and validation.
84
- `;
85
- var Create = Operation.make({
86
- meta: {
87
- key: DXN.make("org.dxos.operation.script.createFunction"),
88
- name: "Create",
89
- description: `Creates a new function with TypeScript source code and adds it to the space. ${FUNCTION_FORMAT} ${AVAILABLE_PACKAGES}`,
90
- icon: "ph--code--regular"
91
- },
92
- input: Schema.Struct({
93
- name: Schema.String.annotate({ description: "Name of the function." }),
94
- source: Schema.optional(Schema.String).annotate({ description: "TypeScript source code for the function." }),
95
- templateId: Schema.optional(Schema.String).annotate({ description: "ID of a template to use as the initial source." })
96
- }),
97
- output: Schema.Struct({ function: FunctionId }),
98
- services: [Database.Service]
99
- });
100
- var Read = Operation.make({
101
- meta: {
102
- key: DXN.make("org.dxos.operation.script.read"),
103
- name: "Read",
104
- description: "Reads the source code and metadata of a function.",
105
- icon: "ph--file-text--regular"
106
- },
107
- input: Schema.Struct({ function: FunctionRef }),
108
- output: Schema.Struct({
109
- name: Schema.optional(Schema.String),
110
- source: Schema.String,
111
- description: Schema.optional(Schema.String)
112
- }),
113
- services: [Database.Service]
114
- });
115
- var Edit = Schema.Struct({
116
- oldString: Schema.String.annotate({ description: "The text to find in the source." }),
117
- newString: Schema.String.annotate({ description: "The text to replace it with." }),
118
- replaceAll: Schema.optional(Schema.Boolean).annotate({ description: "If true, replaces all occurrences. Defaults to false (first occurrence only)." })
119
- });
120
- var Update = Operation.make({
121
- meta: {
122
- key: DXN.make("org.dxos.operation.script.update"),
123
- name: "Update",
124
- description: `Updates the source code or metadata of a function. ${FUNCTION_FORMAT}`,
125
- icon: "ph--pencil--regular"
126
- },
127
- input: Schema.Struct({
128
- function: FunctionRef,
129
- name: Schema.optional(Schema.String).annotate({ description: "New name for the function." }),
130
- description: Schema.optional(Schema.String).annotate({ description: "New description for the function." }),
131
- edits: Schema.optional(Schema.Array(Edit)).annotate({ description: "Edits to apply to the source. Each edit finds oldString and replaces it with newString." })
132
- }),
133
- output: Schema.Struct({ function: FunctionId }),
134
- services: [Database.Service]
135
- });
136
- var Delete = Operation.make({
137
- meta: {
138
- key: DXN.make("org.dxos.operation.script.delete"),
139
- name: "Delete",
140
- description: "Deletes a function and its source from the space.",
141
- icon: "ph--trash--regular"
142
- },
143
- input: Schema.Struct({ function: FunctionRef }),
144
- output: Schema.Void,
145
- services: [Database.Service]
146
- });
147
- var Deploy = Operation.make({
148
- meta: {
149
- key: DXN.make("org.dxos.operation.script.deploy"),
150
- name: "Deploy",
151
- 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.`,
152
- icon: "ph--rocket-launch--regular"
153
- },
154
- input: Schema.Struct({ function: FunctionRef }),
155
- output: Schema.Struct({
156
- function: FunctionId,
157
- functionUrl: Schema.optional(Schema.String).annotate({ description: "The URL of the deployed function." })
158
- }),
159
- services: [Database.Service, ClientService]
160
- });
161
- var Invoke = Operation.make({
162
- meta: {
163
- key: DXN.make("org.dxos.operation.script.invoke"),
164
- name: "Invoke",
165
- description: "Invokes a deployed Edge function with the given payload.",
166
- icon: "ph--play--regular"
167
- },
168
- input: Schema.Struct({
169
- function: FunctionRef,
170
- payload: Schema.optional(Schema.Unknown).annotate({ description: "The input payload to pass to the function." })
171
- }),
172
- output: Schema.Struct({ response: Schema.Unknown.annotate({ description: "The response from the function." }) }),
173
- services: [Database.Service, ClientService]
174
- });
175
- var InvocationSpanSchema = Schema.Struct({
176
- id: Schema.String.annotate({ description: "The invocation ID." }),
177
- timestamp: Schema.Number.annotate({ description: "Start time of the invocation (epoch ms)." }),
178
- duration: Schema.Number.annotate({ description: "Duration in milliseconds." }),
179
- outcome: Schema.String.annotate({ description: "Invocation outcome: success, failure, or pending." }),
180
- input: Schema.ObjectKeyword.annotate({ description: "The input payload passed to the function." }),
181
- error: Schema.optional(Schema.ObjectKeyword).annotate({ description: "Error details if the invocation failed." })
182
- });
183
- var InspectInvocations = Operation.make({
184
- meta: {
185
- key: DXN.make("org.dxos.operation.script.inspectInvocations"),
186
- name: "InspectInvocations",
187
- description: "Queries the invocation trace feed for a function, returning its invocation history.",
188
- icon: "ph--magnifying-glass--regular"
189
- },
190
- input: Schema.Struct({
191
- function: FunctionRef,
192
- limit: Schema.optional(Schema.Number).annotate({ description: "Maximum number of invocations to return. Defaults to 20." })
193
- }),
194
- output: Schema.Struct({
195
- invocations: Schema.Array(InvocationSpanSchema).annotate({ description: "List of invocation spans, most recent first." }),
196
- total: Schema.Number.annotate({ description: "Total number of invocations found." })
197
- }),
198
- services: [Database.Service]
199
- });
200
- var DeployedFunctionSchema = Schema.Struct({
201
- key: Schema.optional(Schema.String).annotate({ description: "Unique key identifying the function. Pass to InstallFunction to install it." }),
202
- name: Schema.String.annotate({ description: "Display name of the function." }),
203
- version: Schema.String.annotate({ description: "Semantic version of the deployed function." }),
204
- description: Schema.optional(Schema.String).annotate({ description: "Description of what the function does." }),
205
- updated: Schema.optional(Schema.String).annotate({ description: "ISO timestamp of the last deployment." })
206
- });
207
- var QueryDeployedFunctions = Operation.make({
208
- meta: {
209
- key: DXN.make("org.dxos.operation.script.queryDeployed"),
210
- name: "QueryDeployedFunctions",
211
- description: "Lists all functions deployed to the EDGE runtime. Use InstallFunction to add one to the space.",
212
- icon: "ph--list--regular"
213
- },
214
- input: Schema.Void,
215
- output: Schema.Struct({ functions: Schema.Array(DeployedFunctionSchema).annotate({ description: "List of deployed functions." }) }),
216
- services: [ClientService]
217
- });
218
- var InstallFunction = Operation.make({
219
- meta: {
220
- key: DXN.make("org.dxos.operation.script.install"),
221
- name: "InstallFunction",
222
- description: "Installs a deployed EDGE function into the current space by key. The returned function ID can be passed directly to Invoke.",
223
- icon: "ph--download--regular"
224
- },
225
- input: Schema.Struct({ key: Schema.String.annotate({ description: "The unique key of the deployed function to install (from QueryDeployedFunctions)." }) }),
226
- output: Schema.Struct({
227
- function: FunctionId,
228
- name: Schema.String.annotate({ description: "Name of the installed function." }),
229
- version: Schema.String.annotate({ description: "Version of the installed function." })
230
- }),
231
- services: [ClientService]
232
- });
233
- //#endregion
234
- //#region src/skills/functions/index.ts
235
- var ScriptHandlers = OperationHandlerSet.lazy([
236
- Create.pipe(Operation.lazyHandler(() => import("./chunk-create.mjs"))),
237
- Read.pipe(Operation.lazyHandler(() => import("./chunk-read.mjs"))),
238
- Update.pipe(Operation.lazyHandler(() => import("./chunk-update.mjs"))),
239
- Delete.pipe(Operation.lazyHandler(() => import("./chunk-delete.mjs"))),
240
- Deploy.pipe(Operation.lazyHandler(() => import("./chunk-deploy.mjs"))),
241
- Invoke.pipe(Operation.lazyHandler(() => import("./chunk-invoke.mjs"))),
242
- InspectInvocations.pipe(Operation.lazyHandler(() => import("./chunk-inspect-invocations.mjs"))),
243
- QueryDeployedFunctions.pipe(Operation.lazyHandler(() => import("./chunk-query-deployed-functions.mjs"))),
244
- InstallFunction.pipe(Operation.lazyHandler(() => import("./chunk-install-function.mjs")))
245
- ]);
1
+ import { getInvocationUrl, getUserFunctionIdInMetadata } from "@dxos/compute-runtime";
2
+ import { Obj } from "@dxos/echo";
3
+ import { log } from "@dxos/log";
4
+ import { bufWkt, createBuf, fromDate, fromPublicKey } from "@dxos/protocols/buf";
5
+ import { ClaimSchema, CredentialSchema, ServiceAccessSchema } from "@dxos/protocols/buf/dxos/halo/credentials_pb";
6
+ //#region src/util/functions.ts
7
+ var __dxlog_file = "/__w/dxos/dxos/packages/plugins/plugin-script/src/util/functions.ts";
8
+ /**
9
+ * Get the function URL for a given script and client configuration
10
+ */
11
+ var getFunctionUrl = ({ script, fn, edgeUrl }) => {
12
+ const spaceId = Obj.getDatabase(script)?.spaceId;
13
+ const existingFunctionId = fn && getUserFunctionIdInMetadata(Obj.getMeta(fn));
14
+ if (!existingFunctionId) return;
15
+ return getInvocationUrl(existingFunctionId, edgeUrl, { spaceId });
16
+ };
17
+ var updateFunctionMetadata = (script, storedFunction, meta, functionId) => {
18
+ Obj.update(storedFunction, (storedFunction) => {
19
+ if (script.description !== void 0 && script.description.trim() !== "") storedFunction.description = script.description;
20
+ else if (meta.description) storedFunction.description = meta.description;
21
+ else log.verbose("no description in function metadata", { functionId }, {
22
+ "~LogMeta": "~LogMeta",
23
+ F: __dxlog_file,
24
+ L: 56,
25
+ S: void 0
26
+ });
27
+ if (meta.inputSchema) storedFunction.inputSchema = meta.inputSchema;
28
+ else log.verbose("no input schema in function metadata", { functionId }, {
29
+ "~LogMeta": "~LogMeta",
30
+ F: __dxlog_file,
31
+ L: 62,
32
+ S: void 0
33
+ });
34
+ if (meta.outputSchema) storedFunction.outputSchema = meta.outputSchema;
35
+ else log.verbose("no output schema in function metadata", { functionId }, {
36
+ "~LogMeta": "~LogMeta",
37
+ F: __dxlog_file,
38
+ L: 68,
39
+ S: void 0
40
+ });
41
+ if (meta.key) Obj.getMeta(storedFunction).key = meta.key;
42
+ else log.verbose("no key in function metadata", { functionId }, {
43
+ "~LogMeta": "~LogMeta",
44
+ F: __dxlog_file,
45
+ L: 74,
46
+ S: void 0
47
+ });
48
+ });
49
+ };
50
+ var getAccessCredential = (identityKey) => {
51
+ const key = fromPublicKey(identityKey);
52
+ return createBuf(CredentialSchema, {
53
+ issuer: key,
54
+ issuanceDate: fromDate(/* @__PURE__ */ new Date()),
55
+ subject: createBuf(ClaimSchema, {
56
+ id: key,
57
+ assertion: bufWkt.anyPack(ServiceAccessSchema, createBuf(ServiceAccessSchema, {
58
+ serverName: "hub.dxos.network",
59
+ serverKey: key,
60
+ identityKey: key,
61
+ capabilities: ["composer:beta"]
62
+ }))
63
+ })
64
+ });
65
+ };
246
66
  //#endregion
247
- export { InspectInvocations as a, QueryDeployedFunctions as c, Deploy as i, Read as l, Create as n, InstallFunction as o, Delete as r, Invoke as s, ScriptHandlers as t, Update as u };
67
+ export { getFunctionUrl as n, updateFunctionMetadata as r, getAccessCredential as t };
248
68
 
249
69
  //# sourceMappingURL=chunk-functions.mjs.map
@@ -1 +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 * as Operation from '@dxos/compute/Operation';\nimport { Database, DXN, Ref } from '@dxos/echo';\nimport { trim } from '@dxos/util';\n\nconst FunctionRef = Ref.Ref(Operation.PersistentOperation).annotate({\n description: 'The ID of the function.',\n});\n\nconst FunctionId = Schema.String.annotate({\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('com.example.operation.example.myFunction'),\n name: 'My Function',\n },\n input: Schema.Struct({\n city: Schema.String.annotate({ 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.operation.script.createFunction'),\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.annotate({\n description: 'Name of the function.',\n }),\n source: Schema.optional(Schema.String).annotate({\n description: 'TypeScript source code for the function.',\n }),\n templateId: Schema.optional(Schema.String).annotate({\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.operation.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.annotate({\n description: 'The text to find in the source.',\n }),\n newString: Schema.String.annotate({\n description: 'The text to replace it with.',\n }),\n replaceAll: Schema.optional(Schema.Boolean).annotate({\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.operation.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).annotate({\n description: 'New name for the function.',\n }),\n description: Schema.optional(Schema.String).annotate({\n description: 'New description for the function.',\n }),\n edits: Schema.optional(Schema.Array(Edit)).annotate({\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.operation.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.operation.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).annotate({\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.operation.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).annotate({\n description: 'The input payload to pass to the function.',\n }),\n }),\n output: Schema.Struct({\n response: Schema.Unknown.annotate({\n description: 'The response from the function.',\n }),\n }),\n services: [Database.Service, ClientService],\n});\n\nconst InvocationSpanSchema = Schema.Struct({\n id: Schema.String.annotate({\n description: 'The invocation ID.',\n }),\n timestamp: Schema.Number.annotate({\n description: 'Start time of the invocation (epoch ms).',\n }),\n duration: Schema.Number.annotate({\n description: 'Duration in milliseconds.',\n }),\n outcome: Schema.String.annotate({\n description: 'Invocation outcome: success, failure, or pending.',\n }),\n input: Schema.ObjectKeyword.annotate({\n description: 'The input payload passed to the function.',\n }),\n error: Schema.optional(Schema.ObjectKeyword).annotate({\n description: 'Error details if the invocation failed.',\n }),\n});\n\nexport const InspectInvocations = Operation.make({\n meta: {\n key: DXN.make('org.dxos.operation.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).annotate({\n description: 'Maximum number of invocations to return. Defaults to 20.',\n }),\n }),\n output: Schema.Struct({\n invocations: Schema.Array(InvocationSpanSchema).annotate({\n description: 'List of invocation spans, most recent first.',\n }),\n total: Schema.Number.annotate({\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).annotate({\n description: 'Unique key identifying the function. Pass to InstallFunction to install it.',\n }),\n name: Schema.String.annotate({\n description: 'Display name of the function.',\n }),\n version: Schema.String.annotate({\n description: 'Semantic version of the deployed function.',\n }),\n description: Schema.optional(Schema.String).annotate({\n description: 'Description of what the function does.',\n }),\n updated: Schema.optional(Schema.String).annotate({\n description: 'ISO timestamp of the last deployment.',\n }),\n});\n\nexport const QueryDeployedFunctions = Operation.make({\n meta: {\n key: DXN.make('org.dxos.operation.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).annotate({\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.operation.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.annotate({\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.annotate({\n description: 'Name of the installed function.',\n }),\n version: Schema.String.annotate({\n description: 'Version of the installed function.',\n }),\n }),\n services: [ClientService],\n});\n","//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Operation from '@dxos/compute/Operation';\nimport * as OperationHandlerSet from '@dxos/compute/OperationHandlerSet';\n\nimport {\n Create,\n Delete,\n Deploy,\n InspectInvocations,\n InstallFunction,\n Invoke,\n QueryDeployedFunctions,\n Read,\n Update,\n} from './definitions';\n\nexport * from './definitions';\n\nexport const ScriptHandlers = OperationHandlerSet.lazy([\n Create.pipe(Operation.lazyHandler(() => import('./create'))),\n Read.pipe(Operation.lazyHandler(() => import('./read'))),\n Update.pipe(Operation.lazyHandler(() => import('./update'))),\n Delete.pipe(Operation.lazyHandler(() => import('./delete'))),\n Deploy.pipe(Operation.lazyHandler(() => import('./deploy'))),\n Invoke.pipe(Operation.lazyHandler(() => import('./invoke'))),\n InspectInvocations.pipe(Operation.lazyHandler(() => import('./inspect-invocations'))),\n QueryDeployedFunctions.pipe(Operation.lazyHandler(() => import('./query-deployed-functions'))),\n InstallFunction.pipe(Operation.lazyHandler(() => import('./install-function'))),\n]);\n"],"mappings":"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"}
1
+ {"version":3,"file":"chunk-functions.mjs","names":[],"sources":["../../src/util/functions.ts"],"sourcesContent":["//\n// Copyright 2025 DXOS.org\n//\n\nimport { getUserFunctionIdInMetadata } from '@dxos/compute-runtime';\nimport { getInvocationUrl } from '@dxos/compute-runtime';\nimport type * as Operation from '@dxos/compute/Operation';\nimport * as Script from '@dxos/compute/Script';\nimport { Obj } from '@dxos/echo';\nimport { type PublicKey } from '@dxos/keys';\nimport { log } from '@dxos/log';\nimport { bufWkt, createBuf, fromDate, fromPublicKey } from '@dxos/protocols/buf';\nimport {\n ClaimSchema,\n type Credential,\n CredentialSchema,\n ServiceAccessSchema,\n} from '@dxos/protocols/buf/dxos/halo/credentials_pb';\n\n/**\n * Get the function URL for a given script and client configuration\n */\nexport const getFunctionUrl = ({\n script,\n fn,\n edgeUrl,\n}: {\n script: Script.Script;\n fn: any;\n edgeUrl: string;\n}): string | undefined => {\n const spaceId = Obj.getDatabase(script)?.spaceId;\n const existingFunctionId = fn && getUserFunctionIdInMetadata(Obj.getMeta(fn));\n\n if (!existingFunctionId) {\n return undefined;\n }\n\n return getInvocationUrl(existingFunctionId, edgeUrl, {\n spaceId,\n });\n};\n\nexport const updateFunctionMetadata = (\n script: Script.Script,\n storedFunction: Operation.PersistentOperation,\n meta: any,\n functionId: string,\n) => {\n Obj.update(storedFunction, (storedFunction) => {\n if (script.description !== undefined && script.description.trim() !== '') {\n storedFunction.description = script.description;\n } else if (meta.description) {\n storedFunction.description = meta.description;\n } else {\n log.verbose('no description in function metadata', { functionId });\n }\n\n if (meta.inputSchema) {\n storedFunction.inputSchema = meta.inputSchema;\n } else {\n log.verbose('no input schema in function metadata', { functionId });\n }\n\n if (meta.outputSchema) {\n storedFunction.outputSchema = meta.outputSchema;\n } else {\n log.verbose('no output schema in function metadata', { functionId });\n }\n\n if (meta.key) {\n Obj.getMeta(storedFunction).key = meta.key;\n } else {\n log.verbose('no key in function metadata', { functionId });\n }\n });\n};\n\nexport const getAccessCredential = (identityKey: PublicKey): Credential => {\n const key = fromPublicKey(identityKey);\n return createBuf(CredentialSchema, {\n issuer: key,\n issuanceDate: fromDate(new Date()),\n subject: createBuf(ClaimSchema, {\n id: key,\n assertion: bufWkt.anyPack(\n ServiceAccessSchema,\n createBuf(ServiceAccessSchema, {\n serverName: 'hub.dxos.network',\n serverKey: key,\n identityKey: key,\n capabilities: ['composer:beta'],\n }),\n ),\n }),\n });\n};\n"],"mappings":";;;;;;;;;;AAsBA,IAAa,kBAAkB,EAC7B,QACA,IACA,cAKwB;CACxB,MAAM,UAAU,IAAI,YAAY,MAAM,CAAC,EAAE;CACzC,MAAM,qBAAqB,MAAM,4BAA4B,IAAI,QAAQ,EAAE,CAAC;CAE5E,IAAI,CAAC,oBACH;CAGF,OAAO,iBAAiB,oBAAoB,SAAS,EACnD,QACF,CAAC;AACH;AAEA,IAAa,0BACX,QACA,gBACA,MACA,eACG;CACH,IAAI,OAAO,iBAAiB,mBAAmB;EAC7C,IAAI,OAAO,gBAAgB,KAAA,KAAa,OAAO,YAAY,KAAK,MAAM,IACpE,eAAe,cAAc,OAAO;OAC/B,IAAI,KAAK,aACd,eAAe,cAAc,KAAK;OAElC,IAAI,QAAQ,uCAAuC,EAAE,WAAW,GAAA;GAAA,YAAA;GAAA,GAAA;GAAA,GAAA;GAAA,GAAA,KAAA;EAAA,CAAC;EAGnE,IAAI,KAAK,aACP,eAAe,cAAc,KAAK;OAElC,IAAI,QAAQ,wCAAwC,EAAE,WAAW,GAAA;GAAA,YAAA;GAAA,GAAA;GAAA,GAAA;GAAA,GAAA,KAAA;EAAA,CAAC;EAGpE,IAAI,KAAK,cACP,eAAe,eAAe,KAAK;OAEnC,IAAI,QAAQ,yCAAyC,EAAE,WAAW,GAAA;GAAA,YAAA;GAAA,GAAA;GAAA,GAAA;GAAA,GAAA,KAAA;EAAA,CAAC;EAGrE,IAAI,KAAK,KACP,IAAI,QAAQ,cAAc,CAAC,CAAC,MAAM,KAAK;OAEvC,IAAI,QAAQ,+BAA+B,EAAE,WAAW,GAAA;GAAA,YAAA;GAAA,GAAA;GAAA,GAAA;GAAA,GAAA,KAAA;EAAA,CAAC;CAE7D,CAAC;AACH;AAEA,IAAa,uBAAuB,gBAAuC;CACzE,MAAM,MAAM,cAAc,WAAW;CACrC,OAAO,UAAU,kBAAkB;EACjC,QAAQ;EACR,cAAc,yBAAS,IAAI,KAAK,CAAC;EACjC,SAAS,UAAU,aAAa;GAC9B,IAAI;GACJ,WAAW,OAAO,QAChB,qBACA,UAAU,qBAAqB;IAC7B,YAAY;IACZ,WAAW;IACX,aAAa;IACb,cAAc,CAAC,eAAe;GAChC,CAAC,CACH;EACF,CAAC;CACH,CAAC;AACH"}
@@ -1,7 +1,7 @@
1
- import { a as InspectInvocations } from "./chunk-functions.mjs";
2
- import * as Operation from "@dxos/compute/Operation";
3
- import { Database, Feed, Filter, Obj, Query } from "@dxos/echo";
1
+ import { i as InspectInvocations } from "./chunk-definitions.mjs";
4
2
  import { InvocationTraceEndEvent, InvocationTraceStartEvent, createInvocationSpans, getUserFunctionIdInMetadata } from "@dxos/compute-runtime";
3
+ import { Database, Feed, Filter, Obj, Query } from "@dxos/echo";
4
+ import * as Operation from "@dxos/compute/Operation";
5
5
  import * as Effect from "effect/Effect";
6
6
  import { SpaceProperties } from "@dxos/client-protocol";
7
7
  //#region src/skills/functions/inspect-invocations.ts
@@ -1 +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 { getUserFunctionIdInMetadata } from '@dxos/compute-runtime';\nimport { InvocationTraceEndEvent, InvocationTraceStartEvent, createInvocationSpans } from '@dxos/compute-runtime';\nimport * as Operation from '@dxos/compute/Operation';\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"}
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 { getUserFunctionIdInMetadata } from '@dxos/compute-runtime';\nimport { InvocationTraceEndEvent, InvocationTraceStartEvent, createInvocationSpans } from '@dxos/compute-runtime';\nimport * as Operation from '@dxos/compute/Operation';\nimport { Database, Feed, Filter, Obj, Query } from '@dxos/echo';\n\nimport { InspectInvocations } from './definitions.ts';\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"}
@@ -1,32 +1,32 @@
1
- import { o as InstallFunction } from "./chunk-functions.mjs";
1
+ import { a as InstallFunction } from "./chunk-definitions.mjs";
2
+ import { t as FunctionError } from "./chunk-errors.mjs";
3
+ import { Database, Filter, Hypergraph, Obj } from "@dxos/echo";
2
4
  import * as Operation from "@dxos/compute/Operation";
3
- import { ClientService } from "@dxos/client";
4
- import { Filter, Obj } from "@dxos/echo";
5
+ import { EdgeHttpClientService } from "@dxos/edge-client";
5
6
  import { Context } from "@dxos/context";
6
7
  import { FunctionsServiceClient } from "@dxos/edge-compute";
7
8
  import * as Effect from "effect/Effect";
8
9
  //#region src/skills/functions/install-function.ts
9
10
  var __dxlog_file = "/__w/dxos/dxos/packages/plugins/plugin-script/src/skills/functions/install-function.ts";
10
11
  var install_function_default = InstallFunction.pipe(Operation.withHandler(Effect.fn(function* ({ key }) {
11
- const client = yield* ClientService;
12
- const functionsService = FunctionsServiceClient.fromClient(client);
12
+ const functionsService = new FunctionsServiceClient(yield* EdgeHttpClientService);
13
13
  const fn = (yield* Effect.promise(() => functionsService.query(Context.default(void 0, {
14
14
  "~LogMeta": "~LogMeta",
15
15
  F: __dxlog_file,
16
16
  L: 20
17
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());
18
+ if (!fn) return yield* Effect.fail(new FunctionError({ message: `No deployed function found with key: ${key}` }));
19
+ const { db } = yield* Database.Service;
20
+ const { graph } = yield* Hypergraph.Service;
21
+ graph.registry.add([Operation.PersistentOperation]);
22
+ const existingFunctions = yield* Effect.promise(() => db.query(Filter.and(Filter.type(Operation.PersistentOperation), Filter.key(key))).run());
23
23
  let installed;
24
24
  if (existingFunctions.length > 0) {
25
25
  installed = existingFunctions[0];
26
26
  for (const existing of existingFunctions) Operation.setFrom(existing, fn);
27
27
  } else {
28
28
  installed = Obj.clone(fn);
29
- space.db.add(installed);
29
+ db.add(installed);
30
30
  }
31
31
  return {
32
32
  function: Obj.getURI(installed),
@@ -1 +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 * as Operation from '@dxos/compute/Operation';\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"}
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 * as Operation from '@dxos/compute/Operation';\nimport { Context } from '@dxos/context';\nimport { Database, Filter, Hypergraph, Obj } from '@dxos/echo';\nimport { EdgeHttpClientService } from '@dxos/edge-client';\nimport { FunctionsServiceClient } from '@dxos/edge-compute';\n\nimport { InstallFunction } from './definitions.ts';\nimport { FunctionError } from './errors.ts';\n\nexport default InstallFunction.pipe(\n Operation.withHandler(\n Effect.fn(function* ({ key }) {\n const functionsService = new FunctionsServiceClient(yield* EdgeHttpClientService);\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 FunctionError({ message: `No deployed function found with key: ${key}` }));\n }\n\n const { db } = yield* Database.Service;\n const { graph } = yield* Hypergraph.Service;\n graph.registry.add([Operation.PersistentOperation]);\n\n const existingFunctions = yield* Effect.promise(() =>\n 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 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":";;;;;;;;;;AAeA,IAAA,2BAAe,gBAAgB,KAC7B,UAAU,YACR,OAAO,GAAG,WAAW,EAAE,OAAO;CAC5B,MAAM,mBAAmB,IAAI,uBAAuB,OAAO,qBAAqB;CAGhF,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,KAAK,IAAI,cAAc,EAAE,SAAS,wCAAwC,MAAM,CAAC,CAAC;CAGzG,MAAM,EAAE,OAAO,OAAO,SAAS;CAC/B,MAAM,EAAE,UAAU,OAAO,WAAW;CACpC,MAAM,SAAS,IAAI,CAAC,UAAU,mBAAmB,CAAC;CAElD,MAAM,oBAAoB,OAAO,OAAO,cACtC,GAAG,MAAM,OAAO,IAAI,OAAO,KAAK,UAAU,mBAAmB,GAAG,OAAO,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CACxF;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,GAAG,IAAI,SAAS;CAClB;CAEA,OAAO;EACL,UAAU,IAAI,OAAO,SAAS;EAC9B,MAAM,GAAG,QAAQ;EACjB,SAAS,IAAI,QAAQ,EAAE,CAAC,CAAC,WAAW;CACtC;AACF,CAAC,CACH,CACF"}
@@ -1,7 +1,8 @@
1
- import { s as Invoke } from "./chunk-functions.mjs";
2
- import * as Operation from "@dxos/compute/Operation";
3
- import { ClientService } from "@dxos/client";
1
+ import { o as Invoke } from "./chunk-definitions.mjs";
2
+ import { t as FunctionError } from "./chunk-errors.mjs";
4
3
  import { Database, Obj } from "@dxos/echo";
4
+ import * as Operation from "@dxos/compute/Operation";
5
+ import { EdgeHttpClientService } from "@dxos/edge-client";
5
6
  import { Context } from "@dxos/context";
6
7
  import { FunctionsServiceClient } from "@dxos/edge-compute";
7
8
  import * as Effect from "effect/Effect";
@@ -9,10 +10,9 @@ import * as Effect from "effect/Effect";
9
10
  var __dxlog_file = "/__w/dxos/dxos/packages/plugins/plugin-script/src/skills/functions/invoke.ts";
10
11
  var invoke_default = Invoke.pipe(Operation.withHandler(Effect.fn(function* ({ function: fn, payload }) {
11
12
  const loaded = yield* Database.load(fn);
12
- const client = yield* ClientService;
13
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);
14
+ if (!spaceId) return yield* Effect.fail(new FunctionError({ message: "Function is not in a space." }));
15
+ const functionsService = new FunctionsServiceClient(yield* EdgeHttpClientService);
16
16
  return { response: yield* Effect.promise(() => functionsService.invoke(Context.default(void 0, {
17
17
  "~LogMeta": "~LogMeta",
18
18
  F: __dxlog_file,
@@ -1 +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 * as Operation from '@dxos/compute/Operation';\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"}
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 * as Operation from '@dxos/compute/Operation';\nimport { Context } from '@dxos/context';\nimport { Database, Obj } from '@dxos/echo';\nimport { EdgeHttpClientService } from '@dxos/edge-client';\nimport { FunctionsServiceClient } from '@dxos/edge-compute';\n\nimport { Invoke } from './definitions.ts';\nimport { FunctionError } from './errors.ts';\n\nexport default Invoke.pipe(\n Operation.withHandler(\n Effect.fn(function* ({ function: fn, payload }) {\n const loaded = yield* Database.load(fn);\n\n const spaceId = Obj.getDatabase(loaded)?.spaceId;\n if (!spaceId) {\n return yield* Effect.fail(new FunctionError({ message: 'Function is not in a space.' }));\n }\n\n const functionsService = new FunctionsServiceClient(yield* EdgeHttpClientService);\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":";;;;;;;;;;AAeA,IAAA,iBAAe,OAAO,KACpB,UAAU,YACR,OAAO,GAAG,WAAW,EAAE,UAAU,IAAI,WAAW;CAC9C,MAAM,SAAS,OAAO,SAAS,KAAK,EAAE;CAEtC,MAAM,UAAU,IAAI,YAAY,MAAM,CAAC,EAAE;CACzC,IAAI,CAAC,SACH,OAAO,OAAO,OAAO,KAAK,IAAI,cAAc,EAAE,SAAS,8BAA8B,CAAC,CAAC;CAGzF,MAAM,mBAAmB,IAAI,uBAAuB,OAAO,qBAAqB;CAKhF,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"}
@@ -1,9 +1,23 @@
1
- import { t as ScriptHandlers } from "./chunk-functions.mjs";
1
+ import { a as InstallFunction, c as Read, i as InspectInvocations, l as Update, n as Delete, o as Invoke, r as Deploy, s as QueryDeployedFunctions, t as Create } from "./chunk-definitions.mjs";
2
2
  import * as Capability from "@dxos/app-framework/Capability";
3
+ import * as Operation from "@dxos/compute/Operation";
3
4
  import * as OperationHandlerSet from "@dxos/compute/OperationHandlerSet";
5
+ import { ScriptOperationHandlerSet } from "#operations";
4
6
  import * as Capabilities from "@dxos/app-framework/Capabilities";
5
7
  import * as Effect from "effect/Effect";
6
- import { ScriptOperationHandlerSet } from "#operations";
8
+ //#region src/skills/functions/index.ts
9
+ var ScriptHandlers = OperationHandlerSet.lazy([
10
+ Create.pipe(Operation.lazyHandler(() => import("./chunk-create.mjs"))),
11
+ Read.pipe(Operation.lazyHandler(() => import("./chunk-read.mjs"))),
12
+ Update.pipe(Operation.lazyHandler(() => import("./chunk-update.mjs"))),
13
+ Delete.pipe(Operation.lazyHandler(() => import("./chunk-delete.mjs"))),
14
+ Deploy.pipe(Operation.lazyHandler(() => import("./chunk-deploy.mjs"))),
15
+ Invoke.pipe(Operation.lazyHandler(() => import("./chunk-invoke.mjs"))),
16
+ InspectInvocations.pipe(Operation.lazyHandler(() => import("./chunk-inspect-invocations.mjs"))),
17
+ QueryDeployedFunctions.pipe(Operation.lazyHandler(() => import("./chunk-query-deployed-functions.mjs"))),
18
+ InstallFunction.pipe(Operation.lazyHandler(() => import("./chunk-install-function.mjs")))
19
+ ]);
20
+ //#endregion
7
21
  //#region src/capabilities/operation-handler.ts
8
22
  var operation_handler_default = Capability.makeModule(Effect.fnUntraced(function* () {
9
23
  return Capability.contribute(Capabilities.OperationHandler, OperationHandlerSet.merge(ScriptOperationHandlerSet.handlers, ScriptHandlers));
@@ -1 +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 * as Capabilities from '@dxos/app-framework/Capabilities';\nimport * as Capability from '@dxos/app-framework/Capability';\nimport * as OperationHandlerSet from '@dxos/compute/OperationHandlerSet';\n\nimport { ScriptOperationHandlerSet } from '#operations';\n\nimport { ScriptHandlers } from '../skills/functions';\n\nexport default Capability.makeModule(\n Effect.fnUntraced(function* () {\n return Capability.contribute(\n Capabilities.OperationHandler,\n OperationHandlerSet.merge(ScriptOperationHandlerSet.handlers, ScriptHandlers),\n );\n }),\n);\n"],"mappings":";;;;;;;AAcA,IAAA,4BAAe,WAAW,WACxB,OAAO,WAAW,aAAa;CAC7B,OAAO,WAAW,WAChB,aAAa,kBACb,oBAAoB,MAAM,0BAA0B,UAAU,cAAc,CAC9E;AACF,CAAC,CACH"}
1
+ {"version":3,"file":"chunk-operation-handler.mjs","names":[],"sources":["../../src/skills/functions/index.ts","../../src/capabilities/operation-handler.ts"],"sourcesContent":["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Operation from '@dxos/compute/Operation';\nimport * as OperationHandlerSet from '@dxos/compute/OperationHandlerSet';\n\nimport {\n Create,\n Delete,\n Deploy,\n InspectInvocations,\n InstallFunction,\n Invoke,\n QueryDeployedFunctions,\n Read,\n Update,\n} from './definitions.ts';\n\nexport * from './definitions.ts';\n\nexport const ScriptHandlers = OperationHandlerSet.lazy([\n Create.pipe(Operation.lazyHandler(() => import('./create.ts'))),\n Read.pipe(Operation.lazyHandler(() => import('./read.ts'))),\n Update.pipe(Operation.lazyHandler(() => import('./update.ts'))),\n Delete.pipe(Operation.lazyHandler(() => import('./delete.ts'))),\n Deploy.pipe(Operation.lazyHandler(() => import('./deploy.ts'))),\n Invoke.pipe(Operation.lazyHandler(() => import('./invoke.ts'))),\n InspectInvocations.pipe(Operation.lazyHandler(() => import('./inspect-invocations.ts'))),\n QueryDeployedFunctions.pipe(Operation.lazyHandler(() => import('./query-deployed-functions.ts'))),\n InstallFunction.pipe(Operation.lazyHandler(() => import('./install-function.ts'))),\n]);\n","//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\n\nimport * as Capabilities from '@dxos/app-framework/Capabilities';\nimport * as Capability from '@dxos/app-framework/Capability';\nimport * as OperationHandlerSet from '@dxos/compute/OperationHandlerSet';\n\nimport { ScriptOperationHandlerSet } from '#operations';\n\nimport { ScriptHandlers } from '../skills/functions/index.ts';\n\nexport default Capability.makeModule(\n Effect.fnUntraced(function* () {\n return Capability.contribute(\n Capabilities.OperationHandler,\n OperationHandlerSet.merge(ScriptOperationHandlerSet.handlers, ScriptHandlers),\n );\n }),\n);\n"],"mappings":";;;;;;;;AAqBA,IAAa,iBAAiB,oBAAoB,KAAK;CACrD,OAAO,KAAK,UAAU,kBAAkB,OAAO,qBAAc,CAAC;CAC9D,KAAK,KAAK,UAAU,kBAAkB,OAAO,mBAAY,CAAC;CAC1D,OAAO,KAAK,UAAU,kBAAkB,OAAO,qBAAc,CAAC;CAC9D,OAAO,KAAK,UAAU,kBAAkB,OAAO,qBAAc,CAAC;CAC9D,OAAO,KAAK,UAAU,kBAAkB,OAAO,qBAAc,CAAC;CAC9D,OAAO,KAAK,UAAU,kBAAkB,OAAO,qBAAc,CAAC;CAC9D,mBAAmB,KAAK,UAAU,kBAAkB,OAAO,kCAA2B,CAAC;CACvF,uBAAuB,KAAK,UAAU,kBAAkB,OAAO,uCAAgC,CAAC;CAChG,gBAAgB,KAAK,UAAU,kBAAkB,OAAO,+BAAwB,CAAC;AACnF,CAAC;;;ACjBD,IAAA,4BAAe,WAAW,WACxB,OAAO,WAAW,aAAa;CAC7B,OAAO,WAAW,WAChB,aAAa,kBACb,oBAAoB,MAAM,0BAA0B,UAAU,cAAc,CAC9E;AACF,CAAC,CACH"}
@@ -1,19 +1,18 @@
1
- import { c as QueryDeployedFunctions } from "./chunk-functions.mjs";
2
- import * as Operation from "@dxos/compute/Operation";
3
- import { ClientService } from "@dxos/client";
1
+ import { s as QueryDeployedFunctions } from "./chunk-definitions.mjs";
4
2
  import { Obj } from "@dxos/echo";
3
+ import * as Operation from "@dxos/compute/Operation";
4
+ import { EdgeHttpClientService } from "@dxos/edge-client";
5
5
  import { Context } from "@dxos/context";
6
6
  import { FunctionsServiceClient } from "@dxos/edge-compute";
7
7
  import * as Effect from "effect/Effect";
8
8
  //#region src/skills/functions/query-deployed-functions.ts
9
9
  var __dxlog_file = "/__w/dxos/dxos/packages/plugins/plugin-script/src/skills/functions/query-deployed-functions.ts";
10
10
  var query_deployed_functions_default = QueryDeployedFunctions.pipe(Operation.withHandler(Effect.fn(function* () {
11
- const client = yield* ClientService;
12
- const functionsService = FunctionsServiceClient.fromClient(client);
11
+ const functionsService = new FunctionsServiceClient(yield* EdgeHttpClientService);
13
12
  return { functions: (yield* Effect.promise(() => functionsService.query(Context.default(void 0, {
14
13
  "~LogMeta": "~LogMeta",
15
14
  F: __dxlog_file,
16
- L: 20
15
+ L: 19
17
16
  })))).map((fn) => {
18
17
  const meta = Obj.getMeta(fn);
19
18
  return {
@@ -1 +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 * as Operation from '@dxos/compute/Operation';\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"}
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 * as Operation from '@dxos/compute/Operation';\nimport { Context } from '@dxos/context';\nimport { Obj } from '@dxos/echo';\nimport { EdgeHttpClientService } from '@dxos/edge-client';\nimport { FunctionsServiceClient } from '@dxos/edge-compute';\n\nimport { QueryDeployedFunctions } from './definitions.ts';\n\nexport default QueryDeployedFunctions.pipe(\n Operation.withHandler(\n Effect.fn(function* () {\n const functionsService = new FunctionsServiceClient(yield* EdgeHttpClientService);\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,mBAAmB,IAAI,uBAAuB,OAAO,qBAAqB;CAEhF,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"}