@dxos/plugin-script 0.8.4-main.7ace549 → 0.8.4-main.9735255
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-MHY3DXDE.mjs → NotebookContainer-NBAXYESH.mjs} +266 -238
- 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-ULJFT73Q.mjs → chunk-C53UJGSU.mjs} +232 -188
- 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-2G2NA6DQ.mjs → chunk-UX4GHJ5E.mjs} +28 -11
- 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 +92 -116
- 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-R245YN52.mjs → react-surface-O6GKHB2J.mjs} +53 -42
- 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-2ULNOZQH.mjs → DeploymentDialog-OGBJPVIX.mjs} +6 -6
- package/dist/lib/node-esm/DeploymentDialog-OGBJPVIX.mjs.map +7 -0
- package/dist/lib/node-esm/{NotebookContainer-U4C2HQ4T.mjs → NotebookContainer-IUAYVJSD.mjs} +266 -238
- 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-57JA6XL5.mjs → chunk-4F5FJZ36.mjs} +28 -11
- 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-VJSRZRLI.mjs → chunk-BX5PP6AW.mjs} +232 -188
- 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 +92 -116
- 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-MHT3PJ6C.mjs → react-surface-RLANMVMB.mjs} +53 -42
- 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.map +1 -1
- package/dist/types/src/components/DeploymentDialog/DeploymentDialog.stories.d.ts +1 -3
- package/dist/types/src/components/DeploymentDialog/DeploymentDialog.stories.d.ts.map +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 -250
- 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 +2 -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 +2 -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/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 +9 -26
- 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/types/Notebook.d.ts +88 -19
- 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 -88
- package/src/ScriptPlugin.tsx +34 -60
- 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 -94
- 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 +27 -23
- package/src/components/DeploymentDialog/DeploymentDialog.tsx +22 -42
- package/src/components/FrameContainer/FrameContainer.tsx +4 -2
- package/src/components/NotebookContainer.stories.tsx +23 -19
- package/src/components/NotebookContainer.tsx +51 -40
- package/src/components/NotebookStack/NotebookCell.tsx +16 -15
- 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 +46 -32
- package/src/components/ScriptToolbar/ScriptToolbar.stories.tsx +38 -15
- package/src/components/ScriptToolbar/ScriptToolbar.tsx +14 -17
- package/src/components/Settings/ScriptObjectSettings.tsx +40 -29
- package/src/components/Settings/ScriptPluginSettings.tsx +8 -3
- package/src/components/TestPanel/TestContainer.tsx +5 -5
- package/src/components/TestPanel/TestPanel.tsx +1 -1
- package/src/components/TypescriptEditor/TypescriptEditor.stories.tsx +12 -7
- package/src/components/TypescriptEditor/TypescriptEditor.tsx +69 -68
- package/src/e2e/ai.test.ts +92 -0
- package/src/e2e/deploy.test.ts +64 -0
- package/src/hooks/deploy.ts +33 -26
- 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 -19
- 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/index.ts +18 -5
- package/src/templates/ping.ts +14 -5
- package/src/testing/simulator.test.ts +40 -0
- package/src/types/Notebook.ts +7 -8
- 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 +19 -25
- package/src/util/functions.ts +24 -22
- package/src/vite-env.d.ts +2 -0
- package/dist/lib/browser/DeploymentDialog-5TKNGPVR.mjs +0 -14
- package/dist/lib/browser/NotebookContainer-MHY3DXDE.mjs.map +0 -7
- package/dist/lib/browser/ScriptContainer-CW6YN3DQ.mjs +0 -148
- package/dist/lib/browser/ScriptContainer-CW6YN3DQ.mjs.map +0 -7
- package/dist/lib/browser/app-graph-builder-2WR2ATTJ.mjs +0 -66
- package/dist/lib/browser/app-graph-builder-2WR2ATTJ.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-2G2NA6DQ.mjs.map +0 -7
- package/dist/lib/browser/chunk-ALS6X4HU.mjs +0 -304
- package/dist/lib/browser/chunk-ALS6X4HU.mjs.map +0 -7
- package/dist/lib/browser/chunk-EB6AXFXO.mjs.map +0 -7
- package/dist/lib/browser/chunk-M6KJPUJK.mjs +0 -111
- package/dist/lib/browser/chunk-M6KJPUJK.mjs.map +0 -7
- package/dist/lib/browser/chunk-N5EYLQOT.mjs +0 -647
- package/dist/lib/browser/chunk-N5EYLQOT.mjs.map +0 -7
- package/dist/lib/browser/chunk-QIZ3BPRK.mjs +0 -103
- package/dist/lib/browser/chunk-QIZ3BPRK.mjs.map +0 -7
- package/dist/lib/browser/chunk-SAN5Y7FI.mjs +0 -155
- package/dist/lib/browser/chunk-SAN5Y7FI.mjs.map +0 -7
- package/dist/lib/browser/chunk-ULJFT73Q.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-4KHRSX7J.mjs +0 -86
- package/dist/lib/browser/compiler-4KHRSX7J.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-TXTBWOVD.mjs +0 -104
- package/dist/lib/browser/intent-resolver-TXTBWOVD.mjs.map +0 -7
- package/dist/lib/browser/react-surface-R245YN52.mjs.map +0 -7
- package/dist/lib/browser/settings-MHJXRGDF.mjs +0 -26
- package/dist/lib/browser/settings-MHJXRGDF.mjs.map +0 -7
- package/dist/lib/node-esm/NotebookContainer-U4C2HQ4T.mjs.map +0 -7
- package/dist/lib/node-esm/ScriptContainer-VRPEKB4T.mjs +0 -149
- package/dist/lib/node-esm/ScriptContainer-VRPEKB4T.mjs.map +0 -7
- package/dist/lib/node-esm/app-graph-builder-NCVLUL5R.mjs +0 -67
- package/dist/lib/node-esm/app-graph-builder-NCVLUL5R.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-55JZVM6K.mjs +0 -16
- package/dist/lib/node-esm/chunk-55JZVM6K.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-57JA6XL5.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-HDKR5WCD.mjs +0 -113
- package/dist/lib/node-esm/chunk-HDKR5WCD.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-IBV2DR36.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-ND4BPYPR.mjs +0 -156
- package/dist/lib/node-esm/chunk-ND4BPYPR.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-UEVZP5DN.mjs +0 -648
- package/dist/lib/node-esm/chunk-UEVZP5DN.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-VJSRZRLI.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-VTRMJSQL.mjs +0 -305
- package/dist/lib/node-esm/chunk-VTRMJSQL.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-XYKKDWUR.mjs +0 -104
- package/dist/lib/node-esm/chunk-XYKKDWUR.mjs.map +0 -7
- package/dist/lib/node-esm/compiler-DU5NQISX.mjs +0 -87
- package/dist/lib/node-esm/compiler-DU5NQISX.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-D6AVAQRA.mjs +0 -105
- package/dist/lib/node-esm/intent-resolver-D6AVAQRA.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-MHT3PJ6C.mjs.map +0 -7
- package/dist/lib/node-esm/settings-BVJORMMJ.mjs +0 -27
- package/dist/lib/node-esm/settings-BVJORMMJ.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 -103
- 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-5TKNGPVR.mjs.map → DeploymentDialog-OSL6RMPA.mjs.map} +0 -0
- /package/dist/lib/{node-esm/DeploymentDialog-2ULNOZQH.mjs.map → browser/blueprints/index.mjs.map} +0 -0
package/src/capabilities/{artifact-definition.ts → artifact-definition/artifact-definition.ts}
RENAMED
|
@@ -5,10 +5,11 @@
|
|
|
5
5
|
// ISSUE(burdon): defineArtifact
|
|
6
6
|
// @ts-nocheck
|
|
7
7
|
|
|
8
|
+
import * as Effect from 'effect/Effect';
|
|
8
9
|
import * as Schema from 'effect/Schema';
|
|
9
10
|
|
|
10
11
|
import { ToolResult, createTool } from '@dxos/ai';
|
|
11
|
-
import { Capabilities, type PromiseIntentDispatcher,
|
|
12
|
+
import { Capabilities, Capability, type PromiseIntentDispatcher, createIntent } from '@dxos/app-framework';
|
|
12
13
|
import { ArtifactId, createArtifactElement } from '@dxos/assistant';
|
|
13
14
|
import { defineArtifact } from '@dxos/blueprints';
|
|
14
15
|
import { Filter, Obj, Ref } from '@dxos/echo';
|
|
@@ -17,7 +18,7 @@ import { invariant } from '@dxos/invariant';
|
|
|
17
18
|
import { SpaceAction } from '@dxos/plugin-space/types';
|
|
18
19
|
import { type Space } from '@dxos/react-client/echo';
|
|
19
20
|
|
|
20
|
-
import { meta } from '
|
|
21
|
+
import { meta } from '../../meta';
|
|
21
22
|
|
|
22
23
|
// TODO(burdon): Factor out.
|
|
23
24
|
declare global {
|
|
@@ -27,14 +28,15 @@ declare global {
|
|
|
27
28
|
}
|
|
28
29
|
}
|
|
29
30
|
|
|
30
|
-
export default () =>
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
31
|
+
export default Capability.makeModule(() =>
|
|
32
|
+
Effect.sync(() => {
|
|
33
|
+
const definition = defineArtifact({
|
|
34
|
+
id: `artifact:${meta.id}`,
|
|
35
|
+
name: meta.name,
|
|
36
|
+
// TODO(dmaretskyi): Since writing scripts requires a lot of domain knowledge,
|
|
37
|
+
// we should offload the work of synthesizing the code to a separate model.
|
|
38
|
+
// The main reasoning model will give it a concrete task and the script model will synthesize the code, knowing all the docs.
|
|
39
|
+
instructions: `
|
|
38
40
|
If the user explicitly requests you to write a script, you can create one.
|
|
39
41
|
If the user requests you to change one of the existing script, you can update it.
|
|
40
42
|
You must not create a script unless the user explicitly requests it.
|
|
@@ -54,7 +56,7 @@ export default () => {
|
|
|
54
56
|
The description is used by AI to understand the script and its purpose.
|
|
55
57
|
The description must provide cases on when the script should be used.
|
|
56
58
|
|
|
57
|
-
Schema:
|
|
59
|
+
Schema:
|
|
58
60
|
The schema is defined using a schema-DSL library called Effect Schema.
|
|
59
61
|
The input schema describes the arguments that the script accepts.
|
|
60
62
|
The output schema describes the result that the script produces.
|
|
@@ -75,18 +77,18 @@ export default () => {
|
|
|
75
77
|
- Detailed output schema
|
|
76
78
|
|
|
77
79
|
<apis>
|
|
78
|
-
export function defineFunction(params: {
|
|
79
|
-
description: string,
|
|
80
|
-
inputSchema: Schema.Schema,
|
|
81
|
-
outputSchema: Schema.Schema,
|
|
82
|
-
handler: (params: { event: { data: TInput } }) => Promise<TOutput>
|
|
80
|
+
export function defineFunction(params: {
|
|
81
|
+
description: string,
|
|
82
|
+
inputSchema: Schema.Schema,
|
|
83
|
+
outputSchema: Schema.Schema,
|
|
84
|
+
handler: (params: { event: { data: TInput } }) => Promise<TOutput>
|
|
83
85
|
}): FunctionDefinition
|
|
84
86
|
/**
|
|
85
87
|
* Effect Schema
|
|
86
88
|
*/
|
|
87
|
-
export const Schema;
|
|
89
|
+
export const Schema;
|
|
88
90
|
|
|
89
|
-
// Examples:
|
|
91
|
+
// Examples:
|
|
90
92
|
|
|
91
93
|
Schema.String
|
|
92
94
|
Schema.Number
|
|
@@ -104,7 +106,7 @@ export default () => {
|
|
|
104
106
|
<handler_function>
|
|
105
107
|
Async function that takes the argument in the form of:
|
|
106
108
|
|
|
107
|
-
type
|
|
109
|
+
type HandlerFunctionProp = {
|
|
108
110
|
event: {
|
|
109
111
|
data: T // The input schema
|
|
110
112
|
},
|
|
@@ -112,7 +114,7 @@ export default () => {
|
|
|
112
114
|
|
|
113
115
|
The function must return the result that matches the output schema.
|
|
114
116
|
</handler_function>
|
|
115
|
-
|
|
117
|
+
|
|
116
118
|
<example>
|
|
117
119
|
import { defineFunction, S } from 'dxos:functions';
|
|
118
120
|
|
|
@@ -143,82 +145,83 @@ export default () => {
|
|
|
143
145
|
});
|
|
144
146
|
</example>
|
|
145
147
|
`,
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
148
|
+
schema: ScriptType,
|
|
149
|
+
tools: [
|
|
150
|
+
createTool(meta.id, {
|
|
151
|
+
name: 'create',
|
|
152
|
+
description: 'Create a new script. Returns the artifact definition for the script',
|
|
153
|
+
caption: 'Creating script...',
|
|
154
|
+
schema: Schema.Struct({
|
|
155
|
+
name: Schema.String.annotations({ description: 'The name of the script' }),
|
|
156
|
+
code: Schema.String.annotations({
|
|
157
|
+
description: 'The full code of the script in JavaScript or TypeScript. Must be valid executable code.',
|
|
158
|
+
}),
|
|
156
159
|
}),
|
|
160
|
+
execute: async ({ name, code }, { extensions }) => {
|
|
161
|
+
invariant(extensions?.space, 'No space');
|
|
162
|
+
invariant(extensions?.dispatch, 'No intent dispatcher');
|
|
163
|
+
const script = Obj.make(ScriptType, { name, source: Ref.make(Text.make(code)) });
|
|
164
|
+
extensions.space.db.add(script);
|
|
165
|
+
await extensions.space.db.flush();
|
|
166
|
+
|
|
167
|
+
const intent = createIntent(SpaceAction.AddObject, { target: extensions.space, object: script });
|
|
168
|
+
const { data, error } = await extensions.dispatch(intent);
|
|
169
|
+
if (!data || error) {
|
|
170
|
+
return ToolResult.Error(error?.message ?? 'Failed to create chess game');
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
return ToolResult.Success(createArtifactElement(script.id));
|
|
174
|
+
},
|
|
157
175
|
}),
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
description: 'Inspect a script. Returns the artifact definition for the script',
|
|
177
|
-
caption: 'Inspecting script...',
|
|
178
|
-
schema: Schema.Struct({
|
|
179
|
-
id: ArtifactId,
|
|
176
|
+
createTool(meta.id, {
|
|
177
|
+
name: 'inspect',
|
|
178
|
+
description: 'Inspect a script. Returns the artifact definition for the script',
|
|
179
|
+
caption: 'Inspecting script...',
|
|
180
|
+
schema: Schema.Struct({
|
|
181
|
+
id: ArtifactId,
|
|
182
|
+
}),
|
|
183
|
+
execute: async ({ id }, { extensions }) => {
|
|
184
|
+
invariant(extensions?.space, 'No space');
|
|
185
|
+
|
|
186
|
+
const script = (await extensions.space.db.query(Filter.id(id)).first()) as ScriptType;
|
|
187
|
+
const { content } = await script.source.load();
|
|
188
|
+
|
|
189
|
+
return ToolResult.Success({
|
|
190
|
+
name: script.name,
|
|
191
|
+
code: content,
|
|
192
|
+
});
|
|
193
|
+
},
|
|
180
194
|
}),
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
});
|
|
191
|
-
},
|
|
192
|
-
}),
|
|
193
|
-
createTool(meta.id, {
|
|
194
|
-
name: 'update',
|
|
195
|
-
description: 'Update a script. Returns the artifact definition for the script',
|
|
196
|
-
caption: 'Updating script...',
|
|
197
|
-
schema: Schema.Struct({
|
|
198
|
-
id: ArtifactId,
|
|
199
|
-
code: Schema.String.annotations({
|
|
200
|
-
description: 'The full code of the script in JavaScript or TypeScript. Must be valid executable code.',
|
|
195
|
+
createTool(meta.id, {
|
|
196
|
+
name: 'update',
|
|
197
|
+
description: 'Update a script. Returns the artifact definition for the script',
|
|
198
|
+
caption: 'Updating script...',
|
|
199
|
+
schema: Schema.Struct({
|
|
200
|
+
id: ArtifactId,
|
|
201
|
+
code: Schema.String.annotations({
|
|
202
|
+
description: 'The full code of the script in JavaScript or TypeScript. Must be valid executable code.',
|
|
203
|
+
}),
|
|
201
204
|
}),
|
|
205
|
+
execute: async ({ id, code }, { extensions }) => {
|
|
206
|
+
invariant(extensions?.space, 'No space');
|
|
207
|
+
|
|
208
|
+
const script = (await extensions.space.db.query(Filter.id(id)).first()) as ScriptType;
|
|
209
|
+
const source = await script.source.load();
|
|
210
|
+
if (!source) {
|
|
211
|
+
return ToolResult.Error('Script not found');
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
source.content = code;
|
|
215
|
+
await extensions.space?.db.flush();
|
|
216
|
+
|
|
217
|
+
return ToolResult.Success({
|
|
218
|
+
name: script.name,
|
|
219
|
+
});
|
|
220
|
+
},
|
|
202
221
|
}),
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
return ToolResult.Error('Script not found');
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
source.content = code;
|
|
213
|
-
await extensions.space?.db.flush();
|
|
214
|
-
|
|
215
|
-
return ToolResult.Success({
|
|
216
|
-
name: script.name,
|
|
217
|
-
});
|
|
218
|
-
},
|
|
219
|
-
}),
|
|
220
|
-
],
|
|
221
|
-
});
|
|
222
|
-
|
|
223
|
-
return contributes(Capabilities.ArtifactDefinition, definition);
|
|
224
|
-
};
|
|
222
|
+
],
|
|
223
|
+
});
|
|
224
|
+
|
|
225
|
+
return Capability.contributes(Capabilities.ArtifactDefinition, definition);
|
|
226
|
+
}),
|
|
227
|
+
);
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
|
+
|
|
7
|
+
import { Capability, Common } from '@dxos/app-framework';
|
|
8
|
+
|
|
9
|
+
import { ScriptBlueprint } from '../../blueprints';
|
|
10
|
+
|
|
11
|
+
export type BlueprintCapabilities = [
|
|
12
|
+
Capability.Capability<typeof Common.Capability.Functions>,
|
|
13
|
+
Capability.Capability<typeof Common.Capability.BlueprintDefinition>,
|
|
14
|
+
];
|
|
15
|
+
|
|
16
|
+
const blueprintDefinition = Capability.makeModule<[], BlueprintCapabilities>(() =>
|
|
17
|
+
Effect.succeed([
|
|
18
|
+
Capability.contributes(Common.Capability.Functions, ScriptBlueprint.functions),
|
|
19
|
+
Capability.contributes(Common.Capability.BlueprintDefinition, ScriptBlueprint.make()),
|
|
20
|
+
]),
|
|
21
|
+
);
|
|
22
|
+
|
|
23
|
+
export default blueprintDefinition;
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as FetchHttpClient from '@effect/platform/FetchHttpClient';
|
|
6
|
+
import * as HttpClient from '@effect/platform/HttpClient';
|
|
7
|
+
import * as Effect from 'effect/Effect';
|
|
8
|
+
import * as Schedule from 'effect/Schedule';
|
|
9
|
+
import * as Schema from 'effect/Schema';
|
|
10
|
+
import wasmUrl from 'esbuild-wasm/esbuild.wasm?url';
|
|
11
|
+
import * as ts from 'typescript';
|
|
12
|
+
|
|
13
|
+
import { Capability } from '@dxos/app-framework';
|
|
14
|
+
import { initializeBundler } from '@dxos/functions-runtime/bundler';
|
|
15
|
+
import { log } from '@dxos/log';
|
|
16
|
+
import { trim } from '@dxos/util';
|
|
17
|
+
|
|
18
|
+
import { Compiler } from '../../compiler';
|
|
19
|
+
import { ScriptCapabilities } from '../../types';
|
|
20
|
+
|
|
21
|
+
// TODO(burdon): Document.
|
|
22
|
+
const SCRIPT_PACKAGES_BUCKET = 'https://pub-5745ae82e450484aa28f75fc6a175935.r2.dev/dev/';
|
|
23
|
+
const DECLARATION_EXTS = ['.d.ts', '.d.mts'];
|
|
24
|
+
const NO_TYPES = true; // Types temopararly disabled due to compiler erorrs.
|
|
25
|
+
|
|
26
|
+
export default Capability.makeModule(() =>
|
|
27
|
+
Effect.gen(function* () {
|
|
28
|
+
yield* Effect.tryPromise(() => initializeBundler({ wasmUrl }));
|
|
29
|
+
|
|
30
|
+
const runtimeModules = yield* fetchRuntimeModules().pipe(Effect.provide(FetchHttpClient.layer));
|
|
31
|
+
|
|
32
|
+
const compiler = new Compiler({
|
|
33
|
+
skipLibCheck: true,
|
|
34
|
+
moduleResolution: ts.ModuleResolutionKind.Bundler,
|
|
35
|
+
allowImportingTsExtensions: true,
|
|
36
|
+
noEmit: true,
|
|
37
|
+
strict: true,
|
|
38
|
+
esModuleInterop: true,
|
|
39
|
+
paths: Object.fromEntries(runtimeModules.map((mod: any) => [mod.moduleName, [`./src/${mod.filename}`]])),
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
yield* Effect.tryPromise(() =>
|
|
43
|
+
compiler.initialize(trim`
|
|
44
|
+
declare module 'https://*';
|
|
45
|
+
${NO_TYPES ? '' : 'declare module "*";'}
|
|
46
|
+
`),
|
|
47
|
+
);
|
|
48
|
+
if (!NO_TYPES) {
|
|
49
|
+
for (const mod of runtimeModules) {
|
|
50
|
+
compiler.setFile(`/src/${mod.filename}`, mod.content);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
return Capability.contributes(ScriptCapabilities.Compiler, compiler);
|
|
55
|
+
}),
|
|
56
|
+
);
|
|
57
|
+
|
|
58
|
+
const fetchRuntimeModules = Effect.fnUntraced(function* () {
|
|
59
|
+
// { key, size, contentType }
|
|
60
|
+
const manifest = yield* HttpClient.get(new URL('manifest.json', SCRIPT_PACKAGES_BUCKET)).pipe(
|
|
61
|
+
Effect.flatMap((_) => _.json),
|
|
62
|
+
Effect.flatMap(
|
|
63
|
+
Schema.decodeUnknown(
|
|
64
|
+
Schema.Struct({
|
|
65
|
+
files: Schema.Array(
|
|
66
|
+
Schema.Struct({
|
|
67
|
+
key: Schema.String,
|
|
68
|
+
}),
|
|
69
|
+
),
|
|
70
|
+
}),
|
|
71
|
+
),
|
|
72
|
+
),
|
|
73
|
+
Effect.map((manifest) => ({ ...manifest, files: manifest.files.map((f) => f.key) })),
|
|
74
|
+
);
|
|
75
|
+
|
|
76
|
+
const declarationFiles = manifest.files.filter((file) => DECLARATION_EXTS.some((ext) => file.endsWith(ext)));
|
|
77
|
+
|
|
78
|
+
let fetched = 0;
|
|
79
|
+
const modules = yield* Effect.forEach(
|
|
80
|
+
declarationFiles,
|
|
81
|
+
Effect.fnUntraced(
|
|
82
|
+
function* (filename) {
|
|
83
|
+
const response = yield* HttpClient.get(new URL(filename, SCRIPT_PACKAGES_BUCKET)).pipe(
|
|
84
|
+
Effect.retry(Schedule.exponential(1_000).pipe(Schedule.compose(Schedule.recurs(3)))),
|
|
85
|
+
);
|
|
86
|
+
const content = yield* response.text;
|
|
87
|
+
const moduleName = filename.replace(/\.d\.(ts|mts)$/, '');
|
|
88
|
+
fetched++;
|
|
89
|
+
|
|
90
|
+
return {
|
|
91
|
+
moduleName,
|
|
92
|
+
filename,
|
|
93
|
+
content,
|
|
94
|
+
};
|
|
95
|
+
},
|
|
96
|
+
Effect.retry(Schedule.exponential(1_000).pipe(Schedule.compose(Schedule.recurs(3)))),
|
|
97
|
+
),
|
|
98
|
+
{ concurrency: 20 },
|
|
99
|
+
);
|
|
100
|
+
|
|
101
|
+
log.info('runtime modules', { manifest: manifest.files.length, files: declarationFiles.length, fetched });
|
|
102
|
+
return modules;
|
|
103
|
+
});
|
|
@@ -2,13 +2,9 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
export
|
|
8
|
-
export
|
|
9
|
-
export
|
|
10
|
-
export
|
|
11
|
-
export const ReactSurface = lazy(() => import('./react-surface'));
|
|
12
|
-
export const ScriptSettings = lazy(() => import('./settings'));
|
|
13
|
-
|
|
14
|
-
export * from './capabilities';
|
|
5
|
+
export * from './app-graph-builder';
|
|
6
|
+
export * from './blueprint-definition';
|
|
7
|
+
export * from './compiler';
|
|
8
|
+
export * from './operation-resolver';
|
|
9
|
+
export * from './react-surface';
|
|
10
|
+
export * from './settings';
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { Octokit } from '@octokit/core';
|
|
6
|
+
import * as Effect from 'effect/Effect';
|
|
7
|
+
import * as Predicate from 'effect/Predicate';
|
|
8
|
+
|
|
9
|
+
import { Capability, Common } from '@dxos/app-framework';
|
|
10
|
+
import { Script } from '@dxos/functions';
|
|
11
|
+
import { Operation, OperationResolver } from '@dxos/operation';
|
|
12
|
+
import { TokenManagerOperation } from '@dxos/plugin-token-manager/types';
|
|
13
|
+
|
|
14
|
+
import { DEPLOYMENT_DIALOG } from '../../components';
|
|
15
|
+
import { defaultScriptsForIntegration } from '../../meta';
|
|
16
|
+
import { templates } from '../../templates';
|
|
17
|
+
import { ScriptOperation } from '../../types';
|
|
18
|
+
|
|
19
|
+
export default Capability.makeModule(
|
|
20
|
+
Effect.fnUntraced(function* () {
|
|
21
|
+
return Capability.contributes(Common.Capability.OperationResolver, [
|
|
22
|
+
OperationResolver.make({
|
|
23
|
+
operation: ScriptOperation.CreateScript,
|
|
24
|
+
handler: Effect.fnUntraced(function* ({ name, gistUrl, initialTemplateId }) {
|
|
25
|
+
let source = templates[0].source;
|
|
26
|
+
let scriptName = name;
|
|
27
|
+
|
|
28
|
+
const gistId = gistUrl?.split('/').at(-1);
|
|
29
|
+
if (gistId) {
|
|
30
|
+
// TODO(wittjosiah): Capability which contributes Octokit?
|
|
31
|
+
// NOTE: AccessToken not needed to read public gists.
|
|
32
|
+
const octokit = new Octokit();
|
|
33
|
+
const response = yield* Effect.promise(() =>
|
|
34
|
+
octokit.request('GET /gists/{gist_id}', {
|
|
35
|
+
gist_id: gistId,
|
|
36
|
+
}),
|
|
37
|
+
);
|
|
38
|
+
const gistContent = Object.values(response.data.files ?? {})[0]?.content;
|
|
39
|
+
if (gistContent) {
|
|
40
|
+
source = gistContent;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
if (initialTemplateId) {
|
|
45
|
+
const template = templates.find((template) => template.id === initialTemplateId);
|
|
46
|
+
if (template) {
|
|
47
|
+
source = template.source;
|
|
48
|
+
scriptName = scriptName || template.name;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
return { object: Script.make({ name: scriptName, source }) };
|
|
53
|
+
}),
|
|
54
|
+
}),
|
|
55
|
+
OperationResolver.make({
|
|
56
|
+
operation: TokenManagerOperation.AccessTokenCreated,
|
|
57
|
+
handler: Effect.fnUntraced(function* ({ accessToken }) {
|
|
58
|
+
const scriptTemplates = (defaultScriptsForIntegration[accessToken.source] ?? [])
|
|
59
|
+
.map((id) => templates.find((t) => t.id === id))
|
|
60
|
+
.filter(Predicate.isNotNullable);
|
|
61
|
+
|
|
62
|
+
if (scriptTemplates.length > 0) {
|
|
63
|
+
yield* Operation.invoke(Common.LayoutOperation.UpdateDialog, {
|
|
64
|
+
subject: DEPLOYMENT_DIALOG,
|
|
65
|
+
blockAlign: 'start',
|
|
66
|
+
state: true,
|
|
67
|
+
props: { accessToken, scriptTemplates },
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
}),
|
|
71
|
+
}),
|
|
72
|
+
]);
|
|
73
|
+
}),
|
|
74
|
+
);
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
|
+
import React from 'react';
|
|
7
|
+
|
|
8
|
+
import { Capability, Common } from '@dxos/app-framework';
|
|
9
|
+
import { useAtomCapability, useSettingsState } from '@dxos/app-framework/react';
|
|
10
|
+
import { InvocationTraceContainer } from '@dxos/devtools';
|
|
11
|
+
import { Obj } from '@dxos/echo';
|
|
12
|
+
import { Script } from '@dxos/functions';
|
|
13
|
+
import { getSpace } from '@dxos/react-client/echo';
|
|
14
|
+
import { Layout } from '@dxos/react-ui-mosaic';
|
|
15
|
+
import { type AccessToken } from '@dxos/types';
|
|
16
|
+
|
|
17
|
+
import {
|
|
18
|
+
DEPLOYMENT_DIALOG,
|
|
19
|
+
DeploymentDialog,
|
|
20
|
+
NotebookContainer,
|
|
21
|
+
ScriptContainer,
|
|
22
|
+
ScriptObjectSettings,
|
|
23
|
+
ScriptPluginSettings,
|
|
24
|
+
ScriptProperties,
|
|
25
|
+
TestContainer,
|
|
26
|
+
} from '../../components';
|
|
27
|
+
import { useCompiler } from '../../hooks';
|
|
28
|
+
import { meta } from '../../meta';
|
|
29
|
+
import { Notebook, ScriptCapabilities, type ScriptSettings } from '../../types';
|
|
30
|
+
|
|
31
|
+
export default Capability.makeModule(() =>
|
|
32
|
+
Effect.succeed(
|
|
33
|
+
Capability.contributes(Common.Capability.ReactSurface, [
|
|
34
|
+
Common.createSurface({
|
|
35
|
+
id: `${meta.id}/plugin-settings`,
|
|
36
|
+
role: 'article',
|
|
37
|
+
filter: (data): data is { subject: Common.Capability.Settings } =>
|
|
38
|
+
Common.Capability.isSettings(data.subject) && data.subject.prefix === meta.id,
|
|
39
|
+
component: ({ data: { subject } }) => {
|
|
40
|
+
const { settings, updateSettings } = useSettingsState<ScriptSettings>(subject.atom);
|
|
41
|
+
return <ScriptPluginSettings settings={settings} onSettingsChange={updateSettings} />;
|
|
42
|
+
},
|
|
43
|
+
}),
|
|
44
|
+
Common.createSurface({
|
|
45
|
+
id: `${meta.id}/script/article`,
|
|
46
|
+
role: ['article', 'section'],
|
|
47
|
+
filter: (data): data is { subject: Script.Script } => Obj.instanceOf(Script.Script, data.subject),
|
|
48
|
+
component: ({ data, role }) => {
|
|
49
|
+
const compiler = useCompiler();
|
|
50
|
+
const settings = useAtomCapability(ScriptCapabilities.Settings);
|
|
51
|
+
// TODO(wittjosiah): Why? The editor should be allow to render even if the environment is not ready.
|
|
52
|
+
if (!compiler?.environment) {
|
|
53
|
+
return null;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
return <ScriptContainer role={role} subject={data.subject} settings={settings} env={compiler?.environment} />;
|
|
57
|
+
},
|
|
58
|
+
}),
|
|
59
|
+
Common.createSurface({
|
|
60
|
+
id: `${meta.id}/notebook/article`,
|
|
61
|
+
role: 'article',
|
|
62
|
+
filter: (data): data is { subject: Notebook.Notebook } => Obj.instanceOf(Notebook.Notebook, data.subject),
|
|
63
|
+
component: ({ data, role }) => {
|
|
64
|
+
const compiler = useCompiler();
|
|
65
|
+
return <NotebookContainer role={role} subject={data.subject} env={compiler?.environment} />;
|
|
66
|
+
},
|
|
67
|
+
}),
|
|
68
|
+
// TODO(burdon): Standardize PluginSettings vs ObjectSettings.
|
|
69
|
+
// TODO(burdon): Why is ScriptProperties different from ScriptObjectSettings?
|
|
70
|
+
Common.createSurface({
|
|
71
|
+
id: `${meta.id}/companion/base-settings`,
|
|
72
|
+
role: 'base-object-settings',
|
|
73
|
+
filter: (data): data is { subject: Script.Script } => Obj.instanceOf(Script.Script, data.subject),
|
|
74
|
+
component: ({ data }) => <ScriptProperties object={data.subject} />,
|
|
75
|
+
}),
|
|
76
|
+
Common.createSurface({
|
|
77
|
+
id: `${meta.id}/companion/settings`,
|
|
78
|
+
role: 'object-settings',
|
|
79
|
+
filter: (data): data is { subject: Script.Script } => Obj.instanceOf(Script.Script, data.subject),
|
|
80
|
+
component: ({ data }) => <ScriptObjectSettings object={data.subject} />,
|
|
81
|
+
}),
|
|
82
|
+
Common.createSurface({
|
|
83
|
+
id: `${meta.id}/companion/execute`,
|
|
84
|
+
role: 'article',
|
|
85
|
+
filter: (data): data is { companionTo: Script.Script } =>
|
|
86
|
+
Obj.instanceOf(Script.Script, data.companionTo) && data.subject === 'execute',
|
|
87
|
+
component: ({ data, role }) => <TestContainer script={data.companionTo} role={role} />,
|
|
88
|
+
}),
|
|
89
|
+
Common.createSurface({
|
|
90
|
+
id: `${meta.id}/companion/logs`,
|
|
91
|
+
role: 'article',
|
|
92
|
+
filter: (data): data is { companionTo: Script.Script } =>
|
|
93
|
+
Obj.instanceOf(Script.Script, data.companionTo) && data.subject === 'logs',
|
|
94
|
+
component: ({ data, role }) => {
|
|
95
|
+
const space = getSpace(data.companionTo);
|
|
96
|
+
const queueDxn = space?.properties.invocationTraceQueue?.dxn;
|
|
97
|
+
return (
|
|
98
|
+
<Layout.Main role={role}>
|
|
99
|
+
<InvocationTraceContainer
|
|
100
|
+
db={space?.db}
|
|
101
|
+
queueDxn={queueDxn}
|
|
102
|
+
target={data.companionTo}
|
|
103
|
+
detailAxis='block'
|
|
104
|
+
/>
|
|
105
|
+
</Layout.Main>
|
|
106
|
+
);
|
|
107
|
+
},
|
|
108
|
+
}),
|
|
109
|
+
Common.createSurface({
|
|
110
|
+
id: DEPLOYMENT_DIALOG,
|
|
111
|
+
role: 'dialog',
|
|
112
|
+
filter: (data): data is { props: { accessToken: AccessToken.AccessToken; scriptTemplates: any } } =>
|
|
113
|
+
data.component === DEPLOYMENT_DIALOG,
|
|
114
|
+
component: ({ data }) => <DeploymentDialog {...data.props} />,
|
|
115
|
+
}),
|
|
116
|
+
]),
|
|
117
|
+
),
|
|
118
|
+
);
|