@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
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chunk-PLUGIN.mjs","names":[],"sources":[],"mappings":""}
@@ -1,11 +1,12 @@
1
1
  import { Obj } from "@dxos/echo";
2
2
  import { useMemo } from "react";
3
- import { Panel } from "@dxos/react-ui";
4
3
  import { jsx, jsxs } from "react/jsx-runtime";
5
4
  import { Doc } from "@dxos/echo-doc";
5
+ import { useResolveRef } from "@dxos/echo-react";
6
6
  import { createDataExtensions, editorClassNames, listener } from "@dxos/ui-editor";
7
7
  import { useDeployState, useToolbarState } from "#hooks";
8
8
  import { getSpace } from "@dxos/react-client/echo";
9
+ import * as Panel from "@dxos/react-ui/Panel";
9
10
  import { ScriptToolbar, TypescriptEditor } from "#components";
10
11
  import { useIdentity } from "@dxos/halo-react";
11
12
  //#region src/containers/ScriptArticle/ScriptArticle.tsx
@@ -17,15 +18,16 @@ var ScriptArticle = ({ role, attendableId, subject: script, settings = { editorI
17
18
  script,
18
19
  state
19
20
  });
21
+ const source = useResolveRef(script.source);
20
22
  const extensions = useMemo(() => {
21
- if (!script.source.target) return [];
23
+ if (!source) return [];
22
24
  return [createDataExtensions({
23
25
  id: script.id,
24
- text: Doc.createAccessor(script.source.target, ["content"]),
26
+ text: Doc.createAccessor(source, ["content"]),
25
27
  messenger: space,
26
28
  identity
27
29
  }), listener({ onChange: ({ text }) => {
28
- if (script.source.target?.content !== text) Obj.update(script, (script) => {
30
+ if (source?.content !== text) Obj.update(script, (script) => {
29
31
  script.changed = true;
30
32
  });
31
33
  } })];
@@ -33,26 +35,23 @@ var ScriptArticle = ({ role, attendableId, subject: script, settings = { editorI
33
35
  identity,
34
36
  space,
35
37
  script,
36
- script.source.target
38
+ source
37
39
  ]);
38
40
  if (!extensions.length) return null;
39
41
  return /* @__PURE__ */ jsxs(Panel.Root, {
40
42
  role,
41
- children: [/* @__PURE__ */ jsx(Panel.Toolbar, {
42
- asChild: true,
43
- children: /* @__PURE__ */ jsx(ScriptToolbar, {
44
- script,
45
- attendableId,
46
- state,
47
- role
48
- })
49
- }), /* @__PURE__ */ jsx(Panel.Content, {
43
+ children: [/* @__PURE__ */ jsx(Panel.Header, { children: /* @__PURE__ */ jsx(ScriptToolbar, {
44
+ script,
45
+ attendableId,
46
+ state,
47
+ role
48
+ }) }), /* @__PURE__ */ jsx(Panel.Body, {
50
49
  asChild: true,
51
50
  children: /* @__PURE__ */ jsx(TypescriptEditor, {
52
51
  classNames: editorClassNames(role),
53
52
  id: script.id,
54
53
  env,
55
- initialValue: script.source?.target?.content,
54
+ initialValue: source?.content,
56
55
  extensions,
57
56
  inputMode: settings.editorInputMode,
58
57
  toolbar: true
@@ -1 +1 @@
1
- {"version":3,"file":"chunk-ScriptArticle.mjs","names":[],"sources":["../../src/containers/ScriptArticle/ScriptArticle.tsx"],"sourcesContent":["//\n// Copyright 2023 DXOS.org\n//\n\nimport React, { useMemo } from 'react';\n\nimport { type AppSurface } from '@dxos/app-toolkit/ui';\nimport type * as Script from '@dxos/compute/Script';\nimport { Obj } from '@dxos/echo';\nimport { Doc } from '@dxos/echo-doc';\nimport { useIdentity } from '@dxos/halo-react';\nimport { getSpace } from '@dxos/react-client/echo';\nimport { Panel } from '@dxos/react-ui';\nimport { createDataExtensions, editorClassNames, listener } from '@dxos/ui-editor';\n\nimport { ScriptToolbar, TypescriptEditor, type TypescriptEditorProps } from '#components';\nimport { useDeployState, useToolbarState } from '#hooks';\nimport { Settings } from '#types';\n\nexport type ScriptEditorProps = AppSurface.ObjectArticleProps<\n Script.Script,\n {\n settings?: Settings.Settings;\n } & Pick<TypescriptEditorProps, 'env'>\n>;\n\nexport const ScriptArticle = ({\n role,\n attendableId,\n subject: script,\n settings = { editorInputMode: 'vscode' },\n env,\n}: ScriptEditorProps) => {\n const identity = useIdentity();\n const space = getSpace(script);\n const state = useToolbarState();\n useDeployState({ script, state });\n\n const extensions = useMemo(() => {\n if (!script.source.target) {\n return [];\n }\n\n return [\n createDataExtensions({\n id: script.id,\n text: Doc.createAccessor(script.source.target, ['content']),\n messenger: space,\n identity,\n }),\n listener({\n onChange: ({ text }) => {\n if (script.source.target?.content !== text) {\n Obj.update(script, (script) => {\n script.changed = true;\n });\n }\n },\n }),\n ];\n }, [identity, space, script, script.source.target]);\n\n if (!extensions.length) {\n return null;\n }\n\n return (\n <Panel.Root role={role}>\n <Panel.Toolbar asChild>\n <ScriptToolbar script={script} attendableId={attendableId} state={state} role={role} />\n </Panel.Toolbar>\n <Panel.Content asChild>\n <TypescriptEditor\n classNames={editorClassNames(role)}\n id={script.id}\n env={env}\n initialValue={script.source?.target?.content}\n extensions={extensions}\n inputMode={settings.editorInputMode}\n toolbar\n />\n </Panel.Content>\n </Panel.Root>\n );\n};\n\nScriptArticle.displayName = 'ScriptArticle';\n"],"mappings":";;;;;;;;;;;AA0BA,IAAa,iBAAiB,EAC5B,MACA,cACA,SAAS,QACT,WAAW,EAAE,iBAAiB,SAAS,GACvC,UACuB;CACvB,MAAM,WAAW,YAAY;CAC7B,MAAM,QAAQ,SAAS,MAAM;CAC7B,MAAM,QAAQ,gBAAgB;CAC9B,eAAe;EAAE;EAAQ;CAAM,CAAC;CAEhC,MAAM,aAAa,cAAc;EAC/B,IAAI,CAAC,OAAO,OAAO,QACjB,OAAO,CAAC;EAGV,OAAO,CACL,qBAAqB;GACnB,IAAI,OAAO;GACX,MAAM,IAAI,eAAe,OAAO,OAAO,QAAQ,CAAC,SAAS,CAAC;GAC1D,WAAW;GACX;EACF,CAAC,GACD,SAAS,EACP,WAAW,EAAE,WAAW;GACtB,IAAI,OAAO,OAAO,QAAQ,YAAY,MACpC,IAAI,OAAO,SAAS,WAAW;IAC7B,OAAO,UAAU;GACnB,CAAC;EAEL,EACF,CAAC,CACH;CACF,GAAG;EAAC;EAAU;EAAO;EAAQ,OAAO,OAAO;CAAM,CAAC;CAElD,IAAI,CAAC,WAAW,QACd,OAAO;CAGT,OACE,qBAAC,MAAM,MAAP;EAAkB;EAAlB,UAAA,CACE,oBAAC,MAAM,SAAP;GAAe,SAAA;GACb,UAAA,oBAAC,eAAD;IAAuB;IAAsB;IAAqB;IAAa;GAAO,CAAA;EACzE,CAAA,GACf,oBAAC,MAAM,SAAP;GAAe,SAAA;GACb,UAAA,oBAAC,kBAAD;IACE,YAAY,iBAAiB,IAAI;IACjC,IAAI,OAAO;IACN;IACL,cAAc,OAAO,QAAQ,QAAQ;IACzB;IACZ,WAAW,SAAS;IACpB,SAAA;GACD,CAAA;EACY,CAAA,CACL;;AAEhB;AAEA,cAAc,cAAc"}
1
+ {"version":3,"file":"chunk-ScriptArticle.mjs","names":[],"sources":["../../src/containers/ScriptArticle/ScriptArticle.tsx"],"sourcesContent":["//\n// Copyright 2023 DXOS.org\n//\n\nimport React, { useMemo } from 'react';\n\nimport type * as AppSurface from '@dxos/app-toolkit/AppSurface';\nimport type * as Script from '@dxos/compute/Script';\nimport { Obj } from '@dxos/echo';\nimport { Doc } from '@dxos/echo-doc';\nimport { useResolveRef } from '@dxos/echo-react';\nimport { useIdentity } from '@dxos/halo-react';\nimport { getSpace } from '@dxos/react-client/echo';\nimport * as Panel from '@dxos/react-ui/Panel';\nimport { createDataExtensions, editorClassNames, listener } from '@dxos/ui-editor';\n\nimport { ScriptToolbar, TypescriptEditor, type TypescriptEditorProps } from '#components';\nimport { useDeployState, useToolbarState } from '#hooks';\nimport { Settings } from '#types';\n\nexport type ScriptEditorProps = AppSurface.ObjectArticleProps<\n Script.Script,\n {\n settings?: Settings.Settings;\n } & Pick<TypescriptEditorProps, 'env'>\n>;\n\nexport const ScriptArticle = ({\n role,\n attendableId,\n subject: script,\n settings = { editorInputMode: 'vscode' },\n env,\n}: ScriptEditorProps) => {\n const identity = useIdentity();\n const space = getSpace(script);\n const state = useToolbarState();\n useDeployState({ script, state });\n const source = useResolveRef(script.source);\n\n const extensions = useMemo(() => {\n if (!source) {\n return [];\n }\n\n return [\n createDataExtensions({\n id: script.id,\n text: Doc.createAccessor(source, ['content']),\n messenger: space,\n identity,\n }),\n listener({\n onChange: ({ text }) => {\n if (source?.content !== text) {\n Obj.update(script, (script) => {\n script.changed = true;\n });\n }\n },\n }),\n ];\n }, [identity, space, script, source]);\n\n if (!extensions.length) {\n return null;\n }\n\n return (\n <Panel.Root role={role}>\n <Panel.Header>\n <ScriptToolbar script={script} attendableId={attendableId} state={state} role={role} />\n </Panel.Header>\n <Panel.Body asChild>\n <TypescriptEditor\n classNames={editorClassNames(role)}\n id={script.id}\n env={env}\n initialValue={source?.content}\n extensions={extensions}\n inputMode={settings.editorInputMode}\n toolbar\n />\n </Panel.Body>\n </Panel.Root>\n );\n};\n\nScriptArticle.displayName = 'ScriptArticle';\n"],"mappings":";;;;;;;;;;;;AA2BA,IAAa,iBAAiB,EAC5B,MACA,cACA,SAAS,QACT,WAAW,EAAE,iBAAiB,SAAS,GACvC,UACuB;CACvB,MAAM,WAAW,YAAY;CAC7B,MAAM,QAAQ,SAAS,MAAM;CAC7B,MAAM,QAAQ,gBAAgB;CAC9B,eAAe;EAAE;EAAQ;CAAM,CAAC;CAChC,MAAM,SAAS,cAAc,OAAO,MAAM;CAE1C,MAAM,aAAa,cAAc;EAC/B,IAAI,CAAC,QACH,OAAO,CAAC;EAGV,OAAO,CACL,qBAAqB;GACnB,IAAI,OAAO;GACX,MAAM,IAAI,eAAe,QAAQ,CAAC,SAAS,CAAC;GAC5C,WAAW;GACX;EACF,CAAC,GACD,SAAS,EACP,WAAW,EAAE,WAAW;GACtB,IAAI,QAAQ,YAAY,MACtB,IAAI,OAAO,SAAS,WAAW;IAC7B,OAAO,UAAU;GACnB,CAAC;EAEL,EACF,CAAC,CACH;CACF,GAAG;EAAC;EAAU;EAAO;EAAQ;CAAM,CAAC;CAEpC,IAAI,CAAC,WAAW,QACd,OAAO;CAGT,OACE,qBAAC,MAAM,MAAP;EAAkB;EAAlB,UAAA,CACE,oBAAC,MAAM,QAAP,EAAA,UACE,oBAAC,eAAD;GAAuB;GAAsB;GAAqB;GAAa;EAAO,CAAA,EAC1E,CAAA,GACd,oBAAC,MAAM,MAAP;GAAY,SAAA;GACV,UAAA,oBAAC,kBAAD;IACE,YAAY,iBAAiB,IAAI;IACjC,IAAI,OAAO;IACN;IACL,cAAc,QAAQ;IACV;IACZ,WAAW,SAAS;IACpB,SAAA;GACD,CAAA;EACS,CAAA,CACF;;AAEhB;AAEA,cAAc,cAAc"}
@@ -1,31 +1,37 @@
1
1
  import { meta } from "#meta";
2
+ import { getInvocationUrl, getUserFunctionIdInMetadata } from "@dxos/compute-runtime";
3
+ import { Filter, Obj, Ref } from "@dxos/echo";
4
+ import { log } from "@dxos/log";
2
5
  import * as Skill from "@dxos/compute/Skill";
3
6
  import * as Template from "@dxos/compute/Template";
4
7
  import { kebabize } from "@dxos/util";
5
8
  import * as Operation from "@dxos/compute/Operation";
6
- import { Filter, Obj, Ref } from "@dxos/echo";
7
- import { getInvocationUrl, getUserFunctionIdInMetadata } from "@dxos/compute-runtime";
8
- import { log } from "@dxos/log";
9
9
  import { useCallback, useState } from "react";
10
- import { Banner, Button, Clipboard, Flex, Input, useAsyncEffect, useControlledState, useTranslation } from "@dxos/react-ui";
10
+ import * as Hooks$1 from "@dxos/react-ui/Hooks";
11
11
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
12
- import { useOperationInvoker } from "@dxos/app-framework/ui";
12
+ import * as Button from "@dxos/react-ui/Button";
13
13
  import { useQuery } from "@dxos/echo-react";
14
+ import * as Field from "@dxos/react-ui/Field";
15
+ import * as Input from "@dxos/react-ui/Input";
16
+ import * as Layout from "@dxos/react-ui/Layout";
14
17
  import { useClient } from "@dxos/react-client";
18
+ import * as Hooks from "@dxos/app-framework/Hooks";
19
+ import * as SystemButton from "@dxos/react-ui/SystemButton";
15
20
  import { Form } from "@dxos/react-ui-form";
16
21
  import { Octokit } from "@octokit/core";
17
22
  import * as SettingsOperation from "@dxos/app-toolkit/SettingsOperation";
18
23
  import { AccessToken } from "@dxos/link";
24
+ import * as Banner from "@dxos/react-ui/Banner";
19
25
  import { ToolId } from "@dxos/ai";
20
26
  //#region src/containers/ScriptProperties/FunctionBinding.tsx
21
27
  var FunctionBinding = ({ object }) => {
22
- const { t } = useTranslation(meta.profile.key);
28
+ const { t } = Hooks$1.useTranslation(meta.profile.key);
23
29
  const client = useClient();
24
30
  const db = Obj.getDatabase(object);
25
31
  const [fn] = useQuery(db, Filter.type(Operation.PersistentOperation, { source: Ref.make(object) }));
26
32
  const functionId = fn && getUserFunctionIdInMetadata(Obj.getMeta(fn));
27
33
  const functionUrl = functionId && getInvocationUrl(functionId, client.config.values.runtime?.services?.edge?.url ?? "", { spaceId: db?.spaceId });
28
- const [binding, setBinding] = useControlledState(fn?.binding ?? "");
34
+ const [binding, setBinding] = Hooks$1.useControlledState(fn?.binding ?? "");
29
35
  const handleBindingChange = useCallback((event) => setBinding(event.target.value), [setBinding]);
30
36
  const handleBindingBlur = useCallback(() => {
31
37
  if (fn) Obj.update(fn, (fn) => {
@@ -33,30 +39,29 @@ var FunctionBinding = ({ object }) => {
33
39
  });
34
40
  }, [fn, binding]);
35
41
  if (!fn) return null;
36
- return /* @__PURE__ */ jsxs(Flex, {
37
- column: true,
38
- children: [
39
- /* @__PURE__ */ jsx(Form.Section, { title: t("remote-function-settings.heading") }),
40
- functionUrl && /* @__PURE__ */ jsxs(Input.Root, { children: [
41
- /* @__PURE__ */ jsx(Input.Label, { children: t("function-url.label") }),
42
- /* @__PURE__ */ jsx(Input.TextInput, {
43
- disabled: true,
44
- value: functionUrl,
45
- onChange: (event) => {
46
- Obj.update(fn, (fn) => {
47
- fn.name = event.target.value;
48
- });
49
- }
50
- }),
51
- /* @__PURE__ */ jsx(Clipboard.IconButton, { value: functionUrl })
52
- ] }),
53
- /* @__PURE__ */ jsxs(Input.Root, { children: [/* @__PURE__ */ jsx(Input.Label, { children: t("function-binding.label") }), /* @__PURE__ */ jsx(Input.TextInput, {
54
- placeholder: t("function-binding.placeholder"),
55
- value: binding,
56
- onChange: handleBindingChange,
57
- onBlur: handleBindingBlur
58
- })] })
59
- ]
42
+ return /* @__PURE__ */ jsxs(Form.FieldSet, {
43
+ label: t("remote-function-settings.heading"),
44
+ children: [functionUrl && /* @__PURE__ */ jsxs(Field.Root, { children: [
45
+ /* @__PURE__ */ jsx(Field.Label, { children: t("function-url.label") }),
46
+ /* @__PURE__ */ jsx(Input.Root, {
47
+ disabled: true,
48
+ value: functionUrl,
49
+ onChange: (event) => {
50
+ Obj.update(fn, (fn) => {
51
+ fn.name = event.target.value;
52
+ });
53
+ }
54
+ }),
55
+ /* @__PURE__ */ jsx(SystemButton.Clipboard, {
56
+ iconOnly: true,
57
+ value: functionUrl
58
+ })
59
+ ] }), /* @__PURE__ */ jsxs(Field.Root, { children: [/* @__PURE__ */ jsx(Field.Label, { children: t("function-binding.label") }), /* @__PURE__ */ jsx(Input.Root, {
60
+ placeholder: t("function-binding.placeholder"),
61
+ value: binding,
62
+ onChange: handleBindingChange,
63
+ onBlur: handleBindingBlur
64
+ })] })]
60
65
  });
61
66
  };
62
67
  FunctionBinding.displayName = "FunctionBinding";
@@ -64,13 +69,13 @@ FunctionBinding.displayName = "FunctionBinding";
64
69
  //#region src/containers/ScriptProperties/FunctionPublishing.tsx
65
70
  var __dxlog_file = "/__w/dxos/dxos/packages/plugins/plugin-script/src/containers/ScriptProperties/FunctionPublishing.tsx";
66
71
  var FunctionPublishing = ({ object }) => {
67
- const { t } = useTranslation(meta.profile.key);
68
- const { invokePromise } = useOperationInvoker();
72
+ const { t } = Hooks$1.useTranslation(meta.profile.key);
73
+ const { invokePromise } = Hooks.useOperationInvoker();
69
74
  const db = Obj.getDatabase(object);
70
75
  const [githubToken] = useQuery(db, Filter.type(AccessToken.AccessToken, { source: "github.com" }));
71
76
  const gistKey = Obj.getMeta(object).keys.find(({ source }) => source === "github.com");
72
77
  const [gistUrl, setGistUrl] = useState();
73
- useAsyncEffect(async () => {
78
+ Hooks$1.useAsyncEffect(async () => {
74
79
  const token = githubToken?.token;
75
80
  const gistId = gistKey?.id;
76
81
  if (!token || !gistId) {
@@ -84,7 +89,7 @@ var FunctionPublishing = ({ object }) => {
84
89
  log.catch(err, void 0, {
85
90
  "~LogMeta": "~LogMeta",
86
91
  F: __dxlog_file,
87
- L: 48,
92
+ L: 52,
88
93
  S: void 0
89
94
  });
90
95
  setGistUrl(void 0);
@@ -119,44 +124,41 @@ var FunctionPublishing = ({ object }) => {
119
124
  setPublishing(false);
120
125
  }
121
126
  }, [object, githubToken]);
122
- return /* @__PURE__ */ jsxs(Flex, {
123
- column: true,
124
- children: [
125
- /* @__PURE__ */ jsx(Form.Section, {
126
- title: t("script-publish-settings.label"),
127
- description: t("script-publish-settings.description")
128
- }),
129
- !githubToken && /* @__PURE__ */ jsxs(Flex, {
130
- column: true,
131
- classNames: "py-form-gap",
132
- children: [/* @__PURE__ */ jsx(Banner.Root, {
133
- valence: "info",
134
- children: /* @__PURE__ */ jsx(Banner.Content, { children: /* @__PURE__ */ jsx(Banner.Title, { children: t("no-github-token.label") }) })
135
- }), /* @__PURE__ */ jsx(Flex, {
136
- classNames: "pt-form-gap",
137
- children: /* @__PURE__ */ jsx(Button, {
138
- onClick: handleOpenTokenManager,
139
- children: t("open-token-manager.label")
140
- })
141
- })]
142
- }),
143
- githubToken && /* @__PURE__ */ jsxs(Flex, {
144
- gap: "sm",
145
- justify: "end",
146
- children: [gistUrl && /* @__PURE__ */ jsx(Clipboard.IconButton, { value: gistUrl }), /* @__PURE__ */ jsx(Button, {
147
- disabled: publishing,
148
- onClick: handlePublish,
149
- children: t("publish.label")
150
- })]
151
- })
152
- ]
127
+ return /* @__PURE__ */ jsxs(Form.FieldSet, {
128
+ label: t("script-publish-settings.label"),
129
+ description: t("script-publish-settings.description"),
130
+ children: [!githubToken && /* @__PURE__ */ jsxs(Layout.Flex, {
131
+ column: true,
132
+ classNames: "py-form-gap",
133
+ children: [/* @__PURE__ */ jsx(Banner.Root, {
134
+ valence: "info",
135
+ children: /* @__PURE__ */ jsx(Banner.Title, { children: t("no-github-token.label") })
136
+ }), /* @__PURE__ */ jsx(Layout.Flex, {
137
+ classNames: "pt-form-gap",
138
+ children: /* @__PURE__ */ jsx(Button.Root, {
139
+ onClick: handleOpenTokenManager,
140
+ children: t("open-token-manager.label")
141
+ })
142
+ })]
143
+ }), githubToken && /* @__PURE__ */ jsxs(Layout.Flex, {
144
+ gap: "sm",
145
+ justify: "end",
146
+ children: [gistUrl && /* @__PURE__ */ jsx(SystemButton.Clipboard, {
147
+ iconOnly: true,
148
+ value: gistUrl
149
+ }), /* @__PURE__ */ jsx(Button.Root, {
150
+ disabled: publishing,
151
+ onClick: handlePublish,
152
+ children: t("publish.label")
153
+ })]
154
+ })]
153
155
  });
154
156
  };
155
157
  FunctionPublishing.displayName = "FunctionPublishing";
156
158
  //#endregion
157
159
  //#region src/containers/ScriptProperties/SkillEditor.tsx
158
160
  var SkillEditor = ({ object }) => {
159
- const { t } = useTranslation(meta.profile.key);
161
+ const { t } = Hooks$1.useTranslation(meta.profile.key);
160
162
  const db = Obj.getDatabase(object);
161
163
  const [fn] = useQuery(db, Filter.type(Operation.PersistentOperation, { source: Ref.make(object) }));
162
164
  const skills = useQuery(db, Filter.type(Skill.Skill));
@@ -165,7 +167,7 @@ var SkillEditor = ({ object }) => {
165
167
  const skillKey = `org.dxos.skill.${kebabize(object.name ?? "script")}`;
166
168
  const existingSkill = skills.find((bp) => Obj.getMeta(bp).key === skillKey);
167
169
  const fnKey = fn ? Obj.getMeta(fn).key : void 0;
168
- useAsyncEffect(async () => {
170
+ Hooks$1.useAsyncEffect(async () => {
169
171
  if (!existingSkill) return;
170
172
  const source = await existingSkill.instructions.source.load();
171
173
  setInstructions(source.content ?? "");
@@ -182,7 +184,8 @@ var SkillEditor = ({ object }) => {
182
184
  if (fnKey) {
183
185
  const toolId = ToolId.make(fnKey);
184
186
  if (!existingSkill.tools?.includes(toolId)) Obj.update(existingSkill, (existingSkill) => {
185
- existingSkill.tools = [...existingSkill.tools ?? [], toolId];
187
+ existingSkill.tools ??= [];
188
+ existingSkill.tools.push(toolId);
186
189
  });
187
190
  }
188
191
  } else if (fnKey) db.add(Skill.make({
@@ -203,29 +206,23 @@ var SkillEditor = ({ object }) => {
203
206
  object.name,
204
207
  instructions
205
208
  ]);
206
- return /* @__PURE__ */ jsxs(Flex, {
207
- column: true,
208
- children: [
209
- /* @__PURE__ */ jsx(Form.Section, {
210
- title: t("skill-editor.label"),
211
- description: t("skill-editor.description")
212
- }),
213
- /* @__PURE__ */ jsxs(Input.Root, { children: [/* @__PURE__ */ jsx(Input.Label, { children: t("skill-instructions.label") }), /* @__PURE__ */ jsx(Input.TextArea, {
214
- placeholder: t("skill-instructions.placeholder"),
215
- rows: 6,
216
- value: instructions,
217
- onChange: (event) => setInstructions(event.target.value),
218
- classNames: "resize-y"
219
- })] }),
220
- /* @__PURE__ */ jsx("div", {
221
- className: "pt-2",
222
- children: /* @__PURE__ */ jsx(Button, {
223
- disabled: !existingSkill && !fnKey || creating,
224
- onClick: handleSave,
225
- children: t(existingSkill ? "update-skill.label" : "create-skill.label")
226
- })
209
+ return /* @__PURE__ */ jsxs(Form.FieldSet, {
210
+ label: t("skill-editor.label"),
211
+ description: t("skill-editor.description"),
212
+ children: [/* @__PURE__ */ jsxs(Field.Root, { children: [/* @__PURE__ */ jsx(Field.Label, { children: t("skill-instructions.label") }), /* @__PURE__ */ jsx(Input.Textarea, {
213
+ placeholder: t("skill-instructions.placeholder"),
214
+ rows: 6,
215
+ value: instructions,
216
+ onChange: (event) => setInstructions(event.target.value),
217
+ classNames: "resize-y"
218
+ })] }), /* @__PURE__ */ jsx("div", {
219
+ className: "pt-2",
220
+ children: /* @__PURE__ */ jsx(Button.Root, {
221
+ disabled: !existingSkill && !fnKey || creating,
222
+ onClick: handleSave,
223
+ children: t(existingSkill ? "update-skill.label" : "create-skill.label")
227
224
  })
228
- ]
225
+ })]
229
226
  });
230
227
  };
231
228
  SkillEditor.displayName = "SkillEditor";
@@ -233,9 +230,9 @@ SkillEditor.displayName = "SkillEditor";
233
230
  //#region src/containers/ScriptProperties/ScriptProperties.tsx
234
231
  var ScriptProperties = ({ subject: object }) => {
235
232
  return /* @__PURE__ */ jsxs(Fragment, { children: [
236
- /* @__PURE__ */ jsx(Form.Section, { children: /* @__PURE__ */ jsx(FunctionBinding, { object }) }),
237
- /* @__PURE__ */ jsx(Form.Section, { children: /* @__PURE__ */ jsx(SkillEditor, { object }) }),
238
- /* @__PURE__ */ jsx(Form.Section, { children: /* @__PURE__ */ jsx(FunctionPublishing, { object }) })
233
+ /* @__PURE__ */ jsx(Form.FieldSet, { children: /* @__PURE__ */ jsx(FunctionBinding, { object }) }),
234
+ /* @__PURE__ */ jsx(Form.FieldSet, { children: /* @__PURE__ */ jsx(SkillEditor, { object }) }),
235
+ /* @__PURE__ */ jsx(Form.FieldSet, { children: /* @__PURE__ */ jsx(FunctionPublishing, { object }) })
239
236
  ] });
240
237
  };
241
238
  ScriptProperties.displayName = "ScriptProperties";
@@ -1 +1 @@
1
- {"version":3,"file":"chunk-ScriptProperties.mjs","names":[],"sources":["../../src/containers/ScriptProperties/FunctionBinding.tsx","../../src/containers/ScriptProperties/FunctionPublishing.tsx","../../src/containers/ScriptProperties/SkillEditor.tsx","../../src/containers/ScriptProperties/ScriptProperties.tsx"],"sourcesContent":["//\n// Copyright 2024 DXOS.org\n//\n\nimport React, { type ChangeEvent, useCallback } from 'react';\n\nimport { getUserFunctionIdInMetadata } from '@dxos/compute-runtime';\nimport { getInvocationUrl } from '@dxos/compute-runtime';\nimport * as Operation from '@dxos/compute/Operation';\nimport type * as Script from '@dxos/compute/Script';\nimport { Filter, Obj, Ref } from '@dxos/echo';\nimport { useQuery } from '@dxos/echo-react';\nimport { useClient } from '@dxos/react-client';\nimport { Clipboard, Flex, Input, useControlledState, useTranslation } from '@dxos/react-ui';\nimport { Form } from '@dxos/react-ui-form';\n\nimport { meta } from '#meta';\n\nexport type FunctionBindingProps = { object: Script.Script };\n\nexport const FunctionBinding = ({ object }: FunctionBindingProps) => {\n const { t } = useTranslation(meta.profile.key);\n const client = useClient();\n const db = Obj.getDatabase(object);\n\n const [fn] = useQuery(db, Filter.type(Operation.PersistentOperation, { source: Ref.make(object) }));\n const functionId = fn && getUserFunctionIdInMetadata(Obj.getMeta(fn));\n const functionUrl =\n functionId &&\n getInvocationUrl(functionId, client.config.values.runtime?.services?.edge?.url ?? '', {\n spaceId: db?.spaceId,\n });\n\n const [binding, setBinding] = useControlledState(fn?.binding ?? '');\n const handleBindingChange = useCallback(\n (event: ChangeEvent<HTMLInputElement>) => setBinding(event.target.value),\n [setBinding],\n );\n\n const handleBindingBlur = useCallback(() => {\n if (fn) {\n Obj.update(fn, (fn) => {\n fn.binding = binding;\n });\n }\n }, [fn, binding]);\n\n if (!fn) {\n return null;\n }\n\n return (\n <Flex column>\n <Form.Section title={t('remote-function-settings.heading')} />\n\n {functionUrl && (\n <Input.Root>\n <Input.Label>{t('function-url.label')}</Input.Label>\n <Input.TextInput\n disabled\n value={functionUrl}\n onChange={(event) => {\n Obj.update(fn, (fn) => {\n fn.name = event.target.value;\n });\n }}\n />\n <Clipboard.IconButton value={functionUrl} />\n </Input.Root>\n )}\n\n <Input.Root>\n <Input.Label>{t('function-binding.label')}</Input.Label>\n <Input.TextInput\n placeholder={t('function-binding.placeholder')}\n value={binding}\n onChange={handleBindingChange}\n onBlur={handleBindingBlur}\n />\n </Input.Root>\n </Flex>\n );\n};\n\nFunctionBinding.displayName = 'FunctionBinding';\n","//\n// Copyright 2024 DXOS.org\n//\n\nimport { Octokit } from '@octokit/core';\nimport React, { useCallback, useState } from 'react';\n\nimport { useOperationInvoker } from '@dxos/app-framework/ui';\nimport * as SettingsOperation from '@dxos/app-toolkit/SettingsOperation';\nimport type * as Script from '@dxos/compute/Script';\nimport { Filter, Obj } from '@dxos/echo';\nimport { useQuery } from '@dxos/echo-react';\nimport { AccessToken } from '@dxos/link';\nimport { log } from '@dxos/log';\nimport { Banner, Button, Clipboard, Flex, useAsyncEffect, useTranslation } from '@dxos/react-ui';\nimport { Form } from '@dxos/react-ui-form';\nimport { kebabize } from '@dxos/util';\n\nimport { meta } from '#meta';\n\nexport type FunctionPublishingProps = { object: Script.Script };\n\n// TODO(burdon): Move to separate tab?\nexport const FunctionPublishing = ({ object }: FunctionPublishingProps) => {\n const { t } = useTranslation(meta.profile.key);\n const { invokePromise } = useOperationInvoker();\n const db = Obj.getDatabase(object);\n\n const [githubToken] = useQuery(db, Filter.type(AccessToken.AccessToken, { source: 'github.com' }));\n const gistKey = Obj.getMeta(object).keys.find(({ source }) => source === 'github.com');\n const [gistUrl, setGistUrl] = useState<string | undefined>();\n\n useAsyncEffect(async () => {\n const token = githubToken?.token;\n const gistId = gistKey?.id;\n if (!token || !gistId) {\n setGistUrl(undefined);\n return;\n }\n\n try {\n const octokit = new Octokit({ auth: githubToken.token });\n const response = await octokit.request('GET /gists/{gist_id}', {\n gist_id: gistId,\n });\n setGistUrl(response.data.html_url);\n } catch (err) {\n log.catch(err);\n setGistUrl(undefined);\n }\n }, [githubToken, gistKey]);\n\n const handleOpenTokenManager = useCallback(\n () =>\n invokePromise(SettingsOperation.Open, {\n plugin: 'org.dxos.plugin.token-manager',\n }),\n [invokePromise],\n );\n\n const [publishing, setPublishing] = useState(false);\n const handlePublish = useCallback(async () => {\n setPublishing(true);\n const octokit = new Octokit({ auth: githubToken.token });\n const source = await object.source.load();\n const filename = object.name ? kebabize(object.name) : 'composer-script';\n const files = { [`${filename}.ts`]: { content: source.content } };\n\n try {\n // TODO(wittjosiah): Factor out to intent.\n const meta = Obj.getMeta(object);\n const githubKey = meta.keys.find(({ source }) => source === 'github.com');\n const gistId = githubKey?.id;\n if (gistId) {\n await octokit.request('PATCH /gists/{gist_id}', {\n gist_id: gistId,\n files,\n });\n } else {\n const response = await octokit.request('POST /gists', {\n public: true,\n files,\n });\n const gistId = response.data.id;\n if (gistId) {\n Obj.update(object, (object) => {\n Obj.getMeta(object).keys.push({ source: 'github.com', id: gistId });\n });\n }\n }\n } finally {\n setPublishing(false);\n }\n }, [object, githubToken]);\n\n return (\n <Flex column>\n <Form.Section title={t('script-publish-settings.label')} description={t('script-publish-settings.description')} />\n\n {!githubToken && (\n <Flex column classNames='py-form-gap'>\n <Banner.Root valence='info'>\n <Banner.Content>\n <Banner.Title>{t('no-github-token.label')}</Banner.Title>\n </Banner.Content>\n </Banner.Root>\n <Flex classNames='pt-form-gap'>\n <Button onClick={handleOpenTokenManager}>{t('open-token-manager.label')}</Button>\n </Flex>\n </Flex>\n )}\n\n {githubToken && (\n <Flex gap='sm' justify='end'>\n {gistUrl && <Clipboard.IconButton value={gistUrl} />}\n <Button disabled={publishing} onClick={handlePublish}>\n {t('publish.label')}\n </Button>\n </Flex>\n )}\n </Flex>\n );\n};\n\nFunctionPublishing.displayName = 'FunctionPublishing';\n","//\n// Copyright 2024 DXOS.org\n//\n\nimport React, { useCallback, useState } from 'react';\n\nimport { ToolId } from '@dxos/ai';\nimport * as Operation from '@dxos/compute/Operation';\nimport type * as Script from '@dxos/compute/Script';\nimport * as Skill from '@dxos/compute/Skill';\nimport * as Template from '@dxos/compute/Template';\nimport { Filter, Obj, Ref } from '@dxos/echo';\nimport { useQuery } from '@dxos/echo-react';\nimport { Button, Flex, Input, useAsyncEffect, useTranslation } from '@dxos/react-ui';\nimport { Form } from '@dxos/react-ui-form';\nimport { kebabize } from '@dxos/util';\n\nimport { meta } from '#meta';\n\nexport type SkillEditorProps = { object: Script.Script };\n\nexport const SkillEditor = ({ object }: SkillEditorProps) => {\n const { t } = useTranslation(meta.profile.key);\n const db = Obj.getDatabase(object);\n const [fn] = useQuery(db, Filter.type(Operation.PersistentOperation, { source: Ref.make(object) }));\n const skills = useQuery(db, Filter.type(Skill.Skill));\n\n const [creating, setCreating] = useState(false);\n // TODO(burdon): Remove?\n const [instructions, setInstructions] = useState<string>(`You can run the script \"${object.name ?? 'script'}\".`);\n const skillKey = `org.dxos.skill.${kebabize(object.name ?? 'script')}`;\n const existingSkill = skills.find((bp) => Obj.getMeta(bp).key === skillKey);\n const fnKey = fn ? Obj.getMeta(fn).key : undefined;\n\n useAsyncEffect(async () => {\n if (!existingSkill) {\n return;\n }\n\n const source = await existingSkill.instructions.source.load();\n setInstructions(source.content ?? '');\n }, [existingSkill]);\n\n const handleSave = useCallback(async () => {\n if (!db) {\n return;\n }\n\n setCreating(true);\n try {\n if (existingSkill) {\n const text = await existingSkill.instructions.source.load();\n Obj.update(text, (text) => {\n text.content = instructions;\n });\n\n if (fnKey) {\n const toolId = ToolId.make(fnKey);\n if (!existingSkill.tools?.includes(toolId)) {\n Obj.update(existingSkill, (existingSkill) => {\n existingSkill.tools = [...(existingSkill.tools ?? []), toolId];\n });\n }\n }\n } else if (fnKey) {\n db.add(\n Skill.make({\n key: skillKey,\n name: object.name ?? 'Script',\n instructions: Template.make({ source: instructions }),\n tools: [ToolId.make(fnKey)],\n }),\n );\n }\n await db.flush();\n } finally {\n setCreating(false);\n }\n }, [db, existingSkill, fnKey, skillKey, object.name, instructions]);\n\n return (\n <Flex column>\n <Form.Section title={t('skill-editor.label')} description={t('skill-editor.description')} />\n\n <Input.Root>\n <Input.Label>{t('skill-instructions.label')}</Input.Label>\n <Input.TextArea\n placeholder={t('skill-instructions.placeholder')}\n rows={6}\n value={instructions}\n onChange={(event) => setInstructions(event.target.value)}\n classNames='resize-y'\n />\n </Input.Root>\n\n <div className='pt-2'>\n <Button disabled={(!existingSkill && !fnKey) || creating} onClick={handleSave}>\n {t(existingSkill ? 'update-skill.label' : 'create-skill.label')}\n </Button>\n </div>\n </Flex>\n );\n};\n\nSkillEditor.displayName = 'SkillEditor';\n","//\n// Copyright 2024 DXOS.org\n//\n\nimport React from 'react';\n\nimport { type AppSurface } from '@dxos/app-toolkit/ui';\nimport type * as Script from '@dxos/compute/Script';\nimport { Form } from '@dxos/react-ui-form';\n\nimport { FunctionBinding } from './FunctionBinding';\nimport { FunctionPublishing } from './FunctionPublishing';\nimport { SkillEditor } from './SkillEditor';\n\nexport type ScriptPropertiesProps = AppSurface.ObjectPropertiesProps<Script.Script>;\n\nexport const ScriptProperties = ({ subject: object }: ScriptPropertiesProps) => {\n return (\n <>\n <Form.Section>\n <FunctionBinding object={object} />\n </Form.Section>\n <Form.Section>\n <SkillEditor object={object} />\n </Form.Section>\n <Form.Section>\n <FunctionPublishing object={object} />\n </Form.Section>\n </>\n );\n};\n\nScriptProperties.displayName = 'ScriptProperties';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAoBA,IAAa,mBAAmB,EAAE,aAAmC;CACnE,MAAM,EAAE,MAAM,eAAe,KAAK,QAAQ,GAAG;CAC7C,MAAM,SAAS,UAAU;CACzB,MAAM,KAAK,IAAI,YAAY,MAAM;CAEjC,MAAM,CAAC,MAAM,SAAS,IAAI,OAAO,KAAK,UAAU,qBAAqB,EAAE,QAAQ,IAAI,KAAK,MAAM,EAAE,CAAC,CAAC;CAClG,MAAM,aAAa,MAAM,4BAA4B,IAAI,QAAQ,EAAE,CAAC;CACpE,MAAM,cACJ,cACA,iBAAiB,YAAY,OAAO,OAAO,OAAO,SAAS,UAAU,MAAM,OAAO,IAAI,EACpF,SAAS,IAAI,QACf,CAAC;CAEH,MAAM,CAAC,SAAS,cAAc,mBAAmB,IAAI,WAAW,EAAE;CAClE,MAAM,sBAAsB,aACzB,UAAyC,WAAW,MAAM,OAAO,KAAK,GACvE,CAAC,UAAU,CACb;CAEA,MAAM,oBAAoB,kBAAkB;EAC1C,IAAI,IACF,IAAI,OAAO,KAAK,OAAO;GACrB,GAAG,UAAU;EACf,CAAC;CAEL,GAAG,CAAC,IAAI,OAAO,CAAC;CAEhB,IAAI,CAAC,IACH,OAAO;CAGT,OACE,qBAAC,MAAD;EAAM,QAAA;EAAN,UAAA;GACE,oBAAC,KAAK,S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C/C,MAAM;IACN,OAAO;IACP,WAAW,UAAU,gBAAgB,MAAM,OAAO,KAAK;IACvD,YAAW;GACZ,CAAA,CACS,EAAA,CAAA;GAEZ,oBAAC,OAAD;IAAK,WAAU;IACb,UAAA,oBAAC,QAAD;KAAQ,UAAW,CAAC,iBAAiB,CAAC,SAAU;KAAU,SAAS;KAChE,UAAA,EAAE,gBAAgB,uBAAuB,oBAAoB;IACxD,CAAA;GACL,CAAA;EACD;;AAEV;AAEA,YAAY,cAAc;;;ACxF1B,IAAa,oBAAoB,EAAE,SAAS,aAAoC;CAC9E,OACE,qBAAA,UAAA,EAAA,UAAA;EACE,oBAAC,KAAK,SAAN,EAAA,UACE,oBAAC,iBAAD,EAAyB,OAAS,CAAA,EACtB,CAAA;EACd,oBAAC,KAAK,SAAN,EAAA,UACE,oBAAC,aAAD,EAAqB,OAAS,CAAA,EAClB,CAAA;EACd,oBAAC,KAAK,SAAN,EAAA,UACE,oBAAC,oBAAD,EAA4B,OAAS,CAAA,EACzB,CAAA;CACd,EAAA,CAAA;AAEN;AAEA,iBAAiB,cAAc"}
1
+ {"version":3,"file":"chunk-ScriptProperties.mjs","names":[],"sources":["../../src/containers/ScriptProperties/FunctionBinding.tsx","../../src/containers/ScriptProperties/FunctionPublishing.tsx","../../src/containers/ScriptProperties/SkillEditor.tsx","../../src/containers/ScriptProperties/ScriptProperties.tsx"],"sourcesContent":["//\n// Copyright 2024 DXOS.org\n//\n\nimport React, { type ChangeEvent, useCallback } from 'react';\n\nimport { getInvocationUrl, getUserFunctionIdInMetadata } from '@dxos/compute-runtime';\nimport * as Operation from '@dxos/compute/Operation';\nimport type * as Script from '@dxos/compute/Script';\nimport { Filter, Obj, Ref } from '@dxos/echo';\nimport { useQuery } from '@dxos/echo-react';\nimport { useClient } from '@dxos/react-client';\nimport { Form } from '@dxos/react-ui-form';\nimport * as Field from '@dxos/react-ui/Field';\nimport * as Hooks from '@dxos/react-ui/Hooks';\nimport * as Input from '@dxos/react-ui/Input';\nimport * as SystemButton from '@dxos/react-ui/SystemButton';\n\nimport { meta } from '#meta';\n\nexport type FunctionBindingProps = { object: Script.Script };\n\nexport const FunctionBinding = ({ object }: FunctionBindingProps) => {\n const { t } = Hooks.useTranslation(meta.profile.key);\n const client = useClient();\n const db = Obj.getDatabase(object);\n\n const [fn] = useQuery(db, Filter.type(Operation.PersistentOperation, { source: Ref.make(object) }));\n const functionId = fn && getUserFunctionIdInMetadata(Obj.getMeta(fn));\n const functionUrl =\n functionId &&\n getInvocationUrl(functionId, client.config.values.runtime?.services?.edge?.url ?? '', {\n spaceId: db?.spaceId,\n });\n\n const [binding, setBinding] = Hooks.useControlledState(fn?.binding ?? '');\n const handleBindingChange = useCallback(\n (event: ChangeEvent<HTMLInputElement>) => setBinding(event.target.value),\n [setBinding],\n );\n\n const handleBindingBlur = useCallback(() => {\n if (fn) {\n Obj.update(fn, (fn) => {\n fn.binding = binding;\n });\n }\n }, [fn, binding]);\n\n if (!fn) {\n return null;\n }\n\n return (\n <Form.FieldSet label={t('remote-function-settings.heading')}>\n {functionUrl && (\n <Field.Root>\n <Field.Label>{t('function-url.label')}</Field.Label>\n <Input.Root\n disabled\n value={functionUrl}\n onChange={(event) => {\n Obj.update(fn, (fn) => {\n fn.name = event.target.value;\n });\n }}\n />\n <SystemButton.Clipboard iconOnly value={functionUrl} />\n </Field.Root>\n )}\n\n <Field.Root>\n <Field.Label>{t('function-binding.label')}</Field.Label>\n <Input.Root\n placeholder={t('function-binding.placeholder')}\n value={binding}\n onChange={handleBindingChange}\n onBlur={handleBindingBlur}\n />\n </Field.Root>\n </Form.FieldSet>\n );\n};\n\nFunctionBinding.displayName = 'FunctionBinding';\n","//\n// Copyright 2024 DXOS.org\n//\n\nimport { Octokit } from '@octokit/core';\nimport React, { useCallback, useState } from 'react';\n\nimport * as Hooks from '@dxos/app-framework/Hooks';\nimport * as SettingsOperation from '@dxos/app-toolkit/SettingsOperation';\nimport type * as Script from '@dxos/compute/Script';\nimport { Filter, Obj } from '@dxos/echo';\nimport { useQuery } from '@dxos/echo-react';\nimport { AccessToken } from '@dxos/link';\nimport { log } from '@dxos/log';\nimport { Form } from '@dxos/react-ui-form';\nimport * as Banner from '@dxos/react-ui/Banner';\nimport * as Button from '@dxos/react-ui/Button';\nimport * as UiHooks from '@dxos/react-ui/Hooks';\nimport * as Layout from '@dxos/react-ui/Layout';\nimport * as SystemButton from '@dxos/react-ui/SystemButton';\nimport { kebabize } from '@dxos/util';\n\nimport { meta } from '#meta';\n\nexport type FunctionPublishingProps = { object: Script.Script };\n\n// TODO(burdon): Move to separate tab?\nexport const FunctionPublishing = ({ object }: FunctionPublishingProps) => {\n const { t } = UiHooks.useTranslation(meta.profile.key);\n const { invokePromise } = Hooks.useOperationInvoker();\n const db = Obj.getDatabase(object);\n\n const [githubToken] = useQuery(db, Filter.type(AccessToken.AccessToken, { source: 'github.com' }));\n const gistKey = Obj.getMeta(object).keys.find(({ source }) => source === 'github.com');\n const [gistUrl, setGistUrl] = useState<string | undefined>();\n\n UiHooks.useAsyncEffect(async () => {\n const token = githubToken?.token;\n const gistId = gistKey?.id;\n if (!token || !gistId) {\n setGistUrl(undefined);\n return;\n }\n\n try {\n const octokit = new Octokit({ auth: githubToken.token });\n const response = await octokit.request('GET /gists/{gist_id}', {\n gist_id: gistId,\n });\n setGistUrl(response.data.html_url);\n } catch (err) {\n log.catch(err);\n setGistUrl(undefined);\n }\n }, [githubToken, gistKey]);\n\n const handleOpenTokenManager = useCallback(\n () =>\n invokePromise(SettingsOperation.Open, {\n plugin: 'org.dxos.plugin.token-manager',\n }),\n [invokePromise],\n );\n\n const [publishing, setPublishing] = useState(false);\n const handlePublish = useCallback(async () => {\n setPublishing(true);\n const octokit = new Octokit({ auth: githubToken.token });\n const source = await object.source.load();\n const filename = object.name ? kebabize(object.name) : 'composer-script';\n const files = { [`${filename}.ts`]: { content: source.content } };\n\n try {\n // TODO(wittjosiah): Factor out to intent.\n const meta = Obj.getMeta(object);\n const githubKey = meta.keys.find(({ source }) => source === 'github.com');\n const gistId = githubKey?.id;\n if (gistId) {\n await octokit.request('PATCH /gists/{gist_id}', {\n gist_id: gistId,\n files,\n });\n } else {\n const response = await octokit.request('POST /gists', {\n public: true,\n files,\n });\n const gistId = response.data.id;\n if (gistId) {\n Obj.update(object, (object) => {\n Obj.getMeta(object).keys.push({ source: 'github.com', id: gistId });\n });\n }\n }\n } finally {\n setPublishing(false);\n }\n }, [object, githubToken]);\n\n return (\n <Form.FieldSet label={t('script-publish-settings.label')} description={t('script-publish-settings.description')}>\n {!githubToken && (\n <Layout.Flex column classNames='py-form-gap'>\n <Banner.Root valence='info'>\n <Banner.Title>{t('no-github-token.label')}</Banner.Title>\n </Banner.Root>\n <Layout.Flex classNames='pt-form-gap'>\n <Button.Root onClick={handleOpenTokenManager}>{t('open-token-manager.label')}</Button.Root>\n </Layout.Flex>\n </Layout.Flex>\n )}\n\n {githubToken && (\n <Layout.Flex gap='sm' justify='end'>\n {gistUrl && <SystemButton.Clipboard iconOnly value={gistUrl} />}\n <Button.Root disabled={publishing} onClick={handlePublish}>\n {t('publish.label')}\n </Button.Root>\n </Layout.Flex>\n )}\n </Form.FieldSet>\n );\n};\n\nFunctionPublishing.displayName = 'FunctionPublishing';\n","//\n// Copyright 2024 DXOS.org\n//\n\nimport React, { useCallback, useState } from 'react';\n\nimport { ToolId } from '@dxos/ai';\nimport * as Operation from '@dxos/compute/Operation';\nimport type * as Script from '@dxos/compute/Script';\nimport * as Skill from '@dxos/compute/Skill';\nimport * as Template from '@dxos/compute/Template';\nimport { Filter, Obj, Ref } from '@dxos/echo';\nimport { useQuery } from '@dxos/echo-react';\nimport { Form } from '@dxos/react-ui-form';\nimport * as Button from '@dxos/react-ui/Button';\nimport * as Field from '@dxos/react-ui/Field';\nimport * as Hooks from '@dxos/react-ui/Hooks';\nimport * as Input from '@dxos/react-ui/Input';\nimport { kebabize } from '@dxos/util';\n\nimport { meta } from '#meta';\n\nexport type SkillEditorProps = { object: Script.Script };\n\nexport const SkillEditor = ({ object }: SkillEditorProps) => {\n const { t } = Hooks.useTranslation(meta.profile.key);\n const db = Obj.getDatabase(object);\n const [fn] = useQuery(db, Filter.type(Operation.PersistentOperation, { source: Ref.make(object) }));\n const skills = useQuery(db, Filter.type(Skill.Skill));\n\n const [creating, setCreating] = useState(false);\n // TODO(burdon): Remove?\n const [instructions, setInstructions] = useState<string>(`You can run the script \"${object.name ?? 'script'}\".`);\n const skillKey = `org.dxos.skill.${kebabize(object.name ?? 'script')}`;\n const existingSkill = skills.find((bp) => Obj.getMeta(bp).key === skillKey);\n const fnKey = fn ? Obj.getMeta(fn).key : undefined;\n\n Hooks.useAsyncEffect(async () => {\n if (!existingSkill) {\n return;\n }\n\n const source = await existingSkill.instructions.source.load();\n setInstructions(source.content ?? '');\n }, [existingSkill]);\n\n const handleSave = useCallback(async () => {\n if (!db) {\n return;\n }\n\n setCreating(true);\n try {\n if (existingSkill) {\n const text = await existingSkill.instructions.source.load();\n Obj.update(text, (text) => {\n text.content = instructions;\n });\n\n if (fnKey) {\n const toolId = ToolId.make(fnKey);\n if (!existingSkill.tools?.includes(toolId)) {\n Obj.update(existingSkill, (existingSkill) => {\n existingSkill.tools ??= [];\n existingSkill.tools.push(toolId);\n });\n }\n }\n } else if (fnKey) {\n db.add(\n Skill.make({\n key: skillKey,\n name: object.name ?? 'Script',\n instructions: Template.make({ source: instructions }),\n tools: [ToolId.make(fnKey)],\n }),\n );\n }\n await db.flush();\n } finally {\n setCreating(false);\n }\n }, [db, existingSkill, fnKey, skillKey, object.name, instructions]);\n\n return (\n <Form.FieldSet label={t('skill-editor.label')} description={t('skill-editor.description')}>\n <Field.Root>\n <Field.Label>{t('skill-instructions.label')}</Field.Label>\n <Input.Textarea\n placeholder={t('skill-instructions.placeholder')}\n rows={6}\n value={instructions}\n onChange={(event) => setInstructions(event.target.value)}\n classNames='resize-y'\n />\n </Field.Root>\n\n <div className='pt-2'>\n <Button.Root disabled={(!existingSkill && !fnKey) || creating} onClick={handleSave}>\n {t(existingSkill ? 'update-skill.label' : 'create-skill.label')}\n </Button.Root>\n </div>\n </Form.FieldSet>\n );\n};\n\nSkillEditor.displayName = 'SkillEditor';\n","//\n// Copyright 2024 DXOS.org\n//\n\nimport React from 'react';\n\nimport type * as AppSurface from '@dxos/app-toolkit/AppSurface';\nimport type * as Script from '@dxos/compute/Script';\nimport { Form } from '@dxos/react-ui-form';\n\nimport { FunctionBinding } from './FunctionBinding.tsx';\nimport { FunctionPublishing } from './FunctionPublishing.tsx';\nimport { SkillEditor } from './SkillEditor.tsx';\n\nexport type ScriptPropertiesProps = AppSurface.ObjectPropertiesProps<Script.Script>;\n\nexport const ScriptProperties = ({ subject: object }: ScriptPropertiesProps) => {\n return (\n <>\n <Form.FieldSet>\n <FunctionBinding object={object} />\n </Form.FieldSet>\n <Form.FieldSet>\n <SkillEditor object={object} />\n </Form.FieldSet>\n <Form.FieldSet>\n <FunctionPublishing object={object} />\n </Form.FieldSet>\n </>\n );\n};\n\nScriptProperties.displayName = 'ScriptProperties';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAsBA,IAAa,mBAAmB,EAAE,aAAmC;CACnE,MAAM,EAAE,MAAM,QAAM,eAAe,KAAK,QAAQ,GAAG;CACnD,MAAM,SAAS,UAAU;CACzB,MAAM,KAAK,IAAI,YAAY,MAAM;CAEjC,MAAM,CAAC,MAAM,SAAS,IAAI,OAAO,KAAK,UAAU,qBAAqB,EAAE,QAAQ,IAAI,KAAK,MAAM,EAAE,CAAC,CAAC;CAClG,MAAM,aAAa,MAAM,4BAA4B,IAAI,QAAQ,EAAE,CAAC;CACpE,MAAM,cACJ,cACA,iBAAiB,YAAY,OAAO,OAAO,OAAO,SAAS,UAAU,MAAM,OAAO,IAAI,EACpF,SAAS,IAAI,QACf,CAAC;CAEH,MAAM,CAAC,SAAS,cAAc,QAAM,mBAAmB,IAAI,WAAW,EAAE;CACxE,MAAM,sBAAsB,aACzB,UAAyC,WAAW,MAAM,O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B;EAAG,aAAa,EAAE,0BAA0B;EAAxF,UAAA,CACE,qBAAC,MAAM,MAAP,EAAA,UAAA,CACE,oBAAC,MAAM,OAAP,EAAA,UAAc,EAAE,0BAA0B,EAAe,CAAA,GACzD,oBAAC,MAAM,UAAP;GACE,aAAa,EAAE,gCAAgC;GAC/C,MAAM;GACN,OAAO;GACP,WAAW,UAAU,gBAAgB,MAAM,OAAO,KAAK;GACvD,YAAW;EACZ,CAAA,CACS,EAAA,CAAA,GAEZ,oBAAC,OAAD;GAAK,WAAU;GACb,UAAA,oBAAC,OAAO,MAAR;IAAa,UAAW,CAAC,iBAAiB,CAAC,SAAU;IAAU,SAAS;IACrE,UAAA,EAAE,gBAAgB,uBAAuB,oBAAoB;GACnD,CAAA;EACV,CAAA,CACQ;;AAEnB;AAEA,YAAY,cAAc;;;AC1F1B,IAAa,oBAAoB,EAAE,SAAS,aAAoC;CAC9E,OACE,qBAAA,UAAA,EAAA,UAAA;EACE,oBAAC,KAAK,UAAN,EAAA,UACE,oBAAC,iBAAD,EAAyB,OAAS,CAAA,EACrB,CAAA;EACf,oBAAC,KAAK,UAAN,EAAA,UACE,oBAAC,aAAD,EAAqB,OAAS,CAAA,EACjB,CAAA;EACf,oBAAC,KAAK,UAAN,EAAA,UACE,oBAAC,oBAAD,EAA4B,OAAS,CAAA,EACxB,CAAA;CACf,EAAA,CAAA;AAEN;AAEA,iBAAiB,cAAc"}
@@ -1,12 +1,13 @@
1
1
  import { Settings } from "#types";
2
2
  import { meta } from "#meta";
3
3
  import "react";
4
- import { Button, useTranslation } from "@dxos/react-ui";
4
+ import * as Hooks from "@dxos/react-ui/Hooks";
5
5
  import { jsx, jsxs } from "react/jsx-runtime";
6
+ import * as Button from "@dxos/react-ui/Button";
6
7
  import { Form } from "@dxos/react-ui-form";
7
8
  //#region src/containers/ScriptSettings/ScriptSettings.tsx
8
- var ScriptSettings = ({ settings, onSettingsChange, onAuthenticate }) => {
9
- const { t } = useTranslation(meta.profile.key);
9
+ var ScriptSettings = ({ settings, onSettingsChange, scope, onAuthenticate }) => {
10
+ const { t } = Hooks.useTranslation(meta.profile.key);
10
11
  return /* @__PURE__ */ jsx(Form.Root, {
11
12
  schema: Settings.Settings,
12
13
  values: settings,
@@ -18,17 +19,19 @@ var ScriptSettings = ({ settings, onSettingsChange, onAuthenticate }) => {
18
19
  })),
19
20
  children: /* @__PURE__ */ jsx(Form.Viewport, {
20
21
  scroll: true,
21
- children: /* @__PURE__ */ jsx(Form.Content, { children: /* @__PURE__ */ jsxs(Form.Section, {
22
- title: meta.profile.name ?? meta.profile.key,
23
- children: [/* @__PURE__ */ jsx(Form.Row, {
22
+ children: /* @__PURE__ */ jsx(Form.Content, { children: /* @__PURE__ */ jsxs(Form.FieldSet, {
23
+ label: meta.profile.name ?? meta.profile.key,
24
+ actions: scope,
25
+ children: [/* @__PURE__ */ jsx(Form.Field, {
26
+ standalone: true,
24
27
  label: t("authenticate-action.label"),
25
28
  description: t("authenticate-action.description"),
26
- children: /* @__PURE__ */ jsx(Button, {
29
+ children: /* @__PURE__ */ jsx(Button.Root, {
27
30
  disabled: !onSettingsChange,
28
31
  onClick: onAuthenticate,
29
32
  children: t("authenticate-button.label")
30
33
  })
31
- }), /* @__PURE__ */ jsx(Form.FieldSet, {})]
34
+ }), /* @__PURE__ */ jsx(Form.Fields, {})]
32
35
  }) })
33
36
  })
34
37
  });
@@ -1 +1 @@
1
- {"version":3,"file":"chunk-ScriptSettings.mjs","names":[],"sources":["../../src/containers/ScriptSettings/ScriptSettings.tsx"],"sourcesContent":["//\n// Copyright 2023 DXOS.org\n//\n\nimport React from 'react';\n\nimport { type AppSurface } from '@dxos/app-toolkit/ui';\nimport { Button, useTranslation } from '@dxos/react-ui';\nimport { Form } from '@dxos/react-ui-form';\n\nimport { meta } from '#meta';\nimport { Settings } from '#types';\n\nexport type ScriptSettingsProps = AppSurface.SettingsProps<\n Settings.Settings,\n {\n onAuthenticate?: () => void;\n }\n>;\n\nexport const ScriptSettings = ({ settings, onSettingsChange, onAuthenticate }: ScriptSettingsProps) => {\n const { t } = useTranslation(meta.profile.key);\n\n return (\n <Form.Root\n schema={Settings.Settings}\n values={settings}\n variant='settings'\n readonly={!onSettingsChange}\n onValuesChanged={(values) => onSettingsChange?.((current) => ({ ...current, ...values }))}\n >\n <Form.Viewport scroll>\n <Form.Content>\n <Form.Section title={meta.profile.name ?? meta.profile.key}>\n {/* TODO(wittjosiah): Hide outside of dev environments. */}\n <Form.Row label={t('authenticate-action.label')} description={t('authenticate-action.description')}>\n <Button disabled={!onSettingsChange} onClick={onAuthenticate}>\n {t('authenticate-button.label')}\n </Button>\n </Form.Row>\n <Form.FieldSet />\n </Form.Section>\n </Form.Content>\n </Form.Viewport>\n </Form.Root>\n );\n};\n\nScriptSettings.displayName = 'ScriptSettings';\n"],"mappings":";;;;;;;AAoBA,IAAa,kBAAkB,EAAE,UAAU,kBAAkB,qBAA0C;CACrG,MAAM,EAAE,MAAM,eAAe,KAAK,QAAQ,GAAG;CAE7C,OACE,oBAAC,KAAK,MAAN;EACE,QAAQ,SAAS;EACjB,QAAQ;EACR,SAAQ;EACR,UAAU,CAAC;EACX,kBAAkB,WAAW,oBAAoB,aAAa;GAAE,GAAG;GAAS,GAAG;EAAO,EAAE;EAExF,UAAA,oBAAC,KAAK,UAAN;GAAe,QAAA;GACb,UAAA,oBAAC,KAAK,SAAN,EAAA,UACE,qBAAC,KAAK,SAAN;IAAc,OAAO,KAAK,QAAQ,QAAQ,KAAK,QAAQ;IAAvD,UAAA,CAEE,oBAAC,KAAK,KAAN;KAAU,OAAO,EAAE,2BAA2B;KAAG,aAAa,EAAE,iCAAiC;KAC/F,UAAA,oBAAC,QAAD;MAAQ,UAAU,CAAC;MAAkB,SAAS;MAC3C,UAAA,EAAE,2BAA2B;KACxB,CAAA;IACA,CAAA,GACV,oBAAC,KAAK,UAAN,CAAgB,CAAA,CACJ;GACF,CAAA,EAAA,CAAA;EACD,CAAA;CACN,CAAA;AAEf;AAEA,eAAe,cAAc"}
1
+ {"version":3,"file":"chunk-ScriptSettings.mjs","names":[],"sources":["../../src/containers/ScriptSettings/ScriptSettings.tsx"],"sourcesContent":["//\n// Copyright 2023 DXOS.org\n//\n\nimport React from 'react';\n\nimport type * as AppSurface from '@dxos/app-toolkit/AppSurface';\nimport { Form } from '@dxos/react-ui-form';\nimport * as Button from '@dxos/react-ui/Button';\nimport * as Hooks from '@dxos/react-ui/Hooks';\n\nimport { meta } from '#meta';\nimport { Settings } from '#types';\n\nexport type ScriptSettingsProps = AppSurface.SettingsProps<\n Settings.Settings,\n {\n onAuthenticate?: () => void;\n }\n>;\n\nexport const ScriptSettings = ({ settings, onSettingsChange, scope, onAuthenticate }: ScriptSettingsProps) => {\n const { t } = Hooks.useTranslation(meta.profile.key);\n\n return (\n <Form.Root\n schema={Settings.Settings}\n values={settings}\n variant='settings'\n readonly={!onSettingsChange}\n onValuesChanged={(values) => onSettingsChange?.((current) => ({ ...current, ...values }))}\n >\n <Form.Viewport scroll>\n <Form.Content>\n <Form.FieldSet label={meta.profile.name ?? meta.profile.key} actions={scope}>\n {/* TODO(wittjosiah): Hide outside of dev environments. */}\n <Form.Field\n standalone\n label={t('authenticate-action.label')}\n description={t('authenticate-action.description')}\n >\n <Button.Root disabled={!onSettingsChange} onClick={onAuthenticate}>\n {t('authenticate-button.label')}\n </Button.Root>\n </Form.Field>\n <Form.Fields />\n </Form.FieldSet>\n </Form.Content>\n </Form.Viewport>\n </Form.Root>\n );\n};\n\nScriptSettings.displayName = 'ScriptSettings';\n"],"mappings":";;;;;;;;AAqBA,IAAa,kBAAkB,EAAE,UAAU,kBAAkB,OAAO,qBAA0C;CAC5G,MAAM,EAAE,MAAM,MAAM,eAAe,KAAK,QAAQ,GAAG;CAEnD,OACE,oBAAC,KAAK,MAAN;EACE,QAAQ,SAAS;EACjB,QAAQ;EACR,SAAQ;EACR,UAAU,CAAC;EACX,kBAAkB,WAAW,oBAAoB,aAAa;GAAE,GAAG;GAAS,GAAG;EAAO,EAAE;EAExF,UAAA,oBAAC,KAAK,UAAN;GAAe,QAAA;GACb,UAAA,oBAAC,KAAK,SAAN,EAAA,UACE,qBAAC,KAAK,UAAN;IAAe,OAAO,KAAK,QAAQ,QAAQ,KAAK,QAAQ;IAAK,SAAS;IAAtE,UAAA,CAEE,oBAAC,KAAK,OAAN;KACE,YAAA;KACA,OAAO,EAAE,2BAA2B;KACpC,aAAa,EAAE,iCAAiC;KAEhD,UAAA,oBAAC,OAAO,MAAR;MAAa,UAAU,CAAC;MAAkB,SAAS;MAChD,UAAA,EAAE,2BAA2B;KACnB,CAAA;IACH,CAAA,GACZ,oBAAC,KAAK,QAAN,CAAc,CAAA,CACD;GACH,CAAA,EAAA,CAAA;EACD,CAAA;CACN,CAAA;AAEf;AAEA,eAAe,cAAc"}
@@ -1,10 +1,10 @@
1
1
  import { Obj } from "@dxos/echo";
2
- import { Context } from "@dxos/context";
3
- import { FunctionsServiceClient } from "@dxos/edge-compute";
4
2
  import { useCallback, useMemo } from "react";
5
- import { Panel } from "@dxos/react-ui";
6
3
  import { jsx } from "react/jsx-runtime";
7
4
  import { useDeployDeps } from "#hooks";
5
+ import { Context } from "@dxos/context";
6
+ import { FunctionsServiceClient } from "@dxos/edge-compute";
7
+ import * as Panel from "@dxos/react-ui/Panel";
8
8
  import { TestPanel } from "#components";
9
9
  //#region src/containers/TestContainer/TestContainer.tsx
10
10
  var __dxlog_file = "/__w/dxos/dxos/packages/plugins/plugin-script/src/containers/TestContainer/TestContainer.tsx";
@@ -26,8 +26,8 @@ var TestContainer = ({ role, script }) => {
26
26
  ]);
27
27
  return /* @__PURE__ */ jsx(Panel.Root, {
28
28
  role,
29
- classNames: "dx-document",
30
- children: /* @__PURE__ */ jsx(Panel.Content, {
29
+ width: "document",
30
+ children: /* @__PURE__ */ jsx(Panel.Body, {
31
31
  asChild: true,
32
32
  children: /* @__PURE__ */ jsx(TestPanel, { onInvoke: existingFunctionId ? handleInvoke : void 0 })
33
33
  })
@@ -1 +1 @@
1
- {"version":3,"file":"chunk-TestContainer.mjs","names":[],"sources":["../../src/containers/TestContainer/TestContainer.tsx"],"sourcesContent":["//\n// Copyright 2025 DXOS.org\n//\n\nimport React, { useCallback, useMemo } from 'react';\n\nimport type * as Script from '@dxos/compute/Script';\nimport { Context } from '@dxos/context';\nimport { Obj } from '@dxos/echo';\nimport { FunctionsServiceClient } from '@dxos/edge-compute';\nimport { Panel } from '@dxos/react-ui';\n\nimport { TestPanel } from '#components';\nimport { useDeployDeps } from '#hooks';\n\nexport type TestContainerProps = {\n role: string;\n script: Script.Script;\n};\n\nexport const TestContainer = ({ role, script }: TestContainerProps) => {\n const { client, fn, existingFunctionId } = useDeployDeps({ script });\n const spaceId = Obj.getDatabase(script)?.spaceId;\n\n const functionsClient = useMemo(() => FunctionsServiceClient.fromClient(client), [client]);\n\n const handleInvoke = useCallback(\n async (input: unknown) => {\n if (!fn) {\n throw new Error('Function not deployed');\n }\n return functionsClient.invoke(Context.default(), fn, input, { spaceId });\n },\n [fn, functionsClient, spaceId],\n );\n\n return (\n <Panel.Root role={role} classNames='dx-document'>\n <Panel.Content asChild>\n <TestPanel onInvoke={existingFunctionId ? handleInvoke : undefined} />\n </Panel.Content>\n </Panel.Root>\n );\n};\n\nTestContainer.displayName = 'TestContainer';\n"],"mappings":";;;;;;;;;;AAoBA,IAAa,iBAAiB,EAAE,MAAM,aAAiC;CACrE,MAAM,EAAE,QAAQ,IAAI,uBAAuB,cAAc,EAAE,OAAO,CAAC;CACnE,MAAM,UAAU,IAAI,YAAY,MAAM,CAAC,EAAE;CAEzC,MAAM,kBAAkB,cAAc,uBAAuB,WAAW,MAAM,GAAG,CAAC,MAAM,CAAC;CAEzF,MAAM,eAAe,YACnB,OAAO,UAAmB;EACxB,IAAI,CAAC,IACH,MAAM,IAAI,MAAM,uBAAuB;EAEzC,OAAO,gBAAgB,OAAO,QAAQ,QAAO,KAAA,GAAA;GAAA,YAAA;GAAA,GAAA;GAAA,GAAA;EAAA,CAAC,GAAG,IAAI,OAAO,EAAE,QAAQ,CAAC;CACzE,GACA;EAAC;EAAI;EAAiB;CAAO,CAC/B;CAEA,OACE,oBAAC,MAAM,MAAP;EAAkB;EAAM,YAAW;EACjC,UAAA,oBAAC,MAAM,SAAP;GAAe,SAAA;GACb,UAAA,oBAAC,WAAD,EAAW,UAAU,qBAAqB,eAAe,KAAA,EAAY,CAAA;EACxD,CAAA;CACL,CAAA;AAEhB;AAEA,cAAc,cAAc"}
1
+ {"version":3,"file":"chunk-TestContainer.mjs","names":[],"sources":["../../src/containers/TestContainer/TestContainer.tsx"],"sourcesContent":["//\n// Copyright 2025 DXOS.org\n//\n\nimport React, { useCallback, useMemo } from 'react';\n\nimport type * as Script from '@dxos/compute/Script';\nimport { Context } from '@dxos/context';\nimport { Obj } from '@dxos/echo';\nimport { FunctionsServiceClient } from '@dxos/edge-compute';\nimport * as Panel from '@dxos/react-ui/Panel';\n\nimport { TestPanel } from '#components';\nimport { useDeployDeps } from '#hooks';\n\nexport type TestContainerProps = {\n role: string;\n script: Script.Script;\n};\n\nexport const TestContainer = ({ role, script }: TestContainerProps) => {\n const { client, fn, existingFunctionId } = useDeployDeps({ script });\n const spaceId = Obj.getDatabase(script)?.spaceId;\n\n const functionsClient = useMemo(() => FunctionsServiceClient.fromClient(client), [client]);\n\n const handleInvoke = useCallback(\n async (input: unknown) => {\n if (!fn) {\n throw new Error('Function not deployed');\n }\n return functionsClient.invoke(Context.default(), fn, input, { spaceId });\n },\n [fn, functionsClient, spaceId],\n );\n\n return (\n <Panel.Root role={role} width='document'>\n <Panel.Body asChild>\n <TestPanel onInvoke={existingFunctionId ? handleInvoke : undefined} />\n </Panel.Body>\n </Panel.Root>\n );\n};\n\nTestContainer.displayName = 'TestContainer';\n"],"mappings":";;;;;;;;;;AAoBA,IAAa,iBAAiB,EAAE,MAAM,aAAiC;CACrE,MAAM,EAAE,QAAQ,IAAI,uBAAuB,cAAc,EAAE,OAAO,CAAC;CACnE,MAAM,UAAU,IAAI,YAAY,MAAM,CAAC,EAAE;CAEzC,MAAM,kBAAkB,cAAc,uBAAuB,WAAW,MAAM,GAAG,CAAC,MAAM,CAAC;CAEzF,MAAM,eAAe,YACnB,OAAO,UAAmB;EACxB,IAAI,CAAC,IACH,MAAM,IAAI,MAAM,uBAAuB;EAEzC,OAAO,gBAAgB,OAAO,QAAQ,QAAO,KAAA,GAAA;GAAA,YAAA;GAAA,GAAA;GAAA,GAAA;EAAA,CAAC,GAAG,IAAI,OAAO,EAAE,QAAQ,CAAC;CACzE,GACA;EAAC;EAAI;EAAiB;CAAO,CAC/B;CAEA,OACE,oBAAC,MAAM,MAAP;EAAkB;EAAM,OAAM;EAC5B,UAAA,oBAAC,MAAM,MAAP;GAAY,SAAA;GACV,UAAA,oBAAC,WAAD,EAAW,UAAU,qBAAqB,eAAe,KAAA,EAAY,CAAA;EAC3D,CAAA;CACF,CAAA;AAEhB;AAEA,cAAc,cAAc"}
@@ -9,6 +9,7 @@ import * as AppNode from "@dxos/app-toolkit/AppNode";
9
9
  var app_graph_builder_default = Capability.makeModule(Effect.fnUntraced(function* () {
10
10
  const extensions = yield* Effect.all([AppGraphBuilder.createTypeExtension({
11
11
  id: "execute",
12
+ relation: AppNode.companion,
12
13
  type: Script.Script,
13
14
  connector: () => Effect.succeed([AppNode.makeCompanion({
14
15
  variant: "execute",
@@ -18,6 +19,7 @@ var app_graph_builder_default = Capability.makeModule(Effect.fnUntraced(function
18
19
  })])
19
20
  }), AppGraphBuilder.createTypeExtension({
20
21
  id: "logs",
22
+ relation: AppNode.companion,
21
23
  type: Script.Script,
22
24
  connector: () => Effect.succeed([AppNode.makeCompanion({
23
25
  variant: "logs",
@@ -1 +1 @@
1
- {"version":3,"file":"chunk-app-graph-builder.mjs","names":[],"sources":["../../src/capabilities/app-graph-builder.ts"],"sourcesContent":["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\n\nimport * as Capability from '@dxos/app-framework/Capability';\nimport * as AppGraphBuilder from '@dxos/app-graph/AppGraphBuilder';\nimport * as AppCapabilities from '@dxos/app-toolkit/AppCapabilities';\nimport * as AppNode from '@dxos/app-toolkit/AppNode';\nimport * as Script from '@dxos/compute/Script';\n\nimport { meta } from '#meta';\n\nexport default Capability.makeModule(\n Effect.fnUntraced(function* () {\n const extensions = yield* Effect.all([\n AppGraphBuilder.createTypeExtension({\n id: 'execute',\n type: Script.Script,\n connector: () =>\n Effect.succeed([\n AppNode.makeCompanion({\n variant: 'execute',\n label: ['script-test.label', { ns: meta.profile.key }],\n icon: 'ph--terminal--regular',\n data: 'execute',\n }),\n ]),\n }),\n AppGraphBuilder.createTypeExtension({\n id: 'logs',\n type: Script.Script,\n connector: () =>\n Effect.succeed([\n AppNode.makeCompanion({\n variant: 'logs',\n label: ['script-logs.label', { ns: meta.profile.key }],\n icon: 'ph--clock-countdown--regular',\n data: 'logs',\n }),\n ]),\n }),\n ]);\n\n return Capability.contribute(AppCapabilities.AppGraphBuilder, extensions);\n }),\n);\n"],"mappings":";;;;;;;;AAcA,IAAA,4BAAe,WAAW,WACxB,OAAO,WAAW,aAAa;CAC7B,MAAM,aAAa,OAAO,OAAO,IAAI,CACnC,gBAAgB,oBAAoB;EAClC,IAAI;EACJ,MAAM,OAAO;EACb,iBACE,OAAO,QAAQ,CACb,QAAQ,cAAc;GACpB,SAAS;GACT,OAAO,CAAC,qBAAqB,EAAE,IAAI,KAAK,QAAQ,IAAI,CAAC;GACrD,MAAM;GACN,MAAM;EACR,CAAC,CACH,CAAC;CACL,CAAC,GACD,gBAAgB,oBAAoB;EAClC,IAAI;EACJ,MAAM,OAAO;EACb,iBACE,OAAO,QAAQ,CACb,QAAQ,cAAc;GACpB,SAAS;GACT,OAAO,CAAC,qBAAqB,EAAE,IAAI,KAAK,QAAQ,IAAI,CAAC;GACrD,MAAM;GACN,MAAM;EACR,CAAC,CACH,CAAC;CACL,CAAC,CACH,CAAC;CAED,OAAO,WAAW,WAAW,gBAAgB,iBAAiB,UAAU;AAC1E,CAAC,CACH"}
1
+ {"version":3,"file":"chunk-app-graph-builder.mjs","names":[],"sources":["../../src/capabilities/app-graph-builder.ts"],"sourcesContent":["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\n\nimport * as Capability from '@dxos/app-framework/Capability';\nimport * as AppGraphBuilder from '@dxos/app-graph/AppGraphBuilder';\nimport * as AppCapabilities from '@dxos/app-toolkit/AppCapabilities';\nimport * as AppNode from '@dxos/app-toolkit/AppNode';\nimport * as Script from '@dxos/compute/Script';\n\nimport { meta } from '#meta';\n\nexport default Capability.makeModule(\n Effect.fnUntraced(function* () {\n const extensions = yield* Effect.all([\n AppGraphBuilder.createTypeExtension({\n id: 'execute',\n relation: AppNode.companion,\n type: Script.Script,\n connector: () =>\n Effect.succeed([\n AppNode.makeCompanion({\n variant: 'execute',\n label: ['script-test.label', { ns: meta.profile.key }],\n icon: 'ph--terminal--regular',\n data: 'execute',\n }),\n ]),\n }),\n AppGraphBuilder.createTypeExtension({\n id: 'logs',\n relation: AppNode.companion,\n type: Script.Script,\n connector: () =>\n Effect.succeed([\n AppNode.makeCompanion({\n variant: 'logs',\n label: ['script-logs.label', { ns: meta.profile.key }],\n icon: 'ph--clock-countdown--regular',\n data: 'logs',\n }),\n ]),\n }),\n ]);\n\n return Capability.contribute(AppCapabilities.AppGraphBuilder, extensions);\n }),\n);\n"],"mappings":";;;;;;;;AAcA,IAAA,4BAAe,WAAW,WACxB,OAAO,WAAW,aAAa;CAC7B,MAAM,aAAa,OAAO,OAAO,IAAI,CACnC,gBAAgB,oBAAoB;EAClC,IAAI;EACJ,UAAU,QAAQ;EAClB,MAAM,OAAO;EACb,iBACE,OAAO,QAAQ,CACb,QAAQ,cAAc;GACpB,SAAS;GACT,OAAO,CAAC,qBAAqB,EAAE,IAAI,KAAK,QAAQ,IAAI,CAAC;GACrD,MAAM;GACN,MAAM;EACR,CAAC,CACH,CAAC;CACL,CAAC,GACD,gBAAgB,oBAAoB;EAClC,IAAI;EACJ,UAAU,QAAQ;EAClB,MAAM,OAAO;EACb,iBACE,OAAO,QAAQ,CACb,QAAQ,cAAc;GACpB,SAAS;GACT,OAAO,CAAC,qBAAqB,EAAE,IAAI,KAAK,QAAQ,IAAI,CAAC;GACrD,MAAM;GACN,MAAM;EACR,CAAC,CACH,CAAC;CACL,CAAC,CACH,CAAC;CAED,OAAO,WAAW,WAAW,gBAAgB,iBAAiB,UAAU;AAC1E,CAAC,CACH"}