@dxos/plugin-script 0.8.4-main.c85a9c8dae → 0.8.4-main.d9fc60f731
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.
- package/LICENSE +102 -5
- package/PLUGIN.mdl +515 -0
- package/dist/lib/{browser/DeploymentDialog-IIOXAS47.mjs → neutral/DeploymentDialog-M3AFYQHC.mjs} +24 -48
- package/dist/lib/neutral/DeploymentDialog-M3AFYQHC.mjs.map +7 -0
- package/dist/lib/{browser/NotebookContainer-VVZOKGRC.mjs → neutral/NotebookArticle-NV4AHOOS.mjs} +58 -145
- package/dist/lib/neutral/NotebookArticle-NV4AHOOS.mjs.map +7 -0
- package/dist/lib/{browser/ScriptContainer-A5SSIUH6.mjs → neutral/ScriptArticle-UBT27SB6.mjs} +14 -28
- package/dist/lib/neutral/ScriptArticle-UBT27SB6.mjs.map +7 -0
- package/dist/lib/neutral/ScriptPlugin.mjs +51 -0
- package/dist/lib/neutral/ScriptPlugin.mjs.map +7 -0
- package/dist/lib/neutral/ScriptPlugin.node.mjs +27 -0
- package/dist/lib/neutral/ScriptPlugin.node.mjs.map +7 -0
- package/dist/lib/neutral/ScriptPlugin.workerd.mjs +21 -0
- package/dist/lib/neutral/ScriptPlugin.workerd.mjs.map +7 -0
- package/dist/lib/neutral/ScriptPluginSettings-T4JMUSHN.mjs +31 -0
- package/dist/lib/neutral/ScriptPluginSettings-T4JMUSHN.mjs.map +7 -0
- package/dist/lib/neutral/ScriptProperties-RLXNAN3N.mjs +297 -0
- package/dist/lib/neutral/ScriptProperties-RLXNAN3N.mjs.map +7 -0
- package/dist/lib/neutral/TestContainer-AFVTBYSJ.mjs +44 -0
- package/dist/lib/neutral/TestContainer-AFVTBYSJ.mjs.map +7 -0
- package/dist/lib/neutral/app-graph-builder-7AWFCEQF.mjs +52 -0
- package/dist/lib/neutral/app-graph-builder-7AWFCEQF.mjs.map +7 -0
- package/dist/lib/{browser/blueprint-definition-YMZEJBAZ.mjs → neutral/blueprint-definition-T33SBPP2.mjs} +4 -6
- package/dist/lib/neutral/blueprint-definition-T33SBPP2.mjs.map +7 -0
- package/dist/lib/{browser → neutral}/blueprints/index.mjs +3 -1
- package/dist/lib/neutral/capabilities/index.mjs +21 -0
- package/dist/lib/neutral/capabilities/index.mjs.map +7 -0
- package/dist/lib/neutral/capabilities/node.mjs +17 -0
- package/dist/lib/neutral/capabilities/node.mjs.map +7 -0
- package/dist/lib/{node-esm/chunk-JGN7TDJH.mjs → neutral/chunk-2REUEDUA.mjs} +10 -23
- package/dist/lib/neutral/chunk-2REUEDUA.mjs.map +7 -0
- package/dist/lib/neutral/chunk-BDHDBPVM.mjs +52 -0
- package/dist/lib/neutral/chunk-BDHDBPVM.mjs.map +7 -0
- package/dist/lib/neutral/chunk-C4O7EV6M.mjs +123 -0
- package/dist/lib/neutral/chunk-C4O7EV6M.mjs.map +7 -0
- package/dist/lib/neutral/chunk-H2BRWQMY.mjs +96 -0
- package/dist/lib/neutral/chunk-H2BRWQMY.mjs.map +7 -0
- package/dist/lib/neutral/chunk-LHEJXJEL.mjs +8 -0
- package/dist/lib/neutral/chunk-LHEJXJEL.mjs.map +7 -0
- package/dist/lib/neutral/chunk-NQOIENTU.mjs +8 -0
- package/dist/lib/neutral/chunk-NQOIENTU.mjs.map +7 -0
- package/dist/lib/neutral/chunk-TRKXIP2Q.mjs +345 -0
- package/dist/lib/neutral/chunk-TRKXIP2Q.mjs.map +7 -0
- package/dist/lib/neutral/chunk-UA3BWOCZ.mjs +38 -0
- package/dist/lib/neutral/chunk-UA3BWOCZ.mjs.map +7 -0
- package/dist/lib/{browser/chunk-G3XIOLLI.mjs → neutral/chunk-VXDJH6OL.mjs} +24 -48
- package/dist/lib/neutral/chunk-VXDJH6OL.mjs.map +7 -0
- package/dist/lib/{browser/compiler-53G6ZHQM.mjs → neutral/compiler-ODK4UA2N.mjs} +24 -22
- package/dist/lib/neutral/compiler-ODK4UA2N.mjs.map +7 -0
- package/dist/lib/neutral/components/index.mjs +664 -0
- package/dist/lib/neutral/components/index.mjs.map +7 -0
- package/dist/lib/neutral/containers/index.mjs +17 -0
- package/dist/lib/neutral/containers/index.mjs.map +7 -0
- package/dist/lib/neutral/create-WQJXMOUE.mjs +46 -0
- package/dist/lib/neutral/create-WQJXMOUE.mjs.map +7 -0
- package/dist/lib/neutral/create-object-FZM5ASWM.mjs +45 -0
- package/dist/lib/neutral/create-object-FZM5ASWM.mjs.map +7 -0
- package/dist/lib/neutral/create-script-66DO3UJO.mjs +45 -0
- package/dist/lib/neutral/create-script-66DO3UJO.mjs.map +7 -0
- package/dist/lib/neutral/delete-HCQIQFVP.mjs +21 -0
- package/dist/lib/neutral/delete-HCQIQFVP.mjs.map +7 -0
- package/dist/lib/neutral/deploy-7JVMMHSH.mjs +63 -0
- package/dist/lib/neutral/deploy-7JVMMHSH.mjs.map +7 -0
- package/dist/lib/{browser/chunk-MUEVLYXJ.mjs → neutral/hooks/index.mjs} +52 -80
- package/dist/lib/neutral/hooks/index.mjs.map +7 -0
- package/dist/lib/neutral/index.mjs +41 -0
- package/dist/lib/neutral/inspect-invocations-6MW73SDV.mjs +59 -0
- package/dist/lib/neutral/inspect-invocations-6MW73SDV.mjs.map +7 -0
- package/dist/lib/neutral/install-function-FJIE2JAI.mjs +49 -0
- package/dist/lib/neutral/install-function-FJIE2JAI.mjs.map +7 -0
- package/dist/lib/neutral/invoke-3HVWY2KF.mjs +32 -0
- package/dist/lib/neutral/invoke-3HVWY2KF.mjs.map +7 -0
- package/dist/lib/neutral/meta.json +1 -0
- package/dist/lib/neutral/meta.mjs +10 -0
- package/dist/lib/neutral/operation-handler-X44IGZXS.mjs +18 -0
- package/dist/lib/neutral/operation-handler-X44IGZXS.mjs.map +7 -0
- package/dist/lib/neutral/operations/index.mjs +8 -0
- package/dist/lib/neutral/plugin.mjs +16 -0
- package/dist/lib/neutral/plugin.mjs.map +7 -0
- package/dist/lib/neutral/query-deployed-functions-F4FHJNWO.mjs +34 -0
- package/dist/lib/neutral/query-deployed-functions-F4FHJNWO.mjs.map +7 -0
- package/dist/lib/neutral/react-surface-ACNZ35FV.mjs +121 -0
- package/dist/lib/neutral/react-surface-ACNZ35FV.mjs.map +7 -0
- package/dist/lib/neutral/read-RQESBAQI.mjs +26 -0
- package/dist/lib/neutral/read-RQESBAQI.mjs.map +7 -0
- package/dist/lib/{browser/settings-76UM7442.mjs → neutral/settings-VJBW4OMK.mjs} +6 -12
- package/dist/lib/neutral/settings-VJBW4OMK.mjs.map +7 -0
- package/dist/lib/{browser → neutral}/templates/index.mjs +1 -1
- package/dist/lib/neutral/translations.mjs +105 -0
- package/dist/lib/neutral/translations.mjs.map +7 -0
- package/dist/lib/neutral/types/index.mjs +17 -0
- package/dist/lib/neutral/update-JZUNJYZM.mjs +63 -0
- package/dist/lib/neutral/update-JZUNJYZM.mjs.map +7 -0
- package/dist/types/src/ScriptPlugin.d.ts +1 -0
- package/dist/types/src/ScriptPlugin.d.ts.map +1 -1
- package/dist/types/src/ScriptPlugin.node.d.ts +4 -0
- package/dist/types/src/ScriptPlugin.node.d.ts.map +1 -0
- package/dist/types/src/ScriptPlugin.test.d.ts +2 -0
- package/dist/types/src/ScriptPlugin.test.d.ts.map +1 -0
- package/dist/types/src/ScriptPlugin.workerd.d.ts +4 -0
- package/dist/types/src/ScriptPlugin.workerd.d.ts.map +1 -0
- package/dist/types/src/blueprints/functions/create.d.ts +11 -0
- package/dist/types/src/blueprints/functions/create.d.ts.map +1 -0
- package/dist/types/src/blueprints/functions/definitions.d.ts +135 -0
- package/dist/types/src/blueprints/functions/definitions.d.ts.map +1 -0
- package/dist/types/src/blueprints/functions/delete.d.ts +17 -0
- package/dist/types/src/blueprints/functions/delete.d.ts.map +1 -0
- package/dist/types/src/blueprints/functions/deploy.d.ts +21 -0
- package/dist/types/src/blueprints/functions/deploy.d.ts.map +1 -0
- package/dist/types/src/blueprints/functions/index.d.ts +4 -0
- package/dist/types/src/blueprints/functions/index.d.ts.map +1 -0
- package/dist/types/src/blueprints/functions/inspect-invocations.d.ts +28 -0
- package/dist/types/src/blueprints/functions/inspect-invocations.d.ts.map +1 -0
- package/dist/types/src/blueprints/functions/install-function.d.ts +11 -0
- package/dist/types/src/blueprints/functions/install-function.d.ts.map +1 -0
- package/dist/types/src/blueprints/functions/invoke.d.ts +21 -0
- package/dist/types/src/blueprints/functions/invoke.d.ts.map +1 -0
- package/dist/types/src/blueprints/functions/query-deployed-functions.d.ts +13 -0
- package/dist/types/src/blueprints/functions/query-deployed-functions.d.ts.map +1 -0
- package/dist/types/src/blueprints/functions/read.d.ts +21 -0
- package/dist/types/src/blueprints/functions/read.d.ts.map +1 -0
- package/dist/types/src/blueprints/functions/update.d.ts +26 -0
- package/dist/types/src/blueprints/functions/update.d.ts.map +1 -0
- package/dist/types/src/blueprints/script-blueprint.d.ts +2 -2
- package/dist/types/src/blueprints/script-blueprint.d.ts.map +1 -1
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -0
- package/dist/types/src/capabilities/blueprint-definition.d.ts +6 -0
- package/dist/types/src/capabilities/blueprint-definition.d.ts.map +1 -0
- package/dist/types/src/capabilities/compiler.d.ts +6 -0
- package/dist/types/src/capabilities/compiler.d.ts.map +1 -0
- package/dist/types/src/capabilities/create-object.d.ts +16 -0
- package/dist/types/src/capabilities/create-object.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +19 -6
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/node.d.ts +18 -0
- package/dist/types/src/capabilities/node.d.ts.map +1 -0
- package/dist/types/src/capabilities/operation-handler.d.ts +6 -0
- package/dist/types/src/capabilities/operation-handler.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -0
- package/dist/types/src/capabilities/{settings/settings.d.ts → settings.d.ts} +2 -5
- package/dist/types/src/capabilities/settings.d.ts.map +1 -0
- package/dist/types/src/compiler/compiler.d.ts.map +1 -1
- package/dist/types/src/components/NotebookStack/NotebookCell.d.ts +1 -1
- package/dist/types/src/components/NotebookStack/NotebookCell.d.ts.map +1 -1
- package/dist/types/src/components/NotebookStack/NotebookMenu.d.ts +1 -1
- package/dist/types/src/components/NotebookStack/NotebookMenu.d.ts.map +1 -1
- package/dist/types/src/components/NotebookStack/NotebookStack.d.ts +4 -2
- package/dist/types/src/components/NotebookStack/NotebookStack.d.ts.map +1 -1
- package/dist/types/src/components/NotebookStack/NotebookStack.stories.d.ts +219 -228
- package/dist/types/src/components/NotebookStack/NotebookStack.stories.d.ts.map +1 -1
- package/dist/types/src/components/QueryEditor/QueryEditor.d.ts.map +1 -1
- package/dist/types/src/components/QueryEditor/QueryEditor.stories.d.ts.map +1 -1
- package/dist/types/src/components/ScriptPluginSettings/ScriptPluginSettings.d.ts +8 -0
- package/dist/types/src/components/ScriptPluginSettings/ScriptPluginSettings.d.ts.map +1 -0
- package/dist/types/src/components/ScriptPluginSettings/ScriptPluginSettings.stories.d.ts +241 -0
- package/dist/types/src/components/ScriptPluginSettings/ScriptPluginSettings.stories.d.ts.map +1 -0
- package/dist/types/src/components/ScriptPluginSettings/index.d.ts +2 -0
- package/dist/types/src/components/ScriptPluginSettings/index.d.ts.map +1 -0
- package/dist/types/src/components/ScriptToolbar/ScriptToolbar.d.ts +7 -6
- package/dist/types/src/components/ScriptToolbar/ScriptToolbar.d.ts.map +1 -1
- package/dist/types/src/components/ScriptToolbar/ScriptToolbar.stories.d.ts +219 -228
- package/dist/types/src/components/ScriptToolbar/ScriptToolbar.stories.d.ts.map +1 -1
- package/dist/types/src/components/TestPanel/TestPanel.d.ts +4 -2
- package/dist/types/src/components/TestPanel/TestPanel.d.ts.map +1 -1
- package/dist/types/src/components/TypescriptEditor/TypescriptEditor.d.ts +5 -2
- package/dist/types/src/components/TypescriptEditor/TypescriptEditor.d.ts.map +1 -1
- package/dist/types/src/components/TypescriptEditor/TypescriptEditor.stories.d.ts +3 -1
- package/dist/types/src/components/TypescriptEditor/TypescriptEditor.stories.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +2 -1
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/constants.d.ts +2 -1
- package/dist/types/src/constants.d.ts.map +1 -1
- package/dist/types/src/containers/DeploymentDialog/DeploymentDialog.d.ts.map +1 -1
- package/dist/types/src/containers/DeploymentDialog/DeploymentDialog.stories.d.ts +219 -228
- package/dist/types/src/containers/DeploymentDialog/DeploymentDialog.stories.d.ts.map +1 -1
- package/dist/types/src/containers/DeploymentDialog/index.d.ts +1 -2
- package/dist/types/src/containers/DeploymentDialog/index.d.ts.map +1 -1
- package/dist/types/src/containers/NotebookArticle/NotebookArticle.d.ts +7 -0
- package/dist/types/src/containers/NotebookArticle/NotebookArticle.d.ts.map +1 -0
- package/dist/types/src/containers/NotebookArticle/NotebookArticle.stories.d.ts +7 -0
- package/dist/types/src/containers/NotebookArticle/NotebookArticle.stories.d.ts.map +1 -0
- package/dist/types/src/containers/NotebookArticle/index.d.ts +2 -0
- package/dist/types/src/containers/NotebookArticle/index.d.ts.map +1 -0
- package/dist/types/src/containers/ScriptArticle/ScriptArticle.d.ts +10 -0
- package/dist/types/src/containers/ScriptArticle/ScriptArticle.d.ts.map +1 -0
- package/dist/types/src/containers/ScriptArticle/ScriptArticle.stories.d.ts +242 -0
- package/dist/types/src/containers/ScriptArticle/ScriptArticle.stories.d.ts.map +1 -0
- package/dist/types/src/containers/ScriptArticle/index.d.ts +2 -0
- package/dist/types/src/containers/ScriptArticle/index.d.ts.map +1 -0
- package/dist/types/src/containers/ScriptProperties/BlueprintEditor.d.ts +7 -0
- package/dist/types/src/containers/ScriptProperties/BlueprintEditor.d.ts.map +1 -0
- package/dist/types/src/containers/ScriptProperties/FunctionBinding.d.ts +7 -0
- package/dist/types/src/containers/ScriptProperties/FunctionBinding.d.ts.map +1 -0
- package/dist/types/src/containers/ScriptProperties/FunctionPublishing.d.ts +7 -0
- package/dist/types/src/containers/ScriptProperties/FunctionPublishing.d.ts.map +1 -0
- package/dist/types/src/containers/ScriptProperties/ScriptProperties.d.ts +4 -5
- package/dist/types/src/containers/ScriptProperties/ScriptProperties.d.ts.map +1 -1
- package/dist/types/src/containers/ScriptProperties/ScriptProperties.stories.d.ts +242 -0
- package/dist/types/src/containers/ScriptProperties/ScriptProperties.stories.d.ts.map +1 -0
- package/dist/types/src/containers/ScriptProperties/index.d.ts +1 -2
- package/dist/types/src/containers/ScriptProperties/index.d.ts.map +1 -1
- package/dist/types/src/containers/TestContainer/TestContainer.d.ts +1 -1
- package/dist/types/src/containers/TestContainer/TestContainer.d.ts.map +1 -1
- package/dist/types/src/containers/TestContainer/index.d.ts +1 -2
- package/dist/types/src/containers/TestContainer/index.d.ts.map +1 -1
- package/dist/types/src/containers/index.d.ts +2 -4
- package/dist/types/src/containers/index.d.ts.map +1 -1
- package/dist/types/src/hooks/deploy.d.ts +16 -5
- package/dist/types/src/hooks/deploy.d.ts.map +1 -1
- package/dist/types/src/hooks/format.d.ts +1 -1
- package/dist/types/src/hooks/format.d.ts.map +1 -1
- package/dist/types/src/hooks/template.d.ts +1 -1
- package/dist/types/src/hooks/template.d.ts.map +1 -1
- package/dist/types/src/hooks/useCompiler.d.ts.map +1 -1
- package/dist/types/src/hooks/useCreateAndDeployScriptTemplates.d.ts.map +1 -1
- package/dist/types/src/hooks/useToolbarState.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +2 -4
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +1 -1
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/notebook/compute-graph.d.ts +1 -1
- package/dist/types/src/notebook/compute-graph.d.ts.map +1 -1
- package/dist/types/src/notebook/eval.d.ts.map +1 -1
- package/dist/types/src/notebook/vfs-parser.d.ts.map +1 -1
- package/dist/types/src/operations/create-script.d.ts +5 -0
- package/dist/types/src/operations/create-script.d.ts.map +1 -0
- package/dist/types/src/operations/index.d.ts +3 -0
- package/dist/types/src/operations/index.d.ts.map +1 -0
- package/dist/types/src/plugin.d.ts +4 -0
- package/dist/types/src/plugin.d.ts.map +1 -0
- package/dist/types/src/templates/anthropic.d.ts +4 -5
- package/dist/types/src/templates/anthropic.d.ts.map +1 -1
- package/dist/types/src/templates/chess-bot.d.ts +8 -10
- package/dist/types/src/templates/chess-bot.d.ts.map +1 -1
- package/dist/types/src/templates/commentary.d.ts +9 -10
- package/dist/types/src/templates/commentary.d.ts.map +1 -1
- package/dist/types/src/templates/data-generator.d.ts.map +1 -1
- package/dist/types/src/templates/discord.d.ts.map +1 -1
- package/dist/types/src/templates/email.d.ts.map +1 -1
- package/dist/types/src/templates/forex-effect.d.ts +3 -2
- package/dist/types/src/templates/forex-effect.d.ts.map +1 -1
- package/dist/types/src/templates/forex.d.ts +3 -2
- package/dist/types/src/templates/forex.d.ts.map +1 -1
- package/dist/types/src/templates/gmail.d.ts.map +1 -1
- package/dist/types/src/templates/index.d.ts +26 -31
- package/dist/types/src/templates/index.d.ts.map +1 -1
- package/dist/types/src/templates/ping.d.ts +2 -1
- package/dist/types/src/templates/ping.d.ts.map +1 -1
- package/dist/types/src/testing/index.d.ts +2 -1
- package/dist/types/src/testing/index.d.ts.map +1 -1
- package/dist/types/src/testing/test-notebook.d.ts +3 -0
- package/dist/types/src/testing/test-notebook.d.ts.map +1 -0
- package/dist/types/src/testing/test-script.d.ts +7 -0
- package/dist/types/src/testing/test-script.d.ts.map +1 -0
- package/dist/types/src/translations.d.ts +222 -92
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/Notebook.d.ts +53 -60
- package/dist/types/src/types/Notebook.d.ts.map +1 -1
- package/dist/types/src/types/ScriptCapabilities.d.ts +6 -0
- package/dist/types/src/types/ScriptCapabilities.d.ts.map +1 -0
- package/dist/types/src/types/ScriptEvents.d.ts +3 -0
- package/dist/types/src/types/ScriptEvents.d.ts.map +1 -0
- package/dist/types/src/types/ScriptOperation.d.ts +29 -0
- package/dist/types/src/types/ScriptOperation.d.ts.map +1 -0
- package/dist/types/src/types/Settings.d.ts +7 -0
- package/dist/types/src/types/Settings.d.ts.map +1 -0
- package/dist/types/src/types/index.d.ts +4 -4
- package/dist/types/src/types/index.d.ts.map +1 -1
- package/dist/types/src/types/types.d.ts +1 -5
- package/dist/types/src/types/types.d.ts.map +1 -1
- package/dist/types/src/util/deploy.d.ts +2 -2
- package/dist/types/src/util/deploy.d.ts.map +1 -1
- package/dist/types/src/util/functions.d.ts +2 -2
- package/dist/types/src/util/functions.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +167 -118
- package/src/ScriptPlugin.node.ts +21 -0
- package/src/ScriptPlugin.test.ts +31 -0
- package/src/ScriptPlugin.tsx +17 -43
- package/src/ScriptPlugin.workerd.ts +18 -0
- package/src/blueprints/functions/create.ts +47 -0
- package/src/blueprints/functions/definitions.ts +332 -0
- package/src/blueprints/functions/delete.ts +23 -0
- package/src/blueprints/functions/deploy.ts +71 -0
- package/src/blueprints/functions/index.ts +19 -0
- package/src/blueprints/functions/inspect-invocations.ts +56 -0
- package/src/blueprints/functions/install-function.ts +56 -0
- package/src/blueprints/functions/invoke.ts +34 -0
- package/src/blueprints/functions/query-deployed-functions.ts +35 -0
- package/src/blueprints/functions/read.ts +29 -0
- package/src/blueprints/functions/update.ts +68 -0
- package/src/blueprints/script-blueprint.ts +32 -8
- package/src/capabilities/app-graph-builder.ts +47 -0
- package/src/capabilities/{blueprint-definition/blueprint-definition.ts → blueprint-definition.ts} +3 -1
- package/src/capabilities/{compiler/compiler.ts → compiler.ts} +17 -9
- package/src/capabilities/create-object.ts +49 -0
- package/src/capabilities/index.ts +14 -6
- package/src/capabilities/node.ts +16 -0
- package/src/capabilities/operation-handler.ts +21 -0
- package/src/capabilities/react-surface.tsx +130 -0
- package/src/capabilities/{settings/settings.ts → settings.ts} +4 -4
- package/src/compiler/compiler.ts +12 -1
- package/src/components/NotebookStack/NotebookCell.tsx +25 -14
- package/src/components/NotebookStack/NotebookMenu.tsx +7 -7
- package/src/components/NotebookStack/NotebookStack.stories.tsx +8 -9
- package/src/components/NotebookStack/NotebookStack.tsx +24 -13
- package/src/components/QueryEditor/QueryEditor.stories.tsx +5 -11
- package/src/components/QueryEditor/QueryEditor.tsx +3 -1
- package/src/components/ScriptPluginSettings/ScriptPluginSettings.stories.tsx +32 -0
- package/src/components/ScriptPluginSettings/ScriptPluginSettings.tsx +42 -0
- package/src/components/ScriptPluginSettings/index.ts +5 -0
- package/src/components/ScriptToolbar/ScriptToolbar.stories.tsx +7 -7
- package/src/components/ScriptToolbar/ScriptToolbar.tsx +24 -26
- package/src/components/TestPanel/TestPanel.tsx +91 -176
- package/src/components/TypescriptEditor/TypescriptEditor.stories.tsx +4 -4
- package/src/components/TypescriptEditor/TypescriptEditor.tsx +25 -18
- package/src/components/index.ts +4 -1
- package/src/constants.ts +4 -2
- package/src/containers/DeploymentDialog/DeploymentDialog.stories.tsx +7 -5
- package/src/containers/DeploymentDialog/DeploymentDialog.tsx +26 -26
- package/src/containers/DeploymentDialog/index.ts +1 -3
- package/src/containers/NotebookArticle/NotebookArticle.stories.tsx +85 -0
- package/src/containers/{NotebookContainer/NotebookContainer.tsx → NotebookArticle/NotebookArticle.tsx} +43 -56
- package/src/containers/NotebookArticle/index.ts +5 -0
- package/src/containers/ScriptArticle/ScriptArticle.stories.tsx +107 -0
- package/src/containers/{ScriptContainer/ScriptContainer.tsx → ScriptArticle/ScriptArticle.tsx} +15 -14
- package/src/containers/ScriptArticle/index.ts +5 -0
- package/src/containers/ScriptProperties/BlueprintEditor.tsx +102 -0
- package/src/containers/ScriptProperties/FunctionBinding.tsx +83 -0
- package/src/containers/ScriptProperties/FunctionPublishing.tsx +121 -0
- package/src/containers/ScriptProperties/ScriptProperties.stories.tsx +76 -0
- package/src/containers/ScriptProperties/ScriptProperties.tsx +12 -21
- package/src/containers/ScriptProperties/index.ts +1 -3
- package/src/containers/TestContainer/TestContainer.tsx +24 -8
- package/src/containers/TestContainer/index.ts +1 -3
- package/src/containers/index.ts +2 -4
- package/src/e2e/ai.test.ts +7 -6
- package/src/e2e/deploy.test.ts +6 -4
- package/src/hooks/deploy.ts +10 -8
- package/src/hooks/format.ts +5 -5
- package/src/hooks/template.ts +7 -6
- package/src/hooks/useCompiler.ts +3 -2
- package/src/hooks/useCreateAndDeployScriptTemplates.ts +4 -3
- package/src/index.ts +2 -5
- package/src/meta.ts +13 -7
- package/src/notebook/compute-graph.test.ts +7 -7
- package/src/notebook/compute-graph.ts +1 -1
- package/src/notebook/vfs-parser.ts +10 -3
- package/src/operations/create-script.ts +46 -0
- package/src/operations/index.ts +7 -0
- package/src/plugin.ts +11 -0
- package/src/templates/anthropic.ts +20 -12
- package/src/templates/chess-bot.ts +42 -37
- package/src/templates/commentary.ts +185 -165
- package/src/templates/data-generator.ts +2 -2
- package/src/templates/discord.ts +8 -8
- package/src/templates/forex-effect.ts +31 -19
- package/src/templates/forex.ts +25 -15
- package/src/templates/gmail.ts +9 -9
- package/src/templates/index.ts +16 -23
- package/src/templates/ping.ts +17 -8
- package/src/testing/index.ts +2 -1
- package/src/testing/simulator.test.ts +3 -4
- package/src/testing/{data.ts → test-notebook.ts} +12 -13
- package/src/testing/test-script.ts +28 -0
- package/src/translations.ts +89 -89
- package/src/types/Notebook.ts +8 -10
- package/src/types/ScriptCapabilities.ts +18 -0
- package/src/types/ScriptEvents.ts +11 -0
- package/src/types/ScriptOperation.ts +42 -0
- package/src/types/Settings.ts +20 -0
- package/src/types/index.ts +5 -4
- package/src/types/types.ts +1 -11
- package/src/util/deploy.ts +14 -12
- package/src/util/functions.ts +12 -11
- package/src/vite-env.d.ts +5 -0
- package/dist/lib/browser/DeploymentDialog-IIOXAS47.mjs.map +0 -7
- package/dist/lib/browser/NotebookContainer-VVZOKGRC.mjs.map +0 -7
- package/dist/lib/browser/ScriptContainer-A5SSIUH6.mjs.map +0 -7
- package/dist/lib/browser/ScriptObjectSettings-HYYC7KXC.mjs +0 -294
- package/dist/lib/browser/ScriptObjectSettings-HYYC7KXC.mjs.map +0 -7
- package/dist/lib/browser/ScriptPluginSettings-UTWA7CBT.mjs +0 -55
- package/dist/lib/browser/ScriptPluginSettings-UTWA7CBT.mjs.map +0 -7
- package/dist/lib/browser/ScriptProperties-HREPUE65.mjs +0 -28
- package/dist/lib/browser/ScriptProperties-HREPUE65.mjs.map +0 -7
- package/dist/lib/browser/TestContainer-D4Y2K2TT.mjs +0 -39
- package/dist/lib/browser/TestContainer-D4Y2K2TT.mjs.map +0 -7
- package/dist/lib/browser/app-graph-builder-66ZDI72K.mjs +0 -69
- package/dist/lib/browser/app-graph-builder-66ZDI72K.mjs.map +0 -7
- package/dist/lib/browser/blueprint-definition-YMZEJBAZ.mjs.map +0 -7
- package/dist/lib/browser/chunk-6IXFDTAI.mjs +0 -113
- package/dist/lib/browser/chunk-6IXFDTAI.mjs.map +0 -7
- package/dist/lib/browser/chunk-ATTZUDT7.mjs +0 -67
- package/dist/lib/browser/chunk-ATTZUDT7.mjs.map +0 -7
- package/dist/lib/browser/chunk-G3XIOLLI.mjs.map +0 -7
- package/dist/lib/browser/chunk-J7PGML5B.mjs +0 -105
- package/dist/lib/browser/chunk-J7PGML5B.mjs.map +0 -7
- package/dist/lib/browser/chunk-MUEVLYXJ.mjs.map +0 -7
- package/dist/lib/browser/chunk-PLDBKKYO.mjs +0 -789
- package/dist/lib/browser/chunk-PLDBKKYO.mjs.map +0 -7
- package/dist/lib/browser/chunk-Q66L5EUR.mjs +0 -20
- package/dist/lib/browser/chunk-Q66L5EUR.mjs.map +0 -7
- package/dist/lib/browser/chunk-TW27W3EL.mjs +0 -29
- package/dist/lib/browser/chunk-TW27W3EL.mjs.map +0 -7
- package/dist/lib/browser/chunk-WYR4QHPE.mjs +0 -31
- package/dist/lib/browser/chunk-WYR4QHPE.mjs.map +0 -7
- package/dist/lib/browser/chunk-ZYU2LP6U.mjs +0 -11
- package/dist/lib/browser/chunk-ZYU2LP6U.mjs.map +0 -7
- package/dist/lib/browser/compiler-53G6ZHQM.mjs.map +0 -7
- package/dist/lib/browser/index.mjs +0 -250
- package/dist/lib/browser/index.mjs.map +0 -7
- package/dist/lib/browser/meta.json +0 -1
- package/dist/lib/browser/operation-resolver-CYEISDDK.mjs +0 -79
- package/dist/lib/browser/operation-resolver-CYEISDDK.mjs.map +0 -7
- package/dist/lib/browser/react-surface-26P6HAFD.mjs +0 -141
- package/dist/lib/browser/react-surface-26P6HAFD.mjs.map +0 -7
- package/dist/lib/browser/settings-76UM7442.mjs.map +0 -7
- package/dist/lib/browser/types/index.mjs +0 -18
- package/dist/lib/node-esm/DeploymentDialog-ZHPHEV2H.mjs +0 -139
- package/dist/lib/node-esm/DeploymentDialog-ZHPHEV2H.mjs.map +0 -7
- package/dist/lib/node-esm/NotebookContainer-ZLWTNMQA.mjs +0 -851
- package/dist/lib/node-esm/NotebookContainer-ZLWTNMQA.mjs.map +0 -7
- package/dist/lib/node-esm/ScriptContainer-S4UKQAWP.mjs +0 -94
- package/dist/lib/node-esm/ScriptContainer-S4UKQAWP.mjs.map +0 -7
- package/dist/lib/node-esm/ScriptObjectSettings-C5QBRERY.mjs +0 -295
- package/dist/lib/node-esm/ScriptObjectSettings-C5QBRERY.mjs.map +0 -7
- package/dist/lib/node-esm/ScriptPluginSettings-MFACDW4R.mjs +0 -56
- package/dist/lib/node-esm/ScriptPluginSettings-MFACDW4R.mjs.map +0 -7
- package/dist/lib/node-esm/ScriptProperties-FMNIX3KU.mjs +0 -29
- package/dist/lib/node-esm/ScriptProperties-FMNIX3KU.mjs.map +0 -7
- package/dist/lib/node-esm/TestContainer-AO45YPGV.mjs +0 -40
- package/dist/lib/node-esm/TestContainer-AO45YPGV.mjs.map +0 -7
- package/dist/lib/node-esm/app-graph-builder-IGAZTJ45.mjs +0 -70
- package/dist/lib/node-esm/app-graph-builder-IGAZTJ45.mjs.map +0 -7
- package/dist/lib/node-esm/blueprint-definition-5MGY6BRQ.mjs +0 -18
- package/dist/lib/node-esm/blueprint-definition-5MGY6BRQ.mjs.map +0 -7
- package/dist/lib/node-esm/blueprints/index.mjs +0 -9
- package/dist/lib/node-esm/chunk-5BG7OJGQ.mjs +0 -176
- package/dist/lib/node-esm/chunk-5BG7OJGQ.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-5HSJPAK7.mjs +0 -33
- package/dist/lib/node-esm/chunk-5HSJPAK7.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-H46R2RS5.mjs +0 -790
- package/dist/lib/node-esm/chunk-H46R2RS5.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-HSLMI22Q.mjs +0 -11
- package/dist/lib/node-esm/chunk-HSLMI22Q.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-JGN7TDJH.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-QG6ANK4B.mjs +0 -107
- package/dist/lib/node-esm/chunk-QG6ANK4B.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-S7DSCLOW.mjs +0 -31
- package/dist/lib/node-esm/chunk-S7DSCLOW.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-TZ2EBTPQ.mjs +0 -22
- package/dist/lib/node-esm/chunk-TZ2EBTPQ.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-UFBVE33O.mjs +0 -12
- package/dist/lib/node-esm/chunk-UFBVE33O.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-WWD5LUU6.mjs +0 -114
- package/dist/lib/node-esm/chunk-WWD5LUU6.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-ZDJ2FI7E.mjs +0 -398
- package/dist/lib/node-esm/chunk-ZDJ2FI7E.mjs.map +0 -7
- package/dist/lib/node-esm/compiler-HHQW7EP3.mjs +0 -100
- package/dist/lib/node-esm/compiler-HHQW7EP3.mjs.map +0 -7
- package/dist/lib/node-esm/index.mjs +0 -251
- package/dist/lib/node-esm/index.mjs.map +0 -7
- package/dist/lib/node-esm/meta.json +0 -1
- package/dist/lib/node-esm/operation-resolver-HFFDXWND.mjs +0 -80
- package/dist/lib/node-esm/operation-resolver-HFFDXWND.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-THCIK266.mjs +0 -142
- package/dist/lib/node-esm/react-surface-THCIK266.mjs.map +0 -7
- package/dist/lib/node-esm/settings-CCHDPLFJ.mjs +0 -37
- package/dist/lib/node-esm/settings-CCHDPLFJ.mjs.map +0 -7
- package/dist/lib/node-esm/templates/index.mjs +0 -11
- package/dist/lib/node-esm/types/index.mjs +0 -19
- package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts.map +0 -1
- package/dist/types/src/capabilities/app-graph-builder/index.d.ts +0 -3
- package/dist/types/src/capabilities/app-graph-builder/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/artifact-definition/artifact-definition.d.ts +0 -12
- package/dist/types/src/capabilities/artifact-definition/artifact-definition.d.ts.map +0 -1
- package/dist/types/src/capabilities/artifact-definition/index.d.ts +0 -3
- package/dist/types/src/capabilities/artifact-definition/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/blueprint-definition/blueprint-definition.d.ts +0 -6
- package/dist/types/src/capabilities/blueprint-definition/blueprint-definition.d.ts.map +0 -1
- package/dist/types/src/capabilities/blueprint-definition/index.d.ts +0 -3
- package/dist/types/src/capabilities/blueprint-definition/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/compiler/compiler.d.ts +0 -6
- package/dist/types/src/capabilities/compiler/compiler.d.ts.map +0 -1
- package/dist/types/src/capabilities/compiler/index.d.ts +0 -3
- package/dist/types/src/capabilities/compiler/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/operation-resolver/index.d.ts +0 -3
- package/dist/types/src/capabilities/operation-resolver/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts +0 -5
- package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts.map +0 -1
- package/dist/types/src/capabilities/react-surface/index.d.ts +0 -3
- package/dist/types/src/capabilities/react-surface/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +0 -1
- package/dist/types/src/capabilities/settings/index.d.ts +0 -7
- package/dist/types/src/capabilities/settings/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/settings/settings.d.ts.map +0 -1
- package/dist/types/src/components/FrameContainer/FrameContainer.d.ts +0 -12
- package/dist/types/src/components/FrameContainer/FrameContainer.d.ts.map +0 -1
- package/dist/types/src/components/FrameContainer/frame.d.ts +0 -2
- package/dist/types/src/components/FrameContainer/frame.d.ts.map +0 -1
- package/dist/types/src/components/FrameContainer/index.d.ts +0 -2
- package/dist/types/src/components/FrameContainer/index.d.ts.map +0 -1
- package/dist/types/src/containers/NotebookContainer/NotebookContainer.d.ts +0 -7
- package/dist/types/src/containers/NotebookContainer/NotebookContainer.d.ts.map +0 -1
- package/dist/types/src/containers/NotebookContainer/NotebookContainer.stories.d.ts +0 -7
- package/dist/types/src/containers/NotebookContainer/NotebookContainer.stories.d.ts.map +0 -1
- package/dist/types/src/containers/NotebookContainer/index.d.ts +0 -3
- package/dist/types/src/containers/NotebookContainer/index.d.ts.map +0 -1
- package/dist/types/src/containers/ScriptContainer/ScriptContainer.d.ts +0 -10
- package/dist/types/src/containers/ScriptContainer/ScriptContainer.d.ts.map +0 -1
- package/dist/types/src/containers/ScriptContainer/index.d.ts +0 -3
- package/dist/types/src/containers/ScriptContainer/index.d.ts.map +0 -1
- package/dist/types/src/containers/ScriptObjectSettings/ScriptObjectSettings.d.ts +0 -7
- package/dist/types/src/containers/ScriptObjectSettings/ScriptObjectSettings.d.ts.map +0 -1
- package/dist/types/src/containers/ScriptObjectSettings/index.d.ts +0 -3
- package/dist/types/src/containers/ScriptObjectSettings/index.d.ts.map +0 -1
- package/dist/types/src/containers/ScriptPluginSettings/ScriptPluginSettings.d.ts +0 -8
- package/dist/types/src/containers/ScriptPluginSettings/ScriptPluginSettings.d.ts.map +0 -1
- package/dist/types/src/containers/ScriptPluginSettings/index.d.ts +0 -3
- package/dist/types/src/containers/ScriptPluginSettings/index.d.ts.map +0 -1
- package/dist/types/src/templates/chat.d.ts +0 -6
- package/dist/types/src/templates/chat.d.ts.map +0 -1
- package/dist/types/src/testing/data.d.ts +0 -3
- package/dist/types/src/testing/data.d.ts.map +0 -1
- package/dist/types/src/types/actions.d.ts +0 -40
- package/dist/types/src/types/actions.d.ts.map +0 -1
- package/dist/types/src/types/capabilities.d.ts +0 -12
- package/dist/types/src/types/capabilities.d.ts.map +0 -1
- package/dist/types/src/types/events.d.ts +0 -5
- package/dist/types/src/types/events.d.ts.map +0 -1
- package/src/capabilities/app-graph-builder/app-graph-builder.ts +0 -56
- package/src/capabilities/app-graph-builder/index.ts +0 -7
- package/src/capabilities/artifact-definition/artifact-definition.ts +0 -227
- package/src/capabilities/artifact-definition/index.ts +0 -7
- package/src/capabilities/blueprint-definition/index.ts +0 -7
- package/src/capabilities/compiler/index.ts +0 -7
- package/src/capabilities/operation-resolver/index.ts +0 -7
- package/src/capabilities/operation-resolver/operation-resolver.ts +0 -75
- package/src/capabilities/react-surface/index.ts +0 -7
- package/src/capabilities/react-surface/react-surface.tsx +0 -121
- package/src/capabilities/settings/index.ts +0 -7
- package/src/components/FrameContainer/FrameContainer.tsx +0 -85
- package/src/components/FrameContainer/frame.html +0 -25
- package/src/components/FrameContainer/frame.tsx +0 -51
- package/src/components/FrameContainer/index.ts +0 -5
- package/src/containers/NotebookContainer/NotebookContainer.stories.tsx +0 -87
- package/src/containers/NotebookContainer/index.ts +0 -7
- package/src/containers/ScriptContainer/index.ts +0 -7
- package/src/containers/ScriptObjectSettings/ScriptObjectSettings.tsx +0 -291
- package/src/containers/ScriptObjectSettings/index.ts +0 -7
- package/src/containers/ScriptPluginSettings/ScriptPluginSettings.tsx +0 -66
- package/src/containers/ScriptPluginSettings/index.ts +0 -7
- package/src/templates/chat.ts +0 -96
- package/src/types/actions.ts +0 -45
- package/src/types/capabilities.ts +0 -17
- package/src/types/events.ts +0 -11
- /package/dist/lib/{browser → neutral}/blueprints/index.mjs.map +0 -0
- /package/dist/lib/{browser → neutral}/chunk-J5LGTIGS.mjs +0 -0
- /package/dist/lib/{browser → neutral}/chunk-J5LGTIGS.mjs.map +0 -0
- /package/dist/lib/{browser/templates → neutral}/index.mjs.map +0 -0
- /package/dist/lib/{browser/types/index.mjs.map → neutral/meta.mjs.map} +0 -0
- /package/dist/lib/{node-esm/blueprints → neutral/operations}/index.mjs.map +0 -0
- /package/dist/lib/{node-esm → neutral}/templates/index.mjs.map +0 -0
- /package/dist/lib/{node-esm → neutral}/types/index.mjs.map +0 -0
- /package/dist/types/src/capabilities/{app-graph-builder/app-graph-builder.d.ts → app-graph-builder.d.ts} +0 -0
- /package/dist/types/src/capabilities/{react-surface/react-surface.d.ts → react-surface.d.ts} +0 -0
|
@@ -1,227 +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 } from '@dxos/blueprints';
|
|
15
|
-
import { Filter, Obj, Ref } from '@dxos/echo';
|
|
16
|
-
import { ScriptType } from '@dxos/functions';
|
|
17
|
-
import { invariant } from '@dxos/invariant';
|
|
18
|
-
import { SpaceAction } from '@dxos/plugin-space/types';
|
|
19
|
-
import { type Space } from '@dxos/react-client/echo';
|
|
20
|
-
|
|
21
|
-
import { meta } from '../../meta';
|
|
22
|
-
|
|
23
|
-
// TODO(burdon): Factor out.
|
|
24
|
-
declare global {
|
|
25
|
-
interface ToolContextExtensions {
|
|
26
|
-
space?: Space;
|
|
27
|
-
dispatch?: PromiseIntentDispatcher;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export default Capability.makeModule(() =>
|
|
32
|
-
Effect.sync(() => {
|
|
33
|
-
const definition = defineArtifact({
|
|
34
|
-
id: `artifact:${meta.id}`,
|
|
35
|
-
name: meta.name,
|
|
36
|
-
// TODO(dmaretskyi): Since writing scripts requires a lot of domain knowledge,
|
|
37
|
-
// we should offload the work of synthesizing the code to a separate model.
|
|
38
|
-
// The main reasoning model will give it a concrete task and the script model will synthesize the code, knowing all the docs.
|
|
39
|
-
instructions: `
|
|
40
|
-
If the user explicitly requests you to write a script, you can create one.
|
|
41
|
-
If the user requests you to change one of the existing script, you can update it.
|
|
42
|
-
You must not create a script unless the user explicitly requests it.
|
|
43
|
-
Scripts are short code pieces of executable code that can be used to perform computations, integrate with external systems, and perform automated tasks.
|
|
44
|
-
Each script must follow as strict shape for the definition but the body can contain any valid executable code.
|
|
45
|
-
Scripts are written in JavaScript or TypeScript.
|
|
46
|
-
Each script must define an input schema and output schema.
|
|
47
|
-
Each script must have its own detailed description.
|
|
48
|
-
|
|
49
|
-
Important: You cannot execute scripts. Scripts are only available as tools after the user deploys them. You must only call the available tools.
|
|
50
|
-
|
|
51
|
-
Description:
|
|
52
|
-
The description is a detailed description of the script.
|
|
53
|
-
It is used to describe the script's purpose, input, and output.
|
|
54
|
-
The description is used to generate the script's documentation.
|
|
55
|
-
The description is also goes into the script metadata.
|
|
56
|
-
The description is used by AI to understand the script and its purpose.
|
|
57
|
-
The description must provide cases on when the script should be used.
|
|
58
|
-
|
|
59
|
-
Schema:
|
|
60
|
-
The schema is defined using a schema-DSL library called Effect Schema.
|
|
61
|
-
The input schema describes the arguments that the script accepts.
|
|
62
|
-
The output schema describes the result that the script produces.
|
|
63
|
-
The schema is used to validate the script's input and output.
|
|
64
|
-
The schema is also goes into the script metadata.
|
|
65
|
-
The properties in the schema must have valid descriptions.
|
|
66
|
-
The input and output schemas must both be a struct of fields.
|
|
67
|
-
|
|
68
|
-
Restricts:
|
|
69
|
-
The scripts can only import code from "dxos:functions" module. No other modules are allowed.
|
|
70
|
-
Some web APIs are available - like fetch.
|
|
71
|
-
|
|
72
|
-
Reasoning:
|
|
73
|
-
Before writing a script, synthesize the following information:
|
|
74
|
-
- Description
|
|
75
|
-
- What APIs will be used.
|
|
76
|
-
- Detailed input schema
|
|
77
|
-
- Detailed output schema
|
|
78
|
-
|
|
79
|
-
<apis>
|
|
80
|
-
export function defineFunction(params: {
|
|
81
|
-
description: string,
|
|
82
|
-
inputSchema: Schema.Schema,
|
|
83
|
-
outputSchema: Schema.Schema,
|
|
84
|
-
handler: (params: { event: { data: TInput } }) => Promise<TOutput>
|
|
85
|
-
}): FunctionDefinition
|
|
86
|
-
/**
|
|
87
|
-
* Effect Schema
|
|
88
|
-
*/
|
|
89
|
-
export const Schema;
|
|
90
|
-
|
|
91
|
-
// Examples:
|
|
92
|
-
|
|
93
|
-
Schema.String
|
|
94
|
-
Schema.Number
|
|
95
|
-
Schema.Boolean
|
|
96
|
-
Schema.Struct({
|
|
97
|
-
from: Schema.String.annotations({ description: 'The source currency' }),
|
|
98
|
-
to: Schema.String.annotations({ description: 'The target currency' }),
|
|
99
|
-
})
|
|
100
|
-
Schema.Array(Schema.String)
|
|
101
|
-
Schema.Union(Schema.String, Schema.Number)
|
|
102
|
-
Schema.optional(Schema.String)
|
|
103
|
-
Schema.String.annotations({ description: 'The source currency' })
|
|
104
|
-
</apis>
|
|
105
|
-
|
|
106
|
-
<handler_function>
|
|
107
|
-
Async function that takes the argument in the form of:
|
|
108
|
-
|
|
109
|
-
type HandlerFunctionProp = {
|
|
110
|
-
event: {
|
|
111
|
-
data: T // The input schema
|
|
112
|
-
},
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
The function must return the result that matches the output schema.
|
|
116
|
-
</handler_function>
|
|
117
|
-
|
|
118
|
-
<example>
|
|
119
|
-
import { defineFunction, S } from 'dxos:functions';
|
|
120
|
-
|
|
121
|
-
export default defineFunction({
|
|
122
|
-
description: 'Returns the exchange rate between two currencies.',
|
|
123
|
-
|
|
124
|
-
inputSchema: Schema.Struct({
|
|
125
|
-
from: Schema.String.annotations({ description: 'The source currency' }),
|
|
126
|
-
to: Schema.String.annotations({ description: 'The target currency' }),
|
|
127
|
-
}),
|
|
128
|
-
|
|
129
|
-
outputSchema: Schema.Struct({
|
|
130
|
-
rate: Schema.String.annotations({ description: 'The exchange rate' }),
|
|
131
|
-
}),
|
|
132
|
-
|
|
133
|
-
handler: async ({
|
|
134
|
-
event: {
|
|
135
|
-
data: { from, to },
|
|
136
|
-
},
|
|
137
|
-
}: any) => {
|
|
138
|
-
const res = await fetch(\`https://free.ratesdb.com/v1/rates?from=\${from}&to=\${to}\`);
|
|
139
|
-
const {
|
|
140
|
-
data: { rates },
|
|
141
|
-
} = await res.json();
|
|
142
|
-
|
|
143
|
-
return { rate: rates[to].toString() };
|
|
144
|
-
},
|
|
145
|
-
});
|
|
146
|
-
</example>
|
|
147
|
-
`,
|
|
148
|
-
schema: ScriptType,
|
|
149
|
-
tools: [
|
|
150
|
-
createTool(meta.id, {
|
|
151
|
-
name: 'create',
|
|
152
|
-
description: 'Create a new script. Returns the artifact definition for the script',
|
|
153
|
-
caption: 'Creating script...',
|
|
154
|
-
schema: Schema.Struct({
|
|
155
|
-
name: Schema.String.annotations({ description: 'The name of the script' }),
|
|
156
|
-
code: Schema.String.annotations({
|
|
157
|
-
description: 'The full code of the script in JavaScript or TypeScript. Must be valid executable code.',
|
|
158
|
-
}),
|
|
159
|
-
}),
|
|
160
|
-
execute: async ({ name, code }, { extensions }) => {
|
|
161
|
-
invariant(extensions?.space, 'No space');
|
|
162
|
-
invariant(extensions?.dispatch, 'No intent dispatcher');
|
|
163
|
-
const script = Obj.make(ScriptType, { name, source: Ref.make(Text.make(code)) });
|
|
164
|
-
extensions.space.db.add(script);
|
|
165
|
-
await extensions.space.db.flush();
|
|
166
|
-
|
|
167
|
-
const intent = createIntent(SpaceAction.AddObject, { target: extensions.space, object: script });
|
|
168
|
-
const { data, error } = await extensions.dispatch(intent);
|
|
169
|
-
if (!data || error) {
|
|
170
|
-
return ToolResult.Error(error?.message ?? 'Failed to create chess game');
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
return ToolResult.Success(createArtifactElement(script.id));
|
|
174
|
-
},
|
|
175
|
-
}),
|
|
176
|
-
createTool(meta.id, {
|
|
177
|
-
name: 'inspect',
|
|
178
|
-
description: 'Inspect a script. Returns the artifact definition for the script',
|
|
179
|
-
caption: 'Inspecting script...',
|
|
180
|
-
schema: Schema.Struct({
|
|
181
|
-
id: ArtifactId,
|
|
182
|
-
}),
|
|
183
|
-
execute: async ({ id }, { extensions }) => {
|
|
184
|
-
invariant(extensions?.space, 'No space');
|
|
185
|
-
|
|
186
|
-
const script = (await extensions.space.db.query(Filter.id(id)).first()) as ScriptType;
|
|
187
|
-
const { content } = await script.source.load();
|
|
188
|
-
|
|
189
|
-
return ToolResult.Success({
|
|
190
|
-
name: script.name,
|
|
191
|
-
code: content,
|
|
192
|
-
});
|
|
193
|
-
},
|
|
194
|
-
}),
|
|
195
|
-
createTool(meta.id, {
|
|
196
|
-
name: 'update',
|
|
197
|
-
description: 'Update a script. Returns the artifact definition for the script',
|
|
198
|
-
caption: 'Updating script...',
|
|
199
|
-
schema: Schema.Struct({
|
|
200
|
-
id: ArtifactId,
|
|
201
|
-
code: Schema.String.annotations({
|
|
202
|
-
description: 'The full code of the script in JavaScript or TypeScript. Must be valid executable code.',
|
|
203
|
-
}),
|
|
204
|
-
}),
|
|
205
|
-
execute: async ({ id, code }, { extensions }) => {
|
|
206
|
-
invariant(extensions?.space, 'No space');
|
|
207
|
-
|
|
208
|
-
const script = (await extensions.space.db.query(Filter.id(id)).first()) as ScriptType;
|
|
209
|
-
const source = await script.source.load();
|
|
210
|
-
if (!source) {
|
|
211
|
-
return ToolResult.Error('Script not found');
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
source.content = code;
|
|
215
|
-
await extensions.space?.db.flush();
|
|
216
|
-
|
|
217
|
-
return ToolResult.Success({
|
|
218
|
-
name: script.name,
|
|
219
|
-
});
|
|
220
|
-
},
|
|
221
|
-
}),
|
|
222
|
-
],
|
|
223
|
-
});
|
|
224
|
-
|
|
225
|
-
return Capability.contributes(Capabilities.ArtifactDefinition, definition);
|
|
226
|
-
}),
|
|
227
|
-
);
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { Octokit } from '@octokit/core';
|
|
6
|
-
import * as Effect from 'effect/Effect';
|
|
7
|
-
import * as Predicate from 'effect/Predicate';
|
|
8
|
-
|
|
9
|
-
import { Capabilities, Capability } from '@dxos/app-framework';
|
|
10
|
-
import { LayoutOperation } from '@dxos/app-toolkit';
|
|
11
|
-
import { Script } from '@dxos/functions';
|
|
12
|
-
import { Operation, OperationResolver } from '@dxos/operation';
|
|
13
|
-
import { TokenManagerOperation } from '@dxos/plugin-token-manager/types';
|
|
14
|
-
|
|
15
|
-
import { DEPLOYMENT_DIALOG } from '../../constants';
|
|
16
|
-
import { defaultScriptsForIntegration } from '../../meta';
|
|
17
|
-
import { templates } from '../../templates';
|
|
18
|
-
import { ScriptOperation } from '../../types';
|
|
19
|
-
|
|
20
|
-
export default Capability.makeModule(
|
|
21
|
-
Effect.fnUntraced(function* () {
|
|
22
|
-
return Capability.contributes(Capabilities.OperationResolver, [
|
|
23
|
-
OperationResolver.make({
|
|
24
|
-
operation: ScriptOperation.CreateScript,
|
|
25
|
-
handler: Effect.fnUntraced(function* ({ name, gistUrl, initialTemplateId }) {
|
|
26
|
-
let source = templates[0].source;
|
|
27
|
-
let scriptName = name;
|
|
28
|
-
|
|
29
|
-
const gistId = gistUrl?.split('/').at(-1);
|
|
30
|
-
if (gistId) {
|
|
31
|
-
// TODO(wittjosiah): Capability which contributes Octokit?
|
|
32
|
-
// NOTE: AccessToken not needed to read public gists.
|
|
33
|
-
const octokit = new Octokit();
|
|
34
|
-
const response = yield* Effect.promise(() =>
|
|
35
|
-
octokit.request('GET /gists/{gist_id}', {
|
|
36
|
-
gist_id: gistId,
|
|
37
|
-
}),
|
|
38
|
-
);
|
|
39
|
-
const gistContent = Object.values(response.data.files ?? {})[0]?.content;
|
|
40
|
-
if (gistContent) {
|
|
41
|
-
source = gistContent;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
if (initialTemplateId) {
|
|
46
|
-
const template = templates.find((template) => template.id === initialTemplateId);
|
|
47
|
-
if (template) {
|
|
48
|
-
source = template.source;
|
|
49
|
-
scriptName = scriptName || template.name;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
return { object: Script.make({ name: scriptName, source }) };
|
|
54
|
-
}),
|
|
55
|
-
}),
|
|
56
|
-
OperationResolver.make({
|
|
57
|
-
operation: TokenManagerOperation.AccessTokenCreated,
|
|
58
|
-
handler: Effect.fnUntraced(function* ({ accessToken }) {
|
|
59
|
-
const scriptTemplates = (defaultScriptsForIntegration[accessToken.source] ?? [])
|
|
60
|
-
.map((id) => templates.find((t) => t.id === id))
|
|
61
|
-
.filter(Predicate.isNotNullable);
|
|
62
|
-
|
|
63
|
-
if (scriptTemplates.length > 0) {
|
|
64
|
-
yield* Operation.invoke(LayoutOperation.UpdateDialog, {
|
|
65
|
-
subject: DEPLOYMENT_DIALOG,
|
|
66
|
-
blockAlign: 'start',
|
|
67
|
-
state: true,
|
|
68
|
-
props: { accessToken, scriptTemplates },
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
}),
|
|
72
|
-
}),
|
|
73
|
-
]);
|
|
74
|
-
}),
|
|
75
|
-
);
|
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import * as Effect from 'effect/Effect';
|
|
6
|
-
import React from 'react';
|
|
7
|
-
|
|
8
|
-
import { Capabilities, Capability } from '@dxos/app-framework';
|
|
9
|
-
import { Surface, useAtomCapability, useSettingsState } from '@dxos/app-framework/ui';
|
|
10
|
-
import { AppCapabilities } from '@dxos/app-toolkit';
|
|
11
|
-
import { InvocationTraceContainer } from '@dxos/devtools';
|
|
12
|
-
import { Obj } from '@dxos/echo';
|
|
13
|
-
import { Script } from '@dxos/functions';
|
|
14
|
-
import { getSpace } from '@dxos/react-client/echo';
|
|
15
|
-
import { Panel } from '@dxos/react-ui';
|
|
16
|
-
import { type AccessToken } from '@dxos/types';
|
|
17
|
-
|
|
18
|
-
import { DEPLOYMENT_DIALOG } from '../../constants';
|
|
19
|
-
import {
|
|
20
|
-
DeploymentDialog,
|
|
21
|
-
NotebookContainer,
|
|
22
|
-
ScriptContainer,
|
|
23
|
-
ScriptObjectSettings,
|
|
24
|
-
ScriptPluginSettings,
|
|
25
|
-
ScriptProperties,
|
|
26
|
-
TestContainer,
|
|
27
|
-
} from '../../containers';
|
|
28
|
-
import { useCompiler } from '../../hooks';
|
|
29
|
-
import { meta } from '../../meta';
|
|
30
|
-
import { Notebook, ScriptCapabilities, type ScriptSettings } from '../../types';
|
|
31
|
-
|
|
32
|
-
export default Capability.makeModule(() =>
|
|
33
|
-
Effect.succeed(
|
|
34
|
-
Capability.contributes(Capabilities.ReactSurface, [
|
|
35
|
-
Surface.create({
|
|
36
|
-
id: `${meta.id}/plugin-settings`,
|
|
37
|
-
role: 'article',
|
|
38
|
-
filter: (data): data is { subject: AppCapabilities.Settings } =>
|
|
39
|
-
AppCapabilities.isSettings(data.subject) && data.subject.prefix === meta.id,
|
|
40
|
-
component: ({ data: { subject } }) => {
|
|
41
|
-
const { settings, updateSettings } = useSettingsState<ScriptSettings>(subject.atom);
|
|
42
|
-
return <ScriptPluginSettings settings={settings} onSettingsChange={updateSettings} />;
|
|
43
|
-
},
|
|
44
|
-
}),
|
|
45
|
-
Surface.create({
|
|
46
|
-
id: `${meta.id}/script/article`,
|
|
47
|
-
role: ['article', 'section'],
|
|
48
|
-
filter: (data): data is { subject: Script.Script } => Obj.instanceOf(Script.Script, data.subject),
|
|
49
|
-
component: ({ data, role }) => {
|
|
50
|
-
const compiler = useCompiler();
|
|
51
|
-
const settings = useAtomCapability(ScriptCapabilities.Settings);
|
|
52
|
-
// TODO(wittjosiah): Why? The editor should be allow to render even if the environment is not ready.
|
|
53
|
-
if (!compiler?.environment) {
|
|
54
|
-
return null;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
return <ScriptContainer role={role} subject={data.subject} settings={settings} env={compiler?.environment} />;
|
|
58
|
-
},
|
|
59
|
-
}),
|
|
60
|
-
Surface.create({
|
|
61
|
-
id: `${meta.id}/notebook/article`,
|
|
62
|
-
role: 'article',
|
|
63
|
-
filter: (data): data is { subject: Notebook.Notebook } => Obj.instanceOf(Notebook.Notebook, data.subject),
|
|
64
|
-
component: ({ data, role }) => {
|
|
65
|
-
const compiler = useCompiler();
|
|
66
|
-
return <NotebookContainer role={role} subject={data.subject} env={compiler?.environment} />;
|
|
67
|
-
},
|
|
68
|
-
}),
|
|
69
|
-
// TODO(burdon): Standardize PluginSettings vs ObjectSettings.
|
|
70
|
-
// TODO(burdon): Why is ScriptProperties different from ScriptObjectSettings?
|
|
71
|
-
Surface.create({
|
|
72
|
-
id: `${meta.id}/companion/base-settings`,
|
|
73
|
-
role: 'base-object-settings',
|
|
74
|
-
filter: (data): data is { subject: Script.Script } => Obj.instanceOf(Script.Script, data.subject),
|
|
75
|
-
component: ({ data }) => <ScriptProperties object={data.subject} />,
|
|
76
|
-
}),
|
|
77
|
-
Surface.create({
|
|
78
|
-
id: `${meta.id}/companion/settings`,
|
|
79
|
-
role: 'object-settings',
|
|
80
|
-
filter: (data): data is { subject: Script.Script } => Obj.instanceOf(Script.Script, data.subject),
|
|
81
|
-
component: ({ data }) => <ScriptObjectSettings object={data.subject} />,
|
|
82
|
-
}),
|
|
83
|
-
Surface.create({
|
|
84
|
-
id: `${meta.id}/companion/execute`,
|
|
85
|
-
role: 'article',
|
|
86
|
-
filter: (data): data is { companionTo: Script.Script } =>
|
|
87
|
-
Obj.instanceOf(Script.Script, data.companionTo) && data.subject === 'execute',
|
|
88
|
-
component: ({ data, role }) => <TestContainer script={data.companionTo} role={role} />,
|
|
89
|
-
}),
|
|
90
|
-
Surface.create({
|
|
91
|
-
id: `${meta.id}/companion/logs`,
|
|
92
|
-
role: 'article',
|
|
93
|
-
filter: (data): data is { companionTo: Script.Script } =>
|
|
94
|
-
Obj.instanceOf(Script.Script, data.companionTo) && data.subject === 'logs',
|
|
95
|
-
component: ({ data, role }) => {
|
|
96
|
-
const space = getSpace(data.companionTo);
|
|
97
|
-
const queueDxn = space?.properties.invocationTraceQueue?.dxn;
|
|
98
|
-
return (
|
|
99
|
-
<Panel.Root role={role}>
|
|
100
|
-
<Panel.Content asChild>
|
|
101
|
-
<InvocationTraceContainer
|
|
102
|
-
db={space?.db}
|
|
103
|
-
queueDxn={queueDxn}
|
|
104
|
-
target={data.companionTo}
|
|
105
|
-
detailAxis='block'
|
|
106
|
-
/>
|
|
107
|
-
</Panel.Content>
|
|
108
|
-
</Panel.Root>
|
|
109
|
-
);
|
|
110
|
-
},
|
|
111
|
-
}),
|
|
112
|
-
Surface.create({
|
|
113
|
-
id: DEPLOYMENT_DIALOG,
|
|
114
|
-
role: 'dialog',
|
|
115
|
-
filter: (data): data is { props: { accessToken: AccessToken.AccessToken; scriptTemplates: any } } =>
|
|
116
|
-
data.component === DEPLOYMENT_DIALOG,
|
|
117
|
-
component: ({ data }) => <DeploymentDialog {...data.props} />,
|
|
118
|
-
}),
|
|
119
|
-
]),
|
|
120
|
-
),
|
|
121
|
-
);
|
|
@@ -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 FrameContainerProps = {
|
|
17
|
-
containerUrl: string;
|
|
18
|
-
result: BundleResult;
|
|
19
|
-
debug?: boolean;
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* IFrame container for the compiled script.
|
|
24
|
-
*/
|
|
25
|
-
export const FrameContainer = ({ containerUrl, result, debug = true }: FrameContainerProps) => {
|
|
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,25 +0,0 @@
|
|
|
1
|
-
<html>
|
|
2
|
-
<head>
|
|
3
|
-
<script src="https://cdn.tailwindcss.com"></script>
|
|
4
|
-
<script type="importmap">
|
|
5
|
-
__IMPORT_MAP__
|
|
6
|
-
</script>
|
|
7
|
-
|
|
8
|
-
<script type="module">
|
|
9
|
-
import RefreshRuntime from '/@react-refresh';
|
|
10
|
-
RefreshRuntime.injectIntoGlobalHook(window);
|
|
11
|
-
window.$RefreshReg$ = () => {};
|
|
12
|
-
window.$RefreshSig$ = () => (type) => type;
|
|
13
|
-
window.__vite_plugin_react_preamble_installed__ = true;
|
|
14
|
-
</script>
|
|
15
|
-
<script type="module" src="/@vite/client"></script>
|
|
16
|
-
</head>
|
|
17
|
-
<body>
|
|
18
|
-
<div id="root"></div>
|
|
19
|
-
|
|
20
|
-
<!-- Prevent vite from compiling this. -->
|
|
21
|
-
<script type="module">
|
|
22
|
-
eval('import("@frame/main")');
|
|
23
|
-
</script>
|
|
24
|
-
</body>
|
|
25
|
-
</html>
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2023 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import React from 'react';
|
|
6
|
-
import { createRoot } from 'react-dom/client';
|
|
7
|
-
|
|
8
|
-
import { ClientProvider } from '@dxos/react-client';
|
|
9
|
-
|
|
10
|
-
const init = async (f: () => Promise<Record<string, any>>) =>
|
|
11
|
-
Object.entries(await f()).reduce<Record<string, any>>((map, [key, module]) => {
|
|
12
|
-
map[key] = module;
|
|
13
|
-
return map;
|
|
14
|
-
}, {});
|
|
15
|
-
|
|
16
|
-
const main = async () => {
|
|
17
|
-
const { ClientServicesProxy } = await import('@dxos/react-client');
|
|
18
|
-
const { createIFramePort } = await import('@dxos/rpc-tunnel');
|
|
19
|
-
|
|
20
|
-
// @ts-ignore
|
|
21
|
-
window.__DXOS_SANDBOX_MODULES__ = await init(async () => ({
|
|
22
|
-
// prettier-ignore
|
|
23
|
-
'react': await import('react'),
|
|
24
|
-
'react-dom/client': await import('react-dom/client'),
|
|
25
|
-
'@dxos/client': await import('@dxos/client'),
|
|
26
|
-
'@dxos/react-client': await import('@dxos/react-client'),
|
|
27
|
-
'@dxos/react-client/echo': await import('@dxos/react-client/echo'),
|
|
28
|
-
'@dxos/plugin-explorer': await import('@dxos/plugin-explorer'),
|
|
29
|
-
}));
|
|
30
|
-
|
|
31
|
-
// eslint-disable-next-line @typescript-eslint/no-implied-eval
|
|
32
|
-
const Component = Function('React', "return React.lazy(() => import('@frame/bundle'))")(React);
|
|
33
|
-
|
|
34
|
-
const services = new ClientServicesProxy(
|
|
35
|
-
createIFramePort({
|
|
36
|
-
channel: 'frame',
|
|
37
|
-
origin: '*',
|
|
38
|
-
}),
|
|
39
|
-
);
|
|
40
|
-
|
|
41
|
-
// TODO(burdon): Error handling.
|
|
42
|
-
createRoot(document.getElementById('root')!).render(
|
|
43
|
-
<div className='flex fixed inset-0'>
|
|
44
|
-
<ClientProvider services={() => services}>
|
|
45
|
-
<Component />
|
|
46
|
-
</ClientProvider>
|
|
47
|
-
</div>,
|
|
48
|
-
);
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
void main();
|