@testmuai/kane-cli 0.6.3 → 0.6.6

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 (174) hide show
  1. package/bin/kane-cli.cjs +91 -0
  2. package/bin/resolve-runtime.cjs +45 -0
  3. package/dist/ChatSurface-LV3KW6WN.js +8 -0
  4. package/dist/{ChromeProfilePicker-UUGUMJPI.js → ChromeProfilePicker-6PLUQ5TW.js} +1 -1
  5. package/dist/{CliFeedbackPrompt-JZWESL7Z.js → CliFeedbackPrompt-I4F56IVK.js} +1 -1
  6. package/dist/{CliUploadProgress-62U3LAUU.js → CliUploadProgress-ULRSPKY3.js} +1 -1
  7. package/dist/{ConfigView-WHEFCVHR.js → ConfigView-7NMYALEA.js} +1 -1
  8. package/dist/EvidenceViewOffer-KQKPTMXA.js +2 -0
  9. package/dist/{FolderPicker-HJUUHQEI.js → FolderPicker-4IOVDO2P.js} +1 -1
  10. package/dist/{HelpView-EWHP7LSJ.js → HelpView-SHMVMHNU.js} +1 -1
  11. package/dist/{InfoBox-GQQJVTI5.js → InfoBox-W2LZVGQS.js} +1 -1
  12. package/dist/{LinksBox-EWCPAZFN.js → LinksBox-ZS25VTBY.js} +1 -1
  13. package/dist/{ProfilesView-5FJNQMUW.js → ProfilesView-XBBRIQ3U.js} +1 -1
  14. package/dist/{ProjectPicker-IN7GFN7I.js → ProjectPicker-AUN47FXS.js} +1 -1
  15. package/dist/{SaveSessionPrompt-ISODGFP7.js → SaveSessionPrompt-Z2K225VN.js} +1 -1
  16. package/dist/SingleShotApp-M7R5PW4X.js +2 -0
  17. package/dist/{SummaryBox-R6WHU7VD.js → SummaryBox-4T545XRB.js} +1 -1
  18. package/dist/TestMdRunView-JXRXMACE.js +2 -0
  19. package/dist/{WhoamiView-YRQNOSOH.js → WhoamiView-GCVD35EX.js} +1 -1
  20. package/dist/bind-JLMT57Q3.js +6 -0
  21. package/dist/{bridge-7UMWMIJJ.js → bridge-PDJEOSAJ.js} +1 -1
  22. package/dist/{changelog-YQC2QDCO.js → changelog-D65HWZDM.js} +1 -1
  23. package/dist/{chat-committer-GHDZY5XF.js → chat-committer-ADJJTDUT.js} +1 -1
  24. package/dist/{chat-controller-QXFAB2DK.js → chat-controller-VAC57IEV.js} +1 -1
  25. package/dist/{chunk-B5LJCGAY.js → chunk-24OFJ7SE.js} +1 -1
  26. package/dist/{chunk-PJDOXRLB.js → chunk-24VYAMMK.js} +1 -1
  27. package/dist/chunk-262ES67I.js +14 -0
  28. package/dist/{chunk-CIW2KP4C.js → chunk-2BWRAY3Y.js} +1 -1
  29. package/dist/{chunk-KHDUQ33H.js → chunk-2PQXEEVY.js} +1 -1
  30. package/dist/{chunk-F66SSA4C.js → chunk-2WO7G2HO.js} +1 -1
  31. package/dist/{chunk-Y6LMHBLE.js → chunk-32GP7KTM.js} +1 -1
  32. package/dist/{chunk-NNZV5RCE.js → chunk-3C5GMAM4.js} +1 -1
  33. package/dist/{chunk-SHSV64GX.js → chunk-3Z3UIW5H.js} +1 -1
  34. package/dist/{chunk-OE7TVGNB.js → chunk-4A6BLXQN.js} +3 -3
  35. package/dist/chunk-4R2HOA7J.js +14 -0
  36. package/dist/{chunk-AV5SUGRY.js → chunk-4SXD6XWV.js} +1 -1
  37. package/dist/{chunk-FFL2TQEJ.js → chunk-5JJ245FW.js} +1 -1
  38. package/dist/chunk-5YPBPZUR.js +2 -0
  39. package/dist/chunk-64LC36AF.js +2 -0
  40. package/dist/{chunk-Z56AWGVY.js → chunk-6AYUSR7X.js} +1 -1
  41. package/dist/{chunk-Y7KW5AEN.js → chunk-6CZIEK6B.js} +1 -1
  42. package/dist/{chunk-VJUIW2ES.js → chunk-6GTOYTCQ.js} +1 -1
  43. package/dist/{chunk-EWFFJBAM.js → chunk-6NIV7AVZ.js} +1 -1
  44. package/dist/chunk-6SGPN76K.js +2 -0
  45. package/dist/{chunk-7MV5UF6O.js → chunk-6XHAXAL2.js} +1 -1
  46. package/dist/{chunk-AE6SS34N.js → chunk-74RUSHIB.js} +1 -1
  47. package/dist/{chunk-RLG5NUTE.js → chunk-AKHUNBQS.js} +1 -1
  48. package/dist/{chunk-53VDR5DN.js → chunk-BLSZ4H5W.js} +12 -12
  49. package/dist/{chunk-OGVIHL5G.js → chunk-BV5QKFMJ.js} +1 -1
  50. package/dist/{chunk-SL7AJ7JQ.js → chunk-C42WWO7Y.js} +1 -1
  51. package/dist/{chunk-FYOCF7DY.js → chunk-CJJXT5DO.js} +1 -1
  52. package/dist/chunk-D7L6UW5Z.js +7 -0
  53. package/dist/chunk-EHN5HTUD.js +147 -0
  54. package/dist/{chunk-P46TIMGQ.js → chunk-EOLQUB4Q.js} +1 -1
  55. package/dist/{chunk-C5POEXSX.js → chunk-EWTX7HSU.js} +2 -2
  56. package/dist/{chunk-RGEAEAZB.js → chunk-FJTWJ243.js} +1 -1
  57. package/dist/{chunk-CE664P73.js → chunk-GBBVP2JW.js} +1 -1
  58. package/dist/chunk-GLS46X7N.js +5 -0
  59. package/dist/{chunk-AD46OCZ4.js → chunk-GRB66C5S.js} +1 -1
  60. package/dist/{chunk-22A2ECA2.js → chunk-GYW7LVVL.js} +1 -1
  61. package/dist/{chunk-BO3JA2GS.js → chunk-HA5GE57Z.js} +15 -15
  62. package/dist/{chunk-VXGOWBET.js → chunk-HWA7WD44.js} +1 -1
  63. package/dist/{chunk-7YQW4TFI.js → chunk-JF7Q2I45.js} +1 -1
  64. package/dist/{chunk-TTSYHJLX.js → chunk-JTEY32TL.js} +1 -1
  65. package/dist/{chunk-DEEBPSJN.js → chunk-JU5KRCKD.js} +4 -4
  66. package/dist/chunk-JV356AYH.js +5 -0
  67. package/dist/chunk-K5JGCJ2K.js +6 -0
  68. package/dist/{chunk-UXJPCWGW.js → chunk-KI2DVQSA.js} +1 -1
  69. package/dist/chunk-KNCHEM6A.js +9 -0
  70. package/dist/{chunk-YZSYXNMB.js → chunk-KYHXDJN4.js} +1 -1
  71. package/dist/{chunk-326XAPMW.js → chunk-L26LU6TU.js} +2 -2
  72. package/dist/{chunk-WFRL54GK.js → chunk-LABIRPOT.js} +1 -1
  73. package/dist/{chunk-BFFCGEUH.js → chunk-LEQ2B3PR.js} +1 -1
  74. package/dist/{chunk-EEO4XWY6.js → chunk-LLS47HUA.js} +1 -1
  75. package/dist/{chunk-2S4S2XJC.js → chunk-LURGFJEE.js} +1 -1
  76. package/dist/{chunk-D5T4ARTB.js → chunk-MCQXRJGH.js} +1 -1
  77. package/dist/{chunk-2TVRHXRK.js → chunk-MSPZOEFB.js} +1 -1
  78. package/dist/{chunk-YZKPZXHY.js → chunk-MY32TBBR.js} +1 -1
  79. package/dist/{chunk-BGGNBWAJ.js → chunk-N6DO2LBH.js} +1 -1
  80. package/dist/{chunk-ARS72637.js → chunk-OFEOWKM3.js} +1 -1
  81. package/dist/{chunk-TZZYRDCF.js → chunk-P4HW2NTZ.js} +1 -1
  82. package/dist/{chunk-LMJTY32X.js → chunk-RHNKYNNZ.js} +1 -1
  83. package/dist/{chunk-RZFINU7J.js → chunk-RIMJDJWY.js} +1 -1
  84. package/dist/{chunk-ZKYYZ5NO.js → chunk-RN4OSVTG.js} +2 -2
  85. package/dist/{chunk-ME5QSYWX.js → chunk-RV2NXHIC.js} +1 -1
  86. package/dist/{chunk-SQFNMZJ2.js → chunk-S2C62SDY.js} +1 -1
  87. package/dist/chunk-SJ2KQKOV.js +3 -0
  88. package/dist/{chunk-G6AF2JUA.js → chunk-UZJ7MRBV.js} +1 -1
  89. package/dist/{chunk-XBE7PGVY.js → chunk-VBCE4U4B.js} +1 -1
  90. package/dist/chunk-WIA7TPK3.js +2 -0
  91. package/dist/{chunk-F2K3XFFH.js → chunk-WJGBXJT4.js} +2 -2
  92. package/dist/{chunk-7LFCSSPX.js → chunk-WWH7CW5R.js} +1 -1
  93. package/dist/{chunk-NFGG5DA2.js → chunk-XQL53VB7.js} +1 -1
  94. package/dist/{chunk-B2PZAB7J.js → chunk-ZG2V2ODK.js} +1 -1
  95. package/dist/{chunk-GIRXJOJI.js → chunk-ZZLR3O5A.js} +1 -1
  96. package/dist/{config-5OOP2BO3.js → config-6PAZZ7CR.js} +1 -1
  97. package/dist/{cover-cmd-Y5L4O4Q3.js → cover-cmd-K3LCXHAQ.js} +1 -1
  98. package/dist/{credentials-XCP6DJZZ.js → credentials-BJCIWQWA.js} +1 -1
  99. package/dist/descriptor-EHK3DRCZ.js +2 -0
  100. package/dist/{evidence-AX67Q6RN.js → evidence-7VE5EGEF.js} +1 -1
  101. package/dist/evolve-cmd-RUGUWKAG.js +2 -0
  102. package/dist/explain-VFIZTHFN.js +2 -0
  103. package/dist/{explain-cmd-RIDEMDMY.js → explain-cmd-KV5YUXKB.js} +1 -1
  104. package/dist/{explain-cmd-55WRDIMW.js → explain-cmd-U367SD4N.js} +1 -1
  105. package/dist/{extract-bind-ZDAXRQUS.js → extract-bind-YS7C4KZ3.js} +2 -2
  106. package/dist/{extract-cmd-5GGI6LAM.js → extract-cmd-Z4PMDIMZ.js} +2 -2
  107. package/dist/{gaps-cmd-P2DRK6FW.js → gaps-cmd-DTVDIOED.js} +1 -1
  108. package/dist/{gate-FACZRGOC.js → gate-B6C6KLFA.js} +1 -1
  109. package/dist/{generate-headless-DRDE46ON.js → generate-headless-IWY32HC4.js} +2 -2
  110. package/dist/{headless-io-GXHKDPHB.js → headless-io-PWW6YKH2.js} +1 -1
  111. package/dist/index.js +43 -43
  112. package/dist/ingest-C5ANIN7S.js +2 -0
  113. package/dist/ingest-cmd-LLC5CDQ5.js +3 -0
  114. package/dist/interactive-bind-ZIIJDRBU.js +7 -0
  115. package/dist/{lifecycle-cmd-55NZL3UO.js → lifecycle-cmd-BXE5IMFN.js} +1 -1
  116. package/dist/{list-cmd-JB2ABACD.js → list-cmd-KBWPYJMV.js} +1 -1
  117. package/dist/{list-commands-UDAL3SBY.js → list-commands-SSXJQGE7.js} +1 -1
  118. package/dist/{logical-ids-ATVR6PF2.js → logical-ids-3Y6RX5C2.js} +1 -1
  119. package/dist/login-flow-HRS6YACY.js +2 -0
  120. package/dist/{maintenance-cmd-E3HEEVQW.js → maintenance-cmd-VS3APIUN.js} +1 -1
  121. package/dist/{persist-recorded-session-BW3YSFMP.js → persist-recorded-session-3AOYZJT2.js} +1 -1
  122. package/dist/pipeline-IZSODNCC.js +2 -0
  123. package/dist/readmodel-XOGOELUP.js +2 -0
  124. package/dist/reconcile-cmd-6HVZJFG3.js +2 -0
  125. package/dist/{recording-banner-6FVTCUWQ.js → recording-banner-KKEUWS3N.js} +1 -1
  126. package/dist/{require-project-folder-AQUVEEJB.js → require-project-folder-NPTKR2AW.js} +1 -1
  127. package/dist/{revert-3TKLOYQA.js → revert-AQQ2VHRM.js} +1 -1
  128. package/dist/{review-cmd-RXPPC5GK.js → review-cmd-4WZUUOE4.js} +1 -1
  129. package/dist/run-2A7M7EJK.js +2 -0
  130. package/dist/run-6AFY35QW.js +2 -0
  131. package/dist/{run-test-md-AUK7NGLL.js → run-test-md-QNC6KDMN.js} +2 -2
  132. package/dist/{skill-installer-2MNPCPRD.js → skill-installer-ULFNSE6X.js} +1 -1
  133. package/dist/{spawner-XCOMTJJC.js → spawner-DWONVIPI.js} +1 -1
  134. package/dist/tcg-generate-IHHPRVNG.js +2 -0
  135. package/dist/{testmd-actions-TU4KTO32.js → testmd-actions-S3ZNOZEK.js} +1 -1
  136. package/dist/token-refresh-CFVOA62N.js +2 -0
  137. package/dist/{validate-basic-IYMPP7C7.js → validate-basic-4OLDKIA2.js} +1 -1
  138. package/dist/{version-check-MUPSKONS.js → version-check-UL4S6R4N.js} +1 -1
  139. package/dist/{view-cmd-QE2FS3GB.js → view-cmd-FRMQF76B.js} +1 -1
  140. package/dist/walk-session-N3BP57HK.js +2 -0
  141. package/package.json +16 -8
  142. package/bin/kane-cli.js +0 -2
  143. package/dist/ChatSurface-J777M5WC.js +0 -8
  144. package/dist/EvidenceViewOffer-JQDEAE2T.js +0 -2
  145. package/dist/SingleShotApp-QANGFAPO.js +0 -2
  146. package/dist/TestMdRunView-74A3LCNE.js +0 -2
  147. package/dist/archive-committer-3NI773TP.js +0 -2
  148. package/dist/bind-FZ4X4SOK.js +0 -6
  149. package/dist/chunk-6RQAUK5F.js +0 -5
  150. package/dist/chunk-E4OYR32M.js +0 -2
  151. package/dist/chunk-FTD3B7QA.js +0 -2
  152. package/dist/chunk-GIGD4M7V.js +0 -5
  153. package/dist/chunk-I2S6KNZW.js +0 -2
  154. package/dist/chunk-IACKIGPX.js +0 -2
  155. package/dist/chunk-NFOBDHZK.js +0 -147
  156. package/dist/chunk-Q4HLQOJI.js +0 -7
  157. package/dist/chunk-SGU72YLH.js +0 -9
  158. package/dist/chunk-TY5LWU6I.js +0 -14
  159. package/dist/chunk-YANCBRER.js +0 -3
  160. package/dist/descriptor-SL5A7RQE.js +0 -2
  161. package/dist/distill-cmd-EYCCCFL3.js +0 -2
  162. package/dist/evolve-cmd-HR25DRTC.js +0 -2
  163. package/dist/explain-JIXUWEFJ.js +0 -2
  164. package/dist/ingest-4CGBXC2L.js +0 -2
  165. package/dist/ingest-cmd-X7BWGIN7.js +0 -3
  166. package/dist/interactive-bind-T6OBLZCT.js +0 -7
  167. package/dist/login-flow-LJ4BH3OS.js +0 -2
  168. package/dist/pipeline-TZJ652NT.js +0 -2
  169. package/dist/readmodel-MPTENJ2R.js +0 -2
  170. package/dist/reconcile-cmd-242S7XNO.js +0 -8
  171. package/dist/run-UGAOGR3B.js +0 -2
  172. package/dist/signals-cmd-LXHZQLXZ.js +0 -2
  173. package/dist/tcg-generate-E5X23RVP.js +0 -2
  174. package/dist/token-refresh-GGLARJV4.js +0 -2
@@ -0,0 +1,2 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{b as a,c as b,d as c}from"./chunk-SJ2KQKOV.js";import"./chunk-2PQXEEVY.js";import"./chunk-MCQXRJGH.js";import"./chunk-74RUSHIB.js";import"./chunk-ZZLR3O5A.js";import"./chunk-ZG2V2ODK.js";import"./chunk-5YPBPZUR.js";import"./chunk-UR6MHSHU.js";export{c as ingestFile,a as slugFromFilename,b as versionBaseOf};
@@ -0,0 +1,3 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{b as g,c as b,d as p}from"./chunk-SJ2KQKOV.js";import{c as l}from"./chunk-RN4OSVTG.js";import{a as f}from"./chunk-BC7UVJJB.js";import"./chunk-2PQXEEVY.js";import{a as d}from"./chunk-MCQXRJGH.js";import"./chunk-74RUSHIB.js";import"./chunk-ZZLR3O5A.js";import"./chunk-ZG2V2ODK.js";import"./chunk-5YPBPZUR.js";import"./chunk-UR6MHSHU.js";import{existsSync as $}from"fs";async function h(o,u,e,i=process.cwd()){let n=f(i);if(u.as!==void 0&&o.length>1)return(e.err??e.out)(`error: --as names ONE source identity \u2014 pass a single file (got ${o.length})`),2;for(let a of o){let m=u.as;if(e.isTTY&&m===void 0&&$(n)){let t=g(a),s=b(t);if(s){let c=d(n);c.heads.get(s)!=null&&c.heads.get(t)==null&&await e.confirm(`${t} looks like a new version of existing source '${s}' \u2014 ingest as '${s}' (moves its head)?`)&&(m=s)}}let r;try{r=await p({contextDir:n,filePath:a,asId:m,confirmSameSource:e.isTTY?t=>e.confirm(`identical bytes already ingested as ${t} \u2014 treat as the same source?`):void 0})}catch(t){return e.out(`error: ${a}: ${t instanceof Error?t.message:String(t)}`),1}if(e.out(`${r.status} ${r.source_id} source ${r.cid} blob ${r.blob}`),!e.isTTY&&r.status==="created"){let t=d(n);for(let[s,c]of t.heads.entries())if(!(s===r.source_id||c==null)&&t.getNode(c)?.content.blob===r.blob){e.out(`hint: identical bytes already ingested as ${s} \u2014 merged later via review`);break}}}return 0}async function Y(o,u){let{createInterface:e}=await import("readline/promises");return h(o,u,{out:i=>process.stdout.write(i+`
3
+ `),isTTY:l(),confirm:async i=>{let n=e({input:process.stdin,output:process.stdout});try{let a=await n.question(`${i} [Y/n] `);return!/^n(o)?$/i.test(a.trim())}finally{n.close()}}})}export{Y as ingestCommand,h as runIngestCommand};
@@ -0,0 +1,7 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{a as y}from"./chunk-WWH7CW5R.js";import"./chunk-KHU7C6EE.js";import"./chunk-3C5GMAM4.js";import"./chunk-KNCHEM6A.js";import"./chunk-FXPPQL4D.js";import"./chunk-RE3BZVGE.js";import"./chunk-6PS65QFF.js";import"./chunk-JFAFKHDX.js";import"./chunk-WIA7TPK3.js";import"./chunk-QPZRHAYK.js";import"./chunk-6GTOYTCQ.js";import"./chunk-YKTYVJBN.js";import"./chunk-6AYUSR7X.js";import"./chunk-427OQS2N.js";import{c as k}from"./chunk-RN4OSVTG.js";import"./chunk-FJTWJ243.js";import{a as v}from"./chunk-BC7UVJJB.js";import"./chunk-2PQXEEVY.js";import"./chunk-L5LI2JF4.js";import"./chunk-MCQXRJGH.js";import"./chunk-74RUSHIB.js";import"./chunk-ZZLR3O5A.js";import"./chunk-ZG2V2ODK.js";import"./chunk-5YPBPZUR.js";import"./chunk-6SGPN76K.js";import"./chunk-UR6MHSHU.js";async function j(t){let[{render:u},o,{QuestionBatchPrompt:p}]=await Promise.all([import("./build-JIKYOZUH.js"),import("./react-QWOAB3TB.js"),import("./ui-JEJGTURD.js")]),i=o.default??o;return new Promise(e=>{let m=u(i.createElement(p,{questions:t,onSubmit:a=>{m.unmount(),e(a)}}))})}async function q(t){let[{resolveAgentAuthEnv:u},{runAgent:o},{preflightTurn:p}]=await Promise.all([import("./spawner-DWONVIPI.js"),import("./bridge-PDJEOSAJ.js"),import("./turn-preflight-JGYT7LXP.js")]),i=await u(),e=v(process.cwd()),{baseUrlAdvisory:m}=await import("./turn-preflight-JGYT7LXP.js"),a=m();a&&process.stderr.write(a+`
3
+ `);let d=await p(i);if(!d.ok)return process.stderr.write((d.message??"error: turn-endpoint preflight failed")+`
4
+ `),2;let T=async()=>d;if(t.plan)return y(t,{contextDir:e,agent:o,preflightTurn:T,ask:j,out:r=>process.stdout.write(r+`
5
+ `),progress:r=>process.stderr.write(r+`
6
+ `),isTTY:k(),auth:i});if(!t.resume){let[{openGraph:r},{designGate:s}]=await Promise.all([import("./readmodel-XOGOELUP.js"),import("./gate-B6C6KLFA.js")]),w=s(r(e),t.useCase,!!t.force);if(!w.ok)return process.stderr.write(`design: ${w.message}
7
+ `),w.code}let[{render:C},b,{ScrollbackProvider:A},{ChatSurface:D},{ScrollbackTap:E},{makeChatController:R},{setInkExit:S},G]=await Promise.all([import("./build-JIKYOZUH.js"),import("./react-QWOAB3TB.js"),import("./scrollback-JLPJR25X.js"),import("./ChatSurface-LV3KW6WN.js"),import("./ScrollbackTap-Q3IOKNMS.js"),import("./chat-controller-VAC57IEV.js"),import("./exit-manager-VCSIUYBR.js"),Promise.all([import("./chat-committer-ADJJTDUT.js"),import("./descriptor-EHK3DRCZ.js"),import("./explain-VFIZTHFN.js"),import("./readmodel-XOGOELUP.js")])]),[{commitChatTurn:I},{topologyDescriptor:O},{explain:Q},{openGraph:x}]=G,f=b.default??b,n=R({commitChatTurn:I,descriptor:O("design"),contextDir:e,refreshGraph:()=>x(e),graph:x(e),explain:Q,by:{kind:"human",id:"owner"}}),g={current:null},P=0,h=null,c=!1,Y=()=>{if(P+=1,P>=2){try{l.unmount()}catch{}process.exit(130)}n.requestPause(),h=setTimeout(()=>{c||(c=!0,(async()=>{n.ledger({kind:"interrupted",detail:"the agent did not confirm the pause within 5s"}),await g.current?.flush();try{l.unmount()}catch{}process.exit(130)})())},5e3)},l=C(f.createElement(A,null,f.createElement(E,{into:g}),f.createElement(D,{controller:n,verb:"design",onCtrlC:Y})),{exitOnCtrlC:!1});S(()=>l.unmount()),n.ledger({kind:"banner",text:`kane-cli design \xB7 ${t.useCase??t.resume??""}`});try{let r=y(t,{contextDir:e,agent:o,preflightTurn:T,ask:s=>n.ask(s),out:s=>n.note(s),progress:()=>{},isTTY:k(),auth:i,chat:n});return r.finally(()=>{c=!0}),await r}finally{c=!0,h&&clearTimeout(h),await g.current?.flush();try{l.unmount()}catch{}}}export{q as bindDesignInteractive};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as b,b as a,c as f,d as m}from"./chunk-AD46OCZ4.js";import{h as p,i as y}from"./chunk-FTD3B7QA.js";import"./chunk-QPZRHAYK.js";import"./chunk-ZKYYZ5NO.js";import"./chunk-BC7UVJJB.js";import{a as c}from"./chunk-D5T4ARTB.js";import"./chunk-AE6SS34N.js";import"./chunk-GIRXJOJI.js";import"./chunk-B2PZAB7J.js";import"./chunk-IACKIGPX.js";import"./chunk-UR6MHSHU.js";var g={kind:"human",id:process.env.USER??"operator"},$=/^(UNKNOWN_|BAD_|INVALID_|MALFORMED_|NOT_|SLUG_TAKEN|ALREADY_|SUPERSEDED_)/;function h(e){return e.every(r=>$.test(r.code))?2:1}function l(e,r){for(let n of r)b(e,`${n.code}: ${n.detail}`);return h(r)}async function w(e,r,n,t=process.cwd()){let s=a(t,n);if(!s||!await f(n,`retire source ${e} (head \u2192 null + tombstone record)`,r.yes))return 2;let i=c(s),o=y({contextDir:s,graph:i,sourceId:e,reason:r.reason,by:g});return o.errors?l(n,o.errors):(n.out(`retired ${e} (record ${o.record.seq}) \u2014 its use-cases stay until no live source evidences them`),0)}async function x(e,r,n,t=process.cwd()){let s=a(t,n);if(!s)return 2;let i=c(s),o=p({contextDir:s,graph:i,assignments:[{ref:e,slug:r}],by:g});return o.errors?l(n,o.errors):(n.out(`named ${o.record.names[0].cid} as "${r}" (record ${o.record.seq})`),0)}async function O(e,r,n,t=process.cwd()){let s=a(t,n);if(!s)return 2;let i=Number(e);if(!await f(n,`revert record ${i} via a compensation record`,r.yes))return 2;let o=c(s),{commitRevert:v}=await import("./revert-3TKLOYQA.js"),d=v({contextDir:s,graph:o,seq:i,reason:r.reason,by:g});for(let C of d.warnings)n.out(`note: ${C}`);if(d.errors)return l(n,d.errors);let u=d.record;return n.out(`reverted record ${i} via compensation record ${u.seq}: ${u.supersessions.length} supersession(s), ${u.review.length} trust restoration(s), ${Object.keys(u.source_head_moves).length} head move(s) \u2014 history unchanged, effects inverted`),0}async function A(e,r){return w(e,r,m())}async function P(e,r){return x(e,r,m())}async function I(e={},r=process.cwd()){return D(e,m(),r)}async function D(e,r,n=process.cwd()){let t=a(n,r);if(!t||!await f(r,"assign logical ids to every live unnamed node (one commit record)",e.yes))return 2;let{backfillLogicalIds:s}=await import("./logical-ids-ATVR6PF2.js"),i=c(t),o=s(t,i);return o.errors?l(r,o.errors):(r.out(o.assigned===0?"backfill: every live node already has a logical id":`backfill: assigned ${o.assigned} logical id(s) (record ${o.record.seq})`),0)}async function R(e,r){return O(e,r,m())}export{I as nameBackfillCommand,P as nameCommand,A as retireCommand,R as revertCommand,D as runNameBackfillCommand,x as runNameCommand,w as runRetireCommand,O as runRevertCommand};
2
+ import{a as b,b as a,c as f,d as m}from"./chunk-GRB66C5S.js";import{h as p,i as y}from"./chunk-WIA7TPK3.js";import"./chunk-QPZRHAYK.js";import"./chunk-RN4OSVTG.js";import"./chunk-BC7UVJJB.js";import{a as c}from"./chunk-MCQXRJGH.js";import"./chunk-74RUSHIB.js";import"./chunk-ZZLR3O5A.js";import"./chunk-ZG2V2ODK.js";import"./chunk-5YPBPZUR.js";import"./chunk-UR6MHSHU.js";var g={kind:"human",id:process.env.USER??"operator"},$=/^(UNKNOWN_|BAD_|INVALID_|MALFORMED_|NOT_|SLUG_TAKEN|ALREADY_|SUPERSEDED_)/;function h(e){return e.every(r=>$.test(r.code))?2:1}function l(e,r){for(let n of r)b(e,`${n.code}: ${n.detail}`);return h(r)}async function w(e,r,n,t=process.cwd()){let s=a(t,n);if(!s||!await f(n,`retire source ${e} (head \u2192 null + tombstone record)`,r.yes))return 2;let i=c(s),o=y({contextDir:s,graph:i,sourceId:e,reason:r.reason,by:g});return o.errors?l(n,o.errors):(n.out(`retired ${e} (record ${o.record.seq}) \u2014 its use-cases stay until no live source evidences them`),0)}async function x(e,r,n,t=process.cwd()){let s=a(t,n);if(!s)return 2;let i=c(s),o=p({contextDir:s,graph:i,assignments:[{ref:e,slug:r}],by:g});return o.errors?l(n,o.errors):(n.out(`named ${o.record.names[0].cid} as "${r}" (record ${o.record.seq})`),0)}async function O(e,r,n,t=process.cwd()){let s=a(t,n);if(!s)return 2;let i=Number(e);if(!await f(n,`revert record ${i} via a compensation record`,r.yes))return 2;let o=c(s),{commitRevert:v}=await import("./revert-AQQ2VHRM.js"),d=v({contextDir:s,graph:o,seq:i,reason:r.reason,by:g});for(let C of d.warnings)n.out(`note: ${C}`);if(d.errors)return l(n,d.errors);let u=d.record;return n.out(`reverted record ${i} via compensation record ${u.seq}: ${u.supersessions.length} supersession(s), ${u.review.length} trust restoration(s), ${Object.keys(u.source_head_moves).length} head move(s) \u2014 history unchanged, effects inverted`),0}async function A(e,r){return w(e,r,m())}async function P(e,r){return x(e,r,m())}async function I(e={},r=process.cwd()){return D(e,m(),r)}async function D(e,r,n=process.cwd()){let t=a(n,r);if(!t||!await f(r,"assign logical ids to every live unnamed node (one commit record)",e.yes))return 2;let{backfillLogicalIds:s}=await import("./logical-ids-3Y6RX5C2.js"),i=c(t),o=s(t,i);return o.errors?l(r,o.errors):(r.out(o.assigned===0?"backfill: every live node already has a logical id":`backfill: assigned ${o.assigned} logical id(s) (record ${o.record.seq})`),0)}async function R(e,r){return O(e,r,m())}export{I as nameBackfillCommand,P as nameCommand,A as retireCommand,R as revertCommand,D as runNameBackfillCommand,x as runNameCommand,w as runRetireCommand,O as runRevertCommand};
@@ -1,3 +1,3 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{b as m}from"./chunk-AD46OCZ4.js";import"./chunk-ZKYYZ5NO.js";import"./chunk-BC7UVJJB.js";import{a as g}from"./chunk-D5T4ARTB.js";import"./chunk-AE6SS34N.js";import"./chunk-GIRXJOJI.js";import"./chunk-B2PZAB7J.js";import{d as o}from"./chunk-IACKIGPX.js";import"./chunk-UR6MHSHU.js";var p=[o.SOURCE,o.USECASE,o.SCENARIO,o.AC,o.TEST,o.GAP];function h(n,e){if(n===o.SOURCE)return String(e.source_id??"");let i=e.question?.header,l=e.title??e.text??i??e.kind??"";return String(l)}function E(n,e){if(n.length<=e)return n;let i=n.slice(0,e-1),l=i.lastIndexOf(" ");return`${(l>e*.6?i.slice(0,l):i).trimEnd()}\u2026`}var b=58;async function O(n,e,i=process.cwd()){let l=m(i,e);if(!l)return 2;let a=g(l),s=[...a.nodeLabel.entries()].filter(([t])=>n.all||!a.superseded.has(t)).map(([t,r])=>{let u=a.getNode(t)?.content??{},f=a.trust.get(t)??(r===o.SOURCE?"-":"derived");return{id:r===o.SOURCE?String(u.source_id??""):a.nameOf.get(t)??t.slice(0,19),cid:t,label:r,title:h(r,u),trust:f,fresh:f==="archived"?"-":a.stale(t)}});if(n.type&&(s=s.filter(t=>t.label===n.type)),n.inferred&&(s=s.filter(t=>t.trust==="derived")),n.stale&&(s=s.filter(t=>t.fresh!=="fresh")),!n.all){let t=new Map;for(let r of s)t.set(`${r.label}:${r.id}`,r);s=[...t.values()]}let d=t=>{let r=p.indexOf(t);return r===-1?p.length:r};if(s.sort((t,r)=>d(t.label)-d(r.label)||t.title.localeCompare(r.title)),n.json){for(let t of s)e.out(JSON.stringify(t));return 0}if(s.length===0)return e.out("(no matching nodes)"),0;e.out("trust \xB7 fresh \xB7 title \xB7 id");let c=null;for(let t of s){if(t.label!==c){c=t.label;let u=s.filter(f=>f.label===t.label).length;e.out(""),e.out(`\u2500\u2500 ${t.label} \xB7 ${u} \u2500\u2500`)}let r=E(t.title||"(untitled)",b);e.out(` ${t.trust.padEnd(8)} ${t.fresh.padEnd(6)} ${r.padEnd(b)} ${t.id}`)}return 0}async function R(n){return O(n,{out:e=>process.stdout.write(e+`
2
+ import{b as m}from"./chunk-GRB66C5S.js";import"./chunk-RN4OSVTG.js";import"./chunk-BC7UVJJB.js";import{a as g}from"./chunk-MCQXRJGH.js";import"./chunk-74RUSHIB.js";import"./chunk-ZZLR3O5A.js";import"./chunk-ZG2V2ODK.js";import{d as o}from"./chunk-5YPBPZUR.js";import"./chunk-UR6MHSHU.js";var p=[o.SOURCE,o.USECASE,o.SCENARIO,o.AC,o.TEST,o.GAP];function h(n,e){if(n===o.SOURCE)return String(e.source_id??"");let i=e.question?.header,l=e.title??e.text??i??e.kind??"";return String(l)}function E(n,e){if(n.length<=e)return n;let i=n.slice(0,e-1),l=i.lastIndexOf(" ");return`${(l>e*.6?i.slice(0,l):i).trimEnd()}\u2026`}var b=58;async function O(n,e,i=process.cwd()){let l=m(i,e);if(!l)return 2;let a=g(l),s=[...a.nodeLabel.entries()].filter(([t])=>n.all||!a.superseded.has(t)).map(([t,r])=>{let u=a.getNode(t)?.content??{},f=a.trust.get(t)??(r===o.SOURCE?"-":"derived");return{id:r===o.SOURCE?String(u.source_id??""):a.nameOf.get(t)??t.slice(0,19),cid:t,label:r,title:h(r,u),trust:f,fresh:f==="archived"?"-":a.stale(t)}});if(n.type&&(s=s.filter(t=>t.label===n.type)),n.inferred&&(s=s.filter(t=>t.trust==="derived")),n.stale&&(s=s.filter(t=>t.fresh!=="fresh")),!n.all){let t=new Map;for(let r of s)t.set(`${r.label}:${r.id}`,r);s=[...t.values()]}let d=t=>{let r=p.indexOf(t);return r===-1?p.length:r};if(s.sort((t,r)=>d(t.label)-d(r.label)||t.title.localeCompare(r.title)),n.json){for(let t of s)e.out(JSON.stringify(t));return 0}if(s.length===0)return e.out("(no matching nodes)"),0;e.out("trust \xB7 fresh \xB7 title \xB7 id");let c=null;for(let t of s){if(t.label!==c){c=t.label;let u=s.filter(f=>f.label===t.label).length;e.out(""),e.out(`\u2500\u2500 ${t.label} \xB7 ${u} \u2500\u2500`)}let r=E(t.title||"(untitled)",b);e.out(` ${t.trust.padEnd(8)} ${t.fresh.padEnd(6)} ${r.padEnd(b)} ${t.id}`)}return 0}async function R(n){return O(n,{out:e=>process.stdout.write(e+`
3
3
  `),confirm:async()=>!1,isTTY:!!process.stdout.isTTY})}export{E as capWord,R as listCommand,O as runListCommand,h as titleOf};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a,b,c,d,e,f,g,h,i}from"./chunk-326XAPMW.js";import"./chunk-FPFOW6BS.js";import"./chunk-WAOCHXJ5.js";import"./chunk-M5JQXOCE.js";import"./chunk-2WVKOZ6W.js";import"./chunk-NLCCBXXV.js";import"./chunk-RZ4F3BHX.js";import"./chunk-RLG5NUTE.js";import"./chunk-TZZYRDCF.js";import"./chunk-E4OYR32M.js";import"./chunk-UR6MHSHU.js";export{d as emitNdjson,b as filterByName,g as formatAuthResolutionError,c as paginate,a as parsePagination,i as registerListCommands,e as renderTable,f as resolveTmsBasicAuth,h as validateCreateName};
2
+ import{a,b,c,d,e,f,g,h,i}from"./chunk-L26LU6TU.js";import"./chunk-FPFOW6BS.js";import"./chunk-WAOCHXJ5.js";import"./chunk-M5JQXOCE.js";import"./chunk-2WVKOZ6W.js";import"./chunk-NLCCBXXV.js";import"./chunk-RZ4F3BHX.js";import"./chunk-AKHUNBQS.js";import"./chunk-P4HW2NTZ.js";import"./chunk-6SGPN76K.js";import"./chunk-UR6MHSHU.js";export{d as emitNdjson,b as filterByName,g as formatAuthResolutionError,c as paginate,a as parsePagination,i as registerListCommands,e as renderTable,f as resolveTmsBasicAuth,h as validateCreateName};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as d,b as f,h as m}from"./chunk-FTD3B7QA.js";import"./chunk-QPZRHAYK.js";import"./chunk-GIRXJOJI.js";import"./chunk-B2PZAB7J.js";import"./chunk-IACKIGPX.js";import"./chunk-UR6MHSHU.js";var y=Object.keys(d).filter(n=>n!=="source");function b(n,t,u={kind:"system",id:"logical-id-backfill"}){let l=new Set(t.names.keys()),r=[];for(let c of y)for(let{cid:s,content:e}of t.byLabel(c)){if(t.superseded.has(s)||t.nameOf.has(s))continue;let a=typeof e.title=="string"&&e.title||typeof e.intent=="string"&&e.intent||typeof e.statement=="string"&&e.statement||typeof e.text=="string"&&e.text||"",i=a?f(c,a,g=>l.has(g)):null;i&&(l.add(i),r.push({ref:s,slug:i}))}if(r.length===0)return{record:null,errors:null,assigned:0};let o=m({contextDir:n,graph:t,assignments:r,by:u});return o.errors?{record:null,errors:o.errors,assigned:0}:{record:o.record,errors:null,assigned:r.length}}export{b as backfillLogicalIds};
2
+ import{a as d,b as f,h as m}from"./chunk-WIA7TPK3.js";import"./chunk-QPZRHAYK.js";import"./chunk-ZZLR3O5A.js";import"./chunk-ZG2V2ODK.js";import"./chunk-5YPBPZUR.js";import"./chunk-UR6MHSHU.js";var y=Object.keys(d).filter(n=>n!=="source");function b(n,t,u={kind:"system",id:"logical-id-backfill"}){let l=new Set(t.names.keys()),r=[];for(let c of y)for(let{cid:s,content:e}of t.byLabel(c)){if(t.superseded.has(s)||t.nameOf.has(s))continue;let a=typeof e.title=="string"&&e.title||typeof e.intent=="string"&&e.intent||typeof e.statement=="string"&&e.statement||typeof e.text=="string"&&e.text||"",i=a?f(c,a,g=>l.has(g)):null;i&&(l.add(i),r.push({ref:s,slug:i}))}if(r.length===0)return{record:null,errors:null,assigned:0};let o=m({contextDir:n,graph:t,assignments:r,by:u});return o.errors?{record:null,errors:o.errors,assigned:0}:{record:o.record,errors:null,assigned:r.length}}export{b as backfillLogicalIds};
@@ -0,0 +1,2 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{a}from"./chunk-MSPZOEFB.js";import"./chunk-C42WWO7Y.js";import"./chunk-RFHMDQXZ.js";import"./chunk-RZ4F3BHX.js";import"./chunk-AKHUNBQS.js";import"./chunk-P4HW2NTZ.js";import"./chunk-6SGPN76K.js";import"./chunk-UR6MHSHU.js";export{a as LoginFlow};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{b as i,c,d as s}from"./chunk-AD46OCZ4.js";import"./chunk-ZKYYZ5NO.js";import{a as t}from"./chunk-BC7UVJJB.js";import{c as m,d as u}from"./chunk-AE6SS34N.js";import"./chunk-GIRXJOJI.js";import"./chunk-B2PZAB7J.js";import"./chunk-IACKIGPX.js";import"./chunk-UR6MHSHU.js";async function d(e,r=process.cwd()){if(!i(r,e))return 2;let o=u(t(r));if(o.ok)return e.out(`ok: ${o.records} record(s) verified, derived projection in parity`),0;for(let n of o.issues)e.out(`issue: ${n}`);return 1}async function f(e,r,o=process.cwd()){if(!i(o,r)||!await c(r,"wipe .context/derived and rebuild it from the verified commit chain",e.yes))return 2;let n=m(t(o));return r.out(`rebuilt: ${n.applied.seq} record(s) replayed, ${Object.keys(n.nodeLabel).length} node(s) projected`),0}async function l(){return d(s())}async function y(e={}){return f(e,s())}export{l as fsckCommand,y as rebuildCommand,d as runFsckCommand,f as runRebuildCommand};
2
+ import{b as i,c,d as s}from"./chunk-GRB66C5S.js";import"./chunk-RN4OSVTG.js";import{a as t}from"./chunk-BC7UVJJB.js";import{c as m,d as u}from"./chunk-74RUSHIB.js";import"./chunk-ZZLR3O5A.js";import"./chunk-ZG2V2ODK.js";import"./chunk-5YPBPZUR.js";import"./chunk-UR6MHSHU.js";async function d(e,r=process.cwd()){if(!i(r,e))return 2;let o=u(t(r));if(o.ok)return e.out(`ok: ${o.records} record(s) verified, derived projection in parity`),0;for(let n of o.issues)e.out(`issue: ${n}`);return 1}async function f(e,r,o=process.cwd()){if(!i(o,r)||!await c(r,"wipe .context/derived and rebuild it from the verified commit chain",e.yes))return 2;let n=m(t(o));return r.out(`rebuilt: ${n.applied.seq} record(s) replayed, ${Object.keys(n.nodeLabel).length} node(s) projected`),0}async function l(){return d(s())}async function y(e={}){return f(e,s())}export{l as fsckCommand,y as rebuildCommand,d as runFsckCommand,f as runRebuildCommand};
@@ -1,3 +1,3 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{g as h}from"./chunk-LMJTY32X.js";import{a as m,b as I,k as S,s as _}from"./chunk-RKWJG3WW.js";import{a as f}from"./chunk-XBE7PGVY.js";import"./chunk-NFOBDHZK.js";import"./chunk-L5LI2JF4.js";import"./chunk-E4OYR32M.js";import"./chunk-UR6MHSHU.js";async function v(e,s={}){e.flushRecorder();let o=e.recorder?.lastWrittenPath??null;if(!o)return e.log("info","PERSIST_SKIPPED","No recorded path \u2014 recorder.flush no-op",{reason:e.sessionName?"recorder_flush_failed":"no_session_name",session_name:e.sessionName}),null;let p;try{p=_(o)}catch(t){throw e.log("error","PERSIST_RESOLVE_FAILED","resolveTestMd threw",{error:t.message,recorded_path:o}),t}let i=e.getRunsAsStepRecords(),u=e.getFlows(),a=[],c=0;for(let t=0;t<i.length;t++){let r=i[t],l=u.slice(c,c+r.totalRunDirs);c+=r.totalRunDirs;let g=l.find(n=>n.status==="failed"||n.status==="error"),T=g?"failed":l.length===0?"skipped":"passed";a.push({rootStepIndex:t+1,status:T,duration_s:l.reduce((n,E)=>n+(E.duration??0),0),reason:g?.reason})}let P=a.some(t=>t.status==="failed")?"failed":"passed",D=new f().load().code_export?.language==="javascript"?"javascript":"python",d=I(o);e.log("info","PERSIST_START","Building staging dir",{recorded_path:o,output_dir:d,session_dir:e.sessionDir,step_count:i.length,flow_count:u.length});try{await h({resolvedTest:p,sessionDir:e.sessionDir,stepRunRecords:i,outcomes:a,overallStatus:P,startedISO:e.startedAt,durationS:a.reduce((t,r)=>t+(r.duration_s??0),0),sessionId:e.sessionId,commitId:e.sessionId,tmsIds:{testId:e.testId??void 0,testcaseId:s.testcaseId,projectId:s.projectId,folderId:s.folderId,orgId:s.orgId??e.orgId??void 0,sessionName:e.sessionName??m(o)},codeExportDir:s.codeExportDir,codeExportLanguage:D,packTestDir:s.packTestDir}),e.log("info","PERSIST_STAGING_OK","Staging dir built",{output_dir:d}),S(d),e.log("info","PERSIST_OK","Persist complete",{output_dir:d})}catch(t){let r=t;e.log("error","PERSIST_FAILED","staging build / atomic replace failed",{error:r.message,stack:r.stack,output_dir:d}),process.stderr.write(`[persist] staging build / atomic replace failed: ${r.message}
2
+ import{g as h}from"./chunk-RHNKYNNZ.js";import{a as m,b as I,k as S,s as _}from"./chunk-RKWJG3WW.js";import{a as f}from"./chunk-VBCE4U4B.js";import"./chunk-EHN5HTUD.js";import"./chunk-L5LI2JF4.js";import"./chunk-6SGPN76K.js";import"./chunk-UR6MHSHU.js";async function v(e,s={}){e.flushRecorder();let o=e.recorder?.lastWrittenPath??null;if(!o)return e.log("info","PERSIST_SKIPPED","No recorded path \u2014 recorder.flush no-op",{reason:e.sessionName?"recorder_flush_failed":"no_session_name",session_name:e.sessionName}),null;let p;try{p=_(o)}catch(t){throw e.log("error","PERSIST_RESOLVE_FAILED","resolveTestMd threw",{error:t.message,recorded_path:o}),t}let i=e.getRunsAsStepRecords(),u=e.getFlows(),a=[],c=0;for(let t=0;t<i.length;t++){let r=i[t],l=u.slice(c,c+r.totalRunDirs);c+=r.totalRunDirs;let g=l.find(n=>n.status==="failed"||n.status==="error"),T=g?"failed":l.length===0?"skipped":"passed";a.push({rootStepIndex:t+1,status:T,duration_s:l.reduce((n,E)=>n+(E.duration??0),0),reason:g?.reason})}let P=a.some(t=>t.status==="failed")?"failed":"passed",D=new f().load().code_export?.language==="javascript"?"javascript":"python",d=I(o);e.log("info","PERSIST_START","Building staging dir",{recorded_path:o,output_dir:d,session_dir:e.sessionDir,step_count:i.length,flow_count:u.length});try{await h({resolvedTest:p,sessionDir:e.sessionDir,stepRunRecords:i,outcomes:a,overallStatus:P,startedISO:e.startedAt,durationS:a.reduce((t,r)=>t+(r.duration_s??0),0),sessionId:e.sessionId,commitId:e.sessionId,tmsIds:{testId:e.testId??void 0,testcaseId:s.testcaseId,projectId:s.projectId,folderId:s.folderId,orgId:s.orgId??e.orgId??void 0,sessionName:e.sessionName??m(o)},codeExportDir:s.codeExportDir,codeExportLanguage:D,packTestDir:s.packTestDir}),e.log("info","PERSIST_STAGING_OK","Staging dir built",{output_dir:d}),S(d),e.log("info","PERSIST_OK","Persist complete",{output_dir:d})}catch(t){let r=t;e.log("error","PERSIST_FAILED","staging build / atomic replace failed",{error:r.message,stack:r.stack,output_dir:d}),process.stderr.write(`[persist] staging build / atomic replace failed: ${r.message}
3
3
  `)}return{recordedTestPath:o,outputDir:d}}export{v as persistRecordedSession};
@@ -0,0 +1,2 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{a,b,c}from"./chunk-GLS46X7N.js";import"./chunk-2YQ6TW77.js";import"./chunk-WAOCHXJ5.js";import"./chunk-4A6BLXQN.js";import"./chunk-CJJXT5DO.js";import"./chunk-FJTWJ243.js";import"./chunk-BC7UVJJB.js";import"./chunk-2PQXEEVY.js";import"./chunk-EHN5HTUD.js";import"./chunk-L5LI2JF4.js";import"./chunk-MCQXRJGH.js";import"./chunk-74RUSHIB.js";import"./chunk-ZZLR3O5A.js";import"./chunk-ZG2V2ODK.js";import"./chunk-5YPBPZUR.js";import"./chunk-2WVKOZ6W.js";import"./chunk-NLCCBXXV.js";import"./chunk-RZ4F3BHX.js";import"./chunk-AKHUNBQS.js";import"./chunk-6SGPN76K.js";import"./chunk-UR6MHSHU.js";export{c as UploadPipeline,b as packPresignEntry,a as readPackForUpload};
@@ -0,0 +1,2 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{a,b}from"./chunk-MCQXRJGH.js";import"./chunk-74RUSHIB.js";import"./chunk-ZZLR3O5A.js";import"./chunk-ZG2V2ODK.js";import"./chunk-5YPBPZUR.js";import"./chunk-UR6MHSHU.js";export{a as openGraph,b as staleForEvolve};
@@ -0,0 +1,2 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{a as G,b as Z,c as J,d as Q}from"./chunk-262ES67I.js";import"./chunk-GBBVP2JW.js";import{a as N,c as q,d as ue,f as z}from"./chunk-JV356AYH.js";import"./chunk-3C5GMAM4.js";import{a as P,b as le,d as de}from"./chunk-GRB66C5S.js";import{a as se,b as oe}from"./chunk-SJ2KQKOV.js";import{a as B,b as T,c as L,d as V,e as ce,g as I,h as K}from"./chunk-K5JGCJ2K.js";import{a as ae}from"./chunk-JFAFKHDX.js";import"./chunk-WIA7TPK3.js";import"./chunk-QPZRHAYK.js";import"./chunk-RN4OSVTG.js";import"./chunk-BC7UVJJB.js";import"./chunk-2PQXEEVY.js";import{a as x}from"./chunk-MCQXRJGH.js";import"./chunk-74RUSHIB.js";import"./chunk-ZZLR3O5A.js";import{e as F}from"./chunk-ZG2V2ODK.js";import"./chunk-5YPBPZUR.js";import"./chunk-UR6MHSHU.js";import{existsSync as ve,statSync as we}from"fs";import{basename as j,resolve as pe}from"path";var ge=new Set(["interactive","agent","ci","override"]);function ke(e,t){if(e.mode!==void 0&&!ge.has(e.mode))return{error:`--mode must be interactive | agent | ci | override, got '${e.mode}'`};let r=e.mode,n="reconcile without a TTY needs an explicit mode \u2014 pass --mode agent|ci|override, or --plan for a preview";return r==="interactive"&&!t?{error:n}:r||(t?"interactive":e.plan?"override":{error:n})}function ye(e,t,r,n){let i=pe(t,r);if(!ve(i)||!we(i).isFile())return{error:`--from '${r}' is not a file \u2014 pass the changed source document`};let p=se(i);if(!p.ok)return{error:`--from '${r}' is not an ingestable document \u2014 allowed: ${p.allowlist.join(", ")}`};let f=x(e);if(!f.heads.has(n))return{error:`unknown source '${n}' \u2014 see \`kane-cli context list --type source\``};if(f.heads.get(n)==null)return{error:`source '${n}' is retired \u2014 restore it first with \`kane-cli context revert\`, then reconcile`};let d=null;try{d=oe(i)}catch{}return d!==null&&d!==n&&f.heads.get(d)!=null?{error:`'${j(i)}' already backs live source '${d}' \u2014 did you mean --source-id ${d}? To truly move these bytes under '${n}', retire '${d}' first`}:{sourceId:n,filePath:i}}function O(e){return e==null?"(none)":e.slice(0,19)}function M(e,t,r){if(e.out(`reconcile ${t.source_id}: head ${t.head.status} \u2014 ${O(t.head.before)} \u2192 ${O(t.head.after)}`),e.out(`note: ${t.note}`),e.out(`skipped arms: ${t.skipped_arms}`),t.changed&&e.out(t.held?`extract ran in override mode; ${r?.defaultsTaken??0} default(s) auto-taken; matched-but-changed and new proposals HELD for your verdict (staged \u2014 nothing committed)`:`extract ran in override mode; ${r?.defaultsTaken??0} default(s) auto-taken; matched-but-changed proposals auto-committed as edits`),t.changed){let n=t.changeset??[];e.out(`changeset: ${n.length} item(s)`);for(let i of n)if(i.kind==="MODIFY")e.out(` [MODIFY] ${i.ref} \u2014 ${i.summary} (${O(i.old_cid)} \u2192 ${i.new_cid===null?"(staged)":O(i.new_cid)})`);else if(i.kind==="ADD")e.out(` [ADD] ${i.ref}`);else{e.out(` [ARCHIVE] ${i.ref} \u2014 ${i.why}`);let p=X(i.impact,"retiring drops");p&&e.out(` ${p}`)}}e.out(`plan: ${t.rows.length} row(s)`);for(let n of t.rows){e.out(` [${n.kind}] ${n.ref} \u2014 ${n.reason}`);let i=X(n.impact,"approving marks");i&&e.out(` ${i}`),e.out(` provenance: ${n.provenance}`),e.out(` action: ${n.action}`)}}function X(e,t){if(!e||e.stale_refs.length===0)return null;let r=e.direct_refs??[];return`impact: ${t} ${e.stale_refs.length} item(s) stale`+(r.length>0?` \u2014 ${r.length} directly touched: ${r.join(", ")}`:"")}function E(e){return e==="interactive"?"override":e}async function A(e,t,r,n,i,p,f=[],d="override",y,w,s,u,h){let l;try{l=K(e)}catch($){return P(n,$ instanceof Error?$.message:String($)),1}try{if(!r){let{runWalkSession:$}=await import("./walk-session-N3BP57HK.js");return await $({dir:e,rows:t,archive:f,held:y??null,childMode:d,runDesign:u??null,mark:p,markA:s,...w?{archiveState:w}:{},signals:k=>C(e,k.ref,k.verdict,k.reason),...h?{script:h}:{}})}return await $e(e,t,r,n,i,p,f,d,y,w)}finally{l()}}var H=e=>`${e} high-risk item(s) need a human \u2014 ci mode won't guess. Walk interactively or use --mode agent.`;function W(e,t,r){let n=t.rows;e({type:"reconcile_plan",source_id:t.source_id,plan_path:r,rows:n.map(i=>({kind:i.kind,ref:i.ref,why:i.reason})),archive:t.changeset.filter(i=>i.kind==="ARCHIVE").map(i=>({ref:i.ref,why:i.why}))})}function ne(e={}){return{type:"reconcile_summary",applied:0,skipped:0,deferred:0,plan_only:0,failed:0,paused:0,stale_created:0,...e}}var ee=ne();async function U(e,t,r,n,i,p,f,d,y){W(i,t,r);let w=t.changeset.filter(h=>h.kind==="ARCHIVE"&&y?.[h.ref]===void 0),s=t.rows,u;try{u=K(e)}catch(h){return i({type:"error",message:h instanceof Error?h.message:String(h)}),i(ne()),2}try{return await Re(e,t,r,n,i,p,f,s,w,d)}finally{u()}}async function Re(e,t,r,n,i,p,f,d,y,w){let s=0,u=0,h=0,l=0,$=0,k=0,a=0,R=new Set,v=(c,o)=>{try{w?.(c,o)}catch{}};for(let[c,o]of d.entries()){i({type:"reconcile_row_start",kind:o.kind,ref:o.ref,...o.impact?{stale:o.impact.stale_refs.length,direct:o.impact.direct_refs?.length??0}:{}});let g=(m,D,S)=>i({type:"reconcile_row_end",kind:o.kind,ref:o.ref,outcome:m,...D!==void 0?{exit_code:D}:{},...S?{detail:S}:{}});if(o.applied){u++,g("skipped");continue}if(o.kind==="REMOVE"){$++,g("plan-only");continue}if(o.held_ref&&t.held){let m=new Set;if(o.kind==="MODIFY"&&o.impact){let S=x(e);for(let re of o.impact.stale_refs){let ie=S.resolve(re);ie&&S.stale(ie.tip)==="fresh"&&m.add(re)}}let D=G(e,t.held,o.held_ref,te);if(!D.ok){h++,a===0&&(a=1),g("failed",1,D.message);continue}if(D.kind==="ADD"){let S=await n(D.ref,{yes:!0,mode:f});if(S!==0){S===3?(l++,a===0&&(a=3),g("paused",3)):(h++,a===0&&(a=1),g("failed",S));continue}}s++,D.kind!=="ADD"&&o.impact&&(k+=m.size),v(c,"approved"),C(e,o.ref,D.kind==="ADD"?"gap-resolved-create":"gap-resolved-evolve"),g("applied");continue}let _=N(x(e),o.ref);if(!_.ok){u++,g("skipped");continue}let b=_.target;if(R.has(b.ucTip)){u++,g("skipped");continue}if(o.kind==="ADD"){let m=await n(b.seamRef,{yes:!0,mode:f});if(m===3){l++,a===0&&(a=3),g("paused",3);continue}if(m!==0){h++,a===0&&(a=1),g("failed",m);continue}R.add(b.ucTip),s++,v(c,"approved"),C(e,o.ref,"gap-resolved-create"),g("applied")}else{let m=await q(e,b,{yes:!0,mode:f},p,n,"batch");m.outcome==="evolved"?(R.add(b.ucTip),s++,v(c,"approved"),C(e,o.ref,"gap-resolved-evolve"),g("applied")):m.outcome==="paused"?(l++,a===0&&(a=m.code),g("paused",m.code)):m.outcome==="failed"?(h++,a===0&&(a=1),g("failed",m.code)):(u++,g("skipped"))}}return y.length>0&&(i({type:"reconcile_paused",plan_path:r,pending:y.map(c=>({ref:c.ref,why:c.why}))}),l+=y.length,a===0&&(a=3)),i(ne({applied:s,skipped:u,plan_only:$,failed:h,paused:l,stale_created:k})),a}var te={kind:"human",id:process.env.USER??"operator"};function C(e,t,r,n){ae(e,{ts:new Date().toISOString(),command:"reconcile-walk",id:t,verdict:r,polarity:"preference",by:te,target:t,...n!==void 0?{reason:n}:{}})}async function $e(e,t,r,n,i,p,f=[],d="override",y,w){let s=0,u=0,h=0,l=0,$=0,k=0,a=0,R=new Set;for(let[v,c]of t.entries()){if(c.applied){n.out(`skipped ${c.ref} \u2014 already applied (${c.applied.outcome} at ${c.applied.at})`),u++;continue}let o=m=>{try{p?.(v,m)}catch(D){P(n,`could not record applied state for ${c.ref}: ${D instanceof Error?D.message:String(D)}`)}};if(c.kind==="REMOVE"){n.out(`REMOVE ${c.ref} \u2014 plan-only in this release (not executed)`),l++;continue}if(c.held_ref&&y){let m=G(e,y,c.held_ref,te);if(!m.ok){P(n,`held ${c.ref}: ${m.message}`),$++,a===0&&(a=1);continue}if(n.out(`committed ${m.ref} (${c.kind==="ADD"?"minted":"updated \u2014 old\u2192new redirect"})`),m.kind==="ADD"){let D=await i(m.ref,{yes:r,mode:d});if(D===3){n.out(`design session for ${m.ref} paused \u2014 resume with "kane-cli design tests --resume"`),k++,a===0&&(a=3),o("approved");continue}if(D!==0){P(n,`design run for ${m.ref} ended with exit code ${D}`),$++,a===0&&(a=1),o("approved");continue}}s++,o("approved"),C(e,c.ref,c.kind==="ADD"?"gap-resolved-create":"gap-resolved-evolve");continue}let g=x(e),_=N(g,c.ref);if(!_.ok){n.out(`skipped ${c.ref} \u2014 ${_.message}`),u++;continue}let b=_.target;if(R.has(b.ucTip)){n.out(`skipped ${c.ref} \u2014 use-case ${b.display} already handled in this walk`),u++;continue}if(c.kind==="ADD"){let m=await i(b.seamRef,{yes:r,mode:d});if(m===3){n.out(`design session for ${b.display} paused \u2014 resume with "kane-cli design tests --resume"; this row lands when that session completes`),k++,a===0&&(a=3);continue}if(m!==0){P(n,`design run for ${b.display} ended with exit code ${m}`),$++,a===0&&(a=1);continue}R.add(b.ucTip),s++,o("approved"),C(e,c.ref,"gap-resolved-create")}else{let m=await q(e,b,{yes:!0,mode:d},n,i,"batch");m.outcome==="evolved"?(R.add(b.ucTip),s++,o("approved"),C(e,c.ref,"gap-resolved-evolve")):m.outcome==="paused"?(k++,a===0&&(a=m.code)):m.outcome==="failed"?($++,a===0&&(a=m.code)):u++}}for(let v of f)if(v.kind==="ARCHIVE"&&w?.[v.ref]===void 0){n.out(`[ARCHIVE] ${v.ref} \u2014 ${v.why}`);{let c=X(v.impact,"retiring drops");c&&n.out(` ${c}`)}n.out(" plan-only \u2014 retire belongs to the interactive session (never headless)"),l++}return n.out(`reconcile walk: ${s} applied, ${u} skipped, ${h} deferred, ${l} plan-only`+($>0?`, ${$} failed`:"")+(k>0?`, ${k} paused`:"")),a}async function me(e,t,r,n,i,p=!1){let f=i.seams??{reingest:J(e,r),reextract:Q(e,{stage:p})},d=null,y={reingest:f.reingest,reextract:async s=>d=await f.reextract(s)},w;try{n.out(`reconciling ${t}: re-reading the source and comparing against the graph\u2026`),w=await(i.buildPlan??Z)(e,t,y)}catch(s){return P(n,`reconcile failed: ${s instanceof Error?s.message:String(s)}`),null}return w.changed&&M(n,w,d),w}async function _e(e,t,r,n,i){let p=T(e,t);if("error"in p)return P(n,p.error),2;let{plan:f,path:d}=p,y=r==="override"||r==="ci";if(t===void 0&&r==="interactive"&&n.isTTY&&!await n.confirm(`apply plan ${j(d)} for ${f.source_id} (created ${f.created})?`))return n.out(`not applying ${j(d)}`),0;let w=i.runDesignForUc??z,s=i.runDesignForUc??null,u=i.sessionScript,h=(R,v)=>I(d,R,v),l=(R,v)=>V(d,R,v),$=F(e);if($===f.head_pin){if(r==="agent"){let v=i.emitEvent??(()=>{});return U(e,Y(f),d,w,v,n,E(r),h,f.archive_state)}let R=L(f);return r==="ci"&&R.length>0?(P(n,H(R.length)),2):(n.out(`applying stored plan ${j(d)} for ${f.source_id} (${f.rows.length} row(s))`),A(e,f.rows,y,n,w,h,f.changeset??[],E(r),f.held,f.archive_state,l,s,u))}if(n.out(`graph moved since this plan (${O(f.head_pin)} \u2192 ${O($)}) \u2014 recomputing`),f.held)return he(e,f,n,i,r,w,!1);let k=await me(e,f.source_id,f.backing_path,n,i);if(!k)return 1;if(!k.changed)return M(n,k,null),0;if(r==="agent"){let R=i.emitEvent??(()=>{});return U(e,k,null,w,R,n,E(r))}let a=k.changeset.filter(R=>R.kind==="ARCHIVE");return r==="ci"&&a.length>0?(P(n,H(a.length)),2):A(e,k.rows,y,n,w,void 0,k.changeset,E(r),k.held,void 0,void 0,s,u)}function Y(e,t=!1){return{source_id:e.source_id,changed:!0,head:{status:"unchanged",before:e.head_pin,after:e.head_pin},note:e.note,skipped_arms:e.skipped_arms,changeset:e.changeset??[],rows:t?e.rows.filter(r=>r.applied===void 0):e.rows,...e.held?{held:e.held}:{}}}async function Pe(e,t,r,n,i,p,f){let d=n.runDesignForUc??null,y=n.sessionScript,w=ce(e,t);if(w===null)return null;if("error"in w)return P(r,w.error),2;let{plan:s,path:u}=w,h=s.rows.filter(a=>a.applied===void 0),l=L(s),$=n.emitEvent??(()=>{});if(h.length===0&&l.length===0){r.out(`already reconciled \u2014 plan ${s.created} applied ${s.rows.length} row(s)`);let a=ue(x(e)).staleCount;return a>0&&r.out(`${a} item(s) still stale \u2014 kane-cli maintain evolve --from-stale`),i==="agent"&&(W($,Y(s),u),$({...ee})),0}let k=F(e);return k!==s.head_pin?(r.out(`plan ${s.created} superseded \u2014 graph moved (${O(s.head_pin)} \u2192 ${O(k)}); recomputing`),he(e,s,r,n,i,p,f)):(r.out(`resuming plan ${s.created} \u2014 ${h.length} pending row(s)${l.length>0?`, ${l.length} undecided archive item(s)`:""}`),f?(M(r,Y(s),null),r.out(`plan stored: ${u}`),0):i==="agent"?U(e,Y(s),u,p,$,r,E(i),(a,R)=>I(u,a,R),s.archive_state):i==="ci"&&l.length>0?(P(r,H(l.length)),2):A(e,s.rows,i==="override"||i==="ci",r,p,(a,R)=>I(u,a,R),s.changeset??[],E(i),s.held,s.archive_state,(a,R)=>V(u,a,R),d,y))}async function he(e,t,r,n,i,p,f){let d=n.runDesignForUc??null,y=n.sessionScript,w;if(t.held){let c=x(e),o=new Set(t.rows.filter(_=>_.held_ref!==void 0&&_.applied!==void 0).map(_=>_.held_ref)),g=[];for(let _ of t.held.rows){if(o.has(_.temp_ref))continue;if(!_.matched_cid){g.push(_);continue}let b=c.tipOf(_.matched_cid);if(c.superseded.get(b)===null){r.out(`dropped held "${_.title}" \u2014 its use-case was retired meanwhile`);continue}g.push(b===_.matched_cid?_:{..._,matched_cid:b,uc:{..._.uc,matches_existing:{cid:b}}})}w={source_id:t.held.source_id,rows:g}}let s=n.seams??{reingest:J(e,t.backing_path),reextract:Q(e,{stage:w!==void 0})},u;try{u=await(n.buildPlan??Z)(e,t.source_id,s,{resumeHeld:w})}catch(c){return P(r,`reconcile failed: ${c instanceof Error?c.message:String(c)}`),1}M(r,u,null);let h=F(e),l=null;if(h!=null){let c={},o=new Set(u.changeset.filter(g=>g.kind==="ARCHIVE").map(g=>g.ref));for(let[g,_]of Object.entries(t.archive_state??{}))o.has(g)&&(c[g]=_);l=B(e,{version:2,source_id:u.source_id,backing_path:t.backing_path,head_pin:h,created:new Date().toISOString().replace(/[:.]/g,"-"),skipped_arms:u.skipped_arms,note:u.note,changeset:u.changeset,rows:u.rows,...u.held?{held:u.held}:{},...Object.keys(c).length>0?{archive_state:c}:{}}),r.out(`plan stored: ${l}`)}if(f)return 0;let $=n.emitEvent??(()=>{}),k=l?T(e,l).plan.archive_state:void 0,a=l?(c,o)=>I(l,c,o):void 0,R=l?(c,o)=>V(l,c,o):void 0;if(i==="agent")return U(e,u,l,p,$,r,E(i),a,k);let v=u.changeset.filter(c=>c.kind==="ARCHIVE"&&k?.[c.ref]===void 0);return i==="ci"&&v.length>0?(P(r,H(v.length)),2):A(e,u.rows,i==="override"||i==="ci",r,p,a,u.changeset,E(i),u.held,k,R,d,y)}async function fe(e,t,r={},n=process.cwd()){let i=e.apply!==void 0&&e.apply!==!1,p=typeof e.apply=="string"?e.apply:void 0;if(e.plan&&i)return P(t,"pass --plan OR --apply, not both"),2;if((e.from!==void 0||!i)&&(!e.from||!e.sourceId))return P(t,"reconcile needs --from <file> AND --source-id <id> \u2014 see `kane-cli context list --type source` for ids"),2;if(e.from&&p!==void 0)return P(t,"pass --from OR --apply <path>, not both \u2014 a stored plan names its own source"),2;let d=le(n,t);if(!d)return 2;if(e.mode!==void 0&&!ge.has(e.mode))return P(t,`--mode must be interactive | agent | ci | override, got '${e.mode}'`),2;let y=e.mode==="agent"||e.mode==="ci"||e.mode==="override";if(i&&!y&&!t.isTTY)return P(t,"refusing to apply without a TTY to confirm \u2014 pass --mode override|ci"),2;let w=!e.plan,s="override";if(e.from){let o=ke(e,t.isTTY);if(typeof o=="object")return P(t,o.error),2;s=o}let u=s==="override"||s==="ci";if(i&&!e.from){let o=e.mode??"interactive";return _e(d,p===void 0?void 0:pe(n,p),o,t,r)}let h=ye(d,n,e.from,e.sourceId);if("error"in h)return P(t,h.error),2;let l=await me(d,h.sourceId,h.filePath,t,r,!!e.plan||s==="interactive");if(!l)return 1;let $=r.runDesignForUc??z,k=r.runDesignForUc??null,a=r.sessionScript;if(!l.changed){let o=await Pe(d,h.sourceId,t,r,s,$,!!e.plan);if(o!==null)return o;if(M(t,l,null),s==="agent"){let g=r.emitEvent??(()=>{});W(g,l,null),g({...ee})}return 0}let R=F(d),v=null;if(R!=null?v=B(d,{version:2,source_id:l.source_id,backing_path:h.filePath,head_pin:R,created:new Date().toISOString().replace(/[:.]/g,"-"),skipped_arms:l.skipped_arms,note:l.note,changeset:l.changeset,rows:l.rows,...l.held?{held:l.held}:{}}):P(t,"no chain head after extract \u2014 plan not stored"),s==="agent"){let o=r.emitEvent??(()=>{});if(!w)return W(o,l,v),o({...ee}),0;let g=v?(_,b)=>I(v,_,b):void 0;return U(d,l,v,$,o,t,E(s),g)}if(!w)return v&&t.out(`plan stored: ${v}`),0;let c=l.changeset.filter(o=>o.kind==="ARCHIVE");if(s==="ci"&&c.length>0)return v&&t.out(`plan stored: ${v}`),P(t,H(c.length)),2;if(v){t.out(`plan stored: ${v}`);let o=v;return A(d,be(d,o)??l.rows,u,t,$,(g,_)=>I(o,g,_),l.changeset,E(s),l.held,void 0,void 0,k,a)}return A(d,l.rows,u,t,$,void 0,l.changeset,E(s),l.held,void 0,void 0,k,a)}function be(e,t){let r=T(e,t);return"error"in r?null:r.plan.rows}async function Te(e,t={},r,n=process.cwd()){if(e.mode==="agent"){let{makeHeadlessIO:i}=await import("./headless-io-PWW6YKH2.js"),p=r?i("ndjson","reconcile",r):i("ndjson","reconcile"),f={out:p.out,err:y=>p.event({type:"error",message:y}),isTTY:!1,confirm:async()=>!1,ask:async()=>""},d=2;try{d=await fe(e,f,{...t,emitEvent:y=>p.event(y)},n)}catch(y){p.event({type:"error",message:y instanceof Error?y.message:String(y)})}return p.done(d)}return fe(e,de(),t,n)}export{E as childModeFor,Te as reconcileCommand,ke as resolveReconcileMode,fe as runReconcileCommand,ye as validateReconcileInputs};
@@ -1,3 +1,3 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
2
  import{a as n}from"./chunk-3MSXQU2C.js";import"./chunk-UR6MHSHU.js";function p(t){let s=t.sessionName!==null,e={type:"recording_state",enabled:!0,session_id:t.sessionId,persist:s};return t.sessionName&&(e.session_name=t.sessionName),t.testPath&&(e.test_path=t.testPath),t.outputPath&&(e.output_path=t.outputPath),e}async function g(t){if(t.isAgent){process.stdout.write(JSON.stringify(p(t))+`
3
- `);return}let s=(await import("./react-QWOAB3TB.js")).default,{render:e,useApp:a}=await import("./build-JIKYOZUH.js"),{useEffect:o}=s,{InfoBox:r}=await import("./InfoBox-GQQJVTI5.js"),u=t.sessionName?[{label:"session",value:t.sessionName},{label:"test",value:n(t.testPath??"")},{label:"output",value:n(t.outputPath??"")}]:[{label:"session",value:"ephemeral"},{label:"note",value:"use /name <name> to persist this session"}];function l(){let{exit:i}=a();return o(()=>{let c=setTimeout(()=>i(),50);return()=>clearTimeout(c)},[i]),s.createElement(r,{title:"Recording",titleColor:"#ff9500",rows:u})}await e(s.createElement(l),{stdout:process.stderr}).waitUntilExit()}export{p as buildRecordingStateEvent,g as printRecordingBanner};
3
+ `);return}let s=(await import("./react-QWOAB3TB.js")).default,{render:e,useApp:a}=await import("./build-JIKYOZUH.js"),{useEffect:o}=s,{InfoBox:r}=await import("./InfoBox-W2LZVGQS.js"),u=t.sessionName?[{label:"session",value:t.sessionName},{label:"test",value:n(t.testPath??"")},{label:"output",value:n(t.outputPath??"")}]:[{label:"session",value:"ephemeral"},{label:"note",value:"use /name <name> to persist this session"}];function l(){let{exit:i}=a();return o(()=>{let c=setTimeout(()=>i(),50);return()=>clearTimeout(c)},[i]),s.createElement(r,{title:"Recording",titleColor:"#ff9500",rows:u})}await e(s.createElement(l),{stdout:process.stderr}).waitUntilExit()}export{p as buildRecordingStateEvent,g as printRecordingBanner};
@@ -1,2 +1,2 @@
1
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,g as f,h as g}from"./chunk-CIW2KP4C.js";import"./chunk-2WVKOZ6W.js";import"./chunk-NLCCBXXV.js";import"./chunk-RZ4F3BHX.js";import"./chunk-RLG5NUTE.js";import"./chunk-VE3SUJMA.js";import"./chunk-E4OYR32M.js";import"./chunk-UR6MHSHU.js";export{d as buildAutoDefaultAnnouncement,f as buildAutoDefaultedEvent,e as buildAutoDefaultedNdjson,c as buildRemediationMessage,b as decideGateAction,a as loadCachedIds,g as requireProjectFolder};
2
+ import{b as a,c as b,d as c,e as d,f as e,g as f,h as g}from"./chunk-2BWRAY3Y.js";import"./chunk-2WVKOZ6W.js";import"./chunk-NLCCBXXV.js";import"./chunk-RZ4F3BHX.js";import"./chunk-AKHUNBQS.js";import"./chunk-VE3SUJMA.js";import"./chunk-6SGPN76K.js";import"./chunk-UR6MHSHU.js";export{d as buildAutoDefaultAnnouncement,f as buildAutoDefaultedEvent,e as buildAutoDefaultedNdjson,c as buildRemediationMessage,b as decideGateAction,a as loadCachedIds,g as requireProjectFolder};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{d as _,g as k}from"./chunk-B2PZAB7J.js";import"./chunk-IACKIGPX.js";import"./chunk-UR6MHSHU.js";function j(w){let{contextDir:v,graph:y,seq:r,by:d}=w,{records:l,hashes:$}=_(v);if(!Number.isInteger(r)||r<1||r>l.length)return{record:null,warnings:[],errors:[{code:"UNKNOWN_SEQ",detail:`no record ${r} (chain has ${l.length})`}]};let i=l[r-1],p=l.slice(0,r-1),c=w.reason??`revert of record ${r}`,t=[],u=[],f=[],g=[],m={},b=new Set(i.nodes.map(e=>e.cid));for(let e of i.nodes){if(y.superseded.has(e.cid)){t.push(`${e.cid} was already superseded after record ${r} \u2014 left as is`);continue}u.push({kind:"node",old:e.cid,new:null,reason:c,by:d})}for(let e of i.supersessions){if(e.kind==="edge"){t.push(`edge retraction ${e.ecid} cannot be auto-restored \u2014 re-extract to re-evidence`);continue}if(l.slice(r).some(n=>n.supersessions.some(s=>s.kind==="node"&&s.old===e.old))){t.push(`supersession of ${e.old.slice(0,19)} was changed again after record ${r} \u2014 later state kept`);continue}let o;for(let n of p)for(let s of n.supersessions)s.kind==="node"&&s.old===e.old&&(o=s.new===s.old?void 0:s.new);o===void 0?u.push({kind:"node",old:e.old,new:e.old,reason:c,by:d}):u.push({kind:"node",old:e.old,new:o,reason:c,by:d})}let h=l.slice(r);for(let e of Object.keys(i.source_head_moves)){if(h.some(n=>e in n.source_head_moves)){t.push(`head of ${e} was moved again after record ${r} \u2014 later state kept`);continue}let o=null;for(let n of p)e in n.source_head_moves&&(o=n.source_head_moves[e]);m[e]=o}let R=new Set;for(let e of i.review){if(R.has(e.id)||b.has(e.id))continue;if(R.add(e.id),h.some(s=>s.review.some(a=>a.id===e.id))){t.push(`trust of ${e.id.slice(0,19)} was reviewed again after record ${r} \u2014 later state kept`);continue}let o=null,n=null;for(let s of p)for(let a of s.review)a.id===e.id&&(o=a.resolution==="reset"?null:a.resolution,n=a.reason);o==="approved"||o==="edited"?f.push({id:e.id,kind:"review-item",resolution:"approved",edit:null,reason:c,by:d}):o==="rejected"?f.push({id:e.id,kind:"review-item",resolution:"rejected",edit:null,reason:n??c,by:d}):f.push({id:e.id,kind:"review-item",resolution:"reset",edit:null,reason:c,by:d})}for(let e of i.names??[]){if(h.some(n=>(n.names??[]).some(s=>s.slug===e.slug))){t.push(`slug "${e.slug}" was reassigned after record ${r} \u2014 later state kept`);continue}let o;for(let n of p)for(let s of n.names??[])s.slug===e.slug&&(o=s.cid);o!==void 0?g.push({cid:o,slug:e.slug,by:d}):t.push(`slug "${e.slug}" was first assigned by record ${r} \u2014 unassignment unsupported, reassign manually`)}return u.length===0&&f.length===0&&g.length===0&&Object.keys(m).length===0?{record:null,warnings:t,errors:[{code:"NOTHING_TO_REVERT",detail:`record ${r} left no compensable facts`}]}:(i.extraction_of&&t.push(`extraction cache for ${i.extraction_of.slice(0,19)} stays \u2014 re-extract with --force`),{record:k(v,{ts:new Date().toISOString(),proposal_id:null,nodes:[],edges:[],review:f,supersessions:u,...g.length>0?{names:g}:{},source_head_moves:m},{expectPrev:$[$.length-1]??null}).record,warnings:t,errors:null})}export{j as commitRevert};
2
+ import{d as _,g as k}from"./chunk-ZG2V2ODK.js";import"./chunk-5YPBPZUR.js";import"./chunk-UR6MHSHU.js";function j(w){let{contextDir:v,graph:y,seq:r,by:d}=w,{records:l,hashes:$}=_(v);if(!Number.isInteger(r)||r<1||r>l.length)return{record:null,warnings:[],errors:[{code:"UNKNOWN_SEQ",detail:`no record ${r} (chain has ${l.length})`}]};let i=l[r-1],p=l.slice(0,r-1),c=w.reason??`revert of record ${r}`,t=[],u=[],f=[],g=[],m={},b=new Set(i.nodes.map(e=>e.cid));for(let e of i.nodes){if(y.superseded.has(e.cid)){t.push(`${e.cid} was already superseded after record ${r} \u2014 left as is`);continue}u.push({kind:"node",old:e.cid,new:null,reason:c,by:d})}for(let e of i.supersessions){if(e.kind==="edge"){t.push(`edge retraction ${e.ecid} cannot be auto-restored \u2014 re-extract to re-evidence`);continue}if(l.slice(r).some(n=>n.supersessions.some(s=>s.kind==="node"&&s.old===e.old))){t.push(`supersession of ${e.old.slice(0,19)} was changed again after record ${r} \u2014 later state kept`);continue}let o;for(let n of p)for(let s of n.supersessions)s.kind==="node"&&s.old===e.old&&(o=s.new===s.old?void 0:s.new);o===void 0?u.push({kind:"node",old:e.old,new:e.old,reason:c,by:d}):u.push({kind:"node",old:e.old,new:o,reason:c,by:d})}let h=l.slice(r);for(let e of Object.keys(i.source_head_moves)){if(h.some(n=>e in n.source_head_moves)){t.push(`head of ${e} was moved again after record ${r} \u2014 later state kept`);continue}let o=null;for(let n of p)e in n.source_head_moves&&(o=n.source_head_moves[e]);m[e]=o}let R=new Set;for(let e of i.review){if(R.has(e.id)||b.has(e.id))continue;if(R.add(e.id),h.some(s=>s.review.some(a=>a.id===e.id))){t.push(`trust of ${e.id.slice(0,19)} was reviewed again after record ${r} \u2014 later state kept`);continue}let o=null,n=null;for(let s of p)for(let a of s.review)a.id===e.id&&(o=a.resolution==="reset"?null:a.resolution,n=a.reason);o==="approved"||o==="edited"?f.push({id:e.id,kind:"review-item",resolution:"approved",edit:null,reason:c,by:d}):o==="rejected"?f.push({id:e.id,kind:"review-item",resolution:"rejected",edit:null,reason:n??c,by:d}):f.push({id:e.id,kind:"review-item",resolution:"reset",edit:null,reason:c,by:d})}for(let e of i.names??[]){if(h.some(n=>(n.names??[]).some(s=>s.slug===e.slug))){t.push(`slug "${e.slug}" was reassigned after record ${r} \u2014 later state kept`);continue}let o;for(let n of p)for(let s of n.names??[])s.slug===e.slug&&(o=s.cid);o!==void 0?g.push({cid:o,slug:e.slug,by:d}):t.push(`slug "${e.slug}" was first assigned by record ${r} \u2014 unassignment unsupported, reassign manually`)}return u.length===0&&f.length===0&&g.length===0&&Object.keys(m).length===0?{record:null,warnings:t,errors:[{code:"NOTHING_TO_REVERT",detail:`record ${r} left no compensable facts`}]}:(i.extraction_of&&t.push(`extraction cache for ${i.extraction_of.slice(0,19)} stays \u2014 re-extract with --force`),{record:k(v,{ts:new Date().toISOString(),proposal_id:null,nodes:[],edges:[],review:f,supersessions:u,...g.length>0?{names:g}:{},source_head_moves:m},{expectPrev:$[$.length-1]??null}).record,warnings:t,errors:null})}export{j as commitRevert};
@@ -1,4 +1,4 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{b as j}from"./chunk-AD46OCZ4.js";import{g as b}from"./chunk-FTD3B7QA.js";import"./chunk-QPZRHAYK.js";import"./chunk-ZKYYZ5NO.js";import"./chunk-BC7UVJJB.js";import{a as _}from"./chunk-D5T4ARTB.js";import"./chunk-AE6SS34N.js";import"./chunk-GIRXJOJI.js";import{d as V}from"./chunk-B2PZAB7J.js";import"./chunk-IACKIGPX.js";import"./chunk-UR6MHSHU.js";import{readFileSync as E}from"fs";var O=new Set(["derived","skipped","archived","drift"]),q={kind:"human",id:process.env.USER??"operator"};function R(d,r){return d.nameOf.get(r)??r.slice(0,19)}function N(d,r){let n=d.getNode(r)?.content??{},a=d.derivesInto(r)[0]?.props.anchor;return{cid:r,uc:{temp_ref:r,title:String(n.title??n.text??""),summary:n.summary!==void 0?String(n.summary):void 0,risk:String(n.risk??"med"),cite:{anchor:typeof a=="string"?a:"\u2014",quote:""},depends_on_hint:[],matches_existing:null}}}function T(d,r){let n=new Set,{records:a}=V(d);for(let s of a){if(s.proposal_id==null)continue;let u=new Set(s.review.map(e=>e.id));for(let e of s.nodes)u.has(e.cid)||n.add(e.cid)}for(let s of[...n])(r.trust.get(s)!=="derived"||r.superseded.has(s))&&n.delete(s);return n}var x=new Set(["approved","edited","rejected","skipped","supersede"]);function C(d){let r;try{r=JSON.parse(d)}catch(s){return{errors:[`not valid JSON: ${s instanceof Error?s.message:String(s)}`]}}if(!Array.isArray(r))return{errors:['expected a top-level array of {"ref", "resolution", ...} entries']};let n=[],a=[];return r.forEach((s,u)=>{if(s==null||typeof s!="object"||Array.isArray(s)){n.push(`[${u}]: not an object`);return}let e=s;(typeof e.ref!="string"||!e.ref.trim())&&n.push(`[${u}]: "ref" (slug or cid) is required`),(typeof e.resolution!="string"||!x.has(e.resolution))&&n.push(`[${u}]: "resolution" must be one of approved | edited | rejected | skipped | supersede`),e.resolution==="supersede"&&(typeof e.supersede_target!="string"||!e.supersede_target.trim())&&n.push(`[${u}]: resolution "supersede" requires "supersede_target" (slug or cid)`),e.edit!==void 0&&(e.edit==null||typeof e.edit!="object"||Array.isArray(e.edit))&&n.push(`[${u}]: "edit" must be an object ({title?, summary?, risk?})`),n.length===0&&a.push(e)}),n.length>0?{errors:n}:{entries:a}}async function I(d,r,n,a=process.cwd()){let s=d.queue??"derived";if(!O.has(s))return r.out(`unknown queue ${s} \u2014 one of: derived | skipped | archived | drift`),2;let u=j(a,r);if(!u)return 2;let e=_(u);if(d.verdicts){let i=t=>(r.err??r.out)(t),o;try{o=E(d.verdicts,"utf8")}catch{return i(`error: cannot read verdicts file ${d.verdicts}`),2}let l=C(o);if("errors"in l){for(let t of l.errors)i(`error: --verdicts ${d.verdicts}: ${t}`);return 2}let c=new Set([...e.trust.entries()].filter(([t,p])=>(p==="derived"||p==="archived")&&!e.superseded.has(t)).map(([t])=>t)),f=new Map,y=[];for(let t of l.entries){let p=e.resolve(t.ref),m=p&&!e.superseded.has(p.tip)?p.tip:null;if(!m){y.push(`${t.ref}: names nothing in the graph`);continue}if(!c.has(m)){y.push(`${t.ref}: not in a review queue (trust: ${e.trust.get(m)??"?"})`);continue}if(f.has(m)){y.push(`${t.ref}: duplicate \u2014 an earlier entry already resolves to this node (${R(e,m)})`);continue}f.set(m,{resolution:t.resolution,...t.reason?{reason:t.reason}:{},...t.edit?{edit:t.edit}:{},...t.supersede_target?{supersedeTarget:t.supersede_target}:{}})}if(y.length>0){for(let t of y)i(`error: --verdicts: ${t}`);return i("error: nothing committed (the verdicts file is atomic \u2014 fix every offender and re-run)"),2}let k=b({contextDir:u,graph:e,verdicts:f,by:q});if(k.errors){if(k.errors[0]?.code==="NO_VERDICTS")return i("nothing changed \u2014 every item was skipped"),0;for(let t of k.errors)i(`${t.code}: ${t.detail}`);return 1}let S=new Map;for(let t of f.values())S.set(t.resolution,(S.get(t.resolution)??0)+1);if(d.json)for(let[t,p]of f.entries())r.out(JSON.stringify({ref:R(e,t),cid:t,resolution:p.resolution}));else{let t=[...S.entries()].map(([p,m])=>`${m} ${p}`).join(", ");r.out(`review: committed record ${k.record.seq} \u2014 ${t}`)}return 0}if(s==="drift"){let i=e.staleList().filter(({state:o})=>o!=="superseded").map(({cid:o,state:l})=>({ref:R(e,o),cid:o,state:l,title:String(e.getNode(o)?.content.title??e.getNode(o)?.content.source_id??""),pinned_sources:[...new Set(e.derivesInto(o).map(c=>String(c.props.source_id)))]}));if(d.json){for(let o of i)r.out(JSON.stringify(o));return 0}if(i.length===0)return r.out("drift queue is empty \u2014 every node's evidence matches the current source snapshots"),0;r.out(`${i.length} node(s) with drifting evidence (re-extract the source to re-bless):`);for(let o of i)r.out(` [${o.state}] ${o.ref} \xB7 ${o.title} \xB7 sources: ${o.pinned_sources.join(", ")||"\u2014"}`);return 0}if(!r.isTTY)return r.out("review: verdict queues need a TTY (drift listing works anywhere, or pass --verdicts <file.json>)"),2;let g,h;if(s==="archived")g=[...e.trust.entries()].filter(([i,o])=>o==="archived"&&!e.superseded.has(i)).map(([i])=>N(e,i)),h="skipped";else{let i=T(u,e),o=[...e.trust.entries()].filter(([c,f])=>f==="derived"&&!e.superseded.has(c)).map(([c])=>c),l=s==="skipped"?o.filter(c=>i.has(c)):o;l.sort((c,f)=>Number(i.has(f))-Number(i.has(c))),g=l.map(c=>N(e,c)),h="skipped"}if(g.length===0)return r.out(`${s} queue is empty`),0;r.out(`${g.length} node(s) in the ${s} queue \u2014 approve promotes, reject ${s==="archived"?"re-archives":"archives"}, edit mints a new version, skip leaves it for later`);let v=await n(g,e,h),w=b({contextDir:u,graph:e,verdicts:v,by:q});if(w.errors){if(w.errors[0]?.code==="NO_VERDICTS")return r.out("nothing changed \u2014 every item was skipped"),0;for(let i of w.errors)r.out(`${i.code}: ${i.detail}`);return 1}let $=w.record;return r.out(`committed record ${$.seq}: ${$.review.length} review fact(s), ${$.supersessions.length} supersession(s), ${$.nodes.length} new version(s)`),0}async function P(d,r,n){let[{render:a},s,{ReviewChecklist:u}]=await Promise.all([import("./build-JIKYOZUH.js"),import("./react-QWOAB3TB.js"),import("./ui-JEJGTURD.js")]),e=s.default??s;return new Promise(g=>{let h=a(e.createElement(u,{items:d.map(v=>({uc:v.uc})),defaultResolution:n,onSubmit:v=>{h.unmount(),g(v)}}))})}async function D(d){let{bothTTY:r}=await import("./headless-io-GXHKDPHB.js");return I(d,{out:n=>process.stdout.write(n+`
2
+ import{b as j}from"./chunk-GRB66C5S.js";import{g as b}from"./chunk-WIA7TPK3.js";import"./chunk-QPZRHAYK.js";import"./chunk-RN4OSVTG.js";import"./chunk-BC7UVJJB.js";import{a as _}from"./chunk-MCQXRJGH.js";import"./chunk-74RUSHIB.js";import"./chunk-ZZLR3O5A.js";import{d as V}from"./chunk-ZG2V2ODK.js";import"./chunk-5YPBPZUR.js";import"./chunk-UR6MHSHU.js";import{readFileSync as E}from"fs";var O=new Set(["derived","skipped","archived","drift"]),q={kind:"human",id:process.env.USER??"operator"};function R(d,r){return d.nameOf.get(r)??r.slice(0,19)}function N(d,r){let n=d.getNode(r)?.content??{},a=d.derivesInto(r)[0]?.props.anchor;return{cid:r,uc:{temp_ref:r,title:String(n.title??n.text??""),summary:n.summary!==void 0?String(n.summary):void 0,risk:String(n.risk??"med"),cite:{anchor:typeof a=="string"?a:"\u2014",quote:""},depends_on_hint:[],matches_existing:null}}}function T(d,r){let n=new Set,{records:a}=V(d);for(let s of a){if(s.proposal_id==null)continue;let u=new Set(s.review.map(e=>e.id));for(let e of s.nodes)u.has(e.cid)||n.add(e.cid)}for(let s of[...n])(r.trust.get(s)!=="derived"||r.superseded.has(s))&&n.delete(s);return n}var x=new Set(["approved","edited","rejected","skipped","supersede"]);function C(d){let r;try{r=JSON.parse(d)}catch(s){return{errors:[`not valid JSON: ${s instanceof Error?s.message:String(s)}`]}}if(!Array.isArray(r))return{errors:['expected a top-level array of {"ref", "resolution", ...} entries']};let n=[],a=[];return r.forEach((s,u)=>{if(s==null||typeof s!="object"||Array.isArray(s)){n.push(`[${u}]: not an object`);return}let e=s;(typeof e.ref!="string"||!e.ref.trim())&&n.push(`[${u}]: "ref" (slug or cid) is required`),(typeof e.resolution!="string"||!x.has(e.resolution))&&n.push(`[${u}]: "resolution" must be one of approved | edited | rejected | skipped | supersede`),e.resolution==="supersede"&&(typeof e.supersede_target!="string"||!e.supersede_target.trim())&&n.push(`[${u}]: resolution "supersede" requires "supersede_target" (slug or cid)`),e.edit!==void 0&&(e.edit==null||typeof e.edit!="object"||Array.isArray(e.edit))&&n.push(`[${u}]: "edit" must be an object ({title?, summary?, risk?})`),n.length===0&&a.push(e)}),n.length>0?{errors:n}:{entries:a}}async function I(d,r,n,a=process.cwd()){let s=d.queue??"derived";if(!O.has(s))return r.out(`unknown queue ${s} \u2014 one of: derived | skipped | archived | drift`),2;let u=j(a,r);if(!u)return 2;let e=_(u);if(d.verdicts){let i=t=>(r.err??r.out)(t),o;try{o=E(d.verdicts,"utf8")}catch{return i(`error: cannot read verdicts file ${d.verdicts}`),2}let l=C(o);if("errors"in l){for(let t of l.errors)i(`error: --verdicts ${d.verdicts}: ${t}`);return 2}let c=new Set([...e.trust.entries()].filter(([t,p])=>(p==="derived"||p==="archived")&&!e.superseded.has(t)).map(([t])=>t)),f=new Map,y=[];for(let t of l.entries){let p=e.resolve(t.ref),m=p&&!e.superseded.has(p.tip)?p.tip:null;if(!m){y.push(`${t.ref}: names nothing in the graph`);continue}if(!c.has(m)){y.push(`${t.ref}: not in a review queue (trust: ${e.trust.get(m)??"?"})`);continue}if(f.has(m)){y.push(`${t.ref}: duplicate \u2014 an earlier entry already resolves to this node (${R(e,m)})`);continue}f.set(m,{resolution:t.resolution,...t.reason?{reason:t.reason}:{},...t.edit?{edit:t.edit}:{},...t.supersede_target?{supersedeTarget:t.supersede_target}:{}})}if(y.length>0){for(let t of y)i(`error: --verdicts: ${t}`);return i("error: nothing committed (the verdicts file is atomic \u2014 fix every offender and re-run)"),2}let k=b({contextDir:u,graph:e,verdicts:f,by:q});if(k.errors){if(k.errors[0]?.code==="NO_VERDICTS")return i("nothing changed \u2014 every item was skipped"),0;for(let t of k.errors)i(`${t.code}: ${t.detail}`);return 1}let S=new Map;for(let t of f.values())S.set(t.resolution,(S.get(t.resolution)??0)+1);if(d.json)for(let[t,p]of f.entries())r.out(JSON.stringify({ref:R(e,t),cid:t,resolution:p.resolution}));else{let t=[...S.entries()].map(([p,m])=>`${m} ${p}`).join(", ");r.out(`review: committed record ${k.record.seq} \u2014 ${t}`)}return 0}if(s==="drift"){let i=e.staleList().filter(({state:o})=>o!=="superseded").map(({cid:o,state:l})=>({ref:R(e,o),cid:o,state:l,title:String(e.getNode(o)?.content.title??e.getNode(o)?.content.source_id??""),pinned_sources:[...new Set(e.derivesInto(o).map(c=>String(c.props.source_id)))]}));if(d.json){for(let o of i)r.out(JSON.stringify(o));return 0}if(i.length===0)return r.out("drift queue is empty \u2014 every node's evidence matches the current source snapshots"),0;r.out(`${i.length} node(s) with drifting evidence (re-extract the source to re-bless):`);for(let o of i)r.out(` [${o.state}] ${o.ref} \xB7 ${o.title} \xB7 sources: ${o.pinned_sources.join(", ")||"\u2014"}`);return 0}if(!r.isTTY)return r.out("review: verdict queues need a TTY (drift listing works anywhere, or pass --verdicts <file.json>)"),2;let g,h;if(s==="archived")g=[...e.trust.entries()].filter(([i,o])=>o==="archived"&&!e.superseded.has(i)).map(([i])=>N(e,i)),h="skipped";else{let i=T(u,e),o=[...e.trust.entries()].filter(([c,f])=>f==="derived"&&!e.superseded.has(c)).map(([c])=>c),l=s==="skipped"?o.filter(c=>i.has(c)):o;l.sort((c,f)=>Number(i.has(f))-Number(i.has(c))),g=l.map(c=>N(e,c)),h="skipped"}if(g.length===0)return r.out(`${s} queue is empty`),0;r.out(`${g.length} node(s) in the ${s} queue \u2014 approve promotes, reject ${s==="archived"?"re-archives":"archives"}, edit mints a new version, skip leaves it for later`);let v=await n(g,e,h),w=b({contextDir:u,graph:e,verdicts:v,by:q});if(w.errors){if(w.errors[0]?.code==="NO_VERDICTS")return r.out("nothing changed \u2014 every item was skipped"),0;for(let i of w.errors)r.out(`${i.code}: ${i.detail}`);return 1}let $=w.record;return r.out(`committed record ${$.seq}: ${$.review.length} review fact(s), ${$.supersessions.length} supersession(s), ${$.nodes.length} new version(s)`),0}async function P(d,r,n){let[{render:a},s,{ReviewChecklist:u}]=await Promise.all([import("./build-JIKYOZUH.js"),import("./react-QWOAB3TB.js"),import("./ui-JEJGTURD.js")]),e=s.default??s;return new Promise(g=>{let h=a(e.createElement(u,{items:d.map(v=>({uc:v.uc})),defaultResolution:n,onSubmit:v=>{h.unmount(),g(v)}}))})}async function D(d){let{bothTTY:r}=await import("./headless-io-PWW6YKH2.js");return I(d,{out:n=>process.stdout.write(n+`
3
3
  `),err:n=>process.stderr.write(n+`
4
4
  `),confirm:async()=>!1,isTTY:r()},P)}export{C as parseVerdictsFile,D as reviewCommand,I as runReviewCommand};
@@ -0,0 +1,2 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{a as b,b as c,c as d,d as e,e as f}from"./chunk-4R2HOA7J.js";import"./chunk-K5JGCJ2K.js";import{f as a}from"./chunk-KNCHEM6A.js";import"./chunk-FXPPQL4D.js";import"./chunk-RE3BZVGE.js";import"./chunk-6PS65QFF.js";import"./chunk-JFAFKHDX.js";import"./chunk-WIA7TPK3.js";import"./chunk-QPZRHAYK.js";import"./chunk-6GTOYTCQ.js";import"./chunk-YKTYVJBN.js";import"./chunk-6AYUSR7X.js";import"./chunk-427OQS2N.js";import"./chunk-2PQXEEVY.js";import"./chunk-MCQXRJGH.js";import"./chunk-74RUSHIB.js";import"./chunk-ZZLR3O5A.js";import"./chunk-ZG2V2ODK.js";import"./chunk-5YPBPZUR.js";import"./chunk-6SGPN76K.js";import"./chunk-UR6MHSHU.js";export{e as dedupPreFlags,c as displaySourceName,a as resolveAnswers,f as runExtract,b as sessionSourceRef,d as sourceBanner};
@@ -0,0 +1,2 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{a}from"./chunk-WWH7CW5R.js";import"./chunk-KHU7C6EE.js";import"./chunk-3C5GMAM4.js";import"./chunk-KNCHEM6A.js";import"./chunk-FXPPQL4D.js";import"./chunk-RE3BZVGE.js";import"./chunk-6PS65QFF.js";import"./chunk-JFAFKHDX.js";import"./chunk-WIA7TPK3.js";import"./chunk-QPZRHAYK.js";import"./chunk-6GTOYTCQ.js";import"./chunk-YKTYVJBN.js";import"./chunk-6AYUSR7X.js";import"./chunk-427OQS2N.js";import"./chunk-FJTWJ243.js";import"./chunk-2PQXEEVY.js";import"./chunk-L5LI2JF4.js";import"./chunk-MCQXRJGH.js";import"./chunk-74RUSHIB.js";import"./chunk-ZZLR3O5A.js";import"./chunk-ZG2V2ODK.js";import"./chunk-5YPBPZUR.js";import"./chunk-6SGPN76K.js";import"./chunk-UR6MHSHU.js";export{a as runDesign};
@@ -1,5 +1,5 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as A}from"./chunk-OGVIHL5G.js";import{E as M,F as P,G as K,H,I as U}from"./chunk-BO3JA2GS.js";import"./chunk-GIGD4M7V.js";import{a as _,b as E}from"./chunk-C5POEXSX.js";import{a as h,b as k}from"./chunk-Y6LMHBLE.js";import"./chunk-2YQ6TW77.js";import"./chunk-LMJTY32X.js";import{s as L}from"./chunk-RKWJG3WW.js";import{c as R}from"./chunk-7MV5UF6O.js";import"./chunk-FFL2TQEJ.js";import"./chunk-Q4HLQOJI.js";import{a as x}from"./chunk-XBE7PGVY.js";import"./chunk-C5UNZ6ZY.js";import"./chunk-S3DAAAE5.js";import"./chunk-P46TIMGQ.js";import"./chunk-SL7AJ7JQ.js";import"./chunk-FPFOW6BS.js";import"./chunk-WAOCHXJ5.js";import"./chunk-OE7TVGNB.js";import"./chunk-FYOCF7DY.js";import"./chunk-RGEAEAZB.js";import"./chunk-BC7UVJJB.js";import"./chunk-KHDUQ33H.js";import"./chunk-NFOBDHZK.js";import"./chunk-L5LI2JF4.js";import"./chunk-D5T4ARTB.js";import"./chunk-AE6SS34N.js";import"./chunk-GIRXJOJI.js";import"./chunk-B2PZAB7J.js";import"./chunk-IACKIGPX.js";import{e as b,f as S,g as T}from"./chunk-M5JQXOCE.js";import"./chunk-CIW2KP4C.js";import"./chunk-2WVKOZ6W.js";import"./chunk-NLCCBXXV.js";import"./chunk-RZ4F3BHX.js";import{a as C}from"./chunk-RLG5NUTE.js";import"./chunk-VE3SUJMA.js";import"./chunk-E47GFYXA.js";import{a as v}from"./chunk-TZZYRDCF.js";import"./chunk-E4OYR32M.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";import{resolve as Y}from"path";import{existsSync as D}from"fs";function O(){return{register:(n,r)=>b(n,r),deregister:n=>S(n),cleanup:(n,r)=>T(n,r),remoteLogger:null}}async function le(n,r){let t=Y(n);if(!D(t))return process.stderr.write(`error: file not found: ${t}
2
+ import{a as A}from"./chunk-BV5QKFMJ.js";import{E as M,F as P,G as K,H,I as U}from"./chunk-HA5GE57Z.js";import"./chunk-GLS46X7N.js";import{a as _,b as E}from"./chunk-EWTX7HSU.js";import{a as h,b as k}from"./chunk-32GP7KTM.js";import"./chunk-2YQ6TW77.js";import"./chunk-RHNKYNNZ.js";import{s as L}from"./chunk-RKWJG3WW.js";import{c as R}from"./chunk-6XHAXAL2.js";import"./chunk-5JJ245FW.js";import"./chunk-D7L6UW5Z.js";import{a as x}from"./chunk-VBCE4U4B.js";import"./chunk-C5UNZ6ZY.js";import"./chunk-S3DAAAE5.js";import"./chunk-EOLQUB4Q.js";import"./chunk-C42WWO7Y.js";import"./chunk-FPFOW6BS.js";import"./chunk-WAOCHXJ5.js";import"./chunk-4A6BLXQN.js";import"./chunk-CJJXT5DO.js";import"./chunk-FJTWJ243.js";import"./chunk-BC7UVJJB.js";import"./chunk-2PQXEEVY.js";import"./chunk-EHN5HTUD.js";import"./chunk-L5LI2JF4.js";import"./chunk-MCQXRJGH.js";import"./chunk-74RUSHIB.js";import"./chunk-ZZLR3O5A.js";import"./chunk-ZG2V2ODK.js";import"./chunk-5YPBPZUR.js";import{e as b,f as S,g as T}from"./chunk-M5JQXOCE.js";import"./chunk-2BWRAY3Y.js";import"./chunk-2WVKOZ6W.js";import"./chunk-NLCCBXXV.js";import"./chunk-RZ4F3BHX.js";import{a as C}from"./chunk-AKHUNBQS.js";import"./chunk-VE3SUJMA.js";import"./chunk-E47GFYXA.js";import{a as v}from"./chunk-P4HW2NTZ.js";import"./chunk-6SGPN76K.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";import{resolve as Y}from"path";import{existsSync as D}from"fs";function O(){return{register:(n,r)=>b(n,r),deregister:n=>S(n),cleanup:(n,r)=>T(n,r),remoteLogger:null}}async function le(n,r){let t=Y(n);if(!D(t))return process.stderr.write(`error: file not found: ${t}
3
3
  `),2;if(r.finalValidation!==void 0&&r.finalValidation!=="on"&&r.finalValidation!=="off")return process.stderr.write(`error: --final-validation must be 'on' or 'off'
4
4
  `),2;if(!t.endsWith("_test.md"))return process.stderr.write(`error: not a *_test.md file: ${t}
5
5
  helpers are import-only \u2014 run a test that @imports it.
@@ -12,6 +12,6 @@ import{a as A}from"./chunk-OGVIHL5G.js";import{E as M,F as P,G as K,H,I as U}fro
12
12
  \u2022 Run 'kane-cli login --username <user> --access-key <key>'
13
13
  `):e instanceof h&&e.code==="refresh_failed"?process.stderr.write(`error: Token refresh failed. Run 'kane-cli login' to re-authenticate.
14
14
  `):process.stderr.write(`error: auth resolution failed: ${e.message}
15
- `),2}let y=String(p.resolvedCreds?.org_id??"");if(!y)return process.stderr.write("error: TMS did not return an org_id. Run `kane-cli login` again.\n"),2;{let{readMetaIfExists:e,assertOrgMatchOrExit:g}=await import("./testmd-actions-TU4KTO32.js"),d=g(e(t),y);if(d!==null)return d}let w=new R,j=A({isAgent:a,log:(e,g,d,V)=>w.log(e,g,d,V)}),F={path:t,cwd:process.cwd(),opts:r,isAgent:a,disableAskUser:!0,resolved:s,resolvedAuth:p,cliOverrides:i,environment:f,envConfig:N,profile:I,model:$,creds:o,configStore:l,session:w};try{return(await M(F,j,c)).exitCode}catch(e){return process.stderr.write(`error: ${e.message}
15
+ `),2}let y=String(p.resolvedCreds?.org_id??"");if(!y)return process.stderr.write("error: TMS did not return an org_id. Run `kane-cli login` again.\n"),2;{let{readMetaIfExists:e,assertOrgMatchOrExit:g}=await import("./testmd-actions-S3ZNOZEK.js"),d=g(e(t),y);if(d!==null)return d}let w=new R,j=A({isAgent:a,log:(e,g,d,V)=>w.log(e,g,d,V)}),F={path:t,cwd:process.cwd(),opts:r,isAgent:a,disableAskUser:!0,resolved:s,resolvedAuth:p,cliOverrides:i,environment:f,envConfig:N,profile:I,model:$,creds:o,configStore:l,session:w};try{return(await M(F,j,c)).exitCode}catch(e){return process.stderr.write(`error: ${e.message}
16
16
  `),2}}var m=class extends Error{constructor(t,a){super(t);this.exitCode=a;this.name="CliArgError"}};function G(n){let r={mode:"mode",assertionMode:"assertion_mode",finalValidation:"final_validation",maxSteps:"max_steps",timeout:"timeout",globalContext:"global_context",localContext:"local_context",codeExport:"code_export",codeLanguage:"code_language",headless:"headless",cdpEndpoint:"cdp_endpoint",wsEndpoint:"ws_endpoint"},t=new Set(["max_steps","timeout"]),a={};for(let[c,s]of Object.entries(r)){let i=n[c];if(i===void 0||i==="")continue;let o=i;if(t.has(s)&&(o=Number(i),Number.isNaN(o))){let l="--"+c.replace(/[A-Z]/g,u=>"-"+u.toLowerCase());throw new m(`error: ${l} must be a number
17
17
  `,2)}a[s]=o}return a}export{U as applyCliStepConfig,K as buildStepRunVariables,P as buildTestLevelVariables,G as optsToOverrides,H as replayVariablesForStep,le as runTestMdFile};
@@ -1,3 +1,3 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as p,b as g}from"./chunk-G6AF2JUA.js";import{b as m}from"./chunk-TTSYHJLX.js";import{a as d}from"./chunk-RZ4F3BHX.js";import"./chunk-RLG5NUTE.js";import"./chunk-TZZYRDCF.js";import{a as f,g as a,h as u}from"./chunk-E4OYR32M.js";import"./chunk-UR6MHSHU.js";import{mkdirSync as y,writeFileSync as w,readFileSync as S,rmSync as c,cpSync as v,createWriteStream as T,existsSync as b}from"fs";import{join as s}from"path";import{tmpdir as k}from"os";import{spawn as h}from"child_process";import{Readable as I}from"stream";import{pipeline as $}from"stream/promises";function E(t){try{return S(s(t,"VERSION"),"utf-8").trim()||null}catch{return null}}function L(t,r,l){return l?t!==r:t===null||m(t,r)>0}function C(t){let r=a.split("/").pop()??a;return`https://registry.npmjs.org/${a}/-/${r}-${t}.tgz`}var R=5e3,A=6e4;async function x(){let t=new AbortController,r=setTimeout(()=>t.abort(),R);try{let l=await d(p(),{headers:{Accept:"application/json"},signal:t.signal});if(!l.ok)throw new Error(`Controller returned ${l.status} fetching skill version map`);let i=await l.json(),n=g(i,f);if(!n)throw new Error("No compatible skill version found for this kane-cli build");return n}finally{clearTimeout(r)}}async function _(t){let r=C(t),l=new AbortController,i=setTimeout(()=>l.abort(),A);try{let n=await d(r,{headers:{Accept:"application/octet-stream"},signal:l.signal});if(!n.ok||!n.body)throw new Error(`Failed to download skill tarball (${n.status})`);let e=s(k(),`kane-cli-skill-${t}-${process.pid}.tgz`);return await $(I.fromWeb(n.body),T(e)),e}finally{clearTimeout(i)}}function M(t,r){return new Promise((l,i)=>{y(r,{recursive:!0});let n=h("tar",["-xzf",t,"-C",r,"--strip-components=2","package/skills"],{stdio:["ignore","ignore","pipe"]}),e="";n.stderr?.on("data",o=>{e+=o.toString()}),n.on("error",o=>i(o)),n.on("close",o=>{o===0?l():i(new Error(`tar exited ${o}${e?`: ${e.trim()}`:""}`))})})}async function W(t){let r;try{r=t??await x()}catch(e){return{status:"failed",version:t??"unknown",installedTargets:0,error:e instanceof Error?e.message:String(e)}}let l=u.filter(({dir:e})=>L(E(e),r,!!t));if(l.length===0)return{status:"already-installed",version:r,installedTargets:0};let i=null,n=null;try{if(n=await _(r),i=s(k(),`kane-cli-skill-${r}-stage-${process.pid}`),c(i,{recursive:!0,force:!0}),await M(n,i),!b(s(i,"SKILL.md")))throw new Error(`Unexpected skill tarball layout for v${r}: SKILL.md not at package/skills/ root`);let e=0;for(let{dir:o}of l)try{c(o,{recursive:!0,force:!0}),y(o,{recursive:!0}),v(i,o,{recursive:!0,force:!0}),w(s(o,"VERSION"),r+`
2
+ import{a as p,b as g}from"./chunk-UZJ7MRBV.js";import{b as m}from"./chunk-JTEY32TL.js";import{a as d}from"./chunk-RZ4F3BHX.js";import"./chunk-AKHUNBQS.js";import"./chunk-P4HW2NTZ.js";import{a as f,h as a,i as u}from"./chunk-6SGPN76K.js";import"./chunk-UR6MHSHU.js";import{mkdirSync as y,writeFileSync as w,readFileSync as S,rmSync as c,cpSync as v,createWriteStream as T,existsSync as b}from"fs";import{join as s}from"path";import{tmpdir as k}from"os";import{spawn as h}from"child_process";import{Readable as I}from"stream";import{pipeline as $}from"stream/promises";function E(t){try{return S(s(t,"VERSION"),"utf-8").trim()||null}catch{return null}}function L(t,r,l){return l?t!==r:t===null||m(t,r)>0}function C(t){let r=a.split("/").pop()??a;return`https://registry.npmjs.org/${a}/-/${r}-${t}.tgz`}var R=5e3,A=6e4;async function x(){let t=new AbortController,r=setTimeout(()=>t.abort(),R);try{let l=await d(p(),{headers:{Accept:"application/json"},signal:t.signal});if(!l.ok)throw new Error(`Controller returned ${l.status} fetching skill version map`);let i=await l.json(),n=g(i,f);if(!n)throw new Error("No compatible skill version found for this kane-cli build");return n}finally{clearTimeout(r)}}async function _(t){let r=C(t),l=new AbortController,i=setTimeout(()=>l.abort(),A);try{let n=await d(r,{headers:{Accept:"application/octet-stream"},signal:l.signal});if(!n.ok||!n.body)throw new Error(`Failed to download skill tarball (${n.status})`);let e=s(k(),`kane-cli-skill-${t}-${process.pid}.tgz`);return await $(I.fromWeb(n.body),T(e)),e}finally{clearTimeout(i)}}function M(t,r){return new Promise((l,i)=>{y(r,{recursive:!0});let n=h("tar",["-xzf",t,"-C",r,"--strip-components=2","package/skills"],{stdio:["ignore","ignore","pipe"]}),e="";n.stderr?.on("data",o=>{e+=o.toString()}),n.on("error",o=>i(o)),n.on("close",o=>{o===0?l():i(new Error(`tar exited ${o}${e?`: ${e.trim()}`:""}`))})})}async function W(t){let r;try{r=t??await x()}catch(e){return{status:"failed",version:t??"unknown",installedTargets:0,error:e instanceof Error?e.message:String(e)}}let l=u.filter(({dir:e})=>L(E(e),r,!!t));if(l.length===0)return{status:"already-installed",version:r,installedTargets:0};let i=null,n=null;try{if(n=await _(r),i=s(k(),`kane-cli-skill-${r}-stage-${process.pid}`),c(i,{recursive:!0,force:!0}),await M(n,i),!b(s(i,"SKILL.md")))throw new Error(`Unexpected skill tarball layout for v${r}: SKILL.md not at package/skills/ root`);let e=0;for(let{dir:o}of l)try{c(o,{recursive:!0,force:!0}),y(o,{recursive:!0}),v(i,o,{recursive:!0,force:!0}),w(s(o,"VERSION"),r+`
3
3
  `),e++}catch{}return e===0?{status:"failed",version:r,installedTargets:0,error:"Could not write to any agent skill directory"}:{status:"installed",version:r,installedTargets:e}}catch(e){return{status:"failed",version:r,installedTargets:0,error:e instanceof Error?e.message:String(e)}}finally{if(n)try{c(n,{force:!0})}catch{}if(i)try{c(i,{recursive:!0,force:!0})}catch{}}}function D(t){switch(t.status){case"installed":return`Installed kane-cli skill v${t.version} (${t.installedTargets}/${u.length} agent dirs). Restart your AI agent (Claude Code / Codex CLI / Gemini CLI) to load it.`;case"already-installed":return`kane-cli skill v${t.version} already installed.`;case"failed":return`Failed to install kane-cli skill: ${t.error??"unknown error"}`}}export{D as formatInstallResult,W as installSkill,L as targetNeedsInstall};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a,b,c,d}from"./chunk-YZSYXNMB.js";import"./chunk-UR6MHSHU.js";export{c as buildAgentEnv,b as findAssuranceAgent,a as platformPackageName,d as resolveAgentAuthEnv};
2
+ import{a,b,c,d}from"./chunk-KYHXDJN4.js";import"./chunk-UR6MHSHU.js";export{c as buildAgentEnv,b as findAssuranceAgent,a as platformPackageName,d as resolveAgentAuthEnv};
@@ -0,0 +1,2 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{d as a}from"./chunk-BLSZ4H5W.js";import"./chunk-S2C62SDY.js";import"./chunk-JU5KRCKD.js";import"./chunk-3MSXQU2C.js";import"./chunk-OFEOWKM3.js";import"./chunk-HA5GE57Z.js";import"./chunk-GLS46X7N.js";import"./chunk-WJGBXJT4.js";import"./chunk-EWTX7HSU.js";import"./chunk-32GP7KTM.js";import"./chunk-2YQ6TW77.js";import"./chunk-LLS47HUA.js";import"./chunk-RHNKYNNZ.js";import"./chunk-RKWJG3WW.js";import"./chunk-JF7Q2I45.js";import"./chunk-6CZIEK6B.js";import"./chunk-6XHAXAL2.js";import"./chunk-KI2DVQSA.js";import"./chunk-5JJ245FW.js";import"./chunk-D7L6UW5Z.js";import"./chunk-VBCE4U4B.js";import"./chunk-24VYAMMK.js";import"./chunk-2WO7G2HO.js";import"./chunk-5Y2G4NC7.js";import"./chunk-RV2NXHIC.js";import"./chunk-XQL53VB7.js";import"./chunk-C5UNZ6ZY.js";import"./chunk-S3DAAAE5.js";import"./chunk-EOLQUB4Q.js";import"./chunk-MSPZOEFB.js";import"./chunk-C42WWO7Y.js";import"./chunk-FPFOW6BS.js";import"./chunk-WAOCHXJ5.js";import"./chunk-24OFJ7SE.js";import"./chunk-RFHMDQXZ.js";import"./chunk-4A6BLXQN.js";import"./chunk-CJJXT5DO.js";import"./chunk-FJTWJ243.js";import"./chunk-BC7UVJJB.js";import"./chunk-2PQXEEVY.js";import"./chunk-EHN5HTUD.js";import"./chunk-L5LI2JF4.js";import"./chunk-MCQXRJGH.js";import"./chunk-74RUSHIB.js";import"./chunk-ZZLR3O5A.js";import"./chunk-ZG2V2ODK.js";import"./chunk-5YPBPZUR.js";import"./chunk-LABIRPOT.js";import"./chunk-HWA7WD44.js";import"./chunk-N6DO2LBH.js";import"./chunk-YCCUBQY4.js";import"./chunk-MY32TBBR.js";import"./chunk-M5JQXOCE.js";import"./chunk-2BWRAY3Y.js";import"./chunk-2WVKOZ6W.js";import"./chunk-NLCCBXXV.js";import"./chunk-RZ4F3BHX.js";import"./chunk-AKHUNBQS.js";import"./chunk-VE3SUJMA.js";import"./chunk-E47GFYXA.js";import"./chunk-P4HW2NTZ.js";import"./chunk-6NIV7AVZ.js";import"./chunk-3Z3UIW5H.js";import{a as o}from"./chunk-DFS4RMVP.js";import"./chunk-LEQ2B3PR.js";import"./chunk-4SXD6XWV.js";import"./chunk-6SGPN76K.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 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{e as a,f as b,g as c,h as d,i as e,j as f,k as g,l as h,m as i,n as j,o as k,p as l,q as m}from"./chunk-F2K3XFFH.js";import"./chunk-C5POEXSX.js";import"./chunk-Y6LMHBLE.js";import"./chunk-2YQ6TW77.js";import"./chunk-RKWJG3WW.js";import"./chunk-XBE7PGVY.js";import"./chunk-P46TIMGQ.js";import"./chunk-SL7AJ7JQ.js";import"./chunk-FPFOW6BS.js";import"./chunk-WAOCHXJ5.js";import"./chunk-L5LI2JF4.js";import"./chunk-YZKPZXHY.js";import"./chunk-M5JQXOCE.js";import"./chunk-NLCCBXXV.js";import"./chunk-RZ4F3BHX.js";import"./chunk-RLG5NUTE.js";import"./chunk-TZZYRDCF.js";import"./chunk-AV5SUGRY.js";import"./chunk-E4OYR32M.js";import"./chunk-HCBYKLMW.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";export{i as ExportError,c as assertOrgMatchOrExit,j as exportTestmd,b as metaMatchesOrg,a as readMetaIfExists,d as resolveCurrentOrgId,l as resolveSyncAuth,h as runDeleteAction,k as runExportAction,e as runListAction,f as runListTui,g as runStatusAction,m as runSyncAction};
2
+ import{e as a,f as b,g as c,h as d,i as e,j as f,k as g,l as h,m as i,n as j,o as k,p as l,q as m}from"./chunk-WJGBXJT4.js";import"./chunk-EWTX7HSU.js";import"./chunk-32GP7KTM.js";import"./chunk-2YQ6TW77.js";import"./chunk-RKWJG3WW.js";import"./chunk-VBCE4U4B.js";import"./chunk-EOLQUB4Q.js";import"./chunk-C42WWO7Y.js";import"./chunk-FPFOW6BS.js";import"./chunk-WAOCHXJ5.js";import"./chunk-L5LI2JF4.js";import"./chunk-MY32TBBR.js";import"./chunk-M5JQXOCE.js";import"./chunk-NLCCBXXV.js";import"./chunk-RZ4F3BHX.js";import"./chunk-AKHUNBQS.js";import"./chunk-P4HW2NTZ.js";import"./chunk-4SXD6XWV.js";import"./chunk-6SGPN76K.js";import"./chunk-HCBYKLMW.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";export{i as ExportError,c as assertOrgMatchOrExit,j as exportTestmd,b as metaMatchesOrg,a as readMetaIfExists,d as resolveCurrentOrgId,l as resolveSyncAuth,h as runDeleteAction,k as runExportAction,e as runListAction,f as runListTui,g as runStatusAction,m as runSyncAction};
@@ -0,0 +1,2 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{a}from"./chunk-EOLQUB4Q.js";import"./chunk-C42WWO7Y.js";import"./chunk-RZ4F3BHX.js";import"./chunk-AKHUNBQS.js";import"./chunk-6SGPN76K.js";import"./chunk-UR6MHSHU.js";export{a as refreshOAuthToken};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as t}from"./chunk-RLG5NUTE.js";import"./chunk-E4OYR32M.js";import"./chunk-UR6MHSHU.js";async function l(n,o,r){let{ControllerClient:e}=await import("./controller-client-RD2YEMAH.js");await new e(t(n).controllerBaseUrl,{username:o,accessKey:r}).getTmsCredentials()}export{l as validateBasicAuth};
2
+ import{a as t}from"./chunk-AKHUNBQS.js";import"./chunk-6SGPN76K.js";import"./chunk-UR6MHSHU.js";async function l(n,o,r){let{ControllerClient:e}=await import("./controller-client-RD2YEMAH.js");await new e(t(n).controllerBaseUrl,{username:o,accessKey:r}).getTmsCredentials()}export{l as validateBasicAuth};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a,b,c,d}from"./chunk-TTSYHJLX.js";import"./chunk-RZ4F3BHX.js";import"./chunk-E4OYR32M.js";import"./chunk-UR6MHSHU.js";export{d as checkForUpdate,b as compareVersions,c as getSeverity,a as getUpdateCommand};
2
+ import{a,b,c,d}from"./chunk-JTEY32TL.js";import"./chunk-RZ4F3BHX.js";import"./chunk-6SGPN76K.js";import"./chunk-UR6MHSHU.js";export{d as checkForUpdate,b as compareVersions,c as getSeverity,a as getUpdateCommand};
@@ -1,5 +1,5 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{b as T}from"./chunk-AD46OCZ4.js";import"./chunk-ZKYYZ5NO.js";import"./chunk-BC7UVJJB.js";import{a as A}from"./chunk-D5T4ARTB.js";import"./chunk-AE6SS34N.js";import"./chunk-GIRXJOJI.js";import{d as V}from"./chunk-B2PZAB7J.js";import{d as g,e as x}from"./chunk-IACKIGPX.js";import"./chunk-UR6MHSHU.js";import{writeFileSync as le,mkdirSync as ce}from"fs";import{tmpdir as pe}from"os";import{dirname as ue,join as ge}from"path";var F={DERIVES:"derivation",automates:"linkage",exercises:"mesh",verifies:"mesh",depends_on:"crosslink",reuses:"crosslink",belongs_to:"containment",scoped_to:"containment",annotates:"annotation"},ne=(t,r)=>t===g.SOURCE?String(r.source_id??""):t===g.AC?String(r.text??""):t===g.STYLENOTE?String(r.statement??r.text??""):t===g.GAP?String(r.text??r.question??""):String(r.title??"");function H(t){let r=[];for(let[o,p]of t.nodeLabel){let f=t.getNode(o)?.content??{};r.push({cid:o,label:p,slug:p===g.SOURCE?String(f.source_id??""):t.nameOf.get(o)??o.slice(0,19),trust:t.trust.get(o)??"derived",fresh:t.stale(o),title:ne(p,f),content:f,superseded:t.superseded.has(o)})}let e=new Map;for(let[o]of t.nodeLabel)for(let p of t.edgesFrom(o)){let f=`${p.type}|${p.src}|${p.dst}`,v=typeof p.props?.anchor=="string"?p.props.anchor:void 0,w=e.get(f);w?(w.count++,v&&w.anchors.push(v)):e.set(f,{key:f,type:p.type,family:F[p.type]??"mesh",src:p.src,dst:p.dst,count:1,anchors:v?[v]:[],container:F[p.type]==="containment"})}let a=[...e.values()],s={},l={trusted:0,derived:0,archived:0},d={fresh:0,stale:0,orphaned:0,superseded:0},i=0;for(let o of r)o.superseded||(i++,s[o.label]=(s[o.label]??0)+1,o.label!==g.SOURCE&&l[o.trust]++,d[o.fresh]++);return{nodes:r,edges:a,summary:{nodes:i,edges:a.reduce((o,p)=>o+p.count,0),byLabel:s,trust:l,fresh:d,usecases:s[g.USECASE]??0,designed:0}}}var E=(t,r)=>t<r?-1:t>r?1:0;function re(t,r,e){let a=new Set,s=d=>{let i=e.nodeLabel.get(d);if(i===g.USECASE)a.add(d);else if(i===g.SCENARIO)for(let o of e.edgesFrom(d))o.type===x.BELONGS_TO&&a.add(o.dst)},l=e.edgesFrom(t);if(r===g.SCENARIO)for(let d of l)d.type===x.BELONGS_TO&&a.add(d.dst);if(r===g.AC)for(let d of l)d.type===x.SCOPED_TO&&s(d.dst);if(r===g.TEST)for(let d of l)d.type===x.AUTOMATES&&s(d.dst);return a}function P(t,r){let e=new Map,a=t.nodes.filter(i=>i.label===g.USECASE).map(i=>i.cid),s=a.map(i=>({ucCid:i,slug:r.nameOf.get(i)??i.slice(0,19),designed:r.designOf.has(i),nodeCids:[i]})).sort((i,o)=>E(i.slug,o.slug)),l={ucCid:"__shared__",slug:"cross-cutting",designed:!1,nodeCids:[]},d=new Map(s.map(i=>[i.ucCid,i]));for(let i of a)e.set(i,i);for(let i of t.nodes){if(i.label===g.SOURCE||i.label===g.USECASE)continue;let o=re(i.cid,i.label,r);if(o.size===1){let p=[...o][0];e.set(i.cid,p),d.get(p).nodeCids.push(i.cid)}else e.set(i.cid,"__shared__"),l.nodeCids.push(i.cid)}return{laneOf:e,lanes:[...s,l]}}var N={source:0,usecase:1,scenario:2,ac:3,test:4,stylenote:5,gap:5},se=6,G=260,R=64,z=28;function B(t,r,e){let{lanes:a}=r,s=new Map(t.nodes.map(n=>[n.cid,n])),l=new Map,d=[],i=[],o=n=>{let m=n.map(h=>l.get(h)).filter(h=>h!==void 0);return m.length?m.reduce((h,S)=>h+S,0)/m.length:Number.MAX_SAFE_INTEGER},p=a.filter(n=>n.ucCid!=="__shared__"||n.nodeCids.length>0),f=t.nodes.filter(n=>n.label===g.SOURCE).sort((n,m)=>E(n.slug,m.slug)),v=0;for(let n of p){let m=n.nodeCids.map(c=>s.get(c)).filter(Boolean),h=c=>m.filter(u=>u.label===c),S=h(g.USECASE).sort((c,u)=>E(c.slug,u.slug));S.forEach((c,u)=>l.set(c.cid,u));let D=h(g.SCENARIO).sort((c,u)=>E(c.slug,u.slug));D.forEach((c,u)=>l.set(c.cid,u));let M=h(g.AC).sort((c,u)=>{let _=o(e.edgesInto(c.cid).filter(b=>b.type===x.EXERCISES).map(b=>b.src)),O=o(e.edgesInto(u.cid).filter(b=>b.type===x.EXERCISES).map(b=>b.src));return _-O||E(c.slug,u.slug)});M.forEach((c,u)=>l.set(c.cid,u));let j=h(g.TEST).sort((c,u)=>{let _=o(e.edgesFrom(c.cid).filter(b=>b.type===x.VERIFIES).map(b=>b.dst)),O=o(e.edgesFrom(u.cid).filter(b=>b.type===x.VERIFIES).map(b=>b.dst));return _-O||E(c.slug,u.slug)});j.forEach((c,u)=>l.set(c.cid,u));let q=m.filter(c=>N[c.label]===void 0||N[c.label]>=5).sort((c,u)=>E(c.slug,u.slug));q.forEach((c,u)=>l.set(c.cid,u));let I=Math.max(1,S.length,D.length,M.length,j.length,q.length)*R+z;for(let c of m){let u=N[c.label]??4,_=l.get(c.cid)??0;d.push({...c,lane:n.ucCid,col:u,x:u*G,y:v+z/2+_*R})}i.push({...n,y0:v,y1:v+I}),v+=I}let w=Math.max(v,R);f.forEach((n,m)=>d.push({...n,lane:"__spine__",col:0,x:0,y:w/(f.length+1)*(m+1)}));let L=se*G;return{nodes:d,lanes:i,width:L,height:w}}function ie(t){return t.design_of?"design":t.review.length>0?"review":t.nodes.some(r=>r.label==="source")?"ingest":t.nodes.length>0?"extract":"other"}function U(t){let r=new Map,e=new Map,a=[];for(let s of t){for(let n of s.nodes)r.has(n.cid)||r.set(n.cid,s.seq);let l=new Map(e);for(let n of s.nodes)n.content?.derived===!0&&!e.has(n.cid)&&e.set(n.cid,"derived");for(let n of s.review)n.resolution==="approved"||n.resolution==="edited"?e.set(n.id,"trusted"):n.resolution==="rejected"?e.set(n.id,"archived"):n.resolution==="reset"&&e.set(n.id,"derived");let d=n=>{let m=0;for(let[h,S]of e)S===n&&l.get(h)!==n&&m++;return m},i=0;for(let[n,m]of e){let h=l.get(n);m==="derived"&&(h==="trusted"||h==="archived")&&i++}let o={trusted:d("trusted"),archived:d("archived"),reset:i},p=ie(s),f=s.nodes.map(n=>n.cid),v=s.edges.map(n=>`${n.type}|${n.src}|${n.dst}`),w=s.review.map(n=>n.id),L=p==="review"?"review \xB7 +"+o.trusted+" trusted"+(o.archived?", +"+o.archived+" archived":""):p+" \xB7 +"+f.length+" nodes";a.push({seq:s.seq,ts:s.ts,kind:p,label:L,mintedNodeCids:f,mintedEdgeKeys:v,reviewedNodeCids:w,trustDelta:o})}return{commits:a,bornSeq:r}}function Y(t,r,e){let a=[];for(let s of t){s.nodes.some(l=>l.cid===r)&&a.push({seq:s.seq,ts:s.ts,kind:"minted",detail:"minted here"});for(let l of s.review)l.id===r&&a.push({seq:s.seq,ts:s.ts,kind:"review",detail:l.resolution+(l.reason?": "+l.reason:"")})}return e.length&&a.push({seq:0,ts:"",kind:"derived_from",detail:"source lines "+e.join(", ")}),a}var ae={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};function k(t){return String(t).replace(/[&<>"']/g,r=>ae[r])}var $=t=>"\\u"+t.charCodeAt(0).toString(16).padStart(4,"0"),oe=new RegExp("[\u2028\u2029]","g");function W(t){return t.replace(/[<>&]/g,$).replace(oe,$)}var X=t=>t.replace("sha256:","").slice(0,12);function K(t){if(!t||typeof t!="object")return"";let r=String(t.operator??""),e=t.operand!=null?String(t.operand):"",a=t.unit!=null?" "+String(t.unit):"",s=t.baseline!=null?String(t.baseline):"",l=t.within&&typeof t.within=="object"?t.within:null,d;switch(r){case"exists":d="exists: "+e;break;case"forall":d="for all "+e;break;case"contains":d="contains "+e;break;case"gte":d=">= "+e+a;break;case"lte":d="<= "+e+a;break;case"equals":d="= "+e+a+(s?" (was "+s+")":"");break;case"changed-by":d="changed by "+e+a;break;default:d=(r+" "+e+a).trim()}if(l){let i=l.threshold!=null?String(l.threshold):"",o=l.unit!=null?String(l.unit):"";(i||o)&&(d+=" within "+i+o)}return d.trim()}var C=t=>t==null||t===""?"":`<span class="chip">${k(t)}</span>`,y=(t,r)=>r==null||r===""?"":`<div class="kv"><span class="k">${k(t)}</span><span class="v">${k(r)}</span></div>`,de=t=>Array.isArray(t)&&t.length?`<ul class="crit">${t.map(r=>`<li>${k(r)}</li>`).join("")}</ul>`:"";function J(t,r){let e=r??{};switch(t){case"usecase":return[y("description",e.description),y("value",e.value),[C(e.risk?"risk: "+e.risk:""),...Array.isArray(e.actors)?e.actors.map(a=>C(a)):[]].join(""),de(e.criteria)].join("");case"scenario":return[y("intent",e.intent),[C(e.case_type)].join(""),e.parameters&&typeof e.parameters=="object"?Object.entries(e.parameters).map(([a,s])=>y(a,s)).join(""):"",y("techniques",e.technique_notes)].join("");case"ac":return[y("",e.text),[C(e.kind),C(e.risk?"risk: "+e.risk:"")].join(""),(()=>{let a=K(e.expected_answer);return a?`<div class="pred">${k(a)}</div>`:""})()].join("");case"test":{let a=K(e.check),s=e.test_md_blob!=null?`<pre class="md">${k(String(e.test_md_blob))}</pre>`:"";return[a?`<div class="pred">${k(a)}</div>`:"",y("definitionId",e.definitionId),s].join("")}case"source":return[y("source_id",e.source_id),y("blob",e.blob)].join("");case"stylenote":return[e.statement?`<div class="pred">${k(e.statement)}</div>`:"",[C(e.learned_from_kind?"learned from: "+e.learned_from_kind:"")].join(""),y("",e.text),Array.isArray(e.tags)?e.tags.map(a=>C(a)).join(""):""].join("");case"gap":return[y("",e.text??e.question),[C(e.kind),C(e.risk?"risk: "+e.risk:"")].join(""),y("why",e.risk_rationale),y("ref",e.ref)].join("");default:return""}}function Z(t,r,e,a){let s=H(t),l=P(s,t),d=B(s,l,t),{commits:i}=U(r);s.summary.designed=l.lanes.filter(n=>n.designed&&n.ucCid!=="__shared__").length;let o={},p={};for(let n of s.nodes){o[n.cid]=J(n.label,n.content);let m=t.edgesInto(n.cid).filter(h=>h.type===x.DERIVES&&typeof h.props?.anchor=="string").map(h=>h.props.anchor);p[n.cid]=Y(r,n.cid,m)}let f=d.nodes.map(n=>({cid:n.cid,slug:n.slug,label:n.label,trust:n.trust,fresh:n.fresh,title:n.title,superseded:n.superseded,lane:n.lane,col:n.col,x:n.x,y:n.y})),v=d.lanes.map(n=>({ucCid:n.ucCid,slug:n.slug,designed:n.designed,y0:n.y0,y1:n.y1})),L=s.nodes.some(n=>n.label===g.SOURCE)?{}:void 0;return{meta:{fromSeq:r[0]?.seq??0,tipHash:e[e.length-1]??null,storePath:a,schema:"assurance/context@1",asOf:r[r.length-1]?.ts??null},summary:s.summary,lanes:v,nodes:f,edges:s.edges,commits:i,lineage:p,contentHtml:o,width:d.width,height:d.height,source:L}}var Q="__PAYLOAD__",ee=`<!doctype html>
2
+ import{b as T}from"./chunk-GRB66C5S.js";import"./chunk-RN4OSVTG.js";import"./chunk-BC7UVJJB.js";import{a as A}from"./chunk-MCQXRJGH.js";import"./chunk-74RUSHIB.js";import"./chunk-ZZLR3O5A.js";import{d as V}from"./chunk-ZG2V2ODK.js";import{d as g,e as x}from"./chunk-5YPBPZUR.js";import"./chunk-UR6MHSHU.js";import{writeFileSync as le,mkdirSync as ce}from"fs";import{tmpdir as pe}from"os";import{dirname as ue,join as ge}from"path";var F={DERIVES:"derivation",automates:"linkage",exercises:"mesh",verifies:"mesh",depends_on:"crosslink",reuses:"crosslink",belongs_to:"containment",scoped_to:"containment",annotates:"annotation"},ne=(t,r)=>t===g.SOURCE?String(r.source_id??""):t===g.AC?String(r.text??""):t===g.STYLENOTE?String(r.statement??r.text??""):t===g.GAP?String(r.text??r.question??""):String(r.title??"");function H(t){let r=[];for(let[o,p]of t.nodeLabel){let f=t.getNode(o)?.content??{};r.push({cid:o,label:p,slug:p===g.SOURCE?String(f.source_id??""):t.nameOf.get(o)??o.slice(0,19),trust:t.trust.get(o)??"derived",fresh:t.stale(o),title:ne(p,f),content:f,superseded:t.superseded.has(o)})}let e=new Map;for(let[o]of t.nodeLabel)for(let p of t.edgesFrom(o)){let f=`${p.type}|${p.src}|${p.dst}`,v=typeof p.props?.anchor=="string"?p.props.anchor:void 0,w=e.get(f);w?(w.count++,v&&w.anchors.push(v)):e.set(f,{key:f,type:p.type,family:F[p.type]??"mesh",src:p.src,dst:p.dst,count:1,anchors:v?[v]:[],container:F[p.type]==="containment"})}let a=[...e.values()],s={},l={trusted:0,derived:0,archived:0},d={fresh:0,stale:0,orphaned:0,superseded:0},i=0;for(let o of r)o.superseded||(i++,s[o.label]=(s[o.label]??0)+1,o.label!==g.SOURCE&&l[o.trust]++,d[o.fresh]++);return{nodes:r,edges:a,summary:{nodes:i,edges:a.reduce((o,p)=>o+p.count,0),byLabel:s,trust:l,fresh:d,usecases:s[g.USECASE]??0,designed:0}}}var E=(t,r)=>t<r?-1:t>r?1:0;function re(t,r,e){let a=new Set,s=d=>{let i=e.nodeLabel.get(d);if(i===g.USECASE)a.add(d);else if(i===g.SCENARIO)for(let o of e.edgesFrom(d))o.type===x.BELONGS_TO&&a.add(o.dst)},l=e.edgesFrom(t);if(r===g.SCENARIO)for(let d of l)d.type===x.BELONGS_TO&&a.add(d.dst);if(r===g.AC)for(let d of l)d.type===x.SCOPED_TO&&s(d.dst);if(r===g.TEST)for(let d of l)d.type===x.AUTOMATES&&s(d.dst);return a}function P(t,r){let e=new Map,a=t.nodes.filter(i=>i.label===g.USECASE).map(i=>i.cid),s=a.map(i=>({ucCid:i,slug:r.nameOf.get(i)??i.slice(0,19),designed:r.designOf.has(i),nodeCids:[i]})).sort((i,o)=>E(i.slug,o.slug)),l={ucCid:"__shared__",slug:"cross-cutting",designed:!1,nodeCids:[]},d=new Map(s.map(i=>[i.ucCid,i]));for(let i of a)e.set(i,i);for(let i of t.nodes){if(i.label===g.SOURCE||i.label===g.USECASE)continue;let o=re(i.cid,i.label,r);if(o.size===1){let p=[...o][0];e.set(i.cid,p),d.get(p).nodeCids.push(i.cid)}else e.set(i.cid,"__shared__"),l.nodeCids.push(i.cid)}return{laneOf:e,lanes:[...s,l]}}var N={source:0,usecase:1,scenario:2,ac:3,test:4,stylenote:5,gap:5},se=6,G=260,R=64,z=28;function B(t,r,e){let{lanes:a}=r,s=new Map(t.nodes.map(n=>[n.cid,n])),l=new Map,d=[],i=[],o=n=>{let m=n.map(h=>l.get(h)).filter(h=>h!==void 0);return m.length?m.reduce((h,S)=>h+S,0)/m.length:Number.MAX_SAFE_INTEGER},p=a.filter(n=>n.ucCid!=="__shared__"||n.nodeCids.length>0),f=t.nodes.filter(n=>n.label===g.SOURCE).sort((n,m)=>E(n.slug,m.slug)),v=0;for(let n of p){let m=n.nodeCids.map(c=>s.get(c)).filter(Boolean),h=c=>m.filter(u=>u.label===c),S=h(g.USECASE).sort((c,u)=>E(c.slug,u.slug));S.forEach((c,u)=>l.set(c.cid,u));let D=h(g.SCENARIO).sort((c,u)=>E(c.slug,u.slug));D.forEach((c,u)=>l.set(c.cid,u));let M=h(g.AC).sort((c,u)=>{let _=o(e.edgesInto(c.cid).filter(b=>b.type===x.EXERCISES).map(b=>b.src)),O=o(e.edgesInto(u.cid).filter(b=>b.type===x.EXERCISES).map(b=>b.src));return _-O||E(c.slug,u.slug)});M.forEach((c,u)=>l.set(c.cid,u));let j=h(g.TEST).sort((c,u)=>{let _=o(e.edgesFrom(c.cid).filter(b=>b.type===x.VERIFIES).map(b=>b.dst)),O=o(e.edgesFrom(u.cid).filter(b=>b.type===x.VERIFIES).map(b=>b.dst));return _-O||E(c.slug,u.slug)});j.forEach((c,u)=>l.set(c.cid,u));let q=m.filter(c=>N[c.label]===void 0||N[c.label]>=5).sort((c,u)=>E(c.slug,u.slug));q.forEach((c,u)=>l.set(c.cid,u));let I=Math.max(1,S.length,D.length,M.length,j.length,q.length)*R+z;for(let c of m){let u=N[c.label]??4,_=l.get(c.cid)??0;d.push({...c,lane:n.ucCid,col:u,x:u*G,y:v+z/2+_*R})}i.push({...n,y0:v,y1:v+I}),v+=I}let w=Math.max(v,R);f.forEach((n,m)=>d.push({...n,lane:"__spine__",col:0,x:0,y:w/(f.length+1)*(m+1)}));let L=se*G;return{nodes:d,lanes:i,width:L,height:w}}function ie(t){return t.design_of?"design":t.review.length>0?"review":t.nodes.some(r=>r.label==="source")?"ingest":t.nodes.length>0?"extract":"other"}function U(t){let r=new Map,e=new Map,a=[];for(let s of t){for(let n of s.nodes)r.has(n.cid)||r.set(n.cid,s.seq);let l=new Map(e);for(let n of s.nodes)n.content?.derived===!0&&!e.has(n.cid)&&e.set(n.cid,"derived");for(let n of s.review)n.resolution==="approved"||n.resolution==="edited"?e.set(n.id,"trusted"):n.resolution==="rejected"?e.set(n.id,"archived"):n.resolution==="reset"&&e.set(n.id,"derived");let d=n=>{let m=0;for(let[h,S]of e)S===n&&l.get(h)!==n&&m++;return m},i=0;for(let[n,m]of e){let h=l.get(n);m==="derived"&&(h==="trusted"||h==="archived")&&i++}let o={trusted:d("trusted"),archived:d("archived"),reset:i},p=ie(s),f=s.nodes.map(n=>n.cid),v=s.edges.map(n=>`${n.type}|${n.src}|${n.dst}`),w=s.review.map(n=>n.id),L=p==="review"?"review \xB7 +"+o.trusted+" trusted"+(o.archived?", +"+o.archived+" archived":""):p+" \xB7 +"+f.length+" nodes";a.push({seq:s.seq,ts:s.ts,kind:p,label:L,mintedNodeCids:f,mintedEdgeKeys:v,reviewedNodeCids:w,trustDelta:o})}return{commits:a,bornSeq:r}}function Y(t,r,e){let a=[];for(let s of t){s.nodes.some(l=>l.cid===r)&&a.push({seq:s.seq,ts:s.ts,kind:"minted",detail:"minted here"});for(let l of s.review)l.id===r&&a.push({seq:s.seq,ts:s.ts,kind:"review",detail:l.resolution+(l.reason?": "+l.reason:"")})}return e.length&&a.push({seq:0,ts:"",kind:"derived_from",detail:"source lines "+e.join(", ")}),a}var ae={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};function k(t){return String(t).replace(/[&<>"']/g,r=>ae[r])}var $=t=>"\\u"+t.charCodeAt(0).toString(16).padStart(4,"0"),oe=new RegExp("[\u2028\u2029]","g");function W(t){return t.replace(/[<>&]/g,$).replace(oe,$)}var X=t=>t.replace("sha256:","").slice(0,12);function K(t){if(!t||typeof t!="object")return"";let r=String(t.operator??""),e=t.operand!=null?String(t.operand):"",a=t.unit!=null?" "+String(t.unit):"",s=t.baseline!=null?String(t.baseline):"",l=t.within&&typeof t.within=="object"?t.within:null,d;switch(r){case"exists":d="exists: "+e;break;case"forall":d="for all "+e;break;case"contains":d="contains "+e;break;case"gte":d=">= "+e+a;break;case"lte":d="<= "+e+a;break;case"equals":d="= "+e+a+(s?" (was "+s+")":"");break;case"changed-by":d="changed by "+e+a;break;default:d=(r+" "+e+a).trim()}if(l){let i=l.threshold!=null?String(l.threshold):"",o=l.unit!=null?String(l.unit):"";(i||o)&&(d+=" within "+i+o)}return d.trim()}var C=t=>t==null||t===""?"":`<span class="chip">${k(t)}</span>`,y=(t,r)=>r==null||r===""?"":`<div class="kv"><span class="k">${k(t)}</span><span class="v">${k(r)}</span></div>`,de=t=>Array.isArray(t)&&t.length?`<ul class="crit">${t.map(r=>`<li>${k(r)}</li>`).join("")}</ul>`:"";function J(t,r){let e=r??{};switch(t){case"usecase":return[y("description",e.description),y("value",e.value),[C(e.risk?"risk: "+e.risk:""),...Array.isArray(e.actors)?e.actors.map(a=>C(a)):[]].join(""),de(e.criteria)].join("");case"scenario":return[y("intent",e.intent),[C(e.case_type)].join(""),e.parameters&&typeof e.parameters=="object"?Object.entries(e.parameters).map(([a,s])=>y(a,s)).join(""):"",y("techniques",e.technique_notes)].join("");case"ac":return[y("",e.text),[C(e.kind),C(e.risk?"risk: "+e.risk:"")].join(""),(()=>{let a=K(e.expected_answer);return a?`<div class="pred">${k(a)}</div>`:""})()].join("");case"test":{let a=K(e.check),s=e.test_md_blob!=null?`<pre class="md">${k(String(e.test_md_blob))}</pre>`:"";return[a?`<div class="pred">${k(a)}</div>`:"",y("definitionId",e.definitionId),s].join("")}case"source":return[y("source_id",e.source_id),y("blob",e.blob)].join("");case"stylenote":return[e.statement?`<div class="pred">${k(e.statement)}</div>`:"",[C(e.learned_from_kind?"learned from: "+e.learned_from_kind:"")].join(""),y("",e.text),Array.isArray(e.tags)?e.tags.map(a=>C(a)).join(""):""].join("");case"gap":return[y("",e.text??e.question),[C(e.kind),C(e.risk?"risk: "+e.risk:"")].join(""),y("why",e.risk_rationale),y("ref",e.ref)].join("");default:return""}}function Z(t,r,e,a){let s=H(t),l=P(s,t),d=B(s,l,t),{commits:i}=U(r);s.summary.designed=l.lanes.filter(n=>n.designed&&n.ucCid!=="__shared__").length;let o={},p={};for(let n of s.nodes){o[n.cid]=J(n.label,n.content);let m=t.edgesInto(n.cid).filter(h=>h.type===x.DERIVES&&typeof h.props?.anchor=="string").map(h=>h.props.anchor);p[n.cid]=Y(r,n.cid,m)}let f=d.nodes.map(n=>({cid:n.cid,slug:n.slug,label:n.label,trust:n.trust,fresh:n.fresh,title:n.title,superseded:n.superseded,lane:n.lane,col:n.col,x:n.x,y:n.y})),v=d.lanes.map(n=>({ucCid:n.ucCid,slug:n.slug,designed:n.designed,y0:n.y0,y1:n.y1})),L=s.nodes.some(n=>n.label===g.SOURCE)?{}:void 0;return{meta:{fromSeq:r[0]?.seq??0,tipHash:e[e.length-1]??null,storePath:a,schema:"assurance/context@1",asOf:r[r.length-1]?.ts??null},summary:s.summary,lanes:v,nodes:f,edges:s.edges,commits:i,lineage:p,contentHtml:o,width:d.width,height:d.height,source:L}}var Q="__PAYLOAD__",ee=`<!doctype html>
3
3
  <html lang="en">
4
4
  <head>
5
5
  <meta charset="utf-8">
@@ -0,0 +1,2 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{a as Y}from"./chunk-262ES67I.js";import"./chunk-GBBVP2JW.js";import{a as j,c as F}from"./chunk-JV356AYH.js";import"./chunk-3C5GMAM4.js";import"./chunk-GRB66C5S.js";import{a as B}from"./chunk-64LC36AF.js";import"./chunk-JFAFKHDX.js";import"./chunk-WIA7TPK3.js";import"./chunk-QPZRHAYK.js";import"./chunk-RN4OSVTG.js";import"./chunk-BC7UVJJB.js";import"./chunk-2PQXEEVY.js";import{a as I}from"./chunk-MCQXRJGH.js";import{b as U}from"./chunk-74RUSHIB.js";import"./chunk-ZZLR3O5A.js";import{g as N}from"./chunk-ZG2V2ODK.js";import"./chunk-5YPBPZUR.js";import{a as V}from"./chunk-YCCUBQY4.js";import{y as m}from"./chunk-6SGPN76K.js";import{a as P}from"./chunk-HCBYKLMW.js";import{a as A,b as u,k as M}from"./chunk-C44QQJR4.js";import{a as Q}from"./chunk-6YGTRKDT.js";import{e as O}from"./chunk-UR6MHSHU.js";var T=O(Q(),1);function K(e,p,k){let{ref:D,reason:d,by:y}=k;if(!d||d.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 x=p.resolve(D);if(!x)return{record:null,errors:[{code:"UNKNOWN_REF",detail:`no node '${D}' in the graph`}]};let r=p.tipOf(x.cid);if(p.superseded.has(r))return{record:null,errors:[{code:"ALREADY_ARCHIVED",detail:`${D} is already superseded at its tip (${r.slice(0,19)}\u2026)`}]};let t=N(e,{ts:new Date().toISOString(),proposal_id:null,nodes:[],edges:[],review:[],supersessions:[{kind:"node",old:r,new:null,reason:d,by:y}],source_head_moves:{}},{expectPrev:p.latestHash});return U(e),{record:t.record,errors:null}}function L(e){let p=e.by??{kind:"human",id:process.env.USER??"operator"},k=e.mode==="interactive"?"override":e.mode,D={out:()=>{},err:()=>{},isTTY:!1,confirm:async()=>!0},d={applied:0,committed:0,retired:0,skipped:0,deferred:0,failed:0},y=new Map;for(let r of e.planRows)if(r.held_ref&&e.held){let t=e.held.rows.find($=>$.temp_ref===r.held_ref);if(!t)continue;let l={kind:t.kind,ref:t.temp_ref,title:t.title,why:t.why,origin:"content-change",...r.impact?{impact:r.impact}:{}};y.set(l.ref,{card:l,source:"held",heldRef:t.temp_ref})}else if(r.kind==="MODIFY"){let t={kind:"MODIFY",ref:r.ref,title:r.ref,why:`${r.reason}: ${r.provenance}`,origin:r.origin??"structural-stale",...r.impact?{impact:r.impact}:{}};y.set(t.ref,{card:t,source:"row",row:r})}else if(r.kind==="ADD"){let t={kind:"ADD",ref:r.ref,title:r.ref,why:r.reason,origin:r.origin??"content-change"};y.set(t.ref,{card:t,source:"row",row:r})}for(let r of e.archive){if(r.kind!=="ARCHIVE")continue;let t={kind:"ARCHIVE",ref:r.ref,title:r.ref,why:r.why,provenance:r.why,...r.impact?{impact:r.impact}:{}};y.set(t.ref,{card:t,source:"archive",row:r})}let x=r=>(d.failed++,{outcome:"failed",detail:r});return{cards:()=>[...y.values()].map(r=>r.card),async submit(r,t){let l=y.get(r);if(!l)return x(`no card ${r}`);if(t.v==="skip")return d.skipped++,e.signals({ref:r,verdict:"gap-dismissed"}),{outcome:"skipped"};if(t.v==="defer")return d.deferred++,{outcome:"deferred"};if(t.v==="archive"){if(l.source!=="archive")return x(`${r} is not an ARCHIVE card`);let c=I(e.contextDir),C=c.resolve(l.row.ref);if(C&&c.superseded.has(c.tipOf(C.cid)))return d.skipped++,{outcome:"skipped",detail:"already retired \u2014 nothing to do"};let n=K(e.contextDir,I(e.contextDir),{ref:l.row.ref,reason:`reconcile retire: ${l.row.why}`,by:p});return n.errors?x(n.errors.map(s=>`${s.code}: ${s.detail}`).join("; ")):(d.retired++,e.signals({ref:r,verdict:"gap-resolved-archive",reason:l.row.why}),{outcome:"retired"})}if(l.source==="archive")return x(`${r} takes archive/skip/defer, not approve`);if(l.source==="held"){let c=Y(e.contextDir,e.held,l.heldRef,p,t.edits);if(!c.ok)return x(c.message);if(c.kind==="ADD"){let C=await e.runDesign(c.ref,{yes:!0,mode:k,...t.steering?{because:t.steering}:{}});return C!==0?(d.failed++,{outcome:"failed",landed:!0,detail:`committed ${c.ref}, but its design run exited ${C} \u2014 finish with kane-cli design tests --use-case ${c.ref}`}):(d.applied++,e.signals({ref:r,verdict:"gap-resolved-create",...t.steering?{reason:t.steering}:{}}),{outcome:"applied",detail:c.ref})}if(t.steering){let C=I(e.contextDir),n=j(C,c.ref);if(!n.ok)return d.committed++,{outcome:"committed",detail:`committed ${c.ref}, but steering could not resolve it (${n.message}) \u2014 steer via kane-cli maintain evolve ${c.ref}`};let s=await F(e.contextDir,n.target,{yes:!0,mode:k,because:t.steering},D,e.runDesign,"batch");if(s.outcome==="no-design"){let R=await e.runDesign(n.target.seamRef,{yes:!0,mode:k,because:t.steering});return R!==0?(d.failed++,{outcome:"failed",landed:!0,detail:`committed ${c.ref}, but its steered design run exited ${R} \u2014 finish with kane-cli design tests --use-case ${n.target.seamRef}`}):(d.applied++,e.signals({ref:r,verdict:"gap-resolved-create",reason:t.steering}),{outcome:"applied",detail:c.ref})}return s.outcome==="failed"||s.outcome==="paused"?(d.failed++,{outcome:"failed",landed:!0,detail:`committed ${c.ref}, but the steering evolve ${s.outcome} (exit ${s.code}) \u2014 finish with kane-cli maintain evolve ${c.ref}`}):s.outcome==="declined"?(d.committed++,{outcome:"committed",detail:`committed ${c.ref} \u2014 the steering evolve was declined; re-run kane-cli maintain evolve ${c.ref}`}):(d.applied++,e.signals({ref:r,verdict:"gap-resolved-evolve",reason:t.steering}),{outcome:"applied",detail:c.ref})}return d.committed++,e.signals({ref:r,verdict:"gap-resolved-evolve"}),{outcome:"committed",detail:c.ref}}let $=I(e.contextDir),b=j($,l.row.ref);if(!b.ok)return x(b.message);if(l.card.kind==="ADD"){let c=await e.runDesign(b.target.seamRef,{yes:!0,mode:k});return c!==0?x(`design run exited ${c}`):(d.applied++,e.signals({ref:r,verdict:"gap-resolved-create"}),{outcome:"applied"})}let h=await F(e.contextDir,b.target,{yes:!0,mode:k,...t.steering?{because:t.steering}:{}},D,e.runDesign,"batch");return h.outcome==="evolved"?(d.applied++,e.signals({ref:r,verdict:"gap-resolved-evolve",...t.steering?{reason:t.steering}:{}}),{outcome:"applied"}):h.outcome==="failed"||h.outcome==="paused"?x(`evolve ${h.outcome} (exit ${h.code})`):(d.skipped++,{outcome:"skipped",detail:h.outcome})},summary:()=>({...d})}}var v=O(P(),1);function S(e){return e.kind==="ARCHIVE"?[{v:"archive",label:"retire",detail:"tombstone it \u2014 the graph forgets forward"},{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"}]:[{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 E(e){return e.kind==="ARCHIVE"?null:S(e).length}var X={ADD:{color:m.green??"green"},MODIFY:{color:"yellow"},ARCHIVE:{color:m.red}},z=60;function G({card:e,position:p,sel:k=0,focused:D=!1,freeText:d=null}){let{stdout:y}=M(),r=(y?.columns??80)<z,t=S(e),l=E(e),$=X[e.kind],b=n=>D&&k===n?(0,v.jsx)(u,{color:m.generateAccent,children:"\u25B8"}):" ",h=e.impact,c=h&&h.stale_refs.length>0?`${e.kind==="ARCHIVE"?"retiring drops":"approving marks"} ${h.stale_refs.length} item(s) stale`+((h.direct_refs?.length??0)>0?` \u2014 ${h.direct_refs.length} directly touched: ${h.direct_refs.join(", ")}`:""):null,C=(0,v.jsxs)(A,{flexDirection:"column",children:[(0,v.jsx)(u,{bold:!0,color:m.generateAccent,children:`? reconcile \u2014 item ${p.n} of ${p.of}`}),(0,v.jsxs)(u,{bold:!0,children:[" ",(0,v.jsx)(u,{color:$.color,children:`[${e.kind}]`}),` ${e.title}`]}),(0,v.jsx)(u,{color:m.muted,children:` ${e.why}`}),c?(0,v.jsx)(u,{color:m.muted,children:` impact: ${c}`}):null,e.kind==="ARCHIVE"&&e.provenance&&e.provenance!==e.why?(0,v.jsx)(u,{color:m.muted,children:` ${e.provenance}`}):null,t.map((n,s)=>(0,v.jsxs)(u,{children:[" ",b(s),` ${s+1} ${n.label}`,(0,v.jsx)(u,{color:m.dim,children:` \u2014 ${n.detail}`})]},`o-${s}`)),l!==null?d?(0,v.jsxs)(A,{children:[(0,v.jsxs)(u,{children:[" ",(0,v.jsx)(u,{color:m.generateAccent,children:"\u25B8"})," ",(0,v.jsx)(u,{color:m.dim,children:"\u270E "})]}),(0,v.jsx)(V,{value:d.value,onChange:d.onChange,onSubmit:d.onSubmit,onCancel:d.onCancel,placeholder:"steer the redesign (approves, then evolves with your words)"})]}):(0,v.jsxs)(u,{children:[" ",b(l)," ",(0,v.jsx)(u,{color:m.dim,children:"\u270E steer the redesign"})]}):null]});return r?C:(0,v.jsx)(A,{flexDirection:"column",borderStyle:"round",borderColor:m.generateAccent,paddingX:1,children:C})}var g=O(P(),1);function q(e){return e.landed?"committed":e.outcome}var J={applied:"\u2713",committed:"\u2713",retired:"\u2713",skipped:"\xB7",deferred:"\u2013",failed:"\u2717"};function Z({controller:e,cards:p,note:k,markOutcome:D,routeChat:d,onFinish:y,onCtrlC:x,pauseRef:r}){let[t,l]=(0,T.useState)(p.length>0?{at:"card",idx:0,sel:0,editor:null}:{at:"chat",text:"",busy:null}),$=(0,T.useRef)(0),b=(0,T.useRef)(t);b.current=t;let h=(0,T.useRef)(!1),c=()=>{k((0,g.jsx)(u,{color:m.dim,children:"walk paused \u2014 every verdict so far is committed; re-run the same command to continue"})),y(3)},C=()=>{if(h.current)return;h.current=!0;let i=b.current;if(i.at==="busy"||i.at==="chat"&&i.busy!==null){k((0,g.jsx)(u,{color:m.dim,children:"finishing the current item, then pausing\u2026"}));return}if(i.at==="chat"){y($.current);return}c()};r&&(r.current=C);let n=t.at==="card"||t.at==="busy"?p[t.idx]:null,s=i=>{let o=i+1;if(o<p.length)l({at:"card",idx:o,sel:0,editor:null});else{let a=e.summary();k((0,g.jsx)(u,{color:m.dim,children:`reconcile walk: ${a.applied} applied, ${a.committed} committed, ${a.retired} retired, ${a.skipped} skipped, ${a.deferred} deferred`+(a.failed>0?`, ${a.failed} failed`:"")})),k((0,g.jsx)(u,{color:m.dim,children:"anything else? steer a redesign \u2014 `<uc-ref> <what to change>` \u2014 or press Enter to finish"})),l({at:"chat",text:"",busy:null})}},R=(0,T.useRef)(!1),w=(i,o)=>{if(R.current)return;R.current=!0;let a=p[i];l({at:"busy",idx:i,label:o.v==="archive"?"retiring\u2026":o.v==="approve"&&o.steering?"committing, then steering the redesign\u2026":"applying\u2026"}),e.submit(a.ref,o).catch(f=>({outcome:"failed",detail:f instanceof Error?f.message:String(f)})).then(f=>{let _=J[f.outcome]??"\xB7";if(k((0,g.jsxs)(u,{children:[(0,g.jsx)(u,{color:f.outcome==="failed"?m.red:m.green,children:_}),` ${f.outcome} [${a.kind}] ${a.title}`,f.detail?(0,g.jsx)(u,{color:m.dim,children:` \u2014 ${f.detail}`}):null,f.outcome!=="failed"&&f.outcome!=="skipped"&&f.outcome!=="deferred"&&a.impact&&a.impact.stale_refs.length>0?(0,g.jsx)(u,{color:m.dim,children:` \xB7 ${a.impact.stale_refs.length} item(s) now stale`}):null]})),f.outcome==="failed"&&($.current=$.current===0?1:$.current),D(a.ref,q(f)),R.current=!1,h.current){c();return}s(i)})},W=(0,T.useMemo)(()=>({isFocused:()=>b.current.at==="card"&&b.current.editor===null,onMove:i=>{l(o=>{if(o.at!=="card")return o;let a=p[o.idx],f=E(a)??S(a).length-1;return{...o,sel:Math.max(0,Math.min(f,o.sel+i))}})},onSelect:()=>{let i=b.current;if(i.at!=="card")return;let o=p[i.idx],a=E(o);if(a!==null&&i.sel===a){l({...i,editor:""});return}let f=S(o)[i.sel];f&&w(i.idx,{v:f.v})},onDigit:i=>{let o=b.current;if(o.at!=="card")return;let a=S(p[o.idx])[i-1];a&&w(o.idx,{v:a.v})},onType:i=>{l(o=>o.at!=="card"||E(p[o.idx])===null?o:{...o,editor:(o.editor??"")+i})},onBack:()=>{}}),[p]);return(0,T.useEffect)(()=>{t.at==="done"&&y($.current)},[t.at]),(0,g.jsxs)(A,{flexDirection:"column",children:[(0,g.jsx)(B,{onToggleThinking:()=>{},onCtrlC:()=>{x(),C()},panel:W}),t.at==="card"&&n?(0,g.jsx)(G,{card:n,position:{n:t.idx+1,of:p.length},sel:t.sel,focused:t.editor===null,freeText:t.editor!==null?{value:t.editor,onChange:i=>l(o=>o.at==="card"?{...o,editor:i}:o),onSubmit:i=>{let o=b.current;o.at==="card"&&(i.trim()?w(o.idx,{v:"approve",steering:i.trim()}):l({...o,editor:null}))},onCancel:()=>l(i=>i.at==="card"?{...i,editor:null}:i)}:null}):null,t.at==="busy"?(0,g.jsx)(u,{color:m.dim,children:`\u2026 ${t.label}`}):null,t.at==="chat"?t.busy?(0,g.jsx)(u,{color:m.dim,children:`\u2026 ${t.busy}`}):(0,g.jsxs)(A,{children:[(0,g.jsx)(u,{color:m.generateAccent,children:"\u203A "}),(0,g.jsx)(V,{value:t.text,onChange:i=>l(o=>o.at==="chat"?{...o,text:i}:o),onSubmit:i=>{let o=i.trim();if(!o){l({at:"done"});return}l({at:"chat",text:"",busy:"redesigning\u2026"}),d(o).catch(a=>`\u2717 redesign failed: ${a instanceof Error?a.message:String(a)}`).then(a=>{if(k((0,g.jsx)(u,{children:a})),h.current){c();return}l({at:"chat",text:"",busy:null})})},onCancel:()=>{},placeholder:"uc-\u2026 what to change (Enter on empty = finish)"})]}):null]})}async function xe(e){let p={current:null},k=n=>{p.current?.append(n)},D=null,d=async(n,s)=>{let[{runDesign:R},{resolveAgentAuthEnv:w},{runAgent:W},{preflightTurn:i}]=await Promise.all([import("./run-6AFY35QW.js"),import("./spawner-DWONVIPI.js"),import("./bridge-PDJEOSAJ.js"),import("./turn-preflight-JGYT7LXP.js")]);D??=await w();let o=D;return R({useCase:n,force:!0,mode:s.mode??"override",...s.because?{because:s.because}:{},...s.changeDelta!==void 0?{changeDelta:s.changeDelta}:{},...s.priorDesign!==void 0?{priorDesign:s.priorDesign}:{}},{contextDir:e.dir,agent:W,preflightTurn:()=>i(o),ask:async()=>[],out:a=>k((0,g.jsx)(u,{color:m.dim,children:` ${a}`})),progress:()=>{},isTTY:!1,auth:o})},y=e.runDesign??d,x=L({contextDir:e.dir,held:e.held,archive:e.archive,planRows:e.rows,runDesign:y,mode:"interactive",signals:e.signals}),r=new Set(e.rows.filter(n=>n.applied!==void 0).map(n=>n.held_ref??n.ref)),t=x.cards().filter(n=>!r.has(n.ref)&&!(n.kind==="ARCHIVE"&&e.archiveState?.[n.ref]!==void 0)),l=n=>e.rows.findIndex(s=>(s.held_ref??s.ref)===n),$=(n,s)=>{try{if(t.find(W=>W.ref===n)?.kind==="ARCHIVE"){s==="retired"?e.markA?.(n,"retired"):s==="skipped"&&e.markA?.(n,"skipped");return}let w=l(n);if(w<0)return;s==="applied"||s==="committed"?e.mark?.(w,"approved"):s==="skipped"&&e.mark?.(w,"skipped")}catch{}},b=async n=>{let[{openGraph:s},{resolveParentUc:R,evolveOneUc:w}]=await Promise.all([import("./readmodel-XOGOELUP.js"),import("./evolve-cmd-RUGUWKAG.js")]),[W,...i]=n.split(/\s+/),o=s(e.dir),a=R(o,W);if(!a.ok)return`couldn't resolve '${W}' \u2014 start with a use-case id (uc-\u2026): ${a.message}`;if(i.length===0)return`say what to change: \`${W} <your words>\` \u2014 the words become the redesign's change delta`;let f=i.join(" "),_={out:()=>{},err:()=>{},isTTY:!1,confirm:async()=>!0},H=await w(e.dir,a.target,{yes:!0,mode:"override",because:f},_,y,"batch");return H.outcome==="evolved"?(e.signals({ref:a.target.display,verdict:"gap-resolved-evolve",reason:f}),`\u2713 redesigned ${a.target.display} \u2014 "${f}"`):`\u2717 evolve ${H.outcome} for ${a.target.display} (exit ${H.code})`};if(e.script){let n=0;for(let s of t){let R=await e.script(s),w=await x.submit(s.ref,R);w.outcome==="failed"&&n===0&&(n=1),$(s.ref,q(w))}return n}let[{render:h},{ScrollbackProvider:c},{ScrollbackTap:C}]=await Promise.all([import("./build-JIKYOZUH.js"),import("./scrollback-JLPJR25X.js"),import("./ScrollbackTap-Q3IOKNMS.js")]);return new Promise(n=>{let s=!1,R=f=>{s||(s=!0,(async()=>{process.removeListener("SIGINT",o),await p.current?.flush();try{a.unmount()}catch{}n(f)})())},w=0,W={current:null},i=()=>{if(w+=1,w>=2){process.removeListener("SIGINT",o);try{a.unmount()}catch{}n(130)}},o=()=>{i(),W.current?.()};process.on("SIGINT",o);let a=h((0,g.jsxs)(c,{children:[(0,g.jsx)(C,{into:p}),(0,g.jsx)(Z,{controller:x,cards:t,note:k,markOutcome:$,routeChat:b,onFinish:R,onCtrlC:i,pauseRef:W})]}),{exitOnCtrlC:!1})})}export{Z as WalkSessionSurface,q as outcomeToMark,xe as runWalkSession};
package/package.json CHANGED
@@ -1,11 +1,14 @@
1
1
  {
2
2
  "name": "@testmuai/kane-cli",
3
- "version": "0.6.3",
3
+ "version": "0.6.6",
4
4
  "description": "KaneAI Terminal UI — browser automation testing agent",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
7
+ "engines": {
8
+ "node": ">=18"
9
+ },
7
10
  "bin": {
8
- "kane-cli": "./bin/kane-cli.js"
11
+ "kane-cli": "./bin/kane-cli.cjs"
9
12
  },
10
13
  "files": [
11
14
  "dist/",
@@ -14,7 +17,7 @@
14
17
  "README.md"
15
18
  ],
16
19
  "dependencies": {
17
- "@testmuai/evidence-cli": "^0.1.6",
20
+ "@testmuai/evidence-cli": "^0.1.7",
18
21
  "archiver": "^7.0.1",
19
22
  "chalk": "^5.3.0",
20
23
  "commander": "^12.0.0",
@@ -26,11 +29,16 @@
26
29
  "ws": "^8.20.0"
27
30
  },
28
31
  "optionalDependencies": {
29
- "@testmuai/kane-cli-darwin-arm64": "0.6.3",
30
- "@testmuai/kane-cli-darwin-x64": "0.6.3",
31
- "@testmuai/kane-cli-linux-x64": "0.6.3",
32
- "@testmuai/kane-cli-linux-arm64": "0.6.3",
33
- "@testmuai/kane-cli-win-x64": "0.6.3",
32
+ "@testmuai/kane-cli-darwin-arm64": "0.6.6",
33
+ "@testmuai/kane-cli-darwin-x64": "0.6.6",
34
+ "@testmuai/kane-cli-linux-x64": "0.6.6",
35
+ "@testmuai/kane-cli-linux-arm64": "0.6.6",
36
+ "@testmuai/kane-cli-win-x64": "0.6.6",
37
+ "@testmuai/kane-cli-node-darwin-arm64": "24.18.0",
38
+ "@testmuai/kane-cli-node-darwin-x64": "24.18.0",
39
+ "@testmuai/kane-cli-node-linux-x64": "24.18.0",
40
+ "@testmuai/kane-cli-node-linux-arm64": "24.18.0",
41
+ "@testmuai/kane-cli-node-win-x64": "24.18.0",
34
42
  "sharp": "^0.34.5"
35
43
  },
36
44
  "publishConfig": {
package/bin/kane-cli.js DELETED
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- import('../dist/index.js');