@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,52 +2,47 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import React
|
|
5
|
+
import React from 'react';
|
|
6
6
|
|
|
7
|
-
import { type
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import { type ThemedClassName,
|
|
11
|
-
import { TagPicker, type TagPickerItemData, type TagPickerOptions } from '@dxos/react-ui-tag-picker';
|
|
7
|
+
import { type AiContextBinder } from '@dxos/assistant';
|
|
8
|
+
import { Obj } from '@dxos/echo';
|
|
9
|
+
import { type Space } from '@dxos/react-client/echo';
|
|
10
|
+
import { IconButton, type Label, type ThemedClassName, toLocalizedString, useTranslation } from '@dxos/react-ui';
|
|
12
11
|
import { mx } from '@dxos/react-ui-theme';
|
|
13
|
-
import { isNonNullable } from '@dxos/util';
|
|
14
12
|
|
|
13
|
+
import { useContextObjects } from '../../hooks';
|
|
15
14
|
import { meta } from '../../meta';
|
|
16
15
|
|
|
17
16
|
export type ChatReferencesProps = ThemedClassName<{
|
|
17
|
+
context: AiContextBinder;
|
|
18
18
|
space: Space;
|
|
19
|
-
context: ContextBinder;
|
|
20
|
-
onUpdate?: (ids: string[]) => void;
|
|
21
19
|
}>;
|
|
22
20
|
|
|
23
|
-
export const ChatReferences = ({ classNames,
|
|
24
|
-
const { t
|
|
25
|
-
|
|
26
|
-
const [items] = useAsyncState<TagPickerItemData[]>(async () => {
|
|
27
|
-
const objects = await Ref.Array.loadAll(context.objects.value ?? []);
|
|
28
|
-
return objects.filter(isNonNullable).map((obj) => ({ id: obj.id, label: Obj.getLabel(obj) ?? obj.id }));
|
|
29
|
-
}, [context]);
|
|
30
|
-
|
|
31
|
-
const handleSearch = useCallback<NonNullable<TagPickerOptions['onSearch']>>(
|
|
32
|
-
(text, ids) => {
|
|
33
|
-
// TODO(burdon): Filter by Item tag (e.g., exclude "contacts") and Query by object label.
|
|
34
|
-
// TODO(burdon): Change to Filter.text().
|
|
35
|
-
const objects = space.db.query(Filter.everything()).runSync();
|
|
36
|
-
return objects
|
|
37
|
-
.map(({ object }) => ({ id: object.id, label: Obj.getLabel(object) ?? '' }))
|
|
38
|
-
.filter(({ id, label }) => !ids.includes(id) && label.toLocaleLowerCase().includes(text.toLocaleLowerCase()));
|
|
39
|
-
},
|
|
40
|
-
[space],
|
|
41
|
-
);
|
|
21
|
+
export const ChatReferences = ({ classNames, context, space }: ChatReferencesProps) => {
|
|
22
|
+
const { t } = useTranslation(meta.id);
|
|
23
|
+
const { objects, onUpdateObject } = useContextObjects({ space, context });
|
|
42
24
|
|
|
43
25
|
return (
|
|
44
|
-
<
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
26
|
+
<ul className={mx('flex flex-wrap', classNames)}>
|
|
27
|
+
{objects.map((obj) => {
|
|
28
|
+
const dxn = Obj.getDXN(obj);
|
|
29
|
+
const typename = Obj.getTypename(obj);
|
|
30
|
+
const label: Label = Obj.getLabel(obj) ?? (typename ? ['object name placeholder', { ns: typename }] : obj.id);
|
|
31
|
+
return (
|
|
32
|
+
<li key={dxn.toString()} className='dx-tag plb-0 pis-2 flex items-center' data-hue='neutral'>
|
|
33
|
+
{toLocalizedString(label, t)}
|
|
34
|
+
<IconButton
|
|
35
|
+
iconOnly
|
|
36
|
+
variant='ghost'
|
|
37
|
+
label={t('remove object in context label')}
|
|
38
|
+
classNames='p-0 hover:bg-transparent'
|
|
39
|
+
size={3}
|
|
40
|
+
icon='ph--x--bold'
|
|
41
|
+
onClick={() => onUpdateObject?.(dxn, false)}
|
|
42
|
+
/>
|
|
43
|
+
</li>
|
|
44
|
+
);
|
|
45
|
+
})}
|
|
46
|
+
</ul>
|
|
52
47
|
);
|
|
53
48
|
};
|
|
@@ -4,36 +4,39 @@
|
|
|
4
4
|
|
|
5
5
|
import React, { useEffect, useState } from 'react';
|
|
6
6
|
|
|
7
|
-
import {
|
|
8
|
-
import { Spinner } from '@dxos/react-ui-sfx';
|
|
9
|
-
import {
|
|
7
|
+
import { type ThemedClassName, Tooltip, useTimeout } from '@dxos/react-ui';
|
|
8
|
+
import { Spinner, type SpinnerProps } from '@dxos/react-ui-sfx';
|
|
9
|
+
import { mx } from '@dxos/react-ui-theme';
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
11
|
+
const period = 3_000;
|
|
12
|
+
|
|
13
|
+
export type ChatStatusIndicatorProps = ThemedClassName<
|
|
14
|
+
{
|
|
15
|
+
preset?: string;
|
|
16
|
+
processing?: boolean;
|
|
17
|
+
error?: Error;
|
|
18
|
+
} & Pick<SpinnerProps, 'size' | 'onClick'>
|
|
19
|
+
>;
|
|
16
20
|
|
|
17
|
-
export const ChatStatusIndicator = ({ preset, error,
|
|
21
|
+
export const ChatStatusIndicator = ({ classNames, preset, processing, error, ...props }: ChatStatusIndicatorProps) => {
|
|
18
22
|
const [init, setInit] = useState(false);
|
|
19
|
-
useEffect(() =>
|
|
20
|
-
setInit(false);
|
|
21
|
-
}, [preset]);
|
|
23
|
+
useEffect(() => setInit(false), [preset]);
|
|
22
24
|
useTimeout(
|
|
23
25
|
async () => {
|
|
24
26
|
setInit(true);
|
|
25
27
|
},
|
|
26
|
-
|
|
28
|
+
period / 2,
|
|
27
29
|
[preset],
|
|
28
30
|
);
|
|
29
31
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
<
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
32
|
+
return (
|
|
33
|
+
<div role='none' className={mx('relative flex', classNames)}>
|
|
34
|
+
<Spinner duration={period} state={!init ? 'flash' : error ? 'error' : processing ? 'spin' : 'pulse'} {...props} />
|
|
35
|
+
{error && (
|
|
36
|
+
<Tooltip.Trigger asChild content={error.message}>
|
|
37
|
+
<div className='absolute inset-0' />
|
|
38
|
+
</Tooltip.Trigger>
|
|
39
|
+
)}
|
|
40
|
+
</div>
|
|
41
|
+
);
|
|
39
42
|
};
|
|
@@ -2,113 +2,109 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import '@
|
|
5
|
+
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
6
|
+
import * as Effect from 'effect/Effect';
|
|
7
|
+
import * as Fiber from 'effect/Fiber';
|
|
8
|
+
import * as Layer from 'effect/Layer';
|
|
9
|
+
import React, { useEffect, useMemo, useState } from 'react';
|
|
6
10
|
|
|
7
|
-
import {
|
|
8
|
-
import React, { useEffect, useState } from 'react';
|
|
9
|
-
|
|
10
|
-
import { Obj } from '@dxos/echo';
|
|
11
|
+
import { ContextQueueService, DatabaseService } from '@dxos/functions';
|
|
11
12
|
import { faker } from '@dxos/random';
|
|
13
|
+
import { useQueue, useSpace } from '@dxos/react-client/echo';
|
|
12
14
|
import { withClientProvider } from '@dxos/react-client/testing';
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
+
import { Popover } from '@dxos/react-ui';
|
|
16
|
+
import { withTheme } from '@dxos/react-ui/testing';
|
|
17
|
+
import { PreviewPopoverProvider, usePreviewPopover } from '@dxos/react-ui-editor/testing';
|
|
18
|
+
import { Card } from '@dxos/react-ui-stack';
|
|
19
|
+
import { DataType } from '@dxos/schema';
|
|
15
20
|
|
|
16
|
-
import {
|
|
21
|
+
import { createMessageGenerator } from '../../testing';
|
|
17
22
|
import { translations } from '../../translations';
|
|
18
23
|
|
|
24
|
+
import { ChatThread, type ChatThreadController, type ChatThreadProps } from './ChatThread';
|
|
25
|
+
|
|
19
26
|
faker.seed(1);
|
|
20
27
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
28
|
+
type MessageGenerator = Effect.Effect<void, never, DatabaseService | ContextQueueService>;
|
|
29
|
+
|
|
30
|
+
type StoryProps = ChatThreadProps & { generator?: MessageGenerator[]; delay?: number };
|
|
31
|
+
|
|
32
|
+
const DefaultStory = ({ generator = [], delay = 0, ...props }: StoryProps) => {
|
|
33
|
+
const space = useSpace();
|
|
34
|
+
const queueDxn = useMemo(() => space?.queues.create().dxn, [space]);
|
|
35
|
+
const queue = useQueue<DataType.Message>(queueDxn);
|
|
36
|
+
|
|
37
|
+
// Generate messages.
|
|
38
|
+
useEffect(() => {
|
|
39
|
+
if (!space || !queue) {
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const fiber = Effect.runFork(
|
|
44
|
+
Effect.gen(function* () {
|
|
45
|
+
for (const step of generator) {
|
|
46
|
+
yield* step;
|
|
47
|
+
if (delay) {
|
|
48
|
+
yield* Effect.sleep(delay);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}).pipe(Effect.provide(Layer.mergeAll(DatabaseService.layer(space.db), ContextQueueService.layer(queue)))),
|
|
52
|
+
);
|
|
53
|
+
|
|
54
|
+
return () => {
|
|
55
|
+
void Effect.runPromise(Fiber.interrupt(fiber));
|
|
56
|
+
};
|
|
57
|
+
}, [space, queue, generator]);
|
|
58
|
+
|
|
59
|
+
// Set context.
|
|
60
|
+
const [controller, setController] = useState<ChatThreadController | null>(null);
|
|
61
|
+
useEffect(() => {
|
|
62
|
+
// controller?.setContext({ timestamp: Date.now() });
|
|
63
|
+
}, [controller]);
|
|
64
|
+
|
|
65
|
+
// TODO(burdon): Elsewhere PreviewProvider is implemented via the plugin-preview.
|
|
66
|
+
return (
|
|
67
|
+
<PreviewPopoverProvider
|
|
68
|
+
onLookup={async ({ label, ref }) => {
|
|
69
|
+
return { label, text: ref };
|
|
70
|
+
}}
|
|
71
|
+
>
|
|
72
|
+
<ChatThread {...props} messages={queue?.objects ?? []} ref={setController} />
|
|
73
|
+
<PreviewCard />
|
|
74
|
+
</PreviewPopoverProvider>
|
|
75
|
+
);
|
|
27
76
|
};
|
|
28
77
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
.
|
|
43
|
-
.
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
.map(() => faker.lorem.paragraphs())
|
|
49
|
-
.join('\n\n'),
|
|
50
|
-
},
|
|
51
|
-
{
|
|
52
|
-
_tag: 'toolCall',
|
|
53
|
-
toolCallId: '1234',
|
|
54
|
-
name: 'search',
|
|
55
|
-
input: {},
|
|
56
|
-
} satisfies ContentBlock.ToolCall,
|
|
57
|
-
]),
|
|
58
|
-
|
|
59
|
-
createMessage('user', [
|
|
60
|
-
{
|
|
61
|
-
_tag: 'toolResult',
|
|
62
|
-
toolCallId: '1234',
|
|
63
|
-
name: 'search',
|
|
64
|
-
result: 'This is a tool result.',
|
|
65
|
-
} satisfies ContentBlock.ToolResult,
|
|
66
|
-
]),
|
|
67
|
-
|
|
68
|
-
createMessage('assistant', [
|
|
69
|
-
{
|
|
70
|
-
_tag: 'toolCall',
|
|
71
|
-
toolCallId: '4567',
|
|
72
|
-
name: 'create',
|
|
73
|
-
input: {},
|
|
74
|
-
} satisfies ContentBlock.ToolCall,
|
|
75
|
-
]),
|
|
76
|
-
|
|
77
|
-
createMessage('user', [
|
|
78
|
-
{
|
|
79
|
-
_tag: 'toolResult',
|
|
80
|
-
toolCallId: '4567',
|
|
81
|
-
name: 'create',
|
|
82
|
-
result: 'This is a tool result.',
|
|
83
|
-
} satisfies ContentBlock.ToolResult,
|
|
84
|
-
]),
|
|
85
|
-
|
|
86
|
-
createMessage('assistant', [
|
|
87
|
-
{
|
|
88
|
-
_tag: 'text',
|
|
89
|
-
text: faker.lorem.paragraphs(1),
|
|
90
|
-
} satisfies ContentBlock.Text,
|
|
91
|
-
]),
|
|
92
|
-
|
|
93
|
-
createMessage('assistant', [
|
|
94
|
-
{
|
|
95
|
-
_tag: 'json',
|
|
96
|
-
disposition: 'suggest',
|
|
97
|
-
data: JSON.stringify({ text: 'Search...' }),
|
|
98
|
-
},
|
|
99
|
-
{
|
|
100
|
-
_tag: 'json',
|
|
101
|
-
disposition: 'suggest',
|
|
102
|
-
data: JSON.stringify({ text: faker.lorem.paragraphs(1) }),
|
|
103
|
-
} satisfies ContentBlock.Json,
|
|
104
|
-
]),
|
|
105
|
-
];
|
|
78
|
+
// TODO(burdon): Factor out.
|
|
79
|
+
// TODO(burdon): Provide renderer for preview extension.
|
|
80
|
+
const PreviewCard = () => {
|
|
81
|
+
const { target } = usePreviewPopover('PreviewCard');
|
|
82
|
+
|
|
83
|
+
return (
|
|
84
|
+
<Popover.Portal>
|
|
85
|
+
<Popover.Content onOpenAutoFocus={(event) => event.preventDefault()}>
|
|
86
|
+
<Popover.Viewport>
|
|
87
|
+
<Card.SurfaceRoot role='card--popover'>
|
|
88
|
+
<Card.Heading>{target?.label}</Card.Heading>
|
|
89
|
+
{target && <Card.Text classNames='truncate line-clamp-3'>{target.text}</Card.Text>}
|
|
90
|
+
</Card.SurfaceRoot>
|
|
91
|
+
</Popover.Viewport>
|
|
92
|
+
<Popover.Arrow />
|
|
93
|
+
</Popover.Content>
|
|
94
|
+
</Popover.Portal>
|
|
95
|
+
);
|
|
96
|
+
};
|
|
106
97
|
|
|
107
98
|
const meta = {
|
|
108
99
|
title: 'plugins/plugin-assistant/ChatThread',
|
|
109
100
|
component: ChatThread,
|
|
110
|
-
|
|
101
|
+
render: DefaultStory,
|
|
102
|
+
decorators: [
|
|
103
|
+
withTheme,
|
|
104
|
+
withClientProvider({ createIdentity: true, createSpace: true, types: [DataType.Organization, DataType.Person] }),
|
|
105
|
+
],
|
|
111
106
|
parameters: {
|
|
107
|
+
layout: 'fullscreen',
|
|
112
108
|
translations,
|
|
113
109
|
},
|
|
114
110
|
} satisfies Meta<typeof ChatThread>;
|
|
@@ -117,27 +113,17 @@ export default meta;
|
|
|
117
113
|
|
|
118
114
|
type Story = StoryObj<typeof meta>;
|
|
119
115
|
|
|
120
|
-
export const Default = {
|
|
116
|
+
export const Default: Story = {
|
|
121
117
|
args: {
|
|
122
|
-
|
|
118
|
+
generator: createMessageGenerator(),
|
|
123
119
|
},
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
export const Incremental = {
|
|
127
|
-
render: () => {
|
|
128
|
-
const [messages, setMessages] = useState<DataType.Message[]>([]);
|
|
129
|
-
useEffect(() => {
|
|
130
|
-
let i = 0;
|
|
131
|
-
const interval = setInterval(() => {
|
|
132
|
-
setMessages((messages) => [...messages, TEST_MESSAGES[i++]]);
|
|
133
|
-
if (i >= TEST_MESSAGES.length) {
|
|
134
|
-
clearInterval(interval);
|
|
135
|
-
}
|
|
136
|
-
}, 2_000);
|
|
137
|
-
|
|
138
|
-
return () => clearInterval(interval);
|
|
139
|
-
}, []);
|
|
120
|
+
};
|
|
140
121
|
|
|
141
|
-
|
|
122
|
+
export const Delayed: Story = {
|
|
123
|
+
args: {
|
|
124
|
+
generator: createMessageGenerator(),
|
|
125
|
+
delay: 3_000,
|
|
126
|
+
fadeIn: true,
|
|
127
|
+
cursor: false,
|
|
142
128
|
},
|
|
143
|
-
}
|
|
129
|
+
};
|
|
@@ -2,56 +2,96 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import React, {
|
|
5
|
+
import React, {
|
|
6
|
+
type CSSProperties,
|
|
7
|
+
forwardRef,
|
|
8
|
+
useCallback,
|
|
9
|
+
useEffect,
|
|
10
|
+
useImperativeHandle,
|
|
11
|
+
useMemo,
|
|
12
|
+
useState,
|
|
13
|
+
} from 'react';
|
|
6
14
|
|
|
7
15
|
import { PublicKey } from '@dxos/keys';
|
|
8
16
|
import { type Identity } from '@dxos/react-client/halo';
|
|
9
17
|
import { type ThemedClassName } from '@dxos/react-ui';
|
|
10
|
-
import {
|
|
18
|
+
import { MarkdownStream, type MarkdownStreamController, type MarkdownStreamProps } from '@dxos/react-ui-components';
|
|
11
19
|
import { mx } from '@dxos/react-ui-theme';
|
|
12
20
|
import { type DataType } from '@dxos/schema';
|
|
13
21
|
import { keyToFallback } from '@dxos/util';
|
|
14
22
|
|
|
15
|
-
import {
|
|
16
|
-
|
|
23
|
+
import { type ChatEvent } from '../Chat';
|
|
24
|
+
|
|
25
|
+
import { blockToMarkdown, componentRegistry } from './registry';
|
|
26
|
+
import { MessageSyncer } from './sync';
|
|
27
|
+
|
|
28
|
+
export type ChatThreadController = Pick<MarkdownStreamController, 'setContext' | 'scrollToBottom'>;
|
|
17
29
|
|
|
18
30
|
export type ChatThreadProps = ThemedClassName<
|
|
19
31
|
{
|
|
20
32
|
identity?: Identity;
|
|
21
33
|
messages?: DataType.Message[];
|
|
22
|
-
|
|
23
|
-
|
|
34
|
+
error?: Error;
|
|
35
|
+
overscroll?: number;
|
|
36
|
+
onEvent?: (event: ChatEvent) => void;
|
|
37
|
+
} & Pick<MarkdownStreamProps, 'cursor' | 'fadeIn' | 'overscroll'>
|
|
24
38
|
>;
|
|
25
39
|
|
|
26
|
-
export const ChatThread = forwardRef<
|
|
27
|
-
(
|
|
40
|
+
export const ChatThread = forwardRef<ChatThreadController | null, ChatThreadProps>(
|
|
41
|
+
(
|
|
42
|
+
{ classNames, identity, messages = [], error, cursor = false, fadeIn = true, overscroll, onEvent },
|
|
43
|
+
forwardedRef,
|
|
44
|
+
) => {
|
|
28
45
|
const userHue = useMemo(() => {
|
|
29
46
|
return identity?.profile?.data?.hue || keyToFallback(identity?.identityKey ?? PublicKey.random()).hue;
|
|
30
47
|
}, [identity]);
|
|
31
48
|
|
|
32
|
-
//
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
49
|
+
// Expose controller.
|
|
50
|
+
const [controller, setController] = useState<MarkdownStreamController | null>(null);
|
|
51
|
+
useImperativeHandle(forwardedRef, () => (controller ? controller : (null as any)), [controller]);
|
|
52
|
+
|
|
53
|
+
// Show error.
|
|
54
|
+
useEffect(() => {
|
|
55
|
+
controller?.scrollToBottom();
|
|
56
|
+
}, [controller, error]);
|
|
57
|
+
|
|
58
|
+
// Update document.
|
|
59
|
+
const syncer = useMemo(() => controller && new MessageSyncer(controller, blockToMarkdown), [controller]);
|
|
60
|
+
useEffect(() => {
|
|
61
|
+
syncer?.sync(messages);
|
|
62
|
+
}, [syncer, messages]);
|
|
63
|
+
|
|
64
|
+
// Event handler.
|
|
65
|
+
const handleEvent = useCallback<NonNullable<MarkdownStreamProps['onEvent']>>(
|
|
66
|
+
(ev) => {
|
|
67
|
+
switch (ev.type) {
|
|
68
|
+
case 'submit': {
|
|
69
|
+
ev.value &&
|
|
70
|
+
onEvent?.({
|
|
71
|
+
type: 'submit',
|
|
72
|
+
text: ev.value,
|
|
73
|
+
});
|
|
74
|
+
break;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
[onEvent],
|
|
79
|
+
);
|
|
42
80
|
|
|
43
81
|
return (
|
|
44
|
-
<
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
{
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
82
|
+
<div
|
|
83
|
+
className={mx('flex bs-full is-full justify-center overflow-hidden', classNames)}
|
|
84
|
+
style={{ '--user-fill': `var(--dx-${userHue}Fill)` } as CSSProperties}
|
|
85
|
+
>
|
|
86
|
+
<MarkdownStream
|
|
87
|
+
ref={setController}
|
|
88
|
+
registry={componentRegistry}
|
|
89
|
+
cursor={cursor}
|
|
90
|
+
fadeIn={fadeIn}
|
|
91
|
+
overscroll={overscroll}
|
|
92
|
+
onEvent={handleEvent}
|
|
93
|
+
/>
|
|
94
|
+
</div>
|
|
55
95
|
);
|
|
56
96
|
},
|
|
57
97
|
);
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import React, { useMemo } from 'react';
|
|
6
|
+
|
|
7
|
+
import { type Space } from '@dxos/client/echo';
|
|
8
|
+
import { Obj } from '@dxos/echo';
|
|
9
|
+
import { type DXN } from '@dxos/keys';
|
|
10
|
+
import { DxAnchor } from '@dxos/lit-ui/react';
|
|
11
|
+
|
|
12
|
+
export type ObjectLinkProps = {
|
|
13
|
+
space: Space;
|
|
14
|
+
dxn: DXN;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export const ObjectLink = ({ space, dxn }: ObjectLinkProps) => {
|
|
18
|
+
const ref = useMemo(() => space.db.ref(dxn), [space, dxn.toString()]);
|
|
19
|
+
|
|
20
|
+
const title = Obj.getLabel(ref.target) ?? ref.target?.id ?? ref.dxn.toString();
|
|
21
|
+
return (
|
|
22
|
+
<DxAnchor rootclassname='dx-tag--anchor' refid={dxn.toString()}>
|
|
23
|
+
{title}
|
|
24
|
+
</DxAnchor>
|
|
25
|
+
);
|
|
26
|
+
};
|