@dxos/plugin-assistant 0.8.4-main.5acf9ea → 0.8.4-main.66e292d
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-BWSLH6LG.mjs +36 -0
- package/dist/lib/browser/BlueprintArticle-BWSLH6LG.mjs.map +7 -0
- package/dist/lib/browser/ChatCompanion-OSZZZSWV.mjs +158 -0
- package/dist/lib/browser/ChatCompanion-OSZZZSWV.mjs.map +7 -0
- package/dist/lib/browser/ChatContainer-2W6FNSJD.mjs +77 -0
- package/dist/lib/browser/ChatContainer-2W6FNSJD.mjs.map +7 -0
- package/dist/lib/browser/{ChatDialog-ZVLXFHEY.mjs → ChatDialog-XQ3KDYWE.mjs} +30 -12
- package/dist/lib/browser/ChatDialog-XQ3KDYWE.mjs.map +7 -0
- package/dist/lib/browser/PromptArticle-Q7JYGFQV.mjs +59 -0
- package/dist/lib/browser/PromptArticle-Q7JYGFQV.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-LM6GVHQO.mjs +199 -0
- package/dist/lib/browser/app-graph-builder-LM6GVHQO.mjs.map +7 -0
- package/dist/lib/browser/blueprint-definition-VBEOXNBS.mjs +12 -0
- package/dist/lib/browser/blueprint-definition-VBEOXNBS.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-5JZRYQZL.mjs +229 -0
- package/dist/lib/browser/chunk-5JZRYQZL.mjs.map +7 -0
- package/dist/lib/browser/chunk-7ZJIXQ2Y.mjs +335 -0
- package/dist/lib/browser/chunk-7ZJIXQ2Y.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-NC2QNMBF.mjs +176 -0
- package/dist/lib/browser/chunk-NC2QNMBF.mjs.map +7 -0
- package/dist/lib/browser/chunk-PWSTPQUY.mjs +1929 -0
- package/dist/lib/browser/chunk-PWSTPQUY.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 +221 -107
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/intent-resolver-EEYS2GJF.mjs +143 -0
- package/dist/lib/browser/intent-resolver-EEYS2GJF.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-ECKZNDSU.mjs +98 -0
- package/dist/lib/browser/react-surface-ECKZNDSU.mjs.map +7 -0
- package/dist/lib/browser/repair-3MZXLUHO.mjs +44 -0
- package/dist/lib/browser/repair-3MZXLUHO.mjs.map +7 -0
- package/dist/lib/browser/{settings-5GTTCVGD.mjs → settings-HD5WA24I.mjs} +8 -7
- package/dist/lib/{node-esm/settings-J2EXEM5H.mjs.map → browser/settings-HD5WA24I.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-R2XYBRCK.mjs +37 -0
- package/dist/lib/node-esm/BlueprintArticle-R2XYBRCK.mjs.map +7 -0
- package/dist/lib/node-esm/ChatCompanion-IUMU7WRQ.mjs +159 -0
- package/dist/lib/node-esm/ChatCompanion-IUMU7WRQ.mjs.map +7 -0
- package/dist/lib/node-esm/{ChatContainer-W3W6FWV3.mjs → ChatContainer-CTUNUEU3.mjs} +38 -15
- package/dist/lib/node-esm/ChatContainer-CTUNUEU3.mjs.map +7 -0
- package/dist/lib/node-esm/{ChatDialog-QW4JRKVO.mjs → ChatDialog-X42ASXQD.mjs} +30 -12
- package/dist/lib/node-esm/ChatDialog-X42ASXQD.mjs.map +7 -0
- package/dist/lib/node-esm/PromptArticle-IV7O5UZ3.mjs +60 -0
- package/dist/lib/node-esm/PromptArticle-IV7O5UZ3.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-6XUAGTRS.mjs +200 -0
- package/dist/lib/node-esm/app-graph-builder-6XUAGTRS.mjs.map +7 -0
- package/dist/lib/node-esm/blueprint-definition-RDCLLIQH.mjs +13 -0
- package/dist/lib/node-esm/blueprint-definition-RDCLLIQH.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-25GMMNY5.mjs +178 -0
- package/dist/lib/node-esm/chunk-25GMMNY5.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-CKW4IYLY.mjs +336 -0
- package/dist/lib/node-esm/chunk-CKW4IYLY.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-E4JSYCWZ.mjs +230 -0
- package/dist/lib/node-esm/chunk-E4JSYCWZ.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-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/chunk-Z37USO4K.mjs +1930 -0
- package/dist/lib/node-esm/chunk-Z37USO4K.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 +221 -107
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/intent-resolver-4SRYLDK5.mjs +144 -0
- package/dist/lib/node-esm/intent-resolver-4SRYLDK5.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-NLIG5VAI.mjs +99 -0
- package/dist/lib/node-esm/react-surface-NLIG5VAI.mjs.map +7 -0
- package/dist/lib/node-esm/repair-RER5H7Y6.mjs +45 -0
- package/dist/lib/node-esm/repair-RER5H7Y6.mjs.map +7 -0
- package/dist/lib/node-esm/{settings-J2EXEM5H.mjs → settings-YJQVKHH5.mjs} +8 -7
- package/dist/lib/{browser/settings-5GTTCVGD.mjs.map → node-esm/settings-YJQVKHH5.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 +12 -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/repair.d.ts +4 -0
- package/dist/types/src/capabilities/repair.d.ts.map +1 -0
- 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 +196 -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 +317 -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 +314 -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 +318 -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/useFilteredTypes.d.ts +4 -0
- package/dist/types/src/hooks/useFilteredTypes.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/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 +262 -28
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/Assistant.d.ts +45 -0
- package/dist/types/src/types/Assistant.d.ts.map +1 -0
- package/dist/types/src/types/AssistantAction.d.ts +129 -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 +135 -85
- 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 +151 -111
- 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 +10 -0
- package/src/capabilities/intent-resolver.ts +89 -26
- package/src/capabilities/local-model-resolver.ts +30 -0
- package/src/capabilities/react-surface.tsx +24 -75
- package/src/capabilities/repair.ts +49 -0
- 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 +234 -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 +30 -54
- 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/useFilteredTypes.ts +38 -0
- package/src/hooks/useFlush.ts +35 -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 +49 -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,52 +2,47 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import React
|
|
5
|
+
import React from 'react';
|
|
6
6
|
|
|
7
|
-
import { type
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import { type ThemedClassName,
|
|
11
|
-
import { TagPicker, type TagPickerItemData, type TagPickerOptions } from '@dxos/react-ui-tag-picker';
|
|
7
|
+
import { type AiContextBinder } from '@dxos/assistant';
|
|
8
|
+
import { Obj } from '@dxos/echo';
|
|
9
|
+
import { type Space } from '@dxos/react-client/echo';
|
|
10
|
+
import { IconButton, type Label, type ThemedClassName, toLocalizedString, useTranslation } from '@dxos/react-ui';
|
|
12
11
|
import { mx } from '@dxos/react-ui-theme';
|
|
13
|
-
import { isNonNullable } from '@dxos/util';
|
|
14
12
|
|
|
13
|
+
import { useContextObjects } from '../../hooks';
|
|
15
14
|
import { meta } from '../../meta';
|
|
16
15
|
|
|
17
16
|
export type ChatReferencesProps = ThemedClassName<{
|
|
17
|
+
context: AiContextBinder;
|
|
18
18
|
space: Space;
|
|
19
|
-
context: ContextBinder;
|
|
20
|
-
onUpdate?: (ids: string[]) => void;
|
|
21
19
|
}>;
|
|
22
20
|
|
|
23
|
-
export const ChatReferences = ({ classNames,
|
|
24
|
-
const { t
|
|
25
|
-
|
|
26
|
-
const [items] = useAsyncState<TagPickerItemData[]>(async () => {
|
|
27
|
-
const objects = await Ref.Array.loadAll(context.objects.value ?? []);
|
|
28
|
-
return objects.filter(isNonNullable).map((obj) => ({ id: obj.id, label: Obj.getLabel(obj) ?? obj.id }));
|
|
29
|
-
}, [context]);
|
|
30
|
-
|
|
31
|
-
const handleSearch = useCallback<NonNullable<TagPickerOptions['onSearch']>>(
|
|
32
|
-
(text, ids) => {
|
|
33
|
-
// TODO(burdon): Filter by Item tag (e.g., exclude "contacts") and Query by object label.
|
|
34
|
-
// TODO(burdon): Change to Filter.text().
|
|
35
|
-
const objects = space.db.query(Filter.everything()).runSync();
|
|
36
|
-
return objects
|
|
37
|
-
.map(({ object }) => ({ id: object.id, label: Obj.getLabel(object) ?? '' }))
|
|
38
|
-
.filter(({ id, label }) => !ids.includes(id) && label.toLocaleLowerCase().includes(text.toLocaleLowerCase()));
|
|
39
|
-
},
|
|
40
|
-
[space],
|
|
41
|
-
);
|
|
21
|
+
export const ChatReferences = ({ classNames, context, space }: ChatReferencesProps) => {
|
|
22
|
+
const { t } = useTranslation(meta.id);
|
|
23
|
+
const { objects, onUpdateObject } = useContextObjects({ space, context });
|
|
42
24
|
|
|
43
25
|
return (
|
|
44
|
-
<
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
26
|
+
<ul className={mx('flex', classNames)}>
|
|
27
|
+
{objects.map((obj) => {
|
|
28
|
+
const dxn = Obj.getDXN(obj);
|
|
29
|
+
const typename = Obj.getTypename(obj);
|
|
30
|
+
const label: Label = Obj.getLabel(obj) ?? (typename ? ['object name placeholder', { ns: typename }] : obj.id);
|
|
31
|
+
return (
|
|
32
|
+
<li key={dxn.toString()} className='dx-tag plb-0 pis-2 flex items-center' data-hue='neutral'>
|
|
33
|
+
{toLocalizedString(label, t)}
|
|
34
|
+
<IconButton
|
|
35
|
+
icon='ph--x--bold'
|
|
36
|
+
iconOnly
|
|
37
|
+
variant='ghost'
|
|
38
|
+
label={t('remove object in context label')}
|
|
39
|
+
classNames='p-0 hover:bg-transparent'
|
|
40
|
+
size={3}
|
|
41
|
+
onClick={() => onUpdateObject?.(dxn, false)}
|
|
42
|
+
/>
|
|
43
|
+
</li>
|
|
44
|
+
);
|
|
45
|
+
})}
|
|
46
|
+
</ul>
|
|
52
47
|
);
|
|
53
48
|
};
|
|
@@ -4,36 +4,39 @@
|
|
|
4
4
|
|
|
5
5
|
import React, { useEffect, useState } from 'react';
|
|
6
6
|
|
|
7
|
-
import {
|
|
8
|
-
import { Spinner } from '@dxos/react-ui-sfx';
|
|
9
|
-
import {
|
|
7
|
+
import { type ThemedClassName, Tooltip, useTimeout } from '@dxos/react-ui';
|
|
8
|
+
import { Spinner, type SpinnerProps } from '@dxos/react-ui-sfx';
|
|
9
|
+
import { mx } from '@dxos/react-ui-theme';
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
11
|
+
const period = 3_000;
|
|
12
|
+
|
|
13
|
+
export type ChatStatusIndicatorProps = ThemedClassName<
|
|
14
|
+
{
|
|
15
|
+
preset?: string;
|
|
16
|
+
processing?: boolean;
|
|
17
|
+
error?: Error;
|
|
18
|
+
} & Pick<SpinnerProps, 'size' | 'onClick'>
|
|
19
|
+
>;
|
|
16
20
|
|
|
17
|
-
export const ChatStatusIndicator = ({ preset, error,
|
|
21
|
+
export const ChatStatusIndicator = ({ classNames, preset, processing, error, ...props }: ChatStatusIndicatorProps) => {
|
|
18
22
|
const [init, setInit] = useState(false);
|
|
19
|
-
useEffect(() =>
|
|
20
|
-
setInit(false);
|
|
21
|
-
}, [preset]);
|
|
23
|
+
useEffect(() => setInit(false), [preset]);
|
|
22
24
|
useTimeout(
|
|
23
25
|
async () => {
|
|
24
26
|
setInit(true);
|
|
25
27
|
},
|
|
26
|
-
|
|
28
|
+
period / 2,
|
|
27
29
|
[preset],
|
|
28
30
|
);
|
|
29
31
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
<
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
32
|
+
return (
|
|
33
|
+
<div role='none' className={mx('relative flex', classNames)}>
|
|
34
|
+
<Spinner duration={period} state={!init ? 'flash' : error ? 'error' : processing ? 'spin' : 'pulse'} {...props} />
|
|
35
|
+
{error && (
|
|
36
|
+
<Tooltip.Trigger asChild content={error.message}>
|
|
37
|
+
<div className='absolute inset-0' />
|
|
38
|
+
</Tooltip.Trigger>
|
|
39
|
+
)}
|
|
40
|
+
</div>
|
|
41
|
+
);
|
|
39
42
|
};
|
|
@@ -2,142 +2,147 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import '@
|
|
5
|
+
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
6
|
+
import * as Effect from 'effect/Effect';
|
|
7
|
+
import * as Fiber from 'effect/Fiber';
|
|
8
|
+
import * as Layer from 'effect/Layer';
|
|
9
|
+
import React, { type CSSProperties, useEffect, useMemo, useState } from 'react';
|
|
6
10
|
|
|
7
|
-
import {
|
|
8
|
-
import React, { useEffect, useState } from 'react';
|
|
9
|
-
|
|
10
|
-
import { Obj } from '@dxos/echo';
|
|
11
|
+
import { ContextQueueService, DatabaseService } from '@dxos/functions';
|
|
11
12
|
import { faker } from '@dxos/random';
|
|
13
|
+
import { useQueue, useSpace } from '@dxos/react-client/echo';
|
|
12
14
|
import { withClientProvider } from '@dxos/react-client/testing';
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
|
|
16
|
-
import {
|
|
15
|
+
import { Popover } from '@dxos/react-ui';
|
|
16
|
+
import { withLayout, withTheme } from '@dxos/react-ui/testing';
|
|
17
|
+
import { MarkdownStream } from '@dxos/react-ui-components';
|
|
18
|
+
import { EditorPreviewProvider, useEditorPreview } from '@dxos/react-ui-editor';
|
|
19
|
+
import { Card } from '@dxos/react-ui-stack';
|
|
20
|
+
import { render } from '@dxos/storybook-utils';
|
|
21
|
+
import { type Message, Organization, Person } from '@dxos/types';
|
|
22
|
+
|
|
23
|
+
import { createMessageGenerator } from '../../testing';
|
|
17
24
|
import { translations } from '../../translations';
|
|
18
25
|
|
|
26
|
+
import { ChatThread, type ChatThreadProps } from './ChatThread';
|
|
27
|
+
import { componentRegistry } from './registry';
|
|
28
|
+
import TEXT from './testing/thread.md?raw';
|
|
29
|
+
|
|
19
30
|
faker.seed(1);
|
|
20
31
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
32
|
+
type MessageGenerator = Effect.Effect<void, never, DatabaseService | ContextQueueService>;
|
|
33
|
+
|
|
34
|
+
type StoryProps = { generator?: MessageGenerator[]; delay?: number; wait?: boolean } & ChatThreadProps;
|
|
35
|
+
|
|
36
|
+
const DefaultStory = ({ generator = [], delay = 0, wait, ...props }: StoryProps) => {
|
|
37
|
+
const space = useSpace();
|
|
38
|
+
const queueDxn = useMemo(() => space?.queues.create().dxn, [space]);
|
|
39
|
+
const queue = useQueue<Message.Message>(queueDxn);
|
|
40
|
+
const [done, setDone] = useState(false);
|
|
41
|
+
|
|
42
|
+
// Generate messages.
|
|
43
|
+
useEffect(() => {
|
|
44
|
+
if (!space || !queue) {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const fiber = Effect.runFork(
|
|
49
|
+
Effect.gen(function* () {
|
|
50
|
+
for (const step of generator) {
|
|
51
|
+
yield* step;
|
|
52
|
+
if (delay) {
|
|
53
|
+
yield* Effect.sleep(delay);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
setDone(true);
|
|
57
|
+
}).pipe(Effect.provide(Layer.mergeAll(DatabaseService.layer(space.db), ContextQueueService.layer(queue)))),
|
|
58
|
+
);
|
|
59
|
+
|
|
60
|
+
return () => {
|
|
61
|
+
void Effect.runPromise(Fiber.interrupt(fiber));
|
|
62
|
+
};
|
|
63
|
+
}, [space, queue, generator]);
|
|
64
|
+
|
|
65
|
+
if (wait && !done) {
|
|
66
|
+
return null;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
return (
|
|
70
|
+
<EditorPreviewProvider onLookup={async ({ label, ref }) => ({ label, text: ref })}>
|
|
71
|
+
<ChatThread {...props} messages={queue?.objects} />
|
|
72
|
+
<PreviewCard />
|
|
73
|
+
</EditorPreviewProvider>
|
|
74
|
+
);
|
|
27
75
|
};
|
|
28
76
|
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
_tag: 'text',
|
|
47
|
-
text: Array.from({ length: faker.number.int({ min: 2, max: 5 }) })
|
|
48
|
-
.map(() => faker.lorem.paragraphs())
|
|
49
|
-
.join('\n\n'),
|
|
50
|
-
},
|
|
51
|
-
{
|
|
52
|
-
_tag: 'toolCall',
|
|
53
|
-
toolCallId: '1234',
|
|
54
|
-
name: 'search',
|
|
55
|
-
input: {},
|
|
56
|
-
} satisfies ContentBlock.ToolCall,
|
|
57
|
-
]),
|
|
58
|
-
|
|
59
|
-
createMessage('user', [
|
|
60
|
-
{
|
|
61
|
-
_tag: 'toolResult',
|
|
62
|
-
toolCallId: '1234',
|
|
63
|
-
name: 'search',
|
|
64
|
-
result: 'This is a tool result.',
|
|
65
|
-
} satisfies ContentBlock.ToolResult,
|
|
66
|
-
]),
|
|
67
|
-
|
|
68
|
-
createMessage('assistant', [
|
|
69
|
-
{
|
|
70
|
-
_tag: 'toolCall',
|
|
71
|
-
toolCallId: '4567',
|
|
72
|
-
name: 'create',
|
|
73
|
-
input: {},
|
|
74
|
-
} satisfies ContentBlock.ToolCall,
|
|
75
|
-
]),
|
|
76
|
-
|
|
77
|
-
createMessage('user', [
|
|
78
|
-
{
|
|
79
|
-
_tag: 'toolResult',
|
|
80
|
-
toolCallId: '4567',
|
|
81
|
-
name: 'create',
|
|
82
|
-
result: 'This is a tool result.',
|
|
83
|
-
} satisfies ContentBlock.ToolResult,
|
|
84
|
-
]),
|
|
85
|
-
|
|
86
|
-
createMessage('assistant', [
|
|
87
|
-
{
|
|
88
|
-
_tag: 'text',
|
|
89
|
-
text: faker.lorem.paragraphs(1),
|
|
90
|
-
} satisfies ContentBlock.Text,
|
|
91
|
-
]),
|
|
92
|
-
|
|
93
|
-
createMessage('assistant', [
|
|
94
|
-
{
|
|
95
|
-
_tag: 'json',
|
|
96
|
-
disposition: 'suggest',
|
|
97
|
-
data: JSON.stringify({ text: 'Search...' }),
|
|
98
|
-
},
|
|
99
|
-
{
|
|
100
|
-
_tag: 'json',
|
|
101
|
-
disposition: 'suggest',
|
|
102
|
-
data: JSON.stringify({ text: faker.lorem.paragraphs(1) }),
|
|
103
|
-
} satisfies ContentBlock.Json,
|
|
104
|
-
]),
|
|
105
|
-
];
|
|
77
|
+
const PreviewCard = () => {
|
|
78
|
+
const { target } = useEditorPreview('PreviewCard');
|
|
79
|
+
|
|
80
|
+
return (
|
|
81
|
+
<Popover.Portal>
|
|
82
|
+
<Popover.Content onOpenAutoFocus={(event) => event.preventDefault()}>
|
|
83
|
+
<Popover.Viewport>
|
|
84
|
+
<Card.SurfaceRoot role='card--popover'>
|
|
85
|
+
<Card.Heading>{target?.label}</Card.Heading>
|
|
86
|
+
{target && <Card.Text classNames='truncate line-clamp-3'>{target.text}</Card.Text>}
|
|
87
|
+
</Card.SurfaceRoot>
|
|
88
|
+
</Popover.Viewport>
|
|
89
|
+
<Popover.Arrow />
|
|
90
|
+
</Popover.Content>
|
|
91
|
+
</Popover.Portal>
|
|
92
|
+
);
|
|
93
|
+
};
|
|
106
94
|
|
|
107
95
|
const meta = {
|
|
108
96
|
title: 'plugins/plugin-assistant/ChatThread',
|
|
109
97
|
component: ChatThread,
|
|
110
|
-
|
|
98
|
+
render: render(DefaultStory),
|
|
99
|
+
decorators: [
|
|
100
|
+
withTheme,
|
|
101
|
+
withLayout({ container: 'column' }),
|
|
102
|
+
withClientProvider({
|
|
103
|
+
createIdentity: true,
|
|
104
|
+
createSpace: true,
|
|
105
|
+
types: [Organization.Organization, Person.Person],
|
|
106
|
+
}),
|
|
107
|
+
],
|
|
111
108
|
parameters: {
|
|
109
|
+
layout: 'fullscreen',
|
|
112
110
|
translations,
|
|
113
111
|
},
|
|
114
|
-
} satisfies Meta<
|
|
112
|
+
} satisfies Meta<StoryProps>;
|
|
115
113
|
|
|
116
114
|
export default meta;
|
|
117
115
|
|
|
118
|
-
type Story = StoryObj<
|
|
116
|
+
type Story = StoryObj<StoryProps>;
|
|
119
117
|
|
|
120
|
-
export const Default = {
|
|
118
|
+
export const Default: Story = {
|
|
121
119
|
args: {
|
|
122
|
-
|
|
120
|
+
generator: createMessageGenerator(),
|
|
121
|
+
wait: true,
|
|
123
122
|
},
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
export const Incremental = {
|
|
127
|
-
render: () => {
|
|
128
|
-
const [messages, setMessages] = useState<DataType.Message[]>([]);
|
|
129
|
-
useEffect(() => {
|
|
130
|
-
let i = 0;
|
|
131
|
-
const interval = setInterval(() => {
|
|
132
|
-
setMessages((messages) => [...messages, TEST_MESSAGES[i++]]);
|
|
133
|
-
if (i >= TEST_MESSAGES.length) {
|
|
134
|
-
clearInterval(interval);
|
|
135
|
-
}
|
|
136
|
-
}, 2_000);
|
|
137
|
-
|
|
138
|
-
return () => clearInterval(interval);
|
|
139
|
-
}, []);
|
|
123
|
+
};
|
|
140
124
|
|
|
141
|
-
|
|
125
|
+
export const Delayed: Story = {
|
|
126
|
+
args: {
|
|
127
|
+
generator: createMessageGenerator(),
|
|
128
|
+
delay: 1_000,
|
|
129
|
+
fadeIn: true,
|
|
130
|
+
cursor: false,
|
|
142
131
|
},
|
|
143
|
-
}
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
export const Raw: Story = {
|
|
135
|
+
render: () => (
|
|
136
|
+
<div className='contents' style={{ '--user-fill': 'var(--dx-amberFill)' } as CSSProperties}>
|
|
137
|
+
<MarkdownStream content={TEXT} />
|
|
138
|
+
</div>
|
|
139
|
+
),
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
export const Static: Story = {
|
|
143
|
+
render: () => (
|
|
144
|
+
<div className='contents' style={{ '--user-fill': 'var(--dx-amberFill)' } as CSSProperties}>
|
|
145
|
+
<MarkdownStream content={TEXT} registry={componentRegistry} />
|
|
146
|
+
</div>
|
|
147
|
+
),
|
|
148
|
+
};
|
|
@@ -2,56 +2,86 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import React, { type CSSProperties, forwardRef, useMemo } from 'react';
|
|
5
|
+
import React, { type CSSProperties, forwardRef, useCallback, useEffect, useMemo } from 'react';
|
|
6
6
|
|
|
7
7
|
import { PublicKey } from '@dxos/keys';
|
|
8
8
|
import { type Identity } from '@dxos/react-client/halo';
|
|
9
|
-
import { type ThemedClassName } from '@dxos/react-ui';
|
|
10
|
-
import {
|
|
9
|
+
import { type ThemedClassName, useForwardedRef } from '@dxos/react-ui';
|
|
10
|
+
import { MarkdownStream, type MarkdownStreamController, type MarkdownStreamProps } from '@dxos/react-ui-components';
|
|
11
11
|
import { mx } from '@dxos/react-ui-theme';
|
|
12
|
-
import { type
|
|
12
|
+
import { type Message } from '@dxos/types';
|
|
13
13
|
import { keyToFallback } from '@dxos/util';
|
|
14
14
|
|
|
15
|
-
import {
|
|
16
|
-
|
|
15
|
+
import { type ChatEvent } from '../Chat';
|
|
16
|
+
|
|
17
|
+
import { blockToMarkdown, componentRegistry } from './registry';
|
|
18
|
+
import { MessageSyncer } from './sync';
|
|
17
19
|
|
|
18
20
|
export type ChatThreadProps = ThemedClassName<
|
|
19
21
|
{
|
|
20
22
|
identity?: Identity;
|
|
21
|
-
messages?:
|
|
22
|
-
|
|
23
|
-
|
|
23
|
+
messages?: Message.Message[];
|
|
24
|
+
error?: Error;
|
|
25
|
+
onEvent?: (event: ChatEvent) => void;
|
|
26
|
+
} & Pick<MarkdownStreamProps, 'cursor' | 'fadeIn' | 'debug'>
|
|
24
27
|
>;
|
|
25
28
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
29
|
+
// TODO(burdon): Memo thread position.
|
|
30
|
+
export const ChatThread = forwardRef<MarkdownStreamController, ChatThreadProps>(
|
|
31
|
+
(
|
|
32
|
+
{ classNames, identity, messages = [], error, cursor = false, fadeIn = true, debug = false, onEvent },
|
|
33
|
+
forwardedRef,
|
|
34
|
+
) => {
|
|
35
|
+
const controllerRef = useForwardedRef(forwardedRef);
|
|
36
|
+
const controller = controllerRef.current;
|
|
37
|
+
|
|
38
|
+
const userHue = useMemo(
|
|
39
|
+
() => identity?.profile?.data?.hue || keyToFallback(identity?.identityKey ?? PublicKey.random()).hue,
|
|
40
|
+
[identity],
|
|
41
|
+
);
|
|
42
|
+
|
|
43
|
+
// Show error.
|
|
44
|
+
useEffect(() => {
|
|
45
|
+
controller?.scrollToBottom();
|
|
46
|
+
}, [controller, error]);
|
|
47
|
+
|
|
48
|
+
// Update document.
|
|
49
|
+
const syncer = useMemo(() => controller && new MessageSyncer(controller, blockToMarkdown), [controller]);
|
|
50
|
+
useEffect(() => {
|
|
51
|
+
const reset = syncer?.append(messages, true);
|
|
52
|
+
if (reset) {
|
|
53
|
+
controller?.scrollToBottom('instant');
|
|
40
54
|
}
|
|
41
|
-
}, [
|
|
55
|
+
}, [syncer, messages]);
|
|
56
|
+
|
|
57
|
+
// Event adapter.
|
|
58
|
+
const handleEvent = useCallback<NonNullable<MarkdownStreamProps['onEvent']>>(
|
|
59
|
+
({ type, value }) => {
|
|
60
|
+
switch (type) {
|
|
61
|
+
case 'submit': {
|
|
62
|
+
value && onEvent?.({ type, text: value });
|
|
63
|
+
break;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
[onEvent],
|
|
68
|
+
);
|
|
42
69
|
|
|
43
70
|
return (
|
|
44
|
-
<
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
{
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
71
|
+
<div
|
|
72
|
+
role='none'
|
|
73
|
+
className={mx('flex bs-full is-full justify-center overflow-hidden', classNames)}
|
|
74
|
+
style={{ '--user-fill': `var(--dx-${userHue}Fill)` } as CSSProperties}
|
|
75
|
+
>
|
|
76
|
+
<MarkdownStream
|
|
77
|
+
ref={controllerRef}
|
|
78
|
+
registry={componentRegistry}
|
|
79
|
+
cursor={cursor}
|
|
80
|
+
fadeIn={fadeIn}
|
|
81
|
+
debug={debug}
|
|
82
|
+
onEvent={handleEvent}
|
|
83
|
+
/>
|
|
84
|
+
</div>
|
|
55
85
|
);
|
|
56
86
|
},
|
|
57
87
|
);
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import React, { useMemo } from 'react';
|
|
6
|
+
|
|
7
|
+
import { type Space } from '@dxos/client/echo';
|
|
8
|
+
import { Obj } from '@dxos/echo';
|
|
9
|
+
import { type DXN } from '@dxos/keys';
|
|
10
|
+
import { DxAnchor } from '@dxos/lit-ui/react';
|
|
11
|
+
|
|
12
|
+
export type ObjectLinkProps = {
|
|
13
|
+
space: Space;
|
|
14
|
+
dxn: DXN;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export const ObjectLink = ({ space, dxn }: ObjectLinkProps) => {
|
|
18
|
+
const ref = useMemo(() => space.db.makeRef(dxn), [space, dxn.toString()]);
|
|
19
|
+
|
|
20
|
+
const title = (ref.target && Obj.getLabel(ref.target)) ?? ref.target?.id ?? ref.dxn.toString();
|
|
21
|
+
return (
|
|
22
|
+
<DxAnchor rootclassname='dx-tag--anchor' refid={dxn.toString()}>
|
|
23
|
+
{title}
|
|
24
|
+
</DxAnchor>
|
|
25
|
+
);
|
|
26
|
+
};
|