@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
|
@@ -7,6 +7,7 @@ import '@dxos-theme';
|
|
|
7
7
|
import { type StoryObj, type Meta } from '@storybook/react';
|
|
8
8
|
import React, { useCallback, useEffect, useMemo, useState } from 'react';
|
|
9
9
|
|
|
10
|
+
import { AIServiceEdgeClient, Message } from '@dxos/ai';
|
|
10
11
|
import {
|
|
11
12
|
Capabilities,
|
|
12
13
|
Events,
|
|
@@ -17,42 +18,45 @@ import {
|
|
|
17
18
|
useIntentDispatcher,
|
|
18
19
|
} from '@dxos/app-framework';
|
|
19
20
|
import { withPluginManager } from '@dxos/app-framework/testing';
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import { createStatic, ObjectId } from '@dxos/echo-schema';
|
|
21
|
+
import { remoteServiceEndpoints } from '@dxos/artifact-testing';
|
|
22
|
+
import { Type, type Obj } from '@dxos/echo';
|
|
23
|
+
import { createQueueDxn, create, Query, Filter } from '@dxos/echo-schema';
|
|
24
24
|
import { invariant } from '@dxos/invariant';
|
|
25
|
-
import { DXN, QueueSubspaceTags, SpaceId } from '@dxos/keys';
|
|
26
25
|
import { ChessPlugin } from '@dxos/plugin-chess';
|
|
27
26
|
import { ChessType } from '@dxos/plugin-chess/types';
|
|
28
27
|
import { ClientPlugin } from '@dxos/plugin-client';
|
|
29
28
|
import { InboxPlugin } from '@dxos/plugin-inbox';
|
|
30
29
|
import { MapPlugin } from '@dxos/plugin-map';
|
|
30
|
+
import { MarkdownPlugin } from '@dxos/plugin-markdown';
|
|
31
31
|
import { SpacePlugin } from '@dxos/plugin-space';
|
|
32
32
|
import { TablePlugin } from '@dxos/plugin-table';
|
|
33
|
-
import {
|
|
34
|
-
import {
|
|
33
|
+
import { useClient } from '@dxos/react-client';
|
|
34
|
+
import { useQueue, useQuery } from '@dxos/react-client/echo';
|
|
35
35
|
import { IconButton, Input, Toolbar } from '@dxos/react-ui';
|
|
36
|
-
import { mx } from '@dxos/react-ui-theme';
|
|
37
|
-
import { withLayout,
|
|
36
|
+
import { descriptionMessage, mx } from '@dxos/react-ui-theme';
|
|
37
|
+
import { withLayout, withTheme } from '@dxos/storybook-utils';
|
|
38
38
|
|
|
39
39
|
import { Thread, type ThreadProps } from './Thread';
|
|
40
40
|
import { ChatProcessor } from '../../hooks';
|
|
41
41
|
import { createProcessorOptions } from '../../testing';
|
|
42
42
|
import translations from '../../translations';
|
|
43
43
|
|
|
44
|
-
|
|
44
|
+
// TODO(burdon): Configure for local with ollama/LM studio.
|
|
45
|
+
// const endpoints = localServiceEndpoints;
|
|
46
|
+
const endpoints = remoteServiceEndpoints;
|
|
45
47
|
|
|
46
48
|
type RenderProps = {
|
|
47
|
-
items?:
|
|
49
|
+
items?: Obj.Any[];
|
|
48
50
|
prompts?: string[];
|
|
49
51
|
} & Pick<ThreadProps, 'debug'>;
|
|
50
52
|
|
|
51
53
|
// TODO(burdon): Use ChatContainer.
|
|
52
54
|
const DefaultStory = ({ items: _items, prompts = [], ...props }: RenderProps) => {
|
|
53
|
-
const
|
|
55
|
+
const client = useClient();
|
|
56
|
+
const space = client.spaces.default;
|
|
57
|
+
|
|
54
58
|
const artifactDefinitions = useCapabilities(Capabilities.ArtifactDefinition);
|
|
55
|
-
const tools =
|
|
59
|
+
const tools = useCapabilities(Capabilities.Tools);
|
|
56
60
|
|
|
57
61
|
const [aiClient] = useState(() => new AIServiceEdgeClient({ endpoint: endpoints.ai }));
|
|
58
62
|
const { dispatchPromise: dispatch } = useIntentDispatcher();
|
|
@@ -66,7 +70,7 @@ const DefaultStory = ({ items: _items, prompts = [], ...props }: RenderProps) =>
|
|
|
66
70
|
|
|
67
71
|
return new ChatProcessor(
|
|
68
72
|
aiClient,
|
|
69
|
-
tools,
|
|
73
|
+
tools.flat(),
|
|
70
74
|
artifactDefinitions,
|
|
71
75
|
{
|
|
72
76
|
space,
|
|
@@ -77,13 +81,19 @@ const DefaultStory = ({ items: _items, prompts = [], ...props }: RenderProps) =>
|
|
|
77
81
|
}, [aiClient, tools, space, dispatch, artifactDefinitions]);
|
|
78
82
|
|
|
79
83
|
// Queue.
|
|
80
|
-
const [queueDxn, setQueueDxn] = useState<string>(() =>
|
|
81
|
-
const queue = useQueue<Message>(DXN.tryParse(queueDxn));
|
|
84
|
+
const [queueDxn, setQueueDxn] = useState<string>(() => createQueueDxn(space.id).toString());
|
|
85
|
+
const queue = useQueue<Message>(Type.DXN.tryParse(queueDxn));
|
|
82
86
|
|
|
83
87
|
useEffect(() => {
|
|
84
|
-
if (
|
|
88
|
+
if (space) {
|
|
89
|
+
setQueueDxn(createQueueDxn(space.id).toString());
|
|
90
|
+
}
|
|
91
|
+
}, [space]);
|
|
92
|
+
|
|
93
|
+
useEffect(() => {
|
|
94
|
+
if (queue?.objects.length === 0 && !queue.isLoading && prompts.length > 0) {
|
|
85
95
|
queue.append([
|
|
86
|
-
|
|
96
|
+
create(Message, {
|
|
87
97
|
role: 'assistant',
|
|
88
98
|
content: prompts.map(
|
|
89
99
|
(prompt) =>
|
|
@@ -96,48 +106,52 @@ const DefaultStory = ({ items: _items, prompts = [], ...props }: RenderProps) =>
|
|
|
96
106
|
}),
|
|
97
107
|
]);
|
|
98
108
|
}
|
|
99
|
-
}, [queueDxn, prompts, queue?.
|
|
109
|
+
}, [queueDxn, prompts, queue?.objects.length, queue?.isLoading]);
|
|
100
110
|
|
|
101
111
|
// State.
|
|
102
|
-
const
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
history: queue.items,
|
|
116
|
-
onComplete: (messages) => {
|
|
117
|
-
queue.append(messages);
|
|
118
|
-
},
|
|
119
|
-
});
|
|
120
|
-
});
|
|
112
|
+
const query = useMemo(
|
|
113
|
+
() => Query.select(Filter.or(...artifactDefinitions.map((definition) => Filter.type(definition.schema)))),
|
|
114
|
+
[artifactDefinitions],
|
|
115
|
+
);
|
|
116
|
+
const artifactItems = useQuery(space, query);
|
|
117
|
+
const messages = [...(queue?.objects ?? []), ...(processor?.messages.value ?? [])];
|
|
118
|
+
|
|
119
|
+
const handleSubmit = useCallback(
|
|
120
|
+
(message: string) => {
|
|
121
|
+
requestAnimationFrame(async () => {
|
|
122
|
+
if (!processor || !queue) {
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
121
125
|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
126
|
+
if (processor.streaming.value) {
|
|
127
|
+
await processor.cancel();
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
await processor.request(message, {
|
|
131
|
+
history: queue.objects,
|
|
132
|
+
onComplete: (messages) => {
|
|
133
|
+
queue.append(messages);
|
|
134
|
+
},
|
|
135
|
+
});
|
|
136
|
+
});
|
|
125
137
|
|
|
126
|
-
|
|
127
|
-
(text: string) => {
|
|
128
|
-
void handleSubmit?.(text);
|
|
138
|
+
return true;
|
|
129
139
|
},
|
|
130
|
-
[
|
|
140
|
+
[processor, queue],
|
|
131
141
|
);
|
|
132
142
|
|
|
133
143
|
const handleDelete = useCallback(
|
|
134
144
|
(id: string) => {
|
|
135
|
-
invariant(ObjectId.isValid(id), 'Invalid message id');
|
|
145
|
+
invariant(Type.ObjectId.isValid(id), 'Invalid message id');
|
|
136
146
|
void queue?.delete([id]);
|
|
137
147
|
},
|
|
138
148
|
[queue],
|
|
139
149
|
);
|
|
140
150
|
|
|
151
|
+
if (!space) {
|
|
152
|
+
return <></>;
|
|
153
|
+
}
|
|
154
|
+
|
|
141
155
|
return (
|
|
142
156
|
<div className='grid grid-cols-2 w-full h-full divide-x divide-separator overflow-hidden'>
|
|
143
157
|
{/* Thread */}
|
|
@@ -160,7 +174,7 @@ const DefaultStory = ({ items: _items, prompts = [], ...props }: RenderProps) =>
|
|
|
160
174
|
iconOnly
|
|
161
175
|
label='Clear history'
|
|
162
176
|
icon='ph--trash--regular'
|
|
163
|
-
onClick={() => setQueueDxn(
|
|
177
|
+
onClick={() => setQueueDxn(createQueueDxn(space.id).toString())}
|
|
164
178
|
/>
|
|
165
179
|
<IconButton iconOnly label='Stop' icon='ph--stop--regular' onClick={() => processor?.cancel()} />
|
|
166
180
|
</Input.Root>
|
|
@@ -173,7 +187,7 @@ const DefaultStory = ({ items: _items, prompts = [], ...props }: RenderProps) =>
|
|
|
173
187
|
error={processor?.error.value}
|
|
174
188
|
tools={processor?.tools}
|
|
175
189
|
onSubmit={processor ? handleSubmit : undefined}
|
|
176
|
-
onPrompt={processor ?
|
|
190
|
+
onPrompt={processor ? handleSubmit : undefined}
|
|
177
191
|
onDelete={processor ? handleDelete : undefined}
|
|
178
192
|
{...props}
|
|
179
193
|
/>
|
|
@@ -183,7 +197,7 @@ const DefaultStory = ({ items: _items, prompts = [], ...props }: RenderProps) =>
|
|
|
183
197
|
<div className='overflow-hidden grid grid-rows-[2fr_1fr] divide-y divide-separator'>
|
|
184
198
|
{artifactItems.length > 0 && (
|
|
185
199
|
<div className={mx('flex grow overflow-hidden', artifactItems.length === 1 && 'row-span-2')}>
|
|
186
|
-
<Surface role='
|
|
200
|
+
<Surface role='article' limit={1} data={{ subject: artifactItems[0] }} fallback={Fallback} />
|
|
187
201
|
</div>
|
|
188
202
|
)}
|
|
189
203
|
|
|
@@ -191,7 +205,7 @@ const DefaultStory = ({ items: _items, prompts = [], ...props }: RenderProps) =>
|
|
|
191
205
|
<div className='flex shrink-0 overflow-hidden divide-x divide-separator'>
|
|
192
206
|
<div className='flex flex-1 h-full'>
|
|
193
207
|
{artifactItems.slice(1, 3).map((item, idx) => (
|
|
194
|
-
<Surface key={idx} role='
|
|
208
|
+
<Surface key={idx} role='article' limit={1} data={{ subject: item }} fallback={Fallback} />
|
|
195
209
|
))}
|
|
196
210
|
</div>
|
|
197
211
|
</div>
|
|
@@ -201,18 +215,10 @@ const DefaultStory = ({ items: _items, prompts = [], ...props }: RenderProps) =>
|
|
|
201
215
|
);
|
|
202
216
|
};
|
|
203
217
|
|
|
204
|
-
const randomQueueDxn = () =>
|
|
205
|
-
new DXN(DXN.kind.QUEUE, [QueueSubspaceTags.DATA, SpaceId.random(), ObjectId.random()]).toString();
|
|
206
|
-
|
|
207
218
|
const meta: Meta<typeof DefaultStory> = {
|
|
208
|
-
title: 'plugins/plugin-
|
|
219
|
+
title: 'plugins/plugin-assistant/ThreadContainer',
|
|
209
220
|
render: DefaultStory,
|
|
210
221
|
decorators: [
|
|
211
|
-
withSignals,
|
|
212
|
-
withClientProvider({
|
|
213
|
-
createIdentity: true,
|
|
214
|
-
createSpace: true,
|
|
215
|
-
}),
|
|
216
222
|
withPluginManager({
|
|
217
223
|
plugins: [
|
|
218
224
|
ClientPlugin({
|
|
@@ -220,7 +226,7 @@ const meta: Meta<typeof DefaultStory> = {
|
|
|
220
226
|
await client.halo.createIdentity();
|
|
221
227
|
},
|
|
222
228
|
}),
|
|
223
|
-
SpacePlugin(
|
|
229
|
+
SpacePlugin(),
|
|
224
230
|
SettingsPlugin(),
|
|
225
231
|
IntentPlugin(),
|
|
226
232
|
|
|
@@ -228,12 +234,13 @@ const meta: Meta<typeof DefaultStory> = {
|
|
|
228
234
|
ChessPlugin(),
|
|
229
235
|
InboxPlugin(),
|
|
230
236
|
MapPlugin(),
|
|
237
|
+
MarkdownPlugin(),
|
|
231
238
|
TablePlugin(),
|
|
232
239
|
],
|
|
233
240
|
fireEvents: [Events.SetupArtifactDefinition],
|
|
234
241
|
}),
|
|
235
242
|
withTheme,
|
|
236
|
-
withLayout({ fullscreen: true
|
|
243
|
+
withLayout({ fullscreen: true }),
|
|
237
244
|
],
|
|
238
245
|
parameters: {
|
|
239
246
|
translations,
|
|
@@ -255,9 +262,23 @@ export const WithInitialItems: Story = {
|
|
|
255
262
|
args: {
|
|
256
263
|
debug: true,
|
|
257
264
|
items: [
|
|
258
|
-
|
|
265
|
+
create(ChessType, {
|
|
259
266
|
fen: 'rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1',
|
|
260
267
|
}),
|
|
261
268
|
],
|
|
262
269
|
},
|
|
263
270
|
};
|
|
271
|
+
|
|
272
|
+
const Fallback = ({ error }: { error?: Error }) => {
|
|
273
|
+
const errorString = error?.toString() ?? '';
|
|
274
|
+
return (
|
|
275
|
+
<div role='none' className='overflow-auto p-8 attention-surface grid place-items-center'>
|
|
276
|
+
<p
|
|
277
|
+
role='alert'
|
|
278
|
+
className={mx(descriptionMessage, 'break-words rounded-lg p-8', errorString.length < 256 && 'text-lg')}
|
|
279
|
+
>
|
|
280
|
+
{error ? errorString : 'error'}
|
|
281
|
+
</p>
|
|
282
|
+
</div>
|
|
283
|
+
);
|
|
284
|
+
};
|
|
@@ -2,10 +2,13 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import React, { useCallback, type FC } from 'react';
|
|
5
|
+
import React, { useCallback, type FC, useEffect } from 'react';
|
|
6
6
|
|
|
7
|
+
import { CollaborationActions, createIntent, useIntentDispatcher } from '@dxos/app-framework';
|
|
7
8
|
import { type AssociatedArtifact } from '@dxos/artifact';
|
|
8
9
|
import { invariant } from '@dxos/invariant';
|
|
10
|
+
import { DXN } from '@dxos/keys';
|
|
11
|
+
import { refFromDXN } from '@dxos/live-object';
|
|
9
12
|
import { log } from '@dxos/log';
|
|
10
13
|
import { getSpace } from '@dxos/react-client/echo';
|
|
11
14
|
import { type ThemedClassName } from '@dxos/react-ui';
|
|
@@ -19,7 +22,7 @@ export type ThreadContainerProps = {
|
|
|
19
22
|
settings?: AssistantSettingsProps;
|
|
20
23
|
part?: 'deck' | 'dialog';
|
|
21
24
|
associatedArtifact?: AssociatedArtifact;
|
|
22
|
-
} & Pick<ThreadProps, 'debug' | 'transcription' | 'onOpenChange'>;
|
|
25
|
+
} & Pick<ThreadProps, 'debug' | 'transcription' | 'onOpenChange' | 'onAddToGraph'>;
|
|
23
26
|
|
|
24
27
|
// TODO(burdon): Since this only wraps Thread, just separate out hook?
|
|
25
28
|
export const ThreadContainer: FC<ThemedClassName<ThreadContainerProps>> = ({
|
|
@@ -35,7 +38,25 @@ export const ThreadContainer: FC<ThemedClassName<ThreadContainerProps>> = ({
|
|
|
35
38
|
const contextProvider = useContextProvider(space);
|
|
36
39
|
const processor = useChatProcessor({ chat, space, settings, part, associatedArtifact });
|
|
37
40
|
const messageQueue = useMessageQueue(chat);
|
|
38
|
-
const
|
|
41
|
+
const { dispatchPromise: dispatch } = useIntentDispatcher();
|
|
42
|
+
// TODO(thure): This will be referentially new on every render, is it causing overreactivity?
|
|
43
|
+
const messages = [...(messageQueue?.objects ?? []), ...processor.messages.value];
|
|
44
|
+
|
|
45
|
+
// Post last message to document.
|
|
46
|
+
useEffect(() => {
|
|
47
|
+
if (!processor.streaming.value && messageQueue?.objects) {
|
|
48
|
+
const message = messageQueue.objects[messageQueue.objects.length - 1];
|
|
49
|
+
if (space && chat && message && dispatch && associatedArtifact) {
|
|
50
|
+
void dispatch(
|
|
51
|
+
createIntent(CollaborationActions.InsertContent, {
|
|
52
|
+
target: associatedArtifact,
|
|
53
|
+
object: refFromDXN(new DXN(DXN.kind.QUEUE, [...chat.queue.dxn.parts, message.id])),
|
|
54
|
+
label: 'View proposal',
|
|
55
|
+
}),
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}, [messageQueue, associatedArtifact, processor.streaming.value]);
|
|
39
60
|
|
|
40
61
|
const handleSubmit = useCallback(
|
|
41
62
|
(text: string) => {
|
|
@@ -49,7 +70,7 @@ export const ThreadContainer: FC<ThemedClassName<ThreadContainerProps>> = ({
|
|
|
49
70
|
|
|
50
71
|
invariant(messageQueue);
|
|
51
72
|
void processor.request(text, {
|
|
52
|
-
history: messageQueue.
|
|
73
|
+
history: messageQueue.objects,
|
|
53
74
|
onComplete: (messages) => {
|
|
54
75
|
messageQueue.append(messages);
|
|
55
76
|
},
|
|
@@ -74,11 +95,11 @@ export const ThreadContainer: FC<ThemedClassName<ThreadContainerProps>> = ({
|
|
|
74
95
|
processing={processor.streaming.value}
|
|
75
96
|
error={processor.error.value}
|
|
76
97
|
tools={processor.tools}
|
|
98
|
+
contextProvider={contextProvider}
|
|
77
99
|
onSubmit={handleSubmit}
|
|
78
100
|
onCancel={handleCancel}
|
|
79
101
|
onPrompt={handleSubmit}
|
|
80
102
|
onOpenChange={onOpenChange}
|
|
81
|
-
contextProvider={contextProvider}
|
|
82
103
|
{...props}
|
|
83
104
|
/>
|
|
84
105
|
);
|
|
@@ -2,9 +2,11 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import React, { type
|
|
5
|
+
import React, { type FC, type PropsWithChildren } from 'react';
|
|
6
6
|
|
|
7
|
-
import { type MessageContentBlock, type Message, type
|
|
7
|
+
import { type MessageContentBlock, type Message, type Tool } from '@dxos/ai';
|
|
8
|
+
import { Surface } from '@dxos/app-framework';
|
|
9
|
+
import type { BaseEchoObject } from '@dxos/echo-schema';
|
|
8
10
|
import { invariant } from '@dxos/invariant';
|
|
9
11
|
import { type Space } from '@dxos/react-client/echo';
|
|
10
12
|
import { Button, Icon, IconButton, type ThemedClassName } from '@dxos/react-ui';
|
|
@@ -20,8 +22,8 @@ import { safeParseJson } from '@dxos/util';
|
|
|
20
22
|
import { ToolBlock, isToolMessage } from './ToolInvocations';
|
|
21
23
|
import { ToolboxContainer } from '../Toolbox';
|
|
22
24
|
|
|
23
|
-
const panelClassNames = 'flex flex-col w-full px-2 bg-
|
|
24
|
-
const userClassNames = 'bg-[--user-fill] text-
|
|
25
|
+
const panelClassNames = 'flex flex-col w-full px-2 bg-activeSurface rounded-md';
|
|
26
|
+
const userClassNames = 'bg-[--user-fill] text-accentSurfaceText';
|
|
25
27
|
|
|
26
28
|
const ToggleContainer = (props: ToggleContainerProps) => {
|
|
27
29
|
return <NativeToggleContainer {...props} classNames={mx(panelClassNames, props.classNames)} />;
|
|
@@ -43,12 +45,20 @@ export type ThreadMessageProps = ThemedClassName<{
|
|
|
43
45
|
space?: Space;
|
|
44
46
|
message: Message;
|
|
45
47
|
debug?: boolean;
|
|
46
|
-
tools?:
|
|
48
|
+
tools?: Tool[];
|
|
47
49
|
onPrompt?: (text: string) => void;
|
|
48
50
|
onDelete?: (id: string) => void;
|
|
51
|
+
onAddToGraph?: (object: BaseEchoObject) => void;
|
|
49
52
|
}>;
|
|
50
53
|
|
|
51
|
-
export const ThreadMessage: FC<ThreadMessageProps> = ({
|
|
54
|
+
export const ThreadMessage: FC<ThreadMessageProps> = ({
|
|
55
|
+
classNames,
|
|
56
|
+
space,
|
|
57
|
+
message,
|
|
58
|
+
tools,
|
|
59
|
+
onPrompt,
|
|
60
|
+
onAddToGraph,
|
|
61
|
+
}) => {
|
|
52
62
|
const { role, content = [] } = message;
|
|
53
63
|
|
|
54
64
|
// TODO(burdon): Restructure types to make check unnecessary.
|
|
@@ -74,13 +84,18 @@ export const ThreadMessage: FC<ThreadMessageProps> = ({ classNames, space, messa
|
|
|
74
84
|
classNames={mx(classNames, 'animate-[fadeIn_0.5s]')}
|
|
75
85
|
user={block.type === 'text' && role === 'user'}
|
|
76
86
|
>
|
|
77
|
-
<Component space={space} block={block} onPrompt={onPrompt} />
|
|
87
|
+
<Component space={space} block={block} onPrompt={onPrompt} onAddToGraph={onAddToGraph} />
|
|
78
88
|
</MessageContainer>
|
|
79
89
|
);
|
|
80
90
|
});
|
|
81
91
|
};
|
|
82
92
|
|
|
83
|
-
type BlockComponent = FC<{
|
|
93
|
+
type BlockComponent = FC<{
|
|
94
|
+
space?: Space;
|
|
95
|
+
block: MessageContentBlock;
|
|
96
|
+
onPrompt?: (text: string) => void;
|
|
97
|
+
onAddToGraph?: (object: BaseEchoObject) => void;
|
|
98
|
+
}>;
|
|
84
99
|
|
|
85
100
|
const components: Record<string, BlockComponent> = {
|
|
86
101
|
//
|
|
@@ -105,7 +120,7 @@ const components: Record<string, BlockComponent> = {
|
|
|
105
120
|
return (
|
|
106
121
|
<ToggleContainer
|
|
107
122
|
// open={open}
|
|
108
|
-
defaultOpen={block.disposition
|
|
123
|
+
defaultOpen={systemDispositions.includes(block.disposition ?? '') && block.pending}
|
|
109
124
|
title={title}
|
|
110
125
|
icon={
|
|
111
126
|
block.pending ? (
|
|
@@ -115,7 +130,7 @@ const components: Record<string, BlockComponent> = {
|
|
|
115
130
|
>
|
|
116
131
|
<MarkdownViewer
|
|
117
132
|
content={block.text}
|
|
118
|
-
classNames={['pbe-2', block.disposition
|
|
133
|
+
classNames={['pbe-2', systemDispositions.includes(block.disposition ?? '') && 'text-sm text-subdued']}
|
|
119
134
|
/>
|
|
120
135
|
</ToggleContainer>
|
|
121
136
|
);
|
|
@@ -124,7 +139,7 @@ const components: Record<string, BlockComponent> = {
|
|
|
124
139
|
//
|
|
125
140
|
// JSON
|
|
126
141
|
//
|
|
127
|
-
['json' as const]: ({ space, block, onPrompt }) => {
|
|
142
|
+
['json' as const]: ({ space, block, onPrompt, onAddToGraph }) => {
|
|
128
143
|
invariant(block.type === 'json');
|
|
129
144
|
|
|
130
145
|
switch (block.disposition) {
|
|
@@ -158,6 +173,26 @@ const components: Record<string, BlockComponent> = {
|
|
|
158
173
|
);
|
|
159
174
|
}
|
|
160
175
|
|
|
176
|
+
case 'graph': {
|
|
177
|
+
return (
|
|
178
|
+
<div className='flex flex-wrap gap-1'>
|
|
179
|
+
<Surface
|
|
180
|
+
role='card'
|
|
181
|
+
data={{ subject: JSON.parse(block.json ?? '{}') }}
|
|
182
|
+
limit={1}
|
|
183
|
+
fallback={<div className='font-mono text-xs text-pre'>{block.json}</div>}
|
|
184
|
+
/>
|
|
185
|
+
{onAddToGraph && (
|
|
186
|
+
<IconButton
|
|
187
|
+
icon='ph--plus--regular'
|
|
188
|
+
label='Add to graph'
|
|
189
|
+
onClick={() => onAddToGraph?.(JSON.parse(block.json ?? '{}'))}
|
|
190
|
+
/>
|
|
191
|
+
)}
|
|
192
|
+
</div>
|
|
193
|
+
);
|
|
194
|
+
}
|
|
195
|
+
|
|
161
196
|
default: {
|
|
162
197
|
const title = block.disposition ? titles[block.disposition] : undefined;
|
|
163
198
|
return (
|
|
@@ -193,4 +228,7 @@ const titles: Record<string, string> = {
|
|
|
193
228
|
['tool_use' as const]: 'Tool request',
|
|
194
229
|
['tool_result' as const]: 'Tool result',
|
|
195
230
|
['tool_list' as const]: 'Tools',
|
|
231
|
+
['artifact-update' as const]: 'Artifact(s) changed',
|
|
196
232
|
};
|
|
233
|
+
|
|
234
|
+
const systemDispositions: string[] = ['cot', 'artifact-update'];
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import React, { type FC, useEffect, useMemo, useRef, useState } from 'react';
|
|
6
6
|
|
|
7
|
-
import { type Message, type
|
|
7
|
+
import { type AgentStatus, type Message, type Tool } from '@dxos/ai';
|
|
8
8
|
import { log } from '@dxos/log';
|
|
9
9
|
import { type ThemedClassName } from '@dxos/react-ui';
|
|
10
10
|
import { NumericTabs, StatusRoll, ToggleContainer } from '@dxos/react-ui-components';
|
|
@@ -17,22 +17,22 @@ export const isToolMessage = (message: Message) => {
|
|
|
17
17
|
return message.content.some((block) => block.type === 'tool_use' || block.type === 'tool_result');
|
|
18
18
|
};
|
|
19
19
|
|
|
20
|
-
const getToolName = (tool:
|
|
20
|
+
const getToolName = (tool: Tool) => {
|
|
21
21
|
return tool.namespace && tool.function ? `${tool.namespace}:${tool.function}` : tool.name.split('_').pop();
|
|
22
22
|
};
|
|
23
23
|
|
|
24
|
-
const getToolCaption = (tool:
|
|
24
|
+
const getToolCaption = (tool: Tool | undefined, status: AgentStatus | undefined) => {
|
|
25
25
|
if (!tool) {
|
|
26
26
|
return 'Calling tool...';
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
return tool.caption ?? `Calling ${getToolName(tool)}...`;
|
|
29
|
+
return status?.message ?? tool.caption ?? `Calling ${getToolName(tool)}...`;
|
|
30
30
|
};
|
|
31
31
|
|
|
32
32
|
export const ToolBlock: FC<ThemedClassName<ThreadMessageProps>> = ({ classNames, message, tools }) => {
|
|
33
33
|
const { content = [] } = message;
|
|
34
34
|
|
|
35
|
-
let request: { tool:
|
|
35
|
+
let request: { tool: Tool | undefined; block: any } | undefined;
|
|
36
36
|
const blocks = content.filter((block) => block.type === 'tool_use' || block.type === 'tool_result');
|
|
37
37
|
const items = blocks
|
|
38
38
|
.map((block) => {
|
|
@@ -43,8 +43,10 @@ export const ToolBlock: FC<ThemedClassName<ThreadMessageProps>> = ({ classNames,
|
|
|
43
43
|
return null;
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
+
log.info('tool_use', { tool: request?.tool, status: block.currentStatus });
|
|
47
|
+
|
|
46
48
|
request = { tool: tools?.find((tool) => tool.name === block.name), block };
|
|
47
|
-
return { title: getToolCaption(request.tool), block };
|
|
49
|
+
return { title: getToolCaption(request.tool, block.currentStatus), block };
|
|
48
50
|
}
|
|
49
51
|
|
|
50
52
|
case 'tool_result': {
|
|
@@ -53,7 +55,7 @@ export const ToolBlock: FC<ThemedClassName<ThreadMessageProps>> = ({ classNames,
|
|
|
53
55
|
return { title: 'Error', block };
|
|
54
56
|
}
|
|
55
57
|
|
|
56
|
-
return { title: `${getToolCaption(request.tool)} (Success)`, block };
|
|
58
|
+
return { title: `${getToolCaption(request.tool, undefined)} (Success)`, block };
|
|
57
59
|
}
|
|
58
60
|
|
|
59
61
|
default: {
|
|
@@ -32,7 +32,7 @@ const DefaultStory = (props: ToolboxProps) => {
|
|
|
32
32
|
};
|
|
33
33
|
|
|
34
34
|
const meta: Meta<typeof Toolbox> = {
|
|
35
|
-
title: 'plugins/plugin-
|
|
35
|
+
title: 'plugins/plugin-assistant/Toolbox',
|
|
36
36
|
component: Toolbox,
|
|
37
37
|
render: DefaultStory,
|
|
38
38
|
decorators: [
|
|
@@ -44,7 +44,7 @@ const meta: Meta<typeof Toolbox> = {
|
|
|
44
44
|
await client.halo.createIdentity();
|
|
45
45
|
},
|
|
46
46
|
}),
|
|
47
|
-
SpacePlugin(
|
|
47
|
+
SpacePlugin(),
|
|
48
48
|
SettingsPlugin(),
|
|
49
49
|
IntentPlugin(),
|
|
50
50
|
ChessPlugin(),
|
|
@@ -54,11 +54,11 @@ const meta: Meta<typeof Toolbox> = {
|
|
|
54
54
|
capabilities,
|
|
55
55
|
}),
|
|
56
56
|
withTheme,
|
|
57
|
-
withLayout(
|
|
57
|
+
withLayout(),
|
|
58
58
|
],
|
|
59
59
|
parameters: {
|
|
60
|
-
translations,
|
|
61
60
|
layout: 'centered',
|
|
61
|
+
translations,
|
|
62
62
|
},
|
|
63
63
|
};
|
|
64
64
|
|
|
@@ -4,9 +4,10 @@
|
|
|
4
4
|
|
|
5
5
|
import React, { useState, useEffect, Fragment, type FC } from 'react';
|
|
6
6
|
|
|
7
|
+
import { parseToolName, type Tool } from '@dxos/ai';
|
|
7
8
|
import { Capabilities, useCapabilities } from '@dxos/app-framework';
|
|
8
|
-
import {
|
|
9
|
-
import { FunctionType } from '@dxos/functions
|
|
9
|
+
import { type ArtifactDefinition } from '@dxos/artifact';
|
|
10
|
+
import { FunctionType } from '@dxos/functions';
|
|
10
11
|
import { log } from '@dxos/log';
|
|
11
12
|
import { Filter, type Space, useQuery } from '@dxos/react-client/echo';
|
|
12
13
|
import { type ThemedClassName } from '@dxos/react-ui';
|
|
@@ -93,7 +94,7 @@ export const ToolboxContainer = ({ classNames, space }: ThemedClassName<{ space?
|
|
|
93
94
|
const artifactDefinitions = useCapabilities(Capabilities.ArtifactDefinition);
|
|
94
95
|
|
|
95
96
|
// Registered services.
|
|
96
|
-
const services = useQuery(space, Filter.
|
|
97
|
+
const services = useQuery(space, Filter.type(ServiceType));
|
|
97
98
|
const [serviceTools, setServiceTools] = useState<{ service: ServiceType; tools: Tool[] }[]>([]);
|
|
98
99
|
useEffect(() => {
|
|
99
100
|
log('creating service tools...', { services: services.length });
|
|
@@ -107,7 +108,7 @@ export const ToolboxContainer = ({ classNames, space }: ThemedClassName<{ space?
|
|
|
107
108
|
}, [services]);
|
|
108
109
|
|
|
109
110
|
// Deployed functions.
|
|
110
|
-
const functions = useQuery(space, Filter.
|
|
111
|
+
const functions = useQuery(space, Filter.type(FunctionType));
|
|
111
112
|
|
|
112
113
|
return (
|
|
113
114
|
<Toolbox classNames={classNames} artifacts={artifactDefinitions} services={serviceTools} functions={functions} />
|
package/src/components/index.ts
CHANGED
|
@@ -4,8 +4,10 @@
|
|
|
4
4
|
|
|
5
5
|
import { lazy } from 'react';
|
|
6
6
|
|
|
7
|
+
export * from './AmbientDialog';
|
|
7
8
|
export * from './AssistantSettings';
|
|
8
|
-
export * from './
|
|
9
|
+
export * from './Prompt';
|
|
10
|
+
export * from './PromptSettings';
|
|
9
11
|
export * from './TemplateEditor';
|
|
10
12
|
export * from './Thread';
|
|
11
13
|
export * from './Toolbox';
|