@dxos/plugin-script 0.7.5-main.499c70c → 0.7.5-main.6a330ac

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 (276) hide show
  1. package/dist/lib/browser/ScriptContainer-3RFMYKTV.mjs +258 -0
  2. package/dist/lib/browser/ScriptContainer-3RFMYKTV.mjs.map +7 -0
  3. package/dist/lib/browser/artifact-definition-4LWPD3DH.mjs +251 -0
  4. package/dist/lib/browser/artifact-definition-4LWPD3DH.mjs.map +7 -0
  5. package/dist/lib/browser/{chunk-K7KY6YMG.mjs → chunk-5SXOHNAK.mjs} +4 -4
  6. package/dist/lib/browser/chunk-5SXOHNAK.mjs.map +7 -0
  7. package/dist/lib/browser/chunk-6MOQ4BP3.mjs +15 -0
  8. package/dist/lib/browser/chunk-6MOQ4BP3.mjs.map +7 -0
  9. package/dist/lib/browser/chunk-FVVCAWNP.mjs +21 -0
  10. package/dist/lib/browser/chunk-FVVCAWNP.mjs.map +7 -0
  11. package/dist/lib/browser/chunk-G2FYNDU4.mjs +475 -0
  12. package/dist/lib/browser/chunk-G2FYNDU4.mjs.map +7 -0
  13. package/dist/lib/browser/chunk-N46LE7FS.mjs +40 -0
  14. package/dist/lib/browser/chunk-N46LE7FS.mjs.map +7 -0
  15. package/dist/lib/browser/chunk-PZPYF7M4.mjs +69 -0
  16. package/dist/lib/browser/chunk-PZPYF7M4.mjs.map +7 -0
  17. package/dist/lib/browser/chunk-VTWBVFBK.mjs +234 -0
  18. package/dist/lib/browser/chunk-VTWBVFBK.mjs.map +7 -0
  19. package/dist/lib/browser/compiler-YY2XSKHQ.mjs +82 -0
  20. package/dist/lib/browser/compiler-YY2XSKHQ.mjs.map +7 -0
  21. package/dist/lib/browser/index.mjs +146 -289
  22. package/dist/lib/browser/index.mjs.map +4 -4
  23. package/dist/lib/browser/intent-resolver-D6FPY5ZA.mjs +45 -0
  24. package/dist/lib/browser/intent-resolver-D6FPY5ZA.mjs.map +7 -0
  25. package/dist/lib/browser/meta.json +1 -1
  26. package/dist/lib/browser/react-surface-G4C2PZ2K.mjs +81 -0
  27. package/dist/lib/browser/react-surface-G4C2PZ2K.mjs.map +7 -0
  28. package/dist/lib/browser/settings-SZCDKHWO.mjs +24 -0
  29. package/dist/lib/browser/settings-SZCDKHWO.mjs.map +7 -0
  30. package/dist/lib/browser/types.mjs +6 -4
  31. package/dist/lib/node/ScriptContainer-G6FZU4AM.cjs +274 -0
  32. package/dist/lib/node/ScriptContainer-G6FZU4AM.cjs.map +7 -0
  33. package/dist/lib/node/artifact-definition-BXQCFPAH.cjs +267 -0
  34. package/dist/lib/node/artifact-definition-BXQCFPAH.cjs.map +7 -0
  35. package/dist/lib/node/{chunk-6LYX73ZT.cjs → chunk-5UH3F7TA.cjs} +11 -8
  36. package/dist/lib/node/chunk-5UH3F7TA.cjs.map +7 -0
  37. package/dist/lib/node/{meta.cjs → chunk-ALY3N6PW.cjs} +12 -8
  38. package/dist/lib/node/chunk-ALY3N6PW.cjs.map +7 -0
  39. package/dist/lib/node/{chunk-PK3OQP5L.cjs → chunk-DJGLGRQV.cjs} +26 -11
  40. package/dist/lib/node/chunk-DJGLGRQV.cjs.map +7 -0
  41. package/dist/lib/node/chunk-ITAJ3WRW.cjs +77 -0
  42. package/dist/lib/node/chunk-ITAJ3WRW.cjs.map +7 -0
  43. package/dist/lib/node/{chunk-4INUJLXL.cjs → chunk-K3ZZWVXS.cjs} +7 -7
  44. package/dist/lib/node/chunk-K3ZZWVXS.cjs.map +7 -0
  45. package/dist/lib/node/chunk-TOXBGIEI.cjs +261 -0
  46. package/dist/lib/node/chunk-TOXBGIEI.cjs.map +7 -0
  47. package/dist/lib/node/chunk-XKYJYY3T.cjs +498 -0
  48. package/dist/lib/node/chunk-XKYJYY3T.cjs.map +7 -0
  49. package/dist/lib/node/compiler-UIBLKJKG.cjs +104 -0
  50. package/dist/lib/node/compiler-UIBLKJKG.cjs.map +7 -0
  51. package/dist/lib/node/index.cjs +138 -278
  52. package/dist/lib/node/index.cjs.map +4 -4
  53. package/dist/lib/node/intent-resolver-NYJFPD5B.cjs +59 -0
  54. package/dist/lib/node/intent-resolver-NYJFPD5B.cjs.map +7 -0
  55. package/dist/lib/node/meta.json +1 -1
  56. package/dist/lib/node/react-surface-EGSE3FMN.cjs +96 -0
  57. package/dist/lib/node/react-surface-EGSE3FMN.cjs.map +7 -0
  58. package/dist/lib/node/settings-SZFSMSKM.cjs +38 -0
  59. package/dist/lib/node/settings-SZFSMSKM.cjs.map +7 -0
  60. package/dist/lib/node/types.cjs +6 -4
  61. package/dist/lib/node/types.cjs.map +2 -2
  62. package/dist/lib/node-esm/ScriptContainer-7FTCFIF3.mjs +259 -0
  63. package/dist/lib/node-esm/ScriptContainer-7FTCFIF3.mjs.map +7 -0
  64. package/dist/lib/node-esm/artifact-definition-KT4DK2LQ.mjs +252 -0
  65. package/dist/lib/node-esm/artifact-definition-KT4DK2LQ.mjs.map +7 -0
  66. package/dist/lib/node-esm/{chunk-OFYGBUNI.mjs → chunk-2AFXX34U.mjs} +4 -4
  67. package/dist/lib/node-esm/chunk-2AFXX34U.mjs.map +7 -0
  68. package/dist/lib/node-esm/chunk-CP5LXTK5.mjs +16 -0
  69. package/dist/lib/node-esm/chunk-CP5LXTK5.mjs.map +7 -0
  70. package/dist/lib/node-esm/chunk-NRICF4KE.mjs +476 -0
  71. package/dist/lib/node-esm/chunk-NRICF4KE.mjs.map +7 -0
  72. package/dist/lib/node-esm/{chunk-SLTZMY34.mjs → chunk-P2V2Y5LV.mjs} +7 -4
  73. package/dist/lib/node-esm/chunk-P2V2Y5LV.mjs.map +7 -0
  74. package/dist/lib/node-esm/chunk-S64WSJQK.mjs +235 -0
  75. package/dist/lib/node-esm/chunk-S64WSJQK.mjs.map +7 -0
  76. package/dist/lib/node-esm/chunk-UNQFIERE.mjs +41 -0
  77. package/dist/lib/node-esm/chunk-UNQFIERE.mjs.map +7 -0
  78. package/dist/lib/node-esm/chunk-YIWRJ25J.mjs +71 -0
  79. package/dist/lib/node-esm/chunk-YIWRJ25J.mjs.map +7 -0
  80. package/dist/lib/node-esm/compiler-XTXFGZJM.mjs +83 -0
  81. package/dist/lib/node-esm/compiler-XTXFGZJM.mjs.map +7 -0
  82. package/dist/lib/node-esm/index.mjs +146 -289
  83. package/dist/lib/node-esm/index.mjs.map +4 -4
  84. package/dist/lib/node-esm/intent-resolver-KLBHSMW4.mjs +46 -0
  85. package/dist/lib/node-esm/intent-resolver-KLBHSMW4.mjs.map +7 -0
  86. package/dist/lib/node-esm/meta.json +1 -1
  87. package/dist/lib/node-esm/react-surface-7YSGHZQM.mjs +82 -0
  88. package/dist/lib/node-esm/react-surface-7YSGHZQM.mjs.map +7 -0
  89. package/dist/lib/node-esm/settings-GR4O2WHZ.mjs +25 -0
  90. package/dist/lib/node-esm/settings-GR4O2WHZ.mjs.map +7 -0
  91. package/dist/lib/node-esm/types.mjs +6 -4
  92. package/dist/types/src/ScriptPlugin.d.ts +1 -3
  93. package/dist/types/src/ScriptPlugin.d.ts.map +1 -1
  94. package/dist/types/src/capabilities/artifact-definition.d.ts +11 -0
  95. package/dist/types/src/capabilities/artifact-definition.d.ts.map +1 -0
  96. package/dist/types/src/capabilities/capabilities.d.ts +5 -0
  97. package/dist/types/src/capabilities/capabilities.d.ts.map +1 -0
  98. package/dist/types/src/capabilities/compiler.d.ts +4 -0
  99. package/dist/types/src/capabilities/compiler.d.ts.map +1 -0
  100. package/dist/types/src/capabilities/index.d.ts +7 -0
  101. package/dist/types/src/capabilities/index.d.ts.map +1 -0
  102. package/dist/types/src/capabilities/intent-resolver.d.ts +4 -0
  103. package/dist/types/src/capabilities/intent-resolver.d.ts.map +1 -0
  104. package/dist/types/src/capabilities/react-surface.d.ts +4 -0
  105. package/dist/types/src/capabilities/react-surface.d.ts.map +1 -0
  106. package/dist/types/src/capabilities/settings.d.ts +4 -0
  107. package/dist/types/src/capabilities/settings.d.ts.map +1 -0
  108. package/dist/types/src/components/DebugPanel/DebugPanel.d.ts +1 -2
  109. package/dist/types/src/components/DebugPanel/DebugPanel.d.ts.map +1 -1
  110. package/dist/types/src/components/FrameContainer/FrameContainer.d.ts +3 -4
  111. package/dist/types/src/components/FrameContainer/FrameContainer.d.ts.map +1 -1
  112. package/dist/types/src/components/ScriptContainer.d.ts +10 -3
  113. package/dist/types/src/components/ScriptContainer.d.ts.map +1 -1
  114. package/dist/types/src/components/ScriptSettings/ScriptSettings.d.ts +1 -2
  115. package/dist/types/src/components/ScriptSettings/ScriptSettings.d.ts.map +1 -1
  116. package/dist/types/src/components/ScriptSettingsPanel.d.ts +1 -2
  117. package/dist/types/src/components/ScriptSettingsPanel.d.ts.map +1 -1
  118. package/dist/types/src/components/ScriptToolbar/ScriptToolbar.d.ts +10 -0
  119. package/dist/types/src/components/ScriptToolbar/ScriptToolbar.d.ts.map +1 -0
  120. package/dist/types/src/components/{Toolbar/Toolbar.stories.d.ts → ScriptToolbar/ScriptToolbar.stories.d.ts} +1 -1
  121. package/dist/types/src/components/ScriptToolbar/ScriptToolbar.stories.d.ts.map +1 -0
  122. package/dist/types/src/components/ScriptToolbar/index.d.ts +2 -0
  123. package/dist/types/src/components/ScriptToolbar/index.d.ts.map +1 -0
  124. package/dist/types/src/components/TypescriptEditor/TypescriptEditor.d.ts +4 -3
  125. package/dist/types/src/components/TypescriptEditor/TypescriptEditor.d.ts.map +1 -1
  126. package/dist/types/src/components/TypescriptEditor/TypescriptEditor.stories.d.ts.map +1 -1
  127. package/dist/types/src/components/index.d.ts +2 -2
  128. package/dist/types/src/components/index.d.ts.map +1 -1
  129. package/dist/types/src/events.d.ts +4 -0
  130. package/dist/types/src/events.d.ts.map +1 -0
  131. package/dist/types/src/hooks/deploy.d.ts +48 -0
  132. package/dist/types/src/hooks/deploy.d.ts.map +1 -0
  133. package/dist/types/src/hooks/format.d.ts +25 -0
  134. package/dist/types/src/hooks/format.d.ts.map +1 -0
  135. package/dist/types/src/hooks/index.d.ts +7 -0
  136. package/dist/types/src/hooks/index.d.ts.map +1 -0
  137. package/dist/types/src/hooks/template.d.ts +31 -0
  138. package/dist/types/src/hooks/template.d.ts.map +1 -0
  139. package/dist/types/src/hooks/useToolbarAction.d.ts +14 -0
  140. package/dist/types/src/hooks/useToolbarAction.d.ts.map +1 -0
  141. package/dist/types/src/hooks/useToolbarState.d.ts +10 -0
  142. package/dist/types/src/hooks/useToolbarState.d.ts.map +1 -0
  143. package/dist/types/src/hooks/view.d.ts +33 -0
  144. package/dist/types/src/hooks/view.d.ts.map +1 -0
  145. package/dist/types/src/index.d.ts +2 -5
  146. package/dist/types/src/index.d.ts.map +1 -1
  147. package/dist/types/src/meta.d.ts +2 -2
  148. package/dist/types/src/meta.d.ts.map +1 -1
  149. package/dist/types/src/templates/chess.d.ts +1 -4
  150. package/dist/types/src/templates/chess.d.ts.map +1 -1
  151. package/dist/types/src/templates/discord.d.ts +3 -0
  152. package/dist/types/src/templates/discord.d.ts.map +1 -0
  153. package/dist/types/src/templates/echo.d.ts.map +1 -1
  154. package/dist/types/src/templates/email.d.ts +2 -1
  155. package/dist/types/src/templates/email.d.ts.map +1 -1
  156. package/dist/types/src/templates/forex-effect.d.ts +3 -0
  157. package/dist/types/src/templates/forex-effect.d.ts.map +1 -0
  158. package/dist/types/src/templates/forex.d.ts +1 -4
  159. package/dist/types/src/templates/forex.d.ts.map +1 -1
  160. package/dist/types/src/{templates.d.ts → templates/index.d.ts} +1 -1
  161. package/dist/types/src/templates/index.d.ts.map +1 -0
  162. package/dist/types/src/translations.d.ts +100 -0
  163. package/dist/types/src/translations.d.ts.map +1 -1
  164. package/dist/types/src/types.d.ts +14 -6
  165. package/dist/types/src/types.d.ts.map +1 -1
  166. package/dist/types/tsconfig.tsbuildinfo +1 -1
  167. package/package.json +46 -46
  168. package/src/ScriptPlugin.tsx +80 -91
  169. package/src/capabilities/artifact-definition.ts +224 -0
  170. package/src/capabilities/capabilities.ts +12 -0
  171. package/src/capabilities/compiler.ts +33 -0
  172. package/src/capabilities/index.ts +13 -0
  173. package/src/capabilities/intent-resolver.ts +46 -0
  174. package/src/capabilities/react-surface.tsx +60 -0
  175. package/src/capabilities/settings.ts +14 -0
  176. package/src/compiler/compiler.browser.test.ts +1 -1
  177. package/src/components/DebugPanel/DebugPanel.tsx +2 -2
  178. package/src/components/FrameContainer/FrameContainer.tsx +5 -4
  179. package/src/components/ScriptContainer.tsx +69 -9
  180. package/src/components/ScriptSettings/ScriptSettings.tsx +28 -4
  181. package/src/components/ScriptSettingsPanel.tsx +139 -51
  182. package/src/components/{Toolbar/Toolbar.stories.tsx → ScriptToolbar/ScriptToolbar.stories.tsx} +2 -2
  183. package/src/components/ScriptToolbar/ScriptToolbar.tsx +53 -0
  184. package/src/{bundler → components/ScriptToolbar}/index.ts +1 -1
  185. package/src/components/TypescriptEditor/TypescriptEditor.stories.tsx +2 -0
  186. package/src/components/TypescriptEditor/TypescriptEditor.tsx +75 -10
  187. package/src/components/index.ts +1 -1
  188. package/src/events.ts +11 -0
  189. package/src/hooks/deploy.ts +169 -0
  190. package/src/hooks/format.ts +47 -0
  191. package/src/hooks/index.ts +11 -0
  192. package/src/hooks/template.ts +64 -0
  193. package/src/hooks/useToolbarAction.ts +54 -0
  194. package/src/hooks/useToolbarState.ts +16 -0
  195. package/src/hooks/view.ts +55 -0
  196. package/src/index.ts +2 -7
  197. package/src/meta.ts +4 -2
  198. package/src/templates/chat.ts +4 -4
  199. package/src/templates/chess.ts +42 -35
  200. package/src/templates/discord.ts +103 -0
  201. package/src/templates/echo.ts +5 -1
  202. package/src/templates/email.ts +26 -23
  203. package/src/templates/forex-effect.ts +41 -0
  204. package/src/templates/forex.ts +23 -16
  205. package/src/{templates.ts → templates/index.ts} +20 -5
  206. package/src/translations.ts +26 -0
  207. package/src/types.ts +19 -18
  208. package/dist/lib/browser/AutomationPanel-RFQAQ7NF.mjs +0 -78
  209. package/dist/lib/browser/AutomationPanel-RFQAQ7NF.mjs.map +0 -7
  210. package/dist/lib/browser/ScriptContainer-IJNY7NHA.mjs +0 -415
  211. package/dist/lib/browser/ScriptContainer-IJNY7NHA.mjs.map +0 -7
  212. package/dist/lib/browser/chunk-4UTRJLQ3.mjs +0 -286
  213. package/dist/lib/browser/chunk-4UTRJLQ3.mjs.map +0 -7
  214. package/dist/lib/browser/chunk-C7VBULMK.mjs +0 -18
  215. package/dist/lib/browser/chunk-C7VBULMK.mjs.map +0 -7
  216. package/dist/lib/browser/chunk-K7KY6YMG.mjs.map +0 -7
  217. package/dist/lib/browser/chunk-RQA3EB5K.mjs +0 -26
  218. package/dist/lib/browser/chunk-RQA3EB5K.mjs.map +0 -7
  219. package/dist/lib/browser/meta.mjs +0 -9
  220. package/dist/lib/browser/meta.mjs.map +0 -7
  221. package/dist/lib/node/AutomationPanel-5CJEF4MI.cjs +0 -104
  222. package/dist/lib/node/AutomationPanel-5CJEF4MI.cjs.map +0 -7
  223. package/dist/lib/node/ScriptContainer-D7CCLTCJ.cjs +0 -426
  224. package/dist/lib/node/ScriptContainer-D7CCLTCJ.cjs.map +0 -7
  225. package/dist/lib/node/chunk-4INUJLXL.cjs.map +0 -7
  226. package/dist/lib/node/chunk-6LYX73ZT.cjs.map +0 -7
  227. package/dist/lib/node/chunk-PK3OQP5L.cjs.map +0 -7
  228. package/dist/lib/node/chunk-WPP65EYS.cjs +0 -298
  229. package/dist/lib/node/chunk-WPP65EYS.cjs.map +0 -7
  230. package/dist/lib/node/meta.cjs.map +0 -7
  231. package/dist/lib/node-esm/AutomationPanel-7Y6REBNJ.mjs +0 -79
  232. package/dist/lib/node-esm/AutomationPanel-7Y6REBNJ.mjs.map +0 -7
  233. package/dist/lib/node-esm/ScriptContainer-FURREOFW.mjs +0 -416
  234. package/dist/lib/node-esm/ScriptContainer-FURREOFW.mjs.map +0 -7
  235. package/dist/lib/node-esm/chunk-4SRPREUK.mjs +0 -288
  236. package/dist/lib/node-esm/chunk-4SRPREUK.mjs.map +0 -7
  237. package/dist/lib/node-esm/chunk-H6BBLQ5Q.mjs +0 -27
  238. package/dist/lib/node-esm/chunk-H6BBLQ5Q.mjs.map +0 -7
  239. package/dist/lib/node-esm/chunk-OFYGBUNI.mjs.map +0 -7
  240. package/dist/lib/node-esm/chunk-SLTZMY34.mjs.map +0 -7
  241. package/dist/lib/node-esm/meta.mjs +0 -10
  242. package/dist/lib/node-esm/meta.mjs.map +0 -7
  243. package/dist/types/src/bundler/bundler.d.ts +0 -39
  244. package/dist/types/src/bundler/bundler.d.ts.map +0 -1
  245. package/dist/types/src/bundler/bundler.test.d.ts +0 -2
  246. package/dist/types/src/bundler/bundler.test.d.ts.map +0 -1
  247. package/dist/types/src/bundler/index.d.ts +0 -2
  248. package/dist/types/src/bundler/index.d.ts.map +0 -1
  249. package/dist/types/src/components/AutomationPanel/AutomationPanel.d.ts +0 -17
  250. package/dist/types/src/components/AutomationPanel/AutomationPanel.d.ts.map +0 -1
  251. package/dist/types/src/components/AutomationPanel/index.d.ts +0 -4
  252. package/dist/types/src/components/AutomationPanel/index.d.ts.map +0 -1
  253. package/dist/types/src/components/ScriptBlock/ScriptBlock.d.ts +0 -12
  254. package/dist/types/src/components/ScriptBlock/ScriptBlock.d.ts.map +0 -1
  255. package/dist/types/src/components/ScriptBlock/ScriptBlock.stories.d.ts +0 -6
  256. package/dist/types/src/components/ScriptBlock/ScriptBlock.stories.d.ts.map +0 -1
  257. package/dist/types/src/components/ScriptBlock/index.d.ts +0 -2
  258. package/dist/types/src/components/ScriptBlock/index.d.ts.map +0 -1
  259. package/dist/types/src/components/ScriptEditor.d.ts +0 -9
  260. package/dist/types/src/components/ScriptEditor.d.ts.map +0 -1
  261. package/dist/types/src/components/Toolbar/Toolbar.d.ts +0 -23
  262. package/dist/types/src/components/Toolbar/Toolbar.d.ts.map +0 -1
  263. package/dist/types/src/components/Toolbar/Toolbar.stories.d.ts.map +0 -1
  264. package/dist/types/src/components/Toolbar/index.d.ts +0 -2
  265. package/dist/types/src/components/Toolbar/index.d.ts.map +0 -1
  266. package/dist/types/src/templates.d.ts.map +0 -1
  267. package/src/bundler/bundler.test.ts +0 -54
  268. package/src/bundler/bundler.ts +0 -250
  269. package/src/components/AutomationPanel/AutomationPanel.tsx +0 -104
  270. package/src/components/AutomationPanel/index.ts +0 -9
  271. package/src/components/ScriptBlock/ScriptBlock.stories.tsx +0 -55
  272. package/src/components/ScriptBlock/ScriptBlock.tsx +0 -102
  273. package/src/components/ScriptBlock/index.ts +0 -5
  274. package/src/components/ScriptEditor.tsx +0 -193
  275. package/src/components/Toolbar/Toolbar.tsx +0 -177
  276. package/src/components/Toolbar/index.ts +0 -5
@@ -0,0 +1,15 @@
1
+ import {
2
+ SCRIPT_PLUGIN
3
+ } from "./chunk-FVVCAWNP.mjs";
4
+
5
+ // packages/plugins/experimental/plugin-script/src/capabilities/capabilities.ts
6
+ import { defineCapability } from "@dxos/app-framework";
7
+ var ScriptCapabilities;
8
+ (function(ScriptCapabilities2) {
9
+ ScriptCapabilities2.Compiler = defineCapability(`${SCRIPT_PLUGIN}/capability/compiler`);
10
+ })(ScriptCapabilities || (ScriptCapabilities = {}));
11
+
12
+ export {
13
+ ScriptCapabilities
14
+ };
15
+ //# sourceMappingURL=chunk-6MOQ4BP3.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/capabilities/capabilities.ts"],
4
+ "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { defineCapability } from '@dxos/app-framework';\n\nimport { type Compiler } from '../compiler';\nimport { SCRIPT_PLUGIN } from '../meta';\n\nexport namespace ScriptCapabilities {\n export const Compiler = defineCapability<Compiler>(`${SCRIPT_PLUGIN}/capability/compiler`);\n}\n"],
5
+ "mappings": ";;;;;AAIA,SAASA,wBAAwB;;UAKhBC,qBAAAA;sBACFC,WAAWC,iBAA2B,GAAGC,aAAAA,sBAAmC;AAC3F,GAFiBH,uBAAAA,qBAAAA,CAAAA,EAAAA;",
6
+ "names": ["defineCapability", "ScriptCapabilities", "Compiler", "defineCapability", "SCRIPT_PLUGIN"]
7
+ }
@@ -0,0 +1,21 @@
1
+ // packages/plugins/experimental/plugin-script/src/meta.ts
2
+ var SCRIPT_PLUGIN = "dxos.org/plugin/script";
3
+ var meta = {
4
+ id: SCRIPT_PLUGIN,
5
+ name: "Scripts",
6
+ description: "Scripts in Composer allow you to deploy custom functions that run on the edge. These functions can be referenced by your AI agent and called inside of cells in any Sheet. Use scripts to interact with API\u2019s or external data inside of Composer.",
7
+ icon: "ph--code--regular",
8
+ source: "https://github.com/dxos/dxos/tree/main/packages/plugins/experimental/plugin-explorer",
9
+ tags: [
10
+ "experimental"
11
+ ],
12
+ screenshots: [
13
+ "https://dxos.network/plugin-details-scripts-dark.png"
14
+ ]
15
+ };
16
+
17
+ export {
18
+ SCRIPT_PLUGIN,
19
+ meta
20
+ };
21
+ //# sourceMappingURL=chunk-FVVCAWNP.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/meta.ts"],
4
+ "sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { type PluginMeta } from '@dxos/app-framework';\n\nexport const SCRIPT_PLUGIN = 'dxos.org/plugin/script';\n\nexport const meta = {\n id: SCRIPT_PLUGIN,\n name: 'Scripts',\n description:\n 'Scripts in Composer allow you to deploy custom functions that run on the edge. These functions can be referenced by your AI agent and called inside of cells in any Sheet. Use scripts to interact with API’s or external data inside of Composer.',\n icon: 'ph--code--regular',\n source: 'https://github.com/dxos/dxos/tree/main/packages/plugins/experimental/plugin-explorer',\n tags: ['experimental'],\n screenshots: ['https://dxos.network/plugin-details-scripts-dark.png'],\n} satisfies PluginMeta;\n"],
5
+ "mappings": ";AAMO,IAAMA,gBAAgB;AAEtB,IAAMC,OAAO;EAClBC,IAAIF;EACJG,MAAM;EACNC,aACE;EACFC,MAAM;EACNC,QAAQ;EACRC,MAAM;IAAC;;EACPC,aAAa;IAAC;;AAChB;",
6
+ "names": ["SCRIPT_PLUGIN", "meta", "id", "name", "description", "icon", "source", "tags", "screenshots"]
7
+ }
@@ -0,0 +1,475 @@
1
+ import {
2
+ templates
3
+ } from "./chunk-PZPYF7M4.mjs";
4
+ import {
5
+ SCRIPT_PLUGIN
6
+ } from "./chunk-FVVCAWNP.mjs";
7
+
8
+ // packages/plugins/experimental/plugin-script/src/hooks/deploy.ts
9
+ import { useCallback, useEffect, useMemo } from "react";
10
+ import { FunctionType, getInvocationUrl, getUserFunctionUrlInMetadata, incrementSemverPatch, setUserFunctionUrlInMetadata, uploadWorkerFunction } from "@dxos/functions";
11
+ import { Bundler } from "@dxos/functions/bundler";
12
+ import { log } from "@dxos/log";
13
+ import { useClient } from "@dxos/react-client";
14
+ import { Filter, create, getMeta, getSpace, makeRef, useQuery } from "@dxos/react-client/echo";
15
+ import { useTranslation } from "@dxos/react-ui";
16
+ import { createMenuAction } from "@dxos/react-ui-menu";
17
+ var __dxlog_file = "/home/runner/work/dxos/dxos/packages/plugins/experimental/plugin-script/src/hooks/deploy.ts";
18
+ var createDeploy = (state) => {
19
+ const errorItem = createMenuAction("error", {
20
+ label: state.error ?? [
21
+ "no error label",
22
+ {
23
+ ns: SCRIPT_PLUGIN
24
+ }
25
+ ],
26
+ icon: "ph--warning-circle--regular",
27
+ hidden: !state.error
28
+ });
29
+ const deployAction = createMenuAction("deploy", {
30
+ type: "deploy",
31
+ label: [
32
+ state.deploying ? "pending label" : "deploy label",
33
+ {
34
+ ns: SCRIPT_PLUGIN
35
+ }
36
+ ],
37
+ icon: state.deploying ? "ph--spinner-gap--regular" : "ph--cloud-arrow-up--regular",
38
+ disabled: state.deploying,
39
+ classNames: state.deploying ? "[&_svg]:animate-spin" : ""
40
+ });
41
+ const copyAction = createMenuAction("copy", {
42
+ type: "copy",
43
+ label: [
44
+ "copy link label",
45
+ {
46
+ ns: SCRIPT_PLUGIN
47
+ }
48
+ ],
49
+ icon: "ph--link--regular",
50
+ disabled: !state.functionUrl
51
+ });
52
+ return {
53
+ nodes: [
54
+ errorItem,
55
+ deployAction,
56
+ copyAction
57
+ ],
58
+ edges: [
59
+ {
60
+ source: "root",
61
+ target: "error"
62
+ },
63
+ {
64
+ source: "root",
65
+ target: "deploy"
66
+ },
67
+ {
68
+ source: "root",
69
+ target: "copy"
70
+ }
71
+ ]
72
+ };
73
+ };
74
+ var useDeployDeps = ({ state, script }) => {
75
+ const space = getSpace(script);
76
+ const [fn] = useQuery(space, Filter.schema(FunctionType, {
77
+ source: script
78
+ }));
79
+ const client = useClient();
80
+ const existingFunctionUrl = useMemo(() => fn && getUserFunctionUrlInMetadata(getMeta(fn)), [
81
+ fn
82
+ ]);
83
+ return {
84
+ space,
85
+ fn,
86
+ client,
87
+ existingFunctionUrl
88
+ };
89
+ };
90
+ var useDeployState = ({ state, script }) => {
91
+ const { space, client, existingFunctionUrl } = useDeployDeps({
92
+ state,
93
+ script
94
+ });
95
+ useEffect(() => {
96
+ if (!existingFunctionUrl) {
97
+ return;
98
+ }
99
+ state.functionUrl = getInvocationUrl(existingFunctionUrl, client.config.values.runtime?.services?.edge?.url ?? "", {
100
+ spaceId: space?.id
101
+ });
102
+ }, [
103
+ existingFunctionUrl,
104
+ space
105
+ ]);
106
+ useEffect(() => {
107
+ state.deployed = Boolean(existingFunctionUrl) && !script.changed;
108
+ }, [
109
+ script.changed,
110
+ existingFunctionUrl
111
+ ]);
112
+ };
113
+ var useDeployHandler = ({ state, script }) => {
114
+ const { space, fn, client, existingFunctionUrl } = useDeployDeps({
115
+ state,
116
+ script
117
+ });
118
+ const { t } = useTranslation(SCRIPT_PLUGIN);
119
+ return useCallback(async () => {
120
+ if (!script.source || !space) {
121
+ return;
122
+ }
123
+ state.error = void 0;
124
+ state.deploying = true;
125
+ try {
126
+ const existingFunctionId = existingFunctionUrl?.split("/").at(-1);
127
+ const bundler = new Bundler({
128
+ platform: "browser",
129
+ sandboxedModules: [],
130
+ remoteModules: {}
131
+ });
132
+ const buildResult = await bundler.bundle({
133
+ source: script.source.target.content
134
+ });
135
+ if (buildResult.error || !buildResult.bundle) {
136
+ throw buildResult.error;
137
+ }
138
+ const { functionId, version, meta } = await uploadWorkerFunction({
139
+ client,
140
+ spaceId: space.id,
141
+ version: fn ? incrementSemverPatch(fn.version) : "0.0.1",
142
+ functionId: existingFunctionId,
143
+ source: buildResult.bundle
144
+ });
145
+ if (functionId === void 0 || version === void 0) {
146
+ throw new Error(`Upload didn't return expected data: functionId=${functionId}, version=${version}`);
147
+ }
148
+ log.info("function uploaded", {
149
+ functionId,
150
+ version
151
+ }, {
152
+ F: __dxlog_file,
153
+ L: 124,
154
+ S: void 0,
155
+ C: (f, a) => f(...a)
156
+ });
157
+ if (fn) {
158
+ fn.version = version;
159
+ }
160
+ const deployedFunction = fn ?? space.db.add(create(FunctionType, {
161
+ name: functionId,
162
+ version,
163
+ source: makeRef(script)
164
+ }));
165
+ script.changed = false;
166
+ if (script.description !== void 0 && script.description.trim() !== "") {
167
+ deployedFunction.description = script.description;
168
+ } else if (meta.description) {
169
+ deployedFunction.description = meta.description;
170
+ } else {
171
+ log.verbose("no description in function metadata", {
172
+ functionId
173
+ }, {
174
+ F: __dxlog_file,
175
+ L: 138,
176
+ S: void 0,
177
+ C: (f, a) => f(...a)
178
+ });
179
+ }
180
+ if (meta.inputSchema) {
181
+ deployedFunction.inputSchema = meta.inputSchema;
182
+ } else {
183
+ log.verbose("no input schema in function metadata", {
184
+ functionId
185
+ }, {
186
+ F: __dxlog_file,
187
+ L: 144,
188
+ S: void 0,
189
+ C: (f, a) => f(...a)
190
+ });
191
+ }
192
+ if (meta.outputSchema) {
193
+ deployedFunction.outputSchema = meta.outputSchema;
194
+ } else {
195
+ log.verbose("no output schema in function metadata", {
196
+ functionId
197
+ }, {
198
+ F: __dxlog_file,
199
+ L: 149,
200
+ S: void 0,
201
+ C: (f, a) => f(...a)
202
+ });
203
+ }
204
+ setUserFunctionUrlInMetadata(getMeta(deployedFunction), `/${space.id}/${functionId}`);
205
+ state.view = "split";
206
+ } catch (err) {
207
+ log.catch(err, void 0, {
208
+ F: __dxlog_file,
209
+ L: 156,
210
+ S: void 0,
211
+ C: (f, a) => f(...a)
212
+ });
213
+ state.error = t("upload failed label");
214
+ }
215
+ state.deploying = false;
216
+ }, [
217
+ fn,
218
+ client,
219
+ t,
220
+ existingFunctionUrl,
221
+ script,
222
+ script.name,
223
+ script.source,
224
+ space?.id ?? null
225
+ ]);
226
+ };
227
+ var useCopyHandler = ({ state }) => useCallback(async () => {
228
+ if (!state.functionUrl) {
229
+ return;
230
+ }
231
+ await navigator.clipboard.writeText(state.functionUrl);
232
+ }, [
233
+ state.functionUrl
234
+ ]);
235
+
236
+ // packages/plugins/experimental/plugin-script/src/hooks/useToolbarState.ts
237
+ import { useMemo as useMemo2 } from "react";
238
+ import { create as create2 } from "@dxos/live-object";
239
+ var useToolbarState = (initialState = {}) => {
240
+ return useMemo2(() => create2(initialState), []);
241
+ };
242
+
243
+ // packages/plugins/experimental/plugin-script/src/hooks/format.ts
244
+ import { format } from "prettier";
245
+ import prettierPluginEstree from "prettier/plugins/estree";
246
+ import prettierPluginTypescript from "prettier/plugins/typescript";
247
+ import { useCallback as useCallback2 } from "react";
248
+ import { log as log2 } from "@dxos/log";
249
+ import { createMenuAction as createMenuAction2 } from "@dxos/react-ui-menu";
250
+ var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/plugins/experimental/plugin-script/src/hooks/format.ts";
251
+ var createFormat = () => {
252
+ const formatAction = createMenuAction2("format", {
253
+ label: [
254
+ "format label",
255
+ {
256
+ ns: SCRIPT_PLUGIN
257
+ }
258
+ ],
259
+ icon: "ph--magic-wand--regular"
260
+ });
261
+ return {
262
+ nodes: [
263
+ formatAction
264
+ ],
265
+ edges: [
266
+ {
267
+ source: "root",
268
+ target: "format"
269
+ }
270
+ ]
271
+ };
272
+ };
273
+ var useFormatHandler = ({ script }) => useCallback2(async () => {
274
+ if (!script.source) {
275
+ return;
276
+ }
277
+ try {
278
+ script.source.target.content = await format(script.source.target.content, {
279
+ parser: "typescript",
280
+ plugins: [
281
+ prettierPluginEstree,
282
+ prettierPluginTypescript
283
+ ],
284
+ semi: true,
285
+ singleQuote: true
286
+ });
287
+ } catch (err) {
288
+ log2.catch(err, void 0, {
289
+ F: __dxlog_file2,
290
+ L: 45,
291
+ S: void 0,
292
+ C: (f, a) => f(...a)
293
+ });
294
+ }
295
+ }, [
296
+ script.source
297
+ ]);
298
+
299
+ // packages/plugins/experimental/plugin-script/src/hooks/template.ts
300
+ import { useCallback as useCallback3 } from "react";
301
+ import { FUNCTIONS_PRESET_META_KEY } from "@dxos/functions";
302
+ import { getMeta as getMeta2 } from "@dxos/live-object";
303
+ import { createMenuItemGroup, createMenuAction as createMenuAction3 } from "@dxos/react-ui-menu";
304
+ var createTemplateSelectGroup = () => {
305
+ return createMenuItemGroup("template-select", {
306
+ label: [
307
+ "template select group label",
308
+ {
309
+ ns: SCRIPT_PLUGIN
310
+ }
311
+ ],
312
+ variant: "dropdownMenu"
313
+ });
314
+ };
315
+ var createTemplateSelectActions = () => {
316
+ return templates.map((template) => {
317
+ return createMenuAction3(`template--${template.id}`, {
318
+ label: template.name,
319
+ value: template.id,
320
+ type: "template"
321
+ });
322
+ });
323
+ };
324
+ var createTemplateSelect = () => {
325
+ const templateSelectGroup = createTemplateSelectGroup();
326
+ const templateSelectActions = createTemplateSelectActions();
327
+ return {
328
+ nodes: [
329
+ templateSelectGroup,
330
+ ...templateSelectActions
331
+ ],
332
+ edges: [
333
+ {
334
+ source: "root",
335
+ target: "template-select"
336
+ },
337
+ ...templateSelectActions.map((action) => ({
338
+ source: "template-select",
339
+ target: action.id
340
+ }))
341
+ ]
342
+ };
343
+ };
344
+ var useTemplateSelectHandler = ({ script }) => {
345
+ return useCallback3((templateId) => {
346
+ const template = templates.find((template2) => template2.id === templateId);
347
+ if (template) {
348
+ script.name = template.name;
349
+ script.source.target.content = template.source;
350
+ const metaKeys = getMeta2(script).keys;
351
+ const oldPresetIndex = metaKeys.findIndex((key) => key.source === FUNCTIONS_PRESET_META_KEY);
352
+ if (oldPresetIndex >= 0) {
353
+ metaKeys.splice(oldPresetIndex, 1);
354
+ }
355
+ if (template.presetId) {
356
+ metaKeys.push({
357
+ source: FUNCTIONS_PRESET_META_KEY,
358
+ id: template.presetId
359
+ });
360
+ }
361
+ }
362
+ }, [
363
+ script
364
+ ]);
365
+ };
366
+
367
+ // packages/plugins/experimental/plugin-script/src/hooks/view.ts
368
+ import { createMenuAction as createMenuAction4, createMenuItemGroup as createMenuItemGroup2 } from "@dxos/react-ui-menu";
369
+ var views = {
370
+ editor: "ph--code--regular",
371
+ split: "ph--square-split-vertical--regular",
372
+ debug: "ph--bug--regular"
373
+ };
374
+ var createViewGroupItem = (state) => {
375
+ return createMenuItemGroup2("view", {
376
+ label: [
377
+ "view group label",
378
+ {
379
+ ns: SCRIPT_PLUGIN
380
+ }
381
+ ],
382
+ variant: "dropdownMenu",
383
+ applyActive: true,
384
+ value: state.view
385
+ });
386
+ };
387
+ var createViewActions = (state) => {
388
+ return Object.entries(views).map(([viewType, icon]) => {
389
+ return createMenuAction4(`view--${viewType}`, {
390
+ type: "view",
391
+ value: viewType,
392
+ label: [
393
+ `view ${viewType} label`,
394
+ {
395
+ ns: SCRIPT_PLUGIN
396
+ }
397
+ ],
398
+ icon,
399
+ checked: state.view === viewType
400
+ });
401
+ });
402
+ };
403
+ var createView = (state) => {
404
+ const viewGroupItem = createViewGroupItem(state);
405
+ const viewActions = createViewActions(state);
406
+ return {
407
+ nodes: [
408
+ viewGroupItem,
409
+ ...viewActions
410
+ ],
411
+ edges: [
412
+ {
413
+ source: "root",
414
+ target: "view"
415
+ },
416
+ ...viewActions.map((action) => ({
417
+ source: "view",
418
+ target: action.id
419
+ }))
420
+ ]
421
+ };
422
+ };
423
+
424
+ // packages/plugins/experimental/plugin-script/src/hooks/useToolbarAction.ts
425
+ import { useCallback as useCallback4 } from "react";
426
+ import { log as log3 } from "@dxos/log";
427
+ var __dxlog_file3 = "/home/runner/work/dxos/dxos/packages/plugins/experimental/plugin-script/src/hooks/useToolbarAction.ts";
428
+ var useToolbarAction = (props) => {
429
+ const handleTemplateSelect = useTemplateSelectHandler(props);
430
+ const handleFormat = useFormatHandler(props);
431
+ const handleDeploy = useDeployHandler(props);
432
+ const handleCopy = useCopyHandler(props);
433
+ return useCallback4((action) => {
434
+ switch (action.properties.type) {
435
+ case "template":
436
+ handleTemplateSelect(action.properties.value);
437
+ break;
438
+ case "view":
439
+ props.state.view = action.properties.value;
440
+ break;
441
+ case "format":
442
+ void handleFormat();
443
+ break;
444
+ case "deploy":
445
+ void handleDeploy();
446
+ break;
447
+ case "copy":
448
+ void handleCopy();
449
+ break;
450
+ default:
451
+ log3.error("Unknown action type", action, {
452
+ F: __dxlog_file3,
453
+ L: 49,
454
+ S: void 0,
455
+ C: (f, a) => f(...a)
456
+ });
457
+ }
458
+ }, [
459
+ handleTemplateSelect,
460
+ handleFormat,
461
+ handleDeploy,
462
+ handleCopy
463
+ ]);
464
+ };
465
+
466
+ export {
467
+ createDeploy,
468
+ useDeployState,
469
+ createFormat,
470
+ createTemplateSelect,
471
+ createView,
472
+ useToolbarAction,
473
+ useToolbarState
474
+ };
475
+ //# sourceMappingURL=chunk-G2FYNDU4.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/hooks/deploy.ts", "../../../src/hooks/useToolbarState.ts", "../../../src/hooks/format.ts", "../../../src/hooks/template.ts", "../../../src/hooks/view.ts", "../../../src/hooks/useToolbarAction.ts"],
4
+ "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { useCallback, useEffect, useMemo } from 'react';\n\nimport {\n FunctionType,\n type ScriptType,\n getInvocationUrl,\n getUserFunctionUrlInMetadata,\n incrementSemverPatch,\n setUserFunctionUrlInMetadata,\n uploadWorkerFunction,\n} from '@dxos/functions';\nimport { Bundler } from '@dxos/functions/bundler';\nimport { log } from '@dxos/log';\nimport { useClient } from '@dxos/react-client';\nimport { Filter, create, getMeta, getSpace, makeRef, useQuery } from '@dxos/react-client/echo';\nimport { useTranslation } from '@dxos/react-ui';\nimport { createMenuAction } from '@dxos/react-ui-menu';\n\nimport { type ViewState } from './view';\nimport { SCRIPT_PLUGIN } from '../meta';\n\nexport type DeployActionProperties = { type: 'deploy' } | { type: 'copy' };\n\nexport type DeployState = ViewState & {\n deploying: boolean;\n deployed: boolean;\n functionUrl: string;\n error: string;\n};\n\nexport const createDeploy = (state: Partial<DeployState>) => {\n const errorItem = createMenuAction('error', {\n label: state.error ?? ['no error label', { ns: SCRIPT_PLUGIN }],\n icon: 'ph--warning-circle--regular',\n hidden: !state.error,\n });\n\n const deployAction = createMenuAction<DeployActionProperties>('deploy', {\n type: 'deploy',\n label: [state.deploying ? 'pending label' : 'deploy label', { ns: SCRIPT_PLUGIN }],\n icon: state.deploying ? 'ph--spinner-gap--regular' : 'ph--cloud-arrow-up--regular',\n disabled: state.deploying,\n classNames: state.deploying ? '[&_svg]:animate-spin' : '',\n });\n\n const copyAction = createMenuAction<DeployActionProperties>('copy', {\n type: 'copy',\n label: ['copy link label', { ns: SCRIPT_PLUGIN }],\n icon: 'ph--link--regular',\n disabled: !state.functionUrl,\n });\n\n return {\n nodes: [errorItem, deployAction, copyAction],\n edges: [\n { source: 'root', target: 'error' },\n { source: 'root', target: 'deploy' },\n { source: 'root', target: 'copy' },\n ],\n };\n};\n\nconst useDeployDeps = ({ state, script }: { state: Partial<DeployState>; script: ScriptType }) => {\n const space = getSpace(script);\n const [fn] = useQuery(space, Filter.schema(FunctionType, { source: script }));\n const client = useClient();\n const existingFunctionUrl = useMemo(() => fn && getUserFunctionUrlInMetadata(getMeta(fn)), [fn]);\n return { space, fn, client, existingFunctionUrl };\n};\n\nexport const useDeployState = ({ state, script }: { state: Partial<DeployState>; script: ScriptType }) => {\n const { space, client, existingFunctionUrl } = useDeployDeps({ state, script });\n useEffect(() => {\n if (!existingFunctionUrl) {\n return;\n }\n\n state.functionUrl = getInvocationUrl(existingFunctionUrl, client.config.values.runtime?.services?.edge?.url ?? '', {\n spaceId: space?.id,\n });\n }, [existingFunctionUrl, space]);\n\n useEffect(() => {\n state.deployed = Boolean(existingFunctionUrl) && !script.changed;\n }, [script.changed, existingFunctionUrl]);\n};\n\nexport const useDeployHandler = ({ state, script }: { state: Partial<DeployState>; script: ScriptType }) => {\n const { space, fn, client, existingFunctionUrl } = useDeployDeps({ state, script });\n const { t } = useTranslation(SCRIPT_PLUGIN);\n\n return useCallback(async () => {\n if (!script.source || !space) {\n return;\n }\n\n state.error = undefined;\n state.deploying = true;\n\n try {\n const existingFunctionId = existingFunctionUrl?.split('/').at(-1);\n\n const bundler = new Bundler({ platform: 'browser', sandboxedModules: [], remoteModules: {} });\n const buildResult = await bundler.bundle({ source: script.source.target!.content });\n if (buildResult.error || !buildResult.bundle) {\n throw buildResult.error;\n }\n\n const { functionId, version, meta } = await uploadWorkerFunction({\n client,\n spaceId: space.id,\n version: fn ? incrementSemverPatch(fn.version) : '0.0.1',\n functionId: existingFunctionId,\n source: buildResult.bundle,\n });\n if (functionId === undefined || version === undefined) {\n throw new Error(`Upload didn't return expected data: functionId=${functionId}, version=${version}`);\n }\n\n log.info('function uploaded', { functionId, version });\n if (fn) {\n fn.version = version;\n }\n\n const deployedFunction =\n fn ?? space.db.add(create(FunctionType, { name: functionId, version, source: makeRef(script) }));\n\n script.changed = false;\n if (script.description !== undefined && script.description.trim() !== '') {\n deployedFunction.description = script.description;\n } else if (meta.description) {\n deployedFunction.description = meta.description;\n } else {\n log.verbose('no description in function metadata', { functionId });\n }\n\n if (meta.inputSchema) {\n deployedFunction.inputSchema = meta.inputSchema;\n } else {\n log.verbose('no input schema in function metadata', { functionId });\n }\n if (meta.outputSchema) {\n deployedFunction.outputSchema = meta.outputSchema;\n } else {\n log.verbose('no output schema in function metadata', { functionId });\n }\n\n setUserFunctionUrlInMetadata(getMeta(deployedFunction), `/${space.id}/${functionId}`);\n\n state.view = 'split';\n } catch (err: any) {\n log.catch(err);\n state.error = t('upload failed label');\n }\n state.deploying = false;\n }, [fn, client, t, existingFunctionUrl, script, script.name, script.source, space?.id ?? null]);\n};\n\nexport const useCopyHandler = ({ state }: { state: Partial<DeployState> }) =>\n useCallback(async () => {\n if (!state.functionUrl) {\n return;\n }\n await navigator.clipboard.writeText(state.functionUrl);\n }, [state.functionUrl]);\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { useMemo } from 'react';\n\nimport { create } from '@dxos/live-object';\n\nimport { type DeployState } from './deploy';\nimport { type ViewState } from './view';\n\nexport type ScriptToolbarState = Partial<DeployState & ViewState>;\n\nexport const useToolbarState = (initialState: ScriptToolbarState = {}) => {\n return useMemo(() => create<ScriptToolbarState>(initialState), []);\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { format } from 'prettier';\nimport prettierPluginEstree from 'prettier/plugins/estree';\nimport prettierPluginTypescript from 'prettier/plugins/typescript';\nimport { useCallback } from 'react';\n\nimport { type ScriptType } from '@dxos/functions';\nimport { log } from '@dxos/log';\nimport { createMenuAction } from '@dxos/react-ui-menu';\n\nimport { SCRIPT_PLUGIN } from '../meta';\n\nexport type FormatActionProperties = { type: 'format' };\n\nexport const createFormat = () => {\n const formatAction = createMenuAction('format', {\n label: ['format label', { ns: SCRIPT_PLUGIN }],\n icon: 'ph--magic-wand--regular',\n });\n\n return {\n nodes: [formatAction],\n edges: [{ source: 'root', target: 'format' }],\n };\n};\n\nexport const useFormatHandler = ({ script }: { script: ScriptType }) =>\n useCallback(async () => {\n if (!script.source) {\n return;\n }\n\n try {\n script.source.target!.content = await format(script.source.target!.content, {\n parser: 'typescript',\n plugins: [prettierPluginEstree, prettierPluginTypescript],\n semi: true,\n singleQuote: true,\n });\n } catch (err: any) {\n // TODO(wittjosiah): Show error in UI.\n log.catch(err);\n }\n }, [script.source]);\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { useCallback } from 'react';\n\nimport { FUNCTIONS_PRESET_META_KEY, type ScriptType } from '@dxos/functions';\nimport { getMeta } from '@dxos/live-object';\nimport { createMenuItemGroup, createMenuAction } from '@dxos/react-ui-menu';\n\nimport { SCRIPT_PLUGIN } from '../meta';\nimport { templates } from '../templates';\n\nexport type TemplateActionProperties = { type: 'template'; value: string };\n\nconst createTemplateSelectGroup = () => {\n return createMenuItemGroup('template-select', {\n label: ['template select group label', { ns: SCRIPT_PLUGIN }],\n variant: 'dropdownMenu',\n });\n};\n\nconst createTemplateSelectActions = () => {\n return templates.map((template) => {\n return createMenuAction<TemplateActionProperties>(`template--${template.id}`, {\n label: template.name,\n value: template.id,\n type: 'template',\n });\n });\n};\n\nexport const createTemplateSelect = () => {\n const templateSelectGroup = createTemplateSelectGroup();\n const templateSelectActions = createTemplateSelectActions();\n return {\n nodes: [templateSelectGroup, ...templateSelectActions],\n edges: [\n { source: 'root', target: 'template-select' },\n ...templateSelectActions.map((action) => ({ source: 'template-select', target: action.id })),\n ],\n };\n};\n\nexport const useTemplateSelectHandler = ({ script }: { script: ScriptType }) => {\n return useCallback(\n (templateId: string) => {\n const template = templates.find((template) => template.id === templateId);\n if (template) {\n script.name = template.name;\n script.source!.target!.content = template.source;\n const metaKeys = getMeta(script).keys;\n const oldPresetIndex = metaKeys.findIndex((key) => key.source === FUNCTIONS_PRESET_META_KEY);\n if (oldPresetIndex >= 0) {\n metaKeys.splice(oldPresetIndex, 1);\n }\n if (template.presetId) {\n metaKeys.push({ source: FUNCTIONS_PRESET_META_KEY, id: template.presetId });\n }\n }\n },\n [script],\n );\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { createMenuAction, createMenuItemGroup } from '@dxos/react-ui-menu';\n\nimport { SCRIPT_PLUGIN } from '../meta';\n\n// TODO(wittjosiah): Replace debug with logs.\nexport type ViewType = 'editor' | 'split' | 'debug'; // 'logs';\n\nexport type ViewState = { view: ViewType };\n\nexport type ViewActionProperties = { type: 'view'; value: ViewType };\n\nconst views: Record<ViewType, string> = {\n editor: 'ph--code--regular',\n split: 'ph--square-split-vertical--regular',\n debug: 'ph--bug--regular',\n // TODO(wittjosiah): Replace debug with logs.\n // logs: 'ph--clock-counter-clockwise--regular',\n};\n\nconst createViewGroupItem = (state: Partial<ViewState>) => {\n return createMenuItemGroup('view', {\n label: ['view group label', { ns: SCRIPT_PLUGIN }],\n variant: 'dropdownMenu',\n applyActive: true,\n value: state.view,\n });\n};\n\nconst createViewActions = (state: Partial<ViewState>) => {\n return Object.entries(views).map(([viewType, icon]) => {\n return createMenuAction<ViewActionProperties>(`view--${viewType}`, {\n type: 'view',\n value: viewType as ViewType,\n label: [`view ${viewType} label`, { ns: SCRIPT_PLUGIN }],\n icon,\n checked: state.view === viewType,\n });\n });\n};\n\nexport const createView = (state: Partial<ViewState>) => {\n const viewGroupItem = createViewGroupItem(state);\n const viewActions = createViewActions(state);\n return {\n nodes: [viewGroupItem, ...viewActions],\n edges: [\n { source: 'root', target: 'view' },\n ...viewActions.map((action) => ({ source: 'view', target: action.id })),\n ],\n };\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { useCallback } from 'react';\n\nimport { type ScriptType } from '@dxos/functions';\nimport { log } from '@dxos/log';\nimport { type MenuAction, type MenuActionHandler } from '@dxos/react-ui-menu';\n\nimport { type DeployActionProperties, useDeployHandler, useCopyHandler } from './deploy';\nimport { type FormatActionProperties, useFormatHandler } from './format';\nimport { type TemplateActionProperties, useTemplateSelectHandler } from './template';\nimport { type ScriptToolbarState } from './useToolbarState';\nimport { type ViewActionProperties } from './view';\n\nexport type ScriptToolbarActionProperties =\n | TemplateActionProperties\n | ViewActionProperties\n | FormatActionProperties\n | DeployActionProperties;\n\nexport type ScriptToolbarAction = MenuAction<ScriptToolbarActionProperties>;\n\nexport const useToolbarAction = (props: { state: ScriptToolbarState; script: ScriptType }) => {\n const handleTemplateSelect = useTemplateSelectHandler(props);\n const handleFormat = useFormatHandler(props);\n const handleDeploy = useDeployHandler(props);\n const handleCopy = useCopyHandler(props);\n return useCallback(\n ((action: ScriptToolbarAction) => {\n switch (action.properties.type) {\n case 'template':\n handleTemplateSelect(action.properties.value);\n break;\n case 'view':\n props.state.view = action.properties.value;\n break;\n case 'format':\n void handleFormat();\n break;\n case 'deploy':\n void handleDeploy();\n break;\n case 'copy':\n void handleCopy();\n break;\n default:\n log.error('Unknown action type', action);\n }\n }) as MenuActionHandler,\n [handleTemplateSelect, handleFormat, handleDeploy, handleCopy],\n );\n};\n"],
5
+ "mappings": ";;;;;;;;AAIA,SAASA,aAAaC,WAAWC,eAAe;AAEhD,SACEC,cAEAC,kBACAC,8BACAC,sBACAC,8BACAC,4BACK;AACP,SAASC,eAAe;AACxB,SAASC,WAAW;AACpB,SAASC,iBAAiB;AAC1B,SAASC,QAAQC,QAAQC,SAASC,UAAUC,SAASC,gBAAgB;AACrE,SAASC,sBAAsB;AAC/B,SAASC,wBAAwB;;AAc1B,IAAMC,eAAe,CAACC,UAAAA;AAC3B,QAAMC,YAAYC,iBAAiB,SAAS;IAC1CC,OAAOH,MAAMI,SAAS;MAAC;MAAkB;QAAEC,IAAIC;MAAc;;IAC7DC,MAAM;IACNC,QAAQ,CAACR,MAAMI;EACjB,CAAA;AAEA,QAAMK,eAAeP,iBAAyC,UAAU;IACtEQ,MAAM;IACNP,OAAO;MAACH,MAAMW,YAAY,kBAAkB;MAAgB;QAAEN,IAAIC;MAAc;;IAChFC,MAAMP,MAAMW,YAAY,6BAA6B;IACrDC,UAAUZ,MAAMW;IAChBE,YAAYb,MAAMW,YAAY,yBAAyB;EACzD,CAAA;AAEA,QAAMG,aAAaZ,iBAAyC,QAAQ;IAClEQ,MAAM;IACNP,OAAO;MAAC;MAAmB;QAAEE,IAAIC;MAAc;;IAC/CC,MAAM;IACNK,UAAU,CAACZ,MAAMe;EACnB,CAAA;AAEA,SAAO;IACLC,OAAO;MAACf;MAAWQ;MAAcK;;IACjCG,OAAO;MACL;QAAEC,QAAQ;QAAQC,QAAQ;MAAQ;MAClC;QAAED,QAAQ;QAAQC,QAAQ;MAAS;MACnC;QAAED,QAAQ;QAAQC,Q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AACtC,SAAO;IACLqB,OAAO;MAACF;SAAkBC;;IAC1BE,OAAO;MACL;QAAEC,QAAQ;QAAQC,QAAQ;MAAO;SAC9BJ,YAAYR,IAAI,CAACa,YAAY;QAAEF,QAAQ;QAAQC,QAAQC,OAAOC;MAAG,EAAA;;EAExE;AACF;;;AClDA,SAASC,eAAAA,oBAAmB;AAG5B,SAASC,OAAAA,YAAW;;AAiBb,IAAMC,mBAAmB,CAACC,UAAAA;AAC/B,QAAMC,uBAAuBC,yBAAyBF,KAAAA;AACtD,QAAMG,eAAeC,iBAAiBJ,KAAAA;AACtC,QAAMK,eAAeC,iBAAiBN,KAAAA;AACtC,QAAMO,aAAaC,eAAeR,KAAAA;AAClC,SAAOS,aACJ,CAACC,WAAAA;AACA,YAAQA,OAAOC,WAAWC,MAAI;MAC5B,KAAK;AACHX,6BAAqBS,OAAOC,WAAWE,KAAK;AAC5C;MACF,KAAK;AACHb,cAAMc,MAAMC,OAAOL,OAAOC,WAAWE;AACrC;MACF,KAAK;AACH,aAAKV,aAAAA;AACL;MACF,KAAK;AACH,aAAKE,aAAAA;AACL;MACF,KAAK;AACH,aAAKE,WAAAA;AACL;MACF;AACES,QAAAA,KAAIC,MAAM,uBAAuBP,QAAAA;;;;;;IACrC;EACF,GACA;IAACT;IAAsBE;IAAcE;IAAcE;GAAW;AAElE;",
6
+ "names": ["useCallback", "useEffect", "useMemo", "FunctionType", "getInvocationUrl", "getUserFunctionUrlInMetadata", "incrementSemverPatch", "setUserFunctionUrlInMetadata", "uploadWorkerFunction", "Bundler", "log", "useClient", "Filter", "create", "getMeta", "getSpace", "makeRef", "useQuery", "useTranslation", "createMenuAction", "createDeploy", "state", "errorItem", "createMenuAction", "label", "error", "ns", "SCRIPT_PLUGIN", "icon", "hidden", "deployAction", "type", "deploying", "disabled", "classNames", "copyAction", "functionUrl", "nodes", "edges", "source", "target", "useDeployDeps", "script", "space", "getSpace", "fn", "useQuery", "Filter", "schema", "FunctionType", "client", "useClient", "existingFunctionUrl", "useMemo", "getUserFunctionUrlInMetadata", "getMeta", "useDeployState", "useEffect", "getInvocationUrl", "config", "values", "runtime", "services", "edge", "url", "spaceId", "id", "deployed", "Boolean", "changed", "useDeployHandler", "t", "useTranslation", "useCallback", "undefined", "existingFunctionId", "split", "at", "bundler", "Bundler", "platform", "sandboxedModules", "remoteModules", "buildResult", "bundle", "content", "functionId", "version", "meta", "uploadWorkerFunction", "incrementSemverPatch", "Error", "log", "info", "deployedFunction", "db", "add", "create", "name", "makeRef", "description", "trim", "verbose", "inputSchema", "outputSchema", "setUserFunctionUrlInMetadata", "view", "err", "catch", "useCopyHandler", "navigator", "clipboard", "writeText", "useMemo", "create", "useToolbarState", "initialState", "useMemo", "create", "format", "prettierPluginEstree", "prettierPluginTypescript", "useCallback", "log", "createMenuAction", "createFormat", "formatAction", "createMenuAction", "label", "ns", "SCRIPT_PLUGIN", "icon", "nodes", "edges", "source", "target", "useFormatHandler", "script", "useCallback", "content", "format", "parser", "plugins", "prettierPluginEstree", "prettierPluginTypescript", "semi", "singleQuote", "err", "log", "catch", "useCallback", "FUNCTIONS_PRESET_META_KEY", "getMeta", "createMenuItemGroup", "createMenuAction", "createTemplateSelectGroup", "createMenuItemGroup", "label", "ns", "SCRIPT_PLUGIN", "variant", "createTemplateSelectActions", "templates", "map", "template", "createMenuAction", "id", "name", "value", "type", "createTemplateSelect", "templateSelectGroup", "templateSelectActions", "nodes", "edges", "source", "target", "action", "useTemplateSelectHandler", "script", "useCallback", "templateId", "find", "content", "metaKeys", "getMeta", "keys", "oldPresetIndex", "findIndex", "key", "FUNCTIONS_PRESET_META_KEY", "splice", "presetId", "push", "createMenuAction", "createMenuItemGroup", "views", "editor", "split", "debug", "createViewGroupItem", "state", "createMenuItemGroup", "label", "ns", "SCRIPT_PLUGIN", "variant", "applyActive", "value", "view", "createViewActions", "Object", "entries", "map", "viewType", "icon", "createMenuAction", "type", "checked", "createView", "viewGroupItem", "viewActions", "nodes", "edges", "source", "target", "action", "id", "useCallback", "log", "useToolbarAction", "props", "handleTemplateSelect", "useTemplateSelectHandler", "handleFormat", "useFormatHandler", "handleDeploy", "useDeployHandler", "handleCopy", "useCopyHandler", "useCallback", "action", "properties", "type", "value", "state", "view", "log", "error"]
7
+ }
@@ -0,0 +1,40 @@
1
+ import {
2
+ SCRIPT_PLUGIN
3
+ } from "./chunk-FVVCAWNP.mjs";
4
+
5
+ // packages/plugins/experimental/plugin-script/src/types.ts
6
+ import { TitleAnnotationId } from "@effect/schema/AST";
7
+ import { SpaceSchema } from "@dxos/client/echo";
8
+ import { S } from "@dxos/echo-schema";
9
+ import { ScriptType } from "@dxos/functions";
10
+ import { EditorInputMode } from "@dxos/react-ui-editor";
11
+ var ScriptAction;
12
+ (function(ScriptAction2) {
13
+ const SCRIPT_ACTION = `${SCRIPT_PLUGIN}/action`;
14
+ ScriptAction2.CreateScriptSchema = S.Struct({
15
+ name: S.optional(S.String),
16
+ // TODO(wittjosiah): Placeholder annotation?
17
+ gistUrl: S.optional(S.String.annotations({
18
+ [TitleAnnotationId]: "Import from Gist (url)"
19
+ }))
20
+ });
21
+ class Create extends S.TaggedClass()(`${SCRIPT_ACTION}/create`, {
22
+ input: S.extend(ScriptAction2.CreateScriptSchema, S.Struct({
23
+ space: SpaceSchema
24
+ })),
25
+ output: S.Struct({
26
+ object: ScriptType
27
+ })
28
+ }) {
29
+ }
30
+ ScriptAction2.Create = Create;
31
+ })(ScriptAction || (ScriptAction = {}));
32
+ var ScriptSettingsSchema = S.mutable(S.Struct({
33
+ editorInputMode: EditorInputMode
34
+ }));
35
+
36
+ export {
37
+ ScriptAction,
38
+ ScriptSettingsSchema
39
+ };
40
+ //# sourceMappingURL=chunk-N46LE7FS.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/types.ts"],
4
+ "sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { TitleAnnotationId } from '@effect/schema/AST';\n\nimport { SpaceSchema } from '@dxos/client/echo';\nimport { S } from '@dxos/echo-schema';\nimport { ScriptType } from '@dxos/functions';\nimport { EditorInputMode } from '@dxos/react-ui-editor';\n\nimport { SCRIPT_PLUGIN } from './meta';\n\nexport namespace ScriptAction {\n const SCRIPT_ACTION = `${SCRIPT_PLUGIN}/action`;\n\n export const CreateScriptSchema = S.Struct({\n name: S.optional(S.String),\n // TODO(wittjosiah): Placeholder annotation?\n gistUrl: S.optional(S.String.annotations({ [TitleAnnotationId]: 'Import from Gist (url)' })),\n });\n\n export type CreateScriptProps = S.Schema.Type<typeof CreateScriptSchema>;\n\n export class Create extends S.TaggedClass<Create>()(`${SCRIPT_ACTION}/create`, {\n input: S.extend(CreateScriptSchema, S.Struct({ space: SpaceSchema })),\n output: S.Struct({\n object: ScriptType,\n }),\n }) {}\n}\n\nexport const ScriptSettingsSchema = S.mutable(\n S.Struct({\n editorInputMode: EditorInputMode,\n }),\n);\n\nexport type ScriptSettingsProps = S.Schema.Type<typeof ScriptSettingsSchema>;\n"],
5
+ "mappings": ";;;;;AAIA,SAASA,yBAAyB;AAElC,SAASC,mBAAmB;AAC5B,SAASC,SAAS;AAClB,SAASC,kBAAkB;AAC3B,SAASC,uBAAuB;;UAIfC,eAAAA;AACf,QAAMC,gBAAgB,GAAGC,aAAAA;gBAEZC,qBAAqBC,EAAEC,OAAO;IACzCC,MAAMF,EAAEG,SAASH,EAAEI,MAAM;;IAEzBC,SAASL,EAAEG,SAASH,EAAEI,OAAOE,YAAY;MAAE,CAACC,iBAAAA,GAAoB;IAAyB,CAAA,CAAA;EAC3F,CAAA;EAIO,MAAMC,eAAeR,EAAES,YAAW,EAAW,GAAGZ,aAAAA,WAAwB;IAC7Ea,OAAOV,EAAEW,OAAMf,cAACG,oBAAoBC,EAAEC,OAAO;MAAEW,OAAOC;IAAY,CAAA,CAAA;IAClEC,QAAQd,EAAEC,OAAO;MACfc,QAAQC;IACV,CAAA;EACF,CAAA,EAAA;EAAI;gBALSR,SAAAA;AAMf,GAjBiBZ,iBAAAA,eAAAA,CAAAA,EAAAA;AAmBV,IAAMqB,uBAAuBjB,EAAEkB,QACpClB,EAAEC,OAAO;EACPkB,iBAAiBC;AACnB,CAAA,CAAA;",
6
+ "names": ["TitleAnnotationId", "SpaceSchema", "S", "ScriptType", "EditorInputMode", "ScriptAction", "SCRIPT_ACTION", "SCRIPT_PLUGIN", "CreateScriptSchema", "S", "Struct", "name", "optional", "String", "gistUrl", "annotations", "TitleAnnotationId", "Create", "TaggedClass", "input", "extend", "space", "SpaceSchema", "output", "object", "ScriptType", "ScriptSettingsSchema", "mutable", "editorInputMode", "EditorInputMode"]
7
+ }