@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
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { Layer } from 'effect';
|
|
6
|
+
import { useMemo } from 'react';
|
|
7
|
+
import { useDeepCompareMemoize } from 'use-deep-compare-effect';
|
|
8
|
+
|
|
9
|
+
import { type AiService, type ToolExecutionService, ToolRegistry, type ToolResolverService } from '@dxos/ai';
|
|
10
|
+
import { AiServiceTestingPreset } from '@dxos/ai/testing';
|
|
11
|
+
import { Capabilities, useCapabilities } from '@dxos/app-framework';
|
|
12
|
+
import { makeToolExecutionServiceFromFunctions, makeToolResolverFromFunctions } from '@dxos/assistant';
|
|
13
|
+
import { type Space } from '@dxos/client/echo';
|
|
14
|
+
import {
|
|
15
|
+
ConfiguredCredentialsService,
|
|
16
|
+
CredentialsService,
|
|
17
|
+
DatabaseService,
|
|
18
|
+
EventLogger,
|
|
19
|
+
FunctionCallService,
|
|
20
|
+
QueueService,
|
|
21
|
+
TracingService,
|
|
22
|
+
} from '@dxos/functions';
|
|
23
|
+
|
|
24
|
+
export * from '@dxos/assistant';
|
|
25
|
+
|
|
26
|
+
// TODO(burdon): Deconstruct into separate layers?
|
|
27
|
+
export type ChatServices =
|
|
28
|
+
| AiService
|
|
29
|
+
| CredentialsService
|
|
30
|
+
| DatabaseService
|
|
31
|
+
| QueueService
|
|
32
|
+
| FunctionCallService
|
|
33
|
+
| ToolResolverService
|
|
34
|
+
| ToolExecutionService
|
|
35
|
+
| TracingService
|
|
36
|
+
| EventLogger;
|
|
37
|
+
|
|
38
|
+
export type UseChatServicesProps = {
|
|
39
|
+
space?: Space;
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Construct service layer.
|
|
44
|
+
*/
|
|
45
|
+
export const useChatServices = ({ space }: UseChatServicesProps): Layer.Layer<ChatServices> | undefined => {
|
|
46
|
+
const toolRegistry = useToolRegistry();
|
|
47
|
+
// TODO(dmaretskyi): We can provide the plugin registry as a layer and then build the entire layer stack from there. We need to think how plugin reactivity affect our layer structure.
|
|
48
|
+
const toolResolver = useToolResolver();
|
|
49
|
+
const toolExecutionService = useToolExecutionService();
|
|
50
|
+
|
|
51
|
+
return useMemo(() => {
|
|
52
|
+
return Layer.mergeAll(
|
|
53
|
+
AiServiceTestingPreset('edge-remote').pipe(Layer.orDie), // TODO(burdon): Error management?
|
|
54
|
+
Layer.succeed(CredentialsService, new ConfiguredCredentialsService()),
|
|
55
|
+
space ? Layer.succeed(DatabaseService, DatabaseService.make(space.db)) : DatabaseService.notAvailable,
|
|
56
|
+
space ? Layer.succeed(QueueService, QueueService.make(space.queues)) : QueueService.notAvailable,
|
|
57
|
+
Layer.succeed(FunctionCallService, FunctionCallService.mock()),
|
|
58
|
+
Layer.succeed(TracingService, TracingService.noop),
|
|
59
|
+
Layer.succeed(EventLogger, EventLogger.noop),
|
|
60
|
+
toolResolver,
|
|
61
|
+
toolExecutionService,
|
|
62
|
+
);
|
|
63
|
+
}, [space, toolRegistry, toolResolver]);
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
const useToolResolver = (): Layer.Layer<ToolResolverService> => {
|
|
67
|
+
const functions = useCapabilities(Capabilities.Functions).flat();
|
|
68
|
+
return useMemo(() => makeToolResolverFromFunctions(functions), [useDeepCompareMemoize(functions.map((f) => f.name))]);
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
const useToolExecutionService = (): Layer.Layer<ToolExecutionService> => {
|
|
72
|
+
const functions = useCapabilities(Capabilities.Functions).flat();
|
|
73
|
+
return useMemo(
|
|
74
|
+
() => makeToolExecutionServiceFromFunctions(functions),
|
|
75
|
+
[useDeepCompareMemoize(functions.map((f) => f.name))],
|
|
76
|
+
);
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
// TODO(burdon): Factor out.
|
|
80
|
+
const useToolRegistry = (): ToolRegistry => {
|
|
81
|
+
const tools = useCapabilities(Capabilities.Tools).flat();
|
|
82
|
+
return useMemo(() => {
|
|
83
|
+
const toolRegistry = new ToolRegistry([]);
|
|
84
|
+
for (const tool of tools) {
|
|
85
|
+
if (!toolRegistry.has(tool)) {
|
|
86
|
+
toolRegistry.register(tool);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
return toolRegistry;
|
|
90
|
+
}, [useDeepCompareMemoize(tools)]);
|
|
91
|
+
};
|
|
@@ -7,27 +7,25 @@ import { useMemo } from 'react';
|
|
|
7
7
|
import { Capabilities, useCapabilities } from '@dxos/app-framework';
|
|
8
8
|
import { type Space } from '@dxos/client/echo';
|
|
9
9
|
import { Filter, Obj, type Type } from '@dxos/echo';
|
|
10
|
+
import { type ReferencesProvider } from '@dxos/react-ui-chat';
|
|
10
11
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
const stringMatch = (query: string, label: string) => label.toLowerCase().startsWith(query.toLowerCase());
|
|
17
|
-
|
|
18
|
-
export const useContextProvider = (space?: Space): ContextProvider | undefined => {
|
|
12
|
+
/**
|
|
13
|
+
* Resolve references to objects in the space.
|
|
14
|
+
*/
|
|
15
|
+
export const useReferencesProvider = (space?: Space): ReferencesProvider | undefined => {
|
|
16
|
+
// TODO(burdon): Pass in.
|
|
19
17
|
const artifactDefinitions = useCapabilities(Capabilities.ArtifactDefinition);
|
|
20
18
|
|
|
21
|
-
return useMemo<
|
|
19
|
+
return useMemo<ReferencesProvider | undefined>((): ReferencesProvider | undefined => {
|
|
22
20
|
if (!space) {
|
|
23
21
|
return undefined;
|
|
24
22
|
}
|
|
25
23
|
|
|
26
24
|
return {
|
|
27
|
-
|
|
28
|
-
const
|
|
25
|
+
getReferences: async ({ query }) => {
|
|
26
|
+
const schemas = artifactDefinitions.map((artifact) => artifact.schema);
|
|
29
27
|
const { objects } = await space.db
|
|
30
|
-
.query(Filter.or(...
|
|
28
|
+
.query(Filter.or(...schemas.map((schema) => Filter.type(schema as Type.Schema))))
|
|
31
29
|
.run();
|
|
32
30
|
|
|
33
31
|
return (
|
|
@@ -46,10 +44,12 @@ export const useContextProvider = (space?: Space): ContextProvider | undefined =
|
|
|
46
44
|
}))
|
|
47
45
|
);
|
|
48
46
|
},
|
|
49
|
-
|
|
47
|
+
resolveReference: async ({ uri }) => {
|
|
50
48
|
const object = await space.db.query(Filter.ids(uri)).first();
|
|
51
49
|
return { uri, label: Obj.getLabel(object) ?? '' };
|
|
52
50
|
},
|
|
53
|
-
};
|
|
51
|
+
} satisfies ReferencesProvider;
|
|
54
52
|
}, [space, artifactDefinitions]);
|
|
55
53
|
};
|
|
54
|
+
|
|
55
|
+
const stringMatch = (query: string, label: string) => label.toLowerCase().startsWith(query.toLowerCase());
|
package/src/parser/index.ts
CHANGED
package/src/queue-logger.ts
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { type Blueprint, type BlueprintEvent, type BlueprintLogger } from '@dxos/assistant';
|
|
6
5
|
import { getSpace, Ref, type Queue, type Space } from '@dxos/client/echo';
|
|
6
|
+
import { type Sequence, type SequenceEvent, type SequenceLogger } from '@dxos/conductor';
|
|
7
7
|
import { DXN, Key, Obj } from '@dxos/echo';
|
|
8
8
|
import {
|
|
9
9
|
InvocationOutcome,
|
|
@@ -16,12 +16,12 @@ import {
|
|
|
16
16
|
import { invariant } from '@dxos/invariant';
|
|
17
17
|
import { QueueSubspaceTags } from '@dxos/keys';
|
|
18
18
|
|
|
19
|
-
export class QueueLogger implements
|
|
19
|
+
export class QueueLogger implements SequenceLogger {
|
|
20
20
|
private _space: Space;
|
|
21
21
|
private _invocationTraceQueue: Queue<InvocationTraceEvent>;
|
|
22
22
|
|
|
23
|
-
constructor(private readonly
|
|
24
|
-
const space = getSpace(
|
|
23
|
+
constructor(private readonly sequence: Sequence) {
|
|
24
|
+
const space = getSpace(sequence);
|
|
25
25
|
invariant(space, 'Space not found');
|
|
26
26
|
this._space = space;
|
|
27
27
|
let dxn = this._space.properties.invocationTraceQueue?.dxn;
|
|
@@ -32,7 +32,7 @@ export class QueueLogger implements BlueprintLogger {
|
|
|
32
32
|
this._invocationTraceQueue = this._space.queues.get(dxn);
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
log(event:
|
|
35
|
+
log(event: SequenceEvent) {
|
|
36
36
|
switch (event.type) {
|
|
37
37
|
case 'begin':
|
|
38
38
|
void this._invocationTraceQueue.append([
|
|
@@ -42,7 +42,7 @@ export class QueueLogger implements BlueprintLogger {
|
|
|
42
42
|
timestampMs: Date.now(),
|
|
43
43
|
input: {},
|
|
44
44
|
invocationTraceQueue: Ref.fromDXN(this._getTraceQueueDxn(event.invocationId)),
|
|
45
|
-
invocationTarget: Ref.make(this.
|
|
45
|
+
invocationTarget: Ref.make(this.sequence),
|
|
46
46
|
}),
|
|
47
47
|
]);
|
|
48
48
|
break;
|
|
@@ -0,0 +1,378 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import '@dxos-theme';
|
|
6
|
+
|
|
7
|
+
import { type StoryObj, type Meta } from '@storybook/react-vite';
|
|
8
|
+
import React, { useCallback, useEffect, useMemo, useState, type FC } from 'react';
|
|
9
|
+
|
|
10
|
+
import { Capabilities, contributes, Events, IntentPlugin, type Plugin, SettingsPlugin } from '@dxos/app-framework';
|
|
11
|
+
import { withPluginManager } from '@dxos/app-framework/testing';
|
|
12
|
+
import { ContextBinder } from '@dxos/assistant';
|
|
13
|
+
import {
|
|
14
|
+
DESIGN_BLUEPRINT,
|
|
15
|
+
TASK_BLUEPRINT,
|
|
16
|
+
readDocument,
|
|
17
|
+
remoteServiceEndpoints,
|
|
18
|
+
writeDocument,
|
|
19
|
+
} from '@dxos/assistant-testing';
|
|
20
|
+
import { Blueprint } from '@dxos/blueprints';
|
|
21
|
+
import { Filter, Obj, Ref } from '@dxos/echo';
|
|
22
|
+
import { invariant } from '@dxos/invariant';
|
|
23
|
+
import { log } from '@dxos/log';
|
|
24
|
+
import { ChessPlugin } from '@dxos/plugin-chess';
|
|
25
|
+
import { ClientPlugin } from '@dxos/plugin-client';
|
|
26
|
+
import { InboxPlugin } from '@dxos/plugin-inbox';
|
|
27
|
+
import { MapPlugin } from '@dxos/plugin-map';
|
|
28
|
+
import { MarkdownPlugin } from '@dxos/plugin-markdown';
|
|
29
|
+
import { DocumentType } from '@dxos/plugin-markdown/types';
|
|
30
|
+
import { SpacePlugin } from '@dxos/plugin-space';
|
|
31
|
+
import { TablePlugin } from '@dxos/plugin-table';
|
|
32
|
+
import { TranscriptionPlugin } from '@dxos/plugin-transcription';
|
|
33
|
+
import { Config } from '@dxos/react-client';
|
|
34
|
+
import { createDocAccessor, useQuery, useSpace } from '@dxos/react-client/echo';
|
|
35
|
+
import { Toolbar, useThemeContext, useTranslation } from '@dxos/react-ui';
|
|
36
|
+
import {
|
|
37
|
+
Editor,
|
|
38
|
+
createBasicExtensions,
|
|
39
|
+
createDataExtensions,
|
|
40
|
+
createMarkdownExtensions,
|
|
41
|
+
createThemeExtensions,
|
|
42
|
+
outliner,
|
|
43
|
+
} from '@dxos/react-ui-editor';
|
|
44
|
+
import { mx } from '@dxos/react-ui-theme';
|
|
45
|
+
import { DataType } from '@dxos/schema';
|
|
46
|
+
import { render, withLayout, withTheme } from '@dxos/storybook-utils';
|
|
47
|
+
|
|
48
|
+
import { AssistantPlugin } from '../AssistantPlugin';
|
|
49
|
+
import { Chat, TemplateEditor, type ChatPromptProps } from '../components';
|
|
50
|
+
import { type AiServicePreset, AiServicePresets } from '../hooks';
|
|
51
|
+
import { useChatProcessor, useChatServices } from '../hooks';
|
|
52
|
+
import { meta as AssistantMeta } from '../meta';
|
|
53
|
+
import { translations } from '../translations';
|
|
54
|
+
import { Assistant } from '../types';
|
|
55
|
+
|
|
56
|
+
//
|
|
57
|
+
// Story container
|
|
58
|
+
//
|
|
59
|
+
|
|
60
|
+
const DefaultStory = ({ components }: { components: (FC | FC[])[] }) => {
|
|
61
|
+
return (
|
|
62
|
+
<div
|
|
63
|
+
className={mx('grid grid-cols gap-2 m-2')}
|
|
64
|
+
style={{ gridTemplateColumns: `repeat(${components.length}, minmax(0, 40rem))` }}
|
|
65
|
+
>
|
|
66
|
+
{components.map((Component, index) =>
|
|
67
|
+
Array.isArray(Component) ? (
|
|
68
|
+
<div
|
|
69
|
+
key={index}
|
|
70
|
+
className='grid grid-rows gap-2 overflow-hidden'
|
|
71
|
+
style={{ gridTemplateRows: `repeat(${Component.length}, 1fr)` }}
|
|
72
|
+
>
|
|
73
|
+
{Component.map((Component, index) => (
|
|
74
|
+
<div key={index} className='flex flex-col overflow-hidden bg-baseSurface border border-separator'>
|
|
75
|
+
<Component />
|
|
76
|
+
</div>
|
|
77
|
+
))}
|
|
78
|
+
</div>
|
|
79
|
+
) : (
|
|
80
|
+
<div key={index} className='flex flex-col overflow-hidden bg-baseSurface border border-separator'>
|
|
81
|
+
<Component />
|
|
82
|
+
</div>
|
|
83
|
+
),
|
|
84
|
+
)}
|
|
85
|
+
</div>
|
|
86
|
+
);
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
//
|
|
90
|
+
// Components
|
|
91
|
+
//
|
|
92
|
+
|
|
93
|
+
const ChatContainer = () => {
|
|
94
|
+
const { t } = useTranslation(AssistantMeta.id);
|
|
95
|
+
const space = useSpace();
|
|
96
|
+
|
|
97
|
+
const [chat, setChat] = useState<Assistant.Chat>();
|
|
98
|
+
useEffect(() => {
|
|
99
|
+
const results = space?.db.query(Filter.type(Assistant.Chat)).runSync();
|
|
100
|
+
if (results?.length) {
|
|
101
|
+
setChat(results[0].object);
|
|
102
|
+
}
|
|
103
|
+
}, [space]);
|
|
104
|
+
|
|
105
|
+
// TODO(burdon): Memo preset for provider.
|
|
106
|
+
const [online, setOnline] = useState(true);
|
|
107
|
+
const [preset, setPreset] = useState<AiServicePreset>();
|
|
108
|
+
const presets = useMemo(
|
|
109
|
+
() => AiServicePresets.filter((preset) => online === (preset.provider === 'dxos-remote')),
|
|
110
|
+
[online],
|
|
111
|
+
);
|
|
112
|
+
useEffect(() => {
|
|
113
|
+
setPreset(presets[0]);
|
|
114
|
+
}, [presets]);
|
|
115
|
+
|
|
116
|
+
const services = useChatServices({ space });
|
|
117
|
+
const blueprintRegistry = useMemo(() => new Blueprint.Registry([DESIGN_BLUEPRINT, TASK_BLUEPRINT]), []);
|
|
118
|
+
const processor = useChatProcessor({
|
|
119
|
+
preset,
|
|
120
|
+
chat,
|
|
121
|
+
space,
|
|
122
|
+
services,
|
|
123
|
+
blueprintRegistry,
|
|
124
|
+
noPluginArtifacts: true,
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
const handleChangePreset = useCallback<NonNullable<ChatPromptProps['onChangePreset']>>(
|
|
128
|
+
(id) => {
|
|
129
|
+
const preset = presets.find((preset) => preset.id === id);
|
|
130
|
+
if (preset) {
|
|
131
|
+
setPreset(preset);
|
|
132
|
+
}
|
|
133
|
+
},
|
|
134
|
+
[presets],
|
|
135
|
+
);
|
|
136
|
+
|
|
137
|
+
const handleNewChat = useCallback(() => {
|
|
138
|
+
invariant(space);
|
|
139
|
+
const chat = space.db.add(
|
|
140
|
+
Obj.make(Assistant.Chat, {
|
|
141
|
+
queue: Ref.fromDXN(space.queues.create().dxn),
|
|
142
|
+
}),
|
|
143
|
+
);
|
|
144
|
+
setChat(chat);
|
|
145
|
+
}, [space]);
|
|
146
|
+
|
|
147
|
+
const handleBranchChat = useCallback(() => {}, [space]);
|
|
148
|
+
|
|
149
|
+
if (!chat || !processor) {
|
|
150
|
+
return null;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
return (
|
|
154
|
+
<Chat.Root chat={chat} processor={processor} onEvent={(event) => log.info('event', { event })}>
|
|
155
|
+
<Toolbar.Root classNames='border-b border-subduedSeparator'>
|
|
156
|
+
<Toolbar.IconButton icon='ph--plus--regular' iconOnly label={t('button new thread')} onClick={handleNewChat} />
|
|
157
|
+
<Toolbar.IconButton
|
|
158
|
+
disabled
|
|
159
|
+
icon='ph--git-branch--regular'
|
|
160
|
+
iconOnly
|
|
161
|
+
label={t('button branch thread')}
|
|
162
|
+
onClick={handleBranchChat}
|
|
163
|
+
/>
|
|
164
|
+
</Toolbar.Root>
|
|
165
|
+
<Chat.Thread />
|
|
166
|
+
<div className='p-4'>
|
|
167
|
+
<Chat.Prompt
|
|
168
|
+
classNames='p-2 border border-subduedSeparator rounded focus-within:outline focus-within:border-transparent outline-primary-500'
|
|
169
|
+
expandable
|
|
170
|
+
online={online}
|
|
171
|
+
presets={presets.map(({ id, model, label }) => ({ id, label: label ?? model }))}
|
|
172
|
+
preset={preset?.id}
|
|
173
|
+
onChangeOnline={setOnline}
|
|
174
|
+
onChangePreset={handleChangePreset}
|
|
175
|
+
/>
|
|
176
|
+
</div>
|
|
177
|
+
</Chat.Root>
|
|
178
|
+
);
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
const DocumentContainer = () => {
|
|
182
|
+
const { themeMode } = useThemeContext();
|
|
183
|
+
const space = useSpace();
|
|
184
|
+
const [document] = useQuery(space, Filter.type(DocumentType));
|
|
185
|
+
if (!document?.content.target) {
|
|
186
|
+
return null;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
return (
|
|
190
|
+
<>
|
|
191
|
+
<Toolbar.Root classNames='border-b border-subduedSeparator'>
|
|
192
|
+
<h2>{Obj.getLabel(document)}</h2>
|
|
193
|
+
</Toolbar.Root>
|
|
194
|
+
<Editor
|
|
195
|
+
id={document.id}
|
|
196
|
+
text={document.content.target}
|
|
197
|
+
classNames='h-full p-2 overflow-hidden'
|
|
198
|
+
extensions={[
|
|
199
|
+
// TODO(burdon): Create util.
|
|
200
|
+
createDataExtensions({ id: document.id, text: createDocAccessor(document.content.target, ['content']) }),
|
|
201
|
+
createBasicExtensions({ readOnly: false }),
|
|
202
|
+
createMarkdownExtensions({ themeMode }),
|
|
203
|
+
createThemeExtensions({ themeMode }),
|
|
204
|
+
outliner(),
|
|
205
|
+
]}
|
|
206
|
+
/>
|
|
207
|
+
</>
|
|
208
|
+
);
|
|
209
|
+
};
|
|
210
|
+
|
|
211
|
+
// TODO(burdon): Show all active blueprints from context?
|
|
212
|
+
const BlueprintContainer = () => {
|
|
213
|
+
const space = useSpace();
|
|
214
|
+
const [blueprint] = useQuery(space, Filter.type(Blueprint.Blueprint));
|
|
215
|
+
if (!blueprint?.instructions.target) {
|
|
216
|
+
return null;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
return (
|
|
220
|
+
<div className='flex flex-col h-full'>
|
|
221
|
+
<Toolbar.Root classNames='border-b border-subduedSeparator'>
|
|
222
|
+
<h2>{Obj.getLabel(blueprint)}</h2>
|
|
223
|
+
</Toolbar.Root>
|
|
224
|
+
<TemplateEditor template={blueprint.instructions.target} />
|
|
225
|
+
</div>
|
|
226
|
+
);
|
|
227
|
+
};
|
|
228
|
+
|
|
229
|
+
//
|
|
230
|
+
// Configuration
|
|
231
|
+
//
|
|
232
|
+
|
|
233
|
+
const meta = {
|
|
234
|
+
title: 'plugins/plugin-assistant/Chat',
|
|
235
|
+
render: render(DefaultStory),
|
|
236
|
+
decorators: [],
|
|
237
|
+
parameters: {
|
|
238
|
+
translations,
|
|
239
|
+
controls: { disable: true },
|
|
240
|
+
},
|
|
241
|
+
} satisfies Meta<typeof DefaultStory>;
|
|
242
|
+
|
|
243
|
+
export default meta;
|
|
244
|
+
|
|
245
|
+
type Story = StoryObj<typeof meta>;
|
|
246
|
+
|
|
247
|
+
//
|
|
248
|
+
// Decorators
|
|
249
|
+
//
|
|
250
|
+
|
|
251
|
+
const remoteConfig = new Config({
|
|
252
|
+
runtime: {
|
|
253
|
+
services: {
|
|
254
|
+
ai: {
|
|
255
|
+
// TODO(burdon): 'url'?
|
|
256
|
+
server: remoteServiceEndpoints.ai,
|
|
257
|
+
},
|
|
258
|
+
edge: {
|
|
259
|
+
url: remoteServiceEndpoints.edge,
|
|
260
|
+
},
|
|
261
|
+
},
|
|
262
|
+
},
|
|
263
|
+
});
|
|
264
|
+
|
|
265
|
+
const getDecorators = ({
|
|
266
|
+
config,
|
|
267
|
+
plugins = [],
|
|
268
|
+
blueprints = [],
|
|
269
|
+
context = false,
|
|
270
|
+
}: {
|
|
271
|
+
config: Config;
|
|
272
|
+
plugins?: Plugin[];
|
|
273
|
+
blueprints?: Blueprint.Blueprint[];
|
|
274
|
+
context?: boolean;
|
|
275
|
+
}) => [
|
|
276
|
+
withPluginManager({
|
|
277
|
+
fireEvents: [Events.SetupArtifactDefinition],
|
|
278
|
+
plugins: [
|
|
279
|
+
ClientPlugin({
|
|
280
|
+
config,
|
|
281
|
+
types: [Assistant.Chat, DocumentType, Blueprint.Blueprint],
|
|
282
|
+
onClientInitialized: async (_, client) => {
|
|
283
|
+
await client.halo.createIdentity();
|
|
284
|
+
await client.spaces.waitUntilReady();
|
|
285
|
+
const space = client.spaces.default;
|
|
286
|
+
// ISSUE(burdon): Should not require this.
|
|
287
|
+
// ERROR: invariant violation: Database was not initialized with root object.
|
|
288
|
+
await space.waitUntilReady();
|
|
289
|
+
|
|
290
|
+
// TODO(burdon): Remove need for this boilerplate. Namespace for types?
|
|
291
|
+
const chat = space.db.add(
|
|
292
|
+
Obj.make(Assistant.Chat, {
|
|
293
|
+
queue: Ref.fromDXN(space.queues.create().dxn),
|
|
294
|
+
}),
|
|
295
|
+
);
|
|
296
|
+
const binder = new ContextBinder(await chat.queue.load());
|
|
297
|
+
|
|
298
|
+
const doc = space.db.add(
|
|
299
|
+
Obj.make(DocumentType, {
|
|
300
|
+
name: 'Tasks',
|
|
301
|
+
content: Ref.make(Obj.make(DataType.Text, { content: '' })),
|
|
302
|
+
}),
|
|
303
|
+
);
|
|
304
|
+
if (context) {
|
|
305
|
+
await binder.bind({ objects: [Ref.make(doc)] });
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
for (const blueprint of blueprints) {
|
|
309
|
+
// Clone blueprints and bind to conversation.
|
|
310
|
+
// TODO(dmaretskyi): This should be done by Obj.clone.
|
|
311
|
+
const { id: _id, ...data } = blueprint;
|
|
312
|
+
const obj = space.db.add(Obj.make(Blueprint.Blueprint, data));
|
|
313
|
+
await binder.bind({ blueprints: [Ref.make(obj)] });
|
|
314
|
+
}
|
|
315
|
+
},
|
|
316
|
+
}),
|
|
317
|
+
IntentPlugin(),
|
|
318
|
+
SettingsPlugin(),
|
|
319
|
+
SpacePlugin(),
|
|
320
|
+
|
|
321
|
+
TranscriptionPlugin(),
|
|
322
|
+
AssistantPlugin(),
|
|
323
|
+
|
|
324
|
+
...plugins,
|
|
325
|
+
],
|
|
326
|
+
capabilities: [contributes(Capabilities.Functions, [readDocument, writeDocument])],
|
|
327
|
+
}),
|
|
328
|
+
withTheme,
|
|
329
|
+
withLayout({
|
|
330
|
+
fullscreen: true,
|
|
331
|
+
classNames: 'bg-deckSurface justify-center',
|
|
332
|
+
}),
|
|
333
|
+
];
|
|
334
|
+
|
|
335
|
+
//
|
|
336
|
+
// Stories
|
|
337
|
+
//
|
|
338
|
+
|
|
339
|
+
export const Default = {
|
|
340
|
+
decorators: getDecorators({
|
|
341
|
+
config: remoteConfig,
|
|
342
|
+
}),
|
|
343
|
+
args: {
|
|
344
|
+
components: [ChatContainer],
|
|
345
|
+
},
|
|
346
|
+
} satisfies Story;
|
|
347
|
+
|
|
348
|
+
export const WithDocument = {
|
|
349
|
+
decorators: getDecorators({
|
|
350
|
+
config: remoteConfig,
|
|
351
|
+
plugins: [MarkdownPlugin()],
|
|
352
|
+
}),
|
|
353
|
+
args: {
|
|
354
|
+
components: [ChatContainer, DocumentContainer],
|
|
355
|
+
},
|
|
356
|
+
} satisfies Story;
|
|
357
|
+
|
|
358
|
+
export const WithBlueprints = {
|
|
359
|
+
decorators: getDecorators({
|
|
360
|
+
config: remoteConfig,
|
|
361
|
+
plugins: [ChessPlugin(), InboxPlugin(), MapPlugin(), MarkdownPlugin(), TablePlugin()],
|
|
362
|
+
blueprints: [TASK_BLUEPRINT],
|
|
363
|
+
context: true,
|
|
364
|
+
}),
|
|
365
|
+
args: {
|
|
366
|
+
components: [ChatContainer, [DocumentContainer, BlueprintContainer]],
|
|
367
|
+
},
|
|
368
|
+
} satisfies Story;
|
|
369
|
+
|
|
370
|
+
// export const WithArtifacts = {
|
|
371
|
+
// decorators: getDecorators({
|
|
372
|
+
// config: remoteConfig,
|
|
373
|
+
// plugins: [ChessPlugin(), InboxPlugin(), MapPlugin(), MarkdownPlugin(), TablePlugin()],
|
|
374
|
+
// }),
|
|
375
|
+
// args: {
|
|
376
|
+
// components: [ChatContainer],
|
|
377
|
+
// },
|
|
378
|
+
// } satisfies Story;
|
package/src/testing/index.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { DEFAULT_EDGE_MODEL, type GenerateRequest } from '@dxos/ai';
|
|
6
|
-
import { createSystemPrompt } from '@dxos/
|
|
6
|
+
import { createSystemPrompt } from '@dxos/assistant';
|
|
7
7
|
|
|
8
8
|
export const createProcessorOptions = (artifacts: string[]): Pick<GenerateRequest, 'model' | 'systemPrompt'> => ({
|
|
9
9
|
model: DEFAULT_EDGE_MODEL,
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { ToolId, ToolRegistry } from '@dxos/ai';
|
|
6
|
+
// import { createExaTool, createGraphWriterTool, createLocalSearchTool } from '@dxos/assistant';
|
|
7
|
+
import { type Space } from '@dxos/client/echo';
|
|
8
|
+
import { SequenceParser, type SequenceDefinition } from '@dxos/conductor';
|
|
9
|
+
import { type DXN } from '@dxos/keys';
|
|
10
|
+
import { isNonNullable } from '@dxos/util';
|
|
11
|
+
|
|
12
|
+
// TODO(dmaretskyi): make db available through services (same as function executor).
|
|
13
|
+
// TODO(burdon): Can tools implement "aspects" so that variants can be used rather than an explicit reference?
|
|
14
|
+
export const createToolRegistry = (space: Space, queueDxn?: DXN): ToolRegistry => {
|
|
15
|
+
return new ToolRegistry(
|
|
16
|
+
[
|
|
17
|
+
// createExaTool({ apiKey: EXA_API_KEY }),
|
|
18
|
+
// createLocalSearchTool(space.db, queueDxn && space.queues.get(queueDxn)),
|
|
19
|
+
// queueDxn &&
|
|
20
|
+
// createGraphWriterTool({
|
|
21
|
+
// db: space.db,
|
|
22
|
+
// queue: space.queues.get(queueDxn),
|
|
23
|
+
// schema: DataTypes,
|
|
24
|
+
// onDone: async (objects) => {
|
|
25
|
+
// const queue = space.queues.get(queueDxn);
|
|
26
|
+
// await queue.append(objects);
|
|
27
|
+
// },
|
|
28
|
+
// }),
|
|
29
|
+
].filter(isNonNullable),
|
|
30
|
+
);
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export const RESEARCH_SEQUENCE_DEFINITION: SequenceDefinition = {
|
|
34
|
+
steps: [
|
|
35
|
+
{
|
|
36
|
+
instructions: 'Research information and entities related to the selected objects.',
|
|
37
|
+
tools: [ToolId.make('search/web_search')],
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
instructions:
|
|
41
|
+
'Based on your research find matching entires that are already in the graph. Do exaustive research.',
|
|
42
|
+
tools: [ToolId.make('search/local_search')],
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
instructions: 'Add researched data to the graph. Make connections to existing objects.',
|
|
46
|
+
tools: [ToolId.make('search/local_search'), ToolId.make('graph/writer')],
|
|
47
|
+
},
|
|
48
|
+
],
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
export const RESEARCH_SEQUENCE = SequenceParser.create().parse(RESEARCH_SEQUENCE_DEFINITION);
|