@dxos/plugin-assistant 0.8.4-main.dedc0f3 → 0.8.4-main.e8ec1fe
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-G6YHR6GJ.mjs → ChatContainer-XCPBWYIR.mjs} +22 -20
- package/dist/lib/browser/ChatContainer-XCPBWYIR.mjs.map +7 -0
- package/dist/lib/browser/{ChatDialog-HJ7VDRQO.mjs → ChatDialog-DT7KFCRL.mjs} +8 -6
- 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-3C43MLCD.mjs → app-graph-builder-VZEXMDTY.mjs} +67 -21
- package/dist/lib/browser/app-graph-builder-VZEXMDTY.mjs.map +7 -0
- package/dist/lib/browser/{blueprint-definition-VHFSRTEJ.mjs → blueprint-definition-5FT5JGPY.mjs} +4 -4
- package/dist/lib/browser/chunk-2BOE3OTW.mjs +262 -0
- package/dist/lib/browser/chunk-2BOE3OTW.mjs.map +7 -0
- package/dist/lib/browser/{chunk-SMIVXXAI.mjs → chunk-BNTPFZ7O.mjs} +51 -24
- 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-GLWD66TA.mjs → chunk-IXIIS4QA.mjs} +53 -38
- package/dist/lib/browser/chunk-IXIIS4QA.mjs.map +7 -0
- package/dist/lib/browser/{chunk-EZUSNS2J.mjs → chunk-LRE4VEZV.mjs} +2 -5
- 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 +118 -82
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/{intent-resolver-I6M3ZDAS.mjs → intent-resolver-AK5O4GUW.mjs} +55 -24
- 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-WNLA2636.mjs → react-surface-YCSR2MSR.mjs} +24 -35
- package/dist/lib/browser/react-surface-YCSR2MSR.mjs.map +7 -0
- package/dist/lib/browser/{settings-36V3VUMW.mjs → settings-NYJGNQ5I.mjs} +5 -5
- package/dist/lib/browser/{settings-36V3VUMW.mjs.map → settings-NYJGNQ5I.mjs.map} +1 -1
- package/dist/lib/browser/{state-AINRYS5W.mjs → state-GG7Z3NB7.mjs} +9 -5
- package/dist/lib/browser/{state-AINRYS5W.mjs.map → state-GG7Z3NB7.mjs.map} +3 -3
- 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 +2 -2
- 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-EZZF7RSQ.mjs → ChatContainer-K7OGPE3G.mjs} +22 -20
- package/dist/lib/node-esm/ChatContainer-K7OGPE3G.mjs.map +7 -0
- package/dist/lib/node-esm/{ChatDialog-PTQLZNJU.mjs → ChatDialog-QT6ZBX45.mjs} +8 -6
- 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-NM3JDLQ2.mjs → app-graph-builder-VRN6ESRR.mjs} +67 -21
- package/dist/lib/node-esm/app-graph-builder-VRN6ESRR.mjs.map +7 -0
- package/dist/lib/node-esm/{blueprint-definition-4E6XTLVN.mjs → blueprint-definition-XW6QQVLV.mjs} +4 -4
- 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-7YOGZI66.mjs → chunk-AB74FOA2.mjs} +51 -24
- 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-KJGD4EBJ.mjs +336 -0
- package/dist/lib/node-esm/chunk-KJGD4EBJ.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-QG2KT3AT.mjs → chunk-UXTUHH24.mjs} +53 -38
- 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-XD4CDA4R.mjs → chunk-YWFWT57N.mjs} +2 -5
- 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 +118 -82
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/{intent-resolver-VIINHFMT.mjs → intent-resolver-L2F3N45L.mjs} +55 -24
- 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-GP3LU6DX.mjs → react-surface-CTW44GEM.mjs} +24 -35
- package/dist/lib/node-esm/react-surface-CTW44GEM.mjs.map +7 -0
- package/dist/lib/node-esm/{settings-7ZCZ6AS5.mjs → settings-RRHYI5KO.mjs} +5 -5
- package/dist/lib/node-esm/{settings-7ZCZ6AS5.mjs.map → settings-RRHYI5KO.mjs.map} +1 -1
- package/dist/lib/node-esm/{state-EQS5KP6M.mjs → state-FSUHFMDM.mjs} +9 -5
- package/dist/lib/node-esm/{state-EQS5KP6M.mjs.map → state-FSUHFMDM.mjs.map} +3 -3
- 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 +2 -2
- 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 +2 -3
- package/dist/types/src/capabilities/ai-service.d.ts.map +1 -1
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
- package/dist/types/src/capabilities/blueprint-definition.d.ts +1 -1
- package/dist/types/src/capabilities/blueprint-definition.d.ts.map +1 -1
- package/dist/types/src/capabilities/capabilities.d.ts +2 -24
- package/dist/types/src/capabilities/capabilities.d.ts.map +1 -1
- package/dist/types/src/capabilities/edge-model-resolver.d.ts.map +1 -1
- package/dist/types/src/capabilities/index.d.ts +0 -1
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/intent-resolver.d.ts.map +1 -1
- package/dist/types/src/capabilities/local-model-resolver.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
- package/dist/types/src/capabilities/state.d.ts.map +1 -1
- package/dist/types/src/capabilities/toolkit.d.ts +1 -1
- package/dist/types/src/capabilities/toolkit.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 +20 -9
- package/dist/types/src/components/Chat/Chat.d.ts.map +1 -1
- package/dist/types/src/components/Chat/events.d.ts +4 -0
- package/dist/types/src/components/Chat/events.d.ts.map +1 -1
- package/dist/types/src/components/ChatCompanion.d.ts +2 -2
- package/dist/types/src/components/ChatCompanion.d.ts.map +1 -1
- package/dist/types/src/components/ChatContainer.d.ts +7 -4
- 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.map +1 -1
- package/dist/types/src/components/ChatPrompt/ChatActions.d.ts.map +1 -1
- package/dist/types/src/components/ChatPrompt/ChatOptions.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/ChatThread.d.ts +6 -7
- package/dist/types/src/components/ChatThread/ChatThread.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/ChatThread.stories.d.ts +124 -71
- package/dist/types/src/components/ChatThread/ChatThread.stories.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/reducers.d.ts +5 -5
- package/dist/types/src/components/ChatThread/reducers.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/registry.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/sync.d.ts +12 -6
- package/dist/types/src/components/ChatThread/sync.d.ts.map +1 -1
- 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 -1
- package/dist/types/src/components/TemplateEditor/TemplateEditor.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/TemplateEditor.stories.d.ts +111 -61
- 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 +111 -61
- package/dist/types/src/components/TemplateEditor/TemplateForm.stories.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/extensions/handlebars-extension.d.ts.map +1 -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 +9 -7
- package/dist/types/src/components/ToolBlock/ToolBlock.d.ts.map +1 -1
- package/dist/types/src/components/Toolbox/Toolbox.d.ts +2 -2
- package/dist/types/src/components/Toolbox/Toolbox.d.ts.map +1 -1
- package/dist/types/src/components/Toolbox/Toolbox.stories.d.ts +111 -61
- package/dist/types/src/components/Toolbox/Toolbox.stories.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +4 -9
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/functions/analysis.d.ts +1 -1
- package/dist/types/src/functions/analysis.d.ts.map +1 -1
- package/dist/types/src/functions/index.d.ts +2 -2
- package/dist/types/src/functions/index.d.ts.map +1 -1
- package/dist/types/src/functions/{list.d.ts → object-list.d.ts} +2 -2
- package/dist/types/src/functions/object-list.d.ts.map +1 -0
- package/dist/types/src/functions/{load.d.ts → object-load.d.ts} +2 -2
- package/dist/types/src/functions/object-load.d.ts.map +1 -0
- package/dist/types/src/hooks/index.d.ts +1 -2
- package/dist/types/src/hooks/index.d.ts.map +1 -1
- package/dist/types/src/hooks/useBlueprintRegistry.d.ts +2 -1
- package/dist/types/src/hooks/useBlueprintRegistry.d.ts.map +1 -1
- package/dist/types/src/hooks/useChatProcessor.d.ts +4 -2
- package/dist/types/src/hooks/useChatProcessor.d.ts.map +1 -1
- package/dist/types/src/hooks/useChatServices.d.ts +1 -1
- 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 +2 -2
- package/dist/types/src/hooks/useContextBinder.d.ts.map +1 -1
- 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 +1 -0
- package/dist/types/src/processor/index.d.ts.map +1 -1
- package/dist/types/src/processor/presets.d.ts +1 -1
- package/dist/types/src/processor/presets.d.ts.map +1 -1
- package/dist/types/src/processor/processor.d.ts +11 -10
- package/dist/types/src/processor/processor.d.ts.map +1 -1
- 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 +0 -2
- package/dist/types/src/testing/index.d.ts.map +1 -1
- package/dist/types/src/testing/test-generator.d.ts +3 -3
- package/dist/types/src/testing/test-generator.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 +239 -26
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/Assistant.d.ts +15 -9
- package/dist/types/src/types/Assistant.d.ts.map +1 -1
- package/dist/types/src/types/AssistantAction.d.ts +33 -8
- package/dist/types/src/types/AssistantAction.d.ts.map +1 -1
- package/dist/types/src/types/service.d.ts +24 -18
- package/dist/types/src/types/service.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +94 -113
- package/src/AssistantPlugin.tsx +154 -137
- package/src/capabilities/ai-service.ts +6 -7
- package/src/capabilities/app-graph-builder.ts +69 -21
- package/src/capabilities/blueprint-definition.ts +38 -30
- package/src/capabilities/capabilities.ts +2 -56
- package/src/capabilities/edge-model-resolver.ts +5 -7
- package/src/capabilities/index.ts +0 -1
- package/src/capabilities/intent-resolver.ts +69 -16
- package/src/capabilities/local-model-resolver.ts +7 -9
- package/src/capabilities/react-surface.tsx +16 -20
- package/src/capabilities/state.ts +2 -0
- package/src/capabilities/toolkit.ts +9 -155
- package/src/components/BlueprintArticle.tsx +29 -0
- package/src/components/Chat/Chat.tsx +155 -113
- package/src/components/Chat/events.ts +6 -0
- package/src/components/ChatCompanion.tsx +93 -49
- package/src/components/ChatContainer.tsx +27 -17
- package/src/components/ChatDialog.tsx +9 -2
- package/src/components/ChatProgress/ChatProgress.tsx +2 -3
- package/src/components/ChatPrompt/ChatActions.tsx +2 -4
- package/src/components/ChatPrompt/ChatOptions.tsx +40 -45
- package/src/components/ChatPrompt/ChatReferences.tsx +2 -2
- package/src/components/ChatThread/ChatThread.stories.tsx +52 -34
- package/src/components/ChatThread/ChatThread.tsx +28 -34
- package/src/components/ChatThread/reducers.ts +6 -6
- package/src/components/ChatThread/registry.tsx +25 -40
- package/src/components/ChatThread/sync.test.ts +21 -13
- package/src/components/ChatThread/sync.ts +48 -13
- package/src/components/ChatThread/testing/thread.md +37 -0
- package/src/components/PromptArticle.tsx +51 -0
- package/src/components/TemplateEditor/TemplateEditor.stories.tsx +15 -7
- package/src/components/TemplateEditor/TemplateEditor.tsx +19 -10
- package/src/components/TemplateEditor/TemplateForm.stories.tsx +4 -6
- package/src/components/TemplateEditor/TemplateForm.tsx +2 -2
- 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 +37 -46
- package/src/components/Toolbox/Toolbox.stories.tsx +5 -8
- package/src/components/Toolbox/Toolbox.tsx +5 -5
- package/src/components/index.ts +2 -5
- package/src/functions/analysis.ts +5 -3
- package/src/functions/index.ts +2 -2
- package/src/functions/{list.ts → object-list.ts} +6 -4
- package/src/functions/{load.ts → object-load.ts} +8 -5
- package/src/hooks/index.ts +1 -2
- package/src/hooks/useBlueprintRegistry.ts +19 -4
- package/src/hooks/useChatProcessor.ts +22 -14
- package/src/hooks/useChatServices.ts +10 -7
- package/src/hooks/useChatToolbarActions.ts +122 -0
- package/src/hooks/useContextBinder.ts +19 -7
- package/src/hooks/useItemTypes.ts +1 -1
- package/src/hooks/useReferencesProvider.ts +2 -1
- package/src/index.ts +2 -0
- package/src/meta.ts +9 -6
- package/src/processor/index.ts +1 -0
- package/src/processor/presets.ts +2 -2
- package/src/processor/processor.test.ts +18 -24
- package/src/processor/processor.ts +35 -60
- package/src/processor/update-name.ts +56 -0
- package/src/queue-logger.ts +4 -8
- package/src/testing/index.ts +0 -2
- package/src/testing/test-generator.ts +15 -11
- package/src/testing/test-services.ts +2 -8
- package/src/translations.ts +24 -16
- package/src/types/Assistant.ts +10 -8
- package/src/types/AssistantAction.ts +23 -6
- package/src/types/service.ts +17 -9
- package/dist/lib/browser/BlueprintContainer-BFNN6K46.mjs +0 -29
- package/dist/lib/browser/BlueprintContainer-BFNN6K46.mjs.map +0 -7
- package/dist/lib/browser/ChatCompanion-YYYCHZYV.mjs +0 -126
- package/dist/lib/browser/ChatCompanion-YYYCHZYV.mjs.map +0 -7
- package/dist/lib/browser/ChatContainer-G6YHR6GJ.mjs.map +0 -7
- package/dist/lib/browser/ChatDialog-HJ7VDRQO.mjs.map +0 -7
- package/dist/lib/browser/SequenceContainer-TF5QNXYM.mjs +0 -150
- package/dist/lib/browser/SequenceContainer-TF5QNXYM.mjs.map +0 -7
- package/dist/lib/browser/ai-service-YC2EQPHA.mjs +0 -22
- package/dist/lib/browser/ai-service-YC2EQPHA.mjs.map +0 -7
- package/dist/lib/browser/app-graph-builder-3C43MLCD.mjs.map +0 -7
- package/dist/lib/browser/chunk-EZUSNS2J.mjs.map +0 -7
- package/dist/lib/browser/chunk-GLWD66TA.mjs.map +0 -7
- package/dist/lib/browser/chunk-O4LUJEDV.mjs +0 -20
- package/dist/lib/browser/chunk-O4LUJEDV.mjs.map +0 -7
- package/dist/lib/browser/chunk-PL4O4ZJU.mjs +0 -1974
- package/dist/lib/browser/chunk-PL4O4ZJU.mjs.map +0 -7
- package/dist/lib/browser/chunk-PPJAIE2T.mjs +0 -299
- package/dist/lib/browser/chunk-PPJAIE2T.mjs.map +0 -7
- package/dist/lib/browser/chunk-PQI3MGDN.mjs +0 -169
- package/dist/lib/browser/chunk-PQI3MGDN.mjs.map +0 -7
- package/dist/lib/browser/chunk-R6LRGW3I.mjs +0 -216
- package/dist/lib/browser/chunk-R6LRGW3I.mjs.map +0 -7
- package/dist/lib/browser/chunk-SMIVXXAI.mjs.map +0 -7
- package/dist/lib/browser/compute-runtime-X6IREJN3.mjs +0 -155
- package/dist/lib/browser/compute-runtime-X6IREJN3.mjs.map +0 -7
- package/dist/lib/browser/edge-model-resolver-JNEB355N.mjs +0 -22
- package/dist/lib/browser/edge-model-resolver-JNEB355N.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-I6M3ZDAS.mjs.map +0 -7
- package/dist/lib/browser/local-model-resolver-EUXSRZ7X.mjs +0 -21
- package/dist/lib/browser/local-model-resolver-EUXSRZ7X.mjs.map +0 -7
- package/dist/lib/browser/react-surface-WNLA2636.mjs.map +0 -7
- package/dist/lib/browser/toolkit-Y5OYX5PO.mjs +0 -191
- package/dist/lib/browser/toolkit-Y5OYX5PO.mjs.map +0 -7
- package/dist/lib/node-esm/BlueprintContainer-X4MRBKDR.mjs +0 -30
- package/dist/lib/node-esm/BlueprintContainer-X4MRBKDR.mjs.map +0 -7
- package/dist/lib/node-esm/ChatCompanion-PUAFRIEC.mjs +0 -127
- package/dist/lib/node-esm/ChatCompanion-PUAFRIEC.mjs.map +0 -7
- package/dist/lib/node-esm/ChatContainer-EZZF7RSQ.mjs.map +0 -7
- package/dist/lib/node-esm/ChatDialog-PTQLZNJU.mjs.map +0 -7
- package/dist/lib/node-esm/SequenceContainer-UXOVZPZO.mjs +0 -151
- package/dist/lib/node-esm/SequenceContainer-UXOVZPZO.mjs.map +0 -7
- package/dist/lib/node-esm/ai-service-XUMZVFCK.mjs +0 -23
- package/dist/lib/node-esm/ai-service-XUMZVFCK.mjs.map +0 -7
- package/dist/lib/node-esm/app-graph-builder-NM3JDLQ2.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-4WLFSXZG.mjs +0 -170
- package/dist/lib/node-esm/chunk-4WLFSXZG.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-7YOGZI66.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-LVTG5JTW.mjs +0 -217
- package/dist/lib/node-esm/chunk-LVTG5JTW.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-QG2KT3AT.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-VFY2JG62.mjs +0 -22
- package/dist/lib/node-esm/chunk-VFY2JG62.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-VH3LTD76.mjs +0 -300
- package/dist/lib/node-esm/chunk-VH3LTD76.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-XD4CDA4R.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-ZIDP7HBI.mjs +0 -1975
- package/dist/lib/node-esm/chunk-ZIDP7HBI.mjs.map +0 -7
- package/dist/lib/node-esm/compute-runtime-NRHLLTSC.mjs +0 -156
- package/dist/lib/node-esm/compute-runtime-NRHLLTSC.mjs.map +0 -7
- package/dist/lib/node-esm/edge-model-resolver-UE5TLLJZ.mjs +0 -23
- package/dist/lib/node-esm/edge-model-resolver-UE5TLLJZ.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-VIINHFMT.mjs.map +0 -7
- package/dist/lib/node-esm/local-model-resolver-JBEFVVZA.mjs +0 -22
- package/dist/lib/node-esm/local-model-resolver-JBEFVVZA.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-GP3LU6DX.mjs.map +0 -7
- package/dist/lib/node-esm/toolkit-2F2OL6WB.mjs +0 -192
- package/dist/lib/node-esm/toolkit-2F2OL6WB.mjs.map +0 -7
- package/dist/types/src/capabilities/compute-runtime.d.ts +0 -5
- package/dist/types/src/capabilities/compute-runtime.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/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 -267
- 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/components/TemplateEditor/handlebars-extension.d.ts.map +0 -1
- package/dist/types/src/components/Toolbar/Toolbar.d.ts +0 -5
- package/dist/types/src/components/Toolbar/Toolbar.d.ts.map +0 -1
- package/dist/types/src/components/Toolbar/index.d.ts +0 -2
- package/dist/types/src/components/Toolbar/index.d.ts.map +0 -1
- package/dist/types/src/components/Toolbar/useChatToolbarActions.d.ts +0 -11
- package/dist/types/src/components/Toolbar/useChatToolbarActions.d.ts.map +0 -1
- package/dist/types/src/execution-graph/execution-graph.d.ts +0 -21
- package/dist/types/src/execution-graph/execution-graph.d.ts.map +0 -1
- package/dist/types/src/execution-graph/index.d.ts +0 -2
- package/dist/types/src/execution-graph/index.d.ts.map +0 -1
- package/dist/types/src/functions/list.d.ts.map +0 -1
- package/dist/types/src/functions/load.d.ts.map +0 -1
- package/dist/types/src/hooks/useComputeRuntimeCallback.d.ts +0 -8
- package/dist/types/src/hooks/useComputeRuntimeCallback.d.ts.map +0 -1
- package/dist/types/src/hooks/useExecutionGraph.d.ts +0 -6
- package/dist/types/src/hooks/useExecutionGraph.d.ts.map +0 -1
- package/dist/types/src/stories/Chat.stories.d.ts +0 -30
- package/dist/types/src/stories/Chat.stories.d.ts.map +0 -1
- package/dist/types/src/stories/components/BlueprintContainer.d.ts +0 -4
- package/dist/types/src/stories/components/BlueprintContainer.d.ts.map +0 -1
- package/dist/types/src/stories/components/ChatContainer.d.ts +0 -4
- package/dist/types/src/stories/components/ChatContainer.d.ts.map +0 -1
- package/dist/types/src/stories/components/ChessContainer.d.ts +0 -4
- package/dist/types/src/stories/components/ChessContainer.d.ts.map +0 -1
- package/dist/types/src/stories/components/CommentsContainer.d.ts +0 -4
- package/dist/types/src/stories/components/CommentsContainer.d.ts.map +0 -1
- package/dist/types/src/stories/components/DebugCard.d.ts +0 -8
- package/dist/types/src/stories/components/DebugCard.d.ts.map +0 -1
- package/dist/types/src/stories/components/GraphContainer.d.ts +0 -6
- package/dist/types/src/stories/components/GraphContainer.d.ts.map +0 -1
- package/dist/types/src/stories/components/InvocationsContainer.d.ts +0 -4
- package/dist/types/src/stories/components/InvocationsContainer.d.ts.map +0 -1
- package/dist/types/src/stories/components/LoggingContainer.d.ts +0 -7
- package/dist/types/src/stories/components/LoggingContainer.d.ts.map +0 -1
- package/dist/types/src/stories/components/MessageContainer.d.ts +0 -4
- package/dist/types/src/stories/components/MessageContainer.d.ts.map +0 -1
- package/dist/types/src/stories/components/PromptContainer.d.ts +0 -6
- package/dist/types/src/stories/components/PromptContainer.d.ts.map +0 -1
- package/dist/types/src/stories/components/ResearchInputStack.d.ts +0 -4
- package/dist/types/src/stories/components/ResearchInputStack.d.ts.map +0 -1
- package/dist/types/src/stories/components/ResearchOutputStack.d.ts +0 -4
- package/dist/types/src/stories/components/ResearchOutputStack.d.ts.map +0 -1
- package/dist/types/src/stories/components/TasksContainer.d.ts +0 -4
- package/dist/types/src/stories/components/TasksContainer.d.ts.map +0 -1
- package/dist/types/src/stories/components/TokenManagerContainer.d.ts +0 -3
- package/dist/types/src/stories/components/TokenManagerContainer.d.ts.map +0 -1
- package/dist/types/src/stories/components/TriggersContainer.d.ts +0 -14
- package/dist/types/src/stories/components/TriggersContainer.d.ts.map +0 -1
- package/dist/types/src/stories/components/index.d.ts +0 -16
- package/dist/types/src/stories/components/index.d.ts.map +0 -1
- package/dist/types/src/stories/components/types.d.ts +0 -7
- package/dist/types/src/stories/components/types.d.ts.map +0 -1
- package/dist/types/src/stories/testing/data.d.ts +0 -9
- package/dist/types/src/stories/testing/data.d.ts.map +0 -1
- package/dist/types/src/stories/testing/index.d.ts +0 -3
- package/dist/types/src/stories/testing/index.d.ts.map +0 -1
- package/dist/types/src/stories/testing/schema.d.ts +0 -7
- package/dist/types/src/stories/testing/schema.d.ts.map +0 -1
- package/dist/types/src/stories/testing/testing.d.ts +0 -48
- package/dist/types/src/stories/testing/testing.d.ts.map +0 -1
- package/dist/types/src/testing/test-data.d.ts +0 -14
- package/dist/types/src/testing/test-data.d.ts.map +0 -1
- package/dist/types/src/testing/test-functions.d.ts +0 -6
- package/dist/types/src/testing/test-functions.d.ts.map +0 -1
- package/src/capabilities/compute-runtime.ts +0 -124
- package/src/components/BlueprintContainer.tsx +0 -24
- package/src/components/PromptSettings.tsx +0 -90
- package/src/components/SequenceContainer.tsx +0 -131
- package/src/components/SequenceEditor/SequenceEditor.stories.tsx +0 -33
- package/src/components/SequenceEditor/SequenceEditor.tsx +0 -50
- package/src/components/SequenceEditor/index.ts +0 -5
- package/src/components/TemplateEditor/handlebars-extension.ts +0 -165
- package/src/components/Toolbar/Toolbar.tsx +0 -21
- package/src/components/Toolbar/index.ts +0 -5
- package/src/components/Toolbar/useChatToolbarActions.ts +0 -126
- package/src/execution-graph/execution-graph.ts +0 -211
- package/src/execution-graph/index.ts +0 -5
- package/src/hooks/useComputeRuntimeCallback.ts +0 -25
- package/src/hooks/useExecutionGraph.ts +0 -20
- package/src/stories/Chat.stories.tsx +0 -657
- package/src/stories/components/BlueprintContainer.tsx +0 -34
- package/src/stories/components/ChatContainer.tsx +0 -74
- package/src/stories/components/ChessContainer.tsx +0 -17
- package/src/stories/components/CommentsContainer.tsx +0 -25
- package/src/stories/components/DebugCard.tsx +0 -61
- package/src/stories/components/GraphContainer.tsx +0 -119
- package/src/stories/components/InvocationsContainer.tsx +0 -17
- package/src/stories/components/LoggingContainer.tsx +0 -33
- package/src/stories/components/MessageContainer.tsx +0 -22
- package/src/stories/components/PromptContainer.tsx +0 -52
- package/src/stories/components/ResearchInputStack.tsx +0 -30
- package/src/stories/components/ResearchOutputStack.tsx +0 -29
- package/src/stories/components/TasksContainer.tsx +0 -49
- package/src/stories/components/TokenManagerContainer.tsx +0 -14
- package/src/stories/components/TriggersContainer.tsx +0 -75
- package/src/stories/components/index.ts +0 -20
- package/src/stories/components/types.ts +0 -11
- package/src/stories/testing/data.ts +0 -142
- package/src/stories/testing/index.ts +0 -6
- package/src/stories/testing/schema.ts +0 -17
- package/src/stories/testing/testing.tsx +0 -279
- package/src/testing/test-data.ts +0 -245
- package/src/testing/test-functions.ts +0 -16
- /package/dist/lib/browser/{blueprint-definition-VHFSRTEJ.mjs.map → blueprint-definition-5FT5JGPY.mjs.map} +0 -0
- /package/dist/lib/node-esm/{blueprint-definition-4E6XTLVN.mjs.map → blueprint-definition-XW6QQVLV.mjs.map} +0 -0
- /package/dist/types/src/components/TemplateEditor/{handlebars-extension.d.ts → extensions/handlebars-extension.d.ts} +0 -0
|
@@ -2,37 +2,42 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import '@dxos-theme';
|
|
6
|
-
|
|
7
5
|
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
8
|
-
import
|
|
9
|
-
import
|
|
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';
|
|
10
10
|
|
|
11
11
|
import { ContextQueueService, DatabaseService } from '@dxos/functions';
|
|
12
12
|
import { faker } from '@dxos/random';
|
|
13
13
|
import { useQueue, useSpace } from '@dxos/react-client/echo';
|
|
14
14
|
import { withClientProvider } from '@dxos/react-client/testing';
|
|
15
15
|
import { Popover } from '@dxos/react-ui';
|
|
16
|
-
import {
|
|
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';
|
|
17
19
|
import { Card } from '@dxos/react-ui-stack';
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
+
import { render } from '@dxos/storybook-utils';
|
|
21
|
+
import { type Message, Organization, Person } from '@dxos/types';
|
|
20
22
|
|
|
21
23
|
import { createMessageGenerator } from '../../testing';
|
|
22
24
|
import { translations } from '../../translations';
|
|
23
25
|
|
|
24
|
-
import { ChatThread, type
|
|
26
|
+
import { ChatThread, type ChatThreadProps } from './ChatThread';
|
|
27
|
+
import { componentRegistry } from './registry';
|
|
28
|
+
import TEXT from './testing/thread.md?raw';
|
|
25
29
|
|
|
26
30
|
faker.seed(1);
|
|
27
31
|
|
|
28
32
|
type MessageGenerator = Effect.Effect<void, never, DatabaseService | ContextQueueService>;
|
|
29
33
|
|
|
30
|
-
type StoryProps =
|
|
34
|
+
type StoryProps = { generator?: MessageGenerator[]; delay?: number; wait?: boolean } & ChatThreadProps;
|
|
31
35
|
|
|
32
|
-
const DefaultStory = ({ generator = [], delay = 0, ...props }: StoryProps) => {
|
|
36
|
+
const DefaultStory = ({ generator = [], delay = 0, wait, ...props }: StoryProps) => {
|
|
33
37
|
const space = useSpace();
|
|
34
38
|
const queueDxn = useMemo(() => space?.queues.create().dxn, [space]);
|
|
35
|
-
const queue = useQueue<
|
|
39
|
+
const queue = useQueue<Message.Message>(queueDxn);
|
|
40
|
+
const [done, setDone] = useState(false);
|
|
36
41
|
|
|
37
42
|
// Generate messages.
|
|
38
43
|
useEffect(() => {
|
|
@@ -48,6 +53,7 @@ const DefaultStory = ({ generator = [], delay = 0, ...props }: StoryProps) => {
|
|
|
48
53
|
yield* Effect.sleep(delay);
|
|
49
54
|
}
|
|
50
55
|
}
|
|
56
|
+
setDone(true);
|
|
51
57
|
}).pipe(Effect.provide(Layer.mergeAll(DatabaseService.layer(space.db), ContextQueueService.layer(queue)))),
|
|
52
58
|
);
|
|
53
59
|
|
|
@@ -56,29 +62,20 @@ const DefaultStory = ({ generator = [], delay = 0, ...props }: StoryProps) => {
|
|
|
56
62
|
};
|
|
57
63
|
}, [space, queue, generator]);
|
|
58
64
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
// controller?.setContext({ timestamp: Date.now() });
|
|
63
|
-
}, [controller]);
|
|
65
|
+
if (wait && !done) {
|
|
66
|
+
return null;
|
|
67
|
+
}
|
|
64
68
|
|
|
65
|
-
// TODO(burdon): Elsewhere PreviewProvider is implemented via the plugin-preview.
|
|
66
69
|
return (
|
|
67
|
-
<
|
|
68
|
-
|
|
69
|
-
return { label, text: ref };
|
|
70
|
-
}}
|
|
71
|
-
>
|
|
72
|
-
<ChatThread {...props} messages={queue?.objects ?? []} ref={setController} />
|
|
70
|
+
<EditorPreviewProvider onLookup={async ({ label, ref }) => ({ label, text: ref })}>
|
|
71
|
+
<ChatThread {...props} messages={queue?.objects} />
|
|
73
72
|
<PreviewCard />
|
|
74
|
-
</
|
|
73
|
+
</EditorPreviewProvider>
|
|
75
74
|
);
|
|
76
75
|
};
|
|
77
76
|
|
|
78
|
-
// TODO(burdon): Factor out.
|
|
79
|
-
// TODO(burdon): Provide renderer for preview extension.
|
|
80
77
|
const PreviewCard = () => {
|
|
81
|
-
const { target } =
|
|
78
|
+
const { target } = useEditorPreview('PreviewCard');
|
|
82
79
|
|
|
83
80
|
return (
|
|
84
81
|
<Popover.Portal>
|
|
@@ -98,33 +95,54 @@ const PreviewCard = () => {
|
|
|
98
95
|
const meta = {
|
|
99
96
|
title: 'plugins/plugin-assistant/ChatThread',
|
|
100
97
|
component: ChatThread,
|
|
101
|
-
render: DefaultStory,
|
|
98
|
+
render: render(DefaultStory),
|
|
102
99
|
decorators: [
|
|
103
|
-
withClientProvider({ createIdentity: true, createSpace: true, types: [DataType.Organization, DataType.Person] }),
|
|
104
|
-
withLayout({ fullscreen: true }),
|
|
105
100
|
withTheme,
|
|
101
|
+
withLayout({ container: 'column' }),
|
|
102
|
+
withClientProvider({
|
|
103
|
+
createIdentity: true,
|
|
104
|
+
createSpace: true,
|
|
105
|
+
types: [Organization.Organization, Person.Person],
|
|
106
|
+
}),
|
|
106
107
|
],
|
|
107
108
|
parameters: {
|
|
108
|
-
layout: 'fullscreen',
|
|
109
|
+
layout: 'fullscreen',
|
|
109
110
|
translations,
|
|
110
111
|
},
|
|
111
|
-
} satisfies Meta<
|
|
112
|
+
} satisfies Meta<StoryProps>;
|
|
112
113
|
|
|
113
114
|
export default meta;
|
|
114
115
|
|
|
115
|
-
type Story = StoryObj<
|
|
116
|
+
type Story = StoryObj<StoryProps>;
|
|
116
117
|
|
|
117
118
|
export const Default: Story = {
|
|
118
119
|
args: {
|
|
119
120
|
generator: createMessageGenerator(),
|
|
121
|
+
wait: true,
|
|
120
122
|
},
|
|
121
123
|
};
|
|
122
124
|
|
|
123
125
|
export const Delayed: Story = {
|
|
124
126
|
args: {
|
|
125
127
|
generator: createMessageGenerator(),
|
|
126
|
-
delay:
|
|
128
|
+
delay: 1_000,
|
|
127
129
|
fadeIn: true,
|
|
128
130
|
cursor: false,
|
|
129
131
|
},
|
|
130
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,22 +2,14 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import React, {
|
|
6
|
-
type CSSProperties,
|
|
7
|
-
forwardRef,
|
|
8
|
-
useCallback,
|
|
9
|
-
useEffect,
|
|
10
|
-
useImperativeHandle,
|
|
11
|
-
useMemo,
|
|
12
|
-
useState,
|
|
13
|
-
} from 'react';
|
|
5
|
+
import React, { type CSSProperties, forwardRef, useCallback, useEffect, useMemo } from 'react';
|
|
14
6
|
|
|
15
7
|
import { PublicKey } from '@dxos/keys';
|
|
16
8
|
import { type Identity } from '@dxos/react-client/halo';
|
|
17
|
-
import { type ThemedClassName } from '@dxos/react-ui';
|
|
9
|
+
import { type ThemedClassName, useForwardedRef } from '@dxos/react-ui';
|
|
18
10
|
import { MarkdownStream, type MarkdownStreamController, type MarkdownStreamProps } from '@dxos/react-ui-components';
|
|
19
11
|
import { mx } from '@dxos/react-ui-theme';
|
|
20
|
-
import { type
|
|
12
|
+
import { type Message } from '@dxos/types';
|
|
21
13
|
import { keyToFallback } from '@dxos/util';
|
|
22
14
|
|
|
23
15
|
import { type ChatEvent } from '../Chat';
|
|
@@ -25,26 +17,28 @@ import { type ChatEvent } from '../Chat';
|
|
|
25
17
|
import { blockToMarkdown, componentRegistry } from './registry';
|
|
26
18
|
import { MessageSyncer } from './sync';
|
|
27
19
|
|
|
28
|
-
export type ChatThreadController = Pick<MarkdownStreamController, 'setContext' | 'scrollToBottom'>;
|
|
29
|
-
|
|
30
20
|
export type ChatThreadProps = ThemedClassName<
|
|
31
21
|
{
|
|
32
22
|
identity?: Identity;
|
|
33
|
-
messages?:
|
|
23
|
+
messages?: Message.Message[];
|
|
34
24
|
error?: Error;
|
|
35
25
|
onEvent?: (event: ChatEvent) => void;
|
|
36
|
-
} & Pick<MarkdownStreamProps, 'cursor' | 'fadeIn'>
|
|
26
|
+
} & Pick<MarkdownStreamProps, 'cursor' | 'fadeIn' | 'debug'>
|
|
37
27
|
>;
|
|
38
28
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
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;
|
|
44
37
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
38
|
+
const userHue = useMemo(
|
|
39
|
+
() => identity?.profile?.data?.hue || keyToFallback(identity?.identityKey ?? PublicKey.random()).hue,
|
|
40
|
+
[identity],
|
|
41
|
+
);
|
|
48
42
|
|
|
49
43
|
// Show error.
|
|
50
44
|
useEffect(() => {
|
|
@@ -54,19 +48,18 @@ export const ChatThread = forwardRef<ChatThreadController | null, ChatThreadProp
|
|
|
54
48
|
// Update document.
|
|
55
49
|
const syncer = useMemo(() => controller && new MessageSyncer(controller, blockToMarkdown), [controller]);
|
|
56
50
|
useEffect(() => {
|
|
57
|
-
syncer?.
|
|
51
|
+
const reset = syncer?.append(messages, true);
|
|
52
|
+
if (reset) {
|
|
53
|
+
controller?.scrollToBottom('instant');
|
|
54
|
+
}
|
|
58
55
|
}, [syncer, messages]);
|
|
59
56
|
|
|
60
|
-
// Event
|
|
57
|
+
// Event adapter.
|
|
61
58
|
const handleEvent = useCallback<NonNullable<MarkdownStreamProps['onEvent']>>(
|
|
62
|
-
(
|
|
63
|
-
switch (
|
|
59
|
+
({ type, value }) => {
|
|
60
|
+
switch (type) {
|
|
64
61
|
case 'submit': {
|
|
65
|
-
|
|
66
|
-
onEvent?.({
|
|
67
|
-
type: 'submit',
|
|
68
|
-
text: ev.value,
|
|
69
|
-
});
|
|
62
|
+
value && onEvent?.({ type, text: value });
|
|
70
63
|
break;
|
|
71
64
|
}
|
|
72
65
|
}
|
|
@@ -76,15 +69,16 @@ export const ChatThread = forwardRef<ChatThreadController | null, ChatThreadProp
|
|
|
76
69
|
|
|
77
70
|
return (
|
|
78
71
|
<div
|
|
72
|
+
role='none'
|
|
79
73
|
className={mx('flex bs-full is-full justify-center overflow-hidden', classNames)}
|
|
80
74
|
style={{ '--user-fill': `var(--dx-${userHue}Fill)` } as CSSProperties}
|
|
81
75
|
>
|
|
82
76
|
<MarkdownStream
|
|
83
|
-
ref={
|
|
84
|
-
classNames='bs-full max-is-prose overflow-hidden'
|
|
77
|
+
ref={controllerRef}
|
|
85
78
|
registry={componentRegistry}
|
|
86
79
|
cursor={cursor}
|
|
87
80
|
fadeIn={fadeIn}
|
|
81
|
+
debug={debug}
|
|
88
82
|
onEvent={handleEvent}
|
|
89
83
|
/>
|
|
90
84
|
</div>
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { type ContentBlock, type
|
|
5
|
+
import { type ContentBlock, type Message } from '@dxos/types';
|
|
6
6
|
|
|
7
7
|
type Reducer<R, I> = (acc: R, value: I, idx: number) => R;
|
|
8
8
|
|
|
@@ -38,12 +38,12 @@ type Reducer<R, I> = (acc: R, value: I, idx: number) => R;
|
|
|
38
38
|
*/
|
|
39
39
|
export const reduceMessages: Reducer<
|
|
40
40
|
{
|
|
41
|
-
messages:
|
|
42
|
-
current?:
|
|
41
|
+
messages: Message.Message[];
|
|
42
|
+
current?: Message.Message;
|
|
43
43
|
toolBlock?: boolean;
|
|
44
|
-
assistantMessages?:
|
|
44
|
+
assistantMessages?: Message.Message[];
|
|
45
45
|
},
|
|
46
|
-
|
|
46
|
+
Message.Message
|
|
47
47
|
> = ({ messages, current, toolBlock, assistantMessages = [] }, message) => {
|
|
48
48
|
// Treat tool calls as assistant messages.
|
|
49
49
|
let assistant = message?.sender.role === 'assistant';
|
|
@@ -111,7 +111,7 @@ export const reduceMessages: Reducer<
|
|
|
111
111
|
/**
|
|
112
112
|
* Accumulate token counts from all summary blocks in pending messages.
|
|
113
113
|
*/
|
|
114
|
-
const reduceSummary = (messages:
|
|
114
|
+
const reduceSummary = (messages: Message.Message[]): ContentBlock.Summary => {
|
|
115
115
|
let start: number | undefined;
|
|
116
116
|
return messages.reduce<ContentBlock.Summary>(
|
|
117
117
|
(acc, msg) => {
|
|
@@ -13,9 +13,9 @@ import {
|
|
|
13
13
|
SummaryWidget,
|
|
14
14
|
ToggleContainer,
|
|
15
15
|
} from '@dxos/react-ui-components';
|
|
16
|
-
import { type XmlWidgetProps, type XmlWidgetRegistry } from '@dxos/react-ui-editor';
|
|
16
|
+
import { type XmlWidgetProps, type XmlWidgetRegistry, getXmlTextChild } from '@dxos/react-ui-editor';
|
|
17
17
|
import { Json } from '@dxos/react-ui-syntax-highlighter';
|
|
18
|
-
import { ContentBlock, type
|
|
18
|
+
import { ContentBlock, type Message } from '@dxos/types';
|
|
19
19
|
|
|
20
20
|
import { ToolBlock } from '../ToolBlock';
|
|
21
21
|
|
|
@@ -32,11 +32,6 @@ const Fallback = ({ _tag, ...props }: XmlWidgetProps<MessageThreadContext>) => {
|
|
|
32
32
|
);
|
|
33
33
|
};
|
|
34
34
|
|
|
35
|
-
const getTextChild = (children: any[]): string | null => {
|
|
36
|
-
const child = children?.[0];
|
|
37
|
-
return typeof child === 'string' ? child : null;
|
|
38
|
-
};
|
|
39
|
-
|
|
40
35
|
/**
|
|
41
36
|
* Custom XML tags registry.
|
|
42
37
|
*/
|
|
@@ -47,38 +42,38 @@ export const componentRegistry: XmlWidgetRegistry = {
|
|
|
47
42
|
|
|
48
43
|
['prompt' as const]: {
|
|
49
44
|
block: true,
|
|
50
|
-
factory: (
|
|
51
|
-
const text =
|
|
45
|
+
factory: ({ children }) => {
|
|
46
|
+
const text = getXmlTextChild(children);
|
|
52
47
|
return text ? new PromptWidget(text) : null;
|
|
53
48
|
},
|
|
54
49
|
},
|
|
55
50
|
['reference' as const]: {
|
|
56
51
|
block: false,
|
|
57
|
-
factory: (
|
|
58
|
-
const text =
|
|
59
|
-
return text &&
|
|
52
|
+
factory: ({ children, ref }) => {
|
|
53
|
+
const text = getXmlTextChild(children);
|
|
54
|
+
return text && ref ? new ReferenceWidget(text, ref) : null;
|
|
60
55
|
},
|
|
61
56
|
},
|
|
62
57
|
['select' as const]: {
|
|
63
58
|
block: true,
|
|
64
|
-
factory: (
|
|
65
|
-
const options =
|
|
66
|
-
?.map((option: any) => option._tag === 'option' &&
|
|
59
|
+
factory: ({ children }) => {
|
|
60
|
+
const options = children
|
|
61
|
+
?.map((option: any) => option._tag === 'option' && getXmlTextChild(option.children))
|
|
67
62
|
.filter(Boolean);
|
|
68
63
|
return options?.length ? new SelectWidget(options) : null;
|
|
69
64
|
},
|
|
70
65
|
},
|
|
71
66
|
['suggestion' as const]: {
|
|
72
67
|
block: true,
|
|
73
|
-
factory: (
|
|
74
|
-
const text =
|
|
68
|
+
factory: ({ children }) => {
|
|
69
|
+
const text = getXmlTextChild(children);
|
|
75
70
|
return text ? new SuggestionWidget(text) : null;
|
|
76
71
|
},
|
|
77
72
|
},
|
|
78
73
|
['summary' as const]: {
|
|
79
74
|
block: true,
|
|
80
|
-
factory: (
|
|
81
|
-
const text =
|
|
75
|
+
factory: ({ children }) => {
|
|
76
|
+
const text = getXmlTextChild(children);
|
|
82
77
|
return text ? new SummaryWidget(text) : null;
|
|
83
78
|
},
|
|
84
79
|
},
|
|
@@ -115,10 +110,10 @@ export const componentRegistry: XmlWidgetRegistry = {
|
|
|
115
110
|
*/
|
|
116
111
|
export const blockToMarkdown: BlockRenderer = (
|
|
117
112
|
context: MessageThreadContext,
|
|
118
|
-
message:
|
|
113
|
+
message: Message.Message,
|
|
119
114
|
block: ContentBlock.Any,
|
|
120
115
|
) => {
|
|
121
|
-
let str =
|
|
116
|
+
let str = blockToMarkdownImpl(context, message, block);
|
|
122
117
|
if (str && !block.pending) {
|
|
123
118
|
return (str += '\n');
|
|
124
119
|
}
|
|
@@ -126,12 +121,12 @@ export const blockToMarkdown: BlockRenderer = (
|
|
|
126
121
|
return str;
|
|
127
122
|
};
|
|
128
123
|
|
|
129
|
-
const
|
|
124
|
+
const blockToMarkdownImpl = (context: MessageThreadContext, message: Message.Message, block: ContentBlock.Any) => {
|
|
130
125
|
log('blockToMarkdown', { block: JSON.stringify(block) });
|
|
131
126
|
switch (block._tag) {
|
|
132
127
|
case 'text': {
|
|
133
128
|
if (message.sender.role === 'user') {
|
|
134
|
-
return
|
|
129
|
+
return `<prompt>${block.text}</prompt>`;
|
|
135
130
|
} else {
|
|
136
131
|
const text = block.text.trim();
|
|
137
132
|
if (text.length > 0) {
|
|
@@ -140,7 +135,10 @@ const _blockToMarkdown = (context: MessageThreadContext, message: DataType.Messa
|
|
|
140
135
|
}
|
|
141
136
|
break;
|
|
142
137
|
}
|
|
143
|
-
|
|
138
|
+
case 'reference': {
|
|
139
|
+
const dxn = block.reference.dxn;
|
|
140
|
+
return `<reference ref="${dxn.toString()}">${context.getObjectLabel(dxn)}</reference>`;
|
|
141
|
+
}
|
|
144
142
|
case 'suggestion': {
|
|
145
143
|
if (block.pending) {
|
|
146
144
|
return;
|
|
@@ -151,38 +149,25 @@ const _blockToMarkdown = (context: MessageThreadContext, message: DataType.Messa
|
|
|
151
149
|
if (block.pending || block.options.length === 0) {
|
|
152
150
|
return;
|
|
153
151
|
}
|
|
154
|
-
|
|
155
152
|
return `<select>${block.options.map((option) => `<option>${option}</option>`).join('')}</select>`;
|
|
156
153
|
}
|
|
157
|
-
|
|
158
|
-
// TODO(burdon): Need label.
|
|
159
|
-
case 'reference': {
|
|
160
|
-
return `<reference ref="${block.reference.dxn.toString()}">Ref</reference>`;
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
// case 'toolkit': {
|
|
164
|
-
// return `<toolkit />`;
|
|
165
|
-
// }
|
|
166
|
-
|
|
167
154
|
case 'toolCall': {
|
|
168
|
-
context.updateWidget(block.toolCallId, {
|
|
155
|
+
context.updateWidget<{ blocks: ContentBlock.Any[] }>(block.toolCallId, {
|
|
169
156
|
blocks: [block],
|
|
170
157
|
});
|
|
171
158
|
return `<toolCall id="${block.toolCallId}" />`;
|
|
172
159
|
}
|
|
173
160
|
case 'toolResult': {
|
|
174
|
-
context.updateWidget(block.toolCallId, ({ blocks = [] }
|
|
161
|
+
context.updateWidget<{ blocks: ContentBlock.Any[] }>(block.toolCallId, ({ blocks = [] }) => ({
|
|
175
162
|
blocks: [...blocks, block],
|
|
176
163
|
}));
|
|
177
164
|
break;
|
|
178
165
|
}
|
|
179
|
-
|
|
180
166
|
case 'summary': {
|
|
181
167
|
return `<summary>${ContentBlock.createSummaryMessage(block)}</summary>`;
|
|
182
168
|
}
|
|
183
|
-
|
|
184
|
-
// TODO(burdon): Need stable ID.
|
|
185
169
|
default: {
|
|
170
|
+
// TODO(burdon): Needs stable ID.
|
|
186
171
|
return `<json id="${message.id}">\n${JSON.stringify(block)}\n</json>`;
|
|
187
172
|
}
|
|
188
173
|
}
|
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
|
|
5
5
|
import { EditorView } from '@codemirror/view';
|
|
6
6
|
import { describe, it } from '@effect/vitest';
|
|
7
|
-
import
|
|
7
|
+
import * as Effect from 'effect/Effect';
|
|
8
8
|
|
|
9
|
-
import { type ContentBlock } from '@dxos/
|
|
9
|
+
import { type ContentBlock } from '@dxos/types';
|
|
10
10
|
|
|
11
11
|
import { createMessage } from '../../testing';
|
|
12
12
|
|
|
@@ -16,16 +16,24 @@ import { MessageSyncer, type TextModel } from './sync';
|
|
|
16
16
|
class TestDocument implements TextModel {
|
|
17
17
|
private readonly _view = new EditorView({ extensions: [] });
|
|
18
18
|
|
|
19
|
+
get view() {
|
|
20
|
+
return this._view;
|
|
21
|
+
}
|
|
22
|
+
|
|
19
23
|
get content() {
|
|
20
24
|
return this._view.state.doc.toString();
|
|
21
25
|
}
|
|
22
26
|
|
|
23
27
|
async reset(text: string) {
|
|
24
|
-
this._view.dispatch({
|
|
28
|
+
this._view.dispatch({
|
|
29
|
+
changes: { from: 0, to: this._view.state.doc.length, insert: text },
|
|
30
|
+
});
|
|
25
31
|
}
|
|
26
32
|
|
|
27
33
|
async append(text: string) {
|
|
28
|
-
this._view.dispatch({
|
|
34
|
+
this._view.dispatch({
|
|
35
|
+
changes: { from: this._view.state.doc.length, insert: text },
|
|
36
|
+
});
|
|
29
37
|
}
|
|
30
38
|
|
|
31
39
|
updateWidget(_id: string, _value: any) {}
|
|
@@ -43,12 +51,12 @@ describe('reducers', () => {
|
|
|
43
51
|
createMessage('assistant', [{ _tag: 'text', text: 'Hi there!' }]),
|
|
44
52
|
];
|
|
45
53
|
|
|
46
|
-
syncer.
|
|
47
|
-
expect(doc.content).toEqual(['
|
|
54
|
+
syncer.append(messages);
|
|
55
|
+
expect(doc.content).toEqual(['<prompt>Hello</prompt>', 'Hi there!', ''].join('\n'));
|
|
48
56
|
|
|
49
57
|
messages[1].blocks.push({ _tag: 'text', text: 'How can I help?' });
|
|
50
|
-
syncer.
|
|
51
|
-
expect(doc.content).toEqual(['
|
|
58
|
+
syncer.append(messages);
|
|
59
|
+
expect(doc.content).toEqual(['<prompt>Hello</prompt>', 'Hi there!', 'How can I help?', ''].join('\n'));
|
|
52
60
|
}),
|
|
53
61
|
);
|
|
54
62
|
|
|
@@ -63,18 +71,18 @@ describe('reducers', () => {
|
|
|
63
71
|
createMessage('assistant', [{ _tag: 'text', text: 'Hi there!', pending: true }]),
|
|
64
72
|
];
|
|
65
73
|
|
|
66
|
-
syncer.
|
|
67
|
-
expect(doc.content).toEqual(['
|
|
74
|
+
syncer.append(messages);
|
|
75
|
+
expect(doc.content).toEqual(['<prompt>Hello</prompt>', 'Hi there!'].join('\n'));
|
|
68
76
|
|
|
69
77
|
const block = messages[1].blocks[0] as ContentBlock.Text;
|
|
70
78
|
block.text = 'Hi there! How are you?';
|
|
71
79
|
block.pending = false;
|
|
72
|
-
syncer.
|
|
80
|
+
syncer.append(messages);
|
|
73
81
|
|
|
74
82
|
messages[1].blocks.push({ _tag: 'text', text: 'How can I help?' });
|
|
75
|
-
syncer.
|
|
83
|
+
syncer.append(messages);
|
|
76
84
|
expect(doc.content).toEqual(
|
|
77
|
-
['
|
|
85
|
+
['<prompt>Hello</prompt>', 'Hi there! How are you?', 'How can I help?', ''].join('\n'),
|
|
78
86
|
);
|
|
79
87
|
}),
|
|
80
88
|
);
|
|
@@ -2,15 +2,16 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
+
import { type DXN } from '@dxos/echo';
|
|
5
6
|
import { log } from '@dxos/log';
|
|
6
7
|
import { type MarkdownStreamController } from '@dxos/react-ui-components';
|
|
7
|
-
import { type XmlWidgetStateManager } from '@dxos/react-ui-editor';
|
|
8
|
-
import { type ContentBlock, type
|
|
8
|
+
import { type StateDispatch, type XmlWidgetStateManager } from '@dxos/react-ui-editor';
|
|
9
|
+
import { type ContentBlock, type Message } from '@dxos/types';
|
|
9
10
|
|
|
10
11
|
/**
|
|
11
12
|
* Update document.
|
|
12
13
|
*/
|
|
13
|
-
export type TextModel = Pick<MarkdownStreamController, 'reset' | 'append' | 'updateWidget'>;
|
|
14
|
+
export type TextModel = Pick<MarkdownStreamController, 'view' | 'reset' | 'append' | 'updateWidget'>;
|
|
14
15
|
|
|
15
16
|
/**
|
|
16
17
|
* Thread context passed to renderer.
|
|
@@ -18,9 +19,14 @@ export type TextModel = Pick<MarkdownStreamController, 'reset' | 'append' | 'upd
|
|
|
18
19
|
export class MessageThreadContext implements Pick<MarkdownStreamController, 'updateWidget'> {
|
|
19
20
|
constructor(private readonly _widgetState?: XmlWidgetStateManager) {}
|
|
20
21
|
|
|
21
|
-
updateWidget<T>(id: string, value: T) {
|
|
22
|
+
updateWidget<T>(id: string, value: StateDispatch<T>) {
|
|
22
23
|
this._widgetState?.updateWidget(id, value);
|
|
23
24
|
}
|
|
25
|
+
|
|
26
|
+
// TODO(burdon): Resolve from hypergraph.
|
|
27
|
+
getObjectLabel(_id: DXN) {
|
|
28
|
+
return 'Object';
|
|
29
|
+
}
|
|
24
30
|
}
|
|
25
31
|
|
|
26
32
|
/**
|
|
@@ -28,7 +34,7 @@ export class MessageThreadContext implements Pick<MarkdownStreamController, 'upd
|
|
|
28
34
|
*/
|
|
29
35
|
export type BlockRenderer = (
|
|
30
36
|
context: MessageThreadContext,
|
|
31
|
-
message:
|
|
37
|
+
message: Message.Message,
|
|
32
38
|
block: ContentBlock.Any,
|
|
33
39
|
) => string | undefined;
|
|
34
40
|
|
|
@@ -63,17 +69,46 @@ export class MessageSyncer {
|
|
|
63
69
|
void this._model.reset('');
|
|
64
70
|
}
|
|
65
71
|
|
|
66
|
-
|
|
72
|
+
/**
|
|
73
|
+
* Syncs messages with the editor.
|
|
74
|
+
*/
|
|
75
|
+
append(messages: Message.Message[], flush = false): boolean {
|
|
76
|
+
// Check if new set of messages.
|
|
77
|
+
if (this._initialMessageId !== messages[0]?.id) {
|
|
78
|
+
this.reset();
|
|
79
|
+
this._initialMessageId = messages[0]?.id;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
if (flush && this._model.view?.state.doc.length === 0) {
|
|
83
|
+
const buffer: string[] = [];
|
|
84
|
+
this.process(messages, (content) => {
|
|
85
|
+
buffer.push(content);
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
const content = buffer.join('');
|
|
89
|
+
this._model.view?.dispatch({
|
|
90
|
+
changes: [{ from: 0, to: this._model.view?.state.doc.length ?? 0, insert: content }],
|
|
91
|
+
selection: { anchor: content.length },
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
return true;
|
|
95
|
+
} else {
|
|
96
|
+
this.process(messages, (content) => {
|
|
97
|
+
void this._model.append(content);
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
return false;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
private process(messages: Message.Message[], append: (content: string) => void) {
|
|
67
105
|
log('sync', {
|
|
68
|
-
|
|
106
|
+
doc: this._model.view?.state.doc.length,
|
|
107
|
+
messages: messages.map((message) => message.blocks.length),
|
|
69
108
|
currentMessageIndex: this._currentMessageIndex,
|
|
70
109
|
currentBlockIndex: this._currentBlockIndex,
|
|
71
110
|
currentBlockContent: this._currentBlockContent,
|
|
72
111
|
});
|
|
73
|
-
if (this._initialMessageId !== messages[0]?.id) {
|
|
74
|
-
this.reset();
|
|
75
|
-
this._initialMessageId = messages[0]?.id;
|
|
76
|
-
}
|
|
77
112
|
|
|
78
113
|
let i = this._currentMessageIndex;
|
|
79
114
|
for (const message of messages.slice(this._currentMessageIndex)) {
|
|
@@ -94,9 +129,9 @@ export class MessageSyncer {
|
|
|
94
129
|
content = currentBlockContent;
|
|
95
130
|
}
|
|
96
131
|
|
|
97
|
-
void this._model.append(content);
|
|
98
|
-
this._currentBlockContent = currentBlockContent;
|
|
99
132
|
log('append', { message: i, block: j, content });
|
|
133
|
+
this._currentBlockContent = currentBlockContent;
|
|
134
|
+
append(content);
|
|
100
135
|
}
|
|
101
136
|
|
|
102
137
|
if (block.pending) {
|