@dxos/plugin-script 0.8.4-main.ae835ea → 0.8.4-main.bc674ce
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-OSL6RMPA.mjs +14 -0
- package/dist/lib/browser/{NotebookContainer-C36N7AFF.mjs → NotebookContainer-NBAXYESH.mjs} +267 -239
- package/dist/lib/browser/NotebookContainer-NBAXYESH.mjs.map +7 -0
- package/dist/lib/browser/ScriptContainer-WD33CJMI.mjs +149 -0
- package/dist/lib/browser/ScriptContainer-WD33CJMI.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-BTWHM6FH.mjs +270 -0
- package/dist/lib/browser/chunk-BTWHM6FH.mjs.map +7 -0
- package/dist/lib/browser/chunk-C53UJGSU.mjs +557 -0
- package/dist/lib/browser/chunk-C53UJGSU.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-TWX2NMZN.mjs +137 -0
- package/dist/lib/browser/chunk-TWX2NMZN.mjs.map +7 -0
- package/dist/lib/browser/chunk-UUR4JNNB.mjs +113 -0
- package/dist/lib/browser/chunk-UUR4JNNB.mjs.map +7 -0
- package/dist/lib/browser/{chunk-ST3ACVUC.mjs → chunk-UX4GHJ5E.mjs} +29 -12
- package/dist/lib/browser/chunk-UX4GHJ5E.mjs.map +7 -0
- package/dist/lib/browser/{chunk-EB6AXFXO.mjs → chunk-WYR4QHPE.mjs} +1 -1
- package/dist/lib/browser/chunk-WYR4QHPE.mjs.map +7 -0
- package/dist/lib/browser/chunk-XCN4D3Z5.mjs +606 -0
- package/dist/lib/browser/chunk-XCN4D3Z5.mjs.map +7 -0
- package/dist/lib/browser/compiler-76F3QAXC.mjs +161 -0
- package/dist/lib/browser/compiler-76F3QAXC.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +96 -126
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/operation-resolver-HUILPPKT.mjs +82 -0
- package/dist/lib/browser/operation-resolver-HUILPPKT.mjs.map +7 -0
- package/dist/lib/browser/{react-surface-X4NATU6B.mjs → react-surface-O6GKHB2J.mjs} +52 -41
- package/dist/lib/browser/react-surface-O6GKHB2J.mjs.map +7 -0
- package/dist/lib/browser/settings-3ENI25PI.mjs +35 -0
- package/dist/lib/browser/settings-3ENI25PI.mjs.map +7 -0
- package/dist/lib/browser/templates/index.mjs +1 -1
- package/dist/lib/browser/types/index.mjs +9 -5
- package/dist/lib/node-esm/{DeploymentDialog-OSHHSEBH.mjs → DeploymentDialog-OGBJPVIX.mjs} +6 -6
- package/dist/lib/node-esm/DeploymentDialog-OGBJPVIX.mjs.map +7 -0
- package/dist/lib/node-esm/{NotebookContainer-FOVFGJQR.mjs → NotebookContainer-IUAYVJSD.mjs} +267 -239
- package/dist/lib/node-esm/NotebookContainer-IUAYVJSD.mjs.map +7 -0
- package/dist/lib/node-esm/ScriptContainer-K7JCEU5Z.mjs +150 -0
- package/dist/lib/node-esm/ScriptContainer-K7JCEU5Z.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-2GVTWESW.mjs → chunk-4F5FJZ36.mjs} +29 -12
- package/dist/lib/node-esm/chunk-4F5FJZ36.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-4QNZMXW6.mjs +607 -0
- package/dist/lib/node-esm/chunk-4QNZMXW6.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-IBV2DR36.mjs → chunk-5HSJPAK7.mjs} +1 -1
- package/dist/lib/node-esm/chunk-5HSJPAK7.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-BX5PP6AW.mjs +558 -0
- package/dist/lib/node-esm/chunk-BX5PP6AW.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-G3J76DWP.mjs +114 -0
- package/dist/lib/node-esm/chunk-G3J76DWP.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-VQPIA4VF.mjs +138 -0
- package/dist/lib/node-esm/chunk-VQPIA4VF.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/compiler-FNZH6TFN.mjs +162 -0
- package/dist/lib/node-esm/compiler-FNZH6TFN.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +96 -126
- 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-JTCIY6HU.mjs +83 -0
- package/dist/lib/node-esm/operation-resolver-JTCIY6HU.mjs.map +7 -0
- package/dist/lib/node-esm/{react-surface-LVGLBSTE.mjs → react-surface-RLANMVMB.mjs} +52 -41
- package/dist/lib/node-esm/react-surface-RLANMVMB.mjs.map +7 -0
- package/dist/lib/node-esm/settings-7AYC5VXN.mjs +36 -0
- package/dist/lib/node-esm/settings-7AYC5VXN.mjs.map +7 -0
- package/dist/lib/node-esm/templates/index.mjs +1 -1
- package/dist/lib/node-esm/types/index.mjs +9 -5
- package/dist/types/src/ScriptPlugin.d.ts +2 -1
- package/dist/types/src/ScriptPlugin.d.ts.map +1 -1
- package/dist/types/src/blueprints/index.d.ts +2 -0
- package/dist/types/src/blueprints/index.d.ts.map +1 -0
- package/dist/types/src/blueprints/script-blueprint.d.ts +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 +2 -2
- package/dist/types/src/components/DeploymentDialog/DeploymentDialog.d.ts.map +1 -1
- package/dist/types/src/components/DeploymentDialog/DeploymentDialog.stories.d.ts +4 -3
- 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 +3 -5
- package/dist/types/src/components/NotebookContainer.d.ts.map +1 -1
- package/dist/types/src/components/NotebookContainer.stories.d.ts +3 -247
- package/dist/types/src/components/NotebookContainer.stories.d.ts.map +1 -1
- package/dist/types/src/components/NotebookStack/NotebookCell.d.ts +3 -3
- package/dist/types/src/components/NotebookStack/NotebookCell.d.ts.map +1 -1
- package/dist/types/src/components/NotebookStack/NotebookStack.d.ts +1 -1
- package/dist/types/src/components/NotebookStack/NotebookStack.d.ts.map +1 -1
- package/dist/types/src/components/NotebookStack/NotebookStack.stories.d.ts +5 -1
- package/dist/types/src/components/NotebookStack/NotebookStack.stories.d.ts.map +1 -1
- package/dist/types/src/components/QueryEditor/QueryEditor.d.ts +5 -0
- package/dist/types/src/components/QueryEditor/QueryEditor.d.ts.map +1 -0
- package/dist/types/src/components/QueryEditor/QueryEditor.stories.d.ts +13 -0
- package/dist/types/src/components/QueryEditor/QueryEditor.stories.d.ts.map +1 -0
- package/dist/types/src/components/QueryEditor/index.d.ts +2 -0
- package/dist/types/src/components/QueryEditor/index.d.ts.map +1 -0
- package/dist/types/src/components/ScriptContainer.d.ts +4 -5
- package/dist/types/src/components/ScriptContainer.d.ts.map +1 -1
- package/dist/types/src/components/ScriptToolbar/ScriptToolbar.d.ts +2 -2
- package/dist/types/src/components/ScriptToolbar/ScriptToolbar.d.ts.map +1 -1
- package/dist/types/src/components/ScriptToolbar/ScriptToolbar.stories.d.ts +5 -1
- package/dist/types/src/components/ScriptToolbar/ScriptToolbar.stories.d.ts.map +1 -1
- package/dist/types/src/components/Settings/ScriptObjectSettings.d.ts.map +1 -1
- package/dist/types/src/components/Settings/ScriptPluginSettings.d.ts +4 -2
- package/dist/types/src/components/Settings/ScriptPluginSettings.d.ts.map +1 -1
- package/dist/types/src/components/TestPanel/TestContainer.d.ts +1 -1
- 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 +3 -2
- package/dist/types/src/components/TypescriptEditor/TypescriptEditor.d.ts.map +1 -1
- package/dist/types/src/components/TypescriptEditor/TypescriptEditor.stories.d.ts +1 -1
- package/dist/types/src/components/TypescriptEditor/TypescriptEditor.stories.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +2 -2
- 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 +10 -25
- package/dist/types/src/hooks/deploy.d.ts.map +1 -1
- package/dist/types/src/hooks/format.d.ts +2 -2
- package/dist/types/src/hooks/format.d.ts.map +1 -1
- package/dist/types/src/hooks/index.d.ts +1 -0
- package/dist/types/src/hooks/index.d.ts.map +1 -1
- package/dist/types/src/hooks/template.d.ts +2 -2
- package/dist/types/src/hooks/template.d.ts.map +1 -1
- package/dist/types/src/hooks/useCompiler.d.ts +7 -0
- package/dist/types/src/hooks/useCompiler.d.ts.map +1 -0
- package/dist/types/src/hooks/useCreateAndDeployScriptTemplates.d.ts.map +1 -1
- package/dist/types/src/hooks/useToolbarState.d.ts +8 -1
- package/dist/types/src/hooks/useToolbarState.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +1 -1
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +2 -2
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/notebook/compute-graph.d.ts +24 -11
- package/dist/types/src/notebook/compute-graph.d.ts.map +1 -1
- package/dist/types/src/templates/anthropic.d.ts +8 -0
- package/dist/types/src/templates/anthropic.d.ts.map +1 -0
- package/dist/types/src/templates/chess-bot.d.ts +16 -0
- package/dist/types/src/templates/chess-bot.d.ts.map +1 -0
- package/dist/types/src/templates/commentary.d.ts +16 -0
- package/dist/types/src/templates/commentary.d.ts.map +1 -0
- package/dist/types/src/templates/forex-effect.d.ts +4 -1
- package/dist/types/src/templates/forex-effect.d.ts.map +1 -1
- package/dist/types/src/templates/forex.d.ts +4 -1
- package/dist/types/src/templates/forex.d.ts.map +1 -1
- package/dist/types/src/templates/index.d.ts +12 -3
- package/dist/types/src/templates/index.d.ts.map +1 -1
- package/dist/types/src/templates/ping.d.ts +1 -4
- package/dist/types/src/templates/ping.d.ts.map +1 -1
- package/dist/types/src/testing/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 +2 -0
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/Notebook.d.ts +91 -22
- package/dist/types/src/types/Notebook.d.ts.map +1 -1
- package/dist/types/src/types/actions.d.ts +30 -44
- package/dist/types/src/types/actions.d.ts.map +1 -1
- package/dist/types/src/types/capabilities.d.ts +12 -0
- package/dist/types/src/types/capabilities.d.ts.map +1 -0
- package/dist/types/src/types/events.d.ts +5 -0
- package/dist/types/src/types/events.d.ts.map +1 -0
- package/dist/types/src/types/index.d.ts +2 -0
- package/dist/types/src/types/index.d.ts.map +1 -1
- package/dist/types/src/util/deploy.d.ts.map +1 -1
- package/dist/types/src/util/functions.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +113 -85
- package/src/ScriptPlugin.tsx +36 -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} +97 -95
- 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 +28 -24
- package/src/components/DeploymentDialog/DeploymentDialog.tsx +38 -41
- package/src/components/FrameContainer/FrameContainer.tsx +6 -4
- package/src/components/NotebookContainer.stories.tsx +23 -19
- package/src/components/NotebookContainer.tsx +69 -61
- package/src/components/NotebookStack/NotebookCell.tsx +36 -27
- package/src/components/NotebookStack/NotebookStack.stories.tsx +19 -18
- package/src/components/NotebookStack/NotebookStack.tsx +4 -4
- 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 +48 -33
- package/src/components/ScriptToolbar/ScriptToolbar.stories.tsx +38 -15
- package/src/components/ScriptToolbar/ScriptToolbar.tsx +18 -21
- package/src/components/Settings/ScriptObjectSettings.tsx +54 -31
- package/src/components/Settings/ScriptPluginSettings.tsx +8 -3
- package/src/components/TestPanel/TestContainer.tsx +5 -5
- package/src/components/TestPanel/TestPanel.tsx +36 -13
- package/src/components/TypescriptEditor/TypescriptEditor.stories.tsx +14 -9
- package/src/components/TypescriptEditor/TypescriptEditor.tsx +69 -69
- package/src/e2e/ai.test.ts +92 -0
- package/src/e2e/deploy.test.ts +64 -0
- package/src/hooks/deploy.ts +36 -28
- package/src/hooks/format.ts +5 -1
- package/src/hooks/index.ts +1 -0
- package/src/hooks/template.ts +15 -9
- package/src/hooks/useCompiler.ts +24 -0
- package/src/hooks/useCreateAndDeployScriptTemplates.ts +13 -15
- package/src/hooks/useToolbarState.ts +29 -5
- package/src/index.ts +1 -1
- package/src/meta.ts +2 -2
- package/src/notebook/compute-graph.test.ts +20 -8
- package/src/notebook/compute-graph.ts +45 -21
- 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 +1 -1
- package/src/templates/forex-effect.ts +22 -27
- package/src/templates/forex.ts +7 -6
- package/src/templates/gmail.ts +1 -2
- package/src/templates/index.ts +18 -5
- package/src/templates/ping.ts +14 -5
- package/src/testing/data.ts +7 -7
- package/src/testing/simulator.test.ts +40 -0
- package/src/translations.ts +2 -0
- package/src/types/Notebook.ts +12 -12
- package/src/types/actions.ts +17 -25
- package/src/types/capabilities.ts +17 -0
- package/src/types/events.ts +11 -0
- package/src/types/index.ts +2 -0
- package/src/types/types.ts +1 -1
- package/src/util/deploy.ts +23 -29
- package/src/util/functions.ts +29 -25
- package/src/vite-env.d.ts +2 -0
- package/dist/lib/browser/DeploymentDialog-E5NXT4UQ.mjs +0 -14
- package/dist/lib/browser/NotebookContainer-C36N7AFF.mjs.map +0 -7
- package/dist/lib/browser/ScriptContainer-4YPRUM3C.mjs +0 -148
- package/dist/lib/browser/ScriptContainer-4YPRUM3C.mjs.map +0 -7
- package/dist/lib/browser/app-graph-builder-LEOPGBJD.mjs +0 -66
- package/dist/lib/browser/app-graph-builder-LEOPGBJD.mjs.map +0 -7
- package/dist/lib/browser/blueprint-definition-6PZWZM2Y.mjs +0 -30
- package/dist/lib/browser/blueprint-definition-6PZWZM2Y.mjs.map +0 -7
- package/dist/lib/browser/chunk-5S5YQNJZ.mjs +0 -304
- package/dist/lib/browser/chunk-5S5YQNJZ.mjs.map +0 -7
- package/dist/lib/browser/chunk-A5K3TXYA.mjs +0 -269
- package/dist/lib/browser/chunk-A5K3TXYA.mjs.map +0 -7
- package/dist/lib/browser/chunk-EB6AXFXO.mjs.map +0 -7
- package/dist/lib/browser/chunk-HCURXADW.mjs +0 -102
- package/dist/lib/browser/chunk-HCURXADW.mjs.map +0 -7
- package/dist/lib/browser/chunk-HHTOAI2J.mjs +0 -644
- package/dist/lib/browser/chunk-HHTOAI2J.mjs.map +0 -7
- package/dist/lib/browser/chunk-IQMYIWHG.mjs +0 -153
- package/dist/lib/browser/chunk-IQMYIWHG.mjs.map +0 -7
- package/dist/lib/browser/chunk-LI4P25M5.mjs +0 -111
- package/dist/lib/browser/chunk-LI4P25M5.mjs.map +0 -7
- package/dist/lib/browser/chunk-Q2DGRQRN.mjs +0 -255
- package/dist/lib/browser/chunk-Q2DGRQRN.mjs.map +0 -7
- package/dist/lib/browser/chunk-ST3ACVUC.mjs.map +0 -7
- package/dist/lib/browser/chunk-UOQ6NCH3.mjs +0 -15
- package/dist/lib/browser/chunk-UOQ6NCH3.mjs.map +0 -7
- package/dist/lib/browser/compiler-Q4UY2COU.mjs +0 -86
- package/dist/lib/browser/compiler-Q4UY2COU.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-AMMHATM7.mjs +0 -105
- package/dist/lib/browser/intent-resolver-AMMHATM7.mjs.map +0 -7
- package/dist/lib/browser/react-surface-X4NATU6B.mjs.map +0 -7
- package/dist/lib/browser/settings-6UXY7F7D.mjs +0 -26
- package/dist/lib/browser/settings-6UXY7F7D.mjs.map +0 -7
- package/dist/lib/node-esm/NotebookContainer-FOVFGJQR.mjs.map +0 -7
- package/dist/lib/node-esm/ScriptContainer-EW24D5II.mjs +0 -149
- package/dist/lib/node-esm/ScriptContainer-EW24D5II.mjs.map +0 -7
- package/dist/lib/node-esm/app-graph-builder-XJ3MY5BM.mjs +0 -67
- package/dist/lib/node-esm/app-graph-builder-XJ3MY5BM.mjs.map +0 -7
- package/dist/lib/node-esm/blueprint-definition-5R6YCSZZ.mjs +0 -31
- package/dist/lib/node-esm/blueprint-definition-5R6YCSZZ.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-2GVTWESW.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-55JZVM6K.mjs +0 -16
- package/dist/lib/node-esm/chunk-55JZVM6K.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-EJLYOSD7.mjs +0 -113
- package/dist/lib/node-esm/chunk-EJLYOSD7.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-GA27XSEY.mjs +0 -270
- package/dist/lib/node-esm/chunk-GA27XSEY.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-IBV2DR36.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-N2XLVOFB.mjs +0 -103
- package/dist/lib/node-esm/chunk-N2XLVOFB.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-O7HXE72S.mjs +0 -256
- package/dist/lib/node-esm/chunk-O7HXE72S.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-OZ6LCME4.mjs +0 -645
- package/dist/lib/node-esm/chunk-OZ6LCME4.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-TUGLYZDT.mjs +0 -305
- package/dist/lib/node-esm/chunk-TUGLYZDT.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-UEGPBCSF.mjs +0 -154
- package/dist/lib/node-esm/chunk-UEGPBCSF.mjs.map +0 -7
- package/dist/lib/node-esm/compiler-I6A4KE6E.mjs +0 -87
- package/dist/lib/node-esm/compiler-I6A4KE6E.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-YKLZQR7U.mjs +0 -106
- package/dist/lib/node-esm/intent-resolver-YKLZQR7U.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-LVGLBSTE.mjs.map +0 -7
- package/dist/lib/node-esm/settings-O4EZPUE3.mjs +0 -27
- package/dist/lib/node-esm/settings-O4EZPUE3.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/src/capabilities/app-graph-builder.ts +0 -65
- package/src/capabilities/blueprint-definition.ts +0 -30
- package/src/capabilities/capabilities.ts +0 -12
- package/src/capabilities/compiler.ts +0 -34
- package/src/capabilities/intent-resolver.ts +0 -86
- package/src/capabilities/react-surface.tsx +0 -102
- package/src/capabilities/settings.ts +0 -21
- package/src/events.ts +0 -11
- package/src/templates/chess.ts +0 -49
- /package/dist/lib/browser/{DeploymentDialog-E5NXT4UQ.mjs.map → DeploymentDialog-OSL6RMPA.mjs.map} +0 -0
- /package/dist/lib/{node-esm/DeploymentDialog-OSHHSEBH.mjs.map → browser/blueprints/index.mjs.map} +0 -0
|
@@ -2,33 +2,27 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
+
import { RegistryContext } from '@effect-atom/atom-react';
|
|
5
6
|
import * as Cause from 'effect/Cause';
|
|
6
7
|
import * as Effect from 'effect/Effect';
|
|
7
8
|
import * as Exit from 'effect/Exit';
|
|
8
|
-
import * as
|
|
9
|
-
import React, { useCallback, useMemo, useState } from 'react';
|
|
9
|
+
import type * as Types from 'effect/Types';
|
|
10
|
+
import React, { useCallback, useContext, useMemo, useState } from 'react';
|
|
10
11
|
|
|
12
|
+
import { type SurfaceComponentProps } from '@dxos/app-framework/react';
|
|
11
13
|
import { Agent } from '@dxos/assistant-toolkit';
|
|
12
14
|
import { Blueprint, Prompt } from '@dxos/blueprints';
|
|
13
15
|
import { Filter, Obj, Query, Ref } from '@dxos/echo';
|
|
14
16
|
import { QueryBuilder } from '@dxos/echo-query';
|
|
15
|
-
import {
|
|
16
|
-
ComputeEventLogger,
|
|
17
|
-
type FunctionDefinition,
|
|
18
|
-
FunctionInvocationService,
|
|
19
|
-
InvocationTracer,
|
|
20
|
-
TracingService,
|
|
21
|
-
} from '@dxos/functions';
|
|
17
|
+
import { type FunctionDefinition, FunctionInvocationService, TracingService } from '@dxos/functions';
|
|
22
18
|
import { invariant } from '@dxos/invariant';
|
|
23
19
|
import { log } from '@dxos/log';
|
|
24
20
|
import { useComputeRuntimeCallback } from '@dxos/plugin-automation';
|
|
25
21
|
import { Graph } from '@dxos/plugin-explorer/types';
|
|
26
|
-
import { fullyQualifiedId } from '@dxos/react-client/echo';
|
|
27
|
-
import { getSpace } from '@dxos/react-client/echo';
|
|
28
22
|
import { DropdownMenu, IconButton, Toolbar, useTranslation } from '@dxos/react-ui';
|
|
29
23
|
import { useAttention } from '@dxos/react-ui-attention';
|
|
30
|
-
import {
|
|
31
|
-
import {
|
|
24
|
+
import { Layout } from '@dxos/react-ui-mosaic';
|
|
25
|
+
import { Text, View } from '@dxos/schema';
|
|
32
26
|
import { isNonNullable } from '@dxos/util';
|
|
33
27
|
|
|
34
28
|
import { meta } from '../meta';
|
|
@@ -42,24 +36,22 @@ const INCLUDE_BLUEPRINTS = ['dxos.org/blueprint/assistant', 'dxos.org/blueprint/
|
|
|
42
36
|
|
|
43
37
|
// TODO(burdon): Support calling named deployed functions (as with sheet).
|
|
44
38
|
|
|
45
|
-
export type NotebookContainerProps =
|
|
46
|
-
role?: string;
|
|
47
|
-
notebook?: Notebook.Notebook;
|
|
48
|
-
} & Pick<TypescriptEditorProps, 'env'>;
|
|
39
|
+
export type NotebookContainerProps = SurfaceComponentProps<Notebook.Notebook, Pick<TypescriptEditorProps, 'env'>>;
|
|
49
40
|
|
|
50
|
-
export const NotebookContainer = ({ notebook, env }: NotebookContainerProps) => {
|
|
41
|
+
export const NotebookContainer = ({ role, subject: notebook, env }: NotebookContainerProps) => {
|
|
51
42
|
const { t } = useTranslation(meta.id);
|
|
52
|
-
const
|
|
53
|
-
const
|
|
43
|
+
const registry = useContext(RegistryContext);
|
|
44
|
+
const db = notebook && Obj.getDatabase(notebook);
|
|
45
|
+
const attendableId = notebook ? Obj.getDXN(notebook).toString() : '';
|
|
54
46
|
const { hasAttention } = useAttention(attendableId);
|
|
55
47
|
|
|
56
48
|
// TODO(burdon): Consolidate execution and state (with graph).
|
|
57
49
|
// Generalize ComputeGraph evaluation function (using effects).
|
|
58
|
-
const graph = useMemo(() => notebook && new ComputeGraph(notebook), [notebook]);
|
|
50
|
+
const graph = useMemo(() => notebook && new ComputeGraph(notebook, registry), [notebook, registry]);
|
|
59
51
|
|
|
60
52
|
const [queryValues, setQueryValues] = useState<Record<string, any>>({});
|
|
61
53
|
const handleExecQueries = useCallback(async () => {
|
|
62
|
-
invariant(
|
|
54
|
+
invariant(db);
|
|
63
55
|
|
|
64
56
|
const builder = new QueryBuilder();
|
|
65
57
|
for (const cell of notebook?.cells ?? []) {
|
|
@@ -69,32 +61,39 @@ export const NotebookContainer = ({ notebook, env }: NotebookContainerProps) =>
|
|
|
69
61
|
const { name, filter } = builder.build(source);
|
|
70
62
|
if (filter) {
|
|
71
63
|
const ast = Query.select(filter).ast;
|
|
72
|
-
const
|
|
73
|
-
if (!
|
|
74
|
-
const
|
|
75
|
-
const
|
|
76
|
-
|
|
77
|
-
|
|
64
|
+
const graph = cell.graph?.target;
|
|
65
|
+
if (!graph) {
|
|
66
|
+
const { view } = await View.makeFromDatabase({ db });
|
|
67
|
+
const newGraph = Graph.make({ query: { ast }, view });
|
|
68
|
+
Obj.change(notebook!, (n) => {
|
|
69
|
+
const c = n.cells.find((c) => c.id === cell.id);
|
|
70
|
+
if (c) {
|
|
71
|
+
c.graph = Ref.make(newGraph);
|
|
72
|
+
c.name = name;
|
|
73
|
+
}
|
|
74
|
+
});
|
|
78
75
|
} else {
|
|
79
|
-
|
|
76
|
+
Obj.change(graph, (g) => {
|
|
77
|
+
g.query.ast = ast as Obj.Mutable<typeof ast>;
|
|
78
|
+
});
|
|
80
79
|
}
|
|
81
80
|
}
|
|
82
81
|
}
|
|
83
82
|
|
|
84
|
-
if (cell.name && cell.
|
|
85
|
-
const
|
|
86
|
-
const query = Query.fromAst(
|
|
87
|
-
const
|
|
88
|
-
const objectIds =
|
|
83
|
+
if (cell.name && cell.graph?.target) {
|
|
84
|
+
const graph = Obj.getSnapshot(cell.graph?.target);
|
|
85
|
+
const query = Query.fromAst(graph.query.ast);
|
|
86
|
+
const objects = await db.query(query).run();
|
|
87
|
+
const objectIds = objects?.map((obj) => obj.id);
|
|
89
88
|
setQueryValues((prev) => ({ ...prev, [cell.name!]: objectIds }));
|
|
90
89
|
}
|
|
91
90
|
}
|
|
92
91
|
}
|
|
93
|
-
}, [
|
|
92
|
+
}, [db, notebook, graph]);
|
|
94
93
|
|
|
95
94
|
const [promptResults, setPromptResults] = useState<Record<string, string>>({});
|
|
96
95
|
const handleExecPrompts = useComputeRuntimeCallback(
|
|
97
|
-
|
|
96
|
+
db?.spaceId,
|
|
98
97
|
Effect.fnUntraced(function* () {
|
|
99
98
|
invariant(graph);
|
|
100
99
|
|
|
@@ -107,8 +106,12 @@ export const NotebookContainer = ({ notebook, env }: NotebookContainerProps) =>
|
|
|
107
106
|
for (const prompt of prompts) {
|
|
108
107
|
yield* runPrompt({
|
|
109
108
|
prompt,
|
|
110
|
-
input: { ...queryValues, ...graph.
|
|
111
|
-
onResult: (result) =>
|
|
109
|
+
input: { ...queryValues, ...graph.getValuesByName() },
|
|
110
|
+
onResult: (result) =>
|
|
111
|
+
setPromptResults((prev) => ({
|
|
112
|
+
...prev,
|
|
113
|
+
[prompt.dxn.toString()]: result,
|
|
114
|
+
})),
|
|
112
115
|
});
|
|
113
116
|
}
|
|
114
117
|
}),
|
|
@@ -129,10 +132,12 @@ export const NotebookContainer = ({ notebook, env }: NotebookContainerProps) =>
|
|
|
129
132
|
const from = notebook.cells.findIndex((cell) => cell.id === source.id);
|
|
130
133
|
const to = notebook.cells.findIndex((cell) => cell.id === target.id);
|
|
131
134
|
if (from != null && to != null) {
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
135
|
+
Obj.change(notebook, (n) => {
|
|
136
|
+
const cell = n.cells.splice(from, 1)[0];
|
|
137
|
+
if (cell) {
|
|
138
|
+
n.cells.splice(to, 0, cell);
|
|
139
|
+
}
|
|
140
|
+
});
|
|
136
141
|
}
|
|
137
142
|
},
|
|
138
143
|
[notebook],
|
|
@@ -141,19 +146,19 @@ export const NotebookContainer = ({ notebook, env }: NotebookContainerProps) =>
|
|
|
141
146
|
const handleCellInsert = useCallback<NonNullable<NotebookStackProps['onCellInsert']>>(
|
|
142
147
|
async (type, after) => {
|
|
143
148
|
invariant(notebook);
|
|
144
|
-
const cell: Notebook.Cell = { id: crypto.randomUUID(), type };
|
|
149
|
+
const cell: Types.Mutable<Notebook.Cell> = { id: crypto.randomUUID(), type };
|
|
145
150
|
switch (type) {
|
|
146
151
|
case 'markdown':
|
|
147
152
|
case 'script':
|
|
148
153
|
case 'query': {
|
|
149
|
-
cell.source = Ref.make(
|
|
154
|
+
cell.source = Ref.make(Text.make());
|
|
150
155
|
break;
|
|
151
156
|
}
|
|
152
157
|
|
|
153
158
|
case 'prompt': {
|
|
154
|
-
if (
|
|
155
|
-
const
|
|
156
|
-
const blueprints =
|
|
159
|
+
if (db) {
|
|
160
|
+
const objects = await db.query(Query.select(Filter.type(Blueprint.Blueprint))).run();
|
|
161
|
+
const blueprints = objects
|
|
157
162
|
.filter((blueprint) => INCLUDE_BLUEPRINTS.includes(blueprint.key))
|
|
158
163
|
.map((blueprint) => Ref.make(blueprint));
|
|
159
164
|
cell.prompt = Ref.make(Prompt.make({ instructions: '', blueprints }));
|
|
@@ -163,9 +168,11 @@ export const NotebookContainer = ({ notebook, env }: NotebookContainerProps) =>
|
|
|
163
168
|
}
|
|
164
169
|
|
|
165
170
|
const idx = after ? notebook.cells.findIndex((cell) => cell.id === after) : notebook.cells.length;
|
|
166
|
-
|
|
171
|
+
Obj.change(notebook, (n) => {
|
|
172
|
+
n.cells.splice(idx, 0, cell);
|
|
173
|
+
});
|
|
167
174
|
},
|
|
168
|
-
[
|
|
175
|
+
[db, notebook],
|
|
169
176
|
);
|
|
170
177
|
|
|
171
178
|
const handleCellDelete = useCallback<NonNullable<NotebookStackProps['onCellDelete']>>(
|
|
@@ -173,14 +180,16 @@ export const NotebookContainer = ({ notebook, env }: NotebookContainerProps) =>
|
|
|
173
180
|
invariant(notebook);
|
|
174
181
|
const idx = notebook.cells.findIndex((cell) => cell.id === id);
|
|
175
182
|
if (idx !== -1) {
|
|
176
|
-
|
|
183
|
+
Obj.change(notebook, (n) => {
|
|
184
|
+
n.cells.splice(idx, 1);
|
|
185
|
+
});
|
|
177
186
|
}
|
|
178
187
|
},
|
|
179
188
|
[notebook],
|
|
180
189
|
);
|
|
181
190
|
|
|
182
191
|
return (
|
|
183
|
-
<
|
|
192
|
+
<Layout.Main role={role} toolbar>
|
|
184
193
|
<Toolbar.Root disabled={!hasAttention} textBlockWidth>
|
|
185
194
|
<DropdownMenu.Root>
|
|
186
195
|
<DropdownMenu.Trigger asChild>
|
|
@@ -199,7 +208,7 @@ export const NotebookContainer = ({ notebook, env }: NotebookContainerProps) =>
|
|
|
199
208
|
<div role='none' className='flex bs-full overflow-hidden -mis-[1px] -mie-[1px]'>
|
|
200
209
|
<NotebookStack
|
|
201
210
|
classNames='container-max-width border-l border-r border-subduedSeparator'
|
|
202
|
-
|
|
211
|
+
db={db}
|
|
203
212
|
notebook={notebook}
|
|
204
213
|
graph={graph}
|
|
205
214
|
env={env}
|
|
@@ -209,13 +218,13 @@ export const NotebookContainer = ({ notebook, env }: NotebookContainerProps) =>
|
|
|
209
218
|
onCellDelete={handleCellDelete}
|
|
210
219
|
/>
|
|
211
220
|
</div>
|
|
212
|
-
</
|
|
221
|
+
</Layout.Main>
|
|
213
222
|
);
|
|
214
223
|
};
|
|
215
224
|
|
|
216
225
|
export default NotebookContainer;
|
|
217
226
|
|
|
218
|
-
// TODO(wittjosiah): Factor out. Copied from
|
|
227
|
+
// TODO(wittjosiah): Factor out. Copied from PromptArticle in plugin-assistant.
|
|
219
228
|
const runPrompt = Effect.fn(function* ({
|
|
220
229
|
prompt,
|
|
221
230
|
input,
|
|
@@ -225,8 +234,11 @@ const runPrompt = Effect.fn(function* ({
|
|
|
225
234
|
input: Record<string, any>;
|
|
226
235
|
onResult: (result: string) => void;
|
|
227
236
|
}) {
|
|
228
|
-
const inputData: FunctionDefinition.Input<typeof Agent.prompt> = {
|
|
229
|
-
|
|
237
|
+
const inputData: FunctionDefinition.Input<typeof Agent.prompt> = {
|
|
238
|
+
prompt,
|
|
239
|
+
input,
|
|
240
|
+
};
|
|
241
|
+
const tracer = yield* TracingService;
|
|
230
242
|
const trace = yield* tracer.traceInvocationStart({
|
|
231
243
|
target: undefined,
|
|
232
244
|
payload: {
|
|
@@ -236,11 +248,7 @@ const runPrompt = Effect.fn(function* ({
|
|
|
236
248
|
|
|
237
249
|
// Invoke the function.
|
|
238
250
|
const result = yield* FunctionInvocationService.invokeFunction(Agent.prompt, inputData).pipe(
|
|
239
|
-
Effect.provide(
|
|
240
|
-
ComputeEventLogger.layerFromTracing.pipe(
|
|
241
|
-
Layer.provideMerge(TracingService.layerQueue(trace.invocationTraceQueue)),
|
|
242
|
-
),
|
|
243
|
-
),
|
|
251
|
+
Effect.provide(trace.invocationTraceQueue ? TracingService.layerInvocation(trace) : TracingService.layerNoop),
|
|
244
252
|
Effect.exit,
|
|
245
253
|
);
|
|
246
254
|
|
|
@@ -4,24 +4,23 @@
|
|
|
4
4
|
|
|
5
5
|
import React, { useCallback, useMemo } from 'react';
|
|
6
6
|
|
|
7
|
-
import { Surface } from '@dxos/app-framework';
|
|
7
|
+
import { Surface } from '@dxos/app-framework/react';
|
|
8
|
+
import { type Database, Obj } from '@dxos/echo';
|
|
9
|
+
import { createDocAccessor } from '@dxos/echo-db';
|
|
8
10
|
import { invariant } from '@dxos/invariant';
|
|
9
11
|
import { TemplateEditor } from '@dxos/plugin-assistant';
|
|
10
|
-
import { createDocAccessor } from '@dxos/react-client/echo';
|
|
11
|
-
import { type Space } from '@dxos/react-client/echo';
|
|
12
12
|
import { useThemeContext, useTranslation } from '@dxos/react-ui';
|
|
13
13
|
import { QueryEditor, type QueryEditorProps } from '@dxos/react-ui-components';
|
|
14
|
+
import { EditorContent, type EditorContentProps } from '@dxos/react-ui-editor';
|
|
14
15
|
import {
|
|
15
16
|
type BasicExtensionsOptions,
|
|
16
|
-
Editor,
|
|
17
|
-
type EditorProps,
|
|
18
17
|
createBasicExtensions,
|
|
19
18
|
createDataExtensions,
|
|
20
19
|
createMarkdownExtensions,
|
|
21
20
|
createThemeExtensions,
|
|
22
21
|
decorateMarkdown,
|
|
23
|
-
} from '@dxos/
|
|
24
|
-
import { mx } from '@dxos/
|
|
22
|
+
} from '@dxos/ui-editor';
|
|
23
|
+
import { mx } from '@dxos/ui-theme';
|
|
25
24
|
import { isNonNullable } from '@dxos/util';
|
|
26
25
|
|
|
27
26
|
import { meta } from '../../meta';
|
|
@@ -35,7 +34,7 @@ const editorStyles = 'p-2 pis-3';
|
|
|
35
34
|
const valueStyles = 'p-1 pis-3';
|
|
36
35
|
|
|
37
36
|
export type NotebookCellProps = {
|
|
38
|
-
|
|
37
|
+
db?: Database.Database;
|
|
39
38
|
graph?: ComputeGraph;
|
|
40
39
|
dragging?: boolean;
|
|
41
40
|
cell: Notebook.Cell;
|
|
@@ -43,23 +42,28 @@ export type NotebookCellProps = {
|
|
|
43
42
|
} & (Pick<NotebookMenuProps, 'onCellInsert' | 'onCellDelete'> & Pick<TypescriptEditorProps, 'env'>);
|
|
44
43
|
|
|
45
44
|
// TODO(burdon): Show evaluation errors.
|
|
46
|
-
export const NotebookCell = ({
|
|
45
|
+
export const NotebookCell = ({ db, graph, dragging, cell, promptResults, env }: NotebookCellProps) => {
|
|
47
46
|
const { t } = useTranslation(meta.id);
|
|
48
47
|
|
|
49
48
|
const extensions = useMemo(() => {
|
|
50
49
|
return cell.source?.target
|
|
51
|
-
? [
|
|
52
|
-
|
|
53
|
-
|
|
50
|
+
? [
|
|
51
|
+
createDataExtensions({
|
|
52
|
+
id: cell.id,
|
|
53
|
+
text: createDocAccessor(cell.source.target, ['content']),
|
|
54
|
+
}),
|
|
55
|
+
].filter(isNonNullable)
|
|
54
56
|
: [];
|
|
55
57
|
}, [cell.source?.target]);
|
|
56
58
|
|
|
57
|
-
const
|
|
59
|
+
const explorerGraph = cell.graph?.target;
|
|
58
60
|
|
|
59
61
|
const handleQueryChange = useCallback<NonNullable<QueryEditorProps['onChange']>>(
|
|
60
62
|
(value: string) => {
|
|
61
63
|
invariant(cell.source?.target);
|
|
62
|
-
cell.source.target
|
|
64
|
+
Obj.change(cell.source.target, (s) => {
|
|
65
|
+
s.content = value;
|
|
66
|
+
});
|
|
63
67
|
},
|
|
64
68
|
[cell],
|
|
65
69
|
);
|
|
@@ -110,15 +114,17 @@ export const NotebookCell = ({ space, graph, dragging, cell, promptResults, env
|
|
|
110
114
|
|
|
111
115
|
// TODO(burdon): Remove app-framework deps (via render prop).
|
|
112
116
|
return (
|
|
113
|
-
<div
|
|
117
|
+
<div
|
|
118
|
+
className={mx('bs-full overflow-hidden grid', explorerGraph && !dragging && 'grid-rows-[min-content_1fr]')}
|
|
119
|
+
>
|
|
114
120
|
<QueryEditor
|
|
115
121
|
id={cell.id}
|
|
116
|
-
classNames={[editorStyles, 'border-
|
|
117
|
-
db={
|
|
122
|
+
classNames={[editorStyles, 'border-be border-subduedSeparator']}
|
|
123
|
+
db={db}
|
|
118
124
|
value={cell.source.target.content}
|
|
119
125
|
onChange={handleQueryChange}
|
|
120
126
|
/>
|
|
121
|
-
{
|
|
127
|
+
{explorerGraph && !dragging && <Surface role='section' limit={1} data={{ subject: explorerGraph }} />}
|
|
122
128
|
</div>
|
|
123
129
|
);
|
|
124
130
|
|
|
@@ -146,7 +152,7 @@ export const NotebookCell = ({ space, graph, dragging, cell, promptResults, env
|
|
|
146
152
|
};
|
|
147
153
|
|
|
148
154
|
const NotebookCellValue = ({ cell, graph }: NotebookCellProps) => {
|
|
149
|
-
const name = graph?.
|
|
155
|
+
const name = graph?.getExpressions()[cell.id]?.name;
|
|
150
156
|
const value = graph?.getValue(cell.id);
|
|
151
157
|
if (value == null) {
|
|
152
158
|
return null;
|
|
@@ -155,7 +161,7 @@ const NotebookCellValue = ({ cell, graph }: NotebookCellProps) => {
|
|
|
155
161
|
return (
|
|
156
162
|
<div
|
|
157
163
|
className={mx(
|
|
158
|
-
'flex is-full bg-groupSurface border-
|
|
164
|
+
'flex is-full bg-groupSurface border-bs border-subduedSeparator text-description font-mono',
|
|
159
165
|
valueStyles,
|
|
160
166
|
)}
|
|
161
167
|
>
|
|
@@ -181,28 +187,31 @@ const NotebookPromptResult = ({ cell, promptResults }: NotebookCellProps) => {
|
|
|
181
187
|
}
|
|
182
188
|
|
|
183
189
|
return (
|
|
184
|
-
<div className={mx('flex is-full bg-groupSurface text-description border-
|
|
190
|
+
<div className={mx('flex is-full bg-groupSurface text-description border-bs border-subduedSeparator', valueStyles)}>
|
|
185
191
|
<NotebookTextEditor readOnly value={value} />
|
|
186
192
|
</div>
|
|
187
193
|
);
|
|
188
194
|
};
|
|
189
195
|
|
|
190
196
|
const NotebookTextEditor = ({
|
|
191
|
-
extensions:
|
|
197
|
+
extensions: extensionsProp,
|
|
192
198
|
readOnly,
|
|
193
199
|
...props
|
|
194
|
-
}:
|
|
200
|
+
}: EditorContentProps & Pick<BasicExtensionsOptions, 'readOnly'>) => {
|
|
195
201
|
const { t } = useTranslation(meta.id);
|
|
196
202
|
const { themeMode } = useThemeContext();
|
|
197
203
|
const extensions = useMemo(() => {
|
|
198
204
|
return [
|
|
199
|
-
createBasicExtensions({
|
|
205
|
+
createBasicExtensions({
|
|
206
|
+
placeholder: t('notebook markdown placeholder'),
|
|
207
|
+
readOnly,
|
|
208
|
+
}),
|
|
200
209
|
createThemeExtensions({ themeMode, syntaxHighlighting: true }),
|
|
201
210
|
createMarkdownExtensions(),
|
|
202
211
|
decorateMarkdown(),
|
|
203
|
-
|
|
212
|
+
extensionsProp,
|
|
204
213
|
].filter(isNonNullable);
|
|
205
|
-
}, [
|
|
214
|
+
}, [extensionsProp]);
|
|
206
215
|
|
|
207
|
-
return <
|
|
216
|
+
return <EditorContent {...props} extensions={extensions} selectionEnd />;
|
|
208
217
|
};
|
|
@@ -3,12 +3,13 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
6
|
+
import * as Effect from 'effect/Effect';
|
|
7
|
+
import React, { useMemo } from 'react';
|
|
6
8
|
|
|
7
|
-
import { IntentPlugin, SettingsPlugin } from '@dxos/app-framework';
|
|
8
9
|
import { withPluginManager } from '@dxos/app-framework/testing';
|
|
9
10
|
import { AutomationPlugin } from '@dxos/plugin-automation';
|
|
10
11
|
import { ClientPlugin } from '@dxos/plugin-client';
|
|
11
|
-
import {
|
|
12
|
+
import { corePlugins } from '@dxos/plugin-testing';
|
|
12
13
|
import { withLayout, withTheme } from '@dxos/react-ui/testing';
|
|
13
14
|
|
|
14
15
|
import { createNotebook } from '../../testing';
|
|
@@ -16,24 +17,28 @@ import { translations } from '../../translations';
|
|
|
16
17
|
|
|
17
18
|
import { NotebookStack } from './NotebookStack';
|
|
18
19
|
|
|
20
|
+
// TODO(wittjosiah): ECHO objects don't work when passed via Storybook args.
|
|
21
|
+
const NotebookStackStory = () => {
|
|
22
|
+
const notebook = useMemo(() => createNotebook(), []);
|
|
23
|
+
return <NotebookStack notebook={notebook} />;
|
|
24
|
+
};
|
|
25
|
+
|
|
19
26
|
const meta = {
|
|
20
27
|
title: 'plugins/plugin-script/NotebookStack',
|
|
21
|
-
component:
|
|
28
|
+
component: NotebookStackStory,
|
|
22
29
|
decorators: [
|
|
23
30
|
withTheme,
|
|
24
|
-
withLayout({
|
|
25
|
-
// TODO(burdon): Factor out Surface to avoid dependency on app-framework.
|
|
31
|
+
withLayout({ layout: 'column', classNames: 'is-proseMaxWidth' }),
|
|
26
32
|
withPluginManager({
|
|
27
33
|
plugins: [
|
|
34
|
+
...corePlugins(),
|
|
28
35
|
ClientPlugin({
|
|
29
|
-
onClientInitialized:
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
36
|
+
onClientInitialized: ({ client }) =>
|
|
37
|
+
Effect.gen(function* () {
|
|
38
|
+
yield* Effect.promise(() => client.halo.createIdentity());
|
|
39
|
+
yield* Effect.promise(() => client.spaces.waitUntilReady());
|
|
40
|
+
}),
|
|
33
41
|
}),
|
|
34
|
-
SpacePlugin({}),
|
|
35
|
-
SettingsPlugin(),
|
|
36
|
-
IntentPlugin(),
|
|
37
42
|
AutomationPlugin(),
|
|
38
43
|
],
|
|
39
44
|
}),
|
|
@@ -41,14 +46,10 @@ const meta = {
|
|
|
41
46
|
parameters: {
|
|
42
47
|
translations,
|
|
43
48
|
},
|
|
44
|
-
} satisfies Meta<typeof
|
|
49
|
+
} satisfies Meta<typeof NotebookStackStory>;
|
|
45
50
|
|
|
46
51
|
export default meta;
|
|
47
52
|
|
|
48
53
|
type Story = StoryObj<typeof meta>;
|
|
49
54
|
|
|
50
|
-
export const Default: Story = {
|
|
51
|
-
args: {
|
|
52
|
-
notebook: createNotebook(),
|
|
53
|
-
},
|
|
54
|
-
};
|
|
55
|
+
export const Default: Story = {};
|
|
@@ -20,7 +20,7 @@ export type NotebookStackProps = ThemedClassName<
|
|
|
20
20
|
{
|
|
21
21
|
notebook?: Notebook.Notebook;
|
|
22
22
|
onRearrange?: StackProps['onRearrange'];
|
|
23
|
-
} & (Pick<NotebookSectionProps, '
|
|
23
|
+
} & (Pick<NotebookSectionProps, 'db' | 'graph' | 'promptResults' | 'onCellInsert' | 'onCellDelete'> &
|
|
24
24
|
Pick<TypescriptEditorProps, 'env'>)
|
|
25
25
|
>;
|
|
26
26
|
|
|
@@ -39,7 +39,7 @@ type NotebookSectionProps = NotebookCellProps;
|
|
|
39
39
|
|
|
40
40
|
const NotebookSection = ({
|
|
41
41
|
cell,
|
|
42
|
-
|
|
42
|
+
db,
|
|
43
43
|
env,
|
|
44
44
|
promptResults,
|
|
45
45
|
onCellInsert,
|
|
@@ -73,13 +73,13 @@ const NotebookSection = ({
|
|
|
73
73
|
<StackItem.DragPreview>
|
|
74
74
|
{({ item: cell }) => (
|
|
75
75
|
<StackItem.Content classNames='overflow-visible bg-groupSurface border border-subduedSeparator'>
|
|
76
|
-
<NotebookCell
|
|
76
|
+
<NotebookCell db={db} cell={cell} env={env} dragging />
|
|
77
77
|
</StackItem.Content>
|
|
78
78
|
)}
|
|
79
79
|
</StackItem.DragPreview>
|
|
80
80
|
|
|
81
81
|
<StackItem.Content classNames='overflow-visible'>
|
|
82
|
-
<NotebookCell
|
|
82
|
+
<NotebookCell db={db} cell={cell} env={env} promptResults={promptResults} {...props} />
|
|
83
83
|
</StackItem.Content>
|
|
84
84
|
</StackItem.Root>
|
|
85
85
|
);
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2023 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
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 { QuerySandbox } from '@dxos/echo-query';
|
|
10
|
+
import { createObject } from '@dxos/react-client/echo';
|
|
11
|
+
import { Toolbar, useAsyncEffect } from '@dxos/react-ui';
|
|
12
|
+
import { withLayout, withTheme } from '@dxos/react-ui/testing';
|
|
13
|
+
import { Layout } from '@dxos/react-ui-mosaic';
|
|
14
|
+
import { Json } from '@dxos/react-ui-syntax-highlighter';
|
|
15
|
+
import { createDataExtensions } from '@dxos/ui-editor';
|
|
16
|
+
import { trim } from '@dxos/util';
|
|
17
|
+
|
|
18
|
+
import { QueryEditor, type QueryEditorProps } from './QueryEditor';
|
|
19
|
+
|
|
20
|
+
const SCRIPT = trim`
|
|
21
|
+
Query.select(Filter.type('dxos.org/type/Person'))
|
|
22
|
+
`;
|
|
23
|
+
|
|
24
|
+
const DefaultStory = (props: QueryEditorProps) => {
|
|
25
|
+
const object = useMemo(() => createObject({ content: SCRIPT }), []);
|
|
26
|
+
const [result, setResult] = useState<object | undefined>({});
|
|
27
|
+
const [sandbox, setSandbox] = useState<QuerySandbox>();
|
|
28
|
+
|
|
29
|
+
useAsyncEffect(async () => {
|
|
30
|
+
const sandbox = new QuerySandbox();
|
|
31
|
+
await sandbox.open();
|
|
32
|
+
setSandbox(sandbox);
|
|
33
|
+
|
|
34
|
+
return () => {
|
|
35
|
+
void sandbox.close();
|
|
36
|
+
};
|
|
37
|
+
}, []);
|
|
38
|
+
|
|
39
|
+
const extensions = useMemo(
|
|
40
|
+
() => [
|
|
41
|
+
createDataExtensions({
|
|
42
|
+
id: object.id,
|
|
43
|
+
text: createDocAccessor(object, ['content']),
|
|
44
|
+
}),
|
|
45
|
+
],
|
|
46
|
+
[],
|
|
47
|
+
);
|
|
48
|
+
|
|
49
|
+
const handleRun = useCallback(async () => {
|
|
50
|
+
try {
|
|
51
|
+
const result = sandbox?.eval(object.content);
|
|
52
|
+
|
|
53
|
+
setResult({
|
|
54
|
+
timestamp: Date.now(),
|
|
55
|
+
result,
|
|
56
|
+
});
|
|
57
|
+
} catch (err) {
|
|
58
|
+
setResult({
|
|
59
|
+
timestamp: Date.now(),
|
|
60
|
+
error: String(err),
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
}, [object, sandbox]);
|
|
64
|
+
|
|
65
|
+
return (
|
|
66
|
+
<Layout.Main toolbar>
|
|
67
|
+
{/* <ScriptToolbar script={script} state={{}} /> */}
|
|
68
|
+
<Toolbar.Root>
|
|
69
|
+
<Toolbar.Button onClick={handleRun}>Run</Toolbar.Button>
|
|
70
|
+
</Toolbar.Root>
|
|
71
|
+
<div role='none' className='grid grid-rows-[1fr_min-content] bs-full overflow-hidden text-sm'>
|
|
72
|
+
<QueryEditor {...props} initialValue={object.content} extensions={extensions} />
|
|
73
|
+
<Json data={result} classNames='shrink-0 p-2 border-bs border-subduedSeparator' />
|
|
74
|
+
</div>
|
|
75
|
+
</Layout.Main>
|
|
76
|
+
);
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
const meta = {
|
|
80
|
+
title: 'plugins/plugin-script/QueryEditor',
|
|
81
|
+
component: QueryEditor,
|
|
82
|
+
render: DefaultStory,
|
|
83
|
+
decorators: [
|
|
84
|
+
withTheme,
|
|
85
|
+
withLayout({
|
|
86
|
+
layout: 'column',
|
|
87
|
+
classNames: 'is-proseMaxWidth',
|
|
88
|
+
}),
|
|
89
|
+
],
|
|
90
|
+
} satisfies Meta<typeof DefaultStory>;
|
|
91
|
+
|
|
92
|
+
export default meta;
|
|
93
|
+
|
|
94
|
+
type Story = StoryObj<typeof meta>;
|
|
95
|
+
|
|
96
|
+
export const Default: Story = {
|
|
97
|
+
args: {
|
|
98
|
+
id: 'test',
|
|
99
|
+
},
|
|
100
|
+
};
|
|
@@ -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
|
+
};
|