@dxos/plugin-script 0.8.4-main.bc674ce → 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-NBAXYESH.mjs → NotebookContainer-TGHMYWWK.mjs} +47 -54
- 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 +53 -3
- package/dist/lib/browser/blueprints/index.mjs.map +4 -4
- package/dist/lib/browser/chunk-AE5EX2VP.mjs +78 -0
- package/dist/lib/browser/chunk-AE5EX2VP.mjs.map +7 -0
- package/dist/lib/browser/{chunk-UX4GHJ5E.mjs → chunk-DL37UOJE.mjs} +29 -29
- 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 +1153 -176
- 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 +3 -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-IUAYVJSD.mjs → NotebookContainer-YUVZF6IS.mjs} +47 -54
- 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 +53 -3
- package/dist/lib/node-esm/blueprints/index.mjs.map +4 -4
- 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-4F5FJZ36.mjs → chunk-ZLTGO4XB.mjs} +29 -29
- 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 +1153 -176
- 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 +3 -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.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 +1 -1
- package/dist/types/src/blueprints/index.d.ts.map +1 -1
- package/dist/types/src/blueprints/script-blueprint.d.ts +3 -21
- package/dist/types/src/blueprints/script-blueprint.d.ts.map +1 -1
- package/dist/types/src/capabilities/app-graph-builder.d.ts +6 -0
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -0
- package/dist/types/src/capabilities/{artifact-definition/artifact-definition.d.ts → artifact-definition.d.ts} +1 -1
- package/dist/types/src/capabilities/artifact-definition.d.ts.map +1 -0
- package/dist/types/src/capabilities/blueprint-definition.d.ts +6 -0
- package/dist/types/src/capabilities/blueprint-definition.d.ts.map +1 -0
- package/dist/types/src/capabilities/compiler.d.ts +6 -0
- package/dist/types/src/capabilities/compiler.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +12 -6
- 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 +5 -0
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -0
- package/dist/types/src/capabilities/settings.d.ts +10 -0
- package/dist/types/src/capabilities/settings.d.ts.map +1 -0
- 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 +1 -1
- 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 +8 -2
- package/dist/types/src/components/NotebookStack/NotebookStack.d.ts.map +1 -1
- package/dist/types/src/components/NotebookStack/NotebookStack.stories.d.ts +240 -228
- package/dist/types/src/components/NotebookStack/NotebookStack.stories.d.ts.map +1 -1
- package/dist/types/src/components/QueryEditor/QueryEditor.stories.d.ts.map +1 -1
- 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 +10 -4
- package/dist/types/src/components/ScriptToolbar/ScriptToolbar.d.ts.map +1 -1
- package/dist/types/src/components/ScriptToolbar/ScriptToolbar.stories.d.ts +240 -228
- 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 +7 -1
- 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 +0 -2
- 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/{components → containers}/DeploymentDialog/DeploymentDialog.stories.d.ts.map +1 -1
- 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.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/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/hooks/deploy.d.ts +19 -5
- package/dist/types/src/hooks/deploy.d.ts.map +1 -1
- package/dist/types/src/hooks/format.d.ts +1 -0
- package/dist/types/src/hooks/format.d.ts.map +1 -1
- package/dist/types/src/hooks/template.d.ts +1 -0
- package/dist/types/src/hooks/template.d.ts.map +1 -1
- package/dist/types/src/hooks/useToolbarState.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +1 -0
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/notebook/compute-graph.d.ts +1 -1
- 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 +4 -5
- package/dist/types/src/templates/anthropic.d.ts.map +1 -1
- package/dist/types/src/templates/chess-bot.d.ts +4 -2
- package/dist/types/src/templates/chess-bot.d.ts.map +1 -1
- package/dist/types/src/templates/commentary.d.ts +5 -2
- package/dist/types/src/templates/commentary.d.ts.map +1 -1
- package/dist/types/src/templates/forex-effect.d.ts +3 -2
- package/dist/types/src/templates/forex-effect.d.ts.map +1 -1
- package/dist/types/src/templates/forex.d.ts +3 -2
- package/dist/types/src/templates/forex.d.ts.map +1 -1
- package/dist/types/src/templates/index.d.ts +18 -18
- package/dist/types/src/templates/ping.d.ts +2 -1
- 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/translations.d.ts +91 -86
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/Notebook.d.ts +29 -13
- 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.map +1 -1
- package/dist/types/src/types/index.d.ts +0 -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 +107 -85
- package/src/ScriptPlugin.tsx +49 -32
- 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 +1 -1
- package/src/blueprints/script-blueprint.ts +40 -8
- package/src/capabilities/app-graph-builder.ts +47 -0
- package/src/capabilities/{artifact-definition/artifact-definition.ts → artifact-definition.ts} +1 -1
- package/src/capabilities/blueprint-definition.ts +17 -0
- package/src/capabilities/{compiler/compiler.ts → compiler.ts} +2 -2
- package/src/capabilities/index.ts +12 -6
- package/src/capabilities/operation-handler.ts +20 -0
- package/src/capabilities/react-surface.tsx +152 -0
- package/src/capabilities/{settings/settings.ts → settings.ts} +7 -6
- package/src/components/{FrameContainer/FrameContainer.tsx → FramePanel/FramePanel.tsx} +4 -5
- package/src/components/{FrameContainer → FramePanel}/index.ts +1 -1
- package/src/components/NotebookStack/NotebookCell.tsx +15 -17
- package/src/components/NotebookStack/NotebookMenu.tsx +7 -7
- package/src/components/NotebookStack/NotebookStack.stories.tsx +6 -8
- package/src/components/NotebookStack/NotebookStack.tsx +26 -15
- package/src/components/QueryEditor/QueryEditor.stories.tsx +17 -21
- 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 +6 -7
- package/src/components/ScriptToolbar/ScriptToolbar.tsx +23 -25
- package/src/components/TestPanel/TestPanel.tsx +107 -187
- package/src/components/TestPanel/index.ts +0 -1
- package/src/components/TypescriptEditor/TypescriptEditor.stories.tsx +16 -14
- package/src/components/TypescriptEditor/TypescriptEditor.tsx +24 -17
- package/src/components/index.ts +7 -8
- package/src/constants.ts +7 -0
- package/src/{components → containers}/DeploymentDialog/DeploymentDialog.stories.tsx +7 -6
- package/src/{components → containers}/DeploymentDialog/DeploymentDialog.tsx +32 -37
- package/src/containers/DeploymentDialog/index.ts +7 -0
- package/src/{components → containers/NotebookContainer}/NotebookContainer.stories.tsx +16 -19
- package/src/{components → containers/NotebookContainer}/NotebookContainer.tsx +54 -57
- package/src/containers/NotebookContainer/index.ts +7 -0
- package/src/{components → containers/ScriptContainer}/ScriptContainer.tsx +27 -26
- package/src/containers/ScriptContainer/index.ts +7 -0
- package/src/{components/Settings → containers/ScriptObjectSettings}/ScriptObjectSettings.tsx +51 -65
- 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 +6 -5
- package/src/e2e/deploy.test.ts +4 -3
- package/src/hooks/deploy.ts +14 -13
- package/src/hooks/format.ts +5 -4
- package/src/hooks/template.ts +7 -7
- package/src/hooks/useCompiler.ts +3 -3
- package/src/hooks/useCreateAndDeployScriptTemplates.ts +3 -3
- package/src/hooks/useToolbarState.ts +7 -6
- package/src/index.ts +1 -0
- package/src/meta.ts +2 -2
- package/src/notebook/compute-graph.test.ts +7 -7
- package/src/notebook/compute-graph.ts +1 -1
- 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 +19 -12
- package/src/templates/chat.ts +1 -1
- package/src/templates/chess-bot.ts +37 -34
- package/src/templates/commentary.ts +173 -161
- package/src/templates/data-generator.ts +1 -1
- package/src/templates/discord.ts +3 -3
- package/src/templates/forex-effect.ts +30 -19
- package/src/templates/forex.ts +24 -15
- package/src/templates/gmail.ts +4 -4
- package/src/templates/index.ts +18 -18
- package/src/templates/ping.ts +16 -8
- package/src/testing/data.ts +1 -1
- package/src/translations.ts +92 -86
- package/src/types/Notebook.ts +9 -5
- package/src/types/Settings.ts +17 -0
- package/src/types/capabilities.ts +4 -4
- package/src/types/events.ts +2 -2
- package/src/types/index.ts +0 -1
- package/src/types/types.ts +1 -11
- package/src/util/deploy.ts +13 -11
- package/src/util/functions.ts +9 -8
- package/dist/lib/browser/DeploymentDialog-OSL6RMPA.mjs +0 -14
- package/dist/lib/browser/DeploymentDialog-OSL6RMPA.mjs.map +0 -7
- package/dist/lib/browser/NotebookContainer-NBAXYESH.mjs.map +0 -7
- package/dist/lib/browser/ScriptContainer-WD33CJMI.mjs +0 -149
- package/dist/lib/browser/ScriptContainer-WD33CJMI.mjs.map +0 -7
- package/dist/lib/browser/app-graph-builder-7VO7AUI6.mjs +0 -68
- package/dist/lib/browser/app-graph-builder-7VO7AUI6.mjs.map +0 -7
- package/dist/lib/browser/blueprint-definition-OSOUYI7A.mjs +0 -17
- package/dist/lib/browser/blueprint-definition-OSOUYI7A.mjs.map +0 -7
- package/dist/lib/browser/chunk-BTWHM6FH.mjs +0 -270
- package/dist/lib/browser/chunk-BTWHM6FH.mjs.map +0 -7
- package/dist/lib/browser/chunk-C53UJGSU.mjs +0 -557
- package/dist/lib/browser/chunk-C53UJGSU.mjs.map +0 -7
- package/dist/lib/browser/chunk-F3QKSKSF.mjs +0 -35
- package/dist/lib/browser/chunk-F3QKSKSF.mjs.map +0 -7
- package/dist/lib/browser/chunk-I7CSE6T3.mjs +0 -110
- package/dist/lib/browser/chunk-I7CSE6T3.mjs.map +0 -7
- package/dist/lib/browser/chunk-TWX2NMZN.mjs +0 -137
- package/dist/lib/browser/chunk-TWX2NMZN.mjs.map +0 -7
- package/dist/lib/browser/chunk-UUR4JNNB.mjs +0 -113
- package/dist/lib/browser/chunk-UUR4JNNB.mjs.map +0 -7
- package/dist/lib/browser/chunk-UX4GHJ5E.mjs.map +0 -7
- package/dist/lib/browser/chunk-WYR4QHPE.mjs +0 -31
- package/dist/lib/browser/chunk-WYR4QHPE.mjs.map +0 -7
- package/dist/lib/browser/chunk-XCN4D3Z5.mjs +0 -606
- package/dist/lib/browser/chunk-XCN4D3Z5.mjs.map +0 -7
- package/dist/lib/browser/compiler-76F3QAXC.mjs +0 -161
- package/dist/lib/browser/compiler-76F3QAXC.mjs.map +0 -7
- package/dist/lib/browser/operation-resolver-HUILPPKT.mjs +0 -82
- package/dist/lib/browser/operation-resolver-HUILPPKT.mjs.map +0 -7
- package/dist/lib/browser/react-surface-O6GKHB2J.mjs +0 -139
- package/dist/lib/browser/react-surface-O6GKHB2J.mjs.map +0 -7
- package/dist/lib/browser/settings-3ENI25PI.mjs +0 -35
- package/dist/lib/browser/settings-3ENI25PI.mjs.map +0 -7
- package/dist/lib/node-esm/DeploymentDialog-OGBJPVIX.mjs +0 -15
- package/dist/lib/node-esm/DeploymentDialog-OGBJPVIX.mjs.map +0 -7
- package/dist/lib/node-esm/NotebookContainer-IUAYVJSD.mjs.map +0 -7
- package/dist/lib/node-esm/ScriptContainer-K7JCEU5Z.mjs +0 -150
- package/dist/lib/node-esm/ScriptContainer-K7JCEU5Z.mjs.map +0 -7
- package/dist/lib/node-esm/app-graph-builder-NVE3EVBG.mjs +0 -69
- package/dist/lib/node-esm/app-graph-builder-NVE3EVBG.mjs.map +0 -7
- package/dist/lib/node-esm/blueprint-definition-NC7NNJGI.mjs +0 -18
- package/dist/lib/node-esm/blueprint-definition-NC7NNJGI.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-4F5FJZ36.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-4QNZMXW6.mjs +0 -607
- package/dist/lib/node-esm/chunk-4QNZMXW6.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-5HSJPAK7.mjs +0 -33
- package/dist/lib/node-esm/chunk-5HSJPAK7.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-BX5PP6AW.mjs +0 -558
- package/dist/lib/node-esm/chunk-BX5PP6AW.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-G3J76DWP.mjs +0 -114
- package/dist/lib/node-esm/chunk-G3J76DWP.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-SLU3KRV3.mjs +0 -112
- package/dist/lib/node-esm/chunk-SLU3KRV3.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-VQPIA4VF.mjs +0 -138
- package/dist/lib/node-esm/chunk-VQPIA4VF.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-VWOLKNMO.mjs +0 -271
- package/dist/lib/node-esm/chunk-VWOLKNMO.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-Y3G5NCTP.mjs +0 -36
- package/dist/lib/node-esm/chunk-Y3G5NCTP.mjs.map +0 -7
- package/dist/lib/node-esm/compiler-FNZH6TFN.mjs +0 -162
- package/dist/lib/node-esm/compiler-FNZH6TFN.mjs.map +0 -7
- package/dist/lib/node-esm/operation-resolver-JTCIY6HU.mjs +0 -83
- package/dist/lib/node-esm/operation-resolver-JTCIY6HU.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-RLANMVMB.mjs +0 -140
- package/dist/lib/node-esm/react-surface-RLANMVMB.mjs.map +0 -7
- package/dist/lib/node-esm/settings-7AYC5VXN.mjs +0 -36
- package/dist/lib/node-esm/settings-7AYC5VXN.mjs.map +0 -7
- package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts +0 -6
- package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts.map +0 -1
- package/dist/types/src/capabilities/app-graph-builder/index.d.ts +0 -3
- package/dist/types/src/capabilities/app-graph-builder/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/artifact-definition/artifact-definition.d.ts.map +0 -1
- package/dist/types/src/capabilities/artifact-definition/index.d.ts +0 -3
- package/dist/types/src/capabilities/artifact-definition/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/blueprint-definition/blueprint-definition.d.ts +0 -9
- package/dist/types/src/capabilities/blueprint-definition/blueprint-definition.d.ts.map +0 -1
- package/dist/types/src/capabilities/blueprint-definition/index.d.ts +0 -3
- package/dist/types/src/capabilities/blueprint-definition/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/compiler/compiler.d.ts +0 -6
- package/dist/types/src/capabilities/compiler/compiler.d.ts.map +0 -1
- package/dist/types/src/capabilities/compiler/index.d.ts +0 -3
- package/dist/types/src/capabilities/compiler/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/operation-resolver/index.d.ts +0 -3
- package/dist/types/src/capabilities/operation-resolver/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts +0 -5
- package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts.map +0 -1
- package/dist/types/src/capabilities/react-surface/index.d.ts +0 -3
- package/dist/types/src/capabilities/react-surface/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts +0 -5
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +0 -1
- package/dist/types/src/capabilities/settings/index.d.ts +0 -7
- package/dist/types/src/capabilities/settings/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/settings/settings.d.ts +0 -9
- package/dist/types/src/capabilities/settings/settings.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 -249
- 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 -8
- package/dist/types/src/components/NotebookContainer.d.ts.map +0 -1
- package/dist/types/src/components/NotebookContainer.stories.d.ts.map +0 -1
- package/dist/types/src/components/ScriptContainer.d.ts +0 -11
- 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 -8
- 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/types/actions.d.ts +0 -40
- package/dist/types/src/types/actions.d.ts.map +0 -1
- package/src/capabilities/app-graph-builder/app-graph-builder.ts +0 -55
- package/src/capabilities/app-graph-builder/index.ts +0 -7
- package/src/capabilities/artifact-definition/index.ts +0 -7
- package/src/capabilities/blueprint-definition/blueprint-definition.ts +0 -23
- package/src/capabilities/blueprint-definition/index.ts +0 -7
- package/src/capabilities/compiler/index.ts +0 -7
- package/src/capabilities/operation-resolver/index.ts +0 -7
- package/src/capabilities/operation-resolver/operation-resolver.ts +0 -74
- package/src/capabilities/react-surface/index.ts +0 -7
- package/src/capabilities/react-surface/react-surface.tsx +0 -118
- package/src/capabilities/settings/index.ts +0 -7
- 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/Settings/ScriptPluginSettings.tsx +0 -66
- package/src/components/Settings/index.ts +0 -6
- package/src/components/TestPanel/TestContainer.tsx +0 -27
- package/src/types/actions.ts +0 -45
- /package/dist/types/src/{components → containers/NotebookContainer}/NotebookContainer.stories.d.ts +0 -0
- /package/dist/types/src/{components/TestPanel → containers/TestContainer}/TestContainer.d.ts +0 -0
|
@@ -2,16 +2,16 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import React, { forwardRef,
|
|
5
|
+
import React, { forwardRef, useRef, useState } from 'react';
|
|
6
6
|
|
|
7
7
|
import { log } from '@dxos/log';
|
|
8
|
-
import { Avatar, Icon, Input, type ThemedClassName, Toolbar, useTranslation } from '@dxos/react-ui';
|
|
8
|
+
import { Avatar, Icon, Input, ScrollArea, type ThemedClassName, Toolbar, useTranslation } from '@dxos/react-ui';
|
|
9
9
|
import { SyntaxHighlighter } from '@dxos/react-ui-syntax-highlighter';
|
|
10
|
-
import {
|
|
10
|
+
import { composable, composableProps, mx } from '@dxos/ui-theme';
|
|
11
11
|
|
|
12
|
-
import { meta } from '
|
|
12
|
+
import { meta } from '#meta';
|
|
13
13
|
|
|
14
|
-
type State = 'pending'
|
|
14
|
+
type State = 'pending';
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
17
|
* Request or response.
|
|
@@ -24,237 +24,157 @@ type Message = {
|
|
|
24
24
|
};
|
|
25
25
|
|
|
26
26
|
export type TestPanelProps = ThemedClassName<{
|
|
27
|
-
|
|
27
|
+
onInvoke?: (input: unknown) => Promise<unknown>;
|
|
28
28
|
}>;
|
|
29
29
|
|
|
30
|
-
// TODO(burdon): Need persistent history (currently lost when switching tabs)
|
|
31
|
-
export const TestPanel =
|
|
32
|
-
|
|
30
|
+
// TODO(burdon): Need persistent history (currently lost when switching tabs).
|
|
31
|
+
export const TestPanel = composable<HTMLDivElement, TestPanelProps>(
|
|
32
|
+
({ classNames, onInvoke, ...props }, forwardedRef) => {
|
|
33
|
+
const { t } = useTranslation(meta.id);
|
|
33
34
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
const [state, setState] = useState<State | null>(null);
|
|
35
|
+
const inputRef = useRef<HTMLInputElement>(null);
|
|
36
|
+
const [input, setInput] = useState('');
|
|
37
|
+
const [state, setState] = useState<State | null>(null);
|
|
38
38
|
|
|
39
|
-
|
|
40
|
-
|
|
39
|
+
// TODO(burdon): Persistent history (thread).
|
|
40
|
+
const [history, setHistory] = useState<Message[]>([]);
|
|
41
41
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
const controller = useRef<AbortController>(null);
|
|
50
|
-
useEffect(() => {
|
|
51
|
-
return () => {
|
|
52
|
-
handleStop();
|
|
42
|
+
const scrollerRef = useRef<HTMLDivElement>(null);
|
|
43
|
+
const handleScroll = () => {
|
|
44
|
+
if (scrollerRef.current) {
|
|
45
|
+
scrollerRef.current.scrollTop = scrollerRef.current.scrollHeight;
|
|
46
|
+
}
|
|
53
47
|
};
|
|
54
|
-
}, []);
|
|
55
48
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
const handleClear = () => {
|
|
62
|
-
handleStop();
|
|
63
|
-
setInput('');
|
|
64
|
-
setResult('');
|
|
65
|
-
setHistory([]);
|
|
66
|
-
inputRef.current?.focus();
|
|
67
|
-
};
|
|
49
|
+
const handleClear = () => {
|
|
50
|
+
setInput('');
|
|
51
|
+
setHistory([]);
|
|
52
|
+
inputRef.current?.focus();
|
|
53
|
+
};
|
|
68
54
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
handleScroll();
|
|
83
|
-
};
|
|
55
|
+
const handleResponse = ({
|
|
56
|
+
text,
|
|
57
|
+
data,
|
|
58
|
+
error,
|
|
59
|
+
}: {
|
|
60
|
+
text?: string;
|
|
61
|
+
data?: any;
|
|
62
|
+
error?: Error;
|
|
63
|
+
} = {}) => {
|
|
64
|
+
setHistory((history) => [...history, { type: 'response', text, data, error } satisfies Message]);
|
|
65
|
+
setState(null);
|
|
66
|
+
handleScroll();
|
|
67
|
+
};
|
|
84
68
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
69
|
+
const handleRequest = async (input: string) => {
|
|
70
|
+
if (!onInvoke) {
|
|
71
|
+
handleResponse({ error: new Error('Function not deployed') });
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
89
74
|
|
|
90
|
-
let data =
|
|
91
|
-
|
|
75
|
+
let data: unknown = input;
|
|
76
|
+
let displayText = input;
|
|
92
77
|
if (input.charAt(0) === '{') {
|
|
93
78
|
try {
|
|
94
79
|
const validJsonString = input.replace(/'/g, '"').replace(/([{,]\s*)([a-zA-Z0-9_]+)(\s*:)/g, '$1"$2"$3');
|
|
95
80
|
data = JSON.parse(validJsonString);
|
|
96
|
-
|
|
81
|
+
displayText = JSON.stringify(data, null, 2);
|
|
97
82
|
} catch (err) {
|
|
98
|
-
|
|
83
|
+
handleResponse({ error: new Error('Invalid JSON input') });
|
|
99
84
|
return;
|
|
100
85
|
}
|
|
101
86
|
}
|
|
102
87
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
handleScroll
|
|
108
|
-
});
|
|
109
|
-
|
|
110
|
-
// Throws DOMException when aborted.
|
|
111
|
-
controller.current = new AbortController();
|
|
112
|
-
const response = await fetch(functionUrl!, {
|
|
113
|
-
signal: controller.current.signal,
|
|
114
|
-
method: 'POST',
|
|
115
|
-
body: input,
|
|
116
|
-
headers: {
|
|
117
|
-
'Content-Type': data ? 'application/json' : 'text/plain',
|
|
118
|
-
},
|
|
119
|
-
});
|
|
120
|
-
|
|
121
|
-
// Check for error.
|
|
122
|
-
if (!response.ok) {
|
|
123
|
-
const text = await response.text();
|
|
124
|
-
handleResponse({
|
|
125
|
-
error: new Error(text || response.statusText || String(response.status)),
|
|
126
|
-
});
|
|
127
|
-
return;
|
|
128
|
-
}
|
|
88
|
+
try {
|
|
89
|
+
setState('pending');
|
|
90
|
+
setInput('');
|
|
91
|
+
setHistory((history) => [...history, { type: 'request', text: displayText }]);
|
|
92
|
+
setTimeout(handleScroll);
|
|
129
93
|
|
|
130
|
-
|
|
131
|
-
const contentType = response.headers.get('content-type');
|
|
132
|
-
if (contentType === 'application/json') {
|
|
133
|
-
const data = await response.json();
|
|
134
|
-
handleResponse({ data });
|
|
135
|
-
return;
|
|
136
|
-
}
|
|
94
|
+
const result = await onInvoke(data);
|
|
137
95
|
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
const pump = async ({ done, value }: ReadableStreamReadResult<Uint8Array>): Promise<void> => {
|
|
143
|
-
text = text + new TextDecoder().decode(value);
|
|
144
|
-
if (!controller.current || done) {
|
|
145
|
-
handleResponse({ text });
|
|
146
|
-
return;
|
|
96
|
+
if (typeof result === 'string') {
|
|
97
|
+
handleResponse({ text: result });
|
|
98
|
+
} else {
|
|
99
|
+
handleResponse({ data: result });
|
|
147
100
|
}
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
setTimeout(() => {
|
|
151
|
-
handleScroll();
|
|
152
|
-
});
|
|
153
|
-
|
|
154
|
-
return reader.read().then(pump);
|
|
155
|
-
};
|
|
156
|
-
|
|
157
|
-
void reader
|
|
158
|
-
.read()
|
|
159
|
-
.then(pump)
|
|
160
|
-
.catch((err) => {
|
|
161
|
-
if (err.name !== 'AbortError') {
|
|
162
|
-
log.catch(err);
|
|
163
|
-
}
|
|
164
|
-
});
|
|
165
|
-
} catch (err: any) {
|
|
166
|
-
if (err !== 'stop') {
|
|
167
|
-
const error = err instanceof Error ? err : new Error(err);
|
|
101
|
+
} catch (err: any) {
|
|
102
|
+
const error = err instanceof Error ? err : new Error(String(err));
|
|
168
103
|
handleResponse({ error });
|
|
169
104
|
log.catch(err);
|
|
170
|
-
} else {
|
|
171
|
-
handleResponse();
|
|
172
105
|
}
|
|
173
|
-
}
|
|
174
|
-
};
|
|
106
|
+
};
|
|
175
107
|
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
<
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
label='Execute'
|
|
196
|
-
iconOnly
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
label={state ? 'Stop' : 'Clear'}
|
|
203
|
-
iconOnly
|
|
204
|
-
onClick={() => (state ? handleStop() : handleClear())}
|
|
205
|
-
/>
|
|
206
|
-
</Toolbar.Root>
|
|
207
|
-
</div>
|
|
208
|
-
);
|
|
209
|
-
};
|
|
108
|
+
return (
|
|
109
|
+
<div
|
|
110
|
+
{...composableProps(props, { classNames: ['flex flex-col h-full overflow-hidden', classNames] })}
|
|
111
|
+
ref={forwardedRef}
|
|
112
|
+
>
|
|
113
|
+
{/* TODO(burdon): Replace with Thread. */}
|
|
114
|
+
<MessageThread ref={scrollerRef} state={state} history={history} />
|
|
115
|
+
{/* TODO(burdon): Replace with Form based on the function's input schema. */}
|
|
116
|
+
<Toolbar.Root>
|
|
117
|
+
<Input.Root>
|
|
118
|
+
<Input.TextInput
|
|
119
|
+
ref={inputRef}
|
|
120
|
+
autoFocus
|
|
121
|
+
placeholder={t('function-request.placeholder')}
|
|
122
|
+
value={input}
|
|
123
|
+
onChange={(ev) => setInput(ev.target.value)}
|
|
124
|
+
onKeyDown={(ev) => ev.key === 'Enter' && handleRequest(input)}
|
|
125
|
+
/>
|
|
126
|
+
</Input.Root>
|
|
127
|
+
<Toolbar.IconButton icon='ph--play--regular' label='Execute' iconOnly onClick={() => handleRequest(input)} />
|
|
128
|
+
<Toolbar.IconButton icon='ph--trash--regular' label='Clear' iconOnly onClick={handleClear} />
|
|
129
|
+
</Toolbar.Root>
|
|
130
|
+
</div>
|
|
131
|
+
);
|
|
132
|
+
},
|
|
133
|
+
);
|
|
210
134
|
|
|
211
135
|
// TODO(burdon): Replace with thread?
|
|
212
136
|
// TODO(burdon): Button to edit/re-run question.
|
|
213
137
|
type MessageThreadProps = {
|
|
214
138
|
state: State | null;
|
|
215
139
|
history: Message[];
|
|
216
|
-
result: string;
|
|
217
140
|
};
|
|
218
141
|
|
|
219
142
|
const MessageThread = forwardRef<HTMLDivElement, MessageThreadProps>(
|
|
220
|
-
({ state, history
|
|
143
|
+
({ state, history }: MessageThreadProps, forwardedRef) => {
|
|
221
144
|
return (
|
|
222
|
-
<
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
<div className='
|
|
226
|
-
|
|
227
|
-
<
|
|
145
|
+
<ScrollArea.Root orientation='vertical' classNames='h-full' ref={forwardedRef}>
|
|
146
|
+
<ScrollArea.Viewport classNames='gap-6 p-2'>
|
|
147
|
+
{history.map((message, i) => (
|
|
148
|
+
<div key={i} className='grid grid-cols-[2rem_1fr_2rem]'>
|
|
149
|
+
<div className='p-1'>{message.type === 'response' && <RobotAvatar />}</div>
|
|
150
|
+
<div className='overflow-auto'>
|
|
151
|
+
<MessageItem message={message} />
|
|
152
|
+
</div>
|
|
228
153
|
</div>
|
|
229
|
-
|
|
230
|
-
))}
|
|
154
|
+
))}
|
|
231
155
|
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
)}
|
|
238
|
-
</div>
|
|
239
|
-
<div className='overflow-auto'>
|
|
240
|
-
<MessageItem message={{ type: 'response', text: result }} />
|
|
156
|
+
{state === 'pending' && (
|
|
157
|
+
<div className='grid grid-cols-[2rem_1fr_2rem]'>
|
|
158
|
+
<div className='p-1'>
|
|
159
|
+
<Icon icon='ph--spinner--regular' size={6} classNames='animate-spin' />
|
|
160
|
+
</div>
|
|
241
161
|
</div>
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
</
|
|
162
|
+
)}
|
|
163
|
+
</ScrollArea.Viewport>
|
|
164
|
+
</ScrollArea.Root>
|
|
245
165
|
);
|
|
246
166
|
},
|
|
247
167
|
);
|
|
248
168
|
|
|
249
169
|
const MessageItem = ({ classNames, message }: ThemedClassName<{ message: Message }>) => {
|
|
250
170
|
const { type, text, data, error } = message;
|
|
251
|
-
const wrapper = 'p-1
|
|
171
|
+
const wrapper = 'p-1 px-2 rounded-md bg-hover-surface overflow-auto';
|
|
252
172
|
return (
|
|
253
173
|
<div className={mx('flex', type === 'request' ? 'ml-[1rem] justify-end' : 'mr-[1rem]', classNames)}>
|
|
254
|
-
{error && <div className={mx(wrapper, 'whitespace-pre'
|
|
174
|
+
{error && <div className={mx(wrapper, 'whitespace-pre text-error-text')}>{String(error)}</div>}
|
|
255
175
|
|
|
256
176
|
{text !== undefined && (
|
|
257
|
-
<div className={mx(wrapper, type === 'request' && 'bg-primary-
|
|
177
|
+
<div className={mx(wrapper, type === 'request' && 'bg-primary-500 dark:bg-primary-600')}>
|
|
258
178
|
{text || '\u00D8'}
|
|
259
179
|
</div>
|
|
260
180
|
)}
|
|
@@ -7,9 +7,8 @@ import React, { useCallback, useMemo, useState } from 'react';
|
|
|
7
7
|
|
|
8
8
|
import { createDocAccessor } from '@dxos/echo-db';
|
|
9
9
|
import { createObject } from '@dxos/react-client/echo';
|
|
10
|
-
import { Toolbar } from '@dxos/react-ui';
|
|
10
|
+
import { Panel, Toolbar } from '@dxos/react-ui';
|
|
11
11
|
import { withLayout, withTheme } from '@dxos/react-ui/testing';
|
|
12
|
-
import { Layout } from '@dxos/react-ui-mosaic';
|
|
13
12
|
import { Json } from '@dxos/react-ui-syntax-highlighter';
|
|
14
13
|
import { createDataExtensions } from '@dxos/ui-editor';
|
|
15
14
|
import { trim } from '@dxos/util';
|
|
@@ -66,24 +65,27 @@ const DefaultStory = (props: TypescriptEditorProps) => {
|
|
|
66
65
|
}, [object]);
|
|
67
66
|
|
|
68
67
|
return (
|
|
69
|
-
<
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
<
|
|
77
|
-
|
|
78
|
-
|
|
68
|
+
<Panel.Root>
|
|
69
|
+
<Panel.Toolbar asChild>
|
|
70
|
+
<Toolbar.Root>
|
|
71
|
+
<Toolbar.Button onClick={handleRun}>Run</Toolbar.Button>
|
|
72
|
+
</Toolbar.Root>
|
|
73
|
+
</Panel.Toolbar>
|
|
74
|
+
<Panel.Content>
|
|
75
|
+
<div role='none' className='grid grid-rows-[1fr_min-content] h-full overflow-hidden text-sm'>
|
|
76
|
+
<TypescriptEditor {...props} initialValue={object.content} extensions={extensions} />
|
|
77
|
+
<Json.Data data={result} classNames='shrink-0 p-2 border-y border-subdued-separator' />
|
|
78
|
+
</div>
|
|
79
|
+
</Panel.Content>
|
|
80
|
+
</Panel.Root>
|
|
79
81
|
);
|
|
80
82
|
};
|
|
81
83
|
|
|
82
84
|
const meta = {
|
|
83
|
-
title: 'plugins/plugin-script/TypescriptEditor',
|
|
85
|
+
title: 'plugins/plugin-script/components/TypescriptEditor',
|
|
84
86
|
component: TypescriptEditor,
|
|
85
87
|
render: DefaultStory,
|
|
86
|
-
decorators: [withTheme, withLayout({ layout: 'column', classNames: '
|
|
88
|
+
decorators: [withTheme(), withLayout({ layout: 'column', classNames: 'w-document-max-width' })],
|
|
87
89
|
} satisfies Meta<typeof DefaultStory>;
|
|
88
90
|
|
|
89
91
|
export default meta;
|
|
@@ -9,10 +9,11 @@ import { lintKeymap } from '@codemirror/lint';
|
|
|
9
9
|
import { Prec } from '@codemirror/state';
|
|
10
10
|
import { keymap } from '@codemirror/view';
|
|
11
11
|
import { tags } from '@lezer/highlight';
|
|
12
|
+
import { composeRefs } from '@radix-ui/react-compose-refs';
|
|
12
13
|
import { type VirtualTypeScriptEnvironment } from '@typescript/vfs';
|
|
13
14
|
import { continueKeymap } from '@valtown/codemirror-continue';
|
|
14
15
|
import { type HoverInfo, tsAutocomplete, tsFacet, tsHover, tsLinter, tsSync } from '@valtown/codemirror-ts';
|
|
15
|
-
import React
|
|
16
|
+
import React from 'react';
|
|
16
17
|
|
|
17
18
|
import { type ThemeMode, type ThemedClassName, useThemeContext } from '@dxos/react-ui';
|
|
18
19
|
import { type UseTextEditorProps, useTextEditor } from '@dxos/react-ui-editor';
|
|
@@ -25,7 +26,7 @@ import {
|
|
|
25
26
|
createThemeExtensions,
|
|
26
27
|
defaultStyles,
|
|
27
28
|
} from '@dxos/ui-editor';
|
|
28
|
-
import {
|
|
29
|
+
import { composable, composableProps } from '@dxos/ui-theme';
|
|
29
30
|
import { isNonNullable } from '@dxos/util';
|
|
30
31
|
|
|
31
32
|
export type TypescriptEditorProps = ThemedClassName<
|
|
@@ -39,19 +40,23 @@ export type TypescriptEditorProps = ThemedClassName<
|
|
|
39
40
|
} & Pick<UseTextEditorProps, 'initialValue' | 'extensions' | 'scrollTo' | 'selection'>
|
|
40
41
|
>;
|
|
41
42
|
|
|
42
|
-
export const TypescriptEditor =
|
|
43
|
-
(
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
43
|
+
export const TypescriptEditor = composable<HTMLDivElement, TypescriptEditorProps>(
|
|
44
|
+
(
|
|
45
|
+
{
|
|
46
|
+
classNames,
|
|
47
|
+
id,
|
|
48
|
+
role = 'article',
|
|
49
|
+
inputMode = 'vscode',
|
|
50
|
+
env,
|
|
51
|
+
options,
|
|
52
|
+
initialValue,
|
|
53
|
+
extensions,
|
|
54
|
+
scrollTo,
|
|
55
|
+
selection,
|
|
56
|
+
...props
|
|
57
|
+
},
|
|
58
|
+
forwardedRef,
|
|
59
|
+
) => {
|
|
55
60
|
const { themeMode } = useThemeContext();
|
|
56
61
|
const { parentRef, focusAttributes } = useTextEditor(
|
|
57
62
|
() => ({
|
|
@@ -98,7 +103,9 @@ export const TypescriptEditor = memo(
|
|
|
98
103
|
[themeMode, id, extensions, inputMode, selection, scrollTo, env],
|
|
99
104
|
);
|
|
100
105
|
|
|
101
|
-
return
|
|
106
|
+
return (
|
|
107
|
+
<div {...composableProps(props, { classNames, ...focusAttributes })} ref={composeRefs(parentRef, forwardedRef)} />
|
|
108
|
+
);
|
|
102
109
|
},
|
|
103
110
|
);
|
|
104
111
|
|
|
@@ -129,7 +136,7 @@ const createTooltipRenderer = (themeMode: ThemeMode) => {
|
|
|
129
136
|
) ?? [];
|
|
130
137
|
return {
|
|
131
138
|
dom: Domino.of('div')
|
|
132
|
-
.classNames('xs:max-
|
|
139
|
+
.classNames('xs:max-w-80 max-w-lg p-1 bg-base-surface rounded-sm border border-separator')
|
|
133
140
|
.children(...children).root,
|
|
134
141
|
};
|
|
135
142
|
};
|
package/src/components/index.ts
CHANGED
|
@@ -2,14 +2,13 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { lazy } from 'react';
|
|
5
|
+
import { type ComponentType, lazy } from 'react';
|
|
6
6
|
|
|
7
|
+
export const ScriptPluginSettings: ComponentType<any> = lazy(() => import('./ScriptPluginSettings'));
|
|
8
|
+
|
|
9
|
+
export * from './FramePanel';
|
|
7
10
|
export * from './NotebookStack';
|
|
8
|
-
export * from './
|
|
11
|
+
export * from './QueryEditor';
|
|
12
|
+
export * from './ScriptToolbar';
|
|
9
13
|
export * from './TestPanel';
|
|
10
|
-
|
|
11
|
-
export { DEPLOYMENT_DIALOG } from './DeploymentDialog';
|
|
12
|
-
|
|
13
|
-
export const ScriptContainer = lazy(() => import('./ScriptContainer'));
|
|
14
|
-
export const DeploymentDialog = lazy(() => import('./DeploymentDialog'));
|
|
15
|
-
export const NotebookContainer = lazy(() => import('./NotebookContainer'));
|
|
14
|
+
export * from './TypescriptEditor';
|
package/src/constants.ts
ADDED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
6
6
|
import React, { useMemo } from 'react';
|
|
7
7
|
|
|
8
|
-
import { OperationPlugin } from '@dxos/app-framework';
|
|
8
|
+
import { OperationPlugin, RuntimePlugin } from '@dxos/app-framework';
|
|
9
9
|
import { withPluginManager } from '@dxos/app-framework/testing';
|
|
10
10
|
import { Obj } from '@dxos/echo';
|
|
11
11
|
import { ClientPlugin } from '@dxos/plugin-client';
|
|
@@ -17,7 +17,6 @@ import { translations } from '../../translations';
|
|
|
17
17
|
|
|
18
18
|
import { DeploymentDialog } from './DeploymentDialog';
|
|
19
19
|
|
|
20
|
-
// TODO(wittjosiah): ECHO objects don't work when passed via Storybook args.
|
|
21
20
|
const DeploymentDialogStory = () => {
|
|
22
21
|
const accessToken = useMemo(
|
|
23
22
|
() =>
|
|
@@ -37,20 +36,22 @@ const DeploymentDialogStory = () => {
|
|
|
37
36
|
);
|
|
38
37
|
return (
|
|
39
38
|
<Dialog.Root defaultOpen={true}>
|
|
40
|
-
<
|
|
39
|
+
<Dialog.Overlay>
|
|
40
|
+
<DeploymentDialog accessToken={accessToken} scriptTemplates={scriptTemplates} />
|
|
41
|
+
</Dialog.Overlay>
|
|
41
42
|
</Dialog.Root>
|
|
42
43
|
);
|
|
43
44
|
};
|
|
44
45
|
|
|
45
46
|
const meta = {
|
|
46
|
-
title: 'plugins/plugin-script/DeploymentDialog',
|
|
47
|
+
title: 'plugins/plugin-script/containers/DeploymentDialog',
|
|
47
48
|
component: DeploymentDialogStory,
|
|
48
49
|
parameters: { translations },
|
|
49
50
|
// TODO(wittjosiah): Try to write story which does not depend on plugin manager.
|
|
50
51
|
decorators: [
|
|
51
|
-
withTheme,
|
|
52
|
+
withTheme(),
|
|
52
53
|
withPluginManager({
|
|
53
|
-
plugins: [OperationPlugin(), ClientPlugin({})],
|
|
54
|
+
plugins: [OperationPlugin(), RuntimePlugin(), ClientPlugin({})],
|
|
54
55
|
}),
|
|
55
56
|
],
|
|
56
57
|
} satisfies Meta<typeof DeploymentDialogStory>;
|