@dxos/plugin-script 0.8.4-main.2e9d522 → 0.8.4-main.3c1ae3b
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-FIHD4UVK.mjs +15 -0
- package/dist/lib/browser/NotebookContainer-GL2Z5I5Q.mjs +817 -0
- package/dist/lib/browser/NotebookContainer-GL2Z5I5Q.mjs.map +7 -0
- package/dist/lib/browser/ScriptContainer-F4OK3OG6.mjs +149 -0
- package/dist/lib/browser/ScriptContainer-F4OK3OG6.mjs.map +7 -0
- package/dist/lib/browser/{app-graph-builder-HLQ7K3BT.mjs → app-graph-builder-2WR2ATTJ.mjs} +12 -10
- package/dist/lib/browser/app-graph-builder-2WR2ATTJ.mjs.map +7 -0
- package/dist/lib/browser/blueprint-definition-6PZWZM2Y.mjs +30 -0
- package/dist/lib/browser/blueprint-definition-6PZWZM2Y.mjs.map +7 -0
- package/dist/lib/browser/chunk-2SXDKBM7.mjs +304 -0
- package/dist/lib/browser/chunk-2SXDKBM7.mjs.map +7 -0
- package/dist/lib/browser/chunk-6X7QVTRB.mjs +112 -0
- package/dist/lib/browser/chunk-6X7QVTRB.mjs.map +7 -0
- package/dist/lib/browser/{chunk-P4HQKUCP.mjs → chunk-75RTLLH4.mjs} +23 -21
- package/dist/lib/browser/chunk-75RTLLH4.mjs.map +7 -0
- package/dist/lib/browser/{chunk-FIM2MVNJ.mjs → chunk-7WFISUBY.mjs} +182 -90
- package/dist/lib/browser/chunk-7WFISUBY.mjs.map +7 -0
- package/dist/lib/browser/{chunk-QYAREHGH.mjs → chunk-EB6AXFXO.mjs} +8 -5
- package/dist/lib/browser/chunk-EB6AXFXO.mjs.map +7 -0
- package/dist/lib/browser/chunk-J5LGTIGS.mjs +10 -0
- package/dist/lib/browser/chunk-MQHBMJLH.mjs +103 -0
- package/dist/lib/browser/chunk-MQHBMJLH.mjs.map +7 -0
- package/dist/lib/browser/chunk-S22N3BUR.mjs +88 -0
- package/dist/lib/browser/chunk-S22N3BUR.mjs.map +7 -0
- package/dist/lib/browser/chunk-UGDRMROB.mjs +542 -0
- package/dist/lib/browser/chunk-UGDRMROB.mjs.map +7 -0
- package/dist/lib/browser/{chunk-5TVBECWH.mjs → chunk-UOQ6NCH3.mjs} +2 -2
- package/dist/lib/browser/compiler-2HV5KXV4.mjs +143 -0
- package/dist/lib/browser/compiler-2HV5KXV4.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +113 -67
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/{intent-resolver-7B77IG3N.mjs → intent-resolver-3B4ESSCU.mjs} +40 -26
- package/dist/lib/browser/intent-resolver-3B4ESSCU.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/{react-surface-FYYXZA7C.mjs → react-surface-ASV2KBRA.mjs} +49 -25
- package/dist/lib/browser/react-surface-ASV2KBRA.mjs.map +7 -0
- package/dist/lib/browser/{settings-KCTBK5TY.mjs → settings-4NKLTJTT.mjs} +10 -8
- package/dist/lib/browser/settings-4NKLTJTT.mjs.map +7 -0
- package/dist/lib/browser/templates/index.mjs +2 -1
- package/dist/lib/browser/types/index.mjs +8 -4
- package/dist/lib/node-esm/DeploymentDialog-5EN2KZE5.mjs +16 -0
- package/dist/lib/node-esm/DeploymentDialog-5EN2KZE5.mjs.map +7 -0
- package/dist/lib/node-esm/NotebookContainer-7RCEXND7.mjs +818 -0
- package/dist/lib/node-esm/NotebookContainer-7RCEXND7.mjs.map +7 -0
- package/dist/lib/node-esm/ScriptContainer-763IAKOD.mjs +150 -0
- package/dist/lib/node-esm/ScriptContainer-763IAKOD.mjs.map +7 -0
- package/dist/lib/node-esm/{app-graph-builder-7EYIHWH4.mjs → app-graph-builder-NCVLUL5R.mjs} +12 -10
- package/dist/lib/node-esm/app-graph-builder-NCVLUL5R.mjs.map +7 -0
- package/dist/lib/node-esm/blueprint-definition-5R6YCSZZ.mjs +31 -0
- package/dist/lib/node-esm/blueprint-definition-5R6YCSZZ.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-2S43VHAM.mjs +90 -0
- package/dist/lib/node-esm/chunk-2S43VHAM.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-32AMTGGN.mjs +104 -0
- package/dist/lib/node-esm/chunk-32AMTGGN.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-4VVV5L5A.mjs +543 -0
- package/dist/lib/node-esm/chunk-4VVV5L5A.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-QKK3NDHW.mjs → chunk-535YDI5V.mjs} +23 -21
- package/dist/lib/node-esm/chunk-535YDI5V.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-35M3CHYE.mjs → chunk-55JZVM6K.mjs} +2 -2
- package/dist/lib/node-esm/chunk-6H4FYMCX.mjs +114 -0
- package/dist/lib/node-esm/chunk-6H4FYMCX.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-7NMI4CEU.mjs → chunk-DKS2EQW6.mjs} +182 -90
- package/dist/lib/node-esm/chunk-DKS2EQW6.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-AHXJ6NQU.mjs → chunk-IBV2DR36.mjs} +8 -5
- package/dist/lib/node-esm/chunk-IBV2DR36.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-NQN3JE2R.mjs +305 -0
- package/dist/lib/node-esm/chunk-NQN3JE2R.mjs.map +7 -0
- package/dist/lib/node-esm/compiler-KPEZKEHC.mjs +144 -0
- package/dist/lib/node-esm/compiler-KPEZKEHC.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +113 -67
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/{intent-resolver-FRZGS4TB.mjs → intent-resolver-GIACMXI4.mjs} +40 -26
- package/dist/lib/node-esm/intent-resolver-GIACMXI4.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/{react-surface-V32NWHKN.mjs → react-surface-NXBO7VYB.mjs} +49 -25
- package/dist/lib/node-esm/react-surface-NXBO7VYB.mjs.map +7 -0
- package/dist/lib/node-esm/{settings-DXZ334A3.mjs → settings-PW5NXWLW.mjs} +10 -8
- package/dist/lib/node-esm/settings-PW5NXWLW.mjs.map +7 -0
- package/dist/lib/node-esm/templates/index.mjs +2 -1
- package/dist/lib/node-esm/types/index.mjs +8 -4
- package/dist/types/src/ScriptPlugin.d.ts +1 -1
- package/dist/types/src/ScriptPlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/app-graph-builder.d.ts +1 -1
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
- package/dist/types/src/capabilities/artifact-definition.d.ts +1 -1
- package/dist/types/src/capabilities/artifact-definition.d.ts.map +1 -1
- package/dist/types/src/capabilities/blueprint-definition.d.ts +5 -0
- package/dist/types/src/capabilities/blueprint-definition.d.ts.map +1 -0
- package/dist/types/src/capabilities/compiler.d.ts +1 -1
- package/dist/types/src/capabilities/compiler.d.ts.map +1 -1
- package/dist/types/src/capabilities/index.d.ts +6 -6
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/intent-resolver.d.ts +1 -1
- package/dist/types/src/capabilities/intent-resolver.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-surface.d.ts +1 -1
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
- package/dist/types/src/capabilities/settings.d.ts +1 -1
- 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 +246 -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 +10 -0
- package/dist/types/src/components/NotebookContainer.d.ts.map +1 -0
- package/dist/types/src/components/NotebookContainer.stories.d.ts +254 -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 +248 -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 +4 -4
- package/dist/types/src/components/ScriptContainer.d.ts.map +1 -1
- package/dist/types/src/components/ScriptToolbar/ScriptToolbar.d.ts +5 -6
- package/dist/types/src/components/ScriptToolbar/ScriptToolbar.d.ts.map +1 -1
- package/dist/types/src/components/ScriptToolbar/ScriptToolbar.stories.d.ts +245 -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 +2 -2
- package/dist/types/src/components/Settings/ScriptPluginSettings.d.ts.map +1 -1
- package/dist/types/src/components/TestPanel/TestContainer.d.ts +2 -2
- 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 +4 -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 +3 -4
- package/dist/types/src/components/index.d.ts.map +1 -1
- 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/events.d.ts.map +1 -1
- package/dist/types/src/hooks/deploy.d.ts +11 -26
- package/dist/types/src/hooks/deploy.d.ts.map +1 -1
- package/dist/types/src/hooks/format.d.ts +2 -2
- 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 +4 -14
- 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/index.d.ts +1 -0
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +0 -1
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/notebook/compute-graph.d.ts +45 -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/chess.d.ts +6 -1
- package/dist/types/src/templates/chess.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/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 +43 -1
- package/dist/types/src/templates/index.d.ts.map +1 -1
- package/dist/types/src/templates/{echo.d.ts → ping.d.ts} +1 -1
- 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/deploy.test.d.ts +2 -0
- package/dist/types/src/testing/deploy.test.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 +32 -5
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/Notebook.d.ts +31 -0
- package/dist/types/src/types/Notebook.d.ts.map +1 -0
- package/dist/types/src/types/actions.d.ts +54 -0
- package/dist/types/src/types/actions.d.ts.map +1 -0
- package/dist/types/src/types/index.d.ts +3 -1
- package/dist/types/src/types/index.d.ts.map +1 -1
- 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 +87 -71
- package/src/ScriptPlugin.tsx +79 -75
- package/src/capabilities/app-graph-builder.ts +12 -11
- package/src/capabilities/artifact-definition.ts +19 -24
- package/src/capabilities/blueprint-definition.ts +30 -0
- package/src/capabilities/compiler.ts +69 -18
- package/src/capabilities/index.ts +1 -1
- package/src/capabilities/intent-resolver.ts +21 -15
- package/src/capabilities/react-surface.tsx +34 -21
- package/src/capabilities/settings.ts +3 -3
- package/src/compiler/compiler.ts +11 -4
- package/src/components/DeploymentDialog/DeploymentDialog.stories.tsx +39 -20
- package/src/components/DeploymentDialog/DeploymentDialog.tsx +45 -34
- package/src/components/DeploymentDialog/index.ts +1 -1
- package/src/components/FrameContainer/FrameContainer.tsx +7 -4
- package/src/components/NotebookContainer.stories.tsx +83 -0
- package/src/components/NotebookContainer.tsx +260 -0
- package/src/components/NotebookStack/NotebookCell.tsx +216 -0
- package/src/components/NotebookStack/NotebookMenu.tsx +47 -0
- package/src/components/NotebookStack/NotebookStack.stories.tsx +54 -0
- package/src/components/NotebookStack/NotebookStack.tsx +86 -0
- package/src/components/NotebookStack/index.ts +6 -0
- package/src/components/QueryEditor/QueryEditor.stories.tsx +89 -0
- package/src/components/QueryEditor/QueryEditor.tsx +47 -0
- package/src/components/QueryEditor/index.ts +5 -0
- package/src/components/ScriptContainer.tsx +10 -8
- package/src/components/ScriptToolbar/ScriptToolbar.stories.tsx +34 -17
- package/src/components/ScriptToolbar/ScriptToolbar.tsx +37 -30
- package/src/components/Settings/ScriptObjectSettings.tsx +130 -38
- package/src/components/Settings/ScriptPluginSettings.tsx +37 -47
- package/src/components/TestPanel/TestContainer.tsx +4 -3
- package/src/components/TestPanel/TestPanel.tsx +42 -19
- package/src/components/TypescriptEditor/TypescriptEditor.stories.tsx +79 -31
- package/src/components/TypescriptEditor/TypescriptEditor.tsx +39 -37
- package/src/components/index.ts +3 -0
- package/src/e2e/deploy.test.ts +64 -0
- package/src/events.ts +2 -2
- package/src/hooks/deploy.ts +24 -24
- package/src/hooks/format.ts +4 -4
- package/src/hooks/index.ts +1 -0
- package/src/hooks/template.ts +6 -15
- package/src/hooks/useCompiler.ts +23 -0
- package/src/hooks/useCreateAndDeployScriptTemplates.ts +11 -6
- package/src/index.ts +1 -0
- package/src/meta.ts +7 -5
- package/src/notebook/compute-graph.test.ts +70 -0
- package/src/notebook/compute-graph.ts +206 -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/chess.ts +11 -8
- package/src/templates/data-generator.ts +10 -4
- package/src/templates/discord.ts +12 -4
- package/src/templates/forex-effect.ts +24 -25
- package/src/templates/forex.ts +9 -6
- package/src/templates/gmail.ts +34 -64
- package/src/templates/index.ts +6 -6
- package/src/testing/data.ts +72 -0
- package/src/testing/deploy.test.ts +63 -0
- package/src/testing/index.ts +5 -0
- package/src/testing/simulator.test.ts +40 -0
- package/src/translations.ts +35 -7
- package/src/types/Notebook.ts +42 -0
- package/src/types/actions.ts +53 -0
- package/src/types/index.ts +3 -1
- package/src/types/types.ts +15 -0
- package/src/util/deploy.ts +33 -60
- package/src/util/functions.ts +39 -8
- package/src/vite-env.d.ts +2 -0
- package/dist/lib/browser/DeploymentDialog-M4QIHTDR.mjs +0 -12
- package/dist/lib/browser/ScriptContainer-Z6SIGRRC.mjs +0 -262
- package/dist/lib/browser/ScriptContainer-Z6SIGRRC.mjs.map +0 -7
- package/dist/lib/browser/app-graph-builder-HLQ7K3BT.mjs.map +0 -7
- package/dist/lib/browser/artifact-definition-24Q3IHOU.mjs +0 -249
- package/dist/lib/browser/artifact-definition-24Q3IHOU.mjs.map +0 -7
- package/dist/lib/browser/chunk-3U6DTUH3.mjs +0 -283
- package/dist/lib/browser/chunk-3U6DTUH3.mjs.map +0 -7
- package/dist/lib/browser/chunk-FIM2MVNJ.mjs.map +0 -7
- package/dist/lib/browser/chunk-FMDXKOP7.mjs +0 -233
- package/dist/lib/browser/chunk-FMDXKOP7.mjs.map +0 -7
- package/dist/lib/browser/chunk-IS4OG2UW.mjs +0 -39
- package/dist/lib/browser/chunk-IS4OG2UW.mjs.map +0 -7
- package/dist/lib/browser/chunk-P4HQKUCP.mjs.map +0 -7
- package/dist/lib/browser/chunk-QYAREHGH.mjs.map +0 -7
- package/dist/lib/browser/chunk-R4R7VOFY.mjs +0 -88
- package/dist/lib/browser/chunk-R4R7VOFY.mjs.map +0 -7
- package/dist/lib/browser/compiler-CXCUA4UQ.mjs +0 -82
- package/dist/lib/browser/compiler-CXCUA4UQ.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-7B77IG3N.mjs.map +0 -7
- package/dist/lib/browser/react-surface-FYYXZA7C.mjs.map +0 -7
- package/dist/lib/browser/settings-KCTBK5TY.mjs.map +0 -7
- package/dist/lib/node-esm/DeploymentDialog-3KPRWFE7.mjs +0 -13
- package/dist/lib/node-esm/ScriptContainer-KPU75HHI.mjs +0 -263
- package/dist/lib/node-esm/ScriptContainer-KPU75HHI.mjs.map +0 -7
- package/dist/lib/node-esm/app-graph-builder-7EYIHWH4.mjs.map +0 -7
- package/dist/lib/node-esm/artifact-definition-WAJFALUI.mjs +0 -250
- package/dist/lib/node-esm/artifact-definition-WAJFALUI.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-7NMI4CEU.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-AHXJ6NQU.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-F5GFJ3PY.mjs +0 -90
- package/dist/lib/node-esm/chunk-F5GFJ3PY.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-JIPFLBYA.mjs +0 -40
- package/dist/lib/node-esm/chunk-JIPFLBYA.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-QKK3NDHW.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-RT43MACC.mjs +0 -284
- package/dist/lib/node-esm/chunk-RT43MACC.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-XJPK3IYI.mjs +0 -234
- package/dist/lib/node-esm/chunk-XJPK3IYI.mjs.map +0 -7
- package/dist/lib/node-esm/compiler-EPFKQXPE.mjs +0 -83
- package/dist/lib/node-esm/compiler-EPFKQXPE.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-FRZGS4TB.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-V32NWHKN.mjs.map +0 -7
- package/dist/lib/node-esm/settings-DXZ334A3.mjs.map +0 -7
- package/dist/types/src/templates/echo.d.ts.map +0 -1
- package/dist/types/src/types/schema.d.ts +0 -38
- package/dist/types/src/types/schema.d.ts.map +0 -1
- package/src/types/schema.ts +0 -37
- /package/dist/lib/browser/{DeploymentDialog-M4QIHTDR.mjs.map → DeploymentDialog-FIHD4UVK.mjs.map} +0 -0
- /package/dist/lib/{node-esm/DeploymentDialog-3KPRWFE7.mjs.map → browser/chunk-J5LGTIGS.mjs.map} +0 -0
- /package/dist/lib/browser/{chunk-5TVBECWH.mjs.map → chunk-UOQ6NCH3.mjs.map} +0 -0
- /package/dist/lib/node-esm/{chunk-35M3CHYE.mjs.map → chunk-55JZVM6K.mjs.map} +0 -0
- /package/src/templates/{echo.ts → ping.ts} +0 -0
package/src/templates/discord.ts
CHANGED
|
@@ -3,17 +3,23 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
// @ts-ignore
|
|
6
|
-
import {
|
|
6
|
+
import { DXN, EchoObject, Filter, ObjectId, S, create, defineFunction } from 'dxos:functions';
|
|
7
7
|
// @ts-ignore
|
|
8
|
-
import { FetchHttpClient } from 'https://esm.sh/@effect/platform@0.
|
|
8
|
+
import { FetchHttpClient } from 'https://esm.sh/@effect/platform@0.89.0?deps=effect@3.17.0&bundle=false';
|
|
9
9
|
import {
|
|
10
10
|
DiscordConfig,
|
|
11
11
|
DiscordREST,
|
|
12
12
|
DiscordRESTMemoryLive,
|
|
13
13
|
// @ts-ignore
|
|
14
|
-
} from 'https://esm.sh/dfx@0.113.0?deps=effect@3.
|
|
14
|
+
} from 'https://esm.sh/dfx@0.113.0?deps=effect@3.17.0&bundle=false';
|
|
15
15
|
// @ts-ignore
|
|
16
|
-
import
|
|
16
|
+
import * as Config from 'https://esm.sh/effect@3.17.0/Config?bundle=false';
|
|
17
|
+
// @ts-ignore
|
|
18
|
+
import * as Effect from 'https://esm.sh/effect@3.17.0/Effect?bundle=false';
|
|
19
|
+
// @ts-ignore
|
|
20
|
+
import * as Redacted from 'https://esm.sh/effect@3.17.0/Redacted?bundle=false';
|
|
21
|
+
// @ts-ignore
|
|
22
|
+
import * as Ref from 'https://esm.sh/effect@3.17.0/Ref?bundle=false';
|
|
17
23
|
|
|
18
24
|
const MessageSchema = S.Struct({
|
|
19
25
|
id: ObjectId,
|
|
@@ -36,6 +42,8 @@ const generateSnowflake = (unixTimestamp: number): bigint => {
|
|
|
36
42
|
};
|
|
37
43
|
|
|
38
44
|
export default defineFunction({
|
|
45
|
+
key: 'dxos.org/script/discord',
|
|
46
|
+
name: 'Discord',
|
|
39
47
|
inputSchema: S.Struct({
|
|
40
48
|
// TODO(wittjosiah): Remove. This is used to provide a terminal for a cron trigger.
|
|
41
49
|
tick: S.optional(S.String),
|
|
@@ -2,37 +2,36 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
} from '
|
|
13
|
-
// @ts-ignore
|
|
14
|
-
import { Effect, Schedule } from 'https://esm.sh/effect@3.14.21?bundle=false';
|
|
5
|
+
import * as FetchHttpClient from '@effect/platform/FetchHttpClient';
|
|
6
|
+
import * as HttpClient from '@effect/platform/HttpClient';
|
|
7
|
+
import * as HttpClientRequest from '@effect/platform/HttpClientRequest';
|
|
8
|
+
import * as Effect from 'effect/Effect';
|
|
9
|
+
import * as Schedule from 'effect/Schedule';
|
|
10
|
+
import * as Schema from 'effect/Schema';
|
|
11
|
+
|
|
12
|
+
import { defineFunction } from '@dxos/functions';
|
|
15
13
|
|
|
16
14
|
export default defineFunction({
|
|
15
|
+
key: 'dxos.org/script/forex-effect',
|
|
16
|
+
name: 'Forex Effect',
|
|
17
17
|
description: 'Returns the exchange rate between two currencies.',
|
|
18
18
|
|
|
19
|
-
inputSchema:
|
|
20
|
-
from:
|
|
21
|
-
to:
|
|
19
|
+
inputSchema: Schema.Struct({
|
|
20
|
+
from: Schema.String.annotations({ description: 'The source currency' }),
|
|
21
|
+
to: Schema.String.annotations({ description: 'The target currency' }),
|
|
22
22
|
}),
|
|
23
23
|
|
|
24
|
-
outputSchema:
|
|
24
|
+
outputSchema: Schema.String.annotations({ description: 'The exchange rate between the two currencies' }),
|
|
25
25
|
|
|
26
|
-
handler:
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
);
|
|
26
|
+
handler: Effect.fnUntraced(function* ({ data: { from, to } }) {
|
|
27
|
+
const res = yield* HttpClientRequest.get(`https://free.ratesdb.com/v1/rates?from=${from}&to=${to}`).pipe(
|
|
28
|
+
HttpClient.execute,
|
|
29
|
+
Effect.flatMap((res: any) => res.json),
|
|
30
|
+
Effect.timeout('1 second'),
|
|
31
|
+
Effect.retry(Schedule.exponential(1_000).pipe(Schedule.compose(Schedule.recurs(3)))),
|
|
32
|
+
Effect.scoped,
|
|
33
|
+
);
|
|
35
34
|
|
|
36
|
-
|
|
37
|
-
|
|
35
|
+
return (res as any).data.rates[to].toString();
|
|
36
|
+
}, Effect.provide(FetchHttpClient.layer)),
|
|
38
37
|
});
|
package/src/templates/forex.ts
CHANGED
|
@@ -2,18 +2,21 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
import * as Schema from 'effect/Schema';
|
|
6
|
+
|
|
7
|
+
import { defineFunction } from '@dxos/functions';
|
|
7
8
|
|
|
8
9
|
export default defineFunction({
|
|
10
|
+
key: 'dxos.org/script/forex',
|
|
11
|
+
name: 'Forex',
|
|
9
12
|
description: 'Returns the exchange rate between two currencies.',
|
|
10
13
|
|
|
11
|
-
inputSchema:
|
|
12
|
-
from:
|
|
13
|
-
to:
|
|
14
|
+
inputSchema: Schema.Struct({
|
|
15
|
+
from: Schema.String.annotations({ description: 'The source currency' }),
|
|
16
|
+
to: Schema.String.annotations({ description: 'The target currency' }),
|
|
14
17
|
}),
|
|
15
18
|
|
|
16
|
-
handler: async ({ data: { from, to } }
|
|
19
|
+
handler: async ({ data: { from, to } }) => {
|
|
17
20
|
const res = await fetch(`https://free.ratesdb.com/v1/rates?from=${from}&to=${to}`);
|
|
18
21
|
const {
|
|
19
22
|
data: { rates },
|
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,17 +157,17 @@ 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
|
//
|
|
@@ -163,8 +175,7 @@ const parseEmailString = (emailString: string): { name?: string; email: string }
|
|
|
163
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
|
@@ -6,11 +6,11 @@ import chat from './chat.ts?raw';
|
|
|
6
6
|
import chess from './chess.ts?raw';
|
|
7
7
|
import dataGenerator from './data-generator.ts?raw';
|
|
8
8
|
import discord from './discord.ts?raw';
|
|
9
|
-
import echo from './echo.ts?raw';
|
|
10
9
|
import email from './email.ts?raw';
|
|
11
10
|
import forexEffect from './forex-effect.ts?raw';
|
|
12
11
|
import forex from './forex.ts?raw';
|
|
13
12
|
import gmail from './gmail.ts?raw';
|
|
13
|
+
import ping from './ping.ts?raw';
|
|
14
14
|
|
|
15
15
|
const removeHeader = (str: string) => str.split('\n').slice(4).join('\n');
|
|
16
16
|
|
|
@@ -23,11 +23,11 @@ export type Template = {
|
|
|
23
23
|
presetId?: string;
|
|
24
24
|
};
|
|
25
25
|
|
|
26
|
-
export const templates
|
|
26
|
+
export const templates = [
|
|
27
27
|
{
|
|
28
|
-
id: 'dxos.org/script/
|
|
29
|
-
name: '
|
|
30
|
-
source: removeHeader(
|
|
28
|
+
id: 'dxos.org/script/ping',
|
|
29
|
+
name: 'Ping',
|
|
30
|
+
source: removeHeader(ping),
|
|
31
31
|
},
|
|
32
32
|
{
|
|
33
33
|
id: 'dxos.org/script/forex',
|
|
@@ -75,4 +75,4 @@ export const templates: Template[] = [
|
|
|
75
75
|
source: removeHeader(dataGenerator),
|
|
76
76
|
presetId: 'dxos.org/function/data-generator',
|
|
77
77
|
},
|
|
78
|
-
];
|
|
78
|
+
] as const;
|
|
@@ -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,63 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { readFile } from 'node:fs/promises';
|
|
6
|
+
|
|
7
|
+
import { describe, expect, test } from 'vitest';
|
|
8
|
+
|
|
9
|
+
import { Client } from '@dxos/client';
|
|
10
|
+
import { configPreset } from '@dxos/config';
|
|
11
|
+
import { bundleFunction } from '@dxos/functions-runtime/bundler';
|
|
12
|
+
import { FunctionsServiceClient } from '@dxos/functions-runtime/edge';
|
|
13
|
+
import { FunctionRuntimeKind } from '@dxos/protocols';
|
|
14
|
+
|
|
15
|
+
describe.runIf(process.env.DX_TEST_TAGS?.includes('functions-e2e'))('Script deployment', () => {
|
|
16
|
+
test('deploys FOREX (effect) function and invokes it via EDGE (main)', { timeout: 120_000 }, async () => {
|
|
17
|
+
const config = configPreset({
|
|
18
|
+
edge: 'dev',
|
|
19
|
+
});
|
|
20
|
+
await using client = await new Client({ config }).initialize();
|
|
21
|
+
await client.halo.createIdentity();
|
|
22
|
+
|
|
23
|
+
const space = await client.spaces.create();
|
|
24
|
+
await space.waitUntilReady();
|
|
25
|
+
|
|
26
|
+
// Inline echo function source.
|
|
27
|
+
const source = await readFile(new URL('../templates/forex-effect.ts', import.meta.url), 'utf-8');
|
|
28
|
+
|
|
29
|
+
// Bundle and upload.
|
|
30
|
+
const buildResult = await bundleFunction({ source });
|
|
31
|
+
if ('error' in buildResult) {
|
|
32
|
+
throw buildResult.error ?? new Error('Bundle creation failed');
|
|
33
|
+
}
|
|
34
|
+
// for (const [key, value] of Object.entries(buildResult.assets)) {
|
|
35
|
+
// await writeFile(key, value);
|
|
36
|
+
// console.log(resolve(key));
|
|
37
|
+
// }
|
|
38
|
+
const functionsServiceClient = FunctionsServiceClient.fromClient(client);
|
|
39
|
+
const newFunction = await functionsServiceClient.deploy({
|
|
40
|
+
// TODO(dmaretskyi): Space key or identity key.
|
|
41
|
+
ownerPublicKey: space.key,
|
|
42
|
+
version: '0.0.1',
|
|
43
|
+
entryPoint: buildResult.entryPoint,
|
|
44
|
+
assets: buildResult.assets,
|
|
45
|
+
runtime: FunctionRuntimeKind.enums.WORKER_LOADER,
|
|
46
|
+
});
|
|
47
|
+
console.log(newFunction);
|
|
48
|
+
|
|
49
|
+
expect(newFunction.id).toBeDefined();
|
|
50
|
+
|
|
51
|
+
// // Invoke deployed function via EDGE directly.
|
|
52
|
+
// const edgeClient = client.edge;
|
|
53
|
+
// invariant(edgeClient, 'edgeClient is required');
|
|
54
|
+
// edgeClient.setIdentity(createEdgeIdentity(client));
|
|
55
|
+
|
|
56
|
+
// const input = { from: 'USD', to: 'EUR' };
|
|
57
|
+
// const result = await edgeClient.invokeFunction({ functionId }, input);
|
|
58
|
+
// log.info('>>> result', { result, functionId });
|
|
59
|
+
// const resultNumber = Number(result);
|
|
60
|
+
// expect(resultNumber).toBeGreaterThan(0);
|
|
61
|
+
// expect(resultNumber).toBeLessThan(100);
|
|
62
|
+
});
|
|
63
|
+
});
|
|
@@ -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,15 +2,16 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { Script } from '@dxos/functions';
|
|
6
6
|
import { type Resource } from '@dxos/react-ui';
|
|
7
7
|
|
|
8
8
|
import { meta } from './meta';
|
|
9
|
+
import { Notebook } from './types';
|
|
9
10
|
|
|
10
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',
|
|
@@ -18,9 +19,21 @@ export const translations = [
|
|
|
18
19
|
'object name placeholder': 'New script',
|
|
19
20
|
'rename object label': 'Rename script',
|
|
20
21
|
'delete object label': 'Delete script',
|
|
22
|
+
'object deleted label': 'Script deleted',
|
|
23
|
+
},
|
|
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',
|
|
21
33
|
},
|
|
22
34
|
[meta.id]: {
|
|
23
35
|
'plugin name': 'Scripts',
|
|
36
|
+
'settings title': 'Scripts plugin settings',
|
|
24
37
|
'description label': 'Description',
|
|
25
38
|
'description placeholder': 'Enter description',
|
|
26
39
|
'binding placeholder': 'Function name',
|
|
@@ -44,25 +57,29 @@ export const translations = [
|
|
|
44
57
|
'open token manager label': 'Open Token Manager',
|
|
45
58
|
'publish label': 'Publish',
|
|
46
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…',
|
|
47
66
|
'editor input mode label': 'Editor input mode',
|
|
48
67
|
'select editor input mode placeholder': 'Select editor input mode…',
|
|
49
68
|
'settings editor input mode default label': 'Default',
|
|
50
69
|
'settings editor input mode vim label': 'Vim',
|
|
51
70
|
'settings editor input mode vscode label': 'VS Code',
|
|
52
|
-
'template select group label': 'Select template',
|
|
53
71
|
'function panel label': 'Debug Function',
|
|
54
72
|
'script test label': 'Test',
|
|
55
73
|
'script logs label': 'Logs',
|
|
74
|
+
|
|
56
75
|
'deployment dialog title': 'Default Scripts',
|
|
57
|
-
'deployment dialog scripts found
|
|
58
|
-
'We found the following script template for your new integration:',
|
|
59
|
-
'deployment dialog scripts found message_other':
|
|
60
|
-
'We found the following script templates for your new integration:',
|
|
76
|
+
'deployment dialog scripts found message': 'Script templates:',
|
|
61
77
|
'deployment dialog deploy functions button label_one': 'Create and deploy script',
|
|
62
78
|
'deployment dialog deploy functions button label_other': 'Create and deploy scripts',
|
|
63
79
|
'deployment dialog deploy functions pending button label_one': 'Deploying script',
|
|
64
80
|
'deployment dialog deploy functions pending button label_other': 'Deploying scripts',
|
|
65
81
|
'deployment dialog skip button label': 'Skip',
|
|
82
|
+
|
|
66
83
|
'script deployment toast label_one': 'Script deployed',
|
|
67
84
|
'script deployment toast label_other': 'Scripts deployed',
|
|
68
85
|
'script deployment toast description_one': 'Your script has been deployed successfully.',
|
|
@@ -75,6 +92,17 @@ export const translations = [
|
|
|
75
92
|
'script deployment error toast description_other': 'There was an error deploying your scripts.',
|
|
76
93
|
'script deployment error toast close label_one': 'Close',
|
|
77
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',
|
|
78
106
|
},
|
|
79
107
|
},
|
|
80
108
|
},
|
|
@@ -0,0 +1,42 @@
|
|
|
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
|
+
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
|
+
}).pipe(Schema.mutable);
|
|
25
|
+
export interface Cell extends Schema.Schema.Type<typeof Cell_> {}
|
|
26
|
+
export interface Cell_Encoded extends Schema.Schema.Encoded<typeof Cell_> {}
|
|
27
|
+
export const Cell: Schema.Schema<Cell, Cell_Encoded> = Cell_;
|
|
28
|
+
|
|
29
|
+
export const Notebook = Schema.Struct({
|
|
30
|
+
name: Schema.String.pipe(Schema.optional),
|
|
31
|
+
cells: Cell.pipe(Schema.Array, Schema.mutable, FormInputAnnotation.set(false)),
|
|
32
|
+
}).pipe(
|
|
33
|
+
Type.Obj({
|
|
34
|
+
typename: 'dxos.org/type/Notebook',
|
|
35
|
+
version: '0.1.0',
|
|
36
|
+
}),
|
|
37
|
+
LabelAnnotation.set(['name']),
|
|
38
|
+
);
|
|
39
|
+
|
|
40
|
+
export type Notebook = Schema.Schema.Type<typeof Notebook>;
|
|
41
|
+
|
|
42
|
+
export const make = (props: Obj.MakeProps<typeof Notebook> = { cells: [] }) => Obj.make(Notebook, props);
|