@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
|
@@ -1,645 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
|
-
import {
|
|
3
|
-
useDeployState,
|
|
4
|
-
useToolbarState
|
|
5
|
-
} from "./chunk-GA27XSEY.mjs";
|
|
6
|
-
import {
|
|
7
|
-
getAccessCredential
|
|
8
|
-
} from "./chunk-O7HXE72S.mjs";
|
|
9
|
-
import {
|
|
10
|
-
meta
|
|
11
|
-
} from "./chunk-IBV2DR36.mjs";
|
|
12
|
-
|
|
13
|
-
// src/components/Settings/ScriptObjectSettings.tsx
|
|
14
|
-
import { useSignals as _useSignals } from "@preact-signals/safe-react/tracking";
|
|
15
|
-
import { Octokit } from "@octokit/core";
|
|
16
|
-
import React, { useCallback, useState } from "react";
|
|
17
|
-
import { ToolId } from "@dxos/ai";
|
|
18
|
-
import { SettingsAction, createIntent, useIntentDispatcher } from "@dxos/app-framework";
|
|
19
|
-
import { Blueprint, Template } from "@dxos/blueprints";
|
|
20
|
-
import { Function, getInvocationUrl, getUserFunctionIdInMetadata } from "@dxos/functions";
|
|
21
|
-
import { log } from "@dxos/log";
|
|
22
|
-
import { useClient } from "@dxos/react-client";
|
|
23
|
-
import { Filter, Ref, getMeta, getSpace, useQuery } from "@dxos/react-client/echo";
|
|
24
|
-
import { Button, Clipboard, Input, useAsyncEffect, useControlledState, useTranslation } from "@dxos/react-ui";
|
|
25
|
-
import { DataType } from "@dxos/schema";
|
|
26
|
-
import { kebabize } from "@dxos/util";
|
|
27
|
-
var __dxlog_file = "/__w/dxos/dxos/packages/plugins/plugin-script/src/components/Settings/ScriptObjectSettings.tsx";
|
|
28
|
-
var ScriptObjectSettings = ({ object }) => {
|
|
29
|
-
var _effect = _useSignals();
|
|
30
|
-
try {
|
|
31
|
-
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Binding, {
|
|
32
|
-
object
|
|
33
|
-
}), /* @__PURE__ */ React.createElement(BlueprintEditor, {
|
|
34
|
-
object
|
|
35
|
-
}), /* @__PURE__ */ React.createElement(Publishing, {
|
|
36
|
-
object
|
|
37
|
-
}));
|
|
38
|
-
} finally {
|
|
39
|
-
_effect.f();
|
|
40
|
-
}
|
|
41
|
-
};
|
|
42
|
-
var ScriptProperties = ({ object }) => {
|
|
43
|
-
var _effect = _useSignals();
|
|
44
|
-
try {
|
|
45
|
-
const { t } = useTranslation(meta.id);
|
|
46
|
-
return /* @__PURE__ */ React.createElement(Input.Root, null, /* @__PURE__ */ React.createElement(Input.Label, null, t("description label")), /* @__PURE__ */ React.createElement(Input.TextInput, {
|
|
47
|
-
placeholder: t("description placeholder"),
|
|
48
|
-
value: object.description ?? "",
|
|
49
|
-
onChange: (event) => {
|
|
50
|
-
object.description = event.target.value;
|
|
51
|
-
}
|
|
52
|
-
}));
|
|
53
|
-
} finally {
|
|
54
|
-
_effect.f();
|
|
55
|
-
}
|
|
56
|
-
};
|
|
57
|
-
var BlueprintEditor = ({ object }) => {
|
|
58
|
-
var _effect = _useSignals();
|
|
59
|
-
try {
|
|
60
|
-
const { t } = useTranslation(meta.id);
|
|
61
|
-
const space = getSpace(object);
|
|
62
|
-
const [fn] = useQuery(space, Filter.type(Function.Function, {
|
|
63
|
-
source: Ref.make(object)
|
|
64
|
-
}));
|
|
65
|
-
const blueprints = useQuery(space, Filter.type(Blueprint.Blueprint));
|
|
66
|
-
const [creating, setCreating] = useState(false);
|
|
67
|
-
const [instructions, setInstructions] = useState(`You can run the script "${object.name ?? "script"}".`);
|
|
68
|
-
const blueprintKey = `dxos.org/blueprint/${kebabize(object.name ?? "script")}`;
|
|
69
|
-
const existingBlueprint = blueprints.find((bp) => bp.key === blueprintKey);
|
|
70
|
-
useAsyncEffect(async () => {
|
|
71
|
-
if (!existingBlueprint) {
|
|
72
|
-
return;
|
|
73
|
-
}
|
|
74
|
-
const source = await existingBlueprint.instructions.source.load();
|
|
75
|
-
setInstructions(source.content ?? "");
|
|
76
|
-
}, [
|
|
77
|
-
existingBlueprint
|
|
78
|
-
]);
|
|
79
|
-
const handleSave = useCallback(async () => {
|
|
80
|
-
if (!space) {
|
|
81
|
-
return;
|
|
82
|
-
}
|
|
83
|
-
setCreating(true);
|
|
84
|
-
try {
|
|
85
|
-
if (existingBlueprint) {
|
|
86
|
-
const text = await existingBlueprint.instructions.source.load();
|
|
87
|
-
text.content = instructions;
|
|
88
|
-
if (fn?.key) {
|
|
89
|
-
const toolId = ToolId.make(fn.key);
|
|
90
|
-
if (!existingBlueprint.tools?.includes(toolId)) {
|
|
91
|
-
existingBlueprint.tools = [
|
|
92
|
-
...existingBlueprint.tools ?? [],
|
|
93
|
-
toolId
|
|
94
|
-
];
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
} else if (fn?.key) {
|
|
98
|
-
space.db.add(Blueprint.make({
|
|
99
|
-
key: blueprintKey,
|
|
100
|
-
name: object.name ?? "Script",
|
|
101
|
-
instructions: Template.make({
|
|
102
|
-
source: instructions
|
|
103
|
-
}),
|
|
104
|
-
tools: [
|
|
105
|
-
ToolId.make(fn.key)
|
|
106
|
-
]
|
|
107
|
-
}));
|
|
108
|
-
}
|
|
109
|
-
await space.db.flush();
|
|
110
|
-
} finally {
|
|
111
|
-
setCreating(false);
|
|
112
|
-
}
|
|
113
|
-
}, [
|
|
114
|
-
space,
|
|
115
|
-
existingBlueprint,
|
|
116
|
-
fn,
|
|
117
|
-
blueprintKey,
|
|
118
|
-
object.name,
|
|
119
|
-
instructions
|
|
120
|
-
]);
|
|
121
|
-
return /* @__PURE__ */ React.createElement("div", {
|
|
122
|
-
className: "flex flex-col gap-4 mlb-cardSpacingBlock"
|
|
123
|
-
}, /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement("h2", null, t("blueprint editor label", {
|
|
124
|
-
default: "Blueprint"
|
|
125
|
-
})), /* @__PURE__ */ React.createElement("p", {
|
|
126
|
-
className: "text-description text-sm"
|
|
127
|
-
}, t("blueprint editor description", {
|
|
128
|
-
default: "Create a blueprint that exposes this script as a tool."
|
|
129
|
-
}))), /* @__PURE__ */ React.createElement(Input.Root, null, /* @__PURE__ */ React.createElement("div", {
|
|
130
|
-
role: "none",
|
|
131
|
-
className: "flex flex-col gap-1"
|
|
132
|
-
}, /* @__PURE__ */ React.createElement(Input.Label, null, t("blueprint instructions label", {
|
|
133
|
-
default: "Instructions"
|
|
134
|
-
})), /* @__PURE__ */ React.createElement(Input.TextArea, {
|
|
135
|
-
placeholder: t("blueprint instructions placeholder", {
|
|
136
|
-
default: "Describe how this tool should be used."
|
|
137
|
-
}),
|
|
138
|
-
rows: 6,
|
|
139
|
-
value: instructions,
|
|
140
|
-
onChange: (event) => setInstructions(event.target.value),
|
|
141
|
-
classNames: "resize-y"
|
|
142
|
-
}))), /* @__PURE__ */ React.createElement("div", {
|
|
143
|
-
className: "flex justify-end gap-2"
|
|
144
|
-
}, /* @__PURE__ */ React.createElement(Button, {
|
|
145
|
-
disabled: !existingBlueprint && !fn?.key || creating,
|
|
146
|
-
onClick: handleSave
|
|
147
|
-
}, t(creating ? "creating label" : "create blueprint label", {
|
|
148
|
-
default: creating ? "Creating\u2026" : "Create blueprint"
|
|
149
|
-
}))));
|
|
150
|
-
} finally {
|
|
151
|
-
_effect.f();
|
|
152
|
-
}
|
|
153
|
-
};
|
|
154
|
-
var Binding = ({ object }) => {
|
|
155
|
-
var _effect = _useSignals();
|
|
156
|
-
try {
|
|
157
|
-
const { t } = useTranslation(meta.id);
|
|
158
|
-
const client = useClient();
|
|
159
|
-
const space = getSpace(object);
|
|
160
|
-
const [fn] = useQuery(space, Filter.type(Function.Function, {
|
|
161
|
-
source: Ref.make(object)
|
|
162
|
-
}));
|
|
163
|
-
const functionId = fn && getUserFunctionIdInMetadata(getMeta(fn));
|
|
164
|
-
const functionUrl = functionId && getInvocationUrl(functionId, client.config.values.runtime?.services?.edge?.url ?? "", {
|
|
165
|
-
spaceId: space?.id
|
|
166
|
-
});
|
|
167
|
-
const [binding, setBinding] = useControlledState(fn?.binding ?? "");
|
|
168
|
-
const handleBindingChange = useCallback((event) => {
|
|
169
|
-
setBinding(event.target.value);
|
|
170
|
-
}, [
|
|
171
|
-
setBinding
|
|
172
|
-
]);
|
|
173
|
-
const handleBindingBlur = useCallback(() => {
|
|
174
|
-
fn.binding = binding;
|
|
175
|
-
}, [
|
|
176
|
-
fn,
|
|
177
|
-
binding
|
|
178
|
-
]);
|
|
179
|
-
if (!fn || !functionUrl) {
|
|
180
|
-
return null;
|
|
181
|
-
}
|
|
182
|
-
return /* @__PURE__ */ React.createElement("div", {
|
|
183
|
-
role: "form",
|
|
184
|
-
className: "flex flex-col gap-2 mlb-cardSpacingBlock"
|
|
185
|
-
}, /* @__PURE__ */ React.createElement("h2", null, t("remote function settings heading")), /* @__PURE__ */ React.createElement(Input.Root, null, /* @__PURE__ */ React.createElement("div", {
|
|
186
|
-
role: "none",
|
|
187
|
-
className: "flex flex-col gap-1"
|
|
188
|
-
}, /* @__PURE__ */ React.createElement(Input.Label, null, t("function url label")), /* @__PURE__ */ React.createElement("div", {
|
|
189
|
-
role: "none",
|
|
190
|
-
className: "flex gap-1"
|
|
191
|
-
}, /* @__PURE__ */ React.createElement(Input.TextInput, {
|
|
192
|
-
disabled: true,
|
|
193
|
-
value: functionUrl,
|
|
194
|
-
onChange: (event) => {
|
|
195
|
-
fn.name = event.target.value;
|
|
196
|
-
}
|
|
197
|
-
}), /* @__PURE__ */ React.createElement(Clipboard.IconButton, {
|
|
198
|
-
value: functionUrl
|
|
199
|
-
})))), /* @__PURE__ */ React.createElement(Input.Root, null, /* @__PURE__ */ React.createElement("div", {
|
|
200
|
-
role: "none",
|
|
201
|
-
className: "flex flex-col gap-1"
|
|
202
|
-
}, /* @__PURE__ */ React.createElement(Input.Label, null, t("function binding label")), /* @__PURE__ */ React.createElement(Input.TextInput, {
|
|
203
|
-
placeholder: t("function binding placeholder"),
|
|
204
|
-
value: binding,
|
|
205
|
-
onChange: handleBindingChange,
|
|
206
|
-
onBlur: handleBindingBlur
|
|
207
|
-
}))));
|
|
208
|
-
} finally {
|
|
209
|
-
_effect.f();
|
|
210
|
-
}
|
|
211
|
-
};
|
|
212
|
-
var Publishing = ({ object }) => {
|
|
213
|
-
var _effect = _useSignals();
|
|
214
|
-
try {
|
|
215
|
-
const { t } = useTranslation(meta.id);
|
|
216
|
-
const { dispatchPromise: dispatch } = useIntentDispatcher();
|
|
217
|
-
const space = getSpace(object);
|
|
218
|
-
const [githubToken] = useQuery(space, Filter.type(DataType.AccessToken, {
|
|
219
|
-
source: "github.com"
|
|
220
|
-
}));
|
|
221
|
-
const gistKey = getMeta(object).keys.find(({ source }) => source === "github.com");
|
|
222
|
-
const [gistUrl, setGistUrl] = useState();
|
|
223
|
-
useAsyncEffect(async () => {
|
|
224
|
-
const token = githubToken?.token;
|
|
225
|
-
const gistId = gistKey?.id;
|
|
226
|
-
if (!token || !gistId) {
|
|
227
|
-
setGistUrl(void 0);
|
|
228
|
-
return;
|
|
229
|
-
}
|
|
230
|
-
try {
|
|
231
|
-
const octokit = new Octokit({
|
|
232
|
-
auth: githubToken.token
|
|
233
|
-
});
|
|
234
|
-
const response = await octokit.request("GET /gists/{gist_id}", {
|
|
235
|
-
gist_id: gistId
|
|
236
|
-
});
|
|
237
|
-
setGistUrl(response.data.html_url);
|
|
238
|
-
} catch (err) {
|
|
239
|
-
log.catch(err, void 0, {
|
|
240
|
-
F: __dxlog_file,
|
|
241
|
-
L: 222,
|
|
242
|
-
S: void 0,
|
|
243
|
-
C: (f, a) => f(...a)
|
|
244
|
-
});
|
|
245
|
-
setGistUrl(void 0);
|
|
246
|
-
}
|
|
247
|
-
}, [
|
|
248
|
-
githubToken,
|
|
249
|
-
gistKey
|
|
250
|
-
]);
|
|
251
|
-
const handleOpenTokenManager = useCallback(() => dispatch(createIntent(SettingsAction.Open, {
|
|
252
|
-
plugin: "dxos.org/plugin/token-manager"
|
|
253
|
-
})), []);
|
|
254
|
-
const [publishing, setPublishing] = useState(false);
|
|
255
|
-
const handlePublish = useCallback(async () => {
|
|
256
|
-
setPublishing(true);
|
|
257
|
-
const octokit = new Octokit({
|
|
258
|
-
auth: githubToken.token
|
|
259
|
-
});
|
|
260
|
-
const source = await object.source.load();
|
|
261
|
-
const filename = object.name ? kebabize(object.name) : "composer-script";
|
|
262
|
-
const files = {
|
|
263
|
-
[`${filename}.ts`]: {
|
|
264
|
-
content: source.content
|
|
265
|
-
}
|
|
266
|
-
};
|
|
267
|
-
try {
|
|
268
|
-
const meta2 = getMeta(object);
|
|
269
|
-
const githubKey = meta2.keys.find(({ source: source2 }) => source2 === "github.com");
|
|
270
|
-
const gistId = githubKey?.id;
|
|
271
|
-
if (gistId) {
|
|
272
|
-
await octokit.request("PATCH /gists/{gist_id}", {
|
|
273
|
-
gist_id: gistId,
|
|
274
|
-
files
|
|
275
|
-
});
|
|
276
|
-
} else {
|
|
277
|
-
const response = await octokit.request("POST /gists", {
|
|
278
|
-
public: true,
|
|
279
|
-
files
|
|
280
|
-
});
|
|
281
|
-
if (response.data.id) {
|
|
282
|
-
meta2.keys.push({
|
|
283
|
-
source: "github.com",
|
|
284
|
-
id: response.data.id
|
|
285
|
-
});
|
|
286
|
-
}
|
|
287
|
-
}
|
|
288
|
-
} finally {
|
|
289
|
-
setPublishing(false);
|
|
290
|
-
}
|
|
291
|
-
}, [
|
|
292
|
-
object,
|
|
293
|
-
githubToken
|
|
294
|
-
]);
|
|
295
|
-
return /* @__PURE__ */ React.createElement("div", {
|
|
296
|
-
className: "flex flex-col gap-4 mlb-cardSpacingBlock"
|
|
297
|
-
}, /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement("h2", null, t("script publish settings label")), /* @__PURE__ */ React.createElement("p", {
|
|
298
|
-
className: "text-description text-sm"
|
|
299
|
-
}, t("script publish settings description"))), !githubToken && /* @__PURE__ */ React.createElement("div", {
|
|
300
|
-
className: "flex flex-col gap-2"
|
|
301
|
-
}, /* @__PURE__ */ React.createElement("span", null, t("no github token label")), /* @__PURE__ */ React.createElement(Button, {
|
|
302
|
-
onClick: handleOpenTokenManager
|
|
303
|
-
}, t("open token manager label"))), githubToken && /* @__PURE__ */ React.createElement("div", {
|
|
304
|
-
className: "flex justify-end gap-2"
|
|
305
|
-
}, gistUrl && /* @__PURE__ */ React.createElement(Clipboard.IconButton, {
|
|
306
|
-
value: gistUrl
|
|
307
|
-
}), /* @__PURE__ */ React.createElement(Button, {
|
|
308
|
-
disabled: publishing,
|
|
309
|
-
onClick: handlePublish
|
|
310
|
-
}, t(publishing ? "publishing label" : "publish label"))));
|
|
311
|
-
} finally {
|
|
312
|
-
_effect.f();
|
|
313
|
-
}
|
|
314
|
-
};
|
|
315
|
-
|
|
316
|
-
// src/components/Settings/ScriptPluginSettings.tsx
|
|
317
|
-
import { useSignals as _useSignals2 } from "@preact-signals/safe-react/tracking";
|
|
318
|
-
import React2 from "react";
|
|
319
|
-
import { useClient as useClient2 } from "@dxos/react-client";
|
|
320
|
-
import { Button as Button2, Select, useTranslation as useTranslation2 } from "@dxos/react-ui";
|
|
321
|
-
import { EditorInputModes } from "@dxos/react-ui-editor";
|
|
322
|
-
import { ControlGroup, ControlItemInput, ControlPage, ControlSection } from "@dxos/react-ui-form";
|
|
323
|
-
var ScriptPluginSettings = ({ settings }) => {
|
|
324
|
-
var _effect = _useSignals2();
|
|
325
|
-
try {
|
|
326
|
-
const { t } = useTranslation2(meta.id);
|
|
327
|
-
const client = useClient2();
|
|
328
|
-
const handleAuthenticate = async () => {
|
|
329
|
-
const { identityKey } = client.halo.identity.get();
|
|
330
|
-
await client.halo.writeCredentials([
|
|
331
|
-
getAccessCredential(identityKey)
|
|
332
|
-
]);
|
|
333
|
-
};
|
|
334
|
-
return /* @__PURE__ */ React2.createElement(ControlPage, null, /* @__PURE__ */ React2.createElement(ControlSection, {
|
|
335
|
-
title: t("settings title", {
|
|
336
|
-
ns: meta.id
|
|
337
|
-
})
|
|
338
|
-
}, /* @__PURE__ */ React2.createElement(ControlGroup, null, /* @__PURE__ */ React2.createElement(ControlItemInput, {
|
|
339
|
-
title: t("authenticate action label")
|
|
340
|
-
}, /* @__PURE__ */ React2.createElement(Button2, {
|
|
341
|
-
onClick: handleAuthenticate
|
|
342
|
-
}, t("authenticate button label"))), /* @__PURE__ */ React2.createElement(ControlItemInput, {
|
|
343
|
-
title: t("editor input mode label")
|
|
344
|
-
}, /* @__PURE__ */ React2.createElement(Select.Root, {
|
|
345
|
-
value: settings.editorInputMode ?? "default",
|
|
346
|
-
onValueChange: (value) => {
|
|
347
|
-
settings.editorInputMode = value;
|
|
348
|
-
}
|
|
349
|
-
}, /* @__PURE__ */ React2.createElement(Select.TriggerButton, {
|
|
350
|
-
placeholder: t("select editor input mode placeholder")
|
|
351
|
-
}), /* @__PURE__ */ React2.createElement(Select.Portal, null, /* @__PURE__ */ React2.createElement(Select.Content, null, /* @__PURE__ */ React2.createElement(Select.Viewport, null, EditorInputModes.map((mode) => /* @__PURE__ */ React2.createElement(Select.Option, {
|
|
352
|
-
key: mode,
|
|
353
|
-
value: mode
|
|
354
|
-
}, t(`settings editor input mode ${mode} label`)))), /* @__PURE__ */ React2.createElement(Select.Arrow, null))))))));
|
|
355
|
-
} finally {
|
|
356
|
-
_effect.f();
|
|
357
|
-
}
|
|
358
|
-
};
|
|
359
|
-
|
|
360
|
-
// src/components/TestPanel/TestPanel.tsx
|
|
361
|
-
import { useSignals as _useSignals3 } from "@preact-signals/safe-react/tracking";
|
|
362
|
-
import React3, { forwardRef, useEffect, useRef, useState as useState2 } from "react";
|
|
363
|
-
import { log as log2 } from "@dxos/log";
|
|
364
|
-
import { Avatar, Icon, Input as Input2, Toolbar, useTranslation as useTranslation3 } from "@dxos/react-ui";
|
|
365
|
-
import { SyntaxHighlighter } from "@dxos/react-ui-syntax-highlighter";
|
|
366
|
-
import { errorText, mx } from "@dxos/react-ui-theme";
|
|
367
|
-
var __dxlog_file2 = "/__w/dxos/dxos/packages/plugins/plugin-script/src/components/TestPanel/TestPanel.tsx";
|
|
368
|
-
var TestPanel = ({ classNames, functionUrl }) => {
|
|
369
|
-
var _effect = _useSignals3();
|
|
370
|
-
try {
|
|
371
|
-
const { t } = useTranslation3(meta.id);
|
|
372
|
-
const inputRef = useRef(null);
|
|
373
|
-
const [input, setInput] = useState2("");
|
|
374
|
-
const [result, setResult] = useState2("");
|
|
375
|
-
const [state, setState] = useState2(null);
|
|
376
|
-
const [history, setHistory] = useState2([]);
|
|
377
|
-
const scrollerRef = useRef(null);
|
|
378
|
-
const handleScroll = () => {
|
|
379
|
-
if (scrollerRef.current) {
|
|
380
|
-
scrollerRef.current.scrollTop = scrollerRef.current.scrollHeight;
|
|
381
|
-
}
|
|
382
|
-
};
|
|
383
|
-
const controller = useRef(null);
|
|
384
|
-
useEffect(() => {
|
|
385
|
-
return () => {
|
|
386
|
-
handleStop();
|
|
387
|
-
};
|
|
388
|
-
}, []);
|
|
389
|
-
const handleStop = () => {
|
|
390
|
-
controller.current?.abort("stop");
|
|
391
|
-
controller.current = null;
|
|
392
|
-
};
|
|
393
|
-
const handleClear = () => {
|
|
394
|
-
handleStop();
|
|
395
|
-
setInput("");
|
|
396
|
-
setResult("");
|
|
397
|
-
setHistory([]);
|
|
398
|
-
inputRef.current?.focus();
|
|
399
|
-
};
|
|
400
|
-
const handleResponse = ({ text, data, error } = {}) => {
|
|
401
|
-
controller.current = null;
|
|
402
|
-
setHistory((history2) => [
|
|
403
|
-
...history2,
|
|
404
|
-
{
|
|
405
|
-
type: "response",
|
|
406
|
-
text,
|
|
407
|
-
data,
|
|
408
|
-
error
|
|
409
|
-
}
|
|
410
|
-
]);
|
|
411
|
-
setResult("");
|
|
412
|
-
setState(null);
|
|
413
|
-
handleScroll();
|
|
414
|
-
};
|
|
415
|
-
const handleRequest = async (input2) => {
|
|
416
|
-
try {
|
|
417
|
-
setState("pending");
|
|
418
|
-
let data = null;
|
|
419
|
-
if (input2.charAt(0) === "{") {
|
|
420
|
-
try {
|
|
421
|
-
const validJsonString = input2.replace(/'/g, '"').replace(/([{,]\s*)([a-zA-Z0-9_]+)(\s*:)/g, '$1"$2"$3');
|
|
422
|
-
data = JSON.parse(validJsonString);
|
|
423
|
-
input2 = JSON.stringify(data, null, 2);
|
|
424
|
-
} catch (err) {
|
|
425
|
-
inputRef.current?.focus();
|
|
426
|
-
return;
|
|
427
|
-
}
|
|
428
|
-
}
|
|
429
|
-
setInput("");
|
|
430
|
-
setResult("");
|
|
431
|
-
setHistory((history2) => [
|
|
432
|
-
...history2,
|
|
433
|
-
{
|
|
434
|
-
type: "request",
|
|
435
|
-
text: input2
|
|
436
|
-
}
|
|
437
|
-
]);
|
|
438
|
-
setTimeout(() => {
|
|
439
|
-
handleScroll();
|
|
440
|
-
});
|
|
441
|
-
controller.current = new AbortController();
|
|
442
|
-
const response = await fetch(functionUrl, {
|
|
443
|
-
signal: controller.current.signal,
|
|
444
|
-
method: "POST",
|
|
445
|
-
body: input2,
|
|
446
|
-
headers: {
|
|
447
|
-
"Content-Type": data ? "application/json" : "text/plain"
|
|
448
|
-
}
|
|
449
|
-
});
|
|
450
|
-
if (!response.ok) {
|
|
451
|
-
const text2 = await response.text();
|
|
452
|
-
handleResponse({
|
|
453
|
-
error: new Error(text2 || response.statusText || String(response.status))
|
|
454
|
-
});
|
|
455
|
-
return;
|
|
456
|
-
}
|
|
457
|
-
const contentType = response.headers.get("content-type");
|
|
458
|
-
if (contentType === "application/json") {
|
|
459
|
-
const data2 = await response.json();
|
|
460
|
-
handleResponse({
|
|
461
|
-
data: data2
|
|
462
|
-
});
|
|
463
|
-
return;
|
|
464
|
-
}
|
|
465
|
-
setState("responding");
|
|
466
|
-
let text = "";
|
|
467
|
-
const reader = response.body.getReader();
|
|
468
|
-
const pump = async ({ done, value }) => {
|
|
469
|
-
text = text + new TextDecoder().decode(value);
|
|
470
|
-
if (!controller.current || done) {
|
|
471
|
-
handleResponse({
|
|
472
|
-
text
|
|
473
|
-
});
|
|
474
|
-
return;
|
|
475
|
-
}
|
|
476
|
-
setResult(text);
|
|
477
|
-
setTimeout(() => {
|
|
478
|
-
handleScroll();
|
|
479
|
-
});
|
|
480
|
-
return reader.read().then(pump);
|
|
481
|
-
};
|
|
482
|
-
void reader.read().then(pump).catch((err) => {
|
|
483
|
-
if (err.name !== "AbortError") {
|
|
484
|
-
log2.catch(err, void 0, {
|
|
485
|
-
F: __dxlog_file2,
|
|
486
|
-
L: 147,
|
|
487
|
-
S: void 0,
|
|
488
|
-
C: (f, a) => f(...a)
|
|
489
|
-
});
|
|
490
|
-
}
|
|
491
|
-
});
|
|
492
|
-
} catch (err) {
|
|
493
|
-
if (err !== "stop") {
|
|
494
|
-
const error = err instanceof Error ? err : new Error(err);
|
|
495
|
-
handleResponse({
|
|
496
|
-
error
|
|
497
|
-
});
|
|
498
|
-
log2.catch(err, void 0, {
|
|
499
|
-
F: __dxlog_file2,
|
|
500
|
-
L: 154,
|
|
501
|
-
S: void 0,
|
|
502
|
-
C: (f, a) => f(...a)
|
|
503
|
-
});
|
|
504
|
-
} else {
|
|
505
|
-
handleResponse();
|
|
506
|
-
}
|
|
507
|
-
}
|
|
508
|
-
};
|
|
509
|
-
return /* @__PURE__ */ React3.createElement("div", {
|
|
510
|
-
className: mx("flex flex-col h-full overflow-hidden", classNames)
|
|
511
|
-
}, /* @__PURE__ */ React3.createElement(MessageThread, {
|
|
512
|
-
ref: scrollerRef,
|
|
513
|
-
state,
|
|
514
|
-
result,
|
|
515
|
-
history
|
|
516
|
-
}), /* @__PURE__ */ React3.createElement(Toolbar.Root, null, /* @__PURE__ */ React3.createElement(Input2.Root, null, /* @__PURE__ */ React3.createElement(Input2.TextInput, {
|
|
517
|
-
ref: inputRef,
|
|
518
|
-
autoFocus: true,
|
|
519
|
-
placeholder: t("function request placeholder"),
|
|
520
|
-
value: input,
|
|
521
|
-
onChange: (ev) => setInput(ev.target.value),
|
|
522
|
-
onKeyDown: (ev) => ev.key === "Enter" && handleRequest(input)
|
|
523
|
-
})), /* @__PURE__ */ React3.createElement(Toolbar.Button, {
|
|
524
|
-
onClick: () => handleRequest(input)
|
|
525
|
-
}, /* @__PURE__ */ React3.createElement(Icon, {
|
|
526
|
-
icon: "ph--play--regular",
|
|
527
|
-
size: 4
|
|
528
|
-
})), /* @__PURE__ */ React3.createElement(Toolbar.Button, {
|
|
529
|
-
onClick: () => state ? handleStop() : handleClear()
|
|
530
|
-
}, /* @__PURE__ */ React3.createElement(Icon, {
|
|
531
|
-
icon: state ? "ph--stop--regular" : "ph--trash--regular",
|
|
532
|
-
size: 4
|
|
533
|
-
}))));
|
|
534
|
-
} finally {
|
|
535
|
-
_effect.f();
|
|
536
|
-
}
|
|
537
|
-
};
|
|
538
|
-
var MessageThread = /* @__PURE__ */ forwardRef(({ state, history, result }, forwardedRef) => {
|
|
539
|
-
var _effect = _useSignals3();
|
|
540
|
-
try {
|
|
541
|
-
return /* @__PURE__ */ React3.createElement("div", {
|
|
542
|
-
ref: forwardedRef,
|
|
543
|
-
className: "flex flex-col gap-6 h-full p-2 overflow-x-hidden overflow-y-auto"
|
|
544
|
-
}, history.map((message, i) => /* @__PURE__ */ React3.createElement("div", {
|
|
545
|
-
key: i,
|
|
546
|
-
className: "grid grid-cols-[2rem_1fr_2rem]"
|
|
547
|
-
}, /* @__PURE__ */ React3.createElement("div", {
|
|
548
|
-
className: "p-1"
|
|
549
|
-
}, message.type === "response" && /* @__PURE__ */ React3.createElement(RobotAvatar, null)), /* @__PURE__ */ React3.createElement("div", {
|
|
550
|
-
className: "overflow-auto"
|
|
551
|
-
}, /* @__PURE__ */ React3.createElement(MessageItem, {
|
|
552
|
-
message
|
|
553
|
-
})))), result?.length > 0 && /* @__PURE__ */ React3.createElement("div", {
|
|
554
|
-
className: "grid grid-cols-[2rem_1fr_2rem]"
|
|
555
|
-
}, /* @__PURE__ */ React3.createElement("div", {
|
|
556
|
-
className: "p-1"
|
|
557
|
-
}, state === "pending" && /* @__PURE__ */ React3.createElement(Icon, {
|
|
558
|
-
icon: "ph--spinner--regular",
|
|
559
|
-
size: 6,
|
|
560
|
-
classNames: "animate-spin"
|
|
561
|
-
}) || /* @__PURE__ */ React3.createElement(Icon, {
|
|
562
|
-
icon: "ph--robot--regular",
|
|
563
|
-
size: 6,
|
|
564
|
-
classNames: "animate-[pulse_1s_ease-in-out_infinite]"
|
|
565
|
-
})), /* @__PURE__ */ React3.createElement("div", {
|
|
566
|
-
className: "overflow-auto"
|
|
567
|
-
}, /* @__PURE__ */ React3.createElement(MessageItem, {
|
|
568
|
-
message: {
|
|
569
|
-
type: "response",
|
|
570
|
-
text: result
|
|
571
|
-
}
|
|
572
|
-
}))));
|
|
573
|
-
} finally {
|
|
574
|
-
_effect.f();
|
|
575
|
-
}
|
|
576
|
-
});
|
|
577
|
-
var MessageItem = ({ classNames, message }) => {
|
|
578
|
-
var _effect = _useSignals3();
|
|
579
|
-
try {
|
|
580
|
-
const { type, text, data, error } = message;
|
|
581
|
-
const wrapper = "p-1 px-2 rounded-md bg-hoverSurface overflow-auto";
|
|
582
|
-
return /* @__PURE__ */ React3.createElement("div", {
|
|
583
|
-
className: mx("flex", type === "request" ? "ml-[1rem] justify-end" : "mr-[1rem]", classNames)
|
|
584
|
-
}, error && /* @__PURE__ */ React3.createElement("div", {
|
|
585
|
-
className: mx(wrapper, "whitespace-pre", errorText)
|
|
586
|
-
}, String(error)), text !== void 0 && /* @__PURE__ */ React3.createElement("div", {
|
|
587
|
-
className: mx(wrapper, type === "request" && "bg-primary-400 dark:bg-primary-600")
|
|
588
|
-
}, text || "\xD8"), data && /* @__PURE__ */ React3.createElement(SyntaxHighlighter, {
|
|
589
|
-
language: "json",
|
|
590
|
-
className: mx(wrapper, "text-xs")
|
|
591
|
-
}, JSON.stringify(data, null, 2)));
|
|
592
|
-
} finally {
|
|
593
|
-
_effect.f();
|
|
594
|
-
}
|
|
595
|
-
};
|
|
596
|
-
var RobotAvatar = () => {
|
|
597
|
-
var _effect = _useSignals3();
|
|
598
|
-
try {
|
|
599
|
-
return /* @__PURE__ */ React3.createElement(Avatar.Root, null, /* @__PURE__ */ React3.createElement(Avatar.Content, {
|
|
600
|
-
size: 6,
|
|
601
|
-
variant: "circle",
|
|
602
|
-
icon: "ph--robot--regular"
|
|
603
|
-
}));
|
|
604
|
-
} finally {
|
|
605
|
-
_effect.f();
|
|
606
|
-
}
|
|
607
|
-
};
|
|
608
|
-
|
|
609
|
-
// src/components/TestPanel/TestContainer.tsx
|
|
610
|
-
import { useSignals as _useSignals4 } from "@preact-signals/safe-react/tracking";
|
|
611
|
-
import React4 from "react";
|
|
612
|
-
import { StackItem } from "@dxos/react-ui-stack";
|
|
613
|
-
var TestContainer = ({ script }) => {
|
|
614
|
-
var _effect = _useSignals4();
|
|
615
|
-
try {
|
|
616
|
-
const state = useToolbarState();
|
|
617
|
-
useDeployState({
|
|
618
|
-
state,
|
|
619
|
-
script
|
|
620
|
-
});
|
|
621
|
-
return /* @__PURE__ */ React4.createElement(StackItem.Content, null, /* @__PURE__ */ React4.createElement(TestPanel, {
|
|
622
|
-
functionUrl: state.functionUrl
|
|
623
|
-
}));
|
|
624
|
-
} finally {
|
|
625
|
-
_effect.f();
|
|
626
|
-
}
|
|
627
|
-
};
|
|
628
|
-
|
|
629
|
-
// src/components/index.ts
|
|
630
|
-
import { lazy } from "react";
|
|
631
|
-
var ScriptContainer = lazy(() => import("./ScriptContainer-EW24D5II.mjs"));
|
|
632
|
-
var DeploymentDialog = lazy(() => import("./DeploymentDialog-OSHHSEBH.mjs"));
|
|
633
|
-
var NotebookContainer = lazy(() => import("./NotebookContainer-FOVFGJQR.mjs"));
|
|
634
|
-
|
|
635
|
-
export {
|
|
636
|
-
ScriptObjectSettings,
|
|
637
|
-
ScriptProperties,
|
|
638
|
-
ScriptPluginSettings,
|
|
639
|
-
TestPanel,
|
|
640
|
-
TestContainer,
|
|
641
|
-
ScriptContainer,
|
|
642
|
-
DeploymentDialog,
|
|
643
|
-
NotebookContainer
|
|
644
|
-
};
|
|
645
|
-
//# sourceMappingURL=chunk-OZ6LCME4.mjs.map
|