@dxos/plugin-script 0.8.4-main.72ec0f3 → 0.8.4-main.7996785055
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/README.md +15 -13
- package/dist/lib/browser/DeploymentDialog-LGEGIX64.mjs +124 -0
- package/dist/lib/browser/DeploymentDialog-LGEGIX64.mjs.map +7 -0
- package/dist/lib/browser/{NotebookContainer-RTESC4OV.mjs → NotebookContainer-CC3G32Q5.mjs} +281 -248
- package/dist/lib/browser/NotebookContainer-CC3G32Q5.mjs.map +7 -0
- package/dist/lib/browser/ScriptContainer-Z3MCPN2D.mjs +95 -0
- package/dist/lib/browser/ScriptContainer-Z3MCPN2D.mjs.map +7 -0
- package/dist/lib/browser/ScriptObjectSettings-LST7DUAN.mjs +297 -0
- package/dist/lib/browser/ScriptObjectSettings-LST7DUAN.mjs.map +7 -0
- package/dist/lib/browser/ScriptPluginSettings-IKWRISC3.mjs +55 -0
- package/dist/lib/browser/ScriptPluginSettings-IKWRISC3.mjs.map +7 -0
- package/dist/lib/browser/ScriptProperties-ZCRTZTAK.mjs +28 -0
- package/dist/lib/browser/ScriptProperties-ZCRTZTAK.mjs.map +7 -0
- package/dist/lib/browser/TestContainer-ACNQMKVU.mjs +61 -0
- package/dist/lib/browser/TestContainer-ACNQMKVU.mjs.map +7 -0
- package/dist/lib/browser/access-token-created-ZHVVOEL7.mjs +36 -0
- package/dist/lib/browser/access-token-created-ZHVVOEL7.mjs.map +7 -0
- package/dist/lib/browser/app-graph-builder-QPXX4YK5.mjs +63 -0
- package/dist/lib/browser/app-graph-builder-QPXX4YK5.mjs.map +7 -0
- package/dist/lib/browser/blueprint-definition-MC264VR5.mjs +17 -0
- package/dist/lib/browser/blueprint-definition-MC264VR5.mjs.map +7 -0
- package/dist/lib/browser/blueprints/index.mjs +8 -0
- package/dist/lib/browser/{chunk-EB6AXFXO.mjs → chunk-37XPSUAH.mjs} +3 -3
- package/dist/lib/browser/chunk-37XPSUAH.mjs.map +7 -0
- package/dist/lib/browser/chunk-4XJSGCAS.mjs +742 -0
- package/dist/lib/browser/chunk-4XJSGCAS.mjs.map +7 -0
- package/dist/lib/browser/chunk-7JI376EM.mjs +20 -0
- package/dist/lib/browser/chunk-7JI376EM.mjs.map +7 -0
- package/dist/lib/browser/{compiler-4KHRSX7J.mjs → chunk-ATTZUDT7.mjs} +14 -33
- package/dist/lib/browser/chunk-ATTZUDT7.mjs.map +7 -0
- package/dist/lib/browser/chunk-BHRCZLLU.mjs +105 -0
- package/dist/lib/browser/chunk-BHRCZLLU.mjs.map +7 -0
- package/dist/lib/browser/chunk-CMHREENI.mjs +8 -0
- package/dist/lib/browser/chunk-CMHREENI.mjs.map +7 -0
- package/dist/lib/browser/chunk-DBEYGFVF.mjs +400 -0
- package/dist/lib/browser/chunk-DBEYGFVF.mjs.map +7 -0
- package/dist/lib/browser/chunk-E6BQ4P6L.mjs +179 -0
- package/dist/lib/browser/chunk-E6BQ4P6L.mjs.map +7 -0
- package/dist/lib/browser/chunk-GB2HL4ZE.mjs +26 -0
- package/dist/lib/browser/chunk-GB2HL4ZE.mjs.map +7 -0
- package/dist/lib/browser/chunk-NQJRENSK.mjs +75 -0
- package/dist/lib/browser/chunk-NQJRENSK.mjs.map +7 -0
- package/dist/lib/browser/chunk-QLFFA4Y4.mjs +52 -0
- package/dist/lib/browser/chunk-QLFFA4Y4.mjs.map +7 -0
- package/dist/lib/browser/chunk-X44CJ7F5.mjs +11 -0
- package/dist/lib/browser/chunk-X44CJ7F5.mjs.map +7 -0
- package/dist/lib/browser/compiler-MZKFKYCG.mjs +98 -0
- package/dist/lib/browser/compiler-MZKFKYCG.mjs.map +7 -0
- package/dist/lib/browser/create-script-Z7J4HDV2.mjs +47 -0
- package/dist/lib/browser/create-script-Z7J4HDV2.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +124 -129
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/operation-handler-76AHUB5G.mjs +18 -0
- package/dist/lib/browser/operation-handler-76AHUB5G.mjs.map +7 -0
- package/dist/lib/browser/operations/index.mjs +14 -0
- package/dist/lib/browser/react-surface-2VVUIV66.mjs +145 -0
- package/dist/lib/browser/react-surface-2VVUIV66.mjs.map +7 -0
- package/dist/lib/browser/settings-BV3KXROF.mjs +35 -0
- package/dist/lib/browser/settings-BV3KXROF.mjs.map +7 -0
- package/dist/lib/browser/templates/index.mjs +1 -1
- package/dist/lib/browser/types/index.mjs +6 -5
- package/dist/lib/node-esm/DeploymentDialog-XSP2EDU2.mjs +125 -0
- package/dist/lib/node-esm/DeploymentDialog-XSP2EDU2.mjs.map +7 -0
- package/dist/lib/node-esm/{NotebookContainer-SVD3A3D6.mjs → NotebookContainer-LNWMJD2D.mjs} +281 -248
- package/dist/lib/node-esm/NotebookContainer-LNWMJD2D.mjs.map +7 -0
- package/dist/lib/node-esm/ScriptContainer-TSU4DBGA.mjs +96 -0
- package/dist/lib/node-esm/ScriptContainer-TSU4DBGA.mjs.map +7 -0
- package/dist/lib/node-esm/ScriptObjectSettings-OGY7X3UE.mjs +298 -0
- package/dist/lib/node-esm/ScriptObjectSettings-OGY7X3UE.mjs.map +7 -0
- package/dist/lib/node-esm/ScriptPluginSettings-HIUSAHCP.mjs +56 -0
- package/dist/lib/node-esm/ScriptPluginSettings-HIUSAHCP.mjs.map +7 -0
- package/dist/lib/node-esm/ScriptProperties-I6SC4P3R.mjs +29 -0
- package/dist/lib/node-esm/ScriptProperties-I6SC4P3R.mjs.map +7 -0
- package/dist/lib/node-esm/TestContainer-WKISNRNU.mjs +62 -0
- package/dist/lib/node-esm/TestContainer-WKISNRNU.mjs.map +7 -0
- package/dist/lib/node-esm/access-token-created-7CGU7FXD.mjs +37 -0
- package/dist/lib/node-esm/access-token-created-7CGU7FXD.mjs.map +7 -0
- package/dist/lib/node-esm/app-graph-builder-GNGOYXIU.mjs +64 -0
- package/dist/lib/node-esm/app-graph-builder-GNGOYXIU.mjs.map +7 -0
- package/dist/lib/node-esm/blueprint-definition-DTRGTRZA.mjs +18 -0
- package/dist/lib/node-esm/blueprint-definition-DTRGTRZA.mjs.map +7 -0
- package/dist/lib/node-esm/blueprints/index.mjs +9 -0
- package/dist/lib/node-esm/blueprints/index.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-2NGQCFVE.mjs +28 -0
- package/dist/lib/node-esm/chunk-2NGQCFVE.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-4YAEFFW2.mjs +12 -0
- package/dist/lib/node-esm/chunk-4YAEFFW2.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-C3GH2SDF.mjs +76 -0
- package/dist/lib/node-esm/chunk-C3GH2SDF.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-CKYUNEE5.mjs +10 -0
- package/dist/lib/node-esm/chunk-CKYUNEE5.mjs.map +7 -0
- package/dist/lib/node-esm/{compiler-DU5NQISX.mjs → chunk-JGN7TDJH.mjs} +14 -32
- package/dist/lib/node-esm/chunk-JGN7TDJH.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-IBV2DR36.mjs → chunk-L3JLWXB5.mjs} +3 -3
- package/dist/lib/node-esm/chunk-L3JLWXB5.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-L55OBVT5.mjs +53 -0
- package/dist/lib/node-esm/chunk-L55OBVT5.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-P4Q2BPBB.mjs +22 -0
- package/dist/lib/node-esm/chunk-P4Q2BPBB.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-RN2SMYCL.mjs +401 -0
- package/dist/lib/node-esm/chunk-RN2SMYCL.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-RTM3D4T5.mjs +181 -0
- package/dist/lib/node-esm/chunk-RTM3D4T5.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-SV742UH7.mjs +743 -0
- package/dist/lib/node-esm/chunk-SV742UH7.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-Y5VWHRVU.mjs +107 -0
- package/dist/lib/node-esm/chunk-Y5VWHRVU.mjs.map +7 -0
- package/dist/lib/node-esm/compiler-QBWP7ERK.mjs +99 -0
- package/dist/lib/node-esm/compiler-QBWP7ERK.mjs.map +7 -0
- package/dist/lib/node-esm/create-script-TAJHVROB.mjs +48 -0
- package/dist/lib/node-esm/create-script-TAJHVROB.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +124 -129
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/operation-handler-OUROH3T7.mjs +19 -0
- package/dist/lib/node-esm/operation-handler-OUROH3T7.mjs.map +7 -0
- package/dist/lib/node-esm/operations/index.mjs +15 -0
- package/dist/lib/node-esm/operations/index.mjs.map +7 -0
- package/dist/lib/node-esm/react-surface-OJ55GFCP.mjs +146 -0
- package/dist/lib/node-esm/react-surface-OJ55GFCP.mjs.map +7 -0
- package/dist/lib/node-esm/settings-2TK3XPLD.mjs +36 -0
- package/dist/lib/node-esm/settings-2TK3XPLD.mjs.map +7 -0
- package/dist/lib/node-esm/templates/index.mjs +1 -1
- package/dist/lib/node-esm/types/index.mjs +6 -5
- package/dist/types/src/ScriptPlugin.d.ts +2 -1
- package/dist/types/src/ScriptPlugin.d.ts.map +1 -1
- 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/app-graph-builder.d.ts +6 -0
- package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts.map +1 -0
- package/dist/types/src/capabilities/app-graph-builder/index.d.ts +3 -0
- package/dist/types/src/capabilities/app-graph-builder/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/artifact-definition/artifact-definition.d.ts +12 -0
- package/dist/types/src/capabilities/artifact-definition/artifact-definition.d.ts.map +1 -0
- package/dist/types/src/capabilities/artifact-definition/index.d.ts +3 -0
- package/dist/types/src/capabilities/artifact-definition/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/blueprint-definition/blueprint-definition.d.ts +6 -0
- package/dist/types/src/capabilities/blueprint-definition/blueprint-definition.d.ts.map +1 -0
- package/dist/types/src/capabilities/blueprint-definition/index.d.ts +3 -0
- package/dist/types/src/capabilities/blueprint-definition/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/compiler/compiler.d.ts +6 -0
- package/dist/types/src/capabilities/compiler/compiler.d.ts.map +1 -0
- package/dist/types/src/capabilities/compiler/index.d.ts +3 -0
- package/dist/types/src/capabilities/compiler/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +6 -7
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/operation-handler/index.d.ts +4 -0
- package/dist/types/src/capabilities/operation-handler/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/operation-handler/operation-handler.d.ts +6 -0
- package/dist/types/src/capabilities/operation-handler/operation-handler.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface/index.d.ts +3 -0
- package/dist/types/src/capabilities/react-surface/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts +5 -0
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +1 -0
- package/dist/types/src/capabilities/settings/index.d.ts +7 -0
- package/dist/types/src/capabilities/settings/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/settings/settings.d.ts +10 -0
- package/dist/types/src/capabilities/settings/settings.d.ts.map +1 -0
- 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 +3 -3
- package/dist/types/src/components/NotebookStack/NotebookCell.d.ts.map +1 -1
- package/dist/types/src/components/NotebookStack/NotebookStack.d.ts +8 -2
- package/dist/types/src/components/NotebookStack/NotebookStack.d.ts.map +1 -1
- package/dist/types/src/components/NotebookStack/NotebookStack.stories.d.ts +8 -1
- 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/ScriptToolbar/ScriptToolbar.d.ts +11 -5
- package/dist/types/src/components/ScriptToolbar/ScriptToolbar.d.ts.map +1 -1
- package/dist/types/src/components/ScriptToolbar/ScriptToolbar.stories.d.ts +8 -1
- package/dist/types/src/components/ScriptToolbar/ScriptToolbar.stories.d.ts.map +1 -1
- package/dist/types/src/components/TestPanel/TestPanel.d.ts +8 -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 +9 -2
- package/dist/types/src/components/TypescriptEditor/TypescriptEditor.d.ts.map +1 -1
- package/dist/types/src/components/TypescriptEditor/TypescriptEditor.stories.d.ts +7 -1
- package/dist/types/src/components/TypescriptEditor/TypescriptEditor.stories.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +4 -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/{components → containers}/DeploymentDialog/DeploymentDialog.stories.d.ts +7 -3
- package/dist/types/src/containers/DeploymentDialog/DeploymentDialog.stories.d.ts.map +1 -0
- package/dist/types/src/containers/DeploymentDialog/index.d.ts +3 -0
- package/dist/types/src/containers/DeploymentDialog/index.d.ts.map +1 -0
- package/dist/types/src/containers/NotebookContainer/NotebookContainer.d.ts +7 -0
- package/dist/types/src/containers/NotebookContainer/NotebookContainer.d.ts.map +1 -0
- package/dist/types/src/containers/NotebookContainer/NotebookContainer.stories.d.ts +7 -0
- package/dist/types/src/containers/NotebookContainer/NotebookContainer.stories.d.ts.map +1 -0
- package/dist/types/src/containers/NotebookContainer/index.d.ts +3 -0
- package/dist/types/src/containers/NotebookContainer/index.d.ts.map +1 -0
- package/dist/types/src/containers/ScriptContainer/ScriptContainer.d.ts +10 -0
- package/dist/types/src/containers/ScriptContainer/ScriptContainer.d.ts.map +1 -0
- package/dist/types/src/containers/ScriptContainer/index.d.ts +3 -0
- package/dist/types/src/containers/ScriptContainer/index.d.ts.map +1 -0
- package/dist/types/src/{components/Settings → containers/ScriptObjectSettings}/ScriptObjectSettings.d.ts +0 -1
- package/dist/types/src/containers/ScriptObjectSettings/ScriptObjectSettings.d.ts.map +1 -0
- package/dist/types/src/containers/ScriptObjectSettings/index.d.ts +3 -0
- package/dist/types/src/containers/ScriptObjectSettings/index.d.ts.map +1 -0
- package/dist/types/src/containers/ScriptPluginSettings/ScriptPluginSettings.d.ts +8 -0
- package/dist/types/src/containers/ScriptPluginSettings/ScriptPluginSettings.d.ts.map +1 -0
- package/dist/types/src/containers/ScriptPluginSettings/index.d.ts +3 -0
- package/dist/types/src/containers/ScriptPluginSettings/index.d.ts.map +1 -0
- package/dist/types/src/containers/ScriptProperties/ScriptProperties.d.ts +7 -0
- package/dist/types/src/containers/ScriptProperties/ScriptProperties.d.ts.map +1 -0
- package/dist/types/src/containers/ScriptProperties/index.d.ts +3 -0
- package/dist/types/src/containers/ScriptProperties/index.d.ts.map +1 -0
- package/dist/types/src/{components/TestPanel → containers/TestContainer}/TestContainer.d.ts +1 -1
- package/dist/types/src/containers/TestContainer/TestContainer.d.ts.map +1 -0
- package/dist/types/src/containers/TestContainer/index.d.ts +3 -0
- package/dist/types/src/containers/TestContainer/index.d.ts.map +1 -0
- package/dist/types/src/containers/index.d.ts +9 -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 +15 -30
- package/dist/types/src/hooks/deploy.d.ts.map +1 -1
- package/dist/types/src/hooks/format.d.ts +3 -2
- 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 +3 -2
- 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 -1
- 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 +24 -11
- package/dist/types/src/notebook/compute-graph.d.ts.map +1 -1
- package/dist/types/src/operations/access-token-created.d.ts +5 -0
- package/dist/types/src/operations/access-token-created.d.ts.map +1 -0
- 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/definitions.d.ts +28 -0
- package/dist/types/src/operations/definitions.d.ts.map +1 -0
- package/dist/types/src/operations/index.d.ts +4 -0
- package/dist/types/src/operations/index.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/chess-bot.d.ts +18 -0
- package/dist/types/src/templates/chess-bot.d.ts.map +1 -0
- package/dist/types/src/templates/commentary.d.ts +19 -0
- package/dist/types/src/templates/commentary.d.ts.map +1 -0
- 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/index.d.ts +25 -16
- 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/simulator.test.d.ts +2 -0
- package/dist/types/src/testing/simulator.test.d.ts.map +1 -0
- package/dist/types/src/translations.d.ts +4 -0
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/Notebook.d.ts +102 -23
- package/dist/types/src/types/Notebook.d.ts.map +1 -1
- package/dist/types/src/types/capabilities.d.ts +12 -0
- package/dist/types/src/types/capabilities.d.ts.map +1 -0
- package/dist/types/src/types/events.d.ts +5 -0
- package/dist/types/src/types/events.d.ts.map +1 -0
- package/dist/types/src/types/index.d.ts +2 -1
- package/dist/types/src/types/index.d.ts.map +1 -1
- package/dist/types/src/util/deploy.d.ts +3 -2
- package/dist/types/src/util/deploy.d.ts.map +1 -1
- package/dist/types/src/util/functions.d.ts +3 -2
- package/dist/types/src/util/functions.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +125 -87
- package/src/ScriptPlugin.tsx +60 -83
- package/src/blueprints/index.ts +5 -0
- package/src/blueprints/script-blueprint.ts +28 -0
- package/src/capabilities/app-graph-builder/app-graph-builder.ts +56 -0
- package/src/capabilities/app-graph-builder/index.ts +7 -0
- package/src/capabilities/{artifact-definition.ts → artifact-definition/artifact-definition.ts} +97 -94
- package/src/capabilities/artifact-definition/index.ts +7 -0
- package/src/capabilities/blueprint-definition/blueprint-definition.ts +17 -0
- package/src/capabilities/blueprint-definition/index.ts +7 -0
- package/src/capabilities/compiler/compiler.ts +103 -0
- package/src/capabilities/compiler/index.ts +7 -0
- package/src/capabilities/index.ts +6 -10
- package/src/capabilities/operation-handler/index.ts +11 -0
- package/src/capabilities/operation-handler/operation-handler.ts +16 -0
- package/src/capabilities/react-surface/index.ts +7 -0
- package/src/capabilities/react-surface/react-surface.tsx +138 -0
- package/src/capabilities/settings/index.ts +7 -0
- package/src/capabilities/settings/settings.ts +33 -0
- package/src/compiler/compiler.ts +10 -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 +25 -24
- package/src/components/NotebookStack/NotebookStack.stories.tsx +20 -21
- package/src/components/NotebookStack/NotebookStack.tsx +27 -16
- package/src/components/QueryEditor/QueryEditor.stories.tsx +96 -0
- package/src/components/QueryEditor/QueryEditor.tsx +47 -0
- package/src/components/QueryEditor/index.ts +5 -0
- package/src/components/ScriptToolbar/ScriptToolbar.stories.tsx +39 -17
- package/src/components/ScriptToolbar/ScriptToolbar.tsx +35 -40
- package/src/components/TestPanel/TestPanel.tsx +106 -186
- package/src/components/TestPanel/index.ts +0 -1
- package/src/components/TypescriptEditor/TypescriptEditor.stories.tsx +24 -17
- package/src/components/TypescriptEditor/TypescriptEditor.tsx +73 -65
- package/src/components/index.ts +4 -9
- package/src/constants.ts +7 -0
- package/src/{components → containers}/DeploymentDialog/DeploymentDialog.stories.tsx +29 -24
- package/src/containers/DeploymentDialog/DeploymentDialog.tsx +98 -0
- package/src/containers/DeploymentDialog/index.ts +7 -0
- package/src/{components → containers/NotebookContainer}/NotebookContainer.stories.tsx +30 -29
- package/src/{components → containers/NotebookContainer}/NotebookContainer.tsx +88 -83
- package/src/containers/NotebookContainer/index.ts +7 -0
- package/src/containers/ScriptContainer/ScriptContainer.tsx +85 -0
- package/src/containers/ScriptContainer/index.ts +7 -0
- package/src/{components/Settings → containers/ScriptObjectSettings}/ScriptObjectSettings.tsx +65 -67
- package/src/containers/ScriptObjectSettings/index.ts +7 -0
- package/src/{components/Settings → containers/ScriptPluginSettings}/ScriptPluginSettings.tsx +19 -14
- package/src/containers/ScriptPluginSettings/index.ts +7 -0
- package/src/containers/ScriptProperties/ScriptProperties.tsx +33 -0
- package/src/containers/ScriptProperties/index.ts +7 -0
- package/src/containers/TestContainer/TestContainer.tsx +45 -0
- package/src/containers/TestContainer/index.ts +7 -0
- package/src/containers/index.ts +13 -0
- package/src/e2e/ai.test.ts +93 -0
- package/src/e2e/deploy.test.ts +65 -0
- package/src/hooks/deploy.ts +42 -33
- package/src/hooks/format.ts +6 -1
- package/src/hooks/index.ts +1 -0
- package/src/hooks/template.ts +17 -11
- package/src/hooks/useCompiler.ts +24 -0
- package/src/hooks/useCreateAndDeployScriptTemplates.ts +13 -19
- package/src/hooks/useToolbarState.ts +29 -4
- package/src/index.ts +2 -1
- package/src/meta.ts +4 -4
- package/src/notebook/compute-graph.test.ts +20 -8
- package/src/notebook/compute-graph.ts +45 -21
- package/src/operations/access-token-created.ts +36 -0
- package/src/operations/create-script.ts +47 -0
- package/src/operations/definitions.ts +40 -0
- package/src/operations/index.ts +12 -0
- package/src/templates/anthropic.ts +49 -0
- package/src/templates/chat.ts +1 -1
- package/src/templates/chess-bot.ts +61 -0
- package/src/templates/commentary.ts +243 -0
- package/src/templates/data-generator.ts +2 -2
- package/src/templates/discord.ts +3 -3
- package/src/templates/forex-effect.ts +35 -29
- package/src/templates/forex.ts +27 -17
- package/src/templates/gmail.ts +4 -4
- package/src/templates/index.ts +31 -18
- package/src/templates/ping.ts +22 -5
- package/src/testing/simulator.test.ts +40 -0
- package/src/translations.ts +4 -0
- package/src/types/Notebook.ts +19 -15
- package/src/types/capabilities.ts +17 -0
- package/src/types/events.ts +11 -0
- package/src/types/index.ts +2 -1
- package/src/types/types.ts +1 -1
- package/src/util/deploy.ts +28 -32
- package/src/util/functions.ts +30 -26
- 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.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.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/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/node-esm/DeploymentDialog-GL5AUWMR.mjs +0 -15
- 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-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.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/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/types/src/capabilities/app-graph-builder.d.ts +0 -4
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +0 -1
- package/dist/types/src/capabilities/artifact-definition.d.ts +0 -11
- package/dist/types/src/capabilities/artifact-definition.d.ts.map +0 -1
- package/dist/types/src/capabilities/blueprint-definition.d.ts +0 -5
- package/dist/types/src/capabilities/blueprint-definition.d.ts.map +0 -1
- 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/compiler.d.ts +0 -4
- package/dist/types/src/capabilities/compiler.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/capabilities/react-surface.d.ts +0 -4
- package/dist/types/src/capabilities/react-surface.d.ts.map +0 -1
- package/dist/types/src/capabilities/settings.d.ts +0 -4
- package/dist/types/src/capabilities/settings.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.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.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.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/types/actions.d.ts +0 -54
- package/dist/types/src/types/actions.d.ts.map +0 -1
- package/src/capabilities/app-graph-builder.ts +0 -65
- package/src/capabilities/blueprint-definition.ts +0 -30
- package/src/capabilities/capabilities.ts +0 -12
- package/src/capabilities/compiler.ts +0 -34
- package/src/capabilities/intent-resolver.ts +0 -86
- package/src/capabilities/react-surface.tsx +0 -103
- package/src/capabilities/settings.ts +0 -21
- 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/ScriptContainer.tsx +0 -69
- 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/{DeploymentDialog-MZX4T77L.mjs.map → blueprints/index.mjs.map} +0 -0
- /package/dist/lib/{node-esm/DeploymentDialog-GL5AUWMR.mjs.map → browser/operations/index.mjs.map} +0 -0
|
@@ -2,20 +2,18 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import * as Function from 'effect/Function';
|
|
6
5
|
import { useCallback, useState } from 'react';
|
|
7
6
|
|
|
8
|
-
import {
|
|
9
|
-
import { useIntentDispatcher } from '@dxos/app-framework/react';
|
|
7
|
+
import { useOperationInvoker } from '@dxos/app-framework/ui';
|
|
10
8
|
import { Obj } from '@dxos/echo';
|
|
11
9
|
import { Script } from '@dxos/functions';
|
|
12
10
|
import { invariant } from '@dxos/invariant';
|
|
13
|
-
import {
|
|
11
|
+
import { SpaceOperation } from '@dxos/plugin-space/operations';
|
|
14
12
|
import { useClient } from '@dxos/react-client';
|
|
15
13
|
import { type Space } from '@dxos/react-client/echo';
|
|
16
14
|
|
|
17
15
|
import { type Template } from '../templates';
|
|
18
|
-
import {
|
|
16
|
+
import { ScriptOperation } from '../operations';
|
|
19
17
|
import { deployScript } from '../util';
|
|
20
18
|
|
|
21
19
|
type DeploymentStatus = 'idle' | 'pending' | 'success' | 'error';
|
|
@@ -28,7 +26,7 @@ type DeploymentStatus = 'idle' | 'pending' | 'success' | 'error';
|
|
|
28
26
|
* All creation / deployment operations run concurrently for improved performance.
|
|
29
27
|
*/
|
|
30
28
|
export const useCreateAndDeployScriptTemplates = (space: Space | undefined, scriptTemplates: Template[]) => {
|
|
31
|
-
const {
|
|
29
|
+
const { invokePromise } = useOperationInvoker();
|
|
32
30
|
const client = useClient();
|
|
33
31
|
const [status, setStatus] = useState<DeploymentStatus>('idle');
|
|
34
32
|
const [error, setError] = useState<Error | undefined>(undefined);
|
|
@@ -40,24 +38,20 @@ export const useCreateAndDeployScriptTemplates = (space: Space | undefined, scri
|
|
|
40
38
|
|
|
41
39
|
const deploymentResults = await Promise.all(
|
|
42
40
|
scriptTemplates.map(async (template) => {
|
|
43
|
-
const
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
);
|
|
52
|
-
invariant(Obj.instanceOf(Script.Script, result.data?.object));
|
|
53
|
-
|
|
54
|
-
return deployScript({ space, client, script: result.data.object });
|
|
41
|
+
const createResult = await invokePromise(ScriptOperation.CreateScript, {
|
|
42
|
+
db: space.db,
|
|
43
|
+
initialTemplateId: template.id as any,
|
|
44
|
+
});
|
|
45
|
+
invariant(Obj.instanceOf(Script.Script, createResult.data?.object));
|
|
46
|
+
await invokePromise(SpaceOperation.AddObject, { target: space.db, object: createResult.data.object });
|
|
47
|
+
|
|
48
|
+
return deployScript({ space, client, script: createResult.data.object });
|
|
55
49
|
}),
|
|
56
50
|
);
|
|
57
51
|
|
|
58
52
|
const hasErrors = deploymentResults.some((result) => !result.success);
|
|
59
53
|
setStatus(hasErrors ? 'error' : 'success');
|
|
60
|
-
}, [space,
|
|
54
|
+
}, [space, invokePromise, client, scriptTemplates]);
|
|
61
55
|
|
|
62
56
|
// TODO(burdon): Return onCreateAndDeployScripts.
|
|
63
57
|
return { handleCreateAndDeployScripts, status, error };
|
|
@@ -2,15 +2,40 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
+
import { Atom } from '@effect-atom/atom-react';
|
|
5
6
|
import { useMemo } from 'react';
|
|
6
7
|
|
|
7
|
-
import {
|
|
8
|
+
import { Capabilities } from '@dxos/app-framework';
|
|
9
|
+
import { useCapability } from '@dxos/app-framework/ui';
|
|
8
10
|
|
|
9
11
|
import { type DeployState } from './deploy';
|
|
10
12
|
|
|
11
13
|
export type ScriptToolbarState = Partial<DeployState>;
|
|
12
14
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
15
|
+
export type ScriptToolbarStateStore = {
|
|
16
|
+
atom: Atom.Writable<ScriptToolbarState>;
|
|
17
|
+
get value(): ScriptToolbarState;
|
|
18
|
+
update: (updater: (current: ScriptToolbarState) => ScriptToolbarState) => void;
|
|
19
|
+
set: <K extends keyof ScriptToolbarState>(key: K, value: ScriptToolbarState[K]) => void;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export const useToolbarState = (initialState: ScriptToolbarState = {}): ScriptToolbarStateStore => {
|
|
23
|
+
const registry = useCapability(Capabilities.AtomRegistry);
|
|
24
|
+
const atom = useMemo(() => Atom.make<ScriptToolbarState>(initialState), []);
|
|
25
|
+
|
|
26
|
+
return useMemo(
|
|
27
|
+
() => ({
|
|
28
|
+
atom,
|
|
29
|
+
get value() {
|
|
30
|
+
return registry.get(atom);
|
|
31
|
+
},
|
|
32
|
+
update: (updater: (current: ScriptToolbarState) => ScriptToolbarState) => {
|
|
33
|
+
registry.set(atom, updater(registry.get(atom)));
|
|
34
|
+
},
|
|
35
|
+
set: <K extends keyof ScriptToolbarState>(key: K, v: ScriptToolbarState[K]) => {
|
|
36
|
+
registry.set(atom, { ...registry.get(atom), [key]: v });
|
|
37
|
+
},
|
|
38
|
+
}),
|
|
39
|
+
[atom, registry],
|
|
40
|
+
);
|
|
16
41
|
};
|
package/src/index.ts
CHANGED
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
export { ScriptCapabilities } from './
|
|
5
|
+
export { ScriptCapabilities, ScriptEvents } from './types';
|
|
6
6
|
export * from './components';
|
|
7
|
+
export * from './containers';
|
|
7
8
|
export * from './meta';
|
|
8
9
|
export * from './util';
|
|
9
10
|
|
package/src/meta.ts
CHANGED
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { type
|
|
5
|
+
import { type Plugin } from '@dxos/app-framework';
|
|
6
6
|
import { trim } from '@dxos/util';
|
|
7
7
|
|
|
8
|
-
export const meta:
|
|
9
|
-
id: 'dxos.
|
|
8
|
+
export const meta: Plugin.Meta = {
|
|
9
|
+
id: 'org.dxos.plugin.script',
|
|
10
10
|
name: 'Scripts',
|
|
11
11
|
description: trim`
|
|
12
12
|
Write and deploy custom JavaScript functions that extend your workspace capabilities.
|
|
@@ -22,5 +22,5 @@ export const meta: PluginMeta = {
|
|
|
22
22
|
// TODO(ZaymonFC): Configure by scopes?
|
|
23
23
|
export const defaultScriptsForIntegration: Record<string, string[]> = {
|
|
24
24
|
// TODO(wittjosiah): Also include content extraction scripts in the default set.
|
|
25
|
-
'gmail.com': ['dxos.
|
|
25
|
+
'gmail.com': ['org.dxos.script.gmail'],
|
|
26
26
|
};
|
|
@@ -2,16 +2,20 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
+
import { Registry } from '@effect-atom/atom-react';
|
|
5
6
|
import { describe, expect, test } from 'vitest';
|
|
6
7
|
|
|
8
|
+
import { Obj } from '@dxos/echo';
|
|
9
|
+
|
|
7
10
|
import { createNotebook } from '../testing';
|
|
8
11
|
|
|
9
12
|
import { ComputeGraph } from './compute-graph';
|
|
10
13
|
|
|
11
14
|
describe('notebook', () => {
|
|
12
15
|
test('parse dependency graph', async () => {
|
|
16
|
+
const registry = Registry.make();
|
|
13
17
|
const notebook = createNotebook();
|
|
14
|
-
const graph = new ComputeGraph(notebook);
|
|
18
|
+
const graph = new ComputeGraph(notebook, registry);
|
|
15
19
|
const result = graph.parse();
|
|
16
20
|
|
|
17
21
|
const getId = (i: number) => notebook.cells[i].id;
|
|
@@ -34,13 +38,17 @@ describe('notebook', () => {
|
|
|
34
38
|
});
|
|
35
39
|
|
|
36
40
|
test('evalScript blocks access to window and document', async () => {
|
|
41
|
+
const registry = Registry.make();
|
|
37
42
|
const notebook = createNotebook();
|
|
38
43
|
// Replace one of the cells with code that tries to access window/document.
|
|
39
|
-
|
|
40
|
-
|
|
44
|
+
const sourceTarget = notebook.cells[2].source?.target;
|
|
45
|
+
if (sourceTarget) {
|
|
46
|
+
Obj.change(sourceTarget, (obj) => {
|
|
47
|
+
obj.content = 'b = typeof window';
|
|
48
|
+
});
|
|
41
49
|
}
|
|
42
50
|
|
|
43
|
-
const graph = new ComputeGraph(notebook);
|
|
51
|
+
const graph = new ComputeGraph(notebook, registry);
|
|
44
52
|
graph.parse();
|
|
45
53
|
const values = await graph.evaluate();
|
|
46
54
|
|
|
@@ -48,8 +56,10 @@ describe('notebook', () => {
|
|
|
48
56
|
expect(values[notebook.cells[2].id]).toBe('undefined');
|
|
49
57
|
|
|
50
58
|
// Test document access.
|
|
51
|
-
if (
|
|
52
|
-
|
|
59
|
+
if (sourceTarget) {
|
|
60
|
+
Obj.change(sourceTarget, (obj) => {
|
|
61
|
+
obj.content = 'b = typeof document';
|
|
62
|
+
});
|
|
53
63
|
}
|
|
54
64
|
graph.parse();
|
|
55
65
|
const values2 = await graph.evaluate();
|
|
@@ -58,8 +68,10 @@ describe('notebook', () => {
|
|
|
58
68
|
expect(values2[notebook.cells[2].id]).toBe('undefined');
|
|
59
69
|
|
|
60
70
|
// Test that safe globals still work.
|
|
61
|
-
if (
|
|
62
|
-
|
|
71
|
+
if (sourceTarget) {
|
|
72
|
+
Obj.change(sourceTarget, (obj) => {
|
|
73
|
+
obj.content = 'b = Math.max(100, 200)';
|
|
74
|
+
});
|
|
63
75
|
}
|
|
64
76
|
graph.parse();
|
|
65
77
|
const values3 = await graph.evaluate();
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { type
|
|
5
|
+
import { Atom, type Registry } from '@effect-atom/atom-react';
|
|
6
6
|
|
|
7
7
|
import { log } from '@dxos/log';
|
|
8
8
|
|
|
@@ -18,38 +18,62 @@ import { type ParsedExpression, VirtualTypeScriptParser } from './vfs-parser';
|
|
|
18
18
|
export class ComputeGraph {
|
|
19
19
|
private readonly _parser = new VirtualTypeScriptParser();
|
|
20
20
|
|
|
21
|
-
private
|
|
22
|
-
private
|
|
23
|
-
private
|
|
21
|
+
private _expressionsAtom = Atom.make<Record<string, ParsedExpression>>({});
|
|
22
|
+
private _valuesByCellIdAtom = Atom.make<Record<string, any>>({});
|
|
23
|
+
private _valuesByNameAtom = Atom.make<Record<string, any>>({});
|
|
24
24
|
|
|
25
|
-
constructor(
|
|
25
|
+
constructor(
|
|
26
|
+
private readonly _notebook: Notebook.Notebook,
|
|
27
|
+
private readonly _registry: Registry.Registry,
|
|
28
|
+
) {}
|
|
26
29
|
|
|
27
30
|
/**
|
|
28
|
-
*
|
|
31
|
+
* Atom for parsed expressions by cell ID.
|
|
29
32
|
*/
|
|
30
|
-
get expressions():
|
|
31
|
-
return this.
|
|
33
|
+
get expressions(): Atom.Atom<Record<string, ParsedExpression>> {
|
|
34
|
+
return this._expressionsAtom;
|
|
32
35
|
}
|
|
33
36
|
|
|
34
37
|
/**
|
|
35
|
-
*
|
|
38
|
+
* Get current expressions by cell ID.
|
|
36
39
|
*/
|
|
37
|
-
|
|
38
|
-
return this.
|
|
40
|
+
getExpressions(): Record<string, ParsedExpression> {
|
|
41
|
+
return this._registry.get(this._expressionsAtom);
|
|
39
42
|
}
|
|
40
43
|
|
|
41
44
|
/**
|
|
42
|
-
*
|
|
45
|
+
* Atom for computed values by cell ID.
|
|
43
46
|
*/
|
|
44
|
-
get
|
|
45
|
-
return this.
|
|
47
|
+
get values(): Atom.Atom<Record<string, any>> {
|
|
48
|
+
return this._valuesByCellIdAtom;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Get computed values by cell ID.
|
|
53
|
+
*/
|
|
54
|
+
getValues(): Record<string, any> {
|
|
55
|
+
return this._registry.get(this._valuesByCellIdAtom);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Atom for computed values by name.
|
|
60
|
+
*/
|
|
61
|
+
get valuesByName(): Atom.Atom<Record<string, any>> {
|
|
62
|
+
return this._valuesByNameAtom;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Get current values by name.
|
|
67
|
+
*/
|
|
68
|
+
getValuesByName(): Record<string, any> {
|
|
69
|
+
return this._registry.get(this._valuesByNameAtom);
|
|
46
70
|
}
|
|
47
71
|
|
|
48
72
|
/**
|
|
49
73
|
* Get computed value by cell ID.
|
|
50
74
|
*/
|
|
51
|
-
getValue(cellId: string) {
|
|
52
|
-
return this.
|
|
75
|
+
getValue(cellId: string): any {
|
|
76
|
+
return this._registry.get(this._valuesByCellIdAtom)[cellId];
|
|
53
77
|
}
|
|
54
78
|
|
|
55
79
|
/**
|
|
@@ -58,8 +82,8 @@ export class ComputeGraph {
|
|
|
58
82
|
async evaluate() {
|
|
59
83
|
// Parse expressions.
|
|
60
84
|
const { expressions, dependencyGraph } = this.parse();
|
|
61
|
-
this.
|
|
62
|
-
this.
|
|
85
|
+
this._registry.set(this._valuesByCellIdAtom, {});
|
|
86
|
+
this._registry.set(this._valuesByNameAtom, {});
|
|
63
87
|
|
|
64
88
|
// Create a map of cell IDs to expressions for easy lookup.
|
|
65
89
|
const cellExpressions = new Map<string, ParsedExpression>();
|
|
@@ -124,8 +148,8 @@ export class ComputeGraph {
|
|
|
124
148
|
}
|
|
125
149
|
}
|
|
126
150
|
|
|
127
|
-
this.
|
|
128
|
-
this.
|
|
151
|
+
this._registry.set(this._valuesByCellIdAtom, valuesByCellId);
|
|
152
|
+
this._registry.set(this._valuesByNameAtom, valuesByName);
|
|
129
153
|
return valuesByCellId;
|
|
130
154
|
}
|
|
131
155
|
|
|
@@ -151,7 +175,7 @@ export class ComputeGraph {
|
|
|
151
175
|
|
|
152
176
|
// Build dependency graph.
|
|
153
177
|
const dependencyGraph = this.buildDependencyGraph(expressions);
|
|
154
|
-
this.
|
|
178
|
+
this._registry.set(this._expressionsAtom, expressions);
|
|
155
179
|
return { expressions, dependencyGraph };
|
|
156
180
|
}
|
|
157
181
|
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
|
+
import * as Predicate from 'effect/Predicate';
|
|
7
|
+
|
|
8
|
+
import { LayoutOperation } from '@dxos/app-toolkit';
|
|
9
|
+
import { Operation } from '@dxos/operation';
|
|
10
|
+
import { TokenManagerOperation } from '@dxos/plugin-token-manager/operations';
|
|
11
|
+
|
|
12
|
+
import { DEPLOYMENT_DIALOG } from '../constants';
|
|
13
|
+
import { defaultScriptsForIntegration } from '../meta';
|
|
14
|
+
import { templates } from '../templates';
|
|
15
|
+
|
|
16
|
+
const handler: Operation.WithHandler<typeof TokenManagerOperation.AccessTokenCreated> =
|
|
17
|
+
TokenManagerOperation.AccessTokenCreated.pipe(
|
|
18
|
+
Operation.withHandler(
|
|
19
|
+
Effect.fnUntraced(function* ({ accessToken }) {
|
|
20
|
+
const scriptTemplates = (defaultScriptsForIntegration[accessToken.source] ?? [])
|
|
21
|
+
.map((id) => templates.find((t) => t.id === id))
|
|
22
|
+
.filter(Predicate.isNotNullable);
|
|
23
|
+
|
|
24
|
+
if (scriptTemplates.length > 0) {
|
|
25
|
+
yield* Operation.invoke(LayoutOperation.UpdateDialog, {
|
|
26
|
+
subject: DEPLOYMENT_DIALOG,
|
|
27
|
+
blockAlign: 'start',
|
|
28
|
+
state: true,
|
|
29
|
+
props: { accessToken, scriptTemplates },
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
}),
|
|
33
|
+
),
|
|
34
|
+
);
|
|
35
|
+
|
|
36
|
+
export default handler;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { Octokit } from '@octokit/core';
|
|
6
|
+
import * as Effect from 'effect/Effect';
|
|
7
|
+
|
|
8
|
+
import { Script } from '@dxos/functions';
|
|
9
|
+
import { Operation } from '@dxos/operation';
|
|
10
|
+
|
|
11
|
+
import { templates } from '../templates';
|
|
12
|
+
import { CreateScript } from './definitions';
|
|
13
|
+
|
|
14
|
+
const handler: Operation.WithHandler<typeof CreateScript> = CreateScript.pipe(
|
|
15
|
+
Operation.withHandler(
|
|
16
|
+
Effect.fnUntraced(function* ({ name, gistUrl, initialTemplateId }) {
|
|
17
|
+
let source = templates[0].source;
|
|
18
|
+
let scriptName = name;
|
|
19
|
+
|
|
20
|
+
const gistId = gistUrl?.split('/').at(-1);
|
|
21
|
+
if (gistId) {
|
|
22
|
+
const octokit = new Octokit();
|
|
23
|
+
const response = yield* Effect.promise(() =>
|
|
24
|
+
octokit.request('GET /gists/{gist_id}', {
|
|
25
|
+
gist_id: gistId,
|
|
26
|
+
}),
|
|
27
|
+
);
|
|
28
|
+
const gistContent = Object.values(response.data.files ?? {})[0]?.content;
|
|
29
|
+
if (gistContent) {
|
|
30
|
+
source = gistContent;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
if (initialTemplateId) {
|
|
35
|
+
const template = templates.find((template) => template.id === initialTemplateId);
|
|
36
|
+
if (template) {
|
|
37
|
+
source = template.source;
|
|
38
|
+
scriptName = scriptName || template.name;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
return { object: Script.make({ name: scriptName, source }) };
|
|
43
|
+
}),
|
|
44
|
+
),
|
|
45
|
+
);
|
|
46
|
+
|
|
47
|
+
export default handler;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Schema from 'effect/Schema';
|
|
6
|
+
|
|
7
|
+
import { Database } from '@dxos/echo';
|
|
8
|
+
import { Script } from '@dxos/functions';
|
|
9
|
+
import { Operation } from '@dxos/operation';
|
|
10
|
+
|
|
11
|
+
import { meta } from '../meta';
|
|
12
|
+
import { templates } from '../templates';
|
|
13
|
+
|
|
14
|
+
const SCRIPT_OPERATION = `${meta.id}.operation`;
|
|
15
|
+
|
|
16
|
+
export const ScriptProps = Schema.Struct({
|
|
17
|
+
name: Schema.optional(Schema.String),
|
|
18
|
+
gistUrl: Schema.optional(Schema.String.annotations({ title: 'Import from Gist (url)' })),
|
|
19
|
+
initialTemplateId: Schema.Literal(...templates.map(({ id }) => id)).pipe(
|
|
20
|
+
Schema.annotations({ title: 'Template' }),
|
|
21
|
+
Schema.optional,
|
|
22
|
+
),
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
export const NotebookProps = Schema.Struct({
|
|
26
|
+
name: Schema.optional(Schema.String),
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
export const CreateScript = Operation.make({
|
|
30
|
+
meta: { key: `${SCRIPT_OPERATION}.create-script`, name: 'Create Script' },
|
|
31
|
+
input: Schema.extend(
|
|
32
|
+
ScriptProps,
|
|
33
|
+
Schema.Struct({
|
|
34
|
+
db: Database.Database,
|
|
35
|
+
}),
|
|
36
|
+
),
|
|
37
|
+
output: Schema.Struct({
|
|
38
|
+
object: Script.Script,
|
|
39
|
+
}),
|
|
40
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { OperationHandlerSet } from '@dxos/operation';
|
|
6
|
+
|
|
7
|
+
export * as ScriptOperation from './definitions';
|
|
8
|
+
|
|
9
|
+
export const ScriptOperationHandlerSet = OperationHandlerSet.lazy(
|
|
10
|
+
() => import('./access-token-created'),
|
|
11
|
+
() => import('./create-script'),
|
|
12
|
+
);
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as LanguageModel from '@effect/ai/LanguageModel';
|
|
6
|
+
import * as Chunk from 'effect/Chunk';
|
|
7
|
+
import * as Effect from 'effect/Effect';
|
|
8
|
+
import * as Schema from 'effect/Schema';
|
|
9
|
+
import * as Stream from 'effect/Stream';
|
|
10
|
+
|
|
11
|
+
import { AiService } from '@dxos/ai';
|
|
12
|
+
import { Operation } from '@dxos/operation';
|
|
13
|
+
|
|
14
|
+
const Anthropic = Operation.make({
|
|
15
|
+
meta: {
|
|
16
|
+
key: 'org.dxos.script.anthropic',
|
|
17
|
+
name: 'Anthropic Chat',
|
|
18
|
+
description: 'Chat with Anthropic',
|
|
19
|
+
},
|
|
20
|
+
input: Schema.Struct({
|
|
21
|
+
message: Schema.String,
|
|
22
|
+
}),
|
|
23
|
+
output: Schema.Any,
|
|
24
|
+
services: [AiService.AiService],
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
export default Anthropic.pipe(
|
|
28
|
+
Operation.withHandler(
|
|
29
|
+
Effect.fn(function* ({ message }) {
|
|
30
|
+
const model = (yield* AiService.AiService).model('@anthropic/claude-sonnet-4-5');
|
|
31
|
+
|
|
32
|
+
//
|
|
33
|
+
// Basic example.
|
|
34
|
+
//
|
|
35
|
+
const { text } = yield* LanguageModel.generateText({ prompt: message }).pipe(Effect.provide(model));
|
|
36
|
+
|
|
37
|
+
//
|
|
38
|
+
// Streaming example.
|
|
39
|
+
//
|
|
40
|
+
const parts = yield* LanguageModel.streamText({
|
|
41
|
+
prompt: 'Count from 1 to 5, one number per line.',
|
|
42
|
+
}).pipe(Stream.runCollect, Effect.map(Chunk.toArray), Effect.provide(model));
|
|
43
|
+
const textDeltas = parts.filter((p) => p.type === 'text-delta');
|
|
44
|
+
const fullText = textDeltas.map((p) => (p as { delta: string }).delta).join('');
|
|
45
|
+
|
|
46
|
+
return { response: text, streamText: fullText };
|
|
47
|
+
}),
|
|
48
|
+
),
|
|
49
|
+
);
|
package/src/templates/chat.ts
CHANGED
|
@@ -76,7 +76,7 @@ export default async ({ data: { bodyText }, context: { space, ai } }: any) => {
|
|
|
76
76
|
|
|
77
77
|
const getContext = async ({ space }: any) => {
|
|
78
78
|
let context = '';
|
|
79
|
-
const { objects: docs } = await space.crud.query({ __typename: 'dxos.
|
|
79
|
+
const { objects: docs } = await space.crud.query({ __typename: 'org.dxos.type.document' }).run();
|
|
80
80
|
for (const doc of docs) {
|
|
81
81
|
const { content } = await space.crud.query({ id: doc.content }).first();
|
|
82
82
|
context += content + '\n\n';
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { Chess as ChessJS } from 'chess.js';
|
|
6
|
+
import * as Effect from 'effect/Effect';
|
|
7
|
+
import * as Schema from 'effect/Schema';
|
|
8
|
+
|
|
9
|
+
import { Database, Obj, Ref } from '@dxos/echo';
|
|
10
|
+
import { Operation } from '@dxos/operation';
|
|
11
|
+
import { Chess } from '@dxos/plugin-chess/types';
|
|
12
|
+
|
|
13
|
+
const ChessBot = Operation.make({
|
|
14
|
+
meta: {
|
|
15
|
+
key: 'org.dxos.script.chess-bot',
|
|
16
|
+
name: 'Chess Bot',
|
|
17
|
+
description: 'Plays a random move in a chess game.',
|
|
18
|
+
},
|
|
19
|
+
input: Schema.Struct({
|
|
20
|
+
game: Ref.Ref(Chess.Game).annotations({
|
|
21
|
+
description: 'The chess game to comment on.',
|
|
22
|
+
}),
|
|
23
|
+
player: Schema.optional(Schema.Literal('white', 'black')).annotations({
|
|
24
|
+
description: 'The player to play the game as.',
|
|
25
|
+
}),
|
|
26
|
+
}),
|
|
27
|
+
output: Schema.Struct({
|
|
28
|
+
state: Schema.String.annotations({
|
|
29
|
+
description: 'The state of the game as an ASCII art board.',
|
|
30
|
+
}),
|
|
31
|
+
}),
|
|
32
|
+
types: [Chess.Game],
|
|
33
|
+
services: [Database.Service],
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
export default ChessBot.pipe(
|
|
37
|
+
Operation.withHandler(
|
|
38
|
+
Effect.fnUntraced(function* ({ game, player = 'black' }) {
|
|
39
|
+
const loadedGame = yield* Database.load(game);
|
|
40
|
+
const chess = new ChessJS();
|
|
41
|
+
chess.loadPgn(loadedGame.pgn ?? '');
|
|
42
|
+
if (chess.turn() !== (player === 'white' ? 'w' : 'b')) {
|
|
43
|
+
return { state: chess.ascii() };
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const moves = chess.moves({ verbose: true });
|
|
47
|
+
const move = moves[Math.floor(Math.random() * moves.length)];
|
|
48
|
+
if (!move) {
|
|
49
|
+
return { state: chess.ascii() };
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
chess.move(move.san);
|
|
53
|
+
const newPgn = chess.pgn();
|
|
54
|
+
Obj.change(loadedGame, (obj) => {
|
|
55
|
+
obj.pgn = newPgn;
|
|
56
|
+
});
|
|
57
|
+
yield* Database.flush();
|
|
58
|
+
return { state: chess.ascii() };
|
|
59
|
+
}),
|
|
60
|
+
),
|
|
61
|
+
);
|