@dxos/plugin-assistant 0.8.4-main.67995b8 → 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-IZ4AK5EO.mjs → BlueprintContainer-GMSYKGSO.mjs} +14 -6
- package/dist/lib/browser/BlueprintContainer-GMSYKGSO.mjs.map +7 -0
- package/dist/lib/browser/ChatCompanion-M3FDKTQM.mjs +151 -0
- package/dist/lib/browser/ChatCompanion-M3FDKTQM.mjs.map +7 -0
- package/dist/lib/browser/{ChatContainer-RP3QEXYX.mjs → ChatContainer-KAH7XITI.mjs} +34 -14
- package/dist/lib/browser/ChatContainer-KAH7XITI.mjs.map +7 -0
- package/dist/lib/browser/{ChatDialog-ZVLXFHEY.mjs → ChatDialog-ZWRGABW6.mjs} +27 -12
- 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-XSEOKJLG.mjs → app-graph-builder-R5T7BJPC.mjs} +60 -41
- 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/blueprint-definition-AGTDXTXO.mjs.map +7 -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-A2NVNXPL.mjs +170 -0
- package/dist/lib/browser/chunk-A2NVNXPL.mjs.map +7 -0
- package/dist/lib/browser/chunk-CQW6UPJM.mjs +199 -0
- package/dist/lib/browser/chunk-CQW6UPJM.mjs.map +7 -0
- package/dist/lib/browser/chunk-GNI6HL6G.mjs +219 -0
- 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-J5LGTIGS.mjs +10 -0
- package/dist/lib/browser/chunk-J5LGTIGS.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-MEN5WTLA.mjs +182 -0
- package/dist/lib/browser/chunk-MEN5WTLA.mjs.map +7 -0
- package/dist/lib/browser/chunk-PUG24BEC.mjs +277 -0
- package/dist/lib/browser/chunk-PUG24BEC.mjs.map +7 -0
- package/dist/lib/browser/chunk-SJJV3HEX.mjs +16 -0
- 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 +185 -76
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/intent-resolver-3C5TABOX.mjs +136 -0
- 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-EYKA5IFU.mjs +90 -0
- package/dist/lib/browser/react-surface-EYKA5IFU.mjs.map +7 -0
- package/dist/lib/browser/{settings-5GTTCVGD.mjs → settings-VMVBYZLN.mjs} +8 -7
- package/dist/lib/{node-esm/settings-J2EXEM5H.mjs.map → browser/settings-VMVBYZLN.mjs.map} +1 -1
- package/dist/lib/browser/state-CFREPBB6.mjs +21 -0
- package/dist/lib/browser/state-CFREPBB6.mjs.map +7 -0
- 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 +7 -4
- package/dist/lib/node-esm/{BlueprintContainer-RGTMNLNX.mjs → BlueprintContainer-6GBLMK4Z.mjs} +14 -6
- package/dist/lib/node-esm/BlueprintContainer-6GBLMK4Z.mjs.map +7 -0
- package/dist/lib/node-esm/ChatCompanion-OV426GCP.mjs +152 -0
- package/dist/lib/node-esm/ChatCompanion-OV426GCP.mjs.map +7 -0
- package/dist/lib/node-esm/{ChatContainer-W3W6FWV3.mjs → ChatContainer-UKY7NHFY.mjs} +34 -14
- package/dist/lib/node-esm/ChatContainer-UKY7NHFY.mjs.map +7 -0
- package/dist/lib/node-esm/{ChatDialog-QW4JRKVO.mjs → ChatDialog-2BDQIEXH.mjs} +27 -12
- 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-PANCJUHV.mjs → app-graph-builder-I52RYVWH.mjs} +60 -41
- package/dist/lib/node-esm/app-graph-builder-I52RYVWH.mjs.map +7 -0
- package/dist/lib/node-esm/blueprint-definition-CFCUD2VC.mjs +14 -0
- package/dist/lib/node-esm/blueprint-definition-CFCUD2VC.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-2CAETDW2.mjs +183 -0
- package/dist/lib/node-esm/chunk-2CAETDW2.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-4J5FYNNM.mjs +171 -0
- package/dist/lib/node-esm/chunk-4J5FYNNM.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-5ARE4R2I.mjs +220 -0
- 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-HSLMI22Q.mjs +11 -0
- package/dist/lib/node-esm/chunk-HSLMI22Q.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-O36P4LN5.mjs +200 -0
- 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-XM4BVQQR.mjs +278 -0
- package/dist/lib/node-esm/chunk-XM4BVQQR.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-XQBL2SBL.mjs +17 -0
- 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 +185 -76
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/intent-resolver-HQ27YALS.mjs +137 -0
- 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-UOC3CBPH.mjs +91 -0
- package/dist/lib/node-esm/react-surface-UOC3CBPH.mjs.map +7 -0
- package/dist/lib/node-esm/{settings-J2EXEM5H.mjs → settings-7AUVNDM2.mjs} +8 -7
- package/dist/lib/{browser/settings-5GTTCVGD.mjs.map → node-esm/settings-7AUVNDM2.mjs.map} +1 -1
- package/dist/lib/node-esm/state-XXND44OW.mjs +22 -0
- package/dist/lib/node-esm/state-XXND44OW.mjs.map +7 -0
- 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 +7 -4
- 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 +4 -0
- package/dist/types/src/capabilities/ai-service.d.ts.map +1 -0
- package/dist/types/src/capabilities/app-graph-builder.d.ts +1 -1
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
- package/dist/types/src/capabilities/blueprint-definition.d.ts +7 -0
- package/dist/types/src/capabilities/blueprint-definition.d.ts.map +1 -0
- package/dist/types/src/capabilities/capabilities.d.ts +11 -0
- package/dist/types/src/capabilities/capabilities.d.ts.map +1 -0
- package/dist/types/src/capabilities/edge-model-resolver.d.ts +4 -0
- package/dist/types/src/capabilities/edge-model-resolver.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +11 -3
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/intent-resolver.d.ts +1 -1
- package/dist/types/src/capabilities/intent-resolver.d.ts.map +1 -1
- package/dist/types/src/capabilities/local-model-resolver.d.ts +10 -0
- package/dist/types/src/capabilities/local-model-resolver.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface.d.ts +1 -1
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
- package/dist/types/src/capabilities/settings.d.ts +1 -1
- package/dist/types/src/capabilities/state.d.ts +4 -0
- package/dist/types/src/capabilities/state.d.ts.map +1 -0
- package/dist/types/src/capabilities/toolkit.d.ts +4 -0
- package/dist/types/src/capabilities/toolkit.d.ts.map +1 -0
- package/dist/types/src/components/AssistantSettings/AssistantSettings.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 +21 -17
- package/dist/types/src/components/Chat/Chat.d.ts.map +1 -1
- package/dist/types/src/components/Chat/events.d.ts +5 -0
- package/dist/types/src/components/Chat/events.d.ts.map +1 -1
- package/dist/types/src/components/ChatCompanion.d.ts +13 -0
- package/dist/types/src/components/ChatCompanion.d.ts.map +1 -0
- package/dist/types/src/components/ChatContainer.d.ts +4 -4
- package/dist/types/src/components/ChatContainer.d.ts.map +1 -1
- package/dist/types/src/components/ChatDialog.d.ts.map +1 -1
- package/dist/types/src/components/ChatProgress/ChatProgress.d.ts +7 -0
- package/dist/types/src/components/ChatProgress/ChatProgress.d.ts.map +1 -0
- package/dist/types/src/components/ChatProgress/index.d.ts +2 -0
- package/dist/types/src/components/ChatProgress/index.d.ts.map +1 -0
- package/dist/types/src/components/ChatPrompt/ChatActions.d.ts.map +1 -1
- package/dist/types/src/components/ChatPrompt/ChatOptions.d.ts +20 -0
- package/dist/types/src/components/ChatPrompt/ChatOptions.d.ts.map +1 -0
- package/dist/types/src/components/ChatPrompt/ChatPresets.d.ts.map +1 -1
- package/dist/types/src/components/ChatPrompt/ChatReferences.d.ts +4 -5
- package/dist/types/src/components/ChatPrompt/ChatReferences.d.ts.map +1 -1
- package/dist/types/src/components/ChatPrompt/ChatStatusIndicator.d.ts +6 -4
- package/dist/types/src/components/ChatPrompt/ChatStatusIndicator.d.ts.map +1 -1
- package/dist/types/src/components/ChatPrompt/index.d.ts +1 -1
- package/dist/types/src/components/ChatPrompt/index.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/ChatThread.d.ts +12 -7
- package/dist/types/src/components/ChatThread/ChatThread.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/ChatThread.stories.d.ts +120 -33
- package/dist/types/src/components/ChatThread/ChatThread.stories.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/Link.d.ts +9 -0
- package/dist/types/src/components/ChatThread/Link.d.ts.map +1 -0
- package/dist/types/src/components/ChatThread/reducers.d.ts +40 -0
- package/dist/types/src/components/ChatThread/reducers.d.ts.map +1 -0
- 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/ChatToolbar/useChatToolbarActions.d.ts +9 -0
- package/dist/types/src/components/ChatToolbar/useChatToolbarActions.d.ts.map +1 -0
- package/dist/types/src/components/TemplateEditor/TemplateEditor.d.ts +2 -6
- package/dist/types/src/components/TemplateEditor/TemplateEditor.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/TemplateEditor.stories.d.ts +265 -7
- 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 +262 -2
- package/dist/types/src/components/TemplateEditor/TemplateForm.stories.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/handlebars-extension.d.ts +12 -0
- package/dist/types/src/components/TemplateEditor/handlebars-extension.d.ts.map +1 -0
- 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 +6 -11
- package/dist/types/src/components/Toolbox/Toolbox.d.ts.map +1 -1
- package/dist/types/src/components/Toolbox/Toolbox.stories.d.ts +266 -5
- package/dist/types/src/components/Toolbox/Toolbox.stories.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +4 -5
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/events.d.ts +1 -1
- package/dist/types/src/events.d.ts.map +1 -1
- package/dist/types/src/functions/analysis.d.ts +5 -0
- package/dist/types/src/functions/analysis.d.ts.map +1 -0
- package/dist/types/src/functions/index.d.ts +4 -0
- package/dist/types/src/functions/index.d.ts.map +1 -0
- package/dist/types/src/functions/object-list.d.ts +10 -0
- package/dist/types/src/functions/object-list.d.ts.map +1 -0
- package/dist/types/src/functions/object-load.d.ts +8 -0
- package/dist/types/src/functions/object-load.d.ts.map +1 -0
- package/dist/types/src/hooks/index.d.ts +7 -3
- package/dist/types/src/hooks/index.d.ts.map +1 -1
- package/dist/types/src/hooks/useBlueprintRegistry.d.ts +25 -0
- package/dist/types/src/hooks/useBlueprintRegistry.d.ts.map +1 -0
- package/dist/types/src/hooks/useChatProcessor.d.ts +8 -21
- package/dist/types/src/hooks/useChatProcessor.d.ts.map +1 -1
- package/dist/types/src/hooks/useChatServices.d.ts +5 -6
- package/dist/types/src/hooks/useChatServices.d.ts.map +1 -1
- package/dist/types/src/hooks/useContextBinder.d.ts +4 -0
- package/dist/types/src/hooks/useContextBinder.d.ts.map +1 -0
- package/dist/types/src/hooks/useContextObjects.d.ts +15 -0
- package/dist/types/src/hooks/useContextObjects.d.ts.map +1 -0
- package/dist/types/src/hooks/useFlush.d.ts +6 -0
- package/dist/types/src/hooks/useFlush.d.ts.map +1 -0
- package/dist/types/src/hooks/useItemTypes.d.ts +4 -0
- package/dist/types/src/hooks/useItemTypes.d.ts.map +1 -0
- package/dist/types/src/hooks/useOnline.d.ts +3 -0
- package/dist/types/src/hooks/useOnline.d.ts.map +1 -0
- package/dist/types/src/hooks/usePresets.d.ts +7 -0
- package/dist/types/src/hooks/usePresets.d.ts.map +1 -0
- package/dist/types/src/hooks/useReferencesProvider.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +2 -0
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +1 -2
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/processor/index.d.ts +4 -0
- package/dist/types/src/processor/index.d.ts.map +1 -0
- package/dist/types/src/{hooks → processor}/presets.d.ts +3 -3
- package/dist/types/src/processor/presets.d.ts.map +1 -0
- package/dist/types/src/processor/processor.d.ts +74 -0
- package/dist/types/src/processor/processor.d.ts.map +1 -0
- package/dist/types/src/processor/processor.test.d.ts +2 -0
- package/dist/types/src/processor/processor.test.d.ts.map +1 -0
- 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 -1
- 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-sequence.d.ts +0 -4
- package/dist/types/src/testing/test-sequence.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/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 +29 -12
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/Assistant.d.ts +48 -0
- package/dist/types/src/types/Assistant.d.ts.map +1 -0
- package/dist/types/src/types/AssistantAction.d.ts +119 -0
- package/dist/types/src/types/AssistantAction.d.ts.map +1 -0
- package/dist/types/src/types/defs.d.ts +2 -0
- package/dist/types/src/types/defs.d.ts.map +1 -0
- package/dist/types/src/types/index.d.ts +3 -1
- package/dist/types/src/types/index.d.ts.map +1 -1
- package/dist/types/src/types/service.d.ts +21 -18
- package/dist/types/src/types/service.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +97 -96
- package/src/AssistantPlugin.tsx +154 -107
- package/src/capabilities/ai-service.ts +27 -0
- package/src/capabilities/app-graph-builder.ts +76 -51
- package/src/capabilities/blueprint-definition.ts +66 -0
- package/src/capabilities/capabilities.ts +18 -0
- package/src/capabilities/edge-model-resolver.ts +25 -0
- package/src/capabilities/index.ts +9 -0
- package/src/capabilities/intent-resolver.ts +72 -23
- package/src/capabilities/local-model-resolver.ts +30 -0
- package/src/capabilities/react-surface.tsx +10 -77
- package/src/capabilities/state.ts +20 -0
- package/src/capabilities/toolkit.ts +19 -0
- package/src/components/AssistantSettings/AssistantSettings.tsx +83 -76
- package/src/components/BlueprintContainer.tsx +8 -2
- package/src/components/Chat/Chat.tsx +189 -181
- package/src/components/Chat/events.ts +7 -0
- package/src/components/ChatCompanion.tsx +136 -0
- package/src/components/ChatContainer.tsx +19 -13
- package/src/components/ChatDialog.tsx +18 -14
- package/src/components/ChatProgress/ChatProgress.tsx +67 -0
- package/src/components/{SequenceEditor → ChatProgress}/index.ts +1 -1
- package/src/components/ChatPrompt/ChatActions.tsx +10 -24
- package/src/components/ChatPrompt/ChatOptions.tsx +225 -0
- package/src/components/ChatPrompt/ChatPresets.tsx +1 -0
- package/src/components/ChatPrompt/ChatReferences.tsx +31 -36
- package/src/components/ChatPrompt/ChatStatusIndicator.tsx +25 -22
- package/src/components/ChatPrompt/index.ts +1 -1
- package/src/components/ChatThread/ChatThread.stories.tsx +98 -112
- package/src/components/ChatThread/ChatThread.tsx +69 -29
- package/src/components/ChatThread/Link.tsx +26 -0
- package/src/components/ChatThread/reducers.ts +151 -0
- 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/ChatToolbar/ChatToolbar.tsx +23 -0
- package/src/components/ChatToolbar/index.ts +5 -0
- package/src/components/ChatToolbar/useChatToolbarActions.ts +126 -0
- package/src/components/TemplateEditor/TemplateEditor.stories.tsx +28 -15
- package/src/components/TemplateEditor/TemplateEditor.tsx +29 -54
- package/src/components/TemplateEditor/TemplateForm.stories.tsx +15 -10
- package/src/components/TemplateEditor/TemplateForm.tsx +4 -2
- package/src/components/TemplateEditor/handlebars-extension.ts +166 -0
- package/src/components/ToolBlock/ToolBlock.tsx +152 -0
- package/src/components/ToolBlock/ToolBlockWidget.tsx +5 -0
- package/src/components/ToolBlock/index.ts +6 -0
- package/src/components/Toolbox/Toolbox.stories.tsx +14 -23
- package/src/components/Toolbox/Toolbox.tsx +23 -53
- package/src/components/index.ts +3 -6
- package/src/events.ts +2 -2
- package/src/functions/analysis.ts +22 -0
- package/src/functions/index.ts +7 -0
- package/src/functions/object-list.ts +48 -0
- package/src/functions/object-load.ts +45 -0
- package/src/hooks/index.ts +7 -4
- package/src/hooks/useBlueprintRegistry.ts +94 -0
- package/src/hooks/useChatProcessor.ts +30 -99
- package/src/hooks/useChatServices.ts +30 -49
- package/src/hooks/useContextBinder.ts +30 -0
- package/src/hooks/useContextObjects.ts +58 -0
- package/src/hooks/useFlush.ts +35 -0
- package/src/hooks/useItemTypes.ts +37 -0
- package/src/hooks/useOnline.ts +10 -0
- package/src/hooks/usePresets.ts +44 -0
- package/src/hooks/useReferencesProvider.ts +11 -9
- package/src/index.ts +2 -0
- package/src/meta.ts +9 -6
- package/src/processor/index.ts +7 -0
- package/src/{hooks → processor}/presets.ts +15 -7
- package/src/processor/processor.test.ts +81 -0
- package/src/processor/processor.ts +277 -0
- package/src/processor/update-name.ts +57 -0
- package/src/queue-logger.ts +10 -10
- package/src/testing/index.ts +1 -1
- package/src/testing/test-generator.ts +261 -0
- package/src/testing/test-sequence.ts +2 -27
- 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 +32 -12
- package/src/types/Assistant.ts +63 -0
- package/src/types/AssistantAction.ts +70 -0
- package/src/types/defs.ts +5 -0
- package/src/types/index.ts +4 -1
- package/src/types/service.ts +17 -9
- package/src/vite-env.d.ts +30 -0
- package/dist/lib/browser/BlueprintContainer-IZ4AK5EO.mjs.map +0 -7
- package/dist/lib/browser/ChatContainer-RP3QEXYX.mjs.map +0 -7
- package/dist/lib/browser/ChatDialog-ZVLXFHEY.mjs.map +0 -7
- package/dist/lib/browser/SequenceContainer-3UDVKWPA.mjs +0 -162
- package/dist/lib/browser/SequenceContainer-3UDVKWPA.mjs.map +0 -7
- package/dist/lib/browser/app-graph-builder-XSEOKJLG.mjs.map +0 -7
- package/dist/lib/browser/chunk-63GG6U6D.mjs +0 -2226
- package/dist/lib/browser/chunk-63GG6U6D.mjs.map +0 -7
- package/dist/lib/browser/chunk-7W7LHTRH.mjs +0 -171
- package/dist/lib/browser/chunk-7W7LHTRH.mjs.map +0 -7
- package/dist/lib/browser/chunk-FDCJSQYF.mjs +0 -40
- package/dist/lib/browser/chunk-FDCJSQYF.mjs.map +0 -7
- package/dist/lib/browser/chunk-KFXSBNZR.mjs +0 -89
- package/dist/lib/browser/chunk-KFXSBNZR.mjs.map +0 -7
- package/dist/lib/browser/chunk-LERGF5YG.mjs +0 -108
- package/dist/lib/browser/chunk-LERGF5YG.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-MV3VSZLS.mjs +0 -75
- package/dist/lib/browser/intent-resolver-MV3VSZLS.mjs.map +0 -7
- package/dist/lib/browser/react-surface-3GYEHQRP.mjs +0 -150
- package/dist/lib/browser/react-surface-3GYEHQRP.mjs.map +0 -7
- package/dist/lib/node-esm/BlueprintContainer-RGTMNLNX.mjs.map +0 -7
- package/dist/lib/node-esm/ChatContainer-W3W6FWV3.mjs.map +0 -7
- package/dist/lib/node-esm/ChatDialog-QW4JRKVO.mjs.map +0 -7
- package/dist/lib/node-esm/SequenceContainer-RQQH5XOC.mjs +0 -163
- package/dist/lib/node-esm/SequenceContainer-RQQH5XOC.mjs.map +0 -7
- package/dist/lib/node-esm/app-graph-builder-PANCJUHV.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-BFO3KHYL.mjs +0 -2227
- package/dist/lib/node-esm/chunk-BFO3KHYL.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-MS3PJARN.mjs +0 -109
- package/dist/lib/node-esm/chunk-MS3PJARN.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-QN2H2EHV.mjs +0 -41
- package/dist/lib/node-esm/chunk-QN2H2EHV.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-VIIMA3XQ.mjs +0 -90
- package/dist/lib/node-esm/chunk-VIIMA3XQ.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-Z7PUODRT.mjs +0 -172
- package/dist/lib/node-esm/chunk-Z7PUODRT.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-3FMC3GHC.mjs +0 -76
- package/dist/lib/node-esm/intent-resolver-3FMC3GHC.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-QDQWJ7FZ.mjs +0 -151
- package/dist/lib/node-esm/react-surface-QDQWJ7FZ.mjs.map +0 -7
- package/dist/types/src/capability-definitions.d.ts +0 -7
- package/dist/types/src/capability-definitions.d.ts.map +0 -1
- package/dist/types/src/components/ChatPrompt/ChatOptionsMenu.d.ts +0 -9
- package/dist/types/src/components/ChatPrompt/ChatOptionsMenu.d.ts.map +0 -1
- package/dist/types/src/components/ChatThread/ChatMessage.d.ts +0 -17
- 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/ChatThread/reducer.d.ts +0 -12
- package/dist/types/src/components/ChatThread/reducer.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 -8
- 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/hooks/chat-processor.d.ts +0 -86
- package/dist/types/src/hooks/chat-processor.d.ts.map +0 -1
- package/dist/types/src/hooks/chat-processor.test.d.ts +0 -2
- package/dist/types/src/hooks/chat-processor.test.d.ts.map +0 -1
- package/dist/types/src/hooks/presets.d.ts.map +0 -1
- package/dist/types/src/hooks/useBlueprints.d.ts +0 -9
- package/dist/types/src/hooks/useBlueprints.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 -207
- package/dist/types/src/stories/Chat.stories.d.ts.map +0 -1
- package/dist/types/src/testing/test-functions.d.ts +0 -3
- package/dist/types/src/testing/test-functions.d.ts.map +0 -1
- package/dist/types/src/tools/function.d.ts +0 -5
- package/dist/types/src/tools/function.d.ts.map +0 -1
- package/dist/types/src/tools/index.d.ts +0 -3
- package/dist/types/src/tools/index.d.ts.map +0 -1
- package/dist/types/src/tools/openapi.d.ts +0 -10
- package/dist/types/src/tools/openapi.d.ts.map +0 -1
- package/dist/types/src/tools/openapi.test.d.ts +0 -2
- package/dist/types/src/tools/openapi.test.d.ts.map +0 -1
- package/dist/types/src/types/schema.d.ts +0 -120
- package/dist/types/src/types/schema.d.ts.map +0 -1
- package/src/capability-definitions.ts +0 -15
- package/src/components/ChatPrompt/ChatOptionsMenu.tsx +0 -52
- package/src/components/ChatThread/ChatMessage.tsx +0 -268
- package/src/components/ChatThread/ToolBlock.tsx +0 -121
- package/src/components/ChatThread/reducer.ts +0 -52
- package/src/components/PromptSettings.tsx +0 -89
- package/src/components/SequenceContainer.tsx +0 -132
- package/src/components/SequenceEditor/SequenceEditor.stories.tsx +0 -32
- package/src/components/SequenceEditor/SequenceEditor.tsx +0 -50
- package/src/hooks/chat-processor.test.ts +0 -16
- package/src/hooks/chat-processor.ts +0 -314
- package/src/hooks/useBlueprints.ts +0 -57
- package/src/parser/filter-generator.test.ts +0 -32
- package/src/parser/filter-generator.ts +0 -81
- 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 -34
- package/src/shims.d.ts +0 -8
- package/src/stories/Chat.stories.tsx +0 -371
- package/src/testing/test-functions.ts +0 -11
- package/src/tools/function.ts +0 -46
- package/src/tools/index.ts +0 -6
- package/src/tools/openapi.test.ts +0 -217
- package/src/tools/openapi.ts +0 -338
- package/src/types/schema.ts +0 -108
- package/src/typings.d.ts +0 -9
|
@@ -2,142 +2,73 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
5
|
+
import { RegistryContext } from '@effect-rx/rx-react';
|
|
6
|
+
import type * as Runtime from 'effect/Runtime';
|
|
7
|
+
import { useContext, useMemo, useState } from 'react';
|
|
7
8
|
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import { Conversation, createSystemPrompt } from '@dxos/assistant';
|
|
11
|
-
import { type ArtifactDefinition, type AssociatedArtifact, type Blueprint } from '@dxos/blueprints';
|
|
12
|
-
import { FunctionType } from '@dxos/functions';
|
|
9
|
+
import { AiConversation } from '@dxos/assistant';
|
|
10
|
+
import { type Blueprint } from '@dxos/blueprints';
|
|
13
11
|
import { log } from '@dxos/log';
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import { isNonNullable } from '@dxos/util';
|
|
12
|
+
import { type Queue } from '@dxos/react-client/echo';
|
|
13
|
+
import { useAsyncEffect } from '@dxos/react-ui';
|
|
17
14
|
|
|
18
|
-
import { type
|
|
19
|
-
import {
|
|
20
|
-
import { type Assistant, ServiceType } from '../types';
|
|
15
|
+
import { AiChatProcessor, type AiChatServices, type AiServicePreset } from '../processor';
|
|
16
|
+
import { type Assistant } from '../types';
|
|
21
17
|
|
|
22
|
-
type UseChatProcessorProps = {
|
|
23
|
-
preset?: AiServicePreset;
|
|
24
|
-
space?: Space;
|
|
18
|
+
export type UseChatProcessorProps = {
|
|
25
19
|
chat?: Assistant.Chat;
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
services?: Layer.Layer<ChatServices>;
|
|
20
|
+
preset?: AiServicePreset;
|
|
21
|
+
services?: () => Promise<Runtime.Runtime<AiChatServices>>;
|
|
29
22
|
blueprintRegistry?: Blueprint.Registry;
|
|
30
|
-
// TODO(burdon): Not currently used.
|
|
31
23
|
settings?: Assistant.Settings;
|
|
32
|
-
|
|
33
|
-
/** @deprecated */
|
|
34
|
-
instructions?: string;
|
|
35
|
-
/** @deprecated */
|
|
36
|
-
artifact?: AssociatedArtifact;
|
|
37
|
-
/** @deprecated */
|
|
38
|
-
noPluginArtifacts?: boolean;
|
|
39
24
|
};
|
|
40
25
|
|
|
41
26
|
/**
|
|
42
|
-
* Configure and create
|
|
27
|
+
* Configure and create AiChatProcessor.
|
|
43
28
|
*/
|
|
44
29
|
export const useChatProcessor = ({
|
|
45
|
-
preset,
|
|
46
|
-
space,
|
|
47
30
|
chat,
|
|
31
|
+
preset,
|
|
48
32
|
services,
|
|
49
33
|
blueprintRegistry,
|
|
50
34
|
settings,
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
noPluginArtifacts,
|
|
54
|
-
}: UseChatProcessorProps): ChatProcessor | undefined => {
|
|
55
|
-
const { dispatchPromise: dispatch } = useIntentDispatcher();
|
|
56
|
-
const globalTools = useCapabilities(Capabilities.Tools);
|
|
57
|
-
|
|
58
|
-
// TODO(burdon): Spec artifacts.
|
|
59
|
-
let artifacts: readonly ArtifactDefinition[] = useCapabilities(Capabilities.ArtifactDefinition);
|
|
60
|
-
if (noPluginArtifacts) {
|
|
61
|
-
artifacts = Stable.array;
|
|
62
|
-
}
|
|
35
|
+
}: UseChatProcessorProps): AiChatProcessor | undefined => {
|
|
36
|
+
const observableRegistry = useContext(RegistryContext);
|
|
63
37
|
|
|
64
|
-
//
|
|
65
|
-
const
|
|
66
|
-
|
|
67
|
-
useEffect(() => {
|
|
68
|
-
log('creating service tools...');
|
|
69
|
-
queueMicrotask(async () => {
|
|
70
|
-
const tools = await Promise.all(remoteServices.map((service) => createToolsFromService(service)));
|
|
71
|
-
setServiceTools(tools.flat());
|
|
72
|
-
});
|
|
73
|
-
}, [remoteServices]);
|
|
74
|
-
|
|
75
|
-
// Tools and context.
|
|
76
|
-
const config = useConfig();
|
|
77
|
-
const functions = useQuery(space, Filter.type(FunctionType));
|
|
78
|
-
const chatId = useMemo(() => (chat ? fullyQualifiedId(chat) : undefined), [chat]);
|
|
79
|
-
const [tools, extensions] = useMemo(() => {
|
|
80
|
-
log('creating tools...');
|
|
81
|
-
const tools: ExecutableTool[] = [
|
|
82
|
-
...globalTools.flat(),
|
|
83
|
-
...serviceTools,
|
|
84
|
-
...functions
|
|
85
|
-
.map((fn) => convertFunctionToTool(fn, config.values.runtime?.services?.edge?.url ?? '', space?.id))
|
|
86
|
-
.filter(isNonNullable),
|
|
87
|
-
];
|
|
88
|
-
const extensions = { space, dispatch, pivotId: chatId };
|
|
89
|
-
return [tools, extensions];
|
|
90
|
-
}, [dispatch, globalTools, space, chatId, serviceTools, functions]);
|
|
91
|
-
|
|
92
|
-
// TODO(burdon): Create from template.
|
|
93
|
-
const systemPrompt = useMemo(
|
|
94
|
-
() =>
|
|
95
|
-
createSystemPrompt({
|
|
96
|
-
artifacts: artifacts.map((definition) => `${definition.name}\n${definition.instructions}`),
|
|
97
|
-
artifact,
|
|
98
|
-
instructions,
|
|
99
|
-
}),
|
|
100
|
-
[artifacts, artifact, instructions],
|
|
101
|
-
);
|
|
102
|
-
|
|
103
|
-
const conversation = useMemo(() => {
|
|
38
|
+
// Create conversation from chat queue.
|
|
39
|
+
const [conversation, setConversation] = useState<AiConversation>();
|
|
40
|
+
useAsyncEffect(async () => {
|
|
104
41
|
if (!chat?.queue.target) {
|
|
105
42
|
return;
|
|
106
43
|
}
|
|
107
44
|
|
|
108
|
-
|
|
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
|
+
};
|
|
109
52
|
}, [chat?.queue.target]);
|
|
110
53
|
|
|
111
54
|
// Create processor.
|
|
112
|
-
// TODO(burdon): Updated on each query update above; should just update current processor?
|
|
113
55
|
const processor = useMemo(() => {
|
|
114
56
|
if (!services || !conversation) {
|
|
115
57
|
return undefined;
|
|
116
58
|
}
|
|
117
59
|
|
|
118
|
-
log
|
|
60
|
+
log('creating processor', {
|
|
119
61
|
preset,
|
|
120
|
-
artifacts: artifacts.length,
|
|
121
|
-
systemPrompt: systemPrompt.length,
|
|
122
62
|
model: preset?.model,
|
|
123
63
|
settings,
|
|
124
64
|
});
|
|
125
65
|
|
|
126
|
-
return new
|
|
127
|
-
|
|
128
|
-
extensions,
|
|
66
|
+
return new AiChatProcessor(conversation, services, {
|
|
67
|
+
observableRegistry,
|
|
129
68
|
blueprintRegistry,
|
|
130
|
-
artifacts,
|
|
131
|
-
systemPrompt,
|
|
132
69
|
model: preset?.model,
|
|
133
70
|
});
|
|
134
|
-
}, [services, conversation,
|
|
71
|
+
}, [services, conversation, blueprintRegistry, preset]);
|
|
135
72
|
|
|
136
73
|
return processor;
|
|
137
74
|
};
|
|
138
|
-
|
|
139
|
-
// TODO(dmaretskyi): Extract.
|
|
140
|
-
export const Stable = Object.freeze({
|
|
141
|
-
array: [] as readonly never[],
|
|
142
|
-
object: {} as {},
|
|
143
|
-
});
|
|
@@ -2,66 +2,47 @@
|
|
|
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
|
-
import { useDeepCompareMemoize } from 'use-deep-compare-effect';
|
|
8
8
|
|
|
9
|
-
import {
|
|
10
|
-
import { Capabilities, useCapabilities } from '@dxos/app-framework';
|
|
11
|
-
import { makeToolExecutionServiceFromFunctions, makeToolResolverFromFunctions } from '@dxos/assistant';
|
|
9
|
+
import { useCapability } from '@dxos/app-framework';
|
|
12
10
|
import { type Space } from '@dxos/client/echo';
|
|
13
|
-
import {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
DatabaseService,
|
|
17
|
-
LocalFunctionExecutionService,
|
|
18
|
-
QueueService,
|
|
19
|
-
RemoteFunctionExecutionService,
|
|
20
|
-
TracingService,
|
|
21
|
-
} from '@dxos/functions';
|
|
11
|
+
import { TracingService } from '@dxos/functions';
|
|
12
|
+
import { AutomationCapabilities } from '@dxos/plugin-automation';
|
|
13
|
+
import { useClient } from '@dxos/react-client';
|
|
22
14
|
|
|
23
|
-
import {
|
|
24
|
-
|
|
25
|
-
export * from '@dxos/assistant';
|
|
26
|
-
|
|
27
|
-
// TODO(burdon): Deconstruct into separate layers?
|
|
28
|
-
export type ChatServices =
|
|
29
|
-
| AiService
|
|
30
|
-
| CredentialsService
|
|
31
|
-
| DatabaseService
|
|
32
|
-
| QueueService
|
|
33
|
-
| RemoteFunctionExecutionService
|
|
34
|
-
| ToolResolverService
|
|
35
|
-
| ToolExecutionService
|
|
36
|
-
| TracingService;
|
|
15
|
+
import { type AiChatServices } from '../processor';
|
|
16
|
+
import { type Assistant } from '../types';
|
|
37
17
|
|
|
38
18
|
export type UseChatServicesProps = {
|
|
39
19
|
space?: Space;
|
|
20
|
+
chat?: Assistant.Chat;
|
|
40
21
|
};
|
|
41
22
|
|
|
42
23
|
/**
|
|
43
24
|
* Construct service layer.
|
|
44
25
|
*/
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
26
|
+
// TODO(dmaretskyi): Better return type.
|
|
27
|
+
export const useChatServices = ({
|
|
28
|
+
space,
|
|
29
|
+
chat,
|
|
30
|
+
}: UseChatServicesProps): (() => Promise<Runtime.Runtime<AiChatServices>>) | undefined => {
|
|
31
|
+
const client = useClient();
|
|
32
|
+
space ??= client.spaces.default;
|
|
33
|
+
|
|
34
|
+
const runtimeResolver = useCapability(AutomationCapabilities.ComputeRuntime);
|
|
50
35
|
return useMemo(() => {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
Layer.provideMerge(LocalFunctionExecutionService.layer),
|
|
64
|
-
Layer.provideMerge(RemoteFunctionExecutionService.mockLayer),
|
|
65
|
-
);
|
|
66
|
-
}, [space, useDeepCompareMemoize(functions.map((f) => f.name))]);
|
|
36
|
+
const runtime = runtimeResolver.getRuntime(space.id);
|
|
37
|
+
return () =>
|
|
38
|
+
runtime.runPromise(
|
|
39
|
+
Effect.gen(function* () {
|
|
40
|
+
return yield* Effect.runtime<AiChatServices>().pipe(
|
|
41
|
+
Effect.provide(
|
|
42
|
+
chat?.traceQueue?.target ? TracingService.layerQueue(chat.traceQueue?.target) : TracingService.layerNoop,
|
|
43
|
+
),
|
|
44
|
+
);
|
|
45
|
+
}),
|
|
46
|
+
);
|
|
47
|
+
}, [space, chat?.traceQueue?.target]);
|
|
67
48
|
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { useState } from 'react';
|
|
6
|
+
|
|
7
|
+
import { AiContextBinder } from '@dxos/assistant';
|
|
8
|
+
import { useAsyncEffect } from '@dxos/react-ui';
|
|
9
|
+
|
|
10
|
+
import { type Assistant } from '../types';
|
|
11
|
+
|
|
12
|
+
export const useContextBinder = (chat: Assistant.Chat | undefined): AiContextBinder | undefined => {
|
|
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]);
|
|
28
|
+
|
|
29
|
+
return binder;
|
|
30
|
+
};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { useCallback } from 'react';
|
|
6
|
+
|
|
7
|
+
import { type AiContextBinder } from '@dxos/assistant';
|
|
8
|
+
import { type DXN, type Obj, Ref } from '@dxos/echo';
|
|
9
|
+
import { log } from '@dxos/log';
|
|
10
|
+
import { type Space } from '@dxos/react-client/echo';
|
|
11
|
+
import { isNonNullable } from '@dxos/util';
|
|
12
|
+
|
|
13
|
+
export type UseContextObjects = {
|
|
14
|
+
objects: Obj.Any[];
|
|
15
|
+
onUpdateObject: (dxn: DXN, checked: boolean) => Promise<void>;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Create reactive map of active object references (by DXN string).
|
|
20
|
+
*/
|
|
21
|
+
export const useContextObjects = ({
|
|
22
|
+
space,
|
|
23
|
+
context,
|
|
24
|
+
}: {
|
|
25
|
+
space?: Space;
|
|
26
|
+
context?: AiContextBinder;
|
|
27
|
+
}): UseContextObjects => {
|
|
28
|
+
const objects = context?.objects.value.map((ref) => ref.target).filter(isNonNullable) ?? [];
|
|
29
|
+
|
|
30
|
+
const handleUpdateObject = useCallback<UseContextObjects['onUpdateObject']>(
|
|
31
|
+
async (dxn: DXN, checked: boolean) => {
|
|
32
|
+
if (!space || !context) {
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// Load the object by DXN/id from the current space.
|
|
37
|
+
const id = dxn.asEchoDXN();
|
|
38
|
+
const object = id && (await space.db.getObjectById(id.echoId));
|
|
39
|
+
if (!object) {
|
|
40
|
+
log.warn('Object not found', { dxn, id });
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const ref = Ref.fromDXN(dxn);
|
|
45
|
+
if (checked) {
|
|
46
|
+
await context.bind({ objects: [ref] });
|
|
47
|
+
} else {
|
|
48
|
+
await context.unbind({ objects: [ref] });
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
[space, context],
|
|
52
|
+
);
|
|
53
|
+
|
|
54
|
+
return {
|
|
55
|
+
objects,
|
|
56
|
+
onUpdateObject: handleUpdateObject,
|
|
57
|
+
};
|
|
58
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { useCallback, useRef, useState } from 'react';
|
|
6
|
+
|
|
7
|
+
import { type Space } from '@dxos/client/echo';
|
|
8
|
+
|
|
9
|
+
export const useFlush = (space?: Space) => {
|
|
10
|
+
const [state, setState] = useState<'idle' | 'flushing' | 'flushed'>('idle');
|
|
11
|
+
const resetTimer = useRef<NodeJS.Timeout | null>(null);
|
|
12
|
+
|
|
13
|
+
const handleFlush = useCallback(() => {
|
|
14
|
+
if (!space) {
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
queueMicrotask(async () => {
|
|
19
|
+
if (resetTimer.current) {
|
|
20
|
+
clearTimeout(resetTimer.current);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
setState('flushing');
|
|
24
|
+
await space.db.flush();
|
|
25
|
+
setState('flushed');
|
|
26
|
+
|
|
27
|
+
resetTimer.current = setTimeout(() => {
|
|
28
|
+
setState('idle');
|
|
29
|
+
resetTimer.current = null;
|
|
30
|
+
}, 1_000);
|
|
31
|
+
});
|
|
32
|
+
}, [space]);
|
|
33
|
+
|
|
34
|
+
return { state, handleFlush };
|
|
35
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Option from 'effect/Option';
|
|
6
|
+
import { useEffect, useState } from 'react';
|
|
7
|
+
|
|
8
|
+
import { type Type } from '@dxos/echo';
|
|
9
|
+
import { type Space } from '@dxos/react-client/echo';
|
|
10
|
+
import { ItemAnnotation } from '@dxos/schema';
|
|
11
|
+
|
|
12
|
+
// TODO(burdon): Pass in filter.
|
|
13
|
+
export const useItemTypes = (space?: Space): Type.Obj.Any[] => {
|
|
14
|
+
const [types, setTypes] = useState<Type.Obj.Any[]>([]);
|
|
15
|
+
useEffect(() => {
|
|
16
|
+
if (!space) {
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
return space.db.schemaRegistry.query().subscribe(
|
|
21
|
+
(query) => {
|
|
22
|
+
const types = Array.from(
|
|
23
|
+
new Set(
|
|
24
|
+
[...space.db.graph.schemaRegistry.schemas, ...query.results].filter((type) =>
|
|
25
|
+
Option.isSome(ItemAnnotation.get(type)),
|
|
26
|
+
),
|
|
27
|
+
),
|
|
28
|
+
);
|
|
29
|
+
|
|
30
|
+
setTypes(types);
|
|
31
|
+
},
|
|
32
|
+
{ fire: true },
|
|
33
|
+
);
|
|
34
|
+
}, [space]);
|
|
35
|
+
|
|
36
|
+
return types;
|
|
37
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { type Dispatch, type SetStateAction, useState } from 'react';
|
|
6
|
+
|
|
7
|
+
export const useOnline = (): [boolean, Dispatch<SetStateAction<boolean>>] => {
|
|
8
|
+
const [online, setOnline] = useState(true);
|
|
9
|
+
return [online, setOnline];
|
|
10
|
+
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { useCallback, useEffect, useMemo, useState } from 'react';
|
|
6
|
+
|
|
7
|
+
import { type ChatPromptProps } from '../components';
|
|
8
|
+
import { type AiServicePreset, AiServicePresets } from '../processor';
|
|
9
|
+
|
|
10
|
+
export type UsePresets = {
|
|
11
|
+
preset: AiServicePreset | undefined;
|
|
12
|
+
} & Pick<ChatPromptProps, 'presets' | 'onPresetChange'>;
|
|
13
|
+
|
|
14
|
+
export const usePresets = (online: boolean): UsePresets => {
|
|
15
|
+
// TODO(burdon): Memo preset for provider.
|
|
16
|
+
const [preset, setPreset] = useState<AiServicePreset>();
|
|
17
|
+
const presets = useMemo(
|
|
18
|
+
() => AiServicePresets.filter((preset) => online === (preset.provider === 'dxos-remote')),
|
|
19
|
+
[online],
|
|
20
|
+
);
|
|
21
|
+
const presetOptions = useMemo(
|
|
22
|
+
() => presets.map(({ id, model, label }) => ({ id, label: label ?? model })),
|
|
23
|
+
[presets],
|
|
24
|
+
);
|
|
25
|
+
useEffect(() => {
|
|
26
|
+
setPreset(presets[0]);
|
|
27
|
+
}, [presets]);
|
|
28
|
+
|
|
29
|
+
const handlePresetChange = useCallback<NonNullable<ChatPromptProps['onPresetChange']>>(
|
|
30
|
+
(id) => {
|
|
31
|
+
const preset = presets.find((preset) => preset.id === id);
|
|
32
|
+
if (preset) {
|
|
33
|
+
setPreset(preset);
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
[presets],
|
|
37
|
+
);
|
|
38
|
+
|
|
39
|
+
return {
|
|
40
|
+
preset: preset,
|
|
41
|
+
presets: presetOptions,
|
|
42
|
+
onPresetChange: handlePresetChange,
|
|
43
|
+
};
|
|
44
|
+
};
|
|
@@ -6,15 +6,14 @@ import { useMemo } from 'react';
|
|
|
6
6
|
|
|
7
7
|
import { Capabilities, useCapabilities } from '@dxos/app-framework';
|
|
8
8
|
import { type Space } from '@dxos/client/echo';
|
|
9
|
-
import { Filter, Obj
|
|
9
|
+
import { Filter, Obj } from '@dxos/echo';
|
|
10
10
|
import { type ReferencesProvider } from '@dxos/react-ui-chat';
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* Resolve references to objects in the space.
|
|
14
14
|
*/
|
|
15
15
|
export const useReferencesProvider = (space?: Space): ReferencesProvider | undefined => {
|
|
16
|
-
|
|
17
|
-
const artifactDefinitions = useCapabilities(Capabilities.ArtifactDefinition);
|
|
16
|
+
const blueprints = useCapabilities(Capabilities.BlueprintDefinition);
|
|
18
17
|
|
|
19
18
|
return useMemo<ReferencesProvider | undefined>((): ReferencesProvider | undefined => {
|
|
20
19
|
if (!space) {
|
|
@@ -23,10 +22,13 @@ export const useReferencesProvider = (space?: Space): ReferencesProvider | undef
|
|
|
23
22
|
|
|
24
23
|
return {
|
|
25
24
|
getReferences: async ({ query }) => {
|
|
26
|
-
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
|
|
25
|
+
// TODO(burdon): Previously we filtered by types declared by the artifact definitions.
|
|
26
|
+
// const schemas = blueprints.map((blueprint) => blueprint.schema).flat();
|
|
27
|
+
// const { objects } = await space.db
|
|
28
|
+
// .query(Filter.or(...schemas.map((schema) => Filter.type(schema as Type.Schema))))
|
|
29
|
+
// .run();
|
|
30
|
+
|
|
31
|
+
const { objects } = await space.db.query(Filter.everything()).run();
|
|
30
32
|
|
|
31
33
|
return (
|
|
32
34
|
objects
|
|
@@ -39,7 +41,7 @@ export const useReferencesProvider = (space?: Space): ReferencesProvider | undef
|
|
|
39
41
|
// TODO(dmaretskyi): `Type.getDXN` (at the point of writing) didn't work here as it was schema-only.
|
|
40
42
|
.filter((object) => !!Obj.getDXN(object as Obj.Any))
|
|
41
43
|
.map((object) => ({
|
|
42
|
-
uri: Obj.getDXN(object as any)
|
|
44
|
+
uri: Obj.getDXN(object as any).toString(),
|
|
43
45
|
label: Obj.getLabel(object as any) ?? '',
|
|
44
46
|
}))
|
|
45
47
|
);
|
|
@@ -49,7 +51,7 @@ export const useReferencesProvider = (space?: Space): ReferencesProvider | undef
|
|
|
49
51
|
return { uri, label: Obj.getLabel(object) ?? '' };
|
|
50
52
|
},
|
|
51
53
|
} satisfies ReferencesProvider;
|
|
52
|
-
}, [space,
|
|
54
|
+
}, [space, blueprints]);
|
|
53
55
|
};
|
|
54
56
|
|
|
55
57
|
const stringMatch = (query: string, label: string) => label.toLowerCase().startsWith(query.toLowerCase());
|
package/src/index.ts
CHANGED
package/src/meta.ts
CHANGED
|
@@ -3,16 +3,19 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { type PluginMeta } from '@dxos/app-framework';
|
|
6
|
-
|
|
7
|
-
export const ASSISTANT_PLUGIN = 'dxos.org/plugin/assistant';
|
|
8
|
-
|
|
9
|
-
export const ASSISTANT_DIALOG = `${ASSISTANT_PLUGIN}/assistant/dialog`;
|
|
6
|
+
import { trim } from '@dxos/util';
|
|
10
7
|
|
|
11
8
|
export const meta: PluginMeta = {
|
|
12
|
-
id:
|
|
9
|
+
id: 'dxos.org/plugin/assistant',
|
|
13
10
|
name: 'Assistant',
|
|
14
|
-
description:
|
|
11
|
+
description: trim`
|
|
12
|
+
Intelligent AI assistant that can analyze and interact with objects across your spaces.
|
|
13
|
+
Chat naturally to get insights, search content, and perform actions using AI-powered context awareness.
|
|
14
|
+
`,
|
|
15
15
|
icon: 'ph--atom--regular',
|
|
16
|
+
iconHue: 'sky',
|
|
16
17
|
source: 'https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-assistant',
|
|
17
18
|
tags: ['labs'],
|
|
18
19
|
};
|
|
20
|
+
|
|
21
|
+
export const ASSISTANT_DIALOG = `${meta.id}/assistant/dialog`;
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import
|
|
5
|
+
import * as Schema from 'effect/Schema';
|
|
6
6
|
|
|
7
|
-
import { type
|
|
7
|
+
import { type ModelName } from '@dxos/ai';
|
|
8
8
|
|
|
9
9
|
const ModelProviders = ['dxos-local', 'dxos-remote', 'lm-studio'] as const;
|
|
10
10
|
|
|
@@ -14,11 +14,11 @@ type ModelProvider = Schema.Schema.Type<typeof ModelProvider>;
|
|
|
14
14
|
export type AiServicePreset = {
|
|
15
15
|
id: string;
|
|
16
16
|
provider: ModelProvider;
|
|
17
|
-
model:
|
|
17
|
+
model: ModelName;
|
|
18
18
|
label?: string;
|
|
19
19
|
};
|
|
20
20
|
|
|
21
|
-
const createModelLabel = (model:
|
|
21
|
+
const createModelLabel = (model: ModelName) => {
|
|
22
22
|
const parts = model.split('/');
|
|
23
23
|
return parts[parts.length - 1];
|
|
24
24
|
};
|
|
@@ -27,20 +27,28 @@ const createModelLabel = (model: LLMModel) => {
|
|
|
27
27
|
export const AiServicePresets: AiServicePreset[] = [
|
|
28
28
|
{
|
|
29
29
|
provider: 'dxos-remote' as const,
|
|
30
|
-
model: '@anthropic/claude-
|
|
30
|
+
model: '@anthropic/claude-opus-4-0' as const,
|
|
31
31
|
},
|
|
32
32
|
{
|
|
33
33
|
provider: 'dxos-remote' as const,
|
|
34
|
-
model: '@anthropic/claude-
|
|
34
|
+
model: '@anthropic/claude-sonnet-4-0' as const,
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
provider: 'dxos-remote' as const,
|
|
38
|
+
model: '@anthropic/claude-3-5-haiku-20241022' as const,
|
|
35
39
|
},
|
|
36
40
|
{
|
|
37
41
|
provider: 'lm-studio' as const,
|
|
38
|
-
model: '@google/gemma-3-
|
|
42
|
+
model: '@google/gemma-3-27b' as const,
|
|
39
43
|
},
|
|
40
44
|
{
|
|
41
45
|
provider: 'lm-studio' as const,
|
|
42
46
|
model: '@mlx-community/llama-3.2-3b-instruct' as const,
|
|
43
47
|
},
|
|
48
|
+
{
|
|
49
|
+
model: 'deepseek-r1:latest' as const,
|
|
50
|
+
provider: 'dxos-local' as const,
|
|
51
|
+
},
|
|
44
52
|
].map(
|
|
45
53
|
({ model, provider }, i) =>
|
|
46
54
|
({
|