@counterfact-labs/cli 0.2.6 → 0.2.7
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/README.md +20 -0
- package/bundle/client-release.json +1 -1
- package/dist/adapters/completion-lock.js +95 -0
- package/dist/adapters/completion.js +132 -17
- package/dist/adapters/entry-files.js +126 -0
- package/dist/adapters/entry-selection.js +45 -0
- package/dist/adapters/files.js +2 -1
- package/dist/adapters/results.js +10 -2
- package/dist/adapters/selection.js +104 -0
- package/dist/adapters/settings.js +29 -2
- package/dist/analysis-core/analysis/schemas.js +1 -1
- package/dist/analysis-core/chunks/2PZF54KH.js +10 -0
- package/dist/analysis-core/chunks/{OPMA32A6.js → 6RWEWBHK.js} +1 -1
- package/dist/analysis-core/chunks/{PECX3OXB.js → 7NEWZ74F.js} +1 -1
- package/dist/analysis-core/chunks/{6QY5BV5B.js → CGCJN73D.js} +1 -1
- package/dist/analysis-core/chunks/CWYVUGG4.js +1 -0
- package/dist/analysis-core/chunks/{3JWEFCTJ.js → FBTOOUPL.js} +1 -1
- package/dist/analysis-core/chunks/GOQVKWP3.js +32 -0
- package/dist/analysis-core/chunks/IHAVDX4L.js +66 -0
- package/dist/analysis-core/chunks/IVULXWQN.js +21 -0
- package/dist/analysis-core/chunks/K5FUABWW.js +1 -0
- package/dist/analysis-core/chunks/KGQYR62R.js +7 -0
- package/dist/analysis-core/chunks/PY5M22CL.js +1 -0
- package/dist/analysis-core/chunks/{YDBO7P4X.js → RNTMH4MU.js} +1 -1
- package/dist/analysis-core/chunks/RUVMFAST.js +1 -0
- package/dist/analysis-core/chunks/S27VIQMZ.js +1 -0
- package/dist/analysis-core/chunks/{5DGPLXYB.js → SLJ6CW7W.js} +1 -1
- package/dist/analysis-core/chunks/{STI4JE7L.js → UEORNVQB.js} +1 -1
- package/dist/analysis-core/chunks/{X7WZAA7S.js → WYLIV2P2.js} +1 -1
- package/dist/analysis-core/contracts/analysis-selection.js +1 -0
- package/dist/analysis-core/contracts/module-resolution.js +1 -0
- package/dist/analysis-core/contracts/relay-analysis.js +1 -1
- package/dist/analysis-core/contracts/requests.js +1 -1
- package/dist/analysis-core/contracts/selection-paths.js +1 -0
- package/dist/analysis-core/conventions/analysis-fit.js +1 -1
- package/dist/analysis-core/conventions/file-admission.js +1 -1
- package/dist/analysis-core/import/calls/modules.js +1 -0
- package/dist/analysis-core/import/outside-loader-sources.js +1 -1
- package/dist/analysis-core/index.js +3 -3
- package/dist/analysis-core/requests/local-plan.js +1 -1
- package/dist/analysis-core/requests/registry.js +1 -1
- package/dist/analysis-core/requests/template-version.js +1 -1
- package/dist/analysis-core/requests/tools.js +1 -1
- package/dist/analysis-core/settings.js +1 -1
- package/dist/analysis-core/stages/engine-entry.js +1 -1
- package/dist/cli/analysis-selection.js +91 -0
- package/dist/cli/commands/analyze.js +31 -6
- package/dist/cli/completion-delivery.js +63 -0
- package/dist/cli/completion-recovery.js +68 -14
- package/dist/cli/context.js +2 -1
- package/dist/cli/main.js +21 -9
- package/dist/cli/mcp.js +70 -11
- package/dist/cli/prior-completion.js +35 -0
- package/dist/cli/relay-check.js +163 -97
- package/dist/cli/relay-failure.js +32 -0
- package/dist/cli/relay-preparation.js +24 -11
- package/dist/cli/results-upload.js +131 -0
- package/dist/cli/scope-choices.js +57 -0
- package/dist/contract/cli-refusals.js +8 -0
- package/dist/contract/cli-version.js +1 -1
- package/dist/contract/console.js +7 -2
- package/dist/contract/scope-choice.js +78 -0
- package/dist/contract/selection-metadata.js +9 -0
- package/dist/contract/selection-offer.js +43 -0
- package/dist/gatekeeper/console.js +36 -25
- package/package.json +2 -2
- package/dist/analysis-core/chunks/377MLK4M.js +0 -21
- package/dist/analysis-core/chunks/DLPVYWHZ.js +0 -1
- package/dist/analysis-core/chunks/FOKDE64Y.js +0 -1
- package/dist/analysis-core/chunks/KTNA2KTN.js +0 -7
- package/dist/analysis-core/chunks/NIOS7U6C.js +0 -41
- package/dist/analysis-core/chunks/QFY6A3MS.js +0 -66
- package/dist/analysis-core/chunks/SVMEWGD3.js +0 -1
- package/dist/analysis-core/chunks/ZTOVBAG7.js +0 -1
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import{a as ko,d as De,f as Ge}from"./K5FUABWW.js";import{C as yo,a as V,b as st,c as Be,d as no,e as so,f as ro,g as io,h as ao,i as rt,j as lo,k as fo,l as co,m as po,n as re,o as mo,u as uo,v as ho,w as go,z as ze}from"./KGQYR62R.js";import{b as Se}from"./2PSNOSJ2.js";import{$ as Tt,$a as ot,A as Ft,B as Ie,F as Et,H as Oe,I as ke,Ia as Ne,J as At,M as Rt,N as xe,O as $t,Q as Me,S as _e,Ua as Wt,Va as qt,Wa as tt,X as jt,Xa as Jt,Y as Lt,Z as It,_ as _t,_a as Vt,a as St,ab as Te,b as Ot,bb as nt,cb as Yt,d as et,db as Ut,e as te,eb as Xt,f as je,fb as Qt,g as Le,ha as Bt,hb as Ht,i as fe,ib as Zt,jb as eo,k as Mt,kb as to,l as ce,m as oe,n as U,o as pe,p as K,pb as oo,q,qa as _,u as ee,v as me,wa as zt,x as Ct,z as B}from"./GOQVKWP3.js";import{a as se,c as Ce,f as Kt}from"./2PZF54KH.js";import{a as Fe}from"./PY5M22CL.js";import{e as Nt}from"./YUY436SM.js";import{a as xt,b as ne,c as D}from"./C6X5GDG4.js";import{e as Gt}from"./RUVMFAST.js";import{a as Dt}from"./S27VIQMZ.js";function Ee(t){let e;try{e=JSON.parse(t)}catch{return{config:null,invalid:!0}}if(typeof e!="object"||e===null||Array.isArray(e))return{config:null,invalid:!0};let o=e,s={};for(let r of["name","model","description","prompt"]){let n=Ke(o[r]);n&&(s[r]=n)}if(Array.isArray(o.agents)){let r=o.agents.flatMap(n=>{let l=kn(n);return l?[l]:[]});r.length>0?s.agents=r:s.invalidAgents=!0}return{config:s,invalid:!1}}function bo(t){let{config:e}=Ee(t);return e?it(e):"bare"}function it(t){return t.agents?.length?"agents":t.prompt?"prompt":"bare"}function We(t){let e=it(t);return e==="agents"?t.agents:e==="prompt"?[{name:t.name,model:t.model,prompt:t.prompt}]:[]}function qe(t,e,o){return wo(t,e,o).paths}function wo(t,e,o,s={}){let r=We(e).map(a=>a.prompt),n=[],l=[];for(let a of r){let u=lt(a).path,y=ft(o,u);if(y===null){l.push({path:u,reason:"out-of-scope"});continue}let c=_(t,{path:y},{purpose:"pointer",route:"github",...s});c.admitted?n.push(y):l.push({path:y,reason:c.reason})}return{paths:n,refused:l}}function at(t,e,o){let s=ft(o.markerDir,lt(e).path),r=s!==null?_(t,{path:s},{purpose:"pointer",route:"github"}):null;if(r&&!r.admitted&&r.reason==="secret")return{kind:"secret",path:s};let n=bn(e,o,eo(t));return n?{kind:"resolved",prompt:n}:{kind:"missed"}}function Zn(t,e,o){let s=[],r=[];e.invalidAgents&&r.push(`${o.repoKey}: counterfact.json "agents" has no entry with a prompt pointer; ignored`);let n=it(e);for(let l of We(e)){let a=at(t,l.prompt,o);if(a.kind==="secret"){r.push(Nt(a.path));continue}if(a.kind==="missed"){r.push(`${o.repoKey}: counterfact.json points at ${l.prompt}, which was not found; ignored`);continue}s.push({name:l.name??null,model:l.model??null,description:n==="prompt"?e.description??null:null,prompt:a.prompt})}return{agents:s,warnings:r,refused:wo(t,e,o.markerDir).refused}}function Ke(t){return typeof t=="string"&&t.trim()?t.trim():void 0}function kn(t){if(typeof t!="object"||t===null)return null;let e=t,o=Ke(e.prompt);if(!o)return null;let s={prompt:o},r=Ke(e.name),n=Ke(e.model);return r&&(s.name=r),n&&(s.model=n),s}function lt(t){let e=t.replace(/\\/g,"/"),o=e.indexOf("#");if(o>=0)return{path:e.slice(0,o),symbol:e.slice(o+1),line:null};let s=/^(.*):(\d+)$/.exec(e);return s?{path:s[1],symbol:null,line:Number(s[2])}:{path:e,symbol:null,line:null}}function ft(t,e){let o=[];for(let s of[...t.split("/"),...e.split("/")])if(s===".."){if(o.pop()===void 0)return null}else s!=="."&&s!==""&&o.push(s);return o.join("/")}function bn(t,e,o){let{path:s,symbol:r,line:n}=lt(t),l=ft(e.markerDir,s);if(l===null||!Object.hasOwn(e.files,l))return null;let a=e.files[l];if(a===void 0)return null;if(r===null&&n===null)return se(l)?null:Rt(l,a);let{sites:u}=Zt(l,a,{minChars:1,promptFunctions:o});return r!==null?u.find(y=>y.symbol===r)??null:wn(u,n)}function wn(t,e){let o=r=>Math.min(r.line,r.span.from),s=t.filter(r=>o(r)<=e&&e<=r.span.to);return s.sort((r,n)=>r.span.to-o(r)-(n.span.to-o(n))),s[0]??null}function Pn(t){return oe(t,"CF_IMPORT_SCOPED_SCAN")}function Po(t,e,o,s="bare"){let r=e.filter(y=>Ie(t,y,o)),n=Pn(t);if(!n&&!r.length)return;if(!n&&(s==="agents"||s==="prompt"))return[];let l=n?co(t,e,o).filter(y=>!y.convention&&(!y.markerPath||y.scope.key===null&&s!=="agents"&&s!=="prompt")).flatMap(y=>y.paths):vo(t,e,o,s)?e:[];if(!l.length&&!r.length)return l;let a=xt(o),u=new Set([...l,...r]);for(let y of e){let c=D(y,a);c!==null&&!c.includes("/")&&$t(y)&&u.add(y)}return[...u]}function be(t,{paths:e,root:o,scanFlag:s,marker:r}){let n={scan:!1,markerToRead:null};if(!s)return n;let l=V(t,e,o);if(l.configPath&&r===null)return{scan:!1,markerToRead:l.configPath};let a=Po(t,e,o,r);return a?{scan:a.length>0,markerToRead:null,scanPaths:a}:{scan:vo(t,e,o,r),markerToRead:null}}function vo(t,e,o,s){let r=V(t,e,o);return Le({usage:"scan",codeAgentsFound:!1,otherDefinitions:Be(r)},t)!=="prompt"&&!no(t,r)&&s!=="agents"&&s!=="prompt"}function fs(t,e){if(e.phase==="read"){let l=bo(e.text??"");if(e.pending.scanPaths){let a=Ee(e.text??"").config,u=e.pending.markerPath.split("/").slice(0,-1).join("/"),y=new Set(a?qe(t,a,u):[]),c=l==="bare"?e.pending.scanPaths:(e.pending.scanPathsIfExplicit??[]).filter(v=>!y.has(v));return{kind:"settled",markerPath:e.pending.markerPath,markerKind:l,scan:c.length>0,scanPaths:c}}return{kind:"settled",markerPath:e.pending.markerPath,markerKind:l,scan:e.pending.scanIfBare&&l==="bare"}}let{paths:o,root:s,scanFlag:r}=e,n=be(t,{paths:o,root:s,scanFlag:r,marker:null});if(!r)return{kind:"off"};if(n.markerToRead){let l=be(t,{paths:o,root:s,scanFlag:r,marker:"bare"});return{kind:"marker",markerPath:n.markerToRead,scanIfBare:l.scan,...l.scanPaths?{scanPaths:l.scanPaths,scanPathsIfExplicit:Po(t,o,s,"agents")}:{}}}return{kind:"settled",markerPath:null,markerKind:null,scan:n.scan,...n.scanPaths?{scanPaths:n.scanPaths}:{}}}var So=(t,e)=>{let{markerToRead:o}=be(e.settings,{paths:t.map(({path:s})=>s),root:e.dir??void 0,scanFlag:e.flags.scan,marker:null});return o?{strength:"partial",wants:[o]}:null};function Oo(t,e,o="bare"){let{scan:s}=be(e.settings,{paths:t.map(({path:r})=>r),root:e.dir??void 0,scanFlag:e.flags.scan,marker:o});return s?{strength:"partial",wants:[]}:null}function we(t){return oe(t,"CF_IMPORT_MANIFEST")}function de(t,e){if(!ke(t))return null;let o=new Set(e.paths),s=At(t,e),r=new Set(e.skillPaths),n=new Set(e.referencePaths),l=g=>Object.hasOwn(e.files,g)?Buffer.byteLength(e.files[g]):e.sizes?.get(g),a=e.selected??[...new Set([...e.skillPaths,...Object.keys(e.files).filter(g=>Oe(g,{nested:!0})?.reference)])].filter(g=>Object.hasOwn(e.files,g)).map(g=>({path:g,size:l(g)})),u=[...new Map(a.filter(g=>!n.has(g.path)||r.has(g.path)).map(g=>[g.path,g])).values()],y=new Set(u.map(g=>g.path)),c=u.filter(g=>r.has(g.path)),v=new Set(u.filter(g=>Oe(g.path,{nested:!0})?.reference).map(g=>g.path)),d=c.length,p=B.conventionImport.skillBytes-u.filter(g=>r.has(g.path)||v.has(g.path)).reduce((g,P)=>g+(l(P.path)??P.size),0),w=ce(t)?B.codeAgent.importBytes-u.reduce((g,P)=>g+(l(P.path)??P.size),0):1/0,k=new Map(c.map(g=>[g.path,null])),f=(g,P=!1)=>{if(k.has(g))return;let i=l(g),b=v.has(g),h=_(t,{path:g,size:i,text:e.files[g]},{...e.admission,purpose:"skill",route:"github",root:e.root,listing:o,managedFiles:e.files}),S=y.has(g)?0:i,M=h.admitted?i===void 0?"missing":!b&&d>=B.conventionImport.skillFiles?"allowance":!b&&(i>p||S>w)?"total":null:h.reason;k.set(g,M),!b&&(P||!M)&&d++,!b&&!M&&(p-=i,w-=S)};for(let g of n)f(g,!0);let m=[...new Set(e.skillPaths)].sort().filter(g=>Object.hasOwn(e.files,g)).map(g=>{let P={ownerPath:g,files:[],cycles:[],unresolved:[],refused:[]},i=new Set([g]);for(let b of s.references.filter(h=>h.ownerPath===g)){if(!i.has(b.fromPath))continue;f(b.path);let h=k.get(b.path);if(h){P.refused.push({path:b.path,reason:h});continue}i.add(b.path);let S=P.files.find(M=>M.path===b.path);S||(S={path:b.path,evidence:[],sharedOwners:[]},P.files.push(S)),S.evidence.push(b)}return P.cycles=s.cycles.filter(b=>b.ownerPath===g&&i.has(b.fromPath)),P.unresolved=s.unresolved.filter(b=>b.ownerPath===g&&i.has(b.fromPath)),P.refused=Se(P.refused),P}),O=new Map;for(let g of m)for(let P of g.files)O.set(P.path,[...O.get(P.path)??[],g.ownerPath]);for(let g of m)for(let P of g.files)P.sharedOwners=O.get(P.path);return m}var vn=2e3;function xo(t,e,o,s={}){let r=e.filter(h=>D(h.path,o)!=null),n={},l=[],a=new Map,u=s.mode!=="core"&&Ne(t),y=re(t,r.map(h=>h.path),o,{mode:u?"all":"core",files:s.files}),c=new Set([...y.ignoredPaths,...y.ignoredImportPaths]),v=new Map(y.files.filter(h=>h.role!=="reference").map(h=>[h.path,h])),d=new Map(y.scopes.map(h=>[h.key,B.conventionImport.totalBytes])),p=B.conventionImport.skillBytes,w=ce(t)?B.codeAgent.importBytes:1/0,k=0,f=h=>D(h.path,y.ownerOf(h.path).folder)??h.path,m=(h,S)=>{a.set(h.path,{path:h.path,reason:S})},O=(h,S)=>{let M=_(t,h,{purpose:S,route:"github",root:o});return M.admitted?!0:(m(h,M.reason),!1)},g=h=>{if(n[h.path])return;let S=u&&v.get(h.path)?.role==="skill"?"skill":"core",M=y.ownerOf(h.path),E=S==="skill"?p:d.get(M.key),C=h.size??0;if(S==="skill"&&k>=B.conventionImport.skillFiles){m(h,"allowance");return}if(C>E||C>w){m(h,"total");return}n[h.path]=h.ref,l.push(h.path),w-=C,S==="skill"?(p-=C,k++):d.set(M.key,E-C)},P=r.filter(h=>v.has(h.path));for(let h of P)O(h,Tt(v.get(h.path).role))&&g(h);let i=0;if(we(t))for(let h of Te(new Set(r.map(S=>S.path)))){let S=r.find(M=>M.path===h);if(i>=B.conventionImport.extractionFiles){m(S,"allowance");continue}if(O(S,"source")&&O(S,"definition")){let M=l.length;g(S),l.length>M&&i++}}let b=y.needsExtraction;if(b){let h=r.flatMap(M=>{if(c.has(M.path)||n[M.path]||u&&Oe(f(M)))return[];if(!O(M,"extraction"))return[];let E=zt(f(M));return E===null?[]:[{entry:M,rank:E}]}).sort((M,E)=>M.rank-E.rank||(M.entry.size??0)-(E.entry.size??0)),S=i;for(let{entry:M}of h){if(S>=B.conventionImport.extractionFiles){m(M,"allowance");continue}let E=l.length;g(M),l.length>E&&S++}}if(u&&s.files){let h=Sn(t,{entries:e,selected:r.filter(S=>Object.hasOwn(n,S.path)),files:s.files,root:o});for(let S of h.paths)Object.hasOwn(n,S)||(l.push(S),n[S]=r.find(M=>M.path===S).ref);for(let S of h.refused)a.set(S.path,S)}return{...ce(t)&&P.some(h=>!Object.hasOwn(n,h.path))?{definitionsOmitted:!0}:{},selectedPaths:l,shaByPath:n,treeListing:r.slice(0,vn).map(h=>h.path),needsExtraction:b,refused:[...a.values()]}}function Sn(t,e){let o=new Set(e.selected.map(n=>n.path)),s=re(t,e.entries.map(n=>n.path),e.root,{files:e.files}).files.filter(n=>n.role==="skill"&&o.has(n.path)).map(n=>n.path),r=de(t,{skillPaths:s,paths:e.entries.map(n=>n.path),files:e.files,sizes:new Map(e.entries.map(n=>[n.path,n.size])),selected:e.selected,root:e.root,admission:e.admission,referencePaths:e.referencePaths});return{paths:[...new Set(r?.flatMap(n=>n.files.map(l=>l.path))??[])],refused:r?.flatMap(n=>n.refused)??[]}}var Mo=(t,e)=>{let o=xo(e.settings,t,e.dir??void 0,{mode:e.mode});return{strength:"partial",wants:o.selectedPaths,state:{needsExtraction:o.needsExtraction,treeListing:o.treeListing,shaByPath:o.shaByPath,refused:o.refused,...o.definitionsOmitted?{definitionsOmitted:!0}:{}}}};var Co=["marker","code-scan","conventions"];var On={marker:So,"code-scan":Oo,conventions:Mo};function ct(t,e,o,s,r=On){let n={...o,settings:t},l={readers:[]};for(let a of Co)if(!(s&&!s.includes(a)))try{let u=r[a]?.(e,n);u&&l.readers.push({id:a,claim:u,done:!1})}catch{}return l}function zs(t){return{readers:t.readers.map(({id:e,done:o})=>({id:e,done:o}))}}function Fo(t){let e=t.readers.find(({id:o})=>o==="conventions").claim;return{selectedPaths:e.wants,...e.state}}var xn={files:200,bytes:B.codeAgent.importBytes,depth:32,edges:Fe.edges,entries:Ce.inventoryEntries};function Eo(t={}){return Object.fromEntries(Object.entries(xn).map(([e,o])=>{let s=t[e]??o;return[e,Number.isFinite(s)?Math.max(0,Math.min(o,Math.floor(s))):0]}))}function Ao(t,e,o,s){let r=new Set(o.map(m=>D(m.path,s))),n=t.CF_READING_NOTE_AGENT_ONLY!=="0"&&mo(t),l=new Set(e.agents),a=m=>!r.has(m)&&(!n||l.has(m)),u=e.instruction.filter(a),y=e.code.filter(a),c=e.agents.filter(m=>!r.has(m)),v=new Set(ho(c)),d=[...u,...y].every(m=>v.has(m)),p=u.length,w=y.length,k=[!d&&p>0&&`${p} instruction file${p===1?"":"s"} left out by the ${Math.round(B.sourceFetch.instructionBytes/1e3)}KB instruction budget`,!d&&w>0&&`${w} analyzable file${w===1?"":"s"} left out by the ${Math.round(B.sourceFetch.codeBytes/1e3)}KB/${B.sourceFetch.codeFiles}-file code budget \u2014 the analysis reads the most agent-shaped files first`,go(c,n)].filter(Boolean),f=o.filter(m=>m.readBytes!==void 0).map(m=>D(m.path,s));return f.length&&k.push(`${f.join(", ")}: only the first ${B.sourceFetch.codeFileBytes/1e3} KB was read`),k.length?k.map((m,O)=>O<k.length-1?String(m).replace(/\.$/,""):m).join("; "):void 0}function Ro(t,e,o,s={}){let{descriptions:r,priority:n,declarations:l}=yo(t,e,{root:o},s),a=[],u=r.flatMap(g=>g.admission.admitted?[{entry:g.readEntry,rel:g.rel,score:g.score,size:g.readEntry.size,pool:g.pool,...g.tier===void 0?{}:{tier:g.tier}}]:(a.push({path:g.entry.path,reason:g.admission.reason}),[])),y=u.filter(({score:g})=>g===0).sort(ze),c=u.filter(({score:g})=>g>0).sort(ze),v=[],d={instruction:0,code:0},p={instruction:[],code:[]},w=0,k=(n.enabled?[...u].sort(ze):[...y,...c]).sort((g,P)=>Number(l.has(P.entry.path))-Number(l.has(g.entry.path)));for(let{entry:g,rel:P,pool:i}of k){let b=i==="instruction"?B.sourceFetch.instructionBytes:B.sourceFetch.codeBytes;if(d[i]+g.size>b||i==="code"&&w>=B.sourceFetch.codeFiles){p[i].push(P),a.push({path:g.path,reason:d[i]+g.size>b?"total":"allowance"});continue}v.push(g),d[i]+=g.size,i==="code"&&(w+=1)}let f=uo(n,a.flatMap(g=>{let P=D(g.path,o);return P===null?[]:[{...g,path:P}]})),m={...p,agents:f},O=Ao(t,m,v,o);return{selected:v,totalBytes:d.instruction+d.code,refused:a,...O?{skippedNote:O}:{},...n.enabled&&O?{readingNotes:m}:{}}}function pt(t){let e=t.CF_CODE_AGENTS!=="0";return{scan:e,model:e&&t.CF_CODE_AGENTS_MODEL!=="0"}}function $o(t,e){if(e.profile==="entry-analysis"){let a=Eo(e.limits),u=e.listing.find(c=>c.path===e.selection.entry),y=[...u?[u]:[],...e.listing.filter(c=>c.path!==e.selection.entry)].slice(0,a.entries);return{profile:e.profile,request:e.selection,entries:y,limits:a,inventoryIncomplete:e.listing.length-y.length}}let o=Ft(t),s=o.length?{scopeSelections:o}:{},r={dir:e.root??null,mode:e.profile==="hosted-import"?e.mode??"all":"all",flags:e.profile==="hosted-import"?e.flags??pt(t):pt(t)};if(e.profile==="hosted-import"){let a=ct(t,e.listing,r);return{profile:e.profile,...a,...s,selection:Fo(a),...U(t)?{mode:r.mode}:{}}}let n=e.listing.filter(a=>_(t,a,{purpose:"pointer",route:"github",root:e.root}).admitted),l=ct(t,n,r,["marker","code-scan"]);return{profile:e.profile,...l,...s,listing:n,selection:e.selection??Ro(t,e.listing,e.root),context:r,...e.selection&&U(t)?{selectionPaths:e.selection.selected.map(a=>a.path)}:{}}}function mt(t,e,o){if(!oe(t)||!e.filenameReferences?.length)return o;let s=o.agents.flatMap(n=>n.prompt.kind==="dedicated"?[{path:n.prompt.path}]:[]),r=Jt(e.filenameReferences,s);return{...o,agents:o.agents.map(n=>{if(n.prompt.kind!=="dedicated")return n;let l=n.prompt.path,a=r.filter(u=>u.promptPath===l&&!n.files.some(y=>y.path===u.readerPath)&&_(t,{path:u.readerPath},{purpose:"override",route:"github",root:e.root}).admitted);return a.length?{...n,files:[...n.files,...a.map(u=>({path:u.readerPath,role:"reference",label:"prompt filename reference"}))]}:n})}}function ue(t,e,o){return t.filter(s=>e.some(r=>r.includes(o(s))))}function jo(t,e,o){if(!t.length||o&&!U(o.settings))return;let s;if(o&&!te(o.settings)){let r=Object.keys(o.files).filter(a=>D(a,o.root)!==null&&_(o.settings,{path:a},{purpose:"override",route:"github",root:o.root}).admitted),n=r.filter(a=>St(D(a,o.root))).sort((a,u)=>Ot(D(a,o.root),D(u,o.root)));if(!n.length)return;let l=ue(r.filter(a=>!n.includes(a)&&fe(a)).sort(),n.map(a=>o.files[a]),a=>D(a,o.root));s=[...n.map(a=>({path:a,role:"reference",label:"developer guidance"})),...l.map(a=>({path:a,role:"reference",label:null}))]}else{if(!e||e.prompt.kind!=="fallback")return;let r=e.prompt.path;if(t.some(n=>n.files.some(l=>l.path===r)))return;s=e.files.map(n=>({...n,role:"reference",label:n.role==="system prompt"?"developer guidance":n.label}))}s=s.filter(r=>!t.some(n=>n.files.some(l=>l.path===r.path))),s.length&&(t[0]={...t[0],files:[...t[0].files,...s],sharedReferencePaths:[...t[0].sharedReferencePaths??[],...s.map(r=>r.path)]})}function Cr({prompt:t,link:e}){return{path:e?.callPath??t.path,...e?{line:e.callLine}:{},symbol:t.symbol,promptPath:t.path,promptStart:t.start,...e?.kind==="L4"?{loadedPrompt:!0,...e.callStart!==void 0?{callStart:e.callStart}:{}}:{}}}function Lo(t,e,o){return oo(t,e,o)}var Je=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase().split(/[^a-z0-9]+/).filter(Boolean).sort().join("-");function Mn(t,e,o,s={}){let r=new Map(t.map(n=>[Je(n),n]));return e.flatMap(n=>{let l=Object.hasOwn(o,n)?o[n]:void 0;if(l===void 0||!_(s,{path:n},{purpose:"code-support",route:"github"}).admitted)return[];let a=pe(n,l,se(n)).toks;return a.flatMap((u,y)=>{if(!q(u))return[];let c=r.get(Je(u.text));if(!c)return[];let v=!1;if(q(a[y-1],"function")||q(a[y-1],"def"))v=K(a[y+1],"(");else if(["const","let","var"].some(d=>q(a[y-1],d))){for(let d=y+1;d<a.length&&d<y+80&&!K(a[d],";");d++)if(K(a[d],"=")){let p=q(a[d+1],"async")?d+2:d+1,w=K(a[p],"(")?ee(a,p)+1:p+1;v=q(a[p],"function")||K(a[w],"=")&&K(a[w+1],">");break}}return v?[{name:c,sourcePath:n,sourceLine:u.line}]:[]})})}function Io(t,e,o,s,r={}){let n=new Set(t.map(Je)),l=c=>_(r,{path:c},{purpose:"code-support",route:"github"}).admitted,a=c=>Mn(t,[c],o,r).length>0,u=e.filter(c=>l(c)&&a(c)),y=s.filter(c=>l(c)&&n.has(Je(c.split("/").at(-1).replace(/\.[^.]+$/,"")))&&(o[c]===void 0||a(c))).sort();return[...new Set([...u,...y])]}import{createHash as Cn}from"node:crypto";var Ve=t=>Cn("sha256").update(t).digest("hex");function Fn(t){return t.unavailable?t.unavailable:t.entry?!Number.isSafeInteger(t.entry.size)||t.entry.size<0?"over-limit":Dt.safeParse(t.path).success?t.depth>t.limits.depth||!t.spentPaths.has(t.path)&&(t.spentPaths.size>=t.limits.files||t.bytes+t.size>t.limits.bytes)?"over-limit":null:"out-of-scope":"missing"}function _o(t,e){let o=R=>({kind:"refused",reason:R,pending:[]});if(!ko(t))return o("disabled");let{request:s,files:r,resolutions:n,unavailable:l={}}=e,a=$o(t,{profile:"entry-analysis",listing:[...e.entries],selection:s,limits:e.limits}),{limits:u}=a,y=new Map(a.entries.map(R=>[R.path,R])),c={},v=[],d=[],p=[],w=[],k=new Set,f=new Set,m=[{path:s.entry,depth:0,settings:!1},...(e.settingsFiles??[]).map(R=>({path:R,depth:0,settings:!0}))],O=new Set,g=new Map,P=new Map,i=new Set(e.attempted?.paths),b=new Set(e.settingsAttempted?.paths),h={files:Ce.settingsFiles,bytes:Ce.settingsBytes,depth:u.depth},S=e.settingsAttempted?.bytes??0,M=e.attempted?.bytes??0,E=0,C=e.inventoryIncomplete??0;C+=a.inventoryIncomplete;let L=(R,$)=>{w.length<Fe.edges&&w.push({from:R.from,specifier:R.specifier,status:"refused",provenance:R.provenance,reason:$})};for(let R=0;R<m.length;R++){let $=m[R],Y=`${$.settings}:${$.path}`;if(O.has(Y))continue;O.add(Y);let J=y.get($.path),ye=Object.hasOwn(r,$.path)?r[$.path]:void 0,ve=ye===void 0?J?.size??0:Buffer.byteLength(ye),Q=$.settings?b:i,Z=Fn({...$,entry:J,size:ve,unavailable:Object.hasOwn(l,$.path)?l[$.path]:void 0,spentPaths:Q,bytes:$.settings?S:M,limits:$.settings?h:u});if(Z){if($.path===s.entry&&!$.settings)return o(Z);if($.settings&&Object.defineProperty(c,$.path,{value:Z,enumerable:!0}),!$.settings){P.set($.path,Z);for(let I of g.get($.path)??[])L(I,Z);Z==="over-limit"&&C++}continue}if(Q.has($.path)||($.settings?S+=ve:M+=ve,Q.add($.path)),ye===void 0){d.push($.path),($.settings?k:f).add($.path);continue}if($.settings)continue;if(v.push($.path),!Object.hasOwn(n,$.path)){d.push($.path);continue}let A=n[$.path];for(let I=0;I<A.length;I++){let z=A[I];if(E++>=u.edges){L(z,"over-limit"),C+=A.length-I;break}if(!Gt.safeParse(z).success||z.from!==$.path){L({from:$.path,specifier:"?",status:"refused",provenance:null,reason:"unsupported"},"unsupported");continue}if(z.status==="refused"){L(z,z.reason);continue}p.push(z),g.set(z.path,[...g.get(z.path)??[],z]);let H=P.get(z.path);if(H){L(z,H);continue}m.push({path:z.path,depth:$.depth+1,settings:!1})}}if(d.length)return{kind:"pending",pending:[...new Set(d)],pendingSettings:[...k].filter(R=>!f.has(R)),...Object.keys(c).length?{unavailable:c}:{}};let j=v.map(R=>({path:R,role:R===s.entry?"entry":"imported-helper",hash:Ve(r[R]),size:Buffer.byteLength(r[R])})),T=Ve(JSON.stringify({request:{...s,scope:void 0},files:j,inventory:[...y.values()].map(({path:R,size:$,ref:Y})=>({path:R,size:$,ref:Y})).sort((R,$)=>R.path.localeCompare($.path)),metadata:(e.settingsFiles??[]).map(R=>[R,Object.hasOwn(r,R)?Ve(r[R]):l[R]??"over-limit"]),edges:p,refusedEdges:w,frontierCount:C,limits:u,resolverVersion:e.resolverVersion,resolverIdentity:e.resolverIdentity,targetIdentity:e.targetIdentity,settings:Object.entries(Ge(t)).sort(([R],[$])=>R.localeCompare($))})),F=s.scope;if(F&&F.snapshot!==T)return o("stale-snapshot");let x=v.filter(R=>R!==s.entry);if(F&&(F.entry!==s.entry||Array.isArray(F.imports)&&F.imports.some(R=>!x.includes(R))))return o("invalid-scope");let G=new Set(!F||F.imports==="all"?v:[s.entry,...F.imports==="none"?[]:F.imports]);if(e.proposal?.files.some(R=>!G.has(R.path)||R.role==="prompt"&&R.path!==s.entry))return o("invalid-scope");let N=j.filter(R=>G.has(R.path)),ie=p.filter(R=>G.has(R.from)&&G.has(R.path));for(let R of p)G.has(R.from)&&!G.has(R.path)&&v.includes(R.path)&&L(R,"not-selected");let ae=[],ge=(R,$)=>{let Y=[s.entry,...$==="none"?[]:$];Y.length!==N.length&&ae.push({id:R,scope:{snapshot:T,entry:s.entry,imports:$},includes:Y,omitted:N.filter(J=>!Y.includes(J.path)).map(J=>J.path)})};ge("entry-only","none");for(let R of N.filter($=>$.role==="imported-helper").slice(0,Fe.choices-1))ge(Ve(R.path),[R.path]);let Pe=w.filter(R=>G.has(R.from)),le={schemaVersion:1,kind:"file",launchRoot:s.launchRoot,entry:s.entry,snapshot:T,resolverVersion:e.resolverVersion,files:N,edges:ie,refusedEdges:Pe,completeness:{complete:Pe.every(R=>R.reason==="external")&&C===0,frontierCount:C},choices:ae};return{kind:"ready",pending:[],selection:le}}var To="model call";function No(t,e){let o=Lo(t.ownPaths,e,t.toolCall);return{tools:o.tools.map(s=>({tool:s,from:o.from[s.name]})),toolWarnings:o.warnings}}function ut(t=new Map,e){return{left:Math.max(0,B.codeAgent.importBytes-[...t.values()].reduce((o,s)=>o+s,0)),chosen:new Set([...t.keys()].filter(o=>!e?.has(o))),...e?{replacementBytes:e}:{}}}function En(t,e){return t.modelId??(!t.documentation&&e.length===1?e[0]:null)}function ni(t,e,o){return An(t,En(t,e),o)}function An(t,e,o){let{prompt:s,link:r}=t,n=[s.kind==="file"?{role:"system prompt",label:null,path:s.path}:{role:"system prompt",label:s.symbol??`line ${s.span.from}`,path:s.path,span:{from:s.span.from,to:s.span.to},...s.filledAtRunTime?{filledAtRunTime:!0}:{}}];for(let a of t.alsoLoads??[])n.push({role:"system prompt",label:"also loaded",path:a});r&&n.push({role:"code",label:To,path:r.callPath}),r?.wrapper&&n.push({role:"code",label:"model wrapper",path:r.wrapper.path}),e&&n.push({role:"code",label:"model setting",path:e.path}),t.shape&&n.push({role:"code",label:"answer shape",path:t.shape.path});let l=new Set;return n.filter(a=>!l.has(a.path)&&!!l.add(a.path)).map(a=>je(o,a.path,a.path===s.path&&t.promptSource==="marker")?a:{...a,role:"reference"})}function si(t,e){let{prompt:o}=t,s=e[o.path]??"";return o.kind==="file"?s:s.split(`
|
|
2
|
+
`).slice(o.span.from-1,o.span.to).join(`
|
|
3
|
+
`)}function ri(t,e){return e?Object.fromEntries(e.files.filter(o=>t[o.path]!==void 0).map(o=>[o.path,t[o.path]])):t}function Bo(t,e,o){let{files:s,sizes:r,root:n,total:l=ut()}=o,a=[...new Set([...e.ownPaths,...o.guides??[]])],u=[],y=new Set(a);a=a.filter(i=>{let b=_(t,{path:i},{purpose:"override",route:"github"});return b.admitted||u.push({path:i,reason:b.reason}),b.admitted});let c=[...r.keys()].filter(i=>{let b=_(t,{path:i},{purpose:"code-support",route:"github",root:n});return!b.admitted&&!y.has(i)&&u.push({path:i,reason:b.reason}),b.admitted}),v=Object.fromEntries(a.filter(i=>s[i]!==void 0).map(i=>[i,s[i]])),d=to(v,c).filter(i=>!a.includes(i)),p=Object.fromEntries([...a,...d].filter(i=>s[i]!==void 0).map(i=>[i,s[i]])),w=No({ownPaths:a,toolCall:e.toolCall},p).tools.map(({tool:i})=>i.name),k=new Set(Io(w,d,s,c,t)),f=dt(t,a,{...o,total:l});for(let i of new Set([...a,...d,...k]))f.take(i,k.has(i)&&!a.includes(i));let{paths:m,skipped:O}=f,g=Object.fromEntries(m.filter(i=>s[i]!==void 0).map(i=>[i,s[i]])),P=No(e,g);return{paths:m,skipped:O,refused:Se(u,f.refused),...P}}function dt(t,e,{sizes:o,total:s=ut(),pool:r},n=[]){let l=[],a=[],u=[],y=B.codeAgent.extraBytes,c=0;return{paths:l,skipped:a,refused:u,take:(d,p,w=!1)=>{if(l.includes(d))return!0;let k=o.get(d),f=d===e[0],m=n.includes(d),O=[s,...r?[r]:[]],g=h=>Math.max(0,(k??0)-(h.replacementBytes?.get(d)??0)),P=m?"override":e.includes(d)||w?"pointer":"code-support",i=_(t,{path:d,size:k},{purpose:P,route:"github"});i.admitted||u.push({path:d,reason:i.reason});let b=k===void 0?"missing":i.admitted?!m&&!f&&k>y?"allowance":!m&&O.some(h=>!h.chosen.has(d)&&(g(h)>h.left||h.wholeBytesLeft!==void 0&&k>h.wholeBytesLeft))?"total":p&&c>=B.codeAgent.toolCodeFiles?"tool-limit":null:i.reason;if(b)return a.push({path:d,reason:b}),!1;!f&&!m&&(y-=k),p&&c++;for(let h of O)h.chosen.has(d)||(h.left-=g(h),h.wholeBytesLeft!==void 0&&(h.wholeBytesLeft-=k),h.chosen.add(d));return l.push(d),!0}}}function zo(t,e,o){return"request"in e?_o(t,e):Rn(t,e,o)}function Rn(t,e,o){if(!we(t)&&!(oe(t)&&e.some(m=>m.fileProfile==="layout")))return null;let s=o.scopes??po(t,[...o.sizes.keys()],o.root??void 0,{},o.agentConfigurations??{}),r=o.total??ut(),n=new Set(o.confirmationIds),l=o.selectedIds&&new Set(o.selectedIds),a=e.filter(m=>!l||l.has(m.id));for(let m of a)for(let{path:O}of m.ownFiles.filter(g=>m.fileProfile==="convention"||m.sharedReferencePaths?.includes(g.path))){let g=o.sizes.get(O),P=m.scopeProof?.paths.includes(O)?void 0:o.root;g===void 0||r.chosen.has(O)||!_(t,{path:O},{purpose:"override",route:"github",root:P}).admitted||(r.left-=Math.max(0,g-(r.replacementBytes?.get(O)??0)),r.wholeBytesLeft!==void 0&&(r.wholeBytesLeft-=g),r.chosen.add(O))}let u=(m,O)=>{for(let g of m){let P=g.ownFiles[0]?.path;if(!P)continue;let i=s.ownerOf(P);!i||i.key!==g.scope.key||i.folder!==g.scope.folder||!_(t,{path:P},{purpose:"pointer",route:"github",root:o.root}).admitted||dt(t,[P],{...o,total:O,pool:void 0}).take(P,!1)}};u(a,r);let y,c=new Set,v=new Set(o.sizes.keys()),d=Te(v).flatMap(m=>o.files[m]===void 0?[]:nt(m,o.files[m],v,{root:o.root??void 0})),p=new Map(d.map(m=>[m,m.to&&o.files[m.to]!==void 0?Yt(m.to,o.files[m.to],m.imported,v,t):[]])),w=new Set(d.filter(m=>{let O=m.to&&se(m.to),g=m.to&&o.files[m.to];return O&&g!==void 0&&g!==null&&!ot(pe(m.to,g,O),m.imported)})),k=e.map(m=>{let O=[...new Set(m.ownFiles.map(F=>F.path))],g=new Set(m.fileProfile==="layout"?m.ownFiles.filter(F=>F.role==="tools").map(F=>F.path):[]),P={schemaVersion:1,agentId:m.id,scope:{...m.scope},files:[],edges:[],unresolved:[],refused:[]};if(l&&!l.has(m.id))return P;n.has(m.id)&&!y&&(y={left:B.candidateFetch.check,chosen:new Set(c)},u(a.filter(F=>n.has(F.id)),y));let i=dt(t,O,{...o,total:r,pool:n.has(m.id)?y:void 0},m.fileProfile==="convention"?O:m.sharedReferencePaths),b=new Set(m.skillManifests?.flatMap(F=>F.files.map(x=>x.path))),h=m.ownFiles.filter(F=>F.role!=="reference"||!b.has(F.path)||m.independentReferences?.includes(F.path)).map(F=>({path:F.path,symbol:null,role:F.role,evidence:null,span:F.span})),S=d.filter(F=>F.to!==null&&O.includes(F.to)),M=S.filter(F=>new Set(S.filter(x=>x.to===F.to).map(x=>x.imported)).size>1),E=d.filter(F=>!w.has(F)&&(S.includes(F)&&!m.toolCall&&!M.includes(F)||p.get(F).some(x=>{if(x.kind!=="graph-node"||!x.to||!O.includes(x.to)||!m.toolCall||m.toolCall.path!==x.to)return!1;let G=o.files[x.to];return G!==void 0&&Ut(x.to,G,x.imported,m.toolCall)})));P.unresolved.push(...S.filter(F=>!E.includes(F)).map(F=>({...F,reason:w.has(F)?"missing":"unlinked"})));for(let F of E)h.push({path:F.from,symbol:F.symbol,role:"config",evidence:F,explicit:!0});let C=new Set,L=new Map,j=new Set,T=new Set;for(let F=0;F<h.length;F++){let x=h[F],G=JSON.stringify([x.path,x.symbol,x.role]);if(C.has(G)){let A=P.files.find(I=>I.path===x.path);A&&x.span&&!A.spans.some(I=>I.from===x.span.from&&I.to===x.span.to)&&(A.spans.push(x.span),A.evidence.push({kind:"entry",from:x.path,to:x.path,span:x.span})),A&&x.evidence?.kind==="skill-reference"&&!A.evidence.some(I=>JSON.stringify(I)===JSON.stringify(x.evidence))&&A.evidence.push(x.evidence);continue}C.add(G);let N=s.ownerOf(x.path),ie=O.includes(x.path)&&m.scopeProof?.paths.includes(x.path),ae=_(t,{path:x.path},{purpose:O.includes(x.path)||x.explicit?"pointer":"code-support",route:"github",root:ie?void 0:o.root}),ge=x.role==="reference"&&O.includes(x.path)&&(m.sharedReferencePaths?.includes(x.path)||m.skillManifests?.some(A=>P.files.some(I=>I.path===A.ownerPath)&&A.files.some(I=>I.path===x.path)&&!A.refused.some(I=>I.path===x.path))),Pe=ae.admitted?!ie&&(!N||!ge&&(N.key!==m.scope.key||N.folder!==m.scope.folder))?"out-of-scope":!O.includes(x.path)&&e.some(A=>A.id!==m.id&&A.ownFiles.some((I,z)=>I.path===x.path&&(z===0||I.label===To)))?"other-agent":null:ae.reason;if(Pe){P.refused.push({path:x.path,reason:Pe});continue}let le=o.files[x.path],R=se(x.path),$=le!==void 0&&R?pe(x.path,le,R):null,Y=$&&x.symbol?ot($,x.symbol):null,J=Y?.name??x.symbol;if(le!==void 0&&!L.has(x.path)){let A=d.filter(W=>W.from===x.path),I=[...A.length?A:nt(x.path,le,v,{root:m.scope.folder,call:m.toolCall}),...[...T].filter(W=>W.to===x.path).flatMap(W=>p.get(W))];I.forEach(W=>j.add(W));let z=Vt(x.path,le,v,O.includes(x.path)?m.toolCall:void 0,t).flatMap(W=>I.some(H=>!H.reason&&H.kind===W.kind&&H.symbol===W.symbol&&H.span.from===W.span.from)?[]:E.some(H=>H.to===x.path)&&!O.includes(x.path)&&(W.kind==="config"||W.kind==="graph-node")&&!W.reason?[{...W,reason:"unlinked"}]:[W]);L.set(x.path,[...z,...I,...(o.links??[]).filter(W=>W.from===x.path)])}let ye=L.get(x.path)??[];if(x.role==="code"&&x.evidence?.kind==="import"&&ye.some(A=>A.reason==="external"&&A.usage==="call"&&(A.within===J||A.within===null)&&Ct(A.source,R))){P.refused.push({path:x.path,reason:"provider-transport"});continue}let ve=g.has(x.path)||x.role==="tool"&&Y?.params!=null&&!O.includes(x.path);if(!i.take(x.path,ve,x.explicit))continue;P.unresolved.push(...d.filter(A=>A.from===x.path&&(A.reason||w.has(A))).map(A=>w.has(A)?{...A,reason:"missing"}:A));let Q=P.files.find(A=>A.path===x.path);Q||(Q={path:x.path,roles:[],spans:[],evidence:[],sharedOwners:[]},P.files.push(Q)),Q.roles.includes(x.role)||Q.roles.push(x.role);let Z=x.span??($&&Y?{from:$.toks[Y.from].line,to:$.toks[Y.to-1].endLine}:void 0);Z&&!Q.spans.some(A=>A.from===Z.from&&A.to===Z.to)&&Q.spans.push(Z),x.evidence?Q.evidence.push(x.evidence):Q.evidence.push({kind:"entry",from:x.path,to:x.path,...x.span?{span:x.span}:{}});for(let A of m.skillManifests??[])if(P.files.some(I=>I.path===A.ownerPath))for(let I of A.files)for(let z of I.evidence)z.fromPath===x.path&&h.push({path:I.path,symbol:null,role:"reference",explicit:!0,evidence:{kind:"skill-reference",from:z.fromPath,to:I.path,span:z.span}});if(le!==void 0)for(let A of ye){let I=A.usage==="reexport"&&(A.symbol===J||A.symbol==="*"),z=A.usage==="call"&&A.within===J;if(!(A.kind!=="import"&&(J===null||A.within===J)||J!==null&&(I||z)||A.reason==="dynamic"&&(J===null||A.within===J)))continue;if(!A.to||A.reason){P.unresolved.push(A);continue}let H=E.includes(A);H&&(T.add(A),L.delete(A.to)),P.edges.push(A);let yn=A.kind==="tool-registration"?"tool":A.kind==="config"?"config":A.kind==="graph-node"?"workflow":I?x.role:"code";h.push({path:A.to,symbol:H?null:A.imported==="*"?x.symbol:A.imported,role:yn,evidence:A,explicit:j.has(A)})}}if(P.refused.push(...Se(i.skipped,i.refused)),P.unresolved=P.unresolved.filter(F=>F.reason!=="unlinked"||!P.edges.some(x=>x.from===F.from&&x.to===F.to&&x.kind===F.kind&&x.symbol===F.symbol&&x.span.from===F.span.from)),P.unresolved=[...new Map(P.unresolved.map(F=>[JSON.stringify(F),F])).values()],P.refused=P.refused.filter((F,x,G)=>G.findIndex(N=>N.path===F.path&&N.reason===F.reason)===x),!n.has(m.id))for(let F of P.files)c.add(F.path);return P}),f=new Map;for(let m of k)for(let O of m.files)f.set(O.path,[...f.get(O.path)??[],m.agentId]);for(let m of k)for(let O of m.files)O.sharedOwners=[...new Set(f.get(O.path))].sort();return k}function ht(t,e){return["[","{"].some(o=>K(t.source.toks[e.from],o))&&ee(t.source.toks,e.from)===e.to?{...e,to:e.to+1}:t.calls.find(o=>o.from===e.from&&o.to===e.to+1&&K(t.source.toks[e.to],")"))??e}function X(t,e,o=new Set){let{toks:s}=t.source;if(e.to!==e.from+1||!q(s[e.from])||["True","False","None"].includes(s[e.from].text))return e;let r=t.binding(s[e.from].text,e.from);return!r||r.append||!t.bindingIsCertain(r,e.from)||o.has(r.at)||t.functions.some(n=>n.from<e.from&&e.from<n.to&&n.params?.includes(r.name))?null:X(t,ht(t,r),new Set([...o,r.at]))}import{posix as Do}from"node:path";function Go(t,e,o,s,r){let{source:{path:n,toks:l}}=t,a=[],u=[],y=[],c=[],v=(k,f)=>c.push({path:k,reason:f}),d=(k,f,m,O=null)=>({path:f,role:k,label:O,...m?{span:m}:{}}),p=(k,f)=>{let m=t.importBinding(k,f),O=e.filter(b=>b.name===k&&b.from<f&&(b.params!==null||b.kind==="class")&&(!t.owner(b.from)||t.owner(b.from)===t.owner(f)));if(!m)return O.length===1?{path:n,span:{from:l[O[0].from].line,to:l[O[0].to-1].endLine}}:null;let g=m.module.source,P=r.length===1?Do.dirname(Do.dirname(r[0])):"",i=Kt(g.startsWith(".")?n:`${P?`${P}/`:""}__root__.py`,g.startsWith(".")?g:`.${g}`,[m.name],"py",s);return i?{path:i}:null},w=o&&X(t,o);if(w&&K(l[w.from],"[")&&ee(l,w.from)===w.to-1)for(let k of me(l,w.from)){let f=k.to===k.from+1&&q(l[k.from])&&!t.binding(l[k.from].text,k.from)?k:X(t,k);if(!f||!q(l[f.from])){v(n,"dynamic");continue}let m=l[f.from].text;if(!(f.to===f.from+1||K(l[f.from+1],"(")&&ee(l,f.from+1)===f.to-1)){v(n,"dynamic");continue}if(t.functions.some(P=>P.from<f.from&&f.from<P.to&&P.params?.includes(m))){v(n,"dynamic");continue}if(!t.importBinding(m,f.from)&&!e.some(P=>P.name===m&&(P.params!==null||P.kind==="class")&&P.from<f.from)){v(n,"dynamic");continue}a.push(m);let g=p(m,f.from);g&&(y.push(d("tools",g.path,g.span,m)),u.push(g.path))}else o&&v(n,"dynamic");return{names:a,files:y,proofPaths:u,refused:c}}function Ko(t,e,o,s,r,n){let l=e.source,{path:a,toks:u}=l,{files:y,paths:c,frameworks:v,defaultsByPath:d}=n,p={prompt:{kind:"none"},files:[]},w=[],k,f=(i,b)=>w.push({path:i,reason:b}),m=(i,b,h,S=null)=>({path:b,role:i,label:S,...h?{span:h}:{}});d.has(a)||d.set(a,rt(a,l.text,c));let O=d.get(a),g=i=>{p.layoutProof??={kind:"outside-loader",paths:[]},p.layoutProof.paths.push(i);let b=y[i];if(b===void 0){p.files.push(m("template",i)),f(i,"missing");return}let h=ao(b,t);if(h.unresolved.length||!h.fields.some(S=>S.key==="system_prompt"&&S.value!==null)){f(i,"invalid");return}for(let S of h.fields.filter(M=>M.value!==null))p.files.push(m(S.key==="system_prompt"?"system prompt":"template",i,S.span,S.key)),S.key==="system_prompt"&&(p.prompt={kind:"entry",path:i,span:S.span,text:S.value})},P=o.get("prompt_templates")??o.get("system_prompt");if(P){let i=X(e,P),b=i&&xe(l,i);if(b&&o.has("system_prompt"))p.prompt={kind:"entry",path:a,span:b.span,text:u[i.from].value},k={path:a,start:b.start},p.files.push(m("system prompt",a,b.span));else if(i&&K(u[i.from],"{")&&ee(u,i.from)===i.to-1){let h=!1,S=(M,E="")=>{let C=new Set;for(let L of me(u,M.from)){let j=u[L.from]?.kind==="string"?u[L.from].value:null;if(!j||C.has(j)||!K(u[L.from+1],":")){f(a,"invalid"),h=!0;return}C.add(j);let T=X(e,{from:L.from+2,to:L.to}),F=T&&xe(l,T);F?(p.files.push(m(j==="system_prompt"?"system prompt":"template",a,F.span,E+j)),j==="system_prompt"&&!E&&(p.prompt={kind:"entry",path:a,span:F.span,text:u[T.from].value},k={path:a,start:F.start})):T&&K(u[T.from],"{")?S(T,`${E}${j}.`):f(a,"dynamic")}};S(i),h&&(p.prompt={kind:"none"},p.files=[])}else{let h=i&&O.find(S=>S.start===u[i.from].start&&S.end===u[i.to-1].end);h?.path&&!h.reason?g(h.path):f(a,"dynamic")}}else if(s.args.some(i=>!q(u[i.from])||!K(u[i.from+1],"=")))f(a,"dynamic");else if(v.length===1){let i=v[0],b=y[i];if(b===void 0)p.files.push(m("config",i)),p.layoutProof={kind:"outside-loader",paths:[i]};else{d.has(i)||d.set(i,rt(i,b,c));let h=d.get(i).filter(j=>j.className===r&&j.binding==="prompt_templates"&&j.forwarded),S=o.get("use_structured_outputs_internally"),M=S?X(e,S):null,E=M&&M.to===M.from+1&&["True","False"].includes(u[M.from].text)?u[M.from].text==="True":null,C=h.filter(j=>j.when?.every(T=>T.parameter==="use_structured_outputs_internally"&&T.value===(S?E:T.defaultValue))),L=C.length===1?C[0]:null;L?.path&&(!L.reason||L.reason==="missing")?g(L.path):f(i,"dynamic")}}else f(a,v.length>1?"dynamic":"missing");return{...p,promptSite:k,refused:w}}function Wo(t,e,o=e.files){let s={agents:[],refused:[]};if(!U(t))return s;let r={...o,...e.files},n=new Set([...Object.keys(r),...e.listedPaths??[]]),l=new Set(Xt(t,[...n],e.root)),a=[...n].filter(c=>/(?:^|\/)smolagents\/agents\.py$/.test(c)),u=new Map,y=(c,v)=>s.refused.push({path:c,reason:v});for(let[c,v]of Object.entries(e.files)){if(!v.includes("smolagents")||Et(c,{listing:n,root:e.root})&&!Ie(t,c,e.root)||!/\.py$/i.test(c)&&!l.has(c)||!_(t,{path:c,size:Buffer.byteLength(v)},{purpose:"code-scan",route:"github",root:e.root,listing:n}).admitted)continue;let d=l.has(c)?Qt(c,v).filter(i=>i.lang==="py"):null,p=d?Ht(v,d):v,w=pe(c,p,"py"),k=Wt(w,{includeMembers:!0}),f=qt(w,k,{enclosingBindings:!0}),{toks:m}=w,O=[],g=i=>{let b=i&&X(f,i);return b&&xe(w,b)?m[b.from].value:null},P=(i,b,h,S=null)=>({path:b,role:i,label:S,...h?{span:h}:{}});for(let i of f.calls){let b=f.importBinding(i.callee,i.from);if(!b||!["smolagents","smolagents.agents"].includes(b.module.source)||!["CodeAgent","ToolCallingAgent"].includes(b.name))continue;let h=new Map(i.args.flatMap(x=>q(m[x.from])&&K(m[x.from+1],"=")?[[m[x.from].text,{from:x.from+2,to:x.to}]]:[])),S=d?.find(x=>x.span.from<=m[i.from].line&&m[i.from].line<=x.span.to);if(S&&(b.module.line<S.span.from||S.span.to<b.module.line)){let x=h.get("managed_agents"),G=x&&X(f,x);if(!(G&&K(m[G.from],"[")&&me(m,G.from).some(ie=>{let ae=X(f,ie);return ae&&O.some(ge=>ge.at===ae.from)})))continue}let E=f.assignments.find(x=>x.from===i.from&&ht(f,x).to===i.to)?.name??`line-${m[i.from].line}`,C=`smolagents:${JSON.stringify([c,m[i.from].start])}`,L={from:m[i.from].line,to:m[i.to-1].endLine},j={key:C,name:g(h.get("name"))??E,model:null,description:g(h.get("description")),prompt:{kind:"none"},files:[],skills:[],tools:[],subagents:[],layoutCall:{path:c,callStart:m[i.from].start,line:L.from,loadedPrompt:!0}},T=Ko(t,f,h,i,b.name,{files:r,paths:n,frameworks:a,defaultsByPath:u});j.prompt=T.prompt,j.files.push(...T.files),T.layoutProof&&(j.layoutProof=T.layoutProof),T.promptSite&&(j.layoutCall.promptPath=T.promptSite.path,j.layoutCall.promptStart=T.promptSite.start),s.refused.push(...T.refused),j.files.push(P(d?"system prompt":"config",c,L));let F=Go(f,k,h.get("tools"),n,a);j.tools=F.names,j.files.push(...F.files),F.proofPaths.length&&(j.layoutProof??={kind:"outside-loader",paths:[]},j.layoutProof.paths.push(...F.proofPaths)),s.refused.push(...F.refused),s.agents.push(j),O.push({agent:j,name:E,at:i.from,children:h.get("managed_agents")})}for(let i of O){if(!i.children)continue;let b=X(f,i.children);if(!b||!K(m[b.from],"[")||ee(m,b.from)!==b.to-1){y(c,"dynamic");continue}for(let h of me(m,b.from)){let S=X(f,h),M=S&&O.find(C=>C.at===S.from&&S.to===f.calls.find(L=>L.from===C.at)?.to);if(!M||M===i){y(c,"dynamic");continue}let E=M.agent.prompt;i.agent.subagents.push({key:M.agent.key,path:E.kind==="none"?c:E.path,name:M.agent.name,description:M.agent.description,prompt:E.kind==="entry"?E.text:"",tools:M.agent.tools,skillPaths:[],files:M.agent.files})}}}return s}import{basename as Nn}from"node:path";import{basename as Ln}from"node:path";var Jo=/^[\w.*:/()-]+$/,Vo=/^(?:true|false|null|~|[-+]?(?:\d[\d_.eExXoObB+-]*|\.\d[\d_eE+-]*|\.inf|\.nan)|\d{4}-\d{1,2}-\d{1,2}(?:[Tt].*)?)$/i,Ue=t=>Jo.test(t)&&!t.startsWith("*")&&!Vo.test(t);function Ye(t){if(t.startsWith('"'))try{return JSON.parse(t)}catch{return t}return t.length>=2&&t.startsWith("'")&&t.endsWith("'")?t.slice(1,-1).replace(/''/g,"'"):t}function Re(t,e=!1,o=!1){let s=[],r="",n=0,l=-1,a=0,u=()=>{l>=0&&s.push([l,a]),l=-1};for(let y=0;y<t.length;y++){let c=t[y];if(r){r==='"'&&c==="\\"?y++:c===r&&(r==="'"&&t[y+1]==="'"?y++:r=""),a=y+1;continue}if(!o&&c==="#"&&(y===0||/\s/.test(t[y-1]))){if(!e)return u(),{spans:s,end:y,comment:t.slice(y)};let v=t.indexOf(`
|
|
4
|
+
`,y);y=v<0?t.length:v;continue}if(e&&c==="]"&&n===0)return u(),{spans:s,end:y,comment:""};if(c===","&&n===0){u();continue}/\s/.test(c)||(l<0&&(l=y),(c==='"'||c==="'")&&(l===y||n>0)?r=c:c==="("?n++:c===")"&&n>0&&n--,a=y+1)}if(e)throw new Error("Unclosed frontmatter tool list");return u(),{spans:s,end:t.length,comment:""}}function qo(t,e){let o=t.startsWith("["),s=Re(o?t.slice(1):t,o),r=(o?t.slice(1,s.end+1):t.slice(0,s.end)).trimEnd(),n=!o&&s.spans.length===1&&/^["']/.test(r)&&Ye(r)!==r?r[0]:"",l=n?Ye(r):o?t.slice(1,s.end+1):t.slice(0,s.end).trimEnd(),a=o?s.spans:Re(l,!1,!!n).spans,u=0,y=a.flatMap(([v,d],p)=>{let w=l.slice(v,d),k=Ye(w),f=l.slice(u,v).replace(/[^\S\n]*#[^\n]*/g,""),m=o?l.slice(d,a[p+1]?.[0]??l.length):"",O=m.match(/[^\S\n]*#[^\n]*/g)?.join(`
|
|
5
|
+
`)??"";return u=d,k?[{name:k,raw:w,before:f,note:O,noteAfterComma:/^[^\S\n]*,/.test(m)}]:[]}),c=o?t.slice(s.end+2).split(`
|
|
6
|
+
`)[0]:t.slice(r.length);return{style:o?"flow":"comma",outerQuote:n,quote:y.find(v=>/^["']/.test(v.raw))?.raw[0]??"",prefix:"",suffix:c,head:(y[0]?.before??l).replace(/,/g,""),tail:y.length?l.slice(u).replace(/[^\S\n]*#[^\n]*/g,""):"",separator:y[1]?.before.replace(/#[^\n]*/g,"")??(l.includes(`
|
|
7
|
+
`)?`,
|
|
8
|
+
${l.match(/\n([^\S\n]*)/)[1]}`:", "),entries:y,first:e,last:e+t.slice(0,o?s.end+2:t.length).split(`
|
|
9
|
+
`).length-1,indent:" - ",blockComments:[]}}function $n(t){let e=Me(t),o=e?.raw.map(a=>a.replace(/\r$/,""))??null,s=[],r=[],n={},l=[];if(o)for(let a=0;a<o.length;a++){let u=/^([A-Za-z_][\w-]*\s*:[^\S\n]*)(.*)$/.exec(o[a]);if(!u||!/^tools\s*:/i.test(u[1]))continue;let y=Re(u[2]),c;u[2].startsWith("[")?c=qo(o.slice(a).join(`
|
|
10
|
+
`).slice(u[1].length),a):c=qo(u[2],a),c.prefix=u[1];let v=c.style==="flow"?Re(c.suffix).comment:y.comment;if(v&&(n[c.style==="flow"?c.last:a]=v),c.style==="flow")for(let d of c.entries)d.note&&l.push({tool:d.name,comment:d.note.trim()});if(!u[2].slice(0,y.end).trim()){c.style="block",c.suffix=u[2];for(let d=a+1;d<o.length;d++){if(!o[d].trim()||/^\s*#/.test(o[d])){/^\s+#/.test(o[d])&&c.blockComments.push(d);continue}let p=/^(\s*-\s+)(.*)$/.exec(o[d]);if(!p)break;let w=Re(p[2]),k=p[2].slice(0,w.end).trimEnd(),f=Ye(k);c.indent=p[1],f&&c.entries.push({name:f,raw:k,before:"",note:"",noteAfterComma:!1,row:o[d]}),w.comment&&f&&l.push({tool:f,comment:w.comment}),r.push(d),c.last=d}c.quote=c.entries.map(d=>d.raw).find(d=>/^["']/.test(d))?.[0]??""}for(let d=a;d<=(c.style==="block"?a:c.last);d++)r.push(d);s.push(c),a=c.last}return{header:e,lists:s,tools:s.length?s.flatMap(a=>a.entries.map(u=>u.name)):null,lines:o,toolLines:r,toolComments:n,itemComments:l}}function Yo(t){try{return $n(t)}catch{let e=Me(t);return{header:e,lists:[],tools:[],lines:e.raw.map(o=>o.replace(/\r$/,"")),toolLines:[],toolComments:{},itemComments:[],error:"Unclosed frontmatter tool list"}}}function jn(t){let{tools:e,lines:o,toolLines:s,toolComments:r,itemComments:n,error:l}=Yo(t);return{tools:e,lines:o,toolLines:s,toolComments:r,itemComments:n,...l?{error:l}:{}}}function Uo(t){let e=jn(t);if(e.error)throw new Error(e.error);let{tools:o,lines:s,toolLines:r,toolComments:n,itemComments:l}=e;return{tools:o,lines:s,toolLines:r,toolComments:n,itemComments:l}}function Xe(t){return t.every(e=>Jo.test(e)&&!e.startsWith("*"))&&(t.length!==1||Ue(t[0]))?t.join(", "):`[${t.map(e=>JSON.stringify(e)).join(", ")}]`}function Ae(t,e){return e==="'"&&!/[\r\n]/.test(t)?`'${t.replace(/'/g,"''")}'`:e==='"'||!Ue(t)?JSON.stringify(t):t}function Li(t,e){let o=Yo(t);if(o.error)return t;let s=o.tools??[],r=e([...s]);if(r.length===s.length&&r.every((w,k)=>w===s[k]))return t;if(!o.header){let w=t.startsWith("\uFEFF")?"\uFEFF":"";return`${w}---
|
|
11
|
+
tools: ${Xe(r)}
|
|
12
|
+
---
|
|
13
|
+
${t.slice(w.length)}`}let{header:n,lists:l,toolLines:a,toolComments:u}=o,y=new Map,c=l[0];if(c){let w=l.flatMap(m=>m.entries),k=r.map(m=>{let O=w.findIndex(g=>g.name===m);return O<0?{name:m,raw:Ae(m,c.quote),before:c.separator,note:"",noteAfterComma:!1}:w.splice(O,1)[0]}),f=c.prefix.endsWith(" ")?c.prefix:`${c.prefix} `;if(!r.length)y.set(c.first,`${f}[]${c.style==="block"&&c.suffix?` ${c.suffix}`:c.suffix}`);else if(c.style==="block"){y.set(c.first,`${c.prefix}${c.suffix}`);let m=a.filter(O=>O>c.first&&O<=c.last).sort((O,g)=>O-g);for(let O=0;O<k.length;O++){let g=k[O],P=c.entries.includes(g)&&g.row?Ue(g.raw)||/^["']/.test(g.raw)?g.row:g.row.replace(g.raw,Ae(g.name,c.quote)):`${c.indent}${Ae(g.name,c.quote)}`,i=m[Math.min(O,m.length-1)]??c.first;y.set(i,`${y.has(i)?`${y.get(i)}${n.newline}`:""}${P}`)}}else{let m=c.style==="flow"||r.length===1&&Vo.test(r[0])||r.some(i=>i.includes(",")||i!==i.trim()||/[\r\n]|(?:^|\s)#|:\s|^[[\]{}&*!|>'"%@`]/.test(i)),O=c.head;for(let[i,b]of k.entries()){if(i){let h=b.before||c.separator,S=k[i-1];S.note&&(S.noteAfterComma?(h=h.replace(/,[^\S\n]*/,`,${S.note}`),h.includes(`
|
|
14
|
+
`)||(h+=`
|
|
15
|
+
`)):h=`${S.note}${/^[^\S\n]*\n/.test(h)?"":`
|
|
16
|
+
`}${h}`),O+=h}O+=m?/^["']/.test(b.raw)||Ue(b.raw)?b.raw:Ae(b.name,c.quote):b.name}let g=k[k.length-1];g.note?(O+=g.noteAfterComma&&!c.tail.includes(",")?",":"",O+=g.noteAfterComma&&c.tail.includes(",")?c.tail.replace(",",`,${g.note}`):`${g.note}${c.tail}`,c.tail.includes(`
|
|
17
|
+
`)||(O+=`
|
|
18
|
+
`)):O+=c.tail;let P=m?`[${O}]`:c.outerQuote?Ae(O,c.outerQuote):O;y.set(c.first,`${c.prefix}${P}${c.suffix}`.replace(/\n/g,n.newline))}}let v=new Set(a),d=n.raw.map((w,k)=>y.has(k)?`${y.get(k)}${n.newline}`:v.has(k)?u[k]&&k>c.last?`${u[k]}${n.newline}`:"":`${!r.length&&l.some(m=>m.blockComments.includes(k))?w.trimStart():w}
|
|
19
|
+
`).join(""),p=c?"":`tools: ${Xe(r)}${n.newline}`;return`${t.slice(0,n.start)}${d}${p}${t.slice(n.end)}`}function gt(t){return t.CF_LEGACY_TOOL_LISTS!=="1"}function Ni(t,e){return gt(t)?Xe(e):e.join(", ")}var In=/^\s*(name|description|tools|model)\s*:\s*(.+?)\s*$/i;function _n(t){if(t.startsWith('"')&&t.endsWith('"'))try{return JSON.parse(t)}catch{}return t.replace(/^["']|["']$/g,"")}function $e(t,e,o,s){let r=gt(t),n=Ln(e).replace(/\.md$/i,""),l,a,u=[],y=!1,c=o,v=[],d=Me(o,r?void 0:"markdown");if(d){c=o.slice(d.bodyStart).trim();let w=r?d.raw.map(k=>k.replace(/\r$/,"")):d.raw;for(let k=0;k<w.length;k++){let m=w[k].match(In);if(!m)continue;let O=m[1].toLowerCase(),g=_n(m[2]);if(O==="name")n=g;else if(O==="description")if(/^[>|][+-]?$/.test(m[2])){let P=[];for(;k+1<w.length&&(/^\s+\S/.test(w[k+1])||w[k+1].trim()==="");)P.push(w[++k].trim());l=P.join(g[0]===">"?" ":`
|
|
20
|
+
`).trim()}else l=g;else O==="model"?a=g:O==="tools"&&!r&&(y=!0,u=g.replace(/^\[|\]$/g,"").split(",").map(P=>P.trim()).filter(Boolean))}}if(r)try{let w=Uo(o);u=w.tools??[],y=w.tools!==null}catch{y=!0,v.push("tools could not be read; check the tool list")}let p=c.trim();return{name:n,...l!==void 0?{description:l}:{},...p?{prompt:p}:{},...!s?.preserveToolAbsence||y?{tools:u}:{},...a!==void 0?{model:a}:{},...v.length?{warnings:v}:{}}}function Xo(t,e,o){let s=e.managed,r=[],n=new Set([...s.agents,...s.configs,...Object.keys(o.files),...o.listedPaths??[]]),l=new Set(Lt(t,[...n],o.files)),a=Object.fromEntries(Object.entries(o.files).filter(([d,p])=>{if(l.has(d))return!1;let w=_(t,{path:d,text:p},{purpose:"override",route:"github",root:e.folder,listing:n,managedFiles:o.files});return!w.admitted&&w.reason==="secret"&&r.push({path:d,reason:"secret"}),w.admitted})),u=new Map;for(let d of s.agents){if(a[d]===void 0){r.some(w=>w.path===d)||r.push({path:d,reason:"missing"});continue}let p=It(d,a[d],s,o.listedPaths??Object.keys(o.files));r.push(...p.refused),u.set(d,p)}let y=new Set([...u.values()].flatMap(d=>d.relationships.filter(p=>p.kind==="agent").map(p=>p.path))),c=[...u.values()].filter(d=>!y.has(d.path));return!c.length&&u.size&&c.push(u.values().next().value),{agents:c.map(d=>{let p=[{path:d.path,role:"system prompt",label:null}],w=[],k=[],f=(m,O,g)=>{for(let P of m.relationships){if(a[P.path]===void 0){r.some(i=>i.path===P.path)||r.push({path:P.path,reason:"missing"});continue}if(P.kind==="agent"){if(O.has(P.path)){r.push({path:P.path,reason:"cycle"});continue}let i=u.get(P.path);if(!i||k.some(h=>h.path===i.path))continue;let b=[];k.push({path:i.path,name:i.name,description:i.description,prompt:i.prompt,...i.model?{model:i.model}:{},tools:[],skillPaths:[],files:b}),f(i,new Set([...O,i.path]),b)}else if(P.kind==="skill"&&o.skills&&Ne(t)||P.kind==="config"&&_t(a[P.path])){if(g.some(i=>i.path===P.path))continue;if(g.push({path:P.path,role:P.kind==="skill"?"skill":"config",label:null}),P.kind==="skill"&&m===d){let i=$e(t,Nn(P.path),a[P.path]);w.push({path:P.path,name:i.name,description:i.description??"",body:i.prompt??""})}}}};return f(d,new Set([d.path]),p),{key:`managed:${d.path}`,name:d.name,model:d.model,description:d.description,prompt:{kind:"dedicated",path:d.path},files:p,tools:[],skills:w,subagents:k}}),notes:[],registry:!1,refused:r}}function Qo(t,e,o){let s=e.miniSwe,r=o.templateSelection?.agentPath===s.agentPath?o.templateSelection.configPaths:void 0,n=lo(t,s,o.files,r),l=n.unresolved.filter(f=>f.reason!=="runtime-variable").map(f=>({path:f.target??f.path,reason:f.reason==="duplicate"?"invalid":f.reason})),a=n.fields.find(f=>f.key==="agent.system_template"&&f.value!==null),u=n.fields.find(f=>f.key==="agent.instance_template"&&f.value!==null),y=n.unresolved.some(f=>n.selectedPaths.includes(f.path)&&f.source===f.path);if(!a||!u||y||l.some(f=>f.reason==="invalid"))return{agents:[],notes:[],registry:!1,refused:l};let c=[a,...n.fields.filter(f=>f!==a)].map(f=>({path:f.path,span:f.span,label:f.key,role:f===a?"system prompt":f.key.endsWith("_template")?"template":"config"}));c.push(...n.loaded.map(f=>({path:f.path,role:"template",label:null})));let v=[];for(let f of c){let m=v.find(O=>O.path===f.path);m?m.span&&f.span&&(m.span={from:Math.min(m.span.from,f.span.from),to:Math.max(m.span.to,f.span.to)}):v.push({...f})}let d=[...new Set(v.map(f=>f.path))],p=Object.fromEntries(d.map(f=>[f,o.files[f]])),w=new Map(d.map(f=>[f,Buffer.byteLength(p[f])])),k=Bo(t,{ownPaths:d},{files:p,sizes:w,root:e.folder});return l.push(...k.refused,...k.skipped),n.fields.some(f=>!k.paths.includes(f.path))?{agents:[],notes:[],registry:!1,refused:l}:(n.loaded=n.loaded.filter(f=>k.paths.includes(f.path)),n.edges=n.edges.filter(f=>k.paths.includes(f.from)&&k.paths.includes(f.to)),{agents:[{key:e.key,name:o.fallbackName,model:n.model,description:null,prompt:{kind:"entry",path:a.path,span:a.span,text:a.value},files:v.filter(f=>k.paths.includes(f.path)),tools:[],skills:[],subagents:[],templateVariants:n}],notes:[],registry:!1,refused:l})}function Ho(t,e,o){if(!e.skills||!ke(t))return o;let s=[...new Set([...Object.keys(e.files),...e.listedPaths??[]])],r=re(t,s,e.root,{files:e.files,listedPaths:e.listedPaths,agentConfigurations:e.agentConfigurations}),n=new Set(r.files.filter(v=>v.role==="skill").map(v=>v.path)),l=v=>[...new Set([...v.skillPaths.filter(d=>n.has(d)),...v.files?.filter(d=>d.role==="skill").map(d=>d.path)??[]])],a=o.agents.flatMap(v=>[...v.skills.map(d=>d.path),...v.subagents.flatMap(l)]),u=de(t,{skillPaths:a,paths:s,files:e.files,root:e.root});for(let v of u)v.files=v.files.filter(d=>Object.hasOwn(e.files,d.path));let y=new Map(u.map(v=>[v.ownerPath,v])),c=(v,d)=>{let p=new Set(d.flatMap(k=>k.refused.map(f=>f.path))),w=v.filter(k=>k.role!=="reference"||!p.has(k.path));for(let k of d)for(let f of k.files)w.some(m=>m.path===f.path)||w.push({path:f.path,role:"reference",label:null});return w};return{...o,agents:o.agents.map(v=>{let d=v.skills.flatMap(p=>y.has(p.path)?[y.get(p.path)]:[]);return{...v,files:c(v.files,d),skills:v.skills.map(p=>({...p,...y.has(p.path)?{manifest:y.get(p.path)}:{}})),subagents:v.subagents.map(p=>{let w=l(p).flatMap(b=>y.has(b)?[y.get(b)]:[]);if(!w.length)return p;let k=r.ownerOf(p.path),f=V(t,s.filter(b=>r.ownerOf(b)===k),k?.folder),m=p.files??p.skillPaths.map(b=>({path:b,role:n.has(b)?"skill":"reference",label:f.skillNames[b]??f.skillRefNames[b]??null})),O=new Set([...v.files.map(b=>b.path),...f.subagentPaths,...Object.keys(f.subagentSkillOwners)]),g=f.scoped.filter(b=>!O.has(b)&&fe(b)&&Object.hasOwn(e.files,b)).sort(),P=p.files?[]:ue(g,[e.files[p.path],...m.filter(b=>b.role==="reference").map(b=>e.files[b.path])],f.stripRoot).map(b=>({path:b,role:"reference",label:null})),i=c([...m,...P],w);return{...p,files:i,skillPaths:[...new Set([...p.skillPaths,...l(p),...w.flatMap(b=>b.files.map(h=>h.path))])].filter(b=>i.some(h=>h.path===b)),skillManifests:w}})}})}}import{basename as un}from"node:path";function Zo(t){return t.prompt.kind!=="none"}function en(t,e,o){if(te(t))return o;let s=new Map(o.agentScopes?.map(l=>[l.key,l.folder])),r=Object.keys(e.files),n=new Map;return{...o,agents:o.agents.map(l=>{let a=s.get(l.key)??e.root,u=n.get(a);return u||(u=V(t,r,a,e.listedPaths??r),n.set(a,u)),{...l,definitionPaths:Tn(l,u)}})}}function Tn(t,e){if(Zo(t))return[t.prompt.path];let o=n=>!e.developerCompanionPaths.includes(n),s=t.subagents.filter(n=>o(n.path));if(s.length)return s.map(n=>n.path);let r=t.files.filter(n=>["skill","tools","mcp"].includes(n.role)&&o(n.path));return t.key!==null||t.plugin||r.some(n=>n.role==="tools"||n.role==="mcp")||!e.hasRepositoryGuide?r.map(n=>n.path):[]}function Bn(t){return!!t.definitionPaths?.length}function la(t,e,o,s){return te(t)?o!==s:(e.key!==null||Zo(e))&&Bn(e)}import{createHash as zn}from"node:crypto";var tn=25,Dn=t=>oe(t,"CF_IMPORT_AGENT_PAGES");function ua(t,e,o,s,r=tn,n){if(!Dn(t))return null;let l=s?.pageSize??r,a=s?.offset??0;if(![8,25,400].includes(l)||!Number.isSafeInteger(a)||a<0)throw new Error("invalid-agent-page");let u=[...new Map(e.map(h=>[h.id,h])).values()],y=zn("sha256").update(JSON.stringify({version:1,context:{commit:o.commit,scope:o.scope},size:l,budgets:n,settings:Object.entries(Ge(t)).filter(([,h])=>h!==void 0).sort(([h],[S])=>h.localeCompare(S)),rows:u.map(({id:h,path:S,groupKey:M,pool:E})=>({id:h,path:S,groupKey:M,pool:E}))})).digest("hex");if(s&&(s.version!==1||s.binding!==y))throw new Error("stale-agent-page");let c=u.map((h,S)=>{let M=nn(t,h,S);return typeof M=="string"?`group:${M}`:`agent:${h.id}`}),v=[...new Set(c)];if(a>0&&a>=v.length)throw new Error("invalid-agent-page");let d=s?.end;if(d!==void 0&&(!Number.isSafeInteger(d)||d<a||d>v.length||d>a+l||d===a&&v.length>0))throw new Error("invalid-agent-page");let p=new Set,w=new Set,k=n?{...n}:null,f=a,m=!1;for(let h of v.slice(a,d??a+l)){let S=new Map(u.filter((E,C)=>c[C]===h&&!w.has(u[C].path)).map(E=>[E.path,E])),M={strong:0,possible:0};for(let E of S.values())M[E.pool??"strong"]+=E.bytes;if(d===void 0&&k&&p.size&&(M.strong>k.strong||M.possible>k.possible)){m=!0;break}p.add(h),f++;for(let E of S.keys())w.add(E);k&&(k.strong=Math.max(0,k.strong-M.strong),k.possible=Math.max(0,k.possible-M.possible))}d!==void 0&&(m=f<v.length&&f-a<l);let O=new Set(v.slice(f)),g=u.filter((h,S)=>p.has(c[S])),P=u.filter((h,S)=>O.has(c[S])).map(h=>h.id),i={version:1,binding:y,offset:a,pageSize:l,end:f},b=new Map(g.map(h=>[h.path,h.bytes]));return{context:{...o},current:i,continuation:P.length?{version:1,binding:y,offset:f,pageSize:l}:null,detected:u.length,detectedGroups:v.length,selected:g.map(h=>h.id),remaining:P,refusals:P.map(h=>({id:h,reason:m?"prompt-over-limit":"page"})),partial:P.length>0,estimatedInputBytes:[...b.values()].reduce((h,S)=>h+S,0)}}function on(){return tn}function nn(t,e,o){return Mt(t)&&e!==null&&typeof e=="object"&&"groupKey"in e&&typeof e.groupKey=="string"&&e.groupKey?e.groupKey:o}function sn(t,e){let o=on(),s=new Set,r=[],n=[];return e.forEach((l,a)=>{let u=nn(t,l,a);s.has(u)||s.size<o?(s.add(u),r.push(l)):n.push(l)}),{kept:r,leftOut:n}}function rn(t){let e=on();if(t.kind==="layout")return`Only ${e} agents can be added per import, so ${t.leftOut} were left out.`;if(t.kind==="scan"){let s=t.found-e;return`${s} ${s===1?"agent wasn't":"agents weren't"} read because the repository is large.`}let o=t.kind==="import"?`Not added: this import already has ${e} agents.`:`Only the ${e} strongest agents of a repository are added.`;return t.kind==="model"?`${t.name}: ${o}`:o}var Qe="crew:";function yt(t){return t.startsWith(Qe)}function kt(t){if(t===null||typeof t!="object"||Array.isArray(t))return null;let e=Object.entries(t);return!e.length||e.some(([,o])=>typeof o!="string"||o.length>=2e3)?null:e.map(([o,s])=>`${o}: ${s}`).join(`
|
|
21
|
+
`)}function an(t,e,o={},s=Object.keys(e)){return U(o)?Gn(t,e,s):t.kind!=="crew"?{agents:[],notes:[],registry:!1}:ln(t,e)}function ln(t,e){let o=[],s=[],r=(a,u)=>s.push({code:"unreadable-crew",path:a,detail:u?`${u} could not be read; some instructions may be missing.`:"could not be read; some instructions may be missing."}),n=_e(e[t.agentsPath]??""),l=t.tasksPath?_e(e[t.tasksPath]??""):[];n?.length||r(t.agentsPath),l===null&&r(t.tasksPath);for(let{key:a,value:u,span:y}of n??[]){if(!he(u)){r(t.agentsPath,a);continue}let{llm:c,tools:v,...d}=u,p=kt(d);if(p===null&&Object.keys(d).length){r(t.agentsPath,a);continue}let w=[{role:"system prompt",path:t.agentsPath,label:a,span:y}];for(let k of l??[])he(k.value)&&k.value.agent===a&&w.push({role:"knowledge",path:t.tasksPath,label:k.key,span:k.span});o.push({key:`${Qe}${t.agentsPath}#${a}`,name:a,model:typeof c=="string"?c:null,description:typeof u.goal=="string"?u.goal:null,entry:{path:t.agentsPath,span:y,text:p},files:w,tools:Array.isArray(v)?[...new Set(v.filter(k=>typeof k=="string"&&!!k.trim()))]:[],skills:[],subagents:[]})}return{agents:o,notes:s,registry:!1}}function he(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}function Gn(t,e,o){let s=new Set([...o,...Object.keys(e)]),r=Object.entries(e).filter(([p])=>p.endsWith(".py")).map(([p,w])=>fo(p,w,s,t.folder)),n=r.flatMap(p=>p.agents),l=r.flatMap(p=>p.refused);if(!n.length)return t.kind==="crew"&&/\.ya?ml$/i.test(t.agentsPath)?{...ln(t,e),refused:l}:{agents:[],notes:[],refused:l,registry:!1};let a=new Map,u=p=>{if(!a.has(p)){let w=e[p]===void 0?null:_e(e[p]);a.set(p,w),w===null&&l.push({path:p,reason:e[p]===void 0?"missing":"invalid"})}return a.get(p)??[]},y=r.flatMap(p=>p.tasks).flatMap(p=>{let w=p.config?.path?u(p.config.path).find(m=>m.key===p.config.key):void 0;if(p.config&&(!p.config.path||!w||!he(w.value)))return p.config.path&&l.push({path:p.config.path,reason:w?"invalid":"missing"}),[];let k=he(w?.value)?w.value:{},f=p.factory.includes(".")?p.factory.slice(0,p.factory.lastIndexOf(".")):null;return[{fact:p,path:p.config?.path??p.path,key:p.config?.key??p.factory,span:w?.span??p.span,agent:p.agent??(typeof k.agent=="string"?f?`${f}.${k.agent}`:k.agent:null),context:[...p.context,...Array.isArray(k.context)?k.context.filter(m=>typeof m=="string"):[]],tools:p.tools}]}),c=r.flatMap(p=>p.tasks).filter(p=>p.config),v=c.flatMap(p=>p.config?.path?[{path:p.config.path,source:p.path,owner:p.factory.includes(".")?p.factory.slice(0,p.factory.lastIndexOf(".")):null}]:[]);!c.length&&t.kind==="crew"&&t.tasksPath&&v.push({path:t.tasksPath,source:t.tasksPath,owner:null});for(let{path:p,source:w,owner:k}of v)for(let f of u(p)){if(y.some(O=>O.path===p&&O.key===f.key&&O.fact.path===w&&(O.fact.factory.includes(".")?O.fact.factory.slice(0,O.fact.factory.lastIndexOf(".")):null)===k)||!he(f.value))continue;let m=f.value;y.push({fact:{path:w,factory:k?`${k}.${f.key}`:f.key,span:f.span,callStart:0,agent:null,context:[],tools:[]},path:p,key:f.key,span:f.span,agent:typeof m.agent=="string"?k?`${k}.${m.agent}`:m.agent:null,context:Array.isArray(m.context)?m.context.filter(O=>typeof O=="string"):[],tools:[]})}let d=[];for(let p of n){let w=p.config?.path?u(p.config.path).find(M=>M.key===p.config.key):void 0;if(p.config&&(!p.config.path||!w||!he(w.value))){p.config.path&&l.push({path:p.config.path,reason:w?"invalid":"missing"});continue}let k=he(w?.value)?w.value:{},f={...Object.fromEntries(Object.entries(k).filter(([M,E])=>!["llm","tools"].includes(M)&&typeof E=="string")),...p.instructions},m=kt(f);if(!m){l.push({path:p.path,reason:"dynamic"});continue}let O=p.config?.key??p.factory.split(".").at(-1),g=p.config?.path??p.path,P=w?.span??p.span,i=[{path:g,role:"system prompt",label:O,span:P}];g!==p.path&&i.push({path:p.path,role:"config",label:p.factory,span:p.span});let b=y.filter(M=>M.fact.path===p.path?M.agent===p.factory||M.agent===O:/\.ya?ml$/i.test(M.fact.path)&&M.agent===O&&n.filter(E=>(E.config?.key??E.factory)===O).length===1),h=new Set,S=[...p.tools];for(let M=0;M<b.length;M++){let E=b[M];if(!h.has(E)&&(h.add(E),!(E.fact.config&&!E.fact.config.path))){i.push({path:E.path,role:"knowledge",label:E.key,span:E.span}),S.push(...E.tools);for(let C of E.context){let L=y.filter(j=>j.fact.path===E.fact.path&&j.fact.factory===C||j.path===E.path&&j.key===C);L.length===1?b.push(L[0]):l.push({path:E.path,reason:L.length?"dynamic":"missing"})}}}for(let M of S)M.path&&M.path!==p.path&&!i.some(E=>E.path===M.path)&&(e[M.path]===void 0&&l.push({path:M.path,reason:"missing"}),i.push({path:M.path,role:"tools",label:M.name}));d.push({key:`${Qe}${p.path}#${p.factory}`,name:O,model:typeof k.llm=="string"?k.llm:null,description:typeof f.goal=="string"?f.goal:null,entry:{path:g,span:P,text:m},files:i,tools:[...new Set([...S.map(M=>M.name),...Array.isArray(k.tools)?k.tools.filter(M=>typeof M=="string"):[]])],skills:[],subagents:[],crewCall:{path:p.path,callStart:p.callStart}})}return{agents:d,notes:[],refused:l,registry:!1}}import{basename as fn,posix as He}from"node:path";function cn(t,e,o){let s={...e.selected,codeAgentsFound:e.codeAgentsFound||e.selected.codeAgentsFound};if(!bt(t,s,o))return{kind:"none"};let r={...e.bodies,...s.files},n=V(t,Object.keys(r),ne(s.root)).templatePaths,l=wt(t,{...s,files:r},n);if(!e.entries)return{kind:"search",paths:[],ownedPaths:l.ownedPaths};let a=new Set([...Object.keys(r),...e.attemptedPaths??[]]),u=new Set(l.facts.dependencies);for(let w of l.relatedReads)w.target.kind==="file"&&u.add(w.target.path);for(let w of e.entries)l.relatedReads.some(k=>k.target.kind==="directory"&&Ze(k,w.path))&&u.add(w.path);let y=(w,k)=>{let f=_(t,w,{purpose:k,route:"local-folder"});return f.admitted||f.reason==="too-large"},c=[...new Set(e.entries.filter(w=>!a.has(w.path)&&(u.has(w.path)?y(w,"pointer"):D(w.path,s.root)===null&&se(w.path)!==null&&y(w,"code-support"))).map(w=>w.path))],v=ne(s.root)??"",d=w=>He.parse(w).name===(v?fn(v):s.fallbackName)?0:Bt.test(fn(w))?1:2,p=w=>He.relative(v||".",He.dirname(w)).split("/").filter(k=>k&&k!==".").length;return c.sort((w,k)=>Number(u.has(k))-Number(u.has(w))||d(w)-d(k)||p(w)-p(k)||(w<k?-1:w>k?1:0)),{kind:"search",paths:c,ownedPaths:l.ownedPaths}}function Ze(t,e){return t.target.kind==="file"?t.target.path===e:He.dirname(e)===t.target.path&&(!t.target.extension||e.endsWith(t.target.extension))}function bt(t,e,o){if(!De(t)||e.codeAgentsFound||e.explicitPrompt!==void 0||o.agents.length||e.listedPaths&&V(t,[...e.listedPaths],ne(e.root)).configPath)return null;let s=V(t,Object.keys(e.files),ne(e.root)).templatePaths;if(!s.length)return null;let r=Object.fromEntries(Object.entries(e.files).filter(([n])=>D(n,e.root)!==null&&_(t,{path:n},{purpose:"override",route:"github"}).admitted));return tt(t,r).reads.some(n=>s.some(l=>Ze(n,l)))?null:s}function wt(t,e,o){let s=Object.fromEntries(Object.entries(e.files).filter(([d])=>_(t,{path:d},{purpose:"override",route:"github"}).admitted)),r=tt(t,s),n=r.reads.filter(d=>D(d.sourcePath,e.root)===null&&o.some(p=>Ze(d,p))),l=o.filter(d=>n.some(p=>Ze(p,d))).sort(),a=[...new Set(n.map(d=>d.sourcePath))].sort(),u=r.reads.filter(d=>a.includes(d.sourcePath)),y=u.flatMap(d=>d.target.kind==="file"&&Object.hasOwn(s,d.target.path)&&D(d.target.path,e.root)!==null&&!o.includes(d.target.path)?[d.target.path]:[]).sort(),c=n.flatMap(d=>d.consumerPaths).sort(),v=l.length?[...new Set([l[0],...o.filter(d=>d!==l[0]),...y,...a,...c])]:[];return{facts:r,relatedReads:u,provenTemplates:l,ownedPaths:v}}function al(t,e,o={}){return et(t)&&!e.agentConfigurations&&(e={...e,agentConfigurations:ro(t,e.listedPaths??Object.keys(e.files),e.root)}),en(t,e,Kn(t,e,o))}function Kn(t,e,o){let s=hn(t,e),{answer:r,scopeProof:n}=Wn(t,e,s),l=we(t);if(!l&&!r.agents.some(f=>f.crewCall||f.layoutCall))return mt(t,e,r);let a=[...new Set([...Object.keys(e.files),...e.listedPaths??[],...r.scopePaths??[]])],u=re(t,a,e.root,{files:e.files,agentConfigurations:e.agentConfigurations,listedPaths:e.listedPaths}),y=r.agents.filter(f=>l||f.crewCall||f.layoutCall).map(f=>{let m=s.agents.find(C=>C.key===f.key),O=Pt(m?.files??[]),g=r.agentScopes?.find(C=>C.key===f.key)?.folder,P=u.scopes.find(C=>g===void 0?C.key===f.key:C.folder===g)??u.scopes[0],i=V(t,a.filter(C=>u.ownerOf(C)===P),P.folder),b=new Set([...f.files.filter(C=>C.role!=="reference"||C.label!==null).map(C=>C.path),...f.subagents.flatMap(C=>[C.path,...m?.subagents.find(L=>L.path===C.path)?.skillPaths??C.skillPaths]),...r.notes.filter(C=>C.code==="orphan-skill").map(C=>C.path)]),h=i.scoped.filter(C=>!b.has(C)&&fe(C)).sort(),S=`convention:${JSON.stringify(f.key)}`,M=f.files.map(C=>f.prompt.kind!=="none"&&f.prompt.path===C.path&&"span"in f.prompt?{...C,span:C.span??f.prompt.span}:C),E=f.subagents.map(C=>{let L=m?.subagents.find(N=>N.path===C.path),j=C.files??C.skillPaths.map(N=>({path:N,role:i.skillNames[N]?"skill":"reference",label:i.skillNames[N]??i.skillRefNames[N]??null})),T=ke(t)?Pt(L?.files??[]):j.map(N=>N.path),F=C.files&&!i.subagentPaths.includes(C.path)?[]:ue(h,[C.path,...T].map(N=>e.files[N]??""),i.stripRoot),x=F.filter(N=>!j.some(ie=>ie.path===N)).map(N=>({path:N,role:"reference",label:null})),G=r.agents.find(N=>"key"in C&&N.key===C.key);return{child:C,id:`${S}:${JSON.stringify("key"in C?C.key:C.path)}`,scopeProof:G?.layoutProof??n,toolCall:G?.layoutCall,independentReferences:[...Pt(L?.files??[]),...F],ownFiles:"key"in C?[...j,...x]:[{path:C.path,role:"system prompt",label:null},...j,...x]}});return{agent:f,id:S,scope:P,ownFiles:M,independentReferences:O,children:E,scopeProof:f.layoutProof??n,toolCall:f.crewCall??f.layoutCall}}),c=y.flatMap(({agent:f,id:m,scope:O,ownFiles:g,independentReferences:P,children:i,scopeProof:b,toolCall:h})=>[{id:m,scope:O,ownFiles:g,independentReferences:P,scopeProof:b,toolCall:h,sharedReferencePaths:f.sharedReferencePaths,fileProfile:f.crewCall||f.layoutCall?"layout":"convention",skillManifests:f.skills.flatMap(S=>S.manifest?[S.manifest]:[])},...i.map(({child:S,id:M,ownFiles:E,independentReferences:C,scopeProof:L,toolCall:j})=>({id:M,scope:O,ownFiles:E,independentReferences:C,scopeProof:L,toolCall:j,fileProfile:"key"in S?"layout":"convention",skillManifests:S.skillManifests}))]),v=zo(t,c,{files:e.files,sizes:o.sizes??new Map(Object.entries(e.files).map(([f,m])=>[f,Buffer.byteLength(m)])),total:o.total,root:e.root,scopes:u}),d=new Map(v.map(f=>[f.agentId,f])),{complete:p,...w}=r,k=new Map(y.map(({agent:f,id:m,children:O})=>{let g=d.get(m);return[f.key,{...f,manifest:g,files:pn(g,f.files),skills:f.skills.filter(P=>g.files.some(i=>i.path===P.path)),subagents:O.flatMap(({child:P,id:i,ownFiles:b})=>{let h=d.get(i);if(!h.files.some(E=>E.path===P.path))return[];let S=pn(h,b),M="key"in P?S:S.filter(E=>E.path!==P.path);return[{...P,files:M,skillPaths:P.skillPaths.filter(E=>M.some(C=>C.path===E))}]})}]}));return mt(t,e,{...w,...p&&!v.some(f=>f.refused.length)?{complete:p}:{},scopePaths:a,manifests:v,agents:r.agents.map(f=>k.get(f.key)??f)})}function pn(t,e){return t.files.flatMap(o=>e.some(s=>s.path===o.path)?e.filter(s=>s.path===o.path):[{path:o.path,role:o.roles.includes("config")?"config":"tools",label:null,...o.spans.length===1?{span:o.spans[0]}:{}}])}function Pt(t){return t.filter(e=>e.role==="reference"&&e.label===null).map(e=>e.path)}function Wn(t,e,o){let s=Ho(t,e,o);if(!te(t)&&e.codeAgentsFound)return{answer:{...s,projection:"code"}};let r=bt(t,e,s);if(!r)return{answer:s};let n=wt(t,e,r);if(!n.provenTemplates.length)return{answer:s};let l=n.provenTemplates[0],a=new Set(s.agentScopes?.find(y=>y.key===null)?.notes),u=y=>!(y.code==="no-prompt"&&y.detail==="no-conventions"&&y.path===(ne(e.root)??""));return{scopeProof:{kind:"outside-loader",paths:n.ownedPaths},answer:{...s,projection:"conventions",notes:s.notes.filter(u),...s.agentScopes?{agentScopes:s.agentScopes.map(y=>({...y,notes:y.notes.filter(u)}))}:{},...s.unassignedNotes?{unassignedNotes:s.unassignedNotes.filter(y=>!a.has(y))}:{},agents:[{key:null,name:e.fallbackName,model:null,description:null,prompt:{kind:"dedicated",path:l},files:n.ownedPaths.map(y=>({path:y,role:y===l?"system prompt":r.includes(y)?"template":"reference",label:null})),skills:[],subagents:[]}]}}}function ll(t,e){return De(t)?cn(t,e,hn(t,e.selected)):{kind:"none"}}function hn(t,e){if(!ce(t)){let{agents:i,notes:b}=vt(t,e,null);return{agents:i,notes:b}}let o=jt(t,e.listedPaths??[]).flatMap(i=>[...i.agents,...i.configs]),s=[...new Set([...Object.keys(e.files),...o,...U(t)?e.listedPaths??[]:[]])],{scopes:r,ownerOf:n,ignoredPaths:l,pluginFolders:a}=re(t,s,e.root,{files:e.files,agentConfigurations:e.agentConfigurations,listedPaths:e.listedPaths}),u=new Set(l),y=new Map(r.map(i=>[i,{}]));for(let[i,b]of Object.entries(e.files)){if(u.has(i))continue;let h=n(i);h&&(y.get(h)[i]=b)}let c=r.map(i=>{let b=y.get(i),h={...e,files:b,root:i.folder,fallbackName:i.key===null?e.fallbackName:un(i.folder),explicitPrompt:i.key===null?e.explicitPrompt:void 0,...e.pointerFiles?{pointerFiles:Object.fromEntries(Object.entries(e.pointerFiles).filter(([S])=>!u.has(S)&&n(S)===i))}:{}};return{scope:i,input:h,answer:mn(t,i,h,!1,e.files)}}),v=[],d=new Map,p=c.filter(({scope:i,input:b,answer:h})=>{let S=h.agents[0];if(!S)return!0;let M=Object.entries(b.files).map(([L,j])=>[D(L,i.folder),j]).sort(([L],[j])=>L<j?-1:L>j?1:0),E=JSON.stringify([S.name,M,...i.managed||U(t)&&(i.kind==="crew"||a.includes(i.folder))?[i.folder]:[]]),C=d.get(E);return C!==void 0?(v.push({code:"duplicate-agent",path:i.folder,detail:C}),!1):(d.set(E,i.folder),!0)}),w=p.find(({scope:i})=>i.key===null),k=w.answer.agents[0];p.some(({scope:i,answer:b})=>i.key!==null&&b.agents.length)&&(w.answer=mn(t,w.scope,w.input,!0,e.files),w.answer.notes=w.answer.notes.filter(i=>i.detail!=="no-conventions"));for(let{scope:i,answer:b}of te(t)?[]:p)a.includes(i.folder)&&(b.agents=b.agents.map(h=>({...h,plugin:!0})));let{kept:f,leftOut:m}=sn(t,p.flatMap(({answer:i})=>i.agents));jo(f,k,{settings:t,files:e.files,root:e.root});let O=[...v,...m.length?[{code:"agent-cap",detail:rn({kind:"layout",leftOut:m.length})}]:[]],g=new Set(f.map(i=>i.key));return{...!e.definitionsOmitted&&p.some(({scope:i})=>i.kind==="crew")&&p.every(({scope:i,answer:b})=>b.notes.length===0&&!b.refused?.length&&(i.kind==="crew"?b.agents.length>0&&b.agents.every(h=>yt(h.key??"")):b.agents.length===0))&&(!e.listedPaths||re(t,e.listedPaths,e.root,{agentConfigurations:e.agentConfigurations}).files.every(i=>Object.hasOwn(e.files,i.path)))?{complete:!0}:{},...p.some(({scope:i,answer:b})=>i.miniSwe&&b.agents.length)&&!e.codeAgentsFound?{projection:"conventions"}:{},agents:f.map(i=>i.layoutCall?{...i,subagents:i.subagents.filter(b=>"key"in b&&g.has(b.key))}:i),notes:[...p.flatMap(({answer:i})=>i.notes),...O],...o.length?{scopePaths:s}:{},...p.some(({answer:i})=>i.refused?.length)?{refused:p.flatMap(({answer:i})=>i.refused??[])}:{},...r.length>1||r.some(i=>i.kind==="crew"||i.managed||i.miniSwe)||p.some(({answer:i})=>i.agents.some(b=>b.layoutCall))?{agentScopes:p.flatMap(({scope:i,answer:b})=>(b.agents.length?b.agents:[{key:i.key}]).map((h,S)=>({key:h.key,folder:i.folder,registry:b.registry&&!yt(h.key??""),notes:b.notes.filter(M=>M.code!=="unreadable-crew"||S===0)}))),unassignedNotes:[...p.filter(({answer:i})=>!i.agents.some(b=>g.has(b.key))).flatMap(({answer:i})=>i.notes),...O]}:{}}}function mn(t,e,o,s=!1,r){if(e.managed)return Xo(t,e,o);if(e.miniSwe&&o.explicitPrompt===void 0)return Qo(t,e,o);if(e.kind!=="crew"&&!U(t))return vt(t,o,e.key,s);let n=Wo(t,o,r),l=qn(t,e,o.files,o.listedPaths),a=vt(t,o,e.key,s||e.key===null&&(l.agents.length>0||n.agents.length>0));return{agents:[...a.agents,...l.agents,...n.agents],notes:[...a.notes.filter(u=>u.detail!=="no-conventions"||e.kind!=="crew"&&l.agents.length===0&&n.agents.length===0),...l.notes],registry:a.registry,...l.refused?.length||n.refused.length?{refused:[...l.refused??[],...n.refused]}:{}}}function qn(t,e,o,s){let r=an(e,o,t,s),{agents:n,notes:l,registry:a}=r;return{agents:n.map(({entry:u,...y})=>({...y,prompt:gn(t,{entry:u},l)})),notes:l,registry:a,...r.refused?.length?{refused:r.refused}:{}}}function vt(t,e,o,s=!1){let{files:r,skills:n,fallbackName:l}=e,a=ne(e.root),u=V(t,Object.keys(r),a,e.listedPaths),y=[],c=typeof e.explicitPrompt=="string"&&!je(t,e.explicitPrompt);c&&y.push({code:"explicit-guide",path:e.explicitPrompt});let v=c?null:e.explicitPrompt,d=typeof v=="string"&&Object.hasOwn(r,v)&&_(t,{path:v},{purpose:"override",route:"github"}).admitted?v:null,p={...u,skillPaths:n?u.skillPaths:[]},w=Be(p),k=Jn(r,u.configPath,y),f=!te(t)&&!k?.prompt&&!k?.agents?.length?io(t,e):null,m=Le({codeAgentsFound:!te(t)&&!!e.codeAgentsFound,folderAgentsFound:s,otherDefinitions:w,agentConfiguration:f!==null},t);if(f&&m==="prompt"&&(u=f),!(v===null||d!==null||so({...p,claudePath:u.claudePath},m)))return dn(st(u),n,y),{agents:[],notes:[...y,{code:"no-prompt",path:a??"",detail:"no-conventions"}],registry:u.registry};let g=gn(t,{files:r,c:u,guideRole:m,folderAgentsFound:s,root:a,config:k,explicitPath:v===null?null:d??void 0,pointerFiles:e.pointerFiles},y);g.kind==="none"&&(u=st(u));let P=n?u.skillPaths.map(h=>{let S=$e(t,`${u.skillNames[h]}.md`,r[h]);return y.push(...(S.warnings??[]).map(M=>({code:"frontmatter",path:h,detail:M}))),{path:h,name:S.name,description:S.description??"",body:S.prompt??""}}):[];dn(u,n,y);let i=n?[...u.subagentSkillPaths,...u.subagentSkillRefPaths]:[],b=u.subagentPaths.map(h=>{let S=$e(t,un(h),r[h],{preserveToolAbsence:!0});return y.push(...(S.warnings??[]).map(M=>({code:"frontmatter",path:h,detail:M}))),{path:h,name:S.name,description:S.description??null,prompt:S.prompt??"",...S.tools!==void 0?{tools:S.tools}:{},...S.model!==void 0?{model:S.model}:{},skillPaths:i.filter(M=>u.subagentSkillOwners[M]===h)}});return{agents:[{key:o,name:k?.name??l,model:k?.model??null,description:k?.description??null,prompt:g,files:Vn(t,r,u,g,n),skills:P,subagents:b}],notes:y,registry:u.registry}}function fl(t,e,o,s){let r=V(t,Object.keys(o),ne(s));return Object.hasOwn(r.subagentSkillOwners,e)?!0:de(t,{skillPaths:r.subagentSkillPaths,paths:r.scoped,files:o,root:s})?.some(n=>n.files.some(l=>l.path===e))??!1}function Jn(t,e,o){if(!e)return null;let s=Ee(t[e]);if(s.invalid)try{JSON.parse(t[e])}catch{o.push({code:"invalid-config",path:e})}return s.config}function gn(t,e,o){if("entry"in e)return e.entry.text?{kind:"entry",...e.entry,text:e.entry.text}:(o.push({code:"no-prompt",path:e.entry.path}),{kind:"none"});let{files:s,c:r,guideRole:n,folderAgentsFound:l,root:a,config:u,explicitPath:y,pointerFiles:c}=e;if(y===null)return{kind:"none"};if(y!==void 0)return{kind:"explicit",path:y};let v=u?We(u)[0]?.prompt:void 0,d=u?qe(t,u,a??"")[0]:void 0,p=v?at(t,v,{repoKey:"",markerDir:a??"",files:c??s}):null,w=d!==void 0&&Object.hasOwn(s,d),k=w&&!!s[d];if(w&&(k||c!==void 0)&&Object.hasOwn(r.subagentSkillOwners,d))o.push({code:"pointer-owned-by-subagent",path:d});else if(w&&(c===void 0?k:p?.kind==="resolved")){let f=p?.kind==="resolved"?p.prompt:null;return{kind:"pointer",path:d,...f&&f.kind!=="file"?{span:{...f.span},site:{kind:f.kind,start:f.start,symbol:f.symbol}}:{}}}else v&&o.push(c!==void 0&&p?.kind==="secret"?{code:"secret-file",path:p.path}:{code:"pointer-missed",...d?{path:d}:{},detail:v});return r.promptPath?{kind:"dedicated",path:r.promptPath}:r.registry&&r.soulPath?{kind:"registry",path:r.soulPath}:r.claudePath&&n==="prompt"?(o.push({code:"claude-fallback",...et(t)?{path:r.claudePath}:{}}),{kind:"fallback",path:r.claudePath}):(o.push({code:"no-prompt",path:a??"",...l?{folderAgentsFound:!0}:{}}),{kind:"none"})}function dn(t,e,o){if(e)for(let s of[...t.subagentSkillPaths,...t.subagentSkillRefPaths])t.subagentSkillOwners[s]||o.push({code:"orphan-skill",path:s})}function Vn(t,e,o,s,r){let n=[],l=(c,v,d=null)=>({role:c,label:d,path:v});if(s.kind!=="none"&&s.kind!=="registry"&&n.push(l("system prompt",s.path)),o.soulPath&&n.push(l("soul",o.soulPath)),o.knowledgePath&&n.push(l("knowledge",o.knowledgePath)),r)for(let c of o.skillPaths)n.push(l("skill",c,o.skillNames[c]));for(let c of o.templatePaths)n.push(l("template",c));if(r)for(let c of o.skillRefPaths)n.push(l("reference",c,o.skillRefNames[c]));let a=[];o.configPath&&a.push(l("config",o.configPath));for(let c of[o.toolsPath,o.toolsTsPath,o.cliPath])c&&a.push(l("tools",c));o.mcpPath&&a.push(l("mcp",o.mcpPath));let u=new Set([...n.map(c=>c.path),...a.map(c=>c.path),...o.subagentPaths,...Object.keys(o.subagentSkillOwners),...o.skillPaths,...o.skillRefPaths]),y=o.scoped.filter(c=>!u.has(c)&&fe(c)).sort();return n.push(...ue(y,n.map(c=>e[c.path]),o.stripRoot).map(c=>l("reference",c)),...a),n}export{ue as a,Cr as b,Mn as c,Io as d,we as e,Ao as f,Ro as g,pt as h,Ee as i,it as j,wo as k,Zn as l,Pn as m,Po as n,fs as o,xo as p,Sn as q,ct as r,zs as s,Fo as t,xn as u,$o as v,No as w,ut as x,En as y,ni as z,si as A,ri as B,Bo as C,zo as D,jn as E,Li as F,gt as G,Ni as H,$e as I,Zo as J,Bn as K,la as L,Dn as M,ua as N,on as O,sn as P,rn as Q,al as R,ll as S,fl as T};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as n}from"./WYLIV2P2.js";function r(e){return e.CF_FILE_SCOPE==="1"&&e.CF_LOCAL_IMPORT_RESOLUTION!=="0"}function o(e){return e.CF_FINDING_HEADLINES==="1"}function E(e){return e.CF_RESULT_SAFETY_CHECK==="1"}function i(e){return e.CF_IMPORT_OUTSIDE_LOADERS==="1"}function _(e){return e.CF_PROMPT_AGREE==="1"}function u(e){return n(e,"saved")}export{r as a,o as b,E as c,i as d,_ as e,u as f};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import{$ as Ye,Aa as He,B as je,Ba as Qe,C as Te,Ca as et,D as B,E as ze,Ea as we,Fa as tt,G as Ue,Ga as ee,H as J,Ia as ot,Ja as Pe,Ka as nt,La as ke,Ma as Se,Pa as ye,Qa as st,R as We,Ra as V,T as Ge,U as ae,Ua as ce,V as Be,Va as fe,W as Ze,X as Ke,a as de,c as Q,d as G,da as Je,e as pe,fa as ie,g as Fe,h as j,i as re,j as Me,ja as Ve,ka as qe,kb as at,l as K,m as $e,n as I,o as z,p as C,q as E,qa as A,r as Ae,ra as ge,s as he,t as Ie,u as U,v as Y,w as Le,xa as le,y as Ne,ya as Xe,z as De}from"./GOQVKWP3.js";import{f as rt}from"./2PZF54KH.js";import{a as T,c as x,e as Z}from"./C6X5GDG4.js";function q(e,t,o,c=t,r={}){let a=V(e,t.filter(s=>A(e,{path:s},{purpose:"override",route:"github"}).admitted),{root:o,...r});return be(a,e,c.some(s=>{let d=x(s,o);return d!==null&&de(d)}))}function be(e,t,o=e.scoped.some(c=>de(c.relativePath))){let c=new Map(e.scoped.map(s=>[s.path,s.relativePath])),r=(s,d,w=!1)=>e.files.find(g=>g.role===s&&g.kind!=="background"&&g.preferred!==!1&&(!d||g.kind===d)&&(!w||g.preferred))?.path??null,a=(s,d,w=!1)=>e.files.filter(g=>g.role===s&&(!d||g.kind===d)&&g.ownerPath!==void 0===w).map(g=>g.path).sort();return{scoped:e.scoped.map(s=>s.path),hasRepositoryGuide:o,developerCompanionPaths:!pe(t)&&o?e.scoped.filter(s=>vt(s.relativePath)).map(s=>s.path):[],stripRoot:s=>c.get(s)??s,configPath:r("marker"),promptPath:r("prompt","dedicated",!0),claudePath:r("prompt","fallback"),toolsPath:r("tool file","json"),toolsTsPath:r("tool file","sdk"),cliPath:r("tool file","cli"),mcpPath:r("MCP config",void 0,!0),registry:e.registry,soulPath:r("soul"),knowledgePath:r("knowledge"),subagentPaths:a("sub-agent"),skillPaths:a("skill"),skillNames:Object.fromEntries(e.files.filter(s=>s.role==="skill"&&s.name).map(s=>[s.path,s.name])),skillRefNames:Object.fromEntries(e.files.filter(s=>s.role==="reference"&&s.kind==="skill"&&s.name).map(s=>[s.path,s.name])),templatePaths:a("reference","template"),skillRefPaths:a("reference","skill"),subagentSkillPaths:a("skill",void 0,!0),subagentSkillRefPaths:a("reference","skill",!0),subagentSkillOwners:Object.fromEntries(e.files.filter(s=>s.ownerPath!==void 0).map(s=>[s.path,s.ownerPath]))}}function it(e){let t=new Set(e.developerCompanionPaths),o=c=>!t.has(c);return{...e,mcpPath:e.mcpPath&&o(e.mcpPath)?e.mcpPath:null,subagentPaths:e.subagentPaths.filter(o),skillPaths:e.skillPaths.filter(o),subagentSkillPaths:e.subagentSkillPaths.filter(o),subagentSkillRefPaths:e.subagentSkillRefPaths.filter(o),skillRefPaths:e.skillRefPaths.filter(o)}}function te(e){let t=it(e);return!!(t.promptPath||t.toolsPath||t.toolsTsPath||t.cliPath||t.mcpPath||t.soulPath||t.knowledgePath||t.subagentPaths.length||t.skillPaths.length)}function Ot(e){let t=it(e);return!!(t.promptPath||t.registry&&t.soulPath||t.subagentPaths.length)}function lt(e,t){return pe(e)?te(t):Ot(t)}function vt(e){return e.toLowerCase()===".mcp.json"||/^\.claude\/(agents|skills)\//i.test(e)}function ct(e,t){return!!e.configPath||!!e.claudePath&&t==="prompt"||te(e)}var Et=/^(evals?|evaluations)\/.*\.(jsonl?|ya?ml|md|csv)$|\.eval\.(json|ya?ml)$/i;function Ct(e){return we.exec(e)?.[1]?.toLowerCase()==="commands"&&/\.md$/i.test(e)}function Rt(e){return Et.test(e)}function X(e,t,o={}){if(!G(e))return!1;if(o.agentConfigurations){if(o.agentConfigurations[T(o.root)]!==!0)return!1;if(o.skills!==!1)return!0}let c=t.flatMap(w=>{let g=x(w,o.root);return g===null?[]:[{path:w,relative:g}]}),r=c.filter(({path:w})=>A(e,{path:w},{purpose:"definition",route:"github",root:o.root}).admitted);if(!r.some(({relative:w})=>Q.includes(w.toLowerCase())))return!1;let a=q(e,r.map(w=>w.path),o.root,t),s=!!(a.subagentPaths.length||a.toolsPath||o.skills!==!1&&a.skillPaths.length),d=r.some(({relative:w})=>Ct(w));return!o.agentConfigurations&&c.some(({relative:w})=>{let g=we.exec(w)?.[1]?.toLowerCase();return!(g==="skills"||(g==="commands"?s:Ne(w)&&(s||d)))&&!qe.test(w)&&!Ve.test(w)&&w.toLowerCase()!==le.toolsSource&&Me(w)})?!1:s||d||r.some(({relative:w})=>Rt(w))}function oe(e,t,o){let c=new Map([[T(o),[]]]);for(let r of t)x(r,o)!==null&&Q.includes(r.split("/").at(-1).toLowerCase())&&c.set(r.slice(0,Math.max(0,r.lastIndexOf("/"))),[]);for(let r of t){if(x(r,o)===null)continue;let a=r.slice(0,Math.max(0,r.lastIndexOf("/")));for(;c.get(a)?.push(r),!!a;)a=a.slice(0,Math.max(0,a.lastIndexOf("/")))}return Object.fromEntries([...c].map(([r,a])=>[r,X(e,a,{root:r})]))}function co(e,t){let o=[...new Set([...Object.keys(t.files),...t.listedPaths??[]])],{root:c,skills:r,agentConfigurations:a}=t;if(!X(e,o,{root:c,skills:r,agentConfigurations:a}))return null;let s=q(e,Object.keys(t.files),c,t.listedPaths,{agentConfiguration:!0});return s.claudePath?s:null}import{posix as ne}from"node:path";import{posix as Ft}from"node:path";function _e(e,t=1){let o=new Set,c=[],r=e.replace(/{#[\s\S]*?#}|{%[-+]?\s*raw\s*[-+]?%}[\s\S]*?(?:{%[-+]?\s*endraw\s*[-+]?%}|$)/g,a=>a.replace(/[^\n]/g," "));for(let a of r.matchAll(/{%[-+]?\s*(include|extends|import|from)\s+(.+?)\s*[-+]?%}/g)){let s=a[2].match(/^(["'])([^"']+)\1(?:\s+(?:as\s+\w+|import\s+.+|ignore missing|with context|without context))?$/),d=t+e.slice(0,a.index).split(`
|
|
2
|
+
`).length-1;c.push({source:s?.[2]??a[2],span:{from:d,to:d},...s?{}:{reason:"dynamic"}})}for(let a of r.matchAll(/{{[-+]?\s*([\w]+)|{%[-+]?\s*(?:if|elif|for\s+\w+\s+in|set\s+\w+\s*=)\s+([\w]+)/g)){let s=a[1]??a[2];!["true","false","none"].includes(s.toLowerCase())&&!/^\d/.test(s)&&o.add(s)}return{variables:[...o],loaders:c}}function ft(e,t={}){let o=e.split(`
|
|
3
|
+
`),c=[],r=[],a=(s,d,w)=>{let g=new Set;for(let P of Ge(s.join(`
|
|
4
|
+
`))){let k=w?`${w}.${P.key}`:P.key,l={from:d+P.span.from,to:d+P.span.to},n=s.slice(P.span.from-1,P.span.to);g.has(P.key)&&r.push({key:k,span:l,reason:"duplicate"}),g.add(P.key);let p=n[0].slice(n[0].indexOf(":")+1).trim();if(!p||p.startsWith("#")){let f=n.slice(1),u=f.find(y=>y.trim()&&!y.trimStart().startsWith("#"))?.match(/^ */)?.[0].length;if(u){a(f.map(y=>y.slice(u)),l.from,k);continue}}let h=We(n.join(`
|
|
5
|
+
`))?.[P.key],m=typeof h=="string"?h:null,i=k.endsWith("_template")||$e(t,"CF_IMPORT_PROMPT_FIELDS")&&k.endsWith("_prompt");(i&&m===null||/^[!&*]/.test(p))&&r.push({key:k,span:l,reason:"invalid"}),c.push({key:k,span:l,text:o.slice(l.from-1,l.to).join(`
|
|
6
|
+
`),value:m,...i&&m!==null?_e(m,l.from+(/^[|>]/.test(p)?1:0)):{variables:[],loaders:[]}})}};a(o,0,"");for(let s of r.filter(d=>d.reason==="duplicate"))for(let d of c.filter(w=>w.key===s.key||w.key.startsWith(`${s.key}.`)))d.value=null;return{fields:c,unresolved:r}}function Mt(e,t){let{toks:o}=e,c=[],r=new Map;for(let a=0;a<o.length;a++){if(!he(o,a))continue;let s=Ie(e.text,o[a]),d=c.findLast(k=>k.indent===s);for(;c.length&&c.at(-1).indent>=s;)c.pop();if(r.set(o[a].line,c.some(k=>!k.guard)?null:c.map(k=>k.guard)),!["if","elif","else","for","while","try","except","with","match","case"].some(k=>E(o[a],k)))continue;let w=a+1;for(;w<o.length&&o[w].line===o[a].line;)w++;let g=C(o[w-1],":"),P=null;if(g&&E(o[a],"else")&&d?.guard&&(P={...d.guard,value:!d.guard.value}),g&&E(o[a],"if")){let k=E(o[a+1],"not"),l=a+(k?2:1),n=o.slice(l,w-1).map(m=>m.text).join(""),p=t.owner(a),h=/^[A-Za-z_]\w*$/.test(n)?n:null;if(/^self\.[A-Za-z_]\w*$/.test(n)){let i=o.flatMap((f,u)=>u<a&&he(o,u)&&t.owner(u)===p&&o.slice(u,u+3).map(y=>y.text).join("")===n?[u]:[]).at(-1);h=i!==void 0&&C(o[i+3],"=")&&E(o[i+4])&&o[i+5]?.line!==o[i].line?o[i+4].text:null}if(h&&p?.params?.includes(h)&&!t.binding(h,a)){let m=o.findIndex((y,_)=>p.from<_&&_<a&&C(y,"(")),i=m>=0&&U(o,m)<a?Y(o,m).find(y=>E(o[y.from],h)):void 0,f=i&&o.findIndex((y,_)=>i.from<_&&_<i.to&&C(y,"=")),u=f!==void 0&&f>=0&&f+2===i?.to?o[f+1].text:null;P={parameter:h,value:!k,defaultValue:u==="True"?!0:u==="False"?!1:null}}}c.push({indent:s,guard:P}),r.set(o[a].line,null)}return r}function Po(e,t,o){let c=z(e,t,"py"),r=ce(c,{includeMembers:!0}),a=fe(c,r,{enclosingBindings:!0}),{toks:s}=c,d=Mt(c,a),w=a.assignments.map(h=>["else","try","finally"].includes(h.name)&&E(s[h.from-2])?{...h,name:s[h.from-2].text,at:h.from-2}:h),g=h=>s.slice(h.from,h.to).map(m=>m.kind==="string"?JSON.stringify(m.value):m.text).join(""),P=(h,m,i,f)=>{let u=a.importBinding(h,m);return u?f?!u.namespace&&u.module.source===i&&u.name===f:u.namespace&&u.module.source===i:!1},k=[],l=new Map,n=new Map;for(let h of a.calls.filter(m=>m.callee.endsWith("read_text"))){let m=g(h),i=/^([A-Za-z_]\w*)\.resources\.files\(("(?:[^"\\]|\\.)*")\)\.joinpath\((.*?)\)\.read_text\(\)$/.exec(m)??/^([A-Za-z_]\w*)\.files\(("(?:[^"\\]|\\.)*")\)\.joinpath\((.*?)\)\.read_text\(\)$/.exec(m);if(!i)continue;let f=a.importBinding(i[1],h.from),u=m.startsWith(`${i[1]}.resources.files(`);if(!(f&&(u?f.namespace&&f.name==="importlib"&&["importlib","importlib.resources"].includes(f.module.source):f.namespace&&f.name==="importlib.resources"&&f.module.source==="importlib.resources"||!f.namespace&&f.name==="resources"&&f.module.source==="importlib")))continue;let _=a.calls.find(b=>b.from<h.from&&h.to<b.to&&b.args.length===1&&b.args[0].from===h.from&&b.args[0].to===h.to&&(b.callee.endsWith(".safe_load")&&P(b.callee.split(".")[0],b.from,"yaml")||P(b.callee,b.from,"yaml","safe_load")));if(!_)continue;let S=JSON.parse(i[2]),O;try{O=JSON.parse(i[3])}catch{}let R=null,$;if(typeof O!="string"||!/^[A-Za-z_]\w*(?:\.[A-Za-z_]\w*)*$/.test(S))$="dynamic";else if(Ft.isAbsolute(O)||/[\\\0]/.test(O)||O.split("/").includes(".."))$="out-of-scope";else{let b=`${S.replaceAll(".","/")}/${O}`,N=e.indexOf(`${S.split(".")[0]}/`),L=N>=0?e.slice(0,N)+b:null,D=[...o].filter(H=>H===b||H.endsWith(`/${b}`));R=L??(D.length===1?D[0]:null),R?o.has(R)||($="missing"):$=D.length>1?"dynamic":"missing"}let v=w.find(b=>b.from<=_.from&&_.from<b.to&&a.owner(b.at)===a.owner(_.from)),F={path:R,source:typeof O=="string"?O:i[3],span:{from:s[h.from].line,to:s[h.to-1].endLine},start:s[_.from].start,end:s[_.to-1].end,binding:v?.name??null,forwarded:!1,when:d.get(s[v?.at??h.from].line)??null,className:r.filter(b=>b.kind==="class"&&b.from<h.from&&h.from<b.to).at(-1)?.name??null,...$?{reason:$}:{}};k.push(F),v&&(l.set(F,v),n.set(v,_))}let p=new Set([...l.values()].filter(h=>{let m=n.get(h);return(E(s[h.from],h.name)&&E(s[h.from+1],"or")?h.from+2:h.from)===m.from&&(h.to===m.to||h.to+1===m.to&&C(s[h.to],")"))}));for(let h of k){let m=l.get(h);!m||!p.has(m)||a.owner(m.at)?.name!=="__init__"||(h.forwarded=a.calls.some(i=>a.owner(i.from)===a.owner(m.at)&&s[i.from].start>h.end&&E(s[i.from],"super")&&i.callee.endsWith("__init__")&&i.args.some(f=>E(s[f.from],m.name)&&C(s[f.from+1],"=")&&f.to===f.from+3&&E(s[f.from+2],m.name))&&w.filter(f=>f.name===m.name&&m.at<f.at&&f.at<i.from&&a.owner(f.at)===a.owner(m.at)).every(f=>p.has(f))&&!s.some((f,u)=>u<i.from&&f.start>=h.end&&E(f,m.name)&&a.owner(u)===a.owner(m.at)&&![...p].some(y=>y.at<=u&&u<n.get(y).to))))}return k}function ut(e,t){if(!I(e))return[];let o=new Set(t),c=[];for(let r of[...o].sort()){let a=r.match(/^((?:[^/]+\/)*?)(?:src\/)?minisweagent\/agents\/default\.py$/);if(!a)continue;let s=r.slice(0,-18),d=`${s}/config`,w=`${d}/__init__.py`,g=`${s}/run/mini.py`;if(!o.has(w)||!o.has(g))continue;let P=[...o].filter(k=>x(k,d)!==null&&/\.ya?ml$/.test(k)).sort();P.length&&c.push({folder:a[1].replace(/\/$/,""),configFolder:d,agentPath:r,loaderPath:w,runnerPath:g,configs:P,templates:[...o].filter(k=>x(k,d)!==null&&/\.(?:j2|jinja2?)$/.test(k)).sort()})}return c}function $t(e,t){let o=z(e.agentPath,t[e.agentPath]??"","py").toks,c=z(e.loaderPath,t[e.loaderPath]??"","py").toks,r=z(e.runnerPath,t[e.runnerPath]??"","py").toks;if(!["system_template","instance_template"].every(s=>o.some((d,w)=>E(d,s)&&C(o[w-1],".")))||!c.some((s,d)=>E(s,"safe_load")&&C(c[d+1],"("))||!c.some((s,d)=>E(s,"read_text")&&C(c[d+1],"("))||!r.some((s,d)=>E(s,"get_config_from_spec")&&C(r[d+1],"("))||!r.some((s,d)=>E(s,"get_agent")&&C(r[d+1],"("))||!r.some((s,d)=>E(s,"get")&&C(r[d+1],"(")&&r[d+2]?.value==="agent"))return null;let a=r.flatMap((s,d)=>{if(!E(s,"DEFAULT_CONFIG_FILE")||!C(r[d+1],"="))return[];let w=r.slice(d+2).filter(g=>g.line===s.line);return w.flatMap((g,P)=>E(g,"builtin_config_dir")&&C(w[P+1],"/")&&w[P+2]?.kind==="string"?[ne.join(e.configFolder,w[P+2].value)]:[])});return a.length===1?a[0]:null}function vo(e,t,o,c){let r={variants:[],selectedPaths:[],fields:[],model:null,loaded:[],unresolved:[],edges:[]};if(!I(e))return r;let a=$t(t,o);if(!a)return r.unresolved.push({path:t.runnerPath,source:"config",reason:"dynamic"}),r;let s=new Map,d=new Set(Object.keys(o)),w=l=>{let n=A(e,{path:l,text:o[l],size:o[l]===void 0?void 0:Buffer.byteLength(o[l])},{purpose:"pointer",route:"github",root:t.configFolder,listing:d,managedFiles:o});return n.admitted||s.set(l,n.reason),n.admitted},g=new Map([...new Set([...t.configs,...c??[]])].flatMap(l=>w(l)&&Object.hasOwn(o,l)?[[l,ft(o[l],e)]]:[]));r.variants=t.configs.map(l=>({path:l,fields:(g.get(l)?.fields??[]).map(n=>({...n,path:l}))})),r.selectedPaths=c?[...c]:[a];let P=new Map;for(let l of r.selectedPaths){if(x(l,t.configFolder)===null){r.unresolved.push({path:l,source:l,reason:"out-of-scope"});continue}let n=g.get(l);if(!n){r.unresolved.push({path:l,source:l,reason:s.get(l)??"missing"});continue}r.unresolved.push(...n.unresolved.map(p=>({path:l,source:p.key,span:p.span,reason:p.reason})));for(let p of n.fields)if(/^(?:agent|model|environment)(?:\.|$)/.test(p.key)){for(let h of P.keys())(h.startsWith(`${p.key}.`)||p.key.startsWith(`${h}.`))&&P.delete(h);P.set(p.key,{...p,path:l})}}r.fields=[...P.values()],r.model=P.get("model.model_name")?.value??null;let k=new Set;for(let l of r.fields){let n=new Set([l.path]),p=[{path:l.path,facts:{variables:l.variables,loaders:l.loaders},next:0}];for(;p.length;){let h=p.at(-1),{path:m,facts:i}=h;if(h.next===0)for(let _ of i.variables)r.unresolved.push({path:m,source:_,reason:"runtime-variable"});if(h.next>=i.loaders.length){n.delete(m),p.pop();continue}let f=i.loaders[h.next++],u=ne.normalize(ne.join(ne.dirname(m),f.source)),y=f.reason??(ne.isAbsolute(f.source)||x(u,t.configFolder)===null?"out-of-scope":w(u)?n.has(u)?"cycle":Object.hasOwn(o,u)?null:"missing":s.get(u));if(y){r.unresolved.push({path:m,source:f.source,...f.reason?{}:{target:u},span:f.span,reason:y});continue}r.edges.push({from:m,to:u,span:f.span}),!k.has(u)&&(k.add(u),r.loaded.push({path:u}),n.add(u),p.push({path:u,facts:_e(o[u]),next:0}))}}return r}import{posix as ue}from"node:path";function ve(e){return/(?:^|\/)(?:(?:[^/]+_)?(?:crew|agents|tasks))\.py$/i.test(e)}function mt(e,t,o,c=""){let r=z(e,t,"py"),{toks:a}=r,s=ce(r,{includeMembers:!0}),d=Le(r),w=fe(r,s,{enclosingBindings:!0}),g={agents:[],tasks:[],refused:[]},P=l=>s.filter(n=>n.from<=l&&l<n.to),k=l=>{if(!E(a[l])||C(a[l-1],".")||!C(a[l+1],"("))return null;let n=w.importBinding(a[l].text,l);return n?.module.source==="crewai"&&["Agent","Task"].includes(n.name)?n.name:null};for(let l=0;l<a.length;l++){let n=k(l);if(!n)continue;let p=U(a,l+1);if(p>=a.length){g.refused.push({path:e,reason:"invalid"});continue}let h=P(l),m=h.filter(v=>v.kind==="class").at(-1),i=h.filter(v=>v.params!==null).at(-1),f=h.filter(v=>v.params===null&&v.kind!=="class"&&v.kind!=="index").at(-1),u=i?.name??f?.name??`line-${a[l].line}`,y=m?`${m.name}.${u}`:u,_=h.some(v=>v.kind==="index")||g.agents.some(v=>v.factory===y)?`${y}@${a[l].start}`:y,S=new Map(Y(a,l+1).flatMap(v=>E(a[v.from])&&C(a[v.from+1],"=")?[[a[v.from].text,{from:v.from+2,to:v.to}]]:[])),O={path:e,factory:_,span:{from:a[l].line,to:a[p].endLine},callStart:a[l].start},R=S.get("config");if(R){let v=a.slice(R.from,R.to).map(b=>b.kind==="string"?JSON.stringify(b.value):b.text).join(""),F=/^(?:self\.)?(agents_config|tasks_config)\["([^"\n]+)"\]$/.exec(v);if(F){let b=s.filter(M=>M.name===F[1]&&M.params===null&&(m?m.from<M.from&&M.to<=m.to&&!s.some(W=>W.params!==null&&W.from<M.from&&M.from<W.to):!s.some(W=>W.kind==="class"&&W.from<M.from&&M.from<W.to))),N=b.length===1?dt(r,b[0]):void 0,L=m&&It(r,m,w),D=N?xe(r,N):b.length===0&&L?`config/${F[1]==="agents_config"?"agents":"tasks"}.yaml`:null,H=null;if(D===null||/[\\\0${}*]/.test(D))g.refused.push({path:e,reason:"dynamic"});else{let M=ue.normalize(ue.join(ue.dirname(e),D));D.startsWith("/")||M===".."||M.startsWith("../")||x(M,c)===null?g.refused.push({path:M,reason:"out-of-scope"}):o.has(M)?H=M:g.refused.push({path:M,reason:"missing"})}O.config={path:H,key:F[2]}}else O.config={path:null,key:""},g.refused.push({path:e,reason:"dynamic"})}let $=Oe(r,S.get("tools"),o,s,i,m,g.refused,w);if(n==="Agent"){let v=Object.fromEntries(["role","goal","backstory"].flatMap(F=>{let b=S.get(F)&&xe(r,S.get(F));return S.has(F)&&b==null&&g.refused.push({path:e,reason:"dynamic"}),b==null?[]:[[F,b]]}));g.agents.push({...O,instructions:v,tools:$})}else{let v=L=>At(r,L,m,s,d),F=v(S.get("agent")),b=S.get("context"),N=b&&C(a[b.from],"[")&&U(a,b.from)===b.to-1?Y(a,b.from):[];b&&(!C(a[b.from],"[")||N.some(L=>!v(L)))&&g.refused.push({path:e,reason:"dynamic"}),S.has("agent")&&!F&&g.refused.push({path:e,reason:"dynamic"}),g.tasks.push({...O,agent:F,context:N.flatMap(L=>v(L)??[]),tools:$})}l=p}return g}function dt(e,t){let o=t.from+1;for(;o<t.to&&!C(e.toks[o],"=");)o++;return o<t.to?{from:o+1,to:t.to}:void 0}function xe(e,t){let{toks:o}=e;return t.to===t.from+1&&o[t.from]?.kind==="string"&&Ae(o[t.from]).closed?o[t.from].value:E(o[t.from],"dedent")&&C(o[t.from+1],"(")&&U(o,t.from+1)===t.to-1?xe(e,{from:t.from+2,to:t.to-1}):null}function At(e,t,o,c,r){if(!t)return null;let a=e.toks.slice(t.from,t.to).map(d=>d.text).join(""),s=/^(self\.)?([A-Za-z_]\w*)(?:\(\))?$/.exec(a);if(s&&!s[1]){let d=c.filter(g=>g.params!==null&&g.from<t.from&&t.from<g.to),w=g=>c.filter(P=>P.params!==null&&P.from<g&&g<P.to).at(-1);if(d.some(g=>g.params?.includes(s[2]))||c.some(g=>g.name===s[2]&&d.includes(w(g.from)))||r.some(g=>g.names.includes(s[2])&&d.includes(w(e.toks.findIndex(P=>P.line===g.line)))))return null}return s?s[1]&&o?`${o.name}.${s[2]}`:s[2]:null}function Oe(e,t,o,c,r,a,s,d,w=new Set){if(!t)return[];let{toks:g}=e;if(C(g[t.from],"[")&&U(g,t.from)===t.to-1)return Y(g,t.from).flatMap(u=>Oe(e,u,o,c,r,a,s,d,new Set(w)));let P=g[t.from];if(!E(P)||w.has(P.text))return s.push({path:e.path,reason:"dynamic"}),[];if(w.add(P.text),r?.params?.includes(P.text))return s.push({path:e.path,reason:"dynamic"}),[];let l=c.filter(u=>u.name===P.text&&u.params===null&&u.kind!=="class"&&u.from<t.from).filter(u=>{let y=c.filter(_=>(_.params!==null||_.kind==="class")&&_.from<u.from&&u.from<_.to).at(-1);return!y||y===r||!r&&y===a}),n=r&&l.filter(u=>r.from<u.from&&u.to<=r.to),p=n&&n.length?n:l;if(p.length===1){let u=dt(e,p[0]);if(u)return Oe(e,u,o,c,r,a,s,d,w)}if(p.length>1)return s.push({path:e.path,reason:"dynamic"}),[];let h=d.importBinding(P.text,t.from),m=h?.module,i=null;if(m){let u=ue.dirname(e.path).split("/"),y=u.lastIndexOf(m.source.split(".")[0]),_=m.source.startsWith(".")?m.source:y<0?`.${m.source}`:".".repeat(u.length-y)+m.source.split(".").slice(1).join(".");i=rt(e.path,_,[h.name],"py",o)??null,!i&&(m.source.startsWith(".")||y>=0)&&s.push({path:e.path,reason:"missing"})}else if(!c.some(u=>u.name===P.text&&(u.kind==="class"||u.params!==null)))return s.push({path:e.path,reason:"dynamic"}),[];let f=t.from+1;for(;C(g[f],".")&&E(g[f+1]);)f+=2;return f<t.to&&(!C(g[f],"(")||U(g,f)!==t.to-1)?(s.push({path:e.path,reason:"dynamic"}),[]):[{name:g.slice(t.from,f).map(u=>u.text).join(""),path:m?i:e.path}]}function It(e,t,o){let c=e.text.slice(0,e.toks[t.from].start).trimEnd().split(`
|
|
7
|
+
`);for(let r=c.length-1;r>=0;r--){let a=/^\s*@([A-Za-z_]\w*)(?:\(\))?\s*$/.exec(c[r]);if(!a)break;let s=o.importBinding(a[1],t.from);if(s?.module.source==="crewai.project"&&s.name==="CrewBase")return!0}return!1}var Lt=new Set([...Xe,le.soul].map(e=>e.toLowerCase())),Nt=["templates","default_prompts","prompts/default","docs","evals","benchmarks"],Dt=["tests","__tests__","fixtures","test_data","evals","benchmarks","templates","default_prompts","prompts/default","docs"];function ht(e,t=""){return e===t?null:`folder:${e}`}function Ho(e,t,o){let c=gt(e,t,o),r=T(o),a=t.filter(n=>!B(e,n,r)),s=a.filter(n=>c.ownerOf(n)?.key===null),d=q(e,s,r),w=te(d)||!!d.configPath,g=V(e,s,{root:r}).files.filter(n=>n.role!=="reference"&&n.kind!=="background"),P=new Set(g.map(n=>n.relativePath)),k=g.flatMap(n=>n.role==="sub-agent"?[n.relativePath.slice(0,-3)]:n.role==="skill"?[n.relativePath.slice(0,n.relativePath.lastIndexOf("/"))]:[]),l=new Map(c.scopes.map(n=>[n.folder,{scope:n,paths:[]}]));for(let n of[...new Set(a)]){let p=c.ownerOf(n);if(!p)continue;let h=x(n,r),m=h.split("/");if(p.key===null&&w&&m.length>1&&!P.has(h)&&!k.some(i=>x(h,i)!==null)){let i=m.slice(0,-1).findIndex((u,y)=>![...P].some(_=>_.startsWith(`${m.slice(0,y+1).join("/")}/`))),f=Z(m.slice(0,i<0?-1:i+1).join("/"),r);l.has(f)||l.set(f,{scope:{key:ht(f,r),folder:f,kind:"folder"},paths:[]}),p=l.get(f).scope}l.get(p.folder).paths.push(n)}return[...l.values()].sort((n,p)=>n.scope.folder<p.scope.folder?-1:n.scope.folder>p.scope.folder?1:0).map(({scope:n,paths:p})=>{let h=q(e,p,n.folder),m=c.scopes.includes(n);return{scope:n,paths:p,convention:m&&(!!n.managed||!!n.miniSwe||n.kind==="crew"&&!n.agentsPath.endsWith(".py")||lt(e,h)),markerPath:m?h.configPath:null}})}function gt(e,t,o,c={},r){let a=T(o);r??=G(e)?oe(e,t,o):void 0;let s=K(e),d=Be(e,t,c),{scopes:w,skipped:g,pluginFolders:P}=s?jt(e,t,a,d,r):{scopes:[{key:null,folder:a,kind:"root"}],skipped:[],pluginFolders:[]},k=m=>wt(w,m),l=new Set(t),n=t.filter(m=>B(e,m,a)||k(m)&&(s&&ie(e,m,P)||Te(e,m,{root:a,listing:l}))),p=new Set(I(e)?Object.entries(c).filter(([m])=>m.endsWith(".py")&&k(m)).flatMap(([m,i])=>mt(m,i,new Set(t),a).agents.flatMap(f=>f.tools.flatMap(u=>u.path??[]))):[]),h=s?t.filter(m=>{let i=k(m);return!p.has(m)&&i?.kind==="crew"&&x(m,i.folder)?.toLowerCase().startsWith("tools/")}):[];return{scopes:w,skipped:g,ownerOf:k,pluginFolders:P,ignoredPaths:n,ignoredImportPaths:h,...d.length?{pluginDeclarations:d.filter(m=>P.includes(m.folder))}:{}}}function wt(e,t){return e.findLast(o=>x(t,o.folder)!==null)??null}function jt(e,t,o,c,r){let a=[...new Set(t)].filter(l=>!ie(e,l)).sort().flatMap(l=>{let n=x(l,o);return n===null?[]:[{path:l,relativePath:n}]}),s=[],d=new Map,w=a.filter(l=>!B(e,l.path,o)).map(l=>l.path);for(let l of Ke(e,w))d.set(l.folder,l.agents.map(n=>({path:n,plugin:!1,crew:!1,checkPath:`${l.folder}/`,managed:l})));for(let l of ut(e,w))d.set(l.folder,[...d.get(l.folder)??[],{path:l.agentPath,plugin:!1,crew:!1,checkPath:`${l.folder}/`,miniSwe:l}]);for(let{path:l,relativePath:n}of a){let p=n.split("/"),h=p.pop().toLowerCase(),m=Z(p.join("/"),o),i=p.length>0&&(Lt.has(h)||Q.includes(h)&&X(e,t,{root:m,agentConfigurations:r})),f=Ze(e,l,c);f===o&&!B(e,l,o)&&!s.includes(o)&&s.push(o);let u=f!==null&&f!==o&&!!x(`${f}/`,o),y=n.toLowerCase()==="config/agents.yaml"||n.toLowerCase().endsWith("/config/agents.yaml"),_=I(e)&&ve(l)&&!/(?:^|\/)(?:tasks|[^/]+_tasks)\.py$/i.test(l),S=y||_;if(!i&&!u&&!S)continue;let O=y?l.slice(0,-18).replace(/\/$/,""):_?l.slice(0,Math.max(0,l.lastIndexOf("/"))):u?f:Z(p.join("/"),o),R=d.get(O)??[];R.push({path:l,plugin:u,crew:S,checkPath:u?`${O}/`:l}),d.set(O,R)}let g=Ue(e),P={settings:e,folder:o,scoped:a,candidates:d,rootPlugins:s,excludedFolders:g?Nt:Dt},k=pt(P,new Set);if(g){let l=[...new Set(k.accepted.map(i=>i.folder))].filter(i=>i!==o),n=a.filter(i=>!B(e,i.path,o)&&!l.some(f=>x(i.path,f)!==null)).map(i=>i.path),p=V(e,n,{root:o,folderAgentsFound:l.length>0,agentConfiguration:X(e,t,{root:o,agentConfigurations:r})}),h=Pt(e,p,l.length>0)?[{path:`${o}/`,checkPath:`${o}/`}]:[],m=ze([...k.accepted,...h],i=>i.checkPath,{root:o,listing:new Set(a.map(i=>i.path)),settings:e});if(k.accepted.some(i=>m(i.checkPath))){let i=new Set([...d.values()].flat().filter(f=>m(f.checkPath)).map(f=>f.path));k=pt(P,i)}}return k.skipped.sort((l,n)=>l.path<n.path?-1:l.path>n.path?1:0),{scopes:k.scopes,skipped:k.skipped,pluginFolders:k.pluginFolders}}function pt({settings:e,folder:t,scoped:o,candidates:c,rootPlugins:r,excludedFolders:a},s){let d=[{key:null,folder:t,kind:"root"}],w=[],g=[...r],P=[],k=new Map;for(let l of[...c.keys()].sort()){let n=c.get(l),p=wt(d,n[0].path),h=k.get(p.folder)??Tt(o.map(S=>S.path),p.folder);k.set(p.folder,h);let m=[];for(let S of n){let{path:O,checkPath:R}=S;if(ie(e,O,g))continue;let $=B(e,O,t)?"excluded-folder":l===t?null:s.has(O)?"excluded-folder":zt(x(R,t),x(R,p.folder),h,je(e,O,t)?[]:a);$?w.push({path:O,reason:$}):(m.push(S),P.push({path:O,folder:l,checkPath:R}))}if(!m.length)continue;let i=(I(e)?m.find(S=>S.crew&&S.path.endsWith("config/agents.yaml")):void 0)??m.find(S=>S.crew),f=ht(l,t),u=i?{key:f,folder:l,kind:"crew",agentsPath:i.path,tasksPath:o.find(S=>x(S.path,l)?.toLowerCase()==="config/tasks.yaml")?.path??null}:{key:f,folder:l,kind:"folder"},y=m.find(S=>S.managed)?.managed;y&&(u.managed=y);let _=m.find(S=>S.miniSwe)?.miniSwe;_&&(u.miniSwe=_),l===t?d[0]=u:d.push(u),m.some(S=>S.plugin)&&!g.includes(l)&&g.push(l)}return{scopes:d,skipped:w,pluginFolders:g,accepted:P}}function se(e,t,o,c={}){let r=c.agentConfigurations??(G(e)?oe(e,c.listedPaths??t,o):void 0),a=gt(e,t,o,c.files,r),{scopes:s,ownerOf:d,ignoredPaths:w}=a,g=new Set(w),P=new Map(s.map(i=>[i,[]]));for(let i of t){if(g.has(i))continue;let f=d(i);f&&P.get(f).push(i)}let k=s.map(i=>V(e,P.get(i),{root:i.folder,mode:c.mode,agentConfiguration:X(e,c.listedPaths??t,{root:i.folder,agentConfigurations:r}),folderAgentsFound:i.key===null&&(s.length>1||i.kind==="crew")})),l=(i,f)=>Pt(e,i,s[f].key===null&&(s.length>1||s[f].kind==="crew")),n=s.length===1?k:k.filter((i,f)=>s[f].managed||s[f].miniSwe||s[f].kind==="crew"||l(i,f)),p=!n.length||n.some(i=>{let f=k.indexOf(i);return s[f].managed||s[f].miniSwe?!1:s[f].kind==="crew"&&!l(i,f)?s[f].agentsPath.endsWith(".py"):!i.registry&&(!i.files.some(u=>u.role==="prompt")||!i.files.some(u=>u.role==="tool file"))}),h=new Set((a.pluginDeclarations??[]).map(i=>i.path));for(let i of ae(e,t))/marketplace\.json$/i.test(i)&&h.add(i);let m=k.flatMap((i,f)=>{let u=s[f],y=[...h].filter(S=>!g.has(S)&&d(S)===u).map(S=>({path:S,relativePath:x(S,u.folder),role:"marker",kind:"entry"}));if(u.miniSwe)return[...i.files,...y,...[...u.miniSwe.configs,...u.miniSwe.templates,u.miniSwe.agentPath,u.miniSwe.loaderPath,u.miniSwe.runnerPath].map(S=>({path:S,relativePath:x(S,u.folder),role:"knowledge",kind:"entry"}))];if(u.managed)return[...[...u.managed.agents,...u.managed.configs].flatMap(S=>{let O=J(x(S,u.folder))?.definition;if(O&&(c.mode==="core"||!ot(e)))return[];let R=u.managed.agents.includes(S);return[{path:S,relativePath:x(S,u.folder),role:R?"prompt":O?"skill":"knowledge",kind:R?"entry":O?"skill":"json"}]}),...y];if(u.kind!=="crew")return[...i.files,...y];let _=[{path:u.agentsPath,relativePath:x(u.agentsPath,u.folder),role:"prompt",kind:"entry"}];if(I(e))for(let S of P.get(u)){let O=x(S,u.folder);S!==u.agentsPath&&(ve(O)&&!O.includes("/")||/^config\/[^/]+\.ya?ml$/i.test(O))&&_.push({path:S,relativePath:O,role:"knowledge",kind:"entry"})}return u.tasksPath&&_.push({path:u.tasksPath,relativePath:x(u.tasksPath,u.folder),role:"knowledge",kind:"entry"}),[...i.files,..._,...y]});return{...a,files:m,needsExtraction:p}}function Pt(e,t,o){let c=be(t,e),r=Fe({codeAgentsFound:!1,folderAgentsFound:o,otherDefinitions:te(c),agentConfiguration:t.files.some(a=>a.role==="prompt"&&a.kind==="fallback")},e);return ct(c,r)}function Tt(e,t){let o=new Set;for(let c of e){let r=x(c,t);r!==null&&ee.test(r)&&o.add(r.slice(0,-3).toLowerCase())}return o}function zt(e,t,o,c){let r=e.toLowerCase();if(c.some(d=>`/${r}`.includes(`/${d}/`)))return"excluded-folder";let a=r.slice(0,r.lastIndexOf("/"));if(J(e,{nested:!0})||tt.some(d=>a===d||a.endsWith(`/${d}`)))return"skill-folder";if(`/${r}`.includes(`/${Qe}/${et}/`)||ee.test(t))return"sub-agent-folder";let s=t.toLowerCase().split("/");return s.some((d,w)=>o.has(s.slice(0,w).join("/")))?"sub-agent-folder":null}var kt="Some of this agent's files weren't read, so findings may be missing.";var St=e=>e.CF_READING_PRIORITY!=="0";var Ut=new Set(["system prompt","soul","knowledge","config","tools","mcp"]);function yt(e){let t=new Set;for(let c of e.nodes)for(let r of c.files??[])Ut.has(r.role)&&t.add(r.path);let o=new Set(e.edges.filter(c=>c.kind==="delegates").map(c=>c.to));for(let c of e.nodes)o.has(c.id)&&c.sourceRef&&t.add(c.sourceRef.path);return t}function nn(e){return new Set([...e.nodes,...e.edges].flatMap(t=>t.sourceRef?[t.sourceRef.path]:[]))}var me=6e4,Wt=e=>{if(e.length<=me)return e;let t=e.endsWith(ge)?ge:"";return(t?e.slice(0,-t.length):e).slice(0,me)+t};function sn(e,t){let o=[...e].filter(c=>t[c]!==void 0&&Wt(t[c])!==t[c]).sort();return o.length===0?null:`${o.length} core file${o.length===1?" was":"s were"} longer than ${me/1e3} KB, so only the first ${me/1e3} KB ${o.length===1?"was":"were"} read: ${o.join(", ")}`}var Ee=e=>e.split("/").slice(0,-1).join("/"),Gt=/(agent|prompt|tool|llm|model)/i,Bt=2.5;function Re(e,t){if(!St(e))return{enabled:!1,tierOf:()=>6};if(t.repos?.some(n=>n.kind==="github"&&T(n.root)))return Zt(e,t,t.repos);let o=t.scopes??(K(e)?se(e,t.paths,void 0,{agentConfigurations:{}}):void 0),c=t.graph?yt(t.graph):new Set,r=new Set(t.graph?.nodes.flatMap(n=>(n.files??[]).filter(p=>p.role==="code"&&j(p.path)).map(p=>p.path))??[]),a=new Set(t.graph?.nodes.flatMap(n=>(n.files??[]).filter(p=>p.role==="system prompt").map(p=>p.path))??[]),s=n=>re(n)&&(He.includes(n.split("/").pop().toLowerCase())||/(^|\/)system_prompt_[^/]+\.md$/i.test(n)||st.test(n)),d=n=>{if(c.has(n))return 1;if(r.has(n))return 2;let p=ke(e,n,o),h=J(p,{nested:!0});if(h?.reference)return 5;if(h?.definition||ee.test(p))return 4;if(h||/(^|\/)(docs?|references)\//i.test(p)||nt.test(n.split("/").pop()))return 5;if(Pe(p)||Se(e,n,o)&&Pe(n.split("/").pop())||s(n))return 1;if(j(n)){if(Gt.test(n))return Bt;if(ye.test(n))return 3}return 6};for(let n of t.paths)d(n)===1&&s(n)&&a.add(n);let w=[...a].flatMap(n=>{let p=Ee(n);return[p,...p?[Ee(p)]:[]]}),g=n=>j(n)&&w.some(p=>Ee(n)===p),P=new Map(t.paths.map(n=>{let p=d(n);return[n,p>2&&g(n)?2:p]})),k=[...P].filter(([n,p])=>p<=2&&j(n)).map(([n])=>n),l=at(Object.fromEntries(k.flatMap(n=>t.files?.[n]===void 0?[]:[[n,t.files[n]]])),t.paths);for(let n of l)j(n)&&!J(ke(e,n,o),{nested:!0})&&(P.get(n)??6)>2&&P.set(n,2);return{enabled:!0,tierOf:n=>P.get(n)??d(n)}}function Zt(e,t,o){let c=new Map;for(let r of o){let a=r.kind==="github"?r.root:void 0,s=t.paths.filter(n=>r.files?.[n]!==void 0&&!c.has(n)),d=n=>x(n,a)??(r.files?.[n]!==void 0?n:null),w=n=>{let p=n?d(n.path):null;return p===null?null:{path:p}},g=t.graph&&{nodes:t.graph.nodes.map(n=>({...n,sourceRef:w(n.sourceRef),files:n.files?.flatMap(p=>{let h=d(p.path);return h===null?[]:[{...p,path:h}]})})),edges:t.graph.edges.map(n=>({...n,sourceRef:w(n.sourceRef)}))},P=s.flatMap(n=>{let p=d(n);return p===null?[]:[p]}),k=Object.fromEntries(s.flatMap(n=>{let p=d(n);return p===null||t.files?.[n]===void 0?[]:[[p,t.files[n]]]})),l=Re(e,{paths:P,files:k,graph:g});for(let n of s)c.set(n,l.tierOf(d(n)??n))}return{enabled:!0,tierOf:r=>c.get(r)??6}}function Kt(e,t){return e.enabled?t.filter(o=>["too-large","total","allowance"].includes(o.reason)&&e.tierOf(o.path)<3).map(o=>o.path):[]}function Yt(e){return e.slice(0,3)}function Jt(e,t=!1){let o=Yt(e);if(!o.length)return;let c=t?". "+kt:", so some findings may be missing";return`${o.join(", ")} ${o.length===1?"was":"were"} left out${c}`}function wn(e,t){return Jt(Kt(e,t))}function Pn(e,t){return e.enabled&&e.tierOf(t)<3}function bt(e,t,o){let c=De.sourceFetch.codeFileBytes;return e.enabled&&e.tierOf(t)<3&&j(t)&&o>c?{size:c,readBytes:c}:{size:o}}function _t(e,t){return e.enabled&&e.tierOf(t)<3&&j(t)}function Ce(e){return e.split("/").length-1}function xt(e,t,o){return Se(e,t,o)?0:ye.test(t)?1+Math.min(Ce(t),3)/10:Ce(t)<=2?2:Ce(t)<=4?3:4}function kn(e,t){return(e.tier??0)-(t.tier??0)||e.score-t.score||e.size-t.size}function Sn(e,t,o,c){return[...e].sort((r,a)=>(c?.enabled?c.tierOf(r)-c.tierOf(a):0)||Number(o.has(a))-Number(o.has(r))||t[r].length-t[a].length||(r<a?-1:1))}function yn(e,t,o,c){return[...e].sort((r,a)=>(c?.enabled?c.tierOf(r.path)-c.tierOf(a.path):0)||Number(t.has(a.path))-Number(t.has(r.path))||Number(o.has(a.path))-Number(o.has(r.path))||r.text.length-a.text.length)}function $n(e,t,o={},c={}){let{root:r}=o,a=t.map(i=>i.path),s=G(e)?oe(e,a,r):void 0,d=t.filter(i=>{let f=A(e,i,{...o,purpose:"source",route:"github"});return f.admitted||f.reason==="wrong-type"||f.reason==="too-large"}),w=K(e)?se(e,d.map(i=>i.path),r,{files:c.files,listedPaths:a,agentConfigurations:s}):void 0,g=new Set([...w?.pluginDeclarations?.map(i=>i.path)??[],...ae(e,w?.files.map(i=>i.path)??[])]),P=w??(c.measureAnalysisSize?se(e,d.map(i=>i.path),r,{listedPaths:a,agentConfigurations:s}):void 0),k=new Map(P?.files.map(i=>[i.path,i])),l=c.measureAnalysisSize?new Map(t.map(i=>[i.path,i.size])):void 0,n=w?{files:w.files.map(i=>({...i,path:x(i.path,r)})),ownerOf:i=>{let f=w.ownerOf(Z(i,r));return f?{...f,folder:f.key===null?"":x(f.folder,r)}:null}}:void 0,p=new Set(w?.ignoredPaths),h=Re(e,{paths:d.map(i=>x(i.path,r)),scopes:n});return{descriptions:t.flatMap(i=>{if(p.has(i.path))return[];let f=x(i.path,r),u=f===null?{size:i.size}:bt(h,f,i.size),y=A(e,{...i,size:u.size},{...o,purpose:"source",route:"github",scopes:n}),_=f===null?99:xt(e,f,n),S=f!==null&&!g.has(i.path)&&!_t(h,f)&&(re(i.path)||Je(e,f,n)||_===0)?"instruction":"code",O={};if(c.measureAnalysisSize){let R=y.admitted||y.reason==="too-large",$=A(e,i,{...o,purpose:"code-scan",route:"github",listing:l}),v=k.get(i.path),F=v&&(y.admitted||["too-large","wrong-type","empty"].includes(y.reason))&&A(e,{path:i.path},{...o,purpose:Ye(v.role),route:"github"}).admitted;O.countsTowardAnalysisSize=R||$.admitted||$.reason==="too-large"||!!F,O.analysisPool=v?.role==="skill"||v?.role==="reference"?"instruction":S}return[{entry:i,readEntry:{...i,...u},rel:f,score:_,pool:S,...O,admission:y,...h.enabled&&f!==null?{tier:h.tierOf(f)}:{}}]}),priority:h,declarations:g,discovery:P}}export{q as a,it as b,te as c,lt as d,ct as e,oe as f,co as g,ft as h,Po as i,vo as j,mt as k,Ho as l,gt as m,se as n,St as o,yt as p,nn as q,Wt as r,sn as s,Re as t,Kt as u,Yt as v,Jt as w,wn as x,Pn as y,kn as z,Sn as A,yn as B,$n as C};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as p,d}from"./RUVMFAST.js";import{a as s,b as l,c as a}from"./S27VIQMZ.js";import{z as t}from"zod";var o={files:1e4,edges:2e4,choices:32,scopeImports:200},m=t.array(s).max(o.files).refine(e=>new Set(e).size===e.length),y=t.union([t.literal("all"),t.literal("none"),m.max(o.scopeImports)]),h=t.strictObject({snapshot:l,entry:s,imports:y}).refine(e=>!Array.isArray(e.imports)||!e.imports.includes(e.entry)),k=t.discriminatedUnion("kind",[t.strictObject({kind:t.literal("file"),launchRoot:a,entry:s,scope:h.optional()}),t.strictObject({kind:t.literal("folder"),launchRoot:a,folder:t.union([t.literal("."),s])})]).refine(e=>e.kind!=="file"||!e.scope||e.entry===e.scope.entry),S=t.strictObject({path:s,role:t.enum(["entry","imported-helper"]),hash:t.string().regex(/^[a-f\d]{64}$/),size:t.number().int().min(0).max(Number.MAX_SAFE_INTEGER)}),u=t.strictObject({complete:t.boolean(),frontierCount:t.number().int().min(0).max(Number.MAX_SAFE_INTEGER)}).refine(e=>!e.complete||e.frontierCount===0),g=t.strictObject({id:l,scope:h,includes:m.min(1),omitted:m}).refine(e=>{if(!e.includes.includes(e.scope.entry)||e.omitted.some(n=>e.includes.includes(n)))return!1;let r=e.scope.imports;if(r==="all")return!0;let i=[e.scope.entry,...r==="none"?[]:r];return i.length===e.includes.length&&i.every(n=>e.includes.includes(n))}),f={schemaVersion:t.literal(1),launchRoot:a,snapshot:l,resolverVersion:l,files:t.array(S).min(1).max(o.files).refine(e=>new Set(e.map(r=>r.path)).size===e.length),edges:t.array(p).max(o.edges),refusedEdges:t.array(d).max(o.edges),completeness:u,choices:t.array(g).max(o.choices)},E=t.discriminatedUnion("kind",[t.strictObject({...f,kind:t.literal("file"),entry:s}),t.strictObject({...f,kind:t.literal("folder"),folder:t.union([t.literal("."),s])})]).refine(e=>{if(e.completeness.complete&&e.refusedEdges.some(n=>n.reason!=="external"))return!1;let r=e.files.filter(n=>n.role==="entry").map(n=>n.path);if(r.length===0||e.kind==="file"&&(r.length!==1||r[0]!==e.entry)||new Set(e.choices.map(n=>n.id)).size!==e.choices.length)return!1;let i=new Set(e.files.map(n=>n.path));return e.choices.every(n=>n.scope.snapshot===e.snapshot&&r.includes(n.scope.entry)&&(e.kind!=="file"||n.scope.entry===e.entry)&&(e.kind!=="file"||n.scope.imports!=="all"||n.omitted.length===0)&&n.includes.every(c=>i.has(c))&&n.omitted.every(c=>i.has(c))&&n.includes.length+n.omitted.length===i.size)});export{o as a,h as b,k as c,S as d,u as e,g as f,E as g};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{pa as t,ra as o,va as a,xa as p}from"./IHAVDX4L.js";function m(e,l,n={}){let r=t(e,l,n.structureState);return[...r.calls,...o(e,r.findings),...p(e,l,n),...a(e)]}function C(e,l){let n=Object.entries(l.files).map(([f,i])=>({path:f,size:Buffer.byteLength(i)})),r=m(e,n,{structureState:{repos:[{key:l.repoKey,kind:"fs",files:l.files,...l.root===void 0?{}:{root:l.root}}],mapped:[l.fragment]}});return{files:n,calls:r}}export{m as a,C as b};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as t}from"./S27VIQMZ.js";import{z as e}from"zod";var o=e.enum(["relative","alias","workspace"]),r=e.enum(["external","missing","ambiguous","unsupported","dynamic","invalid-config","out-of-scope","symlink-escape","hidden","secret","secret-content","excluded","unreadable","over-limit","not-selected"]),s={from:t,specifier:e.string().min(1).max(4096)},n=e.strictObject({...s,status:e.literal("resolved"),path:t,provenance:o}),a=e.strictObject({...s,status:e.literal("refused"),provenance:o.nullable(),reason:r}),m=e.discriminatedUnion("status",[n,a]);export{o as a,r as b,n as c,a as d,m as e};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{z as s}from"zod";var p=s.string().min(1).max(4096).regex(/^(?![A-Za-z]:)[^\\\p{C}\p{Zl}\p{Zp}]+$/u).refine(e=>e.split("/").every(t=>t!==""&&t!=="."&&t!=="..")),r=s.string().min(1).max(256).regex(/^[^\p{C}\p{Zl}\p{Zp}]+$/u),i=s.string().min(1).max(4096).regex(/^[^\p{C}\p{Zl}\p{Zp}]+$/u).refine(e=>e.startsWith("/")||e.startsWith("\\\\")||/^[A-Za-z]:[/\\]/.test(e));export{p as a,r as b,i as c};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as p,b as m}from"./6U2IR4XB.js";import{a as u}from"./MJGB25S5.js";import{j as c,k as d}from"./
|
|
1
|
+
import{a as p,b as m}from"./6U2IR4XB.js";import{a as u}from"./MJGB25S5.js";import{j as c,k as d}from"./WYLIV2P2.js";import{z as n}from"zod";var l=n.lazy(()=>n.union([n.string(),n.number(),n.boolean(),n.null(),n.array(l),n.record(n.string(),l)])),g=n.object({data:n.record(n.string(),l),settings:d,maxInputBytes:n.number().int().positive().optional()}).strict(),h=n.string().min(1).max(128).regex(/^[a-zA-Z0-9][a-zA-Z0-9._:-]*$/),w=n.object({maxTokens:n.number().int().positive().optional(),effort:n.enum(["low","medium","high","max"]).optional(),thinking:n.literal("disabled").optional(),promptCache:n.boolean().optional()}).strict(),b=n.object({template:n.string().min(1),inputs:g,answerFormat:n.string().min(1),model:h,limits:w.optional()}).strict();function A(e,i={},r){let o={data:e.inputs,settings:c(i),...r===void 0?{}:{maxInputBytes:r}};return b.parse({...e,answerFormat:Object.hasOwn(s,e.template)?x(e.template,e.answerFormat,i):e.answerFormat,limits:{...e.limits,promptCache:u(i,{template:e.template},e.model).enabled},inputs:JSON.parse(JSON.stringify(o))})}var t=(e,...i)=>Object.freeze({role:e,answerFormats:Object.freeze(i)}),a=m().map(e=>e.name),s=Object.freeze({"derive-findings":t("required",...a),"derive-findings-legacy":t("required",...a),"derive-findings-no-outcome":t("required",...a),"derive-findings-legacy-no-outcome":t("required",...a),"benchmark-judge":t("required","judge"),"judge-code-prompt":t("optional","codeJudge"),"derive-structure":t("optional","structures"),"structure-recheck":t("optional","recheck"),"derive-shape":t("optional","shape"),"scope-items":t("optional","structureScope"),"scope-findings":t("optional","scope"),"check-findings":t("optional","check"),"check-findings-precision-v1":t("optional","check"),"second-opinion":t("optional","opinion"),"explain-sources":t("optional","sourceNotes"),"finding-headlines":t("optional","findingHeadlines")});function S(){return s}function z(e,i,r){let o=r??(e==="derive"?"derive-findings":"check-findings");if(!Object.keys(s).filter(f=>s[f].answerFormats.includes(e==="derive"?"findings":"check")).includes(o))throw new Error("Unknown analysis template");return e==="derive"&&!p(i).switches.expectedOutcome&&!o.endsWith("-no-outcome")?`${o}-no-outcome`:o}function x(e,i,r){let o=i==="findings"?p(r).name:i;if(!Object.hasOwn(s,e)||!s[e].answerFormats.includes(o))throw new Error("Unsupported template answer format");return o}function N(e,i,r){if(r(i),!Object.hasOwn(s,e)||s[e].role!=="optional")throw i}export{g as a,h as b,w as c,b as d,A as e,S as f,z as g,x as h,N as i};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as p}from"./E7TFIHC5.js";import{
|
|
1
|
+
import{a as p}from"./E7TFIHC5.js";import{e as a}from"./K5FUABWW.js";import{createHash as f}from"node:crypto";function c(e){function r(t){if(!("includes"in e)||!Object.hasOwn(e.includes,t))throw new Error(`Unknown template: ${t}`);return e.includes[t]}function s(t){return"templateText"in e?Buffer.byteLength(e.templateText(t)):r(t).expandedSize}function i(t,n={}){return{name:t,hash:"templateText"in e?f("sha256").update(p(e.templateText(t),{promptAgreement:a(n)})).digest("hex"):r(t).expandedFingerprint}}function m(t,n={}){for(let o of t)if(i(o.name,n).hash!==o.hash)throw new Error("Counterfact's instructions changed since this analysis started. Start a new analysis.")}return{templateBytes:s,promptVersion:i,assertPromptVersions:m}}export{c as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{z as s}from"zod";import{z as t}from"zod";var n=t.string(),l=n.nullable(),R=t.number().int().nonnegative().safe(),F=t.number().int().positive().safe(),z=t.enum(["ordering","reliability","coverage","cost","safety","correctness"]),H=t.enum(["low","medium","high","critical"]),V={headline:n.optional(),ifLeft:n.optional()},_e=t.strictObject({path:n,line:F.nullable()}),G=t.strictObject({nodes:t.array(t.strictObject({id:n,change:n,label:l})),edges:t.array(t.strictObject({from:n,to:n,kind:n,change:n,detail:l}))}),Oe=t.strictObject({sites:t.array(t.strictObject({index:R,role:t.enum(["Says","But also says","Unclear","Context","Requirement","What actually happens","Why it's a gap","Evidence"]),meaning:n,keyPhrase:n})),support:t.enum(["supported","partly","not_supported"]),supportNote:n,counterEvidence:t.array(t.strictObject({repo:n,path:n,line:F,excerpt:n,meaning:n}))}),S=t.strictObject({kind:z,severity:H,title:n,cause:n,summary:l,category:l,question:l,audience:t.enum(["users","team"]).optional(),siteRepo:l,site:_e.nullable(),excerpt:l,otherSites:t.array(t.strictObject({repo:n,path:n,line:F,excerpt:n})),fixes:t.array(t.strictObject({title:n,approach:n,kind:t.enum(["code","prompt"]),targetFiles:t.array(t.strictObject({path:n,create:t.boolean().nullable()})),expectedOutcome:n,summary:l,impact:l,confidence:l,objective:l,status:l,blockedBy:l,alsoFixes:t.array(n).nullable(),delta:G.nullable()})),sourceNotes:Oe.nullable().optional(),...V}),Y=t.strictObject({path:n.optional(),startLine:F,endLine:F}),N=t.number(),X=t.strictObject({subKind:t.enum(["split_monolith","single_source","fold_patches","extract_subagent","merge_subagents","move_rule","move_tool","reorder"]),kind:z,severity:H,title:n,cause:n,summary:n.optional(),evidence:t.array(t.strictObject({path:n,line:F,excerpt:n})),files:t.array(t.strictObject({path:n,action:t.enum(["create","shrink","edit","delete"]),role:t.enum(["system prompt","soul","knowledge","skill","config","tools","mcp","template","reference","log","code"]),unit:n,loadMode:t.enum(["always","on_demand","never"]),loadVia:l,purpose:n,frontmatter:t.strictObject({name:n,description:n,tools:t.array(n)}).nullable()})),segments:t.array(t.strictObject({path:n,startLine:N,endLine:N,to:n,disposition:t.enum(["move","fold_into","remove_duplicate","remove_superseded"]),into:t.strictObject({path:n,line:N}).nullable(),childRef:l,heading:l,reason:n})),additions:t.array(t.strictObject({path:n,text:n,kind:t.enum(["pointer","handoff","reference_update"]),heading:l})),reorder:t.strictObject({path:n,startLine:N,endLine:N,steps:t.array(t.strictObject({from:F,reason:l}))}).nullable(),toolMoves:t.array(t.strictObject({tool:n,fromUnit:n,toUnit:n,reason:n,fromPath:l,toPath:l})),motivation:t.array(t.strictObject({kind:n,reason:n,evidence:n})).optional(),outcomes:t.array(t.strictObject({improvement:n,measurement:n})).optional(),split:t.strictObject({root:n.optional(),frontDoor:t.strictObject({name:n.optional(),job:n,skills:t.array(n)}),subAgents:t.array(t.strictObject({name:n,job:n,description:n,path:n,handoff:n.optional(),resolves:t.array(n).optional(),skills:t.array(t.strictObject({name:n,from:n,to:n})),tools:t.array(n),noTools:t.boolean().optional(),movedKnowledge:t.array(Y),neededKnowledge:t.array(Y)}))}).optional()}),Ce=t.strictObject({nodes:t.array(G.shape.nodes.element.extend({change:t.enum(["added","edited","removed"]),label:l.optional()})),edges:t.array(G.shape.edges.element.extend({kind:t.enum(["invokes","delegates","reads","writes","emits"]),change:t.enum(["added","edited","removed"]),detail:l.optional()})),files:t.array(t.strictObject({path:n,role:X.shape.files.element.shape.role,node:n,change:t.enum(["added","removed","moved","shrunk","grown","reordered"]),fromNode:n.optional(),fromPath:n.optional(),segments:R})),tools:t.array(t.strictObject({label:n,fromNode:n,toNode:n}))}),L=t.strictObject({repo:n,children:t.array(t.strictObject({ref:n,how:n})),sourceHashes:t.record(n,n),body:X,delta:Ce,...V}),P=t.enum(["secret","secret-content","hidden","excluded","wrong-type","too-large","empty","out-of-scope","allowance","total","scan-limit","tool-limit","missing","unreadable"]),k=t.enum([...P.options,"coding-guide","duplicate"]),me=t.strictObject({fromProposal:R,fromRulesOnly:R,rejected:R,rejectedByReason:t.partialRecord(k,R)}),fe=t.strictObject({repoKey:n,findings:t.array(S),structures:t.array(L),warnings:t.array(n),proposalCounts:me.optional(),refusedFiles:t.array(t.strictObject({path:n,reason:P}))});function W(e){return{nodes:e.nodes.map(({id:o,change:r,label:i})=>({id:o,change:r,...i===void 0?{}:{label:i}})),edges:e.edges.map(({from:o,to:r,kind:i,change:c,detail:a})=>({from:o,to:r,kind:i,change:c,...a===void 0?{}:{detail:a}}))}}function $(e,o=r=>r){let{kind:r,severity:i,title:c,cause:a,summary:u,category:d,question:E,excerpt:f}=e;return{kind:r,severity:i,title:c,cause:a,summary:u,category:d,question:E,excerpt:f,siteRepo:o(e.siteRepo),site:e.site&&{path:e.site.path,line:e.site.line},otherSites:e.otherSites.map(({repo:C,path:y,line:I,excerpt:b})=>({repo:o(C),path:y,line:I,excerpt:b})),fixes:e.fixes.map(({title:C,approach:y,kind:I,targetFiles:b,expectedOutcome:M,summary:oe,impact:ie,confidence:ae,objective:ce,status:le,blockedBy:de,alsoFixes:B,delta:q})=>({title:C,approach:y,kind:I,targetFiles:b.map(({path:ue,create:pe})=>({path:ue,create:pe})),expectedOutcome:M,summary:oe,impact:ie,confidence:ae,objective:ce,status:le,blockedBy:de,alsoFixes:B&&B.slice(),delta:q&&W(q)})),...e.sourceNotes===void 0?{}:{sourceNotes:e.sourceNotes&&{sites:e.sourceNotes.sites.map(({index:C,role:y,meaning:I,keyPhrase:b})=>({index:C,role:y,meaning:I,keyPhrase:b})),support:e.sourceNotes.support,supportNote:e.sourceNotes.supportNote,counterEvidence:e.sourceNotes.counterEvidence.map(({repo:C,path:y,line:I,excerpt:b,meaning:M})=>({repo:o(C),path:y,line:I,excerpt:b,meaning:M}))}}}}function Q(e){return{...e.headline===void 0?{}:{headline:e.headline},...e.ifLeft===void 0?{}:{ifLeft:e.ifLeft}}}function Ee(e){let o=e.body;return{repo:e.repo,children:e.children.map(({ref:r,how:i})=>({ref:r,how:i})),sourceHashes:Object.fromEntries(Object.entries(e.sourceHashes)),body:{subKind:o.subKind,kind:o.kind,severity:o.severity,title:o.title,cause:o.cause,...o.summary===void 0?{}:{summary:o.summary},evidence:o.evidence.map(({path:r,line:i,excerpt:c})=>({path:r,line:i,excerpt:c})),files:o.files.map(({path:r,action:i,role:c,unit:a,loadMode:u,loadVia:d,purpose:E,frontmatter:f})=>({path:r,action:i,role:c,unit:a,loadMode:u,loadVia:d,purpose:E,frontmatter:f&&{name:f.name,description:f.description,tools:f.tools.slice()}})),segments:o.segments.map(({path:r,startLine:i,endLine:c,to:a,disposition:u,into:d,childRef:E,heading:f,reason:C})=>({path:r,startLine:i,endLine:c,to:a,disposition:u,into:d&&{path:d.path,line:d.line},childRef:E,heading:f,reason:C})),additions:o.additions.map(({path:r,text:i,kind:c,heading:a})=>({path:r,text:i,kind:c,heading:a})),reorder:o.reorder&&{path:o.reorder.path,startLine:o.reorder.startLine,endLine:o.reorder.endLine,steps:o.reorder.steps.map(({from:r,reason:i})=>({from:r,reason:i}))},toolMoves:o.toolMoves.map(({tool:r,fromUnit:i,toUnit:c,reason:a,fromPath:u,toPath:d})=>({tool:r,fromUnit:i,toUnit:c,reason:a,fromPath:u,toPath:d})),...o.motivation===void 0?{}:{motivation:o.motivation.map(({kind:r,reason:i,evidence:c})=>({kind:r,reason:i,evidence:c}))},...o.outcomes===void 0?{}:{outcomes:o.outcomes.map(({improvement:r,measurement:i})=>({improvement:r,measurement:i}))},...o.split===void 0?{}:{split:{...o.split.root===void 0?{}:{root:o.split.root},frontDoor:{...o.split.frontDoor.name===void 0?{}:{name:o.split.frontDoor.name},job:o.split.frontDoor.job,skills:o.split.frontDoor.skills.slice()},subAgents:o.split.subAgents.map(r=>({name:r.name,job:r.job,description:r.description,path:r.path,...r.handoff===void 0?{}:{handoff:r.handoff},...r.resolves===void 0?{}:{resolves:r.resolves.slice()},skills:r.skills.map(({name:i,from:c,to:a})=>({name:i,from:c,to:a})),tools:r.tools.slice(),...r.noTools===void 0?{}:{noTools:r.noTools},movedKnowledge:r.movedKnowledge.map(Z),neededKnowledge:r.neededKnowledge.map(Z)}))}}},delta:{...W(e.delta),files:e.delta.files.map(({path:r,role:i,node:c,change:a,fromNode:u,fromPath:d,segments:E})=>({path:r,role:i,node:c,change:a,segments:E,...u===void 0?{}:{fromNode:u},...d===void 0?{}:{fromPath:d}})),tools:e.delta.tools.map(({label:r,fromNode:i,toNode:c})=>({label:r,fromNode:i,toNode:c}))},...Q(e)}}function Z({path:e,startLine:o,endLine:r}){return{...e===void 0?{}:{path:e},startLine:o,endLine:r}}function ye(e,o){return{repoKey:e.repoKey,findings:e.findings.map(r=>({...$(r),...Q(r),...r.audience===void 0?{}:{audience:r.audience}})),structures:e.structures.map(Ee),warnings:e.warnings.slice(),...e.proposalCounts?{proposalCounts:{fromProposal:e.proposalCounts.fromProposal,fromRulesOnly:e.proposalCounts.fromRulesOnly,rejected:e.proposalCounts.rejected,rejectedByReason:Object.fromEntries(k.options.filter(r=>e.proposalCounts.rejectedByReason[r]!==void 0).map(r=>[r,e.proposalCounts.rejectedByReason[r]]))}}:{},refusedFiles:o.map(({path:r,reason:i})=>({path:r,reason:i}))}}function Ie(e){if(e.redacted)throw new Error("Relay refused the request: leak_refused");return e.answer}import{z as A}from"zod";var g=1,J=A.string().min(1).max(128),U=["file_reads","repository_listing","sealed_delivery"],be=A.strictObject({protocol:A.literal(g),bundleVersion:J,engineVersion:J,capabilities:A.array(A.enum(U)).refine(e=>e.length===U.length&&new Set(e).size===U.length)});var te=Object.freeze(["CF_MULTI_PASS","CF_SPLIT_CHECK","CF_FINDING_CHECK","CF_SOURCE_NOTES","CF_PARALLEL_PASSES","CF_PASS_CONCURRENCY","CF_PARALLEL_SCOPE_CHECK","CF_FINDING_QUALITY","CF_FINDING_FULL_CONTEXT","CF_FINDING_PRECISION_RULES","CF_PROMPT_AGREE","CF_FINDING_SECOND_OPINION","CF_FINDING_RANKING","CF_FINDING_SEMANTIC_MATCHING","CF_FINDING_CODE_INPUTS","CF_FINDING_RECALL","CF_FINDING_RECALL_VARIANT","CF_FINDING_SECOND_OPINION_MODEL","CF_FINDING_SECOND_OPINION_PROVIDER","CF_FIX_EXPECTED_OUTCOME","CF_UNTRUSTED_CONTENT_CHECK","CF_FINDING_BETTER_AS_CODE","CF_CODE_AGENTS","CF_CODE_AGENTS_MODEL","CF_FINDING_DEDUPE","CF_ANALYSIS_IMPORTED_AGENTS","CF_RECALL_SIGNALS","CF_READING_NOTE_AGENT_ONLY","CF_SPLIT_HELPER_TOOLS","CF_CODE_PROMPT_LOADERS","CF_CODE_PROMPT_FUNCTIONS","CF_READING_PRIORITY","CF_LOCAL_SYMLINK_GUARD","CF_IMPORT_EXAMPLE_FILTER","CF_IMPORT_OUTSIDE_LOADERS","CF_SECRET_SCAN","CF_RESPECT_GITIGNORE","CF_IMPORT_COVERAGE","CF_IMPORT_LEXICAL_FACTS","CF_IMPORT_PROMPT_FIELDS","CF_IMPORT_MANIFEST","CF_IMPORT_SCOPED_SCAN","CF_IMPORT_SCOPES","CF_IMPORT_AGENT_PAGES","CF_IMPORT_INCLUDE_EXAMPLES","CF_IMPORT_WEAK_CODE_FALLBACK","CF_IMPORT_GUIDES_AS_PROMPT","CF_CONFIGURATION_GUIDE_PROMPT","CF_CHOOSE_AGENT","CF_IMPORT_PROPOSAL","CF_LOCAL_COMMITTED_ONLY","CF_LOCAL_GITIGNORE_OUTPUT","CF_REFUSE_TOO_LARGE","CF_FINDING_AUDIENCE","CF_FINDING_HEADLINES","CF_IMPORT_LAYOUTS","CF_DISCOVERY_SKILLS","CF_IMPORT_CALLS","CF_PROMPT_CACHE","CF_MODEL_READER","CF_LEGACY_TOOL_LISTS","CF_RESULT_SAFETY_CHECK"]),w=te.filter(e=>e!=="CF_RESULT_SAFETY_CHECK"&&e!=="CF_LOCAL_COMMITTED_ONLY"&&e!=="CF_LOCAL_GITIGNORE_OUTPUT"),ne=w.filter(e=>e!=="CF_IMPORT_OUTSIDE_LOADERS"&&e!=="CF_SECRET_SCAN"&&e!=="CF_RESPECT_GITIGNORE"&&e!=="CF_IMPORT_COVERAGE"&&e!=="CF_IMPORT_LEXICAL_FACTS"&&e!=="CF_IMPORT_PROMPT_FIELDS"&&e!=="CF_IMPORT_MANIFEST"&&e!=="CF_IMPORT_SCOPED_SCAN"&&e!=="CF_REFUSE_TOO_LARGE"&&e!=="CF_IMPORT_SCOPES"&&e!=="CF_IMPORT_AGENT_PAGES"&&e!=="CF_IMPORT_INCLUDE_EXAMPLES"&&e!=="CF_IMPORT_WEAK_CODE_FALLBACK"&&e!=="CF_IMPORT_GUIDES_AS_PROMPT"&&e!=="CF_CONFIGURATION_GUIDE_PROMPT"&&e!=="CF_CHOOSE_AGENT"&&e!=="CF_IMPORT_PROPOSAL"&&e!=="CF_FINDING_AUDIENCE");function qe(e,o="request"){return Object.freeze(Object.fromEntries((o==="saved"?te:o==="engine"?w:ne).filter(i=>Object.hasOwn(e,i)&&e[i]!==void 0).map(i=>[i,e[i]])))}var Ye=s.partialRecord(s.enum(ne),s.string()),Fe=s.partialRecord(s.enum(w),s.string()),T=Object.freeze({findings:2e4,textBytes:4096,quoteBytes:2e3,freeTextBytesPerFinding:16*1024}),ze=T.freeTextBytesPerFinding*T.findings;function se(e){return typeof e=="string"?!e.includes("\0")&&!/[\uD800-\uDFFF]/u.test(e):e===null||typeof e!="object"||Object.values(e).every(se)}var Re=S.superRefine((e,o)=>{let r=0;function i(c,a){if(typeof c=="string"){let u=a.at(-1)==="excerpt"||a.at(-1)==="keyPhrase",d=new TextEncoder().encode(c).byteLength;u||(r+=d),(d>(u?T.quoteBytes:T.textBytes)||!se(c))&&o.addIssue({code:"custom",path:a,message:"Invalid result text"})}else Array.isArray(c)?c.forEach((u,d)=>i(u,[...a,d])):c!==null&&typeof c=="object"&&Object.entries(c).forEach(([u,d])=>i(d,[...a,u]))}i(e,[]),r>T.freeTextBytesPerFinding&&o.addIssue({code:"custom",message:"Result text exceeds the finding budget"})}),He=s.array(Re).max(T.findings),O=s.string(),p=s.number().int().nonnegative().safe(),h=s.number().int().positive().safe(),v=s.enum(["bad_request","unavailable","reservation","leak_refused","cancelled"]);function Xe(e){let o=v.safeParse(e);return o.success?o.data:"unavailable"}function Ze(e){return Object.assign(new Error(e),{code:e})}var Te=1024*1024,ee=O.min(1).max(128),j=O.regex(/^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$/),D=O.regex(/^[a-f0-9]{64}$/),_={protocol:s.literal(g),analysisId:s.uuid(),nonce:O.min(16).max(256),bundleVersion:ee,engineVersion:ee};function m(e){return s.unknown().refine(o=>{try{let r=JSON.stringify(o);return typeof r=="string"&&new TextEncoder().encode(r).byteLength<=Te}catch{return!1}}).pipe(e)}var Ne=O.min(1).refine(e=>!/[\\\0\r\n]/.test(e)&&!/^(?:\/|[a-zA-Z]:)/.test(e)&&e.split("/").every(o=>o!==""&&o!=="."&&o!=="..")),Se=s.strictObject({id:j,path:Ne,size:p,hash:D}),K=s.array(Se).refine(e=>new Set(e.map(o=>o.id)).size===e.length&&new Set(e.map(o=>o.path)).size===e.length),re=s.strictObject({snapshot:D,commit:O.regex(/^(?:[a-f0-9]{40}|[a-f0-9]{64})$/),files:K,entriesVisited:p.optional(),truncated:s.boolean().optional(),complete:s.boolean(),cursor:O.min(1).max(256).optional()}).refine(e=>e.complete?e.cursor===void 0:e.cursor!==void 0),We=m(s.strictObject({..._,settings:Fe,manifest:re})),$e=s.strictObject(_),Ae=s.strictObject({startByte:p,endByte:p}).refine(e=>e.endByte>e.startByte),he=s.strictObject({startLine:h,endLine:h}).refine(e=>e.endLine>=e.startLine),Le=m(s.strictObject({..._,type:s.literal("need_files"),sequence:p,reads:s.array(s.strictObject({id:j,range:s.union([Ae,he])})).min(1)})),Pe=m(s.strictObject({..._,type:s.literal("need_listing"),sequence:p,cursor:O.min(1).max(256).nullable()})),Qe=m(s.discriminatedUnion("type",[s.strictObject({..._,type:s.literal("files"),sequence:p,files:s.array(s.union([s.strictObject({id:j,startByte:p,text:O,complete:s.boolean(),hash:D}),s.strictObject({id:j,refused:P})])).min(1)}),s.strictObject({..._,type:s.literal("listing"),sequence:p,manifest:re}),s.strictObject({..._,type:s.literal("reservation"),sequence:p,reservationId:s.uuid(),reservationToken:O.min(1).max(256)}),s.strictObject({..._,type:s.literal("delivery"),sequence:p,callId:s.uuid(),attemptId:s.uuid().nullable()}),s.strictObject({..._,type:s.literal("chunk"),sequence:p,callId:s.uuid(),attemptId:s.uuid(),chunk:h})])),x={chunk:p,chunks:h},ge=s.strictObject({..._,type:s.literal("result"),finalFiles:K,findings:s.array(S),structures:s.array(L),notices:s.array(O)}),je=m(ge.extend(x).refine(e=>e.chunk<e.chunks)),xe=m(s.strictObject({..._,type:s.literal("result_chunk"),...x,text:O,hash:D}).refine(e=>e.chunk<e.chunks)),De=m(s.strictObject({..._,type:s.literal("call_failed"),sequence:p,callId:s.uuid(),attemptId:s.uuid().nullable(),code:v}));function Je(e){let o=m(s.strictObject({..._,type:s.literal("plan"),sequence:p,...x,plan:e.plan,finalFiles:K}).refine(a=>a.chunk<a.chunks)),r=O.regex(/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/).min(1).refine(a=>!/\s/.test(a)),i=m(s.strictObject({..._,type:s.literal("sealed_delivery"),sequence:p,callId:s.uuid(),attemptId:s.uuid(),algorithm:s.literal("AES-256-GCM"),iv:r.length(16),...x,ciphertext:r,tag:O.regex(/^[A-Za-z0-9+/]{21}[AQgw]==$/).length(24).optional(),delivery:s.strictObject({confirmation:e.deliveryConfirmation,deadlineMs:h}).optional()}).refine(a=>a.chunk<a.chunks&&(a.chunk===a.chunks-1?a.tag!==void 0&&a.delivery!==void 0&&a.delivery.confirmation.callId===a.callId&&a.delivery.confirmation.attemptId===a.attemptId:a.tag===void 0&&a.delivery===void 0))),c=s.strictObject({..._,type:s.literal("refused"),code:v});return{plan:o,sealedDelivery:i,response:s.union([Le,Pe,o,i,De,je,xe,c])}}export{S as a,L as b,fe as c,$ as d,ye as e,Ie as f,g,be as h,te as i,qe as j,Ye as k,Fe as l,T as m,ze as n,se as o,Re as p,He as q,v as r,Xe as s,Ze as t,Te as u,Se as v,re as w,We as x,$e as y,Le as z,Pe as A,Qe as B,ge as C,je as D,xe as E,De as F,Je as G};
|
|
1
|
+
import{z as s}from"zod";import{z as t}from"zod";var n=t.string(),l=n.nullable(),R=t.number().int().nonnegative().safe(),b=t.number().int().positive().safe(),H=t.enum(["ordering","reliability","coverage","cost","safety","correctness"]),z=t.enum(["low","medium","high","critical"]),V={headline:n.optional(),ifLeft:n.optional()},_e=t.strictObject({path:n,line:b.nullable()}),G=t.strictObject({nodes:t.array(t.strictObject({id:n,change:n,label:l})),edges:t.array(t.strictObject({from:n,to:n,kind:n,change:n,detail:l}))}),Oe=t.strictObject({sites:t.array(t.strictObject({index:R,role:t.enum(["Says","But also says","Unclear","Context","Requirement","What actually happens","Why it's a gap","Evidence"]),meaning:n,keyPhrase:n})),support:t.enum(["supported","partly","not_supported"]),supportNote:n,counterEvidence:t.array(t.strictObject({repo:n,path:n,line:b,excerpt:n,meaning:n}))}),N=t.strictObject({kind:H,severity:z,title:n,cause:n,summary:l,category:l,question:l,audience:t.enum(["users","team"]).optional(),siteRepo:l,site:_e.nullable(),excerpt:l,otherSites:t.array(t.strictObject({repo:n,path:n,line:b,excerpt:n})),fixes:t.array(t.strictObject({title:n,approach:n,kind:t.enum(["code","prompt"]),targetFiles:t.array(t.strictObject({path:n,create:t.boolean().nullable()})),expectedOutcome:n,summary:l,impact:l,confidence:l,objective:l,status:l,blockedBy:l,alsoFixes:t.array(n).nullable(),delta:G.nullable()})),sourceNotes:Oe.nullable().optional(),...V}),Y=t.strictObject({path:n.optional(),startLine:b,endLine:b}),S=t.number(),X=t.strictObject({subKind:t.enum(["split_monolith","single_source","fold_patches","extract_subagent","merge_subagents","move_rule","move_tool","reorder"]),kind:H,severity:z,title:n,cause:n,summary:n.optional(),evidence:t.array(t.strictObject({path:n,line:b,excerpt:n})),files:t.array(t.strictObject({path:n,action:t.enum(["create","shrink","edit","delete"]),role:t.enum(["system prompt","soul","knowledge","skill","config","tools","mcp","template","reference","log","code"]),unit:n,loadMode:t.enum(["always","on_demand","never"]),loadVia:l,purpose:n,frontmatter:t.strictObject({name:n,description:n,tools:t.array(n)}).nullable()})),segments:t.array(t.strictObject({path:n,startLine:S,endLine:S,to:n,disposition:t.enum(["move","fold_into","remove_duplicate","remove_superseded"]),into:t.strictObject({path:n,line:S}).nullable(),childRef:l,heading:l,reason:n})),additions:t.array(t.strictObject({path:n,text:n,kind:t.enum(["pointer","handoff","reference_update"]),heading:l})),reorder:t.strictObject({path:n,startLine:S,endLine:S,steps:t.array(t.strictObject({from:b,reason:l}))}).nullable(),toolMoves:t.array(t.strictObject({tool:n,fromUnit:n,toUnit:n,reason:n,fromPath:l,toPath:l})),motivation:t.array(t.strictObject({kind:n,reason:n,evidence:n})).optional(),outcomes:t.array(t.strictObject({improvement:n,measurement:n})).optional(),split:t.strictObject({root:n.optional(),frontDoor:t.strictObject({name:n.optional(),job:n,skills:t.array(n)}),subAgents:t.array(t.strictObject({name:n,job:n,description:n,path:n,handoff:n.optional(),resolves:t.array(n).optional(),skills:t.array(t.strictObject({name:n,from:n,to:n})),tools:t.array(n),noTools:t.boolean().optional(),movedKnowledge:t.array(Y),neededKnowledge:t.array(Y)}))}).optional()}),Ce=t.strictObject({nodes:t.array(G.shape.nodes.element.extend({change:t.enum(["added","edited","removed"]),label:l.optional()})),edges:t.array(G.shape.edges.element.extend({kind:t.enum(["invokes","delegates","reads","writes","emits"]),change:t.enum(["added","edited","removed"]),detail:l.optional()})),files:t.array(t.strictObject({path:n,role:X.shape.files.element.shape.role,node:n,change:t.enum(["added","removed","moved","shrunk","grown","reordered"]),fromNode:n.optional(),fromPath:n.optional(),segments:R})),tools:t.array(t.strictObject({label:n,fromNode:n,toNode:n}))}),h=t.strictObject({repo:n,children:t.array(t.strictObject({ref:n,how:n})),sourceHashes:t.record(n,n),body:X,delta:Ce,...V}),P=t.enum(["secret","secret-content","hidden","excluded","wrong-type","too-large","empty","out-of-scope","allowance","total","scan-limit","tool-limit","missing","unreadable"]),k=t.enum([...P.options,"coding-guide","duplicate"]),me=t.strictObject({fromProposal:R,fromRulesOnly:R,rejected:R,rejectedByReason:t.partialRecord(k,R)}),fe=t.strictObject({repoKey:n,findings:t.array(N),structures:t.array(h),warnings:t.array(n),proposalCounts:me.optional(),refusedFiles:t.array(t.strictObject({path:n,reason:P}))});function W(e){return{nodes:e.nodes.map(({id:o,change:r,label:i})=>({id:o,change:r,...i===void 0?{}:{label:i}})),edges:e.edges.map(({from:o,to:r,kind:i,change:c,detail:a})=>({from:o,to:r,kind:i,change:c,...a===void 0?{}:{detail:a}}))}}function $(e,o=r=>r){let{kind:r,severity:i,title:c,cause:a,summary:u,category:d,question:E,excerpt:f}=e;return{kind:r,severity:i,title:c,cause:a,summary:u,category:d,question:E,excerpt:f,siteRepo:o(e.siteRepo),site:e.site&&{path:e.site.path,line:e.site.line},otherSites:e.otherSites.map(({repo:C,path:I,line:y,excerpt:F})=>({repo:o(C),path:I,line:y,excerpt:F})),fixes:e.fixes.map(({title:C,approach:I,kind:y,targetFiles:F,expectedOutcome:M,summary:oe,impact:ie,confidence:ae,objective:ce,status:le,blockedBy:de,alsoFixes:B,delta:q})=>({title:C,approach:I,kind:y,targetFiles:F.map(({path:ue,create:pe})=>({path:ue,create:pe})),expectedOutcome:M,summary:oe,impact:ie,confidence:ae,objective:ce,status:le,blockedBy:de,alsoFixes:B&&B.slice(),delta:q&&W(q)})),...e.sourceNotes===void 0?{}:{sourceNotes:e.sourceNotes&&{sites:e.sourceNotes.sites.map(({index:C,role:I,meaning:y,keyPhrase:F})=>({index:C,role:I,meaning:y,keyPhrase:F})),support:e.sourceNotes.support,supportNote:e.sourceNotes.supportNote,counterEvidence:e.sourceNotes.counterEvidence.map(({repo:C,path:I,line:y,excerpt:F,meaning:M})=>({repo:o(C),path:I,line:y,excerpt:F,meaning:M}))}}}}function Q(e){return{...e.headline===void 0?{}:{headline:e.headline},...e.ifLeft===void 0?{}:{ifLeft:e.ifLeft}}}function Ee(e){let o=e.body;return{repo:e.repo,children:e.children.map(({ref:r,how:i})=>({ref:r,how:i})),sourceHashes:Object.fromEntries(Object.entries(e.sourceHashes)),body:{subKind:o.subKind,kind:o.kind,severity:o.severity,title:o.title,cause:o.cause,...o.summary===void 0?{}:{summary:o.summary},evidence:o.evidence.map(({path:r,line:i,excerpt:c})=>({path:r,line:i,excerpt:c})),files:o.files.map(({path:r,action:i,role:c,unit:a,loadMode:u,loadVia:d,purpose:E,frontmatter:f})=>({path:r,action:i,role:c,unit:a,loadMode:u,loadVia:d,purpose:E,frontmatter:f&&{name:f.name,description:f.description,tools:f.tools.slice()}})),segments:o.segments.map(({path:r,startLine:i,endLine:c,to:a,disposition:u,into:d,childRef:E,heading:f,reason:C})=>({path:r,startLine:i,endLine:c,to:a,disposition:u,into:d&&{path:d.path,line:d.line},childRef:E,heading:f,reason:C})),additions:o.additions.map(({path:r,text:i,kind:c,heading:a})=>({path:r,text:i,kind:c,heading:a})),reorder:o.reorder&&{path:o.reorder.path,startLine:o.reorder.startLine,endLine:o.reorder.endLine,steps:o.reorder.steps.map(({from:r,reason:i})=>({from:r,reason:i}))},toolMoves:o.toolMoves.map(({tool:r,fromUnit:i,toUnit:c,reason:a,fromPath:u,toPath:d})=>({tool:r,fromUnit:i,toUnit:c,reason:a,fromPath:u,toPath:d})),...o.motivation===void 0?{}:{motivation:o.motivation.map(({kind:r,reason:i,evidence:c})=>({kind:r,reason:i,evidence:c}))},...o.outcomes===void 0?{}:{outcomes:o.outcomes.map(({improvement:r,measurement:i})=>({improvement:r,measurement:i}))},...o.split===void 0?{}:{split:{...o.split.root===void 0?{}:{root:o.split.root},frontDoor:{...o.split.frontDoor.name===void 0?{}:{name:o.split.frontDoor.name},job:o.split.frontDoor.job,skills:o.split.frontDoor.skills.slice()},subAgents:o.split.subAgents.map(r=>({name:r.name,job:r.job,description:r.description,path:r.path,...r.handoff===void 0?{}:{handoff:r.handoff},...r.resolves===void 0?{}:{resolves:r.resolves.slice()},skills:r.skills.map(({name:i,from:c,to:a})=>({name:i,from:c,to:a})),tools:r.tools.slice(),...r.noTools===void 0?{}:{noTools:r.noTools},movedKnowledge:r.movedKnowledge.map(Z),neededKnowledge:r.neededKnowledge.map(Z)}))}}},delta:{...W(e.delta),files:e.delta.files.map(({path:r,role:i,node:c,change:a,fromNode:u,fromPath:d,segments:E})=>({path:r,role:i,node:c,change:a,segments:E,...u===void 0?{}:{fromNode:u},...d===void 0?{}:{fromPath:d}})),tools:e.delta.tools.map(({label:r,fromNode:i,toNode:c})=>({label:r,fromNode:i,toNode:c}))},...Q(e)}}function Z({path:e,startLine:o,endLine:r}){return{...e===void 0?{}:{path:e},startLine:o,endLine:r}}function Ie(e,o){return{repoKey:e.repoKey,findings:e.findings.map(r=>({...$(r),...Q(r),...r.audience===void 0?{}:{audience:r.audience}})),structures:e.structures.map(Ee),warnings:e.warnings.slice(),...e.proposalCounts?{proposalCounts:{fromProposal:e.proposalCounts.fromProposal,fromRulesOnly:e.proposalCounts.fromRulesOnly,rejected:e.proposalCounts.rejected,rejectedByReason:Object.fromEntries(k.options.filter(r=>e.proposalCounts.rejectedByReason[r]!==void 0).map(r=>[r,e.proposalCounts.rejectedByReason[r]]))}}:{},refusedFiles:o.map(({path:r,reason:i})=>({path:r,reason:i}))}}function ye(e){if(e.redacted)throw new Error("Relay refused the request: leak_refused");return e.answer}import{z as A}from"zod";var g=1,J=A.string().min(1).max(128),U=["file_reads","repository_listing","sealed_delivery"],Fe=A.strictObject({protocol:A.literal(g),bundleVersion:J,engineVersion:J,capabilities:A.array(A.enum(U)).refine(e=>e.length===U.length&&new Set(e).size===U.length)});var te=Object.freeze(["CF_MULTI_PASS","CF_SPLIT_CHECK","CF_FINDING_CHECK","CF_SOURCE_NOTES","CF_PARALLEL_PASSES","CF_PASS_CONCURRENCY","CF_PARALLEL_SCOPE_CHECK","CF_FINDING_QUALITY","CF_FINDING_FULL_CONTEXT","CF_FINDING_PRECISION_RULES","CF_PROMPT_AGREE","CF_FINDING_SECOND_OPINION","CF_FINDING_RANKING","CF_FINDING_SEMANTIC_MATCHING","CF_FINDING_CODE_INPUTS","CF_FINDING_RECALL","CF_FINDING_RECALL_VARIANT","CF_FINDING_SECOND_OPINION_MODEL","CF_FINDING_SECOND_OPINION_PROVIDER","CF_FIX_EXPECTED_OUTCOME","CF_UNTRUSTED_CONTENT_CHECK","CF_FINDING_BETTER_AS_CODE","CF_CODE_AGENTS","CF_CODE_AGENTS_MODEL","CF_FINDING_DEDUPE","CF_ANALYSIS_IMPORTED_AGENTS","CF_RECALL_SIGNALS","CF_READING_NOTE_AGENT_ONLY","CF_SPLIT_HELPER_TOOLS","CF_CODE_PROMPT_LOADERS","CF_CODE_PROMPT_FUNCTIONS","CF_READING_PRIORITY","CF_LOCAL_SYMLINK_GUARD","CF_IMPORT_EXAMPLE_FILTER","CF_IMPORT_OUTSIDE_LOADERS","CF_SECRET_SCAN","CF_RESPECT_GITIGNORE","CF_IMPORT_COVERAGE","CF_IMPORT_LEXICAL_FACTS","CF_IMPORT_PROMPT_FIELDS","CF_IMPORT_MANIFEST","CF_IMPORT_SCOPED_SCAN","CF_IMPORT_SCOPES","CF_IMPORT_AGENT_PAGES","CF_IMPORT_INCLUDE_EXAMPLES","CF_IMPORT_WEAK_CODE_FALLBACK","CF_FILE_SCOPE","CF_SCOPE_CHOICES","CF_LOCAL_IMPORT_RESOLUTION","CF_IMPORT_GUIDES_AS_PROMPT","CF_CONFIGURATION_GUIDE_PROMPT","CF_CHOOSE_AGENT","CF_IMPORT_PROPOSAL","CF_LOCAL_COMMITTED_ONLY","CF_LOCAL_GITIGNORE_OUTPUT","CF_REFUSE_TOO_LARGE","CF_FINDING_AUDIENCE","CF_FINDING_HEADLINES","CF_IMPORT_LAYOUTS","CF_DISCOVERY_SKILLS","CF_IMPORT_CALLS","CF_PROMPT_CACHE","CF_MODEL_READER","CF_LEGACY_TOOL_LISTS","CF_RESULT_SAFETY_CHECK"]),w=te.filter(e=>e!=="CF_RESULT_SAFETY_CHECK"&&e!=="CF_LOCAL_COMMITTED_ONLY"&&e!=="CF_LOCAL_GITIGNORE_OUTPUT"&&e!=="CF_FILE_SCOPE"&&e!=="CF_SCOPE_CHOICES"&&e!=="CF_LOCAL_IMPORT_RESOLUTION"),ne=w.filter(e=>e!=="CF_IMPORT_OUTSIDE_LOADERS"&&e!=="CF_SECRET_SCAN"&&e!=="CF_RESPECT_GITIGNORE"&&e!=="CF_IMPORT_COVERAGE"&&e!=="CF_IMPORT_LEXICAL_FACTS"&&e!=="CF_IMPORT_PROMPT_FIELDS"&&e!=="CF_IMPORT_MANIFEST"&&e!=="CF_IMPORT_SCOPED_SCAN"&&e!=="CF_REFUSE_TOO_LARGE"&&e!=="CF_IMPORT_SCOPES"&&e!=="CF_IMPORT_AGENT_PAGES"&&e!=="CF_IMPORT_INCLUDE_EXAMPLES"&&e!=="CF_IMPORT_WEAK_CODE_FALLBACK"&&e!=="CF_IMPORT_GUIDES_AS_PROMPT"&&e!=="CF_CONFIGURATION_GUIDE_PROMPT"&&e!=="CF_CHOOSE_AGENT"&&e!=="CF_IMPORT_PROPOSAL"&&e!=="CF_FINDING_AUDIENCE");function qe(e,o="request"){return Object.freeze(Object.fromEntries((o==="saved"?te:o==="engine"?w:ne).filter(i=>Object.hasOwn(e,i)&&e[i]!==void 0).map(i=>[i,e[i]])))}var Ye=s.partialRecord(s.enum(ne),s.string()),be=s.partialRecord(s.enum(w),s.string()),T=Object.freeze({findings:2e4,textBytes:4096,quoteBytes:2e3,freeTextBytesPerFinding:16*1024}),He=T.freeTextBytesPerFinding*T.findings;function se(e){return typeof e=="string"?!e.includes("\0")&&!/[\uD800-\uDFFF]/u.test(e):e===null||typeof e!="object"||Object.values(e).every(se)}var Re=N.superRefine((e,o)=>{let r=0;function i(c,a){if(typeof c=="string"){let u=a.at(-1)==="excerpt"||a.at(-1)==="keyPhrase",d=new TextEncoder().encode(c).byteLength;u||(r+=d),(d>(u?T.quoteBytes:T.textBytes)||!se(c))&&o.addIssue({code:"custom",path:a,message:"Invalid result text"})}else Array.isArray(c)?c.forEach((u,d)=>i(u,[...a,d])):c!==null&&typeof c=="object"&&Object.entries(c).forEach(([u,d])=>i(d,[...a,u]))}i(e,[]),r>T.freeTextBytesPerFinding&&o.addIssue({code:"custom",message:"Result text exceeds the finding budget"})}),ze=s.array(Re).max(T.findings),O=s.string(),p=s.number().int().nonnegative().safe(),L=s.number().int().positive().safe(),v=s.enum(["bad_request","unavailable","reservation","leak_refused","cancelled"]);function Xe(e){let o=v.safeParse(e);return o.success?o.data:"unavailable"}function Ze(e){return Object.assign(new Error(e),{code:e})}var Te=1024*1024,ee=O.min(1).max(128),j=O.regex(/^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$/),D=O.regex(/^[a-f0-9]{64}$/),_={protocol:s.literal(g),analysisId:s.uuid(),nonce:O.min(16).max(256),bundleVersion:ee,engineVersion:ee};function m(e){return s.unknown().refine(o=>{try{let r=JSON.stringify(o);return typeof r=="string"&&new TextEncoder().encode(r).byteLength<=Te}catch{return!1}}).pipe(e)}var Se=O.min(1).refine(e=>!/[\\\0\r\n]/.test(e)&&!/^(?:\/|[a-zA-Z]:)/.test(e)&&e.split("/").every(o=>o!==""&&o!=="."&&o!=="..")),Ne=s.strictObject({id:j,path:Se,size:p,hash:D}),K=s.array(Ne).refine(e=>new Set(e.map(o=>o.id)).size===e.length&&new Set(e.map(o=>o.path)).size===e.length),re=s.strictObject({snapshot:D,commit:O.regex(/^(?:[a-f0-9]{40}|[a-f0-9]{64})$/),files:K,entriesVisited:p.optional(),truncated:s.boolean().optional(),complete:s.boolean(),cursor:O.min(1).max(256).optional()}).refine(e=>e.complete?e.cursor===void 0:e.cursor!==void 0),We=m(s.strictObject({..._,settings:be,manifest:re})),$e=s.strictObject(_),Ae=s.strictObject({startByte:p,endByte:p}).refine(e=>e.endByte>e.startByte),Le=s.strictObject({startLine:L,endLine:L}).refine(e=>e.endLine>=e.startLine),he=m(s.strictObject({..._,type:s.literal("need_files"),sequence:p,reads:s.array(s.strictObject({id:j,range:s.union([Ae,Le])})).min(1)})),Pe=m(s.strictObject({..._,type:s.literal("need_listing"),sequence:p,cursor:O.min(1).max(256).nullable()})),Qe=m(s.discriminatedUnion("type",[s.strictObject({..._,type:s.literal("files"),sequence:p,files:s.array(s.union([s.strictObject({id:j,startByte:p,text:O,complete:s.boolean(),hash:D}),s.strictObject({id:j,refused:P})])).min(1)}),s.strictObject({..._,type:s.literal("listing"),sequence:p,manifest:re}),s.strictObject({..._,type:s.literal("reservation"),sequence:p,reservationId:s.uuid(),reservationToken:O.min(1).max(256)}),s.strictObject({..._,type:s.literal("delivery"),sequence:p,callId:s.uuid(),attemptId:s.uuid().nullable()}),s.strictObject({..._,type:s.literal("chunk"),sequence:p,callId:s.uuid(),attemptId:s.uuid(),chunk:L})])),x={chunk:p,chunks:L},ge=s.strictObject({..._,type:s.literal("result"),finalFiles:K,findings:s.array(N),structures:s.array(h),notices:s.array(O)}),je=m(ge.extend(x).refine(e=>e.chunk<e.chunks)),xe=m(s.strictObject({..._,type:s.literal("result_chunk"),...x,text:O,hash:D}).refine(e=>e.chunk<e.chunks)),De=m(s.strictObject({..._,type:s.literal("call_failed"),sequence:p,callId:s.uuid(),attemptId:s.uuid().nullable(),code:v}));function Je(e){let o=m(s.strictObject({..._,type:s.literal("plan"),sequence:p,...x,plan:e.plan,finalFiles:K}).refine(a=>a.chunk<a.chunks)),r=O.regex(/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/).min(1).refine(a=>!/\s/.test(a)),i=m(s.strictObject({..._,type:s.literal("sealed_delivery"),sequence:p,callId:s.uuid(),attemptId:s.uuid(),algorithm:s.literal("AES-256-GCM"),iv:r.length(16),...x,ciphertext:r,tag:O.regex(/^[A-Za-z0-9+/]{21}[AQgw]==$/).length(24).optional(),delivery:s.strictObject({confirmation:e.deliveryConfirmation,deadlineMs:L}).optional()}).refine(a=>a.chunk<a.chunks&&(a.chunk===a.chunks-1?a.tag!==void 0&&a.delivery!==void 0&&a.delivery.confirmation.callId===a.callId&&a.delivery.confirmation.attemptId===a.attemptId:a.tag===void 0&&a.delivery===void 0))),c=s.strictObject({..._,type:s.literal("refused"),code:v});return{plan:o,sealedDelivery:i,response:s.union([he,Pe,o,i,De,je,xe,c])}}export{N as a,h as b,fe as c,$ as d,Ie as e,ye as f,g,Fe as h,te as i,qe as j,Ye as k,be as l,T as m,He as n,se as o,Re as p,ze as q,v as r,Xe as s,Ze as t,Te as u,Ne as v,re as w,We as x,$e as y,he as z,Pe as A,Qe as B,ge as C,je as D,xe as E,De as F,Je as G};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a,b,c,d,e,f,g}from"../chunks/PY5M22CL.js";import"../chunks/RUVMFAST.js";import"../chunks/S27VIQMZ.js";export{a as ANALYSIS_SELECTION_LIMITS,b as analysisScopeSchema,c as analysisSelectionRequestSchema,g as analysisSelectionResultSchema,f as provenScopeChoiceSchema,e as selectionCompletenessSchema,d as selectionFileSchema};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a,b,c,d,e}from"../chunks/RUVMFAST.js";import"../chunks/S27VIQMZ.js";export{a as importProvenanceSchema,b as importRefusalReasonSchema,e as moduleResolutionSchema,d as refusedImportSchema,c as resolvedImportSchema};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{A,B,C,D,E,F,G,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z}from"../chunks/
|
|
1
|
+
import{A,B,C,D,E,F,G,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z}from"../chunks/WYLIV2P2.js";export{u as ANALYSIS_DATA_FRAME_BYTES,g as ANALYSIS_PROTOCOL,i as ANALYSIS_SETTING_NAMES,n as RESULT_CHECK_FREE_TEXT_BYTES,m as RESULT_CHECK_LIMITS,B as analysisAdvance,F as analysisCallFailure,s as analysisCallFailureCode,y as analysisCancel,h as analysisCapabilities,t as analysisFailure,r as analysisFailureCode,v as analysisFile,C as analysisFinalResult,w as analysisManifest,z as analysisNeedFiles,A as analysisNeedListing,D as analysisResult,E as analysisResultChunk,l as analysisSettings,x as analysisStart,j as filterAnalysisSettings,d as projectPublicFinding,e as projectPublicReport,a as publicFinding,c as publicReportSchema,b as publicStructure,G as relayAnalysisSchemas,k as requestAnalysisSettings,p as resultCheckFinding,q as resultCheckFindings,f as unredactedAnswer,o as validIntakeText};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as c,b as d,c as e,d as f,e as g,f as h,g as i,h as j,i as k}from"../chunks/
|
|
1
|
+
import{a as c,b as d,c as e,d as f,e as g,f as h,g as i,h as j,i as k}from"../chunks/SLJ6CW7W.js";import"../chunks/6U2IR4XB.js";import"../chunks/MJGB25S5.js";import{i as a,j as b}from"../chunks/WYLIV2P2.js";import"../chunks/6B2HILSY.js";import"../chunks/JKWTHRUR.js";import"../chunks/SKVEBOGA.js";import"../chunks/3GUKUEEJ.js";import"../chunks/A7WJJMRY.js";import"../chunks/KWECQJ6X.js";import"../chunks/FSLWD2PE.js";export{a as ANALYSIS_SETTING_NAMES,g as analysisExecutionRequest,c as executionInputs,f as executionRequest,b as filterAnalysisSettings,d as modelName,k as recoverRequestFailure,e as requestLimits,h as requestPolicy,i as selectAnalysisTemplate,j as selectAnswerFormat};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a,b,c}from"../chunks/S27VIQMZ.js";export{c as launchRootSchema,a as selectionPathSchema,b as snapshotIdSchema};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a,b,c,d}from"../chunks/
|
|
1
|
+
import{a,b,c,d}from"../chunks/7NEWZ74F.js";import"../chunks/KGQYR62R.js";import"../chunks/GOQVKWP3.js";import"../chunks/74FPPPIG.js";import"../chunks/5TATKWLG.js";import"../chunks/2PZF54KH.js";import"../chunks/6B2HILSY.js";import"../chunks/JKWTHRUR.js";import"../chunks/SKVEBOGA.js";import"../chunks/3GUKUEEJ.js";import"../chunks/724WZMYW.js";import"../chunks/A7WJJMRY.js";import"../chunks/FSLWD2PE.js";import"../chunks/YUY436SM.js";import"../chunks/C6X5GDG4.js";import"../chunks/RUVMFAST.js";import"../chunks/S27VIQMZ.js";export{a as analysisSizeLimits,c as assessAnalysisSize,d as measureAnalysisSize,b as parseAnalysisSize};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{$ as h,aa as i,ba as j,ca as k,da as l,ea as m,fa as n,ga as o,ha as p,ia as q,ja as r,ka as s,la as t,ma as u,na as v,oa as w,pa as x,qa as y,ra as z,sa as A,ta as B,ua as C,va as D}from"../chunks/GOQVKWP3.js";import"../chunks/74FPPPIG.js";import"../chunks/5TATKWLG.js";import"../chunks/2PZF54KH.js";import"../chunks/6B2HILSY.js";import"../chunks/JKWTHRUR.js";import"../chunks/SKVEBOGA.js";import"../chunks/3GUKUEEJ.js";import"../chunks/724WZMYW.js";import"../chunks/A7WJJMRY.js";import"../chunks/FSLWD2PE.js";import{a,b,c,d,e,f,h as g}from"../chunks/YUY436SM.js";import"../chunks/C6X5GDG4.js";import"../chunks/RUVMFAST.js";import"../chunks/S27VIQMZ.js";export{v as CODE_EXT_RE,s as DEPENDENCY_BUILD_FOLDER_RE,p as EXTRACTION_CANDIDATE_RE,q as EXTRACTION_EXT_RE,i as FileReadRefusal,x as GIT_DIR_RE,r as LOCK_FILE_RE,w as NON_SOURCE_FOLDER_RE,j as REFERENCE_FILE_EXTENSIONS,c as SECRET_FILE_RE,z as SOURCE_CUT_MARKER,u as SOURCE_EXCLUDE_RE,t as SOURCE_NON_LOCK_EXCLUDE_RE,y as admitFile,C as admittedFileAccess,D as assertSnapshotAdmission,h as discoveredFilePurpose,f as fileRefusalWarning,l as isFetchableReferencePath,m as isFetchableSourcePath,k as isHtmlReferencePath,o as isReadableLocalPath,d as isReadableRepoPath,n as isUnreadCommandPath,b as localSymlinkGuardEnabled,B as readAdmittedSource,A as readRepoFile,g as resolveLocalExclusions,a as respectGitignore,e as secretFileWarning};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as a,d as b,e as c,f as d,g as e,h as f}from"../../chunks/2PZF54KH.js";import"../../chunks/RUVMFAST.js";import"../../chunks/S27VIQMZ.js";export{f as ModuleResolver,a as moduleResolutionLimits,b as pathMatchesSource,c as relativeImportCandidates,d as relativeImportPath,e as resolveImport};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as c}from"../chunks/
|
|
1
|
+
import{a as c}from"../chunks/FBTOOUPL.js";import"../chunks/IVULXWQN.js";import"../chunks/K5FUABWW.js";import"../chunks/326F4XNG.js";import"../chunks/WYLIV2P2.js";import"../chunks/KGQYR62R.js";import"../chunks/2PSNOSJ2.js";import{z as b}from"../chunks/GOQVKWP3.js";import"../chunks/74FPPPIG.js";import"../chunks/5TATKWLG.js";import"../chunks/2PZF54KH.js";import"../chunks/6B2HILSY.js";import"../chunks/JKWTHRUR.js";import"../chunks/SKVEBOGA.js";import"../chunks/3GUKUEEJ.js";import"../chunks/724WZMYW.js";import"../chunks/A7WJJMRY.js";import"../chunks/FSLWD2PE.js";import"../chunks/PY5M22CL.js";import"../chunks/YUY436SM.js";import{e as a}from"../chunks/C6X5GDG4.js";import"../chunks/RUVMFAST.js";import"../chunks/S27VIQMZ.js";export{b as READ_LIMITS,c as readOutsideLoaderSources,a as repoPathFrom};
|