@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
|
@@ -2,142 +2,73 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
5
|
+
import { RegistryContext } from '@effect-atom/atom-react';
|
|
6
|
+
import type * as Runtime from 'effect/Runtime';
|
|
7
|
+
import { useContext, useMemo, useState } from 'react';
|
|
7
8
|
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import { Conversation, createSystemPrompt } from '@dxos/assistant';
|
|
11
|
-
import { type ArtifactDefinition, type AssociatedArtifact, type Blueprint } from '@dxos/blueprints';
|
|
12
|
-
import { FunctionType } from '@dxos/functions';
|
|
9
|
+
import { AiConversation } from '@dxos/assistant';
|
|
10
|
+
import { type Blueprint } from '@dxos/blueprints';
|
|
13
11
|
import { log } from '@dxos/log';
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import { isNonNullable } from '@dxos/util';
|
|
12
|
+
import { type Queue, type Space } from '@dxos/react-client/echo';
|
|
13
|
+
import { useAsyncEffect } from '@dxos/react-ui';
|
|
17
14
|
|
|
18
|
-
import { type
|
|
19
|
-
import {
|
|
20
|
-
import { type Assistant, ServiceType } from '../types';
|
|
15
|
+
import { AiChatProcessor, type AiChatServices, type AiServicePreset } from '../processor';
|
|
16
|
+
import { type Assistant } from '../types';
|
|
21
17
|
|
|
22
|
-
type UseChatProcessorProps = {
|
|
23
|
-
preset?: AiServicePreset;
|
|
18
|
+
export type UseChatProcessorProps = {
|
|
24
19
|
space?: Space;
|
|
25
20
|
chat?: Assistant.Chat;
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
services?: Layer.Layer<ChatServices>;
|
|
21
|
+
preset?: AiServicePreset;
|
|
22
|
+
services?: () => Promise<Runtime.Runtime<AiChatServices>>;
|
|
29
23
|
blueprintRegistry?: Blueprint.Registry;
|
|
30
|
-
// TODO(burdon): Not currently used.
|
|
31
24
|
settings?: Assistant.Settings;
|
|
32
|
-
|
|
33
|
-
/** @deprecated */
|
|
34
|
-
instructions?: string;
|
|
35
|
-
/** @deprecated */
|
|
36
|
-
artifact?: AssociatedArtifact;
|
|
37
|
-
/** @deprecated */
|
|
38
|
-
noPluginArtifacts?: boolean;
|
|
39
25
|
};
|
|
40
26
|
|
|
41
27
|
/**
|
|
42
|
-
* Configure and create
|
|
28
|
+
* Configure and create AiChatProcessor.
|
|
43
29
|
*/
|
|
44
30
|
export const useChatProcessor = ({
|
|
45
|
-
preset,
|
|
46
31
|
space,
|
|
47
32
|
chat,
|
|
33
|
+
preset,
|
|
48
34
|
services,
|
|
49
35
|
blueprintRegistry,
|
|
50
36
|
settings,
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
noPluginArtifacts,
|
|
54
|
-
}: UseChatProcessorProps): ChatProcessor | undefined => {
|
|
55
|
-
const { dispatchPromise: dispatch } = useIntentDispatcher();
|
|
56
|
-
const globalTools = useCapabilities(Capabilities.Tools);
|
|
37
|
+
}: UseChatProcessorProps): AiChatProcessor | undefined => {
|
|
38
|
+
const observableRegistry = useContext(RegistryContext);
|
|
57
39
|
|
|
58
|
-
//
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
// Services.
|
|
65
|
-
const remoteServices = useQuery(space, Filter.type(ServiceType));
|
|
66
|
-
const [serviceTools, setServiceTools] = useState<ExecutableTool[]>([]);
|
|
67
|
-
useEffect(() => {
|
|
68
|
-
log('creating service tools...');
|
|
69
|
-
queueMicrotask(async () => {
|
|
70
|
-
const tools = await Promise.all(remoteServices.map((service) => createToolsFromService(service)));
|
|
71
|
-
setServiceTools(tools.flat());
|
|
72
|
-
});
|
|
73
|
-
}, [remoteServices]);
|
|
74
|
-
|
|
75
|
-
// Tools and context.
|
|
76
|
-
const config = useConfig();
|
|
77
|
-
const functions = useQuery(space, Filter.type(FunctionType));
|
|
78
|
-
const chatId = useMemo(() => (chat ? fullyQualifiedId(chat) : undefined), [chat]);
|
|
79
|
-
const [tools, extensions] = useMemo(() => {
|
|
80
|
-
log('creating tools...');
|
|
81
|
-
const tools: ExecutableTool[] = [
|
|
82
|
-
...globalTools.flat(),
|
|
83
|
-
...serviceTools,
|
|
84
|
-
...functions
|
|
85
|
-
.map((fn) => convertFunctionToTool(fn, config.values.runtime?.services?.edge?.url ?? '', space?.id))
|
|
86
|
-
.filter(isNonNullable),
|
|
87
|
-
];
|
|
88
|
-
const extensions = { space, dispatch, pivotId: chatId };
|
|
89
|
-
return [tools, extensions];
|
|
90
|
-
}, [dispatch, globalTools, space, chatId, serviceTools, functions]);
|
|
91
|
-
|
|
92
|
-
// TODO(burdon): Create from template.
|
|
93
|
-
const systemPrompt = useMemo(
|
|
94
|
-
() =>
|
|
95
|
-
createSystemPrompt({
|
|
96
|
-
artifacts: artifacts.map((definition) => `${definition.name}\n${definition.instructions}`),
|
|
97
|
-
artifact,
|
|
98
|
-
instructions,
|
|
99
|
-
}),
|
|
100
|
-
[artifacts, artifact, instructions],
|
|
101
|
-
);
|
|
102
|
-
|
|
103
|
-
const conversation = useMemo(() => {
|
|
104
|
-
if (!chat?.queue.target) {
|
|
40
|
+
// Create conversation from chat queue.
|
|
41
|
+
const [conversation, setConversation] = useState<AiConversation>();
|
|
42
|
+
useAsyncEffect(async () => {
|
|
43
|
+
if (!space || !chat) {
|
|
105
44
|
return;
|
|
106
45
|
}
|
|
107
46
|
|
|
108
|
-
|
|
109
|
-
|
|
47
|
+
// NOTE: Passing in space and getting queue from space rather than resolving the reference.
|
|
48
|
+
// This is because if the chat isn't in a space yet, the reference will not be resolvable.
|
|
49
|
+
const queue = space.queues.get(chat.queue.dxn);
|
|
50
|
+
const conversation = new AiConversation(queue as Queue<any>);
|
|
51
|
+
await conversation.open();
|
|
52
|
+
setConversation(conversation);
|
|
53
|
+
return () => {
|
|
54
|
+
void conversation.close();
|
|
55
|
+
setConversation(undefined);
|
|
56
|
+
};
|
|
57
|
+
}, [space, chat?.queue.dxn.toString()]);
|
|
110
58
|
|
|
111
59
|
// Create processor.
|
|
112
|
-
// TODO(burdon): Updated on each query update above; should just update current processor?
|
|
113
60
|
const processor = useMemo(() => {
|
|
114
61
|
if (!services || !conversation) {
|
|
115
62
|
return undefined;
|
|
116
63
|
}
|
|
117
64
|
|
|
118
|
-
log
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
systemPrompt: systemPrompt.length,
|
|
122
|
-
model: preset?.model,
|
|
123
|
-
settings,
|
|
124
|
-
});
|
|
125
|
-
|
|
126
|
-
return new ChatProcessor(services, conversation, {
|
|
127
|
-
tools,
|
|
128
|
-
extensions,
|
|
65
|
+
log('creating processor', { preset, model: preset?.model, settings });
|
|
66
|
+
return new AiChatProcessor(conversation, services, {
|
|
67
|
+
observableRegistry,
|
|
129
68
|
blueprintRegistry,
|
|
130
|
-
artifacts,
|
|
131
|
-
systemPrompt,
|
|
132
69
|
model: preset?.model,
|
|
133
70
|
});
|
|
134
|
-
}, [services, conversation,
|
|
71
|
+
}, [services, conversation, blueprintRegistry, preset]);
|
|
135
72
|
|
|
136
73
|
return processor;
|
|
137
74
|
};
|
|
138
|
-
|
|
139
|
-
// TODO(dmaretskyi): Extract.
|
|
140
|
-
export const Stable = Object.freeze({
|
|
141
|
-
array: [] as readonly never[],
|
|
142
|
-
object: {} as {},
|
|
143
|
-
});
|
|
@@ -2,66 +2,50 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
|
+
import type * as Runtime from 'effect/Runtime';
|
|
6
7
|
import { useMemo } from 'react';
|
|
7
|
-
import { useDeepCompareMemoize } from 'use-deep-compare-effect';
|
|
8
8
|
|
|
9
|
-
import {
|
|
10
|
-
import { Capabilities, useCapabilities } from '@dxos/app-framework';
|
|
11
|
-
import { makeToolExecutionServiceFromFunctions, makeToolResolverFromFunctions } from '@dxos/assistant';
|
|
9
|
+
import { useCapability } from '@dxos/app-framework/react';
|
|
12
10
|
import { type Space } from '@dxos/client/echo';
|
|
13
|
-
import {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
LocalFunctionExecutionService,
|
|
18
|
-
QueueService,
|
|
19
|
-
RemoteFunctionExecutionService,
|
|
20
|
-
TracingService,
|
|
21
|
-
} from '@dxos/functions';
|
|
11
|
+
import { TracingService } from '@dxos/functions';
|
|
12
|
+
import { TracingServiceExt } from '@dxos/functions-runtime';
|
|
13
|
+
import { AutomationCapabilities } from '@dxos/plugin-automation';
|
|
14
|
+
import { useClient } from '@dxos/react-client';
|
|
22
15
|
|
|
23
|
-
import {
|
|
24
|
-
|
|
25
|
-
export * from '@dxos/assistant';
|
|
26
|
-
|
|
27
|
-
// TODO(burdon): Deconstruct into separate layers?
|
|
28
|
-
export type ChatServices =
|
|
29
|
-
| AiService
|
|
30
|
-
| CredentialsService
|
|
31
|
-
| DatabaseService
|
|
32
|
-
| QueueService
|
|
33
|
-
| RemoteFunctionExecutionService
|
|
34
|
-
| ToolResolverService
|
|
35
|
-
| ToolExecutionService
|
|
36
|
-
| TracingService;
|
|
16
|
+
import { type AiChatServices } from '../processor';
|
|
17
|
+
import { type Assistant } from '../types';
|
|
37
18
|
|
|
38
19
|
export type UseChatServicesProps = {
|
|
39
20
|
space?: Space;
|
|
21
|
+
chat?: Assistant.Chat;
|
|
40
22
|
};
|
|
41
23
|
|
|
42
24
|
/**
|
|
43
25
|
* Construct service layer.
|
|
44
26
|
*/
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
27
|
+
// TODO(dmaretskyi): Better return type.
|
|
28
|
+
export const useChatServices = ({
|
|
29
|
+
space,
|
|
30
|
+
chat,
|
|
31
|
+
}: UseChatServicesProps): (() => Promise<Runtime.Runtime<AiChatServices>>) | undefined => {
|
|
32
|
+
const client = useClient();
|
|
33
|
+
space ??= client.spaces.default;
|
|
34
|
+
|
|
35
|
+
const runtimeResolver = useCapability(AutomationCapabilities.ComputeRuntime);
|
|
50
36
|
return useMemo(() => {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
);
|
|
66
|
-
}, [space, useDeepCompareMemoize(functions.map((f) => f.name))]);
|
|
37
|
+
const runtime = runtimeResolver.getRuntime(space.id);
|
|
38
|
+
return () =>
|
|
39
|
+
runtime.runPromise(
|
|
40
|
+
Effect.gen(function* () {
|
|
41
|
+
return yield* Effect.runtime<AiChatServices>().pipe(
|
|
42
|
+
Effect.provide(
|
|
43
|
+
chat?.traceQueue?.target
|
|
44
|
+
? TracingServiceExt.layerQueue(chat.traceQueue?.target)
|
|
45
|
+
: TracingService.layerNoop,
|
|
46
|
+
),
|
|
47
|
+
);
|
|
48
|
+
}),
|
|
49
|
+
);
|
|
50
|
+
}, [space, chat?.traceQueue?.target]);
|
|
67
51
|
};
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { Atom } from '@effect-atom/atom-react';
|
|
6
|
+
import * as Effect from 'effect/Effect';
|
|
7
|
+
import { useMemo } from 'react';
|
|
8
|
+
|
|
9
|
+
import { createIntent } from '@dxos/app-framework';
|
|
10
|
+
import { useIntentDispatcher } from '@dxos/app-framework/react';
|
|
11
|
+
import { Filter, Obj, Query } from '@dxos/echo';
|
|
12
|
+
import { invariant } from '@dxos/invariant';
|
|
13
|
+
import { useQuery } from '@dxos/react-client/echo';
|
|
14
|
+
import { MenuBuilder, useMenuActions } from '@dxos/react-ui-menu';
|
|
15
|
+
|
|
16
|
+
import { useChatContext } from '../components';
|
|
17
|
+
import { meta } from '../meta';
|
|
18
|
+
import { Assistant, AssistantAction } from '../types';
|
|
19
|
+
|
|
20
|
+
export type ChatToolbarActionsProps = {
|
|
21
|
+
chat?: Assistant.Chat;
|
|
22
|
+
companionTo?: Obj.Any;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export const useChatToolbarActions = ({ chat, companionTo }: ChatToolbarActionsProps) => {
|
|
26
|
+
const { dispatch } = useIntentDispatcher();
|
|
27
|
+
const { space } = useChatContext('useChatToolbarActions');
|
|
28
|
+
const query = companionTo
|
|
29
|
+
? Query.select(Filter.ids(companionTo.id)).targetOf(Assistant.CompanionTo).source()
|
|
30
|
+
: Query.select(Filter.nothing());
|
|
31
|
+
|
|
32
|
+
// TODO(wittjosiah): Query in react vs query in atom?
|
|
33
|
+
const chats = useQuery(space, query);
|
|
34
|
+
|
|
35
|
+
// Create stable reference for dependency array to avoid circular reference issues.
|
|
36
|
+
return useMenuActions(
|
|
37
|
+
useMemo(() => {
|
|
38
|
+
return Atom.make(() => {
|
|
39
|
+
const builder = MenuBuilder.make()
|
|
40
|
+
.root({
|
|
41
|
+
label: ['chat toolbar title', { ns: meta.id }],
|
|
42
|
+
})
|
|
43
|
+
.action(
|
|
44
|
+
'new',
|
|
45
|
+
{
|
|
46
|
+
label: ['new thread button', { ns: meta.id }],
|
|
47
|
+
icon: 'ph--plus--regular',
|
|
48
|
+
type: 'new',
|
|
49
|
+
},
|
|
50
|
+
() =>
|
|
51
|
+
dispatch(
|
|
52
|
+
createIntent(AssistantAction.SetCurrentChat, {
|
|
53
|
+
companionTo,
|
|
54
|
+
chat: undefined,
|
|
55
|
+
}),
|
|
56
|
+
).pipe(Effect.runPromise),
|
|
57
|
+
)
|
|
58
|
+
.action(
|
|
59
|
+
'rename',
|
|
60
|
+
{
|
|
61
|
+
label: ['rename thread button', { ns: meta.id }],
|
|
62
|
+
icon: 'ph--magic-wand--regular',
|
|
63
|
+
type: 'rename',
|
|
64
|
+
disabled: !chat,
|
|
65
|
+
},
|
|
66
|
+
() =>
|
|
67
|
+
Effect.gen(function* () {
|
|
68
|
+
invariant(chat);
|
|
69
|
+
yield* dispatch(createIntent(AssistantAction.UpdateChatName, { chat }));
|
|
70
|
+
}).pipe(Effect.runPromise),
|
|
71
|
+
)
|
|
72
|
+
.action(
|
|
73
|
+
'branch',
|
|
74
|
+
{
|
|
75
|
+
label: ['button branch thread', { ns: meta.id }],
|
|
76
|
+
icon: 'ph--git-branch--regular',
|
|
77
|
+
type: 'branch',
|
|
78
|
+
disabled: true,
|
|
79
|
+
},
|
|
80
|
+
() => {},
|
|
81
|
+
);
|
|
82
|
+
|
|
83
|
+
if (chats.length > 0) {
|
|
84
|
+
builder.group(
|
|
85
|
+
'chats',
|
|
86
|
+
{
|
|
87
|
+
label: ['chat history label', { ns: meta.id }],
|
|
88
|
+
icon: 'ph--clock-counter-clockwise--regular',
|
|
89
|
+
selectCardinality: 'single',
|
|
90
|
+
variant: 'dropdownMenu',
|
|
91
|
+
},
|
|
92
|
+
(builder) => {
|
|
93
|
+
chats
|
|
94
|
+
// TODO(wittjosiah): This should be the default sort order.
|
|
95
|
+
.toSorted((a, b) => a.id.localeCompare(b.id))
|
|
96
|
+
.forEach((chat) => {
|
|
97
|
+
builder.action(
|
|
98
|
+
chat.id,
|
|
99
|
+
{
|
|
100
|
+
label: Obj.getLabel(chat) ?? ['object name placeholder', { ns: Assistant.Chat.typename }],
|
|
101
|
+
},
|
|
102
|
+
() =>
|
|
103
|
+
Effect.gen(function* () {
|
|
104
|
+
invariant(companionTo);
|
|
105
|
+
yield* dispatch(
|
|
106
|
+
createIntent(AssistantAction.SetCurrentChat, {
|
|
107
|
+
companionTo,
|
|
108
|
+
chat,
|
|
109
|
+
}),
|
|
110
|
+
);
|
|
111
|
+
}).pipe(Effect.runPromise),
|
|
112
|
+
);
|
|
113
|
+
});
|
|
114
|
+
},
|
|
115
|
+
);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
return builder.build();
|
|
119
|
+
});
|
|
120
|
+
}, [chats.length, space?.id, companionTo?.id, chat?.id, dispatch]),
|
|
121
|
+
);
|
|
122
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { useState } from 'react';
|
|
6
|
+
|
|
7
|
+
import { AiContextBinder } from '@dxos/assistant';
|
|
8
|
+
import { type Queue } from '@dxos/react-client/echo';
|
|
9
|
+
import { useAsyncEffect } from '@dxos/react-ui';
|
|
10
|
+
|
|
11
|
+
// NOTE: This takes a queue rather than a chat because the chat may not be in a space yet.
|
|
12
|
+
export const useContextBinder = (queue: Queue | undefined): AiContextBinder | undefined => {
|
|
13
|
+
const [binder, setBinder] = useState<AiContextBinder>();
|
|
14
|
+
|
|
15
|
+
useAsyncEffect(async () => {
|
|
16
|
+
if (!queue) {
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const binder = new AiContextBinder(queue);
|
|
21
|
+
await binder.open();
|
|
22
|
+
setBinder(binder);
|
|
23
|
+
|
|
24
|
+
return () => {
|
|
25
|
+
void binder.close();
|
|
26
|
+
};
|
|
27
|
+
}, [queue]);
|
|
28
|
+
|
|
29
|
+
return binder;
|
|
30
|
+
};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { useCallback } from 'react';
|
|
6
|
+
|
|
7
|
+
import { type AiContextBinder } from '@dxos/assistant';
|
|
8
|
+
import { type DXN, type Obj, Ref } from '@dxos/echo';
|
|
9
|
+
import { log } from '@dxos/log';
|
|
10
|
+
import { type Space } from '@dxos/react-client/echo';
|
|
11
|
+
import { isNonNullable } from '@dxos/util';
|
|
12
|
+
|
|
13
|
+
export type UseContextObjects = {
|
|
14
|
+
objects: Obj.Any[];
|
|
15
|
+
onUpdateObject: (dxn: DXN, checked: boolean) => Promise<void>;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Create reactive map of active object references (by DXN string).
|
|
20
|
+
*/
|
|
21
|
+
export const useContextObjects = ({
|
|
22
|
+
space,
|
|
23
|
+
context,
|
|
24
|
+
}: {
|
|
25
|
+
space?: Space;
|
|
26
|
+
context?: AiContextBinder;
|
|
27
|
+
}): UseContextObjects => {
|
|
28
|
+
const objects = context?.objects.value.map((ref) => ref.target).filter(isNonNullable) ?? [];
|
|
29
|
+
|
|
30
|
+
const handleUpdateObject = useCallback<UseContextObjects['onUpdateObject']>(
|
|
31
|
+
async (dxn: DXN, checked: boolean) => {
|
|
32
|
+
if (!space || !context) {
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// Load the object by DXN/id from the current space.
|
|
37
|
+
const id = dxn.asEchoDXN();
|
|
38
|
+
const object = id && (await space.db.getObjectById(id.echoId));
|
|
39
|
+
if (!object) {
|
|
40
|
+
log.warn('Object not found', { dxn, id });
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const ref = Ref.fromDXN(dxn);
|
|
45
|
+
if (checked) {
|
|
46
|
+
await context.bind({ objects: [ref] });
|
|
47
|
+
} else {
|
|
48
|
+
await context.unbind({ objects: [ref] });
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
[space, context],
|
|
52
|
+
);
|
|
53
|
+
|
|
54
|
+
return {
|
|
55
|
+
objects,
|
|
56
|
+
onUpdateObject: handleUpdateObject,
|
|
57
|
+
};
|
|
58
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { useCallback, useRef, useState } from 'react';
|
|
6
|
+
|
|
7
|
+
import { type Space } from '@dxos/client/echo';
|
|
8
|
+
|
|
9
|
+
export const useFlush = (space?: Space) => {
|
|
10
|
+
const [state, setState] = useState<'idle' | 'flushing' | 'flushed'>('idle');
|
|
11
|
+
const resetTimer = useRef<NodeJS.Timeout | null>(null);
|
|
12
|
+
|
|
13
|
+
const handleFlush = useCallback(() => {
|
|
14
|
+
if (!space) {
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
queueMicrotask(async () => {
|
|
19
|
+
if (resetTimer.current) {
|
|
20
|
+
clearTimeout(resetTimer.current);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
setState('flushing');
|
|
24
|
+
await space.db.flush();
|
|
25
|
+
setState('flushed');
|
|
26
|
+
|
|
27
|
+
resetTimer.current = setTimeout(() => {
|
|
28
|
+
setState('idle');
|
|
29
|
+
resetTimer.current = null;
|
|
30
|
+
}, 1_000);
|
|
31
|
+
});
|
|
32
|
+
}, [space]);
|
|
33
|
+
|
|
34
|
+
return { state, handleFlush };
|
|
35
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Option from 'effect/Option';
|
|
6
|
+
import { useEffect, useState } from 'react';
|
|
7
|
+
|
|
8
|
+
import { type Type } from '@dxos/echo';
|
|
9
|
+
import { type Space } from '@dxos/react-client/echo';
|
|
10
|
+
import { ItemAnnotation } from '@dxos/schema';
|
|
11
|
+
|
|
12
|
+
// TODO(burdon): Pass in filter.
|
|
13
|
+
export const useItemTypes = (space?: Space): Type.Obj.Any[] => {
|
|
14
|
+
const [types, setTypes] = useState<Type.Obj.Any[]>([]);
|
|
15
|
+
useEffect(() => {
|
|
16
|
+
if (!space) {
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
return space.db.schemaRegistry.query().subscribe(
|
|
21
|
+
(query) => {
|
|
22
|
+
const types = Array.from(
|
|
23
|
+
new Set(
|
|
24
|
+
[...space.db.graph.schemaRegistry.schemas, ...query.results].filter((type) =>
|
|
25
|
+
Option.isSome(ItemAnnotation.get(type)),
|
|
26
|
+
),
|
|
27
|
+
),
|
|
28
|
+
);
|
|
29
|
+
|
|
30
|
+
setTypes(types);
|
|
31
|
+
},
|
|
32
|
+
{ fire: true },
|
|
33
|
+
);
|
|
34
|
+
}, [space]);
|
|
35
|
+
|
|
36
|
+
return types;
|
|
37
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { type Dispatch, type SetStateAction, useState } from 'react';
|
|
6
|
+
|
|
7
|
+
export const useOnline = (): [boolean, Dispatch<SetStateAction<boolean>>] => {
|
|
8
|
+
const [online, setOnline] = useState(true);
|
|
9
|
+
return [online, setOnline];
|
|
10
|
+
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { useCallback, useEffect, useMemo, useState } from 'react';
|
|
6
|
+
|
|
7
|
+
import { type ChatPromptProps } from '../components';
|
|
8
|
+
import { type AiServicePreset, AiServicePresets } from '../processor';
|
|
9
|
+
|
|
10
|
+
export type UsePresets = {
|
|
11
|
+
preset: AiServicePreset | undefined;
|
|
12
|
+
} & Pick<ChatPromptProps, 'presets' | 'onPresetChange'>;
|
|
13
|
+
|
|
14
|
+
export const usePresets = (online: boolean): UsePresets => {
|
|
15
|
+
// TODO(burdon): Memo preset for provider.
|
|
16
|
+
const [preset, setPreset] = useState<AiServicePreset>();
|
|
17
|
+
const presets = useMemo(
|
|
18
|
+
() => AiServicePresets.filter((preset) => online === (preset.provider === 'dxos-remote')),
|
|
19
|
+
[online],
|
|
20
|
+
);
|
|
21
|
+
const presetOptions = useMemo(
|
|
22
|
+
() => presets.map(({ id, model, label }) => ({ id, label: label ?? model })),
|
|
23
|
+
[presets],
|
|
24
|
+
);
|
|
25
|
+
useEffect(() => {
|
|
26
|
+
setPreset(presets[0]);
|
|
27
|
+
}, [presets]);
|
|
28
|
+
|
|
29
|
+
const handlePresetChange = useCallback<NonNullable<ChatPromptProps['onPresetChange']>>(
|
|
30
|
+
(id) => {
|
|
31
|
+
const preset = presets.find((preset) => preset.id === id);
|
|
32
|
+
if (preset) {
|
|
33
|
+
setPreset(preset);
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
[presets],
|
|
37
|
+
);
|
|
38
|
+
|
|
39
|
+
return {
|
|
40
|
+
preset: preset,
|
|
41
|
+
presets: presetOptions,
|
|
42
|
+
onPresetChange: handlePresetChange,
|
|
43
|
+
};
|
|
44
|
+
};
|
|
@@ -4,17 +4,17 @@
|
|
|
4
4
|
|
|
5
5
|
import { useMemo } from 'react';
|
|
6
6
|
|
|
7
|
-
import { Capabilities
|
|
7
|
+
import { Capabilities } from '@dxos/app-framework';
|
|
8
|
+
import { useCapabilities } from '@dxos/app-framework/react';
|
|
8
9
|
import { type Space } from '@dxos/client/echo';
|
|
9
|
-
import { Filter, Obj
|
|
10
|
+
import { Filter, Obj } from '@dxos/echo';
|
|
10
11
|
import { type ReferencesProvider } from '@dxos/react-ui-chat';
|
|
11
12
|
|
|
12
13
|
/**
|
|
13
14
|
* Resolve references to objects in the space.
|
|
14
15
|
*/
|
|
15
16
|
export const useReferencesProvider = (space?: Space): ReferencesProvider | undefined => {
|
|
16
|
-
|
|
17
|
-
const artifactDefinitions = useCapabilities(Capabilities.ArtifactDefinition);
|
|
17
|
+
const blueprints = useCapabilities(Capabilities.BlueprintDefinition);
|
|
18
18
|
|
|
19
19
|
return useMemo<ReferencesProvider | undefined>((): ReferencesProvider | undefined => {
|
|
20
20
|
if (!space) {
|
|
@@ -23,10 +23,13 @@ export const useReferencesProvider = (space?: Space): ReferencesProvider | undef
|
|
|
23
23
|
|
|
24
24
|
return {
|
|
25
25
|
getReferences: async ({ query }) => {
|
|
26
|
-
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
|
|
26
|
+
// TODO(burdon): Previously we filtered by types declared by the artifact definitions.
|
|
27
|
+
// const schemas = blueprints.map((blueprint) => blueprint.schema).flat();
|
|
28
|
+
// const { objects } = await space.db
|
|
29
|
+
// .query(Filter.or(...schemas.map((schema) => Filter.type(schema as Type.Schema))))
|
|
30
|
+
// .run();
|
|
31
|
+
|
|
32
|
+
const { objects } = await space.db.query(Filter.everything()).run();
|
|
30
33
|
|
|
31
34
|
return (
|
|
32
35
|
objects
|
|
@@ -39,7 +42,7 @@ export const useReferencesProvider = (space?: Space): ReferencesProvider | undef
|
|
|
39
42
|
// TODO(dmaretskyi): `Type.getDXN` (at the point of writing) didn't work here as it was schema-only.
|
|
40
43
|
.filter((object) => !!Obj.getDXN(object as Obj.Any))
|
|
41
44
|
.map((object) => ({
|
|
42
|
-
uri: Obj.getDXN(object as any)
|
|
45
|
+
uri: Obj.getDXN(object as any).toString(),
|
|
43
46
|
label: Obj.getLabel(object as any) ?? '',
|
|
44
47
|
}))
|
|
45
48
|
);
|
|
@@ -49,7 +52,7 @@ export const useReferencesProvider = (space?: Space): ReferencesProvider | undef
|
|
|
49
52
|
return { uri, label: Obj.getLabel(object) ?? '' };
|
|
50
53
|
},
|
|
51
54
|
} satisfies ReferencesProvider;
|
|
52
|
-
}, [space,
|
|
55
|
+
}, [space, blueprints]);
|
|
53
56
|
};
|
|
54
57
|
|
|
55
58
|
const stringMatch = (query: string, label: string) => label.toLowerCase().startsWith(query.toLowerCase());
|