@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
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Array from 'effect/Array';
|
|
6
|
+
import * as Effect from 'effect/Effect';
|
|
7
|
+
import * as Function from 'effect/Function';
|
|
8
|
+
import * as Option from 'effect/Option';
|
|
9
|
+
import React, { useMemo } from 'react';
|
|
10
|
+
|
|
11
|
+
import { Capabilities, createIntent, useCapabilities, useIntentDispatcher } from '@dxos/app-framework';
|
|
12
|
+
import { Blueprint } from '@dxos/blueprints';
|
|
13
|
+
import { getSpace } from '@dxos/client/echo';
|
|
14
|
+
import { Filter, Obj, Query, Ref } from '@dxos/echo';
|
|
15
|
+
import { DatabaseService } from '@dxos/functions';
|
|
16
|
+
import { SpaceAction } from '@dxos/plugin-space/types';
|
|
17
|
+
import { useQuery } from '@dxos/react-client/echo';
|
|
18
|
+
import { useAsyncEffect } from '@dxos/react-ui';
|
|
19
|
+
|
|
20
|
+
import { ChatContainer } from '../components';
|
|
21
|
+
import { useBlueprintRegistry, useContextBinder } from '../hooks';
|
|
22
|
+
import { Assistant, AssistantAction } from '../types';
|
|
23
|
+
|
|
24
|
+
export type ChatCompanionProps = {
|
|
25
|
+
role?: string;
|
|
26
|
+
data: { companionTo: Obj.Any; subject: Assistant.Chat | 'assistant-chat' };
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export const ChatCompanion = ({ role, data }: ChatCompanionProps) => {
|
|
30
|
+
const companionTo = data.companionTo;
|
|
31
|
+
const space = getSpace(companionTo);
|
|
32
|
+
const chat = data.subject === 'assistant-chat' ? undefined : data.subject;
|
|
33
|
+
const blueprintRegistry = useBlueprintRegistry();
|
|
34
|
+
const binder = useContextBinder(chat);
|
|
35
|
+
const { dispatch } = useIntentDispatcher();
|
|
36
|
+
|
|
37
|
+
// Initialize companion chat if it doesn't exist.
|
|
38
|
+
useAsyncEffect(async () => {
|
|
39
|
+
if (chat || !space) {
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// TODO(burdon): Garbage collection of queues?
|
|
44
|
+
// TODO(wittjosiah): Figure out how to prevent companion chats from showing up in the navtree.
|
|
45
|
+
await Effect.gen(function* () {
|
|
46
|
+
const { objects } = yield* DatabaseService.runQuery(
|
|
47
|
+
Query.select(Filter.ids(companionTo.id)).targetOf(Assistant.CompanionTo).source(),
|
|
48
|
+
);
|
|
49
|
+
|
|
50
|
+
// TODO(wittjosiah): This should be the default sort order.
|
|
51
|
+
let nextChat = objects.toSorted((a, b) => a.id.localeCompare(b.id)).at(-1);
|
|
52
|
+
if (!nextChat) {
|
|
53
|
+
const { object } = yield* dispatch(createIntent(AssistantAction.CreateChat, { space }));
|
|
54
|
+
nextChat = object;
|
|
55
|
+
yield* dispatch(createIntent(SpaceAction.AddObject, { object: nextChat, target: space, hidden: true }));
|
|
56
|
+
yield* dispatch(
|
|
57
|
+
createIntent(SpaceAction.AddRelation, {
|
|
58
|
+
space,
|
|
59
|
+
schema: Assistant.CompanionTo,
|
|
60
|
+
source: nextChat,
|
|
61
|
+
target: data.companionTo,
|
|
62
|
+
}),
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
yield* dispatch(createIntent(AssistantAction.SetCurrentChat, { companionTo, chat: nextChat }));
|
|
67
|
+
}).pipe(Effect.provide(DatabaseService.layer(space.db)), Effect.runPromise);
|
|
68
|
+
}, [space, chat, companionTo]);
|
|
69
|
+
|
|
70
|
+
const metadata = useCapabilities(Capabilities.Metadata);
|
|
71
|
+
const blueprintKeys = useMemo(
|
|
72
|
+
() =>
|
|
73
|
+
Function.pipe(
|
|
74
|
+
metadata,
|
|
75
|
+
Array.findFirst(
|
|
76
|
+
(capability): capability is { id: string; metadata: { blueprints?: string[] } } =>
|
|
77
|
+
capability.id === Obj.getTypename(companionTo),
|
|
78
|
+
),
|
|
79
|
+
Option.flatMap((c) => Option.fromNullable(c.metadata.blueprints)),
|
|
80
|
+
Option.getOrElse(() => [] as string[]),
|
|
81
|
+
),
|
|
82
|
+
[metadata, companionTo],
|
|
83
|
+
);
|
|
84
|
+
const existingBlueprints = useQuery(space, Filter.type(Blueprint.Blueprint));
|
|
85
|
+
const pluginBlueprints = useMemo(
|
|
86
|
+
() => existingBlueprints.filter((blueprint) => blueprintKeys.includes(blueprint.key)),
|
|
87
|
+
[existingBlueprints, blueprintKeys],
|
|
88
|
+
);
|
|
89
|
+
|
|
90
|
+
// Initialize related blueprints that are not already in the space.
|
|
91
|
+
useAsyncEffect(async () => {
|
|
92
|
+
if (!space) {
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
// NOTE: This must be run instead of using the useQuery result to avoid duplicates.
|
|
97
|
+
const { objects: existingBlueprints } = await space.db.query(Filter.type(Blueprint.Blueprint)).run();
|
|
98
|
+
for (const key of blueprintKeys) {
|
|
99
|
+
const existingBlueprint = existingBlueprints.find((blueprint) => blueprint.key === key);
|
|
100
|
+
if (existingBlueprint) {
|
|
101
|
+
continue;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
const blueprint = blueprintRegistry.getByKey(key);
|
|
105
|
+
if (!blueprint) {
|
|
106
|
+
continue;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
space.db.add(Obj.clone(blueprint));
|
|
110
|
+
}
|
|
111
|
+
}, [space, blueprintRegistry, blueprintKeys]);
|
|
112
|
+
|
|
113
|
+
useAsyncEffect(async () => {
|
|
114
|
+
if (!binder) {
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
if (pluginBlueprints.length > 0) {
|
|
119
|
+
await binder.bind({ blueprints: pluginBlueprints.map((blueprint) => Ref.make(blueprint)) });
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
if (Obj.instanceOf(Blueprint.Blueprint, companionTo)) {
|
|
123
|
+
await binder.bind({ blueprints: [Ref.make(companionTo)] });
|
|
124
|
+
} else {
|
|
125
|
+
await binder.bind({ objects: [Ref.make(companionTo)] });
|
|
126
|
+
}
|
|
127
|
+
}, [binder, companionTo, pluginBlueprints]);
|
|
128
|
+
|
|
129
|
+
if (!chat) {
|
|
130
|
+
return null;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
return <ChatContainer role={role} chat={chat} companionTo={companionTo} />;
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
export default ChatCompanion;
|
|
@@ -5,37 +5,43 @@
|
|
|
5
5
|
import React from 'react';
|
|
6
6
|
|
|
7
7
|
import { Capabilities, useCapability } from '@dxos/app-framework';
|
|
8
|
-
import { type AssociatedArtifact } from '@dxos/blueprints';
|
|
9
8
|
import { getSpace } from '@dxos/client/echo';
|
|
9
|
+
import { type Obj } from '@dxos/echo';
|
|
10
10
|
import { StackItem } from '@dxos/react-ui-stack';
|
|
11
11
|
|
|
12
|
-
import {
|
|
13
|
-
import { useChatProcessor, useChatServices } from '../hooks';
|
|
12
|
+
import { useBlueprintRegistry, useChatProcessor, useChatServices, useOnline, usePresets } from '../hooks';
|
|
14
13
|
import { meta } from '../meta';
|
|
15
14
|
import { type Assistant } from '../types';
|
|
16
15
|
|
|
16
|
+
import { Chat } from './Chat';
|
|
17
|
+
import { ChatToolbar } from './ChatToolbar';
|
|
18
|
+
|
|
17
19
|
export type ChatContainerProps = {
|
|
18
|
-
role: string;
|
|
19
20
|
chat: Assistant.Chat;
|
|
20
|
-
|
|
21
|
+
companionTo?: Obj.Any;
|
|
22
|
+
role?: string;
|
|
21
23
|
};
|
|
22
24
|
|
|
23
|
-
export const ChatContainer = ({
|
|
25
|
+
export const ChatContainer = ({ chat, companionTo }: ChatContainerProps) => {
|
|
24
26
|
const space = getSpace(chat);
|
|
25
27
|
const settings = useCapability(Capabilities.SettingsStore).getStore<Assistant.Settings>(meta.id)?.value;
|
|
26
|
-
const services = useChatServices({ space });
|
|
27
|
-
const
|
|
28
|
+
const services = useChatServices({ space, chat });
|
|
29
|
+
const [online, setOnline] = useOnline();
|
|
30
|
+
const { preset, ...chatProps } = usePresets(online);
|
|
31
|
+
const blueprintRegistry = useBlueprintRegistry();
|
|
32
|
+
const processor = useChatProcessor({ chat, preset, services, blueprintRegistry, settings });
|
|
33
|
+
|
|
28
34
|
if (!processor) {
|
|
29
35
|
return null;
|
|
30
36
|
}
|
|
31
37
|
|
|
32
|
-
// TODO(burdon): Add attention attributes.
|
|
33
38
|
return (
|
|
34
|
-
<StackItem.Content
|
|
35
|
-
<
|
|
39
|
+
<StackItem.Content toolbar>
|
|
40
|
+
<ChatToolbar chat={chat} companionTo={companionTo} />
|
|
41
|
+
<Chat.Root classNames='container-max-width' chat={chat} processor={processor}>
|
|
36
42
|
<Chat.Thread />
|
|
37
|
-
<div className='
|
|
38
|
-
<Chat.Prompt
|
|
43
|
+
<div className='p-2'>
|
|
44
|
+
<Chat.Prompt {...chatProps} outline preset={preset?.id} online={online} onOnlineChange={setOnline} />
|
|
39
45
|
</div>
|
|
40
46
|
</Chat.Root>
|
|
41
47
|
</StackItem.Content>
|
|
@@ -4,16 +4,17 @@
|
|
|
4
4
|
|
|
5
5
|
import React, { useCallback, useState } from 'react';
|
|
6
6
|
|
|
7
|
-
import {
|
|
7
|
+
import { Capabilities, useCapability } from '@dxos/app-framework';
|
|
8
8
|
import { getSpace } from '@dxos/client/echo';
|
|
9
9
|
import { useTranslation } from '@dxos/react-ui';
|
|
10
|
-
import { ChatDialog as
|
|
10
|
+
import { ChatDialog as NaturalChatDialog } from '@dxos/react-ui-chat';
|
|
11
11
|
|
|
12
|
-
import {
|
|
13
|
-
import { useChatProcessor, useChatServices } from '../hooks';
|
|
12
|
+
import { useBlueprintRegistry, useChatProcessor, useChatServices, useOnline, usePresets } from '../hooks';
|
|
14
13
|
import { meta } from '../meta';
|
|
15
14
|
import { type Assistant } from '../types';
|
|
16
15
|
|
|
16
|
+
import { Chat, type ChatRootProps } from './Chat';
|
|
17
|
+
|
|
17
18
|
export type ChatDialogProps = {
|
|
18
19
|
chat?: Assistant.Chat;
|
|
19
20
|
};
|
|
@@ -23,8 +24,11 @@ export const ChatDialog = ({ chat }: ChatDialogProps) => {
|
|
|
23
24
|
|
|
24
25
|
const space = getSpace(chat);
|
|
25
26
|
const settings = useCapability(Capabilities.SettingsStore).getStore<Assistant.Settings>(meta.id)?.value;
|
|
26
|
-
const services = useChatServices({ space });
|
|
27
|
-
const
|
|
27
|
+
const services = useChatServices({ space, chat });
|
|
28
|
+
const [online, setOnline] = useOnline();
|
|
29
|
+
const { preset, ...chatProps } = usePresets(online);
|
|
30
|
+
const blueprintRegistry = useBlueprintRegistry();
|
|
31
|
+
const processor = useChatProcessor({ chat, preset, services, blueprintRegistry, settings });
|
|
28
32
|
|
|
29
33
|
// TODO(burdon): Refocus when open.
|
|
30
34
|
const [open, setOpen] = useState(true);
|
|
@@ -48,15 +52,15 @@ export const ChatDialog = ({ chat }: ChatDialogProps) => {
|
|
|
48
52
|
|
|
49
53
|
return (
|
|
50
54
|
<Chat.Root chat={chat} processor={processor} onEvent={handleEvent}>
|
|
51
|
-
<
|
|
52
|
-
<
|
|
53
|
-
<
|
|
55
|
+
<NaturalChatDialog.Root open={open} expanded={expanded} onOpenChange={setOpen}>
|
|
56
|
+
<NaturalChatDialog.Header title={t('assistant dialog title')} />
|
|
57
|
+
<NaturalChatDialog.Content>
|
|
54
58
|
<Chat.Thread />
|
|
55
|
-
</
|
|
56
|
-
<
|
|
57
|
-
<Chat.Prompt expandable />
|
|
58
|
-
</
|
|
59
|
-
</
|
|
59
|
+
</NaturalChatDialog.Content>
|
|
60
|
+
<NaturalChatDialog.Footer classNames='p-1.5'>
|
|
61
|
+
<Chat.Prompt {...chatProps} preset={preset?.id} online={online} onOnlineChange={setOnline} expandable />
|
|
62
|
+
</NaturalChatDialog.Footer>
|
|
63
|
+
</NaturalChatDialog.Root>
|
|
60
64
|
</Chat.Root>
|
|
61
65
|
);
|
|
62
66
|
};
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
6
|
+
|
|
7
|
+
import { addEventListener } from '@dxos/async';
|
|
8
|
+
import { Flex, ProgressBar, type ProgressBarProps, TextCrawl, useExecutionGraph } from '@dxos/react-ui-components';
|
|
9
|
+
|
|
10
|
+
import { type Assistant } from '../../types';
|
|
11
|
+
|
|
12
|
+
// TODO(burdon): Reset after each session.
|
|
13
|
+
// TODO(burdon): Show after delay.
|
|
14
|
+
// TODO(burdon): Test with errors.
|
|
15
|
+
// TODO(burdon): Filter out empty trace messages.
|
|
16
|
+
|
|
17
|
+
// {
|
|
18
|
+
// "id": "01K3TE3C2VAXETP500QKDHK3C4_block_3",
|
|
19
|
+
// "branch": "main",
|
|
20
|
+
// "parents": [],
|
|
21
|
+
// "icon": "ph--robot--regular",
|
|
22
|
+
// "message": "\n"
|
|
23
|
+
// }
|
|
24
|
+
|
|
25
|
+
export type ChatProgressProps = {
|
|
26
|
+
chat: Assistant.Chat;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export const ChatProgress = ({ chat }: ChatProgressProps) => {
|
|
30
|
+
const { commits } = useExecutionGraph(chat.traceQueue?.target, true);
|
|
31
|
+
const nodes = useMemo(() => commits.map((commit) => ({ id: commit.id, message: commit.message })), [commits]);
|
|
32
|
+
const lines = useMemo(() => commits.map((commit) => commit.message), [commits]);
|
|
33
|
+
|
|
34
|
+
const [index, setIndex] = useState<number | undefined>(undefined);
|
|
35
|
+
const handleSelect = useCallback<NonNullable<ProgressBarProps['onSelect']>>(({ index }) => {
|
|
36
|
+
setIndex((current) => {
|
|
37
|
+
return current === index ? undefined : index;
|
|
38
|
+
});
|
|
39
|
+
}, []);
|
|
40
|
+
|
|
41
|
+
const ref = useRef<HTMLDivElement>(null);
|
|
42
|
+
useEffect(() => {
|
|
43
|
+
if (!ref.current) {
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
return addEventListener(ref.current, 'keydown', (event) => {
|
|
48
|
+
switch (event.key) {
|
|
49
|
+
case 'ArrowLeft': {
|
|
50
|
+
setIndex((current) => (current === undefined || current <= 0 ? 0 : current - 1));
|
|
51
|
+
break;
|
|
52
|
+
}
|
|
53
|
+
case 'ArrowRight': {
|
|
54
|
+
setIndex((current) => (current === undefined || current >= nodes.length ? nodes.length - 1 : current + 1));
|
|
55
|
+
break;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
}, [nodes.length]);
|
|
60
|
+
|
|
61
|
+
return (
|
|
62
|
+
<Flex column tabIndex={0} ref={ref} classNames='outline-none'>
|
|
63
|
+
<ProgressBar nodes={nodes} index={index} onSelect={handleSelect} />
|
|
64
|
+
<TextCrawl lines={lines} index={index} autoAdvance classNames='pis-4 text-sm text-subdued' />
|
|
65
|
+
</Flex>
|
|
66
|
+
);
|
|
67
|
+
};
|
|
@@ -26,34 +26,20 @@ export const ChatActions = ({ classNames, children, microphone, recording, proce
|
|
|
26
26
|
<div className={mx('flex items-center mie-1', classNames)}>
|
|
27
27
|
{children}
|
|
28
28
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
onClick={() => onEvent?.({ type: 'cancel' })}
|
|
39
|
-
/>
|
|
40
|
-
)) || (
|
|
41
|
-
<IconButton
|
|
42
|
-
disabled
|
|
43
|
-
classNames='px-1.5'
|
|
44
|
-
variant='ghost'
|
|
45
|
-
size={5}
|
|
46
|
-
icon='ph--arrow-down--regular'
|
|
47
|
-
iconOnly
|
|
48
|
-
label={t('button scroll down')}
|
|
49
|
-
onClick={() => onEvent?.({ type: 'scroll-to-bottom' })}
|
|
50
|
-
/>
|
|
51
|
-
)}
|
|
29
|
+
<IconButton
|
|
30
|
+
disabled={!processing}
|
|
31
|
+
variant='ghost'
|
|
32
|
+
size={5}
|
|
33
|
+
icon='ph--x--regular'
|
|
34
|
+
iconOnly
|
|
35
|
+
label={t('button cancel processing')}
|
|
36
|
+
onClick={() => onEvent?.({ type: 'cancel' })}
|
|
37
|
+
/>
|
|
52
38
|
|
|
53
39
|
{microphone && (
|
|
54
40
|
<IconButton
|
|
55
41
|
disabled={!processing}
|
|
56
|
-
classNames={mx(
|
|
42
|
+
classNames={mx(recording && 'bg-primary-500')}
|
|
57
43
|
variant='ghost'
|
|
58
44
|
size={5}
|
|
59
45
|
icon='ph--microphone--regular'
|
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import React, { type JSX, useMemo, useState } from 'react';
|
|
6
|
+
|
|
7
|
+
import { type AiContextBinder } from '@dxos/assistant';
|
|
8
|
+
import { type Blueprint } from '@dxos/blueprints';
|
|
9
|
+
import { Filter, Obj, Type } from '@dxos/echo';
|
|
10
|
+
import { type Space, useQuery } from '@dxos/react-client/echo';
|
|
11
|
+
import { Icon, IconButton, Popover, Select, useTranslation } from '@dxos/react-ui';
|
|
12
|
+
import { Listbox, SearchList } from '@dxos/react-ui-searchlist';
|
|
13
|
+
import { Tabs } from '@dxos/react-ui-tabs';
|
|
14
|
+
|
|
15
|
+
import { useActiveBlueprints, useBlueprintHandlers, useBlueprints, useContextObjects, useItemTypes } from '../../hooks';
|
|
16
|
+
import { meta } from '../../meta';
|
|
17
|
+
|
|
18
|
+
const panelClassNames = 'is-[calc(100dvw-.5rem)] sm:is-max md:is-72 max-is-[--text-content]';
|
|
19
|
+
|
|
20
|
+
export type ChatOptionsProps = {
|
|
21
|
+
space: Space;
|
|
22
|
+
context: AiContextBinder;
|
|
23
|
+
blueprintRegistry?: Blueprint.Registry;
|
|
24
|
+
presets?: { id: string; label: string }[];
|
|
25
|
+
preset?: string;
|
|
26
|
+
onPresetChange?: (id: string) => void;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Manages the runtime context for the chat.
|
|
31
|
+
*/
|
|
32
|
+
export const ChatOptions = ({
|
|
33
|
+
space,
|
|
34
|
+
context,
|
|
35
|
+
blueprintRegistry,
|
|
36
|
+
presets,
|
|
37
|
+
preset,
|
|
38
|
+
onPresetChange,
|
|
39
|
+
}: ChatOptionsProps) => {
|
|
40
|
+
const { t } = useTranslation(meta.id);
|
|
41
|
+
|
|
42
|
+
return (
|
|
43
|
+
<div role='none' className='flex gap-0.5'>
|
|
44
|
+
<Popover.Root>
|
|
45
|
+
<Popover.Trigger asChild>
|
|
46
|
+
<IconButton variant='ghost' icon='ph--plus--regular' iconOnly size={5} label={t('button context objects')} />
|
|
47
|
+
</Popover.Trigger>
|
|
48
|
+
<Popover.Portal>
|
|
49
|
+
<Popover.Content side='top' classNames={panelClassNames}>
|
|
50
|
+
<ObjectsPanel space={space} context={context} />
|
|
51
|
+
<Popover.Arrow />
|
|
52
|
+
</Popover.Content>
|
|
53
|
+
</Popover.Portal>
|
|
54
|
+
</Popover.Root>
|
|
55
|
+
|
|
56
|
+
<Popover.Root>
|
|
57
|
+
<Popover.Trigger asChild>
|
|
58
|
+
<IconButton
|
|
59
|
+
variant='ghost'
|
|
60
|
+
icon='ph--sliders-horizontal--regular'
|
|
61
|
+
iconOnly
|
|
62
|
+
size={5}
|
|
63
|
+
label={t('button context settings')}
|
|
64
|
+
/>
|
|
65
|
+
</Popover.Trigger>
|
|
66
|
+
<Popover.Portal>
|
|
67
|
+
<Popover.Content side='top' classNames={panelClassNames}>
|
|
68
|
+
<Tabs.Root orientation='horizontal' defaultValue='blueprints' defaultActivePart='list' tabIndex={-1}>
|
|
69
|
+
<Tabs.Viewport classNames='max-bs-[--radix-popover-content-available-height] grid grid-rows-[1fr_min-content] [&_[cmdk-root]]:contents [&_[role="tabpanel"]]:grid [&_[role="tabpanel"]]:grid-rows-[1fr_min-content] [&_[role="listbox"]]:min-bs-0 [&_[role="listbox"]]:overflow-y-auto [&_[role="tabpanel"]]:min-bs-0 [&_[role="tabpanel"]]:pli-cardSpacingChrome [&_[role="tabpanel"][data-state="active"]]:order-first [&_[role="tabpanel"][data-state="inactive"]]:hidden'>
|
|
70
|
+
<Tabs.Tabpanel value='blueprints' tabIndex={-1} classNames='dx-focus-ring-inset'>
|
|
71
|
+
<BlueprintsPanel blueprintRegistry={blueprintRegistry} space={space} context={context} />
|
|
72
|
+
</Tabs.Tabpanel>
|
|
73
|
+
<Tabs.Tabpanel value='model' tabIndex={-1} classNames='dx-focus-ring-inset !pli-0'>
|
|
74
|
+
<ModelsPanel presets={presets} preset={preset} onPresetChange={onPresetChange} />
|
|
75
|
+
</Tabs.Tabpanel>
|
|
76
|
+
<Tabs.Tablist classNames='sm:overflow-x-hidden justify-center p-[--dx-cardSpacingChrome] border-bs border-subduedSeparator order-last'>
|
|
77
|
+
<Tabs.IconTab
|
|
78
|
+
value='blueprints'
|
|
79
|
+
icon='ph--blueprint--regular'
|
|
80
|
+
label={t('blueprints in context title')}
|
|
81
|
+
/>
|
|
82
|
+
<Tabs.IconTab value='model' label={t('chat model title')} icon='ph--cpu--regular' />
|
|
83
|
+
</Tabs.Tablist>
|
|
84
|
+
</Tabs.Viewport>
|
|
85
|
+
</Tabs.Root>
|
|
86
|
+
<Popover.Arrow />
|
|
87
|
+
</Popover.Content>
|
|
88
|
+
</Popover.Portal>
|
|
89
|
+
</Popover.Root>
|
|
90
|
+
</div>
|
|
91
|
+
);
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
const BlueprintsPanel = ({
|
|
95
|
+
blueprintRegistry,
|
|
96
|
+
space,
|
|
97
|
+
context,
|
|
98
|
+
}: Pick<ChatOptionsProps, 'blueprintRegistry' | 'space' | 'context'>) => {
|
|
99
|
+
const { t } = useTranslation(meta.id);
|
|
100
|
+
|
|
101
|
+
const blueprints = useBlueprints({ blueprintRegistry, space });
|
|
102
|
+
const activeBlueprints = useActiveBlueprints({ context });
|
|
103
|
+
const { onUpdateBlueprint } = useBlueprintHandlers({ space, context, blueprintRegistry });
|
|
104
|
+
|
|
105
|
+
return (
|
|
106
|
+
<SearchList.Root>
|
|
107
|
+
<SearchList.Content classNames='plb-cardSpacingChrome'>
|
|
108
|
+
{blueprints.map((blueprint) => {
|
|
109
|
+
const isActive = activeBlueprints.has(blueprint.key);
|
|
110
|
+
return (
|
|
111
|
+
<SearchList.Item
|
|
112
|
+
classNames='flex items-center overflow-hidden'
|
|
113
|
+
key={blueprint.key}
|
|
114
|
+
value={blueprint.name}
|
|
115
|
+
onSelect={() => onUpdateBlueprint?.(blueprint.key, !isActive)}
|
|
116
|
+
>
|
|
117
|
+
<div className='grow truncate'>{blueprint.name}</div>
|
|
118
|
+
<Icon icon='ph--check--regular' classNames={[!isActive && 'invisible']} />
|
|
119
|
+
</SearchList.Item>
|
|
120
|
+
);
|
|
121
|
+
})}
|
|
122
|
+
</SearchList.Content>
|
|
123
|
+
<SearchList.Input placeholder={t('search placeholder')} classNames='mbe-cardSpacingChrome' autoFocus />
|
|
124
|
+
</SearchList.Root>
|
|
125
|
+
);
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
const ModelsPanel = ({
|
|
129
|
+
presets,
|
|
130
|
+
preset,
|
|
131
|
+
onPresetChange,
|
|
132
|
+
}: Pick<ChatOptionsProps, 'presets' | 'preset' | 'onPresetChange'>) => {
|
|
133
|
+
return (
|
|
134
|
+
<Listbox.Root value={preset} onValueChange={onPresetChange} autoFocus>
|
|
135
|
+
{presets?.map(({ id, label }) => {
|
|
136
|
+
return (
|
|
137
|
+
<Listbox.Option key={id} value={id}>
|
|
138
|
+
<Listbox.OptionLabel>{label}</Listbox.OptionLabel>
|
|
139
|
+
<Listbox.OptionIndicator />
|
|
140
|
+
</Listbox.Option>
|
|
141
|
+
);
|
|
142
|
+
})}
|
|
143
|
+
</Listbox.Root>
|
|
144
|
+
);
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
const ANY = '__any__';
|
|
148
|
+
|
|
149
|
+
const ObjectsPanel = ({ space, context }: Pick<ChatOptionsProps, 'space' | 'context'>): JSX.Element => {
|
|
150
|
+
const { t } = useTranslation(meta.id);
|
|
151
|
+
|
|
152
|
+
// Item types sorted by label.
|
|
153
|
+
const types = useItemTypes(space);
|
|
154
|
+
const typenames = useMemo(() => {
|
|
155
|
+
const typenames = types.map((type) => {
|
|
156
|
+
const typename = Type.getTypename(type);
|
|
157
|
+
return {
|
|
158
|
+
typename,
|
|
159
|
+
label: t('typename label', { ns: typename, defaultValue: typename }),
|
|
160
|
+
};
|
|
161
|
+
});
|
|
162
|
+
|
|
163
|
+
typenames.sort((a, b) => a.label.localeCompare(b.label));
|
|
164
|
+
return typenames;
|
|
165
|
+
}, [types]);
|
|
166
|
+
|
|
167
|
+
// Current type and filter.
|
|
168
|
+
const [typename, setTypename] = useState<string>(ANY);
|
|
169
|
+
const anyFilter = useMemo(
|
|
170
|
+
() => Filter.or(...typenames.map(({ typename }) => Filter.typename(typename))),
|
|
171
|
+
[typenames],
|
|
172
|
+
);
|
|
173
|
+
|
|
174
|
+
// Context objects.
|
|
175
|
+
const objects = useQuery(space, typename === ANY ? anyFilter : Filter.typename(typename));
|
|
176
|
+
const { objects: contextObjects, onUpdateObject } = useContextObjects({ space, context });
|
|
177
|
+
|
|
178
|
+
return (
|
|
179
|
+
<SearchList.Root>
|
|
180
|
+
<SearchList.Content classNames='p-cardSpacingChrome [&:has([cmdk-list-sizer]:empty)]:plb-0'>
|
|
181
|
+
{objects.length ? (
|
|
182
|
+
objects.map((object) => {
|
|
183
|
+
const label = Obj.getLabel(object) ?? Obj.getTypename(object) ?? object.id;
|
|
184
|
+
const isActive = contextObjects.findIndex((obj) => obj.id === object.id) !== -1;
|
|
185
|
+
return (
|
|
186
|
+
<SearchList.Item
|
|
187
|
+
classNames='flex items-center overflow-hidden'
|
|
188
|
+
key={object.id}
|
|
189
|
+
value={object.id}
|
|
190
|
+
onSelect={() => onUpdateObject?.(Obj.getDXN(object), !isActive)}
|
|
191
|
+
>
|
|
192
|
+
<div className='grow truncate'>{label}</div>
|
|
193
|
+
<Icon icon='ph--check--regular' classNames={[!isActive && 'invisible']} />
|
|
194
|
+
</SearchList.Item>
|
|
195
|
+
);
|
|
196
|
+
})
|
|
197
|
+
) : (
|
|
198
|
+
<SearchList.Item>{t('no results')}</SearchList.Item>
|
|
199
|
+
)}
|
|
200
|
+
</SearchList.Content>
|
|
201
|
+
|
|
202
|
+
<div role='none' className='grid grid-cols-[min-content_1fr] gap-2 pli-cardSpacingChrome mbe-cardSpacingChrome'>
|
|
203
|
+
<Select.Root value={typename === ANY ? undefined : typename} onValueChange={setTypename}>
|
|
204
|
+
<Select.TriggerButton density='fine' placeholder={t('type filter placeholder')} />
|
|
205
|
+
<Select.Portal>
|
|
206
|
+
<Select.Content>
|
|
207
|
+
<Select.ScrollUpButton />
|
|
208
|
+
<Select.Viewport>
|
|
209
|
+
<Select.Option value={ANY}>{t('any type filter label')}</Select.Option>
|
|
210
|
+
{typenames.map(({ typename, label }) => (
|
|
211
|
+
<Select.Option key={typename} value={typename}>
|
|
212
|
+
{label}
|
|
213
|
+
</Select.Option>
|
|
214
|
+
))}
|
|
215
|
+
</Select.Viewport>
|
|
216
|
+
<Select.ScrollDownButton />
|
|
217
|
+
<Select.Arrow />
|
|
218
|
+
</Select.Content>
|
|
219
|
+
</Select.Portal>
|
|
220
|
+
</Select.Root>
|
|
221
|
+
<SearchList.Input placeholder={t('search placeholder')} classNames='mbe-0' autoFocus />
|
|
222
|
+
</div>
|
|
223
|
+
</SearchList.Root>
|
|
224
|
+
);
|
|
225
|
+
};
|