@dxos/plugin-assistant 0.8.4-main.7ace549 → 0.8.4-main.937b3ca
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-7ZJIXQ2Y.mjs → chunk-DKQMSMBN.mjs} +54 -63
- package/dist/lib/browser/chunk-DKQMSMBN.mjs.map +7 -0
- package/dist/lib/browser/{chunk-WBG5PTSX.mjs → chunk-EXVT7D4B.mjs} +1 -1
- package/dist/lib/browser/chunk-EXVT7D4B.mjs.map +7 -0
- package/dist/lib/browser/{chunk-2BOE3OTW.mjs → chunk-ML3QCFKA.mjs} +23 -20
- 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 +156 -174
- 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-ECKZNDSU.mjs → react-surface-S7SBFOSW.mjs} +41 -30
- package/dist/lib/browser/react-surface-S7SBFOSW.mjs.map +7 -0
- package/dist/lib/browser/{repair-3MZXLUHO.mjs → repair-6QGAKOVM.mjs} +23 -13
- 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-RDCLLIQH.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-CKW4IYLY.mjs → chunk-75PHXBN3.mjs} +54 -63
- 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-WE6KTH72.mjs → chunk-POWB2BPC.mjs} +1 -1
- package/dist/lib/node-esm/chunk-POWB2BPC.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-3Q22TTXW.mjs → chunk-ZRIPP7YF.mjs} +23 -20
- package/dist/lib/node-esm/chunk-ZRIPP7YF.mjs.map +7 -0
- package/dist/lib/node-esm/{edge-model-resolver-2ARXDOYS.mjs → edge-model-resolver-G5KMODPO.mjs} +9 -7
- package/dist/lib/node-esm/edge-model-resolver-G5KMODPO.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +156 -174
- 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-NLIG5VAI.mjs → react-surface-ZR6FXGLF.mjs} +41 -30
- package/dist/lib/node-esm/react-surface-ZR6FXGLF.mjs.map +7 -0
- package/dist/lib/node-esm/{repair-RER5H7Y6.mjs → repair-QJ7CQDKU.mjs} +23 -13
- 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 -12
- 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 +1 -1
- package/dist/types/src/components/BlueprintArticle.d.ts.map +1 -1
- package/dist/types/src/components/Chat/Chat.d.ts +9 -10
- package/dist/types/src/components/Chat/Chat.d.ts.map +1 -1
- package/dist/types/src/components/Chat/events.d.ts +1 -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 +10 -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/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 +1 -1
- package/dist/types/src/components/ChatThread/ChatThread.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/ChatThread.stories.d.ts +4 -3
- 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 +1 -1
- package/dist/types/src/components/ChatThread/sync.d.ts.map +1 -1
- package/dist/types/src/components/PromptArticle.d.ts +1 -1
- package/dist/types/src/components/PromptArticle.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/TemplateEditor.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 +1 -1
- 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 -1
- package/dist/types/src/components/ToolBlock/ToolBlock.d.ts +3 -3
- package/dist/types/src/components/ToolBlock/ToolBlock.d.ts.map +1 -1
- package/dist/types/src/components/Toolbox/Toolbox.d.ts +4 -5
- package/dist/types/src/components/Toolbox/Toolbox.d.ts.map +1 -1
- 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 -4
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/functions/index.d.ts +1 -1
- package/dist/types/src/functions/index.d.ts.map +1 -1
- package/dist/types/src/functions/object-list.d.ts +1 -1
- package/dist/types/src/functions/object-list.d.ts.map +1 -1
- package/dist/types/src/functions/object-load.d.ts.map +1 -1
- 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/useBlueprintRegistry.d.ts +5 -5
- package/dist/types/src/hooks/useBlueprintRegistry.d.ts.map +1 -1
- package/dist/types/src/hooks/useChatProcessor.d.ts.map +1 -1
- package/dist/types/src/hooks/useChatServices.d.ts +3 -3
- package/dist/types/src/hooks/useChatServices.d.ts.map +1 -1
- package/dist/types/src/hooks/useChatToolbarActions.d.ts +1 -1
- package/dist/types/src/hooks/useChatToolbarActions.d.ts.map +1 -1
- 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 +2 -3
- package/dist/types/src/hooks/useFilteredTypes.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/processor.d.ts +10 -9
- package/dist/types/src/processor/processor.d.ts.map +1 -1
- package/dist/types/src/processor/update-name.d.ts.map +1 -1
- package/dist/types/src/queue-logger.d.ts.map +1 -1
- package/dist/types/src/testing/test-generator.d.ts +3 -2
- 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/types/Assistant.d.ts +16 -19
- package/dist/types/src/types/Assistant.d.ts.map +1 -1
- package/dist/types/src/types/AssistantAction.d.ts +88 -122
- 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 +11 -260
- package/dist/types/src/types/service.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +113 -92
- package/src/AssistantPlugin.tsx +62 -90
- 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 -15
- 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.ts → repair/repair.ts} +23 -9
- 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 +4 -4
- package/src/components/Chat/Chat.tsx +68 -68
- package/src/components/Chat/events.ts +1 -1
- package/src/components/ChatCompanion.tsx +125 -117
- package/src/components/ChatContainer.tsx +19 -19
- package/src/components/ChatDialog.tsx +6 -7
- package/src/components/ChatProgress/ChatProgress.tsx +3 -16
- package/src/components/ChatPrompt/ChatActions.tsx +1 -1
- package/src/components/ChatPrompt/ChatOptions.tsx +62 -58
- package/src/components/ChatPrompt/ChatReferences.tsx +5 -6
- package/src/components/ChatPrompt/ChatStatusIndicator.tsx +1 -1
- package/src/components/ChatThread/ChatThread.stories.tsx +10 -8
- package/src/components/ChatThread/ChatThread.tsx +1 -1
- package/src/components/ChatThread/Link.tsx +2 -2
- package/src/components/ChatThread/registry.tsx +2 -2
- package/src/components/ChatThread/sync.test.ts +12 -5
- package/src/components/ChatThread/sync.ts +8 -2
- package/src/components/PromptArticle.tsx +8 -9
- package/src/components/TemplateEditor/TemplateEditor.stories.tsx +2 -2
- package/src/components/TemplateEditor/TemplateEditor.tsx +7 -4
- package/src/components/TemplateEditor/TemplateForm.stories.tsx +14 -6
- package/src/components/TemplateEditor/TemplateForm.tsx +75 -28
- package/src/components/TemplateEditor/extensions/handlebars-extension.ts +10 -5
- package/src/components/ToolBlock/ToolBlock.tsx +6 -6
- package/src/components/Toolbox/Toolbox.stories.tsx +8 -9
- package/src/components/Toolbox/Toolbox.tsx +14 -15
- 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/functions/index.ts +1 -1
- package/src/functions/object-list.ts +4 -3
- package/src/functions/object-load.ts +6 -4
- package/src/functions/object-search.ts +46 -0
- package/src/hooks/useBlueprintRegistry.ts +30 -20
- package/src/hooks/useChatProcessor.ts +5 -2
- package/src/hooks/useChatServices.ts +11 -15
- package/src/hooks/useChatToolbarActions.ts +24 -25
- package/src/hooks/useContextBinder.ts +4 -2
- package/src/hooks/useContextObjects.ts +13 -25
- package/src/hooks/useFilteredTypes.ts +6 -7
- package/src/hooks/useReferencesProvider.ts +6 -6
- package/src/index.ts +0 -1
- package/src/meta.ts +2 -2
- package/src/processor/processor.test.ts +3 -2
- package/src/processor/processor.ts +23 -25
- package/src/processor/update-name.ts +4 -1
- package/src/queue-logger.ts +4 -1
- package/src/testing/test-generator.ts +4 -3
- package/src/testing/test-services.ts +8 -6
- package/src/types/Assistant.ts +5 -6
- package/src/types/AssistantAction.ts +58 -62
- 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 +10 -7
- package/dist/lib/browser/BlueprintArticle-BWSLH6LG.mjs +0 -36
- package/dist/lib/browser/BlueprintArticle-BWSLH6LG.mjs.map +0 -7
- package/dist/lib/browser/ChatCompanion-OSZZZSWV.mjs +0 -158
- package/dist/lib/browser/ChatCompanion-OSZZZSWV.mjs.map +0 -7
- package/dist/lib/browser/ChatContainer-2W6FNSJD.mjs +0 -77
- package/dist/lib/browser/ChatContainer-2W6FNSJD.mjs.map +0 -7
- package/dist/lib/browser/ChatDialog-XQ3KDYWE.mjs +0 -90
- package/dist/lib/browser/ChatDialog-XQ3KDYWE.mjs.map +0 -7
- package/dist/lib/browser/PromptArticle-Q7JYGFQV.mjs +0 -59
- package/dist/lib/browser/PromptArticle-Q7JYGFQV.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-LM6GVHQO.mjs +0 -199
- package/dist/lib/browser/app-graph-builder-LM6GVHQO.mjs.map +0 -7
- package/dist/lib/browser/blueprint-definition-VBEOXNBS.mjs +0 -12
- package/dist/lib/browser/chunk-2BOE3OTW.mjs.map +0 -7
- package/dist/lib/browser/chunk-5JZRYQZL.mjs +0 -229
- package/dist/lib/browser/chunk-5JZRYQZL.mjs.map +0 -7
- package/dist/lib/browser/chunk-7ZJIXQ2Y.mjs.map +0 -7
- package/dist/lib/browser/chunk-LRE4VEZV.mjs +0 -16
- package/dist/lib/browser/chunk-LRE4VEZV.mjs.map +0 -7
- package/dist/lib/browser/chunk-NC2QNMBF.mjs +0 -176
- package/dist/lib/browser/chunk-NC2QNMBF.mjs.map +0 -7
- package/dist/lib/browser/chunk-PWSTPQUY.mjs +0 -1929
- package/dist/lib/browser/chunk-PWSTPQUY.mjs.map +0 -7
- package/dist/lib/browser/chunk-WBG5PTSX.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-EEYS2GJF.mjs +0 -143
- package/dist/lib/browser/intent-resolver-EEYS2GJF.mjs.map +0 -7
- package/dist/lib/browser/local-model-resolver-34MVHRKD.mjs +0 -17
- package/dist/lib/browser/local-model-resolver-34MVHRKD.mjs.map +0 -7
- package/dist/lib/browser/react-surface-ECKZNDSU.mjs.map +0 -7
- package/dist/lib/browser/repair-3MZXLUHO.mjs.map +0 -7
- package/dist/lib/browser/settings-HD5WA24I.mjs +0 -23
- package/dist/lib/browser/settings-HD5WA24I.mjs.map +0 -7
- package/dist/lib/browser/state-GG7Z3NB7.mjs +0 -25
- package/dist/lib/browser/state-GG7Z3NB7.mjs.map +0 -7
- package/dist/lib/browser/toolkit-VYDAWNE4.mjs +0 -17
- package/dist/lib/browser/toolkit-VYDAWNE4.mjs.map +0 -7
- package/dist/lib/node-esm/BlueprintArticle-R2XYBRCK.mjs +0 -37
- package/dist/lib/node-esm/BlueprintArticle-R2XYBRCK.mjs.map +0 -7
- package/dist/lib/node-esm/ChatCompanion-IUMU7WRQ.mjs +0 -159
- package/dist/lib/node-esm/ChatCompanion-IUMU7WRQ.mjs.map +0 -7
- package/dist/lib/node-esm/ChatContainer-CTUNUEU3.mjs +0 -78
- package/dist/lib/node-esm/ChatContainer-CTUNUEU3.mjs.map +0 -7
- package/dist/lib/node-esm/ChatDialog-X42ASXQD.mjs +0 -91
- package/dist/lib/node-esm/ChatDialog-X42ASXQD.mjs.map +0 -7
- package/dist/lib/node-esm/PromptArticle-IV7O5UZ3.mjs +0 -60
- package/dist/lib/node-esm/PromptArticle-IV7O5UZ3.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-6XUAGTRS.mjs +0 -200
- package/dist/lib/node-esm/app-graph-builder-6XUAGTRS.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-25GMMNY5.mjs +0 -178
- package/dist/lib/node-esm/chunk-25GMMNY5.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-3Q22TTXW.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-CKW4IYLY.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-E4JSYCWZ.mjs +0 -230
- package/dist/lib/node-esm/chunk-E4JSYCWZ.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-WE6KTH72.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-YWFWT57N.mjs +0 -17
- package/dist/lib/node-esm/chunk-YWFWT57N.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-Z37USO4K.mjs +0 -1930
- package/dist/lib/node-esm/chunk-Z37USO4K.mjs.map +0 -7
- package/dist/lib/node-esm/edge-model-resolver-2ARXDOYS.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-4SRYLDK5.mjs +0 -144
- package/dist/lib/node-esm/intent-resolver-4SRYLDK5.mjs.map +0 -7
- package/dist/lib/node-esm/local-model-resolver-TP2NTSAX.mjs +0 -18
- package/dist/lib/node-esm/local-model-resolver-TP2NTSAX.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-NLIG5VAI.mjs.map +0 -7
- package/dist/lib/node-esm/repair-RER5H7Y6.mjs.map +0 -7
- package/dist/lib/node-esm/settings-YJQVKHH5.mjs +0 -24
- package/dist/lib/node-esm/settings-YJQVKHH5.mjs.map +0 -7
- package/dist/lib/node-esm/state-FSUHFMDM.mjs +0 -26
- package/dist/lib/node-esm/state-FSUHFMDM.mjs.map +0 -7
- package/dist/lib/node-esm/toolkit-HFJZLVIR.mjs +0 -18
- package/dist/lib/node-esm/toolkit-HFJZLVIR.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 -10
- 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/repair.d.ts +0 -4
- package/dist/types/src/capabilities/repair.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/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/src/capabilities/ai-service.ts +0 -27
- package/src/capabilities/app-graph-builder.ts +0 -210
- package/src/capabilities/blueprint-definition.ts +0 -66
- package/src/capabilities/capabilities.ts +0 -17
- package/src/capabilities/edge-model-resolver.ts +0 -25
- package/src/capabilities/intent-resolver.ts +0 -135
- package/src/capabilities/local-model-resolver.ts +0 -30
- package/src/capabilities/react-surface.tsx +0 -87
- package/src/capabilities/settings.ts +0 -19
- package/src/capabilities/state.ts +0 -22
- package/src/capabilities/toolkit.ts +0 -17
- package/src/events.ts +0 -11
- package/src/functions/analysis.ts +0 -22
- /package/dist/lib/browser/{blueprint-definition-VBEOXNBS.mjs.map → blueprint-definition-DGHH7MUU.mjs.map} +0 -0
- /package/dist/lib/{node-esm/blueprint-definition-RDCLLIQH.mjs.map → browser/blueprints/index.mjs.map} +0 -0
|
@@ -2,36 +2,34 @@
|
|
|
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';
|
|
9
8
|
import { useCapabilities } from '@dxos/app-framework/react';
|
|
10
9
|
import { type AiContextBinder } from '@dxos/assistant';
|
|
11
10
|
import { Blueprint } from '@dxos/blueprints';
|
|
12
|
-
import { type
|
|
13
|
-
import { Filter, Obj, Ref } from '@dxos/echo';
|
|
11
|
+
import { type Database, Filter, Obj, Ref } from '@dxos/echo';
|
|
14
12
|
import { useQuery } from '@dxos/react-client/echo';
|
|
15
|
-
import { distinctBy
|
|
13
|
+
import { distinctBy } from '@dxos/util';
|
|
16
14
|
|
|
17
15
|
/**
|
|
18
16
|
* Provide a registry of blueprints from plugins.
|
|
19
17
|
*/
|
|
20
18
|
// TODO(burdon): Reconcile with eventual public registry.
|
|
21
19
|
export const useBlueprintRegistry = () => {
|
|
22
|
-
const blueprints = useCapabilities(
|
|
20
|
+
const blueprints = useCapabilities(Common.Capability.BlueprintDefinition);
|
|
23
21
|
return useMemo(() => new Blueprint.Registry(blueprints), [blueprints]);
|
|
24
22
|
};
|
|
25
23
|
|
|
26
24
|
export const useBlueprints = ({
|
|
27
25
|
blueprintRegistry,
|
|
28
|
-
|
|
26
|
+
db,
|
|
29
27
|
}: {
|
|
30
28
|
blueprintRegistry?: Blueprint.Registry;
|
|
31
|
-
|
|
29
|
+
db?: Database.Database;
|
|
32
30
|
}) => {
|
|
33
31
|
const staticBlueprints = useMemo(() => blueprintRegistry?.query() ?? [], [blueprintRegistry]);
|
|
34
|
-
const spaceBlueprints = useQuery(
|
|
32
|
+
const spaceBlueprints = useQuery(db, Filter.type(Blueprint.Blueprint));
|
|
35
33
|
return useMemo(() => {
|
|
36
34
|
const blueprints = distinctBy([...staticBlueprints, ...spaceBlueprints], (b) => b.key);
|
|
37
35
|
blueprints.sort(({ name: a }, { name: b }) => a.localeCompare(b));
|
|
@@ -45,22 +43,34 @@ export const useBlueprints = ({
|
|
|
45
43
|
export const useActiveBlueprints = ({ context }: { context?: AiContextBinder }) => {
|
|
46
44
|
const [active, setActive] = useState<Map<string, Blueprint.Blueprint>>(new Map());
|
|
47
45
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
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]);
|
|
53
63
|
|
|
54
64
|
return active;
|
|
55
65
|
};
|
|
56
66
|
|
|
57
67
|
// TODO(burdon): Move logic into binder.
|
|
58
68
|
export const useBlueprintHandlers = ({
|
|
59
|
-
|
|
69
|
+
db,
|
|
60
70
|
context,
|
|
61
71
|
blueprintRegistry,
|
|
62
72
|
}: {
|
|
63
|
-
|
|
73
|
+
db: Database.Database;
|
|
64
74
|
context?: AiContextBinder;
|
|
65
75
|
blueprintRegistry?: Blueprint.Registry;
|
|
66
76
|
}) => {
|
|
@@ -71,7 +81,7 @@ export const useBlueprintHandlers = ({
|
|
|
71
81
|
}
|
|
72
82
|
|
|
73
83
|
// Find existing cloned blueprint.
|
|
74
|
-
const
|
|
84
|
+
const objects = await db.query(Filter.type(Blueprint.Blueprint)).run();
|
|
75
85
|
let storedBlueprint = objects.find((blueprint) => blueprint.key === key);
|
|
76
86
|
if (checked) {
|
|
77
87
|
if (!storedBlueprint) {
|
|
@@ -81,14 +91,14 @@ export const useBlueprintHandlers = ({
|
|
|
81
91
|
}
|
|
82
92
|
|
|
83
93
|
// NOTE: Possible race condition with other peers.
|
|
84
|
-
storedBlueprint =
|
|
94
|
+
storedBlueprint = db.add(Obj.clone(blueprint));
|
|
85
95
|
}
|
|
86
96
|
await context.bind({ blueprints: [Ref.make(storedBlueprint)] });
|
|
87
97
|
} else if (storedBlueprint) {
|
|
88
98
|
await context.unbind({ blueprints: [Ref.make(storedBlueprint)] });
|
|
89
99
|
}
|
|
90
100
|
},
|
|
91
|
-
[
|
|
101
|
+
[db, context, blueprintRegistry],
|
|
92
102
|
);
|
|
93
103
|
|
|
94
104
|
return { onUpdateBlueprint };
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { RegistryContext } from '@effect-atom/atom-react';
|
|
5
|
+
import { type Registry, RegistryContext } from '@effect-atom/atom-react';
|
|
6
6
|
import type * as Runtime from 'effect/Runtime';
|
|
7
7
|
import { useContext, useMemo, useState } from 'react';
|
|
8
8
|
|
|
@@ -47,7 +47,10 @@ export const useChatProcessor = ({
|
|
|
47
47
|
// NOTE: Passing in space and getting queue from space rather than resolving the reference.
|
|
48
48
|
// This is because if the chat isn't in a space yet, the reference will not be resolvable.
|
|
49
49
|
const queue = space.queues.get(chat.queue.dxn);
|
|
50
|
-
const conversation = new AiConversation(
|
|
50
|
+
const conversation = new AiConversation({
|
|
51
|
+
queue: queue as Queue<any>,
|
|
52
|
+
registry: observableRegistry as Registry.Registry,
|
|
53
|
+
});
|
|
51
54
|
await conversation.open();
|
|
52
55
|
setConversation(conversation);
|
|
53
56
|
return () => {
|
|
@@ -7,7 +7,7 @@ import type * as Runtime from 'effect/Runtime';
|
|
|
7
7
|
import { useMemo } from 'react';
|
|
8
8
|
|
|
9
9
|
import { useCapability } from '@dxos/app-framework/react';
|
|
10
|
-
import { type
|
|
10
|
+
import { type Key } from '@dxos/echo';
|
|
11
11
|
import { TracingService } from '@dxos/functions';
|
|
12
12
|
import { TracingServiceExt } from '@dxos/functions-runtime';
|
|
13
13
|
import { AutomationCapabilities } from '@dxos/plugin-automation';
|
|
@@ -17,7 +17,7 @@ import { type AiChatServices } from '../processor';
|
|
|
17
17
|
import { type Assistant } from '../types';
|
|
18
18
|
|
|
19
19
|
export type UseChatServicesProps = {
|
|
20
|
-
|
|
20
|
+
id?: Key.SpaceId;
|
|
21
21
|
chat?: Assistant.Chat;
|
|
22
22
|
};
|
|
23
23
|
|
|
@@ -26,26 +26,22 @@ export type UseChatServicesProps = {
|
|
|
26
26
|
*/
|
|
27
27
|
// TODO(dmaretskyi): Better return type.
|
|
28
28
|
export const useChatServices = ({
|
|
29
|
-
|
|
29
|
+
id,
|
|
30
30
|
chat,
|
|
31
31
|
}: UseChatServicesProps): (() => Promise<Runtime.Runtime<AiChatServices>>) | undefined => {
|
|
32
32
|
const client = useClient();
|
|
33
|
-
|
|
33
|
+
id ??= client.spaces.default.id;
|
|
34
34
|
|
|
35
35
|
const runtimeResolver = useCapability(AutomationCapabilities.ComputeRuntime);
|
|
36
36
|
return useMemo(() => {
|
|
37
|
-
const runtime = runtimeResolver.getRuntime(
|
|
37
|
+
const runtime = runtimeResolver.getRuntime(id);
|
|
38
38
|
return () =>
|
|
39
39
|
runtime.runPromise(
|
|
40
|
-
Effect.
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
: TracingService.layerNoop,
|
|
46
|
-
),
|
|
47
|
-
);
|
|
48
|
-
}),
|
|
40
|
+
Effect.runtime<AiChatServices>().pipe(
|
|
41
|
+
Effect.provide(
|
|
42
|
+
chat?.traceQueue?.target ? TracingServiceExt.layerQueue(chat.traceQueue?.target) : TracingService.layerNoop,
|
|
43
|
+
),
|
|
44
|
+
),
|
|
49
45
|
);
|
|
50
|
-
}, [
|
|
46
|
+
}, [id, chat?.traceQueue?.target]);
|
|
51
47
|
};
|
|
@@ -6,31 +6,31 @@ import { Atom } from '@effect-atom/atom-react';
|
|
|
6
6
|
import * as Effect from 'effect/Effect';
|
|
7
7
|
import { useMemo } from 'react';
|
|
8
8
|
|
|
9
|
-
import {
|
|
10
|
-
import { useIntentDispatcher } from '@dxos/app-framework/react';
|
|
9
|
+
import { useOperationInvoker } from '@dxos/app-framework/react';
|
|
11
10
|
import { Filter, Obj, Query } from '@dxos/echo';
|
|
11
|
+
import { runAndForwardErrors } from '@dxos/effect';
|
|
12
12
|
import { invariant } from '@dxos/invariant';
|
|
13
13
|
import { useQuery } from '@dxos/react-client/echo';
|
|
14
14
|
import { MenuBuilder, useMenuActions } from '@dxos/react-ui-menu';
|
|
15
15
|
|
|
16
16
|
import { useChatContext } from '../components';
|
|
17
17
|
import { meta } from '../meta';
|
|
18
|
-
import { Assistant,
|
|
18
|
+
import { Assistant, AssistantOperation } from '../types';
|
|
19
19
|
|
|
20
20
|
export type ChatToolbarActionsProps = {
|
|
21
21
|
chat?: Assistant.Chat;
|
|
22
|
-
companionTo?: Obj.
|
|
22
|
+
companionTo?: Obj.Unknown;
|
|
23
23
|
};
|
|
24
24
|
|
|
25
25
|
export const useChatToolbarActions = ({ chat, companionTo }: ChatToolbarActionsProps) => {
|
|
26
|
-
const {
|
|
27
|
-
const {
|
|
26
|
+
const { invoke } = useOperationInvoker();
|
|
27
|
+
const { db } = useChatContext('useChatToolbarActions');
|
|
28
28
|
const query = companionTo
|
|
29
|
-
? Query.select(Filter.
|
|
29
|
+
? Query.select(Filter.id(companionTo.id)).targetOf(Assistant.CompanionTo).source()
|
|
30
30
|
: Query.select(Filter.nothing());
|
|
31
31
|
|
|
32
32
|
// TODO(wittjosiah): Query in react vs query in atom?
|
|
33
|
-
const chats = useQuery(
|
|
33
|
+
const chats = useQuery(db, query);
|
|
34
34
|
|
|
35
35
|
// Create stable reference for dependency array to avoid circular reference issues.
|
|
36
36
|
return useMenuActions(
|
|
@@ -46,14 +46,15 @@ export const useChatToolbarActions = ({ chat, companionTo }: ChatToolbarActionsP
|
|
|
46
46
|
label: ['new thread button', { ns: meta.id }],
|
|
47
47
|
icon: 'ph--plus--regular',
|
|
48
48
|
type: 'new',
|
|
49
|
+
disabled: !companionTo,
|
|
50
|
+
},
|
|
51
|
+
() => {
|
|
52
|
+
invariant(companionTo);
|
|
53
|
+
return invoke(AssistantOperation.SetCurrentChat, {
|
|
54
|
+
companionTo,
|
|
55
|
+
chat: undefined,
|
|
56
|
+
}).pipe(runAndForwardErrors);
|
|
49
57
|
},
|
|
50
|
-
() =>
|
|
51
|
-
dispatch(
|
|
52
|
-
createIntent(AssistantAction.SetCurrentChat, {
|
|
53
|
-
companionTo,
|
|
54
|
-
chat: undefined,
|
|
55
|
-
}),
|
|
56
|
-
).pipe(Effect.runPromise),
|
|
57
58
|
)
|
|
58
59
|
.action(
|
|
59
60
|
'rename',
|
|
@@ -66,8 +67,8 @@ export const useChatToolbarActions = ({ chat, companionTo }: ChatToolbarActionsP
|
|
|
66
67
|
() =>
|
|
67
68
|
Effect.gen(function* () {
|
|
68
69
|
invariant(chat);
|
|
69
|
-
yield*
|
|
70
|
-
}).pipe(
|
|
70
|
+
yield* invoke(AssistantOperation.UpdateChatName, { chat });
|
|
71
|
+
}).pipe(runAndForwardErrors),
|
|
71
72
|
)
|
|
72
73
|
.action(
|
|
73
74
|
'branch',
|
|
@@ -102,13 +103,11 @@ export const useChatToolbarActions = ({ chat, companionTo }: ChatToolbarActionsP
|
|
|
102
103
|
() =>
|
|
103
104
|
Effect.gen(function* () {
|
|
104
105
|
invariant(companionTo);
|
|
105
|
-
yield*
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
);
|
|
111
|
-
}).pipe(Effect.runPromise),
|
|
106
|
+
yield* invoke(AssistantOperation.SetCurrentChat, {
|
|
107
|
+
companionTo,
|
|
108
|
+
chat,
|
|
109
|
+
});
|
|
110
|
+
}).pipe(runAndForwardErrors),
|
|
112
111
|
);
|
|
113
112
|
});
|
|
114
113
|
},
|
|
@@ -117,6 +116,6 @@ export const useChatToolbarActions = ({ chat, companionTo }: ChatToolbarActionsP
|
|
|
117
116
|
|
|
118
117
|
return builder.build();
|
|
119
118
|
});
|
|
120
|
-
}, [chats.length,
|
|
119
|
+
}, [chats.length, db?.spaceId, companionTo?.id, chat?.id, invoke]),
|
|
121
120
|
);
|
|
122
121
|
};
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { type Registry, RegistryContext } from '@effect-atom/atom-react';
|
|
6
|
+
import { useContext, useState } from 'react';
|
|
6
7
|
|
|
7
8
|
import { AiContextBinder } from '@dxos/assistant';
|
|
8
9
|
import { type Queue } from '@dxos/react-client/echo';
|
|
@@ -10,6 +11,7 @@ import { useAsyncEffect } from '@dxos/react-ui';
|
|
|
10
11
|
|
|
11
12
|
// NOTE: This takes a queue rather than a chat because the chat may not be in a space yet.
|
|
12
13
|
export const useContextBinder = (queue: Queue | undefined): AiContextBinder | undefined => {
|
|
14
|
+
const registry = useContext(RegistryContext) as Registry.Registry;
|
|
13
15
|
const [binder, setBinder] = useState<AiContextBinder>();
|
|
14
16
|
|
|
15
17
|
useAsyncEffect(async () => {
|
|
@@ -17,7 +19,7 @@ export const useContextBinder = (queue: Queue | undefined): AiContextBinder | un
|
|
|
17
19
|
return;
|
|
18
20
|
}
|
|
19
21
|
|
|
20
|
-
const binder = new AiContextBinder(queue);
|
|
22
|
+
const binder = new AiContextBinder({ queue, registry });
|
|
21
23
|
await binder.open();
|
|
22
24
|
setBinder(binder);
|
|
23
25
|
|
|
@@ -5,54 +5,42 @@
|
|
|
5
5
|
import { useCallback } from 'react';
|
|
6
6
|
|
|
7
7
|
import { type AiContextBinder } from '@dxos/assistant';
|
|
8
|
-
import { type DXN, type Obj, Ref } from '@dxos/echo';
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
import { type DXN, type Database, type Obj, Ref } from '@dxos/echo';
|
|
9
|
+
|
|
10
|
+
export type UseContextObjectsProps = {
|
|
11
|
+
db?: Database.Database;
|
|
12
|
+
context?: AiContextBinder;
|
|
13
|
+
};
|
|
12
14
|
|
|
13
15
|
export type UseContextObjects = {
|
|
14
|
-
objects: Obj.
|
|
16
|
+
objects: Obj.Unknown[];
|
|
15
17
|
onUpdateObject: (dxn: DXN, checked: boolean) => Promise<void>;
|
|
16
18
|
};
|
|
17
19
|
|
|
18
20
|
/**
|
|
19
21
|
* Create reactive map of active object references (by DXN string).
|
|
20
22
|
*/
|
|
21
|
-
export const useContextObjects = ({
|
|
22
|
-
space,
|
|
23
|
-
context,
|
|
24
|
-
}: {
|
|
25
|
-
space?: Space;
|
|
26
|
-
context?: AiContextBinder;
|
|
27
|
-
}): UseContextObjects => {
|
|
28
|
-
const objects = context?.objects.value.map((ref) => ref.target).filter(isNonNullable) ?? [];
|
|
29
|
-
|
|
23
|
+
export const useContextObjects = ({ db, context }: UseContextObjectsProps): UseContextObjects => {
|
|
30
24
|
const handleUpdateObject = useCallback<UseContextObjects['onUpdateObject']>(
|
|
31
25
|
async (dxn: DXN, checked: boolean) => {
|
|
32
|
-
if (!
|
|
33
|
-
return;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
// Load the object by DXN/id from the current space.
|
|
37
|
-
const id = dxn.asEchoDXN();
|
|
38
|
-
const object = id && space.db.getObjectById(id.echoId);
|
|
39
|
-
if (!object) {
|
|
40
|
-
log.warn('Object not found', { dxn, id });
|
|
26
|
+
if (!db || !context) {
|
|
41
27
|
return;
|
|
42
28
|
}
|
|
43
29
|
|
|
30
|
+
// Load the object by DXN from the current space.
|
|
44
31
|
const ref = Ref.fromDXN(dxn);
|
|
32
|
+
await ref.load();
|
|
45
33
|
if (checked) {
|
|
46
34
|
await context.bind({ objects: [ref] });
|
|
47
35
|
} else {
|
|
48
36
|
await context.unbind({ objects: [ref] });
|
|
49
37
|
}
|
|
50
38
|
},
|
|
51
|
-
[
|
|
39
|
+
[db, context],
|
|
52
40
|
);
|
|
53
41
|
|
|
54
42
|
return {
|
|
55
|
-
objects,
|
|
43
|
+
objects: context?.getObjects() ?? [],
|
|
56
44
|
onUpdateObject: handleUpdateObject,
|
|
57
45
|
};
|
|
58
46
|
};
|
|
@@ -5,24 +5,23 @@
|
|
|
5
5
|
import * as Option from 'effect/Option';
|
|
6
6
|
import { useEffect, useState } from 'react';
|
|
7
7
|
|
|
8
|
-
import { type Type } from '@dxos/echo';
|
|
8
|
+
import { type Database, type Type } from '@dxos/echo';
|
|
9
9
|
import { EntityKind, SystemTypeAnnotation, getTypeAnnotation } from '@dxos/echo/internal';
|
|
10
|
-
import { type Space } from '@dxos/react-client/echo';
|
|
11
10
|
|
|
12
11
|
// TODO(burdon): Pass in filter.
|
|
13
12
|
// TODO(wittjosiah): Factor out.
|
|
14
|
-
export const useFilteredTypes = (
|
|
13
|
+
export const useFilteredTypes = (db?: Database.Database): Type.Entity.Any[] => {
|
|
15
14
|
const [types, setTypes] = useState<Type.Entity.Any[]>([]);
|
|
16
15
|
useEffect(() => {
|
|
17
|
-
if (!
|
|
16
|
+
if (!db) {
|
|
18
17
|
return;
|
|
19
18
|
}
|
|
20
19
|
|
|
21
|
-
return
|
|
20
|
+
return db.schemaRegistry.query({ location: ['database', 'runtime'] }).subscribe(
|
|
22
21
|
(query) => {
|
|
23
22
|
const types = Array.from(
|
|
24
23
|
new Set(
|
|
25
|
-
|
|
24
|
+
query.results
|
|
26
25
|
.filter((schema) => getTypeAnnotation(schema)?.kind !== EntityKind.Relation)
|
|
27
26
|
.filter((schema) => SystemTypeAnnotation.get(schema).pipe(Option.getOrElse(() => false))),
|
|
28
27
|
),
|
|
@@ -32,7 +31,7 @@ export const useFilteredTypes = (space?: Space): Type.Entity.Any[] => {
|
|
|
32
31
|
},
|
|
33
32
|
{ fire: true },
|
|
34
33
|
);
|
|
35
|
-
}, [
|
|
34
|
+
}, [db]);
|
|
36
35
|
|
|
37
36
|
return types;
|
|
38
37
|
};
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import { useMemo } from 'react';
|
|
6
6
|
|
|
7
|
-
import {
|
|
7
|
+
import { Common } from '@dxos/app-framework';
|
|
8
8
|
import { useCapabilities } from '@dxos/app-framework/react';
|
|
9
9
|
import { type Space } from '@dxos/client/echo';
|
|
10
10
|
import { Filter, Obj } from '@dxos/echo';
|
|
@@ -14,7 +14,7 @@ import { type ReferencesProvider } from '@dxos/react-ui-chat';
|
|
|
14
14
|
* Resolve references to objects in the space.
|
|
15
15
|
*/
|
|
16
16
|
export const useReferencesProvider = (space?: Space): ReferencesProvider | undefined => {
|
|
17
|
-
const blueprints = useCapabilities(
|
|
17
|
+
const blueprints = useCapabilities(Common.Capability.BlueprintDefinition);
|
|
18
18
|
|
|
19
19
|
return useMemo<ReferencesProvider | undefined>((): ReferencesProvider | undefined => {
|
|
20
20
|
if (!space) {
|
|
@@ -25,11 +25,11 @@ export const useReferencesProvider = (space?: Space): ReferencesProvider | undef
|
|
|
25
25
|
getReferences: async ({ query }) => {
|
|
26
26
|
// TODO(burdon): Previously we filtered by types declared by the artifact definitions.
|
|
27
27
|
// const schemas = blueprints.map((blueprint) => blueprint.schema).flat();
|
|
28
|
-
// const
|
|
28
|
+
// const objects = await space.db
|
|
29
29
|
// .query(Filter.or(...schemas.map((schema) => Filter.type(schema as Type.Schema))))
|
|
30
30
|
// .run();
|
|
31
31
|
|
|
32
|
-
const
|
|
32
|
+
const objects = await space.db.query(Filter.everything()).run();
|
|
33
33
|
|
|
34
34
|
return (
|
|
35
35
|
objects
|
|
@@ -40,7 +40,7 @@ export const useReferencesProvider = (space?: Space): ReferencesProvider | undef
|
|
|
40
40
|
// })
|
|
41
41
|
.filter((object) => stringMatch(query, Obj.getLabel(object as any) ?? ''))
|
|
42
42
|
// TODO(dmaretskyi): `Type.getDXN` (at the point of writing) didn't work here as it was schema-only.
|
|
43
|
-
.filter((object) => !!Obj.getDXN(object as Obj.
|
|
43
|
+
.filter((object) => !!Obj.getDXN(object as Obj.Unknown))
|
|
44
44
|
.map((object) => ({
|
|
45
45
|
uri: Obj.getDXN(object as any).toString(),
|
|
46
46
|
label: Obj.getLabel(object as any) ?? '',
|
|
@@ -48,7 +48,7 @@ export const useReferencesProvider = (space?: Space): ReferencesProvider | undef
|
|
|
48
48
|
);
|
|
49
49
|
},
|
|
50
50
|
resolveReference: async ({ uri }) => {
|
|
51
|
-
const object = await space.db.query(Filter.
|
|
51
|
+
const object = await space.db.query(Filter.id(uri)).first();
|
|
52
52
|
return { uri, label: Obj.getLabel(object) ?? '' };
|
|
53
53
|
},
|
|
54
54
|
} satisfies ReferencesProvider;
|
package/src/index.ts
CHANGED
package/src/meta.ts
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { type
|
|
5
|
+
import { type Plugin } from '@dxos/app-framework';
|
|
6
6
|
import { trim } from '@dxos/util';
|
|
7
7
|
|
|
8
|
-
export const meta:
|
|
8
|
+
export const meta: Plugin.Meta = {
|
|
9
9
|
id: 'dxos.org/plugin/assistant',
|
|
10
10
|
name: 'Assistant',
|
|
11
11
|
description: trim`
|
|
@@ -12,7 +12,8 @@ import * as Schema from 'effect/Schema';
|
|
|
12
12
|
import { AiService } from '@dxos/ai';
|
|
13
13
|
import { AiServiceTestingPreset } from '@dxos/ai/testing';
|
|
14
14
|
import { AiConversation, makeToolExecutionServiceFromFunctions, makeToolResolverFromFunctions } from '@dxos/assistant';
|
|
15
|
-
import {
|
|
15
|
+
import { acquireReleaseResource } from '@dxos/effect';
|
|
16
|
+
import { TestHelpers } from '@dxos/effect/testing';
|
|
16
17
|
import { CredentialsService, QueueService, TracingService } from '@dxos/functions';
|
|
17
18
|
import { FunctionInvocationServiceLayerTestMocked, TestDatabaseLayer } from '@dxos/functions-runtime/testing';
|
|
18
19
|
import { type Message } from '@dxos/types';
|
|
@@ -57,7 +58,7 @@ describe('Chat processor', () => {
|
|
|
57
58
|
function* ({ expect }) {
|
|
58
59
|
const services = yield* Effect.runtime<AiChatServices>();
|
|
59
60
|
const queue = yield* QueueService.createQueue<Message.Message>();
|
|
60
|
-
const conversation = yield* acquireReleaseResource(() => new AiConversation(queue));
|
|
61
|
+
const conversation = yield* acquireReleaseResource(() => new AiConversation({ queue }));
|
|
61
62
|
const processor = new AiChatProcessor(conversation, async () => services);
|
|
62
63
|
const result = yield* Effect.promise(() => processor.request({ message: 'Hello' }));
|
|
63
64
|
void processor.cancel();
|
|
@@ -20,17 +20,17 @@ import {
|
|
|
20
20
|
} from '@dxos/ai';
|
|
21
21
|
import {
|
|
22
22
|
type AiConversation,
|
|
23
|
-
type
|
|
23
|
+
type AiConversationRunProps,
|
|
24
24
|
ArtifactDiffResolver,
|
|
25
25
|
GenerationObserver,
|
|
26
26
|
createSystemPrompt,
|
|
27
27
|
} from '@dxos/assistant';
|
|
28
28
|
import { type Blueprint } from '@dxos/blueprints';
|
|
29
29
|
import { Obj } from '@dxos/echo';
|
|
30
|
-
import {
|
|
30
|
+
import { type Database } from '@dxos/echo';
|
|
31
|
+
import { runAndForwardErrors, throwCause } from '@dxos/effect';
|
|
31
32
|
import {
|
|
32
33
|
type CredentialsService,
|
|
33
|
-
type DatabaseService,
|
|
34
34
|
type FunctionInvocationService,
|
|
35
35
|
type QueueService,
|
|
36
36
|
type TracingService,
|
|
@@ -44,7 +44,7 @@ import { updateName } from './update-name';
|
|
|
44
44
|
|
|
45
45
|
export type AiChatServices =
|
|
46
46
|
| CredentialsService
|
|
47
|
-
|
|
|
47
|
+
| Database.Service
|
|
48
48
|
| QueueService
|
|
49
49
|
| FunctionInvocationService
|
|
50
50
|
| AiService.AiService
|
|
@@ -58,7 +58,7 @@ export type AiChatProcessorOptions = {
|
|
|
58
58
|
blueprintRegistry?: Blueprint.Registry;
|
|
59
59
|
observableRegistry?: Registry.Registry;
|
|
60
60
|
extensions?: ToolContextExtensions;
|
|
61
|
-
} & Pick<
|
|
61
|
+
} & Pick<AiConversationRunProps, 'system'>;
|
|
62
62
|
|
|
63
63
|
const defaultOptions: Partial<AiChatProcessorOptions> = {
|
|
64
64
|
model: DEFAULT_EDGE_MODEL,
|
|
@@ -82,18 +82,18 @@ export class AiChatProcessor {
|
|
|
82
82
|
/** External observer. */
|
|
83
83
|
private readonly _observer: GenerationObserver;
|
|
84
84
|
|
|
85
|
-
/** Currently active request fiber. */
|
|
86
|
-
private _fiber: Fiber.Fiber<void, any> | undefined;
|
|
87
|
-
|
|
88
|
-
/** Last request (for retries). */
|
|
89
|
-
private _lastRequest: AiRequest | undefined;
|
|
90
|
-
|
|
91
85
|
/** Pending messages (incl. the current user request). */
|
|
92
86
|
private readonly _pending = Atom.make<Message.Message[]>([]);
|
|
93
87
|
|
|
94
88
|
/** Currently streaming message (from the AI service). */
|
|
95
89
|
private readonly _streaming = Atom.make<Option.Option<Message.Message>>(Option.none());
|
|
96
90
|
|
|
91
|
+
/** Currently active request fiber. */
|
|
92
|
+
private _fiber: Fiber.Fiber<void, any> | undefined;
|
|
93
|
+
|
|
94
|
+
/** Last request (for retries). */
|
|
95
|
+
private _lastRequest: AiRequest | undefined;
|
|
96
|
+
|
|
97
97
|
/** Streaming state. */
|
|
98
98
|
public readonly streaming = Atom.make<boolean>((get) => Option.isSome(get(this._streaming)));
|
|
99
99
|
|
|
@@ -144,34 +144,32 @@ export class AiChatProcessor {
|
|
|
144
144
|
/**
|
|
145
145
|
* Initiates a new request.
|
|
146
146
|
*/
|
|
147
|
-
async request(
|
|
147
|
+
async request(requestProp: AiRequest): Promise<void> {
|
|
148
148
|
if (this._fiber) {
|
|
149
149
|
await this.cancel();
|
|
150
150
|
}
|
|
151
151
|
|
|
152
152
|
try {
|
|
153
|
-
this._lastRequest =
|
|
153
|
+
this._lastRequest = requestProp;
|
|
154
154
|
this._registry.set(this.error, Option.none());
|
|
155
155
|
this._registry.set(this.active, true);
|
|
156
156
|
|
|
157
|
+
const services = await this._services();
|
|
158
|
+
|
|
157
159
|
// Create request.
|
|
158
160
|
const request = this._conversation.createRequest({
|
|
159
161
|
system: this._options.system,
|
|
160
|
-
prompt:
|
|
162
|
+
prompt: requestProp.message,
|
|
161
163
|
observer: this._observer,
|
|
162
164
|
});
|
|
163
165
|
|
|
164
|
-
const runtime = await this._services();
|
|
165
|
-
|
|
166
166
|
// Create fiber.
|
|
167
167
|
this._fiber = request.pipe(
|
|
168
168
|
Effect.provide(AiService.model(this._options.model ?? DEFAULT_EDGE_MODEL)),
|
|
169
|
-
|
|
170
169
|
// TODO(dmaretskyi): Move ArtifactDiffResolver upstream.
|
|
171
170
|
Effect.provideService(ArtifactDiffResolver, this._artifactDiffResolver),
|
|
172
|
-
|
|
173
171
|
Effect.asVoid,
|
|
174
|
-
Runtime.runFork(
|
|
172
|
+
Runtime.runFork(services), // Runs in the background.
|
|
175
173
|
);
|
|
176
174
|
|
|
177
175
|
// Execute request.
|
|
@@ -183,12 +181,12 @@ export class AiChatProcessor {
|
|
|
183
181
|
this._registry.set(this.error, Option.none());
|
|
184
182
|
this._lastRequest = undefined;
|
|
185
183
|
this._fiber = undefined;
|
|
186
|
-
} catch (
|
|
187
|
-
log.error('request failed', { error });
|
|
188
|
-
this._registry.set(this.error, Option.some(new Error('AI service error', { cause:
|
|
184
|
+
} catch (err) {
|
|
185
|
+
log.error('request failed', { error: err });
|
|
186
|
+
this._registry.set(this.error, Option.some(new Error('AI service error', { cause: err })));
|
|
189
187
|
} finally {
|
|
190
|
-
this._fiber = undefined;
|
|
191
188
|
this._registry.set(this.active, false);
|
|
189
|
+
this._fiber = undefined;
|
|
192
190
|
}
|
|
193
191
|
}
|
|
194
192
|
|
|
@@ -196,7 +194,7 @@ export class AiChatProcessor {
|
|
|
196
194
|
* Cancels the current request.
|
|
197
195
|
*/
|
|
198
196
|
async cancel(): Promise<void> {
|
|
199
|
-
await
|
|
197
|
+
await runAndForwardErrors(
|
|
200
198
|
Effect.gen(this, function* () {
|
|
201
199
|
if (this._fiber) {
|
|
202
200
|
yield* this._fiber.pipe(Fiber.interrupt);
|
|
@@ -233,7 +231,7 @@ export class AiChatProcessor {
|
|
|
233
231
|
// artifacts.map(async (artifact) => {
|
|
234
232
|
// const {
|
|
235
233
|
// objects: [object],
|
|
236
|
-
// } = await space.db.query(Filter.
|
|
234
|
+
// } = await space.db.query(Filter.id(artifact.id)).run();
|
|
237
235
|
// if (!object) {
|
|
238
236
|
// return;
|
|
239
237
|
// }
|