@dxos/plugin-assistant 0.8.4-main.5acf9ea → 0.8.4-main.5ea62a8
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/{BlueprintContainer-IZ4AK5EO.mjs → BlueprintContainer-OWUSKPRK.mjs} +4 -3
- package/dist/lib/browser/ChatCompanion-FRCVSLPP.mjs +126 -0
- package/dist/lib/browser/ChatCompanion-FRCVSLPP.mjs.map +7 -0
- package/dist/lib/browser/{ChatContainer-RP3QEXYX.mjs → ChatContainer-YBJBIVUZ.mjs} +34 -13
- package/dist/lib/browser/ChatContainer-YBJBIVUZ.mjs.map +7 -0
- package/dist/lib/browser/{ChatDialog-ZVLXFHEY.mjs → ChatDialog-MTPJLEHM.mjs} +26 -9
- package/dist/lib/browser/ChatDialog-MTPJLEHM.mjs.map +7 -0
- package/dist/lib/browser/{SequenceContainer-3UDVKWPA.mjs → SequenceContainer-TF5QNXYM.mjs} +5 -17
- package/dist/lib/browser/SequenceContainer-TF5QNXYM.mjs.map +7 -0
- package/dist/lib/browser/ai-service-NRZPTUHO.mjs +22 -0
- package/dist/lib/browser/ai-service-NRZPTUHO.mjs.map +7 -0
- package/dist/lib/browser/{app-graph-builder-XSEOKJLG.mjs → app-graph-builder-7AAWTWGA.mjs} +25 -36
- package/dist/lib/browser/app-graph-builder-7AAWTWGA.mjs.map +7 -0
- package/dist/lib/browser/blueprint-definition-CRZPIA5A.mjs +12 -0
- package/dist/lib/browser/blueprint-definition-CRZPIA5A.mjs.map +7 -0
- package/dist/lib/browser/chunk-6QMISAU6.mjs +167 -0
- package/dist/lib/browser/chunk-6QMISAU6.mjs.map +7 -0
- package/dist/lib/browser/{chunk-LERGF5YG.mjs → chunk-CFXXQM25.mjs} +96 -22
- package/dist/lib/browser/chunk-CFXXQM25.mjs.map +7 -0
- package/dist/lib/browser/chunk-IJAJRAR7.mjs +18 -0
- package/dist/lib/browser/chunk-IJAJRAR7.mjs.map +7 -0
- package/dist/lib/browser/chunk-J5LGTIGS.mjs +10 -0
- package/dist/lib/browser/chunk-J5LGTIGS.mjs.map +7 -0
- package/dist/lib/browser/chunk-O4LUJEDV.mjs +20 -0
- package/dist/lib/browser/{chunk-FDCJSQYF.mjs.map → chunk-O4LUJEDV.mjs.map} +2 -2
- package/dist/lib/browser/chunk-OYFQS7JM.mjs +157 -0
- package/dist/lib/browser/chunk-OYFQS7JM.mjs.map +7 -0
- package/dist/lib/browser/chunk-SMIVXXAI.mjs +202 -0
- package/dist/lib/browser/chunk-SMIVXXAI.mjs.map +7 -0
- package/dist/lib/browser/chunk-V5H5CCZA.mjs +218 -0
- package/dist/lib/browser/chunk-V5H5CCZA.mjs.map +7 -0
- package/dist/lib/browser/chunk-XL557TXF.mjs +2332 -0
- package/dist/lib/browser/chunk-XL557TXF.mjs.map +7 -0
- package/dist/lib/browser/edge-model-resolver-E5M3CC46.mjs +22 -0
- package/dist/lib/browser/edge-model-resolver-E5M3CC46.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +134 -59
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/intent-resolver-BQO5SVGI.mjs +112 -0
- package/dist/lib/browser/intent-resolver-BQO5SVGI.mjs.map +7 -0
- package/dist/lib/browser/local-model-resolver-VZ5WZQIC.mjs +21 -0
- package/dist/lib/browser/local-model-resolver-VZ5WZQIC.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/{react-surface-3GYEHQRP.mjs → react-surface-VNCD2H7C.mjs} +25 -66
- package/dist/lib/browser/react-surface-VNCD2H7C.mjs.map +7 -0
- package/dist/lib/browser/{settings-5GTTCVGD.mjs → settings-36V3VUMW.mjs} +6 -5
- package/dist/lib/{node-esm/settings-J2EXEM5H.mjs.map → browser/settings-36V3VUMW.mjs.map} +1 -1
- package/dist/lib/browser/state-D5IVKNYG.mjs +21 -0
- package/dist/lib/browser/state-D5IVKNYG.mjs.map +7 -0
- package/dist/lib/browser/toolkit-Y5OYX5PO.mjs +191 -0
- package/dist/lib/browser/toolkit-Y5OYX5PO.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +7 -4
- package/dist/lib/node-esm/{BlueprintContainer-RGTMNLNX.mjs → BlueprintContainer-UFVWCRN6.mjs} +4 -3
- package/dist/lib/{browser/BlueprintContainer-IZ4AK5EO.mjs.map → node-esm/BlueprintContainer-UFVWCRN6.mjs.map} +1 -1
- package/dist/lib/node-esm/ChatCompanion-ZNRZEKH5.mjs +127 -0
- package/dist/lib/node-esm/ChatCompanion-ZNRZEKH5.mjs.map +7 -0
- package/dist/lib/node-esm/{ChatContainer-W3W6FWV3.mjs → ChatContainer-TUCITJJW.mjs} +34 -13
- package/dist/lib/node-esm/ChatContainer-TUCITJJW.mjs.map +7 -0
- package/dist/lib/node-esm/{ChatDialog-QW4JRKVO.mjs → ChatDialog-JLM7RDZQ.mjs} +26 -9
- package/dist/lib/node-esm/ChatDialog-JLM7RDZQ.mjs.map +7 -0
- package/dist/lib/node-esm/{SequenceContainer-RQQH5XOC.mjs → SequenceContainer-UXOVZPZO.mjs} +5 -17
- package/dist/lib/node-esm/SequenceContainer-UXOVZPZO.mjs.map +7 -0
- package/dist/lib/node-esm/ai-service-UDEPIPTO.mjs +23 -0
- package/dist/lib/node-esm/ai-service-UDEPIPTO.mjs.map +7 -0
- package/dist/lib/node-esm/{app-graph-builder-PANCJUHV.mjs → app-graph-builder-PNAFQUYT.mjs} +25 -36
- package/dist/lib/node-esm/app-graph-builder-PNAFQUYT.mjs.map +7 -0
- package/dist/lib/node-esm/blueprint-definition-275J3XL2.mjs +13 -0
- package/dist/lib/node-esm/blueprint-definition-275J3XL2.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-2X6VEO32.mjs +2333 -0
- package/dist/lib/node-esm/chunk-2X6VEO32.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-7YOGZI66.mjs +203 -0
- package/dist/lib/node-esm/chunk-7YOGZI66.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-CAQKGW3B.mjs +159 -0
- package/dist/lib/node-esm/chunk-CAQKGW3B.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-MS3PJARN.mjs → chunk-FNZJJL7G.mjs} +96 -22
- package/dist/lib/node-esm/chunk-FNZJJL7G.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-HSLMI22Q.mjs +11 -0
- package/dist/lib/node-esm/chunk-HSLMI22Q.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-RLBN4RNR.mjs +168 -0
- package/dist/lib/node-esm/chunk-RLBN4RNR.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-UWUUZQWJ.mjs +219 -0
- package/dist/lib/node-esm/chunk-UWUUZQWJ.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-VFY2JG62.mjs +22 -0
- package/dist/lib/node-esm/{chunk-QN2H2EHV.mjs.map → chunk-VFY2JG62.mjs.map} +2 -2
- package/dist/lib/node-esm/chunk-YPXEA46Q.mjs +19 -0
- package/dist/lib/node-esm/chunk-YPXEA46Q.mjs.map +7 -0
- package/dist/lib/node-esm/edge-model-resolver-SZHDLXCT.mjs +23 -0
- package/dist/lib/node-esm/edge-model-resolver-SZHDLXCT.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +134 -59
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/intent-resolver-FIS3T5KP.mjs +113 -0
- package/dist/lib/node-esm/intent-resolver-FIS3T5KP.mjs.map +7 -0
- package/dist/lib/node-esm/local-model-resolver-2KCBKMYA.mjs +22 -0
- package/dist/lib/node-esm/local-model-resolver-2KCBKMYA.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/{react-surface-QDQWJ7FZ.mjs → react-surface-4NLRKNBU.mjs} +25 -66
- package/dist/lib/node-esm/react-surface-4NLRKNBU.mjs.map +7 -0
- package/dist/lib/node-esm/{settings-J2EXEM5H.mjs → settings-7ZCZ6AS5.mjs} +6 -5
- package/dist/lib/{browser/settings-5GTTCVGD.mjs.map → node-esm/settings-7ZCZ6AS5.mjs.map} +1 -1
- package/dist/lib/node-esm/state-4VLKPLW3.mjs +22 -0
- package/dist/lib/node-esm/state-4VLKPLW3.mjs.map +7 -0
- package/dist/lib/node-esm/toolkit-2F2OL6WB.mjs +192 -0
- package/dist/lib/node-esm/toolkit-2F2OL6WB.mjs.map +7 -0
- package/dist/lib/node-esm/types/index.mjs +7 -4
- package/dist/types/src/AssistantPlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/ai-service.d.ts +5 -0
- package/dist/types/src/capabilities/ai-service.d.ts.map +1 -0
- package/dist/types/src/capabilities/app-graph-builder.d.ts +1 -1
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
- package/dist/types/src/capabilities/blueprint-definition.d.ts +7 -0
- package/dist/types/src/capabilities/blueprint-definition.d.ts.map +1 -0
- package/dist/types/src/capabilities/capabilities.d.ts +19 -0
- package/dist/types/src/capabilities/capabilities.d.ts.map +1 -0
- package/dist/types/src/capabilities/edge-model-resolver.d.ts +4 -0
- package/dist/types/src/capabilities/edge-model-resolver.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +11 -3
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/intent-resolver.d.ts +1 -1
- package/dist/types/src/capabilities/intent-resolver.d.ts.map +1 -1
- package/dist/types/src/capabilities/local-model-resolver.d.ts +10 -0
- package/dist/types/src/capabilities/local-model-resolver.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface.d.ts +1 -1
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
- package/dist/types/src/capabilities/settings.d.ts +1 -1
- package/dist/types/src/capabilities/state.d.ts +4 -0
- package/dist/types/src/capabilities/state.d.ts.map +1 -0
- package/dist/types/src/capabilities/toolkit.d.ts +4 -0
- package/dist/types/src/capabilities/toolkit.d.ts.map +1 -0
- package/dist/types/src/components/AssistantSettings/AssistantSettings.d.ts.map +1 -1
- package/dist/types/src/components/Chat/Chat.d.ts +19 -16
- package/dist/types/src/components/Chat/Chat.d.ts.map +1 -1
- package/dist/types/src/components/Chat/events.d.ts +5 -0
- package/dist/types/src/components/Chat/events.d.ts.map +1 -1
- package/dist/types/src/components/ChatCompanion.d.ts +13 -0
- package/dist/types/src/components/ChatCompanion.d.ts.map +1 -0
- package/dist/types/src/components/ChatContainer.d.ts +4 -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 +7 -0
- package/dist/types/src/components/ChatProgress/ChatProgress.d.ts.map +1 -0
- package/dist/types/src/components/ChatProgress/index.d.ts +2 -0
- package/dist/types/src/components/ChatProgress/index.d.ts.map +1 -0
- package/dist/types/src/components/ChatPrompt/ChatActions.d.ts.map +1 -1
- package/dist/types/src/components/ChatPrompt/ChatOptions.d.ts +20 -0
- package/dist/types/src/components/ChatPrompt/ChatOptions.d.ts.map +1 -0
- package/dist/types/src/components/ChatPrompt/ChatPresets.d.ts.map +1 -1
- package/dist/types/src/components/ChatPrompt/ChatReferences.d.ts +4 -5
- package/dist/types/src/components/ChatPrompt/ChatReferences.d.ts.map +1 -1
- package/dist/types/src/components/ChatPrompt/ChatStatusIndicator.d.ts +6 -4
- package/dist/types/src/components/ChatPrompt/ChatStatusIndicator.d.ts.map +1 -1
- package/dist/types/src/components/ChatPrompt/index.d.ts +1 -1
- package/dist/types/src/components/ChatPrompt/index.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/ChatMessage.d.ts +21 -5
- package/dist/types/src/components/ChatThread/ChatMessage.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/ChatThread.d.ts +4 -4
- package/dist/types/src/components/ChatThread/ChatThread.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/ChatThread.stories.d.ts +108 -30
- package/dist/types/src/components/ChatThread/ChatThread.stories.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/Link.d.ts +9 -0
- package/dist/types/src/components/ChatThread/Link.d.ts.map +1 -0
- package/dist/types/src/components/ChatThread/ToolBlock.d.ts +12 -12
- package/dist/types/src/components/ChatThread/ToolBlock.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/reducers.d.ts +40 -0
- package/dist/types/src/components/ChatThread/reducers.d.ts.map +1 -0
- package/dist/types/src/components/PromptSettings.d.ts.map +1 -1
- package/dist/types/src/components/SequenceContainer.d.ts.map +1 -1
- package/dist/types/src/components/SequenceEditor/SequenceEditor.d.ts.map +1 -1
- package/dist/types/src/components/SequenceEditor/SequenceEditor.stories.d.ts +257 -2
- package/dist/types/src/components/SequenceEditor/SequenceEditor.stories.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/TemplateEditor.d.ts +0 -5
- package/dist/types/src/components/TemplateEditor/TemplateEditor.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/TemplateEditor.stories.d.ts +257 -6
- package/dist/types/src/components/TemplateEditor/TemplateEditor.stories.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/TemplateForm.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/TemplateForm.stories.d.ts +254 -1
- package/dist/types/src/components/TemplateEditor/TemplateForm.stories.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/handlebars-extension.d.ts +12 -0
- package/dist/types/src/components/TemplateEditor/handlebars-extension.d.ts.map +1 -0
- package/dist/types/src/components/Toolbar/Toolbar.d.ts +4 -0
- package/dist/types/src/components/Toolbar/Toolbar.d.ts.map +1 -0
- package/dist/types/src/components/Toolbar/index.d.ts +2 -0
- package/dist/types/src/components/Toolbar/index.d.ts.map +1 -0
- package/dist/types/src/components/Toolbar/useChatToolbarActions.d.ts +11 -0
- package/dist/types/src/components/Toolbar/useChatToolbarActions.d.ts.map +1 -0
- package/dist/types/src/components/Toolbox/Toolbox.d.ts +4 -9
- package/dist/types/src/components/Toolbox/Toolbox.d.ts.map +1 -1
- package/dist/types/src/components/Toolbox/Toolbox.stories.d.ts +258 -4
- package/dist/types/src/components/Toolbox/Toolbox.stories.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +4 -1
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/events.d.ts +1 -1
- package/dist/types/src/events.d.ts.map +1 -1
- package/dist/types/src/execution-graph/execution-graph.d.ts +21 -0
- package/dist/types/src/execution-graph/execution-graph.d.ts.map +1 -0
- package/dist/types/src/execution-graph/index.d.ts +2 -0
- package/dist/types/src/execution-graph/index.d.ts.map +1 -0
- package/dist/types/src/functions/analysis.d.ts +5 -0
- package/dist/types/src/functions/analysis.d.ts.map +1 -0
- package/dist/types/src/functions/index.d.ts +4 -0
- package/dist/types/src/functions/index.d.ts.map +1 -0
- package/dist/types/src/functions/list.d.ts +10 -0
- package/dist/types/src/functions/list.d.ts.map +1 -0
- package/dist/types/src/functions/load.d.ts +8 -0
- package/dist/types/src/functions/load.d.ts.map +1 -0
- package/dist/types/src/hooks/index.d.ts +10 -3
- package/dist/types/src/hooks/index.d.ts.map +1 -1
- package/dist/types/src/hooks/useBlueprintRegistry.d.ts +24 -0
- package/dist/types/src/hooks/useBlueprintRegistry.d.ts.map +1 -0
- package/dist/types/src/hooks/useChatProcessor.d.ts +7 -20
- package/dist/types/src/hooks/useChatProcessor.d.ts.map +1 -1
- package/dist/types/src/hooks/useChatServices.d.ts +4 -5
- package/dist/types/src/hooks/useChatServices.d.ts.map +1 -1
- package/dist/types/src/hooks/useContextBinder.d.ts +4 -0
- package/dist/types/src/hooks/useContextBinder.d.ts.map +1 -0
- package/dist/types/src/hooks/useContextObjects.d.ts +15 -0
- package/dist/types/src/hooks/useContextObjects.d.ts.map +1 -0
- package/dist/types/src/hooks/useExecutionGraph.d.ts +7 -0
- package/dist/types/src/hooks/useExecutionGraph.d.ts.map +1 -0
- package/dist/types/src/hooks/useFlush.d.ts +6 -0
- package/dist/types/src/hooks/useFlush.d.ts.map +1 -0
- package/dist/types/src/hooks/useItemTypes.d.ts +4 -0
- package/dist/types/src/hooks/useItemTypes.d.ts.map +1 -0
- package/dist/types/src/hooks/useMatcherExtension.d.ts +3 -0
- package/dist/types/src/hooks/useMatcherExtension.d.ts.map +1 -0
- package/dist/types/src/hooks/useOnline.d.ts +3 -0
- package/dist/types/src/hooks/useOnline.d.ts.map +1 -0
- package/dist/types/src/hooks/usePresets.d.ts +7 -0
- package/dist/types/src/hooks/usePresets.d.ts.map +1 -0
- package/dist/types/src/hooks/useReferencesProvider.d.ts.map +1 -1
- package/dist/types/src/hooks/useResolveRef.d.ts +4 -0
- package/dist/types/src/hooks/useResolveRef.d.ts.map +1 -0
- package/dist/types/src/parser/filter-generator.d.ts.map +1 -1
- package/dist/types/src/parser/query-parser.d.ts.map +1 -1
- package/dist/types/src/parser/types.d.ts.map +1 -1
- package/dist/types/src/processor/index.d.ts +3 -0
- package/dist/types/src/processor/index.d.ts.map +1 -0
- package/dist/types/src/{hooks → processor}/presets.d.ts +2 -2
- package/dist/types/src/processor/presets.d.ts.map +1 -0
- package/dist/types/src/processor/processor.d.ts +80 -0
- package/dist/types/src/processor/processor.d.ts.map +1 -0
- package/dist/types/src/processor/processor.test.d.ts +2 -0
- package/dist/types/src/processor/processor.test.d.ts.map +1 -0
- package/dist/types/src/stories/Chat.stories.d.ts +22 -203
- package/dist/types/src/stories/Chat.stories.d.ts.map +1 -1
- package/dist/types/src/stories/components/BlueprintContainer.d.ts +4 -0
- package/dist/types/src/stories/components/BlueprintContainer.d.ts.map +1 -0
- package/dist/types/src/stories/components/ChatContainer.d.ts +4 -0
- package/dist/types/src/stories/components/ChatContainer.d.ts.map +1 -0
- package/dist/types/src/stories/components/CommentsContainer.d.ts +4 -0
- package/dist/types/src/stories/components/CommentsContainer.d.ts.map +1 -0
- package/dist/types/src/stories/components/GraphContainer.d.ts +6 -0
- package/dist/types/src/stories/components/GraphContainer.d.ts.map +1 -0
- package/dist/types/src/stories/components/LoggingContainer.d.ts +4 -0
- package/dist/types/src/stories/components/LoggingContainer.d.ts.map +1 -0
- package/dist/types/src/stories/components/MessageContainer.d.ts +4 -0
- package/dist/types/src/stories/components/MessageContainer.d.ts.map +1 -0
- package/dist/types/src/stories/components/SurfaceContainer.d.ts +8 -0
- package/dist/types/src/stories/components/SurfaceContainer.d.ts.map +1 -0
- package/dist/types/src/stories/components/TasksContainer.d.ts +4 -0
- package/dist/types/src/stories/components/TasksContainer.d.ts.map +1 -0
- package/dist/types/src/stories/components/TokenManagerContainer.d.ts +3 -0
- package/dist/types/src/stories/components/TokenManagerContainer.d.ts.map +1 -0
- package/dist/types/src/stories/components/index.d.ts +11 -0
- package/dist/types/src/stories/components/index.d.ts.map +1 -0
- package/dist/types/src/stories/components/types.d.ts +7 -0
- package/dist/types/src/stories/components/types.d.ts.map +1 -0
- package/dist/types/src/stories/testing/data.d.ts +5 -0
- package/dist/types/src/stories/testing/data.d.ts.map +1 -0
- package/dist/types/src/stories/testing/index.d.ts +3 -0
- package/dist/types/src/stories/testing/index.d.ts.map +1 -0
- package/dist/types/src/stories/testing/testing.d.ts +44 -0
- package/dist/types/src/stories/testing/testing.d.ts.map +1 -0
- package/dist/types/src/testing/index.d.ts +2 -1
- package/dist/types/src/testing/index.d.ts.map +1 -1
- package/dist/types/src/testing/test-data.d.ts +4 -0
- package/dist/types/src/testing/test-data.d.ts.map +1 -0
- package/dist/types/src/testing/test-functions.d.ts +5 -2
- package/dist/types/src/testing/test-functions.d.ts.map +1 -1
- package/dist/types/src/testing/test-sequence.d.ts +0 -4
- package/dist/types/src/testing/test-sequence.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +26 -11
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/Assistant.d.ts +42 -0
- package/dist/types/src/types/Assistant.d.ts.map +1 -0
- package/dist/types/src/types/AssistantAction.d.ts +107 -0
- package/dist/types/src/types/AssistantAction.d.ts.map +1 -0
- package/dist/types/src/types/defs.d.ts +2 -0
- package/dist/types/src/types/defs.d.ts.map +1 -0
- package/dist/types/src/types/index.d.ts +3 -1
- package/dist/types/src/types/index.d.ts.map +1 -1
- package/dist/types/src/types/service.d.ts +9 -6
- package/dist/types/src/types/service.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +99 -81
- package/src/AssistantPlugin.tsx +52 -16
- package/src/capabilities/ai-service.ts +28 -0
- package/src/capabilities/app-graph-builder.ts +41 -48
- package/src/capabilities/blueprint-definition.ts +42 -0
- package/src/capabilities/capabilities.ts +31 -0
- package/src/capabilities/edge-model-resolver.ts +27 -0
- package/src/capabilities/index.ts +9 -0
- package/src/capabilities/intent-resolver.ts +45 -23
- package/src/capabilities/local-model-resolver.ts +32 -0
- package/src/capabilities/react-surface.tsx +10 -57
- package/src/capabilities/state.ts +20 -0
- package/src/capabilities/toolkit.ts +163 -0
- package/src/components/AssistantSettings/AssistantSettings.tsx +83 -76
- package/src/components/Chat/Chat.tsx +171 -165
- package/src/components/Chat/events.ts +7 -0
- package/src/components/ChatCompanion.tsx +111 -0
- package/src/components/ChatContainer.tsx +19 -13
- package/src/components/ChatDialog.tsx +11 -7
- package/src/components/ChatProgress/ChatProgress.tsx +68 -0
- package/src/components/ChatProgress/index.ts +5 -0
- package/src/components/ChatPrompt/ChatActions.tsx +10 -24
- package/src/components/ChatPrompt/ChatOptions.tsx +233 -0
- package/src/components/ChatPrompt/ChatPresets.tsx +1 -0
- package/src/components/ChatPrompt/ChatReferences.tsx +31 -36
- package/src/components/ChatPrompt/ChatStatusIndicator.tsx +25 -22
- package/src/components/ChatPrompt/index.ts +1 -1
- package/src/components/ChatThread/ChatMessage.tsx +214 -148
- package/src/components/ChatThread/ChatThread.stories.tsx +244 -104
- package/src/components/ChatThread/ChatThread.tsx +44 -22
- package/src/components/ChatThread/Link.tsx +23 -0
- package/src/components/ChatThread/ToolBlock.tsx +103 -77
- package/src/components/ChatThread/reducers.ts +151 -0
- package/src/components/PromptSettings.tsx +1 -0
- package/src/components/SequenceContainer.tsx +27 -28
- package/src/components/SequenceEditor/SequenceEditor.stories.tsx +5 -4
- package/src/components/SequenceEditor/SequenceEditor.tsx +1 -1
- package/src/components/TemplateEditor/TemplateEditor.stories.tsx +25 -12
- package/src/components/TemplateEditor/TemplateEditor.tsx +14 -47
- package/src/components/TemplateEditor/TemplateForm.stories.tsx +12 -5
- package/src/components/TemplateEditor/TemplateForm.tsx +3 -1
- package/src/components/TemplateEditor/handlebars-extension.ts +165 -0
- package/src/components/Toolbar/Toolbar.tsx +20 -0
- package/src/components/Toolbar/index.ts +5 -0
- package/src/components/Toolbar/useChatToolbarActions.ts +125 -0
- package/src/components/Toolbox/Toolbox.stories.tsx +10 -16
- package/src/components/Toolbox/Toolbox.tsx +21 -51
- package/src/components/index.ts +3 -4
- package/src/events.ts +2 -2
- package/src/execution-graph/execution-graph.ts +211 -0
- package/src/execution-graph/index.ts +5 -0
- package/src/functions/analysis.ts +20 -0
- package/src/functions/index.ts +7 -0
- package/src/functions/list.ts +46 -0
- package/src/functions/load.ts +43 -0
- package/src/hooks/index.ts +10 -4
- package/src/hooks/useBlueprintRegistry.ts +80 -0
- package/src/hooks/useChatProcessor.ts +20 -97
- package/src/hooks/useChatServices.ts +29 -32
- package/src/hooks/useContextBinder.ts +18 -0
- package/src/hooks/useContextObjects.ts +58 -0
- package/src/hooks/useExecutionGraph.ts +20 -0
- package/src/hooks/useFlush.ts +35 -0
- package/src/hooks/useItemTypes.ts +37 -0
- package/src/hooks/useMatcherExtension.ts +45 -0
- package/src/hooks/useOnline.ts +10 -0
- package/src/hooks/usePresets.ts +44 -0
- package/src/hooks/useReferencesProvider.ts +11 -9
- package/src/hooks/useResolveRef.ts +33 -0
- package/src/meta.ts +1 -1
- package/src/parser/filter-generator.ts +8 -13
- package/src/parser/query-parser.ts +1 -1
- package/src/parser/types.ts +2 -0
- package/src/processor/index.ts +6 -0
- package/src/{hooks → processor}/presets.ts +14 -6
- package/src/processor/processor.test.ts +77 -0
- package/src/processor/processor.ts +304 -0
- package/src/queue-logger.ts +5 -5
- package/src/stories/Chat.stories.tsx +391 -293
- package/src/stories/components/BlueprintContainer.tsx +32 -0
- package/src/stories/components/ChatContainer.tsx +57 -0
- package/src/stories/components/CommentsContainer.tsx +25 -0
- package/src/stories/components/GraphContainer.tsx +118 -0
- package/src/stories/components/LoggingContainer.tsx +21 -0
- package/src/stories/components/MessageContainer.tsx +27 -0
- package/src/stories/components/SurfaceContainer.tsx +52 -0
- package/src/stories/components/TasksContainer.tsx +49 -0
- package/src/stories/components/TokenManagerContainer.tsx +14 -0
- package/src/stories/components/index.ts +15 -0
- package/src/stories/components/types.ts +11 -0
- package/src/stories/testing/data.ts +142 -0
- package/src/stories/testing/index.ts +6 -0
- package/src/stories/testing/testing.tsx +254 -0
- package/src/testing/index.ts +2 -1
- package/src/testing/test-data.ts +109 -0
- package/src/testing/test-functions.ts +8 -3
- package/src/testing/test-sequence.ts +2 -27
- package/src/translations.ts +30 -11
- package/src/types/Assistant.ts +61 -0
- package/src/types/AssistantAction.ts +62 -0
- package/src/types/defs.ts +5 -0
- package/src/types/index.ts +4 -1
- package/src/vite-env.d.ts +30 -0
- package/dist/lib/browser/ChatContainer-RP3QEXYX.mjs.map +0 -7
- package/dist/lib/browser/ChatDialog-ZVLXFHEY.mjs.map +0 -7
- package/dist/lib/browser/SequenceContainer-3UDVKWPA.mjs.map +0 -7
- package/dist/lib/browser/app-graph-builder-XSEOKJLG.mjs.map +0 -7
- package/dist/lib/browser/chunk-63GG6U6D.mjs +0 -2226
- package/dist/lib/browser/chunk-63GG6U6D.mjs.map +0 -7
- package/dist/lib/browser/chunk-7W7LHTRH.mjs +0 -171
- package/dist/lib/browser/chunk-7W7LHTRH.mjs.map +0 -7
- package/dist/lib/browser/chunk-FDCJSQYF.mjs +0 -40
- package/dist/lib/browser/chunk-KFXSBNZR.mjs +0 -89
- package/dist/lib/browser/chunk-KFXSBNZR.mjs.map +0 -7
- package/dist/lib/browser/chunk-LERGF5YG.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-MV3VSZLS.mjs +0 -75
- package/dist/lib/browser/intent-resolver-MV3VSZLS.mjs.map +0 -7
- package/dist/lib/browser/react-surface-3GYEHQRP.mjs.map +0 -7
- package/dist/lib/node-esm/ChatContainer-W3W6FWV3.mjs.map +0 -7
- package/dist/lib/node-esm/ChatDialog-QW4JRKVO.mjs.map +0 -7
- package/dist/lib/node-esm/SequenceContainer-RQQH5XOC.mjs.map +0 -7
- package/dist/lib/node-esm/app-graph-builder-PANCJUHV.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-BFO3KHYL.mjs +0 -2227
- package/dist/lib/node-esm/chunk-BFO3KHYL.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-MS3PJARN.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-QN2H2EHV.mjs +0 -41
- package/dist/lib/node-esm/chunk-VIIMA3XQ.mjs +0 -90
- package/dist/lib/node-esm/chunk-VIIMA3XQ.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-Z7PUODRT.mjs +0 -172
- package/dist/lib/node-esm/chunk-Z7PUODRT.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-3FMC3GHC.mjs +0 -76
- package/dist/lib/node-esm/intent-resolver-3FMC3GHC.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-QDQWJ7FZ.mjs.map +0 -7
- package/dist/types/src/capability-definitions.d.ts +0 -7
- package/dist/types/src/capability-definitions.d.ts.map +0 -1
- package/dist/types/src/components/ChatPrompt/ChatOptionsMenu.d.ts +0 -9
- package/dist/types/src/components/ChatPrompt/ChatOptionsMenu.d.ts.map +0 -1
- package/dist/types/src/components/ChatThread/reducer.d.ts +0 -12
- package/dist/types/src/components/ChatThread/reducer.d.ts.map +0 -1
- package/dist/types/src/hooks/chat-processor.d.ts +0 -86
- package/dist/types/src/hooks/chat-processor.d.ts.map +0 -1
- package/dist/types/src/hooks/chat-processor.test.d.ts +0 -2
- package/dist/types/src/hooks/chat-processor.test.d.ts.map +0 -1
- package/dist/types/src/hooks/presets.d.ts.map +0 -1
- package/dist/types/src/hooks/useBlueprints.d.ts +0 -9
- package/dist/types/src/hooks/useBlueprints.d.ts.map +0 -1
- package/dist/types/src/tools/function.d.ts +0 -5
- package/dist/types/src/tools/function.d.ts.map +0 -1
- package/dist/types/src/tools/index.d.ts +0 -3
- package/dist/types/src/tools/index.d.ts.map +0 -1
- package/dist/types/src/tools/openapi.d.ts +0 -10
- package/dist/types/src/tools/openapi.d.ts.map +0 -1
- package/dist/types/src/tools/openapi.test.d.ts +0 -2
- package/dist/types/src/tools/openapi.test.d.ts.map +0 -1
- package/dist/types/src/types/schema.d.ts +0 -120
- package/dist/types/src/types/schema.d.ts.map +0 -1
- package/src/capability-definitions.ts +0 -15
- package/src/components/ChatPrompt/ChatOptionsMenu.tsx +0 -52
- package/src/components/ChatThread/reducer.ts +0 -52
- package/src/hooks/chat-processor.test.ts +0 -16
- package/src/hooks/chat-processor.ts +0 -314
- package/src/hooks/useBlueprints.ts +0 -57
- package/src/shims.d.ts +0 -8
- package/src/tools/function.ts +0 -46
- package/src/tools/index.ts +0 -6
- package/src/tools/openapi.test.ts +0 -217
- package/src/tools/openapi.ts +0 -338
- package/src/types/schema.ts +0 -108
- package/src/typings.d.ts +0 -9
- /package/dist/lib/{node-esm/BlueprintContainer-RGTMNLNX.mjs.map → browser/BlueprintContainer-OWUSKPRK.mjs.map} +0 -0
|
@@ -4,20 +4,61 @@
|
|
|
4
4
|
|
|
5
5
|
import '@dxos-theme';
|
|
6
6
|
|
|
7
|
-
import { type
|
|
8
|
-
import
|
|
7
|
+
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
8
|
+
import { Effect, Layer } from 'effect';
|
|
9
|
+
import React, { useEffect, useMemo } from 'react';
|
|
9
10
|
|
|
11
|
+
import { IntentPlugin } from '@dxos/app-framework';
|
|
12
|
+
import { withPluginManager } from '@dxos/app-framework/testing';
|
|
10
13
|
import { Obj } from '@dxos/echo';
|
|
14
|
+
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';
|
|
11
19
|
import { faker } from '@dxos/random';
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
20
|
+
import { useQueue, useSpace } from '@dxos/react-client/echo';
|
|
21
|
+
import { defaultTx } from '@dxos/react-ui-theme';
|
|
22
|
+
import { type ContentBlock, DataType } from '@dxos/schema';
|
|
23
|
+
import { ColumnContainer, render, withLayout } from '@dxos/storybook-utils';
|
|
15
24
|
|
|
16
|
-
import { ChatThread } from './ChatThread';
|
|
17
25
|
import { translations } from '../../translations';
|
|
18
26
|
|
|
27
|
+
import { renderObjectLink } from './ChatMessage';
|
|
28
|
+
import { ChatThread, type ChatThreadProps } from './ChatThread';
|
|
29
|
+
|
|
19
30
|
faker.seed(1);
|
|
20
31
|
|
|
32
|
+
const StoryContainer = ({ delay = 0, ...props }: ChatThreadProps & { delay?: number }) => {
|
|
33
|
+
const space = useSpace();
|
|
34
|
+
const queueDxn = useMemo(() => space?.queues.create().dxn, [space]);
|
|
35
|
+
const queue = useQueue<DataType.Message>(queueDxn);
|
|
36
|
+
useEffect(() => {
|
|
37
|
+
if (!space || !queue) {
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
void Effect.runPromise(
|
|
42
|
+
Effect.gen(function* () {
|
|
43
|
+
for (const step of MESSAGES) {
|
|
44
|
+
yield* step;
|
|
45
|
+
yield* Effect.sleep(delay);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return queue;
|
|
49
|
+
}).pipe(Effect.provide(Layer.mergeAll(DatabaseService.layer(space.db), ContextQueueService.layer(queue)))),
|
|
50
|
+
);
|
|
51
|
+
}, [space, queue]);
|
|
52
|
+
|
|
53
|
+
if (!space) {
|
|
54
|
+
return null;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
return (
|
|
58
|
+
<ChatThread {...props} space={space} messages={queue?.objects ?? []} onEvent={(event) => console.log(event)} />
|
|
59
|
+
);
|
|
60
|
+
};
|
|
61
|
+
|
|
21
62
|
const createMessage = (role: DataType.ActorRole, blocks: ContentBlock.Any[]): DataType.Message => {
|
|
22
63
|
return Obj.make(DataType.Message, {
|
|
23
64
|
created: new Date().toISOString(),
|
|
@@ -26,88 +67,196 @@ const createMessage = (role: DataType.ActorRole, blocks: ContentBlock.Any[]): Da
|
|
|
26
67
|
});
|
|
27
68
|
};
|
|
28
69
|
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
{
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
{
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
{
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
70
|
+
const MESSAGES: Effect.Effect<void, never, DatabaseService | ContextQueueService>[] = [
|
|
71
|
+
Effect.gen(function* () {
|
|
72
|
+
const { queue } = yield* ContextQueueService;
|
|
73
|
+
yield* Effect.promise(() =>
|
|
74
|
+
queue.append([
|
|
75
|
+
createMessage('user', [
|
|
76
|
+
{
|
|
77
|
+
_tag: 'text',
|
|
78
|
+
text: faker.lorem.sentence(5),
|
|
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
|
+
}),
|
|
105
234
|
];
|
|
106
235
|
|
|
107
236
|
const meta = {
|
|
108
237
|
title: 'plugins/plugin-assistant/ChatThread',
|
|
109
238
|
component: ChatThread,
|
|
110
|
-
|
|
239
|
+
render: render(StoryContainer),
|
|
240
|
+
decorators: [
|
|
241
|
+
withPluginManager({
|
|
242
|
+
plugins: [
|
|
243
|
+
ClientPlugin({
|
|
244
|
+
onClientInitialized: async ({ client }) => {
|
|
245
|
+
await client.halo.createIdentity();
|
|
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]',
|
|
258
|
+
}),
|
|
259
|
+
],
|
|
111
260
|
parameters: {
|
|
112
261
|
translations,
|
|
113
262
|
},
|
|
@@ -117,27 +266,18 @@ export default meta;
|
|
|
117
266
|
|
|
118
267
|
type Story = StoryObj<typeof meta>;
|
|
119
268
|
|
|
120
|
-
export const Default = {
|
|
269
|
+
export const Default: Story = {};
|
|
270
|
+
|
|
271
|
+
export const Delayed: Story = {
|
|
121
272
|
args: {
|
|
122
|
-
|
|
273
|
+
delay: 2_000,
|
|
123
274
|
},
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
export const Incremental = {
|
|
127
|
-
render: () => {
|
|
128
|
-
const [messages, setMessages] = useState<DataType.Message[]>([]);
|
|
129
|
-
useEffect(() => {
|
|
130
|
-
let i = 0;
|
|
131
|
-
const interval = setInterval(() => {
|
|
132
|
-
setMessages((messages) => [...messages, TEST_MESSAGES[i++]]);
|
|
133
|
-
if (i >= TEST_MESSAGES.length) {
|
|
134
|
-
clearInterval(interval);
|
|
135
|
-
}
|
|
136
|
-
}, 2_000);
|
|
137
|
-
|
|
138
|
-
return () => clearInterval(interval);
|
|
139
|
-
}, []);
|
|
275
|
+
};
|
|
140
276
|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
277
|
+
export const Sanity = () => {
|
|
278
|
+
return (
|
|
279
|
+
<div className='grid grow place-items-center'>
|
|
280
|
+
<div className='p-8 border border-separator rounded'>DXOS</div>
|
|
281
|
+
</div>
|
|
282
|
+
);
|
|
283
|
+
};
|
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import React, { type CSSProperties, forwardRef, useMemo } from 'react';
|
|
5
|
+
import React, { type CSSProperties, Fragment, forwardRef, useEffect, useMemo } from 'react';
|
|
6
6
|
|
|
7
|
+
import { invariant } from '@dxos/invariant';
|
|
7
8
|
import { PublicKey } from '@dxos/keys';
|
|
8
9
|
import { type Identity } from '@dxos/react-client/halo';
|
|
9
10
|
import { type ThemedClassName } from '@dxos/react-ui';
|
|
@@ -12,46 +13,67 @@ import { mx } from '@dxos/react-ui-theme';
|
|
|
12
13
|
import { type DataType } from '@dxos/schema';
|
|
13
14
|
import { keyToFallback } from '@dxos/util';
|
|
14
15
|
|
|
15
|
-
import { ChatMessage, type ChatMessageProps } from './ChatMessage';
|
|
16
|
-
import {
|
|
16
|
+
import { ChatError, ChatMessage, type ChatMessageProps, styles } from './ChatMessage';
|
|
17
|
+
import { reduceMessages } from './reducers';
|
|
17
18
|
|
|
18
19
|
export type ChatThreadProps = ThemedClassName<
|
|
19
20
|
{
|
|
20
21
|
identity?: Identity;
|
|
21
22
|
messages?: DataType.Message[];
|
|
22
|
-
|
|
23
|
-
} & Pick<ChatMessageProps, 'debug' | 'space' | '
|
|
23
|
+
error?: Error;
|
|
24
|
+
} & Pick<ChatMessageProps, 'debug' | 'space' | 'toolProvider' | 'onEvent'>
|
|
24
25
|
>;
|
|
25
26
|
|
|
26
27
|
export const ChatThread = forwardRef<ScrollController, ChatThreadProps>(
|
|
27
|
-
({ classNames, identity, messages,
|
|
28
|
+
({ classNames, identity, messages = [], error, debug, onEvent, ...props }, forwardedRef) => {
|
|
28
29
|
const userHue = useMemo(() => {
|
|
29
30
|
return identity?.profile?.data?.hue || keyToFallback(identity?.identityKey ?? PublicKey.random()).hue;
|
|
30
31
|
}, [identity]);
|
|
31
32
|
|
|
32
|
-
//
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
33
|
+
// Show error.
|
|
34
|
+
useEffect(() => {
|
|
35
|
+
onEvent?.({ type: 'scroll-to-bottom' });
|
|
36
|
+
}, [error]);
|
|
37
|
+
|
|
38
|
+
// Reduce messages to collapse related blocks.
|
|
39
|
+
const reducedMessages = useMemo(() => {
|
|
40
|
+
if (!debug) {
|
|
41
|
+
return messages.reduce(reduceMessages, { messages: [] }).messages;
|
|
38
42
|
} else {
|
|
39
|
-
return
|
|
43
|
+
return messages;
|
|
40
44
|
}
|
|
41
|
-
}, [messages,
|
|
45
|
+
}, [messages, debug]);
|
|
46
|
+
|
|
47
|
+
const getDelta = (idx: number) => {
|
|
48
|
+
invariant(idx > 0);
|
|
49
|
+
const prev = new Date(reducedMessages[idx - 1].created).getTime();
|
|
50
|
+
const current = new Date(reducedMessages[idx].created).getTime();
|
|
51
|
+
return current - prev;
|
|
52
|
+
};
|
|
42
53
|
|
|
43
54
|
return (
|
|
44
|
-
<ScrollContainer ref={forwardedRef} classNames={classNames}
|
|
45
|
-
<
|
|
46
|
-
|
|
47
|
-
className={mx(filteredMessages.length > 0 && 'pbs-4 pbe-4')}
|
|
55
|
+
<ScrollContainer.Root pin fade ref={forwardedRef} classNames={classNames}>
|
|
56
|
+
<ScrollContainer.Content
|
|
57
|
+
classNames='relative flex flex-col gap-2 pbs-2 pbe-2'
|
|
48
58
|
style={{ '--user-fill': `var(--dx-${userHue}Fill)` } as CSSProperties}
|
|
49
59
|
>
|
|
50
|
-
{
|
|
51
|
-
<
|
|
60
|
+
{reducedMessages.map((message, idx) => (
|
|
61
|
+
<Fragment key={message.id}>
|
|
62
|
+
{debug && (
|
|
63
|
+
<div className={mx('flex justify-end text-subdued', styles.margin)}>
|
|
64
|
+
<pre className='text-xs'>
|
|
65
|
+
{JSON.stringify({ created: message.created, delta: idx > 0 ? getDelta(idx) : undefined })}
|
|
66
|
+
</pre>
|
|
67
|
+
</div>
|
|
68
|
+
)}
|
|
69
|
+
<ChatMessage message={message} debug={debug} onEvent={onEvent} {...props} />
|
|
70
|
+
</Fragment>
|
|
52
71
|
))}
|
|
53
|
-
|
|
54
|
-
|
|
72
|
+
|
|
73
|
+
{error && <ChatError error={error} onEvent={onEvent} />}
|
|
74
|
+
</ScrollContainer.Content>
|
|
75
|
+
<ScrollContainer.ScrollDownButton />
|
|
76
|
+
</ScrollContainer.Root>
|
|
55
77
|
);
|
|
56
78
|
},
|
|
57
79
|
);
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import React from 'react';
|
|
6
|
+
|
|
7
|
+
import { type Space } from '@dxos/client/echo';
|
|
8
|
+
import { Obj, Ref } from '@dxos/echo';
|
|
9
|
+
import { type DXN } from '@dxos/keys';
|
|
10
|
+
import { DxRefTag } from '@dxos/lit-ui/react';
|
|
11
|
+
|
|
12
|
+
import { useResolvedRef } from '../../hooks';
|
|
13
|
+
|
|
14
|
+
export type ObjectLinkProps = {
|
|
15
|
+
space: Space;
|
|
16
|
+
dxn: DXN;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export const ObjectLink = ({ space, dxn }: ObjectLinkProps) => {
|
|
20
|
+
const object = useResolvedRef(space, Ref.fromDXN(dxn));
|
|
21
|
+
const title = Obj.getLabel(object) ?? object?.id ?? dxn.toString();
|
|
22
|
+
return <DxRefTag refid={dxn.toString()}>{title}</DxRefTag>;
|
|
23
|
+
};
|