@dxos/plugin-assistant 0.8.4-main.5ea62a8 → 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-YBJBIVUZ.mjs → ChatContainer-2W6FNSJD.mjs} +22 -20
- package/dist/lib/browser/ChatContainer-2W6FNSJD.mjs.map +7 -0
- package/dist/lib/browser/{ChatDialog-MTPJLEHM.mjs → ChatDialog-XQ3KDYWE.mjs} +12 -11
- 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-7AAWTWGA.mjs → app-graph-builder-LM6GVHQO.mjs} +67 -21
- package/dist/lib/browser/app-graph-builder-LM6GVHQO.mjs.map +7 -0
- package/dist/lib/browser/{blueprint-definition-CRZPIA5A.mjs → blueprint-definition-VBEOXNBS.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-5JZRYQZL.mjs} +52 -25
- 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-IJAJRAR7.mjs → chunk-LRE4VEZV.mjs} +2 -4
- package/dist/lib/browser/chunk-LRE4VEZV.mjs.map +7 -0
- package/dist/lib/browser/{chunk-OYFQS7JM.mjs → chunk-NC2QNMBF.mjs} +60 -41
- 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 +142 -103
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/{intent-resolver-BQO5SVGI.mjs → intent-resolver-EEYS2GJF.mjs} +62 -31
- 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-VNCD2H7C.mjs → react-surface-ECKZNDSU.mjs} +24 -35
- 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-36V3VUMW.mjs → settings-HD5WA24I.mjs} +5 -5
- package/dist/lib/browser/{settings-36V3VUMW.mjs.map → settings-HD5WA24I.mjs.map} +1 -1
- package/dist/lib/browser/{state-D5IVKNYG.mjs → state-GG7Z3NB7.mjs} +9 -5
- package/dist/lib/browser/{state-D5IVKNYG.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-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-TUCITJJW.mjs → ChatContainer-CTUNUEU3.mjs} +22 -20
- package/dist/lib/node-esm/ChatContainer-CTUNUEU3.mjs.map +7 -0
- package/dist/lib/node-esm/{ChatDialog-JLM7RDZQ.mjs → ChatDialog-X42ASXQD.mjs} +12 -11
- 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-PNAFQUYT.mjs → app-graph-builder-6XUAGTRS.mjs} +67 -21
- package/dist/lib/node-esm/app-graph-builder-6XUAGTRS.mjs.map +7 -0
- package/dist/lib/node-esm/{blueprint-definition-275J3XL2.mjs → blueprint-definition-RDCLLIQH.mjs} +4 -4
- package/dist/lib/node-esm/{chunk-CAQKGW3B.mjs → chunk-25GMMNY5.mjs} +60 -41
- 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-7YOGZI66.mjs → chunk-E4JSYCWZ.mjs} +52 -25
- package/dist/lib/node-esm/chunk-E4JSYCWZ.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-YPXEA46Q.mjs → chunk-YWFWT57N.mjs} +2 -4
- 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 +142 -103
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/{intent-resolver-FIS3T5KP.mjs → intent-resolver-4SRYLDK5.mjs} +62 -31
- 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-4NLRKNBU.mjs → react-surface-NLIG5VAI.mjs} +24 -35
- 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-7ZCZ6AS5.mjs → settings-YJQVKHH5.mjs} +5 -5
- package/dist/lib/node-esm/{settings-7ZCZ6AS5.mjs.map → settings-YJQVKHH5.mjs.map} +1 -1
- package/dist/lib/node-esm/{state-4VLKPLW3.mjs → state-FSUHFMDM.mjs} +9 -5
- package/dist/lib/node-esm/{state-4VLKPLW3.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 -11
- 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 +1 -0
- 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/repair.d.ts +4 -0
- package/dist/types/src/capabilities/repair.d.ts.map +1 -0
- 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 +22 -11
- 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 +10 -8
- package/dist/types/src/components/ChatThread/ChatThread.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/ChatThread.stories.d.ts +140 -77
- package/dist/types/src/components/ChatThread/ChatThread.stories.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/Link.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 +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 -1
- package/dist/types/src/components/TemplateEditor/TemplateEditor.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/TemplateEditor.stories.d.ts +121 -62
- 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 +121 -62
- 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 +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 +2 -2
- package/dist/types/src/components/Toolbox/Toolbox.d.ts.map +1 -1
- package/dist/types/src/components/Toolbox/Toolbox.stories.d.ts +121 -62
- 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 +2 -4
- 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 +5 -3
- package/dist/types/src/hooks/useChatProcessor.d.ts.map +1 -1
- package/dist/types/src/hooks/useChatServices.d.ts +2 -2
- 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/useFilteredTypes.d.ts +4 -0
- package/dist/types/src/hooks/useFilteredTypes.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 +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 +17 -23
- 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 +1 -2
- 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-services.d.ts +2 -2
- package/dist/types/src/testing/test-services.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +246 -27
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/Assistant.d.ts +16 -13
- package/dist/types/src/types/Assistant.d.ts.map +1 -1
- package/dist/types/src/types/AssistantAction.d.ts +38 -16
- package/dist/types/src/types/AssistantAction.d.ts.map +1 -1
- package/dist/types/src/types/service.d.ts +129 -82
- package/dist/types/src/types/service.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +96 -111
- package/src/AssistantPlugin.tsx +138 -134
- package/src/capabilities/ai-service.ts +6 -7
- package/src/capabilities/app-graph-builder.ts +69 -21
- package/src/capabilities/blueprint-definition.ts +39 -15
- package/src/capabilities/capabilities.ts +2 -16
- package/src/capabilities/edge-model-resolver.ts +5 -7
- package/src/capabilities/index.ts +1 -0
- package/src/capabilities/intent-resolver.ts +61 -20
- package/src/capabilities/local-model-resolver.ts +7 -9
- package/src/capabilities/react-surface.tsx +16 -20
- package/src/capabilities/repair.ts +49 -0
- 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 +177 -140
- 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 +17 -10
- package/src/components/ChatProgress/ChatProgress.tsx +3 -4
- package/src/components/ChatPrompt/ChatActions.tsx +2 -4
- package/src/components/ChatPrompt/ChatOptions.tsx +48 -47
- package/src/components/ChatPrompt/ChatReferences.tsx +2 -2
- package/src/components/ChatThread/ChatThread.stories.tsx +90 -225
- package/src/components/ChatThread/ChatThread.tsx +59 -51
- package/src/components/ChatThread/Link.tsx +11 -8
- package/src/components/ChatThread/reducers.ts +6 -6
- 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 +15 -7
- package/src/components/TemplateEditor/TemplateEditor.tsx +21 -12
- 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/{ChatThread → ToolBlock}/ToolBlock.tsx +46 -50
- package/src/components/ToolBlock/ToolBlockWidget.tsx +5 -0
- package/src/components/ToolBlock/index.ts +6 -0
- 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} +10 -8
- package/src/hooks/index.ts +2 -4
- package/src/hooks/useBlueprintRegistry.ts +19 -4
- package/src/hooks/useChatProcessor.ts +23 -15
- package/src/hooks/useChatServices.ts +29 -42
- package/src/hooks/useChatToolbarActions.ts +122 -0
- package/src/hooks/useContextBinder.ts +19 -7
- package/src/hooks/useContextObjects.ts +1 -1
- package/src/hooks/{useItemTypes.ts → useFilteredTypes.ts} +8 -7
- 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 +21 -27
- package/src/processor/processor.ts +47 -74
- package/src/processor/update-name.ts +56 -0
- package/src/queue-logger.ts +9 -13
- package/src/testing/index.ts +1 -2
- package/src/testing/test-generator.ts +261 -0
- package/src/testing/test-services.ts +2 -8
- package/src/translations.ts +30 -18
- package/src/types/Assistant.ts +11 -9
- package/src/types/AssistantAction.ts +23 -6
- package/src/types/service.ts +17 -9
- package/dist/lib/browser/BlueprintContainer-OWUSKPRK.mjs +0 -29
- package/dist/lib/browser/BlueprintContainer-OWUSKPRK.mjs.map +0 -7
- package/dist/lib/browser/ChatCompanion-FRCVSLPP.mjs +0 -126
- package/dist/lib/browser/ChatCompanion-FRCVSLPP.mjs.map +0 -7
- package/dist/lib/browser/ChatContainer-YBJBIVUZ.mjs.map +0 -7
- package/dist/lib/browser/ChatDialog-MTPJLEHM.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-NRZPTUHO.mjs +0 -22
- package/dist/lib/browser/ai-service-NRZPTUHO.mjs.map +0 -7
- package/dist/lib/browser/app-graph-builder-7AAWTWGA.mjs.map +0 -7
- package/dist/lib/browser/chunk-6QMISAU6.mjs +0 -167
- package/dist/lib/browser/chunk-6QMISAU6.mjs.map +0 -7
- package/dist/lib/browser/chunk-CFXXQM25.mjs +0 -182
- package/dist/lib/browser/chunk-CFXXQM25.mjs.map +0 -7
- package/dist/lib/browser/chunk-IJAJRAR7.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-OYFQS7JM.mjs.map +0 -7
- package/dist/lib/browser/chunk-SMIVXXAI.mjs.map +0 -7
- package/dist/lib/browser/chunk-V5H5CCZA.mjs +0 -218
- package/dist/lib/browser/chunk-V5H5CCZA.mjs.map +0 -7
- package/dist/lib/browser/chunk-XL557TXF.mjs +0 -2332
- package/dist/lib/browser/chunk-XL557TXF.mjs.map +0 -7
- package/dist/lib/browser/edge-model-resolver-E5M3CC46.mjs +0 -22
- package/dist/lib/browser/edge-model-resolver-E5M3CC46.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-BQO5SVGI.mjs.map +0 -7
- package/dist/lib/browser/local-model-resolver-VZ5WZQIC.mjs +0 -21
- package/dist/lib/browser/local-model-resolver-VZ5WZQIC.mjs.map +0 -7
- package/dist/lib/browser/react-surface-VNCD2H7C.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-UFVWCRN6.mjs +0 -30
- package/dist/lib/node-esm/BlueprintContainer-UFVWCRN6.mjs.map +0 -7
- package/dist/lib/node-esm/ChatCompanion-ZNRZEKH5.mjs +0 -127
- package/dist/lib/node-esm/ChatCompanion-ZNRZEKH5.mjs.map +0 -7
- package/dist/lib/node-esm/ChatContainer-TUCITJJW.mjs.map +0 -7
- package/dist/lib/node-esm/ChatDialog-JLM7RDZQ.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-UDEPIPTO.mjs +0 -23
- package/dist/lib/node-esm/ai-service-UDEPIPTO.mjs.map +0 -7
- package/dist/lib/node-esm/app-graph-builder-PNAFQUYT.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-2X6VEO32.mjs +0 -2333
- package/dist/lib/node-esm/chunk-2X6VEO32.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-7YOGZI66.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-CAQKGW3B.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-FNZJJL7G.mjs +0 -183
- package/dist/lib/node-esm/chunk-FNZJJL7G.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-RLBN4RNR.mjs +0 -168
- package/dist/lib/node-esm/chunk-RLBN4RNR.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-UWUUZQWJ.mjs +0 -219
- package/dist/lib/node-esm/chunk-UWUUZQWJ.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-YPXEA46Q.mjs.map +0 -7
- package/dist/lib/node-esm/edge-model-resolver-SZHDLXCT.mjs +0 -23
- package/dist/lib/node-esm/edge-model-resolver-SZHDLXCT.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-FIS3T5KP.mjs.map +0 -7
- package/dist/lib/node-esm/local-model-resolver-2KCBKMYA.mjs +0 -22
- package/dist/lib/node-esm/local-model-resolver-2KCBKMYA.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-4NLRKNBU.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/components/BlueprintContainer.d.ts +0 -8
- package/dist/types/src/components/BlueprintContainer.d.ts.map +0 -1
- package/dist/types/src/components/ChatThread/ChatMessage.d.ts +0 -33
- 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/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 -263
- 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 -4
- 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/useExecutionGraph.d.ts +0 -7
- package/dist/types/src/hooks/useExecutionGraph.d.ts.map +0 -1
- package/dist/types/src/hooks/useItemTypes.d.ts +0 -4
- package/dist/types/src/hooks/useItemTypes.d.ts.map +0 -1
- package/dist/types/src/hooks/useMatcherExtension.d.ts +0 -3
- package/dist/types/src/hooks/useMatcherExtension.d.ts.map +0 -1
- package/dist/types/src/hooks/useResolveRef.d.ts +0 -4
- package/dist/types/src/hooks/useResolveRef.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 -26
- 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/CommentsContainer.d.ts +0 -4
- package/dist/types/src/stories/components/CommentsContainer.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/LoggingContainer.d.ts +0 -4
- 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/SurfaceContainer.d.ts +0 -8
- package/dist/types/src/stories/components/SurfaceContainer.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/index.d.ts +0 -11
- 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 -5
- 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/testing.d.ts +0 -44
- package/dist/types/src/stories/testing/testing.d.ts.map +0 -1
- package/dist/types/src/testing/test-data.d.ts +0 -4
- 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/components/BlueprintContainer.tsx +0 -24
- package/src/components/ChatThread/ChatMessage.tsx +0 -334
- 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 -20
- package/src/components/Toolbar/index.ts +0 -5
- package/src/components/Toolbar/useChatToolbarActions.ts +0 -125
- package/src/execution-graph/execution-graph.ts +0 -211
- package/src/execution-graph/index.ts +0 -5
- package/src/hooks/useExecutionGraph.ts +0 -20
- package/src/hooks/useMatcherExtension.ts +0 -45
- package/src/hooks/useResolveRef.ts +0 -33
- package/src/parser/filter-generator.test.ts +0 -32
- package/src/parser/filter-generator.ts +0 -76
- 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 -36
- package/src/stories/Chat.stories.tsx +0 -469
- package/src/stories/components/BlueprintContainer.tsx +0 -32
- package/src/stories/components/ChatContainer.tsx +0 -57
- package/src/stories/components/CommentsContainer.tsx +0 -25
- package/src/stories/components/GraphContainer.tsx +0 -118
- package/src/stories/components/LoggingContainer.tsx +0 -21
- package/src/stories/components/MessageContainer.tsx +0 -27
- package/src/stories/components/SurfaceContainer.tsx +0 -52
- package/src/stories/components/TasksContainer.tsx +0 -49
- package/src/stories/components/TokenManagerContainer.tsx +0 -14
- package/src/stories/components/index.ts +0 -15
- 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/testing.tsx +0 -254
- package/src/testing/test-data.ts +0 -109
- package/src/testing/test-functions.ts +0 -16
- /package/dist/lib/browser/{blueprint-definition-CRZPIA5A.mjs.map → blueprint-definition-VBEOXNBS.mjs.map} +0 -0
- /package/dist/lib/node-esm/{blueprint-definition-275J3XL2.mjs.map → blueprint-definition-RDCLLIQH.mjs.map} +0 -0
- /package/dist/types/src/components/TemplateEditor/{handlebars-extension.d.ts → extensions/handlebars-extension.d.ts} +0 -0
|
@@ -2,282 +2,147 @@
|
|
|
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
|
-
import { IntentPlugin } from '@dxos/app-framework';
|
|
12
|
-
import { withPluginManager } from '@dxos/app-framework/testing';
|
|
13
|
-
import { Obj } from '@dxos/echo';
|
|
14
11
|
import { ContextQueueService, DatabaseService } from '@dxos/functions';
|
|
15
|
-
import { ClientPlugin } from '@dxos/plugin-client';
|
|
16
|
-
import { PreviewPlugin } from '@dxos/plugin-preview';
|
|
17
|
-
import { StorybookLayoutPlugin } from '@dxos/plugin-storybook-layout';
|
|
18
|
-
import { ThemePlugin } from '@dxos/plugin-theme';
|
|
19
12
|
import { faker } from '@dxos/random';
|
|
20
13
|
import { useQueue, useSpace } from '@dxos/react-client/echo';
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
|
|
14
|
+
import { withClientProvider } from '@dxos/react-client/testing';
|
|
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';
|
|
25
24
|
import { translations } from '../../translations';
|
|
26
25
|
|
|
27
|
-
import { renderObjectLink } from './ChatMessage';
|
|
28
26
|
import { ChatThread, type ChatThreadProps } from './ChatThread';
|
|
27
|
+
import { componentRegistry } from './registry';
|
|
28
|
+
import TEXT from './testing/thread.md?raw';
|
|
29
29
|
|
|
30
30
|
faker.seed(1);
|
|
31
31
|
|
|
32
|
-
|
|
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) => {
|
|
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);
|
|
41
|
+
|
|
42
|
+
// Generate messages.
|
|
36
43
|
useEffect(() => {
|
|
37
44
|
if (!space || !queue) {
|
|
38
45
|
return;
|
|
39
46
|
}
|
|
40
47
|
|
|
41
|
-
|
|
48
|
+
const fiber = Effect.runFork(
|
|
42
49
|
Effect.gen(function* () {
|
|
43
|
-
for (const step of
|
|
50
|
+
for (const step of generator) {
|
|
44
51
|
yield* step;
|
|
45
|
-
|
|
52
|
+
if (delay) {
|
|
53
|
+
yield* Effect.sleep(delay);
|
|
54
|
+
}
|
|
46
55
|
}
|
|
47
|
-
|
|
48
|
-
return queue;
|
|
56
|
+
setDone(true);
|
|
49
57
|
}).pipe(Effect.provide(Layer.mergeAll(DatabaseService.layer(space.db), ContextQueueService.layer(queue)))),
|
|
50
58
|
);
|
|
51
|
-
}, [space, queue]);
|
|
52
59
|
|
|
53
|
-
|
|
60
|
+
return () => {
|
|
61
|
+
void Effect.runPromise(Fiber.interrupt(fiber));
|
|
62
|
+
};
|
|
63
|
+
}, [space, queue, generator]);
|
|
64
|
+
|
|
65
|
+
if (wait && !done) {
|
|
54
66
|
return null;
|
|
55
67
|
}
|
|
56
68
|
|
|
57
69
|
return (
|
|
58
|
-
<
|
|
70
|
+
<EditorPreviewProvider onLookup={async ({ label, ref }) => ({ label, text: ref })}>
|
|
71
|
+
<ChatThread {...props} messages={queue?.objects} />
|
|
72
|
+
<PreviewCard />
|
|
73
|
+
</EditorPreviewProvider>
|
|
59
74
|
);
|
|
60
75
|
};
|
|
61
76
|
|
|
62
|
-
const
|
|
63
|
-
|
|
64
|
-
created: new Date().toISOString(),
|
|
65
|
-
sender: { role },
|
|
66
|
-
blocks,
|
|
67
|
-
});
|
|
68
|
-
};
|
|
77
|
+
const PreviewCard = () => {
|
|
78
|
+
const { target } = useEditorPreview('PreviewCard');
|
|
69
79
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
Effect.gen(function* () {
|
|
86
|
-
const { queue } = yield* ContextQueueService;
|
|
87
|
-
yield* Effect.promise(() =>
|
|
88
|
-
queue.append([
|
|
89
|
-
createMessage('assistant', [
|
|
90
|
-
{
|
|
91
|
-
_tag: 'suggestion',
|
|
92
|
-
text: 'Search...',
|
|
93
|
-
},
|
|
94
|
-
{
|
|
95
|
-
_tag: 'suggestion',
|
|
96
|
-
text: faker.lorem.paragraphs(1),
|
|
97
|
-
},
|
|
98
|
-
]),
|
|
99
|
-
createMessage('assistant', [
|
|
100
|
-
{
|
|
101
|
-
_tag: 'text',
|
|
102
|
-
text: 'Select an option:',
|
|
103
|
-
},
|
|
104
|
-
{
|
|
105
|
-
_tag: 'select',
|
|
106
|
-
options: ['Option 1', 'Option 2', 'Option 3'],
|
|
107
|
-
},
|
|
108
|
-
]),
|
|
109
|
-
]),
|
|
110
|
-
);
|
|
111
|
-
}),
|
|
112
|
-
|
|
113
|
-
Effect.gen(function* () {
|
|
114
|
-
const { queue } = yield* ContextQueueService;
|
|
115
|
-
const { db } = yield* DatabaseService;
|
|
116
|
-
const obj1 = db.add(Obj.make(DataType.Organization, { name: 'DXOS' }));
|
|
117
|
-
const obj2 = db.add(Obj.make(DataType.Person, { fullName: 'Alice' }));
|
|
118
|
-
const obj3 = db.add(Obj.make(DataType.Person, { fullName: 'Bob' }));
|
|
119
|
-
const obj4 = db.add(Obj.make(DataType.Person, { fullName: 'Charlie' }));
|
|
120
|
-
yield* Effect.promise(() =>
|
|
121
|
-
queue.append([
|
|
122
|
-
createMessage('assistant', [
|
|
123
|
-
// Inline tag.
|
|
124
|
-
{
|
|
125
|
-
_tag: 'text',
|
|
126
|
-
text: [faker.lorem.paragraph(), renderObjectLink(obj1), faker.lorem.paragraph()].join(' '),
|
|
127
|
-
},
|
|
128
|
-
// Inline cards.
|
|
129
|
-
...[obj2, obj3, obj4].map(
|
|
130
|
-
(obj) =>
|
|
131
|
-
({
|
|
132
|
-
_tag: 'text',
|
|
133
|
-
text: renderObjectLink(obj, true),
|
|
134
|
-
}) satisfies ContentBlock.Text,
|
|
135
|
-
),
|
|
136
|
-
]),
|
|
137
|
-
]),
|
|
138
|
-
);
|
|
139
|
-
}),
|
|
140
|
-
|
|
141
|
-
Effect.gen(function* () {
|
|
142
|
-
const { queue } = yield* ContextQueueService;
|
|
143
|
-
yield* Effect.promise(() =>
|
|
144
|
-
queue.append([
|
|
145
|
-
createMessage('assistant', [
|
|
146
|
-
{
|
|
147
|
-
_tag: 'text',
|
|
148
|
-
text: faker.lorem.paragraphs(1),
|
|
149
|
-
},
|
|
150
|
-
{
|
|
151
|
-
_tag: 'toolkit',
|
|
152
|
-
},
|
|
153
|
-
]),
|
|
154
|
-
]),
|
|
155
|
-
);
|
|
156
|
-
}),
|
|
157
|
-
|
|
158
|
-
Effect.gen(function* () {
|
|
159
|
-
const { queue } = yield* ContextQueueService;
|
|
160
|
-
yield* Effect.promise(() =>
|
|
161
|
-
queue.append([
|
|
162
|
-
createMessage('assistant', [
|
|
163
|
-
{
|
|
164
|
-
_tag: 'text',
|
|
165
|
-
disposition: 'cot',
|
|
166
|
-
text: Array.from({ length: faker.number.int({ min: 3, max: 5 }) })
|
|
167
|
-
.map((_, idx) => `${idx + 1}. ${faker.lorem.paragraph()}`)
|
|
168
|
-
.join('\n'),
|
|
169
|
-
},
|
|
170
|
-
{
|
|
171
|
-
_tag: 'toolCall',
|
|
172
|
-
toolCallId: '1234',
|
|
173
|
-
name: 'search',
|
|
174
|
-
input: JSON.stringify({}),
|
|
175
|
-
},
|
|
176
|
-
]),
|
|
177
|
-
createMessage('user', [
|
|
178
|
-
{
|
|
179
|
-
_tag: 'toolResult',
|
|
180
|
-
toolCallId: '1234',
|
|
181
|
-
name: 'search',
|
|
182
|
-
result: 'This is a tool result.',
|
|
183
|
-
},
|
|
184
|
-
]),
|
|
185
|
-
]),
|
|
186
|
-
);
|
|
187
|
-
}),
|
|
188
|
-
|
|
189
|
-
Effect.gen(function* () {
|
|
190
|
-
const { queue } = yield* ContextQueueService;
|
|
191
|
-
yield* Effect.promise(() =>
|
|
192
|
-
queue.append([
|
|
193
|
-
createMessage('assistant', [
|
|
194
|
-
{
|
|
195
|
-
_tag: 'toolCall',
|
|
196
|
-
toolCallId: '4567',
|
|
197
|
-
name: 'create',
|
|
198
|
-
input: JSON.stringify({}),
|
|
199
|
-
},
|
|
200
|
-
]),
|
|
201
|
-
createMessage('user', [
|
|
202
|
-
{
|
|
203
|
-
_tag: 'toolResult',
|
|
204
|
-
toolCallId: '4567',
|
|
205
|
-
name: 'create',
|
|
206
|
-
result: 'This is a tool result.',
|
|
207
|
-
},
|
|
208
|
-
]),
|
|
209
|
-
createMessage('assistant', [
|
|
210
|
-
{
|
|
211
|
-
_tag: 'text',
|
|
212
|
-
text: Array.from({ length: faker.number.int({ min: 2, max: 3 }) })
|
|
213
|
-
.map(() => faker.lorem.paragraphs())
|
|
214
|
-
.join('\n\n'),
|
|
215
|
-
},
|
|
216
|
-
]),
|
|
217
|
-
]),
|
|
218
|
-
);
|
|
219
|
-
}),
|
|
220
|
-
|
|
221
|
-
Effect.gen(function* () {
|
|
222
|
-
const { queue } = yield* ContextQueueService;
|
|
223
|
-
yield* Effect.promise(() =>
|
|
224
|
-
queue.append([
|
|
225
|
-
createMessage('assistant', [
|
|
226
|
-
{
|
|
227
|
-
_tag: 'text',
|
|
228
|
-
text: faker.lorem.paragraphs(2),
|
|
229
|
-
},
|
|
230
|
-
]),
|
|
231
|
-
]),
|
|
232
|
-
);
|
|
233
|
-
}),
|
|
234
|
-
];
|
|
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
|
+
};
|
|
235
94
|
|
|
236
95
|
const meta = {
|
|
237
96
|
title: 'plugins/plugin-assistant/ChatThread',
|
|
238
97
|
component: ChatThread,
|
|
239
|
-
render: render(
|
|
98
|
+
render: render(DefaultStory),
|
|
240
99
|
decorators: [
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
types: [DataType.Organization, DataType.Person],
|
|
248
|
-
}),
|
|
249
|
-
ThemePlugin({ tx: defaultTx }),
|
|
250
|
-
StorybookLayoutPlugin(),
|
|
251
|
-
IntentPlugin(),
|
|
252
|
-
PreviewPlugin(),
|
|
253
|
-
],
|
|
254
|
-
}),
|
|
255
|
-
withLayout({
|
|
256
|
-
Container: ColumnContainer,
|
|
257
|
-
classNames: 'is-[40rem]',
|
|
100
|
+
withTheme,
|
|
101
|
+
withLayout({ container: 'column' }),
|
|
102
|
+
withClientProvider({
|
|
103
|
+
createIdentity: true,
|
|
104
|
+
createSpace: true,
|
|
105
|
+
types: [Organization.Organization, Person.Person],
|
|
258
106
|
}),
|
|
259
107
|
],
|
|
260
108
|
parameters: {
|
|
109
|
+
layout: 'fullscreen',
|
|
261
110
|
translations,
|
|
262
111
|
},
|
|
263
|
-
} satisfies Meta<
|
|
112
|
+
} satisfies Meta<StoryProps>;
|
|
264
113
|
|
|
265
114
|
export default meta;
|
|
266
115
|
|
|
267
|
-
type Story = StoryObj<
|
|
116
|
+
type Story = StoryObj<StoryProps>;
|
|
268
117
|
|
|
269
|
-
export const Default: Story = {
|
|
118
|
+
export const Default: Story = {
|
|
119
|
+
args: {
|
|
120
|
+
generator: createMessageGenerator(),
|
|
121
|
+
wait: true,
|
|
122
|
+
},
|
|
123
|
+
};
|
|
270
124
|
|
|
271
125
|
export const Delayed: Story = {
|
|
272
126
|
args: {
|
|
273
|
-
|
|
127
|
+
generator: createMessageGenerator(),
|
|
128
|
+
delay: 1_000,
|
|
129
|
+
fadeIn: true,
|
|
130
|
+
cursor: false,
|
|
274
131
|
},
|
|
275
132
|
};
|
|
276
133
|
|
|
277
|
-
export const
|
|
278
|
-
|
|
279
|
-
<div className='
|
|
280
|
-
<
|
|
134
|
+
export const Raw: Story = {
|
|
135
|
+
render: () => (
|
|
136
|
+
<div className='contents' style={{ '--user-fill': 'var(--dx-amberFill)' } as CSSProperties}>
|
|
137
|
+
<MarkdownStream content={TEXT} />
|
|
281
138
|
</div>
|
|
282
|
-
)
|
|
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
|
+
),
|
|
283
148
|
};
|
|
@@ -2,78 +2,86 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import React, { type CSSProperties,
|
|
5
|
+
import React, { type CSSProperties, forwardRef, useCallback, useEffect, useMemo } from 'react';
|
|
6
6
|
|
|
7
|
-
import { invariant } from '@dxos/invariant';
|
|
8
7
|
import { PublicKey } from '@dxos/keys';
|
|
9
8
|
import { type Identity } from '@dxos/react-client/halo';
|
|
10
|
-
import { type ThemedClassName } from '@dxos/react-ui';
|
|
11
|
-
import {
|
|
9
|
+
import { type ThemedClassName, useForwardedRef } from '@dxos/react-ui';
|
|
10
|
+
import { MarkdownStream, type MarkdownStreamController, type MarkdownStreamProps } from '@dxos/react-ui-components';
|
|
12
11
|
import { mx } from '@dxos/react-ui-theme';
|
|
13
|
-
import { type
|
|
12
|
+
import { type Message } from '@dxos/types';
|
|
14
13
|
import { keyToFallback } from '@dxos/util';
|
|
15
14
|
|
|
16
|
-
import {
|
|
17
|
-
|
|
15
|
+
import { type ChatEvent } from '../Chat';
|
|
16
|
+
|
|
17
|
+
import { blockToMarkdown, componentRegistry } from './registry';
|
|
18
|
+
import { MessageSyncer } from './sync';
|
|
18
19
|
|
|
19
20
|
export type ChatThreadProps = ThemedClassName<
|
|
20
21
|
{
|
|
21
22
|
identity?: Identity;
|
|
22
|
-
messages?:
|
|
23
|
+
messages?: Message.Message[];
|
|
23
24
|
error?: Error;
|
|
24
|
-
|
|
25
|
+
onEvent?: (event: ChatEvent) => void;
|
|
26
|
+
} & Pick<MarkdownStreamProps, 'cursor' | 'fadeIn' | 'debug'>
|
|
25
27
|
>;
|
|
26
28
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
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
|
+
);
|
|
32
42
|
|
|
33
43
|
// Show error.
|
|
34
44
|
useEffect(() => {
|
|
35
|
-
|
|
36
|
-
}, [error]);
|
|
45
|
+
controller?.scrollToBottom();
|
|
46
|
+
}, [controller, error]);
|
|
37
47
|
|
|
38
|
-
//
|
|
39
|
-
const
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
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');
|
|
44
54
|
}
|
|
45
|
-
}, [
|
|
55
|
+
}, [syncer, messages]);
|
|
46
56
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
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
|
+
);
|
|
53
69
|
|
|
54
70
|
return (
|
|
55
|
-
<
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
<ChatMessage message={message} debug={debug} onEvent={onEvent} {...props} />
|
|
70
|
-
</Fragment>
|
|
71
|
-
))}
|
|
72
|
-
|
|
73
|
-
{error && <ChatError error={error} onEvent={onEvent} />}
|
|
74
|
-
</ScrollContainer.Content>
|
|
75
|
-
<ScrollContainer.ScrollDownButton />
|
|
76
|
-
</ScrollContainer.Root>
|
|
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>
|
|
77
85
|
);
|
|
78
86
|
},
|
|
79
87
|
);
|
|
@@ -2,14 +2,12 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import React from 'react';
|
|
5
|
+
import React, { useMemo } from 'react';
|
|
6
6
|
|
|
7
7
|
import { type Space } from '@dxos/client/echo';
|
|
8
|
-
import { Obj
|
|
8
|
+
import { Obj } from '@dxos/echo';
|
|
9
9
|
import { type DXN } from '@dxos/keys';
|
|
10
|
-
import {
|
|
11
|
-
|
|
12
|
-
import { useResolvedRef } from '../../hooks';
|
|
10
|
+
import { DxAnchor } from '@dxos/lit-ui/react';
|
|
13
11
|
|
|
14
12
|
export type ObjectLinkProps = {
|
|
15
13
|
space: Space;
|
|
@@ -17,7 +15,12 @@ export type ObjectLinkProps = {
|
|
|
17
15
|
};
|
|
18
16
|
|
|
19
17
|
export const ObjectLink = ({ space, dxn }: ObjectLinkProps) => {
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
|
|
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
|
+
);
|
|
23
26
|
};
|
|
@@ -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) => {
|