@dxos/plugin-script 0.8.4-main.7996785055 → 0.8.4-main.8baae0fced
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/dist/lib/{browser/DeploymentDialog-LGEGIX64.mjs → neutral/DeploymentDialog-6DBF3V6C.mjs} +15 -27
- package/dist/lib/neutral/DeploymentDialog-6DBF3V6C.mjs.map +7 -0
- package/dist/lib/{browser/NotebookContainer-CC3G32Q5.mjs → neutral/NotebookArticle-VBBVX4BW.mjs} +48 -135
- package/dist/lib/neutral/NotebookArticle-VBBVX4BW.mjs.map +7 -0
- package/dist/lib/{browser/ScriptContainer-Z3MCPN2D.mjs → neutral/ScriptArticle-UBT27SB6.mjs} +10 -26
- package/dist/lib/neutral/ScriptArticle-UBT27SB6.mjs.map +7 -0
- package/dist/lib/neutral/ScriptPlugin.mjs +39 -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/{browser/TestContainer-ACNQMKVU.mjs → neutral/TestContainer-AFVTBYSJ.mjs} +9 -26
- 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-MC264VR5.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/{browser/chunk-37XPSUAH.mjs → neutral/chunk-436PZKYX.mjs} +2 -1
- package/dist/lib/neutral/chunk-436PZKYX.mjs.map +7 -0
- package/dist/lib/neutral/chunk-4OWPUMGN.mjs +8 -0
- package/dist/lib/neutral/chunk-4OWPUMGN.mjs.map +7 -0
- package/dist/lib/neutral/chunk-A4LRH25S.mjs +105 -0
- package/dist/lib/neutral/chunk-A4LRH25S.mjs.map +7 -0
- package/dist/lib/neutral/chunk-BDRB6ZX2.mjs +52 -0
- package/dist/lib/neutral/chunk-BDRB6ZX2.mjs.map +7 -0
- package/dist/lib/neutral/chunk-BMO5VOKL.mjs +125 -0
- package/dist/lib/neutral/chunk-BMO5VOKL.mjs.map +7 -0
- package/dist/lib/neutral/chunk-MI6X5CTJ.mjs +336 -0
- package/dist/lib/neutral/chunk-MI6X5CTJ.mjs.map +7 -0
- package/dist/lib/neutral/chunk-SNUWHNEW.mjs +8 -0
- package/dist/lib/neutral/chunk-SNUWHNEW.mjs.map +7 -0
- package/dist/lib/{browser/chunk-E6BQ4P6L.mjs → neutral/chunk-VXDJH6OL.mjs} +21 -50
- package/dist/lib/neutral/chunk-VXDJH6OL.mjs.map +7 -0
- package/dist/lib/{browser/compiler-MZKFKYCG.mjs → neutral/compiler-ODK4UA2N.mjs} +24 -21
- package/dist/lib/neutral/compiler-ODK4UA2N.mjs.map +7 -0
- package/dist/lib/{node-esm/chunk-SV742UH7.mjs → neutral/components/index.mjs} +75 -97
- 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-ZUHIXCBS.mjs +46 -0
- package/dist/lib/neutral/create-ZUHIXCBS.mjs.map +7 -0
- package/dist/lib/neutral/create-object-F2NWICFV.mjs +44 -0
- package/dist/lib/neutral/create-object-F2NWICFV.mjs.map +7 -0
- package/dist/lib/{browser/create-script-Z7J4HDV2.mjs → neutral/create-script-H5S4AO47.mjs} +6 -8
- package/dist/lib/neutral/create-script-H5S4AO47.mjs.map +7 -0
- package/dist/lib/neutral/delete-PAUWA2QM.mjs +21 -0
- package/dist/lib/neutral/delete-PAUWA2QM.mjs.map +7 -0
- package/dist/lib/neutral/deploy-M73G7HMP.mjs +63 -0
- package/dist/lib/neutral/deploy-M73G7HMP.mjs.map +7 -0
- package/dist/lib/{browser/chunk-DBEYGFVF.mjs → neutral/hooks/index.mjs} +49 -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-UO27IPCL.mjs +59 -0
- package/dist/lib/neutral/inspect-invocations-UO27IPCL.mjs.map +7 -0
- package/dist/lib/neutral/install-function-MSWSC244.mjs +49 -0
- package/dist/lib/neutral/install-function-MSWSC244.mjs.map +7 -0
- package/dist/lib/neutral/invoke-V6XYXKLD.mjs +32 -0
- package/dist/lib/neutral/invoke-V6XYXKLD.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-KIZ7XZ5G.mjs +18 -0
- package/dist/lib/neutral/operation-handler-KIZ7XZ5G.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-4MMKQ6BR.mjs +34 -0
- package/dist/lib/neutral/query-deployed-functions-4MMKQ6BR.mjs.map +7 -0
- package/dist/lib/neutral/react-surface-K4SSUR57.mjs +120 -0
- package/dist/lib/neutral/react-surface-K4SSUR57.mjs.map +7 -0
- package/dist/lib/neutral/read-FFOSK6A3.mjs +26 -0
- package/dist/lib/neutral/read-FFOSK6A3.mjs.map +7 -0
- package/dist/lib/{browser/settings-BV3KXROF.mjs → neutral/settings-VJBW4OMK.mjs} +6 -11
- 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 +104 -0
- package/dist/lib/neutral/translations.mjs.map +7 -0
- package/dist/lib/neutral/types/index.mjs +17 -0
- package/dist/lib/neutral/update-PJS5GG3Y.mjs +63 -0
- package/dist/lib/neutral/update-PJS5GG3Y.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 +129 -0
- package/dist/types/src/blueprints/functions/definitions.d.ts.map +1 -0
- package/dist/types/src/blueprints/functions/delete.d.ts +16 -0
- package/dist/types/src/blueprints/functions/delete.d.ts.map +1 -0
- package/dist/types/src/blueprints/functions/deploy.d.ts +20 -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 +27 -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 +20 -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 +20 -0
- package/dist/types/src/blueprints/functions/read.d.ts.map +1 -0
- package/dist/types/src/blueprints/functions/update.d.ts +25 -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/artifact-definition.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/operation-handler.d.ts → operation-handler.d.ts} +1 -1
- 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/FramePanel/FramePanel.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 +2 -6
- package/dist/types/src/components/NotebookStack/NotebookStack.d.ts.map +1 -1
- package/dist/types/src/components/NotebookStack/NotebookStack.stories.d.ts +219 -231
- 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 +3 -7
- package/dist/types/src/components/ScriptToolbar/ScriptToolbar.d.ts.map +1 -1
- package/dist/types/src/components/ScriptToolbar/ScriptToolbar.stories.d.ts +219 -231
- package/dist/types/src/components/ScriptToolbar/ScriptToolbar.stories.d.ts.map +1 -1
- package/dist/types/src/components/TestPanel/TestPanel.d.ts +1 -5
- package/dist/types/src/components/TestPanel/TestPanel.d.ts.map +1 -1
- package/dist/types/src/components/TypescriptEditor/TypescriptEditor.d.ts +3 -6
- package/dist/types/src/components/TypescriptEditor/TypescriptEditor.d.ts.map +1 -1
- package/dist/types/src/components/TypescriptEditor/TypescriptEditor.stories.d.ts +1 -5
- package/dist/types/src/components/TypescriptEditor/TypescriptEditor.stories.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +2 -0
- package/dist/types/src/components/index.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 -231
- 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 +14 -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.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 +3 -3
- package/dist/types/src/operations/create-script.d.ts.map +1 -1
- package/dist/types/src/operations/index.d.ts +1 -2
- package/dist/types/src/operations/index.d.ts.map +1 -1
- 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 +1 -1
- package/dist/types/src/templates/anthropic.d.ts.map +1 -1
- package/dist/types/src/templates/chat.d.ts.map +1 -1
- package/dist/types/src/templates/chess-bot.d.ts +5 -11
- package/dist/types/src/templates/chess-bot.d.ts.map +1 -1
- package/dist/types/src/templates/commentary.d.ts +5 -11
- 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 +1 -1
- package/dist/types/src/templates/forex-effect.d.ts.map +1 -1
- package/dist/types/src/templates/forex.d.ts +1 -1
- 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 +29 -29
- package/dist/types/src/templates/index.d.ts.map +1 -1
- package/dist/types/src/templates/ping.d.ts +1 -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 -94
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/Notebook.d.ts +37 -29
- 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 -3
- 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 +1 -2
- package/dist/types/src/util/deploy.d.ts.map +1 -1
- package/dist/types/src/util/functions.d.ts +1 -2
- package/dist/types/src/util/functions.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +153 -113
- package/src/ScriptPlugin.node.ts +21 -0
- package/src/ScriptPlugin.test.ts +31 -0
- package/src/ScriptPlugin.tsx +9 -56
- package/src/ScriptPlugin.workerd.ts +18 -0
- package/src/blueprints/functions/create.ts +47 -0
- package/src/blueprints/functions/definitions.ts +323 -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 -5
- package/src/capabilities/{app-graph-builder/app-graph-builder.ts → app-graph-builder.ts} +13 -22
- package/src/capabilities/{artifact-definition/artifact-definition.ts → artifact-definition.ts} +4 -5
- 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 +48 -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 +22 -11
- package/src/components/NotebookStack/NotebookMenu.tsx +7 -7
- package/src/components/NotebookStack/NotebookStack.stories.tsx +4 -4
- package/src/components/NotebookStack/NotebookStack.tsx +4 -4
- package/src/components/QueryEditor/QueryEditor.stories.tsx +3 -3
- 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 +6 -6
- package/src/components/ScriptToolbar/ScriptToolbar.tsx +4 -4
- package/src/components/TestPanel/TestPanel.tsx +5 -9
- package/src/components/TypescriptEditor/TypescriptEditor.stories.tsx +3 -3
- package/src/components/TypescriptEditor/TypescriptEditor.tsx +2 -2
- package/src/components/index.ts +4 -0
- package/src/constants.ts +1 -1
- package/src/containers/DeploymentDialog/DeploymentDialog.stories.tsx +4 -4
- package/src/containers/DeploymentDialog/DeploymentDialog.tsx +14 -13
- package/src/containers/DeploymentDialog/index.ts +1 -3
- package/src/containers/{NotebookContainer/NotebookContainer.stories.tsx → NotebookArticle/NotebookArticle.stories.tsx} +15 -14
- package/src/containers/{NotebookContainer/NotebookContainer.tsx → NotebookArticle/NotebookArticle.tsx} +32 -45
- 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} +12 -12
- 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 +7 -8
- package/src/containers/TestContainer/index.ts +1 -3
- package/src/containers/index.ts +2 -4
- package/src/e2e/ai.test.ts +2 -2
- package/src/e2e/deploy.test.ts +3 -2
- package/src/hooks/deploy.ts +8 -7
- package/src/hooks/format.ts +4 -4
- package/src/hooks/template.ts +6 -5
- package/src/hooks/useCompiler.ts +3 -2
- package/src/hooks/useCreateAndDeployScriptTemplates.ts +4 -3
- package/src/index.ts +2 -5
- package/src/meta.ts +1 -0
- 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 +3 -4
- package/src/operations/index.ts +2 -7
- package/src/plugin.ts +11 -0
- package/src/templates/anthropic.ts +1 -1
- package/src/templates/chess-bot.ts +11 -9
- package/src/templates/commentary.ts +27 -22
- package/src/templates/discord.ts +1 -1
- package/src/templates/forex-effect.ts +1 -1
- package/src/templates/forex.ts +1 -1
- package/src/templates/gmail.ts +1 -1
- package/src/templates/ping.ts +1 -1
- package/src/testing/index.ts +2 -1
- package/src/testing/simulator.test.ts +3 -4
- package/src/testing/{data.ts → test-notebook.ts} +11 -12
- package/src/testing/test-script.ts +28 -0
- package/src/translations.ts +86 -89
- package/src/types/Notebook.ts +3 -3
- package/src/types/ScriptCapabilities.ts +18 -0
- package/src/types/ScriptEvents.ts +11 -0
- package/src/{operations/definitions.ts → types/ScriptOperation.ts} +5 -3
- package/src/types/Settings.ts +20 -0
- package/src/types/index.ts +5 -3
- package/src/types/types.ts +1 -11
- package/src/util/deploy.ts +7 -7
- package/src/util/functions.ts +11 -11
- package/dist/lib/browser/DeploymentDialog-LGEGIX64.mjs.map +0 -7
- package/dist/lib/browser/NotebookContainer-CC3G32Q5.mjs.map +0 -7
- package/dist/lib/browser/ScriptContainer-Z3MCPN2D.mjs.map +0 -7
- package/dist/lib/browser/ScriptObjectSettings-LST7DUAN.mjs +0 -297
- package/dist/lib/browser/ScriptObjectSettings-LST7DUAN.mjs.map +0 -7
- package/dist/lib/browser/ScriptPluginSettings-IKWRISC3.mjs +0 -55
- package/dist/lib/browser/ScriptPluginSettings-IKWRISC3.mjs.map +0 -7
- package/dist/lib/browser/ScriptProperties-ZCRTZTAK.mjs +0 -28
- package/dist/lib/browser/ScriptProperties-ZCRTZTAK.mjs.map +0 -7
- package/dist/lib/browser/TestContainer-ACNQMKVU.mjs.map +0 -7
- package/dist/lib/browser/access-token-created-ZHVVOEL7.mjs +0 -36
- package/dist/lib/browser/access-token-created-ZHVVOEL7.mjs.map +0 -7
- package/dist/lib/browser/app-graph-builder-QPXX4YK5.mjs +0 -63
- package/dist/lib/browser/app-graph-builder-QPXX4YK5.mjs.map +0 -7
- package/dist/lib/browser/blueprint-definition-MC264VR5.mjs.map +0 -7
- package/dist/lib/browser/chunk-37XPSUAH.mjs.map +0 -7
- package/dist/lib/browser/chunk-4XJSGCAS.mjs +0 -742
- package/dist/lib/browser/chunk-4XJSGCAS.mjs.map +0 -7
- package/dist/lib/browser/chunk-7JI376EM.mjs +0 -20
- package/dist/lib/browser/chunk-7JI376EM.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-BHRCZLLU.mjs +0 -105
- package/dist/lib/browser/chunk-BHRCZLLU.mjs.map +0 -7
- package/dist/lib/browser/chunk-CMHREENI.mjs +0 -8
- package/dist/lib/browser/chunk-CMHREENI.mjs.map +0 -7
- package/dist/lib/browser/chunk-DBEYGFVF.mjs.map +0 -7
- package/dist/lib/browser/chunk-E6BQ4P6L.mjs.map +0 -7
- package/dist/lib/browser/chunk-GB2HL4ZE.mjs +0 -26
- package/dist/lib/browser/chunk-GB2HL4ZE.mjs.map +0 -7
- package/dist/lib/browser/chunk-NQJRENSK.mjs +0 -75
- package/dist/lib/browser/chunk-NQJRENSK.mjs.map +0 -7
- package/dist/lib/browser/chunk-QLFFA4Y4.mjs +0 -52
- package/dist/lib/browser/chunk-QLFFA4Y4.mjs.map +0 -7
- package/dist/lib/browser/chunk-X44CJ7F5.mjs +0 -11
- package/dist/lib/browser/chunk-X44CJ7F5.mjs.map +0 -7
- package/dist/lib/browser/compiler-MZKFKYCG.mjs.map +0 -7
- package/dist/lib/browser/create-script-Z7J4HDV2.mjs.map +0 -7
- package/dist/lib/browser/index.mjs +0 -268
- package/dist/lib/browser/index.mjs.map +0 -7
- package/dist/lib/browser/meta.json +0 -1
- package/dist/lib/browser/operation-handler-76AHUB5G.mjs +0 -18
- package/dist/lib/browser/operation-handler-76AHUB5G.mjs.map +0 -7
- package/dist/lib/browser/operations/index.mjs +0 -14
- package/dist/lib/browser/react-surface-2VVUIV66.mjs +0 -145
- package/dist/lib/browser/react-surface-2VVUIV66.mjs.map +0 -7
- package/dist/lib/browser/settings-BV3KXROF.mjs.map +0 -7
- package/dist/lib/browser/types/index.mjs +0 -15
- package/dist/lib/node-esm/DeploymentDialog-XSP2EDU2.mjs +0 -125
- package/dist/lib/node-esm/DeploymentDialog-XSP2EDU2.mjs.map +0 -7
- package/dist/lib/node-esm/NotebookContainer-LNWMJD2D.mjs +0 -851
- package/dist/lib/node-esm/NotebookContainer-LNWMJD2D.mjs.map +0 -7
- package/dist/lib/node-esm/ScriptContainer-TSU4DBGA.mjs +0 -96
- package/dist/lib/node-esm/ScriptContainer-TSU4DBGA.mjs.map +0 -7
- package/dist/lib/node-esm/ScriptObjectSettings-OGY7X3UE.mjs +0 -298
- package/dist/lib/node-esm/ScriptObjectSettings-OGY7X3UE.mjs.map +0 -7
- package/dist/lib/node-esm/ScriptPluginSettings-HIUSAHCP.mjs +0 -56
- package/dist/lib/node-esm/ScriptPluginSettings-HIUSAHCP.mjs.map +0 -7
- package/dist/lib/node-esm/ScriptProperties-I6SC4P3R.mjs +0 -29
- package/dist/lib/node-esm/ScriptProperties-I6SC4P3R.mjs.map +0 -7
- package/dist/lib/node-esm/TestContainer-WKISNRNU.mjs +0 -62
- package/dist/lib/node-esm/TestContainer-WKISNRNU.mjs.map +0 -7
- package/dist/lib/node-esm/access-token-created-7CGU7FXD.mjs +0 -37
- package/dist/lib/node-esm/access-token-created-7CGU7FXD.mjs.map +0 -7
- package/dist/lib/node-esm/app-graph-builder-GNGOYXIU.mjs +0 -64
- package/dist/lib/node-esm/app-graph-builder-GNGOYXIU.mjs.map +0 -7
- package/dist/lib/node-esm/blueprint-definition-DTRGTRZA.mjs +0 -18
- package/dist/lib/node-esm/blueprint-definition-DTRGTRZA.mjs.map +0 -7
- package/dist/lib/node-esm/blueprints/index.mjs +0 -9
- package/dist/lib/node-esm/chunk-2NGQCFVE.mjs +0 -28
- package/dist/lib/node-esm/chunk-2NGQCFVE.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-4YAEFFW2.mjs +0 -12
- package/dist/lib/node-esm/chunk-4YAEFFW2.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-C3GH2SDF.mjs +0 -76
- package/dist/lib/node-esm/chunk-C3GH2SDF.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-CKYUNEE5.mjs +0 -10
- package/dist/lib/node-esm/chunk-CKYUNEE5.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-L3JLWXB5.mjs +0 -33
- package/dist/lib/node-esm/chunk-L3JLWXB5.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-L55OBVT5.mjs +0 -53
- package/dist/lib/node-esm/chunk-L55OBVT5.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-P4Q2BPBB.mjs +0 -22
- package/dist/lib/node-esm/chunk-P4Q2BPBB.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-RN2SMYCL.mjs +0 -401
- package/dist/lib/node-esm/chunk-RN2SMYCL.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-RTM3D4T5.mjs +0 -181
- package/dist/lib/node-esm/chunk-RTM3D4T5.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-SV742UH7.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-Y5VWHRVU.mjs +0 -107
- package/dist/lib/node-esm/chunk-Y5VWHRVU.mjs.map +0 -7
- package/dist/lib/node-esm/compiler-QBWP7ERK.mjs +0 -99
- package/dist/lib/node-esm/compiler-QBWP7ERK.mjs.map +0 -7
- package/dist/lib/node-esm/create-script-TAJHVROB.mjs +0 -48
- package/dist/lib/node-esm/create-script-TAJHVROB.mjs.map +0 -7
- package/dist/lib/node-esm/index.mjs +0 -269
- 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-handler-OUROH3T7.mjs +0 -19
- package/dist/lib/node-esm/operation-handler-OUROH3T7.mjs.map +0 -7
- package/dist/lib/node-esm/operations/index.mjs +0 -15
- package/dist/lib/node-esm/react-surface-OJ55GFCP.mjs +0 -146
- package/dist/lib/node-esm/react-surface-OJ55GFCP.mjs.map +0 -7
- package/dist/lib/node-esm/settings-2TK3XPLD.mjs +0 -36
- package/dist/lib/node-esm/settings-2TK3XPLD.mjs.map +0 -7
- package/dist/lib/node-esm/templates/index.mjs +0 -11
- package/dist/lib/node-esm/templates/index.mjs.map +0 -7
- package/dist/lib/node-esm/types/index.mjs +0 -16
- package/dist/lib/node-esm/types/index.mjs.map +0 -7
- 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.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-handler/index.d.ts +0 -4
- package/dist/types/src/capabilities/operation-handler/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/operation-handler/operation-handler.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/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/operations/access-token-created.d.ts +0 -5
- package/dist/types/src/operations/access-token-created.d.ts.map +0 -1
- package/dist/types/src/operations/definitions.d.ts +0 -28
- package/dist/types/src/operations/definitions.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/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/index.ts +0 -7
- 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-handler/index.ts +0 -11
- package/src/capabilities/operation-handler/operation-handler.ts +0 -16
- package/src/capabilities/react-surface/index.ts +0 -7
- package/src/capabilities/react-surface/react-surface.tsx +0 -138
- package/src/capabilities/settings/index.ts +0 -7
- package/src/containers/NotebookContainer/index.ts +0 -7
- package/src/containers/ScriptContainer/index.ts +0 -7
- package/src/containers/ScriptObjectSettings/ScriptObjectSettings.tsx +0 -295
- 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/operations/access-token-created.ts +0 -36
- 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/operations → neutral}/index.mjs.map +0 -0
- /package/dist/lib/{browser/templates/index.mjs.map → neutral/meta.mjs.map} +0 -0
- /package/dist/lib/{browser/types → neutral/operations}/index.mjs.map +0 -0
- /package/dist/lib/{node-esm/blueprints → neutral/templates}/index.mjs.map +0 -0
- /package/dist/lib/{node-esm/operations → 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/{artifact-definition/artifact-definition.d.ts → artifact-definition.d.ts} +0 -0
- /package/dist/types/src/capabilities/{react-surface/react-surface.d.ts → react-surface.d.ts} +0 -0
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2026 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
6
|
+
import * as Effect from 'effect/Effect';
|
|
7
|
+
import React from 'react';
|
|
8
|
+
|
|
9
|
+
import { withPluginManager } from '@dxos/app-framework/testing';
|
|
10
|
+
import { Blueprint } from '@dxos/compute';
|
|
11
|
+
import { Script } from '@dxos/compute';
|
|
12
|
+
import { Operation } from '@dxos/compute';
|
|
13
|
+
import { Filter } from '@dxos/echo';
|
|
14
|
+
import { ClientPlugin } from '@dxos/plugin-client/testing';
|
|
15
|
+
import { initializeIdentity } from '@dxos/plugin-client/testing';
|
|
16
|
+
import { StorybookPlugin, corePlugins } from '@dxos/plugin-testing';
|
|
17
|
+
import { useQuery, useSpaces } from '@dxos/react-client/echo';
|
|
18
|
+
import { ObjectProperties } from '@dxos/react-ui-form';
|
|
19
|
+
import { Loading, withLayout, withTheme } from '@dxos/react-ui/testing';
|
|
20
|
+
import { Text } from '@dxos/schema';
|
|
21
|
+
|
|
22
|
+
import { createScript } from '#testing';
|
|
23
|
+
import { translations } from '#translations';
|
|
24
|
+
|
|
25
|
+
import { ScriptProperties } from './ScriptProperties';
|
|
26
|
+
|
|
27
|
+
type DefaultStoryProps = {};
|
|
28
|
+
|
|
29
|
+
const DefaultStory = (_: DefaultStoryProps) => {
|
|
30
|
+
const [space] = useSpaces();
|
|
31
|
+
const [script] = useQuery(space?.db, Filter.type(Script.Script));
|
|
32
|
+
if (!script) {
|
|
33
|
+
return <Loading />;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
return (
|
|
37
|
+
<ObjectProperties object={script}>
|
|
38
|
+
<ScriptProperties role='object-properties' subject={script} />
|
|
39
|
+
</ObjectProperties>
|
|
40
|
+
);
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
const meta = {
|
|
44
|
+
title: 'plugins/plugin-script/containers/ScriptProperties',
|
|
45
|
+
render: DefaultStory,
|
|
46
|
+
decorators: [
|
|
47
|
+
withTheme(),
|
|
48
|
+
withLayout({ layout: 'column' }),
|
|
49
|
+
withPluginManager({
|
|
50
|
+
plugins: [
|
|
51
|
+
...corePlugins(),
|
|
52
|
+
ClientPlugin({
|
|
53
|
+
types: [Script.Script, Operation.PersistentOperation, Blueprint.Blueprint, Text.Text],
|
|
54
|
+
onClientInitialized: ({ client }) =>
|
|
55
|
+
Effect.gen(function* () {
|
|
56
|
+
yield* initializeIdentity(client);
|
|
57
|
+
const [space] = client.spaces.get();
|
|
58
|
+
yield* Effect.promise(() => space.waitUntilReady());
|
|
59
|
+
createScript(space);
|
|
60
|
+
}),
|
|
61
|
+
}),
|
|
62
|
+
StorybookPlugin({}),
|
|
63
|
+
],
|
|
64
|
+
}),
|
|
65
|
+
],
|
|
66
|
+
parameters: {
|
|
67
|
+
layout: 'fullscreen',
|
|
68
|
+
translations,
|
|
69
|
+
},
|
|
70
|
+
} satisfies Meta<DefaultStoryProps>;
|
|
71
|
+
|
|
72
|
+
export default meta;
|
|
73
|
+
|
|
74
|
+
type Story = StoryObj<typeof meta>;
|
|
75
|
+
|
|
76
|
+
export const Default: Story = {};
|
|
@@ -4,30 +4,21 @@
|
|
|
4
4
|
|
|
5
5
|
import React from 'react';
|
|
6
6
|
|
|
7
|
-
import {
|
|
8
|
-
import { type Script } from '@dxos/
|
|
9
|
-
import { Input, useTranslation } from '@dxos/react-ui';
|
|
7
|
+
import { type AppSurface } from '@dxos/app-toolkit/ui';
|
|
8
|
+
import { type Script } from '@dxos/compute';
|
|
10
9
|
|
|
11
|
-
import {
|
|
10
|
+
import { BlueprintEditor } from './BlueprintEditor';
|
|
11
|
+
import { FunctionBinding } from './FunctionBinding';
|
|
12
|
+
import { FunctionPublishing } from './FunctionPublishing';
|
|
12
13
|
|
|
13
|
-
export type ScriptPropertiesProps =
|
|
14
|
-
object: Script.Script;
|
|
15
|
-
};
|
|
14
|
+
export type ScriptPropertiesProps = AppSurface.ObjectPropertiesProps<Script.Script>;
|
|
16
15
|
|
|
17
|
-
export const ScriptProperties = ({ object }: ScriptPropertiesProps) => {
|
|
18
|
-
const { t } = useTranslation(meta.id);
|
|
16
|
+
export const ScriptProperties = ({ subject: object }: ScriptPropertiesProps) => {
|
|
19
17
|
return (
|
|
20
|
-
<
|
|
21
|
-
<
|
|
22
|
-
<
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
onChange={(event) => {
|
|
26
|
-
Obj.change(object, (obj) => {
|
|
27
|
-
obj.description = event.target.value;
|
|
28
|
-
});
|
|
29
|
-
}}
|
|
30
|
-
/>
|
|
31
|
-
</Input.Root>
|
|
18
|
+
<div className='flex flex-col py-form-gap gap-form-section-gap'>
|
|
19
|
+
<FunctionBinding object={object} />
|
|
20
|
+
<BlueprintEditor object={object} />
|
|
21
|
+
<FunctionPublishing object={object} />
|
|
22
|
+
</div>
|
|
32
23
|
);
|
|
33
24
|
};
|
|
@@ -4,15 +4,14 @@
|
|
|
4
4
|
|
|
5
5
|
import React, { useCallback, useMemo } from 'react';
|
|
6
6
|
|
|
7
|
+
import { type Script } from '@dxos/compute';
|
|
7
8
|
import { Context } from '@dxos/context';
|
|
8
|
-
|
|
9
|
-
import { type Script } from '@dxos/functions';
|
|
9
|
+
import { Obj } from '@dxos/echo';
|
|
10
10
|
import { FunctionsServiceClient } from '@dxos/functions-runtime/edge';
|
|
11
11
|
import { Panel } from '@dxos/react-ui';
|
|
12
|
-
import { getSpace } from '@dxos/react-client/echo';
|
|
13
12
|
|
|
14
|
-
import { TestPanel } from '
|
|
15
|
-
import { useDeployDeps } from '
|
|
13
|
+
import { TestPanel } from '#components';
|
|
14
|
+
import { useDeployDeps } from '#hooks';
|
|
16
15
|
|
|
17
16
|
export type TestContainerProps = {
|
|
18
17
|
role: string;
|
|
@@ -21,7 +20,7 @@ export type TestContainerProps = {
|
|
|
21
20
|
|
|
22
21
|
export const TestContainer = ({ role, script }: TestContainerProps) => {
|
|
23
22
|
const { client, fn, existingFunctionId } = useDeployDeps({ script });
|
|
24
|
-
const
|
|
23
|
+
const spaceId = Obj.getDatabase(script)?.spaceId;
|
|
25
24
|
|
|
26
25
|
const functionsClient = useMemo(() => FunctionsServiceClient.fromClient(client), [client]);
|
|
27
26
|
|
|
@@ -30,9 +29,9 @@ export const TestContainer = ({ role, script }: TestContainerProps) => {
|
|
|
30
29
|
if (!fn) {
|
|
31
30
|
throw new Error('Function not deployed');
|
|
32
31
|
}
|
|
33
|
-
return functionsClient.invoke(Context.default(), fn, input, { spaceId
|
|
32
|
+
return functionsClient.invoke(Context.default(), fn, input, { spaceId });
|
|
34
33
|
},
|
|
35
|
-
[fn, functionsClient,
|
|
34
|
+
[fn, functionsClient, spaceId],
|
|
36
35
|
);
|
|
37
36
|
|
|
38
37
|
return (
|
package/src/containers/index.ts
CHANGED
|
@@ -5,9 +5,7 @@
|
|
|
5
5
|
import { type ComponentType, lazy } from 'react';
|
|
6
6
|
|
|
7
7
|
export const DeploymentDialog: ComponentType<any> = lazy(() => import('./DeploymentDialog'));
|
|
8
|
-
export const
|
|
9
|
-
export const
|
|
10
|
-
export const ScriptObjectSettings: ComponentType<any> = lazy(() => import('./ScriptObjectSettings'));
|
|
11
|
-
export const ScriptPluginSettings: ComponentType<any> = lazy(() => import('./ScriptPluginSettings'));
|
|
8
|
+
export const NotebookArticle: ComponentType<any> = lazy(() => import('./NotebookArticle'));
|
|
9
|
+
export const ScriptArticle: ComponentType<any> = lazy(() => import('./ScriptArticle'));
|
|
12
10
|
export const ScriptProperties: ComponentType<any> = lazy(() => import('./ScriptProperties'));
|
|
13
11
|
export const TestContainer: ComponentType<any> = lazy(() => import('./TestContainer'));
|
package/src/e2e/ai.test.ts
CHANGED
|
@@ -7,16 +7,16 @@ import { test } from 'vitest';
|
|
|
7
7
|
|
|
8
8
|
import { Client } from '@dxos/client';
|
|
9
9
|
import { type Space } from '@dxos/client-protocol';
|
|
10
|
+
import { Operation } from '@dxos/compute';
|
|
10
11
|
import { configPreset } from '@dxos/config';
|
|
11
12
|
import { Context } from '@dxos/context';
|
|
12
|
-
import { Operation } from '@dxos/operation';
|
|
13
13
|
import { FunctionsServiceClient } from '@dxos/functions-runtime/edge';
|
|
14
14
|
import { bundleFunction } from '@dxos/functions-runtime/native';
|
|
15
15
|
import { FunctionRuntimeKind } from '@dxos/protocols';
|
|
16
16
|
import { EdgeReplicationSetting } from '@dxos/protocols/proto/dxos/echo/metadata';
|
|
17
17
|
|
|
18
18
|
// To heavy to run in CI.
|
|
19
|
-
describe.
|
|
19
|
+
describe.skip('Function', { tags: ['functions-e2e'] }, () => {
|
|
20
20
|
const config = configPreset({ edge: 'local' });
|
|
21
21
|
|
|
22
22
|
test('bundle anthropic function', { timeout: 120_000 }, async () => {
|
package/src/e2e/deploy.test.ts
CHANGED
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { readFile } from 'node:fs/promises';
|
|
6
|
-
|
|
7
6
|
import { describe, expect, test } from 'vitest';
|
|
8
7
|
|
|
9
8
|
import { Client, type Config } from '@dxos/client';
|
|
@@ -15,7 +14,9 @@ import { FunctionsServiceClient } from '@dxos/functions-runtime/edge';
|
|
|
15
14
|
import { invariant } from '@dxos/invariant';
|
|
16
15
|
import { log } from '@dxos/log';
|
|
17
16
|
|
|
18
|
-
|
|
17
|
+
// TODO(wittjosiah): Re-enable once @dxos/compute.js is available at the R2 dev bucket
|
|
18
|
+
// (https://pub-5745ae82e450484aa28f75fc6a175935.r2.dev/dev/@dxos/compute.js currently 404s).
|
|
19
|
+
describe.skip('Functions deployment', { tags: ['functions-e2e'] }, () => {
|
|
19
20
|
test('deploys FOREX (effect) function and invokes it via EDGE (main)', { timeout: 120_000 }, async () => {
|
|
20
21
|
const config = configPreset({ edge: 'main' });
|
|
21
22
|
await testDeploy(config);
|
package/src/hooks/deploy.ts
CHANGED
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
|
|
5
5
|
import { useEffect, useMemo } from 'react';
|
|
6
6
|
|
|
7
|
+
import { Script, Operation } from '@dxos/compute';
|
|
7
8
|
import { Obj, Query, Ref } from '@dxos/echo';
|
|
8
|
-
import {
|
|
9
|
-
import { Operation } from '@dxos/operation';
|
|
9
|
+
import { getUserFunctionIdInMetadata } from '@dxos/functions';
|
|
10
10
|
import { log } from '@dxos/log';
|
|
11
11
|
import { type Client, useClient } from '@dxos/react-client';
|
|
12
12
|
import { type Space, getSpace, useQuery } from '@dxos/react-client/echo';
|
|
@@ -14,7 +14,8 @@ import { type TFunction } from '@dxos/react-ui';
|
|
|
14
14
|
import { createMenuAction } from '@dxos/react-ui-menu';
|
|
15
15
|
import { messageValence } from '@dxos/ui-theme';
|
|
16
16
|
|
|
17
|
-
import { meta } from '
|
|
17
|
+
import { meta } from '#meta';
|
|
18
|
+
|
|
18
19
|
import { deployScript, getFunctionUrl, isScriptDeployed } from '../util';
|
|
19
20
|
|
|
20
21
|
export type DeployActionProperties = { type: 'deploy' } | { type: 'copy' };
|
|
@@ -43,7 +44,7 @@ export const createDeploy = ({ state, script, space, fn, client, existingFunctio
|
|
|
43
44
|
|
|
44
45
|
// TODO(wittjosiah): Should this be an action?
|
|
45
46
|
const errorItem = createMenuAction('error', () => {}, {
|
|
46
|
-
label: value.error ?? ['no
|
|
47
|
+
label: value.error ?? ['no-error.label', { ns: meta.id }],
|
|
47
48
|
icon: 'ph--warning-circle--regular',
|
|
48
49
|
hidden: !value.error,
|
|
49
50
|
classNames: value.error && messageValence('error'),
|
|
@@ -63,14 +64,14 @@ export const createDeploy = ({ state, script, space, fn, client, existingFunctio
|
|
|
63
64
|
|
|
64
65
|
if (!result.success) {
|
|
65
66
|
log.catch(result.error);
|
|
66
|
-
state.set('error', t('upload
|
|
67
|
+
state.set('error', t('upload-failed.label'));
|
|
67
68
|
}
|
|
68
69
|
|
|
69
70
|
state.set('deploying', false);
|
|
70
71
|
},
|
|
71
72
|
{
|
|
72
73
|
type: 'deploy',
|
|
73
|
-
label: [value.deploying ? 'publishing
|
|
74
|
+
label: [value.deploying ? 'publishing.label' : 'deploy.label', { ns: meta.id }],
|
|
74
75
|
icon: value.deploying ? 'ph--spinner-gap--regular' : 'ph--cloud-arrow-up--regular',
|
|
75
76
|
disabled: value.deploying,
|
|
76
77
|
classNames: value.deploying ? '[&_svg]:animate-spin' : '',
|
|
@@ -86,7 +87,7 @@ export const createDeploy = ({ state, script, space, fn, client, existingFunctio
|
|
|
86
87
|
},
|
|
87
88
|
{
|
|
88
89
|
type: 'copy',
|
|
89
|
-
label: ['copy
|
|
90
|
+
label: ['copy-link.label', { ns: meta.id }],
|
|
90
91
|
icon: 'ph--link--regular',
|
|
91
92
|
disabled: !value.functionUrl,
|
|
92
93
|
},
|
package/src/hooks/format.ts
CHANGED
|
@@ -6,12 +6,12 @@ import { format } from 'prettier';
|
|
|
6
6
|
import prettierPluginEstree from 'prettier/plugins/estree';
|
|
7
7
|
import prettierPluginTypescript from 'prettier/plugins/typescript';
|
|
8
8
|
|
|
9
|
+
import { type Script } from '@dxos/compute';
|
|
9
10
|
import { Obj } from '@dxos/echo';
|
|
10
|
-
import { type Script } from '@dxos/functions';
|
|
11
11
|
import { log } from '@dxos/log';
|
|
12
12
|
import { createMenuAction } from '@dxos/react-ui-menu';
|
|
13
13
|
|
|
14
|
-
import { meta } from '
|
|
14
|
+
import { meta } from '#meta';
|
|
15
15
|
|
|
16
16
|
export type FormatActionProperties = { type: 'format' };
|
|
17
17
|
|
|
@@ -30,7 +30,7 @@ export const createFormat = (script: Script.Script) => {
|
|
|
30
30
|
semi: true,
|
|
31
31
|
singleQuote: true,
|
|
32
32
|
});
|
|
33
|
-
Obj.
|
|
33
|
+
Obj.update(script.source.target!, (obj) => {
|
|
34
34
|
obj.content = formatted;
|
|
35
35
|
});
|
|
36
36
|
} catch (err: any) {
|
|
@@ -39,7 +39,7 @@ export const createFormat = (script: Script.Script) => {
|
|
|
39
39
|
}
|
|
40
40
|
},
|
|
41
41
|
{
|
|
42
|
-
label: ['format
|
|
42
|
+
label: ['format.label', { ns: meta.id }],
|
|
43
43
|
icon: 'ph--magic-wand--regular',
|
|
44
44
|
},
|
|
45
45
|
);
|
package/src/hooks/template.ts
CHANGED
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
+
import { Script } from '@dxos/compute';
|
|
5
6
|
import { Obj } from '@dxos/echo';
|
|
6
|
-
import { FUNCTIONS_PRESET_META_KEY
|
|
7
|
+
import { FUNCTIONS_PRESET_META_KEY } from '@dxos/functions';
|
|
7
8
|
import { createMenuAction } from '@dxos/react-ui-menu';
|
|
8
9
|
|
|
9
10
|
import { templates } from '../templates';
|
|
@@ -15,9 +16,9 @@ const createTemplateSelectActions = (script: Script.Script) => {
|
|
|
15
16
|
return createMenuAction<TemplateActionProperties>(
|
|
16
17
|
`template--${template.id}`,
|
|
17
18
|
() => {
|
|
18
|
-
Obj.
|
|
19
|
-
|
|
20
|
-
const meta = Obj.getMeta(
|
|
19
|
+
Obj.update(script, (script) => {
|
|
20
|
+
script.name = template.name;
|
|
21
|
+
const meta = Obj.getMeta(script);
|
|
21
22
|
const oldPresetIndex = meta.keys.findIndex((key) => key.source === FUNCTIONS_PRESET_META_KEY);
|
|
22
23
|
if (oldPresetIndex >= 0) {
|
|
23
24
|
meta.keys.splice(oldPresetIndex, 1);
|
|
@@ -27,7 +28,7 @@ const createTemplateSelectActions = (script: Script.Script) => {
|
|
|
27
28
|
}
|
|
28
29
|
});
|
|
29
30
|
if (script.source?.target) {
|
|
30
|
-
Obj.
|
|
31
|
+
Obj.update(script.source.target, (obj) => {
|
|
31
32
|
obj.content = template.source;
|
|
32
33
|
});
|
|
33
34
|
}
|
package/src/hooks/useCompiler.ts
CHANGED
|
@@ -6,9 +6,10 @@ import { useCapabilities, usePluginManager } from '@dxos/app-framework/ui';
|
|
|
6
6
|
import { runAndForwardErrors } from '@dxos/effect';
|
|
7
7
|
import { useAsyncEffect } from '@dxos/react-ui';
|
|
8
8
|
|
|
9
|
+
import { ScriptEvents } from '#types';
|
|
10
|
+
import { ScriptCapabilities } from '#types';
|
|
11
|
+
|
|
9
12
|
import type { Compiler } from '../compiler';
|
|
10
|
-
import { ScriptEvents } from '../types';
|
|
11
|
-
import { ScriptCapabilities } from '../types';
|
|
12
13
|
|
|
13
14
|
/**
|
|
14
15
|
* Asynchronously sets up the compiler and returns it.
|
|
@@ -5,15 +5,16 @@
|
|
|
5
5
|
import { useCallback, useState } from 'react';
|
|
6
6
|
|
|
7
7
|
import { useOperationInvoker } from '@dxos/app-framework/ui';
|
|
8
|
+
import { Script } from '@dxos/compute';
|
|
8
9
|
import { Obj } from '@dxos/echo';
|
|
9
|
-
import { Script } from '@dxos/functions';
|
|
10
10
|
import { invariant } from '@dxos/invariant';
|
|
11
|
-
import { SpaceOperation } from '@dxos/plugin-space
|
|
11
|
+
import { SpaceOperation } from '@dxos/plugin-space';
|
|
12
12
|
import { useClient } from '@dxos/react-client';
|
|
13
13
|
import { type Space } from '@dxos/react-client/echo';
|
|
14
14
|
|
|
15
|
+
import { ScriptOperation } from '#types';
|
|
16
|
+
|
|
15
17
|
import { type Template } from '../templates';
|
|
16
|
-
import { ScriptOperation } from '../operations';
|
|
17
18
|
import { deployScript } from '../util';
|
|
18
19
|
|
|
19
20
|
type DeploymentStatus = 'idle' | 'pending' | 'success' | 'error';
|
package/src/index.ts
CHANGED
|
@@ -2,10 +2,7 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
export
|
|
6
|
-
export * from './components';
|
|
7
|
-
export * from './containers';
|
|
5
|
+
export * from './blueprints';
|
|
8
6
|
export * from './meta';
|
|
7
|
+
export * from './types';
|
|
9
8
|
export * from './util';
|
|
10
|
-
|
|
11
|
-
export * from './ScriptPlugin';
|
package/src/meta.ts
CHANGED
|
@@ -8,6 +8,7 @@ import { trim } from '@dxos/util';
|
|
|
8
8
|
export const meta: Plugin.Meta = {
|
|
9
9
|
id: 'org.dxos.plugin.script',
|
|
10
10
|
name: 'Scripts',
|
|
11
|
+
author: 'DXOS',
|
|
11
12
|
description: trim`
|
|
12
13
|
Write and deploy custom JavaScript functions that extend your workspace capabilities.
|
|
13
14
|
Create AI agent tools, spreadsheet formulas, and automation scripts that integrate seamlessly with other plugins.
|
|
@@ -7,7 +7,7 @@ import { describe, expect, test } from 'vitest';
|
|
|
7
7
|
|
|
8
8
|
import { Obj } from '@dxos/echo';
|
|
9
9
|
|
|
10
|
-
import { createNotebook } from '
|
|
10
|
+
import { createNotebook } from '#testing';
|
|
11
11
|
|
|
12
12
|
import { ComputeGraph } from './compute-graph';
|
|
13
13
|
|
|
@@ -43,8 +43,8 @@ describe('notebook', () => {
|
|
|
43
43
|
// Replace one of the cells with code that tries to access window/document.
|
|
44
44
|
const sourceTarget = notebook.cells[2].source?.target;
|
|
45
45
|
if (sourceTarget) {
|
|
46
|
-
Obj.
|
|
47
|
-
|
|
46
|
+
Obj.update(sourceTarget, (sourceTarget) => {
|
|
47
|
+
sourceTarget.content = 'b = typeof window';
|
|
48
48
|
});
|
|
49
49
|
}
|
|
50
50
|
|
|
@@ -57,8 +57,8 @@ describe('notebook', () => {
|
|
|
57
57
|
|
|
58
58
|
// Test document access.
|
|
59
59
|
if (sourceTarget) {
|
|
60
|
-
Obj.
|
|
61
|
-
|
|
60
|
+
Obj.update(sourceTarget, (sourceTarget) => {
|
|
61
|
+
sourceTarget.content = 'b = typeof document';
|
|
62
62
|
});
|
|
63
63
|
}
|
|
64
64
|
graph.parse();
|
|
@@ -69,8 +69,8 @@ describe('notebook', () => {
|
|
|
69
69
|
|
|
70
70
|
// Test that safe globals still work.
|
|
71
71
|
if (sourceTarget) {
|
|
72
|
-
Obj.
|
|
73
|
-
|
|
72
|
+
Obj.update(sourceTarget, (sourceTarget) => {
|
|
73
|
+
sourceTarget.content = 'b = Math.max(100, 200)';
|
|
74
74
|
});
|
|
75
75
|
}
|
|
76
76
|
graph.parse();
|
|
@@ -6,7 +6,7 @@ import { Atom, type Registry } from '@effect-atom/atom-react';
|
|
|
6
6
|
|
|
7
7
|
import { log } from '@dxos/log';
|
|
8
8
|
|
|
9
|
-
import { type Notebook } from '
|
|
9
|
+
import { type Notebook } from '#types';
|
|
10
10
|
|
|
11
11
|
import { evalScript } from './eval';
|
|
12
12
|
import { type ParsedExpression, VirtualTypeScriptParser } from './vfs-parser';
|
|
@@ -42,6 +42,7 @@ export class VirtualTypeScriptParser {
|
|
|
42
42
|
protected compilerOptions: ts.CompilerOptions = {
|
|
43
43
|
target: ts.ScriptTarget.ES2020,
|
|
44
44
|
module: ts.ModuleKind.ESNext,
|
|
45
|
+
moduleResolution: ts.ModuleResolutionKind.Bundler,
|
|
45
46
|
strict: true,
|
|
46
47
|
esModuleInterop: true,
|
|
47
48
|
skipLibCheck: true,
|
|
@@ -91,7 +92,9 @@ export class VirtualTypeScriptParser {
|
|
|
91
92
|
// Analyze each file.
|
|
92
93
|
files.forEach((file) => {
|
|
93
94
|
const sourceFile = env.getSourceFile(file.filename);
|
|
94
|
-
if (!sourceFile || !typeChecker)
|
|
95
|
+
if (!sourceFile || !typeChecker) {
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
95
98
|
|
|
96
99
|
const fileResults = this.analyzeSourceFile(sourceFile, typeChecker);
|
|
97
100
|
results.push(...fileResults);
|
|
@@ -207,7 +210,9 @@ export class VirtualTypeScriptParser {
|
|
|
207
210
|
signature: ts.Signature | undefined,
|
|
208
211
|
typeChecker: ts.TypeChecker,
|
|
209
212
|
): Array<{ name: string; type: string }> {
|
|
210
|
-
if (!signature)
|
|
213
|
+
if (!signature) {
|
|
214
|
+
return [];
|
|
215
|
+
}
|
|
211
216
|
|
|
212
217
|
return signature.parameters.map((param) => ({
|
|
213
218
|
name: param.getName(),
|
|
@@ -429,7 +434,9 @@ export class NotebookVirtualParser extends VirtualTypeScriptParser {
|
|
|
429
434
|
const previousExports = new Set<string>();
|
|
430
435
|
for (const [_prevCellId, prevAnalysis] of cellAnalysis) {
|
|
431
436
|
prevAnalysis.exports.forEach((exp) => {
|
|
432
|
-
if (exp.name)
|
|
437
|
+
if (exp.name) {
|
|
438
|
+
previousExports.add(exp.name);
|
|
439
|
+
}
|
|
433
440
|
});
|
|
434
441
|
}
|
|
435
442
|
|
|
@@ -5,13 +5,12 @@
|
|
|
5
5
|
import { Octokit } from '@octokit/core';
|
|
6
6
|
import * as Effect from 'effect/Effect';
|
|
7
7
|
|
|
8
|
-
import { Script } from '@dxos/
|
|
9
|
-
import { Operation } from '@dxos/operation';
|
|
8
|
+
import { Script, Operation } from '@dxos/compute';
|
|
10
9
|
|
|
11
10
|
import { templates } from '../templates';
|
|
12
|
-
import {
|
|
11
|
+
import { ScriptOperation } from '../types';
|
|
13
12
|
|
|
14
|
-
const handler: Operation.WithHandler<typeof CreateScript> = CreateScript.pipe(
|
|
13
|
+
const handler: Operation.WithHandler<typeof ScriptOperation.CreateScript> = ScriptOperation.CreateScript.pipe(
|
|
15
14
|
Operation.withHandler(
|
|
16
15
|
Effect.fnUntraced(function* ({ name, gistUrl, initialTemplateId }) {
|
|
17
16
|
let source = templates[0].source;
|
package/src/operations/index.ts
CHANGED
|
@@ -2,11 +2,6 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { OperationHandlerSet } from '@dxos/
|
|
5
|
+
import { OperationHandlerSet } from '@dxos/compute';
|
|
6
6
|
|
|
7
|
-
export
|
|
8
|
-
|
|
9
|
-
export const ScriptOperationHandlerSet = OperationHandlerSet.lazy(
|
|
10
|
-
() => import('./access-token-created'),
|
|
11
|
-
() => import('./create-script'),
|
|
12
|
-
);
|
|
7
|
+
export const ScriptOperationHandlerSet = OperationHandlerSet.lazy(() => import('./create-script'));
|
package/src/plugin.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { Plugin } from '@dxos/app-framework';
|
|
6
|
+
|
|
7
|
+
import { meta } from './meta';
|
|
8
|
+
|
|
9
|
+
export const ScriptPlugin = Plugin.lazy(meta, () => import('#plugin'));
|
|
10
|
+
|
|
11
|
+
export { ScriptOperationHandlerSet } from './operations';
|
|
@@ -9,7 +9,7 @@ import * as Schema from 'effect/Schema';
|
|
|
9
9
|
import * as Stream from 'effect/Stream';
|
|
10
10
|
|
|
11
11
|
import { AiService } from '@dxos/ai';
|
|
12
|
-
import { Operation } from '@dxos/
|
|
12
|
+
import { Operation } from '@dxos/compute';
|
|
13
13
|
|
|
14
14
|
const Anthropic = Operation.make({
|
|
15
15
|
meta: {
|
|
@@ -6,9 +6,10 @@ import { Chess as ChessJS } from 'chess.js';
|
|
|
6
6
|
import * as Effect from 'effect/Effect';
|
|
7
7
|
import * as Schema from 'effect/Schema';
|
|
8
8
|
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import { Chess } from '@dxos/plugin-chess
|
|
9
|
+
import { Operation } from '@dxos/compute';
|
|
10
|
+
import { Database, Obj } from '@dxos/echo';
|
|
11
|
+
import { Chess } from '@dxos/plugin-chess';
|
|
12
|
+
import { GameRef, Game, loadGame } from '@dxos/plugin-game';
|
|
12
13
|
|
|
13
14
|
const ChessBot = Operation.make({
|
|
14
15
|
meta: {
|
|
@@ -17,7 +18,7 @@ const ChessBot = Operation.make({
|
|
|
17
18
|
description: 'Plays a random move in a chess game.',
|
|
18
19
|
},
|
|
19
20
|
input: Schema.Struct({
|
|
20
|
-
game:
|
|
21
|
+
game: GameRef(Chess.State).annotations({
|
|
21
22
|
description: 'The chess game to comment on.',
|
|
22
23
|
}),
|
|
23
24
|
player: Schema.optional(Schema.Literal('white', 'black')).annotations({
|
|
@@ -29,16 +30,16 @@ const ChessBot = Operation.make({
|
|
|
29
30
|
description: 'The state of the game as an ASCII art board.',
|
|
30
31
|
}),
|
|
31
32
|
}),
|
|
32
|
-
types: [Chess.
|
|
33
|
+
types: [Game, Chess.State],
|
|
33
34
|
services: [Database.Service],
|
|
34
35
|
});
|
|
35
36
|
|
|
36
37
|
export default ChessBot.pipe(
|
|
37
38
|
Operation.withHandler(
|
|
38
39
|
Effect.fnUntraced(function* ({ game, player = 'black' }) {
|
|
39
|
-
const
|
|
40
|
+
const { variant } = yield* loadGame(game, Chess.State);
|
|
40
41
|
const chess = new ChessJS();
|
|
41
|
-
chess.loadPgn(
|
|
42
|
+
chess.loadPgn(variant.pgn ?? '');
|
|
42
43
|
if (chess.turn() !== (player === 'white' ? 'w' : 'b')) {
|
|
43
44
|
return { state: chess.ascii() };
|
|
44
45
|
}
|
|
@@ -51,8 +52,9 @@ export default ChessBot.pipe(
|
|
|
51
52
|
|
|
52
53
|
chess.move(move.san);
|
|
53
54
|
const newPgn = chess.pgn();
|
|
54
|
-
Obj.
|
|
55
|
-
|
|
55
|
+
Obj.update(variant, (variant) => {
|
|
56
|
+
const mutable = variant as Obj.Mutable<typeof variant>;
|
|
57
|
+
mutable.pgn = newPgn;
|
|
56
58
|
});
|
|
57
59
|
yield* Database.flush();
|
|
58
60
|
return { state: chess.ascii() };
|