@dxos/plugin-assistant 0.8.4-main.406dc2a → 0.8.4-main.52d7546f51
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-JOTRKE7B.mjs +200 -0
- package/dist/lib/browser/ChatCompanion-JOTRKE7B.mjs.map +7 -0
- package/dist/lib/browser/ChatContainer-ESDLG5JY.mjs +73 -0
- package/dist/lib/browser/ChatContainer-ESDLG5JY.mjs.map +7 -0
- package/dist/lib/browser/ChatDialog-LKY3FTYO.mjs +85 -0
- package/dist/lib/browser/ChatDialog-LKY3FTYO.mjs.map +7 -0
- package/dist/lib/browser/InitiativeContainer-T2SQ4O6J.mjs +267 -0
- package/dist/lib/browser/InitiativeContainer-T2SQ4O6J.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/blueprints/index.mjs +12 -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-POPBT2AQ.mjs +198 -0
- package/dist/lib/browser/chunk-POPBT2AQ.mjs.map +7 -0
- package/dist/lib/browser/chunk-Q4QUMX62.mjs +1974 -0
- package/dist/lib/browser/chunk-Q4QUMX62.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 +251 -215
- 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-I7YJVK4K.mjs +125 -0
- package/dist/lib/browser/react-surface-I7YJVK4K.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 +8 -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-52OWAARX.mjs +201 -0
- package/dist/lib/node-esm/ChatCompanion-52OWAARX.mjs.map +7 -0
- package/dist/lib/node-esm/ChatContainer-VLWSQ3ZO.mjs +74 -0
- package/dist/lib/node-esm/ChatContainer-VLWSQ3ZO.mjs.map +7 -0
- package/dist/lib/node-esm/ChatDialog-5DUQIF2T.mjs +86 -0
- package/dist/lib/node-esm/ChatDialog-5DUQIF2T.mjs.map +7 -0
- package/dist/lib/node-esm/InitiativeContainer-ATD3D23L.mjs +268 -0
- package/dist/lib/node-esm/InitiativeContainer-ATD3D23L.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-WD2IVMAI.mjs → blueprint-definition-H3LFAEK2.mjs} +6 -4
- 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-75PHXBN3.mjs +327 -0
- package/dist/lib/node-esm/chunk-75PHXBN3.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-ESDMBGF7.mjs +1975 -0
- package/dist/lib/node-esm/chunk-ESDMBGF7.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-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-73ABYRYX.mjs → chunk-POWB2BPC.mjs} +7 -2
- 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 +251 -215
- 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-2CWJ6GZW.mjs +126 -0
- package/dist/lib/node-esm/react-surface-2CWJ6GZW.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 +8 -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 +10 -11
- 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 +25 -13
- package/dist/types/src/components/Chat/Chat.d.ts.map +1 -1
- package/dist/types/src/components/Chat/events.d.ts +5 -1
- package/dist/types/src/components/Chat/events.d.ts.map +1 -1
- package/dist/types/src/components/ChatCompanion.d.ts +4 -4
- package/dist/types/src/components/ChatCompanion.d.ts.map +1 -1
- package/dist/types/src/components/ChatContainer.d.ts +14 -6
- 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 +2 -2
- package/dist/types/src/components/ChatProgress/ChatProgress.d.ts.map +1 -1
- package/dist/types/src/components/ChatPrompt/ChatActions.d.ts.map +1 -1
- package/dist/types/src/components/ChatPrompt/ChatOptions.d.ts +3 -3
- package/dist/types/src/components/ChatPrompt/ChatOptions.d.ts.map +1 -1
- package/dist/types/src/components/ChatPrompt/ChatReferences.d.ts +3 -3
- package/dist/types/src/components/ChatPrompt/ChatReferences.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/ChatThread.d.ts +7 -10
- package/dist/types/src/components/ChatThread/ChatThread.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/ChatThread.stories.d.ts +246 -73
- package/dist/types/src/components/ChatThread/ChatThread.stories.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/registry.d.ts +1 -1
- package/dist/types/src/components/ChatThread/registry.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/sync.d.ts +12 -6
- package/dist/types/src/components/ChatThread/sync.d.ts.map +1 -1
- package/dist/types/src/components/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 +2 -1
- package/dist/types/src/components/TemplateEditor/TemplateEditor.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/TemplateEditor.stories.d.ts +230 -61
- package/dist/types/src/components/TemplateEditor/TemplateEditor.stories.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/TemplateForm.d.ts +11 -1
- package/dist/types/src/components/TemplateEditor/TemplateForm.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/TemplateForm.stories.d.ts +231 -62
- package/dist/types/src/components/TemplateEditor/TemplateForm.stories.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/extensions/handlebars-extension.d.ts.map +1 -0
- package/dist/types/src/components/TemplateEditor/extensions/index.d.ts +3 -0
- package/dist/types/src/components/TemplateEditor/extensions/index.d.ts.map +1 -0
- package/dist/types/src/components/TemplateEditor/extensions/xml-extension.d.ts +8 -0
- package/dist/types/src/components/TemplateEditor/extensions/xml-extension.d.ts.map +1 -0
- package/dist/types/src/components/ToolBlock/ToolBlock.d.ts +10 -8
- package/dist/types/src/components/ToolBlock/ToolBlock.d.ts.map +1 -1
- package/dist/types/src/components/Toolbox/Toolbox.d.ts +6 -7
- package/dist/types/src/components/Toolbox/Toolbox.d.ts.map +1 -1
- package/dist/types/src/components/Toolbox/Toolbox.stories.d.ts +230 -60
- 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 -10
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/functions/index.d.ts +3 -3
- package/dist/types/src/functions/index.d.ts.map +1 -1
- package/dist/types/src/functions/{list.d.ts → object-list.d.ts} +3 -3
- package/dist/types/src/functions/object-list.d.ts.map +1 -0
- package/dist/types/src/functions/{load.d.ts → object-load.d.ts} +3 -3
- 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 +2 -1
- package/dist/types/src/hooks/index.d.ts.map +1 -1
- package/dist/types/src/hooks/useBlueprintRegistry.d.ts +5 -5
- package/dist/types/src/hooks/useBlueprintRegistry.d.ts.map +1 -1
- package/dist/types/src/hooks/useChatProcessor.d.ts +5 -2
- package/dist/types/src/hooks/useChatProcessor.d.ts.map +1 -1
- package/dist/types/src/hooks/useChatServices.d.ts +5 -5
- package/dist/types/src/hooks/useChatServices.d.ts.map +1 -1
- package/dist/types/src/hooks/useChatToolbarActions.d.ts +8 -0
- package/dist/types/src/hooks/useChatToolbarActions.d.ts.map +1 -0
- package/dist/types/src/hooks/useContextBinder.d.ts +2 -2
- package/dist/types/src/hooks/useContextBinder.d.ts.map +1 -1
- package/dist/types/src/hooks/useContextObjects.d.ts +7 -7
- package/dist/types/src/hooks/useContextObjects.d.ts.map +1 -1
- 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/useReferencesProvider.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +0 -1
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +2 -2
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/processor/index.d.ts +1 -0
- package/dist/types/src/processor/index.d.ts.map +1 -1
- package/dist/types/src/processor/processor.d.ts +23 -18
- package/dist/types/src/processor/processor.d.ts.map +1 -1
- package/dist/types/src/processor/update-name.d.ts +10 -0
- package/dist/types/src/processor/update-name.d.ts.map +1 -0
- package/dist/types/src/queue-logger.d.ts.map +1 -1
- package/dist/types/src/testing/test-generator.d.ts +5 -4
- package/dist/types/src/testing/test-generator.d.ts.map +1 -1
- package/dist/types/src/testing/test-services.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +358 -26
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/Assistant.d.ts +7 -38
- package/dist/types/src/types/Assistant.d.ts.map +1 -1
- package/dist/types/src/types/AssistantAction.d.ts +90 -100
- package/dist/types/src/types/AssistantAction.d.ts.map +1 -1
- 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/events.d.ts +5 -0
- package/dist/types/src/types/events.d.ts.map +1 -0
- package/dist/types/src/types/index.d.ts +4 -1
- package/dist/types/src/types/index.d.ts.map +1 -1
- package/dist/types/src/types/service.d.ts +10 -212
- package/dist/types/src/types/service.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +119 -90
- package/src/AssistantPlugin.tsx +114 -112
- 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 +10 -14
- 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 +28 -20
- package/src/components/BlueprintArticle.tsx +28 -0
- package/src/components/Chat/Chat.tsx +189 -127
- package/src/components/Chat/events.ts +7 -1
- package/src/components/ChatCompanion.tsx +191 -101
- package/src/components/ChatContainer.tsx +48 -31
- package/src/components/ChatDialog.tsx +15 -8
- package/src/components/ChatProgress/ChatProgress.tsx +6 -20
- package/src/components/ChatPrompt/ChatActions.tsx +11 -5
- package/src/components/ChatPrompt/ChatOptions.tsx +93 -80
- package/src/components/ChatPrompt/ChatReferences.tsx +7 -8
- package/src/components/ChatPrompt/ChatStatusIndicator.tsx +1 -1
- package/src/components/ChatThread/ChatThread.stories.tsx +58 -37
- package/src/components/ChatThread/ChatThread.tsx +35 -36
- package/src/components/ChatThread/Link.tsx +4 -4
- package/src/components/ChatThread/registry.tsx +25 -35
- package/src/components/ChatThread/sync.test.ts +33 -17
- package/src/components/ChatThread/sync.ts +53 -12
- 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 +16 -6
- package/src/components/TemplateEditor/TemplateEditor.tsx +24 -12
- package/src/components/TemplateEditor/TemplateForm.stories.tsx +17 -9
- package/src/components/TemplateEditor/TemplateForm.tsx +76 -29
- 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 +36 -45
- package/src/components/Toolbox/Toolbox.stories.tsx +10 -11
- package/src/components/Toolbox/Toolbox.tsx +54 -56
- package/src/components/TriggerStatus/TriggerStatus.tsx +142 -0
- package/src/components/{Toolbar → TriggerStatus}/index.ts +1 -1
- 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 +13 -7
- package/src/functions/index.ts +3 -3
- package/src/functions/{list.ts → object-list.ts} +8 -7
- package/src/functions/object-load.ts +44 -0
- package/src/functions/object-search.ts +46 -0
- package/src/hooks/index.ts +2 -1
- package/src/hooks/useBlueprintRegistry.ts +31 -20
- package/src/hooks/useChatProcessor.ts +17 -13
- package/src/hooks/useChatServices.ts +16 -18
- package/src/hooks/useChatToolbarActions.ts +122 -0
- package/src/hooks/useContextBinder.ts +9 -7
- package/src/hooks/useContextObjects.ts +13 -25
- package/src/hooks/useFilteredTypes.ts +37 -0
- package/src/hooks/useReferencesProvider.ts +7 -6
- package/src/index.ts +0 -1
- package/src/meta.ts +8 -3
- package/src/processor/index.ts +1 -0
- package/src/processor/presets.ts +1 -1
- package/src/processor/processor.test.ts +16 -25
- package/src/processor/processor.ts +72 -73
- package/src/processor/update-name.ts +58 -0
- package/src/queue-logger.ts +8 -9
- package/src/testing/test-generator.ts +14 -13
- package/src/testing/test-services.ts +8 -6
- package/src/translations.ts +51 -18
- package/src/types/Assistant.ts +4 -40
- package/src/types/AssistantAction.ts +67 -53
- package/src/types/capabilities.ts +27 -0
- package/src/types/events.ts +11 -0
- package/src/types/index.ts +6 -1
- package/src/types/service.ts +12 -9
- package/dist/lib/browser/BlueprintContainer-WX2SSDVI.mjs +0 -28
- package/dist/lib/browser/BlueprintContainer-WX2SSDVI.mjs.map +0 -7
- package/dist/lib/browser/ChatCompanion-BDZ55ZRF.mjs +0 -150
- package/dist/lib/browser/ChatCompanion-BDZ55ZRF.mjs.map +0 -7
- package/dist/lib/browser/ChatContainer-RYGNN73X.mjs +0 -73
- package/dist/lib/browser/ChatContainer-RYGNN73X.mjs.map +0 -7
- package/dist/lib/browser/ChatDialog-MVHH2U66.mjs +0 -86
- package/dist/lib/browser/ChatDialog-MVHH2U66.mjs.map +0 -7
- package/dist/lib/browser/SequenceContainer-2FEWMQGW.mjs +0 -150
- package/dist/lib/browser/SequenceContainer-2FEWMQGW.mjs.map +0 -7
- package/dist/lib/browser/ai-service-ERTZBTP3.mjs +0 -19
- package/dist/lib/browser/ai-service-ERTZBTP3.mjs.map +0 -7
- package/dist/lib/browser/app-graph-builder-2U7SLCRX.mjs +0 -154
- package/dist/lib/browser/app-graph-builder-2U7SLCRX.mjs.map +0 -7
- package/dist/lib/browser/blueprint-definition-NSJARW5U.mjs +0 -12
- package/dist/lib/browser/chunk-2CE2KPKZ.mjs +0 -175
- package/dist/lib/browser/chunk-2CE2KPKZ.mjs.map +0 -7
- package/dist/lib/browser/chunk-43I2LR6O.mjs +0 -216
- package/dist/lib/browser/chunk-43I2LR6O.mjs.map +0 -7
- package/dist/lib/browser/chunk-5EGXHCAZ.mjs +0 -16
- package/dist/lib/browser/chunk-5EGXHCAZ.mjs.map +0 -7
- package/dist/lib/browser/chunk-5RICKAMN.mjs +0 -18
- package/dist/lib/browser/chunk-5RICKAMN.mjs.map +0 -7
- package/dist/lib/browser/chunk-CQ7UHYTT.mjs +0 -296
- package/dist/lib/browser/chunk-CQ7UHYTT.mjs.map +0 -7
- package/dist/lib/browser/chunk-FP56WB24.mjs +0 -212
- package/dist/lib/browser/chunk-FP56WB24.mjs.map +0 -7
- package/dist/lib/browser/chunk-JZRZVB2A.mjs +0 -170
- package/dist/lib/browser/chunk-JZRZVB2A.mjs.map +0 -7
- package/dist/lib/browser/chunk-WRJGOT5P.mjs +0 -1794
- package/dist/lib/browser/chunk-WRJGOT5P.mjs.map +0 -7
- package/dist/lib/browser/edge-model-resolver-O6OFYIO2.mjs +0 -18
- package/dist/lib/browser/edge-model-resolver-O6OFYIO2.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-3GOJMBXJ.mjs +0 -114
- package/dist/lib/browser/intent-resolver-3GOJMBXJ.mjs.map +0 -7
- package/dist/lib/browser/local-model-resolver-GO6ZEMLL.mjs +0 -17
- package/dist/lib/browser/local-model-resolver-GO6ZEMLL.mjs.map +0 -7
- package/dist/lib/browser/react-surface-FTKCE6GG.mjs +0 -107
- package/dist/lib/browser/react-surface-FTKCE6GG.mjs.map +0 -7
- package/dist/lib/browser/settings-HBF32KV6.mjs +0 -23
- package/dist/lib/browser/settings-HBF32KV6.mjs.map +0 -7
- package/dist/lib/browser/state-LXTS54DI.mjs +0 -21
- package/dist/lib/browser/state-LXTS54DI.mjs.map +0 -7
- package/dist/lib/browser/toolkit-NQ2GXCF5.mjs +0 -199
- package/dist/lib/browser/toolkit-NQ2GXCF5.mjs.map +0 -7
- package/dist/lib/node-esm/BlueprintContainer-4MKN6ZRB.mjs +0 -29
- package/dist/lib/node-esm/BlueprintContainer-4MKN6ZRB.mjs.map +0 -7
- package/dist/lib/node-esm/ChatCompanion-XFNXVZIP.mjs +0 -151
- package/dist/lib/node-esm/ChatCompanion-XFNXVZIP.mjs.map +0 -7
- package/dist/lib/node-esm/ChatContainer-UTJGCQXF.mjs +0 -74
- package/dist/lib/node-esm/ChatContainer-UTJGCQXF.mjs.map +0 -7
- package/dist/lib/node-esm/ChatDialog-QEYZ4IOV.mjs +0 -87
- package/dist/lib/node-esm/ChatDialog-QEYZ4IOV.mjs.map +0 -7
- package/dist/lib/node-esm/SequenceContainer-PGGJUQ46.mjs +0 -151
- package/dist/lib/node-esm/SequenceContainer-PGGJUQ46.mjs.map +0 -7
- package/dist/lib/node-esm/ai-service-MUYLV3NT.mjs +0 -20
- package/dist/lib/node-esm/ai-service-MUYLV3NT.mjs.map +0 -7
- package/dist/lib/node-esm/app-graph-builder-OKNLR7H2.mjs +0 -155
- package/dist/lib/node-esm/app-graph-builder-OKNLR7H2.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-73ABYRYX.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-DSE2IILK.mjs +0 -217
- package/dist/lib/node-esm/chunk-DSE2IILK.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-E2WXZND7.mjs +0 -297
- package/dist/lib/node-esm/chunk-E2WXZND7.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-HXIBCBH4.mjs +0 -171
- package/dist/lib/node-esm/chunk-HXIBCBH4.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-TNR46C3L.mjs +0 -213
- package/dist/lib/node-esm/chunk-TNR46C3L.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-U2NYUS2N.mjs +0 -177
- package/dist/lib/node-esm/chunk-U2NYUS2N.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-UFKLCEAE.mjs +0 -1795
- package/dist/lib/node-esm/chunk-UFKLCEAE.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-XQGWSZ4T.mjs +0 -17
- package/dist/lib/node-esm/chunk-XQGWSZ4T.mjs.map +0 -7
- package/dist/lib/node-esm/edge-model-resolver-2ARXDOYS.mjs +0 -19
- package/dist/lib/node-esm/edge-model-resolver-2ARXDOYS.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-6XLVTRDJ.mjs +0 -115
- package/dist/lib/node-esm/intent-resolver-6XLVTRDJ.mjs.map +0 -7
- package/dist/lib/node-esm/local-model-resolver-WOQ2D2R2.mjs +0 -18
- package/dist/lib/node-esm/local-model-resolver-WOQ2D2R2.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-K7ZXQLAP.mjs +0 -108
- package/dist/lib/node-esm/react-surface-K7ZXQLAP.mjs.map +0 -7
- package/dist/lib/node-esm/settings-CWP6MTWP.mjs +0 -24
- package/dist/lib/node-esm/settings-CWP6MTWP.mjs.map +0 -7
- package/dist/lib/node-esm/state-BO6GUFLB.mjs +0 -22
- package/dist/lib/node-esm/state-BO6GUFLB.mjs.map +0 -7
- package/dist/lib/node-esm/toolkit-V57PRJNG.mjs +0 -200
- package/dist/lib/node-esm/toolkit-V57PRJNG.mjs.map +0 -7
- package/dist/types/src/capabilities/ai-service.d.ts +0 -4
- package/dist/types/src/capabilities/ai-service.d.ts.map +0 -1
- 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/blueprint-definition.d.ts +0 -7
- package/dist/types/src/capabilities/blueprint-definition.d.ts.map +0 -1
- package/dist/types/src/capabilities/capabilities.d.ts +0 -11
- package/dist/types/src/capabilities/capabilities.d.ts.map +0 -1
- package/dist/types/src/capabilities/edge-model-resolver.d.ts +0 -4
- package/dist/types/src/capabilities/edge-model-resolver.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/local-model-resolver.d.ts +0 -10
- package/dist/types/src/capabilities/local-model-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/capabilities/state.d.ts +0 -4
- package/dist/types/src/capabilities/state.d.ts.map +0 -1
- package/dist/types/src/capabilities/toolkit.d.ts +0 -4
- package/dist/types/src/capabilities/toolkit.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/ChatThread/reducers.d.ts +0 -40
- package/dist/types/src/components/ChatThread/reducers.d.ts.map +0 -1
- package/dist/types/src/components/PromptSettings.d.ts +0 -6
- package/dist/types/src/components/PromptSettings.d.ts.map +0 -1
- package/dist/types/src/components/SequenceContainer.d.ts +0 -8
- package/dist/types/src/components/SequenceContainer.d.ts.map +0 -1
- package/dist/types/src/components/SequenceEditor/SequenceEditor.d.ts +0 -13
- package/dist/types/src/components/SequenceEditor/SequenceEditor.d.ts.map +0 -1
- package/dist/types/src/components/SequenceEditor/SequenceEditor.stories.d.ts +0 -269
- package/dist/types/src/components/SequenceEditor/SequenceEditor.stories.d.ts.map +0 -1
- package/dist/types/src/components/SequenceEditor/index.d.ts +0 -2
- package/dist/types/src/components/SequenceEditor/index.d.ts.map +0 -1
- package/dist/types/src/components/TemplateEditor/handlebars-extension.d.ts.map +0 -1
- package/dist/types/src/components/Toolbar/Toolbar.d.ts +0 -5
- package/dist/types/src/components/Toolbar/Toolbar.d.ts.map +0 -1
- package/dist/types/src/components/Toolbar/index.d.ts +0 -2
- package/dist/types/src/components/Toolbar/index.d.ts.map +0 -1
- package/dist/types/src/components/Toolbar/useChatToolbarActions.d.ts +0 -11
- package/dist/types/src/components/Toolbar/useChatToolbarActions.d.ts.map +0 -1
- package/dist/types/src/events.d.ts +0 -4
- package/dist/types/src/events.d.ts.map +0 -1
- package/dist/types/src/functions/analysis.d.ts +0 -5
- package/dist/types/src/functions/analysis.d.ts.map +0 -1
- package/dist/types/src/functions/list.d.ts.map +0 -1
- package/dist/types/src/functions/load.d.ts.map +0 -1
- package/dist/types/src/hooks/useItemTypes.d.ts +0 -4
- package/dist/types/src/hooks/useItemTypes.d.ts.map +0 -1
- package/src/capabilities/ai-service.ts +0 -27
- package/src/capabilities/app-graph-builder.ts +0 -163
- package/src/capabilities/blueprint-definition.ts +0 -64
- package/src/capabilities/capabilities.ts +0 -18
- package/src/capabilities/edge-model-resolver.ts +0 -25
- package/src/capabilities/intent-resolver.ts +0 -96
- package/src/capabilities/local-model-resolver.ts +0 -30
- package/src/capabilities/react-surface.tsx +0 -91
- package/src/capabilities/settings.ts +0 -19
- package/src/capabilities/state.ts +0 -20
- package/src/capabilities/toolkit.ts +0 -168
- package/src/components/BlueprintContainer.tsx +0 -24
- package/src/components/ChatThread/reducers.ts +0 -151
- package/src/components/PromptSettings.tsx +0 -90
- package/src/components/SequenceContainer.tsx +0 -131
- package/src/components/SequenceEditor/SequenceEditor.stories.tsx +0 -35
- package/src/components/SequenceEditor/SequenceEditor.tsx +0 -50
- package/src/components/SequenceEditor/index.ts +0 -5
- package/src/components/TemplateEditor/handlebars-extension.ts +0 -165
- package/src/components/Toolbar/Toolbar.tsx +0 -21
- package/src/components/Toolbar/useChatToolbarActions.ts +0 -126
- package/src/events.ts +0 -11
- package/src/functions/analysis.ts +0 -22
- package/src/functions/load.ts +0 -46
- package/src/hooks/useItemTypes.ts +0 -37
- /package/dist/lib/browser/{blueprint-definition-NSJARW5U.mjs.map → blueprint-definition-YAGWYVCL.mjs.map} +0 -0
- /package/dist/lib/{node-esm/blueprint-definition-WD2IVMAI.mjs.map → browser/blueprints/index.mjs.map} +0 -0
- /package/dist/types/src/components/TemplateEditor/{handlebars-extension.d.ts → extensions/handlebars-extension.d.ts} +0 -0
|
@@ -3,134 +3,224 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import * as Array from 'effect/Array';
|
|
6
|
-
import * as Effect from 'effect/Effect';
|
|
7
6
|
import * as Function from 'effect/Function';
|
|
8
7
|
import * as Option from 'effect/Option';
|
|
9
|
-
import React, { useMemo } from 'react';
|
|
8
|
+
import React, { forwardRef, useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
10
9
|
|
|
11
|
-
import {
|
|
10
|
+
import { useAtomCapability, useCapabilities, useOperationInvoker } from '@dxos/app-framework/ui';
|
|
11
|
+
import { AppCapabilities } from '@dxos/app-toolkit';
|
|
12
|
+
import { Chat } from '@dxos/assistant-toolkit';
|
|
12
13
|
import { Blueprint } from '@dxos/blueprints';
|
|
13
14
|
import { getSpace } from '@dxos/client/echo';
|
|
14
|
-
import { Filter, Obj, Query, Ref } from '@dxos/echo';
|
|
15
|
-
import {
|
|
16
|
-
import { SpaceAction } from '@dxos/plugin-space/types';
|
|
15
|
+
import { DXN, Filter, Obj, Query, Ref } from '@dxos/echo';
|
|
16
|
+
import { SpaceOperation } from '@dxos/plugin-space/types';
|
|
17
17
|
import { useQuery } from '@dxos/react-client/echo';
|
|
18
18
|
import { useAsyncEffect } from '@dxos/react-ui';
|
|
19
19
|
|
|
20
|
-
import { ChatContainer } from '../components';
|
|
20
|
+
import { ChatContainer, type ChatEvent } from '../components';
|
|
21
21
|
import { useBlueprintRegistry, useContextBinder } from '../hooks';
|
|
22
|
-
import { Assistant,
|
|
22
|
+
import { Assistant, AssistantCapabilities, AssistantOperation } from '../types';
|
|
23
23
|
|
|
24
24
|
export type ChatCompanionProps = {
|
|
25
25
|
role?: string;
|
|
26
|
-
data: {
|
|
26
|
+
data: {
|
|
27
|
+
subject: Chat.Chat | 'assistant-chat';
|
|
28
|
+
companionTo: Obj.Unknown;
|
|
29
|
+
};
|
|
27
30
|
};
|
|
28
31
|
|
|
29
|
-
export const ChatCompanion =
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
32
|
+
export const ChatCompanion = forwardRef<HTMLDivElement, ChatCompanionProps>(
|
|
33
|
+
({ role, data }: ChatCompanionProps, forwardedRef) => {
|
|
34
|
+
const { invokePromise } = useOperationInvoker();
|
|
35
|
+
const blueprintRegistry = useBlueprintRegistry();
|
|
36
|
+
const companionTo = data.companionTo;
|
|
37
|
+
|
|
38
|
+
const space = getSpace(companionTo);
|
|
39
|
+
const [chat, setChat] = useState(data.subject === 'assistant-chat' ? undefined : data.subject);
|
|
40
|
+
|
|
41
|
+
// Watch the state atom directly to detect when plus button clears the chat selection.
|
|
42
|
+
const state = useAtomCapability(AssistantCapabilities.State);
|
|
43
|
+
const companionToId = Obj.getDXN(companionTo).toString();
|
|
44
|
+
const currentChatState = state?.currentChat[companionToId];
|
|
45
|
+
|
|
46
|
+
// Track if initial setup has been done (to distinguish initial mount from plus button click).
|
|
47
|
+
// Reset when companionTo changes.
|
|
48
|
+
const initialSetupDoneRef = useRef(false);
|
|
49
|
+
const prevCompanionToIdRef = useRef(companionToId);
|
|
50
|
+
if (prevCompanionToIdRef.current !== companionToId) {
|
|
51
|
+
initialSetupDoneRef.current = false;
|
|
52
|
+
prevCompanionToIdRef.current = companionToId;
|
|
41
53
|
}
|
|
42
54
|
|
|
43
|
-
//
|
|
44
|
-
//
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
)
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
if (
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
55
|
+
// Sync local chat state with the state atom.
|
|
56
|
+
// When currentChatState is undefined (plus button clicked), reset local chat.
|
|
57
|
+
// When data.subject is a Chat object, use it directly.
|
|
58
|
+
// When currentChatState is a different chat, fetch and set it.
|
|
59
|
+
useEffect(() => {
|
|
60
|
+
// If state says no chat selected AND current chat is persisted, reset local state (handles plus button click).
|
|
61
|
+
// Don't reset in-memory chats - they're expected to have currentChatState === undefined.
|
|
62
|
+
if (!currentChatState && chat && getSpace(chat)) {
|
|
63
|
+
setChat(undefined);
|
|
64
|
+
} else if (data.subject !== 'assistant-chat') {
|
|
65
|
+
// If data.subject is a Chat object (resolved from graph), use it.
|
|
66
|
+
setChat(data.subject);
|
|
67
|
+
} else if (currentChatState && space) {
|
|
68
|
+
// currentChatState is set but graph couldn't resolve it - fetch manually.
|
|
69
|
+
const currentChatDxnStr = chat ? Obj.getDXN(chat).toString() : undefined;
|
|
70
|
+
if (currentChatState !== currentChatDxnStr) {
|
|
71
|
+
// Parse DXN and fetch the chat object from the database.
|
|
72
|
+
const parsedDxn = DXN.tryParse(currentChatState);
|
|
73
|
+
if (parsedDxn) {
|
|
74
|
+
const chatRef = space.db.makeRef(parsedDxn);
|
|
75
|
+
const resolvedChat = chatRef?.target;
|
|
76
|
+
if (Obj.instanceOf(Assistant.Chat, resolvedChat)) {
|
|
77
|
+
setChat(resolvedChat);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
64
81
|
}
|
|
82
|
+
}, [currentChatState, data.subject, space, chat]);
|
|
65
83
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
}, [space, chat, companionTo]);
|
|
69
|
-
|
|
70
|
-
const metadata = useCapabilities(Capabilities.Metadata);
|
|
71
|
-
const blueprintKeys = useMemo(
|
|
72
|
-
() =>
|
|
73
|
-
Function.pipe(
|
|
74
|
-
metadata,
|
|
75
|
-
Array.findFirst(
|
|
76
|
-
(capability): capability is { id: string; metadata: { blueprints?: string[] } } =>
|
|
77
|
-
capability.id === Obj.getTypename(companionTo),
|
|
78
|
-
),
|
|
79
|
-
Option.flatMap((c) => Option.fromNullable(c.metadata.blueprints)),
|
|
80
|
-
Option.getOrElse(() => [] as string[]),
|
|
81
|
-
),
|
|
82
|
-
[metadata, companionTo],
|
|
83
|
-
);
|
|
84
|
-
const existingBlueprints = useQuery(space, Filter.type(Blueprint.Blueprint));
|
|
85
|
-
const pluginBlueprints = useMemo(
|
|
86
|
-
() => existingBlueprints.filter((blueprint) => blueprintKeys.includes(blueprint.key)),
|
|
87
|
-
[existingBlueprints, blueprintKeys],
|
|
88
|
-
);
|
|
89
|
-
|
|
90
|
-
// Initialize related blueprints that are not already in the space.
|
|
91
|
-
useAsyncEffect(async () => {
|
|
92
|
-
if (!space) {
|
|
93
|
-
return;
|
|
94
|
-
}
|
|
84
|
+
const chatQueue = space && chat ? space.queues.get(chat.queue.dxn) : undefined;
|
|
85
|
+
const binder = useContextBinder(chatQueue);
|
|
95
86
|
|
|
96
|
-
//
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
if (existingBlueprint) {
|
|
101
|
-
continue;
|
|
87
|
+
// Initialize companion chat if it doesn't exist, but don't add it to the space immediately.
|
|
88
|
+
useAsyncEffect(async () => {
|
|
89
|
+
if (!space || chat) {
|
|
90
|
+
return;
|
|
102
91
|
}
|
|
103
92
|
|
|
104
|
-
|
|
105
|
-
if (!
|
|
106
|
-
|
|
93
|
+
// Only query for existing chats on initial mount, not when plus button is clicked.
|
|
94
|
+
if (!initialSetupDoneRef.current) {
|
|
95
|
+
// Query for existing companion chats linked to this object.
|
|
96
|
+
const existingChats = await space.db
|
|
97
|
+
.query(Query.select(Filter.id(companionTo.id)).targetOf(Chat.CompanionTo).source())
|
|
98
|
+
.run();
|
|
99
|
+
|
|
100
|
+
initialSetupDoneRef.current = true;
|
|
101
|
+
|
|
102
|
+
// Use existing chat if found on initial mount.
|
|
103
|
+
if (existingChats.length > 0) {
|
|
104
|
+
const existingChat = existingChats.at(-1) as Assistant.Chat;
|
|
105
|
+
setChat(existingChat);
|
|
106
|
+
await invokePromise(AssistantOperation.SetCurrentChat, { companionTo, chat: existingChat });
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
107
109
|
}
|
|
108
110
|
|
|
109
|
-
space.
|
|
110
|
-
|
|
111
|
-
|
|
111
|
+
// Create chat in-memory only - it will be added to space on first message.
|
|
112
|
+
const { data: createResult } = await invokePromise(AssistantOperation.CreateChat, {
|
|
113
|
+
db: space.db,
|
|
114
|
+
addToSpace: false,
|
|
115
|
+
});
|
|
116
|
+
setChat(createResult?.object);
|
|
117
|
+
}, [chat, space, companionTo, invokePromise]);
|
|
118
|
+
|
|
119
|
+
// Add chat to space and create relation when user submits the first message.
|
|
120
|
+
const handleEvent = useCallback(
|
|
121
|
+
async (event: ChatEvent) => {
|
|
122
|
+
if (!chat || !space) {
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
// If chat is not in space yet, persist it on first submit.
|
|
127
|
+
if (event.type === 'submit' && !getSpace(chat)) {
|
|
128
|
+
await invokePromise(SpaceOperation.AddObject, {
|
|
129
|
+
object: chat,
|
|
130
|
+
target: space.db,
|
|
131
|
+
hidden: true,
|
|
132
|
+
});
|
|
133
|
+
await invokePromise(SpaceOperation.AddRelation, {
|
|
134
|
+
db: space.db,
|
|
135
|
+
schema: Chat.CompanionTo,
|
|
136
|
+
source: chat,
|
|
137
|
+
target: companionTo,
|
|
138
|
+
});
|
|
139
|
+
await invokePromise(AssistantOperation.SetCurrentChat, {
|
|
140
|
+
companionTo,
|
|
141
|
+
chat,
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
},
|
|
145
|
+
[chat, space, companionTo, invokePromise],
|
|
146
|
+
);
|
|
147
|
+
|
|
148
|
+
const metadata = useCapabilities(AppCapabilities.Metadata);
|
|
149
|
+
const blueprintKeys = useMemo(
|
|
150
|
+
() =>
|
|
151
|
+
Function.pipe(
|
|
152
|
+
metadata,
|
|
153
|
+
Array.findFirst(
|
|
154
|
+
(
|
|
155
|
+
capability,
|
|
156
|
+
): capability is {
|
|
157
|
+
id: string;
|
|
158
|
+
metadata: { blueprints?: string[] };
|
|
159
|
+
} => capability.id === Obj.getTypename(companionTo),
|
|
160
|
+
),
|
|
161
|
+
Option.flatMap((c) => Option.fromNullable(c.metadata.blueprints)),
|
|
162
|
+
Option.getOrElse(() => [] as string[]),
|
|
163
|
+
),
|
|
164
|
+
[metadata, companionTo],
|
|
165
|
+
);
|
|
166
|
+
const existingBlueprints = useQuery(space?.db, Filter.type(Blueprint.Blueprint));
|
|
167
|
+
const pluginBlueprints = useMemo(
|
|
168
|
+
() => existingBlueprints.filter((blueprint) => blueprintKeys.includes(blueprint.key)),
|
|
169
|
+
[existingBlueprints, blueprintKeys],
|
|
170
|
+
);
|
|
171
|
+
|
|
172
|
+
// Initialize related blueprints that are not already in the space.
|
|
173
|
+
useAsyncEffect(async () => {
|
|
174
|
+
if (!space) {
|
|
175
|
+
return;
|
|
176
|
+
}
|
|
112
177
|
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
178
|
+
// NOTE: This must be run instead of using the useQuery result to avoid duplicates.
|
|
179
|
+
const existingBlueprints = await space.db.query(Filter.type(Blueprint.Blueprint)).run();
|
|
180
|
+
for (const key of blueprintKeys) {
|
|
181
|
+
const existingBlueprint = existingBlueprints.find((blueprint) => blueprint.key === key);
|
|
182
|
+
if (existingBlueprint) {
|
|
183
|
+
continue;
|
|
184
|
+
}
|
|
117
185
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
186
|
+
const blueprint = blueprintRegistry.getByKey(key);
|
|
187
|
+
if (!blueprint) {
|
|
188
|
+
continue;
|
|
189
|
+
}
|
|
121
190
|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
}
|
|
125
|
-
await binder.bind({ objects: [Ref.make(companionTo)] });
|
|
126
|
-
}
|
|
127
|
-
}, [binder, companionTo, pluginBlueprints]);
|
|
191
|
+
space.db.add(Obj.clone(blueprint, { deep: true }));
|
|
192
|
+
}
|
|
193
|
+
}, [space, blueprintRegistry, blueprintKeys]);
|
|
128
194
|
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
195
|
+
useAsyncEffect(async () => {
|
|
196
|
+
if (!binder?.isOpen) {
|
|
197
|
+
return;
|
|
198
|
+
}
|
|
132
199
|
|
|
133
|
-
|
|
134
|
-
|
|
200
|
+
if (pluginBlueprints.length > 0) {
|
|
201
|
+
await binder.bind({
|
|
202
|
+
blueprints: pluginBlueprints.map((blueprint) => Ref.make(blueprint)),
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
if (Obj.instanceOf(Blueprint.Blueprint, companionTo)) {
|
|
207
|
+
await binder.bind({ blueprints: [Ref.make(companionTo)] });
|
|
208
|
+
} else {
|
|
209
|
+
await binder.bind({ objects: [Ref.make(companionTo)] });
|
|
210
|
+
}
|
|
211
|
+
}, [binder, companionTo, blueprintKeys]);
|
|
212
|
+
|
|
213
|
+
return (
|
|
214
|
+
<ChatContainer
|
|
215
|
+
role={role}
|
|
216
|
+
space={space}
|
|
217
|
+
subject={chat}
|
|
218
|
+
companionTo={companionTo}
|
|
219
|
+
onEvent={handleEvent}
|
|
220
|
+
ref={forwardedRef}
|
|
221
|
+
/>
|
|
222
|
+
);
|
|
223
|
+
},
|
|
224
|
+
);
|
|
135
225
|
|
|
136
226
|
export default ChatCompanion;
|
|
@@ -2,50 +2,67 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import React from 'react';
|
|
5
|
+
import React, { forwardRef } from 'react';
|
|
6
6
|
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
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';
|
|
9
10
|
import { type Obj } from '@dxos/echo';
|
|
10
|
-
import {
|
|
11
|
+
import { Layout } from '@dxos/react-ui';
|
|
11
12
|
|
|
12
13
|
import { useBlueprintRegistry, useChatProcessor, useChatServices, useOnline, usePresets } from '../hooks';
|
|
13
|
-
import {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
export const ChatContainer = (
|
|
26
|
-
const space =
|
|
27
|
-
const
|
|
28
|
-
const
|
|
14
|
+
import { AssistantCapabilities, type ChatType } from '../types';
|
|
15
|
+
|
|
16
|
+
import { Chat as ChatComponent, type ChatRootProps } from './Chat';
|
|
17
|
+
|
|
18
|
+
export type ChatContainerProps = SurfaceComponentProps<
|
|
19
|
+
ChatType.Chat | undefined,
|
|
20
|
+
{
|
|
21
|
+
space?: Space;
|
|
22
|
+
companionTo?: Obj.Unknown;
|
|
23
|
+
} & Pick<ChatRootProps, 'onEvent'>
|
|
24
|
+
>;
|
|
25
|
+
|
|
26
|
+
export const ChatContainer = forwardRef<HTMLDivElement, ChatContainerProps>((props, forwardedRef) => {
|
|
27
|
+
const { role, subject: chat, space: spaceProp, companionTo, onEvent } = props;
|
|
28
|
+
const space = spaceProp ?? getSpace(chat);
|
|
29
|
+
const settings = useAtomCapability(AssistantCapabilities.Settings);
|
|
30
|
+
const services = useChatServices({ id: space?.id, chat });
|
|
29
31
|
const [online, setOnline] = useOnline();
|
|
30
32
|
const { preset, ...chatProps } = usePresets(online);
|
|
31
33
|
const blueprintRegistry = useBlueprintRegistry();
|
|
32
|
-
const processor = useChatProcessor({
|
|
34
|
+
const processor = useChatProcessor({
|
|
35
|
+
space,
|
|
36
|
+
chat,
|
|
37
|
+
preset,
|
|
38
|
+
services,
|
|
39
|
+
blueprintRegistry,
|
|
40
|
+
settings,
|
|
41
|
+
});
|
|
33
42
|
|
|
34
43
|
if (!processor) {
|
|
35
44
|
return null;
|
|
36
45
|
}
|
|
37
46
|
|
|
38
47
|
return (
|
|
39
|
-
<
|
|
40
|
-
{
|
|
41
|
-
|
|
42
|
-
<
|
|
43
|
-
|
|
44
|
-
<
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
+
<Layout.Main toolbar role={role} ref={forwardedRef}>
|
|
49
|
+
<ChatComponent.Root db={space?.db} chat={chat} processor={processor} onEvent={onEvent}>
|
|
50
|
+
<ChatComponent.Toolbar companionTo={companionTo} />
|
|
51
|
+
<ChatComponent.Viewport classNames='container-max-width'>
|
|
52
|
+
<ChatComponent.Thread />
|
|
53
|
+
<div role='none' className='p-4'>
|
|
54
|
+
<ChatComponent.Prompt
|
|
55
|
+
{...chatProps}
|
|
56
|
+
outline
|
|
57
|
+
preset={preset?.id}
|
|
58
|
+
online={online}
|
|
59
|
+
onOnlineChange={setOnline}
|
|
60
|
+
/>
|
|
61
|
+
</div>
|
|
62
|
+
</ChatComponent.Viewport>
|
|
63
|
+
</ChatComponent.Root>
|
|
64
|
+
</Layout.Main>
|
|
48
65
|
);
|
|
49
|
-
};
|
|
66
|
+
});
|
|
50
67
|
|
|
51
68
|
export default ChatContainer;
|
|
@@ -4,31 +4,38 @@
|
|
|
4
4
|
|
|
5
5
|
import React, { useCallback, useState } from 'react';
|
|
6
6
|
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
7
|
+
import { useAtomCapability } from '@dxos/app-framework/ui';
|
|
8
|
+
import { type Chat as ChatTypes } from '@dxos/assistant-toolkit';
|
|
9
|
+
import { Obj } from '@dxos/echo';
|
|
9
10
|
import { useTranslation } from '@dxos/react-ui';
|
|
10
11
|
import { ChatDialog as NaturalChatDialog } from '@dxos/react-ui-chat';
|
|
11
12
|
|
|
12
13
|
import { useBlueprintRegistry, useChatProcessor, useChatServices, useOnline, usePresets } from '../hooks';
|
|
13
14
|
import { meta } from '../meta';
|
|
14
|
-
import {
|
|
15
|
+
import { AssistantCapabilities } from '../types';
|
|
15
16
|
|
|
16
17
|
import { Chat, type ChatRootProps } from './Chat';
|
|
17
18
|
|
|
18
19
|
export type ChatDialogProps = {
|
|
19
|
-
chat?:
|
|
20
|
+
chat?: ChatTypes.Chat;
|
|
20
21
|
};
|
|
21
22
|
|
|
22
23
|
export const ChatDialog = ({ chat }: ChatDialogProps) => {
|
|
23
24
|
const { t } = useTranslation(meta.id);
|
|
24
25
|
|
|
25
|
-
const
|
|
26
|
-
const settings =
|
|
27
|
-
const services = useChatServices({
|
|
26
|
+
const db = chat && Obj.getDatabase(chat);
|
|
27
|
+
const settings = useAtomCapability(AssistantCapabilities.Settings);
|
|
28
|
+
const services = useChatServices({ id: db?.spaceId, chat });
|
|
28
29
|
const [online, setOnline] = useOnline();
|
|
29
30
|
const { preset, ...chatProps } = usePresets(online);
|
|
30
31
|
const blueprintRegistry = useBlueprintRegistry();
|
|
31
|
-
const processor = useChatProcessor({
|
|
32
|
+
const processor = useChatProcessor({
|
|
33
|
+
chat,
|
|
34
|
+
preset,
|
|
35
|
+
services,
|
|
36
|
+
blueprintRegistry,
|
|
37
|
+
settings,
|
|
38
|
+
});
|
|
32
39
|
|
|
33
40
|
// TODO(burdon): Refocus when open.
|
|
34
41
|
const [open, setOpen] = useState(true);
|
|
@@ -4,26 +4,12 @@
|
|
|
4
4
|
|
|
5
5
|
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
6
6
|
|
|
7
|
+
import { type Chat } from '@dxos/assistant-toolkit';
|
|
7
8
|
import { addEventListener } from '@dxos/async';
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
import { type Assistant } from '../../types';
|
|
11
|
-
|
|
12
|
-
// TODO(burdon): Reset after each session.
|
|
13
|
-
// TODO(burdon): Show after delay.
|
|
14
|
-
// TODO(burdon): Test with errors.
|
|
15
|
-
// TODO(burdon): Filter out empty trace messages.
|
|
16
|
-
|
|
17
|
-
// {
|
|
18
|
-
// "id": "01K3TE3C2VAXETP500QKDHK3C4_block_3",
|
|
19
|
-
// "branch": "main",
|
|
20
|
-
// "parents": [],
|
|
21
|
-
// "icon": "ph--robot--regular",
|
|
22
|
-
// "message": "\n"
|
|
23
|
-
// }
|
|
9
|
+
import { ProgressBar, type ProgressBarProps, TextCrawl, useExecutionGraph } from '@dxos/react-ui-components';
|
|
24
10
|
|
|
25
11
|
export type ChatProgressProps = {
|
|
26
|
-
chat:
|
|
12
|
+
chat: Chat.Chat;
|
|
27
13
|
};
|
|
28
14
|
|
|
29
15
|
export const ChatProgress = ({ chat }: ChatProgressProps) => {
|
|
@@ -59,9 +45,9 @@ export const ChatProgress = ({ chat }: ChatProgressProps) => {
|
|
|
59
45
|
}, [nodes.length]);
|
|
60
46
|
|
|
61
47
|
return (
|
|
62
|
-
<
|
|
48
|
+
<div role='none' tabIndex={0} ref={ref} className='flex flex-col outline-none'>
|
|
63
49
|
<ProgressBar nodes={nodes} index={index} onSelect={handleSelect} />
|
|
64
|
-
<TextCrawl
|
|
65
|
-
</
|
|
50
|
+
<TextCrawl classNames='pis-4 text-sm text-description' lines={lines} autoAdvance />
|
|
51
|
+
</div>
|
|
66
52
|
);
|
|
67
53
|
};
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import React, { type PropsWithChildren } from 'react';
|
|
6
6
|
|
|
7
7
|
import { IconButton, type ThemedClassName, useTranslation } from '@dxos/react-ui';
|
|
8
|
-
import { mx } from '@dxos/
|
|
8
|
+
import { mx } from '@dxos/ui-theme';
|
|
9
9
|
|
|
10
10
|
import { meta } from '../../meta';
|
|
11
11
|
import { type ChatEvent } from '../Chat';
|
|
@@ -29,10 +29,9 @@ export const ChatActions = ({ classNames, children, microphone, recording, proce
|
|
|
29
29
|
<IconButton
|
|
30
30
|
disabled={!processing}
|
|
31
31
|
variant='ghost'
|
|
32
|
-
size={5}
|
|
33
32
|
icon='ph--x--regular'
|
|
34
33
|
iconOnly
|
|
35
|
-
label={t('
|
|
34
|
+
label={t('cancel processing button')}
|
|
36
35
|
onClick={() => onEvent?.({ type: 'cancel' })}
|
|
37
36
|
/>
|
|
38
37
|
|
|
@@ -41,17 +40,24 @@ export const ChatActions = ({ classNames, children, microphone, recording, proce
|
|
|
41
40
|
disabled={!processing}
|
|
42
41
|
classNames={mx(recording && 'bg-primary-500')}
|
|
43
42
|
variant='ghost'
|
|
44
|
-
size={5}
|
|
45
43
|
icon='ph--microphone--regular'
|
|
46
44
|
iconOnly
|
|
47
45
|
noTooltip
|
|
48
|
-
label={t('button
|
|
46
|
+
label={t('microphone button')}
|
|
49
47
|
onMouseDown={() => onEvent?.({ type: 'record-start' })}
|
|
50
48
|
onMouseUp={() => onEvent?.({ type: 'record-stop' })}
|
|
51
49
|
onTouchStart={() => onEvent?.({ type: 'record-start' })}
|
|
52
50
|
onTouchEnd={() => onEvent?.({ type: 'record-stop' })}
|
|
53
51
|
/>
|
|
54
52
|
)}
|
|
53
|
+
|
|
54
|
+
<IconButton
|
|
55
|
+
variant='ghost'
|
|
56
|
+
icon='ph--wrench--regular'
|
|
57
|
+
iconOnly
|
|
58
|
+
label={t('debug button')}
|
|
59
|
+
onClick={() => onEvent?.({ type: 'toggle-debug' })}
|
|
60
|
+
/>
|
|
55
61
|
</div>
|
|
56
62
|
);
|
|
57
63
|
};
|