@dxos/plugin-assistant 0.8.4-main.67995b8 → 0.8.4-main.c4373fc
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/{BlueprintContainer-IZ4AK5EO.mjs → BlueprintContainer-TO35YXHT.mjs} +4 -3
- package/dist/lib/browser/ChatCompanion-ZIKNUUSU.mjs +127 -0
- package/dist/lib/browser/ChatCompanion-ZIKNUUSU.mjs.map +7 -0
- package/dist/lib/browser/{ChatContainer-RP3QEXYX.mjs → ChatContainer-MA5BVDGH.mjs} +33 -14
- package/dist/lib/browser/ChatContainer-MA5BVDGH.mjs.map +7 -0
- package/dist/lib/browser/{ChatDialog-ZVLXFHEY.mjs → ChatDialog-7OXLIWZI.mjs} +26 -12
- package/dist/lib/browser/ChatDialog-7OXLIWZI.mjs.map +7 -0
- package/dist/lib/browser/{SequenceContainer-3UDVKWPA.mjs → SequenceContainer-2FEWMQGW.mjs} +7 -19
- package/dist/lib/browser/SequenceContainer-2FEWMQGW.mjs.map +7 -0
- package/dist/lib/browser/ai-service-ERTZBTP3.mjs +19 -0
- package/dist/lib/browser/ai-service-ERTZBTP3.mjs.map +7 -0
- package/dist/lib/browser/{app-graph-builder-XSEOKJLG.mjs → app-graph-builder-VKFRYY2N.mjs} +31 -41
- package/dist/lib/browser/app-graph-builder-VKFRYY2N.mjs.map +7 -0
- package/dist/lib/browser/blueprint-definition-NSJARW5U.mjs +12 -0
- package/dist/lib/browser/blueprint-definition-NSJARW5U.mjs.map +7 -0
- package/dist/lib/browser/chunk-2CE2KPKZ.mjs +175 -0
- package/dist/lib/browser/chunk-2CE2KPKZ.mjs.map +7 -0
- package/dist/lib/browser/chunk-43I2LR6O.mjs +216 -0
- package/dist/lib/browser/chunk-43I2LR6O.mjs.map +7 -0
- package/dist/lib/browser/chunk-5EGXHCAZ.mjs +16 -0
- package/dist/lib/browser/chunk-5EGXHCAZ.mjs.map +7 -0
- package/dist/lib/browser/chunk-5RICKAMN.mjs +18 -0
- package/dist/lib/browser/chunk-5RICKAMN.mjs.map +7 -0
- package/dist/lib/browser/chunk-B2RCJXEO.mjs +202 -0
- package/dist/lib/browser/chunk-B2RCJXEO.mjs.map +7 -0
- package/dist/lib/browser/chunk-BRJMNZOS.mjs +169 -0
- package/dist/lib/browser/chunk-BRJMNZOS.mjs.map +7 -0
- package/dist/lib/browser/chunk-J5LGTIGS.mjs +10 -0
- package/dist/lib/browser/chunk-J5LGTIGS.mjs.map +7 -0
- package/dist/lib/browser/chunk-P5P7QXBS.mjs +296 -0
- package/dist/lib/browser/chunk-P5P7QXBS.mjs.map +7 -0
- package/dist/lib/browser/chunk-UDH4MR7H.mjs +1744 -0
- package/dist/lib/browser/chunk-UDH4MR7H.mjs.map +7 -0
- package/dist/lib/browser/edge-model-resolver-O6OFYIO2.mjs +18 -0
- package/dist/lib/browser/edge-model-resolver-O6OFYIO2.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +144 -63
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/intent-resolver-5LB25ZRN.mjs +112 -0
- package/dist/lib/browser/intent-resolver-5LB25ZRN.mjs.map +7 -0
- package/dist/lib/browser/local-model-resolver-GO6ZEMLL.mjs +17 -0
- package/dist/lib/browser/local-model-resolver-GO6ZEMLL.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/react-surface-WQZXU624.mjs +107 -0
- package/dist/lib/browser/react-surface-WQZXU624.mjs.map +7 -0
- package/dist/lib/browser/{settings-5GTTCVGD.mjs → settings-4B2NA4CE.mjs} +8 -7
- package/dist/lib/{node-esm/settings-J2EXEM5H.mjs.map → browser/settings-4B2NA4CE.mjs.map} +1 -1
- package/dist/lib/browser/state-LXTS54DI.mjs +21 -0
- package/dist/lib/browser/state-LXTS54DI.mjs.map +7 -0
- package/dist/lib/browser/toolkit-NQ2GXCF5.mjs +199 -0
- package/dist/lib/browser/toolkit-NQ2GXCF5.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +7 -4
- package/dist/lib/node-esm/{BlueprintContainer-RGTMNLNX.mjs → BlueprintContainer-J664LTU3.mjs} +4 -3
- package/dist/lib/{browser/BlueprintContainer-IZ4AK5EO.mjs.map → node-esm/BlueprintContainer-J664LTU3.mjs.map} +1 -1
- package/dist/lib/node-esm/ChatCompanion-YDXJIVCF.mjs +128 -0
- package/dist/lib/node-esm/ChatCompanion-YDXJIVCF.mjs.map +7 -0
- package/dist/lib/node-esm/{ChatContainer-W3W6FWV3.mjs → ChatContainer-WLTOQLHH.mjs} +33 -14
- package/dist/lib/node-esm/ChatContainer-WLTOQLHH.mjs.map +7 -0
- package/dist/lib/node-esm/{ChatDialog-QW4JRKVO.mjs → ChatDialog-ADKF62SY.mjs} +26 -12
- package/dist/lib/node-esm/ChatDialog-ADKF62SY.mjs.map +7 -0
- package/dist/lib/node-esm/{SequenceContainer-RQQH5XOC.mjs → SequenceContainer-PGGJUQ46.mjs} +7 -19
- package/dist/lib/node-esm/SequenceContainer-PGGJUQ46.mjs.map +7 -0
- package/dist/lib/node-esm/ai-service-MUYLV3NT.mjs +20 -0
- package/dist/lib/node-esm/ai-service-MUYLV3NT.mjs.map +7 -0
- package/dist/lib/node-esm/{app-graph-builder-PANCJUHV.mjs → app-graph-builder-K6AYO4YM.mjs} +31 -41
- package/dist/lib/node-esm/app-graph-builder-K6AYO4YM.mjs.map +7 -0
- package/dist/lib/node-esm/blueprint-definition-WD2IVMAI.mjs +13 -0
- package/dist/lib/node-esm/blueprint-definition-WD2IVMAI.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-73ABYRYX.mjs +20 -0
- package/dist/lib/node-esm/chunk-73ABYRYX.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-DBDKOC3I.mjs +203 -0
- package/dist/lib/node-esm/chunk-DBDKOC3I.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-DSE2IILK.mjs +217 -0
- package/dist/lib/node-esm/chunk-DSE2IILK.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-I7BZMIAG.mjs +170 -0
- package/dist/lib/node-esm/chunk-I7BZMIAG.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-TBQOICXZ.mjs +297 -0
- package/dist/lib/node-esm/chunk-TBQOICXZ.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-U2NYUS2N.mjs +177 -0
- package/dist/lib/node-esm/chunk-U2NYUS2N.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-UPPSDTOJ.mjs +1745 -0
- package/dist/lib/node-esm/chunk-UPPSDTOJ.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-XQGWSZ4T.mjs +17 -0
- package/dist/lib/node-esm/chunk-XQGWSZ4T.mjs.map +7 -0
- package/dist/lib/node-esm/edge-model-resolver-2ARXDOYS.mjs +19 -0
- package/dist/lib/node-esm/edge-model-resolver-2ARXDOYS.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +144 -63
- package/dist/lib/node-esm/index.mjs.map +3 -3
- package/dist/lib/node-esm/intent-resolver-I64MNI4C.mjs +113 -0
- package/dist/lib/node-esm/intent-resolver-I64MNI4C.mjs.map +7 -0
- package/dist/lib/node-esm/local-model-resolver-WOQ2D2R2.mjs +18 -0
- package/dist/lib/node-esm/local-model-resolver-WOQ2D2R2.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/{react-surface-QDQWJ7FZ.mjs → react-surface-TVVVRIR3.mjs} +25 -68
- package/dist/lib/node-esm/react-surface-TVVVRIR3.mjs.map +7 -0
- package/dist/lib/node-esm/{settings-J2EXEM5H.mjs → settings-7Y3CRASE.mjs} +8 -7
- package/dist/lib/{browser/settings-5GTTCVGD.mjs.map → node-esm/settings-7Y3CRASE.mjs.map} +1 -1
- package/dist/lib/node-esm/state-BO6GUFLB.mjs +22 -0
- package/dist/lib/node-esm/state-BO6GUFLB.mjs.map +7 -0
- package/dist/lib/node-esm/toolkit-V57PRJNG.mjs +200 -0
- package/dist/lib/node-esm/toolkit-V57PRJNG.mjs.map +7 -0
- package/dist/lib/node-esm/types/index.mjs +7 -4
- package/dist/types/src/AssistantPlugin.d.ts +1 -1
- package/dist/types/src/AssistantPlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/ai-service.d.ts +4 -0
- package/dist/types/src/capabilities/ai-service.d.ts.map +1 -0
- 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/blueprint-definition.d.ts +7 -0
- package/dist/types/src/capabilities/blueprint-definition.d.ts.map +1 -0
- package/dist/types/src/capabilities/capabilities.d.ts +11 -0
- package/dist/types/src/capabilities/capabilities.d.ts.map +1 -0
- package/dist/types/src/capabilities/edge-model-resolver.d.ts +4 -0
- package/dist/types/src/capabilities/edge-model-resolver.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +11 -3
- 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/local-model-resolver.d.ts +10 -0
- package/dist/types/src/capabilities/local-model-resolver.d.ts.map +1 -0
- 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/capabilities/state.d.ts +4 -0
- package/dist/types/src/capabilities/state.d.ts.map +1 -0
- package/dist/types/src/capabilities/toolkit.d.ts +4 -0
- package/dist/types/src/capabilities/toolkit.d.ts.map +1 -0
- package/dist/types/src/components/AssistantSettings/AssistantSettings.d.ts.map +1 -1
- package/dist/types/src/components/Chat/Chat.d.ts +20 -17
- package/dist/types/src/components/Chat/Chat.d.ts.map +1 -1
- package/dist/types/src/components/Chat/events.d.ts +5 -0
- package/dist/types/src/components/Chat/events.d.ts.map +1 -1
- package/dist/types/src/components/ChatCompanion.d.ts +13 -0
- package/dist/types/src/components/ChatCompanion.d.ts.map +1 -0
- package/dist/types/src/components/ChatContainer.d.ts +4 -4
- package/dist/types/src/components/ChatContainer.d.ts.map +1 -1
- package/dist/types/src/components/ChatDialog.d.ts.map +1 -1
- package/dist/types/src/components/ChatProgress/ChatProgress.d.ts +7 -0
- package/dist/types/src/components/ChatProgress/ChatProgress.d.ts.map +1 -0
- package/dist/types/src/components/ChatProgress/index.d.ts +2 -0
- package/dist/types/src/components/ChatProgress/index.d.ts.map +1 -0
- package/dist/types/src/components/ChatPrompt/ChatActions.d.ts.map +1 -1
- package/dist/types/src/components/ChatPrompt/ChatOptions.d.ts +20 -0
- package/dist/types/src/components/ChatPrompt/ChatOptions.d.ts.map +1 -0
- package/dist/types/src/components/ChatPrompt/ChatPresets.d.ts.map +1 -1
- package/dist/types/src/components/ChatPrompt/ChatReferences.d.ts +4 -5
- package/dist/types/src/components/ChatPrompt/ChatReferences.d.ts.map +1 -1
- package/dist/types/src/components/ChatPrompt/ChatStatusIndicator.d.ts +6 -4
- package/dist/types/src/components/ChatPrompt/ChatStatusIndicator.d.ts.map +1 -1
- package/dist/types/src/components/ChatPrompt/index.d.ts +1 -1
- package/dist/types/src/components/ChatPrompt/index.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/ChatThread.d.ts +10 -7
- package/dist/types/src/components/ChatThread/ChatThread.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/ChatThread.stories.d.ts +115 -33
- package/dist/types/src/components/ChatThread/ChatThread.stories.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/Link.d.ts +9 -0
- package/dist/types/src/components/ChatThread/Link.d.ts.map +1 -0
- package/dist/types/src/components/ChatThread/reducers.d.ts +40 -0
- package/dist/types/src/components/ChatThread/reducers.d.ts.map +1 -0
- package/dist/types/src/components/ChatThread/registry.d.ts +11 -0
- package/dist/types/src/components/ChatThread/registry.d.ts.map +1 -0
- package/dist/types/src/components/ChatThread/sync.d.ts +36 -0
- package/dist/types/src/components/ChatThread/sync.d.ts.map +1 -0
- package/dist/types/src/components/ChatThread/sync.test.d.ts +2 -0
- package/dist/types/src/components/ChatThread/sync.test.d.ts.map +1 -0
- package/dist/types/src/components/PromptSettings.d.ts.map +1 -1
- package/dist/types/src/components/SequenceContainer.d.ts.map +1 -1
- package/dist/types/src/components/SequenceEditor/SequenceEditor.d.ts +1 -1
- package/dist/types/src/components/SequenceEditor/SequenceEditor.d.ts.map +1 -1
- package/dist/types/src/components/SequenceEditor/SequenceEditor.stories.d.ts +264 -3
- package/dist/types/src/components/SequenceEditor/SequenceEditor.stories.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/TemplateEditor.d.ts +0 -5
- package/dist/types/src/components/TemplateEditor/TemplateEditor.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/TemplateEditor.stories.d.ts +262 -7
- package/dist/types/src/components/TemplateEditor/TemplateEditor.stories.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/TemplateForm.d.ts +1 -1
- package/dist/types/src/components/TemplateEditor/TemplateForm.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/TemplateForm.stories.d.ts +259 -2
- package/dist/types/src/components/TemplateEditor/TemplateForm.stories.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/handlebars-extension.d.ts +12 -0
- package/dist/types/src/components/TemplateEditor/handlebars-extension.d.ts.map +1 -0
- package/dist/types/src/components/ToolBlock/ToolBlock.d.ts +19 -0
- package/dist/types/src/components/ToolBlock/ToolBlock.d.ts.map +1 -0
- package/dist/types/src/components/ToolBlock/ToolBlockWidget.d.ts +2 -0
- package/dist/types/src/components/ToolBlock/ToolBlockWidget.d.ts.map +1 -0
- package/dist/types/src/components/ToolBlock/index.d.ts +3 -0
- package/dist/types/src/components/ToolBlock/index.d.ts.map +1 -0
- package/dist/types/src/components/Toolbar/Toolbar.d.ts +5 -0
- package/dist/types/src/components/Toolbar/Toolbar.d.ts.map +1 -0
- package/dist/types/src/components/Toolbar/index.d.ts +2 -0
- package/dist/types/src/components/Toolbar/index.d.ts.map +1 -0
- package/dist/types/src/components/Toolbar/useChatToolbarActions.d.ts +11 -0
- package/dist/types/src/components/Toolbar/useChatToolbarActions.d.ts.map +1 -0
- package/dist/types/src/components/Toolbox/Toolbox.d.ts +4 -9
- package/dist/types/src/components/Toolbox/Toolbox.d.ts.map +1 -1
- package/dist/types/src/components/Toolbox/Toolbox.stories.d.ts +262 -5
- package/dist/types/src/components/Toolbox/Toolbox.stories.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +4 -1
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/events.d.ts +1 -1
- package/dist/types/src/events.d.ts.map +1 -1
- package/dist/types/src/functions/analysis.d.ts +5 -0
- package/dist/types/src/functions/analysis.d.ts.map +1 -0
- package/dist/types/src/functions/index.d.ts +4 -0
- package/dist/types/src/functions/index.d.ts.map +1 -0
- package/dist/types/src/functions/list.d.ts +10 -0
- package/dist/types/src/functions/list.d.ts.map +1 -0
- package/dist/types/src/functions/load.d.ts +8 -0
- package/dist/types/src/functions/load.d.ts.map +1 -0
- package/dist/types/src/hooks/index.d.ts +7 -3
- package/dist/types/src/hooks/index.d.ts.map +1 -1
- package/dist/types/src/hooks/useBlueprintRegistry.d.ts +25 -0
- package/dist/types/src/hooks/useBlueprintRegistry.d.ts.map +1 -0
- package/dist/types/src/hooks/useChatProcessor.d.ts +8 -21
- package/dist/types/src/hooks/useChatProcessor.d.ts.map +1 -1
- package/dist/types/src/hooks/useChatServices.d.ts +5 -6
- package/dist/types/src/hooks/useChatServices.d.ts.map +1 -1
- package/dist/types/src/hooks/useContextBinder.d.ts +4 -0
- package/dist/types/src/hooks/useContextBinder.d.ts.map +1 -0
- package/dist/types/src/hooks/useContextObjects.d.ts +15 -0
- package/dist/types/src/hooks/useContextObjects.d.ts.map +1 -0
- package/dist/types/src/hooks/useFlush.d.ts +6 -0
- package/dist/types/src/hooks/useFlush.d.ts.map +1 -0
- package/dist/types/src/hooks/useItemTypes.d.ts +4 -0
- package/dist/types/src/hooks/useItemTypes.d.ts.map +1 -0
- package/dist/types/src/hooks/useOnline.d.ts +3 -0
- package/dist/types/src/hooks/useOnline.d.ts.map +1 -0
- package/dist/types/src/hooks/usePresets.d.ts +7 -0
- package/dist/types/src/hooks/usePresets.d.ts.map +1 -0
- package/dist/types/src/hooks/useReferencesProvider.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +1 -2
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/processor/index.d.ts +3 -0
- package/dist/types/src/processor/index.d.ts.map +1 -0
- package/dist/types/src/{hooks → processor}/presets.d.ts +3 -3
- package/dist/types/src/processor/presets.d.ts.map +1 -0
- package/dist/types/src/processor/processor.d.ts +74 -0
- package/dist/types/src/processor/processor.d.ts.map +1 -0
- package/dist/types/src/processor/processor.test.d.ts +2 -0
- package/dist/types/src/processor/processor.test.d.ts.map +1 -0
- package/dist/types/src/stories/Chat.stories.d.ts +28 -203
- package/dist/types/src/stories/Chat.stories.d.ts.map +1 -1
- package/dist/types/src/stories/QueryEditor.stories.d.ts +7 -0
- package/dist/types/src/stories/QueryEditor.stories.d.ts.map +1 -0
- package/dist/types/src/stories/components/BlueprintContainer.d.ts +4 -0
- package/dist/types/src/stories/components/BlueprintContainer.d.ts.map +1 -0
- package/dist/types/src/stories/components/ChatContainer.d.ts +4 -0
- package/dist/types/src/stories/components/ChatContainer.d.ts.map +1 -0
- package/dist/types/src/stories/components/ChessContainer.d.ts +4 -0
- package/dist/types/src/stories/components/ChessContainer.d.ts.map +1 -0
- package/dist/types/src/stories/components/CommentsContainer.d.ts +4 -0
- package/dist/types/src/stories/components/CommentsContainer.d.ts.map +1 -0
- package/dist/types/src/stories/components/DebugCard.d.ts +8 -0
- package/dist/types/src/stories/components/DebugCard.d.ts.map +1 -0
- package/dist/types/src/stories/components/ExecutionGraphContainer.d.ts +7 -0
- package/dist/types/src/stories/components/ExecutionGraphContainer.d.ts.map +1 -0
- package/dist/types/src/stories/components/GraphContainer.d.ts +6 -0
- package/dist/types/src/stories/components/GraphContainer.d.ts.map +1 -0
- package/dist/types/src/stories/components/InvocationsContainer.d.ts +4 -0
- package/dist/types/src/stories/components/InvocationsContainer.d.ts.map +1 -0
- package/dist/types/src/stories/components/MessageContainer.d.ts +4 -0
- package/dist/types/src/stories/components/MessageContainer.d.ts.map +1 -0
- package/dist/types/src/stories/components/ProjectContainer.d.ts +4 -0
- package/dist/types/src/stories/components/ProjectContainer.d.ts.map +1 -0
- package/dist/types/src/stories/components/PromptContainer.d.ts +6 -0
- package/dist/types/src/stories/components/PromptContainer.d.ts.map +1 -0
- package/dist/types/src/stories/components/ResearchInputStack.d.ts +4 -0
- package/dist/types/src/stories/components/ResearchInputStack.d.ts.map +1 -0
- package/dist/types/src/stories/components/ResearchOutputStack.d.ts +4 -0
- package/dist/types/src/stories/components/ResearchOutputStack.d.ts.map +1 -0
- package/dist/types/src/stories/components/ScriptContainer.d.ts +4 -0
- package/dist/types/src/stories/components/ScriptContainer.d.ts.map +1 -0
- package/dist/types/src/stories/components/TasksContainer.d.ts +4 -0
- package/dist/types/src/stories/components/TasksContainer.d.ts.map +1 -0
- package/dist/types/src/stories/components/TokenManagerContainer.d.ts +3 -0
- package/dist/types/src/stories/components/TokenManagerContainer.d.ts.map +1 -0
- package/dist/types/src/stories/components/TriggersContainer.d.ts +3 -0
- package/dist/types/src/stories/components/TriggersContainer.d.ts.map +1 -0
- package/dist/types/src/stories/components/index.d.ts +18 -0
- package/dist/types/src/stories/components/index.d.ts.map +1 -0
- package/dist/types/src/stories/components/types.d.ts +7 -0
- package/dist/types/src/stories/components/types.d.ts.map +1 -0
- package/dist/types/src/stories/testing/data.d.ts +9 -0
- package/dist/types/src/stories/testing/data.d.ts.map +1 -0
- package/dist/types/src/stories/testing/index.d.ts +3 -0
- package/dist/types/src/stories/testing/index.d.ts.map +1 -0
- package/dist/types/src/stories/testing/schema.d.ts +7 -0
- package/dist/types/src/stories/testing/schema.d.ts.map +1 -0
- package/dist/types/src/stories/testing/testing.d.ts +51 -0
- package/dist/types/src/stories/testing/testing.d.ts.map +1 -0
- package/dist/types/src/testing/index.d.ts +3 -1
- package/dist/types/src/testing/index.d.ts.map +1 -1
- package/dist/types/src/testing/test-data.d.ts +14 -0
- package/dist/types/src/testing/test-data.d.ts.map +1 -0
- package/dist/types/src/testing/test-functions.d.ts +5 -2
- package/dist/types/src/testing/test-functions.d.ts.map +1 -1
- package/dist/types/src/testing/test-generator.d.ts +7 -0
- package/dist/types/src/testing/test-generator.d.ts.map +1 -0
- package/dist/types/src/testing/test-sequence.d.ts +0 -4
- package/dist/types/src/testing/test-sequence.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +28 -12
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/Assistant.d.ts +42 -0
- package/dist/types/src/types/Assistant.d.ts.map +1 -0
- package/dist/types/src/types/AssistantAction.d.ts +107 -0
- package/dist/types/src/types/AssistantAction.d.ts.map +1 -0
- package/dist/types/src/types/defs.d.ts +2 -0
- package/dist/types/src/types/defs.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/service.d.ts +15 -12
- package/dist/types/src/types/service.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +115 -96
- package/src/AssistantPlugin.tsx +150 -107
- package/src/capabilities/ai-service.ts +27 -0
- package/src/capabilities/app-graph-builder.ts +45 -51
- package/src/capabilities/blueprint-definition.ts +64 -0
- package/src/capabilities/capabilities.ts +18 -0
- package/src/capabilities/edge-model-resolver.ts +25 -0
- package/src/capabilities/index.ts +9 -0
- package/src/capabilities/intent-resolver.ts +46 -24
- package/src/capabilities/local-model-resolver.ts +30 -0
- package/src/capabilities/react-surface.tsx +10 -57
- package/src/capabilities/state.ts +20 -0
- package/src/capabilities/toolkit.ts +168 -0
- package/src/components/AssistantSettings/AssistantSettings.tsx +83 -76
- package/src/components/Chat/Chat.tsx +180 -176
- package/src/components/Chat/events.ts +7 -0
- package/src/components/ChatCompanion.tsx +114 -0
- package/src/components/ChatContainer.tsx +19 -13
- package/src/components/ChatDialog.tsx +18 -14
- package/src/components/ChatProgress/ChatProgress.tsx +67 -0
- package/src/components/ChatProgress/index.ts +5 -0
- package/src/components/ChatPrompt/ChatActions.tsx +10 -24
- package/src/components/ChatPrompt/ChatOptions.tsx +225 -0
- package/src/components/ChatPrompt/ChatPresets.tsx +1 -0
- package/src/components/ChatPrompt/ChatReferences.tsx +31 -36
- package/src/components/ChatPrompt/ChatStatusIndicator.tsx +25 -22
- package/src/components/ChatPrompt/index.ts +1 -1
- package/src/components/ChatThread/ChatThread.stories.tsx +98 -112
- package/src/components/ChatThread/ChatThread.tsx +65 -29
- package/src/components/ChatThread/Link.tsx +26 -0
- package/src/components/ChatThread/reducers.ts +151 -0
- package/src/components/ChatThread/registry.tsx +184 -0
- package/src/components/ChatThread/sync.test.ts +81 -0
- package/src/components/ChatThread/sync.ts +113 -0
- package/src/components/PromptSettings.tsx +1 -0
- package/src/components/SequenceContainer.tsx +29 -30
- package/src/components/SequenceEditor/SequenceEditor.stories.tsx +11 -8
- package/src/components/SequenceEditor/SequenceEditor.tsx +3 -3
- package/src/components/TemplateEditor/TemplateEditor.stories.tsx +26 -15
- package/src/components/TemplateEditor/TemplateEditor.tsx +17 -50
- package/src/components/TemplateEditor/TemplateForm.stories.tsx +15 -10
- package/src/components/TemplateEditor/TemplateForm.tsx +4 -2
- package/src/components/TemplateEditor/handlebars-extension.ts +165 -0
- package/src/components/ToolBlock/ToolBlock.tsx +152 -0
- package/src/components/ToolBlock/ToolBlockWidget.tsx +5 -0
- package/src/components/ToolBlock/index.ts +6 -0
- package/src/components/Toolbar/Toolbar.tsx +21 -0
- package/src/components/Toolbar/index.ts +5 -0
- package/src/components/Toolbar/useChatToolbarActions.ts +126 -0
- package/src/components/Toolbox/Toolbox.stories.tsx +13 -22
- package/src/components/Toolbox/Toolbox.tsx +21 -51
- package/src/components/index.ts +3 -4
- package/src/events.ts +2 -2
- package/src/functions/analysis.ts +22 -0
- package/src/functions/index.ts +7 -0
- package/src/functions/list.ts +48 -0
- package/src/functions/load.ts +46 -0
- package/src/hooks/index.ts +7 -4
- package/src/hooks/useBlueprintRegistry.ts +94 -0
- package/src/hooks/useChatProcessor.ts +21 -98
- package/src/hooks/useChatServices.ts +30 -48
- package/src/hooks/useContextBinder.ts +18 -0
- package/src/hooks/useContextObjects.ts +58 -0
- package/src/hooks/useFlush.ts +35 -0
- package/src/hooks/useItemTypes.ts +37 -0
- package/src/hooks/useOnline.ts +10 -0
- package/src/hooks/usePresets.ts +44 -0
- package/src/hooks/useReferencesProvider.ts +11 -9
- package/src/meta.ts +4 -6
- package/src/processor/index.ts +6 -0
- package/src/{hooks → processor}/presets.ts +15 -7
- package/src/processor/processor.test.ts +81 -0
- package/src/processor/processor.ts +303 -0
- package/src/queue-logger.ts +10 -10
- package/src/stories/Chat.stories.tsx +816 -305
- package/src/stories/QueryEditor.stories.tsx +114 -0
- package/src/stories/components/BlueprintContainer.tsx +34 -0
- package/src/stories/components/ChatContainer.tsx +74 -0
- package/src/stories/components/ChessContainer.tsx +17 -0
- package/src/stories/components/CommentsContainer.tsx +25 -0
- package/src/stories/components/DebugCard.tsx +61 -0
- package/src/stories/components/ExecutionGraphContainer.tsx +30 -0
- package/src/stories/components/GraphContainer.tsx +106 -0
- package/src/stories/components/InvocationsContainer.tsx +17 -0
- package/src/stories/components/MessageContainer.tsx +22 -0
- package/src/stories/components/ProjectContainer.tsx +17 -0
- package/src/stories/components/PromptContainer.tsx +52 -0
- package/src/stories/components/ResearchInputStack.tsx +30 -0
- package/src/stories/components/ResearchOutputStack.tsx +29 -0
- package/src/stories/components/ScriptContainer.tsx +28 -0
- package/src/stories/components/TasksContainer.tsx +47 -0
- package/src/stories/components/TokenManagerContainer.tsx +14 -0
- package/src/stories/components/TriggersContainer.tsx +12 -0
- package/src/stories/components/index.ts +22 -0
- package/src/stories/components/types.ts +11 -0
- package/src/stories/testing/data.ts +135 -0
- package/src/stories/testing/index.ts +6 -0
- package/src/stories/testing/schema.ts +17 -0
- package/src/stories/testing/testing.tsx +291 -0
- package/src/testing/index.ts +3 -1
- package/src/testing/test-data.ts +248 -0
- package/src/testing/test-functions.ts +8 -3
- package/src/testing/test-generator.ts +261 -0
- package/src/testing/test-sequence.ts +2 -27
- package/src/translations.ts +31 -12
- package/src/types/Assistant.ts +61 -0
- package/src/types/AssistantAction.ts +62 -0
- package/src/types/defs.ts +5 -0
- package/src/types/index.ts +4 -1
- package/src/types/service.ts +2 -2
- package/src/vite-env.d.ts +30 -0
- package/dist/lib/browser/ChatContainer-RP3QEXYX.mjs.map +0 -7
- package/dist/lib/browser/ChatDialog-ZVLXFHEY.mjs.map +0 -7
- package/dist/lib/browser/SequenceContainer-3UDVKWPA.mjs.map +0 -7
- package/dist/lib/browser/app-graph-builder-XSEOKJLG.mjs.map +0 -7
- package/dist/lib/browser/chunk-63GG6U6D.mjs +0 -2226
- package/dist/lib/browser/chunk-63GG6U6D.mjs.map +0 -7
- package/dist/lib/browser/chunk-7W7LHTRH.mjs +0 -171
- package/dist/lib/browser/chunk-7W7LHTRH.mjs.map +0 -7
- package/dist/lib/browser/chunk-FDCJSQYF.mjs +0 -40
- package/dist/lib/browser/chunk-FDCJSQYF.mjs.map +0 -7
- package/dist/lib/browser/chunk-KFXSBNZR.mjs +0 -89
- package/dist/lib/browser/chunk-KFXSBNZR.mjs.map +0 -7
- package/dist/lib/browser/chunk-LERGF5YG.mjs +0 -108
- package/dist/lib/browser/chunk-LERGF5YG.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-MV3VSZLS.mjs +0 -75
- package/dist/lib/browser/intent-resolver-MV3VSZLS.mjs.map +0 -7
- package/dist/lib/browser/react-surface-3GYEHQRP.mjs +0 -150
- package/dist/lib/browser/react-surface-3GYEHQRP.mjs.map +0 -7
- package/dist/lib/node-esm/ChatContainer-W3W6FWV3.mjs.map +0 -7
- package/dist/lib/node-esm/ChatDialog-QW4JRKVO.mjs.map +0 -7
- package/dist/lib/node-esm/SequenceContainer-RQQH5XOC.mjs.map +0 -7
- package/dist/lib/node-esm/app-graph-builder-PANCJUHV.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-BFO3KHYL.mjs +0 -2227
- package/dist/lib/node-esm/chunk-BFO3KHYL.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-MS3PJARN.mjs +0 -109
- package/dist/lib/node-esm/chunk-MS3PJARN.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-QN2H2EHV.mjs +0 -41
- package/dist/lib/node-esm/chunk-QN2H2EHV.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-VIIMA3XQ.mjs +0 -90
- package/dist/lib/node-esm/chunk-VIIMA3XQ.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-Z7PUODRT.mjs +0 -172
- package/dist/lib/node-esm/chunk-Z7PUODRT.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-3FMC3GHC.mjs +0 -76
- package/dist/lib/node-esm/intent-resolver-3FMC3GHC.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-QDQWJ7FZ.mjs.map +0 -7
- package/dist/types/src/capability-definitions.d.ts +0 -7
- package/dist/types/src/capability-definitions.d.ts.map +0 -1
- package/dist/types/src/components/ChatPrompt/ChatOptionsMenu.d.ts +0 -9
- package/dist/types/src/components/ChatPrompt/ChatOptionsMenu.d.ts.map +0 -1
- package/dist/types/src/components/ChatThread/ChatMessage.d.ts +0 -17
- package/dist/types/src/components/ChatThread/ChatMessage.d.ts.map +0 -1
- package/dist/types/src/components/ChatThread/ToolBlock.d.ts +0 -19
- package/dist/types/src/components/ChatThread/ToolBlock.d.ts.map +0 -1
- package/dist/types/src/components/ChatThread/reducer.d.ts +0 -12
- package/dist/types/src/components/ChatThread/reducer.d.ts.map +0 -1
- package/dist/types/src/hooks/chat-processor.d.ts +0 -86
- package/dist/types/src/hooks/chat-processor.d.ts.map +0 -1
- package/dist/types/src/hooks/chat-processor.test.d.ts +0 -2
- package/dist/types/src/hooks/chat-processor.test.d.ts.map +0 -1
- package/dist/types/src/hooks/presets.d.ts.map +0 -1
- package/dist/types/src/hooks/useBlueprints.d.ts +0 -9
- package/dist/types/src/hooks/useBlueprints.d.ts.map +0 -1
- package/dist/types/src/parser/filter-generator.d.ts +0 -4
- package/dist/types/src/parser/filter-generator.d.ts.map +0 -1
- package/dist/types/src/parser/filter-generator.test.d.ts +0 -2
- package/dist/types/src/parser/filter-generator.test.d.ts.map +0 -1
- package/dist/types/src/parser/index.d.ts +0 -4
- package/dist/types/src/parser/index.d.ts.map +0 -1
- package/dist/types/src/parser/query-parser.d.ts +0 -15
- package/dist/types/src/parser/query-parser.d.ts.map +0 -1
- package/dist/types/src/parser/query-parser.test.d.ts +0 -2
- package/dist/types/src/parser/query-parser.test.d.ts.map +0 -1
- package/dist/types/src/parser/types.d.ts +0 -24
- package/dist/types/src/parser/types.d.ts.map +0 -1
- package/dist/types/src/tools/function.d.ts +0 -5
- package/dist/types/src/tools/function.d.ts.map +0 -1
- package/dist/types/src/tools/index.d.ts +0 -3
- package/dist/types/src/tools/index.d.ts.map +0 -1
- package/dist/types/src/tools/openapi.d.ts +0 -10
- package/dist/types/src/tools/openapi.d.ts.map +0 -1
- package/dist/types/src/tools/openapi.test.d.ts +0 -2
- package/dist/types/src/tools/openapi.test.d.ts.map +0 -1
- package/dist/types/src/types/schema.d.ts +0 -120
- package/dist/types/src/types/schema.d.ts.map +0 -1
- package/src/capability-definitions.ts +0 -15
- package/src/components/ChatPrompt/ChatOptionsMenu.tsx +0 -52
- package/src/components/ChatThread/ChatMessage.tsx +0 -268
- package/src/components/ChatThread/ToolBlock.tsx +0 -121
- package/src/components/ChatThread/reducer.ts +0 -52
- package/src/hooks/chat-processor.test.ts +0 -16
- package/src/hooks/chat-processor.ts +0 -314
- package/src/hooks/useBlueprints.ts +0 -57
- package/src/parser/filter-generator.test.ts +0 -32
- package/src/parser/filter-generator.ts +0 -81
- package/src/parser/index.ts +0 -7
- package/src/parser/query-parser.test.ts +0 -139
- package/src/parser/query-parser.ts +0 -199
- package/src/parser/types.ts +0 -34
- package/src/shims.d.ts +0 -8
- package/src/tools/function.ts +0 -46
- package/src/tools/index.ts +0 -6
- package/src/tools/openapi.test.ts +0 -217
- package/src/tools/openapi.ts +0 -338
- package/src/types/schema.ts +0 -108
- package/src/typings.d.ts +0 -9
- /package/dist/lib/{node-esm/BlueprintContainer-RGTMNLNX.mjs.map → browser/BlueprintContainer-TO35YXHT.mjs.map} +0 -0
|
@@ -2,370 +2,881 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import '@
|
|
6
|
-
|
|
7
|
-
import { type
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
5
|
+
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
6
|
+
import * as Schema from 'effect/Schema';
|
|
7
|
+
import React, { type FC, useCallback } from 'react';
|
|
8
|
+
|
|
9
|
+
import { ToolId } from '@dxos/ai';
|
|
10
|
+
import { EXA_API_KEY } from '@dxos/ai/testing';
|
|
11
|
+
import { Capabilities, Surface, useCapabilities } from '@dxos/app-framework';
|
|
12
|
+
import { AiContextBinder } from '@dxos/assistant';
|
|
13
13
|
import {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
14
|
+
LINEAR_BLUEPRINT,
|
|
15
|
+
RESEARCH_BLUEPRINT,
|
|
16
|
+
ResearchDataTypes,
|
|
17
|
+
ResearchGraph,
|
|
18
|
+
ResearchOn,
|
|
19
|
+
agent,
|
|
19
20
|
} from '@dxos/assistant-testing';
|
|
20
|
-
import { Blueprint } from '@dxos/blueprints';
|
|
21
|
-
import { Filter, Obj, Ref } from '@dxos/echo';
|
|
21
|
+
import { Blueprint, Prompt, Template } from '@dxos/blueprints';
|
|
22
|
+
import { Filter, Obj, Query, Ref, Relation, Type } from '@dxos/echo';
|
|
23
|
+
import { FunctionTrigger, ScriptType, exampleFunctions, serializeFunction } from '@dxos/functions';
|
|
22
24
|
import { invariant } from '@dxos/invariant';
|
|
23
25
|
import { log } from '@dxos/log';
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
26
|
+
import { Board, BoardPlugin } from '@dxos/plugin-board';
|
|
27
|
+
import { Chess, ChessPlugin } from '@dxos/plugin-chess';
|
|
28
|
+
import * as chessFunctions from '@dxos/plugin-chess/functions';
|
|
26
29
|
import { InboxPlugin } from '@dxos/plugin-inbox';
|
|
27
|
-
import {
|
|
28
|
-
import {
|
|
29
|
-
import {
|
|
30
|
-
import {
|
|
30
|
+
import { Mailbox } from '@dxos/plugin-inbox/types';
|
|
31
|
+
import { Map, MapPlugin } from '@dxos/plugin-map';
|
|
32
|
+
import { createLocationSchema } from '@dxos/plugin-map/testing';
|
|
33
|
+
import { Markdown, MarkdownPlugin } from '@dxos/plugin-markdown';
|
|
34
|
+
import { PreviewPlugin } from '@dxos/plugin-preview';
|
|
35
|
+
import { ProjectPlugin } from '@dxos/plugin-project';
|
|
36
|
+
import { ScriptPlugin, getAccessCredential } from '@dxos/plugin-script';
|
|
37
|
+
import { templates } from '@dxos/plugin-script/templates';
|
|
31
38
|
import { TablePlugin } from '@dxos/plugin-table';
|
|
39
|
+
import { ThreadPlugin } from '@dxos/plugin-thread';
|
|
40
|
+
import { TokenManagerPlugin } from '@dxos/plugin-token-manager';
|
|
32
41
|
import { TranscriptionPlugin } from '@dxos/plugin-transcription';
|
|
33
|
-
import {
|
|
34
|
-
import {
|
|
35
|
-
import {
|
|
36
|
-
import {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
import {
|
|
45
|
-
import {
|
|
46
|
-
|
|
47
|
-
import { AssistantPlugin } from '../AssistantPlugin';
|
|
48
|
-
import { Chat, TemplateEditor, type ChatPromptProps } from '../components';
|
|
49
|
-
import { type AiServicePreset, AiServicePresets } from '../hooks';
|
|
50
|
-
import { useChatProcessor, useChatServices } from '../hooks';
|
|
51
|
-
import { meta } from '../meta';
|
|
42
|
+
import { Transcript } from '@dxos/plugin-transcription/types';
|
|
43
|
+
import { useClient } from '@dxos/react-client';
|
|
44
|
+
import { useQuery, useSpace } from '@dxos/react-client/echo';
|
|
45
|
+
import { useAsyncEffect, useSignalsMemo } from '@dxos/react-ui';
|
|
46
|
+
import { withTheme } from '@dxos/react-ui/testing';
|
|
47
|
+
import { Stack, StackItem } from '@dxos/react-ui-stack';
|
|
48
|
+
import { Table } from '@dxos/react-ui-table/types';
|
|
49
|
+
import { DataType, createView } from '@dxos/schema';
|
|
50
|
+
import { render } from '@dxos/storybook-utils';
|
|
51
|
+
import { isNonNullable, trim } from '@dxos/util';
|
|
52
|
+
|
|
53
|
+
import { BLUEPRINT_KEY } from '../capabilities';
|
|
54
|
+
import { useContextBinder } from '../hooks';
|
|
55
|
+
import { addTestData, createTestMailbox, createTestTranscription, organizations, testTypes } from '../testing';
|
|
52
56
|
import { translations } from '../translations';
|
|
53
57
|
import { Assistant } from '../types';
|
|
54
58
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
),
|
|
83
|
-
)}
|
|
84
|
-
</div>
|
|
85
|
-
);
|
|
59
|
+
import {
|
|
60
|
+
BlueprintContainer,
|
|
61
|
+
ChatContainer,
|
|
62
|
+
ChessContainer,
|
|
63
|
+
CommentsContainer,
|
|
64
|
+
type ComponentProps,
|
|
65
|
+
ExecutionGraphContainer,
|
|
66
|
+
GraphContainer,
|
|
67
|
+
InvocationsContainer,
|
|
68
|
+
MessageContainer,
|
|
69
|
+
ProjectContainer,
|
|
70
|
+
PromptContainer,
|
|
71
|
+
ResearchInputStack,
|
|
72
|
+
ResearchOutputStack,
|
|
73
|
+
ScriptContainer,
|
|
74
|
+
TasksContainer,
|
|
75
|
+
TokenManagerContainer,
|
|
76
|
+
TriggersContainer,
|
|
77
|
+
} from './components';
|
|
78
|
+
import { ResearchInputQueue, accessTokensFromEnv, config, getDecorators } from './testing';
|
|
79
|
+
|
|
80
|
+
const panelClassNames = 'bg-baseSurface rounded border border-separator overflow-hidden mbe-[--stack-gap] last:mbe-0';
|
|
81
|
+
|
|
82
|
+
type StoryProps = {
|
|
83
|
+
debug?: boolean;
|
|
84
|
+
deckComponents: (FC<ComponentProps> | 'surfaces')[][];
|
|
85
|
+
blueprints?: string[];
|
|
86
86
|
};
|
|
87
87
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
//
|
|
91
|
-
|
|
92
|
-
const ChatContainer = () => {
|
|
93
|
-
const { t } = useTranslation(meta.id);
|
|
88
|
+
const DefaultStory = ({ debug = true, deckComponents, blueprints = [] }: StoryProps) => {
|
|
89
|
+
const client = useClient();
|
|
94
90
|
const space = useSpace();
|
|
95
91
|
|
|
96
|
-
const
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
92
|
+
const blueprintsDefinitions = useCapabilities(Capabilities.BlueprintDefinition);
|
|
93
|
+
useAsyncEffect(async () => {
|
|
94
|
+
if (!space) {
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
const { objects: chats = [] } = await space.db.query(Filter.type(Assistant.Chat)).run();
|
|
98
|
+
const chat = chats[0];
|
|
99
|
+
if (!chat) {
|
|
100
|
+
return;
|
|
101
101
|
}
|
|
102
|
-
}, [space]);
|
|
103
|
-
|
|
104
|
-
// TODO(burdon): Memo preset for provider.
|
|
105
|
-
const [online, setOnline] = useState(true);
|
|
106
|
-
const [preset, setPreset] = useState<AiServicePreset>();
|
|
107
|
-
const presets = useMemo(
|
|
108
|
-
() => AiServicePresets.filter((preset) => online === (preset.provider === 'dxos-remote')),
|
|
109
|
-
[online],
|
|
110
|
-
);
|
|
111
|
-
useEffect(() => {
|
|
112
|
-
setPreset(presets[0]);
|
|
113
|
-
}, [presets]);
|
|
114
|
-
|
|
115
|
-
const services = useChatServices({ space });
|
|
116
|
-
const blueprintRegistry = useMemo(() => new Blueprint.Registry([DESIGN_BLUEPRINT, PLANNING_BLUEPRINT]), []);
|
|
117
|
-
const processor = useChatProcessor({
|
|
118
|
-
preset,
|
|
119
|
-
chat,
|
|
120
|
-
space,
|
|
121
|
-
services,
|
|
122
|
-
blueprintRegistry,
|
|
123
|
-
noPluginArtifacts: true,
|
|
124
|
-
});
|
|
125
|
-
|
|
126
|
-
const handleChangePreset = useCallback<NonNullable<ChatPromptProps['onChangePreset']>>(
|
|
127
|
-
(id) => {
|
|
128
|
-
const preset = presets.find((preset) => preset.id === id);
|
|
129
|
-
if (preset) {
|
|
130
|
-
setPreset(preset);
|
|
131
|
-
}
|
|
132
|
-
},
|
|
133
|
-
[presets],
|
|
134
|
-
);
|
|
135
|
-
|
|
136
|
-
const handleNewChat = useCallback(() => {
|
|
137
|
-
invariant(space);
|
|
138
|
-
const chat = space.db.add(
|
|
139
|
-
Obj.make(Assistant.Chat, {
|
|
140
|
-
queue: Ref.fromDXN(space.queues.create().dxn),
|
|
141
|
-
}),
|
|
142
|
-
);
|
|
143
|
-
setChat(chat);
|
|
144
|
-
}, [space]);
|
|
145
|
-
|
|
146
|
-
const handleBranchChat = useCallback(() => {}, [space]);
|
|
147
|
-
|
|
148
|
-
if (!chat || !processor) {
|
|
149
|
-
return null;
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
return (
|
|
153
|
-
<Chat.Root chat={chat} processor={processor} onEvent={(event) => log.info('event', { event })}>
|
|
154
|
-
<Toolbar.Root classNames='border-b border-subduedSeparator'>
|
|
155
|
-
<Toolbar.IconButton icon='ph--plus--regular' iconOnly label={t('button new thread')} onClick={handleNewChat} />
|
|
156
|
-
<Toolbar.IconButton
|
|
157
|
-
disabled
|
|
158
|
-
icon='ph--git-branch--regular'
|
|
159
|
-
iconOnly
|
|
160
|
-
label={t('button branch thread')}
|
|
161
|
-
onClick={handleBranchChat}
|
|
162
|
-
/>
|
|
163
|
-
</Toolbar.Root>
|
|
164
|
-
<Chat.Thread />
|
|
165
|
-
<div className='p-4'>
|
|
166
|
-
<Chat.Prompt
|
|
167
|
-
classNames='p-2 border border-subduedSeparator rounded focus-within:outline focus-within:border-transparent outline-primary-500'
|
|
168
|
-
expandable
|
|
169
|
-
online={online}
|
|
170
|
-
presets={presets.map(({ id, model, label }) => ({ id, label: label ?? model }))}
|
|
171
|
-
preset={preset?.id}
|
|
172
|
-
onChangeOnline={setOnline}
|
|
173
|
-
onChangePreset={handleChangePreset}
|
|
174
|
-
/>
|
|
175
|
-
</div>
|
|
176
|
-
</Chat.Root>
|
|
177
|
-
);
|
|
178
|
-
};
|
|
179
102
|
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
103
|
+
// Add blueprints to context.
|
|
104
|
+
const binder = new AiContextBinder(await chat.queue.load());
|
|
105
|
+
const registry = new Blueprint.Registry(blueprintsDefinitions);
|
|
106
|
+
const blueprintObjects = blueprints
|
|
107
|
+
.map((key) => {
|
|
108
|
+
const blueprint = registry.getByKey(key);
|
|
109
|
+
if (blueprint) {
|
|
110
|
+
return space.db.add(Obj.clone(blueprint));
|
|
111
|
+
}
|
|
112
|
+
})
|
|
113
|
+
.filter(isNonNullable);
|
|
114
|
+
await binder.bind({ blueprints: blueprintObjects.map((blueprint) => Ref.make(blueprint)) });
|
|
115
|
+
}, [space, blueprints, blueprintsDefinitions]);
|
|
116
|
+
|
|
117
|
+
const handleEvent = useCallback<NonNullable<ComponentProps['onEvent']>>((event) => {
|
|
118
|
+
log.info('event', { event });
|
|
119
|
+
switch (event) {
|
|
120
|
+
case 'reset': {
|
|
121
|
+
void client?.reset().then(() => {
|
|
122
|
+
document.location.reload();
|
|
123
|
+
});
|
|
124
|
+
break;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}, []);
|
|
187
128
|
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
<Editor
|
|
194
|
-
id={document.id}
|
|
195
|
-
text={document.content.target}
|
|
196
|
-
classNames='h-full p-2 overflow-hidden'
|
|
197
|
-
extensions={[
|
|
198
|
-
// TODO(burdon): Create util.
|
|
199
|
-
createDataExtensions({ id: document.id, text: createDocAccessor(document.content.target, ['content']) }),
|
|
200
|
-
createBasicExtensions({ readOnly: false }),
|
|
201
|
-
createMarkdownExtensions({ themeMode }),
|
|
202
|
-
createThemeExtensions({ themeMode }),
|
|
203
|
-
outliner(),
|
|
204
|
-
]}
|
|
205
|
-
/>
|
|
206
|
-
</>
|
|
129
|
+
const chats = useQuery(space, Filter.type(Assistant.Chat));
|
|
130
|
+
const binder = useContextBinder(chats.at(-1));
|
|
131
|
+
const objects = useSignalsMemo(
|
|
132
|
+
() => binder?.objects.value.map((ref) => ref.target).filter(isNonNullable) ?? [],
|
|
133
|
+
[binder],
|
|
207
134
|
);
|
|
208
|
-
};
|
|
209
135
|
|
|
210
|
-
|
|
211
|
-
const BlueprintContainer = () => {
|
|
212
|
-
const space = useSpace();
|
|
213
|
-
const [blueprint] = useQuery(space, Filter.type(Blueprint.Blueprint));
|
|
214
|
-
if (!blueprint?.instructions) {
|
|
136
|
+
if (!space) {
|
|
215
137
|
return null;
|
|
216
138
|
}
|
|
217
139
|
|
|
218
140
|
return (
|
|
219
|
-
<
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
141
|
+
<Stack
|
|
142
|
+
orientation='horizontal'
|
|
143
|
+
size='split'
|
|
144
|
+
rail={false}
|
|
145
|
+
itemsCount={deckComponents.length}
|
|
146
|
+
classNames='absolute inset-0 gap-[--stack-gap]'
|
|
147
|
+
>
|
|
148
|
+
{deckComponents.map((plankComponents, i) => {
|
|
149
|
+
const Components: FC<ComponentProps>[] = plankComponents.filter((item) => item !== 'surfaces');
|
|
150
|
+
const renderSurfaces = plankComponents.includes('surfaces');
|
|
151
|
+
let j = 0;
|
|
152
|
+
return (
|
|
153
|
+
<StackItem.Root order={i + 1} item={{ id: `${i}` }} key={i}>
|
|
154
|
+
<Stack
|
|
155
|
+
orientation='vertical'
|
|
156
|
+
size={i > 0 ? 'contain' : 'split'}
|
|
157
|
+
rail={false}
|
|
158
|
+
itemsCount={plankComponents.length + (i > 0 ? objects.length : 0)}
|
|
159
|
+
>
|
|
160
|
+
{Components.map((Component) => {
|
|
161
|
+
const item = (
|
|
162
|
+
<StackItem.Root key={j} order={j + 1} item={{ id: `${i}:${j}` }} classNames={panelClassNames}>
|
|
163
|
+
<Component space={space} debug={debug} onEvent={handleEvent} />
|
|
164
|
+
</StackItem.Root>
|
|
165
|
+
);
|
|
166
|
+
j += 1;
|
|
167
|
+
return item;
|
|
168
|
+
})}
|
|
169
|
+
|
|
170
|
+
{renderSurfaces &&
|
|
171
|
+
objects.map((object, index) => {
|
|
172
|
+
const k = index + j;
|
|
173
|
+
return (
|
|
174
|
+
<StackItem.Root key={k} order={k + 1} item={{ id: `${k}` }} classNames={panelClassNames}>
|
|
175
|
+
{debug && (
|
|
176
|
+
<div role='heading' className='flex gap-2 items-center text-xs justify-center text-subdued'>
|
|
177
|
+
<span>{Obj.getTypename(object)}</span>
|
|
178
|
+
<span>{object.id}</span>
|
|
179
|
+
</div>
|
|
180
|
+
)}
|
|
181
|
+
<Surface role='section' limit={1} data={{ subject: object }} />
|
|
182
|
+
</StackItem.Root>
|
|
183
|
+
);
|
|
184
|
+
})}
|
|
185
|
+
</Stack>
|
|
186
|
+
</StackItem.Root>
|
|
187
|
+
);
|
|
188
|
+
})}
|
|
189
|
+
</Stack>
|
|
225
190
|
);
|
|
226
191
|
};
|
|
227
192
|
|
|
228
|
-
|
|
229
|
-
// Configuration
|
|
230
|
-
//
|
|
231
|
-
|
|
232
|
-
const storybook = {
|
|
193
|
+
const storybook: Meta<typeof DefaultStory> = {
|
|
233
194
|
title: 'plugins/plugin-assistant/Chat',
|
|
234
195
|
render: render(DefaultStory),
|
|
235
|
-
decorators: [],
|
|
196
|
+
decorators: [withTheme],
|
|
236
197
|
parameters: {
|
|
237
198
|
translations,
|
|
238
199
|
controls: { disable: true },
|
|
239
200
|
},
|
|
240
|
-
}
|
|
201
|
+
};
|
|
241
202
|
|
|
242
203
|
export default storybook;
|
|
243
204
|
|
|
244
205
|
type Story = StoryObj<typeof storybook>;
|
|
245
206
|
|
|
246
207
|
//
|
|
247
|
-
//
|
|
208
|
+
// Stories
|
|
248
209
|
//
|
|
249
210
|
|
|
250
|
-
const
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
211
|
+
const MARKDOWN_DOCUMENT = trim`
|
|
212
|
+
# Hello, world!
|
|
213
|
+
|
|
214
|
+
This is a test document that contains Markdown content. Markdown is a lightweight markup language for writing formatted text in plain text form. Its goal is to be easy to read and write in raw form, easy to convert to HTML.
|
|
215
|
+
|
|
216
|
+
Markdown’s simplicity makes it highly adaptable: it can be written in any text editor, stored in plain .md files, and rendered into HTML, PDF, or other formats with converters. Because of this portability, it’s widely used in software documentation, static site generators, technical blogging, and collaborative platforms like GitHub and Notion.
|
|
217
|
+
|
|
218
|
+
Many applications extend the core syntax with extras (e.g., tables, task lists, math notation), but the core idea remains the same—clean, minimal markup that stays readable even without rendering.
|
|
219
|
+
`;
|
|
220
|
+
|
|
221
|
+
const STYLE_GUIDE = trim`
|
|
222
|
+
# Style Guide
|
|
223
|
+
- Use short, simple sentences.
|
|
224
|
+
- Organize content with headings and bullet points.
|
|
225
|
+
- Avoid jargon and explain technical terms.
|
|
226
|
+
- Use active voice whenever possible.
|
|
227
|
+
- Highlight key points in bold.
|
|
228
|
+
- Keep paragraphs brief and focused on one idea.
|
|
229
|
+
- Proofread for clarity and correctness.
|
|
230
|
+
`;
|
|
231
|
+
|
|
232
|
+
const addSpellingMistakes = (text: string, n: number): string => {
|
|
233
|
+
const words = text.split(' ');
|
|
234
|
+
for (let i = 0; i < n; i++) {
|
|
235
|
+
const idx = Math.floor(Math.random() * words.length);
|
|
236
|
+
const word = words[idx];
|
|
237
|
+
const charIdx = Math.floor(Math.random() * word.length);
|
|
238
|
+
const typoChar = String.fromCharCode(word.charCodeAt(charIdx) + 1);
|
|
239
|
+
words[idx] = word.slice(0, charIdx) + typoChar + word.slice(charIdx + 1);
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
return words.join(' ');
|
|
243
|
+
};
|
|
244
|
+
|
|
245
|
+
export const Default: Story = {
|
|
246
|
+
decorators: getDecorators({
|
|
247
|
+
plugins: [MarkdownPlugin()],
|
|
248
|
+
config: config.remote,
|
|
249
|
+
}),
|
|
250
|
+
args: {
|
|
251
|
+
deckComponents: [[ChatContainer]],
|
|
252
|
+
},
|
|
253
|
+
};
|
|
254
|
+
|
|
255
|
+
export const WithWebSearch: Story = {
|
|
256
|
+
decorators: getDecorators({
|
|
257
|
+
plugins: [MarkdownPlugin()],
|
|
258
|
+
config: config.remote,
|
|
259
|
+
}),
|
|
260
|
+
args: {
|
|
261
|
+
deckComponents: [[ChatContainer]],
|
|
262
|
+
blueprints: ['dxos.org/blueprint/web-search'],
|
|
263
|
+
},
|
|
264
|
+
};
|
|
265
|
+
|
|
266
|
+
// Test with prompt: Propose changes to my document based on the style guide.
|
|
267
|
+
export const WithDocument: Story = {
|
|
268
|
+
decorators: getDecorators({
|
|
269
|
+
plugins: [MarkdownPlugin(), ThreadPlugin()],
|
|
270
|
+
config: config.remote, // TODO(burdon): Issue making persistent.
|
|
271
|
+
onInit: async ({ space }) => {
|
|
272
|
+
space.db.add(
|
|
273
|
+
Markdown.makeDocument({
|
|
274
|
+
name: 'My Document',
|
|
275
|
+
content: addSpellingMistakes(MARKDOWN_DOCUMENT, 2),
|
|
276
|
+
}),
|
|
277
|
+
);
|
|
278
|
+
space.db.add(
|
|
279
|
+
Markdown.makeDocument({
|
|
280
|
+
name: 'Style Guide',
|
|
281
|
+
content: STYLE_GUIDE,
|
|
282
|
+
}),
|
|
283
|
+
);
|
|
284
|
+
},
|
|
285
|
+
onChatCreated: async ({ space, binder }) => {
|
|
286
|
+
const { objects } = await space.db.query(Filter.type(Markdown.Document)).run();
|
|
287
|
+
await binder.bind({ objects: objects.map((object) => Ref.make(object)) });
|
|
260
288
|
},
|
|
289
|
+
}),
|
|
290
|
+
args: {
|
|
291
|
+
deckComponents: [[ChatContainer], ['surfaces', CommentsContainer]],
|
|
292
|
+
blueprints: [BLUEPRINT_KEY, 'dxos.org/blueprint/markdown'],
|
|
261
293
|
},
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
const getDecorators = ({
|
|
265
|
-
config,
|
|
266
|
-
plugins = [],
|
|
267
|
-
blueprints = [],
|
|
268
|
-
context = false,
|
|
269
|
-
}: {
|
|
270
|
-
config: Config;
|
|
271
|
-
plugins?: Plugin[];
|
|
272
|
-
blueprints?: Blueprint.Blueprint[];
|
|
273
|
-
context?: boolean;
|
|
274
|
-
}) => [
|
|
275
|
-
withPluginManager({
|
|
276
|
-
fireEvents: [Events.SetupArtifactDefinition],
|
|
277
|
-
plugins: [
|
|
278
|
-
ClientPlugin({
|
|
279
|
-
config,
|
|
280
|
-
types: [Markdown.Document, Assistant.Chat, Blueprint.Blueprint],
|
|
281
|
-
onClientInitialized: async (_, client) => {
|
|
282
|
-
await client.halo.createIdentity();
|
|
283
|
-
await client.spaces.waitUntilReady();
|
|
284
|
-
const space = client.spaces.default;
|
|
285
|
-
// ISSUE(burdon): Should not require this.
|
|
286
|
-
// ERROR: invariant violation: Database was not initialized with root object.
|
|
287
|
-
await space.waitUntilReady();
|
|
288
|
-
|
|
289
|
-
const chat = space.db.add(
|
|
290
|
-
// TODO(burdon): Assistant.makeChat()
|
|
291
|
-
Obj.make(Assistant.Chat, {
|
|
292
|
-
queue: Ref.fromDXN(space.queues.create().dxn),
|
|
293
|
-
}),
|
|
294
|
-
);
|
|
295
|
-
const binder = new ContextBinder(await chat.queue.load());
|
|
296
|
-
const doc = space.db.add(Markdown.makeDocument({ name: 'Tasks' }));
|
|
297
|
-
if (context) {
|
|
298
|
-
await binder.bind({ objects: [Ref.make(doc)] });
|
|
299
|
-
}
|
|
300
|
-
|
|
301
|
-
for (const blueprint of blueprints) {
|
|
302
|
-
// Clone blueprints and bind to conversation.
|
|
303
|
-
// TODO(dmaretskyi): This should be done by Obj.clone.
|
|
304
|
-
const { id: _id, ...data } = blueprint;
|
|
305
|
-
const obj = space.db.add(Obj.make(Blueprint.Blueprint, data));
|
|
306
|
-
await binder.bind({ blueprints: [Ref.make(obj)] });
|
|
307
|
-
}
|
|
308
|
-
},
|
|
309
|
-
}),
|
|
310
|
-
IntentPlugin(),
|
|
311
|
-
SettingsPlugin(),
|
|
312
|
-
SpacePlugin(),
|
|
294
|
+
};
|
|
313
295
|
|
|
314
|
-
|
|
315
|
-
|
|
296
|
+
export const WithBlueprints: Story = {
|
|
297
|
+
decorators: getDecorators({
|
|
298
|
+
plugins: [InboxPlugin(), MarkdownPlugin(), TablePlugin()],
|
|
299
|
+
config: config.remote,
|
|
300
|
+
onInit: async ({ space }) => {
|
|
301
|
+
space.db.add(Markdown.makeDocument({ name: 'Tasks' }));
|
|
302
|
+
},
|
|
303
|
+
onChatCreated: async ({ space, binder }) => {
|
|
304
|
+
const { objects } = await space.db.query(Filter.type(Markdown.Document)).run();
|
|
305
|
+
await binder.bind({ objects: objects.map((object) => Ref.make(object)) });
|
|
306
|
+
},
|
|
307
|
+
}),
|
|
308
|
+
args: {
|
|
309
|
+
deckComponents: [[ChatContainer], [TasksContainer, BlueprintContainer]],
|
|
310
|
+
},
|
|
311
|
+
};
|
|
316
312
|
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
313
|
+
export const WithChess: Story = {
|
|
314
|
+
decorators: getDecorators({
|
|
315
|
+
plugins: [ChessPlugin()],
|
|
316
|
+
config: config.remote,
|
|
317
|
+
types: [Chess.Game],
|
|
318
|
+
onInit: async ({ space }) => {
|
|
319
|
+
// TODO(burdon): Add player DID (for user and assistant).
|
|
320
|
+
space.db.add(
|
|
321
|
+
Chess.makeGame({
|
|
322
|
+
name: 'Challenge',
|
|
323
|
+
pgn: [
|
|
324
|
+
'1. e4 e5',
|
|
325
|
+
'2. Nf3 Nc6',
|
|
326
|
+
'3. Bc4 Bc5',
|
|
327
|
+
'4. c3 Nf6',
|
|
328
|
+
'5. d4 exd4',
|
|
329
|
+
'6. cxd4 Bb4+',
|
|
330
|
+
'7. Nc3 d5',
|
|
331
|
+
'8. exd5 Nxd5',
|
|
332
|
+
'9. O-O Be6',
|
|
333
|
+
'10. Qb3 Na5',
|
|
334
|
+
'11. Qa4+ c6',
|
|
335
|
+
'12. Bxd5 Bxc3',
|
|
336
|
+
'13. Bxe6 fxe6',
|
|
337
|
+
'*',
|
|
338
|
+
].join(' '),
|
|
339
|
+
}),
|
|
340
|
+
);
|
|
341
|
+
},
|
|
342
|
+
onChatCreated: async ({ space, binder }) => {
|
|
343
|
+
const { objects } = await space.db.query(Filter.type(Chess.Game)).run();
|
|
344
|
+
await binder.bind({ objects: objects.map((object) => Ref.make(object)) });
|
|
345
|
+
},
|
|
320
346
|
}),
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
347
|
+
args: {
|
|
348
|
+
deckComponents: [[ChatContainer], ['surfaces']],
|
|
349
|
+
blueprints: [BLUEPRINT_KEY, 'dxos.org/blueprint/chess'],
|
|
350
|
+
},
|
|
351
|
+
};
|
|
352
|
+
|
|
353
|
+
// Test with prompt: Summarize my mailbox and write the summary in a new document.
|
|
354
|
+
export const WithMail: Story = {
|
|
355
|
+
decorators: getDecorators({
|
|
356
|
+
plugins: [InboxPlugin(), MarkdownPlugin(), ThreadPlugin()],
|
|
357
|
+
config: config.remote,
|
|
358
|
+
types: [Mailbox.Mailbox],
|
|
359
|
+
onInit: async ({ space }) => {
|
|
360
|
+
const mailbox = space.db.add(Mailbox.make({ name: 'Mailbox', space }));
|
|
361
|
+
const queue = space.queues.get<DataType.Message>(mailbox.queue.dxn);
|
|
362
|
+
const messages = createTestMailbox();
|
|
363
|
+
await queue.append(messages);
|
|
364
|
+
},
|
|
365
|
+
onChatCreated: async ({ space, binder }) => {
|
|
366
|
+
const { objects } = await space.db.query(Filter.type(Mailbox.Mailbox)).run();
|
|
367
|
+
await binder.bind({ objects: objects.map((object) => Ref.make(object)) });
|
|
368
|
+
},
|
|
325
369
|
}),
|
|
326
|
-
|
|
370
|
+
args: {
|
|
371
|
+
deckComponents: [[ChatContainer], ['surfaces', MessageContainer]],
|
|
372
|
+
blueprints: [BLUEPRINT_KEY, 'dxos.org/blueprint/inbox', 'dxos.org/blueprint/markdown'],
|
|
373
|
+
},
|
|
374
|
+
};
|
|
327
375
|
|
|
328
|
-
//
|
|
329
|
-
|
|
330
|
-
|
|
376
|
+
// Test with prompt: Sync my email.
|
|
377
|
+
export const WithGmail: Story = {
|
|
378
|
+
decorators: getDecorators({
|
|
379
|
+
plugins: [InboxPlugin(), TokenManagerPlugin()],
|
|
380
|
+
config: config.remote,
|
|
381
|
+
types: [Mailbox.Mailbox],
|
|
382
|
+
onInit: async ({ space }) => {
|
|
383
|
+
space.db.add(Mailbox.make({ name: 'Mailbox', space }));
|
|
384
|
+
},
|
|
385
|
+
onChatCreated: async ({ space, binder }) => {
|
|
386
|
+
const { objects } = await space.db.query(Filter.type(Mailbox.Mailbox)).run();
|
|
387
|
+
await binder.bind({ objects: objects.map((object) => Ref.make(object)) });
|
|
388
|
+
},
|
|
389
|
+
}),
|
|
390
|
+
args: {
|
|
391
|
+
deckComponents: [[ChatContainer], ['surfaces', MessageContainer, TokenManagerContainer]],
|
|
392
|
+
blueprints: [BLUEPRINT_KEY, 'dxos.org/blueprint/inbox'],
|
|
393
|
+
},
|
|
394
|
+
};
|
|
395
|
+
|
|
396
|
+
// Test with prompt: Create 10 locations.
|
|
397
|
+
export const WithMap: Story = {
|
|
398
|
+
decorators: getDecorators({
|
|
399
|
+
plugins: [MapPlugin(), TablePlugin()],
|
|
400
|
+
config: config.remote,
|
|
401
|
+
types: [DataType.View, Map.Map, Table.Table],
|
|
402
|
+
onInit: async ({ space }) => {
|
|
403
|
+
const [schema] = await space.db.schemaRegistry.register([createLocationSchema()]);
|
|
404
|
+
const { view: tableView } = await Table.makeView({ name: 'Table', space, typename: schema.typename });
|
|
405
|
+
const { view: mapView } = await Map.makeView({
|
|
406
|
+
name: 'Map',
|
|
407
|
+
space,
|
|
408
|
+
typename: schema.typename,
|
|
409
|
+
pivotFieldName: 'location',
|
|
410
|
+
});
|
|
411
|
+
space.db.add(tableView);
|
|
412
|
+
space.db.add(mapView);
|
|
413
|
+
},
|
|
414
|
+
onChatCreated: async ({ space, binder }) => {
|
|
415
|
+
const { objects } = await space.db.query(Filter.type(DataType.View)).run();
|
|
416
|
+
await binder.bind({ objects: objects.map((object) => Ref.make(object)) });
|
|
417
|
+
},
|
|
418
|
+
}),
|
|
419
|
+
args: {
|
|
420
|
+
deckComponents: [[ChatContainer], ['surfaces']],
|
|
421
|
+
blueprints: [BLUEPRINT_KEY, 'dxos.org/blueprint/map'],
|
|
422
|
+
},
|
|
423
|
+
};
|
|
331
424
|
|
|
332
|
-
export const
|
|
425
|
+
export const WithTrip: Story = {
|
|
333
426
|
decorators: getDecorators({
|
|
334
|
-
|
|
427
|
+
plugins: [MarkdownPlugin(), MapPlugin()],
|
|
428
|
+
config: config.remote,
|
|
429
|
+
types: [Map.Map],
|
|
430
|
+
onInit: async ({ space }) => {
|
|
431
|
+
// TODO(burdon): Table.
|
|
432
|
+
space.db.add(Map.make({ name: 'Trip' }));
|
|
433
|
+
space.db.add(
|
|
434
|
+
Markdown.makeDocument({
|
|
435
|
+
name: 'Itinerary',
|
|
436
|
+
content: trim`
|
|
437
|
+
# Itinerary
|
|
438
|
+
|
|
439
|
+
## Day 1
|
|
440
|
+
- Visit the Sagrada Familia
|
|
441
|
+
- Visit the Park Güell
|
|
442
|
+
- Visit the Casa Batlló
|
|
443
|
+
|
|
444
|
+
## Day 2
|
|
445
|
+
- Visit the Eiffel Tower
|
|
446
|
+
- Visit the Louvre
|
|
447
|
+
- Visit the Musée d'Orsay
|
|
448
|
+
`,
|
|
449
|
+
}),
|
|
450
|
+
);
|
|
451
|
+
space.db.add(
|
|
452
|
+
Markdown.makeDocument({
|
|
453
|
+
name: 'Barcelona',
|
|
454
|
+
content: trim`
|
|
455
|
+
# Barcelona
|
|
456
|
+
|
|
457
|
+
Barcelona is the capital and most populous city of Catalonia, an autonomous community in northeastern Spain.
|
|
458
|
+
It is located on the Mediterranean coast, on the banks of the Llobregat River, in the comarca of the Baix Llobregat.
|
|
459
|
+
The city is known for its rich history, vibrant culture, and stunning architecture, including the Sagrada Familia, Park Güell, and Casa Batlló.
|
|
460
|
+
`,
|
|
461
|
+
}),
|
|
462
|
+
);
|
|
463
|
+
},
|
|
464
|
+
onChatCreated: async ({ space, binder }) => {
|
|
465
|
+
const { objects } = await space.db.query(Filter.or(Filter.type(Map.Map), Filter.type(Markdown.Document))).run();
|
|
466
|
+
await binder.bind({ objects: objects.map((object) => Ref.make(object)) });
|
|
467
|
+
},
|
|
335
468
|
}),
|
|
336
469
|
args: {
|
|
337
|
-
|
|
470
|
+
deckComponents: [[ChatContainer], ['surfaces']],
|
|
338
471
|
},
|
|
339
|
-
}
|
|
472
|
+
};
|
|
340
473
|
|
|
341
|
-
export const
|
|
474
|
+
export const WithBoard: Story = {
|
|
342
475
|
decorators: getDecorators({
|
|
343
|
-
|
|
344
|
-
|
|
476
|
+
plugins: [BoardPlugin()],
|
|
477
|
+
config: config.remote,
|
|
478
|
+
types: [Board.Board],
|
|
479
|
+
onInit: async ({ space }) => {
|
|
480
|
+
space.db.add(Board.makeBoard());
|
|
481
|
+
},
|
|
482
|
+
onChatCreated: async ({ space, binder }) => {
|
|
483
|
+
const { objects } = await space.db.query(Filter.type(Board.Board)).run();
|
|
484
|
+
await binder.bind({ objects: objects.map((object) => Ref.make(object)) });
|
|
485
|
+
},
|
|
486
|
+
}),
|
|
487
|
+
args: {
|
|
488
|
+
debug: true,
|
|
489
|
+
deckComponents: [[ChatContainer], ['surfaces']],
|
|
490
|
+
},
|
|
491
|
+
};
|
|
492
|
+
|
|
493
|
+
export const WithResearch: Story = {
|
|
494
|
+
decorators: getDecorators({
|
|
495
|
+
plugins: [MarkdownPlugin(), TablePlugin(), ThreadPlugin()],
|
|
496
|
+
config: config.remote,
|
|
497
|
+
types: [...ResearchDataTypes, ResearchGraph],
|
|
498
|
+
accessTokens: [Obj.make(DataType.AccessToken, { source: 'exa.ai', token: EXA_API_KEY })],
|
|
499
|
+
}),
|
|
500
|
+
args: {
|
|
501
|
+
deckComponents: [[ChatContainer], [GraphContainer, ExecutionGraphContainer]],
|
|
502
|
+
blueprints: [RESEARCH_BLUEPRINT.key],
|
|
503
|
+
},
|
|
504
|
+
};
|
|
505
|
+
|
|
506
|
+
export const WithSearch: Story = {
|
|
507
|
+
decorators: getDecorators({
|
|
508
|
+
config: config.remote,
|
|
509
|
+
types: testTypes,
|
|
510
|
+
onInit: async ({ space }) => {
|
|
511
|
+
await addTestData(space);
|
|
512
|
+
},
|
|
513
|
+
}),
|
|
514
|
+
args: {
|
|
515
|
+
deckComponents: [[ChatContainer], [GraphContainer]],
|
|
516
|
+
},
|
|
517
|
+
};
|
|
518
|
+
|
|
519
|
+
export const WithTranscription: Story = {
|
|
520
|
+
decorators: getDecorators({
|
|
521
|
+
plugins: [TranscriptionPlugin(), PreviewPlugin()],
|
|
522
|
+
config: config.remote,
|
|
523
|
+
types: [Transcript.Transcript],
|
|
524
|
+
onInit: async ({ space }) => {
|
|
525
|
+
const queue = space.queues.create();
|
|
526
|
+
const messages = createTestTranscription();
|
|
527
|
+
await queue.append(messages);
|
|
528
|
+
space.db.add(Transcript.makeTranscript(queue.dxn));
|
|
529
|
+
},
|
|
530
|
+
onChatCreated: async ({ space, binder }) => {
|
|
531
|
+
const { objects } = await space.db.query(Filter.type(Transcript.Transcript)).run();
|
|
532
|
+
await binder.bind({ objects: objects.map((object) => Ref.make(object)) });
|
|
533
|
+
},
|
|
534
|
+
}),
|
|
535
|
+
args: {
|
|
536
|
+
deckComponents: [[ChatContainer], ['surfaces']],
|
|
537
|
+
blueprints: [BLUEPRINT_KEY, 'dxos.org/blueprint/transcription'],
|
|
538
|
+
},
|
|
539
|
+
};
|
|
540
|
+
|
|
541
|
+
export const WithLinearSync: Story = {
|
|
542
|
+
decorators: getDecorators({
|
|
543
|
+
plugins: [],
|
|
544
|
+
config: config.remote,
|
|
545
|
+
types: [DataType.Task, DataType.Person, DataType.Project],
|
|
546
|
+
accessTokens: accessTokensFromEnv({
|
|
547
|
+
'linear.app': import.meta.env.VITE_LINEAR_API_KEY,
|
|
548
|
+
}),
|
|
549
|
+
}),
|
|
550
|
+
args: {
|
|
551
|
+
deckComponents: [[ChatContainer], [GraphContainer]],
|
|
552
|
+
blueprints: [LINEAR_BLUEPRINT.key],
|
|
553
|
+
},
|
|
554
|
+
};
|
|
555
|
+
|
|
556
|
+
export const WithTriggers: Story = {
|
|
557
|
+
decorators: getDecorators({
|
|
558
|
+
plugins: [],
|
|
559
|
+
config: config.remote,
|
|
560
|
+
onInit: async ({ space }) => {
|
|
561
|
+
space.db.add(
|
|
562
|
+
Obj.make(FunctionTrigger, {
|
|
563
|
+
function: Ref.make(serializeFunction(exampleFunctions.reply)),
|
|
564
|
+
enabled: true,
|
|
565
|
+
spec: {
|
|
566
|
+
kind: 'timer',
|
|
567
|
+
cron: '*/5 * * * * *', // Every 5 seconds
|
|
568
|
+
},
|
|
569
|
+
}),
|
|
570
|
+
);
|
|
571
|
+
},
|
|
345
572
|
}),
|
|
346
573
|
args: {
|
|
347
|
-
|
|
574
|
+
deckComponents: [[ChatContainer], [TriggersContainer, InvocationsContainer]],
|
|
575
|
+
blueprints: [],
|
|
348
576
|
},
|
|
349
|
-
}
|
|
577
|
+
};
|
|
350
578
|
|
|
351
|
-
export const
|
|
579
|
+
export const WithChessTrigger: Story = {
|
|
352
580
|
decorators: getDecorators({
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
581
|
+
plugins: [ChessPlugin()],
|
|
582
|
+
config: config.remote,
|
|
583
|
+
types: [Chess.Game],
|
|
584
|
+
onInit: async ({ space }) => {
|
|
585
|
+
// TODO(burdon): Add player DID (for user and assistant).
|
|
586
|
+
space.db.add(
|
|
587
|
+
Chess.makeGame({
|
|
588
|
+
name: 'Challenge',
|
|
589
|
+
pgn: [
|
|
590
|
+
'1. e4 e5',
|
|
591
|
+
'2. Nf3 Nc6',
|
|
592
|
+
'3. Bc4 Bc5',
|
|
593
|
+
'4. c3 Nf6',
|
|
594
|
+
'5. d4 exd4',
|
|
595
|
+
'6. cxd4 Bb4+',
|
|
596
|
+
'7. Nc3 d5',
|
|
597
|
+
'8. exd5 Nxd5',
|
|
598
|
+
'9. O-O Be6',
|
|
599
|
+
'10. Qb3 Na5',
|
|
600
|
+
'11. Qa4+ c6',
|
|
601
|
+
'12. Bxd5 Bxc3',
|
|
602
|
+
'13. Bxe6 fxe6',
|
|
603
|
+
'*',
|
|
604
|
+
].join(' '),
|
|
605
|
+
}),
|
|
606
|
+
);
|
|
607
|
+
|
|
608
|
+
space.db.add(
|
|
609
|
+
Obj.make(FunctionTrigger, {
|
|
610
|
+
function: Ref.make(serializeFunction(chessFunctions.play)),
|
|
611
|
+
enabled: true,
|
|
612
|
+
spec: {
|
|
613
|
+
kind: 'subscription',
|
|
614
|
+
query: {
|
|
615
|
+
string: 'Query.select(Filter.type(Chess.Game))',
|
|
616
|
+
ast: Query.select(Filter.type(Chess.Game)).ast,
|
|
617
|
+
},
|
|
618
|
+
},
|
|
619
|
+
input: {
|
|
620
|
+
id: '{{event.changedObjectId}}',
|
|
621
|
+
side: 'black', // NOTE: Removing it makes the bot play itself.
|
|
622
|
+
},
|
|
623
|
+
}),
|
|
624
|
+
);
|
|
625
|
+
},
|
|
357
626
|
}),
|
|
358
627
|
args: {
|
|
359
|
-
|
|
628
|
+
deckComponents: [[ChessContainer], [TriggersContainer, InvocationsContainer]],
|
|
629
|
+
blueprints: [],
|
|
360
630
|
},
|
|
361
|
-
}
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
631
|
+
};
|
|
632
|
+
|
|
633
|
+
export const WithResearchQueue: Story = {
|
|
634
|
+
decorators: getDecorators({
|
|
635
|
+
plugins: [],
|
|
636
|
+
config: config.remote,
|
|
637
|
+
types: [...ResearchDataTypes, ResearchGraph, ResearchInputQueue],
|
|
638
|
+
accessTokens: [Obj.make(DataType.AccessToken, { source: 'exa.ai', token: EXA_API_KEY })],
|
|
639
|
+
onInit: async ({ space }) => {
|
|
640
|
+
const researchInputQueue = space.db.add(
|
|
641
|
+
Obj.make(ResearchInputQueue, { queue: Ref.fromDXN(space.queues.create().dxn) }),
|
|
642
|
+
);
|
|
643
|
+
const orgs = organizations.map(({ id: _, ...org }) => Obj.make(DataType.Organization, org));
|
|
644
|
+
await researchInputQueue.queue.target!.append(orgs);
|
|
645
|
+
|
|
646
|
+
const researchPrompt = space.db.add(
|
|
647
|
+
Prompt.make({
|
|
648
|
+
name: 'Research',
|
|
649
|
+
description: 'Research organization',
|
|
650
|
+
input: Schema.Struct({
|
|
651
|
+
org: Schema.Any,
|
|
652
|
+
}),
|
|
653
|
+
output: Schema.Any,
|
|
654
|
+
|
|
655
|
+
instructions:
|
|
656
|
+
'Research the organization provided as input. Create a research note for it at the end. NOTE: Do mocked reseach (set mockSearch to true).',
|
|
657
|
+
blueprints: [Ref.make(RESEARCH_BLUEPRINT)],
|
|
658
|
+
}),
|
|
659
|
+
);
|
|
660
|
+
|
|
661
|
+
space.db.add(
|
|
662
|
+
Obj.make(FunctionTrigger, {
|
|
663
|
+
function: Ref.make(serializeFunction(agent)),
|
|
664
|
+
enabled: true,
|
|
665
|
+
spec: {
|
|
666
|
+
kind: 'queue',
|
|
667
|
+
queue: researchInputQueue.queue.dxn.toString(),
|
|
668
|
+
},
|
|
669
|
+
input: {
|
|
670
|
+
prompt: Ref.make(researchPrompt),
|
|
671
|
+
input: '{{event.item}}',
|
|
672
|
+
},
|
|
673
|
+
}),
|
|
674
|
+
);
|
|
675
|
+
},
|
|
676
|
+
}),
|
|
677
|
+
args: {
|
|
678
|
+
deckComponents: [
|
|
679
|
+
[ResearchInputStack, ResearchOutputStack],
|
|
680
|
+
[TriggersContainer, InvocationsContainer, PromptContainer, GraphContainer],
|
|
681
|
+
],
|
|
682
|
+
blueprints: [RESEARCH_BLUEPRINT.key],
|
|
683
|
+
},
|
|
684
|
+
};
|
|
685
|
+
|
|
686
|
+
export const WithProject: Story = {
|
|
687
|
+
decorators: getDecorators({
|
|
688
|
+
plugins: [InboxPlugin(), MarkdownPlugin(), ProjectPlugin()],
|
|
689
|
+
config: config.remote,
|
|
690
|
+
accessTokens: [Obj.make(DataType.AccessToken, { source: 'exa.ai', token: EXA_API_KEY })],
|
|
691
|
+
types: [
|
|
692
|
+
DataType.Employer,
|
|
693
|
+
DataType.HasConnection,
|
|
694
|
+
DataType.Message,
|
|
695
|
+
DataType.Organization,
|
|
696
|
+
DataType.Person,
|
|
697
|
+
DataType.Project,
|
|
698
|
+
DataType.View,
|
|
699
|
+
Mailbox.Mailbox,
|
|
700
|
+
ResearchOn,
|
|
701
|
+
],
|
|
702
|
+
onInit: async ({ space }) => {
|
|
703
|
+
await addTestData(space);
|
|
704
|
+
const { objects: people } = await space.db.query(Filter.type(DataType.Person)).run();
|
|
705
|
+
const { objects: organizations } = await space.db.query(Filter.type(DataType.Organization)).run();
|
|
706
|
+
|
|
707
|
+
people.slice(0, 4).forEach((person) => {
|
|
708
|
+
person.notes = 'Project';
|
|
709
|
+
});
|
|
710
|
+
|
|
711
|
+
const mailbox = space.db.add(Mailbox.make({ name: 'Mailbox', space }));
|
|
712
|
+
const queue = space.queues.get<DataType.Message>(mailbox.queue.dxn);
|
|
713
|
+
const messages = createTestMailbox(people);
|
|
714
|
+
await queue.append(messages);
|
|
715
|
+
|
|
716
|
+
const dxosResearch = space.db.add(
|
|
717
|
+
Markdown.makeDocument({
|
|
718
|
+
name: 'DXOS Research',
|
|
719
|
+
content: 'DXOS builds Composer, an open-source AI-powered malleable application.',
|
|
720
|
+
}),
|
|
721
|
+
);
|
|
722
|
+
const blueyardResearch = space.db.add(
|
|
723
|
+
Markdown.makeDocument({
|
|
724
|
+
name: 'Blue Yard Research',
|
|
725
|
+
content: 'Blue Yard is a venture capital firm that invests in early-stage startups.',
|
|
726
|
+
}),
|
|
727
|
+
);
|
|
728
|
+
|
|
729
|
+
const dxos = organizations.find((org) => org.name === 'DXOS')!;
|
|
730
|
+
const blueyard = organizations.find((org) => org.name === 'Blue Yard')!;
|
|
731
|
+
space.db.add(
|
|
732
|
+
Relation.make(ResearchOn, {
|
|
733
|
+
[Relation.Source]: dxosResearch,
|
|
734
|
+
[Relation.Target]: dxos,
|
|
735
|
+
completedAt: new Date().toISOString(),
|
|
736
|
+
}),
|
|
737
|
+
);
|
|
738
|
+
space.db.add(
|
|
739
|
+
Relation.make(ResearchOn, {
|
|
740
|
+
[Relation.Source]: blueyardResearch,
|
|
741
|
+
[Relation.Target]: blueyard,
|
|
742
|
+
completedAt: new Date().toISOString(),
|
|
743
|
+
}),
|
|
744
|
+
);
|
|
745
|
+
|
|
746
|
+
const contactsQuery = Query.select(Filter.type(DataType.Person, { notes: 'Project' }));
|
|
747
|
+
const organizationsQuery = contactsQuery.sourceOf(DataType.Employer, { active: true }).target();
|
|
748
|
+
const notesQuery = organizationsQuery.targetOf(ResearchOn).source();
|
|
749
|
+
|
|
750
|
+
const contactsQueryString = 'Query.select(Filter.type(DataType.Person, { notes: "Project" }))';
|
|
751
|
+
const organizationsQueryString = `${contactsQueryString}.sourceOf(DataType.Employer, { active: true }).target()`;
|
|
752
|
+
const notesQueryString = `${organizationsQueryString}.targetOf(ResearchOn).source()`;
|
|
753
|
+
|
|
754
|
+
const researchPrompt = space.db.add(
|
|
755
|
+
Prompt.make({
|
|
756
|
+
name: 'Research',
|
|
757
|
+
description: 'Research organization',
|
|
758
|
+
input: Schema.Struct({
|
|
759
|
+
org: Schema.Any,
|
|
760
|
+
}),
|
|
761
|
+
output: Schema.Any,
|
|
762
|
+
|
|
763
|
+
instructions:
|
|
764
|
+
'Research the organization provided as input. Absolutely, in all cases, create a research note for it at the end. NOTE: Do mocked reseach (set mockSearch to true).',
|
|
765
|
+
blueprints: [Ref.make(RESEARCH_BLUEPRINT)],
|
|
766
|
+
}),
|
|
767
|
+
);
|
|
768
|
+
|
|
769
|
+
const researchTrigger = Obj.make(FunctionTrigger, {
|
|
770
|
+
function: Ref.make(serializeFunction(agent)),
|
|
771
|
+
enabled: true,
|
|
772
|
+
spec: {
|
|
773
|
+
kind: 'subscription',
|
|
774
|
+
query: {
|
|
775
|
+
string: organizationsQueryString,
|
|
776
|
+
ast: organizationsQuery.ast,
|
|
777
|
+
},
|
|
778
|
+
},
|
|
779
|
+
input: {
|
|
780
|
+
prompt: Ref.make(researchPrompt),
|
|
781
|
+
input: '{{event.subject}}',
|
|
782
|
+
},
|
|
783
|
+
});
|
|
784
|
+
space.db.add(researchTrigger);
|
|
785
|
+
|
|
786
|
+
const mailboxView = createView({
|
|
787
|
+
name: 'Mailbox',
|
|
788
|
+
query: Query.select(
|
|
789
|
+
Filter.type(DataType.Message, { properties: { labels: Filter.contains('Project') } }),
|
|
790
|
+
).options({
|
|
791
|
+
queues: [mailbox.queue.dxn.toString()],
|
|
792
|
+
}),
|
|
793
|
+
queryString:
|
|
794
|
+
'Query.select(Filter.type(DataType.Message, { properties: { labels: Filter.contains("Project") } }))',
|
|
795
|
+
jsonSchema: Type.toJsonSchema(DataType.Message),
|
|
796
|
+
presentation: Obj.make(DataType.Collection, { objects: [] }),
|
|
797
|
+
});
|
|
798
|
+
const contactsView = createView({
|
|
799
|
+
name: 'Contacts',
|
|
800
|
+
query: contactsQuery,
|
|
801
|
+
queryString: contactsQueryString,
|
|
802
|
+
jsonSchema: Type.toJsonSchema(DataType.Person),
|
|
803
|
+
presentation: Obj.make(DataType.Collection, { objects: [] }),
|
|
804
|
+
});
|
|
805
|
+
const organizationsView = createView({
|
|
806
|
+
name: 'Organizations',
|
|
807
|
+
query: organizationsQuery,
|
|
808
|
+
queryString: organizationsQueryString,
|
|
809
|
+
jsonSchema: Type.toJsonSchema(DataType.Organization),
|
|
810
|
+
presentation: Obj.make(DataType.Collection, { objects: [] }),
|
|
811
|
+
});
|
|
812
|
+
const notesView = createView({
|
|
813
|
+
name: 'Notes',
|
|
814
|
+
query: notesQuery,
|
|
815
|
+
queryString: notesQueryString,
|
|
816
|
+
jsonSchema: Type.toJsonSchema(Markdown.Document),
|
|
817
|
+
presentation: Obj.make(DataType.Collection, { objects: [] }),
|
|
818
|
+
});
|
|
819
|
+
|
|
820
|
+
space.db.add(
|
|
821
|
+
DataType.makeProject({
|
|
822
|
+
name: 'Investor Research',
|
|
823
|
+
collections: [mailboxView, contactsView, organizationsView, notesView].map((view) => Ref.make(view)),
|
|
824
|
+
}),
|
|
825
|
+
);
|
|
826
|
+
},
|
|
827
|
+
}),
|
|
828
|
+
args: {
|
|
829
|
+
deckComponents: [[ProjectContainer], [TriggersContainer, InvocationsContainer]],
|
|
830
|
+
blueprints: [],
|
|
831
|
+
},
|
|
832
|
+
};
|
|
833
|
+
|
|
834
|
+
export const WithScript: Story = {
|
|
835
|
+
decorators: getDecorators({
|
|
836
|
+
plugins: [MarkdownPlugin(), ScriptPlugin()],
|
|
837
|
+
config: config.local,
|
|
838
|
+
types: [ScriptType, DataType.Text],
|
|
839
|
+
onInit: async ({ client, space }) => {
|
|
840
|
+
const { identityKey } = client.halo.identity.get()!;
|
|
841
|
+
await client.halo.writeCredentials([getAccessCredential(identityKey)]);
|
|
842
|
+
|
|
843
|
+
const template = templates.find((template) => template.id === 'dxos.org/script/forex-effect');
|
|
844
|
+
invariant(template, 'Template not found');
|
|
845
|
+
invariant(template.name, 'Template name not found');
|
|
846
|
+
|
|
847
|
+
// Ensure at least one Script exists so the React surface can render.
|
|
848
|
+
const source = Obj.make(DataType.Text, {
|
|
849
|
+
content: template.source,
|
|
850
|
+
});
|
|
851
|
+
space.db.add(
|
|
852
|
+
Obj.make(ScriptType, {
|
|
853
|
+
name: template.name,
|
|
854
|
+
description: 'Function to get the exchange rates between two currencies.',
|
|
855
|
+
changed: true,
|
|
856
|
+
source: Ref.make(source),
|
|
857
|
+
}),
|
|
858
|
+
);
|
|
859
|
+
|
|
860
|
+
await space.db.flush();
|
|
861
|
+
},
|
|
862
|
+
onChatCreated: async ({ space, binder }) => {
|
|
863
|
+
const bp = space.db.add(
|
|
864
|
+
Blueprint.make({
|
|
865
|
+
key: 'dxos.org/blueprint/forex',
|
|
866
|
+
name: 'Forex',
|
|
867
|
+
instructions: Template.make({
|
|
868
|
+
source: trim`
|
|
869
|
+
You can get the exchange rate between two currencies.
|
|
870
|
+
`,
|
|
871
|
+
}),
|
|
872
|
+
tools: [ToolId.make('dxos.org/script/forex-effect')],
|
|
873
|
+
}),
|
|
874
|
+
);
|
|
875
|
+
|
|
876
|
+
await binder.bind({ blueprints: [Ref.make(bp)] });
|
|
877
|
+
},
|
|
878
|
+
}),
|
|
879
|
+
args: {
|
|
880
|
+
deckComponents: [[ChatContainer], [ScriptContainer]],
|
|
881
|
+
},
|
|
882
|
+
};
|