@dxos/plugin-assistant 0.8.4-main.422d1c7879 → 0.8.4-main.51f1e5ca51
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/AssistantSettings-GG52BLKS.mjs +40 -0
- package/dist/lib/browser/AssistantSettings-GG52BLKS.mjs.map +7 -0
- package/dist/lib/browser/blueprints/index.mjs +26 -3
- package/dist/lib/browser/blueprints/index.mjs.map +4 -4
- package/dist/lib/browser/{chunk-ATHYBVGN.mjs → chunk-RIJNPAYC.mjs} +5 -5
- package/dist/lib/browser/chunk-RIJNPAYC.mjs.map +7 -0
- package/dist/lib/browser/{chunk-LMVTXH54.mjs → chunk-SEMCG4ZK.mjs} +58 -17
- package/dist/lib/browser/chunk-SEMCG4ZK.mjs.map +7 -0
- package/dist/lib/browser/cli/index.mjs +3 -4
- package/dist/lib/browser/cli/index.mjs.map +3 -3
- package/dist/lib/browser/{create-chat-LBZHGVSN.mjs → create-chat-FZJASOQS.mjs} +5 -13
- package/dist/lib/browser/create-chat-FZJASOQS.mjs.map +7 -0
- package/dist/lib/browser/{ensure-companion-chat-ZEZA34MZ.mjs → ensure-companion-chat-PHUWWFVY.mjs} +4 -4
- package/dist/lib/browser/ensure-companion-chat-PHUWWFVY.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +804 -880
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/{on-create-space-54RNX5JI.mjs → on-create-space-OQNCM7NC.mjs} +3 -3
- package/dist/lib/browser/{on-create-space-54RNX5JI.mjs.map → on-create-space-OQNCM7NC.mjs.map} +1 -1
- package/dist/lib/browser/operations/index.mjs +3 -3
- package/dist/lib/browser/operations/index.mjs.map +3 -3
- package/dist/lib/browser/{resolve-navigation-targets-NZOD66NY.mjs → resolve-navigation-targets-PMNR7D3P.mjs} +3 -3
- package/dist/lib/browser/{resolve-navigation-targets-NZOD66NY.mjs.map → resolve-navigation-targets-PMNR7D3P.mjs.map} +1 -1
- package/dist/lib/browser/{run-prompt-in-new-chat-THLK5YQC.mjs → run-prompt-in-new-chat-4XDYFKCV.mjs} +10 -39
- package/dist/lib/browser/run-prompt-in-new-chat-4XDYFKCV.mjs.map +7 -0
- package/dist/lib/browser/{set-current-chat-LRS3VFSH.mjs → set-current-chat-7V4DA66I.mjs} +4 -4
- package/dist/lib/browser/set-current-chat-7V4DA66I.mjs.map +7 -0
- package/dist/lib/browser/translations.mjs +171 -0
- package/dist/lib/browser/translations.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +1 -3
- package/dist/lib/browser/{update-chat-name-3Y36KFAS.mjs → update-chat-name-ZGMU2UGN.mjs} +7 -22
- package/dist/lib/browser/update-chat-name-ZGMU2UGN.mjs.map +7 -0
- package/dist/lib/node-esm/AssistantSettings-23A5IMHS.mjs +41 -0
- package/dist/lib/node-esm/AssistantSettings-23A5IMHS.mjs.map +7 -0
- package/dist/lib/node-esm/blueprints/index.mjs +26 -3
- package/dist/lib/node-esm/blueprints/index.mjs.map +4 -4
- package/dist/lib/node-esm/{chunk-PXAJSTGZ.mjs → chunk-NCIZY5ZV.mjs} +5 -5
- package/dist/lib/node-esm/chunk-NCIZY5ZV.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-W3JZ2F4T.mjs → chunk-XAFVSEUJ.mjs} +58 -17
- package/dist/lib/node-esm/chunk-XAFVSEUJ.mjs.map +7 -0
- package/dist/lib/node-esm/cli/index.mjs +3 -4
- package/dist/lib/node-esm/cli/index.mjs.map +3 -3
- package/dist/lib/node-esm/{create-chat-3BEG4R6J.mjs → create-chat-RY6A4WUV.mjs} +5 -13
- package/dist/lib/node-esm/create-chat-RY6A4WUV.mjs.map +7 -0
- package/dist/lib/node-esm/{ensure-companion-chat-6K2WEWFP.mjs → ensure-companion-chat-BTDU5TS2.mjs} +4 -4
- package/dist/lib/node-esm/ensure-companion-chat-BTDU5TS2.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +804 -880
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/{on-create-space-YRPZ6HZY.mjs → on-create-space-4LWCYT3H.mjs} +3 -3
- package/dist/lib/node-esm/{on-create-space-YRPZ6HZY.mjs.map → on-create-space-4LWCYT3H.mjs.map} +1 -1
- package/dist/lib/node-esm/operations/index.mjs +3 -3
- package/dist/lib/node-esm/operations/index.mjs.map +3 -3
- package/dist/lib/node-esm/{resolve-navigation-targets-3PPK7XLH.mjs → resolve-navigation-targets-GHS3XPVP.mjs} +3 -3
- package/dist/lib/node-esm/{resolve-navigation-targets-3PPK7XLH.mjs.map → resolve-navigation-targets-GHS3XPVP.mjs.map} +1 -1
- package/dist/lib/node-esm/{run-prompt-in-new-chat-OUYKCMQ7.mjs → run-prompt-in-new-chat-UF54E34O.mjs} +10 -39
- package/dist/lib/node-esm/run-prompt-in-new-chat-UF54E34O.mjs.map +7 -0
- package/dist/lib/node-esm/{set-current-chat-SMXZJD3F.mjs → set-current-chat-SWPAOLZL.mjs} +4 -4
- package/dist/lib/node-esm/set-current-chat-SWPAOLZL.mjs.map +7 -0
- package/dist/lib/node-esm/translations.mjs +172 -0
- package/dist/lib/node-esm/translations.mjs.map +7 -0
- package/dist/lib/node-esm/types/index.mjs +1 -3
- package/dist/lib/node-esm/{update-chat-name-HM2P4NSI.mjs → update-chat-name-CW6K5M37.mjs} +7 -22
- package/dist/lib/node-esm/update-chat-name-CW6K5M37.mjs.map +7 -0
- package/dist/types/src/AssistantPlugin.d.ts.map +1 -1
- 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/edge-model-resolver.d.ts.map +1 -1
- package/dist/types/src/capabilities/index.d.ts +2 -2
- 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 +1 -1
- package/dist/types/src/capabilities/markdown.d.ts.map +1 -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/cli/plugin.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 +29 -39
- 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/ChatOptions.d.ts +5 -3
- 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.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 +2 -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 +4 -3
- 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.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/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 +3 -3
- package/dist/types/src/components/TemplateEditor/TemplateForm.d.ts.map +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/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/ChatContainer/ChatContainer.d.ts.map +1 -1
- package/dist/types/src/containers/ChatDialog/ChatDialog.d.ts.map +1 -1
- 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/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 +2 -2
- 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/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 +1 -1
- 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 +1 -1
- package/dist/types/src/hooks/useChatProcessor.d.ts.map +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.map +1 -1
- 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 -3
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/operations/create-chat.d.ts +1 -1
- package/dist/types/src/operations/create-chat.d.ts.map +1 -1
- package/dist/types/src/operations/definitions.d.ts +24 -19
- package/dist/types/src/operations/definitions.d.ts.map +1 -1
- package/dist/types/src/operations/ensure-companion-chat.d.ts +1 -1
- package/dist/types/src/operations/ensure-companion-chat.d.ts.map +1 -1
- package/dist/types/src/operations/index.d.ts +1 -1
- package/dist/types/src/operations/index.d.ts.map +1 -1
- package/dist/types/src/operations/on-create-space.d.ts +1 -1
- 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 +1 -1
- 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 +1 -1
- package/dist/types/src/operations/set-current-chat.d.ts.map +1 -1
- package/dist/types/src/operations/update-chat-name.d.ts +1 -1
- package/dist/types/src/operations/update-chat-name.d.ts.map +1 -1
- package/dist/types/src/processor/processor.d.ts +2 -2
- package/dist/types/src/processor/processor.d.ts.map +1 -1
- package/dist/types/src/queue-logger.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 +1 -1
- package/dist/types/src/testing/test-generator.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/Settings.d.ts +20 -5
- package/dist/types/src/types/Settings.d.ts.map +1 -1
- package/dist/types/src/types/capabilities.d.ts.map +1 -1
- package/dist/types/src/types/events.d.ts.map +1 -1
- package/dist/types/src/types/index.d.ts +0 -1
- 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 +95 -91
- package/src/AssistantPlugin.tsx +10 -12
- package/src/blueprints/assistant/blueprint.test.ts +3 -3
- package/src/blueprints/assistant/blueprint.ts +3 -3
- package/src/capabilities/app-graph-builder.ts +3 -3
- package/src/capabilities/blueprint-definition.ts +0 -4
- package/src/capabilities/index.ts +1 -1
- package/src/capabilities/markdown.ts +1 -1
- package/src/capabilities/migrations.ts +1 -8
- package/src/capabilities/operation-handler.ts +1 -1
- package/src/capabilities/react-surface.tsx +16 -10
- package/src/cli/plugin.ts +3 -4
- package/src/components/AssistantSettings/AssistantSettings.stories.tsx +3 -2
- package/src/components/AssistantSettings/AssistantSettings.tsx +22 -111
- package/src/components/Chat/Chat.tsx +56 -260
- package/src/components/Chat/context.ts +39 -0
- package/src/components/ChatPrompt/ChatActions.tsx +10 -10
- package/src/components/ChatPrompt/ChatOptions.stories.tsx +24 -10
- package/src/components/ChatPrompt/ChatOptions.tsx +60 -31
- package/src/components/ChatPrompt/ChatPrompt.tsx +179 -0
- package/src/components/ChatPrompt/ChatReferences.tsx +1 -1
- package/src/components/ChatPrompt/ChatStatus.tsx +123 -0
- package/src/components/ChatPrompt/index.ts +2 -0
- package/src/components/ChatThread/ChatThread.stories.tsx +3 -3
- 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 +53 -14
- package/src/components/ChatThread/sync.test.ts +80 -12
- package/src/components/ChatThread/sync.ts +1 -1
- package/src/components/ChatThread/widgets/ReasoningWidget.ts +6 -6
- 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 +3 -1
- package/src/components/ChatThread/widgets/SuggestionWidget.ts +1 -1
- package/src/components/ChatThread/widgets/SummaryWidget.tsx +3 -2
- 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 +67 -35
- package/src/components/TemplateEditor/TemplateEditor.stories.tsx +3 -2
- package/src/components/TemplateEditor/TemplateEditor.tsx +5 -5
- package/src/components/TemplateEditor/TemplateForm.stories.tsx +4 -3
- package/src/components/TemplateEditor/TemplateForm.tsx +3 -3
- package/src/components/Toolbox/Toolbox.stories.tsx +2 -1
- package/src/components/Toolbox/Toolbox.tsx +2 -2
- package/src/containers/AgentArticle/AgentArticle.stories.tsx +1 -1
- package/src/containers/AgentArticle/AgentArticle.tsx +2 -2
- package/src/containers/AgentProperties/AgentProperties.stories.tsx +2 -1
- package/src/containers/AgentProperties/AgentProperties.tsx +2 -2
- package/src/containers/BlueprintArticle/BlueprintArticle.tsx +1 -1
- package/src/containers/ChatCompanion/ChatCompanion.tsx +1 -1
- package/src/containers/ChatContainer/ChatContainer.tsx +16 -6
- package/src/containers/ChatDialog/ChatDialog.tsx +3 -9
- package/src/containers/{PromptArticle/PromptArticle.tsx → RoutineArticle/RoutineArticle.tsx} +4 -4
- package/src/containers/RoutineArticle/index.ts +5 -0
- package/src/containers/{PromptList/PromptList.stories.tsx → RoutineList/RoutineList.stories.tsx} +10 -9
- package/src/containers/{PromptList/PromptList.tsx → RoutineList/RoutineList.tsx} +6 -5
- package/src/containers/RoutineList/index.ts +5 -0
- package/src/containers/TracePanel/TracePanel.stories.tsx +204 -198
- package/src/containers/TracePanel/TracePanel.tsx +69 -44
- package/src/containers/TracePanel/dxn-extractor.test.ts +7 -7
- package/src/containers/TracePanel/dxn-extractor.ts +4 -4
- package/src/containers/TracePanel/execution-graph.test.ts +382 -0
- package/src/containers/TracePanel/execution-graph.ts +340 -213
- 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/index.ts +2 -2
- package/src/hooks/index.ts +2 -0
- package/src/hooks/useBlueprintRegistry.ts +1 -1
- package/src/hooks/useChatKeymap.ts +52 -0
- package/src/hooks/useChatProcessor.ts +1 -1
- package/src/hooks/useDebug.ts +38 -0
- package/src/index.ts +0 -3
- package/src/operations/create-chat.ts +2 -2
- package/src/operations/definitions.ts +4 -4
- package/src/operations/ensure-companion-chat.ts +1 -1
- package/src/operations/index.ts +1 -1
- package/src/operations/on-create-space.ts +1 -1
- package/src/operations/prompt.test.ts +5 -6
- package/src/operations/resolve-navigation-targets.ts +1 -1
- package/src/operations/run-prompt-in-new-chat.ts +3 -3
- package/src/operations/set-current-chat.ts +1 -1
- package/src/operations/update-chat-name.ts +2 -2
- package/src/processor/processor.test.ts +1 -1
- package/src/processor/processor.ts +4 -4
- package/src/queue-logger.ts +1 -1
- package/src/testing/data/trace-timeline.dx.json +3737 -1200
- package/src/testing/index.ts +1 -0
- package/src/testing/test-generator.test.ts +1 -1
- package/src/testing/test-generator.ts +4 -4
- 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 +24 -31
- package/src/types/Assistant.ts +11 -0
- package/src/types/Settings.ts +62 -7
- package/src/types/index.ts +0 -1
- 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.map +0 -7
- package/dist/lib/browser/chunk-EZRS3J25.mjs +0 -30
- package/dist/lib/browser/chunk-EZRS3J25.mjs.map +0 -7
- package/dist/lib/browser/chunk-LMVTXH54.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/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/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/chunk-NZIKC7AN.mjs +0 -32
- package/dist/lib/node-esm/chunk-NZIKC7AN.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-PXAJSTGZ.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-W3JZ2F4T.mjs.map +0 -7
- package/dist/lib/node-esm/create-chat-3BEG4R6J.mjs.map +0 -7
- package/dist/lib/node-esm/ensure-companion-chat-6K2WEWFP.mjs.map +0 -7
- 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.map +0 -7
- package/dist/lib/node-esm/update-chat-name-HM2P4NSI.mjs.map +0 -7
- 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/types/defs.d.ts +0 -2
- package/dist/types/src/types/defs.d.ts.map +0 -1
- 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/index.ts +0 -5
- package/src/containers/PromptList/index.ts +0 -5
- package/src/types/defs.ts +0 -5
|
@@ -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 role='none' 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 }) => {
|
|
@@ -133,17 +142,47 @@ 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
|
+
return (str += '\n');
|
|
163
|
+
}
|
|
164
|
+
return str;
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
const isBlockVisible = (
|
|
169
|
+
viewType: Assistant.ChatView | undefined,
|
|
138
170
|
message: Message.Message,
|
|
139
171
|
block: ContentBlock.Any,
|
|
140
|
-
) => {
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
172
|
+
): boolean => {
|
|
173
|
+
switch (viewType) {
|
|
174
|
+
case 'debug':
|
|
175
|
+
return true;
|
|
176
|
+
case 'normal':
|
|
177
|
+
return block._tag !== 'reasoning';
|
|
178
|
+
case 'summary':
|
|
179
|
+
// Show only conversational text (user prompts + assistant replies); hide reasoning,
|
|
180
|
+
// tool calls, status, stats, and synthetic system messages.
|
|
181
|
+
return block._tag === 'text' && (block as ContentBlock.Text).disposition !== 'synthetic';
|
|
182
|
+
case 'thinking':
|
|
183
|
+
default:
|
|
184
|
+
return true;
|
|
144
185
|
}
|
|
145
|
-
|
|
146
|
-
return str;
|
|
147
186
|
};
|
|
148
187
|
|
|
149
188
|
const blockToMarkdownImpl = (context: MessageThreadContext, message: Message.Message, block: ContentBlock.Any) => {
|
|
@@ -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' }]),
|
|
@@ -58,7 +58,7 @@ describe('reducers', () => {
|
|
|
58
58
|
syncer.update(messages);
|
|
59
59
|
expect(doc.content).toEqual(['<prompt>Hello</prompt>', 'Hi there!', ''].join('\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);
|
|
@@ -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' }]),
|
|
@@ -80,14 +80,14 @@ describe('reducers', () => {
|
|
|
80
80
|
syncer.update(messages);
|
|
81
81
|
expect(doc.content).toEqual(['<prompt>Hello</prompt>', 'Hi there!'].join('\n'));
|
|
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);
|
|
@@ -105,10 +105,10 @@ describe('reducers', () => {
|
|
|
105
105
|
'streaming reasoning with list-marker transitions does not duplicate opening tag',
|
|
106
106
|
Effect.fn(function* ({ expect }) {
|
|
107
107
|
const doc = new TestDocument();
|
|
108
|
-
const syncer = new MessageSyncer(doc,
|
|
108
|
+
const syncer = new MessageSyncer(doc, createBlockRenderer('thinking'));
|
|
109
109
|
|
|
110
110
|
const setReasoning = (message: Message.Message, text: string, pending: boolean) => {
|
|
111
|
-
Obj.
|
|
111
|
+
Obj.update(message, (message) => {
|
|
112
112
|
const block = message.blocks[0] as Mutable<ContentBlock.Reasoning>;
|
|
113
113
|
block.reasoningText = text;
|
|
114
114
|
block.pending = pending;
|
|
@@ -143,6 +143,74 @@ describe('reducers', () => {
|
|
|
143
143
|
}),
|
|
144
144
|
);
|
|
145
145
|
|
|
146
|
+
// Regression: prompt "respond with your name inside an xml tag" produces a streamed
|
|
147
|
+
// reasoning block followed by a text block containing a non-registered XML tag
|
|
148
|
+
// (`<name>Claude</name>`). The text block must appear in the document AFTER the
|
|
149
|
+
// closed reasoning block — the bug symptom is the reasoning tag rendering with no
|
|
150
|
+
// follow-up response visible.
|
|
151
|
+
it.effect(
|
|
152
|
+
'reasoning block followed by text containing a non-registered xml tag',
|
|
153
|
+
Effect.fn(function* ({ expect }) {
|
|
154
|
+
const doc = new TestDocument();
|
|
155
|
+
const syncer = new MessageSyncer(doc, createBlockRenderer('thinking'));
|
|
156
|
+
|
|
157
|
+
const setReasoning = (message: Message.Message, text: string, pending: boolean) => {
|
|
158
|
+
Obj.update(message, (message) => {
|
|
159
|
+
const block = message.blocks[0] as Mutable<ContentBlock.Reasoning>;
|
|
160
|
+
block.reasoningText = text;
|
|
161
|
+
block.pending = pending;
|
|
162
|
+
});
|
|
163
|
+
};
|
|
164
|
+
|
|
165
|
+
const setText = (message: Message.Message, text: string, pending: boolean) => {
|
|
166
|
+
Obj.update(message, (message) => {
|
|
167
|
+
const block = message.blocks[1] as Mutable<ContentBlock.Text>;
|
|
168
|
+
block.text = text;
|
|
169
|
+
block.pending = pending;
|
|
170
|
+
});
|
|
171
|
+
};
|
|
172
|
+
|
|
173
|
+
// Tick 1: reasoning starts streaming.
|
|
174
|
+
const messages = [createMessage('assistant', [{ _tag: 'reasoning', reasoningText: 'Thinking', pending: true }])];
|
|
175
|
+
syncer.update(messages);
|
|
176
|
+
|
|
177
|
+
// Tick 2: reasoning grows.
|
|
178
|
+
setReasoning(messages[0], 'Thinking about the answer', true);
|
|
179
|
+
syncer.update(messages);
|
|
180
|
+
|
|
181
|
+
// Tick 3: reasoning closes.
|
|
182
|
+
setReasoning(messages[0], 'Thinking about the answer', false);
|
|
183
|
+
syncer.update(messages);
|
|
184
|
+
|
|
185
|
+
// Tick 4: text block appears, pending and empty (model has started emitting but text is still '').
|
|
186
|
+
Obj.update(messages[0], (message) => {
|
|
187
|
+
message.blocks.push({ _tag: 'text', text: '', pending: true });
|
|
188
|
+
});
|
|
189
|
+
syncer.update(messages);
|
|
190
|
+
|
|
191
|
+
// Tick 5: partial text — opening tag only.
|
|
192
|
+
setText(messages[0], '<name>', true);
|
|
193
|
+
syncer.update(messages);
|
|
194
|
+
|
|
195
|
+
// Tick 6: full text streamed.
|
|
196
|
+
setText(messages[0], '<name>Claude</name>', true);
|
|
197
|
+
syncer.update(messages);
|
|
198
|
+
|
|
199
|
+
// Tick 7: text finalised.
|
|
200
|
+
setText(messages[0], '<name>Claude</name>', false);
|
|
201
|
+
syncer.update(messages);
|
|
202
|
+
|
|
203
|
+
// Both the closed reasoning tag and the response text must be present.
|
|
204
|
+
expect(doc.content).toContain('<reasoning>Thinking about the answer</reasoning>');
|
|
205
|
+
expect(doc.content).toContain('<name>Claude</name>');
|
|
206
|
+
|
|
207
|
+
const openReasoning = (doc.content.match(/<reasoning>/g) ?? []).length;
|
|
208
|
+
const closeReasoning = (doc.content.match(/<\/reasoning>/g) ?? []).length;
|
|
209
|
+
expect(openReasoning).toBe(1);
|
|
210
|
+
expect(closeReasoning).toBe(1);
|
|
211
|
+
}),
|
|
212
|
+
);
|
|
213
|
+
|
|
146
214
|
// Direct test of `MessageSyncer`'s tolerance for non-monotonic renderer output —
|
|
147
215
|
// any renderer that produces a shorter string for the same streaming block (e.g., due
|
|
148
216
|
// to whitespace normalisation or future transforms) must not produce duplicate output.
|
|
@@ -170,12 +238,12 @@ describe('reducers', () => {
|
|
|
170
238
|
const messages = [createMessage('assistant', [{ _tag: 'reasoning', reasoningText: 'abc\n1.', pending: true }])];
|
|
171
239
|
|
|
172
240
|
syncer.update(messages);
|
|
173
|
-
Obj.
|
|
241
|
+
Obj.update(messages[0], (obj) => {
|
|
174
242
|
const block = obj.blocks[0] as Mutable<ContentBlock.Reasoning>;
|
|
175
243
|
block.reasoningText = 'abc\n1. ';
|
|
176
244
|
});
|
|
177
245
|
syncer.update(messages);
|
|
178
|
-
Obj.
|
|
246
|
+
Obj.update(messages[0], (obj) => {
|
|
179
247
|
const block = obj.blocks[0] as Mutable<ContentBlock.Reasoning>;
|
|
180
248
|
block.reasoningText = 'abc\n1. tail';
|
|
181
249
|
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,15 +38,15 @@ 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 px-2 py-1')
|
|
48
50
|
.append(
|
|
49
51
|
Domino.of('div')
|
|
50
52
|
.classNames('max-h-[5lh] overflow-y-auto')
|
|
@@ -54,8 +56,6 @@ export class ReasoningWidget extends WidgetType {
|
|
|
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')
|
|
@@ -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
|
* Simple prompt widget.
|
|
11
13
|
*/
|
|
@@ -24,7 +26,7 @@ export class SelectWidget extends WidgetType {
|
|
|
24
26
|
override toDOM() {
|
|
25
27
|
return Domino.of('div')
|
|
26
28
|
.attributes({ role: 'group' })
|
|
27
|
-
.classNames('flex flex-wrap
|
|
29
|
+
.classNames(styles.padding, 'flex flex-wrap gap-1')
|
|
28
30
|
.append(
|
|
29
31
|
...this.options.map((option) =>
|
|
30
32
|
Domino.of('button')
|
|
@@ -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
|
* Simple stats widget.
|
|
11
13
|
*/
|
|
@@ -19,7 +21,7 @@ export class StatsWidget extends WidgetType {
|
|
|
19
21
|
}
|
|
20
22
|
|
|
21
23
|
override toDOM() {
|
|
22
|
-
return Domino.of('div').classNames('
|
|
24
|
+
return Domino.of('div').classNames(styles.padding, 'text-sm text-placeholder').text(this.text).root;
|
|
23
25
|
}
|
|
24
26
|
|
|
25
27
|
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
|
/**
|
|
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.
|
|
@@ -37,7 +39,7 @@ export class StatusWidget extends WidgetType {
|
|
|
37
39
|
|
|
38
40
|
override toDOM() {
|
|
39
41
|
return Domino.of('div')
|
|
40
|
-
.classNames(
|
|
42
|
+
.classNames(styles.padding)
|
|
41
43
|
.append(
|
|
42
44
|
Domino.of('div')
|
|
43
45
|
.classNames('relative overflow-hidden rounded-sm')
|
|
@@ -19,7 +19,7 @@ export class SuggestionWidget extends WidgetType {
|
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
override toDOM() {
|
|
22
|
-
// NOTE: Container must have `dx-size-container` to support cqi.
|
|
22
|
+
// NOTE: Container must have `dx-inline-size-container` (or `dx-size-container`) to support cqi.
|
|
23
23
|
return Domino.of('span')
|
|
24
24
|
.classNames(mx('inline-flex max-w-[calc(100cqi-8px)] my-1 pe-2 overflow-hidden'))
|
|
25
25
|
.append(
|
|
@@ -11,15 +11,16 @@ import { type XmlWidgetProps } from '@dxos/ui-editor';
|
|
|
11
11
|
import { meta } from '#meta';
|
|
12
12
|
|
|
13
13
|
import { MessageThreadContext } from '../sync';
|
|
14
|
+
import { styles } from './defaults';
|
|
14
15
|
|
|
15
16
|
export const SummaryWidget = ({ children }: XmlWidgetProps<MessageThreadContext>) => {
|
|
16
17
|
const { t } = useTranslation(meta.id);
|
|
17
18
|
|
|
18
19
|
return (
|
|
19
|
-
<TogglePanel.Root classNames=
|
|
20
|
+
<TogglePanel.Root classNames={styles.border}>
|
|
20
21
|
<TogglePanel.Header classNames='text-sm bg-group-surface'>{t('summary.label')}</TogglePanel.Header>
|
|
21
22
|
<TogglePanel.Content>
|
|
22
|
-
<div role='none' className='p-1 text-sm text-
|
|
23
|
+
<div role='none' className='p-1 text-sm text-subdued'>
|
|
23
24
|
{children}
|
|
24
25
|
</div>
|
|
25
26
|
</TogglePanel.Content>
|
|
@@ -7,7 +7,8 @@ import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
|
7
7
|
import { withLayout, withTheme } from '@dxos/react-ui/testing';
|
|
8
8
|
import { type ContentBlock } from '@dxos/types';
|
|
9
9
|
|
|
10
|
-
import { translations } from '
|
|
10
|
+
import { translations } from '#translations';
|
|
11
|
+
|
|
11
12
|
import { ToolWidget, type ToolWidgetProps } from './ToolWidget';
|
|
12
13
|
|
|
13
14
|
const baseWidgetProps = {
|
|
@@ -3,12 +3,11 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
export * from './FallbackWidget';
|
|
6
|
-
export * from './PromptWidget';
|
|
7
6
|
export * from './ReasoningWidget';
|
|
8
7
|
export * from './ReferenceWidget';
|
|
9
8
|
export * from './SelectWidget';
|
|
10
9
|
export * from './StatsWidget';
|
|
10
|
+
export * from './StatusWidget';
|
|
11
11
|
export * from './SummaryWidget';
|
|
12
12
|
export * from './SuggestionWidget';
|
|
13
13
|
export * from './ToolWidget';
|
|
14
|
-
export * from './StatusWidget';
|