@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,84 +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, { useState } from 'react';
|
|
9
|
-
|
|
10
|
-
import { IntentPlugin } from '@dxos/app-framework';
|
|
11
|
-
import { withPluginManager } from '@dxos/app-framework/testing';
|
|
12
|
-
import { Config } from '@dxos/client';
|
|
13
|
-
import { faker } from '@dxos/random';
|
|
14
|
-
import { withClientProvider } from '@dxos/react-client/testing';
|
|
15
|
-
import { Dialog, Toolbar, Button } from '@dxos/react-ui';
|
|
16
|
-
import { withTheme, withLayout } from '@dxos/storybook-utils';
|
|
17
|
-
|
|
18
|
-
import { AmbientDialog } from './AmbientDialog';
|
|
19
|
-
import translations from '../../translations';
|
|
20
|
-
|
|
21
|
-
const meta: Meta<typeof AmbientDialog> = {
|
|
22
|
-
title: 'plugins/plugin-assistant/AmbientDialog',
|
|
23
|
-
component: AmbientDialog,
|
|
24
|
-
render: () => {
|
|
25
|
-
const [open, setOpen] = useState(true);
|
|
26
|
-
const [items, setItems] = useState<string[]>([]);
|
|
27
|
-
return (
|
|
28
|
-
<>
|
|
29
|
-
<div>
|
|
30
|
-
<Toolbar.Root>
|
|
31
|
-
<Toolbar.Button onClick={() => setOpen(true)}>Open</Toolbar.Button>
|
|
32
|
-
</Toolbar.Root>
|
|
33
|
-
</div>
|
|
34
|
-
<Dialog.Root open={open} onOpenChange={setOpen}>
|
|
35
|
-
<AmbientDialog>
|
|
36
|
-
<div className='flex flex-col h-full overflow-hidden'>
|
|
37
|
-
<div className='flex flex-col h-full gap-2 overflow-auto'>
|
|
38
|
-
{items.map((item) => (
|
|
39
|
-
<div key={item} className='px-2'>
|
|
40
|
-
{item}
|
|
41
|
-
</div>
|
|
42
|
-
))}
|
|
43
|
-
{items.length > 0 && <div className='pbe-2' />}
|
|
44
|
-
</div>
|
|
45
|
-
<div className='shrink-0 h-[40px]'>
|
|
46
|
-
<Button onClick={() => setItems([...items, faker.lorem.word()])}>Add</Button>
|
|
47
|
-
</div>
|
|
48
|
-
</div>
|
|
49
|
-
</AmbientDialog>
|
|
50
|
-
</Dialog.Root>
|
|
51
|
-
</>
|
|
52
|
-
);
|
|
53
|
-
},
|
|
54
|
-
decorators: [
|
|
55
|
-
// TODO(burdon): Replace with ClientPlugin.
|
|
56
|
-
withClientProvider({
|
|
57
|
-
config: new Config({
|
|
58
|
-
runtime: {
|
|
59
|
-
client: { edgeFeatures: { signaling: true } },
|
|
60
|
-
services: {
|
|
61
|
-
edge: { url: 'https://edge.dxos.workers.dev/' },
|
|
62
|
-
iceProviders: [{ urls: 'https://edge.dxos.workers.dev/ice' }],
|
|
63
|
-
},
|
|
64
|
-
},
|
|
65
|
-
}),
|
|
66
|
-
createIdentity: true,
|
|
67
|
-
createSpace: true,
|
|
68
|
-
}),
|
|
69
|
-
withPluginManager({
|
|
70
|
-
plugins: [IntentPlugin()],
|
|
71
|
-
}),
|
|
72
|
-
withTheme,
|
|
73
|
-
withLayout({ fullscreen: true }),
|
|
74
|
-
],
|
|
75
|
-
parameters: {
|
|
76
|
-
translations,
|
|
77
|
-
},
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
export default meta;
|
|
81
|
-
|
|
82
|
-
type Story = StoryObj<typeof AmbientDialog>;
|
|
83
|
-
|
|
84
|
-
export const Default: Story = {};
|
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import React, { type PropsWithChildren, useCallback, useEffect, useState } from 'react';
|
|
6
|
-
|
|
7
|
-
import { Dialog, Icon, IconButton } from '@dxos/react-ui';
|
|
8
|
-
import { resizeAttributes, ResizeHandle, type Size, sizeStyle } from '@dxos/react-ui-dnd';
|
|
9
|
-
import { mx } from '@dxos/react-ui-theme';
|
|
10
|
-
|
|
11
|
-
const preventDefault = (event: Event) => event.preventDefault();
|
|
12
|
-
|
|
13
|
-
const minSize = 5;
|
|
14
|
-
|
|
15
|
-
export type AmbientDialogProps = PropsWithChildren<{
|
|
16
|
-
open?: boolean;
|
|
17
|
-
title?: string;
|
|
18
|
-
resizeable?: boolean;
|
|
19
|
-
onOpenChange?: (open: boolean) => void;
|
|
20
|
-
onEscape?: () => void;
|
|
21
|
-
}>;
|
|
22
|
-
|
|
23
|
-
export const AmbientDialog = ({
|
|
24
|
-
children,
|
|
25
|
-
open: controlledOpen,
|
|
26
|
-
title,
|
|
27
|
-
resizeable = true,
|
|
28
|
-
onOpenChange,
|
|
29
|
-
onEscape,
|
|
30
|
-
}: AmbientDialogProps) => {
|
|
31
|
-
const [resizeKey, setReizeKey] = useState(0);
|
|
32
|
-
const [size, setSize] = useState<Size>('min-content');
|
|
33
|
-
const [open, setOpen] = useState(controlledOpen);
|
|
34
|
-
|
|
35
|
-
// Update controlled value.
|
|
36
|
-
useEffect(() => {
|
|
37
|
-
setOpen(controlledOpen);
|
|
38
|
-
}, [controlledOpen]);
|
|
39
|
-
|
|
40
|
-
// Update size and key.
|
|
41
|
-
useEffect(() => {
|
|
42
|
-
setSize(open ? 'min-content' : minSize);
|
|
43
|
-
setReizeKey((key) => key + 1);
|
|
44
|
-
}, [open]);
|
|
45
|
-
|
|
46
|
-
// TODO(burdon): Animate open/close.
|
|
47
|
-
// NOTE: We set the min size to 5rem (80px), and the header and prompt bar to 40px (i.e., the rail-size) each.
|
|
48
|
-
// The dialog has no vertical padding and has box-content so that when closed it collapses to the size of the header and prompt bar.
|
|
49
|
-
const handleToggle = useCallback(() => {
|
|
50
|
-
setOpen((open) => {
|
|
51
|
-
onOpenChange?.(!open);
|
|
52
|
-
return !open;
|
|
53
|
-
});
|
|
54
|
-
}, []);
|
|
55
|
-
|
|
56
|
-
return (
|
|
57
|
-
<div role='none' className='dx-dialog__overlay bg-transparent pointer-events-none' data-block-align='end'>
|
|
58
|
-
<Dialog.Content
|
|
59
|
-
classNames='relative box-content p-0 md:is-[35rem] md:max-is-none overflow-hidden pointer-events-auto transition-[block-size] ease-in-out duration-0 [&:not([data-dx-resizing="true"])]:duration-200'
|
|
60
|
-
inOverlayLayout
|
|
61
|
-
{...resizeAttributes}
|
|
62
|
-
style={{
|
|
63
|
-
...(resizeable ? sizeStyle(size, 'vertical', true) : {}),
|
|
64
|
-
maxBlockSize: 'calc(100dvh - env(safe-area-inset-bottom) - env(safe-area-inset-top) - 9rem)',
|
|
65
|
-
}}
|
|
66
|
-
onEscapeKeyDown={onEscape}
|
|
67
|
-
onInteractOutside={preventDefault}
|
|
68
|
-
>
|
|
69
|
-
{(resizeable && (
|
|
70
|
-
<>
|
|
71
|
-
<ResizeHandle
|
|
72
|
-
key={resizeKey}
|
|
73
|
-
side='block-start'
|
|
74
|
-
defaultSize='min-content'
|
|
75
|
-
minSize={minSize}
|
|
76
|
-
fallbackSize={minSize}
|
|
77
|
-
iconPosition='center'
|
|
78
|
-
onSizeChange={setSize}
|
|
79
|
-
/>
|
|
80
|
-
|
|
81
|
-
<DialogHeader open={open} title={title} onToggle={handleToggle} />
|
|
82
|
-
</>
|
|
83
|
-
)) || <Dialog.Title srOnly />}
|
|
84
|
-
|
|
85
|
-
{children}
|
|
86
|
-
</Dialog.Content>
|
|
87
|
-
</div>
|
|
88
|
-
);
|
|
89
|
-
};
|
|
90
|
-
|
|
91
|
-
/**
|
|
92
|
-
* Matches same layout grid as PromptBar.
|
|
93
|
-
*/
|
|
94
|
-
const DialogHeader = ({ open, title, onToggle }: { open?: boolean; title?: string; onToggle: () => void }) => {
|
|
95
|
-
return (
|
|
96
|
-
<div className='flex shrink-0 w-full grid grid-cols-[var(--rail-action)_1fr_var(--rail-action)] items-center overflow-hidden'>
|
|
97
|
-
<div className='flex w-[--rail-action] h-[--rail-action] items-center justify-center'>
|
|
98
|
-
<Dialog.Close>
|
|
99
|
-
<Icon icon='ph--x--regular' />
|
|
100
|
-
</Dialog.Close>
|
|
101
|
-
</div>
|
|
102
|
-
<div className='grow'>
|
|
103
|
-
<Dialog.Title classNames='flex justify-center text-xs text-subdued'>{title}</Dialog.Title>
|
|
104
|
-
</div>
|
|
105
|
-
<div className='flex w-[--rail-action] h-[--rail-action] items-center justify-center'>
|
|
106
|
-
<IconButton
|
|
107
|
-
variant='ghost'
|
|
108
|
-
icon={'ph--caret-up--regular'}
|
|
109
|
-
classNames={mx('[&>svg]:transition [&>svg]:duration-200', open && '[&>svg]:rotate-180')}
|
|
110
|
-
iconOnly
|
|
111
|
-
label='Shrink'
|
|
112
|
-
onClick={onToggle}
|
|
113
|
-
/>
|
|
114
|
-
</div>
|
|
115
|
-
</div>
|
|
116
|
-
);
|
|
117
|
-
};
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import React, { type FC, useState } from 'react';
|
|
6
|
-
|
|
7
|
-
import { useCapability, Capabilities, useCapabilities } from '@dxos/app-framework';
|
|
8
|
-
import { TranscriptionCapabilities } from '@dxos/plugin-transcription';
|
|
9
|
-
import { useTranslation } from '@dxos/react-ui';
|
|
10
|
-
|
|
11
|
-
import { AmbientDialog } from './AmbientDialog';
|
|
12
|
-
import { ThreadContainer } from './Thread';
|
|
13
|
-
import { ASSISTANT_PLUGIN } from '../meta';
|
|
14
|
-
import { type AssistantSettingsProps, type AIChatType } from '../types';
|
|
15
|
-
|
|
16
|
-
export const AssistantDialog: FC<{ chat?: AIChatType }> = ({ chat }) => {
|
|
17
|
-
const { t } = useTranslation(ASSISTANT_PLUGIN);
|
|
18
|
-
const transcription = useCapabilities(TranscriptionCapabilities.Transcriber).length > 0;
|
|
19
|
-
const settings = useCapability(Capabilities.SettingsStore).getStore<AssistantSettingsProps>(ASSISTANT_PLUGIN)?.value;
|
|
20
|
-
|
|
21
|
-
// TODO(burdon): Refocus when open.
|
|
22
|
-
const [open, setOpen] = useState(false);
|
|
23
|
-
|
|
24
|
-
return (
|
|
25
|
-
<AmbientDialog open={open} onOpenChange={setOpen} title={t('assistant dialog title')}>
|
|
26
|
-
<ThreadContainer
|
|
27
|
-
part={'dialog'}
|
|
28
|
-
chat={chat}
|
|
29
|
-
onOpenChange={setOpen}
|
|
30
|
-
settings={settings}
|
|
31
|
-
transcription={transcription}
|
|
32
|
-
/>
|
|
33
|
-
</AmbientDialog>
|
|
34
|
-
);
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
export default AssistantDialog;
|
|
@@ -1,32 +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
|
-
|
|
9
|
-
import { withLayout, withTheme } from '@dxos/storybook-utils';
|
|
10
|
-
|
|
11
|
-
import { BlueprintEditor } from './BlueprintEditor';
|
|
12
|
-
import { RESEARCH_BLUEPRINT_DEFINITION } from '../../testing';
|
|
13
|
-
import translations from '../../translations';
|
|
14
|
-
|
|
15
|
-
const meta: Meta<typeof BlueprintEditor> = {
|
|
16
|
-
title: 'plugins/plugin-assistant/BlueprintEditor',
|
|
17
|
-
component: BlueprintEditor,
|
|
18
|
-
decorators: [withTheme, withLayout({ fullscreen: true, classNames: 'mli-auto max-is-[50rem] justify-center' })],
|
|
19
|
-
parameters: {
|
|
20
|
-
translations,
|
|
21
|
-
},
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
export default meta;
|
|
25
|
-
|
|
26
|
-
type Story = StoryObj<typeof BlueprintEditor>;
|
|
27
|
-
|
|
28
|
-
export const Default: Story = {
|
|
29
|
-
args: {
|
|
30
|
-
blueprint: RESEARCH_BLUEPRINT_DEFINITION,
|
|
31
|
-
},
|
|
32
|
-
};
|
|
@@ -1,121 +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, { useEffect, useState } from 'react';
|
|
9
|
-
|
|
10
|
-
import { IntentPlugin, SettingsPlugin } from '@dxos/app-framework';
|
|
11
|
-
import { withPluginManager } from '@dxos/app-framework/testing';
|
|
12
|
-
import { log } from '@dxos/log';
|
|
13
|
-
import { TranscriptionPlugin } from '@dxos/plugin-transcription';
|
|
14
|
-
import { withTheme, withLayout } from '@dxos/storybook-utils';
|
|
15
|
-
|
|
16
|
-
import { Prompt } from './Prompt';
|
|
17
|
-
import { PromptBar, type PromptBarProps } from './PromptBar';
|
|
18
|
-
import type { ReferenceData } from './references';
|
|
19
|
-
import translations from '../../translations';
|
|
20
|
-
|
|
21
|
-
const references: ReferenceData[] = [
|
|
22
|
-
{
|
|
23
|
-
uri: 'dxn:echo:@:AAAAAAAA',
|
|
24
|
-
label: 'Meeting Notes',
|
|
25
|
-
},
|
|
26
|
-
{
|
|
27
|
-
uri: 'dxn:echo:@:BBBBBBBB',
|
|
28
|
-
label: 'Project Plan',
|
|
29
|
-
},
|
|
30
|
-
{
|
|
31
|
-
uri: 'dxn:echo:@:CCCCCCCC',
|
|
32
|
-
label: 'Meeting Plan',
|
|
33
|
-
},
|
|
34
|
-
];
|
|
35
|
-
|
|
36
|
-
const DefaultStory = (props: PromptBarProps) => {
|
|
37
|
-
const [processing, setProcessing] = useState(false);
|
|
38
|
-
useEffect(() => {
|
|
39
|
-
let t: NodeJS.Timeout;
|
|
40
|
-
if (processing) {
|
|
41
|
-
t = setTimeout(() => setProcessing(false), 10_000);
|
|
42
|
-
}
|
|
43
|
-
return () => clearTimeout(t);
|
|
44
|
-
}, [processing]);
|
|
45
|
-
|
|
46
|
-
return (
|
|
47
|
-
<PromptBar
|
|
48
|
-
classNames='w-[25rem] p-1 overflow-hidden border border-gray-200 rounded'
|
|
49
|
-
microphone
|
|
50
|
-
processing={processing}
|
|
51
|
-
onSubmit={() => setProcessing(true)}
|
|
52
|
-
onCancel={() => setProcessing(false)}
|
|
53
|
-
{...props}
|
|
54
|
-
/>
|
|
55
|
-
);
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
const meta: Meta<typeof Prompt> = {
|
|
59
|
-
title: 'plugins/plugin-assistant/Prompt',
|
|
60
|
-
component: Prompt,
|
|
61
|
-
render: DefaultStory,
|
|
62
|
-
decorators: [
|
|
63
|
-
withPluginManager({
|
|
64
|
-
plugins: [IntentPlugin(), SettingsPlugin(), TranscriptionPlugin()],
|
|
65
|
-
}),
|
|
66
|
-
withTheme,
|
|
67
|
-
withLayout(),
|
|
68
|
-
],
|
|
69
|
-
parameters: {
|
|
70
|
-
layout: 'centered',
|
|
71
|
-
translations,
|
|
72
|
-
controls: { disable: true },
|
|
73
|
-
},
|
|
74
|
-
};
|
|
75
|
-
|
|
76
|
-
export default meta;
|
|
77
|
-
|
|
78
|
-
type Story = StoryObj<typeof DefaultStory>;
|
|
79
|
-
|
|
80
|
-
export const Default: Story = {};
|
|
81
|
-
|
|
82
|
-
export const WithSuggestions: Story = {
|
|
83
|
-
args: {
|
|
84
|
-
onSubmit: (text) => {
|
|
85
|
-
log('onSubmit', { text });
|
|
86
|
-
},
|
|
87
|
-
onSuggest: (text) => {
|
|
88
|
-
const trimmed = text.trim().toLowerCase();
|
|
89
|
-
if (trimmed.length < 2) {
|
|
90
|
-
return [];
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
const suggestions = [
|
|
94
|
-
'Create a kanban board',
|
|
95
|
-
'Create a new project',
|
|
96
|
-
'Find flights to Tokyo',
|
|
97
|
-
"Let's play chess",
|
|
98
|
-
'Show me Paris on a map',
|
|
99
|
-
];
|
|
100
|
-
|
|
101
|
-
return suggestions.filter((s) => s.toLowerCase().startsWith(text));
|
|
102
|
-
},
|
|
103
|
-
},
|
|
104
|
-
};
|
|
105
|
-
|
|
106
|
-
export const WithReferences: Story = {
|
|
107
|
-
args: {
|
|
108
|
-
references: {
|
|
109
|
-
getReferences: async ({ query }) => {
|
|
110
|
-
const res = references.filter((i) => i.label.toLowerCase().startsWith(query.toLowerCase()));
|
|
111
|
-
log('getReferences', { query, res });
|
|
112
|
-
return res;
|
|
113
|
-
},
|
|
114
|
-
resolveReference: async ({ uri }) => {
|
|
115
|
-
const res = references.find((i) => i.uri === uri);
|
|
116
|
-
log('resolveReference', { uri, res });
|
|
117
|
-
return res ?? null;
|
|
118
|
-
},
|
|
119
|
-
},
|
|
120
|
-
},
|
|
121
|
-
};
|
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { type Extension, Prec } from '@codemirror/state';
|
|
6
|
-
import React, { forwardRef, useImperativeHandle } from 'react';
|
|
7
|
-
|
|
8
|
-
import { type ThemedClassName, useThemeContext } from '@dxos/react-ui';
|
|
9
|
-
import {
|
|
10
|
-
createBasicExtensions,
|
|
11
|
-
createThemeExtensions,
|
|
12
|
-
keymap,
|
|
13
|
-
useTextEditor,
|
|
14
|
-
type BasicExtensionsOptions,
|
|
15
|
-
type UseTextEditorProps,
|
|
16
|
-
} from '@dxos/react-ui-editor';
|
|
17
|
-
import { mx } from '@dxos/react-ui-theme';
|
|
18
|
-
import { isNonNullable } from '@dxos/util';
|
|
19
|
-
|
|
20
|
-
import { autocompleteExtension, type AutocompleteOptions } from './autocomplete';
|
|
21
|
-
import { promptReferences, type ReferencesProvider } from './references';
|
|
22
|
-
|
|
23
|
-
// TODO(burdon): Handle object references.
|
|
24
|
-
|
|
25
|
-
export interface PromptController {
|
|
26
|
-
focus(): void;
|
|
27
|
-
setText(text: string): void;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export type PromptProps = ThemedClassName<
|
|
31
|
-
{
|
|
32
|
-
extensions?: Extension;
|
|
33
|
-
references?: ReferencesProvider;
|
|
34
|
-
onOpenChange?: (open: boolean) => void;
|
|
35
|
-
} & AutocompleteOptions &
|
|
36
|
-
Pick<UseTextEditorProps, 'autoFocus'> &
|
|
37
|
-
Pick<BasicExtensionsOptions, 'lineWrapping' | 'placeholder'>
|
|
38
|
-
>;
|
|
39
|
-
|
|
40
|
-
export const Prompt = forwardRef<PromptController, PromptProps>(
|
|
41
|
-
(
|
|
42
|
-
{
|
|
43
|
-
classNames,
|
|
44
|
-
extensions,
|
|
45
|
-
references,
|
|
46
|
-
autoFocus,
|
|
47
|
-
lineWrapping = false,
|
|
48
|
-
placeholder,
|
|
49
|
-
onSubmit,
|
|
50
|
-
onSuggest,
|
|
51
|
-
onCancel,
|
|
52
|
-
onOpenChange,
|
|
53
|
-
},
|
|
54
|
-
forwardRef,
|
|
55
|
-
) => {
|
|
56
|
-
const { themeMode } = useThemeContext();
|
|
57
|
-
const { parentRef, view } = useTextEditor(
|
|
58
|
-
{
|
|
59
|
-
debug: true,
|
|
60
|
-
autoFocus,
|
|
61
|
-
extensions: [
|
|
62
|
-
autocompleteExtension({ onSubmit, onSuggest, onCancel }),
|
|
63
|
-
createBasicExtensions({
|
|
64
|
-
bracketMatching: false,
|
|
65
|
-
lineWrapping,
|
|
66
|
-
placeholder,
|
|
67
|
-
}),
|
|
68
|
-
createThemeExtensions({ themeMode }),
|
|
69
|
-
references ? promptReferences({ provider: references }) : [],
|
|
70
|
-
Prec.highest(
|
|
71
|
-
keymap.of([
|
|
72
|
-
{
|
|
73
|
-
key: 'cmd-ArrowUp',
|
|
74
|
-
preventDefault: true,
|
|
75
|
-
run: () => {
|
|
76
|
-
onOpenChange?.(true);
|
|
77
|
-
return true;
|
|
78
|
-
},
|
|
79
|
-
},
|
|
80
|
-
{
|
|
81
|
-
key: 'cmd-ArrowDown',
|
|
82
|
-
preventDefault: true,
|
|
83
|
-
run: () => {
|
|
84
|
-
onOpenChange?.(false);
|
|
85
|
-
return true;
|
|
86
|
-
},
|
|
87
|
-
},
|
|
88
|
-
]),
|
|
89
|
-
),
|
|
90
|
-
extensions,
|
|
91
|
-
].filter(isNonNullable),
|
|
92
|
-
},
|
|
93
|
-
[themeMode, extensions, onSubmit, onSuggest],
|
|
94
|
-
);
|
|
95
|
-
|
|
96
|
-
// Expose editor view.
|
|
97
|
-
useImperativeHandle(
|
|
98
|
-
forwardRef,
|
|
99
|
-
() => {
|
|
100
|
-
return {
|
|
101
|
-
focus: () => {
|
|
102
|
-
view?.focus();
|
|
103
|
-
},
|
|
104
|
-
setText: (text: string) => {
|
|
105
|
-
view?.dispatch({
|
|
106
|
-
changes: {
|
|
107
|
-
from: 0,
|
|
108
|
-
to: view.state.doc.length,
|
|
109
|
-
insert: text,
|
|
110
|
-
},
|
|
111
|
-
selection: {
|
|
112
|
-
anchor: text.length,
|
|
113
|
-
head: text.length,
|
|
114
|
-
},
|
|
115
|
-
});
|
|
116
|
-
},
|
|
117
|
-
};
|
|
118
|
-
},
|
|
119
|
-
[view, onSubmit],
|
|
120
|
-
);
|
|
121
|
-
|
|
122
|
-
return <div ref={parentRef} className={mx('w-full', classNames)} />;
|
|
123
|
-
},
|
|
124
|
-
);
|
|
@@ -1,69 +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, { useEffect, useState } from 'react';
|
|
9
|
-
|
|
10
|
-
import { IntentPlugin, SettingsPlugin } from '@dxos/app-framework';
|
|
11
|
-
import { withPluginManager } from '@dxos/app-framework/testing';
|
|
12
|
-
import { log } from '@dxos/log';
|
|
13
|
-
import { TranscriptionPlugin } from '@dxos/plugin-transcription';
|
|
14
|
-
import { withTheme, withLayout } from '@dxos/storybook-utils';
|
|
15
|
-
|
|
16
|
-
import { PromptBar } from './PromptBar';
|
|
17
|
-
import translations from '../../translations';
|
|
18
|
-
|
|
19
|
-
const meta: Meta<typeof PromptBar> = {
|
|
20
|
-
title: 'plugins/plugin-assistant/PromptBar',
|
|
21
|
-
component: PromptBar,
|
|
22
|
-
decorators: [
|
|
23
|
-
withPluginManager({
|
|
24
|
-
plugins: [IntentPlugin(), SettingsPlugin(), TranscriptionPlugin()],
|
|
25
|
-
}),
|
|
26
|
-
withTheme,
|
|
27
|
-
withLayout(),
|
|
28
|
-
],
|
|
29
|
-
parameters: {
|
|
30
|
-
layout: 'centered',
|
|
31
|
-
translations,
|
|
32
|
-
controls: { disable: true },
|
|
33
|
-
},
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
export default meta;
|
|
37
|
-
|
|
38
|
-
type Story = StoryObj<typeof PromptBar>;
|
|
39
|
-
|
|
40
|
-
export const Default: Story = {
|
|
41
|
-
// args: {
|
|
42
|
-
// classNames: 'w-96 p-4 rounded outline outline-gray-200',
|
|
43
|
-
// },
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
export const Toolbar: Story = {
|
|
47
|
-
render: (args) => {
|
|
48
|
-
const [processing, setProcessing] = useState(false);
|
|
49
|
-
useEffect(() => {
|
|
50
|
-
let t: NodeJS.Timeout;
|
|
51
|
-
if (processing) {
|
|
52
|
-
t = setTimeout(() => setProcessing(false), 10_000);
|
|
53
|
-
}
|
|
54
|
-
return () => clearTimeout(t);
|
|
55
|
-
}, [processing]);
|
|
56
|
-
log.info('processing', { processing });
|
|
57
|
-
|
|
58
|
-
return (
|
|
59
|
-
<PromptBar
|
|
60
|
-
classNames='w-[25rem] p-1 overflow-hidden border border-gray-200 rounded'
|
|
61
|
-
microphone
|
|
62
|
-
processing={processing}
|
|
63
|
-
onSubmit={() => setProcessing(true)}
|
|
64
|
-
onCancel={() => setProcessing(false)}
|
|
65
|
-
{...args}
|
|
66
|
-
/>
|
|
67
|
-
);
|
|
68
|
-
},
|
|
69
|
-
};
|
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import React, { forwardRef, useState } from 'react';
|
|
6
|
-
|
|
7
|
-
import { useVoiceInput } from '@dxos/plugin-transcription';
|
|
8
|
-
import { Icon, IconButton, type ThemedClassName, Tooltip, useForwardedRef, useTranslation } from '@dxos/react-ui';
|
|
9
|
-
import { Spinner } from '@dxos/react-ui-sfx';
|
|
10
|
-
import { errorText, mx } from '@dxos/react-ui-theme';
|
|
11
|
-
|
|
12
|
-
import { Prompt, type PromptController, type PromptProps } from './Prompt';
|
|
13
|
-
import { ASSISTANT_PLUGIN } from '../../meta';
|
|
14
|
-
|
|
15
|
-
export type PromptBarProps = ThemedClassName<
|
|
16
|
-
Pick<
|
|
17
|
-
PromptProps,
|
|
18
|
-
| 'extensions'
|
|
19
|
-
| 'references'
|
|
20
|
-
| 'placeholder'
|
|
21
|
-
| 'lineWrapping'
|
|
22
|
-
| 'onSubmit'
|
|
23
|
-
| 'onSuggest'
|
|
24
|
-
| 'onCancel'
|
|
25
|
-
| 'onOpenChange'
|
|
26
|
-
> & {
|
|
27
|
-
processing?: boolean;
|
|
28
|
-
error?: Error;
|
|
29
|
-
microphone?: boolean;
|
|
30
|
-
}
|
|
31
|
-
>;
|
|
32
|
-
|
|
33
|
-
export const PromptBar = forwardRef<PromptController, PromptBarProps>(
|
|
34
|
-
({ classNames, placeholder, processing, error, microphone, references, onCancel, ...props }, forwardedRef) => {
|
|
35
|
-
const { t } = useTranslation(ASSISTANT_PLUGIN);
|
|
36
|
-
const promptRef = useForwardedRef<PromptController>(forwardedRef);
|
|
37
|
-
const [active, setActive] = useState(false);
|
|
38
|
-
|
|
39
|
-
// TODO(burdon): Configure capability in TranscriptionPlugin.
|
|
40
|
-
const { recording } = useVoiceInput({
|
|
41
|
-
active,
|
|
42
|
-
onUpdate: (text) => {
|
|
43
|
-
promptRef.current?.setText(text);
|
|
44
|
-
promptRef.current?.focus();
|
|
45
|
-
},
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
return (
|
|
49
|
-
<div
|
|
50
|
-
className={mx(
|
|
51
|
-
'shrink-0 w-full grid grid-cols-[var(--rail-action)_1fr_var(--rail-action)] overflow-hidden',
|
|
52
|
-
classNames,
|
|
53
|
-
)}
|
|
54
|
-
>
|
|
55
|
-
<div className='flex w-[--rail-action] h-[--rail-action] items-center justify-center'>
|
|
56
|
-
{(error && (
|
|
57
|
-
<Tooltip.Trigger content={error.message} delayDuration={0}>
|
|
58
|
-
<Icon icon='ph--warning-circle--regular' classNames={errorText} size={5} />
|
|
59
|
-
</Tooltip.Trigger>
|
|
60
|
-
)) || <Spinner active={processing} />}
|
|
61
|
-
</div>
|
|
62
|
-
<Prompt
|
|
63
|
-
ref={promptRef}
|
|
64
|
-
autoFocus
|
|
65
|
-
classNames='pbs-2'
|
|
66
|
-
lineWrapping={true}
|
|
67
|
-
placeholder={placeholder ?? t('prompt placeholder')}
|
|
68
|
-
references={references}
|
|
69
|
-
onCancel={onCancel}
|
|
70
|
-
{...props}
|
|
71
|
-
/>
|
|
72
|
-
{(onCancel || microphone) && (
|
|
73
|
-
<div className='flex w-[--rail-action] h-[--rail-action] items-center justify-center'>
|
|
74
|
-
{processing && onCancel && (
|
|
75
|
-
<IconButton
|
|
76
|
-
classNames='px-1.5'
|
|
77
|
-
variant='ghost'
|
|
78
|
-
size={5}
|
|
79
|
-
icon='ph--x--regular'
|
|
80
|
-
iconOnly
|
|
81
|
-
label={t('cancel processing button')}
|
|
82
|
-
onClick={onCancel}
|
|
83
|
-
/>
|
|
84
|
-
)}
|
|
85
|
-
{!processing && microphone && (
|
|
86
|
-
<IconButton
|
|
87
|
-
classNames={mx('px-1.5', recording && 'bg-primary-500')}
|
|
88
|
-
variant='ghost'
|
|
89
|
-
size={5}
|
|
90
|
-
icon='ph--microphone--regular'
|
|
91
|
-
iconOnly
|
|
92
|
-
noTooltip
|
|
93
|
-
label={t('microphone button')}
|
|
94
|
-
onMouseDown={() => setActive(true)}
|
|
95
|
-
onMouseUp={() => setActive(false)}
|
|
96
|
-
onTouchStart={() => setActive(true)}
|
|
97
|
-
onTouchEnd={() => setActive(false)}
|
|
98
|
-
/>
|
|
99
|
-
)}
|
|
100
|
-
</div>
|
|
101
|
-
)}
|
|
102
|
-
</div>
|
|
103
|
-
);
|
|
104
|
-
},
|
|
105
|
-
);
|