@dxos/plugin-assistant 0.8.3 → 0.8.4-main.f9ba587
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/ChatContainer-6XNB5NEI.mjs +57 -0
- package/dist/lib/browser/ChatContainer-6XNB5NEI.mjs.map +7 -0
- package/dist/lib/browser/ChatDialog-IMWPRXTO.mjs +74 -0
- package/dist/lib/browser/ChatDialog-IMWPRXTO.mjs.map +7 -0
- package/dist/lib/browser/{BlueprintContainer-AT5Y7EXG.mjs → SequenceContainer-6XOYB2RN.mjs} +38 -37
- package/dist/lib/browser/SequenceContainer-6XOYB2RN.mjs.map +7 -0
- package/dist/lib/browser/{TemplateContainer-QQHVOTSI.mjs → TemplateContainer-6ZGGH5T4.mjs} +4 -4
- package/dist/lib/browser/TemplateContainer-6ZGGH5T4.mjs.map +7 -0
- package/dist/lib/browser/{ai-client-MK2ZZII2.mjs → ai-client-ML7OQWAO.mjs} +6 -6
- package/dist/lib/browser/ai-client-ML7OQWAO.mjs.map +7 -0
- package/dist/lib/browser/{app-graph-builder-E4H5DCOJ.mjs → app-graph-builder-UJ5NHRGK.mjs} +31 -33
- package/dist/lib/browser/app-graph-builder-UJ5NHRGK.mjs.map +7 -0
- package/dist/lib/browser/{chunk-JQFUME3B.mjs → chunk-44HZKIAW.mjs} +5 -5
- package/dist/lib/browser/chunk-44HZKIAW.mjs.map +7 -0
- package/dist/lib/browser/{chunk-XOZ7YMO3.mjs → chunk-LKP65RPA.mjs} +2 -2
- package/dist/lib/browser/chunk-NTBGTFTV.mjs +15 -0
- package/dist/lib/browser/chunk-NTBGTFTV.mjs.map +7 -0
- package/dist/lib/browser/{chunk-BI6AHRNJ.mjs → chunk-OZL4OHTU.mjs} +15 -15
- package/dist/lib/browser/chunk-OZL4OHTU.mjs.map +7 -0
- package/dist/lib/browser/chunk-TQ3QW3HJ.mjs +2072 -0
- package/dist/lib/browser/chunk-TQ3QW3HJ.mjs.map +7 -0
- package/dist/lib/browser/{chunk-AAOKC2JN.mjs → chunk-TU7UUGWQ.mjs} +68 -73
- package/dist/lib/browser/chunk-TU7UUGWQ.mjs.map +7 -0
- package/dist/lib/browser/chunk-WPZ4UANI.mjs +16 -0
- package/dist/lib/browser/index.mjs +53 -68
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/{intent-resolver-3UICTGPM.mjs → intent-resolver-LEAPB55Q.mjs} +10 -11
- package/dist/lib/browser/intent-resolver-LEAPB55Q.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/{react-surface-LXCNUSZN.mjs → react-surface-TMF7JJA4.mjs} +34 -37
- package/dist/lib/browser/react-surface-TMF7JJA4.mjs.map +7 -0
- package/dist/lib/browser/{settings-XRHXVWGB.mjs → settings-N4HEXADL.mjs} +6 -6
- package/dist/lib/browser/settings-N4HEXADL.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +4 -10
- package/dist/lib/node-esm/ChatContainer-VOLG7J6N.mjs +58 -0
- package/dist/lib/node-esm/ChatContainer-VOLG7J6N.mjs.map +7 -0
- package/dist/lib/node-esm/ChatDialog-B2XNUNRM.mjs +75 -0
- package/dist/lib/node-esm/ChatDialog-B2XNUNRM.mjs.map +7 -0
- package/dist/lib/node-esm/{BlueprintContainer-STOJAVML.mjs → SequenceContainer-WWG6IMN3.mjs} +38 -37
- package/dist/lib/node-esm/SequenceContainer-WWG6IMN3.mjs.map +7 -0
- package/dist/lib/node-esm/{TemplateContainer-SOEWY2ZN.mjs → TemplateContainer-6KRNEMVE.mjs} +4 -4
- package/dist/lib/node-esm/TemplateContainer-6KRNEMVE.mjs.map +7 -0
- package/dist/lib/node-esm/{ai-client-XGZBJ6BE.mjs → ai-client-2FQ434CT.mjs} +6 -6
- package/dist/lib/node-esm/ai-client-2FQ434CT.mjs.map +7 -0
- package/dist/lib/node-esm/{app-graph-builder-3SY5MBIK.mjs → app-graph-builder-MEQ5CYNI.mjs} +31 -33
- package/dist/lib/node-esm/app-graph-builder-MEQ5CYNI.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-D3HTVK5D.mjs +2073 -0
- package/dist/lib/node-esm/chunk-D3HTVK5D.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-3UEZLJ2V.mjs → chunk-E6V2RUQ2.mjs} +5 -5
- package/dist/lib/node-esm/chunk-E6V2RUQ2.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-UCOFKNKN.mjs → chunk-HVMVHP4R.mjs} +15 -15
- package/dist/lib/node-esm/chunk-HVMVHP4R.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-HXKRKIN2.mjs +18 -0
- package/dist/lib/node-esm/{chunk-BB2TAT4P.mjs → chunk-KOC6ESG7.mjs} +2 -2
- package/dist/lib/node-esm/{chunk-OYN6HLXZ.mjs → chunk-VESVUAOS.mjs} +5 -5
- package/dist/lib/node-esm/chunk-VESVUAOS.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-J6UXXZGJ.mjs → chunk-YYUVTTVK.mjs} +68 -73
- package/dist/lib/node-esm/chunk-YYUVTTVK.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +53 -68
- package/dist/lib/node-esm/index.mjs.map +3 -3
- package/dist/lib/node-esm/{intent-resolver-E6MXTYAU.mjs → intent-resolver-4ULF3F7U.mjs} +10 -11
- package/dist/lib/node-esm/intent-resolver-4ULF3F7U.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/{react-surface-7HA5EDWY.mjs → react-surface-6XL6SWL2.mjs} +34 -37
- package/dist/lib/node-esm/react-surface-6XL6SWL2.mjs.map +7 -0
- package/dist/lib/node-esm/{settings-5IAY6BT4.mjs → settings-WQ76EG6O.mjs} +6 -6
- package/dist/lib/node-esm/settings-WQ76EG6O.mjs.map +7 -0
- package/dist/lib/node-esm/types/index.mjs +4 -10
- package/dist/types/src/capabilities/ai-client.d.ts.map +1 -1
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
- package/dist/types/src/capabilities/capabilities.d.ts.map +1 -1
- 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/Chat/Chat.d.ts +42 -0
- package/dist/types/src/components/Chat/Chat.d.ts.map +1 -0
- package/dist/types/src/components/Chat/index.d.ts +2 -0
- package/dist/types/src/components/Chat/index.d.ts.map +1 -0
- package/dist/types/src/components/ChatContainer.d.ts +5 -5
- 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 +10 -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/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 +7 -0
- package/dist/types/src/components/ChatPrompt/ChatStatusIndicator.d.ts.map +1 -0
- package/dist/types/src/components/ChatPrompt/events.d.ts +17 -0
- package/dist/types/src/components/ChatPrompt/events.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/{Thread/ThreadMessage.d.ts → ChatThread/ChatMessage.d.ts} +6 -4
- package/dist/types/src/components/ChatThread/ChatMessage.d.ts.map +1 -0
- package/dist/types/src/components/ChatThread/ChatThread.d.ts +25 -0
- package/dist/types/src/components/ChatThread/ChatThread.d.ts.map +1 -0
- package/dist/types/src/components/ChatThread/ChatThread.stories.d.ts +232 -0
- package/dist/types/src/components/ChatThread/ChatThread.stories.d.ts.map +1 -0
- package/dist/types/src/components/ChatThread/ToolBlock.d.ts +18 -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/ChatThread/reducer.d.ts.map +1 -0
- package/dist/types/src/components/SequenceContainer.d.ts +9 -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/TemplateContainer.d.ts +4 -3
- package/dist/types/src/components/TemplateContainer.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/TemplateEditor.stories.d.ts +1 -1
- 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 +1 -1
- package/dist/types/src/components/TemplateEditor/TemplateForm.stories.d.ts.map +1 -1
- package/dist/types/src/components/Toolbox/Toolbox.d.ts +10 -3
- 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} +27 -17
- 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 +4 -4
- package/dist/types/src/hooks/index.d.ts.map +1 -1
- package/dist/types/src/hooks/useBlueprints.d.ts +4 -0
- package/dist/types/src/hooks/useBlueprints.d.ts.map +1 -0
- package/dist/types/src/hooks/useChatProcessor.d.ts +20 -6
- package/dist/types/src/hooks/useChatProcessor.d.ts.map +1 -1
- package/dist/types/src/hooks/useContextProvider.d.ts +6 -0
- package/dist/types/src/hooks/useContextProvider.d.ts.map +1 -1
- package/dist/types/src/hooks/useServiceContainer.d.ts +8 -0
- package/dist/types/src/hooks/useServiceContainer.d.ts.map +1 -0
- 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 +199 -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 +61 -113
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/index.d.ts +1 -2
- package/dist/types/src/types/index.d.ts.map +1 -1
- package/dist/types/src/types/schema.d.ts +71 -0
- package/dist/types/src/types/schema.d.ts.map +1 -0
- package/dist/types/src/types/service.d.ts +6 -6
- package/dist/types/src/types/service.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +76 -74
- package/src/AssistantPlugin.tsx +13 -13
- package/src/capabilities/ai-client.ts +3 -6
- package/src/capabilities/app-graph-builder.ts +30 -26
- package/src/capabilities/capabilities.ts +2 -3
- package/src/capabilities/intent-resolver.ts +6 -6
- package/src/capabilities/react-surface.tsx +29 -29
- package/src/capabilities/settings.ts +3 -3
- package/src/components/AssistantSettings/AssistantSettings.tsx +4 -4
- package/src/components/Chat/Chat.tsx +348 -0
- package/src/{experimental/transcription → components/Chat}/index.ts +2 -0
- package/src/components/ChatContainer.tsx +24 -18
- package/src/components/ChatDialog.tsx +65 -0
- package/src/components/ChatPrompt/ChatActions.tsx +76 -0
- package/src/components/ChatPrompt/ChatOptionsMenu.tsx +52 -0
- package/src/components/ChatPrompt/ChatReferences.tsx +52 -0
- package/src/components/ChatPrompt/ChatStatusIndicator.tsx +26 -0
- package/src/components/ChatPrompt/events.ts +12 -0
- package/src/components/ChatPrompt/index.ts +10 -0
- package/src/components/{Thread/ThreadMessage.tsx → ChatThread/ChatMessage.tsx} +35 -31
- package/src/components/ChatThread/ChatThread.stories.tsx +148 -0
- package/src/components/ChatThread/ChatThread.tsx +68 -0
- package/src/components/{Thread/ToolInvocations.tsx → ChatThread/ToolBlock.tsx} +13 -8
- package/src/components/{AmbientDialog → ChatThread}/index.ts +1 -1
- package/src/components/PromptSettings.tsx +2 -2
- package/src/components/{BlueprintContainer.tsx → SequenceContainer.tsx} +23 -32
- package/src/components/SequenceEditor/SequenceEditor.stories.tsx +32 -0
- package/src/components/{BlueprintEditor/BlueprintEditor.tsx → SequenceEditor/SequenceEditor.tsx} +7 -7
- package/src/components/SequenceEditor/index.ts +5 -0
- package/src/components/TemplateContainer.tsx +7 -5
- package/src/components/TemplateEditor/TemplateEditor.stories.tsx +2 -2
- package/src/components/TemplateEditor/TemplateEditor.tsx +2 -2
- package/src/components/TemplateEditor/TemplateForm.stories.tsx +2 -2
- package/src/components/TemplateEditor/TemplateForm.tsx +2 -3
- package/src/components/Toolbox/Toolbox.stories.tsx +4 -5
- package/src/components/Toolbox/Toolbox.tsx +56 -3
- package/src/components/index.ts +4 -5
- package/src/events.ts +2 -2
- package/src/hooks/{processor.test.ts → chat-processor.test.ts} +1 -1
- package/src/hooks/{processor.ts → chat-processor.ts} +115 -72
- package/src/hooks/index.ts +4 -4
- package/src/hooks/useBlueprints.ts +31 -0
- package/src/hooks/useChatProcessor.tsx +69 -24
- package/src/hooks/useContextProvider.ts +8 -2
- package/src/hooks/useServiceContainer.ts +42 -0
- package/src/queue-logger.ts +6 -6
- package/src/stories/Chat.stories.tsx +269 -0
- package/src/testing/index.ts +1 -1
- package/src/testing/{test-blueprint.ts → test-sequence.ts} +4 -9
- package/src/tools/openapi.test.ts +11 -11
- package/src/translations.ts +24 -22
- package/src/types/index.ts +1 -2
- package/src/types/schema.ts +86 -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.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.map +0 -7
- package/dist/lib/browser/app-graph-builder-E4H5DCOJ.mjs.map +0 -7
- 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-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/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 +0 -44
- 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.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.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-3UEZLJ2V.mjs.map +0 -7
- 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.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.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/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/BlueprintContainer.d.ts +0 -9
- package/dist/types/src/components/BlueprintContainer.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/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.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/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/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/types.d.ts +0 -50
- package/dist/types/src/types/types.d.ts.map +0 -1
- 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/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/index.ts +0 -6
- package/src/hooks/useMessageQueue.ts +0 -22
- package/src/hooks/useServices.ts +0 -28
- 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/types/chat.ts +0 -32
- package/src/types/types.ts +0 -48
- /package/dist/lib/browser/{chunk-XOZ7YMO3.mjs.map → chunk-LKP65RPA.mjs.map} +0 -0
- /package/dist/lib/browser/{chunk-MEGMOFJB.mjs.map → chunk-WPZ4UANI.mjs.map} +0 -0
- /package/dist/lib/node-esm/{chunk-34EX6E5Q.mjs.map → chunk-HXKRKIN2.mjs.map} +0 -0
- /package/dist/lib/node-esm/{chunk-BB2TAT4P.mjs.map → chunk-KOC6ESG7.mjs.map} +0 -0
- /package/dist/types/src/components/{Thread → ChatThread}/reducer.d.ts +0 -0
- /package/src/components/{Thread → ChatThread}/reducer.ts +0 -0
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import React from 'react';
|
|
6
|
+
|
|
7
|
+
import { IconButton, Select, useTranslation } from '@dxos/react-ui';
|
|
8
|
+
import { mx } from '@dxos/react-ui-theme';
|
|
9
|
+
|
|
10
|
+
import { type ChatEvent } from './events';
|
|
11
|
+
import { meta } from '../../meta';
|
|
12
|
+
|
|
13
|
+
export type ChatActionsProps = {
|
|
14
|
+
microphone?: boolean;
|
|
15
|
+
recording?: boolean;
|
|
16
|
+
processing?: boolean;
|
|
17
|
+
onEvent?: (event: ChatEvent) => void;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export const ChatActions = ({ microphone, recording, processing, onEvent }: ChatActionsProps) => {
|
|
21
|
+
const { t } = useTranslation(meta.id);
|
|
22
|
+
|
|
23
|
+
return (
|
|
24
|
+
<div className='flex items-center mie-1'>
|
|
25
|
+
{/* TODO(burdon): Modes (models and/or presets for blueprints?). */}
|
|
26
|
+
<Select.Root value={'ollama'} disabled>
|
|
27
|
+
<Select.TriggerButton classNames='mie-2 text-sm' />
|
|
28
|
+
<Select.Content>
|
|
29
|
+
<Select.Option value={'ollama'} classNames='text-sm'>
|
|
30
|
+
Ollama
|
|
31
|
+
</Select.Option>
|
|
32
|
+
</Select.Content>
|
|
33
|
+
</Select.Root>
|
|
34
|
+
|
|
35
|
+
{(processing && (
|
|
36
|
+
<IconButton
|
|
37
|
+
disabled={!processing}
|
|
38
|
+
classNames='px-1.5'
|
|
39
|
+
variant='ghost'
|
|
40
|
+
size={5}
|
|
41
|
+
icon='ph--x--regular'
|
|
42
|
+
iconOnly
|
|
43
|
+
label={t('button cancel processing')}
|
|
44
|
+
onClick={() => onEvent?.({ type: 'cancel' })}
|
|
45
|
+
/>
|
|
46
|
+
)) || (
|
|
47
|
+
<IconButton
|
|
48
|
+
classNames='px-1.5'
|
|
49
|
+
variant='ghost'
|
|
50
|
+
size={5}
|
|
51
|
+
icon='ph--arrow-down--regular'
|
|
52
|
+
iconOnly
|
|
53
|
+
label={t('button scroll down')}
|
|
54
|
+
onClick={() => onEvent?.({ type: 'scroll-to-bottom' })}
|
|
55
|
+
/>
|
|
56
|
+
)}
|
|
57
|
+
|
|
58
|
+
{microphone && (
|
|
59
|
+
<IconButton
|
|
60
|
+
disabled={!processing}
|
|
61
|
+
classNames={mx('px-1.5', recording && 'bg-primary-500')}
|
|
62
|
+
variant='ghost'
|
|
63
|
+
size={5}
|
|
64
|
+
icon='ph--microphone--regular'
|
|
65
|
+
iconOnly
|
|
66
|
+
noTooltip
|
|
67
|
+
label={t('button microphone')}
|
|
68
|
+
onMouseDown={() => onEvent?.({ type: 'record-start' })}
|
|
69
|
+
onMouseUp={() => onEvent?.({ type: 'record-stop' })}
|
|
70
|
+
onTouchStart={() => onEvent?.({ type: 'record-start' })}
|
|
71
|
+
onTouchEnd={() => onEvent?.({ type: 'record-stop' })}
|
|
72
|
+
/>
|
|
73
|
+
)}
|
|
74
|
+
</div>
|
|
75
|
+
);
|
|
76
|
+
};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import React, { useMemo } from 'react';
|
|
6
|
+
|
|
7
|
+
import { type Blueprint, type BlueprintRegistry } from '@dxos/assistant';
|
|
8
|
+
import { DropdownMenu, IconButton, Input, useTranslation } from '@dxos/react-ui';
|
|
9
|
+
|
|
10
|
+
import { meta } from '../../meta';
|
|
11
|
+
|
|
12
|
+
export type ChatOptionsMenuProps = {
|
|
13
|
+
blueprintRegistry?: BlueprintRegistry;
|
|
14
|
+
blueprints?: Blueprint[];
|
|
15
|
+
onChange?: (key: string, active: boolean) => void;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export const ChatOptionsMenu = ({ blueprintRegistry, blueprints, onChange }: ChatOptionsMenuProps) => {
|
|
19
|
+
const { t } = useTranslation(meta.id);
|
|
20
|
+
const blueprintOptions = useMemo(
|
|
21
|
+
() => blueprintRegistry?.query().map((blueprint) => ({ key: blueprint.key, label: blueprint.name })),
|
|
22
|
+
[blueprintRegistry],
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
return (
|
|
26
|
+
<DropdownMenu.Root>
|
|
27
|
+
<DropdownMenu.Trigger asChild disabled={!blueprintOptions?.length}>
|
|
28
|
+
<IconButton icon='ph--plus--regular' variant='ghost' size={5} iconOnly label={t('button add blueprint')} />
|
|
29
|
+
</DropdownMenu.Trigger>
|
|
30
|
+
<DropdownMenu.Portal>
|
|
31
|
+
<DropdownMenu.Content side='left'>
|
|
32
|
+
<DropdownMenu.Viewport>
|
|
33
|
+
{blueprintOptions?.map((option) => (
|
|
34
|
+
<DropdownMenu.Item key={option.key}>
|
|
35
|
+
<Input.Root>
|
|
36
|
+
<Input.Checkbox
|
|
37
|
+
checked={!!blueprints?.find((blueprint) => blueprint.key === option.key)}
|
|
38
|
+
onCheckedChange={(checked) => onChange?.(option.key, !!checked)}
|
|
39
|
+
/>
|
|
40
|
+
{/* TODO(burdon): Remove need for custom margin. */}
|
|
41
|
+
{/* TODO(burdon): Clicking on label doesn't toggle checkbox. */}
|
|
42
|
+
<Input.Label classNames='m-0'>{option.label}</Input.Label>
|
|
43
|
+
</Input.Root>
|
|
44
|
+
</DropdownMenu.Item>
|
|
45
|
+
))}
|
|
46
|
+
</DropdownMenu.Viewport>
|
|
47
|
+
<DropdownMenu.Arrow />
|
|
48
|
+
</DropdownMenu.Content>
|
|
49
|
+
</DropdownMenu.Portal>
|
|
50
|
+
</DropdownMenu.Root>
|
|
51
|
+
);
|
|
52
|
+
};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import React, { useCallback } from 'react';
|
|
6
|
+
|
|
7
|
+
import { type ContextBinder } from '@dxos/assistant';
|
|
8
|
+
import { type Space } from '@dxos/client/echo';
|
|
9
|
+
import { Filter, Obj, Ref } from '@dxos/echo';
|
|
10
|
+
import { type ThemedClassName, useAsyncState, useTranslation } from '@dxos/react-ui';
|
|
11
|
+
import { TagPicker, type TagPickerItemData, type TagPickerOptions } from '@dxos/react-ui-tag-picker';
|
|
12
|
+
import { isNonNullable } from '@dxos/util';
|
|
13
|
+
|
|
14
|
+
import { meta } from '../../meta';
|
|
15
|
+
|
|
16
|
+
export type ChatReferencesProps = ThemedClassName<{
|
|
17
|
+
space: Space;
|
|
18
|
+
context: ContextBinder;
|
|
19
|
+
onUpdate?: (ids: string[]) => void;
|
|
20
|
+
}>;
|
|
21
|
+
|
|
22
|
+
export const ChatReferences = ({ classNames, space, context, onUpdate }: ChatReferencesProps) => {
|
|
23
|
+
const { t } = useTranslation(meta.id);
|
|
24
|
+
|
|
25
|
+
const [items] = useAsyncState<TagPickerItemData[]>(async () => {
|
|
26
|
+
const objects = await Ref.Array.loadAll(context.objects.value ?? []);
|
|
27
|
+
return objects.filter(isNonNullable).map((obj) => ({ id: obj.id, label: Obj.getLabel(obj) ?? obj.id }));
|
|
28
|
+
}, [context]);
|
|
29
|
+
|
|
30
|
+
const handleSearch = useCallback<NonNullable<TagPickerOptions['onSearch']>>(
|
|
31
|
+
(text, ids) => {
|
|
32
|
+
// TODO(burdon): Filter by Item tag (e.g., exclude "contacts") and Query by object label.
|
|
33
|
+
// TODO(burdon): Change to Filter.text().
|
|
34
|
+
const objects = space.db.query(Filter.everything()).runSync();
|
|
35
|
+
return objects
|
|
36
|
+
.map(({ object }) => ({ id: object.id, label: Obj.getLabel(object) ?? '' }))
|
|
37
|
+
.filter(({ id, label }) => !ids.includes(id) && label.toLocaleLowerCase().includes(text.toLocaleLowerCase()));
|
|
38
|
+
},
|
|
39
|
+
[space],
|
|
40
|
+
);
|
|
41
|
+
|
|
42
|
+
return (
|
|
43
|
+
<TagPicker
|
|
44
|
+
classNames={classNames}
|
|
45
|
+
mode='multi-select'
|
|
46
|
+
placeholder={t('context objects placeholder')}
|
|
47
|
+
items={items}
|
|
48
|
+
onSearch={handleSearch}
|
|
49
|
+
onUpdate={onUpdate}
|
|
50
|
+
/>
|
|
51
|
+
);
|
|
52
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import React from 'react';
|
|
6
|
+
|
|
7
|
+
import { Icon, Tooltip } from '@dxos/react-ui';
|
|
8
|
+
import { Spinner } from '@dxos/react-ui-sfx';
|
|
9
|
+
import { errorText } from '@dxos/react-ui-theme';
|
|
10
|
+
|
|
11
|
+
export type ChatStatusIndicatorProps = {
|
|
12
|
+
error?: Error;
|
|
13
|
+
processing?: boolean;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export const ChatStatusIndicator = ({ error, processing }: ChatStatusIndicatorProps) => {
|
|
17
|
+
if (error) {
|
|
18
|
+
return (
|
|
19
|
+
<Tooltip.Trigger content={error.message} delayDuration={0}>
|
|
20
|
+
<Icon icon='ph--warning-circle--regular' classNames={errorText} size={5} />
|
|
21
|
+
</Tooltip.Trigger>
|
|
22
|
+
);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
return <Spinner active={processing} />;
|
|
26
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
export type ChatEvent =
|
|
6
|
+
| { type: 'submit'; text: string }
|
|
7
|
+
| { type: 'cancel' }
|
|
8
|
+
| { type: 'thread-open' }
|
|
9
|
+
| { type: 'thread-close' }
|
|
10
|
+
| { type: 'scroll-to-bottom' }
|
|
11
|
+
| { type: 'record-start' }
|
|
12
|
+
| { type: 'record-stop' };
|
|
@@ -15,34 +15,16 @@ import {
|
|
|
15
15
|
ToggleContainer as NativeToggleContainer,
|
|
16
16
|
type ToggleContainerProps,
|
|
17
17
|
} from '@dxos/react-ui-components';
|
|
18
|
-
import { Json } from '@dxos/react-ui-syntax-highlighter';
|
|
19
18
|
import { mx } from '@dxos/react-ui-theme';
|
|
20
19
|
import { safeParseJson } from '@dxos/util';
|
|
21
20
|
|
|
22
|
-
import { ToolBlock, isToolMessage } from './
|
|
21
|
+
import { Json, ToolBlock, isToolMessage } from './ToolBlock';
|
|
22
|
+
import { type ChatProcessor } from '../../hooks';
|
|
23
23
|
import { ToolboxContainer } from '../Toolbox';
|
|
24
24
|
|
|
25
|
-
|
|
26
|
-
const userClassNames = 'bg-[--user-fill] text-accentSurfaceText';
|
|
27
|
-
|
|
28
|
-
const ToggleContainer = (props: ToggleContainerProps) => {
|
|
29
|
-
return <NativeToggleContainer {...props} classNames={mx(panelClassNames, props.classNames)} />;
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
const MessageContainer = ({ children, classNames, user }: ThemedClassName<PropsWithChildren<{ user?: boolean }>>) => {
|
|
33
|
-
if (!children) {
|
|
34
|
-
return null;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
return (
|
|
38
|
-
<div role='list-item' className={mx('flex w-full', user && 'justify-end', classNames)}>
|
|
39
|
-
<div className={mx(user ? ['px-2 py-1 rounded-md', userClassNames] : 'w-full')}>{children}</div>
|
|
40
|
-
</div>
|
|
41
|
-
);
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
export type ThreadMessageProps = ThemedClassName<{
|
|
25
|
+
export type ChatMessageProps = ThemedClassName<{
|
|
45
26
|
space?: Space;
|
|
27
|
+
processor?: ChatProcessor;
|
|
46
28
|
message: Message;
|
|
47
29
|
debug?: boolean;
|
|
48
30
|
tools?: Tool[];
|
|
@@ -51,21 +33,22 @@ export type ThreadMessageProps = ThemedClassName<{
|
|
|
51
33
|
onAddToGraph?: (object: Obj.Any) => void;
|
|
52
34
|
}>;
|
|
53
35
|
|
|
54
|
-
export const
|
|
36
|
+
export const ChatMessage = ({
|
|
55
37
|
classNames,
|
|
56
38
|
space,
|
|
39
|
+
processor,
|
|
57
40
|
message,
|
|
58
41
|
tools,
|
|
59
42
|
onPrompt,
|
|
60
43
|
onAddToGraph,
|
|
61
|
-
}) => {
|
|
44
|
+
}: ChatMessageProps) => {
|
|
62
45
|
const { role, content = [] } = message;
|
|
63
46
|
|
|
64
47
|
// TODO(burdon): Restructure types to make check unnecessary.
|
|
65
48
|
if (isToolMessage(message)) {
|
|
66
49
|
return (
|
|
67
50
|
<MessageContainer classNames={mx(classNames, 'animate-[fadeIn_0.5s]')}>
|
|
68
|
-
<ToolBlock
|
|
51
|
+
<ToolBlock classNames={panelClassNames} message={message} tools={tools} />
|
|
69
52
|
</MessageContainer>
|
|
70
53
|
);
|
|
71
54
|
}
|
|
@@ -84,7 +67,7 @@ export const ThreadMessage: FC<ThreadMessageProps> = ({
|
|
|
84
67
|
classNames={mx(classNames, 'animate-[fadeIn_0.5s]')}
|
|
85
68
|
user={block.type === 'text' && role === 'user'}
|
|
86
69
|
>
|
|
87
|
-
<Component space={space} block={block} onPrompt={onPrompt} onAddToGraph={onAddToGraph} />
|
|
70
|
+
<Component space={space} processor={processor} block={block} onPrompt={onPrompt} onAddToGraph={onAddToGraph} />
|
|
88
71
|
</MessageContainer>
|
|
89
72
|
);
|
|
90
73
|
});
|
|
@@ -92,6 +75,8 @@ export const ThreadMessage: FC<ThreadMessageProps> = ({
|
|
|
92
75
|
|
|
93
76
|
type BlockComponent = FC<{
|
|
94
77
|
space?: Space;
|
|
78
|
+
/** @deprecated Replace with context */
|
|
79
|
+
processor?: ChatProcessor;
|
|
95
80
|
block: MessageContentBlock;
|
|
96
81
|
onPrompt?: (text: string) => void;
|
|
97
82
|
onAddToGraph?: (object: Obj.Any) => void;
|
|
@@ -139,14 +124,14 @@ const components: Record<string, BlockComponent> = {
|
|
|
139
124
|
//
|
|
140
125
|
// JSON
|
|
141
126
|
//
|
|
142
|
-
['json' as const]: ({ space, block, onPrompt, onAddToGraph }) => {
|
|
127
|
+
['json' as const]: ({ space, processor, block, onPrompt, onAddToGraph }) => {
|
|
143
128
|
invariant(block.type === 'json');
|
|
144
129
|
|
|
145
130
|
switch (block.disposition) {
|
|
146
131
|
case 'tool_list': {
|
|
147
132
|
return (
|
|
148
133
|
<ToggleContainer title={titles[block.disposition]} defaultOpen={true}>
|
|
149
|
-
<ToolboxContainer space={space} classNames='pbe-2' />
|
|
134
|
+
<ToolboxContainer space={space} processor={processor} classNames='pbe-2' />
|
|
150
135
|
</ToggleContainer>
|
|
151
136
|
);
|
|
152
137
|
}
|
|
@@ -162,7 +147,7 @@ const components: Record<string, BlockComponent> = {
|
|
|
162
147
|
<div className='flex flex-wrap gap-1'>
|
|
163
148
|
{options.map((option, idx) => (
|
|
164
149
|
<Button
|
|
165
|
-
classNames={'animate-[fadeIn_0.5s] rounded-
|
|
150
|
+
classNames={'animate-[fadeIn_0.5s] rounded-sm text-sm'}
|
|
166
151
|
key={option}
|
|
167
152
|
onClick={() => onPrompt?.(option)}
|
|
168
153
|
>
|
|
@@ -197,7 +182,7 @@ const components: Record<string, BlockComponent> = {
|
|
|
197
182
|
const title = block.disposition ? titles[block.disposition] : undefined;
|
|
198
183
|
return (
|
|
199
184
|
<ToggleContainer title={title ?? 'JSON'}>
|
|
200
|
-
<Json data={safeParseJson(block.json ?? block)}
|
|
185
|
+
<Json data={safeParseJson(block.json ?? block)} />
|
|
201
186
|
</ToggleContainer>
|
|
202
187
|
);
|
|
203
188
|
}
|
|
@@ -215,7 +200,7 @@ const components: Record<string, BlockComponent> = {
|
|
|
215
200
|
|
|
216
201
|
return (
|
|
217
202
|
<ToggleContainer title={title ?? 'JSON'}>
|
|
218
|
-
<Json data={block}
|
|
203
|
+
<Json data={block} />
|
|
219
204
|
</ToggleContainer>
|
|
220
205
|
);
|
|
221
206
|
},
|
|
@@ -232,3 +217,22 @@ const titles: Record<string, string> = {
|
|
|
232
217
|
};
|
|
233
218
|
|
|
234
219
|
const systemDispositions: string[] = ['cot', 'artifact-update'];
|
|
220
|
+
|
|
221
|
+
const panelClassNames = 'flex flex-col w-full px-2 bg-activeSurface rounded-sm';
|
|
222
|
+
const userClassNames = 'bg-[--user-fill] text-accentSurfaceText';
|
|
223
|
+
|
|
224
|
+
const ToggleContainer = (props: ToggleContainerProps) => {
|
|
225
|
+
return <NativeToggleContainer {...props} classNames={mx(panelClassNames, props.classNames)} />;
|
|
226
|
+
};
|
|
227
|
+
|
|
228
|
+
const MessageContainer = ({ children, classNames, user }: ThemedClassName<PropsWithChildren<{ user?: boolean }>>) => {
|
|
229
|
+
if (!children) {
|
|
230
|
+
return null;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
return (
|
|
234
|
+
<div role='list-item' className={mx('flex w-full', user && 'justify-end', classNames)}>
|
|
235
|
+
<div className={mx(user ? ['px-2 py-1 rounded-sm', userClassNames] : 'w-full')}>{children}</div>
|
|
236
|
+
</div>
|
|
237
|
+
);
|
|
238
|
+
};
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import '@dxos-theme';
|
|
6
|
+
|
|
7
|
+
import { type StoryObj, type Meta } from '@storybook/react-vite';
|
|
8
|
+
import React, { useEffect, useState } from 'react';
|
|
9
|
+
|
|
10
|
+
import { Message } from '@dxos/ai';
|
|
11
|
+
import { Obj } from '@dxos/echo';
|
|
12
|
+
import { faker } from '@dxos/random';
|
|
13
|
+
import { withClientProvider } from '@dxos/react-client/testing';
|
|
14
|
+
import { ColumnContainer, withLayout, withTheme } from '@dxos/storybook-utils';
|
|
15
|
+
|
|
16
|
+
import { ChatThread } from './ChatThread';
|
|
17
|
+
import { translations } from '../../translations';
|
|
18
|
+
|
|
19
|
+
faker.seed(1);
|
|
20
|
+
|
|
21
|
+
const TEST_MESSAGES: Message[] = [
|
|
22
|
+
Obj.make(Message, {
|
|
23
|
+
role: 'user',
|
|
24
|
+
content: [
|
|
25
|
+
{
|
|
26
|
+
type: 'text',
|
|
27
|
+
text: faker.lorem.sentence(5),
|
|
28
|
+
},
|
|
29
|
+
],
|
|
30
|
+
}),
|
|
31
|
+
Obj.make(Message, {
|
|
32
|
+
role: 'assistant',
|
|
33
|
+
content: [
|
|
34
|
+
{
|
|
35
|
+
type: 'text',
|
|
36
|
+
disposition: 'cot',
|
|
37
|
+
text: Array.from({ length: faker.number.int({ min: 3, max: 5 }) })
|
|
38
|
+
.map((_, idx) => `${idx + 1}. ${faker.lorem.paragraph()}`)
|
|
39
|
+
.join('\n'),
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
type: 'text',
|
|
43
|
+
text: Array.from({ length: faker.number.int({ min: 2, max: 5 }) })
|
|
44
|
+
.map(() => faker.lorem.paragraphs())
|
|
45
|
+
.join('\n\n'),
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
type: 'tool_use',
|
|
49
|
+
id: '1234',
|
|
50
|
+
name: 'search',
|
|
51
|
+
input: {},
|
|
52
|
+
},
|
|
53
|
+
],
|
|
54
|
+
}),
|
|
55
|
+
Obj.make(Message, {
|
|
56
|
+
role: 'user',
|
|
57
|
+
content: [
|
|
58
|
+
{
|
|
59
|
+
type: 'tool_result',
|
|
60
|
+
toolUseId: '1234',
|
|
61
|
+
content: 'This is a tool result.',
|
|
62
|
+
},
|
|
63
|
+
],
|
|
64
|
+
}),
|
|
65
|
+
Obj.make(Message, {
|
|
66
|
+
role: 'assistant',
|
|
67
|
+
content: [
|
|
68
|
+
{
|
|
69
|
+
type: 'tool_use',
|
|
70
|
+
id: '4567',
|
|
71
|
+
name: 'create',
|
|
72
|
+
input: {},
|
|
73
|
+
},
|
|
74
|
+
],
|
|
75
|
+
}),
|
|
76
|
+
Obj.make(Message, {
|
|
77
|
+
role: 'user',
|
|
78
|
+
content: [
|
|
79
|
+
{
|
|
80
|
+
type: 'tool_result',
|
|
81
|
+
toolUseId: '4567',
|
|
82
|
+
content: 'This is a tool result.',
|
|
83
|
+
},
|
|
84
|
+
],
|
|
85
|
+
}),
|
|
86
|
+
Obj.make(Message, {
|
|
87
|
+
role: 'assistant',
|
|
88
|
+
content: [
|
|
89
|
+
{
|
|
90
|
+
type: 'text',
|
|
91
|
+
text: faker.lorem.paragraphs(1),
|
|
92
|
+
},
|
|
93
|
+
],
|
|
94
|
+
}),
|
|
95
|
+
Obj.make(Message, {
|
|
96
|
+
role: 'assistant',
|
|
97
|
+
content: [
|
|
98
|
+
{
|
|
99
|
+
type: 'json',
|
|
100
|
+
disposition: 'suggest',
|
|
101
|
+
json: JSON.stringify({ text: 'Search...' }),
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
type: 'json',
|
|
105
|
+
disposition: 'suggest',
|
|
106
|
+
json: JSON.stringify({ text: faker.lorem.paragraphs(1) }),
|
|
107
|
+
},
|
|
108
|
+
],
|
|
109
|
+
}),
|
|
110
|
+
];
|
|
111
|
+
|
|
112
|
+
const meta = {
|
|
113
|
+
title: 'plugins/plugin-assistant/ChatThread',
|
|
114
|
+
component: ChatThread,
|
|
115
|
+
decorators: [withClientProvider({ createIdentity: true }), withTheme, withLayout({ Container: ColumnContainer })],
|
|
116
|
+
parameters: {
|
|
117
|
+
translations,
|
|
118
|
+
},
|
|
119
|
+
} satisfies Meta<typeof ChatThread>;
|
|
120
|
+
|
|
121
|
+
export default meta;
|
|
122
|
+
|
|
123
|
+
type Story = StoryObj<typeof meta>;
|
|
124
|
+
|
|
125
|
+
export const Default = {
|
|
126
|
+
args: {
|
|
127
|
+
messages: TEST_MESSAGES,
|
|
128
|
+
},
|
|
129
|
+
} satisfies Story;
|
|
130
|
+
|
|
131
|
+
export const Incremental = {
|
|
132
|
+
render: () => {
|
|
133
|
+
const [messages, setMessages] = useState<Message[]>([]);
|
|
134
|
+
useEffect(() => {
|
|
135
|
+
let i = 0;
|
|
136
|
+
const interval = setInterval(() => {
|
|
137
|
+
setMessages((messages) => [...messages, TEST_MESSAGES[i++]]);
|
|
138
|
+
if (i >= TEST_MESSAGES.length) {
|
|
139
|
+
clearInterval(interval);
|
|
140
|
+
}
|
|
141
|
+
}, 2_000);
|
|
142
|
+
|
|
143
|
+
return () => clearInterval(interval);
|
|
144
|
+
}, []);
|
|
145
|
+
|
|
146
|
+
return <ChatThread messages={messages} collapse />;
|
|
147
|
+
},
|
|
148
|
+
} satisfies Story;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import React, { type CSSProperties, forwardRef, useMemo } from 'react';
|
|
6
|
+
|
|
7
|
+
import { type Message } from '@dxos/ai';
|
|
8
|
+
import { PublicKey } from '@dxos/keys';
|
|
9
|
+
import { type Space } from '@dxos/react-client/echo';
|
|
10
|
+
import { type Identity } from '@dxos/react-client/halo';
|
|
11
|
+
import { type ThemedClassName } from '@dxos/react-ui';
|
|
12
|
+
import { ScrollContainer, type ScrollController } from '@dxos/react-ui-components';
|
|
13
|
+
import { mx } from '@dxos/react-ui-theme';
|
|
14
|
+
import { keyToFallback } from '@dxos/util';
|
|
15
|
+
|
|
16
|
+
import { ChatMessage, type ChatMessageProps } from './ChatMessage';
|
|
17
|
+
import { messageReducer } from './reducer';
|
|
18
|
+
import { type ChatProcessor } from '../../hooks';
|
|
19
|
+
|
|
20
|
+
export type ChatThreadProps = ThemedClassName<{
|
|
21
|
+
identity?: Identity;
|
|
22
|
+
space?: Space;
|
|
23
|
+
// TODO(burdon): Replace with context.
|
|
24
|
+
processor?: ChatProcessor;
|
|
25
|
+
messages?: Message[];
|
|
26
|
+
collapse?: boolean;
|
|
27
|
+
}> &
|
|
28
|
+
Pick<ChatMessageProps, 'debug' | 'tools' | 'onPrompt' | 'onDelete' | 'onAddToGraph'>;
|
|
29
|
+
|
|
30
|
+
export const ChatThread = forwardRef<ScrollController, ChatThreadProps>(
|
|
31
|
+
({ classNames, identity, space, processor, messages, collapse = true, ...props }, forwardedRef) => {
|
|
32
|
+
const userHue = useMemo(() => {
|
|
33
|
+
return identity?.profile?.data?.hue || keyToFallback(identity?.identityKey ?? PublicKey.random()).hue;
|
|
34
|
+
}, [identity]);
|
|
35
|
+
|
|
36
|
+
// TODO(dmaretskyi): This needs to be a separate type: `id` is not a valid ObjectId, this needs to accommodate messageId for deletion.
|
|
37
|
+
const { messages: filteredMessages = [] } = useMemo(() => {
|
|
38
|
+
if (collapse) {
|
|
39
|
+
return (messages ?? []).reduce<{ messages: Message[]; current?: Message }>(messageReducer, {
|
|
40
|
+
messages: [],
|
|
41
|
+
});
|
|
42
|
+
} else {
|
|
43
|
+
return { messages: messages ?? [] };
|
|
44
|
+
}
|
|
45
|
+
}, [messages, collapse]);
|
|
46
|
+
|
|
47
|
+
return (
|
|
48
|
+
<ScrollContainer ref={forwardedRef} classNames={classNames} fade>
|
|
49
|
+
<div
|
|
50
|
+
role='none'
|
|
51
|
+
className={mx(filteredMessages.length > 0 && 'pbs-6 pbe-6')}
|
|
52
|
+
style={{ '--user-fill': `var(--dx-${userHue}Fill)` } as CSSProperties}
|
|
53
|
+
>
|
|
54
|
+
{filteredMessages.map((message) => (
|
|
55
|
+
<ChatMessage
|
|
56
|
+
key={message.id}
|
|
57
|
+
classNames='px-4 pbe-4'
|
|
58
|
+
space={space}
|
|
59
|
+
processor={processor}
|
|
60
|
+
message={message}
|
|
61
|
+
{...props}
|
|
62
|
+
/>
|
|
63
|
+
))}
|
|
64
|
+
</div>
|
|
65
|
+
</ScrollContainer>
|
|
66
|
+
);
|
|
67
|
+
},
|
|
68
|
+
);
|
|
@@ -8,11 +8,9 @@ import { type AgentStatus, type Message, type Tool } from '@dxos/ai';
|
|
|
8
8
|
import { log } from '@dxos/log';
|
|
9
9
|
import { type ThemedClassName } from '@dxos/react-ui';
|
|
10
10
|
import { NumericTabs, StatusRoll, ToggleContainer } from '@dxos/react-ui-components';
|
|
11
|
-
import { Json } from '@dxos/react-ui-syntax-highlighter';
|
|
11
|
+
import { type JsonProps, Json as NativeJson } from '@dxos/react-ui-syntax-highlighter';
|
|
12
12
|
import { isNonNullable, isNotFalsy } from '@dxos/util';
|
|
13
13
|
|
|
14
|
-
import { type ThreadMessageProps } from './ThreadMessage';
|
|
15
|
-
|
|
16
14
|
export const isToolMessage = (message: Message) => {
|
|
17
15
|
return message.content.some((block) => block.type === 'tool_use' || block.type === 'tool_result');
|
|
18
16
|
};
|
|
@@ -29,7 +27,12 @@ const getToolCaption = (tool: Tool | undefined, status: AgentStatus | undefined)
|
|
|
29
27
|
return status?.message ?? tool.caption ?? `Calling ${getToolName(tool)}...`;
|
|
30
28
|
};
|
|
31
29
|
|
|
32
|
-
export
|
|
30
|
+
export type ToolBlockProps = ThemedClassName<{
|
|
31
|
+
message: Message;
|
|
32
|
+
tools?: Tool[];
|
|
33
|
+
}>;
|
|
34
|
+
|
|
35
|
+
export const ToolBlock: FC<ToolBlockProps> = ({ classNames, message, tools }) => {
|
|
33
36
|
const { content = [] } = message;
|
|
34
37
|
|
|
35
38
|
let request: { tool: Tool | undefined; block: any } | undefined;
|
|
@@ -43,8 +46,6 @@ export const ToolBlock: FC<ThemedClassName<ThreadMessageProps>> = ({ classNames,
|
|
|
43
46
|
return null;
|
|
44
47
|
}
|
|
45
48
|
|
|
46
|
-
log.info('tool_use', { tool: request?.tool, status: block.currentStatus });
|
|
47
|
-
|
|
48
49
|
request = { tool: tools?.find((tool) => tool.name === block.name), block };
|
|
49
50
|
return { title: getToolCaption(request.tool, block.currentStatus), block };
|
|
50
51
|
}
|
|
@@ -97,10 +98,14 @@ export const ToolContainer: FC<ThemedClassName<{ items: { title: string; block:
|
|
|
97
98
|
|
|
98
99
|
return (
|
|
99
100
|
<ToggleContainer classNames={['flex flex-col', classNames]} title={title} open={open} onChangeOpen={setOpen}>
|
|
100
|
-
<div className='grid grid-cols-[32px_1fr]'>
|
|
101
|
+
<div className='w-full grid grid-cols-[32px_1fr]'>
|
|
101
102
|
<NumericTabs ref={tabsRef} length={items.length} selected={selected} onSelect={handleSelect} />
|
|
102
|
-
<Json data={items[selected].block}
|
|
103
|
+
<Json data={items[selected].block} />
|
|
103
104
|
</div>
|
|
104
105
|
</ToggleContainer>
|
|
105
106
|
);
|
|
106
107
|
};
|
|
108
|
+
|
|
109
|
+
export const Json = ({ data }: Pick<JsonProps, 'data'>) => (
|
|
110
|
+
<NativeJson data={data} classNames='!p-1 text-xs bg-transparent' />
|
|
111
|
+
);
|
|
@@ -8,11 +8,11 @@ import React, { type ChangeEvent, useCallback } from 'react';
|
|
|
8
8
|
import { debounce } from '@dxos/async';
|
|
9
9
|
import { Input, Select, Toolbar, useTranslation } from '@dxos/react-ui';
|
|
10
10
|
|
|
11
|
-
import {
|
|
11
|
+
import { meta } from '../meta';
|
|
12
12
|
import { TemplateKinds, type TemplateType, type TemplateKindSchema } from '../types';
|
|
13
13
|
|
|
14
14
|
export const PromptSettings = ({ template }: { template: TemplateType }) => {
|
|
15
|
-
const { t } = useTranslation(
|
|
15
|
+
const { t } = useTranslation(meta.id);
|
|
16
16
|
|
|
17
17
|
const handleKindChange = useCallback(
|
|
18
18
|
(value: string) => {
|