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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (295) hide show
  1. package/dist/lib/ScriptPlugin.mjs +25 -0
  2. package/dist/lib/ScriptPlugin.mjs.map +1 -0
  3. package/dist/lib/ScriptPlugin.node.mjs +11 -0
  4. package/dist/lib/ScriptPlugin.node.mjs.map +1 -0
  5. package/dist/lib/ScriptPlugin.workerd.mjs +11 -0
  6. package/dist/lib/ScriptPlugin.workerd.mjs.map +1 -0
  7. package/dist/lib/capabilities/node.mjs +11 -0
  8. package/dist/lib/capabilities/node.mjs.map +1 -0
  9. package/dist/lib/capabilities.mjs +13 -0
  10. package/dist/lib/capabilities.mjs.map +1 -0
  11. package/dist/lib/chunk-DeploymentDialog.mjs +85 -0
  12. package/dist/lib/chunk-DeploymentDialog.mjs.map +1 -0
  13. package/dist/lib/chunk-NotebookArticle.mjs +719 -0
  14. package/dist/lib/chunk-NotebookArticle.mjs.map +1 -0
  15. package/dist/lib/chunk-ScriptArticle.mjs +67 -0
  16. package/dist/lib/chunk-ScriptArticle.mjs.map +1 -0
  17. package/dist/lib/chunk-ScriptProperties.mjs +240 -0
  18. package/dist/lib/chunk-ScriptProperties.mjs.map +1 -0
  19. package/dist/lib/chunk-ScriptSettings.mjs +40 -0
  20. package/dist/lib/chunk-ScriptSettings.mjs.map +1 -0
  21. package/dist/lib/chunk-TestContainer.mjs +40 -0
  22. package/dist/lib/chunk-TestContainer.mjs.map +1 -0
  23. package/dist/lib/chunk-app-graph-builder.mjs +33 -0
  24. package/dist/lib/chunk-app-graph-builder.mjs.map +1 -0
  25. package/dist/lib/chunk-compiler.mjs +60 -0
  26. package/dist/lib/chunk-compiler.mjs.map +1 -0
  27. package/dist/lib/chunk-compiler2.mjs +76 -0
  28. package/dist/lib/chunk-compiler2.mjs.map +1 -0
  29. package/dist/lib/chunk-create-object.mjs +36 -0
  30. package/dist/lib/chunk-create-object.mjs.map +1 -0
  31. package/dist/lib/chunk-create-script.mjs +32 -0
  32. package/dist/lib/chunk-create-script.mjs.map +1 -0
  33. package/dist/lib/chunk-create.mjs +34 -0
  34. package/dist/lib/chunk-create.mjs.map +1 -0
  35. package/dist/lib/chunk-delete.mjs +15 -0
  36. package/dist/lib/chunk-delete.mjs.map +1 -0
  37. package/dist/lib/chunk-deploy.mjs +53 -0
  38. package/dist/lib/chunk-deploy.mjs.map +1 -0
  39. package/dist/lib/chunk-functions.mjs +238 -0
  40. package/dist/lib/chunk-functions.mjs.map +1 -0
  41. package/dist/lib/chunk-inspect-invocations.mjs +42 -0
  42. package/dist/lib/chunk-inspect-invocations.mjs.map +1 -0
  43. package/dist/lib/chunk-install-function.mjs +40 -0
  44. package/dist/lib/chunk-install-function.mjs.map +1 -0
  45. package/dist/lib/chunk-invoke.mjs +25 -0
  46. package/dist/lib/chunk-invoke.mjs.map +1 -0
  47. package/dist/lib/chunk-meta.mjs +33 -0
  48. package/dist/lib/chunk-meta.mjs.map +1 -0
  49. package/dist/lib/chunk-operation-handler.mjs +13 -0
  50. package/dist/lib/chunk-operation-handler.mjs.map +1 -0
  51. package/dist/lib/chunk-query-deployed-functions.mjs +31 -0
  52. package/dist/lib/chunk-query-deployed-functions.mjs.map +1 -0
  53. package/dist/lib/chunk-react-surface.mjs +140 -0
  54. package/dist/lib/chunk-react-surface.mjs.map +1 -0
  55. package/dist/lib/chunk-read.mjs +20 -0
  56. package/dist/lib/chunk-read.mjs.map +1 -0
  57. package/dist/lib/chunk-settings.mjs +23 -0
  58. package/dist/lib/chunk-settings.mjs.map +1 -0
  59. package/dist/lib/chunk-skill-definition.mjs +10 -0
  60. package/dist/lib/chunk-skill-definition.mjs.map +1 -0
  61. package/dist/lib/chunk-skills.mjs +35 -0
  62. package/dist/lib/chunk-skills.mjs.map +1 -0
  63. package/dist/lib/{neutral/chunk-WAGQ77UQ.mjs → chunk-templates.mjs} +82 -84
  64. package/dist/lib/chunk-templates.mjs.map +1 -0
  65. package/dist/lib/chunk-types.mjs +90 -0
  66. package/dist/lib/chunk-types.mjs.map +1 -0
  67. package/dist/lib/chunk-update.mjs +27 -0
  68. package/dist/lib/chunk-update.mjs.map +1 -0
  69. package/dist/lib/chunk-util.mjs +146 -0
  70. package/dist/lib/chunk-util.mjs.map +1 -0
  71. package/dist/lib/components.mjs +618 -0
  72. package/dist/lib/components.mjs.map +1 -0
  73. package/dist/lib/containers.mjs +12 -0
  74. package/dist/lib/containers.mjs.map +1 -0
  75. package/dist/lib/hooks.mjs +307 -0
  76. package/dist/lib/hooks.mjs.map +1 -0
  77. package/dist/lib/index.mjs +5 -0
  78. package/dist/lib/meta.mjs +2 -0
  79. package/dist/lib/operations.mjs +7 -0
  80. package/dist/lib/operations.mjs.map +1 -0
  81. package/dist/lib/plugin.mjs +9 -0
  82. package/dist/lib/plugin.mjs.map +1 -0
  83. package/dist/lib/skills.mjs +2 -0
  84. package/dist/lib/templates.mjs +2 -0
  85. package/dist/lib/testing.mjs +75 -0
  86. package/dist/lib/testing.mjs.map +1 -0
  87. package/dist/lib/translations.mjs +98 -0
  88. package/dist/lib/translations.mjs.map +1 -0
  89. package/dist/lib/types.mjs +2 -0
  90. package/dist/types/src/capabilities/ScriptSurfaces.d.ts +28 -0
  91. package/dist/types/src/capabilities/ScriptSurfaces.d.ts.map +1 -0
  92. package/dist/types/src/capabilities/app-graph-builder.d.ts +1 -1
  93. package/dist/types/src/capabilities/compiler.d.ts +1 -1
  94. package/dist/types/src/capabilities/create-object.d.ts +1 -1
  95. package/dist/types/src/capabilities/operation-handler.d.ts +1 -1
  96. package/dist/types/src/capabilities/react-surface.d.ts +1 -1
  97. package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
  98. package/dist/types/src/capabilities/settings.d.ts +1 -1
  99. package/dist/types/src/components/NotebookStack/NotebookStack.d.ts +1 -1
  100. package/dist/types/src/components/NotebookStack/NotebookStack.d.ts.map +1 -1
  101. package/dist/types/src/components/NotebookStack/NotebookStack.stories.d.ts.map +1 -1
  102. package/dist/types/src/components/QueryEditor/QueryEditor.d.ts.map +1 -1
  103. package/dist/types/src/components/ScriptToolbar/ScriptToolbar.d.ts +1 -1
  104. package/dist/types/src/components/ScriptToolbar/ScriptToolbar.d.ts.map +1 -1
  105. package/dist/types/src/components/TestPanel/TestPanel.d.ts +1 -1
  106. package/dist/types/src/components/TestPanel/TestPanel.d.ts.map +1 -1
  107. package/dist/types/src/components/TypescriptEditor/TypescriptEditor.d.ts +1 -1
  108. package/dist/types/src/components/TypescriptEditor/TypescriptEditor.d.ts.map +1 -1
  109. package/dist/types/src/components/TypescriptEditor/TypescriptEditor.stories.d.ts +1 -1
  110. package/dist/types/src/containers/DeploymentDialog/DeploymentDialog.d.ts +5 -2
  111. package/dist/types/src/containers/DeploymentDialog/DeploymentDialog.d.ts.map +1 -1
  112. package/dist/types/src/containers/NotebookArticle/NotebookArticle.d.ts +4 -1
  113. package/dist/types/src/containers/NotebookArticle/NotebookArticle.d.ts.map +1 -1
  114. package/dist/types/src/containers/ScriptArticle/ScriptArticle.d.ts +4 -1
  115. package/dist/types/src/containers/ScriptArticle/ScriptArticle.d.ts.map +1 -1
  116. package/dist/types/src/containers/ScriptArticle/ScriptArticle.stories.d.ts.map +1 -1
  117. package/dist/types/src/containers/ScriptProperties/FunctionBinding.d.ts +4 -1
  118. package/dist/types/src/containers/ScriptProperties/FunctionBinding.d.ts.map +1 -1
  119. package/dist/types/src/containers/ScriptProperties/FunctionPublishing.d.ts +4 -1
  120. package/dist/types/src/containers/ScriptProperties/FunctionPublishing.d.ts.map +1 -1
  121. package/dist/types/src/containers/ScriptProperties/ScriptProperties.d.ts +4 -1
  122. package/dist/types/src/containers/ScriptProperties/ScriptProperties.d.ts.map +1 -1
  123. package/dist/types/src/containers/ScriptProperties/ScriptProperties.stories.d.ts.map +1 -1
  124. package/dist/types/src/containers/ScriptProperties/SkillEditor.d.ts +4 -1
  125. package/dist/types/src/containers/ScriptProperties/SkillEditor.d.ts.map +1 -1
  126. package/dist/types/src/containers/ScriptSettings/ScriptSettings.d.ts +4 -1
  127. package/dist/types/src/containers/ScriptSettings/ScriptSettings.d.ts.map +1 -1
  128. package/dist/types/src/containers/ScriptSettings/ScriptSettings.stories.d.ts +4 -1
  129. package/dist/types/src/containers/ScriptSettings/ScriptSettings.stories.d.ts.map +1 -1
  130. package/dist/types/src/containers/TestContainer/TestContainer.d.ts +4 -1
  131. package/dist/types/src/containers/TestContainer/TestContainer.d.ts.map +1 -1
  132. package/dist/types/src/hooks/deploy.d.ts +2 -35
  133. package/dist/types/src/hooks/deploy.d.ts.map +1 -1
  134. package/dist/types/src/hooks/format.d.ts +2 -23
  135. package/dist/types/src/hooks/format.d.ts.map +1 -1
  136. package/dist/types/src/hooks/template.d.ts +2 -18
  137. package/dist/types/src/hooks/template.d.ts.map +1 -1
  138. package/dist/types/src/hooks/useToolbarState.d.ts +1 -1
  139. package/dist/types/src/hooks/useToolbarState.d.ts.map +1 -1
  140. package/dist/types/src/notebook/compute-graph.d.ts +1 -1
  141. package/dist/types/src/notebook/compute-graph.d.ts.map +1 -1
  142. package/dist/types/src/skills/functions/deploy.d.ts.map +1 -1
  143. package/dist/types/src/skills/functions/inspect-invocations.d.ts.map +1 -1
  144. package/dist/types/src/templates/chess-bot.d.ts +2 -2
  145. package/dist/types/src/templates/chess-bot.d.ts.map +1 -1
  146. package/dist/types/src/templates/commentary.d.ts +2 -2
  147. package/dist/types/src/templates/commentary.d.ts.map +1 -1
  148. package/dist/types/src/types/ScriptCapabilities.d.ts +1 -1
  149. package/dist/types/src/types/ScriptCapabilities.d.ts.map +1 -1
  150. package/dist/types/tsconfig.tsbuildinfo +1 -1
  151. package/package.json +88 -82
  152. package/src/capabilities/ScriptSurfaces.tsx +96 -0
  153. package/src/capabilities/app-graph-builder.ts +2 -2
  154. package/src/capabilities/compiler.ts +1 -1
  155. package/src/capabilities/react-surface.ts +82 -0
  156. package/src/components/NotebookStack/NotebookCell.tsx +9 -2
  157. package/src/components/NotebookStack/NotebookStack.stories.tsx +2 -0
  158. package/src/components/NotebookStack/NotebookStack.tsx +22 -14
  159. package/src/components/QueryEditor/QueryEditor.stories.tsx +1 -1
  160. package/src/components/QueryEditor/QueryEditor.tsx +1 -0
  161. package/src/components/ScriptToolbar/ScriptToolbar.stories.tsx +1 -1
  162. package/src/components/ScriptToolbar/ScriptToolbar.tsx +1 -1
  163. package/src/components/TestPanel/TestPanel.tsx +2 -2
  164. package/src/components/TypescriptEditor/TypescriptEditor.tsx +1 -1
  165. package/src/containers/DeploymentDialog/DeploymentDialog.stories.tsx +1 -1
  166. package/src/containers/DeploymentDialog/DeploymentDialog.tsx +3 -1
  167. package/src/containers/NotebookArticle/NotebookArticle.stories.tsx +1 -1
  168. package/src/containers/NotebookArticle/NotebookArticle.tsx +4 -2
  169. package/src/containers/ScriptArticle/ScriptArticle.stories.tsx +2 -1
  170. package/src/containers/ScriptArticle/ScriptArticle.tsx +3 -1
  171. package/src/containers/ScriptProperties/FunctionBinding.tsx +5 -3
  172. package/src/containers/ScriptProperties/FunctionPublishing.tsx +4 -2
  173. package/src/containers/ScriptProperties/ScriptProperties.stories.tsx +2 -1
  174. package/src/containers/ScriptProperties/ScriptProperties.tsx +2 -0
  175. package/src/containers/ScriptProperties/SkillEditor.tsx +3 -1
  176. package/src/containers/ScriptSettings/ScriptSettings.tsx +2 -0
  177. package/src/containers/TestContainer/TestContainer.tsx +4 -2
  178. package/src/e2e/ai.test.ts +2 -2
  179. package/src/e2e/deploy.test.ts +2 -2
  180. package/src/hooks/deploy.ts +13 -4
  181. package/src/hooks/format.ts +2 -2
  182. package/src/hooks/template.ts +3 -3
  183. package/src/hooks/useToolbarState.ts +1 -1
  184. package/src/notebook/compute-graph.test.ts +1 -1
  185. package/src/notebook/compute-graph.ts +1 -1
  186. package/src/skills/functions/deploy.ts +5 -6
  187. package/src/skills/functions/inspect-invocations.ts +2 -2
  188. package/src/skills/functions/install-function.ts +1 -1
  189. package/src/skills/functions/invoke.ts +1 -1
  190. package/src/skills/functions/query-deployed-functions.ts +1 -1
  191. package/src/templates/chess-bot.ts +3 -3
  192. package/src/templates/commentary.ts +3 -3
  193. package/src/testing/simulator.test.ts +1 -1
  194. package/src/types/ScriptCapabilities.ts +1 -1
  195. package/src/util/deploy.ts +3 -3
  196. package/src/util/functions.ts +2 -2
  197. package/dist/lib/neutral/DeploymentDialog-7OIIL7LB.mjs +0 -114
  198. package/dist/lib/neutral/DeploymentDialog-7OIIL7LB.mjs.map +0 -7
  199. package/dist/lib/neutral/NotebookArticle-AOBB3XGD.mjs +0 -745
  200. package/dist/lib/neutral/NotebookArticle-AOBB3XGD.mjs.map +0 -7
  201. package/dist/lib/neutral/ScriptArticle-I3DOJARR.mjs +0 -79
  202. package/dist/lib/neutral/ScriptArticle-I3DOJARR.mjs.map +0 -7
  203. package/dist/lib/neutral/ScriptPlugin.mjs +0 -51
  204. package/dist/lib/neutral/ScriptPlugin.mjs.map +0 -7
  205. package/dist/lib/neutral/ScriptPlugin.node.mjs +0 -27
  206. package/dist/lib/neutral/ScriptPlugin.node.mjs.map +0 -7
  207. package/dist/lib/neutral/ScriptPlugin.workerd.mjs +0 -21
  208. package/dist/lib/neutral/ScriptPlugin.workerd.mjs.map +0 -7
  209. package/dist/lib/neutral/ScriptProperties-RHDQGMGT.mjs +0 -296
  210. package/dist/lib/neutral/ScriptProperties-RHDQGMGT.mjs.map +0 -7
  211. package/dist/lib/neutral/ScriptSettings-NS3ZY7ZR.mjs +0 -35
  212. package/dist/lib/neutral/ScriptSettings-NS3ZY7ZR.mjs.map +0 -7
  213. package/dist/lib/neutral/TestContainer-AFVTBYSJ.mjs +0 -44
  214. package/dist/lib/neutral/TestContainer-AFVTBYSJ.mjs.map +0 -7
  215. package/dist/lib/neutral/app-graph-builder-POP3CX6G.mjs +0 -52
  216. package/dist/lib/neutral/app-graph-builder-POP3CX6G.mjs.map +0 -7
  217. package/dist/lib/neutral/capabilities/index.mjs +0 -21
  218. package/dist/lib/neutral/capabilities/index.mjs.map +0 -7
  219. package/dist/lib/neutral/capabilities/node.mjs +0 -17
  220. package/dist/lib/neutral/capabilities/node.mjs.map +0 -7
  221. package/dist/lib/neutral/chunk-2REUEDUA.mjs +0 -56
  222. package/dist/lib/neutral/chunk-2REUEDUA.mjs.map +0 -7
  223. package/dist/lib/neutral/chunk-652CIABA.mjs +0 -124
  224. package/dist/lib/neutral/chunk-652CIABA.mjs.map +0 -7
  225. package/dist/lib/neutral/chunk-6DOWVKIW.mjs +0 -344
  226. package/dist/lib/neutral/chunk-6DOWVKIW.mjs.map +0 -7
  227. package/dist/lib/neutral/chunk-CHNFYLKW.mjs +0 -52
  228. package/dist/lib/neutral/chunk-CHNFYLKW.mjs.map +0 -7
  229. package/dist/lib/neutral/chunk-INFWOSTM.mjs +0 -156
  230. package/dist/lib/neutral/chunk-INFWOSTM.mjs.map +0 -7
  231. package/dist/lib/neutral/chunk-J5LGTIGS.mjs +0 -10
  232. package/dist/lib/neutral/chunk-J5LGTIGS.mjs.map +0 -7
  233. package/dist/lib/neutral/chunk-KSVKXCTX.mjs +0 -8
  234. package/dist/lib/neutral/chunk-KSVKXCTX.mjs.map +0 -7
  235. package/dist/lib/neutral/chunk-NVV5UYY4.mjs +0 -50
  236. package/dist/lib/neutral/chunk-NVV5UYY4.mjs.map +0 -7
  237. package/dist/lib/neutral/chunk-USJ44FIU.mjs +0 -8
  238. package/dist/lib/neutral/chunk-USJ44FIU.mjs.map +0 -7
  239. package/dist/lib/neutral/chunk-WAGQ77UQ.mjs.map +0 -7
  240. package/dist/lib/neutral/compiler-ODK4UA2N.mjs +0 -101
  241. package/dist/lib/neutral/compiler-ODK4UA2N.mjs.map +0 -7
  242. package/dist/lib/neutral/components/index.mjs +0 -695
  243. package/dist/lib/neutral/components/index.mjs.map +0 -7
  244. package/dist/lib/neutral/containers/index.mjs +0 -19
  245. package/dist/lib/neutral/containers/index.mjs.map +0 -7
  246. package/dist/lib/neutral/create-SGHWWTET.mjs +0 -46
  247. package/dist/lib/neutral/create-SGHWWTET.mjs.map +0 -7
  248. package/dist/lib/neutral/create-object-QW66KQWS.mjs +0 -43
  249. package/dist/lib/neutral/create-object-QW66KQWS.mjs.map +0 -7
  250. package/dist/lib/neutral/create-script-CIEJOBIU.mjs +0 -45
  251. package/dist/lib/neutral/create-script-CIEJOBIU.mjs.map +0 -7
  252. package/dist/lib/neutral/delete-72RXVLVI.mjs +0 -21
  253. package/dist/lib/neutral/delete-72RXVLVI.mjs.map +0 -7
  254. package/dist/lib/neutral/deploy-PJTJAQZY.mjs +0 -67
  255. package/dist/lib/neutral/deploy-PJTJAQZY.mjs.map +0 -7
  256. package/dist/lib/neutral/hooks/index.mjs +0 -369
  257. package/dist/lib/neutral/hooks/index.mjs.map +0 -7
  258. package/dist/lib/neutral/index.mjs +0 -41
  259. package/dist/lib/neutral/index.mjs.map +0 -7
  260. package/dist/lib/neutral/inspect-invocations-ZUXVUAML.mjs +0 -59
  261. package/dist/lib/neutral/inspect-invocations-ZUXVUAML.mjs.map +0 -7
  262. package/dist/lib/neutral/install-function-YFDZLVMJ.mjs +0 -49
  263. package/dist/lib/neutral/install-function-YFDZLVMJ.mjs.map +0 -7
  264. package/dist/lib/neutral/invoke-CDRBQ2WA.mjs +0 -32
  265. package/dist/lib/neutral/invoke-CDRBQ2WA.mjs.map +0 -7
  266. package/dist/lib/neutral/meta.json +0 -1
  267. package/dist/lib/neutral/meta.mjs +0 -10
  268. package/dist/lib/neutral/meta.mjs.map +0 -7
  269. package/dist/lib/neutral/operation-handler-M3B6IRMV.mjs +0 -18
  270. package/dist/lib/neutral/operation-handler-M3B6IRMV.mjs.map +0 -7
  271. package/dist/lib/neutral/operations/index.mjs +0 -8
  272. package/dist/lib/neutral/operations/index.mjs.map +0 -7
  273. package/dist/lib/neutral/plugin.mjs +0 -16
  274. package/dist/lib/neutral/plugin.mjs.map +0 -7
  275. package/dist/lib/neutral/query-deployed-functions-RBQMGON2.mjs +0 -34
  276. package/dist/lib/neutral/query-deployed-functions-RBQMGON2.mjs.map +0 -7
  277. package/dist/lib/neutral/react-surface-GEXOZLBC.mjs +0 -120
  278. package/dist/lib/neutral/react-surface-GEXOZLBC.mjs.map +0 -7
  279. package/dist/lib/neutral/read-OY3K5R3V.mjs +0 -26
  280. package/dist/lib/neutral/read-OY3K5R3V.mjs.map +0 -7
  281. package/dist/lib/neutral/settings-FD7HXEY6.mjs +0 -30
  282. package/dist/lib/neutral/settings-FD7HXEY6.mjs.map +0 -7
  283. package/dist/lib/neutral/skill-definition-JZ7UYBT7.mjs +0 -15
  284. package/dist/lib/neutral/skill-definition-JZ7UYBT7.mjs.map +0 -7
  285. package/dist/lib/neutral/skills/index.mjs +0 -10
  286. package/dist/lib/neutral/skills/index.mjs.map +0 -7
  287. package/dist/lib/neutral/templates/index.mjs +0 -10
  288. package/dist/lib/neutral/templates/index.mjs.map +0 -7
  289. package/dist/lib/neutral/translations.mjs +0 -104
  290. package/dist/lib/neutral/translations.mjs.map +0 -7
  291. package/dist/lib/neutral/types/index.mjs +0 -17
  292. package/dist/lib/neutral/types/index.mjs.map +0 -7
  293. package/dist/lib/neutral/update-Z5VGOLBN.mjs +0 -44
  294. package/dist/lib/neutral/update-Z5VGOLBN.mjs.map +0 -7
  295. package/src/capabilities/react-surface.tsx +0 -132
@@ -1,296 +0,0 @@
1
- import "./chunk-J5LGTIGS.mjs";
2
-
3
- // src/containers/ScriptProperties/ScriptProperties.tsx
4
- import React4 from "react";
5
- import { Form as Form4 } from "@dxos/react-ui-form";
6
-
7
- // src/containers/ScriptProperties/FunctionBinding.tsx
8
- import React, { useCallback } from "react";
9
- import { Operation } from "@dxos/compute";
10
- import { Filter, Obj, Ref } from "@dxos/echo";
11
- import { getUserFunctionIdInMetadata } from "@dxos/functions";
12
- import { getInvocationUrl } from "@dxos/functions-runtime";
13
- import { useClient } from "@dxos/react-client";
14
- import { useQuery } from "@dxos/react-client/echo";
15
- import { Clipboard, Input, useControlledState, useTranslation } from "@dxos/react-ui";
16
- import { Form } from "@dxos/react-ui-form";
17
- import { meta } from "#meta";
18
- var FunctionBinding = ({ object }) => {
19
- const { t } = useTranslation(meta.profile.key);
20
- const client = useClient();
21
- const db = Obj.getDatabase(object);
22
- const [fn] = useQuery(db, Filter.type(Operation.PersistentOperation, {
23
- source: Ref.make(object)
24
- }));
25
- const functionId = fn && getUserFunctionIdInMetadata(Obj.getMeta(fn));
26
- const functionUrl = functionId && getInvocationUrl(functionId, client.config.values.runtime?.services?.edge?.url ?? "", {
27
- spaceId: db?.spaceId
28
- });
29
- const [binding, setBinding] = useControlledState(fn?.binding ?? "");
30
- const handleBindingChange = useCallback((event) => setBinding(event.target.value), [
31
- setBinding
32
- ]);
33
- const handleBindingBlur = useCallback(() => {
34
- if (fn) {
35
- Obj.update(fn, (fn2) => {
36
- fn2.binding = binding;
37
- });
38
- }
39
- }, [
40
- fn,
41
- binding
42
- ]);
43
- if (!fn) {
44
- return null;
45
- }
46
- return /* @__PURE__ */ React.createElement("div", {
47
- className: "flex flex-col"
48
- }, /* @__PURE__ */ React.createElement(Form.Section, {
49
- title: t("remote-function-settings.heading")
50
- }), functionUrl && /* @__PURE__ */ React.createElement(Input.Root, null, /* @__PURE__ */ React.createElement(Input.Label, null, t("function-url.label")), /* @__PURE__ */ React.createElement(Input.TextInput, {
51
- disabled: true,
52
- value: functionUrl,
53
- onChange: (event) => {
54
- Obj.update(fn, (fn2) => {
55
- fn2.name = event.target.value;
56
- });
57
- }
58
- }), /* @__PURE__ */ React.createElement(Clipboard.IconButton, {
59
- value: functionUrl
60
- })), /* @__PURE__ */ React.createElement(Input.Root, null, /* @__PURE__ */ React.createElement(Input.Label, null, t("function-binding.label")), /* @__PURE__ */ React.createElement(Input.TextInput, {
61
- placeholder: t("function-binding.placeholder"),
62
- value: binding,
63
- onChange: handleBindingChange,
64
- onBlur: handleBindingBlur
65
- })));
66
- };
67
-
68
- // src/containers/ScriptProperties/FunctionPublishing.tsx
69
- import { Octokit } from "@octokit/core";
70
- import React2, { useCallback as useCallback2, useState } from "react";
71
- import { useOperationInvoker } from "@dxos/app-framework/ui";
72
- import { SettingsOperation } from "@dxos/app-toolkit";
73
- import { Filter as Filter2, Obj as Obj2 } from "@dxos/echo";
74
- import { log } from "@dxos/log";
75
- import { useQuery as useQuery2 } from "@dxos/react-client/echo";
76
- import { Button, Clipboard as Clipboard2, Message, useAsyncEffect, useTranslation as useTranslation2 } from "@dxos/react-ui";
77
- import { Form as Form2 } from "@dxos/react-ui-form";
78
- import { AccessToken } from "@dxos/types";
79
- import { kebabize } from "@dxos/util";
80
- import { meta as meta2 } from "#meta";
81
- var __dxlog_file = "/__w/dxos/dxos/packages/plugins/plugin-script/src/containers/ScriptProperties/FunctionPublishing.tsx";
82
- var FunctionPublishing = ({ object }) => {
83
- const { t } = useTranslation2(meta2.profile.key);
84
- const { invokePromise } = useOperationInvoker();
85
- const db = Obj2.getDatabase(object);
86
- const [githubToken] = useQuery2(db, Filter2.type(AccessToken.AccessToken, {
87
- source: "github.com"
88
- }));
89
- const gistKey = Obj2.getMeta(object).keys.find(({ source }) => source === "github.com");
90
- const [gistUrl, setGistUrl] = useState();
91
- useAsyncEffect(async () => {
92
- const token = githubToken?.token;
93
- const gistId = gistKey?.id;
94
- if (!token || !gistId) {
95
- setGistUrl(void 0);
96
- return;
97
- }
98
- try {
99
- const octokit = new Octokit({
100
- auth: githubToken.token
101
- });
102
- const response = await octokit.request("GET /gists/{gist_id}", {
103
- gist_id: gistId
104
- });
105
- setGistUrl(response.data.html_url);
106
- } catch (err) {
107
- log.catch(err, void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 42, S: void 0 });
108
- setGistUrl(void 0);
109
- }
110
- }, [
111
- githubToken,
112
- gistKey
113
- ]);
114
- const handleOpenTokenManager = useCallback2(() => invokePromise(SettingsOperation.Open, {
115
- plugin: "org.dxos.plugin.token-manager"
116
- }), [
117
- invokePromise
118
- ]);
119
- const [publishing, setPublishing] = useState(false);
120
- const handlePublish = useCallback2(async () => {
121
- setPublishing(true);
122
- const octokit = new Octokit({
123
- auth: githubToken.token
124
- });
125
- const source = await object.source.load();
126
- const filename = object.name ? kebabize(object.name) : "composer-script";
127
- const files = {
128
- [`${filename}.ts`]: {
129
- content: source.content
130
- }
131
- };
132
- try {
133
- const meta4 = Obj2.getMeta(object);
134
- const githubKey = meta4.keys.find(({ source: source2 }) => source2 === "github.com");
135
- const gistId = githubKey?.id;
136
- if (gistId) {
137
- await octokit.request("PATCH /gists/{gist_id}", {
138
- gist_id: gistId,
139
- files
140
- });
141
- } else {
142
- const response = await octokit.request("POST /gists", {
143
- public: true,
144
- files
145
- });
146
- const gistId2 = response.data.id;
147
- if (gistId2) {
148
- Obj2.update(object, (object2) => {
149
- Obj2.getMeta(object2).keys.push({
150
- source: "github.com",
151
- id: gistId2
152
- });
153
- });
154
- }
155
- }
156
- } finally {
157
- setPublishing(false);
158
- }
159
- }, [
160
- object,
161
- githubToken
162
- ]);
163
- return /* @__PURE__ */ React2.createElement("div", {
164
- className: "flex flex-col"
165
- }, /* @__PURE__ */ React2.createElement(Form2.Section, {
166
- title: t("script-publish-settings.label"),
167
- description: t("script-publish-settings.description")
168
- }), !githubToken && /* @__PURE__ */ React2.createElement("div", {
169
- className: "flex flex-col py-form-gap"
170
- }, /* @__PURE__ */ React2.createElement(Message.Root, {
171
- valence: "info"
172
- }, /* @__PURE__ */ React2.createElement(Message.Title, null, t("no-github-token.label"))), /* @__PURE__ */ React2.createElement("div", {
173
- className: "flex pt-form-gap"
174
- }, /* @__PURE__ */ React2.createElement(Button, {
175
- onClick: handleOpenTokenManager
176
- }, t("open-token-manager.label")))), githubToken && /* @__PURE__ */ React2.createElement("div", {
177
- className: "flex justify-end gap-2"
178
- }, gistUrl && /* @__PURE__ */ React2.createElement(Clipboard2.IconButton, {
179
- value: gistUrl
180
- }), /* @__PURE__ */ React2.createElement(Button, {
181
- disabled: publishing,
182
- onClick: handlePublish
183
- }, t("publish.label"))));
184
- };
185
-
186
- // src/containers/ScriptProperties/SkillEditor.tsx
187
- import React3, { useCallback as useCallback3, useState as useState2 } from "react";
188
- import { ToolId } from "@dxos/ai";
189
- import { Skill, Template } from "@dxos/compute";
190
- import { Operation as Operation2 } from "@dxos/compute";
191
- import { Filter as Filter3, Obj as Obj3, Ref as Ref2 } from "@dxos/echo";
192
- import { useQuery as useQuery3 } from "@dxos/react-client/echo";
193
- import { Button as Button2, Input as Input2, useAsyncEffect as useAsyncEffect2, useTranslation as useTranslation3 } from "@dxos/react-ui";
194
- import { Form as Form3 } from "@dxos/react-ui-form";
195
- import { kebabize as kebabize2 } from "@dxos/util";
196
- import { meta as meta3 } from "#meta";
197
- var SkillEditor = ({ object }) => {
198
- const { t } = useTranslation3(meta3.profile.key);
199
- const db = Obj3.getDatabase(object);
200
- const [fn] = useQuery3(db, Filter3.type(Operation2.PersistentOperation, {
201
- source: Ref2.make(object)
202
- }));
203
- const skills = useQuery3(db, Filter3.type(Skill.Skill));
204
- const [creating, setCreating] = useState2(false);
205
- const [instructions, setInstructions] = useState2(`You can run the script "${object.name ?? "script"}".`);
206
- const skillKey = `org.dxos.skill.${kebabize2(object.name ?? "script")}`;
207
- const existingSkill = skills.find((bp) => Obj3.getMeta(bp).key === skillKey);
208
- const fnKey = fn ? Obj3.getMeta(fn).key : void 0;
209
- useAsyncEffect2(async () => {
210
- if (!existingSkill) {
211
- return;
212
- }
213
- const source = await existingSkill.instructions.source.load();
214
- setInstructions(source.content ?? "");
215
- }, [
216
- existingSkill
217
- ]);
218
- const handleSave = useCallback3(async () => {
219
- if (!db) {
220
- return;
221
- }
222
- setCreating(true);
223
- try {
224
- if (existingSkill) {
225
- const text = await existingSkill.instructions.source.load();
226
- Obj3.update(text, (text2) => {
227
- text2.content = instructions;
228
- });
229
- if (fnKey) {
230
- const toolId = ToolId.make(fnKey);
231
- if (!existingSkill.tools?.includes(toolId)) {
232
- Obj3.update(existingSkill, (existingSkill2) => {
233
- existingSkill2.tools = [
234
- ...existingSkill2.tools ?? [],
235
- toolId
236
- ];
237
- });
238
- }
239
- }
240
- } else if (fnKey) {
241
- db.add(Skill.make({
242
- key: skillKey,
243
- name: object.name ?? "Script",
244
- instructions: Template.make({
245
- source: instructions
246
- }),
247
- tools: [
248
- ToolId.make(fnKey)
249
- ]
250
- }));
251
- }
252
- await db.flush();
253
- } finally {
254
- setCreating(false);
255
- }
256
- }, [
257
- db,
258
- existingSkill,
259
- fnKey,
260
- skillKey,
261
- object.name,
262
- instructions
263
- ]);
264
- return /* @__PURE__ */ React3.createElement("div", {
265
- className: "flex flex-col"
266
- }, /* @__PURE__ */ React3.createElement(Form3.Section, {
267
- title: t("skill-editor.label"),
268
- description: t("skill-editor.description")
269
- }), /* @__PURE__ */ React3.createElement(Input2.Root, null, /* @__PURE__ */ React3.createElement(Input2.Label, null, t("skill-instructions.label")), /* @__PURE__ */ React3.createElement(Input2.TextArea, {
270
- placeholder: t("skill-instructions.placeholder"),
271
- rows: 6,
272
- value: instructions,
273
- onChange: (event) => setInstructions(event.target.value),
274
- classNames: "resize-y"
275
- })), /* @__PURE__ */ React3.createElement("div", {
276
- className: "pt-2"
277
- }, /* @__PURE__ */ React3.createElement(Button2, {
278
- disabled: !existingSkill && !fnKey || creating,
279
- onClick: handleSave
280
- }, t(existingSkill ? "update-skill.label" : "create-skill.label"))));
281
- };
282
-
283
- // src/containers/ScriptProperties/ScriptProperties.tsx
284
- var ScriptProperties = ({ subject: object }) => {
285
- return /* @__PURE__ */ React4.createElement(React4.Fragment, null, /* @__PURE__ */ React4.createElement(Form4.Section, null, /* @__PURE__ */ React4.createElement(FunctionBinding, {
286
- object
287
- })), /* @__PURE__ */ React4.createElement(Form4.Section, null, /* @__PURE__ */ React4.createElement(SkillEditor, {
288
- object
289
- })), /* @__PURE__ */ React4.createElement(Form4.Section, null, /* @__PURE__ */ React4.createElement(FunctionPublishing, {
290
- object
291
- })));
292
- };
293
- export {
294
- ScriptProperties as default
295
- };
296
- //# sourceMappingURL=ScriptProperties-RHDQGMGT.mjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/containers/ScriptProperties/ScriptProperties.tsx", "../../../src/containers/ScriptProperties/FunctionBinding.tsx", "../../../src/containers/ScriptProperties/FunctionPublishing.tsx", "../../../src/containers/ScriptProperties/SkillEditor.tsx"],
4
- "sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport React from 'react';\n\nimport { type AppSurface } from '@dxos/app-toolkit/ui';\nimport { type Script } from '@dxos/compute';\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", "//\n// Copyright 2024 DXOS.org\n//\n\nimport React, { type ChangeEvent, useCallback } from 'react';\n\nimport { type Script } from '@dxos/compute';\nimport { Operation } from '@dxos/compute';\nimport { Filter, Obj, Ref } from '@dxos/echo';\nimport { getUserFunctionIdInMetadata } from '@dxos/functions';\nimport { getInvocationUrl } from '@dxos/functions-runtime';\nimport { useClient } from '@dxos/react-client';\nimport { useQuery } from '@dxos/react-client/echo';\nimport { Clipboard, 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 <div className='flex flex-col'>\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 </div>\n );\n};\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 { SettingsOperation } from '@dxos/app-toolkit';\nimport { type Script } from '@dxos/compute';\nimport { Filter, Obj } from '@dxos/echo';\nimport { log } from '@dxos/log';\nimport { useQuery } from '@dxos/react-client/echo';\nimport { Button, Clipboard, Message, useAsyncEffect, useTranslation } from '@dxos/react-ui';\nimport { Form } from '@dxos/react-ui-form';\nimport { AccessToken } from '@dxos/types';\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 <div className='flex flex-col'>\n <Form.Section title={t('script-publish-settings.label')} description={t('script-publish-settings.description')} />\n\n {!githubToken && (\n <div className='flex flex-col py-form-gap'>\n <Message.Root valence='info'>\n <Message.Title>{t('no-github-token.label')}</Message.Title>\n </Message.Root>\n <div className='flex pt-form-gap'>\n <Button onClick={handleOpenTokenManager}>{t('open-token-manager.label')}</Button>\n </div>\n </div>\n )}\n\n {githubToken && (\n <div className='flex justify-end gap-2'>\n {gistUrl && <Clipboard.IconButton value={gistUrl} />}\n <Button disabled={publishing} onClick={handlePublish}>\n {t('publish.label')}\n </Button>\n </div>\n )}\n </div>\n );\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport React, { useCallback, useState } from 'react';\n\nimport { ToolId } from '@dxos/ai';\nimport { Skill, Template } from '@dxos/compute';\nimport { type Script } from '@dxos/compute';\nimport { Operation } from '@dxos/compute';\nimport { Filter, Obj, Ref } from '@dxos/echo';\nimport { useQuery } from '@dxos/react-client/echo';\nimport { Button, 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 <div className='flex flex-col'>\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 </div>\n );\n};\n"],
5
- "mappings": ";;;AAIA,OAAOA,YAAW;AAIlB,SAASC,QAAAA,aAAY;;;ACJrB,OAAOC,SAA2BC,mBAAmB;AAGrD,SAASC,iBAAiB;AAC1B,SAASC,QAAQC,KAAKC,WAAW;AACjC,SAASC,mCAAmC;AAC5C,SAASC,wBAAwB;AACjC,SAASC,iBAAiB;AAC1B,SAASC,gBAAgB;AACzB,SAASC,WAAWC,OAAOC,oBAAoBC,sBAAsB;AACrE,SAASC,YAAY;AAErB,SAASC,YAAY;AAId,IAAMC,kBAAkB,CAAC,EAAEC,OAAM,MAAwB;AAC9D,QAAM,EAAEC,EAAC,IAAKL,eAAeE,KAAKI,QAAQC,GAAG;AAC7C,QAAMC,SAASb,UAAAA;AACf,QAAMc,KAAKlB,IAAImB,YAAYN,MAAAA;AAE3B,QAAM,CAACO,EAAAA,I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tB,CAAA,CAAA;MAEJ;AACA,YAAMlB,GAAG6B,MAAK;IAChB,UAAA;AACEpB,kBAAY,KAAA;IACd;EACF,GAAG;IAACT;IAAIc;IAAeI;IAAOL;IAAUjB,OAAOgB;IAAMF;GAAa;AAElE,SACE,gBAAAjC,OAAA,cAACqD,OAAAA;IAAIC,WAAU;KACb,gBAAAtD,OAAA,cAACe,MAAKwC,SAAO;IAACC,OAAOpC,EAAE,oBAAA;IAAuBqC,aAAarC,EAAE,0BAAA;MAE7D,gBAAApB,OAAA,cAACY,OAAM8C,MAAI,MACT,gBAAA1D,OAAA,cAACY,OAAM+C,OAAK,MAAEvC,EAAE,0BAAA,CAAA,GAChB,gBAAApB,OAAA,cAACY,OAAMgD,UAAQ;IACbC,aAAazC,EAAE,gCAAA;IACf0C,MAAM;IACNC,OAAO9B;IACP+B,UAAU,CAACC,UAAU/B,gBAAgB+B,MAAMC,OAAOH,KAAK;IACvDI,YAAW;OAIf,gBAAAnE,OAAA,cAACqD,OAAAA;IAAIC,WAAU;KACb,gBAAAtD,OAAA,cAACW,SAAAA;IAAOyD,UAAW,CAAC/B,iBAAiB,CAACI,SAAUV;IAAUsC,SAASxB;KAChEzB,EAAEiB,gBAAgB,uBAAuB,oBAAA,CAAA,CAAA,CAAA;AAKpD;;;AHrFO,IAAMiC,mBAAmB,CAAC,EAAEC,SAASC,OAAM,MAAyB;AACzE,SACE,gBAAAC,OAAA,cAAAA,OAAA,UAAA,MACE,gBAAAA,OAAA,cAACC,MAAKC,SAAO,MACX,gBAAAF,OAAA,cAACG,iBAAAA;IAAgBJ;OAEnB,gBAAAC,OAAA,cAACC,MAAKC,SAAO,MACX,gBAAAF,OAAA,cAACI,aAAAA;IAAYL;OAEf,gBAAAC,OAAA,cAACC,MAAKC,SAAO,MACX,gBAAAF,OAAA,cAACK,oBAAAA;IAAmBN;;AAI5B;",
6
- "names": ["React", "Form", "React", "useCallback", "Operation", "Filter", "Obj", "Ref", "getUserFunctionIdInMetadata", "getInvocationUrl", "useClient", "useQuery", "Clipboard", "Input", "useControlledState", "useTranslation", "Form", "meta", "FunctionBinding", "object", "t", "profile", "key", "client", "db", "getDatabase", "fn", "type", "PersistentOperation", "source", "make", "functionId", "getMeta", "functionUrl", "config", "values", "runtime", "services", "edge", "url", "spaceId", "binding", "setBinding", "handleBindingChange", "event", "target", "value", "handleBindingBlur", "update", "div", "className", "Section", "title", "Root", "Label", "TextInput", "disabled", "onChange", "name", "IconButton", "placeholder", "onBlur", "Octokit", "React", "useCallback", "useState", "useOperationInvoker", "SettingsOperation", "Filter", "Obj", "log", "useQuery", "Button", "Clipboard", "Message", "useAsyncEffect", "useTranslation", "Form", "AccessToken", "kebabize", "meta", "invokePromise", "db", "object", "githubToken", "source", "gistKey", "token", "gistId", "setGistUrl", "undefined", "response", "err", "setPublishing", "files", "content", "githubKey", "id", "octokit", "gist_id", "getMeta", "Section", "title", "t", "className", "valence", "Title", "onClick", "handleOpenTokenManager", "gistUrl", "IconButton", "value", "disabled", "handlePublish", "React", "useCallback", "useState", "ToolId", "Skill", "Template", "Operation", "Filter", "Obj", "Ref", "useQuery", "Button", "Input", "useAsyncEffect", "useTranslation", "Form", "kebabize", "meta", "SkillEditor", "object", "t", "profile", "key", "db", "getDatabase", "fn", "type", "PersistentOperation", "source", "make", "skills", "creating", "setCreating", "instructions", "setInstructions", "name", "skillKey", "existingSkill", "find", "bp", "getMeta", "fnKey", "undefined", "load", "content", "handleSave", "text", "update", "toolId", "tools", "includes", "add", "flush", "div", "className", "Section", "title", "description", "Root", "Label", "TextArea", "placeholder", "rows", "value", "onChange", "event", "target", "classNames", "disabled", "onClick", "ScriptProperties", "subject", "object", "React", "Form", "Section", "FunctionBinding", "SkillEditor", "FunctionPublishing"]
7
- }
@@ -1,35 +0,0 @@
1
- import "./chunk-J5LGTIGS.mjs";
2
-
3
- // src/containers/ScriptSettings/ScriptSettings.tsx
4
- import React from "react";
5
- import { Button, useTranslation } from "@dxos/react-ui";
6
- import { Form } from "@dxos/react-ui-form";
7
- import { meta } from "#meta";
8
- import { Settings } from "#types";
9
- var ScriptSettings = ({ settings, onSettingsChange, onAuthenticate }) => {
10
- const { t } = useTranslation(meta.profile.key);
11
- return /* @__PURE__ */ React.createElement(Form.Root, {
12
- schema: Settings.Settings,
13
- values: settings,
14
- variant: "settings",
15
- readonly: !onSettingsChange,
16
- onValuesChanged: (values) => onSettingsChange?.((current) => ({
17
- ...current,
18
- ...values
19
- }))
20
- }, /* @__PURE__ */ React.createElement(Form.Viewport, {
21
- scroll: true
22
- }, /* @__PURE__ */ React.createElement(Form.Content, null, /* @__PURE__ */ React.createElement(Form.Section, {
23
- title: meta.profile.name ?? meta.profile.key
24
- }, /* @__PURE__ */ React.createElement(Form.Row, {
25
- label: t("authenticate-action.label"),
26
- description: t("authenticate-action.description")
27
- }, /* @__PURE__ */ React.createElement(Button, {
28
- disabled: !onSettingsChange,
29
- onClick: onAuthenticate
30
- }, t("authenticate-button.label"))), /* @__PURE__ */ React.createElement(Form.FieldSet, null)))));
31
- };
32
- export {
33
- ScriptSettings as default
34
- };
35
- //# sourceMappingURL=ScriptSettings-NS3ZY7ZR.mjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/containers/ScriptSettings/ScriptSettings.tsx"],
4
- "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"],
5
- "mappings": ";;;AAIA,OAAOA,WAAW;AAGlB,SAASC,QAAQC,sBAAsB;AACvC,SAASC,YAAY;AAErB,SAASC,YAAY;AACrB,SAASC,gBAAgB;AASlB,IAAMC,iBAAiB,CAAC,EAAEC,UAAUC,kBAAkBC,eAAc,MAAuB;AAChG,QAAM,EAAEC,EAAC,IAAKR,eAAeE,KAAKO,QAAQC,GAAG;AAE7C,SACE,sBAAA,cAACT,KAAKU,MAAI;IACRC,QAAQT,SAASA;IACjBU,QAAQR;IACRS,SAAQ;IACRC,UAAU,CAACT;IACXU,iBAAiB,CAACH,WAAWP,mBAAmB,CAACW,aAAa;MAAE,GAAGA;MAAS,GAAGJ;IAAO,EAAA;KAEtF,sBAAA,cAACZ,KAAKiB,UAAQ;IAACC,QAAAA;KACb,sBAAA,cAAClB,KAAKmB,SAAO,MACX,sBAAA,cAACnB,KAAKoB,SAAO;IAACC,OAAOpB,KAAKO,QAAQc,QAAQrB,KAAKO,QAAQC;KAErD,sBAAA,cAACT,KAAKuB,KAAG;IAACC,OAAOjB,EAAE,2BAAA;IAA8BkB,aAAalB,EAAE,iCAAA;KAC9D,sBAAA,cAACT,QAAAA;IAAO4B,UAAU,CAACrB;IAAkBsB,SAASrB;KAC3CC,EAAE,2BAAA,CAAA,CAAA,GAGP,sBAAA,cAACP,KAAK4B,UAAQ,IAAA,CAAA,CAAA,CAAA,CAAA;AAM1B;",
6
- "names": ["React", "Button", "useTranslation", "Form", "meta", "Settings", "ScriptSettings", "settings", "onSettingsChange", "onAuthenticate", "t", "profile", "key", "Root", "schema", "values", "variant", "readonly", "onValuesChanged", "current", "Viewport", "scroll", "Content", "Section", "title", "name", "Row", "label", "description", "disabled", "onClick", "FieldSet"]
7
- }
@@ -1,44 +0,0 @@
1
- import "./chunk-J5LGTIGS.mjs";
2
-
3
- // src/containers/TestContainer/TestContainer.tsx
4
- import React, { useCallback, useMemo } from "react";
5
- import { Context } from "@dxos/context";
6
- import { Obj } from "@dxos/echo";
7
- import { FunctionsServiceClient } from "@dxos/functions-runtime/edge";
8
- import { Panel } from "@dxos/react-ui";
9
- import { TestPanel } from "#components";
10
- import { useDeployDeps } from "#hooks";
11
- var __dxlog_file = "/__w/dxos/dxos/packages/plugins/plugin-script/src/containers/TestContainer/TestContainer.tsx";
12
- var TestContainer = ({ role, script }) => {
13
- const { client, fn, existingFunctionId } = useDeployDeps({
14
- script
15
- });
16
- const spaceId = Obj.getDatabase(script)?.spaceId;
17
- const functionsClient = useMemo(() => FunctionsServiceClient.fromClient(client), [
18
- client
19
- ]);
20
- const handleInvoke = useCallback(async (input) => {
21
- if (!fn) {
22
- throw new Error("Function not deployed");
23
- }
24
- return functionsClient.invoke(Context.default(void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 23 }), fn, input, {
25
- spaceId
26
- });
27
- }, [
28
- fn,
29
- functionsClient,
30
- spaceId
31
- ]);
32
- return /* @__PURE__ */ React.createElement(Panel.Root, {
33
- role,
34
- className: "dx-document"
35
- }, /* @__PURE__ */ React.createElement(Panel.Content, {
36
- asChild: true
37
- }, /* @__PURE__ */ React.createElement(TestPanel, {
38
- onInvoke: existingFunctionId ? handleInvoke : void 0
39
- })));
40
- };
41
- export {
42
- TestContainer as default
43
- };
44
- //# sourceMappingURL=TestContainer-AFVTBYSJ.mjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/containers/TestContainer/TestContainer.tsx"],
4
- "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport React, { useCallback, useMemo } from 'react';\n\nimport { type Script } from '@dxos/compute';\nimport { Context } from '@dxos/context';\nimport { Obj } from '@dxos/echo';\nimport { FunctionsServiceClient } from '@dxos/functions-runtime/edge';\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} className='dx-document'>\n <Panel.Content asChild>\n <TestPanel onInvoke={existingFunctionId ? handleInvoke : undefined} />\n </Panel.Content>\n </Panel.Root>\n );\n};\n"],
5
- "mappings": ";;;AAIA,OAAOA,SAASC,aAAaC,eAAe;AAG5C,SAASC,eAAe;AACxB,SAASC,WAAW;AACpB,SAASC,8BAA8B;AACvC,SAASC,aAAa;AAEtB,SAASC,iBAAiB;AAC1B,SAASC,qBAAqB;AAO9B,IAAA,eAAaC;IACgDC,gBAAAA,CAAAA,EAAAA,MAAAA,OAAAA,MAAAA;AAAO,QAAA,EAAA,QAAA,IAAA,mBAAA,IAAA,cAAA;IAClE;EAEA,CAAA;QAAkFC,UAAAA,IAAAA,YAAAA,MAAAA,GAAAA;QAAO,kBAAA,QAAA,MAAA,uBAAA,WAAA,MAAA,GAAA;IAEzF;;uBAGgBC,YAAM,OAAA,UAAA;AAClB,QAAA,CAAA,IAAA;AACA,YAAOC,IAAAA,MAAAA,uBAA+BC;;AAAgC,WAAA,gBAAA,OAAA,QAAA,QAAA,QAAA,EAAA,YAAA,YAAA,GAAA,cAAA,GAAA,GAAA,CAAA,GAAA,IAAA,OAAA;MAExE;IAACC,CAAAA;;IAAqBC;IAAQ;IAGhC;;SACoC,sBAAA,cAAA,MAAA,MAAA;;IACjBC,WAAAA;KACb,sBAAA,cAACV,MAAAA,SAAAA;IAAUW,SAAAA;;IAIjB,UAAA,qBAAA,eAAA;;;",
6
- "names": ["React", "useCallback", "useMemo", "Context", "Obj", "FunctionsServiceClient", "Panel", "TestPanel", "useDeployDeps", "TestContainer", "script", "client", "Error", "functionsClient", "default", "fn", "spaceId", "asChild", "onInvoke"]
7
- }
@@ -1,52 +0,0 @@
1
- import "./chunk-J5LGTIGS.mjs";
2
-
3
- // src/capabilities/app-graph-builder.ts
4
- import * as Effect from "effect/Effect";
5
- import { Capability } from "@dxos/app-framework";
6
- import { AppCapabilities, AppNode } from "@dxos/app-toolkit";
7
- import { Script } from "@dxos/compute";
8
- import { GraphBuilder } from "@dxos/plugin-graph";
9
- import { meta } from "#meta";
10
- var app_graph_builder_default = Capability.makeModule(Effect.fnUntraced(function* () {
11
- const extensions = yield* Effect.all([
12
- GraphBuilder.createTypeExtension({
13
- id: "execute",
14
- type: Script.Script,
15
- connector: () => Effect.succeed([
16
- AppNode.makeCompanion({
17
- id: "execute",
18
- label: [
19
- "script-test.label",
20
- {
21
- ns: meta.profile.key
22
- }
23
- ],
24
- icon: "ph--terminal--regular",
25
- data: "execute"
26
- })
27
- ])
28
- }),
29
- GraphBuilder.createTypeExtension({
30
- id: "logs",
31
- type: Script.Script,
32
- connector: () => Effect.succeed([
33
- AppNode.makeCompanion({
34
- id: "logs",
35
- label: [
36
- "script-logs.label",
37
- {
38
- ns: meta.profile.key
39
- }
40
- ],
41
- icon: "ph--clock-countdown--regular",
42
- data: "logs"
43
- })
44
- ])
45
- })
46
- ]);
47
- return Capability.contributes(AppCapabilities.AppGraphBuilder, extensions);
48
- }));
49
- export {
50
- app_graph_builder_default as default
51
- };
52
- //# sourceMappingURL=app-graph-builder-POP3CX6G.mjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/capabilities/app-graph-builder.ts"],
4
- "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\n\nimport { Capability } from '@dxos/app-framework';\nimport { AppCapabilities, AppNode } from '@dxos/app-toolkit';\nimport { Script } from '@dxos/compute';\nimport { GraphBuilder } from '@dxos/plugin-graph';\n\nimport { meta } from '#meta';\n\nexport default Capability.makeModule(\n Effect.fnUntraced(function* () {\n const extensions = yield* Effect.all([\n GraphBuilder.createTypeExtension({\n id: 'execute',\n type: Script.Script,\n connector: () =>\n Effect.succeed([\n AppNode.makeCompanion({\n id: 'execute',\n label: ['script-test.label', { ns: meta.profile.key }],\n icon: 'ph--terminal--regular',\n data: 'execute',\n }),\n ]),\n }),\n GraphBuilder.createTypeExtension({\n id: 'logs',\n type: Script.Script,\n connector: () =>\n Effect.succeed([\n AppNode.makeCompanion({\n id: '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.contributes(AppCapabilities.AppGraphBuilder, extensions);\n }),\n);\n"],
5
- "mappings": ";;;AAIA,YAAYA,YAAY;AAExB,SAASC,kBAAkB;AAC3B,SAASC,iBAAiBC,eAAe;AACzC,SAASC,cAAc;AACvB,SAASC,oBAAoB;AAE7B,SAASC,YAAY;AAErB,IAAA,4BAAeL,WAAWM,WACjBC,kBAAW,aAAA;AAChB,QAAMC,aAAa,OAAcC,WAAI;IACnCL,aAAaM,oBAAoB;MAC/BC,IAAI;MACJC,MAAMT,OAAOA;MACbU,WAAW,MACFC,eAAQ;QACbZ,QAAQa,cAAc;UACpBJ,IAAI;UACJK,OAAO;YAAC;YAAqB;cAAEC,IAAIZ,KAAKa,QAAQC;YAAI;;UACpDC,MAAM;UACNC,MAAM;QACR,CAAA;OACD;IACL,CAAA;IACAjB,aAAaM,oBAAoB;MAC/BC,IAAI;MACJC,MAAMT,OAAOA;MACbU,WAAW,MACFC,eAAQ;QACbZ,QAAQa,cAAc;UACpBJ,IAAI;UACJK,OAAO;YAAC;YAAqB;cAAEC,IAAIZ,KAAKa,QAAQC;YAAI;;UACpDC,MAAM;UACNC,MAAM;QACR,CAAA;OACD;IACL,CAAA;GACD;AAED,SAAOrB,WAAWsB,YAAYrB,gBAAgBsB,iBAAiBf,UAAAA;AACjE,CAAA,CAAA;",
6
- "names": ["Effect", "Capability", "AppCapabilities", "AppNode", "Script", "GraphBuilder", "meta", "makeModule", "fnUntraced", "extensions", "all", "createTypeExtension", "id", "type", "connector", "succeed", "makeCompanion", "label", "ns", "profile", "key", "icon", "data", "contributes", "AppGraphBuilder"]
7
- }
@@ -1,21 +0,0 @@
1
- import "../chunk-J5LGTIGS.mjs";
2
-
3
- // src/capabilities/index.ts
4
- import { Capability } from "@dxos/app-framework";
5
- var AppGraphBuilder = Capability.lazy("AppGraphBuilder", () => import("../app-graph-builder-POP3CX6G.mjs"));
6
- var SkillDefinition = Capability.lazy("SkillDefinition", () => import("../skill-definition-JZ7UYBT7.mjs"));
7
- var CreateObject = Capability.lazy("CreateObject", () => import("../create-object-QW66KQWS.mjs"));
8
- var Compiler = Capability.lazy("Compiler", () => import("../compiler-ODK4UA2N.mjs"));
9
- var OperationHandler = Capability.lazy("OperationHandler", () => import("../operation-handler-M3B6IRMV.mjs"));
10
- var ReactSurface = Capability.lazy("ReactSurface", () => import("../react-surface-GEXOZLBC.mjs"));
11
- var ScriptSettings = Capability.lazy("ScriptSettings", () => import("../settings-FD7HXEY6.mjs"));
12
- export {
13
- AppGraphBuilder,
14
- Compiler,
15
- CreateObject,
16
- OperationHandler,
17
- ReactSurface,
18
- ScriptSettings,
19
- SkillDefinition
20
- };
21
- //# sourceMappingURL=index.mjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../../src/capabilities/index.ts"],
4
- "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { Capability } from '@dxos/app-framework';\nimport type { OperationHandlerSet } from '@dxos/compute';\n\nexport const AppGraphBuilder = Capability.lazy('AppGraphBuilder', () => import('./app-graph-builder'));\nexport const SkillDefinition = Capability.lazy('SkillDefinition', () => import('./skill-definition'));\nexport const CreateObject = Capability.lazy('CreateObject', () => import('./create-object'));\nexport const Compiler = Capability.lazy('Compiler', () => import('./compiler'));\nexport const OperationHandler = Capability.lazy<OperationHandlerSet.OperationHandlerSet>(\n 'OperationHandler',\n () => import('./operation-handler'),\n);\nexport const ReactSurface = Capability.lazy('ReactSurface', () => import('./react-surface'));\nexport const ScriptSettings = Capability.lazy('ScriptSettings', () => import('./settings'));\n"],
5
- "mappings": ";;;AAIA,SAASA,kBAAkB;AAGpB,IAAMC,kBAAkBD,WAAWE,KAAK,mBAAmB,MAAM,OAAO,mCAAA,CAAA;AACxE,IAAMC,kBAAkBH,WAAWE,KAAK,mBAAmB,MAAM,OAAO,kCAAA,CAAA;AACxE,IAAME,eAAeJ,WAAWE,KAAK,gBAAgB,MAAM,OAAO,+BAAA,CAAA;AAClE,IAAMG,WAAWL,WAAWE,KAAK,YAAY,MAAM,OAAO,0BAAA,CAAA;AAC1D,IAAMI,mBAAmBN,WAAWE,KACzC,oBACA,MAAM,OAAO,mCAAA,CAAA;AAER,IAAMK,eAAeP,WAAWE,KAAK,gBAAgB,MAAM,OAAO,+BAAA,CAAA;AAClE,IAAMM,iBAAiBR,WAAWE,KAAK,kBAAkB,MAAM,OAAO,0BAAA,CAAA;",
6
- "names": ["Capability", "AppGraphBuilder", "lazy", "SkillDefinition", "CreateObject", "Compiler", "OperationHandler", "ReactSurface", "ScriptSettings"]
7
- }
@@ -1,17 +0,0 @@
1
- import "../chunk-J5LGTIGS.mjs";
2
-
3
- // src/capabilities/node.ts
4
- import { Capability } from "@dxos/app-framework";
5
- var AppGraphBuilder = Capability.lazy("AppGraphBuilder", () => import("../app-graph-builder-POP3CX6G.mjs"));
6
- var SkillDefinition = Capability.lazy("SkillDefinition", () => import("../skill-definition-JZ7UYBT7.mjs"));
7
- var CreateObject = Capability.lazy("CreateObject", () => import("../create-object-QW66KQWS.mjs"));
8
- var Compiler = Capability.lazy("Compiler", () => import("../compiler-ODK4UA2N.mjs"));
9
- var OperationHandler = Capability.lazy("OperationHandler", () => import("../operation-handler-M3B6IRMV.mjs"));
10
- export {
11
- AppGraphBuilder,
12
- Compiler,
13
- CreateObject,
14
- OperationHandler,
15
- SkillDefinition
16
- };
17
- //# sourceMappingURL=node.mjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../../src/capabilities/node.ts"],
4
- "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { Capability } from '@dxos/app-framework';\nimport type { OperationHandlerSet } from '@dxos/compute';\n\nexport const AppGraphBuilder = Capability.lazy('AppGraphBuilder', () => import('./app-graph-builder'));\nexport const SkillDefinition = Capability.lazy('SkillDefinition', () => import('./skill-definition'));\nexport const CreateObject = Capability.lazy('CreateObject', () => import('./create-object'));\nexport const Compiler = Capability.lazy('Compiler', () => import('./compiler'));\nexport const OperationHandler = Capability.lazy<OperationHandlerSet.OperationHandlerSet>(\n 'OperationHandler',\n () => import('./operation-handler'),\n);\n"],
5
- "mappings": ";;;AAIA,SAASA,kBAAkB;AAGpB,IAAMC,kBAAkBD,WAAWE,KAAK,mBAAmB,MAAM,OAAO,mCAAA,CAAA;AACxE,IAAMC,kBAAkBH,WAAWE,KAAK,mBAAmB,MAAM,OAAO,kCAAA,CAAA;AACxE,IAAME,eAAeJ,WAAWE,KAAK,gBAAgB,MAAM,OAAO,+BAAA,CAAA;AAClE,IAAMG,WAAWL,WAAWE,KAAK,YAAY,MAAM,OAAO,0BAAA,CAAA;AAC1D,IAAMI,mBAAmBN,WAAWE,KACzC,oBACA,MAAM,OAAO,mCAAA,CAAA;",
6
- "names": ["Capability", "AppGraphBuilder", "lazy", "SkillDefinition", "CreateObject", "Compiler", "OperationHandler"]
7
- }
@@ -1,56 +0,0 @@
1
- // src/compiler/compiler.ts
2
- import { createDefaultMapFromCDN, createSystem, createVirtualTypeScriptEnvironment } from "@typescript/vfs";
3
- import ts from "typescript";
4
- import { invariant } from "@dxos/invariant";
5
- var __dxlog_file = "/__w/dxos/dxos/packages/plugins/plugin-script/src/compiler/compiler.ts";
6
- var GLOBALS = "globals.d.ts";
7
- var CDN_TS_VERSION = "5.6.3";
8
- var defaultOptions = {
9
- lib: [
10
- "DOM",
11
- "es2022"
12
- ],
13
- target: ts.ScriptTarget.ES2022,
14
- // Override `@typescript/vfs`'s default of `NodeJs` (== deprecated `node10`).
15
- // TypeScript 6 throws on that as a `getCompilerOptionsDiagnostics()` error,
16
- // which surfaces as an unhandled rejection inside the storybook task.
17
- moduleResolution: ts.ModuleResolutionKind.Bundler
18
- };
19
- var Compiler = class {
20
- _options;
21
- _env;
22
- _fsMap;
23
- constructor(_options = defaultOptions) {
24
- this._options = _options;
25
- }
26
- async initialize(globals) {
27
- if (this._env) {
28
- return;
29
- }
30
- this._fsMap = await createDefaultMapFromCDN(this._options, CDN_TS_VERSION, true, ts);
31
- if (globals) {
32
- this._fsMap.set(GLOBALS, globals);
33
- }
34
- const rootFiles = globals ? [
35
- GLOBALS
36
- ] : [];
37
- const system = createSystem(this._fsMap);
38
- this._env = createVirtualTypeScriptEnvironment(system, rootFiles, ts, this._options);
39
- }
40
- get environment() {
41
- invariant(this._env, "Compiler environment not initialized.", { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 48, S: this, A: ["this._env", "'Compiler environment not initialized.'"] });
42
- return this._env;
43
- }
44
- setFile(fileName, content) {
45
- invariant(this._fsMap, "File system map not initialized.", { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 52, S: this, A: ["this._fsMap", "'File system map not initialized.'"] });
46
- this.environment.createFile(fileName, content);
47
- }
48
- compile(fileName) {
49
- return this.environment.languageService.getEmitOutput(fileName);
50
- }
51
- };
52
-
53
- export {
54
- Compiler
55
- };
56
- //# sourceMappingURL=chunk-2REUEDUA.mjs.map