@dxos/plugin-assistant 0.8.4-main.406dc2a → 0.8.4-main.548089c
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/BlueprintArticle-UGPRZRBG.mjs +36 -0
- package/dist/lib/browser/BlueprintArticle-UGPRZRBG.mjs.map +7 -0
- package/dist/lib/browser/{ChatCompanion-BDZ55ZRF.mjs → ChatCompanion-BZGANK56.mjs} +58 -50
- package/dist/lib/browser/ChatCompanion-BZGANK56.mjs.map +7 -0
- package/dist/lib/browser/{ChatContainer-RYGNN73X.mjs → ChatContainer-OG6Y3NHI.mjs} +22 -18
- package/dist/lib/browser/ChatContainer-OG6Y3NHI.mjs.map +7 -0
- package/dist/lib/browser/{ChatDialog-MVHH2U66.mjs → ChatDialog-NKNUCC3R.mjs} +8 -4
- package/dist/lib/browser/ChatDialog-NKNUCC3R.mjs.map +7 -0
- package/dist/lib/browser/PromptArticle-QNJAXD5Y.mjs +89 -0
- package/dist/lib/browser/PromptArticle-QNJAXD5Y.mjs.map +7 -0
- package/dist/lib/browser/{app-graph-builder-2U7SLCRX.mjs → app-graph-builder-CJ5ZUG5I.mjs} +62 -17
- package/dist/lib/browser/app-graph-builder-CJ5ZUG5I.mjs.map +7 -0
- package/dist/lib/browser/{blueprint-definition-NSJARW5U.mjs → blueprint-definition-5FT5JGPY.mjs} +4 -4
- package/dist/lib/browser/chunk-AO6XHMQ7.mjs +262 -0
- package/dist/lib/browser/chunk-AO6XHMQ7.mjs.map +7 -0
- package/dist/lib/browser/{chunk-FP56WB24.mjs → chunk-BNTPFZ7O.mjs} +30 -13
- package/dist/lib/browser/chunk-BNTPFZ7O.mjs.map +7 -0
- package/dist/lib/browser/chunk-FJQ4ZRYJ.mjs +335 -0
- package/dist/lib/browser/chunk-FJQ4ZRYJ.mjs.map +7 -0
- package/dist/lib/browser/{chunk-2CE2KPKZ.mjs → chunk-IXIIS4QA.mjs} +37 -36
- package/dist/lib/browser/chunk-IXIIS4QA.mjs.map +7 -0
- package/dist/lib/browser/{chunk-5EGXHCAZ.mjs → chunk-LRE4VEZV.mjs} +2 -2
- package/dist/lib/browser/chunk-LRE4VEZV.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/{chunk-WRJGOT5P.mjs → chunk-Y4C2CMME.mjs} +772 -620
- package/dist/lib/browser/chunk-Y4C2CMME.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +78 -62
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/{intent-resolver-3GOJMBXJ.mjs → intent-resolver-42A4SLIQ.mjs} +49 -20
- package/dist/lib/browser/intent-resolver-42A4SLIQ.mjs.map +7 -0
- package/dist/lib/browser/{local-model-resolver-GO6ZEMLL.mjs → local-model-resolver-34MVHRKD.mjs} +2 -2
- package/dist/lib/browser/{local-model-resolver-GO6ZEMLL.mjs.map → local-model-resolver-34MVHRKD.mjs.map} +2 -2
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/{react-surface-FTKCE6GG.mjs → react-surface-TULJF2Y3.mjs} +22 -31
- package/dist/lib/browser/react-surface-TULJF2Y3.mjs.map +7 -0
- package/dist/lib/browser/{settings-HBF32KV6.mjs → settings-NYJGNQ5I.mjs} +3 -3
- package/dist/lib/browser/{state-LXTS54DI.mjs → state-GG7Z3NB7.mjs} +7 -3
- package/dist/lib/browser/{state-LXTS54DI.mjs.map → state-GG7Z3NB7.mjs.map} +3 -3
- package/dist/lib/browser/toolkit-VYDAWNE4.mjs +17 -0
- package/dist/lib/browser/toolkit-VYDAWNE4.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +2 -2
- package/dist/lib/node-esm/BlueprintArticle-RPZ2363K.mjs +37 -0
- package/dist/lib/node-esm/BlueprintArticle-RPZ2363K.mjs.map +7 -0
- package/dist/lib/node-esm/{ChatCompanion-XFNXVZIP.mjs → ChatCompanion-LKWZTSCI.mjs} +58 -50
- package/dist/lib/node-esm/ChatCompanion-LKWZTSCI.mjs.map +7 -0
- package/dist/lib/node-esm/{ChatContainer-UTJGCQXF.mjs → ChatContainer-HGAAKVB3.mjs} +22 -18
- package/dist/lib/node-esm/ChatContainer-HGAAKVB3.mjs.map +7 -0
- package/dist/lib/node-esm/{ChatDialog-QEYZ4IOV.mjs → ChatDialog-QA545GGB.mjs} +8 -4
- package/dist/lib/node-esm/ChatDialog-QA545GGB.mjs.map +7 -0
- package/dist/lib/node-esm/PromptArticle-JW46XL4M.mjs +90 -0
- package/dist/lib/node-esm/PromptArticle-JW46XL4M.mjs.map +7 -0
- package/dist/lib/node-esm/{app-graph-builder-OKNLR7H2.mjs → app-graph-builder-XPQLG755.mjs} +62 -17
- package/dist/lib/node-esm/app-graph-builder-XPQLG755.mjs.map +7 -0
- package/dist/lib/node-esm/{blueprint-definition-WD2IVMAI.mjs → blueprint-definition-XW6QQVLV.mjs} +4 -4
- package/dist/lib/node-esm/chunk-3YVWS6OI.mjs +264 -0
- package/dist/lib/node-esm/chunk-3YVWS6OI.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-TNR46C3L.mjs → chunk-AB74FOA2.mjs} +30 -13
- package/dist/lib/node-esm/chunk-AB74FOA2.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-KJGD4EBJ.mjs +336 -0
- package/dist/lib/node-esm/chunk-KJGD4EBJ.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-U2NYUS2N.mjs → chunk-UXTUHH24.mjs} +37 -36
- package/dist/lib/node-esm/chunk-UXTUHH24.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-UFKLCEAE.mjs → chunk-VI6S3Q5H.mjs} +772 -620
- package/dist/lib/node-esm/chunk-VI6S3Q5H.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-73ABYRYX.mjs → chunk-WE6KTH72.mjs} +7 -2
- package/dist/lib/node-esm/chunk-WE6KTH72.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-XQGWSZ4T.mjs → chunk-YWFWT57N.mjs} +2 -2
- package/dist/lib/node-esm/chunk-YWFWT57N.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +78 -62
- package/dist/lib/node-esm/index.mjs.map +3 -3
- package/dist/lib/node-esm/{intent-resolver-6XLVTRDJ.mjs → intent-resolver-Y6I3IDSI.mjs} +49 -20
- package/dist/lib/node-esm/intent-resolver-Y6I3IDSI.mjs.map +7 -0
- package/dist/lib/node-esm/{local-model-resolver-WOQ2D2R2.mjs → local-model-resolver-TP2NTSAX.mjs} +2 -2
- package/dist/lib/node-esm/{local-model-resolver-WOQ2D2R2.mjs.map → local-model-resolver-TP2NTSAX.mjs.map} +2 -2
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/{react-surface-K7ZXQLAP.mjs → react-surface-C4WY3WRR.mjs} +22 -31
- package/dist/lib/node-esm/react-surface-C4WY3WRR.mjs.map +7 -0
- package/dist/lib/node-esm/{settings-CWP6MTWP.mjs → settings-RRHYI5KO.mjs} +3 -3
- package/dist/lib/node-esm/{state-BO6GUFLB.mjs → state-FSUHFMDM.mjs} +7 -3
- package/dist/lib/node-esm/{state-BO6GUFLB.mjs.map → state-FSUHFMDM.mjs.map} +3 -3
- package/dist/lib/node-esm/toolkit-HFJZLVIR.mjs +18 -0
- package/dist/lib/node-esm/toolkit-HFJZLVIR.mjs.map +7 -0
- package/dist/lib/node-esm/types/index.mjs +2 -2
- package/dist/types/src/AssistantPlugin.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 +2 -3
- package/dist/types/src/capabilities/capabilities.d.ts.map +1 -1
- package/dist/types/src/capabilities/intent-resolver.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
- package/dist/types/src/capabilities/state.d.ts.map +1 -1
- package/dist/types/src/capabilities/toolkit.d.ts +1 -1
- package/dist/types/src/capabilities/toolkit.d.ts.map +1 -1
- package/dist/types/src/components/BlueprintArticle.d.ts +7 -0
- package/dist/types/src/components/BlueprintArticle.d.ts.map +1 -0
- package/dist/types/src/components/Chat/Chat.d.ts +18 -8
- package/dist/types/src/components/Chat/Chat.d.ts.map +1 -1
- package/dist/types/src/components/Chat/events.d.ts +4 -0
- package/dist/types/src/components/Chat/events.d.ts.map +1 -1
- package/dist/types/src/components/ChatCompanion.d.ts +2 -2
- package/dist/types/src/components/ChatCompanion.d.ts.map +1 -1
- package/dist/types/src/components/ChatContainer.d.ts +7 -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/ChatPrompt/ChatActions.d.ts.map +1 -1
- package/dist/types/src/components/ChatPrompt/ChatOptions.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/ChatThread.d.ts +6 -9
- package/dist/types/src/components/ChatThread/ChatThread.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/ChatThread.stories.d.ts +123 -70
- package/dist/types/src/components/ChatThread/ChatThread.stories.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/reducers.d.ts +5 -5
- package/dist/types/src/components/ChatThread/reducers.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/sync.d.ts +12 -6
- package/dist/types/src/components/ChatThread/sync.d.ts.map +1 -1
- package/dist/types/src/components/PromptArticle.d.ts +7 -0
- package/dist/types/src/components/PromptArticle.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 +111 -61
- package/dist/types/src/components/TemplateEditor/TemplateEditor.stories.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/TemplateForm.stories.d.ts +111 -61
- package/dist/types/src/components/TemplateEditor/TemplateForm.stories.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/extensions/handlebars-extension.d.ts.map +1 -0
- package/dist/types/src/components/TemplateEditor/extensions/index.d.ts +3 -0
- package/dist/types/src/components/TemplateEditor/extensions/index.d.ts.map +1 -0
- package/dist/types/src/components/TemplateEditor/extensions/xml-extension.d.ts +8 -0
- package/dist/types/src/components/TemplateEditor/extensions/xml-extension.d.ts.map +1 -0
- package/dist/types/src/components/ToolBlock/ToolBlock.d.ts +9 -7
- package/dist/types/src/components/ToolBlock/ToolBlock.d.ts.map +1 -1
- 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 +111 -60
- package/dist/types/src/components/Toolbox/Toolbox.stories.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +4 -9
- package/dist/types/src/components/index.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 +1 -0
- package/dist/types/src/hooks/index.d.ts.map +1 -1
- package/dist/types/src/hooks/useBlueprintRegistry.d.ts.map +1 -1
- package/dist/types/src/hooks/useChatProcessor.d.ts +3 -1
- package/dist/types/src/hooks/useChatProcessor.d.ts.map +1 -1
- package/dist/types/src/hooks/useChatServices.d.ts.map +1 -1
- package/dist/types/src/hooks/useChatToolbarActions.d.ts +8 -0
- package/dist/types/src/hooks/useChatToolbarActions.d.ts.map +1 -0
- package/dist/types/src/hooks/useContextBinder.d.ts +2 -2
- package/dist/types/src/hooks/useContextBinder.d.ts.map +1 -1
- package/dist/types/src/hooks/useReferencesProvider.d.ts.map +1 -1
- 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/processor.d.ts +6 -6
- 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/queue-logger.d.ts.map +1 -1
- package/dist/types/src/testing/test-generator.d.ts +2 -2
- package/dist/types/src/testing/test-generator.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +239 -26
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/Assistant.d.ts +0 -3
- package/dist/types/src/types/Assistant.d.ts.map +1 -1
- package/dist/types/src/types/AssistantAction.d.ts +29 -4
- package/dist/types/src/types/AssistantAction.d.ts.map +1 -1
- package/dist/types/src/types/service.d.ts +9 -6
- package/dist/types/src/types/service.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +78 -73
- package/src/AssistantPlugin.tsx +20 -2
- package/src/capabilities/app-graph-builder.ts +62 -15
- package/src/capabilities/blueprint-definition.ts +38 -36
- package/src/capabilities/capabilities.ts +2 -3
- package/src/capabilities/intent-resolver.ts +66 -15
- package/src/capabilities/local-model-resolver.ts +1 -1
- package/src/capabilities/react-surface.tsx +16 -20
- package/src/capabilities/state.ts +2 -0
- package/src/capabilities/toolkit.ts +9 -160
- package/src/components/BlueprintArticle.tsx +29 -0
- package/src/components/Chat/Chat.tsx +112 -58
- package/src/components/Chat/events.ts +6 -0
- package/src/components/ChatCompanion.tsx +62 -43
- package/src/components/ChatContainer.tsx +27 -17
- package/src/components/ChatDialog.tsx +9 -2
- package/src/components/ChatProgress/ChatProgress.tsx +1 -1
- package/src/components/ChatPrompt/ChatActions.tsx +2 -4
- package/src/components/ChatPrompt/ChatOptions.tsx +26 -23
- package/src/components/ChatPrompt/ChatReferences.tsx +2 -2
- package/src/components/ChatThread/ChatThread.stories.tsx +45 -26
- package/src/components/ChatThread/ChatThread.tsx +25 -35
- package/src/components/ChatThread/reducers.ts +6 -6
- package/src/components/ChatThread/registry.tsx +23 -33
- package/src/components/ChatThread/sync.test.ts +20 -12
- package/src/components/ChatThread/sync.ts +47 -12
- package/src/components/ChatThread/testing/thread.md +37 -0
- package/src/components/PromptArticle.tsx +85 -0
- package/src/components/TemplateEditor/TemplateEditor.stories.tsx +14 -4
- package/src/components/TemplateEditor/TemplateEditor.tsx +17 -8
- package/src/components/TemplateEditor/TemplateForm.stories.tsx +2 -2
- package/src/components/TemplateEditor/TemplateForm.tsx +1 -1
- package/src/components/TemplateEditor/extensions/handlebars-extension.ts +269 -0
- package/src/components/TemplateEditor/extensions/index.ts +6 -0
- package/src/components/TemplateEditor/extensions/xml-extension.ts +64 -0
- package/src/components/ToolBlock/ToolBlock.tsx +33 -42
- package/src/components/Toolbox/Toolbox.stories.tsx +2 -2
- package/src/components/Toolbox/Toolbox.tsx +5 -5
- package/src/components/index.ts +2 -5
- package/src/functions/analysis.ts +1 -1
- package/src/functions/index.ts +2 -2
- package/src/functions/{list.ts → object-list.ts} +4 -4
- package/src/functions/{load.ts → object-load.ts} +3 -4
- package/src/hooks/index.ts +1 -0
- package/src/hooks/useBlueprintRegistry.ts +2 -1
- package/src/hooks/useChatProcessor.ts +12 -12
- package/src/hooks/useChatServices.ts +7 -5
- package/src/hooks/useChatToolbarActions.ts +122 -0
- package/src/hooks/useContextBinder.ts +6 -6
- package/src/hooks/useReferencesProvider.ts +2 -1
- package/src/meta.ts +6 -1
- package/src/processor/index.ts +1 -0
- package/src/processor/presets.ts +1 -1
- package/src/processor/processor.test.ts +8 -18
- package/src/processor/processor.ts +14 -39
- package/src/processor/update-name.ts +56 -0
- package/src/queue-logger.ts +4 -8
- package/src/testing/test-generator.ts +10 -10
- package/src/translations.ts +24 -16
- package/src/types/Assistant.ts +4 -5
- package/src/types/AssistantAction.ts +21 -4
- package/src/types/service.ts +2 -2
- package/dist/lib/browser/BlueprintContainer-WX2SSDVI.mjs +0 -28
- package/dist/lib/browser/BlueprintContainer-WX2SSDVI.mjs.map +0 -7
- package/dist/lib/browser/ChatCompanion-BDZ55ZRF.mjs.map +0 -7
- package/dist/lib/browser/ChatContainer-RYGNN73X.mjs.map +0 -7
- package/dist/lib/browser/ChatDialog-MVHH2U66.mjs.map +0 -7
- package/dist/lib/browser/SequenceContainer-2FEWMQGW.mjs +0 -150
- package/dist/lib/browser/SequenceContainer-2FEWMQGW.mjs.map +0 -7
- package/dist/lib/browser/app-graph-builder-2U7SLCRX.mjs.map +0 -7
- package/dist/lib/browser/chunk-2CE2KPKZ.mjs.map +0 -7
- package/dist/lib/browser/chunk-43I2LR6O.mjs +0 -216
- package/dist/lib/browser/chunk-43I2LR6O.mjs.map +0 -7
- package/dist/lib/browser/chunk-5EGXHCAZ.mjs.map +0 -7
- package/dist/lib/browser/chunk-5RICKAMN.mjs +0 -18
- package/dist/lib/browser/chunk-5RICKAMN.mjs.map +0 -7
- package/dist/lib/browser/chunk-CQ7UHYTT.mjs +0 -296
- package/dist/lib/browser/chunk-CQ7UHYTT.mjs.map +0 -7
- package/dist/lib/browser/chunk-FP56WB24.mjs.map +0 -7
- package/dist/lib/browser/chunk-JZRZVB2A.mjs +0 -170
- package/dist/lib/browser/chunk-JZRZVB2A.mjs.map +0 -7
- package/dist/lib/browser/chunk-WRJGOT5P.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-3GOJMBXJ.mjs.map +0 -7
- package/dist/lib/browser/react-surface-FTKCE6GG.mjs.map +0 -7
- package/dist/lib/browser/toolkit-NQ2GXCF5.mjs +0 -199
- package/dist/lib/browser/toolkit-NQ2GXCF5.mjs.map +0 -7
- package/dist/lib/node-esm/BlueprintContainer-4MKN6ZRB.mjs +0 -29
- package/dist/lib/node-esm/BlueprintContainer-4MKN6ZRB.mjs.map +0 -7
- package/dist/lib/node-esm/ChatCompanion-XFNXVZIP.mjs.map +0 -7
- package/dist/lib/node-esm/ChatContainer-UTJGCQXF.mjs.map +0 -7
- package/dist/lib/node-esm/ChatDialog-QEYZ4IOV.mjs.map +0 -7
- package/dist/lib/node-esm/SequenceContainer-PGGJUQ46.mjs +0 -151
- package/dist/lib/node-esm/SequenceContainer-PGGJUQ46.mjs.map +0 -7
- package/dist/lib/node-esm/app-graph-builder-OKNLR7H2.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-73ABYRYX.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-DSE2IILK.mjs +0 -217
- package/dist/lib/node-esm/chunk-DSE2IILK.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-E2WXZND7.mjs +0 -297
- package/dist/lib/node-esm/chunk-E2WXZND7.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-HXIBCBH4.mjs +0 -171
- package/dist/lib/node-esm/chunk-HXIBCBH4.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-TNR46C3L.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-U2NYUS2N.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-UFKLCEAE.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-XQGWSZ4T.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-6XLVTRDJ.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-K7ZXQLAP.mjs.map +0 -7
- package/dist/lib/node-esm/toolkit-V57PRJNG.mjs +0 -200
- package/dist/lib/node-esm/toolkit-V57PRJNG.mjs.map +0 -7
- package/dist/types/src/components/BlueprintContainer.d.ts +0 -8
- package/dist/types/src/components/BlueprintContainer.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 -269
- 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/TemplateEditor/handlebars-extension.d.ts.map +0 -1
- package/dist/types/src/components/Toolbar/Toolbar.d.ts +0 -5
- 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 +0 -11
- package/dist/types/src/components/Toolbar/useChatToolbarActions.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/src/components/BlueprintContainer.tsx +0 -24
- package/src/components/PromptSettings.tsx +0 -90
- package/src/components/SequenceContainer.tsx +0 -131
- package/src/components/SequenceEditor/SequenceEditor.stories.tsx +0 -35
- package/src/components/SequenceEditor/SequenceEditor.tsx +0 -50
- package/src/components/SequenceEditor/index.ts +0 -5
- package/src/components/TemplateEditor/handlebars-extension.ts +0 -165
- package/src/components/Toolbar/Toolbar.tsx +0 -21
- package/src/components/Toolbar/index.ts +0 -5
- package/src/components/Toolbar/useChatToolbarActions.ts +0 -126
- /package/dist/lib/browser/{blueprint-definition-NSJARW5U.mjs.map → blueprint-definition-5FT5JGPY.mjs.map} +0 -0
- /package/dist/lib/browser/{settings-HBF32KV6.mjs.map → settings-NYJGNQ5I.mjs.map} +0 -0
- /package/dist/lib/node-esm/{blueprint-definition-WD2IVMAI.mjs.map → blueprint-definition-XW6QQVLV.mjs.map} +0 -0
- /package/dist/lib/node-esm/{settings-CWP6MTWP.mjs.map → settings-RRHYI5KO.mjs.map} +0 -0
- /package/dist/types/src/components/TemplateEditor/{handlebars-extension.d.ts → extensions/handlebars-extension.d.ts} +0 -0
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import React from 'react';
|
|
6
6
|
|
|
7
7
|
import { Capabilities, contributes, createSurface } from '@dxos/app-framework';
|
|
8
|
-
import { Blueprint } from '@dxos/blueprints';
|
|
8
|
+
import { Blueprint, Prompt } from '@dxos/blueprints';
|
|
9
9
|
import { getSpace } from '@dxos/client/echo';
|
|
10
10
|
import { Sequence } from '@dxos/conductor';
|
|
11
11
|
import { InvocationTraceContainer } from '@dxos/devtools';
|
|
@@ -15,12 +15,11 @@ import { StackItem } from '@dxos/react-ui-stack';
|
|
|
15
15
|
|
|
16
16
|
import {
|
|
17
17
|
AssistantSettings,
|
|
18
|
-
|
|
18
|
+
BlueprintArticle,
|
|
19
19
|
ChatCompanion,
|
|
20
20
|
ChatContainer,
|
|
21
21
|
ChatDialog,
|
|
22
|
-
|
|
23
|
-
SequenceContainer,
|
|
22
|
+
PromptArticle,
|
|
24
23
|
} from '../components';
|
|
25
24
|
import { ASSISTANT_DIALOG, meta } from '../meta';
|
|
26
25
|
import { Assistant } from '../types';
|
|
@@ -41,6 +40,7 @@ export default () =>
|
|
|
41
40
|
Obj.instanceOf(Assistant.Chat, data.subject) && data.variant !== 'assistant-chat',
|
|
42
41
|
component: ({ data, role }) => <ChatContainer role={role} chat={data.subject} />,
|
|
43
42
|
}),
|
|
43
|
+
// TODO(wittjosiah): This is flashing when chat changes.
|
|
44
44
|
createSurface({
|
|
45
45
|
id: `${meta.id}/companion-chat`,
|
|
46
46
|
role: 'article',
|
|
@@ -50,22 +50,18 @@ export default () =>
|
|
|
50
50
|
component: ({ data, role }) => <ChatCompanion role={role} data={data} />,
|
|
51
51
|
}),
|
|
52
52
|
createSurface({
|
|
53
|
-
id: `${meta.id}/
|
|
54
|
-
role: 'article',
|
|
55
|
-
filter: (data): data is { subject: Sequence } => Obj.instanceOf(Sequence, data.subject),
|
|
56
|
-
component: ({ data }) => <SequenceContainer sequence={data.subject} />,
|
|
57
|
-
}),
|
|
58
|
-
createSurface({
|
|
59
|
-
id: `${meta.id}/companion-logs`,
|
|
53
|
+
id: `${meta.id}/companion-invocations`,
|
|
60
54
|
role: 'article',
|
|
61
55
|
filter: (data): data is { companionTo: Sequence } =>
|
|
62
|
-
Obj.instanceOf(Sequence, data.companionTo)
|
|
63
|
-
|
|
64
|
-
component: ({ data
|
|
56
|
+
(Obj.instanceOf(Sequence, data.companionTo) || Obj.instanceOf(Prompt.Prompt, data.companionTo)) &&
|
|
57
|
+
data.subject === 'invocations',
|
|
58
|
+
component: ({ data }) => {
|
|
65
59
|
const space = getSpace(data.companionTo);
|
|
60
|
+
// TODO(wittjosiah): Support invocation filtering for prompts.
|
|
61
|
+
const target = Obj.instanceOf(Prompt.Prompt, data.companionTo) ? undefined : data.companionTo;
|
|
66
62
|
return (
|
|
67
63
|
<StackItem.Content>
|
|
68
|
-
<InvocationTraceContainer space={space} target={
|
|
64
|
+
<InvocationTraceContainer space={space} target={target} detailAxis='block' />
|
|
69
65
|
</StackItem.Content>
|
|
70
66
|
);
|
|
71
67
|
},
|
|
@@ -74,13 +70,13 @@ export default () =>
|
|
|
74
70
|
id: `${meta.id}/blueprint`,
|
|
75
71
|
role: 'article',
|
|
76
72
|
filter: (data): data is { subject: Blueprint.Blueprint } => Obj.instanceOf(Blueprint.Blueprint, data.subject),
|
|
77
|
-
component: ({ data }) => <
|
|
73
|
+
component: ({ data }) => <BlueprintArticle object={data.subject} />,
|
|
78
74
|
}),
|
|
79
75
|
createSurface({
|
|
80
|
-
id: `${meta.id}/prompt
|
|
81
|
-
role: '
|
|
82
|
-
filter: (data): data is { subject:
|
|
83
|
-
component: ({ data }) => <
|
|
76
|
+
id: `${meta.id}/prompt`,
|
|
77
|
+
role: 'article',
|
|
78
|
+
filter: (data): data is { subject: Prompt.Prompt } => Obj.instanceOf(Prompt.Prompt, data.subject),
|
|
79
|
+
component: ({ data }) => <PromptArticle object={data.subject} />,
|
|
84
80
|
}),
|
|
85
81
|
createSurface({
|
|
86
82
|
id: ASSISTANT_DIALOG,
|
|
@@ -2,167 +2,16 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import * as
|
|
6
|
-
import * as Toolkit from '@effect/ai/Toolkit';
|
|
7
|
-
import * as Effect from 'effect/Effect';
|
|
8
|
-
import * as Schema from 'effect/Schema';
|
|
5
|
+
import * as Layer from 'effect/Layer';
|
|
9
6
|
|
|
10
|
-
import { Capabilities, type Capability, type PluginContext, contributes
|
|
11
|
-
import {
|
|
12
|
-
import { WebSearchToolkit } from '@dxos/assistant-
|
|
13
|
-
import { Filter, Obj, Ref, SchemaNotFoundError, Type } from '@dxos/echo';
|
|
14
|
-
import { DatabaseService } from '@dxos/functions';
|
|
15
|
-
import { invariant } from '@dxos/invariant';
|
|
16
|
-
import { ClientCapabilities } from '@dxos/plugin-client';
|
|
17
|
-
import { SpaceCapabilities, getActiveSpace } from '@dxos/plugin-space';
|
|
18
|
-
import { SpaceAction } from '@dxos/plugin-space/types';
|
|
19
|
-
import { DataType } from '@dxos/schema';
|
|
20
|
-
import { trim } from '@dxos/util';
|
|
7
|
+
import { Capabilities, type Capability, type PluginContext, contributes } from '@dxos/app-framework';
|
|
8
|
+
import { GenericToolkit } from '@dxos/assistant';
|
|
9
|
+
import { AssistantToolkit, SystemToolkit, WebSearchToolkit } from '@dxos/assistant-toolkit';
|
|
21
10
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
Tool.make('add-to-context', {
|
|
25
|
-
description: trim`
|
|
26
|
-
Adds the object to the chat context.
|
|
27
|
-
`,
|
|
28
|
-
parameters: {
|
|
29
|
-
id: ArtifactId.annotations({
|
|
30
|
-
description: 'The ID of the document to read.',
|
|
31
|
-
}),
|
|
32
|
-
},
|
|
33
|
-
success: Schema.Void,
|
|
34
|
-
failure: Schema.Never,
|
|
35
|
-
dependencies: [AiContextService, DatabaseService],
|
|
36
|
-
}),
|
|
11
|
+
export default (_context: PluginContext): Capability<any>[] => [
|
|
12
|
+
contributes(Capabilities.Toolkit, GenericToolkit.make(AssistantToolkit.AssistantToolkit, AssistantToolkit.layer())),
|
|
37
13
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
`,
|
|
42
|
-
parameters: {
|
|
43
|
-
// TODO(wittjosiah): Remove this once parameter-less tools are fixed.
|
|
44
|
-
limit: Schema.Number,
|
|
45
|
-
},
|
|
46
|
-
// TODO(dmaretskyi): Effect returns ({ result, encodedResult })
|
|
47
|
-
success: Schema.Any,
|
|
48
|
-
failure: Schema.Never,
|
|
49
|
-
}),
|
|
50
|
-
|
|
51
|
-
Tool.make('add-schema', {
|
|
52
|
-
description: trim`
|
|
53
|
-
Adds a schema to the space.
|
|
54
|
-
The name will be used when displayed to the user.
|
|
55
|
-
The typename must be in the format of "example.com/type/Type".
|
|
56
|
-
`,
|
|
57
|
-
parameters: {
|
|
58
|
-
name: Schema.String,
|
|
59
|
-
typename: Schema.String,
|
|
60
|
-
jsonSchema: Schema.Any,
|
|
61
|
-
},
|
|
62
|
-
success: Schema.Any,
|
|
63
|
-
failure: Schema.Never,
|
|
64
|
-
}),
|
|
65
|
-
|
|
66
|
-
Tool.make('create-record', {
|
|
67
|
-
description: trim`
|
|
68
|
-
Creates a new record and adds it to the current space.
|
|
69
|
-
Get the schema from the get-schemas tool and ensure that the data matches the corresponding schema.
|
|
70
|
-
Note that only record schemas are supported.
|
|
71
|
-
`,
|
|
72
|
-
parameters: {
|
|
73
|
-
typename: Schema.String,
|
|
74
|
-
data: Schema.Any,
|
|
75
|
-
},
|
|
76
|
-
success: Schema.Any,
|
|
77
|
-
failure: Schema.Never,
|
|
78
|
-
}),
|
|
79
|
-
) {
|
|
80
|
-
static layer = (context: PluginContext) =>
|
|
81
|
-
AssistantToolkit.toLayer({
|
|
82
|
-
'add-to-context': Effect.fnUntraced(function* ({ id }) {
|
|
83
|
-
const { binder } = yield* AiContextService;
|
|
84
|
-
const { db } = yield* DatabaseService;
|
|
85
|
-
const ref = Ref.fromDXN(ArtifactId.toDXN(id, db.spaceId));
|
|
86
|
-
yield* Effect.promise(() =>
|
|
87
|
-
binder.bind({
|
|
88
|
-
blueprints: [],
|
|
89
|
-
objects: [ref],
|
|
90
|
-
}),
|
|
91
|
-
);
|
|
92
|
-
}),
|
|
93
|
-
|
|
94
|
-
'get-schemas': () => {
|
|
95
|
-
const space = getActiveSpace(context);
|
|
96
|
-
invariant(space, 'No active space');
|
|
97
|
-
|
|
98
|
-
return Effect.gen(function* () {
|
|
99
|
-
const whitelist = context
|
|
100
|
-
.getCapabilities(ClientCapabilities.SchemaWhiteList)
|
|
101
|
-
.flat()
|
|
102
|
-
.map((schema) => ({
|
|
103
|
-
typename: Type.getTypename(schema),
|
|
104
|
-
jsonSchema: Type.toJsonSchema(schema),
|
|
105
|
-
kind: 'record',
|
|
106
|
-
}));
|
|
107
|
-
|
|
108
|
-
// TODO(burdon): Why ObjectForm (bad name for data capability; UI term)?
|
|
109
|
-
const forms = context.getCapabilities(SpaceCapabilities.ObjectForm).map((form) => ({
|
|
110
|
-
typename: Type.getTypename(form.objectSchema),
|
|
111
|
-
jsonSchema: Type.toJsonSchema(form.objectSchema),
|
|
112
|
-
kind: 'item',
|
|
113
|
-
}));
|
|
114
|
-
|
|
115
|
-
const schemas = [...whitelist, ...forms];
|
|
116
|
-
if (space) {
|
|
117
|
-
const { objects } = yield* DatabaseService.runQuery(Filter.type(DataType.StoredSchema));
|
|
118
|
-
schemas.push(
|
|
119
|
-
...objects.map((object) => ({
|
|
120
|
-
typename: object.typename,
|
|
121
|
-
jsonSchema: object.jsonSchema,
|
|
122
|
-
kind: 'record',
|
|
123
|
-
})),
|
|
124
|
-
);
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
return schemas;
|
|
128
|
-
}).pipe(Effect.provide(DatabaseService.layer(space.db)));
|
|
129
|
-
},
|
|
130
|
-
|
|
131
|
-
'add-schema': ({ name, typename, jsonSchema }) => {
|
|
132
|
-
return Effect.gen(function* () {
|
|
133
|
-
const { dispatch } = context.getCapability(Capabilities.IntentDispatcher);
|
|
134
|
-
const space = getActiveSpace(context);
|
|
135
|
-
invariant(space, 'No active space');
|
|
136
|
-
|
|
137
|
-
const schema = Type.toEffectSchema(jsonSchema).pipe(Type.Obj({ typename, version: '0.1.0' }));
|
|
138
|
-
yield* dispatch(createIntent(SpaceAction.AddSchema, { space, name, typename, schema }));
|
|
139
|
-
}).pipe(Effect.orDie);
|
|
140
|
-
},
|
|
141
|
-
|
|
142
|
-
'create-record': ({ typename, data }) => {
|
|
143
|
-
const { dispatch } = context.getCapability(Capabilities.IntentDispatcher);
|
|
144
|
-
const space = getActiveSpace(context);
|
|
145
|
-
invariant(space, 'No active space');
|
|
146
|
-
|
|
147
|
-
return Effect.gen(function* () {
|
|
148
|
-
const schemas = context.getCapabilities(ClientCapabilities.SchemaWhiteList).flat();
|
|
149
|
-
const { objects } = yield* DatabaseService.runQuery(Filter.type(DataType.StoredSchema));
|
|
150
|
-
schemas.push(...objects.map((object) => Type.toEffectSchema(object.jsonSchema)));
|
|
151
|
-
const schema = schemas.find((schema) => Type.getTypename(schema) === typename);
|
|
152
|
-
if (!schema) {
|
|
153
|
-
throw new SchemaNotFoundError(typename);
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
const object = Obj.make(schema, data);
|
|
157
|
-
yield* dispatch(createIntent(SpaceAction.AddObject, { object, target: space, hidden: true }));
|
|
158
|
-
return object;
|
|
159
|
-
}).pipe(Effect.provide(DatabaseService.layer(space.db)), Effect.orDie);
|
|
160
|
-
},
|
|
161
|
-
});
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
export default (context: PluginContext): Capability<any>[] => [
|
|
165
|
-
contributes(Capabilities.Toolkit, AssistantToolkit),
|
|
166
|
-
contributes(Capabilities.ToolkitHandler, AssistantToolkit.layer(context)),
|
|
167
|
-
contributes(Capabilities.Toolkit, WebSearchToolkit),
|
|
14
|
+
// TODO(burdon): How to manage dependencies across blueprints.
|
|
15
|
+
contributes(Capabilities.Toolkit, GenericToolkit.make(SystemToolkit.SystemToolkit, SystemToolkit.layer())),
|
|
16
|
+
contributes(Capabilities.Toolkit, GenericToolkit.make(WebSearchToolkit, Layer.empty)),
|
|
168
17
|
];
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import React from 'react';
|
|
6
|
+
|
|
7
|
+
import { type SurfaceComponentProps } from '@dxos/app-framework/react';
|
|
8
|
+
import { type Blueprint } from '@dxos/blueprints';
|
|
9
|
+
import { Obj } from '@dxos/echo';
|
|
10
|
+
import { Toolbar } from '@dxos/react-ui';
|
|
11
|
+
import { useAttention } from '@dxos/react-ui-attention';
|
|
12
|
+
import { StackItem } from '@dxos/react-ui-stack';
|
|
13
|
+
|
|
14
|
+
import { TemplateEditor } from './TemplateEditor';
|
|
15
|
+
|
|
16
|
+
export type BlueprintArticleProps = SurfaceComponentProps<Blueprint.Blueprint>;
|
|
17
|
+
|
|
18
|
+
export const BlueprintArticle = ({ object }: BlueprintArticleProps) => {
|
|
19
|
+
const { hasAttention } = useAttention(Obj.getDXN(object).toString());
|
|
20
|
+
|
|
21
|
+
return (
|
|
22
|
+
<StackItem.Content toolbar>
|
|
23
|
+
<Toolbar.Root disabled={!hasAttention} />
|
|
24
|
+
<TemplateEditor id={object.id} template={object.instructions} classNames='container-max-width' />
|
|
25
|
+
</StackItem.Content>
|
|
26
|
+
);
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export default BlueprintArticle;
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import { type Extension, Prec } from '@codemirror/state';
|
|
6
6
|
import { keymap } from '@codemirror/view';
|
|
7
|
-
import {
|
|
7
|
+
import { useAtomValue } from '@effect-atom/atom-react';
|
|
8
8
|
import { createContext } from '@radix-ui/react-context';
|
|
9
9
|
import * as Array from 'effect/Array';
|
|
10
10
|
import * as Option from 'effect/Option';
|
|
@@ -17,11 +17,13 @@ import { type Space, getSpace, useQueue } from '@dxos/react-client/echo';
|
|
|
17
17
|
import { useIdentity } from '@dxos/react-client/halo';
|
|
18
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 MarkdownStreamController } from '@dxos/react-ui-components';
|
|
21
|
+
import { MenuProvider, ToolbarMenu } from '@dxos/react-ui-menu';
|
|
20
22
|
import { mx } from '@dxos/react-ui-theme';
|
|
21
|
-
import {
|
|
23
|
+
import { Message } from '@dxos/types';
|
|
22
24
|
import { isTruthy } from '@dxos/util';
|
|
23
25
|
|
|
24
|
-
import { useReferencesProvider } from '../../hooks';
|
|
26
|
+
import { useChatToolbarActions, useReferencesProvider } from '../../hooks';
|
|
25
27
|
import { meta } from '../../meta';
|
|
26
28
|
import { type AiChatProcessor } from '../../processor';
|
|
27
29
|
import { type Assistant } from '../../types';
|
|
@@ -33,11 +35,7 @@ import {
|
|
|
33
35
|
ChatReferences,
|
|
34
36
|
ChatStatusIndicator,
|
|
35
37
|
} from '../ChatPrompt';
|
|
36
|
-
import {
|
|
37
|
-
type ChatThreadController,
|
|
38
|
-
ChatThread as NaturalChatThread,
|
|
39
|
-
type ChatThreadProps as NaturalChatThreadProps,
|
|
40
|
-
} from '../ChatThread';
|
|
38
|
+
import { ChatThread as NaturalChatThread, type ChatThreadProps as NaturalChatThreadProps } from '../ChatThread';
|
|
41
39
|
|
|
42
40
|
import { type ChatEvent } from './events';
|
|
43
41
|
|
|
@@ -50,9 +48,9 @@ import { type ChatEvent } from './events';
|
|
|
50
48
|
type ChatContextValue = {
|
|
51
49
|
debug?: boolean;
|
|
52
50
|
event: Event<ChatEvent>;
|
|
53
|
-
space
|
|
54
|
-
chat
|
|
55
|
-
messages:
|
|
51
|
+
space?: Space;
|
|
52
|
+
chat?: Assistant.Chat;
|
|
53
|
+
messages: Message.Message[];
|
|
56
54
|
processor: AiChatProcessor;
|
|
57
55
|
};
|
|
58
56
|
|
|
@@ -62,27 +60,23 @@ export const [ChatContextProvider, useChatContext] = createContext<ChatContextVa
|
|
|
62
60
|
// Root
|
|
63
61
|
//
|
|
64
62
|
|
|
65
|
-
type ChatRootProps =
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
}
|
|
70
|
-
>
|
|
63
|
+
type ChatRootProps = PropsWithChildren<
|
|
64
|
+
Pick<ChatContextValue, 'space' | 'chat' | 'processor'> & {
|
|
65
|
+
onEvent?: (event: ChatEvent) => void;
|
|
66
|
+
}
|
|
71
67
|
>;
|
|
72
68
|
|
|
73
|
-
const ChatRoot = ({
|
|
69
|
+
const ChatRoot = ({ children, chat, processor, onEvent, ...props }: ChatRootProps) => {
|
|
74
70
|
const [debug, setDebug] = useState(false);
|
|
75
|
-
const
|
|
76
|
-
|
|
77
|
-
// Messages.
|
|
78
|
-
const queue = useQueue<DataType.Message>(chat?.queue.dxn);
|
|
79
|
-
const pending = useRxValue(processor.messages);
|
|
80
|
-
const streaming = useRxValue(processor.streaming);
|
|
71
|
+
const pending = useAtomValue(processor.messages);
|
|
72
|
+
const streaming = useAtomValue(processor.streaming);
|
|
81
73
|
const lastPrompt = useRef<string | undefined>(undefined);
|
|
82
74
|
|
|
75
|
+
// Messages.
|
|
76
|
+
const queue = useQueue<Message.Message>(chat?.queue.dxn);
|
|
83
77
|
const messages = useMemo(() => {
|
|
84
|
-
const queueMessages = queue?.objects?.filter(Obj.instanceOf(
|
|
85
|
-
return Array.dedupeWith([...queueMessages, ...pending], (a, b) => a
|
|
78
|
+
const queueMessages = queue?.objects?.filter(Obj.instanceOf(Message.Message)) ?? [];
|
|
79
|
+
return Array.dedupeWith([...queueMessages, ...pending], ({ id: a }, { id: b }) => a === b);
|
|
86
80
|
}, [queue?.objects, pending]);
|
|
87
81
|
|
|
88
82
|
// Events.
|
|
@@ -120,37 +114,45 @@ const ChatRoot = ({ classNames, children, chat, processor, onEvent, ...props }:
|
|
|
120
114
|
}
|
|
121
115
|
break;
|
|
122
116
|
}
|
|
123
|
-
|
|
124
|
-
default: {
|
|
125
|
-
onEvent?.(ev);
|
|
126
|
-
}
|
|
127
117
|
}
|
|
118
|
+
|
|
119
|
+
onEvent?.(ev);
|
|
128
120
|
});
|
|
129
121
|
}, [event, processor, streaming, onEvent]);
|
|
130
122
|
|
|
131
|
-
|
|
132
|
-
return null;
|
|
133
|
-
}
|
|
123
|
+
const space = props.space ?? getSpace(chat);
|
|
134
124
|
|
|
135
125
|
return (
|
|
136
126
|
<ChatContextProvider
|
|
137
127
|
debug={debug}
|
|
138
128
|
event={event}
|
|
139
|
-
chat={chat}
|
|
140
129
|
space={space}
|
|
130
|
+
chat={chat}
|
|
141
131
|
messages={messages}
|
|
142
132
|
processor={processor}
|
|
143
133
|
{...props}
|
|
144
134
|
>
|
|
145
|
-
|
|
146
|
-
{children}
|
|
147
|
-
</div>
|
|
135
|
+
{children}
|
|
148
136
|
</ChatContextProvider>
|
|
149
137
|
);
|
|
150
138
|
};
|
|
151
139
|
|
|
152
140
|
ChatRoot.displayName = 'Chat.Root';
|
|
153
141
|
|
|
142
|
+
//
|
|
143
|
+
// Viewport
|
|
144
|
+
//
|
|
145
|
+
|
|
146
|
+
type ChatViewportProps = ThemedClassName<PropsWithChildren>;
|
|
147
|
+
|
|
148
|
+
const ChatViewport = ({ classNames, children }: ChatViewportProps) => {
|
|
149
|
+
return (
|
|
150
|
+
<div role='none' className={mx('flex flex-col bs-full is-full', classNames)}>
|
|
151
|
+
{children}
|
|
152
|
+
</div>
|
|
153
|
+
);
|
|
154
|
+
};
|
|
155
|
+
|
|
154
156
|
//
|
|
155
157
|
// Prompt
|
|
156
158
|
//
|
|
@@ -181,11 +183,11 @@ const ChatPrompt = ({
|
|
|
181
183
|
onOnlineChange,
|
|
182
184
|
}: ChatPromptProps) => {
|
|
183
185
|
const { t } = useTranslation(meta.id);
|
|
184
|
-
const { space,
|
|
186
|
+
const { space, processor, event } = useChatContext(ChatPrompt.displayName);
|
|
185
187
|
|
|
186
|
-
const error =
|
|
187
|
-
const streaming =
|
|
188
|
-
const active =
|
|
188
|
+
const error = useAtomValue(processor.error).pipe(Option.getOrUndefined);
|
|
189
|
+
const streaming = useAtomValue(processor.streaming);
|
|
190
|
+
const active = useAtomValue(processor.active);
|
|
189
191
|
const activeRef = useDynamicRef(active);
|
|
190
192
|
|
|
191
193
|
const editorRef = useRef<ChatEditorController>(null);
|
|
@@ -227,29 +229,49 @@ const ChatPrompt = ({
|
|
|
227
229
|
keymap.of(
|
|
228
230
|
[
|
|
229
231
|
{
|
|
230
|
-
key: '
|
|
232
|
+
key: 'Mod-d',
|
|
231
233
|
preventDefault: true,
|
|
232
234
|
run: () => {
|
|
233
235
|
event.emit({ type: 'toggle-debug' });
|
|
234
236
|
return true;
|
|
235
237
|
},
|
|
236
238
|
},
|
|
237
|
-
|
|
238
|
-
key: '
|
|
239
|
+
{
|
|
240
|
+
key: 'Mod-ArrowUp',
|
|
239
241
|
preventDefault: true,
|
|
240
242
|
run: () => {
|
|
241
|
-
event.emit({ type: '
|
|
243
|
+
event.emit({ type: 'nav-previous' });
|
|
242
244
|
return true;
|
|
243
245
|
},
|
|
244
246
|
},
|
|
245
|
-
|
|
246
|
-
key: '
|
|
247
|
+
{
|
|
248
|
+
key: 'Mod-ArrowDown',
|
|
247
249
|
preventDefault: true,
|
|
248
250
|
run: () => {
|
|
249
|
-
event.emit({ type: '
|
|
251
|
+
event.emit({ type: 'nav-next' });
|
|
250
252
|
return true;
|
|
251
253
|
},
|
|
252
254
|
},
|
|
255
|
+
...(expandable
|
|
256
|
+
? [
|
|
257
|
+
{
|
|
258
|
+
key: 'Shift-Mod-ArrowUp',
|
|
259
|
+
preventDefault: true,
|
|
260
|
+
run: () => {
|
|
261
|
+
event.emit({ type: 'thread-open' });
|
|
262
|
+
return true;
|
|
263
|
+
},
|
|
264
|
+
},
|
|
265
|
+
{
|
|
266
|
+
key: 'Shift-Mod-ArrowDown',
|
|
267
|
+
preventDefault: true,
|
|
268
|
+
run: () => {
|
|
269
|
+
event.emit({ type: 'thread-close' });
|
|
270
|
+
return true;
|
|
271
|
+
},
|
|
272
|
+
},
|
|
273
|
+
]
|
|
274
|
+
: []),
|
|
253
275
|
].filter(isTruthy),
|
|
254
276
|
),
|
|
255
277
|
),
|
|
@@ -298,8 +320,8 @@ const ChatPrompt = ({
|
|
|
298
320
|
/>
|
|
299
321
|
</div>
|
|
300
322
|
|
|
301
|
-
{settings && (
|
|
302
|
-
<div role='none' className='flex pbs-2 items-center'>
|
|
323
|
+
{space && settings && (
|
|
324
|
+
<div role='none' className='flex pbs-2 items-center overflow-hidden'>
|
|
303
325
|
<ChatOptions
|
|
304
326
|
space={space}
|
|
305
327
|
blueprintRegistry={processor.blueprintRegistry}
|
|
@@ -309,7 +331,7 @@ const ChatPrompt = ({
|
|
|
309
331
|
onPresetChange={onPresetChange}
|
|
310
332
|
/>
|
|
311
333
|
|
|
312
|
-
<div role='none' className='
|
|
334
|
+
<div role='none' className='flex grow overflow-x-auto scrollbar-none'>
|
|
313
335
|
<ChatReferences space={space} context={processor.context} />
|
|
314
336
|
</div>
|
|
315
337
|
|
|
@@ -320,10 +342,11 @@ const ChatPrompt = ({
|
|
|
320
342
|
processing={streaming}
|
|
321
343
|
onEvent={handleEvent}
|
|
322
344
|
>
|
|
345
|
+
{/* TODO(burdon): Move switch into dialog. */}
|
|
323
346
|
{online !== undefined && (
|
|
324
347
|
<Input.Root>
|
|
325
348
|
<Input.Label srOnly>{t('online switch label')}</Input.Label>
|
|
326
|
-
<Input.Switch classNames='
|
|
349
|
+
<Input.Switch classNames='mli-2' checked={online} onCheckedChange={onOnlineChange} />
|
|
327
350
|
</Input.Root>
|
|
328
351
|
)}
|
|
329
352
|
</ChatActions>
|
|
@@ -342,17 +365,23 @@ ChatPrompt.displayName = 'Chat.Prompt';
|
|
|
342
365
|
type ChatThreadProps = Omit<NaturalChatThreadProps, 'identity' | 'messages' | 'tools'>;
|
|
343
366
|
|
|
344
367
|
const ChatThread = (props: ChatThreadProps) => {
|
|
345
|
-
const { event, messages, processor } = useChatContext(ChatThread.displayName);
|
|
368
|
+
const { debug, event, messages, processor } = useChatContext(ChatThread.displayName);
|
|
346
369
|
const identity = useIdentity();
|
|
347
|
-
const error =
|
|
370
|
+
const error = useAtomValue(processor.error).pipe(Option.getOrUndefined);
|
|
348
371
|
|
|
349
|
-
const
|
|
372
|
+
const controllerRef = useRef<MarkdownStreamController | null>(null);
|
|
350
373
|
useEffect(() => {
|
|
351
374
|
return event.on((event) => {
|
|
352
375
|
switch (event.type) {
|
|
353
376
|
case 'submit':
|
|
354
377
|
case 'scroll-to-bottom':
|
|
355
|
-
|
|
378
|
+
controllerRef.current?.scrollToBottom();
|
|
379
|
+
break;
|
|
380
|
+
case 'nav-previous':
|
|
381
|
+
controllerRef.current?.navigatePrevious();
|
|
382
|
+
break;
|
|
383
|
+
case 'nav-next':
|
|
384
|
+
controllerRef.current?.navigateNext();
|
|
356
385
|
break;
|
|
357
386
|
}
|
|
358
387
|
});
|
|
@@ -372,25 +401,50 @@ const ChatThread = (props: ChatThreadProps) => {
|
|
|
372
401
|
return (
|
|
373
402
|
<NaturalChatThread
|
|
374
403
|
{...props}
|
|
375
|
-
ref={scrollerRef}
|
|
376
404
|
identity={identity}
|
|
377
405
|
messages={messages}
|
|
378
406
|
error={error}
|
|
407
|
+
debug={debug}
|
|
379
408
|
onEvent={handleEvent}
|
|
409
|
+
ref={controllerRef}
|
|
380
410
|
/>
|
|
381
411
|
);
|
|
382
412
|
};
|
|
383
413
|
|
|
384
414
|
ChatThread.displayName = 'Chat.Thread';
|
|
385
415
|
|
|
416
|
+
//
|
|
417
|
+
// Toolbar
|
|
418
|
+
//
|
|
419
|
+
|
|
420
|
+
type ChatToolbarProps = ThemedClassName<{ companionTo?: Obj.Any }>;
|
|
421
|
+
|
|
422
|
+
const ChatToolbar = ({ classNames, companionTo }: ChatToolbarProps) => {
|
|
423
|
+
const { chat } = useChatContext(ChatToolbar.displayName);
|
|
424
|
+
const menu = useChatToolbarActions({ chat, companionTo });
|
|
425
|
+
|
|
426
|
+
return (
|
|
427
|
+
<MenuProvider
|
|
428
|
+
{...menu}
|
|
429
|
+
attendableId={companionTo ? Obj.getDXN(companionTo).toString() : chat ? Obj.getDXN(chat).toString() : ''}
|
|
430
|
+
>
|
|
431
|
+
<ToolbarMenu classNames={classNames} textBlockWidth />
|
|
432
|
+
</MenuProvider>
|
|
433
|
+
);
|
|
434
|
+
};
|
|
435
|
+
|
|
436
|
+
ChatToolbar.displayName = 'Chat.Toolbar';
|
|
437
|
+
|
|
386
438
|
//
|
|
387
439
|
// Chat
|
|
388
440
|
//
|
|
389
441
|
|
|
390
442
|
export const Chat = {
|
|
391
443
|
Root: ChatRoot,
|
|
444
|
+
Viewport: ChatViewport,
|
|
392
445
|
Prompt: ChatPrompt,
|
|
393
446
|
Thread: ChatThread,
|
|
447
|
+
Toolbar: ChatToolbar,
|
|
394
448
|
};
|
|
395
449
|
|
|
396
|
-
export type { ChatRootProps, ChatThreadProps, ChatPromptProps, ChatEvent };
|
|
450
|
+
export type { ChatRootProps, ChatViewportProps, ChatThreadProps, ChatPromptProps, ChatToolbarProps, ChatEvent };
|