@dxos/plugin-assistant 0.8.4-main.422d1c7879 → 0.8.4-main.4f23b4e393
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/neutral/AgentArticle-5XDDEXMP.mjs +169 -0
- package/dist/lib/neutral/AgentArticle-5XDDEXMP.mjs.map +7 -0
- package/dist/lib/neutral/AgentProperties-CNH4JMDZ.mjs +100 -0
- package/dist/lib/neutral/AgentProperties-CNH4JMDZ.mjs.map +7 -0
- package/dist/lib/neutral/AssistantPlugin.mjs +99 -0
- package/dist/lib/neutral/AssistantPlugin.mjs.map +7 -0
- package/dist/lib/neutral/AssistantPlugin.node.mjs +46 -0
- package/dist/lib/neutral/AssistantPlugin.node.mjs.map +7 -0
- package/dist/lib/neutral/AssistantSettings-GG52BLKS.mjs +40 -0
- package/dist/lib/neutral/AssistantSettings-GG52BLKS.mjs.map +7 -0
- package/dist/lib/neutral/BlueprintArticle-U7LUBFOS.mjs +27 -0
- package/dist/lib/neutral/BlueprintArticle-U7LUBFOS.mjs.map +7 -0
- package/dist/lib/neutral/ChatCompanion-L33PFOFB.mjs +130 -0
- package/dist/lib/neutral/ChatCompanion-L33PFOFB.mjs.map +7 -0
- package/dist/lib/neutral/ChatContainer-VYVJYPPN.mjs +8 -0
- package/dist/lib/neutral/ChatDialog-QKZLG7SQ.mjs +72 -0
- package/dist/lib/neutral/ChatDialog-QKZLG7SQ.mjs.map +7 -0
- package/dist/lib/neutral/PlanArticle-TS5ULWYS.mjs +28 -0
- package/dist/lib/neutral/PlanArticle-TS5ULWYS.mjs.map +7 -0
- package/dist/lib/neutral/RoutineArticle-H7ECM7AH.mjs +116 -0
- package/dist/lib/neutral/RoutineArticle-H7ECM7AH.mjs.map +7 -0
- package/dist/lib/neutral/RoutineList-CLDXGQUD.mjs +48 -0
- package/dist/lib/neutral/RoutineList-CLDXGQUD.mjs.map +7 -0
- package/dist/lib/neutral/TracePanel-HYVPDIAA.mjs +565 -0
- package/dist/lib/neutral/TracePanel-HYVPDIAA.mjs.map +7 -0
- package/dist/lib/neutral/TriggerStatus-WTFYUIG5.mjs +92 -0
- package/dist/lib/neutral/TriggerStatus-WTFYUIG5.mjs.map +7 -0
- package/dist/lib/neutral/ai-service-GJXMI5OI.mjs +22 -0
- package/dist/lib/neutral/ai-service-GJXMI5OI.mjs.map +7 -0
- package/dist/lib/neutral/app-graph-builder-LHRT43KA.mjs +189 -0
- package/dist/lib/neutral/app-graph-builder-LHRT43KA.mjs.map +7 -0
- package/dist/lib/neutral/blueprint-definition-VXJYQ5AE.mjs +32 -0
- package/dist/lib/neutral/blueprint-definition-VXJYQ5AE.mjs.map +7 -0
- package/dist/lib/{browser → neutral}/blueprints/index.mjs +1 -1
- package/dist/lib/neutral/capabilities/index.mjs +35 -0
- package/dist/lib/neutral/capabilities/index.mjs.map +7 -0
- package/dist/lib/neutral/chunk-4CQZCMRP.mjs +25 -0
- package/dist/lib/neutral/chunk-4CQZCMRP.mjs.map +7 -0
- package/dist/lib/{browser/chunk-EZRS3J25.mjs → neutral/chunk-5H6UJHLF.mjs} +3 -3
- package/dist/lib/neutral/chunk-5H6UJHLF.mjs.map +7 -0
- package/dist/lib/neutral/chunk-A4SCD32D.mjs +106 -0
- package/dist/lib/neutral/chunk-A4SCD32D.mjs.map +7 -0
- package/dist/lib/neutral/chunk-OT2QDO3T.mjs +8 -0
- package/dist/lib/neutral/chunk-OT2QDO3T.mjs.map +7 -0
- package/dist/lib/neutral/chunk-VHPTYKYD.mjs +361 -0
- package/dist/lib/neutral/chunk-VHPTYKYD.mjs.map +7 -0
- package/dist/lib/neutral/companion-chat-provisioner-2Y6PRSDK.mjs +116 -0
- package/dist/lib/neutral/companion-chat-provisioner-2Y6PRSDK.mjs.map +7 -0
- package/dist/lib/neutral/components/index.mjs +2297 -0
- package/dist/lib/neutral/components/index.mjs.map +7 -0
- package/dist/lib/neutral/containers/index.mjs +29 -0
- package/dist/lib/neutral/containers/index.mjs.map +7 -0
- package/dist/lib/{browser/create-chat-LBZHGVSN.mjs → neutral/create-chat-5VM2UUWY.mjs} +8 -19
- package/dist/lib/neutral/create-chat-5VM2UUWY.mjs.map +7 -0
- package/dist/lib/neutral/create-object-UZCJCPWM.mjs +93 -0
- package/dist/lib/neutral/create-object-UZCJCPWM.mjs.map +7 -0
- package/dist/lib/neutral/edge-model-resolver-XDNBZ3US.mjs +21 -0
- package/dist/lib/neutral/edge-model-resolver-XDNBZ3US.mjs.map +7 -0
- package/dist/lib/{browser/ensure-companion-chat-ZEZA34MZ.mjs → neutral/ensure-companion-chat-5S4LZM2H.mjs} +10 -17
- package/dist/lib/neutral/ensure-companion-chat-5S4LZM2H.mjs.map +7 -0
- package/dist/lib/neutral/hooks/index.mjs +930 -0
- package/dist/lib/neutral/hooks/index.mjs.map +7 -0
- package/dist/lib/neutral/index.mjs +32 -0
- package/dist/lib/neutral/local-model-resolver-I2BENFFS.mjs +24 -0
- package/dist/lib/neutral/local-model-resolver-I2BENFFS.mjs.map +7 -0
- package/dist/lib/neutral/markdown-KTBFOMFM.mjs +110 -0
- package/dist/lib/neutral/markdown-KTBFOMFM.mjs.map +7 -0
- package/dist/lib/neutral/meta.json +1 -0
- package/dist/lib/neutral/meta.mjs +12 -0
- package/dist/lib/neutral/migrations-7DEMVBOG.mjs +28 -0
- package/dist/lib/neutral/migrations-7DEMVBOG.mjs.map +7 -0
- package/dist/lib/{browser/on-create-space-54RNX5JI.mjs → neutral/on-create-space-Q2R7OSP6.mjs} +5 -8
- package/dist/lib/neutral/on-create-space-Q2R7OSP6.mjs.map +7 -0
- package/dist/lib/neutral/operation-handler-SF36MOB5.mjs +13 -0
- package/dist/lib/neutral/operation-handler-SF36MOB5.mjs.map +7 -0
- package/dist/lib/neutral/operations/index.mjs +8 -0
- package/dist/lib/neutral/plugin.mjs +16 -0
- package/dist/lib/neutral/plugin.mjs.map +7 -0
- package/dist/lib/neutral/react-surface-2WAPE25I.mjs +174 -0
- package/dist/lib/neutral/react-surface-2WAPE25I.mjs.map +7 -0
- package/dist/lib/{browser/resolve-navigation-targets-NZOD66NY.mjs → neutral/resolve-navigation-targets-VXBSWV5L.mjs} +4 -6
- package/dist/lib/neutral/resolve-navigation-targets-VXBSWV5L.mjs.map +7 -0
- package/dist/lib/{browser/run-prompt-in-new-chat-THLK5YQC.mjs → neutral/run-prompt-in-new-chat-XEPT5MOM.mjs} +14 -50
- package/dist/lib/neutral/run-prompt-in-new-chat-XEPT5MOM.mjs.map +7 -0
- package/dist/lib/{browser/set-current-chat-LRS3VFSH.mjs → neutral/set-current-chat-ZFDCYK5I.mjs} +5 -11
- package/dist/lib/neutral/set-current-chat-ZFDCYK5I.mjs.map +7 -0
- package/dist/lib/neutral/settings-W4BLWQ53.mjs +28 -0
- package/dist/lib/neutral/settings-W4BLWQ53.mjs.map +7 -0
- package/dist/lib/neutral/state-H3G7QCU6.mjs +28 -0
- package/dist/lib/neutral/state-H3G7QCU6.mjs.map +7 -0
- package/dist/lib/neutral/toolkit-GVWXPDLJ.mjs +14 -0
- package/dist/lib/neutral/toolkit-GVWXPDLJ.mjs.map +7 -0
- package/dist/lib/neutral/translations.mjs +174 -0
- package/dist/lib/neutral/translations.mjs.map +7 -0
- package/dist/lib/neutral/types/index.mjs +20 -0
- package/dist/lib/neutral/types/index.mjs.map +7 -0
- package/dist/lib/{browser/update-chat-name-3Y36KFAS.mjs → neutral/update-chat-name-ENXRUMDJ.mjs} +8 -25
- package/dist/lib/neutral/update-chat-name-ENXRUMDJ.mjs.map +7 -0
- package/dist/types/src/AssistantPlugin.d.ts +1 -0
- package/dist/types/src/AssistantPlugin.d.ts.map +1 -1
- package/dist/types/src/AssistantPlugin.node.d.ts +4 -0
- package/dist/types/src/AssistantPlugin.node.d.ts.map +1 -0
- package/dist/types/src/AssistantPlugin.test.d.ts +2 -0
- package/dist/types/src/AssistantPlugin.test.d.ts.map +1 -0
- package/dist/types/src/blueprints/assistant/blueprint.d.ts +2 -2
- package/dist/types/src/blueprints/assistant/blueprint.d.ts.map +1 -1
- package/dist/types/src/capabilities/ai-service.d.ts.map +1 -1
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
- package/dist/types/src/capabilities/blueprint-definition.d.ts.map +1 -1
- package/dist/types/src/capabilities/companion-chat-provisioner.d.ts.map +1 -1
- package/dist/types/src/capabilities/create-object.d.ts +31 -0
- package/dist/types/src/capabilities/create-object.d.ts.map +1 -0
- package/dist/types/src/capabilities/edge-model-resolver.d.ts.map +1 -1
- package/dist/types/src/capabilities/index.d.ts +27 -1
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/local-model-resolver.d.ts.map +1 -1
- package/dist/types/src/capabilities/markdown.d.ts.map +1 -1
- package/dist/types/src/capabilities/migrations.d.ts +2 -1
- package/dist/types/src/capabilities/migrations.d.ts.map +1 -1
- package/dist/types/src/capabilities/operation-handler.d.ts +1 -1
- package/dist/types/src/capabilities/operation-handler.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
- package/dist/types/src/capabilities/settings.d.ts.map +1 -1
- package/dist/types/src/capabilities/state.d.ts.map +1 -1
- package/dist/types/src/capabilities/toolkit.d.ts.map +1 -1
- package/dist/types/src/components/AssistantSettings/AssistantSettings.d.ts +1 -1
- package/dist/types/src/components/AssistantSettings/AssistantSettings.d.ts.map +1 -1
- package/dist/types/src/components/AssistantSettings/AssistantSettings.stories.d.ts.map +1 -1
- package/dist/types/src/components/Chat/Chat.d.ts +36 -40
- package/dist/types/src/components/Chat/Chat.d.ts.map +1 -1
- package/dist/types/src/components/Chat/context.d.ts +29 -0
- package/dist/types/src/components/Chat/context.d.ts.map +1 -0
- package/dist/types/src/components/ChatPrompt/ChatActions.d.ts.map +1 -1
- package/dist/types/src/components/ChatPrompt/ChatMcpErrors.d.ts +12 -0
- package/dist/types/src/components/ChatPrompt/ChatMcpErrors.d.ts.map +1 -0
- package/dist/types/src/components/ChatPrompt/ChatOptions.d.ts +7 -5
- package/dist/types/src/components/ChatPrompt/ChatOptions.d.ts.map +1 -1
- package/dist/types/src/components/ChatPrompt/ChatOptions.stories.d.ts +1 -1
- package/dist/types/src/components/ChatPrompt/ChatOptions.stories.d.ts.map +1 -1
- package/dist/types/src/components/ChatPrompt/ChatPresets.d.ts.map +1 -1
- package/dist/types/src/components/ChatPrompt/ChatPrompt.d.ts +28 -0
- package/dist/types/src/components/ChatPrompt/ChatPrompt.d.ts.map +1 -0
- package/dist/types/src/components/ChatPrompt/ChatReferences.d.ts +2 -2
- package/dist/types/src/components/ChatPrompt/ChatReferences.d.ts.map +1 -1
- package/dist/types/src/components/ChatPrompt/ChatStatus.d.ts +20 -0
- package/dist/types/src/components/ChatPrompt/ChatStatus.d.ts.map +1 -0
- package/dist/types/src/components/ChatPrompt/ChatStatusIndicator.d.ts.map +1 -1
- package/dist/types/src/components/ChatPrompt/index.d.ts +3 -0
- package/dist/types/src/components/ChatPrompt/index.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/Anchor.stories.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/ChatThread.d.ts +6 -3
- package/dist/types/src/components/ChatThread/ChatThread.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/ChatThread.stories.d.ts +5 -5
- package/dist/types/src/components/ChatThread/ChatThread.stories.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/Link.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/MarkdownStream.stories.d.ts +1 -1
- package/dist/types/src/components/ChatThread/MarkdownStream.stories.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/registry.d.ts +18 -0
- package/dist/types/src/components/ChatThread/registry.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/sync.d.ts +1 -1
- package/dist/types/src/components/ChatThread/sync.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/tool-widget-state.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/widgets/FallbackWidget.d.ts +4 -4
- package/dist/types/src/components/ChatThread/widgets/FallbackWidget.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/widgets/ReasoningWidget.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/widgets/ReasoningWidget.stories.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/widgets/ReferenceWidget.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/widgets/SelectWidget.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/widgets/StatsWidget.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/widgets/StatusWidget.d.ts +2 -15
- package/dist/types/src/components/ChatThread/widgets/StatusWidget.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/widgets/SuggestionWidget.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/widgets/SummaryWidget.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/widgets/ToolWidget.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/widgets/ToolWidget.stories.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/widgets/defaults.d.ts +5 -0
- package/dist/types/src/components/ChatThread/widgets/defaults.d.ts.map +1 -0
- package/dist/types/src/components/ChatThread/widgets/index.d.ts +1 -2
- package/dist/types/src/components/ChatThread/widgets/index.d.ts.map +1 -1
- package/dist/types/src/components/ProcessTree/ProcessTree.d.ts +2 -1
- package/dist/types/src/components/ProcessTree/ProcessTree.d.ts.map +1 -1
- package/dist/types/src/components/ProcessTree/ProcessTree.stories.d.ts +0 -1
- package/dist/types/src/components/ProcessTree/ProcessTree.stories.d.ts.map +1 -1
- package/dist/types/src/components/TaskList/TaskList.d.ts +10 -0
- package/dist/types/src/components/TaskList/TaskList.d.ts.map +1 -0
- package/dist/types/src/components/TaskList/TaskList.stories.d.ts +16 -0
- package/dist/types/src/components/TaskList/TaskList.stories.d.ts.map +1 -0
- package/dist/types/src/components/TaskList/index.d.ts +2 -0
- package/dist/types/src/components/TaskList/index.d.ts.map +1 -0
- package/dist/types/src/components/TemplateEditor/TemplateEditor.d.ts +2 -2
- package/dist/types/src/components/TemplateEditor/TemplateEditor.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/TemplateEditor.stories.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/TemplateForm.d.ts +4 -5
- package/dist/types/src/components/TemplateEditor/TemplateForm.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/TemplateForm.stories.d.ts +1 -1
- package/dist/types/src/components/TemplateEditor/TemplateForm.stories.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/extensions/handlebars-extension.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/extensions/xml-extension.d.ts.map +1 -1
- package/dist/types/src/components/ToolBlock/ToolBlock.d.ts +4 -4
- package/dist/types/src/components/ToolBlock/ToolBlock.d.ts.map +1 -1
- package/dist/types/src/components/Toolbox/Toolbox.d.ts +3 -3
- package/dist/types/src/components/Toolbox/Toolbox.d.ts.map +1 -1
- package/dist/types/src/components/Toolbox/Toolbox.stories.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +1 -0
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/containers/AgentArticle/AgentArticle.d.ts.map +1 -1
- package/dist/types/src/containers/AgentArticle/AgentArticle.stories.d.ts.map +1 -1
- package/dist/types/src/containers/AgentProperties/AgentProperties.d.ts.map +1 -1
- package/dist/types/src/containers/AgentProperties/AgentProperties.stories.d.ts.map +1 -1
- package/dist/types/src/containers/BlueprintArticle/BlueprintArticle.d.ts +1 -1
- package/dist/types/src/containers/BlueprintArticle/BlueprintArticle.d.ts.map +1 -1
- package/dist/types/src/containers/ChatCompanion/ChatCompanion.d.ts +1 -1
- package/dist/types/src/containers/ChatCompanion/ChatCompanion.d.ts.map +1 -1
- package/dist/types/src/containers/ChatContainer/ChatContainer.d.ts.map +1 -1
- package/dist/types/src/containers/ChatDialog/ChatDialog.d.ts.map +1 -1
- package/dist/types/src/containers/PlanArticle/PlanArticle.d.ts +6 -0
- package/dist/types/src/containers/PlanArticle/PlanArticle.d.ts.map +1 -0
- package/dist/types/src/containers/PlanArticle/index.d.ts +2 -0
- package/dist/types/src/containers/PlanArticle/index.d.ts.map +1 -0
- package/dist/types/src/containers/RoutineArticle/RoutineArticle.d.ts +6 -0
- package/dist/types/src/containers/RoutineArticle/RoutineArticle.d.ts.map +1 -0
- package/dist/types/src/containers/RoutineArticle/RoutineArticle.stories.d.ts +15 -0
- package/dist/types/src/containers/RoutineArticle/RoutineArticle.stories.d.ts.map +1 -0
- package/dist/types/src/containers/RoutineArticle/index.d.ts +2 -0
- package/dist/types/src/containers/RoutineArticle/index.d.ts.map +1 -0
- package/dist/types/src/containers/RoutineList/RoutineList.d.ts +6 -0
- package/dist/types/src/containers/RoutineList/RoutineList.d.ts.map +1 -0
- package/dist/types/src/containers/{PromptList/PromptList.stories.d.ts → RoutineList/RoutineList.stories.d.ts} +1 -1
- package/dist/types/src/containers/RoutineList/RoutineList.stories.d.ts.map +1 -0
- package/dist/types/src/containers/RoutineList/index.d.ts +2 -0
- package/dist/types/src/containers/RoutineList/index.d.ts.map +1 -0
- package/dist/types/src/containers/TracePanel/TracePanel.d.ts +3 -2
- package/dist/types/src/containers/TracePanel/TracePanel.d.ts.map +1 -1
- package/dist/types/src/containers/TracePanel/TracePanel.stories.d.ts +1 -4
- package/dist/types/src/containers/TracePanel/TracePanel.stories.d.ts.map +1 -1
- package/dist/types/src/containers/TracePanel/dxn-extractor.d.ts +1 -1
- package/dist/types/src/containers/TracePanel/dxn-extractor.d.ts.map +1 -1
- package/dist/types/src/containers/TracePanel/execution-graph.d.ts +81 -1
- package/dist/types/src/containers/TracePanel/execution-graph.d.ts.map +1 -1
- package/dist/types/src/containers/TracePanel/execution-graph.test.d.ts +2 -0
- package/dist/types/src/containers/TracePanel/execution-graph.test.d.ts.map +1 -0
- package/dist/types/src/containers/TracePanel/index.d.ts.map +1 -1
- package/dist/types/src/containers/TracePanel/testing/index.d.ts +3 -0
- package/dist/types/src/containers/TracePanel/testing/index.d.ts.map +1 -0
- package/dist/types/src/containers/TracePanel/testing/simulated-agent.d.ts +14 -0
- package/dist/types/src/containers/TracePanel/testing/simulated-agent.d.ts.map +1 -0
- package/dist/types/src/containers/TracePanel/testing/snapshot-playback.d.ts +12 -0
- package/dist/types/src/containers/TracePanel/testing/snapshot-playback.d.ts.map +1 -0
- package/dist/types/src/containers/TriggerStatus/TriggerStatus.d.ts.map +1 -1
- package/dist/types/src/containers/index.d.ts +5 -4
- package/dist/types/src/containers/index.d.ts.map +1 -1
- package/dist/types/src/extensions/prompt-extension.d.ts.map +1 -1
- package/dist/types/src/feed-logger.d.ts +13 -0
- package/dist/types/src/feed-logger.d.ts.map +1 -0
- package/dist/types/src/hooks/index.d.ts +2 -0
- package/dist/types/src/hooks/index.d.ts.map +1 -1
- package/dist/types/src/hooks/useBlueprintRegistry.d.ts +4 -4
- package/dist/types/src/hooks/useBlueprintRegistry.d.ts.map +1 -1
- package/dist/types/src/hooks/useChatKeymap.d.ts +12 -0
- package/dist/types/src/hooks/useChatKeymap.d.ts.map +1 -0
- package/dist/types/src/hooks/useChatProcessor.d.ts +2 -2
- package/dist/types/src/hooks/useChatProcessor.d.ts.map +1 -1
- package/dist/types/src/hooks/useChatServices.d.ts +1 -1
- package/dist/types/src/hooks/useChatServices.d.ts.map +1 -1
- package/dist/types/src/hooks/useChatToolbarActions.d.ts.map +1 -1
- package/dist/types/src/hooks/useContextBinder.d.ts +2 -2
- package/dist/types/src/hooks/useContextBinder.d.ts.map +1 -1
- package/dist/types/src/hooks/useContextObjects.d.ts +2 -2
- package/dist/types/src/hooks/useContextObjects.d.ts.map +1 -1
- package/dist/types/src/hooks/useDebug.d.ts +10 -0
- package/dist/types/src/hooks/useDebug.d.ts.map +1 -0
- package/dist/types/src/hooks/useFilteredTypes.d.ts.map +1 -1
- package/dist/types/src/hooks/useFlush.d.ts +1 -1
- package/dist/types/src/hooks/useFlush.d.ts.map +1 -1
- package/dist/types/src/hooks/usePresets.d.ts.map +1 -1
- package/dist/types/src/hooks/useReferencesProvider.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +0 -4
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/operations/create-chat.d.ts +3 -3
- package/dist/types/src/operations/create-chat.d.ts.map +1 -1
- package/dist/types/src/operations/ensure-companion-chat.d.ts +3 -3
- package/dist/types/src/operations/ensure-companion-chat.d.ts.map +1 -1
- package/dist/types/src/operations/index.d.ts +1 -2
- package/dist/types/src/operations/index.d.ts.map +1 -1
- package/dist/types/src/operations/on-create-space.d.ts +3 -3
- package/dist/types/src/operations/on-create-space.d.ts.map +1 -1
- package/dist/types/src/operations/resolve-navigation-targets.d.ts +1 -1
- package/dist/types/src/operations/resolve-navigation-targets.d.ts.map +1 -1
- package/dist/types/src/operations/run-prompt-in-new-chat.d.ts +3 -3
- package/dist/types/src/operations/run-prompt-in-new-chat.d.ts.map +1 -1
- package/dist/types/src/operations/set-current-chat.d.ts +3 -3
- package/dist/types/src/operations/set-current-chat.d.ts.map +1 -1
- package/dist/types/src/operations/update-chat-name.d.ts +3 -3
- package/dist/types/src/operations/update-chat-name.d.ts.map +1 -1
- package/dist/types/src/plugin.d.ts +4 -0
- package/dist/types/src/plugin.d.ts.map +1 -0
- package/dist/types/src/processor/processor.d.ts +30 -12
- package/dist/types/src/processor/processor.d.ts.map +1 -1
- package/dist/types/src/testing/index.d.ts +1 -0
- package/dist/types/src/testing/index.d.ts.map +1 -1
- package/dist/types/src/testing/test-generator.d.ts +2 -3
- package/dist/types/src/testing/test-generator.d.ts.map +1 -1
- package/dist/types/src/testing/test-sequence.d.ts +3 -3
- package/dist/types/src/testing/test-sequence.d.ts.map +1 -1
- package/dist/types/src/testing/test-services.d.ts.map +1 -1
- package/dist/types/src/testing/test-trace.d.ts +5 -0
- package/dist/types/src/testing/test-trace.d.ts.map +1 -0
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/Assistant.d.ts +22 -6
- package/dist/types/src/types/Assistant.d.ts.map +1 -1
- package/dist/types/src/types/AssistantCapabilities.d.ts +30 -0
- package/dist/types/src/types/AssistantCapabilities.d.ts.map +1 -0
- package/dist/types/src/types/AssistantEvents.d.ts +3 -0
- package/dist/types/src/types/AssistantEvents.d.ts.map +1 -0
- package/dist/types/src/{operations/definitions.d.ts → types/AssistantOperation.d.ts} +27 -20
- package/dist/types/src/types/AssistantOperation.d.ts.map +1 -0
- package/dist/types/src/types/Settings.d.ts +20 -5
- package/dist/types/src/types/Settings.d.ts.map +1 -1
- package/dist/types/src/types/index.d.ts +3 -3
- package/dist/types/src/types/index.d.ts.map +1 -1
- package/dist/types/src/types/service.d.ts +1 -1
- package/dist/types/src/types/service.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +156 -117
- package/src/AssistantPlugin.node.ts +44 -0
- package/src/AssistantPlugin.test.ts +35 -0
- package/src/AssistantPlugin.ts +126 -0
- package/src/blueprints/assistant/blueprint.test.ts +3 -3
- package/src/blueprints/assistant/blueprint.ts +4 -4
- package/src/capabilities/app-graph-builder.ts +42 -12
- package/src/capabilities/blueprint-definition.ts +2 -4
- package/src/capabilities/companion-chat-provisioner.ts +4 -5
- package/src/capabilities/create-object.ts +107 -0
- package/src/capabilities/index.ts +3 -1
- package/src/capabilities/markdown.ts +1 -1
- package/src/capabilities/migrations.ts +4 -11
- package/src/capabilities/operation-handler.ts +1 -1
- package/src/capabilities/react-surface.tsx +28 -14
- package/src/components/AssistantSettings/AssistantSettings.stories.tsx +3 -2
- package/src/components/AssistantSettings/AssistantSettings.tsx +22 -111
- package/src/components/Chat/Chat.tsx +85 -259
- package/src/components/Chat/context.ts +39 -0
- package/src/components/ChatPrompt/ChatActions.tsx +10 -10
- package/src/components/ChatPrompt/ChatMcpErrors.tsx +50 -0
- package/src/components/ChatPrompt/ChatOptions.stories.tsx +28 -14
- package/src/components/ChatPrompt/ChatOptions.tsx +100 -60
- package/src/components/ChatPrompt/ChatPrompt.tsx +182 -0
- package/src/components/ChatPrompt/ChatReferences.tsx +4 -4
- package/src/components/ChatPrompt/ChatStatus.tsx +123 -0
- package/src/components/ChatPrompt/ChatStatusIndicator.tsx +1 -1
- package/src/components/ChatPrompt/index.ts +3 -0
- package/src/components/ChatThread/Anchor.stories.tsx +3 -3
- package/src/components/ChatThread/ChatThread.stories.tsx +27 -30
- package/src/components/ChatThread/ChatThread.tsx +31 -18
- package/src/components/ChatThread/DEBUG.md +41 -0
- package/src/components/ChatThread/MarkdownStream.stories.tsx +5 -4
- package/src/components/ChatThread/registry.tsx +61 -18
- package/src/components/ChatThread/sync.test.ts +84 -18
- package/src/components/ChatThread/sync.ts +1 -1
- package/src/components/ChatThread/widgets/ReasoningWidget.ts +7 -7
- package/src/components/ChatThread/widgets/ReferenceWidget.ts +3 -1
- package/src/components/ChatThread/widgets/SelectWidget.ts +3 -1
- package/src/components/ChatThread/widgets/StatsWidget.ts +3 -1
- package/src/components/ChatThread/widgets/StatusWidget.ts +5 -83
- package/src/components/ChatThread/widgets/SuggestionWidget.ts +1 -1
- package/src/components/ChatThread/widgets/SummaryWidget.tsx +3 -4
- package/src/components/ChatThread/widgets/ToolWidget.stories.tsx +2 -1
- package/src/components/ChatThread/widgets/defaults.ts +8 -0
- package/src/components/ChatThread/widgets/index.ts +1 -2
- package/src/components/ProcessTree/ProcessTree.stories.tsx +12 -38
- package/src/components/ProcessTree/ProcessTree.tsx +69 -36
- package/src/components/TaskList/TaskList.stories.tsx +44 -0
- package/src/components/TaskList/TaskList.tsx +45 -0
- package/src/{cli → components/TaskList}/index.ts +1 -1
- package/src/components/TemplateEditor/TemplateEditor.stories.tsx +4 -3
- package/src/components/TemplateEditor/TemplateEditor.tsx +5 -5
- package/src/components/TemplateEditor/TemplateForm.stories.tsx +6 -9
- package/src/components/TemplateEditor/TemplateForm.tsx +51 -72
- package/src/components/Toolbox/Toolbox.stories.tsx +6 -5
- package/src/components/Toolbox/Toolbox.tsx +4 -4
- package/src/components/index.ts +1 -0
- package/src/containers/AgentArticle/AgentArticle.stories.tsx +8 -8
- package/src/containers/AgentArticle/AgentArticle.tsx +12 -8
- package/src/containers/AgentProperties/AgentProperties.stories.tsx +6 -5
- package/src/containers/AgentProperties/AgentProperties.tsx +6 -6
- package/src/containers/BlueprintArticle/BlueprintArticle.tsx +1 -1
- package/src/containers/ChatCompanion/ChatCompanion.tsx +13 -26
- package/src/containers/ChatContainer/ChatContainer.tsx +20 -8
- package/src/containers/ChatDialog/ChatDialog.tsx +3 -9
- package/src/containers/PlanArticle/PlanArticle.tsx +33 -0
- package/src/containers/PlanArticle/index.ts +5 -0
- package/src/containers/RoutineArticle/RoutineArticle.stories.tsx +75 -0
- package/src/containers/RoutineArticle/RoutineArticle.tsx +109 -0
- package/src/containers/RoutineArticle/index.ts +5 -0
- package/src/containers/{PromptList/PromptList.stories.tsx → RoutineList/RoutineList.stories.tsx} +13 -12
- package/src/containers/{PromptList/PromptList.tsx → RoutineList/RoutineList.tsx} +8 -7
- package/src/containers/RoutineList/index.ts +5 -0
- package/src/containers/TracePanel/TracePanel.stories.tsx +215 -202
- package/src/containers/TracePanel/TracePanel.tsx +101 -47
- package/src/containers/TracePanel/dxn-extractor.test.ts +7 -7
- package/src/containers/TracePanel/dxn-extractor.ts +11 -11
- package/src/containers/TracePanel/execution-graph.test.ts +382 -0
- package/src/containers/TracePanel/execution-graph.ts +380 -211
- package/src/containers/TracePanel/testing/index.ts +6 -0
- package/src/containers/TracePanel/testing/simulated-agent.ts +114 -0
- package/src/containers/TracePanel/testing/snapshot-playback.ts +45 -0
- package/src/containers/TriggerStatus/TriggerStatus.tsx +1 -1
- package/src/containers/index.ts +5 -4
- package/src/{queue-logger.ts → feed-logger.ts} +38 -28
- package/src/hooks/index.ts +2 -0
- package/src/hooks/useBlueprintRegistry.ts +4 -4
- package/src/hooks/useChatKeymap.ts +52 -0
- package/src/hooks/useChatProcessor.ts +4 -4
- package/src/hooks/useChatServices.ts +1 -1
- package/src/hooks/useChatToolbarActions.ts +1 -1
- package/src/hooks/useContextBinder.ts +4 -4
- package/src/hooks/useContextObjects.ts +2 -2
- package/src/hooks/useDebug.ts +38 -0
- package/src/index.ts +0 -5
- package/src/operations/create-chat.ts +7 -9
- package/src/operations/ensure-companion-chat.ts +49 -47
- package/src/operations/index.ts +1 -3
- package/src/operations/on-create-space.ts +4 -4
- package/src/operations/prompt.test.ts +9 -11
- package/src/operations/resolve-navigation-targets.ts +3 -3
- package/src/operations/run-prompt-in-new-chat.ts +85 -86
- package/src/operations/set-current-chat.ts +4 -5
- package/src/operations/update-chat-name.ts +4 -4
- package/src/plugin.ts +11 -0
- package/src/processor/processor.test.ts +2 -2
- package/src/processor/processor.ts +49 -18
- package/src/testing/data/trace-timeline.dx.json +3737 -1200
- package/src/testing/index.ts +1 -0
- package/src/testing/test-generator.test.ts +41 -52
- package/src/testing/test-generator.ts +177 -192
- package/src/testing/test-sequence.ts +3 -3
- package/src/testing/test-trace.ts +20 -0
- package/src/testing/trace-timeline.conversations.json +1 -1
- package/src/testing/trace-timeline.test.ts +53 -49
- package/src/translations.ts +29 -33
- package/src/types/Assistant.ts +13 -1
- package/src/types/AssistantCapabilities.ts +35 -0
- package/src/types/AssistantEvents.ts +11 -0
- package/src/{operations/definitions.ts → types/AssistantOperation.ts} +5 -4
- package/src/types/Settings.ts +62 -7
- package/src/types/index.ts +5 -3
- package/src/types/service.ts +1 -1
- package/dist/lib/browser/AssistantSettings-7QMO3LGF.mjs +0 -97
- package/dist/lib/browser/AssistantSettings-7QMO3LGF.mjs.map +0 -7
- package/dist/lib/browser/chunk-ATHYBVGN.mjs +0 -176
- package/dist/lib/browser/chunk-ATHYBVGN.mjs.map +0 -7
- package/dist/lib/browser/chunk-EZRS3J25.mjs.map +0 -7
- package/dist/lib/browser/chunk-LMVTXH54.mjs +0 -154
- package/dist/lib/browser/chunk-LMVTXH54.mjs.map +0 -7
- package/dist/lib/browser/cli/index.mjs +0 -74
- package/dist/lib/browser/cli/index.mjs.map +0 -7
- package/dist/lib/browser/create-chat-LBZHGVSN.mjs.map +0 -7
- package/dist/lib/browser/ensure-companion-chat-ZEZA34MZ.mjs.map +0 -7
- package/dist/lib/browser/index.mjs +0 -3446
- package/dist/lib/browser/index.mjs.map +0 -7
- package/dist/lib/browser/meta.json +0 -1
- package/dist/lib/browser/on-create-space-54RNX5JI.mjs.map +0 -7
- package/dist/lib/browser/operations/index.mjs +0 -13
- package/dist/lib/browser/operations/index.mjs.map +0 -7
- package/dist/lib/browser/resolve-navigation-targets-NZOD66NY.mjs.map +0 -7
- package/dist/lib/browser/run-prompt-in-new-chat-THLK5YQC.mjs.map +0 -7
- package/dist/lib/browser/set-current-chat-LRS3VFSH.mjs.map +0 -7
- package/dist/lib/browser/types/index.mjs +0 -20
- package/dist/lib/browser/update-chat-name-3Y36KFAS.mjs.map +0 -7
- package/dist/lib/node-esm/AssistantSettings-UVUTKO7E.mjs +0 -98
- package/dist/lib/node-esm/AssistantSettings-UVUTKO7E.mjs.map +0 -7
- package/dist/lib/node-esm/blueprints/index.mjs +0 -9
- package/dist/lib/node-esm/chunk-HSLMI22Q.mjs +0 -11
- package/dist/lib/node-esm/chunk-NZIKC7AN.mjs +0 -32
- package/dist/lib/node-esm/chunk-NZIKC7AN.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-PXAJSTGZ.mjs +0 -177
- package/dist/lib/node-esm/chunk-PXAJSTGZ.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-W3JZ2F4T.mjs +0 -155
- package/dist/lib/node-esm/chunk-W3JZ2F4T.mjs.map +0 -7
- package/dist/lib/node-esm/cli/index.mjs +0 -75
- package/dist/lib/node-esm/cli/index.mjs.map +0 -7
- package/dist/lib/node-esm/create-chat-3BEG4R6J.mjs +0 -83
- package/dist/lib/node-esm/create-chat-3BEG4R6J.mjs.map +0 -7
- package/dist/lib/node-esm/ensure-companion-chat-6K2WEWFP.mjs +0 -66
- package/dist/lib/node-esm/ensure-companion-chat-6K2WEWFP.mjs.map +0 -7
- package/dist/lib/node-esm/index.mjs +0 -3447
- package/dist/lib/node-esm/index.mjs.map +0 -7
- package/dist/lib/node-esm/meta.json +0 -1
- package/dist/lib/node-esm/on-create-space-YRPZ6HZY.mjs +0 -23
- package/dist/lib/node-esm/on-create-space-YRPZ6HZY.mjs.map +0 -7
- package/dist/lib/node-esm/operations/index.mjs +0 -14
- package/dist/lib/node-esm/operations/index.mjs.map +0 -7
- package/dist/lib/node-esm/resolve-navigation-targets-3PPK7XLH.mjs +0 -23
- package/dist/lib/node-esm/resolve-navigation-targets-3PPK7XLH.mjs.map +0 -7
- package/dist/lib/node-esm/run-prompt-in-new-chat-OUYKCMQ7.mjs +0 -137
- package/dist/lib/node-esm/run-prompt-in-new-chat-OUYKCMQ7.mjs.map +0 -7
- package/dist/lib/node-esm/set-current-chat-SMXZJD3F.mjs +0 -55
- package/dist/lib/node-esm/set-current-chat-SMXZJD3F.mjs.map +0 -7
- package/dist/lib/node-esm/types/index.mjs +0 -21
- package/dist/lib/node-esm/update-chat-name-HM2P4NSI.mjs +0 -72
- package/dist/lib/node-esm/update-chat-name-HM2P4NSI.mjs.map +0 -7
- package/dist/types/src/cli/index.d.ts +0 -2
- package/dist/types/src/cli/index.d.ts.map +0 -1
- package/dist/types/src/cli/plugin.d.ts +0 -10
- package/dist/types/src/cli/plugin.d.ts.map +0 -1
- package/dist/types/src/components/ChatProgress/ChatProgress.d.ts +0 -10
- package/dist/types/src/components/ChatProgress/ChatProgress.d.ts.map +0 -1
- package/dist/types/src/components/ChatProgress/index.d.ts +0 -2
- package/dist/types/src/components/ChatProgress/index.d.ts.map +0 -1
- package/dist/types/src/components/ChatThread/widgets/PromptWidget.d.ts +0 -15
- package/dist/types/src/components/ChatThread/widgets/PromptWidget.d.ts.map +0 -1
- package/dist/types/src/containers/PromptArticle/PromptArticle.d.ts +0 -6
- package/dist/types/src/containers/PromptArticle/PromptArticle.d.ts.map +0 -1
- package/dist/types/src/containers/PromptArticle/index.d.ts +0 -2
- package/dist/types/src/containers/PromptArticle/index.d.ts.map +0 -1
- package/dist/types/src/containers/PromptList/PromptList.d.ts +0 -6
- package/dist/types/src/containers/PromptList/PromptList.d.ts.map +0 -1
- package/dist/types/src/containers/PromptList/PromptList.stories.d.ts.map +0 -1
- package/dist/types/src/containers/PromptList/index.d.ts +0 -2
- package/dist/types/src/containers/PromptList/index.d.ts.map +0 -1
- package/dist/types/src/operations/definitions.d.ts.map +0 -1
- package/dist/types/src/queue-logger.d.ts +0 -11
- package/dist/types/src/queue-logger.d.ts.map +0 -1
- package/dist/types/src/types/capabilities.d.ts +0 -32
- package/dist/types/src/types/capabilities.d.ts.map +0 -1
- package/dist/types/src/types/defs.d.ts +0 -2
- package/dist/types/src/types/defs.d.ts.map +0 -1
- package/dist/types/src/types/events.d.ts +0 -5
- package/dist/types/src/types/events.d.ts.map +0 -1
- package/src/AssistantPlugin.tsx +0 -238
- package/src/cli/plugin.ts +0 -84
- package/src/components/ChatProgress/ChatProgress.tsx +0 -56
- package/src/components/ChatProgress/index.ts +0 -5
- package/src/components/ChatThread/widgets/PromptWidget.ts +0 -30
- package/src/containers/PromptArticle/PromptArticle.tsx +0 -59
- package/src/containers/PromptArticle/index.ts +0 -5
- package/src/containers/PromptList/index.ts +0 -5
- package/src/types/capabilities.ts +0 -35
- package/src/types/defs.ts +0 -5
- package/src/types/events.ts +0 -11
- /package/dist/lib/{browser/blueprints/index.mjs.map → neutral/ChatContainer-VYVJYPPN.mjs.map} +0 -0
- /package/dist/lib/{browser/types → neutral/blueprints}/index.mjs.map +0 -0
- /package/dist/lib/{browser → neutral}/chunk-J5LGTIGS.mjs +0 -0
- /package/dist/lib/{browser → neutral}/chunk-J5LGTIGS.mjs.map +0 -0
- /package/dist/lib/{node-esm/blueprints → neutral}/index.mjs.map +0 -0
- /package/dist/lib/{node-esm/chunk-HSLMI22Q.mjs.map → neutral/meta.mjs.map} +0 -0
- /package/dist/lib/{node-esm/types → neutral/operations}/index.mjs.map +0 -0
|
@@ -9,39 +9,45 @@ import * as Layer from 'effect/Layer';
|
|
|
9
9
|
import React, { useEffect, useMemo, useState } from 'react';
|
|
10
10
|
|
|
11
11
|
import { withPluginManager } from '@dxos/app-framework/testing';
|
|
12
|
-
import {
|
|
12
|
+
import { createFeedServiceLayer } from '@dxos/client/echo';
|
|
13
|
+
import { Database, Feed, Filter, Query } from '@dxos/echo';
|
|
13
14
|
import { runAndForwardErrors } from '@dxos/effect';
|
|
14
|
-
import {
|
|
15
|
-
import { ClientPlugin } from '@dxos/plugin-client';
|
|
15
|
+
import { ClientPlugin } from '@dxos/plugin-client/plugin';
|
|
16
16
|
import { initializeIdentity } from '@dxos/plugin-client/testing';
|
|
17
|
-
import { PreviewPlugin } from '@dxos/plugin-preview';
|
|
17
|
+
import { PreviewPlugin } from '@dxos/plugin-preview/testing';
|
|
18
18
|
import { StorybookPlugin, corePlugins } from '@dxos/plugin-testing';
|
|
19
19
|
import { random } from '@dxos/random';
|
|
20
|
-
import {
|
|
20
|
+
import { useQuery, useSpaces } from '@dxos/react-client/echo';
|
|
21
21
|
import { EditorPreviewProvider } from '@dxos/react-ui-editor';
|
|
22
22
|
import { Loading, withLayout, withTheme } from '@dxos/react-ui/testing';
|
|
23
23
|
import { Message, Organization, Person } from '@dxos/types';
|
|
24
24
|
|
|
25
25
|
import { createMessageGenerator } from '#testing';
|
|
26
|
+
import { translations } from '#translations';
|
|
26
27
|
|
|
27
|
-
import { translations } from '../../translations';
|
|
28
28
|
import { ChatThread, type ChatThreadProps } from './ChatThread';
|
|
29
29
|
|
|
30
30
|
random.seed(1);
|
|
31
31
|
|
|
32
|
-
type MessageGenerator = Effect.Effect<void, never, Database.Service |
|
|
32
|
+
type MessageGenerator = Effect.Effect<void, never, Database.Service | Feed.ContextFeedService | Feed.FeedService>;
|
|
33
33
|
|
|
34
34
|
type DefaultStoryProps = { generator?: MessageGenerator[]; delay?: number; wait?: boolean } & ChatThreadProps;
|
|
35
35
|
|
|
36
36
|
const DefaultStory = ({ generator = [], delay = 0, wait, ...props }: DefaultStoryProps) => {
|
|
37
37
|
const [space] = useSpaces();
|
|
38
|
-
const
|
|
39
|
-
|
|
38
|
+
const feed = useMemo<Feed.Feed | undefined>(
|
|
39
|
+
() => (space ? space.db.add(Feed.make({ name: 'chat' })) : undefined),
|
|
40
|
+
[space],
|
|
41
|
+
);
|
|
42
|
+
const messages = useQuery(
|
|
43
|
+
space?.db,
|
|
44
|
+
feed ? Query.select(Filter.type(Message.Message)).from(feed) : Query.select(Filter.nothing()),
|
|
45
|
+
);
|
|
40
46
|
const [done, setDone] = useState(false);
|
|
41
47
|
|
|
42
48
|
// Generate messages.
|
|
43
49
|
useEffect(() => {
|
|
44
|
-
if (!space || !
|
|
50
|
+
if (!space || !feed) {
|
|
45
51
|
return;
|
|
46
52
|
}
|
|
47
53
|
|
|
@@ -55,13 +61,21 @@ const DefaultStory = ({ generator = [], delay = 0, wait, ...props }: DefaultStor
|
|
|
55
61
|
}
|
|
56
62
|
|
|
57
63
|
setDone(true);
|
|
58
|
-
}).pipe(
|
|
64
|
+
}).pipe(
|
|
65
|
+
Effect.provide(
|
|
66
|
+
Layer.mergeAll(
|
|
67
|
+
Database.layer(space.db),
|
|
68
|
+
Feed.ContextFeedService.layer(feed),
|
|
69
|
+
createFeedServiceLayer(space.queues),
|
|
70
|
+
),
|
|
71
|
+
),
|
|
72
|
+
),
|
|
59
73
|
);
|
|
60
74
|
|
|
61
75
|
return () => {
|
|
62
76
|
void runAndForwardErrors(Fiber.interrupt(fiber));
|
|
63
77
|
};
|
|
64
|
-
}, [space,
|
|
78
|
+
}, [space, feed, generator, delay]);
|
|
65
79
|
|
|
66
80
|
if (wait && !done) {
|
|
67
81
|
return <Loading data={{ wait, done }} />;
|
|
@@ -74,23 +88,6 @@ const DefaultStory = ({ generator = [], delay = 0, wait, ...props }: DefaultStor
|
|
|
74
88
|
);
|
|
75
89
|
};
|
|
76
90
|
|
|
77
|
-
const useQueueMessages = (queue?: Queue<Message.Message>) => {
|
|
78
|
-
const [messages, setMessages] = useState<Message.Message[]>([]);
|
|
79
|
-
|
|
80
|
-
useEffect(() => {
|
|
81
|
-
if (!queue) {
|
|
82
|
-
setMessages([]);
|
|
83
|
-
return;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
const update = () => setMessages([...queue.objects]);
|
|
87
|
-
update();
|
|
88
|
-
return queue.subscribe(update);
|
|
89
|
-
}, [queue]);
|
|
90
|
-
|
|
91
|
-
return messages;
|
|
92
|
-
};
|
|
93
|
-
|
|
94
91
|
const meta = {
|
|
95
92
|
title: 'plugins/plugin-assistant/components/ChatThread',
|
|
96
93
|
component: ChatThread,
|
|
@@ -136,7 +133,7 @@ export const Delayed: Story = {
|
|
|
136
133
|
delay: 500,
|
|
137
134
|
options: {
|
|
138
135
|
autoScroll: true,
|
|
139
|
-
|
|
136
|
+
typewriter: true,
|
|
140
137
|
cursor: true,
|
|
141
138
|
},
|
|
142
139
|
},
|
|
@@ -7,23 +7,20 @@ import React, { forwardRef, useCallback, useEffect, useMemo, useState } from 're
|
|
|
7
7
|
import { PublicKey } from '@dxos/keys';
|
|
8
8
|
import { type Identity } from '@dxos/react-client/halo';
|
|
9
9
|
import { type ThemedClassName, setRef } from '@dxos/react-ui';
|
|
10
|
-
import { MarkdownStream, type MarkdownStreamController, type MarkdownStreamProps } from '@dxos/react-ui-
|
|
10
|
+
import { MarkdownStream, type MarkdownStreamController, type MarkdownStreamProps } from '@dxos/react-ui-markdown';
|
|
11
11
|
import { type Message } from '@dxos/types';
|
|
12
|
-
import { mx } from '@dxos/ui-theme';
|
|
13
12
|
import { keyToFallback } from '@dxos/util';
|
|
14
13
|
|
|
14
|
+
import { type Assistant } from '../../types';
|
|
15
15
|
import { type ChatEvent } from '../Chat';
|
|
16
|
-
import {
|
|
16
|
+
import { componentRegistry, createBlockRenderer } from './registry';
|
|
17
17
|
import { MessageSyncer } from './sync';
|
|
18
18
|
|
|
19
19
|
const defaultOptions: MarkdownStreamProps['options'] = {
|
|
20
20
|
autoScroll: true,
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
// see in the MarkdownStream/Reasoning story.
|
|
25
|
-
wire: true,
|
|
26
|
-
cursor: true,
|
|
21
|
+
cursor: false,
|
|
22
|
+
fader: false,
|
|
23
|
+
typewriter: true,
|
|
27
24
|
};
|
|
28
25
|
|
|
29
26
|
export type ChatThreadProps = ThemedClassName<
|
|
@@ -31,13 +28,27 @@ export type ChatThreadProps = ThemedClassName<
|
|
|
31
28
|
identity?: Identity;
|
|
32
29
|
messages?: Message.Message[];
|
|
33
30
|
error?: Error;
|
|
31
|
+
viewType?: Assistant.ChatView;
|
|
34
32
|
onEvent?: (event: ChatEvent) => void;
|
|
35
|
-
} & Pick<MarkdownStreamProps, 'options' | 'debug'>
|
|
33
|
+
} & Pick<MarkdownStreamProps, 'options' | 'debug' | 'extensions' | 'footer'>
|
|
36
34
|
>;
|
|
37
35
|
|
|
38
|
-
// TODO(burdon): Memo thread position.
|
|
39
36
|
export const ChatThread = forwardRef<MarkdownStreamController | null, ChatThreadProps>(
|
|
40
|
-
(
|
|
37
|
+
(
|
|
38
|
+
{
|
|
39
|
+
classNames,
|
|
40
|
+
identity,
|
|
41
|
+
messages = [],
|
|
42
|
+
error,
|
|
43
|
+
options = defaultOptions,
|
|
44
|
+
footer,
|
|
45
|
+
debug = false,
|
|
46
|
+
extensions,
|
|
47
|
+
viewType,
|
|
48
|
+
onEvent,
|
|
49
|
+
},
|
|
50
|
+
forwardedRef,
|
|
51
|
+
) => {
|
|
41
52
|
const [controller, setController] = useState<MarkdownStreamController | null>(null);
|
|
42
53
|
const handleMarkdownStreamRef = useCallback(
|
|
43
54
|
(instance: MarkdownStreamController | null) => {
|
|
@@ -58,11 +69,13 @@ export const ChatThread = forwardRef<MarkdownStreamController | null, ChatThread
|
|
|
58
69
|
}, [controller, error]);
|
|
59
70
|
|
|
60
71
|
// Update document.
|
|
61
|
-
const
|
|
72
|
+
const renderer = useMemo(() => createBlockRenderer(viewType), [viewType]);
|
|
73
|
+
const syncer = useMemo(() => controller && new MessageSyncer(controller, renderer), [controller, renderer]);
|
|
62
74
|
useEffect(() => {
|
|
63
75
|
if (!syncer) {
|
|
64
76
|
return;
|
|
65
77
|
}
|
|
78
|
+
|
|
66
79
|
if (syncer.update(messages)) {
|
|
67
80
|
controller?.scrollToBottom('instant');
|
|
68
81
|
}
|
|
@@ -82,15 +95,15 @@ export const ChatThread = forwardRef<MarkdownStreamController | null, ChatThread
|
|
|
82
95
|
);
|
|
83
96
|
|
|
84
97
|
return (
|
|
85
|
-
<div
|
|
86
|
-
role='none'
|
|
87
|
-
data-hue={userHue}
|
|
88
|
-
className={mx('flex h-full w-full justify-center overflow-hidden', classNames)}
|
|
89
|
-
>
|
|
98
|
+
<div data-hue={userHue} className='contents'>
|
|
90
99
|
<MarkdownStream
|
|
100
|
+
key={viewType}
|
|
101
|
+
classNames={classNames}
|
|
91
102
|
registry={componentRegistry}
|
|
92
103
|
options={options}
|
|
93
104
|
debug={debug}
|
|
105
|
+
extensions={extensions}
|
|
106
|
+
footer={footer}
|
|
94
107
|
onEvent={handleEvent}
|
|
95
108
|
ref={handleMarkdownStreamRef}
|
|
96
109
|
/>
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# Dataflow from AI to Codemirror
|
|
2
|
+
|
|
3
|
+
AiSession (packages/core/assistant/src/conversation/session.ts)
|
|
4
|
+
│
|
|
5
|
+
│ emits ephemeral Trace events containing
|
|
6
|
+
│ PartialBlock { messageId, role, block: ContentBlock.Any }
|
|
7
|
+
│ via AgentService.Session.subscribeEphemeral(): Stream<Trace.Message>
|
|
8
|
+
▼
|
|
9
|
+
AiChatProcessor (packages/plugins/plugin-assistant/src/processor/processor.ts)
|
|
10
|
+
│
|
|
11
|
+
│ Stream.runForEach → if Trace.isOfType(PartialBlock) →
|
|
12
|
+
│ #handleEphemeralMessage(event.data)
|
|
13
|
+
│ → upserts Message.Message into #streaming atom
|
|
14
|
+
│ → finalizes into #messages atom on complete block
|
|
15
|
+
▼
|
|
16
|
+
Chat.tsx (packages/plugins/plugin-assistant/src/components/Chat/Chat.tsx)
|
|
17
|
+
│
|
|
18
|
+
│ reads processor.messages + processor.streaming atoms,
|
|
19
|
+
│ passes flat Message[] down to ChatThread
|
|
20
|
+
▼
|
|
21
|
+
ChatThread.tsx (packages/plugins/plugin-assistant/src/components/ChatThread/ChatThread.tsx)
|
|
22
|
+
│
|
|
23
|
+
│ MessageSyncer (sync.ts) compares current messages
|
|
24
|
+
│ to last rendered set:
|
|
25
|
+
│ - new finalized chunk → controller.append(delta)
|
|
26
|
+
│ - changed earlier message → controller.setContent(full)
|
|
27
|
+
│ blockToMarkdown serializes ContentBlocks → markdown,
|
|
28
|
+
│ embedding tool calls as XML widget tags
|
|
29
|
+
│ (e.g. <tool-call name="...">...</tool-call>)
|
|
30
|
+
▼
|
|
31
|
+
MarkdownStreamController.append / setContent
|
|
32
|
+
▼
|
|
33
|
+
MarkdownStream (packages/ui/react-ui-markdown/src/MarkdownStream/MarkdownStream.tsx)
|
|
34
|
+
│
|
|
35
|
+
│ CodeMirror editor with:
|
|
36
|
+
│ - extendedMarkdown (parseMixed → xmlLanguage on HTMLBlock/Paragraph)
|
|
37
|
+
│ - xmlTags (registry → React/native widget portals)
|
|
38
|
+
│ - wire extension (buffers appended text, drips at typewriter rate,
|
|
39
|
+
│ treats XML atomic ranges as indivisible units)
|
|
40
|
+
▼
|
|
41
|
+
Rendered DOM (markdown + portaled widgets for tool calls / reasoning / etc.)
|
|
@@ -15,12 +15,13 @@ import {
|
|
|
15
15
|
type MarkdownStreamController,
|
|
16
16
|
type MarkdownStreamProps,
|
|
17
17
|
textStream,
|
|
18
|
-
} from '@dxos/react-ui-
|
|
18
|
+
} from '@dxos/react-ui-markdown';
|
|
19
19
|
import { withLayout, withTheme } from '@dxos/react-ui/testing';
|
|
20
20
|
import { type ContentBlock } from '@dxos/types';
|
|
21
21
|
import { keyToFallback } from '@dxos/util';
|
|
22
22
|
|
|
23
|
-
import { translations } from '
|
|
23
|
+
import { translations } from '#translations';
|
|
24
|
+
|
|
24
25
|
import { componentRegistry } from './registry';
|
|
25
26
|
import REASONING from './testing/reasoning.md?raw';
|
|
26
27
|
import THINKING from './testing/thinking.md?raw';
|
|
@@ -207,7 +208,7 @@ export const Streaming: Story = {
|
|
|
207
208
|
content: THREAD_1,
|
|
208
209
|
options: {
|
|
209
210
|
autoScroll: true,
|
|
210
|
-
|
|
211
|
+
typewriter: true,
|
|
211
212
|
cursor: true,
|
|
212
213
|
},
|
|
213
214
|
},
|
|
@@ -273,7 +274,7 @@ export const Reasoning: Story = {
|
|
|
273
274
|
content: REASONING_PARTS.body,
|
|
274
275
|
options: {
|
|
275
276
|
autoScroll: true,
|
|
276
|
-
|
|
277
|
+
typewriter: true,
|
|
277
278
|
cursor: true,
|
|
278
279
|
},
|
|
279
280
|
},
|
|
@@ -8,11 +8,11 @@ import { log } from '@dxos/log';
|
|
|
8
8
|
import { ContentBlock, type Message } from '@dxos/types';
|
|
9
9
|
import { type XmlWidgetRegistry, getXmlTextChild } from '@dxos/ui-editor';
|
|
10
10
|
|
|
11
|
+
import { type Assistant } from '../../types';
|
|
11
12
|
import { type BlockRenderer, type MessageThreadContext } from './sync';
|
|
12
13
|
import { applyToolBlockToWidgetState } from './tool-widget-state';
|
|
13
14
|
import {
|
|
14
15
|
FallbackWidget,
|
|
15
|
-
PromptWidget,
|
|
16
16
|
ReasoningWidget,
|
|
17
17
|
ReferenceWidget,
|
|
18
18
|
SelectWidget,
|
|
@@ -25,19 +25,28 @@ import {
|
|
|
25
25
|
|
|
26
26
|
/**
|
|
27
27
|
* Custom XML tags registry.
|
|
28
|
+
*
|
|
29
|
+
* NOTE: `<prompt>` has no widget — it is rendered via mark + line decorations
|
|
30
|
+
* (`xmlBlockDecoration`) in MarkdownStream so the prompt text remains part of the document
|
|
31
|
+
* and can be highlighted by `xmlFormatting`. It is still listed here so the markdown block
|
|
32
|
+
* parser (`xmlBlockParsers`) knows to keep `<prompt>...</prompt>` as a single HTMLBlock
|
|
33
|
+
* — otherwise an unregistered prompt opens a Paragraph that lazy-continues into the
|
|
34
|
+
* following lines and breaks parsing of subsequent multi-line tags (e.g. a `<reasoning>`
|
|
35
|
+
* block whose content contains an ordered list).
|
|
28
36
|
*/
|
|
29
37
|
export const componentRegistry: XmlWidgetRegistry = {
|
|
30
38
|
//
|
|
31
|
-
//
|
|
39
|
+
// Block-only (no widget — see note above).
|
|
32
40
|
//
|
|
33
41
|
|
|
34
42
|
prompt: {
|
|
35
43
|
block: true,
|
|
36
|
-
factory: ({ children }) => {
|
|
37
|
-
const text = getXmlTextChild(children);
|
|
38
|
-
return text ? new PromptWidget(text) : null;
|
|
39
|
-
},
|
|
40
44
|
},
|
|
45
|
+
|
|
46
|
+
//
|
|
47
|
+
// DOM Widgets
|
|
48
|
+
//
|
|
49
|
+
|
|
41
50
|
synthetic: {
|
|
42
51
|
block: true,
|
|
43
52
|
factory: ({ children, range }) => {
|
|
@@ -89,9 +98,9 @@ export const componentRegistry: XmlWidgetRegistry = {
|
|
|
89
98
|
status: {
|
|
90
99
|
block: true,
|
|
91
100
|
streaming: true,
|
|
92
|
-
factory: ({ children
|
|
101
|
+
factory: ({ children }) => {
|
|
93
102
|
const text = getXmlTextChild(children);
|
|
94
|
-
return text ? new StatusWidget(text
|
|
103
|
+
return text ? new StatusWidget(text) : null;
|
|
95
104
|
},
|
|
96
105
|
},
|
|
97
106
|
|
|
@@ -106,7 +115,7 @@ export const componentRegistry: XmlWidgetRegistry = {
|
|
|
106
115
|
toolCall: {
|
|
107
116
|
block: true,
|
|
108
117
|
Component: (props) => (
|
|
109
|
-
<div
|
|
118
|
+
<div className='py-2'>
|
|
110
119
|
<ToolWidget {...props} />
|
|
111
120
|
</div>
|
|
112
121
|
),
|
|
@@ -133,17 +142,51 @@ export const componentRegistry: XmlWidgetRegistry = {
|
|
|
133
142
|
/**
|
|
134
143
|
* Convert block to markdown.
|
|
135
144
|
*/
|
|
136
|
-
export const blockToMarkdown: BlockRenderer = (
|
|
137
|
-
|
|
145
|
+
export const blockToMarkdown: BlockRenderer = createBlockRenderer('normal');
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* Create a {@link BlockRenderer} that filters blocks based on the chat view type.
|
|
149
|
+
*
|
|
150
|
+
* - `summary`: only user prompts.
|
|
151
|
+
* - `normal`: user prompts + assistant text + tool calls + summary/select/suggestion/reference + status. Hides reasoning.
|
|
152
|
+
* - `thinking`: same as normal plus reasoning.
|
|
153
|
+
* - `debug`: renders every block (raw fallbacks visible).
|
|
154
|
+
*/
|
|
155
|
+
export function createBlockRenderer(viewType: Assistant.ChatView | undefined): BlockRenderer {
|
|
156
|
+
return (context, message, block) => {
|
|
157
|
+
if (!isBlockVisible(viewType, message, block)) {
|
|
158
|
+
return;
|
|
159
|
+
}
|
|
160
|
+
let str = blockToMarkdownImpl(context, message, block);
|
|
161
|
+
if (str && !block.pending) {
|
|
162
|
+
// Use a blank line as the block separator so each rendered block parses as its own
|
|
163
|
+
// markdown block. A single newline lets CommonMark absorb a following `<prompt>` (an
|
|
164
|
+
// HTML type-7 tag, which can't interrupt an open paragraph) into the previous
|
|
165
|
+
// paragraph, rendering the prompt bubble inline next to the prior assistant text.
|
|
166
|
+
return (str += '\n');
|
|
167
|
+
}
|
|
168
|
+
return str;
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
const isBlockVisible = (
|
|
173
|
+
viewType: Assistant.ChatView | undefined,
|
|
138
174
|
message: Message.Message,
|
|
139
175
|
block: ContentBlock.Any,
|
|
140
|
-
) => {
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
176
|
+
): boolean => {
|
|
177
|
+
switch (viewType) {
|
|
178
|
+
case 'debug':
|
|
179
|
+
return true;
|
|
180
|
+
case 'normal':
|
|
181
|
+
return block._tag !== 'reasoning';
|
|
182
|
+
case 'summary':
|
|
183
|
+
// Show only conversational text (user prompts + assistant replies); hide reasoning,
|
|
184
|
+
// tool calls, status, stats, and synthetic system messages.
|
|
185
|
+
return block._tag === 'text' && (block as ContentBlock.Text).disposition !== 'synthetic';
|
|
186
|
+
case 'thinking':
|
|
187
|
+
default:
|
|
188
|
+
return true;
|
|
144
189
|
}
|
|
145
|
-
|
|
146
|
-
return str;
|
|
147
190
|
};
|
|
148
191
|
|
|
149
192
|
const blockToMarkdownImpl = (context: MessageThreadContext, message: Message.Message, block: ContentBlock.Any) => {
|
|
@@ -154,7 +197,7 @@ const blockToMarkdownImpl = (context: MessageThreadContext, message: Message.Mes
|
|
|
154
197
|
if (block.disposition === 'synthetic') {
|
|
155
198
|
return renderXMLBlock('synthetic', { content: block.text, pending: block.pending });
|
|
156
199
|
} else {
|
|
157
|
-
return
|
|
200
|
+
return `\n<prompt>${block.text}</prompt>`;
|
|
158
201
|
}
|
|
159
202
|
} else {
|
|
160
203
|
const text = block.text.trim();
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
// @vitest-environment jsdom
|
|
2
|
-
|
|
3
1
|
//
|
|
4
2
|
// Copyright 2025 DXOS.org
|
|
5
3
|
//
|
|
6
4
|
|
|
5
|
+
// @vitest-environment jsdom
|
|
6
|
+
|
|
7
7
|
import { EditorView } from '@codemirror/view';
|
|
8
8
|
import { describe, it } from '@effect/vitest';
|
|
9
9
|
import * as Effect from 'effect/Effect';
|
|
@@ -14,7 +14,7 @@ import { type ContentBlock, type Message } from '@dxos/types';
|
|
|
14
14
|
|
|
15
15
|
import { createMessage } from '#testing';
|
|
16
16
|
|
|
17
|
-
import {
|
|
17
|
+
import { createBlockRenderer } from './registry';
|
|
18
18
|
import { type BlockRenderer, MessageSyncer, type MessageThreadContext, type TextModel } from './sync';
|
|
19
19
|
|
|
20
20
|
class TestDocument implements TextModel {
|
|
@@ -48,7 +48,7 @@ describe('reducers', () => {
|
|
|
48
48
|
'basic sync',
|
|
49
49
|
Effect.fn(function* ({ expect }) {
|
|
50
50
|
const doc = new TestDocument();
|
|
51
|
-
const syncer = new MessageSyncer(doc,
|
|
51
|
+
const syncer = new MessageSyncer(doc, createBlockRenderer('thinking'));
|
|
52
52
|
|
|
53
53
|
const messages = [
|
|
54
54
|
createMessage('user', [{ _tag: 'text', text: 'Hello' }]),
|
|
@@ -56,13 +56,13 @@ describe('reducers', () => {
|
|
|
56
56
|
];
|
|
57
57
|
|
|
58
58
|
syncer.update(messages);
|
|
59
|
-
expect(doc.content).toEqual(
|
|
59
|
+
expect(doc.content).toEqual('\n<prompt>Hello</prompt>\nHi there!\n');
|
|
60
60
|
|
|
61
|
-
Obj.
|
|
61
|
+
Obj.update(messages[1], (obj) => {
|
|
62
62
|
obj.blocks.push({ _tag: 'text', text: 'How can I help?' });
|
|
63
63
|
});
|
|
64
64
|
syncer.update(messages);
|
|
65
|
-
expect(doc.content).toEqual(
|
|
65
|
+
expect(doc.content).toEqual('\n<prompt>Hello</prompt>\nHi there!\nHow can I help?\n');
|
|
66
66
|
}),
|
|
67
67
|
);
|
|
68
68
|
|
|
@@ -70,7 +70,7 @@ describe('reducers', () => {
|
|
|
70
70
|
'sync with partial updates',
|
|
71
71
|
Effect.fn(function* ({ expect }) {
|
|
72
72
|
const doc = new TestDocument();
|
|
73
|
-
const syncer = new MessageSyncer(doc,
|
|
73
|
+
const syncer = new MessageSyncer(doc, createBlockRenderer('thinking'));
|
|
74
74
|
|
|
75
75
|
const messages = [
|
|
76
76
|
createMessage('user', [{ _tag: 'text', text: 'Hello' }]),
|
|
@@ -78,22 +78,20 @@ describe('reducers', () => {
|
|
|
78
78
|
];
|
|
79
79
|
|
|
80
80
|
syncer.update(messages);
|
|
81
|
-
expect(doc.content).toEqual(
|
|
81
|
+
expect(doc.content).toEqual('\n<prompt>Hello</prompt>\nHi there!');
|
|
82
82
|
|
|
83
|
-
Obj.
|
|
83
|
+
Obj.update(messages[1], (obj) => {
|
|
84
84
|
const block = obj.blocks[0] as Mutable<ContentBlock.Text>;
|
|
85
85
|
block.text = 'Hi there! How are you?';
|
|
86
86
|
block.pending = false;
|
|
87
87
|
});
|
|
88
88
|
syncer.update(messages);
|
|
89
89
|
|
|
90
|
-
Obj.
|
|
90
|
+
Obj.update(messages[1], (obj) => {
|
|
91
91
|
obj.blocks.push({ _tag: 'text', text: 'How can I help?' });
|
|
92
92
|
});
|
|
93
93
|
syncer.update(messages);
|
|
94
|
-
expect(doc.content).toEqual(
|
|
95
|
-
['<prompt>Hello</prompt>', 'Hi there! How are you?', 'How can I help?', ''].join('\n'),
|
|
96
|
-
);
|
|
94
|
+
expect(doc.content).toEqual('\n<prompt>Hello</prompt>\nHi there! How are you?\nHow can I help?\n');
|
|
97
95
|
}),
|
|
98
96
|
);
|
|
99
97
|
|
|
@@ -105,10 +103,10 @@ describe('reducers', () => {
|
|
|
105
103
|
'streaming reasoning with list-marker transitions does not duplicate opening tag',
|
|
106
104
|
Effect.fn(function* ({ expect }) {
|
|
107
105
|
const doc = new TestDocument();
|
|
108
|
-
const syncer = new MessageSyncer(doc,
|
|
106
|
+
const syncer = new MessageSyncer(doc, createBlockRenderer('thinking'));
|
|
109
107
|
|
|
110
108
|
const setReasoning = (message: Message.Message, text: string, pending: boolean) => {
|
|
111
|
-
Obj.
|
|
109
|
+
Obj.update(message, (message) => {
|
|
112
110
|
const block = message.blocks[0] as Mutable<ContentBlock.Reasoning>;
|
|
113
111
|
block.reasoningText = text;
|
|
114
112
|
block.pending = pending;
|
|
@@ -143,6 +141,74 @@ describe('reducers', () => {
|
|
|
143
141
|
}),
|
|
144
142
|
);
|
|
145
143
|
|
|
144
|
+
// Regression: prompt "respond with your name inside an xml tag" produces a streamed
|
|
145
|
+
// reasoning block followed by a text block containing a non-registered XML tag
|
|
146
|
+
// (`<name>Claude</name>`). The text block must appear in the document AFTER the
|
|
147
|
+
// closed reasoning block — the bug symptom is the reasoning tag rendering with no
|
|
148
|
+
// follow-up response visible.
|
|
149
|
+
it.effect(
|
|
150
|
+
'reasoning block followed by text containing a non-registered xml tag',
|
|
151
|
+
Effect.fn(function* ({ expect }) {
|
|
152
|
+
const doc = new TestDocument();
|
|
153
|
+
const syncer = new MessageSyncer(doc, createBlockRenderer('thinking'));
|
|
154
|
+
|
|
155
|
+
const setReasoning = (message: Message.Message, text: string, pending: boolean) => {
|
|
156
|
+
Obj.update(message, (message) => {
|
|
157
|
+
const block = message.blocks[0] as Mutable<ContentBlock.Reasoning>;
|
|
158
|
+
block.reasoningText = text;
|
|
159
|
+
block.pending = pending;
|
|
160
|
+
});
|
|
161
|
+
};
|
|
162
|
+
|
|
163
|
+
const setText = (message: Message.Message, text: string, pending: boolean) => {
|
|
164
|
+
Obj.update(message, (message) => {
|
|
165
|
+
const block = message.blocks[1] as Mutable<ContentBlock.Text>;
|
|
166
|
+
block.text = text;
|
|
167
|
+
block.pending = pending;
|
|
168
|
+
});
|
|
169
|
+
};
|
|
170
|
+
|
|
171
|
+
// Tick 1: reasoning starts streaming.
|
|
172
|
+
const messages = [createMessage('assistant', [{ _tag: 'reasoning', reasoningText: 'Thinking', pending: true }])];
|
|
173
|
+
syncer.update(messages);
|
|
174
|
+
|
|
175
|
+
// Tick 2: reasoning grows.
|
|
176
|
+
setReasoning(messages[0], 'Thinking about the answer', true);
|
|
177
|
+
syncer.update(messages);
|
|
178
|
+
|
|
179
|
+
// Tick 3: reasoning closes.
|
|
180
|
+
setReasoning(messages[0], 'Thinking about the answer', false);
|
|
181
|
+
syncer.update(messages);
|
|
182
|
+
|
|
183
|
+
// Tick 4: text block appears, pending and empty (model has started emitting but text is still '').
|
|
184
|
+
Obj.update(messages[0], (message) => {
|
|
185
|
+
message.blocks.push({ _tag: 'text', text: '', pending: true });
|
|
186
|
+
});
|
|
187
|
+
syncer.update(messages);
|
|
188
|
+
|
|
189
|
+
// Tick 5: partial text — opening tag only.
|
|
190
|
+
setText(messages[0], '<name>', true);
|
|
191
|
+
syncer.update(messages);
|
|
192
|
+
|
|
193
|
+
// Tick 6: full text streamed.
|
|
194
|
+
setText(messages[0], '<name>Claude</name>', true);
|
|
195
|
+
syncer.update(messages);
|
|
196
|
+
|
|
197
|
+
// Tick 7: text finalised.
|
|
198
|
+
setText(messages[0], '<name>Claude</name>', false);
|
|
199
|
+
syncer.update(messages);
|
|
200
|
+
|
|
201
|
+
// Both the closed reasoning tag and the response text must be present.
|
|
202
|
+
expect(doc.content).toContain('<reasoning>Thinking about the answer</reasoning>');
|
|
203
|
+
expect(doc.content).toContain('<name>Claude</name>');
|
|
204
|
+
|
|
205
|
+
const openReasoning = (doc.content.match(/<reasoning>/g) ?? []).length;
|
|
206
|
+
const closeReasoning = (doc.content.match(/<\/reasoning>/g) ?? []).length;
|
|
207
|
+
expect(openReasoning).toBe(1);
|
|
208
|
+
expect(closeReasoning).toBe(1);
|
|
209
|
+
}),
|
|
210
|
+
);
|
|
211
|
+
|
|
146
212
|
// Direct test of `MessageSyncer`'s tolerance for non-monotonic renderer output —
|
|
147
213
|
// any renderer that produces a shorter string for the same streaming block (e.g., due
|
|
148
214
|
// to whitespace normalisation or future transforms) must not produce duplicate output.
|
|
@@ -170,12 +236,12 @@ describe('reducers', () => {
|
|
|
170
236
|
const messages = [createMessage('assistant', [{ _tag: 'reasoning', reasoningText: 'abc\n1.', pending: true }])];
|
|
171
237
|
|
|
172
238
|
syncer.update(messages);
|
|
173
|
-
Obj.
|
|
239
|
+
Obj.update(messages[0], (obj) => {
|
|
174
240
|
const block = obj.blocks[0] as Mutable<ContentBlock.Reasoning>;
|
|
175
241
|
block.reasoningText = 'abc\n1. ';
|
|
176
242
|
});
|
|
177
243
|
syncer.update(messages);
|
|
178
|
-
Obj.
|
|
244
|
+
Obj.update(messages[0], (obj) => {
|
|
179
245
|
const block = obj.blocks[0] as Mutable<ContentBlock.Reasoning>;
|
|
180
246
|
block.reasoningText = 'abc\n1. tail';
|
|
181
247
|
block.pending = false;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { type DXN } from '@dxos/echo';
|
|
6
|
-
import { type MarkdownStreamController } from '@dxos/react-ui-
|
|
6
|
+
import { type MarkdownStreamController } from '@dxos/react-ui-markdown';
|
|
7
7
|
import { type ContentBlock, type Message } from '@dxos/types';
|
|
8
8
|
import { type StateDispatch, type XmlWidgetStateManager } from '@dxos/ui-editor';
|
|
9
9
|
|
|
@@ -6,6 +6,8 @@ import { WidgetType } from '@codemirror/view';
|
|
|
6
6
|
|
|
7
7
|
import { Domino } from '@dxos/ui';
|
|
8
8
|
|
|
9
|
+
import { styles } from './defaults';
|
|
10
|
+
|
|
9
11
|
/**
|
|
10
12
|
* Props used to derive a stable key for a reasoning block across CodeMirror widget rebuilds.
|
|
11
13
|
* CodeMirror does not assign persistent IDs to widgets; streaming re-runs the factory each tick.
|
|
@@ -36,26 +38,24 @@ export class ReasoningWidget extends WidgetType {
|
|
|
36
38
|
}
|
|
37
39
|
|
|
38
40
|
override toDOM() {
|
|
39
|
-
|
|
40
|
-
.classNames(
|
|
41
|
+
return Domino.of('div')
|
|
42
|
+
.classNames(styles.padding)
|
|
41
43
|
.append(
|
|
42
44
|
Domino.of('div')
|
|
43
|
-
.classNames('relative overflow-hidden p-px
|
|
45
|
+
.classNames('relative overflow-hidden p-px', styles.border)
|
|
44
46
|
.attributes({ 'data-trail-container': '' })
|
|
45
47
|
.append(
|
|
46
48
|
Domino.of('div')
|
|
47
|
-
.classNames('relative z-10 bg-base-surface rounded-sm text-sm text-
|
|
49
|
+
.classNames('relative z-10 bg-base-surface rounded-sm text-sm text-subdued py-1')
|
|
48
50
|
.append(
|
|
49
51
|
Domino.of('div')
|
|
50
|
-
.classNames('max-h-[5lh] overflow-y-auto')
|
|
52
|
+
.classNames('px-2 max-h-[5lh] overflow-y-auto dx-scrollbar-thin')
|
|
51
53
|
.text(this.text)
|
|
52
54
|
.attributes({ 'data-reasoning-text': '' }),
|
|
53
55
|
),
|
|
54
56
|
Domino.of('div').attributes({ 'data-id': this.#pos }),
|
|
55
57
|
),
|
|
56
58
|
).root;
|
|
57
|
-
|
|
58
|
-
return root;
|
|
59
59
|
}
|
|
60
60
|
|
|
61
61
|
override updateDOM(dom: HTMLElement) {
|
|
@@ -6,6 +6,8 @@ import { WidgetType } from '@codemirror/view';
|
|
|
6
6
|
|
|
7
7
|
import { Domino } from '@dxos/ui';
|
|
8
8
|
|
|
9
|
+
import { styles } from './defaults';
|
|
10
|
+
|
|
9
11
|
export class ReferenceWidget extends WidgetType {
|
|
10
12
|
constructor(
|
|
11
13
|
private text: string,
|
|
@@ -20,7 +22,7 @@ export class ReferenceWidget extends WidgetType {
|
|
|
20
22
|
|
|
21
23
|
override toDOM() {
|
|
22
24
|
return Domino.of('div')
|
|
23
|
-
.classNames(
|
|
25
|
+
.classNames(styles.padding)
|
|
24
26
|
.append(
|
|
25
27
|
Domino.of('dx-anchor' as any)
|
|
26
28
|
.classNames('dx-tag--anchor')
|