@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,8 +7,9 @@ import * as Effect from 'effect/Effect';
|
|
|
7
7
|
import React, { useState } from 'react';
|
|
8
8
|
|
|
9
9
|
import { withPluginManager } from '@dxos/app-framework/testing';
|
|
10
|
+
import { Chat } from '@dxos/assistant-toolkit';
|
|
10
11
|
import { capabilities } from '@dxos/assistant-toolkit/testing';
|
|
11
|
-
import { Feed, Filter } from '@dxos/echo';
|
|
12
|
+
import { Feed, Filter, Ref } from '@dxos/echo';
|
|
12
13
|
import { ChessPlugin } from '@dxos/plugin-chess';
|
|
13
14
|
import { ClientPlugin } from '@dxos/plugin-client';
|
|
14
15
|
import { initializeIdentity } from '@dxos/plugin-client/testing';
|
|
@@ -20,14 +21,23 @@ import { Loading, withTheme } from '@dxos/react-ui/testing';
|
|
|
20
21
|
import { Organization, Person } from '@dxos/types';
|
|
21
22
|
|
|
22
23
|
import { useBlueprintRegistry, useContextBinder } from '#hooks';
|
|
24
|
+
import { translations } from '#translations';
|
|
23
25
|
|
|
24
|
-
import { translations } from '../../translations';
|
|
25
26
|
import { ChatOptions, ObjectsPanel, type ChatOptionsProps } from './ChatOptions';
|
|
26
27
|
|
|
27
28
|
const presets = [
|
|
28
|
-
{
|
|
29
|
-
|
|
30
|
-
|
|
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
|
+
},
|
|
31
41
|
];
|
|
32
42
|
|
|
33
43
|
type DefaultStoryProps = Pick<ChatOptionsProps, 'presets'>;
|
|
@@ -35,14 +45,17 @@ type DefaultStoryProps = Pick<ChatOptionsProps, 'presets'>;
|
|
|
35
45
|
const DefaultStory = ({ presets }: DefaultStoryProps) => {
|
|
36
46
|
const [space] = useSpaces();
|
|
37
47
|
const [feed] = useQuery(space?.db, Filter.type(Feed.Feed));
|
|
48
|
+
const [chat] = useQuery(space?.db, Filter.type(Chat.Chat));
|
|
38
49
|
const blueprintRegistry = useBlueprintRegistry();
|
|
39
50
|
const binder = useContextBinder(space, feed);
|
|
40
51
|
const [preset, setPreset] = useState(presets?.[0]?.id);
|
|
41
|
-
if (!space || !binder) {
|
|
52
|
+
if (!space || !binder || !chat) {
|
|
42
53
|
return <Loading />;
|
|
43
54
|
}
|
|
55
|
+
|
|
44
56
|
return (
|
|
45
57
|
<ChatOptions
|
|
58
|
+
chat={chat}
|
|
46
59
|
db={space.db}
|
|
47
60
|
context={binder}
|
|
48
61
|
blueprintRegistry={blueprintRegistry}
|
|
@@ -63,7 +76,7 @@ const meta = {
|
|
|
63
76
|
plugins: [
|
|
64
77
|
...corePlugins(),
|
|
65
78
|
ClientPlugin({
|
|
66
|
-
types: [Feed.Feed, Organization.Organization, Person.Person],
|
|
79
|
+
types: [Chat.Chat, Feed.Feed, Organization.Organization, Person.Person],
|
|
67
80
|
onClientInitialized: ({ client }) =>
|
|
68
81
|
Effect.gen(function* () {
|
|
69
82
|
yield* initializeIdentity(client);
|
|
@@ -77,7 +90,8 @@ const meta = {
|
|
|
77
90
|
}
|
|
78
91
|
|
|
79
92
|
// Create the chat feed used by the context binder.
|
|
80
|
-
space.db.add(Feed.make());
|
|
93
|
+
const feed = space.db.add(Feed.make());
|
|
94
|
+
space.db.add(Chat.make({ name: 'Test chat', feed: Ref.make(feed) }));
|
|
81
95
|
yield* Effect.promise(() => space.db.flush({ indexes: true }));
|
|
82
96
|
}),
|
|
83
97
|
}),
|
|
@@ -104,7 +118,7 @@ export const Default: Story = {
|
|
|
104
118
|
},
|
|
105
119
|
};
|
|
106
120
|
|
|
107
|
-
export const
|
|
121
|
+
export const _ObjectsPanel: Story = {
|
|
108
122
|
render: () => {
|
|
109
123
|
const [space] = useSpaces();
|
|
110
124
|
const [feed] = useQuery(space?.db, Filter.type(Feed.Feed));
|
|
@@ -114,7 +128,7 @@ export const ObjectsPanelStory: Story = {
|
|
|
114
128
|
}
|
|
115
129
|
|
|
116
130
|
return (
|
|
117
|
-
<div className='
|
|
131
|
+
<div className='grid w-[300px] h-[300px] border border-separator'>
|
|
118
132
|
<ObjectsPanel db={space.db} context={binder} />
|
|
119
133
|
</div>
|
|
120
134
|
);
|
|
@@ -6,10 +6,10 @@ import * as Option from 'effect/Option';
|
|
|
6
6
|
import React, { type JSX, useCallback, useMemo, useState } from 'react';
|
|
7
7
|
|
|
8
8
|
import { type AiContextBinder } from '@dxos/assistant';
|
|
9
|
-
import { McpServer } from '@dxos/assistant-toolkit';
|
|
10
|
-
import { type Blueprint } from '@dxos/
|
|
9
|
+
import { type Chat as ChatModule, McpServer } from '@dxos/assistant-toolkit';
|
|
10
|
+
import { type Blueprint } from '@dxos/compute';
|
|
11
11
|
import { Annotation, type Database, Filter, Obj, Type } from '@dxos/echo';
|
|
12
|
-
import { useQuery } from '@dxos/react-client/echo';
|
|
12
|
+
import { useObject, useQuery } from '@dxos/react-client/echo';
|
|
13
13
|
import { IconButton, Input, Popover, Select, useTranslation } from '@dxos/react-ui';
|
|
14
14
|
import { Listbox, SearchList, useSearchListResults } from '@dxos/react-ui-search';
|
|
15
15
|
import { Tabs } from '@dxos/react-ui-tabs';
|
|
@@ -17,13 +17,15 @@ import { getStyles, mx } from '@dxos/ui-theme';
|
|
|
17
17
|
|
|
18
18
|
import { useActiveBlueprints, useBlueprintHandlers, useBlueprints, useContextObjects, useFilteredTypes } from '#hooks';
|
|
19
19
|
import { meta } from '#meta';
|
|
20
|
+
import { Assistant } from '#types';
|
|
20
21
|
|
|
21
22
|
const styles = {
|
|
22
|
-
panel: 'w-[calc(100dvw-.5rem)] sm:w-max
|
|
23
|
-
toolbar: 'p-
|
|
23
|
+
panel: 'w-[calc(100dvw-.5rem)] sm:w-max max-w-document-width',
|
|
24
|
+
toolbar: 'p-0! gap-0! border-t border-separator',
|
|
24
25
|
};
|
|
25
26
|
|
|
26
27
|
export type ChatOptionsProps = {
|
|
28
|
+
chat?: ChatModule.Chat;
|
|
27
29
|
db: Database.Database;
|
|
28
30
|
context: AiContextBinder;
|
|
29
31
|
blueprintRegistry?: Blueprint.Registry;
|
|
@@ -35,11 +37,19 @@ export type ChatOptionsProps = {
|
|
|
35
37
|
/**
|
|
36
38
|
* Manages the runtime context for the chat.
|
|
37
39
|
*/
|
|
38
|
-
export const ChatOptions = ({
|
|
40
|
+
export const ChatOptions = ({
|
|
41
|
+
chat,
|
|
42
|
+
db,
|
|
43
|
+
context,
|
|
44
|
+
blueprintRegistry,
|
|
45
|
+
presets,
|
|
46
|
+
preset,
|
|
47
|
+
onPresetChange,
|
|
48
|
+
}: ChatOptionsProps) => {
|
|
39
49
|
const { t } = useTranslation(meta.id);
|
|
40
50
|
|
|
41
51
|
return (
|
|
42
|
-
<div role='none' className='flex
|
|
52
|
+
<div role='none' className='flex'>
|
|
43
53
|
<Popover.Root>
|
|
44
54
|
<Popover.Trigger asChild>
|
|
45
55
|
<IconButton variant='ghost' icon='ph--plus--regular' iconOnly label={t('context-objects.button')} />
|
|
@@ -66,37 +76,39 @@ export const ChatOptions = ({ db, context, blueprintRegistry, presets, preset, o
|
|
|
66
76
|
<Popover.Portal>
|
|
67
77
|
<Popover.Content side='top' classNames={styles.panel}>
|
|
68
78
|
<Popover.Viewport>
|
|
69
|
-
<Tabs.Root
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
<Tabs.Panel value='model' tabIndex={-1} classNames='dx-focus-ring-inset'>
|
|
80
|
-
<ModelsPanel presets={presets} preset={preset} onPresetChange={onPresetChange} />
|
|
79
|
+
<Tabs.Root
|
|
80
|
+
classNames='flex'
|
|
81
|
+
orientation='horizontal'
|
|
82
|
+
defaultValue='view'
|
|
83
|
+
defaultActivePart='list'
|
|
84
|
+
tabIndex={-1}
|
|
85
|
+
>
|
|
86
|
+
<Tabs.Viewport classNames={mx('grid grid-rows-[1fr_40px] w-full')}>
|
|
87
|
+
<Tabs.Panel tabIndex={-1} classNames='dx-focus-ring-inset overflow-hidden' value='view'>
|
|
88
|
+
<ViewPanel chat={chat} />
|
|
81
89
|
</Tabs.Panel>
|
|
82
|
-
<Tabs.Panel
|
|
90
|
+
<Tabs.Panel tabIndex={-1} classNames='dx-focus-ring-inset overflow-hidden' value='blueprints'>
|
|
91
|
+
<BlueprintsPanel blueprintRegistry={blueprintRegistry} db={db} context={context} />
|
|
92
|
+
</Tabs.Panel>
|
|
93
|
+
<Tabs.Panel tabIndex={-1} classNames='dx-focus-ring-inset overflow-hidden' value='mcp-servers'>
|
|
83
94
|
<McpServersPanel db={db} />
|
|
84
95
|
</Tabs.Panel>
|
|
85
|
-
<Tabs.Panel
|
|
86
|
-
<
|
|
96
|
+
<Tabs.Panel tabIndex={-1} classNames='dx-focus-ring-inset overflow-hidden' value='model'>
|
|
97
|
+
<ModelsPanel presets={presets} preset={preset} onPresetChange={onPresetChange} />
|
|
87
98
|
</Tabs.Panel>
|
|
88
|
-
<Tabs.Tablist classNames={styles.toolbar}>
|
|
89
|
-
<Tabs.IconTab value='
|
|
99
|
+
<Tabs.Tablist classNames={[styles.toolbar]}>
|
|
100
|
+
<Tabs.IconTab value='view' icon='ph--eye--regular' label={t('chat-view.title')} />
|
|
90
101
|
<Tabs.IconTab
|
|
91
102
|
value='blueprints'
|
|
92
103
|
icon='ph--blueprint--regular'
|
|
93
|
-
label={t('blueprints
|
|
104
|
+
label={t('options.blueprints.title')}
|
|
94
105
|
/>
|
|
95
106
|
<Tabs.IconTab
|
|
96
107
|
value='mcp-servers'
|
|
97
108
|
icon='ph--plugs-connected--regular'
|
|
98
|
-
label={t('mcp
|
|
109
|
+
label={t('options.mcp.title')}
|
|
99
110
|
/>
|
|
111
|
+
<Tabs.IconTab value='model' icon='ph--cpu--regular' label={t('options.chat-model.title')} />
|
|
100
112
|
</Tabs.Tablist>
|
|
101
113
|
</Tabs.Viewport>
|
|
102
114
|
</Tabs.Root>
|
|
@@ -126,7 +138,7 @@ const BlueprintsPanel = ({
|
|
|
126
138
|
|
|
127
139
|
return (
|
|
128
140
|
<SearchList.Root onSearch={handleSearch}>
|
|
129
|
-
<SearchList.Content classNames='
|
|
141
|
+
<SearchList.Content classNames='flex flex-col'>
|
|
130
142
|
<SearchList.Viewport>
|
|
131
143
|
{results.map((blueprint) => {
|
|
132
144
|
const isActive = activeBlueprints.has(blueprint.key);
|
|
@@ -142,12 +154,29 @@ const BlueprintsPanel = ({
|
|
|
142
154
|
);
|
|
143
155
|
})}
|
|
144
156
|
</SearchList.Viewport>
|
|
157
|
+
<SearchList.Input placeholder={t('search.placeholder')} classNames='border-t border-separator' autoFocus />
|
|
145
158
|
</SearchList.Content>
|
|
146
|
-
<SearchList.Input placeholder={t('search.placeholder')} classNames='mb-form-chrome' autoFocus />
|
|
147
159
|
</SearchList.Root>
|
|
148
160
|
);
|
|
149
161
|
};
|
|
150
162
|
|
|
163
|
+
const ViewPanel = ({ chat }: Pick<ChatOptionsProps, 'chat'>) => {
|
|
164
|
+
const { t } = useTranslation(meta.id);
|
|
165
|
+
const [view, setView] = useObject(chat, 'view');
|
|
166
|
+
const value = (view as Assistant.ChatView | undefined) ?? 'normal';
|
|
167
|
+
|
|
168
|
+
return (
|
|
169
|
+
<Listbox.Root value={value} onValueChange={setView} autoFocus>
|
|
170
|
+
{Assistant.ChatViews.map((view) => (
|
|
171
|
+
<Listbox.Option key={view} value={view}>
|
|
172
|
+
<Listbox.OptionLabel>{t(`chat-view.${view}.label`, { defaultValue: view })}</Listbox.OptionLabel>
|
|
173
|
+
<Listbox.OptionIndicator />
|
|
174
|
+
</Listbox.Option>
|
|
175
|
+
))}
|
|
176
|
+
</Listbox.Root>
|
|
177
|
+
);
|
|
178
|
+
};
|
|
179
|
+
|
|
151
180
|
const ModelsPanel = ({
|
|
152
181
|
presets,
|
|
153
182
|
preset,
|
|
@@ -185,7 +214,7 @@ const McpServersPanel = ({ db }: McpServersPanelProps) => {
|
|
|
185
214
|
);
|
|
186
215
|
|
|
187
216
|
const handleToggle = useCallback((server: McpServer.McpServer, enabled: boolean) => {
|
|
188
|
-
Obj.
|
|
217
|
+
Obj.update(server, (server) => {
|
|
189
218
|
server.enabled = enabled;
|
|
190
219
|
});
|
|
191
220
|
}, []);
|
|
@@ -198,7 +227,7 @@ const McpServersPanel = ({ db }: McpServersPanelProps) => {
|
|
|
198
227
|
);
|
|
199
228
|
|
|
200
229
|
return (
|
|
201
|
-
<div className='
|
|
230
|
+
<div className='p-form-chrome'>
|
|
202
231
|
{servers.map((server) => (
|
|
203
232
|
<div key={server.id} className='flex items-center gap-2 px-form-chrome'>
|
|
204
233
|
<Input.Root>
|
|
@@ -222,7 +251,7 @@ const McpServersPanel = ({ db }: McpServersPanelProps) => {
|
|
|
222
251
|
{adding ? (
|
|
223
252
|
<McpServerForm onSubmit={handleAdd} onCancel={() => setAdding(false)} />
|
|
224
253
|
) : (
|
|
225
|
-
<div role='none'
|
|
254
|
+
<div role='none'>
|
|
226
255
|
<IconButton
|
|
227
256
|
variant='ghost'
|
|
228
257
|
icon='ph--plus--regular'
|
|
@@ -0,0 +1,179 @@
|
|
|
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 { ChatOptions } from './ChatOptions';
|
|
25
|
+
import { type ChatPresetsProps } from './ChatPresets';
|
|
26
|
+
import { ChatReferences } from './ChatReferences';
|
|
27
|
+
import { ChatStatusIndicator } from './ChatStatusIndicator';
|
|
28
|
+
|
|
29
|
+
export type ChatPromptProps = ThemedClassName<
|
|
30
|
+
Merge<
|
|
31
|
+
{
|
|
32
|
+
outline?: boolean;
|
|
33
|
+
settings?: boolean;
|
|
34
|
+
expandable?: boolean;
|
|
35
|
+
chat?: Chat.Chat;
|
|
36
|
+
db?: Database.Database;
|
|
37
|
+
processor: AiChatProcessor;
|
|
38
|
+
event: Event<ChatEvent>;
|
|
39
|
+
online?: boolean;
|
|
40
|
+
placeholder?: ChatEditorProps['placeholder'];
|
|
41
|
+
onOnlineChange?: (online: boolean) => void;
|
|
42
|
+
onPresetChange?: ChatPresetsProps['onChange'];
|
|
43
|
+
},
|
|
44
|
+
Omit<ChatPresetsProps, 'onChange'>
|
|
45
|
+
>
|
|
46
|
+
>;
|
|
47
|
+
|
|
48
|
+
export const ChatPrompt = ({
|
|
49
|
+
classNames,
|
|
50
|
+
outline,
|
|
51
|
+
chat,
|
|
52
|
+
db,
|
|
53
|
+
processor,
|
|
54
|
+
event,
|
|
55
|
+
online,
|
|
56
|
+
placeholder,
|
|
57
|
+
onOnlineChange,
|
|
58
|
+
onPresetChange,
|
|
59
|
+
settings = true,
|
|
60
|
+
presets,
|
|
61
|
+
preset,
|
|
62
|
+
}: ChatPromptProps) => {
|
|
63
|
+
const { t } = useTranslation(meta.id);
|
|
64
|
+
|
|
65
|
+
const error = useAtomValue(processor.error).pipe(Option.getOrUndefined);
|
|
66
|
+
const streaming = useAtomValue(processor.streaming);
|
|
67
|
+
const active = useAtomValue(processor.active);
|
|
68
|
+
const activeRef = useDynamicRef(active);
|
|
69
|
+
|
|
70
|
+
const editorRef = useRef<ChatEditorController>(null);
|
|
71
|
+
const [recordingState, setRecordingState] = useState(false);
|
|
72
|
+
useEffect(() => {
|
|
73
|
+
return event.on((ev) => {
|
|
74
|
+
switch (ev.type) {
|
|
75
|
+
case 'update-prompt':
|
|
76
|
+
if (!editorRef.current?.getText()?.length) {
|
|
77
|
+
editorRef.current?.setText(ev.text);
|
|
78
|
+
editorRef.current?.focus();
|
|
79
|
+
}
|
|
80
|
+
break;
|
|
81
|
+
case 'record-start':
|
|
82
|
+
setRecordingState(true);
|
|
83
|
+
break;
|
|
84
|
+
case 'record-stop':
|
|
85
|
+
setRecordingState(false);
|
|
86
|
+
break;
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
}, [event]);
|
|
90
|
+
|
|
91
|
+
// TODO(burdon): Configure capability in TranscriptionPlugin.
|
|
92
|
+
const { recording } = useVoiceInput({
|
|
93
|
+
active: recordingState,
|
|
94
|
+
onUpdate: (text) => {
|
|
95
|
+
editorRef.current?.setText(text);
|
|
96
|
+
editorRef.current?.focus();
|
|
97
|
+
},
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
const extensions = useChatKeymapExtensions({ event });
|
|
101
|
+
|
|
102
|
+
const handleSubmit = useCallback<NonNullable<ChatEditorProps['onSubmit']>>(
|
|
103
|
+
(text) => {
|
|
104
|
+
if (!activeRef.current) {
|
|
105
|
+
event.emit({ type: 'submit', text });
|
|
106
|
+
return true;
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
[event],
|
|
110
|
+
);
|
|
111
|
+
|
|
112
|
+
const handleEvent = useCallback<NonNullable<ChatActionsProps['onEvent']>>(
|
|
113
|
+
(ev) => {
|
|
114
|
+
event.emit(ev);
|
|
115
|
+
},
|
|
116
|
+
[event],
|
|
117
|
+
);
|
|
118
|
+
|
|
119
|
+
return (
|
|
120
|
+
<div
|
|
121
|
+
role='group'
|
|
122
|
+
className={mx(
|
|
123
|
+
'flex flex-col w-full dx-density-fine',
|
|
124
|
+
outline &&
|
|
125
|
+
'bg-group-surface rounded-sm! border border-subdued-separator transition transition-border [&:has(.cm-content:focus)]:border-separator',
|
|
126
|
+
classNames,
|
|
127
|
+
)}
|
|
128
|
+
>
|
|
129
|
+
<div role='none' className='flex p-2 gap-2'>
|
|
130
|
+
<ChatStatusIndicator classNames='p-1' preset={preset} error={error} processing={streaming} />
|
|
131
|
+
<ChatEditor
|
|
132
|
+
ref={editorRef}
|
|
133
|
+
autoFocus
|
|
134
|
+
lineWrapping
|
|
135
|
+
classNames='col-span-2 pt-0.5'
|
|
136
|
+
placeholder={placeholder ?? t('prompt.placeholder')}
|
|
137
|
+
extensions={extensions}
|
|
138
|
+
onSubmit={handleSubmit}
|
|
139
|
+
/>
|
|
140
|
+
</div>
|
|
141
|
+
|
|
142
|
+
{db && settings && (
|
|
143
|
+
<div role='none' className='flex items-center overflow-hidden p-1.5'>
|
|
144
|
+
<ChatOptions
|
|
145
|
+
chat={chat}
|
|
146
|
+
db={db}
|
|
147
|
+
blueprintRegistry={processor.blueprintRegistry}
|
|
148
|
+
context={processor.context}
|
|
149
|
+
preset={preset}
|
|
150
|
+
presets={presets}
|
|
151
|
+
onPresetChange={onPresetChange}
|
|
152
|
+
/>
|
|
153
|
+
|
|
154
|
+
<div role='none' className='flex h-8 grow overflow-x-auto scrollbar-none'>
|
|
155
|
+
<ChatReferences db={db} context={processor.context} />
|
|
156
|
+
</div>
|
|
157
|
+
|
|
158
|
+
<ChatActions
|
|
159
|
+
classNames='col-span-2'
|
|
160
|
+
microphone={true}
|
|
161
|
+
recording={recording}
|
|
162
|
+
processing={streaming}
|
|
163
|
+
onEvent={handleEvent}
|
|
164
|
+
>
|
|
165
|
+
{/* TODO(burdon): Move offline switch into dialog. */}
|
|
166
|
+
{online !== undefined && (
|
|
167
|
+
<Input.Root>
|
|
168
|
+
<Input.Label srOnly>{t('online-switch.label')}</Input.Label>
|
|
169
|
+
<Input.Switch classNames='mx-2' checked={online} onCheckedChange={onOnlineChange} />
|
|
170
|
+
</Input.Root>
|
|
171
|
+
)}
|
|
172
|
+
</ChatActions>
|
|
173
|
+
</div>
|
|
174
|
+
)}
|
|
175
|
+
</div>
|
|
176
|
+
);
|
|
177
|
+
};
|
|
178
|
+
|
|
179
|
+
ChatPrompt.displayName = 'Chat.Prompt';
|
|
@@ -41,7 +41,7 @@ export const ChatReferences = ({ classNames, context, db }: ChatReferencesProps)
|
|
|
41
41
|
icon='ph--x--bold'
|
|
42
42
|
iconOnly
|
|
43
43
|
variant='ghost'
|
|
44
|
-
label={t('remove-object
|
|
44
|
+
label={t('remove-object.label')}
|
|
45
45
|
classNames='p-0 hover:bg-transparent'
|
|
46
46
|
size={3}
|
|
47
47
|
onClick={() => onUpdateObject?.(dxn, false)}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2026 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import React, { useEffect, useMemo, useState } from 'react';
|
|
6
|
+
|
|
7
|
+
import { type ThemedClassName } from '@dxos/react-ui';
|
|
8
|
+
import { ChatStatus as NaturalChatStatus, formatElapsed } from '@dxos/react-ui-chat';
|
|
9
|
+
import { Matrix } from '@dxos/react-ui-sfx';
|
|
10
|
+
import { type ContentBlock } from '@dxos/types';
|
|
11
|
+
import { Unit } from '@dxos/util';
|
|
12
|
+
|
|
13
|
+
import { type ChatRequestTiming, useChatContext } from '../Chat/context';
|
|
14
|
+
|
|
15
|
+
const CHAT_STREAM_STATUS_NAME = 'Chat.StreamStatus';
|
|
16
|
+
const TICK_MS = 1_000;
|
|
17
|
+
|
|
18
|
+
export type ChatStreamStatusProps = ThemedClassName<{
|
|
19
|
+
icon?: boolean;
|
|
20
|
+
}>;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Live status pill rendered at the bottom of the chat thread.
|
|
24
|
+
*
|
|
25
|
+
* The block-widget host re-mounts this component each time wire's drip queue toggles
|
|
26
|
+
* (`wireDrainingEffect`) — so all visible state is derived from chat-context values that
|
|
27
|
+
* survive the unmount: the latest `stats` block on the chat context's `messages` for token counts,
|
|
28
|
+
* and `requestTiming` (start/end wall-clock timestamps) for the elapsed value.
|
|
29
|
+
*
|
|
30
|
+
* Shows:
|
|
31
|
+
* - elapsed seconds since the most recent request started (frozen at end-of-request)
|
|
32
|
+
* - last completed turn's output token count (from the most recent `stats` content block)
|
|
33
|
+
* - cumulative session total tokens across all `stats` content blocks
|
|
34
|
+
*/
|
|
35
|
+
export const ChatStatus = ({ classNames, icon }: ChatStreamStatusProps) => {
|
|
36
|
+
// Read `messages` from the chat context (combines `useQuery(queue)` + the processor's
|
|
37
|
+
// pending atom) rather than `processor.messages` directly — the latter only contains
|
|
38
|
+
// blocks streamed via the ephemeral `PartialBlock` channel, while finalized blocks
|
|
39
|
+
// (including the per-turn `stats` block we read for token counts) are submitted to the
|
|
40
|
+
// feed via `_submitMessage` and only show up through `useQuery`.
|
|
41
|
+
const { messages, requestTiming } = useChatContext(CHAT_STREAM_STATUS_NAME);
|
|
42
|
+
|
|
43
|
+
const { lastOutputTokens, sessionTotalTokens } = useMemo(() => {
|
|
44
|
+
let last: number | undefined;
|
|
45
|
+
let total = 0;
|
|
46
|
+
for (const message of messages) {
|
|
47
|
+
for (const block of message.blocks) {
|
|
48
|
+
if (isStats(block) && block.usage) {
|
|
49
|
+
last = block.usage.outputTokens;
|
|
50
|
+
total += block.usage.totalTokens ?? 0;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
return { lastOutputTokens: last, sessionTotalTokens: total };
|
|
55
|
+
}, [messages]);
|
|
56
|
+
|
|
57
|
+
const isRunning = requestTiming != null && requestTiming.endedAt == null;
|
|
58
|
+
const show = requestTiming || lastOutputTokens || sessionTotalTokens > 0;
|
|
59
|
+
if (!show) {
|
|
60
|
+
return null;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
return (
|
|
64
|
+
<NaturalChatStatus.Root defaultRunning={false} classNames={['py-2 gap-2 text-sm', classNames]}>
|
|
65
|
+
{icon && (
|
|
66
|
+
<NaturalChatStatus.Icon>
|
|
67
|
+
<Matrix
|
|
68
|
+
classNames='w-5 h-5'
|
|
69
|
+
dotClassNames='bg-primary-500'
|
|
70
|
+
dim={4}
|
|
71
|
+
dotSize={3}
|
|
72
|
+
count={10}
|
|
73
|
+
interval={500}
|
|
74
|
+
active={isRunning}
|
|
75
|
+
/>
|
|
76
|
+
</NaturalChatStatus.Icon>
|
|
77
|
+
)}
|
|
78
|
+
{show && (
|
|
79
|
+
<div role='none' className='flex items-center'>
|
|
80
|
+
{requestTiming && (
|
|
81
|
+
<NaturalChatStatus.Text>
|
|
82
|
+
<Elapsed timing={requestTiming} />
|
|
83
|
+
</NaturalChatStatus.Text>
|
|
84
|
+
)}
|
|
85
|
+
{lastOutputTokens != null && (
|
|
86
|
+
<>
|
|
87
|
+
{requestTiming && <NaturalChatStatus.Separator />}
|
|
88
|
+
<NaturalChatStatus.Text>↓ {Unit.Thousand(lastOutputTokens).toString()}</NaturalChatStatus.Text>
|
|
89
|
+
</>
|
|
90
|
+
)}
|
|
91
|
+
{sessionTotalTokens > 0 && (
|
|
92
|
+
<>
|
|
93
|
+
{(requestTiming || lastOutputTokens != null) && <NaturalChatStatus.Separator />}
|
|
94
|
+
<NaturalChatStatus.Text>Σ {Unit.Thousand(sessionTotalTokens).toString()}</NaturalChatStatus.Text>
|
|
95
|
+
</>
|
|
96
|
+
)}
|
|
97
|
+
</div>
|
|
98
|
+
)}
|
|
99
|
+
</NaturalChatStatus.Root>
|
|
100
|
+
);
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Wall-clock-derived elapsed display. Tick interval forces a re-render every second while
|
|
105
|
+
* the request is active so the displayed value advances; once `endedAt` is set, the value
|
|
106
|
+
* is frozen and the interval is no longer scheduled.
|
|
107
|
+
*/
|
|
108
|
+
const Elapsed = ({ timing }: { timing: ChatRequestTiming }) => {
|
|
109
|
+
const isRunning = timing.endedAt == null;
|
|
110
|
+
const [now, setNow] = useState(Date.now());
|
|
111
|
+
useEffect(() => {
|
|
112
|
+
if (!isRunning) {
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
const id = setInterval(() => setNow(Date.now()), TICK_MS);
|
|
117
|
+
return () => clearInterval(id);
|
|
118
|
+
}, [isRunning]);
|
|
119
|
+
|
|
120
|
+
return <>{formatElapsed((timing.endedAt ?? now) - timing.startedAt)}</>;
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
const isStats = (block: ContentBlock.Any): block is ContentBlock.Stats => block._tag === 'stats';
|
|
@@ -9,9 +9,9 @@ import * as Layer from 'effect/Layer';
|
|
|
9
9
|
import React, { useEffect, useMemo, useState } from 'react';
|
|
10
10
|
|
|
11
11
|
import { withPluginManager } from '@dxos/app-framework/testing';
|
|
12
|
+
import { ContextQueueService } from '@dxos/compute';
|
|
12
13
|
import { Database } from '@dxos/echo';
|
|
13
14
|
import { runAndForwardErrors } from '@dxos/effect';
|
|
14
|
-
import { ContextQueueService } from '@dxos/functions';
|
|
15
15
|
import { ClientPlugin } from '@dxos/plugin-client';
|
|
16
16
|
import { initializeIdentity } from '@dxos/plugin-client/testing';
|
|
17
17
|
import { PreviewPlugin } from '@dxos/plugin-preview';
|
|
@@ -23,8 +23,8 @@ import { Loading, withLayout, withTheme } from '@dxos/react-ui/testing';
|
|
|
23
23
|
import { Message, Organization, Person } from '@dxos/types';
|
|
24
24
|
|
|
25
25
|
import { createMessageGenerator } from '#testing';
|
|
26
|
+
import { translations } from '#translations';
|
|
26
27
|
|
|
27
|
-
import { translations } from '../../translations';
|
|
28
28
|
import { ChatThread, type ChatThreadProps } from './ChatThread';
|
|
29
29
|
|
|
30
30
|
random.seed(1);
|
|
@@ -136,7 +136,7 @@ export const Delayed: Story = {
|
|
|
136
136
|
delay: 500,
|
|
137
137
|
options: {
|
|
138
138
|
autoScroll: true,
|
|
139
|
-
|
|
139
|
+
typewriter: true,
|
|
140
140
|
cursor: true,
|
|
141
141
|
},
|
|
142
142
|
},
|