@dxos/plugin-script 0.8.3-staging.0fa589b → 0.8.4-main.1068cf700f
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/browser/DeploymentDialog-XUAFCNI7.mjs +14 -0
- package/dist/lib/browser/NotebookContainer-UQ4I24R6.mjs +845 -0
- package/dist/lib/browser/NotebookContainer-UQ4I24R6.mjs.map +7 -0
- package/dist/lib/browser/ScriptContainer-NB76645V.mjs +149 -0
- package/dist/lib/browser/ScriptContainer-NB76645V.mjs.map +7 -0
- package/dist/lib/browser/app-graph-builder-66ZDI72K.mjs +69 -0
- package/dist/lib/browser/app-graph-builder-66ZDI72K.mjs.map +7 -0
- package/dist/lib/browser/blueprint-definition-5RFKE7VK.mjs +18 -0
- package/dist/lib/browser/blueprint-definition-5RFKE7VK.mjs.map +7 -0
- package/dist/lib/browser/blueprints/index.mjs +8 -0
- package/dist/lib/browser/chunk-3BSF5BIA.mjs +113 -0
- package/dist/lib/browser/chunk-3BSF5BIA.mjs.map +7 -0
- package/dist/lib/browser/chunk-4N5TLXEJ.mjs +105 -0
- package/dist/lib/browser/chunk-4N5TLXEJ.mjs.map +7 -0
- package/dist/lib/browser/chunk-BKGEAUUH.mjs +270 -0
- package/dist/lib/browser/chunk-BKGEAUUH.mjs.map +7 -0
- package/dist/lib/browser/chunk-BU6CGVU2.mjs +137 -0
- package/dist/lib/browser/chunk-BU6CGVU2.mjs.map +7 -0
- package/dist/lib/browser/chunk-F3QKSKSF.mjs +35 -0
- package/dist/lib/browser/chunk-F3QKSKSF.mjs.map +7 -0
- package/dist/lib/browser/chunk-I7CSE6T3.mjs +110 -0
- package/dist/lib/browser/chunk-I7CSE6T3.mjs.map +7 -0
- package/dist/lib/browser/chunk-J5LGTIGS.mjs +10 -0
- package/dist/lib/browser/chunk-LYMPME7J.mjs +609 -0
- package/dist/lib/browser/chunk-LYMPME7J.mjs.map +7 -0
- package/dist/lib/browser/chunk-WWCDIB6Z.mjs +557 -0
- package/dist/lib/browser/chunk-WWCDIB6Z.mjs.map +7 -0
- package/dist/lib/browser/{chunk-6ZHHWU6S.mjs → chunk-WYR4QHPE.mjs} +9 -6
- package/dist/lib/browser/chunk-WYR4QHPE.mjs.map +7 -0
- package/dist/lib/browser/compiler-VPUVTFQD.mjs +161 -0
- package/dist/lib/browser/compiler-VPUVTFQD.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +147 -109
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/operation-resolver-NYDY7GDT.mjs +83 -0
- package/dist/lib/browser/operation-resolver-NYDY7GDT.mjs.map +7 -0
- package/dist/lib/browser/react-surface-FYOQSC6S.mjs +140 -0
- package/dist/lib/browser/react-surface-FYOQSC6S.mjs.map +7 -0
- package/dist/lib/browser/settings-5SF77MRH.mjs +36 -0
- package/dist/lib/browser/settings-5SF77MRH.mjs.map +7 -0
- package/dist/lib/browser/templates/index.mjs +10 -0
- package/dist/lib/browser/types/index.mjs +18 -0
- package/dist/lib/browser/types/index.mjs.map +7 -0
- package/dist/lib/node-esm/DeploymentDialog-GGWDQMEB.mjs +15 -0
- package/dist/lib/node-esm/DeploymentDialog-GGWDQMEB.mjs.map +7 -0
- package/dist/lib/node-esm/NotebookContainer-DQGZ6QHI.mjs +846 -0
- package/dist/lib/node-esm/NotebookContainer-DQGZ6QHI.mjs.map +7 -0
- package/dist/lib/node-esm/ScriptContainer-PCNJFUWX.mjs +150 -0
- package/dist/lib/node-esm/ScriptContainer-PCNJFUWX.mjs.map +7 -0
- package/dist/lib/node-esm/app-graph-builder-IGAZTJ45.mjs +70 -0
- package/dist/lib/node-esm/app-graph-builder-IGAZTJ45.mjs.map +7 -0
- package/dist/lib/node-esm/blueprint-definition-EYL5GNDC.mjs +19 -0
- package/dist/lib/node-esm/blueprint-definition-EYL5GNDC.mjs.map +7 -0
- package/dist/lib/node-esm/blueprints/index.mjs +9 -0
- package/dist/lib/node-esm/blueprints/index.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-3CKQUF55.mjs +610 -0
- package/dist/lib/node-esm/chunk-3CKQUF55.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-3QBXN6QC.mjs +271 -0
- package/dist/lib/node-esm/chunk-3QBXN6QC.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-AEB5TPEW.mjs → chunk-5HSJPAK7.mjs} +9 -6
- package/dist/lib/node-esm/chunk-5HSJPAK7.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-ECRSTVR6.mjs +558 -0
- package/dist/lib/node-esm/chunk-ECRSTVR6.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-HSLMI22Q.mjs +11 -0
- package/dist/lib/node-esm/chunk-HSLMI22Q.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-KRVL7UYI.mjs +114 -0
- package/dist/lib/node-esm/chunk-KRVL7UYI.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-SLU3KRV3.mjs +112 -0
- package/dist/lib/node-esm/chunk-SLU3KRV3.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-U6PXM2HT.mjs +138 -0
- package/dist/lib/node-esm/chunk-U6PXM2HT.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-V37R7KB5.mjs +107 -0
- package/dist/lib/node-esm/chunk-V37R7KB5.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-Y3G5NCTP.mjs +36 -0
- package/dist/lib/node-esm/chunk-Y3G5NCTP.mjs.map +7 -0
- package/dist/lib/node-esm/compiler-WUOSY6MS.mjs +162 -0
- package/dist/lib/node-esm/compiler-WUOSY6MS.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +147 -109
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/operation-resolver-AJNJXGCE.mjs +84 -0
- package/dist/lib/node-esm/operation-resolver-AJNJXGCE.mjs.map +7 -0
- package/dist/lib/node-esm/react-surface-LREMOVNJ.mjs +141 -0
- package/dist/lib/node-esm/react-surface-LREMOVNJ.mjs.map +7 -0
- package/dist/lib/node-esm/settings-ILI762CY.mjs +37 -0
- package/dist/lib/node-esm/settings-ILI762CY.mjs.map +7 -0
- package/dist/lib/node-esm/templates/index.mjs +11 -0
- package/dist/lib/node-esm/templates/index.mjs.map +7 -0
- package/dist/lib/node-esm/types/index.mjs +19 -0
- package/dist/lib/node-esm/types/index.mjs.map +7 -0
- package/dist/types/src/ScriptPlugin.d.ts +2 -1
- package/dist/types/src/ScriptPlugin.d.ts.map +1 -1
- package/dist/types/src/blueprints/index.d.ts +2 -0
- package/dist/types/src/blueprints/index.d.ts.map +1 -0
- package/dist/types/src/blueprints/script-blueprint.d.ts +22 -0
- package/dist/types/src/blueprints/script-blueprint.d.ts.map +1 -0
- package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts +6 -0
- package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts.map +1 -0
- package/dist/types/src/capabilities/app-graph-builder/index.d.ts +3 -0
- package/dist/types/src/capabilities/app-graph-builder/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/artifact-definition/artifact-definition.d.ts +12 -0
- package/dist/types/src/capabilities/artifact-definition/artifact-definition.d.ts.map +1 -0
- package/dist/types/src/capabilities/artifact-definition/index.d.ts +3 -0
- package/dist/types/src/capabilities/artifact-definition/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/blueprint-definition/blueprint-definition.d.ts +10 -0
- package/dist/types/src/capabilities/blueprint-definition/blueprint-definition.d.ts.map +1 -0
- package/dist/types/src/capabilities/blueprint-definition/index.d.ts +3 -0
- package/dist/types/src/capabilities/blueprint-definition/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/compiler/compiler.d.ts +6 -0
- package/dist/types/src/capabilities/compiler/compiler.d.ts.map +1 -0
- package/dist/types/src/capabilities/compiler/index.d.ts +3 -0
- package/dist/types/src/capabilities/compiler/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +6 -7
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/operation-resolver/index.d.ts +3 -0
- package/dist/types/src/capabilities/operation-resolver/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts +5 -0
- package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface/index.d.ts +3 -0
- package/dist/types/src/capabilities/react-surface/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts +5 -0
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +1 -0
- package/dist/types/src/capabilities/settings/index.d.ts +7 -0
- package/dist/types/src/capabilities/settings/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/settings/settings.d.ts +10 -0
- package/dist/types/src/capabilities/settings/settings.d.ts.map +1 -0
- package/dist/types/src/compiler/compiler.d.ts +1 -1
- package/dist/types/src/compiler/compiler.d.ts.map +1 -1
- package/dist/types/src/components/DeploymentDialog/DeploymentDialog.d.ts +4 -4
- package/dist/types/src/components/DeploymentDialog/DeploymentDialog.d.ts.map +1 -1
- package/dist/types/src/components/DeploymentDialog/DeploymentDialog.stories.d.ts +244 -13
- package/dist/types/src/components/DeploymentDialog/DeploymentDialog.stories.d.ts.map +1 -1
- package/dist/types/src/components/DeploymentDialog/index.d.ts +1 -1
- package/dist/types/src/components/DeploymentDialog/index.d.ts.map +1 -1
- package/dist/types/src/components/FrameContainer/FrameContainer.d.ts +1 -1
- package/dist/types/src/components/FrameContainer/FrameContainer.d.ts.map +1 -1
- package/dist/types/src/components/NotebookContainer.d.ts +8 -0
- package/dist/types/src/components/NotebookContainer.d.ts.map +1 -0
- package/dist/types/src/components/NotebookContainer.stories.d.ts +7 -0
- package/dist/types/src/components/NotebookContainer.stories.d.ts.map +1 -0
- package/dist/types/src/components/NotebookStack/NotebookCell.d.ts +15 -0
- package/dist/types/src/components/NotebookStack/NotebookCell.d.ts.map +1 -0
- package/dist/types/src/components/NotebookStack/NotebookMenu.d.ts +9 -0
- package/dist/types/src/components/NotebookStack/NotebookMenu.d.ts.map +1 -0
- package/dist/types/src/components/NotebookStack/NotebookStack.d.ts +14 -0
- package/dist/types/src/components/NotebookStack/NotebookStack.d.ts.map +1 -0
- package/dist/types/src/components/NotebookStack/NotebookStack.stories.d.ts +249 -0
- package/dist/types/src/components/NotebookStack/NotebookStack.stories.d.ts.map +1 -0
- package/dist/types/src/components/NotebookStack/index.d.ts +3 -0
- package/dist/types/src/components/NotebookStack/index.d.ts.map +1 -0
- package/dist/types/src/components/QueryEditor/QueryEditor.d.ts +5 -0
- package/dist/types/src/components/QueryEditor/QueryEditor.d.ts.map +1 -0
- package/dist/types/src/components/QueryEditor/QueryEditor.stories.d.ts +13 -0
- package/dist/types/src/components/QueryEditor/QueryEditor.stories.d.ts.map +1 -0
- package/dist/types/src/components/QueryEditor/index.d.ts +2 -0
- package/dist/types/src/components/QueryEditor/index.d.ts.map +1 -0
- package/dist/types/src/components/ScriptContainer.d.ts +7 -8
- package/dist/types/src/components/ScriptContainer.d.ts.map +1 -1
- package/dist/types/src/components/ScriptToolbar/ScriptToolbar.d.ts +7 -8
- package/dist/types/src/components/ScriptToolbar/ScriptToolbar.d.ts.map +1 -1
- package/dist/types/src/components/ScriptToolbar/ScriptToolbar.stories.d.ts +246 -10
- package/dist/types/src/components/ScriptToolbar/ScriptToolbar.stories.d.ts.map +1 -1
- package/dist/types/src/components/Settings/ScriptObjectSettings.d.ts +2 -2
- package/dist/types/src/components/Settings/ScriptObjectSettings.d.ts.map +1 -1
- package/dist/types/src/components/Settings/ScriptPluginSettings.d.ts +6 -4
- package/dist/types/src/components/Settings/ScriptPluginSettings.d.ts.map +1 -1
- package/dist/types/src/components/TestPanel/TestContainer.d.ts +5 -4
- package/dist/types/src/components/TestPanel/TestContainer.d.ts.map +1 -1
- package/dist/types/src/components/TestPanel/TestPanel.d.ts.map +1 -1
- package/dist/types/src/components/TypescriptEditor/TypescriptEditor.d.ts +5 -2
- package/dist/types/src/components/TypescriptEditor/TypescriptEditor.d.ts.map +1 -1
- package/dist/types/src/components/TypescriptEditor/TypescriptEditor.stories.d.ts +11 -4
- package/dist/types/src/components/TypescriptEditor/TypescriptEditor.stories.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +4 -5
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/e2e/ai.test.d.ts +2 -0
- package/dist/types/src/e2e/ai.test.d.ts.map +1 -0
- package/dist/types/src/e2e/deploy.test.d.ts +2 -0
- package/dist/types/src/e2e/deploy.test.d.ts.map +1 -0
- package/dist/types/src/hooks/deploy.d.ts +18 -32
- package/dist/types/src/hooks/deploy.d.ts.map +1 -1
- package/dist/types/src/hooks/format.d.ts +4 -4
- package/dist/types/src/hooks/format.d.ts.map +1 -1
- package/dist/types/src/hooks/index.d.ts +1 -0
- package/dist/types/src/hooks/index.d.ts.map +1 -1
- package/dist/types/src/hooks/template.d.ts +6 -16
- package/dist/types/src/hooks/template.d.ts.map +1 -1
- package/dist/types/src/hooks/useCompiler.d.ts +7 -0
- package/dist/types/src/hooks/useCompiler.d.ts.map +1 -0
- package/dist/types/src/hooks/useCreateAndDeployScriptTemplates.d.ts.map +1 -1
- package/dist/types/src/hooks/useToolbarState.d.ts +8 -1
- package/dist/types/src/hooks/useToolbarState.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +2 -1
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +2 -3
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/notebook/compute-graph.d.ts +58 -0
- package/dist/types/src/notebook/compute-graph.d.ts.map +1 -0
- package/dist/types/src/notebook/compute-graph.test.d.ts +2 -0
- package/dist/types/src/notebook/compute-graph.test.d.ts.map +1 -0
- package/dist/types/src/notebook/eval.d.ts +13 -0
- package/dist/types/src/notebook/eval.d.ts.map +1 -0
- package/dist/types/src/notebook/index.d.ts +2 -0
- package/dist/types/src/notebook/index.d.ts.map +1 -0
- package/dist/types/src/notebook/vfs-parser.d.ts +74 -0
- package/dist/types/src/notebook/vfs-parser.d.ts.map +1 -0
- package/dist/types/src/notebook/vfs-parser.test.d.ts +2 -0
- package/dist/types/src/notebook/vfs-parser.test.d.ts.map +1 -0
- package/dist/types/src/templates/anthropic.d.ts +8 -0
- package/dist/types/src/templates/anthropic.d.ts.map +1 -0
- package/dist/types/src/templates/chess-bot.d.ts +16 -0
- package/dist/types/src/templates/chess-bot.d.ts.map +1 -0
- package/dist/types/src/templates/commentary.d.ts +16 -0
- package/dist/types/src/templates/commentary.d.ts.map +1 -0
- 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/forex-effect.d.ts +4 -1
- package/dist/types/src/templates/forex-effect.d.ts.map +1 -1
- package/dist/types/src/templates/forex.d.ts +4 -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 +54 -1
- package/dist/types/src/templates/index.d.ts.map +1 -1
- package/dist/types/src/templates/ping.d.ts +3 -0
- package/dist/types/src/templates/ping.d.ts.map +1 -0
- package/dist/types/src/testing/data.d.ts +3 -0
- package/dist/types/src/testing/data.d.ts.map +1 -0
- package/dist/types/src/testing/index.d.ts +2 -0
- package/dist/types/src/testing/index.d.ts.map +1 -0
- package/dist/types/src/testing/simulator.test.d.ts +2 -0
- package/dist/types/src/testing/simulator.test.d.ts.map +1 -0
- package/dist/types/src/translations.d.ts +94 -176
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/Notebook.d.ts +100 -0
- package/dist/types/src/types/Notebook.d.ts.map +1 -0
- package/dist/types/src/types/actions.d.ts +40 -0
- package/dist/types/src/types/actions.d.ts.map +1 -0
- package/dist/types/src/types/capabilities.d.ts +12 -0
- package/dist/types/src/types/capabilities.d.ts.map +1 -0
- package/dist/types/src/types/events.d.ts +5 -0
- package/dist/types/src/types/events.d.ts.map +1 -0
- package/dist/types/src/types/index.d.ts +6 -0
- package/dist/types/src/types/index.d.ts.map +1 -0
- package/dist/types/src/types/types.d.ts +6 -0
- package/dist/types/src/types/types.d.ts.map +1 -0
- package/dist/types/src/util/deploy.d.ts +7 -7
- package/dist/types/src/util/deploy.d.ts.map +1 -1
- package/dist/types/src/util/functions.d.ts +6 -3
- package/dist/types/src/util/functions.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +128 -83
- package/src/ScriptPlugin.tsx +59 -78
- package/src/blueprints/index.ts +5 -0
- package/src/blueprints/script-blueprint.ts +24 -0
- package/src/capabilities/app-graph-builder/app-graph-builder.ts +56 -0
- package/src/capabilities/app-graph-builder/index.ts +7 -0
- package/src/capabilities/{artifact-definition.ts → artifact-definition/artifact-definition.ts} +105 -106
- package/src/capabilities/artifact-definition/index.ts +7 -0
- package/src/capabilities/blueprint-definition/blueprint-definition.ts +24 -0
- package/src/capabilities/blueprint-definition/index.ts +7 -0
- package/src/capabilities/compiler/compiler.ts +103 -0
- package/src/capabilities/compiler/index.ts +7 -0
- package/src/capabilities/index.ts +6 -10
- package/src/capabilities/operation-resolver/index.ts +7 -0
- package/src/capabilities/operation-resolver/operation-resolver.ts +75 -0
- package/src/capabilities/react-surface/index.ts +7 -0
- package/src/capabilities/react-surface/react-surface.tsx +119 -0
- package/src/capabilities/settings/index.ts +7 -0
- package/src/capabilities/settings/settings.ts +33 -0
- package/src/compiler/compiler.ts +11 -4
- package/src/components/DeploymentDialog/DeploymentDialog.stories.tsx +47 -24
- package/src/components/DeploymentDialog/DeploymentDialog.tsx +45 -54
- package/src/components/DeploymentDialog/index.ts +1 -1
- package/src/components/FrameContainer/FrameContainer.tsx +8 -5
- package/src/components/FrameContainer/frame.tsx +1 -1
- package/src/components/NotebookContainer.stories.tsx +87 -0
- package/src/components/NotebookContainer.tsx +271 -0
- package/src/components/NotebookStack/NotebookCell.tsx +217 -0
- package/src/components/NotebookStack/NotebookMenu.tsx +47 -0
- package/src/components/NotebookStack/NotebookStack.stories.tsx +55 -0
- package/src/components/NotebookStack/NotebookStack.tsx +86 -0
- package/src/components/NotebookStack/index.ts +6 -0
- package/src/components/QueryEditor/QueryEditor.stories.tsx +100 -0
- package/src/components/QueryEditor/QueryEditor.tsx +47 -0
- package/src/components/QueryEditor/index.ts +5 -0
- package/src/components/ScriptContainer.tsx +52 -35
- package/src/components/ScriptToolbar/ScriptToolbar.stories.tsx +57 -17
- package/src/components/ScriptToolbar/ScriptToolbar.tsx +37 -33
- package/src/components/Settings/ScriptObjectSettings.tsx +151 -48
- package/src/components/Settings/ScriptPluginSettings.tsx +43 -48
- package/src/components/TestPanel/TestContainer.tsx +13 -7
- package/src/components/TestPanel/TestPanel.tsx +66 -41
- package/src/components/TypescriptEditor/TypescriptEditor.stories.tsx +86 -33
- package/src/components/TypescriptEditor/TypescriptEditor.tsx +84 -81
- package/src/components/index.ts +3 -0
- package/src/e2e/ai.test.ts +92 -0
- package/src/e2e/deploy.test.ts +64 -0
- package/src/hooks/deploy.ts +49 -42
- package/src/hooks/format.ts +9 -5
- package/src/hooks/index.ts +1 -0
- package/src/hooks/template.ts +21 -24
- package/src/hooks/useCompiler.ts +24 -0
- package/src/hooks/useCreateAndDeployScriptTemplates.ts +15 -16
- package/src/hooks/useToolbarState.ts +29 -4
- package/src/index.ts +2 -1
- package/src/meta.ts +9 -7
- package/src/notebook/compute-graph.test.ts +82 -0
- package/src/notebook/compute-graph.ts +230 -0
- package/src/notebook/eval.ts +105 -0
- package/src/notebook/index.ts +5 -0
- package/src/notebook/vfs-parser.test.ts +149 -0
- package/src/notebook/vfs-parser.ts +451 -0
- package/src/templates/anthropic.ts +42 -0
- package/src/templates/chess-bot.ts +58 -0
- package/src/templates/commentary.ts +230 -0
- package/src/templates/data-generator.ts +11 -5
- package/src/templates/discord.ts +12 -4
- package/src/templates/email.ts +2 -2
- package/src/templates/forex-effect.ts +24 -25
- package/src/templates/forex.ts +9 -6
- package/src/templates/gmail.ts +35 -65
- package/src/templates/index.ts +26 -11
- package/src/templates/ping.ts +17 -0
- package/src/testing/data.ts +72 -0
- package/src/testing/index.ts +5 -0
- package/src/testing/simulator.test.ts +40 -0
- package/src/translations.ts +42 -12
- package/src/types/Notebook.ts +41 -0
- package/src/types/actions.ts +45 -0
- package/src/types/capabilities.ts +17 -0
- package/src/types/events.ts +11 -0
- package/src/types/index.ts +9 -0
- package/src/types/types.ts +15 -0
- package/src/util/deploy.ts +38 -61
- package/src/util/functions.ts +58 -25
- package/src/vite-env.d.ts +2 -0
- package/dist/lib/browser/DeploymentDialog-RPPPWEEL.mjs +0 -12
- package/dist/lib/browser/ScriptContainer-RSN52NH7.mjs +0 -261
- package/dist/lib/browser/ScriptContainer-RSN52NH7.mjs.map +0 -7
- package/dist/lib/browser/app-graph-builder-5Z3MUX4N.mjs +0 -64
- package/dist/lib/browser/app-graph-builder-5Z3MUX4N.mjs.map +0 -7
- package/dist/lib/browser/artifact-definition-A4TBQL75.mjs +0 -249
- package/dist/lib/browser/artifact-definition-A4TBQL75.mjs.map +0 -7
- package/dist/lib/browser/chunk-3FU4QZVP.mjs +0 -364
- package/dist/lib/browser/chunk-3FU4QZVP.mjs.map +0 -7
- package/dist/lib/browser/chunk-3JLR2SHJ.mjs +0 -557
- package/dist/lib/browser/chunk-3JLR2SHJ.mjs.map +0 -7
- package/dist/lib/browser/chunk-6ZHHWU6S.mjs.map +0 -7
- package/dist/lib/browser/chunk-LA66DQGU.mjs +0 -153
- package/dist/lib/browser/chunk-LA66DQGU.mjs.map +0 -7
- package/dist/lib/browser/chunk-QJH7I2UV.mjs +0 -233
- package/dist/lib/browser/chunk-QJH7I2UV.mjs.map +0 -7
- package/dist/lib/browser/chunk-WB3X5Z7Q.mjs +0 -40
- package/dist/lib/browser/chunk-WB3X5Z7Q.mjs.map +0 -7
- package/dist/lib/browser/chunk-YSQMXTYO.mjs +0 -15
- package/dist/lib/browser/chunk-YSQMXTYO.mjs.map +0 -7
- package/dist/lib/browser/compiler-W4BYJYTL.mjs +0 -82
- package/dist/lib/browser/compiler-W4BYJYTL.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-JOJNH4UX.mjs +0 -90
- package/dist/lib/browser/intent-resolver-JOJNH4UX.mjs.map +0 -7
- package/dist/lib/browser/react-surface-7BKUWL2U.mjs +0 -105
- package/dist/lib/browser/react-surface-7BKUWL2U.mjs.map +0 -7
- package/dist/lib/browser/settings-Z22D6JVJ.mjs +0 -24
- package/dist/lib/browser/settings-Z22D6JVJ.mjs.map +0 -7
- package/dist/lib/browser/types.mjs +0 -13
- package/dist/lib/node/DeploymentDialog-C3EEYGRH.cjs +0 -33
- package/dist/lib/node/DeploymentDialog-C3EEYGRH.cjs.map +0 -7
- package/dist/lib/node/ScriptContainer-CAC7AISY.cjs +0 -278
- package/dist/lib/node/ScriptContainer-CAC7AISY.cjs.map +0 -7
- package/dist/lib/node/app-graph-builder-25OOTBW4.cjs +0 -80
- package/dist/lib/node/app-graph-builder-25OOTBW4.cjs.map +0 -7
- package/dist/lib/node/artifact-definition-QKZI6PTO.cjs +0 -265
- package/dist/lib/node/artifact-definition-QKZI6PTO.cjs.map +0 -7
- package/dist/lib/node/chunk-AU2FOE26.cjs +0 -369
- package/dist/lib/node/chunk-AU2FOE26.cjs.map +0 -7
- package/dist/lib/node/chunk-BUOBOT3V.cjs +0 -179
- package/dist/lib/node/chunk-BUOBOT3V.cjs.map +0 -7
- package/dist/lib/node/chunk-HCRW6T3G.cjs +0 -60
- package/dist/lib/node/chunk-HCRW6T3G.cjs.map +0 -7
- package/dist/lib/node/chunk-OSBMUJ4T.cjs +0 -580
- package/dist/lib/node/chunk-OSBMUJ4T.cjs.map +0 -7
- package/dist/lib/node/chunk-QG2X6J74.cjs +0 -52
- package/dist/lib/node/chunk-QG2X6J74.cjs.map +0 -7
- package/dist/lib/node/chunk-YO5W2IPQ.cjs +0 -251
- package/dist/lib/node/chunk-YO5W2IPQ.cjs.map +0 -7
- package/dist/lib/node/chunk-ZEV3VARQ.cjs +0 -34
- package/dist/lib/node/chunk-ZEV3VARQ.cjs.map +0 -7
- package/dist/lib/node/compiler-TFSJRLL4.cjs +0 -104
- package/dist/lib/node/compiler-TFSJRLL4.cjs.map +0 -7
- package/dist/lib/node/index.cjs +0 -225
- package/dist/lib/node/index.cjs.map +0 -7
- package/dist/lib/node/intent-resolver-BQ2NKEM7.cjs +0 -100
- package/dist/lib/node/intent-resolver-BQ2NKEM7.cjs.map +0 -7
- package/dist/lib/node/meta.json +0 -1
- package/dist/lib/node/react-surface-EUKPDFU3.cjs +0 -120
- package/dist/lib/node/react-surface-EUKPDFU3.cjs.map +0 -7
- package/dist/lib/node/settings-WO53FLYZ.cjs +0 -38
- package/dist/lib/node/settings-WO53FLYZ.cjs.map +0 -7
- package/dist/lib/node/types.cjs +0 -34
- package/dist/lib/node/types.cjs.map +0 -7
- package/dist/lib/node-esm/DeploymentDialog-IA4CH6WZ.mjs +0 -13
- package/dist/lib/node-esm/ScriptContainer-4IOOIPBF.mjs +0 -262
- package/dist/lib/node-esm/ScriptContainer-4IOOIPBF.mjs.map +0 -7
- package/dist/lib/node-esm/app-graph-builder-IOOUTHV2.mjs +0 -65
- package/dist/lib/node-esm/app-graph-builder-IOOUTHV2.mjs.map +0 -7
- package/dist/lib/node-esm/artifact-definition-4XRYAP54.mjs +0 -250
- package/dist/lib/node-esm/artifact-definition-4XRYAP54.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-2KJYPUQD.mjs +0 -16
- package/dist/lib/node-esm/chunk-2KJYPUQD.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-AEB5TPEW.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-B4TP3LSZ.mjs +0 -558
- package/dist/lib/node-esm/chunk-B4TP3LSZ.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-MJJQBUOL.mjs +0 -234
- package/dist/lib/node-esm/chunk-MJJQBUOL.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-T7XDCUTF.mjs +0 -154
- package/dist/lib/node-esm/chunk-T7XDCUTF.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-UESZKXLR.mjs +0 -41
- package/dist/lib/node-esm/chunk-UESZKXLR.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-W2DAXWHA.mjs +0 -365
- package/dist/lib/node-esm/chunk-W2DAXWHA.mjs.map +0 -7
- package/dist/lib/node-esm/compiler-7PQ4D43R.mjs +0 -83
- package/dist/lib/node-esm/compiler-7PQ4D43R.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-HTM5PSRZ.mjs +0 -91
- package/dist/lib/node-esm/intent-resolver-HTM5PSRZ.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-6UO64YOS.mjs +0 -106
- package/dist/lib/node-esm/react-surface-6UO64YOS.mjs.map +0 -7
- package/dist/lib/node-esm/settings-KZEGCDYX.mjs +0 -25
- package/dist/lib/node-esm/settings-KZEGCDYX.mjs.map +0 -7
- package/dist/lib/node-esm/types.mjs +0 -14
- package/dist/types/src/capabilities/app-graph-builder.d.ts +0 -4
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +0 -1
- package/dist/types/src/capabilities/artifact-definition.d.ts +0 -11
- package/dist/types/src/capabilities/artifact-definition.d.ts.map +0 -1
- package/dist/types/src/capabilities/capabilities.d.ts +0 -5
- package/dist/types/src/capabilities/capabilities.d.ts.map +0 -1
- package/dist/types/src/capabilities/compiler.d.ts +0 -4
- package/dist/types/src/capabilities/compiler.d.ts.map +0 -1
- package/dist/types/src/capabilities/intent-resolver.d.ts +0 -4
- package/dist/types/src/capabilities/intent-resolver.d.ts.map +0 -1
- package/dist/types/src/capabilities/react-surface.d.ts +0 -4
- package/dist/types/src/capabilities/react-surface.d.ts.map +0 -1
- package/dist/types/src/capabilities/settings.d.ts +0 -4
- package/dist/types/src/capabilities/settings.d.ts.map +0 -1
- package/dist/types/src/events.d.ts +0 -4
- package/dist/types/src/events.d.ts.map +0 -1
- package/dist/types/src/templates/chess.d.ts +0 -3
- package/dist/types/src/templates/chess.d.ts.map +0 -1
- package/dist/types/src/templates/echo.d.ts +0 -6
- package/dist/types/src/templates/echo.d.ts.map +0 -1
- package/dist/types/src/types.d.ts +0 -40
- package/dist/types/src/types.d.ts.map +0 -1
- package/src/capabilities/app-graph-builder.ts +0 -64
- package/src/capabilities/capabilities.ts +0 -12
- package/src/capabilities/compiler.ts +0 -33
- package/src/capabilities/intent-resolver.ts +0 -80
- package/src/capabilities/react-surface.tsx +0 -89
- package/src/capabilities/settings.ts +0 -21
- package/src/events.ts +0 -11
- package/src/templates/chess.ts +0 -47
- package/src/templates/echo.ts +0 -8
- package/src/types.ts +0 -42
- /package/dist/lib/browser/{DeploymentDialog-RPPPWEEL.mjs.map → DeploymentDialog-XUAFCNI7.mjs.map} +0 -0
- /package/dist/lib/browser/{types.mjs.map → blueprints/index.mjs.map} +0 -0
- /package/dist/lib/{node-esm/DeploymentDialog-IA4CH6WZ.mjs.map → browser/chunk-J5LGTIGS.mjs.map} +0 -0
- /package/dist/lib/{node-esm/types.mjs.map → browser/templates/index.mjs.map} +0 -0
package/src/templates/gmail.ts
CHANGED
|
@@ -3,20 +3,32 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
// @ts-ignore
|
|
6
|
-
import {
|
|
6
|
+
import { EchoObject, Filter, ObjectId, S, create, defineFunction } from 'dxos:functions';
|
|
7
7
|
// @ts-ignore
|
|
8
8
|
import {
|
|
9
|
+
FetchHttpClient,
|
|
9
10
|
HttpClient,
|
|
10
11
|
HttpClientRequest,
|
|
11
|
-
FetchHttpClient,
|
|
12
12
|
// @ts-ignore
|
|
13
|
-
} from 'https://esm.sh/@effect/platform@0.
|
|
13
|
+
} from 'https://esm.sh/@effect/platform@0.89.0?deps=effect@3.17.0&bundle=false';
|
|
14
14
|
// @ts-ignore
|
|
15
15
|
import { format, subDays } from 'https://esm.sh/date-fns@3.3.1?bundle=false';
|
|
16
16
|
// @ts-ignore
|
|
17
|
-
import
|
|
17
|
+
import * as Chunk from 'https://esm.sh/effect@3.17.0/Chunk?bundle=false';
|
|
18
|
+
// @ts-ignore
|
|
19
|
+
import * as Effect from 'https://esm.sh/effect@3.17.0/Effect?bundle=false';
|
|
20
|
+
// @ts-ignore
|
|
21
|
+
import * as Function from 'https://esm.sh/effect@3.17.0/Function?bundle=false';
|
|
22
|
+
// @ts-ignore
|
|
23
|
+
import * as Ref from 'https://esm.sh/effect@3.17.0/Ref?bundle=false';
|
|
24
|
+
// @ts-ignore
|
|
25
|
+
import * as Schedule from 'https://esm.sh/effect@3.17.0/Schedule?bundle=false';
|
|
26
|
+
// @ts-ignore
|
|
27
|
+
import * as Stream from 'https://esm.sh/effect@3.17.0/Stream?bundle=false';
|
|
18
28
|
|
|
19
29
|
export default defineFunction({
|
|
30
|
+
key: 'dxos.org/script/gmail',
|
|
31
|
+
name: 'Gmail',
|
|
20
32
|
inputSchema: S.Struct({
|
|
21
33
|
mailboxId: S.String,
|
|
22
34
|
userId: S.optional(S.String).pipe(S.withDecodingDefault(() => 'me')),
|
|
@@ -41,7 +53,7 @@ export default defineFunction({
|
|
|
41
53
|
|
|
42
54
|
// NOTE: Google API bundles size is v. large and caused runtime issues.
|
|
43
55
|
const makeRequest = (url: string) =>
|
|
44
|
-
pipe(
|
|
56
|
+
Function.pipe(
|
|
45
57
|
url,
|
|
46
58
|
HttpClientRequest.get,
|
|
47
59
|
HttpClientRequest.setHeaders({ Authorization: `Bearer ${token}`, Accept: 'application/json' }),
|
|
@@ -80,7 +92,7 @@ export default defineFunction({
|
|
|
80
92
|
const messageDetails = yield* getMessage(userId, message.id);
|
|
81
93
|
const created = new Date(parseInt(messageDetails.internalDate)).toISOString();
|
|
82
94
|
const from = messageDetails.payload.headers.find((h: any) => h.name === 'From');
|
|
83
|
-
const sender = from &&
|
|
95
|
+
const sender = from && parseFromHeader(from.value);
|
|
84
96
|
// TODO(wittjosiah): Improve parsing of email contents.
|
|
85
97
|
const content =
|
|
86
98
|
messageDetails.payload.body?.data ??
|
|
@@ -98,7 +110,7 @@ export default defineFunction({
|
|
|
98
110
|
sender,
|
|
99
111
|
blocks: [
|
|
100
112
|
{
|
|
101
|
-
|
|
113
|
+
_tag: 'text',
|
|
102
114
|
text: Buffer.from(content, 'base64').toString('utf-8'),
|
|
103
115
|
},
|
|
104
116
|
],
|
|
@@ -114,7 +126,7 @@ export default defineFunction({
|
|
|
114
126
|
|
|
115
127
|
const queueMessages = yield* Ref.get(newMessages);
|
|
116
128
|
if (queueMessages.length > 0) {
|
|
117
|
-
yield* pipe(
|
|
129
|
+
yield* Function.pipe(
|
|
118
130
|
queueMessages,
|
|
119
131
|
Stream.fromIterable,
|
|
120
132
|
Stream.grouped(10),
|
|
@@ -145,26 +157,25 @@ const getUrl = (userId: string, messageId?: string, params?: Record<string, any>
|
|
|
145
157
|
/**
|
|
146
158
|
* Parses an email string in the format "Name <email@example.com>" into separate name and email components.
|
|
147
159
|
*/
|
|
148
|
-
const
|
|
149
|
-
const
|
|
160
|
+
const parseFromHeader = (value: string): { name?: string; email: string } | undefined => {
|
|
161
|
+
const EMAIL_REGEX = /^([^<]+?)\s*<([^>]+@[^>]+)>$/;
|
|
162
|
+
const removeOuterQuotes = (str: string) => str.replace(/^['"]|['"]$/g, '');
|
|
163
|
+
const match = value.match(EMAIL_REGEX);
|
|
150
164
|
if (match) {
|
|
151
165
|
const [, name, email] = match;
|
|
152
166
|
return {
|
|
153
|
-
name: name.trim(),
|
|
167
|
+
name: removeOuterQuotes(name.trim()),
|
|
154
168
|
email: email.trim(),
|
|
155
169
|
};
|
|
156
170
|
}
|
|
157
|
-
|
|
158
|
-
return undefined;
|
|
159
171
|
};
|
|
160
172
|
|
|
161
173
|
//
|
|
162
174
|
// Schemas
|
|
163
|
-
// TODO(wittjosiah): These schemas should be imported from @dxos/
|
|
175
|
+
// TODO(wittjosiah): These schemas should be imported from @dxos/schema.
|
|
164
176
|
//
|
|
165
177
|
|
|
166
|
-
const
|
|
167
|
-
const ActorRole = S.Literal(...ActorRoles);
|
|
178
|
+
const ActorRole = S.Literal('user', 'assistant');
|
|
168
179
|
type ActorRole = S.Schema.Type<typeof ActorRole>;
|
|
169
180
|
|
|
170
181
|
const ActorSchema = S.Struct({
|
|
@@ -174,57 +185,16 @@ const ActorSchema = S.Struct({
|
|
|
174
185
|
role: S.optional(ActorRole),
|
|
175
186
|
});
|
|
176
187
|
|
|
177
|
-
const
|
|
188
|
+
const Base = S.Struct({
|
|
178
189
|
pending: S.optional(S.Boolean),
|
|
179
190
|
});
|
|
180
|
-
type
|
|
181
|
-
const
|
|
182
|
-
|
|
183
|
-
S.
|
|
184
|
-
|
|
185
|
-
disposition: S.optional(S.String),
|
|
186
|
-
text: S.String,
|
|
187
|
-
}),
|
|
188
|
-
).pipe(S.mutable);
|
|
189
|
-
type TextContentBlock = S.Schema.Type<typeof TextContentBlock>;
|
|
190
|
-
const JsonContentBlock = S.extend(
|
|
191
|
-
AbstractContentBlock,
|
|
192
|
-
S.Struct({
|
|
193
|
-
type: S.Literal('json'),
|
|
194
|
-
disposition: S.optional(S.String),
|
|
195
|
-
data: S.String,
|
|
196
|
-
}),
|
|
197
|
-
).pipe(S.mutable);
|
|
198
|
-
type JsonContentBlock = S.Schema.Type<typeof JsonContentBlock>;
|
|
199
|
-
const Base64ImageSource = S.Struct({
|
|
200
|
-
type: S.Literal('base64'),
|
|
201
|
-
mediaType: S.String,
|
|
202
|
-
data: S.String,
|
|
191
|
+
type Base = S.Schema.Type<typeof Base>;
|
|
192
|
+
const Text = S.TaggedStruct('text', {
|
|
193
|
+
mimeType: S.optional(S.String),
|
|
194
|
+
text: S.String,
|
|
195
|
+
...Base.fields,
|
|
203
196
|
}).pipe(S.mutable);
|
|
204
|
-
|
|
205
|
-
type: S.Literal('http'),
|
|
206
|
-
url: S.String,
|
|
207
|
-
}).pipe(S.mutable);
|
|
208
|
-
const ImageSource = S.Union(Base64ImageSource, HttpImageSource);
|
|
209
|
-
type ImageSource = S.Schema.Type<typeof ImageSource>;
|
|
210
|
-
const ImageContentBlock = S.extend(
|
|
211
|
-
AbstractContentBlock,
|
|
212
|
-
S.Struct({
|
|
213
|
-
type: S.Literal('image'),
|
|
214
|
-
id: S.optional(S.String),
|
|
215
|
-
source: S.optional(ImageSource),
|
|
216
|
-
}),
|
|
217
|
-
).pipe(S.mutable);
|
|
218
|
-
type ImageContentBlock = S.Schema.Type<typeof ImageContentBlock>;
|
|
219
|
-
const ReferenceContentBlock = S.extend(
|
|
220
|
-
AbstractContentBlock,
|
|
221
|
-
S.Struct({
|
|
222
|
-
type: S.Literal('reference'),
|
|
223
|
-
reference: S.Any,
|
|
224
|
-
}),
|
|
225
|
-
).pipe(S.mutable);
|
|
226
|
-
type ReferenceContentBlock = S.Schema.Type<typeof ReferenceContentBlock>;
|
|
227
|
-
const MessageContentBlock = S.Union(TextContentBlock, JsonContentBlock, ImageContentBlock, ReferenceContentBlock);
|
|
197
|
+
interface Text extends S.Schema.Type<typeof Text> {}
|
|
228
198
|
|
|
229
199
|
const MessageType = S.Struct({
|
|
230
200
|
id: ObjectId,
|
|
@@ -234,7 +204,7 @@ const MessageType = S.Struct({
|
|
|
234
204
|
sender: ActorSchema.annotations({
|
|
235
205
|
description: 'Identity of the message sender.',
|
|
236
206
|
}),
|
|
237
|
-
blocks: S.Array(
|
|
207
|
+
blocks: S.Array(Text).annotations({
|
|
238
208
|
description: 'Contents of the message.',
|
|
239
209
|
}),
|
|
240
210
|
properties: S.optional(
|
package/src/templates/index.ts
CHANGED
|
@@ -2,18 +2,22 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
+
import anthropic from './anthropic.ts?raw';
|
|
5
6
|
import chat from './chat.ts?raw';
|
|
6
|
-
import
|
|
7
|
+
import chessBot from './chess-bot.ts?raw';
|
|
8
|
+
import commentary from './commentary.ts?raw';
|
|
7
9
|
import dataGenerator from './data-generator.ts?raw';
|
|
8
10
|
import discord from './discord.ts?raw';
|
|
9
|
-
import echo from './echo.ts?raw';
|
|
10
11
|
import email from './email.ts?raw';
|
|
11
12
|
import forexEffect from './forex-effect.ts?raw';
|
|
12
13
|
import forex from './forex.ts?raw';
|
|
13
14
|
import gmail from './gmail.ts?raw';
|
|
15
|
+
import ping from './ping.ts?raw';
|
|
14
16
|
|
|
15
17
|
const removeHeader = (str: string) => str.split('\n').slice(4).join('\n');
|
|
16
18
|
|
|
19
|
+
export { dataGenerator };
|
|
20
|
+
|
|
17
21
|
export type Template = {
|
|
18
22
|
id: string;
|
|
19
23
|
name: string;
|
|
@@ -21,11 +25,11 @@ export type Template = {
|
|
|
21
25
|
presetId?: string;
|
|
22
26
|
};
|
|
23
27
|
|
|
24
|
-
export const templates
|
|
28
|
+
export const templates = [
|
|
25
29
|
{
|
|
26
|
-
id: 'dxos.org/script/
|
|
27
|
-
name: '
|
|
28
|
-
source: removeHeader(
|
|
30
|
+
id: 'dxos.org/script/ping',
|
|
31
|
+
name: 'Ping',
|
|
32
|
+
source: removeHeader(ping),
|
|
29
33
|
},
|
|
30
34
|
{
|
|
31
35
|
id: 'dxos.org/script/forex',
|
|
@@ -44,10 +48,10 @@ export const templates: Template[] = [
|
|
|
44
48
|
presetId: 'dxos.org/function/gpt',
|
|
45
49
|
},
|
|
46
50
|
{
|
|
47
|
-
id: 'dxos.org/script/chess',
|
|
48
|
-
name: 'Chess',
|
|
49
|
-
source: removeHeader(
|
|
50
|
-
presetId: 'dxos.org/function/chess',
|
|
51
|
+
id: 'dxos.org/script/chess-bot',
|
|
52
|
+
name: 'Chess Bot',
|
|
53
|
+
source: removeHeader(chessBot),
|
|
54
|
+
presetId: 'dxos.org/function/chess-bot',
|
|
51
55
|
},
|
|
52
56
|
{
|
|
53
57
|
id: 'dxos.org/script/email',
|
|
@@ -73,4 +77,15 @@ export const templates: Template[] = [
|
|
|
73
77
|
source: removeHeader(dataGenerator),
|
|
74
78
|
presetId: 'dxos.org/function/data-generator',
|
|
75
79
|
},
|
|
76
|
-
|
|
80
|
+
{
|
|
81
|
+
id: 'dxos.org/script/anthropic',
|
|
82
|
+
name: 'Anthropic',
|
|
83
|
+
source: removeHeader(anthropic),
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
id: 'dxos.org/script/commentary',
|
|
87
|
+
name: 'Commentary',
|
|
88
|
+
source: removeHeader(commentary),
|
|
89
|
+
presetId: 'dxos.org/function/chess/commentary',
|
|
90
|
+
},
|
|
91
|
+
] as const;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Schema from 'effect/Schema';
|
|
6
|
+
|
|
7
|
+
import { defineFunction } from '@dxos/functions';
|
|
8
|
+
|
|
9
|
+
export default defineFunction({
|
|
10
|
+
key: 'dxos.org/script/ping',
|
|
11
|
+
name: 'Ping',
|
|
12
|
+
inputSchema: Schema.Any,
|
|
13
|
+
|
|
14
|
+
handler: async ({ data }) => {
|
|
15
|
+
return data;
|
|
16
|
+
},
|
|
17
|
+
});
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { Prompt } from '@dxos/blueprints';
|
|
6
|
+
import { Ref } from '@dxos/echo';
|
|
7
|
+
import { createObject } from '@dxos/echo-db';
|
|
8
|
+
import { PublicKey } from '@dxos/keys';
|
|
9
|
+
import { Markdown } from '@dxos/plugin-markdown/types';
|
|
10
|
+
import { Text } from '@dxos/schema';
|
|
11
|
+
|
|
12
|
+
import { Notebook } from '../types';
|
|
13
|
+
|
|
14
|
+
// TODO(burdon): NOTE: createObject is required for tests.
|
|
15
|
+
|
|
16
|
+
export const createNotebook = (): Notebook.Notebook =>
|
|
17
|
+
Notebook.make({
|
|
18
|
+
cells: [
|
|
19
|
+
{
|
|
20
|
+
id: PublicKey.random().toString(),
|
|
21
|
+
type: 'script',
|
|
22
|
+
source: Ref.make(createObject(Text.make('c = a() + b'))),
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
id: PublicKey.random().toString(),
|
|
26
|
+
type: 'script',
|
|
27
|
+
source: Ref.make(createObject(Text.make('a = () => 100'))),
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
id: PublicKey.random().toString(),
|
|
31
|
+
type: 'script',
|
|
32
|
+
source: Ref.make(createObject(Text.make('b = 200'))),
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
id: PublicKey.random().toString(),
|
|
36
|
+
type: 'script',
|
|
37
|
+
source: Ref.make(createObject(Text.make('d = a() * 2'))),
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
id: PublicKey.random().toString(),
|
|
41
|
+
type: 'script',
|
|
42
|
+
source: Ref.make(createObject(Text.make('c + d'))),
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
id: PublicKey.random().toString(),
|
|
46
|
+
type: 'prompt',
|
|
47
|
+
prompt: Ref.make(
|
|
48
|
+
createObject(
|
|
49
|
+
Prompt.make({
|
|
50
|
+
instructions: 'Very briefly, what colors are associated with the numbers {{a}} and {{b}}.',
|
|
51
|
+
}),
|
|
52
|
+
),
|
|
53
|
+
),
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
id: PublicKey.random().toString(),
|
|
57
|
+
type: 'query',
|
|
58
|
+
source: Ref.make(createObject(Text.make(`docs = (type: ${Markdown.Document.typename})`))),
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
id: PublicKey.random().toString(),
|
|
62
|
+
type: 'prompt',
|
|
63
|
+
prompt: Ref.make(
|
|
64
|
+
createObject(
|
|
65
|
+
Prompt.make({
|
|
66
|
+
instructions: 'Very briefly, summarize the documents: {{docs}}',
|
|
67
|
+
}),
|
|
68
|
+
),
|
|
69
|
+
),
|
|
70
|
+
},
|
|
71
|
+
],
|
|
72
|
+
});
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { readFile } from 'node:fs/promises';
|
|
6
|
+
|
|
7
|
+
import * as Record from 'effect/Record';
|
|
8
|
+
import { describe, expect, test } from 'vitest';
|
|
9
|
+
|
|
10
|
+
import { bundleFunction } from '@dxos/functions-runtime/bundler';
|
|
11
|
+
import { FunctionWorker } from '@dxos/functions-simulator-cloudflare';
|
|
12
|
+
import { ErrorCodec } from '@dxos/protocols';
|
|
13
|
+
|
|
14
|
+
// Requires downloading assets from R2
|
|
15
|
+
describe.runIf(process.env.DX_TEST_TAGS?.includes('functions-e2e'))('Run script in sumulator', () => {
|
|
16
|
+
test('forex-effect', { timeout: 120_000 }, async () => {
|
|
17
|
+
const source = await readFile(new URL('../templates/forex-effect.ts', import.meta.url), 'utf-8');
|
|
18
|
+
|
|
19
|
+
// Bundle and upload.
|
|
20
|
+
const buildResult = await bundleFunction({ source });
|
|
21
|
+
if ('error' in buildResult) {
|
|
22
|
+
throw buildResult.error ?? new Error('Bundle creation failed');
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const worker = new FunctionWorker({
|
|
26
|
+
mainModule: buildResult.entryPoint,
|
|
27
|
+
modules: Record.map(buildResult.assets, (contents, filename) => ({
|
|
28
|
+
contents: contents as Uint8Array<ArrayBuffer>,
|
|
29
|
+
contentType: filename.endsWith('.wasm') ? 'application/wasm' : 'application/javascript',
|
|
30
|
+
})),
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
const result = await worker.invoke({ from: 'USD', to: 'EUR' });
|
|
34
|
+
console.log(result);
|
|
35
|
+
if (result._kind === 'error') {
|
|
36
|
+
throw ErrorCodec.decode(result.error);
|
|
37
|
+
}
|
|
38
|
+
expect(Number(result.result)).toBeGreaterThan(0);
|
|
39
|
+
});
|
|
40
|
+
});
|
package/src/translations.ts
CHANGED
|
@@ -2,23 +2,38 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { Script } from '@dxos/functions';
|
|
6
|
+
import { type Resource } from '@dxos/react-ui';
|
|
7
7
|
|
|
8
|
-
import {
|
|
8
|
+
import { meta } from './meta';
|
|
9
|
+
import { Notebook } from './types';
|
|
9
10
|
|
|
10
|
-
export
|
|
11
|
+
export const translations = [
|
|
11
12
|
{
|
|
12
13
|
'en-US': {
|
|
13
|
-
[
|
|
14
|
+
[Script.Script.typename]: {
|
|
14
15
|
'typename label': 'Script',
|
|
15
16
|
'typename label_zero': 'Scripts',
|
|
16
17
|
'typename label_one': 'Script',
|
|
17
18
|
'typename label_other': 'Scripts',
|
|
18
19
|
'object name placeholder': 'New script',
|
|
20
|
+
'rename object label': 'Rename script',
|
|
21
|
+
'delete object label': 'Delete script',
|
|
22
|
+
'object deleted label': 'Script deleted',
|
|
19
23
|
},
|
|
20
|
-
[
|
|
24
|
+
[Notebook.Notebook.typename]: {
|
|
25
|
+
'typename label': 'Notebook',
|
|
26
|
+
'typename label_zero': 'Notebooks',
|
|
27
|
+
'typename label_one': 'Notebook',
|
|
28
|
+
'typename label_other': 'Notebooks',
|
|
29
|
+
'object name placeholder': 'New notebook',
|
|
30
|
+
'rename object label': 'Rename notebook',
|
|
31
|
+
'delete object label': 'Delete notebook',
|
|
32
|
+
'object deleted label': 'Notebook deleted',
|
|
33
|
+
},
|
|
34
|
+
[meta.id]: {
|
|
21
35
|
'plugin name': 'Scripts',
|
|
36
|
+
'settings title': 'Scripts plugin settings',
|
|
22
37
|
'description label': 'Description',
|
|
23
38
|
'description placeholder': 'Enter description',
|
|
24
39
|
'binding placeholder': 'Function name',
|
|
@@ -42,25 +57,29 @@ export default [
|
|
|
42
57
|
'open token manager label': 'Open Token Manager',
|
|
43
58
|
'publish label': 'Publish',
|
|
44
59
|
'publishing label': 'Publishing',
|
|
60
|
+
'blueprint editor label': 'Blueprint',
|
|
61
|
+
'blueprint editor description': 'Create a blueprint that exposes this script as a tool.',
|
|
62
|
+
'blueprint instructions label': 'Instructions',
|
|
63
|
+
'blueprint instructions placeholder': 'Describe how this tool should be used.',
|
|
64
|
+
'create blueprint label': 'Create blueprint',
|
|
65
|
+
'creating label': 'Creating…',
|
|
45
66
|
'editor input mode label': 'Editor input mode',
|
|
46
67
|
'select editor input mode placeholder': 'Select editor input mode…',
|
|
47
68
|
'settings editor input mode default label': 'Default',
|
|
48
69
|
'settings editor input mode vim label': 'Vim',
|
|
49
70
|
'settings editor input mode vscode label': 'VS Code',
|
|
50
|
-
'template select group label': 'Select template',
|
|
51
71
|
'function panel label': 'Debug Function',
|
|
52
72
|
'script test label': 'Test',
|
|
53
73
|
'script logs label': 'Logs',
|
|
74
|
+
|
|
54
75
|
'deployment dialog title': 'Default Scripts',
|
|
55
|
-
'deployment dialog scripts found
|
|
56
|
-
'We found the following script template for your new integration:',
|
|
57
|
-
'deployment dialog scripts found message_other':
|
|
58
|
-
'We found the following script templates for your new integration:',
|
|
76
|
+
'deployment dialog scripts found message': 'Script templates:',
|
|
59
77
|
'deployment dialog deploy functions button label_one': 'Create and deploy script',
|
|
60
78
|
'deployment dialog deploy functions button label_other': 'Create and deploy scripts',
|
|
61
79
|
'deployment dialog deploy functions pending button label_one': 'Deploying script',
|
|
62
80
|
'deployment dialog deploy functions pending button label_other': 'Deploying scripts',
|
|
63
81
|
'deployment dialog skip button label': 'Skip',
|
|
82
|
+
|
|
64
83
|
'script deployment toast label_one': 'Script deployed',
|
|
65
84
|
'script deployment toast label_other': 'Scripts deployed',
|
|
66
85
|
'script deployment toast description_one': 'Your script has been deployed successfully.',
|
|
@@ -73,7 +92,18 @@ export default [
|
|
|
73
92
|
'script deployment error toast description_other': 'There was an error deploying your scripts.',
|
|
74
93
|
'script deployment error toast close label_one': 'Close',
|
|
75
94
|
'script deployment error toast close label_other': 'Close',
|
|
95
|
+
|
|
96
|
+
'notebook cell placeholder': 'Enter script',
|
|
97
|
+
'notebook cell delete label': 'Delete cell',
|
|
98
|
+
'notebook cell prompt run label': 'Run',
|
|
99
|
+
'notebook cell insert markdown label': 'Insert Markdown',
|
|
100
|
+
'notebook cell insert script label': 'Insert Script',
|
|
101
|
+
'notebook cell insert prompt label': 'Insert Prompt',
|
|
102
|
+
'notebook cell insert query label': 'Insert Query',
|
|
103
|
+
'notebook markdown placeholder': 'Enter Markdown',
|
|
104
|
+
'notebook prompt placeholder': 'Enter prompt',
|
|
105
|
+
'notebook cell insert label': 'Insert cell',
|
|
76
106
|
},
|
|
77
107
|
},
|
|
78
108
|
},
|
|
79
|
-
];
|
|
109
|
+
] as const satisfies Resource[];
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2023 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Schema from 'effect/Schema';
|
|
6
|
+
|
|
7
|
+
import { Prompt } from '@dxos/blueprints';
|
|
8
|
+
import { Obj, Type } from '@dxos/echo';
|
|
9
|
+
import { FormInputAnnotation } from '@dxos/echo/internal';
|
|
10
|
+
import { LabelAnnotation } from '@dxos/echo/internal';
|
|
11
|
+
import { Graph } from '@dxos/plugin-explorer/types';
|
|
12
|
+
import { Text } from '@dxos/schema';
|
|
13
|
+
|
|
14
|
+
export type CellType = 'markdown' | 'script' | 'query' | 'prompt' | 'view';
|
|
15
|
+
|
|
16
|
+
export const Cell = Schema.Struct({
|
|
17
|
+
id: Schema.String,
|
|
18
|
+
type: Schema.String,
|
|
19
|
+
name: Schema.optional(Schema.String),
|
|
20
|
+
// TODO(burdon): Union type.
|
|
21
|
+
source: Schema.optional(Type.Ref(Text.Text)),
|
|
22
|
+
prompt: Schema.optional(Type.Ref(Prompt.Prompt)),
|
|
23
|
+
graph: Schema.optional(Type.Ref(Graph.Graph)),
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
export interface Cell extends Schema.Schema.Type<typeof Cell> {}
|
|
27
|
+
|
|
28
|
+
export const Notebook = Schema.Struct({
|
|
29
|
+
name: Schema.String.pipe(Schema.optional),
|
|
30
|
+
cells: Cell.pipe(Schema.Array, FormInputAnnotation.set(false)),
|
|
31
|
+
}).pipe(
|
|
32
|
+
Type.object({
|
|
33
|
+
typename: 'dxos.org/type/Notebook',
|
|
34
|
+
version: '0.1.0',
|
|
35
|
+
}),
|
|
36
|
+
LabelAnnotation.set(['name']),
|
|
37
|
+
);
|
|
38
|
+
|
|
39
|
+
export type Notebook = Schema.Schema.Type<typeof Notebook>;
|
|
40
|
+
|
|
41
|
+
export const make = (props: Obj.MakeProps<typeof Notebook> = { cells: [] }): Notebook => Obj.make(Notebook, props);
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2023 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Schema from 'effect/Schema';
|
|
6
|
+
|
|
7
|
+
import { Database } from '@dxos/echo';
|
|
8
|
+
import { Script } from '@dxos/functions';
|
|
9
|
+
import { Operation } from '@dxos/operation';
|
|
10
|
+
|
|
11
|
+
import { meta } from '../meta';
|
|
12
|
+
import { templates } from '../templates';
|
|
13
|
+
|
|
14
|
+
const SCRIPT_OPERATION = `${meta.id}/operation`;
|
|
15
|
+
|
|
16
|
+
export namespace ScriptOperation {
|
|
17
|
+
export const ScriptProps = Schema.Struct({
|
|
18
|
+
name: Schema.optional(Schema.String),
|
|
19
|
+
// TODO(wittjosiah): Placeholder annotation?
|
|
20
|
+
gistUrl: Schema.optional(Schema.String.annotations({ title: 'Import from Gist (url)' })),
|
|
21
|
+
initialTemplateId: Schema.Literal(...templates.map(({ id }) => id)).pipe(
|
|
22
|
+
Schema.annotations({ title: 'Template' }),
|
|
23
|
+
Schema.optional,
|
|
24
|
+
),
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
export const NotebookProps = Schema.Struct({
|
|
28
|
+
name: Schema.optional(Schema.String),
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
export const CreateScript = Operation.make({
|
|
32
|
+
meta: { key: `${SCRIPT_OPERATION}/create-script`, name: 'Create Script' },
|
|
33
|
+
schema: {
|
|
34
|
+
input: Schema.extend(
|
|
35
|
+
ScriptProps,
|
|
36
|
+
Schema.Struct({
|
|
37
|
+
db: Database.Database,
|
|
38
|
+
}),
|
|
39
|
+
),
|
|
40
|
+
output: Schema.Struct({
|
|
41
|
+
object: Script.Script,
|
|
42
|
+
}),
|
|
43
|
+
},
|
|
44
|
+
});
|
|
45
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { type Atom } from '@effect-atom/atom-react';
|
|
6
|
+
|
|
7
|
+
import { Capability } from '@dxos/app-framework';
|
|
8
|
+
|
|
9
|
+
import { type Compiler } from '../compiler';
|
|
10
|
+
import { meta } from '../meta';
|
|
11
|
+
|
|
12
|
+
import { type ScriptSettings } from './types';
|
|
13
|
+
|
|
14
|
+
export namespace ScriptCapabilities {
|
|
15
|
+
export const Settings = Capability.make<Atom.Writable<ScriptSettings>>(`${meta.id}/capability/settings`);
|
|
16
|
+
export const Compiler = Capability.make<Compiler>(`${meta.id}/capability/compiler`);
|
|
17
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { ActivationEvent } from '@dxos/app-framework';
|
|
6
|
+
|
|
7
|
+
import { meta } from '../meta';
|
|
8
|
+
|
|
9
|
+
export namespace ScriptEvents {
|
|
10
|
+
export const SetupCompiler = ActivationEvent.make(`${meta.id}/event/setup-compiler`);
|
|
11
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2023 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Schema from 'effect/Schema';
|
|
6
|
+
|
|
7
|
+
import { EditorInputMode } from '@dxos/ui-editor';
|
|
8
|
+
|
|
9
|
+
export const ScriptSettings = Schema.mutable(
|
|
10
|
+
Schema.Struct({
|
|
11
|
+
editorInputMode: EditorInputMode,
|
|
12
|
+
}),
|
|
13
|
+
);
|
|
14
|
+
|
|
15
|
+
export type ScriptSettings = Schema.Schema.Type<typeof ScriptSettings>;
|