@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
|
@@ -1,12 +1,96 @@
|
|
|
1
|
+
import {
|
|
2
|
+
AiChatProcessor,
|
|
3
|
+
AiServicePresets
|
|
4
|
+
} from "./chunk-AO6XHMQ7.mjs";
|
|
5
|
+
import {
|
|
6
|
+
AssistantAction_exports,
|
|
7
|
+
Assistant_exports,
|
|
8
|
+
LLM_PROVIDERS,
|
|
9
|
+
ServiceType
|
|
10
|
+
} from "./chunk-BNTPFZ7O.mjs";
|
|
1
11
|
import {
|
|
2
12
|
meta
|
|
3
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-WBG5PTSX.mjs";
|
|
4
14
|
|
|
5
|
-
// src/
|
|
15
|
+
// src/components/AssistantSettings/AssistantSettings.tsx
|
|
6
16
|
import { useSignals as _useSignals } from "@preact-signals/safe-react/tracking";
|
|
17
|
+
import React from "react";
|
|
18
|
+
import { DEFAULT_EDGE_MODELS, DEFAULT_OLLAMA_MODELS } from "@dxos/ai";
|
|
19
|
+
import { Input, Select, useTranslation } from "@dxos/react-ui";
|
|
20
|
+
import { ControlGroup, ControlItemInput, ControlPage, ControlSection } from "@dxos/react-ui-form";
|
|
21
|
+
var DEFAULT_VALUE = "__default";
|
|
22
|
+
var LLM_PROVIDER_LABELS = {
|
|
23
|
+
edge: "DXOS",
|
|
24
|
+
ollama: "Ollama",
|
|
25
|
+
lmstudio: "LM Studio"
|
|
26
|
+
};
|
|
27
|
+
var AssistantSettings = ({ settings }) => {
|
|
28
|
+
var _effect = _useSignals();
|
|
29
|
+
try {
|
|
30
|
+
const { t } = useTranslation(meta.id);
|
|
31
|
+
return /* @__PURE__ */ React.createElement(ControlPage, null, /* @__PURE__ */ React.createElement(ControlSection, {
|
|
32
|
+
title: t("settings title", {
|
|
33
|
+
ns: meta.id
|
|
34
|
+
})
|
|
35
|
+
}, /* @__PURE__ */ React.createElement(ControlGroup, null, /* @__PURE__ */ React.createElement(ControlItemInput, {
|
|
36
|
+
title: t("settings custom prompts label")
|
|
37
|
+
}, /* @__PURE__ */ React.createElement(Input.Switch, {
|
|
38
|
+
checked: !!settings.customPrompts,
|
|
39
|
+
onCheckedChange: (checked) => settings.customPrompts = checked
|
|
40
|
+
})), /* @__PURE__ */ React.createElement(ControlItemInput, {
|
|
41
|
+
title: t("settings llm provider label")
|
|
42
|
+
}, /* @__PURE__ */ React.createElement(Select.Root, {
|
|
43
|
+
value: settings.llmProvider ?? "edge",
|
|
44
|
+
onValueChange: (value) => {
|
|
45
|
+
settings.llmProvider = value === DEFAULT_VALUE ? void 0 : value;
|
|
46
|
+
}
|
|
47
|
+
}, /* @__PURE__ */ React.createElement(Select.TriggerButton, {
|
|
48
|
+
placeholder: t("settings llm provider label")
|
|
49
|
+
}), /* @__PURE__ */ React.createElement(Select.Portal, null, /* @__PURE__ */ React.createElement(Select.Content, null, /* @__PURE__ */ React.createElement(Select.Viewport, null, /* @__PURE__ */ React.createElement(Select.Option, {
|
|
50
|
+
value: DEFAULT_VALUE
|
|
51
|
+
}, t("settings default label")), LLM_PROVIDERS.map((model) => /* @__PURE__ */ React.createElement(Select.Option, {
|
|
52
|
+
key: model,
|
|
53
|
+
value: model
|
|
54
|
+
}, LLM_PROVIDER_LABELS[model]))), /* @__PURE__ */ React.createElement(Select.Arrow, null))))), /* @__PURE__ */ React.createElement(ControlItemInput, {
|
|
55
|
+
title: t("settings edge llm model label")
|
|
56
|
+
}, /* @__PURE__ */ React.createElement(Select.Root, {
|
|
57
|
+
value: settings.edgeModel ?? DEFAULT_VALUE,
|
|
58
|
+
onValueChange: (value) => {
|
|
59
|
+
settings.edgeModel = value === DEFAULT_VALUE ? void 0 : value;
|
|
60
|
+
}
|
|
61
|
+
}, /* @__PURE__ */ React.createElement(Select.TriggerButton, {
|
|
62
|
+
placeholder: t("settings default llm model label")
|
|
63
|
+
}), /* @__PURE__ */ React.createElement(Select.Portal, null, /* @__PURE__ */ React.createElement(Select.Content, null, /* @__PURE__ */ React.createElement(Select.Viewport, null, /* @__PURE__ */ React.createElement(Select.Option, {
|
|
64
|
+
value: DEFAULT_VALUE
|
|
65
|
+
}, t("settings default label")), DEFAULT_EDGE_MODELS.map((model) => /* @__PURE__ */ React.createElement(Select.Option, {
|
|
66
|
+
key: model,
|
|
67
|
+
value: model
|
|
68
|
+
}, model))), /* @__PURE__ */ React.createElement(Select.Arrow, null))))), /* @__PURE__ */ React.createElement(ControlItemInput, {
|
|
69
|
+
title: t("settings ollama llm model label")
|
|
70
|
+
}, /* @__PURE__ */ React.createElement(Select.Root, {
|
|
71
|
+
value: settings.ollamaModel ?? DEFAULT_VALUE,
|
|
72
|
+
onValueChange: (value) => {
|
|
73
|
+
settings.ollamaModel = value === DEFAULT_VALUE ? void 0 : value;
|
|
74
|
+
}
|
|
75
|
+
}, /* @__PURE__ */ React.createElement(Select.TriggerButton, {
|
|
76
|
+
placeholder: t("settings default llm model label")
|
|
77
|
+
}), /* @__PURE__ */ React.createElement(Select.Portal, null, /* @__PURE__ */ React.createElement(Select.Content, null, /* @__PURE__ */ React.createElement(Select.Viewport, null, /* @__PURE__ */ React.createElement(Select.Option, {
|
|
78
|
+
value: DEFAULT_VALUE
|
|
79
|
+
}, t("settings default label")), DEFAULT_OLLAMA_MODELS.map((model) => /* @__PURE__ */ React.createElement(Select.Option, {
|
|
80
|
+
key: model,
|
|
81
|
+
value: model
|
|
82
|
+
}, model))), /* @__PURE__ */ React.createElement(Select.Arrow, null))))))));
|
|
83
|
+
} finally {
|
|
84
|
+
_effect.f();
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
// src/hooks/useBlueprintRegistry.ts
|
|
89
|
+
import { useSignals as _useSignals2 } from "@preact-signals/safe-react/tracking";
|
|
7
90
|
import { useSignalEffect } from "@preact/signals-react";
|
|
8
91
|
import { useCallback, useMemo, useState } from "react";
|
|
9
|
-
import { Capabilities
|
|
92
|
+
import { Capabilities } from "@dxos/app-framework";
|
|
93
|
+
import { useCapabilities } from "@dxos/app-framework/react";
|
|
10
94
|
import { Blueprint } from "@dxos/blueprints";
|
|
11
95
|
import { Filter, Obj, Ref } from "@dxos/echo";
|
|
12
96
|
import { useQuery } from "@dxos/react-client/echo";
|
|
@@ -35,7 +119,7 @@ var useBlueprints = ({ blueprintRegistry, space }) => {
|
|
|
35
119
|
]);
|
|
36
120
|
};
|
|
37
121
|
var useActiveBlueprints = ({ context }) => {
|
|
38
|
-
var _effect =
|
|
122
|
+
var _effect = _useSignals2();
|
|
39
123
|
try {
|
|
40
124
|
const [active, setActive] = useState(/* @__PURE__ */ new Map());
|
|
41
125
|
useSignalEffect(() => {
|
|
@@ -91,303 +175,42 @@ var useBlueprintHandlers = ({ space, context, blueprintRegistry }) => {
|
|
|
91
175
|
};
|
|
92
176
|
|
|
93
177
|
// src/hooks/useChatProcessor.ts
|
|
94
|
-
import { RegistryContext } from "@effect-
|
|
178
|
+
import { RegistryContext } from "@effect-atom/atom-react";
|
|
95
179
|
import { useContext, useMemo as useMemo2, useState as useState2 } from "react";
|
|
96
180
|
import { AiConversation } from "@dxos/assistant";
|
|
97
|
-
import { log as log2 } from "@dxos/log";
|
|
98
|
-
import { useAsyncEffect } from "@dxos/react-ui";
|
|
99
|
-
|
|
100
|
-
// src/processor/presets.ts
|
|
101
|
-
import * as Schema from "effect/Schema";
|
|
102
|
-
var ModelProviders = [
|
|
103
|
-
"dxos-local",
|
|
104
|
-
"dxos-remote",
|
|
105
|
-
"lm-studio"
|
|
106
|
-
];
|
|
107
|
-
var ModelProvider = Schema.Literal(...ModelProviders);
|
|
108
|
-
var createModelLabel = (model) => {
|
|
109
|
-
const parts = model.split("/");
|
|
110
|
-
return parts[parts.length - 1];
|
|
111
|
-
};
|
|
112
|
-
var AiServicePresets = [
|
|
113
|
-
{
|
|
114
|
-
provider: "dxos-remote",
|
|
115
|
-
model: "@anthropic/claude-opus-4-0"
|
|
116
|
-
},
|
|
117
|
-
{
|
|
118
|
-
provider: "dxos-remote",
|
|
119
|
-
model: "@anthropic/claude-sonnet-4-0"
|
|
120
|
-
},
|
|
121
|
-
{
|
|
122
|
-
provider: "dxos-remote",
|
|
123
|
-
model: "@anthropic/claude-3-5-haiku-20241022"
|
|
124
|
-
},
|
|
125
|
-
{
|
|
126
|
-
provider: "lm-studio",
|
|
127
|
-
model: "@google/gemma-3-27b"
|
|
128
|
-
},
|
|
129
|
-
{
|
|
130
|
-
provider: "lm-studio",
|
|
131
|
-
model: "@mlx-community/llama-3.2-3b-instruct"
|
|
132
|
-
},
|
|
133
|
-
{
|
|
134
|
-
model: "deepseek-r1:latest",
|
|
135
|
-
provider: "dxos-local"
|
|
136
|
-
}
|
|
137
|
-
].map(({ model, provider }, i) => ({
|
|
138
|
-
id: `preset-${i}`,
|
|
139
|
-
provider,
|
|
140
|
-
model,
|
|
141
|
-
label: createModelLabel(model)
|
|
142
|
-
}));
|
|
143
|
-
|
|
144
|
-
// src/processor/processor.ts
|
|
145
|
-
import { Registry, Rx } from "@effect-rx/rx-react";
|
|
146
|
-
import * as Cause from "effect/Cause";
|
|
147
|
-
import * as Effect from "effect/Effect";
|
|
148
|
-
import * as Exit from "effect/Exit";
|
|
149
|
-
import * as Fiber from "effect/Fiber";
|
|
150
|
-
import * as Option from "effect/Option";
|
|
151
|
-
import * as Runtime from "effect/Runtime";
|
|
152
|
-
import { AiService, DEFAULT_EDGE_MODEL } from "@dxos/ai";
|
|
153
|
-
import { AiSession, ArtifactDiffResolver, GenerationObserver, createSystemPrompt } from "@dxos/assistant";
|
|
154
|
-
import { Obj as Obj2 } from "@dxos/echo";
|
|
155
|
-
import { throwCause } from "@dxos/effect";
|
|
156
181
|
import { log } from "@dxos/log";
|
|
157
|
-
import {
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
if (key in obj) {
|
|
161
|
-
Object.defineProperty(obj, key, {
|
|
162
|
-
value,
|
|
163
|
-
enumerable: true,
|
|
164
|
-
configurable: true,
|
|
165
|
-
writable: true
|
|
166
|
-
});
|
|
167
|
-
} else {
|
|
168
|
-
obj[key] = value;
|
|
169
|
-
}
|
|
170
|
-
return obj;
|
|
171
|
-
}
|
|
172
|
-
var __dxlog_file = "/__w/dxos/dxos/packages/plugins/plugin-assistant/src/processor/processor.ts";
|
|
173
|
-
var defaultOptions = {
|
|
174
|
-
model: DEFAULT_EDGE_MODEL
|
|
175
|
-
};
|
|
176
|
-
var AiChatProcessor = class {
|
|
177
|
-
get context() {
|
|
178
|
-
return this._conversation.context;
|
|
179
|
-
}
|
|
180
|
-
get conversation() {
|
|
181
|
-
return this._conversation;
|
|
182
|
-
}
|
|
183
|
-
get blueprintRegistry() {
|
|
184
|
-
return this._options.blueprintRegistry;
|
|
185
|
-
}
|
|
186
|
-
/**
|
|
187
|
-
* Initiates a new request.
|
|
188
|
-
*/
|
|
189
|
-
async request(requestParam) {
|
|
190
|
-
if (this._fiber) {
|
|
191
|
-
await this.cancel();
|
|
192
|
-
}
|
|
193
|
-
try {
|
|
194
|
-
this._lastRequest = requestParam;
|
|
195
|
-
this._rx.set(this.error, Option.none());
|
|
196
|
-
this._rx.set(this.active, true);
|
|
197
|
-
const request = this._conversation.createRequest({
|
|
198
|
-
system: this._options.system,
|
|
199
|
-
prompt: requestParam.message,
|
|
200
|
-
observer: this._observer
|
|
201
|
-
});
|
|
202
|
-
const runtime2 = await this._services();
|
|
203
|
-
this._fiber = request.pipe(
|
|
204
|
-
Effect.provide(AiService.model(this._options.model ?? DEFAULT_EDGE_MODEL)),
|
|
205
|
-
// TODO(dmaretskyi): Move ArtifactDiffResolver upstream.
|
|
206
|
-
Effect.provideService(ArtifactDiffResolver, this._artifactDiffResolver),
|
|
207
|
-
Effect.asVoid,
|
|
208
|
-
Runtime.runFork(runtime2)
|
|
209
|
-
);
|
|
210
|
-
const response = await this._fiber.pipe(Fiber.join, Effect.runPromiseExit);
|
|
211
|
-
if (!Exit.isSuccess(response) && !Cause.isInterruptedOnly(response.cause)) {
|
|
212
|
-
throwCause(response.cause);
|
|
213
|
-
}
|
|
214
|
-
this._rx.set(this.error, Option.none());
|
|
215
|
-
this._lastRequest = void 0;
|
|
216
|
-
this._fiber = void 0;
|
|
217
|
-
} catch (error) {
|
|
218
|
-
log.error("request failed", {
|
|
219
|
-
error
|
|
220
|
-
}, {
|
|
221
|
-
F: __dxlog_file,
|
|
222
|
-
L: 187,
|
|
223
|
-
S: this,
|
|
224
|
-
C: (f, a) => f(...a)
|
|
225
|
-
});
|
|
226
|
-
this._rx.set(this.error, Option.some(new Error("AI service error", {
|
|
227
|
-
cause: error
|
|
228
|
-
})));
|
|
229
|
-
} finally {
|
|
230
|
-
this._fiber = void 0;
|
|
231
|
-
this._rx.set(this.active, false);
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
/**
|
|
235
|
-
* Cancels the current request.
|
|
236
|
-
*/
|
|
237
|
-
async cancel() {
|
|
238
|
-
await Effect.runPromise(Effect.gen(this, function* () {
|
|
239
|
-
if (this._fiber) {
|
|
240
|
-
yield* this._fiber.pipe(Fiber.interrupt);
|
|
241
|
-
}
|
|
242
|
-
}));
|
|
243
|
-
this._fiber = void 0;
|
|
244
|
-
this._rx.set(this.active, false);
|
|
245
|
-
}
|
|
246
|
-
/**
|
|
247
|
-
* Retry last failed request.
|
|
248
|
-
*/
|
|
249
|
-
async retry() {
|
|
250
|
-
if (this._lastRequest) {
|
|
251
|
-
return this.request(this._lastRequest);
|
|
252
|
-
}
|
|
253
|
-
}
|
|
254
|
-
/**
|
|
255
|
-
* Update the current chat's name.
|
|
256
|
-
*/
|
|
257
|
-
async updateName(chat) {
|
|
258
|
-
const runtime2 = await this._services();
|
|
259
|
-
const system = trim`
|
|
260
|
-
It is extremely important that you respond only with the title and nothing else.
|
|
261
|
-
If you cannot do this effectively respond with "New Chat".
|
|
262
|
-
`;
|
|
263
|
-
const history = await this._conversation.getHistory();
|
|
264
|
-
const fiber = Effect.gen(this, function* () {
|
|
265
|
-
const session = new AiSession();
|
|
266
|
-
return yield* session.run({
|
|
267
|
-
system,
|
|
268
|
-
prompt: "Suggest a name for this chat",
|
|
269
|
-
history
|
|
270
|
-
});
|
|
271
|
-
}).pipe(
|
|
272
|
-
// TODO(burdon): Use simpler model.
|
|
273
|
-
Effect.provide(AiService.model(this._options.model ?? DEFAULT_EDGE_MODEL)),
|
|
274
|
-
Effect.tap((messages) => {
|
|
275
|
-
const message = messages.find((message2) => message2.sender.role === "assistant");
|
|
276
|
-
const title = message?.blocks.find((b) => b._tag === "text")?.text;
|
|
277
|
-
if (title) {
|
|
278
|
-
chat.name = title;
|
|
279
|
-
}
|
|
280
|
-
}),
|
|
281
|
-
Runtime.runFork(runtime2)
|
|
282
|
-
);
|
|
283
|
-
const response = await fiber.pipe(Fiber.join, Effect.runPromiseExit);
|
|
284
|
-
if (!Exit.isSuccess(response)) {
|
|
285
|
-
throwCause(response.cause);
|
|
286
|
-
}
|
|
287
|
-
}
|
|
288
|
-
constructor(_conversation, _services, _options = defaultOptions) {
|
|
289
|
-
_define_property(this, "_conversation", void 0);
|
|
290
|
-
_define_property(this, "_services", void 0);
|
|
291
|
-
_define_property(this, "_options", void 0);
|
|
292
|
-
_define_property(this, "_rx", void 0);
|
|
293
|
-
_define_property(this, "_observer", void 0);
|
|
294
|
-
_define_property(this, "_fiber", void 0);
|
|
295
|
-
_define_property(this, "_lastRequest", void 0);
|
|
296
|
-
_define_property(this, "_pending", void 0);
|
|
297
|
-
_define_property(this, "_streaming", void 0);
|
|
298
|
-
_define_property(this, "streaming", void 0);
|
|
299
|
-
_define_property(this, "active", void 0);
|
|
300
|
-
_define_property(this, "messages", void 0);
|
|
301
|
-
_define_property(this, "error", void 0);
|
|
302
|
-
_define_property(this, "_artifactDiffResolver", void 0);
|
|
303
|
-
_define_property(this, "_onMessage", void 0);
|
|
304
|
-
_define_property(this, "_onBlock", void 0);
|
|
305
|
-
this._conversation = _conversation;
|
|
306
|
-
this._services = _services;
|
|
307
|
-
this._options = _options;
|
|
308
|
-
this._pending = Rx.make([]);
|
|
309
|
-
this._streaming = Rx.make(Option.none());
|
|
310
|
-
this.streaming = Rx.make((get) => Option.isSome(get(this._streaming)));
|
|
311
|
-
this.active = Rx.make(false);
|
|
312
|
-
this.messages = Rx.make((get) => Option.match(get(this._streaming), {
|
|
313
|
-
onNone: () => get(this._pending),
|
|
314
|
-
onSome: (streaming) => [
|
|
315
|
-
...get(this._pending),
|
|
316
|
-
streaming
|
|
317
|
-
]
|
|
318
|
-
}));
|
|
319
|
-
this.error = Rx.make(Option.none());
|
|
320
|
-
this._artifactDiffResolver = {
|
|
321
|
-
resolve: async (_artifacts) => {
|
|
322
|
-
const versions = /* @__PURE__ */ new Map();
|
|
323
|
-
return versions;
|
|
324
|
-
}
|
|
325
|
-
};
|
|
326
|
-
this._onMessage = Effect.fn((function* (message) {
|
|
327
|
-
this._rx.set(this._streaming, Option.none());
|
|
328
|
-
this._rx.update(this._pending, (pending) => [
|
|
329
|
-
...pending,
|
|
330
|
-
message
|
|
331
|
-
]);
|
|
332
|
-
}).bind(this));
|
|
333
|
-
this._onBlock = Effect.fn((function* (block) {
|
|
334
|
-
this._rx.update(this._streaming, (streaming) => {
|
|
335
|
-
const blocks = streaming.pipe(Option.map((streaming2) => streaming2.blocks.filter((b) => !b.pending)), Option.getOrElse(() => []));
|
|
336
|
-
return Option.some(Obj2.make(DataType.Message, {
|
|
337
|
-
created: (/* @__PURE__ */ new Date()).toISOString(),
|
|
338
|
-
sender: {
|
|
339
|
-
role: "assistant"
|
|
340
|
-
},
|
|
341
|
-
blocks: [
|
|
342
|
-
...blocks,
|
|
343
|
-
block
|
|
344
|
-
]
|
|
345
|
-
}));
|
|
346
|
-
});
|
|
347
|
-
}).bind(this));
|
|
348
|
-
this._rx = this._options.observableRegistry ?? Registry.make();
|
|
349
|
-
this._observer = GenerationObserver.make({
|
|
350
|
-
onBlock: this._onBlock,
|
|
351
|
-
onMessage: this._onMessage
|
|
352
|
-
});
|
|
353
|
-
if (this._options.model && !this._options.system) {
|
|
354
|
-
const capabilities = this._options.modelRegistry?.getCapabilities(this._options.model) ?? {};
|
|
355
|
-
this._options.system = createSystemPrompt(capabilities);
|
|
356
|
-
}
|
|
357
|
-
}
|
|
358
|
-
};
|
|
359
|
-
|
|
360
|
-
// src/hooks/useChatProcessor.ts
|
|
361
|
-
var __dxlog_file2 = "/__w/dxos/dxos/packages/plugins/plugin-assistant/src/hooks/useChatProcessor.ts";
|
|
362
|
-
var useChatProcessor = ({ chat, preset, services, blueprintRegistry, settings }) => {
|
|
182
|
+
import { useAsyncEffect } from "@dxos/react-ui";
|
|
183
|
+
var __dxlog_file = "/__w/dxos/dxos/packages/plugins/plugin-assistant/src/hooks/useChatProcessor.ts";
|
|
184
|
+
var useChatProcessor = ({ space, chat, preset, services, blueprintRegistry, settings }) => {
|
|
363
185
|
const observableRegistry = useContext(RegistryContext);
|
|
364
186
|
const [conversation, setConversation] = useState2();
|
|
365
187
|
useAsyncEffect(async () => {
|
|
366
|
-
if (!chat
|
|
188
|
+
if (!space || !chat) {
|
|
367
189
|
return;
|
|
368
190
|
}
|
|
369
|
-
const
|
|
370
|
-
|
|
371
|
-
});
|
|
191
|
+
const queue = space.queues.get(chat.queue.dxn);
|
|
192
|
+
const conversation2 = new AiConversation(queue);
|
|
372
193
|
await conversation2.open();
|
|
373
194
|
setConversation(conversation2);
|
|
374
195
|
return () => {
|
|
375
196
|
void conversation2.close();
|
|
197
|
+
setConversation(void 0);
|
|
376
198
|
};
|
|
377
199
|
}, [
|
|
378
|
-
|
|
200
|
+
space,
|
|
201
|
+
chat?.queue.dxn.toString()
|
|
379
202
|
]);
|
|
380
203
|
const processor = useMemo2(() => {
|
|
381
204
|
if (!services || !conversation) {
|
|
382
205
|
return void 0;
|
|
383
206
|
}
|
|
384
|
-
|
|
207
|
+
log("creating processor", {
|
|
385
208
|
preset,
|
|
386
209
|
model: preset?.model,
|
|
387
210
|
settings
|
|
388
211
|
}, {
|
|
389
|
-
F:
|
|
390
|
-
L:
|
|
212
|
+
F: __dxlog_file,
|
|
213
|
+
L: 65,
|
|
391
214
|
S: void 0,
|
|
392
215
|
C: (f, a) => f(...a)
|
|
393
216
|
});
|
|
@@ -406,20 +229,21 @@ var useChatProcessor = ({ chat, preset, services, blueprintRegistry, settings })
|
|
|
406
229
|
};
|
|
407
230
|
|
|
408
231
|
// src/hooks/useChatServices.ts
|
|
409
|
-
import * as
|
|
232
|
+
import * as Effect from "effect/Effect";
|
|
410
233
|
import { useMemo as useMemo3 } from "react";
|
|
411
|
-
import { useCapability } from "@dxos/app-framework";
|
|
234
|
+
import { useCapability } from "@dxos/app-framework/react";
|
|
412
235
|
import { TracingService } from "@dxos/functions";
|
|
236
|
+
import { TracingServiceExt } from "@dxos/functions-runtime";
|
|
413
237
|
import { AutomationCapabilities } from "@dxos/plugin-automation";
|
|
414
238
|
import { useClient } from "@dxos/react-client";
|
|
415
239
|
var useChatServices = ({ space, chat }) => {
|
|
416
240
|
const client = useClient();
|
|
417
|
-
space
|
|
418
|
-
const
|
|
241
|
+
space ??= client.spaces.default;
|
|
242
|
+
const runtimeResolver = useCapability(AutomationCapabilities.ComputeRuntime);
|
|
419
243
|
return useMemo3(() => {
|
|
420
|
-
const runtime2 =
|
|
421
|
-
return () => runtime2.runPromise(
|
|
422
|
-
return yield*
|
|
244
|
+
const runtime2 = runtimeResolver.getRuntime(space.id);
|
|
245
|
+
return () => runtime2.runPromise(Effect.gen(function* () {
|
|
246
|
+
return yield* Effect.runtime().pipe(Effect.provide(chat?.traceQueue?.target ? TracingServiceExt.layerQueue(chat.traceQueue?.target) : TracingService.layerNoop));
|
|
423
247
|
}));
|
|
424
248
|
}, [
|
|
425
249
|
space,
|
|
@@ -427,37 +251,72 @@ var useChatServices = ({ space, chat }) => {
|
|
|
427
251
|
]);
|
|
428
252
|
};
|
|
429
253
|
|
|
254
|
+
// src/hooks/useChatToolbarActions.ts
|
|
255
|
+
import { Atom } from "@effect-atom/atom-react";
|
|
256
|
+
import * as Effect2 from "effect/Effect";
|
|
257
|
+
import { useMemo as useMemo10 } from "react";
|
|
258
|
+
import { createIntent } from "@dxos/app-framework";
|
|
259
|
+
import { useIntentDispatcher } from "@dxos/app-framework/react";
|
|
260
|
+
import { Filter as Filter5, Obj as Obj6, Query } from "@dxos/echo";
|
|
261
|
+
import { invariant } from "@dxos/invariant";
|
|
262
|
+
import { useQuery as useQuery4 } from "@dxos/react-client/echo";
|
|
263
|
+
import { MenuBuilder, useMenuActions } from "@dxos/react-ui-menu";
|
|
264
|
+
|
|
265
|
+
// src/components/index.ts
|
|
266
|
+
import { lazy } from "react";
|
|
267
|
+
|
|
268
|
+
// src/components/Chat/Chat.tsx
|
|
269
|
+
import { useSignals as _useSignals12 } from "@preact-signals/safe-react/tracking";
|
|
270
|
+
import { Prec } from "@codemirror/state";
|
|
271
|
+
import { keymap } from "@codemirror/view";
|
|
272
|
+
import { useAtomValue } from "@effect-atom/atom-react";
|
|
273
|
+
import { createContext } from "@radix-ui/react-context";
|
|
274
|
+
import * as Array2 from "effect/Array";
|
|
275
|
+
import * as Option2 from "effect/Option";
|
|
276
|
+
import React10, { useCallback as useCallback7, useEffect as useEffect6, useMemo as useMemo9, useRef as useRef3, useState as useState11 } from "react";
|
|
277
|
+
import { Event } from "@dxos/async";
|
|
278
|
+
import { Obj as Obj5 } from "@dxos/echo";
|
|
279
|
+
import { useVoiceInput } from "@dxos/plugin-transcription";
|
|
280
|
+
import { getSpace, useQueue } from "@dxos/react-client/echo";
|
|
281
|
+
import { useIdentity } from "@dxos/react-client/halo";
|
|
282
|
+
import { Input as Input2, useDynamicRef, useTranslation as useTranslation6 } from "@dxos/react-ui";
|
|
283
|
+
import { ChatEditor, references } from "@dxos/react-ui-chat";
|
|
284
|
+
import { MenuProvider, ToolbarMenu } from "@dxos/react-ui-menu";
|
|
285
|
+
import { mx as mx5 } from "@dxos/react-ui-theme";
|
|
286
|
+
import { Message } from "@dxos/types";
|
|
287
|
+
import { isTruthy } from "@dxos/util";
|
|
288
|
+
|
|
430
289
|
// src/hooks/useContextBinder.ts
|
|
431
290
|
import { useState as useState3 } from "react";
|
|
432
291
|
import { AiContextBinder } from "@dxos/assistant";
|
|
433
292
|
import { useAsyncEffect as useAsyncEffect2 } from "@dxos/react-ui";
|
|
434
|
-
var useContextBinder = (
|
|
293
|
+
var useContextBinder = (queue) => {
|
|
435
294
|
const [binder, setBinder] = useState3();
|
|
436
295
|
useAsyncEffect2(async () => {
|
|
437
|
-
if (!
|
|
296
|
+
if (!queue) {
|
|
438
297
|
return;
|
|
439
298
|
}
|
|
440
|
-
const binder2 = new AiContextBinder(
|
|
299
|
+
const binder2 = new AiContextBinder(queue);
|
|
441
300
|
await binder2.open();
|
|
442
301
|
setBinder(binder2);
|
|
443
302
|
return () => {
|
|
444
303
|
void binder2.close();
|
|
445
304
|
};
|
|
446
305
|
}, [
|
|
447
|
-
|
|
306
|
+
queue
|
|
448
307
|
]);
|
|
449
308
|
return binder;
|
|
450
309
|
};
|
|
451
310
|
|
|
452
311
|
// src/hooks/useContextObjects.ts
|
|
453
|
-
import { useSignals as
|
|
312
|
+
import { useSignals as _useSignals3 } from "@preact-signals/safe-react/tracking";
|
|
454
313
|
import { useCallback as useCallback2 } from "react";
|
|
455
314
|
import { Ref as Ref2 } from "@dxos/echo";
|
|
456
|
-
import { log as
|
|
315
|
+
import { log as log2 } from "@dxos/log";
|
|
457
316
|
import { isNonNullable as isNonNullable2 } from "@dxos/util";
|
|
458
|
-
var
|
|
317
|
+
var __dxlog_file2 = "/__w/dxos/dxos/packages/plugins/plugin-assistant/src/hooks/useContextObjects.ts";
|
|
459
318
|
var useContextObjects = ({ space, context }) => {
|
|
460
|
-
var _effect =
|
|
319
|
+
var _effect = _useSignals3();
|
|
461
320
|
try {
|
|
462
321
|
const objects = context?.objects.value.map((ref) => ref.target).filter(isNonNullable2) ?? [];
|
|
463
322
|
const handleUpdateObject = useCallback2(async (dxn, checked) => {
|
|
@@ -467,11 +326,11 @@ var useContextObjects = ({ space, context }) => {
|
|
|
467
326
|
const id = dxn.asEchoDXN();
|
|
468
327
|
const object = id && await space.db.getObjectById(id.echoId);
|
|
469
328
|
if (!object) {
|
|
470
|
-
|
|
329
|
+
log2.warn("Object not found", {
|
|
471
330
|
dxn,
|
|
472
331
|
id
|
|
473
332
|
}, {
|
|
474
|
-
F:
|
|
333
|
+
F: __dxlog_file2,
|
|
475
334
|
L: 40,
|
|
476
335
|
S: void 0,
|
|
477
336
|
C: (f, a) => f(...a)
|
|
@@ -536,7 +395,7 @@ var useFlush = (space) => {
|
|
|
536
395
|
};
|
|
537
396
|
|
|
538
397
|
// src/hooks/useItemTypes.ts
|
|
539
|
-
import * as
|
|
398
|
+
import * as Option from "effect/Option";
|
|
540
399
|
import { useEffect, useState as useState5 } from "react";
|
|
541
400
|
import { ItemAnnotation } from "@dxos/schema";
|
|
542
401
|
var useItemTypes = (space) => {
|
|
@@ -549,7 +408,7 @@ var useItemTypes = (space) => {
|
|
|
549
408
|
const types2 = Array.from(new Set([
|
|
550
409
|
...space.db.graph.schemaRegistry.schemas,
|
|
551
410
|
...query.results
|
|
552
|
-
].filter((type) =>
|
|
411
|
+
].filter((type) => Option.isSome(ItemAnnotation.get(type)))));
|
|
553
412
|
setTypes(types2);
|
|
554
413
|
}, {
|
|
555
414
|
fire: true
|
|
@@ -605,8 +464,9 @@ var usePresets = (online) => {
|
|
|
605
464
|
|
|
606
465
|
// src/hooks/useReferencesProvider.ts
|
|
607
466
|
import { useMemo as useMemo5 } from "react";
|
|
608
|
-
import { Capabilities as Capabilities2
|
|
609
|
-
import {
|
|
467
|
+
import { Capabilities as Capabilities2 } from "@dxos/app-framework";
|
|
468
|
+
import { useCapabilities as useCapabilities2 } from "@dxos/app-framework/react";
|
|
469
|
+
import { Filter as Filter2, Obj as Obj2 } from "@dxos/echo";
|
|
610
470
|
var useReferencesProvider = (space) => {
|
|
611
471
|
const blueprints = useCapabilities2(Capabilities2.BlueprintDefinition);
|
|
612
472
|
return useMemo5(() => {
|
|
@@ -616,16 +476,16 @@ var useReferencesProvider = (space) => {
|
|
|
616
476
|
return {
|
|
617
477
|
getReferences: async ({ query }) => {
|
|
618
478
|
const { objects } = await space.db.query(Filter2.everything()).run();
|
|
619
|
-
return objects.filter((object) => stringMatch(query,
|
|
620
|
-
uri:
|
|
621
|
-
label:
|
|
479
|
+
return objects.filter((object) => stringMatch(query, Obj2.getLabel(object) ?? "")).filter((object) => !!Obj2.getDXN(object)).map((object) => ({
|
|
480
|
+
uri: Obj2.getDXN(object).toString(),
|
|
481
|
+
label: Obj2.getLabel(object) ?? ""
|
|
622
482
|
}));
|
|
623
483
|
},
|
|
624
484
|
resolveReference: async ({ uri }) => {
|
|
625
485
|
const object = await space.db.query(Filter2.ids(uri)).first();
|
|
626
486
|
return {
|
|
627
487
|
uri,
|
|
628
|
-
label:
|
|
488
|
+
label: Obj2.getLabel(object) ?? ""
|
|
629
489
|
};
|
|
630
490
|
}
|
|
631
491
|
};
|
|
@@ -636,56 +496,34 @@ var useReferencesProvider = (space) => {
|
|
|
636
496
|
};
|
|
637
497
|
var stringMatch = (query, label) => label.toLowerCase().startsWith(query.toLowerCase());
|
|
638
498
|
|
|
639
|
-
// src/components/Chat/Chat.tsx
|
|
640
|
-
import { useSignals as _useSignals11 } from "@preact-signals/safe-react/tracking";
|
|
641
|
-
import { Prec } from "@codemirror/state";
|
|
642
|
-
import { keymap } from "@codemirror/view";
|
|
643
|
-
import { useRxValue } from "@effect-rx/rx-react";
|
|
644
|
-
import { createContext } from "@radix-ui/react-context";
|
|
645
|
-
import * as Array2 from "effect/Array";
|
|
646
|
-
import * as Option3 from "effect/Option";
|
|
647
|
-
import React9, { useCallback as useCallback6, useEffect as useEffect6, useMemo as useMemo9, useRef as useRef3, useState as useState12 } from "react";
|
|
648
|
-
import { Event } from "@dxos/async";
|
|
649
|
-
import { Obj as Obj6 } from "@dxos/echo";
|
|
650
|
-
import { useVoiceInput } from "@dxos/plugin-transcription";
|
|
651
|
-
import { getSpace, useQueue } from "@dxos/react-client/echo";
|
|
652
|
-
import { useIdentity } from "@dxos/react-client/halo";
|
|
653
|
-
import { Input, useDynamicRef, useTranslation as useTranslation5 } from "@dxos/react-ui";
|
|
654
|
-
import { ChatEditor, references } from "@dxos/react-ui-chat";
|
|
655
|
-
import { mx as mx5 } from "@dxos/react-ui-theme";
|
|
656
|
-
import { DataType as DataType2 } from "@dxos/schema";
|
|
657
|
-
import { isTruthy } from "@dxos/util";
|
|
658
|
-
|
|
659
499
|
// src/components/ChatPrompt/ChatActions.tsx
|
|
660
|
-
import { useSignals as
|
|
661
|
-
import
|
|
662
|
-
import { IconButton, useTranslation } from "@dxos/react-ui";
|
|
500
|
+
import { useSignals as _useSignals4 } from "@preact-signals/safe-react/tracking";
|
|
501
|
+
import React2 from "react";
|
|
502
|
+
import { IconButton, useTranslation as useTranslation2 } from "@dxos/react-ui";
|
|
663
503
|
import { mx } from "@dxos/react-ui-theme";
|
|
664
504
|
var ChatActions = ({ classNames, children, microphone, recording, processing, onEvent }) => {
|
|
665
|
-
var _effect =
|
|
505
|
+
var _effect = _useSignals4();
|
|
666
506
|
try {
|
|
667
|
-
const { t } =
|
|
668
|
-
return /* @__PURE__ */
|
|
507
|
+
const { t } = useTranslation2(meta.id);
|
|
508
|
+
return /* @__PURE__ */ React2.createElement("div", {
|
|
669
509
|
className: mx("flex items-center mie-1", classNames)
|
|
670
|
-
}, children, /* @__PURE__ */
|
|
510
|
+
}, children, /* @__PURE__ */ React2.createElement(IconButton, {
|
|
671
511
|
disabled: !processing,
|
|
672
512
|
variant: "ghost",
|
|
673
|
-
size: 5,
|
|
674
513
|
icon: "ph--x--regular",
|
|
675
514
|
iconOnly: true,
|
|
676
|
-
label: t("
|
|
515
|
+
label: t("cancel processing button"),
|
|
677
516
|
onClick: () => onEvent?.({
|
|
678
517
|
type: "cancel"
|
|
679
518
|
})
|
|
680
|
-
}), microphone && /* @__PURE__ */
|
|
519
|
+
}), microphone && /* @__PURE__ */ React2.createElement(IconButton, {
|
|
681
520
|
disabled: !processing,
|
|
682
521
|
classNames: mx(recording && "bg-primary-500"),
|
|
683
522
|
variant: "ghost",
|
|
684
|
-
size: 5,
|
|
685
523
|
icon: "ph--microphone--regular",
|
|
686
524
|
iconOnly: true,
|
|
687
525
|
noTooltip: true,
|
|
688
|
-
label: t("button
|
|
526
|
+
label: t("microphone button"),
|
|
689
527
|
onMouseDown: () => onEvent?.({
|
|
690
528
|
type: "record-start"
|
|
691
529
|
}),
|
|
@@ -705,88 +543,86 @@ var ChatActions = ({ classNames, children, microphone, recording, processing, on
|
|
|
705
543
|
};
|
|
706
544
|
|
|
707
545
|
// src/components/ChatPrompt/ChatOptions.tsx
|
|
708
|
-
import { useSignals as
|
|
709
|
-
import
|
|
710
|
-
import { Filter as Filter3, Obj as
|
|
546
|
+
import { useSignals as _useSignals5 } from "@preact-signals/safe-react/tracking";
|
|
547
|
+
import React3, { useMemo as useMemo6, useState as useState8 } from "react";
|
|
548
|
+
import { Filter as Filter3, Obj as Obj3, Type } from "@dxos/echo";
|
|
711
549
|
import { useQuery as useQuery2 } from "@dxos/react-client/echo";
|
|
712
|
-
import { Icon, IconButton as IconButton2, Popover, Select, useTranslation as
|
|
550
|
+
import { Icon, IconButton as IconButton2, Popover, Select as Select2, useTranslation as useTranslation3 } from "@dxos/react-ui";
|
|
713
551
|
import { Listbox, SearchList } from "@dxos/react-ui-searchlist";
|
|
714
552
|
import { Tabs } from "@dxos/react-ui-tabs";
|
|
715
553
|
var panelClassNames = "is-[calc(100dvw-.5rem)] sm:is-max md:is-72 max-is-[--text-content]";
|
|
716
554
|
var ChatOptions = ({ space, context, blueprintRegistry, presets, preset, onPresetChange }) => {
|
|
717
|
-
var _effect =
|
|
555
|
+
var _effect = _useSignals5();
|
|
718
556
|
try {
|
|
719
|
-
const { t } =
|
|
720
|
-
return /* @__PURE__ */
|
|
557
|
+
const { t } = useTranslation3(meta.id);
|
|
558
|
+
return /* @__PURE__ */ React3.createElement("div", {
|
|
721
559
|
role: "none",
|
|
722
|
-
className: "flex
|
|
723
|
-
}, /* @__PURE__ */
|
|
560
|
+
className: "flex"
|
|
561
|
+
}, /* @__PURE__ */ React3.createElement(Popover.Root, null, /* @__PURE__ */ React3.createElement(Popover.Trigger, {
|
|
724
562
|
asChild: true
|
|
725
|
-
}, /* @__PURE__ */
|
|
563
|
+
}, /* @__PURE__ */ React3.createElement(IconButton2, {
|
|
726
564
|
variant: "ghost",
|
|
727
565
|
icon: "ph--plus--regular",
|
|
728
566
|
iconOnly: true,
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
})), /* @__PURE__ */ React2.createElement(Popover.Portal, null, /* @__PURE__ */ React2.createElement(Popover.Content, {
|
|
567
|
+
label: t("context objects button")
|
|
568
|
+
})), /* @__PURE__ */ React3.createElement(Popover.Portal, null, /* @__PURE__ */ React3.createElement(Popover.Content, {
|
|
732
569
|
side: "top",
|
|
733
570
|
classNames: panelClassNames
|
|
734
|
-
}, /* @__PURE__ */
|
|
571
|
+
}, /* @__PURE__ */ React3.createElement(Popover.Viewport, null, /* @__PURE__ */ React3.createElement(ObjectsPanel, {
|
|
735
572
|
space,
|
|
736
573
|
context
|
|
737
|
-
}), /* @__PURE__ */
|
|
574
|
+
})), /* @__PURE__ */ React3.createElement(Popover.Arrow, null)))), /* @__PURE__ */ React3.createElement(Popover.Root, null, /* @__PURE__ */ React3.createElement(Popover.Trigger, {
|
|
738
575
|
asChild: true
|
|
739
|
-
}, /* @__PURE__ */
|
|
576
|
+
}, /* @__PURE__ */ React3.createElement(IconButton2, {
|
|
740
577
|
variant: "ghost",
|
|
741
578
|
icon: "ph--sliders-horizontal--regular",
|
|
742
579
|
iconOnly: true,
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
})), /* @__PURE__ */ React2.createElement(Popover.Portal, null, /* @__PURE__ */ React2.createElement(Popover.Content, {
|
|
580
|
+
label: t("context settings button")
|
|
581
|
+
})), /* @__PURE__ */ React3.createElement(Popover.Portal, null, /* @__PURE__ */ React3.createElement(Popover.Content, {
|
|
746
582
|
side: "top",
|
|
747
583
|
classNames: panelClassNames
|
|
748
|
-
}, /* @__PURE__ */
|
|
584
|
+
}, /* @__PURE__ */ React3.createElement(Popover.Viewport, null, /* @__PURE__ */ React3.createElement(Tabs.Root, {
|
|
749
585
|
orientation: "horizontal",
|
|
750
586
|
defaultValue: "blueprints",
|
|
751
587
|
defaultActivePart: "list",
|
|
752
588
|
tabIndex: -1
|
|
753
|
-
}, /* @__PURE__ */
|
|
589
|
+
}, /* @__PURE__ */ React3.createElement(Tabs.Viewport, {
|
|
754
590
|
classNames: 'max-bs-[--radix-popover-content-available-height] grid grid-rows-[1fr_min-content] [&_[cmdk-root]]:contents [&_[role="tabpanel"]]:grid [&_[role="tabpanel"]]:grid-rows-[1fr_min-content] [&_[role="listbox"]]:min-bs-0 [&_[role="listbox"]]:overflow-y-auto [&_[role="tabpanel"]]:min-bs-0 [&_[role="tabpanel"]]:pli-cardSpacingChrome [&_[role="tabpanel"][data-state="active"]]:order-first [&_[role="tabpanel"][data-state="inactive"]]:hidden'
|
|
755
|
-
}, /* @__PURE__ */
|
|
591
|
+
}, /* @__PURE__ */ React3.createElement(Tabs.Tabpanel, {
|
|
756
592
|
value: "blueprints",
|
|
757
593
|
tabIndex: -1,
|
|
758
594
|
classNames: "dx-focus-ring-inset"
|
|
759
|
-
}, /* @__PURE__ */
|
|
595
|
+
}, /* @__PURE__ */ React3.createElement(BlueprintsPanel, {
|
|
760
596
|
blueprintRegistry,
|
|
761
597
|
space,
|
|
762
598
|
context
|
|
763
|
-
})), /* @__PURE__ */
|
|
599
|
+
})), /* @__PURE__ */ React3.createElement(Tabs.Tabpanel, {
|
|
764
600
|
value: "model",
|
|
765
601
|
tabIndex: -1,
|
|
766
602
|
classNames: "dx-focus-ring-inset !pli-0"
|
|
767
|
-
}, /* @__PURE__ */
|
|
603
|
+
}, /* @__PURE__ */ React3.createElement(ModelsPanel, {
|
|
768
604
|
presets,
|
|
769
605
|
preset,
|
|
770
606
|
onPresetChange
|
|
771
|
-
})), /* @__PURE__ */
|
|
607
|
+
})), /* @__PURE__ */ React3.createElement(Tabs.Tablist, {
|
|
772
608
|
classNames: "sm:overflow-x-hidden justify-center p-[--dx-cardSpacingChrome] border-bs border-subduedSeparator order-last"
|
|
773
|
-
}, /* @__PURE__ */
|
|
609
|
+
}, /* @__PURE__ */ React3.createElement(Tabs.IconTab, {
|
|
774
610
|
value: "blueprints",
|
|
775
611
|
icon: "ph--blueprint--regular",
|
|
776
612
|
label: t("blueprints in context title")
|
|
777
|
-
}), /* @__PURE__ */
|
|
613
|
+
}), /* @__PURE__ */ React3.createElement(Tabs.IconTab, {
|
|
778
614
|
value: "model",
|
|
779
615
|
label: t("chat model title"),
|
|
780
616
|
icon: "ph--cpu--regular"
|
|
781
|
-
})))), /* @__PURE__ */
|
|
617
|
+
}))))), /* @__PURE__ */ React3.createElement(Popover.Arrow, null)))));
|
|
782
618
|
} finally {
|
|
783
619
|
_effect.f();
|
|
784
620
|
}
|
|
785
621
|
};
|
|
786
622
|
var BlueprintsPanel = ({ blueprintRegistry, space, context }) => {
|
|
787
|
-
var _effect =
|
|
623
|
+
var _effect = _useSignals5();
|
|
788
624
|
try {
|
|
789
|
-
const { t } =
|
|
625
|
+
const { t } = useTranslation3(meta.id);
|
|
790
626
|
const blueprints = useBlueprints({
|
|
791
627
|
blueprintRegistry,
|
|
792
628
|
space
|
|
@@ -799,24 +635,24 @@ var BlueprintsPanel = ({ blueprintRegistry, space, context }) => {
|
|
|
799
635
|
context,
|
|
800
636
|
blueprintRegistry
|
|
801
637
|
});
|
|
802
|
-
return /* @__PURE__ */
|
|
638
|
+
return /* @__PURE__ */ React3.createElement(SearchList.Root, null, /* @__PURE__ */ React3.createElement(SearchList.Content, {
|
|
803
639
|
classNames: "plb-cardSpacingChrome"
|
|
804
640
|
}, blueprints.map((blueprint) => {
|
|
805
641
|
const isActive = activeBlueprints.has(blueprint.key);
|
|
806
|
-
return /* @__PURE__ */
|
|
642
|
+
return /* @__PURE__ */ React3.createElement(SearchList.Item, {
|
|
807
643
|
classNames: "flex items-center overflow-hidden",
|
|
808
644
|
key: blueprint.key,
|
|
809
645
|
value: blueprint.name,
|
|
810
646
|
onSelect: () => onUpdateBlueprint?.(blueprint.key, !isActive)
|
|
811
|
-
}, /* @__PURE__ */
|
|
647
|
+
}, /* @__PURE__ */ React3.createElement("div", {
|
|
812
648
|
className: "grow truncate"
|
|
813
|
-
}, blueprint.name), /* @__PURE__ */
|
|
649
|
+
}, blueprint.name), /* @__PURE__ */ React3.createElement(Icon, {
|
|
814
650
|
icon: "ph--check--regular",
|
|
815
651
|
classNames: [
|
|
816
652
|
!isActive && "invisible"
|
|
817
653
|
]
|
|
818
654
|
}));
|
|
819
|
-
})), /* @__PURE__ */
|
|
655
|
+
})), /* @__PURE__ */ React3.createElement(SearchList.Input, {
|
|
820
656
|
placeholder: t("search placeholder"),
|
|
821
657
|
classNames: "mbe-cardSpacingChrome",
|
|
822
658
|
autoFocus: true
|
|
@@ -826,17 +662,17 @@ var BlueprintsPanel = ({ blueprintRegistry, space, context }) => {
|
|
|
826
662
|
}
|
|
827
663
|
};
|
|
828
664
|
var ModelsPanel = ({ presets, preset, onPresetChange }) => {
|
|
829
|
-
var _effect =
|
|
665
|
+
var _effect = _useSignals5();
|
|
830
666
|
try {
|
|
831
|
-
return /* @__PURE__ */
|
|
667
|
+
return /* @__PURE__ */ React3.createElement(Listbox.Root, {
|
|
832
668
|
value: preset,
|
|
833
669
|
onValueChange: onPresetChange,
|
|
834
670
|
autoFocus: true
|
|
835
671
|
}, presets?.map(({ id, label }) => {
|
|
836
|
-
return /* @__PURE__ */
|
|
672
|
+
return /* @__PURE__ */ React3.createElement(Listbox.Option, {
|
|
837
673
|
key: id,
|
|
838
674
|
value: id
|
|
839
|
-
}, /* @__PURE__ */
|
|
675
|
+
}, /* @__PURE__ */ React3.createElement(Listbox.OptionLabel, null, label), /* @__PURE__ */ React3.createElement(Listbox.OptionIndicator, null));
|
|
840
676
|
}));
|
|
841
677
|
} finally {
|
|
842
678
|
_effect.f();
|
|
@@ -844,9 +680,9 @@ var ModelsPanel = ({ presets, preset, onPresetChange }) => {
|
|
|
844
680
|
};
|
|
845
681
|
var ANY = "__any__";
|
|
846
682
|
var ObjectsPanel = ({ space, context }) => {
|
|
847
|
-
var _effect =
|
|
683
|
+
var _effect = _useSignals5();
|
|
848
684
|
try {
|
|
849
|
-
const { t } =
|
|
685
|
+
const { t } = useTranslation3(meta.id);
|
|
850
686
|
const types = useItemTypes(space);
|
|
851
687
|
const typenames = useMemo6(() => {
|
|
852
688
|
const typenames2 = types.map((type) => {
|
|
@@ -873,39 +709,39 @@ var ObjectsPanel = ({ space, context }) => {
|
|
|
873
709
|
space,
|
|
874
710
|
context
|
|
875
711
|
});
|
|
876
|
-
return /* @__PURE__ */
|
|
712
|
+
return /* @__PURE__ */ React3.createElement(SearchList.Root, null, /* @__PURE__ */ React3.createElement(SearchList.Content, {
|
|
877
713
|
classNames: "p-cardSpacingChrome [&:has([cmdk-list-sizer]:empty)]:plb-0"
|
|
878
714
|
}, objects.length ? objects.map((object) => {
|
|
879
|
-
const label =
|
|
715
|
+
const label = Obj3.getLabel(object) ?? Obj3.getTypename(object) ?? object.id;
|
|
880
716
|
const isActive = contextObjects.findIndex((obj) => obj.id === object.id) !== -1;
|
|
881
|
-
return /* @__PURE__ */
|
|
717
|
+
return /* @__PURE__ */ React3.createElement(SearchList.Item, {
|
|
882
718
|
classNames: "flex items-center overflow-hidden",
|
|
883
719
|
key: object.id,
|
|
884
720
|
value: object.id,
|
|
885
|
-
onSelect: () => onUpdateObject?.(
|
|
886
|
-
}, /* @__PURE__ */
|
|
721
|
+
onSelect: () => onUpdateObject?.(Obj3.getDXN(object), !isActive)
|
|
722
|
+
}, /* @__PURE__ */ React3.createElement("div", {
|
|
887
723
|
className: "grow truncate"
|
|
888
|
-
}, label), /* @__PURE__ */
|
|
724
|
+
}, label), /* @__PURE__ */ React3.createElement(Icon, {
|
|
889
725
|
icon: "ph--check--regular",
|
|
890
726
|
classNames: [
|
|
891
727
|
!isActive && "invisible"
|
|
892
728
|
]
|
|
893
729
|
}));
|
|
894
|
-
}) : /* @__PURE__ */
|
|
730
|
+
}) : /* @__PURE__ */ React3.createElement(SearchList.Item, null, t("no results"))), /* @__PURE__ */ React3.createElement("div", {
|
|
895
731
|
role: "none",
|
|
896
732
|
className: "grid grid-cols-[min-content_1fr] gap-2 pli-cardSpacingChrome mbe-cardSpacingChrome"
|
|
897
|
-
}, /* @__PURE__ */
|
|
733
|
+
}, /* @__PURE__ */ React3.createElement(Select2.Root, {
|
|
898
734
|
value: typename === ANY ? void 0 : typename,
|
|
899
735
|
onValueChange: setTypename
|
|
900
|
-
}, /* @__PURE__ */
|
|
736
|
+
}, /* @__PURE__ */ React3.createElement(Select2.TriggerButton, {
|
|
901
737
|
density: "fine",
|
|
902
738
|
placeholder: t("type filter placeholder")
|
|
903
|
-
}), /* @__PURE__ */
|
|
739
|
+
}), /* @__PURE__ */ React3.createElement(Select2.Portal, null, /* @__PURE__ */ React3.createElement(Select2.Content, null, /* @__PURE__ */ React3.createElement(Select2.ScrollUpButton, null), /* @__PURE__ */ React3.createElement(Select2.Viewport, null, /* @__PURE__ */ React3.createElement(Select2.Option, {
|
|
904
740
|
value: ANY
|
|
905
|
-
}, t("any type filter label")), typenames.map(({ typename: typename2, label }) => /* @__PURE__ */
|
|
741
|
+
}, t("any type filter label")), typenames.map(({ typename: typename2, label }) => /* @__PURE__ */ React3.createElement(Select2.Option, {
|
|
906
742
|
key: typename2,
|
|
907
743
|
value: typename2
|
|
908
|
-
}, label))), /* @__PURE__ */
|
|
744
|
+
}, label))), /* @__PURE__ */ React3.createElement(Select2.ScrollDownButton, null), /* @__PURE__ */ React3.createElement(Select2.Arrow, null)))), /* @__PURE__ */ React3.createElement(SearchList.Input, {
|
|
909
745
|
placeholder: t("search placeholder"),
|
|
910
746
|
classNames: "mbe-0",
|
|
911
747
|
autoFocus: true
|
|
@@ -916,46 +752,46 @@ var ObjectsPanel = ({ space, context }) => {
|
|
|
916
752
|
};
|
|
917
753
|
|
|
918
754
|
// src/components/ChatPrompt/ChatPresets.tsx
|
|
919
|
-
import { useSignals as _useSignals5 } from "@preact-signals/safe-react/tracking";
|
|
920
|
-
import React3 from "react";
|
|
921
|
-
import { Select as Select2 } from "@dxos/react-ui";
|
|
922
|
-
|
|
923
|
-
// src/components/ChatPrompt/ChatReferences.tsx
|
|
924
755
|
import { useSignals as _useSignals6 } from "@preact-signals/safe-react/tracking";
|
|
925
756
|
import React4 from "react";
|
|
926
|
-
import {
|
|
927
|
-
|
|
757
|
+
import { Select as Select3 } from "@dxos/react-ui";
|
|
758
|
+
|
|
759
|
+
// src/components/ChatPrompt/ChatReferences.tsx
|
|
760
|
+
import { useSignals as _useSignals7 } from "@preact-signals/safe-react/tracking";
|
|
761
|
+
import React5 from "react";
|
|
762
|
+
import { Obj as Obj4 } from "@dxos/echo";
|
|
763
|
+
import { IconButton as IconButton3, toLocalizedString, useTranslation as useTranslation4 } from "@dxos/react-ui";
|
|
928
764
|
import { mx as mx2 } from "@dxos/react-ui-theme";
|
|
929
765
|
var ChatReferences = ({ classNames, context, space }) => {
|
|
930
|
-
var _effect =
|
|
766
|
+
var _effect = _useSignals7();
|
|
931
767
|
try {
|
|
932
|
-
const { t } =
|
|
768
|
+
const { t } = useTranslation4(meta.id);
|
|
933
769
|
const { objects, onUpdateObject } = useContextObjects({
|
|
934
770
|
space,
|
|
935
771
|
context
|
|
936
772
|
});
|
|
937
|
-
return /* @__PURE__ */
|
|
938
|
-
className: mx2("flex
|
|
773
|
+
return /* @__PURE__ */ React5.createElement("ul", {
|
|
774
|
+
className: mx2("flex", classNames)
|
|
939
775
|
}, objects.map((obj) => {
|
|
940
|
-
const dxn =
|
|
941
|
-
const typename =
|
|
942
|
-
const label =
|
|
776
|
+
const dxn = Obj4.getDXN(obj);
|
|
777
|
+
const typename = Obj4.getTypename(obj);
|
|
778
|
+
const label = Obj4.getLabel(obj) ?? (typename ? [
|
|
943
779
|
"object name placeholder",
|
|
944
780
|
{
|
|
945
781
|
ns: typename
|
|
946
782
|
}
|
|
947
783
|
] : obj.id);
|
|
948
|
-
return /* @__PURE__ */
|
|
784
|
+
return /* @__PURE__ */ React5.createElement("li", {
|
|
949
785
|
key: dxn.toString(),
|
|
950
786
|
className: "dx-tag plb-0 pis-2 flex items-center",
|
|
951
787
|
"data-hue": "neutral"
|
|
952
|
-
}, toLocalizedString(label, t), /* @__PURE__ */
|
|
788
|
+
}, toLocalizedString(label, t), /* @__PURE__ */ React5.createElement(IconButton3, {
|
|
789
|
+
icon: "ph--x--bold",
|
|
953
790
|
iconOnly: true,
|
|
954
791
|
variant: "ghost",
|
|
955
792
|
label: t("remove object in context label"),
|
|
956
793
|
classNames: "p-0 hover:bg-transparent",
|
|
957
794
|
size: 3,
|
|
958
|
-
icon: "ph--x--bold",
|
|
959
795
|
onClick: () => onUpdateObject?.(dxn, false)
|
|
960
796
|
}));
|
|
961
797
|
}));
|
|
@@ -965,14 +801,14 @@ var ChatReferences = ({ classNames, context, space }) => {
|
|
|
965
801
|
};
|
|
966
802
|
|
|
967
803
|
// src/components/ChatPrompt/ChatStatusIndicator.tsx
|
|
968
|
-
import { useSignals as
|
|
969
|
-
import
|
|
804
|
+
import { useSignals as _useSignals8 } from "@preact-signals/safe-react/tracking";
|
|
805
|
+
import React6, { useEffect as useEffect3, useState as useState9 } from "react";
|
|
970
806
|
import { Tooltip, useTimeout } from "@dxos/react-ui";
|
|
971
807
|
import { Spinner } from "@dxos/react-ui-sfx";
|
|
972
808
|
import { mx as mx3 } from "@dxos/react-ui-theme";
|
|
973
809
|
var period = 3e3;
|
|
974
810
|
var ChatStatusIndicator = ({ classNames, preset, processing, error, ...props }) => {
|
|
975
|
-
var _effect =
|
|
811
|
+
var _effect = _useSignals8();
|
|
976
812
|
try {
|
|
977
813
|
const [init, setInit] = useState9(false);
|
|
978
814
|
useEffect3(() => setInit(false), [
|
|
@@ -983,17 +819,17 @@ var ChatStatusIndicator = ({ classNames, preset, processing, error, ...props })
|
|
|
983
819
|
}, period / 2, [
|
|
984
820
|
preset
|
|
985
821
|
]);
|
|
986
|
-
return /* @__PURE__ */
|
|
822
|
+
return /* @__PURE__ */ React6.createElement("div", {
|
|
987
823
|
role: "none",
|
|
988
824
|
className: mx3("relative flex", classNames)
|
|
989
|
-
}, /* @__PURE__ */
|
|
825
|
+
}, /* @__PURE__ */ React6.createElement(Spinner, {
|
|
990
826
|
duration: period,
|
|
991
827
|
state: !init ? "flash" : error ? "error" : processing ? "spin" : "pulse",
|
|
992
828
|
...props
|
|
993
|
-
}), error && /* @__PURE__ */
|
|
829
|
+
}), error && /* @__PURE__ */ React6.createElement(Tooltip.Trigger, {
|
|
994
830
|
asChild: true,
|
|
995
831
|
content: error.message
|
|
996
|
-
}, /* @__PURE__ */
|
|
832
|
+
}, /* @__PURE__ */ React6.createElement("div", {
|
|
997
833
|
className: "absolute inset-0"
|
|
998
834
|
})));
|
|
999
835
|
} finally {
|
|
@@ -1002,42 +838,34 @@ var ChatStatusIndicator = ({ classNames, preset, processing, error, ...props })
|
|
|
1002
838
|
};
|
|
1003
839
|
|
|
1004
840
|
// src/components/ChatThread/ChatThread.tsx
|
|
1005
|
-
import { useSignals as
|
|
1006
|
-
import
|
|
841
|
+
import { useSignals as _useSignals11 } from "@preact-signals/safe-react/tracking";
|
|
842
|
+
import React9, { forwardRef, useCallback as useCallback6, useEffect as useEffect5, useMemo as useMemo8 } from "react";
|
|
1007
843
|
import { PublicKey } from "@dxos/keys";
|
|
844
|
+
import { useForwardedRef } from "@dxos/react-ui";
|
|
1008
845
|
import { MarkdownStream } from "@dxos/react-ui-components";
|
|
1009
846
|
import { mx as mx4 } from "@dxos/react-ui-theme";
|
|
1010
847
|
import { keyToFallback } from "@dxos/util";
|
|
1011
848
|
|
|
1012
849
|
// src/components/ChatThread/registry.tsx
|
|
1013
|
-
import { useSignals as
|
|
1014
|
-
import
|
|
1015
|
-
import { log as
|
|
850
|
+
import { useSignals as _useSignals10 } from "@preact-signals/safe-react/tracking";
|
|
851
|
+
import React8 from "react";
|
|
852
|
+
import { log as log3 } from "@dxos/log";
|
|
1016
853
|
import { PromptWidget, ReferenceWidget, SelectWidget, SuggestionWidget, SummaryWidget, ToggleContainer as ToggleContainer2 } from "@dxos/react-ui-components";
|
|
1017
854
|
import { getXmlTextChild } from "@dxos/react-ui-editor";
|
|
1018
855
|
import { Json as Json2 } from "@dxos/react-ui-syntax-highlighter";
|
|
1019
|
-
import { ContentBlock } from "@dxos/
|
|
856
|
+
import { ContentBlock } from "@dxos/types";
|
|
1020
857
|
|
|
1021
858
|
// src/components/ToolBlock/ToolBlock.tsx
|
|
1022
|
-
import { useSignals as
|
|
1023
|
-
import
|
|
1024
|
-
import { useTranslation as
|
|
1025
|
-
import { NumericTabs, TextCrawl, ToggleContainer
|
|
859
|
+
import { useSignals as _useSignals9 } from "@preact-signals/safe-react/tracking";
|
|
860
|
+
import React7, { useCallback as useCallback5, useEffect as useEffect4, useMemo as useMemo7, useRef as useRef2, useState as useState10 } from "react";
|
|
861
|
+
import { useTranslation as useTranslation5 } from "@dxos/react-ui";
|
|
862
|
+
import { NumericTabs, TextCrawl, ToggleContainer } from "@dxos/react-ui-components";
|
|
1026
863
|
import { Json } from "@dxos/react-ui-syntax-highlighter";
|
|
1027
864
|
import { isNonNullable as isNonNullable3, safeParseJson } from "@dxos/util";
|
|
1028
|
-
var ToolBlock = ({ blocks = [] }) => {
|
|
1029
|
-
var _effect =
|
|
865
|
+
var ToolBlock = ({ view, blocks = [] }) => {
|
|
866
|
+
var _effect = _useSignals9();
|
|
1030
867
|
try {
|
|
1031
|
-
const { t } =
|
|
1032
|
-
const getToolCaption = (tool, status) => {
|
|
1033
|
-
if (!tool) {
|
|
1034
|
-
return t("calling tool label");
|
|
1035
|
-
}
|
|
1036
|
-
return status?.message ?? tool.description ?? [
|
|
1037
|
-
t("calling label"),
|
|
1038
|
-
tool.name
|
|
1039
|
-
].join(" ");
|
|
1040
|
-
};
|
|
868
|
+
const { t } = useTranslation5(meta.id);
|
|
1041
869
|
const items = useMemo7(() => {
|
|
1042
870
|
let lastToolCall;
|
|
1043
871
|
const tools = [];
|
|
@@ -1053,7 +881,10 @@ var ToolBlock = ({ blocks = [] }) => {
|
|
|
1053
881
|
block
|
|
1054
882
|
};
|
|
1055
883
|
return {
|
|
1056
|
-
title:
|
|
884
|
+
title: tool?.description ?? [
|
|
885
|
+
t("tool call label"),
|
|
886
|
+
tool?.name
|
|
887
|
+
].join(" "),
|
|
1057
888
|
content: {
|
|
1058
889
|
...block,
|
|
1059
890
|
input: safeParseJson(block.input)
|
|
@@ -1063,11 +894,14 @@ var ToolBlock = ({ blocks = [] }) => {
|
|
|
1063
894
|
case "toolResult": {
|
|
1064
895
|
if (block.error) {
|
|
1065
896
|
return {
|
|
1066
|
-
title: t("error label"),
|
|
897
|
+
title: t("tool error label"),
|
|
1067
898
|
content: block
|
|
1068
899
|
};
|
|
1069
900
|
}
|
|
1070
|
-
const title =
|
|
901
|
+
const title = lastToolCall?.tool?.description ?? [
|
|
902
|
+
t("tool result label"),
|
|
903
|
+
lastToolCall?.tool?.name
|
|
904
|
+
].join(" ");
|
|
1071
905
|
lastToolCall = void 0;
|
|
1072
906
|
return {
|
|
1073
907
|
title,
|
|
@@ -1091,57 +925,65 @@ var ToolBlock = ({ blocks = [] }) => {
|
|
|
1091
925
|
}, [
|
|
1092
926
|
blocks
|
|
1093
927
|
]);
|
|
928
|
+
const handleChangeOpen = useCallback5(() => {
|
|
929
|
+
setTimeout(() => {
|
|
930
|
+
view?.requestMeasure();
|
|
931
|
+
}, 1e3);
|
|
932
|
+
}, [
|
|
933
|
+
view
|
|
934
|
+
]);
|
|
1094
935
|
if (!items.length) {
|
|
1095
936
|
return null;
|
|
1096
937
|
}
|
|
1097
|
-
return /* @__PURE__ */
|
|
1098
|
-
items
|
|
938
|
+
return /* @__PURE__ */ React7.createElement(ToolContainer, {
|
|
939
|
+
items,
|
|
940
|
+
onChangeOpen: handleChangeOpen
|
|
1099
941
|
});
|
|
1100
942
|
} finally {
|
|
1101
943
|
_effect.f();
|
|
1102
944
|
}
|
|
1103
945
|
};
|
|
1104
946
|
ToolBlock.displayName = "ToolBlock";
|
|
1105
|
-
var ToolContainer = ({ items }) => {
|
|
1106
|
-
var _effect =
|
|
947
|
+
var ToolContainer = ({ items, onChangeOpen }) => {
|
|
948
|
+
var _effect = _useSignals9();
|
|
1107
949
|
try {
|
|
1108
950
|
const tabsRef = useRef2(null);
|
|
1109
951
|
const [selected, setSelected] = useState10(0);
|
|
1110
952
|
const [open, setOpen] = useState10(false);
|
|
1111
953
|
useEffect4(() => {
|
|
954
|
+
onChangeOpen?.(open);
|
|
1112
955
|
if (open) {
|
|
1113
956
|
tabsRef.current?.focus();
|
|
1114
957
|
}
|
|
1115
958
|
}, [
|
|
959
|
+
onChangeOpen,
|
|
1116
960
|
open
|
|
1117
961
|
]);
|
|
1118
962
|
const handleSelect = (index) => {
|
|
1119
963
|
setSelected(index);
|
|
1120
964
|
};
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
classNames: chatMessagePanel,
|
|
965
|
+
return /* @__PURE__ */ React7.createElement(ToggleContainer.Root, {
|
|
966
|
+
classNames: "mbs-2 is-full rounded-sm",
|
|
1124
967
|
open,
|
|
1125
968
|
onChangeOpen: setOpen
|
|
1126
|
-
}, /* @__PURE__ */
|
|
1127
|
-
classNames:
|
|
1128
|
-
}, /* @__PURE__ */
|
|
969
|
+
}, /* @__PURE__ */ React7.createElement(ToggleContainer.Header, {
|
|
970
|
+
classNames: "text-sm text-placeholder"
|
|
971
|
+
}, /* @__PURE__ */ React7.createElement(TextCrawl, {
|
|
1129
972
|
key: "status-roll",
|
|
1130
|
-
lines: items.map((item) => item.title)
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
}, /* @__PURE__ */ React6.createElement(NumericTabs, {
|
|
973
|
+
lines: items.map((item) => item.title),
|
|
974
|
+
autoAdvance: true,
|
|
975
|
+
greedy: true
|
|
976
|
+
})), /* @__PURE__ */ React7.createElement(ToggleContainer.Content, {
|
|
977
|
+
classNames: "grid grid-cols-[32px_1fr]"
|
|
978
|
+
}, /* @__PURE__ */ React7.createElement(NumericTabs, {
|
|
1137
979
|
ref: tabsRef,
|
|
1138
980
|
classNames: "p-1",
|
|
1139
981
|
length: items.length,
|
|
1140
982
|
selected,
|
|
1141
983
|
onSelect: handleSelect
|
|
1142
|
-
}), /* @__PURE__ */
|
|
1143
|
-
data,
|
|
1144
|
-
classNames:
|
|
984
|
+
}), /* @__PURE__ */ React7.createElement(Json, {
|
|
985
|
+
data: items[selected]?.content,
|
|
986
|
+
classNames: "p-1 text-xs bg-transparent",
|
|
1145
987
|
replacer: {
|
|
1146
988
|
maxDepth: 3,
|
|
1147
989
|
maxArrayLen: 10,
|
|
@@ -1154,17 +996,17 @@ var ToolContainer = ({ items }) => {
|
|
|
1154
996
|
};
|
|
1155
997
|
|
|
1156
998
|
// src/components/ChatThread/registry.tsx
|
|
1157
|
-
var
|
|
999
|
+
var __dxlog_file3 = "/__w/dxos/dxos/packages/plugins/plugin-assistant/src/components/ChatThread/registry.tsx";
|
|
1158
1000
|
var Fallback = ({ _tag, ...props }) => {
|
|
1159
|
-
var _effect =
|
|
1001
|
+
var _effect = _useSignals10();
|
|
1160
1002
|
try {
|
|
1161
|
-
return /* @__PURE__ */
|
|
1003
|
+
return /* @__PURE__ */ React8.createElement(ToggleContainer2.Root, {
|
|
1162
1004
|
classNames: "rounded-sm"
|
|
1163
|
-
}, /* @__PURE__ */
|
|
1005
|
+
}, /* @__PURE__ */ React8.createElement(ToggleContainer2.Header, {
|
|
1164
1006
|
classNames: "bg-groupSurface"
|
|
1165
|
-
}, _tag), /* @__PURE__ */
|
|
1007
|
+
}, _tag), /* @__PURE__ */ React8.createElement(ToggleContainer2.Content, {
|
|
1166
1008
|
classNames: "bg-modalSurface"
|
|
1167
|
-
}, /* @__PURE__ */
|
|
1009
|
+
}, /* @__PURE__ */ React8.createElement(Json2, {
|
|
1168
1010
|
classNames: "!p-2 text-sm",
|
|
1169
1011
|
data: props
|
|
1170
1012
|
})));
|
|
@@ -1178,36 +1020,36 @@ var componentRegistry = {
|
|
|
1178
1020
|
//
|
|
1179
1021
|
["prompt"]: {
|
|
1180
1022
|
block: true,
|
|
1181
|
-
factory: (
|
|
1182
|
-
const text = getXmlTextChild(
|
|
1023
|
+
factory: ({ children }) => {
|
|
1024
|
+
const text = getXmlTextChild(children);
|
|
1183
1025
|
return text ? new PromptWidget(text) : null;
|
|
1184
1026
|
}
|
|
1185
1027
|
},
|
|
1186
1028
|
["reference"]: {
|
|
1187
1029
|
block: false,
|
|
1188
|
-
factory: (
|
|
1189
|
-
const text = getXmlTextChild(
|
|
1190
|
-
return text &&
|
|
1030
|
+
factory: ({ children, ref }) => {
|
|
1031
|
+
const text = getXmlTextChild(children);
|
|
1032
|
+
return text && ref ? new ReferenceWidget(text, ref) : null;
|
|
1191
1033
|
}
|
|
1192
1034
|
},
|
|
1193
1035
|
["select"]: {
|
|
1194
1036
|
block: true,
|
|
1195
|
-
factory: (
|
|
1196
|
-
const options =
|
|
1037
|
+
factory: ({ children }) => {
|
|
1038
|
+
const options = children?.map((option) => option._tag === "option" && getXmlTextChild(option.children)).filter(Boolean);
|
|
1197
1039
|
return options?.length ? new SelectWidget(options) : null;
|
|
1198
1040
|
}
|
|
1199
1041
|
},
|
|
1200
1042
|
["suggestion"]: {
|
|
1201
1043
|
block: true,
|
|
1202
|
-
factory: (
|
|
1203
|
-
const text = getXmlTextChild(
|
|
1044
|
+
factory: ({ children }) => {
|
|
1045
|
+
const text = getXmlTextChild(children);
|
|
1204
1046
|
return text ? new SuggestionWidget(text) : null;
|
|
1205
1047
|
}
|
|
1206
1048
|
},
|
|
1207
1049
|
["summary"]: {
|
|
1208
1050
|
block: true,
|
|
1209
|
-
factory: (
|
|
1210
|
-
const text = getXmlTextChild(
|
|
1051
|
+
factory: ({ children }) => {
|
|
1052
|
+
const text = getXmlTextChild(children);
|
|
1211
1053
|
return text ? new SummaryWidget(text) : null;
|
|
1212
1054
|
}
|
|
1213
1055
|
},
|
|
@@ -1235,17 +1077,17 @@ var componentRegistry = {
|
|
|
1235
1077
|
}
|
|
1236
1078
|
};
|
|
1237
1079
|
var blockToMarkdown = (context, message, block) => {
|
|
1238
|
-
let str =
|
|
1080
|
+
let str = blockToMarkdownImpl(context, message, block);
|
|
1239
1081
|
if (str && !block.pending) {
|
|
1240
1082
|
return str += "\n";
|
|
1241
1083
|
}
|
|
1242
1084
|
return str;
|
|
1243
1085
|
};
|
|
1244
|
-
var
|
|
1245
|
-
|
|
1086
|
+
var blockToMarkdownImpl = (context, message, block) => {
|
|
1087
|
+
log3("blockToMarkdown", {
|
|
1246
1088
|
block: JSON.stringify(block)
|
|
1247
1089
|
}, {
|
|
1248
|
-
F:
|
|
1090
|
+
F: __dxlog_file3,
|
|
1249
1091
|
L: 125,
|
|
1250
1092
|
S: void 0,
|
|
1251
1093
|
C: (f, a) => f(...a)
|
|
@@ -1253,9 +1095,7 @@ var _blockToMarkdown = (context, message, block) => {
|
|
|
1253
1095
|
switch (block._tag) {
|
|
1254
1096
|
case "text": {
|
|
1255
1097
|
if (message.sender.role === "user") {
|
|
1256
|
-
return
|
|
1257
|
-
<prompt>${block.text}</prompt>
|
|
1258
|
-
`;
|
|
1098
|
+
return `<prompt>${block.text}</prompt>`;
|
|
1259
1099
|
} else {
|
|
1260
1100
|
const text = block.text.trim();
|
|
1261
1101
|
if (text.length > 0) {
|
|
@@ -1264,6 +1104,10 @@ var _blockToMarkdown = (context, message, block) => {
|
|
|
1264
1104
|
}
|
|
1265
1105
|
break;
|
|
1266
1106
|
}
|
|
1107
|
+
case "reference": {
|
|
1108
|
+
const dxn = block.reference.dxn;
|
|
1109
|
+
return `<reference ref="${dxn.toString()}">${context.getObjectLabel(dxn)}</reference>`;
|
|
1110
|
+
}
|
|
1267
1111
|
case "suggestion": {
|
|
1268
1112
|
if (block.pending) {
|
|
1269
1113
|
return;
|
|
@@ -1276,13 +1120,6 @@ var _blockToMarkdown = (context, message, block) => {
|
|
|
1276
1120
|
}
|
|
1277
1121
|
return `<select>${block.options.map((option) => `<option>${option}</option>`).join("")}</select>`;
|
|
1278
1122
|
}
|
|
1279
|
-
// TODO(burdon): Need label.
|
|
1280
|
-
case "reference": {
|
|
1281
|
-
return `<reference ref="${block.reference.dxn.toString()}">Ref</reference>`;
|
|
1282
|
-
}
|
|
1283
|
-
// case 'toolkit': {
|
|
1284
|
-
// return `<toolkit />`;
|
|
1285
|
-
// }
|
|
1286
1123
|
case "toolCall": {
|
|
1287
1124
|
context.updateWidget(block.toolCallId, {
|
|
1288
1125
|
blocks: [
|
|
@@ -1303,7 +1140,6 @@ var _blockToMarkdown = (context, message, block) => {
|
|
|
1303
1140
|
case "summary": {
|
|
1304
1141
|
return `<summary>${ContentBlock.createSummaryMessage(block)}</summary>`;
|
|
1305
1142
|
}
|
|
1306
|
-
// TODO(burdon): Need stable ID.
|
|
1307
1143
|
default: {
|
|
1308
1144
|
return `<json id="${message.id}">
|
|
1309
1145
|
${JSON.stringify(block)}
|
|
@@ -1313,38 +1149,41 @@ ${JSON.stringify(block)}
|
|
|
1313
1149
|
};
|
|
1314
1150
|
|
|
1315
1151
|
// src/components/ChatThread/sync.ts
|
|
1316
|
-
import { log as
|
|
1317
|
-
|
|
1318
|
-
if (key in obj) {
|
|
1319
|
-
Object.defineProperty(obj, key, {
|
|
1320
|
-
value,
|
|
1321
|
-
enumerable: true,
|
|
1322
|
-
configurable: true,
|
|
1323
|
-
writable: true
|
|
1324
|
-
});
|
|
1325
|
-
} else {
|
|
1326
|
-
obj[key] = value;
|
|
1327
|
-
}
|
|
1328
|
-
return obj;
|
|
1329
|
-
}
|
|
1330
|
-
var __dxlog_file5 = "/__w/dxos/dxos/packages/plugins/plugin-assistant/src/components/ChatThread/sync.ts";
|
|
1152
|
+
import { log as log4 } from "@dxos/log";
|
|
1153
|
+
var __dxlog_file4 = "/__w/dxos/dxos/packages/plugins/plugin-assistant/src/components/ChatThread/sync.ts";
|
|
1331
1154
|
var MessageThreadContext = class {
|
|
1155
|
+
_widgetState;
|
|
1156
|
+
constructor(_widgetState) {
|
|
1157
|
+
this._widgetState = _widgetState;
|
|
1158
|
+
}
|
|
1332
1159
|
updateWidget(id, value) {
|
|
1333
1160
|
this._widgetState?.updateWidget(id, value);
|
|
1334
1161
|
}
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1162
|
+
// TODO(burdon): Resolve from hypergraph.
|
|
1163
|
+
getObjectLabel(_id) {
|
|
1164
|
+
return "Object";
|
|
1338
1165
|
}
|
|
1339
1166
|
};
|
|
1340
1167
|
var MessageSyncer = class {
|
|
1168
|
+
_model;
|
|
1169
|
+
_blockRenderer;
|
|
1170
|
+
_initialMessageId;
|
|
1171
|
+
_currentMessageIndex = 0;
|
|
1172
|
+
_currentBlockIndex = 0;
|
|
1173
|
+
_currentBlockContent;
|
|
1174
|
+
_context;
|
|
1175
|
+
constructor(_model, _blockRenderer) {
|
|
1176
|
+
this._model = _model;
|
|
1177
|
+
this._blockRenderer = _blockRenderer;
|
|
1178
|
+
this._context = new MessageThreadContext(this._model);
|
|
1179
|
+
}
|
|
1341
1180
|
get context() {
|
|
1342
1181
|
return this._context;
|
|
1343
1182
|
}
|
|
1344
1183
|
reset() {
|
|
1345
|
-
|
|
1346
|
-
F:
|
|
1347
|
-
L:
|
|
1184
|
+
log4("reset", void 0, {
|
|
1185
|
+
F: __dxlog_file4,
|
|
1186
|
+
L: 64,
|
|
1348
1187
|
S: this,
|
|
1349
1188
|
C: (f, a) => f(...a)
|
|
1350
1189
|
});
|
|
@@ -1354,22 +1193,53 @@ var MessageSyncer = class {
|
|
|
1354
1193
|
this._currentBlockContent = void 0;
|
|
1355
1194
|
void this._model.reset("");
|
|
1356
1195
|
}
|
|
1357
|
-
|
|
1358
|
-
|
|
1196
|
+
/**
|
|
1197
|
+
* Syncs messages with the editor.
|
|
1198
|
+
*/
|
|
1199
|
+
append(messages, flush = false) {
|
|
1200
|
+
if (this._initialMessageId !== messages[0]?.id) {
|
|
1201
|
+
this.reset();
|
|
1202
|
+
this._initialMessageId = messages[0]?.id;
|
|
1203
|
+
}
|
|
1204
|
+
if (flush && this._model.view?.state.doc.length === 0) {
|
|
1205
|
+
const buffer = [];
|
|
1206
|
+
this.process(messages, (content2) => {
|
|
1207
|
+
buffer.push(content2);
|
|
1208
|
+
});
|
|
1209
|
+
const content = buffer.join("");
|
|
1210
|
+
this._model.view?.dispatch({
|
|
1211
|
+
changes: [
|
|
1212
|
+
{
|
|
1213
|
+
from: 0,
|
|
1214
|
+
to: this._model.view?.state.doc.length ?? 0,
|
|
1215
|
+
insert: content
|
|
1216
|
+
}
|
|
1217
|
+
],
|
|
1218
|
+
selection: {
|
|
1219
|
+
anchor: content.length
|
|
1220
|
+
}
|
|
1221
|
+
});
|
|
1222
|
+
return true;
|
|
1223
|
+
} else {
|
|
1224
|
+
this.process(messages, (content) => {
|
|
1225
|
+
void this._model.append(content);
|
|
1226
|
+
});
|
|
1227
|
+
return false;
|
|
1228
|
+
}
|
|
1229
|
+
}
|
|
1230
|
+
process(messages, append) {
|
|
1231
|
+
log4("sync", {
|
|
1232
|
+
doc: this._model.view?.state.doc.length,
|
|
1359
1233
|
messages: messages.map((message) => message.blocks.length),
|
|
1360
1234
|
currentMessageIndex: this._currentMessageIndex,
|
|
1361
1235
|
currentBlockIndex: this._currentBlockIndex,
|
|
1362
1236
|
currentBlockContent: this._currentBlockContent
|
|
1363
1237
|
}, {
|
|
1364
|
-
F:
|
|
1365
|
-
L:
|
|
1238
|
+
F: __dxlog_file4,
|
|
1239
|
+
L: 105,
|
|
1366
1240
|
S: this,
|
|
1367
1241
|
C: (f, a) => f(...a)
|
|
1368
1242
|
});
|
|
1369
|
-
if (this._initialMessageId !== messages[0]?.id) {
|
|
1370
|
-
this.reset();
|
|
1371
|
-
this._initialMessageId = messages[0]?.id;
|
|
1372
|
-
}
|
|
1373
1243
|
let i = this._currentMessageIndex;
|
|
1374
1244
|
for (const message of messages.slice(this._currentMessageIndex)) {
|
|
1375
1245
|
if (i > this._currentMessageIndex) {
|
|
@@ -1387,18 +1257,18 @@ var MessageSyncer = class {
|
|
|
1387
1257
|
} else {
|
|
1388
1258
|
content = currentBlockContent;
|
|
1389
1259
|
}
|
|
1390
|
-
|
|
1391
|
-
this._currentBlockContent = currentBlockContent;
|
|
1392
|
-
log5("append", {
|
|
1260
|
+
log4("append", {
|
|
1393
1261
|
message: i,
|
|
1394
1262
|
block: j,
|
|
1395
1263
|
content
|
|
1396
1264
|
}, {
|
|
1397
|
-
F:
|
|
1398
|
-
L:
|
|
1265
|
+
F: __dxlog_file4,
|
|
1266
|
+
L: 132,
|
|
1399
1267
|
S: this,
|
|
1400
1268
|
C: (f, a) => f(...a)
|
|
1401
1269
|
});
|
|
1270
|
+
this._currentBlockContent = currentBlockContent;
|
|
1271
|
+
append(content);
|
|
1402
1272
|
}
|
|
1403
1273
|
if (block.pending) {
|
|
1404
1274
|
return;
|
|
@@ -1411,35 +1281,17 @@ var MessageSyncer = class {
|
|
|
1411
1281
|
i++;
|
|
1412
1282
|
}
|
|
1413
1283
|
}
|
|
1414
|
-
constructor(_model, _blockRenderer) {
|
|
1415
|
-
_define_property2(this, "_model", void 0);
|
|
1416
|
-
_define_property2(this, "_blockRenderer", void 0);
|
|
1417
|
-
_define_property2(this, "_initialMessageId", void 0);
|
|
1418
|
-
_define_property2(this, "_currentMessageIndex", void 0);
|
|
1419
|
-
_define_property2(this, "_currentBlockIndex", void 0);
|
|
1420
|
-
_define_property2(this, "_currentBlockContent", void 0);
|
|
1421
|
-
_define_property2(this, "_context", void 0);
|
|
1422
|
-
this._model = _model;
|
|
1423
|
-
this._blockRenderer = _blockRenderer;
|
|
1424
|
-
this._currentMessageIndex = 0;
|
|
1425
|
-
this._currentBlockIndex = 0;
|
|
1426
|
-
this._context = new MessageThreadContext(this._model);
|
|
1427
|
-
}
|
|
1428
1284
|
};
|
|
1429
1285
|
|
|
1430
1286
|
// src/components/ChatThread/ChatThread.tsx
|
|
1431
|
-
var ChatThread = /* @__PURE__ */ forwardRef(({ classNames, identity, messages = [], error, cursor = false, fadeIn = true,
|
|
1432
|
-
var _effect =
|
|
1287
|
+
var ChatThread = /* @__PURE__ */ forwardRef(({ classNames, identity, messages = [], error, cursor = false, fadeIn = true, debug = false, onEvent }, forwardedRef) => {
|
|
1288
|
+
var _effect = _useSignals11();
|
|
1433
1289
|
try {
|
|
1434
|
-
const
|
|
1435
|
-
|
|
1436
|
-
|
|
1290
|
+
const controllerRef = useForwardedRef(forwardedRef);
|
|
1291
|
+
const controller = controllerRef.current;
|
|
1292
|
+
const userHue = useMemo8(() => identity?.profile?.data?.hue || keyToFallback(identity?.identityKey ?? PublicKey.random()).hue, [
|
|
1437
1293
|
identity
|
|
1438
1294
|
]);
|
|
1439
|
-
const [controller, setController] = useState11(null);
|
|
1440
|
-
useImperativeHandle(forwardedRef, () => controller ? controller : null, [
|
|
1441
|
-
controller
|
|
1442
|
-
]);
|
|
1443
1295
|
useEffect5(() => {
|
|
1444
1296
|
controller?.scrollToBottom();
|
|
1445
1297
|
}, [
|
|
@@ -1450,17 +1302,20 @@ var ChatThread = /* @__PURE__ */ forwardRef(({ classNames, identity, messages =
|
|
|
1450
1302
|
controller
|
|
1451
1303
|
]);
|
|
1452
1304
|
useEffect5(() => {
|
|
1453
|
-
syncer?.
|
|
1305
|
+
const reset = syncer?.append(messages, true);
|
|
1306
|
+
if (reset) {
|
|
1307
|
+
controller?.scrollToBottom("instant");
|
|
1308
|
+
}
|
|
1454
1309
|
}, [
|
|
1455
1310
|
syncer,
|
|
1456
1311
|
messages
|
|
1457
1312
|
]);
|
|
1458
|
-
const handleEvent =
|
|
1459
|
-
switch (
|
|
1313
|
+
const handleEvent = useCallback6(({ type, value }) => {
|
|
1314
|
+
switch (type) {
|
|
1460
1315
|
case "submit": {
|
|
1461
|
-
|
|
1462
|
-
type
|
|
1463
|
-
text:
|
|
1316
|
+
value && onEvent?.({
|
|
1317
|
+
type,
|
|
1318
|
+
text: value
|
|
1464
1319
|
});
|
|
1465
1320
|
break;
|
|
1466
1321
|
}
|
|
@@ -1468,17 +1323,18 @@ var ChatThread = /* @__PURE__ */ forwardRef(({ classNames, identity, messages =
|
|
|
1468
1323
|
}, [
|
|
1469
1324
|
onEvent
|
|
1470
1325
|
]);
|
|
1471
|
-
return /* @__PURE__ */
|
|
1326
|
+
return /* @__PURE__ */ React9.createElement("div", {
|
|
1327
|
+
role: "none",
|
|
1472
1328
|
className: mx4("flex bs-full is-full justify-center overflow-hidden", classNames),
|
|
1473
1329
|
style: {
|
|
1474
1330
|
"--user-fill": `var(--dx-${userHue}Fill)`
|
|
1475
1331
|
}
|
|
1476
|
-
}, /* @__PURE__ */
|
|
1477
|
-
ref:
|
|
1332
|
+
}, /* @__PURE__ */ React9.createElement(MarkdownStream, {
|
|
1333
|
+
ref: controllerRef,
|
|
1478
1334
|
registry: componentRegistry,
|
|
1479
1335
|
cursor,
|
|
1480
1336
|
fadeIn,
|
|
1481
|
-
|
|
1337
|
+
debug,
|
|
1482
1338
|
onEvent: handleEvent
|
|
1483
1339
|
}));
|
|
1484
1340
|
} finally {
|
|
@@ -1488,21 +1344,20 @@ var ChatThread = /* @__PURE__ */ forwardRef(({ classNames, identity, messages =
|
|
|
1488
1344
|
|
|
1489
1345
|
// src/components/Chat/Chat.tsx
|
|
1490
1346
|
var [ChatContextProvider, useChatContext] = createContext("Chat");
|
|
1491
|
-
var ChatRoot = ({
|
|
1492
|
-
var _effect =
|
|
1347
|
+
var ChatRoot = ({ children, chat, processor, onEvent, ...props }) => {
|
|
1348
|
+
var _effect = _useSignals12();
|
|
1493
1349
|
try {
|
|
1494
|
-
const [debug, setDebug] =
|
|
1495
|
-
const
|
|
1496
|
-
const
|
|
1497
|
-
const pending = useRxValue(processor.messages);
|
|
1498
|
-
const streaming = useRxValue(processor.streaming);
|
|
1350
|
+
const [debug, setDebug] = useState11(false);
|
|
1351
|
+
const pending = useAtomValue(processor.messages);
|
|
1352
|
+
const streaming = useAtomValue(processor.streaming);
|
|
1499
1353
|
const lastPrompt = useRef3(void 0);
|
|
1354
|
+
const queue = useQueue(chat?.queue.dxn);
|
|
1500
1355
|
const messages = useMemo9(() => {
|
|
1501
|
-
const queueMessages = queue?.objects?.filter(
|
|
1356
|
+
const queueMessages = queue?.objects?.filter(Obj5.instanceOf(Message.Message)) ?? [];
|
|
1502
1357
|
return Array2.dedupeWith([
|
|
1503
1358
|
...queueMessages,
|
|
1504
1359
|
...pending
|
|
1505
|
-
], (a, b) => a
|
|
1360
|
+
], ({ id: a }, { id: b }) => a === b);
|
|
1506
1361
|
}, [
|
|
1507
1362
|
queue?.objects,
|
|
1508
1363
|
pending
|
|
@@ -1543,10 +1398,8 @@ var ChatRoot = ({ classNames, children, chat, processor, onEvent, ...props }) =>
|
|
|
1543
1398
|
}
|
|
1544
1399
|
break;
|
|
1545
1400
|
}
|
|
1546
|
-
default: {
|
|
1547
|
-
onEvent?.(ev);
|
|
1548
|
-
}
|
|
1549
1401
|
}
|
|
1402
|
+
onEvent?.(ev);
|
|
1550
1403
|
});
|
|
1551
1404
|
}, [
|
|
1552
1405
|
event,
|
|
@@ -1554,37 +1407,43 @@ var ChatRoot = ({ classNames, children, chat, processor, onEvent, ...props }) =>
|
|
|
1554
1407
|
streaming,
|
|
1555
1408
|
onEvent
|
|
1556
1409
|
]);
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
}
|
|
1560
|
-
return /* @__PURE__ */ React9.createElement(ChatContextProvider, {
|
|
1410
|
+
const space = props.space ?? getSpace(chat);
|
|
1411
|
+
return /* @__PURE__ */ React10.createElement(ChatContextProvider, {
|
|
1561
1412
|
debug,
|
|
1562
1413
|
event,
|
|
1563
|
-
chat,
|
|
1564
1414
|
space,
|
|
1415
|
+
chat,
|
|
1565
1416
|
messages,
|
|
1566
1417
|
processor,
|
|
1567
1418
|
...props
|
|
1568
|
-
},
|
|
1419
|
+
}, children);
|
|
1420
|
+
} finally {
|
|
1421
|
+
_effect.f();
|
|
1422
|
+
}
|
|
1423
|
+
};
|
|
1424
|
+
ChatRoot.displayName = "Chat.Root";
|
|
1425
|
+
var ChatViewport = ({ classNames, children }) => {
|
|
1426
|
+
var _effect = _useSignals12();
|
|
1427
|
+
try {
|
|
1428
|
+
return /* @__PURE__ */ React10.createElement("div", {
|
|
1569
1429
|
role: "none",
|
|
1570
1430
|
className: mx5("flex flex-col bs-full is-full", classNames)
|
|
1571
|
-
}, children)
|
|
1431
|
+
}, children);
|
|
1572
1432
|
} finally {
|
|
1573
1433
|
_effect.f();
|
|
1574
1434
|
}
|
|
1575
1435
|
};
|
|
1576
|
-
ChatRoot.displayName = "Chat.Root";
|
|
1577
1436
|
var ChatPrompt = ({ classNames, outline, settings = true, placeholder, expandable, online, presets, preset, onPresetChange, onOnlineChange }) => {
|
|
1578
|
-
var _effect =
|
|
1437
|
+
var _effect = _useSignals12();
|
|
1579
1438
|
try {
|
|
1580
|
-
const { t } =
|
|
1581
|
-
const { space,
|
|
1582
|
-
const error =
|
|
1583
|
-
const streaming =
|
|
1584
|
-
const active =
|
|
1439
|
+
const { t } = useTranslation6(meta.id);
|
|
1440
|
+
const { space, processor, event } = useChatContext(ChatPrompt.displayName);
|
|
1441
|
+
const error = useAtomValue(processor.error).pipe(Option2.getOrUndefined);
|
|
1442
|
+
const streaming = useAtomValue(processor.streaming);
|
|
1443
|
+
const active = useAtomValue(processor.active);
|
|
1585
1444
|
const activeRef = useDynamicRef(active);
|
|
1586
1445
|
const editorRef = useRef3(null);
|
|
1587
|
-
const [recordingState, setRecordingState] =
|
|
1446
|
+
const [recordingState, setRecordingState] = useState11(false);
|
|
1588
1447
|
useEffect6(() => {
|
|
1589
1448
|
return event.on((event2) => {
|
|
1590
1449
|
switch (event2.type) {
|
|
@@ -1620,7 +1479,7 @@ var ChatPrompt = ({ classNames, outline, settings = true, placeholder, expandabl
|
|
|
1620
1479
|
}),
|
|
1621
1480
|
Prec.highest(keymap.of([
|
|
1622
1481
|
{
|
|
1623
|
-
key: "
|
|
1482
|
+
key: "Mod-d",
|
|
1624
1483
|
preventDefault: true,
|
|
1625
1484
|
run: () => {
|
|
1626
1485
|
event.emit({
|
|
@@ -1629,26 +1488,48 @@ var ChatPrompt = ({ classNames, outline, settings = true, placeholder, expandabl
|
|
|
1629
1488
|
return true;
|
|
1630
1489
|
}
|
|
1631
1490
|
},
|
|
1632
|
-
|
|
1633
|
-
key: "
|
|
1491
|
+
{
|
|
1492
|
+
key: "Mod-ArrowUp",
|
|
1634
1493
|
preventDefault: true,
|
|
1635
1494
|
run: () => {
|
|
1636
1495
|
event.emit({
|
|
1637
|
-
type: "
|
|
1496
|
+
type: "nav-previous"
|
|
1638
1497
|
});
|
|
1639
1498
|
return true;
|
|
1640
1499
|
}
|
|
1641
1500
|
},
|
|
1642
|
-
|
|
1643
|
-
key: "
|
|
1501
|
+
{
|
|
1502
|
+
key: "Mod-ArrowDown",
|
|
1644
1503
|
preventDefault: true,
|
|
1645
1504
|
run: () => {
|
|
1646
1505
|
event.emit({
|
|
1647
|
-
type: "
|
|
1506
|
+
type: "nav-next"
|
|
1648
1507
|
});
|
|
1649
1508
|
return true;
|
|
1650
1509
|
}
|
|
1651
|
-
}
|
|
1510
|
+
},
|
|
1511
|
+
...expandable ? [
|
|
1512
|
+
{
|
|
1513
|
+
key: "Shift-Mod-ArrowUp",
|
|
1514
|
+
preventDefault: true,
|
|
1515
|
+
run: () => {
|
|
1516
|
+
event.emit({
|
|
1517
|
+
type: "thread-open"
|
|
1518
|
+
});
|
|
1519
|
+
return true;
|
|
1520
|
+
}
|
|
1521
|
+
},
|
|
1522
|
+
{
|
|
1523
|
+
key: "Shift-Mod-ArrowDown",
|
|
1524
|
+
preventDefault: true,
|
|
1525
|
+
run: () => {
|
|
1526
|
+
event.emit({
|
|
1527
|
+
type: "thread-close"
|
|
1528
|
+
});
|
|
1529
|
+
return true;
|
|
1530
|
+
}
|
|
1531
|
+
}
|
|
1532
|
+
] : []
|
|
1652
1533
|
].filter(isTruthy)))
|
|
1653
1534
|
].filter(isTruthy);
|
|
1654
1535
|
}, [
|
|
@@ -1656,7 +1537,7 @@ var ChatPrompt = ({ classNames, outline, settings = true, placeholder, expandabl
|
|
|
1656
1537
|
expandable,
|
|
1657
1538
|
referencesProvider
|
|
1658
1539
|
]);
|
|
1659
|
-
const handleSubmit =
|
|
1540
|
+
const handleSubmit = useCallback7((text) => {
|
|
1660
1541
|
if (!activeRef.current) {
|
|
1661
1542
|
event.emit({
|
|
1662
1543
|
type: "submit",
|
|
@@ -1667,25 +1548,25 @@ var ChatPrompt = ({ classNames, outline, settings = true, placeholder, expandabl
|
|
|
1667
1548
|
}, [
|
|
1668
1549
|
event
|
|
1669
1550
|
]);
|
|
1670
|
-
const handleEvent =
|
|
1551
|
+
const handleEvent = useCallback7((ev) => {
|
|
1671
1552
|
event.emit(ev);
|
|
1672
1553
|
}, [
|
|
1673
1554
|
event
|
|
1674
1555
|
]);
|
|
1675
|
-
return /* @__PURE__ */
|
|
1556
|
+
return /* @__PURE__ */ React10.createElement("div", {
|
|
1676
1557
|
role: "group",
|
|
1677
1558
|
className: mx5("flex flex-col is-full density-fine", outline && [
|
|
1678
1559
|
"p-2 bg-groupSurface border border-subduedSeparator transition transition-border [&:has(.cm-content:focus)]:border-separator rounded"
|
|
1679
1560
|
], classNames)
|
|
1680
|
-
}, /* @__PURE__ */
|
|
1561
|
+
}, /* @__PURE__ */ React10.createElement("div", {
|
|
1681
1562
|
role: "none",
|
|
1682
1563
|
className: "flex gap-2"
|
|
1683
|
-
}, /* @__PURE__ */
|
|
1564
|
+
}, /* @__PURE__ */ React10.createElement(ChatStatusIndicator, {
|
|
1684
1565
|
classNames: "p-1",
|
|
1685
1566
|
preset,
|
|
1686
1567
|
error,
|
|
1687
1568
|
processing: streaming
|
|
1688
|
-
}), /* @__PURE__ */
|
|
1569
|
+
}), /* @__PURE__ */ React10.createElement(ChatEditor, {
|
|
1689
1570
|
ref: editorRef,
|
|
1690
1571
|
autoFocus: true,
|
|
1691
1572
|
lineWrapping: true,
|
|
@@ -1693,32 +1574,32 @@ var ChatPrompt = ({ classNames, outline, settings = true, placeholder, expandabl
|
|
|
1693
1574
|
placeholder: placeholder ?? t("prompt placeholder"),
|
|
1694
1575
|
extensions,
|
|
1695
1576
|
onSubmit: handleSubmit
|
|
1696
|
-
})), settings && /* @__PURE__ */
|
|
1577
|
+
})), space && settings && /* @__PURE__ */ React10.createElement("div", {
|
|
1697
1578
|
role: "none",
|
|
1698
|
-
className: "flex pbs-2 items-center"
|
|
1699
|
-
}, /* @__PURE__ */
|
|
1579
|
+
className: "flex pbs-2 items-center overflow-hidden"
|
|
1580
|
+
}, /* @__PURE__ */ React10.createElement(ChatOptions, {
|
|
1700
1581
|
space,
|
|
1701
1582
|
blueprintRegistry: processor.blueprintRegistry,
|
|
1702
1583
|
context: processor.context,
|
|
1703
1584
|
preset,
|
|
1704
1585
|
presets,
|
|
1705
1586
|
onPresetChange
|
|
1706
|
-
}), /* @__PURE__ */
|
|
1587
|
+
}), /* @__PURE__ */ React10.createElement("div", {
|
|
1707
1588
|
role: "none",
|
|
1708
|
-
className: "
|
|
1709
|
-
}, /* @__PURE__ */
|
|
1589
|
+
className: "flex grow overflow-x-auto scrollbar-none"
|
|
1590
|
+
}, /* @__PURE__ */ React10.createElement(ChatReferences, {
|
|
1710
1591
|
space,
|
|
1711
1592
|
context: processor.context
|
|
1712
|
-
})), /* @__PURE__ */
|
|
1593
|
+
})), /* @__PURE__ */ React10.createElement(ChatActions, {
|
|
1713
1594
|
classNames: "col-span-2",
|
|
1714
1595
|
microphone: true,
|
|
1715
1596
|
recording,
|
|
1716
1597
|
processing: streaming,
|
|
1717
1598
|
onEvent: handleEvent
|
|
1718
|
-
}, online !== void 0 && /* @__PURE__ */
|
|
1599
|
+
}, online !== void 0 && /* @__PURE__ */ React10.createElement(Input2.Root, null, /* @__PURE__ */ React10.createElement(Input2.Label, {
|
|
1719
1600
|
srOnly: true
|
|
1720
|
-
}, t("online switch label")), /* @__PURE__ */
|
|
1721
|
-
classNames: "
|
|
1601
|
+
}, t("online switch label")), /* @__PURE__ */ React10.createElement(Input2.Switch, {
|
|
1602
|
+
classNames: "mli-2",
|
|
1722
1603
|
checked: online,
|
|
1723
1604
|
onCheckedChange: onOnlineChange
|
|
1724
1605
|
})))));
|
|
@@ -1728,25 +1609,31 @@ var ChatPrompt = ({ classNames, outline, settings = true, placeholder, expandabl
|
|
|
1728
1609
|
};
|
|
1729
1610
|
ChatPrompt.displayName = "Chat.Prompt";
|
|
1730
1611
|
var ChatThread2 = (props) => {
|
|
1731
|
-
var _effect =
|
|
1612
|
+
var _effect = _useSignals12();
|
|
1732
1613
|
try {
|
|
1733
|
-
const { event, messages, processor } = useChatContext(ChatThread2.displayName);
|
|
1614
|
+
const { debug, event, messages, processor } = useChatContext(ChatThread2.displayName);
|
|
1734
1615
|
const identity = useIdentity();
|
|
1735
|
-
const error =
|
|
1736
|
-
const
|
|
1616
|
+
const error = useAtomValue(processor.error).pipe(Option2.getOrUndefined);
|
|
1617
|
+
const controllerRef = useRef3(null);
|
|
1737
1618
|
useEffect6(() => {
|
|
1738
1619
|
return event.on((event2) => {
|
|
1739
1620
|
switch (event2.type) {
|
|
1740
1621
|
case "submit":
|
|
1741
1622
|
case "scroll-to-bottom":
|
|
1742
|
-
|
|
1623
|
+
controllerRef.current?.scrollToBottom();
|
|
1624
|
+
break;
|
|
1625
|
+
case "nav-previous":
|
|
1626
|
+
controllerRef.current?.navigatePrevious();
|
|
1627
|
+
break;
|
|
1628
|
+
case "nav-next":
|
|
1629
|
+
controllerRef.current?.navigateNext();
|
|
1743
1630
|
break;
|
|
1744
1631
|
}
|
|
1745
1632
|
});
|
|
1746
1633
|
}, [
|
|
1747
1634
|
event
|
|
1748
1635
|
]);
|
|
1749
|
-
const handleEvent =
|
|
1636
|
+
const handleEvent = useCallback7((ev) => {
|
|
1750
1637
|
event.emit(ev);
|
|
1751
1638
|
}, [
|
|
1752
1639
|
event
|
|
@@ -1754,32 +1641,290 @@ var ChatThread2 = (props) => {
|
|
|
1754
1641
|
if (!identity) {
|
|
1755
1642
|
return null;
|
|
1756
1643
|
}
|
|
1757
|
-
return /* @__PURE__ */
|
|
1644
|
+
return /* @__PURE__ */ React10.createElement(ChatThread, {
|
|
1758
1645
|
...props,
|
|
1759
|
-
ref: scrollerRef,
|
|
1760
1646
|
identity,
|
|
1761
1647
|
messages,
|
|
1762
1648
|
error,
|
|
1763
|
-
|
|
1649
|
+
debug,
|
|
1650
|
+
onEvent: handleEvent,
|
|
1651
|
+
ref: controllerRef
|
|
1764
1652
|
});
|
|
1765
1653
|
} finally {
|
|
1766
1654
|
_effect.f();
|
|
1767
1655
|
}
|
|
1768
1656
|
};
|
|
1769
1657
|
ChatThread2.displayName = "Chat.Thread";
|
|
1658
|
+
var ChatToolbar = ({ classNames, companionTo }) => {
|
|
1659
|
+
var _effect = _useSignals12();
|
|
1660
|
+
try {
|
|
1661
|
+
const { chat } = useChatContext(ChatToolbar.displayName);
|
|
1662
|
+
const menu = useChatToolbarActions({
|
|
1663
|
+
chat,
|
|
1664
|
+
companionTo
|
|
1665
|
+
});
|
|
1666
|
+
return /* @__PURE__ */ React10.createElement(MenuProvider, {
|
|
1667
|
+
...menu,
|
|
1668
|
+
attendableId: companionTo ? Obj5.getDXN(companionTo).toString() : chat ? Obj5.getDXN(chat).toString() : ""
|
|
1669
|
+
}, /* @__PURE__ */ React10.createElement(ToolbarMenu, {
|
|
1670
|
+
classNames,
|
|
1671
|
+
textBlockWidth: true
|
|
1672
|
+
}));
|
|
1673
|
+
} finally {
|
|
1674
|
+
_effect.f();
|
|
1675
|
+
}
|
|
1676
|
+
};
|
|
1677
|
+
ChatToolbar.displayName = "Chat.Toolbar";
|
|
1770
1678
|
var Chat = {
|
|
1771
1679
|
Root: ChatRoot,
|
|
1680
|
+
Viewport: ChatViewport,
|
|
1772
1681
|
Prompt: ChatPrompt,
|
|
1773
|
-
Thread: ChatThread2
|
|
1682
|
+
Thread: ChatThread2,
|
|
1683
|
+
Toolbar: ChatToolbar
|
|
1684
|
+
};
|
|
1685
|
+
|
|
1686
|
+
// src/components/Toolbox/Toolbox.tsx
|
|
1687
|
+
import { useSignals as _useSignals13 } from "@preact-signals/safe-react/tracking";
|
|
1688
|
+
import React11, { Fragment, useEffect as useEffect7, useState as useState12 } from "react";
|
|
1689
|
+
import { Function } from "@dxos/functions";
|
|
1690
|
+
import { log as log5 } from "@dxos/log";
|
|
1691
|
+
import { Filter as Filter4, useQuery as useQuery3 } from "@dxos/react-client/echo";
|
|
1692
|
+
import { useTranslation as useTranslation7 } from "@dxos/react-ui";
|
|
1693
|
+
import { mx as mx6 } from "@dxos/react-ui-theme";
|
|
1694
|
+
var __dxlog_file5 = "/__w/dxos/dxos/packages/plugins/plugin-assistant/src/components/Toolbox/Toolbox.tsx";
|
|
1695
|
+
var Toolbox = ({ classNames, functions, services, blueprints, activeBlueprints }) => {
|
|
1696
|
+
var _effect = _useSignals13();
|
|
1697
|
+
try {
|
|
1698
|
+
const { t } = useTranslation7(meta.id);
|
|
1699
|
+
return /* @__PURE__ */ React11.createElement("div", {
|
|
1700
|
+
className: mx6("flex flex-col overflow-y-auto box-content", classNames)
|
|
1701
|
+
}, blueprints && blueprints.length > 0 && /* @__PURE__ */ React11.createElement(Section, {
|
|
1702
|
+
title: "Blueprints",
|
|
1703
|
+
items: blueprints.map(({ target }) => ({
|
|
1704
|
+
name: target?.name ?? "",
|
|
1705
|
+
description: target?.description ?? "",
|
|
1706
|
+
subitems: target?.tools.map((toolId) => ({
|
|
1707
|
+
name: `\u2219 ${safeToolId(toolId)}`
|
|
1708
|
+
}))
|
|
1709
|
+
}))
|
|
1710
|
+
}), activeBlueprints && activeBlueprints.length > 0 && /* @__PURE__ */ React11.createElement(Section, {
|
|
1711
|
+
title: "Blueprints",
|
|
1712
|
+
items: activeBlueprints.map(({ target }) => ({
|
|
1713
|
+
name: target?.name ?? "",
|
|
1714
|
+
description: target?.description ?? "",
|
|
1715
|
+
subitems: target?.tools.map((toolId) => ({
|
|
1716
|
+
name: `\u2219 ${safeToolId(toolId)}`
|
|
1717
|
+
}))
|
|
1718
|
+
}))
|
|
1719
|
+
}), services && services.length > 0 && /* @__PURE__ */ React11.createElement(Section, {
|
|
1720
|
+
title: "Services",
|
|
1721
|
+
items: services.map(({ service: { serviceId, name, description } }) => ({
|
|
1722
|
+
name: name ?? serviceId,
|
|
1723
|
+
description
|
|
1724
|
+
}))
|
|
1725
|
+
}), functions && functions.length > 0 && /* @__PURE__ */ React11.createElement(Section, {
|
|
1726
|
+
title: "Functions",
|
|
1727
|
+
items: functions.map(({ name, description }) => ({
|
|
1728
|
+
name,
|
|
1729
|
+
description
|
|
1730
|
+
}))
|
|
1731
|
+
}));
|
|
1732
|
+
} finally {
|
|
1733
|
+
_effect.f();
|
|
1734
|
+
}
|
|
1735
|
+
};
|
|
1736
|
+
var Section = ({ title, items, striped }) => {
|
|
1737
|
+
var _effect = _useSignals13();
|
|
1738
|
+
try {
|
|
1739
|
+
const stripeClassNames = "odd:bg-neutral-50 dark:odd:bg-neutral-800";
|
|
1740
|
+
const gridClassNames = "grid grid-cols-[8rem_1fr]";
|
|
1741
|
+
const subGridClassNames = mx6("col-span-full grid grid-cols-subgrid text-xs pli-2", striped && stripeClassNames);
|
|
1742
|
+
return /* @__PURE__ */ React11.createElement("div", null, /* @__PURE__ */ React11.createElement("h1", {
|
|
1743
|
+
className: "pli-2 text-sm"
|
|
1744
|
+
}, title), /* @__PURE__ */ React11.createElement("div", {
|
|
1745
|
+
className: gridClassNames
|
|
1746
|
+
}, items.map(({ name, description, subitems }, i) => /* @__PURE__ */ React11.createElement(Fragment, {
|
|
1747
|
+
key: i
|
|
1748
|
+
}, name && /* @__PURE__ */ React11.createElement("div", {
|
|
1749
|
+
className: subGridClassNames
|
|
1750
|
+
}, /* @__PURE__ */ React11.createElement("div", {
|
|
1751
|
+
className: "truncate text-primary-500"
|
|
1752
|
+
}, name), /* @__PURE__ */ React11.createElement("div", {
|
|
1753
|
+
className: "line-clamp-2"
|
|
1754
|
+
}, description)), subitems?.map(({ name: name2, description: description2 }, i2) => /* @__PURE__ */ React11.createElement("div", {
|
|
1755
|
+
key: i2,
|
|
1756
|
+
className: mx6(subGridClassNames, striped && stripeClassNames)
|
|
1757
|
+
}, /* @__PURE__ */ React11.createElement("div", {
|
|
1758
|
+
className: "truncate"
|
|
1759
|
+
}, name2), /* @__PURE__ */ React11.createElement("div", {
|
|
1760
|
+
className: "line-clamp-3 text-subdued"
|
|
1761
|
+
}, description2)))))));
|
|
1762
|
+
} finally {
|
|
1763
|
+
_effect.f();
|
|
1764
|
+
}
|
|
1765
|
+
};
|
|
1766
|
+
var ToolboxContainer = ({ classNames, space, processor }) => {
|
|
1767
|
+
var _effect = _useSignals13();
|
|
1768
|
+
try {
|
|
1769
|
+
const services = useQuery3(space, Filter4.type(ServiceType));
|
|
1770
|
+
const [serviceTools, setServiceTools] = useState12([]);
|
|
1771
|
+
useEffect7(() => {
|
|
1772
|
+
log5("creating service tools...", {
|
|
1773
|
+
services: services.length
|
|
1774
|
+
}, {
|
|
1775
|
+
F: __dxlog_file5,
|
|
1776
|
+
L: 117,
|
|
1777
|
+
S: void 0,
|
|
1778
|
+
C: (f, a) => f(...a)
|
|
1779
|
+
});
|
|
1780
|
+
queueMicrotask(async () => {
|
|
1781
|
+
});
|
|
1782
|
+
}, [
|
|
1783
|
+
services
|
|
1784
|
+
]);
|
|
1785
|
+
const functions = useQuery3(space, Filter4.type(Function.Function));
|
|
1786
|
+
return /* @__PURE__ */ React11.createElement(Toolbox, {
|
|
1787
|
+
classNames,
|
|
1788
|
+
blueprints: processor?.context.blueprints.value,
|
|
1789
|
+
services: serviceTools,
|
|
1790
|
+
functions
|
|
1791
|
+
});
|
|
1792
|
+
} finally {
|
|
1793
|
+
_effect.f();
|
|
1794
|
+
}
|
|
1795
|
+
};
|
|
1796
|
+
var safeToolId = (name) => {
|
|
1797
|
+
return name.split("_").pop();
|
|
1798
|
+
};
|
|
1799
|
+
|
|
1800
|
+
// src/components/index.ts
|
|
1801
|
+
var BlueprintArticle = lazy(() => import("./BlueprintArticle-UGPRZRBG.mjs"));
|
|
1802
|
+
var ChatCompanion = lazy(() => import("./ChatCompanion-BZGANK56.mjs"));
|
|
1803
|
+
var ChatContainer = lazy(() => import("./ChatContainer-OG6Y3NHI.mjs"));
|
|
1804
|
+
var ChatDialog = lazy(() => import("./ChatDialog-NKNUCC3R.mjs"));
|
|
1805
|
+
var PromptArticle = lazy(() => import("./PromptArticle-QNJAXD5Y.mjs"));
|
|
1806
|
+
|
|
1807
|
+
// src/hooks/useChatToolbarActions.ts
|
|
1808
|
+
var __dxlog_file6 = "/__w/dxos/dxos/packages/plugins/plugin-assistant/src/hooks/useChatToolbarActions.ts";
|
|
1809
|
+
var useChatToolbarActions = ({ chat, companionTo }) => {
|
|
1810
|
+
const { dispatch } = useIntentDispatcher();
|
|
1811
|
+
const { space } = useChatContext("useChatToolbarActions");
|
|
1812
|
+
const query = companionTo ? Query.select(Filter5.ids(companionTo.id)).targetOf(Assistant_exports.CompanionTo).source() : Query.select(Filter5.nothing());
|
|
1813
|
+
const chats = useQuery4(space, query);
|
|
1814
|
+
return useMenuActions(useMemo10(() => {
|
|
1815
|
+
return Atom.make(() => {
|
|
1816
|
+
const builder = MenuBuilder.make().root({
|
|
1817
|
+
label: [
|
|
1818
|
+
"chat toolbar title",
|
|
1819
|
+
{
|
|
1820
|
+
ns: meta.id
|
|
1821
|
+
}
|
|
1822
|
+
]
|
|
1823
|
+
}).action("new", {
|
|
1824
|
+
label: [
|
|
1825
|
+
"new thread button",
|
|
1826
|
+
{
|
|
1827
|
+
ns: meta.id
|
|
1828
|
+
}
|
|
1829
|
+
],
|
|
1830
|
+
icon: "ph--plus--regular",
|
|
1831
|
+
type: "new"
|
|
1832
|
+
}, () => dispatch(createIntent(AssistantAction_exports.SetCurrentChat, {
|
|
1833
|
+
companionTo,
|
|
1834
|
+
chat: void 0
|
|
1835
|
+
})).pipe(Effect2.runPromise)).action("rename", {
|
|
1836
|
+
label: [
|
|
1837
|
+
"rename thread button",
|
|
1838
|
+
{
|
|
1839
|
+
ns: meta.id
|
|
1840
|
+
}
|
|
1841
|
+
],
|
|
1842
|
+
icon: "ph--magic-wand--regular",
|
|
1843
|
+
type: "rename",
|
|
1844
|
+
disabled: !chat
|
|
1845
|
+
}, () => Effect2.gen(function* () {
|
|
1846
|
+
invariant(chat, void 0, {
|
|
1847
|
+
F: __dxlog_file6,
|
|
1848
|
+
L: 68,
|
|
1849
|
+
S: this,
|
|
1850
|
+
A: [
|
|
1851
|
+
"chat",
|
|
1852
|
+
""
|
|
1853
|
+
]
|
|
1854
|
+
});
|
|
1855
|
+
yield* dispatch(createIntent(AssistantAction_exports.UpdateChatName, {
|
|
1856
|
+
chat
|
|
1857
|
+
}));
|
|
1858
|
+
}).pipe(Effect2.runPromise)).action("branch", {
|
|
1859
|
+
label: [
|
|
1860
|
+
"button branch thread",
|
|
1861
|
+
{
|
|
1862
|
+
ns: meta.id
|
|
1863
|
+
}
|
|
1864
|
+
],
|
|
1865
|
+
icon: "ph--git-branch--regular",
|
|
1866
|
+
type: "branch",
|
|
1867
|
+
disabled: true
|
|
1868
|
+
}, () => {
|
|
1869
|
+
});
|
|
1870
|
+
if (chats.length > 0) {
|
|
1871
|
+
builder.group("chats", {
|
|
1872
|
+
label: [
|
|
1873
|
+
"chat history label",
|
|
1874
|
+
{
|
|
1875
|
+
ns: meta.id
|
|
1876
|
+
}
|
|
1877
|
+
],
|
|
1878
|
+
icon: "ph--clock-counter-clockwise--regular",
|
|
1879
|
+
selectCardinality: "single",
|
|
1880
|
+
variant: "dropdownMenu"
|
|
1881
|
+
}, (builder2) => {
|
|
1882
|
+
chats.toSorted((a, b) => a.id.localeCompare(b.id)).forEach((chat2) => {
|
|
1883
|
+
builder2.action(chat2.id, {
|
|
1884
|
+
label: Obj6.getLabel(chat2) ?? [
|
|
1885
|
+
"object name placeholder",
|
|
1886
|
+
{
|
|
1887
|
+
ns: Assistant_exports.Chat.typename
|
|
1888
|
+
}
|
|
1889
|
+
]
|
|
1890
|
+
}, () => Effect2.gen(function* () {
|
|
1891
|
+
invariant(companionTo, void 0, {
|
|
1892
|
+
F: __dxlog_file6,
|
|
1893
|
+
L: 104,
|
|
1894
|
+
S: this,
|
|
1895
|
+
A: [
|
|
1896
|
+
"companionTo",
|
|
1897
|
+
""
|
|
1898
|
+
]
|
|
1899
|
+
});
|
|
1900
|
+
yield* dispatch(createIntent(AssistantAction_exports.SetCurrentChat, {
|
|
1901
|
+
companionTo,
|
|
1902
|
+
chat: chat2
|
|
1903
|
+
}));
|
|
1904
|
+
}).pipe(Effect2.runPromise));
|
|
1905
|
+
});
|
|
1906
|
+
});
|
|
1907
|
+
}
|
|
1908
|
+
return builder.build();
|
|
1909
|
+
});
|
|
1910
|
+
}, [
|
|
1911
|
+
chats.length,
|
|
1912
|
+
space?.id,
|
|
1913
|
+
companionTo?.id,
|
|
1914
|
+
chat?.id,
|
|
1915
|
+
dispatch
|
|
1916
|
+
]));
|
|
1774
1917
|
};
|
|
1775
1918
|
|
|
1776
1919
|
export {
|
|
1920
|
+
AssistantSettings,
|
|
1777
1921
|
useBlueprintRegistry,
|
|
1778
1922
|
useBlueprints,
|
|
1779
1923
|
useActiveBlueprints,
|
|
1780
1924
|
useBlueprintHandlers,
|
|
1781
1925
|
useChatProcessor,
|
|
1782
1926
|
useChatServices,
|
|
1927
|
+
useChatToolbarActions,
|
|
1783
1928
|
useContextBinder,
|
|
1784
1929
|
useContextObjects,
|
|
1785
1930
|
useFlush,
|
|
@@ -1789,6 +1934,13 @@ export {
|
|
|
1789
1934
|
useReferencesProvider,
|
|
1790
1935
|
ChatContextProvider,
|
|
1791
1936
|
useChatContext,
|
|
1792
|
-
Chat
|
|
1937
|
+
Chat,
|
|
1938
|
+
Toolbox,
|
|
1939
|
+
ToolboxContainer,
|
|
1940
|
+
BlueprintArticle,
|
|
1941
|
+
ChatCompanion,
|
|
1942
|
+
ChatContainer,
|
|
1943
|
+
ChatDialog,
|
|
1944
|
+
PromptArticle
|
|
1793
1945
|
};
|
|
1794
|
-
//# sourceMappingURL=chunk-
|
|
1946
|
+
//# sourceMappingURL=chunk-Y4C2CMME.mjs.map
|