@dxos/plugin-assistant 0.8.4-main.bc674ce → 0.8.4-main.bcb3aa67d6
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-PTNCDWC6.mjs +100 -0
- package/dist/lib/browser/AssistantSettings-PTNCDWC6.mjs.map +7 -0
- package/dist/lib/browser/blueprints/index.mjs +3 -7
- package/dist/lib/browser/chunk-EZRS3J25.mjs +30 -0
- package/dist/lib/browser/chunk-EZRS3J25.mjs.map +7 -0
- package/dist/lib/browser/chunk-OWBVGFDF.mjs +345 -0
- package/dist/lib/browser/chunk-OWBVGFDF.mjs.map +7 -0
- package/dist/lib/browser/chunk-RUV2WOQH.mjs +154 -0
- package/dist/lib/browser/chunk-RUV2WOQH.mjs.map +7 -0
- package/dist/lib/browser/chunk-YD4JTOO5.mjs +173 -0
- package/dist/lib/browser/chunk-YD4JTOO5.mjs.map +7 -0
- package/dist/lib/browser/create-chat-6G6WROW2.mjs +89 -0
- package/dist/lib/browser/create-chat-6G6WROW2.mjs.map +7 -0
- package/dist/lib/browser/ensure-companion-chat-F46BGW2T.mjs +65 -0
- package/dist/lib/browser/ensure-companion-chat-F46BGW2T.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +2458 -245
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/on-create-space-F5HHB3GI.mjs +22 -0
- package/dist/lib/browser/on-create-space-F5HHB3GI.mjs.map +7 -0
- package/dist/lib/browser/operations/index.mjs +13 -0
- package/dist/lib/browser/operations/index.mjs.map +7 -0
- package/dist/lib/browser/resolve-navigation-targets-5Y7FT4CQ.mjs +22 -0
- package/dist/lib/browser/resolve-navigation-targets-5Y7FT4CQ.mjs.map +7 -0
- package/dist/lib/browser/run-prompt-in-new-chat-XSPRWOSR.mjs +144 -0
- package/dist/lib/browser/run-prompt-in-new-chat-XSPRWOSR.mjs.map +7 -0
- package/dist/lib/browser/set-current-chat-JPWBMS7N.mjs +35 -0
- package/dist/lib/browser/set-current-chat-JPWBMS7N.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +1 -4
- package/dist/lib/browser/update-chat-name-AEMFSIJX.mjs +60 -0
- package/dist/lib/browser/update-chat-name-AEMFSIJX.mjs.map +7 -0
- package/dist/lib/node-esm/AssistantSettings-Z5ZZWWSN.mjs +101 -0
- package/dist/lib/node-esm/AssistantSettings-Z5ZZWWSN.mjs.map +7 -0
- package/dist/lib/node-esm/blueprints/index.mjs +3 -7
- package/dist/lib/node-esm/chunk-NZIKC7AN.mjs +32 -0
- package/dist/lib/node-esm/chunk-NZIKC7AN.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-POJO5MTX.mjs +347 -0
- package/dist/lib/node-esm/chunk-POJO5MTX.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-PY4X6FJT.mjs +155 -0
- package/dist/lib/node-esm/chunk-PY4X6FJT.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-QHPGS4A4.mjs +174 -0
- package/dist/lib/node-esm/chunk-QHPGS4A4.mjs.map +7 -0
- package/dist/lib/node-esm/create-chat-EEMDTQRE.mjs +90 -0
- package/dist/lib/node-esm/create-chat-EEMDTQRE.mjs.map +7 -0
- package/dist/lib/node-esm/ensure-companion-chat-YAKJY7TB.mjs +66 -0
- package/dist/lib/node-esm/ensure-companion-chat-YAKJY7TB.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +2458 -245
- 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-YE5NQ3D2.mjs +23 -0
- package/dist/lib/node-esm/on-create-space-YE5NQ3D2.mjs.map +7 -0
- package/dist/lib/node-esm/operations/index.mjs +14 -0
- package/dist/lib/node-esm/operations/index.mjs.map +7 -0
- package/dist/lib/node-esm/resolve-navigation-targets-W3GTFXDD.mjs +23 -0
- package/dist/lib/node-esm/resolve-navigation-targets-W3GTFXDD.mjs.map +7 -0
- package/dist/lib/node-esm/run-prompt-in-new-chat-Q2CLUUM4.mjs +145 -0
- package/dist/lib/node-esm/run-prompt-in-new-chat-Q2CLUUM4.mjs.map +7 -0
- package/dist/lib/node-esm/set-current-chat-ZBEFWS6P.mjs +36 -0
- package/dist/lib/node-esm/set-current-chat-ZBEFWS6P.mjs.map +7 -0
- package/dist/lib/node-esm/types/index.mjs +1 -4
- package/dist/lib/node-esm/update-chat-name-6F7COUGR.mjs +61 -0
- package/dist/lib/node-esm/update-chat-name-6F7COUGR.mjs.map +7 -0
- package/dist/types/src/AssistantPlugin.d.ts.map +1 -1
- package/dist/types/src/blueprints/assistant/blueprint.d.ts +4 -0
- package/dist/types/src/blueprints/assistant/blueprint.d.ts.map +1 -0
- package/dist/types/src/blueprints/assistant/blueprint.test.d.ts +2 -0
- package/dist/types/src/blueprints/assistant/blueprint.test.d.ts.map +1 -0
- package/dist/types/src/blueprints/assistant/index.d.ts +2 -0
- package/dist/types/src/blueprints/assistant/index.d.ts.map +1 -0
- package/dist/types/src/blueprints/index.d.ts +1 -6
- package/dist/types/src/blueprints/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/ai-service.d.ts +6 -0
- package/dist/types/src/capabilities/ai-service.d.ts.map +1 -0
- package/dist/types/src/capabilities/app-graph-builder.d.ts +6 -0
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -0
- package/dist/types/src/capabilities/blueprint-definition.d.ts +5 -0
- package/dist/types/src/capabilities/blueprint-definition.d.ts.map +1 -0
- package/dist/types/src/capabilities/companion-chat-provisioner.d.ts +9 -0
- package/dist/types/src/capabilities/companion-chat-provisioner.d.ts.map +1 -0
- package/dist/types/src/capabilities/edge-model-resolver.d.ts +7 -0
- package/dist/types/src/capabilities/edge-model-resolver.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +41 -11
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/local-model-resolver.d.ts +13 -0
- package/dist/types/src/capabilities/local-model-resolver.d.ts.map +1 -0
- package/dist/types/src/capabilities/markdown.d.ts +5 -0
- package/dist/types/src/capabilities/markdown.d.ts.map +1 -0
- package/dist/types/src/capabilities/migrations.d.ts +5 -0
- package/dist/types/src/capabilities/migrations.d.ts.map +1 -0
- package/dist/types/src/capabilities/operation-handler.d.ts +6 -0
- package/dist/types/src/capabilities/operation-handler.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface.d.ts +5 -0
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -0
- package/dist/types/src/capabilities/{settings/settings.d.ts → settings.d.ts} +4 -3
- package/dist/types/src/capabilities/settings.d.ts.map +1 -0
- package/dist/types/src/capabilities/state.d.ts +21 -0
- package/dist/types/src/capabilities/state.d.ts.map +1 -0
- package/dist/types/src/capabilities/toolkit.d.ts +6 -0
- package/dist/types/src/capabilities/toolkit.d.ts.map +1 -0
- package/dist/types/src/components/AssistantSettings/AssistantSettings.d.ts +4 -6
- package/dist/types/src/components/AssistantSettings/AssistantSettings.d.ts.map +1 -1
- package/dist/types/src/components/AssistantSettings/AssistantSettings.stories.d.ts +511 -0
- package/dist/types/src/components/AssistantSettings/AssistantSettings.stories.d.ts.map +1 -0
- package/dist/types/src/components/AssistantSettings/index.d.ts +2 -1
- package/dist/types/src/components/AssistantSettings/index.d.ts.map +1 -1
- package/dist/types/src/components/Chat/Chat.d.ts +23 -11
- package/dist/types/src/components/Chat/Chat.d.ts.map +1 -1
- package/dist/types/src/components/ChatProgress/ChatProgress.d.ts +6 -3
- package/dist/types/src/components/ChatProgress/ChatProgress.d.ts.map +1 -1
- package/dist/types/src/components/ChatPrompt/ChatActions.d.ts.map +1 -1
- package/dist/types/src/components/ChatPrompt/ChatOptions.d.ts.map +1 -1
- package/dist/types/src/components/ChatPrompt/ChatReferences.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/ChatThread.d.ts +1 -1
- package/dist/types/src/components/ChatThread/ChatThread.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/ChatThread.stories.d.ts +491 -299
- package/dist/types/src/components/ChatThread/ChatThread.stories.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/registry.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/sync.d.ts.map +1 -1
- package/dist/types/src/components/ProcessTree/ProcessTree.d.ts +14 -0
- package/dist/types/src/components/ProcessTree/ProcessTree.d.ts.map +1 -0
- package/dist/types/src/components/ProcessTree/ProcessTree.stories.d.ts +8 -0
- package/dist/types/src/components/ProcessTree/ProcessTree.stories.d.ts.map +1 -0
- package/dist/types/src/components/ProcessTree/index.d.ts +2 -0
- package/dist/types/src/components/ProcessTree/index.d.ts.map +1 -0
- package/dist/types/src/components/TemplateEditor/TemplateEditor.d.ts +9 -4
- package/dist/types/src/components/TemplateEditor/TemplateEditor.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/TemplateEditor.stories.d.ts +487 -295
- package/dist/types/src/components/TemplateEditor/TemplateEditor.stories.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/TemplateForm.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/TemplateForm.stories.d.ts +487 -295
- package/dist/types/src/components/TemplateEditor/TemplateForm.stories.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 +14 -8
- package/dist/types/src/components/Toolbox/Toolbox.d.ts.map +1 -1
- package/dist/types/src/components/Toolbox/Toolbox.stories.d.ts +487 -295
- package/dist/types/src/components/Toolbox/Toolbox.stories.d.ts.map +1 -1
- package/dist/types/src/components/Typewriter/AssistantToolbar.d.ts +2 -2
- package/dist/types/src/components/Typewriter/AssistantToolbar.d.ts.map +1 -1
- package/dist/types/src/components/Typewriter/Typewriter.d.ts.map +1 -1
- package/dist/types/src/components/Typewriter/Typewriter.stories.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +3 -12
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/containers/BlueprintArticle/BlueprintArticle.d.ts +6 -0
- package/dist/types/src/containers/BlueprintArticle/BlueprintArticle.d.ts.map +1 -0
- package/dist/types/src/containers/BlueprintArticle/index.d.ts +3 -0
- package/dist/types/src/containers/BlueprintArticle/index.d.ts.map +1 -0
- package/dist/types/src/containers/ChatCompanion/ChatCompanion.d.ts +14 -0
- package/dist/types/src/containers/ChatCompanion/ChatCompanion.d.ts.map +1 -0
- package/dist/types/src/containers/ChatCompanion/index.d.ts +3 -0
- package/dist/types/src/containers/ChatCompanion/index.d.ts.map +1 -0
- package/dist/types/src/{components → containers/ChatContainer}/ChatContainer.d.ts +7 -6
- package/dist/types/src/containers/ChatContainer/ChatContainer.d.ts.map +1 -0
- package/dist/types/src/containers/ChatContainer/index.d.ts +3 -0
- package/dist/types/src/containers/ChatContainer/index.d.ts.map +1 -0
- package/dist/types/src/{components → containers/ChatDialog}/ChatDialog.d.ts +2 -3
- package/dist/types/src/containers/ChatDialog/ChatDialog.d.ts.map +1 -0
- package/dist/types/src/containers/ChatDialog/index.d.ts +3 -0
- package/dist/types/src/containers/ChatDialog/index.d.ts.map +1 -0
- package/dist/types/src/containers/ProjectArticle/ProjectArticle.d.ts +6 -0
- package/dist/types/src/containers/ProjectArticle/ProjectArticle.d.ts.map +1 -0
- package/dist/types/src/containers/ProjectArticle/index.d.ts +3 -0
- package/dist/types/src/containers/ProjectArticle/index.d.ts.map +1 -0
- package/dist/types/src/containers/ProjectSettings/ProjectSettings.d.ts +6 -0
- package/dist/types/src/containers/ProjectSettings/ProjectSettings.d.ts.map +1 -0
- package/dist/types/src/containers/ProjectSettings/index.d.ts +3 -0
- package/dist/types/src/containers/ProjectSettings/index.d.ts.map +1 -0
- package/dist/types/src/containers/PromptArticle/PromptArticle.d.ts +6 -0
- package/dist/types/src/containers/PromptArticle/PromptArticle.d.ts.map +1 -0
- package/dist/types/src/containers/PromptArticle/index.d.ts +3 -0
- package/dist/types/src/containers/PromptArticle/index.d.ts.map +1 -0
- package/dist/types/src/containers/PromptList/PromptList.d.ts +6 -0
- package/dist/types/src/containers/PromptList/PromptList.d.ts.map +1 -0
- package/dist/types/src/containers/PromptList/PromptList.stories.d.ts +517 -0
- package/dist/types/src/containers/PromptList/PromptList.stories.d.ts.map +1 -0
- package/dist/types/src/containers/PromptList/index.d.ts +3 -0
- package/dist/types/src/containers/PromptList/index.d.ts.map +1 -0
- package/dist/types/src/containers/TracePanel/TracePanel.d.ts +6 -0
- package/dist/types/src/containers/TracePanel/TracePanel.d.ts.map +1 -0
- package/dist/types/src/containers/TracePanel/dxn-extractor.d.ts +19 -0
- package/dist/types/src/containers/TracePanel/dxn-extractor.d.ts.map +1 -0
- package/dist/types/src/containers/TracePanel/dxn-extractor.test.d.ts +2 -0
- package/dist/types/src/containers/TracePanel/dxn-extractor.test.d.ts.map +1 -0
- package/dist/types/src/containers/TracePanel/index.d.ts +4 -0
- package/dist/types/src/containers/TracePanel/index.d.ts.map +1 -0
- package/dist/types/src/containers/TriggerStatus/TriggerStatus.d.ts +4 -0
- package/dist/types/src/containers/TriggerStatus/TriggerStatus.d.ts.map +1 -0
- package/dist/types/src/containers/TriggerStatus/index.d.ts +3 -0
- package/dist/types/src/containers/TriggerStatus/index.d.ts.map +1 -0
- package/dist/types/src/containers/index.d.ts +12 -0
- package/dist/types/src/containers/index.d.ts.map +1 -0
- package/dist/types/src/extensions/index.d.ts +2 -0
- package/dist/types/src/extensions/index.d.ts.map +1 -0
- package/dist/types/src/extensions/prompt-extension.d.ts +10 -0
- package/dist/types/src/extensions/prompt-extension.d.ts.map +1 -0
- package/dist/types/src/hooks/useBlueprintRegistry.d.ts.map +1 -1
- package/dist/types/src/hooks/useChatProcessor.d.ts +7 -6
- package/dist/types/src/hooks/useChatProcessor.d.ts.map +1 -1
- package/dist/types/src/hooks/useChatServices.d.ts +3 -6
- package/dist/types/src/hooks/useChatServices.d.ts.map +1 -1
- package/dist/types/src/hooks/useChatToolbarActions.d.ts +2 -2
- package/dist/types/src/hooks/useChatToolbarActions.d.ts.map +1 -1
- package/dist/types/src/hooks/useContextObjects.d.ts.map +1 -1
- package/dist/types/src/hooks/useFilteredTypes.d.ts +1 -1
- package/dist/types/src/hooks/useFilteredTypes.d.ts.map +1 -1
- package/dist/types/src/hooks/usePresets.d.ts +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 +1 -1
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +2 -0
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/operations/create-chat.d.ts +5 -0
- package/dist/types/src/operations/create-chat.d.ts.map +1 -0
- package/dist/types/src/operations/definitions.d.ts +134 -0
- package/dist/types/src/operations/definitions.d.ts.map +1 -0
- package/dist/types/src/operations/ensure-companion-chat.d.ts +5 -0
- package/dist/types/src/operations/ensure-companion-chat.d.ts.map +1 -0
- package/dist/types/src/operations/index.d.ts +4 -0
- package/dist/types/src/operations/index.d.ts.map +1 -0
- package/dist/types/src/operations/on-create-space.d.ts +5 -0
- package/dist/types/src/operations/on-create-space.d.ts.map +1 -0
- package/dist/types/src/operations/resolve-navigation-targets.d.ts +15 -0
- package/dist/types/src/operations/resolve-navigation-targets.d.ts.map +1 -0
- package/dist/types/src/operations/run-prompt-in-new-chat.d.ts +5 -0
- package/dist/types/src/operations/run-prompt-in-new-chat.d.ts.map +1 -0
- package/dist/types/src/operations/set-current-chat.d.ts +5 -0
- package/dist/types/src/operations/set-current-chat.d.ts.map +1 -0
- package/dist/types/src/operations/update-chat-name.d.ts +5 -0
- package/dist/types/src/operations/update-chat-name.d.ts.map +1 -0
- package/dist/types/src/processor/processor.d.ts +27 -28
- package/dist/types/src/processor/processor.d.ts.map +1 -1
- package/dist/types/src/processor/update-name.d.ts +2 -2
- package/dist/types/src/processor/update-name.d.ts.map +1 -1
- package/dist/types/src/testing/test-services.d.ts +1 -1
- package/dist/types/src/testing/test-services.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +487 -295
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/Assistant.d.ts +17 -39
- package/dist/types/src/types/Assistant.d.ts.map +1 -1
- package/dist/types/src/types/Settings.d.ts +10 -0
- package/dist/types/src/types/Settings.d.ts.map +1 -0
- package/dist/types/src/types/capabilities.d.ts +11 -0
- package/dist/types/src/types/capabilities.d.ts.map +1 -1
- package/dist/types/src/types/index.d.ts +1 -1
- package/dist/types/src/types/index.d.ts.map +1 -1
- package/dist/types/src/types/service.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +117 -92
- package/src/AssistantPlugin.tsx +151 -53
- package/src/blueprints/assistant/blueprint.conversations.json +1 -0
- package/src/blueprints/assistant/blueprint.test.ts +46 -0
- package/src/blueprints/assistant/blueprint.ts +31 -0
- package/src/blueprints/assistant/index.ts +5 -0
- package/src/blueprints/index.ts +1 -8
- package/src/capabilities/{ai-service/ai-service.ts → ai-service.ts} +4 -3
- package/src/capabilities/app-graph-builder.ts +208 -0
- package/src/capabilities/blueprint-definition.ts +58 -0
- package/src/capabilities/companion-chat-provisioner.ts +165 -0
- package/src/capabilities/{edge-model-resolver/edge-model-resolver.ts → edge-model-resolver.ts} +4 -3
- package/src/capabilities/index.ts +22 -11
- package/src/capabilities/{local-model-resolver/local-model-resolver.ts → local-model-resolver.ts} +4 -3
- package/src/capabilities/markdown.ts +39 -0
- package/src/capabilities/migrations.ts +34 -0
- package/src/capabilities/operation-handler.ts +16 -0
- package/src/capabilities/react-surface.tsx +153 -0
- package/src/capabilities/{settings/settings.ts → settings.ts} +5 -4
- package/src/capabilities/{state/state.ts → state.ts} +11 -3
- package/src/capabilities/toolkit.ts +13 -0
- package/src/components/AssistantSettings/AssistantSettings.stories.tsx +35 -0
- package/src/components/AssistantSettings/AssistantSettings.tsx +104 -92
- package/src/components/AssistantSettings/index.ts +4 -2
- package/src/components/Chat/Chat.tsx +72 -42
- package/src/components/ChatProgress/ChatProgress.tsx +9 -7
- package/src/components/ChatPrompt/ChatActions.tsx +12 -4
- package/src/components/ChatPrompt/ChatOptions.tsx +43 -29
- package/src/components/ChatPrompt/ChatReferences.tsx +18 -8
- package/src/components/ChatThread/ChatThread.stories.tsx +16 -16
- package/src/components/ChatThread/ChatThread.tsx +19 -6
- package/src/components/ChatThread/Link.tsx +1 -1
- package/src/components/ChatThread/registry.tsx +51 -18
- package/src/components/ChatThread/sync.test.ts +9 -7
- package/src/components/ChatThread/sync.ts +14 -8
- package/src/components/ProcessTree/ProcessTree.stories.tsx +109 -0
- package/src/components/ProcessTree/ProcessTree.tsx +85 -0
- package/src/components/ProcessTree/index.ts +5 -0
- package/src/components/TemplateEditor/TemplateEditor.stories.tsx +4 -8
- package/src/components/TemplateEditor/TemplateEditor.tsx +50 -42
- package/src/components/TemplateEditor/TemplateForm.stories.tsx +7 -5
- package/src/components/TemplateEditor/TemplateForm.tsx +9 -10
- package/src/components/TemplateEditor/extensions/handlebars-extension.ts +4 -4
- package/src/components/ToolBlock/ToolBlock.tsx +20 -20
- package/src/components/Toolbox/Toolbox.stories.tsx +4 -5
- package/src/components/Toolbox/Toolbox.tsx +65 -60
- package/src/components/Typewriter/AssistantToolbar.tsx +7 -7
- package/src/components/Typewriter/Typewriter.stories.tsx +18 -15
- package/src/components/Typewriter/Typewriter.tsx +6 -10
- package/src/components/Typewriter/assistant-extension.tsx +5 -8
- package/src/components/index.ts +3 -7
- package/src/containers/BlueprintArticle/BlueprintArticle.tsx +29 -0
- package/src/containers/BlueprintArticle/index.ts +7 -0
- package/src/{components → containers/ChatCompanion}/ChatCompanion.tsx +23 -43
- package/src/containers/ChatCompanion/index.ts +7 -0
- package/src/containers/ChatContainer/ChatContainer.tsx +95 -0
- package/src/containers/ChatContainer/index.ts +7 -0
- package/src/{components → containers/ChatDialog}/ChatDialog.tsx +10 -12
- package/src/containers/ChatDialog/index.ts +7 -0
- package/src/containers/ProjectArticle/ProjectArticle.tsx +127 -0
- package/src/containers/ProjectArticle/index.ts +7 -0
- package/src/containers/ProjectSettings/ProjectSettings.tsx +139 -0
- package/src/containers/ProjectSettings/index.ts +7 -0
- package/src/containers/PromptArticle/PromptArticle.tsx +59 -0
- package/src/containers/PromptArticle/index.ts +7 -0
- package/src/containers/PromptList/PromptList.stories.tsx +130 -0
- package/src/containers/PromptList/PromptList.tsx +49 -0
- package/src/containers/PromptList/index.ts +7 -0
- package/src/containers/TracePanel/TracePanel.tsx +258 -0
- package/src/containers/TracePanel/dxn-extractor.test.ts +153 -0
- package/src/containers/TracePanel/dxn-extractor.ts +178 -0
- package/src/containers/TracePanel/index.ts +9 -0
- package/src/containers/TriggerStatus/TriggerStatus.tsx +144 -0
- package/src/containers/TriggerStatus/index.ts +7 -0
- package/src/containers/index.ts +16 -0
- package/src/extensions/index.ts +5 -0
- package/src/extensions/prompt-extension.ts +111 -0
- package/src/hooks/useBlueprintRegistry.ts +8 -4
- package/src/hooks/useChatProcessor.ts +21 -15
- package/src/hooks/useChatServices.ts +7 -28
- package/src/hooks/useChatToolbarActions.ts +13 -12
- package/src/hooks/useContextObjects.ts +8 -4
- package/src/hooks/useFilteredTypes.ts +3 -3
- package/src/hooks/usePresets.ts +1 -1
- package/src/hooks/useReferencesProvider.ts +1 -5
- package/src/index.ts +1 -1
- package/src/meta.ts +5 -2
- package/src/operations/create-chat.ts +79 -0
- package/src/operations/definitions.ts +126 -0
- package/src/operations/ensure-companion-chat.ts +59 -0
- package/src/operations/index.ts +17 -0
- package/src/operations/on-create-space.ts +24 -0
- package/src/operations/resolve-navigation-targets.ts +26 -0
- package/src/operations/run-prompt-in-new-chat.ts +114 -0
- package/src/operations/set-current-chat.ts +35 -0
- package/src/operations/update-chat-name.ts +55 -0
- package/src/processor/processor.test.ts +16 -49
- package/src/processor/processor.ts +158 -127
- package/src/processor/update-name.ts +4 -5
- package/src/queue-logger.ts +2 -2
- package/src/testing/test-sequence.ts +3 -3
- package/src/testing/test-services.ts +2 -2
- package/src/translations.ts +125 -83
- package/src/types/Assistant.ts +8 -56
- package/src/types/Settings.ts +21 -0
- package/src/types/capabilities.ts +11 -3
- package/src/types/events.ts +2 -2
- package/src/types/index.ts +3 -1
- package/src/types/service.ts +5 -5
- package/dist/lib/browser/BlueprintArticle-WP3G5GLG.mjs +0 -31
- package/dist/lib/browser/BlueprintArticle-WP3G5GLG.mjs.map +0 -7
- package/dist/lib/browser/ChatCompanion-ECQYUQ2B.mjs +0 -153
- package/dist/lib/browser/ChatCompanion-ECQYUQ2B.mjs.map +0 -7
- package/dist/lib/browser/ChatContainer-QCCOFBUX.mjs +0 -73
- package/dist/lib/browser/ChatContainer-QCCOFBUX.mjs.map +0 -7
- package/dist/lib/browser/ChatDialog-SMK4RSZU.mjs +0 -85
- package/dist/lib/browser/ChatDialog-SMK4RSZU.mjs.map +0 -7
- package/dist/lib/browser/PromptArticle-K362ZPAE.mjs +0 -53
- package/dist/lib/browser/PromptArticle-K362ZPAE.mjs.map +0 -7
- package/dist/lib/browser/ai-service-5GUDOEWF.mjs +0 -21
- package/dist/lib/browser/ai-service-5GUDOEWF.mjs.map +0 -7
- package/dist/lib/browser/app-graph-builder-DSNH2OMY.mjs +0 -212
- package/dist/lib/browser/app-graph-builder-DSNH2OMY.mjs.map +0 -7
- package/dist/lib/browser/blueprint-definition-DGHH7MUU.mjs +0 -14
- package/dist/lib/browser/blueprint-definition-DGHH7MUU.mjs.map +0 -7
- package/dist/lib/browser/chunk-3JYPE2MM.mjs +0 -1832
- package/dist/lib/browser/chunk-3JYPE2MM.mjs.map +0 -7
- package/dist/lib/browser/chunk-DKQMSMBN.mjs +0 -326
- package/dist/lib/browser/chunk-DKQMSMBN.mjs.map +0 -7
- package/dist/lib/browser/chunk-EXVT7D4B.mjs +0 -23
- package/dist/lib/browser/chunk-EXVT7D4B.mjs.map +0 -7
- package/dist/lib/browser/chunk-ML3QCFKA.mjs +0 -265
- package/dist/lib/browser/chunk-ML3QCFKA.mjs.map +0 -7
- package/dist/lib/browser/chunk-MRJVYGLU.mjs +0 -208
- package/dist/lib/browser/chunk-MRJVYGLU.mjs.map +0 -7
- package/dist/lib/browser/chunk-V772AMZM.mjs +0 -250
- package/dist/lib/browser/chunk-V772AMZM.mjs.map +0 -7
- package/dist/lib/browser/chunk-WGQTU6UJ.mjs +0 -41
- package/dist/lib/browser/chunk-WGQTU6UJ.mjs.map +0 -7
- package/dist/lib/browser/edge-model-resolver-26BOY6HY.mjs +0 -20
- package/dist/lib/browser/edge-model-resolver-26BOY6HY.mjs.map +0 -7
- package/dist/lib/browser/local-model-resolver-ZFIM6GGV.mjs +0 -19
- package/dist/lib/browser/local-model-resolver-ZFIM6GGV.mjs.map +0 -7
- package/dist/lib/browser/operation-resolver-7XJLBRQY.mjs +0 -132
- package/dist/lib/browser/operation-resolver-7XJLBRQY.mjs.map +0 -7
- package/dist/lib/browser/react-surface-NCITRSJJ.mjs +0 -109
- package/dist/lib/browser/react-surface-NCITRSJJ.mjs.map +0 -7
- package/dist/lib/browser/repair-6QGAKOVM.mjs +0 -54
- package/dist/lib/browser/repair-6QGAKOVM.mjs.map +0 -7
- package/dist/lib/browser/settings-4ZDLUMYE.mjs +0 -32
- package/dist/lib/browser/settings-4ZDLUMYE.mjs.map +0 -7
- package/dist/lib/browser/state-AN6336ZX.mjs +0 -26
- package/dist/lib/browser/state-AN6336ZX.mjs.map +0 -7
- package/dist/lib/browser/toolkit-7AVTEPMA.mjs +0 -18
- package/dist/lib/browser/toolkit-7AVTEPMA.mjs.map +0 -7
- package/dist/lib/node-esm/BlueprintArticle-WZ76E2C4.mjs +0 -32
- package/dist/lib/node-esm/BlueprintArticle-WZ76E2C4.mjs.map +0 -7
- package/dist/lib/node-esm/ChatCompanion-Q4FUZ2MW.mjs +0 -154
- package/dist/lib/node-esm/ChatCompanion-Q4FUZ2MW.mjs.map +0 -7
- package/dist/lib/node-esm/ChatContainer-AKI33HIB.mjs +0 -74
- package/dist/lib/node-esm/ChatContainer-AKI33HIB.mjs.map +0 -7
- package/dist/lib/node-esm/ChatDialog-AP45PVZR.mjs +0 -86
- package/dist/lib/node-esm/ChatDialog-AP45PVZR.mjs.map +0 -7
- package/dist/lib/node-esm/PromptArticle-D4HAIIC6.mjs +0 -54
- package/dist/lib/node-esm/PromptArticle-D4HAIIC6.mjs.map +0 -7
- package/dist/lib/node-esm/ai-service-PXKKCFIF.mjs +0 -22
- package/dist/lib/node-esm/ai-service-PXKKCFIF.mjs.map +0 -7
- package/dist/lib/node-esm/app-graph-builder-TJCUEXW5.mjs +0 -213
- package/dist/lib/node-esm/app-graph-builder-TJCUEXW5.mjs.map +0 -7
- package/dist/lib/node-esm/blueprint-definition-SEMDEIYG.mjs +0 -15
- package/dist/lib/node-esm/blueprint-definition-SEMDEIYG.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-355W5B27.mjs +0 -251
- package/dist/lib/node-esm/chunk-355W5B27.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-75PHXBN3.mjs +0 -327
- package/dist/lib/node-esm/chunk-75PHXBN3.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-DCA5QWQT.mjs +0 -209
- package/dist/lib/node-esm/chunk-DCA5QWQT.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-MSBPC4RJ.mjs +0 -42
- package/dist/lib/node-esm/chunk-MSBPC4RJ.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-POWB2BPC.mjs +0 -25
- package/dist/lib/node-esm/chunk-POWB2BPC.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-XI5T3MJC.mjs +0 -1833
- package/dist/lib/node-esm/chunk-XI5T3MJC.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-ZRIPP7YF.mjs +0 -267
- package/dist/lib/node-esm/chunk-ZRIPP7YF.mjs.map +0 -7
- package/dist/lib/node-esm/edge-model-resolver-G5KMODPO.mjs +0 -21
- package/dist/lib/node-esm/edge-model-resolver-G5KMODPO.mjs.map +0 -7
- package/dist/lib/node-esm/local-model-resolver-KDZLYI7Y.mjs +0 -20
- package/dist/lib/node-esm/local-model-resolver-KDZLYI7Y.mjs.map +0 -7
- package/dist/lib/node-esm/operation-resolver-SX4WMNA7.mjs +0 -133
- package/dist/lib/node-esm/operation-resolver-SX4WMNA7.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-ST6V7LPE.mjs +0 -110
- package/dist/lib/node-esm/react-surface-ST6V7LPE.mjs.map +0 -7
- package/dist/lib/node-esm/repair-QJ7CQDKU.mjs +0 -55
- package/dist/lib/node-esm/repair-QJ7CQDKU.mjs.map +0 -7
- package/dist/lib/node-esm/settings-CQEOHR3R.mjs +0 -33
- package/dist/lib/node-esm/settings-CQEOHR3R.mjs.map +0 -7
- package/dist/lib/node-esm/state-HDON4REW.mjs +0 -27
- package/dist/lib/node-esm/state-HDON4REW.mjs.map +0 -7
- package/dist/lib/node-esm/toolkit-OWGCEKOO.mjs +0 -19
- package/dist/lib/node-esm/toolkit-OWGCEKOO.mjs.map +0 -7
- package/dist/types/src/blueprints/assistant-blueprint.d.ts +0 -209
- package/dist/types/src/blueprints/assistant-blueprint.d.ts.map +0 -1
- package/dist/types/src/capabilities/ai-service/ai-service.d.ts +0 -5
- package/dist/types/src/capabilities/ai-service/ai-service.d.ts.map +0 -1
- package/dist/types/src/capabilities/ai-service/index.d.ts +0 -3
- package/dist/types/src/capabilities/ai-service/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts +0 -6
- package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts.map +0 -1
- package/dist/types/src/capabilities/app-graph-builder/index.d.ts +0 -3
- package/dist/types/src/capabilities/app-graph-builder/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/blueprint-definition/blueprint-definition.d.ts +0 -21
- package/dist/types/src/capabilities/blueprint-definition/blueprint-definition.d.ts.map +0 -1
- package/dist/types/src/capabilities/blueprint-definition/index.d.ts +0 -4
- package/dist/types/src/capabilities/blueprint-definition/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/edge-model-resolver/edge-model-resolver.d.ts +0 -6
- package/dist/types/src/capabilities/edge-model-resolver/edge-model-resolver.d.ts.map +0 -1
- package/dist/types/src/capabilities/edge-model-resolver/index.d.ts +0 -3
- package/dist/types/src/capabilities/edge-model-resolver/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/local-model-resolver/index.d.ts +0 -3
- package/dist/types/src/capabilities/local-model-resolver/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/local-model-resolver/local-model-resolver.d.ts +0 -12
- package/dist/types/src/capabilities/local-model-resolver/local-model-resolver.d.ts.map +0 -1
- package/dist/types/src/capabilities/operation-resolver/index.d.ts +0 -3
- package/dist/types/src/capabilities/operation-resolver/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts +0 -5
- package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts.map +0 -1
- package/dist/types/src/capabilities/react-surface/index.d.ts +0 -3
- package/dist/types/src/capabilities/react-surface/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts +0 -5
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +0 -1
- package/dist/types/src/capabilities/repair/index.d.ts +0 -3
- package/dist/types/src/capabilities/repair/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/repair/repair.d.ts +0 -6
- package/dist/types/src/capabilities/repair/repair.d.ts.map +0 -1
- package/dist/types/src/capabilities/settings/index.d.ts +0 -15
- package/dist/types/src/capabilities/settings/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/settings/settings.d.ts.map +0 -1
- package/dist/types/src/capabilities/state/index.d.ts +0 -11
- package/dist/types/src/capabilities/state/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/state/state.d.ts +0 -13
- package/dist/types/src/capabilities/state/state.d.ts.map +0 -1
- package/dist/types/src/capabilities/toolkit/index.d.ts +0 -3
- package/dist/types/src/capabilities/toolkit/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/toolkit/toolkit.d.ts +0 -5
- package/dist/types/src/capabilities/toolkit/toolkit.d.ts.map +0 -1
- package/dist/types/src/components/BlueprintArticle.d.ts +0 -7
- package/dist/types/src/components/BlueprintArticle.d.ts.map +0 -1
- package/dist/types/src/components/ChatCompanion.d.ts +0 -13
- package/dist/types/src/components/ChatCompanion.d.ts.map +0 -1
- package/dist/types/src/components/ChatContainer.d.ts.map +0 -1
- package/dist/types/src/components/ChatDialog.d.ts.map +0 -1
- package/dist/types/src/components/PromptArticle.d.ts +0 -7
- package/dist/types/src/components/PromptArticle.d.ts.map +0 -1
- package/dist/types/src/functions/index.d.ts +0 -4
- package/dist/types/src/functions/index.d.ts.map +0 -1
- package/dist/types/src/functions/object-list.d.ts +0 -10
- package/dist/types/src/functions/object-list.d.ts.map +0 -1
- package/dist/types/src/functions/object-load.d.ts +0 -8
- package/dist/types/src/functions/object-load.d.ts.map +0 -1
- package/dist/types/src/functions/object-search.d.ts +0 -10
- package/dist/types/src/functions/object-search.d.ts.map +0 -1
- package/dist/types/src/types/AssistantAction.d.ts +0 -95
- package/dist/types/src/types/AssistantAction.d.ts.map +0 -1
- package/src/blueprints/assistant-blueprint.ts +0 -62
- package/src/capabilities/ai-service/index.ts +0 -7
- package/src/capabilities/app-graph-builder/app-graph-builder.ts +0 -180
- package/src/capabilities/app-graph-builder/index.ts +0 -7
- package/src/capabilities/blueprint-definition/blueprint-definition.ts +0 -60
- package/src/capabilities/blueprint-definition/index.ts +0 -8
- package/src/capabilities/edge-model-resolver/index.ts +0 -7
- package/src/capabilities/local-model-resolver/index.ts +0 -7
- package/src/capabilities/operation-resolver/index.ts +0 -7
- package/src/capabilities/operation-resolver/operation-resolver.ts +0 -110
- package/src/capabilities/react-surface/index.ts +0 -7
- package/src/capabilities/react-surface/react-surface.tsx +0 -95
- package/src/capabilities/repair/index.ts +0 -7
- package/src/capabilities/repair/repair.ts +0 -63
- package/src/capabilities/settings/index.ts +0 -7
- package/src/capabilities/state/index.ts +0 -7
- package/src/capabilities/toolkit/index.ts +0 -7
- package/src/capabilities/toolkit/toolkit.ts +0 -26
- package/src/components/BlueprintArticle.tsx +0 -29
- package/src/components/ChatContainer.tsx +0 -61
- package/src/components/PromptArticle.tsx +0 -50
- package/src/functions/index.ts +0 -7
- package/src/functions/object-list.ts +0 -49
- package/src/functions/object-load.ts +0 -47
- package/src/functions/object-search.ts +0 -46
- package/src/types/AssistantAction.ts +0 -75
|
@@ -10,23 +10,23 @@ import * as Array from 'effect/Array';
|
|
|
10
10
|
import * as Option from 'effect/Option';
|
|
11
11
|
import React, { type PropsWithChildren, useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
12
12
|
|
|
13
|
+
import { type Chat as ChatModule } from '@dxos/assistant-toolkit';
|
|
13
14
|
import { Event } from '@dxos/async';
|
|
14
|
-
import { type Database, Obj } from '@dxos/echo';
|
|
15
|
+
import { type Database, Filter, Obj } from '@dxos/echo';
|
|
15
16
|
import { useVoiceInput } from '@dxos/plugin-transcription';
|
|
16
|
-
import {
|
|
17
|
+
import { type Queue, useQuery } from '@dxos/react-client/echo';
|
|
17
18
|
import { useIdentity } from '@dxos/react-client/halo';
|
|
18
19
|
import { Input, type ThemedClassName, useDynamicRef, useTranslation } from '@dxos/react-ui';
|
|
19
20
|
import { ChatEditor, type ChatEditorController, type ChatEditorProps } from '@dxos/react-ui-chat';
|
|
20
21
|
import { type MarkdownStreamController } from '@dxos/react-ui-components';
|
|
21
|
-
import {
|
|
22
|
+
import { Menu, MenuRootProps } from '@dxos/react-ui-menu';
|
|
22
23
|
import { Message } from '@dxos/types';
|
|
23
|
-
import { mx } from '@dxos/ui-theme';
|
|
24
|
+
import { composable, composableProps, mx } from '@dxos/ui-theme';
|
|
24
25
|
import { isTruthy } from '@dxos/util';
|
|
25
26
|
|
|
26
|
-
import { useChatToolbarActions } from '
|
|
27
|
-
import { meta } from '
|
|
27
|
+
import { useChatToolbarActions } from '#hooks';
|
|
28
|
+
import { meta } from '#meta';
|
|
28
29
|
import { type AiChatProcessor } from '../../processor';
|
|
29
|
-
import { type Assistant } from '../../types';
|
|
30
30
|
import {
|
|
31
31
|
ChatActions,
|
|
32
32
|
type ChatActionsProps,
|
|
@@ -49,7 +49,7 @@ type ChatContextValue = {
|
|
|
49
49
|
debug?: boolean;
|
|
50
50
|
event: Event<ChatEvent>;
|
|
51
51
|
db?: Database.Database;
|
|
52
|
-
chat?:
|
|
52
|
+
chat?: ChatModule.Chat;
|
|
53
53
|
messages: Message.Message[];
|
|
54
54
|
processor: AiChatProcessor;
|
|
55
55
|
};
|
|
@@ -62,22 +62,22 @@ export const [ChatContextProvider, useChatContext] = createContext<ChatContextVa
|
|
|
62
62
|
|
|
63
63
|
type ChatRootProps = PropsWithChildren<
|
|
64
64
|
Pick<ChatContextValue, 'db' | 'chat' | 'processor'> & {
|
|
65
|
+
queue?: Queue;
|
|
65
66
|
onEvent?: (event: ChatEvent) => void;
|
|
66
67
|
}
|
|
67
68
|
>;
|
|
68
69
|
|
|
69
|
-
const ChatRoot = ({ children, chat, processor, onEvent, ...props }: ChatRootProps) => {
|
|
70
|
+
const ChatRoot = ({ children, chat, queue, processor, onEvent, ...props }: ChatRootProps) => {
|
|
70
71
|
const [debug, setDebug] = useState(false);
|
|
71
72
|
const pending = useAtomValue(processor.messages);
|
|
72
73
|
const streaming = useAtomValue(processor.streaming);
|
|
73
74
|
const lastPrompt = useRef<string | undefined>(undefined);
|
|
74
75
|
|
|
75
76
|
// Messages.
|
|
76
|
-
const
|
|
77
|
+
const storedMessages = useQuery(queue, Filter.type(Message.Message));
|
|
77
78
|
const messages = useMemo(() => {
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
}, [queue?.objects, pending]);
|
|
79
|
+
return Array.dedupeWith([...storedMessages, ...pending], ({ id: a }, { id: b }) => a === b);
|
|
80
|
+
}, [storedMessages, pending]);
|
|
81
81
|
|
|
82
82
|
// Events.
|
|
83
83
|
const event = useMemo(() => new Event<ChatEvent>(), []);
|
|
@@ -85,7 +85,26 @@ const ChatRoot = ({ children, chat, processor, onEvent, ...props }: ChatRootProp
|
|
|
85
85
|
return event.on((ev) => {
|
|
86
86
|
switch (ev.type) {
|
|
87
87
|
case 'toggle-debug': {
|
|
88
|
-
setDebug((
|
|
88
|
+
setDebug((debug) => !debug);
|
|
89
|
+
|
|
90
|
+
// Dump state to console.
|
|
91
|
+
queueMicrotask(async () => {
|
|
92
|
+
const objects = processor.context.getObjects();
|
|
93
|
+
const blueprints = processor.context.getBlueprints();
|
|
94
|
+
const tools = await processor.getTools();
|
|
95
|
+
const system = await processor.getSystemPrompt();
|
|
96
|
+
// eslint-disable-next-line no-console
|
|
97
|
+
console.log('Chat processor state:', { objects, blueprints });
|
|
98
|
+
// eslint-disable-next-line no-console
|
|
99
|
+
console.log(`
|
|
100
|
+
==== System Prompt ====
|
|
101
|
+
${system}
|
|
102
|
+
==== Tools ====
|
|
103
|
+
${Object.values(tools)
|
|
104
|
+
.map((tool) => JSON.stringify(tool, null, 2))
|
|
105
|
+
.join('\n')}
|
|
106
|
+
`);
|
|
107
|
+
});
|
|
89
108
|
break;
|
|
90
109
|
}
|
|
91
110
|
|
|
@@ -143,24 +162,30 @@ ChatRoot.displayName = 'Chat.Root';
|
|
|
143
162
|
// Viewport
|
|
144
163
|
//
|
|
145
164
|
|
|
146
|
-
|
|
165
|
+
const CHAT_VIEWPORT_NAME = 'Chat.Viewport';
|
|
147
166
|
|
|
148
|
-
|
|
167
|
+
type ChatViewportProps = {};
|
|
168
|
+
|
|
169
|
+
const ChatViewport = composable<HTMLDivElement, ChatViewportProps>(({ children, ...props }, forwardedRef) => {
|
|
149
170
|
return (
|
|
150
|
-
<div
|
|
171
|
+
<div {...composableProps(props, { classNames: 'dx-expander flex flex-col' })} ref={forwardedRef}>
|
|
151
172
|
{children}
|
|
152
173
|
</div>
|
|
153
174
|
);
|
|
154
|
-
};
|
|
175
|
+
});
|
|
176
|
+
|
|
177
|
+
ChatViewport.displayName = CHAT_VIEWPORT_NAME;
|
|
155
178
|
|
|
156
179
|
//
|
|
157
180
|
// Thread
|
|
158
181
|
//
|
|
159
182
|
|
|
183
|
+
const CHAT_THREAD_NAME = 'Chat.Thread';
|
|
184
|
+
|
|
160
185
|
type ChatThreadProps = Omit<NaturalChatThreadProps, 'identity' | 'messages' | 'tools'>;
|
|
161
186
|
|
|
162
187
|
const ChatThread = (props: ChatThreadProps) => {
|
|
163
|
-
const { debug, event, messages, processor } = useChatContext(
|
|
188
|
+
const { debug, event, messages, processor } = useChatContext(CHAT_THREAD_NAME);
|
|
164
189
|
const identity = useIdentity();
|
|
165
190
|
const error = useAtomValue(processor.error).pipe(Option.getOrUndefined);
|
|
166
191
|
|
|
@@ -206,12 +231,14 @@ const ChatThread = (props: ChatThreadProps) => {
|
|
|
206
231
|
);
|
|
207
232
|
};
|
|
208
233
|
|
|
209
|
-
ChatThread.displayName =
|
|
234
|
+
ChatThread.displayName = CHAT_THREAD_NAME;
|
|
210
235
|
|
|
211
236
|
//
|
|
212
237
|
// Prompt
|
|
213
238
|
//
|
|
214
239
|
|
|
240
|
+
const CHAT_PROMPT_NAME = 'Chat.Prompt';
|
|
241
|
+
|
|
215
242
|
type ChatPromptProps = ThemedClassName<
|
|
216
243
|
{
|
|
217
244
|
outline?: boolean;
|
|
@@ -238,7 +265,7 @@ const ChatPrompt = ({
|
|
|
238
265
|
onOnlineChange,
|
|
239
266
|
}: ChatPromptProps) => {
|
|
240
267
|
const { t } = useTranslation(meta.id);
|
|
241
|
-
const { db, processor, event } = useChatContext(
|
|
268
|
+
const { db, processor, event } = useChatContext(CHAT_PROMPT_NAME);
|
|
242
269
|
|
|
243
270
|
const error = useAtomValue(processor.error).pipe(Option.getOrUndefined);
|
|
244
271
|
const streaming = useAtomValue(processor.streaming);
|
|
@@ -337,9 +364,9 @@ const ChatPrompt = ({
|
|
|
337
364
|
<div
|
|
338
365
|
role='group'
|
|
339
366
|
className={mx(
|
|
340
|
-
'flex flex-col
|
|
367
|
+
'flex flex-col w-full dx-density-fine',
|
|
341
368
|
outline &&
|
|
342
|
-
'bg-
|
|
369
|
+
'bg-group-surface border border-subdued-separator transition transition-border [&:has(.cm-content:focus)]:border-separator rounded-sm',
|
|
343
370
|
classNames,
|
|
344
371
|
)}
|
|
345
372
|
>
|
|
@@ -349,8 +376,8 @@ const ChatPrompt = ({
|
|
|
349
376
|
ref={editorRef}
|
|
350
377
|
autoFocus
|
|
351
378
|
lineWrapping
|
|
352
|
-
classNames='col-span-2
|
|
353
|
-
placeholder={placeholder ?? t('prompt
|
|
379
|
+
classNames='col-span-2 pt-0.5'
|
|
380
|
+
placeholder={placeholder ?? t('prompt.placeholder')}
|
|
354
381
|
extensions={extensions}
|
|
355
382
|
onSubmit={handleSubmit}
|
|
356
383
|
/>
|
|
@@ -381,8 +408,8 @@ const ChatPrompt = ({
|
|
|
381
408
|
{/* TODO(burdon): Move offline switch into dialog. */}
|
|
382
409
|
{online !== undefined && (
|
|
383
410
|
<Input.Root>
|
|
384
|
-
<Input.Label srOnly>{t('online
|
|
385
|
-
<Input.Switch classNames='
|
|
411
|
+
<Input.Label srOnly>{t('online-switch.label')}</Input.Label>
|
|
412
|
+
<Input.Switch classNames='mx-2' checked={online} onCheckedChange={onOnlineChange} />
|
|
386
413
|
</Input.Root>
|
|
387
414
|
)}
|
|
388
415
|
</ChatActions>
|
|
@@ -392,29 +419,32 @@ const ChatPrompt = ({
|
|
|
392
419
|
);
|
|
393
420
|
};
|
|
394
421
|
|
|
395
|
-
ChatPrompt.displayName =
|
|
422
|
+
ChatPrompt.displayName = CHAT_PROMPT_NAME;
|
|
396
423
|
|
|
397
424
|
//
|
|
398
425
|
// Toolbar
|
|
399
426
|
//
|
|
400
427
|
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
const ChatToolbar = ({ classNames, companionTo }: ChatToolbarProps) => {
|
|
404
|
-
const { chat } = useChatContext(ChatToolbar.displayName);
|
|
405
|
-
const menu = useChatToolbarActions({ chat, companionTo });
|
|
428
|
+
const CHAT_TOOLBAR_NAME = 'Chat.Toolbar';
|
|
406
429
|
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
{...menu}
|
|
410
|
-
attendableId={companionTo ? Obj.getDXN(companionTo).toString() : chat ? Obj.getDXN(chat).toString() : ''}
|
|
411
|
-
>
|
|
412
|
-
<ToolbarMenu classNames={classNames} textBlockWidth />
|
|
413
|
-
</MenuProvider>
|
|
414
|
-
);
|
|
430
|
+
type ChatToolbarProps = Pick<MenuRootProps, 'attendableId'> & {
|
|
431
|
+
companionTo?: Obj.Unknown;
|
|
415
432
|
};
|
|
416
433
|
|
|
417
|
-
ChatToolbar
|
|
434
|
+
const ChatToolbar = composable<HTMLDivElement, ChatToolbarProps>(
|
|
435
|
+
({ attendableId, companionTo, ...props }, forwardedRef) => {
|
|
436
|
+
const { chat } = useChatContext(CHAT_TOOLBAR_NAME);
|
|
437
|
+
const menuActions = useChatToolbarActions({ chat, companionTo });
|
|
438
|
+
|
|
439
|
+
return (
|
|
440
|
+
<Menu.Root {...menuActions} attendableId={attendableId}>
|
|
441
|
+
<Menu.Toolbar {...composableProps(props)} ref={forwardedRef} />
|
|
442
|
+
</Menu.Root>
|
|
443
|
+
);
|
|
444
|
+
},
|
|
445
|
+
);
|
|
446
|
+
|
|
447
|
+
ChatToolbar.displayName = CHAT_TOOLBAR_NAME;
|
|
418
448
|
|
|
419
449
|
//
|
|
420
450
|
// Chat
|
|
@@ -5,16 +5,18 @@
|
|
|
5
5
|
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
6
6
|
|
|
7
7
|
import { addEventListener } from '@dxos/async';
|
|
8
|
+
import { type Queue } from '@dxos/echo-db';
|
|
8
9
|
import { ProgressBar, type ProgressBarProps, TextCrawl, useExecutionGraph } from '@dxos/react-ui-components';
|
|
9
10
|
|
|
10
|
-
import { type Assistant } from '../../types';
|
|
11
|
-
|
|
12
11
|
export type ChatProgressProps = {
|
|
13
|
-
|
|
12
|
+
traceQueue?: Queue;
|
|
14
13
|
};
|
|
15
14
|
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
/**
|
|
16
|
+
* Displays execution progress from the space's invocation trace queue.
|
|
17
|
+
*/
|
|
18
|
+
export const ChatProgress = ({ traceQueue }: ChatProgressProps) => {
|
|
19
|
+
const { commits } = useExecutionGraph(traceQueue, true);
|
|
18
20
|
const nodes = useMemo(() => commits.map((commit) => ({ id: commit.id, message: commit.message })), [commits]);
|
|
19
21
|
const lines = useMemo(() => commits.map((commit) => commit.message), [commits]);
|
|
20
22
|
|
|
@@ -46,9 +48,9 @@ export const ChatProgress = ({ chat }: ChatProgressProps) => {
|
|
|
46
48
|
}, [nodes.length]);
|
|
47
49
|
|
|
48
50
|
return (
|
|
49
|
-
<div role='none' tabIndex={0} ref={ref} className='flex flex-col outline-
|
|
51
|
+
<div role='none' tabIndex={0} ref={ref} className='flex flex-col outline-hidden'>
|
|
50
52
|
<ProgressBar nodes={nodes} index={index} onSelect={handleSelect} />
|
|
51
|
-
<TextCrawl classNames='
|
|
53
|
+
<TextCrawl classNames='ps-4 text-sm text-description' lines={lines} autoAdvance />
|
|
52
54
|
</div>
|
|
53
55
|
);
|
|
54
56
|
};
|
|
@@ -7,7 +7,7 @@ import React, { type PropsWithChildren } from 'react';
|
|
|
7
7
|
import { IconButton, type ThemedClassName, useTranslation } from '@dxos/react-ui';
|
|
8
8
|
import { mx } from '@dxos/ui-theme';
|
|
9
9
|
|
|
10
|
-
import { meta } from '
|
|
10
|
+
import { meta } from '#meta';
|
|
11
11
|
import { type ChatEvent } from '../Chat';
|
|
12
12
|
|
|
13
13
|
export type ChatActionsProps = ThemedClassName<
|
|
@@ -23,7 +23,7 @@ export const ChatActions = ({ classNames, children, microphone, recording, proce
|
|
|
23
23
|
const { t } = useTranslation(meta.id);
|
|
24
24
|
|
|
25
25
|
return (
|
|
26
|
-
<div className={mx('flex items-center
|
|
26
|
+
<div className={mx('flex items-center me-1', classNames)}>
|
|
27
27
|
{children}
|
|
28
28
|
|
|
29
29
|
<IconButton
|
|
@@ -31,7 +31,7 @@ export const ChatActions = ({ classNames, children, microphone, recording, proce
|
|
|
31
31
|
variant='ghost'
|
|
32
32
|
icon='ph--x--regular'
|
|
33
33
|
iconOnly
|
|
34
|
-
label={t('cancel
|
|
34
|
+
label={t('cancel-processing.button')}
|
|
35
35
|
onClick={() => onEvent?.({ type: 'cancel' })}
|
|
36
36
|
/>
|
|
37
37
|
|
|
@@ -43,13 +43,21 @@ export const ChatActions = ({ classNames, children, microphone, recording, proce
|
|
|
43
43
|
icon='ph--microphone--regular'
|
|
44
44
|
iconOnly
|
|
45
45
|
noTooltip
|
|
46
|
-
label={t('microphone
|
|
46
|
+
label={t('microphone.button')}
|
|
47
47
|
onMouseDown={() => onEvent?.({ type: 'record-start' })}
|
|
48
48
|
onMouseUp={() => onEvent?.({ type: 'record-stop' })}
|
|
49
49
|
onTouchStart={() => onEvent?.({ type: 'record-start' })}
|
|
50
50
|
onTouchEnd={() => onEvent?.({ type: 'record-stop' })}
|
|
51
51
|
/>
|
|
52
52
|
)}
|
|
53
|
+
|
|
54
|
+
<IconButton
|
|
55
|
+
variant='ghost'
|
|
56
|
+
icon='ph--wrench--regular'
|
|
57
|
+
iconOnly
|
|
58
|
+
label={t('debug.button')}
|
|
59
|
+
onClick={() => onEvent?.({ type: 'toggle-debug' })}
|
|
60
|
+
/>
|
|
53
61
|
</div>
|
|
54
62
|
);
|
|
55
63
|
};
|
|
@@ -2,26 +2,23 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
+
import * as Option from 'effect/Option';
|
|
5
6
|
import React, { type JSX, useMemo, useState } from 'react';
|
|
6
7
|
|
|
7
8
|
import { type AiContextBinder } from '@dxos/assistant';
|
|
8
9
|
import { type Blueprint } from '@dxos/blueprints';
|
|
9
10
|
import { type Database, Filter, Obj, Type } from '@dxos/echo';
|
|
11
|
+
import { Annotation } from '@dxos/echo';
|
|
10
12
|
import { useQuery } from '@dxos/react-client/echo';
|
|
11
13
|
import { IconButton, Popover, Select, useTranslation } from '@dxos/react-ui';
|
|
12
|
-
import { Listbox, SearchList, useSearchListResults } from '@dxos/react-ui-
|
|
14
|
+
import { Listbox, SearchList, useSearchListResults } from '@dxos/react-ui-search';
|
|
13
15
|
import { Tabs } from '@dxos/react-ui-tabs';
|
|
16
|
+
import { getStyles, mx } from '@dxos/ui-theme';
|
|
14
17
|
|
|
15
|
-
import {
|
|
16
|
-
|
|
17
|
-
useBlueprintHandlers,
|
|
18
|
-
useBlueprints,
|
|
19
|
-
useContextObjects,
|
|
20
|
-
useFilteredTypes,
|
|
21
|
-
} from '../../hooks';
|
|
22
|
-
import { meta } from '../../meta';
|
|
18
|
+
import { useActiveBlueprints, useBlueprintHandlers, useBlueprints, useContextObjects, useFilteredTypes } from '#hooks';
|
|
19
|
+
import { meta } from '#meta';
|
|
23
20
|
|
|
24
|
-
const panelClassNames = '
|
|
21
|
+
const panelClassNames = 'w-[calc(100dvw-.5rem)] sm:w-max md:w-72 max-w-document-width';
|
|
25
22
|
|
|
26
23
|
export type ChatOptionsProps = {
|
|
27
24
|
db: Database.Database;
|
|
@@ -42,7 +39,7 @@ export const ChatOptions = ({ db, context, blueprintRegistry, presets, preset, o
|
|
|
42
39
|
<div role='none' className='flex p-2'>
|
|
43
40
|
<Popover.Root>
|
|
44
41
|
<Popover.Trigger asChild>
|
|
45
|
-
<IconButton variant='ghost' icon='ph--plus--regular' iconOnly label={t('context
|
|
42
|
+
<IconButton variant='ghost' icon='ph--plus--regular' iconOnly label={t('context-objects.button')} />
|
|
46
43
|
</Popover.Trigger>
|
|
47
44
|
<Popover.Portal>
|
|
48
45
|
<Popover.Content side='top' classNames={panelClassNames}>
|
|
@@ -60,27 +57,34 @@ export const ChatOptions = ({ db, context, blueprintRegistry, presets, preset, o
|
|
|
60
57
|
variant='ghost'
|
|
61
58
|
icon='ph--sliders-horizontal--regular'
|
|
62
59
|
iconOnly
|
|
63
|
-
label={t('context
|
|
60
|
+
label={t('context-settings.button')}
|
|
64
61
|
/>
|
|
65
62
|
</Popover.Trigger>
|
|
66
63
|
<Popover.Portal>
|
|
67
64
|
<Popover.Content side='top' classNames={panelClassNames}>
|
|
68
65
|
<Popover.Viewport>
|
|
69
66
|
<Tabs.Root orientation='horizontal' defaultValue='blueprints' defaultActivePart='list' tabIndex={-1}>
|
|
70
|
-
<Tabs.Viewport
|
|
71
|
-
|
|
67
|
+
<Tabs.Viewport
|
|
68
|
+
classNames={mx(
|
|
69
|
+
'max-h-(--radix-popover-content-available-height) grid grid-rows-[1fr_min-content]',
|
|
70
|
+
'[&_[cmdk-root]]:contents [&_[role="tabpanel"]]:grid [&_[role="tabpanel"]]:grid-rows-[1fr_min-content]',
|
|
71
|
+
'[&_[role="listbox"]]:min-h-0 [&_[role="listbox"]]:overflow-y-auto',
|
|
72
|
+
'[&_[role="tabpanel"]]:min-h-0 [&_[role="tabpanel"]]:px-form-chrome [&_[role="tabpanel"][data-state="active"]]:order-first [&_[role="tabpanel"][data-state="inactive"]]:hidden',
|
|
73
|
+
)}
|
|
74
|
+
>
|
|
75
|
+
<Tabs.Panel value='blueprints' tabIndex={-1} classNames='dx-focus-ring-inset'>
|
|
72
76
|
<BlueprintsPanel blueprintRegistry={blueprintRegistry} db={db} context={context} />
|
|
73
|
-
</Tabs.
|
|
74
|
-
<Tabs.
|
|
77
|
+
</Tabs.Panel>
|
|
78
|
+
<Tabs.Panel value='model' tabIndex={-1} classNames='dx-focus-ring-inset px-0!'>
|
|
75
79
|
<ModelsPanel presets={presets} preset={preset} onPresetChange={onPresetChange} />
|
|
76
|
-
</Tabs.
|
|
77
|
-
<Tabs.Tablist classNames='
|
|
80
|
+
</Tabs.Panel>
|
|
81
|
+
<Tabs.Tablist classNames='justify-center p-form-chrome border-y border-subdued-separator order-last'>
|
|
78
82
|
<Tabs.IconTab
|
|
79
83
|
value='blueprints'
|
|
80
84
|
icon='ph--blueprint--regular'
|
|
81
|
-
label={t('blueprints
|
|
85
|
+
label={t('blueprints-in-context.title')}
|
|
82
86
|
/>
|
|
83
|
-
<Tabs.IconTab value='model' label={t('chat
|
|
87
|
+
<Tabs.IconTab value='model' label={t('chat-model.title')} icon='ph--cpu--regular' />
|
|
84
88
|
</Tabs.Tablist>
|
|
85
89
|
</Tabs.Viewport>
|
|
86
90
|
</Tabs.Root>
|
|
@@ -111,7 +115,7 @@ const BlueprintsPanel = ({
|
|
|
111
115
|
|
|
112
116
|
return (
|
|
113
117
|
<SearchList.Root onSearch={handleSearch}>
|
|
114
|
-
<SearchList.Content classNames='
|
|
118
|
+
<SearchList.Content classNames='py-form-chrome'>
|
|
115
119
|
<SearchList.Viewport>
|
|
116
120
|
{results.map((blueprint) => {
|
|
117
121
|
const isActive = activeBlueprints.has(blueprint.key);
|
|
@@ -128,7 +132,7 @@ const BlueprintsPanel = ({
|
|
|
128
132
|
})}
|
|
129
133
|
</SearchList.Viewport>
|
|
130
134
|
</SearchList.Content>
|
|
131
|
-
<SearchList.Input placeholder={t('search
|
|
135
|
+
<SearchList.Input placeholder={t('search.placeholder')} classNames='mb-form-chrome' autoFocus />
|
|
132
136
|
</SearchList.Root>
|
|
133
137
|
);
|
|
134
138
|
};
|
|
@@ -164,7 +168,7 @@ const ObjectsPanel = ({ db, context }: Pick<ChatOptionsProps, 'db' | 'context'>)
|
|
|
164
168
|
const typename = Type.getTypename(type);
|
|
165
169
|
return {
|
|
166
170
|
typename,
|
|
167
|
-
label: t('typename
|
|
171
|
+
label: t('typename.label', { ns: typename, defaultValue: typename }),
|
|
168
172
|
};
|
|
169
173
|
});
|
|
170
174
|
|
|
@@ -190,16 +194,23 @@ const ObjectsPanel = ({ db, context }: Pick<ChatOptionsProps, 'db' | 'context'>)
|
|
|
190
194
|
|
|
191
195
|
return (
|
|
192
196
|
<SearchList.Root onSearch={handleSearch}>
|
|
193
|
-
<SearchList.Content classNames='p-
|
|
197
|
+
<SearchList.Content classNames='p-form-chrome [&:has([cmdk-list-sizer]:empty)]:py-0'>
|
|
194
198
|
<SearchList.Viewport>
|
|
195
199
|
{results.length ? (
|
|
196
200
|
results.map((object) => {
|
|
197
201
|
const isActive = contextObjects.findIndex((obj) => obj.id === object.id) !== -1;
|
|
202
|
+
const { icon, hue } = Option.fromNullable(Obj.getSchema(object)).pipe(
|
|
203
|
+
Option.flatMap(Annotation.IconAnnotation.get),
|
|
204
|
+
Option.getOrElse(() => ({ icon: DEFAULT_OBJECT_ICON, hue: undefined as string | undefined })),
|
|
205
|
+
);
|
|
206
|
+
const styles = hue ? getStyles(hue) : undefined;
|
|
198
207
|
return (
|
|
199
208
|
<SearchList.Item
|
|
200
209
|
classNames='flex items-center overflow-hidden'
|
|
201
210
|
key={object.id}
|
|
202
211
|
value={object.id}
|
|
212
|
+
icon={icon}
|
|
213
|
+
iconClassNames={styles?.surfaceText}
|
|
203
214
|
label={Obj.getLabel(object) ?? Obj.getTypename(object) ?? object.id}
|
|
204
215
|
checked={isActive}
|
|
205
216
|
onSelect={() => onUpdateObject?.(Obj.getDXN(object), !isActive)}
|
|
@@ -207,19 +218,19 @@ const ObjectsPanel = ({ db, context }: Pick<ChatOptionsProps, 'db' | 'context'>)
|
|
|
207
218
|
);
|
|
208
219
|
})
|
|
209
220
|
) : (
|
|
210
|
-
<SearchList.Item value='__empty__' label={t('no
|
|
221
|
+
<SearchList.Item value='__empty__' label={t('no-results.message')} />
|
|
211
222
|
)}
|
|
212
223
|
</SearchList.Viewport>
|
|
213
224
|
</SearchList.Content>
|
|
214
225
|
|
|
215
|
-
<div role='none' className='grid grid-cols-[min-content_1fr] gap-2
|
|
226
|
+
<div role='none' className='grid grid-cols-[min-content_1fr] gap-2 px-form-chrome mb-form-chrome'>
|
|
216
227
|
<Select.Root value={typename === ANY ? undefined : typename} onValueChange={setTypename}>
|
|
217
|
-
<Select.TriggerButton
|
|
228
|
+
<Select.TriggerButton placeholder={t('type-filter.placeholder')} />
|
|
218
229
|
<Select.Portal>
|
|
219
230
|
<Select.Content>
|
|
220
231
|
<Select.ScrollUpButton />
|
|
221
232
|
<Select.Viewport>
|
|
222
|
-
<Select.Option value={ANY}>{t('any
|
|
233
|
+
<Select.Option value={ANY}>{t('any-type-filter.label')}</Select.Option>
|
|
223
234
|
{typenames.map(({ typename, label }) => (
|
|
224
235
|
<Select.Option key={typename} value={typename}>
|
|
225
236
|
{label}
|
|
@@ -231,8 +242,11 @@ const ObjectsPanel = ({ db, context }: Pick<ChatOptionsProps, 'db' | 'context'>)
|
|
|
231
242
|
</Select.Content>
|
|
232
243
|
</Select.Portal>
|
|
233
244
|
</Select.Root>
|
|
234
|
-
<SearchList.Input placeholder={t('search
|
|
245
|
+
<SearchList.Input placeholder={t('search.placeholder')} classNames='mb-0' autoFocus />
|
|
235
246
|
</div>
|
|
236
247
|
</SearchList.Root>
|
|
237
248
|
);
|
|
238
249
|
};
|
|
250
|
+
|
|
251
|
+
// TODO(dmaretskyi): Extract those somewhere else.
|
|
252
|
+
const DEFAULT_OBJECT_ICON = 'ph--cube--regular';
|
|
@@ -2,15 +2,16 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
+
import * as Option from 'effect/Option';
|
|
5
6
|
import React from 'react';
|
|
6
7
|
|
|
7
8
|
import { type AiContextBinder } from '@dxos/assistant';
|
|
8
|
-
import { type Database, Obj } from '@dxos/echo';
|
|
9
|
-
import { IconButton, type Label, type ThemedClassName, toLocalizedString, useTranslation } from '@dxos/react-ui';
|
|
10
|
-
import { mx } from '@dxos/ui-theme';
|
|
9
|
+
import { Annotation, type Database, Obj } from '@dxos/echo';
|
|
10
|
+
import { Icon, IconButton, type Label, type ThemedClassName, toLocalizedString, useTranslation } from '@dxos/react-ui';
|
|
11
|
+
import { getStyles, mx } from '@dxos/ui-theme';
|
|
11
12
|
|
|
12
|
-
import { useContextObjects } from '
|
|
13
|
-
import { meta } from '
|
|
13
|
+
import { useContextObjects } from '#hooks';
|
|
14
|
+
import { meta } from '#meta';
|
|
14
15
|
|
|
15
16
|
export type ChatReferencesProps = ThemedClassName<{
|
|
16
17
|
context: AiContextBinder;
|
|
@@ -26,15 +27,21 @@ export const ChatReferences = ({ classNames, context, db }: ChatReferencesProps)
|
|
|
26
27
|
{objects.map((obj) => {
|
|
27
28
|
const dxn = Obj.getDXN(obj);
|
|
28
29
|
const typename = Obj.getTypename(obj);
|
|
29
|
-
const label: Label = Obj.getLabel(obj) ?? (typename ? ['object
|
|
30
|
+
const label: Label = Obj.getLabel(obj) ?? (typename ? ['object-name.placeholder', { ns: typename }] : obj.id);
|
|
31
|
+
const { icon, hue } = Option.fromNullable(Obj.getSchema(obj)).pipe(
|
|
32
|
+
Option.flatMap(Annotation.IconAnnotation.get),
|
|
33
|
+
Option.getOrElse(() => ({ icon: DEFAULT_OBJECT_ICON, hue: undefined as string | undefined })),
|
|
34
|
+
);
|
|
35
|
+
const styles = hue ? getStyles(hue) : undefined;
|
|
30
36
|
return (
|
|
31
|
-
<li key={dxn.toString()} className='dx-tag
|
|
37
|
+
<li key={dxn.toString()} className='dx-tag py-0 ps-2 flex items-center gap-1' data-hue='neutral'>
|
|
38
|
+
<Icon icon={icon} size={4} classNames={styles?.surfaceText} />
|
|
32
39
|
{toLocalizedString(label, t)}
|
|
33
40
|
<IconButton
|
|
34
41
|
icon='ph--x--bold'
|
|
35
42
|
iconOnly
|
|
36
43
|
variant='ghost'
|
|
37
|
-
label={t('remove
|
|
44
|
+
label={t('remove-object-in-context.label')}
|
|
38
45
|
classNames='p-0 hover:bg-transparent'
|
|
39
46
|
size={3}
|
|
40
47
|
onClick={() => onUpdateObject?.(dxn, false)}
|
|
@@ -45,3 +52,6 @@ export const ChatReferences = ({ classNames, context, db }: ChatReferencesProps)
|
|
|
45
52
|
</ul>
|
|
46
53
|
);
|
|
47
54
|
};
|
|
55
|
+
|
|
56
|
+
// TODO(dmaretskyi): Extract those somewhere else.
|
|
57
|
+
const DEFAULT_OBJECT_ICON = 'ph--cube--regular';
|
|
@@ -15,14 +15,14 @@ import { faker } from '@dxos/random';
|
|
|
15
15
|
import { useQueue, useSpace } from '@dxos/react-client/echo';
|
|
16
16
|
import { withClientProvider } from '@dxos/react-client/testing';
|
|
17
17
|
import { Popover } from '@dxos/react-ui';
|
|
18
|
-
import {
|
|
18
|
+
import { Card } from '@dxos/react-ui';
|
|
19
|
+
import { Loading, withLayout, withTheme } from '@dxos/react-ui/testing';
|
|
19
20
|
import { MarkdownStream } from '@dxos/react-ui-components';
|
|
20
21
|
import { EditorPreviewProvider, useEditorPreview } from '@dxos/react-ui-editor';
|
|
21
|
-
|
|
22
|
-
import { render } from '@dxos/storybook-utils';
|
|
22
|
+
|
|
23
23
|
import { type Message, Organization, Person } from '@dxos/types';
|
|
24
24
|
|
|
25
|
-
import { createMessageGenerator } from '
|
|
25
|
+
import { createMessageGenerator } from '#testing';
|
|
26
26
|
import { translations } from '../../translations';
|
|
27
27
|
|
|
28
28
|
import { ChatThread, type ChatThreadProps } from './ChatThread';
|
|
@@ -33,9 +33,9 @@ faker.seed(1);
|
|
|
33
33
|
|
|
34
34
|
type MessageGenerator = Effect.Effect<void, never, Database.Service | ContextQueueService>;
|
|
35
35
|
|
|
36
|
-
type
|
|
36
|
+
type DefaultStoryProps = { generator?: MessageGenerator[]; delay?: number; wait?: boolean } & ChatThreadProps;
|
|
37
37
|
|
|
38
|
-
const DefaultStory = ({ generator = [], delay = 0, wait, ...props }:
|
|
38
|
+
const DefaultStory = ({ generator = [], delay = 0, wait, ...props }: DefaultStoryProps) => {
|
|
39
39
|
const space = useSpace();
|
|
40
40
|
const queueDxn = useMemo(() => space?.queues.create().dxn, [space]);
|
|
41
41
|
const queue = useQueue<Message.Message>(queueDxn);
|
|
@@ -56,7 +56,7 @@ const DefaultStory = ({ generator = [], delay = 0, wait, ...props }: StoryProps)
|
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
58
|
setDone(true);
|
|
59
|
-
}).pipe(Effect.provide(Layer.mergeAll(Database.
|
|
59
|
+
}).pipe(Effect.provide(Layer.mergeAll(Database.layer(space.db), ContextQueueService.layer(queue)))),
|
|
60
60
|
);
|
|
61
61
|
|
|
62
62
|
return () => {
|
|
@@ -65,11 +65,11 @@ const DefaultStory = ({ generator = [], delay = 0, wait, ...props }: StoryProps)
|
|
|
65
65
|
}, [space, queue, generator]);
|
|
66
66
|
|
|
67
67
|
if (wait && !done) {
|
|
68
|
-
return
|
|
68
|
+
return <Loading data={{ wait, done }} />;
|
|
69
69
|
}
|
|
70
70
|
|
|
71
71
|
return (
|
|
72
|
-
<EditorPreviewProvider onLookup={async ({
|
|
72
|
+
<EditorPreviewProvider onLookup={async ({ dxn, label }) => ({ label, text: dxn })}>
|
|
73
73
|
<ChatThread {...props} messages={queue?.objects} />
|
|
74
74
|
<PreviewCard />
|
|
75
75
|
</EditorPreviewProvider>
|
|
@@ -95,11 +95,11 @@ const PreviewCard = () => {
|
|
|
95
95
|
};
|
|
96
96
|
|
|
97
97
|
const meta = {
|
|
98
|
-
title: 'plugins/plugin-assistant/ChatThread',
|
|
98
|
+
title: 'plugins/plugin-assistant/components/ChatThread',
|
|
99
99
|
component: ChatThread,
|
|
100
|
-
render:
|
|
100
|
+
render: DefaultStory,
|
|
101
101
|
decorators: [
|
|
102
|
-
withTheme,
|
|
102
|
+
withTheme(),
|
|
103
103
|
withLayout({ layout: 'column' }),
|
|
104
104
|
withClientProvider({
|
|
105
105
|
createIdentity: true,
|
|
@@ -111,11 +111,11 @@ const meta = {
|
|
|
111
111
|
layout: 'fullscreen',
|
|
112
112
|
translations,
|
|
113
113
|
},
|
|
114
|
-
} satisfies Meta<
|
|
114
|
+
} satisfies Meta<DefaultStoryProps>;
|
|
115
115
|
|
|
116
116
|
export default meta;
|
|
117
117
|
|
|
118
|
-
type Story = StoryObj<
|
|
118
|
+
type Story = StoryObj<DefaultStoryProps>;
|
|
119
119
|
|
|
120
120
|
export const Default: Story = {
|
|
121
121
|
args: {
|
|
@@ -135,7 +135,7 @@ export const Delayed: Story = {
|
|
|
135
135
|
|
|
136
136
|
export const Raw: Story = {
|
|
137
137
|
render: () => (
|
|
138
|
-
<div className='contents' style={{ '--user-fill': 'var(--
|
|
138
|
+
<div className='contents' style={{ '--user-fill': 'var(--color-amber-fill)' } as CSSProperties}>
|
|
139
139
|
<MarkdownStream content={TEXT} />
|
|
140
140
|
</div>
|
|
141
141
|
),
|
|
@@ -143,7 +143,7 @@ export const Raw: Story = {
|
|
|
143
143
|
|
|
144
144
|
export const Static: Story = {
|
|
145
145
|
render: () => (
|
|
146
|
-
<div className='contents' style={{ '--user-fill': 'var(--
|
|
146
|
+
<div className='contents' style={{ '--user-fill': 'var(--color-amber-fill)' } as CSSProperties}>
|
|
147
147
|
<MarkdownStream content={TEXT} registry={componentRegistry} />
|
|
148
148
|
</div>
|
|
149
149
|
),
|