@dxos/plugin-script 0.8.4-main.e8ec1fe → 0.8.4-main.effb148878
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/README.md +15 -13
- package/dist/lib/neutral/DeploymentDialog-M3AFYQHC.mjs +114 -0
- package/dist/lib/neutral/DeploymentDialog-M3AFYQHC.mjs.map +7 -0
- package/dist/lib/{browser/NotebookContainer-RTESC4OV.mjs → neutral/NotebookArticle-NV4AHOOS.mjs} +245 -299
- package/dist/lib/neutral/NotebookArticle-NV4AHOOS.mjs.map +7 -0
- package/dist/lib/neutral/ScriptArticle-UBT27SB6.mjs +79 -0
- 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/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/neutral/blueprint-definition-T33SBPP2.mjs +15 -0
- package/dist/lib/neutral/blueprint-definition-T33SBPP2.mjs.map +7 -0
- package/dist/lib/neutral/blueprints/index.mjs +10 -0
- 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/neutral/chunk-2REUEDUA.mjs +56 -0
- package/dist/lib/neutral/chunk-2REUEDUA.mjs.map +7 -0
- package/dist/lib/neutral/chunk-4H6UOE5J.mjs +123 -0
- package/dist/lib/neutral/chunk-4H6UOE5J.mjs.map +7 -0
- package/dist/lib/neutral/chunk-6XGGYOY2.mjs +36 -0
- package/dist/lib/neutral/chunk-6XGGYOY2.mjs.map +7 -0
- package/dist/lib/neutral/chunk-GD5SNDAA.mjs +8 -0
- package/dist/lib/neutral/chunk-GD5SNDAA.mjs.map +7 -0
- package/dist/lib/neutral/chunk-GYQPDUTK.mjs +105 -0
- package/dist/lib/neutral/chunk-GYQPDUTK.mjs.map +7 -0
- package/dist/lib/neutral/chunk-HJ4BY42S.mjs +8 -0
- package/dist/lib/neutral/chunk-HJ4BY42S.mjs.map +7 -0
- package/dist/lib/neutral/chunk-VXDJH6OL.mjs +150 -0
- package/dist/lib/neutral/chunk-VXDJH6OL.mjs.map +7 -0
- package/dist/lib/neutral/chunk-WEIU4BCS.mjs +52 -0
- package/dist/lib/neutral/chunk-WEIU4BCS.mjs.map +7 -0
- package/dist/lib/neutral/chunk-Y3O3YZSE.mjs +345 -0
- package/dist/lib/neutral/chunk-Y3O3YZSE.mjs.map +7 -0
- package/dist/lib/neutral/compiler-ODK4UA2N.mjs +101 -0
- package/dist/lib/neutral/compiler-ODK4UA2N.mjs.map +7 -0
- package/dist/lib/neutral/components/index.mjs +722 -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-32MZYUAA.mjs +46 -0
- package/dist/lib/neutral/create-32MZYUAA.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-6HWJMXMD.mjs +45 -0
- package/dist/lib/neutral/create-script-6HWJMXMD.mjs.map +7 -0
- package/dist/lib/neutral/delete-475DHFZO.mjs +21 -0
- package/dist/lib/neutral/delete-475DHFZO.mjs.map +7 -0
- package/dist/lib/neutral/deploy-VMPGXUR2.mjs +63 -0
- package/dist/lib/neutral/deploy-VMPGXUR2.mjs.map +7 -0
- package/dist/lib/neutral/hooks/index.mjs +369 -0
- package/dist/lib/neutral/hooks/index.mjs.map +7 -0
- package/dist/lib/neutral/index.mjs +41 -0
- package/dist/lib/neutral/inspect-invocations-IHZDHE27.mjs +59 -0
- package/dist/lib/neutral/inspect-invocations-IHZDHE27.mjs.map +7 -0
- package/dist/lib/neutral/install-function-UJWJMTZY.mjs +49 -0
- package/dist/lib/neutral/install-function-UJWJMTZY.mjs.map +7 -0
- package/dist/lib/neutral/invoke-M7J6LRZB.mjs +32 -0
- package/dist/lib/neutral/invoke-M7J6LRZB.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-MOATB7ZI.mjs +18 -0
- package/dist/lib/neutral/operation-handler-MOATB7ZI.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-MZUBGLJG.mjs +34 -0
- package/dist/lib/neutral/query-deployed-functions-MZUBGLJG.mjs.map +7 -0
- package/dist/lib/neutral/react-surface-DPK6XU2Y.mjs +120 -0
- package/dist/lib/neutral/react-surface-DPK6XU2Y.mjs.map +7 -0
- package/dist/lib/neutral/read-LWLI7RB2.mjs +26 -0
- package/dist/lib/neutral/read-LWLI7RB2.mjs.map +7 -0
- package/dist/lib/neutral/settings-VJBW4OMK.mjs +30 -0
- 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-HTFIQY2Z.mjs +63 -0
- package/dist/lib/neutral/update-HTFIQY2Z.mjs.map +7 -0
- package/dist/types/src/ScriptPlugin.d.ts +3 -1
- 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/index.d.ts +2 -0
- package/dist/types/src/blueprints/index.d.ts.map +1 -0
- package/dist/types/src/blueprints/script-blueprint.d.ts +4 -0
- package/dist/types/src/blueprints/script-blueprint.d.ts.map +1 -0
- package/dist/types/src/capabilities/app-graph-builder.d.ts +4 -2
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
- package/dist/types/src/capabilities/artifact-definition.d.ts +3 -2
- package/dist/types/src/capabilities/artifact-definition.d.ts.map +1 -1
- package/dist/types/src/capabilities/blueprint-definition.d.ts +5 -4
- package/dist/types/src/capabilities/blueprint-definition.d.ts.map +1 -1
- package/dist/types/src/capabilities/compiler.d.ts +3 -1
- package/dist/types/src/capabilities/compiler.d.ts.map +1 -1
- 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 -7
- 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 +3 -2
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
- package/dist/types/src/capabilities/settings.d.ts +5 -2
- package/dist/types/src/capabilities/settings.d.ts.map +1 -1
- package/dist/types/src/compiler/compiler.d.ts +1 -1
- package/dist/types/src/compiler/compiler.d.ts.map +1 -1
- package/dist/types/src/components/{FrameContainer/FrameContainer.d.ts → FramePanel/FramePanel.d.ts} +3 -3
- package/dist/types/src/components/FramePanel/FramePanel.d.ts.map +1 -0
- package/dist/types/src/components/FramePanel/index.d.ts +2 -0
- package/dist/types/src/components/FramePanel/index.d.ts.map +1 -0
- package/dist/types/src/components/NotebookStack/NotebookCell.d.ts +4 -4
- 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 +5 -3
- package/dist/types/src/components/NotebookStack/NotebookStack.d.ts.map +1 -1
- package/dist/types/src/components/NotebookStack/NotebookStack.stories.d.ts +221 -226
- package/dist/types/src/components/NotebookStack/NotebookStack.stories.d.ts.map +1 -1
- package/dist/types/src/components/QueryEditor/QueryEditor.d.ts +5 -0
- package/dist/types/src/components/QueryEditor/QueryEditor.d.ts.map +1 -0
- package/dist/types/src/components/QueryEditor/QueryEditor.stories.d.ts +13 -0
- package/dist/types/src/components/QueryEditor/QueryEditor.stories.d.ts.map +1 -0
- package/dist/types/src/components/QueryEditor/index.d.ts +2 -0
- package/dist/types/src/components/QueryEditor/index.d.ts.map +1 -0
- 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 +8 -6
- package/dist/types/src/components/ScriptToolbar/ScriptToolbar.d.ts.map +1 -1
- package/dist/types/src/components/ScriptToolbar/ScriptToolbar.stories.d.ts +221 -226
- 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/TestPanel/index.d.ts +0 -1
- package/dist/types/src/components/TestPanel/index.d.ts.map +1 -1
- package/dist/types/src/components/TypescriptEditor/TypescriptEditor.d.ts +6 -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 +6 -5
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/constants.d.ts +2 -0
- package/dist/types/src/constants.d.ts.map +1 -0
- package/dist/types/src/{components → containers}/DeploymentDialog/DeploymentDialog.d.ts +0 -2
- package/dist/types/src/containers/DeploymentDialog/DeploymentDialog.d.ts.map +1 -0
- package/dist/types/src/containers/DeploymentDialog/DeploymentDialog.stories.d.ts +240 -0
- package/dist/types/src/containers/DeploymentDialog/DeploymentDialog.stories.d.ts.map +1 -0
- package/dist/types/src/containers/DeploymentDialog/index.d.ts +2 -0
- package/dist/types/src/containers/DeploymentDialog/index.d.ts.map +1 -0
- 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 +6 -0
- package/dist/types/src/containers/ScriptProperties/ScriptProperties.d.ts.map +1 -0
- 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 +2 -0
- package/dist/types/src/containers/ScriptProperties/index.d.ts.map +1 -0
- package/dist/types/src/containers/TestContainer/TestContainer.d.ts +8 -0
- package/dist/types/src/containers/TestContainer/TestContainer.d.ts.map +1 -0
- package/dist/types/src/containers/TestContainer/index.d.ts +2 -0
- package/dist/types/src/containers/TestContainer/index.d.ts.map +1 -0
- package/dist/types/src/containers/index.d.ts +7 -0
- package/dist/types/src/containers/index.d.ts.map +1 -0
- package/dist/types/src/e2e/ai.test.d.ts +2 -0
- package/dist/types/src/e2e/ai.test.d.ts.map +1 -0
- package/dist/types/src/e2e/deploy.test.d.ts +2 -0
- package/dist/types/src/e2e/deploy.test.d.ts.map +1 -0
- package/dist/types/src/hooks/deploy.d.ts +24 -29
- package/dist/types/src/hooks/deploy.d.ts.map +1 -1
- package/dist/types/src/hooks/format.d.ts +4 -3
- package/dist/types/src/hooks/format.d.ts.map +1 -1
- package/dist/types/src/hooks/index.d.ts +1 -0
- package/dist/types/src/hooks/index.d.ts.map +1 -1
- package/dist/types/src/hooks/template.d.ts +4 -3
- package/dist/types/src/hooks/template.d.ts.map +1 -1
- package/dist/types/src/hooks/useCompiler.d.ts +7 -0
- package/dist/types/src/hooks/useCompiler.d.ts.map +1 -0
- package/dist/types/src/hooks/useCreateAndDeployScriptTemplates.d.ts.map +1 -1
- package/dist/types/src/hooks/useToolbarState.d.ts +8 -1
- package/dist/types/src/hooks/useToolbarState.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +2 -3
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +2 -2
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/notebook/compute-graph.d.ts +25 -12
- 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 +7 -0
- package/dist/types/src/templates/anthropic.d.ts.map +1 -0
- package/dist/types/src/templates/chat.d.ts.map +1 -1
- package/dist/types/src/templates/chess-bot.d.ts +14 -0
- package/dist/types/src/templates/chess-bot.d.ts.map +1 -0
- package/dist/types/src/templates/commentary.d.ts +15 -0
- package/dist/types/src/templates/commentary.d.ts.map +1 -0
- 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 +5 -1
- package/dist/types/src/templates/forex-effect.d.ts.map +1 -1
- package/dist/types/src/templates/forex.d.ts +5 -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 +33 -24
- package/dist/types/src/templates/index.d.ts.map +1 -1
- package/dist/types/src/templates/ping.d.ts +2 -4
- 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/simulator.test.d.ts +2 -0
- package/dist/types/src/testing/simulator.test.d.ts.map +1 -0
- 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 -90
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/Notebook.d.ts +110 -24
- 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 -2
- 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 +185 -107
- package/src/ScriptPlugin.node.ts +21 -0
- package/src/ScriptPlugin.test.ts +31 -0
- package/src/ScriptPlugin.tsx +24 -94
- 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/index.ts +5 -0
- package/src/blueprints/script-blueprint.ts +55 -0
- package/src/capabilities/app-graph-builder.ts +40 -58
- package/src/capabilities/artifact-definition.ts +99 -97
- package/src/capabilities/blueprint-definition.ts +13 -24
- package/src/capabilities/compiler.ts +99 -22
- package/src/capabilities/create-object.ts +49 -0
- package/src/capabilities/index.ts +13 -9
- package/src/capabilities/node.ts +16 -0
- package/src/capabilities/operation-handler.ts +21 -0
- package/src/capabilities/react-surface.tsx +120 -93
- package/src/capabilities/settings.ts +26 -14
- package/src/compiler/compiler.ts +21 -3
- package/src/components/{FrameContainer/FrameContainer.tsx → FramePanel/FramePanel.tsx} +7 -6
- package/src/components/{FrameContainer → FramePanel}/index.ts +1 -1
- package/src/components/NotebookStack/NotebookCell.tsx +45 -33
- package/src/components/NotebookStack/NotebookMenu.tsx +7 -7
- package/src/components/NotebookStack/NotebookStack.stories.tsx +24 -25
- package/src/components/NotebookStack/NotebookStack.tsx +31 -20
- package/src/components/QueryEditor/QueryEditor.stories.tsx +96 -0
- package/src/components/QueryEditor/QueryEditor.tsx +49 -0
- package/src/components/QueryEditor/index.ts +5 -0
- 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 +42 -20
- package/src/components/ScriptToolbar/ScriptToolbar.tsx +38 -43
- package/src/components/TestPanel/TestPanel.tsx +111 -194
- package/src/components/TestPanel/index.ts +0 -1
- package/src/components/TypescriptEditor/TypescriptEditor.stories.tsx +25 -18
- package/src/components/TypescriptEditor/TypescriptEditor.tsx +74 -66
- package/src/components/index.ts +6 -7
- package/src/constants.ts +7 -0
- package/src/containers/DeploymentDialog/DeploymentDialog.stories.tsx +63 -0
- package/src/containers/DeploymentDialog/DeploymentDialog.tsx +99 -0
- package/src/containers/DeploymentDialog/index.ts +5 -0
- package/src/containers/NotebookArticle/NotebookArticle.stories.tsx +85 -0
- package/src/containers/NotebookArticle/NotebookArticle.tsx +255 -0
- package/src/containers/NotebookArticle/index.ts +5 -0
- package/src/containers/ScriptArticle/ScriptArticle.stories.tsx +107 -0
- package/src/containers/ScriptArticle/ScriptArticle.tsx +85 -0
- 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 +24 -0
- package/src/containers/ScriptProperties/index.ts +5 -0
- package/src/containers/TestContainer/TestContainer.tsx +44 -0
- package/src/containers/TestContainer/index.ts +5 -0
- package/src/containers/index.ts +11 -0
- package/src/e2e/ai.test.ts +93 -0
- package/src/e2e/deploy.test.ts +66 -0
- package/src/hooks/deploy.ts +45 -35
- package/src/hooks/format.ts +9 -4
- package/src/hooks/index.ts +1 -0
- package/src/hooks/template.ts +19 -12
- package/src/hooks/useCompiler.ts +25 -0
- package/src/hooks/useCreateAndDeployScriptTemplates.ts +15 -20
- package/src/hooks/useToolbarState.ts +29 -4
- package/src/index.ts +2 -4
- package/src/meta.ts +11 -6
- package/src/notebook/compute-graph.test.ts +21 -9
- package/src/notebook/compute-graph.ts +46 -22
- 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 +49 -0
- package/src/templates/chat.ts +1 -1
- package/src/templates/chess-bot.ts +63 -0
- package/src/templates/commentary.ts +248 -0
- package/src/templates/data-generator.ts +2 -2
- package/src/templates/discord.ts +5 -5
- package/src/templates/forex-effect.ts +35 -29
- package/src/templates/forex.ts +27 -17
- package/src/templates/gmail.ts +6 -6
- package/src/templates/index.ts +31 -18
- package/src/templates/ping.ts +22 -5
- package/src/testing/index.ts +2 -1
- package/src/testing/simulator.test.ts +39 -0
- package/src/testing/{data.ts → test-notebook.ts} +12 -13
- package/src/testing/test-script.ts +28 -0
- package/src/translations.ts +89 -87
- package/src/types/Notebook.ts +20 -19
- 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 -2
- package/src/types/types.ts +1 -11
- package/src/util/deploy.ts +29 -33
- package/src/util/functions.ts +32 -28
- package/src/vite-env.d.ts +2 -0
- package/dist/lib/browser/DeploymentDialog-MZX4T77L.mjs +0 -14
- package/dist/lib/browser/NotebookContainer-RTESC4OV.mjs.map +0 -7
- package/dist/lib/browser/ScriptContainer-T2BAZDJ4.mjs +0 -147
- package/dist/lib/browser/ScriptContainer-T2BAZDJ4.mjs.map +0 -7
- package/dist/lib/browser/app-graph-builder-2WR2ATTJ.mjs +0 -66
- package/dist/lib/browser/app-graph-builder-2WR2ATTJ.mjs.map +0 -7
- package/dist/lib/browser/blueprint-definition-6PZWZM2Y.mjs +0 -30
- package/dist/lib/browser/blueprint-definition-6PZWZM2Y.mjs.map +0 -7
- package/dist/lib/browser/chunk-2G2NA6DQ.mjs +0 -88
- package/dist/lib/browser/chunk-2G2NA6DQ.mjs.map +0 -7
- package/dist/lib/browser/chunk-3IJASGG5.mjs +0 -155
- package/dist/lib/browser/chunk-3IJASGG5.mjs.map +0 -7
- package/dist/lib/browser/chunk-4M7U2WVT.mjs +0 -304
- package/dist/lib/browser/chunk-4M7U2WVT.mjs.map +0 -7
- package/dist/lib/browser/chunk-5JSNQYZZ.mjs +0 -517
- package/dist/lib/browser/chunk-5JSNQYZZ.mjs.map +0 -7
- package/dist/lib/browser/chunk-EB6AXFXO.mjs +0 -31
- package/dist/lib/browser/chunk-EB6AXFXO.mjs.map +0 -7
- package/dist/lib/browser/chunk-GAFCKEII.mjs +0 -646
- package/dist/lib/browser/chunk-GAFCKEII.mjs.map +0 -7
- package/dist/lib/browser/chunk-LNNCD2H4.mjs +0 -102
- package/dist/lib/browser/chunk-LNNCD2H4.mjs.map +0 -7
- package/dist/lib/browser/chunk-M6KJPUJK.mjs +0 -111
- package/dist/lib/browser/chunk-M6KJPUJK.mjs.map +0 -7
- package/dist/lib/browser/chunk-UOQ6NCH3.mjs +0 -15
- package/dist/lib/browser/chunk-UOQ6NCH3.mjs.map +0 -7
- package/dist/lib/browser/compiler-4KHRSX7J.mjs +0 -86
- package/dist/lib/browser/compiler-4KHRSX7J.mjs.map +0 -7
- package/dist/lib/browser/index.mjs +0 -273
- package/dist/lib/browser/index.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-AFJ575VK.mjs +0 -104
- package/dist/lib/browser/intent-resolver-AFJ575VK.mjs.map +0 -7
- package/dist/lib/browser/meta.json +0 -1
- package/dist/lib/browser/react-surface-QEQ3QUQA.mjs +0 -128
- package/dist/lib/browser/react-surface-QEQ3QUQA.mjs.map +0 -7
- package/dist/lib/browser/settings-LNLSTZM4.mjs +0 -26
- package/dist/lib/browser/settings-LNLSTZM4.mjs.map +0 -7
- package/dist/lib/browser/types/index.mjs +0 -14
- package/dist/lib/node-esm/DeploymentDialog-GL5AUWMR.mjs +0 -15
- package/dist/lib/node-esm/NotebookContainer-SVD3A3D6.mjs +0 -818
- package/dist/lib/node-esm/NotebookContainer-SVD3A3D6.mjs.map +0 -7
- package/dist/lib/node-esm/ScriptContainer-2CE3H3JJ.mjs +0 -148
- package/dist/lib/node-esm/ScriptContainer-2CE3H3JJ.mjs.map +0 -7
- package/dist/lib/node-esm/app-graph-builder-NCVLUL5R.mjs +0 -67
- package/dist/lib/node-esm/app-graph-builder-NCVLUL5R.mjs.map +0 -7
- package/dist/lib/node-esm/blueprint-definition-5R6YCSZZ.mjs +0 -31
- package/dist/lib/node-esm/blueprint-definition-5R6YCSZZ.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-55JZVM6K.mjs +0 -16
- package/dist/lib/node-esm/chunk-55JZVM6K.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-57JA6XL5.mjs +0 -90
- package/dist/lib/node-esm/chunk-57JA6XL5.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-HDKR5WCD.mjs +0 -113
- package/dist/lib/node-esm/chunk-HDKR5WCD.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-IBV2DR36.mjs +0 -33
- package/dist/lib/node-esm/chunk-IBV2DR36.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-IQTBVH4L.mjs +0 -518
- package/dist/lib/node-esm/chunk-IQTBVH4L.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-KJKZ4KNO.mjs +0 -647
- package/dist/lib/node-esm/chunk-KJKZ4KNO.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-NNHWLRHT.mjs +0 -103
- package/dist/lib/node-esm/chunk-NNHWLRHT.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-RIE676OW.mjs +0 -156
- package/dist/lib/node-esm/chunk-RIE676OW.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-YRTA4EHU.mjs +0 -305
- package/dist/lib/node-esm/chunk-YRTA4EHU.mjs.map +0 -7
- package/dist/lib/node-esm/compiler-DU5NQISX.mjs +0 -87
- package/dist/lib/node-esm/compiler-DU5NQISX.mjs.map +0 -7
- package/dist/lib/node-esm/index.mjs +0 -274
- package/dist/lib/node-esm/index.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-A5VVK746.mjs +0 -105
- package/dist/lib/node-esm/intent-resolver-A5VVK746.mjs.map +0 -7
- package/dist/lib/node-esm/meta.json +0 -1
- package/dist/lib/node-esm/react-surface-U77YT7VF.mjs +0 -129
- package/dist/lib/node-esm/react-surface-U77YT7VF.mjs.map +0 -7
- package/dist/lib/node-esm/settings-IUFMOCXY.mjs +0 -27
- package/dist/lib/node-esm/settings-IUFMOCXY.mjs.map +0 -7
- package/dist/lib/node-esm/templates/index.mjs +0 -11
- package/dist/lib/node-esm/types/index.mjs +0 -15
- package/dist/types/src/capabilities/capabilities.d.ts +0 -5
- package/dist/types/src/capabilities/capabilities.d.ts.map +0 -1
- package/dist/types/src/capabilities/intent-resolver.d.ts +0 -4
- package/dist/types/src/capabilities/intent-resolver.d.ts.map +0 -1
- package/dist/types/src/components/DeploymentDialog/DeploymentDialog.d.ts.map +0 -1
- package/dist/types/src/components/DeploymentDialog/DeploymentDialog.stories.d.ts +0 -248
- package/dist/types/src/components/DeploymentDialog/DeploymentDialog.stories.d.ts.map +0 -1
- package/dist/types/src/components/DeploymentDialog/index.d.ts +0 -4
- package/dist/types/src/components/DeploymentDialog/index.d.ts.map +0 -1
- 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/components/NotebookContainer.d.ts +0 -10
- package/dist/types/src/components/NotebookContainer.d.ts.map +0 -1
- package/dist/types/src/components/NotebookContainer.stories.d.ts +0 -251
- package/dist/types/src/components/NotebookContainer.stories.d.ts.map +0 -1
- package/dist/types/src/components/ScriptContainer.d.ts +0 -12
- package/dist/types/src/components/ScriptContainer.d.ts.map +0 -1
- package/dist/types/src/components/Settings/ScriptObjectSettings.d.ts +0 -8
- package/dist/types/src/components/Settings/ScriptObjectSettings.d.ts.map +0 -1
- package/dist/types/src/components/Settings/ScriptPluginSettings.d.ts +0 -6
- package/dist/types/src/components/Settings/ScriptPluginSettings.d.ts.map +0 -1
- package/dist/types/src/components/Settings/index.d.ts +0 -3
- package/dist/types/src/components/Settings/index.d.ts.map +0 -1
- package/dist/types/src/components/TestPanel/TestContainer.d.ts +0 -8
- package/dist/types/src/components/TestPanel/TestContainer.d.ts.map +0 -1
- package/dist/types/src/events.d.ts +0 -4
- package/dist/types/src/events.d.ts.map +0 -1
- package/dist/types/src/templates/chess.d.ts +0 -3
- package/dist/types/src/templates/chess.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 -54
- package/dist/types/src/types/actions.d.ts.map +0 -1
- package/src/capabilities/capabilities.ts +0 -12
- package/src/capabilities/intent-resolver.ts +0 -86
- package/src/components/DeploymentDialog/DeploymentDialog.stories.tsx +0 -58
- package/src/components/DeploymentDialog/DeploymentDialog.tsx +0 -123
- package/src/components/DeploymentDialog/index.ts +0 -9
- package/src/components/FrameContainer/frame.html +0 -25
- package/src/components/FrameContainer/frame.tsx +0 -51
- package/src/components/NotebookContainer.stories.tsx +0 -83
- package/src/components/NotebookContainer.tsx +0 -263
- package/src/components/ScriptContainer.tsx +0 -69
- package/src/components/Settings/ScriptObjectSettings.tsx +0 -297
- package/src/components/Settings/ScriptPluginSettings.tsx +0 -61
- package/src/components/Settings/index.ts +0 -6
- package/src/components/TestPanel/TestContainer.tsx +0 -27
- package/src/events.ts +0 -11
- package/src/templates/chess.ts +0 -49
- package/src/types/actions.ts +0 -53
- /package/dist/lib/{browser/templates → 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/types → neutral}/index.mjs.map +0 -0
- /package/dist/lib/{browser/DeploymentDialog-MZX4T77L.mjs.map → neutral/meta.mjs.map} +0 -0
- /package/dist/lib/{node-esm/templates → neutral/operations}/index.mjs.map +0 -0
- /package/dist/lib/{node-esm/types → neutral/templates}/index.mjs.map +0 -0
- /package/dist/lib/{node-esm/DeploymentDialog-GL5AUWMR.mjs.map → neutral/types/index.mjs.map} +0 -0
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { next as A, type Doc } from '@automerge/automerge';
|
|
6
|
+
import * as Effect from 'effect/Effect';
|
|
7
|
+
|
|
8
|
+
import { type Script, Operation } from '@dxos/compute';
|
|
9
|
+
import { Database, Obj } from '@dxos/echo';
|
|
10
|
+
import { DocAccessor, createDocAccessor } from '@dxos/echo-db';
|
|
11
|
+
|
|
12
|
+
import { Update } from './definitions';
|
|
13
|
+
|
|
14
|
+
export default Update.pipe(
|
|
15
|
+
Operation.withHandler(
|
|
16
|
+
Effect.fn(function* ({ function: fn, name, description, edits }) {
|
|
17
|
+
const loaded = yield* Database.load(fn);
|
|
18
|
+
if (!loaded.source) {
|
|
19
|
+
return yield* Effect.fail(new Error('Function has no source script.'));
|
|
20
|
+
}
|
|
21
|
+
const script = (yield* Database.load(loaded.source)) as Script.Script;
|
|
22
|
+
|
|
23
|
+
if (name !== undefined || description !== undefined) {
|
|
24
|
+
Obj.update(script, (script) => {
|
|
25
|
+
if (name !== undefined) {
|
|
26
|
+
script.name = name;
|
|
27
|
+
}
|
|
28
|
+
if (description !== undefined) {
|
|
29
|
+
script.description = description;
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
if (edits && edits.length > 0) {
|
|
35
|
+
const text = yield* Database.load(script.source);
|
|
36
|
+
const accessor = createDocAccessor(text, ['content']);
|
|
37
|
+
|
|
38
|
+
for (const edit of edits) {
|
|
39
|
+
accessor.handle.change((doc: Doc<typeof text>) => {
|
|
40
|
+
const source = DocAccessor.getValue<string>(accessor);
|
|
41
|
+
if (edit.replaceAll) {
|
|
42
|
+
let idx = source.indexOf(edit.oldString);
|
|
43
|
+
while (idx !== -1) {
|
|
44
|
+
A.splice(doc, accessor.path as A.Prop[], idx, edit.oldString.length, edit.newString);
|
|
45
|
+
const updated = DocAccessor.getValue<string>(accessor);
|
|
46
|
+
idx = updated.indexOf(edit.oldString, idx + edit.newString.length);
|
|
47
|
+
}
|
|
48
|
+
} else {
|
|
49
|
+
const idx = source.indexOf(edit.oldString);
|
|
50
|
+
if (idx === -1) {
|
|
51
|
+
throw new Error(`Edit not found: ${JSON.stringify(edit.oldString)}`);
|
|
52
|
+
}
|
|
53
|
+
A.splice(doc, accessor.path as A.Prop[], idx, edit.oldString.length, edit.newString);
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
Obj.update(script, (script) => {
|
|
59
|
+
script.changed = true;
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
return {
|
|
64
|
+
function: Obj.getURI(loaded),
|
|
65
|
+
};
|
|
66
|
+
}),
|
|
67
|
+
),
|
|
68
|
+
);
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { Blueprint, Template } from '@dxos/compute';
|
|
6
|
+
import { trim } from '@dxos/util';
|
|
7
|
+
|
|
8
|
+
import {
|
|
9
|
+
Create,
|
|
10
|
+
Read,
|
|
11
|
+
Update,
|
|
12
|
+
Delete,
|
|
13
|
+
Deploy,
|
|
14
|
+
Invoke,
|
|
15
|
+
InspectInvocations,
|
|
16
|
+
QueryDeployedFunctions,
|
|
17
|
+
InstallFunction,
|
|
18
|
+
} from './functions';
|
|
19
|
+
|
|
20
|
+
const BLUEPRINT_KEY = 'org.dxos.blueprint.script';
|
|
21
|
+
|
|
22
|
+
const make = () =>
|
|
23
|
+
Blueprint.make({
|
|
24
|
+
key: BLUEPRINT_KEY,
|
|
25
|
+
name: 'Script',
|
|
26
|
+
agentCanEnable: true,
|
|
27
|
+
tools: Blueprint.toolDefinitions({
|
|
28
|
+
operations: [
|
|
29
|
+
Create,
|
|
30
|
+
Read,
|
|
31
|
+
Update,
|
|
32
|
+
Delete,
|
|
33
|
+
Deploy,
|
|
34
|
+
Invoke,
|
|
35
|
+
InspectInvocations,
|
|
36
|
+
QueryDeployedFunctions,
|
|
37
|
+
InstallFunction,
|
|
38
|
+
],
|
|
39
|
+
}),
|
|
40
|
+
instructions: Template.make({
|
|
41
|
+
source: trim`
|
|
42
|
+
You can create, read, update, and delete scripts which contain TypeScript code.
|
|
43
|
+
You can deploy scripts to the Edge runtime and invoke deployed scripts.
|
|
44
|
+
You can inspect the invocation history of a deployed script.
|
|
45
|
+
You can query all functions deployed to the EDGE runtime and install them into the current space.
|
|
46
|
+
`,
|
|
47
|
+
}),
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
const blueprint: Blueprint.Definition = {
|
|
51
|
+
key: BLUEPRINT_KEY,
|
|
52
|
+
make,
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
export default blueprint;
|
|
@@ -2,64 +2,46 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import
|
|
6
|
-
import * as Function from 'effect/Function';
|
|
7
|
-
import * as Option from 'effect/Option';
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
8
6
|
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import { Script } from '@dxos/
|
|
12
|
-
import {
|
|
13
|
-
import { createExtension } from '@dxos/plugin-graph';
|
|
7
|
+
import { Capability } from '@dxos/app-framework';
|
|
8
|
+
import { AppCapabilities, AppNode } from '@dxos/app-toolkit';
|
|
9
|
+
import { Script } from '@dxos/compute';
|
|
10
|
+
import { GraphBuilder } from '@dxos/plugin-graph';
|
|
14
11
|
|
|
15
|
-
import { meta } from '
|
|
12
|
+
import { meta } from '#meta';
|
|
16
13
|
|
|
17
|
-
export default (
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
{
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
id: [node.id, 'logs'].join(ATTENDABLE_PATH_SEPARATOR),
|
|
52
|
-
type: PLANK_COMPANION_TYPE,
|
|
53
|
-
data: 'logs',
|
|
54
|
-
properties: {
|
|
55
|
-
label: ['script logs label', { ns: meta.id }],
|
|
56
|
-
icon: 'ph--clock-countdown--regular',
|
|
57
|
-
disposition: 'hidden',
|
|
58
|
-
},
|
|
59
|
-
},
|
|
60
|
-
]),
|
|
61
|
-
Option.getOrElse(() => []),
|
|
62
|
-
),
|
|
63
|
-
),
|
|
64
|
-
}),
|
|
65
|
-
]);
|
|
14
|
+
export default Capability.makeModule(
|
|
15
|
+
Effect.fnUntraced(function* () {
|
|
16
|
+
const extensions = yield* Effect.all([
|
|
17
|
+
GraphBuilder.createTypeExtension({
|
|
18
|
+
id: 'execute',
|
|
19
|
+
type: Script.Script,
|
|
20
|
+
connector: () =>
|
|
21
|
+
Effect.succeed([
|
|
22
|
+
AppNode.makeCompanion({
|
|
23
|
+
id: 'execute',
|
|
24
|
+
label: ['script-test.label', { ns: meta.id }],
|
|
25
|
+
icon: 'ph--terminal--regular',
|
|
26
|
+
data: 'execute',
|
|
27
|
+
}),
|
|
28
|
+
]),
|
|
29
|
+
}),
|
|
30
|
+
GraphBuilder.createTypeExtension({
|
|
31
|
+
id: 'logs',
|
|
32
|
+
type: Script.Script,
|
|
33
|
+
connector: () =>
|
|
34
|
+
Effect.succeed([
|
|
35
|
+
AppNode.makeCompanion({
|
|
36
|
+
id: 'logs',
|
|
37
|
+
label: ['script-logs.label', { ns: meta.id }],
|
|
38
|
+
icon: 'ph--clock-countdown--regular',
|
|
39
|
+
data: 'logs',
|
|
40
|
+
}),
|
|
41
|
+
]),
|
|
42
|
+
}),
|
|
43
|
+
]);
|
|
44
|
+
|
|
45
|
+
return Capability.contributes(AppCapabilities.AppGraphBuilder, extensions);
|
|
46
|
+
}),
|
|
47
|
+
);
|
|
@@ -5,19 +5,19 @@
|
|
|
5
5
|
// ISSUE(burdon): defineArtifact
|
|
6
6
|
// @ts-nocheck
|
|
7
7
|
|
|
8
|
+
import * as Effect from 'effect/Effect';
|
|
8
9
|
import * as Schema from 'effect/Schema';
|
|
9
10
|
|
|
10
11
|
import { ToolResult, createTool } from '@dxos/ai';
|
|
11
|
-
import { Capabilities, type PromiseIntentDispatcher,
|
|
12
|
+
import { Capabilities, Capability, type PromiseIntentDispatcher, createIntent } from '@dxos/app-framework';
|
|
12
13
|
import { ArtifactId, createArtifactElement } from '@dxos/assistant';
|
|
13
|
-
import { defineArtifact } from '@dxos/
|
|
14
|
+
import { defineArtifact, ScriptType } from '@dxos/compute';
|
|
14
15
|
import { Filter, Obj, Ref } from '@dxos/echo';
|
|
15
|
-
import { ScriptType } from '@dxos/functions';
|
|
16
16
|
import { invariant } from '@dxos/invariant';
|
|
17
|
-
import { SpaceAction } from '@dxos/plugin-space
|
|
17
|
+
import { SpaceAction } from '@dxos/plugin-space';
|
|
18
18
|
import { type Space } from '@dxos/react-client/echo';
|
|
19
19
|
|
|
20
|
-
import { meta } from '
|
|
20
|
+
import { meta } from '#meta';
|
|
21
21
|
|
|
22
22
|
// TODO(burdon): Factor out.
|
|
23
23
|
declare global {
|
|
@@ -27,14 +27,15 @@ declare global {
|
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
export default () =>
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
30
|
+
export default Capability.makeModule(() =>
|
|
31
|
+
Effect.sync(() => {
|
|
32
|
+
const definition = defineArtifact({
|
|
33
|
+
id: `artifact:${meta.id}`,
|
|
34
|
+
name: meta.name,
|
|
35
|
+
// TODO(dmaretskyi): Since writing scripts requires a lot of domain knowledge,
|
|
36
|
+
// we should offload the work of synthesizing the code to a separate model.
|
|
37
|
+
// The main reasoning model will give it a concrete task and the script model will synthesize the code, knowing all the docs.
|
|
38
|
+
instructions: `
|
|
38
39
|
If the user explicitly requests you to write a script, you can create one.
|
|
39
40
|
If the user requests you to change one of the existing script, you can update it.
|
|
40
41
|
You must not create a script unless the user explicitly requests it.
|
|
@@ -54,7 +55,7 @@ export default () => {
|
|
|
54
55
|
The description is used by AI to understand the script and its purpose.
|
|
55
56
|
The description must provide cases on when the script should be used.
|
|
56
57
|
|
|
57
|
-
Schema:
|
|
58
|
+
Schema:
|
|
58
59
|
The schema is defined using a schema-DSL library called Effect Schema.
|
|
59
60
|
The input schema describes the arguments that the script accepts.
|
|
60
61
|
The output schema describes the result that the script produces.
|
|
@@ -75,18 +76,18 @@ export default () => {
|
|
|
75
76
|
- Detailed output schema
|
|
76
77
|
|
|
77
78
|
<apis>
|
|
78
|
-
export function defineFunction(params: {
|
|
79
|
-
description: string,
|
|
80
|
-
inputSchema: Schema.Schema,
|
|
81
|
-
outputSchema: Schema.Schema,
|
|
82
|
-
handler: (params: { event: { data: TInput } }) => Promise<TOutput>
|
|
79
|
+
export function defineFunction(params: {
|
|
80
|
+
description: string,
|
|
81
|
+
inputSchema: Schema.Schema,
|
|
82
|
+
outputSchema: Schema.Schema,
|
|
83
|
+
handler: (params: { event: { data: TInput } }) => Promise<TOutput>
|
|
83
84
|
}): FunctionDefinition
|
|
84
85
|
/**
|
|
85
86
|
* Effect Schema
|
|
86
87
|
*/
|
|
87
|
-
export const Schema;
|
|
88
|
+
export const Schema;
|
|
88
89
|
|
|
89
|
-
// Examples:
|
|
90
|
+
// Examples:
|
|
90
91
|
|
|
91
92
|
Schema.String
|
|
92
93
|
Schema.Number
|
|
@@ -104,7 +105,7 @@ export default () => {
|
|
|
104
105
|
<handler_function>
|
|
105
106
|
Async function that takes the argument in the form of:
|
|
106
107
|
|
|
107
|
-
type
|
|
108
|
+
type HandlerFunctionProp = {
|
|
108
109
|
event: {
|
|
109
110
|
data: T // The input schema
|
|
110
111
|
},
|
|
@@ -112,7 +113,7 @@ export default () => {
|
|
|
112
113
|
|
|
113
114
|
The function must return the result that matches the output schema.
|
|
114
115
|
</handler_function>
|
|
115
|
-
|
|
116
|
+
|
|
116
117
|
<example>
|
|
117
118
|
import { defineFunction, S } from 'dxos:functions';
|
|
118
119
|
|
|
@@ -143,82 +144,83 @@ export default () => {
|
|
|
143
144
|
});
|
|
144
145
|
</example>
|
|
145
146
|
`,
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
147
|
+
schema: ScriptType,
|
|
148
|
+
tools: [
|
|
149
|
+
createTool(meta.id, {
|
|
150
|
+
name: 'create',
|
|
151
|
+
description: 'Create a new script. Returns the artifact definition for the script',
|
|
152
|
+
caption: 'Creating script...',
|
|
153
|
+
schema: Schema.Struct({
|
|
154
|
+
name: Schema.String.annotations({ description: 'The name of the script' }),
|
|
155
|
+
code: Schema.String.annotations({
|
|
156
|
+
description: 'The full code of the script in JavaScript or TypeScript. Must be valid executable code.',
|
|
157
|
+
}),
|
|
156
158
|
}),
|
|
159
|
+
execute: async ({ name, code }, { extensions }) => {
|
|
160
|
+
invariant(extensions?.space, 'No space');
|
|
161
|
+
invariant(extensions?.dispatch, 'No intent dispatcher');
|
|
162
|
+
const script = Obj.make(ScriptType, { name, source: Ref.make(Text.make({ content: code })) });
|
|
163
|
+
extensions.space.db.add(script);
|
|
164
|
+
await extensions.space.db.flush();
|
|
165
|
+
|
|
166
|
+
const intent = createIntent(SpaceAction.AddObject, { target: extensions.space, object: script });
|
|
167
|
+
const { data, error } = await extensions.dispatch(intent);
|
|
168
|
+
if (!data || error) {
|
|
169
|
+
return ToolResult.Error(error?.message ?? 'Failed to create chess game');
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
return ToolResult.Success(createArtifactElement(script.id));
|
|
173
|
+
},
|
|
157
174
|
}),
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
description: 'Inspect a script. Returns the artifact definition for the script',
|
|
177
|
-
caption: 'Inspecting script...',
|
|
178
|
-
schema: Schema.Struct({
|
|
179
|
-
id: ArtifactId,
|
|
175
|
+
createTool(meta.id, {
|
|
176
|
+
name: 'inspect',
|
|
177
|
+
description: 'Inspect a script. Returns the artifact definition for the script',
|
|
178
|
+
caption: 'Inspecting script...',
|
|
179
|
+
schema: Schema.Struct({
|
|
180
|
+
id: ArtifactId,
|
|
181
|
+
}),
|
|
182
|
+
execute: async ({ id }, { extensions }) => {
|
|
183
|
+
invariant(extensions?.space, 'No space');
|
|
184
|
+
|
|
185
|
+
const script = (await extensions.space.db.query(Filter.id(id)).first()) as ScriptType;
|
|
186
|
+
const { content } = await script.source.load();
|
|
187
|
+
|
|
188
|
+
return ToolResult.Success({
|
|
189
|
+
name: script.name,
|
|
190
|
+
code: content,
|
|
191
|
+
});
|
|
192
|
+
},
|
|
180
193
|
}),
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
});
|
|
191
|
-
},
|
|
192
|
-
}),
|
|
193
|
-
createTool(meta.id, {
|
|
194
|
-
name: 'update',
|
|
195
|
-
description: 'Update a script. Returns the artifact definition for the script',
|
|
196
|
-
caption: 'Updating script...',
|
|
197
|
-
schema: Schema.Struct({
|
|
198
|
-
id: ArtifactId,
|
|
199
|
-
code: Schema.String.annotations({
|
|
200
|
-
description: 'The full code of the script in JavaScript or TypeScript. Must be valid executable code.',
|
|
194
|
+
createTool(meta.id, {
|
|
195
|
+
name: 'update',
|
|
196
|
+
description: 'Update a script. Returns the artifact definition for the script',
|
|
197
|
+
caption: 'Updating script...',
|
|
198
|
+
schema: Schema.Struct({
|
|
199
|
+
id: ArtifactId,
|
|
200
|
+
code: Schema.String.annotations({
|
|
201
|
+
description: 'The full code of the script in JavaScript or TypeScript. Must be valid executable code.',
|
|
202
|
+
}),
|
|
201
203
|
}),
|
|
204
|
+
execute: async ({ id, code }, { extensions }) => {
|
|
205
|
+
invariant(extensions?.space, 'No space');
|
|
206
|
+
|
|
207
|
+
const script = (await extensions.space.db.query(Filter.id(id)).first()) as ScriptType;
|
|
208
|
+
const source = await script.source.load();
|
|
209
|
+
if (!source) {
|
|
210
|
+
return ToolResult.Error('Script not found');
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
source.content = code;
|
|
214
|
+
await extensions.space?.db.flush();
|
|
215
|
+
|
|
216
|
+
return ToolResult.Success({
|
|
217
|
+
name: script.name,
|
|
218
|
+
});
|
|
219
|
+
},
|
|
202
220
|
}),
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
return ToolResult.Error('Script not found');
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
source.content = code;
|
|
213
|
-
await extensions.space?.db.flush();
|
|
214
|
-
|
|
215
|
-
return ToolResult.Success({
|
|
216
|
-
name: script.name,
|
|
217
|
-
});
|
|
218
|
-
},
|
|
219
|
-
}),
|
|
220
|
-
],
|
|
221
|
-
});
|
|
222
|
-
|
|
223
|
-
return contributes(Capabilities.ArtifactDefinition, definition);
|
|
224
|
-
};
|
|
221
|
+
],
|
|
222
|
+
});
|
|
223
|
+
|
|
224
|
+
return Capability.contributes(Capabilities.ArtifactDefinition, definition);
|
|
225
|
+
}),
|
|
226
|
+
);
|
|
@@ -2,29 +2,18 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import
|
|
6
|
-
import { Blueprint, Template } from '@dxos/blueprints';
|
|
7
|
-
import { type FunctionDefinition } from '@dxos/functions';
|
|
8
|
-
import { trim } from '@dxos/util';
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
9
6
|
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
import { Capability } from '@dxos/app-framework';
|
|
8
|
+
import { AppCapabilities } from '@dxos/app-toolkit';
|
|
9
|
+
// eslint-disable-next-line unused-imports/no-unused-imports
|
|
10
|
+
import type { Blueprint } from '@dxos/compute';
|
|
12
11
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
tools: Blueprint.toolDefinitions({ functions, tools }),
|
|
22
|
-
instructions: Template.make({
|
|
23
|
-
source: trim`
|
|
24
|
-
You can create and update scripts which contain Typescript code.
|
|
25
|
-
`,
|
|
26
|
-
}),
|
|
27
|
-
}),
|
|
28
|
-
),
|
|
29
|
-
];
|
|
30
|
-
};
|
|
12
|
+
import { ScriptBlueprint } from '#blueprints';
|
|
13
|
+
|
|
14
|
+
const blueprintDefinition = Capability.makeModule<
|
|
15
|
+
[],
|
|
16
|
+
Capability.Capability<typeof AppCapabilities.BlueprintDefinition>[]
|
|
17
|
+
>(() => Effect.succeed([Capability.contributes(AppCapabilities.BlueprintDefinition, ScriptBlueprint)]));
|
|
18
|
+
|
|
19
|
+
export default blueprintDefinition;
|