aegiscode 5.2.17 → 5.2.18
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/bin/cli.js +1 -1
- package/package.json +1 -1
package/bin/cli.js
CHANGED
|
@@ -1243,7 +1243,7 @@ ${W}`,metadata:{serverName:I,toolName:G.name,mcpResult:b}}}catch(b){let Z=b.mess
|
|
|
1243
1243
|
`;await md.appendFile(this.filePath,G,"utf-8")}async appendBatch(I){if(I.length===0)return;await md.mkdir(UcI.dirname(this.filePath),{recursive:!0});let G=I.map(c=>JSON.stringify(c)).join(`
|
|
1244
1244
|
`)+`
|
|
1245
1245
|
`;await md.appendFile(this.filePath,G,"utf-8")}async readAll(){if(!this.exists())return[];let G=(await md.readFile(this.filePath,"utf-8")).split(`
|
|
1246
|
-
`).filter(e=>e.trim().length>0),c=[];for(let e of G)try{c.push(JSON.parse(e))}catch{console.warn(`[JSONLStore] \u89E3\u6790 JSON \u884C\u5931\u8D25: ${e.substring(0,100)}...`)}return c}async readStream(I){return new Promise((G,c)=>{if(!this.exists()){G();return}let e=xal(this.filePath,{encoding:"utf-8"}),t=Bal({input:e,crlfDelay:Number.POSITIVE_INFINITY}),n=async b=>{let Z=b.trim();if(Z.length!==0)try{let W=JSON.parse(Z);await I(W)}catch{console.warn(`[JSONLStore] \u89E3\u6790\u5931\u8D25: ${Z.substring(0,50)}...`)}};t.on("line",b=>{n(b).catch(c)}),t.on("close",()=>G()),t.on("error",c),e.on("error",c)})}async readLast(I){return(await this.readAll()).slice(-I)}async filter(I){return(await this.readAll()).filter(I)}async count(){if(!this.exists())return 0;let I=0;return await this.readStream(()=>{I++}),I}async readAfterCompaction(){let I=await this.readAll(),G=-1;for(let c=I.length-1;c>=0;c--)if(I[c].subtype==="compact_boundary"){G=c;break}return G===-1?I:I.slice(G)}async clear(){this.exists()&&await md.writeFile(this.filePath,"","utf-8")}async delete(){this.exists()&&await md.unlink(this.filePath)}async getFileSize(){return this.exists()?(await md.stat(this.filePath)).size:0}}});var myI={};xG(myI,{default:()=>McI});var McI,OcI=y(()=>{McI={name:"aegiscode",version:"5.2.
|
|
1246
|
+
`).filter(e=>e.trim().length>0),c=[];for(let e of G)try{c.push(JSON.parse(e))}catch{console.warn(`[JSONLStore] \u89E3\u6790 JSON \u884C\u5931\u8D25: ${e.substring(0,100)}...`)}return c}async readStream(I){return new Promise((G,c)=>{if(!this.exists()){G();return}let e=xal(this.filePath,{encoding:"utf-8"}),t=Bal({input:e,crlfDelay:Number.POSITIVE_INFINITY}),n=async b=>{let Z=b.trim();if(Z.length!==0)try{let W=JSON.parse(Z);await I(W)}catch{console.warn(`[JSONLStore] \u89E3\u6790\u5931\u8D25: ${Z.substring(0,50)}...`)}};t.on("line",b=>{n(b).catch(c)}),t.on("close",()=>G()),t.on("error",c),e.on("error",c)})}async readLast(I){return(await this.readAll()).slice(-I)}async filter(I){return(await this.readAll()).filter(I)}async count(){if(!this.exists())return 0;let I=0;return await this.readStream(()=>{I++}),I}async readAfterCompaction(){let I=await this.readAll(),G=-1;for(let c=I.length-1;c>=0;c--)if(I[c].subtype==="compact_boundary"){G=c;break}return G===-1?I:I.slice(G)}async clear(){this.exists()&&await md.writeFile(this.filePath,"","utf-8")}async delete(){this.exists()&&await md.unlink(this.filePath)}async getFileSize(){return this.exists()?(await md.stat(this.filePath)).size:0}}});var myI={};xG(myI,{default:()=>McI});var McI,OcI=y(()=>{McI={name:"aegiscode",version:"5.2.18",description:"AEGIS CLI \u2014 AI-powered coding assistant",type:"module",bin:{aegis:"bin/cli.js","aegis-cli":"bin/cli.js",aegiscli:"bin/cli.js",aegiscode:"bin/cli.js"},scripts:{preinstall:"node scripts/ensure-node-version.mjs",build:"node esbuild.mjs","build:publish":"npm run build && node scripts/make-bin.mjs",dev:"NODE_NO_WARNINGS=1 tsx src/main.tsx",start:"node --no-deprecation dist/main.js",typecheck:"tsc --noEmit","test:prompts":"tsx src/prompts/test.ts","test:tools":"tsx src/tools/test.ts","test:pipeline":"tsx src/tools/execution/test.ts","test:context":"tsx src/context/test.ts","test:mcp":"tsx src/mcp/test.ts","test:store":"tsx src/store/test.ts"},keywords:["cli","ai","coding-agent","llm","openai","gpt","claude","copilot","assistant","terminal","developer-tools"],author:"Niklas Borneklint",license:"MIT",repository:{type:"git",url:"git+https://github.com/aegisinfo/aegiscode.git"},homepage:"https://github.com/aegisinfo/aegiscode#readme",bugs:{url:"https://github.com/aegisinfo/aegiscode/issues"},files:["bin/","scripts/","README.md","LICENSE"],engines:{node:">=18.0.0"},dependencies:{"@huggingface/transformers":"^4.2.0","@modelcontextprotocol/sdk":"^1.30.0",chalk:"^6.0.0",dotenv:"^17.4.2","fuse.js":"^7.4.1",glob:"^13.0.0",ink:"^7.1.1","ink-text-input":"^6.0.0","js-tiktoken":"^1.0.21",lowlight:"^3.3.0",minimatch:"^10.2.6",nanoid:"^6.0.0",openai:"^7.3.0",react:"^19.2.8","react-dom":"^19.2.8","sql.js":"^1.14.1","string-width":"^8.2.2",uuid:"^14.0.0",yaml:"^2.8.2",yargs:"^18.1.0",zod:"^4.4.3","zod-to-json-schema":"^3.25.2",zustand:"^5.0.14"},devDependencies:{"@types/node":"^26.1.2","@types/react":"^19.2.18","@types/sql.js":"^1.4.11","@types/yargs":"^17.0.35",esbuild:"^0.28.0",tsx:"^4.23.4",typescript:"^7.0.2"},overrides:{"string-width":"^8.2.2","slice-ansi":"^7.1.2","cli-truncate":"^4.0.0","cli-boxes":"^3.0.0"}}});var syI,aV,WyI=y(async()=>{"use strict";is();fcI();jy();syI="0.1.0";try{syI=(await Promise.resolve().then(()=>(OcI(),myI))).default.version||"0.1.0"}catch{}aV=class{projectPath;maxSessions;version;constructor(I=process.cwd(),G=100){this.projectPath=I,this.maxSessions=G,this.version=syI}getStore(I){let G=fy(this.projectPath,I);return new nV(G)}async saveMessage(I,G,c,e=null,t){let n=this.getStore(I),b={uuid:Ne(),parentUuid:e,sessionId:I,timestamp:new Date().toISOString(),type:G,cwd:this.projectPath,gitBranch:EW(this.projectPath),version:this.version,message:{role:G,content:c,...t||{}}};return await n.append(b),b.uuid}async saveToolUse(I,G,c,e,t=null){let n=this.getStore(I),b={uuid:Ne(),parentUuid:t,sessionId:I,timestamp:new Date().toISOString(),type:"tool_use",cwd:this.projectPath,gitBranch:EW(this.projectPath),version:this.version,message:{role:"assistant",content:""},tool:{id:G,name:c,input:e}};return await n.append(b),b.uuid}async saveToolResult(I,G,c,e,t=null){let n=this.getStore(I),b={uuid:Ne(),parentUuid:t,sessionId:I,timestamp:new Date().toISOString(),type:"tool_result",cwd:this.projectPath,gitBranch:EW(this.projectPath),version:this.version,message:{role:"assistant",content:""},toolResult:{id:G,output:c,error:e}};return await n.append(b),b.uuid}async saveCompaction(I,G,c,e=null){let t=this.getStore(I),n={uuid:Ne(),parentUuid:e,sessionId:I,timestamp:new Date().toISOString(),type:"system",subtype:"compact_boundary",cwd:this.projectPath,gitBranch:EW(this.projectPath),version:this.version,message:{role:"system",content:"=== \u4E0A\u4E0B\u6587\u538B\u7F29\u8FB9\u754C ==="},compactMetadata:c};await t.append(n);let b={uuid:Ne(),parentUuid:n.uuid,sessionId:I,timestamp:new Date().toISOString(),type:"user",isCompactSummary:!0,cwd:this.projectPath,version:this.version,message:{role:"user",content:G},compactMetadata:c};return await t.append(b),b.uuid}async loadSession(I){let G=this.getStore(I);if(!G.exists())return null;let c=await G.readAll();if(c.length===0)return null;let e=c[0];return{sessionId:I,preferences:{},startTime:new Date(e.timestamp).getTime()}}async loadConversation(I){let G=this.getStore(I);if(!G.exists())return null;let c=await G.readAfterCompaction(),e=[],t=0;for(let n of c){let b=new Date(n.timestamp).getTime();b>t&&(t=b),n.subtype!=="compact_boundary"&&(n.type==="user"||n.type==="assistant"||n.type==="system")&&e.push({id:n.uuid,role:n.message.role,content:typeof n.message.content=="string"?n.message.content:JSON.stringify(n.message.content),timestamp:b,metadata:n.isCompactSummary?{isCompactSummary:!0}:void 0})}return{messages:e,topics:[],lastActivity:t}}async listSessions(){let{readdir:I}=await import("node:fs/promises"),{getProjectStoragePath:G}=await Promise.resolve().then(()=>(jy(),KQI)),c=G(this.projectPath);try{return(await I(c)).filter(t=>t.endsWith(".jsonl")).map(t=>t.replace(".jsonl",""))}catch{return[]}}async deleteSession(I){await this.getStore(I).delete()}async getSessionStats(I){let G=this.getStore(I);if(!G.exists())return null;let c=await G.readAll(),e=await G.getFileSize();return c.length===0?{messageCount:0,fileSize:e,createdAt:null,lastUpdatedAt:null}:{messageCount:c.length,fileSize:e,createdAt:new Date(c[0].timestamp),lastUpdatedAt:new Date(c[c.length-1].timestamp)}}}});var bV,oyI=y(()=>{"use strict";bV=class{cache=new Map;maxSize;defaultTtl;constructor(I=100,G=300*1e3){this.maxSize=I,this.defaultTtl=G}set(I,G,c){this.cache.size>=this.maxSize&&!this.cache.has(I)&&this.evictLRU();let e=Date.now();this.cache.set(I,{value:G,createdAt:e,lastAccessedAt:e,ttl:c??this.defaultTtl})}get(I){let G=this.cache.get(I);if(!G)return;let c=Date.now();if(c-G.createdAt>G.ttl){this.cache.delete(I);return}return G.lastAccessedAt=c,G.value}has(I){let G=this.cache.get(I);return G?Date.now()-G.createdAt>G.ttl?(this.cache.delete(I),!1):!0:!1}delete(I){return this.cache.delete(I)}async getOrSet(I,G,c){let e=this.get(I);if(e!==void 0)return e;let t=await G();return this.set(I,t,c),t}evictLRU(){let I=null,G=1/0;for(let[c,e]of this.cache)e.lastAccessedAt<G&&(G=e.lastAccessedAt,I=c);I&&this.cache.delete(I)}cleanup(){let I=Date.now(),G=0;for(let[c,e]of this.cache)I-e.createdAt>e.ttl&&(this.cache.delete(c),G++);return G}clear(){this.cache.clear()}get size(){return this.cache.size}keys(){return Array.from(this.cache.keys())}getStats(){return{size:this.cache.size,maxSize:this.maxSize}}}});var jcI=y(async()=>{"use strict";ZyI();await WyI();oyI();fcI();jy()});import*as b1 from"node:fs/promises";import{existsSync as ScI}from"node:fs";import*as Ni from"node:path";var dV,KcI=y(()=>{"use strict";dV=class{static MAX_FILES=5;static MAX_LINES_PER_FILE=1e3;static MAX_CHARS_PER_FILE=5e4;static analyzeFiles(I){let G=new Map;return I.forEach((c,e)=>{if(c.content){let t=typeof c.content=="string"?c.content:JSON.stringify(c.content);this.extractFilePathsFromContent(t).forEach(b=>{this.updateFileReference(G,b,e,!1)})}if(c.tool_calls&&Array.isArray(c.tool_calls))for(let t of c.tool_calls){let n=this.extractFilePathsFromToolCall(t),b=["Write","Edit"].includes(t.function?.name||"");n.forEach(Z=>{this.updateFileReference(G,Z,e,b)})}}),Array.from(G.values()).filter(c=>this.isValidFilePath(c.path)).sort((c,e)=>c.wasModified!==e.wasModified?c.wasModified?-1:1:c.mentions!==e.mentions?e.mentions-c.mentions:e.lastMentioned-c.lastMentioned).slice(0,this.MAX_FILES)}static extractFilePathsFromContent(I){let G=[],c=[/(?:^|\s|["'`])(\/?(?:[\w.-]+\/)+[\w.-]+\.[a-zA-Z]{1,10})(?:\s|$|["'`]|:)/gm,/(?:^|\s|["'`])(\.\/(?:[\w.-]+\/)*[\w.-]+\.[a-zA-Z]{1,10})(?:\s|$|["'`]|:)/gm,/```\d+:\d+:([\w./-]+)/gm];for(let e of c){let t;for(;(t=e.exec(I))!==null;){let n=t[1];n&&!G.includes(n)&&G.push(n)}}return G}static extractFilePathsFromToolCall(I){let G=[],c=I.function?.name,e={};try{typeof I.function?.arguments=="string"?e=JSON.parse(I.function.arguments):I.function?.arguments&&(e=I.function.arguments)}catch{return G}if(["Read","Write","Edit","Glob","Grep","NotebookEdit"].includes(c||"")){let n=["file_path","path","notebook_path","filePath"];for(let b of n)e[b]&&typeof e[b]=="string"&&G.push(e[b])}return G}static updateFileReference(I,G,c,e){let t=I.get(G);t?(t.mentions++,t.lastMentioned=Math.max(t.lastMentioned,c),t.wasModified=t.wasModified||e):I.set(G,{path:G,mentions:1,lastMentioned:c,wasModified:e})}static isValidFilePath(I){let G=[/^https?:\/\//,/^node_modules\//,/^\.git\//,/\.(png|jpg|jpeg|gif|svg|ico|webp|mp4|mp3|wav|pdf|zip|tar|gz)$/i];for(let c of G)if(c.test(I))return!1;try{let c=Ni.isAbsolute(I)?I:Ni.join(process.cwd(),I);return ScI(c)}catch{return!1}}static async readFilesContent(I){let G=[];for(let c of I)try{let e=Ni.isAbsolute(c)?c:Ni.join(process.cwd(),c);if(!ScI(e))continue;let t=await b1.readFile(e,"utf-8"),n=t.split(`
|
|
1247
1247
|
`),b=!1,Z=t;n.length>this.MAX_LINES_PER_FILE&&(Z=n.slice(0,this.MAX_LINES_PER_FILE).join(`
|
|
1248
1248
|
`),b=!0),Z.length>this.MAX_CHARS_PER_FILE&&(Z=Z.substring(0,this.MAX_CHARS_PER_FILE),b=!0),b&&(Z+=`
|
|
1249
1249
|
|