@dxos/plugin-assistant 0.8.4-main.5ea62a8 → 0.8.4-main.ae835ea
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/browser/{BlueprintContainer-OWUSKPRK.mjs → BlueprintContainer-GMSYKGSO.mjs} +13 -6
- package/dist/lib/browser/BlueprintContainer-GMSYKGSO.mjs.map +7 -0
- package/dist/lib/browser/{ChatCompanion-FRCVSLPP.mjs → ChatCompanion-M3FDKTQM.mjs} +39 -14
- package/dist/lib/browser/ChatCompanion-M3FDKTQM.mjs.map +7 -0
- package/dist/lib/browser/{ChatContainer-YBJBIVUZ.mjs → ChatContainer-KAH7XITI.mjs} +10 -11
- package/dist/lib/browser/ChatContainer-KAH7XITI.mjs.map +7 -0
- package/dist/lib/browser/{ChatDialog-MTPJLEHM.mjs → ChatDialog-ZWRGABW6.mjs} +8 -10
- package/dist/lib/browser/ChatDialog-ZWRGABW6.mjs.map +7 -0
- package/dist/lib/browser/ai-service-ERTZBTP3.mjs +19 -0
- package/dist/lib/browser/ai-service-ERTZBTP3.mjs.map +7 -0
- package/dist/lib/browser/{app-graph-builder-7AAWTWGA.mjs → app-graph-builder-R5T7BJPC.mjs} +41 -11
- package/dist/lib/browser/app-graph-builder-R5T7BJPC.mjs.map +7 -0
- package/dist/lib/browser/blueprint-definition-AGTDXTXO.mjs +13 -0
- package/dist/lib/browser/chunk-357IHWQL.mjs +1519 -0
- package/dist/lib/browser/chunk-357IHWQL.mjs.map +7 -0
- package/dist/lib/browser/{chunk-6QMISAU6.mjs → chunk-A2NVNXPL.mjs} +15 -12
- package/dist/lib/browser/chunk-A2NVNXPL.mjs.map +7 -0
- package/dist/lib/browser/{chunk-V5H5CCZA.mjs → chunk-CQW6UPJM.mjs} +24 -43
- package/dist/lib/browser/chunk-CQW6UPJM.mjs.map +7 -0
- package/dist/lib/browser/{chunk-SMIVXXAI.mjs → chunk-GNI6HL6G.mjs} +37 -20
- package/dist/lib/browser/chunk-GNI6HL6G.mjs.map +7 -0
- package/dist/lib/browser/chunk-GXHZTOWJ.mjs +378 -0
- package/dist/lib/browser/chunk-GXHZTOWJ.mjs.map +7 -0
- package/dist/lib/browser/chunk-L5OA5OGS.mjs +262 -0
- package/dist/lib/browser/chunk-L5OA5OGS.mjs.map +7 -0
- package/dist/lib/browser/{chunk-OYFQS7JM.mjs → chunk-MEN5WTLA.mjs} +64 -39
- package/dist/lib/browser/chunk-MEN5WTLA.mjs.map +7 -0
- package/dist/lib/browser/{chunk-CFXXQM25.mjs → chunk-PUG24BEC.mjs} +118 -23
- package/dist/lib/browser/chunk-PUG24BEC.mjs.map +7 -0
- package/dist/lib/browser/{chunk-IJAJRAR7.mjs → chunk-SJJV3HEX.mjs} +2 -4
- package/dist/lib/browser/chunk-SJJV3HEX.mjs.map +7 -0
- package/dist/lib/browser/chunk-WBG5PTSX.mjs +23 -0
- package/dist/lib/browser/chunk-WBG5PTSX.mjs.map +7 -0
- package/dist/lib/browser/edge-model-resolver-O6OFYIO2.mjs +18 -0
- package/dist/lib/browser/edge-model-resolver-O6OFYIO2.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +85 -51
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/{intent-resolver-BQO5SVGI.mjs → intent-resolver-3C5TABOX.mjs} +38 -14
- package/dist/lib/browser/intent-resolver-3C5TABOX.mjs.map +7 -0
- package/dist/lib/browser/local-model-resolver-GO6ZEMLL.mjs +17 -0
- package/dist/lib/browser/local-model-resolver-GO6ZEMLL.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/{react-surface-VNCD2H7C.mjs → react-surface-EYKA5IFU.mjs} +11 -30
- package/dist/lib/browser/react-surface-EYKA5IFU.mjs.map +7 -0
- package/dist/lib/browser/{settings-36V3VUMW.mjs → settings-VMVBYZLN.mjs} +5 -5
- package/dist/lib/browser/{settings-36V3VUMW.mjs.map → settings-VMVBYZLN.mjs.map} +1 -1
- package/dist/lib/browser/{state-D5IVKNYG.mjs → state-CFREPBB6.mjs} +5 -5
- package/dist/lib/browser/{state-D5IVKNYG.mjs.map → state-CFREPBB6.mjs.map} +1 -1
- package/dist/lib/browser/toolkit-F3NQ7TSI.mjs +21 -0
- package/dist/lib/browser/toolkit-F3NQ7TSI.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +2 -2
- package/dist/lib/node-esm/{BlueprintContainer-UFVWCRN6.mjs → BlueprintContainer-6GBLMK4Z.mjs} +13 -6
- package/dist/lib/node-esm/BlueprintContainer-6GBLMK4Z.mjs.map +7 -0
- package/dist/lib/node-esm/{ChatCompanion-ZNRZEKH5.mjs → ChatCompanion-OV426GCP.mjs} +39 -14
- package/dist/lib/node-esm/ChatCompanion-OV426GCP.mjs.map +7 -0
- package/dist/lib/node-esm/{ChatContainer-TUCITJJW.mjs → ChatContainer-UKY7NHFY.mjs} +10 -11
- package/dist/lib/node-esm/ChatContainer-UKY7NHFY.mjs.map +7 -0
- package/dist/lib/node-esm/{ChatDialog-JLM7RDZQ.mjs → ChatDialog-2BDQIEXH.mjs} +8 -10
- package/dist/lib/node-esm/ChatDialog-2BDQIEXH.mjs.map +7 -0
- package/dist/lib/node-esm/ai-service-MUYLV3NT.mjs +20 -0
- package/dist/lib/node-esm/ai-service-MUYLV3NT.mjs.map +7 -0
- package/dist/lib/node-esm/{app-graph-builder-PNAFQUYT.mjs → app-graph-builder-I52RYVWH.mjs} +41 -11
- package/dist/lib/node-esm/app-graph-builder-I52RYVWH.mjs.map +7 -0
- package/dist/lib/node-esm/{blueprint-definition-275J3XL2.mjs → blueprint-definition-CFCUD2VC.mjs} +5 -4
- package/dist/lib/node-esm/{chunk-CAQKGW3B.mjs → chunk-2CAETDW2.mjs} +63 -39
- package/dist/lib/node-esm/chunk-2CAETDW2.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-RLBN4RNR.mjs → chunk-4J5FYNNM.mjs} +15 -12
- package/dist/lib/node-esm/chunk-4J5FYNNM.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-7YOGZI66.mjs → chunk-5ARE4R2I.mjs} +37 -20
- package/dist/lib/node-esm/chunk-5ARE4R2I.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-7ZYOYW7F.mjs +264 -0
- package/dist/lib/node-esm/chunk-7ZYOYW7F.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-HJPIYMWD.mjs +1520 -0
- package/dist/lib/node-esm/chunk-HJPIYMWD.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-UWUUZQWJ.mjs → chunk-O36P4LN5.mjs} +24 -43
- package/dist/lib/node-esm/chunk-O36P4LN5.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-WE6KTH72.mjs +25 -0
- package/dist/lib/node-esm/chunk-WE6KTH72.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-FNZJJL7G.mjs → chunk-XM4BVQQR.mjs} +118 -23
- package/dist/lib/node-esm/chunk-XM4BVQQR.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-YPXEA46Q.mjs → chunk-XQBL2SBL.mjs} +2 -4
- package/dist/lib/node-esm/chunk-XQBL2SBL.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-YIO5MEPR.mjs +380 -0
- package/dist/lib/node-esm/chunk-YIO5MEPR.mjs.map +7 -0
- package/dist/lib/node-esm/edge-model-resolver-2ARXDOYS.mjs +19 -0
- package/dist/lib/node-esm/edge-model-resolver-2ARXDOYS.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +85 -51
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/{intent-resolver-FIS3T5KP.mjs → intent-resolver-HQ27YALS.mjs} +38 -14
- package/dist/lib/node-esm/intent-resolver-HQ27YALS.mjs.map +7 -0
- package/dist/lib/node-esm/local-model-resolver-WOQ2D2R2.mjs +18 -0
- package/dist/lib/node-esm/local-model-resolver-WOQ2D2R2.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/{react-surface-4NLRKNBU.mjs → react-surface-UOC3CBPH.mjs} +11 -30
- package/dist/lib/node-esm/react-surface-UOC3CBPH.mjs.map +7 -0
- package/dist/lib/node-esm/{settings-7ZCZ6AS5.mjs → settings-7AUVNDM2.mjs} +5 -5
- package/dist/lib/node-esm/{settings-7ZCZ6AS5.mjs.map → settings-7AUVNDM2.mjs.map} +1 -1
- package/dist/lib/node-esm/{state-4VLKPLW3.mjs → state-XXND44OW.mjs} +5 -5
- package/dist/lib/node-esm/{state-4VLKPLW3.mjs.map → state-XXND44OW.mjs.map} +1 -1
- package/dist/lib/node-esm/toolkit-7CH5UNSQ.mjs +22 -0
- package/dist/lib/node-esm/toolkit-7CH5UNSQ.mjs.map +7 -0
- package/dist/lib/node-esm/types/index.mjs +2 -2
- package/dist/types/src/AssistantPlugin.d.ts +1 -1
- package/dist/types/src/AssistantPlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/ai-service.d.ts +2 -3
- package/dist/types/src/capabilities/ai-service.d.ts.map +1 -1
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
- package/dist/types/src/capabilities/blueprint-definition.d.ts +1 -1
- package/dist/types/src/capabilities/blueprint-definition.d.ts.map +1 -1
- package/dist/types/src/capabilities/capabilities.d.ts +0 -8
- package/dist/types/src/capabilities/capabilities.d.ts.map +1 -1
- package/dist/types/src/capabilities/edge-model-resolver.d.ts.map +1 -1
- package/dist/types/src/capabilities/intent-resolver.d.ts.map +1 -1
- package/dist/types/src/capabilities/local-model-resolver.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
- package/dist/types/src/capabilities/toolkit.d.ts.map +1 -1
- package/dist/types/src/components/BlueprintContainer.d.ts.map +1 -1
- package/dist/types/src/components/Chat/Chat.d.ts +4 -3
- package/dist/types/src/components/Chat/Chat.d.ts.map +1 -1
- package/dist/types/src/components/ChatCompanion.d.ts.map +1 -1
- package/dist/types/src/components/ChatProgress/ChatProgress.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/ChatThread.d.ts +10 -5
- package/dist/types/src/components/ChatThread/ChatThread.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/ChatThread.stories.d.ts +35 -26
- package/dist/types/src/components/ChatThread/ChatThread.stories.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/Link.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/registry.d.ts +11 -0
- package/dist/types/src/components/ChatThread/registry.d.ts.map +1 -0
- package/dist/types/src/components/ChatThread/sync.d.ts +36 -0
- package/dist/types/src/components/ChatThread/sync.d.ts.map +1 -0
- package/dist/types/src/components/ChatThread/sync.test.d.ts +2 -0
- package/dist/types/src/components/ChatThread/sync.test.d.ts.map +1 -0
- package/dist/types/src/components/ChatToolbar/ChatToolbar.d.ts +6 -0
- package/dist/types/src/components/ChatToolbar/ChatToolbar.d.ts.map +1 -0
- package/dist/types/src/components/ChatToolbar/index.d.ts +2 -0
- package/dist/types/src/components/ChatToolbar/index.d.ts.map +1 -0
- package/dist/types/src/components/{Toolbar → ChatToolbar}/useChatToolbarActions.d.ts +1 -3
- package/dist/types/src/components/ChatToolbar/useChatToolbarActions.d.ts.map +1 -0
- package/dist/types/src/components/TemplateEditor/TemplateEditor.d.ts +2 -1
- package/dist/types/src/components/TemplateEditor/TemplateEditor.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/TemplateEditor.stories.d.ts +21 -14
- package/dist/types/src/components/TemplateEditor/TemplateEditor.stories.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/TemplateForm.d.ts +1 -1
- package/dist/types/src/components/TemplateEditor/TemplateForm.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/TemplateForm.stories.d.ts +21 -14
- package/dist/types/src/components/TemplateEditor/TemplateForm.stories.d.ts.map +1 -1
- package/dist/types/src/components/ToolBlock/ToolBlock.d.ts +19 -0
- package/dist/types/src/components/ToolBlock/ToolBlock.d.ts.map +1 -0
- package/dist/types/src/components/ToolBlock/ToolBlockWidget.d.ts +2 -0
- package/dist/types/src/components/ToolBlock/ToolBlockWidget.d.ts.map +1 -0
- package/dist/types/src/components/ToolBlock/index.d.ts +3 -0
- package/dist/types/src/components/ToolBlock/index.d.ts.map +1 -0
- package/dist/types/src/components/Toolbox/Toolbox.d.ts +2 -2
- package/dist/types/src/components/Toolbox/Toolbox.d.ts.map +1 -1
- package/dist/types/src/components/Toolbox/Toolbox.stories.d.ts +21 -14
- package/dist/types/src/components/Toolbox/Toolbox.stories.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +1 -5
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/functions/analysis.d.ts.map +1 -1
- package/dist/types/src/functions/index.d.ts +2 -2
- package/dist/types/src/functions/index.d.ts.map +1 -1
- package/dist/types/src/functions/{list.d.ts → object-list.d.ts} +1 -1
- package/dist/types/src/functions/object-list.d.ts.map +1 -0
- package/dist/types/src/functions/{load.d.ts → object-load.d.ts} +1 -1
- package/dist/types/src/functions/object-load.d.ts.map +1 -0
- package/dist/types/src/hooks/index.d.ts +0 -3
- package/dist/types/src/hooks/index.d.ts.map +1 -1
- package/dist/types/src/hooks/useBlueprintRegistry.d.ts +2 -1
- package/dist/types/src/hooks/useBlueprintRegistry.d.ts.map +1 -1
- package/dist/types/src/hooks/useChatProcessor.d.ts +2 -2
- package/dist/types/src/hooks/useChatProcessor.d.ts.map +1 -1
- package/dist/types/src/hooks/useChatServices.d.ts +2 -2
- package/dist/types/src/hooks/useChatServices.d.ts.map +1 -1
- package/dist/types/src/hooks/useContextBinder.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +2 -0
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +1 -2
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/processor/index.d.ts +1 -0
- package/dist/types/src/processor/index.d.ts.map +1 -1
- package/dist/types/src/processor/presets.d.ts +1 -1
- package/dist/types/src/processor/presets.d.ts.map +1 -1
- package/dist/types/src/processor/processor.d.ts +11 -17
- package/dist/types/src/processor/processor.d.ts.map +1 -1
- package/dist/types/src/processor/update-name.d.ts +10 -0
- package/dist/types/src/processor/update-name.d.ts.map +1 -0
- package/dist/types/src/testing/index.d.ts +1 -2
- package/dist/types/src/testing/index.d.ts.map +1 -1
- package/dist/types/src/testing/test-generator.d.ts +7 -0
- package/dist/types/src/testing/test-generator.d.ts.map +1 -0
- package/dist/types/src/testing/test-services.d.ts +2 -2
- package/dist/types/src/testing/test-services.d.ts.map +1 -1
- package/dist/types/src/toolkits/AssistantToolkit.d.ts +21 -0
- package/dist/types/src/toolkits/AssistantToolkit.d.ts.map +1 -0
- package/dist/types/src/toolkits/SystemToolkit.d.ts +69 -0
- package/dist/types/src/toolkits/SystemToolkit.d.ts.map +1 -0
- package/dist/types/src/toolkits/index.d.ts +3 -0
- package/dist/types/src/toolkits/index.d.ts.map +1 -0
- package/dist/types/src/translations.d.ts +6 -4
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/Assistant.d.ts +15 -9
- package/dist/types/src/types/Assistant.d.ts.map +1 -1
- package/dist/types/src/types/AssistantAction.d.ts +18 -6
- package/dist/types/src/types/AssistantAction.d.ts.map +1 -1
- package/dist/types/src/types/service.d.ts +12 -12
- package/dist/types/src/types/service.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +93 -110
- package/src/AssistantPlugin.tsx +140 -129
- package/src/capabilities/ai-service.ts +6 -7
- package/src/capabilities/app-graph-builder.ts +36 -4
- package/src/capabilities/blueprint-definition.ts +39 -15
- package/src/capabilities/capabilities.ts +0 -13
- package/src/capabilities/edge-model-resolver.ts +5 -7
- package/src/capabilities/intent-resolver.ts +33 -6
- package/src/capabilities/local-model-resolver.ts +6 -8
- package/src/capabilities/react-surface.tsx +1 -21
- package/src/capabilities/toolkit.ts +10 -154
- package/src/components/BlueprintContainer.tsx +8 -2
- package/src/components/Chat/Chat.tsx +72 -70
- package/src/components/ChatCompanion.tsx +33 -8
- package/src/components/ChatContainer.tsx +4 -4
- package/src/components/ChatDialog.tsx +8 -8
- package/src/components/ChatProgress/ChatProgress.tsx +2 -3
- package/src/components/ChatPrompt/ChatOptions.tsx +17 -25
- package/src/components/ChatThread/ChatThread.stories.tsx +75 -229
- package/src/components/ChatThread/ChatThread.tsx +64 -46
- package/src/components/ChatThread/Link.tsx +11 -8
- package/src/components/ChatThread/registry.tsx +184 -0
- package/src/components/ChatThread/sync.test.ts +81 -0
- package/src/components/ChatThread/sync.ts +113 -0
- package/src/components/{Toolbar/Toolbar.tsx → ChatToolbar/ChatToolbar.tsx} +5 -2
- package/src/components/{Toolbar → ChatToolbar}/index.ts +1 -1
- package/src/components/{Toolbar → ChatToolbar}/useChatToolbarActions.ts +2 -1
- package/src/components/TemplateEditor/TemplateEditor.stories.tsx +5 -5
- package/src/components/TemplateEditor/TemplateEditor.tsx +18 -10
- package/src/components/TemplateEditor/TemplateForm.stories.tsx +3 -5
- package/src/components/TemplateEditor/TemplateForm.tsx +1 -1
- package/src/components/TemplateEditor/handlebars-extension.ts +12 -11
- package/src/components/{ChatThread → ToolBlock}/ToolBlock.tsx +31 -26
- package/src/components/ToolBlock/ToolBlockWidget.tsx +5 -0
- package/src/components/ToolBlock/index.ts +6 -0
- package/src/components/Toolbox/Toolbox.stories.tsx +4 -7
- package/src/components/Toolbox/Toolbox.tsx +3 -3
- package/src/components/index.ts +1 -3
- package/src/functions/analysis.ts +4 -2
- package/src/functions/index.ts +2 -2
- package/src/functions/{list.ts → object-list.ts} +6 -4
- package/src/functions/{load.ts → object-load.ts} +9 -7
- package/src/hooks/index.ts +0 -3
- package/src/hooks/useBlueprintRegistry.ts +17 -3
- package/src/hooks/useChatProcessor.ts +13 -5
- package/src/hooks/useChatServices.ts +26 -42
- package/src/hooks/useContextBinder.ts +17 -5
- package/src/hooks/useItemTypes.ts +1 -1
- package/src/index.ts +2 -0
- package/src/meta.ts +9 -6
- package/src/processor/index.ts +1 -0
- package/src/processor/presets.ts +1 -1
- package/src/processor/processor.test.ts +21 -17
- package/src/processor/processor.ts +30 -57
- package/src/processor/update-name.ts +57 -0
- package/src/queue-logger.ts +5 -5
- package/src/testing/index.ts +1 -2
- package/src/testing/test-generator.ts +261 -0
- package/src/testing/test-services.ts +2 -8
- package/src/toolkits/AssistantToolkit.ts +55 -0
- package/src/toolkits/SystemToolkit.ts +292 -0
- package/src/toolkits/index.ts +6 -0
- package/src/translations.ts +6 -5
- package/src/types/Assistant.ts +10 -8
- package/src/types/AssistantAction.ts +10 -2
- package/src/types/service.ts +17 -9
- package/dist/lib/browser/BlueprintContainer-OWUSKPRK.mjs.map +0 -7
- package/dist/lib/browser/ChatCompanion-FRCVSLPP.mjs.map +0 -7
- package/dist/lib/browser/ChatContainer-YBJBIVUZ.mjs.map +0 -7
- package/dist/lib/browser/ChatDialog-MTPJLEHM.mjs.map +0 -7
- package/dist/lib/browser/SequenceContainer-TF5QNXYM.mjs +0 -150
- package/dist/lib/browser/SequenceContainer-TF5QNXYM.mjs.map +0 -7
- package/dist/lib/browser/ai-service-NRZPTUHO.mjs +0 -22
- package/dist/lib/browser/ai-service-NRZPTUHO.mjs.map +0 -7
- package/dist/lib/browser/app-graph-builder-7AAWTWGA.mjs.map +0 -7
- package/dist/lib/browser/blueprint-definition-CRZPIA5A.mjs +0 -12
- package/dist/lib/browser/chunk-6QMISAU6.mjs.map +0 -7
- package/dist/lib/browser/chunk-CFXXQM25.mjs.map +0 -7
- package/dist/lib/browser/chunk-IJAJRAR7.mjs.map +0 -7
- package/dist/lib/browser/chunk-O4LUJEDV.mjs +0 -20
- package/dist/lib/browser/chunk-O4LUJEDV.mjs.map +0 -7
- package/dist/lib/browser/chunk-OYFQS7JM.mjs.map +0 -7
- package/dist/lib/browser/chunk-SMIVXXAI.mjs.map +0 -7
- package/dist/lib/browser/chunk-V5H5CCZA.mjs.map +0 -7
- package/dist/lib/browser/chunk-XL557TXF.mjs +0 -2332
- package/dist/lib/browser/chunk-XL557TXF.mjs.map +0 -7
- package/dist/lib/browser/edge-model-resolver-E5M3CC46.mjs +0 -22
- package/dist/lib/browser/edge-model-resolver-E5M3CC46.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-BQO5SVGI.mjs.map +0 -7
- package/dist/lib/browser/local-model-resolver-VZ5WZQIC.mjs +0 -21
- package/dist/lib/browser/local-model-resolver-VZ5WZQIC.mjs.map +0 -7
- package/dist/lib/browser/react-surface-VNCD2H7C.mjs.map +0 -7
- package/dist/lib/browser/toolkit-Y5OYX5PO.mjs +0 -191
- package/dist/lib/browser/toolkit-Y5OYX5PO.mjs.map +0 -7
- package/dist/lib/node-esm/BlueprintContainer-UFVWCRN6.mjs.map +0 -7
- package/dist/lib/node-esm/ChatCompanion-ZNRZEKH5.mjs.map +0 -7
- package/dist/lib/node-esm/ChatContainer-TUCITJJW.mjs.map +0 -7
- package/dist/lib/node-esm/ChatDialog-JLM7RDZQ.mjs.map +0 -7
- package/dist/lib/node-esm/SequenceContainer-UXOVZPZO.mjs +0 -151
- package/dist/lib/node-esm/SequenceContainer-UXOVZPZO.mjs.map +0 -7
- package/dist/lib/node-esm/ai-service-UDEPIPTO.mjs +0 -23
- package/dist/lib/node-esm/ai-service-UDEPIPTO.mjs.map +0 -7
- package/dist/lib/node-esm/app-graph-builder-PNAFQUYT.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-2X6VEO32.mjs +0 -2333
- package/dist/lib/node-esm/chunk-2X6VEO32.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-7YOGZI66.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-CAQKGW3B.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-FNZJJL7G.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-RLBN4RNR.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-UWUUZQWJ.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-VFY2JG62.mjs +0 -22
- package/dist/lib/node-esm/chunk-VFY2JG62.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-YPXEA46Q.mjs.map +0 -7
- package/dist/lib/node-esm/edge-model-resolver-SZHDLXCT.mjs +0 -23
- package/dist/lib/node-esm/edge-model-resolver-SZHDLXCT.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-FIS3T5KP.mjs.map +0 -7
- package/dist/lib/node-esm/local-model-resolver-2KCBKMYA.mjs +0 -22
- package/dist/lib/node-esm/local-model-resolver-2KCBKMYA.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-4NLRKNBU.mjs.map +0 -7
- package/dist/lib/node-esm/toolkit-2F2OL6WB.mjs +0 -192
- package/dist/lib/node-esm/toolkit-2F2OL6WB.mjs.map +0 -7
- package/dist/types/src/components/ChatThread/ChatMessage.d.ts +0 -33
- package/dist/types/src/components/ChatThread/ChatMessage.d.ts.map +0 -1
- package/dist/types/src/components/ChatThread/ToolBlock.d.ts +0 -19
- package/dist/types/src/components/ChatThread/ToolBlock.d.ts.map +0 -1
- package/dist/types/src/components/PromptSettings.d.ts +0 -6
- package/dist/types/src/components/PromptSettings.d.ts.map +0 -1
- package/dist/types/src/components/SequenceContainer.d.ts +0 -8
- package/dist/types/src/components/SequenceContainer.d.ts.map +0 -1
- package/dist/types/src/components/SequenceEditor/SequenceEditor.d.ts +0 -13
- package/dist/types/src/components/SequenceEditor/SequenceEditor.d.ts.map +0 -1
- package/dist/types/src/components/SequenceEditor/SequenceEditor.stories.d.ts +0 -263
- package/dist/types/src/components/SequenceEditor/SequenceEditor.stories.d.ts.map +0 -1
- package/dist/types/src/components/SequenceEditor/index.d.ts +0 -2
- package/dist/types/src/components/SequenceEditor/index.d.ts.map +0 -1
- package/dist/types/src/components/Toolbar/Toolbar.d.ts +0 -4
- package/dist/types/src/components/Toolbar/Toolbar.d.ts.map +0 -1
- package/dist/types/src/components/Toolbar/index.d.ts +0 -2
- package/dist/types/src/components/Toolbar/index.d.ts.map +0 -1
- package/dist/types/src/components/Toolbar/useChatToolbarActions.d.ts.map +0 -1
- package/dist/types/src/execution-graph/execution-graph.d.ts +0 -21
- package/dist/types/src/execution-graph/execution-graph.d.ts.map +0 -1
- package/dist/types/src/execution-graph/index.d.ts +0 -2
- package/dist/types/src/execution-graph/index.d.ts.map +0 -1
- package/dist/types/src/functions/list.d.ts.map +0 -1
- package/dist/types/src/functions/load.d.ts.map +0 -1
- package/dist/types/src/hooks/useExecutionGraph.d.ts +0 -7
- package/dist/types/src/hooks/useExecutionGraph.d.ts.map +0 -1
- package/dist/types/src/hooks/useMatcherExtension.d.ts +0 -3
- package/dist/types/src/hooks/useMatcherExtension.d.ts.map +0 -1
- package/dist/types/src/hooks/useResolveRef.d.ts +0 -4
- package/dist/types/src/hooks/useResolveRef.d.ts.map +0 -1
- package/dist/types/src/parser/filter-generator.d.ts +0 -4
- package/dist/types/src/parser/filter-generator.d.ts.map +0 -1
- package/dist/types/src/parser/filter-generator.test.d.ts +0 -2
- package/dist/types/src/parser/filter-generator.test.d.ts.map +0 -1
- package/dist/types/src/parser/index.d.ts +0 -4
- package/dist/types/src/parser/index.d.ts.map +0 -1
- package/dist/types/src/parser/query-parser.d.ts +0 -15
- package/dist/types/src/parser/query-parser.d.ts.map +0 -1
- package/dist/types/src/parser/query-parser.test.d.ts +0 -2
- package/dist/types/src/parser/query-parser.test.d.ts.map +0 -1
- package/dist/types/src/parser/types.d.ts +0 -24
- package/dist/types/src/parser/types.d.ts.map +0 -1
- package/dist/types/src/stories/Chat.stories.d.ts +0 -26
- package/dist/types/src/stories/Chat.stories.d.ts.map +0 -1
- package/dist/types/src/stories/components/BlueprintContainer.d.ts +0 -4
- package/dist/types/src/stories/components/BlueprintContainer.d.ts.map +0 -1
- package/dist/types/src/stories/components/ChatContainer.d.ts +0 -4
- package/dist/types/src/stories/components/ChatContainer.d.ts.map +0 -1
- package/dist/types/src/stories/components/CommentsContainer.d.ts +0 -4
- package/dist/types/src/stories/components/CommentsContainer.d.ts.map +0 -1
- package/dist/types/src/stories/components/GraphContainer.d.ts +0 -6
- package/dist/types/src/stories/components/GraphContainer.d.ts.map +0 -1
- package/dist/types/src/stories/components/LoggingContainer.d.ts +0 -4
- package/dist/types/src/stories/components/LoggingContainer.d.ts.map +0 -1
- package/dist/types/src/stories/components/MessageContainer.d.ts +0 -4
- package/dist/types/src/stories/components/MessageContainer.d.ts.map +0 -1
- package/dist/types/src/stories/components/SurfaceContainer.d.ts +0 -8
- package/dist/types/src/stories/components/SurfaceContainer.d.ts.map +0 -1
- package/dist/types/src/stories/components/TasksContainer.d.ts +0 -4
- package/dist/types/src/stories/components/TasksContainer.d.ts.map +0 -1
- package/dist/types/src/stories/components/TokenManagerContainer.d.ts +0 -3
- package/dist/types/src/stories/components/TokenManagerContainer.d.ts.map +0 -1
- package/dist/types/src/stories/components/index.d.ts +0 -11
- package/dist/types/src/stories/components/index.d.ts.map +0 -1
- package/dist/types/src/stories/components/types.d.ts +0 -7
- package/dist/types/src/stories/components/types.d.ts.map +0 -1
- package/dist/types/src/stories/testing/data.d.ts +0 -5
- package/dist/types/src/stories/testing/data.d.ts.map +0 -1
- package/dist/types/src/stories/testing/index.d.ts +0 -3
- package/dist/types/src/stories/testing/index.d.ts.map +0 -1
- package/dist/types/src/stories/testing/testing.d.ts +0 -44
- package/dist/types/src/stories/testing/testing.d.ts.map +0 -1
- package/dist/types/src/testing/test-data.d.ts +0 -4
- package/dist/types/src/testing/test-data.d.ts.map +0 -1
- package/dist/types/src/testing/test-functions.d.ts +0 -6
- package/dist/types/src/testing/test-functions.d.ts.map +0 -1
- package/src/components/ChatThread/ChatMessage.tsx +0 -334
- package/src/components/PromptSettings.tsx +0 -90
- package/src/components/SequenceContainer.tsx +0 -131
- package/src/components/SequenceEditor/SequenceEditor.stories.tsx +0 -33
- package/src/components/SequenceEditor/SequenceEditor.tsx +0 -50
- package/src/components/SequenceEditor/index.ts +0 -5
- package/src/execution-graph/execution-graph.ts +0 -211
- package/src/execution-graph/index.ts +0 -5
- package/src/hooks/useExecutionGraph.ts +0 -20
- package/src/hooks/useMatcherExtension.ts +0 -45
- package/src/hooks/useResolveRef.ts +0 -33
- package/src/parser/filter-generator.test.ts +0 -32
- package/src/parser/filter-generator.ts +0 -76
- package/src/parser/index.ts +0 -7
- package/src/parser/query-parser.test.ts +0 -139
- package/src/parser/query-parser.ts +0 -199
- package/src/parser/types.ts +0 -36
- package/src/stories/Chat.stories.tsx +0 -469
- package/src/stories/components/BlueprintContainer.tsx +0 -32
- package/src/stories/components/ChatContainer.tsx +0 -57
- package/src/stories/components/CommentsContainer.tsx +0 -25
- package/src/stories/components/GraphContainer.tsx +0 -118
- package/src/stories/components/LoggingContainer.tsx +0 -21
- package/src/stories/components/MessageContainer.tsx +0 -27
- package/src/stories/components/SurfaceContainer.tsx +0 -52
- package/src/stories/components/TasksContainer.tsx +0 -49
- package/src/stories/components/TokenManagerContainer.tsx +0 -14
- package/src/stories/components/index.ts +0 -15
- package/src/stories/components/types.ts +0 -11
- package/src/stories/testing/data.ts +0 -142
- package/src/stories/testing/index.ts +0 -6
- package/src/stories/testing/testing.tsx +0 -254
- package/src/testing/test-data.ts +0 -109
- package/src/testing/test-functions.ts +0 -16
- /package/dist/lib/browser/{blueprint-definition-CRZPIA5A.mjs.map → blueprint-definition-AGTDXTXO.mjs.map} +0 -0
- /package/dist/lib/node-esm/{blueprint-definition-275J3XL2.mjs.map → blueprint-definition-CFCUD2VC.mjs.map} +0 -0
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import React from 'react';
|
|
6
|
+
|
|
7
|
+
import { log } from '@dxos/log';
|
|
8
|
+
import {
|
|
9
|
+
PromptWidget,
|
|
10
|
+
ReferenceWidget,
|
|
11
|
+
SelectWidget,
|
|
12
|
+
SuggestionWidget,
|
|
13
|
+
SummaryWidget,
|
|
14
|
+
ToggleContainer,
|
|
15
|
+
} from '@dxos/react-ui-components';
|
|
16
|
+
import { type XmlWidgetProps, type XmlWidgetRegistry, getXmlTextChild } from '@dxos/react-ui-editor';
|
|
17
|
+
import { Json } from '@dxos/react-ui-syntax-highlighter';
|
|
18
|
+
import { ContentBlock, type DataType } from '@dxos/schema';
|
|
19
|
+
|
|
20
|
+
import { ToolBlock } from '../ToolBlock';
|
|
21
|
+
|
|
22
|
+
import { type BlockRenderer, type MessageThreadContext } from './sync';
|
|
23
|
+
|
|
24
|
+
const Fallback = ({ _tag, ...props }: XmlWidgetProps<MessageThreadContext>) => {
|
|
25
|
+
return (
|
|
26
|
+
<ToggleContainer.Root classNames='rounded-sm'>
|
|
27
|
+
<ToggleContainer.Header classNames='bg-groupSurface'>{_tag}</ToggleContainer.Header>
|
|
28
|
+
<ToggleContainer.Content classNames='bg-modalSurface'>
|
|
29
|
+
<Json classNames='!p-2 text-sm' data={props} />
|
|
30
|
+
</ToggleContainer.Content>
|
|
31
|
+
</ToggleContainer.Root>
|
|
32
|
+
);
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Custom XML tags registry.
|
|
37
|
+
*/
|
|
38
|
+
export const componentRegistry: XmlWidgetRegistry = {
|
|
39
|
+
//
|
|
40
|
+
// Widgets
|
|
41
|
+
//
|
|
42
|
+
|
|
43
|
+
['prompt' as const]: {
|
|
44
|
+
block: true,
|
|
45
|
+
factory: (props) => {
|
|
46
|
+
const text = getXmlTextChild(props.children);
|
|
47
|
+
return text ? new PromptWidget(text) : null;
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
['reference' as const]: {
|
|
51
|
+
block: false,
|
|
52
|
+
factory: (props) => {
|
|
53
|
+
const text = getXmlTextChild(props.children);
|
|
54
|
+
return text && props.ref ? new ReferenceWidget(text, props.ref) : null;
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
['select' as const]: {
|
|
58
|
+
block: true,
|
|
59
|
+
factory: (props) => {
|
|
60
|
+
const options = props.children
|
|
61
|
+
?.map((option: any) => option._tag === 'option' && getXmlTextChild(option.children))
|
|
62
|
+
.filter(Boolean);
|
|
63
|
+
return options?.length ? new SelectWidget(options) : null;
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
['suggestion' as const]: {
|
|
67
|
+
block: true,
|
|
68
|
+
factory: (props) => {
|
|
69
|
+
const text = getXmlTextChild(props.children);
|
|
70
|
+
return text ? new SuggestionWidget(text) : null;
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
['summary' as const]: {
|
|
74
|
+
block: true,
|
|
75
|
+
factory: (props) => {
|
|
76
|
+
const text = getXmlTextChild(props.children);
|
|
77
|
+
return text ? new SummaryWidget(text) : null;
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
|
|
81
|
+
//
|
|
82
|
+
// React
|
|
83
|
+
//
|
|
84
|
+
|
|
85
|
+
['toolCall' as const]: {
|
|
86
|
+
block: true,
|
|
87
|
+
Component: ToolBlock,
|
|
88
|
+
},
|
|
89
|
+
['toolResult' as const]: {
|
|
90
|
+
block: true,
|
|
91
|
+
Component: Fallback,
|
|
92
|
+
},
|
|
93
|
+
['toolkit' as const]: {
|
|
94
|
+
block: true,
|
|
95
|
+
Component: Fallback,
|
|
96
|
+
},
|
|
97
|
+
|
|
98
|
+
//
|
|
99
|
+
// Fallback
|
|
100
|
+
//
|
|
101
|
+
|
|
102
|
+
['json' as const]: {
|
|
103
|
+
block: true,
|
|
104
|
+
Component: Fallback,
|
|
105
|
+
},
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Convert block to markdown.
|
|
110
|
+
*/
|
|
111
|
+
export const blockToMarkdown: BlockRenderer = (
|
|
112
|
+
context: MessageThreadContext,
|
|
113
|
+
message: DataType.Message,
|
|
114
|
+
block: ContentBlock.Any,
|
|
115
|
+
) => {
|
|
116
|
+
let str = _blockToMarkdown(context, message, block);
|
|
117
|
+
if (str && !block.pending) {
|
|
118
|
+
return (str += '\n');
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
return str;
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
const _blockToMarkdown = (context: MessageThreadContext, message: DataType.Message, block: ContentBlock.Any) => {
|
|
125
|
+
log('blockToMarkdown', { block: JSON.stringify(block) });
|
|
126
|
+
switch (block._tag) {
|
|
127
|
+
case 'text': {
|
|
128
|
+
if (message.sender.role === 'user') {
|
|
129
|
+
return `\n<prompt>${block.text}</prompt>\n`;
|
|
130
|
+
} else {
|
|
131
|
+
const text = block.text.trim();
|
|
132
|
+
if (text.length > 0) {
|
|
133
|
+
return text;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
break;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
case 'suggestion': {
|
|
140
|
+
if (block.pending) {
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
143
|
+
return `<suggestion>${block.text}</suggestion>`;
|
|
144
|
+
}
|
|
145
|
+
case 'select': {
|
|
146
|
+
if (block.pending || block.options.length === 0) {
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
return `<select>${block.options.map((option) => `<option>${option}</option>`).join('')}</select>`;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
// TODO(burdon): Need label.
|
|
154
|
+
case 'reference': {
|
|
155
|
+
return `<reference ref="${block.reference.dxn.toString()}">Ref</reference>`;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
// case 'toolkit': {
|
|
159
|
+
// return `<toolkit />`;
|
|
160
|
+
// }
|
|
161
|
+
|
|
162
|
+
case 'toolCall': {
|
|
163
|
+
context.updateWidget(block.toolCallId, {
|
|
164
|
+
blocks: [block],
|
|
165
|
+
});
|
|
166
|
+
return `<toolCall id="${block.toolCallId}" />`;
|
|
167
|
+
}
|
|
168
|
+
case 'toolResult': {
|
|
169
|
+
context.updateWidget(block.toolCallId, ({ blocks = [] }: { blocks: ContentBlock.Any[] }) => ({
|
|
170
|
+
blocks: [...blocks, block],
|
|
171
|
+
}));
|
|
172
|
+
break;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
case 'summary': {
|
|
176
|
+
return `<summary>${ContentBlock.createSummaryMessage(block)}</summary>`;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
// TODO(burdon): Need stable ID.
|
|
180
|
+
default: {
|
|
181
|
+
return `<json id="${message.id}">\n${JSON.stringify(block)}\n</json>`;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
};
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { EditorView } from '@codemirror/view';
|
|
6
|
+
import { describe, it } from '@effect/vitest';
|
|
7
|
+
import * as Effect from 'effect/Effect';
|
|
8
|
+
|
|
9
|
+
import { type ContentBlock } from '@dxos/schema';
|
|
10
|
+
|
|
11
|
+
import { createMessage } from '../../testing';
|
|
12
|
+
|
|
13
|
+
import { blockToMarkdown } from './registry';
|
|
14
|
+
import { MessageSyncer, type TextModel } from './sync';
|
|
15
|
+
|
|
16
|
+
class TestDocument implements TextModel {
|
|
17
|
+
private readonly _view = new EditorView({ extensions: [] });
|
|
18
|
+
|
|
19
|
+
get content() {
|
|
20
|
+
return this._view.state.doc.toString();
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
async reset(text: string) {
|
|
24
|
+
this._view.dispatch({ changes: { from: 0, to: this._view.state.doc.length, insert: text } });
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
async append(text: string) {
|
|
28
|
+
this._view.dispatch({ changes: { from: this._view.state.doc.length, insert: text } });
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
updateWidget(_id: string, _value: any) {}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
describe('reducers', () => {
|
|
35
|
+
it.effect(
|
|
36
|
+
'basic sync',
|
|
37
|
+
Effect.fn(function* ({ expect }) {
|
|
38
|
+
const doc = new TestDocument();
|
|
39
|
+
const syncer = new MessageSyncer(doc, blockToMarkdown);
|
|
40
|
+
|
|
41
|
+
const messages = [
|
|
42
|
+
createMessage('user', [{ _tag: 'text', text: 'Hello' }]),
|
|
43
|
+
createMessage('assistant', [{ _tag: 'text', text: 'Hi there!' }]),
|
|
44
|
+
];
|
|
45
|
+
|
|
46
|
+
syncer.sync(messages);
|
|
47
|
+
expect(doc.content).toEqual(['\n<prompt>Hello</prompt>\n', 'Hi there!', ''].join('\n'));
|
|
48
|
+
|
|
49
|
+
messages[1].blocks.push({ _tag: 'text', text: 'How can I help?' });
|
|
50
|
+
syncer.sync(messages);
|
|
51
|
+
expect(doc.content).toEqual(['\n<prompt>Hello</prompt>\n', 'Hi there!', 'How can I help?', ''].join('\n'));
|
|
52
|
+
}),
|
|
53
|
+
);
|
|
54
|
+
|
|
55
|
+
it.effect(
|
|
56
|
+
'sync with partial updates',
|
|
57
|
+
Effect.fn(function* ({ expect }) {
|
|
58
|
+
const doc = new TestDocument();
|
|
59
|
+
const syncer = new MessageSyncer(doc, blockToMarkdown);
|
|
60
|
+
|
|
61
|
+
const messages = [
|
|
62
|
+
createMessage('user', [{ _tag: 'text', text: 'Hello' }]),
|
|
63
|
+
createMessage('assistant', [{ _tag: 'text', text: 'Hi there!', pending: true }]),
|
|
64
|
+
];
|
|
65
|
+
|
|
66
|
+
syncer.sync(messages);
|
|
67
|
+
expect(doc.content).toEqual(['\n<prompt>Hello</prompt>\n', 'Hi there!'].join('\n'));
|
|
68
|
+
|
|
69
|
+
const block = messages[1].blocks[0] as ContentBlock.Text;
|
|
70
|
+
block.text = 'Hi there! How are you?';
|
|
71
|
+
block.pending = false;
|
|
72
|
+
syncer.sync(messages);
|
|
73
|
+
|
|
74
|
+
messages[1].blocks.push({ _tag: 'text', text: 'How can I help?' });
|
|
75
|
+
syncer.sync(messages);
|
|
76
|
+
expect(doc.content).toEqual(
|
|
77
|
+
['\n<prompt>Hello</prompt>\n', 'Hi there! How are you?', 'How can I help?', ''].join('\n'),
|
|
78
|
+
);
|
|
79
|
+
}),
|
|
80
|
+
);
|
|
81
|
+
});
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { log } from '@dxos/log';
|
|
6
|
+
import { type MarkdownStreamController } from '@dxos/react-ui-components';
|
|
7
|
+
import { type XmlWidgetStateManager } from '@dxos/react-ui-editor';
|
|
8
|
+
import { type ContentBlock, type DataType } from '@dxos/schema';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Update document.
|
|
12
|
+
*/
|
|
13
|
+
export type TextModel = Pick<MarkdownStreamController, 'reset' | 'append' | 'updateWidget'>;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Thread context passed to renderer.
|
|
17
|
+
*/
|
|
18
|
+
export class MessageThreadContext implements Pick<MarkdownStreamController, 'updateWidget'> {
|
|
19
|
+
constructor(private readonly _widgetState?: XmlWidgetStateManager) {}
|
|
20
|
+
|
|
21
|
+
updateWidget<T>(id: string, value: T) {
|
|
22
|
+
this._widgetState?.updateWidget(id, value);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Renders a block to markdown.
|
|
28
|
+
*/
|
|
29
|
+
export type BlockRenderer = (
|
|
30
|
+
context: MessageThreadContext,
|
|
31
|
+
message: DataType.Message,
|
|
32
|
+
block: ContentBlock.Any,
|
|
33
|
+
) => string | undefined;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Syncs messages with the editor.
|
|
37
|
+
*/
|
|
38
|
+
export class MessageSyncer {
|
|
39
|
+
private _initialMessageId?: string;
|
|
40
|
+
private _currentMessageIndex = 0;
|
|
41
|
+
private _currentBlockIndex = 0;
|
|
42
|
+
private _currentBlockContent?: string;
|
|
43
|
+
|
|
44
|
+
private readonly _context: MessageThreadContext;
|
|
45
|
+
|
|
46
|
+
constructor(
|
|
47
|
+
private readonly _model: TextModel,
|
|
48
|
+
private readonly _blockRenderer: BlockRenderer,
|
|
49
|
+
) {
|
|
50
|
+
this._context = new MessageThreadContext(this._model);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
get context() {
|
|
54
|
+
return this._context;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
reset() {
|
|
58
|
+
log('reset');
|
|
59
|
+
this._initialMessageId = undefined;
|
|
60
|
+
this._currentMessageIndex = 0;
|
|
61
|
+
this._currentBlockIndex = 0;
|
|
62
|
+
this._currentBlockContent = undefined;
|
|
63
|
+
void this._model.reset('');
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
sync(messages: DataType.Message[]) {
|
|
67
|
+
log('sync', {
|
|
68
|
+
messages: messages.map((message) => message.blocks.length),
|
|
69
|
+
currentMessageIndex: this._currentMessageIndex,
|
|
70
|
+
currentBlockIndex: this._currentBlockIndex,
|
|
71
|
+
currentBlockContent: this._currentBlockContent,
|
|
72
|
+
});
|
|
73
|
+
if (this._initialMessageId !== messages[0]?.id) {
|
|
74
|
+
this.reset();
|
|
75
|
+
this._initialMessageId = messages[0]?.id;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
let i = this._currentMessageIndex;
|
|
79
|
+
for (const message of messages.slice(this._currentMessageIndex)) {
|
|
80
|
+
if (i > this._currentMessageIndex) {
|
|
81
|
+
this._currentBlockIndex = 0;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
this._currentMessageIndex = i;
|
|
85
|
+
let j = this._currentBlockIndex;
|
|
86
|
+
for (const block of message.blocks.slice(this._currentBlockIndex)) {
|
|
87
|
+
this._currentBlockIndex = j;
|
|
88
|
+
const currentBlockContent = this._blockRenderer(this._context, message, block);
|
|
89
|
+
if (currentBlockContent) {
|
|
90
|
+
let content: string = '';
|
|
91
|
+
if (this._currentBlockContent && currentBlockContent.startsWith(this._currentBlockContent)) {
|
|
92
|
+
content = currentBlockContent.slice(this._currentBlockContent.length);
|
|
93
|
+
} else {
|
|
94
|
+
content = currentBlockContent;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
void this._model.append(content);
|
|
98
|
+
this._currentBlockContent = currentBlockContent;
|
|
99
|
+
log('append', { message: i, block: j, content });
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
if (block.pending) {
|
|
103
|
+
return;
|
|
104
|
+
} else {
|
|
105
|
+
this._currentBlockContent = undefined;
|
|
106
|
+
this._currentBlockIndex++;
|
|
107
|
+
}
|
|
108
|
+
j++;
|
|
109
|
+
}
|
|
110
|
+
i++;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
@@ -5,16 +5,19 @@
|
|
|
5
5
|
import React from 'react';
|
|
6
6
|
|
|
7
7
|
import { fullyQualifiedId } from '@dxos/react-client/echo';
|
|
8
|
+
import { type ThemedClassName } from '@dxos/react-ui';
|
|
8
9
|
import { MenuProvider, ToolbarMenu } from '@dxos/react-ui-menu';
|
|
9
10
|
|
|
10
11
|
import { type ChatToolbarActionsProps, useChatToolbarActions } from './useChatToolbarActions';
|
|
11
12
|
|
|
12
|
-
export
|
|
13
|
+
export type ChatToolbarProps = ThemedClassName<ChatToolbarActionsProps>;
|
|
14
|
+
|
|
15
|
+
export const ChatToolbar = ({ chat, companionTo, onReset, classNames }: ChatToolbarProps) => {
|
|
13
16
|
const menu = useChatToolbarActions({ chat, companionTo, onReset });
|
|
14
17
|
|
|
15
18
|
return (
|
|
16
19
|
<MenuProvider {...menu} attendableId={companionTo ? fullyQualifiedId(companionTo) : fullyQualifiedId(chat)}>
|
|
17
|
-
<ToolbarMenu />
|
|
20
|
+
<ToolbarMenu classNames={classNames} textBlockWidth />
|
|
18
21
|
</MenuProvider>
|
|
19
22
|
);
|
|
20
23
|
};
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { Rx } from '@effect-rx/rx-react';
|
|
6
|
-
import
|
|
6
|
+
import * as Effect from 'effect/Effect';
|
|
7
7
|
import { useMemo } from 'react';
|
|
8
8
|
|
|
9
9
|
import { createIntent, useIntentDispatcher } from '@dxos/app-framework';
|
|
@@ -60,6 +60,7 @@ export const useChatToolbarActions = ({ chat, companionTo, onReset }: ChatToolba
|
|
|
60
60
|
target: companionTo,
|
|
61
61
|
}),
|
|
62
62
|
);
|
|
63
|
+
|
|
63
64
|
yield* dispatch(createIntent(AssistantAction.SetCurrentChat, { companionTo, chat: object }));
|
|
64
65
|
}
|
|
65
66
|
}).pipe(Effect.runPromise),
|
|
@@ -2,8 +2,6 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import '@dxos-theme';
|
|
6
|
-
|
|
7
5
|
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
8
6
|
import React, { useState } from 'react';
|
|
9
7
|
|
|
@@ -11,7 +9,7 @@ import { createSystemPrompt } from '@dxos/assistant';
|
|
|
11
9
|
import { Blueprint, Template } from '@dxos/blueprints';
|
|
12
10
|
import { useClient } from '@dxos/react-client';
|
|
13
11
|
import { withClientProvider } from '@dxos/react-client/testing';
|
|
14
|
-
import { withLayout, withTheme } from '@dxos/
|
|
12
|
+
import { withLayout, withTheme } from '@dxos/react-ui/testing';
|
|
15
13
|
import { trim } from '@dxos/util';
|
|
16
14
|
|
|
17
15
|
import { translations } from '../../translations';
|
|
@@ -29,6 +27,8 @@ const TEMPLATE = trim`
|
|
|
29
27
|
- {{this}}
|
|
30
28
|
{{/each}}
|
|
31
29
|
|
|
30
|
+
Reponse in the format: <suggestion>SUGGESTION</suggestion>
|
|
31
|
+
|
|
32
32
|
---
|
|
33
33
|
|
|
34
34
|
{{input}}
|
|
@@ -61,13 +61,13 @@ const meta = {
|
|
|
61
61
|
component: TemplateEditor as any,
|
|
62
62
|
render: DefaultStory,
|
|
63
63
|
decorators: [
|
|
64
|
+
withTheme,
|
|
65
|
+
withLayout({ container: 'column' }),
|
|
64
66
|
withClientProvider({
|
|
65
67
|
types: [Blueprint.Blueprint],
|
|
66
68
|
createIdentity: true,
|
|
67
69
|
createSpace: true,
|
|
68
70
|
}),
|
|
69
|
-
withLayout({ fullscreen: true, classNames: 'justify-center bg-deckSurface' }),
|
|
70
|
-
withTheme,
|
|
71
71
|
],
|
|
72
72
|
parameters: {
|
|
73
73
|
translations,
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
+
import { xml } from '@codemirror/lang-xml';
|
|
6
|
+
import { defaultHighlightStyle, syntaxHighlighting } from '@codemirror/language';
|
|
5
7
|
import React from 'react';
|
|
6
8
|
|
|
7
9
|
import { type Template } from '@dxos/blueprints';
|
|
@@ -12,10 +14,11 @@ import {
|
|
|
12
14
|
createDataExtensions,
|
|
13
15
|
createMarkdownExtensions,
|
|
14
16
|
createThemeExtensions,
|
|
17
|
+
decorateMarkdown,
|
|
15
18
|
useTextEditor,
|
|
16
19
|
} from '@dxos/react-ui-editor';
|
|
17
20
|
import { mx } from '@dxos/react-ui-theme';
|
|
18
|
-
import {
|
|
21
|
+
import { isNonNullable } from '@dxos/util';
|
|
19
22
|
|
|
20
23
|
import { meta } from '../../meta';
|
|
21
24
|
|
|
@@ -24,9 +27,10 @@ import { handlebars } from './handlebars-extension';
|
|
|
24
27
|
export type TemplateEditorProps = ThemedClassName<{
|
|
25
28
|
id: string;
|
|
26
29
|
template: Template.Template;
|
|
30
|
+
lineNumbers?: boolean;
|
|
27
31
|
}>;
|
|
28
32
|
|
|
29
|
-
export const TemplateEditor = ({ id, classNames, template }: TemplateEditorProps) => {
|
|
33
|
+
export const TemplateEditor = ({ id, classNames, template, lineNumbers = true }: TemplateEditorProps) => {
|
|
30
34
|
const { t } = useTranslation(meta.id);
|
|
31
35
|
const { themeMode } = useThemeContext();
|
|
32
36
|
const { parentRef } = useTextEditor(() => {
|
|
@@ -38,21 +42,25 @@ export const TemplateEditor = ({ id, classNames, template }: TemplateEditorProps
|
|
|
38
42
|
return {
|
|
39
43
|
initialValue: text.content ?? '',
|
|
40
44
|
extensions: [
|
|
41
|
-
createDataExtensions({
|
|
45
|
+
createDataExtensions({
|
|
46
|
+
id,
|
|
47
|
+
text: createDocAccessor(text, ['content']),
|
|
48
|
+
}),
|
|
42
49
|
createBasicExtensions({
|
|
43
50
|
bracketMatching: false,
|
|
44
|
-
lineNumbers
|
|
45
|
-
lineWrapping:
|
|
51
|
+
lineNumbers,
|
|
52
|
+
lineWrapping: false,
|
|
46
53
|
placeholder: t('template placeholder'),
|
|
47
54
|
}),
|
|
48
55
|
createThemeExtensions({ themeMode }),
|
|
49
|
-
|
|
50
|
-
//
|
|
51
|
-
createMarkdownExtensions({ themeMode }),
|
|
56
|
+
createMarkdownExtensions(),
|
|
57
|
+
decorateMarkdown(), // TODO(burdon): Move into bundle.
|
|
52
58
|
handlebars(),
|
|
53
|
-
|
|
59
|
+
xml(),
|
|
60
|
+
syntaxHighlighting(defaultHighlightStyle),
|
|
61
|
+
].filter(isNonNullable),
|
|
54
62
|
};
|
|
55
|
-
}, [themeMode, template.source?.target]);
|
|
63
|
+
}, [themeMode, template.source?.target, lineNumbers]);
|
|
56
64
|
|
|
57
65
|
return <div ref={parentRef} className={mx('bs-full overflow-hidden', classNames)} />;
|
|
58
66
|
};
|
|
@@ -2,15 +2,13 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import '@dxos-theme';
|
|
6
|
-
|
|
7
5
|
import { type Meta } from '@storybook/react-vite';
|
|
8
6
|
import React, { useState } from 'react';
|
|
9
7
|
|
|
10
8
|
import { Blueprint, Template } from '@dxos/blueprints';
|
|
11
9
|
import { useClient } from '@dxos/react-client';
|
|
12
10
|
import { withClientProvider } from '@dxos/react-client/testing';
|
|
13
|
-
import { withLayout, withTheme } from '@dxos/
|
|
11
|
+
import { withLayout, withTheme } from '@dxos/react-ui/testing';
|
|
14
12
|
import { trim } from '@dxos/util';
|
|
15
13
|
|
|
16
14
|
import { translations } from '../../translations';
|
|
@@ -52,13 +50,13 @@ const meta = {
|
|
|
52
50
|
component: TemplateForm,
|
|
53
51
|
render: DefaultStory,
|
|
54
52
|
decorators: [
|
|
53
|
+
withTheme,
|
|
54
|
+
withLayout({ container: 'column' }),
|
|
55
55
|
withClientProvider({
|
|
56
56
|
types: [Blueprint.Blueprint],
|
|
57
57
|
createIdentity: true,
|
|
58
58
|
createSpace: true,
|
|
59
59
|
}),
|
|
60
|
-
withLayout({ fullscreen: true, classNames: 'flex justify-center' }),
|
|
61
|
-
withTheme,
|
|
62
60
|
],
|
|
63
61
|
parameters: {
|
|
64
62
|
translations,
|
|
@@ -49,24 +49,25 @@ const handlebarsHighlightPlugin = ViewPlugin.fromClass(
|
|
|
49
49
|
decorations: DecorationSet;
|
|
50
50
|
|
|
51
51
|
constructor(view: EditorView) {
|
|
52
|
-
this.decorations = this.
|
|
52
|
+
this.decorations = this.buildDecorations(view);
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
-
|
|
55
|
+
// NOTE: Decorations may clash with other extensions (e.g., markdown).
|
|
56
|
+
buildDecorations(view: EditorView) {
|
|
56
57
|
const widgets: any[] = [];
|
|
57
58
|
|
|
58
59
|
for (const { from, to } of view.visibleRanges) {
|
|
59
60
|
const text = view.state.doc.sliceString(from, to);
|
|
60
61
|
|
|
61
62
|
// Match comments: {{! comment }}
|
|
62
|
-
{
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
}
|
|
63
|
+
// {
|
|
64
|
+
// let match;
|
|
65
|
+
// while ((match = regex.comment.exec(text)) !== null) {
|
|
66
|
+
// const start = from + match.index;
|
|
67
|
+
// const end = start + match[0].length;
|
|
68
|
+
// widgets.push(Decoration.mark({ class: '!text-roseText' }).range(start, end));
|
|
69
|
+
// }
|
|
70
|
+
// }
|
|
70
71
|
|
|
71
72
|
// Match brackets: {{ and }}
|
|
72
73
|
{
|
|
@@ -113,7 +114,7 @@ const handlebarsHighlightPlugin = ViewPlugin.fromClass(
|
|
|
113
114
|
|
|
114
115
|
update(update: ViewUpdate) {
|
|
115
116
|
if (update.docChanged || update.viewportChanged) {
|
|
116
|
-
this.decorations = this.
|
|
117
|
+
this.decorations = this.buildDecorations(update.view);
|
|
117
118
|
}
|
|
118
119
|
}
|
|
119
120
|
},
|