@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
package/src/{components/Settings → containers/ScriptObjectSettings}/ScriptObjectSettings.tsx
RENAMED
|
@@ -6,11 +6,12 @@ import { Octokit } from '@octokit/core';
|
|
|
6
6
|
import React, { type ChangeEvent, useCallback, useState } from 'react';
|
|
7
7
|
|
|
8
8
|
import { ToolId } from '@dxos/ai';
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
9
|
+
import { useOperationInvoker } from '@dxos/app-framework/ui';
|
|
10
|
+
import { SettingsOperation } from '@dxos/app-toolkit';
|
|
11
11
|
import { Blueprint, Template } from '@dxos/blueprints';
|
|
12
12
|
import { Filter, Obj, Ref } from '@dxos/echo';
|
|
13
|
-
import {
|
|
13
|
+
import { type Script, getUserFunctionIdInMetadata } from '@dxos/functions';
|
|
14
|
+
import { Operation } from '@dxos/operation';
|
|
14
15
|
import { getInvocationUrl } from '@dxos/functions-runtime';
|
|
15
16
|
import { log } from '@dxos/log';
|
|
16
17
|
import { useClient } from '@dxos/react-client';
|
|
@@ -19,7 +20,7 @@ import { Button, Clipboard, Input, useAsyncEffect, useControlledState, useTransl
|
|
|
19
20
|
import { AccessToken } from '@dxos/types';
|
|
20
21
|
import { kebabize } from '@dxos/util';
|
|
21
22
|
|
|
22
|
-
import { meta } from '
|
|
23
|
+
import { meta } from '#meta';
|
|
23
24
|
|
|
24
25
|
export type ScriptObjectSettingsProps = {
|
|
25
26
|
object: Script.Script;
|
|
@@ -35,33 +36,15 @@ export const ScriptObjectSettings = ({ object }: ScriptObjectSettingsProps) => {
|
|
|
35
36
|
);
|
|
36
37
|
};
|
|
37
38
|
|
|
38
|
-
export const ScriptProperties = ({ object }: ScriptObjectSettingsProps) => {
|
|
39
|
-
const { t } = useTranslation(meta.id);
|
|
40
|
-
return (
|
|
41
|
-
<Input.Root>
|
|
42
|
-
<Input.Label>{t('description label')}</Input.Label>
|
|
43
|
-
<Input.TextInput
|
|
44
|
-
placeholder={t('description placeholder')}
|
|
45
|
-
value={object.description ?? ''}
|
|
46
|
-
onChange={(event) => {
|
|
47
|
-
Obj.change(object, (o) => {
|
|
48
|
-
o.description = event.target.value;
|
|
49
|
-
});
|
|
50
|
-
}}
|
|
51
|
-
/>
|
|
52
|
-
</Input.Root>
|
|
53
|
-
);
|
|
54
|
-
};
|
|
55
|
-
|
|
56
39
|
const BlueprintEditor = ({ object }: ScriptObjectSettingsProps) => {
|
|
57
40
|
const { t } = useTranslation(meta.id);
|
|
58
41
|
const db = Obj.getDatabase(object);
|
|
59
|
-
const [fn] = useQuery(db, Filter.type(
|
|
42
|
+
const [fn] = useQuery(db, Filter.type(Operation.PersistentOperation, { source: Ref.make(object) }));
|
|
60
43
|
const blueprints = useQuery(db, Filter.type(Blueprint.Blueprint));
|
|
61
44
|
|
|
62
45
|
const [creating, setCreating] = useState(false);
|
|
63
46
|
const [instructions, setInstructions] = useState<string>(`You can run the script "${object.name ?? 'script'}".`);
|
|
64
|
-
const blueprintKey = `dxos.
|
|
47
|
+
const blueprintKey = `org.dxos.blueprint.${kebabize(object.name ?? 'script')}`;
|
|
65
48
|
const existingBlueprint = blueprints.find((bp) => bp.key === blueprintKey);
|
|
66
49
|
|
|
67
50
|
useAsyncEffect(async () => {
|
|
@@ -81,14 +64,14 @@ const BlueprintEditor = ({ object }: ScriptObjectSettingsProps) => {
|
|
|
81
64
|
try {
|
|
82
65
|
if (existingBlueprint) {
|
|
83
66
|
const text = await existingBlueprint.instructions.source.load();
|
|
84
|
-
Obj.change(text, (
|
|
85
|
-
|
|
67
|
+
Obj.change(text, (obj) => {
|
|
68
|
+
obj.content = instructions;
|
|
86
69
|
});
|
|
87
70
|
if (fn?.key) {
|
|
88
71
|
const toolId = ToolId.make(fn.key);
|
|
89
72
|
if (!existingBlueprint.tools?.includes(toolId)) {
|
|
90
|
-
Obj.change(existingBlueprint, (
|
|
91
|
-
|
|
73
|
+
Obj.change(existingBlueprint, (obj) => {
|
|
74
|
+
obj.tools = [...(obj.tools ?? []), toolId];
|
|
92
75
|
});
|
|
93
76
|
}
|
|
94
77
|
}
|
|
@@ -111,20 +94,20 @@ const BlueprintEditor = ({ object }: ScriptObjectSettingsProps) => {
|
|
|
111
94
|
}, [db, existingBlueprint, fn, blueprintKey, object.name, instructions]);
|
|
112
95
|
|
|
113
96
|
return (
|
|
114
|
-
<div className='flex flex-col gap-4
|
|
97
|
+
<div className='flex flex-col gap-4 my-form-padding'>
|
|
115
98
|
<div>
|
|
116
|
-
<h2>{t('blueprint
|
|
99
|
+
<h2>{t('blueprint-editor.label', { default: 'Blueprint' })}</h2>
|
|
117
100
|
<p className='text-description text-sm'>
|
|
118
|
-
{t('blueprint
|
|
101
|
+
{t('blueprint-editor.description', {
|
|
119
102
|
default: 'Create a blueprint that exposes this script as a tool.',
|
|
120
103
|
})}
|
|
121
104
|
</p>
|
|
122
105
|
</div>
|
|
123
106
|
<Input.Root>
|
|
124
107
|
<div role='none' className='flex flex-col gap-1'>
|
|
125
|
-
<Input.Label>{t('blueprint
|
|
108
|
+
<Input.Label>{t('blueprint-instructions.label', { default: 'Instructions' })}</Input.Label>
|
|
126
109
|
<Input.TextArea
|
|
127
|
-
placeholder={t('blueprint
|
|
110
|
+
placeholder={t('blueprint-instructions.placeholder', {
|
|
128
111
|
default: 'Describe how this tool should be used.',
|
|
129
112
|
})}
|
|
130
113
|
rows={6}
|
|
@@ -149,7 +132,7 @@ const Binding = ({ object }: ScriptObjectSettingsProps) => {
|
|
|
149
132
|
const { t } = useTranslation(meta.id);
|
|
150
133
|
const client = useClient();
|
|
151
134
|
const db = Obj.getDatabase(object);
|
|
152
|
-
const [fn] = useQuery(db, Filter.type(
|
|
135
|
+
const [fn] = useQuery(db, Filter.type(Operation.PersistentOperation, { source: Ref.make(object) }));
|
|
153
136
|
|
|
154
137
|
const functionId = fn && getUserFunctionIdInMetadata(Obj.getMeta(fn));
|
|
155
138
|
const functionUrl =
|
|
@@ -167,41 +150,44 @@ const Binding = ({ object }: ScriptObjectSettingsProps) => {
|
|
|
167
150
|
);
|
|
168
151
|
|
|
169
152
|
const handleBindingBlur = useCallback(() => {
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
153
|
+
if (fn) {
|
|
154
|
+
Obj.change(fn, (obj) => {
|
|
155
|
+
obj.binding = binding;
|
|
156
|
+
});
|
|
157
|
+
}
|
|
173
158
|
}, [fn, binding]);
|
|
174
159
|
|
|
175
|
-
if (!fn
|
|
160
|
+
if (!fn) {
|
|
176
161
|
return null;
|
|
177
162
|
}
|
|
178
163
|
|
|
179
|
-
// TODO(burdon): Use form.
|
|
180
164
|
return (
|
|
181
|
-
<div role='form' className='flex flex-col gap-2
|
|
182
|
-
<h2>{t('remote
|
|
183
|
-
|
|
184
|
-
<
|
|
185
|
-
<
|
|
186
|
-
|
|
187
|
-
<
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
165
|
+
<div role='form' className='flex flex-col gap-2 my-form-padding'>
|
|
166
|
+
<h2>{t('remote-function-settings.heading')}</h2>
|
|
167
|
+
{functionUrl && (
|
|
168
|
+
<Input.Root>
|
|
169
|
+
<div role='none' className='flex flex-col gap-1'>
|
|
170
|
+
<Input.Label>{t('function-url.label')}</Input.Label>
|
|
171
|
+
<div role='none' className='flex gap-1'>
|
|
172
|
+
<Input.TextInput
|
|
173
|
+
disabled
|
|
174
|
+
value={functionUrl}
|
|
175
|
+
onChange={(event) => {
|
|
176
|
+
Obj.change(fn, (obj) => {
|
|
177
|
+
obj.name = event.target.value;
|
|
178
|
+
});
|
|
179
|
+
}}
|
|
180
|
+
/>
|
|
181
|
+
<Clipboard.IconButton value={functionUrl} />
|
|
182
|
+
</div>
|
|
197
183
|
</div>
|
|
198
|
-
</
|
|
199
|
-
|
|
184
|
+
</Input.Root>
|
|
185
|
+
)}
|
|
200
186
|
<Input.Root>
|
|
201
187
|
<div role='none' className='flex flex-col gap-1'>
|
|
202
|
-
<Input.Label>{t('function
|
|
188
|
+
<Input.Label>{t('function-binding.label')}</Input.Label>
|
|
203
189
|
<Input.TextInput
|
|
204
|
-
placeholder={t('function
|
|
190
|
+
placeholder={t('function-binding.placeholder')}
|
|
205
191
|
value={binding}
|
|
206
192
|
onChange={handleBindingChange}
|
|
207
193
|
onBlur={handleBindingBlur}
|
|
@@ -244,7 +230,7 @@ const Publishing = ({ object }: ScriptObjectSettingsProps) => {
|
|
|
244
230
|
const handleOpenTokenManager = useCallback(
|
|
245
231
|
() =>
|
|
246
232
|
invokePromise(SettingsOperation.Open, {
|
|
247
|
-
plugin: 'dxos.
|
|
233
|
+
plugin: 'org.dxos.plugin.token-manager',
|
|
248
234
|
}),
|
|
249
235
|
[invokePromise],
|
|
250
236
|
);
|
|
@@ -285,15 +271,15 @@ const Publishing = ({ object }: ScriptObjectSettingsProps) => {
|
|
|
285
271
|
}, [object, githubToken]);
|
|
286
272
|
|
|
287
273
|
return (
|
|
288
|
-
<div className='flex flex-col gap-4
|
|
274
|
+
<div className='flex flex-col gap-4 my-form-padding'>
|
|
289
275
|
<div>
|
|
290
|
-
<h2>{t('script
|
|
291
|
-
<p className='text-description text-sm'>{t('script
|
|
276
|
+
<h2>{t('script-publish-settings.label')}</h2>
|
|
277
|
+
<p className='text-description text-sm'>{t('script-publish-settings.description')}</p>
|
|
292
278
|
</div>
|
|
293
279
|
{!githubToken && (
|
|
294
280
|
<div className='flex flex-col gap-2'>
|
|
295
|
-
<span>{t('no
|
|
296
|
-
<Button onClick={handleOpenTokenManager}>{t('open
|
|
281
|
+
<span>{t('no-github-token.label')}</span>
|
|
282
|
+
<Button onClick={handleOpenTokenManager}>{t('open-token-manager.label')}</Button>
|
|
297
283
|
</div>
|
|
298
284
|
)}
|
|
299
285
|
{githubToken && (
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2024 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import React from 'react';
|
|
6
|
+
|
|
7
|
+
import { Obj } from '@dxos/echo';
|
|
8
|
+
import { type Script } from '@dxos/functions';
|
|
9
|
+
import { Input, useTranslation } from '@dxos/react-ui';
|
|
10
|
+
|
|
11
|
+
import { meta } from '#meta';
|
|
12
|
+
|
|
13
|
+
export type ScriptPropertiesProps = {
|
|
14
|
+
object: Script.Script;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export const ScriptProperties = ({ object }: ScriptPropertiesProps) => {
|
|
18
|
+
const { t } = useTranslation(meta.id);
|
|
19
|
+
return (
|
|
20
|
+
<Input.Root>
|
|
21
|
+
<Input.Label>{t('description.label')}</Input.Label>
|
|
22
|
+
<Input.TextInput
|
|
23
|
+
placeholder={t('description.placeholder')}
|
|
24
|
+
value={object.description ?? ''}
|
|
25
|
+
onChange={(event) => {
|
|
26
|
+
Obj.change(object, (obj) => {
|
|
27
|
+
obj.description = event.target.value;
|
|
28
|
+
});
|
|
29
|
+
}}
|
|
30
|
+
/>
|
|
31
|
+
</Input.Root>
|
|
32
|
+
);
|
|
33
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import React, { useCallback, useMemo } from 'react';
|
|
6
|
+
|
|
7
|
+
import { Context } from '@dxos/context';
|
|
8
|
+
|
|
9
|
+
import { type Script } from '@dxos/functions';
|
|
10
|
+
import { FunctionsServiceClient } from '@dxos/functions-runtime/edge';
|
|
11
|
+
import { Panel } from '@dxos/react-ui';
|
|
12
|
+
import { getSpace } from '@dxos/react-client/echo';
|
|
13
|
+
|
|
14
|
+
import { TestPanel } from '#components';
|
|
15
|
+
import { useDeployDeps } from '#hooks';
|
|
16
|
+
|
|
17
|
+
export type TestContainerProps = {
|
|
18
|
+
role: string;
|
|
19
|
+
script: Script.Script;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export const TestContainer = ({ role, script }: TestContainerProps) => {
|
|
23
|
+
const { client, fn, existingFunctionId } = useDeployDeps({ script });
|
|
24
|
+
const space = getSpace(script);
|
|
25
|
+
|
|
26
|
+
const functionsClient = useMemo(() => FunctionsServiceClient.fromClient(client), [client]);
|
|
27
|
+
|
|
28
|
+
const handleInvoke = useCallback(
|
|
29
|
+
async (input: unknown) => {
|
|
30
|
+
if (!fn) {
|
|
31
|
+
throw new Error('Function not deployed');
|
|
32
|
+
}
|
|
33
|
+
return functionsClient.invoke(Context.default(), fn, input, { spaceId: space?.id });
|
|
34
|
+
},
|
|
35
|
+
[fn, functionsClient, space?.id],
|
|
36
|
+
);
|
|
37
|
+
|
|
38
|
+
return (
|
|
39
|
+
<Panel.Root role={role} className='dx-document'>
|
|
40
|
+
<Panel.Content asChild>
|
|
41
|
+
<TestPanel onInvoke={existingFunctionId ? handleInvoke : undefined} />
|
|
42
|
+
</Panel.Content>
|
|
43
|
+
</Panel.Root>
|
|
44
|
+
);
|
|
45
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { type ComponentType, lazy } from 'react';
|
|
6
|
+
|
|
7
|
+
export const DeploymentDialog: ComponentType<any> = lazy(() => import('./DeploymentDialog'));
|
|
8
|
+
export const NotebookContainer: ComponentType<any> = lazy(() => import('./NotebookContainer'));
|
|
9
|
+
export const ScriptContainer: ComponentType<any> = lazy(() => import('./ScriptContainer'));
|
|
10
|
+
export const ScriptObjectSettings: ComponentType<any> = lazy(() => import('./ScriptObjectSettings'));
|
|
11
|
+
export const ScriptProperties: ComponentType<any> = lazy(() => import('./ScriptProperties'));
|
|
12
|
+
export const TestContainer: ComponentType<any> = lazy(() => import('./TestContainer'));
|
package/src/e2e/ai.test.ts
CHANGED
|
@@ -8,7 +8,8 @@ import { test } from 'vitest';
|
|
|
8
8
|
import { Client } from '@dxos/client';
|
|
9
9
|
import { type Space } from '@dxos/client-protocol';
|
|
10
10
|
import { configPreset } from '@dxos/config';
|
|
11
|
-
import {
|
|
11
|
+
import { Context } from '@dxos/context';
|
|
12
|
+
import { Operation } from '@dxos/operation';
|
|
12
13
|
import { FunctionsServiceClient } from '@dxos/functions-runtime/edge';
|
|
13
14
|
import { bundleFunction } from '@dxos/functions-runtime/native';
|
|
14
15
|
import { FunctionRuntimeKind } from '@dxos/protocols';
|
|
@@ -47,14 +48,14 @@ describe.runIf(process.env.DX_TEST_TAGS?.includes('functions-e2e')).skip('Functi
|
|
|
47
48
|
new URL('../templates/anthropic.ts', import.meta.url).pathname,
|
|
48
49
|
);
|
|
49
50
|
|
|
50
|
-
const result = await functionsServiceClient.invoke(func, {
|
|
51
|
+
const result = await functionsServiceClient.invoke(Context.default(), func, {
|
|
51
52
|
message: 'Hello, world!',
|
|
52
53
|
});
|
|
53
54
|
console.log(result);
|
|
54
55
|
});
|
|
55
56
|
|
|
56
57
|
const setup = async () => {
|
|
57
|
-
const client = await new Client({ config, types: [
|
|
58
|
+
const client = await new Client({ config, types: [Operation.PersistentOperation] }).initialize();
|
|
58
59
|
await client.halo.createIdentity();
|
|
59
60
|
|
|
60
61
|
const space = await client.spaces.create();
|
|
@@ -66,7 +67,7 @@ describe.runIf(process.env.DX_TEST_TAGS?.includes('functions-e2e')).skip('Functi
|
|
|
66
67
|
};
|
|
67
68
|
|
|
68
69
|
const sync = async (space: Space) => {
|
|
69
|
-
await space.db.flush(
|
|
70
|
+
await space.db.flush();
|
|
70
71
|
await space.internal.syncToEdge({
|
|
71
72
|
onProgress: (state) =>
|
|
72
73
|
console.log(state ? `${state.unsyncedDocumentCount} documents syncing...` : 'connecting to edge...'),
|
|
@@ -78,7 +79,7 @@ describe.runIf(process.env.DX_TEST_TAGS?.includes('functions-e2e')).skip('Functi
|
|
|
78
79
|
entryPoint,
|
|
79
80
|
verbose: true,
|
|
80
81
|
});
|
|
81
|
-
const func = await functionsServiceClient.deploy({
|
|
82
|
+
const func = await functionsServiceClient.deploy(Context.default(), {
|
|
82
83
|
version: '0.0.1',
|
|
83
84
|
ownerPublicKey: space.key,
|
|
84
85
|
entryPoint: artifact.entryPoint,
|
package/src/e2e/deploy.test.ts
CHANGED
|
@@ -9,6 +9,7 @@ import { describe, expect, test } from 'vitest';
|
|
|
9
9
|
import { Client, type Config } from '@dxos/client';
|
|
10
10
|
import { createEdgeIdentity } from '@dxos/client/edge';
|
|
11
11
|
import { configPreset } from '@dxos/config';
|
|
12
|
+
import { Context } from '@dxos/context';
|
|
12
13
|
import { bundleFunction } from '@dxos/functions-runtime/bundler';
|
|
13
14
|
import { FunctionsServiceClient } from '@dxos/functions-runtime/edge';
|
|
14
15
|
import { invariant } from '@dxos/invariant';
|
|
@@ -42,7 +43,7 @@ describe.runIf(process.env.DX_TEST_TAGS?.includes('functions-e2e'))('Functions d
|
|
|
42
43
|
}
|
|
43
44
|
const functionsServiceClient = FunctionsServiceClient.fromClient(client);
|
|
44
45
|
|
|
45
|
-
const func = await functionsServiceClient.deploy({
|
|
46
|
+
const func = await functionsServiceClient.deploy(Context.default(), {
|
|
46
47
|
ownerPublicKey: space.key,
|
|
47
48
|
version: '0.0.1',
|
|
48
49
|
entryPoint: buildResult.entryPoint,
|
|
@@ -50,12 +51,12 @@ describe.runIf(process.env.DX_TEST_TAGS?.includes('functions-e2e'))('Functions d
|
|
|
50
51
|
});
|
|
51
52
|
|
|
52
53
|
// Invoke deployed function via EDGE directly.
|
|
53
|
-
const edgeClient = client.edge;
|
|
54
|
+
const edgeClient = client.edge.http;
|
|
54
55
|
invariant(edgeClient, 'edgeClient is required');
|
|
55
56
|
edgeClient.setIdentity(createEdgeIdentity(client));
|
|
56
57
|
|
|
57
58
|
const input = { from: 'USD', to: 'EUR' };
|
|
58
|
-
const result = await functionsServiceClient.invoke(func, input);
|
|
59
|
+
const result = await functionsServiceClient.invoke(Context.default(), func, input);
|
|
59
60
|
log.info('>>> result', { result, func });
|
|
60
61
|
const resultNumber = Number(result);
|
|
61
62
|
expect(resultNumber).toBeGreaterThan(0);
|
package/src/hooks/deploy.ts
CHANGED
|
@@ -5,15 +5,16 @@
|
|
|
5
5
|
import { useEffect, useMemo } from 'react';
|
|
6
6
|
|
|
7
7
|
import { Obj, Query, Ref } from '@dxos/echo';
|
|
8
|
-
import {
|
|
8
|
+
import { type Script, getUserFunctionIdInMetadata } from '@dxos/functions';
|
|
9
|
+
import { Operation } from '@dxos/operation';
|
|
9
10
|
import { log } from '@dxos/log';
|
|
10
11
|
import { type Client, useClient } from '@dxos/react-client';
|
|
11
12
|
import { type Space, getSpace, useQuery } from '@dxos/react-client/echo';
|
|
12
13
|
import { type TFunction } from '@dxos/react-ui';
|
|
13
14
|
import { createMenuAction } from '@dxos/react-ui-menu';
|
|
14
|
-
import {
|
|
15
|
+
import { messageValence } from '@dxos/ui-theme';
|
|
15
16
|
|
|
16
|
-
import { meta } from '
|
|
17
|
+
import { meta } from '#meta';
|
|
17
18
|
import { deployScript, getFunctionUrl, isScriptDeployed } from '../util';
|
|
18
19
|
|
|
19
20
|
export type DeployActionProperties = { type: 'deploy' } | { type: 'copy' };
|
|
@@ -30,7 +31,7 @@ import { type ScriptToolbarStateStore } from './useToolbarState';
|
|
|
30
31
|
export type CreateDeployOptions = {
|
|
31
32
|
state: ScriptToolbarStateStore;
|
|
32
33
|
script: Script.Script;
|
|
33
|
-
fn:
|
|
34
|
+
fn: Operation.PersistentOperation;
|
|
34
35
|
space?: Space;
|
|
35
36
|
existingFunctionId?: string;
|
|
36
37
|
client: Client;
|
|
@@ -42,10 +43,10 @@ export const createDeploy = ({ state, script, space, fn, client, existingFunctio
|
|
|
42
43
|
|
|
43
44
|
// TODO(wittjosiah): Should this be an action?
|
|
44
45
|
const errorItem = createMenuAction('error', () => {}, {
|
|
45
|
-
label: value.error ?? ['no
|
|
46
|
+
label: value.error ?? ['no-error.label', { ns: meta.id }],
|
|
46
47
|
icon: 'ph--warning-circle--regular',
|
|
47
48
|
hidden: !value.error,
|
|
48
|
-
classNames: value.error &&
|
|
49
|
+
classNames: value.error && messageValence('error'),
|
|
49
50
|
});
|
|
50
51
|
|
|
51
52
|
const deployAction = createMenuAction<DeployActionProperties>(
|
|
@@ -62,14 +63,14 @@ export const createDeploy = ({ state, script, space, fn, client, existingFunctio
|
|
|
62
63
|
|
|
63
64
|
if (!result.success) {
|
|
64
65
|
log.catch(result.error);
|
|
65
|
-
state.set('error', t('upload
|
|
66
|
+
state.set('error', t('upload-failed.label'));
|
|
66
67
|
}
|
|
67
68
|
|
|
68
69
|
state.set('deploying', false);
|
|
69
70
|
},
|
|
70
71
|
{
|
|
71
72
|
type: 'deploy',
|
|
72
|
-
label: [value.deploying ? 'publishing
|
|
73
|
+
label: [value.deploying ? 'publishing.label' : 'deploy.label', { ns: meta.id }],
|
|
73
74
|
icon: value.deploying ? 'ph--spinner-gap--regular' : 'ph--cloud-arrow-up--regular',
|
|
74
75
|
disabled: value.deploying,
|
|
75
76
|
classNames: value.deploying ? '[&_svg]:animate-spin' : '',
|
|
@@ -85,7 +86,7 @@ export const createDeploy = ({ state, script, space, fn, client, existingFunctio
|
|
|
85
86
|
},
|
|
86
87
|
{
|
|
87
88
|
type: 'copy',
|
|
88
|
-
label: ['copy
|
|
89
|
+
label: ['copy-link.label', { ns: meta.id }],
|
|
89
90
|
icon: 'ph--link--regular',
|
|
90
91
|
disabled: !value.functionUrl,
|
|
91
92
|
},
|
|
@@ -94,9 +95,9 @@ export const createDeploy = ({ state, script, space, fn, client, existingFunctio
|
|
|
94
95
|
return {
|
|
95
96
|
nodes: [errorItem, deployAction, copyAction],
|
|
96
97
|
edges: [
|
|
97
|
-
{ source: 'root', target: 'error' },
|
|
98
|
-
{ source: 'root', target: 'deploy' },
|
|
99
|
-
{ source: 'root', target: 'copy' },
|
|
98
|
+
{ source: 'root', target: 'error', relation: 'child' },
|
|
99
|
+
{ source: 'root', target: 'deploy', relation: 'child' },
|
|
100
|
+
{ source: 'root', target: 'copy', relation: 'child' },
|
|
100
101
|
],
|
|
101
102
|
};
|
|
102
103
|
};
|
|
@@ -126,7 +127,7 @@ export const useDeployState = ({ state, script }: { state: ScriptToolbarStateSto
|
|
|
126
127
|
export const useDeployDeps = ({ script }: { script: Script.Script }) => {
|
|
127
128
|
const client = useClient();
|
|
128
129
|
const space = getSpace(script);
|
|
129
|
-
const [fn] = useQuery(space?.db, Query.type(
|
|
130
|
+
const [fn] = useQuery(space?.db, Query.type(Operation.PersistentOperation, { source: Ref.make(script) }));
|
|
130
131
|
const existingFunctionId = useMemo(() => fn && getUserFunctionIdInMetadata(Obj.getMeta(fn)), [fn]);
|
|
131
132
|
return { client, space, fn, existingFunctionId };
|
|
132
133
|
};
|
package/src/hooks/format.ts
CHANGED
|
@@ -11,7 +11,7 @@ import { type Script } from '@dxos/functions';
|
|
|
11
11
|
import { log } from '@dxos/log';
|
|
12
12
|
import { createMenuAction } from '@dxos/react-ui-menu';
|
|
13
13
|
|
|
14
|
-
import { meta } from '
|
|
14
|
+
import { meta } from '#meta';
|
|
15
15
|
|
|
16
16
|
export type FormatActionProperties = { type: 'format' };
|
|
17
17
|
|
|
@@ -30,8 +30,8 @@ export const createFormat = (script: Script.Script) => {
|
|
|
30
30
|
semi: true,
|
|
31
31
|
singleQuote: true,
|
|
32
32
|
});
|
|
33
|
-
Obj.change(script.source.target!, (
|
|
34
|
-
|
|
33
|
+
Obj.change(script.source.target!, (obj) => {
|
|
34
|
+
obj.content = formatted;
|
|
35
35
|
});
|
|
36
36
|
} catch (err: any) {
|
|
37
37
|
// TODO(wittjosiah): Show error in UI.
|
|
@@ -39,7 +39,7 @@ export const createFormat = (script: Script.Script) => {
|
|
|
39
39
|
}
|
|
40
40
|
},
|
|
41
41
|
{
|
|
42
|
-
label: ['format
|
|
42
|
+
label: ['format.label', { ns: meta.id }],
|
|
43
43
|
icon: 'ph--magic-wand--regular',
|
|
44
44
|
},
|
|
45
45
|
);
|
|
@@ -50,6 +50,7 @@ export const createFormat = (script: Script.Script) => {
|
|
|
50
50
|
{
|
|
51
51
|
source: 'root',
|
|
52
52
|
target: 'format',
|
|
53
|
+
relation: 'child',
|
|
53
54
|
},
|
|
54
55
|
],
|
|
55
56
|
};
|
package/src/hooks/template.ts
CHANGED
|
@@ -15,9 +15,9 @@ const createTemplateSelectActions = (script: Script.Script) => {
|
|
|
15
15
|
return createMenuAction<TemplateActionProperties>(
|
|
16
16
|
`template--${template.id}`,
|
|
17
17
|
() => {
|
|
18
|
-
Obj.change(script, (
|
|
19
|
-
|
|
20
|
-
const meta = Obj.getMeta(
|
|
18
|
+
Obj.change(script, (obj) => {
|
|
19
|
+
obj.name = template.name;
|
|
20
|
+
const meta = Obj.getMeta(obj);
|
|
21
21
|
const oldPresetIndex = meta.keys.findIndex((key) => key.source === FUNCTIONS_PRESET_META_KEY);
|
|
22
22
|
if (oldPresetIndex >= 0) {
|
|
23
23
|
meta.keys.splice(oldPresetIndex, 1);
|
|
@@ -27,8 +27,8 @@ const createTemplateSelectActions = (script: Script.Script) => {
|
|
|
27
27
|
}
|
|
28
28
|
});
|
|
29
29
|
if (script.source?.target) {
|
|
30
|
-
Obj.change(script.source.target, (
|
|
31
|
-
|
|
30
|
+
Obj.change(script.source.target, (obj) => {
|
|
31
|
+
obj.content = template.source;
|
|
32
32
|
});
|
|
33
33
|
}
|
|
34
34
|
},
|
|
@@ -46,8 +46,8 @@ export const createTemplateSelect = (script: Script.Script) => {
|
|
|
46
46
|
return {
|
|
47
47
|
nodes: [...templateSelectActions],
|
|
48
48
|
edges: [
|
|
49
|
-
{ source: 'root', target: 'template-select' },
|
|
50
|
-
...templateSelectActions.map((action) => ({ source: 'template-select', target: action.id })),
|
|
49
|
+
{ source: 'root', target: 'template-select', relation: 'child' },
|
|
50
|
+
...templateSelectActions.map((action) => ({ source: 'template-select', target: action.id, relation: 'child' })),
|
|
51
51
|
],
|
|
52
52
|
};
|
|
53
53
|
};
|
package/src/hooks/useCompiler.ts
CHANGED
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { useCapabilities, usePluginManager } from '@dxos/app-framework/
|
|
5
|
+
import { useCapabilities, usePluginManager } from '@dxos/app-framework/ui';
|
|
6
6
|
import { runAndForwardErrors } from '@dxos/effect';
|
|
7
7
|
import { useAsyncEffect } from '@dxos/react-ui';
|
|
8
8
|
|
|
9
9
|
import type { Compiler } from '../compiler';
|
|
10
|
-
import { ScriptEvents } from '
|
|
11
|
-
import { ScriptCapabilities } from '
|
|
10
|
+
import { ScriptEvents } from '#types';
|
|
11
|
+
import { ScriptCapabilities } from '#types';
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* Asynchronously sets up the compiler and returns it.
|
|
@@ -4,16 +4,16 @@
|
|
|
4
4
|
|
|
5
5
|
import { useCallback, useState } from 'react';
|
|
6
6
|
|
|
7
|
-
import { useOperationInvoker } from '@dxos/app-framework/
|
|
7
|
+
import { useOperationInvoker } from '@dxos/app-framework/ui';
|
|
8
8
|
import { Obj } from '@dxos/echo';
|
|
9
9
|
import { Script } from '@dxos/functions';
|
|
10
10
|
import { invariant } from '@dxos/invariant';
|
|
11
|
-
import { SpaceOperation } from '@dxos/plugin-space/
|
|
11
|
+
import { SpaceOperation } from '@dxos/plugin-space/operations';
|
|
12
12
|
import { useClient } from '@dxos/react-client';
|
|
13
13
|
import { type Space } from '@dxos/react-client/echo';
|
|
14
14
|
|
|
15
15
|
import { type Template } from '../templates';
|
|
16
|
-
import { ScriptOperation } from '
|
|
16
|
+
import { ScriptOperation } from '#operations';
|
|
17
17
|
import { deployScript } from '../util';
|
|
18
18
|
|
|
19
19
|
type DeploymentStatus = 'idle' | 'pending' | 'success' | 'error';
|
|
@@ -2,8 +2,11 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { Atom
|
|
6
|
-
import {
|
|
5
|
+
import { Atom } from '@effect-atom/atom-react';
|
|
6
|
+
import { useMemo } from 'react';
|
|
7
|
+
|
|
8
|
+
import { Capabilities } from '@dxos/app-framework';
|
|
9
|
+
import { useCapability } from '@dxos/app-framework/ui';
|
|
7
10
|
|
|
8
11
|
import { type DeployState } from './deploy';
|
|
9
12
|
|
|
@@ -16,11 +19,9 @@ export type ScriptToolbarStateStore = {
|
|
|
16
19
|
set: <K extends keyof ScriptToolbarState>(key: K, value: ScriptToolbarState[K]) => void;
|
|
17
20
|
};
|
|
18
21
|
|
|
19
|
-
// TODO(burdon): Replace with context provider?
|
|
20
22
|
export const useToolbarState = (initialState: ScriptToolbarState = {}): ScriptToolbarStateStore => {
|
|
21
|
-
const registry =
|
|
23
|
+
const registry = useCapability(Capabilities.AtomRegistry);
|
|
22
24
|
const atom = useMemo(() => Atom.make<ScriptToolbarState>(initialState), []);
|
|
23
|
-
const value = useAtomValue(atom);
|
|
24
25
|
|
|
25
26
|
return useMemo(
|
|
26
27
|
() => ({
|
|
@@ -35,6 +36,6 @@ export const useToolbarState = (initialState: ScriptToolbarState = {}): ScriptTo
|
|
|
35
36
|
registry.set(atom, { ...registry.get(atom), [key]: v });
|
|
36
37
|
},
|
|
37
38
|
}),
|
|
38
|
-
[atom, registry
|
|
39
|
+
[atom, registry],
|
|
39
40
|
);
|
|
40
41
|
};
|