@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
package/src/{components/Settings → containers/ScriptPluginSettings}/ScriptPluginSettings.tsx
RENAMED
|
@@ -6,14 +6,19 @@ import React from 'react';
|
|
|
6
6
|
|
|
7
7
|
import { useClient } from '@dxos/react-client';
|
|
8
8
|
import { Button, Select, useTranslation } from '@dxos/react-ui';
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
9
|
+
import { Settings } from '@dxos/react-ui-form';
|
|
10
|
+
import { type EditorInputMode, EditorInputModes } from '@dxos/ui-editor';
|
|
11
11
|
|
|
12
12
|
import { meta } from '../../meta';
|
|
13
13
|
import { type ScriptSettings } from '../../types';
|
|
14
14
|
import { getAccessCredential } from '../../util';
|
|
15
15
|
|
|
16
|
-
export
|
|
16
|
+
export type ScriptPluginSettingsComponentProps = {
|
|
17
|
+
settings: ScriptSettings;
|
|
18
|
+
onSettingsChange: (fn: (current: ScriptSettings) => ScriptSettings) => void;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export const ScriptPluginSettings = ({ settings, onSettingsChange }: ScriptPluginSettingsComponentProps) => {
|
|
17
22
|
const { t } = useTranslation(meta.id);
|
|
18
23
|
const client = useClient();
|
|
19
24
|
|
|
@@ -24,19 +29,19 @@ export const ScriptPluginSettings = ({ settings }: { settings: ScriptSettings })
|
|
|
24
29
|
};
|
|
25
30
|
|
|
26
31
|
return (
|
|
27
|
-
<
|
|
28
|
-
<
|
|
29
|
-
<
|
|
32
|
+
<Settings.Root>
|
|
33
|
+
<Settings.Section title={t('settings title', { ns: meta.id })}>
|
|
34
|
+
<Settings.Group>
|
|
30
35
|
{/* TODO(wittjosiah): Hide outside of dev environments. */}
|
|
31
|
-
<
|
|
36
|
+
<Settings.ItemInput title={t('authenticate action label')}>
|
|
32
37
|
<Button onClick={handleAuthenticate}>{t('authenticate button label')}</Button>
|
|
33
|
-
</
|
|
38
|
+
</Settings.ItemInput>
|
|
34
39
|
|
|
35
|
-
<
|
|
40
|
+
<Settings.ItemInput title={t('editor input mode label')}>
|
|
36
41
|
<Select.Root
|
|
37
42
|
value={settings.editorInputMode ?? 'default'}
|
|
38
43
|
onValueChange={(value) => {
|
|
39
|
-
|
|
44
|
+
onSettingsChange((s) => ({ ...s, editorInputMode: value as EditorInputMode }));
|
|
40
45
|
}}
|
|
41
46
|
>
|
|
42
47
|
<Select.TriggerButton placeholder={t('select editor input mode placeholder')} />
|
|
@@ -53,9 +58,9 @@ export const ScriptPluginSettings = ({ settings }: { settings: ScriptSettings })
|
|
|
53
58
|
</Select.Content>
|
|
54
59
|
</Select.Portal>
|
|
55
60
|
</Select.Root>
|
|
56
|
-
</
|
|
57
|
-
</
|
|
58
|
-
</
|
|
59
|
-
</
|
|
61
|
+
</Settings.ItemInput>
|
|
62
|
+
</Settings.Group>
|
|
63
|
+
</Settings.Section>
|
|
64
|
+
</Settings.Root>
|
|
60
65
|
);
|
|
61
66
|
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2024 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import React from 'react';
|
|
6
|
+
|
|
7
|
+
import { Obj } from '@dxos/echo';
|
|
8
|
+
import { type Script } from '@dxos/functions';
|
|
9
|
+
import { Input, useTranslation } from '@dxos/react-ui';
|
|
10
|
+
|
|
11
|
+
import { meta } from '../../meta';
|
|
12
|
+
|
|
13
|
+
export type ScriptPropertiesProps = {
|
|
14
|
+
object: Script.Script;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export const ScriptProperties = ({ object }: ScriptPropertiesProps) => {
|
|
18
|
+
const { t } = useTranslation(meta.id);
|
|
19
|
+
return (
|
|
20
|
+
<Input.Root>
|
|
21
|
+
<Input.Label>{t('description label')}</Input.Label>
|
|
22
|
+
<Input.TextInput
|
|
23
|
+
placeholder={t('description placeholder')}
|
|
24
|
+
value={object.description ?? ''}
|
|
25
|
+
onChange={(event) => {
|
|
26
|
+
Obj.change(object, (obj) => {
|
|
27
|
+
obj.description = event.target.value;
|
|
28
|
+
});
|
|
29
|
+
}}
|
|
30
|
+
/>
|
|
31
|
+
</Input.Root>
|
|
32
|
+
);
|
|
33
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import React, { useCallback, useMemo } from 'react';
|
|
6
|
+
|
|
7
|
+
import { Context } from '@dxos/context';
|
|
8
|
+
|
|
9
|
+
import { type Script } from '@dxos/functions';
|
|
10
|
+
import { FunctionsServiceClient } from '@dxos/functions-runtime/edge';
|
|
11
|
+
import { Panel } from '@dxos/react-ui';
|
|
12
|
+
import { getSpace } from '@dxos/react-client/echo';
|
|
13
|
+
|
|
14
|
+
import { TestPanel } from '../../components';
|
|
15
|
+
import { useDeployDeps } from '../../hooks';
|
|
16
|
+
|
|
17
|
+
export type TestContainerProps = {
|
|
18
|
+
role: string;
|
|
19
|
+
script: Script.Script;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export const TestContainer = ({ role, script }: TestContainerProps) => {
|
|
23
|
+
const { client, fn, existingFunctionId } = useDeployDeps({ script });
|
|
24
|
+
const space = getSpace(script);
|
|
25
|
+
|
|
26
|
+
const functionsClient = useMemo(() => FunctionsServiceClient.fromClient(client), [client]);
|
|
27
|
+
|
|
28
|
+
const handleInvoke = useCallback(
|
|
29
|
+
async (input: unknown) => {
|
|
30
|
+
if (!fn) {
|
|
31
|
+
throw new Error('Function not deployed');
|
|
32
|
+
}
|
|
33
|
+
return functionsClient.invoke(Context.default(), fn, input, { spaceId: space?.id });
|
|
34
|
+
},
|
|
35
|
+
[fn, functionsClient, space?.id],
|
|
36
|
+
);
|
|
37
|
+
|
|
38
|
+
return (
|
|
39
|
+
<Panel.Root role={role} className='dx-document'>
|
|
40
|
+
<Panel.Content asChild>
|
|
41
|
+
<TestPanel onInvoke={existingFunctionId ? handleInvoke : undefined} />
|
|
42
|
+
</Panel.Content>
|
|
43
|
+
</Panel.Root>
|
|
44
|
+
);
|
|
45
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { type ComponentType, lazy } from 'react';
|
|
6
|
+
|
|
7
|
+
export const DeploymentDialog: ComponentType<any> = lazy(() => import('./DeploymentDialog'));
|
|
8
|
+
export const NotebookContainer: ComponentType<any> = lazy(() => import('./NotebookContainer'));
|
|
9
|
+
export const ScriptContainer: ComponentType<any> = lazy(() => import('./ScriptContainer'));
|
|
10
|
+
export const ScriptObjectSettings: ComponentType<any> = lazy(() => import('./ScriptObjectSettings'));
|
|
11
|
+
export const ScriptPluginSettings: ComponentType<any> = lazy(() => import('./ScriptPluginSettings'));
|
|
12
|
+
export const ScriptProperties: ComponentType<any> = lazy(() => import('./ScriptProperties'));
|
|
13
|
+
export const TestContainer: ComponentType<any> = lazy(() => import('./TestContainer'));
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { describe } from '@effect/vitest';
|
|
6
|
+
import { test } from 'vitest';
|
|
7
|
+
|
|
8
|
+
import { Client } from '@dxos/client';
|
|
9
|
+
import { type Space } from '@dxos/client-protocol';
|
|
10
|
+
import { configPreset } from '@dxos/config';
|
|
11
|
+
import { Context } from '@dxos/context';
|
|
12
|
+
import { Operation } from '@dxos/operation';
|
|
13
|
+
import { FunctionsServiceClient } from '@dxos/functions-runtime/edge';
|
|
14
|
+
import { bundleFunction } from '@dxos/functions-runtime/native';
|
|
15
|
+
import { FunctionRuntimeKind } from '@dxos/protocols';
|
|
16
|
+
import { EdgeReplicationSetting } from '@dxos/protocols/proto/dxos/echo/metadata';
|
|
17
|
+
|
|
18
|
+
// To heavy to run in CI.
|
|
19
|
+
describe.runIf(process.env.DX_TEST_TAGS?.includes('functions-e2e')).skip('Function', () => {
|
|
20
|
+
const config = configPreset({ edge: 'local' });
|
|
21
|
+
|
|
22
|
+
test('bundle anthropic function', { timeout: 120_000 }, async () => {
|
|
23
|
+
await bundleFunction({
|
|
24
|
+
entryPoint: new URL('../templates/anthropic.ts', import.meta.url).pathname,
|
|
25
|
+
verbose: true,
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
test('deploy empty function', { timeout: 120_000 }, async () => {
|
|
30
|
+
const { space, functionsServiceClient } = await setup();
|
|
31
|
+
|
|
32
|
+
await sync(space);
|
|
33
|
+
const func = await deployFunction(
|
|
34
|
+
space,
|
|
35
|
+
functionsServiceClient,
|
|
36
|
+
new URL('../templates/ping.ts', import.meta.url).pathname,
|
|
37
|
+
);
|
|
38
|
+
console.log(func);
|
|
39
|
+
throw new Error('test');
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
test('deploy and invoke anthropic function', { timeout: 120_000 }, async () => {
|
|
43
|
+
const { space, functionsServiceClient } = await setup();
|
|
44
|
+
await sync(space);
|
|
45
|
+
const func = await deployFunction(
|
|
46
|
+
space,
|
|
47
|
+
functionsServiceClient,
|
|
48
|
+
new URL('../templates/anthropic.ts', import.meta.url).pathname,
|
|
49
|
+
);
|
|
50
|
+
|
|
51
|
+
const result = await functionsServiceClient.invoke(Context.default(), func, {
|
|
52
|
+
message: 'Hello, world!',
|
|
53
|
+
});
|
|
54
|
+
console.log(result);
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
const setup = async () => {
|
|
58
|
+
const client = await new Client({ config, types: [Operation.PersistentOperation] }).initialize();
|
|
59
|
+
await client.halo.createIdentity();
|
|
60
|
+
|
|
61
|
+
const space = await client.spaces.create();
|
|
62
|
+
await space.waitUntilReady();
|
|
63
|
+
await space.internal.setEdgeReplicationPreference(EdgeReplicationSetting.ENABLED);
|
|
64
|
+
|
|
65
|
+
const functionsServiceClient = FunctionsServiceClient.fromClient(client);
|
|
66
|
+
return { client, space, functionsServiceClient };
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
const sync = async (space: Space) => {
|
|
70
|
+
await space.db.flush();
|
|
71
|
+
await space.internal.syncToEdge({
|
|
72
|
+
onProgress: (state) =>
|
|
73
|
+
console.log(state ? `${state.unsyncedDocumentCount} documents syncing...` : 'connecting to edge...'),
|
|
74
|
+
});
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
const deployFunction = async (space: Space, functionsServiceClient: FunctionsServiceClient, entryPoint: string) => {
|
|
78
|
+
const artifact = await bundleFunction({
|
|
79
|
+
entryPoint,
|
|
80
|
+
verbose: true,
|
|
81
|
+
});
|
|
82
|
+
const func = await functionsServiceClient.deploy(Context.default(), {
|
|
83
|
+
version: '0.0.1',
|
|
84
|
+
ownerPublicKey: space.key,
|
|
85
|
+
entryPoint: artifact.entryPoint,
|
|
86
|
+
assets: artifact.assets,
|
|
87
|
+
runtime: FunctionRuntimeKind.enums.WORKER_LOADER,
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
space.db.add(func);
|
|
91
|
+
return func;
|
|
92
|
+
};
|
|
93
|
+
});
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { readFile } from 'node:fs/promises';
|
|
6
|
+
|
|
7
|
+
import { describe, expect, test } from 'vitest';
|
|
8
|
+
|
|
9
|
+
import { Client, type Config } from '@dxos/client';
|
|
10
|
+
import { createEdgeIdentity } from '@dxos/client/edge';
|
|
11
|
+
import { configPreset } from '@dxos/config';
|
|
12
|
+
import { Context } from '@dxos/context';
|
|
13
|
+
import { bundleFunction } from '@dxos/functions-runtime/bundler';
|
|
14
|
+
import { FunctionsServiceClient } from '@dxos/functions-runtime/edge';
|
|
15
|
+
import { invariant } from '@dxos/invariant';
|
|
16
|
+
import { log } from '@dxos/log';
|
|
17
|
+
|
|
18
|
+
describe.runIf(process.env.DX_TEST_TAGS?.includes('functions-e2e'))('Functions deployment', () => {
|
|
19
|
+
test('deploys FOREX (effect) function and invokes it via EDGE (main)', { timeout: 120_000 }, async () => {
|
|
20
|
+
const config = configPreset({ edge: 'main' });
|
|
21
|
+
await testDeploy(config);
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
test('deploys FOREX (effect) function and invokes it via EDGE (production)', { timeout: 120_000 }, async () => {
|
|
25
|
+
const config = configPreset({ edge: 'production' });
|
|
26
|
+
await testDeploy(config);
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
const testDeploy = async (config: Config) => {
|
|
30
|
+
await using client = await new Client({ config }).initialize();
|
|
31
|
+
await client.halo.createIdentity();
|
|
32
|
+
|
|
33
|
+
const space = await client.spaces.create();
|
|
34
|
+
await space.waitUntilReady();
|
|
35
|
+
|
|
36
|
+
// Inline echo function source.
|
|
37
|
+
const source = await readFile(new URL('../templates/forex-effect.ts', import.meta.url), 'utf-8');
|
|
38
|
+
|
|
39
|
+
// Bundle and upload.
|
|
40
|
+
const buildResult = await bundleFunction({ source });
|
|
41
|
+
if ('error' in buildResult) {
|
|
42
|
+
throw buildResult.error ?? new Error('Bundle creation failed');
|
|
43
|
+
}
|
|
44
|
+
const functionsServiceClient = FunctionsServiceClient.fromClient(client);
|
|
45
|
+
|
|
46
|
+
const func = await functionsServiceClient.deploy(Context.default(), {
|
|
47
|
+
ownerPublicKey: space.key,
|
|
48
|
+
version: '0.0.1',
|
|
49
|
+
entryPoint: buildResult.entryPoint,
|
|
50
|
+
assets: buildResult.assets,
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
// Invoke deployed function via EDGE directly.
|
|
54
|
+
const edgeClient = client.edge.http;
|
|
55
|
+
invariant(edgeClient, 'edgeClient is required');
|
|
56
|
+
edgeClient.setIdentity(createEdgeIdentity(client));
|
|
57
|
+
|
|
58
|
+
const input = { from: 'USD', to: 'EUR' };
|
|
59
|
+
const result = await functionsServiceClient.invoke(Context.default(), func, input);
|
|
60
|
+
log.info('>>> result', { result, func });
|
|
61
|
+
const resultNumber = Number(result);
|
|
62
|
+
expect(resultNumber).toBeGreaterThan(0);
|
|
63
|
+
expect(resultNumber).toBeLessThan(100);
|
|
64
|
+
};
|
|
65
|
+
});
|
package/src/hooks/deploy.ts
CHANGED
|
@@ -4,13 +4,15 @@
|
|
|
4
4
|
|
|
5
5
|
import { useEffect, useMemo } from 'react';
|
|
6
6
|
|
|
7
|
-
import {
|
|
7
|
+
import { Obj, Query, Ref } from '@dxos/echo';
|
|
8
|
+
import { type Script, getUserFunctionIdInMetadata } from '@dxos/functions';
|
|
9
|
+
import { Operation } from '@dxos/operation';
|
|
8
10
|
import { log } from '@dxos/log';
|
|
9
11
|
import { type Client, useClient } from '@dxos/react-client';
|
|
10
|
-
import {
|
|
12
|
+
import { type Space, getSpace, useQuery } from '@dxos/react-client/echo';
|
|
11
13
|
import { type TFunction } from '@dxos/react-ui';
|
|
12
14
|
import { createMenuAction } from '@dxos/react-ui-menu';
|
|
13
|
-
import {
|
|
15
|
+
import { messageValence } from '@dxos/ui-theme';
|
|
14
16
|
|
|
15
17
|
import { meta } from '../meta';
|
|
16
18
|
import { deployScript, getFunctionUrl, isScriptDeployed } from '../util';
|
|
@@ -24,10 +26,12 @@ export type DeployState = {
|
|
|
24
26
|
error: string;
|
|
25
27
|
};
|
|
26
28
|
|
|
29
|
+
import { type ScriptToolbarStateStore } from './useToolbarState';
|
|
30
|
+
|
|
27
31
|
export type CreateDeployOptions = {
|
|
28
|
-
state:
|
|
32
|
+
state: ScriptToolbarStateStore;
|
|
29
33
|
script: Script.Script;
|
|
30
|
-
fn:
|
|
34
|
+
fn: Operation.PersistentOperation;
|
|
31
35
|
space?: Space;
|
|
32
36
|
existingFunctionId?: string;
|
|
33
37
|
client: Client;
|
|
@@ -35,12 +39,14 @@ export type CreateDeployOptions = {
|
|
|
35
39
|
};
|
|
36
40
|
|
|
37
41
|
export const createDeploy = ({ state, script, space, fn, client, existingFunctionId, t }: CreateDeployOptions) => {
|
|
42
|
+
const { value } = state;
|
|
43
|
+
|
|
38
44
|
// TODO(wittjosiah): Should this be an action?
|
|
39
45
|
const errorItem = createMenuAction('error', () => {}, {
|
|
40
|
-
label:
|
|
46
|
+
label: value.error ?? ['no error label', { ns: meta.id }],
|
|
41
47
|
icon: 'ph--warning-circle--regular',
|
|
42
|
-
hidden: !
|
|
43
|
-
classNames:
|
|
48
|
+
hidden: !value.error,
|
|
49
|
+
classNames: value.error && messageValence('error'),
|
|
44
50
|
});
|
|
45
51
|
|
|
46
52
|
const deployAction = createMenuAction<DeployActionProperties>(
|
|
@@ -50,75 +56,78 @@ export const createDeploy = ({ state, script, space, fn, client, existingFunctio
|
|
|
50
56
|
return;
|
|
51
57
|
}
|
|
52
58
|
|
|
53
|
-
state.error
|
|
54
|
-
state.deploying
|
|
59
|
+
state.set('error', undefined);
|
|
60
|
+
state.set('deploying', true);
|
|
55
61
|
|
|
56
62
|
const result = await deployScript({ script, client, space, fn, existingFunctionId });
|
|
57
63
|
|
|
58
64
|
if (!result.success) {
|
|
59
65
|
log.catch(result.error);
|
|
60
|
-
state.error
|
|
66
|
+
state.set('error', t('upload failed label'));
|
|
61
67
|
}
|
|
62
68
|
|
|
63
|
-
state.deploying
|
|
69
|
+
state.set('deploying', false);
|
|
64
70
|
},
|
|
65
71
|
{
|
|
66
72
|
type: 'deploy',
|
|
67
|
-
label: [
|
|
68
|
-
icon:
|
|
69
|
-
disabled:
|
|
70
|
-
classNames:
|
|
73
|
+
label: [value.deploying ? 'publishing label' : 'deploy label', { ns: meta.id }],
|
|
74
|
+
icon: value.deploying ? 'ph--spinner-gap--regular' : 'ph--cloud-arrow-up--regular',
|
|
75
|
+
disabled: value.deploying,
|
|
76
|
+
classNames: value.deploying ? '[&_svg]:animate-spin' : '',
|
|
71
77
|
},
|
|
72
78
|
);
|
|
73
79
|
|
|
74
80
|
const copyAction = createMenuAction<DeployActionProperties>(
|
|
75
81
|
'copy',
|
|
76
82
|
async () => {
|
|
77
|
-
if (
|
|
78
|
-
await navigator.clipboard.writeText(
|
|
83
|
+
if (value.functionUrl) {
|
|
84
|
+
await navigator.clipboard.writeText(value.functionUrl);
|
|
79
85
|
}
|
|
80
86
|
},
|
|
81
87
|
{
|
|
82
88
|
type: 'copy',
|
|
83
89
|
label: ['copy link label', { ns: meta.id }],
|
|
84
90
|
icon: 'ph--link--regular',
|
|
85
|
-
disabled: !
|
|
91
|
+
disabled: !value.functionUrl,
|
|
86
92
|
},
|
|
87
93
|
);
|
|
88
94
|
|
|
89
95
|
return {
|
|
90
96
|
nodes: [errorItem, deployAction, copyAction],
|
|
91
97
|
edges: [
|
|
92
|
-
{ source: 'root', target: 'error' },
|
|
93
|
-
{ source: 'root', target: 'deploy' },
|
|
94
|
-
{ source: 'root', target: 'copy' },
|
|
98
|
+
{ source: 'root', target: 'error', relation: 'child' },
|
|
99
|
+
{ source: 'root', target: 'deploy', relation: 'child' },
|
|
100
|
+
{ source: 'root', target: 'copy', relation: 'child' },
|
|
95
101
|
],
|
|
96
102
|
};
|
|
97
103
|
};
|
|
98
104
|
|
|
99
|
-
export const useDeployState = ({ state, script }: { state:
|
|
105
|
+
export const useDeployState = ({ state, script }: { state: ScriptToolbarStateStore; script: Script.Script }) => {
|
|
100
106
|
const { space, client, fn, existingFunctionId } = useDeployDeps({ script });
|
|
101
107
|
useEffect(() => {
|
|
102
108
|
if (!existingFunctionId) {
|
|
103
109
|
return;
|
|
104
110
|
}
|
|
105
111
|
|
|
106
|
-
state.
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
+
state.set(
|
|
113
|
+
'functionUrl',
|
|
114
|
+
getFunctionUrl({
|
|
115
|
+
script,
|
|
116
|
+
fn,
|
|
117
|
+
edgeUrl: client.config.values.runtime?.services?.edge?.url ?? '',
|
|
118
|
+
}),
|
|
119
|
+
);
|
|
120
|
+
}, [existingFunctionId, space, fn, script, client.config.values.runtime?.services?.edge?.url, state]);
|
|
112
121
|
|
|
113
122
|
useEffect(() => {
|
|
114
|
-
state.deployed
|
|
115
|
-
}, [script.changed, existingFunctionId, fn, script]);
|
|
123
|
+
state.set('deployed', isScriptDeployed({ script, fn }));
|
|
124
|
+
}, [script.changed, existingFunctionId, fn, script, state]);
|
|
116
125
|
};
|
|
117
126
|
|
|
118
127
|
export const useDeployDeps = ({ script }: { script: Script.Script }) => {
|
|
119
128
|
const client = useClient();
|
|
120
129
|
const space = getSpace(script);
|
|
121
|
-
const [fn] = useQuery(space, Query.type(
|
|
122
|
-
const existingFunctionId = useMemo(() => fn && getUserFunctionIdInMetadata(getMeta(fn)), [fn]);
|
|
130
|
+
const [fn] = useQuery(space?.db, Query.type(Operation.PersistentOperation, { source: Ref.make(script) }));
|
|
131
|
+
const existingFunctionId = useMemo(() => fn && getUserFunctionIdInMetadata(Obj.getMeta(fn)), [fn]);
|
|
123
132
|
return { client, space, fn, existingFunctionId };
|
|
124
133
|
};
|
package/src/hooks/format.ts
CHANGED
|
@@ -6,6 +6,7 @@ import { format } from 'prettier';
|
|
|
6
6
|
import prettierPluginEstree from 'prettier/plugins/estree';
|
|
7
7
|
import prettierPluginTypescript from 'prettier/plugins/typescript';
|
|
8
8
|
|
|
9
|
+
import { Obj } from '@dxos/echo';
|
|
9
10
|
import { type Script } from '@dxos/functions';
|
|
10
11
|
import { log } from '@dxos/log';
|
|
11
12
|
import { createMenuAction } from '@dxos/react-ui-menu';
|
|
@@ -23,12 +24,15 @@ export const createFormat = (script: Script.Script) => {
|
|
|
23
24
|
}
|
|
24
25
|
|
|
25
26
|
try {
|
|
26
|
-
|
|
27
|
+
const formatted = await format(script.source.target!.content, {
|
|
27
28
|
parser: 'typescript',
|
|
28
29
|
plugins: [prettierPluginEstree, prettierPluginTypescript],
|
|
29
30
|
semi: true,
|
|
30
31
|
singleQuote: true,
|
|
31
32
|
});
|
|
33
|
+
Obj.change(script.source.target!, (obj) => {
|
|
34
|
+
obj.content = formatted;
|
|
35
|
+
});
|
|
32
36
|
} catch (err: any) {
|
|
33
37
|
// TODO(wittjosiah): Show error in UI.
|
|
34
38
|
log.catch(err);
|
|
@@ -46,6 +50,7 @@ export const createFormat = (script: Script.Script) => {
|
|
|
46
50
|
{
|
|
47
51
|
source: 'root',
|
|
48
52
|
target: 'format',
|
|
53
|
+
relation: 'child',
|
|
49
54
|
},
|
|
50
55
|
],
|
|
51
56
|
};
|
package/src/hooks/index.ts
CHANGED
package/src/hooks/template.ts
CHANGED
|
@@ -15,15 +15,21 @@ const createTemplateSelectActions = (script: Script.Script) => {
|
|
|
15
15
|
return createMenuAction<TemplateActionProperties>(
|
|
16
16
|
`template--${template.id}`,
|
|
17
17
|
() => {
|
|
18
|
-
script
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
18
|
+
Obj.change(script, (obj) => {
|
|
19
|
+
obj.name = template.name;
|
|
20
|
+
const meta = Obj.getMeta(obj);
|
|
21
|
+
const oldPresetIndex = meta.keys.findIndex((key) => key.source === FUNCTIONS_PRESET_META_KEY);
|
|
22
|
+
if (oldPresetIndex >= 0) {
|
|
23
|
+
meta.keys.splice(oldPresetIndex, 1);
|
|
24
|
+
}
|
|
25
|
+
if ('presetId' in template) {
|
|
26
|
+
meta.keys.push({ source: FUNCTIONS_PRESET_META_KEY, id: template.presetId });
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
if (script.source?.target) {
|
|
30
|
+
Obj.change(script.source.target, (obj) => {
|
|
31
|
+
obj.content = template.source;
|
|
32
|
+
});
|
|
27
33
|
}
|
|
28
34
|
},
|
|
29
35
|
{
|
|
@@ -40,8 +46,8 @@ export const createTemplateSelect = (script: Script.Script) => {
|
|
|
40
46
|
return {
|
|
41
47
|
nodes: [...templateSelectActions],
|
|
42
48
|
edges: [
|
|
43
|
-
{ source: 'root', target: 'template-select' },
|
|
44
|
-
...templateSelectActions.map((action) => ({ source: 'template-select', target: action.id })),
|
|
49
|
+
{ source: 'root', target: 'template-select', relation: 'child' },
|
|
50
|
+
...templateSelectActions.map((action) => ({ source: 'template-select', target: action.id, relation: 'child' })),
|
|
45
51
|
],
|
|
46
52
|
};
|
|
47
53
|
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { useCapabilities, usePluginManager } from '@dxos/app-framework/ui';
|
|
6
|
+
import { runAndForwardErrors } from '@dxos/effect';
|
|
7
|
+
import { useAsyncEffect } from '@dxos/react-ui';
|
|
8
|
+
|
|
9
|
+
import type { Compiler } from '../compiler';
|
|
10
|
+
import { ScriptEvents } from '../types';
|
|
11
|
+
import { ScriptCapabilities } from '../types';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Asynchronously sets up the compiler and returns it.
|
|
15
|
+
* @returns The compiler instance or undefined if it is not ready.
|
|
16
|
+
*/
|
|
17
|
+
export const useCompiler = (): Compiler | undefined => {
|
|
18
|
+
const manager = usePluginManager();
|
|
19
|
+
useAsyncEffect(async () => {
|
|
20
|
+
await manager.activate(ScriptEvents.SetupCompiler).pipe(runAndForwardErrors);
|
|
21
|
+
}, [manager]);
|
|
22
|
+
const [compiler] = useCapabilities(ScriptCapabilities.Compiler);
|
|
23
|
+
return compiler;
|
|
24
|
+
};
|