@dxos/plugin-script 0.8.4-main.c85a9c8dae → 0.8.4-main.dfabb4ec29
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/dist/lib/{browser/DeploymentDialog-IIOXAS47.mjs → neutral/DeploymentDialog-6DBF3V6C.mjs} +22 -48
- package/dist/lib/neutral/DeploymentDialog-6DBF3V6C.mjs.map +7 -0
- package/dist/lib/{browser/NotebookContainer-VVZOKGRC.mjs → neutral/NotebookContainer-FIAQI3A2.mjs} +49 -139
- package/dist/lib/neutral/NotebookContainer-FIAQI3A2.mjs.map +7 -0
- package/dist/lib/{browser/ScriptContainer-A5SSIUH6.mjs → neutral/ScriptContainer-2OPBAXFB.mjs} +13 -27
- package/dist/lib/neutral/ScriptContainer-2OPBAXFB.mjs.map +7 -0
- package/dist/lib/neutral/ScriptPlugin.mjs +39 -0
- package/dist/lib/neutral/ScriptPlugin.mjs.map +7 -0
- package/dist/lib/neutral/ScriptPlugin.node.mjs +27 -0
- package/dist/lib/neutral/ScriptPlugin.node.mjs.map +7 -0
- package/dist/lib/neutral/ScriptPluginSettings-T4JMUSHN.mjs +31 -0
- package/dist/lib/neutral/ScriptPluginSettings-T4JMUSHN.mjs.map +7 -0
- package/dist/lib/neutral/ScriptProperties-F6NE6M4H.mjs +296 -0
- package/dist/lib/neutral/ScriptProperties-F6NE6M4H.mjs.map +7 -0
- package/dist/lib/neutral/TestContainer-JNFPLAJX.mjs +44 -0
- package/dist/lib/neutral/TestContainer-JNFPLAJX.mjs.map +7 -0
- package/dist/lib/neutral/access-token-created-ENMCEGVU.mjs +34 -0
- package/dist/lib/neutral/access-token-created-ENMCEGVU.mjs.map +7 -0
- package/dist/lib/neutral/app-graph-builder-7AWFCEQF.mjs +52 -0
- package/dist/lib/neutral/app-graph-builder-7AWFCEQF.mjs.map +7 -0
- package/dist/lib/{browser/blueprint-definition-YMZEJBAZ.mjs → neutral/blueprint-definition-T33SBPP2.mjs} +4 -6
- package/dist/lib/neutral/blueprint-definition-T33SBPP2.mjs.map +7 -0
- package/dist/lib/{browser → neutral}/blueprints/index.mjs +3 -1
- package/dist/lib/neutral/capabilities/index.mjs +21 -0
- package/dist/lib/neutral/capabilities/index.mjs.map +7 -0
- package/dist/lib/neutral/capabilities/node.mjs +17 -0
- package/dist/lib/neutral/capabilities/node.mjs.map +7 -0
- package/dist/lib/neutral/chunk-2DMPFVUM.mjs +8 -0
- package/dist/lib/neutral/chunk-2DMPFVUM.mjs.map +7 -0
- package/dist/lib/{browser/chunk-G3XIOLLI.mjs → neutral/chunk-4RJALG6K.mjs} +21 -44
- package/dist/lib/neutral/chunk-4RJALG6K.mjs.map +7 -0
- package/dist/lib/neutral/chunk-B4FVQEHV.mjs +8 -0
- package/dist/lib/neutral/chunk-B4FVQEHV.mjs.map +7 -0
- package/dist/lib/neutral/chunk-BDRB6ZX2.mjs +52 -0
- package/dist/lib/neutral/chunk-BDRB6ZX2.mjs.map +7 -0
- package/dist/lib/{browser/chunk-J7PGML5B.mjs → neutral/chunk-BUKQITZT.mjs} +29 -29
- package/dist/lib/neutral/chunk-BUKQITZT.mjs.map +7 -0
- package/dist/lib/{browser/chunk-ATTZUDT7.mjs → neutral/chunk-D7DFASAE.mjs} +5 -20
- package/dist/lib/neutral/chunk-D7DFASAE.mjs.map +7 -0
- package/dist/lib/neutral/chunk-MI6X5CTJ.mjs +336 -0
- package/dist/lib/neutral/chunk-MI6X5CTJ.mjs.map +7 -0
- package/dist/lib/neutral/chunk-P2F3STZN.mjs +8 -0
- package/dist/lib/neutral/chunk-P2F3STZN.mjs.map +7 -0
- package/dist/lib/neutral/chunk-PDB6UOSB.mjs +125 -0
- package/dist/lib/neutral/chunk-PDB6UOSB.mjs.map +7 -0
- package/dist/lib/{browser/chunk-WYR4QHPE.mjs → neutral/chunk-UYR3YH4Q.mjs} +3 -3
- package/dist/lib/{browser/chunk-WYR4QHPE.mjs.map → neutral/chunk-UYR3YH4Q.mjs.map} +3 -3
- package/dist/lib/{browser/compiler-53G6ZHQM.mjs → neutral/compiler-SMVIP5UN.mjs} +24 -22
- package/dist/lib/neutral/compiler-SMVIP5UN.mjs.map +7 -0
- package/dist/lib/{browser/chunk-PLDBKKYO.mjs → neutral/components/index.mjs} +163 -233
- package/dist/lib/neutral/components/index.mjs.map +7 -0
- package/dist/lib/neutral/containers/index.mjs +17 -0
- package/dist/lib/neutral/containers/index.mjs.map +7 -0
- package/dist/lib/neutral/create-OZRIZ7RN.mjs +44 -0
- package/dist/lib/neutral/create-OZRIZ7RN.mjs.map +7 -0
- package/dist/lib/neutral/create-object-F2NWICFV.mjs +44 -0
- package/dist/lib/neutral/create-object-F2NWICFV.mjs.map +7 -0
- package/dist/lib/neutral/create-script-VBA3SLSU.mjs +45 -0
- package/dist/lib/neutral/create-script-VBA3SLSU.mjs.map +7 -0
- package/dist/lib/neutral/delete-PAUWA2QM.mjs +21 -0
- package/dist/lib/neutral/delete-PAUWA2QM.mjs.map +7 -0
- package/dist/lib/neutral/deploy-CXVW54JJ.mjs +62 -0
- package/dist/lib/neutral/deploy-CXVW54JJ.mjs.map +7 -0
- package/dist/lib/{browser/chunk-MUEVLYXJ.mjs → neutral/hooks/index.mjs} +52 -80
- package/dist/lib/neutral/hooks/index.mjs.map +7 -0
- package/dist/lib/neutral/index.mjs +41 -0
- package/dist/lib/neutral/inspect-invocations-LEOEP5I2.mjs +59 -0
- package/dist/lib/neutral/inspect-invocations-LEOEP5I2.mjs.map +7 -0
- package/dist/lib/neutral/install-function-5N24Q45W.mjs +51 -0
- package/dist/lib/neutral/install-function-5N24Q45W.mjs.map +7 -0
- package/dist/lib/neutral/invoke-5QVEZ3X5.mjs +33 -0
- package/dist/lib/neutral/invoke-5QVEZ3X5.mjs.map +7 -0
- package/dist/lib/neutral/meta.json +1 -0
- package/dist/lib/neutral/meta.mjs +10 -0
- package/dist/lib/neutral/operation-handler-OTCWYDFI.mjs +18 -0
- package/dist/lib/neutral/operation-handler-OTCWYDFI.mjs.map +7 -0
- package/dist/lib/neutral/operations/index.mjs +8 -0
- package/dist/lib/neutral/plugin.mjs +16 -0
- package/dist/lib/neutral/plugin.mjs.map +7 -0
- package/dist/lib/neutral/query-deployed-functions-FVD7NYPA.mjs +30 -0
- package/dist/lib/neutral/query-deployed-functions-FVD7NYPA.mjs.map +7 -0
- package/dist/lib/neutral/react-surface-JH2AOK7V.mjs +117 -0
- package/dist/lib/neutral/react-surface-JH2AOK7V.mjs.map +7 -0
- package/dist/lib/neutral/read-FFOSK6A3.mjs +26 -0
- package/dist/lib/neutral/read-FFOSK6A3.mjs.map +7 -0
- package/dist/lib/{browser/settings-76UM7442.mjs → neutral/settings-VJBW4OMK.mjs} +6 -12
- package/dist/lib/neutral/settings-VJBW4OMK.mjs.map +7 -0
- package/dist/lib/{browser → neutral}/templates/index.mjs +1 -1
- package/dist/lib/neutral/translations.mjs +104 -0
- package/dist/lib/neutral/translations.mjs.map +7 -0
- package/dist/lib/neutral/types/index.mjs +17 -0
- package/dist/lib/neutral/update-PJS5GG3Y.mjs +63 -0
- package/dist/lib/neutral/update-PJS5GG3Y.mjs.map +7 -0
- package/dist/types/src/ScriptPlugin.d.ts +1 -0
- package/dist/types/src/ScriptPlugin.d.ts.map +1 -1
- package/dist/types/src/ScriptPlugin.node.d.ts +4 -0
- package/dist/types/src/ScriptPlugin.node.d.ts.map +1 -0
- package/dist/types/src/ScriptPlugin.test.d.ts +2 -0
- package/dist/types/src/ScriptPlugin.test.d.ts.map +1 -0
- package/dist/types/src/blueprints/functions/create.d.ts +11 -0
- package/dist/types/src/blueprints/functions/create.d.ts.map +1 -0
- package/dist/types/src/blueprints/functions/definitions.d.ts +141 -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 +29 -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/script-blueprint.d.ts +2 -2
- package/dist/types/src/blueprints/script-blueprint.d.ts.map +1 -1
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -0
- 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/create-object.d.ts +16 -0
- package/dist/types/src/capabilities/create-object.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +19 -6
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/node.d.ts +18 -0
- package/dist/types/src/capabilities/node.d.ts.map +1 -0
- package/dist/types/src/capabilities/operation-handler.d.ts +6 -0
- package/dist/types/src/capabilities/operation-handler.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -0
- package/dist/types/src/capabilities/{settings/settings.d.ts → settings.d.ts} +2 -5
- package/dist/types/src/capabilities/settings.d.ts.map +1 -0
- package/dist/types/src/compiler/compiler.d.ts.map +1 -1
- package/dist/types/src/components/{FrameContainer/FrameContainer.d.ts → FramePanel/FramePanel.d.ts} +3 -3
- package/dist/types/src/components/FramePanel/FramePanel.d.ts.map +1 -0
- package/dist/types/src/components/FramePanel/index.d.ts +2 -0
- package/dist/types/src/components/FramePanel/index.d.ts.map +1 -0
- package/dist/types/src/components/NotebookStack/NotebookCell.d.ts +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 +4 -2
- package/dist/types/src/components/NotebookStack/NotebookStack.d.ts.map +1 -1
- package/dist/types/src/components/NotebookStack/NotebookStack.stories.d.ts +219 -228
- package/dist/types/src/components/NotebookStack/NotebookStack.stories.d.ts.map +1 -1
- package/dist/types/src/components/QueryEditor/QueryEditor.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 +241 -0
- package/dist/types/src/components/ScriptPluginSettings/ScriptPluginSettings.stories.d.ts.map +1 -0
- package/dist/types/src/components/ScriptPluginSettings/index.d.ts +2 -0
- package/dist/types/src/components/ScriptPluginSettings/index.d.ts.map +1 -0
- package/dist/types/src/components/ScriptToolbar/ScriptToolbar.d.ts +7 -6
- package/dist/types/src/components/ScriptToolbar/ScriptToolbar.d.ts.map +1 -1
- package/dist/types/src/components/ScriptToolbar/ScriptToolbar.stories.d.ts +219 -228
- package/dist/types/src/components/ScriptToolbar/ScriptToolbar.stories.d.ts.map +1 -1
- package/dist/types/src/components/TestPanel/TestPanel.d.ts +4 -2
- package/dist/types/src/components/TestPanel/TestPanel.d.ts.map +1 -1
- package/dist/types/src/components/TypescriptEditor/TypescriptEditor.d.ts +5 -2
- package/dist/types/src/components/TypescriptEditor/TypescriptEditor.d.ts.map +1 -1
- package/dist/types/src/components/TypescriptEditor/TypescriptEditor.stories.d.ts +3 -1
- package/dist/types/src/components/TypescriptEditor/TypescriptEditor.stories.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +3 -1
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/containers/DeploymentDialog/DeploymentDialog.d.ts.map +1 -1
- package/dist/types/src/containers/DeploymentDialog/DeploymentDialog.stories.d.ts +219 -228
- package/dist/types/src/containers/DeploymentDialog/DeploymentDialog.stories.d.ts.map +1 -1
- package/dist/types/src/containers/DeploymentDialog/index.d.ts +1 -2
- package/dist/types/src/containers/DeploymentDialog/index.d.ts.map +1 -1
- package/dist/types/src/containers/NotebookContainer/NotebookContainer.d.ts +5 -5
- package/dist/types/src/containers/NotebookContainer/NotebookContainer.d.ts.map +1 -1
- package/dist/types/src/containers/NotebookContainer/NotebookContainer.stories.d.ts.map +1 -1
- package/dist/types/src/containers/NotebookContainer/index.d.ts +1 -2
- package/dist/types/src/containers/NotebookContainer/index.d.ts.map +1 -1
- package/dist/types/src/containers/ScriptContainer/ScriptContainer.d.ts +7 -7
- package/dist/types/src/containers/ScriptContainer/ScriptContainer.d.ts.map +1 -1
- package/dist/types/src/containers/ScriptContainer/ScriptContainer.stories.d.ts +242 -0
- package/dist/types/src/containers/ScriptContainer/ScriptContainer.stories.d.ts.map +1 -0
- package/dist/types/src/containers/ScriptContainer/index.d.ts +1 -2
- package/dist/types/src/containers/ScriptContainer/index.d.ts.map +1 -1
- package/dist/types/src/containers/ScriptProperties/BlueprintEditor.d.ts +7 -0
- package/dist/types/src/containers/ScriptProperties/BlueprintEditor.d.ts.map +1 -0
- package/dist/types/src/containers/ScriptProperties/FunctionBinding.d.ts +7 -0
- package/dist/types/src/containers/ScriptProperties/FunctionBinding.d.ts.map +1 -0
- package/dist/types/src/containers/ScriptProperties/FunctionPublishing.d.ts +7 -0
- package/dist/types/src/containers/ScriptProperties/FunctionPublishing.d.ts.map +1 -0
- package/dist/types/src/containers/ScriptProperties/ScriptProperties.d.ts +4 -5
- package/dist/types/src/containers/ScriptProperties/ScriptProperties.d.ts.map +1 -1
- package/dist/types/src/containers/ScriptProperties/ScriptProperties.stories.d.ts +242 -0
- package/dist/types/src/containers/ScriptProperties/ScriptProperties.stories.d.ts.map +1 -0
- package/dist/types/src/containers/ScriptProperties/index.d.ts +1 -2
- package/dist/types/src/containers/ScriptProperties/index.d.ts.map +1 -1
- package/dist/types/src/containers/TestContainer/TestContainer.d.ts +1 -1
- package/dist/types/src/containers/TestContainer/TestContainer.d.ts.map +1 -1
- package/dist/types/src/containers/TestContainer/index.d.ts +1 -2
- package/dist/types/src/containers/TestContainer/index.d.ts.map +1 -1
- package/dist/types/src/containers/index.d.ts +0 -2
- package/dist/types/src/containers/index.d.ts.map +1 -1
- package/dist/types/src/hooks/deploy.d.ts +17 -5
- package/dist/types/src/hooks/deploy.d.ts.map +1 -1
- package/dist/types/src/hooks/format.d.ts +1 -1
- package/dist/types/src/hooks/format.d.ts.map +1 -1
- package/dist/types/src/hooks/template.d.ts +1 -1
- package/dist/types/src/hooks/template.d.ts.map +1 -1
- package/dist/types/src/hooks/useCompiler.d.ts.map +1 -1
- package/dist/types/src/hooks/useCreateAndDeployScriptTemplates.d.ts.map +1 -1
- package/dist/types/src/hooks/useToolbarState.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +2 -4
- 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/notebook/eval.d.ts.map +1 -1
- package/dist/types/src/notebook/vfs-parser.d.ts.map +1 -1
- package/dist/types/src/operations/access-token-created.d.ts +5 -0
- package/dist/types/src/operations/access-token-created.d.ts.map +1 -0
- package/dist/types/src/operations/create-script.d.ts +5 -0
- package/dist/types/src/operations/create-script.d.ts.map +1 -0
- package/dist/types/src/operations/index.d.ts +3 -0
- package/dist/types/src/operations/index.d.ts.map +1 -0
- package/dist/types/src/plugin.d.ts +4 -0
- package/dist/types/src/plugin.d.ts.map +1 -0
- package/dist/types/src/templates/anthropic.d.ts +4 -5
- package/dist/types/src/templates/anthropic.d.ts.map +1 -1
- package/dist/types/src/templates/chat.d.ts.map +1 -1
- package/dist/types/src/templates/chess-bot.d.ts +8 -12
- package/dist/types/src/templates/chess-bot.d.ts.map +1 -1
- package/dist/types/src/templates/commentary.d.ts +8 -11
- package/dist/types/src/templates/commentary.d.ts.map +1 -1
- package/dist/types/src/templates/data-generator.d.ts.map +1 -1
- package/dist/types/src/templates/discord.d.ts.map +1 -1
- package/dist/types/src/templates/email.d.ts.map +1 -1
- package/dist/types/src/templates/forex-effect.d.ts +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/gmail.d.ts.map +1 -1
- package/dist/types/src/templates/index.d.ts +29 -29
- package/dist/types/src/templates/index.d.ts.map +1 -1
- 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/index.d.ts +2 -1
- package/dist/types/src/testing/index.d.ts.map +1 -1
- package/dist/types/src/testing/test-notebook.d.ts +3 -0
- package/dist/types/src/testing/test-notebook.d.ts.map +1 -0
- package/dist/types/src/testing/test-script.d.ts +7 -0
- package/dist/types/src/testing/test-script.d.ts.map +1 -0
- package/dist/types/src/translations.d.ts +222 -92
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/Notebook.d.ts +37 -25
- package/dist/types/src/types/Notebook.d.ts.map +1 -1
- package/dist/types/src/types/ScriptCapabilities.d.ts +6 -0
- package/dist/types/src/types/ScriptCapabilities.d.ts.map +1 -0
- package/dist/types/src/types/ScriptEvents.d.ts +3 -0
- package/dist/types/src/types/ScriptEvents.d.ts.map +1 -0
- package/dist/types/src/types/ScriptOperation.d.ts +29 -0
- package/dist/types/src/types/ScriptOperation.d.ts.map +1 -0
- package/dist/types/src/types/Settings.d.ts +7 -0
- package/dist/types/src/types/Settings.d.ts.map +1 -0
- package/dist/types/src/types/index.d.ts +4 -4
- package/dist/types/src/types/index.d.ts.map +1 -1
- package/dist/types/src/types/types.d.ts +1 -5
- package/dist/types/src/types/types.d.ts.map +1 -1
- package/dist/types/src/util/deploy.d.ts +2 -2
- package/dist/types/src/util/deploy.d.ts.map +1 -1
- package/dist/types/src/util/functions.d.ts +2 -2
- package/dist/types/src/util/functions.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +153 -104
- package/src/ScriptPlugin.node.ts +21 -0
- package/src/ScriptPlugin.test.ts +31 -0
- package/src/ScriptPlugin.tsx +11 -43
- package/src/blueprints/functions/create.ts +47 -0
- package/src/blueprints/functions/definitions.ts +323 -0
- package/src/blueprints/functions/delete.ts +23 -0
- package/src/blueprints/functions/deploy.ts +70 -0
- package/src/blueprints/functions/index.ts +19 -0
- package/src/blueprints/functions/inspect-invocations.ts +56 -0
- package/src/blueprints/functions/install-function.ts +56 -0
- package/src/blueprints/functions/invoke.ts +35 -0
- package/src/blueprints/functions/query-deployed-functions.ts +31 -0
- package/src/blueprints/functions/read.ts +29 -0
- package/src/blueprints/functions/update.ts +68 -0
- package/src/blueprints/script-blueprint.ts +32 -8
- package/src/capabilities/app-graph-builder.ts +47 -0
- package/src/capabilities/{artifact-definition/artifact-definition.ts → artifact-definition.ts} +4 -5
- package/src/capabilities/{blueprint-definition/blueprint-definition.ts → blueprint-definition.ts} +3 -1
- package/src/capabilities/{compiler/compiler.ts → compiler.ts} +17 -9
- package/src/capabilities/create-object.ts +48 -0
- package/src/capabilities/index.ts +14 -6
- package/src/capabilities/node.ts +16 -0
- package/src/capabilities/operation-handler.ts +21 -0
- package/src/capabilities/react-surface.tsx +130 -0
- package/src/capabilities/{settings/settings.ts → settings.ts} +4 -4
- package/src/compiler/compiler.ts +8 -1
- package/src/components/{FrameContainer/FrameContainer.tsx → FramePanel/FramePanel.tsx} +2 -2
- package/src/components/{FrameContainer → FramePanel}/index.ts +1 -1
- package/src/components/NotebookStack/NotebookCell.tsx +23 -12
- package/src/components/NotebookStack/NotebookMenu.tsx +7 -7
- package/src/components/NotebookStack/NotebookStack.stories.tsx +8 -9
- package/src/components/NotebookStack/NotebookStack.tsx +24 -13
- package/src/components/QueryEditor/QueryEditor.stories.tsx +5 -11
- package/src/components/ScriptPluginSettings/ScriptPluginSettings.stories.tsx +32 -0
- package/src/components/ScriptPluginSettings/ScriptPluginSettings.tsx +42 -0
- package/src/components/ScriptPluginSettings/index.ts +5 -0
- package/src/components/ScriptToolbar/ScriptToolbar.stories.tsx +5 -5
- package/src/components/ScriptToolbar/ScriptToolbar.tsx +24 -26
- package/src/components/TestPanel/TestPanel.tsx +91 -177
- package/src/components/TypescriptEditor/TypescriptEditor.stories.tsx +4 -4
- package/src/components/TypescriptEditor/TypescriptEditor.tsx +25 -18
- package/src/components/index.ts +5 -1
- package/src/constants.ts +2 -2
- package/src/containers/DeploymentDialog/DeploymentDialog.stories.tsx +5 -3
- package/src/containers/DeploymentDialog/DeploymentDialog.tsx +26 -26
- package/src/containers/DeploymentDialog/index.ts +1 -3
- package/src/containers/NotebookContainer/NotebookContainer.stories.tsx +21 -23
- package/src/containers/NotebookContainer/NotebookContainer.tsx +39 -53
- package/src/containers/NotebookContainer/index.ts +1 -3
- package/src/containers/ScriptContainer/ScriptContainer.stories.tsx +106 -0
- package/src/containers/ScriptContainer/ScriptContainer.tsx +14 -13
- package/src/containers/ScriptContainer/index.ts +1 -3
- package/src/containers/ScriptProperties/BlueprintEditor.tsx +101 -0
- package/src/containers/ScriptProperties/FunctionBinding.tsx +83 -0
- package/src/containers/ScriptProperties/FunctionPublishing.tsx +121 -0
- package/src/containers/ScriptProperties/ScriptProperties.stories.tsx +75 -0
- package/src/containers/ScriptProperties/ScriptProperties.tsx +12 -21
- package/src/containers/ScriptProperties/index.ts +1 -3
- package/src/containers/TestContainer/TestContainer.tsx +24 -8
- package/src/containers/TestContainer/index.ts +1 -3
- package/src/containers/index.ts +0 -2
- package/src/e2e/ai.test.ts +7 -6
- package/src/e2e/deploy.test.ts +6 -4
- package/src/hooks/deploy.ts +10 -8
- package/src/hooks/format.ts +5 -5
- package/src/hooks/template.ts +7 -6
- package/src/hooks/useCompiler.ts +3 -2
- package/src/hooks/useCreateAndDeployScriptTemplates.ts +4 -3
- package/src/index.ts +2 -5
- 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/notebook/vfs-parser.ts +10 -3
- package/src/operations/access-token-created.ts +37 -0
- package/src/operations/create-script.ts +46 -0
- package/src/operations/index.ts +10 -0
- package/src/plugin.ts +11 -0
- package/src/templates/anthropic.ts +19 -12
- package/src/templates/chat.ts +1 -1
- package/src/templates/chess-bot.ts +42 -37
- package/src/templates/commentary.ts +179 -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/index.ts +2 -1
- package/src/testing/simulator.test.ts +3 -4
- package/src/testing/{data.ts → test-notebook.ts} +11 -12
- package/src/testing/test-script.ts +29 -0
- package/src/translations.ts +86 -87
- package/src/types/Notebook.ts +9 -5
- package/src/types/ScriptCapabilities.ts +18 -0
- package/src/types/ScriptEvents.ts +11 -0
- package/src/types/ScriptOperation.ts +42 -0
- package/src/types/Settings.ts +20 -0
- package/src/types/index.ts +5 -4
- 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-IIOXAS47.mjs.map +0 -7
- package/dist/lib/browser/NotebookContainer-VVZOKGRC.mjs.map +0 -7
- package/dist/lib/browser/ScriptContainer-A5SSIUH6.mjs.map +0 -7
- package/dist/lib/browser/ScriptObjectSettings-HYYC7KXC.mjs +0 -294
- package/dist/lib/browser/ScriptObjectSettings-HYYC7KXC.mjs.map +0 -7
- package/dist/lib/browser/ScriptPluginSettings-UTWA7CBT.mjs +0 -55
- package/dist/lib/browser/ScriptPluginSettings-UTWA7CBT.mjs.map +0 -7
- package/dist/lib/browser/ScriptProperties-HREPUE65.mjs +0 -28
- package/dist/lib/browser/ScriptProperties-HREPUE65.mjs.map +0 -7
- package/dist/lib/browser/TestContainer-D4Y2K2TT.mjs +0 -39
- package/dist/lib/browser/TestContainer-D4Y2K2TT.mjs.map +0 -7
- package/dist/lib/browser/app-graph-builder-66ZDI72K.mjs +0 -69
- package/dist/lib/browser/app-graph-builder-66ZDI72K.mjs.map +0 -7
- package/dist/lib/browser/blueprint-definition-YMZEJBAZ.mjs.map +0 -7
- package/dist/lib/browser/chunk-6IXFDTAI.mjs +0 -113
- package/dist/lib/browser/chunk-6IXFDTAI.mjs.map +0 -7
- package/dist/lib/browser/chunk-ATTZUDT7.mjs.map +0 -7
- package/dist/lib/browser/chunk-G3XIOLLI.mjs.map +0 -7
- package/dist/lib/browser/chunk-J7PGML5B.mjs.map +0 -7
- package/dist/lib/browser/chunk-MUEVLYXJ.mjs.map +0 -7
- package/dist/lib/browser/chunk-PLDBKKYO.mjs.map +0 -7
- package/dist/lib/browser/chunk-Q66L5EUR.mjs +0 -20
- package/dist/lib/browser/chunk-Q66L5EUR.mjs.map +0 -7
- package/dist/lib/browser/chunk-TW27W3EL.mjs +0 -29
- package/dist/lib/browser/chunk-TW27W3EL.mjs.map +0 -7
- package/dist/lib/browser/chunk-ZYU2LP6U.mjs +0 -11
- package/dist/lib/browser/chunk-ZYU2LP6U.mjs.map +0 -7
- package/dist/lib/browser/compiler-53G6ZHQM.mjs.map +0 -7
- package/dist/lib/browser/index.mjs +0 -250
- package/dist/lib/browser/index.mjs.map +0 -7
- package/dist/lib/browser/meta.json +0 -1
- package/dist/lib/browser/operation-resolver-CYEISDDK.mjs +0 -79
- package/dist/lib/browser/operation-resolver-CYEISDDK.mjs.map +0 -7
- package/dist/lib/browser/react-surface-26P6HAFD.mjs +0 -141
- package/dist/lib/browser/react-surface-26P6HAFD.mjs.map +0 -7
- package/dist/lib/browser/settings-76UM7442.mjs.map +0 -7
- package/dist/lib/browser/types/index.mjs +0 -18
- package/dist/lib/node-esm/DeploymentDialog-ZHPHEV2H.mjs +0 -139
- package/dist/lib/node-esm/DeploymentDialog-ZHPHEV2H.mjs.map +0 -7
- package/dist/lib/node-esm/NotebookContainer-ZLWTNMQA.mjs +0 -851
- package/dist/lib/node-esm/NotebookContainer-ZLWTNMQA.mjs.map +0 -7
- package/dist/lib/node-esm/ScriptContainer-S4UKQAWP.mjs +0 -94
- package/dist/lib/node-esm/ScriptContainer-S4UKQAWP.mjs.map +0 -7
- package/dist/lib/node-esm/ScriptObjectSettings-C5QBRERY.mjs +0 -295
- package/dist/lib/node-esm/ScriptObjectSettings-C5QBRERY.mjs.map +0 -7
- package/dist/lib/node-esm/ScriptPluginSettings-MFACDW4R.mjs +0 -56
- package/dist/lib/node-esm/ScriptPluginSettings-MFACDW4R.mjs.map +0 -7
- package/dist/lib/node-esm/ScriptProperties-FMNIX3KU.mjs +0 -29
- package/dist/lib/node-esm/ScriptProperties-FMNIX3KU.mjs.map +0 -7
- package/dist/lib/node-esm/TestContainer-AO45YPGV.mjs +0 -40
- package/dist/lib/node-esm/TestContainer-AO45YPGV.mjs.map +0 -7
- package/dist/lib/node-esm/app-graph-builder-IGAZTJ45.mjs +0 -70
- package/dist/lib/node-esm/app-graph-builder-IGAZTJ45.mjs.map +0 -7
- package/dist/lib/node-esm/blueprint-definition-5MGY6BRQ.mjs +0 -18
- package/dist/lib/node-esm/blueprint-definition-5MGY6BRQ.mjs.map +0 -7
- package/dist/lib/node-esm/blueprints/index.mjs +0 -9
- package/dist/lib/node-esm/chunk-5BG7OJGQ.mjs +0 -176
- package/dist/lib/node-esm/chunk-5BG7OJGQ.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-H46R2RS5.mjs +0 -790
- package/dist/lib/node-esm/chunk-H46R2RS5.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-HSLMI22Q.mjs +0 -11
- package/dist/lib/node-esm/chunk-HSLMI22Q.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-JGN7TDJH.mjs +0 -69
- package/dist/lib/node-esm/chunk-JGN7TDJH.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-QG6ANK4B.mjs +0 -107
- package/dist/lib/node-esm/chunk-QG6ANK4B.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-S7DSCLOW.mjs +0 -31
- package/dist/lib/node-esm/chunk-S7DSCLOW.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-TZ2EBTPQ.mjs +0 -22
- package/dist/lib/node-esm/chunk-TZ2EBTPQ.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-UFBVE33O.mjs +0 -12
- package/dist/lib/node-esm/chunk-UFBVE33O.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-WWD5LUU6.mjs +0 -114
- package/dist/lib/node-esm/chunk-WWD5LUU6.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-ZDJ2FI7E.mjs +0 -398
- package/dist/lib/node-esm/chunk-ZDJ2FI7E.mjs.map +0 -7
- package/dist/lib/node-esm/compiler-HHQW7EP3.mjs +0 -100
- package/dist/lib/node-esm/compiler-HHQW7EP3.mjs.map +0 -7
- package/dist/lib/node-esm/index.mjs +0 -251
- package/dist/lib/node-esm/index.mjs.map +0 -7
- package/dist/lib/node-esm/meta.json +0 -1
- package/dist/lib/node-esm/operation-resolver-HFFDXWND.mjs +0 -80
- package/dist/lib/node-esm/operation-resolver-HFFDXWND.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-THCIK266.mjs +0 -142
- package/dist/lib/node-esm/react-surface-THCIK266.mjs.map +0 -7
- package/dist/lib/node-esm/settings-CCHDPLFJ.mjs +0 -37
- package/dist/lib/node-esm/settings-CCHDPLFJ.mjs.map +0 -7
- package/dist/lib/node-esm/templates/index.mjs +0 -11
- package/dist/lib/node-esm/types/index.mjs +0 -19
- 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 -6
- 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.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.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/containers/ScriptObjectSettings/ScriptObjectSettings.d.ts +0 -7
- package/dist/types/src/containers/ScriptObjectSettings/ScriptObjectSettings.d.ts.map +0 -1
- package/dist/types/src/containers/ScriptObjectSettings/index.d.ts +0 -3
- package/dist/types/src/containers/ScriptObjectSettings/index.d.ts.map +0 -1
- package/dist/types/src/containers/ScriptPluginSettings/ScriptPluginSettings.d.ts +0 -8
- package/dist/types/src/containers/ScriptPluginSettings/ScriptPluginSettings.d.ts.map +0 -1
- package/dist/types/src/containers/ScriptPluginSettings/index.d.ts +0 -3
- package/dist/types/src/containers/ScriptPluginSettings/index.d.ts.map +0 -1
- package/dist/types/src/testing/data.d.ts +0 -3
- package/dist/types/src/testing/data.d.ts.map +0 -1
- package/dist/types/src/types/actions.d.ts +0 -40
- package/dist/types/src/types/actions.d.ts.map +0 -1
- package/dist/types/src/types/capabilities.d.ts +0 -12
- package/dist/types/src/types/capabilities.d.ts.map +0 -1
- package/dist/types/src/types/events.d.ts +0 -5
- package/dist/types/src/types/events.d.ts.map +0 -1
- package/src/capabilities/app-graph-builder/app-graph-builder.ts +0 -56
- package/src/capabilities/app-graph-builder/index.ts +0 -7
- package/src/capabilities/artifact-definition/index.ts +0 -7
- 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 -75
- package/src/capabilities/react-surface/index.ts +0 -7
- package/src/capabilities/react-surface/react-surface.tsx +0 -121
- package/src/capabilities/settings/index.ts +0 -7
- package/src/components/FrameContainer/frame.html +0 -25
- package/src/components/FrameContainer/frame.tsx +0 -51
- package/src/containers/ScriptObjectSettings/ScriptObjectSettings.tsx +0 -291
- package/src/containers/ScriptObjectSettings/index.ts +0 -7
- package/src/containers/ScriptPluginSettings/ScriptPluginSettings.tsx +0 -66
- package/src/containers/ScriptPluginSettings/index.ts +0 -7
- package/src/types/actions.ts +0 -45
- package/src/types/capabilities.ts +0 -17
- package/src/types/events.ts +0 -11
- /package/dist/lib/{browser → neutral}/blueprints/index.mjs.map +0 -0
- /package/dist/lib/{browser → neutral}/chunk-J5LGTIGS.mjs +0 -0
- /package/dist/lib/{browser → neutral}/chunk-J5LGTIGS.mjs.map +0 -0
- /package/dist/lib/{browser/templates → neutral}/index.mjs.map +0 -0
- /package/dist/lib/{browser/types/index.mjs.map → neutral/meta.mjs.map} +0 -0
- /package/dist/lib/{node-esm/blueprints → neutral/operations}/index.mjs.map +0 -0
- /package/dist/lib/{node-esm → neutral}/templates/index.mjs.map +0 -0
- /package/dist/lib/{node-esm → neutral}/types/index.mjs.map +0 -0
- /package/dist/types/src/capabilities/{app-graph-builder/app-graph-builder.d.ts → app-graph-builder.d.ts} +0 -0
- /package/dist/types/src/capabilities/{artifact-definition/artifact-definition.d.ts → artifact-definition.d.ts} +0 -0
- /package/dist/types/src/capabilities/{react-surface/react-surface.d.ts → react-surface.d.ts} +0 -0
|
@@ -8,23 +8,25 @@ import React from 'react';
|
|
|
8
8
|
|
|
9
9
|
import { SERVICES_CONFIG } from '@dxos/ai/testing';
|
|
10
10
|
import { withPluginManager } from '@dxos/app-framework/testing';
|
|
11
|
-
import {
|
|
11
|
+
import { AgentPrompt } from '@dxos/assistant-toolkit';
|
|
12
|
+
import { Operation } from '@dxos/compute';
|
|
12
13
|
import { Filter } from '@dxos/echo';
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import { ExplorerPlugin } from '@dxos/plugin-explorer';
|
|
18
|
-
import { Markdown
|
|
14
|
+
import { AssistantPlugin } from '@dxos/plugin-assistant/plugin';
|
|
15
|
+
import { AutomationPlugin } from '@dxos/plugin-automation/plugin';
|
|
16
|
+
import { ClientPlugin } from '@dxos/plugin-client/plugin';
|
|
17
|
+
import { initializeIdentity } from '@dxos/plugin-client/testing';
|
|
18
|
+
import { ExplorerPlugin } from '@dxos/plugin-explorer/plugin';
|
|
19
|
+
import { Markdown } from '@dxos/plugin-markdown';
|
|
20
|
+
import { MarkdownPlugin } from '@dxos/plugin-markdown/plugin';
|
|
19
21
|
import { corePlugins } from '@dxos/plugin-testing';
|
|
20
22
|
import { Config, useClient } from '@dxos/react-client';
|
|
21
23
|
import { useQuery } from '@dxos/react-client/echo';
|
|
22
|
-
import { withLayout
|
|
24
|
+
import { withLayout } from '@dxos/react-ui/testing';
|
|
23
25
|
import { DataTypes } from '@dxos/schema';
|
|
24
26
|
|
|
25
|
-
import { createNotebook } from '
|
|
26
|
-
import { translations } from '
|
|
27
|
-
import { Notebook } from '
|
|
27
|
+
import { createNotebook } from '#testing';
|
|
28
|
+
import { translations } from '#translations';
|
|
29
|
+
import { Notebook } from '#types';
|
|
28
30
|
|
|
29
31
|
import { NotebookContainer } from './NotebookContainer';
|
|
30
32
|
|
|
@@ -33,13 +35,12 @@ const meta: Meta<typeof NotebookContainer> = {
|
|
|
33
35
|
component: NotebookContainer,
|
|
34
36
|
render: (args) => {
|
|
35
37
|
const client = useClient();
|
|
36
|
-
const space = client.spaces.
|
|
38
|
+
const space = client.spaces.get()[0];
|
|
37
39
|
const notebooks = useQuery(space?.db, Filter.type(Notebook.Notebook));
|
|
38
|
-
return <NotebookContainer {...args} subject={notebooks[0]} />;
|
|
40
|
+
return <NotebookContainer {...args} subject={notebooks[0]} attendableId='test' />;
|
|
39
41
|
},
|
|
40
42
|
decorators: [
|
|
41
|
-
|
|
42
|
-
withLayout({ layout: 'column', classNames: 'w-prose-max-width' }),
|
|
43
|
+
withLayout({ layout: 'column', classNames: 'w-document-max-width' }),
|
|
43
44
|
withPluginManager({
|
|
44
45
|
plugins: [
|
|
45
46
|
...corePlugins(),
|
|
@@ -50,17 +51,14 @@ const meta: Meta<typeof NotebookContainer> = {
|
|
|
50
51
|
services: SERVICES_CONFIG.REMOTE,
|
|
51
52
|
},
|
|
52
53
|
}),
|
|
53
|
-
types: [...DataTypes, Notebook.Notebook,
|
|
54
|
+
types: [...DataTypes, Notebook.Notebook, Operation.PersistentOperation, Markdown.Document],
|
|
54
55
|
onClientInitialized: ({ client }) =>
|
|
55
56
|
Effect.gen(function* () {
|
|
56
|
-
yield*
|
|
57
|
-
yield* Effect.promise(() => client.spaces.waitUntilReady());
|
|
58
|
-
const space = client.spaces.default;
|
|
59
|
-
yield* Effect.promise(() => space.waitUntilReady());
|
|
57
|
+
const { personalSpace } = yield* initializeIdentity(client);
|
|
60
58
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
59
|
+
personalSpace.db.add(createNotebook());
|
|
60
|
+
personalSpace.db.add(Markdown.make({ content: '# Hello World' }));
|
|
61
|
+
personalSpace.db.add(Operation.serialize(AgentPrompt));
|
|
64
62
|
}),
|
|
65
63
|
}),
|
|
66
64
|
AssistantPlugin(),
|
|
@@ -9,41 +9,44 @@ import * as Exit from 'effect/Exit';
|
|
|
9
9
|
import type * as Types from 'effect/Types';
|
|
10
10
|
import React, { useCallback, useContext, useMemo, useState } from 'react';
|
|
11
11
|
|
|
12
|
-
import { type
|
|
13
|
-
import {
|
|
14
|
-
import { Blueprint,
|
|
12
|
+
import { type AppSurface } from '@dxos/app-toolkit/ui';
|
|
13
|
+
import { AgentPrompt } from '@dxos/assistant-toolkit';
|
|
14
|
+
import { Blueprint, Routine } from '@dxos/compute';
|
|
15
|
+
import { Operation } from '@dxos/compute';
|
|
15
16
|
import { Filter, Obj, Query, Ref } from '@dxos/echo';
|
|
16
17
|
import { QueryBuilder } from '@dxos/echo-query';
|
|
17
|
-
import { type FunctionDefinition, FunctionInvocationService, TracingService } from '@dxos/functions';
|
|
18
18
|
import { invariant } from '@dxos/invariant';
|
|
19
19
|
import { log } from '@dxos/log';
|
|
20
|
-
import { useComputeRuntimeCallback } from '@dxos/plugin-automation';
|
|
21
|
-
import { Graph } from '@dxos/plugin-explorer
|
|
20
|
+
import { useComputeRuntimeCallback } from '@dxos/plugin-automation/hooks';
|
|
21
|
+
import { Graph } from '@dxos/plugin-explorer';
|
|
22
22
|
import { DropdownMenu, IconButton, Panel, Toolbar, useTranslation } from '@dxos/react-ui';
|
|
23
23
|
import { useAttention } from '@dxos/react-ui-attention';
|
|
24
24
|
import { Text, ViewModel } from '@dxos/schema';
|
|
25
25
|
import { isNonNullable } from '@dxos/util';
|
|
26
26
|
|
|
27
|
-
import { NotebookMenu, NotebookStack, type NotebookStackProps, type TypescriptEditorProps } from '
|
|
28
|
-
import { meta } from '
|
|
27
|
+
import { NotebookMenu, NotebookStack, type NotebookStackProps, type TypescriptEditorProps } from '#components';
|
|
28
|
+
import { meta } from '#meta';
|
|
29
|
+
import { type Notebook } from '#types';
|
|
30
|
+
|
|
29
31
|
import { ComputeGraph } from '../../notebook';
|
|
30
|
-
import { type Notebook } from '../../types';
|
|
31
32
|
|
|
32
33
|
const INCLUDE_BLUEPRINTS = [
|
|
33
|
-
'dxos.
|
|
34
|
-
'dxos.
|
|
35
|
-
'dxos.
|
|
34
|
+
'org.dxos.blueprint.assistant',
|
|
35
|
+
'org.dxos.blueprint.database',
|
|
36
|
+
'org.dxos.blueprint.markdown',
|
|
36
37
|
];
|
|
37
38
|
|
|
38
39
|
// TODO(burdon): Support calling named deployed functions (as with sheet).
|
|
39
40
|
|
|
40
|
-
export type NotebookContainerProps =
|
|
41
|
+
export type NotebookContainerProps = AppSurface.ObjectArticleProps<
|
|
42
|
+
Notebook.Notebook,
|
|
43
|
+
Pick<TypescriptEditorProps, 'env'>
|
|
44
|
+
>;
|
|
41
45
|
|
|
42
|
-
export const NotebookContainer = ({ role, subject: notebook, env }: NotebookContainerProps) => {
|
|
46
|
+
export const NotebookContainer = ({ role, subject: notebook, attendableId, env }: NotebookContainerProps) => {
|
|
43
47
|
const { t } = useTranslation(meta.id);
|
|
44
48
|
const registry = useContext(RegistryContext);
|
|
45
|
-
const db =
|
|
46
|
-
const attendableId = notebook ? Obj.getDXN(notebook).toString() : '';
|
|
49
|
+
const db = Obj.getDatabase(notebook);
|
|
47
50
|
const { hasAttention } = useAttention(attendableId);
|
|
48
51
|
|
|
49
52
|
// TODO(burdon): Consolidate execution and state (with graph).
|
|
@@ -66,16 +69,16 @@ export const NotebookContainer = ({ role, subject: notebook, env }: NotebookCont
|
|
|
66
69
|
if (!graph) {
|
|
67
70
|
const { view } = await ViewModel.makeFromDatabase({ db });
|
|
68
71
|
const newGraph = Graph.make({ query: { ast }, view });
|
|
69
|
-
Obj.
|
|
70
|
-
const c =
|
|
72
|
+
Obj.update(notebook!, (obj) => {
|
|
73
|
+
const c = obj.cells.find((c) => c.id === cell.id);
|
|
71
74
|
if (c) {
|
|
72
75
|
c.graph = Ref.make(newGraph);
|
|
73
76
|
c.name = name;
|
|
74
77
|
}
|
|
75
78
|
});
|
|
76
79
|
} else {
|
|
77
|
-
Obj.
|
|
78
|
-
|
|
80
|
+
Obj.update(graph, (graph) => {
|
|
81
|
+
graph.query.ast = ast as Obj.Mutable<typeof ast>;
|
|
79
82
|
});
|
|
80
83
|
}
|
|
81
84
|
}
|
|
@@ -133,10 +136,10 @@ export const NotebookContainer = ({ role, subject: notebook, env }: NotebookCont
|
|
|
133
136
|
const from = notebook.cells.findIndex((cell) => cell.id === source.id);
|
|
134
137
|
const to = notebook.cells.findIndex((cell) => cell.id === target.id);
|
|
135
138
|
if (from != null && to != null) {
|
|
136
|
-
Obj.
|
|
137
|
-
const cell =
|
|
139
|
+
Obj.update(notebook, (notebook) => {
|
|
140
|
+
const cell = notebook.cells.splice(from, 1)[0];
|
|
138
141
|
if (cell) {
|
|
139
|
-
|
|
142
|
+
notebook.cells.splice(to, 0, cell);
|
|
140
143
|
}
|
|
141
144
|
});
|
|
142
145
|
}
|
|
@@ -162,15 +165,15 @@ export const NotebookContainer = ({ role, subject: notebook, env }: NotebookCont
|
|
|
162
165
|
const blueprints = objects
|
|
163
166
|
.filter((blueprint) => INCLUDE_BLUEPRINTS.includes(blueprint.key))
|
|
164
167
|
.map((blueprint) => Ref.make(blueprint));
|
|
165
|
-
cell.prompt = Ref.make(
|
|
168
|
+
cell.prompt = Ref.make(Routine.make({ instructions: '', blueprints }));
|
|
166
169
|
}
|
|
167
170
|
break;
|
|
168
171
|
}
|
|
169
172
|
}
|
|
170
173
|
|
|
171
174
|
const idx = after ? notebook.cells.findIndex((cell) => cell.id === after) : notebook.cells.length;
|
|
172
|
-
Obj.
|
|
173
|
-
|
|
175
|
+
Obj.update(notebook, (notebook) => {
|
|
176
|
+
notebook.cells.splice(idx, 0, cell);
|
|
174
177
|
});
|
|
175
178
|
},
|
|
176
179
|
[db, notebook],
|
|
@@ -181,8 +184,8 @@ export const NotebookContainer = ({ role, subject: notebook, env }: NotebookCont
|
|
|
181
184
|
invariant(notebook);
|
|
182
185
|
const idx = notebook.cells.findIndex((cell) => cell.id === id);
|
|
183
186
|
if (idx !== -1) {
|
|
184
|
-
Obj.
|
|
185
|
-
|
|
187
|
+
Obj.update(notebook, (notebook) => {
|
|
188
|
+
notebook.cells.splice(idx, 1);
|
|
186
189
|
});
|
|
187
190
|
}
|
|
188
191
|
},
|
|
@@ -190,20 +193,20 @@ export const NotebookContainer = ({ role, subject: notebook, env }: NotebookCont
|
|
|
190
193
|
);
|
|
191
194
|
|
|
192
195
|
return (
|
|
193
|
-
<Panel.Root role={role} className='dx-
|
|
196
|
+
<Panel.Root role={role} className='dx-document'>
|
|
194
197
|
<Panel.Toolbar asChild>
|
|
195
|
-
<Toolbar.Root disabled={!hasAttention}
|
|
198
|
+
<Toolbar.Root disabled={!hasAttention}>
|
|
196
199
|
<DropdownMenu.Root>
|
|
197
200
|
<DropdownMenu.Trigger asChild>
|
|
198
|
-
<IconButton icon='ph--plus--regular' iconOnly label={t('notebook
|
|
201
|
+
<IconButton icon='ph--plus--regular' iconOnly label={t('notebook-cell-insert.label')} />
|
|
199
202
|
</DropdownMenu.Trigger>
|
|
200
203
|
<NotebookMenu onCellInsert={handleCellInsert} />
|
|
201
204
|
</DropdownMenu.Root>
|
|
202
205
|
<Toolbar.IconButton
|
|
203
206
|
icon='ph--play--fill'
|
|
204
207
|
iconOnly
|
|
205
|
-
label={t('compute
|
|
206
|
-
classNames='text-
|
|
208
|
+
label={t('compute.label')}
|
|
209
|
+
classNames='text-success-text'
|
|
207
210
|
onClick={handleCompute}
|
|
208
211
|
/>
|
|
209
212
|
</Toolbar.Root>
|
|
@@ -230,24 +233,13 @@ const runPrompt = Effect.fn(function* ({
|
|
|
230
233
|
input,
|
|
231
234
|
onResult,
|
|
232
235
|
}: {
|
|
233
|
-
prompt: Ref.Ref<
|
|
236
|
+
prompt: Ref.Ref<Routine.Routine>;
|
|
234
237
|
input: Record<string, any>;
|
|
235
238
|
onResult: (result: string) => void;
|
|
236
239
|
}) {
|
|
237
|
-
const inputData:
|
|
238
|
-
const tracer = yield* TracingService;
|
|
239
|
-
const trace = yield* tracer.traceInvocationStart({
|
|
240
|
-
target: undefined,
|
|
241
|
-
payload: {
|
|
242
|
-
data: {},
|
|
243
|
-
},
|
|
244
|
-
});
|
|
245
|
-
|
|
240
|
+
const inputData: Operation.Definition.Input<typeof AgentPrompt> = { prompt, input };
|
|
246
241
|
// Invoke the function.
|
|
247
|
-
const result = yield*
|
|
248
|
-
Effect.provide(trace.invocationTraceQueue ? TracingService.layerInvocation(trace) : TracingService.layerNoop),
|
|
249
|
-
Effect.exit,
|
|
250
|
-
);
|
|
242
|
+
const result = yield* Operation.invoke(AgentPrompt, inputData).pipe(Effect.orDie, Effect.exit);
|
|
251
243
|
|
|
252
244
|
Exit.match(result, {
|
|
253
245
|
onFailure: (cause) => {
|
|
@@ -259,10 +251,4 @@ const runPrompt = Effect.fn(function* ({
|
|
|
259
251
|
onResult(result.note);
|
|
260
252
|
},
|
|
261
253
|
});
|
|
262
|
-
|
|
263
|
-
yield* tracer.traceInvocationEnd({
|
|
264
|
-
trace,
|
|
265
|
-
// TODO(dmaretskyi): Might miss errors.
|
|
266
|
-
exception: Exit.isFailure(result) ? Cause.prettyErrors(result.cause)[0] : undefined,
|
|
267
|
-
});
|
|
268
254
|
});
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2026 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
6
|
+
import * as Effect from 'effect/Effect';
|
|
7
|
+
import React, { useEffect, useState } from 'react';
|
|
8
|
+
|
|
9
|
+
import { SERVICES_CONFIG } from '@dxos/ai/testing';
|
|
10
|
+
import { withPluginManager } from '@dxos/app-framework/testing';
|
|
11
|
+
import { Blueprint } from '@dxos/compute';
|
|
12
|
+
import { Script } from '@dxos/compute';
|
|
13
|
+
import { Operation } from '@dxos/compute';
|
|
14
|
+
import { ClientPlugin } from '@dxos/plugin-client/plugin';
|
|
15
|
+
import { initializeIdentity } from '@dxos/plugin-client/testing';
|
|
16
|
+
import { StorybookPlugin, corePlugins } from '@dxos/plugin-testing';
|
|
17
|
+
import { Config } from '@dxos/react-client';
|
|
18
|
+
import { Filter, useQuery, useSpaces } from '@dxos/react-client/echo';
|
|
19
|
+
import { Loading, withLayout, withTheme } from '@dxos/react-ui/testing';
|
|
20
|
+
import { Text } from '@dxos/schema';
|
|
21
|
+
|
|
22
|
+
import { createScript } from '#testing';
|
|
23
|
+
import { translations } from '#translations';
|
|
24
|
+
|
|
25
|
+
import { ScriptContainer } from './ScriptContainer';
|
|
26
|
+
|
|
27
|
+
type DefaultStoryProps = {};
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Loads the script source ref so `script.source.target` is available for the editor.
|
|
31
|
+
*/
|
|
32
|
+
const DefaultStory = (_: DefaultStoryProps) => {
|
|
33
|
+
const [space] = useSpaces();
|
|
34
|
+
const [script] = useQuery(space?.db, Filter.type(Script.Script));
|
|
35
|
+
const [sourceReady, setSourceReady] = useState(false);
|
|
36
|
+
|
|
37
|
+
useEffect(() => {
|
|
38
|
+
if (!script) {
|
|
39
|
+
setSourceReady(false);
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
let canceled = false;
|
|
44
|
+
void (async () => {
|
|
45
|
+
await script.source.load();
|
|
46
|
+
if (!canceled) {
|
|
47
|
+
setSourceReady(true);
|
|
48
|
+
}
|
|
49
|
+
})();
|
|
50
|
+
|
|
51
|
+
return () => {
|
|
52
|
+
canceled = true;
|
|
53
|
+
};
|
|
54
|
+
}, [script]);
|
|
55
|
+
|
|
56
|
+
if (!script || !sourceReady) {
|
|
57
|
+
return <Loading />;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
return (
|
|
61
|
+
<div className='flex flex-col min-h-[80vh] w-document-max-width'>
|
|
62
|
+
<ScriptContainer role='article' subject={script} attendableId='story-script' />
|
|
63
|
+
</div>
|
|
64
|
+
);
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
const meta = {
|
|
68
|
+
title: 'plugins/plugin-script/containers/ScriptContainer',
|
|
69
|
+
render: DefaultStory,
|
|
70
|
+
decorators: [
|
|
71
|
+
withTheme(),
|
|
72
|
+
withLayout({ layout: 'column', classNames: 'w-document-max-width' }),
|
|
73
|
+
withPluginManager({
|
|
74
|
+
plugins: [
|
|
75
|
+
...corePlugins(),
|
|
76
|
+
ClientPlugin({
|
|
77
|
+
config: new Config({
|
|
78
|
+
runtime: {
|
|
79
|
+
services: SERVICES_CONFIG.REMOTE,
|
|
80
|
+
},
|
|
81
|
+
}),
|
|
82
|
+
types: [Script.Script, Operation.PersistentOperation, Blueprint.Blueprint, Text.Text],
|
|
83
|
+
onClientInitialized: ({ client }) =>
|
|
84
|
+
Effect.gen(function* () {
|
|
85
|
+
yield* initializeIdentity(client);
|
|
86
|
+
const [space] = client.spaces.get();
|
|
87
|
+
yield* Effect.promise(() => space.waitUntilReady());
|
|
88
|
+
|
|
89
|
+
createScript(space);
|
|
90
|
+
}),
|
|
91
|
+
}),
|
|
92
|
+
StorybookPlugin({}),
|
|
93
|
+
],
|
|
94
|
+
}),
|
|
95
|
+
],
|
|
96
|
+
parameters: {
|
|
97
|
+
layout: 'fullscreen',
|
|
98
|
+
translations,
|
|
99
|
+
},
|
|
100
|
+
} satisfies Meta<DefaultStoryProps>;
|
|
101
|
+
|
|
102
|
+
export default meta;
|
|
103
|
+
|
|
104
|
+
type Story = StoryObj<typeof meta>;
|
|
105
|
+
|
|
106
|
+
export const Default: Story = {};
|
|
@@ -4,28 +4,29 @@
|
|
|
4
4
|
|
|
5
5
|
import React, { useMemo } from 'react';
|
|
6
6
|
|
|
7
|
-
import { type
|
|
7
|
+
import { type AppSurface } from '@dxos/app-toolkit/ui';
|
|
8
|
+
import { type Script } from '@dxos/compute';
|
|
8
9
|
import { Obj } from '@dxos/echo';
|
|
9
10
|
import { createDocAccessor } from '@dxos/echo-db';
|
|
10
|
-
import { type Script } from '@dxos/functions';
|
|
11
11
|
import { getSpace } from '@dxos/react-client/echo';
|
|
12
12
|
import { useIdentity } from '@dxos/react-client/halo';
|
|
13
13
|
import { Panel } from '@dxos/react-ui';
|
|
14
|
-
import { createDataExtensions, listener,
|
|
14
|
+
import { createDataExtensions, listener, editorClassNames } from '@dxos/ui-editor';
|
|
15
15
|
|
|
16
|
-
import { ScriptToolbar, TypescriptEditor, type TypescriptEditorProps } from '
|
|
17
|
-
import { useDeployState, useToolbarState } from '
|
|
18
|
-
import { type
|
|
16
|
+
import { ScriptToolbar, TypescriptEditor, type TypescriptEditorProps } from '#components';
|
|
17
|
+
import { useDeployState, useToolbarState } from '#hooks';
|
|
18
|
+
import { type Settings } from '#types';
|
|
19
19
|
|
|
20
|
-
export type ScriptEditorProps =
|
|
20
|
+
export type ScriptEditorProps = AppSurface.ObjectArticleProps<
|
|
21
21
|
Script.Script,
|
|
22
22
|
{
|
|
23
|
-
settings?:
|
|
23
|
+
settings?: Settings.Settings;
|
|
24
24
|
} & Pick<TypescriptEditorProps, 'env'>
|
|
25
25
|
>;
|
|
26
26
|
|
|
27
27
|
export const ScriptContainer = ({
|
|
28
28
|
role,
|
|
29
|
+
attendableId,
|
|
29
30
|
subject: script,
|
|
30
31
|
settings = { editorInputMode: 'vscode' },
|
|
31
32
|
env,
|
|
@@ -50,8 +51,8 @@ export const ScriptContainer = ({
|
|
|
50
51
|
listener({
|
|
51
52
|
onChange: ({ text }) => {
|
|
52
53
|
if (script.source.target?.content !== text) {
|
|
53
|
-
Obj.
|
|
54
|
-
|
|
54
|
+
Obj.update(script, (script) => {
|
|
55
|
+
script.changed = true;
|
|
55
56
|
});
|
|
56
57
|
}
|
|
57
58
|
},
|
|
@@ -64,17 +65,17 @@ export const ScriptContainer = ({
|
|
|
64
65
|
}
|
|
65
66
|
|
|
66
67
|
return (
|
|
67
|
-
<Panel.Root role={role}
|
|
68
|
+
<Panel.Root role={role}>
|
|
68
69
|
<Panel.Toolbar asChild>
|
|
69
|
-
<ScriptToolbar state={state} role={role}
|
|
70
|
+
<ScriptToolbar script={script} attendableId={attendableId} state={state} role={role} />
|
|
70
71
|
</Panel.Toolbar>
|
|
71
72
|
<Panel.Content asChild>
|
|
72
73
|
<TypescriptEditor
|
|
74
|
+
classNames={editorClassNames(role)}
|
|
73
75
|
id={script.id}
|
|
74
76
|
env={env}
|
|
75
77
|
initialValue={script.source?.target?.content}
|
|
76
78
|
extensions={extensions}
|
|
77
|
-
classNames={stackItemContentEditorClassNames(role)}
|
|
78
79
|
inputMode={settings.editorInputMode}
|
|
79
80
|
toolbar
|
|
80
81
|
/>
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2024 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import React, { useCallback, useState } from 'react';
|
|
6
|
+
|
|
7
|
+
import { ToolId } from '@dxos/ai';
|
|
8
|
+
import { Blueprint, Template } from '@dxos/compute';
|
|
9
|
+
import { type Script } from '@dxos/compute';
|
|
10
|
+
import { Operation } from '@dxos/compute';
|
|
11
|
+
import { Filter, Obj, Ref } from '@dxos/echo';
|
|
12
|
+
import { useQuery } from '@dxos/react-client/echo';
|
|
13
|
+
import { Button, Input, useAsyncEffect, useTranslation } from '@dxos/react-ui';
|
|
14
|
+
import { Form } from '@dxos/react-ui-form';
|
|
15
|
+
import { kebabize } from '@dxos/util';
|
|
16
|
+
|
|
17
|
+
import { meta } from '#meta';
|
|
18
|
+
|
|
19
|
+
export type BlueprintEditorProps = { object: Script.Script };
|
|
20
|
+
|
|
21
|
+
export const BlueprintEditor = ({ object }: BlueprintEditorProps) => {
|
|
22
|
+
const { t } = useTranslation(meta.id);
|
|
23
|
+
const db = Obj.getDatabase(object);
|
|
24
|
+
const [fn] = useQuery(db, Filter.type(Operation.PersistentOperation, { source: Ref.make(object) }));
|
|
25
|
+
const blueprints = useQuery(db, Filter.type(Blueprint.Blueprint));
|
|
26
|
+
|
|
27
|
+
const [creating, setCreating] = useState(false);
|
|
28
|
+
// TODO(burdon): Remove?
|
|
29
|
+
const [instructions, setInstructions] = useState<string>(`You can run the script "${object.name ?? 'script'}".`);
|
|
30
|
+
const blueprintKey = `org.dxos.blueprint.${kebabize(object.name ?? 'script')}`;
|
|
31
|
+
const existingBlueprint = blueprints.find((bp) => bp.key === blueprintKey);
|
|
32
|
+
|
|
33
|
+
useAsyncEffect(async () => {
|
|
34
|
+
if (!existingBlueprint) {
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const source = await existingBlueprint.instructions.source.load();
|
|
39
|
+
setInstructions(source.content ?? '');
|
|
40
|
+
}, [existingBlueprint]);
|
|
41
|
+
|
|
42
|
+
const handleSave = useCallback(async () => {
|
|
43
|
+
if (!db) {
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
setCreating(true);
|
|
48
|
+
try {
|
|
49
|
+
if (existingBlueprint) {
|
|
50
|
+
const text = await existingBlueprint.instructions.source.load();
|
|
51
|
+
Obj.update(text, (text) => {
|
|
52
|
+
text.content = instructions;
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
if (fn?.key) {
|
|
56
|
+
const toolId = ToolId.make(fn.key);
|
|
57
|
+
if (!existingBlueprint.tools?.includes(toolId)) {
|
|
58
|
+
Obj.update(existingBlueprint, (existingBlueprint) => {
|
|
59
|
+
existingBlueprint.tools = [...(existingBlueprint.tools ?? []), toolId];
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
} else if (fn?.key) {
|
|
64
|
+
db.add(
|
|
65
|
+
Blueprint.make({
|
|
66
|
+
key: blueprintKey,
|
|
67
|
+
name: object.name ?? 'Script',
|
|
68
|
+
instructions: Template.make({ source: instructions }),
|
|
69
|
+
tools: [ToolId.make(fn.key)],
|
|
70
|
+
}),
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
await db.flush();
|
|
74
|
+
} finally {
|
|
75
|
+
setCreating(false);
|
|
76
|
+
}
|
|
77
|
+
}, [db, existingBlueprint, fn, blueprintKey, object.name, instructions]);
|
|
78
|
+
|
|
79
|
+
return (
|
|
80
|
+
<div className='flex flex-col'>
|
|
81
|
+
<Form.Section label={t('blueprint-editor.label')} description={t('blueprint-editor.description')} />
|
|
82
|
+
|
|
83
|
+
<Input.Root>
|
|
84
|
+
<Input.Label>{t('blueprint-instructions.label')}</Input.Label>
|
|
85
|
+
<Input.TextArea
|
|
86
|
+
placeholder={t('blueprint-instructions.placeholder')}
|
|
87
|
+
rows={6}
|
|
88
|
+
value={instructions}
|
|
89
|
+
onChange={(event) => setInstructions(event.target.value)}
|
|
90
|
+
classNames='resize-y'
|
|
91
|
+
/>
|
|
92
|
+
</Input.Root>
|
|
93
|
+
|
|
94
|
+
<div className='pt-2'>
|
|
95
|
+
<Button disabled={(!existingBlueprint && !fn?.key) || creating} onClick={handleSave}>
|
|
96
|
+
{t(existingBlueprint ? 'update-blueprint.label' : 'create-blueprint.label')}
|
|
97
|
+
</Button>
|
|
98
|
+
</div>
|
|
99
|
+
</div>
|
|
100
|
+
);
|
|
101
|
+
};
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2024 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import React, { type ChangeEvent, useCallback } from 'react';
|
|
6
|
+
|
|
7
|
+
import { type Script } from '@dxos/compute';
|
|
8
|
+
import { Operation } from '@dxos/compute';
|
|
9
|
+
import { Filter, Obj, Ref } from '@dxos/echo';
|
|
10
|
+
import { getUserFunctionIdInMetadata } from '@dxos/functions';
|
|
11
|
+
import { getInvocationUrl } from '@dxos/functions-runtime';
|
|
12
|
+
import { useClient } from '@dxos/react-client';
|
|
13
|
+
import { useQuery } from '@dxos/react-client/echo';
|
|
14
|
+
import { Clipboard, Input, useControlledState, useTranslation } from '@dxos/react-ui';
|
|
15
|
+
import { Form } from '@dxos/react-ui-form';
|
|
16
|
+
|
|
17
|
+
import { meta } from '#meta';
|
|
18
|
+
|
|
19
|
+
export type FunctionBindingProps = { object: Script.Script };
|
|
20
|
+
|
|
21
|
+
export const FunctionBinding = ({ object }: FunctionBindingProps) => {
|
|
22
|
+
const { t } = useTranslation(meta.id);
|
|
23
|
+
const client = useClient();
|
|
24
|
+
const db = Obj.getDatabase(object);
|
|
25
|
+
|
|
26
|
+
const [fn] = useQuery(db, Filter.type(Operation.PersistentOperation, { source: Ref.make(object) }));
|
|
27
|
+
const functionId = fn && getUserFunctionIdInMetadata(Obj.getMeta(fn));
|
|
28
|
+
const functionUrl =
|
|
29
|
+
functionId &&
|
|
30
|
+
getInvocationUrl(functionId, client.config.values.runtime?.services?.edge?.url ?? '', {
|
|
31
|
+
spaceId: db?.spaceId,
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
const [binding, setBinding] = useControlledState(fn?.binding ?? '');
|
|
35
|
+
const handleBindingChange = useCallback(
|
|
36
|
+
(event: ChangeEvent<HTMLInputElement>) => setBinding(event.target.value),
|
|
37
|
+
[setBinding],
|
|
38
|
+
);
|
|
39
|
+
|
|
40
|
+
const handleBindingBlur = useCallback(() => {
|
|
41
|
+
if (fn) {
|
|
42
|
+
Obj.update(fn, (fn) => {
|
|
43
|
+
fn.binding = binding;
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
}, [fn, binding]);
|
|
47
|
+
|
|
48
|
+
if (!fn) {
|
|
49
|
+
return null;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
return (
|
|
53
|
+
<div className='flex flex-col'>
|
|
54
|
+
<Form.Section label={t('remote-function-settings.heading')} />
|
|
55
|
+
|
|
56
|
+
{functionUrl && (
|
|
57
|
+
<Input.Root>
|
|
58
|
+
<Input.Label>{t('function-url.label')}</Input.Label>
|
|
59
|
+
<Input.TextInput
|
|
60
|
+
disabled
|
|
61
|
+
value={functionUrl}
|
|
62
|
+
onChange={(event) => {
|
|
63
|
+
Obj.update(fn, (fn) => {
|
|
64
|
+
fn.name = event.target.value;
|
|
65
|
+
});
|
|
66
|
+
}}
|
|
67
|
+
/>
|
|
68
|
+
<Clipboard.IconButton value={functionUrl} />
|
|
69
|
+
</Input.Root>
|
|
70
|
+
)}
|
|
71
|
+
|
|
72
|
+
<Input.Root>
|
|
73
|
+
<Input.Label>{t('function-binding.label')}</Input.Label>
|
|
74
|
+
<Input.TextInput
|
|
75
|
+
placeholder={t('function-binding.placeholder')}
|
|
76
|
+
value={binding}
|
|
77
|
+
onChange={handleBindingChange}
|
|
78
|
+
onBlur={handleBindingBlur}
|
|
79
|
+
/>
|
|
80
|
+
</Input.Root>
|
|
81
|
+
</div>
|
|
82
|
+
);
|
|
83
|
+
};
|