@dxos/plugin-assistant 0.8.4-main.e098934 → 0.8.4-main.e8ec1fe
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/BlueprintArticle-IMCR3642.mjs +36 -0
- package/dist/lib/browser/BlueprintArticle-IMCR3642.mjs.map +7 -0
- package/dist/lib/browser/ChatCompanion-JYD2RIBJ.mjs +158 -0
- package/dist/lib/browser/ChatCompanion-JYD2RIBJ.mjs.map +7 -0
- package/dist/lib/browser/{ChatContainer-XIVJTCC2.mjs → ChatContainer-XCPBWYIR.mjs} +22 -20
- package/dist/lib/browser/ChatContainer-XCPBWYIR.mjs.map +7 -0
- package/dist/lib/browser/{ChatDialog-EJJMK3WL.mjs → ChatDialog-DT7KFCRL.mjs} +8 -6
- package/dist/lib/browser/ChatDialog-DT7KFCRL.mjs.map +7 -0
- package/dist/lib/browser/PromptArticle-45QX25Y5.mjs +59 -0
- package/dist/lib/browser/PromptArticle-45QX25Y5.mjs.map +7 -0
- package/dist/lib/browser/ai-service-ERTZBTP3.mjs +19 -0
- package/dist/lib/browser/ai-service-ERTZBTP3.mjs.map +7 -0
- package/dist/lib/browser/{app-graph-builder-3C43MLCD.mjs → app-graph-builder-VZEXMDTY.mjs} +67 -21
- package/dist/lib/browser/app-graph-builder-VZEXMDTY.mjs.map +7 -0
- package/dist/lib/browser/{blueprint-definition-VHFSRTEJ.mjs → blueprint-definition-5FT5JGPY.mjs} +4 -4
- package/dist/lib/browser/chunk-2BOE3OTW.mjs +262 -0
- package/dist/lib/browser/chunk-2BOE3OTW.mjs.map +7 -0
- package/dist/lib/browser/{chunk-SMIVXXAI.mjs → chunk-BNTPFZ7O.mjs} +51 -24
- package/dist/lib/browser/chunk-BNTPFZ7O.mjs.map +7 -0
- package/dist/lib/browser/chunk-FJQ4ZRYJ.mjs +335 -0
- package/dist/lib/browser/chunk-FJQ4ZRYJ.mjs.map +7 -0
- package/dist/lib/browser/{chunk-GLWD66TA.mjs → chunk-IXIIS4QA.mjs} +53 -38
- package/dist/lib/browser/chunk-IXIIS4QA.mjs.map +7 -0
- package/dist/lib/browser/{chunk-EZUSNS2J.mjs → chunk-LRE4VEZV.mjs} +2 -5
- package/dist/lib/browser/chunk-LRE4VEZV.mjs.map +7 -0
- package/dist/lib/browser/chunk-U62BTGDF.mjs +1929 -0
- package/dist/lib/browser/chunk-U62BTGDF.mjs.map +7 -0
- package/dist/lib/browser/chunk-WBG5PTSX.mjs +23 -0
- package/dist/lib/browser/chunk-WBG5PTSX.mjs.map +7 -0
- package/dist/lib/browser/edge-model-resolver-O6OFYIO2.mjs +18 -0
- package/dist/lib/browser/edge-model-resolver-O6OFYIO2.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +117 -82
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/{intent-resolver-I6M3ZDAS.mjs → intent-resolver-AK5O4GUW.mjs} +55 -24
- package/dist/lib/browser/intent-resolver-AK5O4GUW.mjs.map +7 -0
- package/dist/lib/browser/local-model-resolver-34MVHRKD.mjs +17 -0
- package/dist/lib/browser/local-model-resolver-34MVHRKD.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/{react-surface-E4NAGB6R.mjs → react-surface-YCSR2MSR.mjs} +24 -35
- package/dist/lib/browser/react-surface-YCSR2MSR.mjs.map +7 -0
- package/dist/lib/browser/{settings-36V3VUMW.mjs → settings-NYJGNQ5I.mjs} +5 -5
- package/dist/lib/browser/{settings-36V3VUMW.mjs.map → settings-NYJGNQ5I.mjs.map} +1 -1
- package/dist/lib/browser/{state-AINRYS5W.mjs → state-GG7Z3NB7.mjs} +9 -5
- package/dist/lib/browser/{state-AINRYS5W.mjs.map → state-GG7Z3NB7.mjs.map} +3 -3
- package/dist/lib/browser/toolkit-VYDAWNE4.mjs +17 -0
- package/dist/lib/browser/toolkit-VYDAWNE4.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +2 -2
- package/dist/lib/node-esm/BlueprintArticle-OL2HUY6Q.mjs +37 -0
- package/dist/lib/node-esm/BlueprintArticle-OL2HUY6Q.mjs.map +7 -0
- package/dist/lib/node-esm/ChatCompanion-AHKJS25S.mjs +159 -0
- package/dist/lib/node-esm/ChatCompanion-AHKJS25S.mjs.map +7 -0
- package/dist/lib/node-esm/{ChatContainer-LMMMQD4K.mjs → ChatContainer-K7OGPE3G.mjs} +22 -20
- package/dist/lib/node-esm/ChatContainer-K7OGPE3G.mjs.map +7 -0
- package/dist/lib/node-esm/{ChatDialog-UUE3F7BT.mjs → ChatDialog-QT6ZBX45.mjs} +8 -6
- package/dist/lib/node-esm/ChatDialog-QT6ZBX45.mjs.map +7 -0
- package/dist/lib/node-esm/PromptArticle-OUKFSJQV.mjs +60 -0
- package/dist/lib/node-esm/PromptArticle-OUKFSJQV.mjs.map +7 -0
- package/dist/lib/node-esm/ai-service-MUYLV3NT.mjs +20 -0
- package/dist/lib/node-esm/ai-service-MUYLV3NT.mjs.map +7 -0
- package/dist/lib/node-esm/{app-graph-builder-NM3JDLQ2.mjs → app-graph-builder-VRN6ESRR.mjs} +67 -21
- package/dist/lib/node-esm/app-graph-builder-VRN6ESRR.mjs.map +7 -0
- package/dist/lib/node-esm/{blueprint-definition-4E6XTLVN.mjs → blueprint-definition-XW6QQVLV.mjs} +4 -4
- package/dist/lib/node-esm/chunk-3Q22TTXW.mjs +264 -0
- package/dist/lib/node-esm/chunk-3Q22TTXW.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-7YOGZI66.mjs → chunk-AB74FOA2.mjs} +51 -24
- package/dist/lib/node-esm/chunk-AB74FOA2.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-BHS747K7.mjs +1930 -0
- package/dist/lib/node-esm/chunk-BHS747K7.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-KJGD4EBJ.mjs +336 -0
- package/dist/lib/node-esm/chunk-KJGD4EBJ.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-QG2KT3AT.mjs → chunk-UXTUHH24.mjs} +53 -38
- package/dist/lib/node-esm/chunk-UXTUHH24.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-WE6KTH72.mjs +25 -0
- package/dist/lib/node-esm/chunk-WE6KTH72.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-XD4CDA4R.mjs → chunk-YWFWT57N.mjs} +2 -5
- package/dist/lib/node-esm/chunk-YWFWT57N.mjs.map +7 -0
- package/dist/lib/node-esm/edge-model-resolver-2ARXDOYS.mjs +19 -0
- package/dist/lib/node-esm/edge-model-resolver-2ARXDOYS.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +117 -82
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/{intent-resolver-VIINHFMT.mjs → intent-resolver-L2F3N45L.mjs} +55 -24
- package/dist/lib/node-esm/intent-resolver-L2F3N45L.mjs.map +7 -0
- package/dist/lib/node-esm/local-model-resolver-TP2NTSAX.mjs +18 -0
- package/dist/lib/node-esm/local-model-resolver-TP2NTSAX.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/{react-surface-5WQLRTCH.mjs → react-surface-CTW44GEM.mjs} +24 -35
- package/dist/lib/node-esm/react-surface-CTW44GEM.mjs.map +7 -0
- package/dist/lib/node-esm/{settings-7ZCZ6AS5.mjs → settings-RRHYI5KO.mjs} +5 -5
- package/dist/lib/node-esm/{settings-7ZCZ6AS5.mjs.map → settings-RRHYI5KO.mjs.map} +1 -1
- package/dist/lib/node-esm/{state-EQS5KP6M.mjs → state-FSUHFMDM.mjs} +9 -5
- package/dist/lib/node-esm/{state-EQS5KP6M.mjs.map → state-FSUHFMDM.mjs.map} +3 -3
- package/dist/lib/node-esm/toolkit-HFJZLVIR.mjs +18 -0
- package/dist/lib/node-esm/toolkit-HFJZLVIR.mjs.map +7 -0
- package/dist/lib/node-esm/types/index.mjs +2 -2
- package/dist/types/src/AssistantPlugin.d.ts +1 -1
- package/dist/types/src/AssistantPlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/ai-service.d.ts +2 -3
- package/dist/types/src/capabilities/ai-service.d.ts.map +1 -1
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
- package/dist/types/src/capabilities/blueprint-definition.d.ts +1 -1
- package/dist/types/src/capabilities/blueprint-definition.d.ts.map +1 -1
- package/dist/types/src/capabilities/capabilities.d.ts +2 -24
- package/dist/types/src/capabilities/capabilities.d.ts.map +1 -1
- package/dist/types/src/capabilities/edge-model-resolver.d.ts.map +1 -1
- package/dist/types/src/capabilities/index.d.ts +0 -1
- 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/local-model-resolver.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
- package/dist/types/src/capabilities/state.d.ts.map +1 -1
- package/dist/types/src/capabilities/toolkit.d.ts +1 -1
- package/dist/types/src/capabilities/toolkit.d.ts.map +1 -1
- package/dist/types/src/components/BlueprintArticle.d.ts +7 -0
- package/dist/types/src/components/BlueprintArticle.d.ts.map +1 -0
- package/dist/types/src/components/Chat/Chat.d.ts +20 -9
- package/dist/types/src/components/Chat/Chat.d.ts.map +1 -1
- package/dist/types/src/components/Chat/events.d.ts +4 -0
- package/dist/types/src/components/Chat/events.d.ts.map +1 -1
- package/dist/types/src/components/ChatCompanion.d.ts +2 -2
- package/dist/types/src/components/ChatCompanion.d.ts.map +1 -1
- package/dist/types/src/components/ChatContainer.d.ts +7 -4
- package/dist/types/src/components/ChatContainer.d.ts.map +1 -1
- package/dist/types/src/components/ChatDialog.d.ts.map +1 -1
- package/dist/types/src/components/ChatProgress/ChatProgress.d.ts.map +1 -1
- package/dist/types/src/components/ChatPrompt/ChatActions.d.ts.map +1 -1
- package/dist/types/src/components/ChatPrompt/ChatOptions.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/ChatThread.d.ts +6 -7
- package/dist/types/src/components/ChatThread/ChatThread.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/ChatThread.stories.d.ts +124 -71
- package/dist/types/src/components/ChatThread/ChatThread.stories.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/reducers.d.ts +5 -5
- package/dist/types/src/components/ChatThread/reducers.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/registry.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/sync.d.ts +12 -6
- package/dist/types/src/components/ChatThread/sync.d.ts.map +1 -1
- package/dist/types/src/components/PromptArticle.d.ts +7 -0
- package/dist/types/src/components/PromptArticle.d.ts.map +1 -0
- package/dist/types/src/components/TemplateEditor/TemplateEditor.d.ts +2 -1
- package/dist/types/src/components/TemplateEditor/TemplateEditor.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/TemplateEditor.stories.d.ts +111 -61
- package/dist/types/src/components/TemplateEditor/TemplateEditor.stories.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/TemplateForm.d.ts +1 -1
- package/dist/types/src/components/TemplateEditor/TemplateForm.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/TemplateForm.stories.d.ts +111 -61
- package/dist/types/src/components/TemplateEditor/TemplateForm.stories.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/extensions/handlebars-extension.d.ts.map +1 -0
- package/dist/types/src/components/TemplateEditor/extensions/index.d.ts +3 -0
- package/dist/types/src/components/TemplateEditor/extensions/index.d.ts.map +1 -0
- package/dist/types/src/components/TemplateEditor/extensions/xml-extension.d.ts +8 -0
- package/dist/types/src/components/TemplateEditor/extensions/xml-extension.d.ts.map +1 -0
- package/dist/types/src/components/ToolBlock/ToolBlock.d.ts +9 -7
- package/dist/types/src/components/ToolBlock/ToolBlock.d.ts.map +1 -1
- package/dist/types/src/components/Toolbox/Toolbox.d.ts +2 -2
- package/dist/types/src/components/Toolbox/Toolbox.d.ts.map +1 -1
- package/dist/types/src/components/Toolbox/Toolbox.stories.d.ts +111 -61
- package/dist/types/src/components/Toolbox/Toolbox.stories.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +4 -9
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/functions/analysis.d.ts +1 -1
- package/dist/types/src/functions/analysis.d.ts.map +1 -1
- package/dist/types/src/functions/index.d.ts +2 -2
- package/dist/types/src/functions/index.d.ts.map +1 -1
- package/dist/types/src/functions/{list.d.ts → object-list.d.ts} +2 -2
- package/dist/types/src/functions/object-list.d.ts.map +1 -0
- package/dist/types/src/functions/{load.d.ts → object-load.d.ts} +2 -2
- package/dist/types/src/functions/object-load.d.ts.map +1 -0
- package/dist/types/src/hooks/index.d.ts +1 -2
- package/dist/types/src/hooks/index.d.ts.map +1 -1
- package/dist/types/src/hooks/useBlueprintRegistry.d.ts +2 -1
- package/dist/types/src/hooks/useBlueprintRegistry.d.ts.map +1 -1
- package/dist/types/src/hooks/useChatProcessor.d.ts +4 -2
- package/dist/types/src/hooks/useChatProcessor.d.ts.map +1 -1
- package/dist/types/src/hooks/useChatServices.d.ts +1 -1
- package/dist/types/src/hooks/useChatServices.d.ts.map +1 -1
- package/dist/types/src/hooks/useChatToolbarActions.d.ts +8 -0
- package/dist/types/src/hooks/useChatToolbarActions.d.ts.map +1 -0
- package/dist/types/src/hooks/useContextBinder.d.ts +2 -2
- package/dist/types/src/hooks/useContextBinder.d.ts.map +1 -1
- package/dist/types/src/hooks/useReferencesProvider.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +2 -0
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +1 -2
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/processor/index.d.ts +1 -0
- package/dist/types/src/processor/index.d.ts.map +1 -1
- package/dist/types/src/processor/presets.d.ts +1 -1
- package/dist/types/src/processor/presets.d.ts.map +1 -1
- package/dist/types/src/processor/processor.d.ts +11 -10
- package/dist/types/src/processor/processor.d.ts.map +1 -1
- package/dist/types/src/processor/update-name.d.ts +10 -0
- package/dist/types/src/processor/update-name.d.ts.map +1 -0
- package/dist/types/src/queue-logger.d.ts.map +1 -1
- package/dist/types/src/testing/index.d.ts +0 -2
- package/dist/types/src/testing/index.d.ts.map +1 -1
- package/dist/types/src/testing/test-generator.d.ts +3 -3
- package/dist/types/src/testing/test-generator.d.ts.map +1 -1
- package/dist/types/src/testing/test-services.d.ts +2 -2
- package/dist/types/src/testing/test-services.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +239 -26
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/Assistant.d.ts +15 -9
- package/dist/types/src/types/Assistant.d.ts.map +1 -1
- package/dist/types/src/types/AssistantAction.d.ts +33 -8
- package/dist/types/src/types/AssistantAction.d.ts.map +1 -1
- package/dist/types/src/types/service.d.ts +24 -18
- package/dist/types/src/types/service.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +94 -113
- package/src/AssistantPlugin.tsx +154 -138
- package/src/capabilities/ai-service.ts +6 -7
- package/src/capabilities/app-graph-builder.ts +69 -21
- package/src/capabilities/blueprint-definition.ts +38 -30
- package/src/capabilities/capabilities.ts +2 -56
- package/src/capabilities/edge-model-resolver.ts +5 -7
- package/src/capabilities/index.ts +0 -1
- package/src/capabilities/intent-resolver.ts +69 -16
- package/src/capabilities/local-model-resolver.ts +7 -9
- package/src/capabilities/react-surface.tsx +16 -20
- package/src/capabilities/state.ts +2 -0
- package/src/capabilities/toolkit.ts +9 -155
- package/src/components/BlueprintArticle.tsx +29 -0
- package/src/components/Chat/Chat.tsx +155 -113
- package/src/components/Chat/events.ts +6 -0
- package/src/components/ChatCompanion.tsx +93 -49
- package/src/components/ChatContainer.tsx +27 -17
- package/src/components/ChatDialog.tsx +9 -2
- package/src/components/ChatProgress/ChatProgress.tsx +2 -3
- package/src/components/ChatPrompt/ChatActions.tsx +2 -4
- package/src/components/ChatPrompt/ChatOptions.tsx +40 -45
- package/src/components/ChatPrompt/ChatReferences.tsx +2 -2
- package/src/components/ChatThread/ChatThread.stories.tsx +52 -34
- package/src/components/ChatThread/ChatThread.tsx +28 -34
- package/src/components/ChatThread/reducers.ts +6 -6
- package/src/components/ChatThread/registry.tsx +25 -40
- package/src/components/ChatThread/sync.test.ts +21 -13
- package/src/components/ChatThread/sync.ts +48 -13
- package/src/components/ChatThread/testing/thread.md +37 -0
- package/src/components/PromptArticle.tsx +51 -0
- package/src/components/TemplateEditor/TemplateEditor.stories.tsx +15 -7
- package/src/components/TemplateEditor/TemplateEditor.tsx +19 -10
- package/src/components/TemplateEditor/TemplateForm.stories.tsx +4 -6
- package/src/components/TemplateEditor/TemplateForm.tsx +2 -2
- package/src/components/TemplateEditor/extensions/handlebars-extension.ts +269 -0
- package/src/components/TemplateEditor/extensions/index.ts +6 -0
- package/src/components/TemplateEditor/extensions/xml-extension.ts +64 -0
- package/src/components/ToolBlock/ToolBlock.tsx +37 -46
- package/src/components/Toolbox/Toolbox.stories.tsx +5 -8
- package/src/components/Toolbox/Toolbox.tsx +5 -5
- package/src/components/index.ts +2 -5
- package/src/functions/analysis.ts +5 -3
- package/src/functions/index.ts +2 -2
- package/src/functions/{list.ts → object-list.ts} +6 -4
- package/src/functions/{load.ts → object-load.ts} +8 -5
- package/src/hooks/index.ts +1 -2
- package/src/hooks/useBlueprintRegistry.ts +19 -4
- package/src/hooks/useChatProcessor.ts +22 -14
- package/src/hooks/useChatServices.ts +10 -7
- package/src/hooks/useChatToolbarActions.ts +122 -0
- package/src/hooks/useContextBinder.ts +19 -7
- package/src/hooks/useItemTypes.ts +1 -1
- package/src/hooks/useReferencesProvider.ts +2 -1
- package/src/index.ts +2 -0
- package/src/meta.ts +9 -6
- package/src/processor/index.ts +1 -0
- package/src/processor/presets.ts +2 -2
- package/src/processor/processor.test.ts +18 -24
- package/src/processor/processor.ts +35 -60
- package/src/processor/update-name.ts +56 -0
- package/src/queue-logger.ts +4 -8
- package/src/testing/index.ts +0 -2
- package/src/testing/test-generator.ts +15 -11
- package/src/testing/test-services.ts +2 -8
- package/src/translations.ts +24 -16
- package/src/types/Assistant.ts +10 -8
- package/src/types/AssistantAction.ts +23 -6
- package/src/types/service.ts +17 -9
- package/dist/lib/browser/BlueprintContainer-BFNN6K46.mjs +0 -29
- package/dist/lib/browser/BlueprintContainer-BFNN6K46.mjs.map +0 -7
- package/dist/lib/browser/ChatCompanion-DOVN34C7.mjs +0 -126
- package/dist/lib/browser/ChatCompanion-DOVN34C7.mjs.map +0 -7
- package/dist/lib/browser/ChatContainer-XIVJTCC2.mjs.map +0 -7
- package/dist/lib/browser/ChatDialog-EJJMK3WL.mjs.map +0 -7
- package/dist/lib/browser/SequenceContainer-TF5QNXYM.mjs +0 -150
- package/dist/lib/browser/SequenceContainer-TF5QNXYM.mjs.map +0 -7
- package/dist/lib/browser/ai-service-YC2EQPHA.mjs +0 -22
- package/dist/lib/browser/ai-service-YC2EQPHA.mjs.map +0 -7
- package/dist/lib/browser/app-graph-builder-3C43MLCD.mjs.map +0 -7
- package/dist/lib/browser/chunk-C4Q2RYQM.mjs +0 -1974
- package/dist/lib/browser/chunk-C4Q2RYQM.mjs.map +0 -7
- package/dist/lib/browser/chunk-EZUSNS2J.mjs.map +0 -7
- package/dist/lib/browser/chunk-GLWD66TA.mjs.map +0 -7
- package/dist/lib/browser/chunk-O4LUJEDV.mjs +0 -20
- package/dist/lib/browser/chunk-O4LUJEDV.mjs.map +0 -7
- package/dist/lib/browser/chunk-PQI3MGDN.mjs +0 -169
- package/dist/lib/browser/chunk-PQI3MGDN.mjs.map +0 -7
- package/dist/lib/browser/chunk-QD4UUISH.mjs +0 -299
- package/dist/lib/browser/chunk-QD4UUISH.mjs.map +0 -7
- package/dist/lib/browser/chunk-R6LRGW3I.mjs +0 -216
- package/dist/lib/browser/chunk-R6LRGW3I.mjs.map +0 -7
- package/dist/lib/browser/chunk-SMIVXXAI.mjs.map +0 -7
- package/dist/lib/browser/compute-runtime-X6IREJN3.mjs +0 -155
- package/dist/lib/browser/compute-runtime-X6IREJN3.mjs.map +0 -7
- package/dist/lib/browser/edge-model-resolver-JNEB355N.mjs +0 -22
- package/dist/lib/browser/edge-model-resolver-JNEB355N.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-I6M3ZDAS.mjs.map +0 -7
- package/dist/lib/browser/local-model-resolver-EUXSRZ7X.mjs +0 -21
- package/dist/lib/browser/local-model-resolver-EUXSRZ7X.mjs.map +0 -7
- package/dist/lib/browser/react-surface-E4NAGB6R.mjs.map +0 -7
- package/dist/lib/browser/toolkit-MPUS3U64.mjs +0 -191
- package/dist/lib/browser/toolkit-MPUS3U64.mjs.map +0 -7
- package/dist/lib/node-esm/BlueprintContainer-X4MRBKDR.mjs +0 -30
- package/dist/lib/node-esm/BlueprintContainer-X4MRBKDR.mjs.map +0 -7
- package/dist/lib/node-esm/ChatCompanion-ICWYVPRD.mjs +0 -127
- package/dist/lib/node-esm/ChatCompanion-ICWYVPRD.mjs.map +0 -7
- package/dist/lib/node-esm/ChatContainer-LMMMQD4K.mjs.map +0 -7
- package/dist/lib/node-esm/ChatDialog-UUE3F7BT.mjs.map +0 -7
- package/dist/lib/node-esm/SequenceContainer-UXOVZPZO.mjs +0 -151
- package/dist/lib/node-esm/SequenceContainer-UXOVZPZO.mjs.map +0 -7
- package/dist/lib/node-esm/ai-service-XUMZVFCK.mjs +0 -23
- package/dist/lib/node-esm/ai-service-XUMZVFCK.mjs.map +0 -7
- package/dist/lib/node-esm/app-graph-builder-NM3JDLQ2.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-4WLFSXZG.mjs +0 -170
- package/dist/lib/node-esm/chunk-4WLFSXZG.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-7YOGZI66.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-LVTG5JTW.mjs +0 -217
- package/dist/lib/node-esm/chunk-LVTG5JTW.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-QG2KT3AT.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-V44ZG7CU.mjs +0 -1975
- package/dist/lib/node-esm/chunk-V44ZG7CU.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-VFY2JG62.mjs +0 -22
- package/dist/lib/node-esm/chunk-VFY2JG62.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-XD4CDA4R.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-YU62ZWJN.mjs +0 -300
- package/dist/lib/node-esm/chunk-YU62ZWJN.mjs.map +0 -7
- package/dist/lib/node-esm/compute-runtime-NRHLLTSC.mjs +0 -156
- package/dist/lib/node-esm/compute-runtime-NRHLLTSC.mjs.map +0 -7
- package/dist/lib/node-esm/edge-model-resolver-UE5TLLJZ.mjs +0 -23
- package/dist/lib/node-esm/edge-model-resolver-UE5TLLJZ.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-VIINHFMT.mjs.map +0 -7
- package/dist/lib/node-esm/local-model-resolver-JBEFVVZA.mjs +0 -22
- package/dist/lib/node-esm/local-model-resolver-JBEFVVZA.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-5WQLRTCH.mjs.map +0 -7
- package/dist/lib/node-esm/toolkit-PKVYDZ4H.mjs +0 -192
- package/dist/lib/node-esm/toolkit-PKVYDZ4H.mjs.map +0 -7
- package/dist/types/src/capabilities/compute-runtime.d.ts +0 -5
- package/dist/types/src/capabilities/compute-runtime.d.ts.map +0 -1
- package/dist/types/src/components/BlueprintContainer.d.ts +0 -8
- package/dist/types/src/components/BlueprintContainer.d.ts.map +0 -1
- package/dist/types/src/components/PromptSettings.d.ts +0 -6
- package/dist/types/src/components/PromptSettings.d.ts.map +0 -1
- package/dist/types/src/components/SequenceContainer.d.ts +0 -8
- package/dist/types/src/components/SequenceContainer.d.ts.map +0 -1
- package/dist/types/src/components/SequenceEditor/SequenceEditor.d.ts +0 -13
- package/dist/types/src/components/SequenceEditor/SequenceEditor.d.ts.map +0 -1
- package/dist/types/src/components/SequenceEditor/SequenceEditor.stories.d.ts +0 -267
- package/dist/types/src/components/SequenceEditor/SequenceEditor.stories.d.ts.map +0 -1
- package/dist/types/src/components/SequenceEditor/index.d.ts +0 -2
- package/dist/types/src/components/SequenceEditor/index.d.ts.map +0 -1
- package/dist/types/src/components/TemplateEditor/handlebars-extension.d.ts.map +0 -1
- package/dist/types/src/components/Toolbar/Toolbar.d.ts +0 -5
- package/dist/types/src/components/Toolbar/Toolbar.d.ts.map +0 -1
- package/dist/types/src/components/Toolbar/index.d.ts +0 -2
- package/dist/types/src/components/Toolbar/index.d.ts.map +0 -1
- package/dist/types/src/components/Toolbar/useChatToolbarActions.d.ts +0 -11
- package/dist/types/src/components/Toolbar/useChatToolbarActions.d.ts.map +0 -1
- package/dist/types/src/execution-graph/execution-graph.d.ts +0 -21
- package/dist/types/src/execution-graph/execution-graph.d.ts.map +0 -1
- package/dist/types/src/execution-graph/index.d.ts +0 -2
- package/dist/types/src/execution-graph/index.d.ts.map +0 -1
- package/dist/types/src/functions/list.d.ts.map +0 -1
- package/dist/types/src/functions/load.d.ts.map +0 -1
- package/dist/types/src/hooks/useComputeRuntimeCallback.d.ts +0 -8
- package/dist/types/src/hooks/useComputeRuntimeCallback.d.ts.map +0 -1
- package/dist/types/src/hooks/useExecutionGraph.d.ts +0 -6
- package/dist/types/src/hooks/useExecutionGraph.d.ts.map +0 -1
- package/dist/types/src/stories/Chat.stories.d.ts +0 -30
- package/dist/types/src/stories/Chat.stories.d.ts.map +0 -1
- package/dist/types/src/stories/components/BlueprintContainer.d.ts +0 -4
- package/dist/types/src/stories/components/BlueprintContainer.d.ts.map +0 -1
- package/dist/types/src/stories/components/ChatContainer.d.ts +0 -4
- package/dist/types/src/stories/components/ChatContainer.d.ts.map +0 -1
- package/dist/types/src/stories/components/ChessContainer.d.ts +0 -4
- package/dist/types/src/stories/components/ChessContainer.d.ts.map +0 -1
- package/dist/types/src/stories/components/CommentsContainer.d.ts +0 -4
- package/dist/types/src/stories/components/CommentsContainer.d.ts.map +0 -1
- package/dist/types/src/stories/components/DebugCard.d.ts +0 -8
- package/dist/types/src/stories/components/DebugCard.d.ts.map +0 -1
- package/dist/types/src/stories/components/GraphContainer.d.ts +0 -6
- package/dist/types/src/stories/components/GraphContainer.d.ts.map +0 -1
- package/dist/types/src/stories/components/InvocationsContainer.d.ts +0 -4
- package/dist/types/src/stories/components/InvocationsContainer.d.ts.map +0 -1
- package/dist/types/src/stories/components/LoggingContainer.d.ts +0 -7
- package/dist/types/src/stories/components/LoggingContainer.d.ts.map +0 -1
- package/dist/types/src/stories/components/MessageContainer.d.ts +0 -4
- package/dist/types/src/stories/components/MessageContainer.d.ts.map +0 -1
- package/dist/types/src/stories/components/PromptContainer.d.ts +0 -6
- package/dist/types/src/stories/components/PromptContainer.d.ts.map +0 -1
- package/dist/types/src/stories/components/ResearchInputStack.d.ts +0 -4
- package/dist/types/src/stories/components/ResearchInputStack.d.ts.map +0 -1
- package/dist/types/src/stories/components/ResearchOutputStack.d.ts +0 -4
- package/dist/types/src/stories/components/ResearchOutputStack.d.ts.map +0 -1
- package/dist/types/src/stories/components/TasksContainer.d.ts +0 -4
- package/dist/types/src/stories/components/TasksContainer.d.ts.map +0 -1
- package/dist/types/src/stories/components/TokenManagerContainer.d.ts +0 -3
- package/dist/types/src/stories/components/TokenManagerContainer.d.ts.map +0 -1
- package/dist/types/src/stories/components/TriggersContainer.d.ts +0 -14
- package/dist/types/src/stories/components/TriggersContainer.d.ts.map +0 -1
- package/dist/types/src/stories/components/index.d.ts +0 -16
- package/dist/types/src/stories/components/index.d.ts.map +0 -1
- package/dist/types/src/stories/components/types.d.ts +0 -7
- package/dist/types/src/stories/components/types.d.ts.map +0 -1
- package/dist/types/src/stories/testing/data.d.ts +0 -9
- package/dist/types/src/stories/testing/data.d.ts.map +0 -1
- package/dist/types/src/stories/testing/index.d.ts +0 -3
- package/dist/types/src/stories/testing/index.d.ts.map +0 -1
- package/dist/types/src/stories/testing/schema.d.ts +0 -7
- package/dist/types/src/stories/testing/schema.d.ts.map +0 -1
- package/dist/types/src/stories/testing/testing.d.ts +0 -48
- package/dist/types/src/stories/testing/testing.d.ts.map +0 -1
- package/dist/types/src/testing/test-data.d.ts +0 -14
- package/dist/types/src/testing/test-data.d.ts.map +0 -1
- package/dist/types/src/testing/test-functions.d.ts +0 -6
- package/dist/types/src/testing/test-functions.d.ts.map +0 -1
- package/src/capabilities/compute-runtime.ts +0 -124
- package/src/components/BlueprintContainer.tsx +0 -24
- package/src/components/PromptSettings.tsx +0 -90
- package/src/components/SequenceContainer.tsx +0 -131
- package/src/components/SequenceEditor/SequenceEditor.stories.tsx +0 -33
- package/src/components/SequenceEditor/SequenceEditor.tsx +0 -50
- package/src/components/SequenceEditor/index.ts +0 -5
- package/src/components/TemplateEditor/handlebars-extension.ts +0 -165
- package/src/components/Toolbar/Toolbar.tsx +0 -21
- package/src/components/Toolbar/index.ts +0 -5
- package/src/components/Toolbar/useChatToolbarActions.ts +0 -126
- package/src/execution-graph/execution-graph.ts +0 -211
- package/src/execution-graph/index.ts +0 -5
- package/src/hooks/useComputeRuntimeCallback.ts +0 -25
- package/src/hooks/useExecutionGraph.ts +0 -20
- package/src/stories/Chat.stories.tsx +0 -657
- package/src/stories/components/BlueprintContainer.tsx +0 -34
- package/src/stories/components/ChatContainer.tsx +0 -74
- package/src/stories/components/ChessContainer.tsx +0 -17
- package/src/stories/components/CommentsContainer.tsx +0 -25
- package/src/stories/components/DebugCard.tsx +0 -61
- package/src/stories/components/GraphContainer.tsx +0 -119
- package/src/stories/components/InvocationsContainer.tsx +0 -17
- package/src/stories/components/LoggingContainer.tsx +0 -33
- package/src/stories/components/MessageContainer.tsx +0 -22
- package/src/stories/components/PromptContainer.tsx +0 -52
- package/src/stories/components/ResearchInputStack.tsx +0 -30
- package/src/stories/components/ResearchOutputStack.tsx +0 -29
- package/src/stories/components/TasksContainer.tsx +0 -49
- package/src/stories/components/TokenManagerContainer.tsx +0 -14
- package/src/stories/components/TriggersContainer.tsx +0 -75
- package/src/stories/components/index.ts +0 -20
- package/src/stories/components/types.ts +0 -11
- package/src/stories/testing/data.ts +0 -142
- package/src/stories/testing/index.ts +0 -6
- package/src/stories/testing/schema.ts +0 -17
- package/src/stories/testing/testing.tsx +0 -279
- package/src/testing/test-data.ts +0 -245
- package/src/testing/test-functions.ts +0 -16
- /package/dist/lib/browser/{blueprint-definition-VHFSRTEJ.mjs.map → blueprint-definition-5FT5JGPY.mjs.map} +0 -0
- /package/dist/lib/node-esm/{blueprint-definition-4E6XTLVN.mjs.map → blueprint-definition-XW6QQVLV.mjs.map} +0 -0
- /package/dist/types/src/components/TemplateEditor/{handlebars-extension.d.ts → extensions/handlebars-extension.d.ts} +0 -0
|
@@ -2,17 +2,29 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { useState } from 'react';
|
|
6
6
|
|
|
7
7
|
import { AiContextBinder } from '@dxos/assistant';
|
|
8
|
+
import { type Queue } from '@dxos/react-client/echo';
|
|
9
|
+
import { useAsyncEffect } from '@dxos/react-ui';
|
|
8
10
|
|
|
9
|
-
|
|
11
|
+
// NOTE: This takes a queue rather than a chat because the chat may not be in a space yet.
|
|
12
|
+
export const useContextBinder = (queue: Queue | undefined): AiContextBinder | undefined => {
|
|
13
|
+
const [binder, setBinder] = useState<AiContextBinder>();
|
|
10
14
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
15
|
+
useAsyncEffect(async () => {
|
|
16
|
+
if (!queue) {
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const binder = new AiContextBinder(queue);
|
|
21
|
+
await binder.open();
|
|
22
|
+
setBinder(binder);
|
|
23
|
+
|
|
24
|
+
return () => {
|
|
25
|
+
void binder.close();
|
|
26
|
+
};
|
|
27
|
+
}, [queue]);
|
|
16
28
|
|
|
17
29
|
return binder;
|
|
18
30
|
};
|
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
|
|
5
5
|
import { useMemo } from 'react';
|
|
6
6
|
|
|
7
|
-
import { Capabilities
|
|
7
|
+
import { Capabilities } from '@dxos/app-framework';
|
|
8
|
+
import { useCapabilities } from '@dxos/app-framework/react';
|
|
8
9
|
import { type Space } from '@dxos/client/echo';
|
|
9
10
|
import { Filter, Obj } from '@dxos/echo';
|
|
10
11
|
import { type ReferencesProvider } from '@dxos/react-ui-chat';
|
package/src/index.ts
CHANGED
package/src/meta.ts
CHANGED
|
@@ -3,16 +3,19 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { type PluginMeta } from '@dxos/app-framework';
|
|
6
|
-
|
|
7
|
-
export const ASSISTANT_PLUGIN = 'dxos.org/plugin/assistant';
|
|
8
|
-
|
|
9
|
-
export const ASSISTANT_DIALOG = `${ASSISTANT_PLUGIN}/assistant/dialog`;
|
|
6
|
+
import { trim } from '@dxos/util';
|
|
10
7
|
|
|
11
8
|
export const meta: PluginMeta = {
|
|
12
|
-
id:
|
|
9
|
+
id: 'dxos.org/plugin/assistant',
|
|
13
10
|
name: 'Assistant',
|
|
14
|
-
description:
|
|
11
|
+
description: trim`
|
|
12
|
+
Intelligent AI assistant that can analyze and interact with objects across your spaces.
|
|
13
|
+
Chat naturally to get insights, search content, and perform actions using AI-powered context awareness.
|
|
14
|
+
`,
|
|
15
15
|
icon: 'ph--atom--regular',
|
|
16
|
+
iconHue: 'sky',
|
|
16
17
|
source: 'https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-assistant',
|
|
17
18
|
tags: ['labs'],
|
|
18
19
|
};
|
|
20
|
+
|
|
21
|
+
export const ASSISTANT_DIALOG = `${meta.id}/assistant/dialog`;
|
package/src/processor/index.ts
CHANGED
package/src/processor/presets.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import
|
|
5
|
+
import * as Schema from 'effect/Schema';
|
|
6
6
|
|
|
7
7
|
import { type ModelName } from '@dxos/ai';
|
|
8
8
|
|
|
@@ -43,7 +43,7 @@ export const AiServicePresets: AiServicePreset[] = [
|
|
|
43
43
|
},
|
|
44
44
|
{
|
|
45
45
|
provider: 'lm-studio' as const,
|
|
46
|
-
model: '@
|
|
46
|
+
model: '@meta/llama-3.2-3b-instruct' as const,
|
|
47
47
|
},
|
|
48
48
|
{
|
|
49
49
|
model: 'deepseek-r1:latest' as const,
|
|
@@ -2,37 +2,33 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import
|
|
5
|
+
import * as Tool from '@effect/ai/Tool';
|
|
6
|
+
import * as Toolkit from '@effect/ai/Toolkit';
|
|
6
7
|
import { describe, it } from '@effect/vitest';
|
|
7
|
-
import
|
|
8
|
+
import * as Effect from 'effect/Effect';
|
|
9
|
+
import * as Layer from 'effect/Layer';
|
|
10
|
+
import * as Schema from 'effect/Schema';
|
|
8
11
|
|
|
9
12
|
import { AiService } from '@dxos/ai';
|
|
10
13
|
import { AiServiceTestingPreset } from '@dxos/ai/testing';
|
|
11
14
|
import { AiConversation, makeToolExecutionServiceFromFunctions, makeToolResolverFromFunctions } from '@dxos/assistant';
|
|
12
|
-
import { TestHelpers } from '@dxos/effect';
|
|
13
|
-
import {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
LocalFunctionExecutionService,
|
|
17
|
-
QueueService,
|
|
18
|
-
RemoteFunctionExecutionService,
|
|
19
|
-
TracingService,
|
|
20
|
-
} from '@dxos/functions';
|
|
21
|
-
import { TestDatabaseLayer } from '@dxos/functions/testing';
|
|
22
|
-
import { type DataType } from '@dxos/schema';
|
|
15
|
+
import { TestHelpers, acquireReleaseResource } from '@dxos/effect';
|
|
16
|
+
import { CredentialsService, QueueService, TracingService } from '@dxos/functions';
|
|
17
|
+
import { FunctionInvocationServiceLayerTestMocked, TestDatabaseLayer } from '@dxos/functions-runtime/testing';
|
|
18
|
+
import { type Message } from '@dxos/types';
|
|
23
19
|
|
|
24
20
|
import { AiChatProcessor, type AiChatServices } from './processor';
|
|
25
21
|
|
|
26
|
-
|
|
27
|
-
|
|
22
|
+
const TestToolkit = Toolkit.make(
|
|
23
|
+
Tool.make('random', {
|
|
28
24
|
description: 'Random number generator',
|
|
29
25
|
parameters: {},
|
|
30
26
|
success: Schema.Number,
|
|
31
27
|
}),
|
|
32
|
-
)
|
|
28
|
+
);
|
|
33
29
|
|
|
34
30
|
// TODO(burdon): Create minimal toolkit.
|
|
35
|
-
const toolkit =
|
|
31
|
+
const toolkit = Toolkit.merge(TestToolkit) as Toolkit.Toolkit<any>;
|
|
36
32
|
|
|
37
33
|
// TODO(burdon): Explain structure.
|
|
38
34
|
const TestServicesLayer = Layer.mergeAll(
|
|
@@ -43,27 +39,25 @@ const TestServicesLayer = Layer.mergeAll(
|
|
|
43
39
|
// types: [],
|
|
44
40
|
}),
|
|
45
41
|
// CredentialsService.configuredLayer([{ service: 'exa.ai', apiKey: EXA_API_KEY }]),
|
|
46
|
-
|
|
47
|
-
RemoteFunctionExecutionService.mockLayer,
|
|
42
|
+
FunctionInvocationServiceLayerTestMocked({ functions: [] }).pipe(Layer.provideMerge(TracingService.layerNoop)),
|
|
48
43
|
);
|
|
49
44
|
|
|
50
45
|
const TestLayer: Layer.Layer<AiChatServices, never, never> = Layer.mergeAll(
|
|
51
46
|
AiService.model('@anthropic/claude-opus-4-0'),
|
|
52
47
|
makeToolResolverFromFunctions([], toolkit),
|
|
53
|
-
makeToolExecutionServiceFromFunctions(
|
|
48
|
+
makeToolExecutionServiceFromFunctions(toolkit, toolkit.toLayer({}) as any),
|
|
54
49
|
CredentialsService.layerFromDatabase(),
|
|
55
|
-
ComputeEventLogger.layerFromTracing,
|
|
56
50
|
).pipe(Layer.provideMerge(TestServicesLayer), Layer.orDie);
|
|
57
51
|
|
|
58
52
|
// TODO(burdon): Create actual test with mock LLM.
|
|
59
53
|
describe('Chat processor', () => {
|
|
60
|
-
it.
|
|
54
|
+
it.scoped(
|
|
61
55
|
'basic',
|
|
62
56
|
Effect.fn(
|
|
63
57
|
function* ({ expect }) {
|
|
64
58
|
const services = yield* Effect.runtime<AiChatServices>();
|
|
65
|
-
const queue = yield* QueueService.createQueue<
|
|
66
|
-
const conversation = new AiConversation(
|
|
59
|
+
const queue = yield* QueueService.createQueue<Message.Message>();
|
|
60
|
+
const conversation = yield* acquireReleaseResource(() => new AiConversation(queue));
|
|
67
61
|
const processor = new AiChatProcessor(conversation, async () => services);
|
|
68
62
|
const result = yield* Effect.promise(() => processor.request({ message: 'Hello' }));
|
|
69
63
|
void processor.cancel();
|
|
@@ -2,8 +2,13 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
5
|
+
import { Atom, Registry } from '@effect-atom/atom-react';
|
|
6
|
+
import * as Cause from 'effect/Cause';
|
|
7
|
+
import * as Effect from 'effect/Effect';
|
|
8
|
+
import * as Exit from 'effect/Exit';
|
|
9
|
+
import * as Fiber from 'effect/Fiber';
|
|
10
|
+
import * as Option from 'effect/Option';
|
|
11
|
+
import * as Runtime from 'effect/Runtime';
|
|
7
12
|
|
|
8
13
|
import {
|
|
9
14
|
AiService,
|
|
@@ -16,7 +21,6 @@ import {
|
|
|
16
21
|
import {
|
|
17
22
|
type AiConversation,
|
|
18
23
|
type AiConversationRunParams,
|
|
19
|
-
AiSession,
|
|
20
24
|
ArtifactDiffResolver,
|
|
21
25
|
GenerationObserver,
|
|
22
26
|
createSystemPrompt,
|
|
@@ -27,21 +31,22 @@ import { throwCause } from '@dxos/effect';
|
|
|
27
31
|
import {
|
|
28
32
|
type CredentialsService,
|
|
29
33
|
type DatabaseService,
|
|
34
|
+
type FunctionInvocationService,
|
|
30
35
|
type QueueService,
|
|
31
|
-
type RemoteFunctionExecutionService,
|
|
32
36
|
type TracingService,
|
|
33
37
|
} from '@dxos/functions';
|
|
34
38
|
import { log } from '@dxos/log';
|
|
35
|
-
import { type ContentBlock,
|
|
36
|
-
import { trim } from '@dxos/util';
|
|
39
|
+
import { type ContentBlock, Message } from '@dxos/types';
|
|
37
40
|
|
|
38
41
|
import { type Assistant } from '../types';
|
|
39
42
|
|
|
43
|
+
import { updateName } from './update-name';
|
|
44
|
+
|
|
40
45
|
export type AiChatServices =
|
|
41
46
|
| CredentialsService
|
|
42
47
|
| DatabaseService
|
|
43
48
|
| QueueService
|
|
44
|
-
|
|
|
49
|
+
| FunctionInvocationService
|
|
45
50
|
| AiService.AiService
|
|
46
51
|
| ToolExecutionService
|
|
47
52
|
| ToolResolverService
|
|
@@ -72,7 +77,7 @@ export type AiRequest = {
|
|
|
72
77
|
* Handles streaming responses from the conversation.
|
|
73
78
|
*/
|
|
74
79
|
export class AiChatProcessor {
|
|
75
|
-
private readonly
|
|
80
|
+
private readonly _registry: Registry.Registry;
|
|
76
81
|
|
|
77
82
|
/** External observer. */
|
|
78
83
|
private readonly _observer: GenerationObserver;
|
|
@@ -84,19 +89,19 @@ export class AiChatProcessor {
|
|
|
84
89
|
private _lastRequest: AiRequest | undefined;
|
|
85
90
|
|
|
86
91
|
/** Pending messages (incl. the current user request). */
|
|
87
|
-
private readonly _pending =
|
|
92
|
+
private readonly _pending = Atom.make<Message.Message[]>([]);
|
|
88
93
|
|
|
89
94
|
/** Currently streaming message (from the AI service). */
|
|
90
|
-
private readonly _streaming =
|
|
95
|
+
private readonly _streaming = Atom.make<Option.Option<Message.Message>>(Option.none());
|
|
91
96
|
|
|
92
97
|
/** Streaming state. */
|
|
93
|
-
public readonly streaming =
|
|
98
|
+
public readonly streaming = Atom.make<boolean>((get) => Option.isSome(get(this._streaming)));
|
|
94
99
|
|
|
95
100
|
/** Active state. */
|
|
96
|
-
public readonly active =
|
|
101
|
+
public readonly active = Atom.make(false);
|
|
97
102
|
|
|
98
103
|
/** Array of Messages (incl. the current message being streamed). */
|
|
99
|
-
public readonly messages =
|
|
104
|
+
public readonly messages = Atom.make<Message.Message[]>((get) =>
|
|
100
105
|
Option.match(get(this._streaming), {
|
|
101
106
|
onNone: () => get(this._pending),
|
|
102
107
|
onSome: (streaming) => [...get(this._pending), streaming],
|
|
@@ -104,7 +109,7 @@ export class AiChatProcessor {
|
|
|
104
109
|
);
|
|
105
110
|
|
|
106
111
|
/** Last error. */
|
|
107
|
-
public readonly error =
|
|
112
|
+
public readonly error = Atom.make<Option.Option<Error>>(Option.none());
|
|
108
113
|
|
|
109
114
|
constructor(
|
|
110
115
|
private readonly _conversation: AiConversation,
|
|
@@ -113,7 +118,7 @@ export class AiChatProcessor {
|
|
|
113
118
|
private readonly _options: AiChatProcessorOptions = defaultOptions,
|
|
114
119
|
) {
|
|
115
120
|
// Initialize registries and defaults before using in other logic.
|
|
116
|
-
this.
|
|
121
|
+
this._registry = this._options.observableRegistry ?? Registry.make();
|
|
117
122
|
this._observer = GenerationObserver.make({
|
|
118
123
|
onBlock: this._onBlock,
|
|
119
124
|
onMessage: this._onMessage,
|
|
@@ -146,8 +151,8 @@ export class AiChatProcessor {
|
|
|
146
151
|
|
|
147
152
|
try {
|
|
148
153
|
this._lastRequest = requestParam;
|
|
149
|
-
this.
|
|
150
|
-
this.
|
|
154
|
+
this._registry.set(this.error, Option.none());
|
|
155
|
+
this._registry.set(this.active, true);
|
|
151
156
|
|
|
152
157
|
// Create request.
|
|
153
158
|
const request = this._conversation.createRequest({
|
|
@@ -166,10 +171,6 @@ export class AiChatProcessor {
|
|
|
166
171
|
Effect.provideService(ArtifactDiffResolver, this._artifactDiffResolver),
|
|
167
172
|
|
|
168
173
|
Effect.asVoid,
|
|
169
|
-
Effect.tapErrorCause((cause) => {
|
|
170
|
-
log.error('request failed', { cause });
|
|
171
|
-
return Effect.void;
|
|
172
|
-
}),
|
|
173
174
|
Runtime.runFork(runtime), // Runs in the background.
|
|
174
175
|
);
|
|
175
176
|
|
|
@@ -179,15 +180,15 @@ export class AiChatProcessor {
|
|
|
179
180
|
throwCause(response.cause);
|
|
180
181
|
}
|
|
181
182
|
|
|
182
|
-
this.
|
|
183
|
+
this._registry.set(this.error, Option.none());
|
|
183
184
|
this._lastRequest = undefined;
|
|
184
185
|
this._fiber = undefined;
|
|
185
|
-
} catch (
|
|
186
|
-
log.error('request failed', {
|
|
187
|
-
this.
|
|
186
|
+
} catch (error) {
|
|
187
|
+
log.error('request failed', { error });
|
|
188
|
+
this._registry.set(this.error, Option.some(new Error('AI service error', { cause: error })));
|
|
188
189
|
} finally {
|
|
189
190
|
this._fiber = undefined;
|
|
190
|
-
this.
|
|
191
|
+
this._registry.set(this.active, false);
|
|
191
192
|
}
|
|
192
193
|
}
|
|
193
194
|
|
|
@@ -204,7 +205,7 @@ export class AiChatProcessor {
|
|
|
204
205
|
);
|
|
205
206
|
|
|
206
207
|
this._fiber = undefined;
|
|
207
|
-
this.
|
|
208
|
+
this._registry.set(this.active, false);
|
|
208
209
|
}
|
|
209
210
|
|
|
210
211
|
/**
|
|
@@ -221,33 +222,7 @@ export class AiChatProcessor {
|
|
|
221
222
|
*/
|
|
222
223
|
async updateName(chat: Assistant.Chat): Promise<void> {
|
|
223
224
|
const runtime = await this._services();
|
|
224
|
-
|
|
225
|
-
const system = trim`
|
|
226
|
-
It is extremely important that you respond only with the title and nothing else.
|
|
227
|
-
If you cannot do this effectively respond with "New Chat".
|
|
228
|
-
`;
|
|
229
|
-
|
|
230
|
-
const history = await this._conversation.getHistory();
|
|
231
|
-
const fiber = Effect.gen(this, function* () {
|
|
232
|
-
const session = new AiSession();
|
|
233
|
-
return yield* session.run({ system, prompt: 'Suggest a name for this chat', history });
|
|
234
|
-
}).pipe(
|
|
235
|
-
// TODO(burdon): Use simpler model.
|
|
236
|
-
Effect.provide(AiService.model(this._options.model ?? DEFAULT_EDGE_MODEL)),
|
|
237
|
-
Effect.tap((messages) => {
|
|
238
|
-
const message = messages.find((message) => message.sender.role === 'assistant');
|
|
239
|
-
const title = message?.blocks.find((b) => b._tag === 'text')?.text;
|
|
240
|
-
if (title) {
|
|
241
|
-
chat.name = title;
|
|
242
|
-
}
|
|
243
|
-
}),
|
|
244
|
-
Runtime.runFork(runtime), // Run in the background.
|
|
245
|
-
);
|
|
246
|
-
|
|
247
|
-
const response = await fiber.pipe(Fiber.join, Effect.runPromiseExit);
|
|
248
|
-
if (!Exit.isSuccess(response)) {
|
|
249
|
-
throwCause(response.cause);
|
|
250
|
-
}
|
|
225
|
+
await updateName(runtime, this._conversation, chat, this._options.model);
|
|
251
226
|
}
|
|
252
227
|
|
|
253
228
|
// TODO(burdon): Fix/factor out.
|
|
@@ -275,22 +250,22 @@ export class AiChatProcessor {
|
|
|
275
250
|
};
|
|
276
251
|
|
|
277
252
|
private _onMessage = Effect.fn(
|
|
278
|
-
function* (this: AiChatProcessor, message:
|
|
279
|
-
this.
|
|
280
|
-
this.
|
|
253
|
+
function* (this: AiChatProcessor, message: Message.Message) {
|
|
254
|
+
this._registry.set(this._streaming, Option.none());
|
|
255
|
+
this._registry.update(this._pending, (pending) => [...pending, message]);
|
|
281
256
|
}.bind(this),
|
|
282
257
|
);
|
|
283
258
|
|
|
284
259
|
private _onBlock = Effect.fn(
|
|
285
260
|
function* (this: AiChatProcessor, block: ContentBlock.Any) {
|
|
286
|
-
this.
|
|
261
|
+
this._registry.update(this._streaming, (streaming) => {
|
|
287
262
|
const blocks = streaming.pipe(
|
|
288
|
-
Option.map((streaming) => streaming.blocks.filter((b) => !b.pending)),
|
|
263
|
+
Option.map((streaming) => streaming.blocks.filter((b: ContentBlock.Any) => !b.pending)),
|
|
289
264
|
Option.getOrElse(() => []),
|
|
290
265
|
);
|
|
291
266
|
|
|
292
267
|
return Option.some(
|
|
293
|
-
Obj.make(
|
|
268
|
+
Obj.make(Message.Message, {
|
|
294
269
|
created: new Date().toISOString(),
|
|
295
270
|
sender: { role: 'assistant' },
|
|
296
271
|
blocks: [...blocks, block],
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
|
+
import * as Exit from 'effect/Exit';
|
|
7
|
+
import * as Fiber from 'effect/Fiber';
|
|
8
|
+
import * as Runtime from 'effect/Runtime';
|
|
9
|
+
|
|
10
|
+
import { AiService, DEFAULT_EDGE_MODEL, type ModelName } from '@dxos/ai';
|
|
11
|
+
import { type AiConversation, AiSession } from '@dxos/assistant';
|
|
12
|
+
import { throwCause } from '@dxos/effect';
|
|
13
|
+
import { trim } from '@dxos/util';
|
|
14
|
+
|
|
15
|
+
import { type Assistant } from '../types';
|
|
16
|
+
|
|
17
|
+
import { type AiChatServices } from './processor';
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Update the current chat's name.
|
|
21
|
+
*/
|
|
22
|
+
// TODO(burdon): Convert this into a plugin tool.
|
|
23
|
+
export const updateName = async (
|
|
24
|
+
runtime: Runtime.Runtime<AiChatServices>,
|
|
25
|
+
conversation: AiConversation,
|
|
26
|
+
chat: Assistant.Chat,
|
|
27
|
+
model: ModelName = DEFAULT_EDGE_MODEL,
|
|
28
|
+
): Promise<void> => {
|
|
29
|
+
const history = await conversation.getHistory();
|
|
30
|
+
const system = trim`
|
|
31
|
+
It is extremely important that you respond only with the title and nothing else.
|
|
32
|
+
If you cannot do this effectively respond with "New Chat".
|
|
33
|
+
`;
|
|
34
|
+
const prompt = 'Suggest a name for this chat';
|
|
35
|
+
|
|
36
|
+
const fiber = Effect.gen(this, function* () {
|
|
37
|
+
const session = new AiSession();
|
|
38
|
+
return yield* session.run({ system, prompt, history });
|
|
39
|
+
}).pipe(
|
|
40
|
+
Effect.provide(AiService.model(model)),
|
|
41
|
+
Effect.tap((messages) => {
|
|
42
|
+
// TODO(burdon): Parse response (should update via tool).
|
|
43
|
+
const message = messages.find((message) => message.sender.role === 'assistant');
|
|
44
|
+
const title = message?.blocks.find((block) => block._tag === 'text')?.text;
|
|
45
|
+
if (title) {
|
|
46
|
+
chat.name = title;
|
|
47
|
+
}
|
|
48
|
+
}),
|
|
49
|
+
Runtime.runFork(runtime), // Run in the background.
|
|
50
|
+
);
|
|
51
|
+
|
|
52
|
+
const response = await fiber.pipe(Fiber.join, Effect.runPromiseExit);
|
|
53
|
+
if (!Exit.isSuccess(response)) {
|
|
54
|
+
throwCause(response.cause);
|
|
55
|
+
}
|
|
56
|
+
};
|
package/src/queue-logger.ts
CHANGED
|
@@ -5,14 +5,10 @@
|
|
|
5
5
|
import { type Queue, Ref, type Space, getSpace } from '@dxos/client/echo';
|
|
6
6
|
import { type Sequence, type SequenceEvent, type SequenceLogger } from '@dxos/conductor';
|
|
7
7
|
import { DXN, Key, Obj } from '@dxos/echo';
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
InvocationTraceEventType,
|
|
13
|
-
InvocationTraceStartEvent,
|
|
14
|
-
TraceEvent,
|
|
15
|
-
} from '@dxos/functions';
|
|
8
|
+
import { InvocationTraceEndEvent, InvocationTraceEventType, InvocationTraceStartEvent } from '@dxos/functions-runtime';
|
|
9
|
+
import { TraceEvent } from '@dxos/functions-runtime';
|
|
10
|
+
import { InvocationOutcome } from '@dxos/functions-runtime';
|
|
11
|
+
import { type InvocationTraceEvent } from '@dxos/functions-runtime';
|
|
16
12
|
import { invariant } from '@dxos/invariant';
|
|
17
13
|
import { QueueSubspaceTags } from '@dxos/keys';
|
|
18
14
|
|
package/src/testing/index.ts
CHANGED
|
@@ -2,17 +2,17 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
6
|
|
|
7
7
|
import { Obj } from '@dxos/echo';
|
|
8
8
|
import { ContextQueueService, DatabaseService } from '@dxos/functions';
|
|
9
9
|
import { faker } from '@dxos/random';
|
|
10
10
|
import { renderObjectLink } from '@dxos/react-ui-components';
|
|
11
|
-
import { type ContentBlock,
|
|
11
|
+
import { type Actor, type ContentBlock, Message, Organization } from '@dxos/types';
|
|
12
12
|
import { trim } from '@dxos/util';
|
|
13
13
|
|
|
14
|
-
export const createMessage = (role:
|
|
15
|
-
return Obj.make(
|
|
14
|
+
export const createMessage = (role: Actor.Role, blocks: ContentBlock.Any[]): Message.Message => {
|
|
15
|
+
return Obj.make(Message.Message, {
|
|
16
16
|
created: new Date().toISOString(),
|
|
17
17
|
sender: { role },
|
|
18
18
|
blocks,
|
|
@@ -70,9 +70,9 @@ export const createMessageGenerator = (): MessageGenerator[] => [
|
|
|
70
70
|
[
|
|
71
71
|
faker.lorem.paragraph(),
|
|
72
72
|
'',
|
|
73
|
-
...Array.from({
|
|
74
|
-
(
|
|
75
|
-
),
|
|
73
|
+
...Array.from({
|
|
74
|
+
length: faker.number.int({ min: 3, max: 5 }),
|
|
75
|
+
}).map((_, idx) => `${idx + 1}. ${faker.lorem.paragraph()}`),
|
|
76
76
|
].join('\n') + '\n',
|
|
77
77
|
},
|
|
78
78
|
]),
|
|
@@ -146,10 +146,10 @@ export const createMessageGenerator = (): MessageGenerator[] => [
|
|
|
146
146
|
Effect.gen(function* () {
|
|
147
147
|
const { queue } = yield* ContextQueueService;
|
|
148
148
|
const { db } = yield* DatabaseService;
|
|
149
|
-
const obj1 = db.add(Obj.make(
|
|
150
|
-
// const obj2 = db.add(Obj.make(
|
|
151
|
-
// const obj3 = db.add(Obj.make(
|
|
152
|
-
// const obj4 = db.add(Obj.make(
|
|
149
|
+
const obj1 = db.add(Obj.make(Organization.Organization, { name: 'DXOS' }));
|
|
150
|
+
// const obj2 = db.add(Obj.make(Person.Person, { fullName: 'Alice' }));
|
|
151
|
+
// const obj3 = db.add(Obj.make(Person.Person, { fullName: 'Bob' }));
|
|
152
|
+
// const obj4 = db.add(Obj.make(Person.Person, { fullName: 'Charlie' }));
|
|
153
153
|
yield* Effect.promise(() =>
|
|
154
154
|
queue.append([
|
|
155
155
|
createMessage('assistant', [
|
|
@@ -188,6 +188,7 @@ export const createMessageGenerator = (): MessageGenerator[] => [
|
|
|
188
188
|
toolCallId: '1234',
|
|
189
189
|
name: 'search',
|
|
190
190
|
input: JSON.stringify({}),
|
|
191
|
+
providerExecuted: false,
|
|
191
192
|
},
|
|
192
193
|
]),
|
|
193
194
|
createMessage('user', [
|
|
@@ -196,6 +197,7 @@ export const createMessageGenerator = (): MessageGenerator[] => [
|
|
|
196
197
|
toolCallId: '1234',
|
|
197
198
|
name: 'search',
|
|
198
199
|
result: 'This is a tool result.',
|
|
200
|
+
providerExecuted: false,
|
|
199
201
|
},
|
|
200
202
|
]),
|
|
201
203
|
]),
|
|
@@ -218,6 +220,7 @@ export const createMessageGenerator = (): MessageGenerator[] => [
|
|
|
218
220
|
toolCallId: '4567',
|
|
219
221
|
name: 'create',
|
|
220
222
|
input: JSON.stringify({}),
|
|
223
|
+
providerExecuted: false,
|
|
221
224
|
},
|
|
222
225
|
]),
|
|
223
226
|
createMessage('user', [
|
|
@@ -226,6 +229,7 @@ export const createMessageGenerator = (): MessageGenerator[] => [
|
|
|
226
229
|
toolCallId: '4567',
|
|
227
230
|
name: 'create',
|
|
228
231
|
result: 'This is a tool result.',
|
|
232
|
+
providerExecuted: false,
|
|
229
233
|
},
|
|
230
234
|
]),
|
|
231
235
|
createMessage('assistant', [
|
|
@@ -4,16 +4,10 @@
|
|
|
4
4
|
|
|
5
5
|
import { Obj } from '@dxos/echo';
|
|
6
6
|
|
|
7
|
-
import {
|
|
8
|
-
type ApiAuthorization,
|
|
9
|
-
type BaseServiceRegistry,
|
|
10
|
-
type ServiceQuery,
|
|
11
|
-
ServiceType,
|
|
12
|
-
categoryIcons,
|
|
13
|
-
} from '../types';
|
|
7
|
+
import { type ApiAuthorization, type BaseServiceRegistry, ServiceType, categoryIcons } from '../types';
|
|
14
8
|
|
|
15
9
|
export class MockServiceRegistry implements BaseServiceRegistry {
|
|
16
|
-
async queryServices(
|
|
10
|
+
async queryServices(): Promise<ServiceType[]> {
|
|
17
11
|
return TEST_SERVICES;
|
|
18
12
|
}
|
|
19
13
|
}
|