@dxos/plugin-assistant 0.8.3 → 0.8.4-main.5acf9ea
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/{TemplateContainer-QQHVOTSI.mjs → BlueprintContainer-IZ4AK5EO.mjs} +10 -10
- package/dist/lib/browser/BlueprintContainer-IZ4AK5EO.mjs.map +7 -0
- package/dist/lib/browser/ChatContainer-RP3QEXYX.mjs +54 -0
- package/dist/lib/browser/ChatContainer-RP3QEXYX.mjs.map +7 -0
- package/dist/lib/browser/ChatDialog-ZVLXFHEY.mjs +72 -0
- package/dist/lib/browser/ChatDialog-ZVLXFHEY.mjs.map +7 -0
- package/dist/lib/browser/SequenceContainer-3UDVKWPA.mjs +162 -0
- package/dist/lib/browser/SequenceContainer-3UDVKWPA.mjs.map +7 -0
- package/dist/lib/browser/{app-graph-builder-E4H5DCOJ.mjs → app-graph-builder-XSEOKJLG.mjs} +25 -86
- package/dist/lib/browser/app-graph-builder-XSEOKJLG.mjs.map +7 -0
- package/dist/lib/browser/chunk-63GG6U6D.mjs +2226 -0
- package/dist/lib/browser/chunk-63GG6U6D.mjs.map +7 -0
- package/dist/lib/browser/chunk-7W7LHTRH.mjs +171 -0
- package/dist/lib/browser/chunk-7W7LHTRH.mjs.map +7 -0
- package/dist/lib/{node/chunk-P74TWGMG.cjs → browser/chunk-FDCJSQYF.mjs} +10 -14
- package/dist/lib/{node-esm/chunk-BB2TAT4P.mjs.map → browser/chunk-FDCJSQYF.mjs.map} +1 -1
- package/dist/lib/browser/{chunk-JQFUME3B.mjs → chunk-KFXSBNZR.mjs} +36 -34
- package/dist/lib/browser/chunk-KFXSBNZR.mjs.map +7 -0
- package/dist/lib/browser/{chunk-BI6AHRNJ.mjs → chunk-LERGF5YG.mjs} +19 -68
- package/dist/lib/browser/chunk-LERGF5YG.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +99 -119
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/intent-resolver-MV3VSZLS.mjs +75 -0
- package/dist/lib/browser/intent-resolver-MV3VSZLS.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/{react-surface-LXCNUSZN.mjs → react-surface-3GYEHQRP.mjs} +44 -53
- package/dist/lib/browser/react-surface-3GYEHQRP.mjs.map +7 -0
- package/dist/lib/browser/{settings-XRHXVWGB.mjs → settings-5GTTCVGD.mjs} +6 -6
- package/dist/lib/browser/settings-5GTTCVGD.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +4 -20
- package/dist/lib/node-esm/{TemplateContainer-SOEWY2ZN.mjs → BlueprintContainer-RGTMNLNX.mjs} +10 -10
- package/dist/lib/node-esm/BlueprintContainer-RGTMNLNX.mjs.map +7 -0
- package/dist/lib/node-esm/ChatContainer-W3W6FWV3.mjs +55 -0
- package/dist/lib/node-esm/ChatContainer-W3W6FWV3.mjs.map +7 -0
- package/dist/lib/node-esm/ChatDialog-QW4JRKVO.mjs +73 -0
- package/dist/lib/node-esm/ChatDialog-QW4JRKVO.mjs.map +7 -0
- package/dist/lib/node-esm/SequenceContainer-RQQH5XOC.mjs +163 -0
- package/dist/lib/node-esm/SequenceContainer-RQQH5XOC.mjs.map +7 -0
- package/dist/lib/node-esm/{app-graph-builder-3SY5MBIK.mjs → app-graph-builder-PANCJUHV.mjs} +25 -86
- package/dist/lib/node-esm/app-graph-builder-PANCJUHV.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-BFO3KHYL.mjs +2227 -0
- package/dist/lib/node-esm/chunk-BFO3KHYL.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-UCOFKNKN.mjs → chunk-MS3PJARN.mjs} +19 -68
- package/dist/lib/node-esm/chunk-MS3PJARN.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-QN2H2EHV.mjs +41 -0
- package/dist/lib/{browser/chunk-XOZ7YMO3.mjs.map → node-esm/chunk-QN2H2EHV.mjs.map} +1 -1
- package/dist/lib/node-esm/{chunk-OYN6HLXZ.mjs → chunk-VIIMA3XQ.mjs} +36 -34
- package/dist/lib/node-esm/chunk-VIIMA3XQ.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-Z7PUODRT.mjs +172 -0
- package/dist/lib/node-esm/chunk-Z7PUODRT.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +99 -119
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/intent-resolver-3FMC3GHC.mjs +76 -0
- package/dist/lib/node-esm/intent-resolver-3FMC3GHC.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/{react-surface-7HA5EDWY.mjs → react-surface-QDQWJ7FZ.mjs} +44 -53
- package/dist/lib/node-esm/react-surface-QDQWJ7FZ.mjs.map +7 -0
- package/dist/lib/node-esm/{settings-5IAY6BT4.mjs → settings-J2EXEM5H.mjs} +6 -6
- package/dist/lib/node-esm/settings-J2EXEM5H.mjs.map +7 -0
- package/dist/lib/node-esm/types/index.mjs +4 -20
- package/dist/types/src/AssistantPlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
- package/dist/types/src/capabilities/index.d.ts +1 -3
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/intent-resolver.d.ts +2 -2
- package/dist/types/src/capabilities/intent-resolver.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
- package/dist/types/src/capability-definitions.d.ts +7 -0
- package/dist/types/src/capability-definitions.d.ts.map +1 -0
- package/dist/types/src/components/AssistantSettings/AssistantSettings.d.ts +2 -2
- package/dist/types/src/components/AssistantSettings/AssistantSettings.d.ts.map +1 -1
- package/dist/types/src/components/BlueprintContainer.d.ts +5 -6
- package/dist/types/src/components/BlueprintContainer.d.ts.map +1 -1
- package/dist/types/src/components/Chat/Chat.d.ts +47 -0
- package/dist/types/src/components/Chat/Chat.d.ts.map +1 -0
- package/dist/types/src/components/Chat/events.d.ts +30 -0
- package/dist/types/src/components/Chat/events.d.ts.map +1 -0
- package/dist/types/src/components/Chat/index.d.ts +3 -0
- package/dist/types/src/components/Chat/index.d.ts.map +1 -0
- package/dist/types/src/components/ChatContainer.d.ts +6 -6
- package/dist/types/src/components/ChatContainer.d.ts.map +1 -1
- package/dist/types/src/components/ChatDialog.d.ts +8 -0
- package/dist/types/src/components/ChatDialog.d.ts.map +1 -0
- package/dist/types/src/components/ChatPrompt/ChatActions.d.ts +11 -0
- package/dist/types/src/components/ChatPrompt/ChatActions.d.ts.map +1 -0
- package/dist/types/src/components/ChatPrompt/ChatOptionsMenu.d.ts +9 -0
- package/dist/types/src/components/ChatPrompt/ChatOptionsMenu.d.ts.map +1 -0
- package/dist/types/src/components/ChatPrompt/ChatPresets.d.ts +11 -0
- package/dist/types/src/components/ChatPrompt/ChatPresets.d.ts.map +1 -0
- package/dist/types/src/components/ChatPrompt/ChatReferences.d.ts +11 -0
- package/dist/types/src/components/ChatPrompt/ChatReferences.d.ts.map +1 -0
- package/dist/types/src/components/ChatPrompt/ChatStatusIndicator.d.ts +8 -0
- package/dist/types/src/components/ChatPrompt/ChatStatusIndicator.d.ts.map +1 -0
- package/dist/types/src/components/ChatPrompt/index.d.ts +6 -0
- package/dist/types/src/components/ChatPrompt/index.d.ts.map +1 -0
- package/dist/types/src/components/ChatThread/ChatMessage.d.ts +17 -0
- package/dist/types/src/components/ChatThread/ChatMessage.d.ts.map +1 -0
- package/dist/types/src/components/ChatThread/ChatThread.d.ts +19 -0
- package/dist/types/src/components/ChatThread/ChatThread.d.ts.map +1 -0
- package/dist/types/src/components/ChatThread/ChatThread.stories.d.ts +199 -0
- package/dist/types/src/components/ChatThread/ChatThread.stories.d.ts.map +1 -0
- package/dist/types/src/components/ChatThread/ToolBlock.d.ts +19 -0
- package/dist/types/src/components/ChatThread/ToolBlock.d.ts.map +1 -0
- package/dist/types/src/components/ChatThread/index.d.ts +2 -0
- package/dist/types/src/components/ChatThread/index.d.ts.map +1 -0
- package/dist/types/src/components/{Thread → ChatThread}/reducer.d.ts +4 -4
- package/dist/types/src/components/ChatThread/reducer.d.ts.map +1 -0
- package/dist/types/src/components/PromptSettings.d.ts +2 -2
- package/dist/types/src/components/PromptSettings.d.ts.map +1 -1
- package/dist/types/src/components/SequenceContainer.d.ts +8 -0
- package/dist/types/src/components/SequenceContainer.d.ts.map +1 -0
- package/dist/types/src/components/SequenceEditor/SequenceEditor.d.ts +13 -0
- package/dist/types/src/components/SequenceEditor/SequenceEditor.d.ts.map +1 -0
- package/dist/types/src/components/SequenceEditor/SequenceEditor.stories.d.ts +8 -0
- package/dist/types/src/components/SequenceEditor/SequenceEditor.stories.d.ts.map +1 -0
- package/dist/types/src/components/SequenceEditor/index.d.ts +2 -0
- package/dist/types/src/components/SequenceEditor/index.d.ts.map +1 -0
- package/dist/types/src/components/TemplateEditor/TemplateEditor.d.ts +4 -3
- package/dist/types/src/components/TemplateEditor/TemplateEditor.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/TemplateEditor.stories.d.ts +3 -3
- package/dist/types/src/components/TemplateEditor/TemplateEditor.stories.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/TemplateForm.d.ts +5 -4
- package/dist/types/src/components/TemplateEditor/TemplateForm.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/TemplateForm.stories.d.ts +1 -1
- package/dist/types/src/components/TemplateEditor/TemplateForm.stories.d.ts.map +1 -1
- package/dist/types/src/components/Toolbox/Toolbox.d.ts +11 -4
- package/dist/types/src/components/Toolbox/Toolbox.d.ts.map +1 -1
- package/dist/types/src/components/Toolbox/Toolbox.stories.d.ts +1 -1
- package/dist/types/src/components/Toolbox/Toolbox.stories.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +6 -12
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/events.d.ts.map +1 -1
- package/dist/types/src/hooks/{processor.d.ts → chat-processor.d.ts} +36 -22
- package/dist/types/src/hooks/chat-processor.d.ts.map +1 -0
- package/dist/types/src/hooks/chat-processor.test.d.ts +2 -0
- package/dist/types/src/hooks/chat-processor.test.d.ts.map +1 -0
- package/dist/types/src/hooks/index.d.ts +5 -5
- package/dist/types/src/hooks/index.d.ts.map +1 -1
- package/dist/types/src/hooks/presets.d.ts +13 -0
- package/dist/types/src/hooks/presets.d.ts.map +1 -0
- package/dist/types/src/hooks/useBlueprints.d.ts +9 -0
- package/dist/types/src/hooks/useBlueprints.d.ts.map +1 -0
- package/dist/types/src/hooks/useChatProcessor.d.ts +20 -8
- package/dist/types/src/hooks/useChatProcessor.d.ts.map +1 -1
- package/dist/types/src/hooks/useChatServices.d.ts +14 -0
- package/dist/types/src/hooks/useChatServices.d.ts.map +1 -0
- package/dist/types/src/hooks/useReferencesProvider.d.ts +7 -0
- package/dist/types/src/hooks/useReferencesProvider.d.ts.map +1 -0
- package/dist/types/src/parser/index.d.ts +1 -1
- package/dist/types/src/parser/index.d.ts.map +1 -1
- package/dist/types/src/queue-logger.d.ts +5 -5
- package/dist/types/src/queue-logger.d.ts.map +1 -1
- package/dist/types/src/stories/Chat.stories.d.ts +207 -0
- package/dist/types/src/stories/Chat.stories.d.ts.map +1 -0
- package/dist/types/src/testing/index.d.ts +1 -1
- package/dist/types/src/testing/index.d.ts.map +1 -1
- package/dist/types/src/testing/test-sequence.d.ts +8 -0
- package/dist/types/src/testing/test-sequence.d.ts.map +1 -0
- package/dist/types/src/translations.d.ts +68 -113
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/index.d.ts +1 -3
- package/dist/types/src/types/index.d.ts.map +1 -1
- package/dist/types/src/types/schema.d.ts +120 -0
- package/dist/types/src/types/schema.d.ts.map +1 -0
- package/dist/types/src/types/service.d.ts +9 -9
- package/dist/types/src/types/service.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +84 -76
- package/src/AssistantPlugin.tsx +43 -44
- package/src/capabilities/app-graph-builder.ts +24 -103
- package/src/capabilities/index.ts +0 -3
- package/src/capabilities/intent-resolver.ts +41 -14
- package/src/capabilities/react-surface.tsx +38 -37
- package/src/capabilities/settings.ts +3 -3
- package/src/capability-definitions.ts +15 -0
- package/src/components/AssistantSettings/AssistantSettings.tsx +4 -4
- package/src/components/BlueprintContainer.tsx +9 -133
- package/src/components/Chat/Chat.tsx +388 -0
- package/src/components/Chat/events.ts +50 -0
- package/src/components/Chat/index.ts +7 -0
- package/src/components/ChatContainer.tsx +26 -20
- package/src/components/ChatDialog.tsx +64 -0
- package/src/components/ChatPrompt/ChatActions.tsx +71 -0
- package/src/components/ChatPrompt/ChatOptionsMenu.tsx +52 -0
- package/src/components/ChatPrompt/ChatPresets.tsx +28 -0
- package/src/components/ChatPrompt/ChatReferences.tsx +53 -0
- package/src/components/ChatPrompt/ChatStatusIndicator.tsx +39 -0
- package/src/components/ChatPrompt/index.ts +9 -0
- package/src/components/ChatThread/ChatMessage.tsx +268 -0
- package/src/components/ChatThread/ChatThread.stories.tsx +143 -0
- package/src/components/ChatThread/ChatThread.tsx +57 -0
- package/src/components/{Thread/ToolInvocations.tsx → ChatThread/ToolBlock.tsx} +36 -21
- package/src/{experimental/transcription → components/ChatThread}/index.ts +2 -0
- package/src/components/{Thread → ChatThread}/reducer.ts +14 -14
- package/src/components/PromptSettings.tsx +43 -45
- package/src/components/SequenceContainer.tsx +132 -0
- package/src/components/SequenceEditor/SequenceEditor.stories.tsx +32 -0
- package/src/components/{BlueprintEditor/BlueprintEditor.tsx → SequenceEditor/SequenceEditor.tsx} +7 -7
- package/src/components/{AmbientDialog → SequenceEditor}/index.ts +1 -1
- package/src/components/TemplateEditor/TemplateEditor.stories.tsx +29 -34
- package/src/components/TemplateEditor/TemplateEditor.tsx +39 -24
- package/src/components/TemplateEditor/TemplateForm.stories.tsx +17 -17
- package/src/components/TemplateEditor/TemplateForm.tsx +50 -57
- package/src/components/Toolbox/Toolbox.stories.tsx +5 -6
- package/src/components/Toolbox/Toolbox.tsx +60 -4
- package/src/components/index.ts +4 -5
- package/src/events.ts +2 -2
- package/src/hooks/{processor.test.ts → chat-processor.test.ts} +3 -2
- package/src/hooks/chat-processor.ts +314 -0
- package/src/hooks/index.ts +5 -5
- package/src/hooks/presets.ts +52 -0
- package/src/hooks/useBlueprints.ts +57 -0
- package/src/hooks/useChatProcessor.ts +143 -0
- package/src/hooks/useChatServices.ts +67 -0
- package/src/hooks/{useContextProvider.ts → useReferencesProvider.ts} +14 -14
- package/src/parser/index.ts +1 -1
- package/src/queue-logger.ts +6 -6
- package/src/stories/Chat.stories.tsx +371 -0
- package/src/testing/index.ts +1 -1
- package/src/testing/test-functions.ts +1 -1
- package/src/testing/test-sequence.ts +51 -0
- package/src/tools/openapi.test.ts +11 -11
- package/src/translations.ts +39 -28
- package/src/types/index.ts +1 -3
- package/src/types/schema.ts +108 -0
- package/dist/lib/browser/AssistantDialog-MQOOR364.mjs +0 -47
- package/dist/lib/browser/AssistantDialog-MQOOR364.mjs.map +0 -7
- package/dist/lib/browser/BlueprintContainer-AT5Y7EXG.mjs +0 -321
- package/dist/lib/browser/BlueprintContainer-AT5Y7EXG.mjs.map +0 -7
- package/dist/lib/browser/ChatContainer-C2NEAS3A.mjs +0 -40
- package/dist/lib/browser/ChatContainer-C2NEAS3A.mjs.map +0 -7
- package/dist/lib/browser/TemplateContainer-QQHVOTSI.mjs.map +0 -7
- package/dist/lib/browser/ai-client-MK2ZZII2.mjs +0 -39
- package/dist/lib/browser/ai-client-MK2ZZII2.mjs.map +0 -7
- package/dist/lib/browser/app-graph-builder-E4H5DCOJ.mjs.map +0 -7
- package/dist/lib/browser/chunk-AAOKC2JN.mjs +0 -208
- package/dist/lib/browser/chunk-AAOKC2JN.mjs.map +0 -7
- package/dist/lib/browser/chunk-BI6AHRNJ.mjs.map +0 -7
- package/dist/lib/browser/chunk-JO4W3MF7.mjs +0 -2101
- package/dist/lib/browser/chunk-JO4W3MF7.mjs.map +0 -7
- package/dist/lib/browser/chunk-JQFUME3B.mjs.map +0 -7
- package/dist/lib/browser/chunk-MEGMOFJB.mjs +0 -16
- package/dist/lib/browser/chunk-MEGMOFJB.mjs.map +0 -7
- package/dist/lib/browser/chunk-Q6UZ4F3H.mjs +0 -96
- package/dist/lib/browser/chunk-Q6UZ4F3H.mjs.map +0 -7
- package/dist/lib/browser/chunk-UE3IZ4PN.mjs +0 -15
- package/dist/lib/browser/chunk-UE3IZ4PN.mjs.map +0 -7
- package/dist/lib/browser/chunk-XOZ7YMO3.mjs +0 -20
- package/dist/lib/browser/intent-resolver-3UICTGPM.mjs +0 -43
- package/dist/lib/browser/intent-resolver-3UICTGPM.mjs.map +0 -7
- package/dist/lib/browser/react-surface-LXCNUSZN.mjs.map +0 -7
- package/dist/lib/browser/settings-XRHXVWGB.mjs.map +0 -7
- package/dist/lib/node/AssistantDialog-AN4Z6YUV.cjs +0 -73
- package/dist/lib/node/AssistantDialog-AN4Z6YUV.cjs.map +0 -7
- package/dist/lib/node/BlueprintContainer-NOWLDYCZ.cjs +0 -344
- package/dist/lib/node/BlueprintContainer-NOWLDYCZ.cjs.map +0 -7
- package/dist/lib/node/ChatContainer-VKYBQHUB.cjs +0 -68
- package/dist/lib/node/ChatContainer-VKYBQHUB.cjs.map +0 -7
- package/dist/lib/node/TemplateContainer-JZF2DCCG.cjs +0 -58
- package/dist/lib/node/TemplateContainer-JZF2DCCG.cjs.map +0 -7
- package/dist/lib/node/ai-client-7HNSMUMT.cjs +0 -53
- package/dist/lib/node/ai-client-7HNSMUMT.cjs.map +0 -7
- package/dist/lib/node/app-graph-builder-PPR5B5KU.cjs +0 -235
- package/dist/lib/node/app-graph-builder-PPR5B5KU.cjs.map +0 -7
- package/dist/lib/node/chunk-4EEWTDQK.cjs +0 -117
- package/dist/lib/node/chunk-4EEWTDQK.cjs.map +0 -7
- package/dist/lib/node/chunk-FUAGEO7Q.cjs +0 -52
- package/dist/lib/node/chunk-FUAGEO7Q.cjs.map +0 -7
- package/dist/lib/node/chunk-HRNIUYVQ.cjs +0 -128
- package/dist/lib/node/chunk-HRNIUYVQ.cjs.map +0 -7
- package/dist/lib/node/chunk-IKZBMHSW.cjs +0 -184
- package/dist/lib/node/chunk-IKZBMHSW.cjs.map +0 -7
- package/dist/lib/node/chunk-LMDJEGZ2.cjs +0 -233
- package/dist/lib/node/chunk-LMDJEGZ2.cjs.map +0 -7
- package/dist/lib/node/chunk-NIDICM57.cjs +0 -2080
- package/dist/lib/node/chunk-NIDICM57.cjs.map +0 -7
- package/dist/lib/node/chunk-P74TWGMG.cjs.map +0 -7
- package/dist/lib/node/chunk-QGPWY6GW.cjs +0 -34
- package/dist/lib/node/chunk-QGPWY6GW.cjs.map +0 -7
- package/dist/lib/node/index.cjs +0 -289
- package/dist/lib/node/index.cjs.map +0 -7
- package/dist/lib/node/intent-resolver-QSWGTKON.cjs +0 -58
- package/dist/lib/node/intent-resolver-QSWGTKON.cjs.map +0 -7
- package/dist/lib/node/meta.json +0 -1
- package/dist/lib/node/react-surface-D3NBYRZ6.cjs +0 -172
- package/dist/lib/node/react-surface-D3NBYRZ6.cjs.map +0 -7
- package/dist/lib/node/settings-2JXLKYGE.cjs +0 -36
- package/dist/lib/node/settings-2JXLKYGE.cjs.map +0 -7
- package/dist/lib/node/types/index.cjs +0 -54
- package/dist/lib/node/types/index.cjs.map +0 -7
- package/dist/lib/node-esm/AssistantDialog-6WEMLUPU.mjs +0 -48
- package/dist/lib/node-esm/AssistantDialog-6WEMLUPU.mjs.map +0 -7
- package/dist/lib/node-esm/BlueprintContainer-STOJAVML.mjs +0 -322
- package/dist/lib/node-esm/BlueprintContainer-STOJAVML.mjs.map +0 -7
- package/dist/lib/node-esm/ChatContainer-3MVBTUJN.mjs +0 -41
- package/dist/lib/node-esm/ChatContainer-3MVBTUJN.mjs.map +0 -7
- package/dist/lib/node-esm/TemplateContainer-SOEWY2ZN.mjs.map +0 -7
- package/dist/lib/node-esm/ai-client-XGZBJ6BE.mjs +0 -40
- package/dist/lib/node-esm/ai-client-XGZBJ6BE.mjs.map +0 -7
- package/dist/lib/node-esm/app-graph-builder-3SY5MBIK.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-34EX6E5Q.mjs +0 -18
- package/dist/lib/node-esm/chunk-34EX6E5Q.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-3UEZLJ2V.mjs +0 -16
- package/dist/lib/node-esm/chunk-3UEZLJ2V.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-BB2TAT4P.mjs +0 -22
- package/dist/lib/node-esm/chunk-CDAILLCU.mjs +0 -98
- package/dist/lib/node-esm/chunk-CDAILLCU.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-J6UXXZGJ.mjs +0 -209
- package/dist/lib/node-esm/chunk-J6UXXZGJ.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-OD574YIU.mjs +0 -2102
- package/dist/lib/node-esm/chunk-OD574YIU.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-OYN6HLXZ.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-UCOFKNKN.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-E6MXTYAU.mjs +0 -44
- package/dist/lib/node-esm/intent-resolver-E6MXTYAU.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-7HA5EDWY.mjs.map +0 -7
- package/dist/lib/node-esm/settings-5IAY6BT4.mjs.map +0 -7
- package/dist/types/src/capabilities/ai-client.d.ts +0 -5
- package/dist/types/src/capabilities/ai-client.d.ts.map +0 -1
- package/dist/types/src/capabilities/capabilities.d.ts +0 -6
- package/dist/types/src/capabilities/capabilities.d.ts.map +0 -1
- package/dist/types/src/components/AmbientDialog/AmbientDialog.d.ts +0 -10
- package/dist/types/src/components/AmbientDialog/AmbientDialog.d.ts.map +0 -1
- package/dist/types/src/components/AmbientDialog/AmbientDialog.stories.d.ts +0 -8
- package/dist/types/src/components/AmbientDialog/AmbientDialog.stories.d.ts.map +0 -1
- package/dist/types/src/components/AmbientDialog/index.d.ts +0 -2
- package/dist/types/src/components/AmbientDialog/index.d.ts.map +0 -1
- package/dist/types/src/components/AssistantDialog.d.ts +0 -7
- package/dist/types/src/components/AssistantDialog.d.ts.map +0 -1
- package/dist/types/src/components/BlueprintEditor/BlueprintEditor.d.ts +0 -13
- package/dist/types/src/components/BlueprintEditor/BlueprintEditor.d.ts.map +0 -1
- package/dist/types/src/components/BlueprintEditor/BlueprintEditor.stories.d.ts +0 -8
- package/dist/types/src/components/BlueprintEditor/BlueprintEditor.stories.d.ts.map +0 -1
- package/dist/types/src/components/BlueprintEditor/index.d.ts +0 -2
- package/dist/types/src/components/BlueprintEditor/index.d.ts.map +0 -1
- package/dist/types/src/components/Prompt/Prompt.d.ts +0 -23
- package/dist/types/src/components/Prompt/Prompt.d.ts.map +0 -1
- package/dist/types/src/components/Prompt/Prompt.stories.d.ts +0 -13
- package/dist/types/src/components/Prompt/Prompt.stories.d.ts.map +0 -1
- package/dist/types/src/components/Prompt/PromptBar.d.ts +0 -16
- package/dist/types/src/components/Prompt/PromptBar.d.ts.map +0 -1
- package/dist/types/src/components/Prompt/PromptBar.stories.d.ts +0 -9
- package/dist/types/src/components/Prompt/PromptBar.stories.d.ts.map +0 -1
- package/dist/types/src/components/Prompt/autocomplete.d.ts +0 -25
- package/dist/types/src/components/Prompt/autocomplete.d.ts.map +0 -1
- package/dist/types/src/components/Prompt/index.d.ts +0 -3
- package/dist/types/src/components/Prompt/index.d.ts.map +0 -1
- package/dist/types/src/components/Prompt/references.d.ts +0 -30
- package/dist/types/src/components/Prompt/references.d.ts.map +0 -1
- package/dist/types/src/components/TemplateContainer.d.ts +0 -8
- package/dist/types/src/components/TemplateContainer.d.ts.map +0 -1
- package/dist/types/src/components/Thread/Thread.d.ts +0 -28
- package/dist/types/src/components/Thread/Thread.d.ts.map +0 -1
- package/dist/types/src/components/Thread/Thread.stories.d.ts +0 -11
- package/dist/types/src/components/Thread/Thread.stories.d.ts.map +0 -1
- package/dist/types/src/components/Thread/ThreadContainer.d.ts +0 -13
- package/dist/types/src/components/Thread/ThreadContainer.d.ts.map +0 -1
- package/dist/types/src/components/Thread/ThreadContainer.stories.d.ts +0 -16
- package/dist/types/src/components/Thread/ThreadContainer.stories.d.ts.map +0 -1
- package/dist/types/src/components/Thread/ThreadMessage.d.ts +0 -16
- package/dist/types/src/components/Thread/ThreadMessage.d.ts.map +0 -1
- package/dist/types/src/components/Thread/ToolInvocations.d.ts +0 -13
- package/dist/types/src/components/Thread/ToolInvocations.d.ts.map +0 -1
- package/dist/types/src/components/Thread/index.d.ts +0 -3
- package/dist/types/src/components/Thread/index.d.ts.map +0 -1
- package/dist/types/src/components/Thread/reducer.d.ts.map +0 -1
- package/dist/types/src/experimental/transcription/index.d.ts +0 -1
- package/dist/types/src/experimental/transcription/index.d.ts.map +0 -1
- package/dist/types/src/hooks/processor.d.ts.map +0 -1
- package/dist/types/src/hooks/processor.test.d.ts +0 -2
- package/dist/types/src/hooks/processor.test.d.ts.map +0 -1
- package/dist/types/src/hooks/useContextProvider.d.ts +0 -17
- package/dist/types/src/hooks/useContextProvider.d.ts.map +0 -1
- package/dist/types/src/hooks/useMessageQueue.d.ts +0 -42
- package/dist/types/src/hooks/useMessageQueue.d.ts.map +0 -1
- package/dist/types/src/hooks/useServices.d.ts +0 -7
- package/dist/types/src/hooks/useServices.d.ts.map +0 -1
- package/dist/types/src/hooks/useTextInputEvents.d.ts +0 -13
- package/dist/types/src/hooks/useTextInputEvents.d.ts.map +0 -1
- package/dist/types/src/stories/Prompt.stories.d.ts +0 -8
- package/dist/types/src/stories/Prompt.stories.d.ts.map +0 -1
- package/dist/types/src/stories/Query.stories.d.ts +0 -19
- package/dist/types/src/stories/Query.stories.d.ts.map +0 -1
- package/dist/types/src/stories/Research.stories.d.ts +0 -15
- package/dist/types/src/stories/Research.stories.d.ts.map +0 -1
- package/dist/types/src/stories/test-data.d.ts +0 -3
- package/dist/types/src/stories/test-data.d.ts.map +0 -1
- package/dist/types/src/stories/testing.d.ts +0 -12
- package/dist/types/src/stories/testing.d.ts.map +0 -1
- package/dist/types/src/testing/test-blueprint.d.ts +0 -8
- package/dist/types/src/testing/test-blueprint.d.ts.map +0 -1
- package/dist/types/src/types/chat.d.ts +0 -23
- package/dist/types/src/types/chat.d.ts.map +0 -1
- package/dist/types/src/types/template.d.ts +0 -56
- package/dist/types/src/types/template.d.ts.map +0 -1
- package/dist/types/src/types/types.d.ts +0 -50
- package/dist/types/src/types/types.d.ts.map +0 -1
- package/src/capabilities/ai-client.ts +0 -42
- package/src/capabilities/capabilities.ts +0 -15
- package/src/components/AmbientDialog/AmbientDialog.stories.tsx +0 -84
- package/src/components/AmbientDialog/AmbientDialog.tsx +0 -117
- package/src/components/AssistantDialog.tsx +0 -37
- package/src/components/BlueprintEditor/BlueprintEditor.stories.tsx +0 -32
- package/src/components/BlueprintEditor/index.ts +0 -5
- package/src/components/Prompt/Prompt.stories.tsx +0 -121
- package/src/components/Prompt/Prompt.tsx +0 -124
- package/src/components/Prompt/PromptBar.stories.tsx +0 -69
- package/src/components/Prompt/PromptBar.tsx +0 -105
- package/src/components/Prompt/autocomplete.ts +0 -218
- package/src/components/Prompt/index.ts +0 -6
- package/src/components/Prompt/references.ts +0 -180
- package/src/components/TemplateContainer.tsx +0 -23
- package/src/components/Thread/Thread.stories.tsx +0 -201
- package/src/components/Thread/Thread.tsx +0 -118
- package/src/components/Thread/ThreadContainer.stories.tsx +0 -283
- package/src/components/Thread/ThreadContainer.tsx +0 -105
- package/src/components/Thread/ThreadMessage.tsx +0 -234
- package/src/components/Thread/index.ts +0 -6
- package/src/hooks/processor.ts +0 -238
- package/src/hooks/useChatProcessor.tsx +0 -97
- package/src/hooks/useMessageQueue.ts +0 -22
- package/src/hooks/useServices.ts +0 -28
- package/src/hooks/useTextInputEvents.ts +0 -49
- package/src/stories/Prompt.stories.tsx +0 -60
- package/src/stories/Query.stories.tsx +0 -514
- package/src/stories/Research.stories.tsx +0 -482
- package/src/stories/test-data.ts +0 -128
- package/src/stories/testing.ts +0 -60
- package/src/testing/test-blueprint.ts +0 -58
- package/src/types/chat.ts +0 -32
- package/src/types/template.ts +0 -66
- package/src/types/types.ts +0 -48
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import React from 'react';
|
|
6
|
-
|
|
7
|
-
import { StackItem, type StackItemContentProps } from '@dxos/react-ui-stack';
|
|
8
|
-
|
|
9
|
-
import { TemplateEditor } from './TemplateEditor';
|
|
10
|
-
import { type TemplateType } from '../types';
|
|
11
|
-
|
|
12
|
-
export const TemplateContainer = ({
|
|
13
|
-
role,
|
|
14
|
-
template,
|
|
15
|
-
}: Pick<StackItemContentProps, 'role'> & { template: TemplateType }) => {
|
|
16
|
-
return (
|
|
17
|
-
<StackItem.Content role={role} classNames='container-max-width'>
|
|
18
|
-
<TemplateEditor template={template} />
|
|
19
|
-
</StackItem.Content>
|
|
20
|
-
);
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
export default TemplateContainer;
|
|
@@ -1,201 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import '@dxos-theme';
|
|
6
|
-
|
|
7
|
-
import { type StoryObj, type Meta } from '@storybook/react';
|
|
8
|
-
import React, { useCallback, useEffect, useState } from 'react';
|
|
9
|
-
|
|
10
|
-
import { Message } from '@dxos/ai';
|
|
11
|
-
import { IntentPlugin } from '@dxos/app-framework';
|
|
12
|
-
import { withPluginManager } from '@dxos/app-framework/testing';
|
|
13
|
-
import { Obj } from '@dxos/echo';
|
|
14
|
-
import { faker } from '@dxos/random';
|
|
15
|
-
import { withClientProvider } from '@dxos/react-client/testing';
|
|
16
|
-
import { withLayout, withSignals, withTheme } from '@dxos/storybook-utils';
|
|
17
|
-
|
|
18
|
-
import { Thread, type ThreadProps } from './Thread';
|
|
19
|
-
import translations from '../../translations';
|
|
20
|
-
|
|
21
|
-
faker.seed(1);
|
|
22
|
-
|
|
23
|
-
const DefaultStory = ({ messages: _messages, ...props }: ThreadProps) => {
|
|
24
|
-
const [processing, setProcessing] = useState(false);
|
|
25
|
-
const [messages, setMessages] = useState<Message[]>(_messages ?? []);
|
|
26
|
-
useEffect(() => {
|
|
27
|
-
setMessages(_messages ?? []);
|
|
28
|
-
}, [_messages]);
|
|
29
|
-
|
|
30
|
-
const handleSubmit = useCallback(
|
|
31
|
-
(text: string) => {
|
|
32
|
-
const request: Message = Obj.make(Message, { role: 'user', content: [{ type: 'text', text }] });
|
|
33
|
-
const response: Message = Obj.make(Message, {
|
|
34
|
-
role: 'assistant',
|
|
35
|
-
content: [{ type: 'text', disposition: 'cot', pending: true, text: faker.lorem.paragraphs(1) }],
|
|
36
|
-
});
|
|
37
|
-
setMessages([...messages, request, response]);
|
|
38
|
-
setProcessing(true);
|
|
39
|
-
setTimeout(() => {
|
|
40
|
-
response.content[0].pending = false;
|
|
41
|
-
setMessages([
|
|
42
|
-
...messages,
|
|
43
|
-
request,
|
|
44
|
-
response,
|
|
45
|
-
Obj.make(Message, {
|
|
46
|
-
role: 'assistant',
|
|
47
|
-
content: [{ type: 'text', text: faker.lorem.paragraphs(1) }],
|
|
48
|
-
}),
|
|
49
|
-
]);
|
|
50
|
-
setProcessing(false);
|
|
51
|
-
}, 3_000);
|
|
52
|
-
},
|
|
53
|
-
[messages],
|
|
54
|
-
);
|
|
55
|
-
|
|
56
|
-
return (
|
|
57
|
-
<div className='flex w-[30rem] bg-white dark:bg-black'>
|
|
58
|
-
<Thread
|
|
59
|
-
{...props}
|
|
60
|
-
messages={messages}
|
|
61
|
-
processing={processing}
|
|
62
|
-
onSubmit={handleSubmit}
|
|
63
|
-
onCancel={() => setProcessing(false)}
|
|
64
|
-
/>
|
|
65
|
-
</div>
|
|
66
|
-
);
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
const meta: Meta<ThreadProps> = {
|
|
70
|
-
title: 'plugins/plugin-assistant/Thread',
|
|
71
|
-
render: DefaultStory,
|
|
72
|
-
component: Thread,
|
|
73
|
-
decorators: [
|
|
74
|
-
withSignals,
|
|
75
|
-
withClientProvider({ createIdentity: true, createSpace: true }),
|
|
76
|
-
withPluginManager({ plugins: [IntentPlugin()] }),
|
|
77
|
-
withTheme,
|
|
78
|
-
withLayout({ fullscreen: true, classNames: 'flex justify-center' }),
|
|
79
|
-
],
|
|
80
|
-
parameters: {
|
|
81
|
-
translations,
|
|
82
|
-
},
|
|
83
|
-
};
|
|
84
|
-
|
|
85
|
-
export default meta;
|
|
86
|
-
|
|
87
|
-
type Story = StoryObj<ThreadProps>;
|
|
88
|
-
|
|
89
|
-
const TEST_MESSAGES: Message[] = [
|
|
90
|
-
Obj.make(Message, {
|
|
91
|
-
role: 'user',
|
|
92
|
-
content: [
|
|
93
|
-
{
|
|
94
|
-
type: 'text',
|
|
95
|
-
text: faker.lorem.sentence(5),
|
|
96
|
-
},
|
|
97
|
-
],
|
|
98
|
-
}),
|
|
99
|
-
Obj.make(Message, {
|
|
100
|
-
role: 'assistant',
|
|
101
|
-
content: [
|
|
102
|
-
{
|
|
103
|
-
type: 'text',
|
|
104
|
-
disposition: 'cot',
|
|
105
|
-
text: Array.from({ length: faker.number.int({ min: 3, max: 5 }) })
|
|
106
|
-
.map((_, idx) => `${idx + 1}. ${faker.lorem.paragraph()}`)
|
|
107
|
-
.join('\n'),
|
|
108
|
-
},
|
|
109
|
-
{
|
|
110
|
-
type: 'text',
|
|
111
|
-
text: Array.from({ length: faker.number.int({ min: 2, max: 5 }) })
|
|
112
|
-
.map(() => faker.lorem.paragraphs())
|
|
113
|
-
.join('\n\n'),
|
|
114
|
-
},
|
|
115
|
-
{
|
|
116
|
-
type: 'tool_use',
|
|
117
|
-
id: '1234',
|
|
118
|
-
name: 'search',
|
|
119
|
-
input: {},
|
|
120
|
-
},
|
|
121
|
-
],
|
|
122
|
-
}),
|
|
123
|
-
Obj.make(Message, {
|
|
124
|
-
role: 'user',
|
|
125
|
-
content: [
|
|
126
|
-
{
|
|
127
|
-
type: 'tool_result',
|
|
128
|
-
toolUseId: '1234',
|
|
129
|
-
content: 'This is a tool result.',
|
|
130
|
-
},
|
|
131
|
-
],
|
|
132
|
-
}),
|
|
133
|
-
Obj.make(Message, {
|
|
134
|
-
role: 'assistant',
|
|
135
|
-
content: [
|
|
136
|
-
{
|
|
137
|
-
type: 'tool_use',
|
|
138
|
-
id: '4567',
|
|
139
|
-
name: 'create',
|
|
140
|
-
input: {},
|
|
141
|
-
},
|
|
142
|
-
],
|
|
143
|
-
}),
|
|
144
|
-
Obj.make(Message, {
|
|
145
|
-
role: 'user',
|
|
146
|
-
content: [
|
|
147
|
-
{
|
|
148
|
-
type: 'tool_result',
|
|
149
|
-
toolUseId: '4567',
|
|
150
|
-
content: 'This is a tool result.',
|
|
151
|
-
},
|
|
152
|
-
],
|
|
153
|
-
}),
|
|
154
|
-
Obj.make(Message, {
|
|
155
|
-
role: 'assistant',
|
|
156
|
-
content: [
|
|
157
|
-
{
|
|
158
|
-
type: 'text',
|
|
159
|
-
text: faker.lorem.paragraphs(1),
|
|
160
|
-
},
|
|
161
|
-
],
|
|
162
|
-
}),
|
|
163
|
-
];
|
|
164
|
-
|
|
165
|
-
export const Default: Story = {
|
|
166
|
-
args: {
|
|
167
|
-
messages: TEST_MESSAGES,
|
|
168
|
-
},
|
|
169
|
-
};
|
|
170
|
-
|
|
171
|
-
export const Input: Story = {
|
|
172
|
-
args: {
|
|
173
|
-
processing: true,
|
|
174
|
-
},
|
|
175
|
-
};
|
|
176
|
-
|
|
177
|
-
export const Collapse: Story = {
|
|
178
|
-
args: {
|
|
179
|
-
collapse: true,
|
|
180
|
-
messages: TEST_MESSAGES,
|
|
181
|
-
},
|
|
182
|
-
};
|
|
183
|
-
|
|
184
|
-
export const Incremental: Story = {
|
|
185
|
-
render: () => {
|
|
186
|
-
const [messages, setMessages] = useState<Message[]>([]);
|
|
187
|
-
useEffect(() => {
|
|
188
|
-
let i = 0;
|
|
189
|
-
const interval = setInterval(() => {
|
|
190
|
-
setMessages((messages) => [...messages, TEST_MESSAGES[i++]]);
|
|
191
|
-
if (i >= TEST_MESSAGES.length) {
|
|
192
|
-
clearInterval(interval);
|
|
193
|
-
}
|
|
194
|
-
}, 2_000);
|
|
195
|
-
|
|
196
|
-
return () => clearInterval(interval);
|
|
197
|
-
}, []);
|
|
198
|
-
|
|
199
|
-
return <DefaultStory messages={messages} collapse />;
|
|
200
|
-
},
|
|
201
|
-
};
|
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import React, { type CSSProperties, useCallback, useMemo, useRef } from 'react';
|
|
6
|
-
|
|
7
|
-
import { type Message } from '@dxos/ai';
|
|
8
|
-
import { type Space } from '@dxos/react-client/echo';
|
|
9
|
-
import { useIdentity } from '@dxos/react-client/halo';
|
|
10
|
-
import { type ThemedClassName } from '@dxos/react-ui';
|
|
11
|
-
import { ScrollContainer, type ScrollController } from '@dxos/react-ui-components';
|
|
12
|
-
import { mx } from '@dxos/react-ui-theme';
|
|
13
|
-
import { keyToFallback } from '@dxos/util';
|
|
14
|
-
|
|
15
|
-
import { ThreadMessage, type ThreadMessageProps } from './ThreadMessage';
|
|
16
|
-
import { messageReducer } from './reducer';
|
|
17
|
-
import { PromptBar, type PromptBarProps } from '../Prompt';
|
|
18
|
-
import type { ReferenceData, ReferencesProvider } from '../Prompt/references';
|
|
19
|
-
|
|
20
|
-
export interface ContextProvider {
|
|
21
|
-
query({ query }: { query: string }): Promise<ReferenceData[]>;
|
|
22
|
-
|
|
23
|
-
resolveMetadata({ uri }: { uri: string }): Promise<ReferenceData | null>;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export type ThreadProps = ThemedClassName<{
|
|
27
|
-
space?: Space;
|
|
28
|
-
messages?: Message[];
|
|
29
|
-
collapse?: boolean;
|
|
30
|
-
transcription?: boolean;
|
|
31
|
-
onOpenChange?: (open: boolean) => void;
|
|
32
|
-
contextProvider?: ContextProvider;
|
|
33
|
-
}> &
|
|
34
|
-
Pick<PromptBarProps, 'processing' | 'error' | 'onSubmit' | 'onSuggest' | 'onCancel'> &
|
|
35
|
-
Pick<ThreadMessageProps, 'debug' | 'tools' | 'onPrompt' | 'onDelete' | 'onAddToGraph'>;
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* Chat thread component.
|
|
39
|
-
*/
|
|
40
|
-
export const Thread = ({
|
|
41
|
-
classNames,
|
|
42
|
-
space,
|
|
43
|
-
messages,
|
|
44
|
-
collapse = true,
|
|
45
|
-
transcription,
|
|
46
|
-
processing,
|
|
47
|
-
error,
|
|
48
|
-
onSubmit,
|
|
49
|
-
onCancel,
|
|
50
|
-
onOpenChange,
|
|
51
|
-
contextProvider,
|
|
52
|
-
...props
|
|
53
|
-
}: ThreadProps) => {
|
|
54
|
-
const scroller = useRef<ScrollController>(null);
|
|
55
|
-
|
|
56
|
-
const identity = useIdentity();
|
|
57
|
-
const fallbackValue = keyToFallback(identity!.identityKey);
|
|
58
|
-
const userHue = identity!.profile?.data?.hue || fallbackValue.hue;
|
|
59
|
-
|
|
60
|
-
const handleSubmit = useCallback<NonNullable<PromptBarProps['onSubmit']>>(
|
|
61
|
-
(value: string) => {
|
|
62
|
-
onSubmit?.(value);
|
|
63
|
-
scroller.current?.scrollToBottom();
|
|
64
|
-
return true;
|
|
65
|
-
},
|
|
66
|
-
[onSubmit],
|
|
67
|
-
);
|
|
68
|
-
|
|
69
|
-
// TODO(dmaretskyi): This needs to be a separate type: `id` is not a valid ObjectId, this needs to accommodate messageId for deletion.
|
|
70
|
-
const { messages: filteredMessages = [] } = useMemo(() => {
|
|
71
|
-
if (collapse) {
|
|
72
|
-
return (messages ?? []).reduce<{ messages: Message[]; current?: Message }>(messageReducer, {
|
|
73
|
-
messages: [],
|
|
74
|
-
});
|
|
75
|
-
} else {
|
|
76
|
-
return { messages: messages ?? [] };
|
|
77
|
-
}
|
|
78
|
-
}, [messages, collapse]);
|
|
79
|
-
|
|
80
|
-
const references = useMemo<ReferencesProvider | undefined>(() => {
|
|
81
|
-
if (!contextProvider) {
|
|
82
|
-
return undefined;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
return {
|
|
86
|
-
getReferences: async ({ query }: { query: string }) => contextProvider.query({ query }),
|
|
87
|
-
resolveReference: async ({ uri }: { uri: string }) => contextProvider.resolveMetadata({ uri }),
|
|
88
|
-
};
|
|
89
|
-
}, [contextProvider]);
|
|
90
|
-
|
|
91
|
-
return (
|
|
92
|
-
<div role='none' className={mx('flex flex-col grow overflow-hidden', classNames)}>
|
|
93
|
-
<ScrollContainer ref={scroller} fade>
|
|
94
|
-
<div
|
|
95
|
-
role='none'
|
|
96
|
-
className={mx(filteredMessages.length > 0 && 'pbs-6 pbe-6')}
|
|
97
|
-
style={{ '--user-fill': `var(--dx-${userHue}Fill)` } as CSSProperties}
|
|
98
|
-
>
|
|
99
|
-
{filteredMessages.map((message) => (
|
|
100
|
-
<ThreadMessage key={message.id} classNames='px-4 pbe-4' space={space} message={message} {...props} />
|
|
101
|
-
))}
|
|
102
|
-
</div>
|
|
103
|
-
</ScrollContainer>
|
|
104
|
-
|
|
105
|
-
{onSubmit && (
|
|
106
|
-
<PromptBar
|
|
107
|
-
microphone={transcription}
|
|
108
|
-
processing={processing}
|
|
109
|
-
error={error}
|
|
110
|
-
onSubmit={handleSubmit}
|
|
111
|
-
onCancel={onCancel}
|
|
112
|
-
onOpenChange={onOpenChange}
|
|
113
|
-
references={references}
|
|
114
|
-
/>
|
|
115
|
-
)}
|
|
116
|
-
</div>
|
|
117
|
-
);
|
|
118
|
-
};
|
|
@@ -1,283 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import '@dxos-theme';
|
|
6
|
-
|
|
7
|
-
import { type StoryObj, type Meta } from '@storybook/react';
|
|
8
|
-
import React, { useCallback, useEffect, useMemo, useState } from 'react';
|
|
9
|
-
|
|
10
|
-
import { EdgeAiServiceClient, Message } from '@dxos/ai';
|
|
11
|
-
import {
|
|
12
|
-
Capabilities,
|
|
13
|
-
Events,
|
|
14
|
-
IntentPlugin,
|
|
15
|
-
SettingsPlugin,
|
|
16
|
-
Surface,
|
|
17
|
-
useCapabilities,
|
|
18
|
-
useIntentDispatcher,
|
|
19
|
-
} from '@dxos/app-framework';
|
|
20
|
-
import { withPluginManager } from '@dxos/app-framework/testing';
|
|
21
|
-
import { remoteServiceEndpoints } from '@dxos/artifact-testing';
|
|
22
|
-
import { Filter, Obj, Query, Type } from '@dxos/echo';
|
|
23
|
-
import { invariant } from '@dxos/invariant';
|
|
24
|
-
import { ChessPlugin } from '@dxos/plugin-chess';
|
|
25
|
-
import { ChessType } from '@dxos/plugin-chess/types';
|
|
26
|
-
import { ClientPlugin } from '@dxos/plugin-client';
|
|
27
|
-
import { InboxPlugin } from '@dxos/plugin-inbox';
|
|
28
|
-
import { MapPlugin } from '@dxos/plugin-map';
|
|
29
|
-
import { MarkdownPlugin } from '@dxos/plugin-markdown';
|
|
30
|
-
import { SpacePlugin } from '@dxos/plugin-space';
|
|
31
|
-
import { TablePlugin } from '@dxos/plugin-table';
|
|
32
|
-
import { useClient } from '@dxos/react-client';
|
|
33
|
-
import { useQueue, useQuery } from '@dxos/react-client/echo';
|
|
34
|
-
import { IconButton, Input, Toolbar } from '@dxos/react-ui';
|
|
35
|
-
import { descriptionMessage, mx } from '@dxos/react-ui-theme';
|
|
36
|
-
import { withLayout, withTheme } from '@dxos/storybook-utils';
|
|
37
|
-
|
|
38
|
-
import { Thread, type ThreadProps } from './Thread';
|
|
39
|
-
import { ChatProcessor } from '../../hooks';
|
|
40
|
-
import { createProcessorOptions } from '../../testing';
|
|
41
|
-
import translations from '../../translations';
|
|
42
|
-
|
|
43
|
-
// TODO(burdon): Configure for local with ollama/LM studio.
|
|
44
|
-
// const endpoints = localServiceEndpoints;
|
|
45
|
-
const endpoints = remoteServiceEndpoints;
|
|
46
|
-
|
|
47
|
-
type RenderProps = {
|
|
48
|
-
items?: Obj.Any[];
|
|
49
|
-
prompts?: string[];
|
|
50
|
-
} & Pick<ThreadProps, 'debug'>;
|
|
51
|
-
|
|
52
|
-
// TODO(burdon): Use ChatContainer.
|
|
53
|
-
const DefaultStory = ({ items: _items, prompts = [], ...props }: RenderProps) => {
|
|
54
|
-
const client = useClient();
|
|
55
|
-
const space = client.spaces.default;
|
|
56
|
-
|
|
57
|
-
const artifactDefinitions = useCapabilities(Capabilities.ArtifactDefinition);
|
|
58
|
-
const tools = useCapabilities(Capabilities.Tools);
|
|
59
|
-
|
|
60
|
-
const aiClient = useMemo(() => new EdgeAiServiceClient({ endpoint: endpoints.ai }), []);
|
|
61
|
-
const { dispatchPromise: dispatch } = useIntentDispatcher();
|
|
62
|
-
|
|
63
|
-
// TODO(burdon): Replace with useChatProcessor.
|
|
64
|
-
// const processor = useChatProcessor(space);
|
|
65
|
-
const processor = useMemo<ChatProcessor | undefined>(() => {
|
|
66
|
-
if (!space) {
|
|
67
|
-
return;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
return new ChatProcessor(
|
|
71
|
-
aiClient,
|
|
72
|
-
tools.flat(),
|
|
73
|
-
artifactDefinitions,
|
|
74
|
-
{
|
|
75
|
-
space,
|
|
76
|
-
dispatch,
|
|
77
|
-
},
|
|
78
|
-
createProcessorOptions(artifactDefinitions.map((definition) => definition.instructions)),
|
|
79
|
-
);
|
|
80
|
-
}, [aiClient, tools, space, dispatch, artifactDefinitions]);
|
|
81
|
-
|
|
82
|
-
// Queue.
|
|
83
|
-
const [queueDxn, setQueueDxn] = useState<string>(() => space.queues.create().dxn.toString());
|
|
84
|
-
const queue = useQueue<Message>(Type.DXN.tryParse(queueDxn));
|
|
85
|
-
|
|
86
|
-
useEffect(() => {
|
|
87
|
-
if (space) {
|
|
88
|
-
setQueueDxn(space.queues.create().dxn.toString());
|
|
89
|
-
}
|
|
90
|
-
}, [space]);
|
|
91
|
-
|
|
92
|
-
useEffect(() => {
|
|
93
|
-
if (queue?.objects.length === 0 && !queue.isLoading && prompts.length > 0) {
|
|
94
|
-
void queue.append([
|
|
95
|
-
Obj.make(Message, {
|
|
96
|
-
role: 'assistant',
|
|
97
|
-
content: prompts.map(
|
|
98
|
-
(prompt) =>
|
|
99
|
-
({
|
|
100
|
-
type: 'json',
|
|
101
|
-
disposition: 'suggest',
|
|
102
|
-
json: JSON.stringify({ text: prompt }),
|
|
103
|
-
}) as const,
|
|
104
|
-
),
|
|
105
|
-
}),
|
|
106
|
-
]);
|
|
107
|
-
}
|
|
108
|
-
}, [queueDxn, prompts, queue?.objects.length, queue?.isLoading]);
|
|
109
|
-
|
|
110
|
-
// State.
|
|
111
|
-
const query = useMemo(
|
|
112
|
-
() => Query.select(Filter.or(...artifactDefinitions.map((definition) => Filter.type(definition.schema)))),
|
|
113
|
-
[artifactDefinitions],
|
|
114
|
-
);
|
|
115
|
-
const artifactItems = useQuery(space, query);
|
|
116
|
-
const messages = [...(queue?.objects ?? []), ...(processor?.messages.value ?? [])];
|
|
117
|
-
|
|
118
|
-
const handleSubmit = useCallback(
|
|
119
|
-
(message: string) => {
|
|
120
|
-
requestAnimationFrame(async () => {
|
|
121
|
-
if (!processor || !queue) {
|
|
122
|
-
return;
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
if (processor.streaming.value) {
|
|
126
|
-
await processor.cancel();
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
await processor.request(message, {
|
|
130
|
-
history: queue.objects,
|
|
131
|
-
onComplete: (messages) => {
|
|
132
|
-
void queue.append(messages);
|
|
133
|
-
},
|
|
134
|
-
});
|
|
135
|
-
});
|
|
136
|
-
|
|
137
|
-
return true;
|
|
138
|
-
},
|
|
139
|
-
[processor, queue],
|
|
140
|
-
);
|
|
141
|
-
|
|
142
|
-
const handleDelete = useCallback(
|
|
143
|
-
(id: string) => {
|
|
144
|
-
invariant(Type.ObjectId.isValid(id), 'Invalid message id');
|
|
145
|
-
void queue?.delete([id]);
|
|
146
|
-
},
|
|
147
|
-
[queue],
|
|
148
|
-
);
|
|
149
|
-
|
|
150
|
-
if (!space) {
|
|
151
|
-
return <></>;
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
return (
|
|
155
|
-
<div className='grid grid-cols-2 w-full h-full divide-x divide-separator overflow-hidden'>
|
|
156
|
-
{/* Thread */}
|
|
157
|
-
<div className='flex flex-col gap-4 overflow-hidden'>
|
|
158
|
-
<Toolbar.Root classNames='p-2'>
|
|
159
|
-
<Input.Root>
|
|
160
|
-
<Input.TextInput
|
|
161
|
-
spellCheck={false}
|
|
162
|
-
placeholder='Queue DXN'
|
|
163
|
-
value={queueDxn}
|
|
164
|
-
onChange={(ev) => setQueueDxn(ev.target.value)}
|
|
165
|
-
/>
|
|
166
|
-
<IconButton
|
|
167
|
-
iconOnly
|
|
168
|
-
label='Copy DXN'
|
|
169
|
-
icon='ph--copy--regular'
|
|
170
|
-
onClick={() => navigator.clipboard.writeText(queueDxn)}
|
|
171
|
-
/>
|
|
172
|
-
<IconButton
|
|
173
|
-
iconOnly
|
|
174
|
-
label='Clear history'
|
|
175
|
-
icon='ph--trash--regular'
|
|
176
|
-
onClick={() => setQueueDxn(space.queues.create().dxn.toString())}
|
|
177
|
-
/>
|
|
178
|
-
<IconButton iconOnly label='Stop' icon='ph--stop--regular' onClick={() => processor?.cancel()} />
|
|
179
|
-
</Input.Root>
|
|
180
|
-
</Toolbar.Root>
|
|
181
|
-
|
|
182
|
-
{/* TODO(burdon): Replace with ThreadContainer. */}
|
|
183
|
-
<Thread
|
|
184
|
-
messages={messages}
|
|
185
|
-
processing={processor?.streaming.value}
|
|
186
|
-
error={processor?.error.value}
|
|
187
|
-
tools={processor?.tools}
|
|
188
|
-
onSubmit={processor ? handleSubmit : undefined}
|
|
189
|
-
onPrompt={processor ? handleSubmit : undefined}
|
|
190
|
-
onDelete={processor ? handleDelete : undefined}
|
|
191
|
-
{...props}
|
|
192
|
-
/>
|
|
193
|
-
</div>
|
|
194
|
-
|
|
195
|
-
{/* Artifacts Deck */}
|
|
196
|
-
<div className='overflow-hidden grid grid-rows-[2fr_1fr] divide-y divide-separator'>
|
|
197
|
-
{artifactItems.length > 0 && (
|
|
198
|
-
<div className={mx('flex grow overflow-hidden', artifactItems.length === 1 && 'row-span-2')}>
|
|
199
|
-
<Surface role='article' limit={1} data={{ subject: artifactItems[0] }} fallback={Fallback} />
|
|
200
|
-
</div>
|
|
201
|
-
)}
|
|
202
|
-
|
|
203
|
-
{artifactItems.length > 1 && (
|
|
204
|
-
<div className='flex shrink-0 overflow-hidden divide-x divide-separator'>
|
|
205
|
-
<div className='flex flex-1 h-full'>
|
|
206
|
-
{artifactItems.slice(1, 3).map((item, idx) => (
|
|
207
|
-
<Surface key={idx} role='article' limit={1} data={{ subject: item }} fallback={Fallback} />
|
|
208
|
-
))}
|
|
209
|
-
</div>
|
|
210
|
-
</div>
|
|
211
|
-
)}
|
|
212
|
-
</div>
|
|
213
|
-
</div>
|
|
214
|
-
);
|
|
215
|
-
};
|
|
216
|
-
|
|
217
|
-
const meta: Meta<typeof DefaultStory> = {
|
|
218
|
-
title: 'plugins/plugin-assistant/ThreadContainer',
|
|
219
|
-
render: DefaultStory,
|
|
220
|
-
decorators: [
|
|
221
|
-
withPluginManager({
|
|
222
|
-
plugins: [
|
|
223
|
-
ClientPlugin({
|
|
224
|
-
onClientInitialized: async (_, client) => {
|
|
225
|
-
await client.halo.createIdentity();
|
|
226
|
-
},
|
|
227
|
-
}),
|
|
228
|
-
SpacePlugin(),
|
|
229
|
-
SettingsPlugin(),
|
|
230
|
-
IntentPlugin(),
|
|
231
|
-
|
|
232
|
-
// Artifacts.
|
|
233
|
-
ChessPlugin(),
|
|
234
|
-
InboxPlugin(),
|
|
235
|
-
MapPlugin(),
|
|
236
|
-
MarkdownPlugin(),
|
|
237
|
-
TablePlugin(),
|
|
238
|
-
],
|
|
239
|
-
fireEvents: [Events.SetupArtifactDefinition],
|
|
240
|
-
}),
|
|
241
|
-
withTheme,
|
|
242
|
-
withLayout({ fullscreen: true }),
|
|
243
|
-
],
|
|
244
|
-
parameters: {
|
|
245
|
-
translations,
|
|
246
|
-
},
|
|
247
|
-
};
|
|
248
|
-
|
|
249
|
-
export default meta;
|
|
250
|
-
|
|
251
|
-
type Story = StoryObj<typeof DefaultStory>;
|
|
252
|
-
|
|
253
|
-
export const Default: Story = {
|
|
254
|
-
args: {
|
|
255
|
-
debug: true,
|
|
256
|
-
prompts: ['What tools do you have access to?', 'Show me a chess puzzle'],
|
|
257
|
-
},
|
|
258
|
-
};
|
|
259
|
-
|
|
260
|
-
export const WithInitialItems: Story = {
|
|
261
|
-
args: {
|
|
262
|
-
debug: true,
|
|
263
|
-
items: [
|
|
264
|
-
Obj.make(ChessType, {
|
|
265
|
-
fen: 'rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1',
|
|
266
|
-
}),
|
|
267
|
-
],
|
|
268
|
-
},
|
|
269
|
-
};
|
|
270
|
-
|
|
271
|
-
const Fallback = ({ error }: { error?: Error }) => {
|
|
272
|
-
const errorString = error?.toString() ?? '';
|
|
273
|
-
return (
|
|
274
|
-
<div role='none' className='overflow-auto p-8 attention-surface grid place-items-center'>
|
|
275
|
-
<p
|
|
276
|
-
role='alert'
|
|
277
|
-
className={mx(descriptionMessage, 'break-words rounded-md p-8', errorString.length < 256 && 'text-lg')}
|
|
278
|
-
>
|
|
279
|
-
{error ? errorString : 'error'}
|
|
280
|
-
</p>
|
|
281
|
-
</div>
|
|
282
|
-
);
|
|
283
|
-
};
|