@dxos/plugin-assistant 0.8.4-main.dedc0f3 → 0.8.4-main.ead640a
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/{BlueprintContainer-BFNN6K46.mjs → BlueprintContainer-FOZTO447.mjs} +6 -7
- package/dist/lib/browser/{BlueprintContainer-BFNN6K46.mjs.map → BlueprintContainer-FOZTO447.mjs.map} +3 -3
- package/dist/lib/browser/{ChatCompanion-YYYCHZYV.mjs → ChatCompanion-EC6LBEWF.mjs} +38 -14
- package/dist/lib/browser/ChatCompanion-EC6LBEWF.mjs.map +7 -0
- package/dist/lib/browser/{ChatContainer-G6YHR6GJ.mjs → ChatContainer-A2SL6WO5.mjs} +7 -9
- package/dist/lib/browser/{ChatContainer-G6YHR6GJ.mjs.map → ChatContainer-A2SL6WO5.mjs.map} +3 -3
- package/dist/lib/browser/{ChatDialog-HJ7VDRQO.mjs → ChatDialog-XMOUFX2P.mjs} +3 -5
- package/dist/lib/browser/{ChatDialog-HJ7VDRQO.mjs.map → ChatDialog-XMOUFX2P.mjs.map} +1 -1
- package/dist/lib/browser/{SequenceContainer-TF5QNXYM.mjs → SequenceContainer-2FEWMQGW.mjs} +4 -4
- package/dist/lib/browser/SequenceContainer-2FEWMQGW.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-7AE4R5KJ.mjs} +41 -11
- package/dist/lib/browser/app-graph-builder-7AE4R5KJ.mjs.map +7 -0
- package/dist/lib/browser/{blueprint-definition-VHFSRTEJ.mjs → blueprint-definition-NSJARW5U.mjs} +2 -2
- package/dist/lib/browser/{chunk-GLWD66TA.mjs → chunk-2CE2KPKZ.mjs} +28 -14
- package/dist/lib/browser/chunk-2CE2KPKZ.mjs.map +7 -0
- package/dist/lib/browser/{chunk-SMIVXXAI.mjs → chunk-37VMDB4P.mjs} +32 -14
- package/dist/lib/browser/chunk-37VMDB4P.mjs.map +7 -0
- package/dist/lib/browser/{chunk-R6LRGW3I.mjs → chunk-3EWE2UQD.mjs} +11 -7
- package/dist/lib/browser/chunk-3EWE2UQD.mjs.map +7 -0
- package/dist/lib/browser/{chunk-EZUSNS2J.mjs → chunk-5EGXHCAZ.mjs} +2 -5
- package/dist/lib/browser/chunk-5EGXHCAZ.mjs.map +7 -0
- package/dist/lib/browser/{chunk-O4LUJEDV.mjs → chunk-5RICKAMN.mjs} +5 -7
- package/dist/lib/browser/chunk-5RICKAMN.mjs.map +7 -0
- package/dist/lib/browser/{chunk-PL4O4ZJU.mjs → chunk-7THOIN6F.mjs} +309 -481
- package/dist/lib/browser/chunk-7THOIN6F.mjs.map +7 -0
- package/dist/lib/browser/{chunk-PQI3MGDN.mjs → chunk-HYYWP3KP.mjs} +6 -5
- package/dist/lib/browser/chunk-HYYWP3KP.mjs.map +7 -0
- package/dist/lib/browser/{chunk-PPJAIE2T.mjs → chunk-Z7DQT64Z.mjs} +39 -37
- package/dist/lib/browser/chunk-Z7DQT64Z.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 +72 -48
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/{intent-resolver-I6M3ZDAS.mjs → intent-resolver-BZUU4UNA.mjs} +29 -11
- package/dist/lib/browser/intent-resolver-BZUU4UNA.mjs.map +7 -0
- package/dist/lib/browser/local-model-resolver-GO6ZEMLL.mjs +17 -0
- package/dist/lib/browser/local-model-resolver-GO6ZEMLL.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/{react-surface-WNLA2636.mjs → react-surface-KRRUOMYY.mjs} +13 -15
- package/dist/lib/browser/react-surface-KRRUOMYY.mjs.map +7 -0
- package/dist/lib/browser/{settings-36V3VUMW.mjs → settings-PSR3WF3X.mjs} +5 -5
- package/dist/lib/browser/{settings-36V3VUMW.mjs.map → settings-PSR3WF3X.mjs.map} +1 -1
- package/dist/lib/browser/{state-AINRYS5W.mjs → state-LXTS54DI.mjs} +5 -5
- package/dist/lib/browser/{state-AINRYS5W.mjs.map → state-LXTS54DI.mjs.map} +1 -1
- package/dist/lib/browser/{toolkit-Y5OYX5PO.mjs → toolkit-NQ2GXCF5.mjs} +29 -21
- package/dist/lib/browser/toolkit-NQ2GXCF5.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +2 -2
- package/dist/lib/node-esm/{BlueprintContainer-X4MRBKDR.mjs → BlueprintContainer-6HSEVQ7U.mjs} +6 -7
- package/dist/lib/node-esm/{BlueprintContainer-X4MRBKDR.mjs.map → BlueprintContainer-6HSEVQ7U.mjs.map} +3 -3
- package/dist/lib/node-esm/{ChatCompanion-PUAFRIEC.mjs → ChatCompanion-NDYEAUQN.mjs} +38 -14
- package/dist/lib/node-esm/ChatCompanion-NDYEAUQN.mjs.map +7 -0
- package/dist/lib/node-esm/{ChatContainer-EZZF7RSQ.mjs → ChatContainer-NMDQM5HG.mjs} +7 -9
- package/dist/lib/node-esm/{ChatContainer-EZZF7RSQ.mjs.map → ChatContainer-NMDQM5HG.mjs.map} +3 -3
- package/dist/lib/node-esm/{ChatDialog-PTQLZNJU.mjs → ChatDialog-QPRWMRU4.mjs} +3 -5
- package/dist/lib/node-esm/{ChatDialog-PTQLZNJU.mjs.map → ChatDialog-QPRWMRU4.mjs.map} +1 -1
- package/dist/lib/node-esm/{SequenceContainer-UXOVZPZO.mjs → SequenceContainer-PGGJUQ46.mjs} +4 -4
- package/dist/lib/node-esm/SequenceContainer-PGGJUQ46.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-SJCOS64C.mjs} +41 -11
- package/dist/lib/node-esm/app-graph-builder-SJCOS64C.mjs.map +7 -0
- package/dist/lib/node-esm/{blueprint-definition-4E6XTLVN.mjs → blueprint-definition-WD2IVMAI.mjs} +2 -2
- package/dist/lib/node-esm/{chunk-VFY2JG62.mjs → chunk-73ABYRYX.mjs} +5 -7
- package/dist/lib/node-esm/chunk-73ABYRYX.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-LVTG5JTW.mjs → chunk-HDZX6TSZ.mjs} +11 -7
- package/dist/lib/node-esm/chunk-HDZX6TSZ.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-4WLFSXZG.mjs → chunk-TMCGJPAN.mjs} +6 -5
- package/dist/lib/node-esm/chunk-TMCGJPAN.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-VH3LTD76.mjs → chunk-TW2WKKSR.mjs} +39 -37
- package/dist/lib/node-esm/chunk-TW2WKKSR.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-QG2KT3AT.mjs → chunk-U2NYUS2N.mjs} +28 -14
- package/dist/lib/node-esm/chunk-U2NYUS2N.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-XD4CDA4R.mjs → chunk-XQGWSZ4T.mjs} +2 -5
- package/dist/lib/node-esm/chunk-XQGWSZ4T.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-ZIDP7HBI.mjs → chunk-YZYGXFVG.mjs} +309 -481
- package/dist/lib/node-esm/chunk-YZYGXFVG.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-7YOGZI66.mjs → chunk-ZQ3THJ2W.mjs} +32 -14
- package/dist/lib/node-esm/chunk-ZQ3THJ2W.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 +72 -48
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/{intent-resolver-VIINHFMT.mjs → intent-resolver-B7YAS3NT.mjs} +29 -11
- package/dist/lib/node-esm/intent-resolver-B7YAS3NT.mjs.map +7 -0
- package/dist/lib/node-esm/local-model-resolver-WOQ2D2R2.mjs +18 -0
- package/dist/lib/node-esm/local-model-resolver-WOQ2D2R2.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/{react-surface-GP3LU6DX.mjs → react-surface-VRDDARFF.mjs} +13 -15
- package/dist/lib/node-esm/react-surface-VRDDARFF.mjs.map +7 -0
- package/dist/lib/node-esm/{settings-7ZCZ6AS5.mjs → settings-4EBIOJVK.mjs} +5 -5
- package/dist/lib/node-esm/{settings-7ZCZ6AS5.mjs.map → settings-4EBIOJVK.mjs.map} +1 -1
- package/dist/lib/node-esm/{state-EQS5KP6M.mjs → state-BO6GUFLB.mjs} +5 -5
- package/dist/lib/node-esm/{state-EQS5KP6M.mjs.map → state-BO6GUFLB.mjs.map} +1 -1
- package/dist/lib/node-esm/{toolkit-2F2OL6WB.mjs → toolkit-V57PRJNG.mjs} +29 -21
- package/dist/lib/node-esm/toolkit-V57PRJNG.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.map +1 -1
- package/dist/types/src/capabilities/capabilities.d.ts +0 -21
- 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/toolkit.d.ts.map +1 -1
- package/dist/types/src/components/BlueprintSettings.d.ts +6 -0
- package/dist/types/src/components/BlueprintSettings.d.ts.map +1 -0
- package/dist/types/src/components/Chat/Chat.d.ts +2 -1
- package/dist/types/src/components/Chat/Chat.d.ts.map +1 -1
- package/dist/types/src/components/ChatCompanion.d.ts.map +1 -1
- package/dist/types/src/components/ChatProgress/ChatProgress.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/ChatThread.d.ts +4 -2
- package/dist/types/src/components/ChatThread/ChatThread.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/ChatThread.stories.d.ts +7 -3
- package/dist/types/src/components/ChatThread/ChatThread.stories.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/registry.d.ts.map +1 -1
- package/dist/types/src/components/SequenceEditor/SequenceEditor.d.ts +1 -1
- package/dist/types/src/components/SequenceEditor/SequenceEditor.d.ts.map +1 -1
- package/dist/types/src/components/SequenceEditor/SequenceEditor.stories.d.ts +8 -3
- package/dist/types/src/components/SequenceEditor/SequenceEditor.stories.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 +4 -1
- 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 +4 -1
- package/dist/types/src/components/TemplateEditor/TemplateForm.stories.d.ts.map +1 -1
- package/dist/types/src/components/ToolBlock/ToolBlock.d.ts.map +1 -1
- package/dist/types/src/components/Toolbar/useChatToolbarActions.d.ts +1 -3
- package/dist/types/src/components/Toolbar/useChatToolbarActions.d.ts.map +1 -1
- package/dist/types/src/components/Toolbox/Toolbox.stories.d.ts +4 -1
- package/dist/types/src/components/Toolbox/Toolbox.stories.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +1 -1
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/functions/analysis.d.ts.map +1 -1
- package/dist/types/src/functions/list.d.ts.map +1 -1
- package/dist/types/src/functions/load.d.ts.map +1 -1
- package/dist/types/src/hooks/index.d.ts +0 -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 +1 -1
- 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/useContextBinder.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 +4 -3
- 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/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 +1 -1
- 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 +1 -0
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/Assistant.d.ts +16 -7
- package/dist/types/src/types/Assistant.d.ts.map +1 -1
- package/dist/types/src/types/AssistantAction.d.ts +19 -4
- package/dist/types/src/types/AssistantAction.d.ts.map +1 -1
- package/dist/types/src/types/service.d.ts +12 -12
- package/dist/types/src/types/service.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +91 -112
- package/src/AssistantPlugin.tsx +139 -137
- package/src/capabilities/ai-service.ts +6 -7
- package/src/capabilities/app-graph-builder.ts +36 -4
- package/src/capabilities/blueprint-definition.ts +7 -1
- package/src/capabilities/capabilities.ts +0 -53
- package/src/capabilities/edge-model-resolver.ts +5 -7
- package/src/capabilities/index.ts +0 -1
- package/src/capabilities/intent-resolver.ts +26 -3
- package/src/capabilities/local-model-resolver.ts +6 -8
- package/src/capabilities/react-surface.tsx +3 -3
- package/src/capabilities/toolkit.ts +18 -13
- package/src/components/BlueprintContainer.tsx +2 -2
- package/src/components/BlueprintSettings.tsx +15 -0
- package/src/components/Chat/Chat.tsx +41 -34
- package/src/components/ChatCompanion.tsx +33 -8
- package/src/components/ChatContainer.tsx +2 -2
- package/src/components/ChatProgress/ChatProgress.tsx +1 -2
- package/src/components/ChatPrompt/ChatOptions.tsx +17 -25
- package/src/components/ChatThread/ChatThread.stories.tsx +10 -11
- package/src/components/ChatThread/ChatThread.tsx +7 -3
- package/src/components/ChatThread/registry.tsx +6 -11
- package/src/components/ChatThread/sync.test.ts +1 -1
- package/src/components/ChatThread/sync.ts +1 -1
- package/src/components/SequenceContainer.tsx +2 -2
- package/src/components/SequenceEditor/SequenceEditor.stories.tsx +5 -4
- package/src/components/SequenceEditor/SequenceEditor.tsx +2 -2
- package/src/components/TemplateEditor/TemplateEditor.stories.tsx +5 -5
- package/src/components/TemplateEditor/TemplateEditor.tsx +8 -4
- package/src/components/TemplateEditor/TemplateForm.stories.tsx +3 -5
- package/src/components/TemplateEditor/TemplateForm.tsx +1 -1
- package/src/components/ToolBlock/ToolBlock.tsx +6 -6
- package/src/components/Toolbar/Toolbar.tsx +1 -1
- package/src/components/Toolbar/useChatToolbarActions.ts +1 -1
- package/src/components/Toolbox/Toolbox.stories.tsx +3 -6
- package/src/components/index.ts +1 -1
- package/src/functions/analysis.ts +4 -2
- package/src/functions/list.ts +4 -2
- package/src/functions/load.ts +7 -3
- package/src/hooks/index.ts +0 -2
- package/src/hooks/useBlueprintRegistry.ts +17 -3
- package/src/hooks/useChatProcessor.ts +12 -4
- package/src/hooks/useChatServices.ts +5 -4
- package/src/hooks/useContextBinder.ts +17 -5
- package/src/hooks/useItemTypes.ts +1 -1
- package/src/index.ts +2 -0
- package/src/meta.ts +3 -5
- package/src/processor/index.ts +1 -0
- package/src/processor/presets.ts +1 -1
- package/src/processor/processor.test.ts +17 -13
- package/src/processor/processor.ts +14 -39
- package/src/processor/update-name.ts +57 -0
- package/src/testing/index.ts +0 -2
- package/src/testing/test-generator.ts +5 -1
- package/src/testing/test-services.ts +2 -8
- package/src/translations.ts +1 -0
- package/src/types/Assistant.ts +7 -4
- package/src/types/AssistantAction.ts +10 -2
- package/src/types/service.ts +15 -7
- package/dist/lib/browser/ChatCompanion-YYYCHZYV.mjs.map +0 -7
- 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-EZUSNS2J.mjs.map +0 -7
- package/dist/lib/browser/chunk-GLWD66TA.mjs.map +0 -7
- package/dist/lib/browser/chunk-O4LUJEDV.mjs.map +0 -7
- package/dist/lib/browser/chunk-PL4O4ZJU.mjs.map +0 -7
- package/dist/lib/browser/chunk-PPJAIE2T.mjs.map +0 -7
- package/dist/lib/browser/chunk-PQI3MGDN.mjs.map +0 -7
- 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-WNLA2636.mjs.map +0 -7
- package/dist/lib/browser/toolkit-Y5OYX5PO.mjs.map +0 -7
- package/dist/lib/node-esm/ChatCompanion-PUAFRIEC.mjs.map +0 -7
- 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.map +0 -7
- package/dist/lib/node-esm/chunk-7YOGZI66.mjs.map +0 -7
- 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-VFY2JG62.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-VH3LTD76.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-XD4CDA4R.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-ZIDP7HBI.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-GP3LU6DX.mjs.map +0 -7
- package/dist/lib/node-esm/toolkit-2F2OL6WB.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/PromptSettings.d.ts +0 -6
- package/dist/types/src/components/PromptSettings.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/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/PromptSettings.tsx +0 -90
- 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-NSJARW5U.mjs.map} +0 -0
- /package/dist/lib/node-esm/{blueprint-definition-4E6XTLVN.mjs.map → blueprint-definition-WD2IVMAI.mjs.map} +0 -0
package/src/functions/load.ts
CHANGED
|
@@ -2,7 +2,10 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
|
+
import * as Function from 'effect/Function';
|
|
7
|
+
import * as Option from 'effect/Option';
|
|
8
|
+
import * as Schema from 'effect/Schema';
|
|
6
9
|
|
|
7
10
|
import { ArtifactId } from '@dxos/assistant';
|
|
8
11
|
import { Obj } from '@dxos/echo';
|
|
@@ -11,7 +14,8 @@ import { DatabaseService, defineFunction } from '@dxos/functions';
|
|
|
11
14
|
// TODO(burdon): Common error handling.
|
|
12
15
|
// TODO(burdon): Factor out to space plugin.
|
|
13
16
|
export default defineFunction({
|
|
14
|
-
|
|
17
|
+
key: 'dxos.org/function/assistant/load',
|
|
18
|
+
name: 'Assistant load',
|
|
15
19
|
description: 'Loads the object.',
|
|
16
20
|
inputSchema: Schema.Struct({
|
|
17
21
|
id: ArtifactId.annotations({
|
|
@@ -27,7 +31,7 @@ export default defineFunction({
|
|
|
27
31
|
}),
|
|
28
32
|
handler: Effect.fn(function* ({ data: { id, typename } }) {
|
|
29
33
|
const object = yield* DatabaseService.resolve(ArtifactId.toDXN(id));
|
|
30
|
-
return yield* pipe(
|
|
34
|
+
return yield* Function.pipe(
|
|
31
35
|
Option.fromNullable(object),
|
|
32
36
|
Option.flatMap((object) => (Obj.getTypename(object) === typename ? Option.some(object) : Option.none())),
|
|
33
37
|
Option.match({
|
package/src/hooks/index.ts
CHANGED
|
@@ -7,10 +7,8 @@ export * from './useChatProcessor';
|
|
|
7
7
|
export * from './useChatServices';
|
|
8
8
|
export * from './useContextBinder';
|
|
9
9
|
export * from './useContextObjects';
|
|
10
|
-
export * from './useExecutionGraph';
|
|
11
10
|
export * from './useFlush';
|
|
12
11
|
export * from './useItemTypes';
|
|
13
12
|
export * from './useOnline';
|
|
14
13
|
export * from './usePresets';
|
|
15
14
|
export * from './useReferencesProvider';
|
|
16
|
-
export * from './useComputeRuntimeCallback';
|
|
@@ -10,7 +10,8 @@ import { type AiContextBinder } from '@dxos/assistant';
|
|
|
10
10
|
import { Blueprint } from '@dxos/blueprints';
|
|
11
11
|
import { type Space } from '@dxos/client/echo';
|
|
12
12
|
import { Filter, Obj, Ref } from '@dxos/echo';
|
|
13
|
-
import {
|
|
13
|
+
import { useQuery } from '@dxos/react-client/echo';
|
|
14
|
+
import { distinctBy, isNonNullable } from '@dxos/util';
|
|
14
15
|
|
|
15
16
|
/**
|
|
16
17
|
* Provide a registry of blueprints from plugins.
|
|
@@ -21,8 +22,21 @@ export const useBlueprintRegistry = () => {
|
|
|
21
22
|
return useMemo(() => new Blueprint.Registry(blueprints), [blueprints]);
|
|
22
23
|
};
|
|
23
24
|
|
|
24
|
-
export const useBlueprints = ({
|
|
25
|
-
|
|
25
|
+
export const useBlueprints = ({
|
|
26
|
+
blueprintRegistry,
|
|
27
|
+
space,
|
|
28
|
+
}: {
|
|
29
|
+
blueprintRegistry?: Blueprint.Registry;
|
|
30
|
+
space?: Space;
|
|
31
|
+
}) => {
|
|
32
|
+
const staticBlueprints = useMemo(() => blueprintRegistry?.query() ?? [], [blueprintRegistry]);
|
|
33
|
+
const spaceBlueprints = useQuery(space, Filter.type(Blueprint.Blueprint));
|
|
34
|
+
return useMemo(() => {
|
|
35
|
+
const blueprints = distinctBy([...staticBlueprints, ...spaceBlueprints], (b) => b.key);
|
|
36
|
+
blueprints.sort(({ name: a }, { name: b }) => a.localeCompare(b));
|
|
37
|
+
return blueprints;
|
|
38
|
+
}, [staticBlueprints, spaceBlueprints]);
|
|
39
|
+
};
|
|
26
40
|
|
|
27
41
|
/**
|
|
28
42
|
* Create reactive map of active blueprints (by key).
|
|
@@ -3,13 +3,14 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { RegistryContext } from '@effect-rx/rx-react';
|
|
6
|
-
import
|
|
7
|
-
import { useContext, useMemo } from 'react';
|
|
6
|
+
import type * as Runtime from 'effect/Runtime';
|
|
7
|
+
import { useContext, useMemo, useState } from 'react';
|
|
8
8
|
|
|
9
9
|
import { AiConversation } from '@dxos/assistant';
|
|
10
10
|
import { type Blueprint } from '@dxos/blueprints';
|
|
11
11
|
import { log } from '@dxos/log';
|
|
12
12
|
import { type Queue } from '@dxos/react-client/echo';
|
|
13
|
+
import { useAsyncEffect } from '@dxos/react-ui';
|
|
13
14
|
|
|
14
15
|
import { AiChatProcessor, type AiChatServices, type AiServicePreset } from '../processor';
|
|
15
16
|
import { type Assistant } from '../types';
|
|
@@ -35,12 +36,19 @@ export const useChatProcessor = ({
|
|
|
35
36
|
const observableRegistry = useContext(RegistryContext);
|
|
36
37
|
|
|
37
38
|
// Create conversation from chat queue.
|
|
38
|
-
const conversation =
|
|
39
|
+
const [conversation, setConversation] = useState<AiConversation>();
|
|
40
|
+
useAsyncEffect(async () => {
|
|
39
41
|
if (!chat?.queue.target) {
|
|
40
42
|
return;
|
|
41
43
|
}
|
|
42
44
|
|
|
43
|
-
|
|
45
|
+
const conversation = new AiConversation(chat.queue.target as Queue<any>);
|
|
46
|
+
await conversation.open();
|
|
47
|
+
setConversation(conversation);
|
|
48
|
+
|
|
49
|
+
return () => {
|
|
50
|
+
void conversation.close();
|
|
51
|
+
};
|
|
44
52
|
}, [chat?.queue.target]);
|
|
45
53
|
|
|
46
54
|
// Create processor.
|
|
@@ -2,15 +2,16 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
|
+
import type * as Runtime from 'effect/Runtime';
|
|
6
7
|
import { useMemo } from 'react';
|
|
7
8
|
|
|
8
9
|
import { useCapability } from '@dxos/app-framework';
|
|
9
10
|
import { type Space } from '@dxos/client/echo';
|
|
10
11
|
import { TracingService } from '@dxos/functions';
|
|
12
|
+
import { AutomationCapabilities } from '@dxos/plugin-automation';
|
|
11
13
|
import { useClient } from '@dxos/react-client';
|
|
12
14
|
|
|
13
|
-
import { AssistantCapabilities } from '../capabilities';
|
|
14
15
|
import { type AiChatServices } from '../processor';
|
|
15
16
|
import { type Assistant } from '../types';
|
|
16
17
|
|
|
@@ -25,12 +26,12 @@ export type UseChatServicesProps = {
|
|
|
25
26
|
// TODO(dmaretskyi): Better return type.
|
|
26
27
|
export const useChatServices = ({
|
|
27
28
|
space,
|
|
28
|
-
chat,
|
|
29
|
+
chat, // TODO(burdon): Pass in queue directly.
|
|
29
30
|
}: UseChatServicesProps): (() => Promise<Runtime.Runtime<AiChatServices>>) | undefined => {
|
|
30
31
|
const client = useClient();
|
|
31
32
|
space ??= client.spaces.default;
|
|
32
33
|
|
|
33
|
-
const computeRuntimeResolver = useCapability(
|
|
34
|
+
const computeRuntimeResolver = useCapability(AutomationCapabilities.ComputeRuntime);
|
|
34
35
|
|
|
35
36
|
return useMemo(() => {
|
|
36
37
|
const runtime = computeRuntimeResolver.getRuntime(space.id);
|
|
@@ -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 { useAsyncEffect } from '@dxos/react-ui';
|
|
8
9
|
|
|
9
10
|
import { type Assistant } from '../types';
|
|
10
11
|
|
|
11
12
|
export const useContextBinder = (chat: Assistant.Chat | undefined): AiContextBinder | undefined => {
|
|
12
|
-
const binder =
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
const [binder, setBinder] = useState<AiContextBinder>();
|
|
14
|
+
|
|
15
|
+
useAsyncEffect(async () => {
|
|
16
|
+
if (!chat?.queue.target) {
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const binder = new AiContextBinder(chat.queue.target);
|
|
21
|
+
await binder.open();
|
|
22
|
+
setBinder(binder);
|
|
23
|
+
|
|
24
|
+
return () => {
|
|
25
|
+
void binder.close();
|
|
26
|
+
};
|
|
27
|
+
}, [chat?.queue.target]);
|
|
16
28
|
|
|
17
29
|
return binder;
|
|
18
30
|
};
|
package/src/index.ts
CHANGED
package/src/meta.ts
CHANGED
|
@@ -4,15 +4,13 @@
|
|
|
4
4
|
|
|
5
5
|
import { type PluginMeta } from '@dxos/app-framework';
|
|
6
6
|
|
|
7
|
-
export const ASSISTANT_PLUGIN = 'dxos.org/plugin/assistant';
|
|
8
|
-
|
|
9
|
-
export const ASSISTANT_DIALOG = `${ASSISTANT_PLUGIN}/assistant/dialog`;
|
|
10
|
-
|
|
11
7
|
export const meta: PluginMeta = {
|
|
12
|
-
id:
|
|
8
|
+
id: 'dxos.org/plugin/assistant',
|
|
13
9
|
name: 'Assistant',
|
|
14
10
|
description: 'The Assistant plugin allows you to chat with your spaces inside of Composer.',
|
|
15
11
|
icon: 'ph--atom--regular',
|
|
16
12
|
source: 'https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-assistant',
|
|
17
13
|
tags: ['labs'],
|
|
18
14
|
};
|
|
15
|
+
|
|
16
|
+
export const ASSISTANT_DIALOG = `${meta.id}/assistant/dialog`;
|
package/src/processor/index.ts
CHANGED
package/src/processor/presets.ts
CHANGED
|
@@ -2,20 +2,22 @@
|
|
|
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';
|
|
15
|
+
import { TestHelpers, acquireReleaseResource } from '@dxos/effect';
|
|
13
16
|
import {
|
|
14
17
|
ComputeEventLogger,
|
|
15
18
|
CredentialsService,
|
|
16
|
-
|
|
19
|
+
FunctionInvocationService,
|
|
17
20
|
QueueService,
|
|
18
|
-
RemoteFunctionExecutionService,
|
|
19
21
|
TracingService,
|
|
20
22
|
} from '@dxos/functions';
|
|
21
23
|
import { TestDatabaseLayer } from '@dxos/functions/testing';
|
|
@@ -23,8 +25,8 @@ import { type DataType } from '@dxos/schema';
|
|
|
23
25
|
|
|
24
26
|
import { AiChatProcessor, type AiChatServices } from './processor';
|
|
25
27
|
|
|
26
|
-
class TestToolkit extends
|
|
27
|
-
|
|
28
|
+
class TestToolkit extends Toolkit.make(
|
|
29
|
+
Tool.make('random', {
|
|
28
30
|
description: 'Random number generator',
|
|
29
31
|
parameters: {},
|
|
30
32
|
success: Schema.Number,
|
|
@@ -32,7 +34,7 @@ class TestToolkit extends AiToolkit.make(
|
|
|
32
34
|
) {}
|
|
33
35
|
|
|
34
36
|
// TODO(burdon): Create minimal toolkit.
|
|
35
|
-
const toolkit =
|
|
37
|
+
const toolkit = Toolkit.merge(TestToolkit) as Toolkit.Toolkit<any>;
|
|
36
38
|
|
|
37
39
|
// TODO(burdon): Explain structure.
|
|
38
40
|
const TestServicesLayer = Layer.mergeAll(
|
|
@@ -43,27 +45,29 @@ const TestServicesLayer = Layer.mergeAll(
|
|
|
43
45
|
// types: [],
|
|
44
46
|
}),
|
|
45
47
|
// CredentialsService.configuredLayer([{ service: 'exa.ai', apiKey: EXA_API_KEY }]),
|
|
46
|
-
|
|
47
|
-
|
|
48
|
+
FunctionInvocationService.layerTestMocked({ functions: [] }).pipe(
|
|
49
|
+
Layer.provideMerge(ComputeEventLogger.layerFromTracing),
|
|
50
|
+
Layer.provideMerge(TracingService.layerNoop),
|
|
51
|
+
),
|
|
48
52
|
);
|
|
49
53
|
|
|
50
54
|
const TestLayer: Layer.Layer<AiChatServices, never, never> = Layer.mergeAll(
|
|
51
55
|
AiService.model('@anthropic/claude-opus-4-0'),
|
|
52
56
|
makeToolResolverFromFunctions([], toolkit),
|
|
53
|
-
makeToolExecutionServiceFromFunctions(
|
|
57
|
+
makeToolExecutionServiceFromFunctions(toolkit, toolkit.toLayer({}) as any),
|
|
54
58
|
CredentialsService.layerFromDatabase(),
|
|
55
59
|
ComputeEventLogger.layerFromTracing,
|
|
56
60
|
).pipe(Layer.provideMerge(TestServicesLayer), Layer.orDie);
|
|
57
61
|
|
|
58
62
|
// TODO(burdon): Create actual test with mock LLM.
|
|
59
63
|
describe('Chat processor', () => {
|
|
60
|
-
it.
|
|
64
|
+
it.scoped(
|
|
61
65
|
'basic',
|
|
62
66
|
Effect.fn(
|
|
63
67
|
function* ({ expect }) {
|
|
64
68
|
const services = yield* Effect.runtime<AiChatServices>();
|
|
65
69
|
const queue = yield* QueueService.createQueue<DataType.Message>();
|
|
66
|
-
const conversation = new AiConversation(
|
|
70
|
+
const conversation = yield* acquireReleaseResource(() => new AiConversation(queue));
|
|
67
71
|
const processor = new AiChatProcessor(conversation, async () => services);
|
|
68
72
|
const result = yield* Effect.promise(() => processor.request({ message: 'Hello' }));
|
|
69
73
|
void processor.cancel();
|
|
@@ -3,7 +3,12 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { Registry, Rx } from '@effect-rx/rx-react';
|
|
6
|
-
import
|
|
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
39
|
import { type ContentBlock, DataType } from '@dxos/schema';
|
|
36
|
-
import { trim } from '@dxos/util';
|
|
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
|
|
@@ -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
|
|
|
@@ -182,9 +183,9 @@ export class AiChatProcessor {
|
|
|
182
183
|
this._rx.set(this.error, Option.none());
|
|
183
184
|
this._lastRequest = undefined;
|
|
184
185
|
this._fiber = undefined;
|
|
185
|
-
} catch (
|
|
186
|
-
log.error('request failed', {
|
|
187
|
-
this._rx.set(this.error, Option.some(new Error('AI service error', { cause:
|
|
186
|
+
} catch (error) {
|
|
187
|
+
log.error('request failed', { error });
|
|
188
|
+
this._rx.set(this.error, Option.some(new Error('AI service error', { cause: error })));
|
|
188
189
|
} finally {
|
|
189
190
|
this._fiber = undefined;
|
|
190
191
|
this._rx.set(this.active, false);
|
|
@@ -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.
|
|
@@ -0,0 +1,57 @@
|
|
|
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
|
+
// TODO(burdon): Use simpler model.
|
|
28
|
+
model: ModelName = DEFAULT_EDGE_MODEL,
|
|
29
|
+
): Promise<void> => {
|
|
30
|
+
const history = await conversation.getHistory();
|
|
31
|
+
const system = trim`
|
|
32
|
+
It is extremely important that you respond only with the title and nothing else.
|
|
33
|
+
If you cannot do this effectively respond with "New Chat".
|
|
34
|
+
`;
|
|
35
|
+
const prompt = 'Suggest a name for this chat';
|
|
36
|
+
|
|
37
|
+
const fiber = Effect.gen(this, function* () {
|
|
38
|
+
const session = new AiSession();
|
|
39
|
+
return yield* session.run({ system, prompt, history });
|
|
40
|
+
}).pipe(
|
|
41
|
+
Effect.provide(AiService.model(model)),
|
|
42
|
+
Effect.tap((messages) => {
|
|
43
|
+
// TODO(burdon): Parse response (should update via tool).
|
|
44
|
+
const message = messages.find((message) => message.sender.role === 'assistant');
|
|
45
|
+
const title = message?.blocks.find((block) => block._tag === 'text')?.text;
|
|
46
|
+
if (title) {
|
|
47
|
+
chat.name = title;
|
|
48
|
+
}
|
|
49
|
+
}),
|
|
50
|
+
Runtime.runFork(runtime), // Run in the background.
|
|
51
|
+
);
|
|
52
|
+
|
|
53
|
+
const response = await fiber.pipe(Fiber.join, Effect.runPromiseExit);
|
|
54
|
+
if (!Exit.isSuccess(response)) {
|
|
55
|
+
throwCause(response.cause);
|
|
56
|
+
}
|
|
57
|
+
};
|
package/src/testing/index.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
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';
|
|
@@ -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
|
}
|
package/src/translations.ts
CHANGED
package/src/types/Assistant.ts
CHANGED
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import
|
|
5
|
+
import * as Schema from 'effect/Schema';
|
|
6
6
|
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
7
|
+
import { Obj, Ref, Type } from '@dxos/echo';
|
|
8
|
+
import { LabelAnnotation } from '@dxos/echo/internal';
|
|
9
|
+
import { Queue } from '@dxos/echo-db';
|
|
10
10
|
|
|
11
11
|
import { LLM_PROVIDERS } from './defs';
|
|
12
12
|
|
|
@@ -29,6 +29,9 @@ export const Chat = Schema.Struct({
|
|
|
29
29
|
|
|
30
30
|
export interface Chat extends Schema.Schema.Type<typeof Chat> {}
|
|
31
31
|
|
|
32
|
+
export const makeChat = ({ name, queue }: { name?: string; queue: Queue }) =>
|
|
33
|
+
Obj.make(Chat, { name, queue: Ref.fromDXN(queue.dxn) });
|
|
34
|
+
|
|
32
35
|
/**
|
|
33
36
|
* Relation between a Chat and companion objects (e.g., artifacts).
|
|
34
37
|
*/
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import
|
|
5
|
+
import * as Schema from 'effect/Schema';
|
|
6
6
|
|
|
7
7
|
import { Blueprint } from '@dxos/blueprints';
|
|
8
8
|
import { EchoObjectSchema, SpaceSchema } from '@dxos/client/echo';
|
|
@@ -13,7 +13,8 @@ import { meta } from '../meta';
|
|
|
13
13
|
|
|
14
14
|
import { Chat } from './Assistant';
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
// TODO(burdon): Name?
|
|
17
|
+
export class onCreateSpace extends Schema.TaggedClass<onCreateSpace>()(`${meta.id}/on-space-created`, {
|
|
17
18
|
input: Schema.Struct({
|
|
18
19
|
space: SpaceSchema,
|
|
19
20
|
rootCollection: DataType.Collection,
|
|
@@ -31,6 +32,13 @@ export class CreateChat extends Schema.TaggedClass<CreateChat>()(`${meta.id}/act
|
|
|
31
32
|
}),
|
|
32
33
|
}) {}
|
|
33
34
|
|
|
35
|
+
export class UpdateChatName extends Schema.TaggedClass<UpdateChatName>()(`${meta.id}/action/update-name`, {
|
|
36
|
+
input: Schema.Struct({
|
|
37
|
+
chat: Chat,
|
|
38
|
+
}),
|
|
39
|
+
output: Schema.Void,
|
|
40
|
+
}) {}
|
|
41
|
+
|
|
34
42
|
export const BlueprintForm = Schema.Struct({
|
|
35
43
|
key: Schema.String,
|
|
36
44
|
name: Schema.String,
|