@dxos/plugin-script 0.8.4-main.ae835ea → 0.8.4-main.bc674ce
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/browser/DeploymentDialog-OSL6RMPA.mjs +14 -0
- package/dist/lib/browser/{NotebookContainer-C36N7AFF.mjs → NotebookContainer-NBAXYESH.mjs} +267 -239
- package/dist/lib/browser/NotebookContainer-NBAXYESH.mjs.map +7 -0
- package/dist/lib/browser/ScriptContainer-WD33CJMI.mjs +149 -0
- package/dist/lib/browser/ScriptContainer-WD33CJMI.mjs.map +7 -0
- package/dist/lib/browser/app-graph-builder-7VO7AUI6.mjs +68 -0
- package/dist/lib/browser/app-graph-builder-7VO7AUI6.mjs.map +7 -0
- package/dist/lib/browser/blueprint-definition-OSOUYI7A.mjs +17 -0
- package/dist/lib/browser/blueprint-definition-OSOUYI7A.mjs.map +7 -0
- package/dist/lib/browser/blueprints/index.mjs +8 -0
- package/dist/lib/browser/chunk-BTWHM6FH.mjs +270 -0
- package/dist/lib/browser/chunk-BTWHM6FH.mjs.map +7 -0
- package/dist/lib/browser/chunk-C53UJGSU.mjs +557 -0
- package/dist/lib/browser/chunk-C53UJGSU.mjs.map +7 -0
- package/dist/lib/browser/chunk-F3QKSKSF.mjs +35 -0
- package/dist/lib/browser/chunk-F3QKSKSF.mjs.map +7 -0
- package/dist/lib/browser/chunk-I7CSE6T3.mjs +110 -0
- package/dist/lib/browser/chunk-I7CSE6T3.mjs.map +7 -0
- package/dist/lib/browser/chunk-TWX2NMZN.mjs +137 -0
- package/dist/lib/browser/chunk-TWX2NMZN.mjs.map +7 -0
- package/dist/lib/browser/chunk-UUR4JNNB.mjs +113 -0
- package/dist/lib/browser/chunk-UUR4JNNB.mjs.map +7 -0
- package/dist/lib/browser/{chunk-ST3ACVUC.mjs → chunk-UX4GHJ5E.mjs} +29 -12
- package/dist/lib/browser/chunk-UX4GHJ5E.mjs.map +7 -0
- package/dist/lib/browser/{chunk-EB6AXFXO.mjs → chunk-WYR4QHPE.mjs} +1 -1
- package/dist/lib/browser/chunk-WYR4QHPE.mjs.map +7 -0
- package/dist/lib/browser/chunk-XCN4D3Z5.mjs +606 -0
- package/dist/lib/browser/chunk-XCN4D3Z5.mjs.map +7 -0
- package/dist/lib/browser/compiler-76F3QAXC.mjs +161 -0
- package/dist/lib/browser/compiler-76F3QAXC.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +96 -126
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/operation-resolver-HUILPPKT.mjs +82 -0
- package/dist/lib/browser/operation-resolver-HUILPPKT.mjs.map +7 -0
- package/dist/lib/browser/{react-surface-X4NATU6B.mjs → react-surface-O6GKHB2J.mjs} +52 -41
- package/dist/lib/browser/react-surface-O6GKHB2J.mjs.map +7 -0
- package/dist/lib/browser/settings-3ENI25PI.mjs +35 -0
- package/dist/lib/browser/settings-3ENI25PI.mjs.map +7 -0
- package/dist/lib/browser/templates/index.mjs +1 -1
- package/dist/lib/browser/types/index.mjs +9 -5
- package/dist/lib/node-esm/{DeploymentDialog-OSHHSEBH.mjs → DeploymentDialog-OGBJPVIX.mjs} +6 -6
- package/dist/lib/node-esm/DeploymentDialog-OGBJPVIX.mjs.map +7 -0
- package/dist/lib/node-esm/{NotebookContainer-FOVFGJQR.mjs → NotebookContainer-IUAYVJSD.mjs} +267 -239
- package/dist/lib/node-esm/NotebookContainer-IUAYVJSD.mjs.map +7 -0
- package/dist/lib/node-esm/ScriptContainer-K7JCEU5Z.mjs +150 -0
- package/dist/lib/node-esm/ScriptContainer-K7JCEU5Z.mjs.map +7 -0
- package/dist/lib/node-esm/app-graph-builder-NVE3EVBG.mjs +69 -0
- package/dist/lib/node-esm/app-graph-builder-NVE3EVBG.mjs.map +7 -0
- package/dist/lib/node-esm/blueprint-definition-NC7NNJGI.mjs +18 -0
- package/dist/lib/node-esm/blueprint-definition-NC7NNJGI.mjs.map +7 -0
- package/dist/lib/node-esm/blueprints/index.mjs +9 -0
- package/dist/lib/node-esm/blueprints/index.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-2GVTWESW.mjs → chunk-4F5FJZ36.mjs} +29 -12
- package/dist/lib/node-esm/chunk-4F5FJZ36.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-4QNZMXW6.mjs +607 -0
- package/dist/lib/node-esm/chunk-4QNZMXW6.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-IBV2DR36.mjs → chunk-5HSJPAK7.mjs} +1 -1
- package/dist/lib/node-esm/chunk-5HSJPAK7.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-BX5PP6AW.mjs +558 -0
- package/dist/lib/node-esm/chunk-BX5PP6AW.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-G3J76DWP.mjs +114 -0
- package/dist/lib/node-esm/chunk-G3J76DWP.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-SLU3KRV3.mjs +112 -0
- package/dist/lib/node-esm/chunk-SLU3KRV3.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-VQPIA4VF.mjs +138 -0
- package/dist/lib/node-esm/chunk-VQPIA4VF.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-VWOLKNMO.mjs +271 -0
- package/dist/lib/node-esm/chunk-VWOLKNMO.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-Y3G5NCTP.mjs +36 -0
- package/dist/lib/node-esm/chunk-Y3G5NCTP.mjs.map +7 -0
- package/dist/lib/node-esm/compiler-FNZH6TFN.mjs +162 -0
- package/dist/lib/node-esm/compiler-FNZH6TFN.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +96 -126
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/operation-resolver-JTCIY6HU.mjs +83 -0
- package/dist/lib/node-esm/operation-resolver-JTCIY6HU.mjs.map +7 -0
- package/dist/lib/node-esm/{react-surface-LVGLBSTE.mjs → react-surface-RLANMVMB.mjs} +52 -41
- package/dist/lib/node-esm/react-surface-RLANMVMB.mjs.map +7 -0
- package/dist/lib/node-esm/settings-7AYC5VXN.mjs +36 -0
- package/dist/lib/node-esm/settings-7AYC5VXN.mjs.map +7 -0
- package/dist/lib/node-esm/templates/index.mjs +1 -1
- package/dist/lib/node-esm/types/index.mjs +9 -5
- package/dist/types/src/ScriptPlugin.d.ts +2 -1
- package/dist/types/src/ScriptPlugin.d.ts.map +1 -1
- package/dist/types/src/blueprints/index.d.ts +2 -0
- package/dist/types/src/blueprints/index.d.ts.map +1 -0
- package/dist/types/src/blueprints/script-blueprint.d.ts +22 -0
- package/dist/types/src/blueprints/script-blueprint.d.ts.map +1 -0
- package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts +6 -0
- package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts.map +1 -0
- package/dist/types/src/capabilities/app-graph-builder/index.d.ts +3 -0
- package/dist/types/src/capabilities/app-graph-builder/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/artifact-definition/artifact-definition.d.ts +12 -0
- package/dist/types/src/capabilities/artifact-definition/artifact-definition.d.ts.map +1 -0
- package/dist/types/src/capabilities/artifact-definition/index.d.ts +3 -0
- package/dist/types/src/capabilities/artifact-definition/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/blueprint-definition/blueprint-definition.d.ts +9 -0
- package/dist/types/src/capabilities/blueprint-definition/blueprint-definition.d.ts.map +1 -0
- package/dist/types/src/capabilities/blueprint-definition/index.d.ts +3 -0
- package/dist/types/src/capabilities/blueprint-definition/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/compiler/compiler.d.ts +6 -0
- package/dist/types/src/capabilities/compiler/compiler.d.ts.map +1 -0
- package/dist/types/src/capabilities/compiler/index.d.ts +3 -0
- package/dist/types/src/capabilities/compiler/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +6 -7
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/operation-resolver/index.d.ts +3 -0
- package/dist/types/src/capabilities/operation-resolver/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts +5 -0
- package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface/index.d.ts +3 -0
- package/dist/types/src/capabilities/react-surface/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts +5 -0
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +1 -0
- package/dist/types/src/capabilities/settings/index.d.ts +7 -0
- package/dist/types/src/capabilities/settings/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/settings/settings.d.ts +9 -0
- package/dist/types/src/capabilities/settings/settings.d.ts.map +1 -0
- package/dist/types/src/compiler/compiler.d.ts +1 -1
- package/dist/types/src/compiler/compiler.d.ts.map +1 -1
- package/dist/types/src/components/DeploymentDialog/DeploymentDialog.d.ts +2 -2
- package/dist/types/src/components/DeploymentDialog/DeploymentDialog.d.ts.map +1 -1
- package/dist/types/src/components/DeploymentDialog/DeploymentDialog.stories.d.ts +4 -3
- package/dist/types/src/components/DeploymentDialog/DeploymentDialog.stories.d.ts.map +1 -1
- package/dist/types/src/components/FrameContainer/FrameContainer.d.ts +1 -1
- package/dist/types/src/components/FrameContainer/FrameContainer.d.ts.map +1 -1
- package/dist/types/src/components/NotebookContainer.d.ts +3 -5
- package/dist/types/src/components/NotebookContainer.d.ts.map +1 -1
- package/dist/types/src/components/NotebookContainer.stories.d.ts +3 -247
- package/dist/types/src/components/NotebookContainer.stories.d.ts.map +1 -1
- package/dist/types/src/components/NotebookStack/NotebookCell.d.ts +3 -3
- package/dist/types/src/components/NotebookStack/NotebookCell.d.ts.map +1 -1
- package/dist/types/src/components/NotebookStack/NotebookStack.d.ts +1 -1
- package/dist/types/src/components/NotebookStack/NotebookStack.d.ts.map +1 -1
- package/dist/types/src/components/NotebookStack/NotebookStack.stories.d.ts +5 -1
- package/dist/types/src/components/NotebookStack/NotebookStack.stories.d.ts.map +1 -1
- package/dist/types/src/components/QueryEditor/QueryEditor.d.ts +5 -0
- package/dist/types/src/components/QueryEditor/QueryEditor.d.ts.map +1 -0
- package/dist/types/src/components/QueryEditor/QueryEditor.stories.d.ts +13 -0
- package/dist/types/src/components/QueryEditor/QueryEditor.stories.d.ts.map +1 -0
- package/dist/types/src/components/QueryEditor/index.d.ts +2 -0
- package/dist/types/src/components/QueryEditor/index.d.ts.map +1 -0
- package/dist/types/src/components/ScriptContainer.d.ts +4 -5
- package/dist/types/src/components/ScriptContainer.d.ts.map +1 -1
- package/dist/types/src/components/ScriptToolbar/ScriptToolbar.d.ts +2 -2
- package/dist/types/src/components/ScriptToolbar/ScriptToolbar.d.ts.map +1 -1
- package/dist/types/src/components/ScriptToolbar/ScriptToolbar.stories.d.ts +5 -1
- package/dist/types/src/components/ScriptToolbar/ScriptToolbar.stories.d.ts.map +1 -1
- package/dist/types/src/components/Settings/ScriptObjectSettings.d.ts.map +1 -1
- package/dist/types/src/components/Settings/ScriptPluginSettings.d.ts +4 -2
- package/dist/types/src/components/Settings/ScriptPluginSettings.d.ts.map +1 -1
- package/dist/types/src/components/TestPanel/TestContainer.d.ts +1 -1
- package/dist/types/src/components/TestPanel/TestContainer.d.ts.map +1 -1
- package/dist/types/src/components/TestPanel/TestPanel.d.ts.map +1 -1
- package/dist/types/src/components/TypescriptEditor/TypescriptEditor.d.ts +3 -2
- package/dist/types/src/components/TypescriptEditor/TypescriptEditor.d.ts.map +1 -1
- package/dist/types/src/components/TypescriptEditor/TypescriptEditor.stories.d.ts +1 -1
- package/dist/types/src/components/TypescriptEditor/TypescriptEditor.stories.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +2 -2
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/e2e/ai.test.d.ts +2 -0
- package/dist/types/src/e2e/ai.test.d.ts.map +1 -0
- package/dist/types/src/e2e/deploy.test.d.ts +2 -0
- package/dist/types/src/e2e/deploy.test.d.ts.map +1 -0
- package/dist/types/src/hooks/deploy.d.ts +10 -25
- package/dist/types/src/hooks/deploy.d.ts.map +1 -1
- package/dist/types/src/hooks/format.d.ts +2 -2
- package/dist/types/src/hooks/format.d.ts.map +1 -1
- package/dist/types/src/hooks/index.d.ts +1 -0
- package/dist/types/src/hooks/index.d.ts.map +1 -1
- package/dist/types/src/hooks/template.d.ts +2 -2
- package/dist/types/src/hooks/template.d.ts.map +1 -1
- package/dist/types/src/hooks/useCompiler.d.ts +7 -0
- package/dist/types/src/hooks/useCompiler.d.ts.map +1 -0
- package/dist/types/src/hooks/useCreateAndDeployScriptTemplates.d.ts.map +1 -1
- package/dist/types/src/hooks/useToolbarState.d.ts +8 -1
- package/dist/types/src/hooks/useToolbarState.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +1 -1
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +2 -2
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/notebook/compute-graph.d.ts +24 -11
- package/dist/types/src/notebook/compute-graph.d.ts.map +1 -1
- package/dist/types/src/templates/anthropic.d.ts +8 -0
- package/dist/types/src/templates/anthropic.d.ts.map +1 -0
- package/dist/types/src/templates/chess-bot.d.ts +16 -0
- package/dist/types/src/templates/chess-bot.d.ts.map +1 -0
- package/dist/types/src/templates/commentary.d.ts +16 -0
- package/dist/types/src/templates/commentary.d.ts.map +1 -0
- package/dist/types/src/templates/forex-effect.d.ts +4 -1
- package/dist/types/src/templates/forex-effect.d.ts.map +1 -1
- package/dist/types/src/templates/forex.d.ts +4 -1
- package/dist/types/src/templates/forex.d.ts.map +1 -1
- package/dist/types/src/templates/index.d.ts +12 -3
- package/dist/types/src/templates/index.d.ts.map +1 -1
- package/dist/types/src/templates/ping.d.ts +1 -4
- package/dist/types/src/templates/ping.d.ts.map +1 -1
- package/dist/types/src/testing/simulator.test.d.ts +2 -0
- package/dist/types/src/testing/simulator.test.d.ts.map +1 -0
- package/dist/types/src/translations.d.ts +2 -0
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/Notebook.d.ts +91 -22
- package/dist/types/src/types/Notebook.d.ts.map +1 -1
- package/dist/types/src/types/actions.d.ts +30 -44
- package/dist/types/src/types/actions.d.ts.map +1 -1
- package/dist/types/src/types/capabilities.d.ts +12 -0
- package/dist/types/src/types/capabilities.d.ts.map +1 -0
- package/dist/types/src/types/events.d.ts +5 -0
- package/dist/types/src/types/events.d.ts.map +1 -0
- package/dist/types/src/types/index.d.ts +2 -0
- package/dist/types/src/types/index.d.ts.map +1 -1
- package/dist/types/src/util/deploy.d.ts.map +1 -1
- package/dist/types/src/util/functions.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +113 -85
- package/src/ScriptPlugin.tsx +36 -75
- package/src/blueprints/index.ts +5 -0
- package/src/blueprints/script-blueprint.ts +24 -0
- package/src/capabilities/app-graph-builder/app-graph-builder.ts +55 -0
- package/src/capabilities/app-graph-builder/index.ts +7 -0
- package/src/capabilities/{artifact-definition.ts → artifact-definition/artifact-definition.ts} +97 -95
- package/src/capabilities/artifact-definition/index.ts +7 -0
- package/src/capabilities/blueprint-definition/blueprint-definition.ts +23 -0
- package/src/capabilities/blueprint-definition/index.ts +7 -0
- package/src/capabilities/compiler/compiler.ts +103 -0
- package/src/capabilities/compiler/index.ts +7 -0
- package/src/capabilities/index.ts +6 -10
- package/src/capabilities/operation-resolver/index.ts +7 -0
- package/src/capabilities/operation-resolver/operation-resolver.ts +74 -0
- package/src/capabilities/react-surface/index.ts +7 -0
- package/src/capabilities/react-surface/react-surface.tsx +118 -0
- package/src/capabilities/settings/index.ts +7 -0
- package/src/capabilities/settings/settings.ts +32 -0
- package/src/compiler/compiler.ts +10 -3
- package/src/components/DeploymentDialog/DeploymentDialog.stories.tsx +28 -24
- package/src/components/DeploymentDialog/DeploymentDialog.tsx +38 -41
- package/src/components/FrameContainer/FrameContainer.tsx +6 -4
- package/src/components/NotebookContainer.stories.tsx +23 -19
- package/src/components/NotebookContainer.tsx +69 -61
- package/src/components/NotebookStack/NotebookCell.tsx +36 -27
- package/src/components/NotebookStack/NotebookStack.stories.tsx +19 -18
- package/src/components/NotebookStack/NotebookStack.tsx +4 -4
- package/src/components/QueryEditor/QueryEditor.stories.tsx +100 -0
- package/src/components/QueryEditor/QueryEditor.tsx +47 -0
- package/src/components/QueryEditor/index.ts +5 -0
- package/src/components/ScriptContainer.tsx +48 -33
- package/src/components/ScriptToolbar/ScriptToolbar.stories.tsx +38 -15
- package/src/components/ScriptToolbar/ScriptToolbar.tsx +18 -21
- package/src/components/Settings/ScriptObjectSettings.tsx +54 -31
- package/src/components/Settings/ScriptPluginSettings.tsx +8 -3
- package/src/components/TestPanel/TestContainer.tsx +5 -5
- package/src/components/TestPanel/TestPanel.tsx +36 -13
- package/src/components/TypescriptEditor/TypescriptEditor.stories.tsx +14 -9
- package/src/components/TypescriptEditor/TypescriptEditor.tsx +69 -69
- package/src/e2e/ai.test.ts +92 -0
- package/src/e2e/deploy.test.ts +64 -0
- package/src/hooks/deploy.ts +36 -28
- package/src/hooks/format.ts +5 -1
- package/src/hooks/index.ts +1 -0
- package/src/hooks/template.ts +15 -9
- package/src/hooks/useCompiler.ts +24 -0
- package/src/hooks/useCreateAndDeployScriptTemplates.ts +13 -15
- package/src/hooks/useToolbarState.ts +29 -5
- package/src/index.ts +1 -1
- package/src/meta.ts +2 -2
- package/src/notebook/compute-graph.test.ts +20 -8
- package/src/notebook/compute-graph.ts +45 -21
- package/src/templates/anthropic.ts +42 -0
- package/src/templates/chess-bot.ts +58 -0
- package/src/templates/commentary.ts +232 -0
- package/src/templates/data-generator.ts +1 -1
- package/src/templates/forex-effect.ts +22 -27
- package/src/templates/forex.ts +7 -6
- package/src/templates/gmail.ts +1 -2
- package/src/templates/index.ts +18 -5
- package/src/templates/ping.ts +14 -5
- package/src/testing/data.ts +7 -7
- package/src/testing/simulator.test.ts +40 -0
- package/src/translations.ts +2 -0
- package/src/types/Notebook.ts +12 -12
- package/src/types/actions.ts +17 -25
- package/src/types/capabilities.ts +17 -0
- package/src/types/events.ts +11 -0
- package/src/types/index.ts +2 -0
- package/src/types/types.ts +1 -1
- package/src/util/deploy.ts +23 -29
- package/src/util/functions.ts +29 -25
- package/src/vite-env.d.ts +2 -0
- package/dist/lib/browser/DeploymentDialog-E5NXT4UQ.mjs +0 -14
- package/dist/lib/browser/NotebookContainer-C36N7AFF.mjs.map +0 -7
- package/dist/lib/browser/ScriptContainer-4YPRUM3C.mjs +0 -148
- package/dist/lib/browser/ScriptContainer-4YPRUM3C.mjs.map +0 -7
- package/dist/lib/browser/app-graph-builder-LEOPGBJD.mjs +0 -66
- package/dist/lib/browser/app-graph-builder-LEOPGBJD.mjs.map +0 -7
- package/dist/lib/browser/blueprint-definition-6PZWZM2Y.mjs +0 -30
- package/dist/lib/browser/blueprint-definition-6PZWZM2Y.mjs.map +0 -7
- package/dist/lib/browser/chunk-5S5YQNJZ.mjs +0 -304
- package/dist/lib/browser/chunk-5S5YQNJZ.mjs.map +0 -7
- package/dist/lib/browser/chunk-A5K3TXYA.mjs +0 -269
- package/dist/lib/browser/chunk-A5K3TXYA.mjs.map +0 -7
- package/dist/lib/browser/chunk-EB6AXFXO.mjs.map +0 -7
- package/dist/lib/browser/chunk-HCURXADW.mjs +0 -102
- package/dist/lib/browser/chunk-HCURXADW.mjs.map +0 -7
- package/dist/lib/browser/chunk-HHTOAI2J.mjs +0 -644
- package/dist/lib/browser/chunk-HHTOAI2J.mjs.map +0 -7
- package/dist/lib/browser/chunk-IQMYIWHG.mjs +0 -153
- package/dist/lib/browser/chunk-IQMYIWHG.mjs.map +0 -7
- package/dist/lib/browser/chunk-LI4P25M5.mjs +0 -111
- package/dist/lib/browser/chunk-LI4P25M5.mjs.map +0 -7
- package/dist/lib/browser/chunk-Q2DGRQRN.mjs +0 -255
- package/dist/lib/browser/chunk-Q2DGRQRN.mjs.map +0 -7
- package/dist/lib/browser/chunk-ST3ACVUC.mjs.map +0 -7
- package/dist/lib/browser/chunk-UOQ6NCH3.mjs +0 -15
- package/dist/lib/browser/chunk-UOQ6NCH3.mjs.map +0 -7
- package/dist/lib/browser/compiler-Q4UY2COU.mjs +0 -86
- package/dist/lib/browser/compiler-Q4UY2COU.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-AMMHATM7.mjs +0 -105
- package/dist/lib/browser/intent-resolver-AMMHATM7.mjs.map +0 -7
- package/dist/lib/browser/react-surface-X4NATU6B.mjs.map +0 -7
- package/dist/lib/browser/settings-6UXY7F7D.mjs +0 -26
- package/dist/lib/browser/settings-6UXY7F7D.mjs.map +0 -7
- package/dist/lib/node-esm/NotebookContainer-FOVFGJQR.mjs.map +0 -7
- package/dist/lib/node-esm/ScriptContainer-EW24D5II.mjs +0 -149
- package/dist/lib/node-esm/ScriptContainer-EW24D5II.mjs.map +0 -7
- package/dist/lib/node-esm/app-graph-builder-XJ3MY5BM.mjs +0 -67
- package/dist/lib/node-esm/app-graph-builder-XJ3MY5BM.mjs.map +0 -7
- package/dist/lib/node-esm/blueprint-definition-5R6YCSZZ.mjs +0 -31
- package/dist/lib/node-esm/blueprint-definition-5R6YCSZZ.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-2GVTWESW.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-55JZVM6K.mjs +0 -16
- package/dist/lib/node-esm/chunk-55JZVM6K.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-EJLYOSD7.mjs +0 -113
- package/dist/lib/node-esm/chunk-EJLYOSD7.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-GA27XSEY.mjs +0 -270
- package/dist/lib/node-esm/chunk-GA27XSEY.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-IBV2DR36.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-N2XLVOFB.mjs +0 -103
- package/dist/lib/node-esm/chunk-N2XLVOFB.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-O7HXE72S.mjs +0 -256
- package/dist/lib/node-esm/chunk-O7HXE72S.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-OZ6LCME4.mjs +0 -645
- package/dist/lib/node-esm/chunk-OZ6LCME4.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-TUGLYZDT.mjs +0 -305
- package/dist/lib/node-esm/chunk-TUGLYZDT.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-UEGPBCSF.mjs +0 -154
- package/dist/lib/node-esm/chunk-UEGPBCSF.mjs.map +0 -7
- package/dist/lib/node-esm/compiler-I6A4KE6E.mjs +0 -87
- package/dist/lib/node-esm/compiler-I6A4KE6E.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-YKLZQR7U.mjs +0 -106
- package/dist/lib/node-esm/intent-resolver-YKLZQR7U.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-LVGLBSTE.mjs.map +0 -7
- package/dist/lib/node-esm/settings-O4EZPUE3.mjs +0 -27
- package/dist/lib/node-esm/settings-O4EZPUE3.mjs.map +0 -7
- package/dist/types/src/capabilities/app-graph-builder.d.ts +0 -4
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +0 -1
- package/dist/types/src/capabilities/artifact-definition.d.ts +0 -11
- package/dist/types/src/capabilities/artifact-definition.d.ts.map +0 -1
- package/dist/types/src/capabilities/blueprint-definition.d.ts +0 -5
- package/dist/types/src/capabilities/blueprint-definition.d.ts.map +0 -1
- package/dist/types/src/capabilities/capabilities.d.ts +0 -5
- package/dist/types/src/capabilities/capabilities.d.ts.map +0 -1
- package/dist/types/src/capabilities/compiler.d.ts +0 -4
- package/dist/types/src/capabilities/compiler.d.ts.map +0 -1
- package/dist/types/src/capabilities/intent-resolver.d.ts +0 -4
- package/dist/types/src/capabilities/intent-resolver.d.ts.map +0 -1
- package/dist/types/src/capabilities/react-surface.d.ts +0 -4
- package/dist/types/src/capabilities/react-surface.d.ts.map +0 -1
- package/dist/types/src/capabilities/settings.d.ts +0 -4
- package/dist/types/src/capabilities/settings.d.ts.map +0 -1
- package/dist/types/src/events.d.ts +0 -4
- package/dist/types/src/events.d.ts.map +0 -1
- package/dist/types/src/templates/chess.d.ts +0 -3
- package/dist/types/src/templates/chess.d.ts.map +0 -1
- package/src/capabilities/app-graph-builder.ts +0 -65
- package/src/capabilities/blueprint-definition.ts +0 -30
- package/src/capabilities/capabilities.ts +0 -12
- package/src/capabilities/compiler.ts +0 -34
- package/src/capabilities/intent-resolver.ts +0 -86
- package/src/capabilities/react-surface.tsx +0 -102
- package/src/capabilities/settings.ts +0 -21
- package/src/events.ts +0 -11
- package/src/templates/chess.ts +0 -49
- /package/dist/lib/browser/{DeploymentDialog-E5NXT4UQ.mjs.map → DeploymentDialog-OSL6RMPA.mjs.map} +0 -0
- /package/dist/lib/{node-esm/DeploymentDialog-OSHHSEBH.mjs.map → browser/blueprints/index.mjs.map} +0 -0
|
@@ -2,41 +2,36 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
} from '
|
|
13
|
-
// @ts-ignore
|
|
14
|
-
import * as Effect from 'https://esm.sh/effect@3.17.0/Effect?bundle=false';
|
|
15
|
-
// @ts-ignore
|
|
16
|
-
import * as Schedule from 'https://esm.sh/effect@3.17.0/Schedule?bundle=false';
|
|
5
|
+
import * as FetchHttpClient from '@effect/platform/FetchHttpClient';
|
|
6
|
+
import * as HttpClient from '@effect/platform/HttpClient';
|
|
7
|
+
import * as HttpClientRequest from '@effect/platform/HttpClientRequest';
|
|
8
|
+
import * as Effect from 'effect/Effect';
|
|
9
|
+
import * as Schedule from 'effect/Schedule';
|
|
10
|
+
import * as Schema from 'effect/Schema';
|
|
11
|
+
|
|
12
|
+
import { defineFunction } from '@dxos/functions';
|
|
17
13
|
|
|
18
14
|
export default defineFunction({
|
|
19
15
|
key: 'dxos.org/script/forex-effect',
|
|
20
16
|
name: 'Forex Effect',
|
|
21
17
|
description: 'Returns the exchange rate between two currencies.',
|
|
22
18
|
|
|
23
|
-
inputSchema:
|
|
24
|
-
from:
|
|
25
|
-
to:
|
|
19
|
+
inputSchema: Schema.Struct({
|
|
20
|
+
from: Schema.String.annotations({ description: 'The source currency' }),
|
|
21
|
+
to: Schema.String.annotations({ description: 'The target currency' }),
|
|
26
22
|
}),
|
|
27
23
|
|
|
28
|
-
outputSchema:
|
|
24
|
+
outputSchema: Schema.String.annotations({ description: 'The exchange rate between the two currencies' }),
|
|
29
25
|
|
|
30
|
-
handler:
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
);
|
|
26
|
+
handler: Effect.fnUntraced(function* ({ data: { from, to } }) {
|
|
27
|
+
const res = yield* HttpClientRequest.get(`https://free.ratesdb.com/v1/rates?from=${from}&to=${to}`).pipe(
|
|
28
|
+
HttpClient.execute,
|
|
29
|
+
Effect.flatMap((res: any) => res.json),
|
|
30
|
+
Effect.timeout('1 second'),
|
|
31
|
+
Effect.retry(Schedule.exponential(1_000).pipe(Schedule.compose(Schedule.recurs(3)))),
|
|
32
|
+
Effect.scoped,
|
|
33
|
+
);
|
|
39
34
|
|
|
40
|
-
|
|
41
|
-
|
|
35
|
+
return (res as any).data.rates[to].toString();
|
|
36
|
+
}, Effect.provide(FetchHttpClient.layer)),
|
|
42
37
|
});
|
package/src/templates/forex.ts
CHANGED
|
@@ -2,20 +2,21 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
import * as Schema from 'effect/Schema';
|
|
6
|
+
|
|
7
|
+
import { defineFunction } from '@dxos/functions';
|
|
7
8
|
|
|
8
9
|
export default defineFunction({
|
|
9
10
|
key: 'dxos.org/script/forex',
|
|
10
11
|
name: 'Forex',
|
|
11
12
|
description: 'Returns the exchange rate between two currencies.',
|
|
12
13
|
|
|
13
|
-
inputSchema:
|
|
14
|
-
from:
|
|
15
|
-
to:
|
|
14
|
+
inputSchema: Schema.Struct({
|
|
15
|
+
from: Schema.String.annotations({ description: 'The source currency' }),
|
|
16
|
+
to: Schema.String.annotations({ description: 'The target currency' }),
|
|
16
17
|
}),
|
|
17
18
|
|
|
18
|
-
handler: async ({ data: { from, to } }
|
|
19
|
+
handler: async ({ data: { from, to } }) => {
|
|
19
20
|
const res = await fetch(`https://free.ratesdb.com/v1/rates?from=${from}&to=${to}`);
|
|
20
21
|
const {
|
|
21
22
|
data: { rates },
|
package/src/templates/gmail.ts
CHANGED
|
@@ -175,8 +175,7 @@ const parseFromHeader = (value: string): { name?: string; email: string } | unde
|
|
|
175
175
|
// TODO(wittjosiah): These schemas should be imported from @dxos/schema.
|
|
176
176
|
//
|
|
177
177
|
|
|
178
|
-
const
|
|
179
|
-
const ActorRole = S.Literal(...ActorRoles);
|
|
178
|
+
const ActorRole = S.Literal('user', 'assistant');
|
|
180
179
|
type ActorRole = S.Schema.Type<typeof ActorRole>;
|
|
181
180
|
|
|
182
181
|
const ActorSchema = S.Struct({
|
package/src/templates/index.ts
CHANGED
|
@@ -2,8 +2,10 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
+
import anthropic from './anthropic.ts?raw';
|
|
5
6
|
import chat from './chat.ts?raw';
|
|
6
|
-
import
|
|
7
|
+
import chessBot from './chess-bot.ts?raw';
|
|
8
|
+
import commentary from './commentary.ts?raw';
|
|
7
9
|
import dataGenerator from './data-generator.ts?raw';
|
|
8
10
|
import discord from './discord.ts?raw';
|
|
9
11
|
import email from './email.ts?raw';
|
|
@@ -46,10 +48,10 @@ export const templates = [
|
|
|
46
48
|
presetId: 'dxos.org/function/gpt',
|
|
47
49
|
},
|
|
48
50
|
{
|
|
49
|
-
id: 'dxos.org/script/chess',
|
|
50
|
-
name: 'Chess',
|
|
51
|
-
source: removeHeader(
|
|
52
|
-
presetId: 'dxos.org/function/chess',
|
|
51
|
+
id: 'dxos.org/script/chess-bot',
|
|
52
|
+
name: 'Chess Bot',
|
|
53
|
+
source: removeHeader(chessBot),
|
|
54
|
+
presetId: 'dxos.org/function/chess-bot',
|
|
53
55
|
},
|
|
54
56
|
{
|
|
55
57
|
id: 'dxos.org/script/email',
|
|
@@ -75,4 +77,15 @@ export const templates = [
|
|
|
75
77
|
source: removeHeader(dataGenerator),
|
|
76
78
|
presetId: 'dxos.org/function/data-generator',
|
|
77
79
|
},
|
|
80
|
+
{
|
|
81
|
+
id: 'dxos.org/script/anthropic',
|
|
82
|
+
name: 'Anthropic',
|
|
83
|
+
source: removeHeader(anthropic),
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
id: 'dxos.org/script/commentary',
|
|
87
|
+
name: 'Commentary',
|
|
88
|
+
source: removeHeader(commentary),
|
|
89
|
+
presetId: 'dxos.org/function/chess/commentary',
|
|
90
|
+
},
|
|
78
91
|
] as const;
|
package/src/templates/ping.ts
CHANGED
|
@@ -1,8 +1,17 @@
|
|
|
1
1
|
//
|
|
2
|
-
// Copyright
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
import * as Schema from 'effect/Schema';
|
|
6
|
+
|
|
7
|
+
import { defineFunction } from '@dxos/functions';
|
|
8
|
+
|
|
9
|
+
export default defineFunction({
|
|
10
|
+
key: 'dxos.org/script/ping',
|
|
11
|
+
name: 'Ping',
|
|
12
|
+
inputSchema: Schema.Any,
|
|
13
|
+
|
|
14
|
+
handler: async ({ data }) => {
|
|
15
|
+
return data;
|
|
16
|
+
},
|
|
17
|
+
});
|
package/src/testing/data.ts
CHANGED
|
@@ -7,7 +7,7 @@ import { Ref } from '@dxos/echo';
|
|
|
7
7
|
import { createObject } from '@dxos/echo-db';
|
|
8
8
|
import { PublicKey } from '@dxos/keys';
|
|
9
9
|
import { Markdown } from '@dxos/plugin-markdown/types';
|
|
10
|
-
import {
|
|
10
|
+
import { Text } from '@dxos/schema';
|
|
11
11
|
|
|
12
12
|
import { Notebook } from '../types';
|
|
13
13
|
|
|
@@ -19,27 +19,27 @@ export const createNotebook = (): Notebook.Notebook =>
|
|
|
19
19
|
{
|
|
20
20
|
id: PublicKey.random().toString(),
|
|
21
21
|
type: 'script',
|
|
22
|
-
source: Ref.make(createObject(
|
|
22
|
+
source: Ref.make(createObject(Text.make('c = a() + b'))),
|
|
23
23
|
},
|
|
24
24
|
{
|
|
25
25
|
id: PublicKey.random().toString(),
|
|
26
26
|
type: 'script',
|
|
27
|
-
source: Ref.make(createObject(
|
|
27
|
+
source: Ref.make(createObject(Text.make('a = () => 100'))),
|
|
28
28
|
},
|
|
29
29
|
{
|
|
30
30
|
id: PublicKey.random().toString(),
|
|
31
31
|
type: 'script',
|
|
32
|
-
source: Ref.make(createObject(
|
|
32
|
+
source: Ref.make(createObject(Text.make('b = 200'))),
|
|
33
33
|
},
|
|
34
34
|
{
|
|
35
35
|
id: PublicKey.random().toString(),
|
|
36
36
|
type: 'script',
|
|
37
|
-
source: Ref.make(createObject(
|
|
37
|
+
source: Ref.make(createObject(Text.make('d = a() * 2'))),
|
|
38
38
|
},
|
|
39
39
|
{
|
|
40
40
|
id: PublicKey.random().toString(),
|
|
41
41
|
type: 'script',
|
|
42
|
-
source: Ref.make(createObject(
|
|
42
|
+
source: Ref.make(createObject(Text.make('c + d'))),
|
|
43
43
|
},
|
|
44
44
|
{
|
|
45
45
|
id: PublicKey.random().toString(),
|
|
@@ -55,7 +55,7 @@ export const createNotebook = (): Notebook.Notebook =>
|
|
|
55
55
|
{
|
|
56
56
|
id: PublicKey.random().toString(),
|
|
57
57
|
type: 'query',
|
|
58
|
-
source: Ref.make(createObject(
|
|
58
|
+
source: Ref.make(createObject(Text.make(`docs = (type: ${Markdown.Document.typename})`))),
|
|
59
59
|
},
|
|
60
60
|
{
|
|
61
61
|
id: PublicKey.random().toString(),
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { readFile } from 'node:fs/promises';
|
|
6
|
+
|
|
7
|
+
import * as Record from 'effect/Record';
|
|
8
|
+
import { describe, expect, test } from 'vitest';
|
|
9
|
+
|
|
10
|
+
import { bundleFunction } from '@dxos/functions-runtime/bundler';
|
|
11
|
+
import { FunctionWorker } from '@dxos/functions-simulator-cloudflare';
|
|
12
|
+
import { ErrorCodec } from '@dxos/protocols';
|
|
13
|
+
|
|
14
|
+
// Requires downloading assets from R2
|
|
15
|
+
describe.runIf(process.env.DX_TEST_TAGS?.includes('functions-e2e'))('Run script in sumulator', () => {
|
|
16
|
+
test('forex-effect', { timeout: 120_000 }, async () => {
|
|
17
|
+
const source = await readFile(new URL('../templates/forex-effect.ts', import.meta.url), 'utf-8');
|
|
18
|
+
|
|
19
|
+
// Bundle and upload.
|
|
20
|
+
const buildResult = await bundleFunction({ source });
|
|
21
|
+
if ('error' in buildResult) {
|
|
22
|
+
throw buildResult.error ?? new Error('Bundle creation failed');
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const worker = new FunctionWorker({
|
|
26
|
+
mainModule: buildResult.entryPoint,
|
|
27
|
+
modules: Record.map(buildResult.assets, (contents, filename) => ({
|
|
28
|
+
contents: contents as Uint8Array<ArrayBuffer>,
|
|
29
|
+
contentType: filename.endsWith('.wasm') ? 'application/wasm' : 'application/javascript',
|
|
30
|
+
})),
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
const result = await worker.invoke({ from: 'USD', to: 'EUR' });
|
|
34
|
+
console.log(result);
|
|
35
|
+
if (result._kind === 'error') {
|
|
36
|
+
throw ErrorCodec.decode(result.error);
|
|
37
|
+
}
|
|
38
|
+
expect(Number(result.result)).toBeGreaterThan(0);
|
|
39
|
+
});
|
|
40
|
+
});
|
package/src/translations.ts
CHANGED
|
@@ -19,6 +19,7 @@ export const translations = [
|
|
|
19
19
|
'object name placeholder': 'New script',
|
|
20
20
|
'rename object label': 'Rename script',
|
|
21
21
|
'delete object label': 'Delete script',
|
|
22
|
+
'object deleted label': 'Script deleted',
|
|
22
23
|
},
|
|
23
24
|
[Notebook.Notebook.typename]: {
|
|
24
25
|
'typename label': 'Notebook',
|
|
@@ -28,6 +29,7 @@ export const translations = [
|
|
|
28
29
|
'object name placeholder': 'New notebook',
|
|
29
30
|
'rename object label': 'Rename notebook',
|
|
30
31
|
'delete object label': 'Delete notebook',
|
|
32
|
+
'object deleted label': 'Notebook deleted',
|
|
31
33
|
},
|
|
32
34
|
[meta.id]: {
|
|
33
35
|
'plugin name': 'Scripts',
|
package/src/types/Notebook.ts
CHANGED
|
@@ -6,30 +6,30 @@ import * as Schema from 'effect/Schema';
|
|
|
6
6
|
|
|
7
7
|
import { Prompt } from '@dxos/blueprints';
|
|
8
8
|
import { Obj, Type } from '@dxos/echo';
|
|
9
|
-
import {
|
|
9
|
+
import { FormInputAnnotation } from '@dxos/echo/internal';
|
|
10
10
|
import { LabelAnnotation } from '@dxos/echo/internal';
|
|
11
|
-
import {
|
|
11
|
+
import { Graph } from '@dxos/plugin-explorer/types';
|
|
12
|
+
import { Text } from '@dxos/schema';
|
|
12
13
|
|
|
13
14
|
export type CellType = 'markdown' | 'script' | 'query' | 'prompt' | 'view';
|
|
14
15
|
|
|
15
|
-
const
|
|
16
|
+
export const Cell = Schema.Struct({
|
|
16
17
|
id: Schema.String,
|
|
17
18
|
type: Schema.String,
|
|
18
19
|
name: Schema.optional(Schema.String),
|
|
19
20
|
// TODO(burdon): Union type.
|
|
20
|
-
source: Schema.optional(Type.Ref(
|
|
21
|
+
source: Schema.optional(Type.Ref(Text.Text)),
|
|
21
22
|
prompt: Schema.optional(Type.Ref(Prompt.Prompt)),
|
|
22
|
-
|
|
23
|
-
})
|
|
24
|
-
|
|
25
|
-
export interface
|
|
26
|
-
export const Cell: Schema.Schema<Cell, Cell_Encoded> = Cell_;
|
|
23
|
+
graph: Schema.optional(Type.Ref(Graph.Graph)),
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
export interface Cell extends Schema.Schema.Type<typeof Cell> {}
|
|
27
27
|
|
|
28
28
|
export const Notebook = Schema.Struct({
|
|
29
29
|
name: Schema.String.pipe(Schema.optional),
|
|
30
|
-
cells: Cell.pipe(Schema.Array,
|
|
30
|
+
cells: Cell.pipe(Schema.Array, FormInputAnnotation.set(false)),
|
|
31
31
|
}).pipe(
|
|
32
|
-
Type.
|
|
32
|
+
Type.object({
|
|
33
33
|
typename: 'dxos.org/type/Notebook',
|
|
34
34
|
version: '0.1.0',
|
|
35
35
|
}),
|
|
@@ -38,4 +38,4 @@ export const Notebook = Schema.Struct({
|
|
|
38
38
|
|
|
39
39
|
export type Notebook = Schema.Schema.Type<typeof Notebook>;
|
|
40
40
|
|
|
41
|
-
export const make = (props: Obj.MakeProps<typeof Notebook> = { cells: [] }) => Obj.make(Notebook, props);
|
|
41
|
+
export const make = (props: Obj.MakeProps<typeof Notebook> = { cells: [] }): Notebook => Obj.make(Notebook, props);
|
package/src/types/actions.ts
CHANGED
|
@@ -4,15 +4,16 @@
|
|
|
4
4
|
|
|
5
5
|
import * as Schema from 'effect/Schema';
|
|
6
6
|
|
|
7
|
-
import {
|
|
7
|
+
import { Database } from '@dxos/echo';
|
|
8
8
|
import { Script } from '@dxos/functions';
|
|
9
|
+
import { Operation } from '@dxos/operation';
|
|
9
10
|
|
|
10
11
|
import { meta } from '../meta';
|
|
11
12
|
import { templates } from '../templates';
|
|
12
13
|
|
|
13
|
-
|
|
14
|
+
const SCRIPT_OPERATION = `${meta.id}/operation`;
|
|
14
15
|
|
|
15
|
-
export namespace
|
|
16
|
+
export namespace ScriptOperation {
|
|
16
17
|
export const ScriptProps = Schema.Struct({
|
|
17
18
|
name: Schema.optional(Schema.String),
|
|
18
19
|
// TODO(wittjosiah): Placeholder annotation?
|
|
@@ -23,31 +24,22 @@ export namespace ScriptAction {
|
|
|
23
24
|
),
|
|
24
25
|
});
|
|
25
26
|
|
|
26
|
-
export class CreateScript extends Schema.TaggedClass<CreateScript>()(`${meta.id}/action/create-script`, {
|
|
27
|
-
input: Schema.extend(
|
|
28
|
-
ScriptProps,
|
|
29
|
-
Schema.Struct({
|
|
30
|
-
space: SpaceSchema,
|
|
31
|
-
}),
|
|
32
|
-
),
|
|
33
|
-
output: Schema.Struct({
|
|
34
|
-
object: Script.Script,
|
|
35
|
-
}),
|
|
36
|
-
}) {}
|
|
37
|
-
|
|
38
27
|
export const NotebookProps = Schema.Struct({
|
|
39
28
|
name: Schema.optional(Schema.String),
|
|
40
29
|
});
|
|
41
30
|
|
|
42
|
-
export
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
Schema.
|
|
46
|
-
|
|
31
|
+
export const CreateScript = Operation.make({
|
|
32
|
+
meta: { key: `${SCRIPT_OPERATION}/create-script`, name: 'Create Script' },
|
|
33
|
+
schema: {
|
|
34
|
+
input: Schema.extend(
|
|
35
|
+
ScriptProps,
|
|
36
|
+
Schema.Struct({
|
|
37
|
+
db: Database.Database,
|
|
38
|
+
}),
|
|
39
|
+
),
|
|
40
|
+
output: Schema.Struct({
|
|
41
|
+
object: Script.Script,
|
|
47
42
|
}),
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
object: Notebook.Notebook,
|
|
51
|
-
}),
|
|
52
|
-
}) {}
|
|
43
|
+
},
|
|
44
|
+
});
|
|
53
45
|
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { type Atom } from '@effect-atom/atom-react';
|
|
6
|
+
|
|
7
|
+
import { Capability } from '@dxos/app-framework';
|
|
8
|
+
|
|
9
|
+
import { type Compiler } from '../compiler';
|
|
10
|
+
import { meta } from '../meta';
|
|
11
|
+
|
|
12
|
+
import { type ScriptSettings } from './types';
|
|
13
|
+
|
|
14
|
+
export namespace ScriptCapabilities {
|
|
15
|
+
export const Settings = Capability.make<Atom.Writable<ScriptSettings>>(`${meta.id}/capability/settings`);
|
|
16
|
+
export const Compiler = Capability.make<Compiler>(`${meta.id}/capability/compiler`);
|
|
17
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { ActivationEvent } from '@dxos/app-framework';
|
|
6
|
+
|
|
7
|
+
import { meta } from '../meta';
|
|
8
|
+
|
|
9
|
+
export namespace ScriptEvents {
|
|
10
|
+
export const SetupCompiler = ActivationEvent.make(`${meta.id}/event/setup-compiler`);
|
|
11
|
+
}
|
package/src/types/index.ts
CHANGED
package/src/types/types.ts
CHANGED
package/src/util/deploy.ts
CHANGED
|
@@ -4,14 +4,12 @@
|
|
|
4
4
|
|
|
5
5
|
import { type Client } from '@dxos/client';
|
|
6
6
|
import { Obj, Ref } from '@dxos/echo';
|
|
7
|
-
import { Function, type Script, getUserFunctionIdInMetadata
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
7
|
+
import { Function, type Script, getUserFunctionIdInMetadata } from '@dxos/functions';
|
|
8
|
+
import { bundleFunction } from '@dxos/functions-runtime/bundler';
|
|
9
|
+
import { FunctionsServiceClient, incrementSemverPatch } from '@dxos/functions-runtime/edge';
|
|
10
10
|
import { log } from '@dxos/log';
|
|
11
|
+
import { FunctionRuntimeKind } from '@dxos/protocols';
|
|
11
12
|
import { type Space } from '@dxos/react-client/echo';
|
|
12
|
-
import { isNode } from '@dxos/util';
|
|
13
|
-
|
|
14
|
-
import { updateFunctionMetadata } from './functions';
|
|
15
13
|
|
|
16
14
|
export const isScriptDeployed = ({ script, fn }: { script: Script.Script; fn: any }): boolean => {
|
|
17
15
|
const existingFunctionId = fn && getUserFunctionIdInMetadata(Obj.getMeta(fn));
|
|
@@ -44,32 +42,30 @@ export const deployScript = async ({
|
|
|
44
42
|
}
|
|
45
43
|
|
|
46
44
|
try {
|
|
47
|
-
const
|
|
48
|
-
|
|
45
|
+
const buildResult = await bundleFunction({
|
|
46
|
+
source: script.source!.target!.content,
|
|
47
|
+
});
|
|
49
48
|
if ('error' in buildResult) {
|
|
50
49
|
throw buildResult.error || new Error('Bundle creation failed');
|
|
51
50
|
}
|
|
52
51
|
|
|
53
|
-
const
|
|
54
|
-
|
|
52
|
+
const functionsServiceClient = FunctionsServiceClient.fromClient(client);
|
|
53
|
+
const newFunction = await functionsServiceClient.deploy({
|
|
54
|
+
// TODO(dmaretskyi): Space key or identity key.
|
|
55
55
|
ownerPublicKey: space.key,
|
|
56
56
|
version: fn ? incrementSemverPatch(fn.version) : '0.0.1',
|
|
57
57
|
functionId: existingFunctionId,
|
|
58
58
|
entryPoint: buildResult.entryPoint,
|
|
59
|
-
assets:
|
|
59
|
+
assets: buildResult.assets,
|
|
60
|
+
runtime: FunctionRuntimeKind.enums.WORKER_LOADER,
|
|
60
61
|
});
|
|
61
62
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
const storedFunction = createOrUpdateFunctionInSpace(space, fn, script, functionId, version);
|
|
67
|
-
script.changed = false;
|
|
68
|
-
updateFunctionMetadata(script, storedFunction, meta, functionId);
|
|
69
|
-
|
|
70
|
-
setUserFunctionIdInMetadata(Obj.getMeta(storedFunction), functionId);
|
|
63
|
+
const storedFunction = createOrUpdateFunctionInSpace(space, fn, script, newFunction);
|
|
64
|
+
Obj.change(script, (s) => {
|
|
65
|
+
s.changed = false;
|
|
66
|
+
});
|
|
71
67
|
|
|
72
|
-
return { success: true, functionId };
|
|
68
|
+
return { success: true, functionId: getUserFunctionIdInMetadata(Obj.getMeta(storedFunction)) };
|
|
73
69
|
} catch (err: any) {
|
|
74
70
|
log.catch(err);
|
|
75
71
|
return { success: false, error: err };
|
|
@@ -90,17 +86,15 @@ const createOrUpdateFunctionInSpace = (
|
|
|
90
86
|
space: Space,
|
|
91
87
|
fn: Function.Function | undefined,
|
|
92
88
|
script: Script.Script,
|
|
93
|
-
|
|
94
|
-
version: string,
|
|
89
|
+
newFunction: Function.Function,
|
|
95
90
|
): Function.Function => {
|
|
96
91
|
if (fn) {
|
|
97
|
-
fn
|
|
98
|
-
fn.version = version;
|
|
92
|
+
Function.setFrom(fn, newFunction);
|
|
99
93
|
return fn;
|
|
100
94
|
} else {
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
return
|
|
95
|
+
Obj.change(newFunction, (f) => {
|
|
96
|
+
f.source = Ref.make(script);
|
|
97
|
+
});
|
|
98
|
+
return space.db.add(newFunction);
|
|
105
99
|
}
|
|
106
100
|
};
|
package/src/util/functions.ts
CHANGED
|
@@ -2,11 +2,13 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { Obj } from '@dxos/echo';
|
|
6
|
+
import { type Function, type Script, getUserFunctionIdInMetadata } from '@dxos/functions';
|
|
7
|
+
import { getInvocationUrl } from '@dxos/functions-runtime';
|
|
6
8
|
import { type PublicKey } from '@dxos/keys';
|
|
7
9
|
import { log } from '@dxos/log';
|
|
8
10
|
import { type Credential } from '@dxos/protocols/proto/dxos/halo/credentials';
|
|
9
|
-
import {
|
|
11
|
+
import { getSpace } from '@dxos/react-client/echo';
|
|
10
12
|
/**
|
|
11
13
|
* Get the function URL for a given script and client configuration
|
|
12
14
|
*/
|
|
@@ -20,7 +22,7 @@ export const getFunctionUrl = ({
|
|
|
20
22
|
edgeUrl: string;
|
|
21
23
|
}): string | undefined => {
|
|
22
24
|
const space = getSpace(script);
|
|
23
|
-
const existingFunctionId = fn && getUserFunctionIdInMetadata(getMeta(fn));
|
|
25
|
+
const existingFunctionId = fn && getUserFunctionIdInMetadata(Obj.getMeta(fn));
|
|
24
26
|
|
|
25
27
|
if (!existingFunctionId) {
|
|
26
28
|
return undefined;
|
|
@@ -37,31 +39,33 @@ export const updateFunctionMetadata = (
|
|
|
37
39
|
meta: any,
|
|
38
40
|
functionId: string,
|
|
39
41
|
) => {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
42
|
+
Obj.change(storedFunction, (f) => {
|
|
43
|
+
if (script.description !== undefined && script.description.trim() !== '') {
|
|
44
|
+
f.description = script.description;
|
|
45
|
+
} else if (meta.description) {
|
|
46
|
+
f.description = meta.description;
|
|
47
|
+
} else {
|
|
48
|
+
log.verbose('no description in function metadata', { functionId });
|
|
49
|
+
}
|
|
47
50
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
51
|
+
if (meta.inputSchema) {
|
|
52
|
+
f.inputSchema = meta.inputSchema;
|
|
53
|
+
} else {
|
|
54
|
+
log.verbose('no input schema in function metadata', { functionId });
|
|
55
|
+
}
|
|
53
56
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
57
|
+
if (meta.outputSchema) {
|
|
58
|
+
f.outputSchema = meta.outputSchema;
|
|
59
|
+
} else {
|
|
60
|
+
log.verbose('no output schema in function metadata', { functionId });
|
|
61
|
+
}
|
|
59
62
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
63
|
+
if (meta.key) {
|
|
64
|
+
f.key = meta.key;
|
|
65
|
+
} else {
|
|
66
|
+
log.verbose('no key in function metadata', { functionId });
|
|
67
|
+
}
|
|
68
|
+
});
|
|
65
69
|
};
|
|
66
70
|
|
|
67
71
|
export const getAccessCredential = (identityKey: PublicKey): Credential => {
|
package/src/vite-env.d.ts
CHANGED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
DEPLOYMENT_DIALOG,
|
|
3
|
-
DeploymentDialog_default
|
|
4
|
-
} from "./chunk-IQMYIWHG.mjs";
|
|
5
|
-
import "./chunk-Q2DGRQRN.mjs";
|
|
6
|
-
import "./chunk-HCURXADW.mjs";
|
|
7
|
-
import "./chunk-ST3ACVUC.mjs";
|
|
8
|
-
import "./chunk-EB6AXFXO.mjs";
|
|
9
|
-
import "./chunk-J5LGTIGS.mjs";
|
|
10
|
-
export {
|
|
11
|
-
DEPLOYMENT_DIALOG,
|
|
12
|
-
DeploymentDialog_default as default
|
|
13
|
-
};
|
|
14
|
-
//# sourceMappingURL=DeploymentDialog-E5NXT4UQ.mjs.map
|