@dxos/plugin-assistant 0.8.4-main.5ea62a8 → 0.8.4-main.ae835ea
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-OWUSKPRK.mjs → BlueprintContainer-GMSYKGSO.mjs} +13 -6
- package/dist/lib/browser/BlueprintContainer-GMSYKGSO.mjs.map +7 -0
- package/dist/lib/browser/{ChatCompanion-FRCVSLPP.mjs → ChatCompanion-M3FDKTQM.mjs} +39 -14
- package/dist/lib/browser/ChatCompanion-M3FDKTQM.mjs.map +7 -0
- package/dist/lib/browser/{ChatContainer-YBJBIVUZ.mjs → ChatContainer-KAH7XITI.mjs} +10 -11
- package/dist/lib/browser/ChatContainer-KAH7XITI.mjs.map +7 -0
- package/dist/lib/browser/{ChatDialog-MTPJLEHM.mjs → ChatDialog-ZWRGABW6.mjs} +8 -10
- package/dist/lib/browser/ChatDialog-ZWRGABW6.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-7AAWTWGA.mjs → app-graph-builder-R5T7BJPC.mjs} +41 -11
- package/dist/lib/browser/app-graph-builder-R5T7BJPC.mjs.map +7 -0
- package/dist/lib/browser/blueprint-definition-AGTDXTXO.mjs +13 -0
- package/dist/lib/browser/chunk-357IHWQL.mjs +1519 -0
- package/dist/lib/browser/chunk-357IHWQL.mjs.map +7 -0
- package/dist/lib/browser/{chunk-6QMISAU6.mjs → chunk-A2NVNXPL.mjs} +15 -12
- package/dist/lib/browser/chunk-A2NVNXPL.mjs.map +7 -0
- package/dist/lib/browser/{chunk-V5H5CCZA.mjs → chunk-CQW6UPJM.mjs} +24 -43
- package/dist/lib/browser/chunk-CQW6UPJM.mjs.map +7 -0
- package/dist/lib/browser/{chunk-SMIVXXAI.mjs → chunk-GNI6HL6G.mjs} +37 -20
- package/dist/lib/browser/chunk-GNI6HL6G.mjs.map +7 -0
- package/dist/lib/browser/chunk-GXHZTOWJ.mjs +378 -0
- package/dist/lib/browser/chunk-GXHZTOWJ.mjs.map +7 -0
- package/dist/lib/browser/chunk-L5OA5OGS.mjs +262 -0
- package/dist/lib/browser/chunk-L5OA5OGS.mjs.map +7 -0
- package/dist/lib/browser/{chunk-OYFQS7JM.mjs → chunk-MEN5WTLA.mjs} +64 -39
- package/dist/lib/browser/chunk-MEN5WTLA.mjs.map +7 -0
- package/dist/lib/browser/{chunk-CFXXQM25.mjs → chunk-PUG24BEC.mjs} +118 -23
- package/dist/lib/browser/chunk-PUG24BEC.mjs.map +7 -0
- package/dist/lib/browser/{chunk-IJAJRAR7.mjs → chunk-SJJV3HEX.mjs} +2 -4
- package/dist/lib/browser/chunk-SJJV3HEX.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 +85 -51
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/{intent-resolver-BQO5SVGI.mjs → intent-resolver-3C5TABOX.mjs} +38 -14
- package/dist/lib/browser/intent-resolver-3C5TABOX.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-VNCD2H7C.mjs → react-surface-EYKA5IFU.mjs} +11 -30
- package/dist/lib/browser/react-surface-EYKA5IFU.mjs.map +7 -0
- package/dist/lib/browser/{settings-36V3VUMW.mjs → settings-VMVBYZLN.mjs} +5 -5
- package/dist/lib/browser/{settings-36V3VUMW.mjs.map → settings-VMVBYZLN.mjs.map} +1 -1
- package/dist/lib/browser/{state-D5IVKNYG.mjs → state-CFREPBB6.mjs} +5 -5
- package/dist/lib/browser/{state-D5IVKNYG.mjs.map → state-CFREPBB6.mjs.map} +1 -1
- package/dist/lib/browser/toolkit-F3NQ7TSI.mjs +21 -0
- package/dist/lib/browser/toolkit-F3NQ7TSI.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +2 -2
- package/dist/lib/node-esm/{BlueprintContainer-UFVWCRN6.mjs → BlueprintContainer-6GBLMK4Z.mjs} +13 -6
- package/dist/lib/node-esm/BlueprintContainer-6GBLMK4Z.mjs.map +7 -0
- package/dist/lib/node-esm/{ChatCompanion-ZNRZEKH5.mjs → ChatCompanion-OV426GCP.mjs} +39 -14
- package/dist/lib/node-esm/ChatCompanion-OV426GCP.mjs.map +7 -0
- package/dist/lib/node-esm/{ChatContainer-TUCITJJW.mjs → ChatContainer-UKY7NHFY.mjs} +10 -11
- package/dist/lib/node-esm/ChatContainer-UKY7NHFY.mjs.map +7 -0
- package/dist/lib/node-esm/{ChatDialog-JLM7RDZQ.mjs → ChatDialog-2BDQIEXH.mjs} +8 -10
- package/dist/lib/node-esm/ChatDialog-2BDQIEXH.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-PNAFQUYT.mjs → app-graph-builder-I52RYVWH.mjs} +41 -11
- package/dist/lib/node-esm/app-graph-builder-I52RYVWH.mjs.map +7 -0
- package/dist/lib/node-esm/{blueprint-definition-275J3XL2.mjs → blueprint-definition-CFCUD2VC.mjs} +5 -4
- package/dist/lib/node-esm/{chunk-CAQKGW3B.mjs → chunk-2CAETDW2.mjs} +63 -39
- package/dist/lib/node-esm/chunk-2CAETDW2.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-RLBN4RNR.mjs → chunk-4J5FYNNM.mjs} +15 -12
- package/dist/lib/node-esm/chunk-4J5FYNNM.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-7YOGZI66.mjs → chunk-5ARE4R2I.mjs} +37 -20
- package/dist/lib/node-esm/chunk-5ARE4R2I.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-7ZYOYW7F.mjs +264 -0
- package/dist/lib/node-esm/chunk-7ZYOYW7F.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-HJPIYMWD.mjs +1520 -0
- package/dist/lib/node-esm/chunk-HJPIYMWD.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-UWUUZQWJ.mjs → chunk-O36P4LN5.mjs} +24 -43
- package/dist/lib/node-esm/chunk-O36P4LN5.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-FNZJJL7G.mjs → chunk-XM4BVQQR.mjs} +118 -23
- package/dist/lib/node-esm/chunk-XM4BVQQR.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-YPXEA46Q.mjs → chunk-XQBL2SBL.mjs} +2 -4
- package/dist/lib/node-esm/chunk-XQBL2SBL.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-YIO5MEPR.mjs +380 -0
- package/dist/lib/node-esm/chunk-YIO5MEPR.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 +85 -51
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/{intent-resolver-FIS3T5KP.mjs → intent-resolver-HQ27YALS.mjs} +38 -14
- package/dist/lib/node-esm/intent-resolver-HQ27YALS.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-4NLRKNBU.mjs → react-surface-UOC3CBPH.mjs} +11 -30
- package/dist/lib/node-esm/react-surface-UOC3CBPH.mjs.map +7 -0
- package/dist/lib/node-esm/{settings-7ZCZ6AS5.mjs → settings-7AUVNDM2.mjs} +5 -5
- package/dist/lib/node-esm/{settings-7ZCZ6AS5.mjs.map → settings-7AUVNDM2.mjs.map} +1 -1
- package/dist/lib/node-esm/{state-4VLKPLW3.mjs → state-XXND44OW.mjs} +5 -5
- package/dist/lib/node-esm/{state-4VLKPLW3.mjs.map → state-XXND44OW.mjs.map} +1 -1
- package/dist/lib/node-esm/toolkit-7CH5UNSQ.mjs +22 -0
- package/dist/lib/node-esm/toolkit-7CH5UNSQ.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 +0 -8
- 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/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/toolkit.d.ts.map +1 -1
- package/dist/types/src/components/BlueprintContainer.d.ts.map +1 -1
- package/dist/types/src/components/Chat/Chat.d.ts +4 -3
- 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 +10 -5
- package/dist/types/src/components/ChatThread/ChatThread.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/ChatThread.stories.d.ts +35 -26
- package/dist/types/src/components/ChatThread/ChatThread.stories.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/Link.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/registry.d.ts +11 -0
- package/dist/types/src/components/ChatThread/registry.d.ts.map +1 -0
- package/dist/types/src/components/ChatThread/sync.d.ts +36 -0
- package/dist/types/src/components/ChatThread/sync.d.ts.map +1 -0
- package/dist/types/src/components/ChatThread/sync.test.d.ts +2 -0
- package/dist/types/src/components/ChatThread/sync.test.d.ts.map +1 -0
- package/dist/types/src/components/ChatToolbar/ChatToolbar.d.ts +6 -0
- package/dist/types/src/components/ChatToolbar/ChatToolbar.d.ts.map +1 -0
- package/dist/types/src/components/ChatToolbar/index.d.ts +2 -0
- package/dist/types/src/components/ChatToolbar/index.d.ts.map +1 -0
- package/dist/types/src/components/{Toolbar → ChatToolbar}/useChatToolbarActions.d.ts +1 -3
- package/dist/types/src/components/ChatToolbar/useChatToolbarActions.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 +21 -14
- 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 +21 -14
- package/dist/types/src/components/TemplateEditor/TemplateForm.stories.d.ts.map +1 -1
- package/dist/types/src/components/ToolBlock/ToolBlock.d.ts +19 -0
- package/dist/types/src/components/ToolBlock/ToolBlock.d.ts.map +1 -0
- package/dist/types/src/components/ToolBlock/ToolBlockWidget.d.ts +2 -0
- package/dist/types/src/components/ToolBlock/ToolBlockWidget.d.ts.map +1 -0
- package/dist/types/src/components/ToolBlock/index.d.ts +3 -0
- package/dist/types/src/components/ToolBlock/index.d.ts.map +1 -0
- 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 +21 -14
- package/dist/types/src/components/Toolbox/Toolbox.stories.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +1 -5
- 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/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} +1 -1
- package/dist/types/src/functions/object-list.d.ts.map +1 -0
- package/dist/types/src/functions/{load.d.ts → object-load.d.ts} +1 -1
- package/dist/types/src/functions/object-load.d.ts.map +1 -0
- package/dist/types/src/hooks/index.d.ts +0 -3
- 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 +2 -2
- package/dist/types/src/hooks/useChatProcessor.d.ts.map +1 -1
- package/dist/types/src/hooks/useChatServices.d.ts +2 -2
- 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 +11 -17
- 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 +1 -2
- package/dist/types/src/testing/index.d.ts.map +1 -1
- package/dist/types/src/testing/test-generator.d.ts +7 -0
- package/dist/types/src/testing/test-generator.d.ts.map +1 -0
- 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/toolkits/AssistantToolkit.d.ts +21 -0
- package/dist/types/src/toolkits/AssistantToolkit.d.ts.map +1 -0
- package/dist/types/src/toolkits/SystemToolkit.d.ts +69 -0
- package/dist/types/src/toolkits/SystemToolkit.d.ts.map +1 -0
- package/dist/types/src/toolkits/index.d.ts +3 -0
- package/dist/types/src/toolkits/index.d.ts.map +1 -0
- package/dist/types/src/translations.d.ts +6 -4
- 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 +18 -6
- 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 +93 -110
- package/src/AssistantPlugin.tsx +140 -129
- package/src/capabilities/ai-service.ts +6 -7
- package/src/capabilities/app-graph-builder.ts +36 -4
- package/src/capabilities/blueprint-definition.ts +39 -15
- package/src/capabilities/capabilities.ts +0 -13
- package/src/capabilities/edge-model-resolver.ts +5 -7
- package/src/capabilities/intent-resolver.ts +33 -6
- package/src/capabilities/local-model-resolver.ts +6 -8
- package/src/capabilities/react-surface.tsx +1 -21
- package/src/capabilities/toolkit.ts +10 -154
- package/src/components/BlueprintContainer.tsx +8 -2
- package/src/components/Chat/Chat.tsx +72 -70
- package/src/components/ChatCompanion.tsx +33 -8
- package/src/components/ChatContainer.tsx +4 -4
- package/src/components/ChatDialog.tsx +8 -8
- package/src/components/ChatProgress/ChatProgress.tsx +2 -3
- package/src/components/ChatPrompt/ChatOptions.tsx +17 -25
- package/src/components/ChatThread/ChatThread.stories.tsx +75 -229
- package/src/components/ChatThread/ChatThread.tsx +64 -46
- package/src/components/ChatThread/Link.tsx +11 -8
- package/src/components/ChatThread/registry.tsx +184 -0
- package/src/components/ChatThread/sync.test.ts +81 -0
- package/src/components/ChatThread/sync.ts +113 -0
- package/src/components/{Toolbar/Toolbar.tsx → ChatToolbar/ChatToolbar.tsx} +5 -2
- package/src/components/{Toolbar → ChatToolbar}/index.ts +1 -1
- package/src/components/{Toolbar → ChatToolbar}/useChatToolbarActions.ts +2 -1
- package/src/components/TemplateEditor/TemplateEditor.stories.tsx +5 -5
- package/src/components/TemplateEditor/TemplateEditor.tsx +18 -10
- package/src/components/TemplateEditor/TemplateForm.stories.tsx +3 -5
- package/src/components/TemplateEditor/TemplateForm.tsx +1 -1
- package/src/components/TemplateEditor/handlebars-extension.ts +12 -11
- package/src/components/{ChatThread → ToolBlock}/ToolBlock.tsx +31 -26
- package/src/components/ToolBlock/ToolBlockWidget.tsx +5 -0
- package/src/components/ToolBlock/index.ts +6 -0
- package/src/components/Toolbox/Toolbox.stories.tsx +4 -7
- package/src/components/Toolbox/Toolbox.tsx +3 -3
- package/src/components/index.ts +1 -3
- package/src/functions/analysis.ts +4 -2
- 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} +9 -7
- package/src/hooks/index.ts +0 -3
- package/src/hooks/useBlueprintRegistry.ts +17 -3
- package/src/hooks/useChatProcessor.ts +13 -5
- package/src/hooks/useChatServices.ts +26 -42
- package/src/hooks/useContextBinder.ts +17 -5
- package/src/hooks/useItemTypes.ts +1 -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 +1 -1
- package/src/processor/processor.test.ts +21 -17
- package/src/processor/processor.ts +30 -57
- package/src/processor/update-name.ts +57 -0
- package/src/queue-logger.ts +5 -5
- package/src/testing/index.ts +1 -2
- package/src/testing/test-generator.ts +261 -0
- package/src/testing/test-services.ts +2 -8
- package/src/toolkits/AssistantToolkit.ts +55 -0
- package/src/toolkits/SystemToolkit.ts +292 -0
- package/src/toolkits/index.ts +6 -0
- package/src/translations.ts +6 -5
- package/src/types/Assistant.ts +10 -8
- package/src/types/AssistantAction.ts +10 -2
- package/src/types/service.ts +17 -9
- package/dist/lib/browser/BlueprintContainer-OWUSKPRK.mjs.map +0 -7
- package/dist/lib/browser/ChatCompanion-FRCVSLPP.mjs.map +0 -7
- package/dist/lib/browser/ChatContainer-YBJBIVUZ.mjs.map +0 -7
- package/dist/lib/browser/ChatDialog-MTPJLEHM.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-NRZPTUHO.mjs +0 -22
- package/dist/lib/browser/ai-service-NRZPTUHO.mjs.map +0 -7
- package/dist/lib/browser/app-graph-builder-7AAWTWGA.mjs.map +0 -7
- package/dist/lib/browser/blueprint-definition-CRZPIA5A.mjs +0 -12
- package/dist/lib/browser/chunk-6QMISAU6.mjs.map +0 -7
- package/dist/lib/browser/chunk-CFXXQM25.mjs.map +0 -7
- package/dist/lib/browser/chunk-IJAJRAR7.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-OYFQS7JM.mjs.map +0 -7
- package/dist/lib/browser/chunk-SMIVXXAI.mjs.map +0 -7
- package/dist/lib/browser/chunk-V5H5CCZA.mjs.map +0 -7
- package/dist/lib/browser/chunk-XL557TXF.mjs +0 -2332
- package/dist/lib/browser/chunk-XL557TXF.mjs.map +0 -7
- package/dist/lib/browser/edge-model-resolver-E5M3CC46.mjs +0 -22
- package/dist/lib/browser/edge-model-resolver-E5M3CC46.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-BQO5SVGI.mjs.map +0 -7
- package/dist/lib/browser/local-model-resolver-VZ5WZQIC.mjs +0 -21
- package/dist/lib/browser/local-model-resolver-VZ5WZQIC.mjs.map +0 -7
- package/dist/lib/browser/react-surface-VNCD2H7C.mjs.map +0 -7
- package/dist/lib/browser/toolkit-Y5OYX5PO.mjs +0 -191
- package/dist/lib/browser/toolkit-Y5OYX5PO.mjs.map +0 -7
- package/dist/lib/node-esm/BlueprintContainer-UFVWCRN6.mjs.map +0 -7
- package/dist/lib/node-esm/ChatCompanion-ZNRZEKH5.mjs.map +0 -7
- package/dist/lib/node-esm/ChatContainer-TUCITJJW.mjs.map +0 -7
- package/dist/lib/node-esm/ChatDialog-JLM7RDZQ.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-UDEPIPTO.mjs +0 -23
- package/dist/lib/node-esm/ai-service-UDEPIPTO.mjs.map +0 -7
- package/dist/lib/node-esm/app-graph-builder-PNAFQUYT.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-2X6VEO32.mjs +0 -2333
- package/dist/lib/node-esm/chunk-2X6VEO32.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-7YOGZI66.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-CAQKGW3B.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-FNZJJL7G.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-RLBN4RNR.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-UWUUZQWJ.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-YPXEA46Q.mjs.map +0 -7
- package/dist/lib/node-esm/edge-model-resolver-SZHDLXCT.mjs +0 -23
- package/dist/lib/node-esm/edge-model-resolver-SZHDLXCT.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-FIS3T5KP.mjs.map +0 -7
- package/dist/lib/node-esm/local-model-resolver-2KCBKMYA.mjs +0 -22
- package/dist/lib/node-esm/local-model-resolver-2KCBKMYA.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-4NLRKNBU.mjs.map +0 -7
- package/dist/lib/node-esm/toolkit-2F2OL6WB.mjs +0 -192
- package/dist/lib/node-esm/toolkit-2F2OL6WB.mjs.map +0 -7
- package/dist/types/src/components/ChatThread/ChatMessage.d.ts +0 -33
- package/dist/types/src/components/ChatThread/ChatMessage.d.ts.map +0 -1
- package/dist/types/src/components/ChatThread/ToolBlock.d.ts +0 -19
- package/dist/types/src/components/ChatThread/ToolBlock.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 -263
- 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/Toolbar/Toolbar.d.ts +0 -4
- 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.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/useExecutionGraph.d.ts +0 -7
- package/dist/types/src/hooks/useExecutionGraph.d.ts.map +0 -1
- package/dist/types/src/hooks/useMatcherExtension.d.ts +0 -3
- package/dist/types/src/hooks/useMatcherExtension.d.ts.map +0 -1
- package/dist/types/src/hooks/useResolveRef.d.ts +0 -4
- package/dist/types/src/hooks/useResolveRef.d.ts.map +0 -1
- package/dist/types/src/parser/filter-generator.d.ts +0 -4
- package/dist/types/src/parser/filter-generator.d.ts.map +0 -1
- package/dist/types/src/parser/filter-generator.test.d.ts +0 -2
- package/dist/types/src/parser/filter-generator.test.d.ts.map +0 -1
- package/dist/types/src/parser/index.d.ts +0 -4
- package/dist/types/src/parser/index.d.ts.map +0 -1
- package/dist/types/src/parser/query-parser.d.ts +0 -15
- package/dist/types/src/parser/query-parser.d.ts.map +0 -1
- package/dist/types/src/parser/query-parser.test.d.ts +0 -2
- package/dist/types/src/parser/query-parser.test.d.ts.map +0 -1
- package/dist/types/src/parser/types.d.ts +0 -24
- package/dist/types/src/parser/types.d.ts.map +0 -1
- package/dist/types/src/stories/Chat.stories.d.ts +0 -26
- 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/CommentsContainer.d.ts +0 -4
- package/dist/types/src/stories/components/CommentsContainer.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/LoggingContainer.d.ts +0 -4
- 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/SurfaceContainer.d.ts +0 -8
- package/dist/types/src/stories/components/SurfaceContainer.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/index.d.ts +0 -11
- 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 -5
- 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/testing.d.ts +0 -44
- package/dist/types/src/stories/testing/testing.d.ts.map +0 -1
- package/dist/types/src/testing/test-data.d.ts +0 -4
- 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/components/ChatThread/ChatMessage.tsx +0 -334
- 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/execution-graph/execution-graph.ts +0 -211
- package/src/execution-graph/index.ts +0 -5
- package/src/hooks/useExecutionGraph.ts +0 -20
- package/src/hooks/useMatcherExtension.ts +0 -45
- package/src/hooks/useResolveRef.ts +0 -33
- package/src/parser/filter-generator.test.ts +0 -32
- package/src/parser/filter-generator.ts +0 -76
- package/src/parser/index.ts +0 -7
- package/src/parser/query-parser.test.ts +0 -139
- package/src/parser/query-parser.ts +0 -199
- package/src/parser/types.ts +0 -36
- package/src/stories/Chat.stories.tsx +0 -469
- package/src/stories/components/BlueprintContainer.tsx +0 -32
- package/src/stories/components/ChatContainer.tsx +0 -57
- package/src/stories/components/CommentsContainer.tsx +0 -25
- package/src/stories/components/GraphContainer.tsx +0 -118
- package/src/stories/components/LoggingContainer.tsx +0 -21
- package/src/stories/components/MessageContainer.tsx +0 -27
- package/src/stories/components/SurfaceContainer.tsx +0 -52
- package/src/stories/components/TasksContainer.tsx +0 -49
- package/src/stories/components/TokenManagerContainer.tsx +0 -14
- package/src/stories/components/index.ts +0 -15
- 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/testing.tsx +0 -254
- package/src/testing/test-data.ts +0 -109
- package/src/testing/test-functions.ts +0 -16
- /package/dist/lib/browser/{blueprint-definition-CRZPIA5A.mjs.map → blueprint-definition-AGTDXTXO.mjs.map} +0 -0
- /package/dist/lib/node-esm/{blueprint-definition-275J3XL2.mjs.map → blueprint-definition-CFCUD2VC.mjs.map} +0 -0
|
@@ -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,16 +25,16 @@ import { type DataType } from '@dxos/schema';
|
|
|
23
25
|
|
|
24
26
|
import { AiChatProcessor, type AiChatServices } from './processor';
|
|
25
27
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
+
const TestToolkit = Toolkit.make(
|
|
29
|
+
Tool.make('random', {
|
|
28
30
|
description: 'Random number generator',
|
|
29
31
|
parameters: {},
|
|
30
32
|
success: Schema.Number,
|
|
31
33
|
}),
|
|
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,31 +45,33 @@ 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
|
-
const services =
|
|
68
|
+
const services = yield* Effect.runtime<AiChatServices>();
|
|
65
69
|
const queue = yield* QueueService.createQueue<DataType.Message>();
|
|
66
|
-
const conversation = new AiConversation(
|
|
67
|
-
const processor = new AiChatProcessor(conversation, services);
|
|
70
|
+
const conversation = yield* acquireReleaseResource(() => new AiConversation(queue));
|
|
71
|
+
const processor = new AiChatProcessor(conversation, async () => services);
|
|
68
72
|
const result = yield* Effect.promise(() => processor.request({ message: 'Hello' }));
|
|
69
73
|
void processor.cancel();
|
|
70
|
-
expect(processor.
|
|
74
|
+
expect(processor.active).to.be.false;
|
|
71
75
|
expect(result).to.exist;
|
|
72
76
|
},
|
|
73
77
|
Effect.provide(TestLayer),
|
|
@@ -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
|
|
@@ -83,24 +88,19 @@ export class AiChatProcessor {
|
|
|
83
88
|
/** Last request (for retries). */
|
|
84
89
|
private _lastRequest: AiRequest | undefined;
|
|
85
90
|
|
|
86
|
-
/**
|
|
87
|
-
* Pending messages (incl. the current user request).
|
|
88
|
-
*/
|
|
91
|
+
/** Pending messages (incl. the current user request). */
|
|
89
92
|
private readonly _pending = Rx.make<DataType.Message[]>([]);
|
|
90
93
|
|
|
91
|
-
/**
|
|
92
|
-
* Currently streaming message (from the AI service).
|
|
93
|
-
*/
|
|
94
|
+
/** Currently streaming message (from the AI service). */
|
|
94
95
|
private readonly _streaming = Rx.make<Option.Option<DataType.Message>>(Option.none());
|
|
95
96
|
|
|
96
|
-
/**
|
|
97
|
-
* Streaming state.
|
|
98
|
-
*/
|
|
97
|
+
/** Streaming state. */
|
|
99
98
|
public readonly streaming = Rx.make<boolean>((get) => Option.isSome(get(this._streaming)));
|
|
100
99
|
|
|
101
|
-
/**
|
|
102
|
-
|
|
103
|
-
|
|
100
|
+
/** Active state. */
|
|
101
|
+
public readonly active = Rx.make(false);
|
|
102
|
+
|
|
103
|
+
/** Array of Messages (incl. the current message being streamed). */
|
|
104
104
|
public readonly messages = Rx.make<DataType.Message[]>((get) =>
|
|
105
105
|
Option.match(get(this._streaming), {
|
|
106
106
|
onNone: () => get(this._pending),
|
|
@@ -114,7 +114,7 @@ export class AiChatProcessor {
|
|
|
114
114
|
constructor(
|
|
115
115
|
private readonly _conversation: AiConversation,
|
|
116
116
|
// TODO(dmaretskyi): Replace this with effect's ManagedRuntime wrapping this layer.
|
|
117
|
-
private readonly _services:
|
|
117
|
+
private readonly _services: () => Promise<Runtime.Runtime<AiChatServices>>,
|
|
118
118
|
private readonly _options: AiChatProcessorOptions = defaultOptions,
|
|
119
119
|
) {
|
|
120
120
|
// Initialize registries and defaults before using in other logic.
|
|
@@ -129,10 +129,6 @@ export class AiChatProcessor {
|
|
|
129
129
|
}
|
|
130
130
|
}
|
|
131
131
|
|
|
132
|
-
get isRunning() {
|
|
133
|
-
return !!this._fiber;
|
|
134
|
-
}
|
|
135
|
-
|
|
136
132
|
get context() {
|
|
137
133
|
return this._conversation.context;
|
|
138
134
|
}
|
|
@@ -156,6 +152,7 @@ export class AiChatProcessor {
|
|
|
156
152
|
try {
|
|
157
153
|
this._lastRequest = requestParam;
|
|
158
154
|
this._rx.set(this.error, Option.none());
|
|
155
|
+
this._rx.set(this.active, true);
|
|
159
156
|
|
|
160
157
|
// Create request.
|
|
161
158
|
const request = this._conversation.createRequest({
|
|
@@ -164,19 +161,17 @@ export class AiChatProcessor {
|
|
|
164
161
|
observer: this._observer,
|
|
165
162
|
});
|
|
166
163
|
|
|
164
|
+
const runtime = await this._services();
|
|
165
|
+
|
|
167
166
|
// Create fiber.
|
|
168
167
|
this._fiber = request.pipe(
|
|
169
|
-
Effect.provide(
|
|
168
|
+
Effect.provide(AiService.model(this._options.model ?? DEFAULT_EDGE_MODEL)),
|
|
170
169
|
|
|
171
170
|
// TODO(dmaretskyi): Move ArtifactDiffResolver upstream.
|
|
172
171
|
Effect.provideService(ArtifactDiffResolver, this._artifactDiffResolver),
|
|
173
172
|
|
|
174
173
|
Effect.asVoid,
|
|
175
|
-
|
|
176
|
-
log.error('request failed', { cause });
|
|
177
|
-
return Effect.void;
|
|
178
|
-
}),
|
|
179
|
-
Effect.runFork, // Runs in the background.
|
|
174
|
+
Runtime.runFork(runtime), // Runs in the background.
|
|
180
175
|
);
|
|
181
176
|
|
|
182
177
|
// Execute request.
|
|
@@ -188,11 +183,12 @@ export class AiChatProcessor {
|
|
|
188
183
|
this._rx.set(this.error, Option.none());
|
|
189
184
|
this._lastRequest = undefined;
|
|
190
185
|
this._fiber = undefined;
|
|
191
|
-
} catch (
|
|
192
|
-
log.error('request failed', {
|
|
193
|
-
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 })));
|
|
194
189
|
} finally {
|
|
195
190
|
this._fiber = undefined;
|
|
191
|
+
this._rx.set(this.active, false);
|
|
196
192
|
}
|
|
197
193
|
}
|
|
198
194
|
|
|
@@ -209,6 +205,7 @@ export class AiChatProcessor {
|
|
|
209
205
|
);
|
|
210
206
|
|
|
211
207
|
this._fiber = undefined;
|
|
208
|
+
this._rx.set(this.active, false);
|
|
212
209
|
}
|
|
213
210
|
|
|
214
211
|
/**
|
|
@@ -224,32 +221,8 @@ export class AiChatProcessor {
|
|
|
224
221
|
* Update the current chat's name.
|
|
225
222
|
*/
|
|
226
223
|
async updateName(chat: Assistant.Chat): Promise<void> {
|
|
227
|
-
const
|
|
228
|
-
|
|
229
|
-
If you cannot do this effectively respond with "New Chat".
|
|
230
|
-
`;
|
|
231
|
-
|
|
232
|
-
const history = await this._conversation.getHistory();
|
|
233
|
-
const fiber = Effect.gen(this, function* () {
|
|
234
|
-
const session = new AiSession();
|
|
235
|
-
return yield* session.run({ system, prompt: 'Suggest a name for this chat', history });
|
|
236
|
-
}).pipe(
|
|
237
|
-
// TODO(burdon): Use simpler model.
|
|
238
|
-
Effect.provide(Layer.provideMerge(AiService.model(this._options.model ?? DEFAULT_EDGE_MODEL), this._services)),
|
|
239
|
-
Effect.tap((messages) => {
|
|
240
|
-
const message = messages.find((message) => message.sender.role === 'assistant');
|
|
241
|
-
const title = message?.blocks.find((b) => b._tag === 'text')?.text;
|
|
242
|
-
if (title) {
|
|
243
|
-
chat.name = title;
|
|
244
|
-
}
|
|
245
|
-
}),
|
|
246
|
-
Effect.runFork, // Run in the background.
|
|
247
|
-
);
|
|
248
|
-
|
|
249
|
-
const response = await fiber.pipe(Fiber.join, Effect.runPromiseExit);
|
|
250
|
-
if (!Exit.isSuccess(response)) {
|
|
251
|
-
throwCause(response.cause);
|
|
252
|
-
}
|
|
224
|
+
const runtime = await this._services();
|
|
225
|
+
await updateName(runtime, this._conversation, chat, this._options.model);
|
|
253
226
|
}
|
|
254
227
|
|
|
255
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/queue-logger.ts
CHANGED
|
@@ -39,7 +39,7 @@ export class QueueLogger implements SequenceLogger {
|
|
|
39
39
|
Obj.make(InvocationTraceStartEvent, {
|
|
40
40
|
type: InvocationTraceEventType.START,
|
|
41
41
|
invocationId: event.invocationId,
|
|
42
|
-
|
|
42
|
+
timestamp: Date.now(),
|
|
43
43
|
input: {},
|
|
44
44
|
invocationTraceQueue: Ref.fromDXN(this._getTraceQueueDxn(event.invocationId)),
|
|
45
45
|
invocationTarget: Ref.make(this.sequence),
|
|
@@ -51,7 +51,7 @@ export class QueueLogger implements SequenceLogger {
|
|
|
51
51
|
Obj.make(InvocationTraceEndEvent, {
|
|
52
52
|
type: InvocationTraceEventType.END,
|
|
53
53
|
invocationId: event.invocationId,
|
|
54
|
-
|
|
54
|
+
timestamp: Date.now(),
|
|
55
55
|
outcome: InvocationOutcome.SUCCESS,
|
|
56
56
|
}),
|
|
57
57
|
]);
|
|
@@ -65,7 +65,7 @@ export class QueueLogger implements SequenceLogger {
|
|
|
65
65
|
ingestionTimestamp: Date.now(),
|
|
66
66
|
logs: [
|
|
67
67
|
{
|
|
68
|
-
|
|
68
|
+
timestamp: Date.now(),
|
|
69
69
|
level: 'info',
|
|
70
70
|
message: event.type,
|
|
71
71
|
context: { step: event.step },
|
|
@@ -83,7 +83,7 @@ export class QueueLogger implements SequenceLogger {
|
|
|
83
83
|
ingestionTimestamp: Date.now(),
|
|
84
84
|
logs: [
|
|
85
85
|
{
|
|
86
|
-
|
|
86
|
+
timestamp: Date.now(),
|
|
87
87
|
level: 'info',
|
|
88
88
|
message: event.type,
|
|
89
89
|
context: { message: event.message },
|
|
@@ -101,7 +101,7 @@ export class QueueLogger implements SequenceLogger {
|
|
|
101
101
|
ingestionTimestamp: Date.now(),
|
|
102
102
|
logs: [
|
|
103
103
|
{
|
|
104
|
-
|
|
104
|
+
timestamp: Date.now(),
|
|
105
105
|
level: 'info',
|
|
106
106
|
message: event.type,
|
|
107
107
|
context: { block: event.block },
|
package/src/testing/index.ts
CHANGED
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
|
+
|
|
7
|
+
import { Obj } from '@dxos/echo';
|
|
8
|
+
import { ContextQueueService, DatabaseService } from '@dxos/functions';
|
|
9
|
+
import { faker } from '@dxos/random';
|
|
10
|
+
import { renderObjectLink } from '@dxos/react-ui-components';
|
|
11
|
+
import { type ContentBlock, DataType } from '@dxos/schema';
|
|
12
|
+
import { trim } from '@dxos/util';
|
|
13
|
+
|
|
14
|
+
export const createMessage = (role: DataType.ActorRole, blocks: ContentBlock.Any[]): DataType.Message => {
|
|
15
|
+
return Obj.make(DataType.Message, {
|
|
16
|
+
created: new Date().toISOString(),
|
|
17
|
+
sender: { role },
|
|
18
|
+
blocks,
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export type MessageGenerator = Effect.Effect<void, never, DatabaseService | ContextQueueService>;
|
|
23
|
+
|
|
24
|
+
export const createMessageGenerator = (): MessageGenerator[] => [
|
|
25
|
+
Effect.gen(function* () {
|
|
26
|
+
const { queue } = yield* ContextQueueService;
|
|
27
|
+
yield* Effect.promise(() =>
|
|
28
|
+
queue.append([
|
|
29
|
+
createMessage('user', [
|
|
30
|
+
{
|
|
31
|
+
_tag: 'text',
|
|
32
|
+
text: faker.lorem.sentence(5),
|
|
33
|
+
},
|
|
34
|
+
]),
|
|
35
|
+
]),
|
|
36
|
+
);
|
|
37
|
+
}),
|
|
38
|
+
|
|
39
|
+
Effect.gen(function* () {
|
|
40
|
+
const { queue } = yield* ContextQueueService;
|
|
41
|
+
yield* Effect.promise(() =>
|
|
42
|
+
queue.append([
|
|
43
|
+
createMessage('assistant', [
|
|
44
|
+
{
|
|
45
|
+
_tag: 'text',
|
|
46
|
+
text:
|
|
47
|
+
trim`
|
|
48
|
+
## Markdown
|
|
49
|
+
Here is a [link](https://dxos.org)
|
|
50
|
+
|
|
51
|
+
And some **bold** text.
|
|
52
|
+
|
|
53
|
+
And some JSON
|
|
54
|
+
\`\`\`json
|
|
55
|
+
{
|
|
56
|
+
"key": "value"
|
|
57
|
+
}
|
|
58
|
+
\`\`\`
|
|
59
|
+
|
|
60
|
+
And some code
|
|
61
|
+
\`\`\`js
|
|
62
|
+
const x = 1;
|
|
63
|
+
\`\`\`
|
|
64
|
+
` + '\n',
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
_tag: 'text',
|
|
68
|
+
disposition: 'cot',
|
|
69
|
+
text:
|
|
70
|
+
[
|
|
71
|
+
faker.lorem.paragraph(),
|
|
72
|
+
'',
|
|
73
|
+
...Array.from({ length: faker.number.int({ min: 3, max: 5 }) }).map(
|
|
74
|
+
(_, idx) => `${idx + 1}. ${faker.lorem.paragraph()}`,
|
|
75
|
+
),
|
|
76
|
+
].join('\n') + '\n',
|
|
77
|
+
},
|
|
78
|
+
]),
|
|
79
|
+
]),
|
|
80
|
+
);
|
|
81
|
+
}),
|
|
82
|
+
|
|
83
|
+
Effect.gen(function* () {
|
|
84
|
+
const { queue } = yield* ContextQueueService;
|
|
85
|
+
yield* Effect.promise(() =>
|
|
86
|
+
queue.append([
|
|
87
|
+
createMessage('assistant', [
|
|
88
|
+
{
|
|
89
|
+
_tag: 'text',
|
|
90
|
+
text: 'How can I help?',
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
_tag: 'suggestion',
|
|
94
|
+
text: 'List tools',
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
_tag: 'suggestion',
|
|
98
|
+
text: 'Show info',
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
_tag: 'suggestion',
|
|
102
|
+
text: faker.lorem.paragraph(),
|
|
103
|
+
},
|
|
104
|
+
]),
|
|
105
|
+
createMessage('assistant', [
|
|
106
|
+
{
|
|
107
|
+
_tag: 'text',
|
|
108
|
+
text: 'Select an option:',
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
_tag: 'select',
|
|
112
|
+
options: ['Option 1', 'Option 2', 'Option 3'],
|
|
113
|
+
},
|
|
114
|
+
]),
|
|
115
|
+
]),
|
|
116
|
+
);
|
|
117
|
+
}),
|
|
118
|
+
|
|
119
|
+
Effect.gen(function* () {
|
|
120
|
+
const { queue } = yield* ContextQueueService;
|
|
121
|
+
yield* Effect.promise(() =>
|
|
122
|
+
queue.append([
|
|
123
|
+
createMessage('assistant', [
|
|
124
|
+
{
|
|
125
|
+
_tag: 'toolkit',
|
|
126
|
+
},
|
|
127
|
+
]),
|
|
128
|
+
]),
|
|
129
|
+
);
|
|
130
|
+
}),
|
|
131
|
+
|
|
132
|
+
Effect.gen(function* () {
|
|
133
|
+
const { queue } = yield* ContextQueueService;
|
|
134
|
+
yield* Effect.promise(() =>
|
|
135
|
+
queue.append([
|
|
136
|
+
createMessage('user', [
|
|
137
|
+
{
|
|
138
|
+
_tag: 'text',
|
|
139
|
+
text: faker.lorem.sentence(5),
|
|
140
|
+
},
|
|
141
|
+
]),
|
|
142
|
+
]),
|
|
143
|
+
);
|
|
144
|
+
}),
|
|
145
|
+
|
|
146
|
+
Effect.gen(function* () {
|
|
147
|
+
const { queue } = yield* ContextQueueService;
|
|
148
|
+
const { db } = yield* DatabaseService;
|
|
149
|
+
const obj1 = db.add(Obj.make(DataType.Organization, { name: 'DXOS' }));
|
|
150
|
+
// const obj2 = db.add(Obj.make(DataType.Person, { fullName: 'Alice' }));
|
|
151
|
+
// const obj3 = db.add(Obj.make(DataType.Person, { fullName: 'Bob' }));
|
|
152
|
+
// const obj4 = db.add(Obj.make(DataType.Person, { fullName: 'Charlie' }));
|
|
153
|
+
yield* Effect.promise(() =>
|
|
154
|
+
queue.append([
|
|
155
|
+
createMessage('assistant', [
|
|
156
|
+
// Inline tag.
|
|
157
|
+
{
|
|
158
|
+
_tag: 'text',
|
|
159
|
+
text: [faker.lorem.paragraph(), renderObjectLink(obj1), faker.lorem.paragraph(), '\n'].join(' '),
|
|
160
|
+
},
|
|
161
|
+
|
|
162
|
+
// Inline cards.
|
|
163
|
+
// ...[obj1, obj2, obj3, obj4].map(
|
|
164
|
+
// (obj) =>
|
|
165
|
+
// ({
|
|
166
|
+
// _tag: 'text',
|
|
167
|
+
// text: renderObjectLink(obj, true) + '\n',
|
|
168
|
+
// }) satisfies ContentBlock.Text,
|
|
169
|
+
// ),
|
|
170
|
+
]),
|
|
171
|
+
]),
|
|
172
|
+
);
|
|
173
|
+
}),
|
|
174
|
+
|
|
175
|
+
Effect.gen(function* () {
|
|
176
|
+
const { queue } = yield* ContextQueueService;
|
|
177
|
+
yield* Effect.promise(() =>
|
|
178
|
+
queue.append([
|
|
179
|
+
createMessage('assistant', [
|
|
180
|
+
{
|
|
181
|
+
_tag: 'text',
|
|
182
|
+
text: faker.lorem.paragraph() + '\n',
|
|
183
|
+
},
|
|
184
|
+
]),
|
|
185
|
+
createMessage('assistant', [
|
|
186
|
+
{
|
|
187
|
+
_tag: 'toolCall',
|
|
188
|
+
toolCallId: '1234',
|
|
189
|
+
name: 'search',
|
|
190
|
+
input: JSON.stringify({}),
|
|
191
|
+
providerExecuted: false,
|
|
192
|
+
},
|
|
193
|
+
]),
|
|
194
|
+
createMessage('user', [
|
|
195
|
+
{
|
|
196
|
+
_tag: 'toolResult',
|
|
197
|
+
toolCallId: '1234',
|
|
198
|
+
name: 'search',
|
|
199
|
+
result: 'This is a tool result.',
|
|
200
|
+
providerExecuted: false,
|
|
201
|
+
},
|
|
202
|
+
]),
|
|
203
|
+
]),
|
|
204
|
+
);
|
|
205
|
+
}),
|
|
206
|
+
|
|
207
|
+
Effect.gen(function* () {
|
|
208
|
+
const { queue } = yield* ContextQueueService;
|
|
209
|
+
yield* Effect.promise(() =>
|
|
210
|
+
queue.append([
|
|
211
|
+
createMessage('assistant', [
|
|
212
|
+
{
|
|
213
|
+
_tag: 'text',
|
|
214
|
+
text: faker.lorem.paragraph() + '\n',
|
|
215
|
+
},
|
|
216
|
+
]),
|
|
217
|
+
createMessage('assistant', [
|
|
218
|
+
{
|
|
219
|
+
_tag: 'toolCall',
|
|
220
|
+
toolCallId: '4567',
|
|
221
|
+
name: 'create',
|
|
222
|
+
input: JSON.stringify({}),
|
|
223
|
+
providerExecuted: false,
|
|
224
|
+
},
|
|
225
|
+
]),
|
|
226
|
+
createMessage('user', [
|
|
227
|
+
{
|
|
228
|
+
_tag: 'toolResult',
|
|
229
|
+
toolCallId: '4567',
|
|
230
|
+
name: 'create',
|
|
231
|
+
result: 'This is a tool result.',
|
|
232
|
+
providerExecuted: false,
|
|
233
|
+
},
|
|
234
|
+
]),
|
|
235
|
+
createMessage('assistant', [
|
|
236
|
+
{
|
|
237
|
+
_tag: 'text',
|
|
238
|
+
text:
|
|
239
|
+
Array.from({ length: faker.number.int({ min: 2, max: 3 }) })
|
|
240
|
+
.map(() => faker.lorem.paragraph())
|
|
241
|
+
.join('\n\n') + '\n',
|
|
242
|
+
},
|
|
243
|
+
]),
|
|
244
|
+
]),
|
|
245
|
+
);
|
|
246
|
+
}),
|
|
247
|
+
|
|
248
|
+
Effect.gen(function* () {
|
|
249
|
+
const { queue } = yield* ContextQueueService;
|
|
250
|
+
yield* Effect.promise(() =>
|
|
251
|
+
queue.append([
|
|
252
|
+
createMessage('assistant', [
|
|
253
|
+
{
|
|
254
|
+
_tag: 'text',
|
|
255
|
+
text: faker.lorem.paragraph(),
|
|
256
|
+
},
|
|
257
|
+
]),
|
|
258
|
+
]),
|
|
259
|
+
);
|
|
260
|
+
}),
|
|
261
|
+
];
|
|
@@ -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
|
}
|