@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,269 @@
|
|
|
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, { useMemo, type FunctionComponent } from 'react';
|
|
9
|
+
|
|
10
|
+
import { Capabilities, contributes, Events, IntentPlugin, type Plugin, SettingsPlugin } from '@dxos/app-framework';
|
|
11
|
+
import { withPluginManager } from '@dxos/app-framework/testing';
|
|
12
|
+
import {
|
|
13
|
+
DESIGN_SPEC_BLUEPRINT,
|
|
14
|
+
TASK_LIST_BLUEPRINT,
|
|
15
|
+
remoteServiceEndpoints,
|
|
16
|
+
readDocument,
|
|
17
|
+
writeDocument,
|
|
18
|
+
} from '@dxos/artifact-testing';
|
|
19
|
+
import { Blueprint, BlueprintRegistry, ContextBinder } from '@dxos/assistant';
|
|
20
|
+
import { Filter, Obj, Ref } from '@dxos/echo';
|
|
21
|
+
import { log } from '@dxos/log';
|
|
22
|
+
import { ChessPlugin } from '@dxos/plugin-chess';
|
|
23
|
+
import { ClientPlugin } from '@dxos/plugin-client';
|
|
24
|
+
import { InboxPlugin } from '@dxos/plugin-inbox';
|
|
25
|
+
import { MapPlugin } from '@dxos/plugin-map';
|
|
26
|
+
import { MarkdownPlugin } from '@dxos/plugin-markdown';
|
|
27
|
+
import { DocumentType } from '@dxos/plugin-markdown/types';
|
|
28
|
+
import { SpacePlugin } from '@dxos/plugin-space';
|
|
29
|
+
import { TablePlugin } from '@dxos/plugin-table';
|
|
30
|
+
import { TranscriptionPlugin } from '@dxos/plugin-transcription';
|
|
31
|
+
import { Config } from '@dxos/react-client';
|
|
32
|
+
import { createDocAccessor, useQuery, useSpace } from '@dxos/react-client/echo';
|
|
33
|
+
import { useThemeContext } from '@dxos/react-ui';
|
|
34
|
+
import {
|
|
35
|
+
Editor,
|
|
36
|
+
createBasicExtensions,
|
|
37
|
+
createDataExtensions,
|
|
38
|
+
createMarkdownExtensions,
|
|
39
|
+
createThemeExtensions,
|
|
40
|
+
outliner,
|
|
41
|
+
} from '@dxos/react-ui-editor';
|
|
42
|
+
import { mx } from '@dxos/react-ui-theme';
|
|
43
|
+
import { DataType } from '@dxos/schema';
|
|
44
|
+
import { render, withLayout, withTheme } from '@dxos/storybook-utils';
|
|
45
|
+
|
|
46
|
+
import { AssistantPlugin } from '../AssistantPlugin';
|
|
47
|
+
import { Chat } from '../components';
|
|
48
|
+
import { useChatProcessor, useServiceContainer } from '../hooks';
|
|
49
|
+
import { translations } from '../translations';
|
|
50
|
+
import { Assistant } from '../types';
|
|
51
|
+
|
|
52
|
+
//
|
|
53
|
+
// Story container
|
|
54
|
+
//
|
|
55
|
+
|
|
56
|
+
const DefaultStory = ({ components }: { components: FunctionComponent[] }) => {
|
|
57
|
+
return (
|
|
58
|
+
<div
|
|
59
|
+
className={mx('grid grid-cols border-x border-separator divide-x divide-separator')}
|
|
60
|
+
style={{ gridTemplateColumns: `repeat(${components.length}, minmax(0, 40rem))` }}
|
|
61
|
+
>
|
|
62
|
+
{components.map((Component, index) => (
|
|
63
|
+
<Component key={index} />
|
|
64
|
+
))}
|
|
65
|
+
</div>
|
|
66
|
+
);
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
//
|
|
70
|
+
// Components
|
|
71
|
+
//
|
|
72
|
+
|
|
73
|
+
const ChatContainer = () => {
|
|
74
|
+
const space = useSpace();
|
|
75
|
+
const [chat] = useQuery(space, Filter.type(Assistant.Chat));
|
|
76
|
+
|
|
77
|
+
// TODO(burdon): Figure out how to use effect to inject serviceContainer, blueprintRegistry into the processor.
|
|
78
|
+
const serviceContainer = useServiceContainer({ space });
|
|
79
|
+
const blueprintRegistry = useMemo(() => new BlueprintRegistry([DESIGN_SPEC_BLUEPRINT, TASK_LIST_BLUEPRINT]), []);
|
|
80
|
+
const processor = useChatProcessor({ chat, space, serviceContainer, blueprintRegistry, noPluginArtifacts: true });
|
|
81
|
+
|
|
82
|
+
if (!chat || !processor) {
|
|
83
|
+
return null;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
return (
|
|
87
|
+
<Chat.Root chat={chat} processor={processor} onEvent={(event) => log.info('event', { event })}>
|
|
88
|
+
<Chat.Thread />
|
|
89
|
+
<div className='p-2'>
|
|
90
|
+
<Chat.Prompt
|
|
91
|
+
expandable
|
|
92
|
+
classNames='p-2 border border-subduedSeparator rounded focus-within:outline focus-within:border-transparent outline-primary-500'
|
|
93
|
+
/>
|
|
94
|
+
</div>
|
|
95
|
+
</Chat.Root>
|
|
96
|
+
);
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
const DocumentContainer = () => {
|
|
100
|
+
const { themeMode } = useThemeContext();
|
|
101
|
+
const space = useSpace();
|
|
102
|
+
const [document] = useQuery(space, Filter.type(DocumentType));
|
|
103
|
+
if (!document?.content.target) {
|
|
104
|
+
return null;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
return (
|
|
108
|
+
<Editor
|
|
109
|
+
id={document.id}
|
|
110
|
+
text={document.content.target}
|
|
111
|
+
classNames='p-2'
|
|
112
|
+
extensions={[
|
|
113
|
+
// TODO(burdon): Create util.
|
|
114
|
+
createDataExtensions({ id: document.id, text: createDocAccessor(document.content.target, ['content']) }),
|
|
115
|
+
createBasicExtensions({ readOnly: false }),
|
|
116
|
+
createMarkdownExtensions({ themeMode }),
|
|
117
|
+
createThemeExtensions({ themeMode }),
|
|
118
|
+
outliner(),
|
|
119
|
+
]}
|
|
120
|
+
/>
|
|
121
|
+
);
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
//
|
|
125
|
+
// Configuration
|
|
126
|
+
//
|
|
127
|
+
|
|
128
|
+
const meta = {
|
|
129
|
+
title: 'plugins/plugin-assistant/Chat',
|
|
130
|
+
render: render(DefaultStory),
|
|
131
|
+
decorators: [],
|
|
132
|
+
parameters: {
|
|
133
|
+
translations,
|
|
134
|
+
controls: { disable: true },
|
|
135
|
+
},
|
|
136
|
+
} satisfies Meta<typeof DefaultStory>;
|
|
137
|
+
|
|
138
|
+
export default meta;
|
|
139
|
+
|
|
140
|
+
type Story = StoryObj<typeof meta>;
|
|
141
|
+
|
|
142
|
+
//
|
|
143
|
+
// Decorators
|
|
144
|
+
//
|
|
145
|
+
|
|
146
|
+
const remoteConfig = new Config({
|
|
147
|
+
runtime: {
|
|
148
|
+
services: {
|
|
149
|
+
ai: {
|
|
150
|
+
// TODO(burdon): 'url'?
|
|
151
|
+
server: remoteServiceEndpoints.ai,
|
|
152
|
+
},
|
|
153
|
+
edge: {
|
|
154
|
+
url: remoteServiceEndpoints.edge,
|
|
155
|
+
},
|
|
156
|
+
},
|
|
157
|
+
},
|
|
158
|
+
});
|
|
159
|
+
|
|
160
|
+
const getDecorators = ({
|
|
161
|
+
config,
|
|
162
|
+
plugins = [],
|
|
163
|
+
blueprints = [],
|
|
164
|
+
}: {
|
|
165
|
+
config: Config;
|
|
166
|
+
plugins?: Plugin[];
|
|
167
|
+
blueprints?: Blueprint[];
|
|
168
|
+
}) => [
|
|
169
|
+
withPluginManager({
|
|
170
|
+
fireEvents: [Events.SetupArtifactDefinition],
|
|
171
|
+
plugins: [
|
|
172
|
+
ClientPlugin({
|
|
173
|
+
config,
|
|
174
|
+
types: [Assistant.Chat, DocumentType, Blueprint],
|
|
175
|
+
onClientInitialized: async (_, client) => {
|
|
176
|
+
await client.halo.createIdentity();
|
|
177
|
+
await client.spaces.waitUntilReady();
|
|
178
|
+
const space = client.spaces.default;
|
|
179
|
+
// ISSUE(burdon): Should not require this.
|
|
180
|
+
// ERROR: invariant violation: Database was not initialized with root object.
|
|
181
|
+
await space.waitUntilReady();
|
|
182
|
+
|
|
183
|
+
// TODO(burdon): Remove need for this boilerplate. Namespace for types?
|
|
184
|
+
const chat = space.db.add(
|
|
185
|
+
Obj.make(Assistant.Chat, {
|
|
186
|
+
queue: Ref.fromDXN(space.queues.create().dxn),
|
|
187
|
+
}),
|
|
188
|
+
);
|
|
189
|
+
|
|
190
|
+
// TODO(burdon): Add to conversation context.
|
|
191
|
+
space.db.add(
|
|
192
|
+
Obj.make(DocumentType, {
|
|
193
|
+
name: 'Tasks',
|
|
194
|
+
content: Ref.make(Obj.make(DataType.Text, { content: '' })),
|
|
195
|
+
}),
|
|
196
|
+
);
|
|
197
|
+
|
|
198
|
+
// Clone blueprints and bind to conversation.
|
|
199
|
+
const binder = new ContextBinder(await chat.queue.load());
|
|
200
|
+
for (const blueprint of blueprints) {
|
|
201
|
+
const obj = space.db.add(Obj.make(Blueprint, { ...blueprint }));
|
|
202
|
+
await binder.bind({ blueprints: [Ref.make(obj)] });
|
|
203
|
+
}
|
|
204
|
+
},
|
|
205
|
+
}),
|
|
206
|
+
IntentPlugin(),
|
|
207
|
+
SettingsPlugin(),
|
|
208
|
+
SpacePlugin(),
|
|
209
|
+
|
|
210
|
+
TranscriptionPlugin(),
|
|
211
|
+
|
|
212
|
+
// TODO(burdon): Install capabilities independently?
|
|
213
|
+
// TODO(burdon): How to mock?
|
|
214
|
+
AssistantPlugin(),
|
|
215
|
+
|
|
216
|
+
...plugins,
|
|
217
|
+
],
|
|
218
|
+
capabilities: [contributes(Capabilities.Tools, [readDocument, writeDocument])],
|
|
219
|
+
}),
|
|
220
|
+
withTheme,
|
|
221
|
+
withLayout({
|
|
222
|
+
fullscreen: true,
|
|
223
|
+
classNames: 'bg-deckSurface justify-center',
|
|
224
|
+
}),
|
|
225
|
+
];
|
|
226
|
+
|
|
227
|
+
//
|
|
228
|
+
// Stories
|
|
229
|
+
//
|
|
230
|
+
|
|
231
|
+
export const Default = {
|
|
232
|
+
decorators: getDecorators({
|
|
233
|
+
config: remoteConfig,
|
|
234
|
+
}),
|
|
235
|
+
args: {
|
|
236
|
+
components: [ChatContainer],
|
|
237
|
+
},
|
|
238
|
+
} satisfies Story;
|
|
239
|
+
|
|
240
|
+
export const WithDocument = {
|
|
241
|
+
decorators: getDecorators({
|
|
242
|
+
config: remoteConfig,
|
|
243
|
+
plugins: [MarkdownPlugin()],
|
|
244
|
+
}),
|
|
245
|
+
args: {
|
|
246
|
+
components: [ChatContainer, DocumentContainer],
|
|
247
|
+
},
|
|
248
|
+
} satisfies Story;
|
|
249
|
+
|
|
250
|
+
export const WithBlueprints = {
|
|
251
|
+
decorators: getDecorators({
|
|
252
|
+
config: remoteConfig,
|
|
253
|
+
plugins: [ChessPlugin(), InboxPlugin(), MapPlugin(), MarkdownPlugin(), TablePlugin()],
|
|
254
|
+
blueprints: [TASK_LIST_BLUEPRINT],
|
|
255
|
+
}),
|
|
256
|
+
args: {
|
|
257
|
+
components: [ChatContainer, DocumentContainer],
|
|
258
|
+
},
|
|
259
|
+
} satisfies Story;
|
|
260
|
+
|
|
261
|
+
// export const WithArtifacts = {
|
|
262
|
+
// decorators: getDecorators({
|
|
263
|
+
// config: remoteConfig,
|
|
264
|
+
// plugins: [ChessPlugin(), InboxPlugin(), MapPlugin(), MarkdownPlugin(), TablePlugin()],
|
|
265
|
+
// }),
|
|
266
|
+
// args: {
|
|
267
|
+
// components: [ChatContainer],
|
|
268
|
+
// },
|
|
269
|
+
// } satisfies Story;
|
package/src/testing/index.ts
CHANGED
|
@@ -4,14 +4,9 @@
|
|
|
4
4
|
|
|
5
5
|
import { ToolRegistry } from '@dxos/ai';
|
|
6
6
|
import { EXA_API_KEY } from '@dxos/ai/testing';
|
|
7
|
-
import {
|
|
8
|
-
type BlueprintDefinition,
|
|
9
|
-
BlueprintParser,
|
|
10
|
-
createExaTool,
|
|
11
|
-
createGraphWriterTool,
|
|
12
|
-
createLocalSearchTool,
|
|
13
|
-
} from '@dxos/assistant';
|
|
7
|
+
import { createExaTool, createGraphWriterTool, createLocalSearchTool } from '@dxos/assistant';
|
|
14
8
|
import { type Space } from '@dxos/client/echo';
|
|
9
|
+
import { SequenceParser, type SequenceDefinition } from '@dxos/conductor';
|
|
15
10
|
import { type DXN } from '@dxos/keys';
|
|
16
11
|
import { DataTypes } from '@dxos/schema';
|
|
17
12
|
import { isNonNullable } from '@dxos/util';
|
|
@@ -37,7 +32,7 @@ export const createToolRegistry = (space: Space, queueDxn?: DXN): ToolRegistry =
|
|
|
37
32
|
);
|
|
38
33
|
};
|
|
39
34
|
|
|
40
|
-
export const
|
|
35
|
+
export const RESEARCH_SEQUENCE_DEFINITION: SequenceDefinition = {
|
|
41
36
|
steps: [
|
|
42
37
|
{
|
|
43
38
|
instructions: 'Research information and entities related to the selected objects.',
|
|
@@ -55,4 +50,4 @@ export const RESEARCH_BLUEPRINT_DEFINITION: BlueprintDefinition = {
|
|
|
55
50
|
],
|
|
56
51
|
};
|
|
57
52
|
|
|
58
|
-
export const
|
|
53
|
+
export const RESEARCH_SEQUENCE = SequenceParser.create().parse(RESEARCH_SEQUENCE_DEFINITION);
|
|
@@ -4,19 +4,16 @@
|
|
|
4
4
|
|
|
5
5
|
import { describe, expect, test } from 'vitest';
|
|
6
6
|
|
|
7
|
-
import { EdgeAiServiceClient } from '@dxos/ai';
|
|
8
|
-
import { AI_SERVICE_ENDPOINT } from '@dxos/ai/testing';
|
|
9
7
|
import { log } from '@dxos/log';
|
|
10
8
|
|
|
11
9
|
import { createToolsFromApi, resolveAuthorization } from './openapi';
|
|
12
10
|
import { ChatProcessor } from '../hooks';
|
|
13
|
-
import type
|
|
11
|
+
import { type ApiAuthorization } from '../types';
|
|
14
12
|
|
|
15
13
|
describe.skip('openapi', () => {
|
|
16
14
|
describe.skip('mapping', () => {
|
|
17
15
|
test('amadeus flight availabilities', async () => {
|
|
18
16
|
const tools = await createToolsFromApi(FLIGHT_SEARCH_API);
|
|
19
|
-
|
|
20
17
|
log.info('tools', { tools });
|
|
21
18
|
// for (const tool of tools) {
|
|
22
19
|
// const schema = tool.parameters;
|
|
@@ -57,7 +54,7 @@ describe.skip('openapi', () => {
|
|
|
57
54
|
|
|
58
55
|
test('weather API', async () => {
|
|
59
56
|
const tools = await createToolsFromApi(WEATHER_API, { authorization: VISUAL_CROSSING_CREDENTIALS });
|
|
60
|
-
const forecastTool = tools.find((
|
|
57
|
+
const forecastTool = tools.find((tool) => tool.name.includes('forecast'));
|
|
61
58
|
const result = await forecastTool?.execute(
|
|
62
59
|
{
|
|
63
60
|
locations: 'Brooklyn, NY',
|
|
@@ -73,8 +70,9 @@ describe.skip('openapi', () => {
|
|
|
73
70
|
describe.skip('AI uses tools', () => {
|
|
74
71
|
test('amadeus flight availabilities', { timeout: 60_000 }, async () => {
|
|
75
72
|
const tools = await createToolsFromApi(FLIGHT_SEARCH_API, { authorization: AMADEUS_AUTH });
|
|
76
|
-
const aiClient = new EdgeAiServiceClient({ endpoint: AI_SERVICE_ENDPOINT.LOCAL });
|
|
77
|
-
|
|
73
|
+
// const aiClient = new EdgeAiServiceClient({ endpoint: AI_SERVICE_ENDPOINT.LOCAL });
|
|
74
|
+
// TODO(dmaretskyi): FIX ME.
|
|
75
|
+
const processor = new ChatProcessor(null as any, { tools });
|
|
78
76
|
const reply = await processor.request(
|
|
79
77
|
`What is the cheapest flight from New York to Paris? going on ${new Date().toISOString()} and returning after a week. 1 adult traveler`,
|
|
80
78
|
);
|
|
@@ -85,8 +83,9 @@ describe.skip('openapi', () => {
|
|
|
85
83
|
// TODO(dmaretskyi): Doesn't work.
|
|
86
84
|
test('amadeus hotel name autocomplete', { timeout: 60_000 }, async () => {
|
|
87
85
|
const tools = await createToolsFromApi(HOTEL_NAME_AUTOCOMPLETE_API, { authorization: AMADEUS_AUTH });
|
|
88
|
-
const aiClient = new EdgeAiServiceClient({ endpoint: AI_SERVICE_ENDPOINT.LOCAL });
|
|
89
|
-
|
|
86
|
+
// const aiClient = new EdgeAiServiceClient({ endpoint: AI_SERVICE_ENDPOINT.LOCAL });
|
|
87
|
+
// TODO(dmaretskyi): FIX ME.
|
|
88
|
+
const processor = new ChatProcessor(null as any, { tools });
|
|
90
89
|
const reply = await processor.request('Find me the William Wale in Brooklyn New York');
|
|
91
90
|
|
|
92
91
|
log.info('reply', { reply });
|
|
@@ -97,8 +96,9 @@ describe.skip('openapi', () => {
|
|
|
97
96
|
authorization: VISUAL_CROSSING_CREDENTIALS,
|
|
98
97
|
instructions: WEATHER_INSTRUCTIONS,
|
|
99
98
|
});
|
|
100
|
-
const aiClient = new EdgeAiServiceClient({ endpoint: AI_SERVICE_ENDPOINT.LOCAL });
|
|
101
|
-
|
|
99
|
+
// const aiClient = new EdgeAiServiceClient({ endpoint: AI_SERVICE_ENDPOINT.LOCAL });
|
|
100
|
+
// TODO(dmaretskyi): FIX ME.
|
|
101
|
+
const processor = new ChatProcessor(null as any, { tools });
|
|
102
102
|
const reply = await processor.request(
|
|
103
103
|
`Today's date is ${new Date().toISOString().split('T')[0]}. Give me weather forecast for Warsaw for next 5 days.`,
|
|
104
104
|
);
|
package/src/translations.ts
CHANGED
|
@@ -2,37 +2,37 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { Sequence } from '@dxos/conductor';
|
|
6
|
+
import { type Resource } from '@dxos/react-ui';
|
|
7
7
|
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
8
|
+
import { meta } from './meta';
|
|
9
|
+
import { Assistant, TemplateType } from './types';
|
|
10
10
|
|
|
11
|
-
export
|
|
11
|
+
export const translations = [
|
|
12
12
|
{
|
|
13
13
|
'en-US': {
|
|
14
|
-
[
|
|
14
|
+
[Assistant.Chat.typename]: {
|
|
15
15
|
'typename label': 'Assistant',
|
|
16
16
|
'typename label_zero': 'Assistants',
|
|
17
17
|
'typename label_one': 'Assistant',
|
|
18
18
|
'typename label_other': 'Assistants',
|
|
19
19
|
'object name placeholder': 'New assistant',
|
|
20
20
|
},
|
|
21
|
-
[
|
|
22
|
-
'typename label': '
|
|
23
|
-
'typename label_zero': '
|
|
24
|
-
'typename label_one': '
|
|
25
|
-
'typename label_other': '
|
|
26
|
-
'object name placeholder': 'New
|
|
21
|
+
[Sequence.typename]: {
|
|
22
|
+
'typename label': 'Sequence',
|
|
23
|
+
'typename label_zero': 'Sequences',
|
|
24
|
+
'typename label_one': 'Sequence',
|
|
25
|
+
'typename label_other': 'Sequences',
|
|
26
|
+
'object name placeholder': 'New sequence',
|
|
27
27
|
},
|
|
28
|
-
[
|
|
28
|
+
[TemplateType.typename]: {
|
|
29
29
|
'typename label': 'Template',
|
|
30
30
|
'typename label_zero': 'Templates',
|
|
31
31
|
'typename label_one': 'Template',
|
|
32
32
|
'typename label_other': 'Templates',
|
|
33
33
|
'object name placeholder': 'New template',
|
|
34
34
|
},
|
|
35
|
-
[
|
|
35
|
+
[meta.id]: {
|
|
36
36
|
'templates label': 'Templates',
|
|
37
37
|
'open ambient chat label': 'Open Assistant',
|
|
38
38
|
'assistant chat label': 'Assistant',
|
|
@@ -50,21 +50,23 @@ export default [
|
|
|
50
50
|
'select preset template placeholder': 'Select preset',
|
|
51
51
|
'service registry label': 'Service Registry',
|
|
52
52
|
|
|
53
|
-
'
|
|
53
|
+
'sequence logs label': 'Logs',
|
|
54
54
|
|
|
55
55
|
'assistant dialog title': 'Assistant',
|
|
56
56
|
'open assistant label': 'Open assistant',
|
|
57
57
|
|
|
58
|
-
'
|
|
59
|
-
'chat input placeholder': 'Ask a question...',
|
|
60
|
-
'chat stop': 'Cancel request.',
|
|
58
|
+
'no tools': 'No tools are configured.',
|
|
61
59
|
|
|
62
60
|
'button save': 'Save',
|
|
63
61
|
'button run': 'Run',
|
|
64
62
|
|
|
65
|
-
'
|
|
66
|
-
'
|
|
67
|
-
'
|
|
63
|
+
'search placeholder': 'Search...',
|
|
64
|
+
'prompt placeholder': 'Ask or search for anything...',
|
|
65
|
+
'context objects placeholder': 'Add to context...',
|
|
66
|
+
'button add blueprint': 'Configure blueprints',
|
|
67
|
+
'button microphone': 'Click to speak',
|
|
68
|
+
'button cancel processing': 'Stop processing',
|
|
69
|
+
'button scroll down': 'Scroll down',
|
|
68
70
|
|
|
69
71
|
'settings default label': 'Default',
|
|
70
72
|
'settings custom prompts label': 'Use custom prompts',
|
|
@@ -74,4 +76,4 @@ export default [
|
|
|
74
76
|
},
|
|
75
77
|
},
|
|
76
78
|
},
|
|
77
|
-
];
|
|
79
|
+
] as const satisfies Resource[];
|
package/src/types/index.ts
CHANGED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2024 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { Schema } from 'effect';
|
|
6
|
+
|
|
7
|
+
import { SpaceSchema, Queue } from '@dxos/client/echo';
|
|
8
|
+
import { Sequence } from '@dxos/conductor';
|
|
9
|
+
import { Type } from '@dxos/echo';
|
|
10
|
+
import { LabelAnnotation } from '@dxos/echo-schema';
|
|
11
|
+
|
|
12
|
+
import { meta } from '../meta';
|
|
13
|
+
|
|
14
|
+
export const LLM_PROVIDERS = ['edge', 'ollama', 'lmstudio'] as const;
|
|
15
|
+
|
|
16
|
+
export namespace Assistant {
|
|
17
|
+
//
|
|
18
|
+
// Types
|
|
19
|
+
//
|
|
20
|
+
|
|
21
|
+
export const Chat = Schema.Struct({
|
|
22
|
+
id: Type.ObjectId,
|
|
23
|
+
name: Schema.optional(Schema.String),
|
|
24
|
+
queue: Type.Ref(Queue),
|
|
25
|
+
}).pipe(
|
|
26
|
+
Type.Obj({
|
|
27
|
+
typename: 'dxos.org/type/assistant/Chat',
|
|
28
|
+
version: '0.2.0',
|
|
29
|
+
}),
|
|
30
|
+
LabelAnnotation.set(['name']),
|
|
31
|
+
);
|
|
32
|
+
|
|
33
|
+
export interface Chat extends Schema.Schema.Type<typeof Chat> {}
|
|
34
|
+
|
|
35
|
+
export const CompanionTo = Schema.Struct({
|
|
36
|
+
id: Type.ObjectId,
|
|
37
|
+
}).pipe(
|
|
38
|
+
Type.Relation({
|
|
39
|
+
typename: 'dxos.org/relation/assistant/CompanionTo',
|
|
40
|
+
version: '0.1.0',
|
|
41
|
+
source: Chat,
|
|
42
|
+
target: Type.Expando,
|
|
43
|
+
}),
|
|
44
|
+
);
|
|
45
|
+
|
|
46
|
+
export interface CompanionTo extends Schema.Schema.Type<typeof CompanionTo> {}
|
|
47
|
+
|
|
48
|
+
//
|
|
49
|
+
// Settings
|
|
50
|
+
//
|
|
51
|
+
|
|
52
|
+
export const Settings = Schema.mutable(
|
|
53
|
+
Schema.Struct({
|
|
54
|
+
llmProvider: Schema.optional(Schema.Literal(...LLM_PROVIDERS)),
|
|
55
|
+
edgeModel: Schema.optional(Schema.String),
|
|
56
|
+
ollamaModel: Schema.optional(Schema.String),
|
|
57
|
+
lmstudioModel: Schema.optional(Schema.String),
|
|
58
|
+
customPrompts: Schema.optional(Schema.Boolean),
|
|
59
|
+
}),
|
|
60
|
+
);
|
|
61
|
+
|
|
62
|
+
export type Settings = Schema.Schema.Type<typeof Settings>;
|
|
63
|
+
|
|
64
|
+
//
|
|
65
|
+
// Actions
|
|
66
|
+
//
|
|
67
|
+
|
|
68
|
+
export class CreateChat extends Schema.TaggedClass<CreateChat>()(`${meta.id}/action}/create-chat`, {
|
|
69
|
+
input: Schema.Struct({
|
|
70
|
+
space: SpaceSchema,
|
|
71
|
+
name: Schema.optional(Schema.String),
|
|
72
|
+
}),
|
|
73
|
+
output: Schema.Struct({
|
|
74
|
+
object: Assistant.Chat,
|
|
75
|
+
}),
|
|
76
|
+
}) {}
|
|
77
|
+
|
|
78
|
+
export class CreateSequence extends Schema.TaggedClass<CreateSequence>()(`${meta.id}/action}/create-sequence`, {
|
|
79
|
+
input: Schema.Struct({
|
|
80
|
+
name: Schema.optional(Schema.String),
|
|
81
|
+
}),
|
|
82
|
+
output: Schema.Struct({
|
|
83
|
+
object: Sequence,
|
|
84
|
+
}),
|
|
85
|
+
}) {}
|
|
86
|
+
}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
AmbientDialog
|
|
3
|
-
} from "./chunk-Q6UZ4F3H.mjs";
|
|
4
|
-
import {
|
|
5
|
-
ThreadContainer
|
|
6
|
-
} from "./chunk-JO4W3MF7.mjs";
|
|
7
|
-
import "./chunk-AAOKC2JN.mjs";
|
|
8
|
-
import "./chunk-MEGMOFJB.mjs";
|
|
9
|
-
import "./chunk-UE3IZ4PN.mjs";
|
|
10
|
-
import {
|
|
11
|
-
ASSISTANT_PLUGIN
|
|
12
|
-
} from "./chunk-XOZ7YMO3.mjs";
|
|
13
|
-
|
|
14
|
-
// packages/plugins/plugin-assistant/src/components/AssistantDialog.tsx
|
|
15
|
-
import { useSignals as _useSignals } from "@preact-signals/safe-react/tracking";
|
|
16
|
-
import React, { useState } from "react";
|
|
17
|
-
import { useCapability, Capabilities, useCapabilities } from "@dxos/app-framework";
|
|
18
|
-
import { TranscriptionCapabilities } from "@dxos/plugin-transcription";
|
|
19
|
-
import { useTranslation } from "@dxos/react-ui";
|
|
20
|
-
var AssistantDialog = ({ chat }) => {
|
|
21
|
-
var _effect = _useSignals();
|
|
22
|
-
try {
|
|
23
|
-
const { t } = useTranslation(ASSISTANT_PLUGIN);
|
|
24
|
-
const transcription = useCapabilities(TranscriptionCapabilities.Transcriber).length > 0;
|
|
25
|
-
const settings = useCapability(Capabilities.SettingsStore).getStore(ASSISTANT_PLUGIN)?.value;
|
|
26
|
-
const [open, setOpen] = useState(false);
|
|
27
|
-
return /* @__PURE__ */ React.createElement(AmbientDialog, {
|
|
28
|
-
open,
|
|
29
|
-
onOpenChange: setOpen,
|
|
30
|
-
title: t("assistant dialog title")
|
|
31
|
-
}, /* @__PURE__ */ React.createElement(ThreadContainer, {
|
|
32
|
-
part: "dialog",
|
|
33
|
-
chat,
|
|
34
|
-
onOpenChange: setOpen,
|
|
35
|
-
settings,
|
|
36
|
-
transcription
|
|
37
|
-
}));
|
|
38
|
-
} finally {
|
|
39
|
-
_effect.f();
|
|
40
|
-
}
|
|
41
|
-
};
|
|
42
|
-
var AssistantDialog_default = AssistantDialog;
|
|
43
|
-
export {
|
|
44
|
-
AssistantDialog,
|
|
45
|
-
AssistantDialog_default as default
|
|
46
|
-
};
|
|
47
|
-
//# sourceMappingURL=AssistantDialog-MQOOR364.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/components/AssistantDialog.tsx"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport React, { type FC, useState } from 'react';\n\nimport { useCapability, Capabilities, useCapabilities } from '@dxos/app-framework';\nimport { TranscriptionCapabilities } from '@dxos/plugin-transcription';\nimport { useTranslation } from '@dxos/react-ui';\n\nimport { AmbientDialog } from './AmbientDialog';\nimport { ThreadContainer } from './Thread';\nimport { ASSISTANT_PLUGIN } from '../meta';\nimport { type AssistantSettingsProps, type AIChatType } from '../types';\n\nexport const AssistantDialog: FC<{ chat?: AIChatType }> = ({ chat }) => {\n const { t } = useTranslation(ASSISTANT_PLUGIN);\n const transcription = useCapabilities(TranscriptionCapabilities.Transcriber).length > 0;\n const settings = useCapability(Capabilities.SettingsStore).getStore<AssistantSettingsProps>(ASSISTANT_PLUGIN)?.value;\n\n // TODO(burdon): Refocus when open.\n const [open, setOpen] = useState(false);\n\n return (\n <AmbientDialog open={open} onOpenChange={setOpen} title={t('assistant dialog title')}>\n <ThreadContainer\n part={'dialog'}\n chat={chat}\n onOpenChange={setOpen}\n settings={settings}\n transcription={transcription}\n />\n </AmbientDialog>\n );\n};\n\nexport default AssistantDialog;\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;AAIA,OAAOA,SAAkBC,gBAAgB;AAEzC,SAASC,eAAeC,cAAcC,uBAAuB;AAC7D,SAASC,iCAAiC;AAC1C,SAASC,sBAAsB;AAOxB,IAAMC,kBAA6C,CAAC,EAAEC,KAAI,MAAE;;;AACjE,UAAM,EAAEC,EAAC,IAAKC,eAAeC,gBAAAA;AAC7B,UAAMC,gBAAgBC,gBAAgBC,0BAA0BC,WAAW,EAAEC,SAAS;AACtF,UAAMC,WAAWC,cAAcC,aAAaC,aAAa,EAAEC,SAAiCV,gBAAAA,GAAmBW;AAG/G,UAAM,CAACC,MAAMC,OAAAA,IAAWC,SAAS,KAAA;AAEjC,WACE,sBAAA,cAACC,eAAAA;MAAcH;MAAYI,cAAcH;MAASI,OAAOnB,EAAE,wBAAA;OACzD,sBAAA,cAACoB,iBAAAA;MACCC,MAAM;MACNtB;MACAmB,cAAcH;MACdP;MACAL;;;;;AAIR;AAEA,IAAA,0BAAeL;",
|
|
6
|
-
"names": ["React", "useState", "useCapability", "Capabilities", "useCapabilities", "TranscriptionCapabilities", "useTranslation", "AssistantDialog", "chat", "t", "useTranslation", "ASSISTANT_PLUGIN", "transcription", "useCapabilities", "TranscriptionCapabilities", "Transcriber", "length", "settings", "useCapability", "Capabilities", "SettingsStore", "getStore", "value", "open", "setOpen", "useState", "AmbientDialog", "onOpenChange", "title", "ThreadContainer", "part"]
|
|
7
|
-
}
|