@qwen-code/qwen-code 0.19.9-nightly.20260714.9dd8389eb → 0.19.10

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 (194) hide show
  1. package/bundled/qc-helper/docs/configuration/settings.md +6 -0
  2. package/bundled/qc-helper/docs/features/sub-agents.md +21 -0
  3. package/bundled/qc-helper/docs/qwen-serve.md +7 -2
  4. package/bundled/review/SKILL.md +23 -11
  5. package/chunks/{MaxSizedBox-QAYHOC4F.js → MaxSizedBox-67ODZ4SZ.js} +5 -6
  6. package/chunks/{StandaloneSessionPicker-D3R6YYX3.js → StandaloneSessionPicker-SIPBQT5Z.js} +17 -18
  7. package/chunks/{acpAgent-ENHBW72A.js → acpAgent-VPZJXLFX.js} +141 -80
  8. package/chunks/{agent-57LX4KMG.js → agent-Z7NWL6XL.js} +2 -3
  9. package/chunks/{agent-headless-AC6EVNAP.js → agent-headless-73HZ6ROQ.js} +2 -3
  10. package/chunks/{bridge-4OZH44MK.js → bridge-XFKW6S7Q.js} +5 -6
  11. package/chunks/{chunk-DPSWJWZI.js → chunk-2W3OOD4W.js} +1 -0
  12. package/chunks/{chunk-FDL4PB5H.js → chunk-3XJFUTNM.js} +8 -8
  13. package/chunks/{chunk-AAS2Q2TV.js → chunk-422XAKCK.js} +2 -2
  14. package/chunks/{chunk-7U7UIO5W.js → chunk-4FMG7EDJ.js} +19 -4
  15. package/chunks/{chunk-X7EBAABW.js → chunk-4YWLED2A.js} +1 -1
  16. package/chunks/{chunk-WN4D7YCI.js → chunk-5EBKKSBX.js} +1 -1
  17. package/chunks/{chunk-G6QTKQN4.js → chunk-5LROA5W4.js} +3 -3
  18. package/chunks/{chunk-SUWGUGAD.js → chunk-65N2J6V2.js} +2 -2
  19. package/chunks/{chunk-T2L6SGQY.js → chunk-6GETGQWP.js} +26 -6
  20. package/chunks/{chunk-T5C2OUCI.js → chunk-6GKMJPOC.js} +3 -3
  21. package/chunks/{chunk-K3PPUB46.js → chunk-6W6DI34P.js} +1 -1
  22. package/chunks/{chunk-WM5HY72H.js → chunk-7L4XBYVW.js} +2 -2
  23. package/chunks/{chunk-CLTWL6HD.js → chunk-7MJAZMXK.js} +5 -5
  24. package/chunks/{chunk-6HHAADP2.js → chunk-AAR5SGMD.js} +4 -4
  25. package/chunks/{chunk-P3S67A5R.js → chunk-B5I2IIWY.js} +3 -3
  26. package/chunks/{chunk-4DYYRLIE.js → chunk-CEW4HDPK.js} +639 -317
  27. package/chunks/{chunk-JR63TOV4.js → chunk-CJFNEBYB.js} +1 -1
  28. package/chunks/{chunk-PMRH4YYW.js → chunk-CUUXANEQ.js} +2 -1
  29. package/chunks/{chunk-Z56JO4JZ.js → chunk-DK33QJ3V.js} +6 -6
  30. package/chunks/{chunk-N7FCSERB.js → chunk-DPFBNG72.js} +1 -1
  31. package/chunks/{chunk-HZYUNZDQ.js → chunk-EQY6POVO.js} +1 -1
  32. package/chunks/{chunk-MBJ3D6SF.js → chunk-F7NXQH4Y.js} +1 -1
  33. package/chunks/{chunk-C4CXFRKY.js → chunk-FXMC7SL2.js} +25 -4
  34. package/chunks/{chunk-CSACSGAW.js → chunk-GGJII3FM.js} +2 -2
  35. package/chunks/{chunk-EU3U7USF.js → chunk-H3FQOPPS.js} +2 -2
  36. package/chunks/{chunk-YVEDCAUE.js → chunk-HGT6JR3U.js} +19 -0
  37. package/chunks/{chunk-MBP3K324.js → chunk-HHEFI4RP.js} +32 -11
  38. package/chunks/{chunk-B6ABUBYY.js → chunk-JSJFKYWT.js} +67 -5
  39. package/chunks/{chunk-QABSSDQH.js → chunk-K4PZ5F5T.js} +1 -1
  40. package/chunks/{chunk-SSFDPGFN.js → chunk-K7CRWKOE.js} +7879 -5472
  41. package/chunks/{chunk-J2TDDOSM.js → chunk-L37RC7MQ.js} +1 -1
  42. package/chunks/{chunk-V75IOTWF.js → chunk-L62SEJWY.js} +4 -4
  43. package/chunks/{chunk-HE54PGVI.js → chunk-LNUXFLLJ.js} +2 -2
  44. package/chunks/{chunk-PHYCWSDG.js → chunk-LQU7EVFA.js} +1 -1
  45. package/chunks/{chunk-AUGSSJX3.js → chunk-LTNI523B.js} +2 -2
  46. package/chunks/{chunk-4LJNI7MU.js → chunk-MO7O5722.js} +262 -7
  47. package/chunks/{chunk-S2QXYLUB.js → chunk-N6FXRR6P.js} +1 -1
  48. package/chunks/{chunk-WL4L7EZH.js → chunk-OA4JVLSA.js} +27 -1
  49. package/chunks/{chunk-XHW5VUIQ.js → chunk-OFEVHGVU.js} +157 -55
  50. package/chunks/{chunk-T7FSRWQ5.js → chunk-P6LART6G.js} +107 -6
  51. package/chunks/{chunk-GYGGUR4Q.js → chunk-Q5GLXH5Q.js} +3 -3
  52. package/chunks/{chunk-SE74CIZD.js → chunk-RDRVMDWV.js} +1 -1
  53. package/chunks/{chunk-DKXW66XA.js → chunk-SPUYQB4T.js} +1 -1
  54. package/chunks/{chunk-AGBFWLA5.js → chunk-TISZXPAX.js} +1 -1
  55. package/chunks/{chunk-ZLM3KXBT.js → chunk-TTUO4DNG.js} +14 -13
  56. package/chunks/{chunk-4QOPEEL2.js → chunk-UFOKA4PR.js} +1 -1
  57. package/chunks/{chunk-2MF6ICOL.js → chunk-V7EQTZYR.js} +36 -8
  58. package/chunks/{chunk-WWQ3QIJS.js → chunk-VBRRNQB7.js} +10 -10
  59. package/chunks/{chunk-OCC3UTWA.js → chunk-W34A5MJH.js} +1 -1
  60. package/chunks/{chunk-LAM6CGP5.js → chunk-WDW64OW3.js} +3 -3
  61. package/chunks/{chunk-DMTQY5GY.js → chunk-WDWJ4OQJ.js} +3 -3
  62. package/chunks/{chunk-B6KHOCU7.js → chunk-WIASPMLX.js} +8 -8
  63. package/chunks/{chunk-4FPUAYTT.js → chunk-WLXYAKV7.js} +4 -4
  64. package/chunks/{chunk-YWUK7OS7.js → chunk-WTSXKLG5.js} +1 -1
  65. package/chunks/{chunk-7BIZARI2.js → chunk-X362TMXZ.js} +4 -4
  66. package/chunks/{chunk-ASVORVFT.js → chunk-XLIRF7IK.js} +1 -1
  67. package/chunks/{chunk-DNKX35GS.js → chunk-XXJKGHZV.js} +4 -4
  68. package/chunks/{chunk-UI3W56WF.js → chunk-YU56QGXX.js} +1 -1
  69. package/chunks/{chunk-RJL5T4WJ.js → chunk-YX4LLZ3D.js} +47 -35
  70. package/chunks/{chunk-YH4J5XI3.js → chunk-YYPXHMWO.js} +4 -4
  71. package/chunks/{chunk-AAWKZ5R7.js → chunk-ZKMGAFYV.js} +1 -1
  72. package/chunks/{chunk-EUNRLYJG.js → chunk-ZQTZXVHP.js} +4 -4
  73. package/chunks/{computer-use-DIP5BWXP.js → computer-use-IYTX45WA.js} +2 -3
  74. package/chunks/{contextCommand-QU4GJWWD.js → contextCommand-272V77WU.js} +4 -5
  75. package/chunks/{create-sub-session-TCLIYVGR.js → create-sub-session-CBJMQLYP.js} +2 -3
  76. package/chunks/{daemon-CEZ27OH4.js → daemon-RNGFPMAB.js} +315 -36
  77. package/chunks/{daemon-status-provider-SIBFMLBQ.js → daemon-status-provider-L4STG5VO.js} +9 -10
  78. package/chunks/{earlyInputCapture-L66BEG2C.js → earlyInputCapture-EN4BRREQ.js} +2 -3
  79. package/chunks/{edit-Y5LAJSST.js → edit-OMAF2QDR.js} +2 -3
  80. package/chunks/{enter-worktree-X5LML7T4.js → enter-worktree-BBZX52HG.js} +2 -3
  81. package/chunks/{enterPlanMode-XWF32QOW.js → enterPlanMode-5NNFMBUY.js} +2 -3
  82. package/chunks/{environment-YVMA5F4I.js → environment-7TEWMJYN.js} +4 -5
  83. package/chunks/{errors-4Y5SUAOC.js → errors-I4VKVX3F.js} +4 -5
  84. package/chunks/{exit-worktree-SFHU7XYC.js → exit-worktree-FUWRJI33.js} +2 -3
  85. package/chunks/{exitPlanMode-FP3NAN6E.js → exitPlanMode-IHCJ5EEI.js} +2 -3
  86. package/chunks/{fast-path-ZJNFFCBM.js → fast-path-ZA57TOH4.js} +2 -2
  87. package/chunks/{gemini-5CAB22BI.js → gemini-UOAKVXBG.js} +91 -33
  88. package/chunks/{geminiContentGenerator-GE3HPIFB.js → geminiContentGenerator-G6UCE6MW.js} +1 -1
  89. package/chunks/{glob-YPACZAEL.js → glob-4GJQ2UFF.js} +2 -3
  90. package/chunks/{grep-IPR4XW37.js → grep-5QSYXF2E.js} +2 -3
  91. package/chunks/{handleAutoUpdate-P2KEP56V.js → handleAutoUpdate-ULHNWL6R.js} +6 -7
  92. package/chunks/{i18n-BRCT66AA.js → i18n-CYDUTF6F.js} +3 -4
  93. package/chunks/{initializer-34HXSK3A.js → initializer-NRFKUGIO.js} +7 -8
  94. package/chunks/{installationInfo-WOTDQMSC.js → installationInfo-WELKRHHE.js} +3 -4
  95. package/chunks/{list-XOGP7UPP.js → list-JVDXEG2E.js} +10 -11
  96. package/chunks/{loadedSettingsAdapter-L4YKGU6F.js → loadedSettingsAdapter-WAM4VUTG.js} +7 -8
  97. package/chunks/{mcp-HH7DIP7Y.js → mcp-YHOZN3ZM.js} +7 -8
  98. package/chunks/{monitor-25DEBT6U.js → monitor-R7XZPJHQ.js} +2 -3
  99. package/chunks/{nonInteractiveCli-CT3VSSLK.js → nonInteractiveCli-NSOB6D74.js} +34 -35
  100. package/chunks/{notebook-edit-TAVXSWQ6.js → notebook-edit-6RNKE2L2.js} +2 -3
  101. package/chunks/{openaiContentGenerator-6I7DKUAN.js → openaiContentGenerator-XNS5S64I.js} +2 -2
  102. package/chunks/{pidfile-SIQGCFLZ.js → pidfile-XE4RRR2P.js} +2 -3
  103. package/chunks/{qwenContentGenerator-5DDIXI2N.js → qwenContentGenerator-APDPJ3VN.js} +3 -4
  104. package/chunks/{read-file-WDOAYRFU.js → read-file-XSUWXSR7.js} +1 -1
  105. package/chunks/{ripGrep-MI7PHN3Q.js → ripGrep-APB3CDMU.js} +2 -3
  106. package/chunks/{run-qwen-serve-PNTYF3RE.js → run-qwen-serve-NWTGPERT.js} +224 -75
  107. package/chunks/{runtime-V3FBMUTG.js → runtime-EIO3NQKR.js} +8 -9
  108. package/chunks/{scheduler-4TAUIJBM.js → scheduler-JJDZBDRN.js} +2 -3
  109. package/chunks/{serve-WB2TR7XM.js → serve-WTIPB3EI.js} +7 -8
  110. package/chunks/{server-AF6LNFPK.js → server-NJPHQHLH.js} +2458 -755
  111. package/chunks/{session-BIGK4NRW.js → session-O4AO7FTS.js} +35 -36
  112. package/chunks/{settings-IXF5FIQO.js → settings-HQNDK7TG.js} +6 -7
  113. package/chunks/{shell-5VWJ2PPG.js → shell-UIXM6PWG.js} +2 -3
  114. package/chunks/{skill-SI667Y3B.js → skill-3XMB4ULV.js} +1 -1
  115. package/chunks/{spawnChannel-IKX6DD7J.js → spawnChannel-3R632QRM.js} +4 -5
  116. package/chunks/{src-55DZWDAK.js → src-USZKPUOC.js} +33 -4
  117. package/chunks/{standalone-update-MHLSFHE6.js → standalone-update-L5XW3D7K.js} +4 -5
  118. package/chunks/{startInteractiveUI-V2EDWLAX.js → startInteractiveUI-CPZOL2WB.js} +174 -122
  119. package/chunks/{team-create-IZAMLBJS.js → team-create-XXPRF3IQ.js} +2 -3
  120. package/chunks/{team-plan-approval-3R4RCKCP.js → team-plan-approval-EOTTKHDW.js} +2 -3
  121. package/chunks/{theme-manager-LCOXZ5DO.js → theme-manager-P6UITO2L.js} +2 -3
  122. package/chunks/{tool-search-NYNCD5LF.js → tool-search-DDNGK2LR.js} +1 -1
  123. package/chunks/{total-session-admission-PJWGOMQE.js → total-session-admission-PL5N7DNY.js} +5 -6
  124. package/chunks/{trustedFolders-DOJDHNYP.js → trustedFolders-C5LMF3UR.js} +3 -4
  125. package/chunks/types-ML3TRJQ5.js +16 -0
  126. package/chunks/{updateCheck-ZXL66KIG.js → updateCheck-QTVVISH7.js} +4 -5
  127. package/chunks/{validateNonInterActiveAuth-JSNJZCYY.js → validateNonInterActiveAuth-RY4RKBQG.js} +30 -31
  128. package/chunks/{version-3NLBENG5.js → version-U45RYOSD.js} +1 -1
  129. package/chunks/{workflow-BQYLF7XP.js → workflow-TCIAQYOA.js} +3 -4
  130. package/chunks/{workspace-providers-status-FA2DGEZW.js → workspace-providers-status-I3G2HYLY.js} +10 -11
  131. package/chunks/{workspace-registration-store-TARTAGMI.js → workspace-registration-store-IH5GLZ6Y.js} +1 -1
  132. package/chunks/{workspace-registry-AGE7WAXX.js → workspace-registry-QEKBELIX.js} +5 -6
  133. package/chunks/{workspace-service-ERC5VR2B.js → workspace-service-ORKHGLP3.js} +17 -14
  134. package/chunks/{workspace-skills-status-FKYWGNCN.js → workspace-skills-status-D7QCNDYY.js} +9 -10
  135. package/chunks/{write-file-S47KSK7Z.js → write-file-JGRQR5VM.js} +2 -3
  136. package/cli.js +11 -11
  137. package/package.json +3 -3
  138. package/web-shell/assets/{arc-Zj4EkBUY.js → arc-CUeDlxvE.js} +1 -1
  139. package/web-shell/assets/{architectureDiagram-3BPJPVTR-DAk1Ua3Y.js → architectureDiagram-3BPJPVTR-PiUszkQA.js} +1 -1
  140. package/web-shell/assets/{blockDiagram-GPEHLZMM-DBNqUthM.js → blockDiagram-GPEHLZMM-s2wYSO7e.js} +1 -1
  141. package/web-shell/assets/{c4Diagram-AAUBKEIU-Dq5QGJ53.js → c4Diagram-AAUBKEIU-DyLxZoz9.js} +1 -1
  142. package/web-shell/assets/channel-DkuJJ0qd.js +1 -0
  143. package/web-shell/assets/{chunk-2J33WTMH-DY0AeGru.js → chunk-2J33WTMH-Dsdai7Tk.js} +1 -1
  144. package/web-shell/assets/{chunk-4BX2VUAB-COX3OyIi.js → chunk-4BX2VUAB-DEosOjV7.js} +1 -1
  145. package/web-shell/assets/{chunk-55IACEB6-Csoyddbh.js → chunk-55IACEB6-sNsRLTXf.js} +1 -1
  146. package/web-shell/assets/{chunk-727SXJPM-BJPONdxX.js → chunk-727SXJPM-DkRNZzmh.js} +1 -1
  147. package/web-shell/assets/{chunk-AQP2D5EJ-syLVH6fg.js → chunk-AQP2D5EJ-BrsRNpzd.js} +1 -1
  148. package/web-shell/assets/{chunk-FMBD7UC4-Cfm59Nhw.js → chunk-FMBD7UC4-CI039lpl.js} +1 -1
  149. package/web-shell/assets/{chunk-ND2GUHAM-DZf6tAqS.js → chunk-ND2GUHAM-M-pkeIfu.js} +1 -1
  150. package/web-shell/assets/{chunk-QZHKN3VN-DKBp_v5q.js → chunk-QZHKN3VN-C4ckGNbH.js} +1 -1
  151. package/web-shell/assets/classDiagram-4FO5ZUOK-CwqHc0TB.js +1 -0
  152. package/web-shell/assets/classDiagram-v2-Q7XG4LA2-CwqHc0TB.js +1 -0
  153. package/web-shell/assets/{cose-bilkent-S5V4N54A-DUU3mMQ5.js → cose-bilkent-S5V4N54A-BciKUAFq.js} +1 -1
  154. package/web-shell/assets/{dagre-BM42HDAG-BUgNfbh-.js → dagre-BM42HDAG-C1nTSgU6.js} +1 -1
  155. package/web-shell/assets/{diagram-2AECGRRQ-DT7MVfAg.js → diagram-2AECGRRQ-BDPNWr1m.js} +1 -1
  156. package/web-shell/assets/{diagram-5GNKFQAL-Cv4YG-ec.js → diagram-5GNKFQAL-CNFhTszL.js} +1 -1
  157. package/web-shell/assets/{diagram-KO2AKTUF-BAe9LLkn.js → diagram-KO2AKTUF-CjPa4p5a.js} +1 -1
  158. package/web-shell/assets/{diagram-LMA3HP47-DW8wqTIP.js → diagram-LMA3HP47-ZzPykSyG.js} +1 -1
  159. package/web-shell/assets/{diagram-OG6HWLK6-CmkuWbaK.js → diagram-OG6HWLK6-0UVtZ9A4.js} +1 -1
  160. package/web-shell/assets/{erDiagram-TEJ5UH35-DwvdHjZ9.js → erDiagram-TEJ5UH35-CajDZCat.js} +1 -1
  161. package/web-shell/assets/{flowDiagram-I6XJVG4X-CSsXrhW_.js → flowDiagram-I6XJVG4X-BRuFBIvL.js} +1 -1
  162. package/web-shell/assets/{ganttDiagram-6RSMTGT7-BtuznCdi.js → ganttDiagram-6RSMTGT7-BevGmJqG.js} +1 -1
  163. package/web-shell/assets/{gitGraphDiagram-PVQCEYII-DGmAm06g.js → gitGraphDiagram-PVQCEYII-DvPMpBMb.js} +1 -1
  164. package/web-shell/assets/index-Cnvv4VcI.css +5 -0
  165. package/web-shell/assets/index-D1Uyklxa.js +1088 -0
  166. package/web-shell/assets/{index-BEtz1cvN.js → index-DzHwQkQq.js} +1 -1
  167. package/web-shell/assets/{infoDiagram-5YYISTIA-OAiZ1q0K.js → infoDiagram-5YYISTIA-Oixn7tA9.js} +1 -1
  168. package/web-shell/assets/{ishikawaDiagram-YF4QCWOH-DyK0KTIT.js → ishikawaDiagram-YF4QCWOH-BgKpeg-j.js} +1 -1
  169. package/web-shell/assets/{journeyDiagram-JHISSGLW-DzYJlwfO.js → journeyDiagram-JHISSGLW-74mwxIaA.js} +1 -1
  170. package/web-shell/assets/{kanban-definition-UN3LZRKU-CU_tcDwi.js → kanban-definition-UN3LZRKU-D4D6cEqA.js} +1 -1
  171. package/web-shell/assets/{linear-DvZXjF17.js → linear-atZRE_L2.js} +1 -1
  172. package/web-shell/assets/{mermaid.core-_ZFEQlOl.js → mermaid.core-KKudX-JC.js} +5 -5
  173. package/web-shell/assets/{mindmap-definition-RKZ34NQL-Or4p64HB.js → mindmap-definition-RKZ34NQL-CMCej9yG.js} +1 -1
  174. package/web-shell/assets/{pieDiagram-4H26LBE5-lXE-zZ6b.js → pieDiagram-4H26LBE5-nhx40X7q.js} +1 -1
  175. package/web-shell/assets/{quadrantDiagram-W4KKPZXB-DUXb9mUV.js → quadrantDiagram-W4KKPZXB-CUmVcN3M.js} +1 -1
  176. package/web-shell/assets/{requirementDiagram-4Y6WPE33-D_10uHfo.js → requirementDiagram-4Y6WPE33-C_vyEwyy.js} +1 -1
  177. package/web-shell/assets/{sankeyDiagram-5OEKKPKP-E8c0fPqe.js → sankeyDiagram-5OEKKPKP-DU6G4VWR.js} +1 -1
  178. package/web-shell/assets/{sequenceDiagram-3UESZ5HK-CJMtFttK.js → sequenceDiagram-3UESZ5HK-DdeRR_KJ.js} +1 -1
  179. package/web-shell/assets/{stateDiagram-AJRCARHV-DhbviRbB.js → stateDiagram-AJRCARHV-C6iCI8ps.js} +1 -1
  180. package/web-shell/assets/stateDiagram-v2-BHNVJYJU-C0_6nR6C.js +1 -0
  181. package/web-shell/assets/{timeline-definition-PNZ67QCA-CM5yMkFK.js → timeline-definition-PNZ67QCA-B_Ea8Cb7.js} +1 -1
  182. package/web-shell/assets/{vennDiagram-CIIHVFJN-BCi-zWNN.js → vennDiagram-CIIHVFJN-BPUVZEJA.js} +1 -1
  183. package/web-shell/assets/{wardley-L42UT6IY-BJ_yJNjJ.js → wardley-L42UT6IY-BWEj0lKY.js} +1 -1
  184. package/web-shell/assets/{wardleyDiagram-YWT4CUSO-TjtLk-qN.js → wardleyDiagram-YWT4CUSO-BvDsdIQw.js} +1 -1
  185. package/web-shell/assets/{xychartDiagram-2RQKCTM6-D1TjyoQ3.js → xychartDiagram-2RQKCTM6-crz0QhF_.js} +1 -1
  186. package/web-shell/index.html +2 -2
  187. package/chunks/chunk-CU3L64TP.js +0 -93
  188. package/chunks/types-JNKGKUJT.js +0 -12
  189. package/web-shell/assets/channel-DWfYijFS.js +0 -1
  190. package/web-shell/assets/classDiagram-4FO5ZUOK-DDht-78J.js +0 -1
  191. package/web-shell/assets/classDiagram-v2-Q7XG4LA2-DDht-78J.js +0 -1
  192. package/web-shell/assets/index-B9Xwf4OS.css +0 -5
  193. package/web-shell/assets/index-BUkM4ZXX.js +0 -1088
  194. package/web-shell/assets/stateDiagram-v2-BHNVJYJU-CntljfwW.js +0 -1
@@ -3,7 +3,7 @@
3
3
  import {
4
4
  escapeAnsiCtrlCodes,
5
5
  stringWidth
6
- } from "./chunk-YWUK7OS7.js";
6
+ } from "./chunk-WTSXKLG5.js";
7
7
  import {
8
8
  require_undici
9
9
  } from "./chunk-L573Z2QZ.js";
@@ -12,18 +12,18 @@ import {
12
12
  } from "./chunk-RXFQM6FQ.js";
13
13
  import {
14
14
  serveCommand
15
- } from "./chunk-LAM6CGP5.js";
15
+ } from "./chunk-WDW64OW3.js";
16
16
  import {
17
17
  listCommand
18
- } from "./chunk-V75IOTWF.js";
18
+ } from "./chunk-L62SEJWY.js";
19
19
  import {
20
20
  getErrorMessage as getErrorMessage2
21
- } from "./chunk-SUWGUGAD.js";
21
+ } from "./chunk-65N2J6V2.js";
22
22
  import {
23
23
  collectProviderModelsForProtocol,
24
24
  getAuthTypeFromEnv,
25
25
  resolveCliGenerationConfig
26
- } from "./chunk-CSACSGAW.js";
26
+ } from "./chunk-GGJII3FM.js";
27
27
  import {
28
28
  resolvePath
29
29
  } from "./chunk-FSA7ERJ2.js";
@@ -39,14 +39,14 @@ import {
39
39
  registerToolCallDispatch,
40
40
  selectFirstModel,
41
41
  sessionsPath
42
- } from "./chunk-GYGGUR4Q.js";
42
+ } from "./chunk-Q5GLXH5Q.js";
43
43
  import {
44
44
  getExtensionManager,
45
45
  requestChoicePluginNonInteractive,
46
46
  requestConsentNonInteractive,
47
47
  requestConsentOrFail,
48
48
  resolveExtensionCommandScope
49
- } from "./chunk-6HHAADP2.js";
49
+ } from "./chunk-AAR5SGMD.js";
50
50
  import {
51
51
  parseChannelConfig
52
52
  } from "./chunk-OATTJGPJ.js";
@@ -97,23 +97,23 @@ import {
97
97
  assembleMcpServers,
98
98
  getPendingGatedMcpServers,
99
99
  mcpCommand
100
- } from "./chunk-YH4J5XI3.js";
100
+ } from "./chunk-YYPXHMWO.js";
101
101
  import {
102
102
  loadSettings
103
- } from "./chunk-T2L6SGQY.js";
103
+ } from "./chunk-6GETGQWP.js";
104
104
  import {
105
105
  detectSystemLanguage,
106
106
  getCurrentLanguage,
107
107
  initializeI18n,
108
108
  resolveLanguageSetting,
109
109
  t
110
- } from "./chunk-SE74CIZD.js";
110
+ } from "./chunk-RDRVMDWV.js";
111
111
  import {
112
112
  loadEnvironment
113
- } from "./chunk-WN4D7YCI.js";
113
+ } from "./chunk-5EBKKSBX.js";
114
114
  import {
115
115
  isWorkspaceTrusted
116
- } from "./chunk-X7EBAABW.js";
116
+ } from "./chunk-4YWLED2A.js";
117
117
  import {
118
118
  require_strip_json_comments
119
119
  } from "./chunk-ALGGS7UH.js";
@@ -127,7 +127,7 @@ import {
127
127
  } from "./chunk-XFSFZCM5.js";
128
128
  import {
129
129
  getCliVersion
130
- } from "./chunk-UI3W56WF.js";
130
+ } from "./chunk-YU56QGXX.js";
131
131
  import {
132
132
  getPackageJson
133
133
  } from "./chunk-VJNBRRZG.js";
@@ -146,6 +146,7 @@ import {
146
146
  getScopedEnvContents,
147
147
  ideContextStore,
148
148
  isBareMode,
149
+ isExtensionCommittedWithWarningsError,
149
150
  isSafeModeEnv,
150
151
  isToolEnabled,
151
152
  loadServerHierarchicalMemory,
@@ -158,7 +159,7 @@ import {
158
159
  sessionIdContext,
159
160
  unquoteCStylePath,
160
161
  updateSetting
161
- } from "./chunk-SSFDPGFN.js";
162
+ } from "./chunk-K7CRWKOE.js";
162
163
  import {
163
164
  nextFireTime,
164
165
  parseCron
@@ -167,7 +168,7 @@ import {
167
168
  getAllGeminiMdFilenames,
168
169
  resolveTelemetrySettings,
169
170
  setGeminiMdFilename
170
- } from "./chunk-T7FSRWQ5.js";
171
+ } from "./chunk-P6LART6G.js";
171
172
  import {
172
173
  DEFAULT_QWEN_EMBEDDING_MODEL
173
174
  } from "./chunk-CARU2RR2.js";
@@ -817,6 +818,8 @@ function normalizeScope(scope) {
817
818
  }
818
819
  __name(normalizeScope, "normalizeScope");
819
820
  async function handleInstall(args) {
821
+ const scope = normalizeScope(args.scope);
822
+ let extensionManager;
820
823
  try {
821
824
  const installMetadata = await parseInstallSource(args.source);
822
825
  if (installMetadata.type !== "git" && installMetadata.type !== "github-release" && installMetadata.type !== "npm" && installMetadata.type !== "archive-url") {
@@ -843,7 +846,7 @@ async function handleInstall(args) {
843
846
  }
844
847
  const requestConsent = args.consent ? () => Promise.resolve() : requestConsentOrFail.bind(null, requestConsentNonInteractive);
845
848
  const workspaceDir = process.cwd();
846
- const extensionManager = new ExtensionManager({
849
+ extensionManager = new ExtensionManager({
847
850
  workspaceDir,
848
851
  locale: getCurrentLanguage(),
849
852
  isWorkspaceTrusted: isWorkspaceTrusted(loadSettings(workspaceDir).merged).isTrusted ?? true,
@@ -858,35 +861,20 @@ async function handleInstall(args) {
858
861
  autoUpdate: args.autoUpdate,
859
862
  allowPreRelease: args.allowPreRelease
860
863
  },
861
- requestConsent
864
+ requestConsent,
865
+ void 0,
866
+ workspaceDir,
867
+ void 0,
868
+ scope === "project" ? { scope: "workspace", workspacePath: workspaceDir } : { scope: "user" }
862
869
  );
863
- const scope = normalizeScope(args.scope);
864
870
  if (args.scope) {
865
- if (scope === "project") {
866
- await extensionManager.disableExtension(
867
- extension.name,
868
- "User" /* User */
871
+ try {
872
+ extensionManager.setExtensionScope(extension.name, scope);
873
+ } catch (scopeError) {
874
+ writeStderrLine(
875
+ `Warning: Extension installed, but failed to save scope preference: ${getErrorMessage2(scopeError)}`
869
876
  );
870
- try {
871
- await extensionManager.enableExtension(
872
- extension.name,
873
- "Workspace" /* Workspace */
874
- );
875
- } catch (enableError) {
876
- try {
877
- await extensionManager.enableExtension(
878
- extension.name,
879
- "User" /* User */
880
- );
881
- } catch (rollbackError) {
882
- writeStderrLine(
883
- `Warning: failed to roll back the scope change for "${extension.name}"; it may be disabled at all scopes: ${getErrorMessage2(rollbackError)}`
884
- );
885
- }
886
- throw enableError;
887
- }
888
877
  }
889
- extensionManager.setExtensionScope(extension.name, scope);
890
878
  }
891
879
  writeStdoutLine(
892
880
  scope === "project" ? t(
@@ -897,6 +885,19 @@ async function handleInstall(args) {
897
885
  })
898
886
  );
899
887
  } catch (error) {
888
+ if (isExtensionCommittedWithWarningsError(error)) {
889
+ if (args.scope && extensionManager) {
890
+ try {
891
+ extensionManager.setExtensionScope(error.identity.name, scope);
892
+ } catch (scopeError) {
893
+ writeStderrLine(
894
+ `Warning: Extension installed, but failed to save scope preference: ${getErrorMessage2(scopeError)}`
895
+ );
896
+ }
897
+ }
898
+ writeStderrLine(`Warning: ${getErrorMessage2(error)}`);
899
+ return;
900
+ }
900
901
  writeStderrLine(getErrorMessage2(error));
901
902
  process.exit(1);
902
903
  }
@@ -971,10 +972,13 @@ async function handleUninstall(args) {
971
972
  isWorkspaceTrusted: isWorkspaceTrusted(loadSettings(workspaceDir).merged).isTrusted ?? true
972
973
  });
973
974
  await extensionManager.refreshCache();
974
- await extensionManager.uninstallExtension(args.name, false);
975
+ const result = await extensionManager.uninstallExtension(args.name, false);
975
976
  writeStdoutLine(
976
977
  t('Extension "{{name}}" successfully uninstalled.', { name: args.name })
977
978
  );
979
+ for (const warning of result.warnings ?? []) {
980
+ writeStderrLine(`${warning.code}: ${warning.error}`);
981
+ }
978
982
  } catch (error) {
979
983
  writeStderrLine(getErrorMessage2(error));
980
984
  process.exit(1);
@@ -1014,6 +1018,13 @@ var updateOutput = /* @__PURE__ */ __name((info) => t(
1014
1018
  newVersion: info.updatedVersion
1015
1019
  }
1016
1020
  ), "updateOutput");
1021
+ var updateWarningOutput = /* @__PURE__ */ __name((info) => (info.warnings ?? []).map(
1022
+ (warning) => t('Extension "{{name}}" updated with warning {{code}}: {{error}}', {
1023
+ name: info.name,
1024
+ code: warning.code,
1025
+ error: warning.error
1026
+ })
1027
+ ).join("\n"), "updateWarningOutput");
1017
1028
  async function handleUpdate(args) {
1018
1029
  const extensionManager = await getExtensionManager();
1019
1030
  const extensions = extensionManager.getLoadedExtensions();
@@ -1069,6 +1080,8 @@ async function handleUpdate(args) {
1069
1080
  t('Extension "{{name}}" is already up to date.', { name: args.name })
1070
1081
  );
1071
1082
  }
1083
+ const warnings = updateWarningOutput(updatedExtensionInfo);
1084
+ if (warnings) writeStderrLine(warnings);
1072
1085
  } catch (error) {
1073
1086
  writeStderrLine(getErrorMessage2(error));
1074
1087
  }
@@ -1098,6 +1111,8 @@ async function handleUpdate(args) {
1098
1111
  return;
1099
1112
  }
1100
1113
  writeStdoutLine(updateInfos.map((info) => updateOutput(info)).join("\n"));
1114
+ const warnings = updateInfos.map((info) => updateWarningOutput(info)).filter(Boolean).join("\n");
1115
+ if (warnings) writeStderrLine(warnings);
1101
1116
  } catch (error) {
1102
1117
  writeStderrLine(getErrorMessage2(error));
1103
1118
  }
@@ -1137,13 +1152,16 @@ async function handleDisable(args) {
1137
1152
  const extensionManager = await getExtensionManager();
1138
1153
  try {
1139
1154
  const scope = resolveExtensionCommandScope(args.scope);
1140
- await extensionManager.disableExtension(args.name, scope);
1155
+ const result = await extensionManager.disableExtension(args.name, scope);
1141
1156
  writeStdoutLine(
1142
1157
  t('Extension "{{name}}" successfully disabled for scope "{{scope}}".', {
1143
1158
  name: args.name,
1144
1159
  scope: args.scope || "User" /* User */
1145
1160
  })
1146
1161
  );
1162
+ for (const warning of result.warnings ?? []) {
1163
+ writeStderrLine(`${warning.code}: ${warning.error}`);
1164
+ }
1147
1165
  } catch (error) {
1148
1166
  writeStderrLine(getErrorMessage2(error));
1149
1167
  process.exit(1);
@@ -1178,7 +1196,7 @@ async function handleEnable(args) {
1178
1196
  const extensionManager = await getExtensionManager();
1179
1197
  try {
1180
1198
  const scope = resolveExtensionCommandScope(args.scope);
1181
- await extensionManager.enableExtension(args.name, scope);
1199
+ const result = await extensionManager.enableExtension(args.name, scope);
1182
1200
  if (args.scope) {
1183
1201
  writeStdoutLine(
1184
1202
  t('Extension "{{name}}" successfully enabled for scope "{{scope}}".', {
@@ -1193,6 +1211,9 @@ async function handleEnable(args) {
1193
1211
  })
1194
1212
  );
1195
1213
  }
1214
+ for (const warning of result.warnings ?? []) {
1215
+ writeStderrLine(`${warning.code}: ${warning.error}`);
1216
+ }
1196
1217
  } catch (error) {
1197
1218
  throw new FatalConfigError(getErrorMessage(error));
1198
1219
  }
@@ -1244,6 +1265,10 @@ async function handleLink(args) {
1244
1265
  })
1245
1266
  );
1246
1267
  } catch (error) {
1268
+ if (isExtensionCommittedWithWarningsError(error)) {
1269
+ writeStderrLine(`Warning: ${getErrorMessage2(error)}`);
1270
+ return;
1271
+ }
1247
1272
  writeStderrLine(getErrorMessage2(error));
1248
1273
  process.exit(1);
1249
1274
  }
@@ -2229,7 +2254,7 @@ var stopCommand = {
2229
2254
  if (argv["daemon-url"]) {
2230
2255
  const token = argv.token ?? process.env[QWEN_SERVER_TOKEN_ENV] ?? process.env[QWEN_DAEMON_TOKEN_ENV];
2231
2256
  try {
2232
- const sdk = await import("./daemon-CEZ27OH4.js");
2257
+ const sdk = await import("./daemon-RNGFPMAB.js");
2233
2258
  const client = new sdk.DaemonClient({
2234
2259
  baseUrl: argv["daemon-url"],
2235
2260
  ...token ? { token } : {}
@@ -2315,7 +2340,7 @@ var statusCommand = {
2315
2340
  if (argv["daemon-url"]) {
2316
2341
  const token = argv.token ?? process.env[QWEN_SERVER_TOKEN_ENV] ?? process.env[QWEN_DAEMON_TOKEN_ENV];
2317
2342
  try {
2318
- const sdk = await import("./daemon-CEZ27OH4.js");
2343
+ const sdk = await import("./daemon-RNGFPMAB.js");
2319
2344
  const client = new sdk.DaemonClient({
2320
2345
  baseUrl: argv["daemon-url"],
2321
2346
  ...token ? { token } : {}
@@ -2420,7 +2445,7 @@ var reloadCommand = {
2420
2445
  const token = resolveToken(argv.token);
2421
2446
  let sdk;
2422
2447
  try {
2423
- sdk = await import("./daemon-CEZ27OH4.js");
2448
+ sdk = await import("./daemon-RNGFPMAB.js");
2424
2449
  } catch (err) {
2425
2450
  writeStderrLine(
2426
2451
  `[Channel] Failed to load daemon SDK: ${err instanceof Error ? err.message : String(err)}`
@@ -2491,7 +2516,7 @@ var setCommand2 = {
2491
2516
  const selection = names[0] === "all" ? { mode: "all" } : { mode: "names", names };
2492
2517
  let sdk;
2493
2518
  try {
2494
- sdk = await import("./daemon-CEZ27OH4.js");
2519
+ sdk = await import("./daemon-RNGFPMAB.js");
2495
2520
  } catch (error) {
2496
2521
  writeStderrLine(
2497
2522
  `[Channel] Failed to load daemon SDK: ${error instanceof Error ? error.message : String(error)}`
@@ -2591,7 +2616,7 @@ function createDaemonChannelBridgeFacade(bridge, opts) {
2591
2616
  }
2592
2617
  __name(createDaemonChannelBridgeFacade, "createDaemonChannelBridgeFacade");
2593
2618
  async function loadDaemonSdk() {
2594
- return await import("./daemon-CEZ27OH4.js");
2619
+ return await import("./daemon-RNGFPMAB.js");
2595
2620
  }
2596
2621
  __name(loadDaemonSdk, "loadDaemonSdk");
2597
2622
  function selectedChannelNames(channelsConfig, selection) {
@@ -2672,7 +2697,7 @@ async function runChannelDaemonWorker(opts) {
2672
2697
  );
2673
2698
  const requestedWorkspace = canonicalizeWorkspace(opts.workspace);
2674
2699
  let daemonWorkspace;
2675
- if (capabilities.workspaces && capabilities.workspaces.length > 0) {
2700
+ if (capabilities.workspaces && capabilities.workspaces.length > 1) {
2676
2701
  const match = capabilities.workspaces.find(
2677
2702
  (workspace) => canonicalizeWorkspace(workspace.cwd) === requestedWorkspace
2678
2703
  );
@@ -3647,8 +3672,221 @@ var parseArgsCommand = {
3647
3672
 
3648
3673
  // packages/cli/src/commands/review/compose-review.ts
3649
3674
  init_esbuild_shims();
3650
- import { mkdirSync as mkdirSync2, readFileSync as readFileSync3, writeFileSync as writeFileSync2 } from "node:fs";
3675
+ import { mkdirSync as mkdirSync2, readFileSync as readFileSync5, writeFileSync as writeFileSync2 } from "node:fs";
3651
3676
  import { dirname as dirname2 } from "node:path";
3677
+
3678
+ // packages/cli/src/commands/review/lib/coverage.ts
3679
+ init_esbuild_shims();
3680
+ import { readFileSync as readFileSync4, statSync as statSync2 } from "node:fs";
3681
+
3682
+ // packages/cli/src/commands/review/lib/transcripts.ts
3683
+ init_esbuild_shims();
3684
+ import { readFileSync as readFileSync3, readdirSync, statSync } from "node:fs";
3685
+ import { join as join3 } from "node:path";
3686
+ var TranscriptsUnavailableError = class extends Error {
3687
+ static {
3688
+ __name(this, "TranscriptsUnavailableError");
3689
+ }
3690
+ };
3691
+ function transcriptDir(env = process.env) {
3692
+ const projectDir = env["QWEN_CODE_PROJECT_DIR"]?.trim();
3693
+ const sessionId = env["QWEN_CODE_SESSION_ID"]?.trim();
3694
+ if (!projectDir || !sessionId) {
3695
+ throw new TranscriptsUnavailableError(
3696
+ "the CLI did not export QWEN_CODE_PROJECT_DIR / QWEN_CODE_SESSION_ID, so this run cannot find the harness's record of what its agents did"
3697
+ );
3698
+ }
3699
+ return join3(projectDir, "subagents", sessionId);
3700
+ }
3701
+ __name(transcriptDir, "transcriptDir");
3702
+ function textOf(rec) {
3703
+ const msg = rec["message"];
3704
+ const parts = Array.isArray(msg?.parts) ? msg.parts : [];
3705
+ return parts.map((p) => p.text).filter((t2) => typeof t2 === "string").join("");
3706
+ }
3707
+ __name(textOf, "textOf");
3708
+ function isErrorResponse(rec) {
3709
+ const msg = rec["message"];
3710
+ const parts = Array.isArray(msg?.parts) ? msg.parts : [];
3711
+ for (const part of parts) {
3712
+ const fr = part.functionResponse;
3713
+ if (!fr) continue;
3714
+ const resp = fr.response;
3715
+ if (resp && resp["error"] !== void 0 && resp["error"] !== null) {
3716
+ return true;
3717
+ }
3718
+ }
3719
+ return false;
3720
+ }
3721
+ __name(isErrorResponse, "isErrorResponse");
3722
+ function parseTranscript(file) {
3723
+ let raw;
3724
+ try {
3725
+ raw = readFileSync3(file, "utf8");
3726
+ } catch {
3727
+ return null;
3728
+ }
3729
+ const lines = raw.split("\n").filter((l) => l.trim());
3730
+ if (lines.length === 0) return null;
3731
+ let agentId = "";
3732
+ let agentName = "";
3733
+ let launchPrompt = "";
3734
+ let finalText = "";
3735
+ let successfulToolCalls = 0;
3736
+ const pendingCalls = [];
3737
+ for (const line of lines) {
3738
+ let rec;
3739
+ try {
3740
+ rec = JSON.parse(line);
3741
+ } catch {
3742
+ continue;
3743
+ }
3744
+ if (!agentId && typeof rec["agentId"] === "string")
3745
+ agentId = rec["agentId"];
3746
+ if (!agentName && typeof rec["agentName"] === "string") {
3747
+ agentName = rec["agentName"];
3748
+ }
3749
+ const type = rec["type"];
3750
+ if (!launchPrompt && type === "user") launchPrompt = textOf(rec);
3751
+ const msg = rec["message"];
3752
+ const parts = Array.isArray(msg?.parts) ? msg.parts : [];
3753
+ const hasCall = parts.some(
3754
+ (p) => p.functionCall
3755
+ );
3756
+ const hasResponse = parts.some(
3757
+ (p) => p.functionResponse
3758
+ );
3759
+ if (hasCall) {
3760
+ pendingCalls.push("call");
3761
+ }
3762
+ if (hasResponse) {
3763
+ if (!isErrorResponse(rec) && pendingCalls.length > 0) {
3764
+ successfulToolCalls++;
3765
+ }
3766
+ pendingCalls.pop();
3767
+ }
3768
+ if (type === "assistant") {
3769
+ const t2 = textOf(rec);
3770
+ if (t2) finalText = t2;
3771
+ }
3772
+ }
3773
+ if (!agentId) return null;
3774
+ let mtimeMs = 0;
3775
+ try {
3776
+ mtimeMs = statSync(file).mtimeMs;
3777
+ } catch {
3778
+ }
3779
+ return {
3780
+ agentId,
3781
+ agentName,
3782
+ launchPrompt,
3783
+ successfulToolCalls,
3784
+ finalText,
3785
+ mtimeMs
3786
+ };
3787
+ }
3788
+ __name(parseTranscript, "parseTranscript");
3789
+ function readTranscripts(since, env = process.env) {
3790
+ const dir = transcriptDir(env);
3791
+ let names;
3792
+ try {
3793
+ names = readdirSync(dir);
3794
+ } catch (err) {
3795
+ throw new TranscriptsUnavailableError(
3796
+ `no subagent transcripts at ${dir} (${err.message}). The harness writes one per agent; if there are none, either no agents ran or the harness could not write them.`
3797
+ );
3798
+ }
3799
+ const out = [];
3800
+ for (const name of names) {
3801
+ if (!name.endsWith(".jsonl")) continue;
3802
+ const rec = parseTranscript(join3(dir, name));
3803
+ if (!rec) continue;
3804
+ if (since !== void 0 && rec.mtimeMs < since) continue;
3805
+ out.push(rec);
3806
+ }
3807
+ return out;
3808
+ }
3809
+ __name(readTranscripts, "readTranscripts");
3810
+ function wasGivenTheDiff(rec, diffPath) {
3811
+ const p = rec.launchPrompt;
3812
+ if (!p) return false;
3813
+ return p.includes(diffPath);
3814
+ }
3815
+ __name(wasGivenTheDiff, "wasGivenTheDiff");
3816
+
3817
+ // packages/cli/src/commands/review/lib/coverage.ts
3818
+ function readPlan(path3) {
3819
+ const plan = JSON.parse(readFileSync4(path3, "utf8"));
3820
+ if (typeof plan?.diffPathAbsolute !== "string" || !plan.diffPathAbsolute) {
3821
+ throw new Error(`coverage: ${path3} has no diffPathAbsolute`);
3822
+ }
3823
+ if (!Array.isArray(plan.chunks) || plan.chunks.length === 0) {
3824
+ throw new Error(`coverage: ${path3} has no chunks[]`);
3825
+ }
3826
+ const ids = plan.chunks.map((c) => c?.id);
3827
+ if (ids.some((id) => !Number.isSafeInteger(id) || id < 1)) {
3828
+ throw new Error(
3829
+ `coverage: ${path3} has a chunk with no positive integer id`
3830
+ );
3831
+ }
3832
+ if (new Set(ids).size !== ids.length) {
3833
+ throw new Error(`coverage: ${path3} has duplicate chunk ids`);
3834
+ }
3835
+ return { plan, mtimeMs: statSync2(path3).mtimeMs };
3836
+ }
3837
+ __name(readPlan, "readPlan");
3838
+ var CHUNK_RE = /\bchunk\s+(\d+)\s+of\s+\d+\b/i;
3839
+ function assignedChunk(rec) {
3840
+ const m = CHUNK_RE.exec(rec.launchPrompt);
3841
+ return m ? Number(m[1]) : null;
3842
+ }
3843
+ __name(assignedChunk, "assignedChunk");
3844
+ var UNCOVERABLE_RE = /^\s*Uncoverable:\s*chunk\s+(\d+)\b/im;
3845
+ function coverageFromTranscripts(planPath, env = process.env) {
3846
+ const { plan, mtimeMs } = readPlan(planPath);
3847
+ const records = readTranscripts(mtimeMs, env);
3848
+ const blindAgents = [];
3849
+ const idleAgents = [];
3850
+ const covered = /* @__PURE__ */ new Set();
3851
+ const uncoverable = /* @__PURE__ */ new Set();
3852
+ for (const rec of records) {
3853
+ const chunk = assignedChunk(rec);
3854
+ const label = chunk !== null ? `chunk ${chunk}` : rec.agentName || rec.agentId;
3855
+ if (chunk !== null && !wasGivenTheDiff(rec, plan.diffPathAbsolute)) {
3856
+ blindAgents.push(label);
3857
+ continue;
3858
+ }
3859
+ if (rec.successfulToolCalls === 0) {
3860
+ idleAgents.push(label);
3861
+ continue;
3862
+ }
3863
+ const u = UNCOVERABLE_RE.exec(rec.finalText);
3864
+ if (u && chunk !== null && Number(u[1]) === chunk) {
3865
+ uncoverable.add(chunk);
3866
+ continue;
3867
+ }
3868
+ if (chunk !== null) covered.add(chunk);
3869
+ }
3870
+ const planned = plan.chunks.map((c) => c.id);
3871
+ const missingChunks = planned.filter(
3872
+ (id) => !covered.has(id) && !uncoverable.has(id)
3873
+ );
3874
+ return {
3875
+ ok: blindAgents.length === 0 && idleAgents.length === 0 && // An uncoverable chunk is a disclosed gap, not coverage: a diff with a line
3876
+ // no read can reach was not reviewed, and the verdict may not be Approve on
3877
+ // its strength. `compose-review` already caps on it; the report must agree.
3878
+ uncoverable.size === 0 && missingChunks.length === 0,
3879
+ agents: records.length,
3880
+ blindAgents,
3881
+ idleAgents,
3882
+ missingChunks,
3883
+ uncoverableChunks: [...uncoverable].sort((a, b) => a - b),
3884
+ coveredChunks: [...covered].sort((a, b) => a - b)
3885
+ };
3886
+ }
3887
+ __name(coverageFromTranscripts, "coverageFromTranscripts");
3888
+
3889
+ // packages/cli/src/commands/review/compose-review.ts
3652
3890
  var CRITICAL_MARKER = "**[Critical]**";
3653
3891
  function withMarker(line) {
3654
3892
  return line.startsWith(CRITICAL_MARKER) ? line : `${CRITICAL_MARKER} ${line}`;
@@ -3671,19 +3909,9 @@ function toStringList(value, field) {
3671
3909
  `compose-review: ${field} must be an array of strings, got ${JSON.stringify(value)}`
3672
3910
  );
3673
3911
  }
3674
- return value;
3912
+ return [...value];
3675
3913
  }
3676
3914
  __name(toStringList, "toStringList");
3677
- function toNumberList(value, field) {
3678
- if (value === void 0 || value === null) return [];
3679
- if (!Array.isArray(value) || value.some((v) => !Number.isSafeInteger(v) || v < 1)) {
3680
- throw new TypeError(
3681
- `compose-review: ${field} must be an array of positive whole numbers, got ${JSON.stringify(value)}`
3682
- );
3683
- }
3684
- return value;
3685
- }
3686
- __name(toNumberList, "toNumberList");
3687
3915
  function toBool(value, field) {
3688
3916
  if (value === void 0 || value === null) return false;
3689
3917
  if (typeof value !== "boolean") {
@@ -3718,43 +3946,37 @@ function composeReview(input) {
3718
3946
  "unreviewedDimensions"
3719
3947
  );
3720
3948
  const missingReceipts = [];
3721
- const coverageRaw = input.coverage ?? {};
3722
- if (typeof coverageRaw !== "object" || Array.isArray(coverageRaw)) {
3723
- throw new TypeError(
3724
- `compose-review: coverage must be an object, got ${JSON.stringify(coverageRaw)}`
3725
- );
3726
- }
3727
- const cov = coverageRaw;
3728
- const covProvided = input.coverage !== void 0 && input.coverage !== null;
3729
- if (!covProvided) {
3949
+ if (!input.planPath) {
3730
3950
  unreviewed.push(
3731
- "coverage \u2014 no `check-coverage` report was supplied, so this run cannot show that any of the diff was read"
3951
+ "coverage \u2014 no plan was given, so this run cannot show that any of the diff was read"
3732
3952
  );
3733
- }
3734
- if (covProvided) {
3735
- if (cov["ok"] !== true) {
3953
+ } else {
3954
+ try {
3955
+ const cov = coverageFromTranscripts(input.planPath, input.env);
3956
+ for (const id of cov.missingChunks) missingReceipts.push(id);
3957
+ for (const id of cov.uncoverableChunks) {
3958
+ const prefix = `chunk ${id}`;
3959
+ const already = uncoverable.some(
3960
+ (e) => e === prefix || e.startsWith(`${prefix} `)
3961
+ );
3962
+ if (!already) uncoverable.push(prefix);
3963
+ }
3964
+ for (const label of cov.idleAgents) {
3965
+ unreviewed.push(
3966
+ `${label} \u2014 the agent made no tool call: it read nothing`
3967
+ );
3968
+ }
3969
+ for (const label of cov.blindAgents) {
3970
+ unreviewed.push(
3971
+ `${label} \u2014 launched with a prompt that never named the diff file, so it could not have read it (build the prompt with \`qwen review agent-prompt\`)`
3972
+ );
3973
+ }
3974
+ } catch (err) {
3975
+ const why = err instanceof TranscriptsUnavailableError ? `could not read the agents' transcripts (${err.message})` : `the plan could not be used (${err.message})`;
3736
3976
  unreviewed.push(
3737
- "coverage \u2014 the `check-coverage` report says the diff was not covered"
3977
+ `coverage \u2014 ${why}, so this run cannot show that any of the diff was read`
3738
3978
  );
3739
3979
  }
3740
- for (const id of toNumberList(
3741
- cov["missingChunks"],
3742
- "coverage.missingChunks"
3743
- )) {
3744
- missingReceipts.push(id);
3745
- }
3746
- for (const id of toNumberList(
3747
- cov["uncoverableChunks"],
3748
- "coverage.uncoverableChunks"
3749
- )) {
3750
- uncoverable.push(`chunk ${id}`);
3751
- }
3752
- for (const label of toStringList(
3753
- cov["whiffedAgents"],
3754
- "coverage.whiffedAgents"
3755
- )) {
3756
- unreviewed.push(`${label} \u2014 the agent returned nothing substantive`);
3757
- }
3758
3980
  }
3759
3981
  const contextUnavailable = toBool(
3760
3982
  input.contextUnavailable,
@@ -3909,8 +4131,10 @@ var composeReviewCommand = {
3909
4131
  }), "builder"),
3910
4132
  handler: /* @__PURE__ */ __name((argv) => {
3911
4133
  const { input, out } = argv;
3912
- const raw = readFileSync3(input ?? 0, "utf8");
3913
- const result = composeReview(JSON.parse(raw));
4134
+ const raw = readFileSync5(input ?? 0, "utf8");
4135
+ const parsed = JSON.parse(raw);
4136
+ delete parsed.env;
4137
+ const result = composeReview(parsed);
3914
4138
  const json = JSON.stringify(result, null, 2);
3915
4139
  if (out) {
3916
4140
  mkdirSync2(dirname2(out), { recursive: true });
@@ -3924,7 +4148,7 @@ var composeReviewCommand = {
3924
4148
  init_esbuild_shims();
3925
4149
  import { execFileSync as execFileSync3 } from "node:child_process";
3926
4150
  import { mkdirSync as mkdirSync3, writeFileSync as writeFileSync3 } from "node:fs";
3927
- import { dirname as dirname3, resolve } from "node:path";
4151
+ import { dirname as dirname3, resolve as resolve2 } from "node:path";
3928
4152
 
3929
4153
  // packages/cli/src/commands/review/lib/gh.ts
3930
4154
  init_esbuild_shims();
@@ -4014,7 +4238,7 @@ __name(ensureAuthenticated, "ensureAuthenticated");
4014
4238
  // packages/cli/src/commands/review/lib/git.ts
4015
4239
  init_esbuild_shims();
4016
4240
  import { execFileSync as execFileSync2 } from "node:child_process";
4017
- import { existsSync as existsSync2 } from "node:fs";
4241
+ import { existsSync as existsSync2, rmSync } from "node:fs";
4018
4242
  var GIT_TIMEOUT_MS = 12e4;
4019
4243
  function gitOpts() {
4020
4244
  return {
@@ -4047,13 +4271,31 @@ function refExists(ref) {
4047
4271
  return gitOpt("rev-parse", "--verify", "--quiet", ref) !== null;
4048
4272
  }
4049
4273
  __name(refExists, "refExists");
4274
+ function worktreeReleaseResult(existed, stillThere, removeError) {
4275
+ const freed = existed && !stillThere;
4276
+ if (!existed || freed) {
4277
+ return { existed, freed, reason: void 0 };
4278
+ }
4279
+ return {
4280
+ existed,
4281
+ freed,
4282
+ reason: removeError ? removeError instanceof Error ? removeError.message : String(removeError) : "the path is still there after `git worktree remove --force` and `rm -rf`"
4283
+ };
4284
+ }
4285
+ __name(worktreeReleaseResult, "worktreeReleaseResult");
4050
4286
  function releaseWorktree(worktreePath2) {
4051
4287
  const existed = existsSync2(worktreePath2);
4288
+ let removeError;
4052
4289
  if (existed) {
4053
4290
  gitOpt("worktree", "remove", worktreePath2, "--force");
4291
+ try {
4292
+ rmSync(worktreePath2, { recursive: true, force: true });
4293
+ } catch (e) {
4294
+ removeError = e;
4295
+ }
4054
4296
  }
4055
4297
  gitOpt("worktree", "prune");
4056
- return existed;
4298
+ return worktreeReleaseResult(existed, existsSync2(worktreePath2), removeError);
4057
4299
  }
4058
4300
  __name(releaseWorktree, "releaseWorktree");
4059
4301
  function gitRaw(...args) {
@@ -4098,14 +4340,18 @@ var LITERAL_PATHSPECS = "--literal-pathspecs";
4098
4340
 
4099
4341
  // packages/cli/src/commands/review/lib/paths.ts
4100
4342
  init_esbuild_shims();
4101
- import { join as join3 } from "node:path";
4102
- var REVIEW_TMP_DIR = join3(".qwen", "tmp");
4103
- var REVIEWS_DIR = join3(".qwen", "reviews");
4104
- var REVIEW_CACHE_DIR = join3(".qwen", "review-cache");
4343
+ import { join as join4, resolve } from "node:path";
4344
+ var REVIEW_TMP_DIR = join4(".qwen", "tmp");
4345
+ var REVIEWS_DIR = join4(".qwen", "reviews");
4346
+ var REVIEW_CACHE_DIR = join4(".qwen", "review-cache");
4105
4347
  function worktreePath(prNumber) {
4106
- return join3(REVIEW_TMP_DIR, `review-pr-${prNumber}`);
4348
+ return join4(REVIEW_TMP_DIR, `review-pr-${prNumber}`);
4107
4349
  }
4108
4350
  __name(worktreePath, "worktreePath");
4351
+ function probeWorktreePath(worktree) {
4352
+ return `${resolve(worktree)}-probe`;
4353
+ }
4354
+ __name(probeWorktreePath, "probeWorktreePath");
4109
4355
  function reviewBranch(prNumber) {
4110
4356
  return `qwen-review/pr-${prNumber}`;
4111
4357
  }
@@ -4116,7 +4362,7 @@ function safeTarget(target) {
4116
4362
  }
4117
4363
  __name(safeTarget, "safeTarget");
4118
4364
  function tmpFile(target, suffix) {
4119
- return join3(REVIEW_TMP_DIR, `qwen-review-${safeTarget(target)}-${suffix}`);
4365
+ return join4(REVIEW_TMP_DIR, `qwen-review-${safeTarget(target)}-${suffix}`);
4120
4366
  }
4121
4367
  __name(tmpFile, "tmpFile");
4122
4368
  function tmpPrefix(target) {
@@ -4492,7 +4738,7 @@ __name(chunksCoverDiff, "chunksCoverDiff");
4492
4738
 
4493
4739
  // packages/cli/src/commands/review/lib/report.ts
4494
4740
  init_esbuild_shims();
4495
- import { statSync } from "node:fs";
4741
+ import { statSync as statSync3 } from "node:fs";
4496
4742
 
4497
4743
  // packages/cli/src/commands/review/lib/heavy.ts
4498
4744
  init_esbuild_shims();
@@ -4555,7 +4801,7 @@ __name(buildPlanReport, "buildPlanReport");
4555
4801
  function warnOnReportSize(path3, cap) {
4556
4802
  let size = 0;
4557
4803
  try {
4558
- size = statSync(path3).size;
4804
+ size = statSync3(path3).size;
4559
4805
  } catch {
4560
4806
  return;
4561
4807
  }
@@ -4707,7 +4953,7 @@ async function runFetchPr(args) {
4707
4953
  writeFileSync3(diffRel, buf);
4708
4954
  diffText = buf.toString("utf8");
4709
4955
  diffPath = diffRel;
4710
- diffPathAbsolute = resolve(diffRel);
4956
+ diffPathAbsolute = resolve2(diffRel);
4711
4957
  } catch (err) {
4712
4958
  writeStderrLine(`Failed to capture diff: ${err.message}`);
4713
4959
  }
@@ -4802,12 +5048,12 @@ var fetchPrCommand = {
4802
5048
  // packages/cli/src/commands/review/capture-local.ts
4803
5049
  init_esbuild_shims();
4804
5050
  import { mkdirSync as mkdirSync4, writeFileSync as writeFileSync4 } from "node:fs";
4805
- import { dirname as dirname4, resolve as resolve3 } from "node:path";
5051
+ import { dirname as dirname4, resolve as resolve4 } from "node:path";
4806
5052
 
4807
5053
  // packages/cli/src/commands/review/lib/local-diff.ts
4808
5054
  init_esbuild_shims();
4809
- import { lstatSync, statSync as statSync2, realpathSync } from "node:fs";
4810
- import { join as join4, relative, resolve as resolve2, isAbsolute, sep } from "node:path";
5055
+ import { lstatSync, statSync as statSync4, realpathSync } from "node:fs";
5056
+ import { join as join5, relative, resolve as resolve3, isAbsolute, sep } from "node:path";
4811
5057
  var MAX_UNTRACKED_BYTES = 1e6;
4812
5058
  var MAX_UNTRACKED_FILES = 500;
4813
5059
  var MAX_UNTRACKED_TOTAL_BYTES = 1e7;
@@ -4828,7 +5074,7 @@ function describeUndiffable(abs, st) {
4828
5074
  }
4829
5075
  if (st.isSymbolicLink()) {
4830
5076
  try {
4831
- return statSync2(abs).isDirectory() ? "is a symlink to a directory \u2014 git cannot diff it as a file" : null;
5077
+ return statSync4(abs).isDirectory() ? "is a symlink to a directory \u2014 git cannot diff it as a file" : null;
4832
5078
  } catch {
4833
5079
  return null;
4834
5080
  }
@@ -4837,7 +5083,7 @@ function describeUndiffable(abs, st) {
4837
5083
  }
4838
5084
  __name(describeUndiffable, "describeUndiffable");
4839
5085
  function toRepoPathspec(repoRoot, file) {
4840
- let abs = resolve2(process.cwd(), file);
5086
+ let abs = resolve3(process.cwd(), file);
4841
5087
  try {
4842
5088
  abs = realpathSync(abs);
4843
5089
  } catch {
@@ -4933,7 +5179,7 @@ function captureLocalDiff(opts) {
4933
5179
  for (const path3 of candidates) {
4934
5180
  let bytes;
4935
5181
  try {
4936
- const abs = join4(repoRoot, path3);
5182
+ const abs = join5(repoRoot, path3);
4937
5183
  const st = lstatSync(abs);
4938
5184
  const kind = describeUndiffable(abs, st);
4939
5185
  if (kind) {
@@ -5026,13 +5272,13 @@ function runCaptureLocal(args) {
5026
5272
  });
5027
5273
  const diffText = capture.diff.toString("utf8");
5028
5274
  mkdirSync4(REVIEW_TMP_DIR, { recursive: true });
5029
- mkdirSync4(dirname4(resolve3(out)), { recursive: true });
5275
+ mkdirSync4(dirname4(resolve4(out)), { recursive: true });
5030
5276
  const diffPath = tmpFile(target, "diff.txt");
5031
5277
  writeFileSync4(diffPath, capture.diff);
5032
5278
  const plan = buildDiffPlan(diffText);
5033
5279
  const result = {
5034
5280
  diffPath,
5035
- diffPathAbsolute: resolve3(diffPath),
5281
+ diffPathAbsolute: resolve4(diffPath),
5036
5282
  // No ref to `git show` a pre-change file out of, so per-file line counts and
5037
5283
  // heaviness are unavailable — same as `plan-diff`. Chunk coverage, which is
5038
5284
  // what the topology needs, is not.
@@ -5094,13 +5340,13 @@ var captureLocalCommand = {
5094
5340
 
5095
5341
  // packages/cli/src/commands/review/plan-diff.ts
5096
5342
  init_esbuild_shims();
5097
- import { readFileSync as readFileSync4, writeFileSync as writeFileSync5, mkdirSync as mkdirSync5 } from "node:fs";
5098
- import { resolve as resolve4 } from "node:path";
5343
+ import { readFileSync as readFileSync6, writeFileSync as writeFileSync5, mkdirSync as mkdirSync5 } from "node:fs";
5344
+ import { resolve as resolve5 } from "node:path";
5099
5345
  function runPlanDiff(args) {
5100
5346
  const { diff_path: diffPath, out } = args;
5101
5347
  let diffText;
5102
5348
  try {
5103
- diffText = readFileSync4(diffPath, "utf8");
5349
+ diffText = readFileSync6(diffPath, "utf8");
5104
5350
  } catch (err) {
5105
5351
  throw new Error(
5106
5352
  `Cannot read diff file ${diffPath}: ${err.message}`
@@ -5109,7 +5355,7 @@ function runPlanDiff(args) {
5109
5355
  const plan = buildDiffPlan(diffText, args.maxChunkLines);
5110
5356
  const result = {
5111
5357
  diffPath,
5112
- diffPathAbsolute: resolve4(diffPath),
5358
+ diffPathAbsolute: resolve5(diffPath),
5113
5359
  // No `git show` is possible here — there is no ref to resolve a path
5114
5360
  // against — so per-file line counts and heaviness are unavailable. Chunk
5115
5361
  // coverage, which is what Step 3B needs, is not.
@@ -5747,7 +5993,7 @@ var loadRulesCommand = {
5747
5993
 
5748
5994
  // packages/cli/src/commands/review/presubmit.ts
5749
5995
  init_esbuild_shims();
5750
- import { writeFileSync as writeFileSync8, readFileSync as readFileSync5 } from "node:fs";
5996
+ import { writeFileSync as writeFileSync8, readFileSync as readFileSync7 } from "node:fs";
5751
5997
  var FAIL_CONCLUSIONS = /* @__PURE__ */ new Set([
5752
5998
  "failure",
5753
5999
  "cancelled",
@@ -5904,7 +6150,7 @@ async function runPresubmit(args) {
5904
6150
  }
5905
6151
  let newFindings = [];
5906
6152
  if (newFindingsPath) {
5907
- newFindings = JSON.parse(readFileSync5(newFindingsPath, "utf8"));
6153
+ newFindings = JSON.parse(readFileSync7(newFindingsPath, "utf8"));
5908
6154
  }
5909
6155
  const newFindingKeys = new Set(newFindings.map((f) => `${f.path}:${f.line}`));
5910
6156
  const buckets = classifyExistingComments(
@@ -5994,8 +6240,8 @@ var presubmitCommand = {
5994
6240
 
5995
6241
  // packages/cli/src/commands/review/resolve-anchors.ts
5996
6242
  init_esbuild_shims();
5997
- import { readFileSync as readFileSync6, writeFileSync as writeFileSync9, mkdirSync as mkdirSync8 } from "node:fs";
5998
- import { dirname as dirname7, resolve as resolve5 } from "node:path";
6243
+ import { readFileSync as readFileSync8, writeFileSync as writeFileSync9, mkdirSync as mkdirSync8 } from "node:fs";
6244
+ import { dirname as dirname7, resolve as resolve6 } from "node:path";
5999
6245
 
6000
6246
  // packages/cli/src/commands/review/lib/anchors.ts
6001
6247
  init_esbuild_shims();
@@ -6219,7 +6465,7 @@ __name(validateRequests, "validateRequests");
6219
6465
  function runResolveAnchors(args) {
6220
6466
  let diffText;
6221
6467
  try {
6222
- diffText = readFileSync6(args.diff, "utf8");
6468
+ diffText = readFileSync8(args.diff, "utf8");
6223
6469
  } catch (err) {
6224
6470
  throw new Error(
6225
6471
  `Cannot read diff file ${args.diff}: ${err.message}`
@@ -6227,7 +6473,7 @@ function runResolveAnchors(args) {
6227
6473
  }
6228
6474
  let rawText;
6229
6475
  try {
6230
- rawText = readFileSync6(args.input, "utf8");
6476
+ rawText = readFileSync8(args.input, "utf8");
6231
6477
  } catch (err) {
6232
6478
  throw new Error(
6233
6479
  `Cannot read findings file ${args.input}: ${err.message}`
@@ -6258,7 +6504,7 @@ function runResolveAnchors(args) {
6258
6504
  loose: resolved.filter((r) => r.tier?.startsWith("loose")).length
6259
6505
  }
6260
6506
  };
6261
- mkdirSync8(dirname7(resolve5(args.out)), { recursive: true });
6507
+ mkdirSync8(dirname7(resolve6(args.out)), { recursive: true });
6262
6508
  writeFileSync9(args.out, JSON.stringify(report, null, 2), "utf8");
6263
6509
  writeStdoutLine(`Wrote resolved anchors to ${args.out}`);
6264
6510
  const s = report.stats;
@@ -6306,188 +6552,228 @@ var resolveAnchorsCommand = {
6306
6552
 
6307
6553
  // packages/cli/src/commands/review/check-coverage.ts
6308
6554
  init_esbuild_shims();
6309
- import { readFileSync as readFileSync7, writeFileSync as writeFileSync10, mkdirSync as mkdirSync9 } from "node:fs";
6310
- import { dirname as dirname8, resolve as resolve6 } from "node:path";
6311
- var WHIFF_CHARS = 40;
6312
- var BARE_RE = /^\s*no issues found[.!]?\s*$/i;
6313
- var AGENT_RE = /^===\s*AGENT:\s*(.+?)\s*===\s*$/;
6314
- var OWN_CHUNK_RE = /\bchunk\s+(\d+)\b/i;
6315
- function ownChunk(label) {
6316
- const m = OWN_CHUNK_RE.exec(label);
6317
- return m ? Number(m[1]) : null;
6318
- }
6319
- __name(ownChunk, "ownChunk");
6320
- function stripReceipts(body) {
6321
- return body.split("\n").filter((l) => !/^\s*(Covered|Uncoverable):/i.test(l)).join("\n").trim();
6322
- }
6323
- __name(stripReceipts, "stripReceipts");
6324
- var COVERED_RE = /^\s*Covered:\s*chunk\s+(\d+)\b/im;
6325
- var UNCOVERABLE_RE = /^\s*Uncoverable:\s*chunk\s+(\d+)\b/im;
6326
- function splitReturns(text) {
6327
- const out = [];
6328
- let cur = null;
6329
- for (const line of text.split("\n")) {
6330
- const m = AGENT_RE.exec(line);
6331
- if (m) {
6332
- if (cur) out.push(cur);
6333
- cur = { label: sanitiseLabel(m[1]), body: "" };
6334
- continue;
6335
- }
6336
- if (cur) cur.body += line + "\n";
6337
- }
6338
- if (cur) out.push(cur);
6339
- return out;
6340
- }
6341
- __name(splitReturns, "splitReturns");
6342
- function sanitiseLabel(raw) {
6343
- const CONTROL = /[\u0000-\u001f\u007f]/g;
6344
- const clean = raw.replace(CONTROL, "?").slice(0, 80);
6345
- return clean.trim() || "(unnamed agent)";
6346
- }
6347
- __name(sanitiseLabel, "sanitiseLabel");
6348
- function checkCoverage(plannedChunks, returns, opts = {
6349
- topology: "territory"
6350
- }) {
6351
- const territory = opts.topology === "territory";
6352
- const covered = /* @__PURE__ */ new Set();
6353
- const uncoverable = /* @__PURE__ */ new Set();
6354
- const whiffed = [];
6355
- const roster = opts.expected && opts.expected.length > 0 ? new Set(opts.expected.map((l) => l.toLowerCase().trim())) : null;
6356
- for (const r of returns) {
6357
- const body = r.body.trim();
6358
- const known = roster === null || roster.has(r.label.toLowerCase().trim());
6359
- const substantive = body.length >= WHIFF_CHARS && !BARE_RE.test(stripReceipts(body));
6360
- const own = ownChunk(r.label);
6361
- const c = COVERED_RE.exec(body);
6362
- const u = UNCOVERABLE_RE.exec(body);
6363
- if (own !== null && known) {
6364
- if (c && Number(c[1]) === own) covered.add(own);
6365
- if (u && Number(u[1]) === own) uncoverable.add(own);
6366
- }
6367
- if (known && !substantive) whiffed.push(r.label);
6368
- }
6369
- const missing = territory ? plannedChunks.filter((id) => !covered.has(id) && !uncoverable.has(id)) : [];
6370
- const seen = new Set(returns.map((r) => r.label.toLowerCase().trim()));
6371
- const missingAgents = (opts.expected ?? []).filter(
6372
- (label) => !seen.has(label.toLowerCase().trim())
6373
- );
6374
- return {
6375
- plannedChunks,
6376
- coveredChunks: [...covered].sort((a, b) => a - b),
6377
- uncoverableChunks: [...uncoverable].sort((a, b) => a - b),
6378
- missingChunks: missing,
6379
- whiffedAgents: whiffed,
6380
- missingAgents,
6381
- topology: opts.topology,
6382
- agents: returns.length,
6383
- // `uncoverable` is a disclosed gap, not a failure — it still forbids an
6384
- // Approve downstream (compose-review caps on it). A chunk nobody receipted,
6385
- // an agent that said nothing, and an agent that never ran are failures.
6386
- ok: missing.length === 0 && whiffed.length === 0 && missingAgents.length === 0
6387
- };
6388
- }
6389
- __name(checkCoverage, "checkCoverage");
6555
+ import { writeFileSync as writeFileSync10, mkdirSync as mkdirSync9 } from "node:fs";
6556
+ import { dirname as dirname8, resolve as resolve7 } from "node:path";
6390
6557
  function runCheckCoverage(args) {
6391
- let plan;
6392
- try {
6393
- plan = JSON.parse(readFileSync7(args.plan, "utf8"));
6394
- } catch (err) {
6395
- throw new Error(
6396
- `Cannot read the chunk plan ${args.plan}: ${err.message}`
6397
- );
6398
- }
6399
- if (!Array.isArray(plan.chunks) || plan.chunks.length === 0) {
6400
- throw new Error(
6401
- `${args.plan} carries no \`chunks[]\`. That is not a chunk plan \u2014 pass the report from fetch-pr / capture-local / plan-diff for THIS review. A plan with no chunks would let the check pass over a diff nobody saw.`
6402
- );
6403
- }
6404
- const planned = plan.chunks.map((c) => c.id);
6405
- if (planned.some((id) => !Number.isSafeInteger(id) || id <= 0)) {
6406
- throw new Error(`${args.plan} has a chunk with no positive integer id.`);
6407
- }
6408
- if (new Set(planned).size !== planned.length) {
6409
- throw new Error(`${args.plan} has duplicate chunk ids.`);
6410
- }
6411
- let text;
6558
+ let report;
6412
6559
  try {
6413
- text = readFileSync7(args.returns, "utf8");
6560
+ report = coverageFromTranscripts(args.plan);
6414
6561
  } catch (err) {
6415
- throw new Error(
6416
- `Cannot read the agent returns ${args.returns}: ${err.message}`
6417
- );
6418
- }
6419
- const returns = splitReturns(text);
6420
- if (returns.length === 0) {
6421
- throw new Error(
6422
- `No agent returns found in ${args.returns}. Each one must be preceded by a \`=== AGENT: <label> ===\` line, and its text copied verbatim \u2014 a summary of what an agent said cannot show whether it said anything.`
6423
- );
6562
+ if (err instanceof TranscriptsUnavailableError) {
6563
+ writeStderrLine(
6564
+ `ERROR: ${err.message}
6565
+ This is an environment problem, not a finding about the agents. Coverage cannot be shown, so the review must not certify the diff.`
6566
+ );
6567
+ process.exitCode = 3;
6568
+ return;
6569
+ }
6570
+ throw err;
6424
6571
  }
6425
- const expected = (args.expect ?? "").split(",").map((l) => l.trim()).filter(Boolean);
6426
- const report = checkCoverage(planned, returns, {
6427
- topology: args.topology,
6428
- expected
6429
- });
6430
- mkdirSync9(dirname8(resolve6(args.out)), { recursive: true });
6431
- writeFileSync10(args.out, JSON.stringify(report, null, 2), "utf8");
6572
+ mkdirSync9(dirname8(resolve7(args.out)), { recursive: true });
6573
+ writeFileSync10(args.out, JSON.stringify(report, null, 2));
6432
6574
  writeStdoutLine(`Wrote coverage report to ${args.out}`);
6575
+ const totalChunks = report.coveredChunks.length + report.missingChunks.length + report.uncoverableChunks.length;
6576
+ const worked = report.agents - report.blindAgents.length - report.idleAgents.length;
6433
6577
  writeStderrLine(
6434
- report.topology === "dimension" ? `Coverage: ${report.agents} dimension agent return(s), no per-chunk receipts (every agent walks the whole plan)` : `Coverage: ${report.coveredChunks.length}/${planned.length} chunks receipted by ${report.agents} agent return(s)` + (report.uncoverableChunks.length ? `, ${report.uncoverableChunks.length} uncoverable` : "")
6578
+ `Coverage: ${report.coveredChunks.length}/${totalChunks} chunk(s) reviewed. ${report.agents} agent(s) ran; ${worked} did work` + (report.blindAgents.length ? `, ${report.blindAgents.length} were launched blind` : "") + (report.idleAgents.length ? `, ${report.idleAgents.length} made no tool call` : "")
6435
6579
  );
6436
- if (report.missingChunks.length > 0) {
6580
+ if (report.blindAgents.length > 0) {
6437
6581
  writeStderrLine(
6438
- `ERROR: ${report.missingChunks.length} chunk(s) carry NO receipt \u2014 ${report.missingChunks.join(", ")}. Nobody read those lines. Relaunch an agent for each before Step 4; do not aggregate findings over a diff that was not read, and do not certify what nobody looked at.`
6582
+ `ERROR: ${report.blindAgents.length} agent(s) were launched with a prompt that never named the diff file \u2014 ${report.blindAgents.join(", ")}. They could not have read the diff, whatever they returned. Do NOT relaunch them as they are: a second blind agent reads no more than the first. Build each prompt with \`qwen review agent-prompt --plan <plan> --chunk <id>\` and pass it verbatim.`
6439
6583
  );
6440
6584
  }
6441
- if (report.missingAgents.length > 0) {
6585
+ if (report.idleAgents.length > 0) {
6442
6586
  writeStderrLine(
6443
- `ERROR: ${report.missingAgents.length} expected agent(s) never returned \u2014 ${report.missingAgents.join(", ")}. A lens nobody ran is not a lens that found nothing. Launch each before Step 4.`
6587
+ `ERROR: ${report.idleAgents.length} agent(s) made no tool call \u2014 ${report.idleAgents.join(", ")}. They read nothing. Their prose is not evidence: of 129 real transcripts, every single one of the 80 agents that made no call still returned confident, specific text.`
6444
6588
  );
6445
6589
  }
6446
- if (report.whiffedAgents.length > 0) {
6590
+ if (report.uncoverableChunks.length > 0) {
6447
6591
  writeStderrLine(
6448
- `ERROR: ${report.whiffedAgents.length} agent(s) returned nothing substantive \u2014 ${report.whiffedAgents.join("; ")}. A return this short is indistinguishable from an agent that did not run (a receipt says which lines it was handed, not that it looked at them). Relaunch each ONCE; if it comes back bare again, record its dimension in \`unreviewedDimensions\`, which forbids an Approve.`
6592
+ `ERROR: ${report.uncoverableChunks.length} chunk(s) were declared uncoverable \u2014 ${report.uncoverableChunks.join(", ")}. A diff with a line no read can reach was not reviewed; the verdict may not approve on its strength. Report them to the user as an unreviewed gap.`
6449
6593
  );
6450
6594
  }
6451
- if (!report.ok) {
6595
+ if (report.missingChunks.length > 0) {
6452
6596
  writeStderrLine(
6453
- "The review has not covered the diff. Fix that before Step 4."
6597
+ `ERROR: ${report.missingChunks.length} chunk(s) were not reviewed \u2014 ${report.missingChunks.join(", ")}. Nobody read those lines. Do not aggregate findings over a diff that was not read.`
6454
6598
  );
6599
+ }
6600
+ if (!report.ok) {
6455
6601
  process.exitCode = 3;
6456
6602
  }
6457
6603
  }
6458
6604
  __name(runCheckCoverage, "runCheckCoverage");
6459
6605
  var checkCoverageCommand = {
6460
6606
  command: "check-coverage",
6461
- describe: "Read the review agents' verbatim returns and report which chunks nobody covered (the Step 3 receipt check, as code)",
6607
+ describe: "Prove the diff was read, from the harness's own per-agent transcripts (not from any file the caller writes)",
6462
6608
  builder: /* @__PURE__ */ __name((yargs) => yargs.option("plan", {
6463
6609
  type: "string",
6464
6610
  demandOption: true,
6465
- describe: "The chunk plan from fetch-pr / capture-local / plan-diff (its `chunks[]` is what must be covered)"
6466
- }).option("returns", {
6467
- type: "string",
6468
- demandOption: true,
6469
- describe: "Every review agent's return, VERBATIM, each preceded by `=== AGENT: <label> ===`. Not a summary: a summary of an agent that said nothing says something."
6611
+ describe: "Path to the plan report from Step 1"
6470
6612
  }).option("out", {
6471
6613
  type: "string",
6472
6614
  demandOption: true,
6473
6615
  describe: "Output JSON path (will be overwritten)"
6474
- }).option("topology", {
6616
+ }), "builder"),
6617
+ handler: /* @__PURE__ */ __name((argv) => {
6618
+ runCheckCoverage(argv);
6619
+ }, "handler")
6620
+ };
6621
+
6622
+ // packages/cli/src/commands/review/agent-prompt.ts
6623
+ init_esbuild_shims();
6624
+ import { readFileSync as readFileSync9 } from "node:fs";
6625
+ var SEVERITY = `Apply the severity definitions:
6626
+ - **Critical** \u2014 the code does something wrong. A bug that produces incorrect behaviour, a security hole, data loss, a resource or state leak, a build or test failure.
6627
+ - **Suggestion** \u2014 a recommended improvement to code that works.
6628
+ - **Nice to have** \u2014 optional.`;
6629
+ var FINDING_FORMAT = `Format each finding using this structure:
6630
+ - **File:** <file path>:<line number or range>
6631
+ - **Anchor:** <1-3 consecutive lines copied VERBATIM from the diff>
6632
+ - **Source:** [review]
6633
+ - **Issue:** <one-line statement of the defect>
6634
+ - **Failure scenario:** <the concrete trigger and the concrete wrong outcome: what input, state, timing, or config makes this code misbehave, and what incorrect output / crash / leak / exposure results>
6635
+ - **Suggested fix:** <concrete code suggestion when possible, or "N/A">
6636
+ - **Severity:** Critical | Suggestion | Nice to have
6637
+ - **Confidence:** high | low`;
6638
+ function chunkFrom(report, id) {
6639
+ const diffPath = report.diffPathAbsolute;
6640
+ if (typeof diffPath !== "string" || diffPath.length === 0) {
6641
+ throw new Error(
6642
+ "agent-prompt: the plan has no `diffPathAbsolute`. Without it the agent has no way to reach the diff \u2014 which is the entire bug this command exists to prevent. Pass the report written by fetch-pr / plan-diff / capture-local."
6643
+ );
6644
+ }
6645
+ if (!Array.isArray(report.chunks) || report.chunks.length === 0) {
6646
+ throw new Error("agent-prompt: the plan has no `chunks[]`.");
6647
+ }
6648
+ const chunks = report.chunks;
6649
+ const chunk = chunks.find((c) => c?.id === id);
6650
+ if (!chunk) {
6651
+ throw new Error(
6652
+ `agent-prompt: the plan has no chunk ${id} (it has ${chunks.length}: ${chunks.map((c) => c?.id).join(", ")}).`
6653
+ );
6654
+ }
6655
+ if (!Number.isSafeInteger(chunk.startLine) || !Number.isSafeInteger(chunk.endLine) || chunk.startLine < 1 || chunk.endLine < chunk.startLine) {
6656
+ throw new Error(
6657
+ `agent-prompt: chunk ${id} has no usable line range (startLine=${chunk.startLine}, endLine=${chunk.endLine}).`
6658
+ );
6659
+ }
6660
+ return { diffPath, chunk, total: chunks.length };
6661
+ }
6662
+ __name(chunkFrom, "chunkFrom");
6663
+ function buildChunkAgentPrompt(report, id, rules) {
6664
+ const { diffPath, chunk, total } = chunkFrom(report, id);
6665
+ const offset = chunk.startLine - 1;
6666
+ const limit = chunk.endLine - chunk.startLine + 1;
6667
+ const files = (Array.isArray(chunk.files) ? chunk.files : []).filter(
6668
+ (f) => !!f && typeof f.path === "string" && f.path.length > 0
6669
+ ).map((f) => `- ${f.path} (new-side lines ${f.newStart}-${f.newEnd})`).join("\n");
6670
+ const unreachable = chunk.maxLineChars > READ_FILE_CHAR_CAP;
6671
+ const parts = [
6672
+ `You are reviewing chunk ${chunk.id} of ${total} of a code diff.`,
6673
+ "",
6674
+ "**Read your chunk first. It is a file on disk \u2014 nothing in this prompt contains the code.**",
6675
+ "",
6676
+ "```",
6677
+ `read_file(file_path="${diffPath}", offset=${offset}, limit=${limit})`,
6678
+ "```",
6679
+ "",
6680
+ `That is your territory: lines ${chunk.startLine}-${chunk.endLine} of the diff (${chunk.lines} lines, ${chunk.chars} characters). The surrounding chunks belong to other agents \u2014 do not review them.`,
6681
+ "",
6682
+ "It covers these source files:",
6683
+ files || "- (none recorded)",
6684
+ "",
6685
+ "**If the read comes back with `isTruncated` set, you do not have your chunk.** Keep calling `read_file` with a larger `offset` until you have the whole range. A receipt for a range you only half read makes the coverage guarantee a lie, which is worse than not having one."
6686
+ ];
6687
+ if (unreachable) {
6688
+ parts.push(
6689
+ "",
6690
+ `**This chunk contains a single line of ${chunk.maxLineChars} characters** \u2014 longer than one read returns, and paging cannot reach its tail (every page starts at a line boundary). Do not claim to have reviewed it. Return exactly:`,
6691
+ "",
6692
+ ` Uncoverable: chunk ${chunk.id} \u2014 line exceeds the read limit`
6693
+ );
6694
+ } else if (chunk.oversized) {
6695
+ parts.push(
6696
+ "",
6697
+ "**This chunk is oversized** \u2014 it is a single hunk with no safe place to cut, and it may exceed one read. Expect to page."
6698
+ );
6699
+ }
6700
+ parts.push(
6701
+ "",
6702
+ "You may also `read_file` the **full source files** above from the worktree whenever a hunk's correctness depends on code outside it. Diff context is three lines deep; state invariants are not. Page a source file that comes back truncated rather than reasoning from its first screenful.",
6703
+ "",
6704
+ "## What to review",
6705
+ "",
6706
+ "For your territory only, you own every dimension: line-by-line correctness, the removed-behavior audit of your own deleted lines, security, code quality, performance, test coverage, and the adversarial reading. Two duties are NOT yours, because a chunk agent is structurally blind to them: cross-file tracing (a caller in another chunk) and the cross-chunk half of removed-behavior. Audit the deletions in your own territory; do not conclude a deletion is unreplaced merely because its replacement is not in your range.",
6707
+ "",
6708
+ FINDING_FORMAT,
6709
+ "",
6710
+ SEVERITY,
6711
+ "",
6712
+ "Review the diff, not pre-existing issues in unchanged code."
6713
+ );
6714
+ if (rules && rules.trim()) {
6715
+ parts.push("", "## Project rules", "", rules.trim());
6716
+ }
6717
+ parts.push(
6718
+ "",
6719
+ "## When you are done",
6720
+ "",
6721
+ "If you found nothing, say so **and say what you examined** \u2014 the specific lines, files and cases you walked, in your own words. Do not recite a stock sentence: a return that names nothing you read is indistinguishable from never having read anything, and will be treated as such."
6722
+ );
6723
+ if (!unreachable) {
6724
+ parts.push(
6725
+ "",
6726
+ `Then, on its own final line: \`Covered: chunk ${chunk.id} lines ${chunk.startLine}-${chunk.endLine}\``
6727
+ );
6728
+ }
6729
+ return parts.join("\n");
6730
+ }
6731
+ __name(buildChunkAgentPrompt, "buildChunkAgentPrompt");
6732
+ function runAgentPrompt(args) {
6733
+ let report;
6734
+ try {
6735
+ report = JSON.parse(readFileSync9(args.plan, "utf8"));
6736
+ } catch (err) {
6737
+ throw new Error(
6738
+ `agent-prompt: cannot read the plan ${args.plan}: ${err.message}`
6739
+ );
6740
+ }
6741
+ let rules;
6742
+ if (args.rules) {
6743
+ try {
6744
+ rules = readFileSync9(args.rules, "utf8");
6745
+ } catch (err) {
6746
+ throw new Error(
6747
+ `agent-prompt: cannot read the rules ${args.rules}: ${err.message}. Omit --rules if this review has none; passing a path that does not resolve would silently review without the project rules it was told to enforce.`
6748
+ );
6749
+ }
6750
+ }
6751
+ writeStdoutLine(buildChunkAgentPrompt(report, args.chunk, rules));
6752
+ }
6753
+ __name(runAgentPrompt, "runAgentPrompt");
6754
+ var agentPromptCommand = {
6755
+ command: "agent-prompt",
6756
+ describe: "Build a chunk agent's launch prompt from the plan (the diff path and its byte range are welded in, not left to the caller to remember)",
6757
+ builder: /* @__PURE__ */ __name((yargs) => yargs.option("plan", {
6475
6758
  type: "string",
6476
- choices: ["territory", "dimension"],
6477
- default: "territory",
6478
- describe: "territory (Step 3B: one receipt per chunk) or dimension (Step 3A: no receipts, every agent walks the whole plan)"
6479
- }).option("expect", {
6759
+ demandOption: true,
6760
+ describe: "Path to the plan report from fetch-pr / plan-diff / capture-local"
6761
+ }).option("chunk", {
6762
+ type: "number",
6763
+ demandOption: true,
6764
+ describe: "Which chunk id this agent owns"
6765
+ }).option("rules", {
6480
6766
  type: "string",
6481
- describe: "Comma-separated labels of every agent launched, so an agent that never returned is caught"
6767
+ describe: "Path to the project rules file from `load-rules` (omit when the review has none)"
6482
6768
  }), "builder"),
6483
6769
  handler: /* @__PURE__ */ __name((argv) => {
6484
- runCheckCoverage(argv);
6770
+ runAgentPrompt(argv);
6485
6771
  }, "handler")
6486
6772
  };
6487
6773
 
6488
6774
  // packages/cli/src/commands/review/submit.ts
6489
6775
  init_esbuild_shims();
6490
- import { readFileSync as readFileSync8 } from "node:fs";
6776
+ import { readFileSync as readFileSync10 } from "node:fs";
6491
6777
 
6492
6778
  // packages/cli/src/services/skill-args-file.ts
6493
6779
  init_esbuild_shims();
@@ -6496,14 +6782,14 @@ import {
6496
6782
  openSync,
6497
6783
  writeSync,
6498
6784
  closeSync,
6499
- rmSync,
6785
+ rmSync as rmSync2,
6500
6786
  lstatSync as lstatSync2,
6501
6787
  existsSync as existsSync3,
6502
6788
  constants
6503
6789
  } from "node:fs";
6504
- import { join as join5 } from "node:path";
6790
+ import { join as join6 } from "node:path";
6505
6791
  var debugLogger2 = createDebugLogger("SKILL_ARGS_FILE");
6506
- var SKILL_ARGS_DIR = join5(".qwen", "tmp");
6792
+ var SKILL_ARGS_DIR = join6(".qwen", "tmp");
6507
6793
  function safe(s) {
6508
6794
  return s.replace(/[^A-Za-z0-9._-]/g, "_");
6509
6795
  }
@@ -6513,11 +6799,11 @@ function currentSessionId() {
6513
6799
  }
6514
6800
  __name(currentSessionId, "currentSessionId");
6515
6801
  function skillArgsDir(sessionId = currentSessionId()) {
6516
- return sessionId ? join5(SKILL_ARGS_DIR, `s-${safe(sessionId)}`) : SKILL_ARGS_DIR;
6802
+ return sessionId ? join6(SKILL_ARGS_DIR, `s-${safe(sessionId)}`) : SKILL_ARGS_DIR;
6517
6803
  }
6518
6804
  __name(skillArgsDir, "skillArgsDir");
6519
6805
  function skillArgsPath(skillName, sessionId = currentSessionId()) {
6520
- return join5(
6806
+ return join6(
6521
6807
  skillArgsDir(sessionId),
6522
6808
  `qwen-skill-args-${safe(skillName)}.txt`
6523
6809
  );
@@ -6560,7 +6846,7 @@ __name(writeSkillArgs, "writeSkillArgs");
6560
6846
  function clearSkillArgs(skillName) {
6561
6847
  const path3 = skillArgsPath(skillName);
6562
6848
  try {
6563
- rmSync(path3, { force: true });
6849
+ rmSync2(path3, { force: true });
6564
6850
  } catch (err) {
6565
6851
  debugLogger2.warn(
6566
6852
  `Could not clear skill args for ${skillName}: ${err.message}`
@@ -6609,7 +6895,7 @@ function authorization(args) {
6609
6895
  const path3 = currentSessionId() === "" && args.skillArgs ? args.skillArgs : sessionScoped;
6610
6896
  let raw;
6611
6897
  try {
6612
- raw = readFileSync8(path3, "utf8");
6898
+ raw = readFileSync10(path3, "utf8");
6613
6899
  } catch {
6614
6900
  return {
6615
6901
  ok: false,
@@ -6733,7 +7019,7 @@ function runSubmit(args) {
6733
7019
  }
6734
7020
  let payload;
6735
7021
  try {
6736
- payload = JSON.parse(readFileSync8(args.review, "utf8"));
7022
+ payload = JSON.parse(readFileSync10(args.review, "utf8"));
6737
7023
  } catch (err) {
6738
7024
  throw new Error(
6739
7025
  `Cannot read review JSON ${args.review}: ${err.message}`
@@ -6830,11 +7116,12 @@ import { spawnSync } from "node:child_process";
6830
7116
  import {
6831
7117
  mkdirSync as mkdirSync11,
6832
7118
  writeFileSync as writeFileSync11,
6833
- readFileSync as readFileSync9,
6834
- rmSync as rmSync2,
6835
- lstatSync as lstatSync3
7119
+ readFileSync as readFileSync11,
7120
+ rmSync as rmSync3,
7121
+ lstatSync as lstatSync3,
7122
+ existsSync as existsSync4
6836
7123
  } from "node:fs";
6837
- import { dirname as dirname9, join as join6, isAbsolute as isAbsolute2, resolve as resolve7, sep as sep2 } from "node:path";
7124
+ import { dirname as dirname9, join as join7, isAbsolute as isAbsolute2, sep as sep2 } from "node:path";
6838
7125
  function isWorkspaceMember(filePath, workspaceGlobs) {
6839
7126
  const norm = filePath.replace(/^\.\//, "");
6840
7127
  const matches = /* @__PURE__ */ __name((glob) => {
@@ -6951,7 +7238,7 @@ function safeRmWithin(worktree, relPath) {
6951
7238
  const parts = relPath.split(/[/\\]+/).filter((s) => s && s !== ".");
6952
7239
  let cur = worktree;
6953
7240
  for (let i = 0; i < parts.length; i++) {
6954
- cur = join6(cur, parts[i]);
7241
+ cur = join7(cur, parts[i]);
6955
7242
  let st;
6956
7243
  try {
6957
7244
  st = lstatSync3(cur);
@@ -6964,15 +7251,34 @@ function safeRmWithin(worktree, relPath) {
6964
7251
  );
6965
7252
  }
6966
7253
  }
6967
- rmSync2(cur, { force: true });
7254
+ rmSync3(cur, { force: true });
6968
7255
  }
6969
7256
  __name(safeRmWithin, "safeRmWithin");
7257
+ function discardWorktree(cwd, tree) {
7258
+ const sweep = spawnSync("git", ["worktree", "remove", "--force", tree], {
7259
+ cwd,
7260
+ encoding: "utf8"
7261
+ });
7262
+ rmSync3(tree, { recursive: true, force: true });
7263
+ return sweep;
7264
+ }
7265
+ __name(discardWorktree, "discardWorktree");
6970
7266
  var existsAtBase = /* @__PURE__ */ __name((cwd, base, path3) => existsAtRev(cwd, base, path3), "existsAtBase");
7267
+ function probeCreateFailureDetail(err, sweepStderr) {
7268
+ const sweepErr = sweepStderr.trim();
7269
+ return `probe worktree could not be created: ${err instanceof Error ? err.message : String(err)}` + (sweepErr ? ` (stale-tree sweep also reported: ${sweepErr})` : "");
7270
+ }
7271
+ __name(probeCreateFailureDetail, "probeCreateFailureDetail");
7272
+ function probeCleanupFailureDetail(probeTree, removeError, sweepStderr) {
7273
+ const why = removeError ? removeError instanceof Error ? removeError.message : String(removeError) : sweepStderr.trim();
7274
+ return `could not remove probe worktree ${probeTree}${why ? `: ${why}` : ""}`;
7275
+ }
7276
+ __name(probeCleanupFailureDetail, "probeCleanupFailureDetail");
6971
7277
  async function runTestEfficacy(args) {
6972
7278
  const { report, worktree, base, out } = args;
6973
- const plan = JSON.parse(readFileSync9(report, "utf8"));
7279
+ const plan = JSON.parse(readFileSync11(report, "utf8"));
6974
7280
  const rootPkg = JSON.parse(
6975
- readFileSync9(`${worktree}/package.json`, "utf8")
7281
+ readFileSync11(`${worktree}/package.json`, "utf8")
6976
7282
  );
6977
7283
  const globs = rootPkg.workspaces ?? [];
6978
7284
  const { unreachable, probes, revert } = planTestEfficacy(
@@ -6980,8 +7286,8 @@ async function runTestEfficacy(args) {
6980
7286
  globs
6981
7287
  );
6982
7288
  for (const p of revert) {
6983
- const norm = join6(worktree, p);
6984
- const root = join6(worktree, ".");
7289
+ const norm = join7(worktree, p);
7290
+ const root = join7(worktree, ".");
6985
7291
  if (isAbsolute2(p) || norm !== root && !norm.startsWith(root + sep2)) {
6986
7292
  throw new Error(
6987
7293
  `refusing to run: revert path escapes the worktree: ${JSON.stringify(p)}`
@@ -6992,16 +7298,15 @@ async function runTestEfficacy(args) {
6992
7298
  let cleanupFailure;
6993
7299
  if (probes.length > 0 && revert.length > 0) {
6994
7300
  const headSha = gitOut(worktree, "rev-parse", "HEAD");
6995
- const probeTree = `${resolve7(worktree)}-probe`;
7301
+ const probeTree = probeWorktreePath(worktree);
6996
7302
  let created = false;
7303
+ let sweep;
6997
7304
  try {
6998
- spawnSync("git", ["worktree", "remove", "--force", probeTree], {
6999
- cwd: worktree
7000
- });
7305
+ sweep = discardWorktree(worktree, probeTree);
7001
7306
  git2(worktree, "worktree", "add", "--detach", probeTree, headSha);
7002
7307
  created = true;
7003
7308
  } catch (e) {
7004
- const detail = `probe worktree could not be created: ${e instanceof Error ? e.message : String(e)}`;
7309
+ const detail = probeCreateFailureDetail(e, String(sweep?.stderr ?? ""));
7005
7310
  for (const file of probes) {
7006
7311
  results.push({ file, verdict: "inconclusive", detail });
7007
7312
  }
@@ -7054,10 +7359,19 @@ async function runTestEfficacy(args) {
7054
7359
  }))
7055
7360
  );
7056
7361
  } finally {
7362
+ let removeError;
7363
+ let discard;
7057
7364
  try {
7058
- git2(worktree, "worktree", "remove", "--force", probeTree);
7365
+ discard = discardWorktree(worktree, probeTree);
7059
7366
  } catch (e) {
7060
- cleanupFailure = `could not remove probe worktree ${probeTree}: ${e instanceof Error ? e.message : String(e)}`;
7367
+ removeError = e;
7368
+ }
7369
+ if (existsSync4(probeTree)) {
7370
+ cleanupFailure = probeCleanupFailureDetail(
7371
+ probeTree,
7372
+ removeError,
7373
+ String(discard?.stderr ?? "")
7374
+ );
7061
7375
  }
7062
7376
  }
7063
7377
  }
@@ -7122,23 +7436,27 @@ var testEfficacyCommand = {
7122
7436
  // packages/cli/src/commands/review/cleanup.ts
7123
7437
  init_esbuild_shims();
7124
7438
  import { execFileSync as execFileSync4 } from "node:child_process";
7125
- import { existsSync as existsSync4, readdirSync, unlinkSync } from "node:fs";
7126
- import { join as join7 } from "node:path";
7439
+ import { existsSync as existsSync5, readdirSync as readdirSync2, unlinkSync } from "node:fs";
7440
+ import { join as join8 } from "node:path";
7127
7441
  function runCleanup(target) {
7128
7442
  let removedAny = false;
7443
+ let failedAny = false;
7129
7444
  const prMatch = /^pr-(\d+)$/.exec(target);
7130
7445
  if (prMatch) {
7131
7446
  const prNumber = prMatch[1];
7447
+ const report = /* @__PURE__ */ __name((label, path3) => {
7448
+ const { existed, freed, reason } = releaseWorktree(path3);
7449
+ if (freed) {
7450
+ writeStdoutLine(`Removed ${label}: ${path3}`);
7451
+ removedAny = true;
7452
+ } else if (existed) {
7453
+ writeStderrLine(`Failed to remove ${label} ${path3}: ${reason}`);
7454
+ failedAny = true;
7455
+ }
7456
+ }, "report");
7132
7457
  const wt = worktreePath(prNumber);
7133
- if (releaseWorktree(wt)) {
7134
- writeStdoutLine(`Removed worktree: ${wt}`);
7135
- removedAny = true;
7136
- }
7137
- const probeWt = `${wt}-probe`;
7138
- if (releaseWorktree(probeWt)) {
7139
- writeStdoutLine(`Removed probe worktree: ${probeWt}`);
7140
- removedAny = true;
7141
- }
7458
+ report("worktree", wt);
7459
+ report("probe worktree", probeWorktreePath(wt));
7142
7460
  const branch = reviewBranch(prNumber);
7143
7461
  if (refExists(branch)) {
7144
7462
  try {
@@ -7155,7 +7473,7 @@ function runCleanup(target) {
7155
7473
  const prefix = tmpPrefix(target);
7156
7474
  let tmpEntries = [];
7157
7475
  try {
7158
- tmpEntries = existsSync4(REVIEW_TMP_DIR) ? readdirSync(REVIEW_TMP_DIR) : [];
7476
+ tmpEntries = existsSync5(REVIEW_TMP_DIR) ? readdirSync2(REVIEW_TMP_DIR) : [];
7159
7477
  } catch (err) {
7160
7478
  writeStderrLine(
7161
7479
  `Failed to read ${REVIEW_TMP_DIR}: ${err.message}`
@@ -7163,16 +7481,17 @@ function runCleanup(target) {
7163
7481
  }
7164
7482
  for (const file of tmpEntries) {
7165
7483
  if (!file.startsWith(prefix)) continue;
7166
- const full = join7(REVIEW_TMP_DIR, file);
7484
+ const full = join8(REVIEW_TMP_DIR, file);
7167
7485
  try {
7168
7486
  unlinkSync(full);
7169
7487
  writeStdoutLine(`Removed temp file: ${full}`);
7170
7488
  removedAny = true;
7171
7489
  } catch (err) {
7172
7490
  writeStderrLine(`Failed to remove ${full}: ${err.message}`);
7491
+ failedAny = true;
7173
7492
  }
7174
7493
  }
7175
- if (!removedAny) {
7494
+ if (!removedAny && !failedAny) {
7176
7495
  writeStdoutLine(`Nothing to clean for target "${target}".`);
7177
7496
  }
7178
7497
  }
@@ -7194,9 +7513,9 @@ var cleanupCommand = {
7194
7513
  var reviewCommand = {
7195
7514
  command: "review",
7196
7515
  describe: "Internal helpers used by the /review skill (PR worktree setup, context fetch, rules loading, presubmit checks, cleanup)",
7197
- builder: /* @__PURE__ */ __name((yargs) => yargs.command(parseArgsCommand).command(fetchPrCommand).command(captureLocalCommand).command(planDiffCommand).command(prContextCommand).command(loadRulesCommand).command(resolveAnchorsCommand).command(checkCoverageCommand).command(presubmitCommand).command(testEfficacyCommand).command(composeReviewCommand).command(submitCommand).command(cleanupCommand).demandCommand(
7516
+ builder: /* @__PURE__ */ __name((yargs) => yargs.command(parseArgsCommand).command(fetchPrCommand).command(captureLocalCommand).command(planDiffCommand).command(prContextCommand).command(loadRulesCommand).command(agentPromptCommand).command(resolveAnchorsCommand).command(checkCoverageCommand).command(presubmitCommand).command(testEfficacyCommand).command(composeReviewCommand).command(submitCommand).command(cleanupCommand).demandCommand(
7198
7517
  1,
7199
- "Specify a subcommand: parse-args, fetch-pr, capture-local, plan-diff, pr-context, load-rules, resolve-anchors, check-coverage, presubmit, test-efficacy, compose-review, submit, or cleanup."
7518
+ "Specify a subcommand: parse-args, fetch-pr, capture-local, plan-diff, pr-context, load-rules, agent-prompt, resolve-anchors, check-coverage, presubmit, test-efficacy, compose-review, submit, or cleanup."
7200
7519
  ).version(false), "builder"),
7201
7520
  handler: /* @__PURE__ */ __name(() => {
7202
7521
  }, "handler")
@@ -7396,10 +7715,10 @@ var updateCommand3 = {
7396
7715
  stdioHelpers,
7397
7716
  { updateEventEmitter }
7398
7717
  ] = await Promise.all([
7399
- import("./settings-IXF5FIQO.js"),
7400
- import("./updateCheck-ZXL66KIG.js"),
7401
- import("./installationInfo-WOTDQMSC.js"),
7402
- import("./standalone-update-MHLSFHE6.js"),
7718
+ import("./settings-HQNDK7TG.js"),
7719
+ import("./updateCheck-QTVVISH7.js"),
7720
+ import("./installationInfo-WELKRHHE.js"),
7721
+ import("./standalone-update-L5XW3D7K.js"),
7403
7722
  import("./stdioHelpers-UMY72QRP.js"),
7404
7723
  import("./updateEventEmitter-5MKC7BLQ.js")
7405
7724
  ]);
@@ -8701,6 +9020,9 @@ async function loadCliConfig(settings, argv, cwd = process.cwd(), overrideExtens
8701
9020
  enabled: lspEnabled
8702
9021
  },
8703
9022
  agents: settings.agents ? {
9023
+ builtin: settings.agents.builtin ? {
9024
+ exploreModel: settings.agents.builtin.exploreModel
9025
+ } : void 0,
8704
9026
  maxParallelAgents: settings.agents.maxParallelAgents,
8705
9027
  displayMode: settings.agents.displayMode,
8706
9028
  arena: settings.agents.arena ? {
@@ -8858,6 +9180,9 @@ var ExtensionRefreshState = class {
8858
9180
  needsExtensionRefresh() {
8859
9181
  return this.extensionRefreshNeeded;
8860
9182
  }
9183
+ isSuppressed() {
9184
+ return this.suppressionDepth > 0 || Date.now() < this.suppressUntil;
9185
+ }
8861
9186
  isReloadInProgress() {
8862
9187
  return this.reloadInProgress;
8863
9188
  }
@@ -8896,9 +9221,6 @@ var ExtensionRefreshState = class {
8896
9221
  this.suppressionDepth = 0;
8897
9222
  this.suppressUntil = 0;
8898
9223
  }
8899
- isSuppressed() {
8900
- return this.suppressionDepth > 0 || Date.now() < this.suppressUntil;
8901
- }
8902
9224
  };
8903
9225
  function isPromiseLike(value) {
8904
9226
  return typeof value === "object" && value !== null && "then" in value && typeof value.then === "function";