@dxos/plugin-script 0.8.4-main.c1de068 → 0.8.4-main.c351d160a8
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/README.md +15 -13
- package/dist/lib/browser/DeploymentDialog-SSJP2BBZ.mjs +138 -0
- package/dist/lib/browser/DeploymentDialog-SSJP2BBZ.mjs.map +7 -0
- package/dist/lib/browser/NotebookContainer-Q6Z2CPH6.mjs +848 -0
- package/dist/lib/browser/NotebookContainer-Q6Z2CPH6.mjs.map +7 -0
- package/dist/lib/browser/ScriptContainer-IKITE6OA.mjs +93 -0
- package/dist/lib/browser/ScriptContainer-IKITE6OA.mjs.map +7 -0
- package/dist/lib/browser/ScriptObjectSettings-X4WV5TBD.mjs +294 -0
- package/dist/lib/browser/ScriptObjectSettings-X4WV5TBD.mjs.map +7 -0
- package/dist/lib/browser/ScriptPluginSettings-5WUKIWCC.mjs +55 -0
- package/dist/lib/browser/ScriptPluginSettings-5WUKIWCC.mjs.map +7 -0
- package/dist/lib/browser/ScriptProperties-5YERQAL2.mjs +28 -0
- package/dist/lib/browser/ScriptProperties-5YERQAL2.mjs.map +7 -0
- package/dist/lib/browser/TestContainer-ZI2PQRXB.mjs +39 -0
- package/dist/lib/browser/TestContainer-ZI2PQRXB.mjs.map +7 -0
- package/dist/lib/browser/app-graph-builder-QPXX4YK5.mjs +63 -0
- package/dist/lib/browser/app-graph-builder-QPXX4YK5.mjs.map +7 -0
- package/dist/lib/browser/blueprint-definition-2UX353LT.mjs +17 -0
- package/dist/lib/browser/blueprint-definition-2UX353LT.mjs.map +7 -0
- package/dist/lib/browser/blueprints/index.mjs +8 -0
- package/dist/lib/browser/{chunk-QYAREHGH.mjs → chunk-37XPSUAH.mjs} +9 -6
- package/dist/lib/browser/chunk-37XPSUAH.mjs.map +7 -0
- package/dist/lib/browser/chunk-7JL6WNT6.mjs +397 -0
- package/dist/lib/browser/chunk-7JL6WNT6.mjs.map +7 -0
- package/dist/lib/browser/chunk-7SXHORK4.mjs +105 -0
- package/dist/lib/browser/chunk-7SXHORK4.mjs.map +7 -0
- package/dist/lib/browser/{compiler-CXCUA4UQ.mjs → chunk-ATTZUDT7.mjs} +17 -32
- package/dist/lib/browser/chunk-ATTZUDT7.mjs.map +7 -0
- package/dist/lib/browser/chunk-G3XIOLLI.mjs +174 -0
- package/dist/lib/browser/chunk-G3XIOLLI.mjs.map +7 -0
- package/dist/lib/browser/chunk-IHEZBW44.mjs +789 -0
- package/dist/lib/browser/chunk-IHEZBW44.mjs.map +7 -0
- package/dist/lib/browser/chunk-J5LGTIGS.mjs +10 -0
- package/dist/lib/browser/chunk-KIYJ6XPN.mjs +20 -0
- package/dist/lib/browser/chunk-KIYJ6XPN.mjs.map +7 -0
- package/dist/lib/browser/chunk-MYSQ4VH5.mjs +29 -0
- package/dist/lib/browser/chunk-MYSQ4VH5.mjs.map +7 -0
- package/dist/lib/browser/chunk-OWMMXCIP.mjs +116 -0
- package/dist/lib/browser/chunk-OWMMXCIP.mjs.map +7 -0
- package/dist/lib/browser/chunk-X44CJ7F5.mjs +11 -0
- package/dist/lib/browser/chunk-X44CJ7F5.mjs.map +7 -0
- package/dist/lib/browser/compiler-ZVLONXEG.mjs +99 -0
- package/dist/lib/browser/compiler-ZVLONXEG.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +150 -108
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/operation-resolver-YYHZGLYR.mjs +79 -0
- package/dist/lib/browser/operation-resolver-YYHZGLYR.mjs.map +7 -0
- package/dist/lib/browser/react-surface-SZ7BHELP.mjs +142 -0
- package/dist/lib/browser/react-surface-SZ7BHELP.mjs.map +7 -0
- package/dist/lib/browser/settings-XGV2T3PC.mjs +36 -0
- package/dist/lib/browser/settings-XGV2T3PC.mjs.map +7 -0
- package/dist/lib/browser/templates/index.mjs +2 -1
- package/dist/lib/browser/types/index.mjs +14 -6
- package/dist/lib/node-esm/DeploymentDialog-V3HYTNFB.mjs +139 -0
- package/dist/lib/node-esm/DeploymentDialog-V3HYTNFB.mjs.map +7 -0
- package/dist/lib/node-esm/NotebookContainer-MDHOETIH.mjs +849 -0
- package/dist/lib/node-esm/NotebookContainer-MDHOETIH.mjs.map +7 -0
- package/dist/lib/node-esm/ScriptContainer-4E4EK6ZF.mjs +94 -0
- package/dist/lib/node-esm/ScriptContainer-4E4EK6ZF.mjs.map +7 -0
- package/dist/lib/node-esm/ScriptObjectSettings-RPY2ZLDJ.mjs +295 -0
- package/dist/lib/node-esm/ScriptObjectSettings-RPY2ZLDJ.mjs.map +7 -0
- package/dist/lib/node-esm/ScriptPluginSettings-H4ESISSG.mjs +56 -0
- package/dist/lib/node-esm/ScriptPluginSettings-H4ESISSG.mjs.map +7 -0
- package/dist/lib/node-esm/ScriptProperties-NNDYQTOW.mjs +29 -0
- package/dist/lib/node-esm/ScriptProperties-NNDYQTOW.mjs.map +7 -0
- package/dist/lib/node-esm/TestContainer-G2TVP2KS.mjs +40 -0
- package/dist/lib/node-esm/TestContainer-G2TVP2KS.mjs.map +7 -0
- package/dist/lib/node-esm/app-graph-builder-GNGOYXIU.mjs +64 -0
- package/dist/lib/node-esm/app-graph-builder-GNGOYXIU.mjs.map +7 -0
- package/dist/lib/node-esm/blueprint-definition-4UDBPYRQ.mjs +18 -0
- package/dist/lib/node-esm/blueprint-definition-4UDBPYRQ.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-3EV4C6GW.mjs +107 -0
- package/dist/lib/node-esm/chunk-3EV4C6GW.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-4YAEFFW2.mjs +12 -0
- package/dist/lib/node-esm/chunk-4YAEFFW2.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-5BG7OJGQ.mjs +176 -0
- package/dist/lib/node-esm/chunk-5BG7OJGQ.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-BOPXK25O.mjs +790 -0
- package/dist/lib/node-esm/chunk-BOPXK25O.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-DMELV4YV.mjs +22 -0
- package/dist/lib/node-esm/chunk-DMELV4YV.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-DQMM7ZL5.mjs +31 -0
- package/dist/lib/node-esm/chunk-DQMM7ZL5.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-EV57E4Q4.mjs +117 -0
- package/dist/lib/node-esm/chunk-EV57E4Q4.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-HSLMI22Q.mjs +11 -0
- package/dist/lib/node-esm/chunk-HSLMI22Q.mjs.map +7 -0
- package/dist/lib/node-esm/{compiler-EPFKQXPE.mjs → chunk-JGN7TDJH.mjs} +17 -31
- package/dist/lib/node-esm/chunk-JGN7TDJH.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-KL6LGVVM.mjs +398 -0
- package/dist/lib/node-esm/chunk-KL6LGVVM.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-AHXJ6NQU.mjs → chunk-L3JLWXB5.mjs} +9 -6
- package/dist/lib/node-esm/chunk-L3JLWXB5.mjs.map +7 -0
- package/dist/lib/node-esm/compiler-INUOAXU7.mjs +100 -0
- package/dist/lib/node-esm/compiler-INUOAXU7.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +150 -108
- 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-OTHAYHTN.mjs +80 -0
- package/dist/lib/node-esm/operation-resolver-OTHAYHTN.mjs.map +7 -0
- package/dist/lib/node-esm/react-surface-DLEXFWGV.mjs +143 -0
- package/dist/lib/node-esm/react-surface-DLEXFWGV.mjs.map +7 -0
- package/dist/lib/node-esm/settings-JZUMGPNG.mjs +37 -0
- package/dist/lib/node-esm/settings-JZUMGPNG.mjs.map +7 -0
- package/dist/lib/node-esm/templates/index.mjs +2 -1
- package/dist/lib/node-esm/types/index.mjs +14 -6
- 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 +4 -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 +6 -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 +10 -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/FramePanel/FramePanel.d.ts +12 -0
- package/dist/types/src/components/FramePanel/FramePanel.d.ts.map +1 -0
- package/dist/types/src/components/FramePanel/index.d.ts +2 -0
- package/dist/types/src/components/FramePanel/index.d.ts.map +1 -0
- package/dist/types/src/components/NotebookStack/NotebookCell.d.ts +15 -0
- package/dist/types/src/components/NotebookStack/NotebookCell.d.ts.map +1 -0
- package/dist/types/src/components/NotebookStack/NotebookMenu.d.ts +9 -0
- package/dist/types/src/components/NotebookStack/NotebookMenu.d.ts.map +1 -0
- package/dist/types/src/components/NotebookStack/NotebookStack.d.ts +14 -0
- package/dist/types/src/components/NotebookStack/NotebookStack.d.ts.map +1 -0
- package/dist/types/src/components/NotebookStack/NotebookStack.stories.d.ts +252 -0
- package/dist/types/src/components/NotebookStack/NotebookStack.stories.d.ts.map +1 -0
- package/dist/types/src/components/NotebookStack/index.d.ts +3 -0
- package/dist/types/src/components/NotebookStack/index.d.ts.map +1 -0
- 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/ScriptToolbar/ScriptToolbar.d.ts +8 -8
- package/dist/types/src/components/ScriptToolbar/ScriptToolbar.d.ts.map +1 -1
- package/dist/types/src/components/ScriptToolbar/ScriptToolbar.stories.d.ts +249 -10
- package/dist/types/src/components/ScriptToolbar/ScriptToolbar.stories.d.ts.map +1 -1
- package/dist/types/src/components/TestPanel/TestPanel.d.ts.map +1 -1
- package/dist/types/src/components/TestPanel/index.d.ts +0 -1
- package/dist/types/src/components/TestPanel/index.d.ts.map +1 -1
- package/dist/types/src/components/TypescriptEditor/TypescriptEditor.d.ts +5 -2
- package/dist/types/src/components/TypescriptEditor/TypescriptEditor.d.ts.map +1 -1
- package/dist/types/src/components/TypescriptEditor/TypescriptEditor.stories.d.ts +11 -4
- package/dist/types/src/components/TypescriptEditor/TypescriptEditor.stories.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +5 -7
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/constants.d.ts +2 -0
- package/dist/types/src/constants.d.ts.map +1 -0
- package/dist/types/src/containers/DeploymentDialog/DeploymentDialog.d.ts +9 -0
- package/dist/types/src/containers/DeploymentDialog/DeploymentDialog.d.ts.map +1 -0
- package/dist/types/src/containers/DeploymentDialog/DeploymentDialog.stories.d.ts +252 -0
- package/dist/types/src/containers/DeploymentDialog/DeploymentDialog.stories.d.ts.map +1 -0
- package/dist/types/src/containers/DeploymentDialog/index.d.ts +3 -0
- package/dist/types/src/containers/DeploymentDialog/index.d.ts.map +1 -0
- package/dist/types/src/containers/NotebookContainer/NotebookContainer.d.ts +7 -0
- package/dist/types/src/containers/NotebookContainer/NotebookContainer.d.ts.map +1 -0
- package/dist/types/src/containers/NotebookContainer/NotebookContainer.stories.d.ts +7 -0
- package/dist/types/src/containers/NotebookContainer/NotebookContainer.stories.d.ts.map +1 -0
- package/dist/types/src/containers/NotebookContainer/index.d.ts +3 -0
- package/dist/types/src/containers/NotebookContainer/index.d.ts.map +1 -0
- package/dist/types/src/containers/ScriptContainer/ScriptContainer.d.ts +10 -0
- package/dist/types/src/containers/ScriptContainer/ScriptContainer.d.ts.map +1 -0
- package/dist/types/src/containers/ScriptContainer/index.d.ts +3 -0
- package/dist/types/src/containers/ScriptContainer/index.d.ts.map +1 -0
- package/dist/types/src/containers/ScriptObjectSettings/ScriptObjectSettings.d.ts +7 -0
- package/dist/types/src/containers/ScriptObjectSettings/ScriptObjectSettings.d.ts.map +1 -0
- package/dist/types/src/containers/ScriptObjectSettings/index.d.ts +3 -0
- package/dist/types/src/containers/ScriptObjectSettings/index.d.ts.map +1 -0
- package/dist/types/src/containers/ScriptPluginSettings/ScriptPluginSettings.d.ts +8 -0
- package/dist/types/src/containers/ScriptPluginSettings/ScriptPluginSettings.d.ts.map +1 -0
- package/dist/types/src/containers/ScriptPluginSettings/index.d.ts +3 -0
- package/dist/types/src/containers/ScriptPluginSettings/index.d.ts.map +1 -0
- package/dist/types/src/containers/ScriptProperties/ScriptProperties.d.ts +7 -0
- package/dist/types/src/containers/ScriptProperties/ScriptProperties.d.ts.map +1 -0
- package/dist/types/src/containers/ScriptProperties/index.d.ts +3 -0
- package/dist/types/src/containers/ScriptProperties/index.d.ts.map +1 -0
- package/dist/types/src/containers/TestContainer/TestContainer.d.ts +8 -0
- package/dist/types/src/containers/TestContainer/TestContainer.d.ts.map +1 -0
- package/dist/types/src/containers/TestContainer/index.d.ts +3 -0
- package/dist/types/src/containers/TestContainer/index.d.ts.map +1 -0
- package/dist/types/src/containers/index.d.ts +9 -0
- package/dist/types/src/containers/index.d.ts.map +1 -0
- 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 +20 -33
- package/dist/types/src/hooks/deploy.d.ts.map +1 -1
- package/dist/types/src/hooks/format.d.ts +5 -4
- 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 +7 -16
- 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 +3 -1
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +2 -3
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/notebook/compute-graph.d.ts +58 -0
- package/dist/types/src/notebook/compute-graph.d.ts.map +1 -0
- package/dist/types/src/notebook/compute-graph.test.d.ts +2 -0
- package/dist/types/src/notebook/compute-graph.test.d.ts.map +1 -0
- package/dist/types/src/notebook/eval.d.ts +13 -0
- package/dist/types/src/notebook/eval.d.ts.map +1 -0
- package/dist/types/src/notebook/index.d.ts +2 -0
- package/dist/types/src/notebook/index.d.ts.map +1 -0
- package/dist/types/src/notebook/vfs-parser.d.ts +74 -0
- package/dist/types/src/notebook/vfs-parser.d.ts.map +1 -0
- package/dist/types/src/notebook/vfs-parser.test.d.ts +2 -0
- package/dist/types/src/notebook/vfs-parser.test.d.ts.map +1 -0
- 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/data-generator.d.ts.map +1 -1
- package/dist/types/src/templates/discord.d.ts.map +1 -1
- 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/gmail.d.ts.map +1 -1
- package/dist/types/src/templates/index.d.ts +52 -1
- package/dist/types/src/templates/index.d.ts.map +1 -1
- package/dist/types/src/templates/ping.d.ts +3 -0
- package/dist/types/src/templates/ping.d.ts.map +1 -0
- package/dist/types/src/testing/data.d.ts +3 -0
- package/dist/types/src/testing/data.d.ts.map +1 -0
- package/dist/types/src/testing/index.d.ts +2 -0
- package/dist/types/src/testing/index.d.ts.map +1 -0
- 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 +34 -5
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/Notebook.d.ts +108 -0
- package/dist/types/src/types/Notebook.d.ts.map +1 -0
- package/dist/types/src/types/actions.d.ts +40 -0
- package/dist/types/src/types/actions.d.ts.map +1 -0
- 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 +5 -1
- package/dist/types/src/types/index.d.ts.map +1 -1
- package/dist/types/src/types/types.d.ts +6 -0
- package/dist/types/src/types/types.d.ts.map +1 -0
- package/dist/types/src/util/deploy.d.ts +7 -7
- package/dist/types/src/util/deploy.d.ts.map +1 -1
- package/dist/types/src/util/functions.d.ts +6 -3
- package/dist/types/src/util/functions.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +124 -85
- package/src/ScriptPlugin.tsx +57 -77
- package/src/blueprints/index.ts +5 -0
- package/src/blueprints/script-blueprint.ts +31 -0
- package/src/capabilities/app-graph-builder/app-graph-builder.ts +56 -0
- package/src/capabilities/app-graph-builder/index.ts +7 -0
- package/src/capabilities/{artifact-definition.ts → artifact-definition/artifact-definition.ts} +103 -105
- package/src/capabilities/artifact-definition/index.ts +7 -0
- package/src/capabilities/blueprint-definition/blueprint-definition.ts +17 -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 +75 -0
- package/src/capabilities/react-surface/index.ts +7 -0
- package/src/capabilities/react-surface/react-surface.tsx +129 -0
- package/src/capabilities/settings/index.ts +7 -0
- package/src/capabilities/settings/settings.ts +33 -0
- package/src/compiler/compiler.ts +11 -4
- package/src/components/{FrameContainer/FrameContainer.tsx → FramePanel/FramePanel.tsx} +10 -8
- package/src/components/{FrameContainer → FramePanel}/index.ts +1 -1
- package/src/components/NotebookStack/NotebookCell.tsx +215 -0
- package/src/components/NotebookStack/NotebookMenu.tsx +47 -0
- package/src/components/NotebookStack/NotebookStack.stories.tsx +54 -0
- package/src/components/NotebookStack/NotebookStack.tsx +86 -0
- package/src/components/NotebookStack/index.ts +6 -0
- package/src/components/QueryEditor/QueryEditor.stories.tsx +96 -0
- package/src/components/QueryEditor/QueryEditor.tsx +47 -0
- package/src/components/QueryEditor/index.ts +5 -0
- package/src/components/ScriptToolbar/ScriptToolbar.stories.tsx +56 -17
- package/src/components/ScriptToolbar/ScriptToolbar.tsx +38 -34
- package/src/components/TestPanel/TestPanel.tsx +67 -42
- package/src/components/TestPanel/index.ts +0 -1
- package/src/components/TypescriptEditor/TypescriptEditor.stories.tsx +89 -34
- package/src/components/TypescriptEditor/TypescriptEditor.tsx +84 -81
- package/src/components/index.ts +5 -7
- package/src/constants.ts +7 -0
- package/src/containers/DeploymentDialog/DeploymentDialog.stories.tsx +61 -0
- package/src/containers/DeploymentDialog/DeploymentDialog.tsx +99 -0
- package/src/containers/DeploymentDialog/index.ts +7 -0
- package/src/containers/NotebookContainer/NotebookContainer.stories.tsx +87 -0
- package/src/containers/NotebookContainer/NotebookContainer.tsx +267 -0
- package/src/containers/NotebookContainer/index.ts +7 -0
- package/src/containers/ScriptContainer/ScriptContainer.tsx +84 -0
- package/src/containers/ScriptContainer/index.ts +7 -0
- package/src/containers/ScriptObjectSettings/ScriptObjectSettings.tsx +291 -0
- package/src/containers/ScriptObjectSettings/index.ts +7 -0
- package/src/containers/ScriptPluginSettings/ScriptPluginSettings.tsx +66 -0
- package/src/containers/ScriptPluginSettings/index.ts +7 -0
- package/src/containers/ScriptProperties/ScriptProperties.tsx +33 -0
- package/src/containers/ScriptProperties/index.ts +7 -0
- package/src/containers/TestContainer/TestContainer.tsx +28 -0
- package/src/containers/TestContainer/index.ts +7 -0
- package/src/containers/index.ts +13 -0
- package/src/e2e/ai.test.ts +92 -0
- package/src/e2e/deploy.test.ts +64 -0
- package/src/hooks/deploy.ts +52 -45
- package/src/hooks/format.ts +10 -5
- package/src/hooks/index.ts +1 -0
- package/src/hooks/template.ts +22 -25
- package/src/hooks/useCompiler.ts +24 -0
- package/src/hooks/useCreateAndDeployScriptTemplates.ts +15 -16
- package/src/hooks/useToolbarState.ts +29 -4
- package/src/index.ts +3 -1
- package/src/meta.ts +10 -8
- package/src/notebook/compute-graph.test.ts +82 -0
- package/src/notebook/compute-graph.ts +230 -0
- package/src/notebook/eval.ts +105 -0
- package/src/notebook/index.ts +5 -0
- package/src/notebook/vfs-parser.test.ts +149 -0
- package/src/notebook/vfs-parser.ts +451 -0
- package/src/templates/anthropic.ts +42 -0
- package/src/templates/chat.ts +1 -1
- package/src/templates/chess-bot.ts +58 -0
- package/src/templates/commentary.ts +231 -0
- package/src/templates/data-generator.ts +10 -4
- package/src/templates/discord.ts +14 -6
- package/src/templates/forex-effect.ts +24 -25
- package/src/templates/forex.ts +9 -6
- package/src/templates/gmail.ts +37 -67
- package/src/templates/index.ts +36 -23
- package/src/templates/ping.ts +17 -0
- package/src/testing/data.ts +72 -0
- package/src/testing/index.ts +5 -0
- package/src/testing/simulator.test.ts +40 -0
- package/src/translations.ts +37 -7
- package/src/types/Notebook.ts +45 -0
- package/src/types/actions.ts +45 -0
- package/src/types/capabilities.ts +17 -0
- package/src/types/events.ts +11 -0
- package/src/types/index.ts +5 -1
- package/src/types/types.ts +15 -0
- package/src/util/deploy.ts +38 -61
- package/src/util/functions.ts +58 -25
- package/src/vite-env.d.ts +2 -0
- package/dist/lib/browser/DeploymentDialog-M4QIHTDR.mjs +0 -12
- package/dist/lib/browser/ScriptContainer-Z6SIGRRC.mjs +0 -262
- package/dist/lib/browser/ScriptContainer-Z6SIGRRC.mjs.map +0 -7
- package/dist/lib/browser/app-graph-builder-HLQ7K3BT.mjs +0 -64
- package/dist/lib/browser/app-graph-builder-HLQ7K3BT.mjs.map +0 -7
- package/dist/lib/browser/artifact-definition-24Q3IHOU.mjs +0 -249
- package/dist/lib/browser/artifact-definition-24Q3IHOU.mjs.map +0 -7
- package/dist/lib/browser/chunk-3U6DTUH3.mjs +0 -283
- package/dist/lib/browser/chunk-3U6DTUH3.mjs.map +0 -7
- package/dist/lib/browser/chunk-5TVBECWH.mjs +0 -15
- package/dist/lib/browser/chunk-5TVBECWH.mjs.map +0 -7
- package/dist/lib/browser/chunk-FIM2MVNJ.mjs +0 -555
- package/dist/lib/browser/chunk-FIM2MVNJ.mjs.map +0 -7
- package/dist/lib/browser/chunk-FMDXKOP7.mjs +0 -233
- package/dist/lib/browser/chunk-FMDXKOP7.mjs.map +0 -7
- package/dist/lib/browser/chunk-IS4OG2UW.mjs +0 -39
- package/dist/lib/browser/chunk-IS4OG2UW.mjs.map +0 -7
- package/dist/lib/browser/chunk-P4HQKUCP.mjs +0 -153
- package/dist/lib/browser/chunk-P4HQKUCP.mjs.map +0 -7
- package/dist/lib/browser/chunk-QYAREHGH.mjs.map +0 -7
- package/dist/lib/browser/chunk-R4R7VOFY.mjs +0 -88
- package/dist/lib/browser/chunk-R4R7VOFY.mjs.map +0 -7
- package/dist/lib/browser/compiler-CXCUA4UQ.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-7B77IG3N.mjs +0 -91
- package/dist/lib/browser/intent-resolver-7B77IG3N.mjs.map +0 -7
- package/dist/lib/browser/react-surface-FYYXZA7C.mjs +0 -104
- package/dist/lib/browser/react-surface-FYYXZA7C.mjs.map +0 -7
- package/dist/lib/browser/settings-KCTBK5TY.mjs +0 -24
- package/dist/lib/browser/settings-KCTBK5TY.mjs.map +0 -7
- package/dist/lib/node-esm/DeploymentDialog-3KPRWFE7.mjs +0 -13
- package/dist/lib/node-esm/ScriptContainer-KPU75HHI.mjs +0 -263
- package/dist/lib/node-esm/ScriptContainer-KPU75HHI.mjs.map +0 -7
- package/dist/lib/node-esm/app-graph-builder-7EYIHWH4.mjs +0 -65
- package/dist/lib/node-esm/app-graph-builder-7EYIHWH4.mjs.map +0 -7
- package/dist/lib/node-esm/artifact-definition-WAJFALUI.mjs +0 -250
- package/dist/lib/node-esm/artifact-definition-WAJFALUI.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-35M3CHYE.mjs +0 -16
- package/dist/lib/node-esm/chunk-35M3CHYE.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-7NMI4CEU.mjs +0 -556
- package/dist/lib/node-esm/chunk-7NMI4CEU.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-AHXJ6NQU.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-F5GFJ3PY.mjs +0 -90
- package/dist/lib/node-esm/chunk-F5GFJ3PY.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-JIPFLBYA.mjs +0 -40
- package/dist/lib/node-esm/chunk-JIPFLBYA.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-QKK3NDHW.mjs +0 -154
- package/dist/lib/node-esm/chunk-QKK3NDHW.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-RT43MACC.mjs +0 -284
- package/dist/lib/node-esm/chunk-RT43MACC.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-XJPK3IYI.mjs +0 -234
- package/dist/lib/node-esm/chunk-XJPK3IYI.mjs.map +0 -7
- package/dist/lib/node-esm/compiler-EPFKQXPE.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-FRZGS4TB.mjs +0 -92
- package/dist/lib/node-esm/intent-resolver-FRZGS4TB.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-V32NWHKN.mjs +0 -105
- package/dist/lib/node-esm/react-surface-V32NWHKN.mjs.map +0 -7
- package/dist/lib/node-esm/settings-DXZ334A3.mjs +0 -25
- package/dist/lib/node-esm/settings-DXZ334A3.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/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/components/DeploymentDialog/DeploymentDialog.d.ts +0 -11
- package/dist/types/src/components/DeploymentDialog/DeploymentDialog.d.ts.map +0 -1
- package/dist/types/src/components/DeploymentDialog/DeploymentDialog.stories.d.ts +0 -18
- package/dist/types/src/components/DeploymentDialog/DeploymentDialog.stories.d.ts.map +0 -1
- package/dist/types/src/components/DeploymentDialog/index.d.ts +0 -4
- package/dist/types/src/components/DeploymentDialog/index.d.ts.map +0 -1
- package/dist/types/src/components/FrameContainer/FrameContainer.d.ts +0 -12
- package/dist/types/src/components/FrameContainer/FrameContainer.d.ts.map +0 -1
- package/dist/types/src/components/FrameContainer/frame.d.ts +0 -2
- package/dist/types/src/components/FrameContainer/frame.d.ts.map +0 -1
- package/dist/types/src/components/FrameContainer/index.d.ts +0 -2
- package/dist/types/src/components/FrameContainer/index.d.ts.map +0 -1
- package/dist/types/src/components/ScriptContainer.d.ts +0 -12
- package/dist/types/src/components/ScriptContainer.d.ts.map +0 -1
- package/dist/types/src/components/Settings/ScriptObjectSettings.d.ts +0 -8
- package/dist/types/src/components/Settings/ScriptObjectSettings.d.ts.map +0 -1
- package/dist/types/src/components/Settings/ScriptPluginSettings.d.ts +0 -6
- package/dist/types/src/components/Settings/ScriptPluginSettings.d.ts.map +0 -1
- package/dist/types/src/components/Settings/index.d.ts +0 -3
- package/dist/types/src/components/Settings/index.d.ts.map +0 -1
- package/dist/types/src/components/TestPanel/TestContainer.d.ts +0 -8
- package/dist/types/src/components/TestPanel/TestContainer.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/dist/types/src/templates/echo.d.ts +0 -6
- package/dist/types/src/templates/echo.d.ts.map +0 -1
- package/dist/types/src/types/schema.d.ts +0 -38
- package/dist/types/src/types/schema.d.ts.map +0 -1
- package/src/capabilities/app-graph-builder.ts +0 -64
- package/src/capabilities/capabilities.ts +0 -12
- package/src/capabilities/compiler.ts +0 -33
- package/src/capabilities/intent-resolver.ts +0 -80
- package/src/capabilities/react-surface.tsx +0 -89
- package/src/capabilities/settings.ts +0 -21
- package/src/components/DeploymentDialog/DeploymentDialog.stories.tsx +0 -39
- package/src/components/DeploymentDialog/DeploymentDialog.tsx +0 -112
- package/src/components/DeploymentDialog/index.ts +0 -9
- package/src/components/FrameContainer/frame.html +0 -25
- package/src/components/FrameContainer/frame.tsx +0 -51
- package/src/components/ScriptContainer.tsx +0 -68
- package/src/components/Settings/ScriptObjectSettings.tsx +0 -206
- package/src/components/Settings/ScriptPluginSettings.tsx +0 -71
- package/src/components/Settings/index.ts +0 -6
- package/src/components/TestPanel/TestContainer.tsx +0 -26
- package/src/events.ts +0 -11
- package/src/templates/chess.ts +0 -47
- package/src/templates/echo.ts +0 -8
- package/src/types/schema.ts +0 -37
- /package/dist/lib/browser/{DeploymentDialog-M4QIHTDR.mjs.map → blueprints/index.mjs.map} +0 -0
- /package/dist/lib/{node-esm/DeploymentDialog-3KPRWFE7.mjs.map → browser/chunk-J5LGTIGS.mjs.map} +0 -0
package/src/capabilities/{artifact-definition.ts → artifact-definition/artifact-definition.ts}
RENAMED
|
@@ -2,20 +2,23 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
// ISSUE(burdon): defineArtifact
|
|
6
|
+
// @ts-nocheck
|
|
6
7
|
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
|
|
8
|
+
import * as Effect from 'effect/Effect';
|
|
9
|
+
import * as Schema from 'effect/Schema';
|
|
10
|
+
|
|
11
|
+
import { ToolResult, createTool } from '@dxos/ai';
|
|
12
|
+
import { Capabilities, Capability, type PromiseIntentDispatcher, createIntent } from '@dxos/app-framework';
|
|
13
|
+
import { ArtifactId, createArtifactElement } from '@dxos/assistant';
|
|
10
14
|
import { defineArtifact } from '@dxos/blueprints';
|
|
11
15
|
import { Filter, Obj, Ref } from '@dxos/echo';
|
|
12
16
|
import { ScriptType } from '@dxos/functions';
|
|
13
17
|
import { invariant } from '@dxos/invariant';
|
|
14
18
|
import { SpaceAction } from '@dxos/plugin-space/types';
|
|
15
19
|
import { type Space } from '@dxos/react-client/echo';
|
|
16
|
-
import { DataType } from '@dxos/schema';
|
|
17
20
|
|
|
18
|
-
import { meta } from '
|
|
21
|
+
import { meta } from '../../meta';
|
|
19
22
|
|
|
20
23
|
// TODO(burdon): Factor out.
|
|
21
24
|
declare global {
|
|
@@ -25,14 +28,15 @@ declare global {
|
|
|
25
28
|
}
|
|
26
29
|
}
|
|
27
30
|
|
|
28
|
-
export default () =>
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
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: `
|
|
36
40
|
If the user explicitly requests you to write a script, you can create one.
|
|
37
41
|
If the user requests you to change one of the existing script, you can update it.
|
|
38
42
|
You must not create a script unless the user explicitly requests it.
|
|
@@ -52,7 +56,7 @@ export default () => {
|
|
|
52
56
|
The description is used by AI to understand the script and its purpose.
|
|
53
57
|
The description must provide cases on when the script should be used.
|
|
54
58
|
|
|
55
|
-
Schema:
|
|
59
|
+
Schema:
|
|
56
60
|
The schema is defined using a schema-DSL library called Effect Schema.
|
|
57
61
|
The input schema describes the arguments that the script accepts.
|
|
58
62
|
The output schema describes the result that the script produces.
|
|
@@ -73,18 +77,18 @@ export default () => {
|
|
|
73
77
|
- Detailed output schema
|
|
74
78
|
|
|
75
79
|
<apis>
|
|
76
|
-
export function defineFunction(params: {
|
|
77
|
-
description: string,
|
|
78
|
-
inputSchema: Schema.Schema,
|
|
79
|
-
outputSchema: Schema.Schema,
|
|
80
|
-
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>
|
|
81
85
|
}): FunctionDefinition
|
|
82
86
|
/**
|
|
83
87
|
* Effect Schema
|
|
84
88
|
*/
|
|
85
|
-
export const Schema;
|
|
89
|
+
export const Schema;
|
|
86
90
|
|
|
87
|
-
// Examples:
|
|
91
|
+
// Examples:
|
|
88
92
|
|
|
89
93
|
Schema.String
|
|
90
94
|
Schema.Number
|
|
@@ -102,7 +106,7 @@ export default () => {
|
|
|
102
106
|
<handler_function>
|
|
103
107
|
Async function that takes the argument in the form of:
|
|
104
108
|
|
|
105
|
-
type
|
|
109
|
+
type HandlerFunctionProp = {
|
|
106
110
|
event: {
|
|
107
111
|
data: T // The input schema
|
|
108
112
|
},
|
|
@@ -110,7 +114,7 @@ export default () => {
|
|
|
110
114
|
|
|
111
115
|
The function must return the result that matches the output schema.
|
|
112
116
|
</handler_function>
|
|
113
|
-
|
|
117
|
+
|
|
114
118
|
<example>
|
|
115
119
|
import { defineFunction, S } from 'dxos:functions';
|
|
116
120
|
|
|
@@ -141,89 +145,83 @@ export default () => {
|
|
|
141
145
|
});
|
|
142
146
|
</example>
|
|
143
147
|
`,
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
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
|
+
}),
|
|
154
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
|
+
},
|
|
155
175
|
}),
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
return ToolResult.Success(createArtifactElement(script.id));
|
|
177
|
-
},
|
|
178
|
-
}),
|
|
179
|
-
createTool(meta.id, {
|
|
180
|
-
name: 'inspect',
|
|
181
|
-
description: 'Inspect a script. Returns the artifact definition for the script',
|
|
182
|
-
caption: 'Inspecting script...',
|
|
183
|
-
schema: Schema.Struct({
|
|
184
|
-
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
|
+
},
|
|
185
194
|
}),
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
});
|
|
196
|
-
},
|
|
197
|
-
}),
|
|
198
|
-
createTool(meta.id, {
|
|
199
|
-
name: 'update',
|
|
200
|
-
description: 'Update a script. Returns the artifact definition for the script',
|
|
201
|
-
caption: 'Updating script...',
|
|
202
|
-
schema: Schema.Struct({
|
|
203
|
-
id: ArtifactId,
|
|
204
|
-
code: Schema.String.annotations({
|
|
205
|
-
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
|
+
}),
|
|
206
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
|
+
},
|
|
207
221
|
}),
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
return ToolResult.Error('Script not found');
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
source.content = code;
|
|
218
|
-
await extensions.space?.db.flush();
|
|
219
|
-
|
|
220
|
-
return ToolResult.Success({
|
|
221
|
-
name: script.name,
|
|
222
|
-
});
|
|
223
|
-
},
|
|
224
|
-
}),
|
|
225
|
-
],
|
|
226
|
-
});
|
|
227
|
-
|
|
228
|
-
return contributes(Capabilities.ArtifactDefinition, definition);
|
|
229
|
-
};
|
|
222
|
+
],
|
|
223
|
+
});
|
|
224
|
+
|
|
225
|
+
return Capability.contributes(Capabilities.ArtifactDefinition, definition);
|
|
226
|
+
}),
|
|
227
|
+
);
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
|
+
|
|
7
|
+
import { Capability } from '@dxos/app-framework';
|
|
8
|
+
import { AppCapabilities } from '@dxos/app-toolkit';
|
|
9
|
+
|
|
10
|
+
import { ScriptBlueprint } from '../../blueprints';
|
|
11
|
+
|
|
12
|
+
const blueprintDefinition = Capability.makeModule<
|
|
13
|
+
[],
|
|
14
|
+
Capability.Capability<typeof AppCapabilities.BlueprintDefinition>[]
|
|
15
|
+
>(() => Effect.succeed([Capability.contributes(AppCapabilities.BlueprintDefinition, ScriptBlueprint)]));
|
|
16
|
+
|
|
17
|
+
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,75 @@
|
|
|
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 { Capabilities, Capability } from '@dxos/app-framework';
|
|
10
|
+
import { LayoutOperation } from '@dxos/app-toolkit';
|
|
11
|
+
import { Script } from '@dxos/functions';
|
|
12
|
+
import { Operation, OperationResolver } from '@dxos/operation';
|
|
13
|
+
import { TokenManagerOperation } from '@dxos/plugin-token-manager/types';
|
|
14
|
+
|
|
15
|
+
import { DEPLOYMENT_DIALOG } from '../../constants';
|
|
16
|
+
import { defaultScriptsForIntegration } from '../../meta';
|
|
17
|
+
import { templates } from '../../templates';
|
|
18
|
+
import { ScriptOperation } from '../../types';
|
|
19
|
+
|
|
20
|
+
export default Capability.makeModule(
|
|
21
|
+
Effect.fnUntraced(function* () {
|
|
22
|
+
return Capability.contributes(Capabilities.OperationResolver, [
|
|
23
|
+
OperationResolver.make({
|
|
24
|
+
operation: ScriptOperation.CreateScript,
|
|
25
|
+
handler: Effect.fnUntraced(function* ({ name, gistUrl, initialTemplateId }) {
|
|
26
|
+
let source = templates[0].source;
|
|
27
|
+
let scriptName = name;
|
|
28
|
+
|
|
29
|
+
const gistId = gistUrl?.split('/').at(-1);
|
|
30
|
+
if (gistId) {
|
|
31
|
+
// TODO(wittjosiah): Capability which contributes Octokit?
|
|
32
|
+
// NOTE: AccessToken not needed to read public gists.
|
|
33
|
+
const octokit = new Octokit();
|
|
34
|
+
const response = yield* Effect.promise(() =>
|
|
35
|
+
octokit.request('GET /gists/{gist_id}', {
|
|
36
|
+
gist_id: gistId,
|
|
37
|
+
}),
|
|
38
|
+
);
|
|
39
|
+
const gistContent = Object.values(response.data.files ?? {})[0]?.content;
|
|
40
|
+
if (gistContent) {
|
|
41
|
+
source = gistContent;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
if (initialTemplateId) {
|
|
46
|
+
const template = templates.find((template) => template.id === initialTemplateId);
|
|
47
|
+
if (template) {
|
|
48
|
+
source = template.source;
|
|
49
|
+
scriptName = scriptName || template.name;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
return { object: Script.make({ name: scriptName, source }) };
|
|
54
|
+
}),
|
|
55
|
+
}),
|
|
56
|
+
OperationResolver.make({
|
|
57
|
+
operation: TokenManagerOperation.AccessTokenCreated,
|
|
58
|
+
handler: Effect.fnUntraced(function* ({ accessToken }) {
|
|
59
|
+
const scriptTemplates = (defaultScriptsForIntegration[accessToken.source] ?? [])
|
|
60
|
+
.map((id) => templates.find((t) => t.id === id))
|
|
61
|
+
.filter(Predicate.isNotNullable);
|
|
62
|
+
|
|
63
|
+
if (scriptTemplates.length > 0) {
|
|
64
|
+
yield* Operation.invoke(LayoutOperation.UpdateDialog, {
|
|
65
|
+
subject: DEPLOYMENT_DIALOG,
|
|
66
|
+
blockAlign: 'start',
|
|
67
|
+
state: true,
|
|
68
|
+
props: { accessToken, scriptTemplates },
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
}),
|
|
72
|
+
}),
|
|
73
|
+
]);
|
|
74
|
+
}),
|
|
75
|
+
);
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
|
+
import React from 'react';
|
|
7
|
+
|
|
8
|
+
import { Capabilities, Capability } from '@dxos/app-framework';
|
|
9
|
+
import { Surface, useAtomCapability, useSettingsState } from '@dxos/app-framework/ui';
|
|
10
|
+
import { AppCapabilities } from '@dxos/app-toolkit';
|
|
11
|
+
import { InvocationTraceContainer } from '@dxos/devtools';
|
|
12
|
+
import { Obj } from '@dxos/echo';
|
|
13
|
+
import { Script } from '@dxos/functions';
|
|
14
|
+
import { getSpace } from '@dxos/react-client/echo';
|
|
15
|
+
import { Panel } from '@dxos/react-ui';
|
|
16
|
+
import { type AccessToken } from '@dxos/types';
|
|
17
|
+
|
|
18
|
+
import { DEPLOYMENT_DIALOG } from '../../constants';
|
|
19
|
+
import {
|
|
20
|
+
DeploymentDialog,
|
|
21
|
+
NotebookContainer,
|
|
22
|
+
ScriptContainer,
|
|
23
|
+
ScriptObjectSettings,
|
|
24
|
+
ScriptPluginSettings,
|
|
25
|
+
ScriptProperties,
|
|
26
|
+
TestContainer,
|
|
27
|
+
} from '../../containers';
|
|
28
|
+
import { useCompiler } from '../../hooks';
|
|
29
|
+
import { meta } from '../../meta';
|
|
30
|
+
import { Notebook, ScriptCapabilities, type ScriptSettings } from '../../types';
|
|
31
|
+
|
|
32
|
+
export default Capability.makeModule(() =>
|
|
33
|
+
Effect.succeed(
|
|
34
|
+
Capability.contributes(Capabilities.ReactSurface, [
|
|
35
|
+
Surface.create({
|
|
36
|
+
id: `${meta.id}.plugin-settings`,
|
|
37
|
+
role: 'article',
|
|
38
|
+
filter: (data): data is { subject: AppCapabilities.Settings } =>
|
|
39
|
+
AppCapabilities.isSettings(data.subject) && data.subject.prefix === meta.id,
|
|
40
|
+
component: ({ data: { subject } }) => {
|
|
41
|
+
const { settings, updateSettings } = useSettingsState<ScriptSettings>(subject.atom);
|
|
42
|
+
return <ScriptPluginSettings settings={settings} onSettingsChange={updateSettings} />;
|
|
43
|
+
},
|
|
44
|
+
}),
|
|
45
|
+
Surface.create({
|
|
46
|
+
id: `${meta.id}.script.article`,
|
|
47
|
+
role: ['article', 'section'],
|
|
48
|
+
filter: (data): data is { subject: Script.Script } => Obj.instanceOf(Script.Script, data.subject),
|
|
49
|
+
component: ({ data, role }) => {
|
|
50
|
+
const compiler = useCompiler();
|
|
51
|
+
const settings = useAtomCapability(ScriptCapabilities.Settings);
|
|
52
|
+
// TODO(wittjosiah): Why? The editor should be allow to render even if the environment is not ready.
|
|
53
|
+
if (!compiler?.environment) {
|
|
54
|
+
return null;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
return <ScriptContainer role={role} subject={data.subject} settings={settings} env={compiler?.environment} />;
|
|
58
|
+
},
|
|
59
|
+
}),
|
|
60
|
+
Surface.create({
|
|
61
|
+
id: `${meta.id}.notebook.article`,
|
|
62
|
+
role: 'article',
|
|
63
|
+
filter: (data): data is { attendableId: string; subject: Notebook.Notebook } =>
|
|
64
|
+
typeof data.attendableId === 'string' && Obj.instanceOf(Notebook.Notebook, data.subject),
|
|
65
|
+
component: ({ data, role }) => {
|
|
66
|
+
const compiler = useCompiler();
|
|
67
|
+
return (
|
|
68
|
+
<NotebookContainer
|
|
69
|
+
role={role}
|
|
70
|
+
subject={data.subject}
|
|
71
|
+
attendableId={data.attendableId}
|
|
72
|
+
env={compiler?.environment}
|
|
73
|
+
/>
|
|
74
|
+
);
|
|
75
|
+
},
|
|
76
|
+
}),
|
|
77
|
+
// TODO(burdon): Standardize PluginSettings vs ObjectSettings.
|
|
78
|
+
// TODO(burdon): Why is ScriptProperties different from ScriptObjectSettings?
|
|
79
|
+
Surface.create({
|
|
80
|
+
id: `${meta.id}.companion.base-settings`,
|
|
81
|
+
role: 'base-object-settings',
|
|
82
|
+
filter: (data): data is { subject: Script.Script } => Obj.instanceOf(Script.Script, data.subject),
|
|
83
|
+
component: ({ data }) => <ScriptProperties object={data.subject} />,
|
|
84
|
+
}),
|
|
85
|
+
Surface.create({
|
|
86
|
+
id: `${meta.id}.companion.settings`,
|
|
87
|
+
role: 'object-settings',
|
|
88
|
+
filter: (data): data is { subject: Script.Script } => Obj.instanceOf(Script.Script, data.subject),
|
|
89
|
+
component: ({ data }) => <ScriptObjectSettings object={data.subject} />,
|
|
90
|
+
}),
|
|
91
|
+
Surface.create({
|
|
92
|
+
id: `${meta.id}.companion.execute`,
|
|
93
|
+
role: 'article',
|
|
94
|
+
filter: (data): data is { companionTo: Script.Script } =>
|
|
95
|
+
Obj.instanceOf(Script.Script, data.companionTo) && data.subject === 'execute',
|
|
96
|
+
component: ({ data, role }) => <TestContainer script={data.companionTo} role={role} />,
|
|
97
|
+
}),
|
|
98
|
+
Surface.create({
|
|
99
|
+
id: `${meta.id}.companion.logs`,
|
|
100
|
+
role: 'article',
|
|
101
|
+
filter: (data): data is { companionTo: Script.Script } =>
|
|
102
|
+
Obj.instanceOf(Script.Script, data.companionTo) && data.subject === 'logs',
|
|
103
|
+
component: ({ data, role }) => {
|
|
104
|
+
const space = getSpace(data.companionTo);
|
|
105
|
+
const queueDxn = space?.properties.invocationTraceQueue?.dxn;
|
|
106
|
+
return (
|
|
107
|
+
<Panel.Root role={role}>
|
|
108
|
+
<Panel.Content asChild>
|
|
109
|
+
<InvocationTraceContainer
|
|
110
|
+
db={space?.db}
|
|
111
|
+
queueDxn={queueDxn}
|
|
112
|
+
target={data.companionTo}
|
|
113
|
+
detailAxis='block'
|
|
114
|
+
/>
|
|
115
|
+
</Panel.Content>
|
|
116
|
+
</Panel.Root>
|
|
117
|
+
);
|
|
118
|
+
},
|
|
119
|
+
}),
|
|
120
|
+
Surface.create({
|
|
121
|
+
id: DEPLOYMENT_DIALOG,
|
|
122
|
+
role: 'dialog',
|
|
123
|
+
filter: (data): data is { props: { accessToken: AccessToken.AccessToken; scriptTemplates: any } } =>
|
|
124
|
+
data.component === DEPLOYMENT_DIALOG,
|
|
125
|
+
component: ({ data }) => <DeploymentDialog {...data.props} />,
|
|
126
|
+
}),
|
|
127
|
+
]),
|
|
128
|
+
),
|
|
129
|
+
);
|