@testmuai/kane-cli 0.8.1 → 0.8.3

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 (205) hide show
  1. package/bin/kane-cli.cjs +1 -1
  2. package/bin/resolve-runtime.cjs +8 -0
  3. package/dist/ChatSurface-FJSO3IKR.js +8 -0
  4. package/dist/{ChromeProfilePicker-AUU7JF6F.js → ChromeProfilePicker-NTZ2RN3L.js} +1 -1
  5. package/dist/{CliFeedbackPrompt-4W74Y3UF.js → CliFeedbackPrompt-BCHUH24C.js} +1 -1
  6. package/dist/{CliUploadProgress-6HL7WTEX.js → CliUploadProgress-QVAJJRUW.js} +1 -1
  7. package/dist/{ConfigView-6BSCZP5Y.js → ConfigView-LAKAQN7O.js} +1 -1
  8. package/dist/EvidenceViewOffer-POKUWAPS.js +2 -0
  9. package/dist/FolderPicker-GR6FZMUJ.js +2 -0
  10. package/dist/{HelpView-TU7ED43J.js → HelpView-JFFVHQAW.js} +1 -1
  11. package/dist/{InfoBox-JLTMKVDE.js → InfoBox-46C7AHDE.js} +1 -1
  12. package/dist/{LinksBox-LREUUJDV.js → LinksBox-KFJXZDUJ.js} +1 -1
  13. package/dist/{ProfilesView-W3GX2N2E.js → ProfilesView-FV3KFVBX.js} +1 -1
  14. package/dist/{ProjectPicker-SYQUJK2J.js → ProjectPicker-MCH35VEF.js} +1 -1
  15. package/dist/{SaveSessionPrompt-MR5NJMRP.js → SaveSessionPrompt-RXHP3YW6.js} +1 -1
  16. package/dist/SingleShotApp-BK5QNXGG.js +2 -0
  17. package/dist/{SummaryBox-UAYSVFB7.js → SummaryBox-33K2MMUW.js} +1 -1
  18. package/dist/TestMdRunView-AT26LOSG.js +2 -0
  19. package/dist/{WhoamiView-2YU76ASQ.js → WhoamiView-HUPBB5AQ.js} +1 -1
  20. package/dist/app-client-ZCCNE3RV.js +2 -0
  21. package/dist/{app-download-AEEFQ63M.js → app-download-3O7NJNGG.js} +1 -1
  22. package/dist/{auth-HET3TBRI.js → auth-OMWFVDL2.js} +1 -1
  23. package/dist/{bind-STKXOUYI.js → bind-NXXKFJMA.js} +2 -2
  24. package/dist/bootstrap-MMRPAHWE.js +2 -0
  25. package/dist/bridge-UH32UGR5.js +2 -0
  26. package/dist/{changelog-7OWRHFHZ.js → changelog-VZ5HFHYM.js} +1 -1
  27. package/dist/{chat-controller-T2FAI55V.js → chat-controller-R4THYYPU.js} +1 -1
  28. package/dist/{chunk-HMYMSRA4.js → chunk-2ERQYYSJ.js} +1 -1
  29. package/dist/{chunk-DCY6R5DP.js → chunk-2N4SZOWN.js} +1 -1
  30. package/dist/{chunk-FMRSMN34.js → chunk-2ZDXNTZT.js} +1 -1
  31. package/dist/{chunk-OTTGS2TE.js → chunk-37ZWKLEN.js} +1 -1
  32. package/dist/{chunk-UV462FZR.js → chunk-3MFTTLOF.js} +1 -1
  33. package/dist/{chunk-DO5HAO3H.js → chunk-3S5DDQLP.js} +1 -1
  34. package/dist/{chunk-BRHNRCEZ.js → chunk-4FQI643D.js} +1 -1
  35. package/dist/chunk-4G4RWARU.js +2 -0
  36. package/dist/{chunk-GZPK6FRP.js → chunk-5BVOF4UW.js} +1 -1
  37. package/dist/{chunk-C7HSWZP6.js → chunk-5CKQTZMG.js} +1 -1
  38. package/dist/{chunk-ZVHCQMJ6.js → chunk-5NQ3TI4S.js} +2 -2
  39. package/dist/{chunk-6O3DDOP2.js → chunk-5OVEBP4D.js} +1 -1
  40. package/dist/{chunk-FQLIW3LM.js → chunk-6G5YKTVN.js} +1 -1
  41. package/dist/chunk-6J5T5FEY.js +2 -0
  42. package/dist/{chunk-QRZRSAZH.js → chunk-7YZMUTJA.js} +1 -1
  43. package/dist/chunk-A2SQD2AY.js +4 -0
  44. package/dist/chunk-A5FFLJVL.js +26 -0
  45. package/dist/{chunk-RFR4ZKIC.js → chunk-AF572MQG.js} +2 -2
  46. package/dist/{chunk-HCKH44I2.js → chunk-APETOVZK.js} +1 -1
  47. package/dist/{chunk-AW2XUHH4.js → chunk-AVH3BEEU.js} +1 -1
  48. package/dist/chunk-AXTPNZPX.js +2 -0
  49. package/dist/{chunk-2WVKOZ6W.js → chunk-BPMSNGXQ.js} +1 -1
  50. package/dist/{chunk-EDSZJZFG.js → chunk-CDB3SYZG.js} +1 -1
  51. package/dist/{chunk-T5Y6MOLM.js → chunk-CJP7RX3E.js} +1 -1
  52. package/dist/{chunk-G7VQCS4J.js → chunk-CVCVBQP6.js} +1 -1
  53. package/dist/{chunk-YFYCCTSL.js → chunk-D5VYMHSO.js} +1 -1
  54. package/dist/chunk-D6FYCAIA.js +2 -0
  55. package/dist/{chunk-ZIUAOEUC.js → chunk-DJR3M7XO.js} +1 -1
  56. package/dist/{chunk-65ZTD5SJ.js → chunk-DN42IM2Z.js} +2 -2
  57. package/dist/{chunk-TKGUT425.js → chunk-DOG7S7R6.js} +1 -1
  58. package/dist/chunk-DSXSU5MH.js +10 -0
  59. package/dist/{chunk-QSDH5P7C.js → chunk-DVYO4CR2.js} +1 -1
  60. package/dist/chunk-DXI5TXNL.js +19 -0
  61. package/dist/{chunk-JJHG3BWO.js → chunk-EBJD2V4Z.js} +1 -1
  62. package/dist/chunk-FPAJURPL.js +2 -0
  63. package/dist/{chunk-3LJWYRAA.js → chunk-GIQURCTO.js} +1 -1
  64. package/dist/{chunk-2BGUUWNF.js → chunk-GR35ZFM2.js} +2 -2
  65. package/dist/chunk-HJ6AXOCR.js +2 -0
  66. package/dist/{chunk-6XX4LEVJ.js → chunk-IEOHAHZO.js} +1 -1
  67. package/dist/{chunk-QW6EZC53.js → chunk-IFIXY3YG.js} +1 -1
  68. package/dist/{chunk-XO5ZH3ZR.js → chunk-IHAHCFFG.js} +1 -1
  69. package/dist/chunk-ITTZYA2G.js +4 -0
  70. package/dist/chunk-IVYXXZEE.js +6 -0
  71. package/dist/chunk-IWWQTXGK.js +11 -0
  72. package/dist/{chunk-GCBKDX2J.js → chunk-JANVTG62.js} +1 -1
  73. package/dist/{chunk-IOFZSQAA.js → chunk-KGSVOTLG.js} +1 -1
  74. package/dist/{chunk-L7MXYCD7.js → chunk-KOMKHFC4.js} +1 -1
  75. package/dist/{chunk-EWCAFKLX.js → chunk-KZVEFBH5.js} +1 -1
  76. package/dist/{chunk-FEJXWJ3L.js → chunk-LCU2P3CH.js} +1 -1
  77. package/dist/{chunk-RC52N7PC.js → chunk-LNQCZ5DS.js} +1 -1
  78. package/dist/{chunk-IP2O264K.js → chunk-LP3BSP74.js} +1 -1
  79. package/dist/chunk-LQQXPY5B.js +4 -0
  80. package/dist/{chunk-3POR47RC.js → chunk-LSZVSYAP.js} +2 -2
  81. package/dist/chunk-MMBBQ4OZ.js +2 -0
  82. package/dist/chunk-NNCMMV6P.js +349 -0
  83. package/dist/{chunk-YJELGSKJ.js → chunk-NVGM5ISX.js} +1 -1
  84. package/dist/{chunk-GKYPNSQP.js → chunk-NWJOPZ7P.js} +2 -2
  85. package/dist/{chunk-ELM6MXGJ.js → chunk-NXXJ56QA.js} +1 -1
  86. package/dist/{chunk-NX7TM662.js → chunk-QJTXNQV5.js} +1 -1
  87. package/dist/chunk-RKXHVP2Z.js +2 -0
  88. package/dist/chunk-RUCSRS4C.js +5 -0
  89. package/dist/{chunk-TFPPEOAK.js → chunk-SA2LQSYP.js} +1 -1
  90. package/dist/chunk-SPQPOUUR.js +11 -0
  91. package/dist/chunk-SQDKYSWT.js +12 -0
  92. package/dist/chunk-TAOHYWEO.js +2 -0
  93. package/dist/{chunk-UXDL4XDL.js → chunk-TRVB7RSW.js} +1 -1
  94. package/dist/{chunk-SDPRO2LE.js → chunk-TUTDSX7T.js} +1 -1
  95. package/dist/{chunk-766WGMBU.js → chunk-UBTNWAKK.js} +1 -1
  96. package/dist/chunk-UJZZDPDY.js +2 -0
  97. package/dist/chunk-VK3NU742.js +21 -0
  98. package/dist/{chunk-DZGCXKKI.js → chunk-WCF2Z4SE.js} +1 -1
  99. package/dist/{chunk-KU6IXFGZ.js → chunk-WMMJXI5O.js} +1 -1
  100. package/dist/chunk-X2FM67OM.js +4 -0
  101. package/dist/chunk-XMYCRE5K.js +4 -0
  102. package/dist/chunk-XO45NGSN.js +2 -0
  103. package/dist/chunk-YJNGBZ42.js +4 -0
  104. package/dist/{chunk-7JWKHKFU.js → chunk-ZH64GOBG.js} +1 -1
  105. package/dist/{chunk-UDIQOJEL.js → chunk-ZNNRCUHH.js} +1 -1
  106. package/dist/{chunk-KFSUPQAG.js → chunk-ZUYPPPC5.js} +43 -43
  107. package/dist/{config-RS47F5SC.js → config-OTUKOTHM.js} +1 -1
  108. package/dist/{credentials-OH6AVI6N.js → credentials-A3RU25MJ.js} +1 -1
  109. package/dist/deps-bundle-RIBEQC2R.js +2 -0
  110. package/dist/{deps-resolve-XC5S53DG.js → deps-resolve-7SWSUDRX.js} +1 -1
  111. package/dist/dispatch-RHSWJJLC.js +2 -0
  112. package/dist/doctor-XP7YDE3J.js +2 -0
  113. package/dist/evidence-K7R7OG2K.js +2 -0
  114. package/dist/evolve-cmd-FFF3F3HO.js +2 -0
  115. package/dist/extract-bind-VIPNGK2H.js +10 -0
  116. package/dist/{extract-cmd-UZMEZMGP.js → extract-cmd-5J47Q4XU.js} +1 -1
  117. package/dist/gaps-cmd-WPCJPLGB.js +3 -0
  118. package/dist/{generate-headless-D3SVQ2AI.js → generate-headless-AJI2OVRG.js} +2 -2
  119. package/dist/index.js +61 -60
  120. package/dist/{ingest-EX72IEQT.js → ingest-4447MYLF.js} +1 -1
  121. package/dist/ingest-cmd-2LK7DWDW.js +2 -0
  122. package/dist/interactive-bind-PI3HY623.js +25 -0
  123. package/dist/{list-commands-MRXL5HGS.js → list-commands-7Y5XV5FK.js} +1 -1
  124. package/dist/login-flow-Z45G34DM.js +2 -0
  125. package/dist/mobile-prompts-O5ALU3QU.js +2 -0
  126. package/dist/{persist-recorded-session-TLDQ5HKP.js → persist-recorded-session-TKSU4HOA.js} +1 -1
  127. package/dist/{phase-seed-VFHIH6FL.js → phase-seed-DIRETNU6.js} +1 -1
  128. package/dist/{pipeline-UOM4LNAI.js → pipeline-HZUV7IMT.js} +1 -1
  129. package/dist/prepare-target-DBYKQ7HW.js +2 -0
  130. package/dist/reconcile-cmd-VHEW2DY5.js +2 -0
  131. package/dist/reconcile-deps-UJ6KVUIS.js +4 -0
  132. package/dist/reconcile-engine-NUQJSIFX.js +2 -0
  133. package/dist/{recording-banner-4M7XHVGI.js → recording-banner-GO2PP53Y.js} +1 -1
  134. package/dist/registry-KYPVINS2.js +2 -0
  135. package/dist/{require-project-folder-4UPQNEBJ.js → require-project-folder-NUQMH224.js} +1 -1
  136. package/dist/resolve-run-intent-H3HX5KUC.js +7 -0
  137. package/dist/{resolver-UBOZLFFE.js → resolver-HHLYRR5W.js} +1 -1
  138. package/dist/run-67ONKMGR.js +2 -0
  139. package/dist/{run-URPGHOQM.js → run-OPLOL3PZ.js} +1 -1
  140. package/dist/{run-test-md-76ZPKXO6.js → run-test-md-3BA56ZYF.js} +2 -2
  141. package/dist/session-items-2ATN7VXG.js +2 -0
  142. package/dist/{skill-installer-CIS6GAYF.js → skill-installer-O7JYVZXD.js} +1 -1
  143. package/dist/{spawner-J67QR4QP.js → spawner-OZ4OE44T.js} +1 -1
  144. package/dist/tcg-generate-EG2MXRJ7.js +2 -0
  145. package/dist/{testmd-actions-77ELR5UU.js → testmd-actions-YJ7O43Z6.js} +1 -1
  146. package/dist/{tms-client-VD3B3SMU.js → tms-client-V3TR4QW3.js} +1 -1
  147. package/dist/token-refresh-K7CANKFQ.js +2 -0
  148. package/dist/{validate-basic-2GVSQ2R5.js → validate-basic-HWYK3CU6.js} +1 -1
  149. package/dist/{verdicts-TRSTJLCL.js → verdicts-KFPMRADV.js} +1 -1
  150. package/dist/{version-check-O6PYTI4T.js → version-check-3ECNG5V2.js} +1 -1
  151. package/dist/walk-session-MZCMXVZB.js +2 -0
  152. package/dist/with-telemetry-Q6V6THIF.js +2 -0
  153. package/package.json +12 -12
  154. package/dist/ChatSurface-U37VZDCW.js +0 -8
  155. package/dist/EvidenceViewOffer-62XHEEGW.js +0 -2
  156. package/dist/FolderPicker-S7U2EN2M.js +0 -2
  157. package/dist/SingleShotApp-XOKVOM7C.js +0 -2
  158. package/dist/TestMdRunView-7UVSDAF4.js +0 -2
  159. package/dist/app-client-OEXESV4U.js +0 -2
  160. package/dist/bootstrap-44YKVWWE.js +0 -2
  161. package/dist/bridge-5Z3BIB77.js +0 -2
  162. package/dist/chunk-27U4PLPX.js +0 -2
  163. package/dist/chunk-2KDGIZED.js +0 -4
  164. package/dist/chunk-3PECJD6S.js +0 -11
  165. package/dist/chunk-7BZSCUPP.js +0 -10
  166. package/dist/chunk-7Q6M6P4X.js +0 -26
  167. package/dist/chunk-CTW2VQKS.js +0 -6
  168. package/dist/chunk-FNH55WSR.js +0 -19
  169. package/dist/chunk-GPG3FIN3.js +0 -21
  170. package/dist/chunk-HEAIJCGZ.js +0 -2
  171. package/dist/chunk-KCCSWEGA.js +0 -4
  172. package/dist/chunk-MA34UWKX.js +0 -4
  173. package/dist/chunk-MBF3FP5P.js +0 -5
  174. package/dist/chunk-MXHHMIO2.js +0 -349
  175. package/dist/chunk-OMQCD3KR.js +0 -2
  176. package/dist/chunk-QGKPLOUI.js +0 -2
  177. package/dist/chunk-RLRNLIRS.js +0 -2
  178. package/dist/chunk-TYLYFERW.js +0 -10
  179. package/dist/chunk-V2R3LCA3.js +0 -12
  180. package/dist/chunk-VGFTNLQQ.js +0 -2
  181. package/dist/chunk-W2JFDDIB.js +0 -2
  182. package/dist/chunk-W4B5LOEX.js +0 -4
  183. package/dist/chunk-YRFMPIU2.js +0 -4
  184. package/dist/dispatch-SE5GY3Z2.js +0 -2
  185. package/dist/doctor-FSECFZUU.js +0 -2
  186. package/dist/evidence-OYPHZUKI.js +0 -2
  187. package/dist/evolve-cmd-BCPNXAMV.js +0 -2
  188. package/dist/extract-bind-LLEASZAK.js +0 -10
  189. package/dist/gaps-cmd-IVXFPFAQ.js +0 -3
  190. package/dist/ingest-cmd-EAE7N5RC.js +0 -2
  191. package/dist/interactive-bind-ORMN2REX.js +0 -25
  192. package/dist/login-flow-QJQM3RHT.js +0 -2
  193. package/dist/mobile-prompts-TOX35ER6.js +0 -2
  194. package/dist/prepare-target-QYWIJIVQ.js +0 -2
  195. package/dist/reconcile-cmd-3H34KVVD.js +0 -2
  196. package/dist/reconcile-deps-XIH75ZLY.js +0 -4
  197. package/dist/reconcile-engine-UKWPG2LV.js +0 -2
  198. package/dist/registry-PYOTKZYZ.js +0 -2
  199. package/dist/resolve-run-intent-X72V3KJA.js +0 -7
  200. package/dist/run-2COODVX2.js +0 -2
  201. package/dist/tcg-generate-BDTRKY2A.js +0 -2
  202. package/dist/token-refresh-4BPAPXKK.js +0 -2
  203. package/dist/walk-session-CHJXHZMO.js +0 -2
  204. package/dist/with-telemetry-CQCWLVOC.js +0 -2
  205. /package/dist/{lifecycle-cmd-O2324GN6.js → lifecycle-cmd-HO5VL7AM.js} +0 -0
@@ -1,12 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{b as jt}from"./chunk-ZMNJBUAO.js";import{f as tr}from"./chunk-W5TTF7GB.js";import{a as Bt}from"./chunk-I7TIGB7K.js";import{a as ke,c as Yt,e as Zt,f as Fe,g as Qt,h as or}from"./chunk-KU6IXFGZ.js";import{a as Xt,b as rr,c as sr,d as ir,e as dt,f as nr}from"./chunk-ZGBSGZZM.js";import{a as Se,b as qt,c as Gt,d as Lt,e as Vt}from"./chunk-BRHNRCEZ.js";import{a as zt}from"./chunk-L2TV4G56.js";import{a as Kt,b as Jt}from"./chunk-JFAFKHDX.js";import{c as Wt}from"./chunk-6KPPGMO2.js";import{a as Nt,e as Ht}from"./chunk-GFKCTYCA.js";import{b as Ft}from"./chunk-YKTYVJBN.js";import{a as er}from"./chunk-IMR64OCZ.js";import{d as Mt}from"./chunk-W4B5LOEX.js";import{a as be,b as ct}from"./chunk-DNNZ353O.js";import{e as Ut}from"./chunk-OMQCD3KR.js";import{a as Be}from"./chunk-SDPRO2LE.js";import{a as we}from"./chunk-NVGBE2DR.js";import{b as ot}from"./chunk-IDX3TOPY.js";import{A as Z,k as ye,o as je}from"./chunk-TH47OOBV.js";import{f as It}from"./chunk-DUAXZYAD.js";import{e as at}from"./chunk-DBIBROYW.js";import{d as de}from"./chunk-WXHQYYD5.js";import{b as Ot}from"./chunk-IAHKTEET.js";import{a as At}from"./chunk-5EOX4MEY.js";import{appendFileSync as wr,mkdirSync as ut,rmdirSync as br,writeFileSync as lt}from"fs";import{dirname as mr,extname as Sr,join as oe}from"path";var J=class extends Error{code;constructor(e,a){super(`${e}: ${a}`),this.name="ProposalAdapterError",this.code=e}};function cr(r){return r.version===2}var ar=8;function vr(r){let e=/^extract@(\d+)$/.exec(r??"");return e?Number.parseInt(e[1],10):null}var yr=r=>typeof r=="object"&&r!==null&&"op"in r;function qe(r,e,a){return{anchor:r.anchor,quote:r.quote,...a||r.source_id!==e?{source_id:r.source_id}:{}}}function dr(r,e,a={}){let m=vr(a.templateVersion),_=m!==null&&m>=5,x=m!==null&&m<5,y=r.archived!=null&&r.archived.length>0&&m!==null&&m<5;if(y&&a.warn?.(`dropped ${r.archived.length} archive op(s): the bound extract template @${m} never described archiving \u2014 nothing was archived; the use-cases still land`),!_&&r.read_basis.length!==1)throw new J("READ_BASIS_COUNT",`read_basis must have exactly 1 element, got ${r.read_basis.length}`);if(r.read_basis.length===0)throw new J("READ_BASIS_COUNT","read_basis must not be empty");let v=r.read_basis[0],g=r.read_basis.length>1,k=r.use_cases.map(i=>{if(x&&i.cite.length!==1)throw new J("CITE_COUNT",`${i.temp_ref}: cite must have exactly 1 element, got ${i.cite.length}`);if(i.cite.length<1||i.cite.length>ar)throw new J("CITE_COUNT",`${i.temp_ref}: 1..${ar} cites allowed, got ${i.cite.length}`);let I=(h,Q)=>{if(!_&&h!==v.source_id)throw new J("SOURCE_MISMATCH",`${Q}: cite source ${h} != read_basis source ${v.source_id} (single-source)`)};I(i.cite[0].source_id,i.temp_ref);let P=i.cite.map(h=>(I(h.source_id,i.temp_ref),qe(h,v.source_id,_&&(g||h.source_id!==v.source_id)))),u=(i.updated?.criteria??[]).some(yr);if(!_&&u)throw new J("CRITERIA_OPS_UNSUPPORTED",`${i.temp_ref}: op-union updated.criteria (keep/set/remove) needs an extract@5+ binding \u2014 this session is bound to ${a.templateVersion??"an unversioned template"}`);return{temp_ref:i.temp_ref,title:i.title,...i.description!==void 0?{description:i.description}:{},...i.summary!==void 0?{summary:i.summary}:{},...i.actors!==void 0?{actors:i.actors}:{},...i.value!==void 0?{value:i.value}:{},risk:i.risk,cite:P[0],...P.length>1?{cites:P}:{},...i.criteria!=null&&i.criteria.length>0?{criteria:i.criteria.map((h,Q)=>(I(h.cite.source_id,`${i.temp_ref}.criteria[${Q}]`),{text:h.text,cite:qe(h.cite,v.source_id,_&&h.cite.source_id!==v.source_id)}))}:{},depends_on_hint:i.depends_on_hint,matches_existing:i.matches_existing,...i.conflicts_with!=null?{conflicts_with:i.conflicts_with}:{},...i.changed?{changed:!0}:{},...i.updated!=null?{updated:{...i.updated.title!=null?{title:i.updated.title}:{},...i.updated.description!=null?{description:i.updated.description}:{},...i.updated.summary!=null?{summary:i.updated.summary}:{},...i.updated.actors!=null?{actors:i.updated.actors}:{},...i.updated.value!=null?{value:i.updated.value}:{},...i.updated.risk!=null?{risk:i.updated.risk}:{},...i.updated.criteria!=null?{criteria:u?i.updated.criteria.map(h=>h.op==="set"?{op:"set",text:h.text,cite:qe(h.cite,v.source_id,_&&h.cite.source_id!==v.source_id)}:h.op==="keep"?{op:"keep",ref:h.ref,text:h.text}:{op:"remove",ref:h.ref,text:h.text,reason:h.reason}):i.updated.criteria.map((h,Q)=>(I(h.cite.source_id,`${i.temp_ref}.updated.criteria[${Q}]`),{text:h.text,cite:qe(h.cite,v.source_id,_&&h.cite.source_id!==v.source_id)}))}:{}}}:{},...i.change_note!=null?{change_note:i.change_note}:{}}});return{version:1,read_basis:e,source:{source_id:v.source_id,source_cid:v.source_cid},use_cases:k,...g?{sources:r.read_basis.map(i=>({source_id:i.source_id,source_cid:i.source_cid}))}:{},...r.extraction_of!=null&&r.extraction_of.length>0?{extraction_claims:r.extraction_of.map(i=>({source_id:i.source_id,completeness:i.completeness}))}:{},...r.archived!=null&&r.archived.length>0&&!y?{archived:r.archived.map(i=>({target:i.target,reason:i.reason,basis:i.basis}))}:{}}}function ur(r){let{contextDir:e,graph:a}=r,m=r.maxDigestBytes??4096,_={},x=[];for(let[g,k]of a.heads){if(_[g]=k,typeof k!="string")continue;let i=a.mediaOf(k),I=a.getNode(k)?.content?.blob;if(typeof I=="string")if(i.format==="image")x.push({source_id:g,cid:k,format:"image",blobRef:{path:we(e,I),cid:I}});else{let P=be(e,a,k)?.toString("utf8")??"";x.push({source_id:g,cid:k,format:i.format,text:P})}}x.sort((g,k)=>g.source_id<k.source_id?-1:1);let y=[];for(let g of a.byLabel(de.STYLENOTE).sort((k,i)=>k.cid<i.cid?-1:1))a.superseded.has(g.cid)||y.push(`\u2022 ${String(g.content.statement)} [${String(g.content.learned_from_kind)}]`);let v="";for(let g of y){if(Buffer.byteLength(v+g+`
3
- `,"utf8")>m)break;v+=g+`
4
- `}return{read_basis:_,sources:x,styleNoteDigest:v}}function lr(r,e){let a=ur({contextDir:r,graph:e}).styleNoteDigest;return a.length>0?a:void 0}function mt(r,e,a,m,_){let x=null,y=()=>x??=_&&Object.keys(_).length>0?Promise.resolve(_):Ut().catch(()=>({}));return{contextDir:r,rootSid:e,locks:at(r,e),probe:m??Bt(r,{resolveAlias:async v=>qt(v,{env:process.env,auth:await y()}),embed:async(v,g)=>Gt(v,g,{env:process.env,auth:await y()}),readVector:(v,g)=>Lt(r,v,g),writeVector:(v,g,k)=>Vt(r,v,g,k)}),...a?.length?{reservedEventIds:a}:{}}}function gt(r,e){let a=[],m=[];for(let _ of r.use_cases){let x=_.matches_existing;x?.cid&&e.hasNode(x.cid)?a.push({ref:x.cid,expectedTip:e.tipOf(x.cid)}):m.push({tempRef:_.temp_ref,title:String(_.title??""),probeText:String(_.title??"")})}return{verb:"extract",ucTargets:a,newBuCandidates:m,sourcePins:[{source_id:r.source.source_id,source_cid:r.source.source_cid}],readBasis:r.read_basis??null}}function kr(r,e){let a=(r.images??[]).filter(m=>m.delivery==="selected");if(a.length!==0)return a.map(m=>({ref:m.ref,...m.page!==void 0?{page:m.page}:{},...m.loc!==void 0?{loc:m.loc}:{},media_type:m.media_type,blob_ref:{path:we(e,m.blob),cid:m.blob}}))}function $r(r){return r.length>8&&r[0]===137&&r[1]===80&&r[2]===78&&r[3]===71?"image/png":r.length>3&&r[0]===255&&r[1]===216&&r[2]===255?"image/jpeg":r.length>12&&r.toString("ascii",0,4)==="RIFF"&&r.toString("ascii",8,12)==="WEBP"?"image/webp":null}function Ge(r){return r.toISOString().replace(/[-:]/g,"").slice(0,15)}function gr(r){return r.startsWith("su-conv-")?`conv-${Ot(Buffer.from(r,"utf8")).slice(0,8)}`:r}function pr(r){return r.source_id.startsWith("su-conv-")?"the conversation":r.source_id}function Rr(r,e,a){return`reading ${pr(r)}${a>1?` (source ${e} of ${a})`:""}`}function $e(r){return r.toLowerCase().trim().replace(/\s+/g," ")}function hr(r,e){let a=new Map,m=new Map,_=new Map;for(let{cid:y,content:v}of e.byLabel(de.USECASE)){if(e.superseded.has(y))continue;(e.trust.get(y)==="archived"?_:m).set($e(String(v.title??"")),y)}let x=y=>e.trust.get(y)==="archived"?{cid:y,archived:!0,reason:e.archivedReason.get(y)}:{cid:y};for(let y of r.use_cases){if(y.matches_existing){let k=y.matches_existing.cid;if(e.superseded.has(k)){let i=e.tipOf(k);k=e.superseded.has(i)?null:i}if(k!==null){a.set(y.temp_ref,x(k));continue}}let v=m.get($e(y.title));if(v){a.set(y.temp_ref,{cid:v});continue}let g=_.get($e(y.title));g&&a.set(y.temp_ref,x(g))}return a}var fr=/^(\S+)\.criteria\[(\d+)\]/;function Cr(r,e,a){if(e.length===0||!e.every(_=>fr.test(_.detail)))return!1;let m=new Map;for(let _ of e){let x=fr.exec(_.detail),y=m.get(x[1])??new Set;y.add(Number(x[2])),m.set(x[1],y)}for(let _ of r.use_cases){let x=m.get(_.temp_ref);x?.size&&(_.criteria=(_.criteria??[]).filter((y,v)=>!x.has(v)),a(`${_.temp_ref}: dropped ${x.size} criteria with unverifiable cites \u2014 committed without them (criteria are hints, not oracles)`))}return!0}async function ht(r,e,a,m,_=()=>{},x,y){let v=(g,k)=>_(g,k,r.session_id);return Zt(r,e,a,m,_,{async onProposalEvent(g){let k=g,i=null,I=null;if(cr(k))try{i=dr(k,r.read_basis,{templateVersion:y?.()??null,warn:P=>{e.out(`warning: ${P}`),v("adapter",{warn:P})}}),v("adapter",{ok:!0,use_cases:i.use_cases.length})}catch(P){I=P instanceof J?P.message:String(P),v("adapter",{ok:!1,error:I})}else i=k;return i&&i.use_cases.length===0&&(e.out("warning: the agent proposed ZERO use-cases for this source"),e.emit?.({type:"warning",code:"ZERO_USE_CASES",message:"the agent proposed ZERO use-cases for this source"})),i&&x&&await x(i),{proposal:i,error:I}}})}var Dr=new Set(["agent","ci","override"]);async function Ss(r,e){let a=`ext-${Ge(e.now?.()??new Date)}-lk${Math.random().toString(36).slice(2,8)}`,_=at(e.contextDir,a,e.now?{now:e.now}:void 0).tryAcquire([{kind:"extract"}],{hold:"session",verb:"extract"});if("contended"in _){let x=_.contended.holder,y=`another extraction is running on this context${x?` (pid ${x.pid})`:""} \u2014 retry when it finishes`;return e.out(y),e.emit?.({type:"error",message:y,code:"EXTRACT_LOCKED"}),2}try{return await Er(r,e)}finally{_.release()}}async function Er(r,e){let a=r.mode??"interactive";if(r.posture==="reconcile"){if(r.trust==="hold"){let n="error: --trust hold has no meaning here \u2014 a reconcile IS the review; drop the flag";return e.out(`${n} [TRUST_USAGE]`),e.emit?.({type:"error",message:n,code:"TRUST_USAGE"}),2}if(!r.source||!r.changeContext){let n="reconcile posture needs a pinned source and its change context \u2014 internal wiring fault";return e.out(`error: ${n}`),e.emit?.({type:"error",message:n,code:"POSTURE_USAGE"}),2}if(a==="ci"){let n="reconcile posture is not available under --mode ci \u2014 a held changeset needs a durable session; use --mode agent";return e.out(`error: ${n}`),e.emit?.({type:"error",message:n,code:"POSTURE_USAGE"}),2}}if(r.trust==="hold"&&a==="interactive")return e.out("error: --trust hold only applies to headless runs \u2014 in interactive chat you review items in-session anyway; use --mode agent to hold everything for review"),e.emit?.({type:"error",message:"error: --trust hold only applies to headless runs \u2014 use --mode agent",code:"TRUST_USAGE"}),2;if(a==="interactive"){if(!e.isTTY)return e.out("extract: --mode interactive needs a TTY (use --mode agent|ci|override headless)"),2}else if(!Dr.has(a))return e.out(`extract: unknown mode "${a}" \u2014 interactive | agent | ci | override`),2;if(r.trust!==void 0){if(a==="ci")return e.out("error: --trust is not available under --mode ci (ci is fail-closed \u2014 no trust dials)"),e.emit?.({type:"error",message:"error: --trust is not available under --mode ci",code:"TRUST_UNDER_CI"}),2;if(r.trust!=="auto"&&r.trust!=="hold")return e.out(`error: --trust must be auto | hold, got '${r.trust}'`),e.emit?.({type:"error",message:`error: --trust must be auto | hold, got '${r.trust}'`,code:"TRUST_USAGE"}),2}let m=e.telemetry?.enabled?e.telemetry:void 0,_=Ge(e.now?.()??new Date),x=m?At(m.ids.context_instance_id??null,"extract",m.ids.session_id):oe(e.contextDir,"logs",`extract-${_}.log`);ut(mr(x),{recursive:!0});let y=`run-${_}-${Math.random().toString(36).slice(2,8)}`,v=n=>n==="error"||n==="failed_proposal"?"error":n==="repair_respawn"?"warn":"info",g=(n,d,s)=>{try{wr(x,JSON.stringify({ts:new Date().toISOString(),level:v(n),run_id:y,...m?{user_session_id:m.ids.session_id}:{},...s?{session_id:s}:{},kind:n,data:d})+`
5
- `)}catch{}m?.wireTrace(n,d,s)};{let n=e.out;e.out=d=>{g("transcript",{line:d}),n(d)}}e.out(`trace: ${ke(x)}`),e.emit?.({type:"run_start",mode:a,trace:x,...m?{session:m.ids.session_id}:{}});let k=Ft();if(k&&e.out(k),e.preflightTurn){let n=await e.preflightTurn();if(g("preflight",n),!n.ok)return e.out(n.message??"error: turn-endpoint preflight failed"),e.emit?.({type:"error",message:n.message??"error: turn-endpoint preflight failed",code:"PREFLIGHT"}),2}let i=Z(e.contextDir),I=lr(e.contextDir,i),P=r.sources?.length?r.sources:r.source?[r.source]:[];if(P.length>0){if(r.resume){let n="error: --source cannot be combined with --resume (the resumed session already has its scope)";return e.out(n),e.emit?.({type:"error",message:n,code:"SOURCE_WITH_RESUME"}),2}for(let n of P){let d=i.heads.get(n);if(typeof d!="string"){let s=d===null?`error: --source ${n} was ingested but is retired \u2014 re-ingest it to extract again`:`error: --source ${n} is not an ingested source (kane-cli context list shows them)`;return e.out(s),e.emit?.({type:"error",message:s,code:"SOURCE_UNKNOWN"}),2}}}let u=null,h=null;if(r.resume){try{{let c=await nr(e.contextDir,r.resume,i,{verb:"extract",deps:{onWarn:C=>e.out(`note: ${C}`)}});{let C=Object.keys(c.handle.state.read_basis??{});if(C.length>1){let j=`error: session ${r.resume} spans ${C.length} sources \u2014 multi-source resume isn't supported yet; committed work is preserved (re-run kane-cli context extract for anything remaining)`;return e.out(j),e.emit?.({type:"error",message:j,code:"MULTI_SOURCE_RESUME"}),c.handle.release(),2}h=c,g("resume_kind",{kind:c.view.pointer===null?"bare-base":c.view.pointer.at==="final"?"pause":"crash"}),u={handle:c.handle,represent:c.represent,questions:c.questions,staleBasis:c.drift.map(j=>j.subject)}}}}catch(c){let C=c instanceof Error?c.message:String(c);return e.out(`error: ${C}`),e.emit?.({type:"error",message:`error: ${C}`,...c instanceof dt?{code:c.code}:{}}),c instanceof dt?2:1}let n=h?null:Xt(u.handle.state.verb,"extract",r.resume);if(n)return e.out(n.message),e.emit?.({type:"error",message:n.message,code:n.code}),u.handle.release(),2;let d=u.handle.state.change_basis;if(d&&(i.heads.get(d.source_id)??null)!==d.new_head){let c=`error: ${d.source_id} moved while this reconcile extraction was paused \u2014 its recorded change context no longer matches; re-run kane-cli maintain reconcile against the current file (session ${r.resume} is defunct and can be ignored)`;return e.out(c),e.emit?.({type:"error",message:c,code:"CHANGE_BASIS_MOVED"}),u.handle.release(),2}if(h&&h.view.pointer!==null&&h.drift.length>0){if(!await e.confirmStale(`changed since the pause: ${h.drift.map(C=>C.subject).join(", ")} \u2014 re-ground and continue against the current versions?`)){let C=`resume aborted: the context moved since the pause (${h.drift.map(j=>j.subject).join(", ")}) \u2014 session ${r.resume} is preserved`;return e.out(C),e.emit?.({type:"error",message:C,code:"RESUME_DRIFT"}),u.handle.release(),2}}else u.staleBasis.length>0&&e.out(`note: changed since the pause: ${u.staleBasis.join(", ")} \u2014 re-presented items may be stale`);let s=[...new Set([...u.handle.state.held_receipts??[],...h?.view.kane?.held_receipts??[]])];if(s.length>0)if(e.chat?.holdReceipt)for(let c of s)e.chat.holdReceipt(c);else e={...e,initialMessage:[s.join(`
6
-
7
- `),e.initialMessage].filter(Boolean).join(`
8
-
9
- `)};u.handle.state.assumed.length>0&&e.out(`note: ${u.handle.state.assumed.length} default(s) were assumed while you were away \u2014 kane-cli context sessions show ${r.resume} lists them`)}let Q=i.extractedSourceCids,ue=!!(r.force||u?.handle.state.force),ee=[],se=[],Re=P.length>0?new Set(P):null;for(let[n,d]of i.heads.entries())if(d!=null&&!(Re&&!Re.has(n))){if(!Re&&!u&&n.startsWith("su-conv-")){e.out(`skipped ${n} \u2014 conversation source; extract it explicitly with --source ${n}`),se.push({source_id:n,reason:"conversation"});continue}if(u){let s=n in u.handle.state.read_basis,c=u.handle.state.corpus_cursor.remaining.includes(n);if(!s&&!c)continue;if(c&&!ue&&Q.has(d)){e.out(`${n} already extracted \u2014 skipped (--force re-runs it)`),se.push({source_id:n,reason:"cached"});continue}}else if(!ue&&Q.has(d)){e.out(`${n} already extracted \u2014 skipped (--force re-runs it)`),se.push({source_id:n,reason:"cached"});continue}ee.push({source_id:n,cid:d})}let _r=n=>{let d=tr(e.contextDir,n);d&&e.out(`note: a reconcile plan for ${n} is pending (${d.pending} item(s)) \u2014 resume with \`kane-cli maintain reconcile --apply ${d.path}\``)};for(let n of se)n.reason==="cached"&&_r(n.source_id);if(e.emit?.({type:"corpus",sources:ee,skipped:se}),ee.length===0){if(u){let s=`error: resumed session's paused source (${Object.keys(u.handle.state.read_basis).join(", ")||"unknown"}) is no longer in the corpus \u2014 restore/re-ingest it and re-run --resume ${r.resume}, or discard with: kane-cli context sessions clean ${r.resume}`;return e.out(s),e.emit?.({type:"error",message:s,code:"SOURCE_MISSING"}),u.handle.release(),2}let n=se.length>0&&se.every(d=>d.reason==="conversation");return e.out(Re?`extract: nothing to do \u2014 ${P.join(", ")} ${P.length===1?"is":"are all"} already extracted at the current snapshot (--force to re-run)`:n?"extract: nothing to do \u2014 only conversation sources here (extract one explicitly with --source <id>)":"extract: nothing to do \u2014 every ingested source is already extracted"),0}let te=!r.plan&&a!=="ci",Ce=e.now?.()??new Date,De=r.resume??`ext-${Ge(Ce)}-${gr(ee[0].source_id)}`,T=null,Ee=!1;te&&!u&&(T=ot(e.contextDir,{sid:De,mode:"agent",created_at:Ce.toISOString(),expires_at:new Date(Ce.getTime()+1440*60*1e3).toISOString(),agent_state:{schema:2,items:[],provider_state:""},pending:{questions:[],proposals:[]},assumed:[],read_basis:{[ee[0].source_id]:ee[0].cid},corpus_cursor:{remaining:ee.slice(1).map(n=>n.source_id)},conv_source:"",verb:"extract",...ue?{force:!0}:{},...r.changeContext?{change_basis:{source_id:r.changeContext.source_id,new_head:r.changeContext.new_head}}:{},...m?{user_session_id:m.ids.session_id}:{}}));let Le=h?h.represent.map(n=>n.event_id).filter(n=>typeof n=="string"):[],w=u?.handle??T,ft=!1,pt=()=>{try{br(oe(e.contextDir,"sessions"))}catch{}},_t=()=>{if(T){try{T.complete()}catch{T.release()}T=null,w=null,pt()}},Pe=new Map;if(u&&u.questions.length>0&&!r.message&&!r.withSource){e.out(`re-presenting ${u.questions.length} unanswered question(s) from the paused session`);let n=await e.ask(u.questions.map(rr));if(Array.isArray(n))for(let d of n)Pe.set(d.id,d)}let le=e.by??{kind:"human",id:"owner"},re=a==="interactive"&&!r.plan&&!!e.chat,Ve=0,xt=0,Te=!1,me=0,We=()=>{Te||(Te=!0,e.out("note: duplicate detection is running in a reduced mode this run \u2014 new items will be held for your review instead of committed"),m?.event("ASR_EMBED_DEGRADED",{}),e.emit?.({type:"degraded",reason:"embed_fallback"}))},Ae=null,ge=()=>w??T,ze=(n,d,s)=>{let c=ge();if(!c)return;let C=d.map(b=>({label:"usecase",content:{title:b.title,...b.summary!==void 0?{summary:b.summary}:{},...b.risk!==void 0?{risk:b.risk}:{},derived:!0,_held:{source_id:n.source_id,source_cid:n.cid,anchor:b.cite?.anchor??"L1-L1",quote:b.cite?.quote??""}},rationale:`held (${s==="degraded"?"embed degraded \u2014 lexical dedup only":"--trust hold"}): ${n.source_id} @ ${n.cid.slice(0,19)} ${b.cite?.anchor??""}`,edges:[],tempRef:b.temp_ref})),j=c.state.pending;c.save({pending:{questions:j.questions,proposals:[...j.proposals,...C]}}),me+=C.length,Ae=c.state.sid,e.emit?.({type:"held",source_id:n.source_id,count:C.length,reason:s==="degraded"?"embed_degraded":"trust_hold"})},F=[],vt=!1,M=[...ee];try{let n=d=>{let s=w;if(!s)return;let c=s.state.ingest_schedule??[];if(!c.some(b=>b.status==="pending"))return;let C=Z(e.contextDir),j=c.map(b=>b.status!=="pending"?b:(C.heads.get(b.source_id)??null)!==b.cid?(e.out(`note: ${b.source_id} changed after it was added \u2014 skipping its extraction this run; re-run kane-cli context extract to pick up the newer version`),{...b,status:"skipped",note:"head moved since landing"}):C.extractedSourceCids.has(b.cid)||M.some(V=>V.source_id===b.source_id&&V.cid===b.cid)?{...b,status:"done"}:M.some(V=>V.source_id===b.source_id)?(e.out(`note: an older version of ${b.source_id} is already queued this run \u2014 the newly landed version is not extracted; re-run kane-cli context extract to pick it up`),{...b,status:"skipped",note:"an older version of the source was already queued this run"}):(M.push({source_id:b.source_id,cid:b.cid}),e.out(`queued ${b.source_id} for extraction in this run (landed mid-run)`),{...b,status:"done"}));s.save({ingest_schedule:j,corpus_cursor:{remaining:M.slice(d+1).map(b=>b.source_id)}})};for(let d=0;d<M.length;n(d),d++){let s=M[d],c=Z(e.contextDir),C={current:c};e.chat?.attachOnCommitted?.(t=>{C.current=t});let j=c.getNode(s.cid),b=String(j?.content.blob??""),Oe=be(e.contextDir,c,s.cid);if(!Oe){e.out(`error: ${s.source_id}: its stored content is missing \u2014 re-ingest the file (kane-cli context ingest <file>) [BLOB_MISSING]`),e.emit?.({type:"error",source_id:s.source_id,message:`error: ${s.source_id}: blob ${b} missing from .context/blobs`,code:"BLOB_MISSING"}),F.push(s.source_id);continue}let V=c.mediaOf(s.cid),Ke=V.media_type.startsWith("image/");if(!Ke){let t=$r(Oe);if(t){e.out(`skipping ${s.source_id}: binary ${t} ingested before image support \u2014 re-ingest it (kane-cli context ingest) to extract from it`),e.emit?.({type:"source_skipped",source_id:s.source_id,reason:"binary_pre_media"});continue}}let yt=Ke?`0001| (image source ${s.source_id} \u2014 the content is attached as an image; cite it with anchor img#whole)`:ct(Oe),Ie=(t,o)=>{let l=new Map;l.set(s.source_id,{media:V,numberedText:yt});for(let f of o.sources??[]){if(l.has(f.source_id))continue;let D=be(e.contextDir,t,f.source_cid);if(!D)continue;let $=t.mediaOf(f.source_cid),E=$.media_type.startsWith("image/")?`0001| (image source ${f.source_id} \u2014 the content is attached as an image; cite it with anchor img#whole)`:ct(D);l.set(f.source_id,{media:$,numberedText:E})}return l},wt=Ge(e.now?.()??new Date),ie=`${wt}-${s.source_id}`,he=!!(u&&s.source_id in u.handle.state.read_basis),Me=w?De:`ext-${wt}-${gr(s.source_id)}`,Je=M.slice(d+1).map(t=>t.source_id);w&&te&&!he&&w.save({read_basis:{[s.source_id]:s.cid},corpus_cursor:{remaining:Je}});let ne="";if(re){let t=Wt({contextDir:e.contextDir,graph:Z(e.contextDir),sessionStamp:Me,by:le});t.errors===null||t.errors[0]?.code==="CONV_SOURCE_EXISTS"?(ne=t.sourceId,e.chat.attachConversationSource?.(ne),C.current=Z(e.contextDir)):e.out(`warning: notes you add in chat can't be saved to the context this session (${t.errors[0]?.detail})`)}let bt={type:"run_config",version:1,session_id:Me,mode:a,source:{source_id:s.source_id,source_cid:s.cid,kind:Mt.has(V.format)?V.format:Sr(s.source_id)||"md",numbered_text:yt,...(()=>{let t=kr(V,e.contextDir);return t?{images:t}:{}})()},existing_use_cases:c.byLabel(de.USECASE).filter(({cid:t})=>c.trust.get(t)!=="archived"&&!c.superseded.has(t)).map(({cid:t,content:o})=>({id:t,title:String(o.title??""),summary:String(o.summary??"")})),read_basis:C.current.latestHash,max_free_text_rounds:Yt,graph_reads:!0,verb:"extract",...I!==void 0?{style_note_digest:I}:{},...r.changeContext&&r.changeContext.source_id===s.source_id?{change_context:r.changeContext}:{},topology:er(),...re?{chat:!0}:{},...Ke?{image_sources:[{source_id:s.source_id,source_cid:s.cid,media_type:V.media_type,blob_ref:{path:we(e.contextDir,b),cid:b}}]}:{},...u&&!h&&s.source_id in u.handle.state.read_basis?{resume:{agent_state:u.handle.state.agent_state}}:{},...te&&w?{checkpoints:!0}:{}},R=h&&he?{...h.spawnConfig,mode:a}:bt;if(te&&w&&!ft){ft=!0;let{resume:t,...o}=bt;Ht(e.contextDir,De,{schema:Nt,kind:"base",sid:De,verb:"extract",mode:a,created_at:Ce.toISOString(),run_config:o,conv_source:ne||w.state.conv_source||"",store_watermark:It(e.contextDir)})}let St=h&&he?0:w?.state.checkpoint?.seq??0,fe={current:null};if(R.resume&&"schema"in R.resume){let t=R.resume.binding?.template_version;typeof t=="string"&&(fe.current=t)}let Xe=te&&w?ir({contextDir:e.contextDir,handle:w,seqBase:()=>St,peekHeldReceipts:()=>e.chat?.peekHeldReceipts?.()??[],readBasis:()=>({[s.source_id]:s.cid}),corpusCursor:()=>({remaining:Je}),onSoftCap:t=>e.out(t),onStat:t=>g("ckpt_stat",t,R.session_id),...e.now?{now:e.now}:{}}):void 0,ae=Xe?{...Xe,persist:t=>{let o=t.binding?.template_version;return typeof o=="string"&&o&&(fe.current=o),Xe.persist(t)}}:void 0;re||e.out(u&&s.source_id in u.handle.state.read_basis?`resuming: ${s.source_id} (session ${r.resume})`:`reading ${s.source_id} (source ${d+1} of ${M.length})`),e.emit?.({type:"source_start",source_id:s.source_id,cid:s.cid,index:d+1,total:M.length,resumed:!!(u&&s.source_id in u.handle.state.read_basis)}),e.chat?.ledger?.({kind:"banner",text:Rr(s,d+1,M.length)}),e.chat?.setWorking?.(`Reading ${pr(s)}\u2026`);let Ye=new Map;g("spawn",{source_id:s.source_id,source_cid:s.cid,resume:!!u,chat:re},R.session_id);let kt=!1,$t=!1,Ze=!1,Rt=async t=>{let o=Z(e.contextDir),l=ye(t,Ie(o,t),o);if(g("kane_validate",{errors:l.map(p=>p.code)},R.session_id),l.length>0){if(e.nested){e.chat?.ledger?.({kind:"commit",ok:!1,line:"proposal failed validation \u2014 nothing landed",warnings:l.map(p=>`${p.code}: ${p.detail}`)}),$t=!0;return}e.chat.submit("[auto-repair] the proposal failed validation: "+l.map(p=>`${p.code}: ${p.detail}`).join("; ")+" \u2014 please re-finalize with these fixed.");return}let f=Z(e.contextDir),D=hr(t,f),$=oe(e.contextDir,"proposals",ie);ut($,{recursive:!0}),lt(oe($,"proposal.json"),JSON.stringify(t,null,2)+`
10
- `);let E=new Map(t.use_cases.map(p=>[p.temp_ref,{resolution:"skipped"}])),Y=mt(e.contextDir,R.session_id,Le,e.probe,e.auth),O=await Se(Y,gt(t,f),p=>{if(p.degradedProbe&&ge()!==null&&t.use_cases.some(xe=>xe.matches_existing==null))return{result:{degradedHold:!0},record:null};let z=je({contextDir:e.contextDir,graph:p.graph,proposal:t,proposalId:ie,verdicts:E,by:{kind:"ai",id:"extract-agent"},autoName:!0,allowStaleBasis:!0,eventIds:p.eventIds("extract",1),...te?{sid:p.sid}:{},probeHits:p.probeHits});return z.errors!==null?{errors:z.errors}:{result:z,record:z.record}}),U=O.ok&&"result"in O?O.result:null;if(U!==null&&"degradedHold"in U){We(),ze(s,t.use_cases,"degraded"),Ze=!0,e.chat.ledger?.({kind:"commit",ok:!1,line:`held ${t.use_cases.length} item(s) for review \u2014 semantic dedup ran degraded (embeddings unavailable); nothing saved this turn`});return}let L=U??{record:null,errors:O.ok?null:O.kind==="validation"?O.errors:[{code:O.kind==="contended"?O.err.code:"UNSETTLED",detail:O.kind==="contended"?`held by ${O.err.holder?.owner_sid??"another session"}`:"concurrent activity kept moving the store"}]};if(L.errors){e.chat.ledger?.({kind:"commit",ok:!1,line:"commit failed \u2014 nothing landed",warnings:L.errors.map(p=>`${p.code}: ${p.detail}`)});return}kt=!0,L.record?.event_ids?.length&&w?.markApplied(L.record.event_ids);{let p=L.record.review.filter(z=>z.kind==="pending_update");p.length>0&&(e.out(`${p.length} update(s) held for review`),e.emit?.({type:"update_held",count:p.length,targets:p.map(z=>z.id)}),e.chat?.ledger?.({kind:"commit",ok:!0,line:`${p.length} update(s) held for review`}))}let W=L.record.nodes.length;Ve+=W;let N=t.use_cases.length-W;{let p=Z(e.contextDir),z=new Map;for(let{cid:H,content:K}of p.byLabel(de.USECASE))p.superseded.has(H)||z.set($e(String(K.title??"")),H);let xe=[];for(let H of t.use_cases){let K=null;if(H.matches_existing?.cid&&p.hasNode(H.matches_existing.cid)){let ve=p.tipOf(H.matches_existing.cid);K=p.superseded.has(ve)?null:ve}K=K??z.get($e(H.title))??null,K&&xe.push({ref:H.temp_ref,cid:K,...p.displayNameOf(K)?{id:p.displayNameOf(K)}:{}})}xe.length>0&&e.chat.registerAliases?.(xe),C.current=p;let Pt=H=>{for(let[K,ve]of p.names)if(ve===H&&!p.superseded.has(ve))return K},Tt=zt({verb:"extract",commitN:1,phase:"proposal",committed:L.record.nodes.map(H=>({cid:H.cid,...Pt(H.cid)?{logical_id:Pt(H.cid)}:{}})),reused:N},p);e.emit?.(Tt.event),e.chat.holdReceipt?.(Tt.text)}g("commit",{derived:W,evidence_matched:N,chat:!0},R.session_id),e.chat.ledger?.({kind:"commit",ok:!0,line:W===0&&N>0?`all ${N} matched existing \u2014 nothing new to save`:`saved ${W} use-case${W===1?"":"s"} as drafts`+(N>0?` \xB7 ${N} matched existing`:"")})},Qe=!!(u&&s.source_id in u.handle.state.read_basis),q=Qe&&Pe.size>0?{...e,ask:async t=>t.every(o=>Pe.has(o.id))?(u.handle.markApplied(t.map(o=>`resolveq:${r.resume}:${o.id}`)),e.out(`answered ${t.length} re-asked question(s) from the held resume answers`),t.map(o=>Pe.get(o.id))):e.ask(t)}:e;Qe&&r.message&&(q={...q,initialMessage:r.message}),q={...q,onEmbedDegraded:We};let ce,et;if(w){let t=w,o=q.ask,l=Qt({contextDir:e.contextDir,cwd:mr(e.contextDir),handle:t,note:f=>e.chat?e.chat.note(f):e.out(f),schedule:r.trust!=="hold",...r.trust==="hold"?{scheduleRefused:"this run holds items for review, so its extraction is not scheduled \u2014 kane-cli context extract runs it after the review"}:{},graphSlot:C,...e.now?{now:e.now}:{}});if(q={...q,ask:async f=>{let D=await o(f);if(Array.isArray(D)){let $=D.filter(E=>{if(E.free_text==null||E.free_text.trim()==="")return!1;let Y=f.find(O=>O.id===E.id);return E.selected_index!=null&&Y?.options[E.selected_index]?.input===!0}).map(E=>E.free_text.trim());if($.length>0){let E=t.state.ingest_registry;for(let Y of $)E=Fe(E,Y,e.now?.()??new Date);t.save({ingest_registry:E})}}return D},ingest:l},Qe&&r.withSource){let f=(t.state.pending?.proposals??[]).filter(E=>E.content?._held!=null).length;if(r.trust==="hold"||f>0){let E=f>0?`error: --with-source can't add a source to a session holding ${f} item(s) for review \u2014 resume without --with-source to finish the review first, then land it with kane-cli context ingest [HOLD_MULTI_SOURCE]`:"error: --with-source is not available with --trust hold \u2014 held work from a multi-source run can't be resumed yet; drop --trust hold, or land the source separately with kane-cli context ingest [HOLD_MULTI_SOURCE]";return e.out(E),e.emit?.({type:"error",code:"HOLD_MULTI_SOURCE",message:E}),2}let D=r.withSource;t.save({ingest_registry:Fe(t.state.ingest_registry,D,e.now?.()??new Date)});let $=await l({id:`withsource-${t.state.sid}`,ref:D,purpose:null});if(!$.ok)return e.out(`error: --with-source: ${$.error.message}`),e.emit?.({type:"error",code:$.error.code,message:`--with-source: ${$.error.message}`}),2;q={...q,pendingDeferral:{ingested:{source_id:$.result.source_id,cid:$.result.cid}}}}et=()=>{if(!e.chat?.attachIngest)return;let f=e.chat;ce=f.attachIngest(async D=>{try{t.save({ingest_registry:Fe(t.state.ingest_registry,D,e.now?.()??new Date)});let $=await l({id:`attach-${t.state.sid}-${(t.state.ingest_registry??[]).length}`,ref:D,purpose:null});return $.ok?(f.deferBatch({source_id:$.result.source_id,cid:$.result.cid}),{ok:!0}):{ok:!1,error:$.error.message}}catch($){return{ok:!1,error:$ instanceof Error?$.message:String($)}}})},et()}let S;try{S=await ht(R,{...q,graphSlot:C,...ae?{checkpoint:ae}:{}},Ye,c,g,re?Rt:void 0,()=>fe.current)}catch(t){if(t instanceof Be)return ce?.(),e.chat?.setWorking?.(null),e.out(`error: ${t.message}`),e.emit?.({type:"error",code:"PAIR_MISMATCH",message:t.message}),2;throw t}if(ce?.(),e.chat?.setWorking?.(null),S.errorCode==="binding_mismatch"&&h&&he){let t=await e.ask([{id:"binding-mismatch",text:"this session's saved conversation is no longer accepted by the service \u2014 start the conversation fresh (committed work is kept), or stop and keep the session?",risk:"high",rationale:"the service refused the saved conversation on the first turn after resume",options:[{label:"start fresh",detail:"continue with a fresh conversation \u2014 earlier answers may be re-asked"},{label:"stop",detail:"stop here; the session stays resumable"}],recommended_index:1,allow_free_text:!1}]);if((Array.isArray(t)?t.find(f=>f.id==="binding-mismatch"):void 0)?.selected_index!==0){let f=`resume abandoned: binding mismatch on session ${Me} \u2014 the session is preserved`;return e.out(f),e.emit?.({type:"error",message:f,code:"BINDING_MISMATCH"}),2}g("binding_migrate",{sid:Me},R.session_id),et?.();let l=R.resume&&"schema"in R.resume?{...R.resume,binding:{}}:void 0;try{S=await ht({...R,...l?{resume:l}:{}},{...q,graphSlot:C,...ae?{checkpoint:ae}:{}},Ye,c,g,re?Rt:void 0,()=>fe.current)}catch(f){if(f instanceof Be)return ce?.(),e.chat?.setWorking?.(null),e.out(`error: ${f.message}`),e.emit?.({type:"error",code:"PAIR_MISMATCH",message:f.message}),2;throw ce?.(),f}ce?.(),e.chat?.setWorking?.(null)}if(S.error){let t=S.error.startsWith("proposal failed validation after repair:");t&&g("agent_error_detail",{error:S.error},R.session_id);let o=t?`error: the agent could not produce a valid proposal for ${s.source_id} \u2014 re-run kane-cli context extract to retry`:`error: agent failed for ${s.source_id}: ${S.error}`;e.out(o),e.emit?.({type:"error",source_id:s.source_id,message:o}),F.push(s.source_id);continue}if(S.highRisk)return e.out(`error: ${S.highRisk.length} high-risk decision${S.highRisk.length===1?"":"s"} need a human \u2014 ci mode won't guess. Re-run with --mode agent to pause for review.`),e.emit?.({type:"error",source_id:s.source_id,message:`error: high-risk question(s) in ci mode (fail-closed): ${S.highRisk.map(t=>t.id).join(", ")}`,code:"HIGH_RISK_CI"}),1;if(S.paused){let t=M.slice(d+1).map(D=>D.source_id),o=u?.handle??T,l=o??ot(e.contextDir,{sid:R.session_id,mode:"agent",created_at:(e.now?.()??new Date).toISOString(),expires_at:new Date((e.now?.()??new Date).getTime()+1440*60*1e3).toISOString(),agent_state:S.paused.agent_state,pending:{questions:[],proposals:[]},assumed:[],read_basis:{[s.source_id]:s.cid},corpus_cursor:{remaining:t},conv_source:ne,verb:"extract",...ue?{force:!0}:{},...r.changeContext?{change_basis:{source_id:r.changeContext.source_id,new_head:r.changeContext.new_head}}:{},...m?{user_session_id:m.ids.session_id}:{}});Ee=!0;try{ne&&l.state.conv_source!==ne&&l.save({conv_source:ne});let D=e.chat?.drainHeldReceipts?.()??[];(D.length>0||(l.state.held_receipts?.length??0)>0)&&l.save({held_receipts:D}),o&&l.save({read_basis:{[s.source_id]:s.cid},corpus_cursor:{remaining:t},...ue&&!l.state.force?{force:!0}:{},...m&&l.state.user_session_id!==m.ids.session_id?{user_session_id:m.ids.session_id}:{}}),sr(l,S.paused)}catch(D){let $=l.state.checkpoint,E=`error: couldn't persist the pause for session ${l.state.sid}`+($?` \u2014 last durable checkpoint: seq ${$.seq} @ ${$.ts}`:" \u2014 no durable checkpoint exists")+` (${D instanceof Error?D.message:String(D)})`;return e.out(E),e.emit?.({type:"error",message:E,code:"PAUSE_PERSIST_FAILED",sid:l.state.sid}),1}g("session_paused",{sid:l.state.sid},R.session_id);let f=`kane-cli context extract --resume ${l.state.sid} --mode ${a}`;return e.out(`paused: session ${l.state.sid} saved \u2014 resume with: ${f}`),e.emit?.({type:"session_paused",sid:l.state.sid,source_id:s.source_id,mode:a,resume:f,expires_at:l.state.expires_at,pending_questions:S.paused.pending.questions}),e.chat?.ledger?.({kind:"pause",sid:l.state.sid,expires_at:l.state.expires_at,resume:f,messageForm:`${f} --message "<your words>"`}),3}if(S.crashed){let t=w?.state.checkpoint;if(w&&t){let o=`kane-cli context extract --resume ${w.state.sid} --mode ${a}`;try{w.save({read_basis:{[s.source_id]:s.cid},corpus_cursor:{remaining:Je}})}catch{}return g("agent_crashed_resumable",{sid:w.state.sid,seq:t.seq},R.session_id),e.out(`agent crashed \u2014 session ${w.state.sid} is resumable at checkpoint seq ${t.seq} (at most the in-flight turn lost); resume with: ${o}`),e.emit?.({type:"session_paused",sid:w.state.sid,source_id:s.source_id,mode:a,resume:o,expires_at:w.state.expires_at,crashed:!0}),e.chat?.ledger?.({kind:"pause",sid:w.state.sid,expires_at:w.state.expires_at,resume:o,messageForm:`${o} --message "<your words>"`}),Ee=!0,w.release(),3}e.out(`error: agent crashed for ${s.source_id} with no durable checkpoint`),e.emit?.({type:"error",source_id:s.source_id,message:`error: agent crashed for ${s.source_id} with no durable checkpoint`,code:"AGENT_CRASHED"}),F.push(s.source_id);continue}if(re){if(xt+=S.assumedDefaults??0,S.error||$t)return 1;if(!kt&&!Ze){let t=M.length-d-1;e.out(`done \u2014 nothing committed for ${s.source_id} (no finalize before the session ended)`+(t>0?`; stopping here \u2014 ${t} remaining source(s) not extracted (re-run kane-cli context extract to continue)`:""));{let o=(w?.state.ingest_schedule??[]).filter(l=>l.status==="pending");o.length>0&&e.out(`note: ${o.length} source(s) landed this session (${o.map(l=>l.source_id).join(", ")}) were not extracted \u2014 the session ended first; kane-cli context extract runs them`)}return u&&s.source_id in u.handle.state.read_basis&&(u.handle.complete(),u=null,w=null),_t(),0}u&&s.source_id in u.handle.state.read_basis&&!Ze&&(n(d),u.handle.complete(),u=null,w=null);continue}if(!S.proposal){e.out(`error: agent ended without a proposal for ${s.source_id}`),e.emit?.({type:"error",source_id:s.source_id,message:`error: agent ended without a proposal for ${s.source_id}`}),F.push(s.source_id);continue}let G=ye(S.proposal,Ie(c,S.proposal),c);if(g("kane_validate",{errors:G.map(t=>t.code)},R.session_id),G.length>0&&Cr(S.proposal,G,t=>e.out(t))&&(g("criteria_dropped",{source_id:s.source_id},R.session_id),G=ye(S.proposal,Ie(c,S.proposal),c)),G.length>0){e.out("the agent's proposal didn't validate \u2014 retrying once"),e.emit?.({type:"validate_failed",source_id:s.source_id,codes:G.map(t=>t.code),repairing:!0}),g("repair_respawn",{source_id:s.source_id},R.session_id),h&&he||(St=w?.state.checkpoint?.seq??0);try{S=await ht(R,{...q,graphSlot:C,...ae?{checkpoint:ae}:{}},Ye,c,g,void 0,()=>fe.current)}catch(t){if(t instanceof Be)return e.out(`error: ${t.message}`),e.emit?.({type:"error",code:"PAIR_MISMATCH",message:t.message}),2;throw t}if(S.error||!S.proposal){e.out(`error: repair run failed for ${s.source_id}`),e.emit?.({type:"error",source_id:s.source_id,message:`error: repair run failed for ${s.source_id}`}),F.push(s.source_id);continue}if(G=ye(S.proposal,Ie(c,S.proposal),c),G.length>0){g("validation_details",{errors:G.map(t=>({code:t.code,detail:t.detail}))},R.session_id),e.out(`\u2717 validation failed \u2014 ${G.map(t=>t.code).join(", ")} (details: ${ke(x)})`),e.emit?.({type:"validate_failed",source_id:s.source_id,codes:G.map(t=>t.code),repairing:!1}),e.emit?.({type:"error",source_id:s.source_id,message:`error: proposal failed validation after repair (${G.map(t=>t.code).join(", ")})`}),F.push(s.source_id);continue}}let A=S.proposal,Ue=hr(A,c),tt=oe(e.contextDir,"proposals",ie);if(ut(tt,{recursive:!0}),lt(oe(tt,"proposal.json"),JSON.stringify(A,null,2)+`
11
- `),r.plan){e.out(`plan: ${A.use_cases.length} use-case(s) proposed from ${s.source_id} (nothing committed)`);for(let t of A.use_cases){let o=Ue.get(t.temp_ref),l=o?o.archived?` \u2248 matches ARCHIVED ${o.cid.slice(0,19)}${o.reason?` \u2014 previously rejected: "${o.reason}"`:" \u2014 previously rejected"}`:` \u2248 matches ${o.cid.slice(0,19)}`:"";e.out(` [${t.risk}] ${t.title} \u2014 cite ${t.cite.anchor}${l}`)}e.emit?.({type:"plan",source_id:s.source_id,use_cases:A.use_cases.map(t=>{let o=Ue.get(t.temp_ref);return{risk:t.risk,title:t.title,anchor:t.cite.anchor,...o?{match:o.cid,match_archived:!!o.archived}:{}}})}),S.assumedDefaults&&e.out(`assumed: ${S.assumedDefaults} default(s) auto-taken (assumed)`);continue}for(let t of A.use_cases){if(!t.conflicts_with?.length)continue;let o=t.conflicts_with.filter(f=>c.resolve(f)!==null),l=t.conflicts_with.filter(f=>c.resolve(f)===null);l.length>0&&(e.out(`note: ${t.temp_ref}: dropped unresolvable conflict hint(s): ${l.join(", ")}`),t.conflicts_with=o.length>0?o:void 0)}g("review_start",{use_cases:A.use_cases.length,flags:Ue.size},R.session_id);let Ne=await e.review(A.use_cases,Ue);if(g("review_verdicts",[...Ne.entries()].map(([t,o])=>({ref:t,resolution:o.resolution})),R.session_id),lt(oe(tt,"review.json"),JSON.stringify(A.use_cases.map(t=>{let o=Ne.get(t.temp_ref)??{resolution:"skipped"};return{id:t.temp_ref,kind:"review-item",resolution:o.resolution,edit:o.edit??null,reason:o.reason??null,...o.supersedeTarget?{supersede_target:o.supersedeTarget}:{},by:le}}),null,2)+`
12
- `),r.posture==="reconcile"){let t=jt(A),o=U=>t.passthrough.use_cases.filter(L=>{let W=L.matches_existing?.cid,N=W?U.resolve(W):null,p=N?U.tipOf(N.cid):null;return p!=null&&(U.trust.get(p)??null)!=="derived"}),l=o(c),f=t.passthrough.use_cases.length-l.length,D=mt(e.contextDir,R.session_id,Le,e.probe,e.auth),$=new Set(l.map(U=>U.temp_ref));(await Se(D,gt({...t.passthrough,use_cases:l},c),U=>{let L={...t.passthrough,use_cases:o(U.graph).filter(p=>$.has(p.temp_ref))},W=new Map(L.use_cases.map(p=>[p.temp_ref,{resolution:"approved"}])),N=je({contextDir:e.contextDir,graph:U.graph,proposal:L,proposalId:ie,verdicts:W,by:le,autoName:!0,allowStaleBasis:!0,eventIds:U.eventIds("extract",1),...te?{sid:U.sid}:{},probeHits:U.probeHits});return N.errors!==null?{errors:N.errors}:{result:N,record:N.record}})).ok||e.out("note: the unchanged-match evidence attach did not land this run \u2014 the held changeset is unaffected; re-run reconcile to refresh it"),f>0&&e.out(`note: ${f} unchanged match(es) target unreviewed (or no-longer-resolving) item(s) \u2014 evidence not attached (bless them with kane-cli context review; a later reconcile attaches)`);let Y=ge(),O=t.adds.length+t.updates.length+t.archives.length;Y&&O>0&&(Y.save({reconcile:{proposal_id:ie,verdicts:{}}}),me+=O,Ae=Y.state.sid,e.out(`held: ${O} change(s) from ${s.source_id} await your verdicts \u2014 nothing from the changeset committed`),e.emit?.({type:"held",source_id:s.source_id,count:O,reason:"reconcile"}));continue}if((Te||r.trust==="hold")&&ge()&&A.use_cases.some(t=>t.matches_existing==null)){ze(s,A.use_cases,Te?"degraded":"trust_hold");continue}let Ct=mt(e.contextDir,R.session_id,Le,e.probe,e.auth),Dt=t=>{if(t.degradedProbe&&ge()!==null&&A.use_cases.some(l=>l.matches_existing==null))return{result:{degradedHold:!0},record:null};let o=je({contextDir:e.contextDir,graph:t.graph,proposal:A,proposalId:ie,verdicts:Ne,by:le,autoName:!0,allowStaleBasis:!0,eventIds:t.eventIds("extract",1),...te?{sid:t.sid}:{},probeHits:t.probeHits});return o.errors!==null?{errors:o.errors}:{result:o,record:o.record}},Et=gt(A,c),B=await Se(Ct,Et,Dt);if(!B.ok&&B.kind==="drifted"){if(!await e.confirmStale(`the context changed while you reviewed (${B.asks.map(o=>o.detail).join("; ")}) \u2014 commit against the new head anyway?`)){e.out("aborted: proposal not committed"),e.emit?.({type:"error",source_id:s.source_id,message:"aborted: proposal not committed",code:"STALE_BASIS"}),F.push(s.source_id);continue}B=await Se(Ct,{...Et,sourcePins:[]},Dt)}let rt=B.ok&&"result"in B?B.result:null;if(rt!==null&&"degradedHold"in rt){We(),ze(s,A.use_cases,"degraded");continue}let pe=rt??(B.ok?{record:null,errors:null}:{record:null,errors:B.kind==="validation"?B.errors:B.kind==="contended"?[{code:B.err.code,detail:`a use-case this proposal touches is held by ${B.err.holder?.owner_sid??"another session"} \u2014 try again when it frees`}]:[{code:"UNSETTLED",detail:"concurrent activity kept moving the store \u2014 retry when quieter"}]});if(pe.errors){g("commit_error_details",{errors:pe.errors.map(t=>({code:t.code,detail:t.detail}))},R.session_id),e.out(`\u2717 commit failed \u2014 ${pe.errors.map(t=>t.code).join(", ")} (details: ${ke(x)})`),e.emit?.({type:"error",source_id:s.source_id,message:`error: commit failed: ${pe.errors.map(t=>`${t.code}: ${t.detail}`).join("; ")}`}),F.push(s.source_id);continue}let xr=new Date().toISOString();for(let t of A.use_cases){let o=Ne.get(t.temp_ref)??{resolution:"skipped"};for(let l of Jt({ts:xr,command:"context extract",id:t.temp_ref,by:le},o.resolution))Kt(e.contextDir,l)}let X=pe.record;X.event_ids?.length&&w?.markApplied(X.event_ids);let st=new Map(X.review.map(t=>[t.id,t.resolution])),it=[...st.values()].filter(t=>t==="approved"||t==="edited").length,He=[...st.values()].filter(t=>t==="rejected").length,_e=X.nodes.filter(t=>!st.has(t.cid)).length,nt=X.supersessions.filter(t=>t.kind==="node"&&t.new!==t.old).length;g("commit",{trusted:it,derived:_e,archived:He},R.session_id),e.out(`saved ${it+_e} use-case(s)`+(_e>0?` \xB7 ${_e} awaiting review`:"")+(He>0?` \xB7 ${He} archived`:"")+(nt>0?` \xB7 ${nt} superseded`:""));{let t=X.review.filter(o=>o.kind==="pending_update");t.length>0&&(e.out(`${t.length} update(s) held for review`),e.emit?.({type:"update_held",count:t.length,targets:t.map(o=>o.id)}))}S.assumedDefaults&&e.out(`assumed: ${S.assumedDefaults} default(s) auto-taken (assumed)`),e.emit?.({type:"commit",source_id:s.source_id,proposal_id:ie,trusted:it,derived:_e,archived:He,superseded:nt,assumed:S.assumedDefaults??0,evidence_matched:Math.max(0,A.use_cases.length-X.nodes.length),minted:X.nodes.map(t=>{let o=X.names?.find(l=>l.cid===t.cid)?.slug;return{cid:t.cid,...o?{logical_id:o}:{}}})}),u&&s.source_id in u.handle.state.read_basis&&(n(d),u.handle.complete(),e.out(`session ${r.resume} complete`),e.emit?.({type:"session_complete",sid:r.resume,source_id:s.source_id}),m?.event("ASR_SESSION_COMPLETE",{}),u=null,w=null)}if(w){let d=w.state.ingest_schedule??[];d.some(s=>s.status==="pending")&&w.save({ingest_schedule:d.map(s=>s.status==="pending"?{...s,status:"skipped",note:"run ended before its turn \u2014 kane-cli context extract runs it"}:s)})}vt=!0}finally{if(u?.handle.release(),T&&!Ee&&!vt){let n=T.state.checkpoint;if(n){let d=`kane-cli context extract --resume ${T.state.sid} --mode ${a}`;e.out(`session ${T.state.sid} kept its last checkpoint (seq ${n.seq}, ${n.ts}) \u2014 resume with: ${d}`),T.release()}else{try{T.complete()}catch{T.release()}pt()}T=null}}if(re){let n=e.chat?.state.ledger.filter(c=>c.kind==="answer"&&c.receipt.form==="assumed").length??0,d=xt+n,s=e.chat?.state.credits?.total;e.chat?.ledger?.({kind:"summary",lines:[`saved ${Ve} use-case${Ve===1?"":"s"} across ${M.length} source${M.length===1?"":"s"}`,...d>0?[`${d} assumed default(s)`]:[],...s!==void 0?[`credits used: ${s.toFixed(1)}`]:[],`trace: ${ke(x)}`]})}if(r.plan||or(e.contextDir),me>0&&(T||Ae)){Ee=!0;let n=T?.state.sid??Ae,d=`kane-cli context extract --resume ${n} --mode ${a}`;return e.out(`paused: ${me} held item(s) await review \u2014 resume with: ${d}`),e.emit?.({type:"session_paused",sid:n,resume:d,held:me}),T?.release(),3}return F.length>0&&e.out(`${F.length} of ${M.length} source(s) failed \u2014 re-run kane-cli context extract to retry (${F.join(", ")})`),_t(),F.length>0?1:0}export{mt as a,kr as b,gr as c,pr as d,Rr as e,hr as f,Ss as g};
@@ -1,2 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- var a={graph_search_similar:"search graph",graph_get_node:"read node",graph_get_edges:"read edges",graph_match_by_type:"match by type",graph_find_by_provenance:"trace provenance",graph_stale_nodes:"check stale",ask_user:"ask",finalize_proposal:"propose use-cases",chat_turn:"apply changes",read_image:"read image",source_read:"read source",source_grep:"search source",finalize_design:"propose design",expand_bva:"expand boundaries",covering_array:"combine classes",dedupe_candidates:"dedupe",budget_cut:"trim to budget",source_list:"list sources",graph_search_similar_batch:"search graph",graph_history:"read history"};function o(t){let e=a[t.name],n=t.status==="error"||t.status==="aborted"?" \u2717":"",i=t.detail?` \u2014 ${t.detail}`:"";return e?`\u2692 ${e}${i}${n}`:`\u2692 working\u2026${i}${n}`}function r(t){return o(t).replace(/^\S+ /,"")}function d(){return{currentAttempt:null,liveThinking:"",thinkingLog:[],activity:[]}}var s={dedup_candidate:"checking a possible duplicate",ambiguity:"asking to resolve an ambiguity",validation_repair:"repairing a validation failure",finalize:"finalizing the proposal",terminal_call:"putting the result together",validation_failed:"fixing a validation issue",no_tool_calls:"nudging a stalled turn",evidence_readback:"reading the evidence back",evidence_search:"searching the evidence",provenance_check:"checking provenance"};function c(t){return s[t.reason_code]??t.reason_code.replace(/_/g," ")}function u(t){let e=r({name:t.name});return t.status==="started"?`\u2192 ${e}\u2026`:t.status==="error"||t.status==="aborted"?`\u2717 ${e}`:`\u2713 ${e}`}function g(t,e){return e.turn_id!==t.turn_id?e.turn_id<t.turn_id:e.attempt<t.attempt}function h(t,e){let n=t.currentAttempt;if(n===null||n.turn_id!==e.turn_id||n.attempt!==e.attempt){if(n!==null&&g(n,e))return t;t={...t,currentAttempt:{turn_id:e.turn_id,attempt:e.attempt},liveThinking:""}}switch(e.type){case"reasoning_delta":return{...t,liveThinking:t.liveThinking+e.text};case"reasoning_done":return e.present?{...t,thinkingLog:[...t.thinkingLog,{text:t.liveThinking,tookMs:e.took_ms}],liveThinking:""}:{...t,liveThinking:""};case"tool_activity":return{...t,activity:[...t.activity,{name:e.name,status:e.status,label:u(e)}]};case"decision_activity":return{...t,activity:[...t.activity,{name:e.action,status:"decision",label:c(e)}]}}}export{o as a,r as b,d as c,c as d,h as e};
@@ -1,2 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as D}from"./chunk-CLGC7VEO.js";import{a as y}from"./chunk-YCCUBQY4.js";import{y as r}from"./chunk-27U4PLPX.js";import{a as B}from"./chunk-HCBYKLMW.js";import{a as p,b as t,i as _,k as C}from"./chunk-C44QQJR4.js";import{a as W}from"./chunk-6YGTRKDT.js";import{e as $}from"./chunk-UR6MHSHU.js";var a=$(B(),1);function G(e){let c=e.findIndex(d=>d.free);return c>=0?c:null}var F=60,N=100;function J({headline:e,ask:c=!1,rows:d,sel:i,focused:v,legend:s,freeText:f=null,freeTextNote:g,sublines:u=[]}){let{stdout:o}=C(),h=o?.columns??80,A=h<F,m=Math.min(h-1,N),b=l=>v&&i===l?(0,a.jsx)(t,{color:r.assuranceAccent,children:"\u276F"}):" ",x=c?`? ${e}`:e,R=Math.max(4,m-3),w=u.map((l,T)=>(0,a.jsx)(t,{color:r.dim,children:` ${l.length>R?`${l.slice(0,R-1)}\u2026`:l}`},`sub-${T}`)),k=0,E=d.map((l,T)=>l.free?f?(0,a.jsxs)(p,{flexDirection:"column",children:[(0,a.jsxs)(p,{children:[(0,a.jsxs)(t,{children:[(0,a.jsx)(t,{color:r.assuranceAccent,children:"\u276F"})," ",(0,a.jsx)(t,{color:r.dim,children:"\u270E "})]}),(0,a.jsx)(y,{value:f.value,onChange:f.onChange,onSubmit:f.onSubmit,onCancel:f.onCancel,placeholder:l.label})]}),g?(0,a.jsx)(t,{color:r.muted,children:` ${g}`}):null]},l.key):(0,a.jsxs)(t,{children:[b(T)," ",(0,a.jsx)(t,{color:r.dim,children:`\u270E ${l.label}`})]},l.key):(k+=1,(0,a.jsxs)(t,{bold:v&&i===T,children:[b(T),` ${k}. ${l.label}`,l.detail?(0,a.jsx)(t,{color:r.dim,bold:!1,children:` \u2014 ${l.detail}`}):null]},l.key)));if(A)return(0,a.jsxs)(p,{marginTop:1,marginBottom:1,flexDirection:"column",children:[(0,a.jsx)(t,{bold:!0,color:r.assuranceAccent,children:x}),w,E,(0,a.jsx)(t,{color:r.muted,children:s})]});let M=Math.max(2,m-(3+x.length+1)),L=Math.max(2,m-(3+s.length+1));return(0,a.jsxs)(p,{marginTop:1,marginBottom:1,flexDirection:"column",children:[(0,a.jsxs)(t,{color:r.assuranceAccent,children:["\u2500\u2500 ",(0,a.jsx)(t,{bold:!0,children:x}),` ${"\u2500".repeat(M)}`]}),w,(0,a.jsx)(t,{children:" "}),E,(0,a.jsx)(t,{children:" "}),(0,a.jsxs)(t,{color:r.assuranceAccent,children:["\u2500\u2500 ",(0,a.jsx)(t,{color:r.muted,children:s}),` ${"\u2500".repeat(L)}`]})]})}var S=$(B(),1),H="ctrl+t thinking \xB7 ctrl+c exit";function I(e,c){if(e.length<=c)return e;if(c<=1)return"\u2026";let d=Math.ceil((c-1)/2),i=Math.floor((c-1)/2);return`${e.slice(0,d)}\u2026${i>0?e.slice(-i):""}`}function te({verb:e,subject:c,pendingCount:d,creditsTotal:i,state:v,hints:s=H}){let{stdout:f}=C(),g=f?.columns??80,u=[];u.push(e),v&&u.push(v),i!==void 0&&u.push(`${i.toFixed(1)} credits`);let o=d?`[${d} pending]`:null,h=" \xB7 ",m=[...u,...o?[o]:[]].join(h).length,b,x=[...u,...c?[c]:[],...o?[o]:[],s].join(h);if(x.length<=g)b=x;else{let R=g-m-(c?h.length:0)-h.length-s.length;if(c&&R>=8)b=[...u,I(c,R),...o?[o]:[],s].join(h);else{let w=g-m-(c?h.length:0);b=[...u,...c&&w>=4?[I(c,w)]:[],...o?[o]:[]].join(h)}}if(v){let R=` \xB7 ${v}`,w=b.indexOf(R);if(w>=0)return(0,S.jsxs)(t,{color:r.dim,children:[b.slice(0,w+3),(0,S.jsx)(t,{color:r.assuranceAccent,children:v}),b.slice(w+R.length)]})}return(0,S.jsx)(t,{color:r.dim,children:b})}var O=$(W(),1);function re({onToggleThinking:e,onCtrlC:c,explorer:d,panel:i}){let s=(0,O.useRef)(null),f=(0,O.useRef)(""),g=()=>{s.current&&clearTimeout(s.current),s.current=null,f.current=""};return(0,O.useEffect)(()=>g,[]),_((u,o)=>{if(o.ctrl&&u==="t"){e();return}if(o.ctrl&&u==="c"){c();return}if(!o.ctrl&&u.includes("")){c();return}if(!o.ctrl&&u.includes("")){e();return}if(d&&d.isOpen()){let h=()=>{s.current&&clearTimeout(s.current),s.current=setTimeout(()=>{g(),d.onBack()},150)};if(s.current){if(o.upArrow||o.downArrow||o.return){g(),o.return?d.onEnter():d.onMove(o.upArrow?-1:1);return}if(f.current+=u,f.current==="["){h();return}let A=f.current;g();let m=/^\[([ABCD])/.exec(A);if(m){(m[1]==="A"||m[1]==="B")&&d.onMove(m[1]==="A"?-1:1);return}d.onBack();return}if(o.upArrow){d.onMove(-1);return}if(o.downArrow){d.onMove(1);return}if(o.return){d.onEnter();return}if(o.escape){f.current="",h();return}return}if(i&&i.isFocused()){let h=()=>{s.current&&clearTimeout(s.current),s.current=setTimeout(()=>{g(),i.onBack()},150)};if(s.current){if(o.upArrow||o.downArrow||o.return||o.leftArrow||o.rightArrow){g(),o.return?i.onSelect():o.leftArrow?i.onLeft?.():o.rightArrow?i.onRight?.():i.onMove(o.upArrow?-1:1);return}if(f.current+=u,f.current==="["){h();return}let A=f.current;g();let m=/^\[([ABCD])/.exec(A);if(m){m[1]==="A"||m[1]==="B"?i.onMove(m[1]==="A"?-1:1):m[1]==="C"?i.onRight?.():i.onLeft?.();return}i.onBack();return}if(o.upArrow){i.onMove(-1);return}if(o.downArrow){i.onMove(1);return}if(o.leftArrow){i.onLeft?.();return}if(o.rightArrow){i.onRight?.();return}if(o.return){i.onSelect();return}if(o.escape){f.current="",h();return}if(/^[1-9]$/.test(u)){i.onDigit(Number(u));return}if(o.tab){i.onTab?.();return}if(u===" "&&i.isMulti()){i.onSpace();return}if(u&&!o.ctrl&&!o.meta){i.onType(u);return}return}}),null}var n=$(B(),1);function V(e){return e.kind==="REVIEW"?[{v:"approve",label:"approve",detail:"mark it reviewed and trusted"},{v:"archive",label:"archive",detail:"reject it \u2014 asks for a reason; impact shown above"},{v:"defer",label:"defer",detail:"not now \u2014 stays queued"}]:e.kind==="PAIR"?[{v:"merge",label:"merge",detail:"duplicate \u2014 fold into the older item (it stays unreviewed)"},{v:"keep_both",label:"keep both",detail:"genuinely distinct \u2014 promote both"},{v:"defer",label:"defer",detail:"not now \u2014 stays queued"}]:e.kind==="ARCHIVE"?[{v:"archive",label:"retire",detail:"hidden from now on; history is kept and it can be reverted"},{v:"skip",label:"skip",detail:"keep it \u2014 decided, never re-offered"},{v:"defer",label:"defer",detail:"not now \u2014 the plan re-offers it"}]:e.heldPayload?[{v:"approve",label:"approve update",detail:"commit the held payload \u2014 impact preview above"},{v:"skip",label:"keep current",detail:"drop the held payload (the owner's disk state stays untouched)"},{v:"defer",label:"defer",detail:"not now \u2014 stays held"}]:[{v:"approve",label:"approve",detail:e.kind==="ADD"?"commit + design it":"commit the updated version (old\u2192new redirect)"},{v:"skip",label:e.origin==="content-change"?"reject":"skip",detail:e.origin==="content-change"?"drop the staged proposal \u2014 nothing committed":"leave it as is"},{v:"defer",label:"defer",detail:"not now \u2014 the plan keeps it staged"}]}function P(e){let c=V(e);return e.viewDiff&&c.push({v:"view_diff",label:"view diff",detail:"full old \u2192 new"}),c}function K(e){return e.kind==="ARCHIVE"?null:P(e).length}var j={ADD:{color:r.green??"green"},MODIFY:{color:"yellow"},ARCHIVE:{color:r.red},REVIEW:{color:"cyan"},PAIR:{color:"magenta"}},q=60,Q=100;function ue({card:e,position:c,sel:d=0,focused:i=!1,freeText:v=null,editorIntent:s="steer"}){let{stdout:f}=C(),g=f?.columns??80,u=g<q,o=Math.min(g-1,Q),h=P(e),A=K(e),m=j[e.kind],b=l=>i&&d===l?(0,n.jsx)(t,{color:r.assuranceAccent,children:"\u276F"}):" ",x=e.impact,R=x&&"stale_refs"in x&&x.stale_refs.length>0?`${e.kind==="ARCHIVE"?"retiring leaves":"approving marks"} ${x.stale_refs.length} item(s) stale`+((x.direct_refs?.length??0)>0?` \u2014 ${x.direct_refs.length} directly touched: ${x.direct_refs.join(", ")}`:""):x&&"design_children"in x?`${e.kind==="REVIEW"?"archiving drops":"merging folds"} ${x.design_children} design child(ren)`:null,w=`? reconcile \u2014 item ${c.n} of ${c.of}`,k=A!==null?"\u2191\u2193 \xB7 \u23CE select \xB7 1-9 \xB7 type = adjust \xB7 esc \xB7 nothing to undo":"\u2191\u2193 \xB7 \u23CE select \xB7 1-9 \xB7 esc \xB7 nothing to undo",E=(0,n.jsxs)(p,{flexDirection:"column",children:[(0,n.jsx)(p,{paddingLeft:2,children:(0,n.jsxs)(t,{bold:!0,children:[(0,n.jsx)(t,{color:m.color,children:`[${e.kind}]`}),` ${D(e.title)}`]})}),(0,n.jsx)(p,{paddingLeft:2,children:(0,n.jsx)(t,{color:r.muted,children:e.why})}),e.diffSummary?(0,n.jsx)(p,{paddingLeft:2,children:(0,n.jsx)(t,{color:r.dim,children:e.diffSummary})}):(e.diff??[]).map((l,T)=>(0,n.jsx)(p,{paddingLeft:4,children:(0,n.jsx)(t,{color:l.op==="-"?"red":"green",children:`${l.op==="-"?"\u2212":"+"} ${l.field==="criteria"?"criterion":l.field}: ${l.text}`})},`d-${T}`)),e.tier?(0,n.jsx)(p,{paddingLeft:2,children:(0,n.jsx)(t,{color:r.dim,children:`match: ${e.tier}`})}):null,(e.citeLines??[]).map((l,T)=>(0,n.jsx)(p,{paddingLeft:2,children:(0,n.jsx)(t,{color:r.dim,children:l})},`c-${T}`)),R?(0,n.jsx)(p,{paddingLeft:2,children:(0,n.jsx)(t,{color:r.muted,children:`impact: ${R}`})}):null,e.kind==="ARCHIVE"&&e.provenance&&e.provenance!==e.why?(0,n.jsx)(p,{paddingLeft:2,children:(0,n.jsx)(t,{color:r.muted,children:e.provenance})}):null,(0,n.jsx)(t,{children:" "}),h.map((l,T)=>(0,n.jsxs)(t,{children:[b(T),` ${T+1}. ${l.label}`,(0,n.jsx)(t,{color:r.dim,children:` \u2014 ${l.detail}`})]},`o-${T}`)),A!==null||v&&s==="because"?v?(0,n.jsxs)(p,{flexDirection:"column",children:[(0,n.jsxs)(p,{children:[(0,n.jsxs)(t,{children:[(0,n.jsx)(t,{color:r.assuranceAccent,children:"\u276F"})," ",(0,n.jsx)(t,{color:r.dim,children:"\u270E "})]}),(0,n.jsx)(y,{value:v.value,onChange:v.onChange,onSubmit:v.onSubmit,onCancel:v.onCancel,placeholder:s==="because"?"why archive it?":"say what to adjust"})]}),(0,n.jsx)(t,{color:r.muted,children:s==="because"?" submits as: archive \xB7 your reason goes on the record":e.kind==="PAIR"?" submits as: defer \xB7 your note parks with the card (it re-offers)":" submits as: approve \xB7 your words steer the re-design"})]}):A!==null?(0,n.jsxs)(t,{children:[b(A)," ",(0,n.jsx)(t,{color:r.dim,children:e.kind==="PAIR"?"\u270E defer with a note \u2014 say what you noticed":"\u270E approve with changes \u2014 say what to adjust"})]}):null:null]});if(u)return(0,n.jsxs)(p,{marginTop:1,marginBottom:1,flexDirection:"column",children:[(0,n.jsx)(t,{bold:!0,color:r.assuranceAccent,children:w}),E,(0,n.jsx)(t,{color:r.muted,children:k})]});let M=Math.max(2,o-(3+w.length+1)),L=Math.max(2,o-(3+k.length+1));return(0,n.jsxs)(p,{marginTop:1,marginBottom:1,flexDirection:"column",children:[(0,n.jsxs)(t,{color:r.assuranceAccent,children:["\u2500\u2500 ",(0,n.jsx)(t,{bold:!0,children:w}),` ${"\u2500".repeat(M)}`]}),(0,n.jsx)(t,{children:" "}),E,(0,n.jsx)(t,{children:" "}),(0,n.jsxs)(t,{color:r.assuranceAccent,children:["\u2500\u2500 ",(0,n.jsx)(t,{color:r.muted,children:k}),` ${"\u2500".repeat(L)}`]})]})}export{G as a,J as b,te as c,re as d,V as e,P as f,K as g,ue as h};
@@ -1,4 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{b as U}from"./chunk-DNNZ353O.js";import{a as G}from"./chunk-Q2F5QB2W.js";import{b as B,c as b}from"./chunk-NVGBE2DR.js";import{A as T}from"./chunk-TH47OOBV.js";import{a as L,c as F}from"./chunk-CUM23TLF.js";import{b as P,i as j}from"./chunk-DUAXZYAD.js";import{a as R,d as $,f as D}from"./chunk-WXHQYYD5.js";import{existsSync as ie,mkdirSync as oe,readFileSync as re,writeFileSync as se}from"fs";import{basename as C,extname as H,join as ae}from"path";var K=/^[A-Za-z0-9][A-Za-z0-9._-]*$/;function q(e){return typeof e=="string"&&e!=="."&&e!==".."&&K.test(e)}function k(e){if(!q(e))throw new Error(`unsafe logical_id: ${JSON.stringify(e)} \u2014 must match ${String(K)} (no path separators)`)}import{extname as W}from"path";var Q={kind:"jira",media_type:"application/x-kane-jira-envelope",extensions:[],cite:"verbatim",maxBytes:2e6},ee={kind:"confluence",media_type:"application/x-kane-confluence-envelope",extensions:[],cite:"verbatim",maxBytes:2e6},z=[{kind:"text",media_type:"text/plain",extensions:[".txt"],cite:"verbatim",maxBytes:2e6},{kind:"markdown",media_type:"text/markdown",extensions:[".md",".markdown"],cite:"verbatim",maxBytes:2e6},{kind:"image",media_type:"image/png",extensions:[".png"],cite:"anchor-only",maxBytes:5e6},{kind:"image",media_type:"image/jpeg",extensions:[".jpg",".jpeg"],cite:"anchor-only",maxBytes:5e6},{kind:"image",media_type:"image/webp",extensions:[".webp"],cite:"anchor-only",maxBytes:5e6},{kind:"text",media_type:"application/json",extensions:[".json"],cite:"verbatim",maxBytes:2e6},{kind:"text",media_type:"application/yaml",extensions:[".yaml",".yml"],cite:"verbatim",maxBytes:2e6},{kind:"text",media_type:"application/toml",extensions:[".toml"],cite:"verbatim",maxBytes:2e6},{kind:"text",media_type:"application/xml",extensions:[".xml"],cite:"verbatim",maxBytes:2e6},{kind:"text",media_type:"text/plain",extensions:[".log"],cite:"verbatim",maxBytes:2e6},{kind:"pdf",media_type:"application/pdf",extensions:[".pdf"],cite:"verbatim",maxBytes:25e6,sniff:e=>e.subarray(0,5).toString("latin1")==="%PDF-"},{kind:"docx",media_type:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",extensions:[".docx"],cite:"verbatim",maxBytes:25e6,sniff:e=>e.length>=4&&e[0]===80&&e[1]===75&&e[2]===3&&e[3]===4,sniffFail:e=>e.length>=8&&e.subarray(0,8).equals(te)?"DOCX_ENCRYPTED_OR_LEGACY: password-protected Office file (or a legacy .doc renamed .docx) \u2014 remove the password / save as .docx and re-ingest":void 0},Q,ee],te=Buffer.from([208,207,17,224,161,177,26,225]),S={pdf:"pdf",docx:"docx",jira:"jira",confluence:"confluence"},pe=new Set(Object.keys(S));function J(e){let n=W(e).toLowerCase(),t=z.find(i=>i.extensions.includes(n));return t?{ok:!0,media:t}:{ok:!1,code:"UNSUPPORTED_MEDIA",allowlist:z.flatMap(i=>i.extensions)}}function v(e){return e>=1024*1024?`${(e/(1024*1024)).toFixed(1)} MB`:`${Math.max(1,Math.round(e/1024))} KB`}function de(e,n,t){return G({source_id:e,source_cid:"sha256:".padEnd(71,"0"),doc_kind:n,numbered_text:U(t)})}var Y=2e3;function ce(e){let t=C(e,H(e)).toLowerCase().replace(/[^a-z0-9._-]+/g,"-").replace(/^[^a-z0-9]+/,"");return k(t),t}function ke(e){let n=/^(.*?)[-_.]?v?\d+$/.exec(e);if(!n)return null;let t=(n[1]??"").replace(/[-_.]+$/,"");return t.length>0&&t!==e?t:null}function X(e){let n=ae(e,"meta.json");ie(n)||(oe(e,{recursive:!0}),se(n,JSON.stringify({schema:R,canonicalizer:"v1"},null,2)+`
3
- `))}async function Se(e){let{contextDir:n,filePath:t,asId:i,confirmSameSource:y,converters:h}=e;X(n);let o=re(t),s=J(t);if(!s.ok)throw new Error(`${C(t)} is a file type kane can't ingest (${H(t)||"no extension"}) \u2014 supported: ${s.allowlist.join(" ")} [UNSUPPORTED_MEDIA]`);if(o.byteLength>s.media.maxBytes)throw new Error(`${C(t)} is too large \u2014 ${v(o.byteLength)}, the limit for ${s.media.media_type} is ${v(s.media.maxBytes)} [FILE_TOO_LARGE]`);if(s.media.sniff&&!s.media.sniff(o)){let m=s.media.sniffFail?.(o);throw new Error(m??`MEDIA_SNIFF_MISMATCH: ${t} does not look like ${s.media.media_type}`)}let l;return i!==void 0?(k(i),l=i):l=ce(t),le({contextDir:n,bytes:o,media:s.media,sourceId:l,label:t,confirmSameSource:y,converters:h})}async function le(e){let{contextDir:n,bytes:t,media:i,confirmSameSource:y,converters:h}=e,o=e.sourceId,s=e.label??o;if(X(n),t.byteLength>i.maxBytes)throw new Error(`the content is too large \u2014 ${v(t.byteLength)}, the limit for ${i.media_type} is ${v(i.maxBytes)} [FILE_TOO_LARGE]`);let l=[],m=S[i.kind];if(i.cite==="verbatim"&&!m){try{new TextDecoder("utf-8",{fatal:!0}).decode(t)}catch{throw new Error(`ENCODING_UNSUPPORTED: ${s} is not valid UTF-8 \u2014 re-save it as UTF-8 and re-ingest`)}t.toString("utf8").split(`
4
- `).some(p=>p.length>Y)&&l.push(`long line detected (> ${Y} chars) \u2014 anchors lose granularity; consider pretty-printing before ingest`)}let f=B(t),_=new Map,c=null,M=!1;for(let p=0;;p++){let x=T(n),u=x.heads.get(o),Z=u!=null?x.getNode(u)?.content:void 0;if(u!=null&&Z?.blob===f)return{status:"unchanged",source_id:o,cid:u,blob:f};if(u==null){for(let[r,g]of x.heads.entries())if(!(r===o||g==null)&&x.getNode(g)?.content.blob===f){let a;if(_.has(r)?a=_.get(r):p===0&&y?(a=await y(r),_.set(r,a)):(a=!1,_.set(r,a),p>0&&l.push(`same bytes already ingested as '${r}' \u2014 minted under '${o}' anyway (the twin appeared mid-commit; not prompted)`)),a)return{status:"unchanged",source_id:r,cid:g,blob:f};break}}if(c===null){let r={},g,a=null,O=null;if(m){let A=h?.[m];if(!A)throw new Error(`${m.toUpperCase()}_CONVERTER_MISSING: ${m} ingestion requires the converter \u2014 the command layer wires it`);let d=await A(t);a=Buffer.from(d.projection,"utf8");let N=de(o,i.kind,a);if(N>4e5)throw new Error(`PROJECTION_TOO_LARGE: serialized source payload ${N} bytes > ${4e5} \u2014 split the document and re-ingest`);r={text_blob:B(a),...d.inventory.length>0?{images:d.inventory}:{},converter:d.converter},O=d.blobs,g={kind:i.kind,...d.pages!==void 0?{pages:d.pages}:{},delivered:d.delivered.length,omitted:d.inventory.length-d.delivered.length}}c={derived:r,composite:g,projBytes:a,derivedBlobs:O}}if(!M){if(b(n,t),c.projBytes!==null&&b(n,c.projBytes),c.derivedBlobs!==null)for(let[,r]of c.derivedBlobs)b(n,r);M=!0}let w=F(o,f),E=D("source",w);if(E.length>0)throw new Error(`source node fails ${E[0].code}: ${E[0].detail}`);let I=L("source",w);try{j(n,{ts:new Date().toISOString(),proposal_id:null,nodes:[{cid:I,label:$.SOURCE,content:w}],edges:[],review:[],supersessions:[],media:{[o]:{format:i.kind,media_type:i.media_type,anchors_supported:m?["L-L","img#ref"]:i.cite==="verbatim"?["L-L"]:[],...c.derived}},...e.eventIds&&e.eventIds.length>0?{event_ids:e.eventIds}:{},source_head_moves:{[o]:I}},{expectPrev:x.latestHash})}catch(r){if(r instanceof P&&p<3)continue;throw r}return{status:u!=null?"versioned":"created",source_id:o,cid:I,blob:f,...l.length?{warnings:l}:{},...c.composite?{composite:c.composite}:{}}}}export{k as a,Q as b,ee as c,pe as d,J as e,de as f,ce as g,ke as h,Se as i,le as j};
@@ -1,4 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{b as u,d as f,e as l}from"./chunk-FNH55WSR.js";import{a as p}from"./chunk-TZXXJWHA.js";function d(t,r,e){return{id:`${t}.internal`,label:r,required:!0,status:"fail",detail:e instanceof Error?e.message:String(e)}}async function $(t,r={}){let e=p();if(!e.supported)return{sections:[{platform:"host",checks:[{id:"host.platform",label:"host",required:!0,status:"fail",detail:e.reason}],targets:[]}]};let n=t?u().filter(s=>s.toLowerCase()===t.toLowerCase()):u(),c=[];for(let s of n){let o=f(s);if(!o)continue;let i;try{i=await o.checks(r)}catch(h){i=[d(s,"toolchain check",h)]}let a=[];if(r.targets)try{a=await l(s)}catch{}c.push({platform:s,checks:i,targets:a})}return{sections:c}}function g(t){return t==="pass"?"\u2713":t==="fail"?"\u2717":"\u2139"}function m(t){return t.charAt(0).toUpperCase()+t.slice(1)}function k(t){if(t.state==="stopped")return`${t.kind==="simulator"?"simulator":"virtual device"}, stopped (bootable)`;let r=t.kind==="simulator"?"simulator":"emulator";return t.state==="ready"?`${r}, ready`:t.state==="unauthorized"?`${r}, UNAUTHORIZED \u2192 accept the USB-debugging prompt on the device`:`${r}, offline \u2192 reconnect the device, then re-run`}function x(t){return t.state==="ready"||t.state==="stopped"?"\u2713":"\u2717"}function y(t,r={}){let e=[];if(t.sections.length===0)return"No mobile platforms are supported on this host.";for(let n of t.sections){e.length>0&&e.push(""),e.push(`${m(n.platform)} toolchain`);let c=r.verbose?n.checks:n.checks.filter(o=>o.status!=="info"),s=new Set;for(let o of c){let i=o.detail?` \u2014 ${o.detail}`:"";if(e.push(` ${g(o.status)} ${o.label}${i}`),o.status==="fail"&&o.fixText&&!s.has(o.fixText)){s.add(o.fixText);for(let a of o.fixText.split(`
3
- `))e.push(` fix: ${a}`)}}if(n.targets.length>0){e.push(" Targets");for(let o of n.targets){let i=o.id===o.displayName?o.displayName:`${o.displayName} (${o.id})`;e.push(` ${x(o)} ${i} \u2014 ${k(o)}`)}}}return e.join(`
4
- `)}function T(t){return t.sections.length===0?!0:t.sections.every(r=>r.checks.some(e=>e.required&&e.status==="fail"&&!e.fixedByBundle))}function C(t){for(let r of t.sections)for(let e of r.checks)if(e.required&&e.status!=="pass")return 2;return 0}export{$ as a,y as b,T as c,C as d};
@@ -1,2 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a,b,c,d}from"./chunk-7BZSCUPP.js";import"./chunk-W4B5LOEX.js";import"./chunk-DNNZ353O.js";import"./chunk-2UIHS2FH.js";import"./chunk-Q2F5QB2W.js";import"./chunk-N2P4MI32.js";import"./chunk-NVGBE2DR.js";import"./chunk-TH47OOBV.js";import"./chunk-VAYBKR76.js";import"./chunk-CUM23TLF.js";import"./chunk-DUAXZYAD.js";import"./chunk-DBIBROYW.js";import"./chunk-WXHQYYD5.js";import"./chunk-IAHKTEET.js";import"./chunk-UD7KKHPW.js";import"./chunk-27U4PLPX.js";import"./chunk-UR6MHSHU.js";export{b as REMOTE_PROVIDERS,d as findProvider,a as landingReceipt,c as looksLikeUrl};
@@ -1,2 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a,b,c,d}from"./chunk-YRFMPIU2.js";import"./chunk-FNH55WSR.js";import"./chunk-TYLYFERW.js";import"./chunk-MSGW4JDG.js";import"./chunk-TZXXJWHA.js";import"./chunk-4JOD47QI.js";import"./chunk-RZ4F3BHX.js";import"./chunk-27U4PLPX.js";import"./chunk-UR6MHSHU.js";export{d as doctorExitCode,c as doctorPreflightBlocked,b as renderDoctorText,a as runDoctor};
@@ -1,2 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{$ as ha,A as L,B as M,C as N,D as O,E as P,F as Q,J as R,K as S,L as T,M as U,N as V,O as W,P as X,Q as Y,R as Z,S as _,T as $,U as aa,V as ba,W as ca,X as da,Y as ea,Z as fa,_ as ga,a as c,aa as ia,b as d,c as e,d as f,e as g,f as h,g as i,h as j,i as t,j as u,k as v,l as w,m as x,n as y,o as z,p as A,q as B,r as C,s as D,t as E,u as F,v as G,w as H,x as I,y as J,z as K}from"./chunk-ZVHCQMJ6.js";import"./chunk-5DBK6QNS.js";import{a as n,b as o,c as p,e as q,f as r,g as s}from"./chunk-CJJXT5DO.js";import"./chunk-XWKUZJCP.js";import"./chunk-ZPDM6FO7.js";import{a as k,b as l,c as m}from"./chunk-EHN5HTUD.js";import"./chunk-NVGBE2DR.js";import"./chunk-CH273NAE.js";import"./chunk-L5LI2JF4.js";import{a,f as b}from"./chunk-6IA6QMPH.js";import"./chunk-TH47OOBV.js";import"./chunk-VAYBKR76.js";import"./chunk-CUM23TLF.js";import"./chunk-DUAXZYAD.js";import"./chunk-DBIBROYW.js";import"./chunk-WXHQYYD5.js";import"./chunk-IAHKTEET.js";import"./chunk-UD7KKHPW.js";import"./chunk-2KDGIZED.js";import"./chunk-TYLYFERW.js";import"./chunk-MSGW4JDG.js";import"./chunk-4JOD47QI.js";import"./chunk-G7VQCS4J.js";import"./chunk-RZ4F3BHX.js";import"./chunk-27U4PLPX.js";import"./chunk-UR6MHSHU.js";export{P as EvidenceSession,C as appendExecutionPointer,M as assembleExecutionEnv,b as buildEnvironment,j as buildEvidenceRunConfig,i as buildExternalId,z as buildLogsMetaYaml,y as buildResultYaml,t as buildRunYaml,O as createCdpBrowserCapture,u as createRunningPack,v as createRunningPackRoot,H as declareLogsFromDir,J as diagnostics,x as discardPack,ba as ensureAuteurExecution,N as fetchCdpBrowserString,L as finalizeEvidencePack,U as finalizeInlineEvidence,K as finalizeMemberTestLogs,da as flattenAuteurLeafIds,ca as flattenAuteurLeaves,T as inlineEvidenceBlock,q as listPacks,p as newExecutionId,a as normalizeOs,S as noteInlineSpawn,$ as offerEvidenceView,o as packPath,I as packTestLogsDir,V as parseRange,D as readExecutionPointers,ia as readPackLeafIds,ha as readPackLeaves,s as recoverStore,fa as remapReplayActionIds,r as resolvePack,ga as resolveReplayResultSteps,F as rollupTestStatus,aa as runEvidenceMerge,_ as runEvidenceServe,E as runEvidenceValidate,Q as runStartupRecovery,l as sealPack,w as sealPackById,Z as serveHint,f as shortHash,e as slugify,W as startEvidenceLocalServer,R as startInlineEvidence,n as storeDir,m as sweepStore,ea as synthesizeSkippedTail,h as testIdForInline,g as testIdForTestmd,k as validatePack,c as verdictFromResultCode,X as viewerBaseFor,Y as viewerUrlFor,d as worstOf,G as worstResultCode,B as writeLogsMeta,A as writeResult};
@@ -1,2 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a,b,c,d,e,f,g}from"./chunk-RLRNLIRS.js";import"./chunk-OS4VSIHT.js";import"./chunk-TRJUD3XJ.js";import"./chunk-JFAFKHDX.js";import"./chunk-JZ26R6UL.js";import"./chunk-DNNZ353O.js";import"./chunk-5DT7PIGB.js";import"./chunk-NVGBE2DR.js";import"./chunk-CH273NAE.js";import"./chunk-TH47OOBV.js";import"./chunk-VAYBKR76.js";import"./chunk-CUM23TLF.js";import"./chunk-DUAXZYAD.js";import"./chunk-DBIBROYW.js";import"./chunk-WXHQYYD5.js";import"./chunk-IAHKTEET.js";import"./chunk-UD7KKHPW.js";import"./chunk-UR6MHSHU.js";export{b as designStateOf,g as evolveCommand,c as evolveOneUc,f as liveRunDesignForUc,a as resolveParentUc,e as runEvolveCommand,d as staleTargets};
@@ -1,10 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{f as Y,g as F}from"./chunk-V2R3LCA3.js";import"./chunk-ZMNJBUAO.js";import"./chunk-W5TTF7GB.js";import"./chunk-I7TIGB7K.js";import"./chunk-KU6IXFGZ.js";import"./chunk-ZGBSGZZM.js";import"./chunk-65ZTD5SJ.js";import"./chunk-BRHNRCEZ.js";import"./chunk-BB2W35TW.js";import"./chunk-VGFTNLQQ.js";import"./chunk-L2TV4G56.js";import"./chunk-JFAFKHDX.js";import"./chunk-6KPPGMO2.js";import"./chunk-7BZSCUPP.js";import"./chunk-GFKCTYCA.js";import{c as Q}from"./chunk-YKTYVJBN.js";import"./chunk-IMR64OCZ.js";import"./chunk-427OQS2N.js";import{a as P}from"./chunk-QSDH5P7C.js";import{a as q}from"./chunk-JZ26R6UL.js";import"./chunk-W4B5LOEX.js";import"./chunk-DNNZ353O.js";import"./chunk-R7QAS6LZ.js";import"./chunk-KRKGZ2ZW.js";import"./chunk-2UIHS2FH.js";import"./chunk-Q2F5QB2W.js";import"./chunk-BKHXPBWN.js";import"./chunk-N2P4MI32.js";import{e as $}from"./chunk-OMQCD3KR.js";import"./chunk-SDPRO2LE.js";import{c as U}from"./chunk-5DT7PIGB.js";import"./chunk-NVGBE2DR.js";import{a as C}from"./chunk-CH273NAE.js";import{a as M,b as N}from"./chunk-IP2O264K.js";import"./chunk-R5T4RLF5.js";import"./chunk-IDX3TOPY.js";import"./chunk-BKM2LWU2.js";import"./chunk-TH47OOBV.js";import"./chunk-VAYBKR76.js";import"./chunk-CUM23TLF.js";import"./chunk-DUAXZYAD.js";import"./chunk-DBIBROYW.js";import"./chunk-WXHQYYD5.js";import"./chunk-IAHKTEET.js";import"./chunk-UD7KKHPW.js";import"./chunk-KBM3XHAM.js";import"./chunk-2YEHV2CX.js";import"./chunk-MSGW4JDG.js";import"./chunk-56PAQAX5.js";import"./chunk-5EOX4MEY.js";import"./chunk-RZ4F3BHX.js";import"./chunk-27U4PLPX.js";import"./chunk-UR6MHSHU.js";async function X(r){let[{render:n},s,{QuestionBatchPrompt:p}]=await Promise.all([import("./build-JIKYOZUH.js"),import("./react-QWOAB3TB.js"),import("./ui-JEJGTURD.js")]),m=s.default??s;return new Promise(w=>{let y=n(m.createElement(p,{questions:r,onSubmit:t=>{y.unmount(),w(t)}}))})}async function Z(r,n){let[{render:s},p,{ReviewChecklist:m}]=await Promise.all([import("./build-JIKYOZUH.js"),import("./react-QWOAB3TB.js"),import("./ui-JEJGTURD.js")]),w=p.default??p;return new Promise(y=>{let t=s(w.createElement(m,{items:r.map(x=>{let g=n.get(x.temp_ref);return{uc:x,dedupWith:g&&!g.archived?g.cid:void 0,archivedMatch:g?.archived?{cid:g.cid,reason:g.reason}:void 0}}),onSubmit:x=>{t.unmount(),y(x)}}))})}async function ee(r){let{createInterface:n}=await import("readline/promises"),s=n({input:process.stdin,output:process.stdout});try{let p=await s.question(`${r} [y/N] `);return/^y(es)?$/i.test(p.trim())}finally{s.close()}}async function de(r){let n=C(process.cwd()),s=N({verb:"extract",mode:r.plan?"cli":"interactive",contextRoot:n,env:M(),resumeSid:r.resume,write:!0,longSession:!0}),m={...await $(),...s.spawnEnv()},w=await Q(m);if(!w.ok)return process.stderr.write((w.message??"error: turn-endpoint preflight failed")+`
3
- `),process.stderr.write(s.supportFooter()+`
4
- `),s.error("preflight_auth"),await s.end({exit_code:2}),2;let y=async()=>w;if(r.plan){let i=await F(r,{contextDir:n,agent:P,preflightTurn:y,ask:X,review:Z,confirmStale:ee,out:u=>process.stdout.write(u+`
5
- `),progress:u=>process.stderr.write(u+`
6
- `),isTTY:U(),auth:m,telemetry:s});return i===1&&process.stderr.write(s.supportFooter()+`
7
- `),await s.end({exit_code:i}),i}let[{render:t},x,{ScrollbackProvider:g},{ChatSurface:c},{ScrollbackTap:E},{makeChatController:V},{setInkExit:T},G]=await Promise.all([import("./build-JIKYOZUH.js"),import("./react-QWOAB3TB.js"),import("./scrollback-JLPJR25X.js"),import("./ChatSurface-U37VZDCW.js"),import("./ScrollbackTap-Q3IOKNMS.js"),import("./chat-controller-T2FAI55V.js"),import("./exit-manager-3FVBTNYR.js"),Promise.all([import("./chat-committer-ZWWCLJFD.js"),import("./descriptor-OEUZZCOK.js"),import("./explain-UAAQWHYR.js"),import("./readmodel-XOYGGQ3S.js")])]),[{commitChatTurn:S},{topologyDescriptor:e},{explain:a},{openGraph:v}]=G,_=x.default??x,d=V({commitChatTurn:S,descriptor:e(),contextDir:n,refreshGraph:()=>v(n),graph:v(n),explain:a,by:{kind:"human",id:"owner"},dedupFlags:i=>Y(i,v(n))}),j={current:null},H=0,I=null,D=!1,z=()=>{if(H+=1,H>=2){try{A.unmount()}catch{}process.exit(130)}d.requestPause(),I=setTimeout(()=>{D||(D=!0,(async()=>{d.ledger({kind:"interrupted",detail:"the agent did not confirm the pause within 5s"}),await j.current?.flush();try{A.unmount()}catch{}process.exit(130)})())},5e3)},O=await import("./dossier-KTLTGT2X.js"),B=i=>{try{return O.buildDossier(v(n),i)}catch{return null}},L={listUcs:()=>{let i=v(n),u=new Set(d.state.turns.flatMap(o=>(o.items??[]).map(l=>l.title.toLowerCase()))),f={high:0,med:1,low:2};return i.byLabel("usecase").filter(o=>!i.superseded.has(o.cid)).map((o,l)=>{let h=o.content,b=String(h.title??o.cid.slice(0,12)),k=q(i,o.cid),R=k?k.designed_at_cid===o.cid?"current":"stale":void 0;return{key:o.cid,title:b,badge:R==="current"?"designed":R==="stale"?"designed \xB7 stale":u.has(b.toLowerCase())?"drafted this session":"existing",designed:R,risk:h.risk,i:l}}).sort((o,l)=>(f[o.risk??"zz"]??3)-(f[l.risk??"zz"]??3)||o.i-l.i).map(({key:o,title:l,badge:h,designed:b})=>({key:o,title:l,badge:h,designed:b}))},runDesignChild:async(i,u=!1)=>{try{let{designEntryCheck:h,confirmUnreviewedViaAsk:b}=await import("./trust-gate-EX7R2P4Y.js"),k=h(v(n),i);if(!k.ok&&(k.code==="UC_UNREVIEWED"||k.code==="UC_ARCHIVED")&&!await b(K=>d.ask(K),k))return d.note(`design child refused \u2014 approve it first: ${k.reviewCmd}`),2}catch{}let[{runDesign:f}]=await Promise.all([import("./run-2COODVX2.js")]),o="",l=await f({useCase:i,force:u,mode:"interactive"},{contextDir:n,agent:P,preflightTurn:y,ask:h=>d.ask(h),chat:d,nested:!0,out:h=>{o=h},progress:()=>{},isTTY:!0,auth:m});return l!==0&&o&&d.note(o),l}},{makeReconcileDeps:W}=await import("./reconcile-deps-XIH75ZLY.js"),J=W({contextDir:n,...r.changeContext?{changeContext:r.changeContext}:{},note:i=>d.note(i)}),A=t(_.createElement(g,null,_.createElement(E,{into:j}),_.createElement(c,{controller:d,verb:"extract",onCtrlC:z,chain:L,inspect:B,reconcile:J})),{exitOnCtrlC:!1});T(()=>A.unmount()),d.ledger({kind:"banner",text:"kane-cli context \xB7 extract \xB7 interactive"});try{let i=F(r,{contextDir:n,agent:P,preflightTurn:y,ask:f=>d.ask(f),review:async f=>new Map(f.map(o=>[o.temp_ref,{resolution:"skipped"}])),confirmStale:async()=>!0,out:f=>d.note(f),progress:()=>{},isTTY:U(),auth:m,chat:d,telemetry:s});i.finally(()=>{D=!0});let u=await i;return u===1&&process.stderr.write(s.supportFooter()+`
8
- `),await s.end({exit_code:u}),u}finally{D=!0,I&&clearTimeout(I),await j.current?.flush();try{A.unmount()}catch{}}}async function ue(r){let n=N({verb:"extract",mode:r.mode,contextRoot:C(process.cwd()),env:M(),resumeSid:r.resume,write:!0,longSession:!0}),{makeHeadlessIO:s,resolveEncoding:p,guardedChannels:m}=await import("./headless-io-66RG5NN5.js"),{withStructuredNext:w,prepareStructuredResume:y}=await import("./structured-answers-5EY2AZN7.js"),t=w(s(p(r.mode),"extract")),{runWithChannel:x}=await import("./run-channel-RGH4WIQX.js"),g=p(r.mode)==="ndjson"?e=>x({event:a=>t.event(a)},e):e=>e();for(let e of r.landed??[]){let a=e;t.event({type:"ingested",source_id:e.source_id,status:e.status,cid:e.source_cid,...a.warnings?.length?{warnings:a.warnings}:{},...a.media?{media:a.media}:{},...a.duplicate_of?{duplicate_of:a.duplicate_of}:{},...a.lineage_candidate?{lineage_candidate:a.lineage_candidate}:{}})}let c;try{c=y({opts:r,contextDir:C(process.cwd()),verb:"extract"})}catch(e){let a=e instanceof Error?e.message:String(e);return t.out(`error: ${a}`),r.mode==="agent"&&t.event({type:"error",message:a}),await n.end({exit_code:1}),r.mode==="agent"?t.done(1,"error"):1}if(c.kind==="refuse")return t.out(c.error),r.mode==="agent"&&t.event({type:"error",message:c.error,code:c.code}),await n.end({exit_code:2}),r.mode==="agent"?t.done(2,"refused"):2;let E=r;if(c.kind==="apply"){for(let e of c.notes)t.out(e);if(c.matchedQids.length>0){t.out(`applying ${c.matchedQids.length} structured answer(s) from --answer to the paused session's pending questions`);for(let e of c.matchedQids)t.event({type:"panel_resolved",id:e,by:"user",via:"flag"})}c.statement&&(E={...r,message:[r.message,c.statement].filter(Boolean).join(`
9
-
10
- `)})}let{makeInterruptGuard:V}=await import("./interrupt-guard-UREUWNRL.js"),T=V(P,e=>t.out(e)),S=m(t,()=>T.interrupted(),/^error: (agent failed|repair run failed|agent ended)/);try{let e=await g(async()=>{let a={...await $(),...n.spawnEnv()};return F(E,{contextDir:C(process.cwd()),agent:T.agent,preflightTurn:()=>Q(a),ask:async()=>[],review:async v=>new Map(v.map(_=>[_.temp_ref,{resolution:"skipped"}])),confirmStale:async()=>!1,out:S.out,emit:S.emit,progress:t.progress,isTTY:!1,auth:a,telemetry:n})});return T.interrupted()&&e!==3?(t.out("interrupted \u2014 no session saved"),await n.end({exit_code:130}),t.done(130)):(e===1&&t.out(n.supportFooter()),await n.end({exit_code:e}),t.done(e))}catch(e){return t.event({type:"error",message:`error: extract failed: ${e instanceof Error?e.message:String(e)}`}),t.out(`error: extract failed: ${e instanceof Error?e.message:String(e)}`),t.out('hint: the full trace is in the file named on the "trace:" line at the start of this run'),t.done(1)}finally{T.dispose()}}export{ue as bindExtractHeadless,de as bindExtractInteractive};
@@ -1,3 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as ie,b as ce}from"./chunk-IOD3HQVW.js";import{a as R,b as H,d as ae}from"./chunk-OS4VSIHT.js";import"./chunk-5DT7PIGB.js";import{a as ee,b as te,c as ne,d as se,e as re,f as oe}from"./chunk-5DBK6QNS.js";import{e as X,f as J}from"./chunk-CJJXT5DO.js";import{a as C,b as Z,c as F,d as q}from"./chunk-XWKUZJCP.js";import"./chunk-ZPDM6FO7.js";import{e as Q}from"./chunk-EHN5HTUD.js";import"./chunk-CH273NAE.js";import{a as W}from"./chunk-L5LI2JF4.js";import{A as K}from"./chunk-TH47OOBV.js";import"./chunk-VAYBKR76.js";import"./chunk-CUM23TLF.js";import"./chunk-DUAXZYAD.js";import"./chunk-DBIBROYW.js";import{d as G,e as M}from"./chunk-WXHQYYD5.js";import"./chunk-IAHKTEET.js";import"./chunk-UD7KKHPW.js";import"./chunk-UR6MHSHU.js";import{basename as B}from"path";import{statSync as Se}from"fs";function ye(e,t){return e.length===0?"not_run":ne(e,t).verified?"proven":te(e,t).some(n=>n.verdict==="failed")?"failing":"blocked"}function le(e,t){let s=null;for(let{cid:f}of e.byLabel(G.TEST))for(let o of e.execHistory(f))(!s||String(o.started_at)>s.started_at)&&(s={execution_id:String(o.execution_id),started_at:String(o.started_at)});if(!s)return null;let n=ee[t],r=oe(e),c=se(r).aspects[t],i={},d={},l=0,g=0,a=0;for(let f of r.usecases){let o=[];for(let b of f.acceptance_criteria){let u=b.executions??[],_=ye(u,n);o.push(_),_==="failing"?l++:_==="blocked"?g++:_==="not_run"&&a++;let S=[],k;if(_==="failing"){let w=null;for(let O of b.covered_by){let T=e.execHistory(O).map($=>({verdict:String($.per_ac?.find(y=>y.ac_ref===b.id)?.verdict??$.verdict),oracle_mode:String($.oracle_mode),ts:String($.started_at),execution_id:String($.execution_id)})).filter($=>n.counted_verdicts.includes($.verdict)&&n.accepted_oracle_modes.includes($.oracle_mode)),I=T[T.length-1];I?.verdict==="failed"&&(S.push(O),(!w||I.ts>w.ts)&&(w={ts:I.ts,execution_id:I.execution_id}))}k=w?.execution_id}else _==="blocked"&&(k=u[u.length-1]?.execution_id);i[b.id]={state:_,viaTests:S,...k?{executionId:k}:{}}}let m=o.some(b=>b!=="not_run"),p=c.usecases[f.id],v=m?p.status==="covered"?"proven":p.status==="partial"?"partial":o.includes("failing")?"failing":o.includes("blocked")?"blocked":"not_run":"not_run";d[f.id]={pct:p.pct,status:v}}return{aspect:t,pct:c.summary.coverage_pct,acs_proven:c.summary.acs_verified,failing:l,blocked:g,not_run:a,latest_run:s,perUc:d,perAc:i,config:{...n,source:"graph_execution_facts",denominator:"current_live_acs"}}}var be=["failing","blocked","needs-refresh","needs-tests","needs-scenarios","happy-only","possible-duplicate","not-yet-run"],_e={failing:"failing",blocked:"blocked","needs-refresh":"needs refresh","needs-tests":"needs tests","needs-scenarios":"needs scenarios","happy-only":"happy path only","possible-duplicate":"possible duplicate","not-yet-run":"not yet run"},E={high:0,med:1,low:2};function Y(e,t){let s=/^(.*?)(\d+)$/.exec(e),n=/^(.*?)(\d+)$/.exec(t);return s&&n&&s[1]===n[1]?Number(s[2])-Number(n[2]):e<t?-1:e>t?1:0}function D(e){if(!e||/^sha256:/.test(e))return"(unnamed)";let t=/^(uc|ac|sc|t)-(\d+)$/.exec(e);return t?`${t[1].toUpperCase()}-${t[2]}`:e}function fe(e,t=5){let s=e.trim().split(/\s+/);return s.slice(0,t).join(" ")+(s.length>t?"\u2026":"")}function ke(e,t){let s=e.resolve(t),n=s?e.getNode(e.tipOf(s.cid))?.content:null;return String(n?.title??n?.text??"")}function ue(e,t){let s=e.resolve(t);return{id:s?e.displayNameOf(e.tipOf(s.cid))??e.displayNameOf(s.cid):null,title:fe(ke(e,t),8)}}function $e(e,t){let s=e.resolve(t);if(!s)return null;let n=e.tipOf(s.cid);if(!C(e,n))return null;let r=e.nodeLabel.get(n);if(r===G.USECASE)return n;if(r===G.AC)return F(e,n);if(r===G.TEST){let c=e.edgesFrom(n).find(d=>d.type===M.VERIFIES&&C(e,d.dst));if(c)return F(e,c.dst);let i=e.edgesFrom(n).find(d=>d.type===M.AUTOMATES&&C(e,d.dst));if(i){let d=e.edgesFrom(i.dst).find(l=>l.type===M.BELONGS_TO&&C(e,l.dst));return d?d.dst:null}}return null}function j(e){if(e.tag==="reuse-candidate"&&e.stage==="design")return"possible-duplicate";switch(e.kind){case"no-verifies":return"needs-tests";case"zero-scenario":return"needs-scenarios";case"happy-only":return"happy-only";case"stale-ac":case"stale-test":return"needs-refresh";case"execution-failed":return"failing";case"execution-blocked":return"blocked";case"covered-not-run":return"not-yet-run";default:return"other"}}function xe(e,t){let s=e.resolve(t),n=s?e.getNode(e.tipOf(s.cid))?.content.risk:null;return n==="high"||n==="med"||n==="low"?n:"med"}function ge(e,t,s,n,r){let c=r.servePaths??new Map,i=e.byLabel(G.USECASE).filter(({cid:o})=>C(e,o)),d=new Map(i.map(o=>[o.cid,o])),l=new Map(i.map(({cid:o})=>[o,[]])),g=[];for(let o of t){if(o.stage!=="design")continue;let m={...o,...ue(e,o.ref)},p=$e(e,o.ref),v=p?l.get(p):void 0;v&&j(o)!=="other"?v.push(m):g.push(m)}let a=new Map(i.map(({cid:o})=>[o,{total:0,designed:0}]));for(let{cid:o}of e.byLabel(G.AC)){if(!C(e,o))continue;let m=F(e,o),p=m?a.get(m):void 0;if(!p)continue;p.total++;let v=Z(e,o);if(v&&p.designed++,!n)continue;let b=e.nameOf.get(o)??o,u=n.perAc[b];if(!u)continue;let{id:_,title:S}=ue(e,b),k={ref:e.displayNameOf(o)??o,id:_,title:S,risk:xe(e,b),stage:"cover"},w=l.get(m);u.state==="failing"?w.push({...k,kind:"execution-failed",tag:"evolve",why:"covering test failed against this AC",ready_command:u.executionId&&c.has(u.executionId)?`kane-cli evidence serve ${c.get(u.executionId)}`:"kane-cli testrun run",via_tests:u.viaTests,...u.executionId?{execution_id:u.executionId}:{},...u.executionId&&c.has(u.executionId)?{servePath:c.get(u.executionId)}:{},...r.testFiles?{viaFiles:u.viaTests.map(O=>r.testFiles.get(O)??null)}:{}}):u.state==="blocked"?w.push({...k,kind:"execution-blocked",tag:"reuse-candidate",why:"the formula could count no run \u2014 broken/skipped or an unaccepted oracle",ready_command:u.executionId&&c.has(u.executionId)?`kane-cli evidence serve ${c.get(u.executionId)}`:"kane-cli testrun run",...u.executionId?{execution_id:u.executionId}:{},...u.executionId&&c.has(u.executionId)?{servePath:c.get(u.executionId)}:{}}):u.state==="not_run"&&v&&w.push({...k,kind:"covered-not-run",tag:"reuse-candidate",why:"a covering test exists but has not run yet",ready_command:"kane-cli testrun run"})}let f=[];for(let{cid:o,content:m}of i){let p=e.displayNameOf(o)??o,v=e.nameOf.get(o)??o,b=s.perUc[p]??{pct:0,status:"undesigned",staleAcs:0},u=n?n.perUc[v]??{pct:0,status:"not_run"}:null,_=n!==null&&(u===null||u.status==="not_run"),S=a.get(o),k=l.get(o)??[],w=new Set(k.filter(h=>j(h)==="needs-refresh").map(h=>h.ref)),O=k.some(h=>j(h)==="needs-tests"&&w.has(h.ref)),T=[];for(let h of be){let A=k.filter(P=>j(P)===h);if(h==="needs-tests"&&(A=A.filter(P=>!w.has(P.ref))),A.length===0)continue;A.sort((P,V)=>(E[P.risk]??3)-(E[V.risk]??3)||Y(P.ref,V.ref));let ve=h==="failing"||h==="blocked"||A.length<=2||new Set(A.map(P=>P.ready_command)).size>1;T.push({key:h,label:_e[h],...h==="needs-refresh"?{suffix:"source moved since these were designed"}:{},alsoNeedsTests:h==="needs-refresh"&&O,rows:A,...ve?{}:{rosterCommand:A[0].ready_command}})}let I=T.some(h=>h.key==="failing"),$=T.some(h=>h.key==="blocked"),y=b.pct===100&&(n===null||u?.pct===100)&&T.length===0,U=u!==null&&u.pct>0,x=I?"\u2717":$?"\u23F8":y?"\u2714":b.pct===0&&!U?"\u2716":"\u25D0";f.push({slug:p,title:String(m.title??""),risk:String(m.risk??""),des:b,prov:u,provAbsent:_,acTotal:S.total,acDesigned:S.designed,mark:x,collapse:y,groups:T})}return f.sort((o,m)=>(E[o.risk]??3)-(E[m.risk]??3)||Y(o.slug,m.slug)),g.sort((o,m)=>(E[o.risk]??3)-(E[m.risk]??3)||Y(o.ref,m.ref)),{stage:r.stage,aspect:r.aspect,top:r.top,dc:s,pa:n,ucs:f,other:g}}function N(e,t){let s=Math.round(e/100*t);return"\u2588".repeat(s)+"\u2591".repeat(t-s)}function z(e){return e===100?"\u2714":e>0?"\u25D0":"\u2716"}function L(e,t){return e==="all"||t.stage===e}function me(e,t){let{dc:s,pa:n}=e,r=Math.max(80,Math.min(t.width,120)),c=l=>t.color?`\x1B[2m${l}\x1B[22m`:l,i=[];if(n){i.push(`coverage \u2014 designed \xD7 proven \xB7 live graph \xB7 aspect ${n.aspect}`),i.push("");let l=s.ucs_needing_scenarios;i.push(` designed ${z(s.pct)} ${N(s.pct,10)} ${String(s.pct).padStart(3)}% \u2014 ${s.acs_designed} ACs have verifying tests`+(l>0?` \xB7 scenario debt: ${l} UC${l>1?"s":""}`:""));let g=[n.failing>0?`${n.failing} failing`:null,n.blocked>0?`${n.blocked} blocked`:null,n.not_run>0?`${n.not_run} not yet run`:null].filter(Boolean);i.push(` proven ${z(n.pct)} ${N(n.pct,10)} ${String(n.pct).padStart(3)}% \u2014 ${n.acs_proven} proven by execution`+(g.length?` \xB7 ${g.join(" \xB7 ")}`:""))}else i.push("AC design completeness \u2014 live graph (what design owes; execution proof not shown)"),i.push(""),i.push(` designed ${z(s.pct)} ${N(s.pct,10)} ${String(s.pct).padStart(3)}% \u2014 ${s.acs_designed} ACs have verifying tests \xB7 ${s.usecases_complete} UCs complete`),s.ucs_needing_scenarios>0&&i.push(` scenario debt: ${s.ucs_needing_scenarios} use-case${s.ucs_needing_scenarios>1?"s":""} need scenarios`),i.push(" proven \u2014 no runs recorded yet \xB7 run tests, then re-run");i.push("");let d=!1;for(let l of e.ucs){if(i.push(we(l,n!==null,r)),l.collapse)continue;let g=e.top??1/0;for(let a of l.groups){let f=a.rows.filter(v=>L(e.stage,v));if(f.length===0)continue;if(d=!0,g<=0){i.push(c(` \u2026 +${f.length} more ${a.label}`));continue}let o=f.slice(0,g),m=f.length-o.length;if(g-=o.length,(a.key==="needs-scenarios"||a.key==="happy-only")&&o.length===1&&o[0].ref===l.slug){i.push(` ${a.label}${a.key==="needs-scenarios"?" \u2014 design from scratch":""}`),i.push(c(` \u2192 ${o[0].ready_command}`));continue}let p=(a.suffix?` \u2014 ${a.suffix}`:"")+(a.alsoNeedsTests?" \u2014 also needs tests":"");if(i.push(` ${a.label} (${f.length})${p}`),a.rosterCommand&&a.key!=="failing"&&a.key!=="blocked")Re(i,o,r),i.push(c(` \u2192 ${a.rosterCommand}`));else for(let v of o)Te(i,v,a.key,c);m>0&&i.push(c(` \u2026 +${m} more ${a.label}`))}}return!d&&e.ucs.every(l=>l.groups.every(g=>g.rows.filter(a=>L(e.stage,a)).length===0))&&i.push(" nothing owed \u2014 design and execution are square"),i.push(""),i.push(c(" metric: live verifies edges \xB7 high \xD73 \xB7 staleness shown, not discounted")),n?i.push(c(` proven: graph execution facts \xB7 latest run ${n.latest_run?.started_at??"\u2014"} \xB7 ${n.aspect} formula verbatim`)):i.push(c(" proof: no runs recorded yet \u2014 run tests, then re-run")),i}function we(e,t,s){let n=D(e.slug);if(!t){let l=e.acTotal===0?"no scenarios yet":e.collapse||e.des.status==="complete"?`${e.acTotal} ACs \xB7 complete`:e.des.staleAcs>0?`${e.acTotal} ACs \xB7 ${e.des.staleAcs} stale`:`${e.acTotal} ACs \xB7 ${e.acTotal-e.acDesigned} unverified`,g=` ${e.mark} ${N(e.des.pct,10)} ${String(e.des.pct).padStart(3)}% ${n} `,a=Math.max(0,s-g.length-l.length-2);return`${g}${de(e.title,a).padEnd(a)} ${l}`}let r=e.provAbsent?"prov \xB7 not run":`prov ${N(e.prov?.pct??0,8)} ${String(e.prov?.pct??0).padStart(3)}%`,c=`des ${N(e.des.pct,8)} ${String(e.des.pct).padStart(3)}% \xB7 ${r}`,i=` ${e.mark} ${n} `,d=Math.max(0,s-i.length-c.length-2);return`${i}${de(e.title,d).padEnd(d)} ${c}`}function de(e,t){return e.length<=t?e:t<=1?e.slice(0,t):e.slice(0,t-1)+"\u2026"}function Te(e,t,s,n){let r=D(t.id??t.ref);if(s==="failing"){let c=(t.via_tests??[]).map((d,l)=>`${D(d)}${t.viaFiles?.[l]?` ${t.viaFiles[l]}`:""}`).join(", ");e.push(` \u2717 ${r} ${t.title} \u2014 failed${c?` \xB7 via ${c}`:""}`),t.servePath&&e.push(n(` \u2192 kane-cli evidence serve ${t.servePath} (see why it failed)`));let i=(t.viaFiles??[]).filter(d=>d!==null);i.length===1?e.push(n(` re-run after fixing: kane-cli testmd run ${i[0]} (heals on failure \u2014 fix the app first, or the test may re-author)`)):i.length>1&&e.push(n(" re-run after fixing: kane-cli testrun run (heals on failure \u2014 fix the app first, or the tests may re-author)"));return}if(s==="blocked"){e.push(` \u23F8 ${r} ${t.title} \u2014 (blocked \u2014 see why)`),t.servePath&&e.push(n(` \u2192 kane-cli evidence serve ${t.servePath} (see why)`));return}e.push(` ${r} ${t.title} \u2014 ${t.why}`),e.push(n(` \u2192 ${t.ready_command}`))}function Re(e,t,s){let n=t.map(c=>`${D(c.id??c.ref)} ${fe(c.title,4)}`),r=" ";for(let c of n){let i=r.trim().length?" \xB7 ":"";r.length+i.length+c.length>s&&r.trim().length?(e.push(r),r=" "+c):r+=i+c}r.trim().length&&e.push(r)}function he(e){let{dc:t,pa:s}=e,n=r=>e.top!==void 0?r.slice(0,e.top):r;return{stage:e.stage,rollup_version:1,design_completeness:{pct:t.pct,acs_designed:t.acs_designed,usecases_complete:t.usecases_complete,ucs_needing_scenarios:t.ucs_needing_scenarios,config:t.config},...s?{proven:{aspect:s.aspect,pct:s.pct,acs_proven:s.acs_proven,failing:s.failing,blocked:s.blocked,not_run:s.not_run,latest_run:s.latest_run,config:s.config}}:{},usecases:e.ucs.map(r=>({id:/^sha256:/.test(r.slug)?null:r.slug,title:r.title,risk:r.risk,design_completeness:{pct:r.des.pct,status:r.des.status},stale_acs:r.des.staleAcs,...s?{proven:r.prov??{pct:0,status:"not_run"}}:{},pending:n(r.groups.flatMap(c=>c.rows).filter(c=>L(e.stage,c))).map(pe)})),other:e.other.filter(r=>L(e.stage,r)).map(pe)}}function pe(e){let{servePath:t,viaFiles:s,meta:n,...r}=e;return{...r}}async function Ae(e){let t=await X(e);return t.length===0?null:t.map(s=>({p:s,m:Se(s).mtimeMs})).sort((s,n)=>n.m-s.m)[0].p}async function Oe(e,t=ae(),s=process.cwd()){if(e.mode!==void 0&&e.mode!=="agent"&&e.mode!=="ci"&&e.mode!=="interactive")return R(t,`--mode must be interactive | agent | ci, got '${e.mode}'`),2;if(e.mode==="agent"||e.mode==="ci"){let{makeHeadlessIO:p,agentRefusal:v}=await import("./headless-io-66RG5NN5.js"),{parsesAgainstGrammar:b}=await import("./next-TRSKMBO5.js"),u=p("ndjson","gaps",{stdout:y=>t.out(y.replace(/\n$/,"")),stderr:y=>(t.err??t.out)(y.replace(/\n$/,""))}),_=[],S=[],k={out:y=>_.push(y),err:y=>S.push(y),confirm:async()=>!1,isTTY:!1};if(await Oe({...e,json:!0,mode:void 0},k,s)!==0)return v(u,S.join("; ")||"cover gaps refused");let O=JSON.parse(_.join(`
3
- `));u.event({type:"gaps",...O});let T=[],I=new Set,$=(y,U)=>{if(Array.isArray(y)){for(let x of y)$(x,U);return}if(y&&typeof y=="object"){let x=y,h=typeof x.why=="string"?x.why:U;typeof x.ready_command=="string"&&x.ready_command.startsWith("kane-cli ")&&b(x.ready_command)&&!I.has(x.ready_command)&&(I.add(x.ready_command),T.push({cmd:x.ready_command,why:h||"close the gap"}));for(let A of Object.values(x))$(A,h)}};return $(O,"close the gap"),u.done(0,void 0,T.slice(0,4))}if(e.flat)return Ie(e,t,s);let n=e.stage??"all";if(n!=="design"&&n!=="cover"&&n!=="all")return R(t,`--stage must be design | cover | all, got '${n}'`),2;if(e.top!==void 0&&(!Number.isInteger(e.top)||e.top<1))return R(t,"--top must be a positive integer"),2;let r=e.aspect??"lenient";if(r!=="lenient"&&r!=="strict")return R(t,`--aspect must be lenient | strict, got '${r}'`),2;if(e.from)return R(t,"the tree reads the live graph \u2014 for a specific run's view use: kane-cli cover --from <pack> (legacy worklist: add --flat)"),2;let c=H(s,t);if(!c)return 2;let i=K(c),d=re(i),l=le(i,r),g=await q(i,"design"),a=new Map;if(l)for(let p of Object.values(l.perAc)){if(!p.executionId||a.has(p.executionId))continue;let v=await J(p.executionId,s);v&&a.set(p.executionId,v)}let f=new Map;for(let[p,v]of ce(ie(s)))v.length===1&&f.set(p,B(v[0]));let o=ge(i,g,d,l,{stage:n,top:e.top,aspect:r,servePaths:a,testFiles:f});if(e.json)return t.out(JSON.stringify(he(o),null,2)),0;if(d.usecases_complete==="0/0")return t.out("nothing to measure yet \u2014 no live use-cases in the graph"),0;let m=t.isTTY&&process.stdout.columns?process.stdout.columns:100;for(let p of me(o,{width:m,color:t.isTTY}))t.out(p);return 0}async function Ie(e,t,s){let n=e.stage??"design";if(n!=="design"&&n!=="cover"&&n!=="all")return R(t,`--stage must be design | cover | all, got '${n}'`),2;if(e.top!==void 0&&(!Number.isInteger(e.top)||e.top<1))return R(t,"--top must be a positive integer"),2;let r=H(s,t);if(!r)return 2;let c,i;if(n!=="design"){let a=e.from?await J(e.from,s):await Ae(s);if(!a)return R(t,e.from?`no evidence pack at '${e.from}'`:`--stage ${n} needs an evidence pack \u2014 run a test first, or pass --from <pack> (live view: drop --flat)`),2;let f=await Q(a,"coverage/usecases.yaml");if(f==null)return R(t,`${B(a)} carries no coverage/usecases.yaml \u2014 re-run the tests to produce a coverage-bearing pack`),2;let o=W(f);if(!o||!Array.isArray(o.usecases))return R(t,`${B(a)}: coverage/usecases.yaml is not a usecases document`),2;c=o,i=B(a)}let d=K(r),l=await q(d,n,void 0,c),g=l.length;if(e.top!==void 0&&(l=l.slice(0,e.top)),e.json){let a=l.map(f=>Pe(d,f));return t.out(JSON.stringify({stage:n,...i?{pack:i}:{},total:g,rows:a},null,2)),0}return t.out(`gaps \u2014 stage ${n}${i?` \xB7 pack ${i}`:""} (${l.length}${l.length<g?` of ${g}`:""})`),l.length===0&&t.out(" nothing owed \u2014 design and execution are square"),l.forEach((a,f)=>{t.out(` ${String(f+1).padStart(2)}. [${a.risk}] ${a.tag} ${a.ref} \u2014 ${a.why}`),t.out(` \u2192 ${a.ready_command}`)}),0}function Pe(e,t){let s=e.resolve(t.ref),n=s?e.tipOf(s.cid):null,r=n?e.getNode(n)?.content:null;return{...t,id:n?e.displayNameOf(n)??e.displayNameOf(s.cid):null,title:String(r?.title??r?.text??"")}}export{Oe as gapsCommand};
@@ -1,2 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a,b,c}from"./chunk-65ZTD5SJ.js";import"./chunk-7BZSCUPP.js";import"./chunk-W4B5LOEX.js";import"./chunk-DNNZ353O.js";import"./chunk-R7QAS6LZ.js";import"./chunk-KRKGZ2ZW.js";import"./chunk-2UIHS2FH.js";import"./chunk-Q2F5QB2W.js";import"./chunk-BKHXPBWN.js";import"./chunk-N2P4MI32.js";import"./chunk-5DT7PIGB.js";import"./chunk-NVGBE2DR.js";import"./chunk-CH273NAE.js";import"./chunk-TH47OOBV.js";import"./chunk-VAYBKR76.js";import"./chunk-CUM23TLF.js";import"./chunk-DUAXZYAD.js";import"./chunk-DBIBROYW.js";import"./chunk-WXHQYYD5.js";import"./chunk-IAHKTEET.js";import"./chunk-UD7KKHPW.js";import"./chunk-MSGW4JDG.js";import"./chunk-27U4PLPX.js";import"./chunk-UR6MHSHU.js";export{c as ingestCommand,b as runIngestCommand,a as runIngestWithResults};
@@ -1,25 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as T}from"./chunk-MXHHMIO2.js";import"./chunk-KHU7C6EE.js";import"./chunk-IOD3HQVW.js";import"./chunk-3Q6WAK6P.js";import"./chunk-AFPHLUQ5.js";import"./chunk-KU6IXFGZ.js";import"./chunk-ZGBSGZZM.js";import"./chunk-65ZTD5SJ.js";import"./chunk-BRHNRCEZ.js";import"./chunk-BB2W35TW.js";import"./chunk-VGFTNLQQ.js";import"./chunk-L2TV4G56.js";import"./chunk-JFAFKHDX.js";import"./chunk-6KPPGMO2.js";import"./chunk-7BZSCUPP.js";import"./chunk-GFKCTYCA.js";import"./chunk-YKTYVJBN.js";import"./chunk-IMR64OCZ.js";import"./chunk-427OQS2N.js";import"./chunk-JZ26R6UL.js";import"./chunk-W4B5LOEX.js";import"./chunk-DNNZ353O.js";import"./chunk-R7QAS6LZ.js";import"./chunk-KRKGZ2ZW.js";import"./chunk-2UIHS2FH.js";import"./chunk-Q2F5QB2W.js";import"./chunk-BKHXPBWN.js";import"./chunk-N2P4MI32.js";import"./chunk-SDPRO2LE.js";import{c as P}from"./chunk-5DT7PIGB.js";import"./chunk-ZPDM6FO7.js";import"./chunk-NVGBE2DR.js";import{a as $}from"./chunk-CH273NAE.js";import"./chunk-L5LI2JF4.js";import{a as R,b as A}from"./chunk-IP2O264K.js";import"./chunk-R5T4RLF5.js";import"./chunk-IDX3TOPY.js";import"./chunk-BKM2LWU2.js";import"./chunk-TH47OOBV.js";import"./chunk-VAYBKR76.js";import"./chunk-CUM23TLF.js";import"./chunk-DUAXZYAD.js";import"./chunk-DBIBROYW.js";import"./chunk-WXHQYYD5.js";import"./chunk-IAHKTEET.js";import"./chunk-UD7KKHPW.js";import"./chunk-KBM3XHAM.js";import"./chunk-2YEHV2CX.js";import"./chunk-MSGW4JDG.js";import"./chunk-56PAQAX5.js";import"./chunk-5EOX4MEY.js";import"./chunk-RZ4F3BHX.js";import"./chunk-27U4PLPX.js";import"./chunk-UR6MHSHU.js";async function J(e){let[{render:o},t,{QuestionBatchPrompt:r}]=await Promise.all([import("./build-JIKYOZUH.js"),import("./react-QWOAB3TB.js"),import("./ui-JEJGTURD.js")]),u=t.default??t;return new Promise(s=>{let g=o(u.createElement(r,{questions:e,onSubmit:m=>{g.unmount(),s(m)}}))})}async function S(e){let{createInterface:o}=await import("readline/promises"),t=o({input:process.stdin,output:process.stdout});try{return/^y(es)?$/i.test((await t.question(`${e} [y/N] `)).trim())}finally{t.close()}}async function K(e){let{createInterface:o}=await import("readline/promises"),t=o({input:process.stdin,output:process.stdout});try{process.stdout.write(`${e.message}
3
- `),process.stdout.write(` 1. start at ${e.earliest} instead \u2014 the earliest uncommitted phase (recommended)
4
- `),process.stdout.write(` 2. proceed anyway \u2014 noted on the record
5
- `),process.stdout.write(` 3. cancel
6
- `);let r=(await t.question("pick [1-3, \u23CE = 1] ")).trim();return r===""||r==="1"?"earliest":r==="2"?"proceed":"cancel"}finally{t.close()}}async function I(e){let{createInterface:o}=await import("readline/promises"),t=o({input:process.stdin,output:process.stdout});try{if(process.stdout.write(`${e.message}
7
- `),e.wall==="already-designed"){process.stdout.write(` 1. view the existing design (recommended)
8
- `),process.stdout.write(` 2. redesign \u2014 asks a reason; ${e.impactPairs} live pair(s) superseded
9
- `),process.stdout.write(` 3. pick another use-case
10
- `);let u=(await t.question("pick [1-3, \u23CE = 1] ")).trim();return u===""||u==="1"?{pick:"view"}:u==="2"?{pick:"redesign",because:(await t.question("because (reason for the redesign): ")).trim()}:{pick:"back"}}process.stdout.write(` 1. refresh first \u2014 evolve re-designs against the moved use-case (recommended)
11
- `),process.stdout.write(` 2. proceed anyway \u2014 asks a reason, noted on the record
12
- `),process.stdout.write(` 3. back
13
- `);let r=(await t.question("pick [1-3, \u23CE = 1] ")).trim();return r===""||r==="1"?{pick:"refresh"}:r==="2"?{pick:"proceed",because:(await t.question("because (reason for proceeding): ")).trim()}:{pick:"back"}}finally{t.close()}}async function Z(e){let[{resolveAgentAuthEnv:o},{runAgent:t},{preflightTurn:r}]=await Promise.all([import("./spawner-J67QR4QP.js"),import("./bridge-5Z3BIB77.js"),import("./turn-preflight-JGYT7LXP.js")]),u=await o(),s=$(process.cwd()),{baseUrlAdvisory:g}=await import("./turn-preflight-JGYT7LXP.js"),m=g();m&&process.stderr.write(m+`
14
- `);let i=A({verb:"design",mode:e.plan?"cli":"interactive",contextRoot:s,env:R(),resumeSid:e.resume,write:!0,longSession:!0}),h={...u,...i.spawnEnv()},k=await r(h);if(!k.ok)return process.stderr.write((k.message??"error: turn-endpoint preflight failed")+`
15
- `),process.stderr.write(i.supportFooter()+`
16
- `),i.error("preflight_auth"),await i.end({exit_code:2}),2;let C=async()=>k;if(e.plan){let n=await T({...e,confirmRetarget:S,askPhaseEntry:K,askDesignEntry:I},{contextDir:s,agent:t,preflightTurn:C,ask:J,out:a=>process.stdout.write(a+`
17
- `),progress:a=>process.stderr.write(a+`
18
- `),isTTY:P(),auth:h,telemetry:i});return n===1&&process.stderr.write(i.supportFooter()+`
19
- `),await i.end({exit_code:n}),n}if(!e.resume&&e.useCase&&!e.phase){let[{openGraph:n},{designGate:a}]=await Promise.all([import("./readmodel-XOYGGQ3S.js"),import("./gate-54BRAE7N.js")]),p=n(s),c=a(p,e.useCase,!!e.force);if(!c.ok)if(c.wall){let{captureForceScope:H}=await import("./design-committer-VYT6NU3T.js"),d=await I({wall:c.wall.kind,message:c.message,display:c.wall.display,impactPairs:H(p,e.useCase).length});if(d.pick==="redesign"||d.pick==="proceed"){if(!d.because.trim())return process.stderr.write(`a redesign needs a reason (--because) \u2014 nothing executed
20
- `),2;e={...e,force:!0,because:e.because??d.because.trim()}}else return d.pick==="view"?(process.stdout.write(`view the existing design: kane-cli context view ${c.wall.display}
21
- `),0):d.pick==="refresh"?(process.stdout.write(`refresh it first: kane-cli maintain evolve ${c.wall.display}
22
- `),0):(process.stdout.write(`nothing executed \u2014 list use-cases: kane-cli context list
23
- `),0)}else return process.stderr.write(`design: ${c.message}
24
- `),c.code}let[{render:F},D,{ScrollbackProvider:q},{ChatSurface:G},{ScrollbackTap:N},{makeChatController:V},{setInkExit:_},j]=await Promise.all([import("./build-JIKYOZUH.js"),import("./react-QWOAB3TB.js"),import("./scrollback-JLPJR25X.js"),import("./ChatSurface-U37VZDCW.js"),import("./ScrollbackTap-Q3IOKNMS.js"),import("./chat-controller-T2FAI55V.js"),import("./exit-manager-3FVBTNYR.js"),Promise.all([import("./chat-committer-ZWWCLJFD.js"),import("./descriptor-OEUZZCOK.js"),import("./explain-UAAQWHYR.js"),import("./readmodel-XOYGGQ3S.js")])]),[{commitChatTurn:B},{topologyDescriptor:O},{explain:Q},{openGraph:y}]=j,b=D.default??D,l=V({commitChatTurn:B,descriptor:O("design"),contextDir:s,refreshGraph:()=>y(s),graph:y(s),explain:Q,by:{kind:"human",id:"owner"}}),{buildDossier:Y}=await import("./dossier-KTLTGT2X.js"),U=n=>{try{return Y(y(s),n)}catch{return null}},v={current:null},E=0,x=null,w=!1,z=()=>{if(E+=1,E>=2){try{f.unmount()}catch{}process.exit(130)}l.requestPause(),x=setTimeout(()=>{w||(w=!0,(async()=>{l.ledger({kind:"interrupted",detail:"the agent did not confirm the pause within 5s"}),await v.current?.flush();try{f.unmount()}catch{}process.exit(130)})())},5e3)},f=F(b.createElement(q,null,b.createElement(N,{into:v}),b.createElement(G,{controller:l,verb:"design",onCtrlC:z,inspect:U})),{exitOnCtrlC:!1});_(()=>f.unmount()),l.ledger({kind:"banner",text:`kane-cli design \xB7 ${e.useCase??e.resume??""}`});try{let n=T({...e,confirmRetarget:S},{contextDir:s,agent:t,preflightTurn:C,ask:p=>l.ask(p),out:p=>l.note(p),progress:()=>{},isTTY:P(),auth:h,chat:l,telemetry:i});n.finally(()=>{w=!0});let a=await n;return a===1&&process.stderr.write(i.supportFooter()+`
25
- `),await i.end({exit_code:a}),a}finally{w=!0,x&&clearTimeout(x),await v.current?.flush();try{f.unmount()}catch{}}}export{Z as bindDesignInteractive};
@@ -1,2 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a}from"./chunk-FMRSMN34.js";import"./chunk-RFHMDQXZ.js";import"./chunk-766WGMBU.js";import"./chunk-G7VQCS4J.js";import"./chunk-RZ4F3BHX.js";import"./chunk-6O3DDOP2.js";import"./chunk-27U4PLPX.js";import"./chunk-UR6MHSHU.js";export{a as LoginFlow};
@@ -1,2 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as c,b as m,c as s,d,e as P}from"./chunk-6XX4LEVJ.js";import{a as f}from"./chunk-IOFZSQAA.js";import"./chunk-EWCAFKLX.js";import"./chunk-5Y2G4NC7.js";import"./chunk-YCCUBQY4.js";import"./chunk-L7MXYCD7.js";import"./chunk-QGKPLOUI.js";import"./chunk-2KDGIZED.js";import"./chunk-YRFMPIU2.js";import"./chunk-FNH55WSR.js";import"./chunk-TYLYFERW.js";import"./chunk-MSGW4JDG.js";import"./chunk-TZXXJWHA.js";import"./chunk-56PAQAX5.js";import"./chunk-5EOX4MEY.js";import"./chunk-AW2XUHH4.js";import"./chunk-HEAIJCGZ.js";import"./chunk-TFPPEOAK.js";import"./chunk-BRIEBB2U.js";import"./chunk-4JOD47QI.js";import"./chunk-RZ4F3BHX.js";import"./chunk-27U4PLPX.js";import{a as p}from"./chunk-HCBYKLMW.js";import"./chunk-C44QQJR4.js";import{a as T}from"./chunk-6YGTRKDT.js";import{e as a}from"./chunk-UR6MHSHU.js";var g=a(T(),1);import{access as k}from"fs/promises";var l=a(p(),1);async function u(r){let{render:e}=await import("./build-JIKYOZUH.js");return await new Promise(t=>{let{unmount:i,waitUntilExit:n}=e(r(o=>{i(),t(o)}),{stdout:process.stderr,exitOnCtrlC:!0});n().then(()=>t(null)).catch(()=>t(null))})}async function K(){return await u(r=>(0,l.jsx)(f,{mode:"mobile-only",onSelect:e=>{(e==="emulator"||e==="simulator")&&r(e)},onCancel:()=>r(null)}))}async function M(r,e,t){return await u(i=>(0,l.jsx)(c,{targets:r,kind:e,...t?{preselectedTarget:t}:{},onSelect:n=>i(n),onCancel:()=>i(null)}))}function y({kind:r,listApps:e,done:t}){let[i,n]=(0,g.useState)(e?"source":"local");return i==="source"?(0,l.jsx)(d,{kind:r,onSelect:o=>n(o==="local"?"local":"cloud"),onCancel:()=>t(null)}):i==="cloud"&&e?(0,l.jsx)(m,{kind:r,listApps:e,onSelect:o=>t(o.appId),onManualEntry:()=>n("id"),onCancel:()=>n("source")}):i==="id"?(0,l.jsx)(P,{onSubmit:async o=>(t(o),{ok:!0}),onBack:()=>n("cloud")}):(0,l.jsx)(s,{kind:r,onSelect:async o=>{try{await k(o.value)}catch{return{ok:!1,error:`${o.value} is not there.`}}return t(o.value),{ok:!0}},onBack:()=>e?n("source"):t(null),onCancel:()=>t(null)})}async function x(r){return await u(e=>(0,l.jsx)(y,{...r,done:e}))}export{x as promptApp,M as promptDevice,K as promptMobileKind};
@@ -1,2 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{c as a,d as b,e as c,f as d,g as e,h as f}from"./chunk-QGKPLOUI.js";import"./chunk-2KDGIZED.js";import"./chunk-YRFMPIU2.js";import"./chunk-FNH55WSR.js";import"./chunk-TYLYFERW.js";import"./chunk-MSGW4JDG.js";import"./chunk-TZXXJWHA.js";import"./chunk-56PAQAX5.js";import"./chunk-5EOX4MEY.js";import"./chunk-AW2XUHH4.js";import"./chunk-HEAIJCGZ.js";import"./chunk-BRIEBB2U.js";import"./chunk-4JOD47QI.js";import"./chunk-RZ4F3BHX.js";import"./chunk-27U4PLPX.js";import"./chunk-UR6MHSHU.js";export{a as MobileHostUnsupportedError,b as MobilePreflightError,c as PACKAGE_ID_REJECTED,e as isInstallablePath,f as prepareTarget,d as toAppSpec};
@@ -1,2 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a,b,c,d,e,f}from"./chunk-MA34UWKX.js";import"./chunk-3POR47RC.js";import"./chunk-AFPHLUQ5.js";import"./chunk-RLRNLIRS.js";import"./chunk-OS4VSIHT.js";import"./chunk-TRJUD3XJ.js";import"./chunk-CLGC7VEO.js";import"./chunk-W5TTF7GB.js";import"./chunk-JFAFKHDX.js";import"./chunk-7BZSCUPP.js";import"./chunk-JZ26R6UL.js";import"./chunk-W4B5LOEX.js";import"./chunk-DNNZ353O.js";import"./chunk-2UIHS2FH.js";import"./chunk-Q2F5QB2W.js";import"./chunk-N2P4MI32.js";import"./chunk-5DT7PIGB.js";import"./chunk-XWKUZJCP.js";import"./chunk-NVGBE2DR.js";import"./chunk-CH273NAE.js";import"./chunk-TH47OOBV.js";import"./chunk-VAYBKR76.js";import"./chunk-CUM23TLF.js";import"./chunk-DUAXZYAD.js";import"./chunk-DBIBROYW.js";import"./chunk-WXHQYYD5.js";import"./chunk-IAHKTEET.js";import"./chunk-UD7KKHPW.js";import"./chunk-27U4PLPX.js";import"./chunk-UR6MHSHU.js";export{c as childModeFor,d as emitWalkSignal,f as reconcileCommand,a as resolveReconcileMode,e as runReconcileCommand,b as validateReconcileInputs};
@@ -1,4 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{d as q}from"./chunk-MA34UWKX.js";import{j as K}from"./chunk-3POR47RC.js";import{a as J}from"./chunk-GCBKDX2J.js";import"./chunk-AFPHLUQ5.js";import"./chunk-RLRNLIRS.js";import"./chunk-OS4VSIHT.js";import"./chunk-TRJUD3XJ.js";import"./chunk-CLGC7VEO.js";import{a as b,b as Y}from"./chunk-ZMNJBUAO.js";import"./chunk-W5TTF7GB.js";import"./chunk-I7TIGB7K.js";import{a as W}from"./chunk-BRHNRCEZ.js";import"./chunk-BB2W35TW.js";import"./chunk-JFAFKHDX.js";import"./chunk-7BZSCUPP.js";import"./chunk-YKTYVJBN.js";import"./chunk-JZ26R6UL.js";import"./chunk-W4B5LOEX.js";import"./chunk-DNNZ353O.js";import"./chunk-2UIHS2FH.js";import"./chunk-Q2F5QB2W.js";import"./chunk-N2P4MI32.js";import"./chunk-5DT7PIGB.js";import"./chunk-XWKUZJCP.js";import"./chunk-NVGBE2DR.js";import"./chunk-CH273NAE.js";import{e as P}from"./chunk-IDX3TOPY.js";import{A as D,d as V,h as G,o as M,p as H,t as U,u as F}from"./chunk-TH47OOBV.js";import"./chunk-VAYBKR76.js";import"./chunk-CUM23TLF.js";import{b as E}from"./chunk-DUAXZYAD.js";import"./chunk-DBIBROYW.js";import{e as A}from"./chunk-WXHQYYD5.js";import"./chunk-IAHKTEET.js";import"./chunk-UD7KKHPW.js";import"./chunk-27U4PLPX.js";import"./chunk-UR6MHSHU.js";import{existsSync as te,mkdirSync as re,readFileSync as N,readdirSync as ne,renameSync as ie,rmSync as le,writeFileSync as oe}from"fs";import{join as v}from"path";var ae=["title","description","summary","value"];function Q(e,t){let s=[],o=t.updated;if(!o)return s;for(let r of ae){let p=o[r];if(typeof p!="string"||p===e[r])continue;let g=e[r];typeof g=="string"&&g.length>0&&s.push({op:"-",field:r,text:g}),s.push({op:"+",field:r,text:p})}let i=(e.criteria??[]).map(String),u=o.criteria??[];if(u.length>0)if(u.some(r=>"op"in r))for(let r of u)r.op==="set"&&s.push({op:"+",field:"criteria",text:r.text}),r.op==="remove"&&s.push({op:"-",field:"criteria",text:r.text});else{let r=u.map(p=>p.text);for(let p of i)r.includes(p)||s.push({op:"-",field:"criteria",text:p});for(let p of r)i.includes(p)||s.push({op:"+",field:"criteria",text:p})}return s}function $(e){let t=e.filter(r=>r.field==="criteria"),s=t.filter(r=>r.op==="+").length,o=t.filter(r=>r.op==="-").length,i=[...new Set(e.filter(r=>r.field!=="criteria").map(r=>r.field))],u=[];return t.length>0&&u.push(`${t.length} criteria changed \xB7 +${s} \u2212${o}`),i.length>0&&u.push(`${i.join("/")} reworded`),u.join(" \xB7 ")||"no field changes"}var z={high:0,med:1,low:2};function B(e,t){return t?e.nameOf.get(t)??`${t.slice(0,19)}\u2026`:"(new)"}function O(e,t){if(!t)return;let s=e.edgesInto(t).filter(o=>o.type===A.BELONGS_TO||o.type===A.SCOPED_TO);if(s.length!==0)return{stale:s.length,direct:s.slice(0,3).map(o=>B(e,o.src))}}function X(e){return G(e).map(t=>({...t.source_id!==void 0?{source_id:t.source_id}:{},anchor:t.anchor,quote:t.quote??""}))}function S(e,t){let s=Y(e),o=[];for(let i of s.updates){let u=t.resolve(i.matches_existing.cid),r=u?t.tipOf(u.cid):null,p=(r?t.getNode(r)?.content:void 0)??{},g=Q(p,i);o.push({key:b("MODIFY",i.matches_existing.cid),kind:"MODIFY",...r?{ref:r}:{},display:B(t,r),title:typeof p.title=="string"?p.title:i.title,changeLine:i.change_note??$(g),diff:g,diffSummary:g.length>4?$(g):null,...i.risk!==void 0?{risk:i.risk}:{},cites:X(i),...i.matches_existing?.reason!==void 0?{tier:i.matches_existing.reason}:{},...O(t,r)!==void 0?{impact:O(t,r)}:{},payload:i})}for(let i of s.adds)o.push({key:b("ADD",i.temp_ref),kind:"ADD",display:"(new)",title:i.title,changeLine:i.summary??i.title,diff:[],diffSummary:null,...i.risk!==void 0?{risk:i.risk}:{},cites:X(i),payload:i});for(let i of s.archives){let u=t.resolve(i.target),r=u?t.tipOf(u.cid):null,p=(r?t.getNode(r)?.content:void 0)??{};o.push({key:b("ARCHIVE",i.target),kind:"ARCHIVE",...r?{ref:r}:{},display:B(t,r),title:typeof p.title=="string"?p.title:i.target,changeLine:i.reason,diff:[],diffSummary:null,...typeof p.risk=="string"?{risk:p.risk}:{},cites:[],reason:i.reason,basis:i.basis,...O(t,r)!==void 0?{impact:O(t,r)}:{}})}return o.sort((i,u)=>(z[i.risk??"low"]??2)-(z[u.risk??"low"]??2))}function j(e,t){return e.filter(s=>!(s.key in t))}async function Z(e){let{contextDir:t,graph:s,card:o,verdict:i,by:u}=e,r=null;if(o.kind!=="ADD"){let n=o.ref?s.resolve(o.ref):null;if(r=n?s.tipOf(n.cid):null,!r||(s.trust.get(r)??null)==="archived")return{ok:!1,refusal:`its target ${o.display} was retired while the review was open \u2014 nothing landed`}}if(i==="reject")return e.signals?.({ref:o.display,verdict:"reject",...e.note?{reason:e.note}:{}}),{ok:!0,landed:"none",note:"nothing saved \u2014 rejections aren't remembered yet; it may be re-proposed"};if(i==="defer"){let n=de({contextDir:t,card:o,note:e.note,changeBasis:e.changeBasis,tip:r,proposalId:e.proposalId});return n.ok?(e.signals?.({ref:o.display,verdict:"defer",...e.note?{reason:e.note}:{}}),{ok:!0,landed:"none",note:"gap recorded \u2014 visible in cover gaps until a later verdict resolves it"}):{ok:!1,refusal:n.refusal}}if(e.changeBasis?.to_cid){let n=s.resolve(e.changeBasis.source_id);if(!n)return{ok:!1,refusal:`the source ${e.changeBasis.source_id} no longer resolves \u2014 cannot verify this changeset is current; re-run maintain reconcile`};if(n.cid!==e.changeBasis.to_cid)return{ok:!1,refusal:`the source ${e.changeBasis.source_id} moved again while this review was open \u2014 re-run maintain reconcile to refresh the changeset`}}if(o.kind==="ARCHIVE"){let n=(e.proposal.archived??[]).filter(c=>{let y=s.resolve(c.target);return y!=null&&s.tipOf(y.cid)===r}),l=V({...e.proposal,archived:n},s);if(n.length===0||l.errors.length>0)return{ok:!1,refusal:l.errors.length>0?`${l.errors.map(c=>c.detail).join("; ")} \u2014 nothing landed; the card re-presents`:`its archive op no longer resolves to ${o.display} \u2014 re-run maintain reconcile`};let h;try{h=H({contextDir:t,graph:s,verdicts:new Map([[r,{resolution:"rejected",...o.reason??e.note?{reason:o.reason??e.note}:{}}]]),by:u})}catch(c){if(c instanceof E)return{ok:!1,refusal:"concurrent activity kept moving the store \u2014 try the card again"};throw c}return h.errors?{ok:!1,refusal:h.errors.map(c=>c.detail).join("; ")}:(e.signals?.({ref:o.display,verdict:"archive"}),F({contextDir:t,graph:s,targetTip:r,resolvedBy:r,...e.changeBasis?{sourceId:e.changeBasis.source_id}:{},by:u}),{ok:!0,landed:"archived"})}let p=o.payload,g=o.kind==="MODIFY"&&r&&p.matches_existing&&r!==p.matches_existing.cid?{...p,matches_existing:{...p.matches_existing,cid:r}}:p,R={version:1,read_basis:s.latestHash,source:e.proposal.source,...e.proposal.sources?{sources:e.proposal.sources}:{},use_cases:[g]},a=await W(J(t,e.sid??`card-${process.pid}`),{verb:"maintain",ucTargets:r?[{ref:r}]:[],newBuCandidates:o.kind==="ADD"?[{tempRef:g.temp_ref,title:g.title,probeText:`${g.title} ${g.summary??""}`.trim()}]:[],sourcePins:[],readBasis:s.latestHash},n=>{let l=M({contextDir:t,graph:n.graph,proposal:R,proposalId:`${e.proposalId}:${o.key}`,verdicts:new Map([[g.temp_ref,{resolution:"approved"}]]),by:u,autoName:!0,allowStaleBasis:!0,eventIds:n.eventIds("maintain",1),...e.sid?{sid:n.sid}:{},probeHits:n.probeHits});return l.errors!==null?{errors:l.errors}:{result:l,record:l.record}});if(!a.ok||!("result"in a))return{ok:!1,refusal:!a.ok&&a.kind==="validation"?a.errors.map(l=>l.detail).join("; "):"concurrent activity kept moving the store \u2014 try the card again"};e.signals?.({ref:o.display,verdict:"approve"});let d=a.result.record?.nodes.find(n=>n.label==="usecase")?.cid,f=o.kind==="MODIFY"?d??r??void 0:d;return o.kind==="MODIFY"&&r&&F({contextDir:t,graph:s,targetTip:r,resolvedBy:d??r,...e.changeBasis?{sourceId:e.changeBasis.source_id}:{},by:u}),{ok:!0,landed:o.kind==="MODIFY"?"successor":"minted",...f?{offer:{kind:o.kind==="MODIFY"?"evolve":"design",target:f}}:{}}}function de(e){let{card:t,changeBasis:s}=e,o={kind:"reconcile_deferred",derived:!0,text:t.changeLine||t.title,...t.risk?{risk:t.risk}:{},...e.note?{risk_rationale:e.note}:{},...e.tip?{ref:t.display,uc:e.tip}:{},...s?{basis:{source_id:s.source_id,from_cid:s.from_cid??"",to_cid:s.to_cid??""}}:{},...e.proposalId?{proposal_id:e.proposalId}:{},...t.payload?.temp_ref?{temp_ref:t.payload.temp_ref}:{}};return U({contextDir:e.contextDir,content:o,...e.tip?{annotates:e.tip}:{}})}function se(e,t){return v(e,"proposals",t,"verdicts.json")}function C(e,t){try{return JSON.parse(N(se(e,t),"utf8"))}catch{return{verdicts:{}}}}function ee(e,t,s){let o=v(e,"proposals",t);re(o,{recursive:!0});let i=v(o,`.verdicts.${process.pid}.tmp`);oe(i,JSON.stringify(s,null,2)+`
3
- `),ie(i,se(e,t))}function T(e,t){try{return JSON.parse(N(v(e,"proposals",t,"proposal.json"),"utf8"))}catch{return null}}function L(e,t){let s=v(e,"sessions");if(!te(s))return null;for(let o of ne(s)){let i;try{i=P(e,o)}catch{continue}if(!i?.reconcile||new Date(i.expires_at).getTime()<=Date.now()||C(e,i.reconcile.proposal_id).resolved)continue;let r=i.change_basis?.source_id??Object.keys(i.read_basis)[0]??"";if(!(t!==void 0&&r!==t))return{sid:i.sid,proposalId:i.reconcile.proposal_id,source:r,...i.change_basis?{changeBasis:{source_id:i.change_basis.source_id,to_cid:i.change_basis.new_head}}:{}}}return null}var fe=80;function pe(e){return{kind:e.kind,ref:e.display,title:e.kind==="ADD"?e.title:`${e.display} \xB7 ${e.title}`,why:e.changeLine,origin:"content-change",...e.tier!==void 0?{tier:e.tier}:{},...e.diffSummary==null&&e.diff.length>0?{diff:e.diff}:{},...e.diffSummary!=null?{diffSummary:e.diffSummary,viewDiff:!0}:{},...e.cites.length>0?{citeLines:e.cites.map(t=>`cite ${t.source_id??"conversation"} ${t.anchor} \u2014 "${t.quote.slice(0,fe)}"`)}:{},...e.impact?{impact:{stale_refs:Array(e.impact.stale).fill("\xB7"),...e.impact.direct.length>0?{direct_refs:e.impact.direct}:{}}}:{}}}function Be(e){let t=e.contextDir,s=e.changeContext?.source_id,o=new Map;e.changeContext&&o.set(e.changeContext.source_id,e.changeContext.old_head);let i=a=>{let d=o.get(a);if(d)return d;try{let f=K(t,a);return f&&o.set(a,f.old_head),f?.old_head}catch{return}},u=v(t,"proposals",".reconcile-steer-carry.json"),r=()=>{try{return JSON.parse(N(u,"utf8"))}catch{return null}},p=(a,d,f)=>{let n=r();if(!n||n.source!==f)return d;let l=C(t,a),h=!1;for(let c of d)(n.keys.includes(c.key)||c.kind==="ADD"&&n.addTitles.includes(c.title.toLowerCase()))&&!(c.key in l.verdicts)&&(l.verdicts[c.key]={verdict:"steer",at:new Date().toISOString()},h=!0);h&&ee(t,a,l);try{le(u)}catch{}return d},g=(a,d)=>{let f=T(t,a);if(!f)return[];let n=p(a,S(f,D(t)),d),l=C(t,a);return j(n,l.verdicts)},R=()=>{let a=v(t,"sessions");if(!te(a))return null;for(let d of ne(a)){let f;try{f=P(t,d)}catch{continue}if(!f||new Date(f.expires_at).getTime()<=Date.now())continue;let n=(f.ingest_schedule??[]).filter(l=>l.status==="skipped"&&(l.note??"").includes("review"));if(n.length>0)return{source:n[0].source_id,count:n.length}}return null};return{pending(){let a=L(t,s);if(a){let f=g(a.proposalId,a.source).length;return f>0?{source:a.source,count:f,kind:"cards"}:null}let d=R();return d?{source:d.source,count:d.count,kind:"needs-run"}:null},loadCards(){let a=L(t,s);if(!a)return[];let d=g(a.proposalId,a.source),f=d.filter(n=>n.kind==="ADD"||n.ref!=null);for(let n of d.filter(l=>l.kind!=="ADD"&&l.ref==null))e.note?.(`dropped: [${n.kind}] ${n.title} \u2014 its target was retired while the review was open; nothing lands`);return f.map(n=>({key:n.key,card:pe(n),viewLines:n.diff}))},noteSteer(){let a=L(t,s);if(!a)return;let d=T(t,a.proposalId);if(!d)return;let f=C(t,a.proposalId),n=S(d,D(t)).filter(c=>c.key in f.verdicts),l={source:a.source,keys:n.map(c=>c.key),addTitles:n.filter(c=>c.kind==="ADD").map(c=>c.title.toLowerCase())},h=`${u}.${process.pid}.tmp`;re(v(t,"proposals"),{recursive:!0}),oe(h,JSON.stringify(l,null,2)+`
4
- `),ie(h,u)},async applyVerdict(a,d,f){let n=L(t,s);if(!n)return{ok:!1,refusal:"the held changeset is gone \u2014 nothing to verdict"};let l=T(t,n.proposalId);if(!l)return{ok:!1,refusal:`proposal ${n.proposalId} is unreadable \u2014 re-run maintain reconcile`};if(a in C(t,n.proposalId).verdicts)return{ok:!1,refusal:"that change was already verdicted (another surface?) \u2014 refresh the review"};let h=D(t),c=S(l,h).find(x=>x.key===a);if(!c)return{ok:!1,refusal:"that change no longer builds a card \u2014 the set may have moved; re-open the review"};let y=i(n.source),I=n.changeBasis?{source_id:n.changeBasis.source_id,...y?{from_cid:y}:{},...n.changeBasis.to_cid?{to_cid:n.changeBasis.to_cid}:{}}:void 0,m=await Z({contextDir:t,graph:h,proposal:l,proposalId:n.proposalId,card:c,verdict:d,...f?{note:f}:{},by:{kind:"human",id:"owner"},sid:n.sid,...I?{changeBasis:I}:{},signals:x=>q(t,x.ref,x.verdict,x.reason)});if(!m.ok)return{ok:!1,refusal:m.refusal};let k=C(t,n.proposalId);return k.verdicts[a]={verdict:d,...f?{note:f}:{},at:new Date().toISOString()},j(S(l,D(t)),k.verdicts).length===0&&(k.resolved=!0),ee(t,n.proposalId,k),{ok:!0,line:`${d==="approve"?c.kind==="ARCHIVE"?"retired":"approved":d==="reject"?"rejected":"deferred"} change \xB7 [${c.kind}] ${c.display}${c.kind==="ADD"?"":` ${c.title}`} (you)`,...m.note?{note:m.note}:{},...m.offer&&m.offer.target?{offer:{kind:m.offer.kind,key:m.offer.target,title:c.kind==="ADD"?c.title:c.display}}:{}}},async startReview(a){let d=e.runPostureChild??(async(l,h)=>{let[{runExtract:c},{runAgent:y},{resolveAgentAuthEnv:I},{preflightTurn:m}]=await Promise.all([import("./run-URPGHOQM.js"),import("./bridge-5Z3BIB77.js"),import("./spawner-J67QR4QP.js"),import("./turn-preflight-JGYT7LXP.js")]),k=await I();return c({mode:"override",posture:"reconcile",source:l,changeContext:h},{contextDir:t,agent:y,preflightTurn:()=>m(k),ask:async _=>_.map(w=>({id:w.id,selected_index:w.recommended_index,free_text:null})),review:async _=>new Map(_.map(w=>[w.temp_ref,{resolution:"skipped"}])),confirmStale:async()=>!0,out:_=>e.note?.(_),progress:()=>{},isTTY:!1,auth:k})}),{buildChangeContext:f}=await import("./reconcile-engine-UKWPG2LV.js"),n=f(t,a);return n?(o.set(a,n.old_head),d(a,n)):(e.note?.(`no change context for ${a} \u2014 nothing to review`),2)}}}export{Be as makeReconcileDeps,C as readVerdictLedger,pe as toWalkCard};
@@ -1,2 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a,b,c,d,e,f,g,h,i,j,k,l,m,n,o}from"./chunk-3POR47RC.js";import"./chunk-AFPHLUQ5.js";import"./chunk-RLRNLIRS.js";import"./chunk-OS4VSIHT.js";import"./chunk-TRJUD3XJ.js";import"./chunk-JFAFKHDX.js";import"./chunk-JZ26R6UL.js";import"./chunk-DNNZ353O.js";import"./chunk-5DT7PIGB.js";import"./chunk-XWKUZJCP.js";import"./chunk-NVGBE2DR.js";import"./chunk-CH273NAE.js";import"./chunk-TH47OOBV.js";import"./chunk-VAYBKR76.js";import"./chunk-CUM23TLF.js";import"./chunk-DUAXZYAD.js";import"./chunk-DBIBROYW.js";import"./chunk-WXHQYYD5.js";import"./chunk-IAHKTEET.js";import"./chunk-UD7KKHPW.js";import"./chunk-UR6MHSHU.js";export{g as EVOLVABLE,d as RECONCILE_NOTE_CHANGED,c as RECONCILE_SKIPPED_ARMS,j as buildChangeContext,l as buildReconcilePlan,i as capDiff,a as commitHeldRows,k as commitOneHeldRow,e as isLive,h as lineDiff,o as liveReextractSeam,m as liveReingestSeam,n as liveRemoteReingestSeam,f as parentUc,b as rowImpactOf};
@@ -1,2 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{b as a,c as b,d as c,e as d,f as e}from"./chunk-FNH55WSR.js";import"./chunk-TYLYFERW.js";import"./chunk-MSGW4JDG.js";import"./chunk-4JOD47QI.js";import"./chunk-RZ4F3BHX.js";import"./chunk-27U4PLPX.js";import"./chunk-UR6MHSHU.js";export{d as discoverAll,a as knownPlatforms,c as providerFor,b as registeredPlatforms,e as resolveTarget};
@@ -1,7 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{e as f,f as u}from"./chunk-QGKPLOUI.js";import"./chunk-2KDGIZED.js";import"./chunk-YRFMPIU2.js";import"./chunk-FNH55WSR.js";import"./chunk-TYLYFERW.js";import"./chunk-MSGW4JDG.js";import"./chunk-TZXXJWHA.js";import"./chunk-56PAQAX5.js";import"./chunk-5EOX4MEY.js";import"./chunk-AW2XUHH4.js";import"./chunk-HEAIJCGZ.js";import"./chunk-BRIEBB2U.js";import"./chunk-4JOD47QI.js";import"./chunk-RZ4F3BHX.js";import{a as c,e as l}from"./chunk-EYOCNMUM.js";import"./chunk-27U4PLPX.js";import"./chunk-UR6MHSHU.js";var m=["desktop","emulator","simulator"];function v(e,n){return e.kind==="app_id"?!0:n==="emulator"?e.kind==="apk":e.kind==="zip"}function h(e){let{flags:n,saved:i}=e,d=[],s;if(n.target!==void 0){if(!m.includes(n.target))return{kind:"invalid",message:`--target must be one of desktop, emulator, simulator (got "${n.target}")`};s=n.target}else{let t=c(i?.tui_target,i?.default_target?.kind);if(t.kind==="choose-mobile")return{kind:"choose-mobile-kind"};s=t.kind==="unset"?"desktop":t.kind}if(s==="desktop"){for(let[t,a]of[["--device",n.device],["--app",n.app]])a!==void 0&&d.push(`ignored ${t} ${a}: session target is desktop \u2014 set --target emulator|simulator to run on a device`);return{kind:"web",warnings:d}}if(!e.host.supported)return{kind:"invalid",message:e.host.reason??"this machine cannot run mobile targets."};let p=[],o;n.device!==void 0?o={value:n.device,source:"flag"}:i?.default_target&&i.default_target.kind===s?o={value:i.default_target.id,source:"saved"}:p.push("device");let r;if(n.app!==void 0){let t=u(n.app);if(!t)return{kind:"invalid",message:`${n.app}: ${f}`};if(!v(t,s))return{kind:"invalid",message:s==="emulator"?`--app ${n.app} cannot run on an emulator (needs an .apk, or an APP\u2026 id).`:`--app ${n.app} cannot run on a simulator (needs a .zip of the .app bundle, or an APP\u2026 id).`};r={value:n.app,source:"flag"}}else{let t=i?.default_app,a=t?u(t):null;a&&v(a,s)&&i?.default_target?.kind===s?r={value:t,source:"saved"}:p.push("app")}return{kind:"mobile",target:s,...o?{device:o}:{},...r?{app:r}:{},missing:p,warnings:d}}function R(e){return e.target==="desktop"?"Running on: Desktop \xB7 Chrome":`Running on: ${l(e.target)} \xB7 ${e.deviceLabel} \xB7 ${e.appLabel}`}var g={emulator:"</path/to/app.apk | APPid>",simulator:"</path/to/app.zip | APPid>"};function S(e,n){let i=l(e).toLowerCase();return n==="device"?[`session target is "${i}" but no device is set.`," See devices: kane-cli doctor",' Set one: kane-cli config set-device "<name>"',' Or per-run: --device "<name>"'].join(`
3
- `):[`session target is "${i}" but no app is set.`,` Set one: kane-cli config set-app ${g[e]}`,` Or per-run: --app ${g[e]}`].join(`
4
- `)}function P(e){return[`saved device "${e}" was not found on this machine.`," See devices: kane-cli doctor",' Set one: kane-cli config set-device "<name>"'].join(`
5
- `)}function T(e,n){return[`saved app ${e} no longer exists on disk.`," The build may have been moved or cleaned. Set a new one:",` kane-cli config set-app ${g[n]}`].join(`
6
- `)}var $=['session target is "mobile" from an older version \u2014 say which kind:'," kane-cli config set-target emulator|simulator"].join(`
7
- `);export{$ as CHOOSE_MOBILE_KIND_MESSAGE,v as appSuitsTarget,R as formatRunningOn,S as missingPieceMessage,h as resolveRunIntent,T as staleAppMessage,P as staleDeviceMessage};
@@ -1,2 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a}from"./chunk-MXHHMIO2.js";import"./chunk-KHU7C6EE.js";import"./chunk-IOD3HQVW.js";import"./chunk-3Q6WAK6P.js";import"./chunk-AFPHLUQ5.js";import"./chunk-KU6IXFGZ.js";import"./chunk-ZGBSGZZM.js";import"./chunk-65ZTD5SJ.js";import"./chunk-BRHNRCEZ.js";import"./chunk-BB2W35TW.js";import"./chunk-VGFTNLQQ.js";import"./chunk-L2TV4G56.js";import"./chunk-JFAFKHDX.js";import"./chunk-6KPPGMO2.js";import"./chunk-7BZSCUPP.js";import"./chunk-GFKCTYCA.js";import"./chunk-YKTYVJBN.js";import"./chunk-IMR64OCZ.js";import"./chunk-427OQS2N.js";import"./chunk-JZ26R6UL.js";import"./chunk-W4B5LOEX.js";import"./chunk-DNNZ353O.js";import"./chunk-R7QAS6LZ.js";import"./chunk-KRKGZ2ZW.js";import"./chunk-2UIHS2FH.js";import"./chunk-Q2F5QB2W.js";import"./chunk-BKHXPBWN.js";import"./chunk-N2P4MI32.js";import"./chunk-SDPRO2LE.js";import"./chunk-5DT7PIGB.js";import"./chunk-ZPDM6FO7.js";import"./chunk-NVGBE2DR.js";import"./chunk-CH273NAE.js";import"./chunk-L5LI2JF4.js";import"./chunk-IDX3TOPY.js";import"./chunk-TH47OOBV.js";import"./chunk-VAYBKR76.js";import"./chunk-CUM23TLF.js";import"./chunk-DUAXZYAD.js";import"./chunk-DBIBROYW.js";import"./chunk-WXHQYYD5.js";import"./chunk-IAHKTEET.js";import"./chunk-UD7KKHPW.js";import"./chunk-MSGW4JDG.js";import"./chunk-5EOX4MEY.js";import"./chunk-27U4PLPX.js";import"./chunk-UR6MHSHU.js";export{a as runDesign};
@@ -1,2 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{f as a}from"./chunk-7Q6M6P4X.js";import"./chunk-3MSXQU2C.js";import"./chunk-6XX4LEVJ.js";import"./chunk-DCY6R5DP.js";import"./chunk-7JWKHKFU.js";import"./chunk-3LJWYRAA.js";import"./chunk-C7HSWZP6.js";import"./chunk-JJHG3BWO.js";import"./chunk-KFSUPQAG.js";import"./chunk-ELM6MXGJ.js";import"./chunk-C5UNZ6ZY.js";import"./chunk-S3DAAAE5.js";import"./chunk-MBF3FP5P.js";import"./chunk-5DT7PIGB.js";import"./chunk-GKYPNSQP.js";import"./chunk-RFR4ZKIC.js";import"./chunk-YJELGSKJ.js";import"./chunk-GPG3FIN3.js";import"./chunk-2YQ6TW77.js";import"./chunk-YFYCCTSL.js";import"./chunk-ZVHCQMJ6.js";import"./chunk-5DBK6QNS.js";import"./chunk-CJJXT5DO.js";import"./chunk-XWKUZJCP.js";import"./chunk-ZPDM6FO7.js";import"./chunk-EHN5HTUD.js";import"./chunk-NVGBE2DR.js";import"./chunk-CH273NAE.js";import"./chunk-3PECJD6S.js";import"./chunk-IOFZSQAA.js";import"./chunk-HMYMSRA4.js";import"./chunk-L5LI2JF4.js";import"./chunk-ZIUAOEUC.js";import"./chunk-CTW2VQKS.js";import"./chunk-GZPK6FRP.js";import"./chunk-6IA6QMPH.js";import"./chunk-TDPWFYTJ.js";import"./chunk-T5Y6MOLM.js";import"./chunk-UV462FZR.js";import"./chunk-EWCAFKLX.js";import"./chunk-5Y2G4NC7.js";import"./chunk-TKGUT425.js";import"./chunk-R5T4RLF5.js";import"./chunk-OTTGS2TE.js";import"./chunk-TH47OOBV.js";import"./chunk-VAYBKR76.js";import"./chunk-CUM23TLF.js";import"./chunk-DUAXZYAD.js";import"./chunk-DBIBROYW.js";import"./chunk-WXHQYYD5.js";import"./chunk-IAHKTEET.js";import"./chunk-UD7KKHPW.js";import"./chunk-QRZRSAZH.js";import"./chunk-UXDL4XDL.js";import"./chunk-YCCUBQY4.js";import"./chunk-L7MXYCD7.js";import"./chunk-DZGCXKKI.js";import"./chunk-2WVKOZ6W.js";import"./chunk-VE3SUJMA.js";import"./chunk-FMRSMN34.js";import"./chunk-RFHMDQXZ.js";import"./chunk-2YEHV2CX.js";import"./chunk-QGKPLOUI.js";import"./chunk-2KDGIZED.js";import"./chunk-YRFMPIU2.js";import"./chunk-FNH55WSR.js";import"./chunk-TYLYFERW.js";import"./chunk-MSGW4JDG.js";import"./chunk-TZXXJWHA.js";import"./chunk-56PAQAX5.js";import"./chunk-5EOX4MEY.js";import"./chunk-AW2XUHH4.js";import"./chunk-HEAIJCGZ.js";import"./chunk-NX7TM662.js";import"./chunk-RC52N7PC.js";import"./chunk-TFPPEOAK.js";import"./chunk-BRIEBB2U.js";import"./chunk-4JOD47QI.js";import"./chunk-XO5ZH3ZR.js";import"./chunk-766WGMBU.js";import"./chunk-G7VQCS4J.js";import"./chunk-DPUV6OSP.js";import"./chunk-NLCCBXXV.js";import"./chunk-RZ4F3BHX.js";import"./chunk-E47GFYXA.js";import"./chunk-EYOCNMUM.js";import"./chunk-6O3DDOP2.js";import"./chunk-UDIQOJEL.js";import"./chunk-FEJXWJ3L.js";import"./chunk-27U4PLPX.js";import{a as o}from"./chunk-DFS4RMVP.js";import{a as t}from"./chunk-HCBYKLMW.js";import{c as n}from"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import{e as r}from"./chunk-UR6MHSHU.js";var e=r(t(),1);async function p(i){let c=i.scenarioLimit!==void 0||i.perScenarioLimit!==void 0?{scenarioLimit:i.scenarioLimit,perScenarioLimit:i.perScenarioLimit}:void 0,{waitUntilExit:m}=n((0,e.jsx)(o,{children:(0,e.jsx)(a,{initialChatMode:"generate",initialObjective:i.objective,initialGenerateLimits:c})}),{exitOnCtrlC:!1});await m()}export{p as runGenerate};
@@ -1,2 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a}from"./chunk-XO5ZH3ZR.js";import"./chunk-766WGMBU.js";import"./chunk-G7VQCS4J.js";import"./chunk-RZ4F3BHX.js";import"./chunk-27U4PLPX.js";import"./chunk-UR6MHSHU.js";export{a as refreshOAuthToken};
@@ -1,2 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{c as ce}from"./chunk-VRVFPMCR.js";import{k as se}from"./chunk-3POR47RC.js";import"./chunk-AFPHLUQ5.js";import{a as q,c as Q,d as ae}from"./chunk-RLRNLIRS.js";import"./chunk-OS4VSIHT.js";import"./chunk-TRJUD3XJ.js";import{b as G,c as ne,d as ie,e as L,g as N,h as oe}from"./chunk-W2JFDDIB.js";import{a as K}from"./chunk-CLGC7VEO.js";import"./chunk-JFAFKHDX.js";import"./chunk-GFKCTYCA.js";import"./chunk-JZ26R6UL.js";import"./chunk-DNNZ353O.js";import"./chunk-5DT7PIGB.js";import"./chunk-XWKUZJCP.js";import"./chunk-NVGBE2DR.js";import"./chunk-CH273NAE.js";import{A as O}from"./chunk-TH47OOBV.js";import{b as re}from"./chunk-VAYBKR76.js";import"./chunk-CUM23TLF.js";import{i as te}from"./chunk-DUAXZYAD.js";import"./chunk-DBIBROYW.js";import"./chunk-WXHQYYD5.js";import"./chunk-IAHKTEET.js";import"./chunk-UD7KKHPW.js";import{a as ee}from"./chunk-YCCUBQY4.js";import{y as g}from"./chunk-27U4PLPX.js";import{a as j}from"./chunk-HCBYKLMW.js";import{a as P,b as w,k as B}from"./chunk-C44QQJR4.js";import{a as be}from"./chunk-6YGTRKDT.js";import{e as H}from"./chunk-UR6MHSHU.js";var D=H(be(),1);function le(r,p,b){let{ref:C,reason:u,by:y}=b;if(!u||u.trim().length===0)return{record:null,errors:[{code:"REASON_REQUIRED",detail:"archiving a node needs a reason \u2014 it becomes the tombstone's provenance"}]};let k=p.resolve(C);if(!k)return{record:null,errors:[{code:"UNKNOWN_REF",detail:`no node '${C}' in the graph`}]};let t=p.tipOf(k.cid);if(p.superseded.has(t))return{record:null,errors:[{code:"ALREADY_ARCHIVED",detail:`${C} is already superseded at its tip (${t.slice(0,19)}\u2026)`}]};let i=te(r,{ts:new Date().toISOString(),proposal_id:null,nodes:[],edges:[],review:[],supersessions:[{kind:"node",old:t,new:null,reason:u,by:y}],source_head_moves:{}},{expectPrev:p.latestHash});return re(r),{record:i.record,errors:null}}function de(r){let p=r.by??{kind:"human",id:process.env.USER??"operator"},b=r.mode==="interactive"?"override":r.mode,C={out:()=>{},err:()=>{},isTTY:!1,confirm:async()=>!0},u={applied:0,committed:0,retired:0,skipped:0,deferred:0,failed:0},y=new Map;for(let t of r.planRows)if(t.held_ref&&r.held){let i=r.held.rows.find(a=>a.temp_ref===t.held_ref);if(!i)continue;let v={kind:i.kind,ref:i.temp_ref,title:i.title,why:i.why,origin:"content-change",...t.impact?{impact:t.impact}:{}};y.set(v.ref,{card:v,source:"held",heldRef:i.temp_ref})}else if(t.kind==="MODIFY"){let i={kind:"MODIFY",ref:t.ref,title:t.ref,why:`${t.reason}: ${t.provenance}`,origin:t.origin??"structural-stale",...t.impact?{impact:t.impact}:{}};y.set(i.ref,{card:i,source:"row",row:t})}else if(t.kind==="ADD"){let i={kind:"ADD",ref:t.ref,title:t.ref,why:t.reason,origin:t.origin??"content-change"};y.set(i.ref,{card:i,source:"row",row:t})}for(let t of r.archive){if(t.kind!=="ARCHIVE")continue;let i={kind:"ARCHIVE",ref:t.ref,title:t.ref,why:t.why,provenance:t.why,...t.impact?{impact:t.impact}:{}};y.set(i.ref,{card:i,source:"archive",row:t})}for(let t of r.reviewFeeder?.()??[]){if(y.has(t.ref))continue;let i={kind:t.kind==="MODIFY_HELD"?"MODIFY":t.kind,ref:t.ref,title:t.title,why:t.why,...t.impact?{impact:t.impact}:{},...t.pair?{pair:t.pair}:{},...t.held?{held:!0}:{},...t.kind==="MODIFY_HELD"?{heldPayload:!0}:{}};y.set(i.ref,{card:i,source:"review",reviewCard:t})}let k=t=>(u.failed++,{outcome:"failed",detail:t});return{cards:()=>[...y.values()].map(t=>t.card),async submit(t,i){let v=y.get(t);if(!v)return k(`no card ${t}`);if(v.source==="review"){if(v.reviewCard.kind==="PAIR"&&i.v==="approve")return k(`${t} is a PAIR card \u2014 approve is not in its grammar (merge / keep both / defer); words ride a defer note`);let{submitReview:s}=await import("./verdicts-TRSTJLCL.js"),x=i.v==="approve"?{v:"approve"}:i.v==="archive"?{v:"archive",because:i.because??""}:i.v==="skip"&&v.reviewCard.kind==="MODIFY_HELD"?{v:"keep_current"}:i.v==="defer"||i.v==="skip"?{v:"defer"}:i.v==="merge"?{v:"merge"}:{v:"keep_both"},h=await s({contextDir:r.contextDir,signals:o=>r.signals({ref:o.ref,verdict:o.verdict,...o.reason?{reason:o.reason}:{}})},v.reviewCard,x,p);return h.outcome==="failed"?(u.failed++,h):h.outcome==="deferred"?(u.deferred++,i.v==="defer"&&i.note?(r.signals({ref:t,verdict:"deferred-with-note",reason:i.note}),{...h,detail:`steering noted: "${i.note}" \u2014 decide ${v.reviewCard.kind==="PAIR"?"merge / keep both":"the verdict"} when it re-offers`}):h):h.outcome==="retired"?(u.retired++,h):h.outcome==="committed"?(u.committed++,h):(u.applied++,h)}if(i.v==="merge"||i.v==="keep_both")return k(`${t} is a ${v.card.kind} card \u2014 ${i.v} applies to review cards only`);if(i.v==="skip")return u.skipped++,r.signals({ref:t,verdict:"gap-dismissed"}),{outcome:"skipped"};if(i.v==="defer")return u.deferred++,i.note?(r.signals({ref:t,verdict:"deferred-with-note",reason:i.note}),{outcome:"deferred",detail:`steering noted: "${i.note}"`}):{outcome:"deferred"};if(i.v==="archive"){if(v.source!=="archive")return k(`${t} is not an ARCHIVE card`);let s=O(r.contextDir),x=s.resolve(v.row.ref);if(x&&s.superseded.has(s.tipOf(x.cid)))return u.skipped++,{outcome:"skipped",detail:"already retired \u2014 nothing to do"};let h=le(r.contextDir,O(r.contextDir),{ref:v.row.ref,reason:`reconcile retire: ${v.row.why}`,by:p});return h.errors?k(h.errors.map(o=>`${o.code}: ${o.detail}`).join("; ")):(u.retired++,r.signals({ref:t,verdict:"gap-resolved-archive",reason:v.row.why}),{outcome:"retired"})}if(v.source==="archive")return k(`${t} takes archive/skip/defer, not approve`);if(v.source==="held"){let s=se(r.contextDir,r.held,v.heldRef,p,i.edits);if(!s.ok)return k(s.message);if(s.kind==="ADD"){let x=await r.runDesign(s.ref,{yes:!0,mode:b,...i.steering?{because:i.steering}:{}});return x!==0?(u.failed++,{outcome:"failed",landed:!0,detail:`committed ${s.ref}, but its design run exited ${x} \u2014 finish with kane-cli design tests --use-case ${s.ref}`}):(u.applied++,r.signals({ref:t,verdict:"gap-resolved-create",...i.steering?{reason:i.steering}:{}}),{outcome:"applied",detail:s.ref})}if(i.steering){let x=O(r.contextDir),h=q(x,s.ref);if(!h.ok)return u.committed++,{outcome:"committed",detail:`committed ${s.ref}, but steering could not resolve it (${h.message}) \u2014 steer via kane-cli maintain evolve ${s.ref}`};let o=await Q(r.contextDir,h.target,{yes:!0,mode:b,because:i.steering},C,r.runDesign,"batch");if(o.outcome==="no-design"){let d=await r.runDesign(h.target.seamRef,{yes:!0,mode:b,because:i.steering});return d!==0?(u.failed++,{outcome:"failed",landed:!0,detail:`committed ${s.ref}, but its steered design run exited ${d} \u2014 finish with kane-cli design tests --use-case ${h.target.seamRef}`}):(u.applied++,r.signals({ref:t,verdict:"gap-resolved-create",reason:i.steering}),{outcome:"applied",detail:s.ref})}return o.outcome==="failed"||o.outcome==="paused"?(u.failed++,{outcome:"failed",landed:!0,detail:`committed ${s.ref}, but the steering evolve ${o.outcome} (exit ${o.code}) \u2014 finish with kane-cli maintain evolve ${s.ref}`}):o.outcome==="declined"?(u.committed++,{outcome:"committed",detail:`committed ${s.ref} \u2014 the steering evolve was declined; re-run kane-cli maintain evolve ${s.ref}`}):(u.applied++,r.signals({ref:t,verdict:"gap-resolved-evolve",reason:i.steering}),{outcome:"applied",detail:s.ref})}return u.committed++,r.signals({ref:t,verdict:"gap-resolved-evolve"}),{outcome:"committed",detail:s.ref}}let a=O(r.contextDir),f=q(a,v.row.ref);if(!f.ok)return k(f.message);if(v.card.kind==="ADD"){let s=await r.runDesign(f.target.seamRef,{yes:!0,mode:b});return s!==0?k(`design run exited ${s}`):(u.applied++,r.signals({ref:t,verdict:"gap-resolved-create"}),{outcome:"applied"})}let R=await Q(r.contextDir,f.target,{yes:!0,mode:b,...i.steering?{because:i.steering}:{}},C,r.runDesign,"batch");return R.outcome==="evolved"?(u.applied++,r.signals({ref:t,verdict:"gap-resolved-evolve",...i.steering?{reason:i.steering}:{}}),{outcome:"applied"}):R.outcome==="failed"||R.outcome==="paused"?k(`evolve ${R.outcome} (exit ${R.code})`):(u.skipped++,{outcome:"skipped",detail:R.outcome})},summary:()=>({...u})}}var _=H(j(),1);function U({mark:r,markColor:p,color:b,indent:C=2,reserve:u=0,children:y}){let{stdout:k}=B(),t=(k?.columns??80)-u,i=C+r.length+1;return(0,_.jsxs)(P,{children:[(0,_.jsx)(P,{width:i,flexShrink:0,children:(0,_.jsx)(w,{color:p,children:`${" ".repeat(C)}${r}`})}),(0,_.jsx)(P,{width:Math.max(20,t-i),children:(0,_.jsx)(w,{color:b,children:y})})]})}var l=H(j(),1);function ue(r){return r.landed?"committed":r.outcome}var ye={applied:{mark:"\u2714",color:"green"},committed:{mark:"\u2714",color:"green"},retired:{mark:"\u2714",color:"green"},skipped:{mark:"\xB7",color:"dim"},deferred:{mark:"\u2013",color:"dim"},failed:{mark:"\u2717",color:"red"}},Y=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"];function xe(r){return r.v==="archive"?"Retiring\u2026":r.v==="approve"&&r.steering?"Approving with your changes \u2014 committing, then re-designing\u2026":"Applying \u2014 committing\u2026"}function Re({controller:r,cards:p,note:b,markOutcome:C,routeChat:u,listEvolveTargets:y,barSubject:k,onFinish:t,onCtrlC:i,pauseRef:v}){let[a,f]=(0,D.useState)(p.length>0?{at:"card",idx:0,sel:0,editor:null}:{at:"done-panel",sel:0}),R=(0,D.useRef)(0),s=(0,D.useRef)(a);s.current=a;let x=(0,D.useRef)([]),[h,o]=(0,D.useState)(0),d=a.at==="busy"||a.at==="evolving";(0,D.useEffect)(()=>{if(!d)return;let e=setInterval(()=>o(n=>n+1),120);return()=>clearInterval(e)},[d]);let A=(0,D.useRef)(!1),$=()=>{b((0,l.jsx)(w,{color:g.dim,children:"walk paused \u2014 every verdict so far is committed; re-run the same command to continue"})),t(3)},I=()=>{if(A.current)return;A.current=!0;let e=s.current;if(e.at==="busy"||e.at==="evolving"){b((0,l.jsx)(w,{color:g.dim,children:"finishing the current item, then pausing\u2026"}));return}if(e.at==="done-panel"||e.at==="picker"||e.at==="why"||e.at==="view"){t(R.current);return}$()};v&&(v.current=I);let E=a.at==="card"||a.at==="busy"?p[a.idx]:null,T=()=>[{key:"finish",label:"finish"},...y?[{key:"evolve",label:"evolve another use-case\u2026"}]:[],...x.current.length>0?[{key:"view",label:"view what changed"}]:[]],W=()=>{let e=y?.()??[];if(e.length===0){b((0,l.jsx)(w,{color:g.dim,children:"nothing is stale \u2014 no evolve targets right now"})),f({at:"done-panel",sel:0});return}f({at:"picker",items:e,sel:0})},M=e=>{let n=e+1;if(n<p.length)f({at:"card",idx:n,sel:0,editor:null});else{let c=r.summary();b((0,l.jsx)(w,{color:g.dim,children:`reconcile walk: ${c.applied} applied, ${c.committed} committed, ${c.retired} retired, ${c.skipped} skipped, ${c.deferred} deferred`+(c.failed>0?`, ${c.failed} failed`:"")})),f({at:"done-panel",sel:0})}},F=(0,D.useRef)(!1),S=(e,n)=>{if(F.current)return;F.current=!0;let c=p[e];f({at:"busy",idx:e,label:xe(n),startedAt:Date.now()}),r.submit(c.ref,n).catch(m=>({outcome:"failed",detail:m instanceof Error?m.message:String(m)})).then(m=>{let V=ye[m.outcome]??{mark:"\xB7",color:"dim"},we=m.outcome!=="failed"&&m.outcome!=="skipped"&&m.outcome!=="deferred"&&c.impact&&"stale_refs"in c.impact&&c.impact.stale_refs.length>0?` \xB7 ${c.impact.stale_refs.length} item(s) now stale`:"",Z=`${m.outcome} [${c.kind}] ${K(c.title)}${m.detail?` \u2014 ${K(m.detail)}`:""}${we}`;if(x.current.push({mark:V.mark,color:V.color,line:Z}),b((0,l.jsx)(U,{mark:V.mark,markColor:V.color==="green"?g.green:V.color==="red"?g.red:g.dim,color:V.color==="dim"?g.dim:void 0,children:Z})),m.outcome==="failed"&&(R.current=R.current===0?1:R.current),C(c.ref,ue(m)),F.current=!1,A.current){$();return}M(e)})},me=(e,n)=>{f({at:"evolving",title:e.title,startedAt:Date.now()}),u(`${e.key} ${n}`).catch(c=>`\u2717 evolve failed: ${c instanceof Error?c.message:String(c)}`).then(c=>{let m=c.startsWith("\u2713");if(x.current.push({mark:m?"\u2714":"\u2717",color:m?"green":"red",line:c.replace(/^[✓✗]\s*/,"")}),b((0,l.jsx)(U,{mark:m?"\u2714":"\u2717",markColor:m?g.green:g.red,children:c.replace(/^[✓✗]\s*/,"")})),A.current){t(R.current);return}f({at:"done-panel",sel:0})})},fe=(0,D.useMemo)(()=>({isFocused:()=>{let e=s.current;return e.at==="card"&&e.editor===null||e.at==="done-panel"||e.at==="picker"||e.at==="view"},onMove:e=>{f(n=>{if(n.at==="card"){let c=p[n.idx],m=N(c)??L(c).length-1;return{...n,sel:Math.max(0,Math.min(m,n.sel+e))}}return n.at==="done-panel"?{...n,sel:Math.max(0,Math.min(T().length-1,n.sel+e))}:n.at==="picker"?{...n,sel:Math.max(0,Math.min(n.items.length-1,n.sel+e))}:n})},onSelect:()=>{let e=s.current;if(e.at==="card"){let n=p[e.idx],c=N(n);if(c!==null&&e.sel===c){f({...e,editor:"",editorIntent:"steer"});return}let m=L(n)[e.sel];if(m?.v==="archive"&&n.kind==="REVIEW"){f({...e,editor:"",editorIntent:"because"});return}m&&S(e.idx,{v:m.v});return}if(e.at==="done-panel"){let n=T()[e.sel];n?.key==="finish"?t(R.current):n?.key==="evolve"?W():n?.key==="view"&&f({at:"view"});return}if(e.at==="picker"){let n=e.items[e.sel];n&&f({at:"why",item:n,text:""});return}},onDigit:e=>{let n=s.current;if(n.at==="card"){let c=p[n.idx],m=L(c)[e-1];if(m?.v==="archive"&&c.kind==="REVIEW"){f({...n,editor:"",editorIntent:"because"});return}m&&S(n.idx,{v:m.v});return}n.at==="done-panel"&&e-1<T().length&&f({...n,sel:e-1}),n.at==="picker"&&e-1<n.items.length&&f({...n,sel:e-1})},onType:e=>{f(n=>n.at!=="card"||N(p[n.idx])===null?n:{...n,editor:(n.editor??"")+e,editorIntent:n.editorIntent??"steer"})},isMulti:()=>!1,onSpace:()=>{},onBack:()=>{let e=s.current;(e.at==="picker"||e.at==="view")&&f({at:"done-panel",sel:0})}}),[p]);(0,D.useEffect)(()=>{a.at==="done"&&t(R.current)},[a.at]);let pe=a.at==="card"||a.at==="done-panel"||a.at==="picker"||a.at==="why"||a.at==="view",ge=a.at==="card"||a.at==="busy"?`${k?`${k} \xB7 `:""}item ${a.idx+1} of ${p.length}`:k,X=e=>Math.floor((Date.now()-e)/1e3),{stdout:ve}=B(),z=Math.min((ve?.columns??80)-1,100),J=`view \xB7 this run's changes \xB7 ${x.current.length}`,he=Math.max(2,z-(3+J.length+1)),ke=Math.max(2,z-12);return(0,l.jsxs)(P,{flexDirection:"column",children:[(0,l.jsx)(ie,{onToggleThinking:()=>{},onCtrlC:()=>{i(),I()},panel:fe}),a.at==="card"&&E?(0,l.jsx)(oe,{card:E,position:{n:a.idx+1,of:p.length},sel:a.sel,focused:a.editor===null,editorIntent:a.editorIntent??"steer",freeText:a.editor!==null?{value:a.editor,onChange:e=>f(n=>n.at==="card"?{...n,editor:e}:n),onSubmit:e=>{let n=s.current;if(n.at!=="card")return;let c=e.trim();if(!c){f({...n,editor:null,editorIntent:void 0});return}let m=p[n.idx];n.editorIntent==="because"?S(n.idx,{v:"archive",because:c}):m.kind==="PAIR"?S(n.idx,{v:"defer",note:c}):S(n.idx,{v:"approve",steering:c})},onCancel:()=>f(e=>e.at==="card"?{...e,editor:null,editorIntent:void 0}:e)}:null}):null,a.at==="busy"?(0,l.jsxs)(w,{color:g.assuranceAccent,children:[`${Y[h%Y.length]} ${a.label} `,(0,l.jsx)(w,{color:g.dim,children:`(${X(a.startedAt)}s)`})]}):null,a.at==="evolving"?(0,l.jsxs)(w,{color:g.assuranceAccent,children:[`${Y[h%Y.length]} Evolving ${a.title}\u2026 `,(0,l.jsx)(w,{color:g.dim,children:`(${X(a.startedAt)}s)`})]}):null,a.at==="done-panel"?(0,l.jsx)(G,{headline:(()=>{let e=r.summary();return`reconcile done \u2014 ${e.applied+e.committed} applied \xB7 ${e.retired} retired \xB7 ${e.skipped} skipped \xB7 ${e.deferred} deferred${e.failed>0?` \xB7 ${e.failed} failed`:""}`})(),rows:T(),sel:a.sel,focused:!0,legend:"\u2191\u2193 \xB7 \u23CE select"}):null,a.at==="picker"?(0,l.jsx)(G,{ask:!0,headline:"evolve which use-case?",rows:a.items.map(e=>({key:e.key,label:e.title,detail:e.badge})),sel:a.sel,focused:!0,legend:"\u2191\u2193 \xB7 \u23CE select \xB7 esc back"}):null,a.at==="why"?(0,l.jsxs)(P,{flexDirection:"column",borderStyle:"round",borderColor:g.assuranceAccent,paddingX:1,children:[(0,l.jsxs)(P,{children:[(0,l.jsxs)(w,{children:[(0,l.jsx)(w,{color:g.assuranceAccent,children:"\u25B8"})," ",(0,l.jsx)(w,{color:g.dim,children:"\u270E "})]}),(0,l.jsx)(ee,{value:a.text,onChange:e=>f(n=>n.at==="why"?{...n,text:e}:n),onSubmit:e=>{let n=s.current;n.at==="why"&&(e.trim()?me(n.item,e.trim()):f({at:"picker",items:[n.item],sel:0}))},onCancel:()=>{s.current.at==="why"&&W()},placeholder:`what should change about ${a.item.title}?`})]}),(0,l.jsx)(w,{color:g.muted,children:" \u23CE submit \xB7 esc back"})]}):null,a.at==="view"?(0,l.jsxs)(P,{marginTop:1,marginBottom:1,flexDirection:"column",children:[(0,l.jsxs)(w,{color:g.assuranceAccent,children:["\u2500\u2500 ",(0,l.jsx)(w,{bold:!0,children:J}),` ${"\u2500".repeat(he)}`]}),(0,l.jsx)(w,{children:" "}),x.current.map((e,n)=>(0,l.jsx)(U,{mark:e.mark,markColor:e.color==="green"?g.green:e.color==="red"?g.red:g.dim,color:e.color==="dim"?g.dim:void 0,indent:0,reserve:0,children:e.line},`vc-${n}`)),(0,l.jsx)(w,{children:" "}),(0,l.jsxs)(w,{color:g.assuranceAccent,children:["\u2500\u2500 ",(0,l.jsx)(w,{color:g.muted,children:"esc back"}),` ${"\u2500".repeat(ke)}`]})]}):null,(0,l.jsx)(ne,{verb:"maintain",subject:ge,state:pe?"idle":void 0,hints:"ctrl+c exit"})]})}async function qe(r){let p={current:null},b=o=>{p.current?.append(o)},C=null,u=async(o,d)=>{let[{runDesign:A},{resolveAgentAuthEnv:$},{runAgent:I},{preflightTurn:E}]=await Promise.all([import("./run-2COODVX2.js"),import("./spawner-J67QR4QP.js"),import("./bridge-5Z3BIB77.js"),import("./turn-preflight-JGYT7LXP.js")]);C??=await $();let T=C;return A({useCase:o,force:!0,mode:d.mode??"override",...d.because?{because:d.because}:{},...d.changeDelta!==void 0?{changeDelta:d.changeDelta}:{},...d.priorDesign!==void 0?{priorDesign:d.priorDesign}:{}},{contextDir:r.dir,agent:I,preflightTurn:()=>E(T),ask:async()=>[],out:()=>{},progress:()=>{},isTTY:!1,auth:T})},y=r.runDesign??u,k=de({contextDir:r.dir,held:r.held,archive:r.archive,planRows:r.rows,runDesign:y,mode:"interactive",signals:r.signals,reviewFeeder:()=>{try{return ce({contextDir:r.dir},O(r.dir))}catch{return[]}}}),t=new Set(r.rows.filter(o=>o.applied!==void 0).map(o=>o.held_ref??o.ref)),i=k.cards().filter(o=>!t.has(o.ref)&&!(o.kind==="ARCHIVE"&&r.archiveState?.[o.ref]!==void 0)),v=o=>r.rows.findIndex(d=>(d.held_ref??d.ref)===o),a=(o,d)=>{try{if(i.find(I=>I.ref===o)?.kind==="ARCHIVE"){d==="retired"?r.markA?.(o,"retired"):d==="skipped"&&r.markA?.(o,"skipped");return}let $=v(o);if($<0)return;d==="applied"||d==="committed"?r.mark?.($,"approved"):d==="skipped"&&r.mark?.($,"skipped")}catch{}},f=async o=>{let[{openGraph:d},{resolveParentUc:A,evolveOneUc:$}]=await Promise.all([import("./readmodel-XOYGGQ3S.js"),import("./evolve-cmd-BCPNXAMV.js")]),[I,...E]=o.split(/\s+/),T=d(r.dir),W=A(T,I);if(!W.ok)return`couldn't resolve '${I}' \u2014 start with a use-case id (uc-\u2026): ${W.message}`;if(E.length===0)return`say what to change: \`${I} <your words>\` \u2014 the words become the redesign's change delta`;let M=E.join(" "),F={out:()=>{},err:()=>{},isTTY:!1,confirm:async()=>!0},S=await $(r.dir,W.target,{yes:!0,mode:"override",because:M},F,y,"batch");return S.outcome==="evolved"?(r.signals({ref:W.target.display,verdict:"gap-resolved-evolve",reason:M}),`\u2713 redesigned ${W.target.display} \u2014 "${M}"`):`\u2717 evolve ${S.outcome} for ${W.target.display} (exit ${S.code})`},R=r.listEvolveTargets??(()=>{let o=O(r.dir);return ae(o).targets.map(d=>({key:d.display,title:d.display,badge:"stale"}))});if(r.script){let o=0;for(let d of i){let A=await r.script(d),$=await k.submit(d.ref,A);$.outcome==="failed"&&o===0&&(o=1),a(d.ref,ue($))}return o}let[{render:s},{ScrollbackProvider:x},{ScrollbackTap:h}]=await Promise.all([import("./build-JIKYOZUH.js"),import("./scrollback-JLPJR25X.js"),import("./ScrollbackTap-Q3IOKNMS.js")]);return new Promise(o=>{let d=!1,A=M=>{d||(d=!0,(async()=>{process.removeListener("SIGINT",T),await p.current?.flush();try{W.unmount()}catch{}o(M)})())},$=0,I={current:null},E=()=>{if($+=1,$>=2){process.removeListener("SIGINT",T);try{W.unmount()}catch{}o(130)}},T=()=>{E(),I.current?.()};process.on("SIGINT",T);let W=s((0,l.jsxs)(x,{children:[(0,l.jsx)(h,{into:p}),(0,l.jsx)(Re,{controller:k,cards:i,note:b,markOutcome:a,routeChat:f,listEvolveTargets:R,barSubject:r.barSubject,onFinish:A,onCtrlC:E,pauseRef:I})]}),{exitOnCtrlC:!1})})}export{Re as WalkSessionSurface,ue as outcomeToMark,qe as runWalkSession};
@@ -1,2 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a}from"./chunk-EDSZJZFG.js";import"./chunk-IP2O264K.js";import"./chunk-R5T4RLF5.js";import"./chunk-IDX3TOPY.js";import"./chunk-BKM2LWU2.js";import"./chunk-KBM3XHAM.js";import"./chunk-2YEHV2CX.js";import"./chunk-56PAQAX5.js";import"./chunk-5EOX4MEY.js";import"./chunk-RZ4F3BHX.js";import"./chunk-27U4PLPX.js";import"./chunk-UR6MHSHU.js";export{a as withTelemetry};