@dxos/plugin-script 0.8.4-main.3fbcb4aa9b → 0.8.4-main.43cb759274

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 (241) hide show
  1. package/LICENSE +102 -5
  2. package/PLUGIN.mdl +515 -0
  3. package/dist/lib/neutral/{DeploymentDialog-6DBF3V6C.mjs → DeploymentDialog-M3AFYQHC.mjs} +4 -2
  4. package/dist/lib/neutral/{DeploymentDialog-6DBF3V6C.mjs.map → DeploymentDialog-M3AFYQHC.mjs.map} +3 -3
  5. package/dist/lib/neutral/{NotebookContainer-FIAQI3A2.mjs → NotebookArticle-NV4AHOOS.mjs} +15 -12
  6. package/dist/lib/neutral/NotebookArticle-NV4AHOOS.mjs.map +7 -0
  7. package/dist/lib/neutral/{ScriptContainer-2OPBAXFB.mjs → ScriptArticle-UBT27SB6.mjs} +4 -4
  8. package/dist/lib/neutral/{ScriptContainer-2OPBAXFB.mjs.map → ScriptArticle-UBT27SB6.mjs.map} +4 -4
  9. package/dist/lib/neutral/ScriptPlugin.mjs +12 -0
  10. package/dist/lib/neutral/ScriptPlugin.mjs.map +4 -4
  11. package/dist/lib/neutral/ScriptPlugin.workerd.mjs +21 -0
  12. package/dist/lib/neutral/ScriptPlugin.workerd.mjs.map +7 -0
  13. package/dist/lib/neutral/{ScriptProperties-F6NE6M4H.mjs → ScriptProperties-RLXNAN3N.mjs} +9 -8
  14. package/dist/lib/neutral/ScriptProperties-RLXNAN3N.mjs.map +7 -0
  15. package/dist/lib/neutral/{TestContainer-JNFPLAJX.mjs → TestContainer-AFVTBYSJ.mjs} +5 -5
  16. package/dist/lib/neutral/TestContainer-AFVTBYSJ.mjs.map +7 -0
  17. package/dist/lib/neutral/blueprints/index.mjs +3 -3
  18. package/dist/lib/neutral/capabilities/index.mjs +4 -4
  19. package/dist/lib/neutral/capabilities/node.mjs +3 -3
  20. package/dist/lib/neutral/{chunk-D7DFASAE.mjs → chunk-2REUEDUA.mjs} +8 -4
  21. package/dist/lib/neutral/chunk-2REUEDUA.mjs.map +7 -0
  22. package/dist/lib/neutral/{chunk-BDRB6ZX2.mjs → chunk-BDHDBPVM.mjs} +2 -2
  23. package/dist/lib/neutral/{chunk-PDB6UOSB.mjs → chunk-C4O7EV6M.mjs} +11 -13
  24. package/dist/lib/neutral/chunk-C4O7EV6M.mjs.map +7 -0
  25. package/dist/lib/neutral/chunk-H2BRWQMY.mjs +96 -0
  26. package/dist/lib/neutral/chunk-H2BRWQMY.mjs.map +7 -0
  27. package/dist/lib/neutral/{chunk-B4FVQEHV.mjs → chunk-LHEJXJEL.mjs} +2 -2
  28. package/dist/lib/neutral/{chunk-B4FVQEHV.mjs.map → chunk-LHEJXJEL.mjs.map} +2 -2
  29. package/dist/lib/neutral/chunk-NQOIENTU.mjs +8 -0
  30. package/dist/lib/neutral/{chunk-MI6X5CTJ.mjs → chunk-TRKXIP2Q.mjs} +30 -21
  31. package/dist/lib/neutral/chunk-TRKXIP2Q.mjs.map +7 -0
  32. package/dist/lib/neutral/chunk-UA3BWOCZ.mjs +38 -0
  33. package/dist/lib/neutral/chunk-UA3BWOCZ.mjs.map +7 -0
  34. package/dist/lib/neutral/{chunk-4RJALG6K.mjs → chunk-VXDJH6OL.mjs} +9 -10
  35. package/dist/lib/neutral/chunk-VXDJH6OL.mjs.map +7 -0
  36. package/dist/lib/neutral/{compiler-SMVIP5UN.mjs → compiler-ODK4UA2N.mjs} +2 -2
  37. package/dist/lib/neutral/components/index.mjs +93 -148
  38. package/dist/lib/neutral/components/index.mjs.map +4 -4
  39. package/dist/lib/neutral/containers/index.mjs +7 -7
  40. package/dist/lib/neutral/containers/index.mjs.map +3 -3
  41. package/dist/lib/neutral/{create-OZRIZ7RN.mjs → create-WQJXMOUE.mjs} +7 -5
  42. package/dist/lib/neutral/create-WQJXMOUE.mjs.map +7 -0
  43. package/dist/lib/neutral/{create-object-F2NWICFV.mjs → create-object-FZM5ASWM.mjs} +4 -3
  44. package/dist/lib/neutral/create-object-FZM5ASWM.mjs.map +7 -0
  45. package/dist/lib/neutral/{create-script-VBA3SLSU.mjs → create-script-66DO3UJO.mjs} +3 -3
  46. package/dist/lib/neutral/{delete-PAUWA2QM.mjs → delete-HCQIQFVP.mjs} +2 -2
  47. package/dist/lib/neutral/{deploy-CXVW54JJ.mjs → deploy-7JVMMHSH.mjs} +6 -5
  48. package/dist/lib/neutral/{deploy-CXVW54JJ.mjs.map → deploy-7JVMMHSH.mjs.map} +3 -3
  49. package/dist/lib/neutral/hooks/index.mjs +2 -2
  50. package/dist/lib/neutral/index.mjs +7 -7
  51. package/dist/lib/neutral/{inspect-invocations-LEOEP5I2.mjs → inspect-invocations-6MW73SDV.mjs} +3 -3
  52. package/dist/lib/neutral/{inspect-invocations-LEOEP5I2.mjs.map → inspect-invocations-6MW73SDV.mjs.map} +3 -3
  53. package/dist/lib/neutral/{install-function-5N24Q45W.mjs → install-function-FJIE2JAI.mjs} +7 -9
  54. package/dist/lib/neutral/install-function-FJIE2JAI.mjs.map +7 -0
  55. package/dist/lib/neutral/{invoke-5QVEZ3X5.mjs → invoke-3HVWY2KF.mjs} +7 -8
  56. package/dist/lib/neutral/invoke-3HVWY2KF.mjs.map +7 -0
  57. package/dist/lib/neutral/meta.json +1 -1
  58. package/dist/lib/neutral/meta.mjs +1 -1
  59. package/dist/lib/neutral/{operation-handler-OTCWYDFI.mjs → operation-handler-X44IGZXS.mjs} +3 -3
  60. package/dist/lib/neutral/operations/index.mjs +1 -1
  61. package/dist/lib/neutral/plugin.mjs +2 -2
  62. package/dist/lib/neutral/{query-deployed-functions-FVD7NYPA.mjs → query-deployed-functions-F4FHJNWO.mjs} +14 -10
  63. package/dist/lib/neutral/query-deployed-functions-F4FHJNWO.mjs.map +7 -0
  64. package/dist/lib/neutral/{react-surface-JH2AOK7V.mjs → react-surface-ACNZ35FV.mjs} +17 -13
  65. package/dist/lib/neutral/react-surface-ACNZ35FV.mjs.map +7 -0
  66. package/dist/lib/neutral/{read-FFOSK6A3.mjs → read-RQESBAQI.mjs} +2 -2
  67. package/dist/lib/neutral/templates/index.mjs +1 -1
  68. package/dist/lib/neutral/translations.mjs +3 -2
  69. package/dist/lib/neutral/translations.mjs.map +3 -3
  70. package/dist/lib/neutral/types/index.mjs +2 -2
  71. package/dist/lib/neutral/{update-PJS5GG3Y.mjs → update-JZUNJYZM.mjs} +3 -3
  72. package/dist/lib/neutral/{update-PJS5GG3Y.mjs.map → update-JZUNJYZM.mjs.map} +3 -3
  73. package/dist/types/src/ScriptPlugin.d.ts.map +1 -1
  74. package/dist/types/src/ScriptPlugin.workerd.d.ts +4 -0
  75. package/dist/types/src/ScriptPlugin.workerd.d.ts.map +1 -0
  76. package/dist/types/src/blueprints/functions/create.d.ts.map +1 -1
  77. package/dist/types/src/blueprints/functions/definitions.d.ts +24 -30
  78. package/dist/types/src/blueprints/functions/definitions.d.ts.map +1 -1
  79. package/dist/types/src/blueprints/functions/delete.d.ts +4 -5
  80. package/dist/types/src/blueprints/functions/deploy.d.ts +4 -5
  81. package/dist/types/src/blueprints/functions/inspect-invocations.d.ts +4 -5
  82. package/dist/types/src/blueprints/functions/invoke.d.ts +5 -6
  83. package/dist/types/src/blueprints/functions/invoke.d.ts.map +1 -1
  84. package/dist/types/src/blueprints/functions/read.d.ts +4 -5
  85. package/dist/types/src/blueprints/functions/update.d.ts +4 -5
  86. package/dist/types/src/capabilities/create-object.d.ts.map +1 -1
  87. package/dist/types/src/compiler/compiler.d.ts.map +1 -1
  88. package/dist/types/src/components/NotebookStack/NotebookStack.d.ts.map +1 -1
  89. package/dist/types/src/components/QueryEditor/QueryEditor.d.ts.map +1 -1
  90. package/dist/types/src/components/ScriptToolbar/ScriptToolbar.d.ts.map +1 -1
  91. package/dist/types/src/components/TestPanel/TestPanel.d.ts.map +1 -1
  92. package/dist/types/src/components/TypescriptEditor/TypescriptEditor.d.ts.map +1 -1
  93. package/dist/types/src/components/index.d.ts +0 -1
  94. package/dist/types/src/components/index.d.ts.map +1 -1
  95. package/dist/types/src/constants.d.ts +2 -1
  96. package/dist/types/src/constants.d.ts.map +1 -1
  97. package/dist/types/src/containers/NotebookArticle/NotebookArticle.d.ts +7 -0
  98. package/dist/types/src/containers/NotebookArticle/NotebookArticle.d.ts.map +1 -0
  99. package/dist/types/src/containers/NotebookArticle/NotebookArticle.stories.d.ts +7 -0
  100. package/dist/types/src/containers/NotebookArticle/NotebookArticle.stories.d.ts.map +1 -0
  101. package/dist/types/src/containers/NotebookArticle/index.d.ts +2 -0
  102. package/dist/types/src/containers/{ScriptContainer → NotebookArticle}/index.d.ts.map +1 -1
  103. package/dist/types/src/containers/{ScriptContainer/ScriptContainer.d.ts → ScriptArticle/ScriptArticle.d.ts} +2 -2
  104. package/dist/types/src/containers/ScriptArticle/ScriptArticle.d.ts.map +1 -0
  105. package/dist/types/src/containers/{ScriptContainer/ScriptContainer.stories.d.ts → ScriptArticle/ScriptArticle.stories.d.ts} +1 -1
  106. package/dist/types/src/containers/ScriptArticle/ScriptArticle.stories.d.ts.map +1 -0
  107. package/dist/types/src/containers/ScriptArticle/index.d.ts +2 -0
  108. package/dist/types/src/containers/ScriptArticle/index.d.ts.map +1 -0
  109. package/dist/types/src/containers/ScriptProperties/BlueprintEditor.d.ts.map +1 -1
  110. package/dist/types/src/containers/ScriptProperties/ScriptProperties.stories.d.ts.map +1 -1
  111. package/dist/types/src/containers/index.d.ts +2 -2
  112. package/dist/types/src/containers/index.d.ts.map +1 -1
  113. package/dist/types/src/hooks/deploy.d.ts +5 -6
  114. package/dist/types/src/hooks/deploy.d.ts.map +1 -1
  115. package/dist/types/src/meta.d.ts +1 -1
  116. package/dist/types/src/meta.d.ts.map +1 -1
  117. package/dist/types/src/operations/index.d.ts.map +1 -1
  118. package/dist/types/src/templates/chess-bot.d.ts +4 -2
  119. package/dist/types/src/templates/chess-bot.d.ts.map +1 -1
  120. package/dist/types/src/templates/commentary.d.ts +6 -4
  121. package/dist/types/src/templates/commentary.d.ts.map +1 -1
  122. package/dist/types/src/templates/index.d.ts +0 -5
  123. package/dist/types/src/templates/index.d.ts.map +1 -1
  124. package/dist/types/src/testing/test-script.d.ts.map +1 -1
  125. package/dist/types/src/translations.d.ts.map +1 -1
  126. package/dist/types/src/types/Notebook.d.ts +28 -47
  127. package/dist/types/src/types/Notebook.d.ts.map +1 -1
  128. package/dist/types/src/types/ScriptOperation.d.ts +6 -6
  129. package/dist/types/src/types/ScriptOperation.d.ts.map +1 -1
  130. package/dist/types/tsconfig.tsbuildinfo +1 -1
  131. package/package.json +90 -90
  132. package/src/ScriptPlugin.tsx +6 -0
  133. package/src/ScriptPlugin.workerd.ts +18 -0
  134. package/src/blueprints/functions/create.ts +3 -3
  135. package/src/blueprints/functions/definitions.ts +20 -11
  136. package/src/blueprints/functions/deploy.ts +3 -2
  137. package/src/blueprints/functions/inspect-invocations.ts +1 -1
  138. package/src/blueprints/functions/install-function.ts +5 -5
  139. package/src/blueprints/functions/invoke.ts +4 -5
  140. package/src/blueprints/functions/query-deployed-functions.ts +11 -7
  141. package/src/blueprints/functions/update.ts +1 -1
  142. package/src/capabilities/create-object.ts +3 -2
  143. package/src/capabilities/react-surface.tsx +6 -6
  144. package/src/compiler/compiler.ts +4 -0
  145. package/src/components/NotebookStack/NotebookCell.tsx +2 -2
  146. package/src/components/NotebookStack/NotebookStack.stories.tsx +2 -2
  147. package/src/components/NotebookStack/NotebookStack.tsx +1 -1
  148. package/src/components/QueryEditor/QueryEditor.tsx +3 -1
  149. package/src/components/ScriptToolbar/ScriptToolbar.stories.tsx +3 -3
  150. package/src/components/ScriptToolbar/ScriptToolbar.tsx +1 -1
  151. package/src/components/TestPanel/TestPanel.tsx +2 -1
  152. package/src/components/TypescriptEditor/TypescriptEditor.tsx +1 -1
  153. package/src/components/index.ts +0 -1
  154. package/src/constants.ts +3 -1
  155. package/src/containers/DeploymentDialog/DeploymentDialog.stories.tsx +3 -3
  156. package/src/containers/DeploymentDialog/DeploymentDialog.tsx +1 -1
  157. package/src/containers/{NotebookContainer/NotebookContainer.stories.tsx → NotebookArticle/NotebookArticle.stories.tsx} +10 -10
  158. package/src/containers/{NotebookContainer/NotebookContainer.tsx → NotebookArticle/NotebookArticle.tsx} +10 -9
  159. package/src/containers/NotebookArticle/index.ts +5 -0
  160. package/src/containers/{ScriptContainer/ScriptContainer.stories.tsx → ScriptArticle/ScriptArticle.stories.tsx} +6 -5
  161. package/src/containers/{ScriptContainer/ScriptContainer.tsx → ScriptArticle/ScriptArticle.tsx} +1 -1
  162. package/src/containers/ScriptArticle/index.ts +5 -0
  163. package/src/containers/ScriptProperties/BlueprintEditor.tsx +8 -7
  164. package/src/containers/ScriptProperties/ScriptProperties.stories.tsx +3 -2
  165. package/src/containers/TestContainer/TestContainer.tsx +4 -4
  166. package/src/containers/index.ts +2 -2
  167. package/src/meta.ts +13 -7
  168. package/src/operations/index.ts +1 -4
  169. package/src/templates/anthropic.ts +2 -1
  170. package/src/templates/chess-bot.ts +2 -2
  171. package/src/templates/commentary.ts +19 -17
  172. package/src/templates/data-generator.ts +1 -1
  173. package/src/templates/discord.ts +5 -5
  174. package/src/templates/forex-effect.ts +2 -1
  175. package/src/templates/forex.ts +2 -1
  176. package/src/templates/gmail.ts +5 -5
  177. package/src/templates/index.ts +0 -7
  178. package/src/templates/ping.ts +2 -1
  179. package/src/testing/test-notebook.ts +2 -2
  180. package/src/testing/test-script.ts +1 -2
  181. package/src/translations.ts +3 -2
  182. package/src/types/Notebook.ts +5 -11
  183. package/src/types/ScriptOperation.ts +4 -4
  184. package/src/util/deploy.ts +1 -1
  185. package/src/util/functions.ts +4 -4
  186. package/src/vite-env.d.ts +5 -0
  187. package/dist/lib/neutral/NotebookContainer-FIAQI3A2.mjs.map +0 -7
  188. package/dist/lib/neutral/ScriptProperties-F6NE6M4H.mjs.map +0 -7
  189. package/dist/lib/neutral/TestContainer-JNFPLAJX.mjs.map +0 -7
  190. package/dist/lib/neutral/access-token-created-ENMCEGVU.mjs +0 -34
  191. package/dist/lib/neutral/access-token-created-ENMCEGVU.mjs.map +0 -7
  192. package/dist/lib/neutral/chunk-2DMPFVUM.mjs +0 -8
  193. package/dist/lib/neutral/chunk-4RJALG6K.mjs.map +0 -7
  194. package/dist/lib/neutral/chunk-BUKQITZT.mjs +0 -105
  195. package/dist/lib/neutral/chunk-BUKQITZT.mjs.map +0 -7
  196. package/dist/lib/neutral/chunk-D7DFASAE.mjs.map +0 -7
  197. package/dist/lib/neutral/chunk-MI6X5CTJ.mjs.map +0 -7
  198. package/dist/lib/neutral/chunk-P2F3STZN.mjs +0 -8
  199. package/dist/lib/neutral/chunk-P2F3STZN.mjs.map +0 -7
  200. package/dist/lib/neutral/chunk-PDB6UOSB.mjs.map +0 -7
  201. package/dist/lib/neutral/chunk-UYR3YH4Q.mjs +0 -31
  202. package/dist/lib/neutral/chunk-UYR3YH4Q.mjs.map +0 -7
  203. package/dist/lib/neutral/create-OZRIZ7RN.mjs.map +0 -7
  204. package/dist/lib/neutral/create-object-F2NWICFV.mjs.map +0 -7
  205. package/dist/lib/neutral/install-function-5N24Q45W.mjs.map +0 -7
  206. package/dist/lib/neutral/invoke-5QVEZ3X5.mjs.map +0 -7
  207. package/dist/lib/neutral/query-deployed-functions-FVD7NYPA.mjs.map +0 -7
  208. package/dist/lib/neutral/react-surface-JH2AOK7V.mjs.map +0 -7
  209. package/dist/types/src/capabilities/artifact-definition.d.ts +0 -12
  210. package/dist/types/src/capabilities/artifact-definition.d.ts.map +0 -1
  211. package/dist/types/src/components/FramePanel/FramePanel.d.ts +0 -12
  212. package/dist/types/src/components/FramePanel/FramePanel.d.ts.map +0 -1
  213. package/dist/types/src/components/FramePanel/index.d.ts +0 -2
  214. package/dist/types/src/components/FramePanel/index.d.ts.map +0 -1
  215. package/dist/types/src/containers/NotebookContainer/NotebookContainer.d.ts +0 -7
  216. package/dist/types/src/containers/NotebookContainer/NotebookContainer.d.ts.map +0 -1
  217. package/dist/types/src/containers/NotebookContainer/NotebookContainer.stories.d.ts +0 -7
  218. package/dist/types/src/containers/NotebookContainer/NotebookContainer.stories.d.ts.map +0 -1
  219. package/dist/types/src/containers/NotebookContainer/index.d.ts +0 -2
  220. package/dist/types/src/containers/NotebookContainer/index.d.ts.map +0 -1
  221. package/dist/types/src/containers/ScriptContainer/ScriptContainer.d.ts.map +0 -1
  222. package/dist/types/src/containers/ScriptContainer/ScriptContainer.stories.d.ts.map +0 -1
  223. package/dist/types/src/containers/ScriptContainer/index.d.ts +0 -2
  224. package/dist/types/src/operations/access-token-created.d.ts +0 -5
  225. package/dist/types/src/operations/access-token-created.d.ts.map +0 -1
  226. package/dist/types/src/templates/chat.d.ts +0 -6
  227. package/dist/types/src/templates/chat.d.ts.map +0 -1
  228. package/src/capabilities/artifact-definition.ts +0 -226
  229. package/src/components/FramePanel/FramePanel.tsx +0 -85
  230. package/src/components/FramePanel/index.ts +0 -5
  231. package/src/containers/NotebookContainer/index.ts +0 -5
  232. package/src/containers/ScriptContainer/index.ts +0 -5
  233. package/src/operations/access-token-created.ts +0 -37
  234. package/src/templates/chat.ts +0 -96
  235. /package/dist/lib/neutral/{chunk-BDRB6ZX2.mjs.map → chunk-BDHDBPVM.mjs.map} +0 -0
  236. /package/dist/lib/neutral/{chunk-2DMPFVUM.mjs.map → chunk-NQOIENTU.mjs.map} +0 -0
  237. /package/dist/lib/neutral/{compiler-SMVIP5UN.mjs.map → compiler-ODK4UA2N.mjs.map} +0 -0
  238. /package/dist/lib/neutral/{create-script-VBA3SLSU.mjs.map → create-script-66DO3UJO.mjs.map} +0 -0
  239. /package/dist/lib/neutral/{delete-PAUWA2QM.mjs.map → delete-HCQIQFVP.mjs.map} +0 -0
  240. /package/dist/lib/neutral/{operation-handler-OTCWYDFI.mjs.map → operation-handler-X44IGZXS.mjs.map} +0 -0
  241. /package/dist/lib/neutral/{read-FFOSK6A3.mjs.map → read-RQESBAQI.mjs.map} +0 -0
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/meta.ts"],
4
- "sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { type Plugin } from '@dxos/app-framework';\nimport { trim } from '@dxos/util';\n\nexport const meta: Plugin.Meta = {\n id: 'org.dxos.plugin.script',\n name: 'Scripts',\n description: trim`\n Write and deploy custom JavaScript functions that extend your workspace capabilities.\n Create AI agent tools, spreadsheet formulas, and automation scripts that integrate seamlessly with other plugins.\n `,\n icon: 'ph--code--regular',\n iconHue: 'sky',\n source: 'https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-explorer',\n tags: ['labs'],\n screenshots: ['https://dxos.network/plugin-details-scripts-dark.png'],\n};\n\n// TODO(ZaymonFC): Configure by scopes?\nexport const defaultScriptsForIntegration: Record<string, string[]> = {\n // TODO(wittjosiah): Also include content extraction scripts in the default set.\n 'gmail.com': ['org.dxos.script.gmail'],\n};\n"],
5
- "mappings": ";AAKA,SAASA,YAAY;AAEd,IAAMC,OAAoB;EAC/BC,IAAI;EACJC,MAAM;EACNC,aAAaJ;;;;EAIbK,MAAM;EACNC,SAAS;EACTC,QAAQ;EACRC,MAAM;IAAC;;EACPC,aAAa;IAAC;;AAChB;AAGO,IAAMC,+BAAyD;;EAEpE,aAAa;IAAC;;AAChB;",
6
- "names": ["trim", "meta", "id", "name", "description", "icon", "iconHue", "source", "tags", "screenshots", "defaultScriptsForIntegration"]
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/blueprints/functions/create.ts"],
4
- "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\n\nimport { Script, Operation } from '@dxos/compute';\nimport { Database, Obj, Ref } from '@dxos/echo';\nimport { CollectionModel } from '@dxos/schema';\n\nimport { Create } from './definitions';\n\nexport default Create.pipe(\n Operation.withHandler(\n Effect.fn(function* ({ name, source, templateId }) {\n let scriptSource = source ?? '';\n\n if (templateId) {\n const template = yield* findTemplate(templateId);\n if (template) {\n scriptSource = template.source;\n }\n }\n\n const script = Script.make({ name, source: scriptSource });\n const { db } = yield* Database.Service;\n db.add(script);\n\n const fn = Obj.make(Operation.PersistentOperation, {\n name,\n version: '0.0.0',\n source: Ref.make(script),\n });\n yield* CollectionModel.add({ object: fn });\n\n return {\n function: Obj.getDXN(fn).toString(),\n };\n }),\n ),\n);\n\nconst findTemplate = (templateId: string) =>\n Effect.promise(async () => {\n const { templates } = await import('../../templates');\n return templates.find((template) => template.id === templateId);\n });\n"],
5
- "mappings": ";;;;;;AAIA,YAAYA,YAAY;AAExB,SAASC,QAAQC,iBAAiB;AAClC,SAASC,UAAUC,KAAKC,WAAW;AACnC,SAASC,uBAAuB;AAIhC,IAAA,iBAAeC,OAAOC,KACpBC,UAAUC,YACDC,UAAG,WAAW,EAAEC,MAAMC,QAAQC,WAAU,GAAE;AAC/C,MAAIC,eAAeF,UAAU;AAE7B,MAAIC,YAAY;AACd,UAAME,WAAW,OAAOC,aAAaH,UAAAA;AACrC,QAAIE,UAAU;AACZD,qBAAeC,SAASH;IAC1B;EACF;AAEA,QAAMK,SAASC,OAAOC,KAAK;IAAER;IAAMC,QAAQE;EAAa,CAAA;AACxD,QAAM,EAAEM,GAAE,IAAK,OAAOC,SAASC;AAC/BF,KAAGG,IAAIN,MAAAA;AAEP,QAAMP,MAAKc,IAAIL,KAAKX,UAAUiB,qBAAqB;IACjDd;IACAe,SAAS;IACTd,QAAQe,IAAIR,KAAKF,MAAAA;EACnB,CAAA;AACA,SAAOW,gBAAgBL,IAAI;IAAEM,QAAQnB;EAAG,CAAA;AAExC,SAAO;IACLoB,UAAUN,IAAIO,OAAOrB,GAAAA,EAAIsB,SAAQ;EACnC;AACF,CAAA,CAAA,CAAA;AAIJ,IAAMhB,eAAe,CAACH,eACboB,eAAQ,YAAA;AACb,QAAM,EAAEC,UAAS,IAAK,MAAM,OAAO,uBAAA;AACnC,SAAOA,UAAUC,KAAK,CAACpB,aAAaA,SAASqB,OAAOvB,UAAAA;AACtD,CAAA;",
6
- "names": ["Effect", "Script", "Operation", "Database", "Obj", "Ref", "CollectionModel", "Create", "pipe", "Operation", "withHandler", "fn", "name", "source", "templateId", "scriptSource", "template", "findTemplate", "script", "Script", "make", "db", "Database", "Service", "add", "Obj", "PersistentOperation", "version", "Ref", "CollectionModel", "object", "function", "getDXN", "toString", "promise", "templates", "find", "id"]
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/capabilities/create-object.ts"],
4
- "sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\n\nimport { Capability } from '@dxos/app-framework';\nimport { Operation, Script } from '@dxos/compute';\nimport { SpaceOperation } from '@dxos/plugin-space';\nimport { SpaceCapabilities } from '@dxos/plugin-space';\n\nimport { ScriptOperation } from '#types';\nimport { Notebook } from '#types';\n\nexport default Capability.makeModule(\n Effect.fnUntraced(function* () {\n return [\n Capability.contributes(SpaceCapabilities.CreateObjectEntry, {\n id: Script.Script.typename,\n inputSchema: ScriptOperation.ScriptProps,\n createObject: (props, options) =>\n Effect.gen(function* () {\n const { object } = yield* Operation.invoke(ScriptOperation.CreateScript, props);\n return yield* Operation.invoke(SpaceOperation.AddObject, {\n object,\n target: options.target,\n hidden: true,\n targetNodeId: options.targetNodeId,\n });\n }),\n }),\n Capability.contributes(SpaceCapabilities.CreateObjectEntry, {\n id: Notebook.Notebook.typename,\n inputSchema: ScriptOperation.NotebookProps,\n createObject: (props, options) =>\n Effect.gen(function* () {\n const object = Notebook.make(props);\n return yield* Operation.invoke(SpaceOperation.AddObject, {\n object,\n target: options.target,\n hidden: true,\n targetNodeId: options.targetNodeId,\n });\n }),\n }),\n ];\n }),\n);\n"],
5
- "mappings": ";;;AAIA,YAAYA,YAAY;AAExB,SAASC,kBAAkB;AAC3B,SAASC,WAAWC,cAAc;AAClC,SAASC,sBAAsB;AAC/B,SAASC,yBAAyB;AAElC,SAASC,uBAAuB;AAChC,SAASC,gBAAgB;AAEzB,IAAA,wBAAeN,WAAWO,WACjBC,kBAAW,aAAA;AAChB,SAAO;IACLR,WAAWS,YAAYL,kBAAkBM,mBAAmB;MAC1DC,IAAIT,OAAOA,OAAOU;MAClBC,aAAaR,gBAAgBS;MAC7BC,cAAc,CAACC,OAAOC,YACbC,WAAI,aAAA;AACT,cAAM,EAAEC,OAAM,IAAK,OAAOlB,UAAUmB,OAAOf,gBAAgBgB,cAAcL,KAAAA;AACzE,eAAO,OAAOf,UAAUmB,OAAOjB,eAAemB,WAAW;UACvDH;UACAI,QAAQN,QAAQM;UAChBC,QAAQ;UACRC,cAAcR,QAAQQ;QACxB,CAAA;MACF,CAAA;IACJ,CAAA;IACAzB,WAAWS,YAAYL,kBAAkBM,mBAAmB;MAC1DC,IAAIL,SAASA,SAASM;MACtBC,aAAaR,gBAAgBqB;MAC7BX,cAAc,CAACC,OAAOC,YACbC,WAAI,aAAA;AACT,cAAMC,SAASb,SAASqB,KAAKX,KAAAA;AAC7B,eAAO,OAAOf,UAAUmB,OAAOjB,eAAemB,WAAW;UACvDH;UACAI,QAAQN,QAAQM;UAChBC,QAAQ;UACRC,cAAcR,QAAQQ;QACxB,CAAA;MACF,CAAA;IACJ,CAAA;;AAEJ,CAAA,CAAA;",
6
- "names": ["Effect", "Capability", "Operation", "Script", "SpaceOperation", "SpaceCapabilities", "ScriptOperation", "Notebook", "makeModule", "fnUntraced", "contributes", "CreateObjectEntry", "id", "typename", "inputSchema", "ScriptProps", "createObject", "props", "options", "gen", "object", "invoke", "CreateScript", "AddObject", "target", "hidden", "targetNodeId", "NotebookProps", "make"]
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/blueprints/functions/install-function.ts"],
4
- "sourcesContent": ["//\n// Copyright 2026 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\n\nimport { ClientService } from '@dxos/client';\nimport { Operation } from '@dxos/compute';\nimport { Context } from '@dxos/context';\nimport { Obj, Query } from '@dxos/echo';\nimport { FunctionsServiceClient } from '@dxos/functions-runtime/edge';\n\nimport { InstallFunction } from './definitions';\n\nexport default InstallFunction.pipe(\n Operation.withHandler(\n Effect.fn(function* ({ key }) {\n const client = yield* ClientService;\n const functionsService = FunctionsServiceClient.fromClient(client);\n const deployed = yield* Effect.promise(() => functionsService.query(Context.default()));\n\n const fn = deployed.findLast((entry) => entry.key === key);\n if (!fn) {\n return yield* Effect.fail(new Error(`No deployed function found with key: ${key}`));\n }\n\n const space = client.spaces.get()[0];\n if (!space) {\n return yield* Effect.fail(new Error('No space available'));\n }\n\n yield* Effect.promise(() => client.addTypes([Operation.PersistentOperation]));\n\n const existingFunctions = yield* Effect.promise(() =>\n space.db.query(Query.type(Operation.PersistentOperation, { key })).run(),\n );\n\n let installed: Operation.PersistentOperation;\n if (existingFunctions.length > 0) {\n installed = existingFunctions[0];\n for (const existing of existingFunctions) {\n Operation.setFrom(existing, fn);\n }\n } else {\n installed = Obj.clone(fn);\n space.db.add(installed);\n }\n\n return {\n function: Obj.getDXN(installed).toString(),\n name: fn.name ?? 'Unnamed function',\n version: fn.version ?? '0.0.0',\n };\n }),\n ),\n);\n"],
5
- "mappings": ";;;;;;AAIA,YAAYA,YAAY;AAExB,SAASC,qBAAqB;AAC9B,SAASC,iBAAiB;AAC1B,SAASC,eAAe;AACxB,SAASC,KAAKC,aAAa;AAC3B,SAASC,8BAA8B;AAIvC,IAAA,eAAeC;IAIT,2BAAMC,gBAAmBC,KAAAA,UAAAA,YAAkCC,UAAAA,WAAAA,EAAAA,IAAAA,GAAAA;AAC3D,QAAMC,SAAAA,OAAW;AAEjB,QAAMC,mBAAcC,uBAA6B,WAAKC,MAAAA;AACtD,QAAKF,WAAI,OAAA,eAAA,MAAA,iBAAA,MAAA,QAAA,QAAA,QAAA,EAAA,YAAA,YAAA,GAAA,cAAA,GAAA,GAAA,CAAA,CAAA,CAAA;QACPA,MAAO,SAAOG,SAAW,CAAC,UAAIC,MAAO,QAAA,GAAA;AACvC,MAAA,CAAAJ,KAAA;AAEA,WAAMK,OAAeC,YAAOC,IAAM,MAAE,wCAAA,GAAA,EAAA,CAAA;EACpC;QACE,QAAO,OAAOJ,OAAOK,IAAK,EAAIJ,CAAAA;AAChC,MAAA,CAAA,OAAA;AAEA,WAAOD,OAAe,YAAML,IAAOW,MAAAA,oBAAS,CAAA;;SAA+B,eAAA,MAAA,OAAA,SAAA;IAErEC,UAAAA;;QAC2D,oBAAO,OAAA,eAAA,MAAA,MAAA,GAAA,MAAA,MAAA,KAAA,UAAA,qBAAA;IAGpEC;EACAD,CAAAA,CAAAA,EAAAA,IAAAA,CAAAA;MACFC;MACA,kBAAWC,SAAYF,GAAAA;gBACrBG,kBAAkBD,CAAAA;AACpB,eAAA,YAAA,mBAAA;AACK,gBAAA,QAAA,UAAAZ,GAAA;IACLW;SACAN;AACF,gBAAA,IAAA,MAAAL,GAAA;AAEA,UAAO,GAAA,IAAA,SAAA;;SAELc;IACAC,UAASf,IAAGe,OAAO,SAAI,EAAA,SAAA;IACzB,MAAAf,IAAA,QAAA;IAGJ,SAAAA,IAAA,WAAA;;;",
6
- "names": ["Effect", "ClientService", "Operation", "Context", "Obj", "Query", "FunctionsServiceClient", "InstallFunction", "functionsService", "FunctionsServiceClient", "client", "deployed", "fn", "findLast", "key", "Effect", "Error", "space", "spaces", "get", "fail", "addTypes", "existingFunctions", "installed", "existing", "Operation", "name", "version"]
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/blueprints/functions/invoke.ts"],
4
- "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\n\nimport { ClientService } from '@dxos/client';\nimport { Operation } from '@dxos/compute';\nimport { Context } from '@dxos/context';\nimport { Database } from '@dxos/echo';\nimport { FunctionsServiceClient } from '@dxos/functions-runtime/edge';\nimport { getSpace } from '@dxos/react-client/echo';\n\nimport { Invoke } from './definitions';\n\nexport default Invoke.pipe(\n Operation.withHandler(\n Effect.fn(function* ({ function: fn, payload }) {\n const loaded = yield* Database.load(fn);\n const client = yield* ClientService;\n\n const space = getSpace(loaded);\n if (!space) {\n return yield* Effect.fail(new Error('Function is not in a space.'));\n }\n\n const functionsService = FunctionsServiceClient.fromClient(client);\n const result = yield* Effect.promise(() =>\n functionsService.invoke(Context.default(), loaded, payload ?? {}, { spaceId: space.id }),\n );\n\n return { response: result };\n }),\n ),\n);\n"],
5
- "mappings": ";;;;;;AAIA,YAAYA,YAAY;AAExB,SAASC,qBAAqB;AAC9B,SAASC,iBAAiB;AAC1B,SAASC,eAAe;AACxB,SAASC,gBAAgB;AACzB,SAASC,8BAA8B;AACvC,SAASC,gBAAgB;AAIzB,IAAA,eAAeC;IAIT,iBAAMC,OAAS,KAAOC,UAAAA,YAAAA,UAAAA,WAAAA,EAAAA,UAAAA,KAAAA,QAAAA,GAAAA;AAEtB,QAAMC,SAAQC,OAAAA,SAASC,KAAAA,GAAAA;AACvB,QAAKF,SAAO,OAAA;QACV,QAAO,SAAOG,MAAW;AAC3B,MAAA,CAAA,OAAA;AAEA,WAAMC,OAAmBC,YAAAA,IAAAA,MAAAA,6BAAkCP,CAAAA;EAC3D;2BACuF,uBAAA,WAAA,MAAA;QAAC,SAAA,OAAA,eAAA,MAAA,iBAAA,OAAA,QAAA,QAAA,QAAA,EAAA,YAAA,YAAA,GAAA,cAAA,GAAA,GAAA,CAAA,GAAA,QAAA,WAAA,CAAA,GAAA;IAGjF,SAAA,MAAA;EAAEQ,CAAAA,CAAAA;AAAiB,SAAA;IAG9B,UAAA;;;",
6
- "names": ["Effect", "ClientService", "Operation", "Context", "Database", "FunctionsServiceClient", "getSpace", "Invoke", "client", "ClientService", "space", "getSpace", "loaded", "Effect", "functionsService", "FunctionsServiceClient", "response"]
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/blueprints/functions/query-deployed-functions.ts"],
4
- "sourcesContent": ["//\n// Copyright 2026 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\n\nimport { ClientService } from '@dxos/client';\nimport { Operation } from '@dxos/compute';\nimport { Context } from '@dxos/context';\nimport { FunctionsServiceClient } from '@dxos/functions-runtime/edge';\n\nimport { QueryDeployedFunctions } from './definitions';\n\nexport default QueryDeployedFunctions.pipe(\n Operation.withHandler(\n Effect.fn(function* () {\n const client = yield* ClientService;\n const functionsService = FunctionsServiceClient.fromClient(client);\n const deployed = yield* Effect.promise(() => functionsService.query(Context.default()));\n return {\n functions: deployed.map((fn) => ({\n key: fn.key,\n name: fn.name ?? 'Unnamed function',\n version: fn.version ?? '0.0.0',\n description: fn.description,\n updated: fn.updated,\n })),\n };\n }),\n ),\n);\n"],
5
- "mappings": ";;;;;;AAIA,YAAYA,YAAY;AAExB,SAASC,qBAAqB;AAC9B,SAASC,iBAAiB;AAC1B,SAASC,eAAe;AACxB,SAASC,8BAA8B;AAIvC,IAAA,eAAeC;IAIT,mCAAMC,uBAAmBC,KAAAA,UAAuBC,YAAWC,UAAAA,aAAAA;AAC3D,QAAMC,SAAAA,OAAW;AACjB,QAAA,mBAAO,uBAAA,WAAA,MAAA;QACLC,WAAWD,OAAcE,eAAQ,MAAA,iBAAA,MAAA,QAAA,QAAA,QAAA,EAAA,YAAA,YAAA,GAAA,cAAA,GAAA,GAAA,CAAA,CAAA,CAAA;;eAE/BC,SAASA,IAAI,CAAID,SAAA;MACjBE,KAAAA,IAAAA;MACAC,MAAAA,IAAAA,QAAgBA;MAChBC,SAASJ,IAAGI,WAAO;MACrB,aAAAJ,IAAA;MACF,SAAAA,IAAA;IAGJ,EAAA;;;",
6
- "names": ["Effect", "ClientService", "Operation", "Context", "FunctionsServiceClient", "QueryDeployedFunctions", "functionsService", "FunctionsServiceClient", "fromClient", "client", "deployed", "functions", "fn", "name", "version", "description", "updated"]
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/capabilities/react-surface.tsx"],
4
- "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\nimport React, { type ComponentProps } from 'react';\n\nimport { Capabilities, Capability } from '@dxos/app-framework';\nimport { Surface, useAtomCapability, useSettingsState } from '@dxos/app-framework/ui';\nimport { AppSurface } from '@dxos/app-toolkit/ui';\nimport { Script } from '@dxos/compute';\nimport { InvocationTraceContainer } from '@dxos/devtools';\nimport { Feed } from '@dxos/echo';\nimport { useClient } from '@dxos/react-client';\nimport { getSpace } from '@dxos/react-client/echo';\nimport { Panel } from '@dxos/react-ui';\n\nimport { ScriptPluginSettings } from '#components';\nimport { DeploymentDialog, NotebookContainer, ScriptContainer, ScriptProperties, TestContainer } from '#containers';\nimport { useCompiler } from '#hooks';\nimport { meta } from '#meta';\nimport { Notebook, ScriptCapabilities, type Settings } from '#types';\n\nimport { DEPLOYMENT_DIALOG } from '../constants';\nimport { getAccessCredential } from '../util';\n\nexport default Capability.makeModule(() =>\n Effect.succeed(\n Capability.contributes(Capabilities.ReactSurface, [\n Surface.create({\n id: 'plugin-settings',\n filter: AppSurface.settings(AppSurface.Article, meta.id),\n component: ({ data: { subject } }) => {\n const { settings, updateSettings } = useSettingsState<Settings.Settings>(subject.atom);\n const client = useClient();\n // TODO(burdon): Check token.\n const handleAuthenticate = async () => {\n const { identityKey } = client.halo.identity.get()!;\n await client.halo.writeCredentials([getAccessCredential(identityKey)]);\n };\n return (\n <ScriptPluginSettings\n settings={settings}\n onSettingsChange={updateSettings}\n onAuthenticate={handleAuthenticate}\n />\n );\n },\n }),\n Surface.create({\n id: 'script.article',\n // TODO(wittjosiah): Split into multiple surfaces if this filter proves too strict for non-article roles.\n filter: AppSurface.oneOf(\n AppSurface.object(AppSurface.Article, Script.Script),\n AppSurface.object(AppSurface.Section, Script.Script),\n ),\n component: ({ data, role }) => {\n const compiler = useCompiler();\n const settings = useAtomCapability(ScriptCapabilities.Settings);\n return (\n <ScriptContainer\n role={role}\n subject={data.subject}\n attendableId={data.attendableId}\n settings={settings}\n env={compiler?.environment}\n />\n );\n },\n }),\n Surface.create({\n id: 'notebook.article',\n filter: AppSurface.object(AppSurface.Article, Notebook.Notebook),\n component: ({ data, role }) => {\n const compiler = useCompiler();\n return (\n <NotebookContainer\n role={role}\n subject={data.subject}\n attendableId={data.attendableId}\n env={compiler?.environment}\n />\n );\n },\n }),\n Surface.create({\n id: 'properties',\n filter: AppSurface.object(AppSurface.ObjectProperties, Script.Script),\n component: ({ data, role }) => <ScriptProperties role={role} subject={data.subject} />,\n }),\n Surface.create({\n id: 'companion.execute',\n filter: AppSurface.allOf(\n AppSurface.literal(AppSurface.Article, 'execute'),\n AppSurface.companion(AppSurface.Article, Script.Script),\n ),\n component: ({ data, role }) => <TestContainer script={data.companionTo} role={role} />,\n }),\n Surface.create({\n id: 'companion.logs',\n filter: AppSurface.allOf(\n AppSurface.literal(AppSurface.Article, 'logs'),\n AppSurface.companion(AppSurface.Article, Script.Script),\n ),\n component: ({ data, role }) => {\n const space = getSpace(data.companionTo);\n const feed = space?.properties.invocationTraceFeed?.target;\n const queueDxn = feed ? Feed.getQueueDxn(feed) : undefined;\n return (\n <Panel.Root role={role}>\n <Panel.Content>\n <InvocationTraceContainer\n db={space?.db}\n queueDxn={queueDxn}\n target={data.companionTo}\n detailAxis='block'\n />\n </Panel.Content>\n </Panel.Root>\n );\n },\n }),\n Surface.create({\n id: DEPLOYMENT_DIALOG,\n filter: AppSurface.component<ComponentProps<typeof DeploymentDialog>>(AppSurface.Dialog, DEPLOYMENT_DIALOG),\n component: ({ data }) => <DeploymentDialog {...data.props} />,\n }),\n ]),\n ),\n);\n"],
5
- "mappings": "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",
6
- "names": ["Effect", "React", "Capabilities", "Capability", "Surface", "useAtomCapability", "useSettingsState", "AppSurface", "Script", "InvocationTraceContainer", "Feed", "useClient", "getSpace", "Panel", "ScriptPluginSettings", "DeploymentDialog", "NotebookContainer", "ScriptContainer", "ScriptProperties", "TestContainer", "useCompiler", "meta", "Notebook", "ScriptCapabilities", "Capability", "makeModule", "succeed", "contributes", "Capabilities", "ReactSurface", "Surface", "create", "id", "filter", "AppSurface", "settings", "Article", "meta", "component", "data", "subject", "updateSettings", "useSettingsState", "atom", "client", "useClient", "handleAuthenticate", "identityKey", "halo", "identity", "get", "writeCredentials", "getAccessCredential", "ScriptPluginSettings", "onSettingsChange", "onAuthenticate", "oneOf", "object", "Script", "Section", "role", "compiler", "useCompiler", "useAtomCapability", "ScriptCapabilities", "Settings", "ScriptContainer", "attendableId", "env", "environment", "Notebook", "NotebookContainer", "ObjectProperties", "ScriptProperties", "allOf", "literal", "companion", "TestContainer", "script", "companionTo", "space", "getSpace", "feed", "properties", "invocationTraceFeed", "target", "queueDxn", "Feed", "getQueueDxn", "undefined", "Panel", "Root", "Content", "InvocationTraceContainer", "db", "detailAxis", "DEPLOYMENT_DIALOG", "Dialog", "DeploymentDialog", "props"]
7
- }
@@ -1,12 +0,0 @@
1
- import * as Effect from 'effect/Effect';
2
- import { Capability, type PromiseIntentDispatcher } from '@dxos/app-framework';
3
- import { type Space } from '@dxos/react-client/echo';
4
- declare global {
5
- interface ToolContextExtensions {
6
- space?: Space;
7
- dispatch?: PromiseIntentDispatcher;
8
- }
9
- }
10
- declare const _default: (props: void) => Effect.Effect<Capability.Capability<any>, never, never>;
11
- export default _default;
12
- //# sourceMappingURL=artifact-definition.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"artifact-definition.d.ts","sourceRoot":"","sources":["../../../../src/capabilities/artifact-definition.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAIxC,OAAO,EAAgB,UAAU,EAAE,KAAK,uBAAuB,EAAgB,MAAM,qBAAqB,CAAC;AAM3G,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAKrD,OAAO,CAAC,MAAM,CAAC,CAAC;IACd,UAAU,qBAAqB;QAC7B,KAAK,CAAC,EAAE,KAAK,CAAC;QACd,QAAQ,CAAC,EAAE,uBAAuB,CAAC;KACpC;CACF"}
@@ -1,12 +0,0 @@
1
- import React from 'react';
2
- import { type BundleResult } from '@dxos/functions-runtime/bundler';
3
- export type FramePanelProps = {
4
- containerUrl: string;
5
- result: BundleResult;
6
- debug?: boolean;
7
- };
8
- /**
9
- * IFrame container for the compiled script.
10
- */
11
- export declare const FramePanel: ({ containerUrl, result, debug }: FramePanelProps) => React.JSX.Element;
12
- //# sourceMappingURL=FramePanel.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"FramePanel.d.ts","sourceRoot":"","sources":["../../../../../src/components/FramePanel/FramePanel.tsx"],"names":[],"mappings":"AAIA,OAAO,KAA4B,MAAM,OAAO,CAAC;AAGjD,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAQpE,MAAM,MAAM,eAAe,GAAG;IAC5B,YAAY,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,YAAY,CAAC;IACrB,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,UAAU,oCAA4C,eAAe,sBA4DjF,CAAC"}
@@ -1,2 +0,0 @@
1
- export * from './FramePanel';
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/FramePanel/index.ts"],"names":[],"mappings":"AAIA,cAAc,cAAc,CAAC"}
@@ -1,7 +0,0 @@
1
- import React from 'react';
2
- import { type AppSurface } from '@dxos/app-toolkit/ui';
3
- import { type TypescriptEditorProps } from '#components';
4
- import { type Notebook } from '#types';
5
- export type NotebookContainerProps = AppSurface.ObjectArticleProps<Notebook.Notebook, Pick<TypescriptEditorProps, 'env'>>;
6
- export declare const NotebookContainer: ({ role, subject: notebook, attendableId, env }: NotebookContainerProps) => React.JSX.Element;
7
- //# sourceMappingURL=NotebookContainer.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"NotebookContainer.d.ts","sourceRoot":"","sources":["../../../../../src/containers/NotebookContainer/NotebookContainer.tsx"],"names":[],"mappings":"AASA,OAAO,KAAqD,MAAM,OAAO,CAAC;AAE1E,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAevD,OAAO,EAAwD,KAAK,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAE/G,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAYvC,MAAM,MAAM,sBAAsB,GAAG,UAAU,CAAC,kBAAkB,CAChE,QAAQ,CAAC,QAAQ,EACjB,IAAI,CAAC,qBAAqB,EAAE,KAAK,CAAC,CACnC,CAAC;AAEF,eAAO,MAAM,iBAAiB,mDAAoD,sBAAsB,sBAsLvG,CAAC"}
@@ -1,7 +0,0 @@
1
- import { type Meta, type StoryObj } from '@storybook/react-vite';
2
- import { NotebookContainer } from './NotebookContainer';
3
- declare const meta: Meta<typeof NotebookContainer>;
4
- export default meta;
5
- type Story = StoryObj<typeof meta>;
6
- export declare const Default: Story;
7
- //# sourceMappingURL=NotebookContainer.stories.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"NotebookContainer.stories.d.ts","sourceRoot":"","sources":["../../../../../src/containers/NotebookContainer/NotebookContainer.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,IAAI,EAAE,KAAK,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AA0BjE,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAExD,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,iBAAiB,CAyCxC,CAAC;eAEa,IAAI;AAEnB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAEnC,eAAO,MAAM,OAAO,EAAE,KAKrB,CAAC"}
@@ -1,2 +0,0 @@
1
- export { NotebookContainer as default } from './NotebookContainer';
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/containers/NotebookContainer/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,iBAAiB,IAAI,OAAO,EAAE,MAAM,qBAAqB,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"ScriptContainer.d.ts","sourceRoot":"","sources":["../../../../../src/containers/ScriptContainer/ScriptContainer.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAkB,MAAM,OAAO,CAAC;AAEvC,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,eAAe,CAAC;AAQ5C,OAAO,EAAmC,KAAK,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAE1F,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAEvC,MAAM,MAAM,iBAAiB,GAAG,UAAU,CAAC,kBAAkB,CAC3D,MAAM,CAAC,MAAM,EACb;IACE,QAAQ,CAAC,EAAE,QAAQ,CAAC,QAAQ,CAAC;CAC9B,GAAG,IAAI,CAAC,qBAAqB,EAAE,KAAK,CAAC,CACvC,CAAC;AAEF,eAAO,MAAM,eAAe,4DAMzB,iBAAiB,6BAoDnB,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"ScriptContainer.stories.d.ts","sourceRoot":"","sources":["../../../../../src/containers/ScriptContainer/ScriptContainer.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAa,KAAK,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAEjE,OAAO,KAA8B,MAAM,OAAO,CAAC;AAoBnD,KAAK,iBAAiB,GAAG,EAAE,CAAC;AAwC5B,QAAA,MAAM,IAAI;;gBAnCe,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoEP,CAAC;eAErB,IAAI;AAEnB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAEnC,eAAO,MAAM,OAAO,EAAE,KAAU,CAAC"}
@@ -1,2 +0,0 @@
1
- export { ScriptContainer as default } from './ScriptContainer';
2
- //# sourceMappingURL=index.d.ts.map
@@ -1,5 +0,0 @@
1
- import { Operation } from '@dxos/compute';
2
- import { IntegrationOperation } from '@dxos/plugin-integration';
3
- declare const handler: Operation.WithHandler<typeof IntegrationOperation.AccessTokenCreated>;
4
- export default handler;
5
- //# sourceMappingURL=access-token-created.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"access-token-created.d.ts","sourceRoot":"","sources":["../../../../src/operations/access-token-created.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAOhE,QAAA,MAAM,OAAO,EAAE,SAAS,CAAC,WAAW,CAAC,OAAO,oBAAoB,CAAC,kBAAkB,CAkBhF,CAAC;eAEW,OAAO"}
@@ -1,6 +0,0 @@
1
- /**
2
- * Chatbot that answers questions based on the context data.
3
- */
4
- declare const _default: ({ data: { bodyText }, context: { space, ai } }: any) => Promise<Response>;
5
- export default _default;
6
- //# sourceMappingURL=chat.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"chat.d.ts","sourceRoot":"","sources":["../../../../src/templates/chat.ts"],"names":[],"mappings":"AAOA;;GAEG;yEACmE,GAAG"}
@@ -1,226 +0,0 @@
1
- //
2
- // Copyright 2025 DXOS.org
3
- //
4
-
5
- // ISSUE(burdon): defineArtifact
6
- // @ts-nocheck
7
-
8
- import * as Effect from 'effect/Effect';
9
- import * as Schema from 'effect/Schema';
10
-
11
- import { ToolResult, createTool } from '@dxos/ai';
12
- import { Capabilities, Capability, type PromiseIntentDispatcher, createIntent } from '@dxos/app-framework';
13
- import { ArtifactId, createArtifactElement } from '@dxos/assistant';
14
- import { defineArtifact, ScriptType } from '@dxos/compute';
15
- import { Filter, Obj, Ref } from '@dxos/echo';
16
- import { invariant } from '@dxos/invariant';
17
- import { SpaceAction } from '@dxos/plugin-space';
18
- import { type Space } from '@dxos/react-client/echo';
19
-
20
- import { meta } from '#meta';
21
-
22
- // TODO(burdon): Factor out.
23
- declare global {
24
- interface ToolContextExtensions {
25
- space?: Space;
26
- dispatch?: PromiseIntentDispatcher;
27
- }
28
- }
29
-
30
- export default Capability.makeModule(() =>
31
- Effect.sync(() => {
32
- const definition = defineArtifact({
33
- id: `artifact:${meta.id}`,
34
- name: meta.name,
35
- // TODO(dmaretskyi): Since writing scripts requires a lot of domain knowledge,
36
- // we should offload the work of synthesizing the code to a separate model.
37
- // The main reasoning model will give it a concrete task and the script model will synthesize the code, knowing all the docs.
38
- instructions: `
39
- If the user explicitly requests you to write a script, you can create one.
40
- If the user requests you to change one of the existing script, you can update it.
41
- You must not create a script unless the user explicitly requests it.
42
- Scripts are short code pieces of executable code that can be used to perform computations, integrate with external systems, and perform automated tasks.
43
- Each script must follow as strict shape for the definition but the body can contain any valid executable code.
44
- Scripts are written in JavaScript or TypeScript.
45
- Each script must define an input schema and output schema.
46
- Each script must have its own detailed description.
47
-
48
- Important: You cannot execute scripts. Scripts are only available as tools after the user deploys them. You must only call the available tools.
49
-
50
- Description:
51
- The description is a detailed description of the script.
52
- It is used to describe the script's purpose, input, and output.
53
- The description is used to generate the script's documentation.
54
- The description is also goes into the script metadata.
55
- The description is used by AI to understand the script and its purpose.
56
- The description must provide cases on when the script should be used.
57
-
58
- Schema:
59
- The schema is defined using a schema-DSL library called Effect Schema.
60
- The input schema describes the arguments that the script accepts.
61
- The output schema describes the result that the script produces.
62
- The schema is used to validate the script's input and output.
63
- The schema is also goes into the script metadata.
64
- The properties in the schema must have valid descriptions.
65
- The input and output schemas must both be a struct of fields.
66
-
67
- Restricts:
68
- The scripts can only import code from "dxos:functions" module. No other modules are allowed.
69
- Some web APIs are available - like fetch.
70
-
71
- Reasoning:
72
- Before writing a script, synthesize the following information:
73
- - Description
74
- - What APIs will be used.
75
- - Detailed input schema
76
- - Detailed output schema
77
-
78
- <apis>
79
- export function defineFunction(params: {
80
- description: string,
81
- inputSchema: Schema.Schema,
82
- outputSchema: Schema.Schema,
83
- handler: (params: { event: { data: TInput } }) => Promise<TOutput>
84
- }): FunctionDefinition
85
- /**
86
- * Effect Schema
87
- */
88
- export const Schema;
89
-
90
- // Examples:
91
-
92
- Schema.String
93
- Schema.Number
94
- Schema.Boolean
95
- Schema.Struct({
96
- from: Schema.String.annotations({ description: 'The source currency' }),
97
- to: Schema.String.annotations({ description: 'The target currency' }),
98
- })
99
- Schema.Array(Schema.String)
100
- Schema.Union(Schema.String, Schema.Number)
101
- Schema.optional(Schema.String)
102
- Schema.String.annotations({ description: 'The source currency' })
103
- </apis>
104
-
105
- <handler_function>
106
- Async function that takes the argument in the form of:
107
-
108
- type HandlerFunctionProp = {
109
- event: {
110
- data: T // The input schema
111
- },
112
- }
113
-
114
- The function must return the result that matches the output schema.
115
- </handler_function>
116
-
117
- <example>
118
- import { defineFunction, S } from 'dxos:functions';
119
-
120
- export default defineFunction({
121
- description: 'Returns the exchange rate between two currencies.',
122
-
123
- inputSchema: Schema.Struct({
124
- from: Schema.String.annotations({ description: 'The source currency' }),
125
- to: Schema.String.annotations({ description: 'The target currency' }),
126
- }),
127
-
128
- outputSchema: Schema.Struct({
129
- rate: Schema.String.annotations({ description: 'The exchange rate' }),
130
- }),
131
-
132
- handler: async ({
133
- event: {
134
- data: { from, to },
135
- },
136
- }: any) => {
137
- const res = await fetch(\`https://free.ratesdb.com/v1/rates?from=\${from}&to=\${to}\`);
138
- const {
139
- data: { rates },
140
- } = await res.json();
141
-
142
- return { rate: rates[to].toString() };
143
- },
144
- });
145
- </example>
146
- `,
147
- schema: ScriptType,
148
- tools: [
149
- createTool(meta.id, {
150
- name: 'create',
151
- description: 'Create a new script. Returns the artifact definition for the script',
152
- caption: 'Creating script...',
153
- schema: Schema.Struct({
154
- name: Schema.String.annotations({ description: 'The name of the script' }),
155
- code: Schema.String.annotations({
156
- description: 'The full code of the script in JavaScript or TypeScript. Must be valid executable code.',
157
- }),
158
- }),
159
- execute: async ({ name, code }, { extensions }) => {
160
- invariant(extensions?.space, 'No space');
161
- invariant(extensions?.dispatch, 'No intent dispatcher');
162
- const script = Obj.make(ScriptType, { name, source: Ref.make(Text.make({ content: code })) });
163
- extensions.space.db.add(script);
164
- await extensions.space.db.flush();
165
-
166
- const intent = createIntent(SpaceAction.AddObject, { target: extensions.space, object: script });
167
- const { data, error } = await extensions.dispatch(intent);
168
- if (!data || error) {
169
- return ToolResult.Error(error?.message ?? 'Failed to create chess game');
170
- }
171
-
172
- return ToolResult.Success(createArtifactElement(script.id));
173
- },
174
- }),
175
- createTool(meta.id, {
176
- name: 'inspect',
177
- description: 'Inspect a script. Returns the artifact definition for the script',
178
- caption: 'Inspecting script...',
179
- schema: Schema.Struct({
180
- id: ArtifactId,
181
- }),
182
- execute: async ({ id }, { extensions }) => {
183
- invariant(extensions?.space, 'No space');
184
-
185
- const script = (await extensions.space.db.query(Filter.id(id)).first()) as ScriptType;
186
- const { content } = await script.source.load();
187
-
188
- return ToolResult.Success({
189
- name: script.name,
190
- code: content,
191
- });
192
- },
193
- }),
194
- createTool(meta.id, {
195
- name: 'update',
196
- description: 'Update a script. Returns the artifact definition for the script',
197
- caption: 'Updating script...',
198
- schema: Schema.Struct({
199
- id: ArtifactId,
200
- code: Schema.String.annotations({
201
- description: 'The full code of the script in JavaScript or TypeScript. Must be valid executable code.',
202
- }),
203
- }),
204
- execute: async ({ id, code }, { extensions }) => {
205
- invariant(extensions?.space, 'No space');
206
-
207
- const script = (await extensions.space.db.query(Filter.id(id)).first()) as ScriptType;
208
- const source = await script.source.load();
209
- if (!source) {
210
- return ToolResult.Error('Script not found');
211
- }
212
-
213
- source.content = code;
214
- await extensions.space?.db.flush();
215
-
216
- return ToolResult.Success({
217
- name: script.name,
218
- });
219
- },
220
- }),
221
- ],
222
- });
223
-
224
- return Capability.contributes(Capabilities.ArtifactDefinition, definition);
225
- }),
226
- );
@@ -1,85 +0,0 @@
1
- //
2
- // Copyright 2023 DXOS.org
3
- //
4
-
5
- import React, { useEffect, useRef } from 'react';
6
-
7
- import { clientServiceBundle } from '@dxos/client-protocol';
8
- import { type BundleResult } from '@dxos/functions-runtime/bundler';
9
- import { invariant } from '@dxos/invariant';
10
- import { log } from '@dxos/log';
11
- import { useClient } from '@dxos/react-client';
12
- import { createProtoRpcPeer } from '@dxos/rpc';
13
- import { createIFramePort } from '@dxos/rpc-tunnel';
14
- import { mx } from '@dxos/ui-theme';
15
-
16
- export type FramePanelProps = {
17
- containerUrl: string;
18
- result: BundleResult;
19
- debug?: boolean;
20
- };
21
-
22
- /**
23
- * IFrame container for the compiled script.
24
- */
25
- export const FramePanel = ({ containerUrl, result, debug = true }: FramePanelProps) => {
26
- const client = useClient();
27
- const iframeRef = useRef<HTMLIFrameElement>(null);
28
- useEffect(() => {
29
- if (iframeRef.current) {
30
- // Connect iframe to client.
31
- const rpc = createProtoRpcPeer({
32
- exposed: clientServiceBundle,
33
- handlers: (client as any)._services.services, // TODO(burdon): Remove cast?
34
- port: createIFramePort({
35
- channel: 'frame',
36
- iframe: iframeRef.current,
37
- origin: '*',
38
- }),
39
- });
40
-
41
- rpc.open().catch((e) => log.catch(e));
42
- return () => {
43
- rpc.close().catch((e) => log.catch(e));
44
- };
45
- }
46
- }, [iframeRef]);
47
-
48
- // Encodes compiled code via URL.
49
- invariant(result.sourceHash, 'Source hash is required.');
50
- const sourceHash = Buffer.from(result.sourceHash).toString('hex');
51
- const src =
52
- 'bundle' in result
53
- ? `${containerUrl}?ts=${sourceHash}#code=${encodeURIComponent(new TextDecoder().decode(Object.values(result.bundle as any)[0] as Uint8Array))}`
54
- : undefined;
55
-
56
- return (
57
- <>
58
- <iframe ref={iframeRef} sandbox='allow-scripts' src={src} style={{ width: '100%', height: '100%' }} />
59
-
60
- {debug && (
61
- <div className='relative'>
62
- <div
63
- className={mx(
64
- 'flex absolute right-2 bottom-2 w-[30rem] h-[200px] bg-base-surface ring rounded-sm',
65
- 'z-20 overflow-x-hidden overflow-y-auto',
66
- )}
67
- >
68
- <pre className='text-xs whitespace-break-spaces break-all p-2'>
69
- {JSON.stringify(
70
- {
71
- timestamp: result.timestamp,
72
- sourceHash,
73
- error: 'error' in result ? result.error : undefined,
74
- src,
75
- },
76
- undefined,
77
- 2,
78
- )}
79
- </pre>
80
- </div>
81
- </div>
82
- )}
83
- </>
84
- );
85
- };
@@ -1,5 +0,0 @@
1
- //
2
- // Copyright 2023 DXOS.org
3
- //
4
-
5
- export * from './FramePanel';
@@ -1,5 +0,0 @@
1
- //
2
- // Copyright 2025 DXOS.org
3
- //
4
-
5
- export { NotebookContainer as default } from './NotebookContainer';
@@ -1,5 +0,0 @@
1
- //
2
- // Copyright 2023 DXOS.org
3
- //
4
-
5
- export { ScriptContainer as default } from './ScriptContainer';
@@ -1,37 +0,0 @@
1
- //
2
- // Copyright 2025 DXOS.org
3
- //
4
-
5
- import * as Effect from 'effect/Effect';
6
- import * as Predicate from 'effect/Predicate';
7
-
8
- import { LayoutOperation } from '@dxos/app-toolkit';
9
- import { Operation } from '@dxos/compute';
10
- import { IntegrationOperation } from '@dxos/plugin-integration';
11
-
12
- import { defaultScriptsForIntegration } from '#meta';
13
-
14
- import { DEPLOYMENT_DIALOG } from '../constants';
15
- import { templates } from '../templates';
16
-
17
- const handler: Operation.WithHandler<typeof IntegrationOperation.AccessTokenCreated> =
18
- IntegrationOperation.AccessTokenCreated.pipe(
19
- Operation.withHandler(
20
- Effect.fnUntraced(function* ({ accessToken }) {
21
- const scriptTemplates = (defaultScriptsForIntegration[accessToken.source] ?? [])
22
- .map((id) => templates.find((t) => t.id === id))
23
- .filter(Predicate.isNotNullable);
24
-
25
- if (scriptTemplates.length > 0) {
26
- yield* Operation.invoke(LayoutOperation.UpdateDialog, {
27
- subject: DEPLOYMENT_DIALOG,
28
- blockAlign: 'start',
29
- state: true,
30
- props: { accessToken, scriptTemplates },
31
- });
32
- }
33
- }),
34
- ),
35
- );
36
-
37
- export default handler;