@dxos/plugin-assistant 0.8.2-main.f11618f → 0.8.2-staging.42af850
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/{node-esm/ChatContainer-XPNXNPSW.mjs.map → browser/ChatContainer-QTO4LE2C.mjs.map} +1 -1
- package/dist/lib/browser/TemplateContainer-AKUYL4AV.mjs +28 -0
- package/dist/lib/{node-esm/TemplateContainer-3LEBT5ZC.mjs.map → browser/TemplateContainer-AKUYL4AV.mjs.map} +1 -1
- package/dist/lib/browser/{ai-client-OK5SMYJC.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-7CAHKTZQ.mjs → chunk-QTW7KVDO.mjs} +1665 -1547
- 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 +24 -10
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/{intent-resolver-W6XREK5F.mjs → intent-resolver-63EAHENI.mjs} +7 -11
- 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-LAJZQI4H.mjs → settings-SHNQ4XXP.mjs} +3 -3
- package/dist/lib/browser/types/index.mjs +4 -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-U6AVMAHY.cjs → ChatContainer-5CLHJOIQ.cjs} +25 -19
- package/dist/lib/node/{ChatContainer-U6AVMAHY.cjs.map → ChatContainer-5CLHJOIQ.cjs.map} +1 -1
- package/dist/lib/node/{TemplateContainer-EQXKHWTF.cjs → TemplateContainer-CTG2MB4W.cjs} +18 -12
- package/dist/lib/node/{TemplateContainer-EQXKHWTF.cjs.map → TemplateContainer-CTG2MB4W.cjs.map} +1 -1
- package/dist/lib/node/{ai-client-3EVTLXTT.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-CWHFK36A.cjs → chunk-H4A42LNR.cjs} +1154 -1030
- 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 +72 -59
- package/dist/lib/node/index.cjs.map +3 -3
- package/dist/lib/node/{intent-resolver-MUJMV7II.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-NPXTE6ND.cjs → settings-ERKLO6IO.cjs} +8 -8
- package/dist/lib/node/types/index.cjs +16 -14
- 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/{browser/ChatContainer-GAYN3FEF.mjs.map → node-esm/ChatContainer-QTC5NYE2.mjs.map} +1 -1
- package/dist/lib/node-esm/TemplateContainer-IVDQ4XQG.mjs +29 -0
- package/dist/lib/{browser/TemplateContainer-WKU5XFSO.mjs.map → node-esm/TemplateContainer-IVDQ4XQG.mjs.map} +1 -1
- package/dist/lib/node-esm/{ai-client-LYCBXZI7.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-XFUXN5QU.mjs → chunk-SI5LOQEO.mjs} +1665 -1547
- 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 +24 -10
- package/dist/lib/node-esm/index.mjs.map +3 -3
- package/dist/lib/node-esm/{intent-resolver-DZY2O2DG.mjs → intent-resolver-X3PWH7KM.mjs} +7 -11
- 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-K3JDH2I5.mjs → settings-IVQRZUCU.mjs} +3 -3
- package/dist/lib/node-esm/types/index.mjs +4 -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 +2 -178
- 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/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.map +1 -1
- 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 +2 -0
- 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 -7
- 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 +3 -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 +24 -21
- 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 +5 -4
- package/src/capabilities/ai-client.ts +5 -5
- package/src/capabilities/app-graph-builder.ts +179 -109
- package/src/capabilities/capabilities.ts +1 -1
- package/src/capabilities/intent-resolver.ts +4 -6
- package/src/capabilities/react-surface.tsx +58 -13
- 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 +1 -1
- 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/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 +2 -2
- package/src/components/TemplateEditor/TemplateEditor.stories.tsx +2 -2
- package/src/components/TemplateEditor/TemplateForm.stories.tsx +1 -1
- 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 +79 -49
- package/src/components/Thread/ThreadContainer.tsx +8 -9
- package/src/components/Thread/ThreadMessage.tsx +44 -9
- package/src/components/Thread/ToolInvocations.tsx +9 -7
- package/src/components/Thread/reducer.ts +1 -1
- package/src/components/Toolbox/Toolbox.stories.tsx +3 -3
- package/src/components/Toolbox/Toolbox.tsx +5 -4
- package/src/components/index.ts +2 -0
- package/src/experimental/transcription/index.ts +3 -0
- package/src/hooks/index.ts +0 -1
- package/src/hooks/processor.ts +65 -27
- package/src/hooks/useChatProcessor.tsx +9 -9
- 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/tools/function.ts +11 -12
- package/src/tools/openapi.test.ts +18 -19
- package/src/tools/openapi.ts +24 -17
- package/src/translations.ts +4 -2
- 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 +20 -18
- package/dist/lib/browser/AssistantDialog-I47GUXWR.mjs +0 -117
- package/dist/lib/browser/AssistantDialog-I47GUXWR.mjs.map +0 -7
- package/dist/lib/browser/ChatContainer-GAYN3FEF.mjs +0 -33
- package/dist/lib/browser/TemplateContainer-WKU5XFSO.mjs +0 -22
- package/dist/lib/browser/ai-client-OK5SMYJC.mjs.map +0 -7
- package/dist/lib/browser/app-graph-builder-ZXKGE3H5.mjs +0 -179
- package/dist/lib/browser/app-graph-builder-ZXKGE3H5.mjs.map +0 -7
- package/dist/lib/browser/chunk-7CAHKTZQ.mjs.map +0 -7
- package/dist/lib/browser/chunk-BGMQ2YYP.mjs +0 -143
- package/dist/lib/browser/chunk-BGMQ2YYP.mjs.map +0 -7
- package/dist/lib/browser/chunk-E7BN4QKP.mjs +0 -190
- package/dist/lib/browser/chunk-E7BN4QKP.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-W6XREK5F.mjs.map +0 -7
- package/dist/lib/browser/react-surface-QMI5KG4H.mjs +0 -90
- package/dist/lib/browser/react-surface-QMI5KG4H.mjs.map +0 -7
- package/dist/lib/node/AssistantDialog-SDS2TE5L.cjs +0 -141
- package/dist/lib/node/AssistantDialog-SDS2TE5L.cjs.map +0 -7
- package/dist/lib/node/ai-client-3EVTLXTT.cjs.map +0 -7
- package/dist/lib/node/app-graph-builder-TXHPXIIC.cjs +0 -190
- package/dist/lib/node/app-graph-builder-TXHPXIIC.cjs.map +0 -7
- package/dist/lib/node/chunk-5UELRDHQ.cjs +0 -214
- package/dist/lib/node/chunk-5UELRDHQ.cjs.map +0 -7
- package/dist/lib/node/chunk-CWHFK36A.cjs.map +0 -7
- package/dist/lib/node/chunk-GBUNQ257.cjs.map +0 -7
- package/dist/lib/node/chunk-XBJO453B.cjs +0 -169
- package/dist/lib/node/chunk-XBJO453B.cjs.map +0 -7
- package/dist/lib/node/intent-resolver-MUJMV7II.cjs.map +0 -7
- package/dist/lib/node/react-surface-SAJF4XBB.cjs +0 -106
- package/dist/lib/node/react-surface-SAJF4XBB.cjs.map +0 -7
- package/dist/lib/node-esm/AssistantDialog-KGA5HBFO.mjs +0 -118
- package/dist/lib/node-esm/AssistantDialog-KGA5HBFO.mjs.map +0 -7
- package/dist/lib/node-esm/ChatContainer-XPNXNPSW.mjs +0 -34
- package/dist/lib/node-esm/TemplateContainer-3LEBT5ZC.mjs +0 -23
- package/dist/lib/node-esm/ai-client-LYCBXZI7.mjs.map +0 -7
- package/dist/lib/node-esm/app-graph-builder-SV4WC2E2.mjs +0 -180
- package/dist/lib/node-esm/app-graph-builder-SV4WC2E2.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-6JK5HEUQ.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-ECYNZYEG.mjs +0 -191
- package/dist/lib/node-esm/chunk-ECYNZYEG.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-R7Q3OHWG.mjs +0 -144
- package/dist/lib/node-esm/chunk-R7Q3OHWG.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-XFUXN5QU.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-DZY2O2DG.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-R43NHNMC.mjs +0 -91
- package/dist/lib/node-esm/react-surface-R43NHNMC.mjs.map +0 -7
- 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/hooks/invocation-handler.ts +0 -107
- package/src/hooks/useLocalTriggerManager.ts +0 -82
- /package/dist/lib/browser/{settings-LAJZQI4H.mjs.map → settings-SHNQ4XXP.mjs.map} +0 -0
- /package/dist/lib/node/{settings-NPXTE6ND.cjs.map → settings-ERKLO6IO.cjs.map} +0 -0
- /package/dist/lib/node-esm/{settings-K3JDH2I5.mjs.map → settings-IVQRZUCU.mjs.map} +0 -0
|
@@ -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,22 +18,22 @@ 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 { create, 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 } 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 {
|
|
33
|
+
import { useClient } from '@dxos/react-client';
|
|
34
|
+
import { useQueue, useQuery } from '@dxos/react-client/echo';
|
|
34
35
|
import { IconButton, Input, Toolbar } from '@dxos/react-ui';
|
|
35
|
-
import { mx } from '@dxos/react-ui-theme';
|
|
36
|
+
import { descriptionMessage, mx } from '@dxos/react-ui-theme';
|
|
36
37
|
import { withLayout, withTheme } from '@dxos/storybook-utils';
|
|
37
38
|
|
|
38
39
|
import { Thread, type ThreadProps } from './Thread';
|
|
@@ -40,18 +41,22 @@ import { ChatProcessor } from '../../hooks';
|
|
|
40
41
|
import { createProcessorOptions } from '../../testing';
|
|
41
42
|
import translations from '../../translations';
|
|
42
43
|
|
|
43
|
-
|
|
44
|
+
// TODO(burdon): Configure for local with ollama/LM studio.
|
|
45
|
+
// const endpoints = localServiceEndpoints;
|
|
46
|
+
const endpoints = remoteServiceEndpoints;
|
|
44
47
|
|
|
45
48
|
type RenderProps = {
|
|
46
|
-
items?:
|
|
49
|
+
items?: Obj.Any[];
|
|
47
50
|
prompts?: string[];
|
|
48
51
|
} & Pick<ThreadProps, 'debug'>;
|
|
49
52
|
|
|
50
53
|
// TODO(burdon): Use ChatContainer.
|
|
51
54
|
const DefaultStory = ({ items: _items, prompts = [], ...props }: RenderProps) => {
|
|
52
|
-
const
|
|
55
|
+
const client = useClient();
|
|
56
|
+
const space = client.spaces.default;
|
|
57
|
+
|
|
53
58
|
const artifactDefinitions = useCapabilities(Capabilities.ArtifactDefinition);
|
|
54
|
-
const tools =
|
|
59
|
+
const tools = useCapabilities(Capabilities.Tools);
|
|
55
60
|
|
|
56
61
|
const [aiClient] = useState(() => new AIServiceEdgeClient({ endpoint: endpoints.ai }));
|
|
57
62
|
const { dispatchPromise: dispatch } = useIntentDispatcher();
|
|
@@ -65,7 +70,7 @@ const DefaultStory = ({ items: _items, prompts = [], ...props }: RenderProps) =>
|
|
|
65
70
|
|
|
66
71
|
return new ChatProcessor(
|
|
67
72
|
aiClient,
|
|
68
|
-
tools,
|
|
73
|
+
tools.flat(),
|
|
69
74
|
artifactDefinitions,
|
|
70
75
|
{
|
|
71
76
|
space,
|
|
@@ -76,11 +81,17 @@ const DefaultStory = ({ items: _items, prompts = [], ...props }: RenderProps) =>
|
|
|
76
81
|
}, [aiClient, tools, space, dispatch, artifactDefinitions]);
|
|
77
82
|
|
|
78
83
|
// Queue.
|
|
79
|
-
const [queueDxn, setQueueDxn] = useState<string>(() => createQueueDxn().toString());
|
|
80
|
-
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));
|
|
86
|
+
|
|
87
|
+
useEffect(() => {
|
|
88
|
+
if (space) {
|
|
89
|
+
setQueueDxn(createQueueDxn(space.id).toString());
|
|
90
|
+
}
|
|
91
|
+
}, [space]);
|
|
81
92
|
|
|
82
93
|
useEffect(() => {
|
|
83
|
-
if (queue?.
|
|
94
|
+
if (queue?.objects.length === 0 && !queue.isLoading && prompts.length > 0) {
|
|
84
95
|
queue.append([
|
|
85
96
|
create(Message, {
|
|
86
97
|
role: 'assistant',
|
|
@@ -95,48 +106,52 @@ const DefaultStory = ({ items: _items, prompts = [], ...props }: RenderProps) =>
|
|
|
95
106
|
}),
|
|
96
107
|
]);
|
|
97
108
|
}
|
|
98
|
-
}, [queueDxn, prompts, queue?.
|
|
109
|
+
}, [queueDxn, prompts, queue?.objects.length, queue?.isLoading]);
|
|
99
110
|
|
|
100
111
|
// State.
|
|
101
|
-
const
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
});
|
|
119
|
-
});
|
|
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
|
+
}
|
|
125
|
+
|
|
126
|
+
if (processor.streaming.value) {
|
|
127
|
+
await processor.cancel();
|
|
128
|
+
}
|
|
120
129
|
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
130
|
+
await processor.request(message, {
|
|
131
|
+
history: queue.objects,
|
|
132
|
+
onComplete: (messages) => {
|
|
133
|
+
queue.append(messages);
|
|
134
|
+
},
|
|
135
|
+
});
|
|
136
|
+
});
|
|
124
137
|
|
|
125
|
-
|
|
126
|
-
(text: string) => {
|
|
127
|
-
void handleSubmit?.(text);
|
|
138
|
+
return true;
|
|
128
139
|
},
|
|
129
|
-
[
|
|
140
|
+
[processor, queue],
|
|
130
141
|
);
|
|
131
142
|
|
|
132
143
|
const handleDelete = useCallback(
|
|
133
144
|
(id: string) => {
|
|
134
|
-
invariant(ObjectId.isValid(id), 'Invalid message id');
|
|
145
|
+
invariant(Type.ObjectId.isValid(id), 'Invalid message id');
|
|
135
146
|
void queue?.delete([id]);
|
|
136
147
|
},
|
|
137
148
|
[queue],
|
|
138
149
|
);
|
|
139
150
|
|
|
151
|
+
if (!space) {
|
|
152
|
+
return <></>;
|
|
153
|
+
}
|
|
154
|
+
|
|
140
155
|
return (
|
|
141
156
|
<div className='grid grid-cols-2 w-full h-full divide-x divide-separator overflow-hidden'>
|
|
142
157
|
{/* Thread */}
|
|
@@ -159,7 +174,7 @@ const DefaultStory = ({ items: _items, prompts = [], ...props }: RenderProps) =>
|
|
|
159
174
|
iconOnly
|
|
160
175
|
label='Clear history'
|
|
161
176
|
icon='ph--trash--regular'
|
|
162
|
-
onClick={() => setQueueDxn(createQueueDxn().toString())}
|
|
177
|
+
onClick={() => setQueueDxn(createQueueDxn(space.id).toString())}
|
|
163
178
|
/>
|
|
164
179
|
<IconButton iconOnly label='Stop' icon='ph--stop--regular' onClick={() => processor?.cancel()} />
|
|
165
180
|
</Input.Root>
|
|
@@ -172,7 +187,7 @@ const DefaultStory = ({ items: _items, prompts = [], ...props }: RenderProps) =>
|
|
|
172
187
|
error={processor?.error.value}
|
|
173
188
|
tools={processor?.tools}
|
|
174
189
|
onSubmit={processor ? handleSubmit : undefined}
|
|
175
|
-
onPrompt={processor ?
|
|
190
|
+
onPrompt={processor ? handleSubmit : undefined}
|
|
176
191
|
onDelete={processor ? handleDelete : undefined}
|
|
177
192
|
{...props}
|
|
178
193
|
/>
|
|
@@ -182,7 +197,7 @@ const DefaultStory = ({ items: _items, prompts = [], ...props }: RenderProps) =>
|
|
|
182
197
|
<div className='overflow-hidden grid grid-rows-[2fr_1fr] divide-y divide-separator'>
|
|
183
198
|
{artifactItems.length > 0 && (
|
|
184
199
|
<div className={mx('flex grow overflow-hidden', artifactItems.length === 1 && 'row-span-2')}>
|
|
185
|
-
<Surface role='
|
|
200
|
+
<Surface role='article' limit={1} data={{ subject: artifactItems[0] }} fallback={Fallback} />
|
|
186
201
|
</div>
|
|
187
202
|
)}
|
|
188
203
|
|
|
@@ -190,7 +205,7 @@ const DefaultStory = ({ items: _items, prompts = [], ...props }: RenderProps) =>
|
|
|
190
205
|
<div className='flex shrink-0 overflow-hidden divide-x divide-separator'>
|
|
191
206
|
<div className='flex flex-1 h-full'>
|
|
192
207
|
{artifactItems.slice(1, 3).map((item, idx) => (
|
|
193
|
-
<Surface key={idx} role='
|
|
208
|
+
<Surface key={idx} role='article' limit={1} data={{ subject: item }} fallback={Fallback} />
|
|
194
209
|
))}
|
|
195
210
|
</div>
|
|
196
211
|
</div>
|
|
@@ -201,7 +216,7 @@ const DefaultStory = ({ items: _items, prompts = [], ...props }: RenderProps) =>
|
|
|
201
216
|
};
|
|
202
217
|
|
|
203
218
|
const meta: Meta<typeof DefaultStory> = {
|
|
204
|
-
title: 'plugins/plugin-
|
|
219
|
+
title: 'plugins/plugin-assistant/ThreadContainer',
|
|
205
220
|
render: DefaultStory,
|
|
206
221
|
decorators: [
|
|
207
222
|
withPluginManager({
|
|
@@ -219,12 +234,13 @@ const meta: Meta<typeof DefaultStory> = {
|
|
|
219
234
|
ChessPlugin(),
|
|
220
235
|
InboxPlugin(),
|
|
221
236
|
MapPlugin(),
|
|
237
|
+
MarkdownPlugin(),
|
|
222
238
|
TablePlugin(),
|
|
223
239
|
],
|
|
224
240
|
fireEvents: [Events.SetupArtifactDefinition],
|
|
225
241
|
}),
|
|
226
242
|
withTheme,
|
|
227
|
-
withLayout({ fullscreen: true
|
|
243
|
+
withLayout({ fullscreen: true }),
|
|
228
244
|
],
|
|
229
245
|
parameters: {
|
|
230
246
|
translations,
|
|
@@ -252,3 +268,17 @@ export const WithInitialItems: Story = {
|
|
|
252
268
|
],
|
|
253
269
|
},
|
|
254
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
|
+
};
|
|
@@ -8,7 +8,7 @@ import { CollaborationActions, createIntent, useIntentDispatcher } from '@dxos/a
|
|
|
8
8
|
import { type AssociatedArtifact } from '@dxos/artifact';
|
|
9
9
|
import { invariant } from '@dxos/invariant';
|
|
10
10
|
import { DXN } from '@dxos/keys';
|
|
11
|
-
import {
|
|
11
|
+
import { refFromDXN } from '@dxos/live-object';
|
|
12
12
|
import { log } from '@dxos/log';
|
|
13
13
|
import { getSpace } from '@dxos/react-client/echo';
|
|
14
14
|
import { type ThemedClassName } from '@dxos/react-ui';
|
|
@@ -22,7 +22,7 @@ export type ThreadContainerProps = {
|
|
|
22
22
|
settings?: AssistantSettingsProps;
|
|
23
23
|
part?: 'deck' | 'dialog';
|
|
24
24
|
associatedArtifact?: AssociatedArtifact;
|
|
25
|
-
} & Pick<ThreadProps, 'debug' | 'transcription' | 'onOpenChange'>;
|
|
25
|
+
} & Pick<ThreadProps, 'debug' | 'transcription' | 'onOpenChange' | 'onAddToGraph'>;
|
|
26
26
|
|
|
27
27
|
// TODO(burdon): Since this only wraps Thread, just separate out hook?
|
|
28
28
|
export const ThreadContainer: FC<ThemedClassName<ThreadContainerProps>> = ({
|
|
@@ -40,18 +40,17 @@ export const ThreadContainer: FC<ThemedClassName<ThreadContainerProps>> = ({
|
|
|
40
40
|
const messageQueue = useMessageQueue(chat);
|
|
41
41
|
const { dispatchPromise: dispatch } = useIntentDispatcher();
|
|
42
42
|
// TODO(thure): This will be referentially new on every render, is it causing overreactivity?
|
|
43
|
-
const messages = [...(messageQueue?.
|
|
43
|
+
const messages = [...(messageQueue?.objects ?? []), ...processor.messages.value];
|
|
44
44
|
|
|
45
45
|
// Post last message to document.
|
|
46
46
|
useEffect(() => {
|
|
47
|
-
if (!processor.streaming.value && messageQueue?.
|
|
48
|
-
const message = messageQueue.
|
|
47
|
+
if (!processor.streaming.value && messageQueue?.objects) {
|
|
48
|
+
const message = messageQueue.objects[messageQueue.objects.length - 1];
|
|
49
49
|
if (space && chat && message && dispatch && associatedArtifact) {
|
|
50
50
|
void dispatch(
|
|
51
51
|
createIntent(CollaborationActions.InsertContent, {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
object: refFromDXN(new DXN(DXN.kind.QUEUE, [...chat.assistantChatQueue.dxn.parts, message.id])),
|
|
52
|
+
target: associatedArtifact,
|
|
53
|
+
object: refFromDXN(new DXN(DXN.kind.QUEUE, [...chat.queue.dxn.parts, message.id])),
|
|
55
54
|
label: 'View proposal',
|
|
56
55
|
}),
|
|
57
56
|
);
|
|
@@ -71,7 +70,7 @@ export const ThreadContainer: FC<ThemedClassName<ThreadContainerProps>> = ({
|
|
|
71
70
|
|
|
72
71
|
invariant(messageQueue);
|
|
73
72
|
void processor.request(text, {
|
|
74
|
-
history: messageQueue.
|
|
73
|
+
history: messageQueue.objects,
|
|
75
74
|
onComplete: (messages) => {
|
|
76
75
|
messageQueue.append(messages);
|
|
77
76
|
},
|
|
@@ -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
|
//
|
|
@@ -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 (
|
|
@@ -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: [
|
|
@@ -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