@dxos/plugin-assistant 0.8.3 → 0.8.4-main.c1de068
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-M3IHQLRS.mjs +54 -0
- package/dist/lib/browser/ChatContainer-M3IHQLRS.mjs.map +7 -0
- package/dist/lib/browser/ChatDialog-X6VN6QZI.mjs +72 -0
- package/dist/lib/browser/ChatDialog-X6VN6QZI.mjs.map +7 -0
- package/dist/lib/browser/SequenceContainer-3UDVKWPA.mjs +162 -0
- package/dist/lib/browser/SequenceContainer-3UDVKWPA.mjs.map +7 -0
- package/dist/lib/browser/{TemplateContainer-QQHVOTSI.mjs → TemplateContainer-RPJ2LBOB.mjs} +5 -6
- package/dist/lib/browser/TemplateContainer-RPJ2LBOB.mjs.map +7 -0
- package/dist/lib/browser/{app-graph-builder-E4H5DCOJ.mjs → app-graph-builder-JTXBKE7O.mjs} +34 -36
- package/dist/lib/browser/app-graph-builder-JTXBKE7O.mjs.map +7 -0
- package/dist/lib/browser/chunk-AEAEKWOC.mjs +98 -0
- package/dist/lib/browser/chunk-AEAEKWOC.mjs.map +7 -0
- package/dist/lib/browser/{chunk-BI6AHRNJ.mjs → chunk-EQDW6BYQ.mjs} +19 -68
- package/dist/lib/browser/chunk-EQDW6BYQ.mjs.map +7 -0
- package/dist/lib/{node/chunk-P74TWGMG.cjs → browser/chunk-FDCJSQYF.mjs} +10 -14
- package/dist/lib/{node-esm/chunk-BB2TAT4P.mjs.map → browser/chunk-FDCJSQYF.mjs.map} +1 -1
- package/dist/lib/browser/chunk-JQBVLTM5.mjs +158 -0
- package/dist/lib/browser/chunk-JQBVLTM5.mjs.map +7 -0
- package/dist/lib/browser/chunk-OWY4CUQY.mjs +2245 -0
- package/dist/lib/browser/chunk-OWY4CUQY.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +87 -119
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/intent-resolver-5RMMCMXG.mjs +60 -0
- package/dist/lib/browser/intent-resolver-5RMMCMXG.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/{react-surface-LXCNUSZN.mjs → react-surface-66VY37YQ.mjs} +42 -51
- package/dist/lib/browser/react-surface-66VY37YQ.mjs.map +7 -0
- package/dist/lib/browser/{settings-XRHXVWGB.mjs → settings-2DGP3UTS.mjs} +6 -6
- package/dist/lib/browser/settings-2DGP3UTS.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +4 -20
- package/dist/lib/node-esm/ChatContainer-VZT74PO2.mjs +55 -0
- package/dist/lib/node-esm/ChatContainer-VZT74PO2.mjs.map +7 -0
- package/dist/lib/node-esm/ChatDialog-RJ6FDX4Q.mjs +73 -0
- package/dist/lib/node-esm/ChatDialog-RJ6FDX4Q.mjs.map +7 -0
- package/dist/lib/node-esm/SequenceContainer-RQQH5XOC.mjs +163 -0
- package/dist/lib/node-esm/SequenceContainer-RQQH5XOC.mjs.map +7 -0
- package/dist/lib/node-esm/{TemplateContainer-SOEWY2ZN.mjs → TemplateContainer-A3NAQCZE.mjs} +5 -6
- package/dist/lib/node-esm/TemplateContainer-A3NAQCZE.mjs.map +7 -0
- package/dist/lib/node-esm/{app-graph-builder-3SY5MBIK.mjs → app-graph-builder-OWSOXFTD.mjs} +34 -36
- package/dist/lib/node-esm/app-graph-builder-OWSOXFTD.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-OYN6HLXZ.mjs → chunk-2XL6MNPE.mjs} +44 -33
- package/dist/lib/node-esm/chunk-2XL6MNPE.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-BISJDTBK.mjs +159 -0
- package/dist/lib/node-esm/chunk-BISJDTBK.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-UCOFKNKN.mjs → chunk-E33DNNDW.mjs} +19 -68
- package/dist/lib/node-esm/chunk-E33DNNDW.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-QN2H2EHV.mjs +41 -0
- package/dist/lib/{browser/chunk-XOZ7YMO3.mjs.map → node-esm/chunk-QN2H2EHV.mjs.map} +1 -1
- package/dist/lib/node-esm/chunk-SENTQAEO.mjs +2246 -0
- package/dist/lib/node-esm/chunk-SENTQAEO.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +87 -119
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/intent-resolver-YPPYELY3.mjs +61 -0
- package/dist/lib/node-esm/intent-resolver-YPPYELY3.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/{react-surface-7HA5EDWY.mjs → react-surface-RJMRBR2M.mjs} +42 -51
- package/dist/lib/node-esm/react-surface-RJMRBR2M.mjs.map +7 -0
- package/dist/lib/node-esm/{settings-5IAY6BT4.mjs → settings-47RYZOU4.mjs} +6 -6
- package/dist/lib/node-esm/settings-47RYZOU4.mjs.map +7 -0
- package/dist/lib/node-esm/types/index.mjs +4 -20
- package/dist/types/src/AssistantPlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
- package/dist/types/src/capabilities/index.d.ts +1 -3
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/intent-resolver.d.ts +2 -2
- package/dist/types/src/capabilities/intent-resolver.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
- package/dist/types/src/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 +47 -0
- package/dist/types/src/components/Chat/Chat.d.ts.map +1 -0
- package/dist/types/src/components/Chat/events.d.ts +30 -0
- package/dist/types/src/components/Chat/events.d.ts.map +1 -0
- package/dist/types/src/components/Chat/index.d.ts +3 -0
- package/dist/types/src/components/Chat/index.d.ts.map +1 -0
- package/dist/types/src/components/ChatContainer.d.ts +6 -6
- package/dist/types/src/components/ChatContainer.d.ts.map +1 -1
- package/dist/types/src/components/ChatDialog.d.ts +8 -0
- package/dist/types/src/components/ChatDialog.d.ts.map +1 -0
- package/dist/types/src/components/ChatPrompt/ChatActions.d.ts +11 -0
- package/dist/types/src/components/ChatPrompt/ChatActions.d.ts.map +1 -0
- package/dist/types/src/components/ChatPrompt/ChatOptionsMenu.d.ts +9 -0
- package/dist/types/src/components/ChatPrompt/ChatOptionsMenu.d.ts.map +1 -0
- package/dist/types/src/components/ChatPrompt/ChatPresets.d.ts +11 -0
- package/dist/types/src/components/ChatPrompt/ChatPresets.d.ts.map +1 -0
- package/dist/types/src/components/ChatPrompt/ChatReferences.d.ts +11 -0
- package/dist/types/src/components/ChatPrompt/ChatReferences.d.ts.map +1 -0
- package/dist/types/src/components/ChatPrompt/ChatStatusIndicator.d.ts +8 -0
- package/dist/types/src/components/ChatPrompt/ChatStatusIndicator.d.ts.map +1 -0
- package/dist/types/src/components/ChatPrompt/index.d.ts +6 -0
- package/dist/types/src/components/ChatPrompt/index.d.ts.map +1 -0
- package/dist/types/src/components/ChatThread/ChatMessage.d.ts +17 -0
- package/dist/types/src/components/ChatThread/ChatMessage.d.ts.map +1 -0
- package/dist/types/src/components/ChatThread/ChatThread.d.ts +19 -0
- package/dist/types/src/components/ChatThread/ChatThread.d.ts.map +1 -0
- package/dist/types/src/components/ChatThread/ChatThread.stories.d.ts +241 -0
- package/dist/types/src/components/ChatThread/ChatThread.stories.d.ts.map +1 -0
- package/dist/types/src/components/ChatThread/ToolBlock.d.ts +19 -0
- package/dist/types/src/components/ChatThread/ToolBlock.d.ts.map +1 -0
- package/dist/types/src/components/ChatThread/index.d.ts +2 -0
- package/dist/types/src/components/ChatThread/index.d.ts.map +1 -0
- package/dist/types/src/components/{Thread → ChatThread}/reducer.d.ts +4 -4
- package/dist/types/src/components/ChatThread/reducer.d.ts.map +1 -0
- package/dist/types/src/components/PromptSettings.d.ts +2 -2
- package/dist/types/src/components/PromptSettings.d.ts.map +1 -1
- package/dist/types/src/components/SequenceContainer.d.ts +8 -0
- package/dist/types/src/components/SequenceContainer.d.ts.map +1 -0
- package/dist/types/src/components/SequenceEditor/SequenceEditor.d.ts +13 -0
- package/dist/types/src/components/SequenceEditor/SequenceEditor.d.ts.map +1 -0
- package/dist/types/src/components/SequenceEditor/SequenceEditor.stories.d.ts +8 -0
- package/dist/types/src/components/SequenceEditor/SequenceEditor.stories.d.ts.map +1 -0
- package/dist/types/src/components/SequenceEditor/index.d.ts +2 -0
- package/dist/types/src/components/SequenceEditor/index.d.ts.map +1 -0
- package/dist/types/src/components/TemplateContainer.d.ts +5 -5
- package/dist/types/src/components/TemplateContainer.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/TemplateEditor.d.ts +2 -2
- package/dist/types/src/components/TemplateEditor/TemplateEditor.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/TemplateEditor.stories.d.ts +3 -3
- package/dist/types/src/components/TemplateEditor/TemplateEditor.stories.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/TemplateForm.d.ts +3 -3
- package/dist/types/src/components/TemplateEditor/TemplateForm.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/TemplateForm.stories.d.ts +1 -1
- package/dist/types/src/components/TemplateEditor/TemplateForm.stories.d.ts.map +1 -1
- package/dist/types/src/components/Toolbox/Toolbox.d.ts +11 -4
- package/dist/types/src/components/Toolbox/Toolbox.d.ts.map +1 -1
- package/dist/types/src/components/Toolbox/Toolbox.stories.d.ts +1 -1
- package/dist/types/src/components/Toolbox/Toolbox.stories.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +6 -12
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/events.d.ts.map +1 -1
- package/dist/types/src/hooks/{processor.d.ts → chat-processor.d.ts} +36 -22
- package/dist/types/src/hooks/chat-processor.d.ts.map +1 -0
- package/dist/types/src/hooks/chat-processor.test.d.ts +2 -0
- package/dist/types/src/hooks/chat-processor.test.d.ts.map +1 -0
- package/dist/types/src/hooks/index.d.ts +5 -5
- package/dist/types/src/hooks/index.d.ts.map +1 -1
- package/dist/types/src/hooks/presets.d.ts +13 -0
- package/dist/types/src/hooks/presets.d.ts.map +1 -0
- package/dist/types/src/hooks/useBlueprints.d.ts +9 -0
- package/dist/types/src/hooks/useBlueprints.d.ts.map +1 -0
- package/dist/types/src/hooks/useChatProcessor.d.ts +20 -8
- package/dist/types/src/hooks/useChatProcessor.d.ts.map +1 -1
- package/dist/types/src/hooks/useChatServices.d.ts +14 -0
- package/dist/types/src/hooks/useChatServices.d.ts.map +1 -0
- package/dist/types/src/hooks/useReferencesProvider.d.ts +7 -0
- package/dist/types/src/hooks/useReferencesProvider.d.ts.map +1 -0
- package/dist/types/src/parser/index.d.ts +1 -1
- package/dist/types/src/parser/index.d.ts.map +1 -1
- package/dist/types/src/queue-logger.d.ts +5 -5
- package/dist/types/src/queue-logger.d.ts.map +1 -1
- package/dist/types/src/stories/Chat.stories.d.ts +249 -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 +77 -113
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/index.d.ts +1 -3
- package/dist/types/src/types/index.d.ts.map +1 -1
- package/dist/types/src/types/schema.d.ts +88 -0
- package/dist/types/src/types/schema.d.ts.map +1 -0
- package/dist/types/src/types/service.d.ts +9 -9
- package/dist/types/src/types/service.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +80 -74
- package/src/AssistantPlugin.tsx +20 -47
- package/src/capabilities/app-graph-builder.ts +35 -30
- package/src/capabilities/index.ts +0 -3
- package/src/capabilities/intent-resolver.ts +27 -14
- package/src/capabilities/react-surface.tsx +38 -37
- package/src/capabilities/settings.ts +3 -3
- package/src/components/AssistantSettings/AssistantSettings.tsx +4 -4
- package/src/components/Chat/Chat.tsx +388 -0
- package/src/components/Chat/events.ts +50 -0
- package/src/components/Chat/index.ts +7 -0
- package/src/components/ChatContainer.tsx +26 -20
- package/src/components/ChatDialog.tsx +64 -0
- package/src/components/ChatPrompt/ChatActions.tsx +71 -0
- package/src/components/ChatPrompt/ChatOptionsMenu.tsx +52 -0
- package/src/components/ChatPrompt/ChatPresets.tsx +28 -0
- package/src/components/ChatPrompt/ChatReferences.tsx +53 -0
- package/src/components/ChatPrompt/ChatStatusIndicator.tsx +39 -0
- package/src/components/ChatPrompt/index.ts +9 -0
- package/src/components/ChatThread/ChatMessage.tsx +268 -0
- package/src/components/ChatThread/ChatThread.stories.tsx +143 -0
- package/src/components/ChatThread/ChatThread.tsx +57 -0
- package/src/components/{Thread/ToolInvocations.tsx → ChatThread/ToolBlock.tsx} +36 -21
- package/src/{experimental/transcription → components/ChatThread}/index.ts +2 -0
- package/src/components/{Thread → ChatThread}/reducer.ts +14 -14
- package/src/components/PromptSettings.tsx +43 -45
- package/src/components/SequenceContainer.tsx +132 -0
- package/src/components/SequenceEditor/SequenceEditor.stories.tsx +32 -0
- package/src/components/{BlueprintEditor/BlueprintEditor.tsx → SequenceEditor/SequenceEditor.tsx} +7 -7
- package/src/components/{AmbientDialog → SequenceEditor}/index.ts +1 -1
- package/src/components/TemplateContainer.tsx +8 -7
- package/src/components/TemplateEditor/TemplateEditor.stories.tsx +28 -33
- package/src/components/TemplateEditor/TemplateEditor.tsx +32 -19
- package/src/components/TemplateEditor/TemplateForm.stories.tsx +15 -15
- package/src/components/TemplateEditor/TemplateForm.tsx +47 -55
- package/src/components/Toolbox/Toolbox.stories.tsx +5 -6
- package/src/components/Toolbox/Toolbox.tsx +60 -4
- package/src/components/index.ts +4 -5
- package/src/events.ts +2 -2
- package/src/hooks/{processor.test.ts → chat-processor.test.ts} +3 -2
- package/src/hooks/chat-processor.ts +314 -0
- package/src/hooks/index.ts +5 -5
- package/src/hooks/presets.ts +52 -0
- package/src/hooks/useBlueprints.ts +57 -0
- package/src/hooks/useChatProcessor.ts +143 -0
- package/src/hooks/useChatServices.ts +91 -0
- package/src/hooks/{useContextProvider.ts → useReferencesProvider.ts} +14 -14
- package/src/parser/index.ts +1 -1
- package/src/queue-logger.ts +6 -6
- package/src/stories/Chat.stories.tsx +378 -0
- package/src/testing/index.ts +1 -1
- package/src/testing/test-functions.ts +1 -1
- package/src/testing/test-sequence.ts +51 -0
- package/src/tools/openapi.test.ts +11 -11
- package/src/translations.ts +43 -23
- package/src/types/index.ts +1 -3
- package/src/types/schema.ts +95 -0
- package/dist/lib/browser/AssistantDialog-MQOOR364.mjs +0 -47
- package/dist/lib/browser/AssistantDialog-MQOOR364.mjs.map +0 -7
- package/dist/lib/browser/BlueprintContainer-AT5Y7EXG.mjs +0 -321
- package/dist/lib/browser/BlueprintContainer-AT5Y7EXG.mjs.map +0 -7
- package/dist/lib/browser/ChatContainer-C2NEAS3A.mjs +0 -40
- package/dist/lib/browser/ChatContainer-C2NEAS3A.mjs.map +0 -7
- package/dist/lib/browser/TemplateContainer-QQHVOTSI.mjs.map +0 -7
- package/dist/lib/browser/ai-client-MK2ZZII2.mjs +0 -39
- package/dist/lib/browser/ai-client-MK2ZZII2.mjs.map +0 -7
- package/dist/lib/browser/app-graph-builder-E4H5DCOJ.mjs.map +0 -7
- package/dist/lib/browser/chunk-AAOKC2JN.mjs +0 -208
- package/dist/lib/browser/chunk-AAOKC2JN.mjs.map +0 -7
- package/dist/lib/browser/chunk-BI6AHRNJ.mjs.map +0 -7
- package/dist/lib/browser/chunk-JO4W3MF7.mjs +0 -2101
- package/dist/lib/browser/chunk-JO4W3MF7.mjs.map +0 -7
- package/dist/lib/browser/chunk-JQFUME3B.mjs +0 -87
- package/dist/lib/browser/chunk-JQFUME3B.mjs.map +0 -7
- package/dist/lib/browser/chunk-MEGMOFJB.mjs +0 -16
- package/dist/lib/browser/chunk-MEGMOFJB.mjs.map +0 -7
- package/dist/lib/browser/chunk-Q6UZ4F3H.mjs +0 -96
- package/dist/lib/browser/chunk-Q6UZ4F3H.mjs.map +0 -7
- package/dist/lib/browser/chunk-UE3IZ4PN.mjs +0 -15
- package/dist/lib/browser/chunk-UE3IZ4PN.mjs.map +0 -7
- package/dist/lib/browser/chunk-XOZ7YMO3.mjs +0 -20
- package/dist/lib/browser/intent-resolver-3UICTGPM.mjs +0 -43
- package/dist/lib/browser/intent-resolver-3UICTGPM.mjs.map +0 -7
- package/dist/lib/browser/react-surface-LXCNUSZN.mjs.map +0 -7
- package/dist/lib/browser/settings-XRHXVWGB.mjs.map +0 -7
- package/dist/lib/node/AssistantDialog-AN4Z6YUV.cjs +0 -73
- package/dist/lib/node/AssistantDialog-AN4Z6YUV.cjs.map +0 -7
- package/dist/lib/node/BlueprintContainer-NOWLDYCZ.cjs +0 -344
- package/dist/lib/node/BlueprintContainer-NOWLDYCZ.cjs.map +0 -7
- package/dist/lib/node/ChatContainer-VKYBQHUB.cjs +0 -68
- package/dist/lib/node/ChatContainer-VKYBQHUB.cjs.map +0 -7
- package/dist/lib/node/TemplateContainer-JZF2DCCG.cjs +0 -58
- package/dist/lib/node/TemplateContainer-JZF2DCCG.cjs.map +0 -7
- package/dist/lib/node/ai-client-7HNSMUMT.cjs +0 -53
- package/dist/lib/node/ai-client-7HNSMUMT.cjs.map +0 -7
- package/dist/lib/node/app-graph-builder-PPR5B5KU.cjs +0 -235
- package/dist/lib/node/app-graph-builder-PPR5B5KU.cjs.map +0 -7
- package/dist/lib/node/chunk-4EEWTDQK.cjs +0 -117
- package/dist/lib/node/chunk-4EEWTDQK.cjs.map +0 -7
- package/dist/lib/node/chunk-FUAGEO7Q.cjs +0 -52
- package/dist/lib/node/chunk-FUAGEO7Q.cjs.map +0 -7
- package/dist/lib/node/chunk-HRNIUYVQ.cjs +0 -128
- package/dist/lib/node/chunk-HRNIUYVQ.cjs.map +0 -7
- package/dist/lib/node/chunk-IKZBMHSW.cjs +0 -184
- package/dist/lib/node/chunk-IKZBMHSW.cjs.map +0 -7
- package/dist/lib/node/chunk-LMDJEGZ2.cjs +0 -233
- package/dist/lib/node/chunk-LMDJEGZ2.cjs.map +0 -7
- package/dist/lib/node/chunk-NIDICM57.cjs +0 -2080
- package/dist/lib/node/chunk-NIDICM57.cjs.map +0 -7
- package/dist/lib/node/chunk-P74TWGMG.cjs.map +0 -7
- package/dist/lib/node/chunk-QGPWY6GW.cjs +0 -34
- package/dist/lib/node/chunk-QGPWY6GW.cjs.map +0 -7
- package/dist/lib/node/index.cjs +0 -289
- package/dist/lib/node/index.cjs.map +0 -7
- package/dist/lib/node/intent-resolver-QSWGTKON.cjs +0 -58
- package/dist/lib/node/intent-resolver-QSWGTKON.cjs.map +0 -7
- package/dist/lib/node/meta.json +0 -1
- package/dist/lib/node/react-surface-D3NBYRZ6.cjs +0 -172
- package/dist/lib/node/react-surface-D3NBYRZ6.cjs.map +0 -7
- package/dist/lib/node/settings-2JXLKYGE.cjs +0 -36
- package/dist/lib/node/settings-2JXLKYGE.cjs.map +0 -7
- package/dist/lib/node/types/index.cjs +0 -54
- package/dist/lib/node/types/index.cjs.map +0 -7
- package/dist/lib/node-esm/AssistantDialog-6WEMLUPU.mjs +0 -48
- package/dist/lib/node-esm/AssistantDialog-6WEMLUPU.mjs.map +0 -7
- package/dist/lib/node-esm/BlueprintContainer-STOJAVML.mjs +0 -322
- package/dist/lib/node-esm/BlueprintContainer-STOJAVML.mjs.map +0 -7
- package/dist/lib/node-esm/ChatContainer-3MVBTUJN.mjs +0 -41
- package/dist/lib/node-esm/ChatContainer-3MVBTUJN.mjs.map +0 -7
- package/dist/lib/node-esm/TemplateContainer-SOEWY2ZN.mjs.map +0 -7
- package/dist/lib/node-esm/ai-client-XGZBJ6BE.mjs +0 -40
- package/dist/lib/node-esm/ai-client-XGZBJ6BE.mjs.map +0 -7
- package/dist/lib/node-esm/app-graph-builder-3SY5MBIK.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-34EX6E5Q.mjs +0 -18
- package/dist/lib/node-esm/chunk-34EX6E5Q.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-3UEZLJ2V.mjs +0 -16
- package/dist/lib/node-esm/chunk-3UEZLJ2V.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-BB2TAT4P.mjs +0 -22
- package/dist/lib/node-esm/chunk-CDAILLCU.mjs +0 -98
- package/dist/lib/node-esm/chunk-CDAILLCU.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-J6UXXZGJ.mjs +0 -209
- package/dist/lib/node-esm/chunk-J6UXXZGJ.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-OD574YIU.mjs +0 -2102
- package/dist/lib/node-esm/chunk-OD574YIU.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-OYN6HLXZ.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-UCOFKNKN.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-E6MXTYAU.mjs +0 -44
- package/dist/lib/node-esm/intent-resolver-E6MXTYAU.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-7HA5EDWY.mjs.map +0 -7
- package/dist/lib/node-esm/settings-5IAY6BT4.mjs.map +0 -7
- package/dist/types/src/capabilities/ai-client.d.ts +0 -5
- package/dist/types/src/capabilities/ai-client.d.ts.map +0 -1
- package/dist/types/src/capabilities/capabilities.d.ts +0 -6
- package/dist/types/src/capabilities/capabilities.d.ts.map +0 -1
- package/dist/types/src/components/AmbientDialog/AmbientDialog.d.ts +0 -10
- package/dist/types/src/components/AmbientDialog/AmbientDialog.d.ts.map +0 -1
- package/dist/types/src/components/AmbientDialog/AmbientDialog.stories.d.ts +0 -8
- package/dist/types/src/components/AmbientDialog/AmbientDialog.stories.d.ts.map +0 -1
- package/dist/types/src/components/AmbientDialog/index.d.ts +0 -2
- package/dist/types/src/components/AmbientDialog/index.d.ts.map +0 -1
- package/dist/types/src/components/AssistantDialog.d.ts +0 -7
- package/dist/types/src/components/AssistantDialog.d.ts.map +0 -1
- package/dist/types/src/components/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 +0 -16
- package/dist/types/src/components/Thread/ThreadMessage.d.ts.map +0 -1
- package/dist/types/src/components/Thread/ToolInvocations.d.ts +0 -13
- package/dist/types/src/components/Thread/ToolInvocations.d.ts.map +0 -1
- package/dist/types/src/components/Thread/index.d.ts +0 -3
- package/dist/types/src/components/Thread/index.d.ts.map +0 -1
- package/dist/types/src/components/Thread/reducer.d.ts.map +0 -1
- package/dist/types/src/experimental/transcription/index.d.ts +0 -1
- package/dist/types/src/experimental/transcription/index.d.ts.map +0 -1
- package/dist/types/src/hooks/processor.d.ts.map +0 -1
- package/dist/types/src/hooks/processor.test.d.ts +0 -2
- package/dist/types/src/hooks/processor.test.d.ts.map +0 -1
- package/dist/types/src/hooks/useContextProvider.d.ts +0 -17
- package/dist/types/src/hooks/useContextProvider.d.ts.map +0 -1
- package/dist/types/src/hooks/useMessageQueue.d.ts +0 -42
- package/dist/types/src/hooks/useMessageQueue.d.ts.map +0 -1
- package/dist/types/src/hooks/useServices.d.ts +0 -7
- package/dist/types/src/hooks/useServices.d.ts.map +0 -1
- package/dist/types/src/hooks/useTextInputEvents.d.ts +0 -13
- package/dist/types/src/hooks/useTextInputEvents.d.ts.map +0 -1
- package/dist/types/src/stories/Prompt.stories.d.ts +0 -8
- package/dist/types/src/stories/Prompt.stories.d.ts.map +0 -1
- package/dist/types/src/stories/Query.stories.d.ts +0 -19
- package/dist/types/src/stories/Query.stories.d.ts.map +0 -1
- package/dist/types/src/stories/Research.stories.d.ts +0 -15
- package/dist/types/src/stories/Research.stories.d.ts.map +0 -1
- package/dist/types/src/stories/test-data.d.ts +0 -3
- package/dist/types/src/stories/test-data.d.ts.map +0 -1
- package/dist/types/src/stories/testing.d.ts +0 -12
- package/dist/types/src/stories/testing.d.ts.map +0 -1
- package/dist/types/src/testing/test-blueprint.d.ts +0 -8
- package/dist/types/src/testing/test-blueprint.d.ts.map +0 -1
- package/dist/types/src/types/chat.d.ts +0 -23
- package/dist/types/src/types/chat.d.ts.map +0 -1
- package/dist/types/src/types/template.d.ts +0 -56
- package/dist/types/src/types/template.d.ts.map +0 -1
- package/dist/types/src/types/types.d.ts +0 -50
- package/dist/types/src/types/types.d.ts.map +0 -1
- package/src/capabilities/ai-client.ts +0 -42
- package/src/capabilities/capabilities.ts +0 -15
- package/src/components/AmbientDialog/AmbientDialog.stories.tsx +0 -84
- package/src/components/AmbientDialog/AmbientDialog.tsx +0 -117
- package/src/components/AssistantDialog.tsx +0 -37
- package/src/components/BlueprintContainer.tsx +0 -148
- 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/ThreadMessage.tsx +0 -234
- package/src/components/Thread/index.ts +0 -6
- package/src/hooks/processor.ts +0 -238
- package/src/hooks/useChatProcessor.tsx +0 -97
- package/src/hooks/useMessageQueue.ts +0 -22
- package/src/hooks/useServices.ts +0 -28
- package/src/hooks/useTextInputEvents.ts +0 -49
- package/src/stories/Prompt.stories.tsx +0 -60
- package/src/stories/Query.stories.tsx +0 -514
- package/src/stories/Research.stories.tsx +0 -482
- package/src/stories/test-data.ts +0 -128
- package/src/stories/testing.ts +0 -60
- package/src/testing/test-blueprint.ts +0 -58
- package/src/types/chat.ts +0 -32
- package/src/types/template.ts +0 -66
- package/src/types/types.ts +0 -48
|
@@ -1,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
|
-
);
|
|
@@ -1,218 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { Prec, type Extension } from '@codemirror/state';
|
|
6
|
-
import {
|
|
7
|
-
EditorView,
|
|
8
|
-
Decoration,
|
|
9
|
-
ViewPlugin,
|
|
10
|
-
keymap,
|
|
11
|
-
type DecorationSet,
|
|
12
|
-
type ViewUpdate,
|
|
13
|
-
WidgetType,
|
|
14
|
-
} from '@codemirror/view';
|
|
15
|
-
|
|
16
|
-
export type AutocompleteOptions = {
|
|
17
|
-
/**
|
|
18
|
-
* Callback triggered when Enter is pressed.
|
|
19
|
-
* @param text The current text in the editor
|
|
20
|
-
* @returns true if the editor should reset the document.
|
|
21
|
-
*/
|
|
22
|
-
onSubmit?: (text: string) => boolean | void;
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Function that returns a list of suggestions based on the current text.
|
|
26
|
-
* @param text The current text before the cursor
|
|
27
|
-
* @returns Array of suggestion strings
|
|
28
|
-
*/
|
|
29
|
-
onSuggest?: (text: string) => string[];
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* ESC pressed.
|
|
33
|
-
*/
|
|
34
|
-
onCancel?: () => void;
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* Creates an autocomplete extension that shows inline suggestions.
|
|
39
|
-
* Pressing Tab will complete the suggestion.
|
|
40
|
-
*/
|
|
41
|
-
// TODO(burdon): Move to react-ui-editor.
|
|
42
|
-
export const autocompleteExtension = ({ onSubmit, onSuggest, onCancel }: AutocompleteOptions): Extension => {
|
|
43
|
-
const suggest = ViewPlugin.fromClass(
|
|
44
|
-
class {
|
|
45
|
-
_decorations: DecorationSet;
|
|
46
|
-
_currentSuggestion: string | null = null;
|
|
47
|
-
|
|
48
|
-
constructor(view: EditorView) {
|
|
49
|
-
this._decorations = this.computeDecorations(view);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
update(update: ViewUpdate) {
|
|
53
|
-
if (update.docChanged || update.selectionSet) {
|
|
54
|
-
this._decorations = this.computeDecorations(update.view);
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
private computeDecorations(view: EditorView): DecorationSet {
|
|
59
|
-
const text = view.state.doc.toString();
|
|
60
|
-
const suggestions = onSuggest?.(text) ?? [];
|
|
61
|
-
if (!suggestions.length) {
|
|
62
|
-
this._currentSuggestion = null;
|
|
63
|
-
return Decoration.none;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
// Get the first suggestion.
|
|
67
|
-
this._currentSuggestion = suggestions[0];
|
|
68
|
-
const suffix = this._currentSuggestion.slice(text.length);
|
|
69
|
-
if (!suffix) {
|
|
70
|
-
return Decoration.none;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
// Always show ghost text at the end of the document.
|
|
74
|
-
return Decoration.set([
|
|
75
|
-
Decoration.widget({
|
|
76
|
-
widget: new InlineSuggestionWidget(suffix),
|
|
77
|
-
side: 1,
|
|
78
|
-
}).range(view.state.doc.length),
|
|
79
|
-
]);
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
completeSuggestion(view: EditorView): boolean {
|
|
83
|
-
if (!this._currentSuggestion) {
|
|
84
|
-
return false;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
const text = view.state.doc.toString();
|
|
88
|
-
const suffix = this._currentSuggestion.slice(text.length);
|
|
89
|
-
if (!suffix) {
|
|
90
|
-
return false;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
view.dispatch({
|
|
94
|
-
changes: {
|
|
95
|
-
from: view.state.doc.length,
|
|
96
|
-
insert: suffix,
|
|
97
|
-
},
|
|
98
|
-
selection: {
|
|
99
|
-
anchor: view.state.doc.length + suffix.length,
|
|
100
|
-
},
|
|
101
|
-
});
|
|
102
|
-
|
|
103
|
-
return true;
|
|
104
|
-
}
|
|
105
|
-
},
|
|
106
|
-
{
|
|
107
|
-
decorations: (v) => v._decorations,
|
|
108
|
-
},
|
|
109
|
-
);
|
|
110
|
-
|
|
111
|
-
return [
|
|
112
|
-
suggest,
|
|
113
|
-
EditorView.theme({
|
|
114
|
-
'.cm-inline-suggestion': {
|
|
115
|
-
opacity: 0.4,
|
|
116
|
-
},
|
|
117
|
-
}),
|
|
118
|
-
|
|
119
|
-
Prec.highest(
|
|
120
|
-
keymap.of([
|
|
121
|
-
{
|
|
122
|
-
key: 'Tab',
|
|
123
|
-
preventDefault: true,
|
|
124
|
-
run: (view) => {
|
|
125
|
-
const plugin = view.plugin(suggest);
|
|
126
|
-
return plugin?.completeSuggestion(view) ?? false;
|
|
127
|
-
},
|
|
128
|
-
},
|
|
129
|
-
{
|
|
130
|
-
key: 'ArrowRight',
|
|
131
|
-
preventDefault: true,
|
|
132
|
-
run: (view) => {
|
|
133
|
-
// Only complete if cursor is at the end
|
|
134
|
-
if (view.state.selection.main.head !== view.state.doc.length) {
|
|
135
|
-
return false;
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
const plugin = view.plugin(suggest);
|
|
139
|
-
return plugin?.completeSuggestion(view) ?? false;
|
|
140
|
-
},
|
|
141
|
-
},
|
|
142
|
-
{
|
|
143
|
-
key: 'Enter',
|
|
144
|
-
preventDefault: true,
|
|
145
|
-
run: (view) => {
|
|
146
|
-
const text = view.state.doc.toString().trim();
|
|
147
|
-
if (text.length > 0 && onSubmit) {
|
|
148
|
-
const reset = onSubmit(text);
|
|
149
|
-
|
|
150
|
-
// Clear the document after calling onEnter.
|
|
151
|
-
if (reset) {
|
|
152
|
-
view.dispatch({
|
|
153
|
-
changes: {
|
|
154
|
-
from: 0,
|
|
155
|
-
to: view.state.doc.length,
|
|
156
|
-
insert: '',
|
|
157
|
-
},
|
|
158
|
-
});
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
return true;
|
|
163
|
-
},
|
|
164
|
-
},
|
|
165
|
-
{
|
|
166
|
-
key: 'Shift-Enter',
|
|
167
|
-
preventDefault: true,
|
|
168
|
-
run: (view) => {
|
|
169
|
-
view.dispatch({
|
|
170
|
-
changes: {
|
|
171
|
-
from: view.state.selection.main.head,
|
|
172
|
-
insert: '\n',
|
|
173
|
-
},
|
|
174
|
-
selection: {
|
|
175
|
-
anchor: view.state.selection.main.head + 1,
|
|
176
|
-
head: view.state.selection.main.head + 1,
|
|
177
|
-
},
|
|
178
|
-
});
|
|
179
|
-
return true;
|
|
180
|
-
},
|
|
181
|
-
},
|
|
182
|
-
{
|
|
183
|
-
key: 'Escape',
|
|
184
|
-
preventDefault: true,
|
|
185
|
-
run: (view) => {
|
|
186
|
-
// Clear the entire document.
|
|
187
|
-
view.dispatch({
|
|
188
|
-
changes: {
|
|
189
|
-
from: 0,
|
|
190
|
-
to: view.state.doc.length,
|
|
191
|
-
insert: '',
|
|
192
|
-
},
|
|
193
|
-
});
|
|
194
|
-
onCancel?.();
|
|
195
|
-
return true;
|
|
196
|
-
},
|
|
197
|
-
},
|
|
198
|
-
]),
|
|
199
|
-
),
|
|
200
|
-
];
|
|
201
|
-
};
|
|
202
|
-
|
|
203
|
-
class InlineSuggestionWidget extends WidgetType {
|
|
204
|
-
constructor(private suffix: string) {
|
|
205
|
-
super();
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
override toDOM(): HTMLSpanElement {
|
|
209
|
-
const span = document.createElement('span');
|
|
210
|
-
span.textContent = this.suffix;
|
|
211
|
-
span.className = 'cm-inline-suggestion';
|
|
212
|
-
return span;
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
override eq(other: InlineSuggestionWidget): boolean {
|
|
216
|
-
return other.suffix === this.suffix;
|
|
217
|
-
}
|
|
218
|
-
}
|