@dxos/plugin-script 0.8.3 → 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
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as LanguageModel from '@effect/ai/LanguageModel';
|
|
6
|
+
import * as Chunk from 'effect/Chunk';
|
|
7
|
+
import * as Effect from 'effect/Effect';
|
|
8
|
+
import * as Schema from 'effect/Schema';
|
|
9
|
+
import * as Stream from 'effect/Stream';
|
|
10
|
+
|
|
11
|
+
import { AiService } from '@dxos/ai';
|
|
12
|
+
import { defineFunction } from '@dxos/functions';
|
|
13
|
+
|
|
14
|
+
export default defineFunction({
|
|
15
|
+
key: 'dxos.org/script/anthropic',
|
|
16
|
+
name: 'Anthropic Chat',
|
|
17
|
+
description: 'Chat with Anthropic',
|
|
18
|
+
inputSchema: Schema.Struct({
|
|
19
|
+
message: Schema.String,
|
|
20
|
+
}),
|
|
21
|
+
services: [AiService.AiService],
|
|
22
|
+
handler: ({ data }) => {
|
|
23
|
+
return Effect.gen(function* () {
|
|
24
|
+
const model = (yield* AiService.AiService).model('@anthropic/claude-sonnet-4-5');
|
|
25
|
+
//
|
|
26
|
+
// Basic example.
|
|
27
|
+
//
|
|
28
|
+
const { text } = yield* LanguageModel.generateText({ prompt: data.message }).pipe(Effect.provide(model));
|
|
29
|
+
|
|
30
|
+
//
|
|
31
|
+
// Streaming example.
|
|
32
|
+
//
|
|
33
|
+
const parts = yield* LanguageModel.streamText({
|
|
34
|
+
prompt: 'Count from 1 to 5, one number per line.',
|
|
35
|
+
}).pipe(Stream.runCollect, Effect.map(Chunk.toArray), Effect.provide(model));
|
|
36
|
+
const textDeltas = parts.filter((p) => p.type === 'text-delta');
|
|
37
|
+
const fullText = textDeltas.map((p) => (p as { delta: string }).delta).join('');
|
|
38
|
+
|
|
39
|
+
return { response: text, streamText: fullText };
|
|
40
|
+
});
|
|
41
|
+
},
|
|
42
|
+
});
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { Chess as ChessJS } from 'chess.js';
|
|
6
|
+
import * as Effect from 'effect/Effect';
|
|
7
|
+
import * as Schema from 'effect/Schema';
|
|
8
|
+
|
|
9
|
+
import { Database, Obj, Type } from '@dxos/echo';
|
|
10
|
+
import { defineFunction } from '@dxos/functions';
|
|
11
|
+
import { Chess } from '@dxos/plugin-chess/types';
|
|
12
|
+
|
|
13
|
+
export default defineFunction({
|
|
14
|
+
key: 'dxos.org/script/chess-bot',
|
|
15
|
+
name: 'Chess Bot',
|
|
16
|
+
description: 'Plays a random move in a chess game.',
|
|
17
|
+
|
|
18
|
+
inputSchema: Schema.Struct({
|
|
19
|
+
game: Type.Ref(Chess.Game).annotations({
|
|
20
|
+
description: 'The chess game to comment on.',
|
|
21
|
+
}),
|
|
22
|
+
player: Schema.optional(Schema.Literal('white', 'black')).annotations({
|
|
23
|
+
description: 'The player to play the game as.',
|
|
24
|
+
}),
|
|
25
|
+
}),
|
|
26
|
+
|
|
27
|
+
outputSchema: Schema.Struct({
|
|
28
|
+
state: Schema.String.annotations({
|
|
29
|
+
description: 'The state of the game as an ASCII art board.',
|
|
30
|
+
}),
|
|
31
|
+
}),
|
|
32
|
+
|
|
33
|
+
types: [Chess.Game],
|
|
34
|
+
services: [Database.Service],
|
|
35
|
+
|
|
36
|
+
handler: Effect.fnUntraced(function* ({ data: { game, player = 'black' } }) {
|
|
37
|
+
const loadedGame = yield* Database.load(game);
|
|
38
|
+
const chess = new ChessJS();
|
|
39
|
+
chess.loadPgn(loadedGame.pgn ?? '');
|
|
40
|
+
if (chess.turn() !== (player === 'white' ? 'w' : 'b')) {
|
|
41
|
+
return { state: chess.ascii() };
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const moves = chess.moves({ verbose: true });
|
|
45
|
+
const move = moves[Math.floor(Math.random() * moves.length)];
|
|
46
|
+
if (!move) {
|
|
47
|
+
return { state: chess.ascii() };
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
chess.move(move.san);
|
|
51
|
+
const newPgn = chess.pgn();
|
|
52
|
+
Obj.change(loadedGame, (g) => {
|
|
53
|
+
g.pgn = newPgn;
|
|
54
|
+
});
|
|
55
|
+
yield* Database.flush();
|
|
56
|
+
return { state: chess.ascii() };
|
|
57
|
+
}),
|
|
58
|
+
});
|
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as A from '@automerge/automerge';
|
|
6
|
+
import { Chess as ChessJS } from 'chess.js';
|
|
7
|
+
import * as Array from 'effect/Array';
|
|
8
|
+
import * as Effect from 'effect/Effect';
|
|
9
|
+
import * as Function from 'effect/Function';
|
|
10
|
+
import * as Layer from 'effect/Layer';
|
|
11
|
+
import * as Option from 'effect/Option';
|
|
12
|
+
import * as Schema from 'effect/Schema';
|
|
13
|
+
|
|
14
|
+
import { AiService, ConsolePrinter, ToolExecutionService, ToolResolverService } from '@dxos/ai';
|
|
15
|
+
import { AiSession, GenerationObserver } from '@dxos/assistant';
|
|
16
|
+
import { ArtifactId } from '@dxos/assistant';
|
|
17
|
+
import { Database, Filter, Obj, Ref, Relation, Type } from '@dxos/echo';
|
|
18
|
+
import { createDocAccessor } from '@dxos/echo-db';
|
|
19
|
+
import { TracingService, defineFunction } from '@dxos/functions';
|
|
20
|
+
import { log } from '@dxos/log';
|
|
21
|
+
import { Chess } from '@dxos/plugin-chess/types';
|
|
22
|
+
import { Markdown } from '@dxos/plugin-markdown/types';
|
|
23
|
+
import { Collection, Text } from '@dxos/schema';
|
|
24
|
+
import { HasSubject } from '@dxos/types';
|
|
25
|
+
import { trim } from '@dxos/util';
|
|
26
|
+
|
|
27
|
+
export default defineFunction({
|
|
28
|
+
key: 'dxos.org/function/chess/commentary',
|
|
29
|
+
name: 'Commentary',
|
|
30
|
+
description: 'Adds commentary about the most recent move to a markdown document associated with the chess game.',
|
|
31
|
+
inputSchema: Schema.Struct({
|
|
32
|
+
game: Type.Ref(Chess.Game).annotations({
|
|
33
|
+
description: 'The chess game to comment on.',
|
|
34
|
+
}),
|
|
35
|
+
}),
|
|
36
|
+
outputSchema: Schema.Union(
|
|
37
|
+
Schema.Struct({
|
|
38
|
+
documentId: ArtifactId.annotations({
|
|
39
|
+
description: 'The ID of the markdown document that was updated or created.',
|
|
40
|
+
}),
|
|
41
|
+
commentary: Schema.String.annotations({
|
|
42
|
+
description: 'The commentary that was added.',
|
|
43
|
+
}),
|
|
44
|
+
}),
|
|
45
|
+
Schema.Void.annotations({
|
|
46
|
+
description: 'Function did not find anything to comment on.',
|
|
47
|
+
}),
|
|
48
|
+
),
|
|
49
|
+
types: [Chess.Game, Markdown.Document, Text.Text, HasSubject.HasSubject, Collection.Collection],
|
|
50
|
+
services: [AiService.AiService, Database.Service],
|
|
51
|
+
handler: Effect.fnUntraced(
|
|
52
|
+
function* ({ data: { game: gameRef } }) {
|
|
53
|
+
// Load the chess game
|
|
54
|
+
log.info('load game', { gameRef });
|
|
55
|
+
const chessGame = yield* Database.load(gameRef);
|
|
56
|
+
|
|
57
|
+
// Load the chess position from PGN or FEN
|
|
58
|
+
const chess = new ChessJS();
|
|
59
|
+
if (chessGame.pgn) {
|
|
60
|
+
chess.loadPgn(chessGame.pgn);
|
|
61
|
+
} else if (chessGame.fen) {
|
|
62
|
+
chess.load(chessGame.fen);
|
|
63
|
+
} else {
|
|
64
|
+
log.info('Early return: no pgn or fen');
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// Get the most recent move
|
|
69
|
+
const history = chess.history({ verbose: true });
|
|
70
|
+
if (history.length === 0) {
|
|
71
|
+
throw new Error('No moves have been played yet');
|
|
72
|
+
}
|
|
73
|
+
const lastMove = history[history.length - 1];
|
|
74
|
+
const moveNumber = Math.ceil(history.length / 2);
|
|
75
|
+
const isWhiteMove = history.length % 2 === 1;
|
|
76
|
+
const player = isWhiteMove ? 'White' : 'Black';
|
|
77
|
+
const moveNotation = lastMove.san;
|
|
78
|
+
|
|
79
|
+
// Generate AI commentary about the move
|
|
80
|
+
const result = yield* new AiSession().run({
|
|
81
|
+
prompt:
|
|
82
|
+
`Comment on this chess move as if you're commentating a live match for an audience:\n\n` +
|
|
83
|
+
`Move ${moveNumber}: ${player} plays ${moveNotation} (${lastMove.from} to ${lastMove.to})${lastMove.captured ? `, capturing ${lastMove.captured}` : ''}\n` +
|
|
84
|
+
`Current position: ${chess.fen()}\n` +
|
|
85
|
+
`${chess.isCheck() ? 'The king is in check! ' : ''}` +
|
|
86
|
+
`${chess.isCheckmate() ? 'CHECKMATE! ' : ''}` +
|
|
87
|
+
`${chess.isStalemate() ? 'STALEMATE! ' : ''}` +
|
|
88
|
+
`\nGame so far:\n${chess.pgn()}`,
|
|
89
|
+
system: COMMENTARY_SYSTEM_PROMPT,
|
|
90
|
+
history: [],
|
|
91
|
+
observer: GenerationObserver.fromPrinter(new ConsolePrinter({ tag: 'chess-commentary' })),
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
const commentaryText = Function.pipe(
|
|
95
|
+
result,
|
|
96
|
+
Array.findLast((msg) => msg.sender.role === 'assistant' && msg.blocks.some((block) => block._tag === 'text')),
|
|
97
|
+
Option.flatMap((msg) =>
|
|
98
|
+
Function.pipe(
|
|
99
|
+
msg.blocks,
|
|
100
|
+
Array.findLast((block) => block._tag === 'text'),
|
|
101
|
+
Option.map((block) => block.text),
|
|
102
|
+
),
|
|
103
|
+
),
|
|
104
|
+
Option.getOrThrowWith(() => new Error('No commentary generated')),
|
|
105
|
+
);
|
|
106
|
+
|
|
107
|
+
const commentary = `## Move ${moveNumber}: ${player} plays ${moveNotation}\n\n${commentaryText}\n\n`;
|
|
108
|
+
log.info('commentary', { commentary });
|
|
109
|
+
|
|
110
|
+
// TODO(wittjosiah): Functions currently don't support traversals.
|
|
111
|
+
// const docs = yield* Database.runQuery(
|
|
112
|
+
// Query.select(Filter.id(chessGame.id)).targetOf(HasSubject.HasSubject).source(),
|
|
113
|
+
// ).pipe(Effect.map((objects) => objects.filter((object) => Obj.instanceOf(Markdown.Document, object))));
|
|
114
|
+
const docs = yield* Database.runQuery(Filter.type(HasSubject.HasSubject)).pipe(
|
|
115
|
+
Effect.map((relations) =>
|
|
116
|
+
relations.filter((relation) => {
|
|
117
|
+
// TODO(wittjosiah): This is a workaround for getTarget not handling deleted objects.
|
|
118
|
+
try {
|
|
119
|
+
log.info('relation', {
|
|
120
|
+
source: Obj.getDXN(Relation.getTarget(relation)).toString(),
|
|
121
|
+
game: Obj.getDXN(chessGame).toString(),
|
|
122
|
+
});
|
|
123
|
+
return Obj.getDXN(Relation.getTarget(relation)).toString() === Obj.getDXN(chessGame).toString();
|
|
124
|
+
} catch {
|
|
125
|
+
return false;
|
|
126
|
+
}
|
|
127
|
+
}),
|
|
128
|
+
),
|
|
129
|
+
Effect.map((relations) =>
|
|
130
|
+
relations
|
|
131
|
+
.map((relation) => {
|
|
132
|
+
// TODO(wittjosiah): This is a workaround for getSource not handling deleted objects.
|
|
133
|
+
try {
|
|
134
|
+
return Relation.getSource(relation);
|
|
135
|
+
} catch {
|
|
136
|
+
return undefined;
|
|
137
|
+
}
|
|
138
|
+
})
|
|
139
|
+
.filter((source) => source !== undefined),
|
|
140
|
+
),
|
|
141
|
+
Effect.map((sources) => {
|
|
142
|
+
const docs = sources.filter((source) => Obj.instanceOf(Markdown.Document, source));
|
|
143
|
+
log.info('docs', { sources, docs });
|
|
144
|
+
return docs;
|
|
145
|
+
}),
|
|
146
|
+
);
|
|
147
|
+
log.info('docs', { count: docs.length });
|
|
148
|
+
|
|
149
|
+
let document: Markdown.Document;
|
|
150
|
+
if (docs.length === 0) {
|
|
151
|
+
// TODO(wittjosiah): Deploy fails if `SpaceProperties` schema is imported because its from `client-protocol`.
|
|
152
|
+
const [properties] = yield* Database.runQuery(Filter.typename('dxos.org/type/Properties'));
|
|
153
|
+
const rootCollection = yield* Database.load<Collection.Collection>(properties[Collection.Collection.typename]);
|
|
154
|
+
|
|
155
|
+
log.info('rootCollection', { rootCollection });
|
|
156
|
+
|
|
157
|
+
// Create a new markdown document
|
|
158
|
+
const gameName = chessGame.name || 'Chess Game';
|
|
159
|
+
document = yield* Database.add(
|
|
160
|
+
Markdown.make({
|
|
161
|
+
name: `${gameName} Commentary`,
|
|
162
|
+
content: `# ${gameName} Commentary\n\n${commentary}`,
|
|
163
|
+
}),
|
|
164
|
+
);
|
|
165
|
+
|
|
166
|
+
const documentRef = Ref.make(document);
|
|
167
|
+
Obj.change(rootCollection, (c) => {
|
|
168
|
+
c.objects.push(documentRef);
|
|
169
|
+
});
|
|
170
|
+
|
|
171
|
+
// Create the HasSubject relation
|
|
172
|
+
yield* Database.add(
|
|
173
|
+
Relation.make(HasSubject.HasSubject, {
|
|
174
|
+
[Relation.Source]: document,
|
|
175
|
+
[Relation.Target]: chessGame,
|
|
176
|
+
completedAt: new Date().toISOString(),
|
|
177
|
+
}),
|
|
178
|
+
);
|
|
179
|
+
} else {
|
|
180
|
+
document = docs[0];
|
|
181
|
+
|
|
182
|
+
// Load the text content and append the commentary
|
|
183
|
+
const text = yield* Database.load(document.content);
|
|
184
|
+
const accessor = createDocAccessor(text, ['content']);
|
|
185
|
+
accessor.handle.change((doc: A.Doc<Text.Text>) => {
|
|
186
|
+
A.splice(doc, accessor.path.slice(), text.content.length, 0, commentary);
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
log.info('result', { documentId: Obj.getDXN(document).toString(), commentary });
|
|
191
|
+
|
|
192
|
+
yield* Database.flush();
|
|
193
|
+
|
|
194
|
+
return {
|
|
195
|
+
documentId: Obj.getDXN(document).toString(),
|
|
196
|
+
commentary,
|
|
197
|
+
};
|
|
198
|
+
},
|
|
199
|
+
Effect.provide(
|
|
200
|
+
Layer.mergeAll(
|
|
201
|
+
AiService.model('@anthropic/claude-haiku-4-5'),
|
|
202
|
+
ToolResolverService.layerEmpty,
|
|
203
|
+
ToolExecutionService.layerEmpty,
|
|
204
|
+
TracingService.layerNoop,
|
|
205
|
+
),
|
|
206
|
+
),
|
|
207
|
+
),
|
|
208
|
+
});
|
|
209
|
+
|
|
210
|
+
const COMMENTARY_SYSTEM_PROMPT = trim`
|
|
211
|
+
You are a professional chess commentator providing live commentary for a chess match.
|
|
212
|
+
|
|
213
|
+
# Style
|
|
214
|
+
- Write in an engaging, enthusiastic style as if commentating for a live audience
|
|
215
|
+
- Be concise but informative (2-4 sentences)
|
|
216
|
+
- Explain the strategic implications of the move
|
|
217
|
+
- Note any tactical elements (captures, threats, checks)
|
|
218
|
+
- Comment on the position and what it means for the game
|
|
219
|
+
|
|
220
|
+
# Format
|
|
221
|
+
- Write in plain text (no markdown formatting in the commentary itself)
|
|
222
|
+
- Be natural and conversational
|
|
223
|
+
- Use chess terminology appropriately but keep it accessible
|
|
224
|
+
|
|
225
|
+
# Special Situations
|
|
226
|
+
- If it's checkmate, express excitement about the conclusion
|
|
227
|
+
- If it's check, note the pressure on the king
|
|
228
|
+
- If a piece is captured, mention the material exchange
|
|
229
|
+
- Comment on the development of pieces and control of key squares when relevant
|
|
230
|
+
`;
|
|
@@ -3,21 +3,27 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
// @ts-ignore
|
|
6
|
-
import {
|
|
6
|
+
import { Expando, S, create, defineFunction } from 'dxos:functions';
|
|
7
7
|
// @ts-ignore
|
|
8
8
|
import { randText } from 'https://esm.sh/@ngneat/falso@7.1.1?bundle=false';
|
|
9
9
|
|
|
10
10
|
export default defineFunction({
|
|
11
|
+
key: 'dxos.org/script/data-generator',
|
|
12
|
+
name: 'Data Generator',
|
|
11
13
|
inputSchema: S.Struct({
|
|
12
14
|
documentAmount: S.optional(S.Number),
|
|
13
15
|
textSize: S.optional(S.Number),
|
|
14
16
|
mutationAmount: S.optional(S.Number),
|
|
17
|
+
waitAfterCreation: S.optional(S.Number),
|
|
15
18
|
}),
|
|
16
19
|
|
|
17
20
|
outputSchema: S.Struct({}),
|
|
18
21
|
|
|
19
|
-
handler: async ({
|
|
20
|
-
|
|
22
|
+
handler: async ({
|
|
23
|
+
data: { documentAmount = 1, textSize = 10, mutationAmount = 0, waitAfterCreation = 10_000 },
|
|
24
|
+
context: { space },
|
|
25
|
+
}: any) => {
|
|
26
|
+
await space.db.graph.schemaRegistry.register([Expando]);
|
|
21
27
|
const result: Record<string, any> = {};
|
|
22
28
|
const objects: Expando[] = [];
|
|
23
29
|
|
|
@@ -42,7 +48,7 @@ export default defineFunction({
|
|
|
42
48
|
|
|
43
49
|
// Flush and wait for data to propagate.
|
|
44
50
|
await space.db.flush();
|
|
45
|
-
await new Promise((resolve) => setTimeout(resolve,
|
|
46
|
-
return
|
|
51
|
+
await new Promise((resolve) => setTimeout(resolve, waitAfterCreation));
|
|
52
|
+
return { createdObjects: objects.length };
|
|
47
53
|
},
|
|
48
54
|
});
|
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),
|
package/src/templates/email.ts
CHANGED
|
@@ -9,10 +9,10 @@
|
|
|
9
9
|
export default async ({ data: { bodyText }, context: { space } }: any) => {
|
|
10
10
|
const { email, targetDocumentId: documentId } = JSON.parse(bodyText) as RequestPayload;
|
|
11
11
|
|
|
12
|
-
const document = await space.db.query({ id: documentId }
|
|
12
|
+
const document = await space.db.query({ id: documentId }).first();
|
|
13
13
|
|
|
14
14
|
const contentId = document.content['/'].split(':')[3];
|
|
15
|
-
const documentContent = await space.db.query({ id: contentId }
|
|
15
|
+
const documentContent = await space.db.query({ id: contentId }).first();
|
|
16
16
|
const modifiedContent = [
|
|
17
17
|
documentContent.content,
|
|
18
18
|
'',
|
|
@@ -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('5 seconds'),
|
|
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 },
|