@yeaft/webchat-agent 1.0.562 → 1.0.564
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":"1.0.
|
|
1
|
+
{"version":"1.0.564"}
|
|
@@ -8337,7 +8337,7 @@ ${String(e||"").trim()}
|
|
|
8337
8337
|
@navigate="loadFolderPickerDir" @edit-path="folderPickerEditPath"
|
|
8338
8338
|
@confirm="confirmFolderPicker" @close="closeFolderPicker" />
|
|
8339
8339
|
</Teleport>
|
|
8340
|
-
`}});var Zv,Jv=V(()=>{io();nl();Zv={name:"PluginCenterPage",emits:["close"],data(){return{saving:!1,error:"",selection:null,savedSelection:null,searchQuery:"",activeCategory:"all",configLoading:!1,configLoadError:"",configLoadedAgentId:null,configLoadGeneration:0,refreshGeneration:0,saveGeneration:0,skillMutationLoading:!1,skillMutationError:"",skillScope:"user",showSkillForm:!1,skillForm:{name:"",description:"",trigger:"",content:""}}},computed:{store(){try{return window.Pinia?.useChatStore?.()||null}catch{return null}},agents(){return(this.store?.agents||[]).filter(e=>e?.online)},agentId(){return this.store?.pluginCenterAgentId||this.store?.currentAgent||null},selectedAgent(){return this.agents.find(e=>e.id===this.agentId)||null},agentSupportsPlugins(){return Gn(this.selectedAgent)},agentSupportsManagedSkills(){return oo(this.selectedAgent)},skillManagementUnavailableMessage(){return this.selectedAgent?.capabilityMetadataProvided===!0?this.$t("yeaft.plugins.skillManagementUpgradeRequired"):this.$t("yeaft.plugins.skillManagementVersionUnknown")},activeSession(){return this.store?.activePluginSession?.()||{sessionId:"",agentId:"",workDir:""}},projectSkillAvailable(){return this.activeSession.agentId===this.agentId&&!!this.activeSession.sessionId&&!!this.activeSession.workDir},configRecord(){return this.store?.pluginConfigByAgent?.[this.agentId]||null},catalogWorkDir(){return this.projectSkillAvailable?this.activeSession.workDir:""},catalogRecord(){let e=this.store?.pluginCatalogKey?.(this.agentId,this.catalogWorkDir);return e&&this.store?.pluginCatalogByKey?.[e]||null},catalog(){return this.catalogRecord?.catalog||{tools:[],skills:[],skillSources:[],mcpServers:[]}},managedSkillSources(){return Array.isArray(this.catalog.skillSources)?this.catalog.skillSources.filter(e=>e?.managed):[]},loading(){return this.agentSupportsPlugins&&(!this.catalogRecord||!!this.catalogRecord.loading)},configReady(){return!!this.agentId&&this.agentSupportsPlugins&&this.configLoadedAgentId===this.agentId&&!this.configLoading&&!this.configLoadError},hasCatalog(){return this.catalog.tools.length+this.catalog.skills.length+this.catalog.mcpServers.length>0},hasExplicitSelection(){return!!this.selection&&Object.keys(this.selection).length>0},enabledCount(){return this.hasExplicitSelection?["tools","skills","mcpServers"].reduce((e,t)=>e+(Array.isArray(this.selection[t])?this.selection[t].length:this.catalog[t].length),0):this.catalog.tools.length+this.catalog.skills.length+this.catalog.mcpServers.length},totalCount(){return this.catalog.tools.length+this.catalog.skills.length+this.catalog.mcpServers.length},categoryDefinitions(){return[{id:"all",label:this.$t("yeaft.plugins.all"),count:this.totalCount},{id:"tools",label:this.$t("yeaft.plugins.tools"),count:this.catalog.tools.length},{id:"skills",label:this.$t("yeaft.plugins.skills"),count:this.catalog.skills.length},{id:"mcpServers",label:this.$t("yeaft.plugins.mcpServers"),count:this.catalog.mcpServers.length}]},normalizedSearchQuery(){return this.searchQuery.trim().toLocaleLowerCase()},filteredCatalog(){let e=t=>{if(!this.normalizedSearchQuery)return!0;let s=[t?.id,t?.name,t?.label,t?.description];return Number.isFinite(t?.toolCount)&&s.push(String(t.toolCount)),s.filter(Boolean).some(n=>String(n).toLocaleLowerCase().includes(this.normalizedSearchQuery))};return{tools:this.catalog.tools.filter(e),skills:this.catalog.skills.filter(e),mcpServers:this.catalog.mcpServers.filter(e)}},visibleCategories(){return["tools","skills","mcpServers"].filter(e=>(this.activeCategory==="all"||this.activeCategory===e)&&this.filteredCatalog[e].length>0)},hasSearchResults(){return this.visibleCategories.length>0},visibleResultCount(){return this.visibleCategories.reduce((e,t)=>e+this.filteredCatalog[t].length,0)},isDirty(){return JSON.stringify(this.normalizedSelection(this.selection))!==JSON.stringify(this.normalizedSelection(this.savedSelection))},statusSummary(){return this.hasExplicitSelection?this.$t("yeaft.plugins.selectedSummary",{count:this.enabledCount}):this.$t("yeaft.plugins.allAvailable")}},watch:{catalogWorkDir(e,t){e===t||!this.agentId||!this.agentSupportsPlugins||this.store?.loadPluginCatalog?.(this.agentId,e).catch(()=>{})},agentId:{immediate:!0,handler(e){if(++this.configLoadGeneration,++this.refreshGeneration,++this.saveGeneration,this.saving=!1,this.error="",!e){this.selection=null,this.savedSelection=null,this.searchQuery="",this.activeCategory="all",this.configLoading=!1,this.configLoadError="",this.configLoadedAgentId=null;return}if(this.searchQuery="",this.activeCategory="all",!this.agentSupportsPlugins){this.selection=null,this.savedSelection=null,this.configLoading=!1,this.configLoadError=this.$t("yeaft.plugins.upgradeRequired"),this.configLoadedAgentId=null;return}this.loadConfig(e),this.store?.loadPluginCatalog?.(e,this.catalogWorkDir).catch(()=>{})}}},methods:{loadConfig(e=this.agentId,t=++this.configLoadGeneration){if(!e)return;if(++this.refreshGeneration,++this.saveGeneration,this.saving=!1,this.selection=null,this.savedSelection=null,this.configLoadedAgentId=null,this.configLoading=!1,this.configLoadError="",!this.agentSupportsPlugins){this.configLoadError=this.$t("yeaft.plugins.upgradeRequired");return}if(this.configRecord?.loaded&&!this.configRecord?.error){this.selection=this.copySelection(this.configRecord.plugins),this.savedSelection=this.copySelection(this.configRecord.plugins),this.configLoadedAgentId=e;return}let s=this.store?.loadPluginConfig?.(e);this.configLoading=!0,Promise.resolve(s).then(n=>{if(!(t!==this.configLoadGeneration||e!==this.agentId)){if(n?.error){this.configLoadError=n.error;return}this.selection=this.copySelection(n?.plugins),this.savedSelection=this.copySelection(n?.plugins),this.configLoadedAgentId=e}}).catch(n=>{t!==this.configLoadGeneration||e!==this.agentId||(this.configLoadError=n?.message||String(n))}).finally(()=>{t===this.configLoadGeneration&&e===this.agentId&&(this.configLoading=!1)})},copySelection(e={}){let t={};for(let s of["tools","skills","mcpServers"])Array.isArray(e?.[s])&&(t[s]=[...e[s]]);return t},normalizedSelection(e={}){let t={};for(let s of["tools","skills","mcpServers"])Array.isArray(e?.[s])&&(t[s]=[...e[s]].sort());return t},pluginName(e,t){return e==="skills"&&(t?.name||t?.label)||t?.id},enabled(e,t){let s=this.pluginName(e,t);return!this.selection||!Array.isArray(this.selection[e])?!0:this.selection[e].includes(s)},toggle(e,t,s){if(!this.configReady||this.saving)return;let n=this.pluginName(e,t);if(!n)return;let r=this.selection||{},i=new Set(Array.isArray(r[e])?r[e]:this.catalog[e].map(o=>this.pluginName(e,o)));s?i.add(n):i.delete(n),this.selection={...r,[e]:[...i]}},useAll(){!this.configReady||this.saving||(this.selection={},this.error="")},async refresh(){if(!this.agentId||!this.agentSupportsPlugins)return;let e=this.agentId,t=this.configLoadGeneration,s=++this.refreshGeneration,n=()=>e===this.agentId&&t===this.configLoadGeneration&&s===this.refreshGeneration;this.error="";try{let r=await this.store?.loadPluginCatalog?.(e,this.catalogWorkDir);n()&&r?.error&&(this.error=r.error)}catch(r){n()&&(this.error=r?.message||String(r))}},async save(){if(this.saving||!this.agentId||!this.agentSupportsPlugins||!this.configReady)return;let e=this.agentId,t=this.configLoadGeneration,s=++this.saveGeneration,n=this.copySelection(this.selection||{}),r=()=>e===this.agentId&&t===this.configLoadGeneration&&s===this.saveGeneration;this.saving=!0,this.error="";try{let i=await this.store?.savePluginConfig?.(n,e);if(!r())return;if(i?.error)this.error=i.error;else{let o=this.copySelection(i?.plugins??n);this.selection=o,this.savedSelection=this.copySelection(o)}}catch(i){r()&&(this.error=i?.message||String(i))}finally{r()&&(this.saving=!1)}},resetSkillForm(){this.skillForm.name="",this.skillForm.description="",this.skillForm.trigger="",this.skillForm.content="",this.skillMutationError=""},async refreshCatalogForSkillScope(){await this.store?.loadPluginCatalog?.(this.agentId,this.catalogWorkDir)},async createSkill(){if(!(this.skillMutationLoading||!this.agentSupportsManagedSkills)){if(this.skillScope==="project"&&!this.projectSkillAvailable){this.skillMutationError=this.$t("yeaft.plugins.projectScopeUnavailable");return}this.skillMutationLoading=!0,this.skillMutationError="";try{let e=await this.store?.mutateManagedSkill?.({action:"create",scope:this.skillScope,skill:{...this.skillForm},sessionId:this.skillScope==="project"?this.activeSession.sessionId:""},this.agentId);if(e?.error){this.skillMutationError=e.error;return}let t=typeof e?.result?.name=="string"?e.result.name.trim():"";t&&Array.isArray(this.selection?.skills)&&(this.selection={...this.selection,skills:[...new Set([...this.selection.skills,t])]}),this.resetSkillForm(),this.showSkillForm=!1,await this.refreshCatalogForSkillScope()}catch(e){this.skillMutationError=e?.message||String(e)}finally{this.skillMutationLoading=!1}}},async removeSkill(e){if(!e?.managed||this.skillMutationLoading||!this.agentSupportsManagedSkills)return;let t=e.tier==="project"?"project":"user";if(t==="project"&&!this.projectSkillAvailable){this.skillMutationError=this.$t("yeaft.plugins.projectScopeUnavailable");return}if(confirm(this.$t("yeaft.plugins.confirmRemoveSkill",{name:e.label}))){this.skillMutationLoading=!0,this.skillMutationError="";try{let s=await this.store?.mutateManagedSkill?.({action:"remove",scope:t,name:e.name||e.label,sessionId:t==="project"?this.activeSession.sessionId:""},this.agentId);s?.error?this.skillMutationError=s.error:await this.refreshCatalogForSkillScope()}catch(s){this.skillMutationError=s?.message||String(s)}finally{this.skillMutationLoading=!1}}},selectAgent(e){!e||e===this.agentId||(this.store.pluginCenterAgentId=e)}},template:`
|
|
8340
|
+
`}});var Zv,Jv=V(()=>{io();nl();Zv={name:"PluginCenterPage",emits:["close"],data(){return{saving:!1,error:"",selection:null,savedSelection:null,searchQuery:"",activeCategory:"all",configLoading:!1,configLoadError:"",configLoadedAgentId:null,configLoadGeneration:0,refreshGeneration:0,saveGeneration:0,skillMutationLoading:!1,skillMutationError:"",skillScope:"user",showSkillForm:!1,skillForm:{name:"",description:"",trigger:"",content:""}}},computed:{store(){try{return window.Pinia?.useChatStore?.()||null}catch{return null}},agents(){return(this.store?.agents||[]).filter(e=>e?.online)},agentId(){return this.store?.pluginCenterAgentId||this.store?.currentAgent||null},selectedAgent(){return this.agents.find(e=>e.id===this.agentId)||null},agentSupportsPlugins(){return Gn(this.selectedAgent)},agentSupportsManagedSkills(){return oo(this.selectedAgent)},skillManagementUnavailableMessage(){return this.selectedAgent?.capabilityMetadataProvided===!0?this.$t("yeaft.plugins.skillManagementUpgradeRequired"):this.$t("yeaft.plugins.skillManagementVersionUnknown")},activeSession(){return this.store?.activePluginSession?.()||{sessionId:"",agentId:"",workDir:""}},projectSkillAvailable(){return this.activeSession.agentId===this.agentId&&!!this.activeSession.sessionId&&!!this.activeSession.workDir},configRecord(){return this.store?.pluginConfigByAgent?.[this.agentId]||null},catalogWorkDir(){return this.projectSkillAvailable?this.activeSession.workDir:""},catalogRecord(){let e=this.store?.pluginCatalogKey?.(this.agentId,this.catalogWorkDir);return e&&this.store?.pluginCatalogByKey?.[e]||null},catalog(){return this.catalogRecord?.catalog||{tools:[],skills:[],skillSources:[],mcpServers:[]}},managedSkillSources(){return Array.isArray(this.catalog.skillSources)?this.catalog.skillSources.filter(e=>e?.managed):[]},loading(){return this.agentSupportsPlugins&&(!this.catalogRecord||!!this.catalogRecord.loading)},configReady(){return!!this.agentId&&this.agentSupportsPlugins&&this.configLoadedAgentId===this.agentId&&!this.configLoading&&!this.configLoadError},hasCatalog(){return this.catalog.tools.length+this.catalog.skills.length+this.catalog.mcpServers.length>0},hasExplicitSelection(){return!!this.selection&&Object.keys(this.selection).length>0},enabledCount(){return this.hasExplicitSelection?["tools","skills","mcpServers"].reduce((e,t)=>e+(Array.isArray(this.selection[t])?this.selection[t].length:this.catalog[t].length),0):this.catalog.tools.length+this.catalog.skills.length+this.catalog.mcpServers.length},totalCount(){return this.catalog.tools.length+this.catalog.skills.length+this.catalog.mcpServers.length},categoryDefinitions(){return[{id:"all",label:this.$t("yeaft.plugins.all"),count:this.totalCount},{id:"tools",label:this.$t("yeaft.plugins.tools"),count:this.catalog.tools.length},{id:"skills",label:this.$t("yeaft.plugins.skills"),count:this.catalog.skills.length},{id:"mcpServers",label:this.$t("yeaft.plugins.mcpServers"),count:this.catalog.mcpServers.length}]},normalizedSearchQuery(){return this.searchQuery.trim().toLocaleLowerCase()},filteredCatalog(){let e=t=>{if(!this.normalizedSearchQuery)return!0;let s=[t?.id,t?.name,t?.label,t?.description];return Number.isFinite(t?.toolCount)&&s.push(String(t.toolCount)),s.filter(Boolean).some(n=>String(n).toLocaleLowerCase().includes(this.normalizedSearchQuery))};return{tools:this.catalog.tools.filter(e),skills:this.catalog.skills.filter(e),mcpServers:this.catalog.mcpServers.filter(e)}},visibleCategories(){return["tools","skills","mcpServers"].filter(e=>(this.activeCategory==="all"||this.activeCategory===e)&&this.filteredCatalog[e].length>0)},hasSearchResults(){return this.visibleCategories.length>0},visibleResultCount(){return this.visibleCategories.reduce((e,t)=>e+this.filteredCatalog[t].length,0)},isDirty(){return JSON.stringify(this.normalizedSelection(this.selection))!==JSON.stringify(this.normalizedSelection(this.savedSelection))},statusSummary(){if(!this.agentId)return this.$t("yeaft.plugins.noAgent");if(!this.agentSupportsPlugins)return this.$t("yeaft.plugins.upgradeRequired");if(this.loading||this.configLoading)return this.$t("yeaft.plugins.loading");let e=this.catalogRecord?.error||this.configLoadError;return e?this.$t("yeaft.plugins.loadError",{error:e}):this.hasCatalog?this.hasExplicitSelection?this.$t("yeaft.plugins.selectedSummary",{count:this.enabledCount}):this.$t("yeaft.plugins.allAvailable"):this.$t("yeaft.plugins.empty")}},watch:{catalogWorkDir(e,t){e===t||!this.agentId||!this.agentSupportsPlugins||this.store?.loadPluginCatalog?.(this.agentId,e).catch(()=>{})},agentId:{immediate:!0,handler(e){if(++this.configLoadGeneration,++this.refreshGeneration,++this.saveGeneration,this.saving=!1,this.error="",!e){this.selection=null,this.savedSelection=null,this.searchQuery="",this.activeCategory="all",this.configLoading=!1,this.configLoadError="",this.configLoadedAgentId=null;return}if(this.searchQuery="",this.activeCategory="all",!this.agentSupportsPlugins){this.selection=null,this.savedSelection=null,this.configLoading=!1,this.configLoadError=this.$t("yeaft.plugins.upgradeRequired"),this.configLoadedAgentId=null;return}this.loadConfig(e),this.store?.loadPluginCatalog?.(e,this.catalogWorkDir).catch(()=>{})}}},methods:{loadConfig(e=this.agentId,t=++this.configLoadGeneration){if(!e)return;if(++this.refreshGeneration,++this.saveGeneration,this.saving=!1,this.selection=null,this.savedSelection=null,this.configLoadedAgentId=null,this.configLoading=!1,this.configLoadError="",!this.agentSupportsPlugins){this.configLoadError=this.$t("yeaft.plugins.upgradeRequired");return}if(this.configRecord?.loaded&&!this.configRecord?.error){this.selection=this.copySelection(this.configRecord.plugins),this.savedSelection=this.copySelection(this.configRecord.plugins),this.configLoadedAgentId=e;return}let s=this.store?.loadPluginConfig?.(e);this.configLoading=!0,Promise.resolve(s).then(n=>{if(!(t!==this.configLoadGeneration||e!==this.agentId)){if(n?.error){this.configLoadError=n.error;return}this.selection=this.copySelection(n?.plugins),this.savedSelection=this.copySelection(n?.plugins),this.configLoadedAgentId=e}}).catch(n=>{t!==this.configLoadGeneration||e!==this.agentId||(this.configLoadError=n?.message||String(n))}).finally(()=>{t===this.configLoadGeneration&&e===this.agentId&&(this.configLoading=!1)})},copySelection(e={}){let t={};for(let s of["tools","skills","mcpServers"])Array.isArray(e?.[s])&&(t[s]=[...e[s]]);return t},normalizedSelection(e={}){let t={};for(let s of["tools","skills","mcpServers"])Array.isArray(e?.[s])&&(t[s]=[...e[s]].sort());return t},pluginName(e,t){return e==="skills"&&(t?.name||t?.label)||t?.id},enabled(e,t){let s=this.pluginName(e,t);return!this.selection||!Array.isArray(this.selection[e])?!0:this.selection[e].includes(s)},toggle(e,t,s){if(!this.configReady||this.saving)return;let n=this.pluginName(e,t);if(!n)return;let r=this.selection||{},i=new Set(Array.isArray(r[e])?r[e]:this.catalog[e].map(o=>this.pluginName(e,o)));s?i.add(n):i.delete(n),this.selection={...r,[e]:[...i]}},useAll(){!this.configReady||this.saving||(this.selection={},this.error="")},async refresh(){if(!this.agentId||!this.agentSupportsPlugins)return;let e=this.agentId,t=this.configLoadGeneration,s=++this.refreshGeneration,n=()=>e===this.agentId&&t===this.configLoadGeneration&&s===this.refreshGeneration;this.error="";try{let r=await this.store?.loadPluginCatalog?.(e,this.catalogWorkDir);n()&&r?.error&&(this.error=r.error)}catch(r){n()&&(this.error=r?.message||String(r))}},async save(){if(this.saving||!this.agentId||!this.agentSupportsPlugins||!this.configReady)return;let e=this.agentId,t=this.configLoadGeneration,s=++this.saveGeneration,n=this.copySelection(this.selection||{}),r=()=>e===this.agentId&&t===this.configLoadGeneration&&s===this.saveGeneration;this.saving=!0,this.error="";try{let i=await this.store?.savePluginConfig?.(n,e);if(!r())return;if(i?.error)this.error=i.error;else{let o=this.copySelection(i?.plugins??n);this.selection=o,this.savedSelection=this.copySelection(o)}}catch(i){r()&&(this.error=i?.message||String(i))}finally{r()&&(this.saving=!1)}},resetSkillForm(){this.skillForm.name="",this.skillForm.description="",this.skillForm.trigger="",this.skillForm.content="",this.skillMutationError=""},async refreshCatalogForSkillScope(){await this.store?.loadPluginCatalog?.(this.agentId,this.catalogWorkDir)},async createSkill(){if(!(this.skillMutationLoading||!this.agentSupportsManagedSkills)){if(this.skillScope==="project"&&!this.projectSkillAvailable){this.skillMutationError=this.$t("yeaft.plugins.projectScopeUnavailable");return}this.skillMutationLoading=!0,this.skillMutationError="";try{let e=await this.store?.mutateManagedSkill?.({action:"create",scope:this.skillScope,skill:{...this.skillForm},sessionId:this.skillScope==="project"?this.activeSession.sessionId:""},this.agentId);if(e?.error){this.skillMutationError=e.error;return}let t=typeof e?.result?.name=="string"?e.result.name.trim():"";t&&Array.isArray(this.selection?.skills)&&(this.selection={...this.selection,skills:[...new Set([...this.selection.skills,t])]}),this.resetSkillForm(),this.showSkillForm=!1,await this.refreshCatalogForSkillScope()}catch(e){this.skillMutationError=e?.message||String(e)}finally{this.skillMutationLoading=!1}}},async removeSkill(e){if(!e?.managed||this.skillMutationLoading||!this.agentSupportsManagedSkills)return;let t=e.tier==="project"?"project":"user";if(t==="project"&&!this.projectSkillAvailable){this.skillMutationError=this.$t("yeaft.plugins.projectScopeUnavailable");return}if(confirm(this.$t("yeaft.plugins.confirmRemoveSkill",{name:e.label}))){this.skillMutationLoading=!0,this.skillMutationError="";try{let s=await this.store?.mutateManagedSkill?.({action:"remove",scope:t,name:e.name||e.label,sessionId:t==="project"?this.activeSession.sessionId:""},this.agentId);s?.error?this.skillMutationError=s.error:await this.refreshCatalogForSkillScope()}catch(s){this.skillMutationError=s?.message||String(s)}finally{this.skillMutationLoading=!1}}},selectAgent(e){!e||e===this.agentId||(this.store.pluginCenterAgentId=e)}},template:`
|
|
8341
8341
|
<section class="plugin-center-page" :aria-label="$t('yeaft.plugins.title')">
|
|
8342
8342
|
<header class="plugin-center-header">
|
|
8343
8343
|
<div class="plugin-center-heading">
|
|
@@ -8383,7 +8383,7 @@ ${String(e||"").trim()}
|
|
|
8383
8383
|
<h2>{{ selectedAgent?.name || selectedAgent?.id || $t('yeaft.plugins.noAgent') }}</h2>
|
|
8384
8384
|
<p>{{ statusSummary }}</p>
|
|
8385
8385
|
</div>
|
|
8386
|
-
<div class="plugin-center-overview-stats">
|
|
8386
|
+
<div v-if="configReady && !loading && !catalogRecord?.error && hasCatalog" class="plugin-center-overview-stats">
|
|
8387
8387
|
<span class="plugin-center-enabled-count"><strong>{{ enabledCount }}</strong> / {{ totalCount }}</span>
|
|
8388
8388
|
<span>{{ $t('yeaft.plugins.enabledLabel') }}</span>
|
|
8389
8389
|
</div>
|
|
Binary file
|
package/package.json
CHANGED
package/yeaft/web-bridge.js
CHANGED
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
|
|
18
18
|
import { delimiter, join } from 'node:path';
|
|
19
19
|
import { COLLAB_TOOL_POLICY } from './tools/registry.js';
|
|
20
|
+
import { createFullRegistry } from './tools/index.js';
|
|
20
21
|
import { existsSync, lstatSync } from 'node:fs';
|
|
21
22
|
import { randomUUID } from 'node:crypto';
|
|
22
23
|
import { DEFAULT_YEAFT_DIR } from './init.js';
|
|
@@ -3360,9 +3361,15 @@ function resolvePluginCatalogRuntime(workDir = '') {
|
|
|
3360
3361
|
const active = runtimeBelongsToOwner(runtime, owner)
|
|
3361
3362
|
? runtime
|
|
3362
3363
|
: (baseRuntime && runtimeBelongsToOwner(baseRuntime, owner) ? baseRuntime : null);
|
|
3364
|
+
const yeaftDir = ctx.CONFIG?.yeaftDir || session?.yeaftDir || DEFAULT_YEAFT_DIR;
|
|
3365
|
+
// Inventory belongs to the Agent, not an initialized inference runtime.
|
|
3366
|
+
// Read Skills afresh for the requested scope (empty means Agent-only), so a
|
|
3367
|
+
// cold/unvisited project never inherits another Session's Skills. Do not boot
|
|
3368
|
+
// a Session, load a provider, or connect MCP just to inspect capabilities.
|
|
3363
3369
|
return {
|
|
3364
|
-
toolRegistry:
|
|
3365
|
-
skillManager:
|
|
3370
|
+
toolRegistry: createFullRegistry(),
|
|
3371
|
+
skillManager: createSkillManager(yeaftDir, normalizedWorkDir),
|
|
3372
|
+
mcpConfig: loadPluginCatalogMcpConfig(yeaftDir),
|
|
3366
3373
|
mcpManager: active?.mcpManager || session?.mcpManager || null,
|
|
3367
3374
|
};
|
|
3368
3375
|
}
|
|
@@ -3439,11 +3446,8 @@ function reloadManagedSkillRuntime(scope, workDir = '') {
|
|
|
3439
3446
|
if (scope === 'user') reloadActiveSkills(owner);
|
|
3440
3447
|
}
|
|
3441
3448
|
|
|
3442
|
-
function managedSkillCatalog(
|
|
3443
|
-
|
|
3444
|
-
const runtime = resolvePluginCatalogRuntime(normalizedWorkDir);
|
|
3445
|
-
const manager = createSkillManager(yeaftDir, normalizedWorkDir || process.cwd());
|
|
3446
|
-
return buildPluginCatalog({ ...runtime, skillManager: manager });
|
|
3449
|
+
function managedSkillCatalog(workDir = '') {
|
|
3450
|
+
return buildPluginCatalog(resolvePluginCatalogRuntime(workDir));
|
|
3447
3451
|
}
|
|
3448
3452
|
|
|
3449
3453
|
/**
|
|
@@ -3479,7 +3483,7 @@ export function handleYeaftManagedSkill(msg = {}) {
|
|
|
3479
3483
|
? createManagedSkill(join(yeaftDir, 'skills'), msg.skill || {})
|
|
3480
3484
|
: removeManagedSkill(join(yeaftDir, 'skills'), msg.name));
|
|
3481
3485
|
reloadManagedSkillRuntime(scope, managedSession?.workDir || '');
|
|
3482
|
-
const catalog = managedSkillCatalog(
|
|
3486
|
+
const catalog = managedSkillCatalog(managedSession?.workDir || '');
|
|
3483
3487
|
respond({ scope, sessionId: managedSession?.sessionId || null, result, catalog, error: null });
|
|
3484
3488
|
} catch (err) {
|
|
3485
3489
|
respond({ scope, sessionId: null, catalog: { tools: [], skills: [], skillSources: [], mcpServers: [] }, error: err?.message || String(err) });
|
|
@@ -3495,10 +3499,7 @@ export function handleYeaftPluginCatalog(msg = {}) {
|
|
|
3495
3499
|
const requestId = msg.requestId || null;
|
|
3496
3500
|
const requestedWorkDir = normalizeSessionWorkDir(msg.workDir);
|
|
3497
3501
|
try {
|
|
3498
|
-
const
|
|
3499
|
-
const yeaftDir = ctx.CONFIG?.yeaftDir || session?.yeaftDir || DEFAULT_YEAFT_DIR;
|
|
3500
|
-
runtime.mcpConfig = loadPluginCatalogMcpConfig(yeaftDir);
|
|
3501
|
-
const catalog = buildPluginCatalog(runtime);
|
|
3502
|
+
const catalog = buildPluginCatalog(resolvePluginCatalogRuntime(requestedWorkDir));
|
|
3502
3503
|
sendToServer({
|
|
3503
3504
|
type: 'yeaft_plugin_catalog_result',
|
|
3504
3505
|
requestId,
|