@counterfact-labs/cli 0.2.9 → 0.2.11

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.
Files changed (134) hide show
  1. package/README.md +4 -5
  2. package/bundle/client-release.json +1 -1
  3. package/dist/adapters/analysis-results.js +10 -5
  4. package/dist/adapters/completion.js +75 -41
  5. package/dist/adapters/config-directory.js +5 -0
  6. package/dist/adapters/files.js +25 -10
  7. package/dist/adapters/legacy-reports.js +48 -0
  8. package/dist/adapters/output-paths.js +85 -5
  9. package/dist/adapters/relay-plan.js +7 -5
  10. package/dist/adapters/result-receipt.js +78 -0
  11. package/dist/adapters/results.js +5 -8
  12. package/dist/adapters/settings.js +10 -4
  13. package/dist/adapters/storage-identity.js +27 -0
  14. package/dist/analysis-core/analysis/code-agents/skipped-files.js +1 -1
  15. package/dist/analysis-core/analysis/file-analysis-plan.js +1 -1
  16. package/dist/analysis-core/analysis/file-dependencies.js +1 -1
  17. package/dist/analysis-core/analysis/finding-quality/policy.js +1 -1
  18. package/dist/analysis-core/analysis/folder-analysis-plan.js +1 -1
  19. package/dist/analysis-core/analysis/passes/full-file-passes.js +1 -1
  20. package/dist/analysis-core/analysis/project-architecture.js +1 -1
  21. package/dist/analysis-core/analysis/schemas.js +1 -1
  22. package/dist/analysis-core/chunks/{5B5UCWD3.js → 2IQN26TC.js} +1 -1
  23. package/dist/analysis-core/chunks/{MZOKZ3N6.js → 2J3PWUPG.js} +1 -1
  24. package/dist/analysis-core/chunks/33EUZF25.js +1 -0
  25. package/dist/analysis-core/chunks/{3GUKUEEJ.js → 5JG3ZRNJ.js} +1 -1
  26. package/dist/analysis-core/chunks/{FRXOQ2M6.js → 6E4K7JTI.js} +1 -1
  27. package/dist/analysis-core/chunks/{4RXRAB5S.js → 6JTHFDH3.js} +1 -1
  28. package/dist/analysis-core/chunks/{4UDQBDDE.js → 6W6B7VSP.js} +1 -1
  29. package/dist/analysis-core/chunks/{4PT5C4IT.js → AIS3FHQR.js} +7 -7
  30. package/dist/analysis-core/chunks/CNQZLSAP.js +1 -0
  31. package/dist/analysis-core/chunks/{YWL52FVW.js → EJ2IZUN2.js} +2 -2
  32. package/dist/analysis-core/chunks/{LOBIDUCA.js → GOBOE2SC.js} +1 -1
  33. package/dist/analysis-core/chunks/GYXDN5W4.js +1 -0
  34. package/dist/analysis-core/chunks/GZSUTDGX.js +1 -0
  35. package/dist/analysis-core/chunks/HB5BTGTI.js +6 -0
  36. package/dist/analysis-core/chunks/HH3HDT5K.js +73 -0
  37. package/dist/analysis-core/chunks/I4F56VMG.js +1 -0
  38. package/dist/analysis-core/chunks/{RQTNTIR4.js → I5F7S63K.js} +1 -1
  39. package/dist/analysis-core/chunks/ICJV6KIZ.js +11 -0
  40. package/dist/analysis-core/chunks/JAPVLU4Z.js +1 -0
  41. package/dist/analysis-core/chunks/{33IGHOYT.js → JCVB6IC4.js} +1 -1
  42. package/dist/analysis-core/chunks/{33HRXJ5Q.js → JLW44GIU.js} +1 -1
  43. package/dist/analysis-core/chunks/JS6HTVYX.js +1 -0
  44. package/dist/analysis-core/chunks/{JGK37AWN.js → JWQXG5RB.js} +1 -1
  45. package/dist/analysis-core/chunks/LOODGUMW.js +1 -0
  46. package/dist/analysis-core/chunks/{HVQJKPQ4.js → NWYNJHY4.js} +1 -1
  47. package/dist/analysis-core/chunks/{HHFDNY6V.js → OHDC3L6V.js} +1 -1
  48. package/dist/analysis-core/chunks/OXGKALKM.js +1 -0
  49. package/dist/analysis-core/chunks/{MJGB25S5.js → P5FCHJ7W.js} +1 -1
  50. package/dist/analysis-core/chunks/PISOGSJF.js +1 -0
  51. package/dist/analysis-core/chunks/{CTLHKFPH.js → QENYFKG3.js} +8 -8
  52. package/dist/analysis-core/chunks/{2YREYGOG.js → QY57UR6E.js} +1 -1
  53. package/dist/analysis-core/chunks/QYYN4YKB.js +35 -0
  54. package/dist/analysis-core/chunks/UYG422QR.js +0 -0
  55. package/dist/analysis-core/chunks/V7GZHSVR.js +1 -0
  56. package/dist/analysis-core/chunks/{JEWBPIQI.js → VBGQKYIT.js} +1 -1
  57. package/dist/analysis-core/chunks/{S27Y2TP5.js → VVSHUUWX.js} +1 -1
  58. package/dist/analysis-core/chunks/VX6LYNXV.js +1 -0
  59. package/dist/analysis-core/chunks/{JKWTHRUR.js → YDSB7UOR.js} +1 -1
  60. package/dist/analysis-core/chunks/ZLUI3EHB.js +1 -0
  61. package/dist/analysis-core/contracts/execution-request.js +1 -1
  62. package/dist/analysis-core/contracts/intake-finding.js +1 -1
  63. package/dist/analysis-core/contracts/model-errors.js +1 -0
  64. package/dist/analysis-core/contracts/relay-analysis.js +1 -1
  65. package/dist/analysis-core/contracts/requests.js +1 -1
  66. package/dist/analysis-core/conventions/analysis-fit.js +1 -1
  67. package/dist/analysis-core/conventions/file-admission.js +1 -1
  68. package/dist/analysis-core/errors.js +1 -1
  69. package/dist/analysis-core/import/calls/modules.js +1 -1
  70. package/dist/analysis-core/import/entry-selection.js +1 -1
  71. package/dist/analysis-core/import/outside-loader-sources.js +1 -1
  72. package/dist/analysis-core/index.js +1 -1
  73. package/dist/analysis-core/llm/cache-policy.js +1 -1
  74. package/dist/analysis-core/llm/cost.js +1 -1
  75. package/dist/analysis-core/llm/structured-output-error.js +1 -1
  76. package/dist/analysis-core/requests/answer-formats.js +1 -1
  77. package/dist/analysis-core/requests/frame-budget.js +1 -0
  78. package/dist/analysis-core/requests/local-plan.js +1 -1
  79. package/dist/analysis-core/requests/planned-limits.js +1 -1
  80. package/dist/analysis-core/requests/registry.js +1 -1
  81. package/dist/analysis-core/requests/template-version.js +1 -1
  82. package/dist/analysis-core/requests/tools.js +1 -1
  83. package/dist/analysis-core/settings.js +1 -1
  84. package/dist/analysis-core/stages/engine-entry.js +1 -1
  85. package/dist/analysis-core/wording.js +1 -0
  86. package/dist/cli/analysis-preview.js +22 -0
  87. package/dist/cli/analysis-selection.js +6 -8
  88. package/dist/cli/commands/analyze.js +29 -26
  89. package/dist/cli/commands/login.js +5 -0
  90. package/dist/cli/compatibility.js +39 -0
  91. package/dist/cli/completion-delivery.js +4 -3
  92. package/dist/cli/completion-recovery.js +25 -23
  93. package/dist/cli/credentials.js +3 -2
  94. package/dist/cli/finding-display.js +3 -2
  95. package/dist/cli/git.js +5 -2
  96. package/dist/cli/intake-payload.js +1 -2
  97. package/dist/cli/main.js +8 -2
  98. package/dist/cli/mcp.js +35 -10
  99. package/dist/cli/prior-completion.js +1 -1
  100. package/dist/cli/relay-check.js +88 -30
  101. package/dist/cli/relay-failure.js +19 -11
  102. package/dist/cli/relay-preparation.js +9 -6
  103. package/dist/cli/scope-choices.js +5 -4
  104. package/dist/cli/skipped-files.js +2 -1
  105. package/dist/cli/suggested-email.js +6 -1
  106. package/dist/cli/summary.js +2 -1
  107. package/dist/contract/agent-choice.js +2 -0
  108. package/dist/contract/cli-refusals.js +105 -9
  109. package/dist/contract/cli-version.js +1 -1
  110. package/dist/contract/console.js +2 -1
  111. package/dist/contract/email-sign-in-messages.js +2 -1
  112. package/dist/contract/scope-choice.js +4 -1
  113. package/dist/gatekeeper/client.js +11 -2
  114. package/dist/gatekeeper/connection-exchange.js +19 -4
  115. package/dist/gatekeeper/connection.js +15 -6
  116. package/dist/gatekeeper/console.js +10 -17
  117. package/dist/gatekeeper/model.js +13 -3
  118. package/package.json +1 -1
  119. package/dist/adapters/gitignore-output.js +0 -41
  120. package/dist/adapters/source-relay-plan.js +0 -7
  121. package/dist/analysis-core/chunks/2AASSZRO.js +0 -35
  122. package/dist/analysis-core/chunks/CQQ4TTXE.js +0 -1
  123. package/dist/analysis-core/chunks/F54DOWKN.js +0 -6
  124. package/dist/analysis-core/chunks/HCPO6QPU.js +0 -1
  125. package/dist/analysis-core/chunks/J4AXGE5W.js +0 -1
  126. package/dist/analysis-core/chunks/LFYTD7JF.js +0 -1
  127. package/dist/analysis-core/chunks/LMUXOKIM.js +0 -1
  128. package/dist/analysis-core/chunks/M5YWJY7P.js +0 -1
  129. package/dist/analysis-core/chunks/MGVIKA74.js +0 -1
  130. package/dist/analysis-core/chunks/NXHVBJL4.js +0 -1
  131. package/dist/analysis-core/chunks/OKBK3JL3.js +0 -1
  132. package/dist/analysis-core/chunks/SJESFYBA.js +0 -10
  133. package/dist/analysis-core/chunks/W24SFYZM.js +0 -67
  134. package/dist/analysis-core/chunks/YTHF2E2S.js +0 -1
@@ -0,0 +1,35 @@
1
+ import{b as on}from"./74FPPPIG.js";import{i as yo}from"./LOODGUMW.js";import{a as Ke}from"./MKYLK6DB.js";import{d as Eo,e as St}from"./5TATKWLG.js";import{f as Po}from"./YDSB7UOR.js";import{g as nn}from"./JAPVLU4Z.js";import{a as gt}from"./I4F56VMG.js";import{b as xo,d as Qt,e as So}from"./33EUZF25.js";import{c as sn,d as ln,e as _t,g as Lo}from"./YUY436SM.js";import{a as Ue,c as U,d as _o,e as Ge}from"./C6X5GDG4.js";import{a as ho,b as Zt,c as go}from"./724WZMYW.js";import{a as mo}from"./JS6HTVYX.js";import{a as X,b as h,c as v,d as ee,e as Be,f as D,g as xt,h as We,i as re,j as be,k as j,l as B,m as bo,n as _e,o as q,p as Je,q as me,r as vo,s as le,t as en,u as ne,v as J,w as ae,x as $o,y as kt}from"./EJ2IZUN2.js";import{a as ko,b as z,c as wo,e as yt,f as Ro,g as ge}from"./ICJV6KIZ.js";import{a as bt}from"./INVTU73D.js";import{a as rn}from"./A7WJJMRY.js";import{a as wt}from"./Q5WR6B2H.js";import{b as tn}from"./VDUFPTDD.js";function Et(e,n,t){let o=e.split(`
2
+ `),r=Math.min(Math.max(n-1-3,0),o.length-1),s=0;for(let l=0;l<r;l++)s+=o[l].length+1;return{text:e.slice(s,s+t),fromLine:r+1}}var Ao=/(^|\/)(?:(?:\.cursor|\.windsurf|\.claude|\.roo)\/rules\/|\.clinerules\/|\.junie\/guidelines\.md$|\.kiro\/steering\/|\.github\/instructions\/.*\.instructions\.md$)/;function Ee(e){let n=e.toLowerCase(),t=n.split("/").pop();return["claude.md","agents.md","gemini.md",".cursorrules",".windsurfrules",".clinerules","copilot-instructions.md"].includes(t)||/^(claude|agents|gemini)\.(local|override)\.md$/.test(t)||Ao.test(n)}function Sa(e){let n=e.toLowerCase();return n.includes("/")?n===".github/copilot-instructions.md"||Ao.exec(n)?.index===0:Ee(n)}function ya(e,n){return+(e.toLowerCase()==="agents.md")-+(n.toLowerCase()==="agents.md")||e.localeCompare(n)}var Ye=["claude.md","agents.md"];function Ws(e){return!ze(e)&&e.CF_CONFIGURATION_GUIDE_PROMPT!=="0"}function ze(e){return e.CF_IMPORT_GUIDES_AS_PROMPT==="1"}function Oo(e,n,t=!1){return t||ze(e)||!Ee(n)}function Mo(e,n){return ze(e)?Ye.includes(n.toLowerCase()):Ee(n)}function Io({codeAgentsFound:e,folderAgentsFound:n=!1,otherDefinitions:t,agentConfiguration:o=!1,usage:r="import"},s){return ze(s)?n?"background":r==="scan"?t?"prompt":"background":r==="map"?e?"background":"prompt":e&&!t?"background":"prompt":Ws(s)&&o&&!e&&!n?"prompt":"background"}var Ks=/\.(ts|tsx|js|jsx|mjs|cjs|py|go|rs|rb|java|kt|swift|c|cc|cpp|h|hpp|cs|php|sh|bash|zsh|ps1|sql|tf|hcl|lock|toml|gradle)$/i,Us=/\.(md|mdx|txt|json|ya?ml)$/i,Gs=/^(licen[cs]e.*|copying|notice|authors|codeowners|readme|changelog|\.gitignore|\.gitattributes|\.editorconfig|\.gitkeep|\.nvmrc|\.python-version|\.tool-versions|\.prettierrc|\.npmignore|\.dockerignore)$/i;function an(e){return Ks.test(e.trim())}function ba(e){return!an(e)&&Us.test(e.trim())}function _a(e){let n=e.trim();return!Ee(n)&&!Gs.test(n.split("/").at(-1))&&!/\.(md|mdx|txt|text|jsonl?|ndjson|csv|tsv|pdf|rst|adoc|ini|cfg|ya?ml|toml|lock|png|jpe?g|gif|svg|ico|webp|avif|bmp|tiff?)$/i.test(n)}function Co(e){return{salesforce:"Salesforce",slack:"Slack",s3:"S3",anthropic:"Anthropic","http-client":"HTTP client"}[e.toLowerCase()]??e}function jo(e){let n=new Map;for(let t of e)!t.unitKey||!t.scope||(n.has(t.scope)||n.set(t.scope,new Map),n.get(t.scope).set(t.unitKey,t.id));return e.flatMap(t=>!t.unitKey||!t.scope?[]:(t.links??[]).flatMap(o=>{let r=n.get(t.scope)?.get(o.to);return r?[{from:t.id,to:r,kind:"invokes",label:o.kind,sourceRef:o.source??null}]:[]}))}function Rt(e){return e.CF_IMPORT_CALLS==="1"}function Re(e){return e.CF_IMPORT_LAYOUTS==="1"}import{relative as mi,sep as di}from"node:path";function ce(e,n){return e.CF_IMPORT_COVERAGE==="1"&&(n===void 0||e[n]==="1")}function H(e){return ce(e,"CF_IMPORT_LAYOUTS")}var vt=["eval","evals"],zs=new RegExp(`(^|/)(${[...vt,"evaluations?","bench(?:mark)?s?"].join("|")})/`,"i"),Vs=/^(evals?|bench(?:mark)?s?)[_-].+|.+[._-](evals?|bench(?:mark)?s?)[._-]/i;function To(e,n){if(zs.test(e))return!0;let t=z(e);if((t||/\.(json|ya?ml|toml)$/i.test(e))&&Vs.test(e.split("/").at(-1)))return!0;if(!t||n===void 0||!/(^|\/)scripts\//i.test(e))return!1;let o=X(e,n,t),{toks:r}=o;if(r.some((f,d)=>v(f,"export")||v(f,"exports")||t==="py"&&v(f,"def")||v(f,"module")&&h(r[d+1],".")&&v(r[d+2],"exports"))||!r.some(f=>v(f)&&/^(expected|dataset|fixtures|cases)$/i.test(f.text)))return!1;let s=r.flatMap((f,d)=>v(f)&&h(r[d+1],"(")&&!["for","if","while","switch","catch"].includes(f.text)&&!["function","def","class"].includes(r[d-1]?.text)?[d]:[]),i=q(o).filter(f=>f.names.some(d=>s.some(S=>v(r[S],d)&&!h(r[S-1],".")))),a=/(^|[/._-])(scores?|scoring|graders?|grading|evals?|evaluators?|bench(?:mark)?s?)([/._-]|$)/i,c=i.filter(f=>f.source.startsWith(".")&&/(^|[/._-])(agents?|runners?)([/._-]|$)/i.test(f.source)),p=[...c,...i.filter(f=>a.test(f.source))],u=new Set(p.flatMap(f=>f.names));return s.some(f=>h(r[f-1],".")?!(v(r[f-2],"console")&&["log","table"].includes(r[f].text)):v(r[f],"require")&&r[f+2]?.kind==="string"&&p.some(d=>d.source===r[f+2].value)?!1:!u.has(r[f].text)&&!(t==="py"&&v(r[f],"print")))?!1:i.some(f=>a.test(f.source))&&c.some(f=>!a.test(f.source))}var Do=/(^|\/)(__tests__|__snapshots__)\/|\.(test|spec)\.[jt]sx?$|_test\.(go|py)$/i,cn=new Set(["test","tests","__tests__","spec","specs","testdata","test-data","test_data","test-support","mocks","fixtures","fixture","__fixtures__","__mocks__","__snapshots__"]),Bo=/^(examples?|samples?)(?:[-_].+)?$|^.+[-_](examples?|samples?)$/i,Wo=/\.(test|spec)\..+|^test_.*\.py$|_test\.(py|go)$|_spec\.rb$|^conftest\.py$/i,Xs=new Set([...cn].filter(e=>!["test","tests","__tests__","spec","specs"].includes(e))),qs=new Set([".github","cassettes"]),Js=new Set,Fo=new WeakMap;function Pt(e){if(!ce(e))return[];let n=Fo.get(e);if(n)return n;let t=[];try{let o=JSON.parse(e.CF_IMPORT_SCOPES??"[]");Array.isArray(o)&&o.every(r=>{if(!r||typeof r!="object"||!["runtime","example","evaluator"].includes(r.kind)||typeof r.path!="string")return!1;let s=r.path.endsWith("/**"),l=s?r.path.slice(0,-3):r.path;return!!l&&!/[\\\0:*?]/.test(l)&&!l.split("/").some(i=>!i||i==="."||i==="..")&&!(r.kind==="evaluator"&&s)})&&new Set(o.map(r=>r.path)).size===o.length&&(t=Object.freeze(o.map(({path:r,kind:s})=>Object.freeze({path:r,kind:s}))))}catch{}return Fo.set(e,t),t}function ve(e,n,t){let o=U(n,t);if(o===null)return;let r=Pt(e).filter(i=>i.path.endsWith("/**")?n.startsWith(i.path.slice(0,-2)):n===i.path).sort((i,a)=>a.path.replace(/\/\*\*$/,"").length-i.path.replace(/\/\*\*$/,"").length)[0];if(!r||r.kind==="runtime")return;let s=o.split("/"),l=s.pop();if(!(s.some(i=>Xs.has(i.toLowerCase())||qs.has(i.toLowerCase()))||/^conftest\.py$/i.test(l))&&!(r.kind==="example"&&(Wo.test(l)||s.some(i=>cn.has(i.toLowerCase())))))return r}function fn(e,n,t={}){return!Pt(e).some(r=>r.kind!=="runtime"&&(U(r.path,t.root)!==null||r.path.endsWith("/**")&&U(`${Ue(t.root)}/`,r.path.slice(0,-3))!==null))||ve(e,n,t.root)?!1:$t(n,{root:t.root??void 0,listing:t.listing??Js})!==null}var Ys=new Set(["example-agents","examples","example","fixtures","__fixtures__","testdata","test","tests","__tests__","demo","demos"]),Hs=/^examples?[-_]/i;function Ko(e,n,t){if(e.CF_IMPORT_INCLUDE_EXAMPLES==="1"||ve(e,n,t))return!1;let o=ce(e),r=l=>Ys.has(l.toLowerCase())||Hs.test(l)||o&&(l.toLowerCase()==="fixture"||Bo.test(l));if(Ue(t).split("/").some(r))return!1;let s=U(n,t);return s!==null&&s.split("/").slice(0,-1).some(r)}var No=new WeakMap;function Zs(e){let n=No.get(e);if(n)return n;let t={exact:new Set,foldedNames:new Set};for(let o of e.keys()){let r=0;for(let s=o.indexOf("/");s!==-1;s=o.indexOf("/",r))t.exact.add(o.slice(0,s)),t.foldedNames.add(o.slice(0,r)+o.slice(r,s).toLowerCase()),r=s+1}return No.set(e,t),t}function Qs(e,n,t){let o=e.some(r=>$t(n(r),t)===null);return r=>{if(t.settings&&ve(t.settings,r,t.root))return!1;if(t.settings&&fn(t.settings,r,t))return!0;let s=$t(r,t);return s==="test"||s==="example"&&o}}function Uo(e,n,t){let o=Qs(e,n,t),r=[],s=[];for(let l of e)(o(n(l))?s:r).push(l);return{kept:r,skipped:s}}function un(e,n){return $t(e,n)!==null}function $t(e,n){let t=U(e,n.root);return t?ei(e,t,n):null}function ei(e,n,t){let o=Zs(t.listing),r=e.endsWith("/")||o.exact.has(e),s=n.split("/").filter(Boolean),l=r?"":s.pop()??"";return Wo.test(l)||s.some(a=>cn.has(a.toLowerCase()))?"test":s.some((a,c)=>{let p=a.toLowerCase();if(Bo.test(p))return!0;if(p!=="before"&&p!=="after")return!1;let u=Ue(Ge(s.slice(0,c).join("/"),t.root)),f=u?`${u}/`:"",d=p==="before"?"after":"before";return o.foldedNames.has(f+d)})?"example":null}var ti=new Set,Go=new WeakMap;function zo(e,n){let t={root:n.root,listing:n.listing??ti};if(!un(e,t))return!1;let o=n.listing;if(!o?.has(e))return!0;let r=Go.get(o);r||Go.set(o,r=new WeakMap);let s=r.get(n.settings);s||r.set(n.settings,s=new Map);let l=s.get(n.key);if(!l){let i=[...o.keys()].filter(a=>un(a,t)||n.readable(a,"get"in o?o.get(a):void 0));l=new Set(Uo(i,a=>a,t).skipped),s.set(n.key,l)}return l.has(e)}function Vo(e){return e.CF_IMPORT_EXAMPLE_FILTER!=="0"}import{posix as pn}from"node:path";var mn=e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");function de(e,n={}){let t=`(?:${He.map(mn).join("|")})`,o=`(?:${Lt.map(mn).join("|")})`,s=new RegExp(`^(${n.nested?"(?:.*?/)??":""}(?:(${t}/[^/]+)/${$e}|${o})/([^/]+))/(.+)$`,n.caseSensitive?"":"i").exec(e);if(!s)return null;let l=n.caseSensitive?s[4]:s[4].toLowerCase(),i=n.caseSensitive?G.skill:G.skill.toLowerCase();return{folder:s[1],name:s[3],definition:l===i,reference:l.startsWith("references/"),...s[2]?{ownerPath:s[1].replace(/\/skills\/[^/]+$/i,".md")}:{}}}function dn(e){return de(e)?.reference??!1}function ni(e){return ce(e,"CF_DISCOVERY_SKILLS")}function oi(e){return!/[\\:\0]/.test(e)&&e.split("/").every(n=>n&&n!=="."&&n!=="..")}function ri(e){let n=[],t;for(let[o,r]of e.split(/\r?\n/).entries()){let s=/^ {0,3}(`{3,}|~{3,})(.*)$/.exec(r);if(t){if(s&&s[1][0]===t.marker[0]&&s[1].length>=t.marker.length&&!s[2].trim()){t=void 0;continue}if(!t.shell||!/^\s*(?:\$\s+)?(?:cat|less|more|head|tail)\s+/.test(r))continue}if(!t&&s){t={marker:s[1],shell:/^(?:sh|bash|shell|console)?$/i.test(s[2].trim())};continue}let l=/!?\[[^\]\n]*\]\(\s*(?:<([^>\n]+)>|([^\s)\n]+))(?:\s+["'][^"'\n]*["'])?\s*\)|^\s*\[[^\]]+\]:\s*(?:<([^>]+)>|(\S+))|`([^`\n]+)`|([^\s`<>"'()[\],;]+)/g;for(let i of r.matchAll(l)){let a=i.slice(1,5).some(d=>d!==void 0),c=i[1]??i[2]??i[3]??i[4]??i[5]??i[6],p=a?c:c.replace(/[.,;:]+$/,""),u=/^[^.\s][^\s]*\.(?:md|mdx|rst|txt|html?|json|ya?ml|toml|csv|ts|tsx|js|jsx|mjs|cjs|py|go|java|rb|rs|sh|prompt)(?:#.*)?$/i.test(p.split(/[/\\]/).at(-1)??""),f=i[5]!==void 0&&/[/\\]/.test(p)||/^\.{1,2}[/\\]/.test(p);p.startsWith("#")||!a&&(/\s/.test(p)||!(f||u))||n.push({target:p,span:{from:o+1,to:o+1},explicit:a||i[5]!==void 0,fileLike:u||f})}}return n}function si(e,n,t,o=!1){let r=n.split("#")[0];if(!r||/[\\:\0*?[\]$]/.test(r)||r.startsWith("/")||/[{}]/.test(r.replace(/(?:^|\/)\{lang\}(?=\/)/g,""))||o&&/[\s<>{}%~]/.test(r))return{reason:"unsupported"};let s=pn.normalize(pn.join(pn.dirname(e),r));return s===".."||s.startsWith("../")||U(s,t)===null?{reason:"out-of-scope"}:{path:s}}function Ga(e,n){let t={references:[],cycles:[],unresolved:[]};if(!ni(e))return t;let o=[...new Set(n.paths)].filter(s=>oi(s)&&U(s,n.root)!==null).sort(),r=new Set(o);for(let s of[...new Set(n.skillPaths)].sort()){if(!r.has(s)||!de(s,{nested:!0})?.definition)continue;let l=new Set,i=new Set,a=c=>{if(!(l.has(c)||!Object.hasOwn(n.files,c))){l.add(c),i.add(c);for(let{target:p,span:u}of ri(n.files[c])){let f=E=>t.unresolved.push({ownerPath:s,fromPath:c,target:p,span:u,reason:E}),d=si(c,p,n.root);if(d.reason){f(d.reason);continue}let S=d.path,_=new RegExp(`^${S.split("/").map(E=>E==="{lang}"?"[^/]+":mn(E)).join("/")}$`),g=S.includes("{lang}")?o.filter(E=>_.test(E)):r.has(S)?[S]:[];if(!g.length){f("missing");continue}for(let E of g){let R={ownerPath:s,fromPath:c,path:E,span:u};i.has(E)?t.cycles.push(R):(t.references.push(R),a(E))}}i.delete(c)}};a(s)}return t}var Pe=/\.(?:md|txt|j2|hbs|mustache|prompt)$/i,Xo=/(?:^|[/\\])(?:prompts?|templates?|instructions)(?=$|[/\\])/i,ii=/prompt|instructions|system/i,li=200;function At(e){if(!Pe.test(e))return!1;let n=e.split("/"),t=n[n.length-1];return n.slice(0,-1).some(r=>r.toLowerCase()==="prompts")||ii.test(t)}function qo(e,n){return!At(e)||Buffer.byteLength(n)<li?null:ai(e,n)}function ai(e,n){let t=Buffer.byteLength(n),o=n.split(`
3
+ `).length;return{kind:"file",named:!1,prose:!1,path:e,start:0,line:1,endLine:o,span:{from:1,to:o},symbol:null,chars:t,excerpt:_e(n),enclosing:null}}function Xa(e,n){let t=e.toks[n.from];return n.to!==n.from+1||t?.kind!=="string"||!Be(t).closed?null:{kind:"named",named:!0,prose:!1,path:e.path,start:t.start,line:t.line,endLine:t.endLine,span:{from:t.line,to:t.endLine},symbol:null,chars:t.value.length,excerpt:_e(t.value),enclosing:null}}function hn(e){return/(?:^|\/)(?:pyproject\.toml|requirements\.txt)$/i.test(e)}function Ja(e,n){if(!hn(e))return!1;let t=n.split(/\r?\n/).map(s=>s.replace(/("(?:\\.|[^"\\])*"|'[^']*')|#.*/g,(l,i)=>i??""));if(/(?:^|\/)requirements\.txt$/i.test(e))return t.some(s=>/^\s*openai[-_.]agents(?:\[[^\]]*\])?(?=\s*(?:$|[<>=!~;@#]))/i.test(s));let o="",r=new Map;for(let s of t){let l=/^\s*\[([^\]]+)\]/.exec(s);l?o=l[1]:(r.has(o)||r.set(o,[]),r.get(o).push(s))}for(let[s,l]of r){let i=l.join(`
4
+ `);if(/^tool\.poetry(?:\.group\.[^.]+)?\.dependencies$/.test(s)){if(/^\s*["']?openai[-_.]agents["']?\s*=/im.test(i))return!0}else if(["project","project.optional-dependencies","dependency-groups"].includes(s)){let a=/^\s*([\w."'-]+)\s*=\s*\[((?:"(?:\\.|[^"\\])*"|'[^']*'|[^\]"'])*)\]/gm;for(let c of i.matchAll(a))if(!(s==="project"&&c[1].replace(/["']/g,"")!=="dependencies")&&/["']openai[-_.]agents(?=["'[<>=!~ ;@])/i.test(c[2]))return!0}}return!1}function Jo(e){return/\.json$/i.test(e)?"json":/\.ya?ml$/i.test(e)?"yaml":z(e)||/\.(cs|go|rb|java)$/i.test(e)?"code":/\.(md|markdown)$/i.test(e)?"markdown":"text"}import{posix as te}from"node:path";function Yo(e,n){if(n==="markdown"){let i=e.startsWith("---")?e.indexOf(`
5
+ ---`,3):-1;return i<0?null:{start:3,end:i+1,bodyStart:i+4,newline:`
6
+ `,raw:e.slice(3,i).split(`
7
+ `)}}if(n==="outline"){let i=e.split(`
8
+ `),a=i[0]==="---"?i.indexOf("---",1):-1;if(a<0)return null;let c=i.slice(0,a).join(`
9
+ `).length+1;return{start:4,end:c,bodyStart:Math.min(e.length,c+4),newline:`
10
+ `,raw:i.slice(1,a)}}let t=/^\uFEFF?---(\r?\n)/.exec(e);if(!t)return null;let o=e.slice(t[0].length),r=/^---(?:\r?\n|$)/m.exec(o);if(!r)return null;let s=o.slice(0,r.index),l=t[0].length+r.index;return{start:t[0].length,end:l,bodyStart:l+r[0].length,newline:t[1],raw:s?s.slice(0,-1).split(`
11
+ `):[]}}function Zo(e){return(e.startsWith('"')?e.match(/^"((?:\\.|[^"\\])*)"\s*(?:#.*)?$/):e.match(/^'((?:''|[^'])*)'\s*(?:#.*)?$/))?.[1]??null}function Ho(e,n=!1){if(!e||e.startsWith("#"))return null;if(e.startsWith('"')||e.startsWith("'"))return Zo(e);let t=e.replace(/\s+#.*$/,"");if(n&&/:\s*$/.test(t))return null;let o=n?t.trimEnd():t;return/^[[\]{}&*!?@`%|>]|^-(?:\s|$)|:\s/.test(o)||/^(?:[-+]?\d|[-+]?\.\d|[-+]?\.(?:inf|nan)$|null$|~$|true$|false$|yes$|no$|on$|off$|y$|n$)/i.test(o)?null:t}function ci(e,n=!1,t=!1){let o=[],r=new Map,s=null;return e.map(l=>{let i=l.replace(/\r$/,""),a=i.length-i.trimStart().length,c=()=>o.map(({key:_})=>_).join(".")||null;if(s&&(!i.trim()||a>s.indent))return i.trim()&&(s.contentIndent??=a),{location:c(),text:i.slice(s.contentIndent??a),keys:s.keys};if(s=null,!i.trim()||i.trimStart().startsWith("#"))return{location:c()};for(;o.length&&o.at(-1).indent>=a;)o.pop();if(t&&/^\s*-\s/.test(i)){let _=o.map(({key:R})=>R),g=JSON.stringify(_),E=r.get(g)??0;return r.set(g,E+1),{location:c(),keys:[..._,E]}}let p=i.match(/^\s*([\w.-]+):(?:\s+(.*))?$/);if(!p)return{location:c()};let u=p[2]??"",f=[...o.map(({key:_})=>_),p[1]];if(!u||u.startsWith("#"))return o.push({indent:a,key:p[1]}),{location:c(),...t?{keys:f}:{}};if(/^[|>][+-]?\s*(?:#.*)?$/.test(u))return s={indent:a,keys:f},{location:c()};let d=u.match(/^(["'])(.*)\1\s*(?:#.*)?$/),S=n?Zo(u)??u.replace(/\s+#.*$/,""):d?d[2]:u.replace(/\s+#.*$/,"");return{location:c(),text:S,keys:f}})}function gn(e,n={}){let t=e.split(`
12
+ `).map(l=>l.replace(/\r$/,"")),o=ci(t,!0),r={},s=[{indent:-1,value:r}];for(let l=0;l<t.length;l++){let i=t[l];if(!i.trim()||i.trimStart().startsWith("#"))continue;if(i.includes(" "))return null;let a=i.length-i.trimStart().length,c=i.match(/^\s*([\w.-]+):(?:\s+(.*))?$/),p=i.match(/^\s*-(?:\s+(.*))?$/);if(!c&&!p)return null;for(;s.at(-1).indent>=a;)s.pop();let u=s.at(-1);if(u.childIndent??=a,u.childIndent!==a||u.indent===-1&&a!==0)return null;if(p){if(!n.lists)return null;let S=Ho(p[1]??"",!0);if(S===null||s.length===1)return null;if(!Array.isArray(u.value)){if(Object.keys(u.value).length)return null;u.value=[],Object.defineProperty(s.at(-2).value,u.key,{value:u.value,enumerable:!0,writable:!0})}u.value.push(S);continue}if(!c||Array.isArray(u.value)||Object.hasOwn(u.value,c[1]))return null;let f=c[2]??"";if(!f||f.startsWith("#")){let S={};Object.defineProperty(u.value,c[1],{value:S,enumerable:!0,writable:!0}),s.push({indent:a,key:c[1],value:S});continue}let d;if(/^[|>][+-]?\s*(?:#.*)?$/.test(f)){let S=l+1,_;for(;l+1<t.length;){let E=t[l+1],R=E.length-E.trimStart().length;if(E.trim()&&R<=a)break;if(E.includes(" ")||E.trim()&&(_??=R,R<_))return null;l++}let g=l;d=o.slice(S,g+1).flatMap(({text:E})=>E===void 0?[]:[E]).join(`
13
+ `)}else{let S=Ho(f);if(S===null)return null;d=S}Object.defineProperty(u.value,c[1],{value:d,enumerable:!0,writable:!0})}return r}function ec(e){let n=gn(e,{lists:!0});return n?xn(e,{legacyBoundaries:!0}).map(t=>({key:t.key,value:n[t.key],span:t.span})):null}function xn(e,n={}){let t=e.split(`
14
+ `),o=t.flatMap((r,s)=>(n.legacyBoundaries?r.trim()&&!/^\s|^#/.test(r):/^[\w.-]+:(?:\s|$)/.test(r))?[s]:[]);return o.map((r,s)=>{let l=t[r].slice(0,t[r].indexOf(":")),i=o[s+1]??t.length;for(;i>o[s]+1&&!t[i-1].trim();)i--;return{key:l,span:{from:r+1,to:i}}})}function Sn(e){let n=e.split(/^---(?:\s+#.*)?\s*$/m);if(n.length>1)return[...new Set(n.flatMap(Sn))];let t=e.split(`
15
+ `).filter(l=>l.trim()&&!/^\s*(?:#|---\s*$|\.\.\.\s*$|%[A-Z])/.test(l)),o=t.join(`
16
+ `).trimStart().replace(/^(?:(?:&[\w.-]+|!<[^>]+>|![\w:/.!-]+)\s+)+/,"");if(o.startsWith("{"))return fi(o);let r=l=>l.length-l.trimStart().length,s=t.reduce((l,i)=>Math.min(l,r(i)),1/0);return t.flatMap(l=>{let i=/^["']?([\w.-]+)["']?\s*:/.exec(l.trimStart());return r(l)===s&&i?[i[1]]:[]})}function fi(e){let n=[],t=[],o="",r=!1;for(let s=0;s<e.length;s++){let l=e[s];if(o){l==="\\"&&o==='"'?s++:l===o&&(o==="'"&&e[s+1]==="'"?s++:o="");continue}if(l==="#"&&/\s/.test(e[s-1]??" ")){for(;s<e.length&&e[s]!==`
17
+ `;)s++;continue}if(r&&t.length===1&&!/\s/.test(l)&&l!=="}"&&l!=="?"){let i=/^(?:"((?:\\.|[^"\\])*)"|'((?:''|[^'])*)'|([\w.-]+))\s*:/.exec(e.slice(s));if(!i)return[];try{n.push(i[1]!==void 0?JSON.parse(`"${i[1]}"`):i[2]?.replace(/''/g,"'")??i[3])}catch{return[]}s+=i[0].length-1,r=!1;continue}if(l==='"'||l==="'")o=l;else if(l==="{"||l==="[")t.push(l),t.length===1&&(r=!0);else if(l==="}"||l==="]"){if(t.pop()!==(l==="}"?"{":"["))return[];if(!t.length)return n}else l===","&&t.length===1&&(r=!0)}return[]}function Qe(e,n){return H(e)?[...new Set(n)].filter(t=>er(t)&&/(?:^|\/)\.claude-plugin\/(?:plugin|marketplace)\.json$/i.test(t)).sort():[]}function sc(e,n,t={}){return Qe(e,n).flatMap(o=>{let r=/^(?:(.*)\/)?\.claude-plugin\/plugin\.json$/i.exec(o);if(r)return[{folder:r[1]??"",path:o}];let s=o.split("/").slice(0,-2).join("/");try{let l=JSON.parse(t[o]);return!l||typeof l!="object"||!("plugins"in l)||!Array.isArray(l.plugins)?[]:[...new Set(l.plugins.flatMap(i=>{if(!i||typeof i!="object"||typeof i.source!="string")return[];let a=i.source.replace(/^\.\//,"");return er(a)?[Ge(a,s)]:[]}))].map(i=>({folder:i,path:o}))}catch{return[]}})}function er(e){return!/[\\:\0?*#%]/.test(e)&&!e.split("/").some(n=>!n||n==="."||n==="..")}function ic(e,n,t){let o=n.split("/");for(let r=0;r<o.length-2;r++)if(!(o[r].toLowerCase()!=="plugins"||!o[r+1])&&Qo(e,o.slice(r+2).join("/")))return o.slice(0,r+2).join("/");for(let r of[...t].sort((s,l)=>l.folder.length-s.folder.length)){let s=U(n,r.folder);if(s!==null&&Qo(e,s))return r.folder}return null}function Qo(e,n){return n.toLowerCase().startsWith(`${Ze}/`)&&yn.test(n)||!!(Le(e)&&n.toLowerCase().startsWith(`${$e}/`)&&de(n)?.definition)}function kn(e,n,t={}){if(!H(e))return[];let o=[...new Set(n)].filter(s=>!/[\\:\0]/.test(s)&&s.split("/").every(l=>l&&l!=="."&&l!=="..")).sort(),r=new Map;for(let s of o){let l=/^(?:(.*)\/)?environments\/[^/]+\.ya?ml$/i.exec(s),i=/^(?:(.*)\/)?agents\/[^/]+\/environment\.ya?ml$/i.exec(s),a=l?.[1]??i?.[1]??(l||i?"":null);if(a===null||r.has(a))continue;let c=f=>U(f,a),p=o.filter(f=>/^agents\/(?:[^/]+\.md|[^/]+\/agent\.md)$/i.test(c(f)??""));if(!p.length)continue;let u=o.filter(f=>/^(?:environments\/[^/]+\.ya?ml|vaults\/[^/]+\.ya?ml|policy\.ya?ml|agents\/[^/]+\/(?:environment|policy|vault)\.ya?ml|skills\/[^/]+\/SKILL\.md)$/i.test(c(f)??""));r.set(a,{folder:a,agents:p,configs:u})}for(let s of r.values())for(let l of s.agents){if(t[l]===void 0)continue;let i=ui(l,t[l],s,o);for(let a of i.configPaths)s.configs.includes(a)||s.configs.push(a);for(let a of i.relationships)a.kind==="config"&&t[a.path]!==void 0&&pi(t[a.path])&&!s.configs.includes(a.path)&&s.configs.push(a.path)}return[...r.values()].sort((s,l)=>s.folder<l.folder?-1:s.folder>l.folder?1:0)}function hc(e,n,t){let o=kn(e,n,t).filter(s=>s.agents.some(l=>t[l]===void 0)),r=new Set(Qe(e,n));return n.filter(s=>!r.has(s)&&/\.(?:ya?ml|json|md)$/i.test(s)&&o.some(l=>U(s,l.folder)!==null&&!l.agents.includes(s)&&!l.configs.includes(s)))}function ui(e,n,t,o){let r=Yo(n),s=r?.raw.join(`
18
+ `)??"",l=new Map(xn(s).map(g=>[g.key,s.split(`
19
+ `).slice(g.span.from-1,g.span.to).join(`
20
+ `)])),i=g=>l.has(g)?gn(l.get(g),{lists:!0})?.[g]:void 0,a=g=>typeof i(g)=="string"?i(g):null,c={path:e,name:a("name")??te.basename(e,".md"),model:a("model"),description:a("description"),prompt:r?n.slice(r.bodyStart).trim():n.trim(),relationships:[],refused:[],configPaths:[]};r||c.refused.push({path:e,reason:"invalid"});let p=(g,E,R=!1)=>{if(/[\\:\0${}*]/.test(g)||g.startsWith("/")){c.refused.push({path:e,reason:"dynamic"});return}let b=te.normalize(te.join(te.dirname(e),g));if(U(b,t.folder)===null||b===".."||b.startsWith("../")){c.refused.push({path:b,reason:"out-of-scope"});return}if(!o.includes(b)){c.refused.push({path:b,reason:"missing"});return}if(E==="agent"&&!t.agents.includes(b)){c.refused.push({path:b,reason:"out-of-scope"});return}c.relationships.some(m=>m.path===b&&m.kind===E)||c.relationships.push({path:b,kind:E}),R&&!c.configPaths.includes(b)&&c.configPaths.push(b)},u=(g,E)=>{let R=i(g);if(R===void 0&&!l.has(g))return;let b=typeof R=="string"?[R]:Array.isArray(R)?R:[];if(!b.length||b.some(m=>typeof m!="string")){c.refused.push({path:e,reason:"dynamic"});return}for(let m of b)p(m,E,E==="config")};for(let g of["environment","policy","vault","vault_schema"])u(g,"config");u("skills","skill");let f=i("multiagent");if(f&&typeof f=="object"&&"agents"in f&&Array.isArray(f.agents))for(let g of f.agents)typeof g=="string"?p(g,"agent"):c.refused.push({path:e,reason:"dynamic"});else l.has("multiagent")&&c.refused.push({path:e,reason:"dynamic"});let d=te.basename(e,".md"),S=d.toLowerCase()==="agent",_=S?t.configs.filter(g=>te.dirname(g)===te.dirname(e)&&/\/environment\.ya?ml$/i.test(g)):t.configs.filter(g=>U(g,t.folder)?.match(/^environments\/([^/]+)\.ya?ml$/i)?.[1]===d);if(!l.has("environment")){let g=t.agents.length===1?t.configs.filter(E=>/^environments\/[^/]+\.ya?ml$/i.test(U(E,t.folder))):[];for(let E of _.length?_:g.length===1?g:[])p(te.relative(te.dirname(e),E),"config")}if(!l.has("policy")&&(S||t.agents.length===1))for(let g of t.configs.filter(E=>/(?:^|\/)policy\.ya?ml$/i.test(E)&&te.dirname(E)===(S?te.dirname(e):t.folder)))p(te.relative(te.dirname(e),g),"config");for(let g of c.prompt.matchAll(/(?:\]\(|[`\s])((?:\.\.?\/)[^\s`"'()]+\.(?:ya?ml|json|md))(?:[)`\s]|$)/g))p(g[1],/\/SKILL\.md$/i.test(g[1])?"skill":"config");return c}function pi(e){let n=/^(?:config|networking|filesystem_policy|network_policies|policy|permissions|auth|injection_location|secret_name)$/;return Sn(e).some(t=>n.test(t))}function zc(e){return e==="skill"?"skill":"definition"}var _n=class extends Error{reason;constructor(n,t){super(n==="secret"?_t(t):n==="secret-content"?go(t):`File was not read: ${n}.`),this.reason=n}},Rn=["html"],rr=["md","json","yaml","yml",...Rn],vn=e=>new RegExp(`\\.(?:${e.join("|")})$`,"i"),hi=vn(rr),gi=vn(Rn),xi=vn(["ts","tsx","js","jsx","py","go","rb","java","rs","toml",...rr.filter(e=>!Rn.includes(e))]);function sr(e,n,t){return n=Ct(e,n,t),dn(n)&&gi.test(n)}function Si(e,n,t){return n=Ct(e,n,t),dn(n)&&hi.test(n)&&(Le(e)||!sr(e,n))}function yi(e,n,t){return xi.test(n)||Si(e,n,t)||ce(e)&&At(n)}function ir(e,n,t=[]){if(!Re(e)||!n.toLowerCase().endsWith(".md"))return!1;let o=n.split("/");return o.some((r,s)=>r.toLowerCase()==="commands"&&s<o.length-1&&(o[s-1]?.toLowerCase()===Ae||t.includes(o.slice(0,s).join("/"))))}function lr(e,n,t=!1){if(!ln(n,t)||ir(e,n))return!1;let o=[Ae,...It.filter(s=>s.startsWith(".")),G.cli],r="";for(let s of n.toLowerCase().split("/")){let l=r?`${r}/${s}`:s,i=Qe(e,[l]).length>0,a=H(e)&&(s===".claude-plugin"||i);if(s.startsWith(".")&&!o.includes(s)&&!a||r.split("/").at(-1)===".claude-plugin"&&!i||r===Ae&&!He.includes(`${r}/${s}`)&&!(Lt.includes(`${r}/${s}`)&&Le(e)))return!1;r=r?`${r}/${s}`:s}return!0}var ar=/(prompt|tool|agent|config|instruction)/i,tr=/\.(md|json|ts|js|py|yaml|yml|txt)$/i,tt=/(^|\/)(package-lock\.json|yarn\.lock|pnpm-lock\.yaml|poetry\.lock|Cargo\.lock|go\.sum)$|\.lock$/i,ki=/(^|\/)(node_modules|dist|build|out|vendor|target|__pycache__|coverage)\//i,nt=new RegExp(`${ki.source}|\\.min\\.|\\.(png|jpg|jpeg|gif|svg|ico|woff2?|ttf|eot|pdf|zip|gz|jar|bin|map)$`,"i"),et=new RegExp(`${nt.source}|${Do.source}|${tt.source}|${sn.source}`,"i"),wi=/\.(ts|tsx|js|jsx|mjs|cjs|py)$/i,cr=new RegExp(`(^|/)(${vt.join("|")}|cassettes|docs|\\.github)/`,"i"),bi=/(^|\/)([^/]*\.stories\.[^/]*|[^/]*\.d\.ts)$/i,_i=new RegExp(`(^|/)(${["test","tests","__tests__","test-support","testdata","fixtures","__fixtures__",...vt,"cassettes","mocks","__mocks__","examples","docs","\\.github"].join("|")})/`,"i"),Ei=/(^|\/)([^/]*fixture[^/]*|[^/]*\.stories\.[^/]*|test_[^/]*\.py|conftest\.py|[^/]*\.d\.ts)$/i,Ot=/(^|\/)\.git\//i,wn=(e,n,t)=>t==="github"?Ke.conventionImport.fileBytes:void 0,Mt=()=>Ke.codeScan.fileBytes,Ri={entry:{hidden:!0,excluded:[nt,tt,Ot]},archive:{hidden:!1,discovery:!0,excluded:[nt,tt,Ot]},listing:{hidden:!0},definition:{hidden:!0,discovery:!0,limit:wn},skill:{hidden:!0,discovery:!0,limit:wn},extraction:{hidden:!0,discovery:!0,accepts:(e,n)=>tr.test(n),limit:wn},source:{hidden:!0,discovery:!0,excluded:[et],empty:!0,accepts:(e,n,t)=>bn(e,n,t)||yi(e,n,t),limit:(e,n,t,o)=>bn(e,n,o)?void 0:sr(e,n,o)?Ke.sourceFetch.htmlReferenceBytes:Ke.sourceFetch.codeFileBytes},"code-scan":{hidden:!0,discovery:!0,excluded:[et,cr,bi],relativeExclusions:!0,excludeExamples:!0,accepts:(e,n)=>wi.test(n)||At(n)||Re(e)&&hn(n)&&lr(e,n),limit:Mt},"code-support":{hidden:!0,excluded:[et],accepts:(e,n)=>z(n)!==null,limit:Mt},pointer:{hidden:!1,limit:Mt},proposal:{hidden:!0,excluded:[nt,tt,Ot],empty:!0,limit:Mt},survey:{hidden:!0,discovery:!0,excluded:[et,Ot],relativeExclusions:!0,accepts:(e,n)=>tr.test(n)||Jo(n)==="code",limit:()=>Ke.survey.fileBytes},override:{hidden:!1}};function Oe(e,n,t){return En(e,n,t,!0)}function Vc(e,n,t={}){let o=U(n.path,t.root);if(o===null)return!1;let r=Re(e),s=l=>["",...l.split("/").slice(0,-1).map((i,a,c)=>c.slice(0,a+1).join("/"))];return r&&(ir(e,n.path,s(n.path))||Pt(e).some(l=>l.kind!=="runtime"))?!1:(r?s(o):[""]).every(l=>{let i=Oe(e,n,{...t,purpose:"source",route:"github",...r?{scopes:{ownerOf:()=>({key:null,kind:"root",folder:l})}}:{}});return i.admitted||i.reason==="too-large"})}var vi=/(?:^|\/)(?:vault\.ya?ml|(?:vaults?|auth)\/(?:credentials?|values?|tokens?)(?:\.[^/]+)?)$/i;function $i(e){let n=e.path.replace(/\\/g,"/");if(e.text===void 0||!/\.(?:ya?ml|json|md)$/i.test(n))return!1;let t=e.text,o=/(?:^|[\n{,])\s*(?:-\s*)?["']?(?:secret(?:_value)?|api[_-]?key|access[_-]?token|refresh[_-]?token|token|password|client[_-]?secret|private[_-]?key|credentials?)["']?\s*:/gim,r=/(?:^|[\n{,])\s*(?:-\s*)?["']?[A-Z][A-Z0-9_]*(?:_KEY|_TOKEN|_PASSWORD|_SECRET)["']?\s*:/gm;return[...t.matchAll(o),...t.matchAll(r)].some(l=>!/^\s*(["']?)(?:\$\{[A-Z_][A-Z0-9_]*\}|\$[A-Z_][A-Z0-9_]*)\1[^\S\n]*(?:#[^\n]*)?(?:[,}\r\n]|$)/.test(t.slice(l.index+l[0].length)))||/["']?auth["']?\s*:/.test(t)&&/(?:^|[\n{,])\s*["']?value["']?\s*:/m.test(t)||/-----BEGIN (?:[A-Z ]*PRIVATE KEY|CERTIFICATE)-----/.test(t)}function En(e,n,t,o){let r=Lo(e,n,{...t,allowSelectedFile:t.purpose==="override",requireLocalTarget:t.purpose==="proposal"});if(!r.admitted)return r;let s=U(n.path,t.root);if(H(e)&&vi.test(n.path.replace(/\\/g,"/")))return{admitted:!1,reason:"secret"};if(H(e)&&$i(n)&&(!t.listing||kn(e,[...t.listing.keys()],n.text===void 0?t.managedFiles:{...t.managedFiles,[n.path]:n.text}).some(u=>u.configs.includes(n.path)&&!/\/SKILL\.md$/i.test(n.path))))return{admitted:!1,reason:"secret"};if(t.route==="local-folder"&&(t.purpose==="proposal"||t.purpose==="entry")&&t.localTarget){let u=mi(t.localTarget.root,t.localTarget.path).split(di).join("/"),f=En(e,{...n,path:u},{...t,root:void 0,localTarget:void 0,gitIgnored:t.purpose==="entry"?t.gitIgnored:void 0},o);if(!f.admitted)return f}let l=Ri[t.purpose];if(t.purpose==="proposal"&&Ee(s))return{admitted:!1,reason:"wrong-type"};if(l.discovery&&Ko(e,n.path,t.root))return{admitted:!1,reason:"excluded"};if(l.hidden&&t.route!=="github"&&!lr(e,n.path,n.directory))return{admitted:!1,reason:"hidden"};if(l.hidden&&t.route==="local-folder"&&n.path.split("/").includes("node_modules"))return{admitted:!1,reason:"excluded"};let i=l.relativeExclusions?s:n.path,a=ve(e,n.path,t.root);if(!["listing","pointer","override"].includes(t.purpose)&&fn(e,n.path,t))return{admitted:!1,reason:"excluded"};if(l.excluded?.some(u=>a&&u===cr?!1:a&&u===et?nt.test(i)||tt.test(i):u.test(i)))return{admitted:!1,reason:"excluded"};if(t.purpose==="archive"&&Rt(e)&&To(s,n.text)&&!a)return{admitted:!1,reason:"excluded"};if(l.excludeExamples&&!a){if(Vo(e)){if(o&&zo(n.path,{root:t.root??void 0,listing:t.listing,settings:e,key:JSON.stringify([t.root??"",t.route,...t.exclusions?.length?[t.exclusions]:[]]),readable:(u,f)=>En(e,{path:u,size:f},{...t,localTarget:void 0},!1).admitted}))return{admitted:!1,reason:"excluded"}}else if(_i.test(i)||Ei.test(i))return{admitted:!1,reason:"excluded"}}if(l.empty&&n.size!==void 0&&n.size<=0)return{admitted:!1,reason:"empty"};if(l.accepts&&!(a?.kind==="example"&&t.purpose==="code-scan"&&/\.md$/i.test(s))&&!l.accepts(e,s,t.scopes))return{admitted:!1,reason:"wrong-type"};let c=l.limit?.(e,s,t.route,t.scopes);if(c!==void 0&&n.size!==void 0&&n.size>c)return{admitted:!1,reason:"too-large"};let p=ho(e,n.text);return p?{admitted:!1,reason:p}:{admitted:!0}}var Pi=`
21
+ [The rest of this file was not read.]
22
+ `;async function Li(e,n,t,o={}){let r=Oe(e,n,{purpose:"override",route:"github",...o});if(!r.admitted)throw new Error(r.reason==="secret"?_t(n.path):`File was not read: ${r.reason}.`);let s=await t(),l=Oe(e,{path:n.path,text:s},{purpose:"override",route:"github",...o});if(!l.admitted)throw new _n(l.reason,n.path);if(n.readBytes===void 0)return s;let i=Buffer.from(s,"utf8");if(i.length<=n.readBytes)return s;let a=Math.min(n.readBytes,i.length);for(;a>0&&(i[a]&192)===128;)a--;return i.subarray(0,a).toString("utf8")+Pi}var Ai=4096;function Oi(e,n,t,o={}){let r=Zt(e),s=r&&n.readBytes!==void 0?n.readBytes+Ai:void 0;return Li(e,r?n:{path:n.path},async()=>{let l=await t(s===void 0?n:{...n,readBytes:s});if(l===null)throw new Error("File is unavailable.");return s===void 0?l:Buffer.from(l.slice(0,s),"utf8").subarray(0,s).toString("utf8")},o)}var nr=new WeakMap;function Mi(e,n){let t=nr.get(n);if(t?.settings===e)return n;n=t?.source??n;let o=n.admission;if(!o?.exclusions?.length&&!Zt(e))return n;let r,s=()=>r??=(n.listAll?n.listAll():n.list()).then(a=>new Set(a.map(c=>c.path))),l=async a=>{let c=await(a&&n.listAll?n.listAll():n.list());return o?.exclusions?.length?c.filter(p=>Oe(e,p,{purpose:"override",route:"github",...o}).admitted):c},i={repoKey:n.repoKey,root:n.root,source:n.source,admission:o,head:()=>n.head(),linkFor:(...a)=>n.linkFor(...a),list:()=>l(!1),...n.listAll?{listAll:()=>l(!0)}:{},read:async a=>Oi(e,a,c=>n.read(c),{...o,...H(e)?{listing:await s()}:{}})};return nr.set(i,{source:n,settings:e}),i}async function Xc(e,n,t){for(let o of t){if(!o.admission?.exclusions?.length)continue;let r=n.repos?.find(c=>c.key===o.repoKey);if(!r)continue;let s=new Map(or(n.projectAgents,r.key).map(c=>[c.path,Ge(c.sourcePath,St(r.key))])),l=[...Object.keys(r.files??{}).map(c=>s.get(c)??c),...s.values(),...(r.selected??[]).map(c=>c.path),...(r.scan?.plan??[]).map(c=>c.path)];if(!l.length)continue;let i=Mi(e,o),a=new Set((await(i.listAll?i.listAll():i.list())).map(c=>c.path));for(let c of l)if(!Oe(e,{path:c},{purpose:"override",route:"github",...o.admission,listing:a}).admitted)throw new Error("Saved files conflict with the current exclusions. Start a new analysis.")}}var Pn="readme";function tf(e){let n=e.toLowerCase();return n.startsWith(Pn)?0:n===G.agentGuide?1:n.endsWith(".md")&&e.split("/").length<=2?2:ar.test(e)?3:null}var G={systemPrompt:"system_prompt.md",hyphenatedPrompt:"system-prompt.md",unseparatedPrompt:"systemprompt.md",system:"system.md",prompt:"prompt.md",promptFallback:"CLAUDE.md",soul:"soul.md",knowledge:"knowledge.md",tools:"tools.json",toolsSource:"tools.ts",cli:".cli.json",config:"counterfact.json",skill:"SKILL.md",readme:`${Pn}.md`,agentGuide:"agents.md"},ot=[G.systemPrompt,G.hyphenatedPrompt,G.system,G.prompt],Ln=G.promptFallback,Ii=[...ot,Ln].map(e=>e.toLowerCase()),It=[".mcp.json","mcp.json"],Ci=[G.toolsSource,G.cli],Ae=".claude",Ze="agents",$e="skills",He=[`${Ae}/${Ze}`,Ze],nf=/^(?:\.claude\/)?(skills|commands)\//i,Lt=[$e,`${Ae}/${$e}`],ji=e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),Ti=e=>e.map(ji).join("|"),Fi=`(?:${Ti(He)})`,yn=new RegExp(`^${Fi}/[^/]+\\.md$`,"i"),Ni=/^templates\/.+/i;function of(e,n){return de(e,n)?.definition??!1}function Le(e){return e.CF_DISCOVERY_SKILLS!=="0"}var An=new Map([...ot.map(e=>[e,{role:"prompt",kind:"dedicated"}]),[Ln.toLowerCase(),{role:"prompt",kind:"fallback"}],[G.soul,{role:"soul"}],[G.knowledge,{role:"knowledge"}],[G.config,{role:"marker"}],[G.tools,{role:"tool file",kind:"json"}],[G.toolsSource,{role:"tool file",kind:"sdk"}],[G.cli,{role:"tool file",kind:"cli"}],...It.map(e=>[e,{role:"MCP config"}])]),Di=[...An.keys()];function $n(e){let n=An.get(e.toLowerCase());if(n)return n;if(yn.test(e))return{role:"sub-agent"};let t=de(e),o=t?.ownerPath?{ownerPath:t.ownerPath}:{};return t?.definition?{role:"skill",name:t.name,...o}:t?.reference?{role:"reference",kind:"skill",name:t.name,...o}:Ni.test(e)?{role:"reference",kind:"template"}:null}function Bi(e){let n=$n(e);return!!n&&n.role!=="skill"&&n.role!=="reference"}var Wi=["package.json","pyproject.toml","go.mod","cargo.toml"],Ki=[...Di.filter(e=>!Ci.includes(e)),...Wi],Ui=new RegExp(`^${Pn}[^/]*$`,"i");function Ct(e,n,t){let o=Re(e)?t?.ownerOf(n):void 0;return o?U(n,o.folder)??n:n}function bn(e,n,t){if(Re(e)&&t?.files?.some(i=>i.path===n&&i.kind==="entry"))return!0;n=Ct(e,n,t);let o=n.split("/").pop()??"",r=de(n),s=r?.definition&&(Le(e)||!r.ownerPath&&!r.folder.startsWith(`${Ae}/`)),l=r?.reference&&r.ownerPath&&Le(e);return Ki.includes(o.toLowerCase())||Ui.test(o)||Bi(n)||!!s||!!l}var rf=[...ot,Ln].join(", "),sf=`${G.config}, a system prompt file, ${G.tools}, an MCP config, ${G.soul}, ${G.knowledge}, ${Ze}/*.md and ${$e}/*/${G.skill}`,lf=/(agent|tool|prompt|llm|model|chain|graph|pipeline|workflow|handler|route|server|main|index|app|orchestr)/i,af=/(^|\/)prompts?\/.*\.(md|txt|prompt)$/i;function cf(e,n,t={}){let o=n.flatMap(S=>{let _=U(S,t.root);return _===null?[]:[{path:S,relativePath:_}]}),r=o.filter(({path:S})=>Oe(e,{path:S},{purpose:"override",route:"github"}).admitted),s=new Map(r.map(S=>[S.relativePath.toLowerCase(),S.path])),l=ot.map(S=>s.get(S)).find(Boolean),i=It.map(S=>s.get(S)).find(Boolean),a=S=>Mo(e,S),c=Io({codeAgentsFound:t.codeAgentsFound??!1,folderAgentsFound:t.folderAgentsFound,agentConfiguration:t.agentConfiguration,otherDefinitions:r.some(({relativePath:S})=>{let _=$n(S);return!a(S)&&!!_&&_.role!=="reference"})},e),p=t.agentConfiguration&&c==="prompt",u=p?Ye.map(S=>s.get(S)).find(Boolean):void 0,f=!p&&s.has(G.soul)&&!(ze(e)?Ii:ot).some(S=>s.has(S)),d=[];for(let S of r){let _=a(S.relativePath)&&(c==="background"||p&&!Ye.includes(S.relativePath.toLowerCase())),g=p&&Ye.includes(S.relativePath.toLowerCase())?{role:"prompt",kind:"fallback"}:_?{role:"knowledge",kind:"background"}:$n(S.relativePath);if(!g||t.mode==="core"&&(g.role==="skill"||g.role==="reference"))continue;let E;_?E=S.path===s.get(S.relativePath.toLowerCase()):p&&g.role==="prompt"&&g.kind==="fallback"?E=S.path===u:g.role==="prompt"&&g.kind==="dedicated"?E=S.path===l:g.role==="MCP config"?E=S.path===i:An.has(S.relativePath.toLowerCase())&&(E=S.path===s.get(S.relativePath.toLowerCase()));let R=g.ownerPath?{ownerPath:s.get(g.ownerPath.toLowerCase())??null}:{};d.push({...S,...g,...R,...E===void 0?{}:{preferred:E}})}return{files:d,scoped:o,registry:f}}function fr(e,n,t){let o;try{let r=JSON.parse(e),s=r?.mcpServers??r?.servers;o=s&&typeof s=="object"?Object.keys(s):[]}catch{return{servers:[],warnings:[`${n} is not valid JSON; ignored`]}}return{servers:o,warnings:!t&&o.length?[`found MCP config (servers: ${o.join(", ")}) but no ${G.tools}; tool schemas are discovered from a running server and were not extracted`]:[]}}import{z as Me}from"zod";var Gi=Me.object({name:Me.string().min(1,"tool name is required"),description:Me.string().optional(),input_schema:Me.record(Me.string(),Me.unknown()).optional()}),zi=Me.array(Gi);function ur(e){let n=[];if(e==null)return{tools:[],warnings:n};let t=e;if(typeof e=="string"){let r=e.trim();if(r==="")return{tools:[],warnings:n};try{t=JSON.parse(r)}catch(s){throw new Error(`tools is not valid JSON: ${s.message}`)}}let o=zi.safeParse(t);if(!o.success)throw new Error(`tools do not match the expected shape (an array of {name, description?, input_schema?}): ${o.error.issues.map(r=>`${r.path.join(".")||"(root)"}: ${r.message}`).join("; ")}`);return o.data.length===0&&n.push("no tools were provided"),{tools:o.data,warnings:n}}import{posix as On}from"node:path";var Y=e=>`${e.path}:${e.kind}:${e.start}`;function rt(e){return e.slice(e.lastIndexOf("/")+1)}function st(e,n){let t=n.replace(/\\/g,"/").replace(/^(\.\/)+/,""),o=e.filter(r=>r.path===t||r.path.endsWith(`/${t}`));return o.length>0?o:e.filter(r=>rt(r.path)===rt(t))}function Ce(e,n,t){let o=Y(n);e.set(o,[...e.get(o)??[],t])}function Vi(e,n,t){let o=r=>r.replace(/\.(tsx?|jsx?|mjs|cjs|py)$/,"").replace(/\/(?:index|__init__)$/,"");if(n.startsWith(".")){let r=e.endsWith(".py"),s=r?/^\.+/.exec(n)?.[0].length??0:0,l=r?"../".repeat(Math.max(0,s-1))+n.slice(s).replace(/\./g,"/"):n,i=o(On.normalize(On.join(On.dirname(e),l)));return t.filter(a=>o(a)===i)}return t.filter(r=>yt(r,n))}function pr(e,n,t){return t&&e.path.endsWith(".py")&&n.imported!=="*"&&n.imported!==n.source?`${n.source}${n.source.endsWith(".")?"":"."}${n.imported}`:n.source}function mr(e,n,t,o=!1){if(!e.moduleResolver||e.moduleResolver.legacy)return;let r=pr(n,t,o);return new Set(e.moduleResolver.bindings(n.path,r,o?[]:[t.imported]).flatMap(s=>s.status==="resolved"?[s.path]:[]))}function Ie(e,n,t,o=!1){let r=mr(e,n,t,o)??new Set(Vi(n.path,pr(n,t,o),e.files.map(s=>s.path)));return e.files.filter(s=>r.has(s.path))}function dr(e,n,t,o){let r=Ie(e,n,t);if(o&&n.path.endsWith(".py")&&t.imported!=="*"){let s=Ie(e,n,t,!0);if(s.length)return{files:s,submodule:t.imported!==t.source}}return{files:r,submodule:!1}}function Mn(e,n,t,o,r=!1){let s=mr(e,n,t);if(s)return o.filter(a=>s.has(a.path));let l=r?[t.source,`${t.source}.${t.imported}`]:[t.source],i=o.filter(a=>l.some(c=>yt(a.path,c)));return i.length?i:o}function je(e,n,t,o){let r=(o.get(t)??[]).filter(c=>c.path===n.path);if(r.length)return r;let[s,l]=t.split("."),i=n.imports.find(c=>c.name===s);if(!i)return[];let a=new Set(Ie(e,n,i).map(c=>c.path));return(o.get(l??i.imported)??[]).filter(c=>a.has(c.path))}import{posix as Wt}from"node:path";var jt=/^(claude-[a-z0-9.-]+|gpt-[a-z0-9.-]+|o[1-9](-[a-z0-9-]+)?|gemini-[a-z0-9.-]+)$/,Xi=/^\S+\.(?:md|txt|j2|hbs|mustache|prompt)$/i,it=50,hr=200;function gr(e){let n=[],t=[],o=[];for(let[r,s]of e.toks.entries()){if(!ee(s))continue;s.kind==="string"&&jt.test(s.value)&&n.length<it&&n.push({value:s.value,path:e.path,line:s.line});let l=s.value.length<=hr&&Xi.test(s.value),i=e.toks[r-2],a=h(e.toks[r-1],":")&&i&&/^(?:system_prompt|user_prompt|prompt|template)$/i.test(i.kind==="string"?i.value:i.text);if(l){let c={value:s.value,path:e.path,line:s.line};t.length<it&&t.push(c),a&&o.length<it&&o.push(c)}}return{modelIds:n,fileRefs:t,promptFileRefs:o}}function xr(e){let{toks:n}=e,t=[];for(let o=0;o<n.length&&t.length<it;o++)if(!(!v(n[o])||!D(n,o+1)||!h(n[o+2],"{"))&&!(e.lang==="js"&&!v(n[o-1],"const")))for(let{from:r,to:s}of B(n,o+2)){let l=n[r],i=n[r+2];if(!(s!==r+3||!h(n[r+1],":")||i?.kind!=="string"||i.value.length>hr||!jt.test(i.value))&&!(!v(l)&&l?.kind!=="string")&&(t.push({object:n[o].text,member:l.kind==="string"?l.value:l.text,value:i.value,path:e.path,line:i.line}),t.length===it))break}return t}import{posix as Dt}from"node:path";import{posix as lt}from"node:path";function Ve(e,n){return e.filter(t=>t.from<n&&n<t.to).at(-1)??null}function xe(e){let{toks:n}=e,t=[];for(let o=0;o<n.length;o++){if(!v(n[o])||!ne(n,o,e))continue;let r=o;for(;h(n[r-1],".")&&v(n[r-2]);)r-=2;if(h(n[r-1],".")&&h(n[r-2],")")){let a=le(e,r-2);r=t.find(p=>p.open===a)?.from??a}let s=j(n,o+1);if(s===n.length)continue;let l=h(n[o-1],".")&&h(n[o-2],")")?o:r,i=n.slice(l,o+1).map(a=>a.text).join("");t.push({from:r,to:s+1,open:o+1,callee:i,args:B(n,o+1)})}return t}function se(e,n,t,o=!1){let r=$o(e,n,t,o);return h(e.toks[r-1],";")?r-1:r}function Tt(e,n=!1){let{toks:t}=e,o=[];for(let r=0;r<t.length;r++){if(!v(t[r])||h(t[r-1],"."))continue;let s=r+1;if(h(t[s],":")){if(!(e.lang==="js"?["const","let","var"].includes(t[r-1]?.text):re(t,r))||n&&e.lang==="py"&&re(t,s+1))continue;for(;s<r+We&&s<t.length&&!D(t,s)&&![";","{","}"].some(c=>h(t[s],c));)s++}let l=h(t[s],"+");if(l&&s++,!D(t,s))continue;let i=le(e,r);e.lang==="py"&&h(t[i],"(")||(o.push({at:r,name:t[r].text,append:l,from:s+1,to:se(e,s+1,void 0,n)}),r=s)}return o}function Sr(e,n,t=xe(e)){let{toks:o}=e,{assignments:r,functions:s,owner:l,binding:i,inBlock:a,lexical:c,declarations:p}=n,u=q(e),f=J(e,{includeMembers:!0}),d=f.filter(m=>m.params!==null),S=m=>f.filter(P=>(P.params!==null||P.kind==="class")&&P.from<m&&m<P.to).sort((P,M)=>M.from-P.from)[0]??null,_=(m,P)=>{let M=S(m.from);return a(m.from,P)&&(M===null||M.from<P&&P<M.to)},g=q(e,{namespaceBindings:!0,bindingPositions:!0}).map(m=>{let P=m.bindingAt,M=m.names.map(y=>({local:y,name:m.renamed?.[y]??y,namespace:m.namespaceNames?.includes(y)===!0||e.lang==="js"&&(v(o[P],"require")&&!h(o[P-2],"}")||h(o[P+1],"*"))}));return{module:m,at:P,names:M}}),E=(m,P,M=!1)=>{if(M){if(l(P)?.params?.includes(m)||i(m,P)||s.some(w=>w.name===m))return null;let x=u.filter(w=>w.names.includes(m));return x.length===1?{module:x[0],name:x[0].renamed?.[m]??m,namespace:!1}:null}let y=S(P),k=[...y?.kind==="class"?[y]:[],...d.filter(x=>x.from<P&&P<x.to).sort((x,w)=>w.from-x.from),null];for(let x of k){let w=g.filter(I=>S(I.at)===x&&a(I.at,P)&&I.names.some(T=>T.local===m)),$=r.filter(I=>I.name===m&&S(I.at)===x&&(!c(p.get(I)??I)||a(I.at,P))&&!w.some(T=>v(o[T.at],"require")&&I.from<=T.at&&T.at<I.to)),L=f.filter(I=>I.name===m&&(I.params!==null||I.kind==="class")&&S(I.from)===x&&_(I,P));if(x?.params?.includes(m)||$.length||L.length)return null;if(!w.length)continue;if(w.length!==1||w[0].at>=P&&!(e.lang==="js"&&v(o[w[0].at],"import")))return null;let A=w[0],O=A.names.find(I=>I.local===m);return{module:A.module,name:O.name,namespace:O.namespace}}return null};return{importBinding:E,hasImport:(m,P)=>P?u.some(M=>M.names.includes(m)):g.some(M=>M.names.some(y=>y.local===m)),loaderImport:(m,P)=>{let M=m.callee.split(".")[0];if(P){let k=E(M,m.from);return k?me([k.module],e.lang).find(x=>x.name===M)??null:null}let y=me(u,e.lang).filter(k=>k.name===M);return y.length!==1||l(t.find(k=>k.callee===m.callee)?.open??0)?.params?.includes(M)?null:y[0]}}}var qi=new Set(["append","extend","copy","model_dump","dict","to_dict","json"]);function yr(e,n,t={}){let{toks:o}=e,r=Tt(e,t.completeExpressions),s=new Map(r.map(y=>[y.at,y])),l=n.filter(y=>y.params!==null),i=y=>Ve(l,y),a=(y,k)=>{let x=i(k);return r.findLast(w=>w.at<k&&w.name===y&&i(w.at)===x)??(x?.params?.includes(y)?void 0:r.findLast(w=>w.at<k&&w.name===y&&i(w.at)===null))},c=[],p=[];for(let y=0;y<o.length;y++)c.push([...p]),h(o[y],"{")?p.push(y):h(o[y],"}")&&p.pop();let u=(y,k)=>c[y].every((x,w)=>c[k]?.[w]===x),f=y=>["const","let"].includes(o[y.at-1]?.text),d=y=>f(y)||v(o[y.at-1],"var"),S=new Map;for(let y of r)S.set(y,d(y)?y:r.findLast(k=>k.at<y.at&&k.name===y.name&&i(k.at)===i(y.at)&&d(k)&&(!f(k)||u(k.at,y.at))));let _=(y,k,x)=>r.some(w=>w.name===y&&i(w.at)!==k&&x(w.at)&&!S.get(w)&&!i(w.at)?.params?.includes(y)),g=(y,k)=>{let x=i(k);return!_(y,x,w=>x!==null&&x.from<w&&w<x.to)},E=y=>{let k=i(y.at);if(!k?.params?.includes(y.name))return!1;let x=o.findIndex((w,$)=>k.from<$&&$<y.at&&h(w,"("));return x>=0&&y.at<j(o,x)},R=(y,k)=>{let x=i(y.from);return u(y.from,k)&&(x===null||(t.enclosingBindings?x.from<k&&k<x.to:x===i(k)))},b=(y,k)=>{if(e.lang==="py"&&t.completeExpressions){let x=be(e.text,o[y.at]);for(let w=y.at-1;w>=0;w--){if(!re(o,w))continue;let $=be(e.text,o[w]);if($>=x)continue;x=$;let L=v(o[w],"async")?o[w+1]?.text??"":o[w].text;if(["if","elif","else","for","while","try","except","finally","match","case"].includes(L)){let A=o.findIndex((O,I)=>I>y.at&&re(o,I)&&be(e.text,O)<=$);if(A>=0&&A<=k)return!0}if(v(o[w],"def")||v(o[w],"async")&&v(o[w+1],"def"))return!1}return!1}for(let x=y.at-1;x>=0&&![";","{","}"].includes(o[x].text);x--){if([")","]"].includes(o[x].text)){x=le(e,x);continue}if(["if","else","for","while","case","and","or"].includes(o[x].text)||["?","&","|"].includes(o[x].text))return!0}return!1},m=(y,k)=>y.at<k&&u(y.at,k)&&(!t.enclosingBindings||!b(y,k))&&!_(y.name,i(y.at),x=>u(y.at,x)&&(!t.enclosingBindings||i(y.at)===null||i(y.at).from<x&&x<i(y.at).to)),P=(y,k)=>{let x=i(k),w=r.filter(N=>{if(N.name!==y)return!1;let F=S.get(N);return!F||!f(F)||u(F.at,k)}),$=[...l.filter(N=>N.from<k&&k<N.to).sort((N,F)=>F.from-N.from),null],L=t.enclosingBindings?$.find(N=>N?.params?.includes(y)||w.some(F=>i(F.at)===N)||l.some(F=>F.name===y&&i(F.from)===N&&R(F,k))):void 0,A=w.filter(N=>t.enclosingBindings?i(N.at)===L:i(N.at)===x||!x?.params?.includes(y)&&i(N.at)===null),O=N=>{let F=S.get(N);return F&&f(F)?c[F.at].length:0},I=Math.max(-1,...A.map(O)),T=A.filter(N=>O(N)===I);return T.findLast(N=>N.at<k)??T[0]};return{assignments:r,functions:l,owner:i,legacyBinding:a,inBlock:u,lexical:f,declarations:S,parameterIsCertain:g,parameterDefault:E,functionVisible:R,bindingIsCertain:m,binding:P,objectIsCertain:(y,k)=>{let x=new Set([y]),w=new Set([y.name]);for(let $=y.to;$<k;$++){let L=s.get($);if(L&&!L.append){let{from:F,to:W}=L;for(;h(o[F],"(")&&j(o,F)===W-1;)F++,W--;let C=F+1;for(;C<W&&(h(o[C],".")&&v(o[C+1])||h(o[C],"["));)C=h(o[C],"[")?j(o,C)+1:C+2;let K=C===W&&v(o[F])?P(o[F].text,F):void 0;K&&x.has(K)&&(x.add(L),w.add(L.name))}if(!v(o[$])||!w.has(o[$].text))continue;let A=P(o[$].text,$);if(!A||!x.has(A))continue;let O=$+1;for(;h(o[O],".")&&v(o[O+1])||h(o[O],"[");)O=h(o[O],"[")?j(o,O)+1:O+2;if(O===$+1)continue;if(h(o[O],"(")&&!(t.completeExpressions&&O===$+3&&h(o[$+1],".")&&qi.has(o[$+2].text)))return!1;if(e.lang==="py"&&h(o[O],":")){let F=se(e,O+1,void 0,t.completeExpressions);for(let W=O+1;W<F;W++){if(["(","[","{"].some(C=>h(o[W],C))){W=j(o,W);continue}if(D(o,W))return!1}}let I=O;for(;o[I]?.kind==="punct"&&"+-*/%&|^<>".includes(o[I].text);)I++;let T=o.slice(O,I).map(F=>F.text).join(""),N=["+","-","*","/","//","**","%","&","|","^","<<",">>"].includes(T)&&D(o,I);if(D(o,O)||N||v(o[$-1],"del"))return!1}return!0}}}function fe(e,n,t={}){let{toks:o}=e,r=xe(e),s=yr(e,n,t),{assignments:l,functions:i,owner:a,legacyBinding:c,binding:p,bindingIsCertain:u,parameterIsCertain:f,parameterDefault:d,functionVisible:S,objectIsCertain:_}=s,{importBinding:g,hasImport:E,loaderImport:R}=Sr(e,s,r),b=(y,k=new Set)=>o.slice(y.from,y.to).flatMap((x,w)=>{let $=c(x.text,y.from+w);return x.kind!=="ident"||!$||$.append||k.has($.at)?[x]:b($,new Set([...k,$.at]))}),m=y=>{let k=o[y.open-1].text;if(["readFileSync","readFile"].includes(k))return y.args[0]??null;if(!h(o[y.open-2],"."))return null;let x=y.open-3;if(k==="read_text"&&v(o[x]))return{from:y.from,to:x+1};if(!h(o[x],")"))return null;let w=le(e,x),$=r.find(L=>L.open===w);return k==="read_text"?$?.callee==="Path"?$.args[0]??null:{from:w+1,to:x}:k==="read"&&$?.callee==="open"||k==="text"&&$?.callee==="Bun.file"?$?.args[0]??null:null},P=y=>{let[k,...x]=y.callee.split("."),w=g(k,y.open,!t.enclosingBindings);if(w){let L=w.module,A=x.at(-1)??w.name;return(/^(?:node:)?fs(?:\/promises)?$/.test(L.source)?["readFile","readFileSync","readdir","readdirSync"]:/^(?:node:)?path$/.test(L.source)?["join","resolve"]:/^(?:node:)?url$/.test(L.source)?["fileURLToPath"]:L.source==="pathlib"?["Path"]:[]).includes(A)?A:null}return(t.enclosingBindings?i.some(L=>L.from<y.open&&y.open<L.to&&L.params?.includes(k)):a(y.open)?.params?.includes(k))||p(k,y.open)||i.some(L=>L.name===k)||E(k,!t.enclosingBindings)||x.length&&!["fs","path","Bun"].includes(k)?null:x.at(-1)??k},M=r.flatMap(y=>{let k=m(y)??(["readFileSync","readFile"].includes(P(y)??"")?y.args[0]:null);return k?[{sourcePath:e.path,line:o[y.open-1].line,call:y,path:k,tokens:b(k)}]:[]});return{source:e,calls:r,assignments:l,functions:i,owner:a,binding:p,bindingIsCertain:u,parameterIsCertain:f,parameterDefault:d,functionVisible:S,objectIsCertain:_,pathTokens:b,importBinding:g,loaderImport:R,builtin:P,operations:M}}function oe({source:{toks:e}},n){let{from:t,to:o}=n;for(v(e[t],"await")&&t++;h(e[t],"(")&&j(e,t)===o-1;)t++,o--;return{from:t,to:o}}function Z(e,n){let{from:t,to:o}=oe(e,n);return e.calls.findLast(r=>r.to===o&&(r.from===t||v(e.source.toks[t],"new")&&r.from===t+1))}function In(e,n){let{toks:t}=e.source,{from:o}=n,r=o+1;if(h(t[o],"(")&&(r=j(t,o)+1,o++),!v(t[o])||!h(t[r],"=")||!h(t[r+1],">"))return null;let s=r+2;return h(t[s],"{")?v(t[s+1],"return")?(s+=2,{name:t[o].text,body:{from:s,to:se(e.source,s)}}):null:{name:t[o].text,body:{from:s,to:n.to}}}function Q(e,n,t=new Map,o=new Set){let{source:{toks:r,path:s},binding:l,builtin:i}=e,a=oe(e,n),{from:c,to:p}=a;if(c>=p||!r[c])return null;let u=r.slice(c,p).map(b=>b.text).join(""),f=b=>{let m=l(b,c);return!m||e.parameterDefault(m)&&t.has(b)&&t.get(b)!==void 0?e.parameterIsCertain(b,c)?t.get(b)??null:null:e.bindingIsCertain(m,c)&&!m.append&&!o.has(m.at)?Q(e,m,t,new Set([...o,m.at])):null},d=b=>Q(e,b,t,o);if(p===c+1){let b=r[c];if(e.source.lang==="py"&&b.formatted&&b.value.includes("{"))return null;if(b.kind==="string"||b.kind==="template"&&!b.value.includes("${"))return/^(?:[a-z]+:|[/\\])/i.test(b.value)?null:b.value;if(b.kind==="template"){let m=!1,P=b.value.replace(/\$\{([^}]*)\}/g,(M,y)=>{if(!/^[A-Za-z_$][\w$]*$/.test(y))return m=!0,"";let k=f(y);return k==null&&(m=!0),k??""});return m||/^(?:[a-z]+:|[/\\])/i.test(P)?null:P}if(v(b,"__dirname")&&!l(b.text,c)&&!e.owner(c)?.params?.includes(b.text))return`/repository/${lt.dirname(s)}`;if(v(b))return f(b.text)}let S=[];for(let b=c;b<p;b++){if(["(","[","{"].some(m=>h(r[b],m))){b=j(r,b);continue}S.push(b)}let _=S.find(b=>h(r[b],"?")&&h(r[b+1],"?"));if(_!==void 0){let b=d({from:c,to:_});if(b!==null)return b;let m=_===c+1&&v(r[c])&&!l(r[c].text,c)?r[c].text:null;return m&&e.owner(c)?.params?.includes(m)&&e.parameterIsCertain(m,c)&&(!t.has(m)||t.get(m)===void 0)?d({from:_+2,to:p}):null}let g=S.find(b=>h(r[b],"+"));if(g!==void 0){let b=d({from:c,to:g}),m=d({from:g+1,to:p});return b===null||m===null?null:b+m}if(u==="import.meta.url")return`/repository/${s}`;let E=Z(e,a);if(!E)return null;let R=i(E);if(R==="URL"&&E.args.length===2){let b=r.slice(E.args[1].from,E.args[1].to).map(P=>P.text).join(""),m=d(E.args[0]);return b==="import.meta.url"&&m!==null&&!/^(?:[a-z]+:|[/\\])/i.test(m)?lt.join("/repository",lt.dirname(s),m):null}if(R==="fileURLToPath"||R==="Path")return E.args.length===1?d(E.args[0]):null;if(R==="join"||R==="resolve"){let b=E.args.map(d);return b.length&&b.every(m=>m!==null)&&b.every(m=>m.startsWith("/repository/")||!/^(?:[a-z]+:|[/\\])/i.test(m))?R==="resolve"?lt.resolve("/repository",...b):lt.join(...b):null}return null}function kr(e,n){let t=oe(e,n),o=e.source.toks[t.from],r=v(o,"null")||v(o,"undefined")&&!e.binding(o.text,t.from)&&!e.owner(t.from)?.params?.includes(o.text);return t.to===t.from+1&&r?void 0:Q(e,t)}import{posix as Ft}from"node:path";function Se(e,n){if(e===null)return null;let t=e.startsWith("/repository/")?e.slice(12):e.startsWith(".")?Ft.join(Ft.dirname(n),e):e,o=Ft.normalize(t.replace(/\\/g,"/")).replace(/\/$/,"");return o===".."||o.startsWith("../")||/^(?:[a-z]+:|\/)/i.test(o)?null:o}function wr(e,n){return{from:n.from,to:n.open-2}}function Cn(e,n,t,o=new Set){let r=oe(e,n),{source:{toks:s},binding:l}=e;if(r.to===r.from+1&&v(s[r.from])){let f=l(s[r.from].text,r.from);return f&&e.bindingIsCertain(f,r.from)&&!f.append&&!o.has(f.at)?Cn(e,f,t,new Set([...o,f.at])):null}let i=Z(e,r);if(!i)return null;if(["readdirSync","readdir"].includes(e.builtin(i)??"")&&i.args[0]){let f=Se(Q(e,i.args[0],t),e.source.path);return f===null?null:{path:f}}if(s[i.open-1].text!=="filter"||i.args.length!==1)return null;let a=In(e,i.args[0]),c=a&&Z(e,a.body),p=c?.args[0]&&Q(e,c.args[0]);if(!a||c?.callee!==`${a.name}.endsWith`||!p||!Pe.test(`template${p}`))return null;let u=Cn(e,wr(e,i),t,o);return u?{...u,extension:p}:null}function br(e,n,t,o){let{source:{toks:r}}=e;for(let s of e.calls){if(r[s.open-1].text!=="map"||s.args.length!==1)continue;let l=In(e,s.args[0]);if(!l||!(l.body.from<=n.from&&n.to<=l.body.to))continue;let i=Cn(e,wr(e,s),o);if(!i?.extension||e.owner(n.open)!==e.owner(s.open)||r.slice(l.body.from,n.from).some((u,f)=>{let d=l.body.from+f;return v(u,"function")||h(u,"=")&&h(r[d+1],">")}))continue;let c=new Map(o).set(l.name,"__template_entry__");if(Se(Q(e,t,c),e.source.path)===Ft.join(i.path,"__template_entry__"))return{kind:"directory",path:i.path,extension:i.extension}}return null}function _r(e,n){let t=e.owner(n.open),o=new Set(e.assignments.filter(r=>e.owner(r.at)===t&&r.from<=n.from&&n.to<=r.to));for(let r of e.assignments)e.owner(r.at)!==t||r.from<=n.from||Nt(e,r,o)&&o.add(r);return o}function Nt(e,n,t){return e.source.toks.slice(n.from,n.to).some((o,r)=>{let s=n.from+r;if(h(e.source.toks[s-1],".")||h(e.source.toks[s+1],":"))return!1;let l=v(o)&&e.binding(o.text,s);return l&&t.has(l)})}function Er(e,n,t,o){if(!n)return!1;let{toks:r}=e.source;for(let l=n.from;l<n.to;l++){if(!v(r[l],"return")||e.owner(l)!==n)continue;let i={from:l+1,to:se(e.source,l+1)};if(i.from<=t.from&&t.to<=i.to||Nt(e,i,o))return!0}let s=r.findIndex((l,i)=>n.from<i&&i<t.from&&h(l,"=")&&h(r[i+1],">"));return s>=0&&!h(r[s+2],"{")}function jn(e,n,t,o=!1){let r=(o?t.replace(Pe,""):t).replace(/\\/g,"/"),s=c=>o?c.path.replace(Pe,""):c.path,l=Dt.dirname(n);for(;;){let c=Dt.normalize(Dt.join(l,r)),p=e.filter(u=>s(u)===c);if(p.length)return p.length===1?p:[];if(l==="."||l==="/")break;l=Dt.dirname(l)}if(r.includes("/"))return[];let i=o?e.filter(c=>s(c)===r||s(c).endsWith(`/${r}`)):st([...e],r),a=i.length||!o?i:e.filter(c=>rt(s(c))===rt(r));return a.length===1?a:[]}function Rr(e){return e.filter(({call:n})=>{let t=n.callee.split(".").at(-1);return t==="readFile"||t==="readFileSync"||["read_text","read","text"].includes(t??"")&&n.from<n.open-1})}function Xe(e){return e.filter(n=>Pe.test(n))}function vr(e,n,t){let{tokens:o}=e,r=o.filter(a=>a.kind==="string"||a.kind==="template").filter(a=>a.value.length<=200).map(a=>a.value),s=r.map(a=>{let c=Xo.exec(a);return c?a.slice(0,c.index+c[0].length).replace(/\\/g,"/"):null}).find(a=>a!==null)??null,l=Xe(r)[0]?.match(/\.[^./\\]+$/)?.[0]??null;if(s===null&&l===null)return null;let i=n.params.findIndex(a=>a!==null&&o.some((c,p)=>v(c,a)&&!h(o[p-1],".")?!0:c.kind!=="template"&&!c.formatted?!1:(c.value.match(/\$?\{[^}]*\}/g)??[]).some(u=>{let f=wo(u.replace(/^\$?\{|\}$/g,""),t);return f.some((d,S)=>v(d,a)&&!h(f[S-1],"."))})));return i<0?null:{folder:s,ext:l,paramIndex:i}}function Ji(e,n,t,o){let r=n.loaderImport(t,H(e));if(!r)return null;let s=Ie({files:o.map(l=>({path:l.source.path}))},{path:n.source.path},r).map(l=>l.path);return{binding:r,paths:s}}function at(e,n){let t=e.builtin(n);if(["readFileSync","readFile"].includes(t??""))return!0;if(!["read_text","read","text"].includes(t??""))return!1;let o=t==="read_text"?"Path":t==="read"?"open":"file";return e.calls.some(r=>r.from===n.from&&r.to<n.to&&e.builtin(r)===o)}function $r(e,n,t,o="anchored"){let r=Object.entries(n).flatMap(([u,f])=>{if(t?.source.path===u)return[fe(t.source,t.scopes)];let d=z(u);if(!d)return[];let S=X(u,f,d);return[fe(S,J(S))]});t&&!r.some(u=>u.source===t.source)&&r.push(fe(t.source,t.scopes));let s=r.flatMap(u=>u.operations);if(o==="operations")return{operations:s,reads:[],dependencies:[]};let l=r.flatMap(u=>u.functions.map(f=>({syntax:u,scope:f}))),i=new Map,a=new Set,c=(u,f)=>{let d=f.callee.split(".")[0];if(u.owner(f.open)?.params?.includes(d))return[];let S=u.binding(d,f.open),_=l.filter(R=>R.syntax===u&&R.scope.name===f.callee&&u.functionVisible(R.scope,f.open));if(_.length)return _.filter(R=>!S||S.at===R.scope.from+1);if(S)return[];let g=Ji(e,u,f,r);if(!g)return[];if(!g.paths.length)for(let R of Ro(u.source.path,g.binding.source,[g.binding.imported],u.source.lang,!0))a.add(R);let E=f.callee.split(".")[1]??g.binding.imported;return l.filter(R=>g.paths.includes(R.syntax.source.path)&&R.scope.name===E&&R.syntax.owner(R.scope.from)===null)};for(let u of r)for(let f of u.calls){let d=c(u,f);for(let S of d){let _=new Map((S.scope.params??[]).flatMap((E,R)=>E===null?[]:[[E,d.length!==1?null:f.args[R]?kr(u,f.args[R]):void 0]])),g=i.get(S.scope)??[];g.push({parameters:_,...d.length===1&&S.syntax!==u?{consumer:u.source.path}:{}}),i.set(S.scope,g)}}let p=[];for(let u of r)for(let f of u.operations){if(!at(u,f.call))continue;let d=u.owner(f.call.open),S=d?i.get(d)??[{parameters:new Map}]:[{parameters:new Map}];for(let _ of S){let g=Se(Q(u,f.path,_.parameters),u.source.path),E=g===null?br(u,f.call,f.path,_.parameters):{kind:"file",path:g};if(!E)continue;let R=_r(u,f.call),b=new Set(_.consumer&&Er(u,d,f.call,R)?[_.consumer]:[]);for(let M of u.calls){if(u.owner(M.open)!==d||!M.args.some(k=>Nt(u,k,R)))continue;let y=c(u,M);y.length===1&&y[0].syntax!==u&&b.add(y[0].syntax.source.path)}let m=p.find(M=>M.sourcePath===f.sourcePath&&M.line===f.line&&JSON.stringify(M.target)===JSON.stringify(E)),P=[...b].sort();m?m.consumerPaths=[...new Set([...m.consumerPaths,...P])].sort():p.push({sourcePath:f.sourcePath,line:f.line,target:E,consumerPaths:P})}}return{operations:s,reads:p,dependencies:[...a].sort()}}function Te(e,n){let{toks:t}=e;if(h(t[n],"(")){let o=Tn(e,n+1);return o&&h(t[o.next],")")?{...o,next:o.next+1}:null}return h(t[n],"[")?Hi(e,n):Tn(e,n)}function Tn(e,n){let{toks:t}=e,o=[],r=n;for(;ee(t[r]);)o.push(t[r]),r++,h(t[r],"+")&&ee(t[r+1])&&r++;return o.length===0?null:{start:o[0].start,line:o[0].line,endLine:o[o.length-1].endLine,text:o.map(s=>s.value).join(""),partStarts:o.map(s=>s.start),next:r,...o.some(Fn)?{filledAtRunTime:!0}:{}}}function Fn(e){return!!e.formatted&&(e.kind==="template"||Yi(e.value))}function Yi(e){for(let n=0;n<e.length;n++)if(e[n]==="{"){if(e[n+1]==="{"){n++;continue}return e.indexOf("}",n+1)>=0}return!1}function ct(e,n,t=e.toks.length){let{toks:o}=e;if(e.lang==="py")for(;n<t&&h(o[n],"(");)n++;if(e.lang==="py"&&v(o[n],"lambda")){for(let r=n+1;r<t;r++){if(h(o[r],":"))return r+1;["(","[","{"].some(s=>h(o[r],s))&&(r=j(o,r))}return null}if(e.lang!=="js")return null;for(;n<t;){let r=v(o[n],"async")?n+1:n,s=h(o[r],"(")?j(o,r):-1,l=s>=0?s+1:v(o[r])?r+1:-1;if(h(o[l],":")){let i=Math.min(t,l+We);for(;l<i&&!h(o[l],"=");)l++}if(l>=0&&l+2<t&&h(o[l],"=")&&h(o[l+1],">"))return l+2;if(s<0)return null;n=r+1,t=Math.min(t,s)}return null}function Hi(e,n){let{toks:t}=e,o=n+1;if(!h(t[o],"{"))return null;let r=j(t,o),s=h(t[r+1],",")?r+2:r+1;if(!h(t[s],"]"))return null;for(let l=o+1;l<r;l++){let i=t[l];if((v(i)&&i.text==="text"||i.kind==="string"&&i.value==="text")&&h(t[l+1],":")){let c=Tn(e,l+2);return c&&{...c,next:s+1}}}return null}var Nn={kind:"other",text:"",siteLine:null,siteStart:null};function ie(e,n,t,o=e.toks.length,r=!1){let{toks:s}=e,l=r?ct(e,t,o):null,i=Te(e,l??t);if(l!==null&&(!i||!n.has(i.start)))return Nn;if(i&&i.next<=o){let p=n.get(i.start)??null;return{kind:"literal",text:_e(i.text),siteLine:p,siteStart:p===null?null:i.start}}if(!v(s[t]))return Nn;let a=t+1,c=!1;for(;;){let p=h(s[a],"?")&&h(s[a+1],".")?a+1:a;if(!h(s[p],".")||!v(s[p+1]))break;a=p+2,c=!0}return a<o&&!Zi(s[a],re(s,a))?Nn:{kind:c?"member":"identifier",text:e.text.slice(s[t].start,s[a-1].end),siteLine:null,siteStart:null}}function Zi(e,n){return n||e.kind==="punct"&&",)}];".includes(e.text)}var qe=new Set(["system","systemPrompt","system_prompt","instructions"]);function Dn(e,n){let t=ye(e.toks[n-2]);if(t===null||!qe.has(t)||Bn(e,n-2)!==n)return!1;let o=le(e,n-2);if(e.lang==="py"&&e.toks[n-2].kind==="ident")return ne(e.toks,o-1,e)&&!h(e.toks[n-3],".");if(!h(e.toks[o],"{"))return!1;let r=le(e,o);if(!ne(e.toks,r-1,e))return!1;let s=o-1;return e.lang==="py"&&(h(e.toks[s],"*")&&h(e.toks[s-1],"*")||h(e.toks[s],"=")&&v(e.toks[s-1]))&&(s-=2),s===r||h(e.toks[s],",")}function ke(e,n,t,o=!1,r=!1){let s=[];return e.toks.forEach((l,i)=>{let a=Bn(e,i);if(a===null)return;let c=Qi(e,t,a,r&&Dn(e,a)),p=o?el(e,i):null;s.push({valueAt:a,site:{kind:"system-arg",path:e.path,line:l.line,value:c,enclosing:ae(n,i),...p?{shortLabel:p}:{}}})}),s}function Qi(e,n,t,o){let{toks:r}=e,s=ie(e,n,t,r.length,o);if(s.kind!=="other")return s;if(h(r[t],"[")){let i=j(r,t);for(let a=t+1;a<i;a++)if(ye(r[a])==="text"&&h(r[a+1],":"))return ie(e,n,a+2)}let l=h(r[t+1],"?")&&h(r[t+2],"?")||h(r[t+1],"|")&&h(r[t+2],"|");return v(r[t])&&l?ie(e,n,t,t+1):s}var ye=e=>e?.kind==="string"?e.value:e?.kind==="ident"?e.text:null;function el(e,n){let{toks:t}=e,o=0;for(let r=n-1;r>=0;r--){let s=t[r];if(s.kind==="punct"){if(")]}".includes(s.text))o++;else if("([{".includes(s.text)){if(o>0){o--;continue}let l=e.lang==="js"&&h(s,"{")?r-1:r;return!h(t[l],"(")||!tl(e,l-1)||e.lang==="js"&&l===r?null:nl(e,r)}}}return null}function tl(e,n){let{toks:t}=e;if(e.lang==="js"&&h(t[n],">")){let o=0;do h(t[n],">")&&!h(t[n-1],"=")?o++:h(t[n],"<")&&o--,n--;while(n>=0&&o>0)}return v(t[n],"Agent")}function nl(e,n){let{toks:t}=e;for(let{from:o,to:r}of B(t,n).reverse()){let s=t[o],l=(v(s,"get")||v(s,"set"))&&(ye(t[o+1])==="name"||h(t[o+1],"["));if(h(s,".")||h(s,"[")||h(s,"*")||l)return null;if(ye(s)!=="name")continue;let i=e.lang==="py"?D(t,o+1):h(t[o+1],":"),a=t[o+2];if(!i||r!==o+3||a?.kind!=="string")return null;let{prefix:c,closed:p}=Be(a);return p&&!/[fb]/i.test(c)&&a.value.trim()||null}return null}function Bn(e,n){let{toks:t}=e,o=t[n],r=ye(o),s=i=>D(t,i),l=i=>h(t[i],":")||e.lang==="py"&&s(i);return r!==null&&qe.has(r)?(e.lang==="py"&&o.kind==="ident"?s(n+1):l(n+1))?e.lang==="js"&&rl(e,n)?null:n+2:e.lang==="js"&&o.kind==="ident"&&(h(t[n-1],"{")||h(t[n-1],","))&&(h(t[n+1],",")||h(t[n+1],"}"))&&!en(e,n)?n:null:r==="role"&&l(n+1)&&t[n+2]?.kind==="string"&&t[n+2].value==="system"?ol(e,n+3):(h(o,"(")||h(o,"["))&&t[n+1]?.kind==="string"&&t[n+1].value==="system"&&h(t[n+2],",")?n+3:v(o,"SystemMessage")&&h(t[n+1],"(")?ye(t[n+2])==="content"&&l(n+3)?n+4:n+2:null}function ol(e,n){let{toks:t}=e;if(!h(t[n],",")||ye(t[n+1])!=="content")return null;let o=t[n+2];return h(o,":")||h(o,"=")?n+3:null}function Wn(e,n,t=!1){let{toks:o}=e,r=B(o,n),s=l=>h(o[l.from],"*")||h(o[l.from],".");return r.some(s)?t?e.lang==="py"&&h(o[n],"(")?r.filter(l=>!s(l)):h(o[n],"{")?r.slice(r.findLastIndex(s)+1):null:null:r}function Kn(e,n,t=!1){let{toks:o}=e,{from:r,to:s}=n,l=Bn(e,r);if((h(o[r],"(")||h(o[r],"["))&&l!==null&&j(o,r)===s-1){let f=B(o,r)[1];return f?[f]:[]}let i=v(o[r],"SystemMessage")&&h(o[r+1],"(")&&j(o,r+1)===s-1,a=h(o[r],"{")&&j(o,r)===s-1;if(!i&&!a)return null;let c=Wn(e,i?r+1:r,t);if(!c)return[];let p=c.flatMap(f=>{let d=ye(o[f.from]);return d!==null&&(h(o[f.from+1],":")||e.lang==="py"&&D(o,f.from+1))?[{key:d,from:f.from+2,to:f.to}]:[]});if(new Set(p.map(f=>f.key)).size!==p.length)return[];if(i)return p.filter(f=>f.key==="content").length?p.filter(f=>f.key==="content"):c[0]?[c[0]]:[];let u=p.find(f=>f.key==="role");return u?p.length===c.length&&u.to===u.from+1&&o[u.from]?.value==="system"?p.filter(f=>f.key==="content"):[]:null}function rl(e,n){let t=e.toks[n+2];return v(t)&&vo(t.text)||en(e,n)}var sl=20,il=/^(?:messages\.(?:create|stream)|chat\.completions\.create|responses\.create|generateText|streamText|Runner\.run)\(/,ll=/\/v1\/(?:messages|chat\/completions)$/;function Pr(e,n,t){let{toks:o}=e;return o.flatMap((r,s)=>{if(!v(r))return[];let l=o.slice(s,s+7).map(p=>p.text).join(""),i=xt.includes(o[s-1]?.text??""),a=n&&r.text==="query"&&o[s+1]?.text==="("&&o[s-1]?.text!==".";return(il.test(l)&&(r.text!=="Runner"||t.layouts===!0&&n)||a)&&!i?[s]:[]})}function Lr(e,n,t={}){let o=n.some(s=>Je(s.source,e.lang,t,e)),r=Pr(e,o,t);return xe(e).filter(s=>r.some(l=>s.from<=l&&l<s.open&&e.toks.slice(l,s.open).every(i=>v(i)||h(i,"."))))}function Bt(e,n,t,o={}){let{toks:r}=e,s=t.filter(a=>Je(a.source,e.lang,o,e)),l=s.length>0,i=s.map(a=>({line:a.line,at:null}));return r.forEach((a,c)=>{if(ee(a)){ll.test(a.value)&&i.push({line:a.line,at:c});return}}),Pr(e,l,o).forEach(a=>i.push({line:r[a].line,at:a})),i.sort((a,c)=>a.line-c.line||(a.at??-1)-(c.at??-1)),i.slice(0,sl).map(({line:a,at:c})=>({kind:"sdk",path:e.path,line:a,value:null,enclosing:c===null?null:ae(n,c)}))}var Mr=new Set(["withStructuredOutput","with_structured_output","bind","bind_tools","bindTools"]),al=new Set([...Mr,"with_config","withConfig","model_dump"]),Ir=e=>Mr.has(e),Ar=/(?:client|llm|model)/i,cl=/(?:llm|model)/i,Or=/(?:config|registry|settings)/i;function Un(e){return/^(?:[A-Z]\w*|dict)$/.test(e.callee.split(".").at(-1))}function Cr(e){let n=new Set(Lr(e.source,q(e.source)).map(t=>t.open));return new Map(e.calls.map(t=>{if(n.has(t.open))return[t,"sdk"];if(Un(t))return[t,"request"];let o=t.callee.split("."),r=o.at(-1),s=o.at(-2);if(al.has(r)||o.some(u=>Or.test(u))||/^(?:assert|mock|log|save|write)|^(?:debug|info|warning|warn|error|critical|exception|trace)$/i.test(r))return[t,"other"];let l=o.length===2&&s?e.binding(s,t.from):void 0,i=l&&!l.append&&e.bindingIsCertain(l,t.from)?Z(e,l):void 0,a=i?.callee.split(".")[0],c=a?e.importBinding(a,l.from):void 0,p=i?.callee.includes(".")?i.callee.split(".").at(-1):c?.name;return c&&p&&Or.test(p)?[t,"other"]:[t,cl.test(r)||s&&Ar.test(s)||c&&p&&Ar.test(p)?"model":"other"]}))}var V=50,fl=new Set(["replace","replaceAll","format","format_messages","formatMessages"]);function jr(e,n,t={}){let o=e.source,{toks:r}=o,s=V*V,l=()=>!t.sentPrompt||--s>=0,i=new Map,a=(y,k)=>{let x=e.importBinding(y,k),w=x&&me([x.module],o.lang).find($=>$.name===y);return w?{namespace:x.namespace,importBinding:w}:null},c=y=>[...new Map(y.map(k=>[JSON.stringify(k),k])).values()].slice(0,V),p=y=>{let k=B(r,y),x=k.map($=>r[$.from]);return!k.every($=>(v(r[$.from])||r[$.from].kind==="string")&&(h(r[$.from+1],":")||v(r[$.from])&&$.to===$.from+1))||new Set(x.map($=>$.value||$.text)).size!==x.length?null:k},u=(y,k)=>e.functions.some(x=>x.from<k&&k<x.to&&x.params?.includes(y)),f=({from:y,to:k})=>{let x=[],w=y;for(let $=y;$<k;$++){if(["(","[","{"].some(L=>h(r[$],L))){$=j(r,$);continue}if(v(r[$])&&["if","else","and","or"].includes(r[$].text))return null;h(r[$],"+")&&(x.push({from:w,to:$}),w=$+1)}return[...x,{from:w,to:k}]},d=(y,k)=>{let x=/^([A-Za-z_$][\w$]*)(\(\))?(?:\.([A-Za-z_$][\w$]*))?$/.exec(y.trim()),w=x&&a(x[1],k);return!x||!w?[]:[{kind:w.namespace&&x[3]&&!x[2]?"module-member":"symbol",callee:`${x[1]}${x[2]&&x[3]?"()":""}${x[3]?`.${x[3]}`:""}`,literals:[],importBinding:w.importBinding,...t.sentPrompt?{trace:[]}:{}}]},S=(y,k)=>t.sentPrompt?k.map(x=>({...x,trace:[{path:o.path,from:r[y.at].line,to:r[y.to-1].endLine},...x.trace??[]].slice(0,V)})):k,_=(y,k,x)=>{if(t.sentPrompt&&x.size>=V)return;let w=e.binding(y,k);return w&&e.bindingIsCertain(w,k)&&!w.append&&!x.has(w.at)&&(!u(y,k)||e.owner(w.at)===e.owner(k))?w:void 0},g=y=>{if(y.append)return!0;let k=f(oe(e,y));return!!k&&k.length>1&&k.some(x=>{let{from:w,to:$}=oe(e,x);return $===w+1&&v(r[w],y.name)})},E=(y,k,x,w=k)=>{let $=a(y,k);if($)return[{kind:"symbol",callee:y,literals:[],importBinding:$.importBinding,...t.sentPrompt?{trace:[]}:{}}];let L=t.sentPrompt?e.binding(y,k):void 0;if(L&&g(L)&&L.at<k&&!x.has(L.at)&&x.size<V){let O=new Set([...x,L.at]),I=E(y,L.at,O,w);return S(L,c([...I,...e.bindingIsCertain(L,w)?R(L,O):[]]))}let A=_(y,k,x);if(A&&!e.bindingIsCertain(A,w))return[];if(A){let I=(t.sentPrompt?i.get(A.at):void 0)??R(A,new Set([...x,A.at]));return t.sentPrompt&&i.set(A.at,I),S(A,I)}return[]},R=(y,k=new Set)=>{if(!l())return[];let x=oe(e,y),{from:w,to:$}=x;if(w>=$||!r[w])return[];if(t.sentPrompt){let O=f(x);if(!O)return[];if(O.length>1)return c(O.flatMap(T=>R(T,k)));let I=Te(o,w);if(I?.next===$){let T=n.find(N=>I.partStarts.includes(N.start));return c([...T?[{kind:"site",callee:"",literals:[],siteStart:T.start}]:[],...r.slice(w,$).flatMap((N,F)=>N.formatted&&o.lang==="py"?ko(N.text).flatMap(W=>b(W,w+F,k)):[])])}}let L=n.find(O=>O.start===r[w].start);if(ee(r[w])&&$===w+1){let O=L?[{kind:"site",callee:"",literals:[],siteStart:L.start}]:[];if($===w+1&&r[w].kind==="template")for(let I of r[w].value.matchAll(/\$\{([^{}]*)\}/g))O.push(...d(I[1],w));return c(O)}if($===w+1&&v(r[w]))return E(r[w].text,w,k);let A=Z(e,x);if(A){let O=r[A.open-1].text;if(fl.has(O)&&h(r[A.open-2],"."))return R({from:A.from,to:A.open-2},k);let I=e.operations.find(T=>T.call.from===A.from&&T.call.to===A.to);if(I&&at(e,A)){let T=Se(Q(e,I.path),o.path);return T?[{kind:"bound-file",callee:A.callee,literals:[T]}]:[]}if(!A.args.length)return d(A.callee,w)}if(h(r[w],"[")&&j(r,w)===$-1)return c(B(r,w).flatMap(O=>R(O,k)));if(h(r[w],"{")&&j(r,w)===$-1){let O=p(w);if(!O)return[];let I=F=>O.find(W=>(v(r[W.from],F)||r[W.from]?.value===F)&&h(r[W.from+1],":")),T=I("role"),N=I("content");return T&&N&&["system","user"].includes(r[T.from+2]?.value)?R({from:N.from+2,to:N.to},k):[]}if($===w+3&&v(r[w])&&h(r[w+1],".")&&v(r[w+2]))return d(`${r[w].text}.${r[w+2].text}`,w);if(h(r[$-2],".")&&v(r[$-1])){let O=Z(e,{from:w,to:$-2});if(O&&!O.args.length)return d(`${O.callee}().${r[$-1].text}`,w)}return[]},b=(y,k,x)=>{let w=X(o.path,y,o.lang),$=w.toks,L=(A,O)=>{if(!l())return[];for(;h($[A],"(")&&j($,A)===O-1;)A++,O--;for(let I=A;I<O;I++){if(["(","[","{"].some(T=>h($[I],T))){I=j($,I);continue}if(h($[I],"!")||h($[I],"="))return L(A,I);if(h($[I],"+"))return c([...L(A,I),...L(I+1,O)])}return O===A+1&&v($[A])?E($[A].text,k,x):O===A+3&&v($[A])&&h($[A+1],".")&&v($[A+2])?d(`${$[A].text}.${$[A+2].text}`,k):[]};return L(0,$.length)},m=(y,k=new Set,x=y.from,w=!1)=>{if(!l()||k.size>=V)return[];if(t.sentPrompt&&o.lang==="py"&&h(r[y.from],"*")&&h(r[y.from+1],"*"))return m({from:y.from+2,to:y.to},k,x,!0);let $=!w&&Kn(o,y,t.sentPrompt);if($)return c($.flatMap(C=>R(C,k)));let L=oe(e,y),{from:A,to:O}=L;if(t.sentPrompt&&!w){let C=f(L);if(!C)return[];if(C.length>1)return c(C.flatMap(K=>m(K,k,x)))}if(O===A+1&&v(r[A])){let C=_(r[A].text,A,k);return C&&e.objectIsCertain(C,x)?S(C,m(C,new Set([...k,C.at]),x,w)):[]}let I=!w&&Kn(o,L,t.sentPrompt);if(I)return c(I.flatMap(C=>R(C,k)));if(!w&&h(r[A],"[")&&j(r,A)===O-1)return c(B(r,A).flatMap(C=>m(C,k,x)));let T=Z(e,L),N=h(r[A],"{")&&j(r,A)===O-1?A:!w&&T&&Un(T)?T.open:null;if(N===null)return[];let F=Wn(o,N,t.sentPrompt);if(!F)return[];let W=F.flatMap(C=>{let K=r[C.from];return(v(K)||K?.kind==="string")&&(h(r[C.from+1],":")||o.lang==="py"&&D(r,C.from+1))?[{key:K.value||K.text,from:C.from+2,to:C.to}]:[]});return new Set(W.map(C=>C.key)).size!==W.length?[]:c(W.flatMap(C=>qe.has(C.key)?R(C,k):["messages","request"].includes(C.key)?m(C,k,x):[]))},P=(y,k=new Set)=>{let x=oe(e,y),{from:w,to:$}=x;if($===w+1&&v(r[w])){let N=r[w].text,F=e.binding(N,w);return!!F&&e.bindingIsCertain(F,w)&&!F.append&&!k.has(F.at)&&(!u(N,w)||e.owner(F.at)===e.owner(w))&&P(F,new Set([...k,F.at]))}let L=Z(e,x);if(!L)return!1;let A=r[L.open-1].text;if(Ir(A))return P({from:L.from,to:L.open-2},k);let O=L.callee.split(".")[0],I=e.importBinding(O,w),T=L.callee.includes(".")?L.callee.split(".").at(-1):I?.name??O;return!!I&&Je(I.module.source,o.lang)&&/^(?:Chat(?!Prompt|Message|History)|AzureChat|BaseChat|LLM)/.test(T)},M=()=>{s=V*V,i.clear()};return{values:(...y)=>(M(),R(...y)),requestValues:(...y)=>(M(),m(...y)),modelValue:P,objectFields:p,unique:c}}var ul=30;function Tr(e,n){let t=(e?.modelIds??[]).filter(o=>Math.abs(o.line-n)<=ul);return t.sort((o,r)=>Math.abs(o.line-n)-Math.abs(r.line-n)||o.line-r.line),t[0]??null}function ft(e,n,t,o){let r=Tr(e.byPath.get(n),t);return r||!o?r:Tr(e.byPath.get(o.path),o.line)}function pl(e,n,t){let o=t.model;if(o?.kind==="literal"&&jt.test(o.text))return n.modelIds.find(f=>f.value===o.text&&f.line>=t.line)??{value:o.text,path:n.path,line:t.line};if(o?.kind!=="member")return null;let[r,s,l]=o.text.split(".");if(!s||l)return null;let i=new Map;for(let f of e.files)for(let d of f.modelMembers??[])i.set(d.object,[...i.get(d.object)??[],d]);let a=je(e,n,r,i).filter(f=>f.member===s);if(a.length!==1)return null;let{value:c,path:p,line:u}=a[0];return{value:c,path:p,line:u}}function ml(e,n,t){if(!t.shape)return;let o=n.imports.find(s=>s.name===t.shape),r=o?Ie(e,n,o):[];return{name:t.shape,path:r.length===1?r[0].path:n.path,line:o?.line??t.line}}function Gn(e,n){let t=new Map,o=new Map;for(let c of e.files){for(let p of c.loaders??[])t.set(p.name,[...t.get(p.name)??[],p]);for(let p of c.promptReturns??[])o.set(p.fn,[...o.get(p.fn)??[],p])}let r=e.files.flatMap(c=>c.sites.filter(p=>p.kind==="file")),s=V*V,l=s,i=(c,p,u,f=new Set)=>{if(p.trace&&--l<0)return[];let d=a(c,p,u,f);return p.trace?d.map(S=>({...S,trace:[...p.trace,...S.trace??[]].slice(0,V)})):d},a=(c,p,u,f)=>{let d=`${c.path}:${JSON.stringify(p)}`;if(f.has(d)||f.size>=V)return[];let S=new Set([...f,d]);if(p.kind==="site")return c.sites.filter(b=>b.start===p.siteStart).map(b=>({site:b,sdk:c.sdk}));if(p.kind==="symbol"||p.kind==="module-member"){let[b,m]=p.callee.split("."),P=b.replace(/\(\)$/,""),M=(c.promptBindings??[]).filter(A=>A.name===p.callee.replace("().","."));if(!p.importBinding&&M.length)return M.flatMap(A=>A.loads.flatMap(O=>i(c,O,u,S)));let y=p.importBinding?[p.importBinding]:c.imports.filter(A=>A.name===P);if(y.length!==1)return[];let k=y[0],{files:x,submodule:w}=dr(e,c,k,!!p.trace&&!!m);if(x.length!==1)return[];let $=x[0],L=p.kind==="module-member"||w?m:m?`${k.imported}.${m}`:k.imported;return L?i($,{kind:"symbol",callee:L,literals:[]},u,S):[]}if(p.kind==="bound-file"||p.kind==="chainlite")return p.literals.flatMap(b=>{let m=p.kind==="bound-file"?[b]:[Wt.join(Wt.dirname(c.path),b),Wt.join(Wt.dirname(c.path),"prompts",b)],P=r.filter(M=>m.includes(M.path));return P.length===1?P.map(M=>({site:M,sdk:p.kind==="chainlite"||c.sdk})):[]});let _=p.kind==="loader"||p.kind==="return",g=_?je(e,c,p.callee,t):[];if(g.length)return g.flatMap(b=>p.literals.flatMap(m=>{let P=b.ext&&!m.endsWith(b.ext)?m+b.ext:m,M=b.folder?`${b.folder}/${P}`:P;return jn(r,b.path,M,!b.ext).map(k=>({site:k,sdk:e.byPath.get(b.path)?.sdk??!1}))}));let E=_&&u?je(e,c,p.callee,o):[];return E.length?E.flatMap(b=>b.loads.flatMap(m=>i(e.byPath.get(b.path),m,!1,S))):p.kind==="read"||p.kind==="file-key"?Xe(p.literals).flatMap(b=>jn(r,c.path,b).map(m=>({site:m,sdk:c.sdk}))):[]};for(let c of e.files){if(c.sdk||c.callSites.some(u=>u.kind==="system-arg"))for(let u of c.loadedPromptRefs??[])for(let f of r.filter(d=>d.path===u.value))Ce(n,f,{kind:"L3",callPath:c.path,callLine:u.line,callExcerpt:u.value,wrapper:null,shortLabel:null,sdk:c.sdk,modelId:ft(e,c.path,u.line,null)});let p=new Map;for(let u of c.deliveries??[]){let f=`${u.callStart??u.line}:${u.callee}`;p.set(f,[...p.get(f)??[],u])}for(let u of p.values()){l=s;let f={...u[0],model:u.find(m=>m.model)?.model??null,shape:u.find(m=>m.shape)?.shape??null},d=u.flatMap(m=>m.loads.flatMap(P=>i(c,P,!0)).map(P=>({...P,untraced:!m.trace?.length}))),S=[...new Map(d.map(m=>[Y(m.site),m.site])).values()];if(!S.length)continue;let _=u.some(m=>m.trace?.length);_&&S.every(m=>m.kind!=="file")&&S.sort((m,P)=>P.chars-m.chars);let g=_?[...new Set(S.slice(1).filter(m=>m.path!==S[0].path).map(m=>m.path))]:S.slice(1).map(m=>m.path),E=_?S.slice(1).filter(m=>m.kind!=="file").map(Y):[],R=ml(e,c,f),b=[...u.flatMap(m=>m.trace??[]),...d.flatMap(m=>m.trace??[])];Ce(n,S[0],{kind:"L4",callPath:c.path,callLine:f.line,callExcerpt:`${f.callee}(\u2026)`,...f.callStart!==void 0?{callStart:f.callStart}:{},..._?{knownSdk:u.some(m=>m.knownSdk===!0)}:{},..._&&d.some(m=>m.untraced&&Y(m.site)===Y(S[0]))?{untraced:!0}:{},...b.length?{trace:[...new Map(b.map(m=>[JSON.stringify(m),m])).values()]}:{},wrapper:null,shortLabel:null,sdk:c.sdk||d.some(m=>m.sdk),modelId:pl(e,c,f),...g.length?{alsoLoads:g}:{},...E.length?{alsoSites:E}:{},...R?{shape:R}:{}})}}}function Nr(e,n,t,o,r=!1){let s=e.files.filter(l=>l.path!==n.path).flatMap(l=>l.sites.filter(i=>i.symbol===t));return Mn(e,n,o,s,r)}function Dr(e,n,t){let o=n.sites.filter(s=>s.symbol===t);if(o.length>0)return o;let r=n.imports.find(s=>s.name===t);return r?Nr(e,n,r.imported,r):[]}function dl(e,n,t,o){return Nr(e,n,o,t,!0)}function hl(e,n,t){let o=(e.wrappers.get(t)??[]).filter(l=>l.path===n.path);if(o.length>0)return o;let r=n.imports.find(l=>l.name===t);if(!r)return[];let s=e.wrappers.get(r.imported)??[];return Mn(e,n,r,s)}function gl(e,n,t,o){if(t.kind!=="system-arg"||!t.value)return!1;let r=Br(e,n,t.value);for(let s of r)Ce(o,s,{kind:"L1",callPath:n.path,callLine:t.line,callExcerpt:`system prompt ${t.value.text}`,wrapper:null,shortLabel:t.shortLabel??null,sdk:n.sdk,modelId:ft(e,n.path,t.line,null)});return r.length>0}function xl(e,n){return e.args.find(t=>t.name===n.paramName)??e.args.filter(t=>t.name===null)[n.paramIndex]}function Br(e,n,t){return t.kind==="literal"&&t.siteStart!==null?n.sites.filter(o=>o.start===t.siteStart):t.kind==="identifier"?Dr(e,n,t.text):t.kind==="member"?Sl(e,n,t.text):[]}function Sl(e,n,t){let o=/^(\w+)\.(\w+)$/.exec(t);if(!o)return[];let r=n.imports.find(s=>s.name===o[1]);return r?dl(e,n,r,o[2]):/^(?:self|cls|this|[A-Z]\w*)$/.test(o[1])?Dr(e,n,o[2]):[]}function yl(e,n,t){for(let o of n.wrapperCalls)for(let r of hl(e,n,o.name)){let s=xl(o,r);if(s)for(let l of Br(e,n,s))Ce(t,l,{kind:"L2",callPath:n.path,callLine:o.line,callExcerpt:`${o.name}(\u2026)`,wrapper:r,shortLabel:o.shortLiterals.length===1?o.shortLiterals[0]:null,sdk:n.sdk||(e.byPath.get(r.path)?.sdk??!1),modelId:ft(e,n.path,o.line,r)})}}function zn(e,n=!1){return e.filter(t=>t.sdk||t.callSites.some(o=>o.kind==="system-arg")).flatMap(t=>n?t.priorFileRefs??[]:t.fileRefs)}function Yu(e,n){let t=e.flatMap(o=>st(n,o.value).map(r=>({promptPath:r.path,readerPath:o.path})));return[...new Map(t.map(o=>[JSON.stringify(o),o])).values()]}function Fr(e,n){let t=e.files.flatMap(o=>o.sites.filter(r=>r.kind==="file"));if(t.length!==0)for(let o of zn(e.files)){let r=e.byPath.get(o.path);for(let s of st(t,o.value))Ce(n,s,{kind:"L3",callPath:r.path,callLine:o.line,callExcerpt:o.value,wrapper:null,shortLabel:null,sdk:r.sdk,modelId:ft(e,r.path,o.line,null)})}}function Wr(e,n={}){let t=new Map;for(let a of e.flatMap(c=>c.wrappers))t.set(a.name,[...t.get(a.name)??[],a]);let o={byPath:new Map(e.map(a=>[a.path,a])),files:e,wrappers:t,moduleResolver:n.moduleResolver},r=new Map,s=[];for(let a of e){for(let c of a.callSites)c.kind!=="system-arg"||gl(o,a,c,r)||c.value&&c.value.kind!=="literal"&&s.push({path:a.path,line:c.line});yl(o,a,r)}let l;if(n.includePrior&&e.some(a=>a.priorDeliveries!==void 0)){let a=e.map(p=>p.priorDeliveries===void 0?p:{...p,deliveries:p.priorDeliveries,fileRefs:p.priorFileRefs??p.fileRefs,promptBindings:void 0,loadedPromptRefs:void 0}),c={...o,files:a,byPath:new Map(a.map(p=>[p.path,p]))};l=new Map(r),Fr(c,l),Gn(c,l)}Fr(o,r),Gn(o,r);let i=new Set([...r.values()].flat().filter(a=>a.kind==="L4").map(a=>`${a.callPath}:${a.callLine}`));return{links:r,...l?{priorLinks:l}:{},callsWithoutPrompt:s.filter(a=>!i.has(`${a.path}:${a.line}`))}}var ut={named:3,prose:2,file:3,link:4,sdk:1},Kr=6,kl=3,Ur={L1:0,L2:1,L4:1.5,L3:2};function pt(e,n){return e<n?-1:e>n?1:0}function wl(e){return[...e].sort((t,o)=>Ur[t.kind]-Ur[o.kind]||Number(o.sdk)-Number(t.sdk)||pt(t.callPath,o.callPath)||t.callLine-o.callLine)[0]??null}function bl(e){return(e.named?ut.named:0)+(e.prose?ut.prose:0)+(e.kind==="file"?ut.file:0)}function Vn(e,n,t){let o=wl(n),r=t||n.some(i=>i.sdk),s=bl(e)+(o?ut.link:0)+(r?ut.sdk:0),l=n.length>0&&n.every(i=>i.trace?.length&&!i.knownSdk&&!i.untraced)?Math.min(s,Kr-1):s;return l<kl?null:{tier:l>=Kr?"strong":"possible",score:l,prompt:e,link:o&&{kind:o.kind,callPath:o.callPath,callLine:o.callLine,callExcerpt:o.callExcerpt,...o.callStart!==void 0?{callStart:o.callStart}:{},...o.trace?{trace:o.trace}:{},wrapper:o.wrapper,shortLabel:o.shortLabel},sdk:r,modelId:o?.modelId??null,...o?.alsoLoads?.length?{alsoLoads:o.alsoLoads}:{},...o?.shape?{shape:o.shape}:{}}}function Kt(e,n){return(n.selectionScore??n.score)-(e.selectionScore??e.score)||pt(e.prompt.path,n.prompt.path)||e.prompt.line-n.prompt.line}function zr(e,n){let t={files:e},o=new Map(e.map(a=>[a.path,a])),r=n.flatMap(a=>{let c=a.link;if(c?.kind!=="L4")return[];let p=o.get(c.callPath),u=p?.deliveries?.find(d=>d.line===c.callLine&&`${d.callee}(\u2026)`===c.callExcerpt&&(c.callStart===void 0||d.callStart===c.callStart));if(!u)return[];let f=p?.stepCalls?.find(d=>d.callStart===u.callStart&&d.line===u.line);return[{path:c.callPath,candidate:a,delivery:u,enclosingStart:f?.enclosingStart}]}),s=new Map;for(let a of r){let c=a.delivery.enclosing;c&&s.set(c,[...s.get(c)??[],a])}let l=new Map,i=(a,c,p)=>{let u=Y(a.candidate.prompt),f=Y(c.candidate.prompt);if(u===f)return;let d=l.get(u)??[];d.some(S=>S.to===f&&S.kind===p)||d.push({to:f,kind:p}),l.set(u,d)};for(let a of e){let c=r.filter(f=>f.path===a.path),p=[...a.stepCalls??[]];for(let{delivery:f}of c)p.some(d=>Gr(d,f))||p.push({callee:f.callee,line:f.line,callStart:f.callStart,enclosing:f.enclosing,resultVar:f.resultVar,argNames:[]});p.sort((f,d)=>f.line-d.line||(f.callStart??0)-(d.callStart??0));let u=new Map;for(let f of p){let d=f.localTarget===null?[]:je(t,a,f.callee,s).filter(E=>f.localTarget===void 0||E.enclosingStart===f.localTarget),S=c.filter(E=>E.delivery.enclosing!==null&&E.delivery.enclosing===f.enclosing&&(E.enclosingStart===void 0||f.enclosingStart===void 0||E.enclosingStart===f.enclosingStart));for(let E of S)for(let R of d)i(E,R,"calls");let _=`${f.enclosing??""}:${f.enclosingStart??""}`,g=u.get(_)??new Map;for(let E of f.argNames){let R=g.get(E);if(!(!R||f.argCalls&&Object.hasOwn(f.argCalls,E)&&f.argCalls[E]!==R.callStart))for(let b of R.steps)for(let m of d)i(b,m,"feeds")}f.resultVar&&g.set(f.resultVar,{steps:[...d,...c.filter(E=>Gr(f,E.delivery))],callStart:f.callStart}),u.set(_,g)}}return l}function Gr(e,n){return e.line===n.line&&e.callee===n.callee&&(n.callStart===void 0||e.callStart===n.callStart)}function Xn(e){let{links:n,callsWithoutPrompt:t,priorLinks:o}=Wr(e,{includePrior:!0}),r=new Set([...n.values()].flatMap(f=>f.flatMap(d=>d.alsoLoads??[]))),s=new Set([...n.values()].flatMap(f=>f.flatMap(d=>d.trace?.length?[]:d.alsoLoads??[]))),l=new Set([...n.values()].flatMap(f=>f.flatMap(d=>d.alsoSites??[]))),i=[];for(let f of e)for(let d of f.sites){if((d.kind==="file"&&r.has(d.path)||s.has(d.path)||l.has(Y(d)))&&!(n.get(Y(d))??[]).some(g=>g.kind!=="L3"))continue;let S=n.get(Y(d))??[],_=Vn(d,S,f.sdk);if(_&&o&&!S.some(g=>g.trace?.length)){let g=Vn(d,o.get(Y(d))??[],f.sdk);g?.score!==_.score&&(_.selectionScore=g?.score??0)}_&&i.push(_)}i.sort(Kt);let a=zr(e,i);for(let f of i){let d=a.get(Y(f.prompt));d?.length&&(f.links=d)}let c=e.flatMap(f=>f.modelIds).sort((f,d)=>pt(f.path,d.path)||f.line-d.line),p=zn(e,!0),u=e.flatMap(f=>f.snippets??[]).map(f=>{let d=Xn([f.hits]),S={path:f.hits.path,span:f.span,imports:f.hits.imports,status:"unresolved"};return{...d,strong:d.strong.map(_=>({..._,documentation:S})),possible:d.possible.map(_=>({..._,documentation:S})),documentation:S}});return{...p.length?{filenameReferences:p}:{},strong:[...i.filter(f=>f.tier==="strong"),...u.flatMap(f=>f.strong)].sort(Kt),possible:[...i.filter(f=>f.tier==="possible"),...u.flatMap(f=>f.possible)].sort(Kt),callsWithoutPrompt:[...t,...u.flatMap(f=>f.callsWithoutPrompt)].sort((f,d)=>pt(f.path,d.path)||f.line-d.line),repoModelIds:c,...u.length?{documentedImports:u.map(f=>f.documentation)}:{},scanned:e.length}}import{posix as dt}from"node:path";function Vr(e,n,t,o,r={}){let s=z(e);if(!s)return[];let l=X(e,n,s),{toks:i}=l,a=q(l),c=J(l,{includeMembers:!0}),p=mt(l,"default");p?.name==="default"&&c.push(p),c.sort((_,g)=>_.from-g.from||g.to-_.to);let u=[],f=vl(l),d=Rl(l,o),S=_=>c.filter(g=>g.params!==null&&g.from<_&&_<g.to).at(-1)?.name??null;for(let _ of kt(e,n,s,!0)){let g=a.find(m=>m.source===_.source&&m.names.join("\0")===_.names.join("\0")),E=g?.names.map(m=>({name:m,imported:g.defaultName===m?"default":g.renamed?.[m]??m}))??El(l,_.source),R=g?.line??i.find(m=>m.kind==="string"&&m.value===_.source)?.line??1,b=_l(l,R);for(let{name:m,imported:P}of E){let M=ge(e,_.source,[P],s,t,!0)??null,y={from:e,to:M,symbol:m,imported:P,source:_.source,...M?{}:{reason:_.source.startsWith(".")?"missing":"external"}},k=i.some(($,L)=>L>b&&v($,m)&&D(i,L+1))||c.some($=>$.name===m&&$.from>b&&!c.some(L=>L.from<$.from&&$.from<L.to&&(L.params!==null||L.kind==="class")));if(k)continue;let x=Xr(l,m);for(let $ of x)u.push({...y,symbol:$,kind:"import",usage:"reexport",within:null,span:{from:R,to:R}});let w=g?i.flatMap(($,L)=>!k&&v($,m)&&L>b&&!["def","function","class"].includes(i[L-1]?.text??"")&&(!h(i[L-1],".")||h(i[L-2],".")&&h(i[L-3],"."))&&!c.some(A=>A.from<L&&L<A.to&&A.params?.includes(m))?[L]:[]):[];if(!w.length&&!x.length){let $=ce(r,"CF_IMPORT_LEXICAL_FACTS")?S(i.findIndex(L=>L.line===R)):null;u.push({...y,kind:"import",usage:$?"reference":"reexport",within:$,span:{from:R,to:R}})}for(let $ of w){let L=f.find(T=>T.from<=$&&$<T.to),A=!d||d.from<=(L?.at??$)&&(L?.at??$)<d.to,O=L&&!A&&(L.kind!=="tool-registration"||d?.to===0),I=L&&(A||O)?L.kind:"import";u.push({...y,...O?{reason:"unlinked"}:{},kind:I,usage:ne(i,$,l)?"call":"reference",within:S($),span:{from:Math.min(i[L?.at??$].line,i[$].line),to:Math.max(i[L?.at??$].endLine,i[$].endLine)}})}}if(!E.length){let m=ge(e,_.source,[],s,t,!0)??null;u.push({from:e,to:m,kind:"import",symbol:"*",imported:"*",source:_.source,usage:"reexport",within:null,span:{from:R,to:R},...m?{}:{reason:_.source.startsWith(".")?"missing":"external"}})}}for(let _=0;_<i.length;_++)!v(i[_])||!["import","import_module","require"].includes(i[_].text)||!h(i[_+1],"(")||i[_+2]?.kind==="string"&&h(i[_+3],")")||u.push({from:e,to:null,kind:"import",symbol:"*",imported:"*",source:"",usage:"call",within:S(_),reason:"dynamic",span:{from:i[_].line,to:i[_].endLine}});return u.filter((_,g)=>u.findIndex(E=>JSON.stringify(E)===JSON.stringify(_))===g)}function _l(e,n){let{toks:t}=e,o=t.findIndex(r=>r.line===n);for(let r=o;r<t.length;r++){if(e.lang==="py"&&t[r].line>n)return r-1;if(h(t[r],";")||e.lang==="js"&&t[r].kind==="string")return r}return t.length-1}function El(e,n){let{toks:t}=e,o=[];for(let r=0;r<t.length;r++){if(!v(t[r],"export"))continue;let s=r+1;if(!h(t[s],"{"))continue;let l=j(t,s);!v(t[l+1],"from")||t[l+2]?.value!==n||o.push(...B(t,s).flatMap(i=>v(t[i.from])?[{name:t[i.to-1].text,imported:t[i.from].text}]:[]))}return o}function Xr(e,n){let{toks:t}=e,o=[];for(let r=0;r<t.length;r++)if(!(!v(t[r],"export")||!h(t[r+1],"{"))&&!v(t[j(t,r+1)+1],"from"))for(let s of B(t,r+1))v(t[s.from],n)&&o.push(t[s.to-1].text);return o}function mt(e,n){let t=J(e),{toks:o}=e;if(n==="default"){let s=o.findIndex((l,i)=>v(l,"default")&&v(o[i-1],"export"));if(s>=0){let l=s+1;v(o[l],"async")&&l++;let i=v(o[l],"function"),a=i?l+1:l;if(v(o[a])&&(n=o[a].text),h(o[a],"(")){let c=j(o,a),p=i?c+1:c+3;if(i||h(o[c+1],"=")&&h(o[c+2],">")){let u=h(o[p],"{")?j(o,p)+1:o.findIndex((f,d)=>d>=p&&h(f,";"));return{name:"default",line:o[l].line,from:l,to:u<0?o.length:u,params:B(o,a).map(f=>v(o[f.from])?o[f.from].text:null),kind:"function"}}}}}let r=t.find(s=>s.name===n);if(r)return r;for(let s of t)if(Xr(e,s.name).includes(n))return s;return null}function Rl(e,n){if(!n||n.path!==e.path)return null;let{toks:t}=e,o=new Set([n.symbol]);for(let a of q(e))for(let c of a.names)(a.renamed?.[c]??c)===n.symbol&&o.add(c);let r=new Map;n.promptPath===e.path&&n.promptStart!==void 0&&r.set(n.promptStart,n.line??1);let s=ke(e,[],r).filter(({site:a})=>(n.line===void 0||a.line===n.line)&&(a.value?.kind==="identifier"&&o.has(a.value.text)||a.value?.siteStart!=null&&a.value.siteStart===n.promptStart)),l=s.length===1?s[0].valueAt:void 0,i=[];for(let a=0;a<t.length;a++){if(!ne(t,a,e))continue;let c=j(t,a+1);(n.callStart!==void 0?t[a].start===n.callStart:l!==void 0?a<l&&l<c:n.line!==void 0&&t[a].line<=n.line&&(t[c]?.endLine??0)>=n.line)&&i.push({from:a,to:c+1})}return l!==void 0||n.callStart!==void 0?i.at(-1)??{from:0,to:0}:i.length===1?i[0]:{from:0,to:0}}function vl(e){let{toks:n}=e,t=[],o=(r,s,l)=>{if(s&&(t.push({...s,at:r,kind:l}),s.to===s.from+1&&v(n[s.from]))){let i=n.flatMap((a,c)=>v(a,n[s.from].text)&&h(n[c+1],"=")?[c+2]:[]);i.length===1&&h(n[i[0]],"[")&&t.push({from:i[0],to:j(n,i[0])+1,at:r,kind:l})}};for(let r=0;r<n.length;r++){let s=n[r].kind==="string"?n[r].value:n[r].text;if(["tools","state_schema","context_schema","config_schema","model_config","llm_config"].includes(s)&&(h(n[r+1],"=")||h(n[r+1],":"))){let i=r+2,a=h(n[i],"[")?j(n,i)+1:i+1;o(r,{from:i,to:a},s==="tools"?"tool-registration":"config")}if(!h(n[r+1],"("))continue;let l=B(n,r+1);["add_node","addNode"].includes(s)&&o(r,l[1],"graph-node"),["StateGraph"].includes(s)&&o(r,l[0],"config"),["bind_tools","bindTools","ToolNode"].includes(s)&&o(r,l[0],"tool-registration")}return t}function _p(e){return[...e].filter(n=>dt.basename(n)==="langgraph.json")}function Jr(e,n,t,o={}){if(dt.basename(e)==="langgraph.json")return $l(e,n,t,o.root);if(z(e)!=="py")return[];let r=X(e,n,"py"),{toks:s}=r,l=J(r),i=fe(r,l,{enclosingBindings:!0}),a=o.root?`${o.root}/llm_config.yaml`:"llm_config.yaml",c=[],p=new Map;for(let u of i.calls){if(u.callee.includes("."))continue;let f=i.importBinding(u.callee,u.from);f?.module.source!=="chainlite"||f.name!=="llm_generation_chain"||s.some((d,S)=>v(d,u.callee)&&d.line!==f.module.line&&!h(s[S+1],"(")&&i.importBinding(u.callee,S)?.module===f.module)||s.some((d,S)=>v(d,"import")&&h(s[S+1],"*"))||p.set(u.callee,[...p.get(u.callee)??[],u.from])}for(let[u,f]of p){let d=o.call?.path===e?o.call:void 0,S=f.filter(_=>d?.callStart!==void 0?s[_].start===d.callStart:d?.line===void 0||s[_].line===d.line);for(let _ of f){let g=j(s,_+1),E=l.filter(R=>R.params!==null&&R.from<_&&_<R.to).at(-1)?.name??null;c.push({from:e,to:t.has(a)?a:null,kind:"config",symbol:u,imported:"*",source:a,usage:"call",within:E,span:{from:s[_].line,to:s[Math.min(g,s.length-1)].endLine},...t.has(a)?d&&(S.length!==1||S[0]!==_)?{reason:"unlinked"}:{}:{reason:"missing"}})}}return c}function $l(e,n,t,o){let r=()=>[{from:e,to:null,kind:"graph-node",symbol:"graphs",imported:"*",source:"",usage:"reference",within:null,span:{from:1,to:Math.max(1,n.split(`
23
+ `).length)},reason:"dynamic"}],s;try{s=JSON.parse(n)}catch{return r()}if(!qr(s)||!qr(s.graphs))return[];let l=s.graphs,i=X(e,n,"js"),{toks:a}=i,c=B(a,0).filter(u=>a[u.from]?.value==="graphs");if(c.length!==1)return r();let p=B(a,c[0].from+2);return p.map(u=>{let f=a[u.from].value,d=l[f],S=p.filter(R=>a[R.from].value===f).length!==1,_=typeof d=="string"?/^(.+):([A-Za-z_$][\w$]*)$/.exec(d):null,g=null,E;if(S||!_)E="dynamic";else if(/^[a-z][a-z\d+.-]*:\/\//i.test(_[1])||!_[1].includes("/")&&!z(_[1]))E="external";else{let R=dt.normalize(dt.join(dt.dirname(e),_[1]));!_[1].startsWith("/")&&!_[1].includes("\\")&&!/^[A-Za-z]:/.test(_[1])&&R!==".."&&!R.startsWith("../")&&U(R,o)!==null&&z(R)&&t.has(R)?g=R:E="missing"}return{from:e,to:g,kind:"graph-node",symbol:f,imported:_?.[2]??"*",source:typeof d=="string"?d:"",usage:"reference",within:f,span:{from:a[u.from].line,to:a[u.to-1].endLine},...E?{reason:E}:{}}})}function Ep(e,n,t,o,r={}){let s=z(e);if(!s)return[];let l=X(e,n,s),{toks:i}=l,a=mt(l,t);if(!a||a.params!==null)return[];let c=i.findIndex((R,b)=>b>=a.from&&b<a.to&&D(i,b));if(c<0)return[];let p=v(i[c+1])&&h(i[c+2],".")&&v(i[c+3],"compile"),u=p?i[c+1].text:t,f=p?mt(l,u):a;if(!f||!i.slice(f.from,f.to).some(R=>v(R,"StateGraph")))return[];if([t,u].some(R=>i.filter((b,m)=>v(b,R)&&D(i,m+1)).length!==1))return[];let d=J(l),S=R=>d.filter(b=>b.params!==null&&b.from<R&&R<b.to).map(b=>b.from).join(","),_=[{from:f.from,to:f.to}];for(let R=0;R<i.length;R++)v(i[R],u)&&h(i[R+1],".")&&["add_node","addNode"].includes(i[R+2]?.text)&&h(i[R+3],"(")&&S(R)===S(f.from)&&_.push({from:R,to:j(i,R+3)+1});let g=[];for(let R of _)for(let b=R.from;b<R.to;b++){if(!["add_node","addNode"].includes(i[b]?.text)||!h(i[b+1],"(")||S(b)!==S(f.from))continue;let m=B(i,b+1)[1];if(!m||m.to!==m.from+1||!v(i[m.from]))continue;let P=i[m.from].text;!Yr(l,P)||i.some((y,k)=>v(y,P)&&D(i,k+1))||g.push({from:e,to:e,kind:"graph-node",symbol:P,imported:P,source:P,usage:"reference",within:null,span:{from:i[b].line,to:i[m.from].endLine}})}return[...Vr(e,n,o,void 0,r).filter(R=>(R.kind==="config"||R.kind==="graph-node")&&_.some(b=>i.slice(b.from,b.to).some(m=>v(m,R.symbol)&&m.line>=R.span.from&&m.line<=R.span.to))),...g].filter((R,b,m)=>m.findIndex(P=>JSON.stringify(P)===JSON.stringify(R))===b)}function Rp(e,n,t,o){let r=z(e);if(!r||o?.path!==e)return!1;let s=X(e,n,r),l=Yr(s,t);if(!l)return!1;let i=(a,c)=>o.callStart!==void 0?s.toks[a].start<=o.callStart&&s.toks[c-1].end>o.callStart:o.line!==void 0&&s.toks[a].line<=o.line&&s.toks[c-1].endLine>=o.line;return i(l.from,l.to)&&(o.callStart!==void 0||J(s).filter(a=>a.params!==null&&i(a.from,a.to)).length===1)}function Yr(e,n){let t=mt(e,n);return t&&t.params!==null&&J(e).filter(o=>o.name===t.name).length===1?t:null}function qr(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}var Pl=new Set(["invoke","ainvoke","batch","abatch","stream","astream"]);function Hr(e,n,t,o={}){let r=fe(e,n,{enclosingBindings:!0,completeExpressions:o.sentPrompt}),{toks:s}=e,{values:l,requestValues:i,modelValue:a,objectFields:c,unique:p}=jr(r,t,o),u=r.assignments.filter(g=>r.owner(g.at)===null).filter(g=>r.assignments.filter(E=>E.name===g.name&&r.owner(E.at)===null).length===1).filter(g=>r.bindingIsCertain(g,s.length)).map(g=>({name:g.name,loads:l(g,new Set([g.at]))})).filter(g=>g.loads.length).slice(0,V),f=[],d=Jr(e.path,e.text,new Set),S=(g,E,R=null,b=!1,m=!1)=>{if(!E.length||f.length===V)return;let P=r.assignments.find(M=>Z(r,M)===g);f.push({path:e.path,line:s[g.from].line,callStart:s[g.from].start,callee:g.callee,key:null,loads:p(E),model:R,shape:null,enclosing:r.owner(g.from)?.name??null,resultVar:P?.name??null,...b?{knownSdk:m,trace:[{path:e.path,from:s[g.from].line,to:s[g.to-1].endLine}]}:{}})};for(let g of r.calls){if(o.coverage===!1)break;if(d.some(E=>E.symbol===g.callee&&E.span.from===s[g.from].line)){let E=g.args[0],R=E&&Q(r,E),b=g.args.find(m=>v(s[m.from],"engine")&&h(s[m.from+1],"="));R&&S(g,[{kind:"chainlite",callee:g.callee,literals:[R]}],b?ie(e,new Map,b.from+2,b.to):null);continue}Pl.has(s[g.open-1].text)&&h(s[g.open-2],".")&&a({from:g.from,to:g.open-2})&&g.args[0]&&S(g,l(g.args[0]),null,o.sentPrompt===!0,!0)}if(o.sentPrompt){let g=Cr(r);for(let E of r.calls){let R=E.args.map(P=>({...P,key:s[P.from]?.value||s[P.from]?.text,pair:D(s,P.from+1)||h(s[P.from+1],":")})),b=g.get(E);if(b!=="model"&&b!=="sdk")continue;let m=R.flatMap(P=>P.pair&&qe.has(P.key)?l({from:P.from+2,to:P.to}):i({from:P.pair?P.from+2:P.from,to:P.to}));S(E,m,null,!0,b==="sdk")}}for(let g=0;g<s.length&&u.length<V;g++){let E=v(s[g],"return")?r.owner(g):null;if(!E||r.owner(E.from)!==null||r.functions.filter(b=>b.name===E.name).length!==1||r.assignments.some(b=>b.name===E.name)||s.filter((b,m)=>v(b,"return")&&r.owner(m)===E).length!==1||s.slice(E.from,g).some(b=>b.kind==="ident"&&["if","for","while","switch","try","catch"].includes(b.text)))continue;if(h(s[g+1],"{")){let b=c(g+1);if(!b)continue;for(let m of b){let P=s[m.from];if(!v(P)&&P.kind!=="string")continue;let M=h(s[m.from+1],":")?m.from+2:m.from,y=l({from:M,to:m.to});y.length&&u.length<V&&u.push({name:`${E.name}.${P.value||P.text}`,loads:y})}continue}let R=l({from:g+1,to:se(e,g+1)});R.length&&u.push({name:E.name,loads:R})}let _=r.operations.flatMap(g=>{if(!at(r,g.call))return[];let E=Se(Q(r,g.path),e.path);return E?[{value:E,path:e.path,line:g.line}]:[]});return{bindings:u,deliveries:f,loadedRefs:_}}var Ll=new Map([["python","py"],["py","py"],["javascript","js"],["js","js"]]);function Zr(e,n,t){return n.filter(o=>/\.md$/i.test(o)&&Oo(e,o)&&ve(e,o,t)?.kind==="example")}function Ut(e,n){if(!/\.md$/i.test(e))return[];let t=[],o,r=0,s=n.split(`
24
+ `);for(let l=0;l<s.length;l++){let i=s[l].replace(/\r$/,""),a=/^ {0,3}(`{3,}|~{3,})(.*)$/.exec(i);if(a){let c=a[1][0],p=a[1].length,u=a[2].trim();o?c===o.marker&&p>=o.width&&!u&&(o.lang&&r>o.start&&t.push({path:e,lang:o.lang,start:o.start,end:r,span:{from:o.line,to:l}}),o=void 0):(c!=="`"||!u.includes("`"))&&(o={marker:c,width:p,lang:Ll.get(u.split(/\s+/)[0].toLowerCase()),start:r+s[l].length+1,line:l+2})}r+=s[l].length+1}return t}function Kp(e,n,t){let o=new Set(Zr(e,Object.keys(n)));if(!o.size)return n;let r=t.nodes.flatMap(s=>s.files??[]).filter(s=>s.role==="system prompt"&&s.span);return Object.fromEntries(Object.entries(n).map(([s,l])=>{if(!o.has(s))return[s,l];let i=r.filter(c=>c.path===s).map(c=>c.span),a=Ut(s,l).filter(c=>i.some(p=>c.span.from<=p.from&&p.to<=c.span.to));return a.length?[s,l.split(`
25
+ `).map((c,p)=>a.some(u=>u.span.from<=p+1&&p+1<=u.span.to)?c:"").join(`
26
+ `)]:[s,l]}))}function Qr(e,n,t,o,r){if(!o||!Zr(e,[n]).length)return null;let s=Ut(n,t).find(i=>i.span.from<=o.from&&o.to<=i.span.to);if(!s)return null;let l=Et(t.slice(s.start,s.end),o.from-s.span.from+1,r);return{text:l.text,fromLine:s.span.from+l.fromLine-1}}function Up(e,n){return e.split("").map((t,o)=>/[\r\n]/.test(t)||n.some(r=>r.start<=o&&o<r.end)?t:" ").join("")}var es=200,ts=300,Jn=/SYSTEM|PROMPT|INSTRUCTION/i,Al=/^\s*You(?:['’]re)?(?![\w'’])/;function ns(e,n,t={}){let o=t.minChars!==void 0,r=t.promptFunctions!==!1,s=[],l=new Map,i=new Set,a=(c,p)=>{i.has(c)||(i.add(c),s.push(p),l.set(c,p.span.from))};for(let c=0;c<e.toks.length;c++){let p=Ol(e,c,o||r);if(!p)continue;let u=r?ct(e,p.valueAt):null,f=Te(e,u??p.valueAt);!f||f.text.length<(t.minChars??es)||!o&&!Jn.test(e.toks[p.nameAt].text)&&!(u!==null&&Gt(f.text,!!f.filledAtRunTime))||(a(f.start,qn(e,f,{named:!0,prose:Gt(f.text,r&&!!f.filledAtRunTime),line:e.toks[p.nameAt].line,symbol:e.toks[p.nameAt].text,enclosing:ae(n,p.declAt)},r&&!!f.filledAtRunTime)),f.partStarts.forEach(d=>i.add(d)))}return r&&e.toks.forEach((c,p)=>{let u=v(c,"return")?n.filter(E=>E.params!==null&&E.from<p&&p<E.to).sort((E,R)=>R.from-E.from)[0]:void 0,f=Dn(e,p);if(!u&&!f)return;let d=u?p+1:p,S=f?ct(e,d):null,_=Te(e,S??d);if(!_||_.text.length<(t.minChars??es))return;let g=Gt(_.text,!!_.filledAtRunTime);u&&!o&&!Jn.test(u.name)&&!g||(a(_.start,qn(e,_,{named:!!u||!g,prose:g,line:u?.line??_.line,symbol:u?.name??null,enclosing:u?.name??ae(n,p)},!!_.filledAtRunTime)),_.partStarts.forEach(E=>i.add(E)))}),e.toks.forEach((c,p)=>{if(!ee(c)||i.has(c.start)||c.value.length<(t.minChars??ts))return;let u=r&&Fn(c),f=Gt(c.value,u);if(!o&&!f)return;let d={start:c.start,line:c.line,endLine:c.endLine,text:c.value,partStarts:[c.start],next:p+1};a(c.start,qn(e,d,{named:!1,prose:f,line:c.line,symbol:null,enclosing:ae(n,p)},u))}),s.sort((c,p)=>c.line-p.line),{sites:s,siteLineByStart:l}}function Gt(e,n=!1){let t=n?e.replace(/^(?:\s*\$?\{[^{}]*\})+\s*/,""):e;return e.length>=ts&&Al.test(t)}function qn(e,n,t,o=!1){return{kind:t.named?"named":"prose",...t,path:e.path,endLine:n.endLine,span:{from:n.line,to:n.endLine},start:n.start,chars:n.text.length,excerpt:_e(n.text),...o?{filledAtRunTime:!0}:{}}}function Ol(e,n,t){let{toks:o}=e,r=e.lang==="js";if(r&&!(v(o[n])&&["const","let","var"].includes(o[n].text)))return null;let s=r?n+1:n;if(!v(o[s])||!t&&!Jn.test(o[s].text)||!r&&!(re(o,n)&&Ml(e,n)))return null;let l=s+1;if(h(o[l],":")){let i=l+We;for(;l<i&&l<o.length&&!D(o,l);)l++}return D(o,l)?{declAt:n,nameAt:s,valueAt:l+1}:null}function Ml(e,n){let t=be(e.text,e.toks[n]);if(t===0)return!0;for(let o=n-1;o>=0;o--)if(!(!re(e.toks,o)||be(e.text,e.toks[o])>=t))return v(e.toks[o],"class");return!1}function zt(e,n,t){let o=[];for(let r of n){let{params:s}=r;if(s)for(let{site:l,valueAt:i}of t){if(l.value?.kind!=="identifier"||i<=r.from||i>=r.to)continue;let a=s.indexOf(l.value.text),c=o.some(p=>p.name===r.name&&p.paramIndex===a);a>=0&&!c&&o.push({name:r.name,paramIndex:a,paramName:l.value.text,path:e.path,line:r.line})}}return o}var Il=200,Cl=40;function os(e,n,t,o){let{toks:r}=e,s=[];for(let l=0;l<r.length&&s.length<Il;l++){let i=r[l];if(!ne(r,l)||h(r[l-1],".")||xt.includes(r[l-1]?.text??""))continue;let a=B(r,l+1).map(p=>jl(e,t,p));a.some(p=>p.kind==="literal"&&p.siteLine!==null||p.kind==="identifier"&&o.has(p.text))&&s.push({name:i.text,path:e.path,line:i.line,args:a,shortLiterals:a.filter(p=>p.kind==="literal"&&p.siteLine===null&&p.text.length>0&&p.text.length<=Cl).map(p=>p.text),enclosing:ae(n,l)})}return s}function jl(e,n,t){let{toks:o}=e,r=e.lang==="py"&&v(o[t.from])&&D(o,t.from+1),s=r?t.from+2:t.from;return{...ie(e,n,s,t.to),name:r?o[t.from].text:null}}var rs=50;function Vt(e,n,t,o,r,s){let{toks:l}=e,i=new Set(n.map(u=>u.name)),a=u=>Ve(n,u),c=new Map(t.map(u=>[u.from,u])),p=new Set(s.map(u=>u.callStart));return t.filter(u=>i.has(u.callee)||r.has(u.callee.split(".")[0])||p.has(l[u.from].start)).slice(0,rs).map(u=>{let f=a(u.from),d=[...new Set(u.args.flatMap(k=>{let{from:x,to:w}=k;for(e.lang==="py"&&v(l[x])&&D(l,x+1)&&(x+=2);h(l[x],"(")&&j(l,x)===w-1;)x++,w--;if(!v(l[x]))return[];for(let $=x+1;$<w;$+=2)if(!h(l[$],".")||!v(l[$+1]))return[];return[l[x].text]}))].slice(0,rs),S=k=>o.findLast(x=>x.name===k&&x.at<u.from&&a(x.at)===f&&!(x.from<=u.from&&u.from<x.to)),_=k=>{let x=v(l[k.from],"await")?k.from+1:k.from,w=c.get(x);return!k.append&&w?.to===k.to?w:null},g=Object.fromEntries(d.flatMap(k=>{let x=S(k);if(!x)return[];let w=_(x);return[[k,w?l[w.from].start:null]]})),E=o.find(k=>_(k)===u),R=n.filter(k=>k.from<u.from&&u.from<k.to),b=n.filter(k=>k.name===u.callee&&(!a(k.from)||R.includes(a(k.from)))).sort((k,x)=>(a(x.from)?.from??-1)-(a(k.from)?.from??-1))[0],m=u.callee.split(".")[0],P=R.findLast(k=>k.params?.includes(m)||o.some(x=>x.name===m&&x.at<u.from&&a(x.at)===k)),M=P&&(!b||(a(b.from)?.from??-1)<P.from),y=M?null:b?l[b.from].start:null;return{callee:u.callee,resultVar:E?.name??null,argNames:d,enclosing:f?.name??null,line:l[u.from].line,callStart:l[u.from].start,...f?{enclosingStart:l[f.from].start}:{},...b||M||i.has(u.callee)?{localTarget:y}:{},...Object.keys(g).length?{argCalls:g}:{}}})}var Fe=50,Tl=200,ss=new Set(["system","systemPrompt","system_prompt","instructions","prompt","template","template_file"]),Fl=new Set(["model","engine","schema","response_format","output_type","outputSchema","tools","messages","max_tokens","maxTokens"]),Nl=new Set(["schema","response_format","output_type","outputSchema"]),is=/(?:template|template_file|prompt_file)$/;function ls(e,n){let{toks:t}=e,o=n.filter(x=>x.params!==null),r=x=>Ve(o,x),s=xe(e),l=new Map(s.map(x=>[x.from,x])),i=q(e),a=new Set(me(i,e.lang).map(x=>x.name)),c=Bt(e,n,i).length>0,p=zt(e,n,ke(e,n,new Map)),u=new Map(s.flatMap(x=>{let w=Dl(e,x),$=p.find(A=>A.name===x.callee),L=w.filter(A=>c||$||w.some(O=>O.object===A.object&&Fl.has(O.key)));return c||$||L.length?[[x,{fields:L,wrapper:$}]]:[]})),f=Tt(e),d=new Map(f.map(x=>[x.at,x])),S=new Map(f.filter(x=>!x.append).map(x=>[v(t[x.from],"await")?x.from+1:x.from,x.name])),_=$r({},{[e.path]:e.text},{source:e,scopes:n},"operations"),g=Rr(_.operations),E=new Map(g.map(x=>[x.call.from,x.path])),R=[];for(let x of o){for(let w of g){if(r(w.call.from)!==x)continue;let $=vr(w,x,e.lang);if(!(!$||R.some(L=>L.name===x.name&&L.line===x.line))&&(R.push({name:x.name,paramIndex:$.paramIndex,folder:$.folder,ext:$.ext,path:e.path,line:x.line}),R.length===Fe))break}if(R.length===Fe)break}let b=new Set(R.map(x=>x.name)),m=new Map,P=x=>[...new Map(x.map(w=>[JSON.stringify(w),w])).values()].slice(0,Fe),M=x=>t.slice(x.from,x.to).filter(ee).filter(w=>w.value.length<=Tl).map(w=>w.value).slice(0,Fe),y=[];for(let x=0;x<2;x++){let w=new Map;y=[];let $=(L,A)=>{let{from:O,to:I}=L;for(v(t[O],"await")&&O++;h(t[O],"(")&&j(t,O)===I-1;)O++,I--;if(I===O+1&&v(t[O]))return w.get(A)?.get(t[O].text)??[];let T=l.get(O);if(T&&T.to===I){let N=E.get(O);if(N){let K=M(N);return Xe(K).length>0?[{kind:"read",callee:T.callee,literals:K}]:[]}if(u.get(T)?.fields.some(K=>ss.has(K.key)||K.key==="messages"))return[];let F=T.args[0]?M(T.args[0]):[],W=a.has(T.callee.split(".")[0]),C=[...m.keys()].some(K=>K.name===T.callee);if(C||(b.has(T.callee)||W)&&(F.length>0||W&&T.args.length===0))return[{kind:C?"return":"loader",callee:T.callee,literals:F}]}return[]};for(let L=0;L<t.length;L++){let A=r(L),O=d.get(L);if(O){let{name:C,append:K}=O,he=w.get(A)??new Map;he.set(C,P([...K?he.get(C)??[]:[],...$(O,A)])),w.set(A,he)}if(v(t[L],"return")&&A&&!R.some(C=>C.name===A.name&&C.line===A.line)){let C=$({from:L+1,to:se(e,L+1)},A);C.length&&(m.has(A)||m.size<Fe)&&m.set(A,{fn:A.name,loads:P([...m.get(A)?.loads??[],...C]),path:e.path,line:A.line})}let I=l.get(L);if(!I||y.length===Fe)continue;let T=u.get(I);if(!T)continue;let{fields:N,wrapper:F}=T,W=(C,K,he=!1)=>{let ue=$(C,A);if(!ue.length&&he){let pe=M(C);Xe(pe).length>0&&(ue=[{kind:"file-key",callee:I.callee,literals:pe}])}if(!ue.length||y.length===Fe)return;let De=N.filter(pe=>C.object===void 0||pe.object===C.object),we=De.find(pe=>pe.key==="model"||pe.key==="engine"),Ht=De.find(pe=>Nl.has(pe.key)),Ns=we?ie(e,new Map,we.from,we.to):null,po=Ht?ie(e,new Map,Ht.from,Ht.to):null,Ds=po?.kind==="identifier"?po.text:null,Bs=S.get(I.from)??null;y.push({path:e.path,line:t[I.from].line,callStart:t[I.from].start,callee:I.callee,key:K,loads:ue,model:Ns,shape:Ds,enclosing:A?.name??null,resultVar:Bs})};for(let C of N)if((ss.has(C.key)||is.test(C.key))&&W(C,C.key,e.lang==="py"&&is.test(C.key)),C.key==="messages")for(let K=C.from;K<C.to;K++){if(!h(t[K],"{"))continue;let he=Yn(e,K),ue=he.find(we=>we.key==="role");if(!ue||t[ue.from]?.kind!=="string"||!["system","user"].includes(t[ue.from].value))continue;let De=he.find(we=>we.key==="content");De&&ue.from<De.from&&W({...De,object:C.object},"content"),K=j(t,K)}F&&I.args[F.paramIndex]&&!N.length&&W(I.args[F.paramIndex],null)}}let k=Vt(e,o,s,f,a,y);return{loaders:R,promptReturns:[...m.values()],deliveries:y,stepCalls:k}}function Yn(e,n){let{toks:t}=e;return B(t,n).flatMap(({from:o,to:r})=>{let s=v(t[o])?t[o].text:t[o]?.kind==="string"?t[o].value:null;return s?h(t[o+1],":")||e.lang==="py"&&D(t,o+1)?[{key:s,from:o+2,to:r,object:n}]:r===o+1?[{key:s,from:o,to:r,object:n}]:[]:[]})}function Dl(e,n){return e.lang==="py"?Yn(e,n.open):n.args.flatMap(t=>h(e.toks[t.from],"{")?Yn(e,t.from):[])}function Hn(e){return{path:e,sites:[],callSites:[],sdk:!1,sdkLine:null,wrappers:[],wrapperCalls:[],imports:[],modelIds:[],fileRefs:[]}}function cs(e,n,t={}){try{if(t.coverageLinks===!0&&t.documented===!0&&/\.md$/i.test(e)){let o=Ut(e,n).map(r=>({span:r.span,hits:as(e,n.slice(0,r.start).replace(/[^\r\n]/g," ")+n.slice(r.start,r.end),t,r.lang)}));return{...Hn(e),snippets:o}}return as(e,n,t)}catch{return Hn(e)}}function as(e,n,t,o=z(e)){if(!o){let M=qo(e,n);return{...Hn(e),sites:M?[M]:[]}}let r=X(e,n,o),s=J(r,{promptFunctions:t.promptFunctions!==!1}),l=q(r),i=me(l,o),{sites:a,siteLineByStart:c}=ns(r,s,t),p=Bt(r,s,l,t.sdk),u=ke(r,s,c,t.sdk?.layouts===!0&&p.length>0,t.promptFunctions!==!1),f=new Set([...a.flatMap(M=>M.symbol?[M.symbol]:[]),...i.map(M=>M.name)]),d=t.promptLoaders!==!1?ls(r,s):null,S=t.coverageLinks===!0,_=o==="py"&&t.sentPrompt!==!1,g=(S||_)&&d?Hr(r,s,a,{coverage:S,sentPrompt:_}):null,E=[...d?.deliveries??[],...g?.deliveries??[]],R=g?fe(r,s,{completeExpressions:_}):null,b=R?Vt(r,R.functions,R.calls,R.assignments,new Set(i.map(M=>M.name)),E):d?.stepCalls,m=gr(r),P=t.promptLoaders!==!1?xr(r):[];return{path:e,sites:a,callSites:[...u.map(M=>M.site),...p].sort((M,y)=>M.line-y.line),sdk:p.length>0,sdkLine:p.length>0?p[0].line:null,wrappers:zt(r,s,u),wrapperCalls:os(r,s,c,f),imports:i,modelIds:m.modelIds,fileRefs:S&&g?m.promptFileRefs:m.fileRefs,...d?.loaders.length?{loaders:d.loaders}:{},...d?.promptReturns.length?{promptReturns:d.promptReturns}:{},...E.length?{deliveries:E}:{},...S&&g?{priorDeliveries:d?.deliveries??[],priorFileRefs:m.fileRefs}:{},...b?.length?{stepCalls:b}:{},...g?.bindings.length?{promptBindings:g.bindings}:{},...S&&g?.loadedRefs.length?{loadedPromptRefs:g.loadedRefs}:{},...P.length?{modelMembers:P}:{}}}var fs=e=>e.CF_CODE_PROMPT_FUNCTIONS!=="0";var Bl=20;function Xt(e,n){let t=new Set(n),o=new Set;for(let[r,s]of Object.entries(e)){let l=z(r);if(l)for(let i of kt(r,s,l)){let a=ge(r,i.source,i.names,l,t);a!==void 0&&o.add(a)}}return[...o].sort()}function Dm(e,n,t){return Xt(e,n).filter(o=>!_o(o,t)).slice(0,Bl)}function Wl(e,n){let t=Ue(e),o=t?t.split("/"):[],r=n.split("/").slice(0,-1),s=0;for(;s<o.length&&s<r.length&&o[s]===r[s];)s++;return o.slice(0,s).join("/")}function Bm(e,n,t){let o=fs(t),r=Xn(Object.entries(n).map(([i,a])=>cs(i,a,{promptFunctions:o,sentPrompt:yo(t)}))),s=r.strong[0]??r.possible[0];if(!s)return null;let l=s.prompt.path;return{suggestedDir:Wl(e,l),file:l,symbol:s.prompt.symbol}}function Wm(e,n){let t=n.suggestedDir||"the repository root";return`no agent prompt in ${e}; its code imports ${n.file}, which defines ${n.symbol??"a prompt"} \u2014 import ${t} to include it`}function Zn(e,n){if(!n||!h(e[n.from],"{")||j(e,n.from)!==n.to-1)return null;let t=new Map;for(let o of B(e,n.from)){let r=e[o.from];if(!(v(r)||r?.kind==="string")||!h(e[o.from+1],":"))return null;let s=r.kind==="string"?r.value:r.text;if(t.has(s))return null;t.set(s,{from:o.from+2,to:o.to})}return t}function Ne(e,n,t=0){if(!n||t>32)return;let{from:o,to:r}=n,s=e[o];if(s?.kind==="string"&&Be(s).closed){if(r===o+1)return s.value;if(h(e[o+1],"+")){let a=Ne(e,{from:o+2,to:r},t+1);if(typeof a=="string")return s.value+a}}if(r===o+1){if(s?.kind==="number"){let a=Number(s.text.replace(/_/g,""));return Number.isFinite(a)?a:void 0}if(v(s,"true"))return!0;if(v(s,"false"))return!1;if(v(s,"null"))return null}if(h(s,"[")&&j(e,o)===r-1){let a=B(e,o).map(c=>Ne(e,c,t+1));return a.includes(void 0)?void 0:a}let l=Zn(e,n);if(!l)return;let i=[...l].map(([a,c])=>[a,Ne(e,c,t+1)]);return i.some(([,a])=>a===void 0)?void 0:Object.fromEntries(i)}function us(e,n){let t=Zn(e,n);if(!t)return null;let o=Ne(e,t.get("type"));if(o==="function"&&t.has("function")&&(t=Zn(e,t.get("function"))),!t)return null;let r=t.get("input_schema")??(o==="function"?t.get("parameters"):void 0);if(!r)return null;let s=Ne(e,t.get("name")),l=Ne(e,t.get("description"));if(typeof s!="string"||!s.trim()||typeof l!="string")return{tools:[],warnings:["Some tools couldn't be read from code"]};let i=Ne(e,r),a=i!==null&&typeof i=="object"&&!Array.isArray(i);return{tools:[{name:s,description:l,...a?{input_schema:i}:{}}],warnings:a?[]:[`${s}'s arguments couldn't be read from code`]}}function to(e,n){v(e[n],"as")&&v(e[n+1],"const")&&(n+=2);let t=e[n];return t===void 0||t.kind==="punct"&&",;)}]".includes(t.text)||v(t)&&t.line>(e[n-1]?.endLine??t.line)&&!["as","satisfies"].includes(t.text)}function Qn(e,n,t){for(;h(e[n],".");)n++;return v(e[n])?[e[n].text]:!h(e[n],"{")&&!h(e[n],"[")?[]:B(e,n).filter(o=>o.from<o.to&&o.to<=t).flatMap(o=>{let r=o.from;return h(e[n],"{")&&h(e[r+1],":")&&(r+=2),Qn(e,r,o.to)})}function eo(e,n){let{toks:t}=e,o=new Map,r=new Map,s=new Map,l=[];for(let i=0;i<t.length;i++){if(h(t[i],"{")?l.push(i):h(t[i],"}")&&l.pop(),!v(t[i])||!["const","let","var"].includes(t[i].text))continue;let a=l.at(-1);if(n!==void 0&&a!==void 0&&(n<a||n>j(t,a)))continue;let c=v(t[i+1])?i+2:j(t,i+1)+1,p=Qn(t,i+1,c).filter(f=>n===void 0||(r.get(f)??-1)<=l.length);for(let f of p)o.set(f,null),r.set(f,l.length),s.set(f,i);if(!v(t[i],"const")||!v(t[i+1])||!p.length)continue;let u=t[i+1].text;for(let f=i+2;f<Math.min(t.length,i+40)&&!h(t[f],";");f++)if(h(t[f],"=")){o.set(u,null),r.set(u,l.length),h(t[f+1],"[")&&to(t,j(t,f+1)+1)&&(o.set(u,f+1),r.set(u,l.length));break}}if(n!==void 0)for(let i of J(e)){if(i.params===null||n<=i.from||n>=i.to)continue;let a=i.params.filter(c=>c!==null);if(i.params.includes(null)){let c=t.findIndex((p,u)=>u>i.from&&u<n&&h(p,"("));c>=0&&a.push(...bo(t,c,"js").flatMap(({from:p,to:u})=>Qn(t,p,u)))}for(let c of a)(s.get(c)??-1)<=i.from&&o.set(c,null)}return o}function Kl(e){let{toks:n}=e,t=new Map;for(let o=0;o<n.length;o++){if(!v(n[o],"export"))continue;let r=eo(e,o);if(v(n[o+1],"const")){let s=n[o+2]?.text,l=r.get(s);l!=null&&t.set(s,l)}else if(v(n[o+1],"default")){let s=h(n[o+2],"[")?o+2:r.get(n[o+2]?.text),l=h(n[o+2],"[")?j(n,o+2)+1:o+3;s!=null&&to(n,l)&&t.set("default",s)}else if(h(n[o+1],"{"))for(let s of B(n,o+1)){let l=r.get(n[s.from]?.text);l!=null&&t.set(n[s.to-1].text,l)}}return t}function ps(e,n,t){return t.has(e[n.from]?.start)&&h(e[n.from+1],"(")&&j(e,n.from+1)===n.to-1}function Ul(e,n){let t=n?.call;if(!t)return;let{toks:o}=e;if(t.loadedPrompt&&t.callStart!==void 0){let u=o.findIndex(f=>f.start===t.callStart);if(u<0)return;for(;h(o[u+1],".")&&v(o[u+2]);)u+=2;return ne(o,u,e)?{from:u+1,to:j(o,u+1)+1}:void 0}let r=new Set([t.symbol]),s=new Set(Object.keys(n.imports));for(let u of q(e)){let f=ge(e.path,u.source,u.names,"js",s);if(!(t.promptPath&&f!==t.promptPath))for(let d of u.names)((u.renamed?.[d]??d)===t.symbol||f===t.promptPath&&d===u.defaultName)&&r.add(d)}let l=t.promptPath===e.path&&t.promptStart!==void 0?new Map([[t.promptStart,t.line??1]]):new Map,i=ke(e,[],l).filter(({site:u})=>t.line===void 0||u.line===t.line),a=(i.find(({site:u})=>u.value?.siteStart!=null&&u.value.siteStart===t.promptStart)??i.find(({site:u})=>u.value&&r.has(u.value.text))??i[0])?.valueAt;if(a===void 0)return;let c,p;for(let u=0;u<a;u++){if(!h(o[u],"(")&&!h(o[u],"{"))continue;let f=j(o,u)+1;f<=a||(h(o[u],"{")?c={from:u,to:f}:p={from:u,to:f})}return p??c}function ms(e,n,t,o){let r=X(n?.path??"tools.ts",e,"js"),{toks:s}=r,l=n?.call?.loadedPrompt?new Set(J(r).filter(m=>m.params!==null).map(m=>m.name)):new Set,i=eo(r),a=new Map,c=n?.imports??{},p=new Set(Object.keys(c));for(let m of q(r)){let P=ge(r.path,m.source,m.names,"js",p);if(P===void 0)continue;let M=X(P,c[P],"js"),y=o(c[P]);for(let[k,x]of Kl(M))for(let w of m.names)(m.defaultName===w?"default":m.renamed?.[w]??w)===k&&a.set(w,{toks:M.toks,open:x,path:P,calls:y})}let u=new Set,f=new Set,d=[],S="Some tools couldn't be read from code",_=Ul(r,n),g=!1;for(let m=0;m<s.length;m++){if(_&&(m<_.from||m>=_.to))continue;let P=s[m];if(["input_schema","parameters"].includes(P.kind==="string"?P.value:P.text)&&h(s[m+1],":")&&h(s[m+2],"{")){m=j(s,m+2);continue}if((v(P,"tools")||P.kind==="string"&&P.value==="tools")&&h(s[m+1],":")){g=!0;let M=s[m+2],y=eo(r,m),k=h(M,"[")?m+2:v(M)?y.get(M.text):void 0,x=h(M,"[")?j(s,m+2)+1:m+3;if(!to(s,x)){d.push(S);continue}k==null?v(M)&&!y.has(M.text)&&a.has(M.text)?f.add(M.text):d.push(S):u.add(k)}}if(!g)for(let m of i.values())m!==null&&B(s,m).some(P=>us(s,P)||ps(s,P,t))&&u.add(m);let E=[],R=new Map,b=[...u].map(m=>({toks:s,open:m,calls:t,path:null}));b.push(...[...f].map(m=>a.get(m)));for(let{toks:m,open:P,calls:M,path:y}of b){let k=w=>d.push(y?`${y}: ${w}`:w),x=j(m,P);if(!h(m[x],"]")){k(S);continue}for(let w of B(m,P)){let $=us(m,w),L=ps(m,w,M),A=w.to===w.from+1&&v(m[w.from])?m[w.from].text:null,O=g&&y===null&&A&&l.has(A)?{name:A,description:""}:null;if(!$&&!L&&!O)k(S);else{let I=$?$.tools:O?[O]:g&&L?[M.get(m[w.from].start)]:[];for(let T of I)R.has(T.name)||R.set(T.name,y??r.path);E.push(...I),$?.warnings.forEach(k)}}}return{tools:E,warnings:d,selected:g,from:Object.fromEntries(R)}}var ht=String.raw`(?:"(?:[^"\\\n]|\\.)*"|'(?:[^'\\\n]|\\.)*')`,Gl=new RegExp(String.raw`(${ht}|`+"`(?:[^`\\\\]|\\\\.)*`)"+String.raw`|\/\/[^\n]*|\/\*[\s\S]*?\*\/`,"g"),zl=/(?<![\w$])tool\s*(<[^()]*>)?\(/g,Vl=new RegExp(`^${ht}$`),Xl=new RegExp(`^${ht}(?:\\s*\\+\\s*${ht})*$`),ql={n:`
27
+ `,t:" ",r:"\r"};function ds(e){return e.slice(1,-1).replace(/\\(.)/g,(n,t)=>ql[t]??t)}function Jl(e){return e.replace(Gl,(n,t)=>t?t[0]+"_".repeat(t.length-2)+t[t.length-1]:" ".repeat(n.length))}function hs(e,n){let t=0;for(let o=n;o<e.length;o++){let r=e[o];if("([{".includes(r))t++;else if(")]}".includes(r)){if(t===0)return o;t--}else if(r===","&&t===0)return o}return e.length}function gs(e){let n=Jl(e),t=[],o=[],r=new Map,s="a tool( call in tools.ts was skipped: its name and description are not plain text";for(let l of n.matchAll(zl)){let i=n.slice(Math.max(0,l.index-40),l.index).trimEnd();if(i.endsWith(".")&&!i.endsWith("...")||l[1]){o.push(s);continue}let c=hs(n,l.index+l[0].length),p=c+1,u=hs(n,p),f=e.slice(l.index+l[0].length,c).trim(),d=e.slice(p,u).trim();if(n[c]!==","||!Vl.test(f)||!Xl.test(d)){o.push(s);continue}let S=d.match(new RegExp(ht,"g")),_={name:ds(f),description:S.map(ds).join("")};t.push(_),r.set(l.index,_)}return{tools:t,warnings:o,readCalls:r}}function xs(e,n){let{tools:t,warnings:o}=Ss(e,n);return{tools:t,warnings:o}}function Ss(e,n){let{tools:t,warnings:o,readCalls:r}=gs(e),s=new Map(t.map(({name:i})=>[i,n?.path??"tools.ts"])),l=ms(e,n,r,i=>gs(i).readCalls);if(l.selected)return l;t.push(...l.tools),o.push(...l.warnings);for(let[i,a]of Object.entries(l.from))s.has(i)||s.set(i,a);return{tools:t,warnings:o,from:Object.fromEntries(s),selected:!1}}function Qm(e,n,t){let o=Object.fromEntries(e.filter(u=>z(u)==="js"&&n[u]!==void 0).map(u=>[u,n[u]])),r=Xt(o,Object.keys(n)),s=u=>{let f=Object.fromEntries(Xt({[u]:n[u]},Object.keys(n)).filter(S=>r.includes(S)).map(S=>[S,n[S]])),d=Ss(n[u],{path:u,imports:f,...t?.path===u?{call:t}:{}});return{...d,warnings:d.warnings.map(S=>`${u}: ${S}`)}},l=Object.keys(o).map(s),i=l.filter((u,f)=>u.selected&&(!t||Object.keys(o)[f]===t.path)),a=i.length?i:[...l,...r.filter(u=>!o[u]).map(s)],c=new Map;return{tools:a.flatMap(u=>u.tools.filter(f=>c.has(f.name)?!1:(c.set(f.name,u.from[f.name]),!0))),from:Object.fromEntries(c),warnings:[...new Set(a.flatMap(u=>u.warnings))]}}function ys(e){let n;try{n=JSON.parse(e)}catch{return{tools:[],warnings:[".cli.json is not valid JSON; ignored"]}}let t=n?.clis;return!t||typeof t!="object"||Array.isArray(t)?{tools:[],warnings:[]}:{tools:Object.entries(t).map(([r,s])=>{let l=s?.description;return{name:r,description:typeof l=="string"?l:""}}),warnings:[]}}function qt(e){return{label:e,brand:Jt(e)}}function sd(e,n,t,o,r){let s=[],l=a=>{s.push(...a.tools.map(c=>c.name)),r.push(...a.warnings.map(c=>`${n}: ${c}`))};if(o.toolsPath)try{s.push(...ur(t[o.toolsPath]).tools.map(a=>a.name))}catch{r.push(`${n}: tools.json is not a valid tool list; ignored`)}o.toolsTsPath&&l(xs(t[o.toolsTsPath])),o.cliPath&&l(ys(t[o.cliPath]));let i=[];if(o.mcpPath){let a=fr(t[o.mcpPath],o.mcpPath,o.toolsPath!==null);i.push(...a.servers),r.push(...a.warnings.map(c=>`${n}: ${c}`))}return[...new Set(s)].map(qt).concat(i.map(a=>({...qt(a),source:"mcp"})))}function ks(e){let n=e.sourceRef?.repo?`${e.sourceRef.repo}#`:null;return e.unitKey??(n&&e.id.startsWith(n)?e.id.slice(n.length):e.id.startsWith("model:")?e.id:e.id.slice(e.id.indexOf("#")+1))}function ws(e){return ks(e).startsWith("model:")}function no(e){return new Set(e.nodes.filter(ws).flatMap(n=>[...(n.files??[]).map(t=>t.path),...n.sourceRef?[n.sourceRef.path]:[]]))}function oo(e,n){let t=e.trim().replace(/^(\.\/)+/,"");if(!n)return t.includes(" \u203A ")&&t.slice(t.lastIndexOf(" \u203A ")+3).includes("/");if(n.has(t))return!0;for(let o of n){let r=o.indexOf(" \u203A ");if(r>=0&&t.startsWith(o.slice(0,r+3)))return!0}return!1}async function dd(e,n,t,o,r=!1,s){if(n)return n;let l={enabled:o??e.CF_ANALYSIS_IMPORTED_AGENTS!=="0",byRepo:{}};if(!l.enabled)return l;Rt(e)&&(l.grouped=!0);let i=await t?.()??[];r&&(l.agentRows=structuredClone(s?.length?[...s]:i.map((a,c)=>({id:a.id??String(c),repoPath:a.repoPath,unitKey:a.unitKey,notFoundAt:a.notFoundAt??null,...a.githubFetched===void 0?{}:{githubFetched:a.githubFetched}}))));for(let a of i){if(!a.unitKey||!a.repoPath||!a.unitKey.startsWith("model:")&&(!r||!a.codeInputsJson))continue;let c=Eo(a.repoPath);if(!c)continue;let p=a.unitKey.startsWith("model:")?l.byRepo:l.codeByRepo??={};(p[c]??=[]).push(structuredClone({unitKey:a.unitKey,name:a.name,...a.groupKey===void 0?{}:{groupKey:a.groupKey},...a.groupName===void 0?{}:{groupName:a.groupName},systemPrompt:a.systemPrompt,toolsJson:a.toolsJson,model:a.model,...a.codeInputsJson===void 0?{}:{codeInputsJson:a.codeInputsJson},...a.links===void 0?{}:{links:a.links},...a.services===void 0?{}:{services:a.services}}))}return l}function _s(e,n){let t=e.slice(6).split("#")[0];return Yl(t,n)}function Yl(e,n){return n?U(e,St(n))??e:e}function bs(e){return`${_s(e.unitKey)} \u203A ${e.name}`}function ro(e,n,t=""){let o=e?.enabled?e.byRepo[n]??[]:[],r=o.map(bs),s=new Set(Object.entries(e?.enabled?e.byRepo:{}).filter(([a])=>a!==n).flatMap(([,a])=>a.map(bs))),l=o.map((a,c)=>{let p=r.filter(g=>g===r[c]).length>1?`${r[c]} (${a.unitKey.split("#").slice(1).join("#")})`:r[c],u=s.has(r[c])?`${n} \u203A ${p}`:p,f=`${u}/system_prompt.md`,d={[f]:a.systemPrompt??t},S=[{role:"system prompt",label:null,path:f}];if(a.toolsJson?.length){let g=`${u}/tools.json`;d[g]=JSON.stringify(a.toolsJson,null,2),S.push({role:"tools",label:null,path:g})}if(a.services?.length){let g=`${u}/context.md`,E=a.services.map(({name:R,kind:b})=>`${Co(R)}${b===R?"":` (${b})`}`);d[g]=`This agent's code (not the model) reads from or writes to: ${E.join(", ")}.`,S.push({role:"reference",label:"Context",path:g})}return{node:{id:a.unitKey,label:a.name,kind:"agent",desc:"",meta:a.model,sourceRef:{path:f,line:1},files:S,tools:(a.toolsJson??[]).map(g=>qt(g.name))},files:d,keys:[a.unitKey],sourcePath:_s(a.unitKey,n),agentKey:a.unitKey.split("#").slice(1).join("#")}});if(!e?.grouped)return l.map(a=>({...a,steps:[a]}));let i=new Map;return l.forEach((a,c)=>{let p=o[c].groupKey?`group:${o[c].groupKey}`:`step:${c}`,u=i.get(p)??[];u.push(a),i.set(p,u)}),[...i.values()].map(a=>{let c=a[0],p=o.find(u=>u.unitKey===c.node.id);return{...c,steps:a,keys:a.flatMap(u=>u.keys),files:Object.assign({},...a.map(u=>u.files)),node:{...c.node,label:p.groupName??p.name,sourcePaths:[...new Set(a.map(u=>u.sourcePath))],files:a.flatMap(u=>u.node.files),tools:[...new Map(a.flatMap(u=>u.node.tools).map(u=>[u.label,u])).values()]}}})}function or(e,n){return ro(e,n).flatMap(({steps:t})=>t.flatMap(({files:o,sourcePath:r,agentKey:s})=>Object.entries(o).map(([l,i])=>({path:l,text:i,sourcePath:r,agentKey:s,role:l.slice(l.lastIndexOf("/")+1)}))))}function hd(e,n,t,o=""){let r=new Set(t.nodes.filter(p=>p.kind==="agent").map(p=>p.id)),s=[],l={},i=ro(e,n,o);for(let p of i)r.has(p.node.id)||(r.add(p.node.id),s.push(p.node),Object.assign(l,p.files));let a=new Map(i.flatMap(p=>p.keys.map(u=>[u,p.node.id]))),c=jo((e?.enabled?e.byRepo[n]??[]:[]).filter(p=>r.has(a.get(p.unitKey)??p.unitKey)).map(p=>{let u=a.get(p.unitKey)??p.unitKey;return{...p,id:u,scope:n,links:p.links?.map(f=>({...f,to:a.get(f.to)??f.to})).filter(f=>!e?.grouped||f.to!==u),unitKey:u}}));return{nodes:s,files:l,edges:c}}function gd(e,n,t){return t.length?n.filter(o=>!o.startsWith(`${e}: no agent found \u2014`)&&!o.startsWith(`${e}: no agent conventions found (`)):n}function xd(e,n,t){let o=new Set(ro(e,n).flatMap(r=>Object.keys(r.files)));return o.size?Object.fromEntries(Object.entries(t).filter(([r])=>!o.has(r))):t}var Hl=["stripe","slack","postgresql","datadog","pagerduty","jira","googlecalendar"],Zl=new Set(Hl);function Jt(e){if(!e)return null;let n=e.trim().toLowerCase();return Zl.has(n)?n:null}function Ql(e,n){let t=[...e.warnings],o=new Set(e.nodes.map(i=>i.id)),r=new Set,s=e.nodes.map(i=>{let a=[],c=new Set;for(let p of i.tools??[]){let u=p.label.trim();if(!u){t.push(`${n}: dropped a tool with no name on ${i.id}`);continue}let f=`${p.source??"tool"}:${u}`;if(c.has(f)){t.push(`${n}: ${i.id} lists ${u} twice \u2014 kept one`);continue}c.add(f);let d=Jt(p.brand);p.brand&&!d&&!r.has(p.brand)&&(r.add(p.brand),t.push(`${n}: "${p.brand}" is not a provider mark we can draw \u2014 those tools render without one`)),a.push({label:u,brand:d,...p.source?{source:p.source}:{}})}return{...i,tools:a}}),l=e.edges.filter(i=>{let a=o.has(i.from)&&o.has(i.to);return a||t.push(`${n}: dropped edge ${i.from} \u2192 ${i.to} (unknown endpoint)`),a});return e.nodes.some(i=>i.kind==="agent")||t.push(`${n}: the mapping found no agent node \u2014 the graph may be incomplete`),{fragment:{...e,nodes:s,edges:l,warnings:[]},warnings:t}}var Yt=2e4;function Es(e){return e.trim().replace(/^(?:\.?\/)+/,"")}function ea(e,n,t,o={}){let r=[],s=new Map;for(let c of Object.keys(n))s.set(Es(c),c);let l={},i=no(e),a=e.nodes.map(c=>{let p=[],u=[];for(let f of c.files??[]){let d=f.path.trim();if(!d)continue;let S=s.get(Es(d));if(S===void 0){r.push(`${t}: node ${c.id} lists ${d} as a definition file, which the analysis never read \u2014 dropped`);continue}let _=n[S],g=_.length>Yt,E=(f.role==="system prompt"?Qr(o,S,_,f.span,Yt):null)??(g&&f.span&&f.role==="system prompt"&&an(S)?Et(_,f.span.from,Yt):null),R=E?E.text:g?_.slice(0,Yt):_;g&&!oo(S,i)&&r.push(`${t}: node ${c.id}'s ${f.role} file (${S}) is ${_.length} characters \u2014 stored truncated at ${R.length}`),p.push({role:f.role,label:f.label??null,path:S,...f.span?{span:f.span}:{},...f.filledAtRunTime?{filledAtRunTime:!0}:{}}),u.push({...f.filledAtRunTime?{filledAtRunTime:!0}:{},role:f.role,...f.label?{label:f.label}:{},path:S,tokens:Po(_.length),text:R,...g?{truncated:!0,storedChars:R.length}:{},...f.span?{span:f.span}:{},...E?{fromLine:E.fromLine}:{}})}return u.length&&(l[c.id]=u),{...c,files:p}});return{fragment:{...e,nodes:a},nodes:l,warnings:r}}function ta(e){let n=[],t=[];for(let{repoKey:o,fragment:r,files:s}of e){let l=i=>`${o}#${i}`;for(let i of r.nodes){let a=s?.[i.id],c=(i.tools??[]).map(p=>({label:p.label,...p.brand?{brand:p.brand}:{},...p.source?{source:p.source}:{}}));n.push({id:l(i.id),label:i.label,kind:i.kind,desc:i.desc,meta:i.meta,...i.sourcePaths?{sourcePaths:i.sourcePaths}:{},sourceRef:i.sourceRef?{repo:o,path:i.sourceRef.path,line:i.sourceRef.line}:null,...a?.length?{files:a}:{},...c.length?{tools:c}:{}})}for(let i of r.edges)t.push({from:l(i.from),to:l(i.to),kind:i.kind,label:i.label,sourceRef:i.sourceRef?{repo:o,path:i.sourceRef.path,line:i.sourceRef.line}:null})}return{nodes:n,edges:t}}var na={critical:0,high:1,medium:2,low:3};function so(e){return na[e]}function Rs(e){let n=e?.trim();return n&&n.length<=280?n:null}var oa=2,io=4,lo=120,vs="Which should the agent do?",ra="asked to pose a question, answered with one fix";function $s(e){if(!on(e.category))return{question:null,fixes:e.fixes,warnings:[]};let n=`finding "${e.title}"`;if(e.fixes.length<oa)return{question:null,fixes:e.fixes,warnings:[`${n}: ${ra}`]};let t=[],o=e.fixes;o.length>io&&(t.push(`${n}: ${o.length} options proposed; keeping the first ${io}`),o=o.slice(0,io));let r=(e.question??"").trim();return r?r.length>lo&&(t.push(`${n}: the question is longer than ${lo} characters; cut`),r=`${r.slice(0,lo-1).trimEnd()}\u2026`):(t.push(`${n}: no question with ${o.length} options; asking "${vs}"`),r=vs),{question:r,fixes:o,warnings:t}}var sa="users";function Ps(e){let n=xo.safeParse(e);return n.success?n.data:sa}function Ls(e,n){if(rn(n))return Ps(e)}function ia(e){let n={users:[],team:[]};for(let t of e)n[Ps(t.audience)].push(t);return n}function Cd(e){if(!e.every(n=>n===void 0))return e.every(n=>n==="team")?"team":"users"}function As(e){let n=e.replace(/\s/g," "),t=[],o=[],r=!0;for(let s=0;s<e.length;s++){let l=n[s];l===" "&&r||(t.push(l),o.push(s),r=l===" ")}return{text:t.join("").trimEnd(),offsets:o}}function*Os(e,n){let t=As(e),o=As(n).text;if(!o)return;let r=i=>e.slice(0,t.offsets[i]).split(`
28
+ `).length,s=t.text.indexOf(o);if(s>=0){for(let i=s;i>=0;i=t.text.indexOf(o,i+1))yield[{from:r(i),to:r(i+o.length-1)}];return}let l=o.split(/\s*(?:\.{3}|…)\s*/);if(!(l.length<2||l.some(i=>!i)))for(let i=t.text.indexOf(l[0]);i>=0;i=t.text.indexOf(l[0],i+1)){let a=i+l[0].length,c=[{from:r(i),to:r(a-1)}],p=!0;for(let u of l.slice(1)){let f=t.text.indexOf(u,a);if(f<0||/\n\s*\n|\n\s*#{1,6}\s|\n[^\s][^:\n]*:/.test(e.slice(t.offsets[a-1]+1,t.offsets[f]))){p=!1;break}a=f+u.length,c.push({from:r(f),to:r(a-1)})}p&&(yield c)}}function Ms(e,n){for(let t of Os(e,n))return t[0].from;return null}function Td(e,n,t){if(!Number.isInteger(t)||t<1)return null;for(let o of Os(e,n)){if(o[0].from===t)return o;if(o[0].from>t)break}return null}function ao(e){if(typeof e=="string")try{e=JSON.parse(e)}catch{return}let n=gt.safeParse(e);if(!n.success)return;let t=n.data;if(t.state==="active")return t;if(!(!t.reason.trim()||!t.evidence.length)&&!(t.state==="switched_off"&&(!t.gate?.trim()||t.evidence.length<2))&&!(t.state==="dead"&&t.gate!==null))return t}function co(e,n){return bt(n)?ao(e):void 0}var Is=/[\w$-]/;function Cs(e,n){for(let t=e.indexOf(n);t!==-1;t=e.indexOf(n,t+1)){let o=t>0?e[t-1]:"",r=e[t+n.length]??"";if(!Is.test(o)&&!Is.test(r))return!0}return!1}function aa(e,n,t,o){let r=n.evidence[0];if(![...e.site?[e.site]:[],...e.otherSites??[]].some(a=>a.path===r.path&&a.line===r.line)||!r.path.endsWith(".json"))return!1;try{JSON.parse(t[r.path])}catch{return!1}let l=r.excerpt.match(/^\s*[{]?\s*["']?([\w$-]+)["']?\s*:/)?.[1];if(o.some(a=>/\b(?:glob|rglob|readdir|readdirSync|listdir|scandir|iterdir)\b/.test(a))||!l||!Object.hasOwn(t,r.path)||o.reduce((a,c)=>a+c.split(l).length-1,0)!==1)return!1;let i=r.path.split("/").at(-1);return!o.some(a=>a.includes(r.path)||a.includes(i))}function ca(e,n,t,o){let r=n.gate?.match(/^([A-Za-z_][\w]*)(?:=[^\r\n]+)?$/)?.[1];if(!r||n.evidence.length!==2||n.evidence.some(f=>!Cs(f.excerpt,r)))return!1;let s=/^\s*if ["']([^"']+)["'] in os\.getenv\(["']([A-Za-z_]\w*)["'], ["']["']\)\.split\(["'],["']\):\s*$/,l=/^\s*if \(process\.env\.([A-Za-z_]\w*) === ["'](?:1|true)["']\)\s*\{?\s*$/,i=/^\s*(?:export )?([A-Za-z_]\w*)\s*=\s*(?:["']["']|false|False|0|null|None|undefined)?\s*(?:#.*)?$/,a=f=>s.exec(f)?.[2]===r||l.exec(f)?.[1]===r,c=f=>i.exec(f)?.[1]===r,[p,u]=n.evidence;return!a(p.excerpt)||!c(u.excerpt)||/^(?:false|False|0|null|None|undefined)$/.test(s.exec(p.excerpt)?.[1]??"")?!1:o.every(f=>f.split(`
29
+ `).every(d=>!Cs(d,r)||a(d)||c(d)))&&fa(e,n,t)}function fa(e,n,t){let o=n.evidence[0],r=t[o.path].split(`
30
+ `),s=r[o.line-1],l=s.length-s.trimStart().length,i=[],a=!1,c=s.trimEnd().endsWith(":");if(!c&&!s.trimEnd().endsWith("{"))return!1;for(let u of r.slice(o.line)){if(u.trim()&&u.length-u.trimStart().length<=l){if(!c&&u.trim()!=="}")return!1;a=!0;break}if(u.includes(" ")||!c&&/[{}]/.test(u))return!1;i.push(u)}if(!c&&!a)return!1;let p=[...e.site?[e.site]:[],...e.otherSites??[]];return p.length>0&&p.every(u=>u.path===o.path?(u.line??0)>o.line&&(u.line??0)<=o.line+i.length:i.some(f=>f.includes(`"${u.path}"`)||f.includes(`'${u.path}'`)))}function Wd(e,n,t,o=Object.values(n),r=!0){return e.map(s=>{let{activity:l,...i}=s,a=co(l,t);return!a||!r&&a.state!=="active"||a.evidence.some(c=>{let p=Object.hasOwn(n,c.path)?n[c.path]:void 0;return typeof p!="string"||!Number.isInteger(c.line)||c.line<1||!c.excerpt.trim()||Ms(p.split(`
31
+ `).slice(c.line-1).join(`
32
+ `),c.excerpt)!==1})||a.state==="dead"&&!aa(s,a,n,o)||a.state==="switched_off"&&!ca(s,a,n,o)?i:{...i,activity:a}})}function ua(e,n=!0){let t=[],o=[];for(let r of e){let s=n?ao(r.activity):void 0;(s&&s.state!=="active"?o:t).push(r)}return{active:t,notActive:o}}function Kd(e){let n=e.map(o=>ao(o.activity)),t=n[0];return t&&n.every(o=>o?.state===t.state&&o.gate===t.gate)?t:void 0}function fo(e,n,t,o,r){if(n===null)return null;let s=e.safeParse(n);return s.success?s.data:(r.push(`${o}: ${t} "${n}" is not one of ${Object.values(e.enum).join(", ")} \u2014 dropped`),null)}var uo=12,js=3,Ts=3;function Fs(e,n){return Object.keys(e).find(t=>e[t].has(n))}function pa(e,n,t=uo,o={},r=[]){let s=[],l=new Set(r),i=e;if(tn(o)){let f=e.filter(d=>d.category==="better_as_code");if(f.length>js){let d=f.sort((_,g)=>so(_.severity)-so(g.severity)).slice(0,js),S=0;i=e.flatMap(_=>_.category!=="better_as_code"?[_]:S<d.length?[d[S++]]:[])}}let a=i.slice(0,t),c=new Set(a.map(wt));for(let f of r){let d=wt(f);c.has(d)||(a.push(f),c.add(d))}i.length>t&&!(tn(o)&&t>uo)&&s.push(`the model proposed ${i.length} ${mo(i.length,"finding")}; keeping the first ${t}`);let p=f=>{let d=(f.otherSites??[]).flatMap(E=>{let R=nn.safeParse(E);return R.success?[R.data]:(s.push(`finding "${f.title}" listed an other site in a shape we could not read \u2014 dropped`),[])}),S=l.has(f)?d.length:Ts;d.length>S&&s.push(`finding "${f.title}" quoted ${d.length} other sites; keeping the first ${Ts}`);let _=d.slice(0,S).flatMap(E=>{let R=Fs(n,E.path);return R?[{...E,repo:R}]:(s.push(`finding "${f.title}" also cited ${E.path}, which the analysis never read \u2014 that site dropped`),[])});if(!f.site)return{...f,siteRepo:null,otherSites:_};let g=Fs(n,f.site.path);return g?{...f,siteRepo:g,otherSites:_}:(s.push(`finding "${f.title}" cited ${f.site.path}, which the analysis never read \u2014 site dropped`),{...f,site:null,excerpt:f.excerpt,siteRepo:null,otherSites:_})};return{findings:a.map(f=>{let{audience:d,activity:S,..._}=p(f),g=Ls(d,o),E=co(S,o),R=$s(_);return s.push(...R.warnings),{..._,...g===void 0?{}:{audience:g},...E===void 0?{}:{activity:E},summary:Rs(_.summary),fixes:R.fixes,question:R.question}}),warnings:s}}function ma(e){let n=e.title.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,""),t=[...new Set(e.targetFiles.map(o=>o.path.trim().replace(/^(\.\/)+/,"")))].sort().join(`
33
+ `);return[e.kind,n,t].join("|")}function da(e,n,t){if(!e)return{delta:null,warnings:[]};let o=[],r=[];for(let i of e.nodes){let a=fo(Qt,i.change,`delta node ${i.id} change`,t,o);if(a){if(a!=="added"&&!n.has(i.id)){o.push(`${t}: dropped delta node ${i.id} (not in the architecture)`);continue}r.push({id:i.id,change:a,label:i.label})}}let s=new Set([...n,...r.map(i=>i.id)]),l=[];for(let i of e.edges){let a=`${i.from} \u2192 ${i.to}`,c=fo(Qt,i.change,`delta edge ${a} change`,t,o),p=fo(So,i.kind,`delta edge ${a} kind`,t,o);if(!(!c||!p)){if(!s.has(i.from)||!s.has(i.to)){o.push(`${t}: dropped delta edge ${a} (unknown node)`);continue}l.push({from:i.from,to:i.to,kind:p,change:c,detail:i.detail})}}return r.length===0&&l.length===0?{delta:null,warnings:o}:{delta:{nodes:r,edges:l},warnings:o}}function ha(e){return wt(e)}function ga(e){let n=e.split(`
34
+ `);return n.length>1&&n[n.length-1]===""&&n.pop(),n.map((t,o)=>`${o+1} ${t}`).join(`
35
+ `)}export{Sa as a,ya as b,Ye as c,Ws as d,ze as e,Oo as f,Io as g,ce as h,H as i,To as j,Rt as k,Re as l,Pt as m,ve as n,fn as o,Ko as p,Qs as q,un as r,Vo as s,de as t,ni as u,ri as v,si as w,Ga as x,tf as y,G as z,ot as A,Ln as B,Ii as C,Ae as D,Ze as E,He as F,nf as G,Lt as H,yn as I,of as J,Le as K,Bi as L,Ui as M,Ct as N,bn as O,rf as P,sf as Q,lf as R,af as S,cf as T,Xo as U,At as V,ai as W,Xa as X,hn as Y,Ja as Z,ur as _,Y as $,fe as aa,$r as ba,Lr as ca,Yu as da,Xn as ea,Vr as fa,mt as ga,_p as ha,Jr as ia,Ep as ja,Rp as ka,Zr as la,Ut as ma,Kp as na,Up as oa,cs as pa,fs as qa,Xt as ra,Dm as sa,Bm as ta,Wm as ua,xs as va,Qm as wa,ys as xa,an as ya,ba as za,_a as Aa,Jt as Ba,Ql as Ca,ea as Da,ta as Ea,ia as Fa,Cd as Ga,Ms as Ha,Td as Ia,Wd as Ja,ua as Ka,Kd as La,uo as Ma,pa as Na,ma as Oa,da as Pa,ha as Qa,ga as Ra,qt as Sa,sd as Ta,ks as Ua,ws as Va,no as Wa,oo as Xa,dd as Ya,_s as Za,Yl as _a,ro as $a,hd as ab,gd as bb,xd as cb,Yo as db,gn as eb,ec as fb,xn as gb,Qe as hb,sc as ib,ic as jb,kn as kb,hc as lb,ui as mb,pi as nb,zc as ob,_n as pb,rr as qb,sr as rb,Si as sb,yi as tb,ir as ub,lr as vb,ar as wb,tr as xb,tt as yb,ki as zb,nt as Ab,et as Bb,wi as Cb,cr as Db,Ot as Eb,Oe as Fb,Vc as Gb,Pi as Hb,Li as Ib,Oi as Jb,Mi as Kb,Xc as Lb};
File without changes
@@ -0,0 +1 @@
1
+ import{C as T,K as A,y as F,z as L}from"./6E4K7JTI.js";import{a as S}from"./326F4XNG.js";import{a as _,f as O}from"./SP6XFHNH.js";import{Fb as x}from"./QYYN4YKB.js";import{c as E,d as C,k as R}from"./LOODGUMW.js";import{y as q}from"./EJ2IZUN2.js";import{b as M,k as I}from"./ICJV6KIZ.js";import{a as P}from"./S27VIQMZ.js";import{createHash as G}from"node:crypto";var N=new WeakMap,j={version:"shared-modules-v6",settingsFiles:I.settingsFiles,resolve(i,s){let{paths:l,files:t,settings:f}=s,u=M(i);if(!u)return[];let c=N.get(s);return c||(c=new I({files:new Map([...l].map(d=>[d,t.get(d)??""])),metadata:t},f),N.set(s,c)),q(i,t.get(i)??"",u,{allReexports:!0,completeImports:!0}).map(d=>d.dynamic?{from:i,specifier:d.source,status:"refused",provenance:null,reason:"dynamic"}:c.resolve(i,d.source,d.names))}};var B=i=>i==="too-large"?"over-limit":i==="wrong-type"||i==="empty"?"unsupported":i;function V(i,s){let l=R(i);if(!E(l))return{kind:"refused",reason:"disabled"};let t=O.safeParse(s.request);if(!t.success||t.data.kind!=="file"||t.data.entries)return{kind:"refused",reason:"invalid-selection"};let f=t.data,u=s.resolver??j,c=F(l,{profile:"entry-analysis",listing:[...s.entries],selection:f,limits:s.limits}),{entries:d}=c;return{kind:"pending",checkpoint:{version:1,settings:l,request:f,entries:d,files:{},resolutions:{},unavailable:{},targets:{},attempted:{paths:[],bytes:0},resolverVersion:u.version,...u.identity===void 0?{}:{resolverIdentity:u.identity},...s.proposal?{proposal:structuredClone(s.proposal)}:{},limits:c.limits,inventoryIncomplete:(s.inventoryIncomplete??0)+c.inventoryIncomplete}}}async function Y(i,s){let l=O.safeParse(i.request);if(i.version!==1||!l.success||l.data.kind!=="file"||l.data.entries)return{kind:"refused",reason:"invalid-selection"};let t=structuredClone(i);t.request=l.data;let{settings:f,request:u}=t,c=s.resolver??j;if(c.version!==t.resolverVersion||c.identity!==t.resolverIdentity)return{kind:"refused",reason:"stale-snapshot"};if(!E(f))return{kind:"refused",reason:"disabled"};let d=new Map(t.entries.map(e=>[e.path,e])),k=new Set(d.keys()),v=new Map(Object.entries(t.files)),p=c.settingsFiles?.(k,v,[u.entry,...Object.keys(t.files)],f)??[];if(p.every(e=>Object.hasOwn(t.files,e)||Object.hasOwn(t.unavailable,e))){let e=Object.keys(t.files).filter(n=>!Object.hasOwn(t.resolutions,n)),r={paths:k,files:v,settings:f},o=await S(e,4,async n=>{try{return{path:n,edges:await c.resolve(n,r)}}catch{return{path:n,reason:"unreadable"}}});for(let{path:n,edges:g,reason:b}of o)Object.defineProperty(b?t.unavailable:t.resolutions,n,{value:b??g,enumerable:!0,configurable:!0,writable:!0})}let m=A(f,{...t,settingsFiles:p,targetIdentity:G("sha256").update(JSON.stringify(Object.entries(t.targets).sort(([e],[r])=>e.localeCompare(r)))).digest("hex")});if(m.kind==="refused")return{kind:"refused",reason:m.reason};if(m.kind==="ready")return{kind:"ready",selection:m.selection,files:Object.fromEntries(m.selection.files.map(e=>[e.path,t.files[e.path]]))};for(let[e,r]of Object.entries(m.unavailable??{}))Object.defineProperty(t.unavailable,e,{value:r,enumerable:!0,configurable:!0,writable:!0});let a={...f,CF_RESPECT_GITIGNORE:"1",CF_LOCAL_SYMLINK_GUARD:"1",CF_SECRET_SCAN:"1"},y=(e,r,o)=>{if(!P.safeParse(e).success||r&&r.root!==u.launchRoot)return"out-of-scope";let n=x(a,{path:e,...o===void 0?{}:{text:o}},{purpose:"entry",route:"local-folder",...s.admission,gitIgnored:s.gitIgnored,...r?{localTarget:r}:{}});return n.admitted?null:n.reason==="out-of-scope"&&r?"symlink-escape":B(n.reason)},z=await S(m.pending.filter(e=>!Object.hasOwn(t.files,e)).slice(0,4),4,async e=>{let r=0,o=!1;try{let n=y(e);if(n)return{path:e,reason:n,bytes:r,attempted:o};let g=await s.localTarget(e);if(!g)return{path:e,reason:"unreadable",bytes:r,attempted:o};if(n=y(e,g),n)return{path:e,reason:n,bytes:r,attempted:o};let b=d.get(e);o=!0,r=b.size;let h=await s.read({path:e,size:b.size,ref:b.ref,readBytes:b.size+1});if(h!==null&&(r=Buffer.byteLength(h)),h===null)return{path:e,reason:"unreadable",bytes:r,attempted:o};let w=await s.localTarget(e);return!w||w.path!==g.path||w.root!==g.root?{path:e,reason:"symlink-escape",bytes:r,attempted:o}:(n=y(e,w,h),n?{path:e,reason:n,bytes:r,attempted:o}:r!==b.size?{path:e,reason:"over-limit",bytes:r,attempted:o}:{path:e,text:h,target:w.path,bytes:r,attempted:o})}catch{return{path:e,reason:"unreadable",bytes:r,attempted:o}}});for(let e of z){if(e.attempted){let o=m.pendingSettings.includes(e.path)?t.settingsAttempted??={paths:[],bytes:0}:t.attempted;o.paths.push(e.path),o.bytes+=e.bytes}let r=(o,n)=>Object.defineProperty(o,e.path,{value:n,enumerable:!0,configurable:!0,writable:!0});e.reason?r(t.unavailable,e.reason):e.text!==void 0&&(r(t.files,e.text),r(t.targets,e.target))}return{kind:"pending",checkpoint:t}}async function D(i,s){let l=O.safeParse(s.request);if(l.success&&l.data.kind==="file"&&l.data.entries){if(!C(i))return{kind:"refused",reason:"disabled"};let f=l.data,u=new Map,c=a=>{let y=u.get(a.path);return y||(y=Promise.resolve(s.read(a)),u.set(a.path,y)),y},d=await S(f.entries.slice(0,_.choices),4,async a=>{try{return await D(i,{...s,proposal:void 0,read:c,request:{kind:"file",launchRoot:f.launchRoot,entry:a}})}catch{return{kind:"refused",reason:"invalid-selection"}}}),k=d.find(a=>a.kind==="refused"&&a.reason!=="over-limit");if(k?.kind==="refused")return k;let v=d.filter(a=>a.kind==="ready");if(!v.length)return{kind:"refused",reason:"over-limit"};let p=L(f,v.map(a=>a.selection));if(p.kind!=="ready")return{kind:"refused",reason:p.kind==="refused"?p.reason:"invalid-selection"};let m=Object.fromEntries(v.flatMap(a=>Object.entries(a.files)));return T(s.proposal,p.selection.files)?{kind:"ready",selection:p.selection,files:Object.fromEntries(p.selection.files.map(a=>[a.path,m[a.path]]))}:{kind:"refused",reason:"invalid-scope"}}let t=V(i,s);for(;t.kind==="pending";)t=await Y(t.checkpoint,s);return t}export{V as a,Y as b,D as c};
@@ -1 +1 @@
1
- import{b as a,c as m}from"./NXHVBJL4.js";import{a as u}from"./MJGB25S5.js";import{d}from"./RQTNTIR4.js";import{h as c}from"./LMUXOKIM.js";import{a as l}from"./INVTU73D.js";function k(e,i={},o){let p={data:l(i)&&(e.answerFormat==="check"||e.answerFormat==="opinion")?{...e.inputs,findingActivityEnabled:!0}:e.inputs,settings:c(i),...o===void 0?{}:{maxInputBytes:o}};return d.parse({...e,answerFormat:Object.hasOwn(r,e.template)?g(e.template,e.answerFormat,i):e.answerFormat,limits:{...e.limits,promptCache:u(i,{template:e.template},e.model).enabled},inputs:JSON.parse(JSON.stringify(p))})}var n=(e,...i)=>Object.freeze({role:e,answerFormats:Object.freeze(i)}),s=m().map(e=>e.name),r=Object.freeze({"derive-findings":n("required",...s),"derive-findings-legacy":n("required",...s),"derive-findings-no-outcome":n("required",...s),"derive-findings-legacy-no-outcome":n("required",...s),"benchmark-judge":n("required","judge"),"judge-code-prompt":n("optional","codeJudge"),"derive-structure":n("optional","structures"),"structure-recheck":n("optional","recheck"),"derive-shape":n("optional","shape"),"scope-items":n("optional","structureScope"),"scope-findings":n("optional","scope"),"check-findings":n("optional","check"),"check-findings-precision-v1":n("optional","check"),"second-opinion":n("optional","opinion"),"explain-sources":n("optional","sourceNotes"),"finding-headlines":n("optional","findingHeadlines")});function A(){return r}function S(e,i,o){let t=o??(e==="derive"?"derive-findings":"check-findings");if(!Object.keys(r).filter(f=>r[f].answerFormats.includes(e==="derive"?"findings":"check")).includes(t))throw new Error("Unknown analysis template");return e==="derive"&&!a(i).switches.expectedOutcome&&!t.endsWith("-no-outcome")?`${t}-no-outcome`:t}function g(e,i,o){let t=i==="findings"?a(o).name:i;if(!Object.hasOwn(r,e)||!r[e].answerFormats.includes(t))throw new Error("Unsupported template answer format");return t}function E(e,i,o){if(o(i),!Object.hasOwn(r,e)||r[e].role!=="optional")throw i}export{k as a,A as b,S as c,g as d,E as e};
1
+ import{b as a,c as m}from"./VX6LYNXV.js";import{a as u}from"./P5FCHJ7W.js";import{d}from"./I5F7S63K.js";import{j as c}from"./OXGKALKM.js";import{a as l}from"./INVTU73D.js";function k(e,i={},o){let p={data:l(i)&&(e.answerFormat==="check"||e.answerFormat==="opinion")?{...e.inputs,findingActivityEnabled:!0}:e.inputs,settings:c(i),...o===void 0?{}:{maxInputBytes:o}};return d.parse({...e,answerFormat:Object.hasOwn(r,e.template)?g(e.template,e.answerFormat,i):e.answerFormat,limits:{...e.limits,promptCache:u(i,{template:e.template},e.model).enabled},inputs:JSON.parse(JSON.stringify(p))})}var n=(e,...i)=>Object.freeze({role:e,answerFormats:Object.freeze(i)}),s=m().map(e=>e.name),r=Object.freeze({"derive-findings":n("required",...s),"derive-findings-legacy":n("required",...s),"derive-findings-no-outcome":n("required",...s),"derive-findings-legacy-no-outcome":n("required",...s),"benchmark-judge":n("required","judge"),"judge-code-prompt":n("optional","codeJudge"),"derive-structure":n("optional","structures"),"structure-recheck":n("optional","recheck"),"derive-shape":n("optional","shape"),"scope-items":n("optional","structureScope"),"scope-findings":n("optional","scope"),"check-findings":n("optional","check"),"check-findings-precision-v1":n("optional","check"),"second-opinion":n("optional","opinion"),"explain-sources":n("optional","sourceNotes"),"finding-headlines":n("optional","findingHeadlines")});function A(){return r}function S(e,i,o){let t=o??(e==="derive"?"derive-findings":"check-findings");if(!Object.keys(r).filter(f=>r[f].answerFormats.includes(e==="derive"?"findings":"check")).includes(t))throw new Error("Unknown analysis template");return e==="derive"&&!a(i).switches.expectedOutcome&&!t.endsWith("-no-outcome")?`${t}-no-outcome`:t}function g(e,i,o){let t=i==="findings"?a(o).name:i;if(!Object.hasOwn(r,e)||!r[e].answerFormats.includes(t))throw new Error("Unsupported template answer format");return t}function E(e,i,o){if(o(i),!Object.hasOwn(r,e)||r[e].role!=="optional")throw i}export{k as a,A as b,S as c,g as d,E as e};
@@ -1 +1 @@
1
- import{pa as t,ra as o,va as a,xa as p}from"./W24SFYZM.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};
1
+ import{pa as t,ra as o,va as a,xa as p}from"./HH3HDT5K.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 u,f as a,h as g,j as h}from"./JAPVLU4Z.js";import{a as f}from"./I4F56VMG.js";import{b as o}from"./33EUZF25.js";import{a as l}from"./INVTU73D.js";import{a as x}from"./A7WJJMRY.js";import{a as m,b as p}from"./VDUFPTDD.js";import{z as r}from"zod";import{z as e}from"zod";var _=["Says","But also says","Unclear","Context","Requirement","What actually happens","Why it's a gap","Evidence"],b=e.object({sites:e.array(e.object({index:e.number().int().nonnegative(),role:e.enum(_),meaning:e.string(),keyPhrase:e.string()})),support:e.enum(["supported","partly","not_supported"]),supportNote:e.string(),counterEvidence:e.array(e.object({repo:e.string(),path:e.string(),line:e.number().int().positive(),excerpt:e.string(),meaning:e.string()}))});var E={expectedOutcome:{setting:"CF_FIX_EXPECTED_OUTCOME",enabled:t=>t.CF_FIX_EXPECTED_OUTCOME!=="0",suffix:"-no-outcome",suffixWhen:!1},untrustedContent:{setting:"CF_UNTRUSTED_CONTENT_CHECK",enabled:m,suffix:"-no-untrusted",suffixWhen:!1},betterAsCode:{setting:"CF_FINDING_BETTER_AS_CODE",enabled:p,suffix:"-better-as-code",suffixWhen:!0},audience:{setting:"CF_FINDING_AUDIENCE",enabled:x,suffix:"-audience",suffixWhen:!0},activity:{setting:"CF_NOT_ACTIVE_GROUP",enabled:l,suffix:"-activity",suffixWhen:!0}};function C(t){let n=Object.entries(E).map(([i,s])=>({key:i,rule:s,enabled:s.enabled(t)}));return{name:`findings${n.map(({rule:i,enabled:s})=>s===i.suffixWhen?i.suffix:"").join("")}`,switches:Object.fromEntries(n.map(({key:i,enabled:s})=>[i,s])),settings:Object.fromEntries(n.map(({rule:i,enabled:s})=>[i.setting,s?"1":"0"]))}}function H(){let t=[{}];for(let{setting:n}of Object.values(E))t=t.flatMap(i=>["0","1"].map(s=>({...i,[n]:s})));return t.map(n=>({...C(n),schema:N(n)}))}function F(t){return r.object({findings:r.array(t.shape.findings.element.extend({fixes:r.array(a.omit({expectedOutcome:!0})).min(1)}))})}var O=r.string(),S=O.catch(void 0),v=a.extend({expectedOutcome:r.string().default("")}),A=r.array(g.extend({audience:o.optional().catch(void 0),activity:f.optional().catch(void 0),fixes:r.array(v).min(1),sourceNotes:b.nullable().optional().catch(null)}));function N(t){let n=C(t),i=h(n.settings),c=(n.switches.expectedOutcome?i:F(i)).shape.findings.element,y=o.describe(u("finding-audience")),d=n.switches.audience?c.extend({audience:y.catch(void 0)}):c;return r.object({findings:r.array(n.switches.activity?d.extend({activity:S}):d)})}function V(t){return T(t.findings)}function T(t){return A.parse(t)}export{b as a,C as b,H as c,N as d,V as e,T as f};
@@ -1 +1 @@
1
- import{b as p}from"./3GUKUEEJ.js";var i=.1,c=Object.freeze({"5m":1.25,"1h":2}),n=Object.freeze(Object.fromEntries([...Object.entries({"claude-opus-5-5":{input:4,output:20},"claude-opus-4-8":{input:5,output:25},"claude-sonnet-5":{input:2,output:10},"claude-haiku-4-5":{input:1,output:5}}).map(([t,e])=>[t,Object.freeze({...e,cachedInput:e.input*(t==="claude-opus-5-5"?.05:i),provider:"anthropic"})]),["gpt-6-luna",Object.freeze({input:.1,output:.5,cachedInput:.01,provider:"openai"})]])),s=(()=>{let t=Object.entries(n);if(t.length===0)throw new Error("PRICE_PER_MTOK is empty");return t.reduce((e,o)=>o[1].input+o[1].output>e[1].input+e[1].output?o:e)[0]})();function h(t,e="5m"){return n[t]?.provider==="openai"?1:c[e]}function E(t){return Math.ceil(t/4)}function a(t,e,o,r=1){let u=Object.hasOwn(n,t)?n[t]:n[s];return(e*u.input*r+o*u.output)/1e6}function _(t,e,o,r,u=1){return{label:t,model:e,inputTokens:o,outputTokens:r,usd:a(e,o,r,u)}}function O(t,e){return{lines:t,totalUsd:t.reduce((o,r)=>o+r.usd,0),capUsd:e}}function l(t){return t.totalUsd>t.capUsd}function x(t){return t>0&&t<.01?`$${t.toFixed(3)}`:`$${t.toFixed(2)}`}var d="This analysis is too large to run at once. Choose fewer repositories or a smaller folder.",C="The split check was skipped because it would make this analysis too large. The rest of the analysis continues.";function A(t,e){if(l(t))throw e?.({level:"warn",code:"analysis.over_cap",counts:{totalUsd:t.totalUsd,capUsd:t.capUsd}}),new p("over_cap",d)}export{i as a,c as b,n as c,s as d,h as e,E as f,a as g,_ as h,O as i,l as j,x as k,d as l,C as m,A as n};
1
+ import{b as p}from"./5JG3ZRNJ.js";var i=.1,c=Object.freeze({"5m":1.25,"1h":2}),n=Object.freeze(Object.fromEntries([...Object.entries({"claude-opus-5-5":{input:4,output:20},"claude-opus-4-8":{input:5,output:25},"claude-sonnet-5":{input:2,output:10},"claude-haiku-4-5":{input:1,output:5}}).map(([t,e])=>[t,Object.freeze({...e,cachedInput:e.input*(t==="claude-opus-5-5"?.05:i),provider:"anthropic"})]),["gpt-6-luna",Object.freeze({input:.1,output:.5,cachedInput:.01,provider:"openai"})]])),s=(()=>{let t=Object.entries(n);if(t.length===0)throw new Error("PRICE_PER_MTOK is empty");return t.reduce((e,o)=>o[1].input+o[1].output>e[1].input+e[1].output?o:e)[0]})();function h(t,e="5m"){return n[t]?.provider==="openai"?1:c[e]}function E(t){return Math.ceil(t/4)}function a(t,e,o,r=1){let u=Object.hasOwn(n,t)?n[t]:n[s];return(e*u.input*r+o*u.output)/1e6}function _(t,e,o,r,u=1){return{label:t,model:e,inputTokens:o,outputTokens:r,usd:a(e,o,r,u)}}function O(t,e){return{lines:t,totalUsd:t.reduce((o,r)=>o+r.usd,0),capUsd:e}}function l(t){return t.totalUsd>t.capUsd}function x(t){return t>0&&t<.01?`$${t.toFixed(3)}`:`$${t.toFixed(2)}`}var d="This analysis is too large to run at once. Choose fewer repositories or a smaller folder.",C="The split check was skipped because it would make this analysis too large. The rest of the analysis continues.";function A(t,e){if(l(t))throw e?.({level:"warn",code:"analysis.over_cap",counts:{totalUsd:t.totalUsd,capUsd:t.capUsd}}),new p("over_cap",d)}export{i as a,c as b,n as c,s as d,h as e,E as f,a as g,_ as h,O as i,l as j,x as k,d as l,C as m,A as n};
@@ -0,0 +1 @@
1
+ var r=class extends Error{name="RelayFrameSizeError";reason="relay_frame_too_large";code=this.reason;constructor(){super("Relay request exceeds the frame budget")}},o=class extends Error{name="StructuredOutputError";reason="model_answer_invalid";code=this.reason;constructor(n="Invalid model answer"){super(n)}},s=class extends Error{name="RelayProtocolError";reason="relay_protocol_invalid";code=this.reason;constructor(){super("Invalid relay response")}};function a(e){return e instanceof r||e instanceof o||e instanceof s}export{r as a,o as b,s as c,a as d};
@@ -1 +1 @@
1
- import{a,b,c,d}from"../chunks/RQTNTIR4.js";import"../chunks/LMUXOKIM.js";import"../chunks/LFYTD7JF.js";import"../chunks/MGVIKA74.js";export{a as executionInputs,d as executionRequest,b as modelName,c as requestLimits};
1
+ import{a,b,c,d}from"../chunks/I5F7S63K.js";import"../chunks/OXGKALKM.js";import"../chunks/CNQZLSAP.js";import"../chunks/I4F56VMG.js";import"../chunks/33EUZF25.js";export{a as executionInputs,d as executionRequest,b as modelName,c as requestLimits};
@@ -1 +1 @@
1
- import{h as a,i as b,j as c,k as d,l as e,m as f,n as g,o as h,p as i,q as j,r as k,s as l}from"../chunks/MGVIKA74.js";export{g as RESULT_CHECK_FREE_TEXT_BYTES,f as RESULT_CHECK_LIMITS,a as findingKind,b as findingSeverity,d as fixDelta,j as intakeFinding,i as nonblankText,e as publicFinding,k as resultCheckFinding,l as resultCheckFindings,h as validIntakeText,c as wording};
1
+ import{a,b,c,d,e,f,g,h,i,j,k,l}from"../chunks/CNQZLSAP.js";import"../chunks/I4F56VMG.js";import"../chunks/33EUZF25.js";export{g as RESULT_CHECK_FREE_TEXT_BYTES,f as RESULT_CHECK_LIMITS,a as findingKind,b as findingSeverity,d as fixDelta,j as intakeFinding,i as nonblankText,e as publicFinding,k as resultCheckFinding,l as resultCheckFindings,h as validIntakeText,c as wording};
@@ -0,0 +1 @@
1
+ import{a,b,c,d}from"../chunks/ZLUI3EHB.js";export{a as RelayFrameSizeError,c as RelayProtocolError,b as StructuredOutputError,d as isPublicModelError};
@@ -1 +1 @@
1
- import{A as I,B as J,a as i,b as j,c as k,d as l,e as m,f as n,g as o,h as p,i as q,j as r,k as s,l as t,m as u,n as v,o as w,p as x,q as y,r as z,s as A,t as B,u as C,v as D,w as E,x as F,y as G,z as H}from"../chunks/LMUXOKIM.js";import{e as g,h}from"../chunks/LFYTD7JF.js";import{l as a,m as b,n as c,o as d,r as e,s as f}from"../chunks/MGVIKA74.js";export{v as ANALYSIS_DATA_FRAME_BYTES,l as ANALYSIS_PROTOCOL,o as ANALYSIS_SETTING_NAMES,n as DECLARED_ANALYSIS_PROTOCOL,c as RESULT_CHECK_FREE_TEXT_BYTES,b as RESULT_CHECK_LIMITS,C as analysisAdvance,G as analysisCallFailure,t as analysisCallFailureCode,z as analysisCancel,m as analysisCapabilities,u as analysisFailure,s as analysisFailureCode,w as analysisFile,D as analysisFinalResult,x as analysisManifest,A as analysisNeedFiles,B as analysisNeedListing,E as analysisResult,F as analysisResultChunk,r as analysisSettings,y as analysisStart,p as filterAnalysisSettings,i as projectPublicFinding,j as projectPublicReport,a as publicFinding,h as publicReportSchema,g as publicStructure,H as relayAnalysisSchemas,J as relayAnalysisV2Schemas,q as requestAnalysisSettings,e as resultCheckFinding,f as resultCheckFindings,I as resultLimitsSchema,k as unredactedAnswer,d as validIntakeText};
1
+ import{A as G,B as H,C as I,D as J,a as g,b as h,c as i,d as j,e as k,f as l,g as m,h as n,i as o,j as p,k as q,l as r,m as s,n as t,o as u,p as v,q as w,r as x,s as y,t as z,u as A,v as B,w as C,x as D,y as E,z as F}from"../chunks/OXGKALKM.js";import{e as a,f as b,g as c,h as d,k as e,l as f}from"../chunks/CNQZLSAP.js";import"../chunks/I4F56VMG.js";import"../chunks/33EUZF25.js";export{v as ANALYSIS_DATA_FRAME_BYTES,l as ANALYSIS_PROTOCOL,o as ANALYSIS_SETTING_NAMES,n as DECLARED_ANALYSIS_PROTOCOL,c as RESULT_CHECK_FREE_TEXT_BYTES,b as RESULT_CHECK_LIMITS,C as analysisAdvance,G as analysisCallFailure,t as analysisCallFailureCode,z as analysisCancel,m as analysisCapabilities,u as analysisFailure,s as analysisFailureCode,w as analysisFile,D as analysisFinalResult,x as analysisManifest,A as analysisNeedFiles,B as analysisNeedListing,E as analysisResult,F as analysisResultChunk,r as analysisSettings,y as analysisStart,p as filterAnalysisSettings,i as projectPublicFinding,j as projectPublicReport,a as publicFinding,h as publicReportSchema,g as publicStructure,H as relayAnalysisSchemas,J as relayAnalysisV2Schemas,q as requestAnalysisSettings,e as resultCheckFinding,f as resultCheckFindings,I as resultLimitsSchema,k as unredactedAnswer,d as validIntakeText};
@@ -1 +1 @@
1
- import{a as g,b as h,c as i,d as j,e as k}from"../chunks/JEWBPIQI.js";import"../chunks/NXHVBJL4.js";import"../chunks/MJGB25S5.js";import{a as c,b as d,c as e,d as f}from"../chunks/RQTNTIR4.js";import{g as a,h as b}from"../chunks/LMUXOKIM.js";import"../chunks/QVXARKP7.js";import"../chunks/OKBK3JL3.js";import"../chunks/JKWTHRUR.js";import"../chunks/3GUKUEEJ.js";import"../chunks/LFYTD7JF.js";import"../chunks/MGVIKA74.js";import"../chunks/INVTU73D.js";import"../chunks/A7WJJMRY.js";import"../chunks/VDUFPTDD.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};
1
+ import{a as g,b as h,c as i,d as j,e as k}from"../chunks/VBGQKYIT.js";import"../chunks/VX6LYNXV.js";import"../chunks/P5FCHJ7W.js";import{a as c,b as d,c as e,d as f}from"../chunks/I5F7S63K.js";import"../chunks/QVXARKP7.js";import"../chunks/YDSB7UOR.js";import"../chunks/5JG3ZRNJ.js";import"../chunks/ZLUI3EHB.js";import"../chunks/JAPVLU4Z.js";import{i as a,j as b}from"../chunks/OXGKALKM.js";import"../chunks/CNQZLSAP.js";import"../chunks/I4F56VMG.js";import"../chunks/33EUZF25.js";import"../chunks/INVTU73D.js";import"../chunks/A7WJJMRY.js";import"../chunks/VDUFPTDD.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};
@@ -1 +1 @@
1
- import{a as b,b as c,c as d,d as e}from"../chunks/JGK37AWN.js";import{a}from"../chunks/PBHHWFR6.js";import"../chunks/4PT5C4IT.js";import"../chunks/2AASSZRO.js";import"../chunks/74FPPPIG.js";import"../chunks/MKYLK6DB.js";import"../chunks/5TATKWLG.js";import"../chunks/OKBK3JL3.js";import"../chunks/JKWTHRUR.js";import"../chunks/3GUKUEEJ.js";import"../chunks/LFYTD7JF.js";import"../chunks/MGVIKA74.js";import"../chunks/YUY436SM.js";import"../chunks/C6X5GDG4.js";import"../chunks/724WZMYW.js";import"../chunks/YWL52FVW.js";import"../chunks/SJESFYBA.js";import"../chunks/RUVMFAST.js";import"../chunks/S27VIQMZ.js";import"../chunks/INVTU73D.js";import"../chunks/A7WJJMRY.js";import"../chunks/Q5WR6B2H.js";import"../chunks/VDUFPTDD.js";export{b as analysisSizeLimits,c as assessAnalysisSize,d as measureAnalysisSize,e as measureAnalysisSizeLowerBound,a as parseAnalysisSize};
1
+ import{a as b,b as c,c as d,d as e}from"../chunks/JWQXG5RB.js";import{a}from"../chunks/PBHHWFR6.js";import"../chunks/AIS3FHQR.js";import"../chunks/QYYN4YKB.js";import"../chunks/74FPPPIG.js";import"../chunks/LOODGUMW.js";import"../chunks/MKYLK6DB.js";import"../chunks/5TATKWLG.js";import"../chunks/YDSB7UOR.js";import"../chunks/5JG3ZRNJ.js";import"../chunks/ZLUI3EHB.js";import"../chunks/JAPVLU4Z.js";import"../chunks/OXGKALKM.js";import"../chunks/CNQZLSAP.js";import"../chunks/I4F56VMG.js";import"../chunks/33EUZF25.js";import"../chunks/YUY436SM.js";import"../chunks/C6X5GDG4.js";import"../chunks/724WZMYW.js";import"../chunks/JS6HTVYX.js";import"../chunks/EJ2IZUN2.js";import"../chunks/ICJV6KIZ.js";import"../chunks/RUVMFAST.js";import"../chunks/S27VIQMZ.js";import"../chunks/INVTU73D.js";import"../chunks/A7WJJMRY.js";import"../chunks/Q5WR6B2H.js";import"../chunks/VDUFPTDD.js";export{b as analysisSizeLimits,c as assessAnalysisSize,d as measureAnalysisSize,e as measureAnalysisSizeLowerBound,a as parseAnalysisSize};
@@ -1 +1 @@
1
- import{Ab as t,Bb as u,Cb as v,Db as w,Eb as x,Fb as y,Gb as z,Hb as A,Ib as B,Jb as C,Kb as D,Lb as E,ob as h,pb as i,qb as j,rb as k,sb as l,tb as m,ub as n,vb as o,wb as p,xb as q,yb as r,zb as s}from"../chunks/2AASSZRO.js";import"../chunks/74FPPPIG.js";import"../chunks/MKYLK6DB.js";import"../chunks/5TATKWLG.js";import"../chunks/OKBK3JL3.js";import"../chunks/JKWTHRUR.js";import"../chunks/3GUKUEEJ.js";import"../chunks/LFYTD7JF.js";import"../chunks/MGVIKA74.js";import{a,b,c,d,e,f,h as g}from"../chunks/YUY436SM.js";import"../chunks/C6X5GDG4.js";import"../chunks/724WZMYW.js";import"../chunks/YWL52FVW.js";import"../chunks/SJESFYBA.js";import"../chunks/RUVMFAST.js";import"../chunks/S27VIQMZ.js";import"../chunks/INVTU73D.js";import"../chunks/A7WJJMRY.js";import"../chunks/Q5WR6B2H.js";import"../chunks/VDUFPTDD.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,A as SOURCE_CUT_MARKER,u as SOURCE_EXCLUDE_RE,t as SOURCE_NON_LOCK_EXCLUDE_RE,y as admitFile,D as admittedFileAccess,E 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,C as readAdmittedSource,B as readRepoFile,g as resolveLocalExclusions,a as respectGitignore,e as secretFileWarning,z as sourceAdmissionIsInventoryIndependent};
1
+ import{Ab as t,Bb as u,Cb as v,Db as w,Eb as x,Fb as y,Gb as z,Hb as A,Ib as B,Jb as C,Kb as D,Lb as E,ob as h,pb as i,qb as j,rb as k,sb as l,tb as m,ub as n,vb as o,wb as p,xb as q,yb as r,zb as s}from"../chunks/QYYN4YKB.js";import"../chunks/74FPPPIG.js";import"../chunks/LOODGUMW.js";import"../chunks/MKYLK6DB.js";import"../chunks/5TATKWLG.js";import"../chunks/YDSB7UOR.js";import"../chunks/5JG3ZRNJ.js";import"../chunks/ZLUI3EHB.js";import"../chunks/JAPVLU4Z.js";import"../chunks/OXGKALKM.js";import"../chunks/CNQZLSAP.js";import"../chunks/I4F56VMG.js";import"../chunks/33EUZF25.js";import{a,b,c,d,e,f,h as g}from"../chunks/YUY436SM.js";import"../chunks/C6X5GDG4.js";import"../chunks/724WZMYW.js";import"../chunks/JS6HTVYX.js";import"../chunks/EJ2IZUN2.js";import"../chunks/ICJV6KIZ.js";import"../chunks/RUVMFAST.js";import"../chunks/S27VIQMZ.js";import"../chunks/INVTU73D.js";import"../chunks/A7WJJMRY.js";import"../chunks/Q5WR6B2H.js";import"../chunks/VDUFPTDD.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,A as SOURCE_CUT_MARKER,u as SOURCE_EXCLUDE_RE,t as SOURCE_NON_LOCK_EXCLUDE_RE,y as admitFile,D as admittedFileAccess,E 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,C as readAdmittedSource,B as readRepoFile,g as resolveLocalExclusions,a as respectGitignore,e as secretFileWarning,z as sourceAdmissionIsInventoryIndependent};
@@ -1 +1 @@
1
- import{a,b,c}from"./chunks/3GUKUEEJ.js";export{a as FOLDER_TOO_LARGE_MESSAGE,b as JobError,c as throwIfOrgSpendReached};
1
+ import{a as b,b as c,c as d}from"./chunks/5JG3ZRNJ.js";import{a}from"./chunks/ZLUI3EHB.js";export{b as FOLDER_TOO_LARGE_MESSAGE,c as JobError,a as RelayFrameSizeError,d as throwIfOrgSpendReached};
@@ -1 +1 @@
1
- import{c as a,d as b,e as c,f as d,g as e,h as f,i as g,j as h}from"../../chunks/SJESFYBA.js";import"../../chunks/RUVMFAST.js";import"../../chunks/S27VIQMZ.js";export{h as ModuleResolver,a as moduleResolutionLimits,b as pathMatchesSource,c as relativeImportCandidates,d as relativeImportPath,e as relativeImportPaths,f as repositoryImportPaths,g as resolveImport};
1
+ import{d as a,e as b,f as c,g as d,h as e,i as f,j as g,k as h}from"../../chunks/ICJV6KIZ.js";import"../../chunks/RUVMFAST.js";import"../../chunks/S27VIQMZ.js";export{h as ModuleResolver,a as moduleResolutionLimits,b as pathMatchesSource,c as relativeImportCandidates,d as relativeImportPath,e as relativeImportPaths,f as repositoryImportPaths,g as resolveImport};
@@ -1 +1 @@
1
- import{a as c,b as d,c as e}from"../chunks/CQQ4TTXE.js";import{A as a,B as b}from"../chunks/FRXOQ2M6.js";import"../chunks/326F4XNG.js";import"../chunks/SP6XFHNH.js";import"../chunks/HCPO6QPU.js";import"../chunks/YTHF2E2S.js";import"../chunks/4PT5C4IT.js";import"../chunks/LMUXOKIM.js";import"../chunks/2AASSZRO.js";import"../chunks/74FPPPIG.js";import"../chunks/MKYLK6DB.js";import"../chunks/5TATKWLG.js";import"../chunks/OKBK3JL3.js";import"../chunks/JKWTHRUR.js";import"../chunks/3GUKUEEJ.js";import"../chunks/LFYTD7JF.js";import"../chunks/MGVIKA74.js";import"../chunks/YUY436SM.js";import"../chunks/C6X5GDG4.js";import"../chunks/724WZMYW.js";import"../chunks/YWL52FVW.js";import"../chunks/SJESFYBA.js";import"../chunks/RUVMFAST.js";import"../chunks/S27VIQMZ.js";import"../chunks/INVTU73D.js";import"../chunks/A7WJJMRY.js";import"../chunks/Q5WR6B2H.js";import"../chunks/VDUFPTDD.js";export{d as advanceEntrySelection,c as createEntrySelectionCheckpoint,a as entryGroupChoice,b as findEntryScopeChoice,e as readEntrySelection};
1
+ import{a as c,b as d,c as e}from"../chunks/V7GZHSVR.js";import{A as a,B as b}from"../chunks/6E4K7JTI.js";import"../chunks/326F4XNG.js";import"../chunks/SP6XFHNH.js";import"../chunks/PISOGSJF.js";import"../chunks/AIS3FHQR.js";import"../chunks/QYYN4YKB.js";import"../chunks/74FPPPIG.js";import"../chunks/LOODGUMW.js";import"../chunks/MKYLK6DB.js";import"../chunks/5TATKWLG.js";import"../chunks/YDSB7UOR.js";import"../chunks/5JG3ZRNJ.js";import"../chunks/ZLUI3EHB.js";import"../chunks/JAPVLU4Z.js";import"../chunks/OXGKALKM.js";import"../chunks/CNQZLSAP.js";import"../chunks/I4F56VMG.js";import"../chunks/33EUZF25.js";import"../chunks/YUY436SM.js";import"../chunks/C6X5GDG4.js";import"../chunks/724WZMYW.js";import"../chunks/JS6HTVYX.js";import"../chunks/EJ2IZUN2.js";import"../chunks/ICJV6KIZ.js";import"../chunks/RUVMFAST.js";import"../chunks/S27VIQMZ.js";import"../chunks/INVTU73D.js";import"../chunks/A7WJJMRY.js";import"../chunks/Q5WR6B2H.js";import"../chunks/VDUFPTDD.js";export{d as advanceEntrySelection,c as createEntrySelectionCheckpoint,a as entryGroupChoice,b as findEntryScopeChoice,e as readEntrySelection};
@@ -1 +1 @@
1
- import{a as c}from"../chunks/HVQJKPQ4.js";import"../chunks/CTLHKFPH.js";import"../chunks/FRXOQ2M6.js";import"../chunks/326F4XNG.js";import"../chunks/SP6XFHNH.js";import"../chunks/HCPO6QPU.js";import"../chunks/33IGHOYT.js";import"../chunks/YTHF2E2S.js";import"../chunks/4PT5C4IT.js";import"../chunks/LMUXOKIM.js";import"../chunks/2AASSZRO.js";import"../chunks/74FPPPIG.js";import{a}from"../chunks/MKYLK6DB.js";import"../chunks/5TATKWLG.js";import"../chunks/OKBK3JL3.js";import"../chunks/JKWTHRUR.js";import"../chunks/3GUKUEEJ.js";import"../chunks/LFYTD7JF.js";import"../chunks/MGVIKA74.js";import"../chunks/YUY436SM.js";import{e as b}from"../chunks/C6X5GDG4.js";import"../chunks/724WZMYW.js";import"../chunks/YWL52FVW.js";import"../chunks/SJESFYBA.js";import"../chunks/RUVMFAST.js";import"../chunks/S27VIQMZ.js";import"../chunks/INVTU73D.js";import"../chunks/A7WJJMRY.js";import"../chunks/Q5WR6B2H.js";import"../chunks/VDUFPTDD.js";export{a as READ_LIMITS,c as readOutsideLoaderSources,b as repoPathFrom};
1
+ import{a as c}from"../chunks/NWYNJHY4.js";import"../chunks/QENYFKG3.js";import"../chunks/6E4K7JTI.js";import"../chunks/326F4XNG.js";import"../chunks/SP6XFHNH.js";import"../chunks/PISOGSJF.js";import"../chunks/JCVB6IC4.js";import"../chunks/AIS3FHQR.js";import"../chunks/QYYN4YKB.js";import"../chunks/74FPPPIG.js";import"../chunks/LOODGUMW.js";import{a}from"../chunks/MKYLK6DB.js";import"../chunks/5TATKWLG.js";import"../chunks/YDSB7UOR.js";import"../chunks/5JG3ZRNJ.js";import"../chunks/ZLUI3EHB.js";import"../chunks/JAPVLU4Z.js";import"../chunks/OXGKALKM.js";import"../chunks/CNQZLSAP.js";import"../chunks/I4F56VMG.js";import"../chunks/33EUZF25.js";import"../chunks/YUY436SM.js";import{e as b}from"../chunks/C6X5GDG4.js";import"../chunks/724WZMYW.js";import"../chunks/JS6HTVYX.js";import"../chunks/EJ2IZUN2.js";import"../chunks/ICJV6KIZ.js";import"../chunks/RUVMFAST.js";import"../chunks/S27VIQMZ.js";import"../chunks/INVTU73D.js";import"../chunks/A7WJJMRY.js";import"../chunks/Q5WR6B2H.js";import"../chunks/VDUFPTDD.js";export{a as READ_LIMITS,c as readOutsideLoaderSources,b as repoPathFrom};