@agenthippo-ai/agenthippo 1.110.26 → 1.110.28

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/out/sync.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /*! Copyright (c) 2026 AgentHippo.ai. All rights reserved. Proprietary; see LICENSE. */
2
2
  "use strict";var __createBinding=this&&this.__createBinding||(Object.create?(function(y,e,t,i){i===void 0&&(i=t);var s=Object.getOwnPropertyDescriptor(e,t);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(y,i,s)}):(function(y,e,t,i){i===void 0&&(i=t),y[i]=e[t]})),__setModuleDefault=this&&this.__setModuleDefault||(Object.create?(function(y,e){Object.defineProperty(y,"default",{enumerable:!0,value:e})}):function(y,e){y.default=e}),__importStar=this&&this.__importStar||(function(){var y=function(e){return y=Object.getOwnPropertyNames||function(t){var i=[];for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(i[i.length]=s);return i},y(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var i=y(e),s=0;s<i.length;s++)i[s]!=="default"&&__createBinding(t,e,i[s]);return __setModuleDefault(t,e),t}})();Object.defineProperty(exports,"__esModule",{value:!0}),exports.SyncService=void 0;const vscode=__importStar(require("vscode")),fs_1=require("fs"),path=__importStar(require("path")),os=__importStar(require("os")),utils_1=require("./utils"),remoteSkills_1=require("./remoteSkills"),branding_1=require("./branding"),paths_1=require("./agentpack/paths"),manifest_1=require("./agentpack/manifest"),mcp_1=require("./mcp"),customRegistry_1=require("./engines/customRegistry"),AGENTIDE_DERIVED_DIR_README="AGENTIDE_README.md",AGENTIDE_CONTEXT_FILE="context.md",AGENTIDE_MANIFEST_FILE="agentide.manifest.json",AGENTIDE_INSTALLED_AGENTS_FILE="installed-agents.json",AGENTIDE_MANIFEST_DEBOUNCE_MS=2e3,AGENTIDE_AGENT_YAML="agent.yaml",AGENTIDE_AGENTS_DIR="agents",AGENTIDE_DEFAULT_AGENT_ID="default",AGENTIDE_DIR_NAME=paths_1.AGENT_CONSTANTS.AGENTIDE_DIR_NAME,shared_1=require("./shared");function getConfiguredAdditionalEngineDir(){return vscode.workspace.getConfiguration("agentide").get("additionalEngineDir")}function getDerivedEngineSyncTargets(y){const e=Object.values(shared_1.AGENT_ENGINES).map(i=>({id:i.id,displayName:i.displayName,workspaceDir:i.workspaceDir,rulesFile:i.rulesFile,managedPaths:i.managedPaths,includeSkills:!0,includeRules:!0})),t=(0,customRegistry_1.discoverCustomEngineManifests)(y,getConfiguredAdditionalEngineDir()).filter(i=>i.workspaceSync?.enabled).map(i=>({id:i.id,displayName:i.displayName??i.id,workspaceDir:i.workspaceSync.dir,rulesFile:i.workspaceSync.rulesFile,includeSkills:i.workspaceSync.includeSkills,includeRules:i.workspaceSync.includeRules}));return[...e,...t]}function getSkillDirNameFromRelPath(y){const t=y.replace(/\\/g,"/").split("/").filter(Boolean),i=t.indexOf("skills");if(i!==-1&&t.length>i+1)return t[i+1];if(t.length>=3&&t[0]==="skills")return t[1]}function parseSkillYamlHeader(y){const e={};if(!y.startsWith("---"))return e;const t=y.split(`
3
3
  `);let i=-1;for(let s=1;s<t.length;s++)if(t[s].trim()==="---"){i=s;break}if(i===-1)return e;for(let s=1;s<i;s++){const l=t[s],o=l.indexOf(":");if(o===-1)continue;const n=l.substring(0,o).trim().toLowerCase();let a=l.substring(o+1).trim();(a.startsWith('"')&&a.endsWith('"')||a.startsWith("'")&&a.endsWith("'"))&&(a=a.slice(1,-1)),n==="name"&&a?e.name=a:n==="description"&&a&&(e.description=a)}return e}function parseYaml(y){return require("js-yaml").load(y)}function dumpYaml(y){return require("js-yaml").dump(y,{lineWidth:120,noRefs:!0})}async function isDirEmpty(y){return(await fs_1.promises.readdir(y)).length===0}class SyncService{getBundledBasePromptsDir;lastAgentideSyncSignatureByRoot=new Map;agentideSignatureByRoot=new Map;agentideSkillsSignatureByRoot=new Map;agentideRootUpdateState=new Map;agentideWatchersByRoot=new Map;activeAgentTurns=0;activePackIdByRoot=new Map;activeAgentManifestCache=new Map;constructor(e){this.getBundledBasePromptsDir=e}setActivePackId(e,t){this.activePackIdByRoot.set(e,t)}getActivePackId(e){return this.activePackIdByRoot.get(e)}incrementActiveAgentTurns(){this.activeAgentTurns++}decrementActiveAgentTurns(){this.activeAgentTurns=Math.max(0,this.activeAgentTurns-1)}getSkillsSignature(e){return this.agentideSkillsSignatureByRoot.get(e)}async computeWorkspaceAgentideSignature(e,t){const i=vscode.workspace.workspaceFolders?.map(n=>n.uri.fsPath)??[],s=(t??[]).filter(n=>i.includes(n)),l=Array.from(new Set([e,...s].map(n=>n.trim()).filter(Boolean))).filter(n=>n!==os.homedir()),o=[];for(const n of l){let a=this.agentideSignatureByRoot.get(n);a||(a=(await this.readAgentideManifest(n))?.agentideSignature,a&&this.agentideSignatureByRoot.set(n,a)),o.push([n,a??"missing"])}return o.sort((n,a)=>n[0].localeCompare(a[0])),(0,utils_1.shortSig)(JSON.stringify(o))}getManagedResources(e,t,i){const s=[],l=Array.from(new Set(i.map(a=>a.trim()).filter(Boolean))).filter(a=>a!==os.homedir()),o={codexHome:e,claudeConfigDir:t},n={CODEX_HOME:"codexHome",CLAUDE_CONFIG_DIR:"claudeConfigDir"};for(const a of Object.values(shared_1.AGENT_ENGINES)){const r=a.configEnvVar?n[a.configEnvVar]:void 0,d=r?o[r]:void 0;if(d)if(a.managedPaths?.length)for(const c of a.managedPaths){const g=!c.includes(".");s.push({path:path.join(d,c),type:g?"directory":"generated",description:`${a.displayName} ${c} (managed by AgentIDE)`,safeToDelete:!0})}else s.push({path:d,type:"directory",description:`${a.displayName} config dir (managed by AgentIDE)`,safeToDelete:!0})}for(const a of l){s.push({path:path.join(a,AGENTIDE_DIR_NAME),type:"directory",description:"AgentIDE project rules & skills (source-of-truth)",safeToDelete:!1});for(const r of getDerivedEngineSyncTargets(a))s.push({path:path.join(a,r.workspaceDir),type:"directory",description:`${r.displayName} project folder (derived/overwritten from ${AGENTIDE_DIR_NAME}/)`,safeToDelete:!0})}return s}async writeManagedPathsManifest(e,t,i,s,l){if(!i||i===os.homedir())return;const o=this.getAgentideProjectDir(i),n=path.join(o,"paths.md"),a=this.getManagedResources(e,t,[i,...s??[]]),r=["# AgentIDE Managed Resources","","This file lists all files and directories managed by the AgentIDE extension.","**Auto-generated** - Do not edit manually.","",`**Workspace:** \`${i}\``,e?`**Codex Home:** \`${e}\``:"",t?`**Claude Config Dir:** \`${t}\``:"","","## Resources","","| Path | Type | Safe to Delete | Description |","|------|------|----------------|-------------|"];for(const d of a){const g=await(0,utils_1.pathExists)(d.path)?"[x]":"[ ]";r.push(`| ${g} \`${d.path}\` | ${d.type} | ${d.safeToDelete?"Yes":"No"} | ${d.description} |`)}r.push(""),r.push("## How to Reset"),r.push(""),r.push("Run the command: **AgentIDE: Clear Managed Resources**"),r.push(""),r.push("This will:"),r.push("- Remove symlinks created by the extension"),r.push("- Delete generated files (context.md, config.toml, etc.)"),r.push(`- **NOT** delete user-managed rules/skills inside \`${AGENTIDE_DIR_NAME}/\``),r.push(""),await fs_1.promises.mkdir(o,{recursive:!0}),await(0,utils_1.writeFileIfChanged)(n,r.filter(Boolean).join(`
4
- `)),l.appendLine(`[AgentIDE] Wrote manifest: ${n}`)}async clearManagedResources(e,t,i,s,l){const o=this.getManagedResources(e,t,[i??"",...s??[]]),n=[],a=[],r=[];for(const d of o){if(!d.safeToDelete){a.push(d.path);continue}try{const c=await fs_1.promises.lstat(d.path);d.type==="symlink"?c.isSymbolicLink()?(await fs_1.promises.unlink(d.path),n.push(d.path),l.appendLine(`[AgentIDE] Removed symlink: ${d.path}`)):(a.push(d.path),l.appendLine(`[AgentIDE] Skipped (not a symlink): ${d.path}`)):d.type==="generated"?c.isFile()&&(await fs_1.promises.unlink(d.path),n.push(d.path),l.appendLine(`[AgentIDE] Removed generated file: ${d.path}`)):d.type==="directory"&&d.safeToDelete&&c.isDirectory()&&(await fs_1.promises.rm(d.path,{recursive:!0,force:!0}),n.push(d.path),l.appendLine(`[AgentIDE] Removed directory: ${d.path}`))}catch(c){(0,utils_1.getErrorCode)(c)!=="ENOENT"&&r.push(`${d.path}: ${c instanceof Error?c.message:String(c)}`)}}return this.lastAgentideSyncSignatureByRoot.clear(),this.agentideSignatureByRoot.clear(),this.agentideSkillsSignatureByRoot.clear(),{cleared:n,skipped:a,errors:r}}getAgentideProjectDir(e){return(0,paths_1.getAgentideDir)(e)}getAgentsDir(e){return path.join(this.getAgentideProjectDir(e),AGENTIDE_AGENTS_DIR)}getAgentRoot(e,t){return path.join(this.getAgentsDir(e),t)}getAgentSkillsDir(e,t){return path.join(this.getAgentRoot(e,t),"skills")}getAgentRulesDir(e,t){return path.join(this.getAgentRoot(e,t),"rules")}getAgentAgentsFile(e,t){return path.join(this.getAgentRoot(e,t),"AGENTS.md")}getAgentContextFile(e,t){return path.join(this.getAgentRoot(e,t),AGENTIDE_CONTEXT_FILE)}getActiveAgentId(e){return this.getActivePackId(e)??AGENTIDE_DEFAULT_AGENT_ID}async resolveManifestSource(e,t){const i=t??this.getActiveAgentId(e),s=this.getAgentRoot(e,i);return{agentId:i,isPack:i!==AGENTIDE_DEFAULT_AGENT_ID,agentRoot:s,agentsFile:this.getAgentAgentsFile(e,i),contextFile:this.getAgentContextFile(e,i),rulesDir:this.getAgentRulesDir(e,i),skillsDir:this.getAgentSkillsDir(e,i),agentYamlPath:path.join(s,AGENTIDE_AGENT_YAML)}}async getDataPathsForAgent(e,t,i){const s=this.getAgentRoot(e,t),l=path.join(s,AGENTIDE_AGENT_YAML);if(await(0,utils_1.pathExists)(l))try{const n=(await(0,manifest_1.loadAgentManifest)(l)).spec?.data;if(!n)return;const a=n.sourcePath?.trim()||"./data",r=(n.workspacePath?.trim()||`.${path.sep}${AGENTIDE_DIR_NAME}${path.sep}data${path.sep}${t}`).replace(/^(?:\.\/|\.\\)/,""),d=path.resolve(s,a),c=path.resolve(e,r);return{sourceDir:d,targetDir:c}}catch(o){(0,utils_1.logInfo)(i,`[AgentIDE] Skipping data sync for ${t}: failed to parse data config (${o instanceof Error?o.message:String(o)})`);return}}async seedAgentDataIfNeeded(e,t,i){const s=await this.getDataPathsForAgent(e,t,i);if(!s)return;const{sourceDir:l,targetDir:o}=s;if(await(0,utils_1.pathExists)(l)){if(!await(0,utils_1.pathExists)(o)){await(0,utils_1.copyDirRecursive)(l,o),(0,utils_1.logInfo)(i,`[AgentIDE] Seeded pack data for ${t}: ${o}`);return}try{if(!(await fs_1.promises.stat(o)).isDirectory())return}catch{return}await isDirEmpty(o)&&(await(0,utils_1.copyDirRecursive)(l,o),(0,utils_1.logInfo)(i,`[AgentIDE] Seeded pack data for ${t}: ${o}`))}}async syncAgentYamlSkills(e,t,i,s){const l=path.join(this.getAgentRoot(e,t),AGENTIDE_AGENT_YAML);if(await(0,utils_1.pathExists)(l))try{const o=await fs_1.promises.readFile(l,"utf8"),n=parseYaml(o);if(!n||typeof n!="object")return;const a=n,r=i.skills.map(c=>({path:`./skills/${c.dirName}`}));a.spec={...a.spec??{},skills:r};const d=dumpYaml(a);await(0,utils_1.writeFileIfChanged)(l,d)}catch(o){s.appendLine(`[AgentIDE] Warning: failed to update agent.yaml skills for ${t}: ${o instanceof Error?o.message:String(o)}`)}}async getActiveAgentManifest(e,t,i){const s=i??this.getActiveAgentId(e),l=path.join(this.getAgentRoot(e,s),AGENTIDE_AGENT_YAML),o=await(0,utils_1.getFileStats)(l);if(!o){const a=this.activeAgentManifestCache.get(l);a?.loggedNoManifest||t.appendLine(`[AgentIDE] No agent.yaml found for agent ${s}`),this.activeAgentManifestCache.set(l,{mtimeMs:-1,size:-1,manifest:void 0,loggedNoManifest:!0,loggedInvalid:a?.loggedInvalid??!1});return}const n=this.activeAgentManifestCache.get(l);if(n&&n.mtimeMs===o.mtimeMs&&n.size===o.size)return n.manifest;try{const a=await fs_1.promises.readFile(l,"utf8"),r=parseYaml(a);if(!r?.metadata?.name||!r?.spec?.engine){n?.loggedInvalid||t.appendLine(`[AgentIDE] Invalid agent.yaml for agent ${s}: missing required fields`),this.activeAgentManifestCache.set(l,{mtimeMs:o.mtimeMs,size:o.size,manifest:void 0,loggedNoManifest:!1,loggedInvalid:!0});return}return this.activeAgentManifestCache.set(l,{mtimeMs:o.mtimeMs,size:o.size,manifest:r,loggedNoManifest:!1,loggedInvalid:!1}),r}catch(a){n?.loggedInvalid||t.appendLine(`[AgentIDE] Failed to parse agent.yaml for agent ${s}: ${a instanceof Error?a.message:String(a)}`),this.activeAgentManifestCache.set(l,{mtimeMs:o.mtimeMs,size:o.size,manifest:void 0,loggedNoManifest:!1,loggedInvalid:!0});return}}getAgentideManifestFilePath(e){return path.join(this.getAgentideProjectDir(e),AGENTIDE_MANIFEST_FILE)}async allDerivedDirsPresent(e){return(await Promise.all(getDerivedEngineSyncTargets(e).map(i=>(0,utils_1.isDirOrSymlink)(path.join(e,i.workspaceDir))))).every(Boolean)}async readAgentideManifest(e){const t=this.getAgentideManifestFilePath(e);try{const i=await fs_1.promises.readFile(t,"utf8"),s=JSON.parse(i);return s.version!==1||typeof s.agentideSignature!="string"?void 0:s}catch(i){return(0,utils_1.getErrorCode)(i)==="ENOENT",void 0}}async computeAgentideManifest(e,t,i){const s=t.rulesDir,l=t.skillsDir,o=new Map,n=new Map;if(i){for(const m of i.rules)o.set(m.relPath,m);for(const m of i.skills){const u=m.dirName||getSkillDirNameFromRelPath(m.skillMdRelPath)||m.name;n.set(u,m)}}const a=[],r=[],d=async(m,u)=>{const E=await(0,utils_1.getFileStats)(m);if(!E)return;const w=o.get(u),D=(0,utils_1.isCachedHashValid)(w,E);if(D)return D;const{sha256:k,size:v,mtimeMs:P}=await(0,utils_1.readFileSha256)(m);return{relPath:u,sha256:k,size:v,mtimeMs:P}},c=t.agentsFile,g=await d(c,"AGENTS.md");g&&a.push(g);const p=t.contextFile,h=await d(p,AGENTIDE_CONTEXT_FILE);h&&a.push(h);try{const m=await fs_1.promises.readdir(s,{withFileTypes:!0});for(const u of m){if(!u.isFile()||!u.name.toLowerCase().endsWith(".md"))continue;const E=path.join(s,u.name),w=path.join("rules",u.name).replace(/\\/g,"/"),D=await d(E,w);D&&a.push(D)}}catch{}try{const m=await fs_1.promises.readdir(l,{withFileTypes:!0});for(const u of m){if(!u.isDirectory()||u.name.startsWith("."))continue;const E=path.join(l,u.name,"SKILL.md"),w=await(0,utils_1.getFileStats)(E);if(!w)continue;const D=n.get(u.name);if(D&&D.skillMdMtimeMs===w.mtimeMs&&D.skillMdSize===w.size)r.push({...D,dirName:u.name});else{const{sha256:v,size:P,mtimeMs:T}=await(0,utils_1.readFileSha256)(E);let I,F;try{const $=await fs_1.promises.readFile(E,"utf-8"),j=parseSkillYamlHeader($);I=j.name,F=j.description}catch{}r.push({dirName:u.name,name:I||u.name,description:F,skillMdRelPath:path.join("skills",u.name,"SKILL.md").replace(/\\/g,"/"),skillMdSha256:v,skillMdSize:P,skillMdMtimeMs:T})}}}catch{}a.sort((m,u)=>m.relPath.localeCompare(u.relPath)),r.sort((m,u)=>m.dirName.localeCompare(u.dirName));const f=(0,utils_1.shortSig)(JSON.stringify(a.map(m=>[m.relPath,m.sha256]))),A=(0,utils_1.shortSig)(JSON.stringify(r.map(m=>[m.dirName,m.skillMdSha256]))),S=(0,utils_1.shortSig)(`${f}:${A}`);return{version:1,workspaceRoot:e,generatedAt:new Date().toISOString(),activeAgentId:t.agentId,rules:a,skills:r,rulesSignature:f,skillsSignature:A,agentideSignature:S}}async writeAgentideManifest(e,t,i){const s=this.getAgentideProjectDir(e);await(0,utils_1.pathExists)(s)||await fs_1.promises.mkdir(s,{recursive:!0});const l=await this.readAgentideManifest(e),o=await this.resolveManifestSource(e,i?.packIdOverride),n=l?.activeAgentId===o.agentId,a=await this.computeAgentideManifest(e,o,n?l:void 0);a.derivedSkillIngestState=n?i?.derivedSkillIngestState??l?.derivedSkillIngestState:i?.derivedSkillIngestState;const r=this.getAgentideManifestFilePath(e);return await(0,utils_1.writeFileIfChanged)(r,JSON.stringify(a,null,2)+`
4
+ `)),l.appendLine(`[AgentIDE] Wrote manifest: ${n}`)}async clearManagedResources(e,t,i,s,l){const o=this.getManagedResources(e,t,[i??"",...s??[]]),n=[],a=[],r=[];for(const d of o){if(!d.safeToDelete){a.push(d.path);continue}try{const c=await fs_1.promises.lstat(d.path);d.type==="symlink"?c.isSymbolicLink()?(await fs_1.promises.unlink(d.path),n.push(d.path),l.appendLine(`[AgentIDE] Removed symlink: ${d.path}`)):(a.push(d.path),l.appendLine(`[AgentIDE] Skipped (not a symlink): ${d.path}`)):d.type==="generated"?c.isFile()&&(await fs_1.promises.unlink(d.path),n.push(d.path),l.appendLine(`[AgentIDE] Removed generated file: ${d.path}`)):d.type==="directory"&&d.safeToDelete&&c.isDirectory()&&(await fs_1.promises.rm(d.path,{recursive:!0,force:!0}),n.push(d.path),l.appendLine(`[AgentIDE] Removed directory: ${d.path}`))}catch(c){(0,utils_1.getErrorCode)(c)!=="ENOENT"&&r.push(`${d.path}: ${c instanceof Error?c.message:String(c)}`)}}return this.lastAgentideSyncSignatureByRoot.clear(),this.agentideSignatureByRoot.clear(),this.agentideSkillsSignatureByRoot.clear(),{cleared:n,skipped:a,errors:r}}getAgentideProjectDir(e){return(0,paths_1.getAgentideDir)(e)}getAgentsDir(e){return path.join(this.getAgentideProjectDir(e),AGENTIDE_AGENTS_DIR)}getAgentRoot(e,t){return path.join(this.getAgentsDir(e),t)}getAgentSkillsDir(e,t){return path.join(this.getAgentRoot(e,t),"skills")}getAgentRulesDir(e,t){return path.join(this.getAgentRoot(e,t),"rules")}getAgentAgentsFile(e,t){return path.join(this.getAgentRoot(e,t),"AGENTS.md")}getAgentContextFile(e,t){return path.join(this.getAgentRoot(e,t),AGENTIDE_CONTEXT_FILE)}getActiveAgentId(e){return this.getActivePackId(e)??AGENTIDE_DEFAULT_AGENT_ID}getActiveAgentContext(e,t){const i=t??this.getActiveAgentId(e);return{agentId:i,agentRoot:this.getAgentRoot(e,i)}}async resolveManifestSource(e,t){const i=t??this.getActiveAgentId(e),s=this.getAgentRoot(e,i);return{agentId:i,isPack:i!==AGENTIDE_DEFAULT_AGENT_ID,agentRoot:s,agentsFile:this.getAgentAgentsFile(e,i),contextFile:this.getAgentContextFile(e,i),rulesDir:this.getAgentRulesDir(e,i),skillsDir:this.getAgentSkillsDir(e,i),agentYamlPath:path.join(s,AGENTIDE_AGENT_YAML)}}async getDataPathsForAgent(e,t,i){const s=this.getAgentRoot(e,t),l=path.join(s,AGENTIDE_AGENT_YAML);if(await(0,utils_1.pathExists)(l))try{const n=(await(0,manifest_1.loadAgentManifest)(l)).spec?.data;if(!n)return;const a=n.sourcePath?.trim()||"./data",r=(n.workspacePath?.trim()||`.${path.sep}${AGENTIDE_DIR_NAME}${path.sep}data${path.sep}${t}`).replace(/^(?:\.\/|\.\\)/,""),d=path.resolve(s,a),c=path.resolve(e,r);return{sourceDir:d,targetDir:c}}catch(o){(0,utils_1.logInfo)(i,`[AgentIDE] Skipping data sync for ${t}: failed to parse data config (${o instanceof Error?o.message:String(o)})`);return}}async seedAgentDataIfNeeded(e,t,i){const s=await this.getDataPathsForAgent(e,t,i);if(!s)return;const{sourceDir:l,targetDir:o}=s;if(await(0,utils_1.pathExists)(l)){if(!await(0,utils_1.pathExists)(o)){await(0,utils_1.copyDirRecursive)(l,o),(0,utils_1.logInfo)(i,`[AgentIDE] Seeded pack data for ${t}: ${o}`);return}try{if(!(await fs_1.promises.stat(o)).isDirectory())return}catch{return}await isDirEmpty(o)&&(await(0,utils_1.copyDirRecursive)(l,o),(0,utils_1.logInfo)(i,`[AgentIDE] Seeded pack data for ${t}: ${o}`))}}async syncAgentYamlSkills(e,t,i,s){const l=path.join(this.getAgentRoot(e,t),AGENTIDE_AGENT_YAML);if(await(0,utils_1.pathExists)(l))try{const o=await fs_1.promises.readFile(l,"utf8"),n=parseYaml(o);if(!n||typeof n!="object")return;const a=n,r=i.skills.map(c=>({path:`./skills/${c.dirName}`}));a.spec={...a.spec??{},skills:r};const d=dumpYaml(a);await(0,utils_1.writeFileIfChanged)(l,d)}catch(o){s.appendLine(`[AgentIDE] Warning: failed to update agent.yaml skills for ${t}: ${o instanceof Error?o.message:String(o)}`)}}async getActiveAgentManifest(e,t,i){const s=i??this.getActiveAgentId(e),l=path.join(this.getAgentRoot(e,s),AGENTIDE_AGENT_YAML),o=await(0,utils_1.getFileStats)(l);if(!o){const a=this.activeAgentManifestCache.get(l);a?.loggedNoManifest||t.appendLine(`[AgentIDE] No agent.yaml found for agent ${s}`),this.activeAgentManifestCache.set(l,{mtimeMs:-1,size:-1,manifest:void 0,loggedNoManifest:!0,loggedInvalid:a?.loggedInvalid??!1});return}const n=this.activeAgentManifestCache.get(l);if(n&&n.mtimeMs===o.mtimeMs&&n.size===o.size)return n.manifest;try{const a=await fs_1.promises.readFile(l,"utf8"),r=parseYaml(a);if(!r?.metadata?.name||!r?.spec?.engine){n?.loggedInvalid||t.appendLine(`[AgentIDE] Invalid agent.yaml for agent ${s}: missing required fields`),this.activeAgentManifestCache.set(l,{mtimeMs:o.mtimeMs,size:o.size,manifest:void 0,loggedNoManifest:!1,loggedInvalid:!0});return}return this.activeAgentManifestCache.set(l,{mtimeMs:o.mtimeMs,size:o.size,manifest:r,loggedNoManifest:!1,loggedInvalid:!1}),r}catch(a){n?.loggedInvalid||t.appendLine(`[AgentIDE] Failed to parse agent.yaml for agent ${s}: ${a instanceof Error?a.message:String(a)}`),this.activeAgentManifestCache.set(l,{mtimeMs:o.mtimeMs,size:o.size,manifest:void 0,loggedNoManifest:!1,loggedInvalid:!0});return}}getAgentideManifestFilePath(e){return path.join(this.getAgentideProjectDir(e),AGENTIDE_MANIFEST_FILE)}async allDerivedDirsPresent(e){return(await Promise.all(getDerivedEngineSyncTargets(e).map(i=>(0,utils_1.isDirOrSymlink)(path.join(e,i.workspaceDir))))).every(Boolean)}async readAgentideManifest(e){const t=this.getAgentideManifestFilePath(e);try{const i=await fs_1.promises.readFile(t,"utf8"),s=JSON.parse(i);return s.version!==1||typeof s.agentideSignature!="string"?void 0:s}catch(i){return(0,utils_1.getErrorCode)(i)==="ENOENT",void 0}}async computeAgentideManifest(e,t,i){const s=t.rulesDir,l=t.skillsDir,o=new Map,n=new Map;if(i){for(const m of i.rules)o.set(m.relPath,m);for(const m of i.skills){const u=m.dirName||getSkillDirNameFromRelPath(m.skillMdRelPath)||m.name;n.set(u,m)}}const a=[],r=[],d=async(m,u)=>{const E=await(0,utils_1.getFileStats)(m);if(!E)return;const w=o.get(u),D=(0,utils_1.isCachedHashValid)(w,E);if(D)return D;const{sha256:k,size:v,mtimeMs:P}=await(0,utils_1.readFileSha256)(m);return{relPath:u,sha256:k,size:v,mtimeMs:P}},c=t.agentsFile,g=await d(c,"AGENTS.md");g&&a.push(g);const p=t.contextFile,h=await d(p,AGENTIDE_CONTEXT_FILE);h&&a.push(h);try{const m=await fs_1.promises.readdir(s,{withFileTypes:!0});for(const u of m){if(!u.isFile()||!u.name.toLowerCase().endsWith(".md"))continue;const E=path.join(s,u.name),w=path.join("rules",u.name).replace(/\\/g,"/"),D=await d(E,w);D&&a.push(D)}}catch{}try{const m=await fs_1.promises.readdir(l,{withFileTypes:!0});for(const u of m){if(!u.isDirectory()||u.name.startsWith("."))continue;const E=path.join(l,u.name,"SKILL.md"),w=await(0,utils_1.getFileStats)(E);if(!w)continue;const D=n.get(u.name);if(D&&D.skillMdMtimeMs===w.mtimeMs&&D.skillMdSize===w.size)r.push({...D,dirName:u.name});else{const{sha256:v,size:P,mtimeMs:T}=await(0,utils_1.readFileSha256)(E);let I,F;try{const $=await fs_1.promises.readFile(E,"utf-8"),j=parseSkillYamlHeader($);I=j.name,F=j.description}catch{}r.push({dirName:u.name,name:I||u.name,description:F,skillMdRelPath:path.join("skills",u.name,"SKILL.md").replace(/\\/g,"/"),skillMdSha256:v,skillMdSize:P,skillMdMtimeMs:T})}}}catch{}a.sort((m,u)=>m.relPath.localeCompare(u.relPath)),r.sort((m,u)=>m.dirName.localeCompare(u.dirName));const f=(0,utils_1.shortSig)(JSON.stringify(a.map(m=>[m.relPath,m.sha256]))),A=(0,utils_1.shortSig)(JSON.stringify(r.map(m=>[m.dirName,m.skillMdSha256]))),S=(0,utils_1.shortSig)(`${f}:${A}`);return{version:1,workspaceRoot:e,generatedAt:new Date().toISOString(),activeAgentId:t.agentId,rules:a,skills:r,rulesSignature:f,skillsSignature:A,agentideSignature:S}}async writeAgentideManifest(e,t,i){const s=this.getAgentideProjectDir(e);await(0,utils_1.pathExists)(s)||await fs_1.promises.mkdir(s,{recursive:!0});const l=await this.readAgentideManifest(e),o=await this.resolveManifestSource(e,i?.packIdOverride),n=l?.activeAgentId===o.agentId,a=await this.computeAgentideManifest(e,o,n?l:void 0);a.derivedSkillIngestState=n?i?.derivedSkillIngestState??l?.derivedSkillIngestState:i?.derivedSkillIngestState;const r=this.getAgentideManifestFilePath(e);return await(0,utils_1.writeFileIfChanged)(r,JSON.stringify(a,null,2)+`
5
5
  `),this.agentideSignatureByRoot.set(e,a.agentideSignature),this.agentideSkillsSignatureByRoot.set(e,a.skillsSignature),t.appendLine(`[AgentIDE] Updated manifest: ${r} (sig=${a.agentideSignature})`),o.isPack||await this.syncAgentYamlSkills(e,o.agentId,a,t),a}ensureAgentideWatchers(e){const t=vscode.workspace.workspaceFolders?.map(s=>s.uri.fsPath)??[],i=new Set(this.agentideWatchersByRoot.keys());for(const s of i)t.includes(s)||(this.disposeAgentideWatchersForRoot(s),this.agentideRootUpdateState.delete(s),this.lastAgentideSyncSignatureByRoot.delete(s),this.agentideSignatureByRoot.delete(s),this.agentideSkillsSignatureByRoot.delete(s));for(const s of t){if(this.agentideWatchersByRoot.has(s))continue;const l=[{pattern:new vscode.RelativePattern(s,`${AGENTIDE_DIR_NAME}/${AGENTIDE_AGENTS_DIR}/*/agent.yaml`),reason:"source"},{pattern:new vscode.RelativePattern(s,`${AGENTIDE_DIR_NAME}/${AGENTIDE_AGENTS_DIR}/*/AGENTS.md`),reason:"source"},{pattern:new vscode.RelativePattern(s,`${AGENTIDE_DIR_NAME}/${AGENTIDE_AGENTS_DIR}/*/context.md`),reason:"source"},{pattern:new vscode.RelativePattern(s,`${AGENTIDE_DIR_NAME}/${AGENTIDE_AGENTS_DIR}/*/rules/**/*.md`),reason:"source"},{pattern:new vscode.RelativePattern(s,`${AGENTIDE_DIR_NAME}/${AGENTIDE_AGENTS_DIR}/*/skills/**/*`),reason:"source"},{pattern:new vscode.RelativePattern(s,`${AGENTIDE_DIR_NAME}/${AGENTIDE_AGENTS_DIR}/*/AGENTS.md`),reason:"source"},{pattern:new vscode.RelativePattern(s,`${AGENTIDE_DIR_NAME}/${AGENTIDE_AGENTS_DIR}/*/context.md`),reason:"source"},{pattern:new vscode.RelativePattern(s,`${AGENTIDE_DIR_NAME}/${AGENTIDE_AGENTS_DIR}/*/rules/**/*.md`),reason:"source"},{pattern:new vscode.RelativePattern(s,`${AGENTIDE_DIR_NAME}/${AGENTIDE_AGENTS_DIR}/*/skills/**/*`),reason:"source"},{pattern:new vscode.RelativePattern(s,`${AGENTIDE_DIR_NAME}/${AGENTIDE_AGENTS_DIR}/*/agent.yaml`),reason:"source"},...getDerivedEngineSyncTargets(s).flatMap(n=>[...n.includeSkills?[{pattern:new vscode.RelativePattern(s,`${n.workspaceDir}/skills/**/SKILL.md`),reason:"derived"}]:[],{pattern:new vscode.RelativePattern(s,`${n.workspaceDir}/${n.rulesFile}`),reason:"derived"},...n.includeRules?[{pattern:new vscode.RelativePattern(s,`${n.workspaceDir}/rules/**/*.md`),reason:"derived"}]:[]])],o=[];for(const{pattern:n,reason:a}of l){const r=vscode.workspace.createFileSystemWatcher(n),d=()=>this.scheduleAgentideRootUpdate(s,e,a);o.push(r,r.onDidChange(d),r.onDidCreate(d),r.onDidDelete(d))}this.agentideWatchersByRoot.set(s,o),this.scheduleAgentideRootUpdate(s,e,"source")}}disposeAgentideWatchersForRoot(e){const t=this.agentideWatchersByRoot.get(e);if(t){for(const i of t)try{i.dispose()}catch{}this.agentideWatchersByRoot.delete(e)}}disposeAllWatchers(){for(const e of this.agentideWatchersByRoot.keys())this.disposeAgentideWatchersForRoot(e);this.agentideRootUpdateState.clear()}scheduleAgentideRootUpdate(e,t,i){const s=this.agentideRootUpdateState.get(e)??{dirty:!1,dirtySource:!1,dirtyDerived:!1,timer:void 0,deferred:void 0};s.dirty=!0,i==="source"?s.dirtySource=!0:s.dirtyDerived=!0,s.deferred||(s.deferred=(0,utils_1.createDeferred)()),s.timer&&clearTimeout(s.timer),s.timer=setTimeout(()=>{this.flushAgentideRootUpdate(e,t,{allowDuringActiveTurn:!1,force:!1})},AGENTIDE_MANIFEST_DEBOUNCE_MS),this.agentideRootUpdateState.set(e,s)}async flushAgentideRootUpdate(e,t,i){const s=i?.allowDuringActiveTurn??!1,l=i?.force??!1;if(!s&&this.activeAgentTurns>0){const d=this.agentideRootUpdateState.get(e),c=d?.dirtySource?"source":d?.dirtyDerived?"derived":"source";this.scheduleAgentideRootUpdate(e,t,c);return}const o=this.agentideRootUpdateState.get(e);if(!l&&(!o||!o.dirty&&!o.deferred))return;const n=l||(o?.dirtySource??!1),a=l||(o?.dirtyDerived??!1);o?.timer&&(clearTimeout(o.timer),o.timer=void 0);const r=o?.deferred;o&&(o.dirty=!1,o.dirtySource=!1,o.dirtyDerived=!1,o.deferred=void 0,this.agentideRootUpdateState.set(e,o));try{let d=await this.readAgentideManifest(e);const c=a?await this.importNewSkillsFromDerivedIntoAgentide(e,t,d?.derivedSkillIngestState):{agentideContentChanged:!1,ingestStateChanged:!1,nextIngestState:d?.derivedSkillIngestState??{}};if(!d||l||n||c.agentideContentChanged||c.ingestStateChanged){if(d=await this.writeAgentideManifest(e,t,{derivedSkillIngestState:c.nextIngestState}),n)try{const h=path.join(e,AGENTIDE_DIR_NAME,AGENTIDE_AGENTS_DIR);if(await(0,utils_1.pathExists)(h)){const A=(await fs_1.promises.readdir(h,{withFileTypes:!0})).filter(m=>m.isDirectory()&&!m.name.startsWith(".")).length,S=await this.loadInstalledAgents(e);A>S.length&&await vscode.commands.executeCommand("agentide.pack.refresh")}}catch{}}else this.agentideSignatureByRoot.set(e,d.agentideSignature),this.agentideSkillsSignatureByRoot.set(e,d.skillsSignature);if(!d)return;const g=this.lastAgentideSyncSignatureByRoot.get(e),p=await this.allDerivedDirsPresent(e);if(n||c.agentideContentChanged||g!==d.agentideSignature||!p){const h=this.getActivePackId(e),f=await this.switchToPack(e,h,t);f!==h&&this.setActivePackId(e,f);const A=f??AGENTIDE_DEFAULT_AGENT_ID;await this.seedAgentDataIfNeeded(e,A,t),this.lastAgentideSyncSignatureByRoot.set(e,d.agentideSignature),t.appendLine(`[AgentIDE] Derived dirs synced for ${e} (sig=${d.agentideSignature}, pack=${f??"default"})`)}r?.resolve()}catch(d){r?.reject(d),t.appendLine(`[AgentIDE] Warning: failed agentide update for ${e}: ${d instanceof Error?d.message:String(d)}`)}}async ensureAgentideProjectPrepared(e,t,i){if(!e)return;const s=vscode.workspace.workspaceFolders?.map(n=>n.uri.fsPath)??[],l=(t??[]).filter(n=>s.includes(n)),o=Array.from(new Set([e,...l].map(n=>n.trim()).filter(Boolean))).filter(n=>n!==os.homedir());for(const n of o){await(0,utils_1.ensureWorkspaceGitAndGitignore)(n,i,{extraSearchPath:getConfiguredAdditionalEngineDir()});const a=this.getAgentideProjectDir(n);await fs_1.promises.mkdir(a,{recursive:!0}),await this.ensureAgentideGitignore(n,i),await this.ensureAgentideBundledPromptsCopiedToProject(n,i);const r=o.filter(d=>d!==n);await this.ensureAgentideContextTemplate(n,r,i),await this.ensureGhostTextPrompt(n,i),await this.ensureTerminalAssistPrompt(n,i),await this.syncRemoteSkillsIfEnabled(n,i,{force:!1})}for(const n of o){await this.flushAgentideRootUpdate(n,i,{force:!1,allowDuringActiveTurn:!0});const a=await this.allDerivedDirsPresent(n);let r=await this.readAgentideManifest(n);if(r?(this.agentideSignatureByRoot.set(n,r.agentideSignature),this.agentideSkillsSignatureByRoot.set(n,r.skillsSignature)):r=await this.writeAgentideManifest(n,i),this.lastAgentideSyncSignatureByRoot.get(n)===r.agentideSignature&&a){i.appendLine(`[AgentIDE] .agentide/ unchanged for ${n}, skipping sync`);continue}const c=this.getActivePackId(n),g=await this.switchToPack(n,c,i,{importDerivedSkills:!0});g!==c&&this.setActivePackId(n,g),this.lastAgentideSyncSignatureByRoot.set(n,r.agentideSignature),i.appendLine(`[AgentIDE] Sync complete for ${n} (sig: ${r.agentideSignature}, pack: ${g??"default"})`)}}async syncRemoteSkillsIfEnabled(e,t,i){const s=vscode.workspace.getConfiguration("agentide.skills.remote");if(!s.get("enabled",!1))return;const o=s.get("syncOnStartup",!0);if(!i.force&&!o)return;const n=s.get("registryUrl","").trim();if(!n){t.appendLine("[AgentIDE] Remote skills: enabled but agentide.skills.remote.registryUrl is empty");return}const a=s.get("timeoutMs",8e3),r=s.get("allowOverwriteLocal",!1);try{const d=this.getAgentSkillsDir(e,AGENTIDE_DEFAULT_AGENT_ID);(await(0,remoteSkills_1.syncRemoteSkillsToAgentideSkillsDir)(d,{registryUrl:n,timeoutMs:a,allowOverwriteLocal:r},g=>t.appendLine(g))).updated>0&&this.scheduleAgentideRootUpdate(e,t,"source")}catch(d){t.appendLine(`[AgentIDE] Remote skills: unexpected error: ${d instanceof Error?d.message:String(d)}`)}}async ensureAgentideBundledPromptsCopiedToProject(e,t){const i=this.getBundledBasePromptsDir();if(!i)return;const s=this.getAgentRoot(e,AGENTIDE_DEFAULT_AGENT_ID),l=this.getAgentAgentsFile(e,AGENTIDE_DEFAULT_AGENT_ID),o=this.getAgentRulesDir(e,AGENTIDE_DEFAULT_AGENT_ID),n=this.getAgentSkillsDir(e,AGENTIDE_DEFAULT_AGENT_ID);await fs_1.promises.mkdir(s,{recursive:!0}),await fs_1.promises.mkdir(o,{recursive:!0}),await fs_1.promises.mkdir(n,{recursive:!0});const a=path.join(i,"rules","AGENTS.md");if(!await(0,utils_1.pathExists)(l)&&await(0,utils_1.pathExists)(a))try{const g=await fs_1.promises.readFile(a,"utf8");await fs_1.promises.writeFile(l,(0,branding_1.applyBrandingTokens)(g)),t.appendLine(`[AgentIDE] Bootstrapped project rules: ${l}`)}catch(g){t.appendLine(`[AgentIDE] Warning: failed to bootstrap project rules: ${g instanceof Error?g.message:String(g)}`)}const r=path.join(i,"skills");if(await(0,utils_1.pathExists)(r))try{const g=await fs_1.promises.readdir(r,{withFileTypes:!0});for(const p of g){if(!p.isDirectory())continue;const h=path.join(r,p.name),f=path.join(n,p.name);await(0,utils_1.pathExists)(f)||(await(0,utils_1.copyDirRecursiveWithTransform)(h,f,branding_1.applyBrandingTokens),t.appendLine(`[AgentIDE] Bootstrapped project skill: ${p.name}`))}}catch(g){t.appendLine(`[AgentIDE] Warning: failed to bootstrap project skills: ${g instanceof Error?g.message:String(g)}`)}const d=path.join(s,paths_1.AGENT_CONSTANTS.MCP_DIR),c=path.join(d,".mcp.json");if(!await(0,utils_1.pathExists)(c))try{const g=await(0,mcp_1.getDefaultMcpConfig)(i);g&&(await fs_1.promises.mkdir(d,{recursive:!0}),await fs_1.promises.writeFile(c,g),t.appendLine(`[AgentIDE] Bootstrapped MCP config: ${c}`))}catch(g){t.appendLine(`[AgentIDE] Warning: failed to bootstrap MCP config: ${g instanceof Error?g.message:String(g)}`)}await this.ensureDefaultAgentYaml(e,t)}async ensureDefaultAgentYaml(e,t){const i=this.getAgentRoot(e,AGENTIDE_DEFAULT_AGENT_ID),s=path.join(i,AGENTIDE_AGENT_YAML);if(await(0,utils_1.pathExists)(s))return;await fs_1.promises.mkdir(i,{recursive:!0});const l=(0,paths_1.generateDefaultAgentYaml)({includeModelHintComment:!0});try{await fs_1.promises.writeFile(s,l,"utf8"),t.appendLine(`[AgentIDE] Bootstrapped default agent configuration: ${s}`)}catch(o){t.appendLine(`[AgentIDE] Warning: failed to create default agent.yaml: ${o instanceof Error?o.message:String(o)}`)}}async ensureAgentideGitignore(e,t){const i=this.getAgentideProjectDir(e),s=path.join(i,".gitignore"),l=["# AgentHippo (managed)","# Keep terminal logs and large per-session terminal attachments out of source control.","terminals/","agents/default","sessions","paths.md","sessions/**/terminal.md","sessions/**/terminal.md.1"];let o="";try{o=await fs_1.promises.readFile(s,"utf8")}catch(r){if((0,utils_1.getErrorCode)(r)!=="ENOENT"){t.appendLine(`[AgentIDE] Warning: failed to read .gitignore: ${r instanceof Error?r.message:String(r)}`);return}}if(l.every(r=>o.includes(r)))return;const a=[o.trimEnd(),"",l.join(`
6
6
  `),""].join(`
7
7
  `).replace(/^\n+/,"");try{await(0,utils_1.writeFileIfChanged)(s,a)&&t.appendLine(`[AgentIDE] Updated ${s} to ignore terminal logs`)}catch(r){t.appendLine(`[AgentIDE] Warning: failed to write .gitignore: ${r instanceof Error?r.message:String(r)}`)}}async ensureAgentideContextTemplate(e,t,i){const s=this.getAgentideProjectDir(e);if(!await(0,utils_1.pathExists)(s))return;const l=this.getActiveAgentId(e),o=this.getAgentContextFile(e,l);if(await(0,utils_1.pathExists)(o))return;const n=this.getBundledBasePromptsDir(),a=n?path.join(n,"templates","context.md"):void 0;if(!a||!await(0,utils_1.pathExists)(a)){i.appendLine("[AgentIDE] Warning: bundled context.md template not found");return}try{let r=await fs_1.promises.readFile(a,"utf8");r=r.replace(/\{\{workspaceRoot\}\}/g,e);const d=t.slice().filter(Boolean).sort(),c=/\{\{#additionalDirectories\}\}([\s\S]*?)\{\{\/additionalDirectories\}\}/,g=r.match(c);if(g){const p=g[1],h=d.length>0?d.map(f=>p.replace(/\{\{\.\}\}/g,f)).join(""):"";r=r.replace(c,h)}await fs_1.promises.mkdir(s,{recursive:!0}),await fs_1.promises.writeFile(o,r,"utf8"),i.appendLine(`[AgentIDE] Created context template: ${o}`)}catch(r){i.appendLine(`[AgentIDE] Warning: failed to copy context template: ${r instanceof Error?r.message:String(r)}`)}}async ensureGhostTextPrompt(e,t){await this.ensureBundledPromptFile(e,paths_1.AGENT_CONSTANTS.GHOST_TEXT_FILE,t)}async ensureTerminalAssistPrompt(e,t){await this.ensureBundledPromptFile(e,paths_1.AGENT_CONSTANTS.TERMINAL_ASSIST_FILE,t)}async ensureBundledPromptFile(e,t,i){const s=this.getAgentideProjectDir(e);if(!await(0,utils_1.pathExists)(s))return;const l=this.getActiveAgentId(e),o=path.join(s,"agents",l),n=path.join(o,t);if(await(0,utils_1.pathExists)(n))return;const a=this.getBundledBasePromptsDir(),r=a?path.join(a,t):void 0;if(!(!r||!await(0,utils_1.pathExists)(r)))try{await fs_1.promises.mkdir(o,{recursive:!0});const d=await fs_1.promises.readFile(r,"utf8");await fs_1.promises.writeFile(n,d,"utf8"),i.appendLine(`[AgentIDE] Created ${t}: ${n}`)}catch(d){i.appendLine(`[AgentIDE] Warning: failed to copy ${t}: ${d instanceof Error?d.message:String(d)}`)}}async importNewSkillsFromDerivedIntoAgentide(e,t,i){const s=this.getActiveAgentId(e),l=this.getAgentSkillsDir(e,s),o=getDerivedEngineSyncTargets(e).filter(d=>d.includeSkills).map(d=>path.join(e,d.workspaceDir,"skills"));await fs_1.promises.mkdir(l,{recursive:!0});const n={...i??{}};let a=!1,r=!1;for(const d of o)try{const c=await fs_1.promises.readdir(d,{withFileTypes:!0});for(const g of c){if(!g.isDirectory()||g.name.startsWith("."))continue;const p=path.join(d,g.name),h=path.join(p,"SKILL.md");if(!await(0,utils_1.pathExists)(h))continue;const f=path.join(l,g.name),A=path.join(f,"SKILL.md"),{sha256:S}=await(0,utils_1.readFileSha256)(h);if(!await(0,utils_1.pathExists)(f)){await(0,utils_1.copyDirRecursive)(p,f),a=!0,n[g.name]={lastIngestedSkillMdSha256:S,lastIngestedAt:new Date().toISOString()},r=!0,t.appendLine(`[AgentIDE] Imported new skill from derived dir: ${g.name} \u2192 ${s}`);continue}if(!await(0,utils_1.pathExists)(A))continue;const{sha256:m}=await(0,utils_1.readFileSha256)(A),u=n[g.name];if(!u&&S===m){n[g.name]={lastIngestedSkillMdSha256:m,lastIngestedAt:new Date().toISOString()},r=!0;continue}if(u){if(m!==u.lastIngestedSkillMdSha256){t.appendLine(`[AgentIDE] Skipped ingest for skill '${g.name}' (conflict: .agentide diverged from last ingested state)`);continue}S!==m&&(await fs_1.promises.copyFile(h,A),a=!0,n[g.name]={lastIngestedSkillMdSha256:S,lastIngestedAt:new Date().toISOString()},r=!0,t.appendLine(`[AgentIDE] Ingested updated SKILL.md from derived dir: ${g.name}`))}}}catch{}return{agentideContentChanged:a,ingestStateChanged:r,nextIngestState:n}}async readAgentideContextMd(e){const t=this.getActiveAgentId(e),i=this.getAgentContextFile(e,t);try{return await fs_1.promises.readFile(i,"utf8")}catch(s){if((0,utils_1.getErrorCode)(s)==="ENOENT")return;throw s}}async writeDerivedDirReadme(e,t,i,s){try{const l=path.join(e,AGENTIDE_DERIVED_DIR_README),o=t.charAt(0).toUpperCase()+t.slice(1),n=s&&s.length>0?s:["- `.agentide/agents/<agentId>/AGENTS.md` (project rules)","- `.agentide/agents/<agentId>/rules/*.md` (additional rule fragments)","- `.agentide/agents/<agentId>/skills/*/SKILL.md` (project skills)"],a=[`# Managed by ${branding_1.AGENTIDE_BRAND_NAME}`,"",`This directory is managed by the ${branding_1.AGENTIDE_BRAND_NAME} extension.`,"","## How It Works","","- **Skills** created here ARE synced back to `.agentide/agents/<id>/skills/`","- **Rules files** (`CLAUDE.md`, `AGENTS.md`) are generated from the source and **not synced back**"," - Edit rules in `.agentide/agents/<id>/AGENTS.md` instead","- The source-of-truth is in:",...n,"","## Tips","","- Create/edit skills here or in `.agentide/` - both will stay in sync","- To change project rules, edit `.agentide/agents/<id>/AGENTS.md` (not the rules file here)","- This folder exists for "+o+" auto-discovery compatibility",""].join(`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agenthippo-ai/agenthippo",
3
- "version": "1.110.26",
3
+ "version": "1.110.28",
4
4
  "description": "AgentHippo CLI — serve, chat, and deploy agent packs",
5
5
  "author": "AgentHippo <dev@agenthippo.ai>",
6
6
  "license": "SEE LICENSE IN LICENSE",
@@ -24,8 +24,8 @@
24
24
  "access": "public"
25
25
  },
26
26
  "dependencies": {
27
- "@anthropic-ai/claude-agent-sdk": "0.3.227",
28
- "@anthropic-ai/sdk": "0.116.0",
27
+ "@anthropic-ai/claude-agent-sdk": "0.3.257",
28
+ "@anthropic-ai/sdk": "0.123.0",
29
29
  "@cfworker/json-schema": "^4.1.1",
30
30
  "@mariozechner/pi-ai": "0.54.0",
31
31
  "@modelcontextprotocol/sdk": "^1.30.0",
@@ -38,7 +38,7 @@
38
38
  "zod": "^4.3.6"
39
39
  },
40
40
  "agenthippo": {
41
- "litellmImageTag": "0.2.14",
41
+ "litellmImageTag": "0.2.16",
42
42
  "hippoclawNpm": "@agenthippo-ai/hippoclaw@2026.7.28"
43
43
  }
44
44
  }