@dxos/plugin-script 0.8.4-main.ae835ea → 0.8.4-main.bcb3aa67d6
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-WUND47NK.mjs +115 -0
- package/dist/lib/browser/DeploymentDialog-WUND47NK.mjs.map +7 -0
- package/dist/lib/browser/{NotebookContainer-C36N7AFF.mjs → NotebookContainer-TGHMYWWK.mjs} +275 -254
- package/dist/lib/browser/NotebookContainer-TGHMYWWK.mjs.map +7 -0
- package/dist/lib/browser/ScriptContainer-BOCXMLNN.mjs +82 -0
- package/dist/lib/browser/ScriptContainer-BOCXMLNN.mjs.map +7 -0
- package/dist/lib/browser/ScriptObjectSettings-QKJFTSLS.mjs +295 -0
- package/dist/lib/browser/ScriptObjectSettings-QKJFTSLS.mjs.map +7 -0
- package/dist/lib/browser/ScriptPluginSettings-AMWZF7LZ.mjs +47 -0
- package/dist/lib/browser/ScriptPluginSettings-AMWZF7LZ.mjs.map +7 -0
- package/dist/lib/browser/ScriptProperties-VBOIIRJJ.mjs +26 -0
- package/dist/lib/browser/ScriptProperties-VBOIIRJJ.mjs.map +7 -0
- package/dist/lib/browser/TestContainer-5VNOC6I3.mjs +50 -0
- package/dist/lib/browser/TestContainer-5VNOC6I3.mjs.map +7 -0
- package/dist/lib/browser/access-token-created-XR7LB2XV.mjs +37 -0
- package/dist/lib/browser/access-token-created-XR7LB2XV.mjs.map +7 -0
- package/dist/lib/browser/blueprints/index.mjs +58 -0
- package/dist/lib/browser/blueprints/index.mjs.map +7 -0
- package/dist/lib/browser/chunk-AE5EX2VP.mjs +78 -0
- package/dist/lib/browser/chunk-AE5EX2VP.mjs.map +7 -0
- package/dist/lib/browser/chunk-DL37UOJE.mjs +105 -0
- package/dist/lib/browser/chunk-DL37UOJE.mjs.map +7 -0
- package/dist/lib/browser/chunk-TXVJW26E.mjs +50 -0
- package/dist/lib/browser/chunk-TXVJW26E.mjs.map +7 -0
- package/dist/lib/browser/chunk-ZLF66W2O.mjs +337 -0
- package/dist/lib/browser/chunk-ZLF66W2O.mjs.map +7 -0
- package/dist/lib/browser/create-V3MRNIUS.mjs +45 -0
- package/dist/lib/browser/create-V3MRNIUS.mjs.map +7 -0
- package/dist/lib/browser/create-script-IEY3HJ33.mjs +46 -0
- package/dist/lib/browser/create-script-IEY3HJ33.mjs.map +7 -0
- package/dist/lib/browser/delete-7QKDZ2QS.mjs +21 -0
- package/dist/lib/browser/delete-7QKDZ2QS.mjs.map +7 -0
- package/dist/lib/browser/deploy-SM2V6SNL.mjs +65 -0
- package/dist/lib/browser/deploy-SM2V6SNL.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +1179 -232
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/inspect-invocations-L4GAXXT3.mjs +55 -0
- package/dist/lib/browser/inspect-invocations-L4GAXXT3.mjs.map +7 -0
- package/dist/lib/browser/install-function-YDAA5EB6.mjs +54 -0
- package/dist/lib/browser/install-function-YDAA5EB6.mjs.map +7 -0
- package/dist/lib/browser/invoke-OKJMYOZB.mjs +36 -0
- package/dist/lib/browser/invoke-OKJMYOZB.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/operations/index.mjs +14 -0
- package/dist/lib/browser/operations/index.mjs.map +7 -0
- package/dist/lib/browser/query-deployed-functions-L3SIQHB5.mjs +33 -0
- package/dist/lib/browser/query-deployed-functions-L3SIQHB5.mjs.map +7 -0
- package/dist/lib/browser/read-YL7TNJC7.mjs +26 -0
- package/dist/lib/browser/read-YL7TNJC7.mjs.map +7 -0
- package/dist/lib/browser/templates/index.mjs +1 -1
- package/dist/lib/browser/types/index.mjs +7 -7
- package/dist/lib/browser/update-4RC6QH62.mjs +63 -0
- package/dist/lib/browser/update-4RC6QH62.mjs.map +7 -0
- package/dist/lib/node-esm/DeploymentDialog-XMR2CKP6.mjs +116 -0
- package/dist/lib/node-esm/DeploymentDialog-XMR2CKP6.mjs.map +7 -0
- package/dist/lib/node-esm/{NotebookContainer-FOVFGJQR.mjs → NotebookContainer-YUVZF6IS.mjs} +275 -254
- package/dist/lib/node-esm/NotebookContainer-YUVZF6IS.mjs.map +7 -0
- package/dist/lib/node-esm/ScriptContainer-G4D2YSFE.mjs +83 -0
- package/dist/lib/node-esm/ScriptContainer-G4D2YSFE.mjs.map +7 -0
- package/dist/lib/node-esm/ScriptObjectSettings-XIOE66BL.mjs +296 -0
- package/dist/lib/node-esm/ScriptObjectSettings-XIOE66BL.mjs.map +7 -0
- package/dist/lib/node-esm/ScriptPluginSettings-SDWEDLUU.mjs +48 -0
- package/dist/lib/node-esm/ScriptPluginSettings-SDWEDLUU.mjs.map +7 -0
- package/dist/lib/node-esm/ScriptProperties-5H2Z4XRF.mjs +27 -0
- package/dist/lib/node-esm/ScriptProperties-5H2Z4XRF.mjs.map +7 -0
- package/dist/lib/node-esm/TestContainer-SEFC4F2O.mjs +51 -0
- package/dist/lib/node-esm/TestContainer-SEFC4F2O.mjs.map +7 -0
- package/dist/lib/node-esm/access-token-created-AZEUHFPA.mjs +38 -0
- package/dist/lib/node-esm/access-token-created-AZEUHFPA.mjs.map +7 -0
- package/dist/lib/node-esm/blueprints/index.mjs +59 -0
- package/dist/lib/node-esm/blueprints/index.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-ELIPYPNQ.mjs +79 -0
- package/dist/lib/node-esm/chunk-ELIPYPNQ.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-QZMVI6AH.mjs +339 -0
- package/dist/lib/node-esm/chunk-QZMVI6AH.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-U2LUPXPK.mjs +51 -0
- package/dist/lib/node-esm/chunk-U2LUPXPK.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-ZLTGO4XB.mjs +107 -0
- package/dist/lib/node-esm/chunk-ZLTGO4XB.mjs.map +7 -0
- package/dist/lib/node-esm/create-XQAER3WF.mjs +46 -0
- package/dist/lib/node-esm/create-XQAER3WF.mjs.map +7 -0
- package/dist/lib/node-esm/create-script-2CGVQ3AU.mjs +47 -0
- package/dist/lib/node-esm/create-script-2CGVQ3AU.mjs.map +7 -0
- package/dist/lib/node-esm/delete-JA2S3K6Z.mjs +22 -0
- package/dist/lib/node-esm/delete-JA2S3K6Z.mjs.map +7 -0
- package/dist/lib/node-esm/deploy-FILYYRWE.mjs +66 -0
- package/dist/lib/node-esm/deploy-FILYYRWE.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +1179 -232
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/inspect-invocations-PLSHQCFM.mjs +56 -0
- package/dist/lib/node-esm/inspect-invocations-PLSHQCFM.mjs.map +7 -0
- package/dist/lib/node-esm/install-function-4TVXEWYF.mjs +55 -0
- package/dist/lib/node-esm/install-function-4TVXEWYF.mjs.map +7 -0
- package/dist/lib/node-esm/invoke-J4Z7CS44.mjs +37 -0
- package/dist/lib/node-esm/invoke-J4Z7CS44.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/operations/index.mjs +15 -0
- package/dist/lib/node-esm/operations/index.mjs.map +7 -0
- package/dist/lib/node-esm/query-deployed-functions-JBYIJGLW.mjs +34 -0
- package/dist/lib/node-esm/query-deployed-functions-JBYIJGLW.mjs.map +7 -0
- package/dist/lib/node-esm/read-HDE5XOGZ.mjs +27 -0
- package/dist/lib/node-esm/read-HDE5XOGZ.mjs.map +7 -0
- package/dist/lib/node-esm/templates/index.mjs +1 -1
- package/dist/lib/node-esm/types/index.mjs +7 -7
- package/dist/lib/node-esm/update-6O53SY6U.mjs +64 -0
- package/dist/lib/node-esm/update-6O53SY6U.mjs.map +7 -0
- package/dist/types/src/ScriptPlugin.d.ts +2 -1
- package/dist/types/src/ScriptPlugin.d.ts.map +1 -1
- 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 +142 -0
- package/dist/types/src/blueprints/functions/definitions.d.ts.map +1 -0
- package/dist/types/src/blueprints/functions/delete.d.ts +18 -0
- package/dist/types/src/blueprints/functions/delete.d.ts.map +1 -0
- package/dist/types/src/blueprints/functions/deploy.d.ts +22 -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 +30 -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 +22 -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 +22 -0
- package/dist/types/src/blueprints/functions/read.d.ts.map +1 -0
- package/dist/types/src/blueprints/functions/update.d.ts +27 -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/index.d.ts +12 -7
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- 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 +8 -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/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 +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 +9 -3
- package/dist/types/src/components/NotebookStack/NotebookStack.d.ts.map +1 -1
- package/dist/types/src/components/NotebookStack/NotebookStack.stories.d.ts +242 -226
- 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 +262 -0
- package/dist/types/src/components/ScriptPluginSettings/ScriptPluginSettings.stories.d.ts.map +1 -0
- package/dist/types/src/components/ScriptPluginSettings/index.d.ts +3 -0
- package/dist/types/src/components/ScriptPluginSettings/index.d.ts.map +1 -0
- package/dist/types/src/components/ScriptToolbar/ScriptToolbar.d.ts +11 -5
- package/dist/types/src/components/ScriptToolbar/ScriptToolbar.d.ts.map +1 -1
- package/dist/types/src/components/ScriptToolbar/ScriptToolbar.stories.d.ts +242 -226
- package/dist/types/src/components/ScriptToolbar/ScriptToolbar.stories.d.ts.map +1 -1
- package/dist/types/src/components/TestPanel/TestPanel.d.ts +8 -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 +9 -2
- package/dist/types/src/components/TypescriptEditor/TypescriptEditor.d.ts.map +1 -1
- package/dist/types/src/components/TypescriptEditor/TypescriptEditor.stories.d.ts +7 -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 +2 -4
- package/dist/types/src/containers/DeploymentDialog/DeploymentDialog.d.ts.map +1 -0
- package/dist/types/src/containers/DeploymentDialog/DeploymentDialog.stories.d.ts +261 -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/{components/Settings → containers/ScriptObjectSettings}/ScriptObjectSettings.d.ts +0 -1
- 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/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/{components/TestPanel → containers/TestContainer}/TestContainer.d.ts +1 -1
- 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 +8 -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 +25 -26
- package/dist/types/src/hooks/deploy.d.ts.map +1 -1
- package/dist/types/src/hooks/format.d.ts +3 -2
- package/dist/types/src/hooks/format.d.ts.map +1 -1
- package/dist/types/src/hooks/index.d.ts +1 -0
- package/dist/types/src/hooks/index.d.ts.map +1 -1
- package/dist/types/src/hooks/template.d.ts +3 -2
- package/dist/types/src/hooks/template.d.ts.map +1 -1
- package/dist/types/src/hooks/useCompiler.d.ts +7 -0
- package/dist/types/src/hooks/useCompiler.d.ts.map +1 -0
- package/dist/types/src/hooks/useCreateAndDeployScriptTemplates.d.ts.map +1 -1
- package/dist/types/src/hooks/useToolbarState.d.ts +8 -1
- package/dist/types/src/hooks/useToolbarState.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +2 -1
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +2 -2
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/notebook/compute-graph.d.ts +25 -12
- package/dist/types/src/notebook/compute-graph.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/definitions.d.ts +29 -0
- package/dist/types/src/operations/definitions.d.ts.map +1 -0
- package/dist/types/src/operations/index.d.ts +4 -0
- package/dist/types/src/operations/index.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/chess-bot.d.ts +18 -0
- package/dist/types/src/templates/chess-bot.d.ts.map +1 -0
- package/dist/types/src/templates/commentary.d.ts +19 -0
- package/dist/types/src/templates/commentary.d.ts.map +1 -0
- 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/index.d.ts +25 -16
- 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/data.d.ts +1 -1
- package/dist/types/src/testing/data.d.ts.map +1 -1
- package/dist/types/src/testing/simulator.test.d.ts +2 -0
- package/dist/types/src/testing/simulator.test.d.ts.map +1 -0
- package/dist/types/src/translations.d.ts +91 -84
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/Notebook.d.ts +108 -23
- package/dist/types/src/types/Notebook.d.ts.map +1 -1
- package/dist/types/src/types/Settings.d.ts +6 -0
- package/dist/types/src/types/Settings.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 +2 -1
- 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 +3 -2
- package/dist/types/src/util/deploy.d.ts.map +1 -1
- package/dist/types/src/util/functions.d.ts +3 -2
- package/dist/types/src/util/functions.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +136 -86
- package/src/ScriptPlugin.tsx +64 -86
- package/src/blueprints/functions/create.ts +48 -0
- package/src/blueprints/functions/definitions.ts +324 -0
- package/src/blueprints/functions/delete.ts +23 -0
- package/src/blueprints/functions/deploy.ts +70 -0
- package/src/blueprints/functions/index.ts +19 -0
- package/src/blueprints/functions/inspect-invocations.ts +55 -0
- package/src/blueprints/functions/install-function.ts +56 -0
- package/src/blueprints/functions/invoke.ts +35 -0
- package/src/blueprints/functions/query-deployed-functions.ts +31 -0
- package/src/blueprints/functions/read.ts +30 -0
- package/src/blueprints/functions/update.ts +69 -0
- package/src/blueprints/index.ts +5 -0
- package/src/blueprints/script-blueprint.ts +56 -0
- package/src/capabilities/app-graph-builder.ts +39 -57
- package/src/capabilities/artifact-definition.ts +97 -95
- package/src/capabilities/blueprint-definition.ts +11 -24
- package/src/capabilities/compiler.ts +92 -23
- package/src/capabilities/index.ts +11 -9
- package/src/capabilities/operation-handler.ts +20 -0
- package/src/capabilities/react-surface.tsx +132 -82
- package/src/capabilities/settings.ts +26 -14
- package/src/compiler/compiler.ts +10 -3
- package/src/components/{FrameContainer/FrameContainer.tsx → FramePanel/FramePanel.tsx} +8 -7
- package/src/components/{FrameContainer → FramePanel}/index.ts +1 -1
- package/src/components/NotebookStack/NotebookCell.tsx +40 -33
- package/src/components/NotebookStack/NotebookMenu.tsx +7 -7
- package/src/components/NotebookStack/NotebookStack.stories.tsx +21 -22
- package/src/components/NotebookStack/NotebookStack.tsx +30 -19
- 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/ScriptPluginSettings/ScriptPluginSettings.stories.tsx +32 -0
- package/src/components/ScriptPluginSettings/ScriptPluginSettings.tsx +64 -0
- package/src/components/ScriptPluginSettings/index.ts +7 -0
- package/src/components/ScriptToolbar/ScriptToolbar.stories.tsx +39 -17
- package/src/components/ScriptToolbar/ScriptToolbar.tsx +39 -44
- package/src/components/TestPanel/TestPanel.tsx +121 -178
- package/src/components/TestPanel/index.ts +0 -1
- package/src/components/TypescriptEditor/TypescriptEditor.stories.tsx +25 -18
- package/src/components/TypescriptEditor/TypescriptEditor.tsx +73 -66
- package/src/components/index.ts +7 -8
- package/src/constants.ts +7 -0
- package/src/{components → containers}/DeploymentDialog/DeploymentDialog.stories.tsx +30 -25
- package/src/containers/DeploymentDialog/DeploymentDialog.tsx +98 -0
- package/src/containers/DeploymentDialog/index.ts +7 -0
- package/src/{components → containers/NotebookContainer}/NotebookContainer.stories.tsx +30 -29
- package/src/{components → containers/NotebookContainer}/NotebookContainer.tsx +97 -92
- package/src/containers/NotebookContainer/index.ts +7 -0
- package/src/containers/ScriptContainer/ScriptContainer.tsx +85 -0
- package/src/containers/ScriptContainer/index.ts +7 -0
- package/src/{components/Settings → containers/ScriptObjectSettings}/ScriptObjectSettings.tsx +84 -75
- package/src/containers/ScriptObjectSettings/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 +45 -0
- package/src/containers/TestContainer/index.ts +7 -0
- package/src/containers/index.ts +12 -0
- package/src/e2e/ai.test.ts +93 -0
- package/src/e2e/deploy.test.ts +65 -0
- package/src/hooks/deploy.ts +44 -35
- package/src/hooks/format.ts +8 -3
- package/src/hooks/index.ts +1 -0
- package/src/hooks/template.ts +17 -11
- package/src/hooks/useCompiler.ts +24 -0
- package/src/hooks/useCreateAndDeployScriptTemplates.ts +13 -15
- package/src/hooks/useToolbarState.ts +29 -4
- package/src/index.ts +2 -1
- 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/operations/access-token-created.ts +36 -0
- package/src/operations/create-script.ts +47 -0
- package/src/operations/definitions.ts +40 -0
- package/src/operations/index.ts +12 -0
- package/src/templates/anthropic.ts +49 -0
- package/src/templates/chat.ts +1 -1
- package/src/templates/chess-bot.ts +61 -0
- package/src/templates/commentary.ts +244 -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 +5 -6
- package/src/templates/index.ts +31 -18
- package/src/templates/ping.ts +22 -5
- package/src/testing/data.ts +8 -8
- package/src/testing/simulator.test.ts +40 -0
- package/src/translations.ts +92 -84
- package/src/types/Notebook.ts +19 -15
- package/src/types/Settings.ts +17 -0
- package/src/types/capabilities.ts +17 -0
- package/src/types/events.ts +11 -0
- package/src/types/index.ts +2 -1
- package/src/types/types.ts +1 -11
- package/src/util/deploy.ts +28 -32
- package/src/util/functions.ts +31 -26
- package/src/vite-env.d.ts +2 -0
- package/dist/lib/browser/DeploymentDialog-E5NXT4UQ.mjs +0 -14
- package/dist/lib/browser/DeploymentDialog-E5NXT4UQ.mjs.map +0 -7
- package/dist/lib/browser/NotebookContainer-C36N7AFF.mjs.map +0 -7
- package/dist/lib/browser/ScriptContainer-4YPRUM3C.mjs +0 -148
- package/dist/lib/browser/ScriptContainer-4YPRUM3C.mjs.map +0 -7
- package/dist/lib/browser/app-graph-builder-LEOPGBJD.mjs +0 -66
- package/dist/lib/browser/app-graph-builder-LEOPGBJD.mjs.map +0 -7
- package/dist/lib/browser/blueprint-definition-6PZWZM2Y.mjs +0 -30
- package/dist/lib/browser/blueprint-definition-6PZWZM2Y.mjs.map +0 -7
- package/dist/lib/browser/chunk-5S5YQNJZ.mjs +0 -304
- package/dist/lib/browser/chunk-5S5YQNJZ.mjs.map +0 -7
- package/dist/lib/browser/chunk-A5K3TXYA.mjs +0 -269
- package/dist/lib/browser/chunk-A5K3TXYA.mjs.map +0 -7
- package/dist/lib/browser/chunk-EB6AXFXO.mjs +0 -31
- package/dist/lib/browser/chunk-EB6AXFXO.mjs.map +0 -7
- package/dist/lib/browser/chunk-HCURXADW.mjs +0 -102
- package/dist/lib/browser/chunk-HCURXADW.mjs.map +0 -7
- package/dist/lib/browser/chunk-HHTOAI2J.mjs +0 -644
- package/dist/lib/browser/chunk-HHTOAI2J.mjs.map +0 -7
- package/dist/lib/browser/chunk-IQMYIWHG.mjs +0 -153
- package/dist/lib/browser/chunk-IQMYIWHG.mjs.map +0 -7
- package/dist/lib/browser/chunk-LI4P25M5.mjs +0 -111
- package/dist/lib/browser/chunk-LI4P25M5.mjs.map +0 -7
- package/dist/lib/browser/chunk-Q2DGRQRN.mjs +0 -255
- package/dist/lib/browser/chunk-Q2DGRQRN.mjs.map +0 -7
- package/dist/lib/browser/chunk-ST3ACVUC.mjs +0 -88
- package/dist/lib/browser/chunk-ST3ACVUC.mjs.map +0 -7
- package/dist/lib/browser/chunk-UOQ6NCH3.mjs +0 -15
- package/dist/lib/browser/chunk-UOQ6NCH3.mjs.map +0 -7
- package/dist/lib/browser/compiler-Q4UY2COU.mjs +0 -86
- package/dist/lib/browser/compiler-Q4UY2COU.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-AMMHATM7.mjs +0 -105
- package/dist/lib/browser/intent-resolver-AMMHATM7.mjs.map +0 -7
- package/dist/lib/browser/react-surface-X4NATU6B.mjs +0 -128
- package/dist/lib/browser/react-surface-X4NATU6B.mjs.map +0 -7
- package/dist/lib/browser/settings-6UXY7F7D.mjs +0 -26
- package/dist/lib/browser/settings-6UXY7F7D.mjs.map +0 -7
- package/dist/lib/node-esm/DeploymentDialog-OSHHSEBH.mjs +0 -15
- package/dist/lib/node-esm/DeploymentDialog-OSHHSEBH.mjs.map +0 -7
- package/dist/lib/node-esm/NotebookContainer-FOVFGJQR.mjs.map +0 -7
- package/dist/lib/node-esm/ScriptContainer-EW24D5II.mjs +0 -149
- package/dist/lib/node-esm/ScriptContainer-EW24D5II.mjs.map +0 -7
- package/dist/lib/node-esm/app-graph-builder-XJ3MY5BM.mjs +0 -67
- package/dist/lib/node-esm/app-graph-builder-XJ3MY5BM.mjs.map +0 -7
- package/dist/lib/node-esm/blueprint-definition-5R6YCSZZ.mjs +0 -31
- package/dist/lib/node-esm/blueprint-definition-5R6YCSZZ.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-2GVTWESW.mjs +0 -90
- package/dist/lib/node-esm/chunk-2GVTWESW.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-55JZVM6K.mjs +0 -16
- package/dist/lib/node-esm/chunk-55JZVM6K.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-EJLYOSD7.mjs +0 -113
- package/dist/lib/node-esm/chunk-EJLYOSD7.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-GA27XSEY.mjs +0 -270
- package/dist/lib/node-esm/chunk-GA27XSEY.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-IBV2DR36.mjs +0 -33
- package/dist/lib/node-esm/chunk-IBV2DR36.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-N2XLVOFB.mjs +0 -103
- package/dist/lib/node-esm/chunk-N2XLVOFB.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-O7HXE72S.mjs +0 -256
- package/dist/lib/node-esm/chunk-O7HXE72S.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-OZ6LCME4.mjs +0 -645
- package/dist/lib/node-esm/chunk-OZ6LCME4.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-TUGLYZDT.mjs +0 -305
- package/dist/lib/node-esm/chunk-TUGLYZDT.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-UEGPBCSF.mjs +0 -154
- package/dist/lib/node-esm/chunk-UEGPBCSF.mjs.map +0 -7
- package/dist/lib/node-esm/compiler-I6A4KE6E.mjs +0 -87
- package/dist/lib/node-esm/compiler-I6A4KE6E.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-YKLZQR7U.mjs +0 -106
- package/dist/lib/node-esm/intent-resolver-YKLZQR7U.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-LVGLBSTE.mjs +0 -129
- package/dist/lib/node-esm/react-surface-LVGLBSTE.mjs.map +0 -7
- package/dist/lib/node-esm/settings-O4EZPUE3.mjs +0 -27
- package/dist/lib/node-esm/settings-O4EZPUE3.mjs.map +0 -7
- package/dist/types/src/capabilities/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 -248
- 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/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 -251
- 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.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.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/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.tsx +0 -106
- 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 -69
- 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
|
@@ -1,274 +1,1221 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
ScriptObjectSettings,
|
|
6
|
-
ScriptPluginSettings,
|
|
7
|
-
ScriptProperties,
|
|
8
|
-
TestContainer,
|
|
9
|
-
TestPanel
|
|
10
|
-
} from "./chunk-HHTOAI2J.mjs";
|
|
11
|
-
import {
|
|
12
|
-
NotebookMenu,
|
|
13
|
-
NotebookStack
|
|
14
|
-
} from "./chunk-5S5YQNJZ.mjs";
|
|
15
|
-
import {
|
|
16
|
-
ScriptCapabilities
|
|
17
|
-
} from "./chunk-UOQ6NCH3.mjs";
|
|
18
|
-
import {
|
|
19
|
-
DEPLOYMENT_DIALOG
|
|
20
|
-
} from "./chunk-IQMYIWHG.mjs";
|
|
21
|
-
import "./chunk-A5K3TXYA.mjs";
|
|
22
|
-
import "./chunk-LI4P25M5.mjs";
|
|
23
|
-
import {
|
|
24
|
-
deployScript,
|
|
25
|
-
getAccessCredential,
|
|
26
|
-
getFunctionUrl,
|
|
27
|
-
isScriptDeployed,
|
|
28
|
-
updateFunctionMetadata
|
|
29
|
-
} from "./chunk-Q2DGRQRN.mjs";
|
|
30
|
-
import {
|
|
31
|
-
Notebook_exports,
|
|
32
|
-
ScriptAction
|
|
33
|
-
} from "./chunk-HCURXADW.mjs";
|
|
34
|
-
import "./chunk-ST3ACVUC.mjs";
|
|
35
|
-
import {
|
|
36
|
-
defaultScriptsForIntegration,
|
|
37
|
-
meta
|
|
38
|
-
} from "./chunk-EB6AXFXO.mjs";
|
|
2
|
+
ScriptCapabilities,
|
|
3
|
+
ScriptEvents
|
|
4
|
+
} from "./chunk-AE5EX2VP.mjs";
|
|
39
5
|
import "./chunk-J5LGTIGS.mjs";
|
|
40
6
|
|
|
41
|
-
// src/
|
|
42
|
-
import { lazy } from "
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
7
|
+
// src/components/index.ts
|
|
8
|
+
import { lazy } from "react";
|
|
9
|
+
|
|
10
|
+
// src/components/FramePanel/FramePanel.tsx
|
|
11
|
+
import React, { useEffect, useRef } from "react";
|
|
12
|
+
import { clientServiceBundle } from "@dxos/client-protocol";
|
|
13
|
+
import { invariant } from "@dxos/invariant";
|
|
14
|
+
import { log } from "@dxos/log";
|
|
15
|
+
import { useClient } from "@dxos/react-client";
|
|
16
|
+
import { createProtoRpcPeer } from "@dxos/rpc";
|
|
17
|
+
import { createIFramePort } from "@dxos/rpc-tunnel";
|
|
18
|
+
import { mx } from "@dxos/ui-theme";
|
|
19
|
+
var __dxlog_file = "/__w/dxos/dxos/packages/plugins/plugin-script/src/components/FramePanel/FramePanel.tsx";
|
|
20
|
+
var FramePanel = ({ containerUrl, result, debug = true }) => {
|
|
21
|
+
const client = useClient();
|
|
22
|
+
const iframeRef = useRef(null);
|
|
23
|
+
useEffect(() => {
|
|
24
|
+
if (iframeRef.current) {
|
|
25
|
+
const rpc = createProtoRpcPeer({
|
|
26
|
+
exposed: clientServiceBundle,
|
|
27
|
+
handlers: client._services.services,
|
|
28
|
+
port: createIFramePort({
|
|
29
|
+
channel: "frame",
|
|
30
|
+
iframe: iframeRef.current,
|
|
31
|
+
origin: "*"
|
|
32
|
+
})
|
|
33
|
+
});
|
|
34
|
+
rpc.open().catch((e) => log.catch(e, void 0, {
|
|
35
|
+
F: __dxlog_file,
|
|
36
|
+
L: 41,
|
|
37
|
+
S: void 0,
|
|
38
|
+
C: (f, a) => f(...a)
|
|
39
|
+
}));
|
|
40
|
+
return () => {
|
|
41
|
+
rpc.close().catch((e) => log.catch(e, void 0, {
|
|
42
|
+
F: __dxlog_file,
|
|
43
|
+
L: 43,
|
|
44
|
+
S: void 0,
|
|
45
|
+
C: (f, a) => f(...a)
|
|
46
|
+
}));
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
}, [
|
|
50
|
+
iframeRef
|
|
51
|
+
]);
|
|
52
|
+
invariant(result.sourceHash, "Source hash is required.", {
|
|
53
|
+
F: __dxlog_file,
|
|
54
|
+
L: 49,
|
|
55
|
+
S: void 0,
|
|
56
|
+
A: [
|
|
57
|
+
"result.sourceHash",
|
|
58
|
+
"'Source hash is required.'"
|
|
59
|
+
]
|
|
60
|
+
});
|
|
61
|
+
const sourceHash = Buffer.from(result.sourceHash).toString("hex");
|
|
62
|
+
const src = "bundle" in result ? `${containerUrl}?ts=${sourceHash}#code=${encodeURIComponent(new TextDecoder().decode(Object.values(result.bundle)[0]))}` : void 0;
|
|
63
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("iframe", {
|
|
64
|
+
ref: iframeRef,
|
|
65
|
+
sandbox: "allow-scripts",
|
|
66
|
+
src,
|
|
67
|
+
style: {
|
|
68
|
+
width: "100%",
|
|
69
|
+
height: "100%"
|
|
70
|
+
}
|
|
71
|
+
}), debug && /* @__PURE__ */ React.createElement("div", {
|
|
72
|
+
className: "relative"
|
|
73
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
74
|
+
className: mx("flex absolute right-2 bottom-2 w-[30rem] h-[200px] bg-base-surface ring rounded-sm", "z-20 overflow-x-hidden overflow-y-auto")
|
|
75
|
+
}, /* @__PURE__ */ React.createElement("pre", {
|
|
76
|
+
className: "text-xs whitespace-break-spaces break-all p-2"
|
|
77
|
+
}, JSON.stringify({
|
|
78
|
+
timestamp: result.timestamp,
|
|
79
|
+
sourceHash,
|
|
80
|
+
error: "error" in result ? result.error : void 0,
|
|
81
|
+
src
|
|
82
|
+
}, void 0, 2)))));
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
// src/components/NotebookStack/NotebookMenu.tsx
|
|
86
|
+
import React2 from "react";
|
|
87
|
+
import { DropdownMenu, useTranslation } from "@dxos/react-ui";
|
|
88
|
+
import { meta } from "#meta";
|
|
89
|
+
var NotebookMenu = ({ cell, onCellInsert, onCellDelete }) => {
|
|
90
|
+
const { t } = useTranslation(meta.id);
|
|
91
|
+
return /* @__PURE__ */ React2.createElement(DropdownMenu.Portal, null, /* @__PURE__ */ React2.createElement(DropdownMenu.Content, null, /* @__PURE__ */ React2.createElement(DropdownMenu.Viewport, null, /* @__PURE__ */ React2.createElement(DropdownMenu.Item, {
|
|
92
|
+
onClick: () => onCellInsert?.("script", cell?.id)
|
|
93
|
+
}, t("notebook-cell-insert-script.label")), /* @__PURE__ */ React2.createElement(DropdownMenu.Item, {
|
|
94
|
+
onClick: () => onCellInsert?.("prompt", cell?.id)
|
|
95
|
+
}, t("notebook-cell-insert-prompt.label")), /* @__PURE__ */ React2.createElement(DropdownMenu.Item, {
|
|
96
|
+
onClick: () => onCellInsert?.("query", cell?.id)
|
|
97
|
+
}, t("notebook-cell-insert-query.label")), /* @__PURE__ */ React2.createElement(DropdownMenu.Item, {
|
|
98
|
+
onClick: () => onCellInsert?.("markdown", cell?.id)
|
|
99
|
+
}, t("notebook-cell-insert-markdown.label")), cell && onCellDelete && /* @__PURE__ */ React2.createElement(DropdownMenu.Item, {
|
|
100
|
+
onClick: () => onCellDelete?.(cell.id)
|
|
101
|
+
}, t("notebook-cell-delete.label"))), /* @__PURE__ */ React2.createElement(DropdownMenu.Arrow, null)));
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
// src/components/NotebookStack/NotebookStack.tsx
|
|
105
|
+
import React5 from "react";
|
|
106
|
+
import { DropdownMenu as DropdownMenu2, IconButton, useTranslation as useTranslation3 } from "@dxos/react-ui";
|
|
107
|
+
import { Stack, StackItem } from "@dxos/react-ui-stack";
|
|
108
|
+
import { composable as composable2, composableProps as composableProps2 } from "@dxos/ui-theme";
|
|
109
|
+
import { meta as meta3 } from "#meta";
|
|
110
|
+
|
|
111
|
+
// src/components/NotebookStack/NotebookCell.tsx
|
|
112
|
+
import React4, { useCallback, useMemo } from "react";
|
|
113
|
+
import { Surface } from "@dxos/app-framework/ui";
|
|
114
|
+
import { Obj } from "@dxos/echo";
|
|
115
|
+
import { createDocAccessor } from "@dxos/echo-db";
|
|
116
|
+
import { invariant as invariant2 } from "@dxos/invariant";
|
|
117
|
+
import { TemplateEditor } from "@dxos/plugin-assistant";
|
|
118
|
+
import { useThemeContext as useThemeContext2, useTranslation as useTranslation2 } from "@dxos/react-ui";
|
|
119
|
+
import { QueryEditor } from "@dxos/react-ui-components";
|
|
120
|
+
import { EditorContent } from "@dxos/react-ui-editor";
|
|
121
|
+
import { createBasicExtensions as createBasicExtensions2, createDataExtensions, createMarkdownExtensions, createThemeExtensions as createThemeExtensions2, decorateMarkdown } from "@dxos/ui-editor";
|
|
122
|
+
import { mx as mx2 } from "@dxos/ui-theme";
|
|
123
|
+
import { isNonNullable as isNonNullable2 } from "@dxos/util";
|
|
124
|
+
import { meta as meta2 } from "#meta";
|
|
125
|
+
|
|
126
|
+
// src/components/TypescriptEditor/TypescriptEditor.tsx
|
|
127
|
+
import { autocompletion, completionKeymap } from "@codemirror/autocomplete";
|
|
128
|
+
import { javascript } from "@codemirror/lang-javascript";
|
|
129
|
+
import { HighlightStyle } from "@codemirror/language";
|
|
130
|
+
import { lintKeymap } from "@codemirror/lint";
|
|
131
|
+
import { Prec } from "@codemirror/state";
|
|
132
|
+
import { keymap } from "@codemirror/view";
|
|
133
|
+
import { tags } from "@lezer/highlight";
|
|
134
|
+
import { composeRefs } from "@radix-ui/react-compose-refs";
|
|
135
|
+
import { continueKeymap } from "@valtown/codemirror-continue";
|
|
136
|
+
import { tsAutocomplete, tsFacet, tsHover, tsLinter, tsSync } from "@valtown/codemirror-ts";
|
|
137
|
+
import React3 from "react";
|
|
138
|
+
import { useThemeContext } from "@dxos/react-ui";
|
|
139
|
+
import { useTextEditor } from "@dxos/react-ui-editor";
|
|
140
|
+
import { Domino } from "@dxos/ui";
|
|
141
|
+
import { InputModeExtensions, createBasicExtensions, createThemeExtensions, defaultStyles } from "@dxos/ui-editor";
|
|
142
|
+
import { composable, composableProps } from "@dxos/ui-theme";
|
|
143
|
+
import { isNonNullable } from "@dxos/util";
|
|
144
|
+
var TypescriptEditor = composable(({ classNames, id, role = "article", inputMode = "vscode", env, options, initialValue, extensions, scrollTo, selection, ...props }, forwardedRef) => {
|
|
145
|
+
const { themeMode } = useThemeContext();
|
|
146
|
+
const { parentRef, focusAttributes } = useTextEditor(() => ({
|
|
147
|
+
id,
|
|
148
|
+
initialValue,
|
|
149
|
+
selection,
|
|
150
|
+
scrollTo,
|
|
151
|
+
extensions: [
|
|
152
|
+
extensions,
|
|
153
|
+
createBasicExtensions({
|
|
154
|
+
highlightActiveLine: true,
|
|
155
|
+
indentWithTab: true,
|
|
156
|
+
lineNumbers: true,
|
|
157
|
+
lineWrapping: false,
|
|
158
|
+
scrollPastEnd: role !== "section",
|
|
159
|
+
search: true,
|
|
160
|
+
...options
|
|
161
|
+
}),
|
|
162
|
+
createThemeExtensions({
|
|
163
|
+
monospace: true,
|
|
164
|
+
themeMode,
|
|
165
|
+
syntaxHighlighting: true
|
|
166
|
+
}),
|
|
167
|
+
InputModeExtensions[inputMode],
|
|
168
|
+
javascript({
|
|
169
|
+
typescript: true
|
|
170
|
+
}),
|
|
171
|
+
autocompletion({
|
|
172
|
+
override: env ? [
|
|
173
|
+
tsAutocomplete()
|
|
174
|
+
] : void 0
|
|
175
|
+
}),
|
|
176
|
+
// Continues block comments when pressing Enter.
|
|
177
|
+
Prec.high(keymap.of(continueKeymap)),
|
|
178
|
+
keymap.of(completionKeymap),
|
|
179
|
+
keymap.of(lintKeymap),
|
|
180
|
+
// https://github.com/val-town/codemirror-ts
|
|
181
|
+
env && [
|
|
182
|
+
// TODO(burdon): Fix type.
|
|
183
|
+
tsFacet.of({
|
|
184
|
+
env,
|
|
185
|
+
path: `./src/${id}.ts`
|
|
186
|
+
}),
|
|
187
|
+
tsSync(),
|
|
188
|
+
tsLinter(),
|
|
189
|
+
tsHover({
|
|
190
|
+
renderTooltip: createTooltipRenderer(themeMode)
|
|
191
|
+
})
|
|
192
|
+
]
|
|
193
|
+
].filter(isNonNullable)
|
|
194
|
+
}), [
|
|
195
|
+
themeMode,
|
|
196
|
+
id,
|
|
197
|
+
extensions,
|
|
198
|
+
inputMode,
|
|
199
|
+
selection,
|
|
200
|
+
scrollTo,
|
|
201
|
+
env
|
|
202
|
+
]);
|
|
203
|
+
return /* @__PURE__ */ React3.createElement("div", {
|
|
204
|
+
...composableProps(props, {
|
|
205
|
+
classNames,
|
|
206
|
+
...focusAttributes
|
|
207
|
+
}),
|
|
208
|
+
ref: composeRefs(parentRef, forwardedRef)
|
|
209
|
+
});
|
|
210
|
+
});
|
|
211
|
+
var createTooltipRenderer = (themeMode) => {
|
|
212
|
+
const theme = HighlightStyle.define(themeMode === "dark" ? defaultStyles.dark : defaultStyles.light);
|
|
213
|
+
const classFromKind = (_kind) => {
|
|
214
|
+
const kind = _kind.endsWith("Name") ? "name" : _kind;
|
|
215
|
+
const validTag = kind in tags;
|
|
216
|
+
if (!validTag) {
|
|
217
|
+
return "";
|
|
218
|
+
}
|
|
219
|
+
const tag = tags[kind];
|
|
220
|
+
if (typeof tag === "function") {
|
|
221
|
+
return "";
|
|
222
|
+
}
|
|
223
|
+
return theme.style([
|
|
224
|
+
tag
|
|
225
|
+
]) ?? "";
|
|
226
|
+
};
|
|
227
|
+
return (info) => {
|
|
228
|
+
const children = info.quickInfo?.displayParts?.map(({ kind, text }) => Domino.of("span").classNames(classFromKind(kind)).text(text)) ?? [];
|
|
229
|
+
return {
|
|
230
|
+
dom: Domino.of("div").classNames("xs:max-w-80 max-w-lg p-1 bg-base-surface rounded-sm border border-separator").children(...children).root
|
|
231
|
+
};
|
|
232
|
+
};
|
|
233
|
+
};
|
|
234
|
+
|
|
235
|
+
// src/components/NotebookStack/NotebookCell.tsx
|
|
236
|
+
var __dxlog_file2 = "/__w/dxos/dxos/packages/plugins/plugin-script/src/components/NotebookStack/NotebookCell.tsx";
|
|
237
|
+
var editorStyles = "p-2 ps-3";
|
|
238
|
+
var valueStyles = "p-1 ps-3";
|
|
239
|
+
var NotebookCell = ({ db, graph, dragging, cell, promptResults, env }) => {
|
|
240
|
+
const { t } = useTranslation2(meta2.id);
|
|
241
|
+
const extensions = useMemo(() => {
|
|
242
|
+
return cell.source?.target ? [
|
|
243
|
+
createDataExtensions({
|
|
244
|
+
id: cell.id,
|
|
245
|
+
text: createDocAccessor(cell.source.target, [
|
|
246
|
+
"content"
|
|
247
|
+
])
|
|
248
|
+
})
|
|
249
|
+
].filter(isNonNullable2) : [];
|
|
250
|
+
}, [
|
|
251
|
+
cell.source?.target
|
|
252
|
+
]);
|
|
253
|
+
const explorerGraph = cell.graph?.target;
|
|
254
|
+
const handleQueryChange = useCallback((value) => {
|
|
255
|
+
invariant2(cell.source?.target, void 0, {
|
|
256
|
+
F: __dxlog_file2,
|
|
257
|
+
L: 63,
|
|
258
|
+
S: void 0,
|
|
259
|
+
A: [
|
|
260
|
+
"cell.source?.target",
|
|
261
|
+
""
|
|
262
|
+
]
|
|
263
|
+
});
|
|
264
|
+
Obj.change(cell.source.target, (obj) => {
|
|
265
|
+
obj.content = value;
|
|
266
|
+
});
|
|
267
|
+
}, [
|
|
268
|
+
cell
|
|
269
|
+
]);
|
|
270
|
+
switch (cell.type) {
|
|
271
|
+
case "markdown":
|
|
272
|
+
if (!cell.source?.target) {
|
|
273
|
+
return null;
|
|
274
|
+
}
|
|
275
|
+
return /* @__PURE__ */ React4.createElement(NotebookTextEditor, {
|
|
276
|
+
id: cell.id,
|
|
277
|
+
classNames: editorStyles,
|
|
278
|
+
initialValue: cell.source.target.content,
|
|
279
|
+
extensions
|
|
280
|
+
});
|
|
281
|
+
case "script":
|
|
282
|
+
if (!cell.source?.target) {
|
|
283
|
+
return null;
|
|
284
|
+
}
|
|
285
|
+
return /* @__PURE__ */ React4.createElement(React4.Fragment, null, /* @__PURE__ */ React4.createElement(TypescriptEditor, {
|
|
286
|
+
id: cell.id,
|
|
287
|
+
role: "section",
|
|
288
|
+
classNames: editorStyles,
|
|
289
|
+
initialValue: cell.source.target.content,
|
|
290
|
+
extensions,
|
|
291
|
+
env,
|
|
292
|
+
options: {
|
|
293
|
+
placeholder: t("notebook-cell.placeholder"),
|
|
294
|
+
highlightActiveLine: false,
|
|
295
|
+
lineNumbers: false
|
|
296
|
+
}
|
|
297
|
+
}), /* @__PURE__ */ React4.createElement(NotebookCellValue, {
|
|
298
|
+
cell,
|
|
299
|
+
graph
|
|
300
|
+
}));
|
|
301
|
+
case "query":
|
|
302
|
+
if (!cell.source?.target) {
|
|
303
|
+
return null;
|
|
304
|
+
}
|
|
305
|
+
return /* @__PURE__ */ React4.createElement("div", {
|
|
306
|
+
className: mx2("h-full overflow-hidden grid", explorerGraph && !dragging && "grid-rows-[min-content_1fr]")
|
|
307
|
+
}, /* @__PURE__ */ React4.createElement(QueryEditor, {
|
|
308
|
+
id: cell.id,
|
|
309
|
+
classNames: [
|
|
310
|
+
editorStyles,
|
|
311
|
+
"border-b border-subdued-separator"
|
|
312
|
+
],
|
|
313
|
+
db,
|
|
314
|
+
value: cell.source.target.content,
|
|
315
|
+
onChange: handleQueryChange
|
|
316
|
+
}), explorerGraph && !dragging && /* @__PURE__ */ React4.createElement(Surface.Surface, {
|
|
317
|
+
role: "section",
|
|
318
|
+
limit: 1,
|
|
319
|
+
data: {
|
|
320
|
+
subject: explorerGraph
|
|
321
|
+
}
|
|
322
|
+
}));
|
|
323
|
+
// TODO(burdon): Use streaming response from Chat.
|
|
324
|
+
case "prompt":
|
|
325
|
+
if (!cell.prompt?.target) {
|
|
326
|
+
return null;
|
|
327
|
+
}
|
|
328
|
+
return /* @__PURE__ */ React4.createElement(React4.Fragment, null, /* @__PURE__ */ React4.createElement(TemplateEditor, {
|
|
329
|
+
id: cell.id,
|
|
330
|
+
template: cell.prompt.target.instructions,
|
|
331
|
+
lineNumbers: false,
|
|
332
|
+
classNames: editorStyles
|
|
333
|
+
}), /* @__PURE__ */ React4.createElement(NotebookPromptResult, {
|
|
334
|
+
cell,
|
|
335
|
+
promptResults
|
|
336
|
+
}));
|
|
337
|
+
default:
|
|
338
|
+
return null;
|
|
339
|
+
}
|
|
340
|
+
};
|
|
341
|
+
var NotebookCellValue = ({ cell, graph }) => {
|
|
342
|
+
const name = graph?.getExpressions()[cell.id]?.name;
|
|
343
|
+
const value = graph?.getValue(cell.id);
|
|
344
|
+
if (value == null) {
|
|
345
|
+
return null;
|
|
346
|
+
}
|
|
347
|
+
return /* @__PURE__ */ React4.createElement("div", {
|
|
348
|
+
className: mx2("flex w-full bg-group-surface border-y border-subdued-separator text-description font-mono", valueStyles)
|
|
349
|
+
}, name && /* @__PURE__ */ React4.createElement(React4.Fragment, null, /* @__PURE__ */ React4.createElement("span", {
|
|
350
|
+
className: "text-success-text"
|
|
351
|
+
}, name), /* @__PURE__ */ React4.createElement("span", {
|
|
352
|
+
className: "text-description"
|
|
353
|
+
}, "\xA0=\xA0")), /* @__PURE__ */ React4.createElement("span", null, value));
|
|
354
|
+
};
|
|
355
|
+
var NotebookPromptResult = ({ cell, promptResults }) => {
|
|
356
|
+
if (!cell.prompt) {
|
|
357
|
+
return null;
|
|
358
|
+
}
|
|
359
|
+
const value = promptResults?.[cell.prompt.dxn.toString()];
|
|
360
|
+
if (value == null) {
|
|
361
|
+
return null;
|
|
362
|
+
}
|
|
363
|
+
return /* @__PURE__ */ React4.createElement("div", {
|
|
364
|
+
className: mx2("flex w-full bg-group-surface text-description border-y border-subdued-separator", valueStyles)
|
|
365
|
+
}, /* @__PURE__ */ React4.createElement(NotebookTextEditor, {
|
|
366
|
+
readOnly: true,
|
|
367
|
+
value
|
|
368
|
+
}));
|
|
369
|
+
};
|
|
370
|
+
var NotebookTextEditor = ({ extensions: extensionsProp, readOnly, ...props }) => {
|
|
371
|
+
const { t } = useTranslation2(meta2.id);
|
|
372
|
+
const { themeMode } = useThemeContext2();
|
|
373
|
+
const extensions = useMemo(() => {
|
|
374
|
+
return [
|
|
375
|
+
createBasicExtensions2({
|
|
376
|
+
placeholder: t("notebook-markdown.placeholder"),
|
|
377
|
+
readOnly
|
|
378
|
+
}),
|
|
379
|
+
createThemeExtensions2({
|
|
380
|
+
themeMode,
|
|
381
|
+
syntaxHighlighting: true
|
|
382
|
+
}),
|
|
383
|
+
createMarkdownExtensions(),
|
|
384
|
+
decorateMarkdown(),
|
|
385
|
+
extensionsProp
|
|
386
|
+
].filter(isNonNullable2);
|
|
387
|
+
}, [
|
|
388
|
+
extensionsProp
|
|
389
|
+
]);
|
|
390
|
+
return /* @__PURE__ */ React4.createElement(EditorContent, {
|
|
391
|
+
...props,
|
|
392
|
+
extensions,
|
|
393
|
+
selectionEnd: true
|
|
394
|
+
});
|
|
395
|
+
};
|
|
396
|
+
|
|
397
|
+
// src/components/NotebookStack/NotebookStack.tsx
|
|
398
|
+
var minSectionHeight = "min-h-[16rem]";
|
|
399
|
+
var NotebookStack = composable2(({ notebook, onRearrange, db, graph, promptResults, onCellInsert, onCellDelete, env, ...props }, forwardedRef) => {
|
|
400
|
+
const sectionProps = {
|
|
401
|
+
db,
|
|
402
|
+
graph,
|
|
403
|
+
promptResults,
|
|
404
|
+
onCellInsert,
|
|
405
|
+
onCellDelete,
|
|
406
|
+
env
|
|
407
|
+
};
|
|
408
|
+
return /* @__PURE__ */ React5.createElement(Stack, {
|
|
409
|
+
...composableProps2(props),
|
|
410
|
+
orientation: "vertical",
|
|
411
|
+
size: "contain",
|
|
412
|
+
rail: true,
|
|
413
|
+
onRearrange,
|
|
414
|
+
ref: forwardedRef
|
|
415
|
+
}, notebook?.cells.map((cell, i) => /* @__PURE__ */ React5.createElement(NotebookSection, {
|
|
416
|
+
key: i,
|
|
417
|
+
cell,
|
|
418
|
+
...sectionProps
|
|
419
|
+
})));
|
|
420
|
+
});
|
|
421
|
+
var NotebookSection = ({ cell, db, env, promptResults, onCellInsert, onCellDelete, ...props }) => {
|
|
422
|
+
const { t } = useTranslation3(meta3.id);
|
|
423
|
+
const resizable = cell.type === "query";
|
|
424
|
+
return /* @__PURE__ */ React5.createElement(StackItem.Root, {
|
|
425
|
+
role: "section",
|
|
426
|
+
item: cell,
|
|
427
|
+
draggable: true,
|
|
428
|
+
classNames: resizable && minSectionHeight
|
|
429
|
+
}, /* @__PURE__ */ React5.createElement(StackItem.Heading, {
|
|
430
|
+
classNames: "h-full p-1 justify-between dx-attention-surface"
|
|
431
|
+
}, /* @__PURE__ */ React5.createElement(StackItem.DragHandle, {
|
|
432
|
+
asChild: true
|
|
433
|
+
}, /* @__PURE__ */ React5.createElement(IconButton, {
|
|
434
|
+
variant: "ghost",
|
|
435
|
+
icon: "ph--dots-six-vertical--regular",
|
|
436
|
+
iconOnly: true,
|
|
437
|
+
label: "Drag handle"
|
|
438
|
+
})), /* @__PURE__ */ React5.createElement(DropdownMenu2.Root, null, /* @__PURE__ */ React5.createElement(DropdownMenu2.Trigger, {
|
|
439
|
+
asChild: true
|
|
440
|
+
}, /* @__PURE__ */ React5.createElement(IconButton, {
|
|
441
|
+
variant: "ghost",
|
|
442
|
+
icon: "ph--dots-three--regular",
|
|
443
|
+
iconOnly: true,
|
|
444
|
+
label: t("notebook-cell-insert.label")
|
|
445
|
+
})), /* @__PURE__ */ React5.createElement(NotebookMenu, {
|
|
446
|
+
cell,
|
|
447
|
+
onCellInsert,
|
|
448
|
+
onCellDelete
|
|
449
|
+
})), resizable && /* @__PURE__ */ React5.createElement(StackItem.ResizeHandle, null)), /* @__PURE__ */ React5.createElement(StackItem.DragPreview, null, ({ item: cell2 }) => /* @__PURE__ */ React5.createElement(StackItem.Content, {
|
|
450
|
+
classNames: "overflow-visible bg-group-surface border border-subdued-separator"
|
|
451
|
+
}, /* @__PURE__ */ React5.createElement(NotebookCell, {
|
|
452
|
+
db,
|
|
453
|
+
cell: cell2,
|
|
454
|
+
env,
|
|
455
|
+
dragging: true
|
|
456
|
+
}))), /* @__PURE__ */ React5.createElement(StackItem.Content, {
|
|
457
|
+
classNames: "overflow-visible"
|
|
458
|
+
}, /* @__PURE__ */ React5.createElement(NotebookCell, {
|
|
459
|
+
db,
|
|
460
|
+
cell,
|
|
461
|
+
env,
|
|
462
|
+
promptResults,
|
|
463
|
+
...props
|
|
464
|
+
})));
|
|
465
|
+
};
|
|
466
|
+
|
|
467
|
+
// src/components/QueryEditor/QueryEditor.tsx
|
|
468
|
+
import React6, { useState } from "react";
|
|
469
|
+
import { ScriptTarget } from "typescript";
|
|
470
|
+
import queryApi from "@dxos/echo-query/api.d.ts?raw";
|
|
471
|
+
import { useAsyncEffect } from "@dxos/react-ui";
|
|
472
|
+
|
|
473
|
+
// src/compiler/compiler.ts
|
|
474
|
+
import { createDefaultMapFromCDN, createSystem, createVirtualTypeScriptEnvironment } from "@typescript/vfs";
|
|
475
|
+
import ts from "typescript";
|
|
476
|
+
import { invariant as invariant3 } from "@dxos/invariant";
|
|
477
|
+
var __dxlog_file3 = "/__w/dxos/dxos/packages/plugins/plugin-script/src/compiler/compiler.ts";
|
|
478
|
+
var GLOBALS = "globals.d.ts";
|
|
479
|
+
var defaultOptions = {
|
|
480
|
+
lib: [
|
|
481
|
+
"DOM",
|
|
482
|
+
"es2022"
|
|
483
|
+
],
|
|
484
|
+
target: ts.ScriptTarget.ES2022
|
|
485
|
+
};
|
|
486
|
+
var Compiler = class {
|
|
487
|
+
_options;
|
|
488
|
+
_env;
|
|
489
|
+
_fsMap;
|
|
490
|
+
constructor(_options = defaultOptions) {
|
|
491
|
+
this._options = _options;
|
|
492
|
+
}
|
|
493
|
+
async initialize(globals) {
|
|
494
|
+
if (this._env) {
|
|
495
|
+
return;
|
|
496
|
+
}
|
|
497
|
+
this._fsMap = await createDefaultMapFromCDN(this._options, "5.7.2", true, ts);
|
|
498
|
+
if (globals) {
|
|
499
|
+
this._fsMap.set(GLOBALS, globals);
|
|
500
|
+
}
|
|
501
|
+
const rootFiles = globals ? [
|
|
502
|
+
GLOBALS
|
|
503
|
+
] : [];
|
|
504
|
+
const system = createSystem(this._fsMap);
|
|
505
|
+
this._env = createVirtualTypeScriptEnvironment(system, rootFiles, ts, this._options);
|
|
506
|
+
}
|
|
507
|
+
get environment() {
|
|
508
|
+
invariant3(this._env, "Compiler environment not initialized.", {
|
|
509
|
+
F: __dxlog_file3,
|
|
510
|
+
L: 46,
|
|
511
|
+
S: this,
|
|
512
|
+
A: [
|
|
513
|
+
"this._env",
|
|
514
|
+
"'Compiler environment not initialized.'"
|
|
515
|
+
]
|
|
516
|
+
});
|
|
517
|
+
return this._env;
|
|
518
|
+
}
|
|
519
|
+
setFile(fileName, content) {
|
|
520
|
+
invariant3(this._fsMap, "File system map not initialized.", {
|
|
521
|
+
F: __dxlog_file3,
|
|
522
|
+
L: 51,
|
|
523
|
+
S: this,
|
|
524
|
+
A: [
|
|
525
|
+
"this._fsMap",
|
|
526
|
+
"'File system map not initialized.'"
|
|
527
|
+
]
|
|
528
|
+
});
|
|
529
|
+
this.environment.createFile(fileName, content);
|
|
530
|
+
}
|
|
531
|
+
compile(fileName) {
|
|
532
|
+
return this.environment.languageService.getEmitOutput(fileName);
|
|
533
|
+
}
|
|
534
|
+
};
|
|
535
|
+
|
|
536
|
+
// src/components/QueryEditor/QueryEditor.tsx
|
|
537
|
+
var GLOBALS2 = `
|
|
538
|
+
namespace QueryAPI {
|
|
539
|
+
${queryApi}
|
|
540
|
+
}
|
|
541
|
+
|
|
542
|
+
declare global {
|
|
543
|
+
const Query: typeof QueryAPI.Query;
|
|
544
|
+
const Filter: typeof QueryAPI.Filter;
|
|
545
|
+
const Order: typeof QueryAPI.Order;
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
export {};
|
|
549
|
+
`;
|
|
550
|
+
var QueryEditor2 = (props) => {
|
|
551
|
+
const [compiler, setCompiler] = useState();
|
|
552
|
+
useAsyncEffect(async () => {
|
|
553
|
+
const compiler2 = new Compiler({
|
|
554
|
+
lib: [
|
|
555
|
+
"ES5"
|
|
556
|
+
],
|
|
557
|
+
target: ScriptTarget.ES2022
|
|
558
|
+
});
|
|
559
|
+
await compiler2.initialize(GLOBALS2);
|
|
560
|
+
setCompiler(compiler2);
|
|
561
|
+
}, []);
|
|
562
|
+
if (!compiler) {
|
|
563
|
+
return null;
|
|
564
|
+
}
|
|
565
|
+
return /* @__PURE__ */ React6.createElement(TypescriptEditor, {
|
|
566
|
+
...props,
|
|
567
|
+
env: compiler.environment
|
|
568
|
+
});
|
|
569
|
+
};
|
|
570
|
+
|
|
571
|
+
// src/components/ScriptToolbar/ScriptToolbar.tsx
|
|
572
|
+
import { Atom } from "@effect-atom/atom-react";
|
|
573
|
+
import React7, { useMemo as useMemo2 } from "react";
|
|
574
|
+
import { ElevationProvider, useTranslation as useTranslation4 } from "@dxos/react-ui";
|
|
575
|
+
import { composable as composable3, composableProps as composableProps3 } from "@dxos/ui-theme";
|
|
576
|
+
import { Menu, createGapSeparator, useMenuActions } from "@dxos/react-ui-menu";
|
|
577
|
+
import { createDeploy, createFormat, createTemplateSelect, useDeployDeps } from "#hooks";
|
|
578
|
+
import { meta as meta4 } from "#meta";
|
|
579
|
+
var ScriptToolbar = composable3(({ script, attendableId, role, state, ...props }, forwardedRef) => {
|
|
580
|
+
const { t } = useTranslation4(meta4.id);
|
|
581
|
+
const options = useDeployDeps({
|
|
582
|
+
script
|
|
583
|
+
});
|
|
584
|
+
const menuCreator = useMemo2(() => createToolbarActions({
|
|
585
|
+
state,
|
|
586
|
+
script,
|
|
587
|
+
t,
|
|
588
|
+
...options
|
|
589
|
+
}), [
|
|
590
|
+
state,
|
|
591
|
+
script,
|
|
592
|
+
options,
|
|
593
|
+
t
|
|
594
|
+
]);
|
|
595
|
+
const menuActions = useMenuActions(menuCreator);
|
|
596
|
+
return /* @__PURE__ */ React7.createElement(ElevationProvider, {
|
|
597
|
+
elevation: role === "section" ? "positioned" : "base"
|
|
598
|
+
}, /* @__PURE__ */ React7.createElement(Menu.Root, {
|
|
599
|
+
...menuActions,
|
|
600
|
+
attendableId
|
|
601
|
+
}, /* @__PURE__ */ React7.createElement(Menu.Toolbar, {
|
|
602
|
+
...composableProps3(props),
|
|
603
|
+
ref: forwardedRef
|
|
604
|
+
})));
|
|
605
|
+
});
|
|
606
|
+
var createToolbarActions = ({ state, script, ...options }) => Atom.make((get) => {
|
|
607
|
+
get(state.atom);
|
|
608
|
+
const templateSelect = createTemplateSelect(script);
|
|
609
|
+
const format = createFormat(script);
|
|
610
|
+
const gap = createGapSeparator();
|
|
611
|
+
const deploy = createDeploy({
|
|
612
|
+
state,
|
|
613
|
+
script,
|
|
614
|
+
...options
|
|
615
|
+
});
|
|
616
|
+
return {
|
|
617
|
+
nodes: [
|
|
618
|
+
...templateSelect.nodes,
|
|
619
|
+
...format.nodes,
|
|
620
|
+
...gap.nodes,
|
|
621
|
+
...deploy.nodes
|
|
622
|
+
],
|
|
623
|
+
edges: [
|
|
624
|
+
...templateSelect.edges,
|
|
625
|
+
...format.edges,
|
|
626
|
+
...gap.edges,
|
|
627
|
+
...deploy.edges
|
|
628
|
+
]
|
|
629
|
+
};
|
|
630
|
+
});
|
|
631
|
+
|
|
632
|
+
// src/components/TestPanel/TestPanel.tsx
|
|
633
|
+
import React8, { forwardRef, useRef as useRef2, useState as useState2 } from "react";
|
|
634
|
+
import { log as log2 } from "@dxos/log";
|
|
635
|
+
import { Avatar, Icon, Input, ScrollArea, Toolbar, useTranslation as useTranslation5 } from "@dxos/react-ui";
|
|
636
|
+
import { SyntaxHighlighter } from "@dxos/react-ui-syntax-highlighter";
|
|
637
|
+
import { composable as composable4, composableProps as composableProps4, mx as mx3 } from "@dxos/ui-theme";
|
|
638
|
+
import { meta as meta5 } from "#meta";
|
|
639
|
+
var __dxlog_file4 = "/__w/dxos/dxos/packages/plugins/plugin-script/src/components/TestPanel/TestPanel.tsx";
|
|
640
|
+
var TestPanel = composable4(({ classNames, onInvoke, ...props }, forwardedRef) => {
|
|
641
|
+
const { t } = useTranslation5(meta5.id);
|
|
642
|
+
const inputRef = useRef2(null);
|
|
643
|
+
const [input, setInput] = useState2("");
|
|
644
|
+
const [state, setState] = useState2(null);
|
|
645
|
+
const [history, setHistory] = useState2([]);
|
|
646
|
+
const scrollerRef = useRef2(null);
|
|
647
|
+
const handleScroll = () => {
|
|
648
|
+
if (scrollerRef.current) {
|
|
649
|
+
scrollerRef.current.scrollTop = scrollerRef.current.scrollHeight;
|
|
650
|
+
}
|
|
651
|
+
};
|
|
652
|
+
const handleClear = () => {
|
|
653
|
+
setInput("");
|
|
654
|
+
setHistory([]);
|
|
655
|
+
inputRef.current?.focus();
|
|
656
|
+
};
|
|
657
|
+
const handleResponse = ({ text, data, error } = {}) => {
|
|
658
|
+
setHistory((history2) => [
|
|
659
|
+
...history2,
|
|
660
|
+
{
|
|
661
|
+
type: "response",
|
|
662
|
+
text,
|
|
663
|
+
data,
|
|
664
|
+
error
|
|
665
|
+
}
|
|
666
|
+
]);
|
|
667
|
+
setState(null);
|
|
668
|
+
handleScroll();
|
|
669
|
+
};
|
|
670
|
+
const handleRequest = async (input2) => {
|
|
671
|
+
if (!onInvoke) {
|
|
672
|
+
handleResponse({
|
|
673
|
+
error: new Error("Function not deployed")
|
|
674
|
+
});
|
|
675
|
+
return;
|
|
676
|
+
}
|
|
677
|
+
let data = input2;
|
|
678
|
+
let displayText = input2;
|
|
679
|
+
if (input2.charAt(0) === "{") {
|
|
680
|
+
try {
|
|
681
|
+
const validJsonString = input2.replace(/'/g, '"').replace(/([{,]\s*)([a-zA-Z0-9_]+)(\s*:)/g, '$1"$2"$3');
|
|
682
|
+
data = JSON.parse(validJsonString);
|
|
683
|
+
displayText = JSON.stringify(data, null, 2);
|
|
684
|
+
} catch (err) {
|
|
685
|
+
handleResponse({
|
|
686
|
+
error: new Error("Invalid JSON input")
|
|
687
|
+
});
|
|
688
|
+
return;
|
|
689
|
+
}
|
|
690
|
+
}
|
|
691
|
+
try {
|
|
692
|
+
setState("pending");
|
|
693
|
+
setInput("");
|
|
694
|
+
setHistory((history2) => [
|
|
695
|
+
...history2,
|
|
696
|
+
{
|
|
697
|
+
type: "request",
|
|
698
|
+
text: displayText
|
|
699
|
+
}
|
|
700
|
+
]);
|
|
701
|
+
setTimeout(handleScroll);
|
|
702
|
+
const result = await onInvoke(data);
|
|
703
|
+
if (typeof result === "string") {
|
|
704
|
+
handleResponse({
|
|
705
|
+
text: result
|
|
706
|
+
});
|
|
707
|
+
} else {
|
|
708
|
+
handleResponse({
|
|
709
|
+
data: result
|
|
710
|
+
});
|
|
711
|
+
}
|
|
712
|
+
} catch (err) {
|
|
713
|
+
const error = err instanceof Error ? err : new Error(String(err));
|
|
714
|
+
handleResponse({
|
|
715
|
+
error
|
|
716
|
+
});
|
|
717
|
+
log2.catch(err, void 0, {
|
|
718
|
+
F: __dxlog_file4,
|
|
719
|
+
L: 104,
|
|
720
|
+
S: void 0,
|
|
721
|
+
C: (f, a) => f(...a)
|
|
722
|
+
});
|
|
723
|
+
}
|
|
724
|
+
};
|
|
725
|
+
return /* @__PURE__ */ React8.createElement("div", {
|
|
726
|
+
...composableProps4(props, {
|
|
727
|
+
classNames: [
|
|
728
|
+
"flex flex-col h-full overflow-hidden",
|
|
729
|
+
classNames
|
|
730
|
+
]
|
|
731
|
+
}),
|
|
732
|
+
ref: forwardedRef
|
|
733
|
+
}, /* @__PURE__ */ React8.createElement(MessageThread, {
|
|
734
|
+
ref: scrollerRef,
|
|
735
|
+
state,
|
|
736
|
+
history
|
|
737
|
+
}), /* @__PURE__ */ React8.createElement(Toolbar.Root, null, /* @__PURE__ */ React8.createElement(Input.Root, null, /* @__PURE__ */ React8.createElement(Input.TextInput, {
|
|
738
|
+
ref: inputRef,
|
|
739
|
+
autoFocus: true,
|
|
740
|
+
placeholder: t("function-request.placeholder"),
|
|
741
|
+
value: input,
|
|
742
|
+
onChange: (ev) => setInput(ev.target.value),
|
|
743
|
+
onKeyDown: (ev) => ev.key === "Enter" && handleRequest(input)
|
|
744
|
+
})), /* @__PURE__ */ React8.createElement(Toolbar.IconButton, {
|
|
745
|
+
icon: "ph--play--regular",
|
|
746
|
+
label: "Execute",
|
|
747
|
+
iconOnly: true,
|
|
748
|
+
onClick: () => handleRequest(input)
|
|
749
|
+
}), /* @__PURE__ */ React8.createElement(Toolbar.IconButton, {
|
|
750
|
+
icon: "ph--trash--regular",
|
|
751
|
+
label: "Clear",
|
|
752
|
+
iconOnly: true,
|
|
753
|
+
onClick: handleClear
|
|
754
|
+
})));
|
|
755
|
+
});
|
|
756
|
+
var MessageThread = /* @__PURE__ */ forwardRef(({ state, history }, forwardedRef) => {
|
|
757
|
+
return /* @__PURE__ */ React8.createElement(ScrollArea.Root, {
|
|
758
|
+
orientation: "vertical",
|
|
759
|
+
classNames: "h-full",
|
|
760
|
+
ref: forwardedRef
|
|
761
|
+
}, /* @__PURE__ */ React8.createElement(ScrollArea.Viewport, {
|
|
762
|
+
classNames: "gap-6 p-2"
|
|
763
|
+
}, history.map((message, i) => /* @__PURE__ */ React8.createElement("div", {
|
|
764
|
+
key: i,
|
|
765
|
+
className: "grid grid-cols-[2rem_1fr_2rem]"
|
|
766
|
+
}, /* @__PURE__ */ React8.createElement("div", {
|
|
767
|
+
className: "p-1"
|
|
768
|
+
}, message.type === "response" && /* @__PURE__ */ React8.createElement(RobotAvatar, null)), /* @__PURE__ */ React8.createElement("div", {
|
|
769
|
+
className: "overflow-auto"
|
|
770
|
+
}, /* @__PURE__ */ React8.createElement(MessageItem, {
|
|
771
|
+
message
|
|
772
|
+
})))), state === "pending" && /* @__PURE__ */ React8.createElement("div", {
|
|
773
|
+
className: "grid grid-cols-[2rem_1fr_2rem]"
|
|
774
|
+
}, /* @__PURE__ */ React8.createElement("div", {
|
|
775
|
+
className: "p-1"
|
|
776
|
+
}, /* @__PURE__ */ React8.createElement(Icon, {
|
|
777
|
+
icon: "ph--spinner--regular",
|
|
778
|
+
size: 6,
|
|
779
|
+
classNames: "animate-spin"
|
|
780
|
+
})))));
|
|
781
|
+
});
|
|
782
|
+
var MessageItem = ({ classNames, message }) => {
|
|
783
|
+
const { type, text, data, error } = message;
|
|
784
|
+
const wrapper = "p-1 px-2 rounded-md bg-hover-surface overflow-auto";
|
|
785
|
+
return /* @__PURE__ */ React8.createElement("div", {
|
|
786
|
+
className: mx3("flex", type === "request" ? "ml-[1rem] justify-end" : "mr-[1rem]", classNames)
|
|
787
|
+
}, error && /* @__PURE__ */ React8.createElement("div", {
|
|
788
|
+
className: mx3(wrapper, "whitespace-pre text-error-text")
|
|
789
|
+
}, String(error)), text !== void 0 && /* @__PURE__ */ React8.createElement("div", {
|
|
790
|
+
className: mx3(wrapper, type === "request" && "bg-primary-500 dark:bg-primary-600")
|
|
791
|
+
}, text || "\xD8"), data && /* @__PURE__ */ React8.createElement(SyntaxHighlighter, {
|
|
792
|
+
language: "json",
|
|
793
|
+
className: mx3(wrapper, "text-xs")
|
|
794
|
+
}, JSON.stringify(data, null, 2)));
|
|
795
|
+
};
|
|
796
|
+
var RobotAvatar = () => /* @__PURE__ */ React8.createElement(Avatar.Root, null, /* @__PURE__ */ React8.createElement(Avatar.Content, {
|
|
797
|
+
size: 6,
|
|
798
|
+
variant: "circle",
|
|
799
|
+
icon: "ph--robot--regular"
|
|
800
|
+
}));
|
|
801
|
+
|
|
802
|
+
// src/components/index.ts
|
|
803
|
+
var ScriptPluginSettings = lazy(() => import("./ScriptPluginSettings-AMWZF7LZ.mjs"));
|
|
804
|
+
|
|
805
|
+
// src/containers/index.ts
|
|
806
|
+
import { lazy as lazy2 } from "react";
|
|
807
|
+
var DeploymentDialog = lazy2(() => import("./DeploymentDialog-WUND47NK.mjs"));
|
|
808
|
+
var NotebookContainer = lazy2(() => import("./NotebookContainer-TGHMYWWK.mjs"));
|
|
809
|
+
var ScriptContainer = lazy2(() => import("./ScriptContainer-BOCXMLNN.mjs"));
|
|
810
|
+
var ScriptObjectSettings = lazy2(() => import("./ScriptObjectSettings-QKJFTSLS.mjs"));
|
|
811
|
+
var ScriptProperties = lazy2(() => import("./ScriptProperties-VBOIIRJJ.mjs"));
|
|
812
|
+
var TestContainer = lazy2(() => import("./TestContainer-5VNOC6I3.mjs"));
|
|
813
|
+
|
|
814
|
+
// src/meta.ts
|
|
815
|
+
import { trim } from "@dxos/util";
|
|
816
|
+
var meta6 = {
|
|
817
|
+
id: "org.dxos.plugin.script",
|
|
818
|
+
name: "Scripts",
|
|
819
|
+
description: trim`
|
|
820
|
+
Write and deploy custom JavaScript functions that extend your workspace capabilities.
|
|
821
|
+
Create AI agent tools, spreadsheet formulas, and automation scripts that integrate seamlessly with other plugins.
|
|
822
|
+
`,
|
|
823
|
+
icon: "ph--code--regular",
|
|
824
|
+
iconHue: "sky",
|
|
825
|
+
source: "https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-explorer",
|
|
826
|
+
tags: [
|
|
827
|
+
"labs"
|
|
828
|
+
],
|
|
829
|
+
screenshots: [
|
|
830
|
+
"https://dxos.network/plugin-details-scripts-dark.png"
|
|
831
|
+
]
|
|
832
|
+
};
|
|
833
|
+
var defaultScriptsForIntegration = {
|
|
834
|
+
// TODO(wittjosiah): Also include content extraction scripts in the default set.
|
|
835
|
+
"gmail.com": [
|
|
836
|
+
"org.dxos.script.gmail"
|
|
837
|
+
]
|
|
838
|
+
};
|
|
839
|
+
|
|
840
|
+
// src/util/deploy.ts
|
|
841
|
+
import { Context } from "@dxos/context";
|
|
842
|
+
import { Obj as Obj2, Ref } from "@dxos/echo";
|
|
843
|
+
import { getUserFunctionIdInMetadata } from "@dxos/functions";
|
|
844
|
+
import { Operation } from "@dxos/operation";
|
|
845
|
+
import { bundleFunction } from "@dxos/functions-runtime/bundler";
|
|
846
|
+
import { FunctionsServiceClient, incrementSemverPatch } from "@dxos/functions-runtime/edge";
|
|
847
|
+
import { log as log3 } from "@dxos/log";
|
|
848
|
+
import { FunctionRuntimeKind } from "@dxos/protocols";
|
|
849
|
+
var __dxlog_file5 = "/__w/dxos/dxos/packages/plugins/plugin-script/src/util/deploy.ts";
|
|
850
|
+
var isScriptDeployed = ({ script, fn }) => {
|
|
851
|
+
const existingFunctionId = fn && getUserFunctionIdInMetadata(Obj2.getMeta(fn));
|
|
852
|
+
return Boolean(existingFunctionId) && !script.changed;
|
|
853
|
+
};
|
|
854
|
+
var deployScript = async ({ script, client, space, fn, existingFunctionId }) => {
|
|
855
|
+
const validationError = validateDeployInputs(script, space);
|
|
856
|
+
if (validationError) {
|
|
857
|
+
return {
|
|
858
|
+
success: false,
|
|
859
|
+
error: validationError
|
|
860
|
+
};
|
|
861
|
+
}
|
|
862
|
+
try {
|
|
863
|
+
const buildResult = await bundleFunction({
|
|
864
|
+
source: script.source.target.content
|
|
865
|
+
});
|
|
866
|
+
if ("error" in buildResult) {
|
|
867
|
+
throw buildResult.error || new Error("Bundle creation failed");
|
|
868
|
+
}
|
|
869
|
+
const functionsServiceClient = FunctionsServiceClient.fromClient(client);
|
|
870
|
+
const newFunction = await functionsServiceClient.deploy(Context.default(void 0, {
|
|
871
|
+
F: __dxlog_file5,
|
|
872
|
+
L: 55
|
|
873
|
+
}), {
|
|
874
|
+
// TODO(dmaretskyi): Space key or identity key.
|
|
875
|
+
ownerPublicKey: space.key,
|
|
876
|
+
version: fn ? incrementSemverPatch(fn.version) : "0.0.1",
|
|
877
|
+
functionId: existingFunctionId,
|
|
878
|
+
entryPoint: buildResult.entryPoint,
|
|
879
|
+
assets: buildResult.assets,
|
|
880
|
+
runtime: FunctionRuntimeKind.enums.WORKER_LOADER
|
|
881
|
+
});
|
|
882
|
+
const storedFunction = createOrUpdateFunctionInSpace(space, fn, script, newFunction);
|
|
883
|
+
Obj2.change(script, (obj) => {
|
|
884
|
+
obj.changed = false;
|
|
885
|
+
});
|
|
886
|
+
return {
|
|
887
|
+
success: true,
|
|
888
|
+
functionId: getUserFunctionIdInMetadata(Obj2.getMeta(storedFunction))
|
|
889
|
+
};
|
|
890
|
+
} catch (err) {
|
|
891
|
+
log3.catch(err, void 0, {
|
|
892
|
+
F: __dxlog_file5,
|
|
893
|
+
L: 72,
|
|
894
|
+
S: void 0,
|
|
895
|
+
C: (f, a) => f(...a)
|
|
896
|
+
});
|
|
897
|
+
return {
|
|
898
|
+
success: false,
|
|
899
|
+
error: err
|
|
900
|
+
};
|
|
901
|
+
}
|
|
902
|
+
};
|
|
903
|
+
var validateDeployInputs = (script, space) => {
|
|
904
|
+
if (!script.source || !space) {
|
|
905
|
+
return new Error("Script source or space not available");
|
|
906
|
+
}
|
|
907
|
+
return null;
|
|
908
|
+
};
|
|
909
|
+
var createOrUpdateFunctionInSpace = (space, fn, script, newFunction) => {
|
|
910
|
+
if (fn) {
|
|
911
|
+
Operation.setFrom(fn, newFunction);
|
|
912
|
+
return fn;
|
|
913
|
+
} else {
|
|
914
|
+
Obj2.change(newFunction, (obj) => {
|
|
915
|
+
obj.source = Ref.make(script);
|
|
916
|
+
});
|
|
917
|
+
return space.db.add(newFunction);
|
|
918
|
+
}
|
|
919
|
+
};
|
|
920
|
+
|
|
921
|
+
// src/util/functions.ts
|
|
922
|
+
import { Obj as Obj3 } from "@dxos/echo";
|
|
923
|
+
import { getUserFunctionIdInMetadata as getUserFunctionIdInMetadata2 } from "@dxos/functions";
|
|
924
|
+
import { getInvocationUrl } from "@dxos/functions-runtime";
|
|
925
|
+
import { log as log4 } from "@dxos/log";
|
|
926
|
+
import { getSpace } from "@dxos/react-client/echo";
|
|
927
|
+
var __dxlog_file6 = "/__w/dxos/dxos/packages/plugins/plugin-script/src/util/functions.ts";
|
|
928
|
+
var getFunctionUrl = ({ script, fn, edgeUrl }) => {
|
|
929
|
+
const space = getSpace(script);
|
|
930
|
+
const existingFunctionId = fn && getUserFunctionIdInMetadata2(Obj3.getMeta(fn));
|
|
931
|
+
if (!existingFunctionId) {
|
|
932
|
+
return void 0;
|
|
933
|
+
}
|
|
934
|
+
return getInvocationUrl(existingFunctionId, edgeUrl, {
|
|
935
|
+
spaceId: space?.id
|
|
936
|
+
});
|
|
937
|
+
};
|
|
938
|
+
var updateFunctionMetadata = (script, storedFunction, meta9, functionId) => {
|
|
939
|
+
Obj3.change(storedFunction, (obj) => {
|
|
940
|
+
if (script.description !== void 0 && script.description.trim() !== "") {
|
|
941
|
+
obj.description = script.description;
|
|
942
|
+
} else if (meta9.description) {
|
|
943
|
+
obj.description = meta9.description;
|
|
944
|
+
} else {
|
|
945
|
+
log4.verbose("no description in function metadata", {
|
|
946
|
+
functionId
|
|
947
|
+
}, {
|
|
948
|
+
F: __dxlog_file6,
|
|
949
|
+
L: 49,
|
|
950
|
+
S: void 0,
|
|
951
|
+
C: (f, a) => f(...a)
|
|
952
|
+
});
|
|
953
|
+
}
|
|
954
|
+
if (meta9.inputSchema) {
|
|
955
|
+
obj.inputSchema = meta9.inputSchema;
|
|
956
|
+
} else {
|
|
957
|
+
log4.verbose("no input schema in function metadata", {
|
|
958
|
+
functionId
|
|
959
|
+
}, {
|
|
960
|
+
F: __dxlog_file6,
|
|
961
|
+
L: 55,
|
|
962
|
+
S: void 0,
|
|
963
|
+
C: (f, a) => f(...a)
|
|
964
|
+
});
|
|
965
|
+
}
|
|
966
|
+
if (meta9.outputSchema) {
|
|
967
|
+
obj.outputSchema = meta9.outputSchema;
|
|
968
|
+
} else {
|
|
969
|
+
log4.verbose("no output schema in function metadata", {
|
|
970
|
+
functionId
|
|
971
|
+
}, {
|
|
972
|
+
F: __dxlog_file6,
|
|
973
|
+
L: 61,
|
|
974
|
+
S: void 0,
|
|
975
|
+
C: (f, a) => f(...a)
|
|
976
|
+
});
|
|
977
|
+
}
|
|
978
|
+
if (meta9.key) {
|
|
979
|
+
obj.key = meta9.key;
|
|
980
|
+
} else {
|
|
981
|
+
log4.verbose("no key in function metadata", {
|
|
982
|
+
functionId
|
|
983
|
+
}, {
|
|
984
|
+
F: __dxlog_file6,
|
|
985
|
+
L: 67,
|
|
986
|
+
S: void 0,
|
|
987
|
+
C: (f, a) => f(...a)
|
|
988
|
+
});
|
|
989
|
+
}
|
|
990
|
+
});
|
|
991
|
+
};
|
|
992
|
+
var getAccessCredential = (identityKey) => {
|
|
993
|
+
return {
|
|
994
|
+
issuer: identityKey,
|
|
995
|
+
issuanceDate: /* @__PURE__ */ new Date(),
|
|
996
|
+
subject: {
|
|
997
|
+
id: identityKey,
|
|
998
|
+
assertion: {
|
|
999
|
+
"@type": "dxos.halo.credentials.ServiceAccess",
|
|
1000
|
+
serverName: "hub.dxos.network",
|
|
1001
|
+
serverKey: identityKey,
|
|
1002
|
+
identityKey,
|
|
1003
|
+
capabilities: [
|
|
1004
|
+
"composer:beta"
|
|
1005
|
+
]
|
|
1006
|
+
}
|
|
1007
|
+
}
|
|
1008
|
+
};
|
|
1009
|
+
};
|
|
49
1010
|
|
|
50
1011
|
// src/ScriptPlugin.tsx
|
|
51
|
-
import
|
|
52
|
-
import
|
|
1012
|
+
import * as Effect from "effect/Effect";
|
|
1013
|
+
import * as Option from "effect/Option";
|
|
1014
|
+
import { Plugin } from "@dxos/app-framework";
|
|
1015
|
+
import { AppActivationEvents, AppPlugin } from "@dxos/app-toolkit";
|
|
1016
|
+
import { Annotation, Ref as Ref2 } from "@dxos/echo";
|
|
53
1017
|
import { Script as Script2 } from "@dxos/functions";
|
|
54
|
-
import {
|
|
55
|
-
import {
|
|
56
|
-
import {
|
|
57
|
-
|
|
58
|
-
// src/events.ts
|
|
59
|
-
import { defineEvent } from "@dxos/app-framework";
|
|
60
|
-
(function(ScriptEvents2) {
|
|
61
|
-
ScriptEvents2.SetupCompiler = defineEvent(`${meta.id}/event/setup-compiler`);
|
|
62
|
-
})(ScriptEvents || (ScriptEvents = {}));
|
|
63
|
-
var ScriptEvents;
|
|
1018
|
+
import { Operation as Operation2 } from "@dxos/operation";
|
|
1019
|
+
import { SpaceOperation } from "@dxos/plugin-space/operations";
|
|
1020
|
+
import { meta as meta8 } from "#meta";
|
|
64
1021
|
|
|
65
1022
|
// src/translations.ts
|
|
66
1023
|
import { Script } from "@dxos/functions";
|
|
1024
|
+
import { meta as meta7 } from "#meta";
|
|
1025
|
+
import { Notebook } from "#types";
|
|
67
1026
|
var translations = [
|
|
68
1027
|
{
|
|
69
1028
|
"en-US": {
|
|
70
1029
|
[Script.Script.typename]: {
|
|
71
|
-
"typename
|
|
72
|
-
"typename
|
|
73
|
-
"typename
|
|
74
|
-
"typename
|
|
75
|
-
"object
|
|
76
|
-
"
|
|
77
|
-
"
|
|
1030
|
+
"typename.label": "Script",
|
|
1031
|
+
"typename.label_zero": "Scripts",
|
|
1032
|
+
"typename.label_one": "Script",
|
|
1033
|
+
"typename.label_other": "Scripts",
|
|
1034
|
+
"object-name.placeholder": "New script",
|
|
1035
|
+
"add-object.label": "Add script",
|
|
1036
|
+
"rename-object.label": "Rename script",
|
|
1037
|
+
"delete-object.label": "Delete script",
|
|
1038
|
+
"object-deleted.label": "Script deleted"
|
|
78
1039
|
},
|
|
79
|
-
[
|
|
80
|
-
"typename
|
|
81
|
-
"typename
|
|
82
|
-
"typename
|
|
83
|
-
"typename
|
|
84
|
-
"object
|
|
85
|
-
"
|
|
86
|
-
"
|
|
1040
|
+
[Notebook.Notebook.typename]: {
|
|
1041
|
+
"typename.label": "Notebook",
|
|
1042
|
+
"typename.label_zero": "Notebooks",
|
|
1043
|
+
"typename.label_one": "Notebook",
|
|
1044
|
+
"typename.label_other": "Notebooks",
|
|
1045
|
+
"object-name.placeholder": "New notebook",
|
|
1046
|
+
"add-object.label": "Add notebook",
|
|
1047
|
+
"rename-object.label": "Rename notebook",
|
|
1048
|
+
"delete-object.label": "Delete notebook",
|
|
1049
|
+
"object-deleted.label": "Notebook deleted"
|
|
87
1050
|
},
|
|
88
|
-
[
|
|
89
|
-
"plugin
|
|
90
|
-
"settings
|
|
91
|
-
"description
|
|
92
|
-
"description
|
|
93
|
-
"binding
|
|
94
|
-
"function
|
|
95
|
-
"deploy
|
|
96
|
-
"deployed
|
|
97
|
-
"upload
|
|
98
|
-
"copy
|
|
99
|
-
"format
|
|
100
|
-
"toggle
|
|
101
|
-
"authenticate
|
|
102
|
-
"authenticate
|
|
103
|
-
"
|
|
104
|
-
"
|
|
105
|
-
"function
|
|
106
|
-
"function
|
|
107
|
-
"function
|
|
108
|
-
"
|
|
109
|
-
"script
|
|
110
|
-
"
|
|
111
|
-
"
|
|
112
|
-
"
|
|
113
|
-
"
|
|
114
|
-
"
|
|
115
|
-
"blueprint
|
|
116
|
-
"blueprint
|
|
117
|
-
"blueprint
|
|
118
|
-
"
|
|
119
|
-
"
|
|
120
|
-
"
|
|
121
|
-
"
|
|
122
|
-
"
|
|
123
|
-
"
|
|
124
|
-
"settings
|
|
125
|
-
"
|
|
126
|
-
"
|
|
127
|
-
"
|
|
128
|
-
"
|
|
129
|
-
"
|
|
130
|
-
"
|
|
131
|
-
"deployment
|
|
132
|
-
"deployment
|
|
133
|
-
"deployment
|
|
134
|
-
"deployment
|
|
135
|
-
"
|
|
136
|
-
"
|
|
137
|
-
"
|
|
138
|
-
"script
|
|
139
|
-
"script
|
|
140
|
-
"script
|
|
141
|
-
"script
|
|
142
|
-
"script
|
|
143
|
-
"script
|
|
144
|
-
"script
|
|
145
|
-
"script
|
|
146
|
-
"script
|
|
147
|
-
"
|
|
148
|
-
"
|
|
149
|
-
"
|
|
150
|
-
"notebook
|
|
151
|
-
"notebook
|
|
152
|
-
"notebook
|
|
153
|
-
"notebook
|
|
154
|
-
"notebook
|
|
155
|
-
"notebook
|
|
156
|
-
"notebook
|
|
1051
|
+
[meta7.id]: {
|
|
1052
|
+
"plugin.name": "Scripts",
|
|
1053
|
+
"settings.title": "Scripts settings",
|
|
1054
|
+
"description.label": "Description",
|
|
1055
|
+
"description.placeholder": "Enter description",
|
|
1056
|
+
"binding.placeholder": "Function name",
|
|
1057
|
+
"function-request.placeholder": "Function request",
|
|
1058
|
+
"deploy.label": "Deploy",
|
|
1059
|
+
"deployed.label": "Current version of the script is deployed",
|
|
1060
|
+
"upload-failed.label": "Upload failed",
|
|
1061
|
+
"copy-link.label": "Copy function link",
|
|
1062
|
+
"format.label": "Format",
|
|
1063
|
+
"toggle-details.label": "Toggle details panel",
|
|
1064
|
+
"authenticate-action.label": "Authenticate functions service",
|
|
1065
|
+
"authenticate-action.description": "Sign in to the remote functions service to enable script deployment and execution.",
|
|
1066
|
+
"authenticate-button.label": "Authenticate",
|
|
1067
|
+
"name.label": "Name",
|
|
1068
|
+
"remote-function-settings.heading": "Remote Function",
|
|
1069
|
+
"function-url.label": "Invocation URL",
|
|
1070
|
+
"function-binding.label": "Function binding",
|
|
1071
|
+
"function-binding.placeholder": "Enter binding name (e.g., NAME)",
|
|
1072
|
+
"script-publish-settings.label": "Publishing",
|
|
1073
|
+
"script-publish-settings.description": "Scripts can be shared publicly as Github gists.",
|
|
1074
|
+
"no-github-token.label": "This space has no GitHub access token available.",
|
|
1075
|
+
"open-token-manager.label": "Open Token Manager",
|
|
1076
|
+
"publish.label": "Publish",
|
|
1077
|
+
"publishing.label": "Publishing",
|
|
1078
|
+
"blueprint-editor.label": "Blueprint",
|
|
1079
|
+
"blueprint-editor.description": "Create a blueprint that exposes this script as a tool.",
|
|
1080
|
+
"blueprint-instructions.label": "Instructions",
|
|
1081
|
+
"blueprint-instructions.placeholder": "Describe how this tool should be used.",
|
|
1082
|
+
"create-blueprint.label": "Create blueprint",
|
|
1083
|
+
"creating.label": "Creating\u2026",
|
|
1084
|
+
"editor-input-mode.label": "Editor input mode",
|
|
1085
|
+
"editor-input-mode.description": "Choose the keybinding style for the script editor.",
|
|
1086
|
+
"select-editor-input-mode.placeholder": "Select editor input mode\u2026",
|
|
1087
|
+
"settings.editor-input-mode.default.label": "Default",
|
|
1088
|
+
"settings.editor-input-mode.vim.label": "Vim",
|
|
1089
|
+
"settings.editor-input-mode.vscode.label": "VS Code",
|
|
1090
|
+
"function-panel.label": "Debug Function",
|
|
1091
|
+
"script-test.label": "Test",
|
|
1092
|
+
"script-logs.label": "Logs",
|
|
1093
|
+
"compute.label": "Compute",
|
|
1094
|
+
"deployment-dialog.title": "Default Scripts",
|
|
1095
|
+
"deployment-dialog-scripts-found.message": "Script templates:",
|
|
1096
|
+
"deployment-dialog-deploy-functions-button.label_one": "Create and deploy script",
|
|
1097
|
+
"deployment-dialog-deploy-functions-button.label_other": "Create and deploy scripts",
|
|
1098
|
+
"deployment-dialog-deploy-functions-pending-button.label_one": "Deploying script",
|
|
1099
|
+
"deployment-dialog-deploy-functions-pending-button.label_other": "Deploying scripts",
|
|
1100
|
+
"deployment-dialog-skip-button.label": "Skip",
|
|
1101
|
+
"script-deployment-toast.label_one": "Script deployed",
|
|
1102
|
+
"script-deployment-toast.label_other": "Scripts deployed",
|
|
1103
|
+
"script-deployment-toast.description_one": "Your script has been deployed successfully.",
|
|
1104
|
+
"script-deployment-toast.description_other": "Your scripts have been deployed successfully.",
|
|
1105
|
+
"script-deployment-toast-close.label_one": "Close",
|
|
1106
|
+
"script-deployment-toast-close.label_other": "Close",
|
|
1107
|
+
"script-deployment-error-toast.label_one": "Script deployment failed",
|
|
1108
|
+
"script-deployment-error-toast.label_other": "Scripts deployment failed",
|
|
1109
|
+
"script-deployment-error-toast.description_one": "There was an error deploying your script.",
|
|
1110
|
+
"script-deployment-error-toast.description_other": "There was an error deploying your scripts.",
|
|
1111
|
+
"script-deployment-error-toast-close.label_one": "Close",
|
|
1112
|
+
"script-deployment-error-toast-close.label_other": "Close",
|
|
1113
|
+
"notebook-cell.placeholder": "Enter script",
|
|
1114
|
+
"notebook-cell-delete.label": "Delete cell",
|
|
1115
|
+
"notebook-cell-prompt-run.label": "Run",
|
|
1116
|
+
"notebook-cell-insert-markdown.label": "Insert Markdown",
|
|
1117
|
+
"notebook-cell-insert-script.label": "Insert Script",
|
|
1118
|
+
"notebook-cell-insert-prompt.label": "Insert Prompt",
|
|
1119
|
+
"notebook-cell-insert-query.label": "Insert Query",
|
|
1120
|
+
"notebook-markdown.placeholder": "Enter Markdown",
|
|
1121
|
+
"notebook-prompt.placeholder": "Enter prompt",
|
|
1122
|
+
"notebook-cell-insert.label": "Insert cell"
|
|
157
1123
|
}
|
|
158
1124
|
}
|
|
159
1125
|
}
|
|
160
1126
|
];
|
|
161
1127
|
|
|
162
1128
|
// src/ScriptPlugin.tsx
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
})
|
|
230
|
-
}))
|
|
231
|
-
}),
|
|
232
|
-
defineModule({
|
|
233
|
-
id: `${meta.id}/module/react-surface`,
|
|
234
|
-
activatesOn: Events.SetupReactSurface,
|
|
235
|
-
// TODO(wittjosiah): Should occur before the script editor is loaded when surfaces activation is more granular.
|
|
236
|
-
activatesBefore: [
|
|
237
|
-
ScriptEvents.SetupCompiler
|
|
238
|
-
],
|
|
239
|
-
activate: ReactSurface
|
|
240
|
-
}),
|
|
241
|
-
defineModule({
|
|
242
|
-
id: `${meta.id}/module/intent-resolver`,
|
|
243
|
-
activatesOn: Events.SetupIntentResolver,
|
|
244
|
-
activate: IntentResolver
|
|
245
|
-
}),
|
|
246
|
-
defineModule({
|
|
247
|
-
id: `${meta.id}/module/blueprint`,
|
|
248
|
-
activatesOn: Events.SetupArtifactDefinition,
|
|
249
|
-
activate: BlueprintDefinition
|
|
250
|
-
})
|
|
251
|
-
]);
|
|
1129
|
+
import { ScriptEvents as ScriptEvents2 } from "#types";
|
|
1130
|
+
import { Notebook as Notebook2 } from "#types";
|
|
1131
|
+
import { ScriptOperation } from "#operations";
|
|
1132
|
+
import { AppGraphBuilder, BlueprintDefinition, Compiler as Compiler2, OperationHandler, ReactSurface, ScriptSettings } from "#capabilities";
|
|
1133
|
+
var ScriptPlugin = Plugin.define(meta8).pipe(AppPlugin.addAppGraphModule({
|
|
1134
|
+
activate: AppGraphBuilder
|
|
1135
|
+
}), AppPlugin.addBlueprintDefinitionModule({
|
|
1136
|
+
activate: BlueprintDefinition
|
|
1137
|
+
}), AppPlugin.addMetadataModule({
|
|
1138
|
+
metadata: [
|
|
1139
|
+
{
|
|
1140
|
+
id: Script2.Script.typename,
|
|
1141
|
+
metadata: {
|
|
1142
|
+
icon: Annotation.IconAnnotation.get(Script2.Script).pipe(Option.getOrThrow).icon,
|
|
1143
|
+
iconHue: Annotation.IconAnnotation.get(Script2.Script).pipe(Option.getOrThrow).hue ?? "white",
|
|
1144
|
+
// TODO(wittjosiah): Move out of metadata.
|
|
1145
|
+
loadReferences: async (script) => await Ref2.Array.loadAll([
|
|
1146
|
+
script.source
|
|
1147
|
+
]),
|
|
1148
|
+
inputSchema: ScriptOperation.ScriptProps,
|
|
1149
|
+
createObject: (props, options) => Effect.gen(function* () {
|
|
1150
|
+
const { object } = yield* Operation2.invoke(ScriptOperation.CreateScript, props);
|
|
1151
|
+
return yield* Operation2.invoke(SpaceOperation.AddObject, {
|
|
1152
|
+
object,
|
|
1153
|
+
target: options.target,
|
|
1154
|
+
hidden: true,
|
|
1155
|
+
targetNodeId: options.targetNodeId
|
|
1156
|
+
});
|
|
1157
|
+
})
|
|
1158
|
+
}
|
|
1159
|
+
},
|
|
1160
|
+
{
|
|
1161
|
+
id: Notebook2.Notebook.typename,
|
|
1162
|
+
metadata: {
|
|
1163
|
+
icon: Annotation.IconAnnotation.get(Notebook2.Notebook).pipe(Option.getOrThrow).icon,
|
|
1164
|
+
iconHue: Annotation.IconAnnotation.get(Notebook2.Notebook).pipe(Option.getOrThrow).hue ?? "white",
|
|
1165
|
+
inputSchema: ScriptOperation.NotebookProps,
|
|
1166
|
+
createObject: (props, options) => Effect.gen(function* () {
|
|
1167
|
+
const object = Notebook2.make(props);
|
|
1168
|
+
return yield* Operation2.invoke(SpaceOperation.AddObject, {
|
|
1169
|
+
object,
|
|
1170
|
+
target: options.target,
|
|
1171
|
+
hidden: true,
|
|
1172
|
+
targetNodeId: options.targetNodeId
|
|
1173
|
+
});
|
|
1174
|
+
})
|
|
1175
|
+
}
|
|
1176
|
+
}
|
|
1177
|
+
]
|
|
1178
|
+
}), AppPlugin.addOperationHandlerModule({
|
|
1179
|
+
activate: OperationHandler
|
|
1180
|
+
}), AppPlugin.addSchemaModule({
|
|
1181
|
+
schema: [
|
|
1182
|
+
Script2.Script
|
|
1183
|
+
]
|
|
1184
|
+
}), AppPlugin.addSurfaceModule({
|
|
1185
|
+
activate: ReactSurface
|
|
1186
|
+
}), AppPlugin.addTranslationsModule({
|
|
1187
|
+
translations
|
|
1188
|
+
}), Plugin.addModule({
|
|
1189
|
+
activatesOn: AppActivationEvents.SetupSettings,
|
|
1190
|
+
activate: ScriptSettings
|
|
1191
|
+
}), Plugin.addModule({
|
|
1192
|
+
activatesOn: ScriptEvents2.SetupCompiler,
|
|
1193
|
+
activate: Compiler2
|
|
1194
|
+
}), Plugin.make);
|
|
252
1195
|
export {
|
|
253
|
-
DEPLOYMENT_DIALOG,
|
|
254
1196
|
DeploymentDialog,
|
|
1197
|
+
FramePanel,
|
|
255
1198
|
NotebookContainer,
|
|
256
1199
|
NotebookMenu,
|
|
257
1200
|
NotebookStack,
|
|
1201
|
+
QueryEditor2 as QueryEditor,
|
|
258
1202
|
ScriptCapabilities,
|
|
259
1203
|
ScriptContainer,
|
|
1204
|
+
ScriptEvents,
|
|
260
1205
|
ScriptObjectSettings,
|
|
261
1206
|
ScriptPlugin,
|
|
262
1207
|
ScriptPluginSettings,
|
|
263
1208
|
ScriptProperties,
|
|
1209
|
+
ScriptToolbar,
|
|
264
1210
|
TestContainer,
|
|
265
1211
|
TestPanel,
|
|
1212
|
+
TypescriptEditor,
|
|
266
1213
|
defaultScriptsForIntegration,
|
|
267
1214
|
deployScript,
|
|
268
1215
|
getAccessCredential,
|
|
269
1216
|
getFunctionUrl,
|
|
270
1217
|
isScriptDeployed,
|
|
271
|
-
meta,
|
|
1218
|
+
meta6 as meta,
|
|
272
1219
|
updateFunctionMetadata
|
|
273
1220
|
};
|
|
274
1221
|
//# sourceMappingURL=index.mjs.map
|