@dxos/plugin-assistant 0.8.4-main.67995b8 → 0.8.4-main.72ec0f3
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/BlueprintArticle-IMCR3642.mjs +36 -0
- package/dist/lib/browser/BlueprintArticle-IMCR3642.mjs.map +7 -0
- package/dist/lib/browser/ChatCompanion-JYD2RIBJ.mjs +158 -0
- package/dist/lib/browser/ChatCompanion-JYD2RIBJ.mjs.map +7 -0
- package/dist/lib/browser/ChatContainer-XCPBWYIR.mjs +77 -0
- package/dist/lib/browser/ChatContainer-XCPBWYIR.mjs.map +7 -0
- package/dist/lib/browser/{ChatDialog-ZVLXFHEY.mjs → ChatDialog-DT7KFCRL.mjs} +30 -12
- package/dist/lib/browser/ChatDialog-DT7KFCRL.mjs.map +7 -0
- package/dist/lib/browser/PromptArticle-45QX25Y5.mjs +59 -0
- package/dist/lib/browser/PromptArticle-45QX25Y5.mjs.map +7 -0
- package/dist/lib/browser/ai-service-ERTZBTP3.mjs +19 -0
- package/dist/lib/browser/ai-service-ERTZBTP3.mjs.map +7 -0
- package/dist/lib/browser/app-graph-builder-VZEXMDTY.mjs +199 -0
- package/dist/lib/browser/app-graph-builder-VZEXMDTY.mjs.map +7 -0
- package/dist/lib/browser/blueprint-definition-5FT5JGPY.mjs +12 -0
- package/dist/lib/browser/blueprint-definition-5FT5JGPY.mjs.map +7 -0
- package/dist/lib/browser/chunk-2BOE3OTW.mjs +262 -0
- package/dist/lib/browser/chunk-2BOE3OTW.mjs.map +7 -0
- package/dist/lib/browser/chunk-BNTPFZ7O.mjs +229 -0
- package/dist/lib/browser/chunk-BNTPFZ7O.mjs.map +7 -0
- package/dist/lib/browser/chunk-FJQ4ZRYJ.mjs +335 -0
- package/dist/lib/browser/chunk-FJQ4ZRYJ.mjs.map +7 -0
- package/dist/lib/browser/chunk-IXIIS4QA.mjs +176 -0
- package/dist/lib/browser/chunk-IXIIS4QA.mjs.map +7 -0
- package/dist/lib/browser/chunk-J5LGTIGS.mjs +10 -0
- package/dist/lib/browser/chunk-J5LGTIGS.mjs.map +7 -0
- package/dist/lib/browser/chunk-LRE4VEZV.mjs +16 -0
- package/dist/lib/browser/chunk-LRE4VEZV.mjs.map +7 -0
- package/dist/lib/browser/chunk-U62BTGDF.mjs +1929 -0
- package/dist/lib/browser/chunk-U62BTGDF.mjs.map +7 -0
- package/dist/lib/browser/chunk-WBG5PTSX.mjs +23 -0
- package/dist/lib/browser/chunk-WBG5PTSX.mjs.map +7 -0
- package/dist/lib/browser/edge-model-resolver-O6OFYIO2.mjs +18 -0
- package/dist/lib/browser/edge-model-resolver-O6OFYIO2.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +209 -87
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/intent-resolver-AK5O4GUW.mjs +143 -0
- package/dist/lib/browser/intent-resolver-AK5O4GUW.mjs.map +7 -0
- package/dist/lib/browser/local-model-resolver-34MVHRKD.mjs +17 -0
- package/dist/lib/browser/local-model-resolver-34MVHRKD.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/react-surface-YCSR2MSR.mjs +98 -0
- package/dist/lib/browser/react-surface-YCSR2MSR.mjs.map +7 -0
- package/dist/lib/browser/{settings-5GTTCVGD.mjs → settings-NYJGNQ5I.mjs} +8 -7
- package/dist/lib/{node-esm/settings-J2EXEM5H.mjs.map → browser/settings-NYJGNQ5I.mjs.map} +1 -1
- package/dist/lib/browser/state-GG7Z3NB7.mjs +25 -0
- package/dist/lib/browser/state-GG7Z3NB7.mjs.map +7 -0
- package/dist/lib/browser/toolkit-VYDAWNE4.mjs +17 -0
- package/dist/lib/browser/toolkit-VYDAWNE4.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +7 -4
- package/dist/lib/node-esm/BlueprintArticle-OL2HUY6Q.mjs +37 -0
- package/dist/lib/node-esm/BlueprintArticle-OL2HUY6Q.mjs.map +7 -0
- package/dist/lib/node-esm/ChatCompanion-AHKJS25S.mjs +159 -0
- package/dist/lib/node-esm/ChatCompanion-AHKJS25S.mjs.map +7 -0
- package/dist/lib/node-esm/{ChatContainer-W3W6FWV3.mjs → ChatContainer-K7OGPE3G.mjs} +38 -15
- package/dist/lib/node-esm/ChatContainer-K7OGPE3G.mjs.map +7 -0
- package/dist/lib/node-esm/{ChatDialog-QW4JRKVO.mjs → ChatDialog-QT6ZBX45.mjs} +30 -12
- package/dist/lib/node-esm/ChatDialog-QT6ZBX45.mjs.map +7 -0
- package/dist/lib/node-esm/PromptArticle-OUKFSJQV.mjs +60 -0
- package/dist/lib/node-esm/PromptArticle-OUKFSJQV.mjs.map +7 -0
- package/dist/lib/node-esm/ai-service-MUYLV3NT.mjs +20 -0
- package/dist/lib/node-esm/ai-service-MUYLV3NT.mjs.map +7 -0
- package/dist/lib/node-esm/app-graph-builder-VRN6ESRR.mjs +200 -0
- package/dist/lib/node-esm/app-graph-builder-VRN6ESRR.mjs.map +7 -0
- package/dist/lib/node-esm/blueprint-definition-XW6QQVLV.mjs +13 -0
- package/dist/lib/node-esm/blueprint-definition-XW6QQVLV.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-3Q22TTXW.mjs +264 -0
- package/dist/lib/node-esm/chunk-3Q22TTXW.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-AB74FOA2.mjs +230 -0
- package/dist/lib/node-esm/chunk-AB74FOA2.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-BHS747K7.mjs +1930 -0
- package/dist/lib/node-esm/chunk-BHS747K7.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-HSLMI22Q.mjs +11 -0
- package/dist/lib/node-esm/chunk-HSLMI22Q.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-KJGD4EBJ.mjs +336 -0
- package/dist/lib/node-esm/chunk-KJGD4EBJ.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-UXTUHH24.mjs +178 -0
- package/dist/lib/node-esm/chunk-UXTUHH24.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-WE6KTH72.mjs +25 -0
- package/dist/lib/node-esm/chunk-WE6KTH72.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-YWFWT57N.mjs +17 -0
- package/dist/lib/node-esm/chunk-YWFWT57N.mjs.map +7 -0
- package/dist/lib/node-esm/edge-model-resolver-2ARXDOYS.mjs +19 -0
- package/dist/lib/node-esm/edge-model-resolver-2ARXDOYS.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +209 -87
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/intent-resolver-L2F3N45L.mjs +144 -0
- package/dist/lib/node-esm/intent-resolver-L2F3N45L.mjs.map +7 -0
- package/dist/lib/node-esm/local-model-resolver-TP2NTSAX.mjs +18 -0
- package/dist/lib/node-esm/local-model-resolver-TP2NTSAX.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/react-surface-CTW44GEM.mjs +99 -0
- package/dist/lib/node-esm/react-surface-CTW44GEM.mjs.map +7 -0
- package/dist/lib/node-esm/{settings-J2EXEM5H.mjs → settings-RRHYI5KO.mjs} +8 -7
- package/dist/lib/{browser/settings-5GTTCVGD.mjs.map → node-esm/settings-RRHYI5KO.mjs.map} +1 -1
- package/dist/lib/node-esm/state-FSUHFMDM.mjs +26 -0
- package/dist/lib/node-esm/state-FSUHFMDM.mjs.map +7 -0
- package/dist/lib/node-esm/toolkit-HFJZLVIR.mjs +18 -0
- package/dist/lib/node-esm/toolkit-HFJZLVIR.mjs.map +7 -0
- package/dist/lib/node-esm/types/index.mjs +7 -4
- package/dist/types/src/AssistantPlugin.d.ts +1 -1
- package/dist/types/src/AssistantPlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/ai-service.d.ts +4 -0
- package/dist/types/src/capabilities/ai-service.d.ts.map +1 -0
- package/dist/types/src/capabilities/app-graph-builder.d.ts +1 -1
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
- package/dist/types/src/capabilities/blueprint-definition.d.ts +7 -0
- package/dist/types/src/capabilities/blueprint-definition.d.ts.map +1 -0
- package/dist/types/src/capabilities/capabilities.d.ts +10 -0
- package/dist/types/src/capabilities/capabilities.d.ts.map +1 -0
- package/dist/types/src/capabilities/edge-model-resolver.d.ts +4 -0
- package/dist/types/src/capabilities/edge-model-resolver.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +11 -3
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/intent-resolver.d.ts +1 -1
- package/dist/types/src/capabilities/intent-resolver.d.ts.map +1 -1
- package/dist/types/src/capabilities/local-model-resolver.d.ts +10 -0
- package/dist/types/src/capabilities/local-model-resolver.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface.d.ts +1 -1
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
- package/dist/types/src/capabilities/settings.d.ts +1 -1
- package/dist/types/src/capabilities/state.d.ts +4 -0
- package/dist/types/src/capabilities/state.d.ts.map +1 -0
- package/dist/types/src/capabilities/toolkit.d.ts +4 -0
- package/dist/types/src/capabilities/toolkit.d.ts.map +1 -0
- package/dist/types/src/components/AssistantSettings/AssistantSettings.d.ts.map +1 -1
- package/dist/types/src/components/BlueprintArticle.d.ts +7 -0
- package/dist/types/src/components/BlueprintArticle.d.ts.map +1 -0
- package/dist/types/src/components/Chat/Chat.d.ts +35 -21
- package/dist/types/src/components/Chat/Chat.d.ts.map +1 -1
- package/dist/types/src/components/Chat/events.d.ts +9 -0
- package/dist/types/src/components/Chat/events.d.ts.map +1 -1
- package/dist/types/src/components/ChatCompanion.d.ts +13 -0
- package/dist/types/src/components/ChatCompanion.d.ts.map +1 -0
- package/dist/types/src/components/ChatContainer.d.ts +9 -6
- package/dist/types/src/components/ChatContainer.d.ts.map +1 -1
- package/dist/types/src/components/ChatDialog.d.ts.map +1 -1
- package/dist/types/src/components/ChatProgress/ChatProgress.d.ts +7 -0
- package/dist/types/src/components/ChatProgress/ChatProgress.d.ts.map +1 -0
- package/dist/types/src/components/ChatProgress/index.d.ts +2 -0
- package/dist/types/src/components/ChatProgress/index.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 +20 -0
- package/dist/types/src/components/ChatPrompt/ChatOptions.d.ts.map +1 -0
- package/dist/types/src/components/ChatPrompt/ChatPresets.d.ts.map +1 -1
- package/dist/types/src/components/ChatPrompt/ChatReferences.d.ts +4 -5
- package/dist/types/src/components/ChatPrompt/ChatReferences.d.ts.map +1 -1
- package/dist/types/src/components/ChatPrompt/ChatStatusIndicator.d.ts +6 -4
- package/dist/types/src/components/ChatPrompt/ChatStatusIndicator.d.ts.map +1 -1
- package/dist/types/src/components/ChatPrompt/index.d.ts +1 -1
- package/dist/types/src/components/ChatPrompt/index.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/ChatThread.d.ts +12 -10
- package/dist/types/src/components/ChatThread/ChatThread.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/ChatThread.stories.d.ts +191 -55
- package/dist/types/src/components/ChatThread/ChatThread.stories.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/Link.d.ts +9 -0
- package/dist/types/src/components/ChatThread/Link.d.ts.map +1 -0
- package/dist/types/src/components/ChatThread/reducers.d.ts +40 -0
- package/dist/types/src/components/ChatThread/reducers.d.ts.map +1 -0
- package/dist/types/src/components/ChatThread/registry.d.ts +11 -0
- package/dist/types/src/components/ChatThread/registry.d.ts.map +1 -0
- package/dist/types/src/components/ChatThread/sync.d.ts +42 -0
- package/dist/types/src/components/ChatThread/sync.d.ts.map +1 -0
- package/dist/types/src/components/ChatThread/sync.test.d.ts +2 -0
- package/dist/types/src/components/ChatThread/sync.test.d.ts.map +1 -0
- package/dist/types/src/components/PromptArticle.d.ts +7 -0
- package/dist/types/src/components/PromptArticle.d.ts.map +1 -0
- package/dist/types/src/components/TemplateEditor/TemplateEditor.d.ts +2 -6
- package/dist/types/src/components/TemplateEditor/TemplateEditor.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/TemplateEditor.stories.d.ts +312 -7
- package/dist/types/src/components/TemplateEditor/TemplateEditor.stories.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/TemplateForm.d.ts +1 -1
- package/dist/types/src/components/TemplateEditor/TemplateForm.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/TemplateForm.stories.d.ts +309 -2
- package/dist/types/src/components/TemplateEditor/TemplateForm.stories.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/extensions/handlebars-extension.d.ts +12 -0
- package/dist/types/src/components/TemplateEditor/extensions/handlebars-extension.d.ts.map +1 -0
- package/dist/types/src/components/TemplateEditor/extensions/index.d.ts +3 -0
- package/dist/types/src/components/TemplateEditor/extensions/index.d.ts.map +1 -0
- package/dist/types/src/components/TemplateEditor/extensions/xml-extension.d.ts +8 -0
- package/dist/types/src/components/TemplateEditor/extensions/xml-extension.d.ts.map +1 -0
- package/dist/types/src/components/ToolBlock/ToolBlock.d.ts +21 -0
- package/dist/types/src/components/ToolBlock/ToolBlock.d.ts.map +1 -0
- package/dist/types/src/components/ToolBlock/ToolBlockWidget.d.ts +2 -0
- package/dist/types/src/components/ToolBlock/ToolBlockWidget.d.ts.map +1 -0
- package/dist/types/src/components/ToolBlock/index.d.ts +3 -0
- package/dist/types/src/components/ToolBlock/index.d.ts.map +1 -0
- package/dist/types/src/components/Toolbox/Toolbox.d.ts +6 -11
- package/dist/types/src/components/Toolbox/Toolbox.d.ts.map +1 -1
- package/dist/types/src/components/Toolbox/Toolbox.stories.d.ts +313 -5
- package/dist/types/src/components/Toolbox/Toolbox.stories.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +4 -6
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/events.d.ts +1 -1
- package/dist/types/src/events.d.ts.map +1 -1
- package/dist/types/src/functions/analysis.d.ts +5 -0
- package/dist/types/src/functions/analysis.d.ts.map +1 -0
- package/dist/types/src/functions/index.d.ts +4 -0
- package/dist/types/src/functions/index.d.ts.map +1 -0
- package/dist/types/src/functions/object-list.d.ts +10 -0
- package/dist/types/src/functions/object-list.d.ts.map +1 -0
- package/dist/types/src/functions/object-load.d.ts +8 -0
- package/dist/types/src/functions/object-load.d.ts.map +1 -0
- package/dist/types/src/hooks/index.d.ts +8 -3
- package/dist/types/src/hooks/index.d.ts.map +1 -1
- package/dist/types/src/hooks/useBlueprintRegistry.d.ts +25 -0
- package/dist/types/src/hooks/useBlueprintRegistry.d.ts.map +1 -0
- package/dist/types/src/hooks/useChatProcessor.d.ts +8 -19
- package/dist/types/src/hooks/useChatProcessor.d.ts.map +1 -1
- package/dist/types/src/hooks/useChatServices.d.ts +5 -6
- package/dist/types/src/hooks/useChatServices.d.ts.map +1 -1
- package/dist/types/src/hooks/useChatToolbarActions.d.ts +8 -0
- package/dist/types/src/hooks/useChatToolbarActions.d.ts.map +1 -0
- package/dist/types/src/hooks/useContextBinder.d.ts +4 -0
- package/dist/types/src/hooks/useContextBinder.d.ts.map +1 -0
- package/dist/types/src/hooks/useContextObjects.d.ts +15 -0
- package/dist/types/src/hooks/useContextObjects.d.ts.map +1 -0
- package/dist/types/src/hooks/useFlush.d.ts +6 -0
- package/dist/types/src/hooks/useFlush.d.ts.map +1 -0
- package/dist/types/src/hooks/useItemTypes.d.ts +4 -0
- package/dist/types/src/hooks/useItemTypes.d.ts.map +1 -0
- package/dist/types/src/hooks/useOnline.d.ts +3 -0
- package/dist/types/src/hooks/useOnline.d.ts.map +1 -0
- package/dist/types/src/hooks/usePresets.d.ts +7 -0
- package/dist/types/src/hooks/usePresets.d.ts.map +1 -0
- package/dist/types/src/hooks/useReferencesProvider.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +2 -0
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +1 -2
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/processor/index.d.ts +4 -0
- package/dist/types/src/processor/index.d.ts.map +1 -0
- package/dist/types/src/{hooks → processor}/presets.d.ts +3 -3
- package/dist/types/src/processor/presets.d.ts.map +1 -0
- package/dist/types/src/processor/processor.d.ts +74 -0
- package/dist/types/src/processor/processor.d.ts.map +1 -0
- package/dist/types/src/processor/processor.test.d.ts +2 -0
- package/dist/types/src/processor/processor.test.d.ts.map +1 -0
- package/dist/types/src/processor/update-name.d.ts +10 -0
- package/dist/types/src/processor/update-name.d.ts.map +1 -0
- package/dist/types/src/queue-logger.d.ts.map +1 -1
- package/dist/types/src/testing/index.d.ts +1 -1
- package/dist/types/src/testing/index.d.ts.map +1 -1
- package/dist/types/src/testing/test-generator.d.ts +7 -0
- package/dist/types/src/testing/test-generator.d.ts.map +1 -0
- package/dist/types/src/testing/test-sequence.d.ts +0 -4
- package/dist/types/src/testing/test-sequence.d.ts.map +1 -1
- package/dist/types/src/testing/test-services.d.ts +2 -2
- package/dist/types/src/testing/test-services.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +257 -28
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/Assistant.d.ts +48 -0
- package/dist/types/src/types/Assistant.d.ts.map +1 -0
- package/dist/types/src/types/AssistantAction.d.ts +132 -0
- package/dist/types/src/types/AssistantAction.d.ts.map +1 -0
- package/dist/types/src/types/defs.d.ts +2 -0
- package/dist/types/src/types/defs.d.ts.map +1 -0
- package/dist/types/src/types/index.d.ts +3 -1
- package/dist/types/src/types/index.d.ts.map +1 -1
- package/dist/types/src/types/service.d.ts +27 -18
- package/dist/types/src/types/service.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +100 -97
- package/src/AssistantPlugin.tsx +168 -107
- package/src/capabilities/ai-service.ts +27 -0
- package/src/capabilities/app-graph-builder.ts +101 -60
- package/src/capabilities/blueprint-definition.ts +66 -0
- package/src/capabilities/capabilities.ts +17 -0
- package/src/capabilities/edge-model-resolver.ts +25 -0
- package/src/capabilities/index.ts +9 -0
- package/src/capabilities/intent-resolver.ts +97 -22
- package/src/capabilities/local-model-resolver.ts +30 -0
- package/src/capabilities/react-surface.tsx +24 -75
- package/src/capabilities/state.ts +22 -0
- package/src/capabilities/toolkit.ts +17 -0
- package/src/components/AssistantSettings/AssistantSettings.tsx +83 -76
- package/src/components/BlueprintArticle.tsx +29 -0
- package/src/components/Chat/Chat.tsx +260 -217
- package/src/components/Chat/events.ts +13 -0
- package/src/components/ChatCompanion.tsx +155 -0
- package/src/components/ChatContainer.tsx +36 -20
- package/src/components/ChatDialog.tsx +25 -14
- package/src/components/ChatProgress/ChatProgress.tsx +67 -0
- package/src/components/{SequenceEditor → ChatProgress}/index.ts +1 -1
- package/src/components/ChatPrompt/ChatActions.tsx +10 -26
- package/src/components/ChatPrompt/ChatOptions.tsx +228 -0
- package/src/components/ChatPrompt/ChatPresets.tsx +1 -0
- package/src/components/ChatPrompt/ChatReferences.tsx +31 -36
- package/src/components/ChatPrompt/ChatStatusIndicator.tsx +25 -22
- package/src/components/ChatPrompt/index.ts +1 -1
- package/src/components/ChatThread/ChatThread.stories.tsx +120 -115
- package/src/components/ChatThread/ChatThread.tsx +65 -35
- package/src/components/ChatThread/Link.tsx +26 -0
- package/src/components/ChatThread/reducers.ts +151 -0
- package/src/components/ChatThread/registry.tsx +174 -0
- package/src/components/ChatThread/sync.test.ts +89 -0
- package/src/components/ChatThread/sync.ts +148 -0
- package/src/components/ChatThread/testing/thread.md +37 -0
- package/src/components/PromptArticle.tsx +51 -0
- package/src/components/TemplateEditor/TemplateEditor.stories.tsx +38 -17
- package/src/components/TemplateEditor/TemplateEditor.tsx +29 -53
- package/src/components/TemplateEditor/TemplateForm.stories.tsx +16 -11
- package/src/components/TemplateEditor/TemplateForm.tsx +5 -3
- package/src/components/TemplateEditor/extensions/handlebars-extension.ts +269 -0
- package/src/components/TemplateEditor/extensions/index.ts +6 -0
- package/src/components/TemplateEditor/extensions/xml-extension.ts +64 -0
- package/src/components/ToolBlock/ToolBlock.tsx +143 -0
- package/src/components/ToolBlock/ToolBlockWidget.tsx +5 -0
- package/src/components/ToolBlock/index.ts +6 -0
- package/src/components/Toolbox/Toolbox.stories.tsx +14 -23
- package/src/components/Toolbox/Toolbox.tsx +25 -55
- package/src/components/index.ts +3 -7
- package/src/events.ts +2 -2
- package/src/functions/analysis.ts +22 -0
- package/src/functions/index.ts +7 -0
- package/src/functions/object-list.ts +48 -0
- package/src/functions/object-load.ts +45 -0
- package/src/hooks/index.ts +8 -4
- package/src/hooks/useBlueprintRegistry.ts +95 -0
- package/src/hooks/useChatProcessor.ts +35 -104
- package/src/hooks/useChatServices.ts +33 -49
- package/src/hooks/useChatToolbarActions.ts +122 -0
- package/src/hooks/useContextBinder.ts +30 -0
- package/src/hooks/useContextObjects.ts +58 -0
- package/src/hooks/useFlush.ts +35 -0
- package/src/hooks/useItemTypes.ts +37 -0
- package/src/hooks/useOnline.ts +10 -0
- package/src/hooks/usePresets.ts +44 -0
- package/src/hooks/useReferencesProvider.ts +13 -10
- package/src/index.ts +2 -0
- package/src/meta.ts +9 -6
- package/src/processor/index.ts +7 -0
- package/src/{hooks → processor}/presets.ts +16 -8
- package/src/processor/processor.test.ts +71 -0
- package/src/processor/processor.ts +277 -0
- package/src/processor/update-name.ts +56 -0
- package/src/queue-logger.ts +13 -17
- package/src/testing/index.ts +1 -1
- package/src/testing/test-generator.ts +261 -0
- package/src/testing/test-sequence.ts +2 -27
- package/src/testing/test-services.ts +2 -8
- package/src/translations.ts +45 -18
- package/src/types/Assistant.ts +63 -0
- package/src/types/AssistantAction.ts +79 -0
- package/src/types/defs.ts +5 -0
- package/src/types/index.ts +4 -1
- package/src/types/service.ts +17 -9
- package/src/vite-env.d.ts +30 -0
- package/dist/lib/browser/BlueprintContainer-IZ4AK5EO.mjs +0 -28
- package/dist/lib/browser/BlueprintContainer-IZ4AK5EO.mjs.map +0 -7
- package/dist/lib/browser/ChatContainer-RP3QEXYX.mjs +0 -54
- package/dist/lib/browser/ChatContainer-RP3QEXYX.mjs.map +0 -7
- package/dist/lib/browser/ChatDialog-ZVLXFHEY.mjs.map +0 -7
- package/dist/lib/browser/SequenceContainer-3UDVKWPA.mjs +0 -162
- package/dist/lib/browser/SequenceContainer-3UDVKWPA.mjs.map +0 -7
- package/dist/lib/browser/app-graph-builder-XSEOKJLG.mjs +0 -164
- package/dist/lib/browser/app-graph-builder-XSEOKJLG.mjs.map +0 -7
- package/dist/lib/browser/chunk-63GG6U6D.mjs +0 -2226
- package/dist/lib/browser/chunk-63GG6U6D.mjs.map +0 -7
- package/dist/lib/browser/chunk-7W7LHTRH.mjs +0 -171
- package/dist/lib/browser/chunk-7W7LHTRH.mjs.map +0 -7
- package/dist/lib/browser/chunk-FDCJSQYF.mjs +0 -40
- package/dist/lib/browser/chunk-FDCJSQYF.mjs.map +0 -7
- package/dist/lib/browser/chunk-KFXSBNZR.mjs +0 -89
- package/dist/lib/browser/chunk-KFXSBNZR.mjs.map +0 -7
- package/dist/lib/browser/chunk-LERGF5YG.mjs +0 -108
- package/dist/lib/browser/chunk-LERGF5YG.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-MV3VSZLS.mjs +0 -75
- package/dist/lib/browser/intent-resolver-MV3VSZLS.mjs.map +0 -7
- package/dist/lib/browser/react-surface-3GYEHQRP.mjs +0 -150
- package/dist/lib/browser/react-surface-3GYEHQRP.mjs.map +0 -7
- package/dist/lib/node-esm/BlueprintContainer-RGTMNLNX.mjs +0 -29
- package/dist/lib/node-esm/BlueprintContainer-RGTMNLNX.mjs.map +0 -7
- package/dist/lib/node-esm/ChatContainer-W3W6FWV3.mjs.map +0 -7
- package/dist/lib/node-esm/ChatDialog-QW4JRKVO.mjs.map +0 -7
- package/dist/lib/node-esm/SequenceContainer-RQQH5XOC.mjs +0 -163
- package/dist/lib/node-esm/SequenceContainer-RQQH5XOC.mjs.map +0 -7
- package/dist/lib/node-esm/app-graph-builder-PANCJUHV.mjs +0 -165
- package/dist/lib/node-esm/app-graph-builder-PANCJUHV.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-BFO3KHYL.mjs +0 -2227
- package/dist/lib/node-esm/chunk-BFO3KHYL.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-MS3PJARN.mjs +0 -109
- package/dist/lib/node-esm/chunk-MS3PJARN.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-QN2H2EHV.mjs +0 -41
- package/dist/lib/node-esm/chunk-QN2H2EHV.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-VIIMA3XQ.mjs +0 -90
- package/dist/lib/node-esm/chunk-VIIMA3XQ.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-Z7PUODRT.mjs +0 -172
- package/dist/lib/node-esm/chunk-Z7PUODRT.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-3FMC3GHC.mjs +0 -76
- package/dist/lib/node-esm/intent-resolver-3FMC3GHC.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-QDQWJ7FZ.mjs +0 -151
- package/dist/lib/node-esm/react-surface-QDQWJ7FZ.mjs.map +0 -7
- package/dist/types/src/capability-definitions.d.ts +0 -7
- package/dist/types/src/capability-definitions.d.ts.map +0 -1
- package/dist/types/src/components/BlueprintContainer.d.ts +0 -8
- package/dist/types/src/components/BlueprintContainer.d.ts.map +0 -1
- package/dist/types/src/components/ChatPrompt/ChatOptionsMenu.d.ts +0 -9
- package/dist/types/src/components/ChatPrompt/ChatOptionsMenu.d.ts.map +0 -1
- package/dist/types/src/components/ChatThread/ChatMessage.d.ts +0 -17
- package/dist/types/src/components/ChatThread/ChatMessage.d.ts.map +0 -1
- package/dist/types/src/components/ChatThread/ToolBlock.d.ts +0 -19
- package/dist/types/src/components/ChatThread/ToolBlock.d.ts.map +0 -1
- package/dist/types/src/components/ChatThread/reducer.d.ts +0 -12
- package/dist/types/src/components/ChatThread/reducer.d.ts.map +0 -1
- package/dist/types/src/components/PromptSettings.d.ts +0 -6
- package/dist/types/src/components/PromptSettings.d.ts.map +0 -1
- package/dist/types/src/components/SequenceContainer.d.ts +0 -8
- package/dist/types/src/components/SequenceContainer.d.ts.map +0 -1
- package/dist/types/src/components/SequenceEditor/SequenceEditor.d.ts +0 -13
- package/dist/types/src/components/SequenceEditor/SequenceEditor.d.ts.map +0 -1
- package/dist/types/src/components/SequenceEditor/SequenceEditor.stories.d.ts +0 -8
- package/dist/types/src/components/SequenceEditor/SequenceEditor.stories.d.ts.map +0 -1
- package/dist/types/src/components/SequenceEditor/index.d.ts +0 -2
- package/dist/types/src/components/SequenceEditor/index.d.ts.map +0 -1
- package/dist/types/src/hooks/chat-processor.d.ts +0 -86
- package/dist/types/src/hooks/chat-processor.d.ts.map +0 -1
- package/dist/types/src/hooks/chat-processor.test.d.ts +0 -2
- package/dist/types/src/hooks/chat-processor.test.d.ts.map +0 -1
- package/dist/types/src/hooks/presets.d.ts.map +0 -1
- package/dist/types/src/hooks/useBlueprints.d.ts +0 -9
- package/dist/types/src/hooks/useBlueprints.d.ts.map +0 -1
- package/dist/types/src/parser/filter-generator.d.ts +0 -4
- package/dist/types/src/parser/filter-generator.d.ts.map +0 -1
- package/dist/types/src/parser/filter-generator.test.d.ts +0 -2
- package/dist/types/src/parser/filter-generator.test.d.ts.map +0 -1
- package/dist/types/src/parser/index.d.ts +0 -4
- package/dist/types/src/parser/index.d.ts.map +0 -1
- package/dist/types/src/parser/query-parser.d.ts +0 -15
- package/dist/types/src/parser/query-parser.d.ts.map +0 -1
- package/dist/types/src/parser/query-parser.test.d.ts +0 -2
- package/dist/types/src/parser/query-parser.test.d.ts.map +0 -1
- package/dist/types/src/parser/types.d.ts +0 -24
- package/dist/types/src/parser/types.d.ts.map +0 -1
- package/dist/types/src/stories/Chat.stories.d.ts +0 -207
- package/dist/types/src/stories/Chat.stories.d.ts.map +0 -1
- package/dist/types/src/testing/test-functions.d.ts +0 -3
- package/dist/types/src/testing/test-functions.d.ts.map +0 -1
- package/dist/types/src/tools/function.d.ts +0 -5
- package/dist/types/src/tools/function.d.ts.map +0 -1
- package/dist/types/src/tools/index.d.ts +0 -3
- package/dist/types/src/tools/index.d.ts.map +0 -1
- package/dist/types/src/tools/openapi.d.ts +0 -10
- package/dist/types/src/tools/openapi.d.ts.map +0 -1
- package/dist/types/src/tools/openapi.test.d.ts +0 -2
- package/dist/types/src/tools/openapi.test.d.ts.map +0 -1
- package/dist/types/src/types/schema.d.ts +0 -120
- package/dist/types/src/types/schema.d.ts.map +0 -1
- package/src/capability-definitions.ts +0 -15
- package/src/components/BlueprintContainer.tsx +0 -24
- package/src/components/ChatPrompt/ChatOptionsMenu.tsx +0 -52
- package/src/components/ChatThread/ChatMessage.tsx +0 -268
- package/src/components/ChatThread/ToolBlock.tsx +0 -121
- package/src/components/ChatThread/reducer.ts +0 -52
- package/src/components/PromptSettings.tsx +0 -89
- package/src/components/SequenceContainer.tsx +0 -132
- package/src/components/SequenceEditor/SequenceEditor.stories.tsx +0 -32
- package/src/components/SequenceEditor/SequenceEditor.tsx +0 -50
- package/src/hooks/chat-processor.test.ts +0 -16
- package/src/hooks/chat-processor.ts +0 -314
- package/src/hooks/useBlueprints.ts +0 -57
- package/src/parser/filter-generator.test.ts +0 -32
- package/src/parser/filter-generator.ts +0 -81
- package/src/parser/index.ts +0 -7
- package/src/parser/query-parser.test.ts +0 -139
- package/src/parser/query-parser.ts +0 -199
- package/src/parser/types.ts +0 -34
- package/src/shims.d.ts +0 -8
- package/src/stories/Chat.stories.tsx +0 -371
- package/src/testing/test-functions.ts +0 -11
- package/src/tools/function.ts +0 -46
- package/src/tools/index.ts +0 -6
- package/src/tools/openapi.test.ts +0 -217
- package/src/tools/openapi.ts +0 -338
- package/src/types/schema.ts +0 -108
- package/src/typings.d.ts +0 -9
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Array from 'effect/Array';
|
|
6
|
+
import * as Function from 'effect/Function';
|
|
7
|
+
import * as Option from 'effect/Option';
|
|
8
|
+
import React, { useCallback, useEffect, useMemo, useState } from 'react';
|
|
9
|
+
|
|
10
|
+
import { Capabilities, createIntent } from '@dxos/app-framework';
|
|
11
|
+
import { useCapabilities, useIntentDispatcher } from '@dxos/app-framework/react';
|
|
12
|
+
import { Blueprint } from '@dxos/blueprints';
|
|
13
|
+
import { getSpace } from '@dxos/client/echo';
|
|
14
|
+
import { Filter, Obj, Ref } from '@dxos/echo';
|
|
15
|
+
import { SpaceAction } from '@dxos/plugin-space/types';
|
|
16
|
+
import { useQuery } from '@dxos/react-client/echo';
|
|
17
|
+
import { useAsyncEffect } from '@dxos/react-ui';
|
|
18
|
+
|
|
19
|
+
import { ChatContainer, type ChatEvent } from '../components';
|
|
20
|
+
import { useBlueprintRegistry, useContextBinder } from '../hooks';
|
|
21
|
+
import { Assistant, AssistantAction } from '../types';
|
|
22
|
+
|
|
23
|
+
export type ChatCompanionProps = {
|
|
24
|
+
role?: string;
|
|
25
|
+
data: { subject: Assistant.Chat | 'assistant-chat'; companionTo: Obj.Any };
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export const ChatCompanion = ({ role, data }: ChatCompanionProps) => {
|
|
29
|
+
const { dispatchPromise: dispatch } = useIntentDispatcher();
|
|
30
|
+
const blueprintRegistry = useBlueprintRegistry();
|
|
31
|
+
const companionTo = data.companionTo;
|
|
32
|
+
|
|
33
|
+
const space = getSpace(companionTo);
|
|
34
|
+
const [chat, setChat] = useState(data.subject === 'assistant-chat' ? undefined : data.subject);
|
|
35
|
+
useEffect(() => {
|
|
36
|
+
setChat(data.subject === 'assistant-chat' ? undefined : data.subject);
|
|
37
|
+
}, [data.subject]);
|
|
38
|
+
|
|
39
|
+
const chatQueue = space && chat ? space.queues.get(chat.queue.dxn) : undefined;
|
|
40
|
+
const binder = useContextBinder(chatQueue);
|
|
41
|
+
|
|
42
|
+
// Initialize companion chat if it doesn't exist, but don't add it to the space immediately.
|
|
43
|
+
useAsyncEffect(async () => {
|
|
44
|
+
if (!space || chat) {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const { data } = await dispatch(createIntent(AssistantAction.CreateChat, { space }));
|
|
49
|
+
setChat(data?.object);
|
|
50
|
+
}, [chat, space]);
|
|
51
|
+
|
|
52
|
+
// Add chat to space when user submits the first message.
|
|
53
|
+
const handleEvent = useCallback(
|
|
54
|
+
async (event: ChatEvent) => {
|
|
55
|
+
const chatInSpace = !!getSpace(chat);
|
|
56
|
+
if (chatInSpace || !chat || !space) {
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
if (event.type === 'submit') {
|
|
61
|
+
await dispatch(
|
|
62
|
+
createIntent(SpaceAction.AddObject, {
|
|
63
|
+
object: chat,
|
|
64
|
+
target: space,
|
|
65
|
+
hidden: true,
|
|
66
|
+
}),
|
|
67
|
+
);
|
|
68
|
+
await dispatch(
|
|
69
|
+
createIntent(SpaceAction.AddRelation, {
|
|
70
|
+
space,
|
|
71
|
+
schema: Assistant.CompanionTo,
|
|
72
|
+
source: chat,
|
|
73
|
+
target: companionTo,
|
|
74
|
+
}),
|
|
75
|
+
);
|
|
76
|
+
await dispatch(
|
|
77
|
+
createIntent(AssistantAction.SetCurrentChat, {
|
|
78
|
+
companionTo,
|
|
79
|
+
chat,
|
|
80
|
+
}),
|
|
81
|
+
);
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
[chat, space, companionTo, dispatch],
|
|
85
|
+
);
|
|
86
|
+
|
|
87
|
+
const metadata = useCapabilities(Capabilities.Metadata);
|
|
88
|
+
const blueprintKeys = useMemo(
|
|
89
|
+
() =>
|
|
90
|
+
Function.pipe(
|
|
91
|
+
metadata,
|
|
92
|
+
Array.findFirst(
|
|
93
|
+
(
|
|
94
|
+
capability,
|
|
95
|
+
): capability is {
|
|
96
|
+
id: string;
|
|
97
|
+
metadata: { blueprints?: string[] };
|
|
98
|
+
} => capability.id === Obj.getTypename(companionTo),
|
|
99
|
+
),
|
|
100
|
+
Option.flatMap((c) => Option.fromNullable(c.metadata.blueprints)),
|
|
101
|
+
Option.getOrElse(() => [] as string[]),
|
|
102
|
+
),
|
|
103
|
+
[metadata, companionTo],
|
|
104
|
+
);
|
|
105
|
+
const existingBlueprints = useQuery(space, Filter.type(Blueprint.Blueprint));
|
|
106
|
+
const pluginBlueprints = useMemo(
|
|
107
|
+
() => existingBlueprints.filter((blueprint) => blueprintKeys.includes(blueprint.key)),
|
|
108
|
+
[existingBlueprints, blueprintKeys],
|
|
109
|
+
);
|
|
110
|
+
|
|
111
|
+
// Initialize related blueprints that are not already in the space.
|
|
112
|
+
useAsyncEffect(async () => {
|
|
113
|
+
if (!space) {
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
// NOTE: This must be run instead of using the useQuery result to avoid duplicates.
|
|
118
|
+
const { objects: existingBlueprints } = await space.db.query(Filter.type(Blueprint.Blueprint)).run();
|
|
119
|
+
for (const key of blueprintKeys) {
|
|
120
|
+
const existingBlueprint = existingBlueprints.find((blueprint) => blueprint.key === key);
|
|
121
|
+
if (existingBlueprint) {
|
|
122
|
+
continue;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
const blueprint = blueprintRegistry.getByKey(key);
|
|
126
|
+
if (!blueprint) {
|
|
127
|
+
continue;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
space.db.add(Obj.clone(blueprint));
|
|
131
|
+
}
|
|
132
|
+
}, [space, blueprintRegistry, blueprintKeys]);
|
|
133
|
+
|
|
134
|
+
useAsyncEffect(async () => {
|
|
135
|
+
if (!binder?.isOpen) {
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
if (pluginBlueprints.length > 0) {
|
|
140
|
+
await binder.bind({
|
|
141
|
+
blueprints: pluginBlueprints.map((blueprint) => Ref.make(blueprint)),
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
if (Obj.instanceOf(Blueprint.Blueprint, companionTo)) {
|
|
146
|
+
await binder.bind({ blueprints: [Ref.make(companionTo)] });
|
|
147
|
+
} else {
|
|
148
|
+
await binder.bind({ objects: [Ref.make(companionTo)] });
|
|
149
|
+
}
|
|
150
|
+
}, [binder, companionTo, blueprintKeys]);
|
|
151
|
+
|
|
152
|
+
return <ChatContainer role={role} space={space} chat={chat} companionTo={companionTo} onEvent={handleEvent} />;
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
export default ChatCompanion;
|
|
@@ -4,39 +4,55 @@
|
|
|
4
4
|
|
|
5
5
|
import React from 'react';
|
|
6
6
|
|
|
7
|
-
import { Capabilities
|
|
8
|
-
import {
|
|
9
|
-
import { getSpace } from '@dxos/client/echo';
|
|
7
|
+
import { Capabilities } from '@dxos/app-framework';
|
|
8
|
+
import { useCapability } from '@dxos/app-framework/react';
|
|
9
|
+
import { type Space, getSpace } from '@dxos/client/echo';
|
|
10
|
+
import { type Obj } from '@dxos/echo';
|
|
10
11
|
import { StackItem } from '@dxos/react-ui-stack';
|
|
11
12
|
|
|
12
|
-
import {
|
|
13
|
-
import { useChatProcessor, useChatServices } from '../hooks';
|
|
13
|
+
import { useBlueprintRegistry, useChatProcessor, useChatServices, useOnline, usePresets } from '../hooks';
|
|
14
14
|
import { meta } from '../meta';
|
|
15
15
|
import { type Assistant } from '../types';
|
|
16
16
|
|
|
17
|
+
import { Chat, type ChatRootProps } from './Chat';
|
|
18
|
+
|
|
17
19
|
export type ChatContainerProps = {
|
|
18
|
-
role
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
role?: string;
|
|
21
|
+
space?: Space;
|
|
22
|
+
chat?: Assistant.Chat;
|
|
23
|
+
companionTo?: Obj.Any;
|
|
24
|
+
} & Pick<ChatRootProps, 'onEvent'>;
|
|
22
25
|
|
|
23
|
-
export const ChatContainer = ({
|
|
24
|
-
const space = getSpace(chat);
|
|
26
|
+
export const ChatContainer = ({ space: spaceProp, chat, companionTo, onEvent }: ChatContainerProps) => {
|
|
27
|
+
const space = spaceProp ?? getSpace(chat);
|
|
25
28
|
const settings = useCapability(Capabilities.SettingsStore).getStore<Assistant.Settings>(meta.id)?.value;
|
|
26
|
-
const services = useChatServices({ space });
|
|
27
|
-
const
|
|
29
|
+
const services = useChatServices({ space, chat });
|
|
30
|
+
const [online, setOnline] = useOnline();
|
|
31
|
+
const { preset, ...chatProps } = usePresets(online);
|
|
32
|
+
const blueprintRegistry = useBlueprintRegistry();
|
|
33
|
+
const processor = useChatProcessor({
|
|
34
|
+
space,
|
|
35
|
+
chat,
|
|
36
|
+
preset,
|
|
37
|
+
services,
|
|
38
|
+
blueprintRegistry,
|
|
39
|
+
settings,
|
|
40
|
+
});
|
|
41
|
+
|
|
28
42
|
if (!processor) {
|
|
29
43
|
return null;
|
|
30
44
|
}
|
|
31
45
|
|
|
32
|
-
// TODO(burdon): Add attention attributes.
|
|
33
46
|
return (
|
|
34
|
-
<StackItem.Content
|
|
35
|
-
<Chat.Root chat={chat} processor={processor}
|
|
36
|
-
<Chat.
|
|
37
|
-
<
|
|
38
|
-
<Chat.
|
|
39
|
-
|
|
47
|
+
<StackItem.Content toolbar>
|
|
48
|
+
<Chat.Root space={space} chat={chat} processor={processor} onEvent={onEvent}>
|
|
49
|
+
<Chat.Toolbar companionTo={companionTo} />
|
|
50
|
+
<Chat.Viewport classNames='container-max-width'>
|
|
51
|
+
<Chat.Thread />
|
|
52
|
+
<div role='none' className='p-4'>
|
|
53
|
+
<Chat.Prompt {...chatProps} outline preset={preset?.id} online={online} onOnlineChange={setOnline} />
|
|
54
|
+
</div>
|
|
55
|
+
</Chat.Viewport>
|
|
40
56
|
</Chat.Root>
|
|
41
57
|
</StackItem.Content>
|
|
42
58
|
);
|
|
@@ -4,16 +4,18 @@
|
|
|
4
4
|
|
|
5
5
|
import React, { useCallback, useState } from 'react';
|
|
6
6
|
|
|
7
|
-
import {
|
|
7
|
+
import { Capabilities } from '@dxos/app-framework';
|
|
8
|
+
import { useCapability } from '@dxos/app-framework/react';
|
|
8
9
|
import { getSpace } from '@dxos/client/echo';
|
|
9
10
|
import { useTranslation } from '@dxos/react-ui';
|
|
10
|
-
import { ChatDialog as
|
|
11
|
+
import { ChatDialog as NaturalChatDialog } from '@dxos/react-ui-chat';
|
|
11
12
|
|
|
12
|
-
import {
|
|
13
|
-
import { useChatProcessor, useChatServices } from '../hooks';
|
|
13
|
+
import { useBlueprintRegistry, useChatProcessor, useChatServices, useOnline, usePresets } from '../hooks';
|
|
14
14
|
import { meta } from '../meta';
|
|
15
15
|
import { type Assistant } from '../types';
|
|
16
16
|
|
|
17
|
+
import { Chat, type ChatRootProps } from './Chat';
|
|
18
|
+
|
|
17
19
|
export type ChatDialogProps = {
|
|
18
20
|
chat?: Assistant.Chat;
|
|
19
21
|
};
|
|
@@ -23,8 +25,17 @@ export const ChatDialog = ({ chat }: ChatDialogProps) => {
|
|
|
23
25
|
|
|
24
26
|
const space = getSpace(chat);
|
|
25
27
|
const settings = useCapability(Capabilities.SettingsStore).getStore<Assistant.Settings>(meta.id)?.value;
|
|
26
|
-
const services = useChatServices({ space });
|
|
27
|
-
const
|
|
28
|
+
const services = useChatServices({ space, chat });
|
|
29
|
+
const [online, setOnline] = useOnline();
|
|
30
|
+
const { preset, ...chatProps } = usePresets(online);
|
|
31
|
+
const blueprintRegistry = useBlueprintRegistry();
|
|
32
|
+
const processor = useChatProcessor({
|
|
33
|
+
chat,
|
|
34
|
+
preset,
|
|
35
|
+
services,
|
|
36
|
+
blueprintRegistry,
|
|
37
|
+
settings,
|
|
38
|
+
});
|
|
28
39
|
|
|
29
40
|
// TODO(burdon): Refocus when open.
|
|
30
41
|
const [open, setOpen] = useState(true);
|
|
@@ -48,15 +59,15 @@ export const ChatDialog = ({ chat }: ChatDialogProps) => {
|
|
|
48
59
|
|
|
49
60
|
return (
|
|
50
61
|
<Chat.Root chat={chat} processor={processor} onEvent={handleEvent}>
|
|
51
|
-
<
|
|
52
|
-
<
|
|
53
|
-
<
|
|
62
|
+
<NaturalChatDialog.Root open={open} expanded={expanded} onOpenChange={setOpen}>
|
|
63
|
+
<NaturalChatDialog.Header title={t('assistant dialog title')} />
|
|
64
|
+
<NaturalChatDialog.Content>
|
|
54
65
|
<Chat.Thread />
|
|
55
|
-
</
|
|
56
|
-
<
|
|
57
|
-
<Chat.Prompt expandable />
|
|
58
|
-
</
|
|
59
|
-
</
|
|
66
|
+
</NaturalChatDialog.Content>
|
|
67
|
+
<NaturalChatDialog.Footer classNames='p-1.5'>
|
|
68
|
+
<Chat.Prompt {...chatProps} preset={preset?.id} online={online} onOnlineChange={setOnline} expandable />
|
|
69
|
+
</NaturalChatDialog.Footer>
|
|
70
|
+
</NaturalChatDialog.Root>
|
|
60
71
|
</Chat.Root>
|
|
61
72
|
);
|
|
62
73
|
};
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
6
|
+
|
|
7
|
+
import { addEventListener } from '@dxos/async';
|
|
8
|
+
import { Flex, ProgressBar, type ProgressBarProps, TextCrawl, useExecutionGraph } from '@dxos/react-ui-components';
|
|
9
|
+
|
|
10
|
+
import { type Assistant } from '../../types';
|
|
11
|
+
|
|
12
|
+
// TODO(burdon): Reset after each session.
|
|
13
|
+
// TODO(burdon): Show after delay.
|
|
14
|
+
// TODO(burdon): Test with errors.
|
|
15
|
+
// TODO(burdon): Filter out empty trace messages.
|
|
16
|
+
|
|
17
|
+
// {
|
|
18
|
+
// "id": "01K3TE3C2VAXETP500QKDHK3C4_block_3",
|
|
19
|
+
// "branch": "main",
|
|
20
|
+
// "parents": [],
|
|
21
|
+
// "icon": "ph--robot--regular",
|
|
22
|
+
// "message": "\n"
|
|
23
|
+
// }
|
|
24
|
+
|
|
25
|
+
export type ChatProgressProps = {
|
|
26
|
+
chat: Assistant.Chat;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export const ChatProgress = ({ chat }: ChatProgressProps) => {
|
|
30
|
+
const { commits } = useExecutionGraph(chat.traceQueue?.target, true);
|
|
31
|
+
const nodes = useMemo(() => commits.map((commit) => ({ id: commit.id, message: commit.message })), [commits]);
|
|
32
|
+
const lines = useMemo(() => commits.map((commit) => commit.message), [commits]);
|
|
33
|
+
|
|
34
|
+
const [index, setIndex] = useState<number | undefined>(undefined);
|
|
35
|
+
const handleSelect = useCallback<NonNullable<ProgressBarProps['onSelect']>>(({ index }) => {
|
|
36
|
+
setIndex((current) => {
|
|
37
|
+
return current === index ? undefined : index;
|
|
38
|
+
});
|
|
39
|
+
}, []);
|
|
40
|
+
|
|
41
|
+
const ref = useRef<HTMLDivElement>(null);
|
|
42
|
+
useEffect(() => {
|
|
43
|
+
if (!ref.current) {
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
return addEventListener(ref.current, 'keydown', (event) => {
|
|
48
|
+
switch (event.key) {
|
|
49
|
+
case 'ArrowLeft': {
|
|
50
|
+
setIndex((current) => (current === undefined || current <= 0 ? 0 : current - 1));
|
|
51
|
+
break;
|
|
52
|
+
}
|
|
53
|
+
case 'ArrowRight': {
|
|
54
|
+
setIndex((current) => (current === undefined || current >= nodes.length ? nodes.length - 1 : current + 1));
|
|
55
|
+
break;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
}, [nodes.length]);
|
|
60
|
+
|
|
61
|
+
return (
|
|
62
|
+
<Flex column tabIndex={0} ref={ref} classNames='outline-none'>
|
|
63
|
+
<ProgressBar nodes={nodes} index={index} onSelect={handleSelect} />
|
|
64
|
+
<TextCrawl classNames='pis-4 text-sm text-description' lines={lines} autoAdvance />
|
|
65
|
+
</Flex>
|
|
66
|
+
);
|
|
67
|
+
};
|
|
@@ -26,40 +26,24 @@ export const ChatActions = ({ classNames, children, microphone, recording, proce
|
|
|
26
26
|
<div className={mx('flex items-center mie-1', classNames)}>
|
|
27
27
|
{children}
|
|
28
28
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
label={t('button cancel processing')}
|
|
38
|
-
onClick={() => onEvent?.({ type: 'cancel' })}
|
|
39
|
-
/>
|
|
40
|
-
)) || (
|
|
41
|
-
<IconButton
|
|
42
|
-
disabled
|
|
43
|
-
classNames='px-1.5'
|
|
44
|
-
variant='ghost'
|
|
45
|
-
size={5}
|
|
46
|
-
icon='ph--arrow-down--regular'
|
|
47
|
-
iconOnly
|
|
48
|
-
label={t('button scroll down')}
|
|
49
|
-
onClick={() => onEvent?.({ type: 'scroll-to-bottom' })}
|
|
50
|
-
/>
|
|
51
|
-
)}
|
|
29
|
+
<IconButton
|
|
30
|
+
disabled={!processing}
|
|
31
|
+
variant='ghost'
|
|
32
|
+
icon='ph--x--regular'
|
|
33
|
+
iconOnly
|
|
34
|
+
label={t('cancel processing button')}
|
|
35
|
+
onClick={() => onEvent?.({ type: 'cancel' })}
|
|
36
|
+
/>
|
|
52
37
|
|
|
53
38
|
{microphone && (
|
|
54
39
|
<IconButton
|
|
55
40
|
disabled={!processing}
|
|
56
|
-
classNames={mx(
|
|
41
|
+
classNames={mx(recording && 'bg-primary-500')}
|
|
57
42
|
variant='ghost'
|
|
58
|
-
size={5}
|
|
59
43
|
icon='ph--microphone--regular'
|
|
60
44
|
iconOnly
|
|
61
45
|
noTooltip
|
|
62
|
-
label={t('button
|
|
46
|
+
label={t('microphone button')}
|
|
63
47
|
onMouseDown={() => onEvent?.({ type: 'record-start' })}
|
|
64
48
|
onMouseUp={() => onEvent?.({ type: 'record-stop' })}
|
|
65
49
|
onTouchStart={() => onEvent?.({ type: 'record-start' })}
|
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import React, { type JSX, useMemo, useState } from 'react';
|
|
6
|
+
|
|
7
|
+
import { type AiContextBinder } from '@dxos/assistant';
|
|
8
|
+
import { type Blueprint } from '@dxos/blueprints';
|
|
9
|
+
import { Filter, Obj, Type } from '@dxos/echo';
|
|
10
|
+
import { type Space, useQuery } from '@dxos/react-client/echo';
|
|
11
|
+
import { Icon, IconButton, Popover, Select, useTranslation } from '@dxos/react-ui';
|
|
12
|
+
import { Listbox, SearchList } from '@dxos/react-ui-searchlist';
|
|
13
|
+
import { Tabs } from '@dxos/react-ui-tabs';
|
|
14
|
+
|
|
15
|
+
import { useActiveBlueprints, useBlueprintHandlers, useBlueprints, useContextObjects, useItemTypes } from '../../hooks';
|
|
16
|
+
import { meta } from '../../meta';
|
|
17
|
+
|
|
18
|
+
const panelClassNames = 'is-[calc(100dvw-.5rem)] sm:is-max md:is-72 max-is-[--text-content]';
|
|
19
|
+
|
|
20
|
+
export type ChatOptionsProps = {
|
|
21
|
+
space: Space;
|
|
22
|
+
context: AiContextBinder;
|
|
23
|
+
blueprintRegistry?: Blueprint.Registry;
|
|
24
|
+
presets?: { id: string; label: string }[];
|
|
25
|
+
preset?: string;
|
|
26
|
+
onPresetChange?: (id: string) => void;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Manages the runtime context for the chat.
|
|
31
|
+
*/
|
|
32
|
+
export const ChatOptions = ({
|
|
33
|
+
space,
|
|
34
|
+
context,
|
|
35
|
+
blueprintRegistry,
|
|
36
|
+
presets,
|
|
37
|
+
preset,
|
|
38
|
+
onPresetChange,
|
|
39
|
+
}: ChatOptionsProps) => {
|
|
40
|
+
const { t } = useTranslation(meta.id);
|
|
41
|
+
|
|
42
|
+
return (
|
|
43
|
+
<div role='none' className='flex p-2'>
|
|
44
|
+
<Popover.Root>
|
|
45
|
+
<Popover.Trigger asChild>
|
|
46
|
+
<IconButton variant='ghost' icon='ph--plus--regular' iconOnly label={t('context objects button')} />
|
|
47
|
+
</Popover.Trigger>
|
|
48
|
+
<Popover.Portal>
|
|
49
|
+
<Popover.Content side='top' classNames={panelClassNames}>
|
|
50
|
+
<Popover.Viewport>
|
|
51
|
+
<ObjectsPanel space={space} context={context} />
|
|
52
|
+
</Popover.Viewport>
|
|
53
|
+
<Popover.Arrow />
|
|
54
|
+
</Popover.Content>
|
|
55
|
+
</Popover.Portal>
|
|
56
|
+
</Popover.Root>
|
|
57
|
+
|
|
58
|
+
<Popover.Root>
|
|
59
|
+
<Popover.Trigger asChild>
|
|
60
|
+
<IconButton
|
|
61
|
+
variant='ghost'
|
|
62
|
+
icon='ph--sliders-horizontal--regular'
|
|
63
|
+
iconOnly
|
|
64
|
+
label={t('context settings button')}
|
|
65
|
+
/>
|
|
66
|
+
</Popover.Trigger>
|
|
67
|
+
<Popover.Portal>
|
|
68
|
+
<Popover.Content side='top' classNames={panelClassNames}>
|
|
69
|
+
<Popover.Viewport>
|
|
70
|
+
<Tabs.Root orientation='horizontal' defaultValue='blueprints' defaultActivePart='list' tabIndex={-1}>
|
|
71
|
+
<Tabs.Viewport classNames='max-bs-[--radix-popover-content-available-height] grid grid-rows-[1fr_min-content] [&_[cmdk-root]]:contents [&_[role="tabpanel"]]:grid [&_[role="tabpanel"]]:grid-rows-[1fr_min-content] [&_[role="listbox"]]:min-bs-0 [&_[role="listbox"]]:overflow-y-auto [&_[role="tabpanel"]]:min-bs-0 [&_[role="tabpanel"]]:pli-cardSpacingChrome [&_[role="tabpanel"][data-state="active"]]:order-first [&_[role="tabpanel"][data-state="inactive"]]:hidden'>
|
|
72
|
+
<Tabs.Tabpanel value='blueprints' tabIndex={-1} classNames='dx-focus-ring-inset'>
|
|
73
|
+
<BlueprintsPanel blueprintRegistry={blueprintRegistry} space={space} context={context} />
|
|
74
|
+
</Tabs.Tabpanel>
|
|
75
|
+
<Tabs.Tabpanel value='model' tabIndex={-1} classNames='dx-focus-ring-inset !pli-0'>
|
|
76
|
+
<ModelsPanel presets={presets} preset={preset} onPresetChange={onPresetChange} />
|
|
77
|
+
</Tabs.Tabpanel>
|
|
78
|
+
<Tabs.Tablist classNames='sm:overflow-x-hidden justify-center p-[--dx-cardSpacingChrome] border-bs border-subduedSeparator order-last'>
|
|
79
|
+
<Tabs.IconTab
|
|
80
|
+
value='blueprints'
|
|
81
|
+
icon='ph--blueprint--regular'
|
|
82
|
+
label={t('blueprints in context title')}
|
|
83
|
+
/>
|
|
84
|
+
<Tabs.IconTab value='model' label={t('chat model title')} icon='ph--cpu--regular' />
|
|
85
|
+
</Tabs.Tablist>
|
|
86
|
+
</Tabs.Viewport>
|
|
87
|
+
</Tabs.Root>
|
|
88
|
+
</Popover.Viewport>
|
|
89
|
+
<Popover.Arrow />
|
|
90
|
+
</Popover.Content>
|
|
91
|
+
</Popover.Portal>
|
|
92
|
+
</Popover.Root>
|
|
93
|
+
</div>
|
|
94
|
+
);
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
const BlueprintsPanel = ({
|
|
98
|
+
blueprintRegistry,
|
|
99
|
+
space,
|
|
100
|
+
context,
|
|
101
|
+
}: Pick<ChatOptionsProps, 'blueprintRegistry' | 'space' | 'context'>) => {
|
|
102
|
+
const { t } = useTranslation(meta.id);
|
|
103
|
+
|
|
104
|
+
const blueprints = useBlueprints({ blueprintRegistry, space });
|
|
105
|
+
const activeBlueprints = useActiveBlueprints({ context });
|
|
106
|
+
const { onUpdateBlueprint } = useBlueprintHandlers({ space, context, blueprintRegistry });
|
|
107
|
+
|
|
108
|
+
return (
|
|
109
|
+
<SearchList.Root>
|
|
110
|
+
<SearchList.Content classNames='plb-cardSpacingChrome'>
|
|
111
|
+
{blueprints.map((blueprint) => {
|
|
112
|
+
const isActive = activeBlueprints.has(blueprint.key);
|
|
113
|
+
return (
|
|
114
|
+
<SearchList.Item
|
|
115
|
+
classNames='flex items-center overflow-hidden'
|
|
116
|
+
key={blueprint.key}
|
|
117
|
+
value={blueprint.name}
|
|
118
|
+
onSelect={() => onUpdateBlueprint?.(blueprint.key, !isActive)}
|
|
119
|
+
>
|
|
120
|
+
<div className='grow truncate'>{blueprint.name}</div>
|
|
121
|
+
<Icon icon='ph--check--regular' classNames={[!isActive && 'invisible']} />
|
|
122
|
+
</SearchList.Item>
|
|
123
|
+
);
|
|
124
|
+
})}
|
|
125
|
+
</SearchList.Content>
|
|
126
|
+
<SearchList.Input placeholder={t('search placeholder')} classNames='mbe-cardSpacingChrome' autoFocus />
|
|
127
|
+
</SearchList.Root>
|
|
128
|
+
);
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
const ModelsPanel = ({
|
|
132
|
+
presets,
|
|
133
|
+
preset,
|
|
134
|
+
onPresetChange,
|
|
135
|
+
}: Pick<ChatOptionsProps, 'presets' | 'preset' | 'onPresetChange'>) => {
|
|
136
|
+
return (
|
|
137
|
+
<Listbox.Root value={preset} onValueChange={onPresetChange} autoFocus>
|
|
138
|
+
{presets?.map(({ id, label }) => {
|
|
139
|
+
return (
|
|
140
|
+
<Listbox.Option key={id} value={id}>
|
|
141
|
+
<Listbox.OptionLabel>{label}</Listbox.OptionLabel>
|
|
142
|
+
<Listbox.OptionIndicator />
|
|
143
|
+
</Listbox.Option>
|
|
144
|
+
);
|
|
145
|
+
})}
|
|
146
|
+
</Listbox.Root>
|
|
147
|
+
);
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
const ANY = '__any__';
|
|
151
|
+
|
|
152
|
+
const ObjectsPanel = ({ space, context }: Pick<ChatOptionsProps, 'space' | 'context'>): JSX.Element => {
|
|
153
|
+
const { t } = useTranslation(meta.id);
|
|
154
|
+
|
|
155
|
+
// Item types sorted by label.
|
|
156
|
+
const types = useItemTypes(space);
|
|
157
|
+
const typenames = useMemo(() => {
|
|
158
|
+
const typenames = types.map((type) => {
|
|
159
|
+
const typename = Type.getTypename(type);
|
|
160
|
+
return {
|
|
161
|
+
typename,
|
|
162
|
+
label: t('typename label', { ns: typename, defaultValue: typename }),
|
|
163
|
+
};
|
|
164
|
+
});
|
|
165
|
+
|
|
166
|
+
typenames.sort((a, b) => a.label.localeCompare(b.label));
|
|
167
|
+
return typenames;
|
|
168
|
+
}, [types]);
|
|
169
|
+
|
|
170
|
+
// Current type and filter.
|
|
171
|
+
const [typename, setTypename] = useState<string>(ANY);
|
|
172
|
+
const anyFilter = useMemo(
|
|
173
|
+
() => Filter.or(...typenames.map(({ typename }) => Filter.typename(typename))),
|
|
174
|
+
[typenames],
|
|
175
|
+
);
|
|
176
|
+
|
|
177
|
+
// Context objects.
|
|
178
|
+
const objects = useQuery(space, typename === ANY ? anyFilter : Filter.typename(typename));
|
|
179
|
+
const { objects: contextObjects, onUpdateObject } = useContextObjects({ space, context });
|
|
180
|
+
|
|
181
|
+
return (
|
|
182
|
+
<SearchList.Root>
|
|
183
|
+
<SearchList.Content classNames='p-cardSpacingChrome [&:has([cmdk-list-sizer]:empty)]:plb-0'>
|
|
184
|
+
{objects.length ? (
|
|
185
|
+
objects.map((object) => {
|
|
186
|
+
const label = Obj.getLabel(object) ?? Obj.getTypename(object) ?? object.id;
|
|
187
|
+
const isActive = contextObjects.findIndex((obj) => obj.id === object.id) !== -1;
|
|
188
|
+
return (
|
|
189
|
+
<SearchList.Item
|
|
190
|
+
classNames='flex items-center overflow-hidden'
|
|
191
|
+
key={object.id}
|
|
192
|
+
value={object.id}
|
|
193
|
+
onSelect={() => onUpdateObject?.(Obj.getDXN(object), !isActive)}
|
|
194
|
+
>
|
|
195
|
+
<div className='grow truncate'>{label}</div>
|
|
196
|
+
<Icon icon='ph--check--regular' classNames={[!isActive && 'invisible']} />
|
|
197
|
+
</SearchList.Item>
|
|
198
|
+
);
|
|
199
|
+
})
|
|
200
|
+
) : (
|
|
201
|
+
<SearchList.Item>{t('no results')}</SearchList.Item>
|
|
202
|
+
)}
|
|
203
|
+
</SearchList.Content>
|
|
204
|
+
|
|
205
|
+
<div role='none' className='grid grid-cols-[min-content_1fr] gap-2 pli-cardSpacingChrome mbe-cardSpacingChrome'>
|
|
206
|
+
<Select.Root value={typename === ANY ? undefined : typename} onValueChange={setTypename}>
|
|
207
|
+
<Select.TriggerButton density='fine' placeholder={t('type filter placeholder')} />
|
|
208
|
+
<Select.Portal>
|
|
209
|
+
<Select.Content>
|
|
210
|
+
<Select.ScrollUpButton />
|
|
211
|
+
<Select.Viewport>
|
|
212
|
+
<Select.Option value={ANY}>{t('any type filter label')}</Select.Option>
|
|
213
|
+
{typenames.map(({ typename, label }) => (
|
|
214
|
+
<Select.Option key={typename} value={typename}>
|
|
215
|
+
{label}
|
|
216
|
+
</Select.Option>
|
|
217
|
+
))}
|
|
218
|
+
</Select.Viewport>
|
|
219
|
+
<Select.ScrollDownButton />
|
|
220
|
+
<Select.Arrow />
|
|
221
|
+
</Select.Content>
|
|
222
|
+
</Select.Portal>
|
|
223
|
+
</Select.Root>
|
|
224
|
+
<SearchList.Input placeholder={t('search placeholder')} classNames='mbe-0' autoFocus />
|
|
225
|
+
</div>
|
|
226
|
+
</SearchList.Root>
|
|
227
|
+
);
|
|
228
|
+
};
|