@dxos/plugin-assistant 0.8.4-main.9be5663bfe → 0.8.4-main.abd8ff62ef
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-DVOOFAWU.mjs} +4 -5
- package/dist/lib/browser/chunk-DVOOFAWU.mjs.map +7 -0
- package/dist/lib/browser/chunk-M55MBYG7.mjs +932 -0
- package/dist/lib/browser/chunk-M55MBYG7.mjs.map +7 -0
- package/dist/lib/browser/{chunk-RUV2WOQH.mjs → chunk-SEMCG4ZK.mjs} +58 -17
- package/dist/lib/browser/chunk-SEMCG4ZK.mjs.map +7 -0
- package/dist/lib/browser/chunk-VK53MITK.mjs +2300 -0
- package/dist/lib/browser/chunk-VK53MITK.mjs.map +7 -0
- package/dist/lib/browser/cli/index.mjs +73 -0
- package/dist/lib/browser/cli/index.mjs.map +7 -0
- package/dist/lib/browser/components/index.mjs +20 -0
- package/dist/lib/browser/components/index.mjs.map +7 -0
- package/dist/lib/browser/{create-chat-LBZHGVSN.mjs → create-chat-E2ZLVTLP.mjs} +4 -13
- package/dist/lib/browser/create-chat-E2ZLVTLP.mjs.map +7 -0
- package/dist/lib/browser/{ensure-companion-chat-FR4AWZ2P.mjs → ensure-companion-chat-7GDMXSQW.mjs} +4 -4
- package/dist/lib/browser/ensure-companion-chat-7GDMXSQW.mjs.map +7 -0
- package/dist/lib/browser/hooks/index.mjs +39 -0
- package/dist/lib/browser/hooks/index.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +43 -3233
- 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-4J3KTNAJ.mjs} +3 -3
- package/dist/lib/browser/{on-create-space-54RNX5JI.mjs.map → on-create-space-4J3KTNAJ.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-3ZPQE6SZ.mjs} +3 -3
- package/dist/lib/browser/{resolve-navigation-targets-NZOD66NY.mjs.map → resolve-navigation-targets-3ZPQE6SZ.mjs.map} +1 -1
- package/dist/lib/browser/{run-prompt-in-new-chat-4YQ37XIS.mjs → run-prompt-in-new-chat-AA3KPBDN.mjs} +9 -39
- package/dist/lib/browser/run-prompt-in-new-chat-AA3KPBDN.mjs.map +7 -0
- package/dist/lib/browser/{set-current-chat-WJI3WAVM.mjs → set-current-chat-P4VHI3YF.mjs} +4 -4
- package/dist/lib/browser/set-current-chat-P4VHI3YF.mjs.map +7 -0
- package/dist/lib/browser/translations.mjs +172 -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-VWKNUON7.mjs} +7 -22
- package/dist/lib/browser/update-chat-name-VWKNUON7.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-FWC3ZGPH.mjs +933 -0
- package/dist/lib/node-esm/chunk-FWC3ZGPH.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-JKEB3NFZ.mjs +2302 -0
- package/dist/lib/node-esm/chunk-JKEB3NFZ.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-PXAJSTGZ.mjs → chunk-MBDVPB4V.mjs} +4 -5
- package/dist/lib/node-esm/chunk-MBDVPB4V.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-PY4X6FJT.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 +74 -0
- package/dist/lib/node-esm/cli/index.mjs.map +7 -0
- package/dist/lib/node-esm/components/index.mjs +21 -0
- package/dist/lib/node-esm/components/index.mjs.map +7 -0
- package/dist/lib/node-esm/{create-chat-3BEG4R6J.mjs → create-chat-UQQ3542N.mjs} +4 -13
- package/dist/lib/node-esm/create-chat-UQQ3542N.mjs.map +7 -0
- package/dist/lib/node-esm/{ensure-companion-chat-BLP7NT32.mjs → ensure-companion-chat-LVCPD4DJ.mjs} +4 -4
- package/dist/lib/node-esm/ensure-companion-chat-LVCPD4DJ.mjs.map +7 -0
- package/dist/lib/node-esm/hooks/index.mjs +40 -0
- package/dist/lib/node-esm/hooks/index.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +43 -3233
- 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-M63UBTTT.mjs} +3 -3
- package/dist/lib/node-esm/{on-create-space-YRPZ6HZY.mjs.map → on-create-space-M63UBTTT.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-HO77CAFT.mjs} +3 -3
- package/dist/lib/node-esm/{resolve-navigation-targets-3PPK7XLH.mjs.map → resolve-navigation-targets-HO77CAFT.mjs.map} +1 -1
- package/dist/lib/node-esm/{run-prompt-in-new-chat-2IJBSDTM.mjs → run-prompt-in-new-chat-RIRYYYPK.mjs} +9 -39
- package/dist/lib/node-esm/run-prompt-in-new-chat-RIRYYYPK.mjs.map +7 -0
- package/dist/lib/node-esm/{set-current-chat-KBMMZULR.mjs → set-current-chat-Z7GJ52VX.mjs} +4 -4
- package/dist/lib/node-esm/set-current-chat-Z7GJ52VX.mjs.map +7 -0
- package/dist/lib/node-esm/translations.mjs +173 -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-GV4HX32Z.mjs} +7 -22
- package/dist/lib/node-esm/update-chat-name-GV4HX32Z.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/edge-model-resolver.d.ts.map +1 -1
- package/dist/types/src/capabilities/index.d.ts +5 -17
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/local-model-resolver.d.ts +6 -3
- 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 +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 +1 -13
- 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/index.d.ts +2 -0
- package/dist/types/src/cli/index.d.ts.map +1 -0
- package/dist/types/src/cli/plugin.d.ts +10 -0
- package/dist/types/src/cli/plugin.d.ts.map +1 -0
- 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 +1 -539
- package/dist/types/src/components/AssistantSettings/AssistantSettings.stories.d.ts.map +1 -1
- package/dist/types/src/components/Chat/Chat.d.ts +32 -42
- 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 +6 -2
- package/dist/types/src/components/ChatPrompt/ChatOptions.d.ts.map +1 -1
- package/dist/types/src/components/ChatPrompt/ChatOptions.stories.d.ts +19 -0
- package/dist/types/src/components/ChatPrompt/ChatOptions.stories.d.ts.map +1 -0
- 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 +3 -0
- package/dist/types/src/components/ChatPrompt/index.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/Anchor.stories.d.ts +14 -0
- package/dist/types/src/components/ChatThread/Anchor.stories.d.ts.map +1 -0
- 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 -541
- 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 +9 -540
- 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 +40 -14
- 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 +1 -539
- 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 +1 -539
- 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 +1 -539
- 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 +1 -539
- package/dist/types/src/components/Toolbox/Toolbox.stories.d.ts.map +1 -1
- package/dist/types/src/containers/AgentArticle/AgentArticle.d.ts +2 -2
- package/dist/types/src/containers/AgentArticle/AgentArticle.d.ts.map +1 -1
- package/dist/types/src/containers/AgentArticle/AgentArticle.stories.d.ts +7 -540
- package/dist/types/src/containers/AgentArticle/AgentArticle.stories.d.ts.map +1 -1
- package/dist/types/src/containers/AgentProperties/AgentProperties.d.ts +1 -1
- package/dist/types/src/containers/AgentProperties/AgentProperties.d.ts.map +1 -1
- package/dist/types/src/containers/AgentProperties/AgentProperties.stories.d.ts +1 -539
- 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/RoutineList/RoutineList.stories.d.ts +21 -0
- 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 +6 -4
- package/dist/types/src/containers/TracePanel/TracePanel.d.ts.map +1 -1
- package/dist/types/src/containers/TracePanel/TracePanel.stories.d.ts +13 -0
- package/dist/types/src/containers/TracePanel/TracePanel.stories.d.ts.map +1 -0
- 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 +97 -0
- package/dist/types/src/containers/TracePanel/execution-graph.d.ts.map +1 -0
- 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 +3 -2
- package/dist/types/src/containers/TriggerStatus/TriggerStatus.d.ts.map +1 -1
- package/dist/types/src/containers/TriggerStatus/index.d.ts +1 -1
- package/dist/types/src/containers/TriggerStatus/index.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 +3 -5
- 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/prompt.test.d.ts +2 -0
- package/dist/types/src/operations/prompt.test.d.ts.map +1 -0
- 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/presets.d.ts +1 -1
- package/dist/types/src/processor/presets.d.ts.map +1 -1
- package/dist/types/src/processor/processor.d.ts +25 -7
- 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.map +1 -1
- package/dist/types/src/testing/test-generator.test.d.ts +2 -0
- package/dist/types/src/testing/test-generator.test.d.ts.map +1 -0
- 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/testing/trace-timeline.test.d.ts +2 -0
- package/dist/types/src/testing/trace-timeline.test.d.ts.map +1 -0
- package/dist/types/src/translations.d.ts +2 -539
- 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 +22 -6
- package/dist/types/src/types/Settings.d.ts.map +1 -1
- package/dist/types/src/types/capabilities.d.ts +1 -13
- 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 +113 -99
- package/src/AssistantPlugin.node.ts +125 -0
- package/src/AssistantPlugin.test.ts +35 -0
- package/src/AssistantPlugin.tsx +22 -16
- package/src/blueprints/assistant/blueprint.test.ts +3 -3
- package/src/blueprints/assistant/blueprint.ts +3 -3
- package/src/capabilities/app-graph-builder.ts +5 -61
- package/src/capabilities/blueprint-definition.ts +2 -4
- package/src/capabilities/index.ts +2 -1
- package/src/capabilities/local-model-resolver.ts +14 -4
- package/src/capabilities/markdown.ts +1 -1
- package/src/capabilities/migrations.ts +1 -7
- package/src/capabilities/operation-handler.ts +1 -1
- package/src/capabilities/react-surface.tsx +38 -28
- package/src/capabilities/toolkit.ts +2 -2
- package/src/{components/Typewriter → cli}/index.ts +1 -1
- package/src/cli/plugin.ts +83 -0
- package/src/components/AssistantSettings/AssistantSettings.stories.tsx +3 -2
- package/src/components/AssistantSettings/AssistantSettings.tsx +22 -111
- package/src/components/Chat/Chat.tsx +82 -286
- 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 +136 -0
- package/src/components/ChatPrompt/ChatOptions.tsx +229 -37
- package/src/components/ChatPrompt/ChatPrompt.tsx +182 -0
- package/src/components/ChatPrompt/ChatReferences.tsx +1 -1
- package/src/components/ChatPrompt/ChatStatus.tsx +123 -0
- package/src/components/ChatPrompt/index.ts +3 -0
- package/src/components/ChatThread/Anchor.stories.tsx +95 -0
- package/src/components/ChatThread/ChatThread.stories.tsx +39 -29
- package/src/components/ChatThread/ChatThread.tsx +36 -21
- package/src/components/ChatThread/DEBUG.md +41 -0
- package/src/components/ChatThread/MarkdownStream.stories.tsx +43 -5
- package/src/components/ChatThread/registry.tsx +72 -24
- package/src/components/ChatThread/sync.test.ts +175 -15
- package/src/components/ChatThread/sync.ts +87 -102
- package/src/components/ChatThread/testing/reasoning.md +25 -0
- package/src/components/ChatThread/widgets/FallbackWidget.tsx +2 -2
- package/src/components/ChatThread/widgets/ReasoningWidget.stories.tsx +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 -3
- 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 +3 -2
- package/src/components/ChatThread/widgets/ToolWidget.tsx +2 -2
- 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 +70 -37
- 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/TemplateEditor/extensions/handlebars-extension.ts +1 -1
- package/src/components/ToolBlock/ToolBlock.tsx +2 -2
- package/src/components/Toolbox/Toolbox.stories.tsx +2 -1
- package/src/components/Toolbox/Toolbox.tsx +2 -2
- package/src/containers/AgentArticle/AgentArticle.stories.tsx +40 -25
- package/src/containers/AgentArticle/AgentArticle.tsx +96 -53
- package/src/containers/AgentProperties/AgentProperties.stories.tsx +14 -4
- package/src/containers/AgentProperties/AgentProperties.tsx +46 -88
- 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} +11 -10
- 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 +278 -0
- package/src/containers/TracePanel/TracePanel.tsx +95 -318
- 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 +579 -0
- 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 +19 -34
- package/src/containers/TriggerStatus/index.ts +1 -1
- 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 +11 -11
- package/src/hooks/useDebug.ts +38 -0
- package/src/index.ts +8 -6
- package/src/operations/create-chat.ts +1 -2
- package/src/operations/definitions.ts +3 -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 +77 -0
- package/src/operations/resolve-navigation-targets.ts +1 -1
- package/src/operations/run-prompt-in-new-chat.ts +2 -3
- package/src/operations/set-current-chat.ts +1 -1
- package/src/operations/update-chat-name.ts +2 -2
- package/src/processor/presets.ts +9 -1
- package/src/processor/processor.test.ts +4 -4
- package/src/processor/processor.ts +43 -27
- package/src/queue-logger.ts +19 -8
- package/src/testing/data/trace-timeline.dx.json +4657 -0
- package/src/testing/index.ts +1 -0
- package/src/testing/test-generator.test.ts +81 -0
- package/src/testing/test-generator.ts +46 -40
- package/src/testing/test-trace.ts +20 -0
- package/src/testing/trace-timeline.conversations.json +1 -0
- package/src/testing/trace-timeline.test.ts +249 -0
- package/src/translations.ts +49 -34
- package/src/types/Assistant.ts +11 -0
- package/src/types/Settings.ts +63 -8
- 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-RUV2WOQH.mjs.map +0 -7
- package/dist/lib/browser/create-chat-LBZHGVSN.mjs.map +0 -7
- package/dist/lib/browser/ensure-companion-chat-FR4AWZ2P.mjs.map +0 -7
- package/dist/lib/browser/run-prompt-in-new-chat-4YQ37XIS.mjs.map +0 -7
- package/dist/lib/browser/set-current-chat-WJI3WAVM.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-PY4X6FJT.mjs.map +0 -7
- package/dist/lib/node-esm/create-chat-3BEG4R6J.mjs.map +0 -7
- package/dist/lib/node-esm/ensure-companion-chat-BLP7NT32.mjs.map +0 -7
- package/dist/lib/node-esm/run-prompt-in-new-chat-2IJBSDTM.mjs.map +0 -7
- package/dist/lib/node-esm/set-current-chat-KBMMZULR.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 -14
- package/dist/types/src/components/ChatThread/widgets/PromptWidget.d.ts.map +0 -1
- package/dist/types/src/components/Typewriter/AssistantToolbar.d.ts +0 -12
- package/dist/types/src/components/Typewriter/AssistantToolbar.d.ts.map +0 -1
- package/dist/types/src/components/Typewriter/Typewriter.d.ts +0 -11
- package/dist/types/src/components/Typewriter/Typewriter.d.ts.map +0 -1
- package/dist/types/src/components/Typewriter/Typewriter.stories.d.ts +0 -7
- package/dist/types/src/components/Typewriter/Typewriter.stories.d.ts.map +0 -1
- package/dist/types/src/components/Typewriter/assistant-extension.d.ts +0 -5
- package/dist/types/src/components/Typewriter/assistant-extension.d.ts.map +0 -1
- package/dist/types/src/components/Typewriter/index.d.ts +0 -2
- package/dist/types/src/components/Typewriter/index.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 +0 -559
- 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/blueprints/assistant/blueprint.conversations.json +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 -28
- package/src/components/Typewriter/AssistantToolbar.tsx +0 -161
- package/src/components/Typewriter/Typewriter.stories.tsx +0 -86
- package/src/components/Typewriter/Typewriter.tsx +0 -50
- package/src/components/Typewriter/assistant-extension.tsx +0 -141
- package/src/containers/PromptArticle/index.ts +0 -5
- package/src/containers/PromptList/index.ts +0 -5
- package/src/types/defs.ts +0 -5
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
6
|
+
import * as Effect from 'effect/Effect';
|
|
7
|
+
import React, { useState } from 'react';
|
|
8
|
+
|
|
9
|
+
import { withPluginManager } from '@dxos/app-framework/testing';
|
|
10
|
+
import { Chat } from '@dxos/assistant-toolkit';
|
|
11
|
+
import { capabilities } from '@dxos/assistant-toolkit/testing';
|
|
12
|
+
import { Feed, Filter, Ref } from '@dxos/echo';
|
|
13
|
+
import { ChessPlugin } from '@dxos/plugin-chess';
|
|
14
|
+
import { ClientPlugin } from '@dxos/plugin-client';
|
|
15
|
+
import { initializeIdentity } from '@dxos/plugin-client/testing';
|
|
16
|
+
import { MapPlugin } from '@dxos/plugin-map';
|
|
17
|
+
import { TablePlugin } from '@dxos/plugin-table';
|
|
18
|
+
import { corePlugins } from '@dxos/plugin-testing';
|
|
19
|
+
import { useQuery, useSpaces } from '@dxos/react-client/echo';
|
|
20
|
+
import { Loading, withTheme } from '@dxos/react-ui/testing';
|
|
21
|
+
import { Organization, Person } from '@dxos/types';
|
|
22
|
+
|
|
23
|
+
import { useBlueprintRegistry, useContextBinder } from '#hooks';
|
|
24
|
+
import { translations } from '#translations';
|
|
25
|
+
|
|
26
|
+
import { ChatOptions, ObjectsPanel, type ChatOptionsProps } from './ChatOptions';
|
|
27
|
+
|
|
28
|
+
const presets = [
|
|
29
|
+
{
|
|
30
|
+
id: 'edge-claude-sonnet',
|
|
31
|
+
label: 'Edge/Claude Sonnet',
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
id: 'edge-gpt-4o',
|
|
35
|
+
label: 'Edge/GPT-4o',
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
id: 'ollama-llama3',
|
|
39
|
+
label: 'Ollama/Llama 3',
|
|
40
|
+
},
|
|
41
|
+
];
|
|
42
|
+
|
|
43
|
+
type DefaultStoryProps = Pick<ChatOptionsProps, 'presets'>;
|
|
44
|
+
|
|
45
|
+
const DefaultStory = ({ presets }: DefaultStoryProps) => {
|
|
46
|
+
const [space] = useSpaces();
|
|
47
|
+
const [feed] = useQuery(space?.db, Filter.type(Feed.Feed));
|
|
48
|
+
const [chat] = useQuery(space?.db, Filter.type(Chat.Chat));
|
|
49
|
+
const blueprintRegistry = useBlueprintRegistry();
|
|
50
|
+
const binder = useContextBinder(space, feed);
|
|
51
|
+
const [preset, setPreset] = useState(presets?.[0]?.id);
|
|
52
|
+
if (!space || !binder || !chat) {
|
|
53
|
+
return <Loading />;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
return (
|
|
57
|
+
<ChatOptions
|
|
58
|
+
chat={chat}
|
|
59
|
+
db={space.db}
|
|
60
|
+
context={binder}
|
|
61
|
+
blueprintRegistry={blueprintRegistry}
|
|
62
|
+
presets={presets}
|
|
63
|
+
preset={preset}
|
|
64
|
+
onPresetChange={setPreset}
|
|
65
|
+
/>
|
|
66
|
+
);
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
const meta = {
|
|
70
|
+
title: 'plugins/plugin-assistant/components/ChatOptions',
|
|
71
|
+
component: ChatOptions as any,
|
|
72
|
+
render: DefaultStory,
|
|
73
|
+
decorators: [
|
|
74
|
+
withTheme(),
|
|
75
|
+
withPluginManager({
|
|
76
|
+
plugins: [
|
|
77
|
+
...corePlugins(),
|
|
78
|
+
ClientPlugin({
|
|
79
|
+
types: [Chat.Chat, Feed.Feed, Organization.Organization, Person.Person],
|
|
80
|
+
onClientInitialized: ({ client }) =>
|
|
81
|
+
Effect.gen(function* () {
|
|
82
|
+
yield* initializeIdentity(client);
|
|
83
|
+
const [space] = client.spaces.get();
|
|
84
|
+
yield* Effect.promise(() => space.waitUntilReady());
|
|
85
|
+
|
|
86
|
+
// Populate space with sample objects.
|
|
87
|
+
for (let idx = 0; idx < 8; idx++) {
|
|
88
|
+
space.db.add(Organization.make({ name: `Org ${idx + 1}` }));
|
|
89
|
+
space.db.add(Person.make({ fullName: `Person ${idx + 1}` }));
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
// Create the chat feed used by the context binder.
|
|
93
|
+
const feed = space.db.add(Feed.make());
|
|
94
|
+
space.db.add(Chat.make({ name: 'Test chat', feed: Ref.make(feed) }));
|
|
95
|
+
yield* Effect.promise(() => space.db.flush({ indexes: true }));
|
|
96
|
+
}),
|
|
97
|
+
}),
|
|
98
|
+
ChessPlugin(),
|
|
99
|
+
MapPlugin(),
|
|
100
|
+
TablePlugin(),
|
|
101
|
+
],
|
|
102
|
+
capabilities,
|
|
103
|
+
}),
|
|
104
|
+
],
|
|
105
|
+
parameters: {
|
|
106
|
+
layout: 'centered',
|
|
107
|
+
translations,
|
|
108
|
+
},
|
|
109
|
+
} satisfies Meta<typeof DefaultStory>;
|
|
110
|
+
|
|
111
|
+
export default meta;
|
|
112
|
+
|
|
113
|
+
type Story = StoryObj<typeof meta>;
|
|
114
|
+
|
|
115
|
+
export const Default: Story = {
|
|
116
|
+
args: {
|
|
117
|
+
presets,
|
|
118
|
+
},
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
export const _ObjectsPanel: Story = {
|
|
122
|
+
render: () => {
|
|
123
|
+
const [space] = useSpaces();
|
|
124
|
+
const [feed] = useQuery(space?.db, Filter.type(Feed.Feed));
|
|
125
|
+
const binder = useContextBinder(space, feed);
|
|
126
|
+
if (!space || !binder) {
|
|
127
|
+
return <Loading />;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
return (
|
|
131
|
+
<div className='grid w-[300px] h-[300px] border border-separator'>
|
|
132
|
+
<ObjectsPanel db={space.db} context={binder} />
|
|
133
|
+
</div>
|
|
134
|
+
);
|
|
135
|
+
},
|
|
136
|
+
};
|
|
@@ -3,24 +3,30 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import * as Option from 'effect/Option';
|
|
6
|
-
import React, { type JSX, useMemo, useState } from 'react';
|
|
6
|
+
import React, { type JSX, useCallback, useMemo, useState } from 'react';
|
|
7
7
|
|
|
8
8
|
import { type AiContextBinder } from '@dxos/assistant';
|
|
9
|
-
import { type
|
|
10
|
-
import { type
|
|
11
|
-
import { Annotation } from '@dxos/echo';
|
|
12
|
-
import { useQuery } from '@dxos/react-client/echo';
|
|
13
|
-
import { IconButton, Popover, Select, useTranslation } from '@dxos/react-ui';
|
|
14
|
-
import { Listbox
|
|
9
|
+
import { type Chat as ChatModule, McpServer } from '@dxos/assistant-toolkit';
|
|
10
|
+
import { type Blueprint } from '@dxos/compute';
|
|
11
|
+
import { Annotation, type Database, Filter, Obj, Type } from '@dxos/echo';
|
|
12
|
+
import { useObject, useQuery } from '@dxos/react-client/echo';
|
|
13
|
+
import { IconButton, Input, Popover, Select, useTranslation } from '@dxos/react-ui';
|
|
14
|
+
import { Listbox } from '@dxos/react-ui-list';
|
|
15
|
+
import { SearchList, useSearchListResults } from '@dxos/react-ui-search';
|
|
15
16
|
import { Tabs } from '@dxos/react-ui-tabs';
|
|
16
17
|
import { getStyles, mx } from '@dxos/ui-theme';
|
|
17
18
|
|
|
18
19
|
import { useActiveBlueprints, useBlueprintHandlers, useBlueprints, useContextObjects, useFilteredTypes } from '#hooks';
|
|
19
20
|
import { meta } from '#meta';
|
|
21
|
+
import { Assistant } from '#types';
|
|
20
22
|
|
|
21
|
-
const
|
|
23
|
+
const styles = {
|
|
24
|
+
panel: 'w-[calc(100dvw-.5rem)] sm:w-max max-w-document-width',
|
|
25
|
+
toolbar: 'p-0! gap-0! border-t border-separator',
|
|
26
|
+
};
|
|
22
27
|
|
|
23
28
|
export type ChatOptionsProps = {
|
|
29
|
+
chat?: ChatModule.Chat;
|
|
24
30
|
db: Database.Database;
|
|
25
31
|
context: AiContextBinder;
|
|
26
32
|
blueprintRegistry?: Blueprint.Registry;
|
|
@@ -32,17 +38,25 @@ export type ChatOptionsProps = {
|
|
|
32
38
|
/**
|
|
33
39
|
* Manages the runtime context for the chat.
|
|
34
40
|
*/
|
|
35
|
-
export const ChatOptions = ({
|
|
41
|
+
export const ChatOptions = ({
|
|
42
|
+
chat,
|
|
43
|
+
db,
|
|
44
|
+
context,
|
|
45
|
+
blueprintRegistry,
|
|
46
|
+
presets,
|
|
47
|
+
preset,
|
|
48
|
+
onPresetChange,
|
|
49
|
+
}: ChatOptionsProps) => {
|
|
36
50
|
const { t } = useTranslation(meta.id);
|
|
37
51
|
|
|
38
52
|
return (
|
|
39
|
-
<div role='none' className='flex
|
|
53
|
+
<div role='none' className='flex'>
|
|
40
54
|
<Popover.Root>
|
|
41
55
|
<Popover.Trigger asChild>
|
|
42
56
|
<IconButton variant='ghost' icon='ph--plus--regular' iconOnly label={t('context-objects.button')} />
|
|
43
57
|
</Popover.Trigger>
|
|
44
58
|
<Popover.Portal>
|
|
45
|
-
<Popover.Content side='top' classNames={
|
|
59
|
+
<Popover.Content side='top' classNames={styles.panel}>
|
|
46
60
|
<Popover.Viewport>
|
|
47
61
|
<ObjectsPanel db={db} context={context} />
|
|
48
62
|
</Popover.Viewport>
|
|
@@ -61,30 +75,41 @@ export const ChatOptions = ({ db, context, blueprintRegistry, presets, preset, o
|
|
|
61
75
|
/>
|
|
62
76
|
</Popover.Trigger>
|
|
63
77
|
<Popover.Portal>
|
|
64
|
-
<Popover.Content side='top' classNames={
|
|
78
|
+
<Popover.Content side='top' classNames={styles.panel}>
|
|
65
79
|
<Popover.Viewport>
|
|
66
|
-
<Tabs.Root
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
80
|
+
<Tabs.Root
|
|
81
|
+
classNames='flex'
|
|
82
|
+
orientation='horizontal'
|
|
83
|
+
defaultValue='view'
|
|
84
|
+
defaultActivePart='list'
|
|
85
|
+
tabIndex={-1}
|
|
86
|
+
>
|
|
87
|
+
<Tabs.Viewport classNames={mx('grid grid-rows-[1fr_40px] w-full')}>
|
|
88
|
+
<Tabs.Panel tabIndex={-1} classNames='dx-focus-ring-inset overflow-hidden' value='view'>
|
|
89
|
+
<ViewPanel chat={chat} />
|
|
90
|
+
</Tabs.Panel>
|
|
91
|
+
<Tabs.Panel tabIndex={-1} classNames='dx-focus-ring-inset overflow-hidden' value='blueprints'>
|
|
76
92
|
<BlueprintsPanel blueprintRegistry={blueprintRegistry} db={db} context={context} />
|
|
77
93
|
</Tabs.Panel>
|
|
78
|
-
<Tabs.Panel
|
|
94
|
+
<Tabs.Panel tabIndex={-1} classNames='dx-focus-ring-inset overflow-hidden' value='mcp-servers'>
|
|
95
|
+
<McpServersPanel db={db} />
|
|
96
|
+
</Tabs.Panel>
|
|
97
|
+
<Tabs.Panel tabIndex={-1} classNames='dx-focus-ring-inset overflow-hidden' value='model'>
|
|
79
98
|
<ModelsPanel presets={presets} preset={preset} onPresetChange={onPresetChange} />
|
|
80
99
|
</Tabs.Panel>
|
|
81
|
-
<Tabs.Tablist classNames=
|
|
100
|
+
<Tabs.Tablist classNames={[styles.toolbar]}>
|
|
101
|
+
<Tabs.IconTab value='view' icon='ph--eye--regular' label={t('chat-view.title')} />
|
|
82
102
|
<Tabs.IconTab
|
|
83
103
|
value='blueprints'
|
|
84
104
|
icon='ph--blueprint--regular'
|
|
85
|
-
label={t('blueprints
|
|
105
|
+
label={t('options.blueprints.title')}
|
|
106
|
+
/>
|
|
107
|
+
<Tabs.IconTab
|
|
108
|
+
value='mcp-servers'
|
|
109
|
+
icon='ph--plugs-connected--regular'
|
|
110
|
+
label={t('options.mcp.title')}
|
|
86
111
|
/>
|
|
87
|
-
<Tabs.IconTab value='model' label={t('chat-model.title')}
|
|
112
|
+
<Tabs.IconTab value='model' icon='ph--cpu--regular' label={t('options.chat-model.title')} />
|
|
88
113
|
</Tabs.Tablist>
|
|
89
114
|
</Tabs.Viewport>
|
|
90
115
|
</Tabs.Root>
|
|
@@ -107,7 +132,6 @@ const BlueprintsPanel = ({
|
|
|
107
132
|
const blueprints = useBlueprints({ blueprintRegistry, db });
|
|
108
133
|
const activeBlueprints = useActiveBlueprints({ context });
|
|
109
134
|
const { onUpdateBlueprint } = useBlueprintHandlers({ db, context, blueprintRegistry });
|
|
110
|
-
|
|
111
135
|
const { results, handleSearch } = useSearchListResults({
|
|
112
136
|
items: blueprints,
|
|
113
137
|
extract: (blueprint) => blueprint.name,
|
|
@@ -115,7 +139,7 @@ const BlueprintsPanel = ({
|
|
|
115
139
|
|
|
116
140
|
return (
|
|
117
141
|
<SearchList.Root onSearch={handleSearch}>
|
|
118
|
-
<SearchList.Content classNames='
|
|
142
|
+
<SearchList.Content classNames='flex flex-col'>
|
|
119
143
|
<SearchList.Viewport>
|
|
120
144
|
{results.map((blueprint) => {
|
|
121
145
|
const isActive = activeBlueprints.has(blueprint.key);
|
|
@@ -131,12 +155,29 @@ const BlueprintsPanel = ({
|
|
|
131
155
|
);
|
|
132
156
|
})}
|
|
133
157
|
</SearchList.Viewport>
|
|
158
|
+
<SearchList.Input placeholder={t('search.placeholder')} classNames='border-t border-separator' autoFocus />
|
|
134
159
|
</SearchList.Content>
|
|
135
|
-
<SearchList.Input placeholder={t('search.placeholder')} classNames='mb-form-chrome' autoFocus />
|
|
136
160
|
</SearchList.Root>
|
|
137
161
|
);
|
|
138
162
|
};
|
|
139
163
|
|
|
164
|
+
const ViewPanel = ({ chat }: Pick<ChatOptionsProps, 'chat'>) => {
|
|
165
|
+
const { t } = useTranslation(meta.id);
|
|
166
|
+
const [view, setView] = useObject(chat, 'view');
|
|
167
|
+
const value = (view as Assistant.ChatView | undefined) ?? 'normal';
|
|
168
|
+
|
|
169
|
+
return (
|
|
170
|
+
<Listbox.Root value={value} onValueChange={setView} autoFocus>
|
|
171
|
+
{Assistant.ChatViews.map((view) => (
|
|
172
|
+
<Listbox.Option key={view} value={view}>
|
|
173
|
+
<Listbox.OptionLabel>{t(`chat-view.${view}.label`, { defaultValue: view })}</Listbox.OptionLabel>
|
|
174
|
+
<Listbox.OptionIndicator />
|
|
175
|
+
</Listbox.Option>
|
|
176
|
+
))}
|
|
177
|
+
</Listbox.Root>
|
|
178
|
+
);
|
|
179
|
+
};
|
|
180
|
+
|
|
140
181
|
const ModelsPanel = ({
|
|
141
182
|
presets,
|
|
142
183
|
preset,
|
|
@@ -156,9 +197,161 @@ const ModelsPanel = ({
|
|
|
156
197
|
);
|
|
157
198
|
};
|
|
158
199
|
|
|
200
|
+
type McpServersPanelProps = {
|
|
201
|
+
db: Database.Database;
|
|
202
|
+
};
|
|
203
|
+
|
|
204
|
+
const McpServersPanel = ({ db }: McpServersPanelProps) => {
|
|
205
|
+
const { t } = useTranslation(meta.id);
|
|
206
|
+
const servers = useQuery(db, Filter.type(McpServer.McpServer));
|
|
207
|
+
const [adding, setAdding] = useState(false);
|
|
208
|
+
|
|
209
|
+
const handleAdd = useCallback(
|
|
210
|
+
(name: string, url: string, protocol: 'sse' | 'http', apiKey?: string) => {
|
|
211
|
+
db.add(Obj.make(McpServer.McpServer, { name, url, protocol, apiKey, enabled: true }));
|
|
212
|
+
setAdding(false);
|
|
213
|
+
},
|
|
214
|
+
[db],
|
|
215
|
+
);
|
|
216
|
+
|
|
217
|
+
const handleRemove = useCallback(
|
|
218
|
+
(server: McpServer.McpServer) => {
|
|
219
|
+
db.remove(server);
|
|
220
|
+
},
|
|
221
|
+
[db],
|
|
222
|
+
);
|
|
223
|
+
|
|
224
|
+
return (
|
|
225
|
+
<div className='p-form-chrome'>
|
|
226
|
+
{servers.map((server) => (
|
|
227
|
+
<McpServerRow key={server.id} server={server} onRemove={handleRemove} />
|
|
228
|
+
))}
|
|
229
|
+
{adding ? (
|
|
230
|
+
<McpServerForm onSubmit={handleAdd} onCancel={() => setAdding(false)} />
|
|
231
|
+
) : (
|
|
232
|
+
<div role='none'>
|
|
233
|
+
<IconButton
|
|
234
|
+
variant='ghost'
|
|
235
|
+
icon='ph--plus--regular'
|
|
236
|
+
label={t('mcp-server-add.label')}
|
|
237
|
+
onClick={() => setAdding(true)}
|
|
238
|
+
/>
|
|
239
|
+
</div>
|
|
240
|
+
)}
|
|
241
|
+
</div>
|
|
242
|
+
);
|
|
243
|
+
};
|
|
244
|
+
|
|
245
|
+
type McpServerRowProps = {
|
|
246
|
+
server: McpServer.McpServer;
|
|
247
|
+
onRemove: (server: McpServer.McpServer) => void;
|
|
248
|
+
};
|
|
249
|
+
|
|
250
|
+
/**
|
|
251
|
+
* `useQuery` returns live objects but only re-renders on result-identity changes,
|
|
252
|
+
* so we must subscribe to the per-server `enabled` field via `useObject` to keep the
|
|
253
|
+
* switch in sync with mutations made through the returned setter.
|
|
254
|
+
*/
|
|
255
|
+
const McpServerRow = ({ server, onRemove }: McpServerRowProps) => {
|
|
256
|
+
const { t } = useTranslation(meta.id);
|
|
257
|
+
const [enabled, setEnabled] = useObject(server, 'enabled');
|
|
258
|
+
|
|
259
|
+
return (
|
|
260
|
+
<div className='flex items-center gap-2 px-form-chrome'>
|
|
261
|
+
<Input.Root>
|
|
262
|
+
<Input.Label srOnly>{server.name}</Input.Label>
|
|
263
|
+
<Input.Switch checked={enabled !== false} onCheckedChange={(checked) => setEnabled(!!checked)} />
|
|
264
|
+
</Input.Root>
|
|
265
|
+
<span className='flex-1 truncate text-sm'>{server.name}</span>
|
|
266
|
+
<span className='truncate text-xs text-description'>{server.url}</span>
|
|
267
|
+
<IconButton
|
|
268
|
+
variant='ghost'
|
|
269
|
+
icon='ph--x--regular'
|
|
270
|
+
iconOnly
|
|
271
|
+
label={t('mcp-server-remove.label')}
|
|
272
|
+
onClick={() => onRemove(server)}
|
|
273
|
+
/>
|
|
274
|
+
</div>
|
|
275
|
+
);
|
|
276
|
+
};
|
|
277
|
+
|
|
278
|
+
type McpServerFormProps = {
|
|
279
|
+
onSubmit: (name: string, url: string, protocol: 'sse' | 'http', apiKey?: string) => void;
|
|
280
|
+
onCancel: () => void;
|
|
281
|
+
};
|
|
282
|
+
|
|
283
|
+
const McpServerForm = ({ onSubmit, onCancel }: McpServerFormProps) => {
|
|
284
|
+
const { t } = useTranslation(meta.id);
|
|
285
|
+
const [name, setName] = useState('');
|
|
286
|
+
const [url, setUrl] = useState('');
|
|
287
|
+
const [protocol, setProtocol] = useState<'sse' | 'http'>('sse');
|
|
288
|
+
const [apiKey, setApiKey] = useState('');
|
|
289
|
+
|
|
290
|
+
const canSubmit = name.trim().length > 0 && url.trim().length > 0;
|
|
291
|
+
const handleSubmit = useCallback(() => {
|
|
292
|
+
if (canSubmit) {
|
|
293
|
+
onSubmit(name.trim(), url.trim(), protocol, apiKey.trim() || undefined);
|
|
294
|
+
}
|
|
295
|
+
}, [canSubmit, name, url, protocol, apiKey, onSubmit]);
|
|
296
|
+
|
|
297
|
+
return (
|
|
298
|
+
<div className='space-y-2 px-form-chrome'>
|
|
299
|
+
<Input.Root>
|
|
300
|
+
<Input.Label srOnly>{t('mcp-server-name.label')}</Input.Label>
|
|
301
|
+
<Input.TextInput
|
|
302
|
+
placeholder={t('mcp-server-name.placeholder')}
|
|
303
|
+
value={name}
|
|
304
|
+
onChange={(event) => setName(event.target.value)}
|
|
305
|
+
autoFocus
|
|
306
|
+
/>
|
|
307
|
+
</Input.Root>
|
|
308
|
+
<Input.Root>
|
|
309
|
+
<Input.Label srOnly>{t('mcp-server-url.label')}</Input.Label>
|
|
310
|
+
<Input.TextInput
|
|
311
|
+
placeholder={t('mcp-server-url.placeholder')}
|
|
312
|
+
value={url}
|
|
313
|
+
onChange={(event) => setUrl(event.target.value)}
|
|
314
|
+
/>
|
|
315
|
+
</Input.Root>
|
|
316
|
+
<Select.Root value={protocol} onValueChange={(value) => setProtocol(value as 'sse' | 'http')}>
|
|
317
|
+
<Select.TriggerButton placeholder={t('mcp-server-protocol.label')} />
|
|
318
|
+
<Select.Portal>
|
|
319
|
+
<Select.Content>
|
|
320
|
+
<Select.Viewport>
|
|
321
|
+
<Select.Option value='sse'>SSE</Select.Option>
|
|
322
|
+
<Select.Option value='http'>HTTP</Select.Option>
|
|
323
|
+
</Select.Viewport>
|
|
324
|
+
</Select.Content>
|
|
325
|
+
</Select.Portal>
|
|
326
|
+
</Select.Root>
|
|
327
|
+
<Input.Root>
|
|
328
|
+
<Input.Label srOnly>{t('mcp-server-api-key.label')}</Input.Label>
|
|
329
|
+
<Input.TextInput
|
|
330
|
+
type='password'
|
|
331
|
+
placeholder={t('mcp-server-api-key.placeholder')}
|
|
332
|
+
value={apiKey}
|
|
333
|
+
onChange={(event) => setApiKey(event.target.value)}
|
|
334
|
+
/>
|
|
335
|
+
</Input.Root>
|
|
336
|
+
<div role='none' className='flex gap-2'>
|
|
337
|
+
<IconButton
|
|
338
|
+
variant='ghost'
|
|
339
|
+
icon='ph--check--regular'
|
|
340
|
+
iconOnly
|
|
341
|
+
label={t('save.button')}
|
|
342
|
+
onClick={handleSubmit}
|
|
343
|
+
disabled={!canSubmit}
|
|
344
|
+
/>
|
|
345
|
+
<IconButton variant='ghost' icon='ph--x--regular' iconOnly label={t('cancel.button')} onClick={onCancel} />
|
|
346
|
+
</div>
|
|
347
|
+
</div>
|
|
348
|
+
);
|
|
349
|
+
};
|
|
350
|
+
|
|
159
351
|
const ANY = '__any__';
|
|
160
352
|
|
|
161
|
-
|
|
353
|
+
/** @private */
|
|
354
|
+
export const ObjectsPanel = ({ db, context }: Pick<ChatOptionsProps, 'db' | 'context'>): JSX.Element => {
|
|
162
355
|
const { t } = useTranslation(meta.id);
|
|
163
356
|
|
|
164
357
|
// Item types sorted by label.
|
|
@@ -186,7 +379,6 @@ const ObjectsPanel = ({ db, context }: Pick<ChatOptionsProps, 'db' | 'context'>)
|
|
|
186
379
|
// Context objects.
|
|
187
380
|
const objects = useQuery(db, typename === ANY ? anyFilter : Filter.typename(typename));
|
|
188
381
|
const { objects: contextObjects, onUpdateObject } = useContextObjects({ db, context });
|
|
189
|
-
|
|
190
382
|
const { results, handleSearch } = useSearchListResults({
|
|
191
383
|
items: objects,
|
|
192
384
|
extract: (object) => Obj.getLabel(object) ?? Obj.getTypename(object) ?? object.id,
|
|
@@ -201,7 +393,10 @@ const ObjectsPanel = ({ db, context }: Pick<ChatOptionsProps, 'db' | 'context'>)
|
|
|
201
393
|
const isActive = contextObjects.findIndex((obj) => obj.id === object.id) !== -1;
|
|
202
394
|
const { icon, hue } = Option.fromNullable(Obj.getSchema(object)).pipe(
|
|
203
395
|
Option.flatMap(Annotation.IconAnnotation.get),
|
|
204
|
-
Option.getOrElse(() => ({
|
|
396
|
+
Option.getOrElse(() => ({
|
|
397
|
+
icon: 'ph--cube--regular',
|
|
398
|
+
hue: undefined as string | undefined,
|
|
399
|
+
})),
|
|
205
400
|
);
|
|
206
401
|
const styles = hue ? getStyles(hue) : undefined;
|
|
207
402
|
return (
|
|
@@ -223,7 +418,7 @@ const ObjectsPanel = ({ db, context }: Pick<ChatOptionsProps, 'db' | 'context'>)
|
|
|
223
418
|
</SearchList.Viewport>
|
|
224
419
|
</SearchList.Content>
|
|
225
420
|
|
|
226
|
-
<div role='none' className='
|
|
421
|
+
<div role='none' className={mx('flex flex-col', styles.toolbar)}>
|
|
227
422
|
<Select.Root value={typename === ANY ? undefined : typename} onValueChange={setTypename}>
|
|
228
423
|
<Select.TriggerButton placeholder={t('type-filter.placeholder')} />
|
|
229
424
|
<Select.Portal>
|
|
@@ -242,11 +437,8 @@ const ObjectsPanel = ({ db, context }: Pick<ChatOptionsProps, 'db' | 'context'>)
|
|
|
242
437
|
</Select.Content>
|
|
243
438
|
</Select.Portal>
|
|
244
439
|
</Select.Root>
|
|
245
|
-
<SearchList.Input placeholder={t('search.placeholder')}
|
|
440
|
+
<SearchList.Input placeholder={t('search.placeholder')} autoFocus />
|
|
246
441
|
</div>
|
|
247
442
|
</SearchList.Root>
|
|
248
443
|
);
|
|
249
444
|
};
|
|
250
|
-
|
|
251
|
-
// TODO(dmaretskyi): Extract those somewhere else.
|
|
252
|
-
const DEFAULT_OBJECT_ICON = 'ph--cube--regular';
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { useAtomValue } from '@effect-atom/atom-react';
|
|
6
|
+
import * as Option from 'effect/Option';
|
|
7
|
+
import React, { useCallback, useEffect, useRef, useState } from 'react';
|
|
8
|
+
|
|
9
|
+
import { type Chat } from '@dxos/assistant-toolkit';
|
|
10
|
+
import { type Event } from '@dxos/async';
|
|
11
|
+
import { type Database } from '@dxos/echo';
|
|
12
|
+
import { type Merge } from '@dxos/effect';
|
|
13
|
+
import { useVoiceInput } from '@dxos/plugin-transcription';
|
|
14
|
+
import { Input, type ThemedClassName, useDynamicRef, useTranslation } from '@dxos/react-ui';
|
|
15
|
+
import { ChatEditor, type ChatEditorController, type ChatEditorProps } from '@dxos/react-ui-chat';
|
|
16
|
+
import { mx } from '@dxos/ui-theme';
|
|
17
|
+
|
|
18
|
+
import { useChatKeymapExtensions } from '#hooks';
|
|
19
|
+
import { meta } from '#meta';
|
|
20
|
+
|
|
21
|
+
import { type AiChatProcessor } from '../../processor';
|
|
22
|
+
import { type ChatEvent } from '../Chat/events';
|
|
23
|
+
import { ChatActions, type ChatActionsProps } from './ChatActions';
|
|
24
|
+
import { ChatMcpErrors } from './ChatMcpErrors';
|
|
25
|
+
import { ChatOptions } from './ChatOptions';
|
|
26
|
+
import { type ChatPresetsProps } from './ChatPresets';
|
|
27
|
+
import { ChatReferences } from './ChatReferences';
|
|
28
|
+
import { ChatStatusIndicator } from './ChatStatusIndicator';
|
|
29
|
+
|
|
30
|
+
export type ChatPromptProps = ThemedClassName<
|
|
31
|
+
Merge<
|
|
32
|
+
{
|
|
33
|
+
outline?: boolean;
|
|
34
|
+
settings?: boolean;
|
|
35
|
+
expandable?: boolean;
|
|
36
|
+
chat?: Chat.Chat;
|
|
37
|
+
db?: Database.Database;
|
|
38
|
+
processor: AiChatProcessor;
|
|
39
|
+
event: Event<ChatEvent>;
|
|
40
|
+
online?: boolean;
|
|
41
|
+
placeholder?: ChatEditorProps['placeholder'];
|
|
42
|
+
onOnlineChange?: (online: boolean) => void;
|
|
43
|
+
onPresetChange?: ChatPresetsProps['onChange'];
|
|
44
|
+
},
|
|
45
|
+
Omit<ChatPresetsProps, 'onChange'>
|
|
46
|
+
>
|
|
47
|
+
>;
|
|
48
|
+
|
|
49
|
+
export const ChatPrompt = ({
|
|
50
|
+
classNames,
|
|
51
|
+
outline,
|
|
52
|
+
chat,
|
|
53
|
+
db,
|
|
54
|
+
processor,
|
|
55
|
+
event,
|
|
56
|
+
online,
|
|
57
|
+
placeholder,
|
|
58
|
+
onOnlineChange,
|
|
59
|
+
onPresetChange,
|
|
60
|
+
settings = true,
|
|
61
|
+
presets,
|
|
62
|
+
preset,
|
|
63
|
+
}: ChatPromptProps) => {
|
|
64
|
+
const { t } = useTranslation(meta.id);
|
|
65
|
+
|
|
66
|
+
const error = useAtomValue(processor.error).pipe(Option.getOrUndefined);
|
|
67
|
+
const streaming = useAtomValue(processor.streaming);
|
|
68
|
+
const active = useAtomValue(processor.active);
|
|
69
|
+
const activeRef = useDynamicRef(active);
|
|
70
|
+
|
|
71
|
+
const editorRef = useRef<ChatEditorController>(null);
|
|
72
|
+
const [recordingState, setRecordingState] = useState(false);
|
|
73
|
+
useEffect(() => {
|
|
74
|
+
return event.on((ev) => {
|
|
75
|
+
switch (ev.type) {
|
|
76
|
+
case 'update-prompt':
|
|
77
|
+
if (!editorRef.current?.getText()?.length) {
|
|
78
|
+
editorRef.current?.setText(ev.text);
|
|
79
|
+
editorRef.current?.focus();
|
|
80
|
+
}
|
|
81
|
+
break;
|
|
82
|
+
case 'record-start':
|
|
83
|
+
setRecordingState(true);
|
|
84
|
+
break;
|
|
85
|
+
case 'record-stop':
|
|
86
|
+
setRecordingState(false);
|
|
87
|
+
break;
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
}, [event]);
|
|
91
|
+
|
|
92
|
+
// TODO(burdon): Configure capability in TranscriptionPlugin.
|
|
93
|
+
const { recording } = useVoiceInput({
|
|
94
|
+
active: recordingState,
|
|
95
|
+
onUpdate: (text) => {
|
|
96
|
+
editorRef.current?.setText(text);
|
|
97
|
+
editorRef.current?.focus();
|
|
98
|
+
},
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
const extensions = useChatKeymapExtensions({ event });
|
|
102
|
+
|
|
103
|
+
const handleSubmit = useCallback<NonNullable<ChatEditorProps['onSubmit']>>(
|
|
104
|
+
(text) => {
|
|
105
|
+
if (!activeRef.current) {
|
|
106
|
+
event.emit({ type: 'submit', text });
|
|
107
|
+
return true;
|
|
108
|
+
}
|
|
109
|
+
},
|
|
110
|
+
[event],
|
|
111
|
+
);
|
|
112
|
+
|
|
113
|
+
const handleEvent = useCallback<NonNullable<ChatActionsProps['onEvent']>>(
|
|
114
|
+
(ev) => {
|
|
115
|
+
event.emit(ev);
|
|
116
|
+
},
|
|
117
|
+
[event],
|
|
118
|
+
);
|
|
119
|
+
|
|
120
|
+
return (
|
|
121
|
+
<div
|
|
122
|
+
role='group'
|
|
123
|
+
className={mx(
|
|
124
|
+
'flex flex-col w-full dx-density-fine',
|
|
125
|
+
outline &&
|
|
126
|
+
'bg-group-surface rounded-sm! border border-subdued-separator transition transition-border [&:has(.cm-content:focus)]:border-separator',
|
|
127
|
+
classNames,
|
|
128
|
+
)}
|
|
129
|
+
>
|
|
130
|
+
<ChatMcpErrors processor={processor} />
|
|
131
|
+
|
|
132
|
+
<div role='none' className='flex p-2 gap-2'>
|
|
133
|
+
<ChatStatusIndicator classNames='p-1' preset={preset} error={error} processing={streaming} />
|
|
134
|
+
<ChatEditor
|
|
135
|
+
ref={editorRef}
|
|
136
|
+
autoFocus
|
|
137
|
+
lineWrapping
|
|
138
|
+
classNames='col-span-2 pt-0.5'
|
|
139
|
+
placeholder={placeholder ?? t('prompt.placeholder')}
|
|
140
|
+
extensions={extensions}
|
|
141
|
+
onSubmit={handleSubmit}
|
|
142
|
+
/>
|
|
143
|
+
</div>
|
|
144
|
+
|
|
145
|
+
{db && settings && (
|
|
146
|
+
<div role='none' className='flex items-center overflow-hidden p-1.5'>
|
|
147
|
+
<ChatOptions
|
|
148
|
+
chat={chat}
|
|
149
|
+
db={db}
|
|
150
|
+
blueprintRegistry={processor.blueprintRegistry}
|
|
151
|
+
context={processor.context}
|
|
152
|
+
preset={preset}
|
|
153
|
+
presets={presets}
|
|
154
|
+
onPresetChange={onPresetChange}
|
|
155
|
+
/>
|
|
156
|
+
|
|
157
|
+
<div role='none' className='flex h-8 grow overflow-x-auto scrollbar-none'>
|
|
158
|
+
<ChatReferences db={db} context={processor.context} />
|
|
159
|
+
</div>
|
|
160
|
+
|
|
161
|
+
<ChatActions
|
|
162
|
+
classNames='col-span-2'
|
|
163
|
+
microphone={true}
|
|
164
|
+
recording={recording}
|
|
165
|
+
processing={streaming}
|
|
166
|
+
onEvent={handleEvent}
|
|
167
|
+
>
|
|
168
|
+
{/* TODO(burdon): Move offline switch into dialog. */}
|
|
169
|
+
{online !== undefined && (
|
|
170
|
+
<Input.Root>
|
|
171
|
+
<Input.Label srOnly>{t('online-switch.label')}</Input.Label>
|
|
172
|
+
<Input.Switch classNames='mx-1' checked={online} onCheckedChange={onOnlineChange} />
|
|
173
|
+
</Input.Root>
|
|
174
|
+
)}
|
|
175
|
+
</ChatActions>
|
|
176
|
+
</div>
|
|
177
|
+
)}
|
|
178
|
+
</div>
|
|
179
|
+
);
|
|
180
|
+
};
|
|
181
|
+
|
|
182
|
+
ChatPrompt.displayName = 'Chat.Prompt';
|