@dxos/plugin-assistant 0.8.4-main.2e9d522 → 0.8.4-main.3eb6e50203
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-6SP2ZWJ2.mjs +30 -0
- package/dist/lib/browser/BlueprintArticle-6SP2ZWJ2.mjs.map +7 -0
- package/dist/lib/browser/ChatCompanion-CAKFZAWN.mjs +200 -0
- package/dist/lib/browser/ChatCompanion-CAKFZAWN.mjs.map +7 -0
- package/dist/lib/browser/ChatContainer-QB37VONJ.mjs +73 -0
- package/dist/lib/browser/ChatContainer-QB37VONJ.mjs.map +7 -0
- package/dist/lib/browser/ChatDialog-ASVBLOOS.mjs +85 -0
- package/dist/lib/browser/ChatDialog-ASVBLOOS.mjs.map +7 -0
- package/dist/lib/browser/InitiativeContainer-V522FCYH.mjs +266 -0
- package/dist/lib/browser/InitiativeContainer-V522FCYH.mjs.map +7 -0
- package/dist/lib/browser/PromptArticle-PK3CBRUB.mjs +52 -0
- package/dist/lib/browser/PromptArticle-PK3CBRUB.mjs.map +7 -0
- package/dist/lib/browser/ai-service-CY2BYPH6.mjs +22 -0
- package/dist/lib/browser/ai-service-CY2BYPH6.mjs.map +7 -0
- package/dist/lib/browser/app-graph-builder-MUZGUQSC.mjs +234 -0
- package/dist/lib/browser/app-graph-builder-MUZGUQSC.mjs.map +7 -0
- package/dist/lib/browser/blueprint-definition-YAGWYVCL.mjs +14 -0
- package/dist/lib/browser/blueprint-definition-YAGWYVCL.mjs.map +7 -0
- package/dist/lib/browser/blueprints/index.mjs +12 -0
- package/dist/lib/browser/blueprints/index.mjs.map +7 -0
- package/dist/lib/browser/chunk-3ETBCBMH.mjs +47 -0
- package/dist/lib/browser/chunk-3ETBCBMH.mjs.map +7 -0
- package/dist/lib/browser/chunk-6BVCG5SJ.mjs +230 -0
- package/dist/lib/browser/chunk-6BVCG5SJ.mjs.map +7 -0
- package/dist/lib/browser/chunk-DKQMSMBN.mjs +326 -0
- package/dist/lib/browser/chunk-DKQMSMBN.mjs.map +7 -0
- package/dist/lib/browser/chunk-EXVT7D4B.mjs +23 -0
- package/dist/lib/browser/chunk-EXVT7D4B.mjs.map +7 -0
- package/dist/lib/browser/chunk-IJYAKPEU.mjs +286 -0
- package/dist/lib/browser/chunk-IJYAKPEU.mjs.map +7 -0
- package/dist/lib/browser/chunk-J5LGTIGS.mjs +10 -0
- package/dist/lib/browser/chunk-J5LGTIGS.mjs.map +7 -0
- package/dist/lib/browser/chunk-JA7PUZC7.mjs +1974 -0
- package/dist/lib/browser/chunk-JA7PUZC7.mjs.map +7 -0
- package/dist/lib/browser/chunk-POPBT2AQ.mjs +198 -0
- package/dist/lib/browser/chunk-POPBT2AQ.mjs.map +7 -0
- package/dist/lib/browser/edge-model-resolver-YTMFQEN5.mjs +21 -0
- package/dist/lib/browser/edge-model-resolver-YTMFQEN5.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +310 -156
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/local-model-resolver-CGRQH37T.mjs +20 -0
- package/dist/lib/browser/local-model-resolver-CGRQH37T.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/operation-resolver-2673CFJS.mjs +133 -0
- package/dist/lib/browser/operation-resolver-2673CFJS.mjs.map +7 -0
- package/dist/lib/browser/react-surface-T3FN4GVP.mjs +125 -0
- package/dist/lib/browser/react-surface-T3FN4GVP.mjs.map +7 -0
- package/dist/lib/browser/repair-IRXDYF4R.mjs +51 -0
- package/dist/lib/browser/repair-IRXDYF4R.mjs.map +7 -0
- package/dist/lib/browser/settings-XF6GKHCG.mjs +33 -0
- package/dist/lib/browser/settings-XF6GKHCG.mjs.map +7 -0
- package/dist/lib/browser/state-OYDPWLKA.mjs +26 -0
- package/dist/lib/browser/state-OYDPWLKA.mjs.map +7 -0
- package/dist/lib/browser/toolkit-IDXQCSTX.mjs +19 -0
- package/dist/lib/browser/toolkit-IDXQCSTX.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +11 -4
- package/dist/lib/node-esm/BlueprintArticle-7LI6UXKZ.mjs +31 -0
- package/dist/lib/node-esm/BlueprintArticle-7LI6UXKZ.mjs.map +7 -0
- package/dist/lib/node-esm/ChatCompanion-W4PGOCGR.mjs +201 -0
- package/dist/lib/node-esm/ChatCompanion-W4PGOCGR.mjs.map +7 -0
- package/dist/lib/node-esm/ChatContainer-ECFQVH6O.mjs +74 -0
- package/dist/lib/node-esm/ChatContainer-ECFQVH6O.mjs.map +7 -0
- package/dist/lib/node-esm/ChatDialog-AFLPYSIU.mjs +86 -0
- package/dist/lib/node-esm/ChatDialog-AFLPYSIU.mjs.map +7 -0
- package/dist/lib/node-esm/InitiativeContainer-U4LGO3BW.mjs +267 -0
- package/dist/lib/node-esm/InitiativeContainer-U4LGO3BW.mjs.map +7 -0
- package/dist/lib/node-esm/PromptArticle-BHPABYLT.mjs +53 -0
- package/dist/lib/node-esm/PromptArticle-BHPABYLT.mjs.map +7 -0
- package/dist/lib/node-esm/ai-service-ZI3A6RVG.mjs +23 -0
- package/dist/lib/node-esm/ai-service-ZI3A6RVG.mjs.map +7 -0
- package/dist/lib/node-esm/app-graph-builder-4QN5M6PD.mjs +235 -0
- package/dist/lib/node-esm/app-graph-builder-4QN5M6PD.mjs.map +7 -0
- package/dist/lib/node-esm/blueprint-definition-H3LFAEK2.mjs +15 -0
- package/dist/lib/node-esm/blueprint-definition-H3LFAEK2.mjs.map +7 -0
- package/dist/lib/node-esm/blueprints/index.mjs +13 -0
- package/dist/lib/node-esm/blueprints/index.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-2LEN26ZQ.mjs +48 -0
- package/dist/lib/node-esm/chunk-2LEN26ZQ.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-3XC7LQSO.mjs +1975 -0
- package/dist/lib/node-esm/chunk-3XC7LQSO.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-75PHXBN3.mjs +327 -0
- package/dist/lib/node-esm/chunk-75PHXBN3.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-F6LA7XNS.mjs +199 -0
- package/dist/lib/node-esm/chunk-F6LA7XNS.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-HSLMI22Q.mjs +11 -0
- package/dist/lib/node-esm/chunk-HSLMI22Q.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-LB72WG6R.mjs +231 -0
- package/dist/lib/node-esm/chunk-LB72WG6R.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-MJD5XWQV.mjs +288 -0
- package/dist/lib/node-esm/chunk-MJD5XWQV.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-POWB2BPC.mjs +25 -0
- package/dist/lib/node-esm/chunk-POWB2BPC.mjs.map +7 -0
- package/dist/lib/node-esm/edge-model-resolver-CMJ3KNLQ.mjs +22 -0
- package/dist/lib/node-esm/edge-model-resolver-CMJ3KNLQ.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +310 -156
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/local-model-resolver-FFDAKOXN.mjs +21 -0
- package/dist/lib/node-esm/local-model-resolver-FFDAKOXN.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/operation-resolver-2ZD2DXOU.mjs +134 -0
- package/dist/lib/node-esm/operation-resolver-2ZD2DXOU.mjs.map +7 -0
- package/dist/lib/node-esm/react-surface-T4VMCCKZ.mjs +126 -0
- package/dist/lib/node-esm/react-surface-T4VMCCKZ.mjs.map +7 -0
- package/dist/lib/node-esm/repair-DMI55PON.mjs +52 -0
- package/dist/lib/node-esm/repair-DMI55PON.mjs.map +7 -0
- package/dist/lib/node-esm/settings-NGGZA7S7.mjs +34 -0
- package/dist/lib/node-esm/settings-NGGZA7S7.mjs.map +7 -0
- package/dist/lib/node-esm/state-VSCPGN7R.mjs +27 -0
- package/dist/lib/node-esm/state-VSCPGN7R.mjs.map +7 -0
- package/dist/lib/node-esm/toolkit-JPRJRDDB.mjs +20 -0
- package/dist/lib/node-esm/toolkit-JPRJRDDB.mjs.map +7 -0
- package/dist/lib/node-esm/types/index.mjs +11 -4
- package/dist/types/src/AssistantPlugin.d.ts +2 -1
- package/dist/types/src/AssistantPlugin.d.ts.map +1 -1
- package/dist/types/src/blueprints/assistant-blueprint.d.ts +11 -0
- package/dist/types/src/blueprints/assistant-blueprint.d.ts.map +1 -0
- package/dist/types/src/blueprints/index.d.ts +7 -0
- package/dist/types/src/blueprints/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/ai-service/ai-service.d.ts +6 -0
- package/dist/types/src/capabilities/ai-service/ai-service.d.ts.map +1 -0
- package/dist/types/src/capabilities/ai-service/index.d.ts +3 -0
- package/dist/types/src/capabilities/ai-service/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts +6 -0
- package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts.map +1 -0
- package/dist/types/src/capabilities/app-graph-builder/index.d.ts +3 -0
- package/dist/types/src/capabilities/app-graph-builder/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/blueprint-definition/blueprint-definition.d.ts +26 -0
- package/dist/types/src/capabilities/blueprint-definition/blueprint-definition.d.ts.map +1 -0
- package/dist/types/src/capabilities/blueprint-definition/index.d.ts +4 -0
- package/dist/types/src/capabilities/blueprint-definition/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/edge-model-resolver/edge-model-resolver.d.ts +7 -0
- package/dist/types/src/capabilities/edge-model-resolver/edge-model-resolver.d.ts.map +1 -0
- package/dist/types/src/capabilities/edge-model-resolver/index.d.ts +3 -0
- package/dist/types/src/capabilities/edge-model-resolver/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +11 -4
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/local-model-resolver/index.d.ts +3 -0
- package/dist/types/src/capabilities/local-model-resolver/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/local-model-resolver/local-model-resolver.d.ts +13 -0
- package/dist/types/src/capabilities/local-model-resolver/local-model-resolver.d.ts.map +1 -0
- package/dist/types/src/capabilities/operation-resolver/index.d.ts +3 -0
- package/dist/types/src/capabilities/operation-resolver/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts +5 -0
- package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface/index.d.ts +3 -0
- package/dist/types/src/capabilities/react-surface/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts +5 -0
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +1 -0
- package/dist/types/src/capabilities/repair/index.d.ts +3 -0
- package/dist/types/src/capabilities/repair/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/repair/repair.d.ts +6 -0
- package/dist/types/src/capabilities/repair/repair.d.ts.map +1 -0
- package/dist/types/src/capabilities/settings/index.d.ts +15 -0
- package/dist/types/src/capabilities/settings/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/settings/settings.d.ts +18 -0
- package/dist/types/src/capabilities/settings/settings.d.ts.map +1 -0
- package/dist/types/src/capabilities/state/index.d.ts +11 -0
- package/dist/types/src/capabilities/state/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/state/state.d.ts +13 -0
- package/dist/types/src/capabilities/state/state.d.ts.map +1 -0
- package/dist/types/src/capabilities/toolkit/index.d.ts +3 -0
- package/dist/types/src/capabilities/toolkit/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/toolkit/toolkit.d.ts +6 -0
- package/dist/types/src/capabilities/toolkit/toolkit.d.ts.map +1 -0
- package/dist/types/src/components/AssistantSettings/AssistantSettings.d.ts +4 -2
- package/dist/types/src/components/AssistantSettings/AssistantSettings.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 +37 -21
- package/dist/types/src/components/Chat/Chat.d.ts.map +1 -1
- package/dist/types/src/components/Chat/events.d.ts +10 -1
- package/dist/types/src/components/Chat/events.d.ts.map +1 -1
- package/dist/types/src/components/ChatCompanion.d.ts +13 -0
- package/dist/types/src/components/ChatCompanion.d.ts.map +1 -0
- package/dist/types/src/components/ChatContainer.d.ts +16 -8
- package/dist/types/src/components/ChatContainer.d.ts.map +1 -1
- package/dist/types/src/components/ChatDialog.d.ts +2 -2
- package/dist/types/src/components/ChatDialog.d.ts.map +1 -1
- package/dist/types/src/components/ChatProgress/ChatProgress.d.ts +7 -0
- package/dist/types/src/components/ChatProgress/ChatProgress.d.ts.map +1 -0
- package/dist/types/src/components/ChatProgress/index.d.ts +2 -0
- package/dist/types/src/components/ChatProgress/index.d.ts.map +1 -0
- package/dist/types/src/components/ChatPrompt/ChatActions.d.ts.map +1 -1
- package/dist/types/src/components/ChatPrompt/ChatOptions.d.ts +20 -0
- package/dist/types/src/components/ChatPrompt/ChatOptions.d.ts.map +1 -0
- package/dist/types/src/components/ChatPrompt/ChatPresets.d.ts.map +1 -1
- package/dist/types/src/components/ChatPrompt/ChatReferences.d.ts +5 -6
- package/dist/types/src/components/ChatPrompt/ChatReferences.d.ts.map +1 -1
- package/dist/types/src/components/ChatPrompt/ChatStatusIndicator.d.ts +6 -4
- package/dist/types/src/components/ChatPrompt/ChatStatusIndicator.d.ts.map +1 -1
- package/dist/types/src/components/ChatPrompt/index.d.ts +1 -1
- package/dist/types/src/components/ChatPrompt/index.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/ChatThread.d.ts +13 -11
- package/dist/types/src/components/ChatThread/ChatThread.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/ChatThread.stories.d.ts +285 -71
- package/dist/types/src/components/ChatThread/ChatThread.stories.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/Link.d.ts +9 -0
- package/dist/types/src/components/ChatThread/Link.d.ts.map +1 -0
- package/dist/types/src/components/ChatThread/registry.d.ts +11 -0
- package/dist/types/src/components/ChatThread/registry.d.ts.map +1 -0
- package/dist/types/src/components/ChatThread/sync.d.ts +42 -0
- package/dist/types/src/components/ChatThread/sync.d.ts.map +1 -0
- package/dist/types/src/components/ChatThread/sync.test.d.ts +2 -0
- package/dist/types/src/components/ChatThread/sync.test.d.ts.map +1 -0
- package/dist/types/src/components/InitiativeContainer.d.ts +9 -0
- package/dist/types/src/components/InitiativeContainer.d.ts.map +1 -0
- 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 +3 -6
- package/dist/types/src/components/TemplateEditor/TemplateEditor.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/TemplateEditor.stories.d.ts +431 -7
- package/dist/types/src/components/TemplateEditor/TemplateEditor.stories.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/TemplateForm.d.ts +13 -2
- package/dist/types/src/components/TemplateEditor/TemplateForm.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/TemplateForm.stories.d.ts +428 -2
- package/dist/types/src/components/TemplateEditor/TemplateForm.stories.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/extensions/handlebars-extension.d.ts +12 -0
- 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 +21 -0
- package/dist/types/src/components/ToolBlock/ToolBlock.d.ts.map +1 -0
- package/dist/types/src/components/ToolBlock/ToolBlockWidget.d.ts +2 -0
- package/dist/types/src/components/ToolBlock/ToolBlockWidget.d.ts.map +1 -0
- package/dist/types/src/components/ToolBlock/index.d.ts +3 -0
- package/dist/types/src/components/ToolBlock/index.d.ts.map +1 -0
- package/dist/types/src/components/Toolbox/Toolbox.d.ts +9 -15
- package/dist/types/src/components/Toolbox/Toolbox.d.ts.map +1 -1
- package/dist/types/src/components/Toolbox/Toolbox.stories.d.ts +432 -5
- package/dist/types/src/components/Toolbox/Toolbox.stories.d.ts.map +1 -1
- package/dist/types/src/components/TriggerStatus/TriggerStatus.d.ts +4 -0
- package/dist/types/src/components/TriggerStatus/TriggerStatus.d.ts.map +1 -0
- package/dist/types/src/components/TriggerStatus/index.d.ts +2 -0
- package/dist/types/src/components/TriggerStatus/index.d.ts.map +1 -0
- package/dist/types/src/components/Typewriter/AssistantToolbar.d.ts +12 -0
- package/dist/types/src/components/Typewriter/AssistantToolbar.d.ts.map +1 -0
- package/dist/types/src/components/Typewriter/Typewriter.d.ts +11 -0
- package/dist/types/src/components/Typewriter/Typewriter.d.ts.map +1 -0
- package/dist/types/src/components/Typewriter/Typewriter.stories.d.ts +7 -0
- package/dist/types/src/components/Typewriter/Typewriter.stories.d.ts.map +1 -0
- package/dist/types/src/components/Typewriter/assistant-extension.d.ts +5 -0
- package/dist/types/src/components/Typewriter/assistant-extension.d.ts.map +1 -0
- package/dist/types/src/components/Typewriter/index.d.ts +2 -0
- package/dist/types/src/components/Typewriter/index.d.ts.map +1 -0
- package/dist/types/src/components/index.d.ts +10 -7
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/functions/index.d.ts +4 -0
- package/dist/types/src/functions/index.d.ts.map +1 -0
- package/dist/types/src/functions/object-list.d.ts +10 -0
- package/dist/types/src/functions/object-list.d.ts.map +1 -0
- package/dist/types/src/functions/object-load.d.ts +8 -0
- package/dist/types/src/functions/object-load.d.ts.map +1 -0
- package/dist/types/src/functions/object-search.d.ts +10 -0
- package/dist/types/src/functions/object-search.d.ts.map +1 -0
- package/dist/types/src/hooks/index.d.ts +8 -3
- package/dist/types/src/hooks/index.d.ts.map +1 -1
- package/dist/types/src/hooks/useBlueprintRegistry.d.ts +25 -0
- package/dist/types/src/hooks/useBlueprintRegistry.d.ts.map +1 -0
- package/dist/types/src/hooks/useChatProcessor.d.ts +10 -20
- package/dist/types/src/hooks/useChatProcessor.d.ts.map +1 -1
- package/dist/types/src/hooks/useChatServices.d.ts +7 -8
- 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 +4 -0
- package/dist/types/src/hooks/useContextBinder.d.ts.map +1 -0
- package/dist/types/src/hooks/useContextObjects.d.ts +15 -0
- package/dist/types/src/hooks/useContextObjects.d.ts.map +1 -0
- package/dist/types/src/hooks/useFilteredTypes.d.ts +3 -0
- package/dist/types/src/hooks/useFilteredTypes.d.ts.map +1 -0
- package/dist/types/src/hooks/useFlush.d.ts +6 -0
- package/dist/types/src/hooks/useFlush.d.ts.map +1 -0
- package/dist/types/src/hooks/useOnline.d.ts +3 -0
- package/dist/types/src/hooks/useOnline.d.ts.map +1 -0
- package/dist/types/src/hooks/usePresets.d.ts +7 -0
- package/dist/types/src/hooks/usePresets.d.ts.map +1 -0
- package/dist/types/src/hooks/useReferencesProvider.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +2 -1
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +3 -4
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/processor/index.d.ts +4 -0
- package/dist/types/src/processor/index.d.ts.map +1 -0
- package/dist/types/src/{hooks → processor}/presets.d.ts +3 -3
- package/dist/types/src/processor/presets.d.ts.map +1 -0
- package/dist/types/src/processor/processor.d.ts +79 -0
- package/dist/types/src/processor/processor.d.ts.map +1 -0
- package/dist/types/src/processor/processor.test.d.ts +2 -0
- package/dist/types/src/processor/processor.test.d.ts.map +1 -0
- 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/index.d.ts +1 -1
- package/dist/types/src/testing/index.d.ts.map +1 -1
- package/dist/types/src/testing/test-generator.d.ts +8 -0
- package/dist/types/src/testing/test-generator.d.ts.map +1 -0
- package/dist/types/src/testing/test-sequence.d.ts +0 -4
- package/dist/types/src/testing/test-sequence.d.ts.map +1 -1
- package/dist/types/src/testing/test-services.d.ts +2 -2
- package/dist/types/src/testing/test-services.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +376 -37
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/Assistant.d.ts +20 -0
- package/dist/types/src/types/Assistant.d.ts.map +1 -0
- package/dist/types/src/types/AssistantAction.d.ts +97 -0
- package/dist/types/src/types/AssistantAction.d.ts.map +1 -0
- package/dist/types/src/types/capabilities.d.ts +33 -0
- package/dist/types/src/types/capabilities.d.ts.map +1 -0
- package/dist/types/src/types/defs.d.ts +2 -0
- package/dist/types/src/types/defs.d.ts.map +1 -0
- package/dist/types/src/types/events.d.ts +5 -0
- package/dist/types/src/types/events.d.ts.map +1 -0
- package/dist/types/src/types/index.d.ts +6 -1
- package/dist/types/src/types/index.d.ts.map +1 -1
- package/dist/types/src/types/service.d.ts +14 -213
- package/dist/types/src/types/service.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +125 -96
- package/src/AssistantPlugin.tsx +159 -88
- package/src/blueprints/assistant-blueprint.ts +57 -0
- package/src/blueprints/index.ts +12 -0
- package/src/capabilities/ai-service/ai-service.ts +30 -0
- package/src/capabilities/ai-service/index.ts +7 -0
- package/src/capabilities/app-graph-builder/app-graph-builder.ts +200 -0
- package/src/capabilities/app-graph-builder/index.ts +7 -0
- package/src/capabilities/blueprint-definition/blueprint-definition.ts +74 -0
- package/src/capabilities/blueprint-definition/index.ts +8 -0
- package/src/capabilities/edge-model-resolver/edge-model-resolver.ts +33 -0
- package/src/capabilities/edge-model-resolver/index.ts +7 -0
- package/src/capabilities/index.ts +11 -6
- package/src/capabilities/local-model-resolver/index.ts +7 -0
- package/src/capabilities/local-model-resolver/local-model-resolver.ts +38 -0
- package/src/capabilities/operation-resolver/index.ts +7 -0
- package/src/capabilities/operation-resolver/operation-resolver.ts +112 -0
- package/src/capabilities/react-surface/index.ts +7 -0
- package/src/capabilities/react-surface/react-surface.tsx +111 -0
- package/src/capabilities/repair/index.ts +7 -0
- package/src/capabilities/repair/repair.ts +62 -0
- package/src/capabilities/settings/index.ts +7 -0
- package/src/capabilities/settings/settings.ts +31 -0
- package/src/capabilities/state/index.ts +7 -0
- package/src/capabilities/state/state.ts +27 -0
- package/src/capabilities/toolkit/index.ts +7 -0
- package/src/capabilities/toolkit/toolkit.ts +27 -0
- package/src/components/AssistantSettings/AssistantSettings.tsx +92 -77
- package/src/components/BlueprintArticle.tsx +28 -0
- package/src/components/Chat/Chat.tsx +267 -197
- package/src/components/Chat/events.ts +14 -1
- package/src/components/ChatCompanion.tsx +226 -0
- package/src/components/ChatContainer.tsx +56 -33
- package/src/components/ChatDialog.tsx +30 -19
- package/src/components/ChatProgress/ChatProgress.tsx +53 -0
- package/src/components/{SequenceEditor → ChatProgress}/index.ts +1 -1
- package/src/components/ChatPrompt/ChatActions.tsx +19 -27
- package/src/components/ChatPrompt/ChatOptions.tsx +238 -0
- package/src/components/ChatPrompt/ChatPresets.tsx +1 -0
- package/src/components/ChatPrompt/ChatReferences.tsx +32 -38
- package/src/components/ChatPrompt/ChatStatusIndicator.tsx +25 -22
- package/src/components/ChatPrompt/index.ts +1 -1
- package/src/components/ChatThread/ChatThread.stories.tsx +123 -116
- package/src/components/ChatThread/ChatThread.tsx +75 -36
- package/src/components/ChatThread/Link.tsx +26 -0
- package/src/components/ChatThread/registry.tsx +174 -0
- package/src/components/ChatThread/sync.test.ts +97 -0
- package/src/components/ChatThread/sync.ts +154 -0
- package/src/components/ChatThread/testing/thread.md +37 -0
- package/src/components/InitiativeContainer.tsx +340 -0
- package/src/components/PromptArticle.tsx +49 -0
- package/src/components/TemplateEditor/TemplateEditor.stories.tsx +40 -19
- package/src/components/TemplateEditor/TemplateEditor.tsx +33 -52
- package/src/components/TemplateEditor/TemplateForm.stories.tsx +30 -17
- package/src/components/TemplateEditor/TemplateForm.tsx +82 -32
- package/src/components/TemplateEditor/extensions/handlebars-extension.ts +274 -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 +143 -0
- package/src/components/ToolBlock/ToolBlockWidget.tsx +5 -0
- package/src/components/ToolBlock/index.ts +6 -0
- package/src/components/Toolbox/Toolbox.stories.tsx +18 -28
- package/src/components/Toolbox/Toolbox.tsx +70 -102
- package/src/components/TriggerStatus/TriggerStatus.tsx +142 -0
- package/src/components/TriggerStatus/index.ts +5 -0
- package/src/components/Typewriter/AssistantToolbar.tsx +161 -0
- package/src/components/Typewriter/Typewriter.stories.tsx +83 -0
- package/src/components/Typewriter/Typewriter.tsx +54 -0
- package/src/components/Typewriter/assistant-extension.tsx +144 -0
- package/src/components/Typewriter/index.ts +5 -0
- package/src/components/index.ts +14 -9
- package/src/functions/index.ts +7 -0
- package/src/functions/object-list.ts +49 -0
- package/src/functions/object-load.ts +44 -0
- package/src/functions/object-search.ts +46 -0
- package/src/hooks/index.ts +8 -4
- package/src/hooks/useBlueprintRegistry.ts +105 -0
- package/src/hooks/useChatProcessor.ts +40 -105
- package/src/hooks/useChatServices.ts +31 -75
- package/src/hooks/useChatToolbarActions.ts +122 -0
- package/src/hooks/useContextBinder.ts +32 -0
- package/src/hooks/useContextObjects.ts +46 -0
- package/src/hooks/useFilteredTypes.ts +37 -0
- package/src/hooks/useFlush.ts +35 -0
- package/src/hooks/useOnline.ts +10 -0
- package/src/hooks/usePresets.ts +44 -0
- package/src/hooks/useReferencesProvider.ts +15 -12
- package/src/index.ts +2 -1
- package/src/meta.ts +11 -8
- package/src/processor/index.ts +7 -0
- package/src/{hooks → processor}/presets.ts +16 -8
- package/src/processor/processor.test.ts +72 -0
- package/src/processor/processor.ts +301 -0
- package/src/processor/update-name.ts +58 -0
- package/src/queue-logger.ts +17 -18
- package/src/testing/index.ts +1 -1
- package/src/testing/test-generator.ts +262 -0
- package/src/testing/test-sequence.ts +2 -27
- package/src/testing/test-services.ts +10 -14
- package/src/translations.ts +71 -28
- package/src/types/Assistant.ts +28 -0
- package/src/types/AssistantAction.ts +76 -0
- package/src/types/capabilities.ts +27 -0
- package/src/types/defs.ts +5 -0
- package/src/types/events.ts +11 -0
- package/src/types/index.ts +9 -1
- package/src/types/service.ts +25 -14
- package/src/vite-env.d.ts +30 -0
- package/dist/lib/browser/ChatContainer-M3IHQLRS.mjs +0 -54
- package/dist/lib/browser/ChatContainer-M3IHQLRS.mjs.map +0 -7
- package/dist/lib/browser/ChatDialog-X6VN6QZI.mjs +0 -72
- package/dist/lib/browser/ChatDialog-X6VN6QZI.mjs.map +0 -7
- package/dist/lib/browser/SequenceContainer-3UDVKWPA.mjs +0 -162
- package/dist/lib/browser/SequenceContainer-3UDVKWPA.mjs.map +0 -7
- package/dist/lib/browser/TemplateContainer-RPJ2LBOB.mjs +0 -27
- package/dist/lib/browser/TemplateContainer-RPJ2LBOB.mjs.map +0 -7
- package/dist/lib/browser/app-graph-builder-JTXBKE7O.mjs +0 -223
- package/dist/lib/browser/app-graph-builder-JTXBKE7O.mjs.map +0 -7
- package/dist/lib/browser/chunk-AEAEKWOC.mjs +0 -98
- package/dist/lib/browser/chunk-AEAEKWOC.mjs.map +0 -7
- package/dist/lib/browser/chunk-EQDW6BYQ.mjs +0 -108
- package/dist/lib/browser/chunk-EQDW6BYQ.mjs.map +0 -7
- package/dist/lib/browser/chunk-FDCJSQYF.mjs +0 -40
- package/dist/lib/browser/chunk-FDCJSQYF.mjs.map +0 -7
- package/dist/lib/browser/chunk-JQBVLTM5.mjs +0 -158
- package/dist/lib/browser/chunk-JQBVLTM5.mjs.map +0 -7
- package/dist/lib/browser/chunk-OWY4CUQY.mjs +0 -2245
- package/dist/lib/browser/chunk-OWY4CUQY.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-5RMMCMXG.mjs +0 -60
- package/dist/lib/browser/intent-resolver-5RMMCMXG.mjs.map +0 -7
- package/dist/lib/browser/react-surface-66VY37YQ.mjs +0 -150
- package/dist/lib/browser/react-surface-66VY37YQ.mjs.map +0 -7
- package/dist/lib/browser/settings-2DGP3UTS.mjs +0 -22
- package/dist/lib/browser/settings-2DGP3UTS.mjs.map +0 -7
- package/dist/lib/node-esm/ChatContainer-VZT74PO2.mjs +0 -55
- package/dist/lib/node-esm/ChatContainer-VZT74PO2.mjs.map +0 -7
- package/dist/lib/node-esm/ChatDialog-RJ6FDX4Q.mjs +0 -73
- package/dist/lib/node-esm/ChatDialog-RJ6FDX4Q.mjs.map +0 -7
- package/dist/lib/node-esm/SequenceContainer-RQQH5XOC.mjs +0 -163
- package/dist/lib/node-esm/SequenceContainer-RQQH5XOC.mjs.map +0 -7
- package/dist/lib/node-esm/TemplateContainer-A3NAQCZE.mjs +0 -28
- package/dist/lib/node-esm/TemplateContainer-A3NAQCZE.mjs.map +0 -7
- package/dist/lib/node-esm/app-graph-builder-OWSOXFTD.mjs +0 -224
- package/dist/lib/node-esm/app-graph-builder-OWSOXFTD.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-2XL6MNPE.mjs +0 -99
- package/dist/lib/node-esm/chunk-2XL6MNPE.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-BISJDTBK.mjs +0 -159
- package/dist/lib/node-esm/chunk-BISJDTBK.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-E33DNNDW.mjs +0 -109
- package/dist/lib/node-esm/chunk-E33DNNDW.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-QN2H2EHV.mjs +0 -41
- package/dist/lib/node-esm/chunk-QN2H2EHV.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-SENTQAEO.mjs +0 -2246
- package/dist/lib/node-esm/chunk-SENTQAEO.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-YPPYELY3.mjs +0 -61
- package/dist/lib/node-esm/intent-resolver-YPPYELY3.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-RJMRBR2M.mjs +0 -151
- package/dist/lib/node-esm/react-surface-RJMRBR2M.mjs.map +0 -7
- package/dist/lib/node-esm/settings-47RYZOU4.mjs +0 -23
- package/dist/lib/node-esm/settings-47RYZOU4.mjs.map +0 -7
- package/dist/types/src/capabilities/app-graph-builder.d.ts +0 -4
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +0 -1
- package/dist/types/src/capabilities/intent-resolver.d.ts +0 -4
- package/dist/types/src/capabilities/intent-resolver.d.ts.map +0 -1
- package/dist/types/src/capabilities/react-surface.d.ts +0 -4
- package/dist/types/src/capabilities/react-surface.d.ts.map +0 -1
- package/dist/types/src/capabilities/settings.d.ts +0 -4
- package/dist/types/src/capabilities/settings.d.ts.map +0 -1
- package/dist/types/src/components/ChatPrompt/ChatOptionsMenu.d.ts +0 -9
- package/dist/types/src/components/ChatPrompt/ChatOptionsMenu.d.ts.map +0 -1
- package/dist/types/src/components/ChatThread/ChatMessage.d.ts +0 -17
- package/dist/types/src/components/ChatThread/ChatMessage.d.ts.map +0 -1
- package/dist/types/src/components/ChatThread/ToolBlock.d.ts +0 -19
- package/dist/types/src/components/ChatThread/ToolBlock.d.ts.map +0 -1
- package/dist/types/src/components/ChatThread/reducer.d.ts +0 -12
- package/dist/types/src/components/ChatThread/reducer.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 -8
- 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/TemplateContainer.d.ts +0 -8
- package/dist/types/src/components/TemplateContainer.d.ts.map +0 -1
- package/dist/types/src/events.d.ts +0 -4
- package/dist/types/src/events.d.ts.map +0 -1
- package/dist/types/src/hooks/chat-processor.d.ts +0 -86
- package/dist/types/src/hooks/chat-processor.d.ts.map +0 -1
- package/dist/types/src/hooks/chat-processor.test.d.ts +0 -2
- package/dist/types/src/hooks/chat-processor.test.d.ts.map +0 -1
- package/dist/types/src/hooks/presets.d.ts.map +0 -1
- package/dist/types/src/hooks/useBlueprints.d.ts +0 -9
- package/dist/types/src/hooks/useBlueprints.d.ts.map +0 -1
- package/dist/types/src/parser/filter-generator.d.ts +0 -4
- package/dist/types/src/parser/filter-generator.d.ts.map +0 -1
- package/dist/types/src/parser/filter-generator.test.d.ts +0 -2
- package/dist/types/src/parser/filter-generator.test.d.ts.map +0 -1
- package/dist/types/src/parser/index.d.ts +0 -4
- package/dist/types/src/parser/index.d.ts.map +0 -1
- package/dist/types/src/parser/query-parser.d.ts +0 -15
- package/dist/types/src/parser/query-parser.d.ts.map +0 -1
- package/dist/types/src/parser/query-parser.test.d.ts +0 -2
- package/dist/types/src/parser/query-parser.test.d.ts.map +0 -1
- package/dist/types/src/parser/types.d.ts +0 -24
- package/dist/types/src/parser/types.d.ts.map +0 -1
- package/dist/types/src/stories/Chat.stories.d.ts +0 -249
- package/dist/types/src/stories/Chat.stories.d.ts.map +0 -1
- package/dist/types/src/testing/test-functions.d.ts +0 -3
- package/dist/types/src/testing/test-functions.d.ts.map +0 -1
- package/dist/types/src/tools/function.d.ts +0 -5
- package/dist/types/src/tools/function.d.ts.map +0 -1
- package/dist/types/src/tools/index.d.ts +0 -3
- package/dist/types/src/tools/index.d.ts.map +0 -1
- package/dist/types/src/tools/openapi.d.ts +0 -10
- package/dist/types/src/tools/openapi.d.ts.map +0 -1
- package/dist/types/src/tools/openapi.test.d.ts +0 -2
- package/dist/types/src/tools/openapi.test.d.ts.map +0 -1
- package/dist/types/src/types/schema.d.ts +0 -88
- package/dist/types/src/types/schema.d.ts.map +0 -1
- package/src/capabilities/app-graph-builder.ts +0 -253
- package/src/capabilities/intent-resolver.ts +0 -58
- package/src/capabilities/react-surface.tsx +0 -138
- package/src/capabilities/settings.ts +0 -19
- package/src/components/ChatPrompt/ChatOptionsMenu.tsx +0 -52
- package/src/components/ChatThread/ChatMessage.tsx +0 -268
- package/src/components/ChatThread/ToolBlock.tsx +0 -121
- package/src/components/ChatThread/reducer.ts +0 -52
- package/src/components/PromptSettings.tsx +0 -89
- package/src/components/SequenceContainer.tsx +0 -132
- package/src/components/SequenceEditor/SequenceEditor.stories.tsx +0 -32
- package/src/components/SequenceEditor/SequenceEditor.tsx +0 -50
- package/src/components/TemplateContainer.tsx +0 -24
- package/src/events.ts +0 -11
- package/src/hooks/chat-processor.test.ts +0 -16
- package/src/hooks/chat-processor.ts +0 -314
- package/src/hooks/useBlueprints.ts +0 -57
- package/src/parser/filter-generator.test.ts +0 -32
- package/src/parser/filter-generator.ts +0 -81
- package/src/parser/index.ts +0 -7
- package/src/parser/query-parser.test.ts +0 -139
- package/src/parser/query-parser.ts +0 -199
- package/src/parser/types.ts +0 -34
- package/src/shims.d.ts +0 -8
- package/src/stories/Chat.stories.tsx +0 -378
- package/src/testing/test-functions.ts +0 -11
- package/src/tools/function.ts +0 -46
- package/src/tools/index.ts +0 -6
- package/src/tools/openapi.test.ts +0 -217
- package/src/tools/openapi.ts +0 -338
- package/src/types/schema.ts +0 -95
- package/src/typings.d.ts +0 -9
|
@@ -0,0 +1,340 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2026 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { Atom, useAtomValue } from '@effect-atom/atom-react';
|
|
6
|
+
import * as Effect from 'effect/Effect';
|
|
7
|
+
import * as Match from 'effect/Match';
|
|
8
|
+
import * as Option from 'effect/Option';
|
|
9
|
+
import type * as Record from 'effect/Record';
|
|
10
|
+
import React, { useCallback, useMemo, useState } from 'react';
|
|
11
|
+
|
|
12
|
+
import { Surface, useCapability } from '@dxos/app-framework/ui';
|
|
13
|
+
import { Initiative } from '@dxos/assistant-toolkit';
|
|
14
|
+
import { DXN, Filter, Obj, Query, Ref } from '@dxos/echo';
|
|
15
|
+
import { type JsonPath, splitJsonPath } from '@dxos/echo/internal';
|
|
16
|
+
import { AtomObj, AtomRef } from '@dxos/echo-atom';
|
|
17
|
+
import { FunctionDefinition, QueueService, Trigger } from '@dxos/functions';
|
|
18
|
+
import { AutomationCapabilities } from '@dxos/plugin-automation/types';
|
|
19
|
+
import { MarkdownEditor } from '@dxos/plugin-markdown';
|
|
20
|
+
import { useObject, useQuery } from '@dxos/react-client/echo';
|
|
21
|
+
import { Button, ButtonGroup, IconButton, Input, toLocalizedString, useTranslation } from '@dxos/react-ui';
|
|
22
|
+
import { Form, type FormFieldMap, omitId } from '@dxos/react-ui-form';
|
|
23
|
+
import { StackItem } from '@dxos/react-ui-stack';
|
|
24
|
+
import { type Text } from '@dxos/schema';
|
|
25
|
+
|
|
26
|
+
export type InitiativeContainerProps = {
|
|
27
|
+
role?: string;
|
|
28
|
+
initiative: Initiative.Initiative;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
const TAB_INITATIVE = 'Initiative';
|
|
32
|
+
const TAB_CHAT = 'Chat';
|
|
33
|
+
|
|
34
|
+
export const InitiativeContainer = ({ role, initiative }: InitiativeContainerProps) => {
|
|
35
|
+
const [selectedTab, setSelectedTab] = useState<string>(TAB_INITATIVE);
|
|
36
|
+
|
|
37
|
+
const tabs = useAtomValue(
|
|
38
|
+
useMemo(
|
|
39
|
+
() =>
|
|
40
|
+
AtomObj.make(initiative).pipe((initiative) =>
|
|
41
|
+
Atom.make((get) => {
|
|
42
|
+
return [TAB_INITATIVE, TAB_CHAT, ...get(initiative).artifacts.map((artifact) => artifact.name)];
|
|
43
|
+
}),
|
|
44
|
+
),
|
|
45
|
+
[initiative],
|
|
46
|
+
),
|
|
47
|
+
);
|
|
48
|
+
|
|
49
|
+
const chat = useAtomValue(
|
|
50
|
+
useMemo(
|
|
51
|
+
() =>
|
|
52
|
+
AtomObj.make(initiative).pipe((initiative) =>
|
|
53
|
+
Atom.make((get) => {
|
|
54
|
+
const chat = get(initiative).chat;
|
|
55
|
+
return chat ? get(AtomRef.make(chat)) : undefined;
|
|
56
|
+
}),
|
|
57
|
+
),
|
|
58
|
+
[initiative],
|
|
59
|
+
),
|
|
60
|
+
);
|
|
61
|
+
|
|
62
|
+
const artifacts = useAtomValue(
|
|
63
|
+
useMemo(
|
|
64
|
+
() =>
|
|
65
|
+
AtomObj.make(initiative).pipe((initiative) =>
|
|
66
|
+
Atom.make((get) => {
|
|
67
|
+
return get(initiative).artifacts.map((artifact) => ({
|
|
68
|
+
name: artifact.name,
|
|
69
|
+
data: get(AtomRef.make(artifact.data)),
|
|
70
|
+
}));
|
|
71
|
+
}),
|
|
72
|
+
),
|
|
73
|
+
[initiative],
|
|
74
|
+
),
|
|
75
|
+
);
|
|
76
|
+
|
|
77
|
+
const selectedArtifact = artifacts.find((artifact) => artifact.name === selectedTab);
|
|
78
|
+
|
|
79
|
+
return (
|
|
80
|
+
<StackItem.Content toolbar>
|
|
81
|
+
<div
|
|
82
|
+
role='none'
|
|
83
|
+
className='flex-1 min-is-0 overflow-x-auto scrollbar-none flex gap-1 border-b border-subduedSeparator'
|
|
84
|
+
>
|
|
85
|
+
{tabs.map((tab) => (
|
|
86
|
+
<IconButton
|
|
87
|
+
key={tab}
|
|
88
|
+
icon={Match.value(tab).pipe(
|
|
89
|
+
Match.when(TAB_INITATIVE, () => 'ph--sparkle--regular'),
|
|
90
|
+
Match.when(TAB_CHAT, () => 'ph--chat--regular'),
|
|
91
|
+
Match.orElse(() => 'ph--file--regular'),
|
|
92
|
+
)}
|
|
93
|
+
label={tab}
|
|
94
|
+
variant={selectedTab === tab ? 'primary' : 'ghost'}
|
|
95
|
+
onClick={() => setSelectedTab(tab)}
|
|
96
|
+
/>
|
|
97
|
+
))}
|
|
98
|
+
</div>
|
|
99
|
+
{selectedTab === TAB_INITATIVE && <InitiativeForm initiative={initiative} />}
|
|
100
|
+
{selectedTab === TAB_CHAT && <Surface.Surface role='article' data={{ subject: chat }} limit={1} />}
|
|
101
|
+
{selectedArtifact && <Surface.Surface role='section' data={{ subject: selectedArtifact.data }} limit={1} />}
|
|
102
|
+
</StackItem.Content>
|
|
103
|
+
);
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
export default InitiativeContainer;
|
|
107
|
+
|
|
108
|
+
const InitiativeForm = ({ initiative }: { initiative: Initiative.Initiative }) => {
|
|
109
|
+
const handleChange = useCallback(
|
|
110
|
+
(
|
|
111
|
+
values: Omit<Initiative.Initiative, 'id'>,
|
|
112
|
+
{ isValid, changed }: { isValid: boolean; changed: Record<string, boolean> },
|
|
113
|
+
) => {
|
|
114
|
+
if (!isValid) {
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
const changedPaths = Object.keys(changed).filter((path) => changed[path as string]) as JsonPath[];
|
|
119
|
+
// Handle other property changes.
|
|
120
|
+
if (changedPaths.length > 0) {
|
|
121
|
+
Obj.change(initiative, () => {
|
|
122
|
+
for (const path of changedPaths) {
|
|
123
|
+
const parts = splitJsonPath(path);
|
|
124
|
+
const value = Obj.getValue(values as any, parts);
|
|
125
|
+
Obj.setValue(initiative, parts, value);
|
|
126
|
+
}
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
queueMicrotask(() => syncTriggers(initiative));
|
|
131
|
+
},
|
|
132
|
+
[initiative],
|
|
133
|
+
);
|
|
134
|
+
|
|
135
|
+
const fieldMap = useMemo<FormFieldMap>(
|
|
136
|
+
() => ({
|
|
137
|
+
spec: ({ type, label, getValue, onValueChange }) => {
|
|
138
|
+
const { t } = useTranslation();
|
|
139
|
+
|
|
140
|
+
const value: Ref.Ref<Text.Text> = getValue();
|
|
141
|
+
const target = useAtomValue(AtomRef.make(value));
|
|
142
|
+
const [initialValue] = useObject(target, 'content');
|
|
143
|
+
|
|
144
|
+
return (
|
|
145
|
+
<Input.Root>
|
|
146
|
+
<div role='none'>
|
|
147
|
+
<Input.Label>{toLocalizedString(label, t)}</Input.Label>
|
|
148
|
+
</div>
|
|
149
|
+
<MarkdownEditor.Root id={target?.id ?? ''} object={target}>
|
|
150
|
+
<MarkdownEditor.Content initialValue={initialValue} />
|
|
151
|
+
</MarkdownEditor.Root>
|
|
152
|
+
</Input.Root>
|
|
153
|
+
);
|
|
154
|
+
},
|
|
155
|
+
plan: ({ type, label, getValue, onValueChange }) => {
|
|
156
|
+
const { t } = useTranslation();
|
|
157
|
+
|
|
158
|
+
const value: Ref.Ref<Initiative.Plan> = getValue();
|
|
159
|
+
const target = useAtomValue(AtomRef.make(value));
|
|
160
|
+
|
|
161
|
+
return (
|
|
162
|
+
<Input.Root>
|
|
163
|
+
<div role='none'>
|
|
164
|
+
<Input.Label>{toLocalizedString(label, t)}</Input.Label>
|
|
165
|
+
</div>
|
|
166
|
+
<MarkdownEditor.Root id={target?.id ?? ''}>
|
|
167
|
+
<MarkdownEditor.Content initialValue={target ? Initiative.formatPlan(target) : ''} />
|
|
168
|
+
</MarkdownEditor.Root>
|
|
169
|
+
</Input.Root>
|
|
170
|
+
);
|
|
171
|
+
},
|
|
172
|
+
}),
|
|
173
|
+
[],
|
|
174
|
+
);
|
|
175
|
+
|
|
176
|
+
const computeRuntime = useCapability(AutomationCapabilities.ComputeRuntime);
|
|
177
|
+
|
|
178
|
+
const handleResetHistory = useCallback(async () => {
|
|
179
|
+
const runtime = computeRuntime.getRuntime(Obj.getDatabase(initiative)!.spaceId);
|
|
180
|
+
|
|
181
|
+
await runtime.runPromise(Initiative.resetChatHistory(initiative));
|
|
182
|
+
|
|
183
|
+
if (!initiative.queue) {
|
|
184
|
+
await runtime.runPromise(
|
|
185
|
+
Effect.gen(function* () {
|
|
186
|
+
const queue = yield* QueueService.createQueue();
|
|
187
|
+
Obj.change(initiative, (initiative) => {
|
|
188
|
+
initiative.queue = Ref.fromDXN(queue.dxn);
|
|
189
|
+
});
|
|
190
|
+
}),
|
|
191
|
+
);
|
|
192
|
+
}
|
|
193
|
+
}, [initiative, computeRuntime]);
|
|
194
|
+
|
|
195
|
+
const inputQueue = useAtomValue(
|
|
196
|
+
AtomObj.make(initiative).pipe((_) =>
|
|
197
|
+
Atom.make((get) =>
|
|
198
|
+
Option.fromNullable(get(_).queue).pipe(Option.map(AtomRef.make), Option.map(get), Option.getOrUndefined),
|
|
199
|
+
),
|
|
200
|
+
),
|
|
201
|
+
);
|
|
202
|
+
|
|
203
|
+
const inputQueueItems = useQuery(inputQueue, Query.select(Filter.everything()));
|
|
204
|
+
|
|
205
|
+
// TODO(dmaretskyi): Form breaks if we provide the echo object directly.
|
|
206
|
+
const spreadValue = useMemo(() => ({ ...initiative }), [initiative]);
|
|
207
|
+
return (
|
|
208
|
+
<div className='flex flex-col gap-2'>
|
|
209
|
+
<ButtonGroup classNames='h-10'>
|
|
210
|
+
<Button onClick={handleResetHistory}>Reset History</Button>
|
|
211
|
+
</ButtonGroup>
|
|
212
|
+
<h3 className='mb-2'>Input Queue</h3>
|
|
213
|
+
<div className='border border-subduedSeparator rounded-md p-2 h-64 overflow-y-auto'>
|
|
214
|
+
{inputQueueItems.map((item) => (
|
|
215
|
+
<Surface.Surface key={item.id} role='section' data={{ subject: item }} limit={1} />
|
|
216
|
+
))}
|
|
217
|
+
{inputQueueItems.length === 0 && <div className='text-subdued'>No items in queue</div>}
|
|
218
|
+
</div>
|
|
219
|
+
<Form.Root
|
|
220
|
+
schema={omitId(Initiative.Initiative)}
|
|
221
|
+
onValuesChanged={handleChange as any}
|
|
222
|
+
values={spreadValue}
|
|
223
|
+
db={Obj.getDatabase(initiative)}
|
|
224
|
+
fieldMap={fieldMap}
|
|
225
|
+
>
|
|
226
|
+
<Form.FieldSet />
|
|
227
|
+
</Form.Root>
|
|
228
|
+
</div>
|
|
229
|
+
);
|
|
230
|
+
};
|
|
231
|
+
|
|
232
|
+
// TODO(dmaretskyi): Perhaps the association is better done with a relation.
|
|
233
|
+
|
|
234
|
+
/**
|
|
235
|
+
* Foreign key {@link INITIATIVE_TRIGGER_EXTENSION_KEY} => <initative id : ObjectId>
|
|
236
|
+
*/
|
|
237
|
+
const INITIATIVE_TRIGGER_EXTENSION_KEY = 'dxos.org/extension/InitiativeTrigger';
|
|
238
|
+
|
|
239
|
+
/**
|
|
240
|
+
* Foreign key {@link INITIATIVE_TRIGGER_EXTENSION_KEY} => <dxn string of subscription target>
|
|
241
|
+
*/
|
|
242
|
+
const INITIATIVE_TRIGGER_TARGET_EXTENSION_KEY = 'dxos.org/extension/InitiativeTriggerTarget';
|
|
243
|
+
|
|
244
|
+
/**
|
|
245
|
+
* Syncs triggers in the database with the initiative subscriptions.
|
|
246
|
+
*/
|
|
247
|
+
|
|
248
|
+
const syncTriggers = async (initiative: Initiative.Initiative) => {
|
|
249
|
+
const db = Obj.getDatabase(initiative);
|
|
250
|
+
if (!db) {
|
|
251
|
+
return;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
const triggers = await db
|
|
255
|
+
.query(Filter.foreignKeys(Trigger.Trigger, [{ source: INITIATIVE_TRIGGER_EXTENSION_KEY, id: initiative.id }]))
|
|
256
|
+
.run();
|
|
257
|
+
|
|
258
|
+
// Delete triggers that are not in subscriptions.
|
|
259
|
+
for (const trigger of triggers) {
|
|
260
|
+
const target = Obj.getKeys(trigger, INITIATIVE_TRIGGER_TARGET_EXTENSION_KEY).at(0)?.id;
|
|
261
|
+
|
|
262
|
+
const exists = initiative.subscriptions.find((subscription) => subscription.dxn.toString() === target);
|
|
263
|
+
if (!exists && !(initiative.useQualifyingAgent && target === Obj.getDXN(initiative)?.toString())) {
|
|
264
|
+
db.remove(trigger);
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
// Add triggers that are not in the database.
|
|
269
|
+
for (const subscription of initiative.subscriptions) {
|
|
270
|
+
const relevantTrigger = triggers.find((trigger) =>
|
|
271
|
+
Obj.getKeys(trigger, INITIATIVE_TRIGGER_TARGET_EXTENSION_KEY).some(
|
|
272
|
+
(key) => key.id === subscription.dxn.toString(),
|
|
273
|
+
),
|
|
274
|
+
);
|
|
275
|
+
if (relevantTrigger) {
|
|
276
|
+
continue;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
const target = await subscription.tryLoad();
|
|
280
|
+
if (!target || !target.queue || !(target.queue.dxn instanceof DXN) || target.queue.dxn.kind !== DXN.kind.QUEUE) {
|
|
281
|
+
continue;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
db.add(
|
|
285
|
+
Trigger.make({
|
|
286
|
+
[Obj.Meta]: {
|
|
287
|
+
keys: [
|
|
288
|
+
{ source: INITIATIVE_TRIGGER_EXTENSION_KEY, id: initiative.id },
|
|
289
|
+
{ source: INITIATIVE_TRIGGER_TARGET_EXTENSION_KEY, id: subscription.dxn.toString() },
|
|
290
|
+
],
|
|
291
|
+
},
|
|
292
|
+
enabled: true,
|
|
293
|
+
spec: {
|
|
294
|
+
kind: 'queue',
|
|
295
|
+
queue: target.queue.dxn.toString(),
|
|
296
|
+
},
|
|
297
|
+
function: Ref.make(
|
|
298
|
+
FunctionDefinition.serialize(initiative.useQualifyingAgent ? Initiative.qualifier : Initiative.agent),
|
|
299
|
+
),
|
|
300
|
+
input: {
|
|
301
|
+
initiative: Ref.make(initiative),
|
|
302
|
+
event: '{{event}}',
|
|
303
|
+
},
|
|
304
|
+
concurrency: initiative.useQualifyingAgent ? 5 : undefined,
|
|
305
|
+
}),
|
|
306
|
+
);
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
if (initiative.useQualifyingAgent) {
|
|
310
|
+
const qualifierTrigger = triggers.find((trigger) =>
|
|
311
|
+
Obj.getKeys(trigger, INITIATIVE_TRIGGER_TARGET_EXTENSION_KEY).some(
|
|
312
|
+
(key) => key.id === Obj.getDXN(initiative)?.toString(),
|
|
313
|
+
),
|
|
314
|
+
);
|
|
315
|
+
if (!qualifierTrigger && initiative.queue) {
|
|
316
|
+
db.add(
|
|
317
|
+
Trigger.make({
|
|
318
|
+
[Obj.Meta]: {
|
|
319
|
+
keys: [
|
|
320
|
+
{ source: INITIATIVE_TRIGGER_EXTENSION_KEY, id: initiative.id },
|
|
321
|
+
{ source: INITIATIVE_TRIGGER_TARGET_EXTENSION_KEY, id: Obj.getDXN(initiative)?.toString() ?? '' },
|
|
322
|
+
],
|
|
323
|
+
},
|
|
324
|
+
function: Ref.make(FunctionDefinition.serialize(Initiative.agent)),
|
|
325
|
+
enabled: true,
|
|
326
|
+
spec: {
|
|
327
|
+
kind: 'queue',
|
|
328
|
+
queue: initiative.queue.dxn.toString(),
|
|
329
|
+
},
|
|
330
|
+
input: {
|
|
331
|
+
initiative: Ref.make(initiative),
|
|
332
|
+
event: '{{event}}',
|
|
333
|
+
},
|
|
334
|
+
}),
|
|
335
|
+
);
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
await db.flush({ indexes: true });
|
|
340
|
+
};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import React, { useMemo } from 'react';
|
|
6
|
+
|
|
7
|
+
import { type SurfaceComponentProps } from '@dxos/app-toolkit/ui';
|
|
8
|
+
import { Agent } from '@dxos/assistant-toolkit';
|
|
9
|
+
import { type Prompt } from '@dxos/blueprints';
|
|
10
|
+
import { Obj } from '@dxos/echo';
|
|
11
|
+
import { invokeFunctionWithTracing, useComputeRuntimeCallback } from '@dxos/plugin-automation';
|
|
12
|
+
import { Layout, Toolbar, useTranslation } from '@dxos/react-ui';
|
|
13
|
+
import { useAttention } from '@dxos/react-ui-attention';
|
|
14
|
+
|
|
15
|
+
import { meta } from '../meta';
|
|
16
|
+
|
|
17
|
+
import { TemplateEditor } from './TemplateEditor';
|
|
18
|
+
|
|
19
|
+
export type PromptArticleProps = SurfaceComponentProps<Prompt.Prompt>;
|
|
20
|
+
|
|
21
|
+
export const PromptArticle = ({ role, subject }: PromptArticleProps) => {
|
|
22
|
+
const { t } = useTranslation(meta.id);
|
|
23
|
+
const db = Obj.getDatabase(subject);
|
|
24
|
+
const { hasAttention } = useAttention(Obj.getDXN(subject).toString());
|
|
25
|
+
|
|
26
|
+
const inputData = useMemo(
|
|
27
|
+
() =>
|
|
28
|
+
subject && {
|
|
29
|
+
prompt: db?.makeRef(Obj.getDXN(subject)),
|
|
30
|
+
input: {},
|
|
31
|
+
},
|
|
32
|
+
[subject, db],
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
const handleRun = useComputeRuntimeCallback(db?.spaceId, () => invokeFunctionWithTracing(Agent.prompt, inputData), [
|
|
36
|
+
inputData,
|
|
37
|
+
]);
|
|
38
|
+
|
|
39
|
+
return (
|
|
40
|
+
<Layout.Main role={role} toolbar>
|
|
41
|
+
<Toolbar.Root disabled={!hasAttention} onClick={handleRun}>
|
|
42
|
+
<Toolbar.IconButton iconOnly icon='ph--play--regular' label={t('run prompt label')} onClick={handleRun} />
|
|
43
|
+
</Toolbar.Root>
|
|
44
|
+
<TemplateEditor id={subject.id} template={subject.instructions} classNames='container-max-width' />
|
|
45
|
+
</Layout.Main>
|
|
46
|
+
);
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
export default PromptArticle;
|
|
@@ -2,68 +2,89 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import '@
|
|
6
|
-
|
|
7
|
-
import { type Meta } from '@storybook/react-vite';
|
|
5
|
+
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
8
6
|
import React, { useState } from 'react';
|
|
9
7
|
|
|
10
8
|
import { createSystemPrompt } from '@dxos/assistant';
|
|
11
|
-
import { Template } from '@dxos/blueprints';
|
|
9
|
+
import { Blueprint, Template } from '@dxos/blueprints';
|
|
12
10
|
import { useClient } from '@dxos/react-client';
|
|
13
11
|
import { withClientProvider } from '@dxos/react-client/testing';
|
|
14
|
-
import {
|
|
12
|
+
import { withLayout, withTheme } from '@dxos/react-ui/testing';
|
|
15
13
|
import { trim } from '@dxos/util';
|
|
16
14
|
|
|
17
|
-
import { TemplateEditor, type TemplateEditorProps } from './TemplateEditor';
|
|
18
15
|
import { translations } from '../../translations';
|
|
19
16
|
|
|
17
|
+
import { TemplateEditor, type TemplateEditorProps } from './TemplateEditor';
|
|
18
|
+
|
|
19
|
+
const FENCE = '```';
|
|
20
|
+
|
|
20
21
|
const TEMPLATE = trim`
|
|
21
22
|
{{! System Prompt }}
|
|
22
23
|
|
|
23
|
-
You are
|
|
24
|
-
The move history of the current game is: {{history}}
|
|
24
|
+
You are an expert chess player.
|
|
25
|
+
The move history of the current game is: {{history}}.
|
|
25
26
|
If asked to suggest a move explain why it is a good move.
|
|
26
27
|
|
|
27
28
|
{{#each artifacts}}
|
|
28
|
-
|
|
29
|
+
{{this}}
|
|
29
30
|
{{/each}}
|
|
30
31
|
|
|
32
|
+
Reponse in the format: <suggestion>SUGGESTION</suggestion>
|
|
33
|
+
|
|
34
|
+
@dxn:queue:data:B6INSIBY3CBEF4M5VZRYBCMAHQMPYK5AJ:01K24XMVHSZHS97SG1VTVQDM5Z:01K24XPK464FSCKVQJAB2H662M
|
|
35
|
+
|
|
31
36
|
---
|
|
32
37
|
|
|
38
|
+
${FENCE}ts
|
|
39
|
+
const x = 100;
|
|
40
|
+
${FENCE}
|
|
41
|
+
|
|
33
42
|
{{input}}
|
|
34
43
|
`;
|
|
35
44
|
|
|
36
45
|
const DefaultStory = ({ source }: TemplateEditorProps & { source: string }) => {
|
|
37
46
|
const client = useClient();
|
|
38
|
-
const [
|
|
47
|
+
const [blueprint] = useState(() => {
|
|
39
48
|
const space = client.spaces.default;
|
|
40
|
-
return space.db.add(
|
|
49
|
+
return space.db.add(
|
|
50
|
+
Blueprint.make({
|
|
51
|
+
key: 'example.com/blueprint/test',
|
|
52
|
+
name: 'Test',
|
|
53
|
+
instructions: Template.make({ source }),
|
|
54
|
+
}),
|
|
55
|
+
);
|
|
41
56
|
});
|
|
42
57
|
|
|
43
|
-
return
|
|
58
|
+
return (
|
|
59
|
+
<TemplateEditor
|
|
60
|
+
classNames='bg-baseSurface is-full max-is-proseMaxWidth'
|
|
61
|
+
id={blueprint.id}
|
|
62
|
+
template={blueprint.instructions}
|
|
63
|
+
/>
|
|
64
|
+
);
|
|
44
65
|
};
|
|
45
66
|
|
|
46
|
-
const meta
|
|
67
|
+
const meta = {
|
|
47
68
|
title: 'plugins/plugin-assistant/TemplateEditor',
|
|
48
|
-
component: TemplateEditor,
|
|
69
|
+
component: TemplateEditor as any,
|
|
49
70
|
render: DefaultStory,
|
|
50
71
|
decorators: [
|
|
72
|
+
withTheme(),
|
|
73
|
+
withLayout({ layout: 'column' }),
|
|
51
74
|
withClientProvider({
|
|
75
|
+
types: [Blueprint.Blueprint],
|
|
52
76
|
createIdentity: true,
|
|
53
77
|
createSpace: true,
|
|
54
|
-
types: [Template.Template],
|
|
55
78
|
}),
|
|
56
|
-
withLayout({ fullscreen: true, Container: ColumnContainer }),
|
|
57
|
-
withTheme,
|
|
58
79
|
],
|
|
59
80
|
parameters: {
|
|
60
81
|
translations,
|
|
61
82
|
},
|
|
62
|
-
}
|
|
83
|
+
} satisfies Meta<typeof DefaultStory>;
|
|
63
84
|
|
|
64
85
|
export default meta;
|
|
65
86
|
|
|
66
|
-
type Story =
|
|
87
|
+
type Story = StoryObj<typeof meta>;
|
|
67
88
|
|
|
68
89
|
export const Default: Story = {
|
|
69
90
|
args: {
|
|
@@ -2,88 +2,69 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import {
|
|
6
|
-
import { styleTags, tags } from '@lezer/highlight';
|
|
7
|
-
import { handlebarsLanguage } from '@xiechao/codemirror-lang-handlebars';
|
|
5
|
+
import { defaultHighlightStyle, syntaxHighlighting } from '@codemirror/language';
|
|
8
6
|
import React from 'react';
|
|
9
7
|
|
|
10
8
|
import { type Template } from '@dxos/blueprints';
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
9
|
+
import { createDocAccessor } from '@dxos/echo-db';
|
|
10
|
+
import { type ThemedClassName, useThemeContext, useTranslation } from '@dxos/react-ui';
|
|
11
|
+
import { useTextEditor } from '@dxos/react-ui-editor';
|
|
14
12
|
import {
|
|
15
13
|
createBasicExtensions,
|
|
16
14
|
createDataExtensions,
|
|
15
|
+
createMarkdownExtensions,
|
|
17
16
|
createThemeExtensions,
|
|
18
|
-
|
|
19
|
-
} from '@dxos/
|
|
20
|
-
import { mx } from '@dxos/
|
|
17
|
+
decorateMarkdown,
|
|
18
|
+
} from '@dxos/ui-editor';
|
|
19
|
+
import { mx } from '@dxos/ui-theme';
|
|
20
|
+
import { isNonNullable } from '@dxos/util';
|
|
21
21
|
|
|
22
22
|
import { meta } from '../../meta';
|
|
23
23
|
|
|
24
|
-
|
|
25
|
-
props: [
|
|
26
|
-
styleTags({
|
|
27
|
-
'---': tags.lineComment,
|
|
28
|
-
}),
|
|
29
|
-
],
|
|
30
|
-
});
|
|
24
|
+
import { handlebars, xmlDecorator } from './extensions';
|
|
31
25
|
|
|
32
26
|
export type TemplateEditorProps = ThemedClassName<{
|
|
27
|
+
id: string;
|
|
33
28
|
template: Template.Template;
|
|
29
|
+
lineNumbers?: boolean;
|
|
34
30
|
}>;
|
|
35
31
|
|
|
36
|
-
export const TemplateEditor = ({ classNames, template }: TemplateEditorProps) => {
|
|
32
|
+
export const TemplateEditor = ({ id, classNames, template, lineNumbers = true }: TemplateEditorProps) => {
|
|
37
33
|
const { t } = useTranslation(meta.id);
|
|
38
34
|
const { themeMode } = useThemeContext();
|
|
39
35
|
const { parentRef } = useTextEditor(() => {
|
|
40
|
-
|
|
36
|
+
const text = template.source?.target;
|
|
37
|
+
if (!text) {
|
|
38
|
+
return {};
|
|
39
|
+
}
|
|
40
|
+
|
|
41
41
|
return {
|
|
42
|
-
initialValue:
|
|
42
|
+
initialValue: text.content ?? '',
|
|
43
43
|
extensions: [
|
|
44
44
|
createDataExtensions({
|
|
45
|
-
id
|
|
46
|
-
text: createDocAccessor(
|
|
45
|
+
id,
|
|
46
|
+
text: createDocAccessor(text, ['content']),
|
|
47
47
|
}),
|
|
48
48
|
createBasicExtensions({
|
|
49
49
|
bracketMatching: false,
|
|
50
|
-
lineNumbers
|
|
50
|
+
lineNumbers,
|
|
51
51
|
lineWrapping: true,
|
|
52
|
-
monospace: true,
|
|
53
52
|
placeholder: t('template placeholder'),
|
|
54
53
|
}),
|
|
55
54
|
createThemeExtensions({
|
|
56
55
|
themeMode,
|
|
56
|
+
slots: { content: { className: '!pie-4' } },
|
|
57
57
|
}),
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
58
|
+
createMarkdownExtensions(),
|
|
59
|
+
decorateMarkdown(),
|
|
60
|
+
handlebars(),
|
|
61
|
+
// xml(),
|
|
62
|
+
// NOTE: Since we're using markdown only HTML nodes are parsed.
|
|
63
|
+
xmlDecorator(),
|
|
64
|
+
syntaxHighlighting(defaultHighlightStyle),
|
|
65
|
+
].filter(isNonNullable),
|
|
62
66
|
};
|
|
63
|
-
}, [themeMode, template]);
|
|
67
|
+
}, [themeMode, template.source?.target, lineNumbers]);
|
|
64
68
|
|
|
65
|
-
return <div ref={parentRef} className={mx('
|
|
69
|
+
return <div ref={parentRef} className={mx('bs-full overflow-hidden', classNames)} />;
|
|
66
70
|
};
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* https://github.com/xiechao/lang-handlebars/blob/direct/src/highlight.js
|
|
70
|
-
*/
|
|
71
|
-
export const handlebarsHighlightStyle = HighlightStyle.define([
|
|
72
|
-
{
|
|
73
|
-
// Braces.
|
|
74
|
-
tag: tags.tagName,
|
|
75
|
-
class: 'text-redText',
|
|
76
|
-
},
|
|
77
|
-
{
|
|
78
|
-
tag: tags.variableName,
|
|
79
|
-
class: 'text-blueText',
|
|
80
|
-
},
|
|
81
|
-
{
|
|
82
|
-
tag: tags.keyword,
|
|
83
|
-
class: 'text-greenText',
|
|
84
|
-
},
|
|
85
|
-
{
|
|
86
|
-
tag: tags.comment,
|
|
87
|
-
class: 'text-subdued',
|
|
88
|
-
},
|
|
89
|
-
]);
|