aegiscode 5.1.9 → 5.2.0
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 +3 -3
- package/package.json +1 -1
package/bin/cli.js
CHANGED
|
@@ -1054,7 +1054,7 @@ ${N}`,metadata:{serverName:I,toolName:G.name,mcpResult:n}}}catch(n){let Z=n.mess
|
|
|
1054
1054
|
`;await dn.appendFile(this.filePath,G,"utf-8")}async appendBatch(I){if(I.length===0)return;await dn.mkdir(__.dirname(this.filePath),{recursive:!0});let G=I.map(c=>JSON.stringify(c)).join(`
|
|
1055
1055
|
`)+`
|
|
1056
1056
|
`;await dn.appendFile(this.filePath,G,"utf-8")}async readAll(){if(!this.exists())return[];let G=(await dn.readFile(this.filePath,"utf-8")).split(`
|
|
1057
|
-
`).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=Dtl(this.filePath,{encoding:"utf-8"}),t=Ttl({input:e,crlfDelay:Number.POSITIVE_INFINITY}),a=async n=>{let Z=n.trim();if(Z.length!==0)try{let N=JSON.parse(Z);await I(N)}catch{console.warn(`[JSONLStore] \u89E3\u6790\u5931\u8D25: ${Z.substring(0,50)}...`)}};t.on("line",n=>{a(n).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 dn.writeFile(this.filePath,"","utf-8")}async delete(){this.exists()&&await dn.unlink(this.filePath)}async getFileSize(){return this.exists()?(await dn.stat(this.filePath)).size:0}}});var ewI={};MG(ewI,{default:()=>l$});var l$,I$=J(()=>{l$={name:"aegiscode",version:"5.
|
|
1057
|
+
`).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=Dtl(this.filePath,{encoding:"utf-8"}),t=Ttl({input:e,crlfDelay:Number.POSITIVE_INFINITY}),a=async n=>{let Z=n.trim();if(Z.length!==0)try{let N=JSON.parse(Z);await I(N)}catch{console.warn(`[JSONLStore] \u89E3\u6790\u5931\u8D25: ${Z.substring(0,50)}...`)}};t.on("line",n=>{a(n).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 dn.writeFile(this.filePath,"","utf-8")}async delete(){this.exists()&&await dn.unlink(this.filePath)}async getFileSize(){return this.exists()?(await dn.stat(this.filePath)).size:0}}});var ewI={};MG(ewI,{default:()=>l$});var l$,I$=J(()=>{l$={name:"aegiscode",version:"5.2.0",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":"^3.8.1","@modelcontextprotocol/sdk":"^1.25.3",chalk:"^5.4.1",dotenv:"^17.4.2","fuse.js":"^7.4.1",glob:"^13.0.0",ink:"^7.0.5","ink-text-input":"^6.0.0","js-tiktoken":"^1.0.21",lowlight:"^3.3.0",minimatch:"^10.1.1",nanoid:"^5.1.6",openai:"^4.77.0",react:"^19.2.7","react-dom":"^19.2.7","sql.js":"^1.14.1","string-width":"^7.2.0",uuid:"^14.0.0",yaml:"^2.8.2",yargs:"^17.7.2",zod:"^3.24.2","zod-to-json-schema":"^3.25.1",zustand:"^5.0.14"},devDependencies:{"@types/node":"^22.19.19","@types/react":"^19.2.17","@types/sql.js":"^1.4.11","@types/yargs":"^17.0.35",esbuild:"^0.28.0",tsx:"^4.22.4",typescript:"^5.7.2"},overrides:{"string-width":"^7.2.0","slice-ansi":"^7.1.2","cli-truncate":"^4.0.0","cli-boxes":"^3.0.0"}}});var twI,lV,awI=J(async()=>{"use strict";is();$_();vg();twI="0.1.0";try{twI=(await Promise.resolve().then(()=>(I$(),ewI))).default.version||"0.1.0"}catch{}lV=class{projectPath;maxSessions;version;constructor(I=process.cwd(),G=100){this.projectPath=I,this.maxSessions=G,this.version=twI}getStore(I){let G=Qg(this.projectPath,I);return new IV(G)}async saveMessage(I,G,c,e=null,t){let a=this.getStore(I),n={uuid:_c(),parentUuid:e,sessionId:I,timestamp:new Date().toISOString(),type:G,cwd:this.projectPath,gitBranch:MW(this.projectPath),version:this.version,message:{role:G,content:c,...t||{}}};return await a.append(n),n.uuid}async saveToolUse(I,G,c,e,t=null){let a=this.getStore(I),n={uuid:_c(),parentUuid:t,sessionId:I,timestamp:new Date().toISOString(),type:"tool_use",cwd:this.projectPath,gitBranch:MW(this.projectPath),version:this.version,message:{role:"assistant",content:""},tool:{id:G,name:c,input:e}};return await a.append(n),n.uuid}async saveToolResult(I,G,c,e,t=null){let a=this.getStore(I),n={uuid:_c(),parentUuid:t,sessionId:I,timestamp:new Date().toISOString(),type:"tool_result",cwd:this.projectPath,gitBranch:MW(this.projectPath),version:this.version,message:{role:"assistant",content:""},toolResult:{id:G,output:c,error:e}};return await a.append(n),n.uuid}async saveCompaction(I,G,c,e=null){let t=this.getStore(I),a={uuid:_c(),parentUuid:e,sessionId:I,timestamp:new Date().toISOString(),type:"system",subtype:"compact_boundary",cwd:this.projectPath,gitBranch:MW(this.projectPath),version:this.version,message:{role:"system",content:"=== \u4E0A\u4E0B\u6587\u538B\u7F29\u8FB9\u754C ==="},compactMetadata:c};await t.append(a);let n={uuid:_c(),parentUuid:a.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(n),n.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 a of c){let n=new Date(a.timestamp).getTime();n>t&&(t=n),a.subtype!=="compact_boundary"&&(a.type==="user"||a.type==="assistant"||a.type==="system")&&e.push({id:a.uuid,role:a.message.role,content:typeof a.message.content=="string"?a.message.content:JSON.stringify(a.message.content),timestamp:n,metadata:a.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(()=>(vg(),hrI)),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 GV,dwI=J(()=>{"use strict";GV=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 G$=J(async()=>{"use strict";cwI();await awI();dwI();$_();vg()});import*as lA from"node:fs/promises";import{existsSync as c$}from"node:fs";import*as qo from"node:path";var cV,e$=J(()=>{"use strict";cV=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(n=>{this.updateFileReference(G,n,e,!1)})}if(c.tool_calls&&Array.isArray(c.tool_calls))for(let t of c.tool_calls){let a=this.extractFilePathsFromToolCall(t),n=["Write","Edit"].includes(t.function?.name||"");a.forEach(Z=>{this.updateFileReference(G,Z,e,n)})}}),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 a=t[1];a&&!G.includes(a)&&G.push(a)}}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 a=["file_path","path","notebook_path","filePath"];for(let n of a)e[n]&&typeof e[n]=="string"&&G.push(e[n])}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=qo.isAbsolute(I)?I:qo.join(process.cwd(),I);return c$(c)}catch{return!1}}static async readFilesContent(I){let G=[];for(let c of I)try{let e=qo.isAbsolute(c)?c:qo.join(process.cwd(),c);if(!c$(e))continue;let t=await lA.readFile(e,"utf-8"),a=t.split(`
|
|
1058
1058
|
`),n=!1,Z=t;a.length>this.MAX_LINES_PER_FILE&&(Z=a.slice(0,this.MAX_LINES_PER_FILE).join(`
|
|
1059
1059
|
`),n=!0),Z.length>this.MAX_CHARS_PER_FILE&&(Z=Z.substring(0,this.MAX_CHARS_PER_FILE),n=!0),n&&(Z+=`
|
|
1060
1060
|
|
|
@@ -1933,12 +1933,12 @@ ${R.join(`
|
|
|
1933
1933
|
`)[0];if(!/^```|^#{1,6}\s|^[-*+]\s|^\d+\.\s|^>\s|^\s*$|^\|/.test(k)){let M=A.blocks.slice(),O=M[M.length-1];if(O&&O.type==="text")return M[M.length-1]={...O,content:O.content+y},u.current={content:l,blocks:M},M}}let C=bV(l);return u.current={content:l,blocks:C},C},[l]),Y=(0,ye.useMemo)(()=>e?bV(e):[],[e]),R=(0,ye.useMemo)(()=>h.filter((A,C)=>A.type!=="empty"?!0:!(C===0||h[C-1].type==="empty")),[h]),F=(0,ye.useMemo)(()=>Y.filter(A=>A.type!=="empty"),[Y]),X=c&&N&&N.prefix?N.prefix.length+1:0,v=n&&n.some(A=>A.type==="tool_use"||A.type==="tool_result"),g=n&&n.length>0;return I==="user"?(0,XI.jsx)(rI,{flexDirection:"column",marginBottom:0,children:(0,XI.jsxs)(rI,{backgroundColor:Z.colors.background.secondary,flexDirection:"row",paddingX:1,children:[(0,XI.jsxs)(rI,{marginRight:1,flexShrink:0,children:[(0,XI.jsx)(cI,{color:Z.colors.primary,bold:!0,children:"You"}),(0,XI.jsx)(cI,{color:Z.colors.border.light,children:":"})]}),(0,XI.jsx)(rI,{flexGrow:1,children:(0,XI.jsx)(cI,{color:Z.colors.text.primary,wrap:"wrap",children:l})})]})}):(0,XI.jsxs)(rI,{flexDirection:"column",marginBottom:0,children:[g?(0,XI.jsx)(oZl,{contentBlocks:n,content:l,theme:Z,isStreaming:t,roleStyle:N,terminalWidth:G,prefixOffset:X}):(0,XI.jsxs)(XI.Fragment,{children:[!!e&&(0,XI.jsx)(rI,{flexDirection:"column",children:t?(0,XI.jsxs)(XI.Fragment,{children:[(0,XI.jsx)(rI,{children:(0,XI.jsxs)(cI,{color:Z.colors.text.secondary,children:[(0,XI.jsx)(VII,{}),(0,XI.jsx)(cI,{color:Z.colors.text.secondary,italic:!0,children:"thinking"})]})}),(0,XI.jsx)(rI,{flexDirection:"column",marginLeft:0,children:F.map((A,C)=>(0,XI.jsx)(rI,{children:(0,XI.jsx)(cI,{color:"#c0c0c0",italic:!0,children:A.content})},C))})]}):e.length>0?(0,XI.jsxs)(XI.Fragment,{children:[(0,XI.jsx)(rI,{children:(0,XI.jsxs)(cI,{color:Z.colors.text.secondary,children:[(0,XI.jsx)(cI,{color:Z.colors.primary,children:"\u25A1 "}),(0,XI.jsx)(cI,{color:Z.colors.text.secondary,italic:!0,children:"thought"})]})}),(0,XI.jsx)(rI,{flexDirection:"column",marginLeft:0,children:F.map((A,C)=>(0,XI.jsx)(rI,{children:(0,XI.jsx)(cI,{color:"#c0c0c0",italic:!0,children:A.content})},C))})]}):null}),R.map((A,C)=>(0,XI.jsx)(rII,{block:A,isFirst:C===0&&F.length===0,roleStyle:c?N:void 0,terminalWidth:G,theme:Z},C))]}),!g&&v&&(0,XI.jsx)(XZl,{contentBlocks:n,theme:Z,prefixOffset:X}),t&&(0,XI.jsx)(WyI,{prefixOffset:X,hasContent:l.length>0||(e?.length??0)>0})]})},hZl);NV.displayName="MessageRenderer";var oZl=ye.default.memo(({contentBlocks:l,content:I,theme:G,isStreaming:c,roleStyle:e,terminalWidth:t,prefixOffset:a})=>{let n=e&&e.prefix?e:void 0,Z=!1,N=()=>Z||!n?null:(Z=!0,(0,XI.jsx)(rI,{marginRight:1,children:(0,XI.jsx)(cI,{color:n.color,bold:n.bold,children:n.prefix})}));return(0,XI.jsxs)(XI.Fragment,{children:[l.map((p,u)=>{if(p.type==="thinking"){let h=c&&p.thinking.length>0,Y=bV(p.thinking).filter(R=>R.type!=="empty");return(0,XI.jsxs)(rI,{flexDirection:"column",children:[N(),h?(0,XI.jsxs)(XI.Fragment,{children:[(0,XI.jsx)(rI,{children:(0,XI.jsxs)(cI,{color:G.colors.text.secondary,children:[(0,XI.jsx)(VII,{}),(0,XI.jsx)(cI,{color:G.colors.text.secondary,italic:!0,children:"thinking"})]})}),(0,XI.jsx)(rI,{flexDirection:"column",marginLeft:2,children:Y.map((R,F)=>(0,XI.jsx)(rI,{children:(0,XI.jsx)(cI,{color:"#c0c0c0",italic:!0,children:R.content})},F))})]}):p.thinking?(0,XI.jsxs)(XI.Fragment,{children:[(0,XI.jsx)(rI,{children:(0,XI.jsxs)(cI,{color:G.colors.text.secondary,children:[(0,XI.jsx)(cI,{color:G.colors.primary,children:"\u25A1 "}),(0,XI.jsx)(cI,{color:G.colors.text.secondary,italic:!0,children:"thought"})]})}),(0,XI.jsx)(rI,{flexDirection:"column",marginLeft:2,children:Y.map((R,F)=>(0,XI.jsx)(rI,{children:(0,XI.jsx)(cI,{color:"#c0c0c0",italic:!0,children:R.content})},F))})]}):null]},`cb-think-${u}`)}if(p.type==="text"){let Y=bV(p.text).filter(R=>R.type!=="empty");return(0,XI.jsxs)(rI,{flexDirection:"column",children:[N(),Y.map((R,F)=>(0,XI.jsx)(rII,{block:R,isFirst:!1,roleStyle:void 0,terminalWidth:t,theme:G},F))]},`cb-text-${u}`)}if(p.type==="tool_use"){let h=l.find(Y=>Y.type==="tool_result"&&Y.tool_use_id===p.id);return(0,XI.jsx)(RII,{block:p,result:h,theme:G,prefixOffset:a},`cb-tool-${p.id||u}`)}return null}),I&&(!l||l.every(p=>p.type!=="text"))&&(0,XI.jsxs)(rI,{flexDirection:"column",children:[N(),bV(I).filter(p=>p.type!=="empty").map((p,u)=>(0,XI.jsx)(rII,{block:p,isFirst:!1,roleStyle:void 0,terminalWidth:t,theme:G},u))]},"remaining-text")]})},(l,I)=>l.contentBlocks===I.contentBlocks&&l.content===I.content&&l.isStreaming===I.isStreaming&&l.terminalWidth===I.terminalWidth&&l.prefixOffset===I.prefixOffset&&l.theme.colors===I.theme.colors),Ux=["#0055FF","#0077FF","#0099FF","#00AAFF","#00CCFF","#00EEFF","#00FFFF","#00EEFF","#00CCFF","#00AAFF","#0099FF","#0077FF"],nyI=["\u25DC","\u25DD","\u25DE","\u25DF"],iZl=120,ZyI=["\u258F","\u258E","\u258D","\u258C","\u258C","\u258D","\u258E","\u258F","\u258F"," "," "," "],YZl=65,WyI=ye.default.memo(({prefixOffset:l,hasContent:I})=>{let G=_G.getTheme(),[c,e]=(0,ye.useState)(0);(0,ye.useEffect)(()=>{e(0);let a=setInterval(()=>e(n=>(n+1)%(I?ZyI.length:nyI.length)),I?YZl:iZl);return()=>clearInterval(a)},[I]);let t=Ux[c%Ux.length];return(0,XI.jsx)(rI,{marginLeft:l,children:(0,XI.jsx)(cI,{color:I?G.colors.primary:t,children:I?ZyI[c]:nyI[c]})})});WyI.displayName="StreamingCursor";var myI=["\u25CC","\u25CB","\u25CE","\u25CF","\u25CE","\u25CB"],rZl=180,VII=ye.default.memo(()=>{let[l,I]=(0,ye.useState)(0);(0,ye.useEffect)(()=>{let c=setInterval(()=>I(e=>(e+1)%myI.length),rZl);return()=>clearInterval(c)},[]);let G=Ux[l%Ux.length];return(0,XI.jsxs)(cI,{color:G,children:[myI[l]," "]})});VII.displayName="ThinkingIcon";var RII=ye.default.memo(({block:l,result:I,theme:G,prefixOffset:c})=>{let e=l.status==="error",t=l.status==="running",a=e?Bx:t?QZl:YII,n=l.completedAt?FZl(l.completedAt-l.startedAt):null,Z=VZl(l.name,l.input),{label:N,path:p}=RZl(Z),u=[];if(I?.content){let h=I.content.split(`
|
|
1934
1934
|
`).filter(R=>R.trim()),Y=h.filter(R=>/^[+-]/.test(R)&&!R.startsWith("+++")&&!R.startsWith("---"));if(Y.length>0){let R=Y.filter(X=>X.startsWith("+")).length,F=Y.filter(X=>X.startsWith("-")).length;(R>0||F>0)&&u.push({text:`${R>0?`+${R}`:""}${F>0?` -${F}`:""} lines`,isUrl:!1}),Y.slice(0,5).forEach(X=>{u.push({text:X,isUrl:!1,isDiff:!0,diffType:X.startsWith("+")?"+":"-"})})}else h.slice(0,4).forEach(R=>{let F=R.length>100?R.slice(0,97)+"\u2026":R;u.push({text:F,isUrl:/^https?:\/\//.test(F)})})}return(0,XI.jsxs)(rI,{flexDirection:"column",marginLeft:c,children:[(0,XI.jsxs)(rI,{children:[(0,XI.jsx)(cI,{color:a,bold:!0,children:"\u25CF "}),(0,XI.jsx)(cI,{color:G.colors.text.primary,bold:!0,children:N}),p&&(0,XI.jsx)(cI,{color:e?Bx:YII,children:p}),n&&(0,XI.jsxs)(cI,{color:G.colors.text.muted,dimColor:!0,children:[" ",n]})]}),u.map((h,Y)=>(0,XI.jsxs)(rI,{marginLeft:2,children:[(0,XI.jsx)(cI,{color:G.colors.text.muted,dimColor:!0,children:Y===0?"\u2514 ":" "}),h.isDiff?(0,XI.jsx)(rI,{backgroundColor:h.diffType==="+"?"#0d2b0d":"#2b0d0d",children:(0,XI.jsx)(cI,{color:h.diffType==="+"?YII:Bx,children:h.text})}):h.isUrl?(0,XI.jsx)(cI,{color:"#58a6ff",underline:!0,children:h.text}):(0,XI.jsx)(cI,{color:e?Bx:G.colors.text.muted,dimColor:!e,children:h.text})]},Y))]})},(l,I)=>l.block===I.block&&l.result===I.result&&l.theme===I.theme&&l.prefixOffset===I.prefixOffset);RII.displayName="ToolUseBlock";function syI(l){if(l.length<=45)return l;let I=l.split("/");return I.length>3?"\u2026/"+I.slice(-2).join("/"):l}function VZl(l,I){if(!I)return l;try{let G=JSON.parse(I);switch(l){case"Read":case"Write":case"Edit":return`${l}(${syI(G.file_path||"")})`;case"Bash":{let c=(G.command||"").trim().replace(/\n/g," ");return`${l}(${c.length>60?c.slice(0,57)+"\u2026":c})`}case"Glob":return`${l}(${G.pattern||""})`;case"Grep":return`${l}(${G.pattern||""}${G.path?` in ${syI(G.path)}`:""})`;case"Task":{let c=Array.isArray(G.tasks)?G.tasks:[];if(c.length===0)return l;let e=String(c[0]?.description||""),t=c.length>1?`${e} +${c.length-1} more`:e;return`${l}(${t.length>45?t.slice(0,42)+"\u2026":t})`}default:{let c=Object.entries(G);if(c.length===0)return l;let[,e]=c[0],t=String(e);return`${l}(${t.length>45?t.slice(0,42)+"\u2026":t})`}}}catch{return l}}function RZl(l){let I=l.match(/^([^(]+)(\(.+\))$/);return I?{label:I[1],path:I[2]}:{label:l,path:""}}function FZl(l){return l<1e3?`${l}ms`:`${(l/1e3).toFixed(1)}s`}var YII="#3fb950",Bx="#f85149",QZl="#e3b341",XZl=ye.default.memo(({contentBlocks:l,theme:I,prefixOffset:G})=>l.filter(e=>e.type==="tool_use").length===0?null:(0,XI.jsx)(rI,{flexDirection:"column",children:l.map((e,t)=>{if(e.type!=="tool_use")return null;let a=l.find(n=>n.type==="tool_result"&&n.tool_use_id===e.id);return(0,XI.jsx)(RII,{block:e,result:a,theme:I,prefixOffset:0},`action-${e.id||t}`)})}),(l,I)=>l.contentBlocks===I.contentBlocks&&l.theme===I.theme&&l.prefixOffset===I.prefixOffset),rII=ye.default.memo(({block:l,isFirst:I,roleStyle:G,terminalWidth:c,theme:e})=>{let t=G?.prefix.length??0,a=c-t-2;if(l.type==="empty")return null;let n=G&&G.prefix?G:void 0;return(0,XI.jsxs)(rI,{flexDirection:"row",children:[I&&n&&(0,XI.jsx)(rI,{marginRight:1,children:(0,XI.jsx)(cI,{color:n.color,bold:n.bold,children:n.prefix})}),!I&&n&&(0,XI.jsx)(rI,{width:t+1}),(0,XI.jsx)(rI,{flexGrow:1,flexShrink:1,children:l.type==="code"?(0,XI.jsx)(HZl,{content:l.content,language:l.language,filePath:l.filePath,theme:e}):l.type==="heading"?(0,XI.jsx)(vZl,{content:l.content,level:l.level||1,theme:e}):l.type==="list"?(0,XI.jsx)(wZl,{content:l.content,listType:l.listType,marker:l.marker,indent:l.indent,theme:e}):l.type==="hr"?(0,XI.jsx)(EZl,{width:a,theme:e}):l.type==="table"&&l.tableData?(0,XI.jsx)(CZl,{headers:l.tableData.headers,rows:l.tableData.rows,alignments:l.tableData.alignments,theme:e,maxWidth:a}):l.type==="blockquote"?(0,XI.jsx)(JZl,{content:l.content,theme:e}):(0,XI.jsx)(kZl,{content:l.content,theme:e})})]})},(l,I)=>l.block===I.block&&l.isFirst===I.isFirst&&l.terminalWidth===I.terminalWidth&&l.theme===I.theme),HZl=({content:l,language:I,filePath:G})=>(0,XI.jsx)(ayI,{content:l,language:I,filePath:G,showLineNumbers:!0}),vZl=({content:l,level:I,theme:G})=>{let c=I===1?G.colors.primary:I===2?G.colors.secondary:I===3?G.colors.accent:G.colors.text.primary,e=I<=2?1:0,t=I===1,a=/\*\*|`|~~|\[.*\]\(/.test(l);return(0,XI.jsx)(rI,{flexDirection:"column",marginY:e,children:a?(0,XI.jsx)(cI,{color:c,bold:!0,underline:t,children:(0,XI.jsx)(zZl,{content:l,theme:G,baseColor:c})}):(0,XI.jsx)(cI,{color:c,bold:!0,underline:t,children:l})})},wZl=({content:l,listType:I,marker:G,indent:c=0,theme:e})=>{let t=" ".repeat(Math.floor(c/2)),a=I==="ol"?e.colors.info:e.colors.success;return(0,XI.jsxs)(rI,{children:[(0,XI.jsxs)(cI,{children:[t,(0,XI.jsx)(cI,{color:a,children:G||"\u2022"})," "]}),(0,XI.jsx)(cI,{wrap:"wrap",children:(0,XI.jsx)(FII,{content:l,theme:e})})]})},EZl=({width:l,theme:I})=>(0,XI.jsx)(rI,{marginY:1,children:(0,XI.jsx)(cI,{color:I.colors.border.light,children:"\u2500".repeat(Math.max(l,10))})}),fx=l=>l.replace(/\*\*(.+?)\*\*/g,"$1").replace(/\*(.+?)\*/g,"$1").replace(/`([^`]+)`/g,"$1").replace(/~~(.+?)~~/g,"$1").replace(/\[([^\]]+)\]\([^)]+\)/g,"$1");function gZl(l,I){let G=l.trim().toLowerCase();return/^(before|old|previous|removed?|from)$/.test(G)?I.colors.error:/^(after|new|updated?|added?|to)$/.test(G)?I.colors.success:null}var yZl=6,NyI="\u2026";function AZl(l,I){let G=fx(l);if(bt(G)<=I)return pyI(l,I,"left");let e=0,t=0,a=[...l];for(;t<a.length;t++){let n=a[t];if(e+=bt(n),e>I-1)break}return l.slice(0,t)+NyI}function pyI(l,I,G){let c=bt(fx(l)),e=Math.max(0,I-c);if(G==="center"){let t=Math.floor(e/2),a=e-t;return" ".repeat(t)+l+" ".repeat(a)}return G==="right"?" ".repeat(e)+l:l+" ".repeat(e)}var CZl=({headers:l,rows:I,alignments:G,theme:c,maxWidth:e})=>{let t=1+l.length*2,a=e-t-2,n=l.map((R,F)=>{let X=bt(fx(R)),v=Math.max(0,...I.map(g=>bt(fx(g[F]||""))));return Math.max(X,v)+2}),Z=n.reduce((R,F)=>R+F,0),N=Z<=a?n:n.map(R=>Math.max(yZl,Math.floor(R*(a/Z)))),p=Z>a,u=l.map(R=>gZl(R,c)),h=u.some(R=>R!==null),Y=(R,F,X)=>p?AZl(R,F):pyI(R,F,X);return(0,XI.jsxs)(rI,{flexDirection:"column",marginY:1,children:[(0,XI.jsxs)(rI,{children:[(0,XI.jsx)(cI,{color:c.colors.border.light,children:"\u2502"}),l.map((R,F)=>{let X=u[F];return(0,XI.jsxs)(ye.default.Fragment,{children:[(0,XI.jsx)(cI,{bold:!0,color:X??c.colors.primary,children:Y(R,N[F],G[F]||"left")}),(0,XI.jsx)(cI,{color:c.colors.border.light,children:"\u2502"})]},F)})]}),(0,XI.jsxs)(rI,{children:[(0,XI.jsx)(cI,{color:c.colors.border.light,children:"\u251C"}),N.map((R,F)=>(0,XI.jsxs)(ye.default.Fragment,{children:[(0,XI.jsx)(cI,{color:c.colors.border.light,children:"\u2500".repeat(R)}),(0,XI.jsx)(cI,{color:c.colors.border.light,children:F<N.length-1?"\u253C":"\u2524"})]},F))]}),I.map((R,F)=>(0,XI.jsxs)(rI,{children:[(0,XI.jsx)(cI,{color:c.colors.border.light,children:"\u2502"}),l.map((X,v)=>{let g=R[v]||"",A=Y(g,N[v],G[v]||"left"),C=u[v],y=/\*\*|`|~~|\[.*\]\(/.test(g);return(0,XI.jsxs)(ye.default.Fragment,{children:[C?(0,XI.jsx)(cI,{color:C,dimColor:F%2===0,children:A}):y?(0,XI.jsx)(cI,{children:(0,XI.jsx)(FII,{content:A,theme:c})}):(0,XI.jsx)(cI,{children:A}),(0,XI.jsx)(cI,{color:c.colors.border.light,children:"\u2502"})]},v)})]},F)),p&&(0,XI.jsx)(rI,{children:(0,XI.jsx)(cI,{dimColor:!0,color:c.colors.text.secondary,children:` \u255A\u2550\u2550 ${NyI} columns scaled to fit terminal width (${e} cols)`})})]})},JZl=({content:l,theme:I})=>(0,XI.jsxs)(rI,{children:[(0,XI.jsx)(cI,{color:I.colors.border.light,children:"\u2502 "}),(0,XI.jsx)(cI,{color:I.colors.text.muted,italic:!0,wrap:"wrap",children:l})]}),uyI=/^\s{2,}(\S+)\s*(.*?)\s*(✓|✗.*)$/,LZl=({content:l,theme:I})=>{let G=l.match(uyI);if(!G)return(0,XI.jsx)(cI,{dimColor:!0,children:l});let[,c,e,t]=G,a=t.startsWith("\u2717");return(0,XI.jsxs)(rI,{children:[(0,XI.jsx)(cI,{dimColor:!0,color:I.colors.text.muted,children:" "}),(0,XI.jsx)(cI,{dimColor:!0,color:I.colors.text.secondary,children:c}),e?(0,XI.jsxs)(cI,{dimColor:!0,color:I.colors.text.muted,children:[" ",e]}):null,(0,XI.jsxs)(cI,{dimColor:!0,color:a?I.colors.error:I.colors.success,children:[" ",t]})]})},kZl=({content:l,theme:I})=>uyI.test(l)?(0,XI.jsx)(LZl,{content:l,theme:I}):(0,XI.jsx)(cI,{wrap:"wrap",children:(0,XI.jsx)(FII,{content:l,theme:I})}),zZl=({content:l,theme:I,baseColor:G})=>{let c=hyI(l);return(0,XI.jsx)(XI.Fragment,{children:c.map((e,t)=>{switch(e.type){case"bold":return(0,XI.jsx)(cI,{bold:!0,color:I.colors.text.primary,children:e.text},t);case"code":return(0,XI.jsx)(cI,{color:I.colors.accent,children:e.text},t);case"strikethrough":return(0,XI.jsx)(cI,{strikethrough:!0,color:I.colors.text.muted,children:e.text},t);case"link":return(0,XI.jsx)(cI,{color:I.colors.info,underline:!0,children:e.text},t);default:return(0,XI.jsx)(cI,{children:e.text},t)}})})},FII=({content:l,theme:I})=>{let G=hyI(l);return(0,XI.jsx)(XI.Fragment,{children:G.map((c,e)=>{switch(c.type){case"bold":return(0,XI.jsx)(cI,{bold:!0,color:I.colors.text.primary,children:c.text},e);case"italic":return(0,XI.jsx)(cI,{italic:!0,color:I.colors.text.primary,children:c.text},e);case"code":return(0,XI.jsx)(cI,{color:I.colors.accent,children:c.text},e);case"strikethrough":return(0,XI.jsx)(cI,{strikethrough:!0,color:I.colors.text.muted,children:c.text},e);case"link":return(0,XI.jsx)(cI,{color:I.colors.info,underline:!0,children:c.text},e);default:return(0,XI.jsx)(cI,{color:I.colors.text.primary,children:c.text},e)}})})};function hyI(l){let I=[],G=[{type:"code",regex:/`([^`]+)`/g,group:1},{type:"bold",regex:/\*\*([^*]+)\*\*/g,group:1},{type:"strikethrough",regex:/~~([^~]+)~~/g,group:1},{type:"italic",regex:/(?<!\*)\*([^*]+)\*(?!\*)/g,group:1},{type:"link",regex:/\[([^\]]+)\]\([^)]+\)/g,group:1}],c=[];for(let{type:t,regex:a,group:n}of G){let Z;for(a.lastIndex=0;(Z=a.exec(l))!==null;){let N=Z.index,p=Z.index+Z[0].length;c.some(h=>N>=h.start&&N<h.end||p>h.start&&p<=h.end)||c.push({type:t,text:Z[n],start:N,end:p})}}c.sort((t,a)=>t.start-a.start);let e=0;for(let t of c)t.start>e&&I.push({type:"text",text:l.slice(e,t.start)}),I.push({type:t.type,text:t.text}),e=t.end;return e<l.length&&I.push({type:"text",text:l.slice(e)}),I.length===0?[{type:"text",text:l}]:I}var YG=OI(Jl(),1);await Dt();var Ma=OI(Jl(),1);await Dt();zv();var XII=OI(ac(),1),QII={TIMEOUT_MS:100,RAPID_INPUT_THRESHOLD_MS:400,LARGE_INPUT_THRESHOLD:100},HII=(0,Ma.memo)(({value:l,cursorPosition:I,onChange:G,onChangeCursorPosition:c,onSubmit:e,onPaste:t,onArrowUp:a,onArrowDown:n,placeholder:Z="",focusId:N="main-input",disabled:p=!1,cursorOn:u=!0})=>{let Y=iw(N)&&!p,R=(0,Ma.useRef)(l),F=(0,Ma.useRef)(I),X=(0,Ma.useRef)(G),v=(0,Ma.useRef)(c),g=(0,Ma.useRef)(e),A=(0,Ma.useRef)(t),C=(0,Ma.useRef)(a),y=(0,Ma.useRef)(n),k=(0,Ma.useRef)(Y);R.current=l,F.current=I,X.current=G,v.current=c,g.current=e,A.current=t,C.current=a,y.current=n,k.current=Y;let M=(0,Ma.useMemo)(()=>{if(!Y)return l||Xe.dim(Z);if(l.length===0)return(u?Xe.bgHex("#00c8b4").hex("#000000")(" "):" ")+Xe.dim(Z);let D=Xe.hex("#c0c0c0"),j=D(l.slice(0,I)),$=l[I]??" ",II=D(l.slice(I+1)),_=u?Xe.bgHex("#00c8b4").hex("#000000")($):D($);return j+_+II},[l,I,Y,Z,u]),O=(0,Ma.useRef)({chunks:[],timeoutId:null,firstInputTime:null}),x=(0,Ma.useCallback)(D=>{let j=R.current,$=F.current,II=D.trimEnd();if(A.current){let T=A.current(D);if(T?.prompt){X.current(j+T.prompt),v.current(j.length+T.prompt.length);return}}let _=j.slice(0,$)+II+j.slice($);X.current(_),v.current($+II.length)},[]),S=(0,Ma.useCallback)((D,j)=>{if(Un.getCurrentFocus()!==N||!k.current)return;let $=R.current,II=F.current,_=Date.now(),T=O.current,lI=T.firstInputTime?_-T.firstInputTime:0;if((D.length>QII.LARGE_INPUT_THRESHOLD||D.includes(`
|
|
1935
1935
|
`)||lI<QII.RAPID_INPUT_THRESHOLD_MS&&T.chunks.length>0)&&D.length>1){T.chunks.push(D),T.firstInputTime||(T.firstInputTime=_),T.timeoutId&&clearTimeout(T.timeoutId),T.timeoutId=setTimeout(()=>{let pI=T.chunks.join("");x(pI),T.chunks=[],T.timeoutId=null,T.firstInputTime=null},QII.TIMEOUT_MS);return}let AI=["/multi","/multiyolo","/research","/build","/forge","/council"].some(pI=>$.trimStart().startsWith(pI));if(j.return){if(AI&&!j.shift){let pI=$.slice(0,II)+`
|
|
1936
|
-
`+$.slice(II);X.current(pI),v.current(II+1)}else g.current?.($);return}if(j.leftArrow){II>0&&v.current(II-1);return}if(j.rightArrow){II<$.length&&v.current(II+1);return}if(j.upArrow){C.current?.();return}if(j.downArrow){y.current?.();return}if(j.backspace||j.delete){if(II>0){let pI=$.slice(0,II-1)+$.slice(II);X.current(pI),v.current(II-1)}return}if(j.ctrl&&D==="a"){v.current(0);return}if(j.ctrl&&D==="e"){v.current($.length);return}if(j.ctrl&&D==="k"){X.current($.slice(0,II));return}if(j.ctrl&&D==="u"){X.current($.slice(II)),v.current(0);return}if(D&&!j.ctrl&&!j.meta){let pI=$.slice(0,II)+D+$.slice(II);X.current(pI),v.current(II+D.length)}},[N,x]);return je(S,{isActive:Y}),(0,XII.jsx)(cI,{children:!Y&&l.length===0?(0,XII.jsx)(cI,{dimColor:!0,children:Z}):M})},(l,I)=>l.value===I.value&&l.cursorPosition===I.cursorPosition&&l.cursorOn===I.cursorOn&&l.placeholder===I.placeholder&&l.disabled===I.disabled&&l.focusId===I.focusId);HII.displayName="CustomTextInput";var Gi=OI(Jl(),1);await Dt();nV();zd();var As=OI(ac(),1),oyI=({input:l,cursorPosition:I,onSelectSuggestion:G,visible:c})=>{let[e,t]=Gi.default.useState(0),a=_G.getTheme(),n=(0,Gi.useRef)(l);(0,Gi.useEffect)(()=>{n.current!==l&&(t(0),n.current=l)},[l]);let Z=(0,Gi.useMemo)(()=>{if(!c||!l.startsWith("/"))return[];let p=l.slice(0,I),u=cII(p);return p.trim()==="/"?u.sort((Y,R)=>Y.command.localeCompare(R.command)):u.sort((Y,R)=>(R.matchScore??0)-(Y.matchScore??0)),u},[l,I,c]),N=Math.min(e,Math.max(0,Z.length-1));return je((p,u)=>{if(!(!c||Z.length===0)&&Un.getCurrentFocus()==="main-input"){if(u.tab&&!u.shift){let h=(N+1)%Z.length;t(h);return}if(u.tab&&u.shift){let h=N<=0?Z.length-1:N-1;t(h);return}if(u.return&&Z.length>0){let h=Z[N];if(h){let Y=l.slice(0,I),R=l.slice(I),F=Y.lastIndexOf("/");if(F!==-1){let v=`${Y.slice(0,F)}${h.command} `;G(v+R)}}}}},{isActive:c&&Z.length>0}),!c||Z.length===0?null:(0,As.jsxs)(rI,{flexDirection:"column",marginLeft:1,marginBottom:0,borderStyle:"round",borderColor:a.colors.border.light,paddingX:1,paddingY:0,children:[(0,As.jsxs)(cI,{dimColor:!0,children:["Commands (",Z.length,"):"]}),Z.map((p,u)=>{let h=u===N;return(0,As.jsx)(rI,{flexDirection:"row",children:(0,As.jsxs)(cI,{children:[h?(0,As.jsx)(cI,{color:a.colors.primary,bold:!0,children:">"}):(0,As.jsx)(cI,{children:" "})," ",(0,As.jsx)(cI,{color:h?a.colors.primary:void 0,bold:h,children:p.command}),(0,As.jsxs)(cI,{color:a.colors.text.muted,children:[" \u2014 ",p.description]})]})},p.command)}),(0,As.jsx)(cI,{dimColor:!0,children:"Tab/Shift+Tab to navigate \xB7 Enter to select"})]})};zd();gt();YF();Qh();var xd=OI(ac(),1),iyI=["\u25DC","\u25DD","\u25DE","\u25DF"],xZl=
|
|
1936
|
+
`+$.slice(II);X.current(pI),v.current(II+1)}else g.current?.($);return}if(j.leftArrow){II>0&&v.current(II-1);return}if(j.rightArrow){II<$.length&&v.current(II+1);return}if(j.upArrow){C.current?.();return}if(j.downArrow){y.current?.();return}if(j.backspace||j.delete){if(II>0){let pI=$.slice(0,II-1)+$.slice(II);X.current(pI),v.current(II-1)}return}if(j.ctrl&&D==="a"){v.current(0);return}if(j.ctrl&&D==="e"){v.current($.length);return}if(j.ctrl&&D==="k"){X.current($.slice(0,II));return}if(j.ctrl&&D==="u"){X.current($.slice(II)),v.current(0);return}if(D&&!j.ctrl&&!j.meta){let pI=$.slice(0,II)+D+$.slice(II);X.current(pI),v.current(II+D.length)}},[N,x]);return je(S,{isActive:Y}),(0,XII.jsx)(cI,{children:!Y&&l.length===0?(0,XII.jsx)(cI,{dimColor:!0,children:Z}):M})},(l,I)=>l.value===I.value&&l.cursorPosition===I.cursorPosition&&l.cursorOn===I.cursorOn&&l.placeholder===I.placeholder&&l.disabled===I.disabled&&l.focusId===I.focusId);HII.displayName="CustomTextInput";var Gi=OI(Jl(),1);await Dt();nV();zd();var As=OI(ac(),1),oyI=({input:l,cursorPosition:I,onSelectSuggestion:G,visible:c})=>{let[e,t]=Gi.default.useState(0),a=_G.getTheme(),n=(0,Gi.useRef)(l);(0,Gi.useEffect)(()=>{n.current!==l&&(t(0),n.current=l)},[l]);let Z=(0,Gi.useMemo)(()=>{if(!c||!l.startsWith("/"))return[];let p=l.slice(0,I),u=cII(p);return p.trim()==="/"?u.sort((Y,R)=>Y.command.localeCompare(R.command)):u.sort((Y,R)=>(R.matchScore??0)-(Y.matchScore??0)),u},[l,I,c]),N=Math.min(e,Math.max(0,Z.length-1));return je((p,u)=>{if(!(!c||Z.length===0)&&Un.getCurrentFocus()==="main-input"){if(u.tab&&!u.shift){let h=(N+1)%Z.length;t(h);return}if(u.tab&&u.shift){let h=N<=0?Z.length-1:N-1;t(h);return}if(u.return&&Z.length>0){let h=Z[N];if(h){let Y=l.slice(0,I),R=l.slice(I),F=Y.lastIndexOf("/");if(F!==-1){let v=`${Y.slice(0,F)}${h.command} `;G(v+R)}}}}},{isActive:c&&Z.length>0}),!c||Z.length===0?null:(0,As.jsxs)(rI,{flexDirection:"column",marginLeft:1,marginBottom:0,borderStyle:"round",borderColor:a.colors.border.light,paddingX:1,paddingY:0,children:[(0,As.jsxs)(cI,{dimColor:!0,children:["Commands (",Z.length,"):"]}),Z.map((p,u)=>{let h=u===N;return(0,As.jsx)(rI,{flexDirection:"row",children:(0,As.jsxs)(cI,{children:[h?(0,As.jsx)(cI,{color:a.colors.primary,bold:!0,children:">"}):(0,As.jsx)(cI,{children:" "})," ",(0,As.jsx)(cI,{color:h?a.colors.primary:void 0,bold:h,children:p.command}),(0,As.jsxs)(cI,{color:a.colors.text.muted,children:[" \u2014 ",p.description]})]})},p.command)}),(0,As.jsx)(cI,{dimColor:!0,children:"Tab/Shift+Tab to navigate \xB7 Enter to select"})]})};zd();gt();YF();Qh();var xd=OI(ac(),1),iyI=["\u25DC","\u25DD","\u25DE","\u25DF"],xZl=200,ryI=(0,YG.memo)(({isProcessing:l,lockedIn:I,glowPhase:G,color:c,idleColor:e})=>{let[t,a]=(0,YG.useState)(0);if((0,YG.useEffect)(()=>{if(l){a(0);let n=setInterval(()=>a(Z=>(Z+1)%iyI.length),xZl);return()=>clearInterval(n)}else a(0)},[l]),l){let n=I?YyI[G%YyI.length]:c;return(0,xd.jsx)(cI,{color:n,bold:!0,children:iyI[t]})}return(0,xd.jsx)(cI,{color:e,bold:!0,children:"\u25A1"})});ryI.displayName="PromptGlyph";var YyI=["#0055FF","#0077FF","#0099FF","#00AAFF","#00CCFF","#00EEFF","#00FFFF","#00EEFF","#00CCFF","#00AAFF","#0099FF","#0077FF"],vII=YG.default.memo(({onSubmit:l})=>{let I=(0,YG.useRef)(l);(0,YG.useEffect)(()=>{I.current=l});let G=(0,YG.useRef)([]),c=(0,YG.useRef)(-1),e=(0,YG.useCallback)(VI=>{if(VI.trim()){let _I=G.current;_I[_I.length-1]!==VI&&(_I.push(VI),_I.length>100&&_I.shift())}c.current=-1},[]),t=(0,YG.useCallback)(()=>{let VI=G.current;return VI.length===0?null:c.current<VI.length-1?(c.current++,VI[VI.length-1-c.current]):VI[0]},[]),a=(0,YG.useCallback)(()=>c.current>0?(c.current--,G.current[G.current.length-1-c.current]):(c.current=-1,""),[]),n=_G.getTheme(),Z=y4(),N=o2(),p=A4(),[u,h]=(0,YG.useState)(null),Y=(0,YG.useRef)(null),[R,F]=(0,YG.useState)(0),[X,v]=(0,YG.useState)(0),g=(0,YG.useRef)(null);(0,YG.useEffect)(()=>(Z?(F(0),v(0),g.current=setInterval(()=>{F(_I=>_I+1);let VI=_Y();VI&&v(Math.ceil(VI.content.length/4))},2e3)):(g.current&&(clearInterval(g.current),g.current=null),F(0),v(0)),()=>{g.current&&(clearInterval(g.current),g.current=null)}),[Z]);let[A,C]=(0,YG.useState)(()=>FG().session.messages.some(VI=>VI.isStreaming));(0,YG.useEffect)(()=>{let VI=A;return $d.subscribe(yl=>{let Pl=yl.session.messages,nG=Pl[Pl.length-1]?.isStreaming??!1;nG!==VI&&(VI=nG,C(nG))})},[]);let[y,k]=(0,YG.useState)(0),M=(0,YG.useRef)(null);(0,YG.useEffect)(()=>(Z&&!A?(k(0),M.current=setInterval(()=>k(VI=>VI+1),240)):(M.current&&(clearInterval(M.current),M.current=null),Z||k(0)),()=>{M.current&&(clearInterval(M.current),M.current=null)}),[Z,A]);let[O,x]=(0,YG.useState)(!0),S=(0,YG.useRef)(null);(0,YG.useEffect)(()=>(Z?(S.current&&(clearInterval(S.current),S.current=null),x(!0)):(x(!0),S.current=setInterval(()=>x(VI=>!VI),800)),()=>{S.current&&(clearInterval(S.current),S.current=null)}),[Z]);let D=Z?Math.floor(y/5)%2===0:O,j=(0,YG.useMemo)(()=>{if(!Z)return null;let VI=p?.slice(0,80),_I=VI?` \xB7 locked: ${VI}`:"",yl=R>=2?` \xB7 ${R}s`:"",Pl=X>0?` \xB7 ~${X}t`:"";return A?`generating${Pl}${yl}${_I}`:`thinking${yl}${_I}`},[Z,A,R,X,p]),$=(0,YG.useMemo)(()=>Z?N.length>0?`Queued: ${N.length} command(s). Type to add more...`:"Processing... Type to queue next command":"Type a message...",[Z,N.length]),[II,_]=(0,YG.useState)(""),[T,lI]=(0,YG.useState)(0),eI=(0,YG.useRef)({value:"",cursorPosition:0});(0,YG.useEffect)(()=>{eI.current={value:II,cursorPosition:T}},[II,T]);let vI=(0,YG.useCallback)(VI=>{eI.current.value=VI,_(VI)},[]),AI=(0,YG.useCallback)(VI=>{let _I=Math.max(0,Math.min(VI,eI.current.value.length));eI.current.cursorPosition=_I,lI(_I)},[]),pI=II.startsWith("/")&&II.length>0&&!Z,RI=!1,zI=(0,YG.useCallback)(VI=>{vI(VI),AI(VI.length)},[vI,AI]),FI=(0,YG.useCallback)(()=>{_(""),lI(0),eI.current={value:"",cursorPosition:0}},[]),KI=(0,YG.useCallback)(VI=>{let _I=VI.split(`
|
|
1937
1937
|
`).length,yl=VI.length;if(_I>1||yl>200){let Pl=_I>1?`pasted ${_I} lines (${yl} chars)`:`pasted ${yl} chars`;h(Pl),Y.current&&clearTimeout(Y.current),Y.current=setTimeout(()=>h(null),2e3)}},[]),xI=(0,YG.useCallback)(VI=>{let _I=eI.current.value;_I.trim()&&I.current&&(eI.current={value:"",cursorPosition:0},e(_I),FI(),I.current(_I))},[FI,e]),jI=(0,YG.useCallback)(()=>{let VI=t();VI!=null&&(vI(VI),AI(VI.length))},[vI,AI,t]),ll=(0,YG.useCallback)(()=>{let VI=a();VI!=null&&(vI(VI),AI(VI.length))},[vI,AI,a]);return je((VI,_I)=>{Un.getCurrentFocus(),"main-input"}),(0,xd.jsxs)(rI,{flexDirection:"column",children:[u&&(0,xd.jsx)(rI,{paddingX:0,marginBottom:0,children:(0,xd.jsx)(cI,{color:n.colors.text.muted,dimColor:!0,children:u})}),(0,xd.jsx)(rI,{paddingX:0,marginBottom:0,children:j?(0,xd.jsxs)(cI,{color:n.colors.text.muted,dimColor:!0,children:[j,N.length>0&&(0,xd.jsxs)(cI,{dimColor:!0,children:[" \xB7 queued: ",N.length]})]}):null}),(0,xd.jsxs)(rI,{flexDirection:"row",paddingX:0,paddingY:0,children:[(0,xd.jsx)(rI,{marginRight:1,children:(0,xd.jsx)(ryI,{isProcessing:Z,lockedIn:p!==null,glowPhase:y,color:n.colors.primary,idleColor:n.colors.primary})}),(0,xd.jsx)(rI,{flexGrow:1,children:(0,xd.jsx)(HII,{value:II,cursorPosition:T,onChange:vI,onChangeCursorPosition:AI,onSubmit:xI,onPaste:KI,onArrowUp:jI,onArrowDown:ll,placeholder:$,focusId:"main-input",disabled:!1,cursorOn:D})})]}),pI&&(0,xd.jsx)(oyI,{input:II,cursorPosition:T,onSelectSuggestion:zI,visible:pI})]})},()=>!1);vII.displayName="InputArea";var VyI=OI(Jl(),1);await Dt();UM();zd();gt();var pV=OI(ac(),1);var wII=VyI.default.memo(({model:l,modelIsAuto:I=!1,isVisible:G=!0,isScrolledUp:c=!1,renderLatency:e=0,routerEnabled:t=!1,onToggleRouter:a})=>{let n=_G.getTheme(),Z=l,{messageCount:N,queuedCommands:p}=SG(h2(h=>({messageCount:h.session.messages.length,queuedCommands:h.command.pendingCommands.length})));if(!G)return null;let u=[];if(Z){let h=Z.length>24?Z.slice(0,24)+"\u2026":Z;u.push(I?`${h} (auto)`:h)}return e>50&&u.push(`lag: ${e}ms`),N!==void 0&&u.push(`${N} msgs`),c&&u.push("\u2191 scrolled"),p>0&&u.push(`queue: ${p}`),u.length===0?null:(0,pV.jsx)(rI,{flexDirection:"row",paddingX:0,marginTop:0,children:(0,pV.jsxs)(cI,{color:n.colors.text.muted,dimColor:!0,children:[u.join(" \xB7 "),(0,pV.jsx)(cI,{children:" \xB7 "}),(0,pV.jsxs)(cI,{color:t?n.colors.success:n.colors.text.muted,bold:t,children:["R:",t?"ON":"OFF"]}),(0,pV.jsx)(cI,{dimColor:!0,children:" alt+r"})]})})});wII.displayName="ChatStatusBar";var d1=OI(Jl(),1);await Dt();zd();I$();var la=OI(ac(),1),RyI=[{cmd:"/help",desc:"all commands"},{cmd:"/model",desc:"switch AI model"},{cmd:"/theme",desc:"change appearance"},{cmd:"/copy",desc:"copy code/text to clipboard"},{cmd:"/compact",desc:"compress context"}],EII={current:!1},BZl=({cmd:l,desc:I,delayMs:G})=>{let c=_G.getTheme(),[e,t]=(0,d1.useState)(EII.current);return(0,d1.useEffect)(()=>{if(EII.current)return;let a=setTimeout(()=>{EII.current=!0,t(!0)},G);return()=>clearTimeout(a)},[G]),e?(0,la.jsx)(rI,{children:(0,la.jsxs)(cI,{color:c.colors.text.muted,dimColor:!0,children:[l.padEnd(12),I]})}):null},gII=d1.default.memo(({terminalWidth:l})=>{let I=_G.getTheme(),G=80,c=G+RyI.length*100+80;return(0,la.jsxs)(rI,{flexDirection:"column",paddingX:0,paddingY:0,marginBottom:1,children:[(0,la.jsxs)(rI,{flexDirection:"column",children:[(0,la.jsx)(cI,{color:I.colors.primary,bold:!0,children:`
|
|
1938
1938
|
\u2554\u2550\u2557\u2554\u2550\u2557\u2554\u2550\u2557\u2566\u2554\u2550\u2557
|
|
1939
1939
|
\u2560\u2550\u2563\u2551\u2563 \u2551 \u2566\u2551\u255A\u2550\u2557
|
|
1940
1940
|
\u2569 \u2569\u255A\u2550\u255D\u255A\u2550\u255D\u2569\u255A\u2550\u255D`}),(0,la.jsx)(rI,{marginLeft:2,children:(0,la.jsxs)(cI,{color:I.colors.text.muted,dimColor:!0,children:["v",l$.version]})}),(0,la.jsxs)(rI,{marginLeft:2,children:[(0,la.jsx)(cI,{color:I.colors.primary,bold:!0,children:"\xC6GIS "}),(0,la.jsx)(cI,{color:I.colors.text.muted,dimColor:!0,children:"\xB7 terminal coding agent"})]}),(0,la.jsx)(rI,{marginLeft:2,children:(0,la.jsx)(cI,{color:I.colors.text.muted,dimColor:!0,children:"\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500"})})]}),(0,la.jsx)(rI,{flexDirection:"column",marginTop:0,marginLeft:2,children:RyI.map(({cmd:e,desc:t},a)=>(0,la.jsx)(BZl,{cmd:e,desc:t,delayMs:G+a*100},e))}),(0,la.jsx)(rI,{marginTop:0,marginLeft:2,children:(0,la.jsx)(cI,{color:I.colors.text.muted,dimColor:!0,children:"Ctrl+Z exit \xB7 Ctrl+F search \xB7 Alt+C copy last"})}),!process.env.ANTHROPIC_API_KEY&&!process.env.CLAUDE_CODE_OAUTH_TOKEN&&(0,la.jsx)(rI,{marginTop:0,marginLeft:2,children:(0,la.jsx)(cI,{color:I.colors.text.muted,dimColor:!0,children:"Need Claude? Set ANTHROPIC_API_KEY in ~/.aegiscode/.env or run /setup"})})]})});gII.displayName="WelcomeMessage";var kG=OI(Jl(),1);await Dt();gt();YF();Qh();zd();var Nm=OI(ac(),1),UZl=.18,fZl=.5;function RA(l,I){if(!l)return 0;let G=Math.max(I,20),c=l.split(`
|
|
1941
|
-
`),e=0;for(let t of c){let a=t.length;e+=a===0?1:Math.max(1,Math.ceil(a/G))}return e}function FyI(l,I,G,c){let e=1;if(I&&I.length>0&&(e+=1,e+=RA(I,G)),c&&c.length>0){for(let t of c)switch(t.type){case"thinking":e+=1,e+=RA(t.thinking||"",G);break;case"text":e+=RA(t.text||"",G);break;case"tool_use":e+=2;break;case"tool_result":e+=Math.min(RA(t.content||"",G),6);break}return e}return e+=RA(l,G),e}var OZl=16,MZl=1,jZl=8,SZl=6,QyI=5e4;var KZl=500,DZl=1.6,TZl=.25,yII=kG.default.memo(({terminalWidth:l,terminalHeight:I,onScrolledUpChange:G,onRenderLatency:c,pendingCommandCount:e=0,extraOverheadLines:t=0})=>{let[a,n]=(0,kG.useState)(()=>FG().session.messages),[Z,N]=(0,kG.useState)(()=>$d.getState().app.showAllThinking),[p,u]=(0,kG.useState)(0),[h,Y]=(0,kG.useState)(0),[R,F]=(0,kG.useState)(0),X=(0,kG.useRef)(0),v=(0,kG.useRef)(!1),g=(0,kG.useRef)(null),[A,C]=(0,kG.useState)(!0),y=(0,kG.useRef)(A);y.current=A;let k=(0,kG.useRef)(a);k.current=a;let M=(0,kG.useRef)(Z);M.current=Z;let O=(0,kG.useRef)(l);O.current=l;let x=(0,kG.useRef)(I);x.current=I;let S=(0,kG.useRef)(G);S.current=G;let D=(0,kG.useRef)(c);D.current=c;let j=(0,kG.useRef)(h);j.current=h;let $=(0,kG.useRef)(0),II=(0,kG.useRef)(0),_=(0,kG.useRef)(null),T=(0,kG.useRef)(0);function lI(){if(!v.current)return;let UI=X.current,nl=j.current,ol=nl-UI;if(Math.abs(ol)<=fZl){X.current=nl,F(nl),v.current=!1,g.current=null;return}let PI=UI+ol*UZl;X.current=PI,F(PI),g.current=requestAnimationFrame(lI)}function eI(UI){j.current=UI,Y(UI),v.current||(v.current=!0,lI())}function vI(UI){v.current=!1,g.current!==null&&(cancelAnimationFrame(g.current),g.current=null),X.current=UI,F(UI),Y(UI)}let AI=Math.max(I-SZl-t,5),pI=a.filter(UI=>!UI.isStreaming),RI=pI.length>QyI?pI.slice(-QyI):pI,zI=a.find(UI=>UI.isStreaming&&dw(UI)),FI=zI?_Y():null,KI=(0,kG.useMemo)(()=>RI.map(UI=>FyI(UI.content,UI.thinking,l,UI.contentBlocks)),[RI,l]),xI=(0,kG.useMemo)(()=>{let UI=[0];for(let nl=0;nl<KI.length;nl++)UI.push(UI[nl]+KI[nl]);return UI},[KI]),jI=zI&&FI?FyI(zI.content+FI.content,(zI.thinking||"")+FI.thinking,l,zI.contentBlocks):0,ll=(xI[xI.length-1]||0)+jI,VI=Math.max(0,ll-AI);$.current=VI;let _I=A?0:Math.min(R,VI),yl=A?VI:_I,Pl=yl>=VI,nG=(0,kG.useMemo)(()=>{if(xI.length<=1)return 0;let UI=0,nl=xI.length-1;for(;UI<nl;){let ol=Math.floor((UI+nl+1)/2);xI[ol]<=yl?UI=ol:nl=ol-1}return UI},[yl,xI]);(0,kG.useEffect)(()=>{Y(UI=>Math.min(UI,VI)),F(UI=>Math.min(UI,VI))},[VI]);let gl=ll>AI,P=RI,tI=!1;if(gl){P=[];let UI=AI;for(let ol=nG;ol<RI.length&&UI>0;ol++)P.push(RI[ol]),UI-=KI[ol];let nl=P.length>0&&P[P.length-1].id===RI[RI.length-1]?.id;if(!nl&&RI.length>0){let ol=RI[RI.length-1];if(P.length>0){let PI=KI[RI.indexOf(P[P.length-1])];UI+=PI,P[P.length-1]=ol,UI-=KI[RI.length-1]}else P.push(ol)}tI=!Pl&&RI.length>0&&!nl}let EI=(0,kG.useRef)(!1);(0,kG.useEffect)(()=>{let UI=gl&&!Pl;UI!==EI.current&&(EI.current=UI,S.current?.(UI))},[gl,Pl]);function GI(UI,nl){let ol=performance.now();(nl!==_.current||ol-II.current>KZl)&&(T.current=0),_.current=nl,II.current=ol,T.current+=1;let PI=Math.min(Math.pow(DZl,T.current-1),10),il=Math.round(UI*PI),pl=Math.max(1,Math.floor(AI*TZl));return Math.min(il,pl)}let sI=(0,kG.useCallback)(UI=>{let nl=GI(UI,"up"),ol=y.current?$.current:j.current,PI=Math.max(0,ol-nl);C(!1),eI(PI)},[AI]),TI=(0,kG.useCallback)(UI=>{let nl=GI(UI,"down"),ol=y.current?$.current:j.current,PI=$.current,il=Math.min(PI,ol+nl);eI(il),il>=PI&&C(!0)},[AI]);function LI(){_.current=null,T.current=0}je((UI,nl)=>{if(nl.pageUp||nl.ctrl&&UI===""){sI(AI);return}if(nl.pageDown||nl.ctrl&&UI===""){TI(AI);return}if(nl.ctrl&&UI===""){sI(Math.max(1,Math.floor(AI/2)));return}if(nl.ctrl&&UI===""){TI(Math.max(1,Math.floor(AI/2)));return}if(nl.upArrow&&nl.ctrl){sI(1);return}if(nl.downArrow&&nl.ctrl){TI(1);return}if(nl.home){LI(),C(!1),vI(0);return}if(nl.end){LI(),vI($.current),C(!0);return}LI()});let $I=(0,kG.useRef)(null),_l=(0,kG.useRef)({}),yG=(0,kG.useRef)(!1),Jc=(0,kG.useRef)(null),al=(0,kG.useRef)(0);function Rl(){if(yG.current)return;yG.current=!0;let UI=nl=>{if(!yG.current)return;if(nl-al.current<OZl){Jc.current=requestAnimationFrame(UI);return}if(al.current=nl,$I.current){let uI=$I.current;$I.current=null,n(uI)}let ol=_Y(),il=$d.getState().session.messages.find(uI=>uI.isStreaming&&dw(uI));if(ol&&il){let uI=_l.current[il.id]||{content:0,thinking:0};(uI.content>ol.content.length||uI.thinking>ol.thinking.length)&&(_l.current[il.id]={content:0,thinking:0});let SI=_l.current[il.id]||{content:0,thinking:0},Zl=ol.content.length-SI.content,Fl=ol.thinking.length-SI.thinking,GG=SI.thinking===0&&ol.thinking.length>0;if(Zl>=MZl||Fl>=jZl||GG){_l.current[il.id]={content:ol.content.length,thinking:ol.thinking.length},u(zG=>zG+1);let Ul=iM();Ul>30&&D.current?.(Ul)}}let pl=$I.current!==null,hG=$d.getState().session.messages.find(uI=>uI.isStreaming&&dw(uI)),z=!!(_Y()&&hG);pl||z?Jc.current=requestAnimationFrame(UI):(yG.current=!1,Jc.current=null)};Jc.current=requestAnimationFrame(UI)}return(0,kG.useEffect)(()=>{let UI=$d.subscribe(nl=>{let ol=nl.session.messages,PI=nl.app.showAllThinking,il=k.current,pl=!1;if(ol.length!==il.length)pl=!0;else for(let $l=0;$l<ol.length;$l++){let hG=il[$l],z=ol[$l];if(hG.id!==z.id||hG.isStreaming!==z.isStreaming||hG.content!==z.content||hG.thinking!==z.thinking||hG.contentBlocks!==z.contentBlocks){pl=!0;break}}if(pl){let $l=il.length,hG=ol.length;if(hG>$l){let z=ol[hG-1];z?.role==="user"||z?.isStreaming?(eI($.current),C(!0)):y.current&&C(!0)}$I.current=[...ol],Rl()}ol.length>0&&ol[ol.length-1].isStreaming&&Rl(),PI!==M.current&&N(PI),ol.forEach($l=>{$l.isStreaming||delete _l.current[$l.id]})});return()=>{yG.current=!1,Jc.current!==null&&cancelAnimationFrame(Jc.current),Jc.current=null,v.current=!1,g.current!==null&&cancelAnimationFrame(g.current),g.current=null,UI()}},[]),(0,Nm.jsxs)(rI,{flexDirection:"column",children:[(0,Nm.jsx)(rI,{height:1,flexShrink:0,children:gl&&!Pl&&!zI?(0,Nm.jsxs)(cI,{color:_G.getTheme().colors.text.muted,dimColor:!0,children:["\u2191 ",yl," lines above"]}):(0,Nm.jsx)(cI,{children:" "})}),P.map(UI=>(0,Nm.jsx)(NV,{content:UI.content,role:UI.role,terminalWidth:l,showPrefix:!0,thinking:UI.thinking,isStreaming:!1,showAllThinking:Z,contentBlocks:UI.contentBlocks},UI.id)),zI&&(()=>{let UI=FI?zI.content+FI.content:zI.content,nl=FI?(zI.thinking||"")+FI.thinking:zI.thinking,ol=zI.contentBlocks||[],PI=FI?Fh():[],pl=ol.map(hG=>{if(hG.type==="tool_use"){let z=PI.find(uI=>uI.id===hG.id);if(z&&z.arguments)return{...hG,input:z.arguments}}return hG}).filter(hG=>hG.type!=="text"&&hG.type!=="thinking"),$l=[];return nl&&$l.push({type:"thinking",thinking:nl}),UI&&$l.push({type:"text",text:UI}),$l.push(...pl),(0,Nm.jsx)(NV,{content:UI,role:zI.role,terminalWidth:l,showPrefix:!0,thinking:nl,isStreaming:!0,showAllThinking:Z,contentBlocks:$l},zI.id)})(),(0,Nm.jsxs)(rI,{flexDirection:"column",flexShrink:0,children:[tI&&(0,Nm.jsx)(rI,{height:1,flexShrink:0,children:(0,Nm.jsx)(cI,{color:_G.getTheme().colors.text.muted,dimColor:!0,children:"\u22EF latest (End to jump here) \u22EF"})}),tI&&(0,Nm.jsx)(NV,{content:RI[RI.length-1].content,role:RI[RI.length-1].role,terminalWidth:l,showPrefix:!0,thinking:RI[RI.length-1].thinking,isStreaming:!1,showAllThinking:Z,contentBlocks:RI[RI.length-1].contentBlocks},"last-"+RI[RI.length-1].id)]})]})});yII.displayName="MessageList";var XyI=OI(Jl(),1);await Dt();zd();var lZ=OI(ac(),1),qZl={building:"#22c55e",refactoring:"#f59e0b",debugging:"#ef4444",testing:"#3b82f6",planning:"#7c6fd4"};function PZl(l){let I=l.toLowerCase().trim();for(let[G,c]of Object.entries(qZl))if(I.includes(G)||G.includes(I))return c;return _G.getTheme().colors.primary}var AII=XyI.default.memo(({workflow:l})=>{let I=_G.getTheme();if(!l.visible)return null;let G=PZl(l.phase),c=`\u25CF ${l.phase} ${l.target}`,e=`${l.currentStepIndex}/${l.totalSteps}`,t=l.steps.map((n,Z)=>{let N=n.status==="active"?"\u25C9":n.status==="done"?"\u25CF":"\u25CB",p=n.status==="active"?G:n.status==="done"?I.colors.success:I.colors.text.muted;return(0,lZ.jsxs)(cI,{color:p,children:[N," ",n.label,Z<l.steps.length-1&&(0,lZ.jsx)(cI,{color:I.colors.text.muted,children:" \xB7 "})]},Z)}),a=I.colors.border.light;return(0,lZ.jsxs)(rI,{flexDirection:"column",marginTop:0,marginBottom:0,children:[(0,lZ.jsxs)(rI,{children:[(0,lZ.jsx)(cI,{color:a,children:"\u2500"}),(0,lZ.jsx)(cI,{children:" "}),(0,lZ.jsx)(cI,{color:G,bold:!0,children:c}),(0,lZ.jsxs)(cI,{color:I.colors.text.muted,children:[" \xB7 ",e]})]}),(0,lZ.jsx)(rI,{marginLeft:1,children:t}),(0,lZ.jsx)(rI,{children:(0,lZ.jsx)(cI,{color:a,children:"\u2500"})})]})});AII.displayName="ContextBar";var HyI=OI(Jl(),1);await Dt();zd();var $e=OI(ac(),1),vyI=({details:l,onResponse:I})=>{let[G,c]=(0,HyI.useState)(0),e=_G.getTheme(),t=iw("confirmation-prompt"),a=[{key:"y",label:"allow",scope:"once",approved:!0},{key:"a",label:"always",scope:"session",approved:!0},{key:"n",label:"deny",scope:"once",approved:!1},{key:"d",label:"never",scope:"session",approved:!1}];je((h,Y)=>{if(Y.upArrow)c(R=>R>0?R-1:a.length-1);else if(Y.downArrow)c(R=>R<a.length-1?R+1:0);else if(Y.return){let R=a[G];I({approved:R.approved,scope:R.scope,reason:R.approved?void 0:"denied"})}else h==="y"||h==="Y"?I({approved:!0,scope:"once"}):h==="a"||h==="A"?I({approved:!0,scope:"session"}):h==="n"||h==="N"?I({approved:!1,scope:"once",reason:"denied"}):(h==="d"||h==="D")&&I({approved:!1,scope:"session",reason:"denied for this session"})},{isActive:t});let n=l.title.replace(/^.*:\s*/,""),Z=["Bash","Shell"].includes(n)&&l.details?.includes("**Command:**"),{label:N,highlight:p,extra:u}=_Zl(l.details);return(0,$e.jsxs)(rI,{flexDirection:"column",paddingX:1,children:[!Z&&(0,$e.jsxs)(rI,{children:[(0,$e.jsx)(cI,{color:e.colors.warning,bold:!0,children:"? "}),(0,$e.jsx)(cI,{bold:!0,children:n}),l.message&&l.message!==l.title&&(0,$e.jsxs)(cI,{color:e.colors.text.muted,dimColor:!0,children:[" \xB7 ",l.message]})]}),Z&&p&&(0,$e.jsxs)(rI,{children:[(0,$e.jsx)(cI,{color:e.colors.warning,bold:!0,children:"? "}),N&&(0,$e.jsxs)(cI,{color:e.colors.text.muted,dimColor:!0,children:[N," "]}),(0,$e.jsx)(cI,{color:e.colors.accent,wrap:"wrap",children:p})]}),!Z&&p&&(0,$e.jsxs)(rI,{marginLeft:2,children:[N&&(0,$e.jsxs)(cI,{color:e.colors.text.muted,dimColor:!0,children:[N," "]}),(0,$e.jsx)(cI,{color:e.colors.accent,wrap:"wrap",children:p})]}),u.length>0&&(0,$e.jsx)(rI,{flexDirection:"column",marginLeft:2,children:u.map((h,Y)=>(0,$e.jsx)(cI,{color:e.colors.text.muted,dimColor:!0,wrap:"wrap",children:h},Y))}),l.affectedFiles&&l.affectedFiles.length>0&&(0,$e.jsx)(rI,{marginLeft:2,children:(0,$e.jsx)(cI,{color:e.colors.info,dimColor:!0,children:l.affectedFiles.join(", ")})}),l.risks&&l.risks.length>0&&(0,$e.jsx)(rI,{marginLeft:2,children:(0,$e.jsx)(cI,{color:e.colors.text.muted,dimColor:!0,children:l.risks.join(" \xB7 ")})}),(0,$e.jsx)(rI,{flexDirection:"column",marginLeft:2,marginTop:1,children:a.map((h,Y)=>{let R=Y===G;return(0,$e.jsxs)(rI,{children:[(0,$e.jsxs)(cI,{color:R?e.colors.success:e.colors.text.muted,bold:R,dimColor:!R,children:[R?"> ":" ",h.label]}),(0,$e.jsxs)(cI,{color:e.colors.text.muted,dimColor:!0,children:[" (",h.key,")"]})]},h.key)})})]})};function _Zl(l){if(!l)return{label:"",highlight:"",extra:[]};let I=N=>N.replace(/\*\*(.+?)\*\*/g,"$1").replace(/`([^`]+)`/g,"$1").trim(),G=l.split(`
|
|
1941
|
+
`),e=0;for(let t of c){let a=t.length;e+=a===0?1:Math.max(1,Math.ceil(a/G))}return e}function FyI(l,I,G,c){let e=1;if(I&&I.length>0&&(e+=1,e+=RA(I,G)),c&&c.length>0){for(let t of c)switch(t.type){case"thinking":e+=1,e+=RA(t.thinking||"",G);break;case"text":e+=RA(t.text||"",G);break;case"tool_use":e+=2;break;case"tool_result":e+=Math.min(RA(t.content||"",G),6);break}return e}return e+=RA(l,G),e}var OZl=50,MZl=5,jZl=16,SZl=6,QyI=5e4;var KZl=500,DZl=1.6,TZl=.25,yII=kG.default.memo(({terminalWidth:l,terminalHeight:I,onScrolledUpChange:G,onRenderLatency:c,pendingCommandCount:e=0,extraOverheadLines:t=0})=>{let[a,n]=(0,kG.useState)(()=>FG().session.messages),[Z,N]=(0,kG.useState)(()=>$d.getState().app.showAllThinking),[p,u]=(0,kG.useState)(0),[h,Y]=(0,kG.useState)(0),[R,F]=(0,kG.useState)(0),X=(0,kG.useRef)(0),v=(0,kG.useRef)(!1),g=(0,kG.useRef)(null),[A,C]=(0,kG.useState)(!0),y=(0,kG.useRef)(A);y.current=A;let k=(0,kG.useRef)(a);k.current=a;let M=(0,kG.useRef)(Z);M.current=Z;let O=(0,kG.useRef)(l);O.current=l;let x=(0,kG.useRef)(I);x.current=I;let S=(0,kG.useRef)(G);S.current=G;let D=(0,kG.useRef)(c);D.current=c;let j=(0,kG.useRef)(h);j.current=h;let $=(0,kG.useRef)(0),II=(0,kG.useRef)(0),_=(0,kG.useRef)(null),T=(0,kG.useRef)(0);function lI(){if(!v.current)return;let UI=X.current,nl=j.current,ol=nl-UI;if(Math.abs(ol)<=fZl){X.current=nl,F(nl),v.current=!1,g.current=null;return}let PI=UI+ol*UZl;X.current=PI,F(PI),g.current=requestAnimationFrame(lI)}function eI(UI){j.current=UI,Y(UI),v.current||(v.current=!0,lI())}function vI(UI){v.current=!1,g.current!==null&&(cancelAnimationFrame(g.current),g.current=null),X.current=UI,F(UI),Y(UI)}let AI=Math.max(I-SZl-t,5),pI=a.filter(UI=>!UI.isStreaming),RI=pI.length>QyI?pI.slice(-QyI):pI,zI=a.find(UI=>UI.isStreaming&&dw(UI)),FI=zI?_Y():null,KI=(0,kG.useMemo)(()=>RI.map(UI=>FyI(UI.content,UI.thinking,l,UI.contentBlocks)),[RI,l]),xI=(0,kG.useMemo)(()=>{let UI=[0];for(let nl=0;nl<KI.length;nl++)UI.push(UI[nl]+KI[nl]);return UI},[KI]),jI=zI&&FI?FyI(zI.content+FI.content,(zI.thinking||"")+FI.thinking,l,zI.contentBlocks):0,ll=(xI[xI.length-1]||0)+jI,VI=Math.max(0,ll-AI);$.current=VI;let _I=A?0:Math.min(R,VI),yl=A?VI:_I,Pl=yl>=VI,nG=(0,kG.useMemo)(()=>{if(xI.length<=1)return 0;let UI=0,nl=xI.length-1;for(;UI<nl;){let ol=Math.floor((UI+nl+1)/2);xI[ol]<=yl?UI=ol:nl=ol-1}return UI},[yl,xI]);(0,kG.useEffect)(()=>{Y(UI=>Math.min(UI,VI)),F(UI=>Math.min(UI,VI))},[VI]);let gl=ll>AI,P=RI,tI=!1;if(gl){P=[];let UI=AI;for(let ol=nG;ol<RI.length&&UI>0;ol++)P.push(RI[ol]),UI-=KI[ol];let nl=P.length>0&&P[P.length-1].id===RI[RI.length-1]?.id;if(!nl&&RI.length>0){let ol=RI[RI.length-1];if(P.length>0){let PI=KI[RI.indexOf(P[P.length-1])];UI+=PI,P[P.length-1]=ol,UI-=KI[RI.length-1]}else P.push(ol)}tI=!Pl&&RI.length>0&&!nl}let EI=(0,kG.useRef)(!1);(0,kG.useEffect)(()=>{let UI=gl&&!Pl;UI!==EI.current&&(EI.current=UI,S.current?.(UI))},[gl,Pl]);function GI(UI,nl){let ol=performance.now();(nl!==_.current||ol-II.current>KZl)&&(T.current=0),_.current=nl,II.current=ol,T.current+=1;let PI=Math.min(Math.pow(DZl,T.current-1),10),il=Math.round(UI*PI),pl=Math.max(1,Math.floor(AI*TZl));return Math.min(il,pl)}let sI=(0,kG.useCallback)(UI=>{let nl=GI(UI,"up"),ol=y.current?$.current:j.current,PI=Math.max(0,ol-nl);C(!1),eI(PI)},[AI]),TI=(0,kG.useCallback)(UI=>{let nl=GI(UI,"down"),ol=y.current?$.current:j.current,PI=$.current,il=Math.min(PI,ol+nl);eI(il),il>=PI&&C(!0)},[AI]);function LI(){_.current=null,T.current=0}je((UI,nl)=>{if(nl.pageUp||nl.ctrl&&UI===""){sI(AI);return}if(nl.pageDown||nl.ctrl&&UI===""){TI(AI);return}if(nl.ctrl&&UI===""){sI(Math.max(1,Math.floor(AI/2)));return}if(nl.ctrl&&UI===""){TI(Math.max(1,Math.floor(AI/2)));return}if(nl.upArrow&&nl.ctrl){sI(1);return}if(nl.downArrow&&nl.ctrl){TI(1);return}if(nl.home){LI(),C(!1),vI(0);return}if(nl.end){LI(),vI($.current),C(!0);return}LI()});let $I=(0,kG.useRef)(null),_l=(0,kG.useRef)({}),yG=(0,kG.useRef)(!1),Jc=(0,kG.useRef)(null),al=(0,kG.useRef)(0);function Rl(){if(yG.current)return;yG.current=!0;let UI=nl=>{if(!yG.current)return;if(nl-al.current<OZl){Jc.current=requestAnimationFrame(UI);return}if(al.current=nl,$I.current){let uI=$I.current;$I.current=null,n(uI)}let ol=_Y(),il=$d.getState().session.messages.find(uI=>uI.isStreaming&&dw(uI));if(ol&&il){let uI=_l.current[il.id]||{content:0,thinking:0};(uI.content>ol.content.length||uI.thinking>ol.thinking.length)&&(_l.current[il.id]={content:0,thinking:0});let SI=_l.current[il.id]||{content:0,thinking:0},Zl=ol.content.length-SI.content,Fl=ol.thinking.length-SI.thinking,GG=SI.thinking===0&&ol.thinking.length>0;if(Zl>=MZl||Fl>=jZl||GG){_l.current[il.id]={content:ol.content.length,thinking:ol.thinking.length},u(zG=>zG+1);let Ul=iM();Ul>30&&D.current?.(Ul)}}let pl=$I.current!==null,hG=$d.getState().session.messages.find(uI=>uI.isStreaming&&dw(uI)),z=!!(_Y()&&hG);pl||z?Jc.current=requestAnimationFrame(UI):(yG.current=!1,Jc.current=null)};Jc.current=requestAnimationFrame(UI)}return(0,kG.useEffect)(()=>{let UI=$d.subscribe(nl=>{let ol=nl.session.messages,PI=nl.app.showAllThinking,il=k.current,pl=!1;if(ol.length!==il.length)pl=!0;else for(let $l=0;$l<ol.length;$l++){let hG=il[$l],z=ol[$l];if(hG.id!==z.id||hG.isStreaming!==z.isStreaming||hG.content!==z.content||hG.thinking!==z.thinking||hG.contentBlocks!==z.contentBlocks){pl=!0;break}}if(pl){let $l=il.length,hG=ol.length;if(hG>$l){let z=ol[hG-1];z?.role==="user"||z?.isStreaming?(eI($.current),C(!0)):y.current&&C(!0)}$I.current=[...ol],Rl()}ol.length>0&&ol[ol.length-1].isStreaming&&Rl(),PI!==M.current&&N(PI),ol.forEach($l=>{$l.isStreaming||delete _l.current[$l.id]})});return()=>{yG.current=!1,Jc.current!==null&&cancelAnimationFrame(Jc.current),Jc.current=null,v.current=!1,g.current!==null&&cancelAnimationFrame(g.current),g.current=null,UI()}},[]),(0,Nm.jsxs)(rI,{flexDirection:"column",children:[(0,Nm.jsx)(rI,{height:1,flexShrink:0,children:gl&&!Pl&&!zI?(0,Nm.jsxs)(cI,{color:_G.getTheme().colors.text.muted,dimColor:!0,children:["\u2191 ",yl," lines above"]}):(0,Nm.jsx)(cI,{children:" "})}),P.map(UI=>(0,Nm.jsx)(NV,{content:UI.content,role:UI.role,terminalWidth:l,showPrefix:!0,thinking:UI.thinking,isStreaming:!1,showAllThinking:Z,contentBlocks:UI.contentBlocks},UI.id)),zI&&(()=>{let UI=FI?zI.content+FI.content:zI.content,nl=FI?(zI.thinking||"")+FI.thinking:zI.thinking,ol=zI.contentBlocks||[],PI=FI?Fh():[],pl=ol.map(hG=>{if(hG.type==="tool_use"){let z=PI.find(uI=>uI.id===hG.id);if(z&&z.arguments)return{...hG,input:z.arguments}}return hG}).filter(hG=>hG.type!=="text"&&hG.type!=="thinking"),$l=[];return nl&&$l.push({type:"thinking",thinking:nl}),UI&&$l.push({type:"text",text:UI}),$l.push(...pl),(0,Nm.jsx)(NV,{content:UI,role:zI.role,terminalWidth:l,showPrefix:!0,thinking:nl,isStreaming:!0,showAllThinking:Z,contentBlocks:$l},zI.id)})(),(0,Nm.jsxs)(rI,{flexDirection:"column",flexShrink:0,children:[tI&&(0,Nm.jsx)(rI,{height:1,flexShrink:0,children:(0,Nm.jsx)(cI,{color:_G.getTheme().colors.text.muted,dimColor:!0,children:"\u22EF latest (End to jump here) \u22EF"})}),tI&&(0,Nm.jsx)(NV,{content:RI[RI.length-1].content,role:RI[RI.length-1].role,terminalWidth:l,showPrefix:!0,thinking:RI[RI.length-1].thinking,isStreaming:!1,showAllThinking:Z,contentBlocks:RI[RI.length-1].contentBlocks},"last-"+RI[RI.length-1].id)]})]})});yII.displayName="MessageList";var XyI=OI(Jl(),1);await Dt();zd();var lZ=OI(ac(),1),qZl={building:"#22c55e",refactoring:"#f59e0b",debugging:"#ef4444",testing:"#3b82f6",planning:"#7c6fd4"};function PZl(l){let I=l.toLowerCase().trim();for(let[G,c]of Object.entries(qZl))if(I.includes(G)||G.includes(I))return c;return _G.getTheme().colors.primary}var AII=XyI.default.memo(({workflow:l})=>{let I=_G.getTheme();if(!l.visible)return null;let G=PZl(l.phase),c=`\u25CF ${l.phase} ${l.target}`,e=`${l.currentStepIndex}/${l.totalSteps}`,t=l.steps.map((n,Z)=>{let N=n.status==="active"?"\u25C9":n.status==="done"?"\u25CF":"\u25CB",p=n.status==="active"?G:n.status==="done"?I.colors.success:I.colors.text.muted;return(0,lZ.jsxs)(cI,{color:p,children:[N," ",n.label,Z<l.steps.length-1&&(0,lZ.jsx)(cI,{color:I.colors.text.muted,children:" \xB7 "})]},Z)}),a=I.colors.border.light;return(0,lZ.jsxs)(rI,{flexDirection:"column",marginTop:0,marginBottom:0,children:[(0,lZ.jsxs)(rI,{children:[(0,lZ.jsx)(cI,{color:a,children:"\u2500"}),(0,lZ.jsx)(cI,{children:" "}),(0,lZ.jsx)(cI,{color:G,bold:!0,children:c}),(0,lZ.jsxs)(cI,{color:I.colors.text.muted,children:[" \xB7 ",e]})]}),(0,lZ.jsx)(rI,{marginLeft:1,children:t}),(0,lZ.jsx)(rI,{children:(0,lZ.jsx)(cI,{color:a,children:"\u2500"})})]})});AII.displayName="ContextBar";var HyI=OI(Jl(),1);await Dt();zd();var $e=OI(ac(),1),vyI=({details:l,onResponse:I})=>{let[G,c]=(0,HyI.useState)(0),e=_G.getTheme(),t=iw("confirmation-prompt"),a=[{key:"y",label:"allow",scope:"once",approved:!0},{key:"a",label:"always",scope:"session",approved:!0},{key:"n",label:"deny",scope:"once",approved:!1},{key:"d",label:"never",scope:"session",approved:!1}];je((h,Y)=>{if(Y.upArrow)c(R=>R>0?R-1:a.length-1);else if(Y.downArrow)c(R=>R<a.length-1?R+1:0);else if(Y.return){let R=a[G];I({approved:R.approved,scope:R.scope,reason:R.approved?void 0:"denied"})}else h==="y"||h==="Y"?I({approved:!0,scope:"once"}):h==="a"||h==="A"?I({approved:!0,scope:"session"}):h==="n"||h==="N"?I({approved:!1,scope:"once",reason:"denied"}):(h==="d"||h==="D")&&I({approved:!1,scope:"session",reason:"denied for this session"})},{isActive:t});let n=l.title.replace(/^.*:\s*/,""),Z=["Bash","Shell"].includes(n)&&l.details?.includes("**Command:**"),{label:N,highlight:p,extra:u}=_Zl(l.details);return(0,$e.jsxs)(rI,{flexDirection:"column",paddingX:1,children:[!Z&&(0,$e.jsxs)(rI,{children:[(0,$e.jsx)(cI,{color:e.colors.warning,bold:!0,children:"? "}),(0,$e.jsx)(cI,{bold:!0,children:n}),l.message&&l.message!==l.title&&(0,$e.jsxs)(cI,{color:e.colors.text.muted,dimColor:!0,children:[" \xB7 ",l.message]})]}),Z&&p&&(0,$e.jsxs)(rI,{children:[(0,$e.jsx)(cI,{color:e.colors.warning,bold:!0,children:"? "}),N&&(0,$e.jsxs)(cI,{color:e.colors.text.muted,dimColor:!0,children:[N," "]}),(0,$e.jsx)(cI,{color:e.colors.accent,wrap:"wrap",children:p})]}),!Z&&p&&(0,$e.jsxs)(rI,{marginLeft:2,children:[N&&(0,$e.jsxs)(cI,{color:e.colors.text.muted,dimColor:!0,children:[N," "]}),(0,$e.jsx)(cI,{color:e.colors.accent,wrap:"wrap",children:p})]}),u.length>0&&(0,$e.jsx)(rI,{flexDirection:"column",marginLeft:2,children:u.map((h,Y)=>(0,$e.jsx)(cI,{color:e.colors.text.muted,dimColor:!0,wrap:"wrap",children:h},Y))}),l.affectedFiles&&l.affectedFiles.length>0&&(0,$e.jsx)(rI,{marginLeft:2,children:(0,$e.jsx)(cI,{color:e.colors.info,dimColor:!0,children:l.affectedFiles.join(", ")})}),l.risks&&l.risks.length>0&&(0,$e.jsx)(rI,{marginLeft:2,children:(0,$e.jsx)(cI,{color:e.colors.text.muted,dimColor:!0,children:l.risks.join(" \xB7 ")})}),(0,$e.jsx)(rI,{flexDirection:"column",marginLeft:2,marginTop:1,children:a.map((h,Y)=>{let R=Y===G;return(0,$e.jsxs)(rI,{children:[(0,$e.jsxs)(cI,{color:R?e.colors.success:e.colors.text.muted,bold:R,dimColor:!R,children:[R?"> ":" ",h.label]}),(0,$e.jsxs)(cI,{color:e.colors.text.muted,dimColor:!0,children:[" (",h.key,")"]})]},h.key)})})]})};function _Zl(l){if(!l)return{label:"",highlight:"",extra:[]};let I=N=>N.replace(/\*\*(.+?)\*\*/g,"$1").replace(/`([^`]+)`/g,"$1").trim(),G=l.split(`
|
|
1942
1942
|
`).filter(N=>N.trim()),c="",e="",t=[],a=[],n=!1,Z=/^(Command|File|Directory|Content Preview|Before|After):\s*/;for(let N of G){let p=I(N);p==="```"||p.startsWith("```")||(/^Command:\s*/.test(p)?(c="Command:",t.push(p.replace(/^Command:\s*/,"")),n=!0):/^File:\s*/.test(p)?(c="File:",t.push(p.replace(/^File:\s*/,"")),n=!0):/^(Directory|Content Preview|Before|After):\s*/.test(p)?(n=!1,a.push(p)):n?t.push(p):p&&a.push(p))}return e=t.join(`
|
|
1943
1943
|
`),{label:c,highlight:e,extra:a}}var tu=OI(Jl(),1);await Dt();zd();var Bd=OI(ac(),1);function wyI({title:l,options:I,onSelect:G,onCancel:c,initialIndex:e=0,focusId:t="selector",maxVisible:a=10}){let n=_G.getTheme(),[Z,N]=(0,tu.useState)(()=>{let X=I.findIndex(v=>v.isCurrent);return X>=0?X:e}),[p,u]=(0,tu.useState)(0),h=(0,tu.useRef)(!1);(0,tu.useEffect)(()=>{h.current=!1},[I]),(0,tu.useEffect)(()=>{u(X=>Z<X?Z:Z>=X+a?Z-a+1:X)},[Z,a]),je((X,v)=>{Un.getCurrentFocus()===t&&(v.upArrow||X==="k"?N(g=>g>0?g-1:I.length-1):v.downArrow||X==="j"?N(g=>g<I.length-1?g+1:0):v.pageUp?N(g=>Math.max(0,g-a)):v.pageDown?N(g=>Math.min(I.length-1,g+a)):v.return?h.current||(h.current=!0,G(I[Z].value)):(v.escape||X==="q")&&c())}),(0,tu.useEffect)(()=>{Z>=I.length&&N(0)},[I.length,Z]);let Y=I.slice(p,p+a),R=p>0,F=p+a<I.length;return(0,Bd.jsxs)(rI,{flexDirection:"column",borderStyle:"round",borderColor:n.colors.primary,paddingX:2,paddingY:1,children:[(0,Bd.jsxs)(rI,{marginBottom:1,flexDirection:"row",justifyContent:"space-between",children:[(0,Bd.jsx)(cI,{bold:!0,color:n.colors.primary,children:l}),I.length>a&&(0,Bd.jsxs)(cI,{color:n.colors.text.muted,dimColor:!0,children:[Z+1,"/",I.length]})]}),R&&(0,Bd.jsx)(rI,{children:(0,Bd.jsxs)(cI,{color:n.colors.text.muted,dimColor:!0,children:[" \u2191 ",p," more"]})}),(0,Bd.jsx)(rI,{flexDirection:"column",children:Y.map((X,v)=>{let A=p+v===Z;return(0,Bd.jsxs)(rI,{flexDirection:"row",children:[(0,Bd.jsxs)(cI,{color:A?n.colors.primary:n.colors.text.primary,bold:A,children:[A?"\u25B8 ":" ",X.label,X.isCurrent?" \u2713":""]}),X.description&&(0,Bd.jsxs)(cI,{color:n.colors.text.muted,dimColor:!0,children:[" - ",X.description]})]},String(X.value))})}),F&&(0,Bd.jsx)(rI,{children:(0,Bd.jsxs)(cI,{color:n.colors.text.muted,dimColor:!0,children:[" \u2193 ",I.length-p-a," more"]})}),(0,Bd.jsx)(rI,{marginTop:1,borderStyle:"single",borderTop:!0,borderBottom:!1,borderLeft:!1,borderRight:!1,borderColor:n.colors.border.light,children:(0,Bd.jsx)(cI,{color:n.colors.text.muted,dimColor:!0,children:"\u2191/\u2193 navigate PgUp/PgDn page Enter confirm Esc cancel"})})]})}var au=OI(Jl(),1);await Dt();zd();gt();var Ql=OI(ac(),1);import*as du from"node:fs";import*as CII from"node:path";import*as JII from"node:os";var Ox=[{id:"anthropic",label:"Anthropic (Claude)",envVar:"ANTHROPIC_API_KEY",keyUrl:"console.anthropic.com/settings/keys"},{id:"openai",label:"OpenAI (GPT)",envVar:"OPENAI_API_KEY",keyUrl:"platform.openai.com/api-keys"},{id:"deepseek",label:"DeepSeek",envVar:"DEEPSEEK_API_KEY",keyUrl:"platform.deepseek.com/api_keys"},{id:"groq",label:"Groq",envVar:"GROQ_API_KEY",keyUrl:"console.groq.com/keys"},{id:"gemini",label:"Google Gemini",envVar:"GEMINI_API_KEY",keyUrl:"aistudio.google.com/app/apikey"},{id:"ollama",label:"Ollama (local)",envVar:"",keyUrl:"",noKey:!0}];function EyI(l){let I={};if(!du.existsSync(l))return I;for(let G of du.readFileSync(l,"utf-8").split(`
|
|
1944
1944
|
`)){let c=G.indexOf("=");c<0||G.trim().startsWith("#")||(I[G.slice(0,c).trim()]=G.slice(c+1).trim())}return I}function $Zl(l,I){let G=Object.entries(I).map(([c,e])=>`${c}=${e}`);du.writeFileSync(l,G.join(`
|