codebaseiq 0.3.0 → 0.3.1

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 (176) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/dist/{chunk-BFBIMTCJ.js → chunk-2XBJRZEM.js} +2 -2
  3. package/dist/{chunk-GDHWOA57.js → chunk-2Z7K66D7.js} +2 -2
  4. package/dist/{chunk-HVFB3PME.js → chunk-3H2H5ODK.js} +2 -2
  5. package/dist/{chunk-LZSQ6X7E.js → chunk-3LQJRS4I.js} +2 -2
  6. package/dist/{chunk-GIDCP7KV.js → chunk-3ON3A2QV.js} +2 -2
  7. package/dist/{chunk-TPO7XC5Z.js → chunk-4GWN76B2.js} +2 -2
  8. package/dist/{chunk-GL6UTNUB.js → chunk-53ELMZRF.js} +2 -2
  9. package/dist/{chunk-6VREELBC.js → chunk-57OPIQFM.js} +2 -2
  10. package/dist/{chunk-JSNTHRLQ.js → chunk-5CR4U5X2.js} +2 -2
  11. package/dist/{chunk-GUFPEFBG.js → chunk-5MPBSFZH.js} +2 -2
  12. package/dist/{chunk-K7JLSGCJ.js → chunk-5TZNHP4T.js} +3 -3
  13. package/dist/{chunk-DVWO7RBC.js → chunk-5YBDBY5L.js} +2 -2
  14. package/dist/{chunk-T5X7DK6C.js → chunk-6EYESTJM.js} +2 -2
  15. package/dist/{chunk-AQI4N64O.js → chunk-6FXXYYQM.js} +2 -2
  16. package/dist/{chunk-VWYGCMV5.js → chunk-AGGR2BKS.js} +2 -2
  17. package/dist/{chunk-FEIZXBLH.js → chunk-ALOEHWJS.js} +2 -2
  18. package/dist/{chunk-D53LWANR.js → chunk-AXQCHG77.js} +2 -2
  19. package/dist/{chunk-7JELP5YE.js → chunk-BFANZRQ5.js} +2 -2
  20. package/dist/{chunk-5IZRKWTZ.js → chunk-BGYRF5YX.js} +2 -2
  21. package/dist/{chunk-5IC2WZAL.js → chunk-BIADXGC3.js} +2 -2
  22. package/dist/{chunk-HENP2O4A.js → chunk-BPKNP3KZ.js} +2 -2
  23. package/dist/{chunk-GP7C5VAE.js → chunk-CB5AVJMM.js} +2 -2
  24. package/dist/{chunk-HQA7EBSK.js → chunk-CJTKGAGH.js} +2 -2
  25. package/dist/{chunk-JLZLLLW5.js → chunk-CLPCFGRT.js} +2 -2
  26. package/dist/{chunk-EXZ7VLRY.js → chunk-CSPDQLLU.js} +2 -2
  27. package/dist/{chunk-AEXQYQD7.js → chunk-CYJS33YX.js} +2 -2
  28. package/dist/{chunk-AURCQHSG.js → chunk-DDRA3QKN.js} +2 -2
  29. package/dist/{chunk-3RSBGWGL.js → chunk-DECN422G.js} +2 -2
  30. package/dist/{chunk-3RR2K7EZ.js → chunk-DJKOXMNG.js} +2 -2
  31. package/dist/{chunk-PFC44E6D.js → chunk-DWBAESVW.js} +2 -2
  32. package/dist/{chunk-FQTIFWLR.js → chunk-EHPOTEQX.js} +2 -2
  33. package/dist/{chunk-NBCQZSGR.js → chunk-ELYMY5S2.js} +2 -2
  34. package/dist/{chunk-FTTV7IRX.js → chunk-EOKVZXNF.js} +42 -42
  35. package/dist/{chunk-HINZQKSY.js → chunk-F5CJO5JN.js} +2 -2
  36. package/dist/{chunk-SMDIEDM4.js → chunk-G7GVV2TV.js} +2 -2
  37. package/dist/{chunk-67VJAYVR.js → chunk-HJTM3C4Y.js} +2 -2
  38. package/dist/{chunk-I22IZYDI.js → chunk-HNXRVGMY.js} +2 -2
  39. package/dist/{chunk-NCJILOAK.js → chunk-I3OK27P7.js} +2 -2
  40. package/dist/{chunk-FWQGH2N2.js → chunk-ILGTMRMZ.js} +2 -2
  41. package/dist/{chunk-DDN2F6GB.js → chunk-JAFDMV5I.js} +2 -2
  42. package/dist/{chunk-LONKINMJ.js → chunk-JNXI6NQ7.js} +2 -2
  43. package/dist/{chunk-6BF3VYEF.js → chunk-JSB43EX6.js} +2 -2
  44. package/dist/chunk-JYRJYXUV.js +2 -0
  45. package/dist/chunk-K4S2VH42.js +82 -0
  46. package/dist/{chunk-75KJGYX7.js → chunk-K6FNTQQW.js} +2 -2
  47. package/dist/{chunk-XQPPURLQ.js → chunk-KEJ2HLRW.js} +2 -2
  48. package/dist/{chunk-D7AZAOZX.js → chunk-KFTHI2R6.js} +2 -2
  49. package/dist/{chunk-J3GLP7Q5.js → chunk-KLX6NSWT.js} +2 -2
  50. package/dist/{chunk-TJBOJUVN.js → chunk-KUKKLWJD.js} +2 -2
  51. package/dist/{chunk-2EDX3JT5.js → chunk-KUKWHP4R.js} +2 -2
  52. package/dist/{chunk-JFIA2JI3.js → chunk-KWRQVLPX.js} +2 -2
  53. package/dist/{chunk-5DSL3NT2.js → chunk-L37EQYAX.js} +2 -2
  54. package/dist/{chunk-ITSJMNUD.js → chunk-LCW3PSGL.js} +2 -2
  55. package/dist/{chunk-2PRONPAS.js → chunk-LSZYMN2A.js} +2 -2
  56. package/dist/{chunk-Q23IMHXS.js → chunk-MC46AL7B.js} +2 -2
  57. package/dist/{chunk-JYI7CV25.js → chunk-MDFT325O.js} +2 -2
  58. package/dist/{chunk-CVHOQONG.js → chunk-N2XDMNVI.js} +2 -2
  59. package/dist/chunk-NNG6M6XD.js +3 -0
  60. package/dist/{chunk-MVRGB4KJ.js → chunk-O2KWU34K.js} +2 -2
  61. package/dist/{chunk-USOAJHY7.js → chunk-OBC7HSSO.js} +2 -2
  62. package/dist/{chunk-RIYJ4L33.js → chunk-OKAF4OQS.js} +2 -2
  63. package/dist/{chunk-GQXXOS55.js → chunk-OP6BUIV6.js} +2 -2
  64. package/dist/{chunk-23C5AD3B.js → chunk-OQ3DK7FW.js} +2 -2
  65. package/dist/chunk-OT5ISJSR.js +2 -0
  66. package/dist/{chunk-C7QWUBR2.js → chunk-OWJWOEDU.js} +2 -2
  67. package/dist/{chunk-RJVAPMHF.js → chunk-PIFYOWS4.js} +2 -2
  68. package/dist/{chunk-CR3OG6SQ.js → chunk-PTR3EOXC.js} +2 -2
  69. package/dist/{chunk-NBZKSTXP.js → chunk-QY7QB7I6.js} +2 -2
  70. package/dist/{chunk-Q3ZCQY2Y.js → chunk-R4OJGTMP.js} +2 -2
  71. package/dist/{chunk-UQE4XFSA.js → chunk-RIO3JXHM.js} +2 -2
  72. package/dist/{chunk-CW6AXOLR.js → chunk-SA7G6GJX.js} +2 -2
  73. package/dist/{chunk-Q4XEU3UH.js → chunk-SB53KPWA.js} +2 -2
  74. package/dist/{chunk-36JC5BG2.js → chunk-SUE7SHZL.js} +2 -2
  75. package/dist/{chunk-ZAFGY22Q.js → chunk-SZ4P7MF7.js} +2 -2
  76. package/dist/{chunk-BBP7HVBJ.js → chunk-T2M5HWBQ.js} +2 -2
  77. package/dist/{chunk-MHWMEZDA.js → chunk-TEMM2FEL.js} +2 -2
  78. package/dist/{chunk-JX6ZWDOS.js → chunk-TLTSESB4.js} +2 -2
  79. package/dist/{chunk-FOZ74V56.js → chunk-UIAUPFBJ.js} +2 -2
  80. package/dist/{chunk-PHNCEUXX.js → chunk-UJIXCI3L.js} +2 -2
  81. package/dist/{chunk-XMJ53WG4.js → chunk-UMEPSVKT.js} +2 -2
  82. package/dist/{chunk-GWYZVVKY.js → chunk-V4NGDIEA.js} +2 -2
  83. package/dist/{chunk-E52K4L2W.js → chunk-VSGOIZMQ.js} +2 -2
  84. package/dist/{chunk-Z6RL7XOE.js → chunk-W7QDASTN.js} +2 -2
  85. package/dist/{chunk-PTQPPPG2.js → chunk-WO6OFKUC.js} +2 -2
  86. package/dist/{chunk-C7OUW52M.js → chunk-XJBK3QDV.js} +2 -2
  87. package/dist/{chunk-FH5WG4LE.js → chunk-XUPFA6GH.js} +2 -2
  88. package/dist/{chunk-DAKIGMIK.js → chunk-YPBKBYPS.js} +2 -2
  89. package/dist/{chunk-ZQ62NNKN.js → chunk-Z66XYVLZ.js} +2 -2
  90. package/dist/{chunk-OFGOOL6U.js → chunk-ZMA5HWXY.js} +2 -2
  91. package/dist/{cli-program-UO7PZD6V.js → cli-program-SCHOHOQE.js} +2 -2
  92. package/dist/cli.js +1 -1
  93. package/dist/{code-viewer-VHLBLIUM.js → code-viewer-AMRXV444.js} +2 -2
  94. package/dist/{code-viewer-KIXEYQNJ.js → code-viewer-EXI5SFFR.js} +2 -2
  95. package/dist/{command-descriptors-F5P2V3NW.js → command-descriptors-H6A4UY72.js} +3 -3
  96. package/dist/{command-descriptors-YCLATF5I.js → command-descriptors-ROIOTCCW.js} +3 -3
  97. package/dist/direct-navigation-3JOYP2MO.js +3 -0
  98. package/dist/direct-navigation-SJMJLBY7.js +2 -0
  99. package/dist/index.js +1 -1
  100. package/dist/invocation-command-descriptors-GMZX3UAD.js +2 -0
  101. package/dist/invocation-command-descriptors-HNMKDEF6.js +3 -0
  102. package/dist/{output-continuation-command-BTETTXEC.js → output-continuation-command-5NWVDQT7.js} +2 -2
  103. package/dist/output-continuation-command-RNEHNYPU.js +3 -0
  104. package/dist/project-reindex-MIW5CYEG.js +3 -0
  105. package/dist/{project-reindex-CRJU3IFG.js → project-reindex-VQ23LWDA.js} +2 -2
  106. package/dist/queries/affected.js +1 -1
  107. package/dist/queries/anchors.js +1 -1
  108. package/dist/queries/bottlenecks.js +1 -1
  109. package/dist/queries/call-graph.js +1 -1
  110. package/dist/queries/change-surface.js +1 -1
  111. package/dist/queries/cleanup-plan.js +1 -1
  112. package/dist/queries/complexity-hotspots.js +1 -1
  113. package/dist/queries/complexity.js +1 -1
  114. package/dist/queries/context.js +1 -1
  115. package/dist/queries/convergence.js +1 -1
  116. package/dist/queries/dataflow.js +1 -1
  117. package/dist/queries/dead.js +1 -1
  118. package/dist/queries/decorative-checkers.js +1 -1
  119. package/dist/queries/dependence-slice.js +1 -1
  120. package/dist/queries/diff-impact.js +1 -1
  121. package/dist/queries/drift.js +1 -1
  122. package/dist/queries/entry-map.js +1 -1
  123. package/dist/queries/evidence.js +1 -1
  124. package/dist/queries/extract-candidates.js +1 -1
  125. package/dist/queries/health.js +1 -1
  126. package/dist/queries/hotspots.js +1 -1
  127. package/dist/queries/imports.js +1 -1
  128. package/dist/queries/incomplete-migration.js +1 -1
  129. package/dist/queries/index.js +1 -1
  130. package/dist/queries/isolated.js +1 -1
  131. package/dist/queries/locality-candidates.js +1 -1
  132. package/dist/queries/members.js +1 -1
  133. package/dist/queries/methods.js +1 -1
  134. package/dist/queries/not-implemented.js +1 -1
  135. package/dist/queries/passthrough-candidates.js +1 -1
  136. package/dist/queries/plan-context.js +1 -1
  137. package/dist/queries/recent-duplicates.js +1 -1
  138. package/dist/queries/redundant-reexports.js +1 -1
  139. package/dist/queries/reference-neighborhood.js +1 -1
  140. package/dist/queries/reference-reachability.js +1 -1
  141. package/dist/queries/refs.js +1 -1
  142. package/dist/queries/self-audit.js +1 -1
  143. package/dist/queries/similar-signatures.js +1 -1
  144. package/dist/queries/similar.js +1 -1
  145. package/dist/queries/slice.js +1 -1
  146. package/dist/queries/source-inspection.js +1 -1
  147. package/dist/queries/stale-abstractions.js +1 -1
  148. package/dist/queries/surface.js +1 -1
  149. package/dist/queries/system-map.js +1 -1
  150. package/dist/queries/trace.js +1 -1
  151. package/dist/queries/twin-ab.js +1 -1
  152. package/dist/queries/unused-imports.js +1 -1
  153. package/dist/queries/unused-params.js +1 -1
  154. package/dist/queries/value-flow.js +1 -1
  155. package/dist/queries/wrapper-candidates.js +1 -1
  156. package/dist/reindex-worker.js +1 -1
  157. package/dist/reindex.js +1 -1
  158. package/dist/runtime.js +1 -1
  159. package/dist/rust-semantic-session-server.js +1 -1
  160. package/dist/rust-semantic-session-worker.js +1 -1
  161. package/dist/rust-semantic-worker.js +1 -1
  162. package/dist/{sentinel-ensure-command-SPW7XQLB.js → sentinel-ensure-command-H66AZ3VE.js} +2 -2
  163. package/dist/sentinel-ensure-command-R4YAUCJB.js +3 -0
  164. package/dist/watch-server.js +1 -1
  165. package/package.json +1 -1
  166. package/dist/chunk-6JMAVFL4.js +0 -3
  167. package/dist/chunk-6WAPPQ5F.js +0 -82
  168. package/dist/chunk-P4NVCOM7.js +0 -2
  169. package/dist/chunk-Z35GOVEH.js +0 -2
  170. package/dist/direct-navigation-4XJTXIDT.js +0 -2
  171. package/dist/direct-navigation-J5MVYYAD.js +0 -3
  172. package/dist/invocation-command-descriptors-RWV4VAI4.js +0 -2
  173. package/dist/invocation-command-descriptors-U76PN7IY.js +0 -3
  174. package/dist/output-continuation-command-BL25S26S.js +0 -3
  175. package/dist/project-reindex-TQFCOA2O.js +0 -3
  176. package/dist/sentinel-ensure-command-OSWGCFFL.js +0 -3
package/CHANGELOG.md CHANGED
@@ -9,6 +9,21 @@ names are separate packages, and no `scip-query` version is superseded in place.
9
9
  Entries at 0.20.0 and below record the predecessor package's history, retained
10
10
  for continuity; they document releases of `scip-query`, not of `codebaseiq`.
11
11
 
12
+ ## [0.3.1] — 2026-10-19
13
+
14
+ ### Fixes
15
+
16
+ - **Large Rust workspaces can finish indexing.** Each language indexer was
17
+ stopped after 10 minutes, and rust-analyzer on a 15-crate Tauri workspace
18
+ had grown past that, so every refresh failed and `codebaseiq view` could not
19
+ prepare fresh evidence. The default limit is now 30 minutes.
20
+ `CODEBASEIQ_INDEXER_TIMEOUT_MS` still overrides it.
21
+ - **Stopping a timed-out indexer on Windows no longer reports a cleanup
22
+ failure.** `taskkill /T /F` had one second to end the whole process tree,
23
+ which is too short for rust-analyzer with its cargo, rustc, and proc-macro
24
+ children, so the error ended with "Process-tree cleanup failed: spawnSync
25
+ taskkill.exe ETIMEDOUT". It now has ten seconds.
26
+
12
27
  ## [0.3.0] — 2026-10-18
13
28
 
14
29
  ### Changed (codebaseiq writes its own SQLite index)
@@ -1,2 +1,2 @@
1
- import{a as g}from"./chunk-DGXRDLV5.js";import{c as m}from"./chunk-HENP2O4A.js";import{a as u}from"./chunk-BGBBVSH4.js";import{d}from"./chunk-GVAF222T.js";function k(n,l={}){let{scope:e,minLoc:t=10,minCallees:a=6,limit:r=20,scanLimit:i}=l,s=new m(n);return g({candidates:()=>s.productionCallableDefinitions({scope:e,minLoc:t,excludeTypesFiles:!0,requireFunctionLikeSymbol:!0,sortByLocDesc:!0}),scanLimit:i,profile:{name:"extract-candidates"},prepare:o=>s.calleeEvidenceMap(o,{semantic:l.semantic!==!1}),evaluate:(o,c)=>c.incompleteSymbolIds.has(o.symbolId)||c.unavailableSymbolIds.has(o.symbolId)?null:h(o,c.rows.get(o.symbolId)??[],a),orderResults:(o,c)=>c.clusters.length-o.clusters.length||c.loc-o.loc,limit:r})}function h(n,l,e){let t=new Set(l.map(c=>c.symbol));if(t.size<e)return null;let a=S(t,l),r=y(t,a);if(r.length<2)return null;let i=C(r,a);if(i.length===0)return null;let s=d(n.symbol),o=p(s,t.size,r.length,i);return{symbol:n.symbol,shortName:s,relativePath:n.relativePath,startLine:n.startLine,endLine:n.endLine,loc:u(n),totalCallees:t.size,extractionKind:o.extractionKind,actionTier:"signal",evidenceReasons:o.evidenceReasons,recommendation:o.recommendation,clusters:i}}function p(n,l,e,t){let a=Math.max(...t.map(o=>o.callees.length)),r=Math.max(...t.map(o=>o.isolation)),i=[`${l} distinct callees across ${e} co-occurrence cluster(s)`,`${t.length} extractable cluster(s) passed size and isolation thresholds`,`largest extractable cluster has ${a} callees at ${Math.round(r*100)}% isolation`],s=f(n,l,e);return s!==null?{extractionKind:"workflow-orchestration",evidenceReasons:[...i,s],recommendation:"Review the isolated helper group as a possible private or feature-local helper, but keep the orchestration sequence together when it preserves the workflow."}:a>=6?{extractionKind:"broad-helper-cluster",evidenceReasons:[...i,"one isolated helper group is broad enough to deserve a named review"],recommendation:"Review whether the broad helper cluster has a stable concept name before extracting it; avoid creating a bag-of-helpers abstraction."}:{extractionKind:"cohesive-helper-cluster",evidenceReasons:i,recommendation:"Review the isolated callee group as a possible same-file or feature-local helper; extract only if the new name preserves the current behavior."}}function f(n,l,e){if(l>=10)return`callee breadth suggests orchestration: ${l} callees`;if(e>=4)return`multiple disconnected callee groups suggest orchestration: ${e} groups`;let t=b(n);return x.has(t)?`caller verb suggests orchestration: ${t}`:null}function b(n){return n.split(":").pop()?.replace(/\(\)$/,"").replace(/[^A-Za-z0-9_]/g,"").replace(/([a-z0-9])([A-Z])/g,"$1 $2").split(/[_\s-]+/).filter(Boolean)[0]?.toLowerCase()??""}var x=new Set(["apply","build","check","collect","create","diff","execute","find","handle","load","prepare","process","render","resolve","run","select","sync","update","validate","verify","write"]);function S(n,l){let e=new Map;for(let a of n)e.set(a,new Set);let t=new Map;for(let a of l){let r=t.get(a.chunkId);r||(r=new Set,t.set(a.chunkId,r)),r.add(a.symbol)}for(let a of t.values()){let r=[...a];for(let i=0;i<r.length;i++)for(let s=i+1;s<r.length;s++)e.get(r[i]).add(r[s]),e.get(r[s]).add(r[i])}return e}function y(n,l){let e=new Set,t=[];for(let a of n){if(e.has(a))continue;let r=new Set,i=[a];for(;i.length>0;){let s=i.pop();if(!e.has(s)){e.add(s),r.add(s);for(let o of l.get(s)??[])e.has(o)||i.push(o)}}t.push(r)}return t}function C(n,l){return n.filter(e=>e.size>=3).map(e=>v(e,n,l)).filter(e=>e.isolation>.5).sort((e,t)=>t.isolation-e.isolation)}function v(n,l,e){let t=new Set;for(let s of l)if(s!==n)for(let o of s)t.add(o);let a=0;for(let s of n)for(let o of e.get(s)??[])t.has(o)&&a++;let r=n.size*t.size,i=r>0?1-a/r:1;return{callees:[...n].map(d),isolation:i}}export{k as a};
2
- //# sourceMappingURL=chunk-BFBIMTCJ.js.map
1
+ import{a as g}from"./chunk-DGXRDLV5.js";import{c as m}from"./chunk-BPKNP3KZ.js";import{a as u}from"./chunk-BGBBVSH4.js";import{d}from"./chunk-GVAF222T.js";function k(n,l={}){let{scope:e,minLoc:t=10,minCallees:a=6,limit:r=20,scanLimit:i}=l,s=new m(n);return g({candidates:()=>s.productionCallableDefinitions({scope:e,minLoc:t,excludeTypesFiles:!0,requireFunctionLikeSymbol:!0,sortByLocDesc:!0}),scanLimit:i,profile:{name:"extract-candidates"},prepare:o=>s.calleeEvidenceMap(o,{semantic:l.semantic!==!1}),evaluate:(o,c)=>c.incompleteSymbolIds.has(o.symbolId)||c.unavailableSymbolIds.has(o.symbolId)?null:h(o,c.rows.get(o.symbolId)??[],a),orderResults:(o,c)=>c.clusters.length-o.clusters.length||c.loc-o.loc,limit:r})}function h(n,l,e){let t=new Set(l.map(c=>c.symbol));if(t.size<e)return null;let a=S(t,l),r=y(t,a);if(r.length<2)return null;let i=C(r,a);if(i.length===0)return null;let s=d(n.symbol),o=p(s,t.size,r.length,i);return{symbol:n.symbol,shortName:s,relativePath:n.relativePath,startLine:n.startLine,endLine:n.endLine,loc:u(n),totalCallees:t.size,extractionKind:o.extractionKind,actionTier:"signal",evidenceReasons:o.evidenceReasons,recommendation:o.recommendation,clusters:i}}function p(n,l,e,t){let a=Math.max(...t.map(o=>o.callees.length)),r=Math.max(...t.map(o=>o.isolation)),i=[`${l} distinct callees across ${e} co-occurrence cluster(s)`,`${t.length} extractable cluster(s) passed size and isolation thresholds`,`largest extractable cluster has ${a} callees at ${Math.round(r*100)}% isolation`],s=f(n,l,e);return s!==null?{extractionKind:"workflow-orchestration",evidenceReasons:[...i,s],recommendation:"Review the isolated helper group as a possible private or feature-local helper, but keep the orchestration sequence together when it preserves the workflow."}:a>=6?{extractionKind:"broad-helper-cluster",evidenceReasons:[...i,"one isolated helper group is broad enough to deserve a named review"],recommendation:"Review whether the broad helper cluster has a stable concept name before extracting it; avoid creating a bag-of-helpers abstraction."}:{extractionKind:"cohesive-helper-cluster",evidenceReasons:i,recommendation:"Review the isolated callee group as a possible same-file or feature-local helper; extract only if the new name preserves the current behavior."}}function f(n,l,e){if(l>=10)return`callee breadth suggests orchestration: ${l} callees`;if(e>=4)return`multiple disconnected callee groups suggest orchestration: ${e} groups`;let t=b(n);return x.has(t)?`caller verb suggests orchestration: ${t}`:null}function b(n){return n.split(":").pop()?.replace(/\(\)$/,"").replace(/[^A-Za-z0-9_]/g,"").replace(/([a-z0-9])([A-Z])/g,"$1 $2").split(/[_\s-]+/).filter(Boolean)[0]?.toLowerCase()??""}var x=new Set(["apply","build","check","collect","create","diff","execute","find","handle","load","prepare","process","render","resolve","run","select","sync","update","validate","verify","write"]);function S(n,l){let e=new Map;for(let a of n)e.set(a,new Set);let t=new Map;for(let a of l){let r=t.get(a.chunkId);r||(r=new Set,t.set(a.chunkId,r)),r.add(a.symbol)}for(let a of t.values()){let r=[...a];for(let i=0;i<r.length;i++)for(let s=i+1;s<r.length;s++)e.get(r[i]).add(r[s]),e.get(r[s]).add(r[i])}return e}function y(n,l){let e=new Set,t=[];for(let a of n){if(e.has(a))continue;let r=new Set,i=[a];for(;i.length>0;){let s=i.pop();if(!e.has(s)){e.add(s),r.add(s);for(let o of l.get(s)??[])e.has(o)||i.push(o)}}t.push(r)}return t}function C(n,l){return n.filter(e=>e.size>=3).map(e=>v(e,n,l)).filter(e=>e.isolation>.5).sort((e,t)=>t.isolation-e.isolation)}function v(n,l,e){let t=new Set;for(let s of l)if(s!==n)for(let o of s)t.add(o);let a=0;for(let s of n)for(let o of e.get(s)??[])t.has(o)&&a++;let r=n.size*t.size,i=r>0?1-a/r:1;return{callees:[...n].map(d),isolation:i}}export{k as a};
2
+ //# sourceMappingURL=chunk-2XBJRZEM.js.map
@@ -1,7 +1,7 @@
1
- import{a as A}from"./chunk-QMOZZ2VX.js";import{a as T,b,c as W}from"./chunk-NBZKSTXP.js";import{a as R}from"./chunk-DGXRDLV5.js";import{a as N}from"./chunk-B75HZHUP.js";import{b as C,c as j}from"./chunk-HENP2O4A.js";import{a as _}from"./chunk-BGBBVSH4.js";import{b as E}from"./chunk-J7AMBVWF.js";import{A as P,d,e as w,k}from"./chunk-GVAF222T.js";import{i as L}from"./chunk-F74LZWCE.js";import{d as x}from"./chunk-3LCDIREB.js";import{basename as m,extname as I}from"path";function ce(t,n){let{scope:e,maxLoc:i=15,limit:r=30,scanLimit:o}=n??{},a=new j(t),l=K(a.fileDependencyGraph(e));return R({candidates:()=>z(t,a,e,i),orderCandidates:N,scanLimit:o,profile:{name:"wrapper-candidates"},prepare:c=>({...J(t,a,c,{semantic:n?.semantic!==!1}),reverseFanIn:l}),evaluate:(c,u)=>q(t,a,c,u),orderResults:(c,u)=>u.callerFanIn-c.callerFanIn||u.loc-c.loc,limit:r})}function J(t,n,e,i){let r=T(t,n),o=b(r.forDefinitions(e,{semantic:!1,sourceFallback:!1})),a=[];i.semantic&&x("wrapper.semantic-candidates",()=>{a=e.filter(s=>y(t,n,s,o).length<=1)},()=>({symbols:e.length,semanticCandidates:a.length}));let l=r.forDefinitions(a,{semantic:!0,sourceFallback:!1}),c=b(l),u=new Set([...l.values()].filter(s=>s.semanticIncomplete).map(s=>s.definition.symbolId)),f=new Set([...l.values()].filter(s=>s.semanticUnavailable).map(s=>s.definition.symbolId)),g=c.size===0?o:C(o,c),h=new Map(e.map(s=>[s.symbolId,s])),S=new Map;for(let s of e){let F=y(t,n,s,g);if(F.length>1||(S.set(s.symbolId,s),F.length!==1))continue;let D=F[0],v=O(t,s.symbolId,D);if(!v)continue;let p=B(n,t,D,s.symbol,v);p?.isFunctionLike&&h.has(p.symbolId)&&S.set(p.symbolId,h.get(p.symbolId))}let M=[...S.values()];return{callerFileMap:M.length===0?g:C(g,b(r.forDefinitions(M,{semantic:!1,sourceFallback:!0}))),incompleteSymbolIds:u,unavailableSymbolIds:f}}function q(t,n,e,i){if(i.incompleteSymbolIds.has(e.symbolId)||i.unavailableSymbolIds.has(e.symbolId))return null;let r=y(t,n,e,i.callerFileMap);if(r.length!==1)return null;let o=r[0],a=O(t,e.symbolId,o);if(!a)return null;let l=B(n,t,o,e.symbol,a);if(l&&k(l.symbol))return null;let{fanIn:c,source:u}=G(i.callerFileMap,i.reverseFanIn,o,l);if(u==="function"?c<=3:c<=5)return null;let f=Q(t,e,o,l);return{symbol:e.symbol,shortName:d(e.symbol),file:e.relativePath,startLine:e.startLine,endLine:e.endLine,loc:_(e),singleCaller:l?.symbol??"",singleCallerShort:l?.isFunctionLike?d(l.symbol):m(o),callerFanIn:c,actionTier:f.length>0?"signal":"direct",boundaryEvidence:f}}function z(t,n,e,i){return n.productionCallableDefinitions({scope:e,minLoc:2,maxLoc:i,requireFunctionLikeSymbol:!0,excludeRootedSymbols:!0,excludeRustTraitImplMembers:!0}).filter(r=>!L(t,r))}function y(t,n,e,i){let r=m(e.relativePath,I(e.relativePath)),o=[...i.get(e.symbolId)??[]].filter(a=>a!==e.relativePath).filter(a=>m(a,I(a))!==r).filter(a=>{let l=n.fileKind(a);return l!=="barrel"&&l!=="entry"&&l!=="test"});return W(t,e,o).realConsumers}function O(t,n,e){return t.get(`SELECT c.start_line, c.end_line
1
+ import{a as A}from"./chunk-QMOZZ2VX.js";import{a as T,b,c as W}from"./chunk-QY7QB7I6.js";import{a as R}from"./chunk-DGXRDLV5.js";import{a as N}from"./chunk-B75HZHUP.js";import{b as C,c as j}from"./chunk-BPKNP3KZ.js";import{a as _}from"./chunk-BGBBVSH4.js";import{b as E}from"./chunk-J7AMBVWF.js";import{A as P,d,e as w,k}from"./chunk-GVAF222T.js";import{i as L}from"./chunk-F74LZWCE.js";import{d as x}from"./chunk-3LCDIREB.js";import{basename as m,extname as I}from"path";function ce(t,n){let{scope:e,maxLoc:i=15,limit:r=30,scanLimit:o}=n??{},a=new j(t),l=K(a.fileDependencyGraph(e));return R({candidates:()=>z(t,a,e,i),orderCandidates:N,scanLimit:o,profile:{name:"wrapper-candidates"},prepare:c=>({...J(t,a,c,{semantic:n?.semantic!==!1}),reverseFanIn:l}),evaluate:(c,u)=>q(t,a,c,u),orderResults:(c,u)=>u.callerFanIn-c.callerFanIn||u.loc-c.loc,limit:r})}function J(t,n,e,i){let r=T(t,n),o=b(r.forDefinitions(e,{semantic:!1,sourceFallback:!1})),a=[];i.semantic&&x("wrapper.semantic-candidates",()=>{a=e.filter(s=>y(t,n,s,o).length<=1)},()=>({symbols:e.length,semanticCandidates:a.length}));let l=r.forDefinitions(a,{semantic:!0,sourceFallback:!1}),c=b(l),u=new Set([...l.values()].filter(s=>s.semanticIncomplete).map(s=>s.definition.symbolId)),f=new Set([...l.values()].filter(s=>s.semanticUnavailable).map(s=>s.definition.symbolId)),g=c.size===0?o:C(o,c),h=new Map(e.map(s=>[s.symbolId,s])),S=new Map;for(let s of e){let F=y(t,n,s,g);if(F.length>1||(S.set(s.symbolId,s),F.length!==1))continue;let D=F[0],v=O(t,s.symbolId,D);if(!v)continue;let p=B(n,t,D,s.symbol,v);p?.isFunctionLike&&h.has(p.symbolId)&&S.set(p.symbolId,h.get(p.symbolId))}let M=[...S.values()];return{callerFileMap:M.length===0?g:C(g,b(r.forDefinitions(M,{semantic:!1,sourceFallback:!0}))),incompleteSymbolIds:u,unavailableSymbolIds:f}}function q(t,n,e,i){if(i.incompleteSymbolIds.has(e.symbolId)||i.unavailableSymbolIds.has(e.symbolId))return null;let r=y(t,n,e,i.callerFileMap);if(r.length!==1)return null;let o=r[0],a=O(t,e.symbolId,o);if(!a)return null;let l=B(n,t,o,e.symbol,a);if(l&&k(l.symbol))return null;let{fanIn:c,source:u}=G(i.callerFileMap,i.reverseFanIn,o,l);if(u==="function"?c<=3:c<=5)return null;let f=Q(t,e,o,l);return{symbol:e.symbol,shortName:d(e.symbol),file:e.relativePath,startLine:e.startLine,endLine:e.endLine,loc:_(e),singleCaller:l?.symbol??"",singleCallerShort:l?.isFunctionLike?d(l.symbol):m(o),callerFanIn:c,actionTier:f.length>0?"signal":"direct",boundaryEvidence:f}}function z(t,n,e,i){return n.productionCallableDefinitions({scope:e,minLoc:2,maxLoc:i,requireFunctionLikeSymbol:!0,excludeRootedSymbols:!0,excludeRustTraitImplMembers:!0}).filter(r=>!L(t,r))}function y(t,n,e,i){let r=m(e.relativePath,I(e.relativePath)),o=[...i.get(e.symbolId)??[]].filter(a=>a!==e.relativePath).filter(a=>m(a,I(a))!==r).filter(a=>{let l=n.fileKind(a);return l!=="barrel"&&l!=="entry"&&l!=="test"});return W(t,e,o).realConsumers}function O(t,n,e){return t.get(`SELECT c.start_line, c.end_line
2
2
  FROM mentions m
3
3
  JOIN chunks c ON m.chunk_id = c.id
4
4
  JOIN documents d ON c.document_id = d.id
5
5
  WHERE m.symbol_id = ? AND m.role != 1 AND d.relative_path = ?
6
6
  LIMIT 1`,n,e)}function B(t,n,e,i,r){let o=t.definitionsForFile(e),a=H(n,e,i,r.start_line,r.end_line);return P(o,a)}function G(t,n,e,i){if(i?.isFunctionLike){let r=[...t.get(i.symbolId)??[]].filter(o=>o!==i.relativePath);if(r.length>0)return{fanIn:r.length,source:"function"}}return{fanIn:U(n,e),source:"file"}}function H(t,n,e,i,r){let o=w(e);if(!o)return i;let a=E(t,n).get(o);if(!a||a.length===0)return i;for(let l of a)if(l>=i&&l<=r)return l;return i}function K(t){let n=new Map;for(let[e,i]of t){n.has(e)||n.set(e,n.get(e)??0);for(let r of i)n.set(r,(n.get(r)??0)+1)}return n}function U(t,n){let e=t.get(n)??0;if(e>0)return e;let i=m(n,I(n)),r=0;for(let[o,a]of t)o!==n&&m(o,I(o))===i&&a>r&&(r=a);return r}function Q(t,n,e,i){return A(t,n.relativePath,n.startLine,"wrapper","explicit ignore-wrapper comment",[{label:"wrapper name",value:d(n.symbol)},{label:"caller name",value:i?.symbol?d(i.symbol):m(e)},{label:"wrapper path",value:n.relativePath},{label:"caller path",value:e}])}export{ce as a};
7
- //# sourceMappingURL=chunk-GDHWOA57.js.map
7
+ //# sourceMappingURL=chunk-2Z7K66D7.js.map
@@ -1,2 +1,2 @@
1
- import{c as y}from"./chunk-HENP2O4A.js";import{b as h,e as b}from"./chunk-SGMNWYTH.js";import{d as u,e as i,g as c}from"./chunk-GVAF222T.js";import{f as m}from"./chunk-F74LZWCE.js";import{z as l}from"./chunk-ICUL7XRT.js";import{basename as f}from"path";function g(t,o){let n=o.className,e=h(t,n);return e.match?e.total>1?{kind:"ambiguous",query:n,total:e.total,candidates:[p(e.match),...e.candidates]}:{kind:"matched",query:n,owner:L(e.match),methods:M(t,e.match)}:{kind:"missing",query:n,suggestions:b(t,n,5)}}function j(t,o){let n=g(t,{className:o});if(n.kind==="missing")throw new Error(`No class definition matched '${o}'.`);if(n.kind==="ambiguous"){let e=n.candidates.map(s=>`${s.relativePath}:${s.startLine+1}`).join(", ");throw new Error(`Class '${o}' is ambiguous across ${n.total} definitions (${e}). Qualify it with a path or exact SCIP symbol identity.`)}return n.methods}function M(t,o){let n=i(o.symbol),s=new y(t).definitionsForFile(o.relativePath).filter(r=>c(r.symbol)),a=s.filter(r=>r.parentTypeName===n||r.symbol.includes(n)),d=(a.length>0?a:S(f(o.relativePath))===n?s.filter(r=>r.symbol.includes("<invalid-global-code>")):[]).map(r=>({startLine:r.startLine,endLine:r.endLine,name:i(r.symbol)}));return l(o.relativePath)!=="clojure"?d:R(d,w(t,o))}function p(t){return{symbol:t.symbol,shortName:u(t.symbol),relativePath:t.relativePath,startLine:t.startLine}}function L(t){return{...p(t),endLine:t.endLine}}function S(t){return t.replace(/\.[^.]+$/,"")}function w(t,o){let n=i(o.symbol);return n?(m(t,o.relativePath)?.clojureMembers??[]).filter(e=>e.ownerName===n).map(e=>({startLine:e.startLine,endLine:e.endLine,name:e.memberName})):[]}function R(t,o){let n=new Map;for(let e of[...t,...o])n.set(`${e.name}:${e.startLine}:${e.endLine}`,e);return[...n.values()].sort((e,s)=>e.startLine-s.startLine||e.endLine-s.endLine)}export{g as a,j as b};
2
- //# sourceMappingURL=chunk-HVFB3PME.js.map
1
+ import{c as y}from"./chunk-BPKNP3KZ.js";import{b as h,e as b}from"./chunk-SGMNWYTH.js";import{d as u,e as i,g as c}from"./chunk-GVAF222T.js";import{f as m}from"./chunk-F74LZWCE.js";import{z as l}from"./chunk-ICUL7XRT.js";import{basename as f}from"path";function g(t,o){let n=o.className,e=h(t,n);return e.match?e.total>1?{kind:"ambiguous",query:n,total:e.total,candidates:[p(e.match),...e.candidates]}:{kind:"matched",query:n,owner:L(e.match),methods:M(t,e.match)}:{kind:"missing",query:n,suggestions:b(t,n,5)}}function j(t,o){let n=g(t,{className:o});if(n.kind==="missing")throw new Error(`No class definition matched '${o}'.`);if(n.kind==="ambiguous"){let e=n.candidates.map(s=>`${s.relativePath}:${s.startLine+1}`).join(", ");throw new Error(`Class '${o}' is ambiguous across ${n.total} definitions (${e}). Qualify it with a path or exact SCIP symbol identity.`)}return n.methods}function M(t,o){let n=i(o.symbol),s=new y(t).definitionsForFile(o.relativePath).filter(r=>c(r.symbol)),a=s.filter(r=>r.parentTypeName===n||r.symbol.includes(n)),d=(a.length>0?a:S(f(o.relativePath))===n?s.filter(r=>r.symbol.includes("<invalid-global-code>")):[]).map(r=>({startLine:r.startLine,endLine:r.endLine,name:i(r.symbol)}));return l(o.relativePath)!=="clojure"?d:R(d,w(t,o))}function p(t){return{symbol:t.symbol,shortName:u(t.symbol),relativePath:t.relativePath,startLine:t.startLine}}function L(t){return{...p(t),endLine:t.endLine}}function S(t){return t.replace(/\.[^.]+$/,"")}function w(t,o){let n=i(o.symbol);return n?(m(t,o.relativePath)?.clojureMembers??[]).filter(e=>e.ownerName===n).map(e=>({startLine:e.startLine,endLine:e.endLine,name:e.memberName})):[]}function R(t,o){let n=new Map;for(let e of[...t,...o])n.set(`${e.name}:${e.startLine}:${e.endLine}`,e);return[...n.values()].sort((e,s)=>e.startLine-s.startLine||e.endLine-s.endLine)}export{g as a,j as b};
2
+ //# sourceMappingURL=chunk-3H2H5ODK.js.map
@@ -1,2 +1,2 @@
1
- import{c as m}from"./chunk-NCJILOAK.js";var v=/:\d+(?:-\d+)?$/u;function D(d,t,c={}){let p=c.direction??"backward",n=c.maxDepth??3;if(!Number.isSafeInteger(n)||n<0)throw new RangeError(`Dependence-slice depth must be a non-negative safe integer; received ${n}.`);let r=v.test(t),o=m(d,r?{locations:[t]}:{symbols:[t]},{families:["execution","runtime","dataflow","ownership"],maxDepth:n+1,maxEdges:c.maxEdges??200}),f=new Set(o.targets.flatMap(e=>e.nodeIds)),a=new Set(f),l=new Map;u(o.edges,a,l,0);for(let e=1;e<=n;e+=1){let s=[];for(let i of o.edges)if(p==="backward"?a.has(i.to.id):a.has(i.from.id)){let g=p==="backward"?i.from.id:i.to.id;if(a.has(g))continue;s.push(g),l.set(i.id,e)}if(s.length===0)break;for(let i of s)a.add(i);u(o.edges,a,l,e)}let h=o.edges.filter(e=>a.has(e.from.id)&&a.has(e.to.id)).filter(e=>l.has(e.id)||e.family==="ownership").map(e=>({...e,traversalDepth:l.get(e.id)??0,supporting:e.family!=="dataflow"&&!y(e)})).sort((e,s)=>e.traversalDepth-s.traversalDepth||e.family.localeCompare(s.family)||e.from.label.localeCompare(s.from.label)||e.to.label.localeCompare(s.to.label));return{kind:"dependence-slice",direction:p,criterion:t,targets:o.targets,nodeIds:[...a].sort(),edges:h,coverage:{status:o.coverage.status,criterionKind:r?"source-location-summary":"symbol-summary",basis:"partial-system-dependence-graph",analysisBasis:"typescript-cfg-reaching-definitions-plus-system-edges",providers:["typescript-local-dependence","bounded-static-value-flow"],graph:o.coverage,unsupportedRelations:["general heap alias and cross-instance field points-to flow","exceptional control and value flow","closure invocation order","downstream local definition-use after a call result","unresolved dynamic dispatch"]}}}function u(d,t,c,p){let n=!0;for(;n;){n=!1;for(let r of d)r.family!=="ownership"||!t.has(r.from.id)||t.has(r.to.id)||(t.add(r.to.id),c.set(r.id,p),n=!0)}}function y(d){return d.semanticFamily==="control"&&d.sourceKind==="control-dependence"}export{D as a};
2
- //# sourceMappingURL=chunk-LZSQ6X7E.js.map
1
+ import{c as m}from"./chunk-I3OK27P7.js";var v=/:\d+(?:-\d+)?$/u;function D(d,t,c={}){let p=c.direction??"backward",n=c.maxDepth??3;if(!Number.isSafeInteger(n)||n<0)throw new RangeError(`Dependence-slice depth must be a non-negative safe integer; received ${n}.`);let r=v.test(t),o=m(d,r?{locations:[t]}:{symbols:[t]},{families:["execution","runtime","dataflow","ownership"],maxDepth:n+1,maxEdges:c.maxEdges??200}),f=new Set(o.targets.flatMap(e=>e.nodeIds)),a=new Set(f),l=new Map;u(o.edges,a,l,0);for(let e=1;e<=n;e+=1){let s=[];for(let i of o.edges)if(p==="backward"?a.has(i.to.id):a.has(i.from.id)){let g=p==="backward"?i.from.id:i.to.id;if(a.has(g))continue;s.push(g),l.set(i.id,e)}if(s.length===0)break;for(let i of s)a.add(i);u(o.edges,a,l,e)}let h=o.edges.filter(e=>a.has(e.from.id)&&a.has(e.to.id)).filter(e=>l.has(e.id)||e.family==="ownership").map(e=>({...e,traversalDepth:l.get(e.id)??0,supporting:e.family!=="dataflow"&&!y(e)})).sort((e,s)=>e.traversalDepth-s.traversalDepth||e.family.localeCompare(s.family)||e.from.label.localeCompare(s.from.label)||e.to.label.localeCompare(s.to.label));return{kind:"dependence-slice",direction:p,criterion:t,targets:o.targets,nodeIds:[...a].sort(),edges:h,coverage:{status:o.coverage.status,criterionKind:r?"source-location-summary":"symbol-summary",basis:"partial-system-dependence-graph",analysisBasis:"typescript-cfg-reaching-definitions-plus-system-edges",providers:["typescript-local-dependence","bounded-static-value-flow"],graph:o.coverage,unsupportedRelations:["general heap alias and cross-instance field points-to flow","exceptional control and value flow","closure invocation order","downstream local definition-use after a call result","unresolved dynamic dispatch"]}}}function u(d,t,c,p){let n=!0;for(;n;){n=!1;for(let r of d)r.family!=="ownership"||!t.has(r.from.id)||t.has(r.to.id)||(t.add(r.to.id),c.set(r.id,p),n=!0)}}function y(d){return d.semanticFamily==="control"&&d.sourceKind==="control-dependence"}export{D as a};
2
+ //# sourceMappingURL=chunk-3LQJRS4I.js.map
@@ -1,6 +1,6 @@
1
- import{a as le}from"./chunk-D7AZAOZX.js";import{a as re}from"./chunk-UW6KD57C.js";import{b as _}from"./chunk-VWYGCMV5.js";import{a as se}from"./chunk-2E6OUPCF.js";import{b as ie}from"./chunk-NBCQZSGR.js";import{a as ne,b as oe}from"./chunk-W7YLRXZE.js";import{b as ee}from"./chunk-HINZQKSY.js";import{f as te}from"./chunk-2OMXFE64.js";import{a as X}from"./chunk-Q4XEU3UH.js";import{a as Z}from"./chunk-PFC44E6D.js";import{b as Q}from"./chunk-OQUCBKOI.js";import{a as J}from"./chunk-CCIYWXX6.js";import{d as V}from"./chunk-VGWZ4MOY.js";import{b as Y}from"./chunk-LMTSB3TB.js";import{a as W}from"./chunk-XMJ53WG4.js";import{a as D}from"./chunk-36JC5BG2.js";import{b as q}from"./chunk-CW6AXOLR.js";import{a as H,c as K}from"./chunk-SGMNWYTH.js";import{a as G}from"./chunk-BRQL7AFJ.js";import{e as P,t as w}from"./chunk-GVAF222T.js";import{d as z}from"./chunk-3LCDIREB.js";function ae(e){let t=new Set(e.filter(o=>o.definition?.isFunctionLike).map(o=>`${o.role}:${o.definition.relativePath}`));return e.flatMap(o=>o.definition?!o.definition.isFunctionLike&&t.has(`${o.role}:${o.definition.relativePath}`)?[]:[{definition:o.definition,role:o.role}]:[])}var pe=6,I=10,B=3,N=8,he=.7,ce=24,M=200,ye=12,ue=80,me=600;function Ve(e,t,o={}){let l=o.impactDepth??3,m=o.sliceDepth??3,u=o.semantic,c=Ee(t)?be(e,t):null,a=c?c.primary?.symbol??null:t,s=a!==null,d=s?f("trace",a,()=>ie(e,a,{semantic:u,referenceContext:ye}),i=>({definitions:i.definitions.length,references:i.referencedBy.length})):{definitions:[],referencedBy:[],claimSupport:null},g=s?f("call-graph",a,()=>X(e,a,{semantic:u}),i=>({callers:i?.callers.length??0,callees:i?.callees.length??0})):null,n=s?f("complexity",a,()=>W(e,a,{semantic:u}),i=>({callees:i?.calleeCount??0})):null,y=s?f("dataflow",a,()=>ee(e,a,{semantic:u}),i=>({references:i?.usageSites.length??0,producers:i?.producers.length??0,consumers:i?.consumers.length??0})):null,r=s?f("backward-slice",a,()=>_(e,a,{direction:"backward",maxDepth:m,semantic:u}),i=>({maxDepth:m,connectedSymbols:i?.connectedSymbols.length??0})):null,C=s?f("forward-slice",a,()=>_(e,a,{direction:"forward",maxDepth:m,semantic:u}),i=>({maxDepth:m,connectedSymbols:i?.connectedSymbols.length??0})):null,h=s?f("affected",a,()=>q(e,a,{maxDepth:l,scope:o.scope}),i=>({maxDepth:l,affectedSymbols:i.rows.length,coverage:i.coverage.status})):null,b=h?.rows??[],p=h?.coverage??null,S=s?f("reuse-candidates",a,()=>D(e,a,{minSimilarity:.4,limit:5,semantic:u,sourceCandidateMode:"target-pruned"}),i=>({candidates:i.length,direct:i.filter(Ce=>Ce.actionTier==="direct").length})):[],L=s?H(e,a)?.symbol??null:null,k=s?f("affected-consumer-reuse",a,()=>Re(d,L,i=>D(e,i,{minSimilarity:.4,limit:I,semantic:u,sourceCandidateMode:"target-pruned"}),{consumerLimit:pe,perConsumerSearchLimit:I,perConsumerCandidateLimit:B,candidateLimit:N}),i=>({totalConsumers:i.coverage.totalConsumers,analyzedConsumers:i.coverage.analyzedConsumers,candidates:i.candidates.length})):ve(),A=f("change-surface",t,()=>Z(e,t,{semantic:u}),i=>({symbols:i?.symbols.length??0,externalConsumers:i?.totalExternalConsumers??0})),R=f("system",t,()=>re(e,t),i=>({files:i.files.length,symbols:i.symbols.length})),T=R.files.length===1,F=f("deps",t,()=>T?R.dependsOn.map(i=>({relativePath:i,edgeBasis:"symbol-references",evidence:"cross-file SCIP references plus resolved source imports"})):ne(e,t),i=>({files:i.length,reusedSystem:T})),O=f("rdeps",t,()=>T?R.dependedOnBy.map(i=>({relativePath:i,edgeBasis:"symbol-references",evidence:"cross-file SCIP references plus resolved source imports"})):oe(e,t),i=>({files:i.length,reusedSystem:T})),U=f("surface",t,()=>le(e,t),i=>({consumers:i.length})),v={symbol:d.definitions.length>0||d.referencedBy.length>0||g!==null||n!==null||y!==null||r!==null||C!==null||b.length>0,file:A!==null||F.length>0||O.length>0,module:R.files.length>0||R.symbols.length>0||U.length>0},x=[];c&&!c.primary&&c.callableCount>1&&x.push(`File target has ${c.callableCount} callable symbols; use one callable name for compiler-resolved flow.`);let $=[...new Set(d.referencedBy.map(i=>i.relativePath))];$.length>0&&$.every(i=>G(i)==="test")&&x.push("Only test references were found for this target. For replacement or retirement work, map the currently wired owner or one production entry point before planning; this target does not describe the live affected surface."),!v.symbol&&!v.file&&!v.module&&x.push("No symbol, file, or module matched target."),p&&p.status!=="accounted"&&x.push(`Possible-impact coverage is ${p.status}: ${p.reasons.join(" ")}`);let j=A?.file??d.definitions[0]?.relativePath??null;return{target:t,...c?.primary?{primaryCallable:{symbol:c.primary.symbol,shortName:P(c.primary.symbol),file:c.primary.relativePath}}:{},matched:v,history:f("history",j??t,()=>Pe(e,j,o.gitHead)),trace:ge(d),callGraph:g,complexity:n,dataflow:y,backwardSlice:r,forwardSlice:C,affected:b,affectedCoverage:p,changeSurface:A,deps:F,rdeps:O,system:R,surface:U,reuseCandidates:S,affectedConsumerReuse:k,sourcePacket:Se(e,L,d,k,S),warnings:x}}function ge(e){return{definitions:e.definitions,referencedBy:e.referencedBy.map(t=>({relativePath:t.relativePath,line:t.line,enclosingSymbol:t.enclosingSymbol,enclosingShort:t.enclosingShort}))}}function be(e,t){let o=Y(e,t);if(o.length!==1)return{primary:null,callableCount:0};let l=w(e,o[0]).filter(c=>c.isFunctionLike),m=l.filter(c=>c.enclosingSymbol===null),u=m.length>0?m:l;return{primary:u.length===1?u[0]:null,callableCount:u.length}}function Se(e,t,o,l,m){let u=[...t?[{definition:fe(e,t),role:"target"}]:[],...[...l.candidates.map(n=>n.candidate),...m].map(n=>({definition:fe(e,n.symbolB),role:"reuse-candidate"}))],c=new Map;for(let n of ae(u)){if(c.has(n.definition.symbol))continue;let y=n.role==="target"?M:ue,r=n.definition.endLine<=n.definition.startLine?V(e,n.definition.relativePath,n.definition.startLine,y):null,C=r?.unitType?r.source:te(e,n.definition);if(!C)continue;let h=C.split(`
1
+ import{a as le}from"./chunk-KFTHI2R6.js";import{a as re}from"./chunk-UW6KD57C.js";import{b as _}from"./chunk-AGGR2BKS.js";import{a as se}from"./chunk-2E6OUPCF.js";import{b as ie}from"./chunk-ELYMY5S2.js";import{a as ne,b as oe}from"./chunk-W7YLRXZE.js";import{b as ee}from"./chunk-F5CJO5JN.js";import{f as te}from"./chunk-2OMXFE64.js";import{a as X}from"./chunk-SB53KPWA.js";import{a as Z}from"./chunk-DWBAESVW.js";import{b as Q}from"./chunk-OQUCBKOI.js";import{a as J}from"./chunk-CCIYWXX6.js";import{d as V}from"./chunk-VGWZ4MOY.js";import{b as Y}from"./chunk-LMTSB3TB.js";import{a as W}from"./chunk-UMEPSVKT.js";import{a as D}from"./chunk-SUE7SHZL.js";import{b as q}from"./chunk-SA7G6GJX.js";import{a as H,c as K}from"./chunk-SGMNWYTH.js";import{a as G}from"./chunk-BRQL7AFJ.js";import{e as P,t as w}from"./chunk-GVAF222T.js";import{d as z}from"./chunk-3LCDIREB.js";function ae(e){let t=new Set(e.filter(o=>o.definition?.isFunctionLike).map(o=>`${o.role}:${o.definition.relativePath}`));return e.flatMap(o=>o.definition?!o.definition.isFunctionLike&&t.has(`${o.role}:${o.definition.relativePath}`)?[]:[{definition:o.definition,role:o.role}]:[])}var pe=6,I=10,B=3,N=8,he=.7,ce=24,M=200,ye=12,ue=80,me=600;function Ve(e,t,o={}){let l=o.impactDepth??3,m=o.sliceDepth??3,u=o.semantic,c=Ee(t)?be(e,t):null,a=c?c.primary?.symbol??null:t,s=a!==null,d=s?f("trace",a,()=>ie(e,a,{semantic:u,referenceContext:ye}),i=>({definitions:i.definitions.length,references:i.referencedBy.length})):{definitions:[],referencedBy:[],claimSupport:null},g=s?f("call-graph",a,()=>X(e,a,{semantic:u}),i=>({callers:i?.callers.length??0,callees:i?.callees.length??0})):null,n=s?f("complexity",a,()=>W(e,a,{semantic:u}),i=>({callees:i?.calleeCount??0})):null,y=s?f("dataflow",a,()=>ee(e,a,{semantic:u}),i=>({references:i?.usageSites.length??0,producers:i?.producers.length??0,consumers:i?.consumers.length??0})):null,r=s?f("backward-slice",a,()=>_(e,a,{direction:"backward",maxDepth:m,semantic:u}),i=>({maxDepth:m,connectedSymbols:i?.connectedSymbols.length??0})):null,C=s?f("forward-slice",a,()=>_(e,a,{direction:"forward",maxDepth:m,semantic:u}),i=>({maxDepth:m,connectedSymbols:i?.connectedSymbols.length??0})):null,h=s?f("affected",a,()=>q(e,a,{maxDepth:l,scope:o.scope}),i=>({maxDepth:l,affectedSymbols:i.rows.length,coverage:i.coverage.status})):null,b=h?.rows??[],p=h?.coverage??null,S=s?f("reuse-candidates",a,()=>D(e,a,{minSimilarity:.4,limit:5,semantic:u,sourceCandidateMode:"target-pruned"}),i=>({candidates:i.length,direct:i.filter(Ce=>Ce.actionTier==="direct").length})):[],L=s?H(e,a)?.symbol??null:null,k=s?f("affected-consumer-reuse",a,()=>Re(d,L,i=>D(e,i,{minSimilarity:.4,limit:I,semantic:u,sourceCandidateMode:"target-pruned"}),{consumerLimit:pe,perConsumerSearchLimit:I,perConsumerCandidateLimit:B,candidateLimit:N}),i=>({totalConsumers:i.coverage.totalConsumers,analyzedConsumers:i.coverage.analyzedConsumers,candidates:i.candidates.length})):ve(),A=f("change-surface",t,()=>Z(e,t,{semantic:u}),i=>({symbols:i?.symbols.length??0,externalConsumers:i?.totalExternalConsumers??0})),R=f("system",t,()=>re(e,t),i=>({files:i.files.length,symbols:i.symbols.length})),T=R.files.length===1,F=f("deps",t,()=>T?R.dependsOn.map(i=>({relativePath:i,edgeBasis:"symbol-references",evidence:"cross-file SCIP references plus resolved source imports"})):ne(e,t),i=>({files:i.length,reusedSystem:T})),O=f("rdeps",t,()=>T?R.dependedOnBy.map(i=>({relativePath:i,edgeBasis:"symbol-references",evidence:"cross-file SCIP references plus resolved source imports"})):oe(e,t),i=>({files:i.length,reusedSystem:T})),U=f("surface",t,()=>le(e,t),i=>({consumers:i.length})),v={symbol:d.definitions.length>0||d.referencedBy.length>0||g!==null||n!==null||y!==null||r!==null||C!==null||b.length>0,file:A!==null||F.length>0||O.length>0,module:R.files.length>0||R.symbols.length>0||U.length>0},x=[];c&&!c.primary&&c.callableCount>1&&x.push(`File target has ${c.callableCount} callable symbols; use one callable name for compiler-resolved flow.`);let $=[...new Set(d.referencedBy.map(i=>i.relativePath))];$.length>0&&$.every(i=>G(i)==="test")&&x.push("Only test references were found for this target. For replacement or retirement work, map the currently wired owner or one production entry point before planning; this target does not describe the live affected surface."),!v.symbol&&!v.file&&!v.module&&x.push("No symbol, file, or module matched target."),p&&p.status!=="accounted"&&x.push(`Possible-impact coverage is ${p.status}: ${p.reasons.join(" ")}`);let j=A?.file??d.definitions[0]?.relativePath??null;return{target:t,...c?.primary?{primaryCallable:{symbol:c.primary.symbol,shortName:P(c.primary.symbol),file:c.primary.relativePath}}:{},matched:v,history:f("history",j??t,()=>Pe(e,j,o.gitHead)),trace:ge(d),callGraph:g,complexity:n,dataflow:y,backwardSlice:r,forwardSlice:C,affected:b,affectedCoverage:p,changeSurface:A,deps:F,rdeps:O,system:R,surface:U,reuseCandidates:S,affectedConsumerReuse:k,sourcePacket:Se(e,L,d,k,S),warnings:x}}function ge(e){return{definitions:e.definitions,referencedBy:e.referencedBy.map(t=>({relativePath:t.relativePath,line:t.line,enclosingSymbol:t.enclosingSymbol,enclosingShort:t.enclosingShort}))}}function be(e,t){let o=Y(e,t);if(o.length!==1)return{primary:null,callableCount:0};let l=w(e,o[0]).filter(c=>c.isFunctionLike),m=l.filter(c=>c.enclosingSymbol===null),u=m.length>0?m:l;return{primary:u.length===1?u[0]:null,callableCount:u.length}}function Se(e,t,o,l,m){let u=[...t?[{definition:fe(e,t),role:"target"}]:[],...[...l.candidates.map(n=>n.candidate),...m].map(n=>({definition:fe(e,n.symbolB),role:"reuse-candidate"}))],c=new Map;for(let n of ae(u)){if(c.has(n.definition.symbol))continue;let y=n.role==="target"?M:ue,r=n.definition.endLine<=n.definition.startLine?V(e,n.definition.relativePath,n.definition.startLine,y):null,C=r?.unitType?r.source:te(e,n.definition);if(!C)continue;let h=C.split(`
2
2
  `),b=Math.min(h.length,y),p=r?.unitType?r.startLine:n.definition.startLine;c.set(n.definition.symbol,{role:n.role,symbol:n.definition.symbol,shortName:P(n.definition.symbol),file:n.definition.relativePath,startLine:p,endLine:p+b-1,source:h.slice(0,b).join(`
3
3
  `),omittedLines:(r?.unitType?r.omittedLines:0)+Math.max(0,h.length-b)})}let a=new Map;for(let n of o.referencedBy){if(n.source===void 0||n.source===null||n.sourceStartLine===void 0||n.sourceStartLine===null||n.sourceEndLine===void 0||n.sourceEndLine===null)continue;let y=`${n.relativePath}:${n.sourceStartLine}-${n.sourceEndLine}`,r=a.get(y);if(r){r.focusLines=[...new Set([...r.focusLines??[],n.line])].sort((C,h)=>C-h);continue}a.set(y,{role:"consumer",symbol:n.enclosingSymbol??`${n.relativePath}:${n.line}`,shortName:n.enclosingShort,file:n.relativePath,startLine:n.sourceStartLine,endLine:n.sourceEndLine,source:n.source,omittedLines:0,focusLines:[n.line]})}let s=[...[...c.values()].filter(n=>n.role==="target"),...a.values(),...[...c.values()].filter(n=>n.role==="reuse-candidate")],d=[],g=me;for(let n of s){if(d.length>=ce||g<=0)break;let y=n.source.split(`
4
4
  `),r=Math.min(y.length,g);d.push({...n,endLine:n.startLine+r-1,source:y.slice(0,r).join(`
5
5
  `),omittedLines:n.omittedLines+Math.max(0,y.length-r),...n.focusLines?{focusLines:n.focusLines.filter(C=>C<=n.startLine+r-1)}:{}}),g-=r}return{slices:d,candidateSlices:s.length,omittedSlices:Math.max(0,s.length-d.length),maxSlices:ce,maxLinesPerSlice:M,maxTotalLines:me,targetLineLimit:M,consumerContextLines:ye,reuseLineLimit:ue}}function fe(e,t){let o=K(e,t);return o?w(e,o.relativePath).find(l=>l.symbol===t)??null:null}function Re(e,t,o,l={}){let m=E(l.consumerLimit,pe),u=E(l.perConsumerSearchLimit,I),c=E(l.perConsumerCandidateLimit,B),a=E(l.candidateLimit,N),s=xe(e),d=s.slice(0,m),g=new Set(s.map(r=>r.symbol));t&&g.add(t);let n=new Map;for(let r of d){let C=o(r.symbol).slice(0,u),h=0;for(let b of C){let p=Le(b,r.symbol);if(!p||g.has(p.symbolB))continue;let S=n.get(p.symbolB);if(S?(S.consumers.some(L=>L.symbol===r.symbol)||S.consumers.push(r),p.similarity>S.candidate.similarity&&(S.candidate=p)):n.set(p.symbolB,{candidate:p,consumers:[r]}),h+=1,h>=c)break}}let y=[...n.values()].filter(r=>r.candidate.actionTier==="direct"||r.candidate.similarity>=he||r.consumers.length>1).sort(Te).slice(0,a);return{candidates:y,coverage:{totalConsumers:s.length,analyzedConsumers:d.length,omittedConsumers:Math.max(0,s.length-d.length),perConsumerSearchLimit:u,perConsumerCandidateLimit:c,candidateLimit:a,returnedCandidates:y.length}}}function xe(e){let t=new Map;for(let o of e.referencedBy){if(!o.enclosingSymbol)continue;let l=t.get(o.enclosingSymbol);if(l){l.referenceCount+=1;continue}t.set(o.enclosingSymbol,{symbol:o.enclosingSymbol,shortName:P(o.enclosingSymbol)||o.enclosingShort,file:o.relativePath,referenceCount:1})}return[...t.values()].sort((o,l)=>l.referenceCount-o.referenceCount||o.symbol.localeCompare(l.symbol))}function Le(e,t){return e.symbolA===t?e:e.symbolB!==t?null:{...e,symbolA:e.symbolB,shortNameA:e.shortNameB,fileA:e.fileB,symbolB:e.symbolA,shortNameB:e.shortNameA,fileB:e.fileA,uniqueToA:e.uniqueToB,uniqueToB:e.uniqueToA}}function Te(e,t){let o=de(t.candidate.actionTier)-de(e.candidate.actionTier);if(o!==0)return o;let l=t.consumers.length-e.consumers.length;if(l!==0)return l;let m=t.candidate.similarity-e.candidate.similarity;return m!==0?m:e.candidate.symbolB.localeCompare(t.candidate.symbolB)}function de(e){return e==="direct"?1:0}function E(e,t){return typeof e=="number"&&Number.isFinite(e)?Math.max(1,Math.floor(e)):t}function ve(){return{candidates:[],coverage:{totalConsumers:0,analyzedConsumers:0,omittedConsumers:0,perConsumerSearchLimit:I,perConsumerCandidateLimit:B,candidateLimit:N,returnedCandidates:0}}}function f(e,t,o,l=()=>({})){let m;return z(`context.${e}`,()=>(m=o(),m),()=>({target:t,...l(m)}))}function Pe(e,t,o){let l={available:!1,file:t,churn:null,coChangePartners:[],suppressionsInFile:0};if(!t)return l;let m=J(e,o?{head:o}:{}),u=f("history.churn",t,()=>m.fileChurn(),s=>({files:s?.size??0}));if(!u)return l;let c=f("history.co-change",t,()=>Q(e,t,{limit:5,...o?{head:o}:{}}),s=>({commits:s.commitsAnalyzed,partners:s.findings.length})),a=f("history.suppressions",t,()=>se(e).byFile.get(t)??0,s=>({suppressions:s}));return{available:!0,file:t,churn:u.get(t)??{changes:0,fixChanges:0,lastChangedAt:0},coChangePartners:c.findings.map(s=>({file:s.fileA===t?s.fileB:s.fileA,together:s.together,confidence:s.confidence,subjectContext:s.subjectContext})),suppressionsInFile:a}}function Ee(e){return e.includes("/")||e.includes("\\")||/\.[A-Za-z0-9]+(?::\d+(?:-\d+)?)?$/.test(e)}export{Ve as a,Re as b};
6
- //# sourceMappingURL=chunk-GIDCP7KV.js.map
6
+ //# sourceMappingURL=chunk-3ON3A2QV.js.map
@@ -1,2 +1,2 @@
1
- import{b as S}from"./chunk-B75HZHUP.js";import{c as C}from"./chunk-HENP2O4A.js";import{a as g}from"./chunk-6VREELBC.js";import{f as v}from"./chunk-MSI3K7PJ.js";import{d as f}from"./chunk-GVAF222T.js";function h(n,t={}){return x(n,t).rows}function x(n,t={}){let{limit:a=20,scope:r,minFanIn:b=2,minFanOut:u=2,scanLimit:l}=t,c=new C(n),s=S(c.productionCallableDefinitions({scope:r,requireCallableSymbol:!0,includeSuppressed:!0,sortByLocDesc:typeof l=="number"&&l>0}),l),m=t.semantic!==!1,d=v(n,s,{limit:500,semantic:m,semanticEvidence:g}),e=c.calleeEvidenceMap(s,{semantic:m}),i=new Set([...d.incompleteSymbolIds,...e.incompleteSymbolIds]),p=new Set([...d.unavailableSymbolIds,...e.unavailableSymbolIds]);return{rows:s.filter(o=>!i.has(o.symbolId)&&!p.has(o.symbolId)).map(o=>E(o,d.rows.get(o.symbolId)??[],e.rows.get(o.symbolId)??[])).filter(o=>o.fanIn>=b&&o.fanOut>=u).sort((o,y)=>y.score-o.score||y.fanIn-o.fanIn).slice(0,a),coverage:k(m,i,p)}}function D(n,t={}){return h(n,t)}function k(n,t,a){let r=n?t.size>0&&a.size>0?"incomplete-and-unavailable":t.size>0?"incomplete":a.size>0?"unavailable":"complete":"disabled";return{semanticEvidence:{enabled:n,status:r,incompleteSymbolCount:t.size,unavailableSymbolCount:a.size,excludedSymbolCount:new Set([...t,...a]).size}}}function E(n,t,a){let r=[...new Set(t.map(e=>e.file))].sort(),b=[...new Set(t.filter(e=>e.source!=="caller-map-inversion"||e.callEvidence==="scip-chunk").map(e=>e.file))].sort(),u=new Map;for(let e of a.slice(0,500)){if(e.file===n.relativePath)continue;let i=`${e.symbol}|${e.file}`;u.has(i)||u.set(i,{symbol:e.symbol,shortName:f(e.symbol),file:e.file,evidenceStrength:e.source==="scip-chunk"?"candidate":"exact",evidenceSource:e.source})}let l=[...u.values()].sort((e,i)=>e.file.localeCompare(i.file)||e.symbol.localeCompare(i.symbol)),c=r.length,s=l.length,m=c*s,d=l.filter(e=>e.evidenceStrength==="candidate").map(e=>e.symbol);return{symbol:n.symbol,shortName:f(n.symbol),fanIn:c,fanOut:s,callerFiles:r,candidateCallerFiles:b,externalCallees:l.map(({symbol:e,shortName:i,file:p})=>({symbol:e,shortName:i,file:p})),externalCalleeEvidence:l,candidateExternalCallees:d,inputBasis:"mixed-static-call-or-reference-evidence",score:m,definedIn:n.relativePath,actionTier:"signal",riskKind:"coordination-hotspot",evidenceReasons:[`${c} incoming file(s) reference this symbol`,`${s} distinct cross-file callee symbol(s) are reached from it`,`centrality score is ${m} (fan-in * fan-out)`,`${b.length} incoming file(s) and ${d.length} outgoing target(s) rely on candidate rather than exact call evidence`],recommendation:"Review ownership, API stability, and caller groups before changing this central symbol; do not refactor solely from graph centrality."}}export{h as a,x as b,D as c};
2
- //# sourceMappingURL=chunk-TPO7XC5Z.js.map
1
+ import{b as S}from"./chunk-B75HZHUP.js";import{c as C}from"./chunk-BPKNP3KZ.js";import{a as g}from"./chunk-57OPIQFM.js";import{f as v}from"./chunk-MSI3K7PJ.js";import{d as f}from"./chunk-GVAF222T.js";function h(n,t={}){return x(n,t).rows}function x(n,t={}){let{limit:a=20,scope:r,minFanIn:b=2,minFanOut:u=2,scanLimit:l}=t,c=new C(n),s=S(c.productionCallableDefinitions({scope:r,requireCallableSymbol:!0,includeSuppressed:!0,sortByLocDesc:typeof l=="number"&&l>0}),l),m=t.semantic!==!1,d=v(n,s,{limit:500,semantic:m,semanticEvidence:g}),e=c.calleeEvidenceMap(s,{semantic:m}),i=new Set([...d.incompleteSymbolIds,...e.incompleteSymbolIds]),p=new Set([...d.unavailableSymbolIds,...e.unavailableSymbolIds]);return{rows:s.filter(o=>!i.has(o.symbolId)&&!p.has(o.symbolId)).map(o=>E(o,d.rows.get(o.symbolId)??[],e.rows.get(o.symbolId)??[])).filter(o=>o.fanIn>=b&&o.fanOut>=u).sort((o,y)=>y.score-o.score||y.fanIn-o.fanIn).slice(0,a),coverage:k(m,i,p)}}function D(n,t={}){return h(n,t)}function k(n,t,a){let r=n?t.size>0&&a.size>0?"incomplete-and-unavailable":t.size>0?"incomplete":a.size>0?"unavailable":"complete":"disabled";return{semanticEvidence:{enabled:n,status:r,incompleteSymbolCount:t.size,unavailableSymbolCount:a.size,excludedSymbolCount:new Set([...t,...a]).size}}}function E(n,t,a){let r=[...new Set(t.map(e=>e.file))].sort(),b=[...new Set(t.filter(e=>e.source!=="caller-map-inversion"||e.callEvidence==="scip-chunk").map(e=>e.file))].sort(),u=new Map;for(let e of a.slice(0,500)){if(e.file===n.relativePath)continue;let i=`${e.symbol}|${e.file}`;u.has(i)||u.set(i,{symbol:e.symbol,shortName:f(e.symbol),file:e.file,evidenceStrength:e.source==="scip-chunk"?"candidate":"exact",evidenceSource:e.source})}let l=[...u.values()].sort((e,i)=>e.file.localeCompare(i.file)||e.symbol.localeCompare(i.symbol)),c=r.length,s=l.length,m=c*s,d=l.filter(e=>e.evidenceStrength==="candidate").map(e=>e.symbol);return{symbol:n.symbol,shortName:f(n.symbol),fanIn:c,fanOut:s,callerFiles:r,candidateCallerFiles:b,externalCallees:l.map(({symbol:e,shortName:i,file:p})=>({symbol:e,shortName:i,file:p})),externalCalleeEvidence:l,candidateExternalCallees:d,inputBasis:"mixed-static-call-or-reference-evidence",score:m,definedIn:n.relativePath,actionTier:"signal",riskKind:"coordination-hotspot",evidenceReasons:[`${c} incoming file(s) reference this symbol`,`${s} distinct cross-file callee symbol(s) are reached from it`,`centrality score is ${m} (fan-in * fan-out)`,`${b.length} incoming file(s) and ${d.length} outgoing target(s) rely on candidate rather than exact call evidence`],recommendation:"Review ownership, API stability, and caller groups before changing this central symbol; do not refactor solely from graph centrality."}}export{h as a,x as b,D as c};
2
+ //# sourceMappingURL=chunk-4GWN76B2.js.map
@@ -1,8 +1,8 @@
1
- import{a as D,c as L,i as H,k as O}from"./chunk-FQTIFWLR.js";import{j as T,o as B}from"./chunk-36JC5BG2.js";import{d as A}from"./chunk-NMTSZXCL.js";import{c as _}from"./chunk-HENP2O4A.js";import{d as u,e as F}from"./chunk-GVAF222T.js";import{a as E}from"./chunk-F74LZWCE.js";var J=5;function le(e,n={}){let{base:o="HEAD",minContainment:a=.7,minCallees:l=3,minSiteCoverage:t=.4,maxHelpers:p=Number.POSITIVE_INFINITY,limit:c=20,scanLimit:g}=n,h=n.semantic!==!1,s=n.diffPlan??L(e,{base:o}),r={available:s.note!==D,base:o,changedFiles:s.changedFiles,helpersChecked:0,skipped:[],findings:[],...s.note?{note:s.note}:{}};if(!r.available||s.changedFiles.length===0)return r;let k=new _(e),P=new Set(s.changedFiles),$=new Map(s.renamedFiles.map(i=>[i.to,i.from]));if(n.baseContentAt&&n.baseContentResultAt)throw new Error("Specify only one of baseContentAt or baseContentResultAt.");let z=n.baseContentResultAt?n.baseContentResultAt:n.baseContentAt?Q(n.baseContentAt):H({projectRoot:e.config.projectRoot,base:o,preloadPaths:O(s)}),f=Z(k,P,$,z);if(f.unavailable)return r.available=!1,r.note=`Base content unavailable: ${f.unavailable.reason}`,r;if(f.definitions.length===0)return r;let I=f.definitions.slice(0,p);f.definitions.length>p&&(r.note=`helper scoring capped at ${p} of ${f.definitions.length} new symbols`);let d=k.calleeEvidenceMap(I,{semantic:h}),q=I.filter(i=>!d.incompleteSymbolIds.has(i.symbolId)&&!d.unavailableSymbolIds.has(i.symbolId)).map(i=>({def:i,callees:B((d.rows.get(i.symbolId)??[]).map(m=>m.symbol))}));for(let i of I)!d.incompleteSymbolIds.has(i.symbolId)&&!d.unavailableSymbolIds.has(i.symbolId)||r.skipped.push({helperShortName:u(i.symbol),helperFile:i.relativePath,reason:"compiler-resolved callee evidence is incomplete or unavailable \u2014 unsafe to score"});let V=T(e),M,G=()=>(M??=V.calleeIndex({minCallees:Math.min(3,l),scanLimit:g,semantic:h}),M);for(let{def:i,callees:m}of q){let b=u(i.symbol);if(m.size<l){r.skipped.push({helperShortName:b,helperFile:i.relativePath,reason:`fewer than ${l} meaningful callees \u2014 too small to score`});continue}let w=G(),N=Y(m,w);if(N===0){r.skipped.push({helperShortName:b,helperFile:i.relativePath,reason:"helper callee pattern is all project-wide infrastructure \u2014 too generic to score"});continue}let y=ee(e,i.symbolId);if(y.length===0){r.skipped.push({helperShortName:b,helperFile:i.relativePath,reason:"no references yet \u2014 covered by the new-dead check"});continue}r.helpersChecked+=1;let v=K({candidateIndex:w,changed:P,helperCallees:m,helperFile:i.relativePath,helperSymbol:i.symbol,minContainment:a,minSiteCoverage:t,migratedFiles:y});v.length!==0&&(v.sort((C,S)=>j(S.migrationScope)-j(C.migrationScope)||S.containment-C.containment||S.siteCoverage-C.siteCoverage||C.file.localeCompare(S.file)),r.findings.push({helperSymbol:i.symbol,helperShortName:b,helperFile:i.relativePath,helperShape:"specific-callee-cluster",helperCalleeCount:m.size,specificHelperCalleeCount:N,migratedFiles:y.sort(),leftovers:v.slice(0,J)}))}return r.findings.sort((i,m)=>(m.leftovers[0]?.containment??0)-(i.leftovers[0]?.containment??0)||i.helperFile.localeCompare(m.helperFile)),r.findings=r.findings.slice(0,c),r}function K(e){let n=[],o=U(e.helperSymbol,e.helperFile,e.migratedFiles),a=new Set;for(let l of e.helperCallees)for(let t of e.candidateIndex.candidateIndexesByCallee.get(l)??[])a.add(t);for(let l of a){let t=e.candidateIndex.corpus[l];if(t.symbol===e.helperSymbol||e.changed.has(t.file)||t.callees.has(e.helperSymbol))continue;let p=A(e.helperCallees,t.callees);if(p<e.minContainment)continue;let c=[...e.helperCallees].filter(s=>t.callees.has(s)),g=t.callees.size===0?0:c.length/t.callees.size;if(g<e.minSiteCoverage||!c.some(s=>(e.candidateIndex.docFreq.get(s)??0)<=e.candidateIndex.ubiquityThreshold))continue;let h=W(o,t.symbol,t.file);n.push({symbol:t.symbol,shortName:u(t.symbol),file:t.file,...h,containment:p,siteCoverage:g,uniqueSiteCalleeCount:Math.max(0,t.callees.size-c.length),sharedCallees:c.map(u).sort()})}return n}function j(e){return e==="same-scope"?2:e==="unknown"?1:0}function U(e,n,o){let a=new Set([...R(n),...x(F(e))]);for(let l of o)for(let t of R(l))a.add(t);return a}function W(e,n,o){let a=new Set([...R(o),...x(F(n))]);if(e.size===0||a.size===0)return{migrationScope:"unknown",migrationScopeReasons:["insufficient path/name tokens to infer migration scope"]};let l=[...a].filter(t=>e.has(t)).sort();return l.length>0?{migrationScope:"same-scope",migrationScopeReasons:[`shares migration-scope token(s): ${l.slice(0,5).join(", ")}`]}:{migrationScope:"possible-subtype",migrationScopeReasons:["no path/name tokens shared with the helper or already migrated files"]}}var X=new Set(["app","apps","common","component","components","helper","helpers","index","lib","package","packages","page","pages","route","routes","service","services","shared","spec","src","test","tests","util","utils"]);function R(e){return x(e.replace(/\.[^.]+$/,""))}function x(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1 $2").toLowerCase().split(/[^a-z0-9]+/).filter(n=>n.length>1&&!X.has(n))}function Y(e,n){let o=0;for(let a of e)(n.docFreq.get(a)??0)<=n.ubiquityThreshold&&(o+=1);return o}function Z(e,n,o,a){let l=[];for(let t of e.productionCallableDefinitions({files:[...n],requireFunctionLikeSymbol:!0})){if(!n.has(t.relativePath))continue;let p=o.get(t.relativePath)??t.relativePath,c=a(p);if(c.state==="unavailable")return{definitions:[],unavailable:c};(c.state==="absent"||!new RegExp(`\\b${E(t.leaf)}\\b`).test(c.content))&&l.push(t)}return{definitions:l}}function Q(e){return n=>{let o=e(n);return o===null?{state:"absent"}:{state:"present",content:o}}}function ee(e,n){return e.all(`SELECT DISTINCT ref_d.relative_path
1
+ import{a as D,c as L,i as H,k as O}from"./chunk-EHPOTEQX.js";import{j as T,o as B}from"./chunk-SUE7SHZL.js";import{d as A}from"./chunk-NMTSZXCL.js";import{c as _}from"./chunk-BPKNP3KZ.js";import{d as u,e as F}from"./chunk-GVAF222T.js";import{a as E}from"./chunk-F74LZWCE.js";var J=5;function le(e,n={}){let{base:o="HEAD",minContainment:a=.7,minCallees:l=3,minSiteCoverage:t=.4,maxHelpers:p=Number.POSITIVE_INFINITY,limit:c=20,scanLimit:g}=n,h=n.semantic!==!1,s=n.diffPlan??L(e,{base:o}),r={available:s.note!==D,base:o,changedFiles:s.changedFiles,helpersChecked:0,skipped:[],findings:[],...s.note?{note:s.note}:{}};if(!r.available||s.changedFiles.length===0)return r;let k=new _(e),P=new Set(s.changedFiles),$=new Map(s.renamedFiles.map(i=>[i.to,i.from]));if(n.baseContentAt&&n.baseContentResultAt)throw new Error("Specify only one of baseContentAt or baseContentResultAt.");let z=n.baseContentResultAt?n.baseContentResultAt:n.baseContentAt?Q(n.baseContentAt):H({projectRoot:e.config.projectRoot,base:o,preloadPaths:O(s)}),f=Z(k,P,$,z);if(f.unavailable)return r.available=!1,r.note=`Base content unavailable: ${f.unavailable.reason}`,r;if(f.definitions.length===0)return r;let I=f.definitions.slice(0,p);f.definitions.length>p&&(r.note=`helper scoring capped at ${p} of ${f.definitions.length} new symbols`);let d=k.calleeEvidenceMap(I,{semantic:h}),q=I.filter(i=>!d.incompleteSymbolIds.has(i.symbolId)&&!d.unavailableSymbolIds.has(i.symbolId)).map(i=>({def:i,callees:B((d.rows.get(i.symbolId)??[]).map(m=>m.symbol))}));for(let i of I)!d.incompleteSymbolIds.has(i.symbolId)&&!d.unavailableSymbolIds.has(i.symbolId)||r.skipped.push({helperShortName:u(i.symbol),helperFile:i.relativePath,reason:"compiler-resolved callee evidence is incomplete or unavailable \u2014 unsafe to score"});let V=T(e),M,G=()=>(M??=V.calleeIndex({minCallees:Math.min(3,l),scanLimit:g,semantic:h}),M);for(let{def:i,callees:m}of q){let b=u(i.symbol);if(m.size<l){r.skipped.push({helperShortName:b,helperFile:i.relativePath,reason:`fewer than ${l} meaningful callees \u2014 too small to score`});continue}let w=G(),N=Y(m,w);if(N===0){r.skipped.push({helperShortName:b,helperFile:i.relativePath,reason:"helper callee pattern is all project-wide infrastructure \u2014 too generic to score"});continue}let y=ee(e,i.symbolId);if(y.length===0){r.skipped.push({helperShortName:b,helperFile:i.relativePath,reason:"no references yet \u2014 covered by the new-dead check"});continue}r.helpersChecked+=1;let v=K({candidateIndex:w,changed:P,helperCallees:m,helperFile:i.relativePath,helperSymbol:i.symbol,minContainment:a,minSiteCoverage:t,migratedFiles:y});v.length!==0&&(v.sort((C,S)=>j(S.migrationScope)-j(C.migrationScope)||S.containment-C.containment||S.siteCoverage-C.siteCoverage||C.file.localeCompare(S.file)),r.findings.push({helperSymbol:i.symbol,helperShortName:b,helperFile:i.relativePath,helperShape:"specific-callee-cluster",helperCalleeCount:m.size,specificHelperCalleeCount:N,migratedFiles:y.sort(),leftovers:v.slice(0,J)}))}return r.findings.sort((i,m)=>(m.leftovers[0]?.containment??0)-(i.leftovers[0]?.containment??0)||i.helperFile.localeCompare(m.helperFile)),r.findings=r.findings.slice(0,c),r}function K(e){let n=[],o=U(e.helperSymbol,e.helperFile,e.migratedFiles),a=new Set;for(let l of e.helperCallees)for(let t of e.candidateIndex.candidateIndexesByCallee.get(l)??[])a.add(t);for(let l of a){let t=e.candidateIndex.corpus[l];if(t.symbol===e.helperSymbol||e.changed.has(t.file)||t.callees.has(e.helperSymbol))continue;let p=A(e.helperCallees,t.callees);if(p<e.minContainment)continue;let c=[...e.helperCallees].filter(s=>t.callees.has(s)),g=t.callees.size===0?0:c.length/t.callees.size;if(g<e.minSiteCoverage||!c.some(s=>(e.candidateIndex.docFreq.get(s)??0)<=e.candidateIndex.ubiquityThreshold))continue;let h=W(o,t.symbol,t.file);n.push({symbol:t.symbol,shortName:u(t.symbol),file:t.file,...h,containment:p,siteCoverage:g,uniqueSiteCalleeCount:Math.max(0,t.callees.size-c.length),sharedCallees:c.map(u).sort()})}return n}function j(e){return e==="same-scope"?2:e==="unknown"?1:0}function U(e,n,o){let a=new Set([...R(n),...x(F(e))]);for(let l of o)for(let t of R(l))a.add(t);return a}function W(e,n,o){let a=new Set([...R(o),...x(F(n))]);if(e.size===0||a.size===0)return{migrationScope:"unknown",migrationScopeReasons:["insufficient path/name tokens to infer migration scope"]};let l=[...a].filter(t=>e.has(t)).sort();return l.length>0?{migrationScope:"same-scope",migrationScopeReasons:[`shares migration-scope token(s): ${l.slice(0,5).join(", ")}`]}:{migrationScope:"possible-subtype",migrationScopeReasons:["no path/name tokens shared with the helper or already migrated files"]}}var X=new Set(["app","apps","common","component","components","helper","helpers","index","lib","package","packages","page","pages","route","routes","service","services","shared","spec","src","test","tests","util","utils"]);function R(e){return x(e.replace(/\.[^.]+$/,""))}function x(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1 $2").toLowerCase().split(/[^a-z0-9]+/).filter(n=>n.length>1&&!X.has(n))}function Y(e,n){let o=0;for(let a of e)(n.docFreq.get(a)??0)<=n.ubiquityThreshold&&(o+=1);return o}function Z(e,n,o,a){let l=[];for(let t of e.productionCallableDefinitions({files:[...n],requireFunctionLikeSymbol:!0})){if(!n.has(t.relativePath))continue;let p=o.get(t.relativePath)??t.relativePath,c=a(p);if(c.state==="unavailable")return{definitions:[],unavailable:c};(c.state==="absent"||!new RegExp(`\\b${E(t.leaf)}\\b`).test(c.content))&&l.push(t)}return{definitions:l}}function Q(e){return n=>{let o=e(n);return o===null?{state:"absent"}:{state:"present",content:o}}}function ee(e,n){return e.all(`SELECT DISTINCT ref_d.relative_path
2
2
  FROM mentions m
3
3
  JOIN chunks c ON m.chunk_id = c.id
4
4
  JOIN documents ref_d ON c.document_id = ref_d.id
5
5
  WHERE m.symbol_id = ?
6
6
  AND m.role != 1
7
7
  ${e.pathExclusionsFor("ref_d")}`,n).map(a=>a.relative_path)}export{le as a};
8
- //# sourceMappingURL=chunk-GL6UTNUB.js.map
8
+ //# sourceMappingURL=chunk-53ELMZRF.js.map
@@ -1,2 +1,2 @@
1
- import{a as O,b as T,c as y,f as I,g as G,i as $,l as Y,m as q,n as K}from"./chunk-J3GLP7Q5.js";import{Y as _}from"./chunk-SMDIEDM4.js";import{a as N}from"./chunk-GV2CEZCW.js";import{g as U,k as P,l as h,n as z,p as E,w as g}from"./chunk-7GAK2F3H.js";import{a as J,d as f}from"./chunk-3LCDIREB.js";var ue={references:$,referenceMap:Y,referenceEvidenceMap:q,callerMap:(e,i)=>I(e).callerMap(i),calleeMap:X,calleeEvidenceMap:Q};function X(e,i,r={}){return Q(e,i,r).rows}function Q(e,i,r={}){let a=J(),o=new Map,l=G(e,i),n=[],c=[],m=0,p=0,d=0,w=0,R=0,H=0,k=0,S=new Set,v=new Set;for(let{definition:t,callees:s}of l.hits)R+=1,o.set(t.symbolId,s),s.length>0&&(H+=1,k+=s.length);let u=Z(e,l.hits);if(u.entries.length>0&&f("semantic.callees.prefetch-cache-write",()=>E(e,u.entries),()=>({entries:u.entries.length,sourceMissing:u.sourceMissing,skippedUnsupportedLanguage:u.skippedUnsupportedLanguage})),f("semantic.callees.cache-scan",()=>{for(let[t,s]of O(l.misses)){if(!y(t)){a&&(m+=s.length);continue}let j=g(e,t);if(!j){a&&(p+=s.length),c.push(...s);continue}let A=h(e,t,j),D=V(e,t);if(!D){c.push(...s);continue}let W=z(e,t,A,D);for(let M of s){let L=W.get(M.symbol)??null;if(L!==null){let B=te(L);if(B){a&&(d+=1),o.set(M.symbolId,B);continue}a&&(w+=1)}n.push({def:M,contentHash:A,depsDigest:D})}}},()=>({definitions:i.length,skippedUnsupportedLanguage:m,sourceMissing:p,cacheHits:d,parseFailures:w,misses:n.length,unkeyed:c.length,inMemoryHits:R,inMemoryRows:H,inMemoryCalleeCount:k,resultRows:o.size})),n.length===0&&c.length===0)return{rows:o,incompleteSymbolIds:S,unavailableSymbolIds:v};let x=[...c,...n.map(t=>t.def)],F=0,C=f("semantic.callees.compute-misses",()=>{let t=K(e,x,r.resolveProvider);for(let s of t.incompleteSymbolIds)S.add(s);for(let s of t.unavailableSymbolIds)v.add(s);return F=t.rows.size,t.rows},()=>({definitions:x.length,misses:n.length,unkeyed:c.length,rows:F}));for(let[t,s]of C)o.set(t,s);let b=n.filter(t=>C.has(t.def.symbolId)&&I(e).capability("semantic-callees",t.def.relativePath).available).map(t=>({relativePath:t.def.relativePath,symbol:t.def.symbol,contentHash:t.contentHash,depsDigest:t.depsDigest,payload:JSON.stringify(C.get(t.def.symbolId)??[])}));return b.length>0?f("semantic.callees.cache-write",()=>E(e,b),()=>({entries:b.length})):f("semantic.callees.cache-write-skip",()=>{},()=>({reason:"provider-unavailable",misses:n.length})),{rows:o,incompleteSymbolIds:S,unavailableSymbolIds:v}}function Z(e,i){let r=[],a=new Map,o=0,l=0;for(let{definition:n,callees:c}of i){if(!y(n.relativePath)){l+=1;continue}if(!a.has(n.relativePath)){let p=g(e,n.relativePath),d=p?V(e,n.relativePath):null;a.set(n.relativePath,p&&d?{contentHash:h(e,n.relativePath,p),depsDigest:d}:null)}let m=a.get(n.relativePath);if(!m){o+=1;continue}r.push({relativePath:n.relativePath,symbol:n.symbol,contentHash:m.contentHash,depsDigest:m.depsDigest,payload:JSON.stringify(c)})}return{entries:r,sourceMissing:o,skippedUnsupportedLanguage:l}}var ee="typescript-callees-v3-incomplete-scan";function V(e,i){let r=y(i);if(r==="typescript")return _(e,i,ee)?.key??null;let a=ie(e,i);return r==="rust"?P(JSON.stringify({kind:"semantic-callees",language:r,engine:T(e.config.projectRoot),positionMapping:"nearby-leaf-v2-callsite-line",depsDigest:a})):a}function te(e){try{return JSON.parse(e)}catch{return null}}var ne=U("semantic-deps-digest",{clearGroups:["whole-project","source-file"]});function ie(e,i){return ne.get(e,i,()=>{let a=[...N(e).get(i)??[]].sort().map(o=>`${o}:${h(e,o,g(e,o))}`);return P(a.join("|"))})}export{ue as a};
2
- //# sourceMappingURL=chunk-6VREELBC.js.map
1
+ import{a as O,b as T,c as y,f as I,g as G,i as $,l as Y,m as q,n as K}from"./chunk-KLX6NSWT.js";import{Y as _}from"./chunk-G7GVV2TV.js";import{a as N}from"./chunk-GV2CEZCW.js";import{g as U,k as P,l as h,n as z,p as E,w as g}from"./chunk-7GAK2F3H.js";import{a as J,d as f}from"./chunk-3LCDIREB.js";var ue={references:$,referenceMap:Y,referenceEvidenceMap:q,callerMap:(e,i)=>I(e).callerMap(i),calleeMap:X,calleeEvidenceMap:Q};function X(e,i,r={}){return Q(e,i,r).rows}function Q(e,i,r={}){let a=J(),o=new Map,l=G(e,i),n=[],c=[],m=0,p=0,d=0,w=0,R=0,H=0,k=0,S=new Set,v=new Set;for(let{definition:t,callees:s}of l.hits)R+=1,o.set(t.symbolId,s),s.length>0&&(H+=1,k+=s.length);let u=Z(e,l.hits);if(u.entries.length>0&&f("semantic.callees.prefetch-cache-write",()=>E(e,u.entries),()=>({entries:u.entries.length,sourceMissing:u.sourceMissing,skippedUnsupportedLanguage:u.skippedUnsupportedLanguage})),f("semantic.callees.cache-scan",()=>{for(let[t,s]of O(l.misses)){if(!y(t)){a&&(m+=s.length);continue}let j=g(e,t);if(!j){a&&(p+=s.length),c.push(...s);continue}let A=h(e,t,j),D=V(e,t);if(!D){c.push(...s);continue}let W=z(e,t,A,D);for(let M of s){let L=W.get(M.symbol)??null;if(L!==null){let B=te(L);if(B){a&&(d+=1),o.set(M.symbolId,B);continue}a&&(w+=1)}n.push({def:M,contentHash:A,depsDigest:D})}}},()=>({definitions:i.length,skippedUnsupportedLanguage:m,sourceMissing:p,cacheHits:d,parseFailures:w,misses:n.length,unkeyed:c.length,inMemoryHits:R,inMemoryRows:H,inMemoryCalleeCount:k,resultRows:o.size})),n.length===0&&c.length===0)return{rows:o,incompleteSymbolIds:S,unavailableSymbolIds:v};let x=[...c,...n.map(t=>t.def)],F=0,C=f("semantic.callees.compute-misses",()=>{let t=K(e,x,r.resolveProvider);for(let s of t.incompleteSymbolIds)S.add(s);for(let s of t.unavailableSymbolIds)v.add(s);return F=t.rows.size,t.rows},()=>({definitions:x.length,misses:n.length,unkeyed:c.length,rows:F}));for(let[t,s]of C)o.set(t,s);let b=n.filter(t=>C.has(t.def.symbolId)&&I(e).capability("semantic-callees",t.def.relativePath).available).map(t=>({relativePath:t.def.relativePath,symbol:t.def.symbol,contentHash:t.contentHash,depsDigest:t.depsDigest,payload:JSON.stringify(C.get(t.def.symbolId)??[])}));return b.length>0?f("semantic.callees.cache-write",()=>E(e,b),()=>({entries:b.length})):f("semantic.callees.cache-write-skip",()=>{},()=>({reason:"provider-unavailable",misses:n.length})),{rows:o,incompleteSymbolIds:S,unavailableSymbolIds:v}}function Z(e,i){let r=[],a=new Map,o=0,l=0;for(let{definition:n,callees:c}of i){if(!y(n.relativePath)){l+=1;continue}if(!a.has(n.relativePath)){let p=g(e,n.relativePath),d=p?V(e,n.relativePath):null;a.set(n.relativePath,p&&d?{contentHash:h(e,n.relativePath,p),depsDigest:d}:null)}let m=a.get(n.relativePath);if(!m){o+=1;continue}r.push({relativePath:n.relativePath,symbol:n.symbol,contentHash:m.contentHash,depsDigest:m.depsDigest,payload:JSON.stringify(c)})}return{entries:r,sourceMissing:o,skippedUnsupportedLanguage:l}}var ee="typescript-callees-v3-incomplete-scan";function V(e,i){let r=y(i);if(r==="typescript")return _(e,i,ee)?.key??null;let a=ie(e,i);return r==="rust"?P(JSON.stringify({kind:"semantic-callees",language:r,engine:T(e.config.projectRoot),positionMapping:"nearby-leaf-v2-callsite-line",depsDigest:a})):a}function te(e){try{return JSON.parse(e)}catch{return null}}var ne=U("semantic-deps-digest",{clearGroups:["whole-project","source-file"]});function ie(e,i){return ne.get(e,i,()=>{let a=[...N(e).get(i)??[]].sort().map(o=>`${o}:${h(e,o,g(e,o))}`);return P(a.join("|"))})}export{ue as a};
2
+ //# sourceMappingURL=chunk-57OPIQFM.js.map
@@ -1,4 +1,4 @@
1
- import{a as u}from"./chunk-6VREELBC.js";import{f as d}from"./chunk-MSI3K7PJ.js";import{d as r,u as a}from"./chunk-GVAF222T.js";function b(e,i={}){return f(e,i).rows}function f(e,i={}){let{limit:l=30,scope:t}=i,n=t?"AND def_d.relative_path LIKE ?":"",c=t?[`%${t}%`]:[],o=e.all(`SELECT
1
+ import{a as u}from"./chunk-57OPIQFM.js";import{f as d}from"./chunk-MSI3K7PJ.js";import{d as r,u as a}from"./chunk-GVAF222T.js";function b(e,i={}){return f(e,i).rows}function f(e,i={}){let{limit:l=30,scope:t}=i,n=t?"AND def_d.relative_path LIKE ?":"",c=t?[`%${t}%`]:[],o=e.all(`SELECT
2
2
  gs.symbol,
3
3
  COUNT(*) AS ref_count,
4
4
  COUNT(DISTINCT ref_d.id) AS file_count,
@@ -23,4 +23,4 @@ import{a as u}from"./chunk-6VREELBC.js";import{f as d}from"./chunk-MSI3K7PJ.js";
23
23
  GROUP BY gs.id
24
24
  ORDER BY ref_count DESC
25
25
  LIMIT ?`,...c,l).filter(s=>!e.isIgnored(s.defined_in)).map(s=>({symbol:s.symbol,shortName:r(s.symbol),refCount:s.ref_count,fileCount:s.file_count,definedIn:s.defined_in,basis:"scip-cross-file-mentions",countUnit:"reference-occurrences"}));return o.length>0?{rows:o,coverage:{semanticEvidence:{enabled:!1,status:"disabled",incompleteSymbolCount:0,unavailableSymbolCount:0}}}:p(e,t,l)}function I(e,i={}){return b(e,i)}function p(e,i,l){let t=a(e,{scope:i}).filter(o=>!e.isIgnored(o.relativePath)),n=d(e,t,{limit:500,semanticEvidence:u}),c=t.filter(o=>!n.incompleteSymbolIds.has(o.symbolId)&&!n.unavailableSymbolIds.has(o.symbolId)).map(o=>y(o,n.rows.get(o.symbolId)??[])).filter(o=>o.refCount>0).sort((o,s)=>s.refCount-o.refCount||s.fileCount-o.fileCount).slice(0,l),m=n.incompleteSymbolIds.size>0&&n.unavailableSymbolIds.size>0?"incomplete-and-unavailable":n.incompleteSymbolIds.size>0?"incomplete":n.unavailableSymbolIds.size>0?"unavailable":"complete";return{rows:c,coverage:{semanticEvidence:{enabled:!0,status:m,incompleteSymbolCount:n.incompleteSymbolIds.size,unavailableSymbolCount:n.unavailableSymbolIds.size}}}}function y(e,i){let l=i.filter(t=>t.file!==e.relativePath);return{symbol:e.symbol,shortName:r(e.symbol),refCount:l.length,fileCount:new Set(l.map(t=>t.file)).size,definedIn:e.relativePath,basis:"source-backed-incoming-evidence",countUnit:"distinct-incoming-evidence-rows"}}export{b as a,f as b,I as c};
26
- //# sourceMappingURL=chunk-JSNTHRLQ.js.map
26
+ //# sourceMappingURL=chunk-5CR4U5X2.js.map
@@ -1,2 +1,2 @@
1
- import{a as R}from"./chunk-MZNMASFM.js";import{a as D}from"./chunk-WWCV4E6J.js";import{a as g}from"./chunk-KPZGTB2O.js";import{a as F}from"./chunk-WK2IQJPK.js";import{a as y}from"./chunk-CCIYWXX6.js";import{e as f}from"./chunk-36JC5BG2.js";import{j as d}from"./chunk-GVAF222T.js";import{L as h}from"./chunk-ICUL7XRT.js";var A=.7,S=.62,C=.45;function J(i,t={}){let{windowCommits:e=100,limit:n=30,scope:a,scanLimit:o}=t,s=y(i,{historyMode:t.historyMode}).fileAddRecords();if(!s)return{available:!1,windowCommits:e,findings:[]};if(n<=0)return{available:!0,windowCommits:e,findings:[]};let r=P(s,e);if(r.size===0)return{available:!0,windowCommits:e,findings:[]};let b=B(i,{limit:n,minSimilarity:t.minSimilarity,scanLimit:o,scope:a,semantic:t.semantic,focusFiles:Number.isFinite(n)?void 0:r}).map(l=>O(l,s,e)).filter(l=>l!==null);b.sort((l,c)=>(l.kind===c.kind?0:l.kind==="echo"?-1:1)||c.similarity-l.similarity||l.echoFile.localeCompare(c.echoFile)||l.echoSymbol.localeCompare(c.echoSymbol)||l.domain.localeCompare(c.domain));let p=b.slice(0,n).map(M);return{available:!0,windowCommits:e,findings:p,rootCauseGroups:N(p)}}function B(i,t){let e=K(t.limit),n=[...k(i,{scope:t.scope,minSimilarity:t.minSimilarity??A,limit:e,scanLimit:t.scanLimit,semantic:t.semantic,focusFiles:t.focusFiles})],a=h(i,{scope:t.scope});return a.react&&n.push(...E(i,{scope:t.scope,minSimilarity:t.minSimilarity??S,limit:e,scanLimit:t.scanLimit,focusFiles:t.focusFiles}),...L(i,{scope:t.scope,minSimilarity:t.minSimilarity??C,limit:e,scanLimit:t.scanLimit,focusFiles:t.focusFiles})),a.vue&&n.push(...x(i,{scope:t.scope,minSimilarity:t.minSimilarity??S,limit:e,scanLimit:t.scanLimit,focusFiles:t.focusFiles}),...T(i,{scope:t.scope,minSimilarity:t.minSimilarity??C,limit:e,scanLimit:t.scanLimit,focusFiles:t.focusFiles})),n}function k(i,t){return f(i,{scope:t.scope,minSimilarity:t.minSimilarity,limit:t.limit,crossFileOnly:!0,scanLimit:t.scanLimit,semantic:t.semantic,focusFiles:t.focusFiles}).filter(e=>!d(e.symbolA)&&!d(e.symbolB)).map(e=>({domain:"callable",basis:e.similarityBasis??"callees",symbolA:e.shortNameA,fileA:e.fileA,symbolB:e.shortNameB,fileB:e.fileB,similarity:e.similarity,sharedEvidence:e.sharedCallees,sharedCallees:e.sharedCallees}))}function E(i,t){return u(i,t,{query:g,domain:"react-component",basis:"jsx-structure",symbolA:e=>e.componentA,symbolB:e=>e.componentB,evidenceBuckets:e=>[["component",e.sharedComponents],["tag",e.sharedNativeTags],["prop",e.sharedProps],["event",e.sharedEvents],["binding",e.sharedBindings]]})}function u(i,t,e){return e.query(i,t).filter(n=>n.fileA!==n.fileB).filter(n=>e.acceptPair?.(n)??!0).map(n=>({domain:e.domain,basis:e.basis,symbolA:e.symbolA(n),fileA:n.fileA,symbolB:e.symbolB(n),fileB:n.fileB,similarity:n.similarity,sharedEvidence:G(...e.evidenceBuckets(n)),sharedCallees:[]}))}function L(i,t){return u(i,t,{query:F,domain:"react-hook",basis:"react-behavior",symbolA:e=>e.componentA,symbolB:e=>e.componentB,acceptPair:w,evidenceBuckets:e=>[["hook",e.sharedHooks],["react-hook",e.sharedReactHooks],["effect",e.sharedEffects],["state",e.sharedState],["request",e.sharedRequests],["handler",e.sharedHandlers],["action",e.sharedHandlerVerbs]]})}var I=new Set(["useCallback","useEffect","useLayoutEffect","useMemo","useMutation","useQueries","useQuery","useQueryClient","useReducer","useRef","useState"]);function w(i){return i.sharedHooks.some(t=>!I.has(t))||i.sharedState.length>0||i.sharedHandlers.length>0||i.sharedHandlerVerbs.length>=2}function x(i,t){return u(i,t,{query:D,domain:"vue-component",basis:"vue-template",symbolA:e=>m(e.fileA),symbolB:e=>m(e.fileB),evidenceBuckets:e=>[["component",e.sharedComponents],["prop",e.sharedProps],["event",e.sharedEvents],["directive",e.sharedDirectives],["slot",e.sharedSlots],["identifier",e.sharedIdentifiers]]})}function T(i,t){return u(i,t,{query:R,domain:"vue-composable",basis:"vue-behavior",symbolA:e=>m(e.fileA),symbolB:e=>m(e.fileB),evidenceBuckets:e=>[["composable",e.sharedComposables],["store",e.sharedStores],["reactivity",e.sharedReactivity],["lifecycle",e.sharedLifecycle],["request",e.sharedRequests],["function",e.sharedFunctions],["action",e.sharedFunctionVerbs],["binding",e.sharedBindings],["template-event",e.sharedTemplateEvents]]})}function P(i,t){let e=new Set;for(let[n,a]of i)a.commitsAgo<=t&&e.add(n);return e}function O(i,t,e){let n=t.get(i.fileA)?.commitsAgo??null,a=t.get(i.fileB)?.commitsAgo??null,o=n!==null&&n<=e,s=a!==null&&a<=e;if(!o&&!s)return null;if(o&&s){let r=(n??0)<=(a??0);return{kind:"twin",domain:i.domain,basis:i.basis,echoSymbol:r?i.symbolA:i.symbolB,echoFile:r?i.fileA:i.fileB,echoAgeCommits:(r?n:a)??0,establishedSymbol:r?i.symbolB:i.symbolA,establishedFile:r?i.fileB:i.fileA,establishedAgeCommits:r?a:n,similarity:i.similarity,sharedEvidence:i.sharedEvidence,sharedCallees:i.sharedCallees}}return{kind:"echo",domain:i.domain,basis:i.basis,echoSymbol:o?i.symbolA:i.symbolB,echoFile:o?i.fileA:i.fileB,echoAgeCommits:(o?n:a)??0,establishedSymbol:o?i.symbolB:i.symbolA,establishedFile:o?i.fileB:i.fileA,establishedAgeCommits:o?a:n,similarity:i.similarity,sharedEvidence:i.sharedEvidence,sharedCallees:i.sharedCallees}}function M(i){let t=v(i);return{...i,rootCauseKey:t,groupKey:`recent-duplicate:${t}`}}function v(i){if(i.kind==="echo")return["echo",i.domain,i.basis,i.establishedSymbol].join(":");let t=i.sharedEvidence.slice().sort().join("|"),e=[i.echoSymbol,i.establishedSymbol].sort().join("|");return["twin",i.domain,i.basis,t||e].join(":")}function N(i){let t=new Map;for(let[e,n]of i.entries()){let a=n.rootCauseKey??v(n),o=n.groupKey??`recent-duplicate:${a}`,s=t.get(o);s||(s={groupKey:o,rootCauseKey:a,kind:n.kind,domain:n.domain,basis:n.basis,count:0,maxSimilarity:n.similarity,findingIndexes:[],echoFiles:new Set,establishedFile:n.kind==="echo"?n.establishedFile:void 0,establishedSymbol:n.kind==="echo"?n.establishedSymbol:void 0,relatedFiles:new Set,sharedEvidence:new Set,recommendation:H(n)},t.set(o,s)),s.count+=1,s.maxSimilarity=Math.max(s.maxSimilarity,n.similarity),s.findingIndexes.push(e),s.echoFiles.add(n.echoFile),s.relatedFiles.add(n.echoFile),s.relatedFiles.add(n.establishedFile);for(let r of n.sharedEvidence)s.sharedEvidence.add(r)}return[...t.values()].map(e=>({...e,echoFiles:[...e.echoFiles].sort(),relatedFiles:[...e.relatedFiles].sort(),sharedEvidence:[...e.sharedEvidence].sort().slice(0,16)})).sort((e,n)=>n.count-e.count||n.maxSimilarity-e.maxSimilarity||e.groupKey.localeCompare(n.groupKey))}function H(i){return i.kind==="echo"?"Review the established side once, then migrate or delete every echo in this group.":"Pick one owner for the new twins and consolidate the group before the copies diverge."}function K(i){return Number.isFinite(i)?i*5:Number.POSITIVE_INFINITY}function G(...i){let t=[],e=new Set;for(let[n,a]of i)for(let o of a){let s=`${n}:${o}`;e.has(s)||(e.add(s),t.push(s))}return t}function m(i){return(i.split("/").pop()??i).replace(/\.[^.]+$/,"")}export{J as a};
2
- //# sourceMappingURL=chunk-GUFPEFBG.js.map
1
+ import{a as R}from"./chunk-MZNMASFM.js";import{a as D}from"./chunk-WWCV4E6J.js";import{a as g}from"./chunk-KPZGTB2O.js";import{a as F}from"./chunk-WK2IQJPK.js";import{a as y}from"./chunk-CCIYWXX6.js";import{e as f}from"./chunk-SUE7SHZL.js";import{j as d}from"./chunk-GVAF222T.js";import{L as h}from"./chunk-ICUL7XRT.js";var A=.7,S=.62,C=.45;function J(i,t={}){let{windowCommits:e=100,limit:n=30,scope:a,scanLimit:o}=t,s=y(i,{historyMode:t.historyMode}).fileAddRecords();if(!s)return{available:!1,windowCommits:e,findings:[]};if(n<=0)return{available:!0,windowCommits:e,findings:[]};let r=P(s,e);if(r.size===0)return{available:!0,windowCommits:e,findings:[]};let b=B(i,{limit:n,minSimilarity:t.minSimilarity,scanLimit:o,scope:a,semantic:t.semantic,focusFiles:Number.isFinite(n)?void 0:r}).map(l=>O(l,s,e)).filter(l=>l!==null);b.sort((l,c)=>(l.kind===c.kind?0:l.kind==="echo"?-1:1)||c.similarity-l.similarity||l.echoFile.localeCompare(c.echoFile)||l.echoSymbol.localeCompare(c.echoSymbol)||l.domain.localeCompare(c.domain));let p=b.slice(0,n).map(M);return{available:!0,windowCommits:e,findings:p,rootCauseGroups:N(p)}}function B(i,t){let e=K(t.limit),n=[...k(i,{scope:t.scope,minSimilarity:t.minSimilarity??A,limit:e,scanLimit:t.scanLimit,semantic:t.semantic,focusFiles:t.focusFiles})],a=h(i,{scope:t.scope});return a.react&&n.push(...E(i,{scope:t.scope,minSimilarity:t.minSimilarity??S,limit:e,scanLimit:t.scanLimit,focusFiles:t.focusFiles}),...L(i,{scope:t.scope,minSimilarity:t.minSimilarity??C,limit:e,scanLimit:t.scanLimit,focusFiles:t.focusFiles})),a.vue&&n.push(...x(i,{scope:t.scope,minSimilarity:t.minSimilarity??S,limit:e,scanLimit:t.scanLimit,focusFiles:t.focusFiles}),...T(i,{scope:t.scope,minSimilarity:t.minSimilarity??C,limit:e,scanLimit:t.scanLimit,focusFiles:t.focusFiles})),n}function k(i,t){return f(i,{scope:t.scope,minSimilarity:t.minSimilarity,limit:t.limit,crossFileOnly:!0,scanLimit:t.scanLimit,semantic:t.semantic,focusFiles:t.focusFiles}).filter(e=>!d(e.symbolA)&&!d(e.symbolB)).map(e=>({domain:"callable",basis:e.similarityBasis??"callees",symbolA:e.shortNameA,fileA:e.fileA,symbolB:e.shortNameB,fileB:e.fileB,similarity:e.similarity,sharedEvidence:e.sharedCallees,sharedCallees:e.sharedCallees}))}function E(i,t){return u(i,t,{query:g,domain:"react-component",basis:"jsx-structure",symbolA:e=>e.componentA,symbolB:e=>e.componentB,evidenceBuckets:e=>[["component",e.sharedComponents],["tag",e.sharedNativeTags],["prop",e.sharedProps],["event",e.sharedEvents],["binding",e.sharedBindings]]})}function u(i,t,e){return e.query(i,t).filter(n=>n.fileA!==n.fileB).filter(n=>e.acceptPair?.(n)??!0).map(n=>({domain:e.domain,basis:e.basis,symbolA:e.symbolA(n),fileA:n.fileA,symbolB:e.symbolB(n),fileB:n.fileB,similarity:n.similarity,sharedEvidence:G(...e.evidenceBuckets(n)),sharedCallees:[]}))}function L(i,t){return u(i,t,{query:F,domain:"react-hook",basis:"react-behavior",symbolA:e=>e.componentA,symbolB:e=>e.componentB,acceptPair:w,evidenceBuckets:e=>[["hook",e.sharedHooks],["react-hook",e.sharedReactHooks],["effect",e.sharedEffects],["state",e.sharedState],["request",e.sharedRequests],["handler",e.sharedHandlers],["action",e.sharedHandlerVerbs]]})}var I=new Set(["useCallback","useEffect","useLayoutEffect","useMemo","useMutation","useQueries","useQuery","useQueryClient","useReducer","useRef","useState"]);function w(i){return i.sharedHooks.some(t=>!I.has(t))||i.sharedState.length>0||i.sharedHandlers.length>0||i.sharedHandlerVerbs.length>=2}function x(i,t){return u(i,t,{query:D,domain:"vue-component",basis:"vue-template",symbolA:e=>m(e.fileA),symbolB:e=>m(e.fileB),evidenceBuckets:e=>[["component",e.sharedComponents],["prop",e.sharedProps],["event",e.sharedEvents],["directive",e.sharedDirectives],["slot",e.sharedSlots],["identifier",e.sharedIdentifiers]]})}function T(i,t){return u(i,t,{query:R,domain:"vue-composable",basis:"vue-behavior",symbolA:e=>m(e.fileA),symbolB:e=>m(e.fileB),evidenceBuckets:e=>[["composable",e.sharedComposables],["store",e.sharedStores],["reactivity",e.sharedReactivity],["lifecycle",e.sharedLifecycle],["request",e.sharedRequests],["function",e.sharedFunctions],["action",e.sharedFunctionVerbs],["binding",e.sharedBindings],["template-event",e.sharedTemplateEvents]]})}function P(i,t){let e=new Set;for(let[n,a]of i)a.commitsAgo<=t&&e.add(n);return e}function O(i,t,e){let n=t.get(i.fileA)?.commitsAgo??null,a=t.get(i.fileB)?.commitsAgo??null,o=n!==null&&n<=e,s=a!==null&&a<=e;if(!o&&!s)return null;if(o&&s){let r=(n??0)<=(a??0);return{kind:"twin",domain:i.domain,basis:i.basis,echoSymbol:r?i.symbolA:i.symbolB,echoFile:r?i.fileA:i.fileB,echoAgeCommits:(r?n:a)??0,establishedSymbol:r?i.symbolB:i.symbolA,establishedFile:r?i.fileB:i.fileA,establishedAgeCommits:r?a:n,similarity:i.similarity,sharedEvidence:i.sharedEvidence,sharedCallees:i.sharedCallees}}return{kind:"echo",domain:i.domain,basis:i.basis,echoSymbol:o?i.symbolA:i.symbolB,echoFile:o?i.fileA:i.fileB,echoAgeCommits:(o?n:a)??0,establishedSymbol:o?i.symbolB:i.symbolA,establishedFile:o?i.fileB:i.fileA,establishedAgeCommits:o?a:n,similarity:i.similarity,sharedEvidence:i.sharedEvidence,sharedCallees:i.sharedCallees}}function M(i){let t=v(i);return{...i,rootCauseKey:t,groupKey:`recent-duplicate:${t}`}}function v(i){if(i.kind==="echo")return["echo",i.domain,i.basis,i.establishedSymbol].join(":");let t=i.sharedEvidence.slice().sort().join("|"),e=[i.echoSymbol,i.establishedSymbol].sort().join("|");return["twin",i.domain,i.basis,t||e].join(":")}function N(i){let t=new Map;for(let[e,n]of i.entries()){let a=n.rootCauseKey??v(n),o=n.groupKey??`recent-duplicate:${a}`,s=t.get(o);s||(s={groupKey:o,rootCauseKey:a,kind:n.kind,domain:n.domain,basis:n.basis,count:0,maxSimilarity:n.similarity,findingIndexes:[],echoFiles:new Set,establishedFile:n.kind==="echo"?n.establishedFile:void 0,establishedSymbol:n.kind==="echo"?n.establishedSymbol:void 0,relatedFiles:new Set,sharedEvidence:new Set,recommendation:H(n)},t.set(o,s)),s.count+=1,s.maxSimilarity=Math.max(s.maxSimilarity,n.similarity),s.findingIndexes.push(e),s.echoFiles.add(n.echoFile),s.relatedFiles.add(n.echoFile),s.relatedFiles.add(n.establishedFile);for(let r of n.sharedEvidence)s.sharedEvidence.add(r)}return[...t.values()].map(e=>({...e,echoFiles:[...e.echoFiles].sort(),relatedFiles:[...e.relatedFiles].sort(),sharedEvidence:[...e.sharedEvidence].sort().slice(0,16)})).sort((e,n)=>n.count-e.count||n.maxSimilarity-e.maxSimilarity||e.groupKey.localeCompare(n.groupKey))}function H(i){return i.kind==="echo"?"Review the established side once, then migrate or delete every echo in this group.":"Pick one owner for the new twins and consolidate the group before the copies diverge."}function K(i){return Number.isFinite(i)?i*5:Number.POSITIVE_INFINITY}function G(...i){let t=[],e=new Set;for(let[n,a]of i)for(let o of a){let s=`${n}:${o}`;e.has(s)||(e.add(s),t.push(s))}return t}function m(i){return(i.split("/").pop()??i).replace(/\.[^.]+$/,"")}export{J as a};
2
+ //# sourceMappingURL=chunk-5MPBSFZH.js.map
@@ -1,8 +1,8 @@
1
- import{e as C,f as G,m as z,n as U}from"./chunk-6JMAVFL4.js";import{D as h,E as _,F as j,H as F,o as $,q as M,s as R,t as P}from"./chunk-UC2FD2PS.js";import{execFileSync as ge}from"child_process";import{existsSync as fe,readdirSync as q}from"fs";import{extname as X,join as V}from"path";var Y=new Set([".git",".hg",".svn",".idea",".vscode","node_modules","vendor","dist","build","target","bin","obj",".dart_tool",".gradle",".next",".venv","venv","__pycache__"]),me=[{language:"typescript",files:["tsconfig.json","tsconfig.base.json"],extensions:[".ts",".tsx",".mts",".cts"]},{language:"rust",files:["Cargo.toml"],extensions:[".rs"]},{language:"go",files:["go.mod"],extensions:[".go"]},{language:"java",files:["pom.xml","build.gradle","build.gradle.kts"],extensions:[".java"]},{language:"kotlin",files:["build.gradle.kts"],extensions:[".kt",".kts"]},{language:"scala",files:["build.sbt"],extensions:[".scala"]},{language:"clojure",files:["deps.edn","project.clj","bb.edn","shadow-cljs.edn"],extensions:[".clj",".cljs",".cljc"]},{language:"python",files:["pyproject.toml","setup.py","setup.cfg","Pipfile"],extensions:[".py",".pyi"]},{language:"ruby",files:["Gemfile"],extensions:[".rb"]},{language:"cpp",files:["compile_commands.json","CMakeLists.txt","Makefile"],extensions:[".cc",".cpp",".cxx",".hpp",".hh",".hxx"]},{language:"c",files:["compile_commands.json","CMakeLists.txt","Makefile"],extensions:[".c",".h"]},{language:"csharp",globs:["*.csproj","*.sln"],extensions:[".cs"]},{language:"vb",globs:["*.vbproj"],extensions:[".vb"]},{language:"dart",files:["pubspec.yaml"],extensions:[".dart"]},{language:"php",files:["composer.json"],extensions:[".php"]},{language:"javascript",files:["package.json"],extensions:[".js",".jsx",".mjs",".cjs"]}];function rt(e){let t=[],n=pe(e),r=xe(e);for(let s of me){if(ye(e,s.files)){t.push(s.language);continue}if(Re(n,s.globs)){t.push(s.language);continue}Be(r,s.extensions)&&t.push(s.language)}return t.includes("typescript")&&K(t,"javascript"),t.includes("cpp")&&!r.has(".c")&&K(t,"c"),t}function pe(e){try{return q(e)}catch{return[]}}function ye(e,t){return t?.length?t.some(n=>fe(V(e,n))):!1}function Re(e,t){return t?.length?e.some(n=>t.some(r=>be(n,r))):!1}function be(e,t){if(t==="*")return!0;if(!t.includes("*"))return e===t;let[n,r]=t.split("*");return e.startsWith(n??"")&&e.endsWith(r??"")}function xe(e){let t=ve(e);if(t)return t;let n=new Set,r=[e];for(;r.length>0;){let s=r.pop();if(!s)continue;let a;try{a=q(s,{withFileTypes:!0})}catch{continue}for(let i of a){if(i.name.startsWith(".")&&!i.name.endsWith("proj")&&!i.name.endsWith("sln")&&i.isDirectory())continue;let u=V(s,i.name);if(i.isDirectory()){Y.has(i.name)||r.push(u);continue}let d=X(i.name).toLowerCase();d&&n.add(d)}}return n}function ve(e){try{let t=ge("git",["-C",e,"ls-files","-co","--exclude-standard","--","."],{encoding:"utf-8",maxBuffer:26214400,stdio:["ignore","pipe","ignore"],windowsHide:!0,timeout:3e4,killSignal:"SIGKILL"}),n=new Set;for(let r of t.split(`
1
+ import{e as C,f as G,m as z,n as U}from"./chunk-NNG6M6XD.js";import{D as h,E as _,F as j,H as F,o as $,q as M,s as R,t as P}from"./chunk-UC2FD2PS.js";import{execFileSync as ge}from"child_process";import{existsSync as fe,readdirSync as q}from"fs";import{extname as X,join as V}from"path";var Y=new Set([".git",".hg",".svn",".idea",".vscode","node_modules","vendor","dist","build","target","bin","obj",".dart_tool",".gradle",".next",".venv","venv","__pycache__"]),me=[{language:"typescript",files:["tsconfig.json","tsconfig.base.json"],extensions:[".ts",".tsx",".mts",".cts"]},{language:"rust",files:["Cargo.toml"],extensions:[".rs"]},{language:"go",files:["go.mod"],extensions:[".go"]},{language:"java",files:["pom.xml","build.gradle","build.gradle.kts"],extensions:[".java"]},{language:"kotlin",files:["build.gradle.kts"],extensions:[".kt",".kts"]},{language:"scala",files:["build.sbt"],extensions:[".scala"]},{language:"clojure",files:["deps.edn","project.clj","bb.edn","shadow-cljs.edn"],extensions:[".clj",".cljs",".cljc"]},{language:"python",files:["pyproject.toml","setup.py","setup.cfg","Pipfile"],extensions:[".py",".pyi"]},{language:"ruby",files:["Gemfile"],extensions:[".rb"]},{language:"cpp",files:["compile_commands.json","CMakeLists.txt","Makefile"],extensions:[".cc",".cpp",".cxx",".hpp",".hh",".hxx"]},{language:"c",files:["compile_commands.json","CMakeLists.txt","Makefile"],extensions:[".c",".h"]},{language:"csharp",globs:["*.csproj","*.sln"],extensions:[".cs"]},{language:"vb",globs:["*.vbproj"],extensions:[".vb"]},{language:"dart",files:["pubspec.yaml"],extensions:[".dart"]},{language:"php",files:["composer.json"],extensions:[".php"]},{language:"javascript",files:["package.json"],extensions:[".js",".jsx",".mjs",".cjs"]}];function rt(e){let t=[],n=pe(e),r=xe(e);for(let s of me){if(ye(e,s.files)){t.push(s.language);continue}if(Re(n,s.globs)){t.push(s.language);continue}Be(r,s.extensions)&&t.push(s.language)}return t.includes("typescript")&&K(t,"javascript"),t.includes("cpp")&&!r.has(".c")&&K(t,"c"),t}function pe(e){try{return q(e)}catch{return[]}}function ye(e,t){return t?.length?t.some(n=>fe(V(e,n))):!1}function Re(e,t){return t?.length?e.some(n=>t.some(r=>be(n,r))):!1}function be(e,t){if(t==="*")return!0;if(!t.includes("*"))return e===t;let[n,r]=t.split("*");return e.startsWith(n??"")&&e.endsWith(r??"")}function xe(e){let t=ve(e);if(t)return t;let n=new Set,r=[e];for(;r.length>0;){let s=r.pop();if(!s)continue;let a;try{a=q(s,{withFileTypes:!0})}catch{continue}for(let i of a){if(i.name.startsWith(".")&&!i.name.endsWith("proj")&&!i.name.endsWith("sln")&&i.isDirectory())continue;let u=V(s,i.name);if(i.isDirectory()){Y.has(i.name)||r.push(u);continue}let d=X(i.name).toLowerCase();d&&n.add(d)}}return n}function ve(e){try{let t=ge("git",["-C",e,"ls-files","-co","--exclude-standard","--","."],{encoding:"utf-8",maxBuffer:26214400,stdio:["ignore","pipe","ignore"],windowsHide:!0,timeout:3e4,killSignal:"SIGKILL"}),n=new Set;for(let r of t.split(`
2
2
  `)){if(!r||r.split("/").some(a=>Y.has(a)))continue;let s=X(r).toLowerCase();s&&n.add(s)}return n}catch{return null}}function Be(e,t){return t?.length?t.some(n=>e.has(n)):!1}function K(e,t){let n=e.indexOf(t);n!==-1&&e.splice(n,1)}import{existsSync as ne,statSync as De}from"fs";import{dirname as se,join as ae}from"path";import{appendFileSync as he,existsSync as Le,mkdirSync as Se,renameSync as Ae,rmSync as Te,statSync as ke,truncateSync as we}from"fs";import{basename as Oe,dirname as Me}from"path";var L=".previous",Pe=".rotation.lock",_e=2e3,E=class extends Error{constructor(n,r){super(`Timed out after ${r}ms waiting for rotating JSONL lock: ${n}`);this.lockPath=n;this.timeoutMs=r;this.name="RotatingJsonlLockTimeoutError"}lockPath;timeoutMs;code="ROTATING_JSONL_LOCK_TIMEOUT"},N=class extends Error{constructor(n){super(`Rotating JSONL lock ownership changed before release: ${n}`);this.lockPath=n;this.name="RotatingJsonlLockReleaseError"}lockPath;code="ROTATING_JSONL_LOCK_RELEASE_FAILED"},H=Object.freeze({monotonicNow:C,wait(e){Atomics.wait(new Int32Array(new SharedArrayBuffer(4)),0,0,e)},tryAcquireLock(e,t){let n=G(e,{kind:"rotating-jsonl",detail:{target:Oe(t)}});return n.kind==="acquired"?{kind:"acquired",lock:n.lock}:{kind:"contended"}},makeDirectory(e){Se(e,{recursive:!0})},exists:Le,readBytes(e){return j(e,{maxBytes:h,inputKind:"rotating JSONL segment"})},size(e){return ke(e).size},truncate:we,remove(e){Te(e,{force:!0})},rename:Ae,append:he});function Q(e,t,n){let r=n.runtime??H,s=JSON.stringify(t);if(s===void 0)throw new TypeError("Rotating JSONL records must be JSON-serializable values.");let a=Buffer.from(`${s}
3
3
  `),i=Math.max(1,Math.floor(n.maxSegmentBytes),a.length);return ee(e,n.lockTimeoutMs,r,()=>{r.makeDirectory(Me(e));let u=Ee(e,h,r);n.onPhase?.("tail-repaired");let d=`${e}${n.previousSuffix??L}`,o=!1,g=!1;return r.exists(e)&&r.size(e)+a.length>i&&(r.exists(d)&&(r.remove(d),g=!0),n.onPhase?.("previous-pruned"),r.rename(e,d),o=!0,n.onPhase?.("current-rotated")),r.append(e,a),n.onPhase?.("record-appended"),{lineBytes:a.length,segmentLimitBytes:i,repairedTailBytes:u,rotated:o,prunedPrevious:g}})}function Z(e,t={}){let n=t.runtime??H,r=Ne(t.maxSegmentBytes);return ee(e,t.lockTimeoutMs,n,()=>{let s=[],a=0,i=`${e}${t.previousSuffix??L}`;for(let u of[i,e]){if(!n.exists(u))continue;let d=Ie(te(u,r,n));s.push(...d.lines),a+=d.partialTailBytes}return{lines:s,ignoredPartialTailBytes:a}})}function ee(e,t,n,r){let s=`${e}${Pe}`,a=Math.max(0,t??_e),i=n.monotonicNow()+a,u;for(;;){let m=n.tryAcquireLock(s,e);if(m.kind==="acquired"){u=m.lock;break}let p=i-n.monotonicNow();if(p<=0)throw new E(s,a);n.wait(Math.min(5,p))}let d=!1,o,g;try{g=r()}catch(m){d=!0,o=m}let l=!1;try{l=u.release()}catch(m){if(!d)throw m}if(d)throw o;if(!l)throw new N(s);return g}function Ee(e,t,n){if(!n.exists(e))return 0;let r=te(e,t,n);if(r.length===0||r[r.length-1]===10)return 0;let s=r.lastIndexOf(10),a=s<0?0:s+1;return n.truncate(e,a),r.length-a}function Ne(e){let t=e??h;if(!Number.isSafeInteger(t)||t<=0)throw new RangeError(`maxSegmentBytes must be a positive safe integer; received ${t}`);return t}function te(e,t,n){let r=n.size(e);if(r>t)throw new _("rotating JSONL segment",e,"too-large",r,t);let s=n.readBytes(e),a=n.size(e);if(a!==r||s.byteLength!==r)throw new _("rotating JSONL segment",e,"changed-during-read",a,t);return s}function Ie(e){let t=e.lastIndexOf(10),n=t<0?0:t+1;return{lines:e.subarray(0,n).toString("utf8").split(`
4
4
  `).filter(s=>s.length>0),partialTailBytes:e.length-n}}var Je="reindex-activity.jsonl",S=L,We=1024*1024,$e=1440*60*1e3,ie=e=>F(e,"reindex activity segment");function D(e){return ae(se(e),Je)}function je(e){if(e.reused)return 0;let t=I(e.indexPath)+I(e.dbPath);for(let n of e.shards??[])!n.reused&&n.outputBytes!==null&&(t+=n.outputBytes);return t}function bt(e,t){let n=t.lastRefresh;if(!n)return{state:"failed",reason:"reindex result has no refresh metadata"};let r=je(t);return oe(D(e),{version:1,event:"run",recordedAt:n.completedAt,trigger:n.trigger,result:n.result,durationMs:n.durationMs,estimatedLogicalOutputBytes:r,estimatedWriteBytes:r+(t.writeTelemetry?.fallbackCopiedBytes??0),reflinkedBytes:t.writeTelemetry?.reflinkedBytes??0,fallbackCopiedBytes:t.writeTelemetry?.fallbackCopiedBytes??0,byLanguage:Ke(t)})}function xt(e,t){return oe(D(e),{version:1,event:"run",recordedAt:t.completedAt,trigger:t.trigger,result:"failed",durationMs:t.durationMs,estimatedLogicalOutputBytes:0})}function Fe(e,t,n=We,r){Q(e,t,{maxSegmentBytes:n,previousSuffix:S,...r?{runtime:r}:{}})}function Ce(e,t=new Date,n=$e,r=ie){let s=t.getTime(),a=s-n,i={confidence:"complete",recordsRead:0,invalidRecords:0,skippedRecords:0,readErrors:0,ignoredPartialTailBytes:0,windowStartedAt:new Date(a).toISOString(),windowEndedAt:t.toISOString(),runs:0,rebuilt:0,reused:0,failed:0,suppressed:0,estimatedLogicalOutputBytes:0,estimatedWriteBytes:0,reflinkedBytes:0,fallbackCopiedBytes:0,languageAttribution:"complete",attributedRuns:0,unattributedRuns:0,invalidLanguageDetails:0,byLanguage:{},byTrigger:{}},u=D(e),d=[];if(r===ie){if(!ne(u)&&!ne(`${u}${S}`))return i;try{let o=Z(u,{previousSuffix:S});d=o.lines,i.ignoredPartialTailBytes=o.ignoredPartialTailBytes}catch{i.readErrors+=1,i.confidence="unavailable"}}else{let o=0;for(let g of[`${u}${S}`,u])try{d.push(...Ze(r(g))),o+=1}catch{i.readErrors+=1}o===0?i.confidence="unavailable":i.readErrors>0&&(i.confidence="partial")}for(let o of d){i.recordsRead+=1;let g=Ge(o);if(!g){i.invalidRecords+=1,i.confidence!=="unavailable"&&(i.confidence="partial");continue}let{record:l}=g,m=Date.parse(l.recordedAt);if(m<a||m>s){i.skippedRecords+=1;continue}if(i.invalidLanguageDetails=(i.invalidLanguageDetails??0)+g.invalidLanguageDetails,i.byTrigger[l.trigger.kind]=(i.byTrigger[l.trigger.kind]??0)+1,l.event==="suppressed"){i.suppressed+=1;continue}i.runs+=1,i[l.result]+=1,i.estimatedLogicalOutputBytes+=l.estimatedLogicalOutputBytes,i.estimatedWriteBytes=(i.estimatedWriteBytes??0)+(l.estimatedWriteBytes??l.estimatedLogicalOutputBytes),i.reflinkedBytes=(i.reflinkedBytes??0)+(l.reflinkedBytes??0),i.fallbackCopiedBytes=(i.fallbackCopiedBytes??0)+(l.fallbackCopiedBytes??0),l.result!=="failed"&&(g.hasLanguageDetails?i.attributedRuns=(i.attributedRuns??0)+1:i.unattributedRuns=(i.unattributedRuns??0)+1);for(let[p,y]of Ye(l.byLanguage)){let b=(i.byLanguage??={})[p]??=He();b.runs+=1,b[y.result]+=1,b.producedOutputBytes+=y.producedOutputBytes,b.durationMs+=y.durationMs}l.result==="rebuilt"&&i.oldestRebuildAt===void 0&&(i.oldestRebuildAt=l.recordedAt),(l.estimatedWriteBytes??l.estimatedLogicalOutputBytes)>0&&i.oldestWriteAt===void 0&&(i.oldestWriteAt=l.recordedAt)}return i.ignoredPartialTailBytes>0&&i.confidence!=="unavailable"&&(i.confidence="partial"),i.languageAttribution=Qe(i),i}function oe(e,t){try{return Fe(e,t),{state:"recorded"}}catch(n){return{state:"failed",reason:n instanceof Error?n.message:String(n)}}}function Ge(e){try{let t=JSON.parse(e);if(!t||typeof t!="object")return null;let n=t;if(n.version!==1||!$(n.recordedAt)||!n.trigger||!Ue(n.trigger.kind))return null;if(n.event==="suppressed")return n.reason==="completed-index-is-fresh"?{record:n,hasLanguageDetails:!1,invalidLanguageDetails:0}:null;if(n.event!=="run"||n.result!=="rebuilt"&&n.result!=="reused"&&n.result!=="failed"||!R(n.durationMs)||!R(n.estimatedLogicalOutputBytes)||n.estimatedWriteBytes!==void 0&&!R(n.estimatedWriteBytes)||n.reflinkedBytes!==void 0&&!R(n.reflinkedBytes)||n.fallbackCopiedBytes!==void 0&&!R(n.fallbackCopiedBytes))return null;let r=n,{byLanguage:s,...a}=r,i=qe(s);return{record:{...a,...i.byLanguage?{byLanguage:i.byLanguage}:{}},hasLanguageDetails:i.hasLanguageDetails,invalidLanguageDetails:i.invalidLanguageDetails}}catch{return null}}function vt(e,t,n=new Date){return t.enabled?ze(Ce(e,n,t.windowMs),t,n.getTime()):{state:"allowed",rebuilt:0,estimatedWriteBytes:0}}function ze(e,t,n){let r=e.estimatedWriteBytes??e.estimatedLogicalOutputBytes,s={rebuilt:e.rebuilt,estimatedWriteBytes:r};return t.enabled?e.confidence!==void 0&&e.confidence!=="complete"?{state:"paused",reason:"activity-evidence",until:n+t.windowMs,...s,detail:`reindex activity evidence is ${e.confidence}`}:e.rebuilt>=t.maxRebuilds?{state:"paused",reason:"rebuild-count",until:re(e.oldestRebuildAt,t.windowMs,n),...s,detail:`${e.rebuilt}/${t.maxRebuilds} automatic rebuild slots consumed`}:r>=t.maxEstimatedWriteBytes?{state:"paused",reason:"estimated-write-bytes",until:re(e.oldestWriteAt,t.windowMs,n),...s,detail:`${r}/${t.maxEstimatedWriteBytes} estimated write bytes consumed`}:{state:"allowed",...s}:{state:"allowed",...s}}function re(e,t,n){let r=e?Date.parse(e):Number.NaN;return Number.isFinite(r)&&r+t>n?r+t:n+t}function Ue(e){return e==="manual-cli"||e==="setup"||e==="watch-source"||e==="watch-startup"||e==="watch-demand"||e==="watch-git-head"||e==="watch-git-index"||e==="watch-git-state"||e==="unknown"}function I(e){try{return De(e).size}catch{return 0}}function Ke(e){let t={};for(let n of e.languages){let r=(e.shards??[]).filter(o=>o.language===n),s=r.find(o=>o.id===n),a=e.reused||(s?s.reused:r.length>0&&r.every(o=>o.reused)),i=I(ae(se(e.dbPath),"language-indexes",`${n}.scip`)),u=i>0?i:s?.outputBytes??i,d=a?0:s?.durationMs??r.filter(o=>!o.reused).reduce((o,g)=>o+g.durationMs,0);t[n]={result:a?"reused":"rebuilt",outputBytes:u,producedOutputBytes:a?0:u,durationMs:d}}return t}function qe(e){if(e===void 0)return{hasLanguageDetails:!1,invalidLanguageDetails:0};if(!e||typeof e!="object"||Array.isArray(e))return{hasLanguageDetails:!1,invalidLanguageDetails:1};let t={},n=0;for(let[s,a]of Object.entries(e)){if(!Ve(s)||!Xe(a)){n+=1;continue}t[s]=a}let r=Object.keys(t).length>0;return{...r?{byLanguage:t}:{},hasLanguageDetails:r,invalidLanguageDetails:n}}function Xe(e){if(!e||typeof e!="object")return!1;let t=e;return(t.result==="rebuilt"||t.result==="reused")&&M(t.outputBytes)&&M(t.producedOutputBytes)&&R(t.durationMs)&&(t.result!=="reused"||t.producedOutputBytes===0&&t.durationMs===0)&&t.producedOutputBytes<=t.outputBytes}function Ve(e){return P.includes(e)}function Ye(e){return e?P.flatMap(t=>{let n=e[t];return n?[[t,n]]:[]}):[]}function He(){return{runs:0,rebuilt:0,reused:0,producedOutputBytes:0,durationMs:0}}function Qe(e){let t=e.invalidLanguageDetails??0,n=e.attributedRuns??0;return(e.unattributedRuns??0)===0&&t===0?"complete":n===0?"unavailable":"partial"}function Ze(e){return e.endsWith(`
5
5
  `)||(e=e.slice(0,Math.max(0,e.lastIndexOf(`
6
6
  `)+1))),e.split(`
7
- `).filter(t=>t.length>0)}import{spawn as et}from"child_process";import{platform as ue}from"os";import{performance as de}from"perf_hooks";var Tt={probe:1e4,git:3e4,analysis:18e4,install:3e5,indexer:6e5},B=class extends Error{constructor(n,r,s,a={}){super(s,a.cause===void 0?void 0:{cause:a.cause});this.kind=n;this.label=r;this.name="BoundedProcessError",this.timedOut=a.timedOut??!1,this.reaped=a.reaped??!1,this.stdout=a.stdout??"",this.stderr=a.stderr??"",this.stdoutTruncated=a.stdoutTruncated??!1,this.stderrTruncated=a.stderrTruncated??!1}kind;label;timedOut;reaped;stdout;stderr;stdoutTruncated;stderrTruncated};function v(e,t){if(!Number.isFinite(e)||e<=0)throw new TypeError(`${t} must be a positive finite number.`)}function le(e,t,n,r){let s=Math.max(0,r-n);s>0&&e.push(t.subarray(0,s))}function ce(e,t,n){let r=Buffer.concat([...e,t]);e.length=0,e.push(r.subarray(Math.max(0,r.length-n)))}function kt(e){v(e.timeoutMs,"timeoutMs"),v(e.maxStdoutBytes,"maxStdoutBytes"),v(e.maxStderrBytes,"maxStderrBytes");let t=e.terminationGraceMs??1e3;v(t,"terminationGraceMs");let n=e.terminationForceMs??t;return v(n,"terminationForceMs"),new Promise((r,s)=>{let a=de.now(),i;try{let c=ue()!=="win32";i=et(e.command,[...e.args??[]],{cwd:e.cwd,env:e.env,detached:c?!0:e.detached,stdio:["pipe","pipe","pipe"],windowsHide:!0})}catch(c){s(new B("spawn",e.label,`${e.label} could not start.`,{cause:c,reaped:!0}));return}let u=[],d=[],o=0,g=0,l=!1,m=!1,p=null,y=!1,b=ue()!=="win32",J=i.pid===void 0?null:z(i.pid,b),A=()=>{clearTimeout(W),e.signal?.removeEventListener("abort",k)},T=c=>{if(y||!p)return;y=!0,A();let f=Buffer.concat(u).toString("utf8"),w=Buffer.concat(d).toString("utf8"),O=c.reaped||!c.detail?"":` Process-tree cleanup failed: ${c.detail}`;s(new B(p.kind,e.label,`${p.message}${O}`,{timedOut:p.timedOut,reaped:c.reaped,stdout:f,stderr:w,stdoutTruncated:l,stderrTruncated:m}))},x=c=>{if(!(p||y)){if(p=c,!J){T({reaped:i.pid===void 0,reason:i.pid===void 0?"terminated":"identity-unavailable"});return}U(J,{gracefulMs:t,forceMs:n}).then(T,f=>{T({reaped:!1,reason:"signal-failed",detail:f instanceof Error?f.message:String(f)})})}},W=setTimeout(()=>{x({kind:"timeout",timedOut:!0,message:`${e.label} timed out after ${e.timeoutMs}ms.`})},e.timeoutMs);W.unref();let k=()=>{x({kind:"aborted",timedOut:!1,message:`${e.label} was cancelled.`})};e.signal?.addEventListener("abort",k,{once:!0}),e.signal?.aborted&&k(),i.stdout.on("data",c=>{let f=Buffer.isBuffer(c)?c:Buffer.from(c);e.outputLimitBehavior==="truncate-tail"?ce(u,f,e.maxStdoutBytes):le(u,f,o,e.maxStdoutBytes),o+=f.length,o>e.maxStdoutBytes&&(l=!0,e.outputLimitBehavior!=="truncate-tail"&&x({kind:"stdout-limit",timedOut:!1,message:`${e.label} exceeded stdout limit (${e.maxStdoutBytes} bytes).`}))}),i.stderr.on("data",c=>{let f=Buffer.isBuffer(c)?c:Buffer.from(c);e.outputLimitBehavior==="truncate-tail"?ce(d,f,e.maxStderrBytes):le(d,f,g,e.maxStderrBytes),g+=f.length,g>e.maxStderrBytes&&(m=!0,e.outputLimitBehavior!=="truncate-tail"&&x({kind:"stderr-limit",timedOut:!1,message:`${e.label} exceeded stderr limit (${e.maxStderrBytes} bytes).`}))}),i.on("error",c=>{if(!y&&!p){if(i.pid===void 0){A(),y=!0,s(new B("spawn",e.label,`${e.label} could not start: ${c.message}`,{cause:c,reaped:!0}));return}x({kind:"spawn",timedOut:!1,message:`${e.label} failed after start: ${c.message}`})}}),i.on("close",(c,f)=>{if(y||p)return;y=!0,A();let w=Buffer.concat(u).toString("utf8"),O=Buffer.concat(d).toString("utf8");r({status:c,signal:f,stdout:w,stderr:O,timedOut:!1,durationMs:de.now()-a,stdoutTruncated:l,stderrTruncated:m})}),e.input===void 0?i.stdin.end():i.stdin.end(e.input)})}export{L as a,Q as b,rt as c,Je as d,bt as e,xt as f,vt as g,Tt as h,B as i,kt as j};
8
- //# sourceMappingURL=chunk-K7JLSGCJ.js.map
7
+ `).filter(t=>t.length>0)}import{spawn as et}from"child_process";import{platform as ue}from"os";import{performance as de}from"perf_hooks";var Tt={probe:1e4,git:3e4,analysis:18e4,install:3e5,indexer:18e5},B=class extends Error{constructor(n,r,s,a={}){super(s,a.cause===void 0?void 0:{cause:a.cause});this.kind=n;this.label=r;this.name="BoundedProcessError",this.timedOut=a.timedOut??!1,this.reaped=a.reaped??!1,this.stdout=a.stdout??"",this.stderr=a.stderr??"",this.stdoutTruncated=a.stdoutTruncated??!1,this.stderrTruncated=a.stderrTruncated??!1}kind;label;timedOut;reaped;stdout;stderr;stdoutTruncated;stderrTruncated};function v(e,t){if(!Number.isFinite(e)||e<=0)throw new TypeError(`${t} must be a positive finite number.`)}function le(e,t,n,r){let s=Math.max(0,r-n);s>0&&e.push(t.subarray(0,s))}function ce(e,t,n){let r=Buffer.concat([...e,t]);e.length=0,e.push(r.subarray(Math.max(0,r.length-n)))}function kt(e){v(e.timeoutMs,"timeoutMs"),v(e.maxStdoutBytes,"maxStdoutBytes"),v(e.maxStderrBytes,"maxStderrBytes");let t=e.terminationGraceMs??1e3;v(t,"terminationGraceMs");let n=e.terminationForceMs??t;return v(n,"terminationForceMs"),new Promise((r,s)=>{let a=de.now(),i;try{let c=ue()!=="win32";i=et(e.command,[...e.args??[]],{cwd:e.cwd,env:e.env,detached:c?!0:e.detached,stdio:["pipe","pipe","pipe"],windowsHide:!0})}catch(c){s(new B("spawn",e.label,`${e.label} could not start.`,{cause:c,reaped:!0}));return}let u=[],d=[],o=0,g=0,l=!1,m=!1,p=null,y=!1,b=ue()!=="win32",J=i.pid===void 0?null:z(i.pid,b),A=()=>{clearTimeout(W),e.signal?.removeEventListener("abort",k)},T=c=>{if(y||!p)return;y=!0,A();let f=Buffer.concat(u).toString("utf8"),w=Buffer.concat(d).toString("utf8"),O=c.reaped||!c.detail?"":` Process-tree cleanup failed: ${c.detail}`;s(new B(p.kind,e.label,`${p.message}${O}`,{timedOut:p.timedOut,reaped:c.reaped,stdout:f,stderr:w,stdoutTruncated:l,stderrTruncated:m}))},x=c=>{if(!(p||y)){if(p=c,!J){T({reaped:i.pid===void 0,reason:i.pid===void 0?"terminated":"identity-unavailable"});return}U(J,{gracefulMs:t,forceMs:n}).then(T,f=>{T({reaped:!1,reason:"signal-failed",detail:f instanceof Error?f.message:String(f)})})}},W=setTimeout(()=>{x({kind:"timeout",timedOut:!0,message:`${e.label} timed out after ${e.timeoutMs}ms.`})},e.timeoutMs);W.unref();let k=()=>{x({kind:"aborted",timedOut:!1,message:`${e.label} was cancelled.`})};e.signal?.addEventListener("abort",k,{once:!0}),e.signal?.aborted&&k(),i.stdout.on("data",c=>{let f=Buffer.isBuffer(c)?c:Buffer.from(c);e.outputLimitBehavior==="truncate-tail"?ce(u,f,e.maxStdoutBytes):le(u,f,o,e.maxStdoutBytes),o+=f.length,o>e.maxStdoutBytes&&(l=!0,e.outputLimitBehavior!=="truncate-tail"&&x({kind:"stdout-limit",timedOut:!1,message:`${e.label} exceeded stdout limit (${e.maxStdoutBytes} bytes).`}))}),i.stderr.on("data",c=>{let f=Buffer.isBuffer(c)?c:Buffer.from(c);e.outputLimitBehavior==="truncate-tail"?ce(d,f,e.maxStderrBytes):le(d,f,g,e.maxStderrBytes),g+=f.length,g>e.maxStderrBytes&&(m=!0,e.outputLimitBehavior!=="truncate-tail"&&x({kind:"stderr-limit",timedOut:!1,message:`${e.label} exceeded stderr limit (${e.maxStderrBytes} bytes).`}))}),i.on("error",c=>{if(!y&&!p){if(i.pid===void 0){A(),y=!0,s(new B("spawn",e.label,`${e.label} could not start: ${c.message}`,{cause:c,reaped:!0}));return}x({kind:"spawn",timedOut:!1,message:`${e.label} failed after start: ${c.message}`})}}),i.on("close",(c,f)=>{if(y||p)return;y=!0,A();let w=Buffer.concat(u).toString("utf8"),O=Buffer.concat(d).toString("utf8");r({status:c,signal:f,stdout:w,stderr:O,timedOut:!1,durationMs:de.now()-a,stdoutTruncated:l,stderrTruncated:m})}),e.input===void 0?i.stdin.end():i.stdin.end(e.input)})}export{L as a,Q as b,rt as c,Je as d,bt as e,xt as f,vt as g,Tt as h,B as i,kt as j};
8
+ //# sourceMappingURL=chunk-5TZNHP4T.js.map
@@ -1,2 +1,2 @@
1
- import{h as p,j as x,l,p as g,x as v}from"./chunk-GWYZVVKY.js";import{Q as d}from"./chunk-6WAPPQ5F.js";import{P as h,S as u,ia as f}from"./chunk-MEUHIDI3.js";import{G as m}from"./chunk-UQYQBLJX.js";import{existsSync as C}from"fs";var E=5e3,S=100,R={prepare:f,freshness:h,ensureService:x,inspectService:l,requestRefresh:g,async reindex(e,t,n,o){let{reindexConfiguredProject:a}=await import("./project-reindex-CRJU3IFG.js");return a(e,t,n,o)},indexExists:C,wait(e){return new Promise(t=>setTimeout(t,e))},now:Date.now};async function I(e,t=R,n={}){if(e.dbPathSource==="env")return{source:"explicit-index",service:{kind:"skipped",reason:"environment"}};if(v(e.commandName,e.config)&&t.indexExists(e.paths.dbPath))return{source:"published-generation",service:{kind:"skipped",reason:"excluded-command"}};let o=y(e,t),a=t.prepare(e.projectRoot,e.config,e.paths,{gitContext:e.gitContext,...o?{watcherGeneration:o}:{}}),r=t.freshness(e.projectRoot,e.config,e.paths),i=t.ensureService({commandName:e.commandName,projectRoot:e.projectRoot,cacheDir:e.paths.cacheDir,cliVersion:m,config:e.config,gitContext:e.gitContext});if(r.state==="fresh")return{source:a.kind==="local-fresh"?"existing":"shared-generation",service:i};if((i.kind==="started"||i.kind==="reused")&&(t.requestRefresh(d(e.paths.cacheDir).activityPath,`evidence command ${e.commandName} requires a fresh generation`),r=await F(e,r,t,n,i),r.state==="fresh"))return{source:"watcher",service:i};try{await t.reindex(e.projectRoot,e.config,e.paths,{allowPartial:!1,skipAutoInstall:!0,trigger:{kind:"watch-demand",detail:`codebaseiq ${e.commandName}`},onStatus:()=>{}})}catch(s){throw new Error(`Could not prepare fresh evidence for codebaseiq ${e.commandName}: ${s instanceof Error?s.message:String(s)}`,{cause:s})}if(r=t.freshness(e.projectRoot,e.config,e.paths),r.state!=="fresh")throw new Error(`Could not prepare fresh evidence for codebaseiq ${e.commandName}: index remained ${r.state} (${r.reason})`);return{source:"synchronous-reindex",service:i}}function y(e,t){if(e.config.watch?.enabled===!0)try{return p(t.inspectService({projectRoot:e.projectRoot,cacheDir:e.paths.cacheDir,cliVersion:m,gitContext:e.gitContext}))}catch{return}}async function F(e,t,n,o,a){if(a.state.watcher.state==="budget-paused")return t;let r=Math.max(0,o.waitMs??E),i=Math.max(1,o.pollMs??S),s=n.now()+r,c=t;for(;n.now()<s;)if(await n.wait(Math.min(i,Math.max(1,s-n.now()))),u(),c=n.freshness(e.projectRoot,e.config,e.paths),c.state==="fresh")return c;return c}export{I as a};
2
- //# sourceMappingURL=chunk-DVWO7RBC.js.map
1
+ import{h as p,j as x,l,p as g,x as v}from"./chunk-V4NGDIEA.js";import{Q as d}from"./chunk-K4S2VH42.js";import{P as h,S as u,ia as f}from"./chunk-MEUHIDI3.js";import{G as m}from"./chunk-UQYQBLJX.js";import{existsSync as C}from"fs";var E=5e3,S=100,R={prepare:f,freshness:h,ensureService:x,inspectService:l,requestRefresh:g,async reindex(e,t,n,o){let{reindexConfiguredProject:a}=await import("./project-reindex-VQ23LWDA.js");return a(e,t,n,o)},indexExists:C,wait(e){return new Promise(t=>setTimeout(t,e))},now:Date.now};async function I(e,t=R,n={}){if(e.dbPathSource==="env")return{source:"explicit-index",service:{kind:"skipped",reason:"environment"}};if(v(e.commandName,e.config)&&t.indexExists(e.paths.dbPath))return{source:"published-generation",service:{kind:"skipped",reason:"excluded-command"}};let o=y(e,t),a=t.prepare(e.projectRoot,e.config,e.paths,{gitContext:e.gitContext,...o?{watcherGeneration:o}:{}}),r=t.freshness(e.projectRoot,e.config,e.paths),i=t.ensureService({commandName:e.commandName,projectRoot:e.projectRoot,cacheDir:e.paths.cacheDir,cliVersion:m,config:e.config,gitContext:e.gitContext});if(r.state==="fresh")return{source:a.kind==="local-fresh"?"existing":"shared-generation",service:i};if((i.kind==="started"||i.kind==="reused")&&(t.requestRefresh(d(e.paths.cacheDir).activityPath,`evidence command ${e.commandName} requires a fresh generation`),r=await F(e,r,t,n,i),r.state==="fresh"))return{source:"watcher",service:i};try{await t.reindex(e.projectRoot,e.config,e.paths,{allowPartial:!1,skipAutoInstall:!0,trigger:{kind:"watch-demand",detail:`codebaseiq ${e.commandName}`},onStatus:()=>{}})}catch(s){throw new Error(`Could not prepare fresh evidence for codebaseiq ${e.commandName}: ${s instanceof Error?s.message:String(s)}`,{cause:s})}if(r=t.freshness(e.projectRoot,e.config,e.paths),r.state!=="fresh")throw new Error(`Could not prepare fresh evidence for codebaseiq ${e.commandName}: index remained ${r.state} (${r.reason})`);return{source:"synchronous-reindex",service:i}}function y(e,t){if(e.config.watch?.enabled===!0)try{return p(t.inspectService({projectRoot:e.projectRoot,cacheDir:e.paths.cacheDir,cliVersion:m,gitContext:e.gitContext}))}catch{return}}async function F(e,t,n,o,a){if(a.state.watcher.state==="budget-paused")return t;let r=Math.max(0,o.waitMs??E),i=Math.max(1,o.pollMs??S),s=n.now()+r,c=t;for(;n.now()<s;)if(await n.wait(Math.min(i,Math.max(1,s-n.now()))),u(),c=n.freshness(e.projectRoot,e.config,e.paths),c.state==="fresh")return c;return c}export{I as a};
2
+ //# sourceMappingURL=chunk-5YBDBY5L.js.map
@@ -1,3 +1,3 @@
1
1
  #!/usr/bin/env node
2
- import{g as m,s as h,t as y}from"./chunk-5IC2WZAL.js";import{y as g}from"./chunk-7UCDGXRW.js";import{l as d,r as p}from"./chunk-5T44HG5Y.js";import{i as l,r as f}from"./chunk-DUKHVPU5.js";import{statSync as A}from"fs";import{join as O,resolve as T}from"path";import{createHash as C,randomUUID as N}from"crypto";import{mkdirSync as H,realpathSync as x,renameSync as M,unlinkSync as V,writeFileSync as U}from"fs";import{homedir as w,tmpdir as K,userInfo as F}from"os";import{dirname as Y,join as a}from"path";var G=1*1024*1024,Q=4*1024*1024;function S(e=process.env){return a(e.XDG_CACHE_HOME||a(w(),".cache"),"codebaseiq")}function E(e){let r=x.native(e).replaceAll("\\","/");return process.platform==="win32"&&(r=r.toLowerCase()),C("sha256").update(r).digest("hex").slice(0,16)}var P=16,X=P+5;function k(e,r){return a(e,"sentinel","registry",`${r}.json`)}function R(e,r){try{let t=JSON.parse(f(k(e,r),"sentinel registry record")),{pid:n,socketPath:i,serviceVersion:o,projectRoot:s,startedAt:u,token:c}=t;if(typeof n=="number"&&Number.isInteger(n)&&n>0&&typeof i=="string"&&i.length>0&&typeof o=="string"&&typeof s=="string"&&typeof u=="string"&&typeof c=="string"&&c.length>0)return{pid:n,socketPath:i,serviceVersion:o,projectRoot:s,startedAt:u,token:c}}catch{}}function v(e){try{return process.kill(e,0),!0}catch(r){return r.code==="EPERM"}}var D=3e3,b=250,j={env:process.env,cliVersion:d,loadConfig:g,cacheDir:(e,r)=>p(e,r).cacheDir,registryRecord:e=>R(S(),E(e)),isProcessAlive:v,configChangedAtMs:e=>A(O(e,".codebaseiq.json")).mtimeMs,refreshHookBinary:e=>{m(e)},ensure:h,stop:y,sleep:e=>new Promise(r=>setTimeout(r,e))};async function I(e,r=j){let t=l(T(e)),n=r.loadConfig(t);if(n.sentinel?.enabled!==!0)return"sentinel-disabled";if(r.refreshHookBinary(r.cliVersion),n.watch?.enabled!==!0)return"watch-disabled";if(r.env.CODEBASEIQ_SKIP_WATCH_SERVICE==="1")return"environment";if(_(r,t))return"already-running";let i={projectRoot:t,cacheDir:r.cacheDir(t,n),cliVersion:r.cliVersion,spawnEnv:{CODEBASEIQ_SENTINEL_ENSURE:"1"}},o=r.ensure(i);if(o.disposition==="started")return"started";for(let s=0;s<D;s+=b)if(await r.sleep(b),_(r,t))return"reused";return Date.parse(o.state.startedAt)>=r.configChangedAtMs(t)?"reused-without-sentinel":(r.stop(i),r.ensure(i),"restarted")}function _(e,r){let t=e.registryRecord(r);return t!==void 0&&e.isProcessAlive(t.pid)&&t.serviceVersion===e.cliVersion}async function L(e){if(typeof e!="string"||e.length===0)throw new Error("A project root is required.");await I(e)}var ae={id:"__sentinel-ensure-service",command:"__sentinel-ensure-service <projectRoot>",hidden:!0,description:"Internal: start the resident service that hosts the trailing sentinel",renderShape:"custom",handler:L};export{E as a,R as b,v as c,I as d,ae as e};
3
- //# sourceMappingURL=chunk-T5X7DK6C.js.map
2
+ import{g as m,s as h,t as y}from"./chunk-BIADXGC3.js";import{y as g}from"./chunk-7UCDGXRW.js";import{l as d,r as p}from"./chunk-5T44HG5Y.js";import{i as l,r as f}from"./chunk-DUKHVPU5.js";import{statSync as A}from"fs";import{join as O,resolve as T}from"path";import{createHash as C,randomUUID as N}from"crypto";import{mkdirSync as H,realpathSync as x,renameSync as M,unlinkSync as V,writeFileSync as U}from"fs";import{homedir as w,tmpdir as K,userInfo as F}from"os";import{dirname as Y,join as a}from"path";var G=1*1024*1024,Q=4*1024*1024;function S(e=process.env){return a(e.XDG_CACHE_HOME||a(w(),".cache"),"codebaseiq")}function E(e){let r=x.native(e).replaceAll("\\","/");return process.platform==="win32"&&(r=r.toLowerCase()),C("sha256").update(r).digest("hex").slice(0,16)}var P=16,X=P+5;function k(e,r){return a(e,"sentinel","registry",`${r}.json`)}function R(e,r){try{let t=JSON.parse(f(k(e,r),"sentinel registry record")),{pid:n,socketPath:i,serviceVersion:o,projectRoot:s,startedAt:u,token:c}=t;if(typeof n=="number"&&Number.isInteger(n)&&n>0&&typeof i=="string"&&i.length>0&&typeof o=="string"&&typeof s=="string"&&typeof u=="string"&&typeof c=="string"&&c.length>0)return{pid:n,socketPath:i,serviceVersion:o,projectRoot:s,startedAt:u,token:c}}catch{}}function v(e){try{return process.kill(e,0),!0}catch(r){return r.code==="EPERM"}}var D=3e3,b=250,j={env:process.env,cliVersion:d,loadConfig:g,cacheDir:(e,r)=>p(e,r).cacheDir,registryRecord:e=>R(S(),E(e)),isProcessAlive:v,configChangedAtMs:e=>A(O(e,".codebaseiq.json")).mtimeMs,refreshHookBinary:e=>{m(e)},ensure:h,stop:y,sleep:e=>new Promise(r=>setTimeout(r,e))};async function I(e,r=j){let t=l(T(e)),n=r.loadConfig(t);if(n.sentinel?.enabled!==!0)return"sentinel-disabled";if(r.refreshHookBinary(r.cliVersion),n.watch?.enabled!==!0)return"watch-disabled";if(r.env.CODEBASEIQ_SKIP_WATCH_SERVICE==="1")return"environment";if(_(r,t))return"already-running";let i={projectRoot:t,cacheDir:r.cacheDir(t,n),cliVersion:r.cliVersion,spawnEnv:{CODEBASEIQ_SENTINEL_ENSURE:"1"}},o=r.ensure(i);if(o.disposition==="started")return"started";for(let s=0;s<D;s+=b)if(await r.sleep(b),_(r,t))return"reused";return Date.parse(o.state.startedAt)>=r.configChangedAtMs(t)?"reused-without-sentinel":(r.stop(i),r.ensure(i),"restarted")}function _(e,r){let t=e.registryRecord(r);return t!==void 0&&e.isProcessAlive(t.pid)&&t.serviceVersion===e.cliVersion}async function L(e){if(typeof e!="string"||e.length===0)throw new Error("A project root is required.");await I(e)}var ae={id:"__sentinel-ensure-service",command:"__sentinel-ensure-service <projectRoot>",hidden:!0,description:"Internal: start the resident service that hosts the trailing sentinel",renderShape:"custom",handler:L};export{E as a,R as b,v as c,I as d,ae as e};
3
+ //# sourceMappingURL=chunk-6EYESTJM.js.map
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import{a as he,c as z}from"./chunk-C7QWUBR2.js";import{b as le}from"./chunk-XZEE23VG.js";import{O as P,X as v}from"./chunk-5T44HG5Y.js";import{j as de,r as b,w as pe,x as ge,y as D}from"./chunk-DUKHVPU5.js";import{AsyncLocalStorage as nt}from"async_hooks";import{createHash as V}from"crypto";import{existsSync as rt,mkdirSync as st}from"fs";import{tmpdir as it}from"os";import{isAbsolute as ot,join as ye,resolve as Se}from"path";var q=2,at="CODEBASEIQ_SESSION",me="CODEBASEIQ_SESSION_DIR",ut=128,I=new nt;function ve(e,t){let n=e.sessionEnabled===!1||e.json?void 0:It(),r={enabled:n!==void 0,reemit:e.reemit===!0,command:e.command,projectRoot:Se(e.cwd),sessionIdentity:n,staged:[],stagedEvidence:[],finalized:!1};return I.run(r,t)}function Dn(e){let t=I.getStore();!t||t.finalized||(t.generationIdentity=e)}function zn(){return I.getStore()?.staged.length??0}function qn(e){let t=I.getStore();!t||e<0||e>t.staged.length||(t.staged.length=e)}function W(e){let t=I.getStore();if(!t||t.finalized)return;t.finalized=!0;let n=t.state;if(!n){t.staged.length=0,t.stagedEvidence.length=0;return}try{if(e&&(t.staged.length>0||t.stagedEvidence.length>0)){let r=n.ledger.nextOrdinal,s=yt(t.staged).map(o=>({...o,ordinal:r,command:t.command})),i=vt(t.stagedEvidence).map(o=>({...o,ordinal:r,command:t.command}));n.ledger.ranges.push(...s),n.ledger.evidence.push(...i),n.ledger.nextOrdinal+=1,n.ledger.updatedAt=new Date().toISOString(),v(n.ledgerPath,n.ledger,{spacing:2,trailingNewline:!0})}}catch{}finally{n.lock.release(),t.state=null,t.staged.length=0,t.stagedEvidence.length=0}}function Vn(e){let t=e.source.split(`
2
+ import{a as he,c as z}from"./chunk-OWJWOEDU.js";import{b as le}from"./chunk-XZEE23VG.js";import{O as P,X as v}from"./chunk-5T44HG5Y.js";import{j as de,r as b,w as pe,x as ge,y as D}from"./chunk-DUKHVPU5.js";import{AsyncLocalStorage as nt}from"async_hooks";import{createHash as V}from"crypto";import{existsSync as rt,mkdirSync as st}from"fs";import{tmpdir as it}from"os";import{isAbsolute as ot,join as ye,resolve as Se}from"path";var q=2,at="CODEBASEIQ_SESSION",me="CODEBASEIQ_SESSION_DIR",ut=128,I=new nt;function ve(e,t){let n=e.sessionEnabled===!1||e.json?void 0:It(),r={enabled:n!==void 0,reemit:e.reemit===!0,command:e.command,projectRoot:Se(e.cwd),sessionIdentity:n,staged:[],stagedEvidence:[],finalized:!1};return I.run(r,t)}function Dn(e){let t=I.getStore();!t||t.finalized||(t.generationIdentity=e)}function zn(){return I.getStore()?.staged.length??0}function qn(e){let t=I.getStore();!t||e<0||e>t.staged.length||(t.staged.length=e)}function W(e){let t=I.getStore();if(!t||t.finalized)return;t.finalized=!0;let n=t.state;if(!n){t.staged.length=0,t.stagedEvidence.length=0;return}try{if(e&&(t.staged.length>0||t.stagedEvidence.length>0)){let r=n.ledger.nextOrdinal,s=yt(t.staged).map(o=>({...o,ordinal:r,command:t.command})),i=vt(t.stagedEvidence).map(o=>({...o,ordinal:r,command:t.command}));n.ledger.ranges.push(...s),n.ledger.evidence.push(...i),n.ledger.nextOrdinal+=1,n.ledger.updatedAt=new Date().toISOString(),v(n.ledgerPath,n.ledger,{spacing:2,trailingNewline:!0})}}catch{}finally{n.lock.release(),t.state=null,t.staged.length=0,t.stagedEvidence.length=0}}function Vn(e){let t=e.source.split(`
3
3
  `);if(t.length===0)return"";let n=ct(e.relativePath,e.startLine,t,e.ownerSymbol,e.sessionPolicy??"exact-unit"),r=e.indent??" ",s=e.sourceIndent??" ",i=e.focusLines??new Set;return n.map(o=>{let a=z(e.relativePath,o.startLine,o.endLine);if(o.kind==="covered"){let p=o.ordinal===null?"this command":`session #${o.ordinal} via ${o.command}`;return[`${r}${a} [source previously emitted: ${p}; not repeated]`,...e.afterHeader??[]].join(`
4
4
  `)}let u=e.headerSuffix??"",d=o.lines.map((p,l)=>{let g=o.startLine+l,c=e.showFocusMarker===!1?"":i.has(g)?">":" ",m=e.lineNumberWidth??5;return`${s}${c}${String(he(g)).padStart(m)} ${p}`});return[`${r}${a}${u}`,...e.blankAfterHeader?[""]:[],...e.afterHeader??[],...d].join(`
5
5
  `)}).join(`
@@ -19,4 +19,4 @@ ${t.command}]
19
19
  `:`
20
20
  [codebaseiq transport complete; evaluate command coverage separately]
21
21
  `;return`${r}${e.content}${s}`}export{Ae as a,Dn as b,zn as c,qn as d,Vn as e,Wn as f,Gn as g,tr as h,nr as i,Ft as j,M as k,sn as l,Or as m,br as n};
22
- //# sourceMappingURL=chunk-AQI4N64O.js.map
22
+ //# sourceMappingURL=chunk-6FXXYYQM.js.map
@@ -1,2 +1,2 @@
1
- import{c as p}from"./chunk-HENP2O4A.js";import{a as y}from"./chunk-6VREELBC.js";import{a as h}from"./chunk-MSI3K7PJ.js";import{o as u}from"./chunk-J7AMBVWF.js";import{a as S,c as b}from"./chunk-SGMNWYTH.js";import{A as d,d as m}from"./chunk-GVAF222T.js";function x(e,o,r={}){let{direction:c="backward",maxDepth:s=3}=r,l=S(e,o);return l?c==="backward"?k(e,l,s,{semantic:r.semantic!==!1}):D(e,l,{semantic:r.semantic!==!1}):null}function j(e,o,r={}){return x(e,o,r)}function k(e,o,r,c){let s=[],l=new Set([o.symbol]),t=[o];for(let n=1;n<=r&&t.length!==0;n++){let i=[];for(let g of t){let w=h(e,g,{semantic:c.semantic,semanticEvidence:y});for(let a of w){if(l.has(a.symbol))continue;l.add(a.symbol),s.push({symbol:a.symbol,shortName:m(a.symbol),file:a.file,relationship:n===1?"referenced within definition (callee)":`depth ${n} callee`});let f=b(e,a.symbol);f&&!e.isIgnored(f.relativePath)&&i.push(f)}}t=i}return{symbol:o.symbol,shortName:m(o.symbol),direction:"backward",connectedSymbols:s}}function D(e,o,r){let c=new Set,s=[],l=new p(e);for(let t of u(e,o,{semantic:r.semantic,semanticEvidence:y})){if(s.length>=30)break;let n=t.enclosingSymbol??d(l.definitionsForFile(t.file),t.line)?.symbol??null;if(!n||n===o.symbol)continue;let i=b(e,n);!i||e.isIgnored(i.relativePath)||c.has(i.symbol)||(c.add(i.symbol),s.push({symbol:i.symbol,shortName:m(i.symbol),file:i.relativePath,relationship:`references target at ${t.file}:${t.line+1}`}))}return s.sort((t,n)=>t.file.localeCompare(n.file)),{symbol:o.symbol,shortName:m(o.symbol),direction:"forward",connectedSymbols:s}}export{x as a,j as b};
2
- //# sourceMappingURL=chunk-VWYGCMV5.js.map
1
+ import{c as p}from"./chunk-BPKNP3KZ.js";import{a as y}from"./chunk-57OPIQFM.js";import{a as h}from"./chunk-MSI3K7PJ.js";import{o as u}from"./chunk-J7AMBVWF.js";import{a as S,c as b}from"./chunk-SGMNWYTH.js";import{A as d,d as m}from"./chunk-GVAF222T.js";function x(e,o,r={}){let{direction:c="backward",maxDepth:s=3}=r,l=S(e,o);return l?c==="backward"?k(e,l,s,{semantic:r.semantic!==!1}):D(e,l,{semantic:r.semantic!==!1}):null}function j(e,o,r={}){return x(e,o,r)}function k(e,o,r,c){let s=[],l=new Set([o.symbol]),t=[o];for(let n=1;n<=r&&t.length!==0;n++){let i=[];for(let g of t){let w=h(e,g,{semantic:c.semantic,semanticEvidence:y});for(let a of w){if(l.has(a.symbol))continue;l.add(a.symbol),s.push({symbol:a.symbol,shortName:m(a.symbol),file:a.file,relationship:n===1?"referenced within definition (callee)":`depth ${n} callee`});let f=b(e,a.symbol);f&&!e.isIgnored(f.relativePath)&&i.push(f)}}t=i}return{symbol:o.symbol,shortName:m(o.symbol),direction:"backward",connectedSymbols:s}}function D(e,o,r){let c=new Set,s=[],l=new p(e);for(let t of u(e,o,{semantic:r.semantic,semanticEvidence:y})){if(s.length>=30)break;let n=t.enclosingSymbol??d(l.definitionsForFile(t.file),t.line)?.symbol??null;if(!n||n===o.symbol)continue;let i=b(e,n);!i||e.isIgnored(i.relativePath)||c.has(i.symbol)||(c.add(i.symbol),s.push({symbol:i.symbol,shortName:m(i.symbol),file:i.relativePath,relationship:`references target at ${t.file}:${t.line+1}`}))}return s.sort((t,n)=>t.file.localeCompare(n.file)),{symbol:o.symbol,shortName:m(o.symbol),direction:"forward",connectedSymbols:s}}export{x as a,j as b};
2
+ //# sourceMappingURL=chunk-AGGR2BKS.js.map
@@ -1,2 +1,2 @@
1
- import{b as i}from"./chunk-36JC5BG2.js";function l(n,o,s,t={}){let e=i(n,o,s,t);return e?{symbolA:e.symbolA,symbolB:e.symbolB,similarity:e.similarity,sharedCallees:e.sharedEvidence,uniqueToA:e.uniqueToA,uniqueToB:e.uniqueToB,consolidationStrategy:e.consolidationStrategy}:null}export{l as a};
2
- //# sourceMappingURL=chunk-FEIZXBLH.js.map
1
+ import{b as i}from"./chunk-SUE7SHZL.js";function l(n,o,s,t={}){let e=i(n,o,s,t);return e?{symbolA:e.symbolA,symbolB:e.symbolB,similarity:e.similarity,sharedCallees:e.sharedEvidence,uniqueToA:e.uniqueToA,uniqueToB:e.uniqueToB,consolidationStrategy:e.consolidationStrategy}:null}export{l as a};
2
+ //# sourceMappingURL=chunk-ALOEHWJS.js.map
@@ -1,2 +1,2 @@
1
- import{d as x}from"./chunk-YRKP7PM7.js";import{f,g as p}from"./chunk-2OMXFE64.js";import{a as L}from"./chunk-YHPG3S2U.js";import{b as D}from"./chunk-B75HZHUP.js";import{c as E}from"./chunk-HENP2O4A.js";import{a as C}from"./chunk-BGBBVSH4.js";import{a as v}from"./chunk-6VREELBC.js";import{b as y}from"./chunk-MSI3K7PJ.js";import{b}from"./chunk-SGMNWYTH.js";import{d as m,t as g}from"./chunk-GVAF222T.js";import{c as u,f as h}from"./chunk-F74LZWCE.js";var A=/^(?:validate|verify|check|assert)(?:[A-Z].*)?$/,N=/^(?:is|has)(?:[A-Z].*)?$/,I=/[{,]\s*(?:ok|success|valid|isValid)\s*:\s*false\b/,d=/\breturn\b/g,k=/\bfunction\b|=>|\)\s*(?::\s*[^{;=]+)?\s*\{/,w=/\.(?:addIssue|push)\s*\(/;function M(e,n={}){let{scope:t,limit:o=30,scanLimit:i}=n,c=new E(e),r=D(c.productionCallableDefinitions({scope:t,minLoc:1,requireFunctionLikeSymbol:!0,excludeTypesFiles:!0}),i),s=[];for(let l of r){let a=P(e,l);a&&s.push({symbol:l.symbol,shortName:m(l.symbol),file:l.relativePath,startLine:l.startLine,endLine:l.endLine,loc:C(l),...a})}return s.sort((l,a)=>l.file.localeCompare(a.file)||l.startLine-a.startLine||l.loc-a.loc),o?s.slice(0,o):s}function _(e){return A.test(e)?"imperative":N.test(e)?"predicate":null}function P(e,n){let t=_(n.leaf);if(!t||L(e,n))return null;let o=f(e,n);if(!o||!k.test(o))return null;let i=h(e,n.relativePath)?.callables.find(r=>r.startLine===n.startLine&&r.endLine===n.endLine);if(t==="predicate"&&i?.paramCount===0)return null;if(x(o)){let r=O(e,n);return!r||S(r.body,T(r.snippet))||R(r.body)?null:{nameKind:t,resolvedVia:"one-hop-delegate",delegateTarget:r.shortName}}let c=p(o);return S(c,T(o))||R(c)?null:{nameKind:t,resolvedVia:"direct"}}var F=new Set(["if","for","while","switch","catch","function"]);function R(e){let n=u(e);for(let t of n.matchAll(/\b([A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)*)\s*\(/g))if(!F.has(t[1]))return!0;return!1}function T(e){let n=e.indexOf("=>");return n===-1?!1:!/^\s*\{/.test(e.slice(n+2))}function S(e,n){let t=u(e);if(/\bthrow\b/.test(t)||/\.reject\s*\(/.test(t)||I.test(t)||w.test(t))return!0;let o=K(t);if(n&&o.length===0){let i=t.trim();return i!==""&&i!=="true"}for(let i of o)if(i!==""&&i!=="true")return!0;return!1}function K(e){let n=[];d.lastIndex=0;let t;for(;t=d.exec(e);){let o=t.index+t[0].length,i=0,c=e.length;for(let r=o;r<e.length;r+=1){let s=e[r];if(s==="("||s==="["||s==="{")i+=1;else if(s===")"||s==="]"||s==="}"){if(i===0){c=r;break}i-=1}else if(s===";"&&i===0){c=r;break}}n.push(e.slice(o,c).trim()),d.lastIndex=c}return n}function O(e,n){let t=y(e,n,{callableOnly:!0,limit:3,semanticEvidence:v});if(t.semanticIncomplete||t.semanticUnavailable)return null;let o=t.rows,i=[...new Set(o.map(a=>a.symbol))].filter(a=>a!==n.symbol);if(i.length!==1)return null;let r=b(e,i[0]).match;if(!r)return null;let s=g(e,r.relativePath).find(a=>a.symbolId===r.symbolId);if(!s)return null;let l=f(e,s);return l?{body:p(l),snippet:l,shortName:m(s.symbol)}:null}export{M as a};
2
- //# sourceMappingURL=chunk-D53LWANR.js.map
1
+ import{d as x}from"./chunk-YRKP7PM7.js";import{f,g as p}from"./chunk-2OMXFE64.js";import{a as L}from"./chunk-YHPG3S2U.js";import{b as D}from"./chunk-B75HZHUP.js";import{c as E}from"./chunk-BPKNP3KZ.js";import{a as C}from"./chunk-BGBBVSH4.js";import{a as v}from"./chunk-57OPIQFM.js";import{b as y}from"./chunk-MSI3K7PJ.js";import{b}from"./chunk-SGMNWYTH.js";import{d as m,t as g}from"./chunk-GVAF222T.js";import{c as u,f as h}from"./chunk-F74LZWCE.js";var A=/^(?:validate|verify|check|assert)(?:[A-Z].*)?$/,N=/^(?:is|has)(?:[A-Z].*)?$/,I=/[{,]\s*(?:ok|success|valid|isValid)\s*:\s*false\b/,d=/\breturn\b/g,k=/\bfunction\b|=>|\)\s*(?::\s*[^{;=]+)?\s*\{/,w=/\.(?:addIssue|push)\s*\(/;function M(e,n={}){let{scope:t,limit:o=30,scanLimit:i}=n,c=new E(e),r=D(c.productionCallableDefinitions({scope:t,minLoc:1,requireFunctionLikeSymbol:!0,excludeTypesFiles:!0}),i),s=[];for(let l of r){let a=P(e,l);a&&s.push({symbol:l.symbol,shortName:m(l.symbol),file:l.relativePath,startLine:l.startLine,endLine:l.endLine,loc:C(l),...a})}return s.sort((l,a)=>l.file.localeCompare(a.file)||l.startLine-a.startLine||l.loc-a.loc),o?s.slice(0,o):s}function _(e){return A.test(e)?"imperative":N.test(e)?"predicate":null}function P(e,n){let t=_(n.leaf);if(!t||L(e,n))return null;let o=f(e,n);if(!o||!k.test(o))return null;let i=h(e,n.relativePath)?.callables.find(r=>r.startLine===n.startLine&&r.endLine===n.endLine);if(t==="predicate"&&i?.paramCount===0)return null;if(x(o)){let r=O(e,n);return!r||S(r.body,T(r.snippet))||R(r.body)?null:{nameKind:t,resolvedVia:"one-hop-delegate",delegateTarget:r.shortName}}let c=p(o);return S(c,T(o))||R(c)?null:{nameKind:t,resolvedVia:"direct"}}var F=new Set(["if","for","while","switch","catch","function"]);function R(e){let n=u(e);for(let t of n.matchAll(/\b([A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)*)\s*\(/g))if(!F.has(t[1]))return!0;return!1}function T(e){let n=e.indexOf("=>");return n===-1?!1:!/^\s*\{/.test(e.slice(n+2))}function S(e,n){let t=u(e);if(/\bthrow\b/.test(t)||/\.reject\s*\(/.test(t)||I.test(t)||w.test(t))return!0;let o=K(t);if(n&&o.length===0){let i=t.trim();return i!==""&&i!=="true"}for(let i of o)if(i!==""&&i!=="true")return!0;return!1}function K(e){let n=[];d.lastIndex=0;let t;for(;t=d.exec(e);){let o=t.index+t[0].length,i=0,c=e.length;for(let r=o;r<e.length;r+=1){let s=e[r];if(s==="("||s==="["||s==="{")i+=1;else if(s===")"||s==="]"||s==="}"){if(i===0){c=r;break}i-=1}else if(s===";"&&i===0){c=r;break}}n.push(e.slice(o,c).trim()),d.lastIndex=c}return n}function O(e,n){let t=y(e,n,{callableOnly:!0,limit:3,semanticEvidence:v});if(t.semanticIncomplete||t.semanticUnavailable)return null;let o=t.rows,i=[...new Set(o.map(a=>a.symbol))].filter(a=>a!==n.symbol);if(i.length!==1)return null;let r=b(e,i[0]).match;if(!r)return null;let s=g(e,r.relativePath).find(a=>a.symbolId===r.symbolId);if(!s)return null;let l=f(e,s);return l?{body:p(l),snippet:l,shortName:m(s.symbol)}:null}export{M as a};
2
+ //# sourceMappingURL=chunk-AXQCHG77.js.map
@@ -1,2 +1,2 @@
1
- import{a as _}from"./chunk-NBZKSTXP.js";import{f as L,g as A}from"./chunk-2OMXFE64.js";import{a as R}from"./chunk-U7NUXDQO.js";import{b as D}from"./chunk-B75HZHUP.js";import{c as E}from"./chunk-HENP2O4A.js";import{a as w}from"./chunk-BGBBVSH4.js";import{f as I,h as x}from"./chunk-NDKOVQFG.js";import{d as N}from"./chunk-GVAF222T.js";import{b as T,c as h}from"./chunk-F74LZWCE.js";import{a as g}from"./chunk-ICUL7XRT.js";import{w as S}from"./chunk-7GAK2F3H.js";var F={caller:3,"entry-surface":2,rooted:1},O=/not\s*yet\s*implement|not\s*implement|unimplement|\bnyi\b|\btodo\b|\bstub\b|not\s*supported|coming\s*soon/i,P=/^throw\s+new\s+[\w.]*Error\s*\(([\s\S]*)\)\s*;?$/,C=/^return(\s+(null|undefined|false|0|''|""|``|\[\]|\{\}))?\s*;?$/,v=/\/\/\s*TODO\b|\/\*\s*TODO\b/i,K=/(?:=>|\))\s*(?::\s*[^{;=]+)?\s*\{\s*\}\s*;?\s*$/;function et(e,n={}){let{scope:o,limit:r=30,scanLimit:l,semantic:a=!0}=n,s=new E(e),t=D(s.productionCallableDefinitions({scope:o,minLoc:1,requireFunctionLikeSymbol:!0,excludeTypesFiles:!0}),l),c=[];for(let i of t){let m=M(e,i);m&&c.push(m)}if(c.length===0)return[];let d=j(e,c,t),f=c.filter(i=>!d.has(i.def.symbol));if(f.length===0)return[];let p=_(e,s).forDefinitions(f.map(i=>i.def),{semantic:a}),u=[];for(let i of f){let m=p.get(i.def.symbolId);if(m?.semanticIncomplete||m?.semanticUnavailable)continue;let b=m?.realConsumers.length??0,y=B(e,i.def,b);y&&u.push({symbol:i.def.symbol,shortName:N(i.def.symbol),file:i.def.relativePath,startLine:i.def.startLine,endLine:i.def.endLine,loc:w(i.def),stubKind:i.stubKind,reachability:y,callerFanIn:b,stubText:i.stubText})}return u.sort((i,m)=>F[m.reachability]-F[i.reachability]||m.callerFanIn-i.callerFanIn||i.file.localeCompare(m.file)||i.startLine-m.startLine),r?u.slice(0,r):u}function B(e,n,o){return o>0?"caller":x(e,n.symbol,n.relativePath)?"rooted":I(e,n.relativePath)?"entry-surface":null}function M(e,n){let o=L(e,n);if(!o)return null;let r=A(o),l=r.trim();if(l==="")return!z(o)||!R(e,n)?null:{def:n,stubKind:"empty-body",stubText:"(empty body)"};let a=h(r),s=T(r),t=U(a,s);if(t.length!==1)return null;let c=t[0];return $(c)?{def:n,stubKind:"throw-stub",stubText:c.trim()}:v.test(r)&&C.test(c.trim())?{def:n,stubKind:"todo-return-default",stubText:l}:null}function U(e,n){let o=[],r=0,l="";for(let a=0;a<n.length;a+=1){let s=n[a];if(s==="("||s==="["||s==="{"?r+=1:(s===")"||s==="]"||s==="}")&&(r=Math.max(0,r-1)),s===";"&&r===0){o.push(l),l="";continue}l+=e[a]??""}return l.trim()&&o.push(l),o.map(a=>a.trim()).filter(a=>a.length>0)}function $(e){let n=P.exec(e.trim());return n?O.test(n[1]??""):!1}function z(e){return K.test(e.trimEnd())}function j(e,n,o){let r=new Set,l=new Set(n.map(t=>t.def.parentTypeName).filter(t=>t!==null));if(l.size===0)return r;let a=k(e,l),s=new Map;for(let t of o){if(!t.parentTypeName)continue;let c=s.get(t.leaf)??new Set;c.add(t.parentTypeName),s.set(t.leaf,c)}for(let t of n){let c=t.def.parentTypeName;if(!c)continue;let d=a.get(c);if(!d||d.size===0)continue;let f=s.get(t.def.leaf)??new Set;[...d].every(u=>f.has(u))&&r.add(t.def.symbol)}return r}var Y=/\bclass\s+([A-Za-z_$][\w$]*)\s+extends\s+([A-Za-z_$][\w$]*)/g;function k(e,n){let o=new Map;for(let r of g(e,{includeIgnored:!1})){let l=S(e,r);if(l)for(let a of l.matchAll(Y)){let s=a[1],t=a[2];if(!s||!t||!n.has(t))continue;let c=o.get(t)??new Set;c.add(s),o.set(t,c)}}return o}export{et as a};
2
- //# sourceMappingURL=chunk-7JELP5YE.js.map
1
+ import{a as _}from"./chunk-QY7QB7I6.js";import{f as L,g as A}from"./chunk-2OMXFE64.js";import{a as R}from"./chunk-U7NUXDQO.js";import{b as D}from"./chunk-B75HZHUP.js";import{c as E}from"./chunk-BPKNP3KZ.js";import{a as w}from"./chunk-BGBBVSH4.js";import{f as I,h as x}from"./chunk-NDKOVQFG.js";import{d as N}from"./chunk-GVAF222T.js";import{b as T,c as h}from"./chunk-F74LZWCE.js";import{a as g}from"./chunk-ICUL7XRT.js";import{w as S}from"./chunk-7GAK2F3H.js";var F={caller:3,"entry-surface":2,rooted:1},O=/not\s*yet\s*implement|not\s*implement|unimplement|\bnyi\b|\btodo\b|\bstub\b|not\s*supported|coming\s*soon/i,P=/^throw\s+new\s+[\w.]*Error\s*\(([\s\S]*)\)\s*;?$/,C=/^return(\s+(null|undefined|false|0|''|""|``|\[\]|\{\}))?\s*;?$/,v=/\/\/\s*TODO\b|\/\*\s*TODO\b/i,K=/(?:=>|\))\s*(?::\s*[^{;=]+)?\s*\{\s*\}\s*;?\s*$/;function et(e,n={}){let{scope:o,limit:r=30,scanLimit:l,semantic:a=!0}=n,s=new E(e),t=D(s.productionCallableDefinitions({scope:o,minLoc:1,requireFunctionLikeSymbol:!0,excludeTypesFiles:!0}),l),c=[];for(let i of t){let m=M(e,i);m&&c.push(m)}if(c.length===0)return[];let d=j(e,c,t),f=c.filter(i=>!d.has(i.def.symbol));if(f.length===0)return[];let p=_(e,s).forDefinitions(f.map(i=>i.def),{semantic:a}),u=[];for(let i of f){let m=p.get(i.def.symbolId);if(m?.semanticIncomplete||m?.semanticUnavailable)continue;let b=m?.realConsumers.length??0,y=B(e,i.def,b);y&&u.push({symbol:i.def.symbol,shortName:N(i.def.symbol),file:i.def.relativePath,startLine:i.def.startLine,endLine:i.def.endLine,loc:w(i.def),stubKind:i.stubKind,reachability:y,callerFanIn:b,stubText:i.stubText})}return u.sort((i,m)=>F[m.reachability]-F[i.reachability]||m.callerFanIn-i.callerFanIn||i.file.localeCompare(m.file)||i.startLine-m.startLine),r?u.slice(0,r):u}function B(e,n,o){return o>0?"caller":x(e,n.symbol,n.relativePath)?"rooted":I(e,n.relativePath)?"entry-surface":null}function M(e,n){let o=L(e,n);if(!o)return null;let r=A(o),l=r.trim();if(l==="")return!z(o)||!R(e,n)?null:{def:n,stubKind:"empty-body",stubText:"(empty body)"};let a=h(r),s=T(r),t=U(a,s);if(t.length!==1)return null;let c=t[0];return $(c)?{def:n,stubKind:"throw-stub",stubText:c.trim()}:v.test(r)&&C.test(c.trim())?{def:n,stubKind:"todo-return-default",stubText:l}:null}function U(e,n){let o=[],r=0,l="";for(let a=0;a<n.length;a+=1){let s=n[a];if(s==="("||s==="["||s==="{"?r+=1:(s===")"||s==="]"||s==="}")&&(r=Math.max(0,r-1)),s===";"&&r===0){o.push(l),l="";continue}l+=e[a]??""}return l.trim()&&o.push(l),o.map(a=>a.trim()).filter(a=>a.length>0)}function $(e){let n=P.exec(e.trim());return n?O.test(n[1]??""):!1}function z(e){return K.test(e.trimEnd())}function j(e,n,o){let r=new Set,l=new Set(n.map(t=>t.def.parentTypeName).filter(t=>t!==null));if(l.size===0)return r;let a=k(e,l),s=new Map;for(let t of o){if(!t.parentTypeName)continue;let c=s.get(t.leaf)??new Set;c.add(t.parentTypeName),s.set(t.leaf,c)}for(let t of n){let c=t.def.parentTypeName;if(!c)continue;let d=a.get(c);if(!d||d.size===0)continue;let f=s.get(t.def.leaf)??new Set;[...d].every(u=>f.has(u))&&r.add(t.def.symbol)}return r}var Y=/\bclass\s+([A-Za-z_$][\w$]*)\s+extends\s+([A-Za-z_$][\w$]*)/g;function k(e,n){let o=new Map;for(let r of g(e,{includeIgnored:!1})){let l=S(e,r);if(l)for(let a of l.matchAll(Y)){let s=a[1],t=a[2];if(!s||!t||!n.has(t))continue;let c=o.get(t)??new Set;c.add(s),o.set(t,c)}}return o}export{et as a};
2
+ //# sourceMappingURL=chunk-BFANZRQ5.js.map
@@ -1,3 +1,3 @@
1
- import{b as pe,c as ne}from"./chunk-FWQGH2N2.js";import{f as ee}from"./chunk-BGGB5N53.js";import{c as me}from"./chunk-HENP2O4A.js";import{d as ue,f as fe}from"./chunk-J7AMBVWF.js";import{t as U}from"./chunk-GVAF222T.js";import{f as Z}from"./chunk-F74LZWCE.js";import{x as q}from"./chunk-7GAK2F3H.js";var Le=6;function ge(e,i,l){return`${e}\0${i}\0${l??i}`}function qe(e,i,l,a={}){let s=a.limit??Le;if(!Number.isSafeInteger(s)||s<=0)throw new RangeError(`next-anchor limit must be a positive safe integer; received ${s}`);let m=a.sourceAllowed??(()=>!0),u=new Map(i.nodes.map(t=>[t.id,t])),C=new Set(l.steps.map(t=>t.nodeId)),S=new Set(l.steps.flatMap(t=>{let g=le(u.get(t.nodeId));return g?[g]:[]})),A=new Set;for(let t of l.steps)for(let g of t.behavior?.supportingDeclarations??[])S.add(g.symbol),A.add(ge(g.file,g.line,g.endLine));let y=t=>t.symbol!==null&&S.has(t.symbol)||A.has(ge(t.file,t.line,t.endLine)),I=new Map(l.steps.flatMap(t=>{if(!t.location)return[];let g=le(u.get(t.nodeId));if(!g)return[];let x=U(e,t.location.file).find(_=>_.symbol===g);return x?[[t.id,x]]:[]})),M=new me(e).calleeMap([...I.values()],{additive:!1,semantic:!0}),o=[],f=new Set,V=new Set,T=0,D=0,j=0,$=0,G=0,B=0,r=0,N=0;for(let t of l.steps){if(!t.location||!t.behavior)continue;let g=i.edges.filter(n=>["call","runtime-boundary"].includes(n.kind)&&(n.fromNodeId===t.nodeId||n.toNodeId===t.nodeId)&&n.disposition!=="excluded"&&n.disposition!=="unsupported");for(let n of g){let d=n.toNodeId===t.nodeId,p=d?n.fromNodeId:n.toNodeId;if(C.has(p))continue;let b=u.get(p);if(!b?.location||!m(b.location.file))continue;let L=n.kind==="call"?oe(e,b):ae(b);if(!L||y(L))continue;let h=re(n,b.location.file)??b.location,w=q(e,h.file)[h.line]?.trim(),v=d?"upstream":"downstream",k=n.kind==="runtime-boundary"?d?"runtime-producer":"runtime-consumer":d?"caller":"callee",P=["call"],O=te(n.evidence),Ne=z(b);o.push({anchor:{id:R(t.id,h.line,b.id),status:O,source:"graph-relation",direction:v,causalRole:k,relationKind:n.kind,fromStepId:t.id,fromLabel:t.label,callsite:{file:h.file,line:h.line,endLine:h.endLine??h.line,text:w||`${b.label} \u2192 ${t.label}`,signals:P,calleeLeaf:Ne},alternatives:[L],alternativeCount:1,evidence:n.evidence}}),d&&(B+=1),n.kind==="runtime-boundary"&&(N+=1)}let x=i.edges.filter(n=>n.kind==="reference"&&n.fromNodeId===t.nodeId&&n.disposition!=="excluded"&&n.disposition!=="unsupported"&&!C.has(n.toNodeId));for(let n of x){let d=u.get(n.toNodeId);if(!d?.location||!m(d.location.file))continue;let p=oe(e,d);if(!p||y(p))continue;let b=z(d),L=re(n,t.location.file)?.line,h=t.behavior.lines.find(P=>(L===void 0||L>=P.line&&L<=P.endLine)&&P.text.includes(b));if(!h)continue;let w=ye(h.signals),v=w==="result-callback",k=te(n.evidence);o.push({anchor:{id:R(t.id,h.line,d.id),status:k,source:"graph-relation",direction:"downstream",causalRole:w,relationKind:"reference",fromStepId:t.id,fromLabel:t.label,callsite:{file:t.location.file,line:h.line,endLine:h.endLine,text:h.text,signals:h.signals,calleeLeaf:b},alternatives:[p],alternativeCount:1,evidence:n.evidence}}),v&&(r+=1)}let _=ne(e,t.location.file,t.location.line,t.location.endLine??t.location.line),F=q(e,t.location.file),W=ee(e,t.location.file,t.location.line,t.location.endLine??t.location.line);for(let n of _.targets){if(!m(n.definition.relativePath))continue;let d=K(t.location.file,n.sourceLine,n.calleeLeaf);if(f.has(d))continue;f.add(d);let p=ie(W.get(n.sourceLine)),b={symbol:n.definition.symbol,label:n.definition.leaf,file:n.definition.relativePath,line:n.definition.startLine,endLine:n.definition.endLine};y(b)||o.push({anchor:{id:R(t.id,n.sourceLine,n.definition.symbol),status:"exact",source:"graph-call",direction:"downstream",causalRole:"callee",relationKind:"call",fromStepId:t.id,fromLabel:t.label,callsite:{file:t.location.file,line:n.sourceLine,endLine:n.sourceLine,text:F[n.sourceLine]?.trim()||`${n.calleeLeaf}()`,signals:p,calleeLeaf:n.calleeLeaf},alternatives:[b],alternativeCount:1,evidence:[{method:"scip-occurrence-callsite",strength:"exact",identity:n.definition.symbol,location:{file:t.location.file,line:n.sourceLine}}]}})}let c=t.behavior.lines.filter(n=>n.signals.includes("call"));if(c.length===0)continue;T+=1;let E=(Z(e,t.location.file)?.callSites??[]).filter(n=>c.some(d=>n.line>=d.line&&n.line<=d.endLine));D+=E.length;let se=i.edges.filter(n=>n.kind==="call"&&n.fromNodeId===t.nodeId&&n.disposition!=="excluded"&&n.disposition!=="unsupported"),Y=new Map;for(let n of se){let d=u.get(n.toNodeId);if(!d)continue;let p=z(d);Y.set(p,(Y.get(p)??0)+1)}let ce=I.get(t.id),de=Ie(e,ce?M.get(ce.symbolId)??[]:[]),Ae=Ee(de);for(let n of de){if(!m(n.alternative.file)||y(n.alternative))continue;let d=X(n.alternative.label),p=be(E,c,d,n.row.callsiteLine,Ae.get(d)===1);if(!p)continue;let b=H(c,p.line,d);if(!b)continue;let L=K(t.location.file,p.line,d);if(f.has(L))continue;f.add(L);let h=Se(n.row.source);o.push({anchor:{id:R(t.id,p.line,n.alternative.symbol??n.alternative.file),status:h,source:"graph-call",direction:"downstream",causalRole:"callee",relationKind:"call",fromStepId:t.id,fromLabel:t.label,callsite:{file:t.location.file,line:b.line,endLine:b.endLine,text:b.text,signals:b.signals,calleeLeaf:d},alternatives:[n.alternative],alternativeCount:1,evidence:[{method:n.row.source,strength:h,identity:n.row.symbol,location:{file:t.location.file,line:p.line}}]}})}for(let n of se){if(C.has(n.toNodeId))continue;let d=u.get(n.toNodeId);if(!d?.location||!m(d.location.file))continue;let p=z(d),b=n.evidence.find(P=>{let O=P.location;return O!==null&&O.file===t.location?.file&&O.line>=0})?.location?.line,L=be(E,c,p,b,Y.get(p)===1);if(!L)continue;let h=H(c,L.line,p);if(!h)continue;let w=K(t.location.file,L.line,p);if(f.has(w))continue;f.add(w);let v=ae(d);if(!v||y(v))continue;let k=te(n.evidence);o.push({anchor:{id:R(t.id,L.line,d.id),status:k,source:"graph-call",direction:"downstream",causalRole:"callee",relationKind:"call",fromStepId:t.id,fromLabel:t.label,callsite:{file:t.location.file,line:h.line,endLine:h.endLine,text:h.text,signals:h.signals,calleeLeaf:p},alternatives:[v],alternativeCount:1,evidence:n.evidence}})}for(let n of E){let d=K(t.location.file,n.line,n.calleeLeaf);if(f.has(d))continue;let p=H(c,n.line,n.calleeLeaf);if(!p)continue;let b=ue(t.location.file,fe(e).get(n.calleeLeaf)??[]).flatMap(v=>U(e,v.file).filter(k=>k.symbol===v.symbol&&k.isFunctionLike)).filter(v=>m(v.relativePath)&&!y({symbol:v.symbol,label:v.leaf,file:v.relativePath,line:v.startLine,endLine:v.endLine})),L=Q(b.map(v=>({symbol:v.symbol,label:v.leaf??n.calleeLeaf,file:v.relativePath,line:v.startLine,endLine:v.endLine})));if(L.length===0){G+=1;continue}let h=`${t.id}\0${n.line}\0${n.calleeLeaf}`;if(V.has(h))continue;V.add(h);let w=L.length>1;w?$+=1:j+=1,o.push({anchor:{id:R(t.id,n.line,n.calleeLeaf),status:w?"ambiguous":"candidate",source:"leaf-identity-candidate",direction:"downstream",causalRole:"callee",relationKind:"call",fromStepId:t.id,fromLabel:t.label,callsite:{file:t.location.file,line:p.line,endLine:p.endLine,text:p.text,signals:p.signals,calleeLeaf:n.calleeLeaf},alternatives:L.slice(0,3),alternativeCount:L.length,evidence:[]}})}}return Ce(e,o,l.steps,s,{scannedBehaviorSteps:T,visibleCallsites:D,graphEvidencedCallsites:f.size,identityCandidateCallsites:j,ambiguousCallsites:$,unresolvedCallsites:G,upstreamCandidates:B,resultCandidates:r,runtimeCandidates:N},a.selectionTerms)}function Ue(e,i,l){let a=new Map(i.nodes.map(s=>[s.id,s]));for(let s of l.steps)if(!(!s.behavior||!s.location))for(let m of i.edges){if(m.kind!=="reference"||m.fromNodeId!==s.nodeId||m.disposition==="excluded"||m.disposition==="unsupported")continue;let u=a.get(m.toNodeId);if(!u?.location||!oe(e,u))continue;let C=z(u),S=re(m,s.location.file)?.line,A=s.behavior.lines.find(y=>(S===void 0||S>=y.line&&S<=y.endLine)&&y.text.includes(C));!A||ye(A.signals)!=="result-callback"||m.semantics?.some(({family:y,subtype:I})=>y==="control"&&I==="result-callback")||(m.semantics=[...m.semantics??[],{family:"control",subtype:"result-callback",attributes:{evidenceRole:"result-producing-callable-reference"}}])}}function ye(e){return e.includes("call")&&e.some(i=>["return","mutation","shape","spread","binding"].includes(i))?"result-callback":"callable-reference"}function ze(e,i,l={}){let a=l.limit??Le;if(!Number.isSafeInteger(a)||a<=0)throw new RangeError(`next-anchor limit must be a positive safe integer; received ${a}`);let s=l.sourceAllowed??(()=>!0),m=[],u=i.map((o,f)=>({id:o.id,nodeId:o.id,order:f,role:"anchor",kind:"source-construct",label:o.label,location:{file:o.file,line:o.startLine,endLine:o.endLine},behavior:null})),C=i.map(o=>({file:o.file,startLine:o.startLine,endLine:o.endLine})),S=0,A=0,y=0,I=0,M=0;for(let o of i){let f=q(e,o.file),T=(Z(e,o.file)?.callSites??[]).filter(r=>r.line>=o.startLine&&r.line<=o.endLine);S+=T.length;let D=ee(e,o.file,o.startLine,o.endLine),j=ne(e,o.file,o.startLine,o.endLine),$=new Set;for(let r of j.targets){if(!s(r.definition.relativePath)||C.some(x=>x.file===r.definition.relativePath&&x.startLine<=r.definition.startLine&&x.endLine>=r.definition.endLine))continue;let N=K(o.file,r.sourceLine,r.calleeLeaf);$.add(N);let t=ie(D.get(r.sourceLine)),g={symbol:r.definition.symbol,label:r.definition.leaf,file:r.definition.relativePath,line:r.definition.startLine,endLine:r.definition.endLine};m.push({anchor:{id:R(o.id,r.sourceLine,r.definition.symbol),status:"exact",source:"graph-call",direction:"downstream",causalRole:"callee",relationKind:"call",fromStepId:o.id,fromLabel:o.label,callsite:{file:o.file,line:r.sourceLine,endLine:r.sourceLine,text:f[r.sourceLine]?.trim()||`${r.calleeLeaf}()`,signals:t,calleeLeaf:r.calleeLeaf},alternatives:[g],alternativeCount:1,evidence:[{method:"scip-occurrence-callsite",strength:"exact",identity:r.definition.symbol,location:{file:o.file,line:r.sourceLine}}]}})}A+=j.resolvedCallsites;let G=pe(e,o.file,{ranges:[{startLine:o.startLine,endLine:o.endLine}]}),B=new Map;for(let r of G.targets){let N=T.find(x=>x.line===r.line)?.calleeLeaf??r.calleeLeaf,t=K(o.file,r.line,N),g=B.get(t)??[];g.push(r),B.set(t,g)}for(let[r,N]of B){if($.has(r))continue;$.add(r);let t=N.filter(c=>s(c.targetFile)&&!C.some(E=>E.file===c.targetFile&&E.startLine<=c.targetStartLine&&E.endLine>=c.targetEndLine));if(t.length===0)continue;let g=t[0],x=T.find(c=>c.line===g.line)?.calleeLeaf??g.calleeLeaf,_=ie(D.get(g.line)),F=Q(t.map(c=>({symbol:c.targetSymbol??null,label:c.calleeLeaf,file:c.targetFile,line:c.targetStartLine,endLine:c.targetEndLine}))),W=t.some(c=>(c.resolutionAlternativeCount??0)>1)?"candidate":t.every(c=>c.strength==="exact")?"exact":"derived";m.push({anchor:{id:R(o.id,g.line,F.map(c=>`${c.file}:${c.line}`).join("|")),status:F.length>1?"ambiguous":W,source:"graph-call",direction:"downstream",causalRole:"callee",relationKind:"call",fromStepId:o.id,fromLabel:o.label,callsite:{file:o.file,line:g.line,endLine:g.line,text:f[g.line]?.trim()||`${g.calleeLeaf}()`,signals:_,calleeLeaf:x},alternatives:F.slice(0,3),alternativeCount:F.length,evidence:t.map(c=>({method:c.resolution==="constructed-member-receiver"?"ast-constructed-member-callsite":c.resolution==="factory-callback-member"?"ast-factory-callback-callsite":c.resolution==="imported-service-object-member"?"ast-service-member-callsite":"ast-import-member-callsite",strength:W,identity:c.targetSymbol??`${c.targetFile}:${c.targetStartLine}-${c.targetEndLine}`,location:{file:o.file,line:g.line}}))}})}A+=B.size;for(let r of T){let N=K(o.file,r.line,r.calleeLeaf);$.has(N)||(M+=1)}}return Ce(e,m,u,a,{scannedBehaviorSteps:i.length,visibleCallsites:S,graphEvidencedCallsites:A,identityCandidateCallsites:y,ambiguousCallsites:I,unresolvedCallsites:M,upstreamCandidates:0,resultCandidates:0,runtimeCandidates:0})}function Ce(e,i,l,a,s,m=[]){let u=ke(i).sort(xe),C=u.filter(f=>we(e,f)).slice(0,a),S=new Set(C.map(f=>f.anchor.id)),A=u.filter(f=>!S.has(f.anchor.id)),y=C.map(f=>f.anchor),I=A.map(f=>f.anchor),M=Q(y.flatMap(f=>f.alternativeCount===1?f.alternatives:[])),o=Q(I.flatMap(f=>f.alternativeCount===1?f.alternatives:[]));return{anchors:y,withheldAnchors:I,candidateAnchors:u.length,omittedAnchors:Math.max(0,u.length-y.length),...s,inspectCommand:M.length===0?null:`codebaseiq inspect ${M.map(ve).join(" ")} --view behavior`,remainingInspectCommands:Me(o,8).map(f=>`codebaseiq inspect ${f.map(ve).join(" ")} --view behavior`)}}function xe(e,i){let l=e.anchor.alternatives[0],a=i.anchor.alternatives[0];return J(e.anchor.status)-J(i.anchor.status)||(e.anchor.direction??"").localeCompare(i.anchor.direction??"")||(e.anchor.relationKind??"").localeCompare(i.anchor.relationKind??"")||(e.anchor.causalRole??"").localeCompare(i.anchor.causalRole??"")||e.anchor.fromStepId.localeCompare(i.anchor.fromStepId)||e.anchor.callsite.file.localeCompare(i.anchor.callsite.file)||e.anchor.callsite.line-i.anchor.callsite.line||(l?.file??"").localeCompare(a?.file??"")||(l?.line??0)-(a?.line??0)||e.anchor.id.localeCompare(i.anchor.id)}function we(e,i){if(i.anchor.alternativeCount!==1)return!0;let l=i.anchor.alternatives[0],a=l.endLine??l.line;return q(e,l.file).slice(l.line,a+1).join(`
1
+ import{b as pe,c as ne}from"./chunk-ILGTMRMZ.js";import{f as ee}from"./chunk-BGGB5N53.js";import{c as me}from"./chunk-BPKNP3KZ.js";import{d as ue,f as fe}from"./chunk-J7AMBVWF.js";import{t as U}from"./chunk-GVAF222T.js";import{f as Z}from"./chunk-F74LZWCE.js";import{x as q}from"./chunk-7GAK2F3H.js";var Le=6;function ge(e,i,l){return`${e}\0${i}\0${l??i}`}function qe(e,i,l,a={}){let s=a.limit??Le;if(!Number.isSafeInteger(s)||s<=0)throw new RangeError(`next-anchor limit must be a positive safe integer; received ${s}`);let m=a.sourceAllowed??(()=>!0),u=new Map(i.nodes.map(t=>[t.id,t])),C=new Set(l.steps.map(t=>t.nodeId)),S=new Set(l.steps.flatMap(t=>{let g=le(u.get(t.nodeId));return g?[g]:[]})),A=new Set;for(let t of l.steps)for(let g of t.behavior?.supportingDeclarations??[])S.add(g.symbol),A.add(ge(g.file,g.line,g.endLine));let y=t=>t.symbol!==null&&S.has(t.symbol)||A.has(ge(t.file,t.line,t.endLine)),I=new Map(l.steps.flatMap(t=>{if(!t.location)return[];let g=le(u.get(t.nodeId));if(!g)return[];let x=U(e,t.location.file).find(_=>_.symbol===g);return x?[[t.id,x]]:[]})),M=new me(e).calleeMap([...I.values()],{additive:!1,semantic:!0}),o=[],f=new Set,V=new Set,T=0,D=0,j=0,$=0,G=0,B=0,r=0,N=0;for(let t of l.steps){if(!t.location||!t.behavior)continue;let g=i.edges.filter(n=>["call","runtime-boundary"].includes(n.kind)&&(n.fromNodeId===t.nodeId||n.toNodeId===t.nodeId)&&n.disposition!=="excluded"&&n.disposition!=="unsupported");for(let n of g){let d=n.toNodeId===t.nodeId,p=d?n.fromNodeId:n.toNodeId;if(C.has(p))continue;let b=u.get(p);if(!b?.location||!m(b.location.file))continue;let L=n.kind==="call"?oe(e,b):ae(b);if(!L||y(L))continue;let h=re(n,b.location.file)??b.location,w=q(e,h.file)[h.line]?.trim(),v=d?"upstream":"downstream",k=n.kind==="runtime-boundary"?d?"runtime-producer":"runtime-consumer":d?"caller":"callee",P=["call"],O=te(n.evidence),Ne=z(b);o.push({anchor:{id:R(t.id,h.line,b.id),status:O,source:"graph-relation",direction:v,causalRole:k,relationKind:n.kind,fromStepId:t.id,fromLabel:t.label,callsite:{file:h.file,line:h.line,endLine:h.endLine??h.line,text:w||`${b.label} \u2192 ${t.label}`,signals:P,calleeLeaf:Ne},alternatives:[L],alternativeCount:1,evidence:n.evidence}}),d&&(B+=1),n.kind==="runtime-boundary"&&(N+=1)}let x=i.edges.filter(n=>n.kind==="reference"&&n.fromNodeId===t.nodeId&&n.disposition!=="excluded"&&n.disposition!=="unsupported"&&!C.has(n.toNodeId));for(let n of x){let d=u.get(n.toNodeId);if(!d?.location||!m(d.location.file))continue;let p=oe(e,d);if(!p||y(p))continue;let b=z(d),L=re(n,t.location.file)?.line,h=t.behavior.lines.find(P=>(L===void 0||L>=P.line&&L<=P.endLine)&&P.text.includes(b));if(!h)continue;let w=ye(h.signals),v=w==="result-callback",k=te(n.evidence);o.push({anchor:{id:R(t.id,h.line,d.id),status:k,source:"graph-relation",direction:"downstream",causalRole:w,relationKind:"reference",fromStepId:t.id,fromLabel:t.label,callsite:{file:t.location.file,line:h.line,endLine:h.endLine,text:h.text,signals:h.signals,calleeLeaf:b},alternatives:[p],alternativeCount:1,evidence:n.evidence}}),v&&(r+=1)}let _=ne(e,t.location.file,t.location.line,t.location.endLine??t.location.line),F=q(e,t.location.file),W=ee(e,t.location.file,t.location.line,t.location.endLine??t.location.line);for(let n of _.targets){if(!m(n.definition.relativePath))continue;let d=K(t.location.file,n.sourceLine,n.calleeLeaf);if(f.has(d))continue;f.add(d);let p=ie(W.get(n.sourceLine)),b={symbol:n.definition.symbol,label:n.definition.leaf,file:n.definition.relativePath,line:n.definition.startLine,endLine:n.definition.endLine};y(b)||o.push({anchor:{id:R(t.id,n.sourceLine,n.definition.symbol),status:"exact",source:"graph-call",direction:"downstream",causalRole:"callee",relationKind:"call",fromStepId:t.id,fromLabel:t.label,callsite:{file:t.location.file,line:n.sourceLine,endLine:n.sourceLine,text:F[n.sourceLine]?.trim()||`${n.calleeLeaf}()`,signals:p,calleeLeaf:n.calleeLeaf},alternatives:[b],alternativeCount:1,evidence:[{method:"scip-occurrence-callsite",strength:"exact",identity:n.definition.symbol,location:{file:t.location.file,line:n.sourceLine}}]}})}let c=t.behavior.lines.filter(n=>n.signals.includes("call"));if(c.length===0)continue;T+=1;let E=(Z(e,t.location.file)?.callSites??[]).filter(n=>c.some(d=>n.line>=d.line&&n.line<=d.endLine));D+=E.length;let se=i.edges.filter(n=>n.kind==="call"&&n.fromNodeId===t.nodeId&&n.disposition!=="excluded"&&n.disposition!=="unsupported"),Y=new Map;for(let n of se){let d=u.get(n.toNodeId);if(!d)continue;let p=z(d);Y.set(p,(Y.get(p)??0)+1)}let ce=I.get(t.id),de=Ie(e,ce?M.get(ce.symbolId)??[]:[]),Ae=Ee(de);for(let n of de){if(!m(n.alternative.file)||y(n.alternative))continue;let d=X(n.alternative.label),p=be(E,c,d,n.row.callsiteLine,Ae.get(d)===1);if(!p)continue;let b=H(c,p.line,d);if(!b)continue;let L=K(t.location.file,p.line,d);if(f.has(L))continue;f.add(L);let h=Se(n.row.source);o.push({anchor:{id:R(t.id,p.line,n.alternative.symbol??n.alternative.file),status:h,source:"graph-call",direction:"downstream",causalRole:"callee",relationKind:"call",fromStepId:t.id,fromLabel:t.label,callsite:{file:t.location.file,line:b.line,endLine:b.endLine,text:b.text,signals:b.signals,calleeLeaf:d},alternatives:[n.alternative],alternativeCount:1,evidence:[{method:n.row.source,strength:h,identity:n.row.symbol,location:{file:t.location.file,line:p.line}}]}})}for(let n of se){if(C.has(n.toNodeId))continue;let d=u.get(n.toNodeId);if(!d?.location||!m(d.location.file))continue;let p=z(d),b=n.evidence.find(P=>{let O=P.location;return O!==null&&O.file===t.location?.file&&O.line>=0})?.location?.line,L=be(E,c,p,b,Y.get(p)===1);if(!L)continue;let h=H(c,L.line,p);if(!h)continue;let w=K(t.location.file,L.line,p);if(f.has(w))continue;f.add(w);let v=ae(d);if(!v||y(v))continue;let k=te(n.evidence);o.push({anchor:{id:R(t.id,L.line,d.id),status:k,source:"graph-call",direction:"downstream",causalRole:"callee",relationKind:"call",fromStepId:t.id,fromLabel:t.label,callsite:{file:t.location.file,line:h.line,endLine:h.endLine,text:h.text,signals:h.signals,calleeLeaf:p},alternatives:[v],alternativeCount:1,evidence:n.evidence}})}for(let n of E){let d=K(t.location.file,n.line,n.calleeLeaf);if(f.has(d))continue;let p=H(c,n.line,n.calleeLeaf);if(!p)continue;let b=ue(t.location.file,fe(e).get(n.calleeLeaf)??[]).flatMap(v=>U(e,v.file).filter(k=>k.symbol===v.symbol&&k.isFunctionLike)).filter(v=>m(v.relativePath)&&!y({symbol:v.symbol,label:v.leaf,file:v.relativePath,line:v.startLine,endLine:v.endLine})),L=Q(b.map(v=>({symbol:v.symbol,label:v.leaf??n.calleeLeaf,file:v.relativePath,line:v.startLine,endLine:v.endLine})));if(L.length===0){G+=1;continue}let h=`${t.id}\0${n.line}\0${n.calleeLeaf}`;if(V.has(h))continue;V.add(h);let w=L.length>1;w?$+=1:j+=1,o.push({anchor:{id:R(t.id,n.line,n.calleeLeaf),status:w?"ambiguous":"candidate",source:"leaf-identity-candidate",direction:"downstream",causalRole:"callee",relationKind:"call",fromStepId:t.id,fromLabel:t.label,callsite:{file:t.location.file,line:p.line,endLine:p.endLine,text:p.text,signals:p.signals,calleeLeaf:n.calleeLeaf},alternatives:L.slice(0,3),alternativeCount:L.length,evidence:[]}})}}return Ce(e,o,l.steps,s,{scannedBehaviorSteps:T,visibleCallsites:D,graphEvidencedCallsites:f.size,identityCandidateCallsites:j,ambiguousCallsites:$,unresolvedCallsites:G,upstreamCandidates:B,resultCandidates:r,runtimeCandidates:N},a.selectionTerms)}function Ue(e,i,l){let a=new Map(i.nodes.map(s=>[s.id,s]));for(let s of l.steps)if(!(!s.behavior||!s.location))for(let m of i.edges){if(m.kind!=="reference"||m.fromNodeId!==s.nodeId||m.disposition==="excluded"||m.disposition==="unsupported")continue;let u=a.get(m.toNodeId);if(!u?.location||!oe(e,u))continue;let C=z(u),S=re(m,s.location.file)?.line,A=s.behavior.lines.find(y=>(S===void 0||S>=y.line&&S<=y.endLine)&&y.text.includes(C));!A||ye(A.signals)!=="result-callback"||m.semantics?.some(({family:y,subtype:I})=>y==="control"&&I==="result-callback")||(m.semantics=[...m.semantics??[],{family:"control",subtype:"result-callback",attributes:{evidenceRole:"result-producing-callable-reference"}}])}}function ye(e){return e.includes("call")&&e.some(i=>["return","mutation","shape","spread","binding"].includes(i))?"result-callback":"callable-reference"}function ze(e,i,l={}){let a=l.limit??Le;if(!Number.isSafeInteger(a)||a<=0)throw new RangeError(`next-anchor limit must be a positive safe integer; received ${a}`);let s=l.sourceAllowed??(()=>!0),m=[],u=i.map((o,f)=>({id:o.id,nodeId:o.id,order:f,role:"anchor",kind:"source-construct",label:o.label,location:{file:o.file,line:o.startLine,endLine:o.endLine},behavior:null})),C=i.map(o=>({file:o.file,startLine:o.startLine,endLine:o.endLine})),S=0,A=0,y=0,I=0,M=0;for(let o of i){let f=q(e,o.file),T=(Z(e,o.file)?.callSites??[]).filter(r=>r.line>=o.startLine&&r.line<=o.endLine);S+=T.length;let D=ee(e,o.file,o.startLine,o.endLine),j=ne(e,o.file,o.startLine,o.endLine),$=new Set;for(let r of j.targets){if(!s(r.definition.relativePath)||C.some(x=>x.file===r.definition.relativePath&&x.startLine<=r.definition.startLine&&x.endLine>=r.definition.endLine))continue;let N=K(o.file,r.sourceLine,r.calleeLeaf);$.add(N);let t=ie(D.get(r.sourceLine)),g={symbol:r.definition.symbol,label:r.definition.leaf,file:r.definition.relativePath,line:r.definition.startLine,endLine:r.definition.endLine};m.push({anchor:{id:R(o.id,r.sourceLine,r.definition.symbol),status:"exact",source:"graph-call",direction:"downstream",causalRole:"callee",relationKind:"call",fromStepId:o.id,fromLabel:o.label,callsite:{file:o.file,line:r.sourceLine,endLine:r.sourceLine,text:f[r.sourceLine]?.trim()||`${r.calleeLeaf}()`,signals:t,calleeLeaf:r.calleeLeaf},alternatives:[g],alternativeCount:1,evidence:[{method:"scip-occurrence-callsite",strength:"exact",identity:r.definition.symbol,location:{file:o.file,line:r.sourceLine}}]}})}A+=j.resolvedCallsites;let G=pe(e,o.file,{ranges:[{startLine:o.startLine,endLine:o.endLine}]}),B=new Map;for(let r of G.targets){let N=T.find(x=>x.line===r.line)?.calleeLeaf??r.calleeLeaf,t=K(o.file,r.line,N),g=B.get(t)??[];g.push(r),B.set(t,g)}for(let[r,N]of B){if($.has(r))continue;$.add(r);let t=N.filter(c=>s(c.targetFile)&&!C.some(E=>E.file===c.targetFile&&E.startLine<=c.targetStartLine&&E.endLine>=c.targetEndLine));if(t.length===0)continue;let g=t[0],x=T.find(c=>c.line===g.line)?.calleeLeaf??g.calleeLeaf,_=ie(D.get(g.line)),F=Q(t.map(c=>({symbol:c.targetSymbol??null,label:c.calleeLeaf,file:c.targetFile,line:c.targetStartLine,endLine:c.targetEndLine}))),W=t.some(c=>(c.resolutionAlternativeCount??0)>1)?"candidate":t.every(c=>c.strength==="exact")?"exact":"derived";m.push({anchor:{id:R(o.id,g.line,F.map(c=>`${c.file}:${c.line}`).join("|")),status:F.length>1?"ambiguous":W,source:"graph-call",direction:"downstream",causalRole:"callee",relationKind:"call",fromStepId:o.id,fromLabel:o.label,callsite:{file:o.file,line:g.line,endLine:g.line,text:f[g.line]?.trim()||`${g.calleeLeaf}()`,signals:_,calleeLeaf:x},alternatives:F.slice(0,3),alternativeCount:F.length,evidence:t.map(c=>({method:c.resolution==="constructed-member-receiver"?"ast-constructed-member-callsite":c.resolution==="factory-callback-member"?"ast-factory-callback-callsite":c.resolution==="imported-service-object-member"?"ast-service-member-callsite":"ast-import-member-callsite",strength:W,identity:c.targetSymbol??`${c.targetFile}:${c.targetStartLine}-${c.targetEndLine}`,location:{file:o.file,line:g.line}}))}})}A+=B.size;for(let r of T){let N=K(o.file,r.line,r.calleeLeaf);$.has(N)||(M+=1)}}return Ce(e,m,u,a,{scannedBehaviorSteps:i.length,visibleCallsites:S,graphEvidencedCallsites:A,identityCandidateCallsites:y,ambiguousCallsites:I,unresolvedCallsites:M,upstreamCandidates:0,resultCandidates:0,runtimeCandidates:0})}function Ce(e,i,l,a,s,m=[]){let u=ke(i).sort(xe),C=u.filter(f=>we(e,f)).slice(0,a),S=new Set(C.map(f=>f.anchor.id)),A=u.filter(f=>!S.has(f.anchor.id)),y=C.map(f=>f.anchor),I=A.map(f=>f.anchor),M=Q(y.flatMap(f=>f.alternativeCount===1?f.alternatives:[])),o=Q(I.flatMap(f=>f.alternativeCount===1?f.alternatives:[]));return{anchors:y,withheldAnchors:I,candidateAnchors:u.length,omittedAnchors:Math.max(0,u.length-y.length),...s,inspectCommand:M.length===0?null:`codebaseiq inspect ${M.map(ve).join(" ")} --view behavior`,remainingInspectCommands:Me(o,8).map(f=>`codebaseiq inspect ${f.map(ve).join(" ")} --view behavior`)}}function xe(e,i){let l=e.anchor.alternatives[0],a=i.anchor.alternatives[0];return J(e.anchor.status)-J(i.anchor.status)||(e.anchor.direction??"").localeCompare(i.anchor.direction??"")||(e.anchor.relationKind??"").localeCompare(i.anchor.relationKind??"")||(e.anchor.causalRole??"").localeCompare(i.anchor.causalRole??"")||e.anchor.fromStepId.localeCompare(i.anchor.fromStepId)||e.anchor.callsite.file.localeCompare(i.anchor.callsite.file)||e.anchor.callsite.line-i.anchor.callsite.line||(l?.file??"").localeCompare(a?.file??"")||(l?.line??0)-(a?.line??0)||e.anchor.id.localeCompare(i.anchor.id)}function we(e,i){if(i.anchor.alternativeCount!==1)return!0;let l=i.anchor.alternatives[0],a=l.endLine??l.line;return q(e,l.file).slice(l.line,a+1).join(`
2
2
  `).length<=2e4}function ie(e){return e?.includes("call")?[...e]:["call",...e??[]]}function Ie(e,i){let l=new Map;for(let a of i){let s=U(e,a.file).find(C=>C.symbol===a.symbol&&C.isFunctionLike);if(!s)continue;let m={symbol:s.symbol,label:s.leaf,file:s.relativePath,line:s.startLine,endLine:s.endLine},u=l.get(s.symbol);!u||he(a.source)>he(u.row.source)?l.set(s.symbol,{row:{...a,...a.callsiteLine===void 0&&u?.row.callsiteLine!==void 0?{callsiteLine:u.row.callsiteLine}:{}},alternative:m}):u.row.callsiteLine===void 0&&a.callsiteLine!==void 0&&l.set(s.symbol,{...u,row:{...u.row,callsiteLine:a.callsiteLine}})}return[...l.values()]}function Ee(e){let i=new Map;for(let l of e){let a=X(l.alternative.label);i.set(a,(i.get(a)??0)+1)}return i}function Se(e){return e==="semantic-callee"||e==="scip-chunk"?"exact":"derived"}function he(e){return Se(e)==="exact"?2:1}function H(e,i,l){return e.find(a=>i>=a.line&&i<=a.endLine&&a.text.includes(l))??e.find(a=>i>=a.line&&i<=a.endLine)??null}function be(e,i,l,a,s){if(a!==void 0)return e.find(u=>u.line===a&&u.calleeLeaf===l&&H(i,u.line,l)!==null)??null;let m=e.filter(u=>u.calleeLeaf===l&&H(i,u.line,u.calleeLeaf)!==null);return s&&m.length===1?m[0]:null}function z(e){let i=e.attributes.leaf;if(typeof i=="string"&&i.length>0)return X(i);let l=e.label.slice(e.label.lastIndexOf(":")+1);return X(l)}function X(e){return e.replace(/\(\)$/u,"").replace(/^#/u,"")}function le(e){if(e?.kind!=="symbol"||!e.id.startsWith("symbol:"))return null;try{return decodeURIComponent(e.id.slice(7))}catch{return null}}function ae(e){return e.location?{symbol:le(e),label:e.label,file:e.location.file,line:e.location.line,endLine:e.location.endLine??null}:null}function oe(e,i){let l=ae(i);return l?.symbol&&U(e,l.file).some(s=>s.symbol===l.symbol&&s.isFunctionLike)?l:null}function re(e,i){return e.evidence.find(l=>l.location?.file===i)?.location??e.evidence.find(l=>l.location!==null)?.location??null}function te(e){let i={exact:5,derived:4,mixed:3,candidate:2,unknown:1};return e.reduce((l,a)=>i[a.strength]>i[l]?a.strength:l,"unknown")}function ke(e){let i=new Map;for(let l of e){let s=l.anchor.alternatives[0]?.symbol??`${l.anchor.callsite.file}:${l.anchor.callsite.line}:${l.anchor.callsite.calleeLeaf}`,m=i.get(s);(!m||Re(l,m)<0)&&i.set(s,l)}return[...i.values()]}function Re(e,i){return J(e.anchor.status)-J(i.anchor.status)||e.anchor.alternativeCount-i.anchor.alternativeCount||xe(e,i)}function J(e){return{exact:0,derived:1,mixed:2,candidate:3,unknown:4,ambiguous:5}[e]}function Q(e){let i=new Map;for(let l of e)i.set(l.symbol??`${l.file}:${l.line}`,l);return[...i.values()].sort((l,a)=>l.file.localeCompare(a.file)||l.line-a.line||l.label.localeCompare(a.label))}function ve(e){return`--at ${Te(`${e.file}:${e.line+1}`)}`}function Me(e,i){let l=[];for(let a=0;a<e.length;a+=i)l.push(e.slice(a,a+i));return l}function Te(e){return`'${e.replaceAll("'","'\\''")}'`}function K(e,i,l){return`${e}\0${i}\0${l}`}function R(e,i,l){return["next-anchor",e,String(i),l].map(encodeURIComponent).join(":")}export{qe as a,Ue as b,ze as c};
3
- //# sourceMappingURL=chunk-5IZRKWTZ.js.map
3
+ //# sourceMappingURL=chunk-BGYRF5YX.js.map