@dxos/plugin-assistant 0.8.2-staging.7ac8446 → 0.8.2
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/AssistantDialog-K6POM23O.mjs +46 -0
- package/dist/lib/browser/AssistantDialog-K6POM23O.mjs.map +7 -0
- package/dist/lib/browser/ChatContainer-QTO4LE2C.mjs +39 -0
- package/dist/lib/browser/ChatContainer-QTO4LE2C.mjs.map +7 -0
- package/dist/lib/browser/TemplateContainer-AKUYL4AV.mjs +28 -0
- package/dist/lib/browser/TemplateContainer-AKUYL4AV.mjs.map +7 -0
- package/dist/lib/browser/{ai-client-CDZLSNXE.mjs → ai-client-COXVUC6V.mjs} +6 -6
- package/dist/lib/browser/ai-client-COXVUC6V.mjs.map +7 -0
- package/dist/lib/browser/app-graph-builder-YH4EGNBC.mjs +206 -0
- package/dist/lib/browser/app-graph-builder-YH4EGNBC.mjs.map +7 -0
- package/dist/lib/browser/{chunk-TXJWGWJ7.mjs → chunk-3F44MBHU.mjs} +3 -3
- package/dist/lib/browser/chunk-3F44MBHU.mjs.map +7 -0
- package/dist/lib/browser/chunk-IHEBFO5O.mjs +205 -0
- package/dist/lib/browser/chunk-IHEBFO5O.mjs.map +7 -0
- package/dist/lib/browser/chunk-JQFUME3B.mjs +87 -0
- package/dist/lib/{node-esm/chunk-PBZA7XJR.mjs.map → browser/chunk-JQFUME3B.mjs.map} +1 -1
- package/dist/lib/browser/chunk-Q6UZ4F3H.mjs +96 -0
- package/dist/lib/browser/chunk-Q6UZ4F3H.mjs.map +7 -0
- package/dist/lib/browser/{chunk-FMB7RGMP.mjs → chunk-QTW7KVDO.mjs} +1669 -1515
- package/dist/lib/browser/chunk-QTW7KVDO.mjs.map +7 -0
- package/dist/lib/browser/chunk-USJBRB3H.mjs +155 -0
- package/dist/lib/browser/chunk-USJBRB3H.mjs.map +7 -0
- package/dist/lib/browser/{chunk-3HCI5FIL.mjs → chunk-XOZ7YMO3.mjs} +3 -3
- package/dist/lib/browser/{chunk-3HCI5FIL.mjs.map → chunk-XOZ7YMO3.mjs.map} +1 -1
- package/dist/lib/browser/index.mjs +35 -18
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/{intent-resolver-WJGLKKVO.mjs → intent-resolver-63EAHENI.mjs} +10 -14
- package/dist/lib/browser/intent-resolver-63EAHENI.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/react-surface-XCV6NR75.mjs +131 -0
- package/dist/lib/browser/react-surface-XCV6NR75.mjs.map +7 -0
- package/dist/lib/browser/{settings-U6UFQX32.mjs → settings-SHNQ4XXP.mjs} +5 -5
- package/dist/lib/browser/settings-SHNQ4XXP.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +6 -2
- package/dist/lib/node/AssistantDialog-FDATKYE5.cjs +72 -0
- package/dist/lib/node/AssistantDialog-FDATKYE5.cjs.map +7 -0
- package/dist/lib/node/{ChatContainer-ZJ5JXF6A.cjs → ChatContainer-5CLHJOIQ.cjs} +25 -19
- package/dist/lib/node/ChatContainer-5CLHJOIQ.cjs.map +7 -0
- package/dist/lib/node/TemplateContainer-CTG2MB4W.cjs +58 -0
- package/dist/lib/node/TemplateContainer-CTG2MB4W.cjs.map +7 -0
- package/dist/lib/node/{ai-client-URCCYU6B.cjs → ai-client-R2CGEYZW.cjs} +13 -13
- package/dist/lib/node/ai-client-R2CGEYZW.cjs.map +7 -0
- package/dist/lib/node/app-graph-builder-PSHIOW3Q.cjs +216 -0
- package/dist/lib/node/app-graph-builder-PSHIOW3Q.cjs.map +7 -0
- package/dist/lib/node/{chunk-XI2ARIEO.cjs → chunk-4EEWTDQK.cjs} +45 -39
- package/dist/lib/node/{chunk-XI2ARIEO.cjs.map → chunk-4EEWTDQK.cjs.map} +1 -1
- package/dist/lib/node/chunk-FLJWJ35M.cjs +181 -0
- package/dist/lib/node/chunk-FLJWJ35M.cjs.map +7 -0
- package/dist/lib/node/{chunk-RPBKMP2E.cjs → chunk-H4A42LNR.cjs} +1504 -1343
- package/dist/lib/node/chunk-H4A42LNR.cjs.map +7 -0
- package/dist/lib/node/chunk-HRNIUYVQ.cjs +128 -0
- package/dist/lib/node/chunk-HRNIUYVQ.cjs.map +7 -0
- package/dist/lib/node/{chunk-Q5XWEMHB.cjs → chunk-P74TWGMG.cjs} +6 -6
- package/dist/lib/node/{chunk-Q5XWEMHB.cjs.map → chunk-P74TWGMG.cjs.map} +1 -1
- package/dist/lib/node/chunk-RXPA2C2A.cjs +230 -0
- package/dist/lib/node/chunk-RXPA2C2A.cjs.map +7 -0
- package/dist/lib/node/{chunk-GBUNQ257.cjs → chunk-TS3H5OSX.cjs} +7 -7
- package/dist/lib/node/chunk-TS3H5OSX.cjs.map +7 -0
- package/dist/lib/node/index.cjs +79 -63
- package/dist/lib/node/index.cjs.map +3 -3
- package/dist/lib/node/{intent-resolver-R3OSTIMH.cjs → intent-resolver-66F7WLW6.cjs} +13 -17
- package/dist/lib/node/intent-resolver-66F7WLW6.cjs.map +7 -0
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/react-surface-TASAPRPQ.cjs +145 -0
- package/dist/lib/node/react-surface-TASAPRPQ.cjs.map +7 -0
- package/dist/lib/node/{settings-TXGRCYAL.cjs → settings-ERKLO6IO.cjs} +9 -9
- package/dist/lib/node/settings-ERKLO6IO.cjs.map +7 -0
- package/dist/lib/node/types/index.cjs +17 -13
- package/dist/lib/node/types/index.cjs.map +2 -2
- package/dist/lib/node-esm/AssistantDialog-PIMYK774.mjs +47 -0
- package/dist/lib/node-esm/AssistantDialog-PIMYK774.mjs.map +7 -0
- package/dist/lib/node-esm/ChatContainer-QTC5NYE2.mjs +40 -0
- package/dist/lib/node-esm/ChatContainer-QTC5NYE2.mjs.map +7 -0
- package/dist/lib/node-esm/TemplateContainer-IVDQ4XQG.mjs +29 -0
- package/dist/lib/node-esm/TemplateContainer-IVDQ4XQG.mjs.map +7 -0
- package/dist/lib/node-esm/{ai-client-WMHS5EGV.mjs → ai-client-I5LXHMOZ.mjs} +6 -6
- package/dist/lib/node-esm/ai-client-I5LXHMOZ.mjs.map +7 -0
- package/dist/lib/node-esm/app-graph-builder-Z3GMMJMD.mjs +207 -0
- package/dist/lib/node-esm/app-graph-builder-Z3GMMJMD.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-ECRK6TUQ.mjs → chunk-BB2TAT4P.mjs} +3 -3
- package/dist/lib/node-esm/{chunk-ECRK6TUQ.mjs.map → chunk-BB2TAT4P.mjs.map} +1 -1
- package/dist/lib/node-esm/chunk-CDAILLCU.mjs +98 -0
- package/dist/lib/node-esm/chunk-CDAILLCU.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-6JK5HEUQ.mjs → chunk-HLPGKJ7N.mjs} +3 -3
- package/dist/lib/node-esm/chunk-HLPGKJ7N.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-PBZA7XJR.mjs → chunk-OYN6HLXZ.mjs} +42 -36
- package/dist/lib/{browser/chunk-NFUHCW2J.mjs.map → node-esm/chunk-OYN6HLXZ.mjs.map} +1 -1
- package/dist/lib/node-esm/chunk-QU626JMR.mjs +156 -0
- package/dist/lib/node-esm/chunk-QU626JMR.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-MVDAY3CZ.mjs → chunk-SI5LOQEO.mjs} +1669 -1515
- package/dist/lib/node-esm/chunk-SI5LOQEO.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-ZKBACPIW.mjs +206 -0
- package/dist/lib/node-esm/chunk-ZKBACPIW.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +35 -18
- package/dist/lib/node-esm/index.mjs.map +3 -3
- package/dist/lib/node-esm/{intent-resolver-H32TL4X6.mjs → intent-resolver-X3PWH7KM.mjs} +10 -14
- package/dist/lib/node-esm/intent-resolver-X3PWH7KM.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/react-surface-QMIQCXUM.mjs +132 -0
- package/dist/lib/node-esm/react-surface-QMIQCXUM.mjs.map +7 -0
- package/dist/lib/node-esm/{settings-DZU5PNXM.mjs → settings-IVQRZUCU.mjs} +5 -5
- package/dist/lib/node-esm/settings-IVQRZUCU.mjs.map +7 -0
- package/dist/lib/node-esm/types/index.mjs +6 -2
- package/dist/types/src/AssistantPlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/ai-client.d.ts +3 -3
- package/dist/types/src/capabilities/ai-client.d.ts.map +1 -1
- package/dist/types/src/capabilities/app-graph-builder.d.ts +2 -179
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
- package/dist/types/src/capabilities/capabilities.d.ts +1 -1
- package/dist/types/src/capabilities/capabilities.d.ts.map +1 -1
- package/dist/types/src/capabilities/index.d.ts +3 -179
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- 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/AmbientDialog/AmbientDialog.d.ts +3 -1
- package/dist/types/src/components/AmbientDialog/AmbientDialog.d.ts.map +1 -1
- package/dist/types/src/components/AssistantSettings/AssistantSettings.d.ts.map +1 -1
- package/dist/types/src/components/BlueprintEditor/BlueprintEditor.d.ts +8 -0
- package/dist/types/src/components/BlueprintEditor/BlueprintEditor.d.ts.map +1 -0
- package/dist/types/src/components/BlueprintEditor/BlueprintEditor.stories.d.ts +8 -0
- package/dist/types/src/components/BlueprintEditor/BlueprintEditor.stories.d.ts.map +1 -0
- package/dist/types/src/components/BlueprintEditor/index.d.ts +2 -0
- package/dist/types/src/components/BlueprintEditor/index.d.ts.map +1 -0
- package/dist/types/src/components/ChatContainer.d.ts +4 -3
- package/dist/types/src/components/ChatContainer.d.ts.map +1 -1
- package/dist/types/src/components/Prompt/Prompt.d.ts +5 -2
- package/dist/types/src/components/Prompt/Prompt.d.ts.map +1 -1
- package/dist/types/src/components/Prompt/Prompt.stories.d.ts +6 -3
- package/dist/types/src/components/Prompt/Prompt.stories.d.ts.map +1 -1
- package/dist/types/src/components/Prompt/PromptBar.d.ts +9 -4
- package/dist/types/src/components/Prompt/PromptBar.d.ts.map +1 -1
- package/dist/types/src/components/Prompt/PromptBar.stories.d.ts +9 -0
- package/dist/types/src/components/Prompt/PromptBar.stories.d.ts.map +1 -0
- package/dist/types/src/components/Prompt/autocomplete.d.ts +5 -1
- package/dist/types/src/components/Prompt/autocomplete.d.ts.map +1 -1
- package/dist/types/src/components/Prompt/references.d.ts.map +1 -1
- package/dist/types/src/components/PromptSettings.d.ts +6 -0
- package/dist/types/src/components/PromptSettings.d.ts.map +1 -0
- package/dist/types/src/components/TemplateContainer.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/TemplateEditor.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/TemplateEditor.stories.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/TemplateForm.d.ts +2 -2
- package/dist/types/src/components/TemplateEditor/TemplateForm.d.ts.map +1 -1
- package/dist/types/src/components/Thread/Thread.d.ts +2 -2
- package/dist/types/src/components/Thread/Thread.d.ts.map +1 -1
- package/dist/types/src/components/Thread/Thread.stories.d.ts.map +1 -1
- package/dist/types/src/components/Thread/ThreadContainer.d.ts +1 -1
- package/dist/types/src/components/Thread/ThreadContainer.d.ts.map +1 -1
- package/dist/types/src/components/Thread/ThreadContainer.stories.d.ts +2 -2
- package/dist/types/src/components/Thread/ThreadContainer.stories.d.ts.map +1 -1
- package/dist/types/src/components/Thread/ThreadMessage.d.ts +4 -2
- package/dist/types/src/components/Thread/ThreadMessage.d.ts.map +1 -1
- package/dist/types/src/components/Thread/ToolInvocations.d.ts +1 -1
- package/dist/types/src/components/Thread/ToolInvocations.d.ts.map +1 -1
- package/dist/types/src/components/Thread/reducer.d.ts +1 -1
- package/dist/types/src/components/Thread/reducer.d.ts.map +1 -1
- package/dist/types/src/components/Toolbox/Toolbox.d.ts +3 -2
- package/dist/types/src/components/Toolbox/Toolbox.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +4 -6
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/experimental/transcription/index.d.ts +1 -0
- package/dist/types/src/experimental/transcription/index.d.ts.map +1 -0
- package/dist/types/src/hooks/index.d.ts +0 -1
- package/dist/types/src/hooks/index.d.ts.map +1 -1
- package/dist/types/src/hooks/processor.d.ts +6 -5
- package/dist/types/src/hooks/processor.d.ts.map +1 -1
- package/dist/types/src/hooks/useChatProcessor.d.ts.map +1 -1
- package/dist/types/src/hooks/useContextProvider.d.ts +1 -1
- package/dist/types/src/hooks/useContextProvider.d.ts.map +1 -1
- package/dist/types/src/hooks/useMessageQueue.d.ts +11 -10
- package/dist/types/src/hooks/useMessageQueue.d.ts.map +1 -1
- package/dist/types/src/hooks/useServices.d.ts.map +1 -1
- package/dist/types/src/hooks/useTextInputEvents.d.ts.map +1 -1
- package/dist/types/src/parser/filter-generator.d.ts +4 -0
- package/dist/types/src/parser/filter-generator.d.ts.map +1 -0
- package/dist/types/src/parser/filter-generator.test.d.ts +2 -0
- package/dist/types/src/parser/filter-generator.test.d.ts.map +1 -0
- package/dist/types/src/parser/index.d.ts +4 -0
- package/dist/types/src/parser/index.d.ts.map +1 -0
- package/dist/types/src/parser/query-parser.d.ts +15 -0
- package/dist/types/src/parser/query-parser.d.ts.map +1 -0
- package/dist/types/src/parser/query-parser.test.d.ts +2 -0
- package/dist/types/src/parser/query-parser.test.d.ts.map +1 -0
- package/dist/types/src/parser/types.d.ts +24 -0
- package/dist/types/src/parser/types.d.ts.map +1 -0
- package/dist/types/src/stories/Prompt.stories.d.ts +8 -0
- package/dist/types/src/stories/Prompt.stories.d.ts.map +1 -0
- package/dist/types/src/stories/Query.stories.d.ts +19 -0
- package/dist/types/src/stories/Query.stories.d.ts.map +1 -0
- package/dist/types/src/stories/Research.stories.d.ts +15 -0
- package/dist/types/src/stories/Research.stories.d.ts.map +1 -0
- package/dist/types/src/stories/test-data.d.ts +3 -0
- package/dist/types/src/stories/test-data.d.ts.map +1 -0
- package/dist/types/src/stories/testing.d.ts +12 -0
- package/dist/types/src/stories/testing.d.ts.map +1 -0
- package/dist/types/src/testing/blueprint.d.ts +7 -0
- package/dist/types/src/testing/blueprint.d.ts.map +1 -0
- package/dist/types/src/testing/index.d.ts +1 -0
- package/dist/types/src/testing/index.d.ts.map +1 -1
- package/dist/types/src/testing/test-functions.d.ts +1 -1
- package/dist/types/src/testing/test-functions.d.ts.map +1 -1
- package/dist/types/src/tools/function.d.ts +4 -4
- package/dist/types/src/tools/function.d.ts.map +1 -1
- package/dist/types/src/tools/openapi.d.ts +3 -3
- package/dist/types/src/tools/openapi.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +6 -0
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/chat.d.ts +18 -8
- package/dist/types/src/types/chat.d.ts.map +1 -1
- package/dist/types/src/types/service.d.ts +96 -95
- package/dist/types/src/types/service.d.ts.map +1 -1
- package/dist/types/src/types/template.d.ts +52 -52
- package/dist/types/src/types/template.d.ts.map +1 -1
- package/dist/types/src/types/types.d.ts +25 -20
- package/dist/types/src/types/types.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +79 -61
- package/src/AssistantPlugin.tsx +7 -6
- package/src/capabilities/ai-client.ts +5 -6
- package/src/capabilities/app-graph-builder.ts +173 -135
- package/src/capabilities/capabilities.ts +1 -1
- package/src/capabilities/index.ts +1 -1
- package/src/capabilities/intent-resolver.ts +7 -9
- package/src/capabilities/react-surface.tsx +63 -16
- package/src/capabilities/settings.ts +2 -2
- package/src/components/AmbientDialog/AmbientDialog.stories.tsx +2 -2
- package/src/components/AmbientDialog/AmbientDialog.tsx +27 -13
- package/src/components/AssistantDialog.tsx +1 -1
- package/src/components/AssistantSettings/AssistantSettings.tsx +29 -7
- package/src/components/BlueprintEditor/BlueprintEditor.stories.tsx +32 -0
- package/src/components/BlueprintEditor/BlueprintEditor.tsx +41 -0
- package/src/components/BlueprintEditor/index.ts +5 -0
- package/src/components/ChatContainer.tsx +6 -8
- package/src/components/Prompt/Prompt.stories.tsx +59 -52
- package/src/components/Prompt/Prompt.tsx +24 -10
- package/src/components/Prompt/PromptBar.stories.tsx +68 -0
- package/src/components/Prompt/PromptBar.tsx +82 -88
- package/src/components/Prompt/autocomplete.ts +14 -8
- package/src/components/Prompt/references.ts +3 -3
- package/src/components/PromptSettings.tsx +91 -0
- package/src/components/TemplateContainer.tsx +3 -79
- package/src/components/TemplateEditor/TemplateEditor.stories.tsx +4 -4
- package/src/components/TemplateEditor/TemplateForm.stories.tsx +3 -3
- package/src/components/TemplateEditor/TemplateForm.tsx +2 -2
- package/src/components/Thread/Thread.stories.tsx +14 -17
- package/src/components/Thread/Thread.tsx +2 -2
- package/src/components/Thread/ThreadContainer.stories.tsx +83 -62
- package/src/components/Thread/ThreadContainer.tsx +26 -5
- package/src/components/Thread/ThreadMessage.tsx +49 -11
- package/src/components/Thread/ToolInvocations.tsx +9 -7
- package/src/components/Thread/reducer.ts +1 -1
- package/src/components/Toolbox/Toolbox.stories.tsx +4 -4
- package/src/components/Toolbox/Toolbox.tsx +5 -4
- package/src/components/index.ts +3 -1
- package/src/experimental/transcription/index.ts +3 -0
- package/src/hooks/index.ts +0 -1
- package/src/hooks/processor.ts +68 -8
- package/src/hooks/useChatProcessor.tsx +12 -11
- package/src/hooks/useContextProvider.ts +21 -17
- package/src/hooks/useMessageQueue.ts +5 -5
- package/src/meta.ts +2 -2
- package/src/parser/filter-generator.test.ts +32 -0
- package/src/parser/filter-generator.ts +81 -0
- package/src/parser/index.ts +7 -0
- package/src/parser/query-parser.test.ts +139 -0
- package/src/parser/query-parser.ts +199 -0
- package/src/parser/types.ts +34 -0
- package/src/shims.d.ts +8 -0
- package/src/stories/Prompt.stories.tsx +59 -0
- package/src/stories/Query.stories.tsx +448 -0
- package/src/stories/Research.stories.tsx +495 -0
- package/src/stories/test-data.ts +128 -0
- package/src/stories/testing.ts +64 -0
- package/src/testing/blueprint.ts +47 -0
- package/src/testing/index.ts +1 -0
- package/src/testing/test-functions.ts +1 -1
- package/src/testing/test-services.ts +6 -6
- package/src/tools/function.ts +11 -12
- package/src/tools/openapi.test.ts +18 -19
- package/src/tools/openapi.ts +24 -17
- package/src/translations.ts +9 -6
- package/src/types/chat.ts +27 -4
- package/src/types/service.ts +39 -37
- package/src/types/template.ts +27 -25
- package/src/types/types.ts +22 -17
- package/dist/lib/browser/AssistantDialog-YSHMAHW5.mjs +0 -117
- package/dist/lib/browser/AssistantDialog-YSHMAHW5.mjs.map +0 -7
- package/dist/lib/browser/ChatContainer-V5GP7DYF.mjs +0 -33
- package/dist/lib/browser/ChatContainer-V5GP7DYF.mjs.map +0 -7
- package/dist/lib/browser/TemplateContainer-K4EJNGIL.mjs +0 -78
- package/dist/lib/browser/TemplateContainer-K4EJNGIL.mjs.map +0 -7
- package/dist/lib/browser/ai-client-CDZLSNXE.mjs.map +0 -7
- package/dist/lib/browser/app-graph-builder-MF5EVDWW.mjs +0 -209
- package/dist/lib/browser/app-graph-builder-MF5EVDWW.mjs.map +0 -7
- package/dist/lib/browser/chunk-FMB7RGMP.mjs.map +0 -7
- package/dist/lib/browser/chunk-IAMR2FAE.mjs +0 -183
- package/dist/lib/browser/chunk-IAMR2FAE.mjs.map +0 -7
- package/dist/lib/browser/chunk-KYMKVE6M.mjs +0 -128
- package/dist/lib/browser/chunk-KYMKVE6M.mjs.map +0 -7
- package/dist/lib/browser/chunk-NFUHCW2J.mjs +0 -81
- package/dist/lib/browser/chunk-TXJWGWJ7.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-WJGLKKVO.mjs.map +0 -7
- package/dist/lib/browser/react-surface-57VRDOQT.mjs +0 -90
- package/dist/lib/browser/react-surface-57VRDOQT.mjs.map +0 -7
- package/dist/lib/browser/settings-U6UFQX32.mjs.map +0 -7
- package/dist/lib/node/AssistantDialog-YI2BSGSX.cjs +0 -141
- package/dist/lib/node/AssistantDialog-YI2BSGSX.cjs.map +0 -7
- package/dist/lib/node/ChatContainer-ZJ5JXF6A.cjs.map +0 -7
- package/dist/lib/node/TemplateContainer-XWFYJB4T.cjs +0 -104
- package/dist/lib/node/TemplateContainer-XWFYJB4T.cjs.map +0 -7
- package/dist/lib/node/ai-client-URCCYU6B.cjs.map +0 -7
- package/dist/lib/node/app-graph-builder-N5ZUUI2Z.cjs +0 -220
- package/dist/lib/node/app-graph-builder-N5ZUUI2Z.cjs.map +0 -7
- package/dist/lib/node/chunk-APRU3QWK.cjs +0 -206
- package/dist/lib/node/chunk-APRU3QWK.cjs.map +0 -7
- package/dist/lib/node/chunk-GBUNQ257.cjs.map +0 -7
- package/dist/lib/node/chunk-RPBKMP2E.cjs.map +0 -7
- package/dist/lib/node/chunk-ZKOC4ZFY.cjs +0 -152
- package/dist/lib/node/chunk-ZKOC4ZFY.cjs.map +0 -7
- package/dist/lib/node/intent-resolver-R3OSTIMH.cjs.map +0 -7
- package/dist/lib/node/react-surface-NUQTM6MS.cjs +0 -106
- package/dist/lib/node/react-surface-NUQTM6MS.cjs.map +0 -7
- package/dist/lib/node/settings-TXGRCYAL.cjs.map +0 -7
- package/dist/lib/node-esm/AssistantDialog-U2FQX5TD.mjs +0 -118
- package/dist/lib/node-esm/AssistantDialog-U2FQX5TD.mjs.map +0 -7
- package/dist/lib/node-esm/ChatContainer-QW3OOXTT.mjs +0 -34
- package/dist/lib/node-esm/ChatContainer-QW3OOXTT.mjs.map +0 -7
- package/dist/lib/node-esm/TemplateContainer-EUM2X65J.mjs +0 -79
- package/dist/lib/node-esm/TemplateContainer-EUM2X65J.mjs.map +0 -7
- package/dist/lib/node-esm/ai-client-WMHS5EGV.mjs.map +0 -7
- package/dist/lib/node-esm/app-graph-builder-DWBNIMHM.mjs +0 -210
- package/dist/lib/node-esm/app-graph-builder-DWBNIMHM.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-6JK5HEUQ.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-GBBXIW5F.mjs +0 -129
- package/dist/lib/node-esm/chunk-GBBXIW5F.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-MVDAY3CZ.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-MXK2EANZ.mjs +0 -184
- package/dist/lib/node-esm/chunk-MXK2EANZ.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-H32TL4X6.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-JBVZF6CP.mjs +0 -91
- package/dist/lib/node-esm/react-surface-JBVZF6CP.mjs.map +0 -7
- package/dist/lib/node-esm/settings-DZU5PNXM.mjs.map +0 -7
- package/dist/types/src/components/ServiceRegistry/ServiceRegistry.d.ts +0 -6
- package/dist/types/src/components/ServiceRegistry/ServiceRegistry.d.ts.map +0 -1
- package/dist/types/src/components/ServiceRegistry/ServiceRegistry.stories.d.ts +0 -8
- package/dist/types/src/components/ServiceRegistry/ServiceRegistry.stories.d.ts.map +0 -1
- package/dist/types/src/components/ServiceRegistry/index.d.ts +0 -2
- package/dist/types/src/components/ServiceRegistry/index.d.ts.map +0 -1
- package/dist/types/src/hooks/invocation-handler.d.ts +0 -5
- package/dist/types/src/hooks/invocation-handler.d.ts.map +0 -1
- package/dist/types/src/hooks/useLocalTriggerManager.d.ts +0 -3
- package/dist/types/src/hooks/useLocalTriggerManager.d.ts.map +0 -1
- package/src/components/ServiceRegistry/ServiceRegistry.stories.tsx +0 -49
- package/src/components/ServiceRegistry/ServiceRegistry.tsx +0 -76
- package/src/components/ServiceRegistry/index.ts +0 -5
- package/src/hooks/invocation-handler.ts +0 -107
- package/src/hooks/useLocalTriggerManager.ts +0 -82
|
@@ -0,0 +1,495 @@
|
|
|
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, AIServiceEdgeClient, 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, type Obj } from '@dxos/echo';
|
|
20
|
+
import {
|
|
21
|
+
ATTR_RELATION_SOURCE,
|
|
22
|
+
ATTR_RELATION_TARGET,
|
|
23
|
+
create,
|
|
24
|
+
createQueueDxn,
|
|
25
|
+
getSchema,
|
|
26
|
+
getSchemaDXN,
|
|
27
|
+
getTypename,
|
|
28
|
+
isInstanceOf,
|
|
29
|
+
toJsonSchema,
|
|
30
|
+
type BaseObject,
|
|
31
|
+
Filter,
|
|
32
|
+
RelationSourceId,
|
|
33
|
+
RelationTargetId,
|
|
34
|
+
} from '@dxos/echo-schema';
|
|
35
|
+
import { ConfiguredCredentialsService, FunctionExecutor, ServiceContainer, TracingService } from '@dxos/functions';
|
|
36
|
+
import { invariant } from '@dxos/invariant';
|
|
37
|
+
import { log } from '@dxos/log';
|
|
38
|
+
import { ForceGraph, useGraphModel } from '@dxos/plugin-explorer';
|
|
39
|
+
import { useClient } from '@dxos/react-client';
|
|
40
|
+
import { getSpace, live, useQuery, useQueue, type EchoDatabase, type Live } from '@dxos/react-client/echo';
|
|
41
|
+
import { IconButton, Input, Toolbar, useAsyncState } from '@dxos/react-ui';
|
|
42
|
+
import {
|
|
43
|
+
createMenuAction,
|
|
44
|
+
createMenuItemGroup,
|
|
45
|
+
MenuProvider,
|
|
46
|
+
ToolbarMenu,
|
|
47
|
+
useMenuActions,
|
|
48
|
+
type ActionGraphProps,
|
|
49
|
+
type ToolbarMenuActionGroupProperties,
|
|
50
|
+
rxFromSignal,
|
|
51
|
+
} from '@dxos/react-ui-menu';
|
|
52
|
+
import { SyntaxHighlighter } from '@dxos/react-ui-syntax-highlighter';
|
|
53
|
+
import { mx } from '@dxos/react-ui-theme';
|
|
54
|
+
import { DataTypes } from '@dxos/schema';
|
|
55
|
+
import { withLayout, withTheme } from '@dxos/storybook-utils';
|
|
56
|
+
|
|
57
|
+
import { testPlugins } from './testing';
|
|
58
|
+
import { Thread, type ThreadProps } from '../components';
|
|
59
|
+
import { ChatProcessor } from '../hooks';
|
|
60
|
+
import { createProcessorOptions } from '../testing';
|
|
61
|
+
import translations from '../translations';
|
|
62
|
+
|
|
63
|
+
const LOCAL = false;
|
|
64
|
+
const endpoints = LOCAL ? localServiceEndpoints : remoteServiceEndpoints;
|
|
65
|
+
|
|
66
|
+
type RenderProps = {
|
|
67
|
+
items?: Obj.Any[];
|
|
68
|
+
prompts?: string[];
|
|
69
|
+
} & Pick<ThreadProps, 'debug'>;
|
|
70
|
+
|
|
71
|
+
// TODO(burdon): Use ChatContainer.
|
|
72
|
+
const DefaultStory = ({ items: _items, prompts = [], ...props }: RenderProps) => {
|
|
73
|
+
const [, forceUpdate] = useState({});
|
|
74
|
+
|
|
75
|
+
const client = useClient();
|
|
76
|
+
// TODO(burdon): Hook.
|
|
77
|
+
const [aiClient] = useState(
|
|
78
|
+
() =>
|
|
79
|
+
new SpyAIService(
|
|
80
|
+
new AIServiceEdgeClient({
|
|
81
|
+
endpoint: endpoints.ai,
|
|
82
|
+
defaultGenerationOptions: {
|
|
83
|
+
// model: '@anthropic/claude-sonnet-4-20250514',
|
|
84
|
+
model: '@anthropic/claude-3-5-sonnet-20241022',
|
|
85
|
+
},
|
|
86
|
+
}),
|
|
87
|
+
),
|
|
88
|
+
);
|
|
89
|
+
|
|
90
|
+
const space = client.spaces.default;
|
|
91
|
+
const model = useGraphModel(space);
|
|
92
|
+
|
|
93
|
+
const actionCreator = useMemo(() => createToolbar(aiClient), [aiClient]);
|
|
94
|
+
const menuProps = useMenuActions(actionCreator);
|
|
95
|
+
|
|
96
|
+
// Queue.
|
|
97
|
+
const [queueDxn, setQueueDxn] = useState<string>(() => createQueueDxn(space.id).toString());
|
|
98
|
+
const queue = useQueue<Message>(Type.DXN.tryParse(queueDxn));
|
|
99
|
+
|
|
100
|
+
// Function executor.
|
|
101
|
+
const serviceContainer = useMemo(
|
|
102
|
+
() =>
|
|
103
|
+
new ServiceContainer().setServices({
|
|
104
|
+
ai: {
|
|
105
|
+
client: aiClient,
|
|
106
|
+
},
|
|
107
|
+
credentials: new ConfiguredCredentialsService([
|
|
108
|
+
{
|
|
109
|
+
service: 'exa.ai',
|
|
110
|
+
apiKey: EXA_API_KEY,
|
|
111
|
+
},
|
|
112
|
+
]),
|
|
113
|
+
queues: {
|
|
114
|
+
queues: space.queues,
|
|
115
|
+
contextQueue: queue,
|
|
116
|
+
},
|
|
117
|
+
database: {
|
|
118
|
+
db: space.db,
|
|
119
|
+
},
|
|
120
|
+
tracing: TracingService.console,
|
|
121
|
+
}),
|
|
122
|
+
[aiClient, space, queue],
|
|
123
|
+
);
|
|
124
|
+
|
|
125
|
+
const tools = useMemo<ExecutableTool[]>(() => [createResearchTool(serviceContainer, 'research', researchFn)], []);
|
|
126
|
+
|
|
127
|
+
const { dispatchPromise: dispatch } = useIntentDispatcher();
|
|
128
|
+
|
|
129
|
+
// TODO(burdon): Replace with useChatProcessor.
|
|
130
|
+
// const processor = useChatProcessor(space);
|
|
131
|
+
const processor = useMemo<ChatProcessor | undefined>(() => {
|
|
132
|
+
if (!space) {
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
return new ChatProcessor(
|
|
137
|
+
aiClient,
|
|
138
|
+
tools,
|
|
139
|
+
[],
|
|
140
|
+
{
|
|
141
|
+
space,
|
|
142
|
+
dispatch,
|
|
143
|
+
},
|
|
144
|
+
createProcessorOptions([]),
|
|
145
|
+
);
|
|
146
|
+
}, [aiClient, tools, space, dispatch]);
|
|
147
|
+
|
|
148
|
+
useEffect(() => {
|
|
149
|
+
if (queue?.objects.length === 0 && !queue.isLoading && prompts.length > 0) {
|
|
150
|
+
queue.append([
|
|
151
|
+
create(Message, {
|
|
152
|
+
role: 'assistant',
|
|
153
|
+
content: prompts.map(
|
|
154
|
+
(prompt) =>
|
|
155
|
+
({
|
|
156
|
+
type: 'json',
|
|
157
|
+
disposition: 'suggest',
|
|
158
|
+
json: JSON.stringify({ text: prompt }),
|
|
159
|
+
}) as const,
|
|
160
|
+
),
|
|
161
|
+
}),
|
|
162
|
+
]);
|
|
163
|
+
}
|
|
164
|
+
}, [queueDxn, prompts, queue?.objects.length, queue?.isLoading]);
|
|
165
|
+
|
|
166
|
+
// State.
|
|
167
|
+
const objects = useQuery(space, Filter.or(...DataTypes.map((type) => Filter.type(type))));
|
|
168
|
+
const messages = [
|
|
169
|
+
...(queue?.objects.filter((item) => isInstanceOf(Message, item)) ?? []),
|
|
170
|
+
...(processor?.messages.value ?? []),
|
|
171
|
+
];
|
|
172
|
+
|
|
173
|
+
const handleSubmit = processor
|
|
174
|
+
? (message: string) => {
|
|
175
|
+
requestAnimationFrame(async () => {
|
|
176
|
+
invariant(processor);
|
|
177
|
+
if (processor.streaming.value) {
|
|
178
|
+
await processor.cancel();
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
// Make sure everything is indexed before agent starts processing.
|
|
182
|
+
await space.db.flush({ indexes: true });
|
|
183
|
+
|
|
184
|
+
invariant(queue);
|
|
185
|
+
await processor.request(message, {
|
|
186
|
+
history: queue.objects,
|
|
187
|
+
onComplete: (messages) => {
|
|
188
|
+
queue.append(messages);
|
|
189
|
+
},
|
|
190
|
+
});
|
|
191
|
+
});
|
|
192
|
+
|
|
193
|
+
return true;
|
|
194
|
+
}
|
|
195
|
+
: undefined;
|
|
196
|
+
|
|
197
|
+
const handlePrompt = useCallback(
|
|
198
|
+
(text: string) => {
|
|
199
|
+
void handleSubmit?.(text);
|
|
200
|
+
},
|
|
201
|
+
[handleSubmit],
|
|
202
|
+
);
|
|
203
|
+
|
|
204
|
+
const handleDelete = useCallback(
|
|
205
|
+
(id: string) => {
|
|
206
|
+
invariant(Type.ObjectId.isValid(id), 'Invalid message id');
|
|
207
|
+
void queue?.delete([id]);
|
|
208
|
+
},
|
|
209
|
+
[queue],
|
|
210
|
+
);
|
|
211
|
+
|
|
212
|
+
// TODO(dmaretskyi): Pull in relations automatically.
|
|
213
|
+
const handleAddToGraph = useCallback(async (object: BaseObject) => {
|
|
214
|
+
space.db.add(instantiate(space.db, object));
|
|
215
|
+
await space.db.flush({ indexes: true });
|
|
216
|
+
forceUpdate({});
|
|
217
|
+
}, []);
|
|
218
|
+
|
|
219
|
+
const handleResearchMore = useCallback((object: BaseObject, relatedSchema: RelatedSchema) => {
|
|
220
|
+
const prompt = `
|
|
221
|
+
Research more about objects related to the object in terms of the by the specific relation schema:
|
|
222
|
+
<object>${JSON.stringify(object, null, 2)}</object>
|
|
223
|
+
<schema>
|
|
224
|
+
<description>${SchemaAST.getDescriptionAnnotation(relatedSchema.schema.ast).pipe(Option.getOrElse(() => ''))}</description>
|
|
225
|
+
<json>
|
|
226
|
+
${JSON.stringify(toJsonSchema(relatedSchema.schema), null, 2)}
|
|
227
|
+
</json>
|
|
228
|
+
</schema>
|
|
229
|
+
`;
|
|
230
|
+
|
|
231
|
+
handlePrompt(prompt);
|
|
232
|
+
}, []);
|
|
233
|
+
|
|
234
|
+
return (
|
|
235
|
+
<div className={mx('grid w-full h-full grid-cols-3 overflow-hidden divide-x divide-separator')}>
|
|
236
|
+
{/* Thread */}
|
|
237
|
+
<div className='flex flex-col h-full gap-4 outline outline-separator overflow-hidden'>
|
|
238
|
+
{/* TODO(wittjosiah): Use react-ui-menu toolbar. */}
|
|
239
|
+
<Toolbar.Root classNames='p-2'>
|
|
240
|
+
<Input.Root>
|
|
241
|
+
<Input.TextInput
|
|
242
|
+
spellCheck={false}
|
|
243
|
+
placeholder='Queue DXN'
|
|
244
|
+
value={queueDxn}
|
|
245
|
+
onChange={(ev) => setQueueDxn(ev.target.value)}
|
|
246
|
+
/>
|
|
247
|
+
<IconButton
|
|
248
|
+
iconOnly
|
|
249
|
+
label='Copy DXN'
|
|
250
|
+
icon='ph--copy--regular'
|
|
251
|
+
onClick={() => navigator.clipboard.writeText(queueDxn)}
|
|
252
|
+
/>
|
|
253
|
+
<IconButton
|
|
254
|
+
iconOnly
|
|
255
|
+
label='Clear history'
|
|
256
|
+
icon='ph--trash--regular'
|
|
257
|
+
onClick={() => setQueueDxn(createQueueDxn().toString())}
|
|
258
|
+
/>
|
|
259
|
+
<IconButton iconOnly label='Stop' icon='ph--stop--regular' onClick={() => processor?.cancel()} />
|
|
260
|
+
</Input.Root>
|
|
261
|
+
</Toolbar.Root>
|
|
262
|
+
|
|
263
|
+
{/* TODO(burdon): Replace with ThreadContainer. */}
|
|
264
|
+
<Thread
|
|
265
|
+
messages={messages}
|
|
266
|
+
processing={processor?.streaming.value}
|
|
267
|
+
error={processor?.error.value}
|
|
268
|
+
tools={processor?.tools}
|
|
269
|
+
onSubmit={processor ? handleSubmit : undefined}
|
|
270
|
+
onPrompt={processor ? handlePrompt : undefined}
|
|
271
|
+
onDelete={processor ? handleDelete : undefined}
|
|
272
|
+
onAddToGraph={handleAddToGraph}
|
|
273
|
+
{...props}
|
|
274
|
+
/>
|
|
275
|
+
</div>
|
|
276
|
+
|
|
277
|
+
{/* TODO(burdon): Filter/query. */}
|
|
278
|
+
<ForceGraph model={model} />
|
|
279
|
+
|
|
280
|
+
{/* Artifacts Deck */}
|
|
281
|
+
<div className='flex flex-col overflow-y-auto'>
|
|
282
|
+
{/* TODO(wittjosiah): Combine with thread toolbar. */}
|
|
283
|
+
<MenuProvider {...menuProps}>
|
|
284
|
+
<ToolbarMenu />
|
|
285
|
+
</MenuProvider>
|
|
286
|
+
{objects.map((object) => (
|
|
287
|
+
<div
|
|
288
|
+
key={object.id}
|
|
289
|
+
className={mx('flex flex-col border border-separator rounded m-2 mb-0 hover:bg-hoverSurface')}
|
|
290
|
+
>
|
|
291
|
+
<div className='px-2 text-xs text-foreground-secondary'>{object.id}</div>
|
|
292
|
+
<Surface
|
|
293
|
+
role='card'
|
|
294
|
+
limit={1}
|
|
295
|
+
data={{ subject: object }}
|
|
296
|
+
fallback={
|
|
297
|
+
<SyntaxHighlighter language='json' className='text-xs'>
|
|
298
|
+
{JSON.stringify(object, null, 2)}
|
|
299
|
+
</SyntaxHighlighter>
|
|
300
|
+
}
|
|
301
|
+
/>
|
|
302
|
+
<ResearchPrompts object={object} onResearch={handleResearchMore} />
|
|
303
|
+
</div>
|
|
304
|
+
))}
|
|
305
|
+
</div>
|
|
306
|
+
</div>
|
|
307
|
+
);
|
|
308
|
+
};
|
|
309
|
+
|
|
310
|
+
type ResearchPromptsProps = {
|
|
311
|
+
object: BaseObject;
|
|
312
|
+
onResearch: (object: BaseObject, relatedSchema: RelatedSchema) => void;
|
|
313
|
+
};
|
|
314
|
+
|
|
315
|
+
const ResearchPrompts = ({ object, onResearch }: ResearchPromptsProps) => {
|
|
316
|
+
const [relatedSchemas = []] = useAsyncState(
|
|
317
|
+
async () => findRelatedSchema(getSpace(object)!.db, getSchema(object)!),
|
|
318
|
+
[object],
|
|
319
|
+
);
|
|
320
|
+
return (
|
|
321
|
+
<div>
|
|
322
|
+
{relatedSchemas.map((schema) => (
|
|
323
|
+
<button
|
|
324
|
+
key={getSchemaDXN(schema.schema)?.toString()}
|
|
325
|
+
onClick={() => onResearch(object, schema)}
|
|
326
|
+
className='border border-separator rounded px-2 py-1 m-1'
|
|
327
|
+
>
|
|
328
|
+
Research more of {Type.getTypename(schema.schema)}
|
|
329
|
+
</button>
|
|
330
|
+
))}
|
|
331
|
+
</div>
|
|
332
|
+
);
|
|
333
|
+
};
|
|
334
|
+
|
|
335
|
+
const createResearchTool = (serviceContainer: ServiceContainer, name: string, fn: typeof researchFn) => {
|
|
336
|
+
return createTool('example', {
|
|
337
|
+
name,
|
|
338
|
+
description: fn.description ?? raise(new Error('No description')),
|
|
339
|
+
schema: fn.inputSchema,
|
|
340
|
+
execute: async (input, { reportStatus }) => {
|
|
341
|
+
const executor = new FunctionExecutor(
|
|
342
|
+
serviceContainer.clone().setServices({
|
|
343
|
+
tracing: {
|
|
344
|
+
write: (event) => {
|
|
345
|
+
if (isInstanceOf(AgentStatusReport, event)) {
|
|
346
|
+
log.info('[too] report status', { status: event });
|
|
347
|
+
reportStatus?.(event);
|
|
348
|
+
}
|
|
349
|
+
},
|
|
350
|
+
},
|
|
351
|
+
}),
|
|
352
|
+
);
|
|
353
|
+
|
|
354
|
+
reportStatus?.(
|
|
355
|
+
create(AgentStatusReport, {
|
|
356
|
+
message: 'Researching...',
|
|
357
|
+
}),
|
|
358
|
+
);
|
|
359
|
+
|
|
360
|
+
await new Promise((resolve) => setTimeout(resolve, 1000));
|
|
361
|
+
|
|
362
|
+
const { result } = await executor.invoke(fn, input);
|
|
363
|
+
return ToolResult.Success(
|
|
364
|
+
'Research completed. The results are placed in the conversation and already presented to the user. No need to present them again.',
|
|
365
|
+
result.objects.map((obj: any) => ({
|
|
366
|
+
type: 'json',
|
|
367
|
+
json: JSON.stringify(obj),
|
|
368
|
+
disposition: 'graph',
|
|
369
|
+
})),
|
|
370
|
+
);
|
|
371
|
+
},
|
|
372
|
+
});
|
|
373
|
+
};
|
|
374
|
+
|
|
375
|
+
/**
|
|
376
|
+
* Instantiate an object from it's JSON representation.
|
|
377
|
+
* Resolves schema and relation references.
|
|
378
|
+
*
|
|
379
|
+
* @param db - The database to use for reference lookup.
|
|
380
|
+
* @param object - The object in JSON format to instantiate.
|
|
381
|
+
*/
|
|
382
|
+
// TODO(dmaretskyi): Move into core.
|
|
383
|
+
const instantiate = (db: EchoDatabase, object: unknown): Live<any> => {
|
|
384
|
+
const schema =
|
|
385
|
+
db.graph.schemaRegistry.getSchemaByDXN(Type.DXN.parse(getTypename(object as any)!)) ??
|
|
386
|
+
raise(new Error('Schema not found'));
|
|
387
|
+
|
|
388
|
+
let { id, [ATTR_RELATION_SOURCE]: source, [ATTR_RELATION_TARGET]: target, ...props } = object as any;
|
|
389
|
+
if (source) {
|
|
390
|
+
source = db.getObjectById(Type.DXN.parse(source).asEchoDXN()!.echoId) ?? raise(new Error('Source not found'));
|
|
391
|
+
}
|
|
392
|
+
if (target) {
|
|
393
|
+
target = db.getObjectById(Type.DXN.parse(target).asEchoDXN()!.echoId) ?? raise(new Error('Target not found'));
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
return live(schema, {
|
|
397
|
+
id,
|
|
398
|
+
...props,
|
|
399
|
+
[RelationSourceId]: source,
|
|
400
|
+
[RelationTargetId]: target,
|
|
401
|
+
});
|
|
402
|
+
};
|
|
403
|
+
|
|
404
|
+
const createToolbar = (aiClient: SpyAIService) =>
|
|
405
|
+
Rx.make((get) => {
|
|
406
|
+
const result: ActionGraphProps = { nodes: [], edges: [] };
|
|
407
|
+
const save = createMenuAction('save', () => aiClient.saveEvents(), {
|
|
408
|
+
label: 'Save events',
|
|
409
|
+
icon: 'ph--floppy-disk--regular',
|
|
410
|
+
});
|
|
411
|
+
const load = createMenuAction('load', () => aiClient.loadEvents(), {
|
|
412
|
+
label: 'Load events',
|
|
413
|
+
icon: 'ph--folder-open--regular',
|
|
414
|
+
});
|
|
415
|
+
const modes = createMenuItemGroup('mode', {
|
|
416
|
+
variant: 'dropdownMenu',
|
|
417
|
+
applyActive: true,
|
|
418
|
+
selectCardinality: 'single',
|
|
419
|
+
value: get(rxFromSignal(() => aiClient.mode)),
|
|
420
|
+
} as ToolbarMenuActionGroupProperties);
|
|
421
|
+
const spy = createMenuAction('spy', () => aiClient.setMode('spy'), {
|
|
422
|
+
label: 'Spy',
|
|
423
|
+
icon: 'ph--detective--regular',
|
|
424
|
+
checked: get(rxFromSignal(() => aiClient.mode === 'spy')),
|
|
425
|
+
});
|
|
426
|
+
const mock = createMenuAction('mock', () => aiClient.setMode('mock'), {
|
|
427
|
+
label: 'Mock',
|
|
428
|
+
icon: 'ph--rewind--regular',
|
|
429
|
+
checked: get(rxFromSignal(() => aiClient.mode === 'mock')),
|
|
430
|
+
});
|
|
431
|
+
result.nodes.push(save, load, modes, spy, mock);
|
|
432
|
+
result.edges.push(
|
|
433
|
+
{ source: 'root', target: save.id },
|
|
434
|
+
{ source: 'root', target: load.id },
|
|
435
|
+
{ source: 'root', target: modes.id },
|
|
436
|
+
{ source: modes.id, target: spy.id },
|
|
437
|
+
{ source: modes.id, target: mock.id },
|
|
438
|
+
);
|
|
439
|
+
return result;
|
|
440
|
+
});
|
|
441
|
+
|
|
442
|
+
const meta: Meta<typeof DefaultStory> = {
|
|
443
|
+
title: 'plugins/plugin-assistant/Research',
|
|
444
|
+
render: DefaultStory,
|
|
445
|
+
decorators: [
|
|
446
|
+
withPluginManager({
|
|
447
|
+
plugins: testPlugins({
|
|
448
|
+
config: {
|
|
449
|
+
runtime: {
|
|
450
|
+
client: {
|
|
451
|
+
storage: {
|
|
452
|
+
persistent: true,
|
|
453
|
+
},
|
|
454
|
+
enableVectorIndexing: true,
|
|
455
|
+
},
|
|
456
|
+
},
|
|
457
|
+
},
|
|
458
|
+
}),
|
|
459
|
+
capabilities: [
|
|
460
|
+
contributes(
|
|
461
|
+
Capabilities.ReactSurface,
|
|
462
|
+
createSurface({
|
|
463
|
+
id: 'test',
|
|
464
|
+
role: 'card',
|
|
465
|
+
position: 'fallback',
|
|
466
|
+
component: ({ data }) => (
|
|
467
|
+
<span className='text-xs whitespace-pre-wrap'>{JSON.stringify(data.subject, null, 2)}</span>
|
|
468
|
+
),
|
|
469
|
+
}),
|
|
470
|
+
),
|
|
471
|
+
],
|
|
472
|
+
fireEvents: [Events.SetupArtifactDefinition],
|
|
473
|
+
}),
|
|
474
|
+
withTheme,
|
|
475
|
+
withLayout({ fullscreen: true }),
|
|
476
|
+
],
|
|
477
|
+
parameters: {
|
|
478
|
+
translations,
|
|
479
|
+
},
|
|
480
|
+
};
|
|
481
|
+
|
|
482
|
+
export default meta;
|
|
483
|
+
|
|
484
|
+
type Story = StoryObj<typeof DefaultStory>;
|
|
485
|
+
|
|
486
|
+
export const Default: Story = {
|
|
487
|
+
args: {
|
|
488
|
+
debug: true,
|
|
489
|
+
prompts: [
|
|
490
|
+
//
|
|
491
|
+
'Research companies in the area of personal knowledge management and AI',
|
|
492
|
+
'Who founded Notion?',
|
|
493
|
+
],
|
|
494
|
+
},
|
|
495
|
+
};
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { type Live, type Space } from '@dxos/client/echo';
|
|
6
|
+
import { create, getSchemaTypename, RelationSourceId, RelationTargetId } from '@dxos/echo-schema';
|
|
7
|
+
import { invariant } from '@dxos/invariant';
|
|
8
|
+
import { DataType } from '@dxos/schema';
|
|
9
|
+
|
|
10
|
+
const organizations: DataType.Organization[] = [
|
|
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: DataType.Person[] = [
|
|
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
|
+
[getSchemaTypename(DataType.Organization)!]: organizations,
|
|
45
|
+
[getSchemaTypename(DataType.Person)!]: people,
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
const testRelationships: Record<
|
|
49
|
+
string,
|
|
50
|
+
({
|
|
51
|
+
source: string;
|
|
52
|
+
target: string;
|
|
53
|
+
} & Record<string, any>)[]
|
|
54
|
+
> = {
|
|
55
|
+
[getSchemaTypename(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
|
+
[getSchemaTypename(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(create(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
|
+
create(schema, {
|
|
120
|
+
...data,
|
|
121
|
+
// TODO(burdon): Test source/target types match.
|
|
122
|
+
[RelationSourceId]: sourceObject,
|
|
123
|
+
[RelationTargetId]: targetObject,
|
|
124
|
+
}),
|
|
125
|
+
);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
};
|
|
@@ -0,0 +1,64 @@
|
|
|
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 = {
|
|
24
|
+
config?: ConfigProto;
|
|
25
|
+
types?: Schema.Schema.AnyNoContext[];
|
|
26
|
+
indexConfig?: IndexConfig;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export const testPlugins = ({ config, types = DataTypes, indexConfig }: TestPluginsOptions = {}) => [
|
|
30
|
+
ClientPlugin({
|
|
31
|
+
config: new Config(
|
|
32
|
+
defaulstDeep({}, config, {
|
|
33
|
+
runtime: {
|
|
34
|
+
services: {
|
|
35
|
+
edge: {
|
|
36
|
+
url: 'http://edge-main.dxos.workers.dev',
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
}),
|
|
41
|
+
),
|
|
42
|
+
types,
|
|
43
|
+
onClientInitialized: async (_, client) => {
|
|
44
|
+
if (!client.halo.identity.get()) {
|
|
45
|
+
await client.halo.createIdentity();
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
if (indexConfig) {
|
|
49
|
+
// TODO(burdon): Rename services.services?
|
|
50
|
+
await client.services.services.QueryService!.setConfig(indexConfig);
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
}),
|
|
54
|
+
SpacePlugin(),
|
|
55
|
+
SettingsPlugin(),
|
|
56
|
+
IntentPlugin(),
|
|
57
|
+
|
|
58
|
+
// Artifacts.
|
|
59
|
+
ChessPlugin(),
|
|
60
|
+
InboxPlugin(),
|
|
61
|
+
MapPlugin(),
|
|
62
|
+
TablePlugin(),
|
|
63
|
+
PreviewPlugin(),
|
|
64
|
+
];
|