@dxos/plugin-script 0.8.4-main.67995b8 → 0.8.4-main.6fa680abb7
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-J34VKLNR.mjs +138 -0
- package/dist/lib/browser/DeploymentDialog-J34VKLNR.mjs.map +7 -0
- package/dist/lib/browser/NotebookContainer-EL6AHDB7.mjs +849 -0
- package/dist/lib/browser/NotebookContainer-EL6AHDB7.mjs.map +7 -0
- package/dist/lib/browser/ScriptContainer-YCS6M5LS.mjs +93 -0
- package/dist/lib/browser/ScriptContainer-YCS6M5LS.mjs.map +7 -0
- package/dist/lib/browser/ScriptObjectSettings-X4WV5TBD.mjs +294 -0
- package/dist/lib/browser/ScriptObjectSettings-X4WV5TBD.mjs.map +7 -0
- package/dist/lib/browser/ScriptPluginSettings-5WUKIWCC.mjs +55 -0
- package/dist/lib/browser/ScriptPluginSettings-5WUKIWCC.mjs.map +7 -0
- package/dist/lib/browser/ScriptProperties-5YERQAL2.mjs +28 -0
- package/dist/lib/browser/ScriptProperties-5YERQAL2.mjs.map +7 -0
- package/dist/lib/browser/TestContainer-NZ4YZOYT.mjs +39 -0
- package/dist/lib/browser/TestContainer-NZ4YZOYT.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-2UX353LT.mjs +17 -0
- package/dist/lib/browser/blueprint-definition-2UX353LT.mjs.map +7 -0
- package/dist/lib/browser/blueprints/index.mjs +8 -0
- package/dist/lib/browser/{chunk-QYAREHGH.mjs → chunk-37XPSUAH.mjs} +9 -6
- package/dist/lib/browser/chunk-37XPSUAH.mjs.map +7 -0
- package/dist/lib/browser/chunk-3KBF2IW7.mjs +20 -0
- package/dist/lib/browser/chunk-3KBF2IW7.mjs.map +7 -0
- package/dist/lib/browser/chunk-7LHEB2QO.mjs +397 -0
- package/dist/lib/browser/chunk-7LHEB2QO.mjs.map +7 -0
- package/dist/lib/browser/chunk-7SXHORK4.mjs +105 -0
- package/dist/lib/browser/chunk-7SXHORK4.mjs.map +7 -0
- package/dist/lib/browser/{compiler-CXCUA4UQ.mjs → chunk-ATTZUDT7.mjs} +17 -32
- 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-MVIWELNH.mjs +789 -0
- package/dist/lib/browser/chunk-MVIWELNH.mjs.map +7 -0
- package/dist/lib/browser/chunk-MYSQ4VH5.mjs +29 -0
- package/dist/lib/browser/chunk-MYSQ4VH5.mjs.map +7 -0
- package/dist/lib/browser/chunk-QUKW7YWV.mjs +113 -0
- package/dist/lib/browser/chunk-QUKW7YWV.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-4JVZK3D2.mjs +99 -0
- package/dist/lib/browser/compiler-4JVZK3D2.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +147 -106
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/operation-resolver-GU3NMGIL.mjs +79 -0
- package/dist/lib/browser/operation-resolver-GU3NMGIL.mjs.map +7 -0
- package/dist/lib/browser/react-surface-JEDP6MPG.mjs +142 -0
- package/dist/lib/browser/react-surface-JEDP6MPG.mjs.map +7 -0
- package/dist/lib/browser/settings-EEXY6JM7.mjs +36 -0
- package/dist/lib/browser/settings-EEXY6JM7.mjs.map +7 -0
- package/dist/lib/browser/templates/index.mjs +2 -1
- package/dist/lib/browser/types/index.mjs +14 -6
- package/dist/lib/node-esm/DeploymentDialog-AU5IG3AN.mjs +139 -0
- package/dist/lib/node-esm/DeploymentDialog-AU5IG3AN.mjs.map +7 -0
- package/dist/lib/node-esm/NotebookContainer-2J3TNVUY.mjs +850 -0
- package/dist/lib/node-esm/NotebookContainer-2J3TNVUY.mjs.map +7 -0
- package/dist/lib/node-esm/ScriptContainer-67PHQKMM.mjs +94 -0
- package/dist/lib/node-esm/ScriptContainer-67PHQKMM.mjs.map +7 -0
- package/dist/lib/node-esm/ScriptObjectSettings-RPY2ZLDJ.mjs +295 -0
- package/dist/lib/node-esm/ScriptObjectSettings-RPY2ZLDJ.mjs.map +7 -0
- package/dist/lib/node-esm/ScriptPluginSettings-H4ESISSG.mjs +56 -0
- package/dist/lib/node-esm/ScriptPluginSettings-H4ESISSG.mjs.map +7 -0
- package/dist/lib/node-esm/ScriptProperties-NNDYQTOW.mjs +29 -0
- package/dist/lib/node-esm/ScriptProperties-NNDYQTOW.mjs.map +7 -0
- package/dist/lib/node-esm/TestContainer-5TMMG7HV.mjs +40 -0
- package/dist/lib/node-esm/TestContainer-5TMMG7HV.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-4UDBPYRQ.mjs +18 -0
- package/dist/lib/node-esm/blueprint-definition-4UDBPYRQ.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-3EV4C6GW.mjs +107 -0
- package/dist/lib/node-esm/chunk-3EV4C6GW.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-5BG7OJGQ.mjs +176 -0
- package/dist/lib/node-esm/chunk-5BG7OJGQ.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-CPJJOBC3.mjs +790 -0
- package/dist/lib/node-esm/chunk-CPJJOBC3.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-DQMM7ZL5.mjs +31 -0
- package/dist/lib/node-esm/chunk-DQMM7ZL5.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-EP474OF4.mjs +398 -0
- package/dist/lib/node-esm/chunk-EP474OF4.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/{compiler-EPFKQXPE.mjs → chunk-JGN7TDJH.mjs} +17 -31
- package/dist/lib/node-esm/chunk-JGN7TDJH.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-AHXJ6NQU.mjs → chunk-L3JLWXB5.mjs} +9 -6
- package/dist/lib/node-esm/chunk-L3JLWXB5.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-QZOKU2JW.mjs +22 -0
- package/dist/lib/node-esm/chunk-QZOKU2JW.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-WZ4YV7VB.mjs +114 -0
- package/dist/lib/node-esm/chunk-WZ4YV7VB.mjs.map +7 -0
- package/dist/lib/node-esm/compiler-QOSDBXG2.mjs +100 -0
- package/dist/lib/node-esm/compiler-QOSDBXG2.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +147 -106
- 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-YAT75MET.mjs +80 -0
- package/dist/lib/node-esm/operation-resolver-YAT75MET.mjs.map +7 -0
- package/dist/lib/node-esm/react-surface-SABRQNVU.mjs +143 -0
- package/dist/lib/node-esm/react-surface-SABRQNVU.mjs.map +7 -0
- package/dist/lib/node-esm/settings-QMDXGZCI.mjs +37 -0
- package/dist/lib/node-esm/settings-QMDXGZCI.mjs.map +7 -0
- package/dist/lib/node-esm/templates/index.mjs +2 -1
- package/dist/lib/node-esm/types/index.mjs +14 -6
- 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/FramePanel/FramePanel.d.ts +12 -0
- 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 +15 -0
- package/dist/types/src/components/NotebookStack/NotebookCell.d.ts.map +1 -0
- package/dist/types/src/components/NotebookStack/NotebookMenu.d.ts +9 -0
- package/dist/types/src/components/NotebookStack/NotebookMenu.d.ts.map +1 -0
- package/dist/types/src/components/NotebookStack/NotebookStack.d.ts +14 -0
- package/dist/types/src/components/NotebookStack/NotebookStack.d.ts.map +1 -0
- package/dist/types/src/components/NotebookStack/NotebookStack.stories.d.ts +252 -0
- package/dist/types/src/components/NotebookStack/NotebookStack.stories.d.ts.map +1 -0
- package/dist/types/src/components/NotebookStack/index.d.ts +3 -0
- package/dist/types/src/components/NotebookStack/index.d.ts.map +1 -0
- 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 +249 -10
- 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 +5 -2
- package/dist/types/src/components/TypescriptEditor/TypescriptEditor.d.ts.map +1 -1
- package/dist/types/src/components/TypescriptEditor/TypescriptEditor.stories.d.ts +11 -4
- package/dist/types/src/components/TypescriptEditor/TypescriptEditor.stories.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +5 -7
- 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/containers/DeploymentDialog/DeploymentDialog.d.ts +9 -0
- package/dist/types/src/containers/DeploymentDialog/DeploymentDialog.d.ts.map +1 -0
- package/dist/types/src/containers/DeploymentDialog/DeploymentDialog.stories.d.ts +252 -0
- 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 +20 -33
- 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 +3 -1
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +2 -3
- 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 +13 -0
- package/dist/types/src/notebook/eval.d.ts.map +1 -0
- package/dist/types/src/notebook/index.d.ts +2 -0
- package/dist/types/src/notebook/index.d.ts.map +1 -0
- package/dist/types/src/notebook/vfs-parser.d.ts +74 -0
- package/dist/types/src/notebook/vfs-parser.d.ts.map +1 -0
- package/dist/types/src/notebook/vfs-parser.test.d.ts +2 -0
- package/dist/types/src/notebook/vfs-parser.test.d.ts.map +1 -0
- 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/data-generator.d.ts.map +1 -1
- package/dist/types/src/templates/discord.d.ts.map +1 -1
- 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/gmail.d.ts.map +1 -1
- package/dist/types/src/templates/index.d.ts +52 -1
- package/dist/types/src/templates/index.d.ts.map +1 -1
- package/dist/types/src/templates/ping.d.ts +3 -0
- package/dist/types/src/templates/ping.d.ts.map +1 -0
- package/dist/types/src/testing/data.d.ts +3 -0
- package/dist/types/src/testing/data.d.ts.map +1 -0
- package/dist/types/src/testing/index.d.ts +2 -0
- package/dist/types/src/testing/index.d.ts.map +1 -0
- 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 +34 -5
- 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 +40 -0
- package/dist/types/src/types/actions.d.ts.map +1 -0
- 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 +5 -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 +7 -7
- package/dist/types/src/util/deploy.d.ts.map +1 -1
- package/dist/types/src/util/functions.d.ts +6 -3
- package/dist/types/src/util/functions.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +122 -86
- package/src/ScriptPlugin.tsx +55 -76
- 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} +103 -98
- 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 +129 -0
- package/src/capabilities/settings/index.ts +7 -0
- package/src/capabilities/settings/settings.ts +33 -0
- package/src/compiler/compiler.ts +11 -4
- package/src/components/{FrameContainer/FrameContainer.tsx → FramePanel/FramePanel.tsx} +10 -8
- package/src/components/{FrameContainer → FramePanel}/index.ts +1 -1
- package/src/components/NotebookStack/NotebookCell.tsx +215 -0
- package/src/components/NotebookStack/NotebookMenu.tsx +47 -0
- package/src/components/NotebookStack/NotebookStack.stories.tsx +54 -0
- package/src/components/NotebookStack/NotebookStack.tsx +86 -0
- package/src/components/NotebookStack/index.ts +6 -0
- 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 +56 -17
- package/src/components/ScriptToolbar/ScriptToolbar.tsx +38 -34
- package/src/components/TestPanel/TestPanel.tsx +67 -42
- package/src/components/TestPanel/index.ts +0 -1
- package/src/components/TypescriptEditor/TypescriptEditor.stories.tsx +89 -34
- package/src/components/TypescriptEditor/TypescriptEditor.tsx +84 -81
- package/src/components/index.ts +5 -7
- 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 +267 -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/containers/ScriptObjectSettings/ScriptObjectSettings.tsx +291 -0
- package/src/containers/ScriptObjectSettings/index.ts +7 -0
- package/src/containers/ScriptPluginSettings/ScriptPluginSettings.tsx +66 -0
- 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 +52 -45
- package/src/hooks/format.ts +10 -5
- package/src/hooks/index.ts +1 -0
- package/src/hooks/template.ts +22 -25
- package/src/hooks/useCompiler.ts +24 -0
- package/src/hooks/useCreateAndDeployScriptTemplates.ts +15 -16
- package/src/hooks/useToolbarState.ts +29 -4
- package/src/index.ts +3 -1
- package/src/meta.ts +10 -8
- package/src/notebook/compute-graph.test.ts +82 -0
- package/src/notebook/compute-graph.ts +230 -0
- package/src/notebook/eval.ts +105 -0
- package/src/notebook/index.ts +5 -0
- package/src/notebook/vfs-parser.test.ts +149 -0
- package/src/notebook/vfs-parser.ts +451 -0
- package/src/templates/anthropic.ts +42 -0
- package/src/templates/chat.ts +1 -1
- package/src/templates/chess-bot.ts +58 -0
- package/src/templates/commentary.ts +231 -0
- package/src/templates/data-generator.ts +10 -4
- package/src/templates/discord.ts +14 -6
- package/src/templates/forex-effect.ts +24 -25
- package/src/templates/forex.ts +9 -6
- package/src/templates/gmail.ts +37 -67
- package/src/templates/index.ts +36 -23
- package/src/templates/ping.ts +17 -0
- package/src/testing/data.ts +72 -0
- package/src/testing/index.ts +5 -0
- package/src/testing/simulator.test.ts +40 -0
- package/src/translations.ts +37 -7
- package/src/types/Notebook.ts +41 -0
- package/src/types/actions.ts +45 -0
- package/src/types/capabilities.ts +17 -0
- package/src/types/events.ts +11 -0
- package/src/types/index.ts +5 -1
- package/src/types/types.ts +15 -0
- package/src/util/deploy.ts +38 -61
- package/src/util/functions.ts +58 -25
- package/src/vite-env.d.ts +2 -0
- package/dist/lib/browser/DeploymentDialog-M4QIHTDR.mjs +0 -12
- package/dist/lib/browser/ScriptContainer-Z6SIGRRC.mjs +0 -262
- package/dist/lib/browser/ScriptContainer-Z6SIGRRC.mjs.map +0 -7
- package/dist/lib/browser/app-graph-builder-HLQ7K3BT.mjs +0 -64
- package/dist/lib/browser/app-graph-builder-HLQ7K3BT.mjs.map +0 -7
- package/dist/lib/browser/artifact-definition-CK3BIBSI.mjs +0 -247
- package/dist/lib/browser/artifact-definition-CK3BIBSI.mjs.map +0 -7
- package/dist/lib/browser/chunk-3U6DTUH3.mjs +0 -283
- package/dist/lib/browser/chunk-3U6DTUH3.mjs.map +0 -7
- package/dist/lib/browser/chunk-5TVBECWH.mjs +0 -15
- package/dist/lib/browser/chunk-5TVBECWH.mjs.map +0 -7
- package/dist/lib/browser/chunk-FIM2MVNJ.mjs +0 -555
- package/dist/lib/browser/chunk-FIM2MVNJ.mjs.map +0 -7
- package/dist/lib/browser/chunk-FMDXKOP7.mjs +0 -233
- package/dist/lib/browser/chunk-FMDXKOP7.mjs.map +0 -7
- package/dist/lib/browser/chunk-IS4OG2UW.mjs +0 -39
- package/dist/lib/browser/chunk-IS4OG2UW.mjs.map +0 -7
- package/dist/lib/browser/chunk-P4HQKUCP.mjs +0 -153
- package/dist/lib/browser/chunk-P4HQKUCP.mjs.map +0 -7
- package/dist/lib/browser/chunk-QYAREHGH.mjs.map +0 -7
- package/dist/lib/browser/chunk-R4R7VOFY.mjs +0 -88
- package/dist/lib/browser/chunk-R4R7VOFY.mjs.map +0 -7
- package/dist/lib/browser/compiler-CXCUA4UQ.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-S3H2SMUY.mjs +0 -89
- package/dist/lib/browser/intent-resolver-S3H2SMUY.mjs.map +0 -7
- package/dist/lib/browser/react-surface-FYYXZA7C.mjs +0 -104
- package/dist/lib/browser/react-surface-FYYXZA7C.mjs.map +0 -7
- package/dist/lib/browser/settings-KCTBK5TY.mjs +0 -24
- package/dist/lib/browser/settings-KCTBK5TY.mjs.map +0 -7
- package/dist/lib/node-esm/DeploymentDialog-3KPRWFE7.mjs +0 -13
- package/dist/lib/node-esm/ScriptContainer-KPU75HHI.mjs +0 -263
- package/dist/lib/node-esm/ScriptContainer-KPU75HHI.mjs.map +0 -7
- package/dist/lib/node-esm/app-graph-builder-7EYIHWH4.mjs +0 -65
- package/dist/lib/node-esm/app-graph-builder-7EYIHWH4.mjs.map +0 -7
- package/dist/lib/node-esm/artifact-definition-YCBV4YX2.mjs +0 -248
- package/dist/lib/node-esm/artifact-definition-YCBV4YX2.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-35M3CHYE.mjs +0 -16
- package/dist/lib/node-esm/chunk-35M3CHYE.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-7NMI4CEU.mjs +0 -556
- package/dist/lib/node-esm/chunk-7NMI4CEU.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-AHXJ6NQU.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-F5GFJ3PY.mjs +0 -90
- package/dist/lib/node-esm/chunk-F5GFJ3PY.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-JIPFLBYA.mjs +0 -40
- package/dist/lib/node-esm/chunk-JIPFLBYA.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-QKK3NDHW.mjs +0 -154
- package/dist/lib/node-esm/chunk-QKK3NDHW.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-RT43MACC.mjs +0 -284
- package/dist/lib/node-esm/chunk-RT43MACC.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-XJPK3IYI.mjs +0 -234
- package/dist/lib/node-esm/chunk-XJPK3IYI.mjs.map +0 -7
- package/dist/lib/node-esm/compiler-EPFKQXPE.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-OHKNJFCC.mjs +0 -90
- package/dist/lib/node-esm/intent-resolver-OHKNJFCC.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-V32NWHKN.mjs +0 -105
- package/dist/lib/node-esm/react-surface-V32NWHKN.mjs.map +0 -7
- package/dist/lib/node-esm/settings-DXZ334A3.mjs +0 -25
- package/dist/lib/node-esm/settings-DXZ334A3.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/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 +0 -11
- package/dist/types/src/components/DeploymentDialog/DeploymentDialog.d.ts.map +0 -1
- package/dist/types/src/components/DeploymentDialog/DeploymentDialog.stories.d.ts +0 -18
- 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 +0 -12
- 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/ScriptContainer.d.ts +0 -12
- package/dist/types/src/components/ScriptContainer.d.ts.map +0 -1
- package/dist/types/src/components/Settings/ScriptObjectSettings.d.ts +0 -8
- package/dist/types/src/components/Settings/ScriptObjectSettings.d.ts.map +0 -1
- package/dist/types/src/components/Settings/ScriptPluginSettings.d.ts +0 -6
- package/dist/types/src/components/Settings/ScriptPluginSettings.d.ts.map +0 -1
- package/dist/types/src/components/Settings/index.d.ts +0 -3
- package/dist/types/src/components/Settings/index.d.ts.map +0 -1
- package/dist/types/src/components/TestPanel/TestContainer.d.ts +0 -8
- package/dist/types/src/components/TestPanel/TestContainer.d.ts.map +0 -1
- package/dist/types/src/events.d.ts +0 -4
- package/dist/types/src/events.d.ts.map +0 -1
- package/dist/types/src/templates/chess.d.ts +0 -3
- package/dist/types/src/templates/chess.d.ts.map +0 -1
- package/dist/types/src/templates/echo.d.ts +0 -6
- package/dist/types/src/templates/echo.d.ts.map +0 -1
- package/dist/types/src/types/schema.d.ts +0 -38
- package/dist/types/src/types/schema.d.ts.map +0 -1
- package/src/capabilities/app-graph-builder.ts +0 -64
- package/src/capabilities/capabilities.ts +0 -12
- package/src/capabilities/compiler.ts +0 -33
- package/src/capabilities/intent-resolver.ts +0 -77
- package/src/capabilities/react-surface.tsx +0 -89
- package/src/capabilities/settings.ts +0 -21
- package/src/components/DeploymentDialog/DeploymentDialog.stories.tsx +0 -39
- package/src/components/DeploymentDialog/DeploymentDialog.tsx +0 -112
- 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 -68
- package/src/components/Settings/ScriptObjectSettings.tsx +0 -206
- package/src/components/Settings/ScriptPluginSettings.tsx +0 -71
- package/src/components/Settings/index.ts +0 -6
- package/src/components/TestPanel/TestContainer.tsx +0 -26
- package/src/events.ts +0 -11
- package/src/templates/chess.ts +0 -47
- package/src/templates/echo.ts +0 -8
- package/src/types/schema.ts +0 -37
- /package/dist/lib/browser/{DeploymentDialog-M4QIHTDR.mjs.map → blueprints/index.mjs.map} +0 -0
- /package/dist/lib/{node-esm/DeploymentDialog-3KPRWFE7.mjs.map → browser/chunk-J5LGTIGS.mjs.map} +0 -0
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2024 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import React, { useState } from 'react';
|
|
6
|
+
import { ScriptTarget } from 'typescript';
|
|
7
|
+
|
|
8
|
+
import queryApi from '@dxos/echo-query/api.d.ts?raw';
|
|
9
|
+
import { useAsyncEffect } from '@dxos/react-ui';
|
|
10
|
+
|
|
11
|
+
import { Compiler } from '../../compiler';
|
|
12
|
+
import { TypescriptEditor, type TypescriptEditorProps } from '../TypescriptEditor';
|
|
13
|
+
|
|
14
|
+
const GLOBALS = `
|
|
15
|
+
namespace QueryAPI {
|
|
16
|
+
${queryApi}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
declare global {
|
|
20
|
+
const Query: typeof QueryAPI.Query;
|
|
21
|
+
const Filter: typeof QueryAPI.Filter;
|
|
22
|
+
const Order: typeof QueryAPI.Order;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export {};
|
|
26
|
+
`;
|
|
27
|
+
|
|
28
|
+
export type QueryEditorProps = Omit<TypescriptEditorProps, 'env'>;
|
|
29
|
+
|
|
30
|
+
export const QueryEditor = (props: QueryEditorProps) => {
|
|
31
|
+
const [compiler, setCompiler] = useState<Compiler>();
|
|
32
|
+
|
|
33
|
+
useAsyncEffect(async () => {
|
|
34
|
+
const compiler = new Compiler({
|
|
35
|
+
lib: ['ES5'],
|
|
36
|
+
target: ScriptTarget.ES2022,
|
|
37
|
+
});
|
|
38
|
+
await compiler.initialize(GLOBALS);
|
|
39
|
+
setCompiler(compiler);
|
|
40
|
+
}, []);
|
|
41
|
+
|
|
42
|
+
if (!compiler) {
|
|
43
|
+
return null;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
return <TypescriptEditor {...props} env={compiler.environment} />;
|
|
47
|
+
};
|
|
@@ -2,29 +2,68 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import '@
|
|
5
|
+
import { Atom, Registry } from '@effect-atom/atom-react';
|
|
6
|
+
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
7
|
+
import React, { useMemo } from 'react';
|
|
6
8
|
|
|
7
|
-
import {
|
|
9
|
+
import { OperationPlugin, RuntimePlugin } from '@dxos/app-framework';
|
|
10
|
+
import { withPluginManager } from '@dxos/app-framework/testing';
|
|
11
|
+
import { Script } from '@dxos/functions';
|
|
12
|
+
import { ClientPlugin } from '@dxos/plugin-client';
|
|
13
|
+
import { withLayout, withTheme } from '@dxos/react-ui/testing';
|
|
8
14
|
|
|
9
|
-
import {
|
|
15
|
+
import { type ScriptToolbarState, type ScriptToolbarStateStore } from '../../hooks';
|
|
16
|
+
import { translations } from '../../translations';
|
|
10
17
|
|
|
11
18
|
import { ScriptToolbar } from './ScriptToolbar';
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
|
|
20
|
+
// Create a mock store for stories.
|
|
21
|
+
const createMockStore = (initialState: ScriptToolbarState = {}): ScriptToolbarStateStore => {
|
|
22
|
+
const registry = Registry.make();
|
|
23
|
+
const atom = Atom.make<ScriptToolbarState>(initialState);
|
|
24
|
+
return {
|
|
25
|
+
atom,
|
|
26
|
+
get value() {
|
|
27
|
+
return registry.get(atom);
|
|
28
|
+
},
|
|
29
|
+
update: (updater) => registry.set(atom, updater(registry.get(atom))),
|
|
30
|
+
set: (key, value) => registry.set(atom, { ...registry.get(atom), [key]: value }),
|
|
31
|
+
};
|
|
22
32
|
};
|
|
23
33
|
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
34
|
+
const ScriptToolbarStory = () => {
|
|
35
|
+
const state = useMemo(() => createMockStore(), []);
|
|
36
|
+
const script = useMemo(
|
|
37
|
+
() =>
|
|
38
|
+
Script.make({
|
|
39
|
+
name: 'test',
|
|
40
|
+
description: 'test',
|
|
41
|
+
source: 'test',
|
|
42
|
+
}),
|
|
43
|
+
[],
|
|
44
|
+
);
|
|
45
|
+
return <ScriptToolbar state={state} script={script} />;
|
|
28
46
|
};
|
|
29
47
|
|
|
48
|
+
const meta = {
|
|
49
|
+
title: 'plugins/plugin-script/components/Toolbar',
|
|
50
|
+
component: ScriptToolbarStory,
|
|
51
|
+
// TODO(wittjosiah): Try to write story which does not depend on plugin manager.
|
|
52
|
+
decorators: [
|
|
53
|
+
withTheme(),
|
|
54
|
+
withLayout({ classNames: 'w-prose-max-width' }),
|
|
55
|
+
withPluginManager({
|
|
56
|
+
plugins: [OperationPlugin(), RuntimePlugin(), ClientPlugin({})],
|
|
57
|
+
}),
|
|
58
|
+
],
|
|
59
|
+
parameters: {
|
|
60
|
+
layout: 'centered',
|
|
61
|
+
translations,
|
|
62
|
+
},
|
|
63
|
+
} satisfies Meta<typeof ScriptToolbarStory>;
|
|
64
|
+
|
|
30
65
|
export default meta;
|
|
66
|
+
|
|
67
|
+
type Story = StoryObj<typeof meta>;
|
|
68
|
+
|
|
69
|
+
export const Default: Story = {};
|
|
@@ -2,57 +2,61 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { Atom } from '@effect-atom/atom-react';
|
|
6
6
|
import React, { useMemo } from 'react';
|
|
7
7
|
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import { ElevationProvider, useTranslation
|
|
11
|
-
import {
|
|
8
|
+
import { Obj } from '@dxos/echo';
|
|
9
|
+
import { type Script } from '@dxos/functions';
|
|
10
|
+
import { ElevationProvider, useTranslation } from '@dxos/react-ui';
|
|
11
|
+
import {
|
|
12
|
+
type ActionGraphProps,
|
|
13
|
+
Menu,
|
|
14
|
+
type MenuRootProps,
|
|
15
|
+
createGapSeparator,
|
|
16
|
+
useMenuActions,
|
|
17
|
+
} from '@dxos/react-ui-menu';
|
|
12
18
|
|
|
13
19
|
import {
|
|
14
20
|
type CreateDeployOptions,
|
|
15
|
-
type
|
|
21
|
+
type ScriptToolbarStateStore,
|
|
16
22
|
createDeploy,
|
|
17
23
|
createFormat,
|
|
18
24
|
createTemplateSelect,
|
|
19
25
|
useDeployDeps,
|
|
20
26
|
} from '../../hooks';
|
|
21
|
-
import {
|
|
22
|
-
|
|
23
|
-
const createToolbar = ({ state, script, ...options }: CreateDeployOptions) =>
|
|
24
|
-
Rx.make((get) =>
|
|
25
|
-
get(
|
|
26
|
-
rxFromSignal(() => {
|
|
27
|
-
const templateSelect = createTemplateSelect(script);
|
|
28
|
-
const format = createFormat(script);
|
|
29
|
-
const gap = createGapSeparator();
|
|
30
|
-
const deploy = createDeploy({ state, script, ...options });
|
|
31
|
-
return {
|
|
32
|
-
nodes: [...templateSelect.nodes, ...format.nodes, ...gap.nodes, ...deploy.nodes],
|
|
33
|
-
edges: [...templateSelect.edges, ...format.edges, ...gap.edges, ...deploy.edges],
|
|
34
|
-
};
|
|
35
|
-
}),
|
|
36
|
-
),
|
|
37
|
-
);
|
|
27
|
+
import { meta } from '../../meta';
|
|
38
28
|
|
|
39
|
-
export type ScriptToolbarProps =
|
|
29
|
+
export type ScriptToolbarProps = Partial<MenuRootProps> & {
|
|
40
30
|
role?: string;
|
|
41
|
-
script:
|
|
42
|
-
state:
|
|
43
|
-
}
|
|
31
|
+
script: Script.Script;
|
|
32
|
+
state: ScriptToolbarStateStore;
|
|
33
|
+
};
|
|
44
34
|
|
|
45
|
-
export const ScriptToolbar = ({ script, role, state,
|
|
46
|
-
const { t } = useTranslation(
|
|
35
|
+
export const ScriptToolbar = ({ script, role, state, ...props }: ScriptToolbarProps) => {
|
|
36
|
+
const { t } = useTranslation(meta.id);
|
|
47
37
|
const options = useDeployDeps({ script });
|
|
48
|
-
const
|
|
49
|
-
const
|
|
38
|
+
const menu = useMemo(() => createToolbarActions({ state, script, t, ...options }), [state, script, options, t]);
|
|
39
|
+
const actions = useMenuActions(menu);
|
|
50
40
|
|
|
51
41
|
return (
|
|
52
42
|
<ElevationProvider elevation={role === 'section' ? 'positioned' : 'base'}>
|
|
53
|
-
<
|
|
54
|
-
<
|
|
55
|
-
</
|
|
43
|
+
<Menu.Root {...props} {...actions} attendableId={Obj.getDXN(script).toString()}>
|
|
44
|
+
<Menu.Toolbar />
|
|
45
|
+
</Menu.Root>
|
|
56
46
|
</ElevationProvider>
|
|
57
47
|
);
|
|
58
48
|
};
|
|
49
|
+
|
|
50
|
+
const createToolbarActions = ({ state, script, ...options }: CreateDeployOptions): Atom.Atom<ActionGraphProps> =>
|
|
51
|
+
Atom.make((get) => {
|
|
52
|
+
// Subscribe to state changes.
|
|
53
|
+
get(state.atom);
|
|
54
|
+
const templateSelect = createTemplateSelect(script);
|
|
55
|
+
const format = createFormat(script);
|
|
56
|
+
const gap = createGapSeparator();
|
|
57
|
+
const deploy = createDeploy({ state, script, ...options });
|
|
58
|
+
return {
|
|
59
|
+
nodes: [...templateSelect.nodes, ...format.nodes, ...gap.nodes, ...deploy.nodes],
|
|
60
|
+
edges: [...templateSelect.edges, ...format.edges, ...gap.edges, ...deploy.edges],
|
|
61
|
+
};
|
|
62
|
+
});
|
|
@@ -5,18 +5,23 @@
|
|
|
5
5
|
import React, { forwardRef, useEffect, useRef, useState } from 'react';
|
|
6
6
|
|
|
7
7
|
import { log } from '@dxos/log';
|
|
8
|
-
import { Avatar, Icon, Input, type ThemedClassName, Toolbar, useTranslation } from '@dxos/react-ui';
|
|
8
|
+
import { Avatar, Icon, Input, ScrollArea, type ThemedClassName, Toolbar, useTranslation } from '@dxos/react-ui';
|
|
9
9
|
import { SyntaxHighlighter } from '@dxos/react-ui-syntax-highlighter';
|
|
10
|
-
import {
|
|
10
|
+
import { mx } from '@dxos/ui-theme';
|
|
11
11
|
|
|
12
|
-
import {
|
|
12
|
+
import { meta } from '../../meta';
|
|
13
13
|
|
|
14
14
|
type State = 'pending' | 'responding';
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
17
|
* Request or response.
|
|
18
18
|
*/
|
|
19
|
-
type Message = {
|
|
19
|
+
type Message = {
|
|
20
|
+
type: 'request' | 'response';
|
|
21
|
+
text?: string;
|
|
22
|
+
data?: any;
|
|
23
|
+
error?: Error;
|
|
24
|
+
};
|
|
20
25
|
|
|
21
26
|
export type TestPanelProps = ThemedClassName<{
|
|
22
27
|
functionUrl?: string;
|
|
@@ -24,7 +29,7 @@ export type TestPanelProps = ThemedClassName<{
|
|
|
24
29
|
|
|
25
30
|
// TODO(burdon): Need persistent history (currently lost when switching tabs)..
|
|
26
31
|
export const TestPanel = ({ classNames, functionUrl }: TestPanelProps) => {
|
|
27
|
-
const { t } = useTranslation(
|
|
32
|
+
const { t } = useTranslation(meta.id);
|
|
28
33
|
|
|
29
34
|
const inputRef = useRef<HTMLInputElement>(null);
|
|
30
35
|
const [input, setInput] = useState('');
|
|
@@ -41,7 +46,7 @@ export const TestPanel = ({ classNames, functionUrl }: TestPanelProps) => {
|
|
|
41
46
|
}
|
|
42
47
|
};
|
|
43
48
|
|
|
44
|
-
const controller = useRef<AbortController>();
|
|
49
|
+
const controller = useRef<AbortController>(null);
|
|
45
50
|
useEffect(() => {
|
|
46
51
|
return () => {
|
|
47
52
|
handleStop();
|
|
@@ -50,7 +55,7 @@ export const TestPanel = ({ classNames, functionUrl }: TestPanelProps) => {
|
|
|
50
55
|
|
|
51
56
|
const handleStop = () => {
|
|
52
57
|
controller.current?.abort('stop');
|
|
53
|
-
controller.current =
|
|
58
|
+
controller.current = null;
|
|
54
59
|
};
|
|
55
60
|
|
|
56
61
|
const handleClear = () => {
|
|
@@ -61,8 +66,16 @@ export const TestPanel = ({ classNames, functionUrl }: TestPanelProps) => {
|
|
|
61
66
|
inputRef.current?.focus();
|
|
62
67
|
};
|
|
63
68
|
|
|
64
|
-
const handleResponse = ({
|
|
65
|
-
|
|
69
|
+
const handleResponse = ({
|
|
70
|
+
text,
|
|
71
|
+
data,
|
|
72
|
+
error,
|
|
73
|
+
}: {
|
|
74
|
+
text?: string;
|
|
75
|
+
data?: any;
|
|
76
|
+
error?: Error;
|
|
77
|
+
} = {}) => {
|
|
78
|
+
controller.current = null;
|
|
66
79
|
setHistory((history) => [...history, { type: 'response', text, data, error } satisfies Message]);
|
|
67
80
|
setResult('');
|
|
68
81
|
setState(null);
|
|
@@ -108,7 +121,9 @@ export const TestPanel = ({ classNames, functionUrl }: TestPanelProps) => {
|
|
|
108
121
|
// Check for error.
|
|
109
122
|
if (!response.ok) {
|
|
110
123
|
const text = await response.text();
|
|
111
|
-
handleResponse({
|
|
124
|
+
handleResponse({
|
|
125
|
+
error: new Error(text || response.statusText || String(response.status)),
|
|
126
|
+
});
|
|
112
127
|
return;
|
|
113
128
|
}
|
|
114
129
|
|
|
@@ -163,7 +178,7 @@ export const TestPanel = ({ classNames, functionUrl }: TestPanelProps) => {
|
|
|
163
178
|
{/* TODO(burdon): Replace with Thread. */}
|
|
164
179
|
<MessageThread ref={scrollerRef} state={state} result={result} history={history} />
|
|
165
180
|
{/* TODO(burdon): Replace with Form based on the function's input schema. */}
|
|
166
|
-
<Toolbar.Root
|
|
181
|
+
<Toolbar.Root>
|
|
167
182
|
<Input.Root>
|
|
168
183
|
<Input.TextInput
|
|
169
184
|
ref={inputRef}
|
|
@@ -174,12 +189,20 @@ export const TestPanel = ({ classNames, functionUrl }: TestPanelProps) => {
|
|
|
174
189
|
onKeyDown={(ev) => ev.key === 'Enter' && handleRequest(input)}
|
|
175
190
|
/>
|
|
176
191
|
</Input.Root>
|
|
177
|
-
<Toolbar.
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
192
|
+
<Toolbar.IconButton
|
|
193
|
+
icon='ph--play--regular'
|
|
194
|
+
size={4}
|
|
195
|
+
label='Execute'
|
|
196
|
+
iconOnly
|
|
197
|
+
onClick={() => handleRequest(input)}
|
|
198
|
+
/>
|
|
199
|
+
<Toolbar.IconButton
|
|
200
|
+
icon={state ? 'ph--stop--regular' : 'ph--trash--regular'}
|
|
201
|
+
size={4}
|
|
202
|
+
label={state ? 'Stop' : 'Clear'}
|
|
203
|
+
iconOnly
|
|
204
|
+
onClick={() => (state ? handleStop() : handleClear())}
|
|
205
|
+
/>
|
|
183
206
|
</Toolbar.Root>
|
|
184
207
|
</div>
|
|
185
208
|
);
|
|
@@ -196,48 +219,50 @@ type MessageThreadProps = {
|
|
|
196
219
|
const MessageThread = forwardRef<HTMLDivElement, MessageThreadProps>(
|
|
197
220
|
({ state, history, result }: MessageThreadProps, forwardedRef) => {
|
|
198
221
|
return (
|
|
199
|
-
<
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
<div className='
|
|
203
|
-
|
|
204
|
-
<
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
))}
|
|
208
|
-
|
|
209
|
-
{result?.length > 0 && (
|
|
210
|
-
<div className='grid grid-cols-[2rem_1fr_2rem]'>
|
|
211
|
-
<div className='p-1'>
|
|
212
|
-
{(state === 'pending' && <Icon icon='ph--spinner--regular' size={6} classNames='animate-spin' />) || (
|
|
213
|
-
<Icon icon='ph--robot--regular' size={6} classNames='animate-[pulse_1s_ease-in-out_infinite]' />
|
|
214
|
-
)}
|
|
222
|
+
<ScrollArea.Root orientation='vertical' classNames='h-full' ref={forwardedRef}>
|
|
223
|
+
<ScrollArea.Viewport classNames='gap-6 p-2'>
|
|
224
|
+
{history.map((message, i) => (
|
|
225
|
+
<div key={i} className='grid grid-cols-[2rem_1fr_2rem]'>
|
|
226
|
+
<div className='p-1'>{message.type === 'response' && <RobotAvatar />}</div>
|
|
227
|
+
<div className='overflow-auto'>
|
|
228
|
+
<MessageItem message={message} />
|
|
229
|
+
</div>
|
|
215
230
|
</div>
|
|
216
|
-
|
|
217
|
-
|
|
231
|
+
))}
|
|
232
|
+
|
|
233
|
+
{result?.length > 0 && (
|
|
234
|
+
<div className='grid grid-cols-[2rem_1fr_2rem]'>
|
|
235
|
+
<div className='p-1'>
|
|
236
|
+
{(state === 'pending' && <Icon icon='ph--spinner--regular' size={6} classNames='animate-spin' />) || (
|
|
237
|
+
<Icon icon='ph--robot--regular' size={6} classNames='animate-[pulse_1s_ease-in-out_infinite]' />
|
|
238
|
+
)}
|
|
239
|
+
</div>
|
|
240
|
+
<div className='overflow-auto'>
|
|
241
|
+
<MessageItem message={{ type: 'response', text: result }} />
|
|
242
|
+
</div>
|
|
218
243
|
</div>
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
</
|
|
244
|
+
)}
|
|
245
|
+
</ScrollArea.Viewport>
|
|
246
|
+
</ScrollArea.Root>
|
|
222
247
|
);
|
|
223
248
|
},
|
|
224
249
|
);
|
|
225
250
|
|
|
226
251
|
const MessageItem = ({ classNames, message }: ThemedClassName<{ message: Message }>) => {
|
|
227
252
|
const { type, text, data, error } = message;
|
|
228
|
-
const wrapper = 'p-1 px-2 rounded-md bg-
|
|
253
|
+
const wrapper = 'p-1 px-2 rounded-md bg-hover-surface overflow-auto';
|
|
229
254
|
return (
|
|
230
255
|
<div className={mx('flex', type === 'request' ? 'ml-[1rem] justify-end' : 'mr-[1rem]', classNames)}>
|
|
231
|
-
{error && <div className={mx(wrapper, 'whitespace-pre'
|
|
256
|
+
{error && <div className={mx(wrapper, 'whitespace-pre text-error-text')}>{String(error)}</div>}
|
|
232
257
|
|
|
233
258
|
{text !== undefined && (
|
|
234
|
-
<div className={mx(wrapper, type === 'request' && 'bg-primary-
|
|
259
|
+
<div className={mx(wrapper, type === 'request' && 'bg-primary-500 dark:bg-primary-600')}>
|
|
235
260
|
{text || '\u00D8'}
|
|
236
261
|
</div>
|
|
237
262
|
)}
|
|
238
263
|
|
|
239
264
|
{data && (
|
|
240
|
-
<SyntaxHighlighter language='json' className={mx(wrapper, '
|
|
265
|
+
<SyntaxHighlighter language='json' className={mx(wrapper, 'text-xs')}>
|
|
241
266
|
{JSON.stringify(data, null, 2)}
|
|
242
267
|
</SyntaxHighlighter>
|
|
243
268
|
)}
|
|
@@ -2,43 +2,98 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import '@
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
import
|
|
9
|
-
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
|
|
14
|
-
import {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
const
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
5
|
+
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
6
|
+
import React, { useCallback, useMemo, useState } from 'react';
|
|
7
|
+
|
|
8
|
+
import { createDocAccessor } from '@dxos/echo-db';
|
|
9
|
+
import { createObject } from '@dxos/react-client/echo';
|
|
10
|
+
import { Panel, Toolbar } from '@dxos/react-ui';
|
|
11
|
+
import { withLayout, withTheme } from '@dxos/react-ui/testing';
|
|
12
|
+
import { Json } from '@dxos/react-ui-syntax-highlighter';
|
|
13
|
+
import { createDataExtensions } from '@dxos/ui-editor';
|
|
14
|
+
import { trim } from '@dxos/util';
|
|
15
|
+
|
|
16
|
+
import { TypescriptEditor, type TypescriptEditorProps } from './TypescriptEditor';
|
|
17
|
+
|
|
18
|
+
const SCRIPT = trim`
|
|
19
|
+
x * 2
|
|
20
|
+
`;
|
|
21
|
+
|
|
22
|
+
const DefaultStory = (props: TypescriptEditorProps) => {
|
|
23
|
+
const object = useMemo(() => createObject({ content: SCRIPT }), []);
|
|
24
|
+
const [result, setResult] = useState<object | undefined>({});
|
|
25
|
+
|
|
26
|
+
// TODO(burdon): Make this work.
|
|
27
|
+
// const object = useMemo(() => Text.make(templates[1].source), []);
|
|
28
|
+
// const script = useMemo(
|
|
29
|
+
// () =>
|
|
30
|
+
// Obj.make(ScriptType, {
|
|
31
|
+
// source: Ref.make(createObject({ content: templates[0].source })),
|
|
32
|
+
// }),
|
|
33
|
+
// [object],
|
|
34
|
+
// );
|
|
35
|
+
|
|
36
|
+
const extensions = useMemo(
|
|
37
|
+
() => [
|
|
38
|
+
createDataExtensions({
|
|
39
|
+
id: object.id,
|
|
40
|
+
text: createDocAccessor(object, ['content']),
|
|
41
|
+
}),
|
|
42
|
+
],
|
|
43
|
+
[],
|
|
44
|
+
);
|
|
45
|
+
|
|
46
|
+
const handleRun = useCallback(async () => {
|
|
47
|
+
try {
|
|
48
|
+
const definitions: [string, any][] = [['x', 100]];
|
|
34
49
|
|
|
35
|
-
|
|
50
|
+
// eslint-disable-next-line @typescript-eslint/no-implied-eval
|
|
51
|
+
const result = new Function(...definitions.map(([name]) => name), `return ${object.content.trim()}`)(
|
|
52
|
+
...definitions.map(([, value]) => value),
|
|
53
|
+
);
|
|
36
54
|
|
|
37
|
-
|
|
38
|
-
|
|
55
|
+
setResult({
|
|
56
|
+
timestamp: Date.now(),
|
|
57
|
+
result,
|
|
58
|
+
});
|
|
59
|
+
} catch (err) {
|
|
60
|
+
setResult({
|
|
61
|
+
timestamp: Date.now(),
|
|
62
|
+
error: String(err),
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
}, [object]);
|
|
66
|
+
|
|
67
|
+
return (
|
|
68
|
+
<Panel.Root>
|
|
69
|
+
<Panel.Toolbar asChild>
|
|
70
|
+
<Toolbar.Root>
|
|
71
|
+
<Toolbar.Button onClick={handleRun}>Run</Toolbar.Button>
|
|
72
|
+
</Toolbar.Root>
|
|
73
|
+
</Panel.Toolbar>
|
|
74
|
+
<Panel.Content>
|
|
75
|
+
<div role='none' className='grid grid-rows-[1fr_min-content] h-full overflow-hidden text-sm'>
|
|
76
|
+
<TypescriptEditor {...props} initialValue={object.content} extensions={extensions} />
|
|
77
|
+
<Json data={result} classNames='shrink-0 p-2 border-y border-subdued-separator' />
|
|
78
|
+
</div>
|
|
79
|
+
</Panel.Content>
|
|
80
|
+
</Panel.Root>
|
|
81
|
+
);
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
const meta = {
|
|
85
|
+
title: 'plugins/plugin-script/components/TypescriptEditor',
|
|
39
86
|
component: TypescriptEditor,
|
|
40
87
|
render: DefaultStory,
|
|
41
|
-
decorators: [withTheme],
|
|
42
|
-
}
|
|
88
|
+
decorators: [withTheme(), withLayout({ layout: 'column', classNames: 'w-prose-max-width' })],
|
|
89
|
+
} satisfies Meta<typeof DefaultStory>;
|
|
43
90
|
|
|
44
91
|
export default meta;
|
|
92
|
+
|
|
93
|
+
type Story = StoryObj<typeof meta>;
|
|
94
|
+
|
|
95
|
+
export const Default: Story = {
|
|
96
|
+
args: {
|
|
97
|
+
id: 'test',
|
|
98
|
+
},
|
|
99
|
+
};
|