@dxos/plugin-assistant 0.8.4-main.1da679c → 0.8.4-main.21d9917
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-WP3G5GLG.mjs +31 -0
- package/dist/lib/browser/BlueprintArticle-WP3G5GLG.mjs.map +7 -0
- package/dist/lib/browser/ChatCompanion-GFSJZTOT.mjs +153 -0
- package/dist/lib/browser/ChatCompanion-GFSJZTOT.mjs.map +7 -0
- package/dist/lib/browser/ChatContainer-IHAPBIZE.mjs +72 -0
- package/dist/lib/browser/ChatContainer-IHAPBIZE.mjs.map +7 -0
- package/dist/lib/browser/ChatDialog-EGRMPCTL.mjs +85 -0
- package/dist/lib/browser/ChatDialog-EGRMPCTL.mjs.map +7 -0
- package/dist/lib/browser/PromptArticle-K362ZPAE.mjs +53 -0
- package/dist/lib/browser/PromptArticle-K362ZPAE.mjs.map +7 -0
- package/dist/lib/browser/ai-service-5GUDOEWF.mjs +21 -0
- package/dist/lib/browser/ai-service-5GUDOEWF.mjs.map +7 -0
- package/dist/lib/browser/app-graph-builder-DSNH2OMY.mjs +212 -0
- package/dist/lib/browser/app-graph-builder-DSNH2OMY.mjs.map +7 -0
- package/dist/lib/browser/blueprint-definition-DGHH7MUU.mjs +14 -0
- package/dist/lib/browser/blueprints/index.mjs +12 -0
- package/dist/lib/browser/chunk-A75V4MOQ.mjs +1832 -0
- package/dist/lib/browser/chunk-A75V4MOQ.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-ML3QCFKA.mjs +265 -0
- package/dist/lib/browser/chunk-ML3QCFKA.mjs.map +7 -0
- package/dist/lib/browser/chunk-MRJVYGLU.mjs +208 -0
- package/dist/lib/browser/chunk-MRJVYGLU.mjs.map +7 -0
- package/dist/lib/browser/chunk-V772AMZM.mjs +250 -0
- package/dist/lib/browser/chunk-V772AMZM.mjs.map +7 -0
- package/dist/lib/browser/chunk-WGQTU6UJ.mjs +41 -0
- package/dist/lib/browser/chunk-WGQTU6UJ.mjs.map +7 -0
- package/dist/lib/browser/edge-model-resolver-26BOY6HY.mjs +20 -0
- package/dist/lib/browser/edge-model-resolver-26BOY6HY.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +229 -216
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/local-model-resolver-ZFIM6GGV.mjs +19 -0
- package/dist/lib/browser/local-model-resolver-ZFIM6GGV.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/operation-resolver-7XJLBRQY.mjs +132 -0
- package/dist/lib/browser/operation-resolver-7XJLBRQY.mjs.map +7 -0
- package/dist/lib/browser/react-surface-S7SBFOSW.mjs +109 -0
- package/dist/lib/browser/react-surface-S7SBFOSW.mjs.map +7 -0
- package/dist/lib/browser/repair-6QGAKOVM.mjs +54 -0
- package/dist/lib/browser/repair-6QGAKOVM.mjs.map +7 -0
- package/dist/lib/browser/settings-4ZDLUMYE.mjs +32 -0
- package/dist/lib/browser/settings-4ZDLUMYE.mjs.map +7 -0
- package/dist/lib/browser/state-AN6336ZX.mjs +26 -0
- package/dist/lib/browser/state-AN6336ZX.mjs.map +7 -0
- package/dist/lib/browser/toolkit-7AVTEPMA.mjs +18 -0
- package/dist/lib/browser/toolkit-7AVTEPMA.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +8 -4
- package/dist/lib/node-esm/BlueprintArticle-WZ76E2C4.mjs +32 -0
- package/dist/lib/node-esm/BlueprintArticle-WZ76E2C4.mjs.map +7 -0
- package/dist/lib/node-esm/ChatCompanion-UR7DXZ54.mjs +154 -0
- package/dist/lib/node-esm/ChatCompanion-UR7DXZ54.mjs.map +7 -0
- package/dist/lib/node-esm/ChatContainer-YMLLGOZK.mjs +73 -0
- package/dist/lib/node-esm/ChatContainer-YMLLGOZK.mjs.map +7 -0
- package/dist/lib/node-esm/ChatDialog-D24WJPK4.mjs +86 -0
- package/dist/lib/node-esm/ChatDialog-D24WJPK4.mjs.map +7 -0
- package/dist/lib/node-esm/PromptArticle-D4HAIIC6.mjs +54 -0
- package/dist/lib/node-esm/PromptArticle-D4HAIIC6.mjs.map +7 -0
- package/dist/lib/node-esm/ai-service-PXKKCFIF.mjs +22 -0
- package/dist/lib/node-esm/ai-service-PXKKCFIF.mjs.map +7 -0
- package/dist/lib/node-esm/app-graph-builder-TJCUEXW5.mjs +213 -0
- package/dist/lib/node-esm/app-graph-builder-TJCUEXW5.mjs.map +7 -0
- package/dist/lib/node-esm/{blueprint-definition-B6UDX5U3.mjs → blueprint-definition-SEMDEIYG.mjs} +6 -4
- package/dist/lib/node-esm/blueprint-definition-SEMDEIYG.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-355W5B27.mjs +251 -0
- package/dist/lib/node-esm/chunk-355W5B27.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-4BERCIES.mjs +1833 -0
- package/dist/lib/node-esm/chunk-4BERCIES.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-DCA5QWQT.mjs +209 -0
- package/dist/lib/node-esm/chunk-DCA5QWQT.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-MSBPC4RJ.mjs +42 -0
- package/dist/lib/node-esm/chunk-MSBPC4RJ.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-POWB2BPC.mjs +25 -0
- package/dist/lib/node-esm/chunk-POWB2BPC.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-ZRIPP7YF.mjs +267 -0
- package/dist/lib/node-esm/chunk-ZRIPP7YF.mjs.map +7 -0
- package/dist/lib/node-esm/edge-model-resolver-G5KMODPO.mjs +21 -0
- package/dist/lib/node-esm/edge-model-resolver-G5KMODPO.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +229 -216
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/local-model-resolver-KDZLYI7Y.mjs +20 -0
- package/dist/lib/node-esm/local-model-resolver-KDZLYI7Y.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/operation-resolver-SX4WMNA7.mjs +133 -0
- package/dist/lib/node-esm/operation-resolver-SX4WMNA7.mjs.map +7 -0
- package/dist/lib/node-esm/react-surface-ZR6FXGLF.mjs +110 -0
- package/dist/lib/node-esm/react-surface-ZR6FXGLF.mjs.map +7 -0
- package/dist/lib/node-esm/repair-QJ7CQDKU.mjs +55 -0
- package/dist/lib/node-esm/repair-QJ7CQDKU.mjs.map +7 -0
- package/dist/lib/node-esm/settings-CQEOHR3R.mjs +33 -0
- package/dist/lib/node-esm/settings-CQEOHR3R.mjs.map +7 -0
- package/dist/lib/node-esm/state-HDON4REW.mjs +27 -0
- package/dist/lib/node-esm/state-HDON4REW.mjs.map +7 -0
- package/dist/lib/node-esm/toolkit-OWGCEKOO.mjs +19 -0
- package/dist/lib/node-esm/toolkit-OWGCEKOO.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 +209 -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 +5 -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 +21 -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 +6 -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 +12 -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 +17 -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 +5 -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 +23 -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 +2 -2
- package/dist/types/src/components/ChatCompanion.d.ts.map +1 -1
- package/dist/types/src/components/ChatContainer.d.ts +13 -5
- package/dist/types/src/components/ChatContainer.d.ts.map +1 -1
- package/dist/types/src/components/ChatDialog.d.ts.map +1 -1
- package/dist/types/src/components/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 -8
- package/dist/types/src/components/ChatThread/ChatThread.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/ChatThread.stories.d.ts +133 -74
- package/dist/types/src/components/ChatThread/ChatThread.stories.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/reducers.d.ts +5 -5
- package/dist/types/src/components/ChatThread/reducers.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/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/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 +116 -61
- 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 +117 -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 +116 -61
- 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 +10 -9
- 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} +2 -2
- 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 -2
- package/dist/types/src/hooks/index.d.ts.map +1 -1
- package/dist/types/src/hooks/useBlueprintRegistry.d.ts +5 -4
- package/dist/types/src/hooks/useBlueprintRegistry.d.ts.map +1 -1
- package/dist/types/src/hooks/useChatProcessor.d.ts +4 -2
- package/dist/types/src/hooks/useChatProcessor.d.ts.map +1 -1
- package/dist/types/src/hooks/useChatServices.d.ts +4 -4
- 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 +2 -1
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +3 -4
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/processor/index.d.ts +1 -0
- package/dist/types/src/processor/index.d.ts.map +1 -1
- package/dist/types/src/processor/presets.d.ts +1 -1
- package/dist/types/src/processor/presets.d.ts.map +1 -1
- package/dist/types/src/processor/processor.d.ts +19 -17
- 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/index.d.ts +0 -2
- package/dist/types/src/testing/index.d.ts.map +1 -1
- package/dist/types/src/testing/test-generator.d.ts +6 -5
- package/dist/types/src/testing/test-generator.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 +244 -26
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/Assistant.d.ts +20 -20
- package/dist/types/src/types/Assistant.d.ts.map +1 -1
- package/dist/types/src/types/AssistantAction.d.ts +89 -101
- 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 +3 -1
- package/dist/types/src/types/index.d.ts.map +1 -1
- package/dist/types/src/types/service.d.ts +14 -216
- package/dist/types/src/types/service.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +118 -117
- package/src/AssistantPlugin.tsx +114 -146
- package/src/blueprints/assistant-blueprint.ts +62 -0
- package/src/blueprints/index.ts +12 -0
- package/src/capabilities/ai-service/ai-service.ts +29 -0
- package/src/capabilities/ai-service/index.ts +7 -0
- package/src/capabilities/app-graph-builder/app-graph-builder.ts +180 -0
- package/src/capabilities/app-graph-builder/index.ts +7 -0
- package/src/capabilities/blueprint-definition/blueprint-definition.ts +60 -0
- package/src/capabilities/blueprint-definition/index.ts +8 -0
- package/src/capabilities/edge-model-resolver/edge-model-resolver.ts +32 -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 +37 -0
- package/src/capabilities/operation-resolver/index.ts +7 -0
- package/src/capabilities/operation-resolver/operation-resolver.ts +110 -0
- package/src/capabilities/react-surface/index.ts +7 -0
- package/src/capabilities/react-surface/react-surface.tsx +95 -0
- package/src/capabilities/repair/index.ts +7 -0
- package/src/capabilities/repair/repair.ts +63 -0
- package/src/capabilities/settings/index.ts +7 -0
- package/src/capabilities/settings/settings.ts +30 -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 +26 -0
- package/src/components/AssistantSettings/AssistantSettings.tsx +13 -5
- package/src/components/BlueprintArticle.tsx +29 -0
- package/src/components/Chat/Chat.tsx +193 -151
- package/src/components/Chat/events.ts +7 -1
- package/src/components/ChatCompanion.tsx +143 -91
- package/src/components/ChatContainer.tsx +40 -30
- package/src/components/ChatDialog.tsx +13 -7
- package/src/components/ChatProgress/ChatProgress.tsx +4 -18
- package/src/components/ChatPrompt/ChatActions.tsx +3 -5
- package/src/components/ChatPrompt/ChatOptions.tsx +104 -99
- package/src/components/ChatPrompt/ChatReferences.tsx +7 -8
- package/src/components/ChatPrompt/ChatStatusIndicator.tsx +1 -1
- package/src/components/ChatThread/ChatThread.stories.tsx +62 -42
- package/src/components/ChatThread/ChatThread.tsx +29 -35
- package/src/components/ChatThread/Link.tsx +3 -3
- package/src/components/ChatThread/reducers.ts +6 -6
- package/src/components/ChatThread/registry.tsx +26 -41
- package/src/components/ChatThread/sync.test.ts +33 -18
- package/src/components/ChatThread/sync.ts +54 -13
- package/src/components/ChatThread/testing/thread.md +37 -0
- package/src/components/PromptArticle.tsx +50 -0
- package/src/components/TemplateEditor/TemplateEditor.stories.tsx +16 -8
- package/src/components/TemplateEditor/TemplateEditor.tsx +24 -12
- package/src/components/TemplateEditor/TemplateForm.stories.tsx +17 -11
- package/src/components/TemplateEditor/TemplateForm.tsx +77 -30
- 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 +40 -49
- package/src/components/Toolbox/Toolbox.stories.tsx +11 -15
- package/src/components/Toolbox/Toolbox.tsx +18 -19
- 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 +2 -5
- package/src/functions/index.ts +3 -3
- package/src/functions/{list.ts → object-list.ts} +10 -7
- package/src/functions/{load.ts → object-load.ts} +15 -10
- package/src/functions/object-search.ts +46 -0
- package/src/hooks/index.ts +2 -2
- package/src/hooks/useBlueprintRegistry.ts +44 -19
- package/src/hooks/useChatProcessor.ts +25 -14
- package/src/hooks/useChatServices.ts +16 -17
- package/src/hooks/useChatToolbarActions.ts +121 -0
- package/src/hooks/useContextBinder.ts +21 -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 +2 -1
- package/src/meta.ts +11 -8
- package/src/processor/index.ts +1 -0
- package/src/processor/presets.ts +2 -2
- package/src/processor/processor.test.ts +19 -24
- package/src/processor/processor.ts +51 -78
- package/src/processor/update-name.ts +59 -0
- package/src/queue-logger.ts +8 -9
- package/src/testing/index.ts +0 -2
- package/src/testing/test-generator.ts +19 -14
- package/src/testing/test-services.ts +10 -14
- package/src/translations.ts +28 -16
- package/src/types/Assistant.ts +13 -12
- package/src/types/AssistantAction.ts +65 -52
- package/src/types/capabilities.ts +27 -0
- package/src/types/events.ts +11 -0
- package/src/types/index.ts +3 -1
- package/src/types/service.ts +25 -14
- package/dist/lib/browser/BlueprintContainer-6MZHBQ25.mjs +0 -29
- package/dist/lib/browser/BlueprintContainer-6MZHBQ25.mjs.map +0 -7
- package/dist/lib/browser/ChatCompanion-B4DLQE6Y.mjs +0 -124
- package/dist/lib/browser/ChatCompanion-B4DLQE6Y.mjs.map +0 -7
- package/dist/lib/browser/ChatContainer-Z7A3RKOY.mjs +0 -73
- package/dist/lib/browser/ChatContainer-Z7A3RKOY.mjs.map +0 -7
- package/dist/lib/browser/ChatDialog-PL5TSGD5.mjs +0 -86
- package/dist/lib/browser/ChatDialog-PL5TSGD5.mjs.map +0 -7
- package/dist/lib/browser/SequenceContainer-TF5QNXYM.mjs +0 -150
- package/dist/lib/browser/SequenceContainer-TF5QNXYM.mjs.map +0 -7
- package/dist/lib/browser/ai-service-4VESSFNB.mjs +0 -18
- package/dist/lib/browser/ai-service-4VESSFNB.mjs.map +0 -7
- package/dist/lib/browser/app-graph-builder-BBDHBJXA.mjs +0 -153
- package/dist/lib/browser/app-graph-builder-BBDHBJXA.mjs.map +0 -7
- package/dist/lib/browser/blueprint-definition-3SATLYJW.mjs +0 -12
- package/dist/lib/browser/chunk-BBT6KNXA.mjs +0 -165
- package/dist/lib/browser/chunk-BBT6KNXA.mjs.map +0 -7
- package/dist/lib/browser/chunk-JDI4FEKA.mjs +0 -299
- package/dist/lib/browser/chunk-JDI4FEKA.mjs.map +0 -7
- package/dist/lib/browser/chunk-O4LUJEDV.mjs +0 -20
- package/dist/lib/browser/chunk-O4LUJEDV.mjs.map +0 -7
- package/dist/lib/browser/chunk-PQI3MGDN.mjs +0 -169
- package/dist/lib/browser/chunk-PQI3MGDN.mjs.map +0 -7
- package/dist/lib/browser/chunk-SMIVXXAI.mjs +0 -202
- package/dist/lib/browser/chunk-SMIVXXAI.mjs.map +0 -7
- package/dist/lib/browser/chunk-TMKK6VCA.mjs +0 -216
- package/dist/lib/browser/chunk-TMKK6VCA.mjs.map +0 -7
- package/dist/lib/browser/chunk-YKODYEYR.mjs +0 -16
- package/dist/lib/browser/chunk-YKODYEYR.mjs.map +0 -7
- package/dist/lib/browser/chunk-YOBHCEEI.mjs +0 -1941
- package/dist/lib/browser/chunk-YOBHCEEI.mjs.map +0 -7
- package/dist/lib/browser/edge-model-resolver-6YWYDPTS.mjs +0 -18
- package/dist/lib/browser/edge-model-resolver-6YWYDPTS.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-MRZJU255.mjs +0 -112
- package/dist/lib/browser/intent-resolver-MRZJU255.mjs.map +0 -7
- package/dist/lib/browser/local-model-resolver-QXLLTV2H.mjs +0 -17
- package/dist/lib/browser/local-model-resolver-QXLLTV2H.mjs.map +0 -7
- package/dist/lib/browser/react-surface-UKMOARXR.mjs +0 -107
- package/dist/lib/browser/react-surface-UKMOARXR.mjs.map +0 -7
- package/dist/lib/browser/settings-4AJ34FKF.mjs +0 -23
- package/dist/lib/browser/settings-4AJ34FKF.mjs.map +0 -7
- package/dist/lib/browser/state-ABR7YSSA.mjs +0 -21
- package/dist/lib/browser/state-ABR7YSSA.mjs.map +0 -7
- package/dist/lib/browser/toolkit-U7SKGAIC.mjs +0 -191
- package/dist/lib/browser/toolkit-U7SKGAIC.mjs.map +0 -7
- package/dist/lib/node-esm/BlueprintContainer-MUHW5HNY.mjs +0 -30
- package/dist/lib/node-esm/BlueprintContainer-MUHW5HNY.mjs.map +0 -7
- package/dist/lib/node-esm/ChatCompanion-DK6FULBU.mjs +0 -125
- package/dist/lib/node-esm/ChatCompanion-DK6FULBU.mjs.map +0 -7
- package/dist/lib/node-esm/ChatContainer-7IN7ZICQ.mjs +0 -74
- package/dist/lib/node-esm/ChatContainer-7IN7ZICQ.mjs.map +0 -7
- package/dist/lib/node-esm/ChatDialog-LPE653RZ.mjs +0 -87
- package/dist/lib/node-esm/ChatDialog-LPE653RZ.mjs.map +0 -7
- package/dist/lib/node-esm/SequenceContainer-UXOVZPZO.mjs +0 -151
- package/dist/lib/node-esm/SequenceContainer-UXOVZPZO.mjs.map +0 -7
- package/dist/lib/node-esm/ai-service-I5JU4JN2.mjs +0 -19
- package/dist/lib/node-esm/ai-service-I5JU4JN2.mjs.map +0 -7
- package/dist/lib/node-esm/app-graph-builder-EMR5JF6Z.mjs +0 -154
- package/dist/lib/node-esm/app-graph-builder-EMR5JF6Z.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-4WLFSXZG.mjs +0 -170
- package/dist/lib/node-esm/chunk-4WLFSXZG.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-5MYWJPYA.mjs +0 -167
- package/dist/lib/node-esm/chunk-5MYWJPYA.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-7YOGZI66.mjs +0 -203
- package/dist/lib/node-esm/chunk-7YOGZI66.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-FHRJMZ7L.mjs +0 -17
- package/dist/lib/node-esm/chunk-FHRJMZ7L.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-GCNF3CQU.mjs +0 -217
- package/dist/lib/node-esm/chunk-GCNF3CQU.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-H3ZC4UL7.mjs +0 -300
- package/dist/lib/node-esm/chunk-H3ZC4UL7.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-VFY2JG62.mjs +0 -22
- package/dist/lib/node-esm/chunk-VFY2JG62.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-X2YUKRBE.mjs +0 -1942
- package/dist/lib/node-esm/chunk-X2YUKRBE.mjs.map +0 -7
- package/dist/lib/node-esm/edge-model-resolver-A7B6QHLL.mjs +0 -19
- package/dist/lib/node-esm/edge-model-resolver-A7B6QHLL.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-CIXO3KMY.mjs +0 -113
- package/dist/lib/node-esm/intent-resolver-CIXO3KMY.mjs.map +0 -7
- package/dist/lib/node-esm/local-model-resolver-JCYDHAZY.mjs +0 -18
- package/dist/lib/node-esm/local-model-resolver-JCYDHAZY.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-5NDJAWA2.mjs +0 -108
- package/dist/lib/node-esm/react-surface-5NDJAWA2.mjs.map +0 -7
- package/dist/lib/node-esm/settings-K2QW4ATZ.mjs +0 -24
- package/dist/lib/node-esm/settings-K2QW4ATZ.mjs.map +0 -7
- package/dist/lib/node-esm/state-6UHESJI5.mjs +0 -22
- package/dist/lib/node-esm/state-6UHESJI5.mjs.map +0 -7
- package/dist/lib/node-esm/toolkit-LNLRBVDU.mjs +0 -192
- package/dist/lib/node-esm/toolkit-LNLRBVDU.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/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 -267
- 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/execution-graph/execution-graph.d.ts +0 -21
- package/dist/types/src/execution-graph/execution-graph.d.ts.map +0 -1
- package/dist/types/src/execution-graph/index.d.ts +0 -2
- package/dist/types/src/execution-graph/index.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/useExecutionGraph.d.ts +0 -6
- package/dist/types/src/hooks/useExecutionGraph.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/dist/types/src/stories/Chat.stories.d.ts +0 -31
- package/dist/types/src/stories/Chat.stories.d.ts.map +0 -1
- package/dist/types/src/stories/components/BlueprintContainer.d.ts +0 -4
- package/dist/types/src/stories/components/BlueprintContainer.d.ts.map +0 -1
- package/dist/types/src/stories/components/ChatContainer.d.ts +0 -4
- package/dist/types/src/stories/components/ChatContainer.d.ts.map +0 -1
- package/dist/types/src/stories/components/ChessContainer.d.ts +0 -4
- package/dist/types/src/stories/components/ChessContainer.d.ts.map +0 -1
- package/dist/types/src/stories/components/CommentsContainer.d.ts +0 -4
- package/dist/types/src/stories/components/CommentsContainer.d.ts.map +0 -1
- package/dist/types/src/stories/components/DebugCard.d.ts +0 -8
- package/dist/types/src/stories/components/DebugCard.d.ts.map +0 -1
- package/dist/types/src/stories/components/GraphContainer.d.ts +0 -6
- package/dist/types/src/stories/components/GraphContainer.d.ts.map +0 -1
- package/dist/types/src/stories/components/InvocationsContainer.d.ts +0 -4
- package/dist/types/src/stories/components/InvocationsContainer.d.ts.map +0 -1
- package/dist/types/src/stories/components/LoggingContainer.d.ts +0 -7
- package/dist/types/src/stories/components/LoggingContainer.d.ts.map +0 -1
- package/dist/types/src/stories/components/MessageContainer.d.ts +0 -4
- package/dist/types/src/stories/components/MessageContainer.d.ts.map +0 -1
- package/dist/types/src/stories/components/ProjectContainer.d.ts +0 -4
- package/dist/types/src/stories/components/ProjectContainer.d.ts.map +0 -1
- package/dist/types/src/stories/components/PromptContainer.d.ts +0 -6
- package/dist/types/src/stories/components/PromptContainer.d.ts.map +0 -1
- package/dist/types/src/stories/components/ResearchInputStack.d.ts +0 -4
- package/dist/types/src/stories/components/ResearchInputStack.d.ts.map +0 -1
- package/dist/types/src/stories/components/ResearchOutputStack.d.ts +0 -4
- package/dist/types/src/stories/components/ResearchOutputStack.d.ts.map +0 -1
- package/dist/types/src/stories/components/TasksContainer.d.ts +0 -4
- package/dist/types/src/stories/components/TasksContainer.d.ts.map +0 -1
- package/dist/types/src/stories/components/TokenManagerContainer.d.ts +0 -3
- package/dist/types/src/stories/components/TokenManagerContainer.d.ts.map +0 -1
- package/dist/types/src/stories/components/TriggersContainer.d.ts +0 -3
- package/dist/types/src/stories/components/TriggersContainer.d.ts.map +0 -1
- package/dist/types/src/stories/components/index.d.ts +0 -17
- package/dist/types/src/stories/components/index.d.ts.map +0 -1
- package/dist/types/src/stories/components/types.d.ts +0 -7
- package/dist/types/src/stories/components/types.d.ts.map +0 -1
- package/dist/types/src/stories/testing/data.d.ts +0 -9
- package/dist/types/src/stories/testing/data.d.ts.map +0 -1
- package/dist/types/src/stories/testing/index.d.ts +0 -3
- package/dist/types/src/stories/testing/index.d.ts.map +0 -1
- package/dist/types/src/stories/testing/schema.d.ts +0 -7
- package/dist/types/src/stories/testing/schema.d.ts.map +0 -1
- package/dist/types/src/stories/testing/testing.d.ts +0 -48
- package/dist/types/src/stories/testing/testing.d.ts.map +0 -1
- package/dist/types/src/testing/test-data.d.ts +0 -14
- package/dist/types/src/testing/test-data.d.ts.map +0 -1
- package/dist/types/src/testing/test-functions.d.ts +0 -6
- package/dist/types/src/testing/test-functions.d.ts.map +0 -1
- package/src/capabilities/ai-service.ts +0 -26
- package/src/capabilities/app-graph-builder.ts +0 -162
- package/src/capabilities/blueprint-definition.ts +0 -61
- package/src/capabilities/capabilities.ts +0 -18
- package/src/capabilities/edge-model-resolver.ts +0 -25
- package/src/capabilities/intent-resolver.ts +0 -94
- 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 -163
- package/src/components/BlueprintContainer.tsx +0 -24
- package/src/components/PromptSettings.tsx +0 -90
- package/src/components/SequenceContainer.tsx +0 -131
- package/src/components/SequenceEditor/SequenceEditor.stories.tsx +0 -33
- package/src/components/SequenceEditor/SequenceEditor.tsx +0 -50
- package/src/components/SequenceEditor/index.ts +0 -5
- package/src/components/TemplateEditor/handlebars-extension.ts +0 -165
- package/src/components/Toolbar/Toolbar.tsx +0 -21
- package/src/components/Toolbar/index.ts +0 -5
- package/src/components/Toolbar/useChatToolbarActions.ts +0 -126
- package/src/events.ts +0 -11
- package/src/execution-graph/execution-graph.ts +0 -211
- package/src/execution-graph/index.ts +0 -5
- package/src/functions/analysis.ts +0 -20
- package/src/hooks/useExecutionGraph.ts +0 -20
- package/src/hooks/useItemTypes.ts +0 -37
- package/src/stories/Chat.stories.tsx +0 -804
- package/src/stories/components/BlueprintContainer.tsx +0 -34
- package/src/stories/components/ChatContainer.tsx +0 -74
- package/src/stories/components/ChessContainer.tsx +0 -17
- package/src/stories/components/CommentsContainer.tsx +0 -25
- package/src/stories/components/DebugCard.tsx +0 -61
- package/src/stories/components/GraphContainer.tsx +0 -119
- package/src/stories/components/InvocationsContainer.tsx +0 -17
- package/src/stories/components/LoggingContainer.tsx +0 -33
- package/src/stories/components/MessageContainer.tsx +0 -22
- package/src/stories/components/ProjectContainer.tsx +0 -17
- package/src/stories/components/PromptContainer.tsx +0 -52
- package/src/stories/components/ResearchInputStack.tsx +0 -30
- package/src/stories/components/ResearchOutputStack.tsx +0 -29
- package/src/stories/components/TasksContainer.tsx +0 -49
- package/src/stories/components/TokenManagerContainer.tsx +0 -14
- package/src/stories/components/TriggersContainer.tsx +0 -12
- package/src/stories/components/index.ts +0 -21
- package/src/stories/components/types.ts +0 -11
- package/src/stories/testing/data.ts +0 -142
- package/src/stories/testing/index.ts +0 -6
- package/src/stories/testing/schema.ts +0 -17
- package/src/stories/testing/testing.tsx +0 -284
- package/src/testing/test-data.ts +0 -255
- package/src/testing/test-functions.ts +0 -16
- /package/dist/lib/browser/{blueprint-definition-3SATLYJW.mjs.map → blueprint-definition-DGHH7MUU.mjs.map} +0 -0
- /package/dist/lib/{node-esm/blueprint-definition-B6UDX5U3.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
|
@@ -0,0 +1,144 @@
|
|
|
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 (e) {
|
|
115
|
+
// failed to parse
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
const diagnostics: Diagnostic[] = [];
|
|
119
|
+
for (const s of suggestions) {
|
|
120
|
+
// Naive finding of position
|
|
121
|
+
const idx = text.indexOf(s.original);
|
|
122
|
+
if (idx !== -1) {
|
|
123
|
+
diagnostics.push({
|
|
124
|
+
from: idx,
|
|
125
|
+
to: idx + s.original.length,
|
|
126
|
+
severity: 'info',
|
|
127
|
+
message: `Suggestion: ${s.replacement}`,
|
|
128
|
+
actions: [
|
|
129
|
+
{
|
|
130
|
+
name: 'Apply',
|
|
131
|
+
apply: (view, from, to) => {
|
|
132
|
+
view.dispatch({ changes: { from, to, insert: s.replacement } });
|
|
133
|
+
},
|
|
134
|
+
},
|
|
135
|
+
],
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
return diagnostics;
|
|
140
|
+
} catch (e) {
|
|
141
|
+
log.error('Proofreading failed', { error: e });
|
|
142
|
+
return [];
|
|
143
|
+
}
|
|
144
|
+
});
|
package/src/components/index.ts
CHANGED
|
@@ -6,14 +6,11 @@ import { lazy } from 'react';
|
|
|
6
6
|
|
|
7
7
|
export * from './AssistantSettings';
|
|
8
8
|
export * from './Chat';
|
|
9
|
-
export * from './ChatProgress';
|
|
10
|
-
export * from './PromptSettings';
|
|
11
9
|
export * from './TemplateEditor';
|
|
12
|
-
export * from './Toolbar';
|
|
13
10
|
export * from './Toolbox';
|
|
14
11
|
|
|
15
|
-
export const
|
|
12
|
+
export const BlueprintArticle = lazy(() => import('./BlueprintArticle'));
|
|
16
13
|
export const ChatCompanion = lazy(() => import('./ChatCompanion'));
|
|
17
14
|
export const ChatContainer = lazy(() => import('./ChatContainer'));
|
|
18
15
|
export const ChatDialog = lazy(() => import('./ChatDialog'));
|
|
19
|
-
export const
|
|
16
|
+
export const PromptArticle = lazy(() => import('./PromptArticle'));
|
package/src/functions/index.ts
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
export { default as
|
|
6
|
-
export { default as
|
|
7
|
-
export { default as
|
|
5
|
+
export { default as list } from './object-list';
|
|
6
|
+
export { default as load } from './object-load';
|
|
7
|
+
export { default as search } from './object-search';
|
|
@@ -2,20 +2,23 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
|
+
import * as Schema from 'effect/Schema';
|
|
6
7
|
|
|
7
8
|
import { Filter, Obj, Query } from '@dxos/echo';
|
|
8
|
-
import {
|
|
9
|
+
import { Database } from '@dxos/echo';
|
|
10
|
+
import { defineFunction } from '@dxos/functions';
|
|
9
11
|
import { trim } from '@dxos/util';
|
|
10
12
|
|
|
11
|
-
// TODO(burdon):
|
|
13
|
+
// TODO(burdon): Move to toolkit (i.e., tool not function).
|
|
12
14
|
export default defineFunction({
|
|
13
|
-
|
|
15
|
+
key: 'dxos.org/function/assistant/object-list',
|
|
16
|
+
name: 'List objects',
|
|
14
17
|
description:
|
|
15
18
|
// TODO(wittjosiah): Find a better way to prompt for looking up typenames before querying with them.
|
|
16
19
|
trim`
|
|
17
20
|
Lists the objects of the given type.
|
|
18
|
-
Check the
|
|
21
|
+
Check the get-schemas tool for available types before calling this function.
|
|
19
22
|
`,
|
|
20
23
|
inputSchema: Schema.Struct({
|
|
21
24
|
typename: Schema.String.annotations({
|
|
@@ -32,10 +35,10 @@ export default defineFunction({
|
|
|
32
35
|
}),
|
|
33
36
|
handler: Effect.fn(function* ({ data: { typename } }) {
|
|
34
37
|
// TODO(wittjosiah): Typename query is not working for dynamic schemas.
|
|
35
|
-
const [schema] = yield*
|
|
38
|
+
const [schema] = yield* Database.Service.runSchemaQuery({ typename });
|
|
36
39
|
const filter = schema ? Filter.type(schema) : Filter.typename(typename);
|
|
37
40
|
|
|
38
|
-
const
|
|
41
|
+
const objects = yield* Database.Service.runQuery(Query.select(filter));
|
|
39
42
|
const results = objects.map((object) => ({
|
|
40
43
|
dxn: Obj.getDXN(object).toString(),
|
|
41
44
|
label: Obj.getLabel(object),
|
|
@@ -2,18 +2,23 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
|
+
import * as Function from 'effect/Function';
|
|
7
|
+
import * as Option from 'effect/Option';
|
|
8
|
+
import * as Schema from 'effect/Schema';
|
|
6
9
|
|
|
7
10
|
import { ArtifactId } from '@dxos/assistant';
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
11
|
+
import { Entity } from '@dxos/echo';
|
|
12
|
+
import { Database } from '@dxos/echo';
|
|
13
|
+
import { defineFunction } from '@dxos/functions';
|
|
10
14
|
|
|
11
|
-
// TODO(burdon):
|
|
12
|
-
// TODO(burdon): Factor out to space plugin.
|
|
15
|
+
// TODO(burdon): Move to toolkit (i.e., tool not function).
|
|
13
16
|
export default defineFunction({
|
|
14
|
-
|
|
17
|
+
key: 'dxos.org/function/assistant/object-load',
|
|
18
|
+
name: 'Load object',
|
|
15
19
|
description: 'Loads the object.',
|
|
16
20
|
inputSchema: Schema.Struct({
|
|
21
|
+
// TODO(dmaretskyi): Use Ref.
|
|
17
22
|
id: ArtifactId.annotations({
|
|
18
23
|
description: 'The ID of the object.',
|
|
19
24
|
}),
|
|
@@ -22,14 +27,14 @@ export default defineFunction({
|
|
|
22
27
|
}),
|
|
23
28
|
}),
|
|
24
29
|
outputSchema: Schema.Struct({
|
|
25
|
-
// TODO(wittjosiah): Type.
|
|
30
|
+
// TODO(wittjosiah): Type.Entity.Any
|
|
26
31
|
object: Schema.Any,
|
|
27
32
|
}),
|
|
28
33
|
handler: Effect.fn(function* ({ data: { id, typename } }) {
|
|
29
|
-
const object = yield*
|
|
30
|
-
return yield* pipe(
|
|
34
|
+
const object = yield* Database.Service.resolve(ArtifactId.toDXN(id));
|
|
35
|
+
return yield* Function.pipe(
|
|
31
36
|
Option.fromNullable(object),
|
|
32
|
-
Option.flatMap((object) => (
|
|
37
|
+
Option.flatMap((object) => (Entity.getTypename(object) === typename ? Option.some(object) : Option.none())),
|
|
33
38
|
Option.match({
|
|
34
39
|
onNone: () => Effect.fail('Object not found.'),
|
|
35
40
|
onSome: (object) => {
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
|
+
import * as Schema from 'effect/Schema';
|
|
7
|
+
|
|
8
|
+
import { Filter, Obj, Query } from '@dxos/echo';
|
|
9
|
+
import { Database } from '@dxos/echo';
|
|
10
|
+
import { defineFunction } from '@dxos/functions';
|
|
11
|
+
import { trim } from '@dxos/util';
|
|
12
|
+
|
|
13
|
+
// TODO(burdon): Move to toolkit (i.e., tool not function).
|
|
14
|
+
export default defineFunction({
|
|
15
|
+
key: 'dxos.org/function/assistant/object-search',
|
|
16
|
+
name: 'Search objects',
|
|
17
|
+
description:
|
|
18
|
+
// TODO(wittjosiah): Find a better way to prompt for looking up typenames before querying with them.
|
|
19
|
+
trim`
|
|
20
|
+
Searches the objects using full-text search.
|
|
21
|
+
`,
|
|
22
|
+
inputSchema: Schema.Struct({
|
|
23
|
+
query: Schema.String.annotations({
|
|
24
|
+
description: 'The query to search for.',
|
|
25
|
+
}),
|
|
26
|
+
}),
|
|
27
|
+
outputSchema: Schema.Struct({
|
|
28
|
+
results: Schema.Array(
|
|
29
|
+
Schema.Struct({
|
|
30
|
+
dxn: Schema.String.annotations({ description: 'The DXN of the object.' }),
|
|
31
|
+
label: Schema.optional(Schema.String.annotations({ description: 'The label of the object.' })),
|
|
32
|
+
}),
|
|
33
|
+
),
|
|
34
|
+
}),
|
|
35
|
+
handler: Effect.fn(function* ({ data: { query } }) {
|
|
36
|
+
const objects = yield* Database.Service.runQuery(
|
|
37
|
+
Query.select(Filter.text(query, { type: 'full-text' })).options({ allQueuesFromSpaces: true }),
|
|
38
|
+
);
|
|
39
|
+
const results = objects.map((object) => ({
|
|
40
|
+
dxn: Obj.getDXN(object).toString(),
|
|
41
|
+
label: Obj.getLabel(object),
|
|
42
|
+
}));
|
|
43
|
+
|
|
44
|
+
return { results };
|
|
45
|
+
}),
|
|
46
|
+
});
|
package/src/hooks/index.ts
CHANGED
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
export * from './useBlueprintRegistry';
|
|
6
6
|
export * from './useChatProcessor';
|
|
7
7
|
export * from './useChatServices';
|
|
8
|
+
export * from './useChatToolbarActions';
|
|
8
9
|
export * from './useContextBinder';
|
|
9
10
|
export * from './useContextObjects';
|
|
10
|
-
export * from './
|
|
11
|
+
export * from './useFilteredTypes';
|
|
11
12
|
export * from './useFlush';
|
|
12
|
-
export * from './useItemTypes';
|
|
13
13
|
export * from './useOnline';
|
|
14
14
|
export * from './usePresets';
|
|
15
15
|
export * from './useReferencesProvider';
|
|
@@ -2,27 +2,40 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import {
|
|
6
|
-
import { useCallback, useMemo, useState } from 'react';
|
|
5
|
+
import { useCallback, useEffect, useMemo, useState } from 'react';
|
|
7
6
|
|
|
8
|
-
import {
|
|
7
|
+
import { Common } from '@dxos/app-framework';
|
|
8
|
+
import { useCapabilities } from '@dxos/app-framework/react';
|
|
9
9
|
import { type AiContextBinder } from '@dxos/assistant';
|
|
10
10
|
import { Blueprint } from '@dxos/blueprints';
|
|
11
|
-
import { type
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
11
|
+
import { type Database, Filter, Obj, Ref } from '@dxos/echo';
|
|
12
|
+
import { useQuery } from '@dxos/react-client/echo';
|
|
13
|
+
import { distinctBy } from '@dxos/util';
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
16
|
* Provide a registry of blueprints from plugins.
|
|
17
17
|
*/
|
|
18
18
|
// TODO(burdon): Reconcile with eventual public registry.
|
|
19
19
|
export const useBlueprintRegistry = () => {
|
|
20
|
-
const blueprints = useCapabilities(
|
|
20
|
+
const blueprints = useCapabilities(Common.Capability.BlueprintDefinition);
|
|
21
21
|
return useMemo(() => new Blueprint.Registry(blueprints), [blueprints]);
|
|
22
22
|
};
|
|
23
23
|
|
|
24
|
-
export const useBlueprints = ({
|
|
25
|
-
|
|
24
|
+
export const useBlueprints = ({
|
|
25
|
+
blueprintRegistry,
|
|
26
|
+
db,
|
|
27
|
+
}: {
|
|
28
|
+
blueprintRegistry?: Blueprint.Registry;
|
|
29
|
+
db?: Database.Database;
|
|
30
|
+
}) => {
|
|
31
|
+
const staticBlueprints = useMemo(() => blueprintRegistry?.query() ?? [], [blueprintRegistry]);
|
|
32
|
+
const spaceBlueprints = useQuery(db, Filter.type(Blueprint.Blueprint));
|
|
33
|
+
return useMemo(() => {
|
|
34
|
+
const blueprints = distinctBy([...staticBlueprints, ...spaceBlueprints], (b) => b.key);
|
|
35
|
+
blueprints.sort(({ name: a }, { name: b }) => a.localeCompare(b));
|
|
36
|
+
return blueprints;
|
|
37
|
+
}, [staticBlueprints, spaceBlueprints]);
|
|
38
|
+
};
|
|
26
39
|
|
|
27
40
|
/**
|
|
28
41
|
* Create reactive map of active blueprints (by key).
|
|
@@ -30,22 +43,34 @@ export const useBlueprints = ({ blueprintRegistry }: { blueprintRegistry?: Bluep
|
|
|
30
43
|
export const useActiveBlueprints = ({ context }: { context?: AiContextBinder }) => {
|
|
31
44
|
const [active, setActive] = useState<Map<string, Blueprint.Blueprint>>(new Map());
|
|
32
45
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
46
|
+
useEffect(() => {
|
|
47
|
+
if (!context) {
|
|
48
|
+
setActive(new Map());
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
const updateActive = () => {
|
|
53
|
+
const blueprints = context.getBlueprints();
|
|
54
|
+
setActive(new Map(blueprints.map((blueprint) => [blueprint.key, blueprint])));
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
// Set initial value.
|
|
58
|
+
updateActive();
|
|
59
|
+
|
|
60
|
+
// Subscribe to changes.
|
|
61
|
+
return context.subscribeBlueprints(updateActive);
|
|
62
|
+
}, [context]);
|
|
38
63
|
|
|
39
64
|
return active;
|
|
40
65
|
};
|
|
41
66
|
|
|
42
67
|
// TODO(burdon): Move logic into binder.
|
|
43
68
|
export const useBlueprintHandlers = ({
|
|
44
|
-
|
|
69
|
+
db,
|
|
45
70
|
context,
|
|
46
71
|
blueprintRegistry,
|
|
47
72
|
}: {
|
|
48
|
-
|
|
73
|
+
db: Database.Database;
|
|
49
74
|
context?: AiContextBinder;
|
|
50
75
|
blueprintRegistry?: Blueprint.Registry;
|
|
51
76
|
}) => {
|
|
@@ -56,7 +81,7 @@ export const useBlueprintHandlers = ({
|
|
|
56
81
|
}
|
|
57
82
|
|
|
58
83
|
// Find existing cloned blueprint.
|
|
59
|
-
const
|
|
84
|
+
const objects = await db.query(Filter.type(Blueprint.Blueprint)).run();
|
|
60
85
|
let storedBlueprint = objects.find((blueprint) => blueprint.key === key);
|
|
61
86
|
if (checked) {
|
|
62
87
|
if (!storedBlueprint) {
|
|
@@ -66,14 +91,14 @@ export const useBlueprintHandlers = ({
|
|
|
66
91
|
}
|
|
67
92
|
|
|
68
93
|
// NOTE: Possible race condition with other peers.
|
|
69
|
-
storedBlueprint =
|
|
94
|
+
storedBlueprint = db.add(Obj.clone(blueprint));
|
|
70
95
|
}
|
|
71
96
|
await context.bind({ blueprints: [Ref.make(storedBlueprint)] });
|
|
72
97
|
} else if (storedBlueprint) {
|
|
73
98
|
await context.unbind({ blueprints: [Ref.make(storedBlueprint)] });
|
|
74
99
|
}
|
|
75
100
|
},
|
|
76
|
-
[
|
|
101
|
+
[db, context, blueprintRegistry],
|
|
77
102
|
);
|
|
78
103
|
|
|
79
104
|
return { onUpdateBlueprint };
|
|
@@ -2,19 +2,21 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { RegistryContext } from '@effect-
|
|
6
|
-
import
|
|
7
|
-
import { useContext, useMemo } from 'react';
|
|
5
|
+
import { type Registry, RegistryContext } from '@effect-atom/atom-react';
|
|
6
|
+
import type * as Runtime from 'effect/Runtime';
|
|
7
|
+
import { useContext, useMemo, useState } from 'react';
|
|
8
8
|
|
|
9
9
|
import { AiConversation } from '@dxos/assistant';
|
|
10
10
|
import { type Blueprint } from '@dxos/blueprints';
|
|
11
11
|
import { log } from '@dxos/log';
|
|
12
|
-
import { type Queue } from '@dxos/react-client/echo';
|
|
12
|
+
import { type Queue, type Space } from '@dxos/react-client/echo';
|
|
13
|
+
import { useAsyncEffect } from '@dxos/react-ui';
|
|
13
14
|
|
|
14
15
|
import { AiChatProcessor, type AiChatServices, type AiServicePreset } from '../processor';
|
|
15
16
|
import { type Assistant } from '../types';
|
|
16
17
|
|
|
17
18
|
export type UseChatProcessorProps = {
|
|
19
|
+
space?: Space;
|
|
18
20
|
chat?: Assistant.Chat;
|
|
19
21
|
preset?: AiServicePreset;
|
|
20
22
|
services?: () => Promise<Runtime.Runtime<AiChatServices>>;
|
|
@@ -26,6 +28,7 @@ export type UseChatProcessorProps = {
|
|
|
26
28
|
* Configure and create AiChatProcessor.
|
|
27
29
|
*/
|
|
28
30
|
export const useChatProcessor = ({
|
|
31
|
+
space,
|
|
29
32
|
chat,
|
|
30
33
|
preset,
|
|
31
34
|
services,
|
|
@@ -35,13 +38,26 @@ export const useChatProcessor = ({
|
|
|
35
38
|
const observableRegistry = useContext(RegistryContext);
|
|
36
39
|
|
|
37
40
|
// Create conversation from chat queue.
|
|
38
|
-
const conversation =
|
|
39
|
-
|
|
41
|
+
const [conversation, setConversation] = useState<AiConversation>();
|
|
42
|
+
useAsyncEffect(async () => {
|
|
43
|
+
if (!space || !chat) {
|
|
40
44
|
return;
|
|
41
45
|
}
|
|
42
46
|
|
|
43
|
-
|
|
44
|
-
|
|
47
|
+
// NOTE: Passing in space and getting queue from space rather than resolving the reference.
|
|
48
|
+
// This is because if the chat isn't in a space yet, the reference will not be resolvable.
|
|
49
|
+
const queue = space.queues.get(chat.queue.dxn);
|
|
50
|
+
const conversation = new AiConversation({
|
|
51
|
+
queue: queue as Queue<any>,
|
|
52
|
+
registry: observableRegistry as Registry.Registry,
|
|
53
|
+
});
|
|
54
|
+
await conversation.open();
|
|
55
|
+
setConversation(conversation);
|
|
56
|
+
return () => {
|
|
57
|
+
void conversation.close();
|
|
58
|
+
setConversation(undefined);
|
|
59
|
+
};
|
|
60
|
+
}, [space, chat?.queue.dxn.toString()]);
|
|
45
61
|
|
|
46
62
|
// Create processor.
|
|
47
63
|
const processor = useMemo(() => {
|
|
@@ -49,12 +65,7 @@ export const useChatProcessor = ({
|
|
|
49
65
|
return undefined;
|
|
50
66
|
}
|
|
51
67
|
|
|
52
|
-
log('creating processor', {
|
|
53
|
-
preset,
|
|
54
|
-
model: preset?.model,
|
|
55
|
-
settings,
|
|
56
|
-
});
|
|
57
|
-
|
|
68
|
+
log('creating processor', { preset, model: preset?.model, settings });
|
|
58
69
|
return new AiChatProcessor(conversation, services, {
|
|
59
70
|
observableRegistry,
|
|
60
71
|
blueprintRegistry,
|
|
@@ -2,12 +2,14 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
|
+
import type * as Runtime from 'effect/Runtime';
|
|
6
7
|
import { useMemo } from 'react';
|
|
7
8
|
|
|
8
|
-
import { useCapability } from '@dxos/app-framework';
|
|
9
|
-
import { type
|
|
9
|
+
import { useCapability } from '@dxos/app-framework/react';
|
|
10
|
+
import { type Key } from '@dxos/echo';
|
|
10
11
|
import { TracingService } from '@dxos/functions';
|
|
12
|
+
import { TracingServiceExt } from '@dxos/functions-runtime';
|
|
11
13
|
import { AutomationCapabilities } from '@dxos/plugin-automation';
|
|
12
14
|
import { useClient } from '@dxos/react-client';
|
|
13
15
|
|
|
@@ -15,7 +17,7 @@ import { type AiChatServices } from '../processor';
|
|
|
15
17
|
import { type Assistant } from '../types';
|
|
16
18
|
|
|
17
19
|
export type UseChatServicesProps = {
|
|
18
|
-
|
|
20
|
+
id?: Key.SpaceId;
|
|
19
21
|
chat?: Assistant.Chat;
|
|
20
22
|
};
|
|
21
23
|
|
|
@@ -24,25 +26,22 @@ export type UseChatServicesProps = {
|
|
|
24
26
|
*/
|
|
25
27
|
// TODO(dmaretskyi): Better return type.
|
|
26
28
|
export const useChatServices = ({
|
|
27
|
-
|
|
29
|
+
id,
|
|
28
30
|
chat,
|
|
29
31
|
}: UseChatServicesProps): (() => Promise<Runtime.Runtime<AiChatServices>>) | undefined => {
|
|
30
32
|
const client = useClient();
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
const computeRuntimeResolver = useCapability(AutomationCapabilities.ComputeRuntime);
|
|
33
|
+
id ??= client.spaces.default.id;
|
|
34
34
|
|
|
35
|
+
const runtimeResolver = useCapability(AutomationCapabilities.ComputeRuntime);
|
|
35
36
|
return useMemo(() => {
|
|
36
|
-
const runtime =
|
|
37
|
+
const runtime = runtimeResolver.getRuntime(id);
|
|
37
38
|
return () =>
|
|
38
39
|
runtime.runPromise(
|
|
39
|
-
Effect.
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
);
|
|
45
|
-
}),
|
|
40
|
+
Effect.runtime<AiChatServices>().pipe(
|
|
41
|
+
Effect.provide(
|
|
42
|
+
chat?.traceQueue?.target ? TracingServiceExt.layerQueue(chat.traceQueue?.target) : TracingService.layerNoop,
|
|
43
|
+
),
|
|
44
|
+
),
|
|
46
45
|
);
|
|
47
|
-
}, [
|
|
46
|
+
}, [id, chat?.traceQueue?.target]);
|
|
48
47
|
};
|