@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
|
@@ -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
|
-
};
|
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import React, { useCallback, type FC, useEffect } from 'react';
|
|
6
|
-
|
|
7
|
-
import { CollaborationActions, createIntent, useIntentDispatcher } from '@dxos/app-framework';
|
|
8
|
-
import { type AssociatedArtifact } from '@dxos/artifact';
|
|
9
|
-
import { DXN, Ref } from '@dxos/echo';
|
|
10
|
-
import { invariant } from '@dxos/invariant';
|
|
11
|
-
import { log } from '@dxos/log';
|
|
12
|
-
import { getSpace } from '@dxos/react-client/echo';
|
|
13
|
-
import { type ThemedClassName } from '@dxos/react-ui';
|
|
14
|
-
|
|
15
|
-
import { Thread, type ThreadProps } from './Thread';
|
|
16
|
-
import { useChatProcessor, useContextProvider, useMessageQueue } from '../../hooks';
|
|
17
|
-
import { type AIChatType, type AssistantSettingsProps } from '../../types';
|
|
18
|
-
|
|
19
|
-
export type ThreadContainerProps = {
|
|
20
|
-
chat?: AIChatType;
|
|
21
|
-
settings?: AssistantSettingsProps;
|
|
22
|
-
part?: 'deck' | 'dialog';
|
|
23
|
-
associatedArtifact?: AssociatedArtifact;
|
|
24
|
-
} & Pick<ThreadProps, 'debug' | 'transcription' | 'onOpenChange' | 'onAddToGraph'>;
|
|
25
|
-
|
|
26
|
-
// TODO(burdon): Since this only wraps Thread, just separate out hook?
|
|
27
|
-
export const ThreadContainer: FC<ThemedClassName<ThreadContainerProps>> = ({
|
|
28
|
-
classNames,
|
|
29
|
-
chat,
|
|
30
|
-
settings,
|
|
31
|
-
part,
|
|
32
|
-
associatedArtifact,
|
|
33
|
-
onOpenChange,
|
|
34
|
-
...props
|
|
35
|
-
}) => {
|
|
36
|
-
const space = getSpace(chat);
|
|
37
|
-
const contextProvider = useContextProvider(space);
|
|
38
|
-
const processor = useChatProcessor({ chat, space, settings, part, associatedArtifact });
|
|
39
|
-
const messageQueue = useMessageQueue(chat);
|
|
40
|
-
const { dispatchPromise: dispatch } = useIntentDispatcher();
|
|
41
|
-
// TODO(thure): This will be referentially new on every render, is it causing overreactivity?
|
|
42
|
-
const messages = [...(messageQueue?.objects ?? []), ...processor.messages.value];
|
|
43
|
-
|
|
44
|
-
// Post last message to document.
|
|
45
|
-
useEffect(() => {
|
|
46
|
-
if (!processor.streaming.value && messageQueue?.objects) {
|
|
47
|
-
const message = messageQueue.objects[messageQueue.objects.length - 1];
|
|
48
|
-
if (space && chat && message && dispatch && associatedArtifact) {
|
|
49
|
-
void dispatch(
|
|
50
|
-
createIntent(CollaborationActions.InsertContent, {
|
|
51
|
-
target: associatedArtifact,
|
|
52
|
-
object: Ref.fromDXN(new DXN(DXN.kind.QUEUE, [...chat.queue.dxn.parts, message.id])),
|
|
53
|
-
label: 'View proposal',
|
|
54
|
-
}),
|
|
55
|
-
);
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
}, [messageQueue, associatedArtifact, processor.streaming.value]);
|
|
59
|
-
|
|
60
|
-
const handleSubmit = useCallback(
|
|
61
|
-
(text: string) => {
|
|
62
|
-
// Don't accept input if still processing.
|
|
63
|
-
if (processor.streaming.value) {
|
|
64
|
-
log.warn('ignoring submit; still processing.');
|
|
65
|
-
return false;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
onOpenChange?.(true);
|
|
69
|
-
|
|
70
|
-
invariant(messageQueue);
|
|
71
|
-
void processor.request(text, {
|
|
72
|
-
history: messageQueue.objects,
|
|
73
|
-
onComplete: (messages) => {
|
|
74
|
-
void messageQueue.append(messages);
|
|
75
|
-
},
|
|
76
|
-
});
|
|
77
|
-
|
|
78
|
-
return true;
|
|
79
|
-
},
|
|
80
|
-
[processor, messageQueue, onOpenChange],
|
|
81
|
-
);
|
|
82
|
-
|
|
83
|
-
const handleCancel = useCallback(() => {
|
|
84
|
-
if (processor.streaming.value) {
|
|
85
|
-
void processor.cancel();
|
|
86
|
-
}
|
|
87
|
-
}, [processor]);
|
|
88
|
-
|
|
89
|
-
return (
|
|
90
|
-
<Thread
|
|
91
|
-
classNames={classNames}
|
|
92
|
-
space={space}
|
|
93
|
-
messages={messages}
|
|
94
|
-
processing={processor.streaming.value}
|
|
95
|
-
error={processor.error.value}
|
|
96
|
-
tools={processor.tools}
|
|
97
|
-
contextProvider={contextProvider}
|
|
98
|
-
onSubmit={handleSubmit}
|
|
99
|
-
onCancel={handleCancel}
|
|
100
|
-
onPrompt={handleSubmit}
|
|
101
|
-
onOpenChange={onOpenChange}
|
|
102
|
-
{...props}
|
|
103
|
-
/>
|
|
104
|
-
);
|
|
105
|
-
};
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { useMemo } from 'react';
|
|
6
|
-
|
|
7
|
-
import { type Message } from '@dxos/ai';
|
|
8
|
-
import { createQueueDXN } from '@dxos/echo-schema';
|
|
9
|
-
import { getSpace, useQueue } from '@dxos/react-client/echo';
|
|
10
|
-
|
|
11
|
-
import { type AIChatType } from '../types';
|
|
12
|
-
|
|
13
|
-
export const useMessageQueue = (chat?: AIChatType) => {
|
|
14
|
-
const space = getSpace(chat);
|
|
15
|
-
const queueDxn = useMemo(() => {
|
|
16
|
-
// TODO(dmaretskyi): Chat.queue.dxn should be a valid DXN already.
|
|
17
|
-
const dxn = space && chat?.queue.dxn;
|
|
18
|
-
return dxn ? createQueueDXN(space.id, dxn.parts.at(-1)) : undefined;
|
|
19
|
-
}, [space, chat?.queue.dxn]);
|
|
20
|
-
|
|
21
|
-
return useQueue<Message>(queueDxn);
|
|
22
|
-
};
|
package/src/hooks/useServices.ts
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { useEffect, useMemo, useState } from 'react';
|
|
6
|
-
|
|
7
|
-
import { type Space } from '@dxos/client/echo';
|
|
8
|
-
|
|
9
|
-
import { MockServiceRegistry } from '../testing';
|
|
10
|
-
import { type ServiceType, type ServiceQuery } from '../types';
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Retrieves matching services from the registry.
|
|
14
|
-
*/
|
|
15
|
-
export const useServices = (space: Space, query?: ServiceQuery): ServiceType[] => {
|
|
16
|
-
const registry = useMemo(() => new MockServiceRegistry(), []);
|
|
17
|
-
const [services, setServices] = useState<ServiceType[]>([]);
|
|
18
|
-
useEffect(() => {
|
|
19
|
-
const t = setTimeout(async () => {
|
|
20
|
-
const services = await registry.queryServices(query);
|
|
21
|
-
setServices(services);
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
return () => clearTimeout(t);
|
|
25
|
-
}, [query, registry]);
|
|
26
|
-
|
|
27
|
-
return services;
|
|
28
|
-
};
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import '@dxos-theme';
|
|
6
|
-
|
|
7
|
-
import { type Meta, type StoryObj } from '@storybook/react';
|
|
8
|
-
import React, { useCallback, useState } from 'react';
|
|
9
|
-
|
|
10
|
-
import { withPluginManager } from '@dxos/app-framework/testing';
|
|
11
|
-
import { JsonFilter } from '@dxos/react-ui-syntax-highlighter';
|
|
12
|
-
import { withLayout, withTheme } from '@dxos/storybook-utils';
|
|
13
|
-
|
|
14
|
-
import { PromptBar, type PromptBarProps } from '../components';
|
|
15
|
-
import { type Expression, QueryParser } from '../parser';
|
|
16
|
-
import translations from '../translations';
|
|
17
|
-
|
|
18
|
-
const DefaultStory = (props: PromptBarProps) => {
|
|
19
|
-
const [ast, setAst] = useState<Expression>();
|
|
20
|
-
const handleSubmit = useCallback<NonNullable<PromptBarProps['onSubmit']>>((text) => {
|
|
21
|
-
const parser = new QueryParser(text);
|
|
22
|
-
const ast = parser.parse();
|
|
23
|
-
setAst(ast);
|
|
24
|
-
}, []);
|
|
25
|
-
|
|
26
|
-
return (
|
|
27
|
-
<div className='flex flex-col w-[40rem] border border-separator rounded-md'>
|
|
28
|
-
<PromptBar {...props} onSubmit={handleSubmit} />
|
|
29
|
-
<JsonFilter data={{ ast }} />
|
|
30
|
-
</div>
|
|
31
|
-
);
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
const meta: Meta<typeof PromptBar> = {
|
|
35
|
-
title: 'plugins/plugin-assistant/QueryPrompt',
|
|
36
|
-
render: DefaultStory,
|
|
37
|
-
decorators: [
|
|
38
|
-
withPluginManager({
|
|
39
|
-
plugins: [],
|
|
40
|
-
}),
|
|
41
|
-
withTheme,
|
|
42
|
-
withLayout({
|
|
43
|
-
fullscreen: true,
|
|
44
|
-
classNames: 'justify-center',
|
|
45
|
-
}),
|
|
46
|
-
],
|
|
47
|
-
parameters: {
|
|
48
|
-
translations,
|
|
49
|
-
layout: 'centered',
|
|
50
|
-
controls: { disable: true },
|
|
51
|
-
},
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
type Story = StoryObj<typeof PromptBar>;
|
|
55
|
-
|
|
56
|
-
export default meta;
|
|
57
|
-
|
|
58
|
-
export const Default: Story = {
|
|
59
|
-
args: {},
|
|
60
|
-
};
|