@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
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
+
import { defaultHighlightStyle, syntaxHighlighting } from '@codemirror/language';
|
|
5
6
|
import React from 'react';
|
|
6
7
|
|
|
7
8
|
import { type Template } from '@dxos/blueprints';
|
|
@@ -16,18 +17,19 @@ import {
|
|
|
16
17
|
useTextEditor,
|
|
17
18
|
} from '@dxos/react-ui-editor';
|
|
18
19
|
import { mx } from '@dxos/react-ui-theme';
|
|
19
|
-
import {
|
|
20
|
+
import { isNonNullable } from '@dxos/util';
|
|
20
21
|
|
|
21
22
|
import { meta } from '../../meta';
|
|
22
23
|
|
|
23
|
-
import { handlebars } from './
|
|
24
|
+
import { handlebars, xmlDecorator } from './extensions';
|
|
24
25
|
|
|
25
26
|
export type TemplateEditorProps = ThemedClassName<{
|
|
26
27
|
id: string;
|
|
27
28
|
template: Template.Template;
|
|
29
|
+
lineNumbers?: boolean;
|
|
28
30
|
}>;
|
|
29
31
|
|
|
30
|
-
export const TemplateEditor = ({ id, classNames, template }: TemplateEditorProps) => {
|
|
32
|
+
export const TemplateEditor = ({ id, classNames, template, lineNumbers = true }: TemplateEditorProps) => {
|
|
31
33
|
const { t } = useTranslation(meta.id);
|
|
32
34
|
const { themeMode } = useThemeContext();
|
|
33
35
|
const { parentRef } = useTextEditor(() => {
|
|
@@ -39,20 +41,27 @@ export const TemplateEditor = ({ id, classNames, template }: TemplateEditorProps
|
|
|
39
41
|
return {
|
|
40
42
|
initialValue: text.content ?? '',
|
|
41
43
|
extensions: [
|
|
42
|
-
createDataExtensions({
|
|
44
|
+
createDataExtensions({
|
|
45
|
+
id,
|
|
46
|
+
text: createDocAccessor(text, ['content']),
|
|
47
|
+
}),
|
|
43
48
|
createBasicExtensions({
|
|
44
49
|
bracketMatching: false,
|
|
45
|
-
lineNumbers
|
|
50
|
+
lineNumbers,
|
|
46
51
|
lineWrapping: true,
|
|
47
52
|
placeholder: t('template placeholder'),
|
|
48
53
|
}),
|
|
49
|
-
createThemeExtensions({ themeMode }),
|
|
54
|
+
createThemeExtensions({ themeMode, slots: { content: { className: '!pie-4' } } }),
|
|
50
55
|
createMarkdownExtensions(),
|
|
51
56
|
decorateMarkdown(),
|
|
52
57
|
handlebars(),
|
|
53
|
-
|
|
58
|
+
// xml(),
|
|
59
|
+
// NOTE: Since we're using markdown only HTML nodes are parsed.
|
|
60
|
+
xmlDecorator(),
|
|
61
|
+
syntaxHighlighting(defaultHighlightStyle),
|
|
62
|
+
].filter(isNonNullable),
|
|
54
63
|
};
|
|
55
|
-
}, [themeMode, template.source?.target]);
|
|
64
|
+
}, [themeMode, template.source?.target, lineNumbers]);
|
|
56
65
|
|
|
57
66
|
return <div ref={parentRef} className={mx('bs-full overflow-hidden', classNames)} />;
|
|
58
67
|
};
|
|
@@ -8,7 +8,7 @@ import React, { useState } from 'react';
|
|
|
8
8
|
import { Blueprint, Template } from '@dxos/blueprints';
|
|
9
9
|
import { useClient } from '@dxos/react-client';
|
|
10
10
|
import { withClientProvider } from '@dxos/react-client/testing';
|
|
11
|
-
import { withTheme } from '@dxos/react-ui/testing';
|
|
11
|
+
import { withLayout, withTheme } from '@dxos/react-ui/testing';
|
|
12
12
|
import { trim } from '@dxos/util';
|
|
13
13
|
|
|
14
14
|
import { translations } from '../../translations';
|
|
@@ -51,6 +51,7 @@ const meta = {
|
|
|
51
51
|
render: DefaultStory,
|
|
52
52
|
decorators: [
|
|
53
53
|
withTheme,
|
|
54
|
+
withLayout({ container: 'column' }),
|
|
54
55
|
withClientProvider({
|
|
55
56
|
types: [Blueprint.Blueprint],
|
|
56
57
|
createIdentity: true,
|
|
@@ -58,7 +59,6 @@ const meta = {
|
|
|
58
59
|
}),
|
|
59
60
|
],
|
|
60
61
|
parameters: {
|
|
61
|
-
layout: 'column',
|
|
62
62
|
translations,
|
|
63
63
|
},
|
|
64
64
|
} satisfies Meta<typeof TemplateForm>;
|
|
@@ -26,7 +26,7 @@ export const TemplateForm = ({ id, template, commandEditable = true }: TemplateF
|
|
|
26
26
|
usePromptInputs(template);
|
|
27
27
|
|
|
28
28
|
return (
|
|
29
|
-
<div className={mx('flex flex-col
|
|
29
|
+
<div className={mx('flex flex-col is-full overflow-hidden gap-4', groupBorder)}>
|
|
30
30
|
{/* {commandEditable && (
|
|
31
31
|
<div className='flex items-center pl-4'>
|
|
32
32
|
<span className='text-neutral-500'>/</span>
|
|
@@ -0,0 +1,269 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import {
|
|
6
|
+
type CompletionContext,
|
|
7
|
+
type CompletionResult,
|
|
8
|
+
autocompletion,
|
|
9
|
+
completionKeymap,
|
|
10
|
+
} from '@codemirror/autocomplete';
|
|
11
|
+
import { type Extension, RangeSetBuilder } from '@codemirror/state';
|
|
12
|
+
import {
|
|
13
|
+
Decoration,
|
|
14
|
+
type DecorationSet,
|
|
15
|
+
type EditorView,
|
|
16
|
+
ViewPlugin,
|
|
17
|
+
type ViewUpdate,
|
|
18
|
+
WidgetType,
|
|
19
|
+
keymap,
|
|
20
|
+
} from '@codemirror/view';
|
|
21
|
+
|
|
22
|
+
import { Domino } from '@dxos/react-ui';
|
|
23
|
+
import { mx } from '@dxos/react-ui-theme';
|
|
24
|
+
|
|
25
|
+
export type HandlebarsOptions = {};
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Simple Handlebars plugin for CodeMirror.
|
|
29
|
+
* Supports:
|
|
30
|
+
* - Comments: {{! comment }}
|
|
31
|
+
* - Commands: {{#command}} {{/command}}
|
|
32
|
+
* - Variables: {{var}}
|
|
33
|
+
* - Commands with variables: {{#each items}} {{/each}}
|
|
34
|
+
*/
|
|
35
|
+
export const handlebars = (_: HandlebarsOptions = {}): Extension => {
|
|
36
|
+
return [
|
|
37
|
+
handlebarsHighlightPlugin,
|
|
38
|
+
autocompletion({
|
|
39
|
+
activateOnTyping: true,
|
|
40
|
+
aboveCursor: true,
|
|
41
|
+
closeOnBlur: true,
|
|
42
|
+
override: [handlebarsCompletions],
|
|
43
|
+
}),
|
|
44
|
+
keymap.of(completionKeymap),
|
|
45
|
+
];
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
const regex = {
|
|
49
|
+
// {{! comment }}
|
|
50
|
+
comment: /\{\{!\s*[^}]*\}\}/g,
|
|
51
|
+
|
|
52
|
+
// {{var}}
|
|
53
|
+
brackets: /\{\{[^}]*\}\}/g,
|
|
54
|
+
|
|
55
|
+
// {{#command}} {{/command}}
|
|
56
|
+
command: /\{\{[#/]([^}]+)\}\}/g,
|
|
57
|
+
|
|
58
|
+
// {{var}}
|
|
59
|
+
var: /\{\{(?!\s*!)(\w[^}]*)\}\}/g,
|
|
60
|
+
|
|
61
|
+
// @dxn:queue:data:xxx
|
|
62
|
+
dxn: /@?dxn:[\w@:]+/g,
|
|
63
|
+
|
|
64
|
+
// dxos.org/type/xxx
|
|
65
|
+
url: /[\w.-]+\.[\w.-]+\/[\w/]+/g,
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
const tagPadding = 'mli-0.5 pli-1 rounded-sm';
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* ViewPlugin that decorates Handlebars syntax.
|
|
72
|
+
*/
|
|
73
|
+
const handlebarsHighlightPlugin = ViewPlugin.fromClass(
|
|
74
|
+
class {
|
|
75
|
+
decorations: DecorationSet;
|
|
76
|
+
|
|
77
|
+
constructor(view: EditorView) {
|
|
78
|
+
this.decorations = this.buildDecorations(view);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
update(update: ViewUpdate) {
|
|
82
|
+
if (update.docChanged || update.viewportChanged || update.selectionSet) {
|
|
83
|
+
this.decorations = this.buildDecorations(update.view);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// NOTE: Decorations may clash with other extensions (e.g., markdown).
|
|
88
|
+
buildDecorations(view: EditorView) {
|
|
89
|
+
const selection = view.state.selection.main;
|
|
90
|
+
const decorations: Array<{ from: number; to: number; decoration: Decoration }> = [];
|
|
91
|
+
|
|
92
|
+
for (const { from, to } of view.visibleRanges) {
|
|
93
|
+
const text = view.state.doc.sliceString(from, to);
|
|
94
|
+
|
|
95
|
+
// Match DXN.
|
|
96
|
+
{
|
|
97
|
+
let match;
|
|
98
|
+
while ((match = regex.dxn.exec(text)) !== null) {
|
|
99
|
+
const start = from + match.index;
|
|
100
|
+
const end = start + match[0].length;
|
|
101
|
+
// Only show widget if selection doesn't overlap with the match range.
|
|
102
|
+
const overlaps = selection.to > start && selection.from <= end;
|
|
103
|
+
if (!overlaps) {
|
|
104
|
+
decorations.push({
|
|
105
|
+
from: start,
|
|
106
|
+
to: end,
|
|
107
|
+
decoration: Decoration.widget({
|
|
108
|
+
widget: new DXNWidget(match[0]),
|
|
109
|
+
}),
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
// Match URLs.
|
|
116
|
+
{
|
|
117
|
+
let match;
|
|
118
|
+
while ((match = regex.url.exec(text)) !== null) {
|
|
119
|
+
const start = from + match.index;
|
|
120
|
+
const end = start + match[0].length;
|
|
121
|
+
decorations.push({
|
|
122
|
+
from: start,
|
|
123
|
+
to: end,
|
|
124
|
+
decoration: Decoration.mark({ class: mx('dx-tag--blue', tagPadding) }),
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
// Match brackets: {{ and }}.
|
|
130
|
+
{
|
|
131
|
+
let match;
|
|
132
|
+
while ((match = regex.brackets.exec(text)) !== null) {
|
|
133
|
+
const start = from + match.index;
|
|
134
|
+
const end = start + match[0].length;
|
|
135
|
+
decorations.push({
|
|
136
|
+
from: start,
|
|
137
|
+
to: end,
|
|
138
|
+
decoration: Decoration.mark({ class: 'text-subdued' }),
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
// Match commands: {{#command}} and {{/command}}.
|
|
144
|
+
{
|
|
145
|
+
let match;
|
|
146
|
+
while ((match = regex.command.exec(text)) !== null) {
|
|
147
|
+
const start = from + match.index + 2;
|
|
148
|
+
let end = start + match[0].length - 4;
|
|
149
|
+
const text = view.state.doc.sliceString(start, end);
|
|
150
|
+
const parts = text.split(/\s+/);
|
|
151
|
+
if (parts.length > 1) {
|
|
152
|
+
const idx = start + parts[0].length;
|
|
153
|
+
decorations.push({
|
|
154
|
+
from: idx,
|
|
155
|
+
to: end,
|
|
156
|
+
decoration: Decoration.mark({ class: 'text-greenText' }),
|
|
157
|
+
});
|
|
158
|
+
end = idx;
|
|
159
|
+
}
|
|
160
|
+
decorations.push({
|
|
161
|
+
from: start,
|
|
162
|
+
to: end,
|
|
163
|
+
decoration: Decoration.mark({ class: 'text-blueText' }),
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
// Match variables: {{var}}.
|
|
169
|
+
{
|
|
170
|
+
let match;
|
|
171
|
+
while ((match = regex.var.exec(text)) !== null) {
|
|
172
|
+
const start = from + match.index + 2;
|
|
173
|
+
const end = start + match[0].length - 4;
|
|
174
|
+
decorations.push({
|
|
175
|
+
from: start,
|
|
176
|
+
to: end,
|
|
177
|
+
decoration: Decoration.mark({ class: 'text-greenText' }),
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
// Sort decorations by position to satisfy RangeSetBuilder requirements.
|
|
184
|
+
decorations.sort((a, b) => a.from - b.from || a.to - b.to);
|
|
185
|
+
|
|
186
|
+
// Add sorted decorations to builder.
|
|
187
|
+
const builder = new RangeSetBuilder<Decoration>();
|
|
188
|
+
for (const { from, to, decoration } of decorations) {
|
|
189
|
+
builder.add(from, to, decoration);
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
return builder.finish();
|
|
193
|
+
}
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
decorations: (v) => v.decorations,
|
|
197
|
+
},
|
|
198
|
+
);
|
|
199
|
+
|
|
200
|
+
class DXNWidget extends WidgetType {
|
|
201
|
+
constructor(private readonly _identifier: string) {
|
|
202
|
+
super();
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
override ignoreEvent() {
|
|
206
|
+
return false;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
override eq(other: this) {
|
|
210
|
+
return this._identifier === other._identifier;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
override toDOM() {
|
|
214
|
+
const text = this._identifier
|
|
215
|
+
.split(':')
|
|
216
|
+
.map((part) => {
|
|
217
|
+
const len = 16;
|
|
218
|
+
const plen = 4;
|
|
219
|
+
if (part.length > len) {
|
|
220
|
+
return `[${part.slice(0, plen)}…${part.slice(-plen)}]`;
|
|
221
|
+
}
|
|
222
|
+
return part;
|
|
223
|
+
})
|
|
224
|
+
.join(':');
|
|
225
|
+
return Domino.of('span').classNames(['font-mono dx-tag--blue', tagPadding]).text(text).build();
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
// TODO(burdon): Pass in variables.
|
|
230
|
+
const variables = ['this'];
|
|
231
|
+
const commands = ['this', 'each', 'if', 'unless', 'with'];
|
|
232
|
+
|
|
233
|
+
/**
|
|
234
|
+
* Provides completions for Handlebars variables.
|
|
235
|
+
*/
|
|
236
|
+
function handlebarsCompletions(context: CompletionContext): CompletionResult | null {
|
|
237
|
+
const match = context.matchBefore(/\{\{[^}]*/);
|
|
238
|
+
if (!match || match.from === match.to) {
|
|
239
|
+
return null;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
let type = 'variable';
|
|
243
|
+
let text = match.text.slice(2);
|
|
244
|
+
let from = match.from + 2;
|
|
245
|
+
let matches = [];
|
|
246
|
+
if (text.startsWith('#') || text.startsWith('/')) {
|
|
247
|
+
const idx = text.lastIndexOf(' ');
|
|
248
|
+
if (idx !== -1) {
|
|
249
|
+
type = 'variable';
|
|
250
|
+
matches = variables;
|
|
251
|
+
text = text.slice(idx + 1);
|
|
252
|
+
from += idx + 1;
|
|
253
|
+
} else {
|
|
254
|
+
type = 'command';
|
|
255
|
+
text = text.slice(1);
|
|
256
|
+
matches = commands;
|
|
257
|
+
from += 1;
|
|
258
|
+
}
|
|
259
|
+
} else {
|
|
260
|
+
type = 'variable';
|
|
261
|
+
matches = variables;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
const options = matches.filter((name) => name.startsWith(text)).map((name) => ({ type, label: name }));
|
|
265
|
+
return {
|
|
266
|
+
from,
|
|
267
|
+
options,
|
|
268
|
+
};
|
|
269
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { syntaxTree } from '@codemirror/language';
|
|
6
|
+
import { type Extension, RangeSetBuilder } from '@codemirror/state';
|
|
7
|
+
import { Decoration, type DecorationSet, type EditorView, ViewPlugin, type ViewUpdate } from '@codemirror/view';
|
|
8
|
+
|
|
9
|
+
export type XmlOptions = {};
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* XML decorator plugin for CodeMirror.
|
|
13
|
+
* Decorates XML tags with monospace font using the XML language grammar.
|
|
14
|
+
*/
|
|
15
|
+
export const xmlDecorator = (_: XmlOptions = {}): Extension => {
|
|
16
|
+
return [xmlDecoratorPlugin];
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* ViewPlugin that decorates XML tags using syntax tree.
|
|
21
|
+
*/
|
|
22
|
+
const xmlDecoratorPlugin = ViewPlugin.fromClass(
|
|
23
|
+
class {
|
|
24
|
+
decorations: DecorationSet;
|
|
25
|
+
|
|
26
|
+
constructor(view: EditorView) {
|
|
27
|
+
this.decorations = this.buildDecorations(view);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
update(update: ViewUpdate) {
|
|
31
|
+
if (update.docChanged || update.viewportChanged) {
|
|
32
|
+
this.decorations = this.buildDecorations(update.view);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
buildDecorations(view: EditorView) {
|
|
37
|
+
const builder = new RangeSetBuilder<Decoration>();
|
|
38
|
+
|
|
39
|
+
for (const { from, to } of view.visibleRanges) {
|
|
40
|
+
syntaxTree(view.state).iterate({
|
|
41
|
+
from,
|
|
42
|
+
to,
|
|
43
|
+
enter: (node) => {
|
|
44
|
+
// Decorate XML elements (opening tags, closing tags, self-closing tags).
|
|
45
|
+
if (
|
|
46
|
+
node.name === 'HTMLTag' ||
|
|
47
|
+
node.name === 'OpenTag' ||
|
|
48
|
+
node.name === 'CloseTag' ||
|
|
49
|
+
node.name === 'SelfClosingTag' ||
|
|
50
|
+
node.name === 'Element'
|
|
51
|
+
) {
|
|
52
|
+
builder.add(node.from, node.to, Decoration.mark({ class: 'font-mono text-subdued' }));
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
return builder.finish();
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
decorations: (v) => v.decorations,
|
|
63
|
+
},
|
|
64
|
+
);
|
|
@@ -3,45 +3,29 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import type * as Tool from '@effect/ai/Tool';
|
|
6
|
-
import React, { useEffect, useMemo, useRef, useState } from 'react';
|
|
6
|
+
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
7
7
|
|
|
8
|
-
import { type AgentStatus } from '@dxos/ai';
|
|
9
8
|
import { useTranslation } from '@dxos/react-ui';
|
|
10
|
-
import {
|
|
11
|
-
|
|
12
|
-
TextCrawl,
|
|
13
|
-
ToggleContainer,
|
|
14
|
-
chatMessageJson,
|
|
15
|
-
chatMessagePanel,
|
|
16
|
-
chatMessagePanelContent,
|
|
17
|
-
chatMessagePanelHeader,
|
|
18
|
-
} from '@dxos/react-ui-components';
|
|
9
|
+
import { NumericTabs, TextCrawl, ToggleContainer, type ToggleContainerRootProps } from '@dxos/react-ui-components';
|
|
10
|
+
import { type XmlWidgetProps } from '@dxos/react-ui-editor';
|
|
19
11
|
import { Json } from '@dxos/react-ui-syntax-highlighter';
|
|
20
|
-
import { type ContentBlock, type
|
|
12
|
+
import { type ContentBlock, type Message } from '@dxos/types';
|
|
21
13
|
import { isNonNullable, safeParseJson } from '@dxos/util';
|
|
22
14
|
|
|
23
15
|
import { meta } from '../../meta';
|
|
24
16
|
|
|
25
|
-
export const isToolMessage = (message:
|
|
26
|
-
return message.blocks.some((block) => block._tag === 'toolCall' || block._tag === 'toolResult');
|
|
17
|
+
export const isToolMessage = (message: Message.Message) => {
|
|
18
|
+
return message.blocks.some((block: ContentBlock.Any) => block._tag === 'toolCall' || block._tag === 'toolResult');
|
|
27
19
|
};
|
|
28
20
|
|
|
29
|
-
export type ToolBlockProps = {
|
|
21
|
+
export type ToolBlockProps = XmlWidgetProps<{
|
|
30
22
|
blocks: ContentBlock.Any[];
|
|
31
|
-
}
|
|
23
|
+
}>;
|
|
32
24
|
|
|
33
|
-
export const ToolBlock = ({ blocks = [] }: ToolBlockProps) => {
|
|
25
|
+
export const ToolBlock = ({ view, blocks = [] }: ToolBlockProps) => {
|
|
34
26
|
const { t } = useTranslation(meta.id);
|
|
35
27
|
|
|
36
|
-
const
|
|
37
|
-
if (!tool) {
|
|
38
|
-
return t('calling tool label');
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
return status?.message ?? tool.description ?? [t('calling label'), tool.name].join(' ');
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
const items = useMemo(() => {
|
|
28
|
+
const items = useMemo<ToolContainerParams['items']>(() => {
|
|
45
29
|
let lastToolCall: { tool: Tool.Any | undefined; block: ContentBlock.ToolCall } | undefined;
|
|
46
30
|
// TODO(burdon): Get from context?
|
|
47
31
|
const tools: Tool.Any[] = []; //processor.conversation.toolkit?.tools ?? [];
|
|
@@ -57,7 +41,7 @@ export const ToolBlock = ({ blocks = [] }: ToolBlockProps) => {
|
|
|
57
41
|
const tool = tools.find((tool) => tool.name === block.name);
|
|
58
42
|
lastToolCall = { tool, block };
|
|
59
43
|
return {
|
|
60
|
-
title:
|
|
44
|
+
title: tool?.description ?? [t('tool call label'), tool?.name].join(' '),
|
|
61
45
|
content: {
|
|
62
46
|
...block,
|
|
63
47
|
input: safeParseJson(block.input),
|
|
@@ -69,12 +53,13 @@ export const ToolBlock = ({ blocks = [] }: ToolBlockProps) => {
|
|
|
69
53
|
// TODO(burdon): Parse error type.
|
|
70
54
|
if (block.error) {
|
|
71
55
|
return {
|
|
72
|
-
title: t('error label'),
|
|
56
|
+
title: t('tool error label'),
|
|
73
57
|
content: block,
|
|
74
58
|
};
|
|
75
59
|
}
|
|
76
60
|
|
|
77
|
-
const title =
|
|
61
|
+
const title =
|
|
62
|
+
lastToolCall?.tool?.description ?? [t('tool result label'), lastToolCall?.tool?.name].join(' ');
|
|
78
63
|
lastToolCall = undefined;
|
|
79
64
|
return {
|
|
80
65
|
title,
|
|
@@ -100,46 +85,52 @@ export const ToolBlock = ({ blocks = [] }: ToolBlockProps) => {
|
|
|
100
85
|
.filter(isNonNullable);
|
|
101
86
|
}, [blocks]);
|
|
102
87
|
|
|
88
|
+
const handleChangeOpen = useCallback(() => {
|
|
89
|
+
setTimeout(() => {
|
|
90
|
+
// Measure after animation.
|
|
91
|
+
view?.requestMeasure();
|
|
92
|
+
}, 1_000);
|
|
93
|
+
}, [view]);
|
|
94
|
+
|
|
103
95
|
if (!items.length) {
|
|
104
96
|
return null;
|
|
105
97
|
}
|
|
106
98
|
|
|
107
|
-
return <ToolContainer items={items} />;
|
|
99
|
+
return <ToolContainer items={items} onChangeOpen={handleChangeOpen} />;
|
|
108
100
|
};
|
|
109
101
|
|
|
110
102
|
ToolBlock.displayName = 'ToolBlock';
|
|
111
103
|
|
|
112
104
|
type ToolContainerParams = {
|
|
113
105
|
items: { title: string; content: any }[];
|
|
114
|
-
}
|
|
106
|
+
} & Pick<ToggleContainerRootProps, 'onChangeOpen'>;
|
|
115
107
|
|
|
116
|
-
|
|
117
|
-
export const ToolContainer = ({ items }: ToolContainerParams) => {
|
|
108
|
+
export const ToolContainer = ({ items, onChangeOpen }: ToolContainerParams) => {
|
|
118
109
|
const tabsRef = useRef<HTMLDivElement>(null);
|
|
119
110
|
const [selected, setSelected] = useState(0);
|
|
120
111
|
const [open, setOpen] = useState(false);
|
|
112
|
+
|
|
121
113
|
useEffect(() => {
|
|
114
|
+
onChangeOpen?.(open);
|
|
122
115
|
if (open) {
|
|
123
116
|
tabsRef.current?.focus();
|
|
124
117
|
}
|
|
125
|
-
}, [open]);
|
|
118
|
+
}, [onChangeOpen, open]);
|
|
126
119
|
|
|
127
120
|
const handleSelect = (index: number) => {
|
|
128
121
|
setSelected(index);
|
|
129
122
|
};
|
|
130
123
|
|
|
131
|
-
const data = items[selected]?.content;
|
|
132
|
-
|
|
133
124
|
return (
|
|
134
|
-
<ToggleContainer.Root classNames=
|
|
135
|
-
<ToggleContainer.Header classNames=
|
|
136
|
-
<TextCrawl key='status-roll' lines={items.map((item) => item.title)} />
|
|
125
|
+
<ToggleContainer.Root classNames='mbs-2 is-full rounded-sm' open={open} onChangeOpen={setOpen}>
|
|
126
|
+
<ToggleContainer.Header classNames='text-sm text-placeholder'>
|
|
127
|
+
<TextCrawl key='status-roll' lines={items.map((item) => item.title)} autoAdvance greedy />
|
|
137
128
|
</ToggleContainer.Header>
|
|
138
|
-
<ToggleContainer.Content classNames=
|
|
129
|
+
<ToggleContainer.Content classNames='grid grid-cols-[32px_1fr]'>
|
|
139
130
|
<NumericTabs ref={tabsRef} classNames='p-1' length={items.length} selected={selected} onSelect={handleSelect} />
|
|
140
131
|
<Json
|
|
141
|
-
data={
|
|
142
|
-
classNames=
|
|
132
|
+
data={items[selected]?.content}
|
|
133
|
+
classNames='p-1 text-xs bg-transparent'
|
|
143
134
|
replacer={{
|
|
144
135
|
maxDepth: 3,
|
|
145
136
|
maxArrayLen: 10,
|
|
@@ -7,7 +7,7 @@ import React from 'react';
|
|
|
7
7
|
|
|
8
8
|
import { IntentPlugin, SettingsPlugin } from '@dxos/app-framework';
|
|
9
9
|
import { withPluginManager } from '@dxos/app-framework/testing';
|
|
10
|
-
import { capabilities } from '@dxos/assistant-
|
|
10
|
+
import { capabilities } from '@dxos/assistant-toolkit';
|
|
11
11
|
import { ChessPlugin } from '@dxos/plugin-chess';
|
|
12
12
|
import { ClientPlugin } from '@dxos/plugin-client';
|
|
13
13
|
import { MapPlugin } from '@dxos/plugin-map';
|
|
@@ -20,7 +20,7 @@ import { translations } from '../../translations';
|
|
|
20
20
|
import { Toolbox, type ToolboxProps } from './Toolbox';
|
|
21
21
|
|
|
22
22
|
const DefaultStory = (props: ToolboxProps) => {
|
|
23
|
-
return <Toolbox {...props} classNames='w-[30rem] h-[15rem] rounded-sm border border-separator
|
|
23
|
+
return <Toolbox {...props} classNames='w-[30rem] h-[15rem] rounded-sm border border-separator plb-1' />;
|
|
24
24
|
};
|
|
25
25
|
|
|
26
26
|
const meta = {
|
|
@@ -6,7 +6,7 @@ import React, { type FC, Fragment, useEffect, useState } from 'react';
|
|
|
6
6
|
|
|
7
7
|
import { type Blueprint } from '@dxos/blueprints';
|
|
8
8
|
import { type Ref } from '@dxos/echo';
|
|
9
|
-
import {
|
|
9
|
+
import { Function } from '@dxos/functions';
|
|
10
10
|
import { log } from '@dxos/log';
|
|
11
11
|
import { Filter, type Space, useQuery } from '@dxos/react-client/echo';
|
|
12
12
|
import { type ThemedClassName } from '@dxos/react-ui';
|
|
@@ -19,7 +19,7 @@ import { ServiceType } from '../../types';
|
|
|
19
19
|
|
|
20
20
|
export type ToolboxProps = ThemedClassName<{
|
|
21
21
|
services?: { service: ServiceType }[];
|
|
22
|
-
functions?:
|
|
22
|
+
functions?: Function.Function[];
|
|
23
23
|
// TODO(burdon): Combine into single array.
|
|
24
24
|
blueprints?: readonly Ref.Ref<Blueprint.Blueprint>[];
|
|
25
25
|
activeBlueprints?: readonly Ref.Ref<Blueprint.Blueprint>[];
|
|
@@ -77,11 +77,11 @@ const Section: FC<{
|
|
|
77
77
|
}> = ({ title, items, striped }) => {
|
|
78
78
|
const stripeClassNames = 'odd:bg-neutral-50 dark:odd:bg-neutral-800';
|
|
79
79
|
const gridClassNames = 'grid grid-cols-[8rem_1fr]';
|
|
80
|
-
const subGridClassNames = mx('col-span-full grid grid-cols-subgrid text-xs
|
|
80
|
+
const subGridClassNames = mx('col-span-full grid grid-cols-subgrid text-xs pli-2', striped && stripeClassNames);
|
|
81
81
|
|
|
82
82
|
return (
|
|
83
83
|
<div>
|
|
84
|
-
<h1 className='
|
|
84
|
+
<h1 className='pli-2 text-sm'>{title}</h1>
|
|
85
85
|
<div className={gridClassNames}>
|
|
86
86
|
{items.map(({ name, description, subitems }, i) => (
|
|
87
87
|
<Fragment key={i}>
|
|
@@ -125,7 +125,7 @@ export const ToolboxContainer = ({ classNames, space, processor }: ToolboxContai
|
|
|
125
125
|
}, [services]);
|
|
126
126
|
|
|
127
127
|
// Deployed functions.
|
|
128
|
-
const functions = useQuery(space, Filter.type(
|
|
128
|
+
const functions = useQuery(space, Filter.type(Function.Function));
|
|
129
129
|
|
|
130
130
|
return (
|
|
131
131
|
<Toolbox
|
package/src/components/index.ts
CHANGED
|
@@ -6,14 +6,11 @@ import { lazy } from 'react';
|
|
|
6
6
|
|
|
7
7
|
export * from './AssistantSettings';
|
|
8
8
|
export * from './Chat';
|
|
9
|
-
export * from './ChatProgress';
|
|
10
|
-
export * from './PromptSettings';
|
|
11
9
|
export * from './TemplateEditor';
|
|
12
|
-
export * from './Toolbar';
|
|
13
10
|
export * from './Toolbox';
|
|
14
11
|
|
|
15
|
-
export const
|
|
12
|
+
export const BlueprintArticle = lazy(() => import('./BlueprintArticle'));
|
|
16
13
|
export const ChatCompanion = lazy(() => import('./ChatCompanion'));
|
|
17
14
|
export const ChatContainer = lazy(() => import('./ChatContainer'));
|
|
18
15
|
export const ChatDialog = lazy(() => import('./ChatDialog'));
|
|
19
|
-
export const
|
|
16
|
+
export const PromptArticle = lazy(() => import('./PromptArticle'));
|
package/src/functions/index.ts
CHANGED