@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 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/Toolbar/index.ts"],"names":[],"mappings":"AAIA,cAAc,WAAW,CAAC"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { Obj } from '@dxos/echo';
|
|
2
|
-
import { Assistant } from '../../types';
|
|
3
|
-
export type ChatToolbarActionsProps = {
|
|
4
|
-
chat: Assistant.Chat;
|
|
5
|
-
companionTo?: Obj.Any;
|
|
6
|
-
onReset?: () => void;
|
|
7
|
-
};
|
|
8
|
-
export declare const useChatToolbarActions: ({ chat, companionTo, onReset }: ChatToolbarActionsProps) => {
|
|
9
|
-
useGroupItems: (sourceNode?: import("@dxos/react-ui-menu").MenuItemGroup) => import("@dxos/react-ui-menu").MenuItem[];
|
|
10
|
-
};
|
|
11
|
-
//# sourceMappingURL=useChatToolbarActions.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useChatToolbarActions.d.ts","sourceRoot":"","sources":["../../../../../src/components/Toolbar/useChatToolbarActions.ts"],"names":[],"mappings":"AASA,OAAO,EAAU,GAAG,EAAS,MAAM,YAAY,CAAC;AAOhD,OAAO,EAAE,SAAS,EAAmB,MAAM,aAAa,CAAC;AAEzD,MAAM,MAAM,uBAAuB,GAAG;IACpC,IAAI,EAAE,SAAS,CAAC,IAAI,CAAC;IACrB,WAAW,CAAC,EAAE,GAAG,CAAC,GAAG,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB,CAAC;AAEF,eAAO,MAAM,qBAAqB,GAAI,gCAAgC,uBAAuB;8BAX5E,CAAC;CAgHjB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../../src/functions/list.ts"],"names":[],"mappings":";;;;;;;;AAYA,wBAmCG"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"load.d.ts","sourceRoot":"","sources":["../../../../src/functions/load.ts"],"names":[],"mappings":";;;;;;AAeA,wBA8BG"}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import React from 'react';
|
|
6
|
-
|
|
7
|
-
import { type Blueprint } from '@dxos/blueprints';
|
|
8
|
-
import { StackItem } from '@dxos/react-ui-stack';
|
|
9
|
-
|
|
10
|
-
import { TemplateEditor } from './TemplateEditor';
|
|
11
|
-
|
|
12
|
-
export type BlueprintContainerProps = {
|
|
13
|
-
blueprint: Blueprint.Blueprint;
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
export const BlueprintContainer = ({ blueprint }: BlueprintContainerProps) => {
|
|
17
|
-
return (
|
|
18
|
-
<StackItem.Content>
|
|
19
|
-
<TemplateEditor id={blueprint.id} template={blueprint.instructions} classNames='container-max-width' />
|
|
20
|
-
</StackItem.Content>
|
|
21
|
-
);
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
export default BlueprintContainer;
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import React from 'react';
|
|
6
|
-
|
|
7
|
-
import { type Template } from '@dxos/blueprints';
|
|
8
|
-
import { Toolbar, useTranslation } from '@dxos/react-ui';
|
|
9
|
-
|
|
10
|
-
import { meta } from '../meta';
|
|
11
|
-
|
|
12
|
-
export const PromptSettings = ({ template }: { template: Template.Template }) => {
|
|
13
|
-
const { t } = useTranslation(meta.id);
|
|
14
|
-
|
|
15
|
-
// const handleKindChange = useCallback(
|
|
16
|
-
// (value: string) => {
|
|
17
|
-
// const kind = Match.type<string>().pipe(
|
|
18
|
-
// Match.withReturnType<Schema.Schema.Type<typeof Template.Template>>(),
|
|
19
|
-
// Match.when('always', () => ({ include: 'always' })),
|
|
20
|
-
// Match.when('schema-matching', () => ({ include: 'schema-matching', typename: '' })),
|
|
21
|
-
// Match.when('automatically', () => ({ include: 'automatically', description: '' })),
|
|
22
|
-
// Match.orElse(() => ({ include: 'manual' })),
|
|
23
|
-
// )(value);
|
|
24
|
-
//
|
|
25
|
-
// template.kind = kind;
|
|
26
|
-
// },
|
|
27
|
-
// [template],
|
|
28
|
-
// );
|
|
29
|
-
|
|
30
|
-
// const handleTypenameChange = useCallback(
|
|
31
|
-
// debounce((event: ChangeEvent<HTMLInputElement>) => {
|
|
32
|
-
// if (template.kind.include === 'schema-matching') {
|
|
33
|
-
// template.kind.typename = event.target.value;
|
|
34
|
-
// }
|
|
35
|
-
// }, 300),
|
|
36
|
-
// [template.kind.include],
|
|
37
|
-
// );
|
|
38
|
-
|
|
39
|
-
// const handleDescriptionChange = useCallback(
|
|
40
|
-
// debounce((event: ChangeEvent<HTMLInputElement>) => {
|
|
41
|
-
// if (template.kind.include === 'automatically') {
|
|
42
|
-
// template.kind.description = event.target.value;
|
|
43
|
-
// }
|
|
44
|
-
// }, 300),
|
|
45
|
-
// [template.kind.include],
|
|
46
|
-
// );
|
|
47
|
-
|
|
48
|
-
return (
|
|
49
|
-
<div className='flex flex-col gap-4'>
|
|
50
|
-
<h2>{t('prompt rules label')}</h2>
|
|
51
|
-
<Toolbar.Root>
|
|
52
|
-
{/* <Select.Root value={template.kind.include} onValueChange={handleKindChange}>
|
|
53
|
-
<Toolbar.Button asChild>
|
|
54
|
-
<Select.TriggerButton />
|
|
55
|
-
</Toolbar.Button>
|
|
56
|
-
<Select.Portal>
|
|
57
|
-
<Select.Content>
|
|
58
|
-
<Select.Viewport>
|
|
59
|
-
{Template.Kinds.map((kind) => (
|
|
60
|
-
<Select.Option key={kind} value={kind}>
|
|
61
|
-
{kind}
|
|
62
|
-
</Select.Option>
|
|
63
|
-
))}
|
|
64
|
-
</Select.Viewport>
|
|
65
|
-
<Select.Arrow />
|
|
66
|
-
</Select.Content>
|
|
67
|
-
</Select.Portal>
|
|
68
|
-
</Select.Root> */}
|
|
69
|
-
{/* {template.kind.include === 'schema-matching' && (
|
|
70
|
-
<Input.Root>
|
|
71
|
-
<Input.TextInput
|
|
72
|
-
placeholder={t('typename placeholder')}
|
|
73
|
-
defaultValue={template.kind.typename}
|
|
74
|
-
onChange={handleTypenameChange}
|
|
75
|
-
/>
|
|
76
|
-
</Input.Root>
|
|
77
|
-
)} */}
|
|
78
|
-
{/* {template.kind.include === 'automatically' && (
|
|
79
|
-
<Input.Root>
|
|
80
|
-
<Input.TextInput
|
|
81
|
-
placeholder={t('description placeholder')}
|
|
82
|
-
defaultValue={template.kind.description}
|
|
83
|
-
onChange={handleDescriptionChange}
|
|
84
|
-
/>
|
|
85
|
-
</Input.Root>
|
|
86
|
-
)} */}
|
|
87
|
-
</Toolbar.Root>
|
|
88
|
-
</div>
|
|
89
|
-
);
|
|
90
|
-
};
|
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { type EditorView } from '@codemirror/view';
|
|
6
|
-
import JSON5 from 'json5';
|
|
7
|
-
import React, { useCallback, useEffect, useRef, useState } from 'react';
|
|
8
|
-
|
|
9
|
-
import { type Sequence, type SequenceDefinition } from '@dxos/conductor';
|
|
10
|
-
import { Key } from '@dxos/echo';
|
|
11
|
-
import { Toolbar, useTranslation } from '@dxos/react-ui';
|
|
12
|
-
import { useSelectionManager } from '@dxos/react-ui-attention';
|
|
13
|
-
import { StackItem } from '@dxos/react-ui-stack';
|
|
14
|
-
|
|
15
|
-
import { meta } from '../meta';
|
|
16
|
-
|
|
17
|
-
import { SequenceEditor } from './SequenceEditor';
|
|
18
|
-
|
|
19
|
-
// TODO(burdon): Move to config.
|
|
20
|
-
export const EXA_API_KEY = '9c7e17ff-0c85-4cd5-827a-8b489f139e03';
|
|
21
|
-
|
|
22
|
-
// TODO(burdon): Validate.
|
|
23
|
-
const parseSequence = (text: string): SequenceDefinition | undefined => {
|
|
24
|
-
try {
|
|
25
|
-
const json = JSON5.parse(text);
|
|
26
|
-
const { steps } = json;
|
|
27
|
-
return { steps };
|
|
28
|
-
} catch {
|
|
29
|
-
// Ignore.
|
|
30
|
-
}
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
export const SequenceContainer = ({ sequence }: { sequence: Sequence }) => {
|
|
34
|
-
const { t } = useTranslation(meta.id);
|
|
35
|
-
const selectionManager = useSelectionManager();
|
|
36
|
-
const [definition, setDefinition] = useState<SequenceDefinition>();
|
|
37
|
-
useEffect(() => {
|
|
38
|
-
setDefinition({
|
|
39
|
-
steps: sequence.steps.map(({ instructions, tools }) => ({ instructions, tools })),
|
|
40
|
-
});
|
|
41
|
-
}, [sequence]);
|
|
42
|
-
|
|
43
|
-
const editorRef = useRef<EditorView>(null);
|
|
44
|
-
|
|
45
|
-
// TODO(burdon): Factor out.
|
|
46
|
-
// const toolRegistry = useMemo(() => {
|
|
47
|
-
// const space = getSpace(sequence);
|
|
48
|
-
// if (!space) {
|
|
49
|
-
// return;
|
|
50
|
-
// }
|
|
51
|
-
|
|
52
|
-
// // TODO(burdon): How should the queue be created?
|
|
53
|
-
// // eslint-disable-next-line no-unused-vars
|
|
54
|
-
// const _queue = space.queues.create();
|
|
55
|
-
|
|
56
|
-
// return new ToolRegistry([
|
|
57
|
-
// // createExaTool({ apiKey: EXA_API_KEY }),
|
|
58
|
-
// // createLocalSearchTool(space.db, queue),
|
|
59
|
-
// // createGraphWriterTool({
|
|
60
|
-
// // db: space.db,
|
|
61
|
-
// // queue,
|
|
62
|
-
// // schema: [], // TODO(burdon): Get schema from client/sequence?
|
|
63
|
-
// // onDone: async (objects) => {
|
|
64
|
-
// // await queue.append(objects);
|
|
65
|
-
// // },
|
|
66
|
-
// // }),
|
|
67
|
-
// ]);
|
|
68
|
-
// }, [sequence]);
|
|
69
|
-
|
|
70
|
-
const formatAndSave = useCallback((): SequenceDefinition | undefined => {
|
|
71
|
-
if (!sequence) {
|
|
72
|
-
return;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
const text = editorRef.current?.state.doc.toString();
|
|
76
|
-
if (!text) {
|
|
77
|
-
return;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
const definition = parseSequence(text);
|
|
81
|
-
if (!definition) {
|
|
82
|
-
return;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
setDefinition(definition);
|
|
86
|
-
const formatted = JSON.stringify(definition, null, 2);
|
|
87
|
-
editorRef.current?.dispatch({
|
|
88
|
-
changes: { from: 0, to: text.length, insert: formatted },
|
|
89
|
-
});
|
|
90
|
-
|
|
91
|
-
sequence.steps.length = 0;
|
|
92
|
-
for (const step of definition.steps) {
|
|
93
|
-
sequence.steps.push({
|
|
94
|
-
id: Key.ObjectId.random(),
|
|
95
|
-
instructions: step.instructions,
|
|
96
|
-
tools: step.tools,
|
|
97
|
-
});
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
return sequence;
|
|
101
|
-
}, [sequence]);
|
|
102
|
-
|
|
103
|
-
// TODO(burdon): Save raw sequence separately from parsed sequence? (like Script).
|
|
104
|
-
const handleSave = useCallback(() => formatAndSave(), [formatAndSave]);
|
|
105
|
-
|
|
106
|
-
const handleRun = useCallback(async () => {
|
|
107
|
-
// if (!aiClient?.value || !toolRegistry) {
|
|
108
|
-
// return;
|
|
109
|
-
// }
|
|
110
|
-
// formatAndSave();
|
|
111
|
-
// // Get input from selection.
|
|
112
|
-
// const input = Array.from(getSelectionSet(selectionManager)).map((id) => DXN.fromLocalObjectId(id));
|
|
113
|
-
// if (!input.length) {
|
|
114
|
-
// return;
|
|
115
|
-
// }
|
|
116
|
-
// const machine = new SequenceMachine(toolRegistry, sequence).setLogger(new QueueLogger(sequence));
|
|
117
|
-
// await machine.runToCompletion({ aiClient: aiClient.value, input });
|
|
118
|
-
}, [sequence, formatAndSave, selectionManager]);
|
|
119
|
-
|
|
120
|
-
return (
|
|
121
|
-
<StackItem.Content toolbar>
|
|
122
|
-
<Toolbar.Root>
|
|
123
|
-
<Toolbar.Button onClick={handleSave}>{t('button save')}</Toolbar.Button>
|
|
124
|
-
<Toolbar.Button onClick={handleRun}>{t('button run')}</Toolbar.Button>
|
|
125
|
-
</Toolbar.Root>
|
|
126
|
-
{definition && <SequenceEditor ref={editorRef} sequence={definition} />}
|
|
127
|
-
</StackItem.Content>
|
|
128
|
-
);
|
|
129
|
-
};
|
|
130
|
-
|
|
131
|
-
export default SequenceContainer;
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
6
|
-
import React from 'react';
|
|
7
|
-
|
|
8
|
-
import { withTheme } from '@dxos/react-ui/testing';
|
|
9
|
-
|
|
10
|
-
import { RESEARCH_SEQUENCE_DEFINITION } from '../../testing';
|
|
11
|
-
import { translations } from '../../translations';
|
|
12
|
-
|
|
13
|
-
import { SequenceEditor } from './SequenceEditor';
|
|
14
|
-
|
|
15
|
-
const meta = {
|
|
16
|
-
title: 'plugins/plugin-assistant/SequenceEditor',
|
|
17
|
-
component: SequenceEditor,
|
|
18
|
-
// TODO(wittjosiah): Fix story.
|
|
19
|
-
render: () => <>TODO</>,
|
|
20
|
-
decorators: [withTheme],
|
|
21
|
-
parameters: {
|
|
22
|
-
layout: 'column',
|
|
23
|
-
translations,
|
|
24
|
-
},
|
|
25
|
-
} satisfies Meta<typeof SequenceEditor>;
|
|
26
|
-
|
|
27
|
-
export default meta;
|
|
28
|
-
|
|
29
|
-
type Story = StoryObj<typeof SequenceEditor>;
|
|
30
|
-
|
|
31
|
-
export const Default: Story = {
|
|
32
|
-
args: {
|
|
33
|
-
sequence: RESEARCH_SEQUENCE_DEFINITION,
|
|
34
|
-
},
|
|
35
|
-
};
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import React, { forwardRef, useImperativeHandle } from 'react';
|
|
6
|
-
|
|
7
|
-
import { SequenceDefinition } from '@dxos/conductor';
|
|
8
|
-
import { Type } from '@dxos/echo';
|
|
9
|
-
import { type ThemedClassName, useThemeContext } from '@dxos/react-ui';
|
|
10
|
-
import {
|
|
11
|
-
type EditorView,
|
|
12
|
-
createBasicExtensions,
|
|
13
|
-
createJsonExtensions,
|
|
14
|
-
createThemeExtensions,
|
|
15
|
-
useTextEditor,
|
|
16
|
-
} from '@dxos/react-ui-editor';
|
|
17
|
-
import { mx } from '@dxos/react-ui-theme';
|
|
18
|
-
|
|
19
|
-
export type SequenceEditorProps = ThemedClassName<{
|
|
20
|
-
sequence: SequenceDefinition;
|
|
21
|
-
}>;
|
|
22
|
-
|
|
23
|
-
// TODO(burdon): Factor out JsonEditor.
|
|
24
|
-
export const SequenceEditor = forwardRef<EditorView | null, SequenceEditorProps>(
|
|
25
|
-
({ classNames, sequence }, forwardedRef) => {
|
|
26
|
-
const { themeMode } = useThemeContext();
|
|
27
|
-
const { parentRef, view } = useTextEditor({
|
|
28
|
-
initialValue: JSON.stringify(sequence, null, 2),
|
|
29
|
-
extensions: [
|
|
30
|
-
createBasicExtensions({
|
|
31
|
-
lineNumbers: true,
|
|
32
|
-
lineWrapping: false,
|
|
33
|
-
monospace: true,
|
|
34
|
-
scrollPastEnd: true,
|
|
35
|
-
}),
|
|
36
|
-
createThemeExtensions({
|
|
37
|
-
themeMode,
|
|
38
|
-
syntaxHighlighting: true,
|
|
39
|
-
}),
|
|
40
|
-
createJsonExtensions({
|
|
41
|
-
schema: Type.toJsonSchema(SequenceDefinition, { strict: true }),
|
|
42
|
-
}),
|
|
43
|
-
],
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
useImperativeHandle<EditorView | null, EditorView | null>(forwardedRef, () => view, [view]);
|
|
47
|
-
|
|
48
|
-
return <div ref={parentRef} className={mx('overflow-hidden', classNames)} />;
|
|
49
|
-
},
|
|
50
|
-
);
|
|
@@ -1,165 +0,0 @@
|
|
|
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 } from '@codemirror/state';
|
|
12
|
-
import { Decoration, type DecorationSet, type EditorView, ViewPlugin, type ViewUpdate, keymap } from '@codemirror/view';
|
|
13
|
-
|
|
14
|
-
export type HandlebarsOptions = {};
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Simple Handlebars plugin for CodeMirror.
|
|
18
|
-
* Supports:
|
|
19
|
-
* - Comments: {{! comment }}
|
|
20
|
-
* - Commands: {{#command}} {{/command}}
|
|
21
|
-
* - Variables: {{var}}
|
|
22
|
-
* - Commands with variables: {{#each items}} {{/each}}
|
|
23
|
-
*/
|
|
24
|
-
export const handlebars = (_: HandlebarsOptions = {}): Extension => {
|
|
25
|
-
return [
|
|
26
|
-
handlebarsHighlightPlugin,
|
|
27
|
-
autocompletion({
|
|
28
|
-
activateOnTyping: true,
|
|
29
|
-
aboveCursor: true,
|
|
30
|
-
closeOnBlur: true,
|
|
31
|
-
override: [handlebarsCompletions],
|
|
32
|
-
}),
|
|
33
|
-
keymap.of(completionKeymap),
|
|
34
|
-
];
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
const regex = {
|
|
38
|
-
comment: /\{\{!\s*[^}]*\}\}/g,
|
|
39
|
-
brackets: /\{\{[^}]*\}\}/g,
|
|
40
|
-
command: /\{\{[#/]([^}]+)\}\}/g,
|
|
41
|
-
var: /\{\{(?!\s*!)(\w[^}]*)\}\}/g,
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* ViewPlugin that decorates Handlebars syntax.
|
|
46
|
-
*/
|
|
47
|
-
const handlebarsHighlightPlugin = ViewPlugin.fromClass(
|
|
48
|
-
class {
|
|
49
|
-
decorations: DecorationSet;
|
|
50
|
-
|
|
51
|
-
constructor(view: EditorView) {
|
|
52
|
-
this.decorations = this.buildDecorations(view);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
buildDecorations(view: EditorView) {
|
|
56
|
-
const widgets: any[] = [];
|
|
57
|
-
|
|
58
|
-
for (const { from, to } of view.visibleRanges) {
|
|
59
|
-
const text = view.state.doc.sliceString(from, to);
|
|
60
|
-
|
|
61
|
-
// Match comments: {{! comment }}
|
|
62
|
-
{
|
|
63
|
-
let match;
|
|
64
|
-
while ((match = regex.comment.exec(text)) !== null) {
|
|
65
|
-
const start = from + match.index;
|
|
66
|
-
const end = start + match[0].length;
|
|
67
|
-
widgets.push(Decoration.mark({ class: 'text-subdued' }).range(start, end));
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
// Match brackets: {{ and }}
|
|
72
|
-
{
|
|
73
|
-
let match;
|
|
74
|
-
while ((match = regex.brackets.exec(text)) !== null) {
|
|
75
|
-
const start = from + match.index;
|
|
76
|
-
const end = start + match[0].length;
|
|
77
|
-
widgets.push(Decoration.mark({ class: 'text-subdued' }).range(start, end));
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
// Match commands: {{#command}} and {{/command}}
|
|
82
|
-
{
|
|
83
|
-
let match;
|
|
84
|
-
while ((match = regex.command.exec(text)) !== null) {
|
|
85
|
-
const start = from + match.index + 2;
|
|
86
|
-
let end = start + match[0].length - 4;
|
|
87
|
-
const text = view.state.doc.sliceString(start, end);
|
|
88
|
-
const parts = text.split(/\s+/);
|
|
89
|
-
if (parts.length > 1) {
|
|
90
|
-
const idx = start + parts[0].length;
|
|
91
|
-
widgets.push(Decoration.mark({ class: 'text-greenText' }).range(idx, end));
|
|
92
|
-
end = idx;
|
|
93
|
-
}
|
|
94
|
-
widgets.push(Decoration.mark({ class: 'text-blueText' }).range(start, end));
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
// Match variables: {{var}}
|
|
99
|
-
{
|
|
100
|
-
let match;
|
|
101
|
-
while ((match = regex.var.exec(text)) !== null) {
|
|
102
|
-
const start = from + match.index + 2;
|
|
103
|
-
const end = start + match[0].length - 4;
|
|
104
|
-
widgets.push(Decoration.mark({ class: 'text-greenText' }).range(start, end));
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
// Sort decorations by position to avoid "Ranges must be added sorted" error.
|
|
110
|
-
widgets.sort((a, b) => a.from - b.from || a.startSide - b.startSide);
|
|
111
|
-
return Decoration.set(widgets);
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
update(update: ViewUpdate) {
|
|
115
|
-
if (update.docChanged || update.viewportChanged) {
|
|
116
|
-
this.decorations = this.buildDecorations(update.view);
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
},
|
|
120
|
-
{
|
|
121
|
-
decorations: (v) => v.decorations,
|
|
122
|
-
},
|
|
123
|
-
);
|
|
124
|
-
|
|
125
|
-
// TODO(burdon): Pass in variables.
|
|
126
|
-
const variables = ['this'];
|
|
127
|
-
const commands = ['this', 'each', 'if', 'unless', 'with'];
|
|
128
|
-
|
|
129
|
-
/**
|
|
130
|
-
* Provides completions for Handlebars variables.
|
|
131
|
-
*/
|
|
132
|
-
function handlebarsCompletions(context: CompletionContext): CompletionResult | null {
|
|
133
|
-
const match = context.matchBefore(/\{\{[^}]*/);
|
|
134
|
-
if (!match || match.from === match.to) {
|
|
135
|
-
return null;
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
let type = 'variable';
|
|
139
|
-
let text = match.text.slice(2);
|
|
140
|
-
let from = match.from + 2;
|
|
141
|
-
let matches = [];
|
|
142
|
-
if (text.startsWith('#') || text.startsWith('/')) {
|
|
143
|
-
const idx = text.lastIndexOf(' ');
|
|
144
|
-
if (idx !== -1) {
|
|
145
|
-
type = 'variable';
|
|
146
|
-
matches = variables;
|
|
147
|
-
text = text.slice(idx + 1);
|
|
148
|
-
from += idx + 1;
|
|
149
|
-
} else {
|
|
150
|
-
type = 'command';
|
|
151
|
-
text = text.slice(1);
|
|
152
|
-
matches = commands;
|
|
153
|
-
from += 1;
|
|
154
|
-
}
|
|
155
|
-
} else {
|
|
156
|
-
type = 'variable';
|
|
157
|
-
matches = variables;
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
const options = matches.filter((name) => name.startsWith(text)).map((name) => ({ type, label: name }));
|
|
161
|
-
return {
|
|
162
|
-
from,
|
|
163
|
-
options,
|
|
164
|
-
};
|
|
165
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import React from 'react';
|
|
6
|
-
|
|
7
|
-
import { fullyQualifiedId } from '@dxos/react-client/echo';
|
|
8
|
-
import { type ThemedClassName } from '@dxos/react-ui';
|
|
9
|
-
import { MenuProvider, ToolbarMenu } from '@dxos/react-ui-menu';
|
|
10
|
-
|
|
11
|
-
import { type ChatToolbarActionsProps, useChatToolbarActions } from './useChatToolbarActions';
|
|
12
|
-
|
|
13
|
-
export const Toolbar = ({ chat, companionTo, onReset, classNames }: ThemedClassName<ChatToolbarActionsProps>) => {
|
|
14
|
-
const menu = useChatToolbarActions({ chat, companionTo, onReset });
|
|
15
|
-
|
|
16
|
-
return (
|
|
17
|
-
<MenuProvider {...menu} attendableId={companionTo ? fullyQualifiedId(companionTo) : fullyQualifiedId(chat)}>
|
|
18
|
-
<ToolbarMenu classNames={classNames} textBlockWidth />
|
|
19
|
-
</MenuProvider>
|
|
20
|
-
);
|
|
21
|
-
};
|