@vpxa/aikit 0.1.271 → 0.1.273
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/package.json +1 -1
- package/packages/cli/dist/index.js +3 -3
- package/packages/cli/dist/{init-fd-21aSJ.js → init-DCs4TWh6.js} +1 -1
- package/packages/cli/dist/{templates-CdHbXhGF.js → templates-C92mODRl.js} +4 -1
- package/packages/server/dist/bin.js +3 -3
- package/packages/server/dist/{curated-manager-xTfPLFMR.js → curated-manager-CfwN96rp.js} +2 -2
- package/packages/server/dist/index.d.ts +9 -0
- package/packages/server/dist/index.js +1 -1
- package/packages/server/dist/{promotion-PdKQQktE.js → promotion-BNEScZVD.js} +1 -1
- package/packages/server/dist/{server-CIPdEf8F.js → server-4h0Cclv3.js} +82 -82
- package/packages/server/dist/{server-CIf0Ejd4.js → server-DIz2FGOX.js} +83 -83
- package/packages/tools/dist/index.js +1 -1
- package/scaffold/dist/definitions/agents.mjs +1 -1
- package/scaffold/dist/definitions/models.mjs +1 -1
- package/scaffold/dist/definitions/skills/aikit.mjs +3 -1
|
@@ -12,7 +12,7 @@ import{mkdir as e,readFile as t,readdir as n,rm as r,stat as i,writeFile as a}fr
|
|
|
12
12
|
### Patterns Detected
|
|
13
13
|
`),n.push(`| Pattern | Confidence | Count |`),n.push(`|---------|-----------|-------|`);for(let t of e.patterns)n.push(`| ${t.name} | ${t.confidence} | ${t.count} |`)}else t===`normal`&&n.push(`\n**Patterns:** ${e.patterns.map(e=>e.name).join(`, `)}`);return n.join(`
|
|
14
14
|
`)}const bt=/^[a-zA-Z0-9_./\-~^@{}]+$/;function xt(e){let{from:t,to:n=`HEAD`,format:r=`grouped`,includeBreaking:i=!0,cwd:a=process.cwd()}=e;if(!bt.test(t))throw Error(`Invalid git ref: ${t}`);if(!bt.test(n))throw Error(`Invalid git ref: ${n}`);let o;try{o=w(`git`,[`log`,`${t}..${n}`,`--format=%H%s%b%an%ai`],{cwd:a,encoding:`utf8`,maxBuffer:10*1024*1024,timeout:3e4})}catch{throw Error(`Git log failed. Ensure "${t}" and "${n}" are valid refs.`)}let s=o.split(``).map(e=>e.trim()).filter(Boolean).map(e=>{let[t=``,n=``,r=``,i=``,a=``]=e.split(``),o=n.match(/^(\w+)(?:\(([^)]*)\))?(!)?:\s*(.+)/);return{hash:t.slice(0,8),type:o?.[1]??`other`,scope:o?.[2]??``,subject:o?.[4]??n,body:r.trim(),author:i.trim(),date:a.trim().split(` `)[0],breaking:!!(o?.[3]||/BREAKING[\s-]CHANGE/i.test(r))}}),c={},l=0;for(let e of s)c[e.type]=(c[e.type]??0)+1,e.breaking&&l++;return{entries:s,markdown:St(s,r,i),stats:{total:s.length,breaking:l,types:c}}}function St(e,t,n){let r=[`# Changelog`,``];if(n){let t=e.filter(e=>e.breaking);if(t.length>0){r.push(`## Breaking Changes`,``);for(let e of t)r.push(`- ${e.subject} (${e.hash})`);r.push(``)}}if(t===`grouped`){let t={};for(let n of e)t[n.type]||(t[n.type]=[]),t[n.type].push(n);let n=[`feat`,`fix`,`refactor`,`perf`,`test`,`docs`,`chore`],i={feat:`Features`,fix:`Bug Fixes`,refactor:`Refactoring`,perf:`Performance`,test:`Tests`,docs:`Documentation`,chore:`Chores`,other:`Other`};for(let e of[...n,...Object.keys(t).filter(e=>!n.includes(e))])if(t[e]?.length){r.push(`## ${i[e]??e}`,``);for(let n of t[e]){let e=n.scope?`**${n.scope}:** `:``;r.push(`- ${e}${n.subject} (${n.hash})`)}r.push(``)}}else if(t===`chronological`)for(let t of e){let e=t.scope?`(${t.scope}) `:``;r.push(`- \`${t.date}\` ${t.type}: ${e}${t.subject} (${t.hash})`)}else{let t={};for(let n of e){let e=n.scope||`general`;t[e]||(t[e]=[]),t[e].push(n)}for(let[e,n]of Object.entries(t)){r.push(`## ${e}`,``);for(let e of n)r.push(`- ${e.type}: ${e.subject} (${e.hash})`);r.push(``)}}return r.join(`
|
|
15
|
-
`)}const Ct=/^[a-z0-9][a-z0-9-]*$/,wt=new Map;function Tt(e){let t=f(e),n=wt.get(t);if(n!==void 0)return n;try{return w(`git`,[`rev-parse`,`--git-dir`],{cwd:t,timeout:1e4,encoding:`utf8`}),wt.set(t,!0),!0}catch{return wt.set(t,!1),!1}}function Et(e,t,n,r){try{return w(`git`,e,{cwd:t,timeout:1e4,input:n,encoding:`utf8`,stdio:[`pipe`,`pipe`,`pipe`]}).trim()}catch(t){r||console.warn(`Git operation failed (${e.join(` `)}): ${t instanceof Error?t.message:String(t)}`);return}}function Dt(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-|-$/g,``).slice(0,60)||`untitled`}function Ot(e,t,n,r,i){let a=Et([`hash-object`,`-w`,`--stdin`],i,n);if(!a)return;let o=Et([`mktree`],i,`100644 blob ${a}\t${t}\n`);if(!o)return;let s=Et([`rev-parse`,e],i,void 0,!0),c=[`commit-tree`,o];s&&c.push(`-p`,s),c.push(`-m`,r);let l=Et(c,i);if(l)return Et([`update-ref`,e,l],i)===void 0?void 0:l}function kt(){wt.clear()}const At=new Set;function jt(e){let t=Dt(e);return t===`untitled`?`checkpoint`:t}function Mt(e={}){let t=e.cwd??process.cwd();return f(e.stateDir??B(t),`checkpoints`)}function Nt(e){return`${e}.bak`}function Pt(e){return!!e&&typeof e==`object`&&!Array.isArray(e)}function Ft(e,t,n){if(typeof e!=`string`||e.length<1||e.length>120)throw Error(`Checkpoint label must be 1-120 characters.`);if(!Pt(t))throw Error(`Checkpoint data must be a JSON-serializable object.`);let r;try{r=JSON.stringify(t)}catch{throw Error(`Checkpoint data must be a JSON-serializable object.`)}if(Buffer.byteLength(r,`utf8`)>5e5)throw Error(`Checkpoint data must be 500KB or less when serialized.`);if(n?.notes!==void 0&&Buffer.byteLength(n.notes,`utf8`)>1e4)throw Error(`Checkpoint notes must be 10KB or less.`);return r}function It(e,t){try{let t=JSON.parse(e);if(!Pt(t))throw Error(`Checkpoint data must deserialize to an object.`);return t}catch(e){console.warn(`Corrupt checkpoint payload ${t}: ${e instanceof Error?e.message:String(e)}`);return}}function Lt(e){let t=It(e.data,e.id);if(t)return{id:e.id,label:e.label,createdAt:e.createdAt,data:t,...e.notes?{notes:e.notes}:{}}}function Rt(e){return{id:e.id,label:e.label,createdAt:e.createdAt,...e.notes?{notes:e.notes}:{}}}function zt(e,t={}){let n=Mt(t);if(At.has(n)||!M(n)){At.add(n);return}try{let t=F(n).filter(e=>e.endsWith(`.json`));for(let r of t){let t=f(n,r);try{let n=P(t,`utf-8`),i=JSON.parse(n),a=typeof i.id==`string`&&i.id.length>0?i.id:o(r,`.json`);if(typeof i.label!=`string`)throw Error(`Missing checkpoint label.`);if(!Pt(i.data))throw Error(`Checkpoint data must be a JSON object.`);let s=Ft(i.label,i.data,{notes:i.notes});e.checkpointSave(a,i.label,s,i.notes)}catch(e){console.warn(`Legacy checkpoint import failed for ${t}: ${e instanceof Error?e.message:String(e)}`)}}let r=Nt(n);M(r)&&ie(r,{recursive:!0,force:!0}),I(n,r),At.add(n)}catch(e){console.warn(`Legacy checkpoint import failed for ${n}: ${e instanceof Error?e.message:String(e)}`)}}function Bt(e,t,n,r){zt(e,{cwd:r?.cwd});let i=Ft(t,n,{notes:r?.notes}),a=`${Date.now()}-${jt(t)}`;e.checkpointSave(a,t,i,r?.notes);let o=Vt(e,a,{cwd:r?.cwd});if(!o)throw Error(`Failed to load saved checkpoint "${a}".`);return o}function Vt(e,t,n={}){zt(e,n);let r=e.checkpointLoad(t);if(r)return Lt(r)}function Ht(e,t={}){return zt(e,t),e.checkpointList(t.label,t.limit).map(Rt)}function Ut(e,t={}){zt(e,t);let n=e.checkpointLatest(t.label);if(n)return Lt(n)}function Wt(e,t,n,r={}){zt(e,r);let i=e.checkpointDiff(t,n);if(!i)return;let a=It(i.from,t),o=It(i.to,n);if(!a||!o)return;let s=new Set(Object.keys(a)),c=new Set(Object.keys(o));return{fromId:t,toId:n,added:[...c].filter(e=>!s.has(e)),removed:[...s].filter(e=>!c.has(e)),modified:[...s].filter(e=>c.has(e)).filter(e=>JSON.stringify(a[e])!==JSON.stringify(o[e]))}}function Gt(e,t,n){return zt(e,{cwd:n?.cwd}),e.checkpointHistory(t,n?.limit??20).map(Rt)}function Kt(e,t){zt(e,{cwd:t?.cwd});let n=t?.keepLast??10,r=t?.dryRun??!0,i=t?.maxAgeDays===void 0?void 0:Date.now()-t.maxAgeDays*864e5,a=t?.label?jt(t.label):void 0,o=t?.label?e.checkpointHistory(t.label):e.checkpointList(),s=new Map;for(let e of o){let t=jt(e.label);if(a&&t!==a)continue;let n=s.get(t);n?n.push(e):s.set(t,[e])}let c=[],l=0;for(let e of s.values())e.forEach((e,t)=>{let r=Date.parse(e.createdAt);if(t<n&&!(i!==void 0&&!Number.isNaN(r)&&r<i)){l+=1;return}c.push(e.id)});if(!r)for(let t of c)e.checkpointDelete(t);return{deleted:c.length,kept:l,labels:[...s.keys()],deletedIds:c}}const qt=[`.ts`,`.tsx`,`.js`,`.jsx`],Jt=new Set([`node_modules`,`.git`,`dist`,`build`,`coverage`,`.turbo`,`.cache`,`cdk.out`,z.state]);function Yt(e){return e.replace(/\\/g,`/`)}function Xt(e){return e.replace(/[.+^${}()|[\]\\]/g,`\\$&`)}function Zt(e,t){let n=Yt(e),r=Yt(t).trim();if(!r)return!1;let i=Xt(r).replace(/\*\*/g,`::DOUBLE_STAR::`).replace(/\*/g,`[^/]*`).replace(/\?/g,`[^/]`).replace(/::DOUBLE_STAR::/g,`.*`);return RegExp(`^${i}$`).test(n)}function Qt(e,t,n){return t.some(t=>Zt(e,t)?!0:n?Zt(`${e}/`,t):!1)}async function $t(e,t,r,a){let o=[],s=t.map(e=>e.toLowerCase()),l=Math.max(0,Math.min(a?.maxFiles??1e4,5e4)),f=Math.max(0,Math.min(a?.maxDepth??20,50));async function p(t,a){if(a>f||o.length>=l)return;let m=await n(t);for(let n of m){if(o.length>=l)return;if(Jt.has(n))continue;let f=u(t,n),m=await i(f),h=Yt(d(e,f));if(m.isDirectory()){Qt(h,r,!0)||await p(f,a+1);continue}Qt(h,r,!1)||s.includes(c(n).toLowerCase())&&o.push(f)}}return await p(e,0),o.sort((e,t)=>e.localeCompare(t)),o}const en=z.restorePoints;function tn(){let e=u(process.cwd(),en);return M(e)||N(e,{recursive:!0}),e}function nn(e,t,n){let r=tn(),i=`${Date.now()}-${e}`,a={id:i,timestamp:new Date().toISOString(),operation:e,files:t,description:n};R(u(r,`${i}.json`),`${JSON.stringify(a,null,2)}\n`,`utf-8`);let o=F(r).filter(e=>e.endsWith(`.json`)).sort();for(;o.length>50;){let e=o.shift();if(!e)break;try{ae(u(r,e))}catch{}}return i}function rn(){let e=u(process.cwd(),en);return M(e)?F(e).filter(e=>e.endsWith(`.json`)).sort().reverse().map(t=>{try{return JSON.parse(P(u(e,t),`utf-8`))}catch(n){return console.debug(`Skipping corrupt restore point ${u(e,t)}: ${n instanceof Error?n.message:String(n)}`),null}}).filter(e=>e!==null):[]}async function an(e){let t=u(u(process.cwd(),en),`${e}.json`);if(!M(t))throw Error(`Restore point not found: ${e}`);let n=JSON.parse(P(t,`utf-8`)),r=[];for(let e of n.files){let t=s(e.path);M(t)||N(t,{recursive:!0}),await a(e.path,e.content,`utf-8`),r.push(e.path)}return r}function on(e){return e.replace(/\\/g,`/`)}async function sn(e){let{rootPath:n,rules:r,extensions:i=qt,exclude:o=[],dryRun:s=!1}=e,c=r.map(e=>({...e,regex:new RegExp(e.pattern,`g`)})),l=await $t(n,i,o),u=[],f=new Set,p=0,m=[];for(let e of l){let r=on(d(n,e)),i=await t(e,`utf-8`),o=i.split(/\r?\n/),l=!1;for(let[e,t]of c.entries())if(!(t.fileFilter&&!Zt(r,t.fileFilter)))for(let n=0;n<o.length;n++){let i=o[n];t.regex.lastIndex=0;let a=i.replace(t.regex,t.replacement);i!==a&&(o[n]=a,l=!0,f.add(e),u.push({rule:t.description,path:r,line:n+1,before:i,after:a}))}l&&(p+=1,s||(m.push({path:e,content:i}),await a(e,o.join(`
|
|
15
|
+
`)}const Ct=/^[a-z0-9][a-z0-9-]*$/,wt=new Map;function Tt(e){let t=f(e),n=wt.get(t);if(n!==void 0)return n;try{return w(`git`,[`rev-parse`,`--git-dir`],{cwd:t,timeout:1e4,encoding:`utf8`,stdio:[`ignore`,`pipe`,`pipe`],windowsHide:!0}),wt.set(t,!0),!0}catch{return wt.set(t,!1),!1}}function Et(e,t,n,r){try{return w(`git`,e,{cwd:t,timeout:1e4,input:n,encoding:`utf8`,stdio:[`pipe`,`pipe`,`pipe`],windowsHide:!0}).trim()}catch(t){r||console.warn(`Git operation failed (${e.join(` `)}): ${t instanceof Error?t.message:String(t)}`);return}}function Dt(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-|-$/g,``).slice(0,60)||`untitled`}function Ot(e,t,n,r,i){let a=Et([`hash-object`,`-w`,`--stdin`],i,n);if(!a)return;let o=Et([`mktree`],i,`100644 blob ${a}\t${t}\n`);if(!o)return;let s=Et([`rev-parse`,e],i,void 0,!0),c=[`commit-tree`,o];s&&c.push(`-p`,s),c.push(`-m`,r);let l=Et(c,i);if(l)return Et([`update-ref`,e,l],i)===void 0?void 0:l}function kt(){wt.clear()}const At=new Set;function jt(e){let t=Dt(e);return t===`untitled`?`checkpoint`:t}function Mt(e={}){let t=e.cwd??process.cwd();return f(e.stateDir??B(t),`checkpoints`)}function Nt(e){return`${e}.bak`}function Pt(e){return!!e&&typeof e==`object`&&!Array.isArray(e)}function Ft(e,t,n){if(typeof e!=`string`||e.length<1||e.length>120)throw Error(`Checkpoint label must be 1-120 characters.`);if(!Pt(t))throw Error(`Checkpoint data must be a JSON-serializable object.`);let r;try{r=JSON.stringify(t)}catch{throw Error(`Checkpoint data must be a JSON-serializable object.`)}if(Buffer.byteLength(r,`utf8`)>5e5)throw Error(`Checkpoint data must be 500KB or less when serialized.`);if(n?.notes!==void 0&&Buffer.byteLength(n.notes,`utf8`)>1e4)throw Error(`Checkpoint notes must be 10KB or less.`);return r}function It(e,t){try{let t=JSON.parse(e);if(!Pt(t))throw Error(`Checkpoint data must deserialize to an object.`);return t}catch(e){console.warn(`Corrupt checkpoint payload ${t}: ${e instanceof Error?e.message:String(e)}`);return}}function Lt(e){let t=It(e.data,e.id);if(t)return{id:e.id,label:e.label,createdAt:e.createdAt,data:t,...e.notes?{notes:e.notes}:{}}}function Rt(e){return{id:e.id,label:e.label,createdAt:e.createdAt,...e.notes?{notes:e.notes}:{}}}function zt(e,t={}){let n=Mt(t);if(At.has(n)||!M(n)){At.add(n);return}try{let t=F(n).filter(e=>e.endsWith(`.json`));for(let r of t){let t=f(n,r);try{let n=P(t,`utf-8`),i=JSON.parse(n),a=typeof i.id==`string`&&i.id.length>0?i.id:o(r,`.json`);if(typeof i.label!=`string`)throw Error(`Missing checkpoint label.`);if(!Pt(i.data))throw Error(`Checkpoint data must be a JSON object.`);let s=Ft(i.label,i.data,{notes:i.notes});e.checkpointSave(a,i.label,s,i.notes)}catch(e){console.warn(`Legacy checkpoint import failed for ${t}: ${e instanceof Error?e.message:String(e)}`)}}let r=Nt(n);M(r)&&ie(r,{recursive:!0,force:!0}),I(n,r),At.add(n)}catch(e){console.warn(`Legacy checkpoint import failed for ${n}: ${e instanceof Error?e.message:String(e)}`)}}function Bt(e,t,n,r){zt(e,{cwd:r?.cwd});let i=Ft(t,n,{notes:r?.notes}),a=`${Date.now()}-${jt(t)}`;e.checkpointSave(a,t,i,r?.notes);let o=Vt(e,a,{cwd:r?.cwd});if(!o)throw Error(`Failed to load saved checkpoint "${a}".`);return o}function Vt(e,t,n={}){zt(e,n);let r=e.checkpointLoad(t);if(r)return Lt(r)}function Ht(e,t={}){return zt(e,t),e.checkpointList(t.label,t.limit).map(Rt)}function Ut(e,t={}){zt(e,t);let n=e.checkpointLatest(t.label);if(n)return Lt(n)}function Wt(e,t,n,r={}){zt(e,r);let i=e.checkpointDiff(t,n);if(!i)return;let a=It(i.from,t),o=It(i.to,n);if(!a||!o)return;let s=new Set(Object.keys(a)),c=new Set(Object.keys(o));return{fromId:t,toId:n,added:[...c].filter(e=>!s.has(e)),removed:[...s].filter(e=>!c.has(e)),modified:[...s].filter(e=>c.has(e)).filter(e=>JSON.stringify(a[e])!==JSON.stringify(o[e]))}}function Gt(e,t,n){return zt(e,{cwd:n?.cwd}),e.checkpointHistory(t,n?.limit??20).map(Rt)}function Kt(e,t){zt(e,{cwd:t?.cwd});let n=t?.keepLast??10,r=t?.dryRun??!0,i=t?.maxAgeDays===void 0?void 0:Date.now()-t.maxAgeDays*864e5,a=t?.label?jt(t.label):void 0,o=t?.label?e.checkpointHistory(t.label):e.checkpointList(),s=new Map;for(let e of o){let t=jt(e.label);if(a&&t!==a)continue;let n=s.get(t);n?n.push(e):s.set(t,[e])}let c=[],l=0;for(let e of s.values())e.forEach((e,t)=>{let r=Date.parse(e.createdAt);if(t<n&&!(i!==void 0&&!Number.isNaN(r)&&r<i)){l+=1;return}c.push(e.id)});if(!r)for(let t of c)e.checkpointDelete(t);return{deleted:c.length,kept:l,labels:[...s.keys()],deletedIds:c}}const qt=[`.ts`,`.tsx`,`.js`,`.jsx`],Jt=new Set([`node_modules`,`.git`,`dist`,`build`,`coverage`,`.turbo`,`.cache`,`cdk.out`,z.state]);function Yt(e){return e.replace(/\\/g,`/`)}function Xt(e){return e.replace(/[.+^${}()|[\]\\]/g,`\\$&`)}function Zt(e,t){let n=Yt(e),r=Yt(t).trim();if(!r)return!1;let i=Xt(r).replace(/\*\*/g,`::DOUBLE_STAR::`).replace(/\*/g,`[^/]*`).replace(/\?/g,`[^/]`).replace(/::DOUBLE_STAR::/g,`.*`);return RegExp(`^${i}$`).test(n)}function Qt(e,t,n){return t.some(t=>Zt(e,t)?!0:n?Zt(`${e}/`,t):!1)}async function $t(e,t,r,a){let o=[],s=t.map(e=>e.toLowerCase()),l=Math.max(0,Math.min(a?.maxFiles??1e4,5e4)),f=Math.max(0,Math.min(a?.maxDepth??20,50));async function p(t,a){if(a>f||o.length>=l)return;let m=await n(t);for(let n of m){if(o.length>=l)return;if(Jt.has(n))continue;let f=u(t,n),m=await i(f),h=Yt(d(e,f));if(m.isDirectory()){Qt(h,r,!0)||await p(f,a+1);continue}Qt(h,r,!1)||s.includes(c(n).toLowerCase())&&o.push(f)}}return await p(e,0),o.sort((e,t)=>e.localeCompare(t)),o}const en=z.restorePoints;function tn(){let e=u(process.cwd(),en);return M(e)||N(e,{recursive:!0}),e}function nn(e,t,n){let r=tn(),i=`${Date.now()}-${e}`,a={id:i,timestamp:new Date().toISOString(),operation:e,files:t,description:n};R(u(r,`${i}.json`),`${JSON.stringify(a,null,2)}\n`,`utf-8`);let o=F(r).filter(e=>e.endsWith(`.json`)).sort();for(;o.length>50;){let e=o.shift();if(!e)break;try{ae(u(r,e))}catch{}}return i}function rn(){let e=u(process.cwd(),en);return M(e)?F(e).filter(e=>e.endsWith(`.json`)).sort().reverse().map(t=>{try{return JSON.parse(P(u(e,t),`utf-8`))}catch(n){return console.debug(`Skipping corrupt restore point ${u(e,t)}: ${n instanceof Error?n.message:String(n)}`),null}}).filter(e=>e!==null):[]}async function an(e){let t=u(u(process.cwd(),en),`${e}.json`);if(!M(t))throw Error(`Restore point not found: ${e}`);let n=JSON.parse(P(t,`utf-8`)),r=[];for(let e of n.files){let t=s(e.path);M(t)||N(t,{recursive:!0}),await a(e.path,e.content,`utf-8`),r.push(e.path)}return r}function on(e){return e.replace(/\\/g,`/`)}async function sn(e){let{rootPath:n,rules:r,extensions:i=qt,exclude:o=[],dryRun:s=!1}=e,c=r.map(e=>({...e,regex:new RegExp(e.pattern,`g`)})),l=await $t(n,i,o),u=[],f=new Set,p=0,m=[];for(let e of l){let r=on(d(n,e)),i=await t(e,`utf-8`),o=i.split(/\r?\n/),l=!1;for(let[e,t]of c.entries())if(!(t.fileFilter&&!Zt(r,t.fileFilter)))for(let n=0;n<o.length;n++){let i=o[n];t.regex.lastIndex=0;let a=i.replace(t.regex,t.replacement);i!==a&&(o[n]=a,l=!0,f.add(e),u.push({rule:t.description,path:r,line:n+1,before:i,after:a}))}l&&(p+=1,s||(m.push({path:e,content:i}),await a(e,o.join(`
|
|
16
16
|
`),`utf-8`)))}return!s&&m.length>0&&nn(`codemod`,m,`codemod: ${r.length} rules, ${p} files`),{changes:u,rulesApplied:f.size,filesModified:p,dryRun:s}}const cn=new Se({max:1e4,ttl:1e3*60*30});function ln(e){return V(`sha256`).update(e).digest(`hex`).slice(0,24)}function un(e,t){return`${e.modelId}:${e.dimensions}:${ln(t)}`}async function dn(e,t,n){if(t.length===0)return[];let r=Array(t.length),i=[],a=[];for(let n=0;n<t.length;n++){let o=t[n],s=cn.get(un(e,o));if(s){r[n]=s;continue}i.push(o),a.push(n)}if(i.length>0){let t=await e.embedBatch(i,n);for(let n=0;n<a.length;n++){let o=a[n],s=t[n]??new Float32Array;r[o]=s,s.length>0&&cn.set(un(e,i[n]),s)}}return r.map(e=>e??new Float32Array)}const fn=.6;function pn(e){if(!e||e.length===0)return 0;let t=Ce(e),n=e.length;return n===0?0:Math.min(t.length/n,fn)/fn}function mn(e){if(e.length===0)return[];let t=new Map,n=[];for(let r of e){let e=Ce(r);n.push(e);for(let n of e)t.set(n,(t.get(n)??0)+1)}let r=[];for(let i=0;i<e.length;i++){let a=e[i],o=n[i];if(!a||o.length===0){r.push(0);continue}let s=Math.min(o.length/a.length,fn)/fn,c=0;for(let e of o)(t.get(e)??0)===1&&c++;let l=c/o.length,u=.6*s+.4*l;r.push(Math.min(u,1))}return r}function hn(e){if(!e||e.length===0)return 0;let t=new Map;for(let n of e)t.set(n,(t.get(n)??0)+1);let n=0,r=e.length;for(let e of t.values()){let t=e/r;t>0&&(n-=t*Math.log2(t))}return Math.min(n/6.6,1)}function gn(e){try{return pn(e)}catch{return hn(e)}}const _n=new Set(`a.an.and.are.as.at.be.by.for.from.how.in.is.it.of.on.or.that.the.this.to.was.what.when.where.with`.split(`.`));function vn(e){let t=e.toLowerCase().split(/[^a-z0-9_]+/i).map(e=>e.trim()).filter(e=>e.length>=2&&!_n.has(e));return[...new Set(t)]}function yn(e,t){let n=0,r=e.indexOf(t);for(;r!==-1;)n++,r=e.indexOf(t,r+t.length);return n}function bn(e,t,n){if(e.length===0||t.length===0)return 0;let r=e.toLowerCase(),i=0,a=0;for(let e of t){let t=yn(r,e);t>0&&(i++,a+=t)}if(i===0)return 0;let o=i/t.length,s=Math.min(1,a/Math.max(1,r.length/32)),c=n.length>=3&&r.includes(n)?1:0;return .65*o+.2*s+.15*c}function xn(e,t,n){if(e.size>=n||t.length===0)return;let r=Math.max(1,Math.floor(t.length/Math.max(1,n-e.size)));for(let i=0;i<t.length&&e.size<n;i+=r){let n=t[i];e.has(n.index)||e.set(n.index,n)}if(e.size>=n)return;let i=[0,Math.floor((t.length-1)/2),t.length-1];for(let r of i){let i=t[r];if(i&&!e.has(i.index)&&e.set(i.index,i),e.size>=n)return}for(let r of t)if(e.has(r.index)||e.set(r.index,r),e.size>=n)return}function Sn(e){return e<=24?e:Math.min(e,Math.min(96,Math.max(24,Math.ceil(Math.sqrt(e)*6))))}function Cn(e,t){if(e.length===0)return[];let n=Sn(e.length),r=t.trim().toLowerCase(),i=vn(t),a=e.map((e,t)=>{let n=bn(e,i,r),a=hn(e);return{index:t,text:e,lexicalScore:n,semanticBonus:a,prefilterScore:i.length===0?a:n>0?n*.85+a*.15:a*.35}});if(a.length<=n){let e=mn(a.map(e=>e.text));return a.map((t,n)=>({...t,semanticBonus:e[n]??t.semanticBonus}))}let o=[...a].sort((e,t)=>t.prefilterScore-e.prefilterScore||t.lexicalScore-e.lexicalScore||e.text.length-t.text.length||e.index-t.index),s=new Map,c=Math.min(n,Math.max(1,Math.ceil(n*.75)));for(let e of o){if(s.size>=c)break;s.set(e.index,e)}xn(s,a,n);let l=[...s.values()].sort((e,t)=>e.index-t.index),u=mn(l.map(e=>e.text));return l.map((e,t)=>({...e,semanticBonus:u[t]??e.semanticBonus}))}const wn=new Se({max:200,ttl:1e3*60*30});function Tn(e){return V(`sha256`).update(e).digest(`hex`).slice(0,16)}function En(e,t){let n=Tn(t),r=wn.get(e);if(wn.set(e,{hash:n,text:t,timestamp:Date.now()}),!r||r.hash===n)return{text:r?.hash===n?`[No changes since last read]`:t,isDelta:r?.hash===n,hash:n};let i=we(e,e,r.text,t,`previous`,`current`,{context:3});return i.length>=t.length*.8?{text:t,isDelta:!1,hash:n}:{text:i,isDelta:!0,hash:n}}const Dn=/^ctx[cd]_[a-z0-9]+$/,On=new Se({max:250,ttl:1e3*60*30});function kn(e,t){let n=V(`sha256`).update(e).update(`\0`).update(t).digest(`hex`);return`${e===`compact`?`ctxc`:`ctxd`}_${n.slice(0,12)}`}function An(e){return Dn.test(e)}function jn(e){if(e.text.length===0||e.text.length>1e5)return;let t={...e,ref:kn(e.kind,e.text),createdAt:Date.now()};return On.set(t.ref,t),t}function Mn(e){return On.get(e)}function Nn(e,t=15){try{let n=F(s(e),{withFileTypes:!0});if(n.length===0)return``;let r=n.slice(0,t).map(e=>e.isDirectory()?`${e.name}/`:e.name),i=n.length>t?`, … (${n.length} total)`:``;return` Available in directory: ${r.join(`, `)}${i}`}catch{return``}}function Pn(e){return{text:e.text,ref:e.ref,originalChars:e.originalChars,compressedChars:e.compressedChars,ratio:e.originalChars===0?0:e.compressedChars/e.originalChars,segmentsKept:1,segmentsTotal:1}}async function Fn(e,n){let{query:r,ref:a,maxChars:o=3e3,minScore:s=.3,segmentation:c=`paragraph`}=n,l=r?.trim(),u=n.tokenBudget?n.tokenBudget*4:o;function d(e){if(n.storeReference===!1||e.text.length===0)return e;let t=jn({kind:`compact`,text:e.text,originalChars:e.originalChars,compressedChars:e.compressedChars});return t?{...e,ref:t.ref}:e}if(a&&(n.text||n.path))throw Error(`Provide "ref" by itself, not together with "text" or "path".`);let f=a?Mn(a):void 0;if(a){if(!f)throw Error(`Cached ref not found: ${a}. It may have expired.`);if(!l)return Pn(f)}if(!l)throw Error(`Either "query" or "ref" must be provided`);let p;if(n.text)p=n.text;else if(f)p=f.text;else if(n.path){if(An(n.path))throw Error(`Cached reversible refs must be passed as "ref", not "path".`);let e;try{e=await i(n.path)}catch(e){let t=e.code;if(t===`ENOENT`){let e=Nn(n.path);throw Error(`File not found: ${n.path}. Check the path and try again.${e}`)}throw t===`EACCES`||t===`EPERM`?Error(`Permission denied reading ${n.path}. The file exists but is not accessible.`):e}if(e.isDirectory())throw Error(`Path is a directory: ${n.path}. compact requires a file path, not a directory. Use analyze({ aspect: "structure", path }) or find to explore directories.`);if(e.size>1e7)throw Error(`File too large (${(e.size/1e6).toFixed(1)}MB). compact supports files up to 10MB. Consider splitting or using search instead.`);p=n.cache?(await n.cache.get(n.path)).content:await t(n.path,`utf-8`)}else throw Error(`Either "text", "path", or "ref" must be provided`);if(n.mode===`delta`&&n.path){let e=En(n.path,p);if(e.isDelta)return d({text:e.text,originalChars:p.length,compressedChars:e.text.length,ratio:e.text.length/p.length,segmentsKept:1,segmentsTotal:1})}if(p.length<=u)return d({text:p,originalChars:p.length,compressedChars:p.length,ratio:1,segmentsKept:1,segmentsTotal:1});let m=ct(p,c);if(m.length===0)return d({text:``,originalChars:p.length,compressedChars:0,ratio:0,segmentsKept:0,segmentsTotal:0});let h;try{h=await e.embedQuery(l)}catch{h=new Float32Array}if(h.length===0){let e=p.slice(0,u);return d({text:`/* warning: embeddings unavailable — returning unscored text */\n${e}`,originalChars:p.length,compressedChars:e.length,ratio:e.length/p.length,segmentsKept:m.length,segmentsTotal:m.length})}let g=Cn(m,l),_=await dn(e,g.map(e=>e.text),8),v=g.map((e,t)=>{let n=_[t]??new Float32Array,r=.85*ft(h,n)+.15*e.semanticBonus;return{text:e.text,score:r,index:e.index}}).filter(e=>e.score>=s).sort((e,t)=>t.score-e.score),y=[],b=0;for(let e of v){if(b+e.text.length>u){b===0&&(y.push({...e,text:e.text.slice(0,u)}),b=u);break}y.push(e),b+=e.text.length+2}let x=pt(y.sort((e,t)=>t.score-e.score)).map(e=>e.text).join(`
|
|
17
17
|
|
|
18
18
|
`);return d({text:x,originalChars:p.length,compressedChars:x.length,ratio:x.length/p.length,segmentsKept:y.length,segmentsTotal:m.length})}const In=/vitest|jest|mocha|pnpm test|npm test/i,Ln=/\btsc\b|pnpm check|pnpm typecheck|pnpm lint|biome/i,Rn=/\bgrep\b|\bfind\b|\brg\b|Select-String/i,zn=new Set([`apply_patch`,`codemod`,`create_file`,`rename`,`restore`,`replace_string_in_file`,`vscode_renameSymbol`]),U=[{id:`no-grep-search`,description:`grep_search → use search`,toolMatch:`grep_search`,commandPatterns:null,heuristic:null},{id:`no-semantic-search`,description:`semantic_search → use search`,toolMatch:`semantic_search`,commandPatterns:null,heuristic:null},{id:`no-read-file-understanding`,description:`read_file (for understanding) → use file_summary or compact`,toolMatch:null,commandPatterns:null,heuristic:`read_file with range > 50 lines and no subsequent edit`},{id:`no-terminal-test`,description:`run_in_terminal (for test) → use test_run`,toolMatch:null,commandPatterns:[`vitest`,`jest`,`mocha`,`pnpm test`,`npm test`],heuristic:null},{id:`no-terminal-typecheck`,description:`run_in_terminal (for tsc/lint) → use check`,toolMatch:null,commandPatterns:[`\\btsc\\b`,`pnpm check`,`pnpm typecheck`,`pnpm lint`,`biome`],heuristic:null},{id:`no-terminal-grep`,description:`run_in_terminal (for find/grep) → use find or search`,toolMatch:null,commandPatterns:[`\\bgrep\\b`,`\\bfind\\b`,`\\brg\\b`,`Select-String`],heuristic:null},{id:`no-fetch-webpage`,description:`fetch_webpage → use web_fetch`,toolMatch:`fetch_webpage`,commandPatterns:null,heuristic:null},{id:`no-subagent-present`,description:`present (from subagent) → use Return findings as structured text`,toolMatch:null,commandPatterns:null,heuristic:`present called in subagent context`}];function Bn(e){return typeof e==`object`&&!!e}function Vn(e){try{return JSON.parse(e)}catch{return e}}function Hn(e){let t=Vn(e.input);return Bn(t)?t:null}function Un(e){let t=Hn(e);return t&&typeof t.command==`string`?t.command:e.input}function Wn(e,t){return t.test(e)}function Gn(e){let t=Hn(e),n=typeof t?.startLine==`number`?t.startLine:null,r=typeof t?.endLine==`number`?t.endLine:null;if(n!==null&&r!==null)return Math.max(0,r-n+1);let i=e.input.match(/"startLine"\s*:\s*(\d+)/),a=e.input.match(/"endLine"\s*:\s*(\d+)/);if(!i||!a)return null;let o=Number(i[1]),s=Number(a[1]);return!Number.isFinite(o)||!Number.isFinite(s)?null:Math.max(0,s-o+1)}function Kn(e){return zn.has(e.tool)?!0:/(?:^|_)rename|codemod|apply_patch|create_file|replace_string_in_file|restore/i.test(e.tool)}function qn(e){if(e.tool!==`knowledge`)return!1;let t=Hn(e);return t?t.scope===`flow`&&typeof t.profile==`string`:!1}function W(e,t,n,r){return{rule:n,ruleId:t,tool:e.tool,timestamp:e.ts,suggestion:r}}function Jn(e){let t=new WeakMap;return e.forEach((e,n)=>{t.set(e,n)}),[{id:`no-grep-search`,description:U[0].description,check:e=>e.tool===`grep_search`?W(e,`no-grep-search`,`Avoid grep_search for code discovery.`,"Use `search` instead."):null},{id:`no-semantic-search`,description:U[1].description,check:e=>e.tool===`semantic_search`?W(e,`no-semantic-search`,`Avoid semantic_search for code discovery.`,"Use `search` instead."):null},{id:`no-read-file-understanding`,description:U[2].description,check:n=>{if(n.tool!==`read_file`)return null;let r=Gn(n);if(r===null||r<=50)return null;let i=t.get(n);return i===void 0||e.slice(i+1,i+3).some(Kn)?null:W(n,`no-read-file-understanding`,`Avoid large read_file ranges for understanding code.`,"Use `file_summary` or `compact` for understanding.")}},{id:`no-terminal-test`,description:U[3].description,check:e=>e.tool===`run_in_terminal`&&Wn(Un(e),In)?W(e,`no-terminal-test`,`Avoid terminal-driven test execution.`,"Use `test_run` instead."):null},{id:`no-terminal-typecheck`,description:U[4].description,check:e=>e.tool===`run_in_terminal`&&Wn(Un(e),Ln)?W(e,`no-terminal-typecheck`,`Avoid terminal-driven typecheck or lint execution.`,"Use `check` instead."):null},{id:`no-terminal-grep`,description:U[5].description,check:e=>e.tool===`run_in_terminal`&&Wn(Un(e),Rn)?W(e,`no-terminal-grep`,`Avoid terminal-driven grep or file search.`,"Use `find` or `search` instead."):null},{id:`no-fetch-webpage`,description:U[6].description,check:e=>e.tool===`fetch_webpage`?W(e,`no-fetch-webpage`,`Avoid fetch_webpage when AI Kit web fetching is available.`,"Use `web_fetch` instead."):null},{id:`no-subagent-present`,description:U[7].description,check:n=>{if(n.tool!==`present`)return null;let r=t.get(n);return r===void 0?null:e.slice(Math.max(0,r-5),r).some(qn)?W(n,`no-subagent-present`,`Subagent execution should stay text-only.`,"Subagents should not use `present`."):null}}]}function Yn(e,t={}){let n=typeof t.lastN==`number`?e.slice(-Math.max(0,t.lastN)):[...e],r=Jn(n),i=[];for(let e of n)for(let t of r){let n=t.check(e);n&&i.push(n)}let a=Math.max(0,100-i.length*10),o=i.length===0?`No routing violations detected across ${n.length} replay calls.`:`Compliance score ${a}/100. Found ${i.length} violation(s) across ${n.length} replay calls.`;return{score:a,violations:i,totalCalls:n.length,summary:o}}const Xn=/\b(error|fatal|exception|failed|failure|fail|passed|warn|warning|panic|abort|timeout|critical)\b/i,Zn=[];function Qn(e){Zn.push(e),Zn.sort((e,t)=>t.priority-e.priority)}function $n(e){for(let t of e)Qn(t)}function er(){return Zn}function tr(e){return/^(diff --git|commit [0-9a-f]{7,40}|On branch |Your branch )/m.test(e)?`git`:/^\s*[MADRCU?!]{1,2}\s+\S/m.test(e)&&/^##\s/m.test(e)?`git-status`:/^(npm (warn|ERR!|notice)|added \d+ packages?|up to date)/m.test(e)?`npm`:/^(Packages|Progress):/m.test(e)||/pnpm/.test(e)?`pnpm`:/✓|✗|PASS|FAIL|Tests?\s+\d+\s+(passed|failed)/m.test(e)||/^(PASS|FAIL)\s+\S/m.test(e)?`test-runner`:/^(error TS\d+|warning TS\d+|\S+\.tsx?[(:]\d+)/m.test(e)?`tsc`:/^\S+\.\w+:\d+:\d+\s+(error|warning|info)/m.test(e)||/Found \d+ (error|warning)/m.test(e)?`lint`:/^(CONTAINER ID|IMAGE|REPOSITORY|Step \d+\/\d+|--->)/m.test(e)||/docker|Dockerfile/i.test(e)?`docker`:/^(NAME\s+READY|NAMESPACE\s|kubectl)/m.test(e)?`kubectl`:`unknown`}function nr(e,t,n){return[`\n... [${e} chars / ~${t} tokens omitted]\n`,`\n... [${e} chars omitted]\n`,`
|
|
@@ -24,6 +24,6 @@ ${l}
|
|
|
24
24
|
${e(a)}
|
|
25
25
|
|
|
26
26
|
${o}
|
|
27
|
-
${s}`}}const i={Orchestrator:{title:`The Master Conductor`,description:`Master conductor that orchestrates the full development lifecycle: Planning → Implementation → Review → Recovery → Commit`,argumentHint:null,toolRole:`orchestrator`,sharedBase:null,sharedProtocols:[`decision-protocol`,`forge-protocol`,`thinking-principles`],category:`orchestration`,skills:[]},Planner:{title:`The Strategic Architect`,description:`Autonomous planner that researches codebases and writes comprehensive TDD implementation plans`,compactRole:`TDD implementation plans`,argumentHint:null,toolRole:`planner`,sharedBase:`code-agent-base`,sharedProtocols:[`thinking-principles`,`planning-principles`],category:`orchestration`},Implementer:{title:`The Code Builder`,description:`Persistent implementation agent that writes code following TDD practices until all tasks are complete`,compactRole:`New features, wire up, build`,argumentHint:`Implementation task, feature, or phase from plan`,toolRole:`codeAgent`,sharedBase:`code-agent-base`,sharedProtocols:[`engineering-principles`],category:`implementation`,skills:[[`aikit`,`**Always** — AI Kit tool signatures, search, analysis`],[`typescript`,`When writing TypeScript code — type patterns, generics, utility types`]]},Frontend:{title:`The UI Specialist`,description:`UI/UX specialist for React, styling, responsive design, and frontend implementation`,compactRole:`UI/UX, React, styling, responsive`,argumentHint:`UI component, styling task, or frontend feature`,toolRole:`codeAgent`,sharedBase:`code-agent-base`,sharedProtocols:[`engineering-principles`],category:`implementation`,skills:[[`aikit`,`**Always** — AI Kit tool signatures, search, analysis`],[`react`,`When building React components — hooks, patterns, Server Components`],[`typescript`,`When writing TypeScript code — type patterns, generics, utility types`],[`frontend-design`,`When implementing UI/UX — design systems, accessibility, responsive patterns`]]},Refactor:{title:`The Code Sculptor`,description:`Code refactoring specialist that improves structure, readability, and maintainability`,compactRole:`Cleanup, simplify, DRY, extract`,argumentHint:`Code, component, or pattern to refactor`,toolRole:`refactor`,sharedBase:`code-agent-base`,sharedProtocols:[`engineering-principles`],category:`implementation`,skills:[[`aikit`,`**Always** — AI Kit tool signatures, search, analysis`]]},Debugger:{title:`The Problem Solver`,description:`Expert debugger that diagnoses issues, traces errors, and provides solutions using AI Kit traces and compressed context before raw file reads`,compactRole:`Bug diagnosis, error tracing`,argumentHint:`Error message, stack trace, or description of issue`,toolRole:`debugger`,sharedBase:`code-agent-base`,sharedProtocols:[`engineering-principles`],category:`diagnostics`,skills:[[`aikit`,`**Always** — AI Kit tool signatures, search, analysis`],[`typescript`,`When writing TypeScript code — type patterns, generics, utility types`]]},Security:{title:`The Vulnerability Hunter`,description:`Security specialist that analyzes code for vulnerabilities and compliance`,compactRole:`Vulnerability analysis, auth hardening`,argumentHint:`Code, feature, or component to security review`,toolRole:`security`,sharedBase:`code-agent-base`,sharedProtocols:[`engineering-principles`],category:`diagnostics`,skills:[[`aikit`,`**Always** — AI Kit tool signatures, search, analysis`],[`typescript`,`When reviewing code — security patterns, type safety`]]},Documenter:{title:`The Knowledge Keeper`,description:`Documentation specialist that creates and maintains comprehensive project documentation`,compactRole:`Project documentation`,argumentHint:`Component, API, feature, or area to document`,toolRole:`documenter`,sharedBase:`code-agent-base`,sharedProtocols:[`thinking-principles`,`documentation-principles`],category:`documentation`,skills:[[`aikit`,`**Always** — AI Kit tool signatures, search, analysis`],[`present`,`When presenting documentation previews or architecture visuals to the user`],[`docs`,`When creating or updating project documentation — docs/ convention, architecture blueprints, Diátaxis framework`]]},Explorer:{title:`The Rapid Scout`,description:`Rapid codebase exploration to find files, usages, dependencies, and structural context`,compactRole:`Rapid codebase navigation`,argumentHint:`Find files, usages, and context related to: {topic or goal}`,toolRole:`explorer`,sharedBase:null,sharedProtocols:[`thinking-principles`],category:`exploration`,skills:[[`aikit`,`**Always** — AI Kit tool signatures, search, analysis`]]},Researcher:{title:`The Context Gatherer`,description:`Deep analysis, architecture review, and multi-model decision protocol participant`,compactRole:`Multi-model deep research`,argumentHint:`Research question, problem statement, or subsystem to investigate`,toolRole:`researcher`,sharedBase:`researcher-base`,sharedProtocols:[`thinking-principles`],category:`research`,skills:[[`aikit`,`**Always** — AI Kit tool signatures, search, analysis`],[`lesson-learned`,`When analyzing past changes to extract engineering principles`],[`c4-architecture`,`When researching system architecture — produce C4 diagrams`],[`adr-skill`,`When the research involves a technical decision — draft an ADR`]],variants:{Alpha:n({description:`Primary deep research agent — also serves as default Researcher`,lensName:`Contrarian`,lensDescription:`deep research`,lensPrompt:`actively look for flaws, fatal assumptions, and hidden risks in every approach. The best ideas survive adversarial pressure.`,identityIntro:`, the primary deep research agent. During multi-model decision sessions, you provide deep reasoning and nuanced system design.`,requiredOutputSection:`Depth Analysis`,requiredOutputItems:[`Deep-dive into ONE chosen subsystem (most structurally central to the question)`,`Full evidence chain: file:line citations for every structural claim`,"At least 2 `compact`/`file_summary` extracts woven into the narrative"],focusAreas:[`For every proposed approach, actively seek the fatal flaw or hidden assumption`,`Ask: "Under what conditions does this approach fail catastrophically?"`,`Prefer uncomfortable truths over comfortable consensus`],variantSummary:`You are the DEFAULT researcher. When the Orchestrator needs breadth + depth, they
|
|
27
|
+
${s}`}}const i={Orchestrator:{title:`The Master Conductor`,description:`Master conductor that orchestrates the full development lifecycle: Planning → Implementation → Review → Recovery → Commit`,argumentHint:null,toolRole:`orchestrator`,sharedBase:null,sharedProtocols:[`decision-protocol`,`forge-protocol`,`thinking-principles`],category:`orchestration`,skills:[[`aikit`,`**Always** — AI Kit recall, flow status, search, and ctx ref reuse`]]},Planner:{title:`The Strategic Architect`,description:`Autonomous planner that researches codebases and writes comprehensive TDD implementation plans`,compactRole:`TDD implementation plans`,argumentHint:null,toolRole:`planner`,sharedBase:`code-agent-base`,sharedProtocols:[`thinking-principles`,`planning-principles`],category:`orchestration`,skills:[[`aikit`,`**Always** — AI Kit reading plans, recall, and compressed context reuse`]]},Implementer:{title:`The Code Builder`,description:`Persistent implementation agent that writes code following TDD practices until all tasks are complete`,compactRole:`New features, wire up, build`,argumentHint:`Implementation task, feature, or phase from plan`,toolRole:`codeAgent`,sharedBase:`code-agent-base`,sharedProtocols:[`engineering-principles`],category:`implementation`,skills:[[`aikit`,`**Always** — AI Kit tool signatures, search, analysis`],[`typescript`,`When writing TypeScript code — type patterns, generics, utility types`]]},Frontend:{title:`The UI Specialist`,description:`UI/UX specialist for React, styling, responsive design, and frontend implementation`,compactRole:`UI/UX, React, styling, responsive`,argumentHint:`UI component, styling task, or frontend feature`,toolRole:`codeAgent`,sharedBase:`code-agent-base`,sharedProtocols:[`engineering-principles`],category:`implementation`,skills:[[`aikit`,`**Always** — AI Kit tool signatures, search, analysis`],[`react`,`When building React components — hooks, patterns, Server Components`],[`typescript`,`When writing TypeScript code — type patterns, generics, utility types`],[`frontend-design`,`When implementing UI/UX — design systems, accessibility, responsive patterns`]]},Refactor:{title:`The Code Sculptor`,description:`Code refactoring specialist that improves structure, readability, and maintainability`,compactRole:`Cleanup, simplify, DRY, extract`,argumentHint:`Code, component, or pattern to refactor`,toolRole:`refactor`,sharedBase:`code-agent-base`,sharedProtocols:[`engineering-principles`],category:`implementation`,skills:[[`aikit`,`**Always** — AI Kit tool signatures, search, analysis`]]},Debugger:{title:`The Problem Solver`,description:`Expert debugger that diagnoses issues, traces errors, and provides solutions using AI Kit traces and compressed context before raw file reads`,compactRole:`Bug diagnosis, error tracing`,argumentHint:`Error message, stack trace, or description of issue`,toolRole:`debugger`,sharedBase:`code-agent-base`,sharedProtocols:[`engineering-principles`],category:`diagnostics`,skills:[[`aikit`,`**Always** — AI Kit tool signatures, search, analysis`],[`typescript`,`When writing TypeScript code — type patterns, generics, utility types`]]},Security:{title:`The Vulnerability Hunter`,description:`Security specialist that analyzes code for vulnerabilities and compliance`,compactRole:`Vulnerability analysis, auth hardening`,argumentHint:`Code, feature, or component to security review`,toolRole:`security`,sharedBase:`code-agent-base`,sharedProtocols:[`engineering-principles`],category:`diagnostics`,skills:[[`aikit`,`**Always** — AI Kit tool signatures, search, analysis`],[`typescript`,`When reviewing code — security patterns, type safety`]]},Documenter:{title:`The Knowledge Keeper`,description:`Documentation specialist that creates and maintains comprehensive project documentation`,compactRole:`Project documentation`,argumentHint:`Component, API, feature, or area to document`,toolRole:`documenter`,sharedBase:`code-agent-base`,sharedProtocols:[`thinking-principles`,`documentation-principles`],category:`documentation`,skills:[[`aikit`,`**Always** — AI Kit tool signatures, search, analysis`],[`present`,`When presenting documentation previews or architecture visuals to the user`],[`docs`,`When creating or updating project documentation — docs/ convention, architecture blueprints, Diátaxis framework`]]},Explorer:{title:`The Rapid Scout`,description:`Rapid codebase exploration to find files, usages, dependencies, and structural context`,compactRole:`Rapid codebase navigation`,argumentHint:`Find files, usages, and context related to: {topic or goal}`,toolRole:`explorer`,sharedBase:null,sharedProtocols:[`thinking-principles`],category:`exploration`,skills:[[`aikit`,`**Always** — AI Kit tool signatures, search, analysis`]]},Researcher:{title:`The Context Gatherer`,description:`Deep analysis, architecture review, and multi-model decision protocol participant`,compactRole:`Multi-model deep research`,argumentHint:`Research question, problem statement, or subsystem to investigate`,toolRole:`researcher`,sharedBase:`researcher-base`,sharedProtocols:[`thinking-principles`],category:`research`,skills:[[`aikit`,`**Always** — AI Kit tool signatures, search, analysis`],[`lesson-learned`,`When analyzing past changes to extract engineering principles`],[`c4-architecture`,`When researching system architecture — produce C4 diagrams`],[`adr-skill`,`When the research involves a technical decision — draft an ADR`]],variants:{Alpha:n({description:`Primary deep research agent — also serves as default Researcher`,lensName:`Contrarian`,lensDescription:`deep research`,lensPrompt:`actively look for flaws, fatal assumptions, and hidden risks in every approach. The best ideas survive adversarial pressure.`,identityIntro:`, the primary deep research agent. During multi-model decision sessions, you provide deep reasoning and nuanced system design.`,requiredOutputSection:`Depth Analysis`,requiredOutputItems:[`Deep-dive into ONE chosen subsystem (most structurally central to the question)`,`Full evidence chain: file:line citations for every structural claim`,"At least 2 `compact`/`file_summary` extracts woven into the narrative"],focusAreas:[`For every proposed approach, actively seek the fatal flaw or hidden assumption`,`Ask: "Under what conditions does this approach fail catastrophically?"`,`Prefer uncomfortable truths over comfortable consensus`],variantSummary:`You are the DEFAULT researcher. When the Orchestrator needs breadth + depth, they
|
|
28
28
|
dispatch you alone. Your lens: thorough, evidence-first, exhaustive + contrarian.`}),Beta:n({description:`Research variant — pragmatic analysis with focus on trade-offs and edge cases`,lensName:`First Principles`,lensDescription:`pragmatic analysis`,lensPrompt:`strip away assumptions, decompose to ground truths, and rebuild reasoning from scratch.`,identityIntro:`, a variant of the Researcher agent optimized for **pragmatic analysis**. Focus on trade-offs, edge cases, and practical constraints. Challenge assumptions and highlight risks the primary researcher may overlook.`,requiredOutputSection:`Failure Modes & Counter-Evidence`,requiredOutputItems:[`At least 3 adversarial claims challenging your own primary finding`,`For each counter-claim: the condition under which it would be TRUE, and the
|
|
29
29
|
evidence (file:line or search receipt) that currently falsifies it`,"Any unresolved counter-evidence flagged as `⚠ UNRESOLVED`"],focusAreas:[`Strip every assumption: "Is this truly required, or just inherited convention?"`,`Decompose to ground truths, then rebuild the reasoning from scratch`,`If the current approach exists only because "that's how it's always been done", flag it`],variantSummary:"Your lens: pragmatic skepticism + first principles. Mark competing claims as `A` (Assumed)\nby default; challenge before promoting to `V`."}),Gamma:n({description:`Research variant — broad pattern matching across domains and technologies`,lensName:`Expansionist`,lensDescription:`cross-domain pattern matching`,lensPrompt:`look for the bigger opportunity, find what's undervalued, and identify patterns others dismiss.`,identityIntro:`, a variant of the Researcher agent optimized for **cross-domain pattern matching**. Draw connections from other domains, frameworks, and industries. Bring breadth where Alpha brings depth.`,requiredOutputSection:`Cross-Domain Analogies`,requiredOutputItems:[`At least 2 patterns from other tools/frameworks/domains that apply to the question`,"For each: the external source (cite via `web_search` or `web_fetch` receipt) and\n how it maps to our codebase",`One "missing pattern we should adopt" recommendation`],focusAreas:[`Ask: "What's the bigger opportunity everyone else is ignoring?"`,`Seek undervalued approaches and non-obvious connections across domains`,`Challenge narrow framing: "Is this really just an X problem, or is it also a Y problem?"`],variantSummary:"Your lens: cross-domain pattern matching + expansionist. Weight `web_search` + `web_fetch`\nhigher than peers. Assume the LLM's training data is stale — verify with fresh searches."}),Delta:n({description:`Research variant — implementation feasibility and performance implications`,lensName:`Executor`,lensDescription:`implementation feasibility`,lensPrompt:`focus on what can actually be built, the fastest path to value, and real-world constraints.`,identityIntro:`, a variant of the Researcher agent optimized for **implementation feasibility**. Focus on performance implications, scaling concerns, and concrete implementation paths. Ground theoretical proposals in practical reality.`,requiredOutputSection:`Implementation Cost & Feasibility`,requiredOutputItems:["Complexity snapshot: you MUST call `measure({ path })` on any file ≥ 50 LOC in the\n target subsystem at least once and quote the `cognitiveComplexity` result","Blast radius estimate: `blast_radius({ changed_files })` on the proposed edits",`Time/risk table: | Change | Lines | Risk | Effort |`,`Feasibility verdict: SAFE / RISKY / INFEASIBLE with one-line justification`],focusAreas:[`Ask: "Can this actually be built? What's the fastest path to a working version?"`,`Ground every proposal in concrete effort: lines of code, files changed, risk`,`Reject elegant theory that can't survive contact with the codebase`],variantSummary:'Your lens: implementation feasibility + executor. Prefer `measure` + `blast_radius` +\n`analyze({ aspect: "patterns", ... })` over abstract reasoning.'})}},"Code-Reviewer":{title:`The Quality Guardian`,description:`Code review specialist analyzing code for quality, security, performance, and maintainability`,compactRole:`Dual-perspective code review`,argumentHint:`File path, PR, or code to review`,toolRole:`reviewer`,sharedBase:`code-reviewer-base`,sharedProtocols:[`thinking-principles`,`review-principles`],category:`review`,skills:[[`aikit`,`**Always** — AI Kit tool signatures, search, analysis`],[`typescript`,`When reviewing TypeScript code — type patterns, best practices`]],variants:{Alpha:r({roleName:`Code-Reviewer`,description:`Primary code reviewer`,lensName:`Compliance & Red-Team`,lensDescription:`compliance and red-teaming`,lensPrompt:`you hunt for correctness bugs, security holes, and contract violations that will break in production.`,identityIntro:`, the primary Code-Reviewer agent.`,focusAreas:[`**Correctness** — Logic errors, race conditions, null/undefined paths, off-by-one`,`**Security** — OWASP Top 10, input validation, secrets, injection vectors`,`**Contract compliance** — Does this honor its type signatures, API contracts, and invariants?`,`**Error handling** — What happens on the unhappy path? Missing try/catch, swallowed errors`],instinct:`Your instinct: "How does this break?" Think like an attacker and a pessimist.`,closing:`When in doubt, flag it — false positives are cheaper than missed bugs in production.`}),Beta:r({roleName:`Code-Reviewer`,description:`Code reviewer variant — different LLM perspective for dual review`,lensName:`Quality & Engineering Excellence`,lensDescription:`quality and engineering excellence`,lensPrompt:`you focus on maintainability, performance, testing, and whether the code will age well.`,identityIntro:`, the secondary Code-Reviewer agent.`,focusAreas:[`**Maintainability** — Naming clarity, single responsibility, cognitive complexity, DRY`,`**Performance** — N+1 queries, unnecessary allocations, missing caching, O(n²) where O(n) suffices`,`**Testing** — Coverage for new/changed logic, edge cases, test readability`,`**Patterns** — Consistency with existing codebase conventions, idiomatic usage`],instinct:`Your instinct: "Will a new team member understand this in 6 months?" Think like a mentor.`,closing:`Prefer actionable suggestions over vague concerns. Show the better version when possible.`})}},"Architect-Reviewer":{title:`The Structural Guardian`,description:`Reviews architecture for pattern adherence, SOLID compliance, dependency direction, and structural integrity`,compactRole:`Architecture review`,argumentHint:`Files, PR, or subsystem to architecture-review`,toolRole:`reviewer`,sharedBase:`architect-reviewer-base`,sharedProtocols:[`thinking-principles`,`review-principles`],category:`review`,skills:[[`aikit`,`**Always** — AI Kit tool signatures, search, analysis`],[`c4-architecture`,`When reviewing architectural diagrams or boundary changes`],[`adr-skill`,`When the review involves architecture decisions — reference or create ADRs`]],extraBody:`You are **not** the Code-Reviewer agent. Code-Reviewer handles correctness, testing, security, and code quality. You handle the big picture: service boundaries, dependency direction, pattern adherence, and structural health.`,variants:{Alpha:r({roleName:`Architect-Reviewer`,description:`Primary architecture reviewer`,lensName:`Structural Prosecutor`,lensDescription:`structural prosecution`,lensPrompt:`you challenge architectural choices, find boundary violations, and test whether the design survives growth.`,identityIntro:`, the primary Architect-Reviewer agent.`,focusHeading:`Your primary focus areas:`,focusAreas:[`**Boundary violations** — Does this cross package/module boundaries it shouldn't?`,`**Dependency direction** — Are dependencies flowing inward? Any layer leakage?`,`**Hidden coupling** — Shared mutable state, implicit contracts, temporal coupling`,`**Scalability stress** — What breaks at 10x load, 10x data, 10x features?`],instinct:`Your instinct: "This design will fail when..." Challenge every architectural assumption.`,closing:`If a boundary is crossed, require justification or block.`}),Beta:r({roleName:`Architect-Reviewer`,description:`Architecture reviewer variant — different LLM perspective for dual review`,lensName:`Pragmatic Defense`,lensDescription:`pragmatic defense`,lensPrompt:`you evaluate whether the architecture is proportional to the problem, and defend reasonable trade-offs.`,identityIntro:`, the secondary Architect-Reviewer agent.`,focusHeading:`Your primary focus areas:`,focusAreas:[`**Proportionality** — Is the architecture proportional to the problem? Over-engineering is a defect.`,`**Trade-off validity** — Are the trade-offs explicitly acknowledged and reasonable?`,`**Migration path** — Can this evolve without a rewrite? Is there a clear upgrade path?`,`**Team ergonomics** — Can the team actually maintain this? Does it match their skills?`],instinct:`Your instinct: "Is this the simplest architecture that solves the actual problem?"`,closing:`Push back on unnecessary complexity. Defend working solutions against premature abstraction.`})}}};export{i as AGENTS};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e={copilot:{Orchestrator:{primary:`GPT-5.4
|
|
1
|
+
const e={copilot:{Orchestrator:{primary:`GPT-5.4 (copilot)`,fallbacks:[`GPT-5.4 mini (copilot)`,`GPT-5.4 (copilot)`,`Auto (copilot)`]},Planner:{primary:`GPT-5.4 (copilot)`,fallbacks:[`GPT-5.4 mini (copilot)`,`GPT-5.4 (copilot)`,`Claude Opus 4.6 (copilot)`,`Auto (copilot)`]},Implementer:{primary:`GPT-5.4 mini (copilot)`,fallbacks:[`GPT-5.4 (copilot)`,`GPT-5.3-Codex (copilot)`,`GPT-5.4 mini (copilot)`,`Auto (copilot)`]},Frontend:{primary:`GPT-5.4 mini (copilot)`,fallbacks:[`GPT-5.4 mini (copilot)`,`GPT-5.4 (copilot)`,`Gemini 3.1 Pro (Preview) (copilot)`,`GPT-5.3-Codex (copilot)`,`Auto (copilot)`]},Debugger:{primary:`GPT-5.4 (copilot)`,fallbacks:[`GPT-5.4 (copilot)`,`GPT-5.3-Codex (copilot)`,`Claude Opus 4.6 (copilot)`,`Auto (copilot)`]},Refactor:{primary:`GPT-5.4 (copilot)`,fallbacks:[`GPT-5.4 (copilot)`,`GPT-5.3-Codex (copilot)`,`Auto (copilot)`]},Security:{primary:`GPT-5.4 (copilot)`,fallbacks:[`GPT-5.4 (copilot)`,`Claude Opus 4.6 (copilot)`,`Auto (copilot)`]},Documenter:{primary:`GPT-5.4 mini (copilot)`,fallbacks:[`GPT-5.4 mini (copilot)`,`GPT-5 mini (copilot)`,`Auto (copilot)`]},Explorer:{primary:`GPT-5 mini (copilot)`,fallbacks:[`GPT-5 mini (copilot)`,`Gemini 3 Flash (Preview) (copilot)`,`Auto (copilot)`]},"Researcher-Alpha":{primary:`Claude Opus 4.6 (copilot)`,fallbacks:[`Claude Opus 4.6 (copilot)`,`Auto (copilot)`]},"Researcher-Beta":{primary:`Claude Sonnet 4.6 (copilot)`,fallbacks:[`Claude Sonnet 4.6 (copilot)`,`Auto (copilot)`]},"Researcher-Gamma":{primary:`GPT-5.4 (copilot)`,fallbacks:[`GPT-5.4 (copilot)`,`Auto (copilot)`]},"Researcher-Delta":{primary:`Gemini 3.5 Flash (copilot)`,fallbacks:[`Gemini 3.5 Flash (copilot)`,`Auto (copilot)`]},"Code-Reviewer-Alpha":{primary:`GPT-5.4 (copilot)`,fallbacks:[`GPT-5.4 (copilot)`,`Auto (copilot)`]},"Code-Reviewer-Beta":{primary:`Claude Opus 4.6 (copilot)`,fallbacks:[`Claude Opus 4.6 (copilot)`,`Auto (copilot)`]},"Architect-Reviewer-Alpha":{primary:`GPT-5.4 (copilot)`,fallbacks:[`GPT-5.4 (copilot)`,`Auto (copilot)`]},"Architect-Reviewer-Beta":{primary:`Claude Opus 4.6 (copilot)`,fallbacks:[`Claude Opus 4.6 (copilot)`,`Auto (copilot)`]}},"claude-code":{Orchestrator:{primary:`Claude Sonnet 4.6`},Planner:{primary:`Claude Opus 4.6`},Implementer:{primary:`Claude Sonnet 4.6`},Frontend:{primary:`Claude Sonnet 4.6`},Debugger:{primary:`Claude Opus 4.6`},Refactor:{primary:`Claude Sonnet 4.6`},Security:{primary:`Claude Opus 4.6`},Documenter:{primary:`Claude Sonnet 4.6`},Explorer:{primary:`Claude Sonnet 4.6`},"Researcher-Alpha":{primary:`Claude Opus 4.6`},"Researcher-Beta":{primary:`Claude Sonnet 4.6`},"Researcher-Gamma":{primary:`Claude Opus 4.6`},"Researcher-Delta":{primary:`Claude Sonnet 4.6`},"Code-Reviewer-Alpha":{primary:`Claude Opus 4.6`},"Code-Reviewer-Beta":{primary:`Claude Sonnet 4.6`},"Architect-Reviewer-Alpha":{primary:`Claude Opus 4.6`},"Architect-Reviewer-Beta":{primary:`Claude Sonnet 4.6`}},codex:{Orchestrator:{primary:`gpt-5.4-mini`,reasoningEffort:`high`},Planner:{primary:`gpt-5.4`,reasoningEffort:`high`},Implementer:{primary:`gpt-5.3-codex`,reasoningEffort:`high`},Frontend:{primary:`gpt-5.4`,reasoningEffort:`high`},Debugger:{primary:`gpt-5.3-codex`,reasoningEffort:`high`},Refactor:{primary:`gpt-5.3-codex`,reasoningEffort:`high`},Security:{primary:`gpt-5.4`,reasoningEffort:`high`},Documenter:{primary:`gpt-5.4-mini`,reasoningEffort:`high`},Explorer:{primary:`gpt-5.4-mini`,reasoningEffort:`high`},"Researcher-Alpha":{primary:`gpt-5.4`,reasoningEffort:`high`},"Researcher-Beta":{primary:`gpt-5.3-codex`,reasoningEffort:`high`},"Researcher-Gamma":{primary:`gpt-5.4-mini`,reasoningEffort:`high`},"Researcher-Delta":{primary:`gpt-5.4`,reasoningEffort:`high`},"Code-Reviewer-Alpha":{primary:`gpt-5.4`,reasoningEffort:`high`},"Code-Reviewer-Beta":{primary:`gpt-5.3-codex`,reasoningEffort:`high`},"Architect-Reviewer-Alpha":{primary:`gpt-5.4`,reasoningEffort:`high`},"Architect-Reviewer-Beta":{primary:`gpt-5.3-codex`,reasoningEffort:`high`}}};function t(t,n){return e[t]?.[n]||null}function n(e,n,r=null){return t(e,n)?.primary||r}function r(e,n){return t(e,n)?.fallbacks||[]}function i(t){return Object.fromEntries(Object.entries(e[t]||{}).map(([e,t])=>[e,t.primary]))}const a={Researcher:[`Alpha`,`Beta`,`Gamma`,`Delta`],"Code-Reviewer":[`Alpha`,`Beta`],"Architect-Reviewer":[`Alpha`,`Beta`]},o={Researcher:`Alpha`,"Code-Reviewer":`Alpha`,"Architect-Reviewer":`Alpha`};export{e as PLATFORM_AGENT_MODELS,o as PRIMARY_VARIANT,a as VARIANT_GROUPS,t as getAgentModelConfig,r as getFallbackAgentModels,i as getPlatformPrimaryModelMap,n as getPrimaryAgentModel};
|
|
@@ -155,9 +155,11 @@ Every tool call passes through extractors that capture reusable facts:
|
|
|
155
155
|
| **Research results** | \`web_search\`, \`web_fetch\`, \`search\`, \`find\` | Search findings, web content, code discoveries |
|
|
156
156
|
| **Behavioral patterns** | ALL tools (ring buffer) | Tool preferences, search→edit sequences, error-fix cycles |
|
|
157
157
|
|
|
158
|
+
**Refresh model:** High-use extractors should converge on stable facts keyed by path, task, query, or analysis scope. Revisiting the same thing should refresh or no-op instead of multiplying near-duplicate memory.
|
|
159
|
+
|
|
158
160
|
**Retrieval:** Use \`enrich: true\` on any tool that supports it — the server automatically surfaces previously captured facts relevant to your query. Search/find/knowledge responses can also emit reusable \`ctxc_...\` refs; pass them as \`ref\` to \`compact({ ref })\` or \`compact({ ref, query? })\` instead of reopening the source. \`ctxc_...\` is a reversible ref, not an id or path.
|
|
159
161
|
|
|
160
|
-
**Best practice:** Before re-reading a file you've already explored, try \`search({ query: "file-path-or-topic" })\`
|
|
162
|
+
**Best practice:** Before re-reading a file you've already explored, try \`search({ query: "exact-file-path-or-topic" })\` first. If you already have a \`ctxc_...\` ref, reuse it with \`compact({ ref })\` or \`compact({ ref, query? })\`. Reach for fresh \`file_summary\` / \`scope_map\` calls only when the topic materially changed or retrieval came back thin.
|
|
161
163
|
|
|
162
164
|
### Retention & Tier Promotion
|
|
163
165
|
- Memories start at **working** tier → promote on repeated access: episodic (2) → semantic (5) → procedural (10)
|