@dxos/plugin-script 0.8.4-main.406dc2a → 0.8.4-main.4a85c3132b
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-IIOXAS47.mjs +138 -0
- package/dist/lib/browser/DeploymentDialog-IIOXAS47.mjs.map +7 -0
- package/dist/lib/browser/{NotebookContainer-LVGRPFY3.mjs → NotebookContainer-VVZOKGRC.mjs} +367 -200
- package/dist/lib/browser/NotebookContainer-VVZOKGRC.mjs.map +7 -0
- package/dist/lib/browser/ScriptContainer-A5SSIUH6.mjs +93 -0
- package/dist/lib/browser/ScriptContainer-A5SSIUH6.mjs.map +7 -0
- package/dist/lib/browser/ScriptObjectSettings-HYYC7KXC.mjs +294 -0
- package/dist/lib/browser/ScriptObjectSettings-HYYC7KXC.mjs.map +7 -0
- package/dist/lib/browser/ScriptPluginSettings-UTWA7CBT.mjs +55 -0
- package/dist/lib/browser/ScriptPluginSettings-UTWA7CBT.mjs.map +7 -0
- package/dist/lib/browser/ScriptProperties-HREPUE65.mjs +28 -0
- package/dist/lib/browser/ScriptProperties-HREPUE65.mjs.map +7 -0
- package/dist/lib/browser/TestContainer-D4Y2K2TT.mjs +39 -0
- package/dist/lib/browser/TestContainer-D4Y2K2TT.mjs.map +7 -0
- package/dist/lib/browser/app-graph-builder-66ZDI72K.mjs +69 -0
- package/dist/lib/browser/app-graph-builder-66ZDI72K.mjs.map +7 -0
- package/dist/lib/browser/blueprint-definition-YMZEJBAZ.mjs +17 -0
- package/dist/lib/browser/blueprint-definition-YMZEJBAZ.mjs.map +7 -0
- package/dist/lib/browser/blueprints/index.mjs +8 -0
- package/dist/lib/browser/chunk-6IXFDTAI.mjs +113 -0
- package/dist/lib/browser/chunk-6IXFDTAI.mjs.map +7 -0
- package/dist/lib/browser/chunk-ATTZUDT7.mjs +67 -0
- package/dist/lib/browser/chunk-ATTZUDT7.mjs.map +7 -0
- package/dist/lib/browser/chunk-G3XIOLLI.mjs +174 -0
- package/dist/lib/browser/chunk-G3XIOLLI.mjs.map +7 -0
- package/dist/lib/browser/chunk-J5LGTIGS.mjs +10 -0
- package/dist/lib/browser/{chunk-ST3ACVUC.mjs → chunk-J7PGML5B.mjs} +29 -12
- package/dist/lib/browser/chunk-J7PGML5B.mjs.map +7 -0
- package/dist/lib/browser/chunk-MUEVLYXJ.mjs +397 -0
- package/dist/lib/browser/chunk-MUEVLYXJ.mjs.map +7 -0
- package/dist/lib/browser/chunk-PLDBKKYO.mjs +789 -0
- package/dist/lib/browser/chunk-PLDBKKYO.mjs.map +7 -0
- package/dist/lib/browser/chunk-Q66L5EUR.mjs +20 -0
- package/dist/lib/browser/chunk-Q66L5EUR.mjs.map +7 -0
- package/dist/lib/browser/chunk-TW27W3EL.mjs +29 -0
- package/dist/lib/browser/chunk-TW27W3EL.mjs.map +7 -0
- package/dist/lib/browser/{chunk-EZVXV6DA.mjs → chunk-WYR4QHPE.mjs} +7 -2
- package/dist/lib/browser/chunk-WYR4QHPE.mjs.map +7 -0
- package/dist/lib/browser/chunk-ZYU2LP6U.mjs +11 -0
- package/dist/lib/browser/chunk-ZYU2LP6U.mjs.map +7 -0
- package/dist/lib/browser/compiler-53G6ZHQM.mjs +99 -0
- package/dist/lib/browser/compiler-53G6ZHQM.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +111 -140
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/operation-resolver-CYEISDDK.mjs +79 -0
- package/dist/lib/browser/operation-resolver-CYEISDDK.mjs.map +7 -0
- package/dist/lib/browser/react-surface-26P6HAFD.mjs +141 -0
- package/dist/lib/browser/react-surface-26P6HAFD.mjs.map +7 -0
- package/dist/lib/browser/settings-76UM7442.mjs +36 -0
- package/dist/lib/browser/settings-76UM7442.mjs.map +7 -0
- package/dist/lib/browser/templates/index.mjs +2 -1
- package/dist/lib/browser/types/index.mjs +12 -7
- package/dist/lib/node-esm/DeploymentDialog-ZHPHEV2H.mjs +139 -0
- package/dist/lib/node-esm/DeploymentDialog-ZHPHEV2H.mjs.map +7 -0
- package/dist/lib/node-esm/{NotebookContainer-QY5NJGJI.mjs → NotebookContainer-ZLWTNMQA.mjs} +367 -200
- package/dist/lib/node-esm/NotebookContainer-ZLWTNMQA.mjs.map +7 -0
- package/dist/lib/node-esm/ScriptContainer-S4UKQAWP.mjs +94 -0
- package/dist/lib/node-esm/ScriptContainer-S4UKQAWP.mjs.map +7 -0
- package/dist/lib/node-esm/ScriptObjectSettings-C5QBRERY.mjs +295 -0
- package/dist/lib/node-esm/ScriptObjectSettings-C5QBRERY.mjs.map +7 -0
- package/dist/lib/node-esm/ScriptPluginSettings-MFACDW4R.mjs +56 -0
- package/dist/lib/node-esm/ScriptPluginSettings-MFACDW4R.mjs.map +7 -0
- package/dist/lib/node-esm/ScriptProperties-FMNIX3KU.mjs +29 -0
- package/dist/lib/node-esm/ScriptProperties-FMNIX3KU.mjs.map +7 -0
- package/dist/lib/node-esm/TestContainer-AO45YPGV.mjs +40 -0
- package/dist/lib/node-esm/TestContainer-AO45YPGV.mjs.map +7 -0
- package/dist/lib/node-esm/app-graph-builder-IGAZTJ45.mjs +70 -0
- package/dist/lib/node-esm/app-graph-builder-IGAZTJ45.mjs.map +7 -0
- package/dist/lib/node-esm/blueprint-definition-5MGY6BRQ.mjs +18 -0
- package/dist/lib/node-esm/blueprint-definition-5MGY6BRQ.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-5BG7OJGQ.mjs +176 -0
- package/dist/lib/node-esm/chunk-5BG7OJGQ.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-OG2SIKHE.mjs → chunk-5HSJPAK7.mjs} +7 -2
- package/dist/lib/node-esm/chunk-5HSJPAK7.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-H46R2RS5.mjs +790 -0
- package/dist/lib/node-esm/chunk-H46R2RS5.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-HSLMI22Q.mjs +11 -0
- package/dist/lib/node-esm/chunk-HSLMI22Q.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-JGN7TDJH.mjs +69 -0
- package/dist/lib/node-esm/chunk-JGN7TDJH.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-2GVTWESW.mjs → chunk-QG6ANK4B.mjs} +29 -12
- package/dist/lib/node-esm/chunk-QG6ANK4B.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-S7DSCLOW.mjs +31 -0
- package/dist/lib/node-esm/chunk-S7DSCLOW.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-TZ2EBTPQ.mjs +22 -0
- package/dist/lib/node-esm/chunk-TZ2EBTPQ.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-UFBVE33O.mjs +12 -0
- package/dist/lib/node-esm/chunk-UFBVE33O.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-WWD5LUU6.mjs +114 -0
- package/dist/lib/node-esm/chunk-WWD5LUU6.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-ZDJ2FI7E.mjs +398 -0
- package/dist/lib/node-esm/chunk-ZDJ2FI7E.mjs.map +7 -0
- package/dist/lib/node-esm/compiler-HHQW7EP3.mjs +100 -0
- package/dist/lib/node-esm/compiler-HHQW7EP3.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +111 -140
- 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-resolver-HFFDXWND.mjs +80 -0
- package/dist/lib/node-esm/operation-resolver-HFFDXWND.mjs.map +7 -0
- package/dist/lib/node-esm/react-surface-THCIK266.mjs +142 -0
- package/dist/lib/node-esm/react-surface-THCIK266.mjs.map +7 -0
- package/dist/lib/node-esm/settings-CCHDPLFJ.mjs +37 -0
- package/dist/lib/node-esm/settings-CCHDPLFJ.mjs.map +7 -0
- package/dist/lib/node-esm/templates/index.mjs +2 -1
- package/dist/lib/node-esm/types/index.mjs +12 -7
- 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-resolver/index.d.ts +3 -0
- package/dist/types/src/capabilities/operation-resolver/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts +5 -0
- package/dist/types/src/capabilities/operation-resolver/operation-resolver.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 +1 -1
- package/dist/types/src/components/FrameContainer/FrameContainer.d.ts.map +1 -1
- package/dist/types/src/components/NotebookStack/NotebookCell.d.ts +4 -3
- package/dist/types/src/components/NotebookStack/NotebookCell.d.ts.map +1 -1
- package/dist/types/src/components/NotebookStack/NotebookStack.d.ts +1 -1
- package/dist/types/src/components/NotebookStack/NotebookStack.d.ts.map +1 -1
- package/dist/types/src/components/NotebookStack/NotebookStack.stories.d.ts +5 -4
- 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 +8 -8
- package/dist/types/src/components/ScriptToolbar/ScriptToolbar.d.ts.map +1 -1
- package/dist/types/src/components/ScriptToolbar/ScriptToolbar.stories.d.ts +5 -4
- package/dist/types/src/components/ScriptToolbar/ScriptToolbar.stories.d.ts.map +1 -1
- 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 +3 -2
- package/dist/types/src/components/TypescriptEditor/TypescriptEditor.d.ts.map +1 -1
- package/dist/types/src/components/TypescriptEditor/TypescriptEditor.stories.d.ts +1 -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 +2 -4
- package/dist/types/src/containers/DeploymentDialog/DeploymentDialog.d.ts.map +1 -0
- package/dist/types/src/{components/NotebookContainer.stories.d.ts → containers/DeploymentDialog/DeploymentDialog.stories.d.ts} +7 -6
- 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/containers/ScriptObjectSettings/ScriptObjectSettings.d.ts +7 -0
- 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/containers/TestContainer/TestContainer.d.ts +8 -0
- package/dist/types/src/containers/TestContainer/TestContainer.d.ts.map +1 -0
- package/dist/types/src/containers/TestContainer/index.d.ts +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 +17 -31
- package/dist/types/src/hooks/deploy.d.ts.map +1 -1
- package/dist/types/src/hooks/format.d.ts +5 -4
- 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 +7 -16
- 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 +58 -0
- package/dist/types/src/notebook/compute-graph.d.ts.map +1 -0
- package/dist/types/src/notebook/compute-graph.test.d.ts +2 -0
- package/dist/types/src/notebook/compute-graph.test.d.ts.map +1 -0
- package/dist/types/src/notebook/eval.d.ts +1 -1
- package/dist/types/src/notebook/eval.d.ts.map +1 -1
- package/dist/types/src/notebook/index.d.ts +1 -1
- package/dist/types/src/notebook/index.d.ts.map +1 -1
- package/dist/types/src/templates/anthropic.d.ts +8 -0
- package/dist/types/src/templates/anthropic.d.ts.map +1 -0
- package/dist/types/src/templates/chess-bot.d.ts +16 -0
- package/dist/types/src/templates/chess-bot.d.ts.map +1 -0
- package/dist/types/src/templates/commentary.d.ts +16 -0
- package/dist/types/src/templates/commentary.d.ts.map +1 -0
- package/dist/types/src/templates/forex-effect.d.ts +4 -1
- package/dist/types/src/templates/forex-effect.d.ts.map +1 -1
- package/dist/types/src/templates/forex.d.ts +4 -1
- package/dist/types/src/templates/forex.d.ts.map +1 -1
- package/dist/types/src/templates/index.d.ts +12 -3
- package/dist/types/src/templates/index.d.ts.map +1 -1
- package/dist/types/src/templates/ping.d.ts +1 -4
- package/dist/types/src/templates/ping.d.ts.map +1 -1
- package/dist/types/src/testing/data.d.ts +2 -18
- package/dist/types/src/testing/data.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 -3
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/Notebook.d.ts +108 -0
- package/dist/types/src/types/Notebook.d.ts.map +1 -0
- package/dist/types/src/types/actions.d.ts +30 -56
- package/dist/types/src/types/actions.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 +4 -1
- package/dist/types/src/types/index.d.ts.map +1 -1
- package/dist/types/src/types/types.d.ts +6 -0
- package/dist/types/src/types/types.d.ts.map +1 -0
- package/dist/types/src/util/deploy.d.ts +4 -4
- package/dist/types/src/util/deploy.d.ts.map +1 -1
- package/dist/types/src/util/functions.d.ts +3 -3
- package/dist/types/src/util/functions.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +114 -82
- package/src/ScriptPlugin.tsx +45 -87
- package/src/blueprints/index.ts +5 -0
- package/src/blueprints/script-blueprint.ts +31 -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 -95
- 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-resolver/index.ts +7 -0
- package/src/capabilities/operation-resolver/operation-resolver.ts +75 -0
- package/src/capabilities/react-surface/index.ts +7 -0
- package/src/capabilities/react-surface/react-surface.tsx +121 -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 +6 -5
- package/src/components/FrameContainer/frame.html +21 -21
- package/src/components/NotebookStack/NotebookCell.tsx +85 -87
- package/src/components/NotebookStack/NotebookStack.stories.tsx +32 -10
- package/src/components/NotebookStack/NotebookStack.tsx +16 -9
- package/src/components/QueryEditor/QueryEditor.stories.tsx +102 -0
- package/src/components/QueryEditor/QueryEditor.tsx +47 -0
- package/src/components/QueryEditor/index.ts +5 -0
- package/src/components/ScriptToolbar/ScriptToolbar.stories.tsx +42 -20
- package/src/components/ScriptToolbar/ScriptToolbar.tsx +28 -31
- package/src/components/TestPanel/TestPanel.tsx +61 -36
- package/src/components/TestPanel/index.ts +0 -1
- package/src/components/TypescriptEditor/TypescriptEditor.stories.tsx +25 -18
- package/src/components/TypescriptEditor/TypescriptEditor.tsx +70 -74
- package/src/components/index.ts +4 -9
- package/src/constants.ts +7 -0
- package/src/containers/DeploymentDialog/DeploymentDialog.stories.tsx +61 -0
- package/src/containers/DeploymentDialog/DeploymentDialog.tsx +99 -0
- package/src/containers/DeploymentDialog/index.ts +7 -0
- package/src/containers/NotebookContainer/NotebookContainer.stories.tsx +87 -0
- package/src/containers/NotebookContainer/NotebookContainer.tsx +268 -0
- package/src/containers/NotebookContainer/index.ts +7 -0
- package/src/containers/ScriptContainer/ScriptContainer.tsx +84 -0
- package/src/containers/ScriptContainer/index.ts +7 -0
- package/src/{components/Settings → containers/ScriptObjectSettings}/ScriptObjectSettings.tsx +55 -50
- 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 +28 -0
- package/src/containers/TestContainer/index.ts +7 -0
- package/src/containers/index.ts +13 -0
- package/src/e2e/ai.test.ts +92 -0
- package/src/e2e/deploy.test.ts +64 -0
- package/src/hooks/deploy.ts +43 -35
- package/src/hooks/format.ts +8 -3
- package/src/hooks/index.ts +1 -0
- package/src/hooks/template.ts +22 -26
- package/src/hooks/useCompiler.ts +24 -0
- package/src/hooks/useCreateAndDeployScriptTemplates.ts +14 -16
- package/src/hooks/useToolbarState.ts +29 -4
- package/src/index.ts +2 -1
- package/src/meta.ts +8 -4
- package/src/notebook/{notebook.test.ts → compute-graph.test.ts} +31 -19
- package/src/notebook/{notebook.ts → compute-graph.ts} +65 -18
- package/src/notebook/eval.ts +1 -1
- package/src/notebook/index.ts +1 -1
- package/src/templates/anthropic.ts +42 -0
- package/src/templates/chess-bot.ts +58 -0
- package/src/templates/commentary.ts +231 -0
- package/src/templates/data-generator.ts +1 -1
- package/src/templates/forex-effect.ts +22 -27
- package/src/templates/forex.ts +7 -6
- package/src/templates/gmail.ts +1 -2
- package/src/templates/index.ts +18 -5
- package/src/templates/ping.ts +14 -5
- package/src/testing/data.ts +34 -9
- package/src/testing/simulator.test.ts +40 -0
- package/src/translations.ts +4 -3
- package/src/types/Notebook.ts +41 -0
- package/src/types/actions.ts +18 -26
- package/src/types/capabilities.ts +17 -0
- package/src/types/events.ts +11 -0
- package/src/types/index.ts +4 -1
- package/src/types/types.ts +15 -0
- package/src/util/deploy.ts +30 -40
- package/src/util/functions.ts +32 -28
- package/src/vite-env.d.ts +2 -0
- package/dist/lib/browser/DeploymentDialog-65TWT6S5.mjs +0 -13
- package/dist/lib/browser/NotebookContainer-LVGRPFY3.mjs.map +0 -7
- package/dist/lib/browser/ScriptContainer-LRTRN7JW.mjs +0 -149
- package/dist/lib/browser/ScriptContainer-LRTRN7JW.mjs.map +0 -7
- package/dist/lib/browser/app-graph-builder-DPYULSME.mjs +0 -65
- package/dist/lib/browser/app-graph-builder-DPYULSME.mjs.map +0 -7
- package/dist/lib/browser/blueprint-definition-ET5KZ46I.mjs +0 -28
- package/dist/lib/browser/blueprint-definition-ET5KZ46I.mjs.map +0 -7
- package/dist/lib/browser/chunk-5CYLWXRH.mjs +0 -89
- package/dist/lib/browser/chunk-5CYLWXRH.mjs.map +0 -7
- package/dist/lib/browser/chunk-75LH4EUR.mjs +0 -326
- package/dist/lib/browser/chunk-75LH4EUR.mjs.map +0 -7
- package/dist/lib/browser/chunk-E7DXDICD.mjs +0 -282
- package/dist/lib/browser/chunk-E7DXDICD.mjs.map +0 -7
- package/dist/lib/browser/chunk-EZVXV6DA.mjs.map +0 -7
- package/dist/lib/browser/chunk-I3QSGUFJ.mjs +0 -646
- package/dist/lib/browser/chunk-I3QSGUFJ.mjs.map +0 -7
- package/dist/lib/browser/chunk-JO2O7W6J.mjs +0 -254
- package/dist/lib/browser/chunk-JO2O7W6J.mjs.map +0 -7
- package/dist/lib/browser/chunk-N6M34EUC.mjs +0 -112
- package/dist/lib/browser/chunk-N6M34EUC.mjs.map +0 -7
- package/dist/lib/browser/chunk-NM4WQS4F.mjs +0 -153
- package/dist/lib/browser/chunk-NM4WQS4F.mjs.map +0 -7
- package/dist/lib/browser/chunk-OKXN2N7M.mjs +0 -15
- package/dist/lib/browser/chunk-OKXN2N7M.mjs.map +0 -7
- package/dist/lib/browser/chunk-ST3ACVUC.mjs.map +0 -7
- package/dist/lib/browser/compiler-G2N2CG63.mjs +0 -98
- package/dist/lib/browser/compiler-G2N2CG63.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-JLU7DVLQ.mjs +0 -105
- package/dist/lib/browser/intent-resolver-JLU7DVLQ.mjs.map +0 -7
- package/dist/lib/browser/react-surface-76SDTUYG.mjs +0 -127
- package/dist/lib/browser/react-surface-76SDTUYG.mjs.map +0 -7
- package/dist/lib/browser/settings-ERFKVNUK.mjs +0 -25
- package/dist/lib/browser/settings-ERFKVNUK.mjs.map +0 -7
- package/dist/lib/node-esm/DeploymentDialog-I63ZC2HH.mjs +0 -14
- package/dist/lib/node-esm/NotebookContainer-QY5NJGJI.mjs.map +0 -7
- package/dist/lib/node-esm/ScriptContainer-SVXCSLNH.mjs +0 -150
- package/dist/lib/node-esm/ScriptContainer-SVXCSLNH.mjs.map +0 -7
- package/dist/lib/node-esm/app-graph-builder-UXJGHXSL.mjs +0 -66
- package/dist/lib/node-esm/app-graph-builder-UXJGHXSL.mjs.map +0 -7
- package/dist/lib/node-esm/blueprint-definition-AIYFOT7Q.mjs +0 -30
- package/dist/lib/node-esm/blueprint-definition-AIYFOT7Q.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-2GVTWESW.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-4X375PGY.mjs +0 -90
- package/dist/lib/node-esm/chunk-4X375PGY.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-67OVZHI3.mjs +0 -327
- package/dist/lib/node-esm/chunk-67OVZHI3.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-C2ORIPKH.mjs +0 -154
- package/dist/lib/node-esm/chunk-C2ORIPKH.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-NUXZQQ6P.mjs +0 -16
- package/dist/lib/node-esm/chunk-NUXZQQ6P.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-OG2SIKHE.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-SMFPSKQT.mjs +0 -647
- package/dist/lib/node-esm/chunk-SMFPSKQT.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-VRSDE4CI.mjs +0 -114
- package/dist/lib/node-esm/chunk-VRSDE4CI.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-VZAFGLD7.mjs +0 -283
- package/dist/lib/node-esm/chunk-VZAFGLD7.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-YW36TZ7K.mjs +0 -255
- package/dist/lib/node-esm/chunk-YW36TZ7K.mjs.map +0 -7
- package/dist/lib/node-esm/compiler-PLDAZ5GJ.mjs +0 -99
- package/dist/lib/node-esm/compiler-PLDAZ5GJ.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-SFGTIFOG.mjs +0 -106
- package/dist/lib/node-esm/intent-resolver-SFGTIFOG.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-SHEBNW4R.mjs +0 -128
- package/dist/lib/node-esm/react-surface-SHEBNW4R.mjs.map +0 -7
- package/dist/lib/node-esm/settings-5TYXQ42N.mjs +0 -26
- package/dist/lib/node-esm/settings-5TYXQ42N.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 +0 -251
- 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/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.map +0 -1
- package/dist/types/src/components/ScriptContainer.d.ts +0 -12
- package/dist/types/src/components/ScriptContainer.d.ts.map +0 -1
- package/dist/types/src/components/Settings/ScriptObjectSettings.d.ts +0 -8
- package/dist/types/src/components/Settings/ScriptObjectSettings.d.ts.map +0 -1
- package/dist/types/src/components/Settings/ScriptPluginSettings.d.ts +0 -6
- package/dist/types/src/components/Settings/ScriptPluginSettings.d.ts.map +0 -1
- package/dist/types/src/components/Settings/index.d.ts +0 -3
- package/dist/types/src/components/Settings/index.d.ts.map +0 -1
- package/dist/types/src/components/TestPanel/TestContainer.d.ts +0 -8
- package/dist/types/src/components/TestPanel/TestContainer.d.ts.map +0 -1
- package/dist/types/src/events.d.ts +0 -4
- package/dist/types/src/events.d.ts.map +0 -1
- package/dist/types/src/notebook/notebook.d.ts +0 -35
- package/dist/types/src/notebook/notebook.d.ts.map +0 -1
- package/dist/types/src/notebook/notebook.test.d.ts +0 -2
- package/dist/types/src/notebook/notebook.test.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/schema.d.ts +0 -61
- package/dist/types/src/types/schema.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 -87
- package/src/capabilities/react-surface.tsx +0 -102
- package/src/capabilities/settings.ts +0 -21
- package/src/components/DeploymentDialog/DeploymentDialog.stories.tsx +0 -53
- package/src/components/DeploymentDialog/DeploymentDialog.tsx +0 -106
- package/src/components/DeploymentDialog/index.ts +0 -9
- package/src/components/NotebookContainer.stories.tsx +0 -32
- package/src/components/NotebookContainer.tsx +0 -124
- 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/schema.ts +0 -48
- /package/dist/lib/browser/{DeploymentDialog-65TWT6S5.mjs.map → blueprints/index.mjs.map} +0 -0
- /package/dist/lib/{node-esm/DeploymentDialog-I63ZC2HH.mjs.map → browser/chunk-J5LGTIGS.mjs.map} +0 -0
package/src/{components/Settings → containers/ScriptObjectSettings}/ScriptObjectSettings.tsx
RENAMED
|
@@ -6,20 +6,23 @@ import { Octokit } from '@octokit/core';
|
|
|
6
6
|
import React, { type ChangeEvent, useCallback, useState } from 'react';
|
|
7
7
|
|
|
8
8
|
import { ToolId } from '@dxos/ai';
|
|
9
|
-
import {
|
|
9
|
+
import { useOperationInvoker } from '@dxos/app-framework/ui';
|
|
10
|
+
import { SettingsOperation } from '@dxos/app-toolkit';
|
|
10
11
|
import { Blueprint, Template } from '@dxos/blueprints';
|
|
11
|
-
import {
|
|
12
|
+
import { Filter, Obj, Ref } from '@dxos/echo';
|
|
13
|
+
import { Function, type Script, getUserFunctionIdInMetadata } from '@dxos/functions';
|
|
14
|
+
import { getInvocationUrl } from '@dxos/functions-runtime';
|
|
12
15
|
import { log } from '@dxos/log';
|
|
13
16
|
import { useClient } from '@dxos/react-client';
|
|
14
|
-
import {
|
|
17
|
+
import { useQuery } from '@dxos/react-client/echo';
|
|
15
18
|
import { Button, Clipboard, Input, useAsyncEffect, useControlledState, useTranslation } from '@dxos/react-ui';
|
|
16
|
-
import {
|
|
19
|
+
import { AccessToken } from '@dxos/types';
|
|
17
20
|
import { kebabize } from '@dxos/util';
|
|
18
21
|
|
|
19
22
|
import { meta } from '../../meta';
|
|
20
23
|
|
|
21
24
|
export type ScriptObjectSettingsProps = {
|
|
22
|
-
object:
|
|
25
|
+
object: Script.Script;
|
|
23
26
|
};
|
|
24
27
|
|
|
25
28
|
export const ScriptObjectSettings = ({ object }: ScriptObjectSettingsProps) => {
|
|
@@ -32,27 +35,11 @@ export const ScriptObjectSettings = ({ object }: ScriptObjectSettingsProps) => {
|
|
|
32
35
|
);
|
|
33
36
|
};
|
|
34
37
|
|
|
35
|
-
export const ScriptProperties = ({ object }: ScriptObjectSettingsProps) => {
|
|
36
|
-
const { t } = useTranslation(meta.id);
|
|
37
|
-
return (
|
|
38
|
-
<Input.Root>
|
|
39
|
-
<Input.Label>{t('description label')}</Input.Label>
|
|
40
|
-
<Input.TextInput
|
|
41
|
-
placeholder={t('description placeholder')}
|
|
42
|
-
value={object.description ?? ''}
|
|
43
|
-
onChange={(event) => {
|
|
44
|
-
object.description = event.target.value;
|
|
45
|
-
}}
|
|
46
|
-
/>
|
|
47
|
-
</Input.Root>
|
|
48
|
-
);
|
|
49
|
-
};
|
|
50
|
-
|
|
51
38
|
const BlueprintEditor = ({ object }: ScriptObjectSettingsProps) => {
|
|
52
39
|
const { t } = useTranslation(meta.id);
|
|
53
|
-
const
|
|
54
|
-
const [fn] = useQuery(
|
|
55
|
-
const blueprints = useQuery(
|
|
40
|
+
const db = Obj.getDatabase(object);
|
|
41
|
+
const [fn] = useQuery(db, Filter.type(Function.Function, { source: Ref.make(object) }));
|
|
42
|
+
const blueprints = useQuery(db, Filter.type(Blueprint.Blueprint));
|
|
56
43
|
|
|
57
44
|
const [creating, setCreating] = useState(false);
|
|
58
45
|
const [instructions, setInstructions] = useState<string>(`You can run the script "${object.name ?? 'script'}".`);
|
|
@@ -68,7 +55,7 @@ const BlueprintEditor = ({ object }: ScriptObjectSettingsProps) => {
|
|
|
68
55
|
}, [existingBlueprint]);
|
|
69
56
|
|
|
70
57
|
const handleSave = useCallback(async () => {
|
|
71
|
-
if (!
|
|
58
|
+
if (!db) {
|
|
72
59
|
return;
|
|
73
60
|
}
|
|
74
61
|
|
|
@@ -76,15 +63,19 @@ const BlueprintEditor = ({ object }: ScriptObjectSettingsProps) => {
|
|
|
76
63
|
try {
|
|
77
64
|
if (existingBlueprint) {
|
|
78
65
|
const text = await existingBlueprint.instructions.source.load();
|
|
79
|
-
text
|
|
66
|
+
Obj.change(text, (t) => {
|
|
67
|
+
t.content = instructions;
|
|
68
|
+
});
|
|
80
69
|
if (fn?.key) {
|
|
81
70
|
const toolId = ToolId.make(fn.key);
|
|
82
71
|
if (!existingBlueprint.tools?.includes(toolId)) {
|
|
83
|
-
|
|
72
|
+
Obj.change(existingBlueprint, (b) => {
|
|
73
|
+
b.tools = [...(b.tools ?? []), toolId];
|
|
74
|
+
});
|
|
84
75
|
}
|
|
85
76
|
}
|
|
86
77
|
} else if (fn?.key) {
|
|
87
|
-
|
|
78
|
+
db.add(
|
|
88
79
|
Blueprint.make({
|
|
89
80
|
key: blueprintKey,
|
|
90
81
|
name: object.name ?? 'Script',
|
|
@@ -95,25 +86,29 @@ const BlueprintEditor = ({ object }: ScriptObjectSettingsProps) => {
|
|
|
95
86
|
}),
|
|
96
87
|
);
|
|
97
88
|
}
|
|
98
|
-
await
|
|
89
|
+
await db.flush();
|
|
99
90
|
} finally {
|
|
100
91
|
setCreating(false);
|
|
101
92
|
}
|
|
102
|
-
}, [
|
|
93
|
+
}, [db, existingBlueprint, fn, blueprintKey, object.name, instructions]);
|
|
103
94
|
|
|
104
95
|
return (
|
|
105
|
-
<div className='flex flex-col gap-4
|
|
96
|
+
<div className='flex flex-col gap-4 my-form-padding'>
|
|
106
97
|
<div>
|
|
107
98
|
<h2>{t('blueprint editor label', { default: 'Blueprint' })}</h2>
|
|
108
99
|
<p className='text-description text-sm'>
|
|
109
|
-
{t('blueprint editor description', {
|
|
100
|
+
{t('blueprint editor description', {
|
|
101
|
+
default: 'Create a blueprint that exposes this script as a tool.',
|
|
102
|
+
})}
|
|
110
103
|
</p>
|
|
111
104
|
</div>
|
|
112
105
|
<Input.Root>
|
|
113
106
|
<div role='none' className='flex flex-col gap-1'>
|
|
114
107
|
<Input.Label>{t('blueprint instructions label', { default: 'Instructions' })}</Input.Label>
|
|
115
108
|
<Input.TextArea
|
|
116
|
-
placeholder={t('blueprint instructions placeholder', {
|
|
109
|
+
placeholder={t('blueprint instructions placeholder', {
|
|
110
|
+
default: 'Describe how this tool should be used.',
|
|
111
|
+
})}
|
|
117
112
|
rows={6}
|
|
118
113
|
value={instructions}
|
|
119
114
|
onChange={(event) => setInstructions(event.target.value)}
|
|
@@ -135,14 +130,14 @@ const BlueprintEditor = ({ object }: ScriptObjectSettingsProps) => {
|
|
|
135
130
|
const Binding = ({ object }: ScriptObjectSettingsProps) => {
|
|
136
131
|
const { t } = useTranslation(meta.id);
|
|
137
132
|
const client = useClient();
|
|
138
|
-
const
|
|
139
|
-
const [fn] = useQuery(
|
|
133
|
+
const db = Obj.getDatabase(object);
|
|
134
|
+
const [fn] = useQuery(db, Filter.type(Function.Function, { source: Ref.make(object) }));
|
|
140
135
|
|
|
141
|
-
const functionId = fn && getUserFunctionIdInMetadata(getMeta(fn));
|
|
136
|
+
const functionId = fn && getUserFunctionIdInMetadata(Obj.getMeta(fn));
|
|
142
137
|
const functionUrl =
|
|
143
138
|
functionId &&
|
|
144
139
|
getInvocationUrl(functionId, client.config.values.runtime?.services?.edge?.url ?? '', {
|
|
145
|
-
spaceId:
|
|
140
|
+
spaceId: db?.spaceId,
|
|
146
141
|
});
|
|
147
142
|
|
|
148
143
|
const [binding, setBinding] = useControlledState(fn?.binding ?? '');
|
|
@@ -154,7 +149,9 @@ const Binding = ({ object }: ScriptObjectSettingsProps) => {
|
|
|
154
149
|
);
|
|
155
150
|
|
|
156
151
|
const handleBindingBlur = useCallback(() => {
|
|
157
|
-
fn
|
|
152
|
+
Obj.change(fn, (f) => {
|
|
153
|
+
f.binding = binding;
|
|
154
|
+
});
|
|
158
155
|
}, [fn, binding]);
|
|
159
156
|
|
|
160
157
|
if (!fn || !functionUrl) {
|
|
@@ -163,7 +160,7 @@ const Binding = ({ object }: ScriptObjectSettingsProps) => {
|
|
|
163
160
|
|
|
164
161
|
// TODO(burdon): Use form.
|
|
165
162
|
return (
|
|
166
|
-
<div role='form' className='flex flex-col gap-2
|
|
163
|
+
<div role='form' className='flex flex-col gap-2 my-form-padding'>
|
|
167
164
|
<h2>{t('remote function settings heading')}</h2>
|
|
168
165
|
<Input.Root>
|
|
169
166
|
<div role='none' className='flex flex-col gap-1'>
|
|
@@ -173,7 +170,9 @@ const Binding = ({ object }: ScriptObjectSettingsProps) => {
|
|
|
173
170
|
disabled
|
|
174
171
|
value={functionUrl}
|
|
175
172
|
onChange={(event) => {
|
|
176
|
-
fn
|
|
173
|
+
Obj.change(fn, (f) => {
|
|
174
|
+
f.name = event.target.value;
|
|
175
|
+
});
|
|
177
176
|
}}
|
|
178
177
|
/>
|
|
179
178
|
<Clipboard.IconButton value={functionUrl} />
|
|
@@ -198,10 +197,10 @@ const Binding = ({ object }: ScriptObjectSettingsProps) => {
|
|
|
198
197
|
// TODO(burdon): Move to separate tab?
|
|
199
198
|
const Publishing = ({ object }: ScriptObjectSettingsProps) => {
|
|
200
199
|
const { t } = useTranslation(meta.id);
|
|
201
|
-
const {
|
|
202
|
-
const
|
|
203
|
-
const [githubToken] = useQuery(
|
|
204
|
-
const gistKey = getMeta(object).keys.find(({ source }) => source === 'github.com');
|
|
200
|
+
const { invokePromise } = useOperationInvoker();
|
|
201
|
+
const db = Obj.getDatabase(object);
|
|
202
|
+
const [githubToken] = useQuery(db, Filter.type(AccessToken.AccessToken, { source: 'github.com' }));
|
|
203
|
+
const gistKey = Obj.getMeta(object).keys.find(({ source }) => source === 'github.com');
|
|
205
204
|
const [gistUrl, setGistUrl] = useState<string | undefined>();
|
|
206
205
|
|
|
207
206
|
useAsyncEffect(async () => {
|
|
@@ -225,8 +224,11 @@ const Publishing = ({ object }: ScriptObjectSettingsProps) => {
|
|
|
225
224
|
}, [githubToken, gistKey]);
|
|
226
225
|
|
|
227
226
|
const handleOpenTokenManager = useCallback(
|
|
228
|
-
() =>
|
|
229
|
-
|
|
227
|
+
() =>
|
|
228
|
+
invokePromise(SettingsOperation.Open, {
|
|
229
|
+
plugin: 'dxos.org/plugin/token-manager',
|
|
230
|
+
}),
|
|
231
|
+
[invokePromise],
|
|
230
232
|
);
|
|
231
233
|
|
|
232
234
|
const [publishing, setPublishing] = useState(false);
|
|
@@ -239,7 +241,7 @@ const Publishing = ({ object }: ScriptObjectSettingsProps) => {
|
|
|
239
241
|
|
|
240
242
|
try {
|
|
241
243
|
// TODO(wittjosiah): Factor out to intent.
|
|
242
|
-
const meta = getMeta(object);
|
|
244
|
+
const meta = Obj.getMeta(object);
|
|
243
245
|
const githubKey = meta.keys.find(({ source }) => source === 'github.com');
|
|
244
246
|
const gistId = githubKey?.id;
|
|
245
247
|
if (gistId) {
|
|
@@ -252,8 +254,11 @@ const Publishing = ({ object }: ScriptObjectSettingsProps) => {
|
|
|
252
254
|
public: true,
|
|
253
255
|
files,
|
|
254
256
|
});
|
|
255
|
-
|
|
256
|
-
|
|
257
|
+
const gistId = response.data.id;
|
|
258
|
+
if (gistId) {
|
|
259
|
+
Obj.change(object, (obj) => {
|
|
260
|
+
Obj.getMeta(obj).keys.push({ source: 'github.com', id: gistId });
|
|
261
|
+
});
|
|
257
262
|
}
|
|
258
263
|
}
|
|
259
264
|
} finally {
|
|
@@ -262,7 +267,7 @@ const Publishing = ({ object }: ScriptObjectSettingsProps) => {
|
|
|
262
267
|
}, [object, githubToken]);
|
|
263
268
|
|
|
264
269
|
return (
|
|
265
|
-
<div className='flex flex-col gap-4
|
|
270
|
+
<div className='flex flex-col gap-4 my-form-padding'>
|
|
266
271
|
<div>
|
|
267
272
|
<h2>{t('script publish settings label')}</h2>
|
|
268
273
|
<p className='text-description text-sm'>{t('script publish settings description')}</p>
|
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, (o) => {
|
|
27
|
+
o.description = event.target.value;
|
|
28
|
+
});
|
|
29
|
+
}}
|
|
30
|
+
/>
|
|
31
|
+
</Input.Root>
|
|
32
|
+
);
|
|
33
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import React from 'react';
|
|
6
|
+
|
|
7
|
+
import { type Script } from '@dxos/functions';
|
|
8
|
+
import { Panel } from '@dxos/react-ui';
|
|
9
|
+
|
|
10
|
+
import { TestPanel } from '../../components';
|
|
11
|
+
import { useDeployState, useToolbarState } from '../../hooks';
|
|
12
|
+
|
|
13
|
+
export type TestContainerProps = {
|
|
14
|
+
role: string;
|
|
15
|
+
script: Script.Script;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export const TestContainer = ({ role, script }: TestContainerProps) => {
|
|
19
|
+
const state = useToolbarState();
|
|
20
|
+
useDeployState({ state, script });
|
|
21
|
+
return (
|
|
22
|
+
<Panel.Root role={role} className='dx-article'>
|
|
23
|
+
<Panel.Content asChild>
|
|
24
|
+
<TestPanel functionUrl={state.value.functionUrl} />
|
|
25
|
+
</Panel.Content>
|
|
26
|
+
</Panel.Root>
|
|
27
|
+
);
|
|
28
|
+
};
|
|
@@ -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,92 @@
|
|
|
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 { Function } from '@dxos/functions';
|
|
12
|
+
import { FunctionsServiceClient } from '@dxos/functions-runtime/edge';
|
|
13
|
+
import { bundleFunction } from '@dxos/functions-runtime/native';
|
|
14
|
+
import { FunctionRuntimeKind } from '@dxos/protocols';
|
|
15
|
+
import { EdgeReplicationSetting } from '@dxos/protocols/proto/dxos/echo/metadata';
|
|
16
|
+
|
|
17
|
+
// To heavy to run in CI.
|
|
18
|
+
describe.runIf(process.env.DX_TEST_TAGS?.includes('functions-e2e')).skip('Function', () => {
|
|
19
|
+
const config = configPreset({ edge: 'local' });
|
|
20
|
+
|
|
21
|
+
test('bundle anthropic function', { timeout: 120_000 }, async () => {
|
|
22
|
+
await bundleFunction({
|
|
23
|
+
entryPoint: new URL('../templates/anthropic.ts', import.meta.url).pathname,
|
|
24
|
+
verbose: true,
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
test('deploy empty function', { timeout: 120_000 }, async () => {
|
|
29
|
+
const { space, functionsServiceClient } = await setup();
|
|
30
|
+
|
|
31
|
+
await sync(space);
|
|
32
|
+
const func = await deployFunction(
|
|
33
|
+
space,
|
|
34
|
+
functionsServiceClient,
|
|
35
|
+
new URL('../templates/ping.ts', import.meta.url).pathname,
|
|
36
|
+
);
|
|
37
|
+
console.log(func);
|
|
38
|
+
throw new Error('test');
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
test('deploy and invoke anthropic function', { timeout: 120_000 }, async () => {
|
|
42
|
+
const { space, functionsServiceClient } = await setup();
|
|
43
|
+
await sync(space);
|
|
44
|
+
const func = await deployFunction(
|
|
45
|
+
space,
|
|
46
|
+
functionsServiceClient,
|
|
47
|
+
new URL('../templates/anthropic.ts', import.meta.url).pathname,
|
|
48
|
+
);
|
|
49
|
+
|
|
50
|
+
const result = await functionsServiceClient.invoke(func, {
|
|
51
|
+
message: 'Hello, world!',
|
|
52
|
+
});
|
|
53
|
+
console.log(result);
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
const setup = async () => {
|
|
57
|
+
const client = await new Client({ config, types: [Function.Function] }).initialize();
|
|
58
|
+
await client.halo.createIdentity();
|
|
59
|
+
|
|
60
|
+
const space = await client.spaces.create();
|
|
61
|
+
await space.waitUntilReady();
|
|
62
|
+
await space.internal.setEdgeReplicationPreference(EdgeReplicationSetting.ENABLED);
|
|
63
|
+
|
|
64
|
+
const functionsServiceClient = FunctionsServiceClient.fromClient(client);
|
|
65
|
+
return { client, space, functionsServiceClient };
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
const sync = async (space: Space) => {
|
|
69
|
+
await space.db.flush({ indexes: true });
|
|
70
|
+
await space.internal.syncToEdge({
|
|
71
|
+
onProgress: (state) =>
|
|
72
|
+
console.log(state ? `${state.unsyncedDocumentCount} documents syncing...` : 'connecting to edge...'),
|
|
73
|
+
});
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
const deployFunction = async (space: Space, functionsServiceClient: FunctionsServiceClient, entryPoint: string) => {
|
|
77
|
+
const artifact = await bundleFunction({
|
|
78
|
+
entryPoint,
|
|
79
|
+
verbose: true,
|
|
80
|
+
});
|
|
81
|
+
const func = await functionsServiceClient.deploy({
|
|
82
|
+
version: '0.0.1',
|
|
83
|
+
ownerPublicKey: space.key,
|
|
84
|
+
entryPoint: artifact.entryPoint,
|
|
85
|
+
assets: artifact.assets,
|
|
86
|
+
runtime: FunctionRuntimeKind.enums.WORKER_LOADER,
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
space.db.add(func);
|
|
90
|
+
return func;
|
|
91
|
+
};
|
|
92
|
+
});
|
|
@@ -0,0 +1,64 @@
|
|
|
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 { bundleFunction } from '@dxos/functions-runtime/bundler';
|
|
13
|
+
import { FunctionsServiceClient } from '@dxos/functions-runtime/edge';
|
|
14
|
+
import { invariant } from '@dxos/invariant';
|
|
15
|
+
import { log } from '@dxos/log';
|
|
16
|
+
|
|
17
|
+
describe.runIf(process.env.DX_TEST_TAGS?.includes('functions-e2e'))('Functions deployment', () => {
|
|
18
|
+
test('deploys FOREX (effect) function and invokes it via EDGE (main)', { timeout: 120_000 }, async () => {
|
|
19
|
+
const config = configPreset({ edge: 'main' });
|
|
20
|
+
await testDeploy(config);
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
test('deploys FOREX (effect) function and invokes it via EDGE (production)', { timeout: 120_000 }, async () => {
|
|
24
|
+
const config = configPreset({ edge: 'production' });
|
|
25
|
+
await testDeploy(config);
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
const testDeploy = async (config: Config) => {
|
|
29
|
+
await using client = await new Client({ config }).initialize();
|
|
30
|
+
await client.halo.createIdentity();
|
|
31
|
+
|
|
32
|
+
const space = await client.spaces.create();
|
|
33
|
+
await space.waitUntilReady();
|
|
34
|
+
|
|
35
|
+
// Inline echo function source.
|
|
36
|
+
const source = await readFile(new URL('../templates/forex-effect.ts', import.meta.url), 'utf-8');
|
|
37
|
+
|
|
38
|
+
// Bundle and upload.
|
|
39
|
+
const buildResult = await bundleFunction({ source });
|
|
40
|
+
if ('error' in buildResult) {
|
|
41
|
+
throw buildResult.error ?? new Error('Bundle creation failed');
|
|
42
|
+
}
|
|
43
|
+
const functionsServiceClient = FunctionsServiceClient.fromClient(client);
|
|
44
|
+
|
|
45
|
+
const func = await functionsServiceClient.deploy({
|
|
46
|
+
ownerPublicKey: space.key,
|
|
47
|
+
version: '0.0.1',
|
|
48
|
+
entryPoint: buildResult.entryPoint,
|
|
49
|
+
assets: buildResult.assets,
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
// Invoke deployed function via EDGE directly.
|
|
53
|
+
const edgeClient = client.edge.http;
|
|
54
|
+
invariant(edgeClient, 'edgeClient is required');
|
|
55
|
+
edgeClient.setIdentity(createEdgeIdentity(client));
|
|
56
|
+
|
|
57
|
+
const input = { from: 'USD', to: 'EUR' };
|
|
58
|
+
const result = await functionsServiceClient.invoke(func, input);
|
|
59
|
+
log.info('>>> result', { result, func });
|
|
60
|
+
const resultNumber = Number(result);
|
|
61
|
+
expect(resultNumber).toBeGreaterThan(0);
|
|
62
|
+
expect(resultNumber).toBeLessThan(100);
|
|
63
|
+
};
|
|
64
|
+
});
|