@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,482 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import '@dxos-theme';
|
|
6
|
-
|
|
7
|
-
import { Rx } from '@effect-rx/rx-react';
|
|
8
|
-
import { type Meta, type StoryObj } from '@storybook/react';
|
|
9
|
-
import { Option, SchemaAST } from 'effect';
|
|
10
|
-
import React, { useCallback, useEffect, useMemo, useState } from 'react';
|
|
11
|
-
|
|
12
|
-
import { AgentStatusReport, EdgeAiServiceClient, createTool, type ExecutableTool, Message, ToolResult } from '@dxos/ai';
|
|
13
|
-
import { EXA_API_KEY, SpyAiService } from '@dxos/ai/testing';
|
|
14
|
-
import { Capabilities, contributes, createSurface, Events, Surface, useIntentDispatcher } from '@dxos/app-framework';
|
|
15
|
-
import { withPluginManager } from '@dxos/app-framework/testing';
|
|
16
|
-
import { localServiceEndpoints, remoteServiceEndpoints } from '@dxos/artifact-testing';
|
|
17
|
-
import { findRelatedSchema, researchFn, type RelatedSchema } from '@dxos/assistant';
|
|
18
|
-
import { raise } from '@dxos/debug';
|
|
19
|
-
import { Type, Filter, Obj, Relation } from '@dxos/echo';
|
|
20
|
-
import { ATTR_RELATION_SOURCE, ATTR_RELATION_TARGET } from '@dxos/echo-schema';
|
|
21
|
-
import { ConfiguredCredentialsService, FunctionExecutor, ServiceContainer, TracingService } from '@dxos/functions';
|
|
22
|
-
import { invariant } from '@dxos/invariant';
|
|
23
|
-
import { log } from '@dxos/log';
|
|
24
|
-
import { ForceGraph, useGraphModel } from '@dxos/plugin-explorer';
|
|
25
|
-
import { useClient } from '@dxos/react-client';
|
|
26
|
-
import { getSpace, useQuery, useQueue, type EchoDatabase, type Live } from '@dxos/react-client/echo';
|
|
27
|
-
import { IconButton, Input, Toolbar, useAsyncState } from '@dxos/react-ui';
|
|
28
|
-
import {
|
|
29
|
-
createMenuAction,
|
|
30
|
-
createMenuItemGroup,
|
|
31
|
-
rxFromSignal,
|
|
32
|
-
useMenuActions,
|
|
33
|
-
type ActionGraphProps,
|
|
34
|
-
MenuProvider,
|
|
35
|
-
ToolbarMenu,
|
|
36
|
-
type ToolbarMenuActionGroupProperties,
|
|
37
|
-
} from '@dxos/react-ui-menu';
|
|
38
|
-
import { SyntaxHighlighter } from '@dxos/react-ui-syntax-highlighter';
|
|
39
|
-
import { mx } from '@dxos/react-ui-theme';
|
|
40
|
-
import { DataTypes } from '@dxos/schema';
|
|
41
|
-
import { withLayout, withTheme } from '@dxos/storybook-utils';
|
|
42
|
-
|
|
43
|
-
import { testPlugins } from './testing';
|
|
44
|
-
import { Thread, type ThreadProps } from '../components';
|
|
45
|
-
import { ChatProcessor } from '../hooks';
|
|
46
|
-
import { createProcessorOptions } from '../testing';
|
|
47
|
-
import translations from '../translations';
|
|
48
|
-
|
|
49
|
-
const LOCAL = false;
|
|
50
|
-
const endpoints = LOCAL ? localServiceEndpoints : remoteServiceEndpoints;
|
|
51
|
-
|
|
52
|
-
type RenderProps = {
|
|
53
|
-
items?: Obj.Any[];
|
|
54
|
-
prompts?: string[];
|
|
55
|
-
} & Pick<ThreadProps, 'debug'>;
|
|
56
|
-
|
|
57
|
-
// TODO(burdon): Use ChatContainer.
|
|
58
|
-
const DefaultStory = ({ items: _items, prompts = [], ...props }: RenderProps) => {
|
|
59
|
-
const [, forceUpdate] = useState({});
|
|
60
|
-
|
|
61
|
-
const client = useClient();
|
|
62
|
-
const aiClient = useMemo(
|
|
63
|
-
() =>
|
|
64
|
-
new SpyAiService(
|
|
65
|
-
new EdgeAiServiceClient({
|
|
66
|
-
endpoint: endpoints.ai,
|
|
67
|
-
defaultGenerationOptions: {
|
|
68
|
-
// model: '@anthropic/claude-sonnet-4-20250514',
|
|
69
|
-
model: '@anthropic/claude-3-5-sonnet-20241022',
|
|
70
|
-
},
|
|
71
|
-
}),
|
|
72
|
-
),
|
|
73
|
-
[],
|
|
74
|
-
);
|
|
75
|
-
|
|
76
|
-
const space = client.spaces.default;
|
|
77
|
-
const model = useGraphModel(space);
|
|
78
|
-
|
|
79
|
-
const actionCreator = useMemo(() => createToolbar(aiClient), [aiClient]);
|
|
80
|
-
const menuProps = useMenuActions(actionCreator);
|
|
81
|
-
|
|
82
|
-
// Queue.
|
|
83
|
-
const [queueDxn, setQueueDxn] = useState<string>(() => space.queues.create().dxn.toString());
|
|
84
|
-
const queue = useQueue<Message>(Type.DXN.tryParse(queueDxn));
|
|
85
|
-
|
|
86
|
-
// Function executor.
|
|
87
|
-
const serviceContainer = useMemo(
|
|
88
|
-
() =>
|
|
89
|
-
new ServiceContainer().setServices({
|
|
90
|
-
ai: {
|
|
91
|
-
client: aiClient,
|
|
92
|
-
},
|
|
93
|
-
credentials: new ConfiguredCredentialsService([
|
|
94
|
-
{
|
|
95
|
-
service: 'exa.ai',
|
|
96
|
-
apiKey: EXA_API_KEY,
|
|
97
|
-
},
|
|
98
|
-
]),
|
|
99
|
-
queues: {
|
|
100
|
-
queues: space.queues,
|
|
101
|
-
contextQueue: queue,
|
|
102
|
-
},
|
|
103
|
-
database: {
|
|
104
|
-
db: space.db,
|
|
105
|
-
},
|
|
106
|
-
tracing: TracingService.console,
|
|
107
|
-
}),
|
|
108
|
-
[aiClient, space, queue],
|
|
109
|
-
);
|
|
110
|
-
|
|
111
|
-
const tools = useMemo<ExecutableTool[]>(() => [createResearchTool(serviceContainer, 'research', researchFn)], []);
|
|
112
|
-
|
|
113
|
-
const { dispatchPromise: dispatch } = useIntentDispatcher();
|
|
114
|
-
|
|
115
|
-
// TODO(burdon): Replace with useChatProcessor.
|
|
116
|
-
// const processor = useChatProcessor(space);
|
|
117
|
-
const processor = useMemo<ChatProcessor | undefined>(() => {
|
|
118
|
-
if (!space) {
|
|
119
|
-
return;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
return new ChatProcessor(
|
|
123
|
-
aiClient,
|
|
124
|
-
tools,
|
|
125
|
-
[],
|
|
126
|
-
{
|
|
127
|
-
space,
|
|
128
|
-
dispatch,
|
|
129
|
-
},
|
|
130
|
-
createProcessorOptions([]),
|
|
131
|
-
);
|
|
132
|
-
}, [aiClient, tools, space, dispatch]);
|
|
133
|
-
|
|
134
|
-
useEffect(() => {
|
|
135
|
-
if (queue?.objects.length === 0 && !queue.isLoading && prompts.length > 0) {
|
|
136
|
-
void queue.append([
|
|
137
|
-
Obj.make(Message, {
|
|
138
|
-
role: 'assistant',
|
|
139
|
-
content: prompts.map(
|
|
140
|
-
(prompt) =>
|
|
141
|
-
({
|
|
142
|
-
type: 'json',
|
|
143
|
-
disposition: 'suggest',
|
|
144
|
-
json: JSON.stringify({ text: prompt }),
|
|
145
|
-
}) as const,
|
|
146
|
-
),
|
|
147
|
-
}),
|
|
148
|
-
]);
|
|
149
|
-
}
|
|
150
|
-
}, [queueDxn, prompts, queue?.objects.length, queue?.isLoading]);
|
|
151
|
-
|
|
152
|
-
// State.
|
|
153
|
-
const objects = useQuery(space, Filter.or(...DataTypes.map((type) => Filter.type(type))));
|
|
154
|
-
const messages = [
|
|
155
|
-
...(queue?.objects.filter((item) => Obj.instanceOf(Message, item)) ?? []),
|
|
156
|
-
...(processor?.messages.value ?? []),
|
|
157
|
-
];
|
|
158
|
-
|
|
159
|
-
const handleSubmit = processor
|
|
160
|
-
? (message: string) => {
|
|
161
|
-
requestAnimationFrame(async () => {
|
|
162
|
-
invariant(processor);
|
|
163
|
-
if (processor.streaming.value) {
|
|
164
|
-
await processor.cancel();
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
// Make sure everything is indexed before agent starts processing.
|
|
168
|
-
await space.db.flush({ indexes: true });
|
|
169
|
-
|
|
170
|
-
invariant(queue);
|
|
171
|
-
await processor.request(message, {
|
|
172
|
-
history: queue.objects,
|
|
173
|
-
onComplete: (messages) => {
|
|
174
|
-
void queue.append(messages);
|
|
175
|
-
},
|
|
176
|
-
});
|
|
177
|
-
});
|
|
178
|
-
|
|
179
|
-
return true;
|
|
180
|
-
}
|
|
181
|
-
: undefined;
|
|
182
|
-
|
|
183
|
-
const handlePrompt = useCallback(
|
|
184
|
-
(text: string) => {
|
|
185
|
-
void handleSubmit?.(text);
|
|
186
|
-
},
|
|
187
|
-
[handleSubmit],
|
|
188
|
-
);
|
|
189
|
-
|
|
190
|
-
const handleDelete = useCallback(
|
|
191
|
-
(id: string) => {
|
|
192
|
-
invariant(Type.ObjectId.isValid(id), 'Invalid message id');
|
|
193
|
-
void queue?.delete([id]);
|
|
194
|
-
},
|
|
195
|
-
[queue],
|
|
196
|
-
);
|
|
197
|
-
|
|
198
|
-
// TODO(dmaretskyi): Pull in relations automatically.
|
|
199
|
-
const handleAddToGraph = useCallback(async (object: Obj.Any) => {
|
|
200
|
-
space.db.add(instantiate(space.db, object));
|
|
201
|
-
await space.db.flush({ indexes: true });
|
|
202
|
-
forceUpdate({});
|
|
203
|
-
}, []);
|
|
204
|
-
|
|
205
|
-
const handleResearchMore = useCallback((object: Obj.Any | Relation.Any, relatedSchema: RelatedSchema) => {
|
|
206
|
-
const prompt = `
|
|
207
|
-
Research more about objects related to the object in terms of the by the specific relation schema:
|
|
208
|
-
<object>${JSON.stringify(object, null, 2)}</object>
|
|
209
|
-
<schema>
|
|
210
|
-
<description>${SchemaAST.getDescriptionAnnotation(relatedSchema.schema.ast).pipe(Option.getOrElse(() => ''))}</description>
|
|
211
|
-
<json>
|
|
212
|
-
${JSON.stringify(Type.toJsonSchema(relatedSchema.schema), null, 2)}
|
|
213
|
-
</json>
|
|
214
|
-
</schema>
|
|
215
|
-
`;
|
|
216
|
-
|
|
217
|
-
handlePrompt(prompt);
|
|
218
|
-
}, []);
|
|
219
|
-
|
|
220
|
-
return (
|
|
221
|
-
<div className={mx('grid w-full h-full grid-cols-3 overflow-hidden divide-x divide-separator')}>
|
|
222
|
-
{/* Thread */}
|
|
223
|
-
<div className='flex flex-col h-full gap-4 outline outline-separator overflow-hidden'>
|
|
224
|
-
{/* TODO(wittjosiah): Use react-ui-menu toolbar. */}
|
|
225
|
-
<Toolbar.Root classNames='p-2'>
|
|
226
|
-
<Input.Root>
|
|
227
|
-
<Input.TextInput
|
|
228
|
-
spellCheck={false}
|
|
229
|
-
placeholder='Queue DXN'
|
|
230
|
-
value={queueDxn}
|
|
231
|
-
onChange={(ev) => setQueueDxn(ev.target.value)}
|
|
232
|
-
/>
|
|
233
|
-
<IconButton
|
|
234
|
-
iconOnly
|
|
235
|
-
label='Copy DXN'
|
|
236
|
-
icon='ph--copy--regular'
|
|
237
|
-
onClick={() => navigator.clipboard.writeText(queueDxn)}
|
|
238
|
-
/>
|
|
239
|
-
<IconButton
|
|
240
|
-
iconOnly
|
|
241
|
-
label='Clear history'
|
|
242
|
-
icon='ph--trash--regular'
|
|
243
|
-
onClick={() => setQueueDxn(space.queues.create().dxn.toString())}
|
|
244
|
-
/>
|
|
245
|
-
<IconButton iconOnly label='Stop' icon='ph--stop--regular' onClick={() => processor?.cancel()} />
|
|
246
|
-
</Input.Root>
|
|
247
|
-
</Toolbar.Root>
|
|
248
|
-
|
|
249
|
-
{/* TODO(burdon): Replace with ThreadContainer. */}
|
|
250
|
-
<Thread
|
|
251
|
-
messages={messages}
|
|
252
|
-
processing={processor?.streaming.value}
|
|
253
|
-
error={processor?.error.value}
|
|
254
|
-
tools={processor?.tools}
|
|
255
|
-
onSubmit={processor ? handleSubmit : undefined}
|
|
256
|
-
onPrompt={processor ? handlePrompt : undefined}
|
|
257
|
-
onDelete={processor ? handleDelete : undefined}
|
|
258
|
-
onAddToGraph={handleAddToGraph}
|
|
259
|
-
{...props}
|
|
260
|
-
/>
|
|
261
|
-
</div>
|
|
262
|
-
|
|
263
|
-
{/* TODO(burdon): Filter/query. */}
|
|
264
|
-
<ForceGraph model={model} />
|
|
265
|
-
|
|
266
|
-
{/* Artifacts Deck */}
|
|
267
|
-
<div className='flex flex-col overflow-y-auto'>
|
|
268
|
-
{/* TODO(wittjosiah): Combine with thread toolbar. */}
|
|
269
|
-
<MenuProvider {...menuProps}>
|
|
270
|
-
<ToolbarMenu />
|
|
271
|
-
</MenuProvider>
|
|
272
|
-
{objects.map((object) => (
|
|
273
|
-
<div
|
|
274
|
-
key={object.id}
|
|
275
|
-
className={mx('flex flex-col border border-separator rounded m-2 mb-0 hover:bg-hoverSurface')}
|
|
276
|
-
>
|
|
277
|
-
<div className='px-2 text-xs text-foreground-secondary'>{object.id}</div>
|
|
278
|
-
<Surface
|
|
279
|
-
role='card'
|
|
280
|
-
limit={1}
|
|
281
|
-
data={{ subject: object }}
|
|
282
|
-
fallback={
|
|
283
|
-
<SyntaxHighlighter language='json' className='text-xs'>
|
|
284
|
-
{JSON.stringify(object, null, 2)}
|
|
285
|
-
</SyntaxHighlighter>
|
|
286
|
-
}
|
|
287
|
-
/>
|
|
288
|
-
<ResearchPrompts object={object} onResearch={handleResearchMore} />
|
|
289
|
-
</div>
|
|
290
|
-
))}
|
|
291
|
-
</div>
|
|
292
|
-
</div>
|
|
293
|
-
);
|
|
294
|
-
};
|
|
295
|
-
|
|
296
|
-
type ResearchPromptsProps = {
|
|
297
|
-
object: Obj.Any | Relation.Any;
|
|
298
|
-
onResearch: (object: Obj.Any | Relation.Any, relatedSchema: RelatedSchema) => void;
|
|
299
|
-
};
|
|
300
|
-
|
|
301
|
-
const ResearchPrompts = ({ object, onResearch }: ResearchPromptsProps) => {
|
|
302
|
-
const [relatedSchemas = []] = useAsyncState(
|
|
303
|
-
async () => findRelatedSchema(getSpace(object)!.db, Obj.getSchema(object)!),
|
|
304
|
-
[object],
|
|
305
|
-
);
|
|
306
|
-
return (
|
|
307
|
-
<div>
|
|
308
|
-
{relatedSchemas.map((schema) => (
|
|
309
|
-
<button
|
|
310
|
-
key={Type.getDXN(schema.schema)?.toString()}
|
|
311
|
-
onClick={() => onResearch(object, schema)}
|
|
312
|
-
className='border border-separator rounded px-2 py-1 m-1'
|
|
313
|
-
>
|
|
314
|
-
Research more of {Type.getTypename(schema.schema)}
|
|
315
|
-
</button>
|
|
316
|
-
))}
|
|
317
|
-
</div>
|
|
318
|
-
);
|
|
319
|
-
};
|
|
320
|
-
|
|
321
|
-
const createResearchTool = (serviceContainer: ServiceContainer, name: string, fn: typeof researchFn) => {
|
|
322
|
-
return createTool('example', {
|
|
323
|
-
name,
|
|
324
|
-
description: fn.description ?? raise(new Error('No description')),
|
|
325
|
-
schema: fn.inputSchema,
|
|
326
|
-
execute: async (input, { reportStatus }) => {
|
|
327
|
-
const executor = new FunctionExecutor(
|
|
328
|
-
serviceContainer.clone().setServices({
|
|
329
|
-
tracing: {
|
|
330
|
-
write: (event) => {
|
|
331
|
-
if (Obj.instanceOf(AgentStatusReport, event)) {
|
|
332
|
-
log.info('[too] report status', { status: event });
|
|
333
|
-
reportStatus?.(event);
|
|
334
|
-
}
|
|
335
|
-
},
|
|
336
|
-
},
|
|
337
|
-
}),
|
|
338
|
-
);
|
|
339
|
-
|
|
340
|
-
reportStatus?.(
|
|
341
|
-
Obj.make(AgentStatusReport, {
|
|
342
|
-
message: 'Researching...',
|
|
343
|
-
}),
|
|
344
|
-
);
|
|
345
|
-
|
|
346
|
-
await new Promise((resolve) => setTimeout(resolve, 1000));
|
|
347
|
-
|
|
348
|
-
const { result } = await executor.invoke(fn, input);
|
|
349
|
-
return ToolResult.Success(
|
|
350
|
-
'Research completed. The results are placed in the conversation and already presented to the user. No need to present them again.',
|
|
351
|
-
result.objects.map((obj: any) => ({
|
|
352
|
-
type: 'json',
|
|
353
|
-
json: JSON.stringify(obj),
|
|
354
|
-
disposition: 'graph',
|
|
355
|
-
})),
|
|
356
|
-
);
|
|
357
|
-
},
|
|
358
|
-
});
|
|
359
|
-
};
|
|
360
|
-
|
|
361
|
-
/**
|
|
362
|
-
* Instantiate an object from it's JSON representation.
|
|
363
|
-
* Resolves schema and relation references.
|
|
364
|
-
*
|
|
365
|
-
* @param db - The database to use for reference lookup.
|
|
366
|
-
* @param object - The object in JSON format to instantiate.
|
|
367
|
-
*/
|
|
368
|
-
// TODO(dmaretskyi): Move into core.
|
|
369
|
-
const instantiate = (db: EchoDatabase, object: unknown): Live<any> => {
|
|
370
|
-
const schema =
|
|
371
|
-
db.graph.schemaRegistry.getSchemaByDXN(Type.DXN.parse(Obj.getTypename(object as any)!)) ??
|
|
372
|
-
raise(new Error('Schema not found'));
|
|
373
|
-
|
|
374
|
-
let { id, [ATTR_RELATION_SOURCE]: source, [ATTR_RELATION_TARGET]: target, ...props } = object as any;
|
|
375
|
-
if (source) {
|
|
376
|
-
source = db.getObjectById(Type.DXN.parse(source).asEchoDXN()!.echoId) ?? raise(new Error('Source not found'));
|
|
377
|
-
}
|
|
378
|
-
if (target) {
|
|
379
|
-
target = db.getObjectById(Type.DXN.parse(target).asEchoDXN()!.echoId) ?? raise(new Error('Target not found'));
|
|
380
|
-
}
|
|
381
|
-
|
|
382
|
-
return Relation.make(schema, {
|
|
383
|
-
id,
|
|
384
|
-
[Relation.Source]: source,
|
|
385
|
-
[Relation.Target]: target,
|
|
386
|
-
...props,
|
|
387
|
-
});
|
|
388
|
-
};
|
|
389
|
-
|
|
390
|
-
const createToolbar = (aiClient: SpyAiService) =>
|
|
391
|
-
Rx.make((get) => {
|
|
392
|
-
const result: ActionGraphProps = { nodes: [], edges: [] };
|
|
393
|
-
const save = createMenuAction('save', () => aiClient.saveEvents(), {
|
|
394
|
-
label: 'Save events',
|
|
395
|
-
icon: 'ph--floppy-disk--regular',
|
|
396
|
-
});
|
|
397
|
-
const load = createMenuAction('load', () => aiClient.loadEvents(), {
|
|
398
|
-
label: 'Load events',
|
|
399
|
-
icon: 'ph--folder-open--regular',
|
|
400
|
-
});
|
|
401
|
-
const modes = createMenuItemGroup('mode', {
|
|
402
|
-
variant: 'dropdownMenu',
|
|
403
|
-
applyActive: true,
|
|
404
|
-
selectCardinality: 'single',
|
|
405
|
-
value: get(rxFromSignal(() => aiClient.mode)),
|
|
406
|
-
} as ToolbarMenuActionGroupProperties);
|
|
407
|
-
const spy = createMenuAction('spy', () => aiClient.setMode('spy'), {
|
|
408
|
-
label: 'Spy',
|
|
409
|
-
icon: 'ph--detective--regular',
|
|
410
|
-
checked: get(rxFromSignal(() => aiClient.mode === 'spy')),
|
|
411
|
-
});
|
|
412
|
-
const mock = createMenuAction('mock', () => aiClient.setMode('mock'), {
|
|
413
|
-
label: 'Mock',
|
|
414
|
-
icon: 'ph--rewind--regular',
|
|
415
|
-
checked: get(rxFromSignal(() => aiClient.mode === 'mock')),
|
|
416
|
-
});
|
|
417
|
-
result.nodes.push(save, load, modes, spy, mock);
|
|
418
|
-
result.edges.push(
|
|
419
|
-
{ source: 'root', target: save.id },
|
|
420
|
-
{ source: 'root', target: load.id },
|
|
421
|
-
{ source: 'root', target: modes.id },
|
|
422
|
-
{ source: modes.id, target: spy.id },
|
|
423
|
-
{ source: modes.id, target: mock.id },
|
|
424
|
-
);
|
|
425
|
-
return result;
|
|
426
|
-
});
|
|
427
|
-
|
|
428
|
-
const meta: Meta<typeof DefaultStory> = {
|
|
429
|
-
title: 'plugins/plugin-assistant/Research',
|
|
430
|
-
render: DefaultStory,
|
|
431
|
-
decorators: [
|
|
432
|
-
withPluginManager({
|
|
433
|
-
plugins: testPlugins({
|
|
434
|
-
config: {
|
|
435
|
-
runtime: {
|
|
436
|
-
client: {
|
|
437
|
-
storage: {
|
|
438
|
-
persistent: true,
|
|
439
|
-
},
|
|
440
|
-
enableVectorIndexing: true,
|
|
441
|
-
},
|
|
442
|
-
},
|
|
443
|
-
},
|
|
444
|
-
}),
|
|
445
|
-
capabilities: [
|
|
446
|
-
contributes(
|
|
447
|
-
Capabilities.ReactSurface,
|
|
448
|
-
createSurface({
|
|
449
|
-
id: 'test',
|
|
450
|
-
role: 'card',
|
|
451
|
-
position: 'fallback',
|
|
452
|
-
component: ({ data }) => (
|
|
453
|
-
<span className='text-xs whitespace-pre-wrap'>{JSON.stringify(data.subject, null, 2)}</span>
|
|
454
|
-
),
|
|
455
|
-
}),
|
|
456
|
-
),
|
|
457
|
-
],
|
|
458
|
-
fireEvents: [Events.SetupArtifactDefinition],
|
|
459
|
-
}),
|
|
460
|
-
withTheme,
|
|
461
|
-
withLayout({ fullscreen: true }),
|
|
462
|
-
],
|
|
463
|
-
parameters: {
|
|
464
|
-
translations,
|
|
465
|
-
controls: { disable: true },
|
|
466
|
-
},
|
|
467
|
-
};
|
|
468
|
-
|
|
469
|
-
export default meta;
|
|
470
|
-
|
|
471
|
-
type Story = StoryObj<typeof DefaultStory>;
|
|
472
|
-
|
|
473
|
-
export const Default: Story = {
|
|
474
|
-
args: {
|
|
475
|
-
debug: true,
|
|
476
|
-
prompts: [
|
|
477
|
-
//
|
|
478
|
-
'Research companies in the area of personal knowledge management and AI',
|
|
479
|
-
'Who founded Notion?',
|
|
480
|
-
],
|
|
481
|
-
},
|
|
482
|
-
};
|
package/src/stories/test-data.ts
DELETED
|
@@ -1,128 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { type Live, type Space } from '@dxos/client/echo';
|
|
6
|
-
import { Obj, Type, Relation } from '@dxos/echo';
|
|
7
|
-
import { invariant } from '@dxos/invariant';
|
|
8
|
-
import { DataType } from '@dxos/schema';
|
|
9
|
-
|
|
10
|
-
const organizations: (Type.Properties<DataType.Organization> & { id: string })[] = [
|
|
11
|
-
{ id: 'dxos', name: 'DXOS', website: 'https://dxos.org' },
|
|
12
|
-
{ id: 'socket_supply', name: 'Socket Supply', website: 'https://socketsupply.com' },
|
|
13
|
-
{ id: 'ink_and_switch', name: 'Ink & Switch', website: 'https://inkandswitch.com' },
|
|
14
|
-
{ id: 'effectful', name: 'Effectful', website: 'https://effect.co' },
|
|
15
|
-
{ id: 'blueyard', name: 'Blue Yard', website: 'https://blueyard.com' },
|
|
16
|
-
{ id: 'backed', name: 'Backed', website: 'https://backed.vc' },
|
|
17
|
-
{ id: 'protocol_labs', name: 'Protocol Labs', website: 'https://protocol.ai' },
|
|
18
|
-
{ id: 'newlab', name: 'Newlab', website: 'https://newlab.com' },
|
|
19
|
-
{ id: 'google', name: 'Google', website: 'https://google.com' },
|
|
20
|
-
{ id: 'microsoft', name: 'Microsoft', website: 'https://microsoft.com' },
|
|
21
|
-
{ id: 'openai', name: 'OpenAI', website: 'https://openai.com' },
|
|
22
|
-
{ id: 'anthropic', name: 'Anthropic', website: 'https://anthropic.com' },
|
|
23
|
-
{ id: 'amazon', name: 'Amazon', website: 'https://amazon.com' },
|
|
24
|
-
{ id: 'deshaw', name: 'D. E. Shaw & Co.', website: 'https://deshaw.com' },
|
|
25
|
-
];
|
|
26
|
-
|
|
27
|
-
const people: (Type.Properties<DataType.Person> & { id: string })[] = [
|
|
28
|
-
{ id: 'rich_burdon', fullName: 'Rich Burdon' },
|
|
29
|
-
{ id: 'josiah_witt', fullName: 'Josiah Witt' },
|
|
30
|
-
{ id: 'dima_dmaretskyi', fullName: 'Dima Maretskyi' },
|
|
31
|
-
{ id: 'chad_fowler', fullName: 'Chad Fowler' },
|
|
32
|
-
{ id: 'ciaran_oleary', fullName: "Ciarán O'Leary" },
|
|
33
|
-
{ id: 'jason_whitmire', fullName: 'Jason Whitmire' },
|
|
34
|
-
{ id: 'alex_brunicki', fullName: 'Alex Brunicki' },
|
|
35
|
-
{ id: 'andre_de_haes', fullName: 'Andre de Haes' },
|
|
36
|
-
{ id: 'scott_cohen', fullName: 'Scott Cohen' },
|
|
37
|
-
{ id: 'juan_benet', fullName: 'Juan Benet' },
|
|
38
|
-
{ id: 'satya_nadella', fullName: 'Satya Nadella' },
|
|
39
|
-
{ id: 'kevin_scott', fullName: 'Kevin Scott' },
|
|
40
|
-
{ id: 'jeff_bezos', fullName: 'Jeff Bezos' },
|
|
41
|
-
];
|
|
42
|
-
|
|
43
|
-
const testObjects: Record<string, any[]> = {
|
|
44
|
-
[Type.getTypename(DataType.Organization)!]: organizations,
|
|
45
|
-
[Type.getTypename(DataType.Person)!]: people,
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
const testRelationships: Record<
|
|
49
|
-
string,
|
|
50
|
-
({
|
|
51
|
-
source: string;
|
|
52
|
-
target: string;
|
|
53
|
-
} & Record<string, any>)[]
|
|
54
|
-
> = {
|
|
55
|
-
[Type.getTypename(DataType.Employer)!]: [
|
|
56
|
-
// @eslint-disable-next-line
|
|
57
|
-
{ source: 'rich_burdon', target: 'dxos' },
|
|
58
|
-
{ source: 'rich_burdon', target: 'google', active: false }, // TODO(burdon): Should not contribute to force.
|
|
59
|
-
{ source: 'rich_burdon', target: 'deshaw', active: false },
|
|
60
|
-
{ source: 'josiah_witt', target: 'dxos' },
|
|
61
|
-
{ source: 'dima_dmaretskyi', target: 'dxos' },
|
|
62
|
-
{ source: 'chad_fowler', target: 'blueyard' },
|
|
63
|
-
{ source: 'chad_fowler', target: 'microsoft', active: false },
|
|
64
|
-
{ source: 'ciaran_oleary', target: 'blueyard' },
|
|
65
|
-
{ source: 'jason_whitmire', target: 'blueyard' },
|
|
66
|
-
{ source: 'juan_benet', target: 'protocol_labs' },
|
|
67
|
-
{ source: 'alex_brunicki', target: 'backed' },
|
|
68
|
-
{ source: 'andre_de_haes', target: 'backed' },
|
|
69
|
-
{ source: 'scott_cohen', target: 'newlab' },
|
|
70
|
-
{ source: 'satya_nadella', target: 'microsoft' },
|
|
71
|
-
{ source: 'kevin_scott', target: 'microsoft' },
|
|
72
|
-
{ source: 'kevin_scott', target: 'google', active: false },
|
|
73
|
-
{ source: 'jeff_bezos', target: 'amazon' },
|
|
74
|
-
{ source: 'jeff_bezos', target: 'deshaw', active: false },
|
|
75
|
-
],
|
|
76
|
-
|
|
77
|
-
// TODO(burdon): Limit graph view to selected relationship types.
|
|
78
|
-
[Type.getTypename(DataType.HasConnection)!]: [
|
|
79
|
-
//
|
|
80
|
-
{ kind: 'partner', source: 'dxos', target: 'ink_and_switch' },
|
|
81
|
-
{ kind: 'partner', source: 'dxos', target: 'effectful' },
|
|
82
|
-
{ kind: 'partner', source: 'dxos', target: 'socket_supply' },
|
|
83
|
-
|
|
84
|
-
//
|
|
85
|
-
{ kind: 'investor', source: 'blueyard', target: 'dxos' },
|
|
86
|
-
{ kind: 'investor', source: 'blueyard', target: 'protocol_labs' },
|
|
87
|
-
{ kind: 'investor', source: 'protocol_labs', target: 'dxos' },
|
|
88
|
-
{ kind: 'investor', source: 'backed', target: 'dxos' },
|
|
89
|
-
{ kind: 'investor', source: 'newlab', target: 'dxos' },
|
|
90
|
-
{ kind: 'investor', source: 'microsoft', target: 'openai' },
|
|
91
|
-
{ kind: 'investor', source: 'google', target: 'anthropic' },
|
|
92
|
-
{ kind: 'investor', source: 'amazon', target: 'anthropic' },
|
|
93
|
-
],
|
|
94
|
-
};
|
|
95
|
-
|
|
96
|
-
export const addTestData = async (space: Space): Promise<void> => {
|
|
97
|
-
const objectMap = new Map<string, Live<any>>();
|
|
98
|
-
|
|
99
|
-
for (const [typename, objects] of Object.entries(testObjects)) {
|
|
100
|
-
const schema = space.db.graph.schemaRegistry.getSchema(typename);
|
|
101
|
-
invariant(schema, `Schema not found: ${typename}`);
|
|
102
|
-
for (const { id, ...data } of objects) {
|
|
103
|
-
const object = space.db.add(Obj.make(schema, data));
|
|
104
|
-
objectMap.set(id, object);
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
for (const [typename, relationships] of Object.entries(testRelationships)) {
|
|
109
|
-
const schema = space.db.graph.schemaRegistry.getSchema(typename);
|
|
110
|
-
invariant(schema, `Schema not found: ${typename}`);
|
|
111
|
-
|
|
112
|
-
for (const { source, target, ...data } of relationships) {
|
|
113
|
-
const sourceObject = objectMap.get(source);
|
|
114
|
-
const targetObject = objectMap.get(target);
|
|
115
|
-
invariant(sourceObject, `Source object not found: ${source}`);
|
|
116
|
-
invariant(targetObject, `Target object not found: ${target}`);
|
|
117
|
-
|
|
118
|
-
space.db.add(
|
|
119
|
-
Relation.make(schema, {
|
|
120
|
-
// TODO(burdon): Test source/target types match.
|
|
121
|
-
[Relation.Source]: sourceObject,
|
|
122
|
-
[Relation.Target]: targetObject,
|
|
123
|
-
...data,
|
|
124
|
-
}),
|
|
125
|
-
);
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
};
|
package/src/stories/testing.ts
DELETED
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import '@dxos-theme';
|
|
6
|
-
|
|
7
|
-
import { type Schema } from 'effect';
|
|
8
|
-
import defaulstDeep from 'lodash.defaultsdeep';
|
|
9
|
-
|
|
10
|
-
import { IntentPlugin, SettingsPlugin } from '@dxos/app-framework';
|
|
11
|
-
import { type ConfigProto } from '@dxos/config';
|
|
12
|
-
import { ChessPlugin } from '@dxos/plugin-chess';
|
|
13
|
-
import { ClientPlugin } from '@dxos/plugin-client';
|
|
14
|
-
import { InboxPlugin } from '@dxos/plugin-inbox';
|
|
15
|
-
import { MapPlugin } from '@dxos/plugin-map';
|
|
16
|
-
import { PreviewPlugin } from '@dxos/plugin-preview';
|
|
17
|
-
import { SpacePlugin } from '@dxos/plugin-space';
|
|
18
|
-
import { TablePlugin } from '@dxos/plugin-table';
|
|
19
|
-
import { type IndexConfig } from '@dxos/protocols/proto/dxos/echo/indexing';
|
|
20
|
-
import { Config } from '@dxos/react-client';
|
|
21
|
-
import { DataTypes } from '@dxos/schema';
|
|
22
|
-
|
|
23
|
-
type TestPluginsOptions = { config?: ConfigProto; types?: Schema.Schema.AnyNoContext[]; indexConfig?: IndexConfig };
|
|
24
|
-
|
|
25
|
-
export const testPlugins = ({ config, types = DataTypes, indexConfig }: TestPluginsOptions = {}) => [
|
|
26
|
-
ClientPlugin({
|
|
27
|
-
config: new Config(
|
|
28
|
-
defaulstDeep({}, config, {
|
|
29
|
-
runtime: {
|
|
30
|
-
services: {
|
|
31
|
-
edge: {
|
|
32
|
-
url: 'http://edge-main.dxos.workers.dev',
|
|
33
|
-
},
|
|
34
|
-
},
|
|
35
|
-
},
|
|
36
|
-
}),
|
|
37
|
-
),
|
|
38
|
-
types,
|
|
39
|
-
onClientInitialized: async (_, client) => {
|
|
40
|
-
if (!client.halo.identity.get()) {
|
|
41
|
-
await client.halo.createIdentity();
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
if (indexConfig) {
|
|
45
|
-
// TODO(burdon): Rename services.services?
|
|
46
|
-
await client.services.services.QueryService!.setConfig(indexConfig);
|
|
47
|
-
}
|
|
48
|
-
},
|
|
49
|
-
}),
|
|
50
|
-
SpacePlugin(),
|
|
51
|
-
SettingsPlugin(),
|
|
52
|
-
IntentPlugin(),
|
|
53
|
-
|
|
54
|
-
// Artifacts.
|
|
55
|
-
ChessPlugin(),
|
|
56
|
-
InboxPlugin(),
|
|
57
|
-
MapPlugin(),
|
|
58
|
-
TablePlugin(),
|
|
59
|
-
PreviewPlugin(),
|
|
60
|
-
];
|