@dxos/plugin-script 0.8.4-main.1da679c → 0.8.4-main.21d9917
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/dist/lib/browser/DeploymentDialog-GXNRUXF6.mjs +14 -0
- package/dist/lib/browser/NotebookContainer-4MM2VAQF.mjs +845 -0
- package/dist/lib/browser/NotebookContainer-4MM2VAQF.mjs.map +7 -0
- package/dist/lib/browser/ScriptContainer-X6GCYZZW.mjs +149 -0
- package/dist/lib/browser/ScriptContainer-X6GCYZZW.mjs.map +7 -0
- package/dist/lib/browser/app-graph-builder-7VO7AUI6.mjs +68 -0
- package/dist/lib/browser/app-graph-builder-7VO7AUI6.mjs.map +7 -0
- package/dist/lib/browser/blueprint-definition-OSOUYI7A.mjs +17 -0
- package/dist/lib/browser/blueprint-definition-OSOUYI7A.mjs.map +7 -0
- package/dist/lib/browser/blueprints/index.mjs +8 -0
- package/dist/lib/browser/chunk-3O2DQGCP.mjs +113 -0
- package/dist/lib/browser/chunk-3O2DQGCP.mjs.map +7 -0
- package/dist/lib/browser/chunk-BTWHM6FH.mjs +270 -0
- package/dist/lib/browser/chunk-BTWHM6FH.mjs.map +7 -0
- package/dist/lib/browser/chunk-F3QKSKSF.mjs +35 -0
- package/dist/lib/browser/chunk-F3QKSKSF.mjs.map +7 -0
- package/dist/lib/browser/chunk-I7CSE6T3.mjs +110 -0
- package/dist/lib/browser/chunk-I7CSE6T3.mjs.map +7 -0
- package/dist/lib/browser/chunk-IQRLM6JK.mjs +137 -0
- package/dist/lib/browser/chunk-IQRLM6JK.mjs.map +7 -0
- package/dist/lib/browser/chunk-J5LGTIGS.mjs +10 -0
- package/dist/lib/browser/chunk-J5LGTIGS.mjs.map +7 -0
- package/dist/lib/browser/chunk-NWSK27QB.mjs +606 -0
- package/dist/lib/browser/chunk-NWSK27QB.mjs.map +7 -0
- package/dist/lib/browser/chunk-UX4GHJ5E.mjs +105 -0
- package/dist/lib/browser/chunk-UX4GHJ5E.mjs.map +7 -0
- package/dist/lib/browser/chunk-WX2NVNFQ.mjs +557 -0
- package/dist/lib/browser/chunk-WX2NVNFQ.mjs.map +7 -0
- package/dist/lib/browser/{chunk-QYAREHGH.mjs → chunk-WYR4QHPE.mjs} +8 -5
- package/dist/lib/browser/chunk-WYR4QHPE.mjs.map +7 -0
- package/dist/lib/browser/compiler-XRBFQFXO.mjs +161 -0
- package/dist/lib/browser/compiler-XRBFQFXO.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +137 -103
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/operation-resolver-MUNR376F.mjs +82 -0
- package/dist/lib/browser/operation-resolver-MUNR376F.mjs.map +7 -0
- package/dist/lib/browser/react-surface-5TEC66UY.mjs +139 -0
- package/dist/lib/browser/react-surface-5TEC66UY.mjs.map +7 -0
- package/dist/lib/browser/settings-R4WKREUJ.mjs +35 -0
- package/dist/lib/browser/settings-R4WKREUJ.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-EVFV2VJT.mjs +15 -0
- package/dist/lib/node-esm/DeploymentDialog-EVFV2VJT.mjs.map +7 -0
- package/dist/lib/node-esm/NotebookContainer-QLW5ZYGS.mjs +846 -0
- package/dist/lib/node-esm/NotebookContainer-QLW5ZYGS.mjs.map +7 -0
- package/dist/lib/node-esm/ScriptContainer-3DZ3BMHW.mjs +150 -0
- package/dist/lib/node-esm/ScriptContainer-3DZ3BMHW.mjs.map +7 -0
- package/dist/lib/node-esm/app-graph-builder-NVE3EVBG.mjs +69 -0
- package/dist/lib/node-esm/app-graph-builder-NVE3EVBG.mjs.map +7 -0
- package/dist/lib/node-esm/blueprint-definition-NC7NNJGI.mjs +18 -0
- package/dist/lib/node-esm/blueprint-definition-NC7NNJGI.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-4F5FJZ36.mjs +107 -0
- package/dist/lib/node-esm/chunk-4F5FJZ36.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-AHXJ6NQU.mjs → chunk-5HSJPAK7.mjs} +8 -5
- package/dist/lib/node-esm/chunk-5HSJPAK7.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-KN6SQYUF.mjs +114 -0
- package/dist/lib/node-esm/chunk-KN6SQYUF.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-MGWKULCD.mjs +558 -0
- package/dist/lib/node-esm/chunk-MGWKULCD.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-SLU3KRV3.mjs +112 -0
- package/dist/lib/node-esm/chunk-SLU3KRV3.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-VWOLKNMO.mjs +271 -0
- package/dist/lib/node-esm/chunk-VWOLKNMO.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-Y3G5NCTP.mjs +36 -0
- package/dist/lib/node-esm/chunk-Y3G5NCTP.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-YEWLTVBT.mjs +138 -0
- package/dist/lib/node-esm/chunk-YEWLTVBT.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-ZQGHFNO3.mjs +607 -0
- package/dist/lib/node-esm/chunk-ZQGHFNO3.mjs.map +7 -0
- package/dist/lib/node-esm/compiler-ORJAXDN7.mjs +162 -0
- package/dist/lib/node-esm/compiler-ORJAXDN7.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +137 -103
- 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-CLE4ZCC5.mjs +83 -0
- package/dist/lib/node-esm/operation-resolver-CLE4ZCC5.mjs.map +7 -0
- package/dist/lib/node-esm/react-surface-O3UDMKOQ.mjs +140 -0
- package/dist/lib/node-esm/react-surface-O3UDMKOQ.mjs.map +7 -0
- package/dist/lib/node-esm/settings-OFIMHU7K.mjs +36 -0
- package/dist/lib/node-esm/settings-OFIMHU7K.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 +22 -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 +9 -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 +9 -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/DeploymentDialog/DeploymentDialog.d.ts +3 -3
- package/dist/types/src/components/DeploymentDialog/DeploymentDialog.d.ts.map +1 -1
- package/dist/types/src/components/DeploymentDialog/DeploymentDialog.stories.d.ts +114 -10
- package/dist/types/src/components/DeploymentDialog/DeploymentDialog.stories.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/NotebookContainer.d.ts +8 -0
- package/dist/types/src/components/NotebookContainer.d.ts.map +1 -0
- package/dist/types/src/components/NotebookContainer.stories.d.ts +7 -0
- package/dist/types/src/components/NotebookContainer.stories.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 +249 -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/ScriptContainer.d.ts +7 -8
- package/dist/types/src/components/ScriptContainer.d.ts.map +1 -1
- package/dist/types/src/components/ScriptToolbar/ScriptToolbar.d.ts +7 -8
- package/dist/types/src/components/ScriptToolbar/ScriptToolbar.d.ts.map +1 -1
- package/dist/types/src/components/ScriptToolbar/ScriptToolbar.stories.d.ts +241 -2
- package/dist/types/src/components/ScriptToolbar/ScriptToolbar.stories.d.ts.map +1 -1
- package/dist/types/src/components/Settings/ScriptObjectSettings.d.ts +2 -2
- package/dist/types/src/components/Settings/ScriptObjectSettings.d.ts.map +1 -1
- package/dist/types/src/components/Settings/ScriptPluginSettings.d.ts +6 -4
- package/dist/types/src/components/Settings/ScriptPluginSettings.d.ts.map +1 -1
- package/dist/types/src/components/TestPanel/TestContainer.d.ts +3 -3
- package/dist/types/src/components/TestPanel/TestContainer.d.ts.map +1 -1
- package/dist/types/src/components/TestPanel/TestPanel.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 +3 -3
- package/dist/types/src/components/TypescriptEditor/TypescriptEditor.stories.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +3 -1
- package/dist/types/src/components/index.d.ts.map +1 -1
- 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 +16 -31
- package/dist/types/src/hooks/deploy.d.ts.map +1 -1
- package/dist/types/src/hooks/format.d.ts +4 -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 +6 -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 -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 +31 -5
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/Notebook.d.ts +100 -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 +4 -4
- 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 +117 -82
- package/src/ScriptPlugin.tsx +55 -75
- package/src/blueprints/index.ts +5 -0
- package/src/blueprints/script-blueprint.ts +24 -0
- package/src/capabilities/app-graph-builder/app-graph-builder.ts +55 -0
- package/src/capabilities/app-graph-builder/index.ts +7 -0
- package/src/capabilities/{artifact-definition.ts → artifact-definition/artifact-definition.ts} +98 -96
- package/src/capabilities/artifact-definition/index.ts +7 -0
- package/src/capabilities/blueprint-definition/blueprint-definition.ts +23 -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 +74 -0
- package/src/capabilities/react-surface/index.ts +7 -0
- package/src/capabilities/react-surface/react-surface.tsx +118 -0
- package/src/capabilities/settings/index.ts +7 -0
- package/src/capabilities/settings/settings.ts +32 -0
- package/src/compiler/compiler.ts +10 -3
- package/src/components/DeploymentDialog/DeploymentDialog.stories.tsx +37 -26
- package/src/components/DeploymentDialog/DeploymentDialog.tsx +41 -50
- package/src/components/FrameContainer/FrameContainer.tsx +6 -4
- package/src/components/NotebookContainer.stories.tsx +87 -0
- package/src/components/NotebookContainer.tsx +270 -0
- package/src/components/NotebookStack/NotebookCell.tsx +217 -0
- package/src/components/NotebookStack/NotebookMenu.tsx +47 -0
- package/src/components/NotebookStack/NotebookStack.stories.tsx +55 -0
- package/src/components/NotebookStack/NotebookStack.tsx +86 -0
- package/src/components/NotebookStack/index.ts +6 -0
- package/src/components/QueryEditor/QueryEditor.stories.tsx +100 -0
- package/src/components/QueryEditor/QueryEditor.tsx +47 -0
- package/src/components/QueryEditor/index.ts +5 -0
- package/src/components/ScriptContainer.tsx +50 -35
- package/src/components/ScriptToolbar/ScriptToolbar.stories.tsx +54 -19
- package/src/components/ScriptToolbar/ScriptToolbar.tsx +30 -36
- package/src/components/Settings/ScriptObjectSettings.tsx +136 -29
- package/src/components/Settings/ScriptPluginSettings.tsx +11 -21
- package/src/components/TestPanel/TestContainer.tsx +7 -7
- package/src/components/TestPanel/TestPanel.tsx +42 -19
- package/src/components/TypescriptEditor/TypescriptEditor.stories.tsx +77 -17
- package/src/components/TypescriptEditor/TypescriptEditor.tsx +81 -80
- package/src/components/index.ts +3 -0
- package/src/e2e/ai.test.ts +92 -0
- package/src/e2e/deploy.test.ts +64 -0
- package/src/hooks/deploy.ts +44 -37
- package/src/hooks/format.ts +9 -5
- package/src/hooks/index.ts +1 -0
- package/src/hooks/template.ts +20 -23
- package/src/hooks/useCompiler.ts +24 -0
- package/src/hooks/useCreateAndDeployScriptTemplates.ts +14 -16
- package/src/hooks/useToolbarState.ts +29 -5
- package/src/index.ts +2 -1
- package/src/meta.ts +9 -7
- 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/chess-bot.ts +58 -0
- package/src/templates/commentary.ts +232 -0
- package/src/templates/data-generator.ts +3 -1
- package/src/templates/discord.ts +9 -1
- package/src/templates/forex-effect.ts +24 -25
- package/src/templates/forex.ts +9 -6
- package/src/templates/gmail.ts +22 -11
- package/src/templates/index.ts +24 -11
- 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 +34 -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 +30 -40
- package/src/util/functions.ts +56 -23
- package/src/vite-env.d.ts +2 -0
- package/dist/lib/browser/DeploymentDialog-QZSTVNIS.mjs +0 -12
- package/dist/lib/browser/ScriptContainer-IA7YJMFR.mjs +0 -265
- package/dist/lib/browser/ScriptContainer-IA7YJMFR.mjs.map +0 -7
- package/dist/lib/browser/app-graph-builder-5NIA7SLT.mjs +0 -64
- package/dist/lib/browser/app-graph-builder-5NIA7SLT.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-4AUQEB2I.mjs +0 -88
- package/dist/lib/browser/chunk-4AUQEB2I.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-B5QYN3AG.mjs +0 -556
- package/dist/lib/browser/chunk-B5QYN3AG.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-KLGK77UK.mjs +0 -283
- package/dist/lib/browser/chunk-KLGK77UK.mjs.map +0 -7
- package/dist/lib/browser/chunk-NXKU3BNX.mjs +0 -222
- package/dist/lib/browser/chunk-NXKU3BNX.mjs.map +0 -7
- package/dist/lib/browser/chunk-QYAREHGH.mjs.map +0 -7
- package/dist/lib/browser/chunk-YCZPTTFO.mjs +0 -153
- package/dist/lib/browser/chunk-YCZPTTFO.mjs.map +0 -7
- package/dist/lib/browser/compiler-O7MNN3XT.mjs +0 -98
- package/dist/lib/browser/compiler-O7MNN3XT.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-GGGTXYMB.mjs +0 -89
- package/dist/lib/browser/intent-resolver-GGGTXYMB.mjs.map +0 -7
- package/dist/lib/browser/react-surface-C4ZTW4QA.mjs +0 -104
- package/dist/lib/browser/react-surface-C4ZTW4QA.mjs.map +0 -7
- package/dist/lib/browser/settings-A4E4R7VL.mjs +0 -24
- package/dist/lib/browser/settings-A4E4R7VL.mjs.map +0 -7
- package/dist/lib/node-esm/DeploymentDialog-G6EHEPXN.mjs +0 -13
- package/dist/lib/node-esm/ScriptContainer-6AVJSLU4.mjs +0 -266
- package/dist/lib/node-esm/ScriptContainer-6AVJSLU4.mjs.map +0 -7
- package/dist/lib/node-esm/app-graph-builder-V7QF54LT.mjs +0 -65
- package/dist/lib/node-esm/app-graph-builder-V7QF54LT.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-35M3CHYE.mjs +0 -16
- package/dist/lib/node-esm/chunk-35M3CHYE.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-5OGRMRLA.mjs +0 -90
- package/dist/lib/node-esm/chunk-5OGRMRLA.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-AHXJ6NQU.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-M642JUOZ.mjs +0 -223
- package/dist/lib/node-esm/chunk-M642JUOZ.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-MPN2DI4P.mjs +0 -557
- package/dist/lib/node-esm/chunk-MPN2DI4P.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-WXKOIREL.mjs +0 -284
- package/dist/lib/node-esm/chunk-WXKOIREL.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-ZA36GO4T.mjs +0 -154
- package/dist/lib/node-esm/chunk-ZA36GO4T.mjs.map +0 -7
- package/dist/lib/node-esm/compiler-TZUZ7I6H.mjs +0 -99
- package/dist/lib/node-esm/compiler-TZUZ7I6H.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-DUJWXCRR.mjs +0 -90
- package/dist/lib/node-esm/intent-resolver-DUJWXCRR.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-5CM3KXFE.mjs +0 -105
- package/dist/lib/node-esm/react-surface-5CM3KXFE.mjs.map +0 -7
- package/dist/lib/node-esm/settings-FZ25DUX4.mjs +0 -25
- package/dist/lib/node-esm/settings-FZ25DUX4.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/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/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 -77
- package/src/capabilities/react-surface.tsx +0 -90
- package/src/capabilities/settings.ts +0 -21
- 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-QZSTVNIS.mjs.map → DeploymentDialog-GXNRUXF6.mjs.map} +0 -0
- /package/dist/lib/{node-esm/DeploymentDialog-G6EHEPXN.mjs.map → browser/blueprints/index.mjs.map} +0 -0
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
|
+
|
|
7
|
+
import { Capability, Common } from '@dxos/app-framework';
|
|
8
|
+
import { createKvsStore } from '@dxos/effect';
|
|
9
|
+
|
|
10
|
+
import { meta } from '../../meta';
|
|
11
|
+
import { ScriptCapabilities, ScriptSettings } from '../../types';
|
|
12
|
+
|
|
13
|
+
export default Capability.makeModule(() =>
|
|
14
|
+
Effect.sync(() => {
|
|
15
|
+
const settingsAtom = createKvsStore({
|
|
16
|
+
key: meta.id,
|
|
17
|
+
schema: ScriptSettings,
|
|
18
|
+
defaultValue: () => ({
|
|
19
|
+
editorInputMode: 'vscode' as const,
|
|
20
|
+
}),
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
return [
|
|
24
|
+
Capability.contributes(ScriptCapabilities.Settings, settingsAtom),
|
|
25
|
+
Capability.contributes(Common.Capability.Settings, {
|
|
26
|
+
prefix: meta.id,
|
|
27
|
+
schema: ScriptSettings,
|
|
28
|
+
atom: settingsAtom,
|
|
29
|
+
}),
|
|
30
|
+
];
|
|
31
|
+
}),
|
|
32
|
+
);
|
package/src/compiler/compiler.ts
CHANGED
|
@@ -12,6 +12,8 @@ import ts from 'typescript';
|
|
|
12
12
|
|
|
13
13
|
import { invariant } from '@dxos/invariant';
|
|
14
14
|
|
|
15
|
+
const GLOBALS = 'globals.d.ts';
|
|
16
|
+
|
|
15
17
|
const defaultOptions: ts.CompilerOptions = {
|
|
16
18
|
lib: ['DOM', 'es2022'],
|
|
17
19
|
target: ts.ScriptTarget.ES2022,
|
|
@@ -23,16 +25,21 @@ export class Compiler {
|
|
|
23
25
|
|
|
24
26
|
constructor(private readonly _options: ts.CompilerOptions = defaultOptions) {}
|
|
25
27
|
|
|
26
|
-
async initialize(): Promise<void> {
|
|
28
|
+
async initialize(globals?: string): Promise<void> {
|
|
27
29
|
if (this._env) {
|
|
28
30
|
return;
|
|
29
31
|
}
|
|
30
32
|
|
|
31
33
|
// TODO(wittjosiah): Figure out how to get workers working in plugin packages.
|
|
32
34
|
// https://github.com/val-town/codemirror-ts?tab=readme-ov-file#setup-worker
|
|
33
|
-
this._fsMap = await createDefaultMapFromCDN(this._options, '5.
|
|
35
|
+
this._fsMap = await createDefaultMapFromCDN(this._options, '5.7.2', true, ts);
|
|
36
|
+
if (globals) {
|
|
37
|
+
this._fsMap.set(GLOBALS, globals);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const rootFiles = globals ? [GLOBALS] : [];
|
|
34
41
|
const system = createSystem(this._fsMap);
|
|
35
|
-
this._env = createVirtualTypeScriptEnvironment(system,
|
|
42
|
+
this._env = createVirtualTypeScriptEnvironment(system, rootFiles, ts, this._options);
|
|
36
43
|
}
|
|
37
44
|
|
|
38
45
|
get environment() {
|
|
@@ -2,50 +2,61 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import '@dxos-theme';
|
|
6
|
-
|
|
7
5
|
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
8
|
-
import React from 'react';
|
|
6
|
+
import React, { useMemo } from 'react';
|
|
9
7
|
|
|
8
|
+
import { OperationPlugin } from '@dxos/app-framework';
|
|
9
|
+
import { withPluginManager } from '@dxos/app-framework/testing';
|
|
10
10
|
import { Obj } from '@dxos/echo';
|
|
11
|
+
import { ClientPlugin } from '@dxos/plugin-client';
|
|
11
12
|
import { Dialog } from '@dxos/react-ui';
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
13
|
+
import { withTheme } from '@dxos/react-ui/testing';
|
|
14
|
+
import { AccessToken } from '@dxos/types';
|
|
14
15
|
|
|
15
16
|
import { translations } from '../../translations';
|
|
16
17
|
|
|
17
|
-
import { DeploymentDialog
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
import { DeploymentDialog } from './DeploymentDialog';
|
|
19
|
+
|
|
20
|
+
// TODO(wittjosiah): ECHO objects don't work when passed via Storybook args.
|
|
21
|
+
const DeploymentDialogStory = () => {
|
|
22
|
+
const accessToken = useMemo(
|
|
23
|
+
() =>
|
|
24
|
+
Obj.make(AccessToken.AccessToken, {
|
|
25
|
+
source: 'example.com',
|
|
26
|
+
token: 'example-token',
|
|
27
|
+
}),
|
|
28
|
+
[],
|
|
29
|
+
);
|
|
30
|
+
const scriptTemplates = useMemo(
|
|
31
|
+
() => [
|
|
32
|
+
{ id: 't-1', name: 'Script 1', source: 'template1' },
|
|
33
|
+
{ id: 't-2', name: 'Script 2', source: 'template2' },
|
|
34
|
+
{ id: 't-3', name: 'Script 3', source: 'template3' },
|
|
35
|
+
],
|
|
36
|
+
[],
|
|
37
|
+
);
|
|
20
38
|
return (
|
|
21
39
|
<Dialog.Root defaultOpen={true}>
|
|
22
|
-
<DeploymentDialog {
|
|
40
|
+
<DeploymentDialog accessToken={accessToken} scriptTemplates={scriptTemplates} />
|
|
23
41
|
</Dialog.Root>
|
|
24
42
|
);
|
|
25
43
|
};
|
|
26
44
|
|
|
27
45
|
const meta = {
|
|
28
46
|
title: 'plugins/plugin-script/DeploymentDialog',
|
|
29
|
-
component:
|
|
30
|
-
render: DefaultStory,
|
|
47
|
+
component: DeploymentDialogStory,
|
|
31
48
|
parameters: { translations },
|
|
32
|
-
|
|
33
|
-
|
|
49
|
+
// TODO(wittjosiah): Try to write story which does not depend on plugin manager.
|
|
50
|
+
decorators: [
|
|
51
|
+
withTheme,
|
|
52
|
+
withPluginManager({
|
|
53
|
+
plugins: [OperationPlugin(), ClientPlugin({})],
|
|
54
|
+
}),
|
|
55
|
+
],
|
|
56
|
+
} satisfies Meta<typeof DeploymentDialogStory>;
|
|
34
57
|
|
|
35
58
|
export default meta;
|
|
36
59
|
|
|
37
60
|
type Story = StoryObj<typeof meta>;
|
|
38
61
|
|
|
39
|
-
export const Default: Story = {
|
|
40
|
-
args: {
|
|
41
|
-
accessToken: Obj.make(DataType.AccessToken, {
|
|
42
|
-
source: 'example.com',
|
|
43
|
-
token: 'example-token',
|
|
44
|
-
}),
|
|
45
|
-
scriptTemplates: [
|
|
46
|
-
{ id: 't-1', name: 'Script 1', source: 'template1' },
|
|
47
|
-
{ id: 't-2', name: 'Script 2', source: 'template2' },
|
|
48
|
-
{ id: 't-3', name: 'Script 3', source: 'template3' },
|
|
49
|
-
],
|
|
50
|
-
},
|
|
51
|
-
};
|
|
62
|
+
export const Default: Story = {};
|
|
@@ -4,16 +4,17 @@
|
|
|
4
4
|
|
|
5
5
|
import React, { useEffect, useMemo } from 'react';
|
|
6
6
|
|
|
7
|
-
import {
|
|
7
|
+
import { Common } from '@dxos/app-framework';
|
|
8
|
+
import { useOperationInvoker } from '@dxos/app-framework/react';
|
|
8
9
|
import { getSpace } from '@dxos/react-client/echo';
|
|
9
|
-
import { Button, Dialog,
|
|
10
|
-
import { type
|
|
10
|
+
import { Button, Dialog, IconButton, useTranslation } from '@dxos/react-ui';
|
|
11
|
+
import { type AccessToken } from '@dxos/types';
|
|
11
12
|
|
|
12
|
-
import { useCreateAndDeployScriptTemplates } from '../../hooks
|
|
13
|
-
import {
|
|
13
|
+
import { useCreateAndDeployScriptTemplates } from '../../hooks';
|
|
14
|
+
import { meta } from '../../meta';
|
|
14
15
|
import { type Template } from '../../templates';
|
|
15
16
|
|
|
16
|
-
export const DEPLOYMENT_DIALOG = `${
|
|
17
|
+
export const DEPLOYMENT_DIALOG = `${meta.id}/deployment/dialog`;
|
|
17
18
|
|
|
18
19
|
// TODO(ZaymonFC):
|
|
19
20
|
// - Show activity and feedback to the user.
|
|
@@ -21,74 +22,60 @@ export const DEPLOYMENT_DIALOG = `${SCRIPT_PLUGIN}/deployment/dialog`;
|
|
|
21
22
|
// - Pending / onError states.
|
|
22
23
|
|
|
23
24
|
export type DeploymentDialogProps = {
|
|
24
|
-
accessToken:
|
|
25
|
+
accessToken: AccessToken.AccessToken;
|
|
25
26
|
scriptTemplates: Template[];
|
|
26
27
|
};
|
|
27
28
|
|
|
28
29
|
export const DeploymentDialog = ({ accessToken, scriptTemplates }: DeploymentDialogProps) => {
|
|
29
|
-
const { t } = useTranslation(
|
|
30
|
+
const { t } = useTranslation(meta.id);
|
|
30
31
|
const space = useMemo(() => getSpace(accessToken), [accessToken]);
|
|
31
32
|
|
|
32
33
|
// TODO(ZaymonFC): Thinking further. All of this should get moved to intents to run async in the background.
|
|
33
34
|
// Deployment shouldn't be tied to the lifecycle of the dialogue component.
|
|
34
35
|
const { handleCreateAndDeployScripts, status } = useCreateAndDeployScriptTemplates(space, scriptTemplates);
|
|
35
|
-
const {
|
|
36
|
+
const { invokePromise } = useOperationInvoker();
|
|
36
37
|
|
|
37
38
|
useEffect(() => {
|
|
38
39
|
if (status === 'success') {
|
|
39
40
|
// TODO(ZaymonFC): We can probably re-use this toast for normal script deployment.
|
|
40
|
-
void
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
closeLabel: ['script deployment toast close label', { ns: SCRIPT_PLUGIN, count: scriptTemplates.length }],
|
|
50
|
-
},
|
|
51
|
-
}),
|
|
52
|
-
);
|
|
53
|
-
void dispatch(createIntent(LayoutAction.UpdateDialog, { part: 'dialog', options: { state: false } }));
|
|
41
|
+
void invokePromise(Common.LayoutOperation.AddToast, {
|
|
42
|
+
id: `${meta.id}/deployment-success`,
|
|
43
|
+
icon: 'ph--check--regular',
|
|
44
|
+
duration: Infinity,
|
|
45
|
+
title: ['script deployment toast label', { ns: meta.id, count: scriptTemplates.length }],
|
|
46
|
+
description: ['script deployment toast description', { ns: meta.id, count: scriptTemplates.length }],
|
|
47
|
+
closeLabel: ['script deployment toast close label', { ns: meta.id, count: scriptTemplates.length }],
|
|
48
|
+
});
|
|
49
|
+
void invokePromise(Common.LayoutOperation.UpdateDialog, { state: false });
|
|
54
50
|
}
|
|
55
51
|
if (status === 'error') {
|
|
56
|
-
void
|
|
57
|
-
void
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
description: [
|
|
66
|
-
'script deployment error toast description',
|
|
67
|
-
{ ns: SCRIPT_PLUGIN, count: scriptTemplates.length },
|
|
68
|
-
],
|
|
69
|
-
closeLabel: [
|
|
70
|
-
'script deployment error toast close label',
|
|
71
|
-
{ ns: SCRIPT_PLUGIN, count: scriptTemplates.length },
|
|
72
|
-
],
|
|
73
|
-
},
|
|
74
|
-
}),
|
|
75
|
-
);
|
|
52
|
+
void invokePromise(Common.LayoutOperation.UpdateDialog, { state: false });
|
|
53
|
+
void invokePromise(Common.LayoutOperation.AddToast, {
|
|
54
|
+
id: `${meta.id}/deployment-error`,
|
|
55
|
+
icon: 'ph--warning--regular',
|
|
56
|
+
duration: Infinity,
|
|
57
|
+
title: ['script deployment error toast label', { ns: meta.id, count: scriptTemplates.length }],
|
|
58
|
+
description: ['script deployment error toast description', { ns: meta.id, count: scriptTemplates.length }],
|
|
59
|
+
closeLabel: ['script deployment error toast close label', { ns: meta.id, count: scriptTemplates.length }],
|
|
60
|
+
});
|
|
76
61
|
}
|
|
77
|
-
}, [status,
|
|
62
|
+
}, [status, invokePromise]);
|
|
78
63
|
|
|
79
64
|
return (
|
|
80
65
|
<Dialog.Content>
|
|
81
66
|
<div className='flex justify-between items-center'>
|
|
82
67
|
<Dialog.Title>{t('deployment dialog title')}</Dialog.Title>
|
|
83
68
|
<Dialog.Close asChild>
|
|
84
|
-
<
|
|
85
|
-
<Icon icon='ph--x--regular' size={4} />
|
|
86
|
-
</Button>
|
|
69
|
+
<IconButton icon='ph--x--regular' size={4} label='Close' iconOnly density='fine' variant='ghost' />
|
|
87
70
|
</Dialog.Close>
|
|
88
71
|
</div>
|
|
89
72
|
<div role='none' className='plb-4'>
|
|
90
73
|
{/* TODO: Implement deployment logic and UI. */}
|
|
91
|
-
<p>
|
|
74
|
+
<p>
|
|
75
|
+
{t('deployment dialog scripts found message', {
|
|
76
|
+
count: scriptTemplates.length,
|
|
77
|
+
})}
|
|
78
|
+
</p>
|
|
92
79
|
<ul className='pbs-2'>
|
|
93
80
|
{scriptTemplates.map((template) => {
|
|
94
81
|
return <li key={template.id}>{template.name}</li>;
|
|
@@ -98,8 +85,12 @@ export const DeploymentDialog = ({ accessToken, scriptTemplates }: DeploymentDia
|
|
|
98
85
|
<div role='none' className='flex flex-row-reverse gap-1'>
|
|
99
86
|
<Button variant='primary' onClick={handleCreateAndDeployScripts} disabled={status === 'pending'}>
|
|
100
87
|
{status === 'pending'
|
|
101
|
-
? t('deployment dialog deploy functions pending button label', {
|
|
102
|
-
|
|
88
|
+
? t('deployment dialog deploy functions pending button label', {
|
|
89
|
+
count: scriptTemplates.length,
|
|
90
|
+
})
|
|
91
|
+
: t('deployment dialog deploy functions button label', {
|
|
92
|
+
count: scriptTemplates.length,
|
|
93
|
+
})}
|
|
103
94
|
</Button>
|
|
104
95
|
<Dialog.Close asChild disabled={status === 'pending'}>
|
|
105
96
|
<Button disabled={status === 'pending'}>{t('deployment dialog skip button label')}</Button>
|
|
@@ -5,13 +5,13 @@
|
|
|
5
5
|
import React, { useEffect, useRef } from 'react';
|
|
6
6
|
|
|
7
7
|
import { clientServiceBundle } from '@dxos/client-protocol';
|
|
8
|
-
import { type BundleResult } from '@dxos/functions/bundler';
|
|
8
|
+
import { type BundleResult } from '@dxos/functions-runtime/bundler';
|
|
9
9
|
import { invariant } from '@dxos/invariant';
|
|
10
10
|
import { log } from '@dxos/log';
|
|
11
11
|
import { useClient } from '@dxos/react-client';
|
|
12
|
-
import { baseSurface, mx } from '@dxos/react-ui-theme';
|
|
13
12
|
import { createProtoRpcPeer } from '@dxos/rpc';
|
|
14
13
|
import { createIFramePort } from '@dxos/rpc-tunnel';
|
|
14
|
+
import { baseSurface, mx } from '@dxos/ui-theme';
|
|
15
15
|
|
|
16
16
|
export type FrameContainerProps = {
|
|
17
17
|
containerUrl: string;
|
|
@@ -49,7 +49,9 @@ export const FrameContainer = ({ containerUrl, result, debug = true }: FrameCont
|
|
|
49
49
|
invariant(result.sourceHash, 'Source hash is required.');
|
|
50
50
|
const sourceHash = Buffer.from(result.sourceHash).toString('hex');
|
|
51
51
|
const src =
|
|
52
|
-
'bundle' in result
|
|
52
|
+
'bundle' in result
|
|
53
|
+
? `${containerUrl}?ts=${sourceHash}#code=${encodeURIComponent(new TextDecoder().decode(Object.values(result.bundle as any)[0] as Uint8Array))}`
|
|
54
|
+
: undefined;
|
|
53
55
|
|
|
54
56
|
return (
|
|
55
57
|
<>
|
|
@@ -60,7 +62,7 @@ export const FrameContainer = ({ containerUrl, result, debug = true }: FrameCont
|
|
|
60
62
|
<div
|
|
61
63
|
className={mx(
|
|
62
64
|
baseSurface,
|
|
63
|
-
'flex absolute right-2 bottom-2
|
|
65
|
+
'flex absolute right-2 bottom-2 is-[30rem] bs-[200px] ring rounded',
|
|
64
66
|
'z-20 overflow-x-hidden overflow-y-auto',
|
|
65
67
|
)}
|
|
66
68
|
>
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2023 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
6
|
+
import * as Effect from 'effect/Effect';
|
|
7
|
+
import React from 'react';
|
|
8
|
+
|
|
9
|
+
import { SERVICES_CONFIG } from '@dxos/ai/testing';
|
|
10
|
+
import { withPluginManager } from '@dxos/app-framework/testing';
|
|
11
|
+
import { Agent } from '@dxos/assistant-toolkit';
|
|
12
|
+
import { Filter } from '@dxos/echo';
|
|
13
|
+
import { Function, serializeFunction } from '@dxos/functions';
|
|
14
|
+
import { AssistantPlugin } from '@dxos/plugin-assistant';
|
|
15
|
+
import { AutomationPlugin } from '@dxos/plugin-automation';
|
|
16
|
+
import { ClientPlugin } from '@dxos/plugin-client';
|
|
17
|
+
import { ExplorerPlugin } from '@dxos/plugin-explorer';
|
|
18
|
+
import { Markdown, MarkdownPlugin } from '@dxos/plugin-markdown';
|
|
19
|
+
import { corePlugins } from '@dxos/plugin-testing';
|
|
20
|
+
import { Config, useClient } from '@dxos/react-client';
|
|
21
|
+
import { useQuery } from '@dxos/react-client/echo';
|
|
22
|
+
import { withLayout, withTheme } from '@dxos/react-ui/testing';
|
|
23
|
+
import { DataTypes } from '@dxos/schema';
|
|
24
|
+
|
|
25
|
+
import { createNotebook } from '../testing';
|
|
26
|
+
import { translations } from '../translations';
|
|
27
|
+
import { Notebook } from '../types';
|
|
28
|
+
|
|
29
|
+
import { NotebookContainer } from './NotebookContainer';
|
|
30
|
+
|
|
31
|
+
const meta: Meta<typeof NotebookContainer> = {
|
|
32
|
+
title: 'plugins/plugin-script/NotebookContainer',
|
|
33
|
+
component: NotebookContainer,
|
|
34
|
+
render: (args) => {
|
|
35
|
+
const client = useClient();
|
|
36
|
+
const space = client.spaces.default;
|
|
37
|
+
const notebooks = useQuery(space?.db, Filter.type(Notebook.Notebook));
|
|
38
|
+
return <NotebookContainer {...args} subject={notebooks[0]} />;
|
|
39
|
+
},
|
|
40
|
+
decorators: [
|
|
41
|
+
withTheme,
|
|
42
|
+
withLayout({ layout: 'column', classNames: 'is-proseMaxWidth' }),
|
|
43
|
+
withPluginManager({
|
|
44
|
+
plugins: [
|
|
45
|
+
...corePlugins(),
|
|
46
|
+
ClientPlugin({
|
|
47
|
+
// TODO(wittjosiah): ComputeRuntime requires edge to be configured or it will throw.
|
|
48
|
+
config: new Config({
|
|
49
|
+
runtime: {
|
|
50
|
+
services: SERVICES_CONFIG.REMOTE,
|
|
51
|
+
},
|
|
52
|
+
}),
|
|
53
|
+
types: [...DataTypes, Notebook.Notebook, Function.Function, Markdown.Document],
|
|
54
|
+
onClientInitialized: ({ client }) =>
|
|
55
|
+
Effect.gen(function* () {
|
|
56
|
+
yield* Effect.promise(() => client.halo.createIdentity());
|
|
57
|
+
yield* Effect.promise(() => client.spaces.waitUntilReady());
|
|
58
|
+
const space = client.spaces.default;
|
|
59
|
+
yield* Effect.promise(() => space.waitUntilReady());
|
|
60
|
+
|
|
61
|
+
space.db.add(createNotebook());
|
|
62
|
+
space.db.add(Markdown.make({ content: '# Hello World' }));
|
|
63
|
+
space.db.add(serializeFunction(Agent.prompt));
|
|
64
|
+
}),
|
|
65
|
+
}),
|
|
66
|
+
AssistantPlugin(),
|
|
67
|
+
AutomationPlugin(),
|
|
68
|
+
ExplorerPlugin(),
|
|
69
|
+
MarkdownPlugin(),
|
|
70
|
+
],
|
|
71
|
+
}),
|
|
72
|
+
],
|
|
73
|
+
parameters: {
|
|
74
|
+
translations,
|
|
75
|
+
},
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
export default meta;
|
|
79
|
+
|
|
80
|
+
type Story = StoryObj<typeof meta>;
|
|
81
|
+
|
|
82
|
+
export const Default: Story = {
|
|
83
|
+
args: {
|
|
84
|
+
role: 'article',
|
|
85
|
+
subject: undefined as any,
|
|
86
|
+
},
|
|
87
|
+
};
|