@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
|
@@ -4,11 +4,14 @@
|
|
|
4
4
|
|
|
5
5
|
import React, { useMemo } from 'react';
|
|
6
6
|
|
|
7
|
+
import { type SurfaceComponentProps } from '@dxos/app-framework/react';
|
|
8
|
+
import { Obj } from '@dxos/echo';
|
|
9
|
+
import { createDocAccessor } from '@dxos/echo-db';
|
|
7
10
|
import { type Script } from '@dxos/functions';
|
|
8
|
-
import {
|
|
11
|
+
import { getSpace } from '@dxos/react-client/echo';
|
|
9
12
|
import { useIdentity } from '@dxos/react-client/halo';
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
13
|
+
import { Layout } from '@dxos/react-ui-mosaic';
|
|
14
|
+
import { createDataExtensions, listener, stackItemContentEditorClassNames } from '@dxos/ui-editor';
|
|
12
15
|
|
|
13
16
|
import { useDeployState, useToolbarState } from '../hooks';
|
|
14
17
|
import { type ScriptSettings } from '../types';
|
|
@@ -16,42 +19,54 @@ import { type ScriptSettings } from '../types';
|
|
|
16
19
|
import { ScriptToolbar } from './ScriptToolbar';
|
|
17
20
|
import { TypescriptEditor, type TypescriptEditorProps } from './TypescriptEditor';
|
|
18
21
|
|
|
19
|
-
export type ScriptEditorProps =
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
} & Pick<TypescriptEditorProps, 'env'
|
|
22
|
+
export type ScriptEditorProps = SurfaceComponentProps<
|
|
23
|
+
Script.Script,
|
|
24
|
+
{
|
|
25
|
+
settings?: ScriptSettings;
|
|
26
|
+
} & Pick<TypescriptEditorProps, 'env'>
|
|
27
|
+
>;
|
|
24
28
|
|
|
25
|
-
export const ScriptContainer = ({
|
|
29
|
+
export const ScriptContainer = ({
|
|
30
|
+
role,
|
|
31
|
+
subject: script,
|
|
32
|
+
settings = { editorInputMode: 'vscode' },
|
|
33
|
+
env,
|
|
34
|
+
}: ScriptEditorProps) => {
|
|
26
35
|
const identity = useIdentity();
|
|
27
36
|
const space = getSpace(script);
|
|
28
37
|
const state = useToolbarState();
|
|
29
|
-
useDeployState({
|
|
38
|
+
useDeployState({ script, state });
|
|
30
39
|
|
|
31
|
-
const extensions = useMemo(
|
|
32
|
-
()
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
40
|
+
const extensions = useMemo(() => {
|
|
41
|
+
if (!script.source.target) {
|
|
42
|
+
return [];
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
return [
|
|
46
|
+
createDataExtensions({
|
|
47
|
+
id: script.id,
|
|
48
|
+
text: createDocAccessor(script.source.target, ['content']),
|
|
49
|
+
messenger: space,
|
|
50
|
+
identity,
|
|
51
|
+
}),
|
|
52
|
+
listener({
|
|
53
|
+
onChange: ({ text }) => {
|
|
54
|
+
if (script.source.target?.content !== text) {
|
|
55
|
+
Obj.change(script, (s) => {
|
|
56
|
+
s.changed = true;
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
}),
|
|
61
|
+
];
|
|
62
|
+
}, [identity, space, script, script.source.target]);
|
|
63
|
+
|
|
64
|
+
if (!extensions.length) {
|
|
65
|
+
return null;
|
|
66
|
+
}
|
|
52
67
|
|
|
53
68
|
return (
|
|
54
|
-
<
|
|
69
|
+
<Layout.Main role={role} toolbar>
|
|
55
70
|
<ScriptToolbar state={state} role={role} script={script} />
|
|
56
71
|
<TypescriptEditor
|
|
57
72
|
id={script.id}
|
|
@@ -62,7 +77,7 @@ export const ScriptContainer = ({ role, script, settings = { editorInputMode: 'v
|
|
|
62
77
|
inputMode={settings.editorInputMode}
|
|
63
78
|
toolbar
|
|
64
79
|
/>
|
|
65
|
-
</
|
|
80
|
+
</Layout.Main>
|
|
66
81
|
);
|
|
67
82
|
};
|
|
68
83
|
|
|
@@ -2,46 +2,69 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
+
import { Atom, Registry } from '@effect-atom/atom-react';
|
|
5
6
|
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
7
|
+
import React, { useMemo } from 'react';
|
|
6
8
|
|
|
7
|
-
import {
|
|
9
|
+
import { OperationPlugin } from '@dxos/app-framework';
|
|
8
10
|
import { withPluginManager } from '@dxos/app-framework/testing';
|
|
9
11
|
import { Script } from '@dxos/functions';
|
|
10
12
|
import { ClientPlugin } from '@dxos/plugin-client';
|
|
11
13
|
import { withLayout, withTheme } from '@dxos/react-ui/testing';
|
|
12
14
|
|
|
15
|
+
import { type ScriptToolbarState, type ScriptToolbarStateStore } from '../../hooks';
|
|
13
16
|
import { translations } from '../../translations';
|
|
14
17
|
|
|
15
18
|
import { ScriptToolbar } from './ScriptToolbar';
|
|
16
19
|
|
|
20
|
+
// Create a mock store for stories.
|
|
21
|
+
const createMockStore = (initialState: ScriptToolbarState = {}): ScriptToolbarStateStore => {
|
|
22
|
+
const registry = Registry.make();
|
|
23
|
+
const atom = Atom.make<ScriptToolbarState>(initialState);
|
|
24
|
+
return {
|
|
25
|
+
atom,
|
|
26
|
+
get value() {
|
|
27
|
+
return registry.get(atom);
|
|
28
|
+
},
|
|
29
|
+
update: (updater) => registry.set(atom, updater(registry.get(atom))),
|
|
30
|
+
set: (key, value) => registry.set(atom, { ...registry.get(atom), [key]: value }),
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
// TODO(wittjosiah): ECHO objects don't work when passed via Storybook args.
|
|
35
|
+
const ScriptToolbarStory = () => {
|
|
36
|
+
const state = useMemo(() => createMockStore(), []);
|
|
37
|
+
const script = useMemo(
|
|
38
|
+
() =>
|
|
39
|
+
Script.make({
|
|
40
|
+
name: 'test',
|
|
41
|
+
description: 'test',
|
|
42
|
+
source: 'test',
|
|
43
|
+
}),
|
|
44
|
+
[],
|
|
45
|
+
);
|
|
46
|
+
return <ScriptToolbar state={state} script={script} />;
|
|
47
|
+
};
|
|
48
|
+
|
|
17
49
|
const meta = {
|
|
18
50
|
title: 'plugins/plugin-script/Toolbar',
|
|
19
|
-
component:
|
|
51
|
+
component: ScriptToolbarStory,
|
|
20
52
|
// TODO(wittjosiah): Try to write story which does not depend on plugin manager.
|
|
21
53
|
decorators: [
|
|
22
54
|
withTheme,
|
|
23
|
-
withLayout({ classNames: 'is-
|
|
55
|
+
withLayout({ classNames: 'is-proseMaxWidth' }),
|
|
24
56
|
withPluginManager({
|
|
25
|
-
plugins: [
|
|
57
|
+
plugins: [OperationPlugin(), ClientPlugin({})],
|
|
26
58
|
}),
|
|
27
59
|
],
|
|
28
60
|
parameters: {
|
|
29
61
|
layout: 'centered',
|
|
30
62
|
translations,
|
|
31
63
|
},
|
|
32
|
-
} satisfies Meta<typeof
|
|
64
|
+
} satisfies Meta<typeof ScriptToolbarStory>;
|
|
33
65
|
|
|
34
66
|
export default meta;
|
|
35
67
|
|
|
36
68
|
type Story = StoryObj<typeof meta>;
|
|
37
69
|
|
|
38
|
-
export const Default: Story = {
|
|
39
|
-
args: {
|
|
40
|
-
state: {},
|
|
41
|
-
script: Script.make({
|
|
42
|
-
name: 'test',
|
|
43
|
-
description: 'test',
|
|
44
|
-
source: 'test',
|
|
45
|
-
}),
|
|
46
|
-
},
|
|
47
|
-
};
|
|
70
|
+
export const Default: Story = {};
|
|
@@ -2,24 +2,23 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { Atom } from '@effect-atom/atom-react';
|
|
6
6
|
import React, { useMemo } from 'react';
|
|
7
7
|
|
|
8
|
+
import { Obj } from '@dxos/echo';
|
|
8
9
|
import { type Script } from '@dxos/functions';
|
|
9
|
-
import { fullyQualifiedId } from '@dxos/react-client/echo';
|
|
10
10
|
import { ElevationProvider, useTranslation } from '@dxos/react-ui';
|
|
11
11
|
import {
|
|
12
12
|
type ActionGraphProps,
|
|
13
13
|
MenuProvider,
|
|
14
14
|
ToolbarMenu,
|
|
15
15
|
createGapSeparator,
|
|
16
|
-
rxFromSignal,
|
|
17
16
|
useMenuActions,
|
|
18
17
|
} from '@dxos/react-ui-menu';
|
|
19
18
|
|
|
20
19
|
import {
|
|
21
20
|
type CreateDeployOptions,
|
|
22
|
-
type
|
|
21
|
+
type ScriptToolbarStateStore,
|
|
23
22
|
createDeploy,
|
|
24
23
|
createFormat,
|
|
25
24
|
createTemplateSelect,
|
|
@@ -30,7 +29,7 @@ import { meta } from '../../meta';
|
|
|
30
29
|
export type ScriptToolbarProps = {
|
|
31
30
|
role?: string;
|
|
32
31
|
script: Script.Script;
|
|
33
|
-
state:
|
|
32
|
+
state: ScriptToolbarStateStore;
|
|
34
33
|
};
|
|
35
34
|
|
|
36
35
|
export const ScriptToolbar = ({ script, role, state }: ScriptToolbarProps) => {
|
|
@@ -41,25 +40,23 @@ export const ScriptToolbar = ({ script, role, state }: ScriptToolbarProps) => {
|
|
|
41
40
|
|
|
42
41
|
return (
|
|
43
42
|
<ElevationProvider elevation={role === 'section' ? 'positioned' : 'base'}>
|
|
44
|
-
<MenuProvider {...actions} attendableId={
|
|
43
|
+
<MenuProvider {...actions} attendableId={Obj.getDXN(script).toString()}>
|
|
45
44
|
<ToolbarMenu />
|
|
46
45
|
</MenuProvider>
|
|
47
46
|
</ElevationProvider>
|
|
48
47
|
);
|
|
49
48
|
};
|
|
50
49
|
|
|
51
|
-
const createToolbarActions = ({ state, script, ...options }: CreateDeployOptions):
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
),
|
|
65
|
-
);
|
|
50
|
+
const createToolbarActions = ({ state, script, ...options }: CreateDeployOptions): Atom.Atom<ActionGraphProps> =>
|
|
51
|
+
Atom.make((get) => {
|
|
52
|
+
// Subscribe to state changes.
|
|
53
|
+
get(state.atom);
|
|
54
|
+
const templateSelect = createTemplateSelect(script);
|
|
55
|
+
const format = createFormat(script);
|
|
56
|
+
const gap = createGapSeparator();
|
|
57
|
+
const deploy = createDeploy({ state, script, ...options });
|
|
58
|
+
return {
|
|
59
|
+
nodes: [...templateSelect.nodes, ...format.nodes, ...gap.nodes, ...deploy.nodes],
|
|
60
|
+
edges: [...templateSelect.edges, ...format.edges, ...gap.edges, ...deploy.edges],
|
|
61
|
+
};
|
|
62
|
+
});
|
|
@@ -6,14 +6,17 @@ import { Octokit } from '@octokit/core';
|
|
|
6
6
|
import React, { type ChangeEvent, useCallback, useState } from 'react';
|
|
7
7
|
|
|
8
8
|
import { ToolId } from '@dxos/ai';
|
|
9
|
-
import {
|
|
9
|
+
import { SettingsOperation } from '@dxos/app-framework';
|
|
10
|
+
import { useOperationInvoker } from '@dxos/app-framework/react';
|
|
10
11
|
import { Blueprint, Template } from '@dxos/blueprints';
|
|
11
|
-
import {
|
|
12
|
+
import { Filter, Obj, Ref } from '@dxos/echo';
|
|
13
|
+
import { Function, type Script, getUserFunctionIdInMetadata } from '@dxos/functions';
|
|
14
|
+
import { getInvocationUrl } from '@dxos/functions-runtime';
|
|
12
15
|
import { log } from '@dxos/log';
|
|
13
16
|
import { useClient } from '@dxos/react-client';
|
|
14
|
-
import {
|
|
17
|
+
import { useQuery } from '@dxos/react-client/echo';
|
|
15
18
|
import { Button, Clipboard, Input, useAsyncEffect, useControlledState, useTranslation } from '@dxos/react-ui';
|
|
16
|
-
import {
|
|
19
|
+
import { AccessToken } from '@dxos/types';
|
|
17
20
|
import { kebabize } from '@dxos/util';
|
|
18
21
|
|
|
19
22
|
import { meta } from '../../meta';
|
|
@@ -41,7 +44,9 @@ export const ScriptProperties = ({ object }: ScriptObjectSettingsProps) => {
|
|
|
41
44
|
placeholder={t('description placeholder')}
|
|
42
45
|
value={object.description ?? ''}
|
|
43
46
|
onChange={(event) => {
|
|
44
|
-
object
|
|
47
|
+
Obj.change(object, (o) => {
|
|
48
|
+
o.description = event.target.value;
|
|
49
|
+
});
|
|
45
50
|
}}
|
|
46
51
|
/>
|
|
47
52
|
</Input.Root>
|
|
@@ -50,9 +55,9 @@ export const ScriptProperties = ({ object }: ScriptObjectSettingsProps) => {
|
|
|
50
55
|
|
|
51
56
|
const BlueprintEditor = ({ object }: ScriptObjectSettingsProps) => {
|
|
52
57
|
const { t } = useTranslation(meta.id);
|
|
53
|
-
const
|
|
54
|
-
const [fn] = useQuery(
|
|
55
|
-
const blueprints = useQuery(
|
|
58
|
+
const db = Obj.getDatabase(object);
|
|
59
|
+
const [fn] = useQuery(db, Filter.type(Function.Function, { source: Ref.make(object) }));
|
|
60
|
+
const blueprints = useQuery(db, Filter.type(Blueprint.Blueprint));
|
|
56
61
|
|
|
57
62
|
const [creating, setCreating] = useState(false);
|
|
58
63
|
const [instructions, setInstructions] = useState<string>(`You can run the script "${object.name ?? 'script'}".`);
|
|
@@ -68,7 +73,7 @@ const BlueprintEditor = ({ object }: ScriptObjectSettingsProps) => {
|
|
|
68
73
|
}, [existingBlueprint]);
|
|
69
74
|
|
|
70
75
|
const handleSave = useCallback(async () => {
|
|
71
|
-
if (!
|
|
76
|
+
if (!db) {
|
|
72
77
|
return;
|
|
73
78
|
}
|
|
74
79
|
|
|
@@ -76,15 +81,19 @@ const BlueprintEditor = ({ object }: ScriptObjectSettingsProps) => {
|
|
|
76
81
|
try {
|
|
77
82
|
if (existingBlueprint) {
|
|
78
83
|
const text = await existingBlueprint.instructions.source.load();
|
|
79
|
-
text
|
|
84
|
+
Obj.change(text, (t) => {
|
|
85
|
+
t.content = instructions;
|
|
86
|
+
});
|
|
80
87
|
if (fn?.key) {
|
|
81
88
|
const toolId = ToolId.make(fn.key);
|
|
82
89
|
if (!existingBlueprint.tools?.includes(toolId)) {
|
|
83
|
-
|
|
90
|
+
Obj.change(existingBlueprint, (b) => {
|
|
91
|
+
b.tools = [...(b.tools ?? []), toolId];
|
|
92
|
+
});
|
|
84
93
|
}
|
|
85
94
|
}
|
|
86
95
|
} else if (fn?.key) {
|
|
87
|
-
|
|
96
|
+
db.add(
|
|
88
97
|
Blueprint.make({
|
|
89
98
|
key: blueprintKey,
|
|
90
99
|
name: object.name ?? 'Script',
|
|
@@ -95,25 +104,29 @@ const BlueprintEditor = ({ object }: ScriptObjectSettingsProps) => {
|
|
|
95
104
|
}),
|
|
96
105
|
);
|
|
97
106
|
}
|
|
98
|
-
await
|
|
107
|
+
await db.flush();
|
|
99
108
|
} finally {
|
|
100
109
|
setCreating(false);
|
|
101
110
|
}
|
|
102
|
-
}, [
|
|
111
|
+
}, [db, existingBlueprint, fn, blueprintKey, object.name, instructions]);
|
|
103
112
|
|
|
104
113
|
return (
|
|
105
114
|
<div className='flex flex-col gap-4 mlb-cardSpacingBlock'>
|
|
106
115
|
<div>
|
|
107
116
|
<h2>{t('blueprint editor label', { default: 'Blueprint' })}</h2>
|
|
108
117
|
<p className='text-description text-sm'>
|
|
109
|
-
{t('blueprint editor description', {
|
|
118
|
+
{t('blueprint editor description', {
|
|
119
|
+
default: 'Create a blueprint that exposes this script as a tool.',
|
|
120
|
+
})}
|
|
110
121
|
</p>
|
|
111
122
|
</div>
|
|
112
123
|
<Input.Root>
|
|
113
124
|
<div role='none' className='flex flex-col gap-1'>
|
|
114
125
|
<Input.Label>{t('blueprint instructions label', { default: 'Instructions' })}</Input.Label>
|
|
115
126
|
<Input.TextArea
|
|
116
|
-
placeholder={t('blueprint instructions placeholder', {
|
|
127
|
+
placeholder={t('blueprint instructions placeholder', {
|
|
128
|
+
default: 'Describe how this tool should be used.',
|
|
129
|
+
})}
|
|
117
130
|
rows={6}
|
|
118
131
|
value={instructions}
|
|
119
132
|
onChange={(event) => setInstructions(event.target.value)}
|
|
@@ -135,14 +148,14 @@ const BlueprintEditor = ({ object }: ScriptObjectSettingsProps) => {
|
|
|
135
148
|
const Binding = ({ object }: ScriptObjectSettingsProps) => {
|
|
136
149
|
const { t } = useTranslation(meta.id);
|
|
137
150
|
const client = useClient();
|
|
138
|
-
const
|
|
139
|
-
const [fn] = useQuery(
|
|
151
|
+
const db = Obj.getDatabase(object);
|
|
152
|
+
const [fn] = useQuery(db, Filter.type(Function.Function, { source: Ref.make(object) }));
|
|
140
153
|
|
|
141
|
-
const functionId = fn && getUserFunctionIdInMetadata(getMeta(fn));
|
|
154
|
+
const functionId = fn && getUserFunctionIdInMetadata(Obj.getMeta(fn));
|
|
142
155
|
const functionUrl =
|
|
143
156
|
functionId &&
|
|
144
157
|
getInvocationUrl(functionId, client.config.values.runtime?.services?.edge?.url ?? '', {
|
|
145
|
-
spaceId:
|
|
158
|
+
spaceId: db?.spaceId,
|
|
146
159
|
});
|
|
147
160
|
|
|
148
161
|
const [binding, setBinding] = useControlledState(fn?.binding ?? '');
|
|
@@ -154,7 +167,9 @@ const Binding = ({ object }: ScriptObjectSettingsProps) => {
|
|
|
154
167
|
);
|
|
155
168
|
|
|
156
169
|
const handleBindingBlur = useCallback(() => {
|
|
157
|
-
fn
|
|
170
|
+
Obj.change(fn, (f) => {
|
|
171
|
+
f.binding = binding;
|
|
172
|
+
});
|
|
158
173
|
}, [fn, binding]);
|
|
159
174
|
|
|
160
175
|
if (!fn || !functionUrl) {
|
|
@@ -173,7 +188,9 @@ const Binding = ({ object }: ScriptObjectSettingsProps) => {
|
|
|
173
188
|
disabled
|
|
174
189
|
value={functionUrl}
|
|
175
190
|
onChange={(event) => {
|
|
176
|
-
fn
|
|
191
|
+
Obj.change(fn, (f) => {
|
|
192
|
+
f.name = event.target.value;
|
|
193
|
+
});
|
|
177
194
|
}}
|
|
178
195
|
/>
|
|
179
196
|
<Clipboard.IconButton value={functionUrl} />
|
|
@@ -198,10 +215,10 @@ const Binding = ({ object }: ScriptObjectSettingsProps) => {
|
|
|
198
215
|
// TODO(burdon): Move to separate tab?
|
|
199
216
|
const Publishing = ({ object }: ScriptObjectSettingsProps) => {
|
|
200
217
|
const { t } = useTranslation(meta.id);
|
|
201
|
-
const {
|
|
202
|
-
const
|
|
203
|
-
const [githubToken] = useQuery(
|
|
204
|
-
const gistKey = getMeta(object).keys.find(({ source }) => source === 'github.com');
|
|
218
|
+
const { invokePromise } = useOperationInvoker();
|
|
219
|
+
const db = Obj.getDatabase(object);
|
|
220
|
+
const [githubToken] = useQuery(db, Filter.type(AccessToken.AccessToken, { source: 'github.com' }));
|
|
221
|
+
const gistKey = Obj.getMeta(object).keys.find(({ source }) => source === 'github.com');
|
|
205
222
|
const [gistUrl, setGistUrl] = useState<string | undefined>();
|
|
206
223
|
|
|
207
224
|
useAsyncEffect(async () => {
|
|
@@ -225,8 +242,11 @@ const Publishing = ({ object }: ScriptObjectSettingsProps) => {
|
|
|
225
242
|
}, [githubToken, gistKey]);
|
|
226
243
|
|
|
227
244
|
const handleOpenTokenManager = useCallback(
|
|
228
|
-
() =>
|
|
229
|
-
|
|
245
|
+
() =>
|
|
246
|
+
invokePromise(SettingsOperation.Open, {
|
|
247
|
+
plugin: 'dxos.org/plugin/token-manager',
|
|
248
|
+
}),
|
|
249
|
+
[invokePromise],
|
|
230
250
|
);
|
|
231
251
|
|
|
232
252
|
const [publishing, setPublishing] = useState(false);
|
|
@@ -239,7 +259,7 @@ const Publishing = ({ object }: ScriptObjectSettingsProps) => {
|
|
|
239
259
|
|
|
240
260
|
try {
|
|
241
261
|
// TODO(wittjosiah): Factor out to intent.
|
|
242
|
-
const meta = getMeta(object);
|
|
262
|
+
const meta = Obj.getMeta(object);
|
|
243
263
|
const githubKey = meta.keys.find(({ source }) => source === 'github.com');
|
|
244
264
|
const gistId = githubKey?.id;
|
|
245
265
|
if (gistId) {
|
|
@@ -252,8 +272,11 @@ const Publishing = ({ object }: ScriptObjectSettingsProps) => {
|
|
|
252
272
|
public: true,
|
|
253
273
|
files,
|
|
254
274
|
});
|
|
255
|
-
|
|
256
|
-
|
|
275
|
+
const gistId = response.data.id;
|
|
276
|
+
if (gistId) {
|
|
277
|
+
Obj.change(object, (obj) => {
|
|
278
|
+
Obj.getMeta(obj).keys.push({ source: 'github.com', id: gistId });
|
|
279
|
+
});
|
|
257
280
|
}
|
|
258
281
|
}
|
|
259
282
|
} finally {
|
|
@@ -6,14 +6,19 @@ import React from 'react';
|
|
|
6
6
|
|
|
7
7
|
import { useClient } from '@dxos/react-client';
|
|
8
8
|
import { Button, Select, useTranslation } from '@dxos/react-ui';
|
|
9
|
-
import { type EditorInputMode, EditorInputModes } from '@dxos/react-ui-editor';
|
|
10
9
|
import { ControlGroup, ControlItemInput, ControlPage, ControlSection } from '@dxos/react-ui-form';
|
|
10
|
+
import { type EditorInputMode, EditorInputModes } from '@dxos/ui-editor';
|
|
11
11
|
|
|
12
12
|
import { meta } from '../../meta';
|
|
13
13
|
import { type ScriptSettings } from '../../types';
|
|
14
14
|
import { getAccessCredential } from '../../util';
|
|
15
15
|
|
|
16
|
-
export
|
|
16
|
+
export type ScriptPluginSettingsComponentProps = {
|
|
17
|
+
settings: ScriptSettings;
|
|
18
|
+
onSettingsChange: (fn: (current: ScriptSettings) => ScriptSettings) => void;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export const ScriptPluginSettings = ({ settings, onSettingsChange }: ScriptPluginSettingsComponentProps) => {
|
|
17
22
|
const { t } = useTranslation(meta.id);
|
|
18
23
|
const client = useClient();
|
|
19
24
|
|
|
@@ -36,7 +41,7 @@ export const ScriptPluginSettings = ({ settings }: { settings: ScriptSettings })
|
|
|
36
41
|
<Select.Root
|
|
37
42
|
value={settings.editorInputMode ?? 'default'}
|
|
38
43
|
onValueChange={(value) => {
|
|
39
|
-
|
|
44
|
+
onSettingsChange((s) => ({ ...s, editorInputMode: value as EditorInputMode }));
|
|
40
45
|
}}
|
|
41
46
|
>
|
|
42
47
|
<Select.TriggerButton placeholder={t('select editor input mode placeholder')} />
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import React from 'react';
|
|
6
6
|
|
|
7
7
|
import { type Script } from '@dxos/functions';
|
|
8
|
-
import {
|
|
8
|
+
import { Layout } from '@dxos/react-ui-mosaic';
|
|
9
9
|
|
|
10
10
|
import { useDeployState, useToolbarState } from '../../hooks';
|
|
11
11
|
|
|
@@ -16,12 +16,12 @@ export type TestContainerProps = {
|
|
|
16
16
|
script: Script.Script;
|
|
17
17
|
};
|
|
18
18
|
|
|
19
|
-
export const TestContainer = ({ script }: TestContainerProps) => {
|
|
19
|
+
export const TestContainer = ({ role, script }: TestContainerProps) => {
|
|
20
20
|
const state = useToolbarState();
|
|
21
21
|
useDeployState({ state, script });
|
|
22
22
|
return (
|
|
23
|
-
<
|
|
24
|
-
<TestPanel functionUrl={state.functionUrl} />
|
|
25
|
-
</
|
|
23
|
+
<Layout.Main role={role}>
|
|
24
|
+
<TestPanel functionUrl={state.value.functionUrl} />
|
|
25
|
+
</Layout.Main>
|
|
26
26
|
);
|
|
27
27
|
};
|
|
@@ -7,7 +7,7 @@ import React, { forwardRef, useEffect, useRef, useState } from 'react';
|
|
|
7
7
|
import { log } from '@dxos/log';
|
|
8
8
|
import { Avatar, Icon, Input, type ThemedClassName, Toolbar, useTranslation } from '@dxos/react-ui';
|
|
9
9
|
import { SyntaxHighlighter } from '@dxos/react-ui-syntax-highlighter';
|
|
10
|
-
import { errorText, mx } from '@dxos/
|
|
10
|
+
import { errorText, mx } from '@dxos/ui-theme';
|
|
11
11
|
|
|
12
12
|
import { meta } from '../../meta';
|
|
13
13
|
|
|
@@ -16,7 +16,12 @@ type State = 'pending' | 'responding';
|
|
|
16
16
|
/**
|
|
17
17
|
* Request or response.
|
|
18
18
|
*/
|
|
19
|
-
type Message = {
|
|
19
|
+
type Message = {
|
|
20
|
+
type: 'request' | 'response';
|
|
21
|
+
text?: string;
|
|
22
|
+
data?: any;
|
|
23
|
+
error?: Error;
|
|
24
|
+
};
|
|
20
25
|
|
|
21
26
|
export type TestPanelProps = ThemedClassName<{
|
|
22
27
|
functionUrl?: string;
|
|
@@ -61,7 +66,15 @@ export const TestPanel = ({ classNames, functionUrl }: TestPanelProps) => {
|
|
|
61
66
|
inputRef.current?.focus();
|
|
62
67
|
};
|
|
63
68
|
|
|
64
|
-
const handleResponse = ({
|
|
69
|
+
const handleResponse = ({
|
|
70
|
+
text,
|
|
71
|
+
data,
|
|
72
|
+
error,
|
|
73
|
+
}: {
|
|
74
|
+
text?: string;
|
|
75
|
+
data?: any;
|
|
76
|
+
error?: Error;
|
|
77
|
+
} = {}) => {
|
|
65
78
|
controller.current = null;
|
|
66
79
|
setHistory((history) => [...history, { type: 'response', text, data, error } satisfies Message]);
|
|
67
80
|
setResult('');
|
|
@@ -108,7 +121,9 @@ export const TestPanel = ({ classNames, functionUrl }: TestPanelProps) => {
|
|
|
108
121
|
// Check for error.
|
|
109
122
|
if (!response.ok) {
|
|
110
123
|
const text = await response.text();
|
|
111
|
-
handleResponse({
|
|
124
|
+
handleResponse({
|
|
125
|
+
error: new Error(text || response.statusText || String(response.status)),
|
|
126
|
+
});
|
|
112
127
|
return;
|
|
113
128
|
}
|
|
114
129
|
|
|
@@ -159,7 +174,7 @@ export const TestPanel = ({ classNames, functionUrl }: TestPanelProps) => {
|
|
|
159
174
|
};
|
|
160
175
|
|
|
161
176
|
return (
|
|
162
|
-
<div className={mx('flex flex-col
|
|
177
|
+
<div className={mx('flex flex-col bs-full overflow-hidden', classNames)}>
|
|
163
178
|
{/* TODO(burdon): Replace with Thread. */}
|
|
164
179
|
<MessageThread ref={scrollerRef} state={state} result={result} history={history} />
|
|
165
180
|
{/* TODO(burdon): Replace with Form based on the function's input schema. */}
|
|
@@ -174,12 +189,20 @@ export const TestPanel = ({ classNames, functionUrl }: TestPanelProps) => {
|
|
|
174
189
|
onKeyDown={(ev) => ev.key === 'Enter' && handleRequest(input)}
|
|
175
190
|
/>
|
|
176
191
|
</Input.Root>
|
|
177
|
-
<Toolbar.
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
192
|
+
<Toolbar.IconButton
|
|
193
|
+
icon='ph--play--regular'
|
|
194
|
+
size={4}
|
|
195
|
+
label='Execute'
|
|
196
|
+
iconOnly
|
|
197
|
+
onClick={() => handleRequest(input)}
|
|
198
|
+
/>
|
|
199
|
+
<Toolbar.IconButton
|
|
200
|
+
icon={state ? 'ph--stop--regular' : 'ph--trash--regular'}
|
|
201
|
+
size={4}
|
|
202
|
+
label={state ? 'Stop' : 'Clear'}
|
|
203
|
+
iconOnly
|
|
204
|
+
onClick={() => (state ? handleStop() : handleClear())}
|
|
205
|
+
/>
|
|
183
206
|
</Toolbar.Root>
|
|
184
207
|
</div>
|
|
185
208
|
);
|
|
@@ -196,7 +219,7 @@ type MessageThreadProps = {
|
|
|
196
219
|
const MessageThread = forwardRef<HTMLDivElement, MessageThreadProps>(
|
|
197
220
|
({ state, history, result }: MessageThreadProps, forwardedRef) => {
|
|
198
221
|
return (
|
|
199
|
-
<div ref={forwardedRef} className='flex flex-col gap-6
|
|
222
|
+
<div ref={forwardedRef} className='flex flex-col gap-6 bs-full p-2 overflow-x-hidden overflow-y-auto'>
|
|
200
223
|
{history.map((message, i) => (
|
|
201
224
|
<div key={i} className='grid grid-cols-[2rem_1fr_2rem]'>
|
|
202
225
|
<div className='p-1'>{message.type === 'response' && <RobotAvatar />}</div>
|
|
@@ -225,7 +248,7 @@ const MessageThread = forwardRef<HTMLDivElement, MessageThreadProps>(
|
|
|
225
248
|
|
|
226
249
|
const MessageItem = ({ classNames, message }: ThemedClassName<{ message: Message }>) => {
|
|
227
250
|
const { type, text, data, error } = message;
|
|
228
|
-
const wrapper = 'p-1
|
|
251
|
+
const wrapper = 'p-1 pli-2 rounded-md bg-hoverSurface overflow-auto';
|
|
229
252
|
return (
|
|
230
253
|
<div className={mx('flex', type === 'request' ? 'ml-[1rem] justify-end' : 'mr-[1rem]', classNames)}>
|
|
231
254
|
{error && <div className={mx(wrapper, 'whitespace-pre', errorText)}>{String(error)}</div>}
|