@dxos/plugin-script 0.8.4-main.70d3990 → 0.8.4-main.765dc60934
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/LICENSE +102 -5
- package/README.md +15 -13
- package/dist/lib/neutral/DeploymentDialog-6DBF3V6C.mjs +112 -0
- package/dist/lib/neutral/DeploymentDialog-6DBF3V6C.mjs.map +7 -0
- package/dist/lib/{browser/NotebookContainer-MHY3DXDE.mjs → neutral/NotebookArticle-3TE4WBZC.mjs} +245 -299
- package/dist/lib/neutral/NotebookArticle-3TE4WBZC.mjs.map +7 -0
- package/dist/lib/neutral/ScriptArticle-UBT27SB6.mjs +79 -0
- package/dist/lib/neutral/ScriptArticle-UBT27SB6.mjs.map +7 -0
- package/dist/lib/neutral/ScriptPlugin.mjs +39 -0
- package/dist/lib/neutral/ScriptPlugin.mjs.map +7 -0
- package/dist/lib/neutral/ScriptPlugin.node.mjs +27 -0
- package/dist/lib/neutral/ScriptPlugin.node.mjs.map +7 -0
- package/dist/lib/neutral/ScriptPluginSettings-T4JMUSHN.mjs +31 -0
- package/dist/lib/neutral/ScriptPluginSettings-T4JMUSHN.mjs.map +7 -0
- package/dist/lib/neutral/ScriptProperties-RLXNAN3N.mjs +297 -0
- package/dist/lib/neutral/ScriptProperties-RLXNAN3N.mjs.map +7 -0
- package/dist/lib/neutral/TestContainer-AFVTBYSJ.mjs +44 -0
- package/dist/lib/neutral/TestContainer-AFVTBYSJ.mjs.map +7 -0
- package/dist/lib/neutral/access-token-created-XNDXOZ2U.mjs +34 -0
- package/dist/lib/neutral/access-token-created-XNDXOZ2U.mjs.map +7 -0
- package/dist/lib/neutral/app-graph-builder-7AWFCEQF.mjs +52 -0
- package/dist/lib/neutral/app-graph-builder-7AWFCEQF.mjs.map +7 -0
- package/dist/lib/neutral/blueprint-definition-T33SBPP2.mjs +15 -0
- package/dist/lib/neutral/blueprint-definition-T33SBPP2.mjs.map +7 -0
- package/dist/lib/neutral/blueprints/index.mjs +10 -0
- package/dist/lib/neutral/capabilities/index.mjs +21 -0
- package/dist/lib/neutral/capabilities/index.mjs.map +7 -0
- package/dist/lib/neutral/capabilities/node.mjs +17 -0
- package/dist/lib/neutral/capabilities/node.mjs.map +7 -0
- package/dist/lib/neutral/chunk-2REUEDUA.mjs +56 -0
- package/dist/lib/neutral/chunk-2REUEDUA.mjs.map +7 -0
- package/dist/lib/neutral/chunk-A4LRH25S.mjs +105 -0
- package/dist/lib/neutral/chunk-A4LRH25S.mjs.map +7 -0
- package/dist/lib/neutral/chunk-BDRB6ZX2.mjs +52 -0
- package/dist/lib/neutral/chunk-BDRB6ZX2.mjs.map +7 -0
- package/dist/lib/neutral/chunk-BMO5VOKL.mjs +125 -0
- package/dist/lib/neutral/chunk-BMO5VOKL.mjs.map +7 -0
- package/dist/lib/neutral/chunk-LYPVNW4K.mjs +8 -0
- package/dist/lib/neutral/chunk-LYPVNW4K.mjs.map +7 -0
- package/dist/lib/neutral/chunk-MI6X5CTJ.mjs +336 -0
- package/dist/lib/neutral/chunk-MI6X5CTJ.mjs.map +7 -0
- package/dist/lib/neutral/chunk-P2F3STZN.mjs +8 -0
- package/dist/lib/neutral/chunk-P2F3STZN.mjs.map +7 -0
- package/dist/lib/neutral/chunk-QVDG5XHG.mjs +8 -0
- package/dist/lib/neutral/chunk-QVDG5XHG.mjs.map +7 -0
- package/dist/lib/{browser/chunk-EB6AXFXO.mjs → neutral/chunk-UYR3YH4Q.mjs} +3 -3
- package/dist/lib/neutral/chunk-UYR3YH4Q.mjs.map +7 -0
- package/dist/lib/neutral/chunk-VXDJH6OL.mjs +150 -0
- package/dist/lib/neutral/chunk-VXDJH6OL.mjs.map +7 -0
- package/dist/lib/neutral/compiler-ODK4UA2N.mjs +101 -0
- package/dist/lib/neutral/compiler-ODK4UA2N.mjs.map +7 -0
- package/dist/lib/neutral/components/index.mjs +721 -0
- package/dist/lib/neutral/components/index.mjs.map +7 -0
- package/dist/lib/neutral/containers/index.mjs +17 -0
- package/dist/lib/neutral/containers/index.mjs.map +7 -0
- package/dist/lib/neutral/create-ZUHIXCBS.mjs +46 -0
- package/dist/lib/neutral/create-ZUHIXCBS.mjs.map +7 -0
- package/dist/lib/neutral/create-object-F2NWICFV.mjs +44 -0
- package/dist/lib/neutral/create-object-F2NWICFV.mjs.map +7 -0
- package/dist/lib/neutral/create-script-H5S4AO47.mjs +45 -0
- package/dist/lib/neutral/create-script-H5S4AO47.mjs.map +7 -0
- package/dist/lib/neutral/delete-PAUWA2QM.mjs +21 -0
- package/dist/lib/neutral/delete-PAUWA2QM.mjs.map +7 -0
- package/dist/lib/neutral/deploy-M73G7HMP.mjs +63 -0
- package/dist/lib/neutral/deploy-M73G7HMP.mjs.map +7 -0
- package/dist/lib/neutral/hooks/index.mjs +369 -0
- package/dist/lib/neutral/hooks/index.mjs.map +7 -0
- package/dist/lib/neutral/index.mjs +41 -0
- package/dist/lib/neutral/inspect-invocations-UO27IPCL.mjs +59 -0
- package/dist/lib/neutral/inspect-invocations-UO27IPCL.mjs.map +7 -0
- package/dist/lib/neutral/install-function-MSWSC244.mjs +49 -0
- package/dist/lib/neutral/install-function-MSWSC244.mjs.map +7 -0
- package/dist/lib/neutral/invoke-V6XYXKLD.mjs +32 -0
- package/dist/lib/neutral/invoke-V6XYXKLD.mjs.map +7 -0
- package/dist/lib/neutral/meta.json +1 -0
- package/dist/lib/neutral/meta.mjs +10 -0
- package/dist/lib/neutral/operation-handler-MUBRQ6L5.mjs +18 -0
- package/dist/lib/neutral/operation-handler-MUBRQ6L5.mjs.map +7 -0
- package/dist/lib/neutral/operations/index.mjs +8 -0
- package/dist/lib/neutral/plugin.mjs +16 -0
- package/dist/lib/neutral/plugin.mjs.map +7 -0
- package/dist/lib/neutral/query-deployed-functions-4MMKQ6BR.mjs +34 -0
- package/dist/lib/neutral/query-deployed-functions-4MMKQ6BR.mjs.map +7 -0
- package/dist/lib/neutral/react-surface-ZMU2CRJ7.mjs +117 -0
- package/dist/lib/neutral/react-surface-ZMU2CRJ7.mjs.map +7 -0
- package/dist/lib/neutral/read-FFOSK6A3.mjs +26 -0
- package/dist/lib/neutral/read-FFOSK6A3.mjs.map +7 -0
- package/dist/lib/neutral/settings-VJBW4OMK.mjs +30 -0
- package/dist/lib/neutral/settings-VJBW4OMK.mjs.map +7 -0
- package/dist/lib/{browser → neutral}/templates/index.mjs +1 -1
- package/dist/lib/neutral/translations.mjs +104 -0
- package/dist/lib/neutral/translations.mjs.map +7 -0
- package/dist/lib/neutral/types/index.mjs +17 -0
- package/dist/lib/neutral/update-PJS5GG3Y.mjs +63 -0
- package/dist/lib/neutral/update-PJS5GG3Y.mjs.map +7 -0
- package/dist/types/src/ScriptPlugin.d.ts +3 -1
- package/dist/types/src/ScriptPlugin.d.ts.map +1 -1
- package/dist/types/src/ScriptPlugin.node.d.ts +4 -0
- package/dist/types/src/ScriptPlugin.node.d.ts.map +1 -0
- package/dist/types/src/ScriptPlugin.test.d.ts +2 -0
- package/dist/types/src/ScriptPlugin.test.d.ts.map +1 -0
- package/dist/types/src/blueprints/functions/create.d.ts +11 -0
- package/dist/types/src/blueprints/functions/create.d.ts.map +1 -0
- package/dist/types/src/blueprints/functions/definitions.d.ts +129 -0
- package/dist/types/src/blueprints/functions/definitions.d.ts.map +1 -0
- package/dist/types/src/blueprints/functions/delete.d.ts +16 -0
- package/dist/types/src/blueprints/functions/delete.d.ts.map +1 -0
- package/dist/types/src/blueprints/functions/deploy.d.ts +20 -0
- package/dist/types/src/blueprints/functions/deploy.d.ts.map +1 -0
- package/dist/types/src/blueprints/functions/index.d.ts +4 -0
- package/dist/types/src/blueprints/functions/index.d.ts.map +1 -0
- package/dist/types/src/blueprints/functions/inspect-invocations.d.ts +27 -0
- package/dist/types/src/blueprints/functions/inspect-invocations.d.ts.map +1 -0
- package/dist/types/src/blueprints/functions/install-function.d.ts +11 -0
- package/dist/types/src/blueprints/functions/install-function.d.ts.map +1 -0
- package/dist/types/src/blueprints/functions/invoke.d.ts +20 -0
- package/dist/types/src/blueprints/functions/invoke.d.ts.map +1 -0
- package/dist/types/src/blueprints/functions/query-deployed-functions.d.ts +13 -0
- package/dist/types/src/blueprints/functions/query-deployed-functions.d.ts.map +1 -0
- package/dist/types/src/blueprints/functions/read.d.ts +20 -0
- package/dist/types/src/blueprints/functions/read.d.ts.map +1 -0
- package/dist/types/src/blueprints/functions/update.d.ts +25 -0
- package/dist/types/src/blueprints/functions/update.d.ts.map +1 -0
- 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.d.ts +4 -2
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
- package/dist/types/src/capabilities/artifact-definition.d.ts +3 -2
- package/dist/types/src/capabilities/artifact-definition.d.ts.map +1 -1
- package/dist/types/src/capabilities/blueprint-definition.d.ts +5 -4
- package/dist/types/src/capabilities/blueprint-definition.d.ts.map +1 -1
- package/dist/types/src/capabilities/compiler.d.ts +3 -1
- package/dist/types/src/capabilities/compiler.d.ts.map +1 -1
- package/dist/types/src/capabilities/create-object.d.ts +16 -0
- package/dist/types/src/capabilities/create-object.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +19 -7
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/node.d.ts +18 -0
- package/dist/types/src/capabilities/node.d.ts.map +1 -0
- package/dist/types/src/capabilities/operation-handler.d.ts +6 -0
- package/dist/types/src/capabilities/operation-handler.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface.d.ts +3 -2
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
- package/dist/types/src/capabilities/settings.d.ts +5 -2
- package/dist/types/src/capabilities/settings.d.ts.map +1 -1
- 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/{FrameContainer/FrameContainer.d.ts → FramePanel/FramePanel.d.ts} +3 -3
- 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 +4 -4
- package/dist/types/src/components/NotebookStack/NotebookCell.d.ts.map +1 -1
- package/dist/types/src/components/NotebookStack/NotebookMenu.d.ts +1 -1
- package/dist/types/src/components/NotebookStack/NotebookMenu.d.ts.map +1 -1
- package/dist/types/src/components/NotebookStack/NotebookStack.d.ts +5 -3
- package/dist/types/src/components/NotebookStack/NotebookStack.d.ts.map +1 -1
- package/dist/types/src/components/NotebookStack/NotebookStack.stories.d.ts +221 -229
- 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/ScriptPluginSettings/ScriptPluginSettings.d.ts +8 -0
- package/dist/types/src/components/ScriptPluginSettings/ScriptPluginSettings.d.ts.map +1 -0
- package/dist/types/src/components/ScriptPluginSettings/ScriptPluginSettings.stories.d.ts +241 -0
- package/dist/types/src/components/ScriptPluginSettings/ScriptPluginSettings.stories.d.ts.map +1 -0
- package/dist/types/src/components/ScriptPluginSettings/index.d.ts +2 -0
- package/dist/types/src/components/ScriptPluginSettings/index.d.ts.map +1 -0
- package/dist/types/src/components/ScriptToolbar/ScriptToolbar.d.ts +8 -6
- package/dist/types/src/components/ScriptToolbar/ScriptToolbar.d.ts.map +1 -1
- package/dist/types/src/components/ScriptToolbar/ScriptToolbar.stories.d.ts +221 -229
- package/dist/types/src/components/ScriptToolbar/ScriptToolbar.stories.d.ts.map +1 -1
- package/dist/types/src/components/TestPanel/TestPanel.d.ts +4 -2
- 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 +6 -2
- package/dist/types/src/components/TypescriptEditor/TypescriptEditor.d.ts.map +1 -1
- package/dist/types/src/components/TypescriptEditor/TypescriptEditor.stories.d.ts +3 -1
- package/dist/types/src/components/TypescriptEditor/TypescriptEditor.stories.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +6 -5
- 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/{components → containers}/DeploymentDialog/DeploymentDialog.d.ts +0 -2
- package/dist/types/src/containers/DeploymentDialog/DeploymentDialog.d.ts.map +1 -0
- package/dist/types/src/containers/DeploymentDialog/DeploymentDialog.stories.d.ts +240 -0
- package/dist/types/src/containers/DeploymentDialog/DeploymentDialog.stories.d.ts.map +1 -0
- package/dist/types/src/containers/DeploymentDialog/index.d.ts +2 -0
- package/dist/types/src/containers/DeploymentDialog/index.d.ts.map +1 -0
- package/dist/types/src/containers/NotebookArticle/NotebookArticle.d.ts +7 -0
- package/dist/types/src/containers/NotebookArticle/NotebookArticle.d.ts.map +1 -0
- package/dist/types/src/containers/NotebookArticle/NotebookArticle.stories.d.ts +7 -0
- package/dist/types/src/containers/NotebookArticle/NotebookArticle.stories.d.ts.map +1 -0
- package/dist/types/src/containers/NotebookArticle/index.d.ts +2 -0
- package/dist/types/src/containers/NotebookArticle/index.d.ts.map +1 -0
- package/dist/types/src/containers/ScriptArticle/ScriptArticle.d.ts +10 -0
- package/dist/types/src/containers/ScriptArticle/ScriptArticle.d.ts.map +1 -0
- package/dist/types/src/containers/ScriptArticle/ScriptArticle.stories.d.ts +242 -0
- package/dist/types/src/containers/ScriptArticle/ScriptArticle.stories.d.ts.map +1 -0
- package/dist/types/src/containers/ScriptArticle/index.d.ts +2 -0
- package/dist/types/src/containers/ScriptArticle/index.d.ts.map +1 -0
- package/dist/types/src/containers/ScriptProperties/BlueprintEditor.d.ts +7 -0
- package/dist/types/src/containers/ScriptProperties/BlueprintEditor.d.ts.map +1 -0
- package/dist/types/src/containers/ScriptProperties/FunctionBinding.d.ts +7 -0
- package/dist/types/src/containers/ScriptProperties/FunctionBinding.d.ts.map +1 -0
- package/dist/types/src/containers/ScriptProperties/FunctionPublishing.d.ts +7 -0
- package/dist/types/src/containers/ScriptProperties/FunctionPublishing.d.ts.map +1 -0
- package/dist/types/src/containers/ScriptProperties/ScriptProperties.d.ts +6 -0
- package/dist/types/src/containers/ScriptProperties/ScriptProperties.d.ts.map +1 -0
- package/dist/types/src/containers/ScriptProperties/ScriptProperties.stories.d.ts +242 -0
- package/dist/types/src/containers/ScriptProperties/ScriptProperties.stories.d.ts.map +1 -0
- package/dist/types/src/containers/ScriptProperties/index.d.ts +2 -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 +2 -0
- package/dist/types/src/containers/TestContainer/index.d.ts.map +1 -0
- package/dist/types/src/containers/index.d.ts +7 -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 -26
- package/dist/types/src/hooks/deploy.d.ts.map +1 -1
- package/dist/types/src/hooks/format.d.ts +4 -3
- 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 +4 -3
- 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 +2 -3
- 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 +25 -12
- package/dist/types/src/notebook/compute-graph.d.ts.map +1 -1
- package/dist/types/src/notebook/eval.d.ts.map +1 -1
- package/dist/types/src/notebook/vfs-parser.d.ts.map +1 -1
- package/dist/types/src/operations/access-token-created.d.ts +5 -0
- package/dist/types/src/operations/access-token-created.d.ts.map +1 -0
- package/dist/types/src/operations/create-script.d.ts +5 -0
- package/dist/types/src/operations/create-script.d.ts.map +1 -0
- package/dist/types/src/operations/index.d.ts +3 -0
- package/dist/types/src/operations/index.d.ts.map +1 -0
- package/dist/types/src/plugin.d.ts +4 -0
- package/dist/types/src/plugin.d.ts.map +1 -0
- package/dist/types/src/templates/anthropic.d.ts +7 -0
- package/dist/types/src/templates/anthropic.d.ts.map +1 -0
- package/dist/types/src/templates/chat.d.ts.map +1 -1
- package/dist/types/src/templates/chess-bot.d.ts +12 -0
- package/dist/types/src/templates/chess-bot.d.ts.map +1 -0
- package/dist/types/src/templates/commentary.d.ts +13 -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/email.d.ts.map +1 -1
- package/dist/types/src/templates/forex-effect.d.ts +5 -1
- package/dist/types/src/templates/forex-effect.d.ts.map +1 -1
- package/dist/types/src/templates/forex.d.ts +5 -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 +33 -24
- package/dist/types/src/templates/index.d.ts.map +1 -1
- package/dist/types/src/templates/ping.d.ts +2 -4
- package/dist/types/src/templates/ping.d.ts.map +1 -1
- package/dist/types/src/testing/index.d.ts +2 -1
- package/dist/types/src/testing/index.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/testing/test-notebook.d.ts +3 -0
- package/dist/types/src/testing/test-notebook.d.ts.map +1 -0
- package/dist/types/src/testing/test-script.d.ts +7 -0
- package/dist/types/src/testing/test-script.d.ts.map +1 -0
- package/dist/types/src/translations.d.ts +222 -92
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/Notebook.d.ts +109 -22
- package/dist/types/src/types/Notebook.d.ts.map +1 -1
- package/dist/types/src/types/ScriptCapabilities.d.ts +6 -0
- package/dist/types/src/types/ScriptCapabilities.d.ts.map +1 -0
- package/dist/types/src/types/ScriptEvents.d.ts +3 -0
- package/dist/types/src/types/ScriptEvents.d.ts.map +1 -0
- package/dist/types/src/types/ScriptOperation.d.ts +29 -0
- package/dist/types/src/types/ScriptOperation.d.ts.map +1 -0
- package/dist/types/src/types/Settings.d.ts +7 -0
- package/dist/types/src/types/Settings.d.ts.map +1 -0
- package/dist/types/src/types/index.d.ts +4 -2
- package/dist/types/src/types/index.d.ts.map +1 -1
- package/dist/types/src/types/types.d.ts +1 -5
- package/dist/types/src/types/types.d.ts.map +1 -1
- package/dist/types/src/util/deploy.d.ts +2 -2
- package/dist/types/src/util/deploy.d.ts.map +1 -1
- package/dist/types/src/util/functions.d.ts +2 -2
- package/dist/types/src/util/functions.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +176 -101
- package/src/ScriptPlugin.node.ts +21 -0
- package/src/ScriptPlugin.test.ts +31 -0
- package/src/ScriptPlugin.tsx +23 -80
- package/src/blueprints/functions/create.ts +47 -0
- package/src/blueprints/functions/definitions.ts +323 -0
- package/src/blueprints/functions/delete.ts +23 -0
- package/src/blueprints/functions/deploy.ts +71 -0
- package/src/blueprints/functions/index.ts +19 -0
- package/src/blueprints/functions/inspect-invocations.ts +56 -0
- package/src/blueprints/functions/install-function.ts +56 -0
- package/src/blueprints/functions/invoke.ts +34 -0
- package/src/blueprints/functions/query-deployed-functions.ts +35 -0
- package/src/blueprints/functions/read.ts +29 -0
- package/src/blueprints/functions/update.ts +68 -0
- package/src/blueprints/index.ts +5 -0
- package/src/blueprints/script-blueprint.ts +55 -0
- package/src/capabilities/app-graph-builder.ts +40 -58
- package/src/capabilities/artifact-definition.ts +99 -97
- package/src/capabilities/blueprint-definition.ts +13 -24
- package/src/capabilities/compiler.ts +99 -22
- package/src/capabilities/create-object.ts +48 -0
- package/src/capabilities/index.ts +13 -9
- package/src/capabilities/node.ts +16 -0
- package/src/capabilities/operation-handler.ts +21 -0
- package/src/capabilities/react-surface.tsx +120 -93
- package/src/capabilities/settings.ts +26 -14
- package/src/compiler/compiler.ts +21 -3
- package/src/components/{FrameContainer/FrameContainer.tsx → FramePanel/FramePanel.tsx} +7 -6
- package/src/components/{FrameContainer → FramePanel}/index.ts +1 -1
- package/src/components/NotebookStack/NotebookCell.tsx +42 -32
- package/src/components/NotebookStack/NotebookMenu.tsx +7 -7
- package/src/components/NotebookStack/NotebookStack.stories.tsx +24 -25
- package/src/components/NotebookStack/NotebookStack.tsx +31 -20
- package/src/components/QueryEditor/QueryEditor.stories.tsx +96 -0
- package/src/components/QueryEditor/QueryEditor.tsx +49 -0
- package/src/components/QueryEditor/index.ts +5 -0
- package/src/components/ScriptPluginSettings/ScriptPluginSettings.stories.tsx +32 -0
- package/src/components/ScriptPluginSettings/ScriptPluginSettings.tsx +42 -0
- package/src/components/ScriptPluginSettings/index.ts +5 -0
- package/src/components/ScriptToolbar/ScriptToolbar.stories.tsx +42 -20
- package/src/components/ScriptToolbar/ScriptToolbar.tsx +38 -43
- package/src/components/TestPanel/TestPanel.tsx +110 -194
- package/src/components/TestPanel/index.ts +0 -1
- package/src/components/TypescriptEditor/TypescriptEditor.stories.tsx +24 -17
- package/src/components/TypescriptEditor/TypescriptEditor.tsx +74 -66
- package/src/components/index.ts +6 -7
- package/src/constants.ts +7 -0
- package/src/containers/DeploymentDialog/DeploymentDialog.stories.tsx +63 -0
- package/src/containers/DeploymentDialog/DeploymentDialog.tsx +99 -0
- package/src/containers/DeploymentDialog/index.ts +5 -0
- package/src/containers/NotebookArticle/NotebookArticle.stories.tsx +85 -0
- package/src/{components/NotebookContainer.tsx → containers/NotebookArticle/NotebookArticle.tsx} +90 -96
- package/src/containers/NotebookArticle/index.ts +5 -0
- package/src/containers/ScriptArticle/ScriptArticle.stories.tsx +107 -0
- package/src/containers/ScriptArticle/ScriptArticle.tsx +85 -0
- package/src/containers/ScriptArticle/index.ts +5 -0
- package/src/containers/ScriptProperties/BlueprintEditor.tsx +102 -0
- package/src/containers/ScriptProperties/FunctionBinding.tsx +83 -0
- package/src/containers/ScriptProperties/FunctionPublishing.tsx +121 -0
- package/src/containers/ScriptProperties/ScriptProperties.stories.tsx +76 -0
- package/src/containers/ScriptProperties/ScriptProperties.tsx +24 -0
- package/src/containers/ScriptProperties/index.ts +5 -0
- package/src/containers/TestContainer/TestContainer.tsx +44 -0
- package/src/containers/TestContainer/index.ts +5 -0
- package/src/containers/index.ts +11 -0
- package/src/e2e/ai.test.ts +93 -0
- package/src/e2e/deploy.test.ts +66 -0
- package/src/hooks/deploy.ts +42 -33
- package/src/hooks/format.ts +9 -4
- package/src/hooks/index.ts +1 -0
- package/src/hooks/template.ts +19 -12
- package/src/hooks/useCompiler.ts +25 -0
- package/src/hooks/useCreateAndDeployScriptTemplates.ts +15 -20
- package/src/hooks/useToolbarState.ts +29 -4
- package/src/index.ts +2 -4
- package/src/meta.ts +4 -4
- package/src/notebook/compute-graph.test.ts +21 -9
- package/src/notebook/compute-graph.ts +46 -22
- package/src/notebook/vfs-parser.ts +10 -3
- package/src/operations/access-token-created.ts +37 -0
- package/src/operations/create-script.ts +46 -0
- package/src/operations/index.ts +10 -0
- package/src/plugin.ts +11 -0
- package/src/templates/anthropic.ts +49 -0
- package/src/templates/chat.ts +1 -1
- package/src/templates/chess-bot.ts +63 -0
- package/src/templates/commentary.ts +248 -0
- package/src/templates/data-generator.ts +2 -2
- package/src/templates/discord.ts +3 -3
- package/src/templates/forex-effect.ts +35 -29
- package/src/templates/forex.ts +27 -17
- package/src/templates/gmail.ts +4 -4
- package/src/templates/index.ts +31 -18
- package/src/templates/ping.ts +22 -5
- package/src/testing/index.ts +2 -1
- package/src/testing/simulator.test.ts +39 -0
- package/src/testing/{data.ts → test-notebook.ts} +11 -12
- package/src/testing/test-script.ts +28 -0
- package/src/translations.ts +86 -87
- package/src/types/Notebook.ts +18 -15
- package/src/types/ScriptCapabilities.ts +18 -0
- package/src/types/ScriptEvents.ts +11 -0
- package/src/types/ScriptOperation.ts +42 -0
- package/src/types/Settings.ts +20 -0
- package/src/types/index.ts +5 -2
- package/src/types/types.ts +1 -11
- package/src/util/deploy.ts +25 -29
- package/src/util/functions.ts +30 -27
- 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 +0 -88
- 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 +0 -513
- 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/index.mjs +0 -268
- package/dist/lib/browser/index.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/meta.json +0 -1
- package/dist/lib/browser/react-surface-R245YN52.mjs +0 -128
- 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/browser/types/index.mjs +0 -14
- package/dist/lib/node-esm/DeploymentDialog-2ULNOZQH.mjs +0 -15
- package/dist/lib/node-esm/NotebookContainer-U4C2HQ4T.mjs +0 -818
- 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 +0 -90
- 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-HSLMI22Q.mjs +0 -11
- package/dist/lib/node-esm/chunk-HSLMI22Q.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-IBV2DR36.mjs +0 -33
- 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 +0 -514
- 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/index.mjs +0 -269
- package/dist/lib/node-esm/index.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/meta.json +0 -1
- package/dist/lib/node-esm/react-surface-MHT3PJ6C.mjs +0 -129
- 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/lib/node-esm/templates/index.mjs +0 -11
- package/dist/lib/node-esm/types/index.mjs +0 -15
- 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/intent-resolver.d.ts +0 -4
- package/dist/types/src/capabilities/intent-resolver.d.ts.map +0 -1
- package/dist/types/src/components/DeploymentDialog/DeploymentDialog.d.ts.map +0 -1
- package/dist/types/src/components/DeploymentDialog/DeploymentDialog.stories.d.ts +0 -251
- 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.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/NotebookContainer.d.ts +0 -10
- package/dist/types/src/components/NotebookContainer.d.ts.map +0 -1
- package/dist/types/src/components/NotebookContainer.stories.d.ts +0 -254
- package/dist/types/src/components/NotebookContainer.stories.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/testing/data.d.ts +0 -3
- package/dist/types/src/testing/data.d.ts.map +0 -1
- package/dist/types/src/types/actions.d.ts +0 -54
- package/dist/types/src/types/actions.d.ts.map +0 -1
- package/src/capabilities/capabilities.ts +0 -12
- package/src/capabilities/intent-resolver.ts +0 -86
- package/src/components/DeploymentDialog/DeploymentDialog.stories.tsx +0 -58
- package/src/components/DeploymentDialog/DeploymentDialog.tsx +0 -123
- 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/NotebookContainer.stories.tsx +0 -83
- package/src/components/ScriptContainer.tsx +0 -70
- package/src/components/Settings/ScriptObjectSettings.tsx +0 -298
- package/src/components/Settings/ScriptPluginSettings.tsx +0 -61
- package/src/components/Settings/index.ts +0 -6
- package/src/components/TestPanel/TestContainer.tsx +0 -27
- package/src/events.ts +0 -11
- package/src/templates/chess.ts +0 -49
- package/src/types/actions.ts +0 -53
- /package/dist/lib/{browser/templates → neutral/blueprints}/index.mjs.map +0 -0
- /package/dist/lib/{browser → neutral}/chunk-J5LGTIGS.mjs +0 -0
- /package/dist/lib/{browser → neutral}/chunk-J5LGTIGS.mjs.map +0 -0
- /package/dist/lib/{browser/types → neutral}/index.mjs.map +0 -0
- /package/dist/lib/{browser/DeploymentDialog-5TKNGPVR.mjs.map → neutral/meta.mjs.map} +0 -0
- /package/dist/lib/{node-esm/templates → neutral/operations}/index.mjs.map +0 -0
- /package/dist/lib/{node-esm/types → neutral/templates}/index.mjs.map +0 -0
- /package/dist/lib/{node-esm/DeploymentDialog-2ULNOZQH.mjs.map → neutral/types/index.mjs.map} +0 -0
|
@@ -1,818 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
|
-
import {
|
|
3
|
-
NotebookMenu,
|
|
4
|
-
NotebookStack
|
|
5
|
-
} from "./chunk-VTRMJSQL.mjs";
|
|
6
|
-
import "./chunk-HDKR5WCD.mjs";
|
|
7
|
-
import {
|
|
8
|
-
meta
|
|
9
|
-
} from "./chunk-IBV2DR36.mjs";
|
|
10
|
-
import "./chunk-HSLMI22Q.mjs";
|
|
11
|
-
|
|
12
|
-
// src/components/NotebookContainer.tsx
|
|
13
|
-
import { useSignals as _useSignals } from "@preact-signals/safe-react/tracking";
|
|
14
|
-
import * as Cause from "effect/Cause";
|
|
15
|
-
import * as Effect from "effect/Effect";
|
|
16
|
-
import * as Exit from "effect/Exit";
|
|
17
|
-
import React, { useCallback, useMemo, useState } from "react";
|
|
18
|
-
import { Agent } from "@dxos/assistant-toolkit";
|
|
19
|
-
import { Blueprint, Prompt } from "@dxos/blueprints";
|
|
20
|
-
import { Filter, Obj, Query, Ref } from "@dxos/echo";
|
|
21
|
-
import { QueryBuilder } from "@dxos/echo-query";
|
|
22
|
-
import { FunctionInvocationService } from "@dxos/functions";
|
|
23
|
-
import { InvocationTracer } from "@dxos/functions-runtime";
|
|
24
|
-
import { TracingServiceExt } from "@dxos/functions-runtime";
|
|
25
|
-
import { invariant as invariant2 } from "@dxos/invariant";
|
|
26
|
-
import { log as log2 } from "@dxos/log";
|
|
27
|
-
import { useComputeRuntimeCallback } from "@dxos/plugin-automation";
|
|
28
|
-
import { Graph } from "@dxos/plugin-explorer/types";
|
|
29
|
-
import { getSpace } from "@dxos/react-client/echo";
|
|
30
|
-
import { DropdownMenu, IconButton, Toolbar, useTranslation } from "@dxos/react-ui";
|
|
31
|
-
import { useAttention } from "@dxos/react-ui-attention";
|
|
32
|
-
import { StackItem } from "@dxos/react-ui-stack";
|
|
33
|
-
import { Text, View } from "@dxos/schema";
|
|
34
|
-
import { isNonNullable } from "@dxos/util";
|
|
35
|
-
|
|
36
|
-
// src/notebook/compute-graph.ts
|
|
37
|
-
import { signal } from "@preact/signals-core";
|
|
38
|
-
import { log } from "@dxos/log";
|
|
39
|
-
|
|
40
|
-
// src/notebook/eval.ts
|
|
41
|
-
import { trim } from "@dxos/util";
|
|
42
|
-
var evalScript = async (code, deps = {}) => {
|
|
43
|
-
const sandbox = {
|
|
44
|
-
...deps,
|
|
45
|
-
// Block access to global objects.
|
|
46
|
-
console: void 0,
|
|
47
|
-
document: void 0,
|
|
48
|
-
global: void 0,
|
|
49
|
-
globalThis: void 0,
|
|
50
|
-
self: void 0,
|
|
51
|
-
window: void 0,
|
|
52
|
-
// Allow some safe globals.
|
|
53
|
-
Array,
|
|
54
|
-
Boolean,
|
|
55
|
-
Date,
|
|
56
|
-
Error,
|
|
57
|
-
JSON,
|
|
58
|
-
Map,
|
|
59
|
-
Math,
|
|
60
|
-
Number,
|
|
61
|
-
Object,
|
|
62
|
-
Promise,
|
|
63
|
-
RegExp,
|
|
64
|
-
Set,
|
|
65
|
-
String,
|
|
66
|
-
// Functions.
|
|
67
|
-
isFinite,
|
|
68
|
-
isNaN,
|
|
69
|
-
parseFloat,
|
|
70
|
-
parseInt
|
|
71
|
-
};
|
|
72
|
-
const sandboxKeys = Object.keys(sandbox);
|
|
73
|
-
const sandboxValues = Object.values(sandbox);
|
|
74
|
-
const fn2 = new Function(...sandboxKeys, trim`
|
|
75
|
-
'use strict';
|
|
76
|
-
return ${code};
|
|
77
|
-
`);
|
|
78
|
-
return fn2(...sandboxValues);
|
|
79
|
-
};
|
|
80
|
-
var builtIns = /* @__PURE__ */ new Set([
|
|
81
|
-
// Types.
|
|
82
|
-
"Array",
|
|
83
|
-
"Date",
|
|
84
|
-
"Error",
|
|
85
|
-
"JSON",
|
|
86
|
-
"Map",
|
|
87
|
-
"Math",
|
|
88
|
-
"Number",
|
|
89
|
-
"Object",
|
|
90
|
-
"Promise",
|
|
91
|
-
"RegExp",
|
|
92
|
-
"Set",
|
|
93
|
-
"String",
|
|
94
|
-
// Functions.
|
|
95
|
-
"isFinite",
|
|
96
|
-
"isNaN",
|
|
97
|
-
"parseFloat",
|
|
98
|
-
"parseInt"
|
|
99
|
-
]);
|
|
100
|
-
var systemDefinitions = trim`
|
|
101
|
-
interface Array<T> { length: number; [n: number]: T; }
|
|
102
|
-
interface Boolean {}
|
|
103
|
-
interface Function {}
|
|
104
|
-
interface IArguments {}
|
|
105
|
-
interface Number {}
|
|
106
|
-
interface Object {}
|
|
107
|
-
interface RegExp {}
|
|
108
|
-
interface String { length: number; }
|
|
109
|
-
|
|
110
|
-
interface CallableFunction extends Function {}
|
|
111
|
-
interface NewableFunction extends Function {}
|
|
112
|
-
|
|
113
|
-
declare var console: { log(...args: any[]): void };
|
|
114
|
-
`;
|
|
115
|
-
|
|
116
|
-
// src/notebook/vfs-parser.ts
|
|
117
|
-
import { createSystem, createVirtualTypeScriptEnvironment } from "@typescript/vfs";
|
|
118
|
-
import ts from "typescript";
|
|
119
|
-
import { invariant } from "@dxos/invariant";
|
|
120
|
-
var __dxlog_file = "/__w/dxos/dxos/packages/plugins/plugin-script/src/notebook/vfs-parser.ts";
|
|
121
|
-
var systemFiles = [
|
|
122
|
-
{
|
|
123
|
-
filename: "/lib.d.ts",
|
|
124
|
-
content: systemDefinitions
|
|
125
|
-
}
|
|
126
|
-
];
|
|
127
|
-
var VirtualTypeScriptParser = class {
|
|
128
|
-
compilerOptions = {
|
|
129
|
-
target: ts.ScriptTarget.ES2020,
|
|
130
|
-
module: ts.ModuleKind.ESNext,
|
|
131
|
-
strict: true,
|
|
132
|
-
esModuleInterop: true,
|
|
133
|
-
skipLibCheck: true,
|
|
134
|
-
forceConsistentCasingInfilenames: true,
|
|
135
|
-
jsx: ts.JsxEmit.React,
|
|
136
|
-
noLib: true
|
|
137
|
-
};
|
|
138
|
-
/**
|
|
139
|
-
* Parse a single expression or statement.
|
|
140
|
-
*/
|
|
141
|
-
parseExpression(input) {
|
|
142
|
-
invariant(input.trim() !== "", "input must not be empty", {
|
|
143
|
-
F: __dxlog_file,
|
|
144
|
-
L: 57,
|
|
145
|
-
S: this,
|
|
146
|
-
A: [
|
|
147
|
-
"input.trim() !== ''",
|
|
148
|
-
"'input must not be empty'"
|
|
149
|
-
]
|
|
150
|
-
});
|
|
151
|
-
const files = [
|
|
152
|
-
{
|
|
153
|
-
filename: "/temp.ts",
|
|
154
|
-
content: input
|
|
155
|
-
}
|
|
156
|
-
];
|
|
157
|
-
const analysis = this.analyzeFiles(files);
|
|
158
|
-
if (analysis.length === 0) {
|
|
159
|
-
const sourcefilename = "/temp.ts";
|
|
160
|
-
const env = this.createEnvironment([
|
|
161
|
-
{
|
|
162
|
-
filename: sourcefilename,
|
|
163
|
-
content: input
|
|
164
|
-
}
|
|
165
|
-
]);
|
|
166
|
-
const sourceFile = env.getSourceFile(sourcefilename);
|
|
167
|
-
const typeChecker = env.languageService.getProgram()?.getTypeChecker();
|
|
168
|
-
if (sourceFile && typeChecker) {
|
|
169
|
-
const assignmentInfo = this.findAssignmentExpression(sourceFile, typeChecker);
|
|
170
|
-
if (assignmentInfo) {
|
|
171
|
-
return assignmentInfo;
|
|
172
|
-
}
|
|
173
|
-
const references = this.findAllReferences(sourceFile, typeChecker);
|
|
174
|
-
return {
|
|
175
|
-
references
|
|
176
|
-
};
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
return analysis[0];
|
|
180
|
-
}
|
|
181
|
-
/**
|
|
182
|
-
* Analyze multiple files with full type information.
|
|
183
|
-
*/
|
|
184
|
-
analyzeFiles(files) {
|
|
185
|
-
const env = this.createEnvironment(files);
|
|
186
|
-
const results = [];
|
|
187
|
-
const typeChecker = env.languageService.getProgram()?.getTypeChecker();
|
|
188
|
-
files.forEach((file) => {
|
|
189
|
-
const sourceFile = env.getSourceFile(file.filename);
|
|
190
|
-
if (!sourceFile || !typeChecker) return;
|
|
191
|
-
const fileResults = this.analyzeSourceFile(sourceFile, typeChecker);
|
|
192
|
-
results.push(...fileResults);
|
|
193
|
-
});
|
|
194
|
-
return results;
|
|
195
|
-
}
|
|
196
|
-
/**
|
|
197
|
-
* Analyze a source file with type information.
|
|
198
|
-
*/
|
|
199
|
-
analyzeSourceFile(sourceFile, typeChecker) {
|
|
200
|
-
const results = [];
|
|
201
|
-
const visit = (node) => {
|
|
202
|
-
if (ts.isFunctionDeclaration(node) && node.name) {
|
|
203
|
-
const symbol = typeChecker.getSymbolAtLocation(node.name);
|
|
204
|
-
const type = symbol && typeChecker.getTypeOfSymbolAtLocation(symbol, node);
|
|
205
|
-
const signature = type && typeChecker.getSignaturesOfType(type, ts.SignatureKind.Call)[0];
|
|
206
|
-
results.push({
|
|
207
|
-
name: node.name.text,
|
|
208
|
-
type: "function",
|
|
209
|
-
parameters: this.extractParameters(signature, typeChecker),
|
|
210
|
-
returnType: signature ? typeChecker.typeToString(signature.getReturnType()) : "any",
|
|
211
|
-
references: this.findReferences(node, sourceFile, typeChecker)
|
|
212
|
-
});
|
|
213
|
-
} else if (ts.isVariableStatement(node)) {
|
|
214
|
-
node.declarationList.declarations.forEach((declaration) => {
|
|
215
|
-
if (ts.isIdentifier(declaration.name)) {
|
|
216
|
-
const symbol = typeChecker.getSymbolAtLocation(declaration.name);
|
|
217
|
-
const type = symbol && typeChecker.getTypeOfSymbolAtLocation(symbol, declaration);
|
|
218
|
-
let kind = "variable";
|
|
219
|
-
let parameters;
|
|
220
|
-
let returnType;
|
|
221
|
-
let value;
|
|
222
|
-
const typeString = type ? typeChecker.typeToString(type) : "any";
|
|
223
|
-
if (declaration.initializer) {
|
|
224
|
-
if (ts.isArrowFunction(declaration.initializer) || ts.isFunctionExpression(declaration.initializer)) {
|
|
225
|
-
kind = "function";
|
|
226
|
-
const funcType = typeChecker.getTypeAtLocation(declaration.initializer);
|
|
227
|
-
const signature = typeChecker.getSignaturesOfType(funcType, ts.SignatureKind.Call)[0];
|
|
228
|
-
if (signature) {
|
|
229
|
-
parameters = this.extractParameters(signature, typeChecker);
|
|
230
|
-
returnType = typeChecker.typeToString(signature.getReturnType());
|
|
231
|
-
}
|
|
232
|
-
} else {
|
|
233
|
-
if (ts.isNumericLiteral(declaration.initializer)) {
|
|
234
|
-
value = Number(declaration.initializer.text);
|
|
235
|
-
} else if (ts.isStringLiteral(declaration.initializer)) {
|
|
236
|
-
value = declaration.initializer.text;
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
const refs = declaration.initializer ? this.findReferences(declaration.initializer, sourceFile, typeChecker) : [];
|
|
241
|
-
results.push({
|
|
242
|
-
name: declaration.name.text,
|
|
243
|
-
type: kind,
|
|
244
|
-
valueType: typeString,
|
|
245
|
-
value,
|
|
246
|
-
parameters,
|
|
247
|
-
returnType,
|
|
248
|
-
references: refs
|
|
249
|
-
});
|
|
250
|
-
}
|
|
251
|
-
});
|
|
252
|
-
} else if (ts.isClassDeclaration(node) && node.name) {
|
|
253
|
-
results.push({
|
|
254
|
-
name: node.name.text,
|
|
255
|
-
type: "class",
|
|
256
|
-
references: this.findReferences(node, sourceFile, typeChecker)
|
|
257
|
-
});
|
|
258
|
-
} else if (ts.isInterfaceDeclaration(node)) {
|
|
259
|
-
results.push({
|
|
260
|
-
name: node.name.text,
|
|
261
|
-
type: "interface",
|
|
262
|
-
references: this.findReferences(node, sourceFile, typeChecker)
|
|
263
|
-
});
|
|
264
|
-
}
|
|
265
|
-
ts.forEachChild(node, visit);
|
|
266
|
-
};
|
|
267
|
-
visit(sourceFile);
|
|
268
|
-
return results;
|
|
269
|
-
}
|
|
270
|
-
/**
|
|
271
|
-
* Extract parameter information from a signature.
|
|
272
|
-
*/
|
|
273
|
-
extractParameters(signature, typeChecker) {
|
|
274
|
-
if (!signature) return [];
|
|
275
|
-
return signature.parameters.map((param) => ({
|
|
276
|
-
name: param.getName(),
|
|
277
|
-
type: typeChecker.typeToString(typeChecker.getTypeOfSymbolAtLocation(param, param.valueDeclaration))
|
|
278
|
-
}));
|
|
279
|
-
}
|
|
280
|
-
/**
|
|
281
|
-
* Find all references to variables used in a node.
|
|
282
|
-
*/
|
|
283
|
-
findReferences(node, _sourceFile, _typeChecker) {
|
|
284
|
-
const references = /* @__PURE__ */ new Set();
|
|
285
|
-
const localSymbols = /* @__PURE__ */ new Set();
|
|
286
|
-
const collectLocalSymbols = (node2) => {
|
|
287
|
-
if (ts.isFunctionDeclaration(node2) || ts.isArrowFunction(node2) || ts.isFunctionExpression(node2)) {
|
|
288
|
-
node2.parameters.forEach((param) => {
|
|
289
|
-
if (ts.isIdentifier(param.name)) {
|
|
290
|
-
localSymbols.add(param.name.text);
|
|
291
|
-
}
|
|
292
|
-
});
|
|
293
|
-
}
|
|
294
|
-
if (ts.isVariableDeclaration(node2) && ts.isIdentifier(node2.name)) {
|
|
295
|
-
localSymbols.add(node2.name.text);
|
|
296
|
-
}
|
|
297
|
-
ts.forEachChild(node2, collectLocalSymbols);
|
|
298
|
-
};
|
|
299
|
-
collectLocalSymbols(node);
|
|
300
|
-
const findRefs = (node2) => {
|
|
301
|
-
if (ts.isIdentifier(node2)) {
|
|
302
|
-
if (!localSymbols.has(node2.text)) {
|
|
303
|
-
const parent = node2.parent;
|
|
304
|
-
const isDeclaration = ts.isVariableDeclaration(parent) && parent.name === node2 || ts.isFunctionDeclaration(parent) && parent.name === node2 || ts.isParameter(parent) && parent.name === node2;
|
|
305
|
-
if (!isDeclaration && !this.isBuiltIn(node2.text)) {
|
|
306
|
-
references.add(node2.text);
|
|
307
|
-
}
|
|
308
|
-
}
|
|
309
|
-
}
|
|
310
|
-
ts.forEachChild(node2, findRefs);
|
|
311
|
-
};
|
|
312
|
-
findRefs(node);
|
|
313
|
-
return Array.from(references);
|
|
314
|
-
}
|
|
315
|
-
/**
|
|
316
|
-
* Check if a name is a built-in global.
|
|
317
|
-
*/
|
|
318
|
-
isBuiltIn(name) {
|
|
319
|
-
return builtIns.has(name);
|
|
320
|
-
}
|
|
321
|
-
/**
|
|
322
|
-
* Find assignment expressions in a source file.
|
|
323
|
-
*/
|
|
324
|
-
findAssignmentExpression(sourceFile, typeChecker) {
|
|
325
|
-
let result = null;
|
|
326
|
-
const visit = (node) => {
|
|
327
|
-
if (ts.isExpressionStatement(node) && ts.isBinaryExpression(node.expression)) {
|
|
328
|
-
const expr = node.expression;
|
|
329
|
-
if (expr.operatorToken.kind === ts.SyntaxKind.EqualsToken && ts.isIdentifier(expr.left)) {
|
|
330
|
-
const type = typeChecker.getTypeAtLocation(expr.right);
|
|
331
|
-
const typeString = typeChecker.typeToString(type);
|
|
332
|
-
let value;
|
|
333
|
-
if (ts.isNumericLiteral(expr.right)) {
|
|
334
|
-
value = Number(expr.right.text);
|
|
335
|
-
} else if (ts.isStringLiteral(expr.right)) {
|
|
336
|
-
value = expr.right.text;
|
|
337
|
-
}
|
|
338
|
-
const references = this.findReferences(expr.right, sourceFile, typeChecker);
|
|
339
|
-
result = {
|
|
340
|
-
name: expr.left.text,
|
|
341
|
-
type: "variable",
|
|
342
|
-
valueType: typeString,
|
|
343
|
-
value,
|
|
344
|
-
references
|
|
345
|
-
};
|
|
346
|
-
}
|
|
347
|
-
}
|
|
348
|
-
if (!result) {
|
|
349
|
-
ts.forEachChild(node, visit);
|
|
350
|
-
}
|
|
351
|
-
};
|
|
352
|
-
visit(sourceFile);
|
|
353
|
-
return result;
|
|
354
|
-
}
|
|
355
|
-
/**
|
|
356
|
-
* Find all identifier references in a source file.
|
|
357
|
-
*/
|
|
358
|
-
findAllReferences(sourceFile, _typeChecker) {
|
|
359
|
-
const references = /* @__PURE__ */ new Set();
|
|
360
|
-
const visit = (node) => {
|
|
361
|
-
if (ts.isIdentifier(node)) {
|
|
362
|
-
const parent = node.parent;
|
|
363
|
-
const isDeclaration = ts.isVariableDeclaration(parent) && parent.name === node || ts.isFunctionDeclaration(parent) && parent.name === node || ts.isParameter(parent) && parent.name === node;
|
|
364
|
-
const isAssignmentTarget = ts.isBinaryExpression(parent) && parent.operatorToken.kind === ts.SyntaxKind.EqualsToken && parent.left === node;
|
|
365
|
-
if (!isDeclaration && !isAssignmentTarget && !this.isBuiltIn(node.text)) {
|
|
366
|
-
references.add(node.text);
|
|
367
|
-
}
|
|
368
|
-
}
|
|
369
|
-
ts.forEachChild(node, visit);
|
|
370
|
-
};
|
|
371
|
-
visit(sourceFile);
|
|
372
|
-
return Array.from(references);
|
|
373
|
-
}
|
|
374
|
-
createEnvironment(files) {
|
|
375
|
-
const allFiles = [
|
|
376
|
-
...systemFiles,
|
|
377
|
-
...files
|
|
378
|
-
];
|
|
379
|
-
const fileMap = /* @__PURE__ */ new Map();
|
|
380
|
-
allFiles.forEach(({ filename, content }) => {
|
|
381
|
-
fileMap.set(filename, content);
|
|
382
|
-
});
|
|
383
|
-
const system = createSystem(fileMap);
|
|
384
|
-
return createVirtualTypeScriptEnvironment(system, allFiles.map(({ filename }) => filename), ts, this.compilerOptions);
|
|
385
|
-
}
|
|
386
|
-
};
|
|
387
|
-
|
|
388
|
-
// src/notebook/compute-graph.ts
|
|
389
|
-
var __dxlog_file2 = "/__w/dxos/dxos/packages/plugins/plugin-script/src/notebook/compute-graph.ts";
|
|
390
|
-
var ComputeGraph = class {
|
|
391
|
-
_notebook;
|
|
392
|
-
_parser = new VirtualTypeScriptParser();
|
|
393
|
-
_expressions = signal({});
|
|
394
|
-
_valuesByCellId = signal({});
|
|
395
|
-
_valuesByName = signal({});
|
|
396
|
-
constructor(_notebook) {
|
|
397
|
-
this._notebook = _notebook;
|
|
398
|
-
}
|
|
399
|
-
/**
|
|
400
|
-
* Parsed expressions by cell ID.
|
|
401
|
-
*/
|
|
402
|
-
get expressions() {
|
|
403
|
-
return this._expressions;
|
|
404
|
-
}
|
|
405
|
-
/**
|
|
406
|
-
* Computed values by cell ID.
|
|
407
|
-
*/
|
|
408
|
-
get values() {
|
|
409
|
-
return this._valuesByCellId;
|
|
410
|
-
}
|
|
411
|
-
/**
|
|
412
|
-
* Computed values by name.
|
|
413
|
-
*/
|
|
414
|
-
get valuesByName() {
|
|
415
|
-
return this._valuesByName;
|
|
416
|
-
}
|
|
417
|
-
/**
|
|
418
|
-
* Get computed value by cell ID.
|
|
419
|
-
*/
|
|
420
|
-
getValue(cellId) {
|
|
421
|
-
return this._valuesByCellId.value[cellId];
|
|
422
|
-
}
|
|
423
|
-
/**
|
|
424
|
-
* Compute values.
|
|
425
|
-
*/
|
|
426
|
-
async evaluate() {
|
|
427
|
-
const { expressions, dependencyGraph } = this.parse();
|
|
428
|
-
this._valuesByCellId.value = {};
|
|
429
|
-
this._valuesByName.value = {};
|
|
430
|
-
const cellExpressions = /* @__PURE__ */ new Map();
|
|
431
|
-
Object.entries(expressions).forEach(([id, expr]) => {
|
|
432
|
-
cellExpressions.set(id, expr);
|
|
433
|
-
});
|
|
434
|
-
const evaluationOrder = this.topologicalSort(Object.keys(expressions), dependencyGraph);
|
|
435
|
-
const valuesByName = {};
|
|
436
|
-
const valuesByCellId = {};
|
|
437
|
-
for (const cellId of evaluationOrder) {
|
|
438
|
-
const expr = cellExpressions.get(cellId);
|
|
439
|
-
if (!expr) {
|
|
440
|
-
log.error("no expression for cell", {
|
|
441
|
-
cellId
|
|
442
|
-
}, {
|
|
443
|
-
F: __dxlog_file2,
|
|
444
|
-
L: 81,
|
|
445
|
-
S: this,
|
|
446
|
-
C: (f, a) => f(...a)
|
|
447
|
-
});
|
|
448
|
-
continue;
|
|
449
|
-
}
|
|
450
|
-
const cellSource = this._notebook.cells.find((cell) => cell.id === cellId)?.source?.target?.content;
|
|
451
|
-
if (!cellSource) {
|
|
452
|
-
log.error("no source for cell", {
|
|
453
|
-
cellId
|
|
454
|
-
}, {
|
|
455
|
-
F: __dxlog_file2,
|
|
456
|
-
L: 87,
|
|
457
|
-
S: this,
|
|
458
|
-
C: (f, a) => f(...a)
|
|
459
|
-
});
|
|
460
|
-
continue;
|
|
461
|
-
}
|
|
462
|
-
try {
|
|
463
|
-
if (expr.name && expr.value !== void 0) {
|
|
464
|
-
valuesByName[expr.name] = expr.value;
|
|
465
|
-
valuesByCellId[cellId] = expr.value;
|
|
466
|
-
} else if (expr.name) {
|
|
467
|
-
const equalIndex = cellSource.indexOf("=");
|
|
468
|
-
if (equalIndex !== -1) {
|
|
469
|
-
let rhs = cellSource.substring(equalIndex + 1).trim();
|
|
470
|
-
if (rhs.endsWith(";")) {
|
|
471
|
-
rhs = rhs.slice(0, -1).trim();
|
|
472
|
-
}
|
|
473
|
-
const result = await this.eval(rhs, valuesByName);
|
|
474
|
-
valuesByName[expr.name] = result;
|
|
475
|
-
if (typeof result !== "function") {
|
|
476
|
-
valuesByCellId[cellId] = result;
|
|
477
|
-
}
|
|
478
|
-
}
|
|
479
|
-
} else {
|
|
480
|
-
const result = await this.eval(cellSource, valuesByName);
|
|
481
|
-
valuesByCellId[cellId] = result;
|
|
482
|
-
}
|
|
483
|
-
} catch (error) {
|
|
484
|
-
log.error("error evaluating cell", {
|
|
485
|
-
cellId,
|
|
486
|
-
error
|
|
487
|
-
}, {
|
|
488
|
-
F: __dxlog_file2,
|
|
489
|
-
L: 123,
|
|
490
|
-
S: this,
|
|
491
|
-
C: (f, a) => f(...a)
|
|
492
|
-
});
|
|
493
|
-
}
|
|
494
|
-
}
|
|
495
|
-
this._valuesByCellId.value = valuesByCellId;
|
|
496
|
-
this._valuesByName.value = valuesByName;
|
|
497
|
-
return valuesByCellId;
|
|
498
|
-
}
|
|
499
|
-
async eval(source, values) {
|
|
500
|
-
return evalScript(source, values);
|
|
501
|
-
}
|
|
502
|
-
/**
|
|
503
|
-
* Parse expressions.
|
|
504
|
-
*/
|
|
505
|
-
parse() {
|
|
506
|
-
const expressions = this._notebook.cells.filter((cell) => cell.type === "script").reduce((acc, cell) => {
|
|
507
|
-
const text = cell.source?.target?.content.trim();
|
|
508
|
-
if (text) {
|
|
509
|
-
const parsed = this._parser.parseExpression(text);
|
|
510
|
-
acc[cell.id] = parsed;
|
|
511
|
-
}
|
|
512
|
-
return acc;
|
|
513
|
-
}, {});
|
|
514
|
-
const dependencyGraph = this.buildDependencyGraph(expressions);
|
|
515
|
-
this._expressions.value = expressions;
|
|
516
|
-
return {
|
|
517
|
-
expressions,
|
|
518
|
-
dependencyGraph
|
|
519
|
-
};
|
|
520
|
-
}
|
|
521
|
-
topologicalSort(nodes, dependencies) {
|
|
522
|
-
const visited = /* @__PURE__ */ new Set();
|
|
523
|
-
const result = [];
|
|
524
|
-
const visit = (node) => {
|
|
525
|
-
if (visited.has(node)) {
|
|
526
|
-
return;
|
|
527
|
-
}
|
|
528
|
-
visited.add(node);
|
|
529
|
-
const deps = dependencies[node] || [];
|
|
530
|
-
deps.forEach((dep) => visit(dep));
|
|
531
|
-
result.push(node);
|
|
532
|
-
};
|
|
533
|
-
nodes.forEach((node) => visit(node));
|
|
534
|
-
return result;
|
|
535
|
-
}
|
|
536
|
-
buildDependencyGraph(expressions) {
|
|
537
|
-
const nameToCellId = /* @__PURE__ */ new Map();
|
|
538
|
-
Object.entries(expressions).forEach(([id, expr]) => {
|
|
539
|
-
if (expr.name) {
|
|
540
|
-
nameToCellId.set(expr.name, id);
|
|
541
|
-
}
|
|
542
|
-
});
|
|
543
|
-
const graph = {};
|
|
544
|
-
Object.entries(expressions).forEach(([id, expr]) => {
|
|
545
|
-
if (expr.references && expr.references.length > 0) {
|
|
546
|
-
const dependencyCellIds = expr.references.map((ref) => nameToCellId.get(ref)).filter((cellId) => cellId !== void 0 && cellId !== id);
|
|
547
|
-
if (dependencyCellIds.length > 0) {
|
|
548
|
-
graph[id] = dependencyCellIds;
|
|
549
|
-
}
|
|
550
|
-
}
|
|
551
|
-
});
|
|
552
|
-
return graph;
|
|
553
|
-
}
|
|
554
|
-
};
|
|
555
|
-
|
|
556
|
-
// src/components/NotebookContainer.tsx
|
|
557
|
-
var __dxlog_file3 = "/__w/dxos/dxos/packages/plugins/plugin-script/src/components/NotebookContainer.tsx";
|
|
558
|
-
var INCLUDE_BLUEPRINTS = [
|
|
559
|
-
"dxos.org/blueprint/assistant",
|
|
560
|
-
"dxos.org/blueprint/markdown"
|
|
561
|
-
];
|
|
562
|
-
var NotebookContainer = ({ notebook, env }) => {
|
|
563
|
-
var _effect = _useSignals();
|
|
564
|
-
try {
|
|
565
|
-
const { t } = useTranslation(meta.id);
|
|
566
|
-
const space = getSpace(notebook);
|
|
567
|
-
const attendableId = notebook ? Obj.getDXN(notebook).toString() : "";
|
|
568
|
-
const { hasAttention } = useAttention(attendableId);
|
|
569
|
-
const graph = useMemo(() => notebook && new ComputeGraph(notebook), [
|
|
570
|
-
notebook
|
|
571
|
-
]);
|
|
572
|
-
const [queryValues, setQueryValues] = useState({});
|
|
573
|
-
const handleExecQueries = useCallback(async () => {
|
|
574
|
-
invariant2(space, void 0, {
|
|
575
|
-
F: __dxlog_file3,
|
|
576
|
-
L: 56,
|
|
577
|
-
S: void 0,
|
|
578
|
-
A: [
|
|
579
|
-
"space",
|
|
580
|
-
""
|
|
581
|
-
]
|
|
582
|
-
});
|
|
583
|
-
const builder = new QueryBuilder();
|
|
584
|
-
for (const cell of notebook?.cells ?? []) {
|
|
585
|
-
if (cell.type === "query") {
|
|
586
|
-
if (cell.source?.target) {
|
|
587
|
-
const source = cell.source.target.content;
|
|
588
|
-
const { name, filter } = builder.build(source);
|
|
589
|
-
if (filter) {
|
|
590
|
-
const ast = Query.select(filter).ast;
|
|
591
|
-
const graph2 = cell.graph?.target;
|
|
592
|
-
if (!graph2) {
|
|
593
|
-
const { view } = await View.makeFromSpace({
|
|
594
|
-
space
|
|
595
|
-
});
|
|
596
|
-
const graph3 = Graph.make({
|
|
597
|
-
query: {
|
|
598
|
-
ast
|
|
599
|
-
},
|
|
600
|
-
view
|
|
601
|
-
});
|
|
602
|
-
cell.graph = Ref.make(graph3);
|
|
603
|
-
cell.name = name;
|
|
604
|
-
} else {
|
|
605
|
-
graph2.query.ast = ast;
|
|
606
|
-
}
|
|
607
|
-
}
|
|
608
|
-
}
|
|
609
|
-
if (cell.name && cell.graph?.target) {
|
|
610
|
-
const graph2 = Obj.getSnapshot(cell.graph?.target);
|
|
611
|
-
const query = Query.fromAst(graph2.query.ast);
|
|
612
|
-
const result = await space?.db.query(query).run();
|
|
613
|
-
const objectIds = result?.objects?.map((obj) => obj.id);
|
|
614
|
-
setQueryValues((prev) => ({
|
|
615
|
-
...prev,
|
|
616
|
-
[cell.name]: objectIds
|
|
617
|
-
}));
|
|
618
|
-
}
|
|
619
|
-
}
|
|
620
|
-
}
|
|
621
|
-
}, [
|
|
622
|
-
space,
|
|
623
|
-
notebook,
|
|
624
|
-
graph
|
|
625
|
-
]);
|
|
626
|
-
const [promptResults, setPromptResults] = useState({});
|
|
627
|
-
const handleExecPrompts = useComputeRuntimeCallback(space, Effect.fnUntraced(function* () {
|
|
628
|
-
invariant2(graph, void 0, {
|
|
629
|
-
F: __dxlog_file3,
|
|
630
|
-
L: 93,
|
|
631
|
-
S: this,
|
|
632
|
-
A: [
|
|
633
|
-
"graph",
|
|
634
|
-
""
|
|
635
|
-
]
|
|
636
|
-
});
|
|
637
|
-
const prompts = notebook?.cells.filter((cell) => cell.type === "prompt").map((cell) => cell.prompt).filter(isNonNullable) ?? [];
|
|
638
|
-
for (const prompt of prompts) {
|
|
639
|
-
yield* runPrompt({
|
|
640
|
-
prompt,
|
|
641
|
-
input: {
|
|
642
|
-
...queryValues,
|
|
643
|
-
...graph.valuesByName.value
|
|
644
|
-
},
|
|
645
|
-
onResult: (result) => setPromptResults((prev) => ({
|
|
646
|
-
...prev,
|
|
647
|
-
[prompt.dxn.toString()]: result
|
|
648
|
-
}))
|
|
649
|
-
});
|
|
650
|
-
}
|
|
651
|
-
}), [
|
|
652
|
-
notebook,
|
|
653
|
-
graph,
|
|
654
|
-
queryValues
|
|
655
|
-
]);
|
|
656
|
-
const handleCompute = useCallback(async () => {
|
|
657
|
-
await graph?.evaluate();
|
|
658
|
-
await handleExecQueries();
|
|
659
|
-
await handleExecPrompts();
|
|
660
|
-
}, [
|
|
661
|
-
graph,
|
|
662
|
-
handleExecQueries,
|
|
663
|
-
handleExecPrompts
|
|
664
|
-
]);
|
|
665
|
-
const handleRearrange = useCallback((source, target) => {
|
|
666
|
-
invariant2(notebook, void 0, {
|
|
667
|
-
F: __dxlog_file3,
|
|
668
|
-
L: 126,
|
|
669
|
-
S: void 0,
|
|
670
|
-
A: [
|
|
671
|
-
"notebook",
|
|
672
|
-
""
|
|
673
|
-
]
|
|
674
|
-
});
|
|
675
|
-
const from = notebook.cells.findIndex((cell) => cell.id === source.id);
|
|
676
|
-
const to = notebook.cells.findIndex((cell) => cell.id === target.id);
|
|
677
|
-
if (from != null && to != null) {
|
|
678
|
-
const cell = notebook.cells.splice(from, 1)[0];
|
|
679
|
-
if (cell) {
|
|
680
|
-
notebook.cells.splice(to, 0, cell);
|
|
681
|
-
}
|
|
682
|
-
}
|
|
683
|
-
}, [
|
|
684
|
-
notebook
|
|
685
|
-
]);
|
|
686
|
-
const handleCellInsert = useCallback(async (type, after) => {
|
|
687
|
-
invariant2(notebook, void 0, {
|
|
688
|
-
F: __dxlog_file3,
|
|
689
|
-
L: 141,
|
|
690
|
-
S: void 0,
|
|
691
|
-
A: [
|
|
692
|
-
"notebook",
|
|
693
|
-
""
|
|
694
|
-
]
|
|
695
|
-
});
|
|
696
|
-
const cell = {
|
|
697
|
-
id: crypto.randomUUID(),
|
|
698
|
-
type
|
|
699
|
-
};
|
|
700
|
-
switch (type) {
|
|
701
|
-
case "markdown":
|
|
702
|
-
case "script":
|
|
703
|
-
case "query": {
|
|
704
|
-
cell.source = Ref.make(Text.make());
|
|
705
|
-
break;
|
|
706
|
-
}
|
|
707
|
-
case "prompt": {
|
|
708
|
-
if (space) {
|
|
709
|
-
const result = await space.db.query(Query.select(Filter.type(Blueprint.Blueprint))).run();
|
|
710
|
-
const blueprints = result.objects.filter((blueprint) => INCLUDE_BLUEPRINTS.includes(blueprint.key)).map((blueprint) => Ref.make(blueprint));
|
|
711
|
-
cell.prompt = Ref.make(Prompt.make({
|
|
712
|
-
instructions: "",
|
|
713
|
-
blueprints
|
|
714
|
-
}));
|
|
715
|
-
}
|
|
716
|
-
break;
|
|
717
|
-
}
|
|
718
|
-
}
|
|
719
|
-
const idx = after ? notebook.cells.findIndex((cell2) => cell2.id === after) : notebook.cells.length;
|
|
720
|
-
notebook.cells.splice(idx, 0, cell);
|
|
721
|
-
}, [
|
|
722
|
-
space,
|
|
723
|
-
notebook
|
|
724
|
-
]);
|
|
725
|
-
const handleCellDelete = useCallback((id) => {
|
|
726
|
-
invariant2(notebook, void 0, {
|
|
727
|
-
F: __dxlog_file3,
|
|
728
|
-
L: 171,
|
|
729
|
-
S: void 0,
|
|
730
|
-
A: [
|
|
731
|
-
"notebook",
|
|
732
|
-
""
|
|
733
|
-
]
|
|
734
|
-
});
|
|
735
|
-
const idx = notebook.cells.findIndex((cell) => cell.id === id);
|
|
736
|
-
if (idx !== -1) {
|
|
737
|
-
notebook.cells.splice(idx, 1);
|
|
738
|
-
}
|
|
739
|
-
}, [
|
|
740
|
-
notebook
|
|
741
|
-
]);
|
|
742
|
-
return /* @__PURE__ */ React.createElement(StackItem.Content, {
|
|
743
|
-
toolbar: true
|
|
744
|
-
}, /* @__PURE__ */ React.createElement(Toolbar.Root, {
|
|
745
|
-
disabled: !hasAttention,
|
|
746
|
-
textBlockWidth: true
|
|
747
|
-
}, /* @__PURE__ */ React.createElement(DropdownMenu.Root, null, /* @__PURE__ */ React.createElement(DropdownMenu.Trigger, {
|
|
748
|
-
asChild: true
|
|
749
|
-
}, /* @__PURE__ */ React.createElement(IconButton, {
|
|
750
|
-
icon: "ph--plus--regular",
|
|
751
|
-
iconOnly: true,
|
|
752
|
-
label: t("notebook cell insert label")
|
|
753
|
-
})), /* @__PURE__ */ React.createElement(NotebookMenu, {
|
|
754
|
-
onCellInsert: handleCellInsert
|
|
755
|
-
})), /* @__PURE__ */ React.createElement(Toolbar.IconButton, {
|
|
756
|
-
icon: "ph--play--fill",
|
|
757
|
-
iconOnly: true,
|
|
758
|
-
label: t("compute label"),
|
|
759
|
-
classNames: "text-green-500",
|
|
760
|
-
onClick: handleCompute
|
|
761
|
-
})), /* @__PURE__ */ React.createElement("div", {
|
|
762
|
-
role: "none",
|
|
763
|
-
className: "flex bs-full overflow-hidden -mis-[1px] -mie-[1px]"
|
|
764
|
-
}, /* @__PURE__ */ React.createElement(NotebookStack, {
|
|
765
|
-
classNames: "container-max-width border-l border-r border-subduedSeparator",
|
|
766
|
-
space,
|
|
767
|
-
notebook,
|
|
768
|
-
graph,
|
|
769
|
-
env,
|
|
770
|
-
promptResults,
|
|
771
|
-
onRearrange: handleRearrange,
|
|
772
|
-
onCellInsert: handleCellInsert,
|
|
773
|
-
onCellDelete: handleCellDelete
|
|
774
|
-
})));
|
|
775
|
-
} finally {
|
|
776
|
-
_effect.f();
|
|
777
|
-
}
|
|
778
|
-
};
|
|
779
|
-
var NotebookContainer_default = NotebookContainer;
|
|
780
|
-
var runPrompt = Effect.fn(function* ({ prompt, input, onResult }) {
|
|
781
|
-
const inputData = {
|
|
782
|
-
prompt,
|
|
783
|
-
input
|
|
784
|
-
};
|
|
785
|
-
const tracer = yield* InvocationTracer;
|
|
786
|
-
const trace = yield* tracer.traceInvocationStart({
|
|
787
|
-
target: void 0,
|
|
788
|
-
payload: {
|
|
789
|
-
data: {}
|
|
790
|
-
}
|
|
791
|
-
});
|
|
792
|
-
const result = yield* FunctionInvocationService.invokeFunction(Agent.prompt, inputData).pipe(Effect.provide(TracingServiceExt.layerQueue(trace.invocationTraceQueue)), Effect.exit);
|
|
793
|
-
Exit.match(result, {
|
|
794
|
-
onFailure: (cause) => {
|
|
795
|
-
const error = Cause.prettyErrors(cause)[0];
|
|
796
|
-
log2.error(error.message, error.cause ?? error.stack, {
|
|
797
|
-
F: __dxlog_file3,
|
|
798
|
-
L: 247,
|
|
799
|
-
S: this,
|
|
800
|
-
C: (f, a) => f(...a)
|
|
801
|
-
});
|
|
802
|
-
onResult(error.message);
|
|
803
|
-
},
|
|
804
|
-
onSuccess: (result2) => {
|
|
805
|
-
onResult(result2.note);
|
|
806
|
-
}
|
|
807
|
-
});
|
|
808
|
-
yield* tracer.traceInvocationEnd({
|
|
809
|
-
trace,
|
|
810
|
-
// TODO(dmaretskyi): Might miss errors.
|
|
811
|
-
exception: Exit.isFailure(result) ? Cause.prettyErrors(result.cause)[0] : void 0
|
|
812
|
-
});
|
|
813
|
-
});
|
|
814
|
-
export {
|
|
815
|
-
NotebookContainer,
|
|
816
|
-
NotebookContainer_default as default
|
|
817
|
-
};
|
|
818
|
-
//# sourceMappingURL=NotebookContainer-U4C2HQ4T.mjs.map
|