@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
|
@@ -4,46 +4,42 @@
|
|
|
4
4
|
|
|
5
5
|
import { type Extension, Prec } from '@codemirror/state';
|
|
6
6
|
import { keymap } from '@codemirror/view';
|
|
7
|
+
import { useRxValue } from '@effect-rx/rx-react';
|
|
7
8
|
import { createContext } from '@radix-ui/react-context';
|
|
8
|
-
import
|
|
9
|
+
import * as Array from 'effect/Array';
|
|
10
|
+
import * as Option from 'effect/Option';
|
|
9
11
|
import React, { type PropsWithChildren, useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
10
12
|
|
|
11
|
-
import { CollaborationActions, createIntent, useIntentDispatcher } from '@dxos/app-framework';
|
|
12
13
|
import { Event } from '@dxos/async';
|
|
13
|
-
import {
|
|
14
|
-
import { log } from '@dxos/log';
|
|
14
|
+
import { Obj } from '@dxos/echo';
|
|
15
15
|
import { useVoiceInput } from '@dxos/plugin-transcription';
|
|
16
|
-
import { type
|
|
16
|
+
import { type Space, getSpace, useQueue } from '@dxos/react-client/echo';
|
|
17
17
|
import { useIdentity } from '@dxos/react-client/halo';
|
|
18
|
-
import { Input,
|
|
18
|
+
import { Input, type ThemedClassName, useDynamicRef, useTranslation } from '@dxos/react-ui';
|
|
19
19
|
import { ChatEditor, type ChatEditorController, type ChatEditorProps, references } from '@dxos/react-ui-chat';
|
|
20
|
-
import { type ScrollController } from '@dxos/react-ui-components';
|
|
21
20
|
import { mx } from '@dxos/react-ui-theme';
|
|
22
21
|
import { DataType } from '@dxos/schema';
|
|
23
|
-
import {
|
|
22
|
+
import { isTruthy } from '@dxos/util';
|
|
24
23
|
|
|
25
|
-
import {
|
|
26
|
-
import { type ChatProcessor, useBlueprints, useReferencesProvider } from '../../hooks';
|
|
24
|
+
import { useReferencesProvider } from '../../hooks';
|
|
27
25
|
import { meta } from '../../meta';
|
|
26
|
+
import { type AiChatProcessor } from '../../processor';
|
|
28
27
|
import { type Assistant } from '../../types';
|
|
29
28
|
import {
|
|
30
29
|
ChatActions,
|
|
31
30
|
type ChatActionsProps,
|
|
32
|
-
|
|
33
|
-
ChatPresets,
|
|
31
|
+
ChatOptions,
|
|
34
32
|
type ChatPresetsProps,
|
|
35
33
|
ChatReferences,
|
|
36
|
-
type ChatReferencesProps,
|
|
37
34
|
ChatStatusIndicator,
|
|
38
35
|
} from '../ChatPrompt';
|
|
39
|
-
import {
|
|
36
|
+
import {
|
|
37
|
+
type ChatThreadController,
|
|
38
|
+
ChatThread as NaturalChatThread,
|
|
39
|
+
type ChatThreadProps as NaturalChatThreadProps,
|
|
40
|
+
} from '../ChatThread';
|
|
40
41
|
|
|
41
|
-
|
|
42
|
-
const Endcap = ({ children }: PropsWithChildren) => {
|
|
43
|
-
return (
|
|
44
|
-
<div className='grid w-[var(--rail-action)] h-[var(--rail-action)] items-center justify-center'>{children}</div>
|
|
45
|
-
);
|
|
46
|
-
};
|
|
42
|
+
import { type ChatEvent } from './events';
|
|
47
43
|
|
|
48
44
|
//
|
|
49
45
|
// Context
|
|
@@ -51,21 +47,16 @@ const Endcap = ({ children }: PropsWithChildren) => {
|
|
|
51
47
|
// Components outside of this Radix-style group shuld define their own APIs.
|
|
52
48
|
//
|
|
53
49
|
|
|
54
|
-
// TODO(burdon): Inject via effect layer.
|
|
55
50
|
type ChatContextValue = {
|
|
56
51
|
debug?: boolean;
|
|
57
52
|
event: Event<ChatEvent>;
|
|
58
53
|
space: Space;
|
|
59
54
|
chat: Assistant.Chat;
|
|
60
|
-
processor: ChatProcessor;
|
|
61
55
|
messages: DataType.Message[];
|
|
62
|
-
|
|
63
|
-
/** @deprecated Remove and replace with context. */
|
|
64
|
-
artifact?: Expando;
|
|
56
|
+
processor: AiChatProcessor;
|
|
65
57
|
};
|
|
66
58
|
|
|
67
|
-
|
|
68
|
-
const [ChatContextProvider, useChatContext] = createContext<ChatContextValue>('Chat');
|
|
59
|
+
export const [ChatContextProvider, useChatContext] = createContext<ChatContextValue>('Chat');
|
|
69
60
|
|
|
70
61
|
//
|
|
71
62
|
// Root
|
|
@@ -73,72 +64,69 @@ const [ChatContextProvider, useChatContext] = createContext<ChatContextValue>('C
|
|
|
73
64
|
|
|
74
65
|
type ChatRootProps = ThemedClassName<
|
|
75
66
|
PropsWithChildren<
|
|
76
|
-
Pick<ChatContextValue, 'chat' | 'processor'
|
|
67
|
+
Pick<ChatContextValue, 'chat' | 'processor'> & {
|
|
77
68
|
onEvent?: (event: ChatEvent) => void;
|
|
78
69
|
}
|
|
79
70
|
>
|
|
80
71
|
>;
|
|
81
72
|
|
|
82
|
-
const ChatRoot = ({ classNames, children, chat, processor,
|
|
73
|
+
const ChatRoot = ({ classNames, children, chat, processor, onEvent, ...props }: ChatRootProps) => {
|
|
83
74
|
const [debug, setDebug] = useState(false);
|
|
84
75
|
const space = getSpace(chat);
|
|
85
76
|
|
|
86
77
|
// Messages.
|
|
87
78
|
const queue = useQueue<DataType.Message>(chat?.queue.dxn);
|
|
88
|
-
const
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
[...(queue?.objects?.filter(Obj.instanceOf(DataType.Message)) ?? []), ...(processor?.messages.value ?? [])],
|
|
92
|
-
(a, b) => a.id === b.id,
|
|
93
|
-
),
|
|
94
|
-
[queue?.objects, processor?.messages.value],
|
|
95
|
-
);
|
|
79
|
+
const pending = useRxValue(processor.messages);
|
|
80
|
+
const streaming = useRxValue(processor.streaming);
|
|
81
|
+
const lastPrompt = useRef<string | undefined>(undefined);
|
|
96
82
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
const message = queue.objects[queue.objects.length - 1];
|
|
102
|
-
if (dispatch && space && chat && message) {
|
|
103
|
-
void dispatch(
|
|
104
|
-
createIntent(CollaborationActions.InsertContent, {
|
|
105
|
-
target: artifact,
|
|
106
|
-
object: Ref.fromDXN(new DXN(DXN.kind.QUEUE, [...chat.queue.dxn.parts, message.id])),
|
|
107
|
-
label: 'View proposal',
|
|
108
|
-
}),
|
|
109
|
-
);
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
}, [queue, processor?.streaming.value]);
|
|
83
|
+
const messages = useMemo(() => {
|
|
84
|
+
const queueMessages = queue?.objects?.filter(Obj.instanceOf(DataType.Message)) ?? [];
|
|
85
|
+
return Array.dedupeWith([...queueMessages, ...pending], (a, b) => a.id === b.id);
|
|
86
|
+
}, [queue?.objects, pending]);
|
|
113
87
|
|
|
114
88
|
// Events.
|
|
115
89
|
const event = useMemo(() => new Event<ChatEvent>(), []);
|
|
116
90
|
useEffect(() => {
|
|
117
|
-
return event.on((
|
|
118
|
-
switch (
|
|
91
|
+
return event.on((ev) => {
|
|
92
|
+
switch (ev.type) {
|
|
119
93
|
case 'toggle-debug': {
|
|
120
|
-
setDebug((
|
|
94
|
+
setDebug((current) => !current);
|
|
121
95
|
break;
|
|
122
96
|
}
|
|
123
97
|
|
|
124
98
|
case 'submit': {
|
|
125
|
-
|
|
126
|
-
|
|
99
|
+
const text = ev.text.trim();
|
|
100
|
+
if (!streaming && text.length) {
|
|
101
|
+
lastPrompt.current = ev.text;
|
|
102
|
+
void processor.request({ message: text });
|
|
103
|
+
}
|
|
104
|
+
break;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
case 'retry': {
|
|
108
|
+
if (!streaming) {
|
|
109
|
+
void processor.retry();
|
|
127
110
|
}
|
|
128
111
|
break;
|
|
129
112
|
}
|
|
130
113
|
|
|
131
114
|
case 'cancel': {
|
|
132
|
-
|
|
115
|
+
if (streaming) {
|
|
116
|
+
void processor.cancel();
|
|
117
|
+
if (lastPrompt.current) {
|
|
118
|
+
event.emit({ type: 'update-prompt', text: lastPrompt.current });
|
|
119
|
+
}
|
|
120
|
+
}
|
|
133
121
|
break;
|
|
134
122
|
}
|
|
135
123
|
|
|
136
124
|
default: {
|
|
137
|
-
onEvent?.(
|
|
125
|
+
onEvent?.(ev);
|
|
138
126
|
}
|
|
139
127
|
}
|
|
140
128
|
});
|
|
141
|
-
}, [event, onEvent]);
|
|
129
|
+
}, [event, processor, streaming, onEvent]);
|
|
142
130
|
|
|
143
131
|
if (!space) {
|
|
144
132
|
return null;
|
|
@@ -150,11 +138,11 @@ const ChatRoot = ({ classNames, children, chat, processor, artifact, onEvent, ..
|
|
|
150
138
|
event={event}
|
|
151
139
|
chat={chat}
|
|
152
140
|
space={space}
|
|
153
|
-
processor={processor}
|
|
154
141
|
messages={messages}
|
|
142
|
+
processor={processor}
|
|
155
143
|
{...props}
|
|
156
144
|
>
|
|
157
|
-
<div role='none' className={mx('flex flex-col
|
|
145
|
+
<div role='none' className={mx('flex flex-col bs-full is-full', classNames)}>
|
|
158
146
|
{children}
|
|
159
147
|
</div>
|
|
160
148
|
</ChatContextProvider>
|
|
@@ -163,110 +151,81 @@ const ChatRoot = ({ classNames, children, chat, processor, artifact, onEvent, ..
|
|
|
163
151
|
|
|
164
152
|
ChatRoot.displayName = 'Chat.Root';
|
|
165
153
|
|
|
166
|
-
//
|
|
167
|
-
// Thread
|
|
168
|
-
//
|
|
169
|
-
|
|
170
|
-
type ChatThreadProps = Omit<NativeChatThreadProps, 'identity' | 'space' | 'messages' | 'tools' | 'onEvent'>;
|
|
171
|
-
|
|
172
|
-
const ChatThread = (props: ChatThreadProps) => {
|
|
173
|
-
const { debug, event, space, processor, messages } = useChatContext(ChatThread.displayName);
|
|
174
|
-
const identity = useIdentity();
|
|
175
|
-
|
|
176
|
-
const scrollerRef = useRef<ScrollController>(null);
|
|
177
|
-
useEffect(() => {
|
|
178
|
-
return event.on((event) => {
|
|
179
|
-
switch (event.type) {
|
|
180
|
-
case 'submit':
|
|
181
|
-
case 'scroll-to-bottom':
|
|
182
|
-
scrollerRef.current?.scrollToBottom('smooth');
|
|
183
|
-
break;
|
|
184
|
-
}
|
|
185
|
-
});
|
|
186
|
-
}, [event]);
|
|
187
|
-
|
|
188
|
-
if (!identity) {
|
|
189
|
-
return null;
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
return (
|
|
193
|
-
<NativeChatThread
|
|
194
|
-
{...props}
|
|
195
|
-
ref={scrollerRef}
|
|
196
|
-
debug={debug}
|
|
197
|
-
identity={identity}
|
|
198
|
-
space={space}
|
|
199
|
-
messages={messages}
|
|
200
|
-
tools={processor?.tools}
|
|
201
|
-
onEvent={(ev) => event.emit(ev)}
|
|
202
|
-
/>
|
|
203
|
-
);
|
|
204
|
-
};
|
|
205
|
-
|
|
206
|
-
ChatThread.displayName = 'Chat.Thread';
|
|
207
|
-
|
|
208
154
|
//
|
|
209
155
|
// Prompt
|
|
210
156
|
//
|
|
211
157
|
|
|
212
158
|
type ChatPromptProps = ThemedClassName<
|
|
213
|
-
|
|
159
|
+
{
|
|
160
|
+
outline?: boolean;
|
|
161
|
+
settings?: boolean;
|
|
162
|
+
} & Pick<ChatEditorProps, 'placeholder'> &
|
|
214
163
|
Omit<ChatPresetsProps, 'onChange'> & {
|
|
215
164
|
expandable?: boolean;
|
|
216
165
|
online?: boolean;
|
|
217
|
-
|
|
218
|
-
|
|
166
|
+
onOnlineChange?: (online: boolean) => void;
|
|
167
|
+
onPresetChange?: ChatPresetsProps['onChange'];
|
|
219
168
|
}
|
|
220
169
|
>;
|
|
221
170
|
|
|
222
171
|
const ChatPrompt = ({
|
|
223
172
|
classNames,
|
|
173
|
+
outline,
|
|
174
|
+
settings = true,
|
|
224
175
|
placeholder,
|
|
225
176
|
expandable,
|
|
226
177
|
online,
|
|
227
178
|
presets,
|
|
228
179
|
preset,
|
|
229
|
-
|
|
230
|
-
|
|
180
|
+
onPresetChange,
|
|
181
|
+
onOnlineChange,
|
|
231
182
|
}: ChatPromptProps) => {
|
|
232
183
|
const { t } = useTranslation(meta.id);
|
|
233
184
|
const { space, event, processor } = useChatContext(ChatPrompt.displayName);
|
|
234
185
|
|
|
235
|
-
const
|
|
186
|
+
const error = useRxValue(processor.error).pipe(Option.getOrUndefined);
|
|
187
|
+
const streaming = useRxValue(processor.streaming);
|
|
188
|
+
const active = useRxValue(processor.active);
|
|
189
|
+
const activeRef = useDynamicRef(active);
|
|
190
|
+
|
|
191
|
+
const editorRef = useRef<ChatEditorController>(null);
|
|
192
|
+
const [recordingState, setRecordingState] = useState(false);
|
|
236
193
|
useEffect(() => {
|
|
237
194
|
return event.on((event) => {
|
|
238
195
|
switch (event.type) {
|
|
196
|
+
case 'update-prompt':
|
|
197
|
+
if (!editorRef.current?.getText()?.length) {
|
|
198
|
+
editorRef.current?.setText(event.text);
|
|
199
|
+
editorRef.current?.focus();
|
|
200
|
+
}
|
|
201
|
+
break;
|
|
239
202
|
case 'record-start':
|
|
240
|
-
|
|
203
|
+
setRecordingState(true);
|
|
241
204
|
break;
|
|
242
205
|
case 'record-stop':
|
|
243
|
-
|
|
206
|
+
setRecordingState(false);
|
|
244
207
|
break;
|
|
245
208
|
}
|
|
246
209
|
});
|
|
247
210
|
}, [event]);
|
|
248
211
|
|
|
249
|
-
const editorRef = useRef<ChatEditorController>(null);
|
|
250
|
-
|
|
251
212
|
// TODO(burdon): Configure capability in TranscriptionPlugin.
|
|
252
213
|
const { recording } = useVoiceInput({
|
|
253
|
-
active,
|
|
214
|
+
active: recordingState,
|
|
254
215
|
onUpdate: (text) => {
|
|
255
216
|
editorRef.current?.setText(text);
|
|
256
217
|
editorRef.current?.focus();
|
|
257
218
|
},
|
|
258
219
|
});
|
|
259
220
|
|
|
260
|
-
const [blueprints, handleUpdateBlueprints] = useBlueprints(space, processor.context, processor.blueprintRegistry);
|
|
261
|
-
|
|
262
221
|
// TODO(burdon): Reconcile with object tags.
|
|
263
|
-
const
|
|
222
|
+
const referencesProvider = useReferencesProvider(space);
|
|
264
223
|
const extensions = useMemo<Extension[]>(() => {
|
|
265
224
|
return [
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
225
|
+
referencesProvider && references({ provider: referencesProvider }),
|
|
226
|
+
Prec.highest(
|
|
227
|
+
keymap.of(
|
|
228
|
+
[
|
|
270
229
|
{
|
|
271
230
|
key: 'cmd-d',
|
|
272
231
|
preventDefault: true,
|
|
@@ -275,7 +234,7 @@ const ChatPrompt = ({
|
|
|
275
234
|
return true;
|
|
276
235
|
},
|
|
277
236
|
},
|
|
278
|
-
{
|
|
237
|
+
expandable && {
|
|
279
238
|
key: 'cmd-ArrowUp',
|
|
280
239
|
preventDefault: true,
|
|
281
240
|
run: () => {
|
|
@@ -283,7 +242,7 @@ const ChatPrompt = ({
|
|
|
283
242
|
return true;
|
|
284
243
|
},
|
|
285
244
|
},
|
|
286
|
-
{
|
|
245
|
+
expandable && {
|
|
287
246
|
key: 'cmd-ArrowDown',
|
|
288
247
|
preventDefault: true,
|
|
289
248
|
run: () => {
|
|
@@ -291,19 +250,20 @@ const ChatPrompt = ({
|
|
|
291
250
|
return true;
|
|
292
251
|
},
|
|
293
252
|
},
|
|
294
|
-
]),
|
|
253
|
+
].filter(isTruthy),
|
|
295
254
|
),
|
|
296
|
-
|
|
297
|
-
|
|
255
|
+
),
|
|
256
|
+
].filter(isTruthy);
|
|
257
|
+
}, [event, expandable, referencesProvider]);
|
|
298
258
|
|
|
299
259
|
const handleSubmit = useCallback<NonNullable<ChatEditorProps['onSubmit']>>(
|
|
300
260
|
(text) => {
|
|
301
|
-
if (!
|
|
261
|
+
if (!activeRef.current) {
|
|
302
262
|
event.emit({ type: 'submit', text });
|
|
303
263
|
return true;
|
|
304
264
|
}
|
|
305
265
|
},
|
|
306
|
-
[
|
|
266
|
+
[event],
|
|
307
267
|
);
|
|
308
268
|
|
|
309
269
|
const handleEvent = useCallback<NonNullable<ChatActionsProps['onEvent']>>(
|
|
@@ -313,76 +273,124 @@ const ChatPrompt = ({
|
|
|
313
273
|
[event],
|
|
314
274
|
);
|
|
315
275
|
|
|
316
|
-
// TODO(burdon): Update context.
|
|
317
|
-
const handleUpdateReferences = useCallback<NonNullable<ChatReferencesProps['onUpdate']>>((ids) => {
|
|
318
|
-
log.info('update', { ids });
|
|
319
|
-
}, []);
|
|
320
|
-
|
|
321
276
|
return (
|
|
322
277
|
<div
|
|
278
|
+
role='group'
|
|
323
279
|
className={mx(
|
|
324
|
-
'is-full
|
|
280
|
+
'flex flex-col is-full density-fine',
|
|
281
|
+
outline && [
|
|
282
|
+
'p-2 bg-groupSurface border border-subduedSeparator transition transition-border [&:has(.cm-content:focus)]:border-separator rounded',
|
|
283
|
+
],
|
|
325
284
|
classNames,
|
|
326
285
|
)}
|
|
327
286
|
>
|
|
328
|
-
<
|
|
329
|
-
<ChatStatusIndicator preset={preset} error={
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
287
|
+
<div role='none' className='flex gap-2'>
|
|
288
|
+
<ChatStatusIndicator classNames='p-1' preset={preset} error={error} processing={streaming} />
|
|
289
|
+
|
|
290
|
+
<ChatEditor
|
|
291
|
+
ref={editorRef}
|
|
292
|
+
autoFocus
|
|
293
|
+
lineWrapping
|
|
294
|
+
classNames='col-span-2 pbs-0.5'
|
|
295
|
+
placeholder={placeholder ?? t('prompt placeholder')}
|
|
296
|
+
extensions={extensions}
|
|
297
|
+
onSubmit={handleSubmit}
|
|
298
|
+
/>
|
|
299
|
+
</div>
|
|
300
|
+
|
|
301
|
+
{settings && (
|
|
302
|
+
<div role='none' className='flex pbs-2 items-center'>
|
|
303
|
+
<ChatOptions
|
|
304
|
+
space={space}
|
|
305
|
+
blueprintRegistry={processor.blueprintRegistry}
|
|
306
|
+
context={processor.context}
|
|
307
|
+
preset={preset}
|
|
308
|
+
presets={presets}
|
|
309
|
+
onPresetChange={onPresetChange}
|
|
310
|
+
/>
|
|
311
|
+
|
|
312
|
+
<div role='none' className='pli-cardSpacingChrome grow'>
|
|
313
|
+
<ChatReferences space={space} context={processor.context} />
|
|
314
|
+
</div>
|
|
315
|
+
|
|
316
|
+
<ChatActions
|
|
317
|
+
classNames='col-span-2'
|
|
318
|
+
microphone={true}
|
|
319
|
+
recording={recording}
|
|
320
|
+
processing={streaming}
|
|
321
|
+
onEvent={handleEvent}
|
|
322
|
+
>
|
|
323
|
+
{online !== undefined && (
|
|
324
|
+
<Input.Root>
|
|
325
|
+
<Input.Label srOnly>{t('online switch label')}</Input.Label>
|
|
326
|
+
<Input.Switch classNames='mis-2 mie-2' checked={online} onCheckedChange={onOnlineChange} />
|
|
327
|
+
</Input.Root>
|
|
328
|
+
)}
|
|
329
|
+
</ChatActions>
|
|
330
|
+
</div>
|
|
331
|
+
)}
|
|
372
332
|
</div>
|
|
373
333
|
);
|
|
374
334
|
};
|
|
375
335
|
|
|
376
336
|
ChatPrompt.displayName = 'Chat.Prompt';
|
|
377
337
|
|
|
338
|
+
//
|
|
339
|
+
// Thread
|
|
340
|
+
//
|
|
341
|
+
|
|
342
|
+
type ChatThreadProps = Omit<NaturalChatThreadProps, 'identity' | 'messages' | 'tools'>;
|
|
343
|
+
|
|
344
|
+
const ChatThread = (props: ChatThreadProps) => {
|
|
345
|
+
const { event, messages, processor } = useChatContext(ChatThread.displayName);
|
|
346
|
+
const identity = useIdentity();
|
|
347
|
+
const error = useRxValue(processor.error).pipe(Option.getOrUndefined);
|
|
348
|
+
|
|
349
|
+
const scrollerRef = useRef<ChatThreadController | null>(null);
|
|
350
|
+
useEffect(() => {
|
|
351
|
+
return event.on((event) => {
|
|
352
|
+
switch (event.type) {
|
|
353
|
+
case 'submit':
|
|
354
|
+
case 'scroll-to-bottom':
|
|
355
|
+
scrollerRef.current?.scrollToBottom();
|
|
356
|
+
break;
|
|
357
|
+
}
|
|
358
|
+
});
|
|
359
|
+
}, [event]);
|
|
360
|
+
|
|
361
|
+
const handleEvent = useCallback<NonNullable<NaturalChatThreadProps['onEvent']>>(
|
|
362
|
+
(ev) => {
|
|
363
|
+
event.emit(ev);
|
|
364
|
+
},
|
|
365
|
+
[event],
|
|
366
|
+
);
|
|
367
|
+
|
|
368
|
+
if (!identity) {
|
|
369
|
+
return null;
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
return (
|
|
373
|
+
<NaturalChatThread
|
|
374
|
+
{...props}
|
|
375
|
+
ref={scrollerRef}
|
|
376
|
+
identity={identity}
|
|
377
|
+
messages={messages}
|
|
378
|
+
error={error}
|
|
379
|
+
onEvent={handleEvent}
|
|
380
|
+
/>
|
|
381
|
+
);
|
|
382
|
+
};
|
|
383
|
+
|
|
384
|
+
ChatThread.displayName = 'Chat.Thread';
|
|
385
|
+
|
|
378
386
|
//
|
|
379
387
|
// Chat
|
|
380
388
|
//
|
|
381
389
|
|
|
382
390
|
export const Chat = {
|
|
383
391
|
Root: ChatRoot,
|
|
384
|
-
Thread: ChatThread,
|
|
385
392
|
Prompt: ChatPrompt,
|
|
393
|
+
Thread: ChatThread,
|
|
386
394
|
};
|
|
387
395
|
|
|
388
396
|
export type { ChatRootProps, ChatThreadProps, ChatPromptProps, ChatEvent };
|
|
@@ -19,6 +19,9 @@ export type ChatEvent =
|
|
|
19
19
|
type: 'submit';
|
|
20
20
|
text: string;
|
|
21
21
|
}
|
|
22
|
+
| {
|
|
23
|
+
type: 'retry';
|
|
24
|
+
}
|
|
22
25
|
| {
|
|
23
26
|
type: 'cancel';
|
|
24
27
|
}
|
|
@@ -33,6 +36,10 @@ export type ChatEvent =
|
|
|
33
36
|
//
|
|
34
37
|
// UX
|
|
35
38
|
//
|
|
39
|
+
| {
|
|
40
|
+
type: 'update-prompt';
|
|
41
|
+
text: string;
|
|
42
|
+
}
|
|
36
43
|
| {
|
|
37
44
|
type: 'scroll-to-bottom';
|
|
38
45
|
}
|