@dxos/plugin-assistant 0.8.4-main.67995b8 → 0.8.4-main.6fa680abb7
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/AssistantSettings-PP6JSHWB.mjs +93 -0
- package/dist/lib/browser/AssistantSettings-PP6JSHWB.mjs.map +7 -0
- package/dist/lib/browser/BlueprintArticle-H6R33TZZ.mjs +35 -0
- package/dist/lib/browser/BlueprintArticle-H6R33TZZ.mjs.map +7 -0
- package/dist/lib/browser/ChatCompanion-GXS6DK4X.mjs +202 -0
- package/dist/lib/browser/ChatCompanion-GXS6DK4X.mjs.map +7 -0
- package/dist/lib/browser/ChatContainer-SMSZXEF5.mjs +12 -0
- package/dist/lib/browser/ChatContainer-SMSZXEF5.mjs.map +7 -0
- package/dist/lib/browser/ChatDialog-ZCVPPONM.mjs +85 -0
- package/dist/lib/browser/ChatDialog-ZCVPPONM.mjs.map +7 -0
- package/dist/lib/browser/ProjectArticle-QDBTIFNE.mjs +91 -0
- package/dist/lib/browser/ProjectArticle-QDBTIFNE.mjs.map +7 -0
- package/dist/lib/browser/ProjectSettings-L5MCDUXK.mjs +232 -0
- package/dist/lib/browser/ProjectSettings-L5MCDUXK.mjs.map +7 -0
- package/dist/lib/browser/PromptArticle-G5YSAEGK.mjs +71 -0
- package/dist/lib/browser/PromptArticle-G5YSAEGK.mjs.map +7 -0
- package/dist/lib/browser/TriggerStatus-X35WDCK5.mjs +112 -0
- package/dist/lib/browser/TriggerStatus-X35WDCK5.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-ECQCWGCN.mjs +224 -0
- package/dist/lib/browser/app-graph-builder-ECQCWGCN.mjs.map +7 -0
- package/dist/lib/browser/blueprint-definition-CKG4TQ2J.mjs +35 -0
- package/dist/lib/browser/blueprint-definition-CKG4TQ2J.mjs.map +7 -0
- package/dist/lib/browser/blueprints/index.mjs +8 -0
- package/dist/lib/browser/blueprints/index.mjs.map +7 -0
- package/dist/lib/browser/chunk-2VIEX4RA.mjs +23 -0
- package/dist/lib/browser/chunk-2VIEX4RA.mjs.map +7 -0
- package/dist/lib/browser/chunk-734CB3XG.mjs +230 -0
- package/dist/lib/browser/chunk-734CB3XG.mjs.map +7 -0
- package/dist/lib/browser/chunk-A346P45I.mjs +2125 -0
- package/dist/lib/browser/chunk-A346P45I.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-JYY5AD65.mjs +286 -0
- package/dist/lib/browser/chunk-JYY5AD65.mjs.map +7 -0
- package/dist/lib/browser/chunk-WP4WY2Y6.mjs +69 -0
- package/dist/lib/browser/chunk-WP4WY2Y6.mjs.map +7 -0
- package/dist/lib/browser/chunk-ZZRRSIQQ.mjs +26 -0
- package/dist/lib/browser/chunk-ZZRRSIQQ.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 +295 -175
- 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-DYSWWNVG.mjs +123 -0
- package/dist/lib/browser/operation-resolver-DYSWWNVG.mjs.map +7 -0
- package/dist/lib/browser/react-surface-M3GSSFPC.mjs +142 -0
- package/dist/lib/browser/react-surface-M3GSSFPC.mjs.map +7 -0
- package/dist/lib/browser/settings-NC5DQWES.mjs +33 -0
- package/dist/lib/browser/settings-NC5DQWES.mjs.map +7 -0
- package/dist/lib/browser/state-EMIKHGYZ.mjs +26 -0
- package/dist/lib/browser/state-EMIKHGYZ.mjs.map +7 -0
- package/dist/lib/browser/toolkit-XRSBBB3L.mjs +16 -0
- package/dist/lib/browser/toolkit-XRSBBB3L.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +11 -4
- package/dist/lib/node-esm/AssistantSettings-3MNGBQB2.mjs +94 -0
- package/dist/lib/node-esm/AssistantSettings-3MNGBQB2.mjs.map +7 -0
- package/dist/lib/node-esm/BlueprintArticle-2KYFUQKY.mjs +36 -0
- package/dist/lib/node-esm/BlueprintArticle-2KYFUQKY.mjs.map +7 -0
- package/dist/lib/node-esm/ChatCompanion-MPQGSWZB.mjs +203 -0
- package/dist/lib/node-esm/ChatCompanion-MPQGSWZB.mjs.map +7 -0
- package/dist/lib/node-esm/ChatContainer-DMOAYUUM.mjs +13 -0
- package/dist/lib/node-esm/ChatContainer-DMOAYUUM.mjs.map +7 -0
- package/dist/lib/node-esm/ChatDialog-PV2EU2XM.mjs +86 -0
- package/dist/lib/node-esm/ChatDialog-PV2EU2XM.mjs.map +7 -0
- package/dist/lib/node-esm/ProjectArticle-BCIBESJN.mjs +92 -0
- package/dist/lib/node-esm/ProjectArticle-BCIBESJN.mjs.map +7 -0
- package/dist/lib/node-esm/ProjectSettings-K3YBQWDD.mjs +233 -0
- package/dist/lib/node-esm/ProjectSettings-K3YBQWDD.mjs.map +7 -0
- package/dist/lib/node-esm/PromptArticle-HAGZPZWV.mjs +72 -0
- package/dist/lib/node-esm/PromptArticle-HAGZPZWV.mjs.map +7 -0
- package/dist/lib/node-esm/TriggerStatus-V3QMIE7T.mjs +113 -0
- package/dist/lib/node-esm/TriggerStatus-V3QMIE7T.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-YPHP6X6W.mjs +225 -0
- package/dist/lib/node-esm/app-graph-builder-YPHP6X6W.mjs.map +7 -0
- package/dist/lib/node-esm/blueprint-definition-UZWGSFBI.mjs +36 -0
- package/dist/lib/node-esm/blueprint-definition-UZWGSFBI.mjs.map +7 -0
- package/dist/lib/node-esm/blueprints/index.mjs +9 -0
- package/dist/lib/node-esm/blueprints/index.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-5DLYAEBK.mjs +2126 -0
- package/dist/lib/node-esm/chunk-5DLYAEBK.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-AK3JJ76X.mjs +28 -0
- package/dist/lib/node-esm/chunk-AK3JJ76X.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-JMBYVUD6.mjs +288 -0
- package/dist/lib/node-esm/chunk-JMBYVUD6.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-JQAXFBBU.mjs +231 -0
- package/dist/lib/node-esm/chunk-JQAXFBBU.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-TEYTGR67.mjs +25 -0
- package/dist/lib/node-esm/chunk-TEYTGR67.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-ZTL6HRDB.mjs +70 -0
- package/dist/lib/node-esm/chunk-ZTL6HRDB.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 +295 -175
- 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-EE4EBO2Y.mjs +124 -0
- package/dist/lib/node-esm/operation-resolver-EE4EBO2Y.mjs.map +7 -0
- package/dist/lib/node-esm/react-surface-U3PGFTKA.mjs +143 -0
- package/dist/lib/node-esm/react-surface-U3PGFTKA.mjs.map +7 -0
- package/dist/lib/node-esm/settings-OOAN5LAO.mjs +34 -0
- package/dist/lib/node-esm/settings-OOAN5LAO.mjs.map +7 -0
- package/dist/lib/node-esm/state-7A7QPQKK.mjs +27 -0
- package/dist/lib/node-esm/state-7A7QPQKK.mjs.map +7 -0
- package/dist/lib/node-esm/toolkit-5IWGLUF4.mjs +17 -0
- package/dist/lib/node-esm/toolkit-5IWGLUF4.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 +4 -0
- package/dist/types/src/blueprints/assistant/blueprint.d.ts.map +1 -0
- package/dist/types/src/blueprints/assistant/blueprint.test.d.ts +2 -0
- package/dist/types/src/blueprints/assistant/blueprint.test.d.ts.map +1 -0
- package/dist/types/src/blueprints/assistant/index.d.ts +2 -0
- package/dist/types/src/blueprints/assistant/index.d.ts.map +1 -0
- package/dist/types/src/blueprints/index.d.ts +2 -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 +6 -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 +3 -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 +10 -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/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/Chat/Chat.d.ts +39 -22
- 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/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 +318 -56
- 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/TemplateEditor/TemplateEditor.d.ts +2 -6
- package/dist/types/src/components/TemplateEditor/TemplateEditor.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/TemplateEditor.stories.d.ts +437 -7
- package/dist/types/src/components/TemplateEditor/TemplateEditor.stories.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/TemplateForm.d.ts +12 -2
- package/dist/types/src/components/TemplateEditor/TemplateForm.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/TemplateForm.stories.d.ts +434 -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 +10 -16
- package/dist/types/src/components/Toolbox/Toolbox.d.ts.map +1 -1
- package/dist/types/src/components/Toolbox/Toolbox.stories.d.ts +438 -5
- package/dist/types/src/components/Toolbox/Toolbox.stories.d.ts.map +1 -1
- 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 +0 -8
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/containers/AssistantSettings/AssistantSettings.d.ts +8 -0
- package/dist/types/src/containers/AssistantSettings/AssistantSettings.d.ts.map +1 -0
- package/dist/types/src/containers/AssistantSettings/index.d.ts +3 -0
- package/dist/types/src/containers/AssistantSettings/index.d.ts.map +1 -0
- package/dist/types/src/containers/BlueprintArticle/BlueprintArticle.d.ts +6 -0
- package/dist/types/src/containers/BlueprintArticle/BlueprintArticle.d.ts.map +1 -0
- package/dist/types/src/containers/BlueprintArticle/index.d.ts +3 -0
- package/dist/types/src/containers/BlueprintArticle/index.d.ts.map +1 -0
- package/dist/types/src/containers/ChatCompanion/ChatCompanion.d.ts +12 -0
- package/dist/types/src/containers/ChatCompanion/ChatCompanion.d.ts.map +1 -0
- package/dist/types/src/containers/ChatCompanion/index.d.ts +3 -0
- package/dist/types/src/containers/ChatCompanion/index.d.ts.map +1 -0
- package/dist/types/src/containers/ChatContainer/ChatContainer.d.ts +19 -0
- package/dist/types/src/containers/ChatContainer/ChatContainer.d.ts.map +1 -0
- package/dist/types/src/containers/ChatContainer/index.d.ts +3 -0
- package/dist/types/src/containers/ChatContainer/index.d.ts.map +1 -0
- package/dist/types/src/{components → containers/ChatDialog}/ChatDialog.d.ts +2 -3
- package/dist/types/src/containers/ChatDialog/ChatDialog.d.ts.map +1 -0
- package/dist/types/src/containers/ChatDialog/index.d.ts +3 -0
- package/dist/types/src/containers/ChatDialog/index.d.ts.map +1 -0
- package/dist/types/src/containers/Project/ProjectArticle.d.ts +7 -0
- package/dist/types/src/containers/Project/ProjectArticle.d.ts.map +1 -0
- package/dist/types/src/containers/Project/ProjectSettings.d.ts +6 -0
- package/dist/types/src/containers/Project/ProjectSettings.d.ts.map +1 -0
- package/dist/types/src/containers/Project/index.d.ts +7 -0
- package/dist/types/src/containers/Project/index.d.ts.map +1 -0
- package/dist/types/src/containers/Project/triggers.d.ts +6 -0
- package/dist/types/src/containers/Project/triggers.d.ts.map +1 -0
- package/dist/types/src/containers/PromptArticle/PromptArticle.d.ts +6 -0
- package/dist/types/src/containers/PromptArticle/PromptArticle.d.ts.map +1 -0
- package/dist/types/src/containers/PromptArticle/index.d.ts +3 -0
- package/dist/types/src/containers/PromptArticle/index.d.ts.map +1 -0
- package/dist/types/src/containers/TriggerStatus/TriggerStatus.d.ts +4 -0
- package/dist/types/src/containers/TriggerStatus/TriggerStatus.d.ts.map +1 -0
- package/dist/types/src/containers/TriggerStatus/index.d.ts +3 -0
- package/dist/types/src/containers/TriggerStatus/index.d.ts.map +1 -0
- package/dist/types/src/containers/index.d.ts +10 -0
- package/dist/types/src/containers/index.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 +3 -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 +382 -28
- 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 +93 -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 +127 -100
- package/src/AssistantPlugin.tsx +153 -113
- package/src/blueprints/assistant/blueprint.conversations.json +1 -0
- package/src/blueprints/assistant/blueprint.test.ts +48 -0
- package/src/blueprints/assistant/blueprint.ts +27 -0
- package/src/blueprints/assistant/index.ts +5 -0
- package/src/{components/SequenceEditor → blueprints}/index.ts +1 -1
- 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 +197 -0
- package/src/capabilities/app-graph-builder/index.ts +7 -0
- package/src/capabilities/blueprint-definition/blueprint-definition.ts +50 -0
- package/src/capabilities/blueprint-definition/index.ts +7 -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 +10 -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 +113 -0
- package/src/capabilities/react-surface/index.ts +7 -0
- package/src/capabilities/react-surface/react-surface.tsx +119 -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 +15 -0
- package/src/components/Chat/Chat.tsx +278 -198
- package/src/components/Chat/events.ts +14 -1
- package/src/components/ChatProgress/ChatProgress.tsx +53 -0
- package/src/components/ChatProgress/index.ts +5 -0
- package/src/components/ChatPrompt/ChatActions.tsx +20 -28
- package/src/components/ChatPrompt/ChatOptions.tsx +258 -0
- package/src/components/ChatPrompt/ChatPresets.tsx +1 -0
- package/src/components/ChatPrompt/ChatReferences.tsx +42 -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 +207 -0
- package/src/components/ChatThread/sync.test.ts +99 -0
- package/src/components/ChatThread/sync.ts +160 -0
- package/src/components/ChatThread/testing/thread.md +37 -0
- package/src/components/TemplateEditor/TemplateEditor.stories.tsx +39 -18
- package/src/components/TemplateEditor/TemplateEditor.tsx +33 -54
- package/src/components/TemplateEditor/TemplateForm.stories.tsx +28 -15
- package/src/components/TemplateEditor/TemplateForm.tsx +84 -36
- 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 +19 -29
- package/src/components/Toolbox/Toolbox.tsx +74 -104
- package/src/components/Typewriter/AssistantToolbar.tsx +161 -0
- package/src/components/Typewriter/Typewriter.stories.tsx +86 -0
- package/src/components/Typewriter/Typewriter.tsx +54 -0
- package/src/components/Typewriter/assistant-extension.tsx +142 -0
- package/src/components/Typewriter/index.ts +5 -0
- package/src/components/index.ts +0 -13
- package/src/containers/AssistantSettings/AssistantSettings.tsx +120 -0
- package/src/containers/AssistantSettings/index.ts +7 -0
- package/src/containers/BlueprintArticle/BlueprintArticle.tsx +29 -0
- package/src/containers/BlueprintArticle/index.ts +7 -0
- package/src/containers/ChatCompanion/ChatCompanion.tsx +225 -0
- package/src/containers/ChatCompanion/index.ts +7 -0
- package/src/containers/ChatContainer/ChatContainer.tsx +69 -0
- package/src/containers/ChatContainer/index.ts +7 -0
- package/src/containers/ChatDialog/ChatDialog.tsx +72 -0
- package/src/containers/ChatDialog/index.ts +7 -0
- package/src/containers/Project/ProjectArticle.tsx +117 -0
- package/src/containers/Project/ProjectSettings.tsx +134 -0
- package/src/containers/Project/index.ts +16 -0
- package/src/containers/Project/triggers.ts +149 -0
- package/src/containers/PromptArticle/PromptArticle.tsx +59 -0
- package/src/containers/PromptArticle/index.ts +7 -0
- package/src/containers/TriggerStatus/TriggerStatus.tsx +140 -0
- package/src/containers/TriggerStatus/index.ts +7 -0
- package/src/containers/index.ts +15 -0
- package/src/hooks/index.ts +8 -4
- package/src/hooks/useBlueprintRegistry.ts +108 -0
- package/src/hooks/useChatProcessor.ts +40 -105
- package/src/hooks/useChatServices.ts +31 -51
- 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 +12 -13
- package/src/index.ts +3 -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 +73 -0
- package/src/processor/processor.ts +296 -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 +5 -30
- package/src/testing/test-services.ts +10 -14
- package/src/translations.ts +77 -20
- 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 +27 -16
- package/src/vite-env.d.ts +30 -0
- package/dist/lib/browser/BlueprintContainer-IZ4AK5EO.mjs +0 -28
- package/dist/lib/browser/BlueprintContainer-IZ4AK5EO.mjs.map +0 -7
- package/dist/lib/browser/ChatContainer-RP3QEXYX.mjs +0 -54
- package/dist/lib/browser/ChatContainer-RP3QEXYX.mjs.map +0 -7
- package/dist/lib/browser/ChatDialog-ZVLXFHEY.mjs +0 -72
- package/dist/lib/browser/ChatDialog-ZVLXFHEY.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/app-graph-builder-XSEOKJLG.mjs +0 -164
- package/dist/lib/browser/app-graph-builder-XSEOKJLG.mjs.map +0 -7
- package/dist/lib/browser/chunk-63GG6U6D.mjs +0 -2226
- package/dist/lib/browser/chunk-63GG6U6D.mjs.map +0 -7
- package/dist/lib/browser/chunk-7W7LHTRH.mjs +0 -171
- package/dist/lib/browser/chunk-7W7LHTRH.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-KFXSBNZR.mjs +0 -89
- package/dist/lib/browser/chunk-KFXSBNZR.mjs.map +0 -7
- package/dist/lib/browser/chunk-LERGF5YG.mjs +0 -108
- package/dist/lib/browser/chunk-LERGF5YG.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-MV3VSZLS.mjs +0 -75
- package/dist/lib/browser/intent-resolver-MV3VSZLS.mjs.map +0 -7
- package/dist/lib/browser/react-surface-3GYEHQRP.mjs +0 -150
- package/dist/lib/browser/react-surface-3GYEHQRP.mjs.map +0 -7
- package/dist/lib/browser/settings-5GTTCVGD.mjs +0 -22
- package/dist/lib/browser/settings-5GTTCVGD.mjs.map +0 -7
- package/dist/lib/node-esm/BlueprintContainer-RGTMNLNX.mjs +0 -29
- package/dist/lib/node-esm/BlueprintContainer-RGTMNLNX.mjs.map +0 -7
- package/dist/lib/node-esm/ChatContainer-W3W6FWV3.mjs +0 -55
- package/dist/lib/node-esm/ChatContainer-W3W6FWV3.mjs.map +0 -7
- package/dist/lib/node-esm/ChatDialog-QW4JRKVO.mjs +0 -73
- package/dist/lib/node-esm/ChatDialog-QW4JRKVO.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/app-graph-builder-PANCJUHV.mjs +0 -165
- package/dist/lib/node-esm/app-graph-builder-PANCJUHV.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-BFO3KHYL.mjs +0 -2227
- package/dist/lib/node-esm/chunk-BFO3KHYL.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-MS3PJARN.mjs +0 -109
- package/dist/lib/node-esm/chunk-MS3PJARN.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-VIIMA3XQ.mjs +0 -90
- package/dist/lib/node-esm/chunk-VIIMA3XQ.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-Z7PUODRT.mjs +0 -172
- package/dist/lib/node-esm/chunk-Z7PUODRT.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-3FMC3GHC.mjs +0 -76
- package/dist/lib/node-esm/intent-resolver-3FMC3GHC.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-QDQWJ7FZ.mjs +0 -151
- package/dist/lib/node-esm/react-surface-QDQWJ7FZ.mjs.map +0 -7
- package/dist/lib/node-esm/settings-J2EXEM5H.mjs +0 -23
- package/dist/lib/node-esm/settings-J2EXEM5H.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/capability-definitions.d.ts +0 -7
- package/dist/types/src/capability-definitions.d.ts.map +0 -1
- package/dist/types/src/components/AssistantSettings/AssistantSettings.d.ts +0 -6
- package/dist/types/src/components/AssistantSettings/AssistantSettings.d.ts.map +0 -1
- package/dist/types/src/components/AssistantSettings/index.d.ts +0 -2
- package/dist/types/src/components/AssistantSettings/index.d.ts.map +0 -1
- 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/ChatContainer.d.ts +0 -11
- package/dist/types/src/components/ChatContainer.d.ts.map +0 -1
- package/dist/types/src/components/ChatDialog.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/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 -207
- 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 -120
- package/dist/types/src/types/schema.d.ts.map +0 -1
- package/src/capabilities/app-graph-builder.ts +0 -169
- package/src/capabilities/intent-resolver.ts +0 -72
- package/src/capabilities/react-surface.tsx +0 -138
- package/src/capabilities/settings.ts +0 -19
- package/src/capability-definitions.ts +0 -15
- package/src/components/AssistantSettings/AssistantSettings.tsx +0 -105
- package/src/components/AssistantSettings/index.ts +0 -5
- package/src/components/BlueprintContainer.tsx +0 -24
- package/src/components/ChatContainer.tsx +0 -45
- package/src/components/ChatDialog.tsx +0 -64
- 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/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 -371
- 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 -108
- package/src/typings.d.ts +0 -9
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2026 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { type Diagnostic, linter } from '@codemirror/lint';
|
|
6
|
+
import { type Extension, StateField } from '@codemirror/state';
|
|
7
|
+
import { EditorView, type Tooltip, showTooltip } from '@codemirror/view';
|
|
8
|
+
import * as LanguageModel from '@effect/ai/LanguageModel';
|
|
9
|
+
import * as Effect from 'effect/Effect';
|
|
10
|
+
import * as Runtime from 'effect/Runtime';
|
|
11
|
+
import React from 'react';
|
|
12
|
+
import { createRoot } from 'react-dom/client';
|
|
13
|
+
|
|
14
|
+
import { unwrapExit } from '@dxos/effect';
|
|
15
|
+
import { log } from '@dxos/log';
|
|
16
|
+
|
|
17
|
+
import { AssistantToolbar } from './AssistantToolbar';
|
|
18
|
+
|
|
19
|
+
export const assistant = (runtime: Runtime.Runtime<LanguageModel.LanguageModel>): Extension[] => {
|
|
20
|
+
return [
|
|
21
|
+
assistantState(runtime),
|
|
22
|
+
assistantLinter(runtime),
|
|
23
|
+
EditorView.baseTheme({
|
|
24
|
+
'.cm-tooltip-assistant': {
|
|
25
|
+
backgroundColor: 'transparent !important',
|
|
26
|
+
border: 'none !important',
|
|
27
|
+
padding: '0 !important',
|
|
28
|
+
},
|
|
29
|
+
}),
|
|
30
|
+
];
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
//
|
|
34
|
+
// Toolbar State & Tooltip
|
|
35
|
+
//
|
|
36
|
+
|
|
37
|
+
const assistantState = (runtime: Runtime.Runtime<LanguageModel.LanguageModel>) =>
|
|
38
|
+
StateField.define<Tooltip | null>({
|
|
39
|
+
create: () => null,
|
|
40
|
+
update: (tooltip, tr): Tooltip | null => {
|
|
41
|
+
if (tr.selection || tr.docChanged) {
|
|
42
|
+
const { from, to } = tr.state.selection.main;
|
|
43
|
+
if (from === to) {
|
|
44
|
+
return null;
|
|
45
|
+
} // No selection
|
|
46
|
+
|
|
47
|
+
// Check if we should show tooltip
|
|
48
|
+
// We return a tooltip object
|
|
49
|
+
return {
|
|
50
|
+
pos: from,
|
|
51
|
+
above: false,
|
|
52
|
+
strictSide: true,
|
|
53
|
+
create: (view) => {
|
|
54
|
+
const dom = document.createElement('div');
|
|
55
|
+
dom.classList.add('cm-tooltip-assistant');
|
|
56
|
+
const root = createRoot(dom);
|
|
57
|
+
|
|
58
|
+
root.render(React.createElement(AssistantToolbar, { view, runtime, from, to }));
|
|
59
|
+
|
|
60
|
+
return {
|
|
61
|
+
dom,
|
|
62
|
+
destroy: () => {
|
|
63
|
+
// Delay unmount to allow animations if needed, but for now just cleanup
|
|
64
|
+
setTimeout(() => root.unmount(), 0);
|
|
65
|
+
},
|
|
66
|
+
};
|
|
67
|
+
},
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
return tooltip;
|
|
71
|
+
},
|
|
72
|
+
provide: (f) => showTooltip.from(f),
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
//
|
|
76
|
+
// Linter
|
|
77
|
+
//
|
|
78
|
+
|
|
79
|
+
const assistantLinter = (runtime: Runtime.Runtime<LanguageModel.LanguageModel>) =>
|
|
80
|
+
linter(async (view) => {
|
|
81
|
+
const text = view.state.doc.toString();
|
|
82
|
+
if (text.length < 10) {
|
|
83
|
+
return [];
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// Run proofreading effect
|
|
87
|
+
const prompt = `Proofread the following text. Identify typos and simple grammar mistakes. Return ONLY a valid JSON array of objects with fields: "original" (string), "replacement" (string), "context" (string, 3-5 words around match). Text: \n\n${text}`;
|
|
88
|
+
|
|
89
|
+
// We mocked the model behavior in the story, but here we assume the model returns a string.
|
|
90
|
+
// In a real implementation we would parse the JSON.
|
|
91
|
+
// For this refactor, we just wire it up.
|
|
92
|
+
|
|
93
|
+
// NOTE: This runs on every doc view update that triggers linter. Linter is debounced by default (750ms).
|
|
94
|
+
|
|
95
|
+
try {
|
|
96
|
+
const result = unwrapExit(
|
|
97
|
+
await Effect.gen(function* () {
|
|
98
|
+
const generated = yield* LanguageModel.generateText({ prompt });
|
|
99
|
+
return generated.text;
|
|
100
|
+
}).pipe(Runtime.runPromiseExit(runtime)),
|
|
101
|
+
);
|
|
102
|
+
|
|
103
|
+
// Parse result - assuming simpler mock response format for now or we build a robust parser
|
|
104
|
+
// For the purpose of this task (UX demo), we can assume the mock returns a specific format or we parse it.
|
|
105
|
+
// Let's assume the mock returns a JSON string.
|
|
106
|
+
|
|
107
|
+
let suggestions: any[] = [];
|
|
108
|
+
try {
|
|
109
|
+
// Find JSON in response
|
|
110
|
+
const match = result.match(/\[.*\]/s);
|
|
111
|
+
if (match) {
|
|
112
|
+
suggestions = JSON.parse(match[0]);
|
|
113
|
+
}
|
|
114
|
+
} catch {}
|
|
115
|
+
|
|
116
|
+
const diagnostics: Diagnostic[] = [];
|
|
117
|
+
for (const s of suggestions) {
|
|
118
|
+
// Naive finding of position
|
|
119
|
+
const idx = text.indexOf(s.original);
|
|
120
|
+
if (idx !== -1) {
|
|
121
|
+
diagnostics.push({
|
|
122
|
+
from: idx,
|
|
123
|
+
to: idx + s.original.length,
|
|
124
|
+
severity: 'info',
|
|
125
|
+
message: `Suggestion: ${s.replacement}`,
|
|
126
|
+
actions: [
|
|
127
|
+
{
|
|
128
|
+
name: 'Apply',
|
|
129
|
+
apply: (view, from, to) => {
|
|
130
|
+
view.dispatch({ changes: { from, to, insert: s.replacement } });
|
|
131
|
+
},
|
|
132
|
+
},
|
|
133
|
+
],
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
return diagnostics;
|
|
138
|
+
} catch (error) {
|
|
139
|
+
log.catch(error);
|
|
140
|
+
return [];
|
|
141
|
+
}
|
|
142
|
+
});
|
package/src/components/index.ts
CHANGED
|
@@ -2,19 +2,6 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { lazy } from 'react';
|
|
6
|
-
|
|
7
|
-
export * from './AssistantSettings';
|
|
8
5
|
export * from './Chat';
|
|
9
|
-
export * from './PromptSettings';
|
|
10
6
|
export * from './TemplateEditor';
|
|
11
7
|
export * from './Toolbox';
|
|
12
|
-
|
|
13
|
-
// TODO(burdon): Lazy loading causes issues with Tabster.
|
|
14
|
-
// Repro: open assistant dialog then close.
|
|
15
|
-
// https://github.com/microsoft/fluentui/issues/34020
|
|
16
|
-
|
|
17
|
-
export const BlueprintContainer = lazy(() => import('./BlueprintContainer'));
|
|
18
|
-
export const ChatContainer = lazy(() => import('./ChatContainer'));
|
|
19
|
-
export const ChatDialog = lazy(() => import('./ChatDialog'));
|
|
20
|
-
export const SequenceContainer = lazy(() => import('./SequenceContainer'));
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2023 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import React from 'react';
|
|
6
|
+
|
|
7
|
+
import { DEFAULT_EDGE_MODELS, DEFAULT_OLLAMA_MODELS } from '@dxos/ai';
|
|
8
|
+
import { Input, Select, useTranslation } from '@dxos/react-ui';
|
|
9
|
+
import { Settings } from '@dxos/react-ui-form';
|
|
10
|
+
|
|
11
|
+
import { meta } from '../../meta';
|
|
12
|
+
import { type Assistant, LLM_PROVIDERS } from '../../types';
|
|
13
|
+
|
|
14
|
+
// TODO(burdon): Factor out default Selector.
|
|
15
|
+
const DEFAULT_VALUE = '__default';
|
|
16
|
+
|
|
17
|
+
const LLM_PROVIDER_LABELS = {
|
|
18
|
+
edge: 'DXOS',
|
|
19
|
+
ollama: 'Ollama',
|
|
20
|
+
lmstudio: 'LM Studio',
|
|
21
|
+
} as const;
|
|
22
|
+
|
|
23
|
+
export type AssistantSettingsComponentProps = {
|
|
24
|
+
settings: Assistant.Settings;
|
|
25
|
+
onSettingsChange: (fn: (current: Assistant.Settings) => Assistant.Settings) => void;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export const AssistantSettings = ({ settings, onSettingsChange }: AssistantSettingsComponentProps) => {
|
|
29
|
+
const { t } = useTranslation(meta.id);
|
|
30
|
+
|
|
31
|
+
return (
|
|
32
|
+
<Settings.Root>
|
|
33
|
+
<Settings.Section title={t('settings title', { ns: meta.id })}>
|
|
34
|
+
<Settings.Group>
|
|
35
|
+
<Settings.ItemInput title={t('settings custom prompts label')}>
|
|
36
|
+
<Input.Switch
|
|
37
|
+
checked={!!settings.customPrompts}
|
|
38
|
+
onCheckedChange={(checked) => onSettingsChange((s) => ({ ...s, customPrompts: checked }))}
|
|
39
|
+
/>
|
|
40
|
+
</Settings.ItemInput>
|
|
41
|
+
|
|
42
|
+
<Settings.ItemInput title={t('settings llm provider label')}>
|
|
43
|
+
<Select.Root
|
|
44
|
+
value={settings.llmProvider ?? 'edge'}
|
|
45
|
+
onValueChange={(value) => {
|
|
46
|
+
onSettingsChange((s) => ({
|
|
47
|
+
...s,
|
|
48
|
+
llmProvider: value === DEFAULT_VALUE ? undefined : (value as any),
|
|
49
|
+
}));
|
|
50
|
+
}}
|
|
51
|
+
>
|
|
52
|
+
<Select.TriggerButton placeholder={t('settings llm provider label')} />
|
|
53
|
+
<Select.Portal>
|
|
54
|
+
<Select.Content>
|
|
55
|
+
<Select.Viewport>
|
|
56
|
+
<Select.Option value={DEFAULT_VALUE}>{t('settings default label')}</Select.Option>
|
|
57
|
+
{LLM_PROVIDERS.map((model) => (
|
|
58
|
+
<Select.Option key={model} value={model}>
|
|
59
|
+
{LLM_PROVIDER_LABELS[model]}
|
|
60
|
+
</Select.Option>
|
|
61
|
+
))}
|
|
62
|
+
</Select.Viewport>
|
|
63
|
+
<Select.Arrow />
|
|
64
|
+
</Select.Content>
|
|
65
|
+
</Select.Portal>
|
|
66
|
+
</Select.Root>
|
|
67
|
+
</Settings.ItemInput>
|
|
68
|
+
|
|
69
|
+
<Settings.ItemInput title={t('settings edge llm model label')}>
|
|
70
|
+
<Select.Root
|
|
71
|
+
value={settings.edgeModel ?? DEFAULT_VALUE}
|
|
72
|
+
onValueChange={(value) => {
|
|
73
|
+
onSettingsChange((s) => ({ ...s, edgeModel: value === DEFAULT_VALUE ? undefined : value }));
|
|
74
|
+
}}
|
|
75
|
+
>
|
|
76
|
+
<Select.TriggerButton placeholder={t('settings default llm model label')} />
|
|
77
|
+
<Select.Portal>
|
|
78
|
+
<Select.Content>
|
|
79
|
+
<Select.Viewport>
|
|
80
|
+
<Select.Option value={DEFAULT_VALUE}>{t('settings default label')}</Select.Option>
|
|
81
|
+
{DEFAULT_EDGE_MODELS.map((model) => (
|
|
82
|
+
<Select.Option key={model} value={model}>
|
|
83
|
+
{model}
|
|
84
|
+
</Select.Option>
|
|
85
|
+
))}
|
|
86
|
+
</Select.Viewport>
|
|
87
|
+
<Select.Arrow />
|
|
88
|
+
</Select.Content>
|
|
89
|
+
</Select.Portal>
|
|
90
|
+
</Select.Root>
|
|
91
|
+
</Settings.ItemInput>
|
|
92
|
+
|
|
93
|
+
<Settings.ItemInput title={t('settings ollama llm model label')}>
|
|
94
|
+
<Select.Root
|
|
95
|
+
value={settings.ollamaModel ?? DEFAULT_VALUE}
|
|
96
|
+
onValueChange={(value) => {
|
|
97
|
+
onSettingsChange((s) => ({ ...s, ollamaModel: value === DEFAULT_VALUE ? undefined : value }));
|
|
98
|
+
}}
|
|
99
|
+
>
|
|
100
|
+
<Select.TriggerButton placeholder={t('settings default llm model label')} />
|
|
101
|
+
<Select.Portal>
|
|
102
|
+
<Select.Content>
|
|
103
|
+
<Select.Viewport>
|
|
104
|
+
<Select.Option value={DEFAULT_VALUE}>{t('settings default label')}</Select.Option>
|
|
105
|
+
{DEFAULT_OLLAMA_MODELS.map((model) => (
|
|
106
|
+
<Select.Option key={model} value={model}>
|
|
107
|
+
{model}
|
|
108
|
+
</Select.Option>
|
|
109
|
+
))}
|
|
110
|
+
</Select.Viewport>
|
|
111
|
+
<Select.Arrow />
|
|
112
|
+
</Select.Content>
|
|
113
|
+
</Select.Portal>
|
|
114
|
+
</Select.Root>
|
|
115
|
+
</Settings.ItemInput>
|
|
116
|
+
</Settings.Group>
|
|
117
|
+
</Settings.Section>
|
|
118
|
+
</Settings.Root>
|
|
119
|
+
);
|
|
120
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import React from 'react';
|
|
6
|
+
|
|
7
|
+
import { type SurfaceComponentProps } from '@dxos/app-toolkit/ui';
|
|
8
|
+
import { type Blueprint } from '@dxos/blueprints';
|
|
9
|
+
import { Panel, Toolbar } from '@dxos/react-ui';
|
|
10
|
+
import { useAttention } from '@dxos/react-ui-attention';
|
|
11
|
+
|
|
12
|
+
import { TemplateEditor } from '../../components';
|
|
13
|
+
|
|
14
|
+
export type BlueprintArticleProps = SurfaceComponentProps<Blueprint.Blueprint>;
|
|
15
|
+
|
|
16
|
+
export const BlueprintArticle = ({ role, attendableId, subject }: BlueprintArticleProps) => {
|
|
17
|
+
const { hasAttention } = useAttention(attendableId);
|
|
18
|
+
|
|
19
|
+
return (
|
|
20
|
+
<Panel.Root role={role} classNames='dx-article'>
|
|
21
|
+
<Panel.Toolbar asChild>
|
|
22
|
+
<Toolbar.Root disabled={!hasAttention} />
|
|
23
|
+
</Panel.Toolbar>
|
|
24
|
+
<Panel.Content asChild>
|
|
25
|
+
<TemplateEditor id={subject.id} template={subject.instructions} />
|
|
26
|
+
</Panel.Content>
|
|
27
|
+
</Panel.Root>
|
|
28
|
+
);
|
|
29
|
+
};
|
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Array from 'effect/Array';
|
|
6
|
+
import * as Function from 'effect/Function';
|
|
7
|
+
import * as Option from 'effect/Option';
|
|
8
|
+
import React, { forwardRef, useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
9
|
+
|
|
10
|
+
import { useAtomCapability, useCapabilities, useOperationInvoker } from '@dxos/app-framework/ui';
|
|
11
|
+
import { AppCapabilities } from '@dxos/app-toolkit';
|
|
12
|
+
import { Chat } from '@dxos/assistant-toolkit';
|
|
13
|
+
import { Blueprint } from '@dxos/blueprints';
|
|
14
|
+
import { getSpace } from '@dxos/client/echo';
|
|
15
|
+
import { DXN, Filter, Obj, Query, Ref } from '@dxos/echo';
|
|
16
|
+
import { SpaceOperation } from '@dxos/plugin-space/types';
|
|
17
|
+
import { useQuery } from '@dxos/react-client/echo';
|
|
18
|
+
import { useAsyncEffect } from '@dxos/react-ui';
|
|
19
|
+
|
|
20
|
+
import { type ChatEvent } from '../../components';
|
|
21
|
+
import { useBlueprintRegistry, useContextBinder } from '../../hooks';
|
|
22
|
+
import { Assistant, AssistantCapabilities, AssistantOperation } from '../../types';
|
|
23
|
+
import ChatContainer from '../ChatContainer';
|
|
24
|
+
|
|
25
|
+
export type ChatCompanionProps = {
|
|
26
|
+
role?: string;
|
|
27
|
+
data: {
|
|
28
|
+
subject: Chat.Chat | 'assistant-chat';
|
|
29
|
+
companionTo: Obj.Unknown;
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export const ChatCompanion = forwardRef<HTMLDivElement, ChatCompanionProps>(
|
|
34
|
+
({ role, data }: ChatCompanionProps, forwardedRef) => {
|
|
35
|
+
const { invokePromise } = useOperationInvoker();
|
|
36
|
+
const blueprintRegistry = useBlueprintRegistry();
|
|
37
|
+
const companionTo = data.companionTo;
|
|
38
|
+
|
|
39
|
+
const space = getSpace(companionTo);
|
|
40
|
+
const [chat, setChat] = useState(data.subject === 'assistant-chat' ? undefined : data.subject);
|
|
41
|
+
|
|
42
|
+
// Watch the state atom directly to detect when plus button clears the chat selection.
|
|
43
|
+
const state = useAtomCapability(AssistantCapabilities.State);
|
|
44
|
+
const companionToId = Obj.getDXN(companionTo).toString();
|
|
45
|
+
const currentChatState = state?.currentChat[companionToId];
|
|
46
|
+
|
|
47
|
+
// Track if initial setup has been done (to distinguish initial mount from plus button click).
|
|
48
|
+
// Reset when companionTo changes.
|
|
49
|
+
const initialSetupDoneRef = useRef(false);
|
|
50
|
+
const prevCompanionToIdRef = useRef(companionToId);
|
|
51
|
+
if (prevCompanionToIdRef.current !== companionToId) {
|
|
52
|
+
initialSetupDoneRef.current = false;
|
|
53
|
+
prevCompanionToIdRef.current = companionToId;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// Sync local chat state with the state atom.
|
|
57
|
+
// When currentChatState is undefined (plus button clicked), reset local chat.
|
|
58
|
+
// When data.subject is a Chat object, use it directly.
|
|
59
|
+
// When currentChatState is a different chat, fetch and set it.
|
|
60
|
+
useEffect(() => {
|
|
61
|
+
// If state says no chat selected AND current chat is persisted, reset local state (handles plus button click).
|
|
62
|
+
// Don't reset in-memory chats - they're expected to have currentChatState === undefined.
|
|
63
|
+
if (!currentChatState && chat && getSpace(chat)) {
|
|
64
|
+
setChat(undefined);
|
|
65
|
+
} else if (data.subject !== 'assistant-chat') {
|
|
66
|
+
// If data.subject is a Chat object (resolved from graph), use it.
|
|
67
|
+
setChat(data.subject);
|
|
68
|
+
} else if (currentChatState && space) {
|
|
69
|
+
// currentChatState is set but graph couldn't resolve it - fetch manually.
|
|
70
|
+
const currentChatDxnStr = chat ? Obj.getDXN(chat).toString() : undefined;
|
|
71
|
+
if (currentChatState !== currentChatDxnStr) {
|
|
72
|
+
// Parse DXN and fetch the chat object from the database.
|
|
73
|
+
const parsedDxn = DXN.tryParse(currentChatState);
|
|
74
|
+
if (parsedDxn) {
|
|
75
|
+
const chatRef = space.db.makeRef(parsedDxn);
|
|
76
|
+
const resolvedChat = chatRef?.target;
|
|
77
|
+
if (Obj.instanceOf(Assistant.Chat, resolvedChat)) {
|
|
78
|
+
setChat(resolvedChat);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}, [currentChatState, data.subject, space, chat]);
|
|
84
|
+
|
|
85
|
+
const chatQueue = space && chat ? space.queues.get(chat.queue.dxn) : undefined;
|
|
86
|
+
const binder = useContextBinder(chatQueue);
|
|
87
|
+
|
|
88
|
+
// Initialize companion chat if it doesn't exist, but don't add it to the space immediately.
|
|
89
|
+
useAsyncEffect(async () => {
|
|
90
|
+
if (!space || chat) {
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
// Only query for existing chats on initial mount, not when plus button is clicked.
|
|
95
|
+
if (!initialSetupDoneRef.current) {
|
|
96
|
+
// Query for existing companion chats linked to this object.
|
|
97
|
+
const existingChats = await space.db
|
|
98
|
+
.query(Query.select(Filter.id(companionTo.id)).targetOf(Chat.CompanionTo).source())
|
|
99
|
+
.run();
|
|
100
|
+
|
|
101
|
+
initialSetupDoneRef.current = true;
|
|
102
|
+
|
|
103
|
+
// Use existing chat if found on initial mount.
|
|
104
|
+
if (existingChats.length > 0) {
|
|
105
|
+
const existingChat = existingChats.at(-1) as Assistant.Chat;
|
|
106
|
+
setChat(existingChat);
|
|
107
|
+
await invokePromise(AssistantOperation.SetCurrentChat, { companionTo, chat: existingChat });
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
// Create chat in-memory only - it will be added to space on first message.
|
|
113
|
+
const { data: createResult } = await invokePromise(AssistantOperation.CreateChat, {
|
|
114
|
+
db: space.db,
|
|
115
|
+
addToSpace: false,
|
|
116
|
+
});
|
|
117
|
+
setChat(createResult?.object);
|
|
118
|
+
}, [chat, space, companionTo, invokePromise]);
|
|
119
|
+
|
|
120
|
+
// Add chat to space and create relation when user submits the first message.
|
|
121
|
+
const handleEvent = useCallback(
|
|
122
|
+
async (event: ChatEvent) => {
|
|
123
|
+
if (!chat || !space) {
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
// If chat is not in space yet, persist it on first submit.
|
|
128
|
+
if (event.type === 'submit' && !getSpace(chat)) {
|
|
129
|
+
await invokePromise(SpaceOperation.AddObject, {
|
|
130
|
+
object: chat,
|
|
131
|
+
target: space.db,
|
|
132
|
+
hidden: true,
|
|
133
|
+
});
|
|
134
|
+
await invokePromise(SpaceOperation.AddRelation, {
|
|
135
|
+
db: space.db,
|
|
136
|
+
schema: Chat.CompanionTo,
|
|
137
|
+
source: chat,
|
|
138
|
+
target: companionTo,
|
|
139
|
+
});
|
|
140
|
+
await invokePromise(AssistantOperation.SetCurrentChat, {
|
|
141
|
+
companionTo,
|
|
142
|
+
chat,
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
},
|
|
146
|
+
[chat, space, companionTo, invokePromise],
|
|
147
|
+
);
|
|
148
|
+
|
|
149
|
+
const metadata = useCapabilities(AppCapabilities.Metadata);
|
|
150
|
+
const blueprintKeys = useMemo(
|
|
151
|
+
() =>
|
|
152
|
+
Function.pipe(
|
|
153
|
+
metadata,
|
|
154
|
+
Array.findFirst(
|
|
155
|
+
(
|
|
156
|
+
capability,
|
|
157
|
+
): capability is {
|
|
158
|
+
id: string;
|
|
159
|
+
metadata: { blueprints?: string[] };
|
|
160
|
+
} => capability.id === Obj.getTypename(companionTo),
|
|
161
|
+
),
|
|
162
|
+
Option.flatMap((c) => Option.fromNullable(c.metadata.blueprints)),
|
|
163
|
+
Option.getOrElse(() => [] as string[]),
|
|
164
|
+
),
|
|
165
|
+
[metadata, companionTo],
|
|
166
|
+
);
|
|
167
|
+
const existingBlueprints = useQuery(space?.db, Filter.type(Blueprint.Blueprint));
|
|
168
|
+
const pluginBlueprints = useMemo(
|
|
169
|
+
() => existingBlueprints.filter((blueprint) => blueprintKeys.includes(blueprint.key)),
|
|
170
|
+
[existingBlueprints, blueprintKeys],
|
|
171
|
+
);
|
|
172
|
+
|
|
173
|
+
// Initialize related blueprints that are not already in the space.
|
|
174
|
+
useAsyncEffect(async () => {
|
|
175
|
+
if (!space) {
|
|
176
|
+
return;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
// NOTE: This must be run instead of using the useQuery result to avoid duplicates.
|
|
180
|
+
const existingBlueprints = await space.db.query(Filter.type(Blueprint.Blueprint)).run();
|
|
181
|
+
for (const key of blueprintKeys) {
|
|
182
|
+
const existingBlueprint = existingBlueprints.find((blueprint) => blueprint.key === key);
|
|
183
|
+
if (existingBlueprint) {
|
|
184
|
+
continue;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
const blueprint = blueprintRegistry.getByKey(key);
|
|
188
|
+
if (!blueprint) {
|
|
189
|
+
continue;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
space.db.add(Obj.clone(blueprint, { deep: true }));
|
|
193
|
+
}
|
|
194
|
+
}, [space, blueprintRegistry, blueprintKeys]);
|
|
195
|
+
|
|
196
|
+
useAsyncEffect(async () => {
|
|
197
|
+
if (!binder?.isOpen) {
|
|
198
|
+
return;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
if (pluginBlueprints.length > 0) {
|
|
202
|
+
await binder.bind({
|
|
203
|
+
blueprints: pluginBlueprints.map((blueprint) => Ref.make(blueprint)),
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
if (Obj.instanceOf(Blueprint.Blueprint, companionTo)) {
|
|
208
|
+
await binder.bind({ blueprints: [Ref.make(companionTo)] });
|
|
209
|
+
} else {
|
|
210
|
+
await binder.bind({ objects: [Ref.make(companionTo)] });
|
|
211
|
+
}
|
|
212
|
+
}, [binder, companionTo, blueprintKeys]);
|
|
213
|
+
|
|
214
|
+
return (
|
|
215
|
+
<ChatContainer
|
|
216
|
+
role={role}
|
|
217
|
+
space={space}
|
|
218
|
+
subject={chat}
|
|
219
|
+
companionTo={companionTo}
|
|
220
|
+
onEvent={handleEvent}
|
|
221
|
+
ref={forwardedRef}
|
|
222
|
+
/>
|
|
223
|
+
);
|
|
224
|
+
},
|
|
225
|
+
);
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import React, { forwardRef } from 'react';
|
|
6
|
+
|
|
7
|
+
import { useAtomCapability } from '@dxos/app-framework/ui';
|
|
8
|
+
import { type SurfaceComponentProps } from '@dxos/app-toolkit/ui';
|
|
9
|
+
import { type Space, getSpace } from '@dxos/client/echo';
|
|
10
|
+
import { type Obj } from '@dxos/echo';
|
|
11
|
+
import { Panel } from '@dxos/react-ui';
|
|
12
|
+
|
|
13
|
+
import { Chat as ChatComponent, type ChatRootProps } from '../../components';
|
|
14
|
+
import { useBlueprintRegistry, useChatProcessor, useChatServices, useOnline, usePresets } from '../../hooks';
|
|
15
|
+
import { AssistantCapabilities, type ChatType } from '../../types';
|
|
16
|
+
|
|
17
|
+
export type ChatContainerProps = SurfaceComponentProps<
|
|
18
|
+
ChatType.Chat | undefined,
|
|
19
|
+
{
|
|
20
|
+
space?: Space;
|
|
21
|
+
companionTo?: Obj.Unknown;
|
|
22
|
+
} & Pick<ChatRootProps, 'onEvent'>
|
|
23
|
+
>;
|
|
24
|
+
|
|
25
|
+
export const ChatContainer = forwardRef<HTMLDivElement, ChatContainerProps>((props, forwardedRef) => {
|
|
26
|
+
const { role, subject: chat, space: spaceProp, companionTo, onEvent } = props;
|
|
27
|
+
const space = spaceProp ?? getSpace(chat);
|
|
28
|
+
const settings = useAtomCapability(AssistantCapabilities.Settings);
|
|
29
|
+
const services = useChatServices({ id: space?.id, chat });
|
|
30
|
+
const [online, setOnline] = useOnline();
|
|
31
|
+
const { preset, ...chatProps } = usePresets(online);
|
|
32
|
+
const blueprintRegistry = useBlueprintRegistry();
|
|
33
|
+
const processor = useChatProcessor({
|
|
34
|
+
space,
|
|
35
|
+
chat,
|
|
36
|
+
preset,
|
|
37
|
+
services,
|
|
38
|
+
blueprintRegistry,
|
|
39
|
+
settings,
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
if (!processor) {
|
|
43
|
+
return null;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
return (
|
|
47
|
+
<ChatComponent.Root db={space?.db} chat={chat} processor={processor} onEvent={onEvent}>
|
|
48
|
+
<Panel.Root role={role} classNames='dx-article' ref={forwardedRef}>
|
|
49
|
+
<Panel.Toolbar>
|
|
50
|
+
<ChatComponent.Toolbar companionTo={companionTo} />
|
|
51
|
+
</Panel.Toolbar>
|
|
52
|
+
<Panel.Content>
|
|
53
|
+
<ChatComponent.Viewport>
|
|
54
|
+
<ChatComponent.Thread />
|
|
55
|
+
<div role='none' className='p-4'>
|
|
56
|
+
<ChatComponent.Prompt
|
|
57
|
+
{...chatProps}
|
|
58
|
+
outline
|
|
59
|
+
preset={preset?.id}
|
|
60
|
+
online={online}
|
|
61
|
+
onOnlineChange={setOnline}
|
|
62
|
+
/>
|
|
63
|
+
</div>
|
|
64
|
+
</ChatComponent.Viewport>
|
|
65
|
+
</Panel.Content>
|
|
66
|
+
</Panel.Root>
|
|
67
|
+
</ChatComponent.Root>
|
|
68
|
+
);
|
|
69
|
+
});
|