@dxos/plugin-script 0.8.4-main.7996785055 → 0.8.4-main.8baae0fced
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +102 -5
- package/dist/lib/{browser/DeploymentDialog-LGEGIX64.mjs → neutral/DeploymentDialog-6DBF3V6C.mjs} +15 -27
- package/dist/lib/neutral/DeploymentDialog-6DBF3V6C.mjs.map +7 -0
- package/dist/lib/{browser/NotebookContainer-CC3G32Q5.mjs → neutral/NotebookArticle-VBBVX4BW.mjs} +48 -135
- package/dist/lib/neutral/NotebookArticle-VBBVX4BW.mjs.map +7 -0
- package/dist/lib/{browser/ScriptContainer-Z3MCPN2D.mjs → neutral/ScriptArticle-UBT27SB6.mjs} +10 -26
- package/dist/lib/neutral/ScriptArticle-UBT27SB6.mjs.map +7 -0
- package/dist/lib/neutral/ScriptPlugin.mjs +39 -0
- package/dist/lib/neutral/ScriptPlugin.mjs.map +7 -0
- package/dist/lib/neutral/ScriptPlugin.node.mjs +27 -0
- package/dist/lib/neutral/ScriptPlugin.node.mjs.map +7 -0
- package/dist/lib/neutral/ScriptPlugin.workerd.mjs +21 -0
- package/dist/lib/neutral/ScriptPlugin.workerd.mjs.map +7 -0
- package/dist/lib/neutral/ScriptPluginSettings-T4JMUSHN.mjs +31 -0
- package/dist/lib/neutral/ScriptPluginSettings-T4JMUSHN.mjs.map +7 -0
- package/dist/lib/neutral/ScriptProperties-RLXNAN3N.mjs +297 -0
- package/dist/lib/neutral/ScriptProperties-RLXNAN3N.mjs.map +7 -0
- package/dist/lib/{browser/TestContainer-ACNQMKVU.mjs → neutral/TestContainer-AFVTBYSJ.mjs} +9 -26
- package/dist/lib/neutral/TestContainer-AFVTBYSJ.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-MC264VR5.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/{node-esm/chunk-JGN7TDJH.mjs → neutral/chunk-2REUEDUA.mjs} +10 -23
- package/dist/lib/neutral/chunk-2REUEDUA.mjs.map +7 -0
- package/dist/lib/{browser/chunk-37XPSUAH.mjs → neutral/chunk-436PZKYX.mjs} +2 -1
- package/dist/lib/neutral/chunk-436PZKYX.mjs.map +7 -0
- package/dist/lib/neutral/chunk-4OWPUMGN.mjs +8 -0
- package/dist/lib/neutral/chunk-4OWPUMGN.mjs.map +7 -0
- package/dist/lib/neutral/chunk-A4LRH25S.mjs +105 -0
- package/dist/lib/neutral/chunk-A4LRH25S.mjs.map +7 -0
- package/dist/lib/neutral/chunk-BDRB6ZX2.mjs +52 -0
- package/dist/lib/neutral/chunk-BDRB6ZX2.mjs.map +7 -0
- package/dist/lib/neutral/chunk-BMO5VOKL.mjs +125 -0
- package/dist/lib/neutral/chunk-BMO5VOKL.mjs.map +7 -0
- package/dist/lib/neutral/chunk-MI6X5CTJ.mjs +336 -0
- package/dist/lib/neutral/chunk-MI6X5CTJ.mjs.map +7 -0
- package/dist/lib/neutral/chunk-SNUWHNEW.mjs +8 -0
- package/dist/lib/neutral/chunk-SNUWHNEW.mjs.map +7 -0
- package/dist/lib/{browser/chunk-E6BQ4P6L.mjs → neutral/chunk-VXDJH6OL.mjs} +21 -50
- package/dist/lib/neutral/chunk-VXDJH6OL.mjs.map +7 -0
- package/dist/lib/{browser/compiler-MZKFKYCG.mjs → neutral/compiler-ODK4UA2N.mjs} +24 -21
- package/dist/lib/neutral/compiler-ODK4UA2N.mjs.map +7 -0
- package/dist/lib/{node-esm/chunk-SV742UH7.mjs → neutral/components/index.mjs} +75 -97
- package/dist/lib/neutral/components/index.mjs.map +7 -0
- package/dist/lib/neutral/containers/index.mjs +17 -0
- package/dist/lib/neutral/containers/index.mjs.map +7 -0
- package/dist/lib/neutral/create-ZUHIXCBS.mjs +46 -0
- package/dist/lib/neutral/create-ZUHIXCBS.mjs.map +7 -0
- package/dist/lib/neutral/create-object-F2NWICFV.mjs +44 -0
- package/dist/lib/neutral/create-object-F2NWICFV.mjs.map +7 -0
- package/dist/lib/{browser/create-script-Z7J4HDV2.mjs → neutral/create-script-H5S4AO47.mjs} +6 -8
- package/dist/lib/neutral/create-script-H5S4AO47.mjs.map +7 -0
- package/dist/lib/neutral/delete-PAUWA2QM.mjs +21 -0
- package/dist/lib/neutral/delete-PAUWA2QM.mjs.map +7 -0
- package/dist/lib/neutral/deploy-M73G7HMP.mjs +63 -0
- package/dist/lib/neutral/deploy-M73G7HMP.mjs.map +7 -0
- package/dist/lib/{browser/chunk-DBEYGFVF.mjs → neutral/hooks/index.mjs} +49 -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-UO27IPCL.mjs +59 -0
- package/dist/lib/neutral/inspect-invocations-UO27IPCL.mjs.map +7 -0
- package/dist/lib/neutral/install-function-MSWSC244.mjs +49 -0
- package/dist/lib/neutral/install-function-MSWSC244.mjs.map +7 -0
- package/dist/lib/neutral/invoke-V6XYXKLD.mjs +32 -0
- package/dist/lib/neutral/invoke-V6XYXKLD.mjs.map +7 -0
- package/dist/lib/neutral/meta.json +1 -0
- package/dist/lib/neutral/meta.mjs +10 -0
- package/dist/lib/neutral/operation-handler-KIZ7XZ5G.mjs +18 -0
- package/dist/lib/neutral/operation-handler-KIZ7XZ5G.mjs.map +7 -0
- package/dist/lib/neutral/operations/index.mjs +8 -0
- package/dist/lib/neutral/plugin.mjs +16 -0
- package/dist/lib/neutral/plugin.mjs.map +7 -0
- package/dist/lib/neutral/query-deployed-functions-4MMKQ6BR.mjs +34 -0
- package/dist/lib/neutral/query-deployed-functions-4MMKQ6BR.mjs.map +7 -0
- package/dist/lib/neutral/react-surface-K4SSUR57.mjs +120 -0
- package/dist/lib/neutral/react-surface-K4SSUR57.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-BV3KXROF.mjs → neutral/settings-VJBW4OMK.mjs} +6 -11
- 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/ScriptPlugin.workerd.d.ts +4 -0
- package/dist/types/src/ScriptPlugin.workerd.d.ts.map +1 -0
- package/dist/types/src/blueprints/functions/create.d.ts +11 -0
- package/dist/types/src/blueprints/functions/create.d.ts.map +1 -0
- package/dist/types/src/blueprints/functions/definitions.d.ts +129 -0
- package/dist/types/src/blueprints/functions/definitions.d.ts.map +1 -0
- package/dist/types/src/blueprints/functions/delete.d.ts +16 -0
- package/dist/types/src/blueprints/functions/delete.d.ts.map +1 -0
- package/dist/types/src/blueprints/functions/deploy.d.ts +20 -0
- package/dist/types/src/blueprints/functions/deploy.d.ts.map +1 -0
- package/dist/types/src/blueprints/functions/index.d.ts +4 -0
- package/dist/types/src/blueprints/functions/index.d.ts.map +1 -0
- package/dist/types/src/blueprints/functions/inspect-invocations.d.ts +27 -0
- package/dist/types/src/blueprints/functions/inspect-invocations.d.ts.map +1 -0
- package/dist/types/src/blueprints/functions/install-function.d.ts +11 -0
- package/dist/types/src/blueprints/functions/install-function.d.ts.map +1 -0
- package/dist/types/src/blueprints/functions/invoke.d.ts +20 -0
- package/dist/types/src/blueprints/functions/invoke.d.ts.map +1 -0
- package/dist/types/src/blueprints/functions/query-deployed-functions.d.ts +13 -0
- package/dist/types/src/blueprints/functions/query-deployed-functions.d.ts.map +1 -0
- package/dist/types/src/blueprints/functions/read.d.ts +20 -0
- package/dist/types/src/blueprints/functions/read.d.ts.map +1 -0
- package/dist/types/src/blueprints/functions/update.d.ts +25 -0
- package/dist/types/src/blueprints/functions/update.d.ts.map +1 -0
- package/dist/types/src/blueprints/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/operation-handler.d.ts → operation-handler.d.ts} +1 -1
- 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/FramePanel/FramePanel.d.ts.map +1 -1
- 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 +2 -6
- package/dist/types/src/components/NotebookStack/NotebookStack.d.ts.map +1 -1
- package/dist/types/src/components/NotebookStack/NotebookStack.stories.d.ts +219 -231
- 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 +3 -7
- package/dist/types/src/components/ScriptToolbar/ScriptToolbar.d.ts.map +1 -1
- package/dist/types/src/components/ScriptToolbar/ScriptToolbar.stories.d.ts +219 -231
- package/dist/types/src/components/ScriptToolbar/ScriptToolbar.stories.d.ts.map +1 -1
- package/dist/types/src/components/TestPanel/TestPanel.d.ts +1 -5
- package/dist/types/src/components/TestPanel/TestPanel.d.ts.map +1 -1
- package/dist/types/src/components/TypescriptEditor/TypescriptEditor.d.ts +3 -6
- package/dist/types/src/components/TypescriptEditor/TypescriptEditor.d.ts.map +1 -1
- package/dist/types/src/components/TypescriptEditor/TypescriptEditor.stories.d.ts +1 -5
- package/dist/types/src/components/TypescriptEditor/TypescriptEditor.stories.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +2 -0
- 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 -231
- 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/NotebookArticle/NotebookArticle.d.ts +7 -0
- package/dist/types/src/containers/NotebookArticle/NotebookArticle.d.ts.map +1 -0
- package/dist/types/src/containers/NotebookArticle/NotebookArticle.stories.d.ts +7 -0
- package/dist/types/src/containers/NotebookArticle/NotebookArticle.stories.d.ts.map +1 -0
- package/dist/types/src/containers/NotebookArticle/index.d.ts +2 -0
- package/dist/types/src/containers/NotebookArticle/index.d.ts.map +1 -0
- package/dist/types/src/containers/ScriptArticle/ScriptArticle.d.ts +10 -0
- package/dist/types/src/containers/ScriptArticle/ScriptArticle.d.ts.map +1 -0
- package/dist/types/src/containers/ScriptArticle/ScriptArticle.stories.d.ts +242 -0
- package/dist/types/src/containers/ScriptArticle/ScriptArticle.stories.d.ts.map +1 -0
- package/dist/types/src/containers/ScriptArticle/index.d.ts +2 -0
- package/dist/types/src/containers/ScriptArticle/index.d.ts.map +1 -0
- package/dist/types/src/containers/ScriptProperties/BlueprintEditor.d.ts +7 -0
- package/dist/types/src/containers/ScriptProperties/BlueprintEditor.d.ts.map +1 -0
- package/dist/types/src/containers/ScriptProperties/FunctionBinding.d.ts +7 -0
- package/dist/types/src/containers/ScriptProperties/FunctionBinding.d.ts.map +1 -0
- package/dist/types/src/containers/ScriptProperties/FunctionPublishing.d.ts +7 -0
- package/dist/types/src/containers/ScriptProperties/FunctionPublishing.d.ts.map +1 -0
- package/dist/types/src/containers/ScriptProperties/ScriptProperties.d.ts +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 +2 -4
- package/dist/types/src/containers/index.d.ts.map +1 -1
- package/dist/types/src/hooks/deploy.d.ts +14 -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/meta.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/create-script.d.ts +3 -3
- package/dist/types/src/operations/create-script.d.ts.map +1 -1
- package/dist/types/src/operations/index.d.ts +1 -2
- package/dist/types/src/operations/index.d.ts.map +1 -1
- 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 +1 -1
- 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 +5 -11
- package/dist/types/src/templates/chess-bot.d.ts.map +1 -1
- package/dist/types/src/templates/commentary.d.ts +5 -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 +1 -1
- package/dist/types/src/templates/forex-effect.d.ts.map +1 -1
- package/dist/types/src/templates/forex.d.ts +1 -1
- package/dist/types/src/templates/forex.d.ts.map +1 -1
- package/dist/types/src/templates/gmail.d.ts.map +1 -1
- package/dist/types/src/templates/index.d.ts +29 -29
- package/dist/types/src/templates/index.d.ts.map +1 -1
- package/dist/types/src/templates/ping.d.ts +1 -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 -94
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/Notebook.d.ts +37 -29
- 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 -3
- 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 +1 -2
- package/dist/types/src/util/deploy.d.ts.map +1 -1
- package/dist/types/src/util/functions.d.ts +1 -2
- package/dist/types/src/util/functions.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +153 -113
- package/src/ScriptPlugin.node.ts +21 -0
- package/src/ScriptPlugin.test.ts +31 -0
- package/src/ScriptPlugin.tsx +9 -56
- package/src/ScriptPlugin.workerd.ts +18 -0
- package/src/blueprints/functions/create.ts +47 -0
- package/src/blueprints/functions/definitions.ts +323 -0
- package/src/blueprints/functions/delete.ts +23 -0
- package/src/blueprints/functions/deploy.ts +71 -0
- package/src/blueprints/functions/index.ts +19 -0
- package/src/blueprints/functions/inspect-invocations.ts +56 -0
- package/src/blueprints/functions/install-function.ts +56 -0
- package/src/blueprints/functions/invoke.ts +34 -0
- package/src/blueprints/functions/query-deployed-functions.ts +35 -0
- package/src/blueprints/functions/read.ts +29 -0
- package/src/blueprints/functions/update.ts +68 -0
- package/src/blueprints/script-blueprint.ts +32 -5
- package/src/capabilities/{app-graph-builder/app-graph-builder.ts → app-graph-builder.ts} +13 -22
- 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 +12 -1
- package/src/components/NotebookStack/NotebookCell.tsx +22 -11
- package/src/components/NotebookStack/NotebookMenu.tsx +7 -7
- package/src/components/NotebookStack/NotebookStack.stories.tsx +4 -4
- package/src/components/NotebookStack/NotebookStack.tsx +4 -4
- package/src/components/QueryEditor/QueryEditor.stories.tsx +3 -3
- package/src/components/QueryEditor/QueryEditor.tsx +3 -1
- 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 +6 -6
- package/src/components/ScriptToolbar/ScriptToolbar.tsx +4 -4
- package/src/components/TestPanel/TestPanel.tsx +5 -9
- package/src/components/TypescriptEditor/TypescriptEditor.stories.tsx +3 -3
- package/src/components/TypescriptEditor/TypescriptEditor.tsx +2 -2
- package/src/components/index.ts +4 -0
- package/src/constants.ts +1 -1
- package/src/containers/DeploymentDialog/DeploymentDialog.stories.tsx +4 -4
- package/src/containers/DeploymentDialog/DeploymentDialog.tsx +14 -13
- package/src/containers/DeploymentDialog/index.ts +1 -3
- package/src/containers/{NotebookContainer/NotebookContainer.stories.tsx → NotebookArticle/NotebookArticle.stories.tsx} +15 -14
- package/src/containers/{NotebookContainer/NotebookContainer.tsx → NotebookArticle/NotebookArticle.tsx} +32 -45
- package/src/containers/NotebookArticle/index.ts +5 -0
- package/src/containers/ScriptArticle/ScriptArticle.stories.tsx +107 -0
- package/src/containers/{ScriptContainer/ScriptContainer.tsx → ScriptArticle/ScriptArticle.tsx} +12 -12
- package/src/containers/ScriptArticle/index.ts +5 -0
- package/src/containers/ScriptProperties/BlueprintEditor.tsx +102 -0
- package/src/containers/ScriptProperties/FunctionBinding.tsx +83 -0
- package/src/containers/ScriptProperties/FunctionPublishing.tsx +121 -0
- package/src/containers/ScriptProperties/ScriptProperties.stories.tsx +76 -0
- package/src/containers/ScriptProperties/ScriptProperties.tsx +12 -21
- package/src/containers/ScriptProperties/index.ts +1 -3
- package/src/containers/TestContainer/TestContainer.tsx +7 -8
- package/src/containers/TestContainer/index.ts +1 -3
- package/src/containers/index.ts +2 -4
- package/src/e2e/ai.test.ts +2 -2
- package/src/e2e/deploy.test.ts +3 -2
- package/src/hooks/deploy.ts +8 -7
- package/src/hooks/format.ts +4 -4
- package/src/hooks/template.ts +6 -5
- package/src/hooks/useCompiler.ts +3 -2
- package/src/hooks/useCreateAndDeployScriptTemplates.ts +4 -3
- package/src/index.ts +2 -5
- package/src/meta.ts +1 -0
- 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/create-script.ts +3 -4
- package/src/operations/index.ts +2 -7
- package/src/plugin.ts +11 -0
- package/src/templates/anthropic.ts +1 -1
- package/src/templates/chess-bot.ts +11 -9
- package/src/templates/commentary.ts +27 -22
- package/src/templates/discord.ts +1 -1
- package/src/templates/forex-effect.ts +1 -1
- package/src/templates/forex.ts +1 -1
- package/src/templates/gmail.ts +1 -1
- package/src/templates/ping.ts +1 -1
- 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 +28 -0
- package/src/translations.ts +86 -89
- package/src/types/Notebook.ts +3 -3
- package/src/types/ScriptCapabilities.ts +18 -0
- package/src/types/ScriptEvents.ts +11 -0
- package/src/{operations/definitions.ts → types/ScriptOperation.ts} +5 -3
- package/src/types/Settings.ts +20 -0
- package/src/types/index.ts +5 -3
- package/src/types/types.ts +1 -11
- package/src/util/deploy.ts +7 -7
- package/src/util/functions.ts +11 -11
- package/dist/lib/browser/DeploymentDialog-LGEGIX64.mjs.map +0 -7
- package/dist/lib/browser/NotebookContainer-CC3G32Q5.mjs.map +0 -7
- package/dist/lib/browser/ScriptContainer-Z3MCPN2D.mjs.map +0 -7
- package/dist/lib/browser/ScriptObjectSettings-LST7DUAN.mjs +0 -297
- package/dist/lib/browser/ScriptObjectSettings-LST7DUAN.mjs.map +0 -7
- package/dist/lib/browser/ScriptPluginSettings-IKWRISC3.mjs +0 -55
- package/dist/lib/browser/ScriptPluginSettings-IKWRISC3.mjs.map +0 -7
- package/dist/lib/browser/ScriptProperties-ZCRTZTAK.mjs +0 -28
- package/dist/lib/browser/ScriptProperties-ZCRTZTAK.mjs.map +0 -7
- package/dist/lib/browser/TestContainer-ACNQMKVU.mjs.map +0 -7
- package/dist/lib/browser/access-token-created-ZHVVOEL7.mjs +0 -36
- package/dist/lib/browser/access-token-created-ZHVVOEL7.mjs.map +0 -7
- package/dist/lib/browser/app-graph-builder-QPXX4YK5.mjs +0 -63
- package/dist/lib/browser/app-graph-builder-QPXX4YK5.mjs.map +0 -7
- package/dist/lib/browser/blueprint-definition-MC264VR5.mjs.map +0 -7
- package/dist/lib/browser/chunk-37XPSUAH.mjs.map +0 -7
- package/dist/lib/browser/chunk-4XJSGCAS.mjs +0 -742
- package/dist/lib/browser/chunk-4XJSGCAS.mjs.map +0 -7
- package/dist/lib/browser/chunk-7JI376EM.mjs +0 -20
- package/dist/lib/browser/chunk-7JI376EM.mjs.map +0 -7
- package/dist/lib/browser/chunk-ATTZUDT7.mjs +0 -67
- package/dist/lib/browser/chunk-ATTZUDT7.mjs.map +0 -7
- package/dist/lib/browser/chunk-BHRCZLLU.mjs +0 -105
- package/dist/lib/browser/chunk-BHRCZLLU.mjs.map +0 -7
- package/dist/lib/browser/chunk-CMHREENI.mjs +0 -8
- package/dist/lib/browser/chunk-CMHREENI.mjs.map +0 -7
- package/dist/lib/browser/chunk-DBEYGFVF.mjs.map +0 -7
- package/dist/lib/browser/chunk-E6BQ4P6L.mjs.map +0 -7
- package/dist/lib/browser/chunk-GB2HL4ZE.mjs +0 -26
- package/dist/lib/browser/chunk-GB2HL4ZE.mjs.map +0 -7
- package/dist/lib/browser/chunk-NQJRENSK.mjs +0 -75
- package/dist/lib/browser/chunk-NQJRENSK.mjs.map +0 -7
- package/dist/lib/browser/chunk-QLFFA4Y4.mjs +0 -52
- package/dist/lib/browser/chunk-QLFFA4Y4.mjs.map +0 -7
- package/dist/lib/browser/chunk-X44CJ7F5.mjs +0 -11
- package/dist/lib/browser/chunk-X44CJ7F5.mjs.map +0 -7
- package/dist/lib/browser/compiler-MZKFKYCG.mjs.map +0 -7
- package/dist/lib/browser/create-script-Z7J4HDV2.mjs.map +0 -7
- package/dist/lib/browser/index.mjs +0 -268
- package/dist/lib/browser/index.mjs.map +0 -7
- package/dist/lib/browser/meta.json +0 -1
- package/dist/lib/browser/operation-handler-76AHUB5G.mjs +0 -18
- package/dist/lib/browser/operation-handler-76AHUB5G.mjs.map +0 -7
- package/dist/lib/browser/operations/index.mjs +0 -14
- package/dist/lib/browser/react-surface-2VVUIV66.mjs +0 -145
- package/dist/lib/browser/react-surface-2VVUIV66.mjs.map +0 -7
- package/dist/lib/browser/settings-BV3KXROF.mjs.map +0 -7
- package/dist/lib/browser/types/index.mjs +0 -15
- package/dist/lib/node-esm/DeploymentDialog-XSP2EDU2.mjs +0 -125
- package/dist/lib/node-esm/DeploymentDialog-XSP2EDU2.mjs.map +0 -7
- package/dist/lib/node-esm/NotebookContainer-LNWMJD2D.mjs +0 -851
- package/dist/lib/node-esm/NotebookContainer-LNWMJD2D.mjs.map +0 -7
- package/dist/lib/node-esm/ScriptContainer-TSU4DBGA.mjs +0 -96
- package/dist/lib/node-esm/ScriptContainer-TSU4DBGA.mjs.map +0 -7
- package/dist/lib/node-esm/ScriptObjectSettings-OGY7X3UE.mjs +0 -298
- package/dist/lib/node-esm/ScriptObjectSettings-OGY7X3UE.mjs.map +0 -7
- package/dist/lib/node-esm/ScriptPluginSettings-HIUSAHCP.mjs +0 -56
- package/dist/lib/node-esm/ScriptPluginSettings-HIUSAHCP.mjs.map +0 -7
- package/dist/lib/node-esm/ScriptProperties-I6SC4P3R.mjs +0 -29
- package/dist/lib/node-esm/ScriptProperties-I6SC4P3R.mjs.map +0 -7
- package/dist/lib/node-esm/TestContainer-WKISNRNU.mjs +0 -62
- package/dist/lib/node-esm/TestContainer-WKISNRNU.mjs.map +0 -7
- package/dist/lib/node-esm/access-token-created-7CGU7FXD.mjs +0 -37
- package/dist/lib/node-esm/access-token-created-7CGU7FXD.mjs.map +0 -7
- package/dist/lib/node-esm/app-graph-builder-GNGOYXIU.mjs +0 -64
- package/dist/lib/node-esm/app-graph-builder-GNGOYXIU.mjs.map +0 -7
- package/dist/lib/node-esm/blueprint-definition-DTRGTRZA.mjs +0 -18
- package/dist/lib/node-esm/blueprint-definition-DTRGTRZA.mjs.map +0 -7
- package/dist/lib/node-esm/blueprints/index.mjs +0 -9
- package/dist/lib/node-esm/chunk-2NGQCFVE.mjs +0 -28
- package/dist/lib/node-esm/chunk-2NGQCFVE.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-4YAEFFW2.mjs +0 -12
- package/dist/lib/node-esm/chunk-4YAEFFW2.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-C3GH2SDF.mjs +0 -76
- package/dist/lib/node-esm/chunk-C3GH2SDF.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-CKYUNEE5.mjs +0 -10
- package/dist/lib/node-esm/chunk-CKYUNEE5.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.map +0 -7
- package/dist/lib/node-esm/chunk-L3JLWXB5.mjs +0 -33
- package/dist/lib/node-esm/chunk-L3JLWXB5.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-L55OBVT5.mjs +0 -53
- package/dist/lib/node-esm/chunk-L55OBVT5.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-P4Q2BPBB.mjs +0 -22
- package/dist/lib/node-esm/chunk-P4Q2BPBB.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-RN2SMYCL.mjs +0 -401
- package/dist/lib/node-esm/chunk-RN2SMYCL.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-RTM3D4T5.mjs +0 -181
- package/dist/lib/node-esm/chunk-RTM3D4T5.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-SV742UH7.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-Y5VWHRVU.mjs +0 -107
- package/dist/lib/node-esm/chunk-Y5VWHRVU.mjs.map +0 -7
- package/dist/lib/node-esm/compiler-QBWP7ERK.mjs +0 -99
- package/dist/lib/node-esm/compiler-QBWP7ERK.mjs.map +0 -7
- package/dist/lib/node-esm/create-script-TAJHVROB.mjs +0 -48
- package/dist/lib/node-esm/create-script-TAJHVROB.mjs.map +0 -7
- package/dist/lib/node-esm/index.mjs +0 -269
- package/dist/lib/node-esm/index.mjs.map +0 -7
- package/dist/lib/node-esm/meta.json +0 -1
- package/dist/lib/node-esm/operation-handler-OUROH3T7.mjs +0 -19
- package/dist/lib/node-esm/operation-handler-OUROH3T7.mjs.map +0 -7
- package/dist/lib/node-esm/operations/index.mjs +0 -15
- package/dist/lib/node-esm/react-surface-OJ55GFCP.mjs +0 -146
- package/dist/lib/node-esm/react-surface-OJ55GFCP.mjs.map +0 -7
- package/dist/lib/node-esm/settings-2TK3XPLD.mjs +0 -36
- package/dist/lib/node-esm/settings-2TK3XPLD.mjs.map +0 -7
- package/dist/lib/node-esm/templates/index.mjs +0 -11
- package/dist/lib/node-esm/templates/index.mjs.map +0 -7
- package/dist/lib/node-esm/types/index.mjs +0 -16
- package/dist/lib/node-esm/types/index.mjs.map +0 -7
- 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-handler/index.d.ts +0 -4
- package/dist/types/src/capabilities/operation-handler/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/operation-handler/operation-handler.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/containers/NotebookContainer/NotebookContainer.d.ts +0 -7
- package/dist/types/src/containers/NotebookContainer/NotebookContainer.d.ts.map +0 -1
- package/dist/types/src/containers/NotebookContainer/NotebookContainer.stories.d.ts +0 -7
- package/dist/types/src/containers/NotebookContainer/NotebookContainer.stories.d.ts.map +0 -1
- package/dist/types/src/containers/NotebookContainer/index.d.ts +0 -3
- package/dist/types/src/containers/NotebookContainer/index.d.ts.map +0 -1
- package/dist/types/src/containers/ScriptContainer/ScriptContainer.d.ts +0 -10
- package/dist/types/src/containers/ScriptContainer/ScriptContainer.d.ts.map +0 -1
- package/dist/types/src/containers/ScriptContainer/index.d.ts +0 -3
- package/dist/types/src/containers/ScriptContainer/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/operations/access-token-created.d.ts +0 -5
- package/dist/types/src/operations/access-token-created.d.ts.map +0 -1
- package/dist/types/src/operations/definitions.d.ts +0 -28
- package/dist/types/src/operations/definitions.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/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/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-handler/index.ts +0 -11
- package/src/capabilities/operation-handler/operation-handler.ts +0 -16
- package/src/capabilities/react-surface/index.ts +0 -7
- package/src/capabilities/react-surface/react-surface.tsx +0 -138
- package/src/capabilities/settings/index.ts +0 -7
- package/src/containers/NotebookContainer/index.ts +0 -7
- package/src/containers/ScriptContainer/index.ts +0 -7
- package/src/containers/ScriptObjectSettings/ScriptObjectSettings.tsx +0 -295
- 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/operations/access-token-created.ts +0 -36
- 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/operations → neutral}/index.mjs.map +0 -0
- /package/dist/lib/{browser/templates/index.mjs.map → neutral/meta.mjs.map} +0 -0
- /package/dist/lib/{browser/types → neutral/operations}/index.mjs.map +0 -0
- /package/dist/lib/{node-esm/blueprints → neutral/templates}/index.mjs.map +0 -0
- /package/dist/lib/{node-esm/operations → 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
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["raw-loader:/__w/dxos/dxos/packages/plugins/plugin-script/src/templates/anthropic.ts?raw", "raw-loader:/__w/dxos/dxos/packages/plugins/plugin-script/src/templates/chat.ts?raw", "raw-loader:/__w/dxos/dxos/packages/plugins/plugin-script/src/templates/chess-bot.ts?raw", "raw-loader:/__w/dxos/dxos/packages/plugins/plugin-script/src/templates/commentary.ts?raw", "raw-loader:/__w/dxos/dxos/packages/plugins/plugin-script/src/templates/data-generator.ts?raw", "raw-loader:/__w/dxos/dxos/packages/plugins/plugin-script/src/templates/discord.ts?raw", "raw-loader:/__w/dxos/dxos/packages/plugins/plugin-script/src/templates/email.ts?raw", "raw-loader:/__w/dxos/dxos/packages/plugins/plugin-script/src/templates/forex-effect.ts?raw", "raw-loader:/__w/dxos/dxos/packages/plugins/plugin-script/src/templates/forex.ts?raw", "raw-loader:/__w/dxos/dxos/packages/plugins/plugin-script/src/templates/gmail.ts?raw", "raw-loader:/__w/dxos/dxos/packages/plugins/plugin-script/src/templates/ping.ts?raw", "../../../src/templates/index.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as LanguageModel from '@effect/ai/LanguageModel';\nimport * as Chunk from 'effect/Chunk';\nimport * as Effect from 'effect/Effect';\nimport * as Schema from 'effect/Schema';\nimport * as Stream from 'effect/Stream';\n\nimport { AiService } from '@dxos/ai';\nimport { Operation } from '@dxos/operation';\n\nconst Anthropic = Operation.make({\n meta: {\n key: 'org.dxos.script.anthropic',\n name: 'Anthropic Chat',\n description: 'Chat with Anthropic',\n },\n input: Schema.Struct({\n message: Schema.String,\n }),\n output: Schema.Any,\n services: [AiService.AiService],\n});\n\nexport default Anthropic.pipe(\n Operation.withHandler(\n Effect.fn(function* ({ message }) {\n const model = (yield* AiService.AiService).model('@anthropic/claude-sonnet-4-5');\n\n //\n // Basic example.\n //\n const { text } = yield* LanguageModel.generateText({ prompt: message }).pipe(Effect.provide(model));\n\n //\n // Streaming example.\n //\n const parts = yield* LanguageModel.streamText({\n prompt: 'Count from 1 to 5, one number per line.',\n }).pipe(Stream.runCollect, Effect.map(Chunk.toArray), Effect.provide(model));\n const textDeltas = parts.filter((p) => p.type === 'text-delta');\n const fullText = textDeltas.map((p) => (p as { delta: string }).delta).join('');\n\n return { response: text, streamText: fullText };\n }),\n ),\n);\n", "//\n// Copyright 2024 DXOS.org\n//\n\n// @ts-ignore\nimport { transformServerSentEvents } from 'https://esm.sh/@dxos/script-toolbox?bundle=false';\n\n/**\n * Chatbot that answers questions based on the context data.\n */\nexport default async ({ data: { bodyText }, context: { space, ai } }: any) => {\n let parsedRequest: any;\n try {\n parsedRequest = JSON.parse(bodyText);\n } catch (err) {\n const answer = await ai.run('@cf/meta/llama-3.1-8b-instruct', {\n stream: true,\n prompt: `\n Using only the context data below to answer the user's question.\n If you cannot answer the question from the provided content, then reply with \"I don't know.\"\n\n CONTEXT:\n ${await getContext({ space })}\n\n QUESTION:\n ${bodyText}\n `,\n });\n return new Response(transformServerSentEvents(answer));\n }\n\n const promptId = parsedRequest.trigger.promptId;\n const promptObject = await space.crud.query({ id: promptId }).first();\n\n if (parsedRequest.data.objects.length !== 1) {\n return new Response('Message batches not supported.');\n }\n\n const messageId = parsedRequest.data.objects[0];\n let message;\n try {\n message = await space.crud.query({ id: messageId }).first();\n } catch (err) {\n return new Response('Message not replicated yet.', { status: 409 });\n }\n\n if (message.text.includes('--------')) {\n return new Response('Message was already processed.');\n }\n\n let prompt = promptObject.template;\n for (const input of promptObject.inputs) {\n let value: string | null = null;\n if (input.type === TemplateInputType.VALUE) {\n value = String(input.value);\n } else if (input.type === TemplateInputType.RETRIEVER) {\n value = await getContext({ space });\n } else if (input.type === TemplateInputType.PASS_THROUGH) {\n value = message.text;\n }\n if (value) {\n prompt = prompt.replaceAll(`{${input.name}}`, value);\n }\n }\n\n const answer = await ai.run('@cf/meta/llama-3.1-8b-instruct', {\n stream: false,\n prompt,\n });\n const response = { response: answer.response, prompt, message };\n const textWithAnswer = message.text + '\\n--------\\n\\n' + answer.response;\n await space.crud.update({ id: messageId }, { text: textWithAnswer });\n\n return new Response(JSON.stringify(response));\n};\n\nconst getContext = async ({ space }: any) => {\n let context = '';\n const { objects: docs } = await space.crud.query({ __typename: 'org.dxos.type.document' }).run();\n for (const doc of docs) {\n const { content } = await space.crud.query({ id: doc.content }).first();\n context += content + '\\n\\n';\n }\n return context;\n};\n\nenum TemplateInputType {\n VALUE = 0,\n PASS_THROUGH = 1,\n RETRIEVER = 2,\n FUNCTION = 3,\n QUERY = 4,\n RESOLVER = 5,\n CONTEXT = 6,\n SCHEMA = 7,\n}\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { Chess as ChessJS } from 'chess.js';\nimport * as Effect from 'effect/Effect';\nimport * as Schema from 'effect/Schema';\n\nimport { Database, Obj, Ref } from '@dxos/echo';\nimport { Operation } from '@dxos/operation';\nimport { Chess } from '@dxos/plugin-chess/types';\n\nconst ChessBot = Operation.make({\n meta: {\n key: 'org.dxos.script.chess-bot',\n name: 'Chess Bot',\n description: 'Plays a random move in a chess game.',\n },\n input: Schema.Struct({\n game: Ref.Ref(Chess.Game).annotations({\n description: 'The chess game to comment on.',\n }),\n player: Schema.optional(Schema.Literal('white', 'black')).annotations({\n description: 'The player to play the game as.',\n }),\n }),\n output: Schema.Struct({\n state: Schema.String.annotations({\n description: 'The state of the game as an ASCII art board.',\n }),\n }),\n types: [Chess.Game],\n services: [Database.Service],\n});\n\nexport default ChessBot.pipe(\n Operation.withHandler(\n Effect.fnUntraced(function* ({ game, player = 'black' }) {\n const loadedGame = yield* Database.load(game);\n const chess = new ChessJS();\n chess.loadPgn(loadedGame.pgn ?? '');\n if (chess.turn() !== (player === 'white' ? 'w' : 'b')) {\n return { state: chess.ascii() };\n }\n\n const moves = chess.moves({ verbose: true });\n const move = moves[Math.floor(Math.random() * moves.length)];\n if (!move) {\n return { state: chess.ascii() };\n }\n\n chess.move(move.san);\n const newPgn = chess.pgn();\n Obj.change(loadedGame, (obj) => {\n obj.pgn = newPgn;\n });\n yield* Database.flush();\n return { state: chess.ascii() };\n }),\n ),\n);\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport * as A from '@automerge/automerge';\nimport { Chess as ChessJS } from 'chess.js';\nimport * as Array from 'effect/Array';\nimport * as Effect from 'effect/Effect';\nimport * as Function from 'effect/Function';\nimport * as Layer from 'effect/Layer';\nimport * as Option from 'effect/Option';\nimport * as Schema from 'effect/Schema';\n\nimport { AiService, ConsolePrinter, ToolExecutionService, ToolResolverService } from '@dxos/ai';\nimport { AiSession, GenerationObserver } from '@dxos/assistant';\nimport { ArtifactId } from '@dxos/assistant';\nimport { Database, Filter, Obj, Ref, Relation } from '@dxos/echo';\nimport { Collection } from '@dxos/echo';\nimport { createDocAccessor } from '@dxos/echo-db';\nimport { FunctionInvocationService, TracingService } from '@dxos/functions';\nimport { log } from '@dxos/log';\nimport { Operation } from '@dxos/operation';\nimport { Chess } from '@dxos/plugin-chess/types';\nimport { Markdown } from '@dxos/plugin-markdown/types';\nimport { Text } from '@dxos/schema';\nimport { HasSubject } from '@dxos/types';\nimport { trim } from '@dxos/util';\n\nconst Commentary = Operation.make({\n meta: {\n key: 'org.dxos.function.chess.commentary',\n name: 'Commentary',\n description: 'Adds commentary about the most recent move to a markdown document associated with the chess game.',\n },\n input: Schema.Struct({\n game: Ref.Ref(Chess.Game).annotations({\n description: 'The chess game to comment on.',\n }),\n }),\n output: Schema.Union(\n Schema.Struct({\n documentId: ArtifactId.annotations({\n description: 'The ID of the markdown document that was updated or created.',\n }),\n commentary: Schema.String.annotations({\n description: 'The commentary that was added.',\n }),\n }),\n Schema.Void.annotations({\n description: 'Function did not find anything to comment on.',\n }),\n ),\n types: [Chess.Game, Markdown.Document, Text.Text, HasSubject.HasSubject, Collection.Collection],\n services: [AiService.AiService, Database.Service],\n});\n\nexport default Commentary.pipe(\n Operation.withHandler(\n Effect.fnUntraced(\n function* ({ game: gameRef }) {\n // Load the chess game\n log.info('load game', { gameRef });\n const chessGame = yield* Database.load(gameRef);\n\n // Load the chess position from PGN or FEN\n const chess = new ChessJS();\n if (chessGame.pgn) {\n chess.loadPgn(chessGame.pgn);\n } else if (chessGame.fen) {\n chess.load(chessGame.fen);\n } else {\n log.info('Early return: no pgn or fen');\n return;\n }\n\n // Get the most recent move\n const history = chess.history({ verbose: true });\n if (history.length === 0) {\n throw new Error('No moves have been played yet');\n }\n const lastMove = history[history.length - 1];\n const moveNumber = Math.ceil(history.length / 2);\n const isWhiteMove = history.length % 2 === 1;\n const player = isWhiteMove ? 'White' : 'Black';\n const moveNotation = lastMove.san;\n\n // Generate AI commentary about the move\n const result = yield* new AiSession({\n observer: GenerationObserver.fromPrinter(new ConsolePrinter({ tag: 'chess-commentary' })),\n }).run({\n prompt:\n `Comment on this chess move as if you're commentating a live match for an audience:\\n\\n` +\n `Move ${moveNumber}: ${player} plays ${moveNotation} (${lastMove.from} to ${lastMove.to})${lastMove.captured ? `, capturing ${lastMove.captured}` : ''}\\n` +\n `Current position: ${chess.fen()}\\n` +\n `${chess.isCheck() ? 'The king is in check! ' : ''}` +\n `${chess.isCheckmate() ? 'CHECKMATE! ' : ''}` +\n `${chess.isStalemate() ? 'STALEMATE! ' : ''}` +\n `\\nGame so far:\\n${chess.pgn()}`,\n system: COMMENTARY_SYSTEM_PROMPT,\n history: [],\n });\n\n const commentaryText = Function.pipe(\n result,\n Array.findLast((msg) => msg.sender.role === 'assistant' && msg.blocks.some((block) => block._tag === 'text')),\n Option.flatMap((msg) =>\n Function.pipe(\n msg.blocks,\n Array.findLast((block) => block._tag === 'text'),\n Option.map((block) => block.text),\n ),\n ),\n Option.getOrThrowWith(() => new Error('No commentary generated')),\n );\n\n const commentary = `## Move ${moveNumber}: ${player} plays ${moveNotation}\\n\\n${commentaryText}\\n\\n`;\n log.info('commentary', { commentary });\n\n // TODO(wittjosiah): Functions currently don't support traversals.\n // const docs = yield* Database.runQuery(\n // Query.select(Filter.id(chessGame.id)).targetOf(HasSubject.HasSubject).source(),\n // ).pipe(Effect.map((objects) => objects.filter((object) => Obj.instanceOf(Markdown.Document, object))));\n const docs = yield* Database.runQuery(Filter.type(HasSubject.HasSubject)).pipe(\n Effect.map((relations) =>\n relations.filter((relation) => {\n // TODO(wittjosiah): This is a workaround for getTarget not handling deleted objects.\n try {\n log.info('relation', {\n source: Obj.getDXN(Relation.getTarget(relation)).toString(),\n game: Obj.getDXN(chessGame).toString(),\n });\n return Obj.getDXN(Relation.getTarget(relation)).toString() === Obj.getDXN(chessGame).toString();\n } catch {\n return false;\n }\n }),\n ),\n Effect.map((relations) =>\n relations\n .map((relation) => {\n // TODO(wittjosiah): This is a workaround for getSource not handling deleted objects.\n try {\n return Relation.getSource(relation);\n } catch {\n return undefined;\n }\n })\n .filter((source) => source !== undefined),\n ),\n Effect.map((sources) => {\n const docs = sources.filter((source) => Obj.instanceOf(Markdown.Document, source));\n log.info('docs', { sources, docs });\n return docs;\n }),\n );\n log.info('docs', { count: docs.length });\n\n let document: Markdown.Document;\n if (docs.length === 0) {\n // TODO(wittjosiah): Deploy fails if `SpaceProperties` schema is imported because its from `client-protocol`.\n const [properties] = yield* Database.runQuery(Filter.typename('org.dxos.type.space-properties'));\n const rootCollection = yield* Database.load<Collection.Collection>(\n properties[Collection.Collection.typename],\n );\n\n log.info('rootCollection', { rootCollection });\n\n // Create a new markdown document\n const gameName = chessGame.name || 'Chess Game';\n document = yield* Database.add(\n Markdown.make({\n name: `${gameName} Commentary`,\n content: `# ${gameName} Commentary\\n\\n${commentary}`,\n }),\n );\n\n const documentRef = Ref.make(document);\n Obj.change(rootCollection, (obj) => {\n obj.objects.push(documentRef);\n });\n\n // Create the HasSubject relation\n yield* Database.add(\n Relation.make(HasSubject.HasSubject, {\n [Relation.Source]: document,\n [Relation.Target]: chessGame,\n completedAt: new Date().toISOString(),\n }),\n );\n } else {\n document = docs[0];\n\n // Load the text content and append the commentary\n const text = yield* Database.load(document.content);\n const accessor = createDocAccessor(text, ['content']);\n accessor.handle.change((doc: A.Doc<Text.Text>) => {\n A.splice(doc, accessor.path.slice(), text.content.length, 0, commentary);\n });\n }\n\n log.info('result', { documentId: Obj.getDXN(document).toString(), commentary });\n\n yield* Database.flush();\n\n return {\n documentId: Obj.getDXN(document).toString(),\n commentary,\n };\n },\n Effect.provide(\n Layer.mergeAll(\n AiService.model('@anthropic/claude-haiku-4-5'),\n ToolResolverService.layerEmpty,\n ToolExecutionService.layerEmpty,\n TracingService.layerNoop,\n FunctionInvocationService.layerNotAvailable,\n ),\n ),\n ),\n ),\n);\n\nconst COMMENTARY_SYSTEM_PROMPT = trim`\n You are a professional chess commentator providing live commentary for a chess match.\n\n # Style\n - Write in an engaging, enthusiastic style as if commentating for a live audience\n - Be concise but informative (2-4 sentences)\n - Explain the strategic implications of the move\n - Note any tactical elements (captures, threats, checks)\n - Comment on the position and what it means for the game\n\n # Format\n - Write in plain text (no markdown formatting in the commentary itself)\n - Be natural and conversational\n - Use chess terminology appropriately but keep it accessible\n\n # Special Situations\n - If it's checkmate, express excitement about the conclusion\n - If it's check, note the pressure on the king\n - If a piece is captured, mention the material exchange\n - Comment on the development of pieces and control of key squares when relevant\n`;\n", "//\n// Copyright 2025 DXOS.org\n//\n\n// @ts-ignore\nimport { Expando, S, create, defineFunction } from 'dxos:functions';\n// @ts-ignore\nimport { randText } from 'https://esm.sh/@ngneat/falso@7.1.1?bundle=false';\n\nexport default defineFunction({\n key: 'org.dxos.script.data-generator',\n name: 'Data Generator',\n inputSchema: S.Struct({\n documentAmount: S.optional(S.Number),\n textSize: S.optional(S.Number),\n mutationAmount: S.optional(S.Number),\n waitAfterCreation: S.optional(S.Number),\n }),\n\n outputSchema: S.Struct({}),\n\n handler: async ({\n data: { documentAmount = 1, textSize = 10, mutationAmount = 0, waitAfterCreation = 10_000 },\n context: { space },\n }: any) => {\n await space.db.graph.schemaRegistry.register([Expando]);\n const result: Record<string, any> = {};\n const objects: Expando[] = [];\n\n // Create objects.\n for (let i = 0; i < documentAmount; i++) {\n const obj = space.db.add(\n create(Expando, {\n name: 'scriptGenerated',\n content: randText({ charCount: textSize }),\n }),\n );\n objects.push(obj);\n const objectResult: any = {};\n // Mutate the object.\n for (let i = 0; i < mutationAmount; i++) {\n obj.content = randText({ charCount: textSize });\n }\n objectResult.mutations = mutationAmount;\n objectResult.contentLength = obj.content.length;\n result[obj.id] = objectResult;\n }\n\n // Flush and wait for data to propagate.\n await space.db.flush();\n await new Promise((resolve) => setTimeout(resolve, waitAfterCreation));\n return { createdObjects: objects.length };\n },\n});\n", "//\n// Copyright 2025 DXOS.org\n//\n\n// @ts-ignore\nimport { DXN, EchoObject, Filter, ObjectId, S, create, defineFunction } from 'dxos:functions';\n// @ts-ignore\nimport { FetchHttpClient } from 'https://esm.sh/@effect/platform@0.89.0?deps=effect@3.17.0&bundle=false';\nimport {\n DiscordConfig,\n DiscordREST,\n DiscordRESTMemoryLive,\n // @ts-ignore\n} from 'https://esm.sh/dfx@0.113.0?deps=effect@3.17.0&bundle=false';\n// @ts-ignore\nimport * as Config from 'https://esm.sh/effect@3.17.0/Config?bundle=false';\n// @ts-ignore\nimport * as Effect from 'https://esm.sh/effect@3.17.0/Effect?bundle=false';\n// @ts-ignore\nimport * as Redacted from 'https://esm.sh/effect@3.17.0/Redacted?bundle=false';\n// @ts-ignore\nimport * as Ref from 'https://esm.sh/effect@3.17.0/Ref?bundle=false';\n\nconst MessageSchema = S.Struct({\n id: ObjectId,\n foreignId: S.Any, // bigint?\n from: S.String,\n created: S.String,\n content: S.String,\n}).pipe(\n EchoObject({\n typename: 'com.example.type.message',\n version: '0.1.0',\n }),\n);\n\nconst DEFAULT_AFTER = 1704067200; // 2024-01-01\n\nconst generateSnowflake = (unixTimestamp: number): bigint => {\n const discordEpoch = 1420070400000n; // Discord Epoch (ms)\n return (BigInt(unixTimestamp * 1000) - discordEpoch) << 22n;\n};\n\nexport default defineFunction({\n key: 'org.dxos.script.discord',\n name: 'Discord',\n inputSchema: S.Struct({\n // TODO(wittjosiah): Remove. This is used to provide a terminal for a cron trigger.\n tick: S.optional(S.String),\n channelId: S.String,\n after: S.optional(S.Number),\n pageSize: S.optional(S.Number),\n queueId: S.String,\n }),\n\n outputSchema: S.Struct({\n newMessages: S.Number,\n }),\n\n handler: ({ data: { channelId, queueId, after = DEFAULT_AFTER, pageSize = 5 }, context: { space } }: any) =>\n Effect.gen(function* () {\n const { token } = yield* Effect.tryPromise({\n try: () => space.db.query(Filter.typename('org.dxos.type.access-token', { source: 'discord.com' })).first(),\n catch: (e: any) => e,\n });\n const { objects } = yield* Effect.tryPromise({\n try: () => space.queues.queryQueue(DXN.parse(queueId)),\n catch: (e: any) => e,\n });\n const backfill = objects.length === 0;\n const newMessages = yield* Ref.make(0);\n const lastMessage = yield* Ref.make(objects.at(-1));\n\n const enqueueMessages = Effect.gen(function* () {\n const rest = yield* DiscordREST;\n\n while (true) {\n const last = yield* Ref.get(lastMessage);\n const options = {\n after: backfill && !last ? `${generateSnowflake(after)}` : last?.foreignId,\n limit: pageSize,\n };\n const messages = yield* rest.getChannelMessages(channelId, options).pipe((res: any) => res.json);\n const queueMessages = messages\n .map((message: any) =>\n create(MessageSchema, {\n id: ObjectId.random(),\n foreignId: message.id,\n from: message.author.username,\n created: message.timestamp,\n content: message.content,\n }),\n )\n .toReversed();\n if (queueMessages.length > 0) {\n yield* Effect.tryPromise({\n try: () => space.queues.insertIntoQueue(DXN.parse(queueId), queueMessages),\n catch: (e: any) => e,\n });\n yield* Ref.update(newMessages, (n: any) => n + queueMessages.length);\n yield* Ref.update(lastMessage, (m: any) => queueMessages.at(-1));\n }\n if (messages.length < pageSize) {\n break;\n }\n }\n }).pipe(\n Effect.provide(DiscordRESTMemoryLive),\n Effect.provide(\n DiscordConfig.layerConfig({\n token: Config.succeed(Redacted.make(token)),\n }),\n ),\n Effect.provide(FetchHttpClient.layer),\n );\n\n yield* enqueueMessages;\n return { newMessages: yield* Ref.get(newMessages) };\n }),\n});\n", "//\n// Copyright 2024 DXOS.org\n//\n\n/**\n * Appends a message to the end of a Document configured through a trigger.\n * Trigger must have a targetDocumentId field set in Meta.\n */\nexport default async ({ data: { bodyText }, context: { space } }: any) => {\n const { email, targetDocumentId: documentId } = JSON.parse(bodyText) as RequestPayload;\n\n const document = await space.db.query({ id: documentId }).first();\n\n const contentId = document.content['/'].split(':')[3];\n const documentContent = await space.db.query({ id: contentId }).first();\n const modifiedContent = [\n documentContent.content,\n '',\n '---',\n `**From:** ${email.from}`,\n `**Subject:** ${email.subject}`,\n `**Date:** ${email.created}`,\n '',\n email.body,\n ].join('\\n');\n\n await space.db.update({ id: contentId }, { content: modifiedContent });\n\n return new Response(JSON.stringify({ success: true }));\n};\n\ntype RequestPayload = {\n email: { from: string; subject: string; created: string; body: string };\n targetDocumentId: string;\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport * as FetchHttpClient from '@effect/platform/FetchHttpClient';\nimport * as HttpClient from '@effect/platform/HttpClient';\nimport * as HttpClientRequest from '@effect/platform/HttpClientRequest';\nimport * as Effect from 'effect/Effect';\nimport * as Schedule from 'effect/Schedule';\nimport * as Schema from 'effect/Schema';\n\nimport { Operation } from '@dxos/operation';\n\nconst ForexEffect = Operation.make({\n meta: {\n key: 'org.dxos.script.forex-effect',\n name: 'Forex Effect',\n description: 'Returns the exchange rate between two currencies.',\n },\n input: Schema.Struct({\n from: Schema.String.annotations({ description: 'The source currency' }),\n to: Schema.String.annotations({ description: 'The target currency' }),\n }),\n output: Schema.Any,\n});\n\nexport default ForexEffect.pipe(\n Operation.withHandler(\n Effect.fnUntraced(function* ({ from: rawFrom, to: rawTo }) {\n const from = rawFrom.toUpperCase();\n const to = rawTo.toUpperCase();\n const json: any = yield* HttpClientRequest.get(`https://free.ratesdb.com/v1/rates?from=${from}&to=${to}`).pipe(\n HttpClient.execute,\n Effect.flatMap((response) => response.json),\n Effect.timeout('5 seconds'),\n Effect.retry(Schedule.exponential(1_000).pipe(Schedule.compose(Schedule.recurs(3)))),\n Effect.scoped,\n );\n\n const rate = json?.data?.rates?.[to];\n if (rate == null) {\n return yield* Effect.fail(new Error(`No rate found for ${from} -> ${to}`));\n }\n\n return rate.toString();\n }, Effect.provide(FetchHttpClient.layer)),\n ),\n);\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\nimport * as Schema from 'effect/Schema';\n\nimport { Operation } from '@dxos/operation';\n\nconst Forex = Operation.make({\n meta: {\n key: 'org.dxos.script.forex',\n name: 'Forex',\n description: 'Returns the exchange rate between two currencies.',\n },\n input: Schema.Struct({\n from: Schema.String.annotations({ description: 'The source currency' }),\n to: Schema.String.annotations({ description: 'The target currency' }),\n }),\n output: Schema.Any,\n});\n\nexport default Forex.pipe(\n Operation.withHandler(\n Effect.fn(function* ({ from: rawFrom, to: rawTo }) {\n const from = rawFrom.toUpperCase();\n const to = rawTo.toUpperCase();\n const res = yield* Effect.promise(() => fetch(`https://free.ratesdb.com/v1/rates?from=${from}&to=${to}`));\n const {\n data: { rates },\n } = yield* Effect.promise(() => res.json());\n\n return rates[to].toString();\n }),\n ),\n);\n", "//\n// Copyright 2025 DXOS.org\n//\n\n// @ts-ignore\nimport { EchoObject, Filter, ObjectId, S, create, defineFunction } from 'dxos:functions';\n// @ts-ignore\nimport {\n FetchHttpClient,\n HttpClient,\n HttpClientRequest,\n // @ts-ignore\n} from 'https://esm.sh/@effect/platform@0.89.0?deps=effect@3.17.0&bundle=false';\n// @ts-ignore\nimport { format, subDays } from 'https://esm.sh/date-fns@3.3.1?bundle=false';\n// @ts-ignore\nimport * as Chunk from 'https://esm.sh/effect@3.17.0/Chunk?bundle=false';\n// @ts-ignore\nimport * as Effect from 'https://esm.sh/effect@3.17.0/Effect?bundle=false';\n// @ts-ignore\nimport * as Function from 'https://esm.sh/effect@3.17.0/Function?bundle=false';\n// @ts-ignore\nimport * as Ref from 'https://esm.sh/effect@3.17.0/Ref?bundle=false';\n// @ts-ignore\nimport * as Schedule from 'https://esm.sh/effect@3.17.0/Schedule?bundle=false';\n// @ts-ignore\nimport * as Stream from 'https://esm.sh/effect@3.17.0/Stream?bundle=false';\n\nexport default defineFunction({\n key: 'org.dxos.script.gmail',\n name: 'Gmail',\n inputSchema: S.Struct({\n mailboxId: S.String,\n userId: S.optional(S.String).pipe(S.withDecodingDefault(() => 'me')),\n after: S.optional(S.Union(S.Number, S.String)).pipe(\n S.withDecodingDefault(() => format(subDays(new Date(), 30), 'yyyy-MM-dd')),\n ),\n pageSize: S.optional(S.Number).pipe(S.withDecodingDefault(() => 100)),\n // TODO(wittjosiah): Remove. This is used to provide a terminal for a cron trigger.\n tick: S.optional(S.String),\n }),\n\n outputSchema: S.Struct({\n newMessages: S.Number,\n }),\n\n handler: ({ context: { space }, data: { mailboxId, userId, after, pageSize } }: any) =>\n Effect.gen(function* () {\n const { token } = yield* Effect.tryPromise({\n try: () => space.db.query(Filter.typename('org.dxos.type.access-token', { source: 'gmail.com' })).first(),\n catch: (e: any) => e,\n });\n\n // NOTE: Google API bundles size is v. large and caused runtime issues.\n const makeRequest = (url: string) =>\n Function.pipe(\n url,\n HttpClientRequest.get,\n HttpClientRequest.setHeaders({ Authorization: `Bearer ${token}`, Accept: 'application/json' }),\n HttpClient.execute,\n Effect.flatMap((res: any) => res.json),\n Effect.timeout('1 second'),\n Effect.retry(Schedule.exponential(1000).pipe(Schedule.compose(Schedule.recurs(3)))),\n Effect.scoped,\n );\n\n const listMessages = (userId: string, q: string, pageSize: number, pageToken: string | null) =>\n makeRequest(getUrl(userId, undefined, { q, pageSize, pageToken }));\n\n const getMessage = (userId: string, messageId: string) => makeRequest(getUrl(userId, messageId));\n\n const mailbox = yield* Effect.tryPromise({\n try: () => space.db.query({ id: mailboxId }).first(),\n catch: (e: any) => e,\n });\n const { objects } = yield* Effect.tryPromise({\n try: () => space.queues.queryQueue(mailbox.queue.dxn),\n catch: (e: any) => e,\n });\n const newMessages = yield* Ref.make([]);\n const nextPage = yield* Ref.make(null);\n\n do {\n const last = objects.at(-1);\n const q = last\n ? `in:inbox after:${Math.floor(new Date(last.created).getTime() / 1000)}`\n : `in:inbox after:${after}`;\n const pageToken = yield* Ref.get(nextPage);\n const { messages, nextPageToken } = yield* listMessages(userId, q, pageSize, pageToken);\n yield* Ref.update(nextPage, () => nextPageToken);\n for (const message of messages) {\n const messageDetails = yield* getMessage(userId, message.id);\n const created = new Date(parseInt(messageDetails.internalDate)).toISOString();\n const from = messageDetails.payload.headers.find((h: any) => h.name === 'From');\n const sender = from && parseFromHeader(from.value);\n // TODO(wittjosiah): Improve parsing of email contents.\n const content =\n messageDetails.payload.body?.data ??\n messageDetails.payload.parts?.find((p: any) => p.mimeType === 'text/plain')?.body.data;\n // Skip the message if content or sender is missing.\n // Skip the message if it's the same as the last message.\n // TODO(wittjosiah): This comparison should be done via foreignId probably.\n if (!content || !sender || created === last?.created) {\n continue;\n }\n const subject = messageDetails.payload.headers.find((h: any) => h.name === 'Subject')?.value;\n const object = create(MessageType, {\n id: ObjectId.random(),\n created,\n sender,\n blocks: [\n {\n _tag: 'text',\n text: Buffer.from(content, 'base64').toString('utf-8'),\n },\n ],\n properties: {\n subject,\n threadId: message.threadId,\n },\n });\n // TODO(wittjosiah): Set foreignId in object meta.\n yield* Ref.update(newMessages, (n: any) => [object, ...n]);\n }\n } while (yield* Ref.get(nextPage));\n\n const queueMessages = yield* Ref.get(newMessages);\n if (queueMessages.length > 0) {\n yield* Function.pipe(\n queueMessages,\n Stream.fromIterable,\n Stream.grouped(10),\n Stream.flatMap((batch: any) =>\n Effect.tryPromise({\n try: () => space.queues.insertIntoQueue(mailbox.queue.dxn, Chunk.toReadonlyArray(batch)),\n catch: (e: any) => e,\n }),\n ),\n Stream.runDrain,\n );\n }\n\n return { newMessages: queueMessages.length };\n }).pipe(Effect.provide(FetchHttpClient.layer)),\n});\n\nconst getUrl = (userId: string, messageId?: string, params?: Record<string, any>) => {\n const api = new URL(\n [`https://gmail.googleapis.com/gmail/v1/users/${userId}/messages`, messageId].filter(Boolean).join('/'),\n );\n Object.entries(params ?? {})\n .filter(([_, value]) => value != null)\n .forEach(([key, value]) => api.searchParams.set(key, value));\n return api.toString();\n};\n\n/**\n * Parses an email string in the format \"Name <email@example.com>\" into separate name and email components.\n */\nconst parseFromHeader = (value: string): { name?: string; email: string } | undefined => {\n const EMAIL_REGEX = /^([^<]+?)\\s*<([^>]+@[^>]+)>$/;\n const removeOuterQuotes = (str: string) => str.replace(/^['\"]|['\"]$/g, '');\n const match = value.match(EMAIL_REGEX);\n if (match) {\n const [, name, email] = match;\n return {\n name: removeOuterQuotes(name.trim()),\n email: email.trim(),\n };\n }\n};\n\n//\n// Schemas\n// TODO(wittjosiah): These schemas should be imported from @dxos/schema.\n//\n\nconst ActorRole = S.Literal('user', 'assistant');\ntype ActorRole = S.Schema.Type<typeof ActorRole>;\n\nconst ActorSchema = S.Struct({\n identityKey: S.optional(S.String),\n email: S.optional(S.String),\n name: S.optional(S.String),\n role: S.optional(ActorRole),\n});\n\nconst Base = S.Struct({\n pending: S.optional(S.Boolean),\n});\ntype Base = S.Schema.Type<typeof Base>;\nconst Text = S.TaggedStruct('text', {\n mimeType: S.optional(S.String),\n text: S.String,\n ...Base.fields,\n}).pipe(S.mutable);\ninterface Text extends S.Schema.Type<typeof Text> {}\n\nconst MessageType = S.Struct({\n id: ObjectId,\n created: S.String.annotations({\n description: 'ISO date string when the message was sent.',\n }),\n sender: ActorSchema.annotations({\n description: 'Identity of the message sender.',\n }),\n blocks: S.Array(Text).annotations({\n description: 'Contents of the message.',\n }),\n properties: S.optional(\n S.mutable(\n S.Record({ key: S.String, value: S.Any }).annotations({\n description: 'Custom properties for specific message types (e.g. attention context, email subject, etc.).',\n }),\n ),\n ),\n}).pipe(\n EchoObject({\n typename: 'org.dxos.type.message',\n version: '0.1.0',\n }),\n);\ntype MessageType = S.Schema.Type<typeof MessageType>;\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\nimport * as Schema from 'effect/Schema';\n\nimport { Operation } from '@dxos/operation';\n\nconst Ping = Operation.make({\n meta: {\n key: 'org.dxos.script.ping',\n name: 'Ping',\n },\n input: Schema.Any,\n output: Schema.Any,\n});\n\nexport default Ping.pipe(\n Operation.withHandler(\n Effect.fn(function* (data) {\n return data;\n }),\n ),\n);\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport anthropic from './anthropic.ts?raw';\nimport chat from './chat.ts?raw';\nimport chessBot from './chess-bot.ts?raw';\nimport commentary from './commentary.ts?raw';\nimport dataGenerator from './data-generator.ts?raw';\nimport discord from './discord.ts?raw';\nimport email from './email.ts?raw';\nimport forexEffect from './forex-effect.ts?raw';\nimport forex from './forex.ts?raw';\nimport gmail from './gmail.ts?raw';\nimport ping from './ping.ts?raw';\n\nconst removeHeader = (str: string) => str.split('\\n').slice(4).join('\\n');\n\nexport { dataGenerator };\n\nexport type Template = {\n id: string;\n name: string;\n source: string;\n presetId?: string;\n};\n\nexport const templates = [\n {\n id: 'org.dxos.script.ping',\n name: 'Ping',\n source: removeHeader(ping),\n },\n {\n id: 'org.dxos.script.forex',\n name: 'Forex',\n source: removeHeader(forex),\n },\n {\n id: 'org.dxos.script.forex-effect',\n name: 'Forex (Effect)',\n source: removeHeader(forexEffect),\n },\n {\n id: 'org.dxos.script.gpt',\n name: 'Gpt',\n source: removeHeader(chat),\n presetId: 'org.dxos.function.gpt',\n },\n {\n id: 'org.dxos.script.chess-bot',\n name: 'Chess Bot',\n source: removeHeader(chessBot),\n presetId: 'org.dxos.function.chess-bot',\n },\n {\n id: 'org.dxos.script.email',\n name: 'Email',\n source: removeHeader(email),\n presetId: 'org.dxos.function.email',\n },\n {\n id: 'org.dxos.script.discord',\n name: 'Discord',\n source: removeHeader(discord),\n presetId: 'org.dxos.function.discord',\n },\n {\n id: 'org.dxos.script.gmail',\n name: 'Gmail',\n source: removeHeader(gmail),\n presetId: 'org.dxos.function.gmail',\n },\n {\n id: 'org.dxos.script.data-generator',\n name: 'Data Generator',\n source: removeHeader(dataGenerator),\n presetId: 'org.dxos.function.data-generator',\n },\n {\n id: 'org.dxos.script.anthropic',\n name: 'Anthropic',\n source: removeHeader(anthropic),\n },\n {\n id: 'org.dxos.script.commentary',\n name: 'Commentary',\n source: removeHeader(commentary),\n presetId: 'org.dxos.function.chess.commentary',\n },\n] as const;\n"],
|
|
5
|
-
"mappings": ";;;AAAA;;;ACAA;;;ACAA;;;ACAA;;;ACAA;;;ACAA;;;ACAA;;;ACAA;;;ACAA;;;ACAA;;;ACAA;;;ACgBA,IAAMA,eAAe,CAACC,QAAgBA,IAAIC,MAAM,IAAA,EAAMC,MAAM,CAAA,EAAGC,KAAK,IAAA;AAW7D,IAAMC,YAAY;EACvB;IACEC,IAAI;IACJC,MAAM;IACNC,QAAQC,aAAaC,YAAAA;EACvB;EACA;IACEJ,IAAI;IACJC,MAAM;IACNC,QAAQC,aAAaE,aAAAA;EACvB;EACA;IACEL,IAAI;IACJC,MAAM;IACNC,QAAQC,aAAaG,oBAAAA;EACvB;EACA;IACEN,IAAI;IACJC,MAAM;IACNC,QAAQC,aAAaI,YAAAA;IACrBC,UAAU;EACZ;EACA;IACER,IAAI;IACJC,MAAM;IACNC,QAAQC,aAAaM,iBAAAA;IACrBD,UAAU;EACZ;EACA;IACER,IAAI;IACJC,MAAM;IACNC,QAAQC,aAAaO,aAAAA;IACrBF,UAAU;EACZ;EACA;IACER,IAAI;IACJC,MAAM;IACNC,QAAQC,aAAaQ,eAAAA;IACrBH,UAAU;EACZ;EACA;IACER,IAAI;IACJC,MAAM;IACNC,QAAQC,aAAaS,aAAAA;IACrBJ,UAAU;EACZ;EACA;IACER,IAAI;IACJC,MAAM;IACNC,QAAQC,aAAaU,sBAAAA;IACrBL,UAAU;EACZ;EACA;IACER,IAAI;IACJC,MAAM;IACNC,QAAQC,aAAaW,iBAAAA;EACvB;EACA;IACEd,IAAI;IACJC,MAAM;IACNC,QAAQC,aAAaY,kBAAAA;IACrBP,UAAU;EACZ;;",
|
|
6
|
-
"names": ["removeHeader", "str", "split", "slice", "join", "templates", "id", "name", "source", "removeHeader", "ping", "forex", "forexEffect", "chat", "presetId", "chessBot", "email", "discord", "gmail", "dataGenerator", "anthropic", "commentary"]
|
|
7
|
-
}
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
|
-
import {
|
|
3
|
-
Compiler
|
|
4
|
-
} from "./chunk-JGN7TDJH.mjs";
|
|
5
|
-
import {
|
|
6
|
-
ScriptCapabilities
|
|
7
|
-
} from "./chunk-C3GH2SDF.mjs";
|
|
8
|
-
import "./chunk-L3JLWXB5.mjs";
|
|
9
|
-
import "./chunk-HSLMI22Q.mjs";
|
|
10
|
-
|
|
11
|
-
// src/capabilities/compiler/compiler.ts
|
|
12
|
-
import * as FetchHttpClient from "@effect/platform/FetchHttpClient";
|
|
13
|
-
import * as HttpClient from "@effect/platform/HttpClient";
|
|
14
|
-
import * as Effect from "effect/Effect";
|
|
15
|
-
import * as Schedule from "effect/Schedule";
|
|
16
|
-
import * as Schema from "effect/Schema";
|
|
17
|
-
import wasmUrl from "esbuild-wasm/esbuild.wasm?url";
|
|
18
|
-
import * as ts from "typescript";
|
|
19
|
-
import { Capability } from "@dxos/app-framework";
|
|
20
|
-
import { initializeBundler } from "@dxos/functions-runtime/bundler";
|
|
21
|
-
import { log } from "@dxos/log";
|
|
22
|
-
import { trim } from "@dxos/util";
|
|
23
|
-
var __dxlog_file = "/__w/dxos/dxos/packages/plugins/plugin-script/src/capabilities/compiler/compiler.ts";
|
|
24
|
-
var SCRIPT_PACKAGES_BUCKET = "https://pub-5745ae82e450484aa28f75fc6a175935.r2.dev/dev/";
|
|
25
|
-
var DECLARATION_EXTS = [
|
|
26
|
-
".d.ts",
|
|
27
|
-
".d.mts"
|
|
28
|
-
];
|
|
29
|
-
var NO_TYPES = true;
|
|
30
|
-
var compiler_default = Capability.makeModule(() => Effect.gen(function* () {
|
|
31
|
-
yield* Effect.tryPromise(() => initializeBundler({
|
|
32
|
-
wasmUrl
|
|
33
|
-
}));
|
|
34
|
-
const runtimeModules = yield* fetchRuntimeModules().pipe(Effect.provide(FetchHttpClient.layer));
|
|
35
|
-
const compiler = new Compiler({
|
|
36
|
-
skipLibCheck: true,
|
|
37
|
-
moduleResolution: ts.ModuleResolutionKind.Bundler,
|
|
38
|
-
allowImportingTsExtensions: true,
|
|
39
|
-
noEmit: true,
|
|
40
|
-
strict: true,
|
|
41
|
-
esModuleInterop: true,
|
|
42
|
-
paths: Object.fromEntries(runtimeModules.map((mod) => [
|
|
43
|
-
mod.moduleName,
|
|
44
|
-
[
|
|
45
|
-
`./src/${mod.filename}`
|
|
46
|
-
]
|
|
47
|
-
]))
|
|
48
|
-
});
|
|
49
|
-
yield* Effect.tryPromise(() => compiler.initialize(trim`
|
|
50
|
-
declare module 'https://*';
|
|
51
|
-
${NO_TYPES ? "" : 'declare module "*";'}
|
|
52
|
-
`));
|
|
53
|
-
if (!NO_TYPES) {
|
|
54
|
-
for (const mod of runtimeModules) {
|
|
55
|
-
compiler.setFile(`/src/${mod.filename}`, mod.content);
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
return Capability.contributes(ScriptCapabilities.Compiler, compiler);
|
|
59
|
-
}));
|
|
60
|
-
var fetchRuntimeModules = Effect.fnUntraced(function* () {
|
|
61
|
-
const manifest = yield* HttpClient.get(new URL("manifest.json", SCRIPT_PACKAGES_BUCKET)).pipe(Effect.flatMap((_) => _.json), Effect.flatMap(Schema.decodeUnknown(Schema.Struct({
|
|
62
|
-
files: Schema.Array(Schema.Struct({
|
|
63
|
-
key: Schema.String
|
|
64
|
-
}))
|
|
65
|
-
}))), Effect.map((manifest2) => ({
|
|
66
|
-
...manifest2,
|
|
67
|
-
files: manifest2.files.map((f) => f.key)
|
|
68
|
-
})));
|
|
69
|
-
const declarationFiles = manifest.files.filter((file) => DECLARATION_EXTS.some((ext) => file.endsWith(ext)));
|
|
70
|
-
let fetched = 0;
|
|
71
|
-
const modules = yield* Effect.forEach(declarationFiles, Effect.fnUntraced(function* (filename) {
|
|
72
|
-
const response = yield* HttpClient.get(new URL(filename, SCRIPT_PACKAGES_BUCKET)).pipe(Effect.retry(Schedule.exponential(1e3).pipe(Schedule.compose(Schedule.recurs(3)))));
|
|
73
|
-
const content = yield* response.text;
|
|
74
|
-
const moduleName = filename.replace(/\.d\.(ts|mts)$/, "");
|
|
75
|
-
fetched++;
|
|
76
|
-
return {
|
|
77
|
-
moduleName,
|
|
78
|
-
filename,
|
|
79
|
-
content
|
|
80
|
-
};
|
|
81
|
-
}, Effect.retry(Schedule.exponential(1e3).pipe(Schedule.compose(Schedule.recurs(3))))), {
|
|
82
|
-
concurrency: 20
|
|
83
|
-
});
|
|
84
|
-
log.info("runtime modules", {
|
|
85
|
-
manifest: manifest.files.length,
|
|
86
|
-
files: declarationFiles.length,
|
|
87
|
-
fetched
|
|
88
|
-
}, {
|
|
89
|
-
F: __dxlog_file,
|
|
90
|
-
L: 101,
|
|
91
|
-
S: this,
|
|
92
|
-
C: (f, a) => f(...a)
|
|
93
|
-
});
|
|
94
|
-
return modules;
|
|
95
|
-
});
|
|
96
|
-
export {
|
|
97
|
-
compiler_default as default
|
|
98
|
-
};
|
|
99
|
-
//# sourceMappingURL=compiler-QBWP7ERK.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/capabilities/compiler/compiler.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as FetchHttpClient from '@effect/platform/FetchHttpClient';\nimport * as HttpClient from '@effect/platform/HttpClient';\nimport * as Effect from 'effect/Effect';\nimport * as Schedule from 'effect/Schedule';\nimport * as Schema from 'effect/Schema';\nimport wasmUrl from 'esbuild-wasm/esbuild.wasm?url';\nimport * as ts from 'typescript';\n\nimport { Capability } from '@dxos/app-framework';\nimport { initializeBundler } from '@dxos/functions-runtime/bundler';\nimport { log } from '@dxos/log';\nimport { trim } from '@dxos/util';\n\nimport { Compiler } from '../../compiler';\nimport { ScriptCapabilities } from '../../types';\n\n// TODO(burdon): Document.\nconst SCRIPT_PACKAGES_BUCKET = 'https://pub-5745ae82e450484aa28f75fc6a175935.r2.dev/dev/';\nconst DECLARATION_EXTS = ['.d.ts', '.d.mts'];\nconst NO_TYPES = true; // Types temopararly disabled due to compiler erorrs.\n\nexport default Capability.makeModule(() =>\n Effect.gen(function* () {\n yield* Effect.tryPromise(() => initializeBundler({ wasmUrl }));\n\n const runtimeModules = yield* fetchRuntimeModules().pipe(Effect.provide(FetchHttpClient.layer));\n\n const compiler = new Compiler({\n skipLibCheck: true,\n moduleResolution: ts.ModuleResolutionKind.Bundler,\n allowImportingTsExtensions: true,\n noEmit: true,\n strict: true,\n esModuleInterop: true,\n paths: Object.fromEntries(runtimeModules.map((mod: any) => [mod.moduleName, [`./src/${mod.filename}`]])),\n });\n\n yield* Effect.tryPromise(() =>\n compiler.initialize(trim`\n declare module 'https://*';\n ${NO_TYPES ? '' : 'declare module \"*\";'}\n `),\n );\n if (!NO_TYPES) {\n for (const mod of runtimeModules) {\n compiler.setFile(`/src/${mod.filename}`, mod.content);\n }\n }\n\n return Capability.contributes(ScriptCapabilities.Compiler, compiler);\n }),\n);\n\nconst fetchRuntimeModules = Effect.fnUntraced(function* () {\n // { key, size, contentType }\n const manifest = yield* HttpClient.get(new URL('manifest.json', SCRIPT_PACKAGES_BUCKET)).pipe(\n Effect.flatMap((_) => _.json),\n Effect.flatMap(\n Schema.decodeUnknown(\n Schema.Struct({\n files: Schema.Array(\n Schema.Struct({\n key: Schema.String,\n }),\n ),\n }),\n ),\n ),\n Effect.map((manifest) => ({ ...manifest, files: manifest.files.map((f) => f.key) })),\n );\n\n const declarationFiles = manifest.files.filter((file) => DECLARATION_EXTS.some((ext) => file.endsWith(ext)));\n\n let fetched = 0;\n const modules = yield* Effect.forEach(\n declarationFiles,\n Effect.fnUntraced(\n function* (filename) {\n const response = yield* HttpClient.get(new URL(filename, SCRIPT_PACKAGES_BUCKET)).pipe(\n Effect.retry(Schedule.exponential(1_000).pipe(Schedule.compose(Schedule.recurs(3)))),\n );\n const content = yield* response.text;\n const moduleName = filename.replace(/\\.d\\.(ts|mts)$/, '');\n fetched++;\n\n return {\n moduleName,\n filename,\n content,\n };\n },\n Effect.retry(Schedule.exponential(1_000).pipe(Schedule.compose(Schedule.recurs(3)))),\n ),\n { concurrency: 20 },\n );\n\n log.info('runtime modules', { manifest: manifest.files.length, files: declarationFiles.length, fetched });\n return modules;\n});\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;AAIA,YAAYA,qBAAqB;AACjC,YAAYC,gBAAgB;AAC5B,YAAYC,YAAY;AACxB,YAAYC,cAAc;AAC1B,YAAYC,YAAY;AACxB,OAAOC,aAAa;AACpB,YAAYC,QAAQ;AAEpB,SAASC,kBAAkB;AAC3B,SAASC,yBAAyB;AAClC,SAASC,WAAW;AACpB,SAASC,YAAY;;AAMrB,IAAMC,yBAAyB;AAC/B,IAAMC,mBAAmB;EAAC;EAAS;;AACnC,IAAMC,WAAW;AAEjB,IAAA,mBAAeC,WAAWC,WAAW,MAC5BC,WAAI,aAAA;AACT,SAAcC,kBAAW,MAAMC,kBAAkB;IAAEC;EAAQ,CAAA,CAAA;AAE3D,QAAMC,iBAAiB,OAAOC,oBAAAA,EAAsBC,KAAYC,eAAwBC,qBAAK,CAAA;AAE7F,QAAMC,WAAW,IAAIC,SAAS;IAC5BC,cAAc;IACdC,kBAAqBC,wBAAqBC;IAC1CC,4BAA4B;IAC5BC,QAAQ;IACRC,QAAQ;IACRC,iBAAiB;IACjBC,OAAOC,OAAOC,YAAYjB,eAAekB,IAAI,CAACC,QAAa;MAACA,IAAIC;MAAY;QAAC,SAASD,IAAIE,QAAQ;;KAAI,CAAA;EACxG,CAAA;AAEA,SAAcxB,kBAAW,MACvBQ,SAASiB,WAAWC;;QAElB9B,WAAW,KAAK,qBAAA;KACnB,CAAA;AAED,MAAI,CAACA,UAAU;AACb,eAAW0B,OAAOnB,gBAAgB;AAChCK,eAASmB,QAAQ,QAAQL,IAAIE,QAAQ,IAAIF,IAAIM,OAAO;IACtD;EACF;AAEA,SAAO/B,WAAWgC,YAAYC,mBAAmBrB,UAAUD,QAAAA;AAC7D,CAAA,CAAA;AAGF,IAAMJ,sBAA6B2B,kBAAW,aAAA;AAE5C,QAAMC,WAAW,OAAkBC,eAAI,IAAIC,IAAI,iBAAiBxC,sBAAAA,CAAAA,EAAyBW,KAChF8B,eAAQ,CAACC,MAAMA,EAAEC,IAAI,GACrBF,eACEG,qBACEC,cAAO;IACZC,OAAcC,aACLF,cAAO;MACZG,KAAYC;IACd,CAAA,CAAA;EAEJ,CAAA,CAAA,CAAA,GAGGtB,WAAI,CAACW,eAAc;IAAE,GAAGA;IAAUQ,OAAOR,UAASQ,MAAMnB,IAAI,CAACuB,MAAMA,EAAEF,GAAG;EAAE,EAAA,CAAA;AAGnF,QAAMG,mBAAmBb,SAASQ,MAAMM,OAAO,CAACC,SAASpD,iBAAiBqD,KAAK,CAACC,QAAQF,KAAKG,SAASD,GAAAA,CAAAA,CAAAA;AAEtG,MAAIE,UAAU;AACd,QAAMC,UAAU,OAAcC,eAC5BR,kBACOd,kBACL,WAAWP,UAAQ;AACjB,UAAM8B,WAAW,OAAkBrB,eAAI,IAAIC,IAAIV,UAAU9B,sBAAAA,CAAAA,EAAyBW,KACzEkD,aAAeC,qBAAY,GAAA,EAAOnD,KAAcoD,iBAAiBC,gBAAO,CAAA,CAAA,CAAA,CAAA,CAAA;AAEjF,UAAM9B,UAAU,OAAO0B,SAASK;AAChC,UAAMpC,aAAaC,SAASoC,QAAQ,kBAAkB,EAAA;AACtDT;AAEA,WAAO;MACL5B;MACAC;MACAI;IACF;EACF,GACO2B,aAAeC,qBAAY,GAAA,EAAOnD,KAAcoD,iBAAiBC,gBAAO,CAAA,CAAA,CAAA,CAAA,CAAA,GAEjF;IAAEG,aAAa;EAAG,CAAA;AAGpBC,MAAIC,KAAK,mBAAmB;IAAE/B,UAAUA,SAASQ,MAAMwB;IAAQxB,OAAOK,iBAAiBmB;IAAQb;EAAQ,GAAA;;;;;;AACvG,SAAOC;AACT,CAAA;",
|
|
6
|
-
"names": ["FetchHttpClient", "HttpClient", "Effect", "Schedule", "Schema", "wasmUrl", "ts", "Capability", "initializeBundler", "log", "trim", "SCRIPT_PACKAGES_BUCKET", "DECLARATION_EXTS", "NO_TYPES", "Capability", "makeModule", "gen", "tryPromise", "initializeBundler", "wasmUrl", "runtimeModules", "fetchRuntimeModules", "pipe", "provide", "layer", "compiler", "Compiler", "skipLibCheck", "moduleResolution", "ModuleResolutionKind", "Bundler", "allowImportingTsExtensions", "noEmit", "strict", "esModuleInterop", "paths", "Object", "fromEntries", "map", "mod", "moduleName", "filename", "initialize", "trim", "setFile", "content", "contributes", "ScriptCapabilities", "fnUntraced", "manifest", "get", "URL", "flatMap", "_", "json", "decodeUnknown", "Struct", "files", "Array", "key", "String", "f", "declarationFiles", "filter", "file", "some", "ext", "endsWith", "fetched", "modules", "forEach", "response", "retry", "exponential", "compose", "recurs", "text", "replace", "concurrency", "log", "info", "length"]
|
|
7
|
-
}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
|
-
import {
|
|
3
|
-
CreateScript
|
|
4
|
-
} from "./chunk-L55OBVT5.mjs";
|
|
5
|
-
import "./chunk-L3JLWXB5.mjs";
|
|
6
|
-
import {
|
|
7
|
-
templates
|
|
8
|
-
} from "./chunk-Y5VWHRVU.mjs";
|
|
9
|
-
import "./chunk-HSLMI22Q.mjs";
|
|
10
|
-
|
|
11
|
-
// src/operations/create-script.ts
|
|
12
|
-
import { Octokit } from "@octokit/core";
|
|
13
|
-
import * as Effect from "effect/Effect";
|
|
14
|
-
import { Script } from "@dxos/functions";
|
|
15
|
-
import { Operation } from "@dxos/operation";
|
|
16
|
-
var handler = CreateScript.pipe(Operation.withHandler(Effect.fnUntraced(function* ({ name, gistUrl, initialTemplateId }) {
|
|
17
|
-
let source = templates[0].source;
|
|
18
|
-
let scriptName = name;
|
|
19
|
-
const gistId = gistUrl?.split("/").at(-1);
|
|
20
|
-
if (gistId) {
|
|
21
|
-
const octokit = new Octokit();
|
|
22
|
-
const response = yield* Effect.promise(() => octokit.request("GET /gists/{gist_id}", {
|
|
23
|
-
gist_id: gistId
|
|
24
|
-
}));
|
|
25
|
-
const gistContent = Object.values(response.data.files ?? {})[0]?.content;
|
|
26
|
-
if (gistContent) {
|
|
27
|
-
source = gistContent;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
if (initialTemplateId) {
|
|
31
|
-
const template = templates.find((template2) => template2.id === initialTemplateId);
|
|
32
|
-
if (template) {
|
|
33
|
-
source = template.source;
|
|
34
|
-
scriptName = scriptName || template.name;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
return {
|
|
38
|
-
object: Script.make({
|
|
39
|
-
name: scriptName,
|
|
40
|
-
source
|
|
41
|
-
})
|
|
42
|
-
};
|
|
43
|
-
})));
|
|
44
|
-
var create_script_default = handler;
|
|
45
|
-
export {
|
|
46
|
-
create_script_default as default
|
|
47
|
-
};
|
|
48
|
-
//# sourceMappingURL=create-script-TAJHVROB.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/operations/create-script.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { Octokit } from '@octokit/core';\nimport * as Effect from 'effect/Effect';\n\nimport { Script } from '@dxos/functions';\nimport { Operation } from '@dxos/operation';\n\nimport { templates } from '../templates';\nimport { CreateScript } from './definitions';\n\nconst handler: Operation.WithHandler<typeof CreateScript> = CreateScript.pipe(\n Operation.withHandler(\n Effect.fnUntraced(function* ({ name, gistUrl, initialTemplateId }) {\n let source = templates[0].source;\n let scriptName = name;\n\n const gistId = gistUrl?.split('/').at(-1);\n if (gistId) {\n const octokit = new Octokit();\n const response = yield* Effect.promise(() =>\n octokit.request('GET /gists/{gist_id}', {\n gist_id: gistId,\n }),\n );\n const gistContent = Object.values(response.data.files ?? {})[0]?.content;\n if (gistContent) {\n source = gistContent;\n }\n }\n\n if (initialTemplateId) {\n const template = templates.find((template) => template.id === initialTemplateId);\n if (template) {\n source = template.source;\n scriptName = scriptName || template.name;\n }\n }\n\n return { object: Script.make({ name: scriptName, source }) };\n }),\n ),\n);\n\nexport default handler;\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;AAIA,SAASA,eAAe;AACxB,YAAYC,YAAY;AAExB,SAASC,cAAc;AACvB,SAASC,iBAAiB;AAK1B,IAAMC,UAAsDC,aAAaC,KACvEC,UAAUC,YACDC,kBAAW,WAAW,EAAEC,MAAMC,SAASC,kBAAiB,GAAE;AAC/D,MAAIC,SAASC,UAAU,CAAA,EAAGD;AAC1B,MAAIE,aAAaL;AAEjB,QAAMM,SAASL,SAASM,MAAM,GAAA,EAAKC,GAAG,EAAC;AACvC,MAAIF,QAAQ;AACV,UAAMG,UAAU,IAAIC,QAAAA;AACpB,UAAMC,WAAW,OAAcC,eAAQ,MACrCH,QAAQI,QAAQ,wBAAwB;MACtCC,SAASR;IACX,CAAA,CAAA;AAEF,UAAMS,cAAcC,OAAOC,OAAON,SAASO,KAAKC,SAAS,CAAC,CAAA,EAAG,CAAA,GAAIC;AACjE,QAAIL,aAAa;AACfZ,eAASY;IACX;EACF;AAEA,MAAIb,mBAAmB;AACrB,UAAMmB,WAAWjB,UAAUkB,KAAK,CAACD,cAAaA,UAASE,OAAOrB,iBAAAA;AAC9D,QAAImB,UAAU;AACZlB,eAASkB,SAASlB;AAClBE,mBAAaA,cAAcgB,SAASrB;IACtC;EACF;AAEA,SAAO;IAAEwB,QAAQC,OAAOC,KAAK;MAAE1B,MAAMK;MAAYF;IAAO,CAAA;EAAG;AAC7D,CAAA,CAAA,CAAA;AAIJ,IAAA,wBAAeT;",
|
|
6
|
-
"names": ["Octokit", "Effect", "Script", "Operation", "handler", "CreateScript", "pipe", "Operation", "withHandler", "fnUntraced", "name", "gistUrl", "initialTemplateId", "source", "templates", "scriptName", "gistId", "split", "at", "octokit", "Octokit", "response", "promise", "request", "gist_id", "gistContent", "Object", "values", "data", "files", "content", "template", "find", "id", "object", "Script", "make"]
|
|
7
|
-
}
|
|
@@ -1,269 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
|
-
import {
|
|
3
|
-
DeploymentDialog,
|
|
4
|
-
NotebookContainer,
|
|
5
|
-
ScriptContainer,
|
|
6
|
-
ScriptObjectSettings,
|
|
7
|
-
ScriptPluginSettings,
|
|
8
|
-
ScriptProperties,
|
|
9
|
-
TestContainer
|
|
10
|
-
} from "./chunk-P4Q2BPBB.mjs";
|
|
11
|
-
import {
|
|
12
|
-
FramePanel,
|
|
13
|
-
NotebookMenu,
|
|
14
|
-
NotebookStack,
|
|
15
|
-
QueryEditor,
|
|
16
|
-
ScriptToolbar,
|
|
17
|
-
TestPanel,
|
|
18
|
-
TypescriptEditor
|
|
19
|
-
} from "./chunk-SV742UH7.mjs";
|
|
20
|
-
import "./chunk-JGN7TDJH.mjs";
|
|
21
|
-
import "./chunk-RN2SMYCL.mjs";
|
|
22
|
-
import {
|
|
23
|
-
deployScript,
|
|
24
|
-
getAccessCredential,
|
|
25
|
-
getFunctionUrl,
|
|
26
|
-
isScriptDeployed,
|
|
27
|
-
updateFunctionMetadata
|
|
28
|
-
} from "./chunk-RTM3D4T5.mjs";
|
|
29
|
-
import "./chunk-CKYUNEE5.mjs";
|
|
30
|
-
import {
|
|
31
|
-
Notebook_exports,
|
|
32
|
-
ScriptCapabilities,
|
|
33
|
-
ScriptEvents
|
|
34
|
-
} from "./chunk-C3GH2SDF.mjs";
|
|
35
|
-
import {
|
|
36
|
-
definitions_exports
|
|
37
|
-
} from "./chunk-L55OBVT5.mjs";
|
|
38
|
-
import {
|
|
39
|
-
defaultScriptsForIntegration,
|
|
40
|
-
meta
|
|
41
|
-
} from "./chunk-L3JLWXB5.mjs";
|
|
42
|
-
import "./chunk-Y5VWHRVU.mjs";
|
|
43
|
-
import "./chunk-HSLMI22Q.mjs";
|
|
44
|
-
|
|
45
|
-
// src/ScriptPlugin.tsx
|
|
46
|
-
import * as Effect from "effect/Effect";
|
|
47
|
-
import * as Option from "effect/Option";
|
|
48
|
-
import { Plugin } from "@dxos/app-framework";
|
|
49
|
-
import { AppActivationEvents, AppPlugin } from "@dxos/app-toolkit";
|
|
50
|
-
import { Annotation, Ref } from "@dxos/echo";
|
|
51
|
-
import { Script as Script2 } from "@dxos/functions";
|
|
52
|
-
import { Operation } from "@dxos/operation";
|
|
53
|
-
import { SpaceOperation } from "@dxos/plugin-space/operations";
|
|
54
|
-
|
|
55
|
-
// src/capabilities/app-graph-builder/index.ts
|
|
56
|
-
import { Capability } from "@dxos/app-framework";
|
|
57
|
-
var AppGraphBuilder = Capability.lazy("AppGraphBuilder", () => import("./app-graph-builder-GNGOYXIU.mjs"));
|
|
58
|
-
|
|
59
|
-
// src/capabilities/blueprint-definition/index.ts
|
|
60
|
-
import { Capability as Capability2 } from "@dxos/app-framework";
|
|
61
|
-
var BlueprintDefinition = Capability2.lazy("BlueprintDefinition", () => import("./blueprint-definition-DTRGTRZA.mjs"));
|
|
62
|
-
|
|
63
|
-
// src/capabilities/compiler/index.ts
|
|
64
|
-
import { Capability as Capability3 } from "@dxos/app-framework";
|
|
65
|
-
var Compiler = Capability3.lazy("Compiler", () => import("./compiler-QBWP7ERK.mjs"));
|
|
66
|
-
|
|
67
|
-
// src/capabilities/operation-handler/index.ts
|
|
68
|
-
import { Capability as Capability4 } from "@dxos/app-framework";
|
|
69
|
-
var OperationHandler = Capability4.lazy("OperationHandler", () => import("./operation-handler-OUROH3T7.mjs"));
|
|
70
|
-
|
|
71
|
-
// src/capabilities/react-surface/index.ts
|
|
72
|
-
import { Capability as Capability5 } from "@dxos/app-framework";
|
|
73
|
-
var ReactSurface = Capability5.lazy("ReactSurface", () => import("./react-surface-OJ55GFCP.mjs"));
|
|
74
|
-
|
|
75
|
-
// src/capabilities/settings/index.ts
|
|
76
|
-
import { Capability as Capability6 } from "@dxos/app-framework";
|
|
77
|
-
var ScriptSettings = Capability6.lazy("ScriptSettings", () => import("./settings-2TK3XPLD.mjs"));
|
|
78
|
-
|
|
79
|
-
// src/translations.ts
|
|
80
|
-
import { Script } from "@dxos/functions";
|
|
81
|
-
var translations = [
|
|
82
|
-
{
|
|
83
|
-
"en-US": {
|
|
84
|
-
[Script.Script.typename]: {
|
|
85
|
-
"typename label": "Script",
|
|
86
|
-
"typename label_zero": "Scripts",
|
|
87
|
-
"typename label_one": "Script",
|
|
88
|
-
"typename label_other": "Scripts",
|
|
89
|
-
"object name placeholder": "New script",
|
|
90
|
-
"add object label": "Add script",
|
|
91
|
-
"rename object label": "Rename script",
|
|
92
|
-
"delete object label": "Delete script",
|
|
93
|
-
"object deleted label": "Script deleted"
|
|
94
|
-
},
|
|
95
|
-
[Notebook_exports.Notebook.typename]: {
|
|
96
|
-
"typename label": "Notebook",
|
|
97
|
-
"typename label_zero": "Notebooks",
|
|
98
|
-
"typename label_one": "Notebook",
|
|
99
|
-
"typename label_other": "Notebooks",
|
|
100
|
-
"object name placeholder": "New notebook",
|
|
101
|
-
"add object label": "Add notebook",
|
|
102
|
-
"rename object label": "Rename notebook",
|
|
103
|
-
"delete object label": "Delete notebook",
|
|
104
|
-
"object deleted label": "Notebook deleted"
|
|
105
|
-
},
|
|
106
|
-
[meta.id]: {
|
|
107
|
-
"plugin name": "Scripts",
|
|
108
|
-
"settings title": "Scripts plugin settings",
|
|
109
|
-
"description label": "Description",
|
|
110
|
-
"description placeholder": "Enter description",
|
|
111
|
-
"binding placeholder": "Function name",
|
|
112
|
-
"function request placeholder": "Function request",
|
|
113
|
-
"deploy label": "Deploy",
|
|
114
|
-
"deployed label": "Current version of the script is deployed",
|
|
115
|
-
"upload failed label": "Upload failed",
|
|
116
|
-
"copy link label": "Copy function link",
|
|
117
|
-
"format label": "Format",
|
|
118
|
-
"toggle details label": "Toggle details panel",
|
|
119
|
-
"authenticate action label": "Authenticate functions service",
|
|
120
|
-
"authenticate button label": "Authenticate",
|
|
121
|
-
"name label": "Name",
|
|
122
|
-
"remote function settings heading": "Remote Function",
|
|
123
|
-
"function url label": "Invocation URL",
|
|
124
|
-
"function binding label": "Function binding",
|
|
125
|
-
"function binding placeholder": "Enter binding name (e.g., NAME)",
|
|
126
|
-
"script publish settings label": "Publishing",
|
|
127
|
-
"script publish settings description": "Scripts can be shared publicly as Github gists.",
|
|
128
|
-
"no github token label": "This space has no GitHub access token available.",
|
|
129
|
-
"open token manager label": "Open Token Manager",
|
|
130
|
-
"publish label": "Publish",
|
|
131
|
-
"publishing label": "Publishing",
|
|
132
|
-
"blueprint editor label": "Blueprint",
|
|
133
|
-
"blueprint editor description": "Create a blueprint that exposes this script as a tool.",
|
|
134
|
-
"blueprint instructions label": "Instructions",
|
|
135
|
-
"blueprint instructions placeholder": "Describe how this tool should be used.",
|
|
136
|
-
"create blueprint label": "Create blueprint",
|
|
137
|
-
"creating label": "Creating\u2026",
|
|
138
|
-
"editor input mode label": "Editor input mode",
|
|
139
|
-
"select editor input mode placeholder": "Select editor input mode\u2026",
|
|
140
|
-
"settings editor input mode default label": "Default",
|
|
141
|
-
"settings editor input mode vim label": "Vim",
|
|
142
|
-
"settings editor input mode vscode label": "VS Code",
|
|
143
|
-
"function panel label": "Debug Function",
|
|
144
|
-
"script test label": "Test",
|
|
145
|
-
"script logs label": "Logs",
|
|
146
|
-
"deployment dialog title": "Default Scripts",
|
|
147
|
-
"deployment dialog scripts found message": "Script templates:",
|
|
148
|
-
"deployment dialog deploy functions button label_one": "Create and deploy script",
|
|
149
|
-
"deployment dialog deploy functions button label_other": "Create and deploy scripts",
|
|
150
|
-
"deployment dialog deploy functions pending button label_one": "Deploying script",
|
|
151
|
-
"deployment dialog deploy functions pending button label_other": "Deploying scripts",
|
|
152
|
-
"deployment dialog skip button label": "Skip",
|
|
153
|
-
"script deployment toast label_one": "Script deployed",
|
|
154
|
-
"script deployment toast label_other": "Scripts deployed",
|
|
155
|
-
"script deployment toast description_one": "Your script has been deployed successfully.",
|
|
156
|
-
"script deployment toast description_other": "Your scripts have been deployed successfully.",
|
|
157
|
-
"script deployment toast close label_one": "Close",
|
|
158
|
-
"script deployment toast close label_other": "Close",
|
|
159
|
-
"script deployment error toast label_one": "Script deployment failed",
|
|
160
|
-
"script deployment error toast label_other": "Scripts deployment failed",
|
|
161
|
-
"script deployment error toast description_one": "There was an error deploying your script.",
|
|
162
|
-
"script deployment error toast description_other": "There was an error deploying your scripts.",
|
|
163
|
-
"script deployment error toast close label_one": "Close",
|
|
164
|
-
"script deployment error toast close label_other": "Close",
|
|
165
|
-
"notebook cell placeholder": "Enter script",
|
|
166
|
-
"notebook cell delete label": "Delete cell",
|
|
167
|
-
"notebook cell prompt run label": "Run",
|
|
168
|
-
"notebook cell insert markdown label": "Insert Markdown",
|
|
169
|
-
"notebook cell insert script label": "Insert Script",
|
|
170
|
-
"notebook cell insert prompt label": "Insert Prompt",
|
|
171
|
-
"notebook cell insert query label": "Insert Query",
|
|
172
|
-
"notebook markdown placeholder": "Enter Markdown",
|
|
173
|
-
"notebook prompt placeholder": "Enter prompt",
|
|
174
|
-
"notebook cell insert label": "Insert cell"
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
];
|
|
179
|
-
|
|
180
|
-
// src/ScriptPlugin.tsx
|
|
181
|
-
var ScriptPlugin = Plugin.define(meta).pipe(AppPlugin.addAppGraphModule({
|
|
182
|
-
activate: AppGraphBuilder
|
|
183
|
-
}), AppPlugin.addBlueprintDefinitionModule({
|
|
184
|
-
activate: BlueprintDefinition
|
|
185
|
-
}), AppPlugin.addMetadataModule({
|
|
186
|
-
metadata: [
|
|
187
|
-
{
|
|
188
|
-
id: Script2.Script.typename,
|
|
189
|
-
metadata: {
|
|
190
|
-
icon: Annotation.IconAnnotation.get(Script2.Script).pipe(Option.getOrThrow).icon,
|
|
191
|
-
iconHue: Annotation.IconAnnotation.get(Script2.Script).pipe(Option.getOrThrow).hue ?? "white",
|
|
192
|
-
// TODO(wittjosiah): Move out of metadata.
|
|
193
|
-
loadReferences: async (script) => await Ref.Array.loadAll([
|
|
194
|
-
script.source
|
|
195
|
-
]),
|
|
196
|
-
inputSchema: definitions_exports.ScriptProps,
|
|
197
|
-
createObject: (props, options) => Effect.gen(function* () {
|
|
198
|
-
const { object } = yield* Operation.invoke(definitions_exports.CreateScript, props);
|
|
199
|
-
return yield* Operation.invoke(SpaceOperation.AddObject, {
|
|
200
|
-
object,
|
|
201
|
-
target: options.target,
|
|
202
|
-
hidden: true,
|
|
203
|
-
targetNodeId: options.targetNodeId
|
|
204
|
-
});
|
|
205
|
-
})
|
|
206
|
-
}
|
|
207
|
-
},
|
|
208
|
-
{
|
|
209
|
-
id: Notebook_exports.Notebook.typename,
|
|
210
|
-
metadata: {
|
|
211
|
-
icon: Annotation.IconAnnotation.get(Notebook_exports.Notebook).pipe(Option.getOrThrow).icon,
|
|
212
|
-
iconHue: Annotation.IconAnnotation.get(Notebook_exports.Notebook).pipe(Option.getOrThrow).hue ?? "white",
|
|
213
|
-
inputSchema: definitions_exports.NotebookProps,
|
|
214
|
-
createObject: (props, options) => Effect.gen(function* () {
|
|
215
|
-
const object = Notebook_exports.make(props);
|
|
216
|
-
return yield* Operation.invoke(SpaceOperation.AddObject, {
|
|
217
|
-
object,
|
|
218
|
-
target: options.target,
|
|
219
|
-
hidden: true,
|
|
220
|
-
targetNodeId: options.targetNodeId
|
|
221
|
-
});
|
|
222
|
-
})
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
]
|
|
226
|
-
}), AppPlugin.addOperationHandlerModule({
|
|
227
|
-
activate: OperationHandler
|
|
228
|
-
}), AppPlugin.addSchemaModule({
|
|
229
|
-
schema: [
|
|
230
|
-
Script2.Script
|
|
231
|
-
]
|
|
232
|
-
}), AppPlugin.addSurfaceModule({
|
|
233
|
-
activate: ReactSurface
|
|
234
|
-
}), AppPlugin.addTranslationsModule({
|
|
235
|
-
translations
|
|
236
|
-
}), Plugin.addModule({
|
|
237
|
-
activatesOn: AppActivationEvents.SetupSettings,
|
|
238
|
-
activate: ScriptSettings
|
|
239
|
-
}), Plugin.addModule({
|
|
240
|
-
activatesOn: ScriptEvents.SetupCompiler,
|
|
241
|
-
activate: Compiler
|
|
242
|
-
}), Plugin.make);
|
|
243
|
-
export {
|
|
244
|
-
DeploymentDialog,
|
|
245
|
-
FramePanel,
|
|
246
|
-
NotebookContainer,
|
|
247
|
-
NotebookMenu,
|
|
248
|
-
NotebookStack,
|
|
249
|
-
QueryEditor,
|
|
250
|
-
ScriptCapabilities,
|
|
251
|
-
ScriptContainer,
|
|
252
|
-
ScriptEvents,
|
|
253
|
-
ScriptObjectSettings,
|
|
254
|
-
ScriptPlugin,
|
|
255
|
-
ScriptPluginSettings,
|
|
256
|
-
ScriptProperties,
|
|
257
|
-
ScriptToolbar,
|
|
258
|
-
TestContainer,
|
|
259
|
-
TestPanel,
|
|
260
|
-
TypescriptEditor,
|
|
261
|
-
defaultScriptsForIntegration,
|
|
262
|
-
deployScript,
|
|
263
|
-
getAccessCredential,
|
|
264
|
-
getFunctionUrl,
|
|
265
|
-
isScriptDeployed,
|
|
266
|
-
meta,
|
|
267
|
-
updateFunctionMetadata
|
|
268
|
-
};
|
|
269
|
-
//# sourceMappingURL=index.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/ScriptPlugin.tsx", "../../../src/capabilities/app-graph-builder/index.ts", "../../../src/capabilities/blueprint-definition/index.ts", "../../../src/capabilities/compiler/index.ts", "../../../src/capabilities/operation-handler/index.ts", "../../../src/capabilities/react-surface/index.ts", "../../../src/capabilities/settings/index.ts", "../../../src/translations.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\nimport * as Option from 'effect/Option';\n\nimport { Plugin } from '@dxos/app-framework';\nimport { AppActivationEvents, AppPlugin } from '@dxos/app-toolkit';\nimport { Annotation, Ref } from '@dxos/echo';\nimport { Script } from '@dxos/functions';\nimport { Operation } from '@dxos/operation';\nimport { type CreateObject } from '@dxos/plugin-space/types';\nimport { SpaceOperation } from '@dxos/plugin-space/operations';\n\nimport {\n AppGraphBuilder,\n BlueprintDefinition,\n Compiler,\n OperationHandler,\n ReactSurface,\n ScriptSettings,\n} from './capabilities';\nimport { meta } from './meta';\nimport { translations } from './translations';\nimport { ScriptEvents } from './types';\nimport { Notebook } from './types';\nimport { ScriptOperation } from './operations';\n\nexport const ScriptPlugin = Plugin.define(meta).pipe(\n AppPlugin.addAppGraphModule({ activate: AppGraphBuilder }),\n AppPlugin.addBlueprintDefinitionModule({ activate: BlueprintDefinition }),\n AppPlugin.addMetadataModule({\n metadata: [\n {\n id: Script.Script.typename,\n metadata: {\n icon: Annotation.IconAnnotation.get(Script.Script).pipe(Option.getOrThrow).icon,\n iconHue: Annotation.IconAnnotation.get(Script.Script).pipe(Option.getOrThrow).hue ?? 'white',\n // TODO(wittjosiah): Move out of metadata.\n loadReferences: async (script: Script.Script) => await Ref.Array.loadAll([script.source]),\n inputSchema: ScriptOperation.ScriptProps,\n createObject: ((props, options) =>\n Effect.gen(function* () {\n const { object } = yield* Operation.invoke(ScriptOperation.CreateScript, props);\n return yield* Operation.invoke(SpaceOperation.AddObject, {\n object,\n target: options.target,\n hidden: true,\n targetNodeId: options.targetNodeId,\n });\n })) satisfies CreateObject,\n },\n },\n {\n id: Notebook.Notebook.typename,\n metadata: {\n icon: Annotation.IconAnnotation.get(Notebook.Notebook).pipe(Option.getOrThrow).icon,\n iconHue: Annotation.IconAnnotation.get(Notebook.Notebook).pipe(Option.getOrThrow).hue ?? 'white',\n inputSchema: ScriptOperation.NotebookProps,\n createObject: ((props, options) =>\n Effect.gen(function* () {\n const object = Notebook.make(props);\n return yield* Operation.invoke(SpaceOperation.AddObject, {\n object,\n target: options.target,\n hidden: true,\n targetNodeId: options.targetNodeId,\n });\n })) satisfies CreateObject,\n },\n },\n ],\n }),\n AppPlugin.addOperationHandlerModule({ activate: OperationHandler }),\n AppPlugin.addSchemaModule({ schema: [Script.Script] }),\n AppPlugin.addSurfaceModule({ activate: ReactSurface }),\n AppPlugin.addTranslationsModule({ translations }),\n Plugin.addModule({\n activatesOn: AppActivationEvents.SetupSettings,\n activate: ScriptSettings,\n }),\n Plugin.addModule({\n activatesOn: ScriptEvents.SetupCompiler,\n activate: Compiler,\n }),\n Plugin.make,\n);\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { Capability } from '@dxos/app-framework';\n\nexport const AppGraphBuilder = Capability.lazy('AppGraphBuilder', () => import('./app-graph-builder'));\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { Capability } from '@dxos/app-framework';\n\nexport const BlueprintDefinition = Capability.lazy('BlueprintDefinition', () => import('./blueprint-definition'));\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { Capability } from '@dxos/app-framework';\n\nexport const Compiler = Capability.lazy('Compiler', () => import('./compiler'));\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { Capability } from '@dxos/app-framework';\nimport { OperationHandlerSet } from '@dxos/operation';\n\nexport const OperationHandler = Capability.lazy<OperationHandlerSet.OperationHandlerSet>(\n 'OperationHandler',\n () => import('./operation-handler'),\n);\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { Capability } from '@dxos/app-framework';\n\nexport const ReactSurface = Capability.lazy('ReactSurface', () => import('./react-surface'));\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { Capability } from '@dxos/app-framework';\n\nexport const ScriptSettings = Capability.lazy('ScriptSettings', () => import('./settings'));\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { Script } from '@dxos/functions';\nimport { type Resource } from '@dxos/react-ui';\n\nimport { meta } from './meta';\nimport { Notebook } from './types';\n\nexport const translations = [\n {\n 'en-US': {\n [Script.Script.typename]: {\n 'typename label': 'Script',\n 'typename label_zero': 'Scripts',\n 'typename label_one': 'Script',\n 'typename label_other': 'Scripts',\n 'object name placeholder': 'New script',\n 'add object label': 'Add script',\n 'rename object label': 'Rename script',\n 'delete object label': 'Delete script',\n 'object deleted label': 'Script deleted',\n },\n [Notebook.Notebook.typename]: {\n 'typename label': 'Notebook',\n 'typename label_zero': 'Notebooks',\n 'typename label_one': 'Notebook',\n 'typename label_other': 'Notebooks',\n 'object name placeholder': 'New notebook',\n 'add object label': 'Add notebook',\n 'rename object label': 'Rename notebook',\n 'delete object label': 'Delete notebook',\n 'object deleted label': 'Notebook deleted',\n },\n [meta.id]: {\n 'plugin name': 'Scripts',\n 'settings title': 'Scripts plugin settings',\n 'description label': 'Description',\n 'description placeholder': 'Enter description',\n 'binding placeholder': 'Function name',\n 'function request placeholder': 'Function request',\n 'deploy label': 'Deploy',\n 'deployed label': 'Current version of the script is deployed',\n 'upload failed label': 'Upload failed',\n 'copy link label': 'Copy function link',\n 'format label': 'Format',\n 'toggle details label': 'Toggle details panel',\n 'authenticate action label': 'Authenticate functions service',\n 'authenticate button label': 'Authenticate',\n 'name label': 'Name',\n 'remote function settings heading': 'Remote Function',\n 'function url label': 'Invocation URL',\n 'function binding label': 'Function binding',\n 'function binding placeholder': 'Enter binding name (e.g., NAME)',\n 'script publish settings label': 'Publishing',\n 'script publish settings description': 'Scripts can be shared publicly as Github gists.',\n 'no github token label': 'This space has no GitHub access token available.',\n 'open token manager label': 'Open Token Manager',\n 'publish label': 'Publish',\n 'publishing label': 'Publishing',\n 'blueprint editor label': 'Blueprint',\n 'blueprint editor description': 'Create a blueprint that exposes this script as a tool.',\n 'blueprint instructions label': 'Instructions',\n 'blueprint instructions placeholder': 'Describe how this tool should be used.',\n 'create blueprint label': 'Create blueprint',\n 'creating label': 'Creating…',\n 'editor input mode label': 'Editor input mode',\n 'select editor input mode placeholder': 'Select editor input mode…',\n 'settings editor input mode default label': 'Default',\n 'settings editor input mode vim label': 'Vim',\n 'settings editor input mode vscode label': 'VS Code',\n 'function panel label': 'Debug Function',\n 'script test label': 'Test',\n 'script logs label': 'Logs',\n\n 'deployment dialog title': 'Default Scripts',\n 'deployment dialog scripts found message': 'Script templates:',\n 'deployment dialog deploy functions button label_one': 'Create and deploy script',\n 'deployment dialog deploy functions button label_other': 'Create and deploy scripts',\n 'deployment dialog deploy functions pending button label_one': 'Deploying script',\n 'deployment dialog deploy functions pending button label_other': 'Deploying scripts',\n 'deployment dialog skip button label': 'Skip',\n\n 'script deployment toast label_one': 'Script deployed',\n 'script deployment toast label_other': 'Scripts deployed',\n 'script deployment toast description_one': 'Your script has been deployed successfully.',\n 'script deployment toast description_other': 'Your scripts have been deployed successfully.',\n 'script deployment toast close label_one': 'Close',\n 'script deployment toast close label_other': 'Close',\n 'script deployment error toast label_one': 'Script deployment failed',\n 'script deployment error toast label_other': 'Scripts deployment failed',\n 'script deployment error toast description_one': 'There was an error deploying your script.',\n 'script deployment error toast description_other': 'There was an error deploying your scripts.',\n 'script deployment error toast close label_one': 'Close',\n 'script deployment error toast close label_other': 'Close',\n\n 'notebook cell placeholder': 'Enter script',\n 'notebook cell delete label': 'Delete cell',\n 'notebook cell prompt run label': 'Run',\n 'notebook cell insert markdown label': 'Insert Markdown',\n 'notebook cell insert script label': 'Insert Script',\n 'notebook cell insert prompt label': 'Insert Prompt',\n 'notebook cell insert query label': 'Insert Query',\n 'notebook markdown placeholder': 'Enter Markdown',\n 'notebook prompt placeholder': 'Enter prompt',\n 'notebook cell insert label': 'Insert cell',\n },\n },\n },\n] as const satisfies Resource[];\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,YAAYA,YAAY;AACxB,YAAYC,YAAY;AAExB,SAASC,cAAc;AACvB,SAASC,qBAAqBC,iBAAiB;AAC/C,SAASC,YAAYC,WAAW;AAChC,SAASC,UAAAA,eAAc;AACvB,SAASC,iBAAiB;AAE1B,SAASC,sBAAsB;;;ACT/B,SAASC,kBAAkB;AAEpB,IAAMC,kBAAkBC,WAAWC,KAAK,mBAAmB,MAAM,OAAO,kCAAA,CAAA;;;ACF/E,SAASC,cAAAA,mBAAkB;AAEpB,IAAMC,sBAAsBC,YAAWC,KAAK,uBAAuB,MAAM,OAAO,qCAAA,CAAA;;;ACFvF,SAASC,cAAAA,mBAAkB;AAEpB,IAAMC,WAAWC,YAAWC,KAAK,YAAY,MAAM,OAAO,yBAAA,CAAA;;;ACFjE,SAASC,cAAAA,mBAAkB;AAGpB,IAAMC,mBAAmBC,YAAWC,KACzC,oBACA,MAAM,OAAO,kCAAA,CAAA;;;ACLf,SAASC,cAAAA,mBAAkB;AAEpB,IAAMC,eAAeC,YAAWC,KAAK,gBAAgB,MAAM,OAAO,8BAAA,CAAA;;;ACFzE,SAASC,cAAAA,mBAAkB;AAEpB,IAAMC,iBAAiBC,YAAWC,KAAK,kBAAkB,MAAM,OAAO,yBAAA,CAAA;;;ACF7E,SAASC,cAAc;AAMhB,IAAMC,eAAe;EAC1B;IACE,SAAS;MACP,CAACC,OAAOA,OAAOC,QAAQ,GAAG;QACxB,kBAAkB;QAClB,uBAAuB;QACvB,sBAAsB;QACtB,wBAAwB;QACxB,2BAA2B;QAC3B,oBAAoB;QACpB,uBAAuB;QACvB,uBAAuB;QACvB,wBAAwB;MAC1B;MACA,CAACC,iBAASA,SAASD,QAAQ,GAAG;QAC5B,kBAAkB;QAClB,uBAAuB;QACvB,sBAAsB;QACtB,wBAAwB;QACxB,2BAA2B;QAC3B,oBAAoB;QACpB,uBAAuB;QACvB,uBAAuB;QACvB,wBAAwB;MAC1B;MACA,CAACE,KAAKC,EAAE,GAAG;QACT,eAAe;QACf,kBAAkB;QAClB,qBAAqB;QACrB,2BAA2B;QAC3B,uBAAuB;QACvB,gCAAgC;QAChC,gBAAgB;QAChB,kBAAkB;QAClB,uBAAuB;QACvB,mBAAmB;QACnB,gBAAgB;QAChB,wBAAwB;QACxB,6BAA6B;QAC7B,6BAA6B;QAC7B,cAAc;QACd,oCAAoC;QACpC,sBAAsB;QACtB,0BAA0B;QAC1B,gCAAgC;QAChC,iCAAiC;QACjC,uCAAuC;QACvC,yBAAyB;QACzB,4BAA4B;QAC5B,iBAAiB;QACjB,oBAAoB;QACpB,0BAA0B;QAC1B,gCAAgC;QAChC,gCAAgC;QAChC,sCAAsC;QACtC,0BAA0B;QAC1B,kBAAkB;QAClB,2BAA2B;QAC3B,wCAAwC;QACxC,4CAA4C;QAC5C,wCAAwC;QACxC,2CAA2C;QAC3C,wBAAwB;QACxB,qBAAqB;QACrB,qBAAqB;QAErB,2BAA2B;QAC3B,2CAA2C;QAC3C,uDAAuD;QACvD,yDAAyD;QACzD,+DAA+D;QAC/D,iEAAiE;QACjE,uCAAuC;QAEvC,qCAAqC;QACrC,uCAAuC;QACvC,2CAA2C;QAC3C,6CAA6C;QAC7C,2CAA2C;QAC3C,6CAA6C;QAC7C,2CAA2C;QAC3C,6CAA6C;QAC7C,iDAAiD;QACjD,mDAAmD;QACnD,iDAAiD;QACjD,mDAAmD;QAEnD,6BAA6B;QAC7B,8BAA8B;QAC9B,kCAAkC;QAClC,uCAAuC;QACvC,qCAAqC;QACrC,qCAAqC;QACrC,oCAAoC;QACpC,iCAAiC;QACjC,+BAA+B;QAC/B,8BAA8B;MAChC;IACF;EACF;;;;APhFK,IAAMC,eAAeC,OAAOC,OAAOC,IAAAA,EAAMC,KAC9CC,UAAUC,kBAAkB;EAAEC,UAAUC;AAAgB,CAAA,GACxDH,UAAUI,6BAA6B;EAAEF,UAAUG;AAAoB,CAAA,GACvEL,UAAUM,kBAAkB;EAC1BC,UAAU;IACR;MACEC,IAAIC,QAAOA,OAAOC;MAClBH,UAAU;QACRI,MAAMC,WAAWC,eAAeC,IAAIL,QAAOA,MAAM,EAAEV,KAAYgB,iBAAU,EAAEJ;QAC3EK,SAASJ,WAAWC,eAAeC,IAAIL,QAAOA,MAAM,EAAEV,KAAYgB,iBAAU,EAAEE,OAAO;;QAErFC,gBAAgB,OAAOC,WAA0B,MAAMC,IAAIC,MAAMC,QAAQ;UAACH,OAAOI;SAAO;QACxFC,aAAaC,oBAAgBC;QAC7BC,cAAe,CAACC,OAAOC,YACdC,WAAI,aAAA;AACT,gBAAM,EAAEC,OAAM,IAAK,OAAOC,UAAUC,OAAOR,oBAAgBS,cAAcN,KAAAA;AACzE,iBAAO,OAAOI,UAAUC,OAAOE,eAAeC,WAAW;YACvDL;YACAM,QAAQR,QAAQQ;YAChBC,QAAQ;YACRC,cAAcV,QAAQU;UACxB,CAAA;QACF,CAAA;MACJ;IACF;IACA;MACE/B,IAAIgC,iBAASA,SAAS9B;MACtBH,UAAU;QACRI,MAAMC,WAAWC,eAAeC,IAAI0B,iBAASA,QAAQ,EAAEzC,KAAYgB,iBAAU,EAAEJ;QAC/EK,SAASJ,WAAWC,eAAeC,IAAI0B,iBAASA,QAAQ,EAAEzC,KAAYgB,iBAAU,EAAEE,OAAO;QACzFO,aAAaC,oBAAgBgB;QAC7Bd,cAAe,CAACC,OAAOC,YACdC,WAAI,aAAA;AACT,gBAAMC,SAASS,iBAASE,KAAKd,KAAAA;AAC7B,iBAAO,OAAOI,UAAUC,OAAOE,eAAeC,WAAW;YACvDL;YACAM,QAAQR,QAAQQ;YAChBC,QAAQ;YACRC,cAAcV,QAAQU;UACxB,CAAA;QACF,CAAA;MACJ;IACF;;AAEJ,CAAA,GACAvC,UAAU2C,0BAA0B;EAAEzC,UAAU0C;AAAiB,CAAA,GACjE5C,UAAU6C,gBAAgB;EAAEC,QAAQ;IAACrC,QAAOA;;AAAQ,CAAA,GACpDT,UAAU+C,iBAAiB;EAAE7C,UAAU8C;AAAa,CAAA,GACpDhD,UAAUiD,sBAAsB;EAAEC;AAAa,CAAA,GAC/CtD,OAAOuD,UAAU;EACfC,aAAaC,oBAAoBC;EACjCpD,UAAUqD;AACZ,CAAA,GACA3D,OAAOuD,UAAU;EACfC,aAAaI,aAAaC;EAC1BvD,UAAUwD;AACZ,CAAA,GACA9D,OAAO8C,IAAI;",
|
|
6
|
-
"names": ["Effect", "Option", "Plugin", "AppActivationEvents", "AppPlugin", "Annotation", "Ref", "Script", "Operation", "SpaceOperation", "Capability", "AppGraphBuilder", "Capability", "lazy", "Capability", "BlueprintDefinition", "Capability", "lazy", "Capability", "Compiler", "Capability", "lazy", "Capability", "OperationHandler", "Capability", "lazy", "Capability", "ReactSurface", "Capability", "lazy", "Capability", "ScriptSettings", "Capability", "lazy", "Script", "translations", "Script", "typename", "Notebook", "meta", "id", "ScriptPlugin", "Plugin", "define", "meta", "pipe", "AppPlugin", "addAppGraphModule", "activate", "AppGraphBuilder", "addBlueprintDefinitionModule", "BlueprintDefinition", "addMetadataModule", "metadata", "id", "Script", "typename", "icon", "Annotation", "IconAnnotation", "get", "getOrThrow", "iconHue", "hue", "loadReferences", "script", "Ref", "Array", "loadAll", "source", "inputSchema", "ScriptOperation", "ScriptProps", "createObject", "props", "options", "gen", "object", "Operation", "invoke", "CreateScript", "SpaceOperation", "AddObject", "target", "hidden", "targetNodeId", "Notebook", "NotebookProps", "make", "addOperationHandlerModule", "OperationHandler", "addSchemaModule", "schema", "addSurfaceModule", "ReactSurface", "addTranslationsModule", "translations", "addModule", "activatesOn", "AppActivationEvents", "SetupSettings", "ScriptSettings", "ScriptEvents", "SetupCompiler", "Compiler"]
|
|
7
|
-
}
|