@testmuai/kane-cli 0.6.8 → 0.6.9

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 (102) hide show
  1. package/dist/{ChatSurface-QLRMFZJG.js → ChatSurface-B2QJYKV4.js} +1 -1
  2. package/dist/{ChromeProfilePicker-FJOUNY2B.js → ChromeProfilePicker-FSZB4SZR.js} +1 -1
  3. package/dist/{CliFeedbackPrompt-HC4NNBTK.js → CliFeedbackPrompt-WNMDCIHZ.js} +1 -1
  4. package/dist/{CliUploadProgress-VIEZQNZ5.js → CliUploadProgress-H4265KXU.js} +1 -1
  5. package/dist/{ConfigView-LK5F4F7W.js → ConfigView-XCUZ44SP.js} +1 -1
  6. package/dist/{EvidenceViewOffer-HZ4WZKGM.js → EvidenceViewOffer-5TJCRM2T.js} +1 -1
  7. package/dist/{FolderPicker-3S57MSC6.js → FolderPicker-S2XVCPYN.js} +1 -1
  8. package/dist/{HelpView-BQ3TS7WE.js → HelpView-OPKRGNNM.js} +1 -1
  9. package/dist/{InfoBox-4HVXV3TD.js → InfoBox-TW2PGJK5.js} +1 -1
  10. package/dist/{LinksBox-3B2KO5S4.js → LinksBox-66M7XP5Y.js} +1 -1
  11. package/dist/{ProfilesView-FLRMROUR.js → ProfilesView-T2CFQPR5.js} +1 -1
  12. package/dist/{ProjectPicker-R3KLRGHH.js → ProjectPicker-7ALN52CY.js} +1 -1
  13. package/dist/{SaveSessionPrompt-P7HSG7R7.js → SaveSessionPrompt-HM3F6QML.js} +1 -1
  14. package/dist/SingleShotApp-YQYS6HTB.js +2 -0
  15. package/dist/{SummaryBox-HCDIWKPS.js → SummaryBox-BQZEGOIV.js} +1 -1
  16. package/dist/TestMdRunView-7CL3PM3J.js +2 -0
  17. package/dist/{WhoamiView-ZD6FIBMK.js → WhoamiView-722MBPSG.js} +1 -1
  18. package/dist/{bind-RSVQXQJT.js → bind-HNI5LCNK.js} +2 -2
  19. package/dist/{bridge-D2HETW5M.js → bridge-V4FF5QPK.js} +1 -1
  20. package/dist/{changelog-QB7S4VV4.js → changelog-KMYZW5MI.js} +1 -1
  21. package/dist/{chunk-35RV2AAV.js → chunk-2Z5MSC23.js} +1 -1
  22. package/dist/{chunk-ELN3EN4K.js → chunk-345PY4SZ.js} +1 -1
  23. package/dist/{chunk-GO4CBUB6.js → chunk-3YI4QRXF.js} +1 -1
  24. package/dist/{chunk-K7P6VNLI.js → chunk-4BAL4OGF.js} +1 -1
  25. package/dist/{chunk-BSFONZ2E.js → chunk-4CKZAGBD.js} +1 -1
  26. package/dist/{chunk-3BIEIXJK.js → chunk-4FH2KFRT.js} +1 -1
  27. package/dist/{chunk-YKZIACYJ.js → chunk-7BCZLDNX.js} +1 -1
  28. package/dist/{chunk-ATO6NM45.js → chunk-AU7WQ2O5.js} +2 -2
  29. package/dist/{chunk-D5IZ77YG.js → chunk-CLYG26XV.js} +2 -2
  30. package/dist/{chunk-F4FXE466.js → chunk-DKERZJYF.js} +1 -1
  31. package/dist/{chunk-BUVRZXO3.js → chunk-DPOES6G3.js} +1 -1
  32. package/dist/{chunk-Q3WHZ26R.js → chunk-EASTDHNW.js} +1 -1
  33. package/dist/{chunk-D4WLVWJQ.js → chunk-EWLLPUP4.js} +1 -1
  34. package/dist/{chunk-N5YIMTGV.js → chunk-F42YVALT.js} +1 -1
  35. package/dist/{chunk-B22NUHB2.js → chunk-FFHBQK5N.js} +2 -2
  36. package/dist/{chunk-VRVSOGXH.js → chunk-FT4G3QGO.js} +1 -1
  37. package/dist/{chunk-NKCXCCPM.js → chunk-FVM7TWKT.js} +1 -1
  38. package/dist/{chunk-A6TFZQV6.js → chunk-G6F2BOFT.js} +1 -1
  39. package/dist/{chunk-AXJIXRYF.js → chunk-GBYH35H5.js} +1 -1
  40. package/dist/{chunk-VZHXNQDO.js → chunk-GNNMHYWE.js} +1 -1
  41. package/dist/{chunk-TBXIOT6M.js → chunk-IWBPV3VS.js} +1 -1
  42. package/dist/{chunk-66LXV7NN.js → chunk-JHAGEBKE.js} +1 -1
  43. package/dist/{chunk-TRXNJZSL.js → chunk-LMMOR7CR.js} +1 -1
  44. package/dist/{chunk-EQORZ6RT.js → chunk-LRA3V5GY.js} +1 -1
  45. package/dist/{chunk-5VC7MBHR.js → chunk-MXLXKHW4.js} +1 -1
  46. package/dist/{chunk-HCWEZCKP.js → chunk-NIKA2V6B.js} +1 -1
  47. package/dist/{chunk-EYZWG32F.js → chunk-O4HWPV67.js} +2 -2
  48. package/dist/{chunk-JKHQBGFY.js → chunk-OAEZKYYQ.js} +2 -2
  49. package/dist/{chunk-OYOTWI53.js → chunk-OV2W7KBC.js} +1 -1
  50. package/dist/{chunk-6WHKJSMJ.js → chunk-P4SE6YON.js} +1 -1
  51. package/dist/{chunk-PV4EDQY4.js → chunk-QB4IOM3X.js} +1 -1
  52. package/dist/{chunk-BLHCGRSK.js → chunk-QM3XF5TW.js} +1 -1
  53. package/dist/{chunk-MEHEGW3V.js → chunk-QTHITA73.js} +1 -1
  54. package/dist/{chunk-K4ERF7GT.js → chunk-QZJID3OZ.js} +1 -1
  55. package/dist/{chunk-GFKIE3AL.js → chunk-QZNUTCSD.js} +1 -1
  56. package/dist/{chunk-IQFUBT6Z.js → chunk-R65HNFRB.js} +1 -1
  57. package/dist/{chunk-YEMR62WY.js → chunk-RLICAFFQ.js} +1 -1
  58. package/dist/{chunk-NVGTSXCJ.js → chunk-RQM3DUSB.js} +1 -1
  59. package/dist/{chunk-K4LCN5X4.js → chunk-SORKKW7B.js} +1 -1
  60. package/dist/{chunk-YTK3IQUB.js → chunk-T2ULEJK7.js} +1 -1
  61. package/dist/{chunk-QOGQBVTP.js → chunk-T4WZWKIU.js} +1 -1
  62. package/dist/{chunk-FCZ2YFD3.js → chunk-TACPTX64.js} +2 -2
  63. package/dist/{chunk-NKUA3TSO.js → chunk-U5QTE3WX.js} +1 -1
  64. package/dist/{chunk-TAUSKB3O.js → chunk-U6TLLYRG.js} +1 -1
  65. package/dist/{chunk-PXPXK4Q7.js → chunk-VCYVSKPM.js} +1 -1
  66. package/dist/{chunk-XSAZDIQV.js → chunk-VXLOEM2U.js} +1 -1
  67. package/dist/{chunk-QZ7DZXLQ.js → chunk-XTO236AL.js} +2 -2
  68. package/dist/{chunk-27GF2OQ7.js → chunk-YY6WPFMT.js} +3 -3
  69. package/dist/{chunk-QFD6CB4P.js → chunk-ZA4GR5R7.js} +1 -1
  70. package/dist/{config-JV7HNJ3I.js → config-Z4OS3HEE.js} +1 -1
  71. package/dist/{credentials-TQW3TT2I.js → credentials-TNEVAUHI.js} +1 -1
  72. package/dist/{evidence-ZFYDHO73.js → evidence-MA3LDBWG.js} +1 -1
  73. package/dist/{evolve-cmd-YGJECGND.js → evolve-cmd-DTW4EOXM.js} +1 -1
  74. package/dist/{extract-bind-7UZXDON6.js → extract-bind-DZLG4GUE.js} +2 -2
  75. package/dist/{extract-cmd-TQ2MYXOG.js → extract-cmd-LFVMG6UE.js} +1 -1
  76. package/dist/{generate-headless-XXECVP6L.js → generate-headless-TYQRYQKJ.js} +2 -2
  77. package/dist/index.js +12 -12
  78. package/dist/{interactive-bind-WA2YVAUW.js → interactive-bind-QEBWUJCN.js} +2 -2
  79. package/dist/{list-commands-I577A5LK.js → list-commands-BU2MSYRH.js} +1 -1
  80. package/dist/login-flow-4L62GWLT.js +2 -0
  81. package/dist/{persist-recorded-session-DT3K6ZYQ.js → persist-recorded-session-RAL7UCQT.js} +1 -1
  82. package/dist/{pipeline-5N7HWGAL.js → pipeline-PLI5WQKX.js} +1 -1
  83. package/dist/{reconcile-cmd-HYYH3SZS.js → reconcile-cmd-UXY36ROJ.js} +1 -1
  84. package/dist/{recording-banner-QI77ERTZ.js → recording-banner-MBR3Q7VD.js} +1 -1
  85. package/dist/{require-project-folder-2UAXXZA4.js → require-project-folder-KE7XOOFN.js} +1 -1
  86. package/dist/{run-VMKZDO7J.js → run-5DQSL5KH.js} +1 -1
  87. package/dist/{run-RYIYWV63.js → run-B7BRNC3X.js} +1 -1
  88. package/dist/{run-test-md-DKRJOUFA.js → run-test-md-ZCAWNP35.js} +2 -2
  89. package/dist/{skill-installer-TK5REDD6.js → skill-installer-H5DPJJFW.js} +1 -1
  90. package/dist/{spawner-K7LWPNIC.js → spawner-C6B5J73J.js} +1 -1
  91. package/dist/tcg-generate-DIMZXAV3.js +2 -0
  92. package/dist/{testmd-actions-Q2XWL7P5.js → testmd-actions-X6XCV53D.js} +1 -1
  93. package/dist/token-refresh-7PAPCMQK.js +2 -0
  94. package/dist/{validate-basic-XEJGB4GN.js → validate-basic-VBPGGHES.js} +1 -1
  95. package/dist/{version-check-IT7T5YKJ.js → version-check-YPRCQJ7E.js} +1 -1
  96. package/dist/{walk-session-HCTG4LN2.js → walk-session-GWOP27TX.js} +1 -1
  97. package/package.json +6 -6
  98. package/dist/SingleShotApp-ZBZY7KGR.js +0 -2
  99. package/dist/TestMdRunView-GQP2QGFU.js +0 -2
  100. package/dist/login-flow-OVEZXSMW.js +0 -2
  101. package/dist/tcg-generate-6EJLU5KX.js +0 -2
  102. package/dist/token-refresh-NQZJEUQE.js +0 -2
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as Z,b as J,c as Q,d as X}from"./chunk-QZ7DZXLQ.js";import{a as q,c as z,d as fe,f as G}from"./chunk-QOGQBVTP.js";import{a as P,b as de,d as ue}from"./chunk-GRB66C5S.js";import"./chunk-3C5GMAM4.js";import{a as H}from"./chunk-TFVMSEIA.js";import{a as oe,b as ae}from"./chunk-4GXOBABK.js";import{a as K,b as V,c as L,d as j,e as le,g as x,h as N}from"./chunk-K5JGCJ2K.js";import{a as ce}from"./chunk-JFAFKHDX.js";import"./chunk-DNNZ353O.js";import"./chunk-RN4OSVTG.js";import"./chunk-QM4S2APK.js";import"./chunk-BC7UVJJB.js";import"./chunk-NVGBE2DR.js";import{a as O}from"./chunk-LEA6IHXC.js";import"./chunk-RGDQMKNJ.js";import"./chunk-L3HG5ONB.js";import"./chunk-L4JIMNKW.js";import{c as F}from"./chunk-MBXWXBDM.js";import"./chunk-IAHKTEET.js";import"./chunk-5YPBPZUR.js";import"./chunk-UR6MHSHU.js";import{existsSync as we,statSync as ke}from"fs";import{basename as Y,resolve as ge}from"path";var me=new Set(["interactive","agent","ci","override"]);function ye(e,n){if(e.mode!==void 0&&!me.has(e.mode))return{error:`--mode must be interactive | agent | ci | override, got '${e.mode}'`};let t=e.mode,r="reconcile without a TTY needs an explicit mode \u2014 pass --mode agent|ci|override, or --plan for a preview";return t==="interactive"&&!n?{error:r}:t||(n?"interactive":e.plan?"override":{error:r})}function Re(e,n,t,r){let i=ge(n,t);if(!we(i)||!ke(i).isFile())return{error:`--from '${t}' is not a file \u2014 pass the changed source document`};let a=oe(i);if(!a.ok)return{error:`--from '${t}' is not an ingestable document \u2014 allowed: ${a.allowlist.join(", ")}`};let f=O(e);if(!f.heads.has(r))return{error:`unknown source '${r}' \u2014 see \`kane-cli context list --type source\``};if(f.heads.get(r)==null)return{error:`source '${r}' is retired \u2014 restore it first with \`kane-cli context revert\`, then reconcile`};let p=null;try{p=ae(i)}catch{}return p!==null&&p!==r&&f.heads.get(p)!=null?{error:`'${Y(i)}' already backs live source '${p}' \u2014 did you mean --source-id ${p}? To truly move these bytes under '${r}', retire '${p}' first`}:{sourceId:r,filePath:i}}function I(e){return e==null?"(none)":e.slice(0,19)}function T(e,n,t,r=!1){if(e.out(`reconcile ${n.source_id}: head ${n.head.status} \u2014 ${I(n.head.before)} \u2192 ${I(n.head.after)}`),r||(e.out(`note: ${n.note}`),e.out(`skipped arms: ${n.skipped_arms}`)),n.changed&&e.out(n.held?`extract ran in override mode; ${t?.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; ${t?.defaultsTaken??0} default(s) auto-taken; matched-but-changed proposals auto-committed as edits`),r){let i=n.changeset??[],a=(p,h)=>{let k=i.filter(s=>s.kind===p).length;return k>0?`${k} ${h}`:null},f=[a("ADD","add"),a("MODIFY","modify"),a("ARCHIVE","archive")].filter(Boolean);n.changed&&e.out(`changeset: ${i.length} item(s)${f.length?` \u2014 ${f.join(" \xB7 ")}`:""}`),e.out(`plan: ${n.rows.length} row(s) \u2014 each gets a card below`);return}if(n.changed){let i=n.changeset??[];e.out(`changeset: ${i.length} item(s)`);for(let a of i)if(a.kind==="MODIFY")e.out(` [MODIFY] ${H(a.ref)} \u2014 ${a.summary} (${I(a.old_cid)} \u2192 ${a.new_cid===null?"(staged)":I(a.new_cid)})`);else if(a.kind==="ADD")e.out(` [ADD] ${H(a.ref)}`);else{e.out(` [ARCHIVE] ${H(a.ref)} \u2014 ${a.why}`);let f=ee(a.impact,"retiring drops");f&&e.out(` ${f}`)}}e.out(`plan: ${n.rows.length} row(s)`);for(let i of n.rows){e.out(` [${i.kind}] ${H(i.ref)} \u2014 ${i.reason}`);let a=ee(i.impact,"approving marks");a&&e.out(` ${a}`),e.out(` provenance: ${i.provenance}`),e.out(` action: ${i.action}`)}}function ee(e,n){if(!e||e.stale_refs.length===0)return null;let t=e.direct_refs??[];return`impact: ${n} ${e.stale_refs.length} item(s) stale`+(t.length>0?` \u2014 ${t.length} directly touched: ${t.join(", ")}`:"")}function E(e){return e==="interactive"?"override":e}async function A(e,n,t,r,i,a,f=[],p="override",h,k,s,d,v){let u;try{u=N(e)}catch($){return P(r,$ instanceof Error?$.message:String($)),1}try{if(!t){let{runWalkSession:$}=await import("./walk-session-HCTG4LN2.js");return await $({dir:e,rows:n,archive:f,held:h??null,childMode:p,runDesign:d??null,mark:a,markA:s,...k?{archiveState:k}:{},signals:y=>C(e,y.ref,y.verdict,y.reason),...v?{script:v}:{}})}return await _e(e,n,t,r,i,a,f,p,h,k)}finally{u()}}var M=e=>`${e} high-risk item(s) need a human \u2014 ci mode won't guess. Walk interactively or use --mode agent.`;function W(e,n,t){let r=n.rows;e({type:"reconcile_plan",source_id:n.source_id,plan_path:t,rows:r.map(i=>({kind:i.kind,ref:i.ref,why:i.reason})),archive:n.changeset.filter(i=>i.kind==="ARCHIVE").map(i=>({ref:i.ref,why:i.why}))})}function te(e={}){return{type:"reconcile_summary",applied:0,skipped:0,deferred:0,plan_only:0,failed:0,paused:0,stale_created:0,...e}}var ne=te();async function U(e,n,t,r,i,a,f,p,h){W(i,n,t);let k=n.changeset.filter(v=>v.kind==="ARCHIVE"&&h?.[v.ref]===void 0),s=n.rows,d;try{d=N(e)}catch(v){return i({type:"error",message:v instanceof Error?v.message:String(v)}),i(te()),2}try{return await $e(e,n,t,r,i,a,f,s,k,p)}finally{d()}}async function $e(e,n,t,r,i,a,f,p,h,k){let s=0,d=0,v=0,u=0,$=0,y=0,c=0,R=new Set,w=(l,o)=>{try{k?.(l,o)}catch{}};for(let[l,o]of p.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){d++,g("skipped");continue}if(o.kind==="REMOVE"){$++,g("plan-only");continue}if(o.held_ref&&n.held){let m=new Set;if(o.kind==="MODIFY"&&o.impact){let S=O(e);for(let ie of o.impact.stale_refs){let se=S.resolve(ie);se&&S.stale(se.tip)==="fresh"&&m.add(ie)}}let D=Z(e,n.held,o.held_ref,re);if(!D.ok){v++,c===0&&(c=1),g("failed",1,D.message);continue}if(D.kind==="ADD"){let S=await r(D.ref,{yes:!0,mode:f});if(S!==0){S===3?(u++,c===0&&(c=3),g("paused",3)):(v++,c===0&&(c=1),g("failed",S));continue}}s++,D.kind!=="ADD"&&o.impact&&(y+=m.size),w(l,"approved"),C(e,o.ref,D.kind==="ADD"?"gap-resolved-create":"gap-resolved-evolve"),g("applied");continue}let _=q(O(e),o.ref);if(!_.ok){d++,g("skipped");continue}let b=_.target;if(R.has(b.ucTip)){d++,g("skipped");continue}if(o.kind==="ADD"){let m=await r(b.seamRef,{yes:!0,mode:f});if(m===3){u++,c===0&&(c=3),g("paused",3);continue}if(m!==0){v++,c===0&&(c=1),g("failed",m);continue}R.add(b.ucTip),s++,w(l,"approved"),C(e,o.ref,"gap-resolved-create"),g("applied")}else{let m=await z(e,b,{yes:!0,mode:f},a,r,"batch");m.outcome==="evolved"?(R.add(b.ucTip),s++,w(l,"approved"),C(e,o.ref,"gap-resolved-evolve"),g("applied")):m.outcome==="paused"?(u++,c===0&&(c=m.code),g("paused",m.code)):m.outcome==="failed"?(v++,c===0&&(c=1),g("failed",m.code)):(d++,g("skipped"))}}return h.length>0&&(i({type:"reconcile_paused",plan_path:t,pending:h.map(l=>({ref:l.ref,why:l.why}))}),u+=h.length,c===0&&(c=3)),i(te({applied:s,skipped:d,plan_only:$,failed:v,paused:u,stale_created:y})),c}var re={kind:"human",id:process.env.USER??"operator"};function C(e,n,t,r){ce(e,{ts:new Date().toISOString(),command:"reconcile-walk",id:n,verdict:t,polarity:"preference",by:re,target:n,...r!==void 0?{reason:r}:{}})}async function _e(e,n,t,r,i,a,f=[],p="override",h,k){let s=0,d=0,v=0,u=0,$=0,y=0,c=0,R=new Set;for(let[w,l]of n.entries()){if(l.applied){r.out(`skipped ${l.ref} \u2014 already applied (${l.applied.outcome} at ${l.applied.at})`),d++;continue}let o=m=>{try{a?.(w,m)}catch(D){P(r,`could not record applied state for ${l.ref}: ${D instanceof Error?D.message:String(D)}`)}};if(l.kind==="REMOVE"){r.out(`REMOVE ${l.ref} \u2014 plan-only in this release (not executed)`),u++;continue}if(l.held_ref&&h){let m=Z(e,h,l.held_ref,re);if(!m.ok){P(r,`held ${l.ref}: ${m.message}`),$++,c===0&&(c=1);continue}if(r.out(`committed ${m.ref} (${l.kind==="ADD"?"minted":"updated \u2014 old\u2192new redirect"})`),m.kind==="ADD"){let D=await i(m.ref,{yes:t,mode:p});if(D===3){r.out(`design session for ${m.ref} paused \u2014 resume with "kane-cli design tests --resume"`),y++,c===0&&(c=3),o("approved");continue}if(D!==0){P(r,`design run for ${m.ref} ended with exit code ${D}`),$++,c===0&&(c=1),o("approved");continue}}s++,o("approved"),C(e,l.ref,l.kind==="ADD"?"gap-resolved-create":"gap-resolved-evolve");continue}let g=O(e),_=q(g,l.ref);if(!_.ok){r.out(`skipped ${l.ref} \u2014 ${_.message}`),d++;continue}let b=_.target;if(R.has(b.ucTip)){r.out(`skipped ${l.ref} \u2014 use-case ${b.display} already handled in this walk`),d++;continue}if(l.kind==="ADD"){let m=await i(b.seamRef,{yes:t,mode:p});if(m===3){r.out(`design session for ${b.display} paused \u2014 resume with "kane-cli design tests --resume"; this row lands when that session completes`),y++,c===0&&(c=3);continue}if(m!==0){P(r,`design run for ${b.display} ended with exit code ${m}`),$++,c===0&&(c=1);continue}R.add(b.ucTip),s++,o("approved"),C(e,l.ref,"gap-resolved-create")}else{let m=await z(e,b,{yes:!0,mode:p},r,i,"batch");m.outcome==="evolved"?(R.add(b.ucTip),s++,o("approved"),C(e,l.ref,"gap-resolved-evolve")):m.outcome==="paused"?(y++,c===0&&(c=m.code)):m.outcome==="failed"?($++,c===0&&(c=m.code)):d++}}for(let w of f)if(w.kind==="ARCHIVE"&&k?.[w.ref]===void 0){r.out(`[ARCHIVE] ${w.ref} \u2014 ${w.why}`);{let l=ee(w.impact,"retiring drops");l&&r.out(` ${l}`)}r.out(" plan-only \u2014 retire belongs to the interactive session (never headless)"),u++}return r.out(`reconcile walk: ${s} applied, ${d} skipped, ${v} deferred, ${u} plan-only`+($>0?`, ${$} failed`:"")+(y>0?`, ${y} paused`:"")),c}async function he(e,n,t,r,i,a=!1,f=!1){let p=i.seams??{reingest:Q(e,t),reextract:X(e,{stage:a})},h=null,k={reingest:p.reingest,reextract:async d=>h=await p.reextract(d)},s;try{r.out(`reconciling ${n}: re-reading the source and comparing against the graph\u2026`),s=await(i.buildPlan??J)(e,n,k)}catch(d){return P(r,`reconcile failed: ${d instanceof Error?d.message:String(d)}`),null}return s.changed&&T(r,s,h,f),s}async function Pe(e,n,t,r,i){let a=V(e,n);if("error"in a)return P(r,a.error),2;let{plan:f,path:p}=a,h=t==="override"||t==="ci";if(n===void 0&&t==="interactive"&&r.isTTY&&!await r.confirm(`apply plan ${Y(p)} for ${f.source_id} (created ${f.created})?`))return r.out(`not applying ${Y(p)}`),0;let k=i.runDesignForUc??G,s=i.runDesignForUc??null,d=i.sessionScript,v=(R,w)=>x(p,R,w),u=(R,w)=>j(p,R,w),$=F(e);if($===f.head_pin){if(t==="agent"){let w=i.emitEvent??(()=>{});return U(e,B(f),p,k,w,r,E(t),v,f.archive_state)}let R=L(f);return t==="ci"&&R.length>0?(P(r,M(R.length)),2):(r.out(`applying stored plan ${Y(p)} for ${f.source_id} (${f.rows.length} row(s))`),A(e,f.rows,h,r,k,v,f.changeset??[],E(t),f.held,f.archive_state,u,s,d))}if(r.out(`graph moved since this plan (${I(f.head_pin)} \u2192 ${I($)}) \u2014 recomputing`),f.held)return ve(e,f,r,i,t,k,!1);let y=await he(e,f.source_id,f.backing_path,r,i,!1,t==="interactive");if(!y)return 1;if(!y.changed)return T(r,y,null),0;if(t==="agent"){let R=i.emitEvent??(()=>{});return U(e,y,null,k,R,r,E(t))}let c=y.changeset.filter(R=>R.kind==="ARCHIVE");return t==="ci"&&c.length>0?(P(r,M(c.length)),2):A(e,y.rows,h,r,k,void 0,y.changeset,E(t),y.held,void 0,void 0,s,d)}function B(e,n=!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:n?e.rows.filter(t=>t.applied===void 0):e.rows,...e.held?{held:e.held}:{}}}async function be(e,n,t,r,i,a,f){let p=r.runDesignForUc??null,h=r.sessionScript,k=le(e,n);if(k===null)return null;if("error"in k)return P(t,k.error),2;let{plan:s,path:d}=k,v=s.rows.filter(c=>c.applied===void 0),u=L(s),$=r.emitEvent??(()=>{});if(v.length===0&&u.length===0){t.out(`already reconciled \u2014 plan ${s.created} applied ${s.rows.length} row(s)`);let c=fe(O(e)).staleCount;return c>0&&t.out(`${c} item(s) still stale \u2014 kane-cli maintain evolve --from-stale`),i==="agent"&&(W($,B(s),d),$({...ne})),0}let y=F(e);return y!==s.head_pin?(t.out(`plan ${s.created} superseded \u2014 graph moved (${I(s.head_pin)} \u2192 ${I(y)}); recomputing`),ve(e,s,t,r,i,a,f)):(t.out(`resuming plan ${s.created} \u2014 ${v.length} pending row(s)${u.length>0?`, ${u.length} undecided archive item(s)`:""}`),f?(T(t,B(s),null),t.out(`plan stored: ${d}`),0):i==="agent"?U(e,B(s),d,a,$,t,E(i),(c,R)=>x(d,c,R),s.archive_state):i==="ci"&&u.length>0?(P(t,M(u.length)),2):A(e,s.rows,i==="override"||i==="ci",t,a,(c,R)=>x(d,c,R),s.changeset??[],E(i),s.held,s.archive_state,(c,R)=>j(d,c,R),p,h))}async function ve(e,n,t,r,i,a,f){let p=r.runDesignForUc??null,h=r.sessionScript,k;if(n.held){let l=O(e),o=new Set(n.rows.filter(_=>_.held_ref!==void 0&&_.applied!==void 0).map(_=>_.held_ref)),g=[];for(let _ of n.held.rows){if(o.has(_.temp_ref))continue;if(!_.matched_cid){g.push(_);continue}let b=l.tipOf(_.matched_cid);if(l.superseded.get(b)===null){t.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}}})}k={source_id:n.held.source_id,rows:g}}let s=r.seams??{reingest:Q(e,n.backing_path),reextract:X(e,{stage:k!==void 0})},d;try{d=await(r.buildPlan??J)(e,n.source_id,s,{resumeHeld:k})}catch(l){return P(t,`reconcile failed: ${l instanceof Error?l.message:String(l)}`),1}T(t,d,null,i==="interactive"&&!f);let v=F(e),u=null;if(v!=null){let l={},o=new Set(d.changeset.filter(g=>g.kind==="ARCHIVE").map(g=>g.ref));for(let[g,_]of Object.entries(n.archive_state??{}))o.has(g)&&(l[g]=_);u=K(e,{version:2,source_id:d.source_id,backing_path:n.backing_path,head_pin:v,created:new Date().toISOString().replace(/[:.]/g,"-"),skipped_arms:d.skipped_arms,note:d.note,changeset:d.changeset,rows:d.rows,...d.held?{held:d.held}:{},...Object.keys(l).length>0?{archive_state:l}:{}}),t.out(`plan stored: ${u}`)}if(f)return 0;let $=r.emitEvent??(()=>{}),y=u?V(e,u).plan.archive_state:void 0,c=u?(l,o)=>x(u,l,o):void 0,R=u?(l,o)=>j(u,l,o):void 0;if(i==="agent")return U(e,d,u,a,$,t,E(i),c,y);let w=d.changeset.filter(l=>l.kind==="ARCHIVE"&&y?.[l.ref]===void 0);return i==="ci"&&w.length>0?(P(t,M(w.length)),2):A(e,d.rows,i==="override"||i==="ci",t,a,c,d.changeset,E(i),d.held,y,R,p,h)}async function pe(e,n,t={},r=process.cwd()){let i=e.apply!==void 0&&e.apply!==!1,a=typeof e.apply=="string"?e.apply:void 0;if(e.plan&&i)return P(n,"pass --plan OR --apply, not both"),2;if((e.from!==void 0||!i)&&(!e.from||!e.sourceId))return P(n,"reconcile needs --from <file> AND --source-id <id> \u2014 see `kane-cli context list --type source` for ids"),2;if(e.from&&a!==void 0)return P(n,"pass --from OR --apply <path>, not both \u2014 a stored plan names its own source"),2;let p=de(r,n);if(!p)return 2;if(e.mode!==void 0&&!me.has(e.mode))return P(n,`--mode must be interactive | agent | ci | override, got '${e.mode}'`),2;let h=e.mode==="agent"||e.mode==="ci"||e.mode==="override";if(i&&!h&&!n.isTTY)return P(n,"refusing to apply without a TTY to confirm \u2014 pass --mode override|ci"),2;let k=!e.plan,s="override";if(e.from){let o=ye(e,n.isTTY);if(typeof o=="object")return P(n,o.error),2;s=o}let d=s==="override"||s==="ci";if(i&&!e.from){let o=e.mode??"interactive";return Pe(p,a===void 0?void 0:ge(r,a),o,n,t)}let v=Re(p,r,e.from,e.sourceId);if("error"in v)return P(n,v.error),2;let u=await he(p,v.sourceId,v.filePath,n,t,!!e.plan||s==="interactive",s==="interactive"&&!e.plan);if(!u)return 1;let $=t.runDesignForUc??G,y=t.runDesignForUc??null,c=t.sessionScript;if(!u.changed){let o=await be(p,v.sourceId,n,t,s,$,!!e.plan);if(o!==null)return o;if(T(n,u,null),s==="agent"){let g=t.emitEvent??(()=>{});W(g,u,null),g({...ne})}return 0}let R=F(p),w=null;if(R!=null?w=K(p,{version:2,source_id:u.source_id,backing_path:v.filePath,head_pin:R,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}:{}}):P(n,"no chain head after extract \u2014 plan not stored"),s==="agent"){let o=t.emitEvent??(()=>{});if(!k)return W(o,u,w),o({...ne}),0;let g=w?(_,b)=>x(w,_,b):void 0;return U(p,u,w,$,o,n,E(s),g)}if(!k)return w&&n.out(`plan stored: ${w}`),0;let l=u.changeset.filter(o=>o.kind==="ARCHIVE");if(s==="ci"&&l.length>0)return w&&n.out(`plan stored: ${w}`),P(n,M(l.length)),2;if(w){n.out(`plan stored: ${w}`);let o=w;return A(p,De(p,o)??u.rows,d,n,$,(g,_)=>x(o,g,_),u.changeset,E(s),u.held,void 0,void 0,y,c)}return A(p,u.rows,d,n,$,void 0,u.changeset,E(s),u.held,void 0,void 0,y,c)}function De(e,n){let t=V(e,n);return"error"in t?null:t.plan.rows}async function je(e,n={},t,r=process.cwd()){if(e.mode==="agent"){let{makeHeadlessIO:i}=await import("./headless-io-PWW6YKH2.js"),a=t?i("ndjson","reconcile",t):i("ndjson","reconcile"),f={out:a.out,err:h=>a.event({type:"error",message:h}),isTTY:!1,confirm:async()=>!1,ask:async()=>""},p=2;try{p=await pe(e,f,{...n,emitEvent:h=>a.event(h)},r)}catch(h){a.event({type:"error",message:h instanceof Error?h.message:String(h)})}return a.done(p)}return pe(e,ue(),n,r)}export{E as childModeFor,je as reconcileCommand,ye as resolveReconcileMode,pe as runReconcileCommand,Re as validateReconcileInputs};
2
+ import{a as Z,b as J,c as Q,d as X}from"./chunk-XTO236AL.js";import{a as q,c as z,d as fe,f as G}from"./chunk-T4WZWKIU.js";import{a as P,b as de,d as ue}from"./chunk-GRB66C5S.js";import"./chunk-3C5GMAM4.js";import{a as H}from"./chunk-TFVMSEIA.js";import{a as oe,b as ae}from"./chunk-4GXOBABK.js";import{a as K,b as V,c as L,d as j,e as le,g as x,h as N}from"./chunk-K5JGCJ2K.js";import{a as ce}from"./chunk-JFAFKHDX.js";import"./chunk-DNNZ353O.js";import"./chunk-RN4OSVTG.js";import"./chunk-QM4S2APK.js";import"./chunk-BC7UVJJB.js";import"./chunk-NVGBE2DR.js";import{a as O}from"./chunk-LEA6IHXC.js";import"./chunk-RGDQMKNJ.js";import"./chunk-L3HG5ONB.js";import"./chunk-L4JIMNKW.js";import{c as F}from"./chunk-MBXWXBDM.js";import"./chunk-IAHKTEET.js";import"./chunk-5YPBPZUR.js";import"./chunk-UR6MHSHU.js";import{existsSync as we,statSync as ke}from"fs";import{basename as Y,resolve as ge}from"path";var me=new Set(["interactive","agent","ci","override"]);function ye(e,n){if(e.mode!==void 0&&!me.has(e.mode))return{error:`--mode must be interactive | agent | ci | override, got '${e.mode}'`};let t=e.mode,r="reconcile without a TTY needs an explicit mode \u2014 pass --mode agent|ci|override, or --plan for a preview";return t==="interactive"&&!n?{error:r}:t||(n?"interactive":e.plan?"override":{error:r})}function Re(e,n,t,r){let i=ge(n,t);if(!we(i)||!ke(i).isFile())return{error:`--from '${t}' is not a file \u2014 pass the changed source document`};let a=oe(i);if(!a.ok)return{error:`--from '${t}' is not an ingestable document \u2014 allowed: ${a.allowlist.join(", ")}`};let f=O(e);if(!f.heads.has(r))return{error:`unknown source '${r}' \u2014 see \`kane-cli context list --type source\``};if(f.heads.get(r)==null)return{error:`source '${r}' is retired \u2014 restore it first with \`kane-cli context revert\`, then reconcile`};let p=null;try{p=ae(i)}catch{}return p!==null&&p!==r&&f.heads.get(p)!=null?{error:`'${Y(i)}' already backs live source '${p}' \u2014 did you mean --source-id ${p}? To truly move these bytes under '${r}', retire '${p}' first`}:{sourceId:r,filePath:i}}function I(e){return e==null?"(none)":e.slice(0,19)}function T(e,n,t,r=!1){if(e.out(`reconcile ${n.source_id}: head ${n.head.status} \u2014 ${I(n.head.before)} \u2192 ${I(n.head.after)}`),r||(e.out(`note: ${n.note}`),e.out(`skipped arms: ${n.skipped_arms}`)),n.changed&&e.out(n.held?`extract ran in override mode; ${t?.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; ${t?.defaultsTaken??0} default(s) auto-taken; matched-but-changed proposals auto-committed as edits`),r){let i=n.changeset??[],a=(p,h)=>{let k=i.filter(s=>s.kind===p).length;return k>0?`${k} ${h}`:null},f=[a("ADD","add"),a("MODIFY","modify"),a("ARCHIVE","archive")].filter(Boolean);n.changed&&e.out(`changeset: ${i.length} item(s)${f.length?` \u2014 ${f.join(" \xB7 ")}`:""}`),e.out(`plan: ${n.rows.length} row(s) \u2014 each gets a card below`);return}if(n.changed){let i=n.changeset??[];e.out(`changeset: ${i.length} item(s)`);for(let a of i)if(a.kind==="MODIFY")e.out(` [MODIFY] ${H(a.ref)} \u2014 ${a.summary} (${I(a.old_cid)} \u2192 ${a.new_cid===null?"(staged)":I(a.new_cid)})`);else if(a.kind==="ADD")e.out(` [ADD] ${H(a.ref)}`);else{e.out(` [ARCHIVE] ${H(a.ref)} \u2014 ${a.why}`);let f=ee(a.impact,"retiring drops");f&&e.out(` ${f}`)}}e.out(`plan: ${n.rows.length} row(s)`);for(let i of n.rows){e.out(` [${i.kind}] ${H(i.ref)} \u2014 ${i.reason}`);let a=ee(i.impact,"approving marks");a&&e.out(` ${a}`),e.out(` provenance: ${i.provenance}`),e.out(` action: ${i.action}`)}}function ee(e,n){if(!e||e.stale_refs.length===0)return null;let t=e.direct_refs??[];return`impact: ${n} ${e.stale_refs.length} item(s) stale`+(t.length>0?` \u2014 ${t.length} directly touched: ${t.join(", ")}`:"")}function E(e){return e==="interactive"?"override":e}async function A(e,n,t,r,i,a,f=[],p="override",h,k,s,d,v){let u;try{u=N(e)}catch($){return P(r,$ instanceof Error?$.message:String($)),1}try{if(!t){let{runWalkSession:$}=await import("./walk-session-GWOP27TX.js");return await $({dir:e,rows:n,archive:f,held:h??null,childMode:p,runDesign:d??null,mark:a,markA:s,...k?{archiveState:k}:{},signals:y=>C(e,y.ref,y.verdict,y.reason),...v?{script:v}:{}})}return await _e(e,n,t,r,i,a,f,p,h,k)}finally{u()}}var M=e=>`${e} high-risk item(s) need a human \u2014 ci mode won't guess. Walk interactively or use --mode agent.`;function W(e,n,t){let r=n.rows;e({type:"reconcile_plan",source_id:n.source_id,plan_path:t,rows:r.map(i=>({kind:i.kind,ref:i.ref,why:i.reason})),archive:n.changeset.filter(i=>i.kind==="ARCHIVE").map(i=>({ref:i.ref,why:i.why}))})}function te(e={}){return{type:"reconcile_summary",applied:0,skipped:0,deferred:0,plan_only:0,failed:0,paused:0,stale_created:0,...e}}var ne=te();async function U(e,n,t,r,i,a,f,p,h){W(i,n,t);let k=n.changeset.filter(v=>v.kind==="ARCHIVE"&&h?.[v.ref]===void 0),s=n.rows,d;try{d=N(e)}catch(v){return i({type:"error",message:v instanceof Error?v.message:String(v)}),i(te()),2}try{return await $e(e,n,t,r,i,a,f,s,k,p)}finally{d()}}async function $e(e,n,t,r,i,a,f,p,h,k){let s=0,d=0,v=0,u=0,$=0,y=0,c=0,R=new Set,w=(l,o)=>{try{k?.(l,o)}catch{}};for(let[l,o]of p.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){d++,g("skipped");continue}if(o.kind==="REMOVE"){$++,g("plan-only");continue}if(o.held_ref&&n.held){let m=new Set;if(o.kind==="MODIFY"&&o.impact){let S=O(e);for(let ie of o.impact.stale_refs){let se=S.resolve(ie);se&&S.stale(se.tip)==="fresh"&&m.add(ie)}}let D=Z(e,n.held,o.held_ref,re);if(!D.ok){v++,c===0&&(c=1),g("failed",1,D.message);continue}if(D.kind==="ADD"){let S=await r(D.ref,{yes:!0,mode:f});if(S!==0){S===3?(u++,c===0&&(c=3),g("paused",3)):(v++,c===0&&(c=1),g("failed",S));continue}}s++,D.kind!=="ADD"&&o.impact&&(y+=m.size),w(l,"approved"),C(e,o.ref,D.kind==="ADD"?"gap-resolved-create":"gap-resolved-evolve"),g("applied");continue}let _=q(O(e),o.ref);if(!_.ok){d++,g("skipped");continue}let b=_.target;if(R.has(b.ucTip)){d++,g("skipped");continue}if(o.kind==="ADD"){let m=await r(b.seamRef,{yes:!0,mode:f});if(m===3){u++,c===0&&(c=3),g("paused",3);continue}if(m!==0){v++,c===0&&(c=1),g("failed",m);continue}R.add(b.ucTip),s++,w(l,"approved"),C(e,o.ref,"gap-resolved-create"),g("applied")}else{let m=await z(e,b,{yes:!0,mode:f},a,r,"batch");m.outcome==="evolved"?(R.add(b.ucTip),s++,w(l,"approved"),C(e,o.ref,"gap-resolved-evolve"),g("applied")):m.outcome==="paused"?(u++,c===0&&(c=m.code),g("paused",m.code)):m.outcome==="failed"?(v++,c===0&&(c=1),g("failed",m.code)):(d++,g("skipped"))}}return h.length>0&&(i({type:"reconcile_paused",plan_path:t,pending:h.map(l=>({ref:l.ref,why:l.why}))}),u+=h.length,c===0&&(c=3)),i(te({applied:s,skipped:d,plan_only:$,failed:v,paused:u,stale_created:y})),c}var re={kind:"human",id:process.env.USER??"operator"};function C(e,n,t,r){ce(e,{ts:new Date().toISOString(),command:"reconcile-walk",id:n,verdict:t,polarity:"preference",by:re,target:n,...r!==void 0?{reason:r}:{}})}async function _e(e,n,t,r,i,a,f=[],p="override",h,k){let s=0,d=0,v=0,u=0,$=0,y=0,c=0,R=new Set;for(let[w,l]of n.entries()){if(l.applied){r.out(`skipped ${l.ref} \u2014 already applied (${l.applied.outcome} at ${l.applied.at})`),d++;continue}let o=m=>{try{a?.(w,m)}catch(D){P(r,`could not record applied state for ${l.ref}: ${D instanceof Error?D.message:String(D)}`)}};if(l.kind==="REMOVE"){r.out(`REMOVE ${l.ref} \u2014 plan-only in this release (not executed)`),u++;continue}if(l.held_ref&&h){let m=Z(e,h,l.held_ref,re);if(!m.ok){P(r,`held ${l.ref}: ${m.message}`),$++,c===0&&(c=1);continue}if(r.out(`committed ${m.ref} (${l.kind==="ADD"?"minted":"updated \u2014 old\u2192new redirect"})`),m.kind==="ADD"){let D=await i(m.ref,{yes:t,mode:p});if(D===3){r.out(`design session for ${m.ref} paused \u2014 resume with "kane-cli design tests --resume"`),y++,c===0&&(c=3),o("approved");continue}if(D!==0){P(r,`design run for ${m.ref} ended with exit code ${D}`),$++,c===0&&(c=1),o("approved");continue}}s++,o("approved"),C(e,l.ref,l.kind==="ADD"?"gap-resolved-create":"gap-resolved-evolve");continue}let g=O(e),_=q(g,l.ref);if(!_.ok){r.out(`skipped ${l.ref} \u2014 ${_.message}`),d++;continue}let b=_.target;if(R.has(b.ucTip)){r.out(`skipped ${l.ref} \u2014 use-case ${b.display} already handled in this walk`),d++;continue}if(l.kind==="ADD"){let m=await i(b.seamRef,{yes:t,mode:p});if(m===3){r.out(`design session for ${b.display} paused \u2014 resume with "kane-cli design tests --resume"; this row lands when that session completes`),y++,c===0&&(c=3);continue}if(m!==0){P(r,`design run for ${b.display} ended with exit code ${m}`),$++,c===0&&(c=1);continue}R.add(b.ucTip),s++,o("approved"),C(e,l.ref,"gap-resolved-create")}else{let m=await z(e,b,{yes:!0,mode:p},r,i,"batch");m.outcome==="evolved"?(R.add(b.ucTip),s++,o("approved"),C(e,l.ref,"gap-resolved-evolve")):m.outcome==="paused"?(y++,c===0&&(c=m.code)):m.outcome==="failed"?($++,c===0&&(c=m.code)):d++}}for(let w of f)if(w.kind==="ARCHIVE"&&k?.[w.ref]===void 0){r.out(`[ARCHIVE] ${w.ref} \u2014 ${w.why}`);{let l=ee(w.impact,"retiring drops");l&&r.out(` ${l}`)}r.out(" plan-only \u2014 retire belongs to the interactive session (never headless)"),u++}return r.out(`reconcile walk: ${s} applied, ${d} skipped, ${v} deferred, ${u} plan-only`+($>0?`, ${$} failed`:"")+(y>0?`, ${y} paused`:"")),c}async function he(e,n,t,r,i,a=!1,f=!1){let p=i.seams??{reingest:Q(e,t),reextract:X(e,{stage:a})},h=null,k={reingest:p.reingest,reextract:async d=>h=await p.reextract(d)},s;try{r.out(`reconciling ${n}: re-reading the source and comparing against the graph\u2026`),s=await(i.buildPlan??J)(e,n,k)}catch(d){return P(r,`reconcile failed: ${d instanceof Error?d.message:String(d)}`),null}return s.changed&&T(r,s,h,f),s}async function Pe(e,n,t,r,i){let a=V(e,n);if("error"in a)return P(r,a.error),2;let{plan:f,path:p}=a,h=t==="override"||t==="ci";if(n===void 0&&t==="interactive"&&r.isTTY&&!await r.confirm(`apply plan ${Y(p)} for ${f.source_id} (created ${f.created})?`))return r.out(`not applying ${Y(p)}`),0;let k=i.runDesignForUc??G,s=i.runDesignForUc??null,d=i.sessionScript,v=(R,w)=>x(p,R,w),u=(R,w)=>j(p,R,w),$=F(e);if($===f.head_pin){if(t==="agent"){let w=i.emitEvent??(()=>{});return U(e,B(f),p,k,w,r,E(t),v,f.archive_state)}let R=L(f);return t==="ci"&&R.length>0?(P(r,M(R.length)),2):(r.out(`applying stored plan ${Y(p)} for ${f.source_id} (${f.rows.length} row(s))`),A(e,f.rows,h,r,k,v,f.changeset??[],E(t),f.held,f.archive_state,u,s,d))}if(r.out(`graph moved since this plan (${I(f.head_pin)} \u2192 ${I($)}) \u2014 recomputing`),f.held)return ve(e,f,r,i,t,k,!1);let y=await he(e,f.source_id,f.backing_path,r,i,!1,t==="interactive");if(!y)return 1;if(!y.changed)return T(r,y,null),0;if(t==="agent"){let R=i.emitEvent??(()=>{});return U(e,y,null,k,R,r,E(t))}let c=y.changeset.filter(R=>R.kind==="ARCHIVE");return t==="ci"&&c.length>0?(P(r,M(c.length)),2):A(e,y.rows,h,r,k,void 0,y.changeset,E(t),y.held,void 0,void 0,s,d)}function B(e,n=!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:n?e.rows.filter(t=>t.applied===void 0):e.rows,...e.held?{held:e.held}:{}}}async function be(e,n,t,r,i,a,f){let p=r.runDesignForUc??null,h=r.sessionScript,k=le(e,n);if(k===null)return null;if("error"in k)return P(t,k.error),2;let{plan:s,path:d}=k,v=s.rows.filter(c=>c.applied===void 0),u=L(s),$=r.emitEvent??(()=>{});if(v.length===0&&u.length===0){t.out(`already reconciled \u2014 plan ${s.created} applied ${s.rows.length} row(s)`);let c=fe(O(e)).staleCount;return c>0&&t.out(`${c} item(s) still stale \u2014 kane-cli maintain evolve --from-stale`),i==="agent"&&(W($,B(s),d),$({...ne})),0}let y=F(e);return y!==s.head_pin?(t.out(`plan ${s.created} superseded \u2014 graph moved (${I(s.head_pin)} \u2192 ${I(y)}); recomputing`),ve(e,s,t,r,i,a,f)):(t.out(`resuming plan ${s.created} \u2014 ${v.length} pending row(s)${u.length>0?`, ${u.length} undecided archive item(s)`:""}`),f?(T(t,B(s),null),t.out(`plan stored: ${d}`),0):i==="agent"?U(e,B(s),d,a,$,t,E(i),(c,R)=>x(d,c,R),s.archive_state):i==="ci"&&u.length>0?(P(t,M(u.length)),2):A(e,s.rows,i==="override"||i==="ci",t,a,(c,R)=>x(d,c,R),s.changeset??[],E(i),s.held,s.archive_state,(c,R)=>j(d,c,R),p,h))}async function ve(e,n,t,r,i,a,f){let p=r.runDesignForUc??null,h=r.sessionScript,k;if(n.held){let l=O(e),o=new Set(n.rows.filter(_=>_.held_ref!==void 0&&_.applied!==void 0).map(_=>_.held_ref)),g=[];for(let _ of n.held.rows){if(o.has(_.temp_ref))continue;if(!_.matched_cid){g.push(_);continue}let b=l.tipOf(_.matched_cid);if(l.superseded.get(b)===null){t.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}}})}k={source_id:n.held.source_id,rows:g}}let s=r.seams??{reingest:Q(e,n.backing_path),reextract:X(e,{stage:k!==void 0})},d;try{d=await(r.buildPlan??J)(e,n.source_id,s,{resumeHeld:k})}catch(l){return P(t,`reconcile failed: ${l instanceof Error?l.message:String(l)}`),1}T(t,d,null,i==="interactive"&&!f);let v=F(e),u=null;if(v!=null){let l={},o=new Set(d.changeset.filter(g=>g.kind==="ARCHIVE").map(g=>g.ref));for(let[g,_]of Object.entries(n.archive_state??{}))o.has(g)&&(l[g]=_);u=K(e,{version:2,source_id:d.source_id,backing_path:n.backing_path,head_pin:v,created:new Date().toISOString().replace(/[:.]/g,"-"),skipped_arms:d.skipped_arms,note:d.note,changeset:d.changeset,rows:d.rows,...d.held?{held:d.held}:{},...Object.keys(l).length>0?{archive_state:l}:{}}),t.out(`plan stored: ${u}`)}if(f)return 0;let $=r.emitEvent??(()=>{}),y=u?V(e,u).plan.archive_state:void 0,c=u?(l,o)=>x(u,l,o):void 0,R=u?(l,o)=>j(u,l,o):void 0;if(i==="agent")return U(e,d,u,a,$,t,E(i),c,y);let w=d.changeset.filter(l=>l.kind==="ARCHIVE"&&y?.[l.ref]===void 0);return i==="ci"&&w.length>0?(P(t,M(w.length)),2):A(e,d.rows,i==="override"||i==="ci",t,a,c,d.changeset,E(i),d.held,y,R,p,h)}async function pe(e,n,t={},r=process.cwd()){let i=e.apply!==void 0&&e.apply!==!1,a=typeof e.apply=="string"?e.apply:void 0;if(e.plan&&i)return P(n,"pass --plan OR --apply, not both"),2;if((e.from!==void 0||!i)&&(!e.from||!e.sourceId))return P(n,"reconcile needs --from <file> AND --source-id <id> \u2014 see `kane-cli context list --type source` for ids"),2;if(e.from&&a!==void 0)return P(n,"pass --from OR --apply <path>, not both \u2014 a stored plan names its own source"),2;let p=de(r,n);if(!p)return 2;if(e.mode!==void 0&&!me.has(e.mode))return P(n,`--mode must be interactive | agent | ci | override, got '${e.mode}'`),2;let h=e.mode==="agent"||e.mode==="ci"||e.mode==="override";if(i&&!h&&!n.isTTY)return P(n,"refusing to apply without a TTY to confirm \u2014 pass --mode override|ci"),2;let k=!e.plan,s="override";if(e.from){let o=ye(e,n.isTTY);if(typeof o=="object")return P(n,o.error),2;s=o}let d=s==="override"||s==="ci";if(i&&!e.from){let o=e.mode??"interactive";return Pe(p,a===void 0?void 0:ge(r,a),o,n,t)}let v=Re(p,r,e.from,e.sourceId);if("error"in v)return P(n,v.error),2;let u=await he(p,v.sourceId,v.filePath,n,t,!!e.plan||s==="interactive",s==="interactive"&&!e.plan);if(!u)return 1;let $=t.runDesignForUc??G,y=t.runDesignForUc??null,c=t.sessionScript;if(!u.changed){let o=await be(p,v.sourceId,n,t,s,$,!!e.plan);if(o!==null)return o;if(T(n,u,null),s==="agent"){let g=t.emitEvent??(()=>{});W(g,u,null),g({...ne})}return 0}let R=F(p),w=null;if(R!=null?w=K(p,{version:2,source_id:u.source_id,backing_path:v.filePath,head_pin:R,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}:{}}):P(n,"no chain head after extract \u2014 plan not stored"),s==="agent"){let o=t.emitEvent??(()=>{});if(!k)return W(o,u,w),o({...ne}),0;let g=w?(_,b)=>x(w,_,b):void 0;return U(p,u,w,$,o,n,E(s),g)}if(!k)return w&&n.out(`plan stored: ${w}`),0;let l=u.changeset.filter(o=>o.kind==="ARCHIVE");if(s==="ci"&&l.length>0)return w&&n.out(`plan stored: ${w}`),P(n,M(l.length)),2;if(w){n.out(`plan stored: ${w}`);let o=w;return A(p,De(p,o)??u.rows,d,n,$,(g,_)=>x(o,g,_),u.changeset,E(s),u.held,void 0,void 0,y,c)}return A(p,u.rows,d,n,$,void 0,u.changeset,E(s),u.held,void 0,void 0,y,c)}function De(e,n){let t=V(e,n);return"error"in t?null:t.plan.rows}async function je(e,n={},t,r=process.cwd()){if(e.mode==="agent"){let{makeHeadlessIO:i}=await import("./headless-io-PWW6YKH2.js"),a=t?i("ndjson","reconcile",t):i("ndjson","reconcile"),f={out:a.out,err:h=>a.event({type:"error",message:h}),isTTY:!1,confirm:async()=>!1,ask:async()=>""},p=2;try{p=await pe(e,f,{...n,emitEvent:h=>a.event(h)},r)}catch(h){a.event({type:"error",message:h instanceof Error?h.message:String(h)})}return a.done(p)}return pe(e,ue(),n,r)}export{E as childModeFor,je as reconcileCommand,ye as resolveReconcileMode,pe as runReconcileCommand,Re 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-4HVXV3TD.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-TW2PGJK5.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-YTK3IQUB.js";import"./chunk-2WVKOZ6W.js";import"./chunk-NLCCBXXV.js";import"./chunk-RZ4F3BHX.js";import"./chunk-K4ERF7GT.js";import"./chunk-VE3SUJMA.js";import"./chunk-PXPXK4Q7.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-T2ULEJK7.js";import"./chunk-2WVKOZ6W.js";import"./chunk-NLCCBXXV.js";import"./chunk-RZ4F3BHX.js";import"./chunk-QZJID3OZ.js";import"./chunk-VE3SUJMA.js";import"./chunk-VCYVSKPM.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{a}from"./chunk-XSAZDIQV.js";import"./chunk-SHAA6FOD.js";import"./chunk-KHU7C6EE.js";import"./chunk-3C5GMAM4.js";import"./chunk-NVGTSXCJ.js";import"./chunk-FXPPQL4D.js";import"./chunk-GG43HSU2.js";import"./chunk-JFAFKHDX.js";import"./chunk-OSALXGD4.js";import"./chunk-DNNZ353O.js";import"./chunk-YKTYVJBN.js";import"./chunk-CVOGP253.js";import"./chunk-427OQS2N.js";import"./chunk-ZPDM6FO7.js";import"./chunk-NVGBE2DR.js";import"./chunk-L5LI2JF4.js";import"./chunk-LEA6IHXC.js";import"./chunk-RGDQMKNJ.js";import"./chunk-L3HG5ONB.js";import"./chunk-L4JIMNKW.js";import"./chunk-MBXWXBDM.js";import"./chunk-IAHKTEET.js";import"./chunk-5YPBPZUR.js";import"./chunk-PXPXK4Q7.js";import"./chunk-UR6MHSHU.js";export{a as runDesign};
2
+ import{a}from"./chunk-VXLOEM2U.js";import"./chunk-SHAA6FOD.js";import"./chunk-KHU7C6EE.js";import"./chunk-3C5GMAM4.js";import"./chunk-RQM3DUSB.js";import"./chunk-FXPPQL4D.js";import"./chunk-GG43HSU2.js";import"./chunk-JFAFKHDX.js";import"./chunk-OSALXGD4.js";import"./chunk-DNNZ353O.js";import"./chunk-YKTYVJBN.js";import"./chunk-CVOGP253.js";import"./chunk-427OQS2N.js";import"./chunk-ZPDM6FO7.js";import"./chunk-NVGBE2DR.js";import"./chunk-L5LI2JF4.js";import"./chunk-LEA6IHXC.js";import"./chunk-RGDQMKNJ.js";import"./chunk-L3HG5ONB.js";import"./chunk-L4JIMNKW.js";import"./chunk-MBXWXBDM.js";import"./chunk-IAHKTEET.js";import"./chunk-5YPBPZUR.js";import"./chunk-VCYVSKPM.js";import"./chunk-UR6MHSHU.js";export{a as runDesign};
@@ -1,2 +1,2 @@
1
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-35RV2AAV.js";import"./chunk-K5JGCJ2K.js";import{f as a}from"./chunk-NVGTSXCJ.js";import"./chunk-FXPPQL4D.js";import"./chunk-GG43HSU2.js";import"./chunk-JFAFKHDX.js";import"./chunk-OSALXGD4.js";import"./chunk-DNNZ353O.js";import"./chunk-YKTYVJBN.js";import"./chunk-CVOGP253.js";import"./chunk-427OQS2N.js";import"./chunk-NVGBE2DR.js";import"./chunk-LEA6IHXC.js";import"./chunk-RGDQMKNJ.js";import"./chunk-L3HG5ONB.js";import"./chunk-L4JIMNKW.js";import"./chunk-MBXWXBDM.js";import"./chunk-IAHKTEET.js";import"./chunk-5YPBPZUR.js";import"./chunk-PXPXK4Q7.js";import"./chunk-UR6MHSHU.js";export{e as dedupPreFlags,c as displaySourceName,a as resolveAnswers,f as runExtract,b as sessionSourceRef,d as sourceBanner};
2
+ import{a as b,b as c,c as d,d as e,e as f}from"./chunk-2Z5MSC23.js";import"./chunk-K5JGCJ2K.js";import{f as a}from"./chunk-RQM3DUSB.js";import"./chunk-FXPPQL4D.js";import"./chunk-GG43HSU2.js";import"./chunk-JFAFKHDX.js";import"./chunk-OSALXGD4.js";import"./chunk-DNNZ353O.js";import"./chunk-YKTYVJBN.js";import"./chunk-CVOGP253.js";import"./chunk-427OQS2N.js";import"./chunk-NVGBE2DR.js";import"./chunk-LEA6IHXC.js";import"./chunk-RGDQMKNJ.js";import"./chunk-L3HG5ONB.js";import"./chunk-L4JIMNKW.js";import"./chunk-MBXWXBDM.js";import"./chunk-IAHKTEET.js";import"./chunk-5YPBPZUR.js";import"./chunk-VCYVSKPM.js";import"./chunk-UR6MHSHU.js";export{e as dedupPreFlags,c as displaySourceName,a as resolveAnswers,f as runExtract,b as sessionSourceRef,d as sourceBanner};
@@ -1,5 +1,5 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as A}from"./chunk-A6TFZQV6.js";import{E as M,F as P,G as K,H,I as U}from"./chunk-D5IZ77YG.js";import"./chunk-GLS46X7N.js";import{a as _,b as E}from"./chunk-FCZ2YFD3.js";import{a as h,b as k}from"./chunk-YEMR62WY.js";import"./chunk-2YQ6TW77.js";import"./chunk-RHNKYNNZ.js";import{s as L}from"./chunk-RKWJG3WW.js";import{c as R}from"./chunk-IQFUBT6Z.js";import"./chunk-TAUSKB3O.js";import"./chunk-K7P6VNLI.js";import{a as x}from"./chunk-NKCXCCPM.js";import"./chunk-C5UNZ6ZY.js";import"./chunk-S3DAAAE5.js";import"./chunk-GFKIE3AL.js";import"./chunk-NKUA3TSO.js";import"./chunk-FPFOW6BS.js";import"./chunk-WAOCHXJ5.js";import"./chunk-EYZWG32F.js";import"./chunk-FCMLIK7P.js";import"./chunk-CJJXT5DO.js";import"./chunk-QM4S2APK.js";import"./chunk-ZPDM6FO7.js";import"./chunk-BC7UVJJB.js";import"./chunk-NVGBE2DR.js";import"./chunk-EHN5HTUD.js";import"./chunk-L5LI2JF4.js";import"./chunk-LEA6IHXC.js";import"./chunk-RGDQMKNJ.js";import"./chunk-L3HG5ONB.js";import"./chunk-L4JIMNKW.js";import"./chunk-MBXWXBDM.js";import"./chunk-IAHKTEET.js";import"./chunk-5YPBPZUR.js";import{e as b,f as S,g as T}from"./chunk-M5JQXOCE.js";import"./chunk-YTK3IQUB.js";import"./chunk-2WVKOZ6W.js";import"./chunk-NLCCBXXV.js";import"./chunk-RZ4F3BHX.js";import{a as C}from"./chunk-K4ERF7GT.js";import"./chunk-VE3SUJMA.js";import"./chunk-E47GFYXA.js";import{a as v}from"./chunk-BUVRZXO3.js";import"./chunk-PXPXK4Q7.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-G6F2BOFT.js";import{E as M,F as P,G as K,H,I as U}from"./chunk-CLYG26XV.js";import"./chunk-GLS46X7N.js";import{a as _,b as E}from"./chunk-TACPTX64.js";import{a as h,b as k}from"./chunk-RLICAFFQ.js";import"./chunk-2YQ6TW77.js";import"./chunk-RHNKYNNZ.js";import{s as L}from"./chunk-RKWJG3WW.js";import{c as R}from"./chunk-R65HNFRB.js";import"./chunk-U6TLLYRG.js";import"./chunk-4BAL4OGF.js";import{a as x}from"./chunk-FVM7TWKT.js";import"./chunk-C5UNZ6ZY.js";import"./chunk-S3DAAAE5.js";import"./chunk-QZNUTCSD.js";import"./chunk-U5QTE3WX.js";import"./chunk-FPFOW6BS.js";import"./chunk-WAOCHXJ5.js";import"./chunk-O4HWPV67.js";import"./chunk-FCMLIK7P.js";import"./chunk-CJJXT5DO.js";import"./chunk-QM4S2APK.js";import"./chunk-ZPDM6FO7.js";import"./chunk-BC7UVJJB.js";import"./chunk-NVGBE2DR.js";import"./chunk-EHN5HTUD.js";import"./chunk-L5LI2JF4.js";import"./chunk-LEA6IHXC.js";import"./chunk-RGDQMKNJ.js";import"./chunk-L3HG5ONB.js";import"./chunk-L4JIMNKW.js";import"./chunk-MBXWXBDM.js";import"./chunk-IAHKTEET.js";import"./chunk-5YPBPZUR.js";import{e as b,f as S,g as T}from"./chunk-M5JQXOCE.js";import"./chunk-T2ULEJK7.js";import"./chunk-2WVKOZ6W.js";import"./chunk-NLCCBXXV.js";import"./chunk-RZ4F3BHX.js";import{a as C}from"./chunk-QZJID3OZ.js";import"./chunk-VE3SUJMA.js";import"./chunk-E47GFYXA.js";import{a as v}from"./chunk-DPOES6G3.js";import"./chunk-VCYVSKPM.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-A6TFZQV6.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-Q2XWL7P5.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-X6XCV53D.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-HCWEZCKP.js";import{b as m}from"./chunk-D4WLVWJQ.js";import{a as d}from"./chunk-RZ4F3BHX.js";import"./chunk-K4ERF7GT.js";import"./chunk-BUVRZXO3.js";import{a as f,h as a,i as u}from"./chunk-PXPXK4Q7.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-NIKA2V6B.js";import{b as m}from"./chunk-EWLLPUP4.js";import{a as d}from"./chunk-RZ4F3BHX.js";import"./chunk-QZJID3OZ.js";import"./chunk-DPOES6G3.js";import{a as f,h as a,i as u}from"./chunk-VCYVSKPM.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-YKZIACYJ.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-7BCZLDNX.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-YY6WPFMT.js";import"./chunk-3MSXQU2C.js";import"./chunk-GBYH35H5.js";import"./chunk-AU7WQ2O5.js";import"./chunk-SORKKW7B.js";import"./chunk-CLYG26XV.js";import"./chunk-GLS46X7N.js";import"./chunk-OAEZKYYQ.js";import"./chunk-TACPTX64.js";import"./chunk-RLICAFFQ.js";import"./chunk-2YQ6TW77.js";import"./chunk-345PY4SZ.js";import"./chunk-RHNKYNNZ.js";import"./chunk-RKWJG3WW.js";import"./chunk-QM3XF5TW.js";import"./chunk-R65HNFRB.js";import"./chunk-LMMOR7CR.js";import"./chunk-U6TLLYRG.js";import"./chunk-4BAL4OGF.js";import"./chunk-FVM7TWKT.js";import"./chunk-GNNMHYWE.js";import"./chunk-F42YVALT.js";import"./chunk-5Y2G4NC7.js";import"./chunk-LRA3V5GY.js";import"./chunk-IWBPV3VS.js";import"./chunk-C5UNZ6ZY.js";import"./chunk-S3DAAAE5.js";import"./chunk-QZNUTCSD.js";import"./chunk-4FH2KFRT.js";import"./chunk-U5QTE3WX.js";import"./chunk-FPFOW6BS.js";import"./chunk-WAOCHXJ5.js";import"./chunk-EASTDHNW.js";import"./chunk-RFHMDQXZ.js";import"./chunk-O4HWPV67.js";import"./chunk-FCMLIK7P.js";import"./chunk-CJJXT5DO.js";import"./chunk-QM4S2APK.js";import"./chunk-ZPDM6FO7.js";import"./chunk-BC7UVJJB.js";import"./chunk-NVGBE2DR.js";import"./chunk-EHN5HTUD.js";import"./chunk-L5LI2JF4.js";import"./chunk-LEA6IHXC.js";import"./chunk-RGDQMKNJ.js";import"./chunk-L3HG5ONB.js";import"./chunk-L4JIMNKW.js";import"./chunk-MBXWXBDM.js";import"./chunk-IAHKTEET.js";import"./chunk-5YPBPZUR.js";import"./chunk-ZA4GR5R7.js";import"./chunk-FT4G3QGO.js";import"./chunk-QB4IOM3X.js";import"./chunk-YCCUBQY4.js";import"./chunk-JHAGEBKE.js";import"./chunk-M5JQXOCE.js";import"./chunk-T2ULEJK7.js";import"./chunk-2WVKOZ6W.js";import"./chunk-NLCCBXXV.js";import"./chunk-RZ4F3BHX.js";import"./chunk-QZJID3OZ.js";import"./chunk-VE3SUJMA.js";import"./chunk-E47GFYXA.js";import"./chunk-DPOES6G3.js";import"./chunk-DKERZJYF.js";import"./chunk-3YI4QRXF.js";import{a as o}from"./chunk-DFS4RMVP.js";import"./chunk-OV2W7KBC.js";import"./chunk-QTHITA73.js";import"./chunk-VCYVSKPM.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-JKHQBGFY.js";import"./chunk-FCZ2YFD3.js";import"./chunk-YEMR62WY.js";import"./chunk-2YQ6TW77.js";import"./chunk-RKWJG3WW.js";import"./chunk-NKCXCCPM.js";import"./chunk-GFKIE3AL.js";import"./chunk-NKUA3TSO.js";import"./chunk-FPFOW6BS.js";import"./chunk-WAOCHXJ5.js";import"./chunk-L5LI2JF4.js";import"./chunk-66LXV7NN.js";import"./chunk-M5JQXOCE.js";import"./chunk-NLCCBXXV.js";import"./chunk-RZ4F3BHX.js";import"./chunk-K4ERF7GT.js";import"./chunk-BUVRZXO3.js";import"./chunk-MEHEGW3V.js";import"./chunk-PXPXK4Q7.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-OAEZKYYQ.js";import"./chunk-TACPTX64.js";import"./chunk-RLICAFFQ.js";import"./chunk-2YQ6TW77.js";import"./chunk-RKWJG3WW.js";import"./chunk-FVM7TWKT.js";import"./chunk-QZNUTCSD.js";import"./chunk-U5QTE3WX.js";import"./chunk-FPFOW6BS.js";import"./chunk-WAOCHXJ5.js";import"./chunk-L5LI2JF4.js";import"./chunk-JHAGEBKE.js";import"./chunk-M5JQXOCE.js";import"./chunk-NLCCBXXV.js";import"./chunk-RZ4F3BHX.js";import"./chunk-QZJID3OZ.js";import"./chunk-DPOES6G3.js";import"./chunk-QTHITA73.js";import"./chunk-VCYVSKPM.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-QZNUTCSD.js";import"./chunk-U5QTE3WX.js";import"./chunk-RZ4F3BHX.js";import"./chunk-QZJID3OZ.js";import"./chunk-VCYVSKPM.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-K4ERF7GT.js";import"./chunk-PXPXK4Q7.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-QZJID3OZ.js";import"./chunk-VCYVSKPM.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-D4WLVWJQ.js";import"./chunk-RZ4F3BHX.js";import"./chunk-PXPXK4Q7.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-EWLLPUP4.js";import"./chunk-RZ4F3BHX.js";import"./chunk-VCYVSKPM.js";import"./chunk-UR6MHSHU.js";export{d as checkForUpdate,b as compareVersions,c as getSeverity,a as getUpdateCommand};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as ie}from"./chunk-QZ7DZXLQ.js";import{a as Q,c as z,d as ne}from"./chunk-QOGQBVTP.js";import"./chunk-GRB66C5S.js";import"./chunk-3C5GMAM4.js";import{b as X,c as re,d as oe}from"./chunk-BSFONZ2E.js";import{a as L}from"./chunk-TFVMSEIA.js";import"./chunk-JFAFKHDX.js";import"./chunk-DNNZ353O.js";import"./chunk-RN4OSVTG.js";import"./chunk-QM4S2APK.js";import"./chunk-BC7UVJJB.js";import"./chunk-NVGBE2DR.js";import{a as _}from"./chunk-LEA6IHXC.js";import{b as te}from"./chunk-RGDQMKNJ.js";import"./chunk-L3HG5ONB.js";import"./chunk-L4JIMNKW.js";import{e as ee}from"./chunk-MBXWXBDM.js";import"./chunk-IAHKTEET.js";import"./chunk-5YPBPZUR.js";import{a as G}from"./chunk-YCCUBQY4.js";import{y as l}from"./chunk-PXPXK4Q7.js";import{a as H}from"./chunk-HCBYKLMW.js";import{a as T,b as c,k as Y}from"./chunk-C44QQJR4.js";import{a as ge}from"./chunk-6YGTRKDT.js";import{e as V}from"./chunk-UR6MHSHU.js";var A=V(ge(),1);function ae(e,g,b){let{ref:C,reason:d,by:x}=b;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 w=g.resolve(C);if(!w)return{record:null,errors:[{code:"UNKNOWN_REF",detail:`no node '${C}' in the graph`}]};let o=g.tipOf(w.cid);if(g.superseded.has(o))return{record:null,errors:[{code:"ALREADY_ARCHIVED",detail:`${C} is already superseded at its tip (${o.slice(0,19)}\u2026)`}]};let i=ee(e,{ts:new Date().toISOString(),proposal_id:null,nodes:[],edges:[],review:[],supersessions:[{kind:"node",old:o,new:null,reason:d,by:x}],source_head_moves:{}},{expectPrev:g.latestHash});return te(e),{record:i.record,errors:null}}function se(e){let g=e.by??{kind:"human",id:process.env.USER??"operator"},b=e.mode==="interactive"?"override":e.mode,C={out:()=>{},err:()=>{},isTTY:!1,confirm:async()=>!0},d={applied:0,committed:0,retired:0,skipped:0,deferred:0,failed:0},x=new Map;for(let o of e.planRows)if(o.held_ref&&e.held){let i=e.held.rows.find(n=>n.temp_ref===o.held_ref);if(!i)continue;let h={kind:i.kind,ref:i.temp_ref,title:i.title,why:i.why,origin:"content-change",...o.impact?{impact:o.impact}:{}};x.set(h.ref,{card:h,source:"held",heldRef:i.temp_ref})}else if(o.kind==="MODIFY"){let i={kind:"MODIFY",ref:o.ref,title:o.ref,why:`${o.reason}: ${o.provenance}`,origin:o.origin??"structural-stale",...o.impact?{impact:o.impact}:{}};x.set(i.ref,{card:i,source:"row",row:o})}else if(o.kind==="ADD"){let i={kind:"ADD",ref:o.ref,title:o.ref,why:o.reason,origin:o.origin??"content-change"};x.set(i.ref,{card:i,source:"row",row:o})}for(let o of e.archive){if(o.kind!=="ARCHIVE")continue;let i={kind:"ARCHIVE",ref:o.ref,title:o.ref,why:o.why,provenance:o.why,...o.impact?{impact:o.impact}:{}};x.set(i.ref,{card:i,source:"archive",row:o})}let w=o=>(d.failed++,{outcome:"failed",detail:o});return{cards:()=>[...x.values()].map(o=>o.card),async submit(o,i){let h=x.get(o);if(!h)return w(`no card ${o}`);if(i.v==="skip")return d.skipped++,e.signals({ref:o,verdict:"gap-dismissed"}),{outcome:"skipped"};if(i.v==="defer")return d.deferred++,{outcome:"deferred"};if(i.v==="archive"){if(h.source!=="archive")return w(`${o} is not an ARCHIVE card`);let s=_(e.contextDir),R=s.resolve(h.row.ref);if(R&&s.superseded.has(s.tipOf(R.cid)))return d.skipped++,{outcome:"skipped",detail:"already retired \u2014 nothing to do"};let $=ae(e.contextDir,_(e.contextDir),{ref:h.row.ref,reason:`reconcile retire: ${h.row.why}`,by:g});return $.errors?w($.errors.map(a=>`${a.code}: ${a.detail}`).join("; ")):(d.retired++,e.signals({ref:o,verdict:"gap-resolved-archive",reason:h.row.why}),{outcome:"retired"})}if(h.source==="archive")return w(`${o} takes archive/skip/defer, not approve`);if(h.source==="held"){let s=ie(e.contextDir,e.held,h.heldRef,g,i.edits);if(!s.ok)return w(s.message);if(s.kind==="ADD"){let R=await e.runDesign(s.ref,{yes:!0,mode:b,...i.steering?{because:i.steering}:{}});return R!==0?(d.failed++,{outcome:"failed",landed:!0,detail:`committed ${s.ref}, but its design run exited ${R} \u2014 finish with kane-cli design tests --use-case ${s.ref}`}):(d.applied++,e.signals({ref:o,verdict:"gap-resolved-create",...i.steering?{reason:i.steering}:{}}),{outcome:"applied",detail:s.ref})}if(i.steering){let R=_(e.contextDir),$=Q(R,s.ref);if(!$.ok)return d.committed++,{outcome:"committed",detail:`committed ${s.ref}, but steering could not resolve it (${$.message}) \u2014 steer via kane-cli maintain evolve ${s.ref}`};let a=await z(e.contextDir,$.target,{yes:!0,mode:b,because:i.steering},C,e.runDesign,"batch");if(a.outcome==="no-design"){let u=await e.runDesign($.target.seamRef,{yes:!0,mode:b,because:i.steering});return u!==0?(d.failed++,{outcome:"failed",landed:!0,detail:`committed ${s.ref}, but its steered design run exited ${u} \u2014 finish with kane-cli design tests --use-case ${$.target.seamRef}`}):(d.applied++,e.signals({ref:o,verdict:"gap-resolved-create",reason:i.steering}),{outcome:"applied",detail:s.ref})}return a.outcome==="failed"||a.outcome==="paused"?(d.failed++,{outcome:"failed",landed:!0,detail:`committed ${s.ref}, but the steering evolve ${a.outcome} (exit ${a.code}) \u2014 finish with kane-cli maintain evolve ${s.ref}`}):a.outcome==="declined"?(d.committed++,{outcome:"committed",detail:`committed ${s.ref} \u2014 the steering evolve was declined; re-run kane-cli maintain evolve ${s.ref}`}):(d.applied++,e.signals({ref:o,verdict:"gap-resolved-evolve",reason:i.steering}),{outcome:"applied",detail:s.ref})}return d.committed++,e.signals({ref:o,verdict:"gap-resolved-evolve"}),{outcome:"committed",detail:s.ref}}let n=_(e.contextDir),f=Q(n,h.row.ref);if(!f.ok)return w(f.message);if(h.card.kind==="ADD"){let s=await e.runDesign(f.target.seamRef,{yes:!0,mode:b});return s!==0?w(`design run exited ${s}`):(d.applied++,e.signals({ref:o,verdict:"gap-resolved-create"}),{outcome:"applied"})}let v=await z(e.contextDir,f.target,{yes:!0,mode:b,...i.steering?{because:i.steering}:{}},C,e.runDesign,"batch");return v.outcome==="evolved"?(d.applied++,e.signals({ref:o,verdict:"gap-resolved-evolve",...i.steering?{reason:i.steering}:{}}),{outcome:"applied"}):v.outcome==="failed"||v.outcome==="paused"?w(`evolve ${v.outcome} (exit ${v.code})`):(d.skipped++,{outcome:"skipped",detail:v.outcome})},summary:()=>({...d})}}var y=V(H(),1);function N(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 U(e){return e.kind==="ARCHIVE"?null:N(e).length}var he={ADD:{color:l.green??"green"},MODIFY:{color:"yellow"},ARCHIVE:{color:l.red}},ve=60;function le({card:e,position:g,sel:b=0,focused:C=!1,freeText:d=null}){let{stdout:x}=Y(),o=(x?.columns??80)<ve,i=N(e),h=U(e),n=he[e.kind],f=$=>C&&b===$?(0,y.jsx)(c,{color:l.generateAccent,children:"\u25B8"}):" ",v=e.impact,s=v&&v.stale_refs.length>0?`${e.kind==="ARCHIVE"?"retiring drops":"approving marks"} ${v.stale_refs.length} item(s) stale`+((v.direct_refs?.length??0)>0?` \u2014 ${v.direct_refs.length} directly touched: ${v.direct_refs.join(", ")}`:""):null,R=(0,y.jsxs)(T,{flexDirection:"column",children:[(0,y.jsx)(c,{bold:!0,color:l.generateAccent,children:`? reconcile \u2014 item ${g.n} of ${g.of}`}),(0,y.jsxs)(c,{bold:!0,children:[" ",(0,y.jsx)(c,{color:n.color,children:`[${e.kind}]`}),` ${L(e.title)}`]}),(0,y.jsx)(c,{color:l.muted,children:` ${e.why}`}),s?(0,y.jsx)(c,{color:l.muted,children:` impact: ${s}`}):null,e.kind==="ARCHIVE"&&e.provenance&&e.provenance!==e.why?(0,y.jsx)(c,{color:l.muted,children:` ${e.provenance}`}):null,i.map(($,a)=>(0,y.jsxs)(c,{children:[" ",f(a),` ${a+1} ${$.label}`,(0,y.jsx)(c,{color:l.dim,children:` \u2014 ${$.detail}`})]},`o-${a}`)),h!==null?d?(0,y.jsxs)(T,{flexDirection:"column",children:[(0,y.jsxs)(T,{children:[(0,y.jsxs)(c,{children:[" ",(0,y.jsx)(c,{color:l.generateAccent,children:"\u25B8"})," ",(0,y.jsx)(c,{color:l.dim,children:"\u270E "})]}),(0,y.jsx)(G,{value:d.value,onChange:d.onChange,onSubmit:d.onSubmit,onCancel:d.onCancel,placeholder:"say what to adjust"})]}),(0,y.jsx)(c,{color:l.muted,children:" submits as: approve \xB7 your words steer the re-design"})]}):(0,y.jsxs)(c,{children:[" ",f(h)," ",(0,y.jsx)(c,{color:l.dim,children:"\u270E approve with changes \u2014 say what to adjust"})]}):null,(0,y.jsx)(c,{color:l.muted,children:h!==null?" \u2191\u2193 \xB7 \u23CE select \xB7 1-9 \xB7 type = adjust \xB7 esc \xB7 nothing to undo":" \u2191\u2193 \xB7 \u23CE select \xB7 1-9 \xB7 esc \xB7 nothing to undo"})]});return o?R:(0,y.jsx)(T,{flexDirection:"column",borderStyle:"round",borderColor:l.generateAccent,paddingX:1,children:R})}var j=V(H(),1);function K({mark:e,markColor:g,color:b,indent:C=2,reserve:d=0,children:x}){let{stdout:w}=Y(),o=(w?.columns??80)-d,i=C+e.length+1;return(0,j.jsxs)(T,{children:[(0,j.jsx)(T,{width:i,flexShrink:0,children:(0,j.jsx)(c,{color:g,children:`${" ".repeat(C)}${e}`})}),(0,j.jsx)(T,{width:Math.max(20,o-i),children:(0,j.jsx)(c,{color:b,children:x})})]})}var p=V(H(),1);function ce(e){return e.landed?"committed":e.outcome}var ke={applied:{mark:"\u2714",color:"green"},committed:{mark:"\u2714",color:"green"},retired:{mark:"\u2714",color:"green"},skipped:{mark:"\xB7",color:"dim"},deferred:{mark:"\u2013",color:"dim"},failed:{mark:"\u2717",color:"red"}},q=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"];function ye(e){return e.v==="archive"?"Retiring\u2026":e.v==="approve"&&e.steering?"Approving with your changes \u2014 committing, then re-designing\u2026":"Applying \u2014 committing\u2026"}function we({controller:e,cards:g,note:b,markOutcome:C,routeChat:d,listEvolveTargets:x,barSubject:w,onFinish:o,onCtrlC:i,pauseRef:h}){let[n,f]=(0,A.useState)(g.length>0?{at:"card",idx:0,sel:0,editor:null}:{at:"done-panel",sel:0}),v=(0,A.useRef)(0),s=(0,A.useRef)(n);s.current=n;let R=(0,A.useRef)([]),[$,a]=(0,A.useState)(0),u=n.at==="busy"||n.at==="evolving";(0,A.useEffect)(()=>{if(!u)return;let t=setInterval(()=>a(r=>r+1),120);return()=>clearInterval(t)},[u]);let W=(0,A.useRef)(!1),D=()=>{b((0,p.jsx)(c,{color:l.dim,children:"walk paused \u2014 every verdict so far is committed; re-run the same command to continue"})),o(3)},S=()=>{if(W.current)return;W.current=!0;let t=s.current;if(t.at==="busy"||t.at==="evolving"){b((0,p.jsx)(c,{color:l.dim,children:"finishing the current item, then pausing\u2026"}));return}if(t.at==="done-panel"||t.at==="picker"||t.at==="why"||t.at==="view"){o(v.current);return}D()};h&&(h.current=S);let I=n.at==="card"||n.at==="busy"?g[n.idx]:null,E=()=>[{key:"finish",label:"finish"},...x?[{key:"evolve",label:"evolve another use-case\u2026"}]:[],...R.current.length>0?[{key:"view",label:"view what changed"}]:[]],O=()=>{let t=x?.()??[];if(t.length===0){b((0,p.jsx)(c,{color:l.dim,children:"nothing is stale \u2014 no evolve targets right now"})),f({at:"done-panel",sel:0});return}f({at:"picker",items:t,sel:0})},P=t=>{let r=t+1;if(r<g.length)f({at:"card",idx:r,sel:0,editor:null});else{let m=e.summary();b((0,p.jsx)(c,{color:l.dim,children:`reconcile walk: ${m.applied} applied, ${m.committed} committed, ${m.retired} retired, ${m.skipped} skipped, ${m.deferred} deferred`+(m.failed>0?`, ${m.failed} failed`:"")})),f({at:"done-panel",sel:0})}},F=(0,A.useRef)(!1),M=(t,r)=>{if(F.current)return;F.current=!0;let m=g[t];f({at:"busy",idx:t,label:ye(r),startedAt:Date.now()}),e.submit(m.ref,r).catch(k=>({outcome:"failed",detail:k instanceof Error?k.message:String(k)})).then(k=>{let B=ke[k.outcome]??{mark:"\xB7",color:"dim"},fe=k.outcome!=="failed"&&k.outcome!=="skipped"&&k.outcome!=="deferred"&&m.impact&&m.impact.stale_refs.length>0?` \xB7 ${m.impact.stale_refs.length} item(s) now stale`:"",Z=`${k.outcome} [${m.kind}] ${L(m.title)}${k.detail?` \u2014 ${L(k.detail)}`:""}${fe}`;if(R.current.push({mark:B.mark,color:B.color,line:Z}),b((0,p.jsx)(K,{mark:B.mark,markColor:B.color==="green"?l.green:B.color==="red"?l.red:l.dim,color:B.color==="dim"?l.dim:void 0,children:Z})),k.outcome==="failed"&&(v.current=v.current===0?1:v.current),C(m.ref,ce(k)),F.current=!1,W.current){D();return}P(t)})},de=(t,r)=>{f({at:"evolving",title:t.title,startedAt:Date.now()}),d(`${t.key} ${r}`).catch(m=>`\u2717 evolve failed: ${m instanceof Error?m.message:String(m)}`).then(m=>{let k=m.startsWith("\u2713");if(R.current.push({mark:k?"\u2714":"\u2717",color:k?"green":"red",line:m.replace(/^[✓✗]\s*/,"")}),b((0,p.jsx)(K,{mark:k?"\u2714":"\u2717",markColor:k?l.green:l.red,children:m.replace(/^[✓✗]\s*/,"")})),W.current){o(v.current);return}f({at:"done-panel",sel:0})})},ue=(0,A.useMemo)(()=>({isFocused:()=>{let t=s.current;return t.at==="card"&&t.editor===null||t.at==="done-panel"||t.at==="picker"||t.at==="view"},onMove:t=>{f(r=>{if(r.at==="card"){let m=g[r.idx],k=U(m)??N(m).length-1;return{...r,sel:Math.max(0,Math.min(k,r.sel+t))}}return r.at==="done-panel"?{...r,sel:Math.max(0,Math.min(E().length-1,r.sel+t))}:r.at==="picker"?{...r,sel:Math.max(0,Math.min(r.items.length-1,r.sel+t))}:r})},onSelect:()=>{let t=s.current;if(t.at==="card"){let r=g[t.idx],m=U(r);if(m!==null&&t.sel===m){f({...t,editor:""});return}let k=N(r)[t.sel];k&&M(t.idx,{v:k.v});return}if(t.at==="done-panel"){let r=E()[t.sel];r?.key==="finish"?o(v.current):r?.key==="evolve"?O():r?.key==="view"&&f({at:"view"});return}if(t.at==="picker"){let r=t.items[t.sel];r&&f({at:"why",item:r,text:""});return}},onDigit:t=>{let r=s.current;if(r.at==="card"){let m=N(g[r.idx])[t-1];m&&M(r.idx,{v:m.v});return}r.at==="done-panel"&&t-1<E().length&&f({...r,sel:t-1}),r.at==="picker"&&t-1<r.items.length&&f({...r,sel:t-1})},onType:t=>{f(r=>r.at!=="card"||U(g[r.idx])===null?r:{...r,editor:(r.editor??"")+t})},isMulti:()=>!1,onSpace:()=>{},onBack:()=>{let t=s.current;(t.at==="picker"||t.at==="view")&&f({at:"done-panel",sel:0})}}),[g]);(0,A.useEffect)(()=>{n.at==="done"&&o(v.current)},[n.at]);let me=n.at==="card"||n.at==="done-panel"||n.at==="picker"||n.at==="why"||n.at==="view",pe=n.at==="card"||n.at==="busy"?`${w?`${w} \xB7 `:""}item ${n.idx+1} of ${g.length}`:w,J=t=>Math.floor((Date.now()-t)/1e3);return(0,p.jsxs)(T,{flexDirection:"column",children:[(0,p.jsx)(oe,{onToggleThinking:()=>{},onCtrlC:()=>{i(),S()},panel:ue}),n.at==="card"&&I?(0,p.jsx)(le,{card:I,position:{n:n.idx+1,of:g.length},sel:n.sel,focused:n.editor===null,freeText:n.editor!==null?{value:n.editor,onChange:t=>f(r=>r.at==="card"?{...r,editor:t}:r),onSubmit:t=>{let r=s.current;r.at==="card"&&(t.trim()?M(r.idx,{v:"approve",steering:t.trim()}):f({...r,editor:null}))},onCancel:()=>f(t=>t.at==="card"?{...t,editor:null}:t)}:null}):null,n.at==="busy"?(0,p.jsxs)(c,{color:l.generateAccent,children:[`${q[$%q.length]} ${n.label} `,(0,p.jsx)(c,{color:l.dim,children:`(${J(n.startedAt)}s)`})]}):null,n.at==="evolving"?(0,p.jsxs)(c,{color:l.generateAccent,children:[`${q[$%q.length]} Evolving ${n.title}\u2026 `,(0,p.jsx)(c,{color:l.dim,children:`(${J(n.startedAt)}s)`})]}):null,n.at==="done-panel"?(0,p.jsx)(X,{headline:(()=>{let t=e.summary();return`reconcile done \u2014 ${t.applied+t.committed} applied \xB7 ${t.retired} retired \xB7 ${t.skipped} skipped \xB7 ${t.deferred} deferred${t.failed>0?` \xB7 ${t.failed} failed`:""}`})(),rows:E(),sel:n.sel,focused:!0,legend:"\u2191\u2193 \xB7 \u23CE select"}):null,n.at==="picker"?(0,p.jsx)(X,{ask:!0,headline:"evolve which use-case?",rows:n.items.map(t=>({key:t.key,label:t.title,detail:t.badge})),sel:n.sel,focused:!0,legend:"\u2191\u2193 \xB7 \u23CE select \xB7 esc back"}):null,n.at==="why"?(0,p.jsxs)(T,{flexDirection:"column",borderStyle:"round",borderColor:l.generateAccent,paddingX:1,children:[(0,p.jsxs)(T,{children:[(0,p.jsxs)(c,{children:[(0,p.jsx)(c,{color:l.generateAccent,children:"\u25B8"})," ",(0,p.jsx)(c,{color:l.dim,children:"\u270E "})]}),(0,p.jsx)(G,{value:n.text,onChange:t=>f(r=>r.at==="why"?{...r,text:t}:r),onSubmit:t=>{let r=s.current;r.at==="why"&&(t.trim()?de(r.item,t.trim()):f({at:"picker",items:[r.item],sel:0}))},onCancel:()=>{s.current.at==="why"&&O()},placeholder:`what should change about ${n.item.title}?`})]}),(0,p.jsx)(c,{color:l.muted,children:" \u23CE submit \xB7 esc back"})]}):null,n.at==="view"?(0,p.jsxs)(T,{flexDirection:"column",borderStyle:"round",borderColor:l.dim,paddingX:1,children:[(0,p.jsx)(c,{bold:!0,children:`view \xB7 this run's changes \xB7 ${R.current.length}`}),R.current.map((t,r)=>(0,p.jsx)(K,{mark:t.mark,markColor:t.color==="green"?l.green:t.color==="red"?l.red:l.dim,color:t.color==="dim"?l.dim:void 0,indent:0,reserve:4,children:t.line},`vc-${r}`)),(0,p.jsx)(c,{color:l.muted,children:" esc back"})]}):null,(0,p.jsx)(re,{verb:"maintain",subject:pe,state:me?"idle":void 0,hints:"ctrl+c exit"})]})}async function Xe(e){let g={current:null},b=a=>{g.current?.append(a)},C=null,d=async(a,u)=>{let[{runDesign:W},{resolveAgentAuthEnv:D},{runAgent:S},{preflightTurn:I}]=await Promise.all([import("./run-VMKZDO7J.js"),import("./spawner-K7LWPNIC.js"),import("./bridge-D2HETW5M.js"),import("./turn-preflight-JGYT7LXP.js")]);C??=await D();let E=C;return W({useCase:a,force:!0,mode:u.mode??"override",...u.because?{because:u.because}:{},...u.changeDelta!==void 0?{changeDelta:u.changeDelta}:{},...u.priorDesign!==void 0?{priorDesign:u.priorDesign}:{}},{contextDir:e.dir,agent:S,preflightTurn:()=>I(E),ask:async()=>[],out:()=>{},progress:()=>{},isTTY:!1,auth:E})},x=e.runDesign??d,w=se({contextDir:e.dir,held:e.held,archive:e.archive,planRows:e.rows,runDesign:x,mode:"interactive",signals:e.signals}),o=new Set(e.rows.filter(a=>a.applied!==void 0).map(a=>a.held_ref??a.ref)),i=w.cards().filter(a=>!o.has(a.ref)&&!(a.kind==="ARCHIVE"&&e.archiveState?.[a.ref]!==void 0)),h=a=>e.rows.findIndex(u=>(u.held_ref??u.ref)===a),n=(a,u)=>{try{if(i.find(S=>S.ref===a)?.kind==="ARCHIVE"){u==="retired"?e.markA?.(a,"retired"):u==="skipped"&&e.markA?.(a,"skipped");return}let D=h(a);if(D<0)return;u==="applied"||u==="committed"?e.mark?.(D,"approved"):u==="skipped"&&e.mark?.(D,"skipped")}catch{}},f=async a=>{let[{openGraph:u},{resolveParentUc:W,evolveOneUc:D}]=await Promise.all([import("./readmodel-V3DVL6NP.js"),import("./evolve-cmd-YGJECGND.js")]),[S,...I]=a.split(/\s+/),E=u(e.dir),O=W(E,S);if(!O.ok)return`couldn't resolve '${S}' \u2014 start with a use-case id (uc-\u2026): ${O.message}`;if(I.length===0)return`say what to change: \`${S} <your words>\` \u2014 the words become the redesign's change delta`;let P=I.join(" "),F={out:()=>{},err:()=>{},isTTY:!1,confirm:async()=>!0},M=await D(e.dir,O.target,{yes:!0,mode:"override",because:P},F,x,"batch");return M.outcome==="evolved"?(e.signals({ref:O.target.display,verdict:"gap-resolved-evolve",reason:P}),`\u2713 redesigned ${O.target.display} \u2014 "${P}"`):`\u2717 evolve ${M.outcome} for ${O.target.display} (exit ${M.code})`},v=e.listEvolveTargets??(()=>{let a=_(e.dir);return ne(a).targets.map(u=>({key:u.display,title:u.display,badge:"stale"}))});if(e.script){let a=0;for(let u of i){let W=await e.script(u),D=await w.submit(u.ref,W);D.outcome==="failed"&&a===0&&(a=1),n(u.ref,ce(D))}return a}let[{render:s},{ScrollbackProvider:R},{ScrollbackTap:$}]=await Promise.all([import("./build-JIKYOZUH.js"),import("./scrollback-JLPJR25X.js"),import("./ScrollbackTap-Q3IOKNMS.js")]);return new Promise(a=>{let u=!1,W=P=>{u||(u=!0,(async()=>{process.removeListener("SIGINT",E),await g.current?.flush();try{O.unmount()}catch{}a(P)})())},D=0,S={current:null},I=()=>{if(D+=1,D>=2){process.removeListener("SIGINT",E);try{O.unmount()}catch{}a(130)}},E=()=>{I(),S.current?.()};process.on("SIGINT",E);let O=s((0,p.jsxs)(R,{children:[(0,p.jsx)($,{into:g}),(0,p.jsx)(we,{controller:w,cards:i,note:b,markOutcome:n,routeChat:f,listEvolveTargets:v,barSubject:e.barSubject,onFinish:W,onCtrlC:I,pauseRef:S})]}),{exitOnCtrlC:!1})})}export{we as WalkSessionSurface,ce as outcomeToMark,Xe as runWalkSession};
2
+ import{a as ie}from"./chunk-XTO236AL.js";import{a as Q,c as z,d as ne}from"./chunk-T4WZWKIU.js";import"./chunk-GRB66C5S.js";import"./chunk-3C5GMAM4.js";import{b as X,c as re,d as oe}from"./chunk-4CKZAGBD.js";import{a as L}from"./chunk-TFVMSEIA.js";import"./chunk-JFAFKHDX.js";import"./chunk-DNNZ353O.js";import"./chunk-RN4OSVTG.js";import"./chunk-QM4S2APK.js";import"./chunk-BC7UVJJB.js";import"./chunk-NVGBE2DR.js";import{a as _}from"./chunk-LEA6IHXC.js";import{b as te}from"./chunk-RGDQMKNJ.js";import"./chunk-L3HG5ONB.js";import"./chunk-L4JIMNKW.js";import{e as ee}from"./chunk-MBXWXBDM.js";import"./chunk-IAHKTEET.js";import"./chunk-5YPBPZUR.js";import{a as G}from"./chunk-YCCUBQY4.js";import{y as l}from"./chunk-VCYVSKPM.js";import{a as H}from"./chunk-HCBYKLMW.js";import{a as T,b as c,k as Y}from"./chunk-C44QQJR4.js";import{a as ge}from"./chunk-6YGTRKDT.js";import{e as V}from"./chunk-UR6MHSHU.js";var A=V(ge(),1);function ae(e,g,b){let{ref:C,reason:d,by:x}=b;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 w=g.resolve(C);if(!w)return{record:null,errors:[{code:"UNKNOWN_REF",detail:`no node '${C}' in the graph`}]};let o=g.tipOf(w.cid);if(g.superseded.has(o))return{record:null,errors:[{code:"ALREADY_ARCHIVED",detail:`${C} is already superseded at its tip (${o.slice(0,19)}\u2026)`}]};let i=ee(e,{ts:new Date().toISOString(),proposal_id:null,nodes:[],edges:[],review:[],supersessions:[{kind:"node",old:o,new:null,reason:d,by:x}],source_head_moves:{}},{expectPrev:g.latestHash});return te(e),{record:i.record,errors:null}}function se(e){let g=e.by??{kind:"human",id:process.env.USER??"operator"},b=e.mode==="interactive"?"override":e.mode,C={out:()=>{},err:()=>{},isTTY:!1,confirm:async()=>!0},d={applied:0,committed:0,retired:0,skipped:0,deferred:0,failed:0},x=new Map;for(let o of e.planRows)if(o.held_ref&&e.held){let i=e.held.rows.find(n=>n.temp_ref===o.held_ref);if(!i)continue;let h={kind:i.kind,ref:i.temp_ref,title:i.title,why:i.why,origin:"content-change",...o.impact?{impact:o.impact}:{}};x.set(h.ref,{card:h,source:"held",heldRef:i.temp_ref})}else if(o.kind==="MODIFY"){let i={kind:"MODIFY",ref:o.ref,title:o.ref,why:`${o.reason}: ${o.provenance}`,origin:o.origin??"structural-stale",...o.impact?{impact:o.impact}:{}};x.set(i.ref,{card:i,source:"row",row:o})}else if(o.kind==="ADD"){let i={kind:"ADD",ref:o.ref,title:o.ref,why:o.reason,origin:o.origin??"content-change"};x.set(i.ref,{card:i,source:"row",row:o})}for(let o of e.archive){if(o.kind!=="ARCHIVE")continue;let i={kind:"ARCHIVE",ref:o.ref,title:o.ref,why:o.why,provenance:o.why,...o.impact?{impact:o.impact}:{}};x.set(i.ref,{card:i,source:"archive",row:o})}let w=o=>(d.failed++,{outcome:"failed",detail:o});return{cards:()=>[...x.values()].map(o=>o.card),async submit(o,i){let h=x.get(o);if(!h)return w(`no card ${o}`);if(i.v==="skip")return d.skipped++,e.signals({ref:o,verdict:"gap-dismissed"}),{outcome:"skipped"};if(i.v==="defer")return d.deferred++,{outcome:"deferred"};if(i.v==="archive"){if(h.source!=="archive")return w(`${o} is not an ARCHIVE card`);let s=_(e.contextDir),R=s.resolve(h.row.ref);if(R&&s.superseded.has(s.tipOf(R.cid)))return d.skipped++,{outcome:"skipped",detail:"already retired \u2014 nothing to do"};let $=ae(e.contextDir,_(e.contextDir),{ref:h.row.ref,reason:`reconcile retire: ${h.row.why}`,by:g});return $.errors?w($.errors.map(a=>`${a.code}: ${a.detail}`).join("; ")):(d.retired++,e.signals({ref:o,verdict:"gap-resolved-archive",reason:h.row.why}),{outcome:"retired"})}if(h.source==="archive")return w(`${o} takes archive/skip/defer, not approve`);if(h.source==="held"){let s=ie(e.contextDir,e.held,h.heldRef,g,i.edits);if(!s.ok)return w(s.message);if(s.kind==="ADD"){let R=await e.runDesign(s.ref,{yes:!0,mode:b,...i.steering?{because:i.steering}:{}});return R!==0?(d.failed++,{outcome:"failed",landed:!0,detail:`committed ${s.ref}, but its design run exited ${R} \u2014 finish with kane-cli design tests --use-case ${s.ref}`}):(d.applied++,e.signals({ref:o,verdict:"gap-resolved-create",...i.steering?{reason:i.steering}:{}}),{outcome:"applied",detail:s.ref})}if(i.steering){let R=_(e.contextDir),$=Q(R,s.ref);if(!$.ok)return d.committed++,{outcome:"committed",detail:`committed ${s.ref}, but steering could not resolve it (${$.message}) \u2014 steer via kane-cli maintain evolve ${s.ref}`};let a=await z(e.contextDir,$.target,{yes:!0,mode:b,because:i.steering},C,e.runDesign,"batch");if(a.outcome==="no-design"){let u=await e.runDesign($.target.seamRef,{yes:!0,mode:b,because:i.steering});return u!==0?(d.failed++,{outcome:"failed",landed:!0,detail:`committed ${s.ref}, but its steered design run exited ${u} \u2014 finish with kane-cli design tests --use-case ${$.target.seamRef}`}):(d.applied++,e.signals({ref:o,verdict:"gap-resolved-create",reason:i.steering}),{outcome:"applied",detail:s.ref})}return a.outcome==="failed"||a.outcome==="paused"?(d.failed++,{outcome:"failed",landed:!0,detail:`committed ${s.ref}, but the steering evolve ${a.outcome} (exit ${a.code}) \u2014 finish with kane-cli maintain evolve ${s.ref}`}):a.outcome==="declined"?(d.committed++,{outcome:"committed",detail:`committed ${s.ref} \u2014 the steering evolve was declined; re-run kane-cli maintain evolve ${s.ref}`}):(d.applied++,e.signals({ref:o,verdict:"gap-resolved-evolve",reason:i.steering}),{outcome:"applied",detail:s.ref})}return d.committed++,e.signals({ref:o,verdict:"gap-resolved-evolve"}),{outcome:"committed",detail:s.ref}}let n=_(e.contextDir),f=Q(n,h.row.ref);if(!f.ok)return w(f.message);if(h.card.kind==="ADD"){let s=await e.runDesign(f.target.seamRef,{yes:!0,mode:b});return s!==0?w(`design run exited ${s}`):(d.applied++,e.signals({ref:o,verdict:"gap-resolved-create"}),{outcome:"applied"})}let v=await z(e.contextDir,f.target,{yes:!0,mode:b,...i.steering?{because:i.steering}:{}},C,e.runDesign,"batch");return v.outcome==="evolved"?(d.applied++,e.signals({ref:o,verdict:"gap-resolved-evolve",...i.steering?{reason:i.steering}:{}}),{outcome:"applied"}):v.outcome==="failed"||v.outcome==="paused"?w(`evolve ${v.outcome} (exit ${v.code})`):(d.skipped++,{outcome:"skipped",detail:v.outcome})},summary:()=>({...d})}}var y=V(H(),1);function N(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 U(e){return e.kind==="ARCHIVE"?null:N(e).length}var he={ADD:{color:l.green??"green"},MODIFY:{color:"yellow"},ARCHIVE:{color:l.red}},ve=60;function le({card:e,position:g,sel:b=0,focused:C=!1,freeText:d=null}){let{stdout:x}=Y(),o=(x?.columns??80)<ve,i=N(e),h=U(e),n=he[e.kind],f=$=>C&&b===$?(0,y.jsx)(c,{color:l.generateAccent,children:"\u25B8"}):" ",v=e.impact,s=v&&v.stale_refs.length>0?`${e.kind==="ARCHIVE"?"retiring drops":"approving marks"} ${v.stale_refs.length} item(s) stale`+((v.direct_refs?.length??0)>0?` \u2014 ${v.direct_refs.length} directly touched: ${v.direct_refs.join(", ")}`:""):null,R=(0,y.jsxs)(T,{flexDirection:"column",children:[(0,y.jsx)(c,{bold:!0,color:l.generateAccent,children:`? reconcile \u2014 item ${g.n} of ${g.of}`}),(0,y.jsxs)(c,{bold:!0,children:[" ",(0,y.jsx)(c,{color:n.color,children:`[${e.kind}]`}),` ${L(e.title)}`]}),(0,y.jsx)(c,{color:l.muted,children:` ${e.why}`}),s?(0,y.jsx)(c,{color:l.muted,children:` impact: ${s}`}):null,e.kind==="ARCHIVE"&&e.provenance&&e.provenance!==e.why?(0,y.jsx)(c,{color:l.muted,children:` ${e.provenance}`}):null,i.map(($,a)=>(0,y.jsxs)(c,{children:[" ",f(a),` ${a+1} ${$.label}`,(0,y.jsx)(c,{color:l.dim,children:` \u2014 ${$.detail}`})]},`o-${a}`)),h!==null?d?(0,y.jsxs)(T,{flexDirection:"column",children:[(0,y.jsxs)(T,{children:[(0,y.jsxs)(c,{children:[" ",(0,y.jsx)(c,{color:l.generateAccent,children:"\u25B8"})," ",(0,y.jsx)(c,{color:l.dim,children:"\u270E "})]}),(0,y.jsx)(G,{value:d.value,onChange:d.onChange,onSubmit:d.onSubmit,onCancel:d.onCancel,placeholder:"say what to adjust"})]}),(0,y.jsx)(c,{color:l.muted,children:" submits as: approve \xB7 your words steer the re-design"})]}):(0,y.jsxs)(c,{children:[" ",f(h)," ",(0,y.jsx)(c,{color:l.dim,children:"\u270E approve with changes \u2014 say what to adjust"})]}):null,(0,y.jsx)(c,{color:l.muted,children:h!==null?" \u2191\u2193 \xB7 \u23CE select \xB7 1-9 \xB7 type = adjust \xB7 esc \xB7 nothing to undo":" \u2191\u2193 \xB7 \u23CE select \xB7 1-9 \xB7 esc \xB7 nothing to undo"})]});return o?R:(0,y.jsx)(T,{flexDirection:"column",borderStyle:"round",borderColor:l.generateAccent,paddingX:1,children:R})}var j=V(H(),1);function K({mark:e,markColor:g,color:b,indent:C=2,reserve:d=0,children:x}){let{stdout:w}=Y(),o=(w?.columns??80)-d,i=C+e.length+1;return(0,j.jsxs)(T,{children:[(0,j.jsx)(T,{width:i,flexShrink:0,children:(0,j.jsx)(c,{color:g,children:`${" ".repeat(C)}${e}`})}),(0,j.jsx)(T,{width:Math.max(20,o-i),children:(0,j.jsx)(c,{color:b,children:x})})]})}var p=V(H(),1);function ce(e){return e.landed?"committed":e.outcome}var ke={applied:{mark:"\u2714",color:"green"},committed:{mark:"\u2714",color:"green"},retired:{mark:"\u2714",color:"green"},skipped:{mark:"\xB7",color:"dim"},deferred:{mark:"\u2013",color:"dim"},failed:{mark:"\u2717",color:"red"}},q=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"];function ye(e){return e.v==="archive"?"Retiring\u2026":e.v==="approve"&&e.steering?"Approving with your changes \u2014 committing, then re-designing\u2026":"Applying \u2014 committing\u2026"}function we({controller:e,cards:g,note:b,markOutcome:C,routeChat:d,listEvolveTargets:x,barSubject:w,onFinish:o,onCtrlC:i,pauseRef:h}){let[n,f]=(0,A.useState)(g.length>0?{at:"card",idx:0,sel:0,editor:null}:{at:"done-panel",sel:0}),v=(0,A.useRef)(0),s=(0,A.useRef)(n);s.current=n;let R=(0,A.useRef)([]),[$,a]=(0,A.useState)(0),u=n.at==="busy"||n.at==="evolving";(0,A.useEffect)(()=>{if(!u)return;let t=setInterval(()=>a(r=>r+1),120);return()=>clearInterval(t)},[u]);let W=(0,A.useRef)(!1),D=()=>{b((0,p.jsx)(c,{color:l.dim,children:"walk paused \u2014 every verdict so far is committed; re-run the same command to continue"})),o(3)},S=()=>{if(W.current)return;W.current=!0;let t=s.current;if(t.at==="busy"||t.at==="evolving"){b((0,p.jsx)(c,{color:l.dim,children:"finishing the current item, then pausing\u2026"}));return}if(t.at==="done-panel"||t.at==="picker"||t.at==="why"||t.at==="view"){o(v.current);return}D()};h&&(h.current=S);let I=n.at==="card"||n.at==="busy"?g[n.idx]:null,E=()=>[{key:"finish",label:"finish"},...x?[{key:"evolve",label:"evolve another use-case\u2026"}]:[],...R.current.length>0?[{key:"view",label:"view what changed"}]:[]],O=()=>{let t=x?.()??[];if(t.length===0){b((0,p.jsx)(c,{color:l.dim,children:"nothing is stale \u2014 no evolve targets right now"})),f({at:"done-panel",sel:0});return}f({at:"picker",items:t,sel:0})},P=t=>{let r=t+1;if(r<g.length)f({at:"card",idx:r,sel:0,editor:null});else{let m=e.summary();b((0,p.jsx)(c,{color:l.dim,children:`reconcile walk: ${m.applied} applied, ${m.committed} committed, ${m.retired} retired, ${m.skipped} skipped, ${m.deferred} deferred`+(m.failed>0?`, ${m.failed} failed`:"")})),f({at:"done-panel",sel:0})}},F=(0,A.useRef)(!1),M=(t,r)=>{if(F.current)return;F.current=!0;let m=g[t];f({at:"busy",idx:t,label:ye(r),startedAt:Date.now()}),e.submit(m.ref,r).catch(k=>({outcome:"failed",detail:k instanceof Error?k.message:String(k)})).then(k=>{let B=ke[k.outcome]??{mark:"\xB7",color:"dim"},fe=k.outcome!=="failed"&&k.outcome!=="skipped"&&k.outcome!=="deferred"&&m.impact&&m.impact.stale_refs.length>0?` \xB7 ${m.impact.stale_refs.length} item(s) now stale`:"",Z=`${k.outcome} [${m.kind}] ${L(m.title)}${k.detail?` \u2014 ${L(k.detail)}`:""}${fe}`;if(R.current.push({mark:B.mark,color:B.color,line:Z}),b((0,p.jsx)(K,{mark:B.mark,markColor:B.color==="green"?l.green:B.color==="red"?l.red:l.dim,color:B.color==="dim"?l.dim:void 0,children:Z})),k.outcome==="failed"&&(v.current=v.current===0?1:v.current),C(m.ref,ce(k)),F.current=!1,W.current){D();return}P(t)})},de=(t,r)=>{f({at:"evolving",title:t.title,startedAt:Date.now()}),d(`${t.key} ${r}`).catch(m=>`\u2717 evolve failed: ${m instanceof Error?m.message:String(m)}`).then(m=>{let k=m.startsWith("\u2713");if(R.current.push({mark:k?"\u2714":"\u2717",color:k?"green":"red",line:m.replace(/^[✓✗]\s*/,"")}),b((0,p.jsx)(K,{mark:k?"\u2714":"\u2717",markColor:k?l.green:l.red,children:m.replace(/^[✓✗]\s*/,"")})),W.current){o(v.current);return}f({at:"done-panel",sel:0})})},ue=(0,A.useMemo)(()=>({isFocused:()=>{let t=s.current;return t.at==="card"&&t.editor===null||t.at==="done-panel"||t.at==="picker"||t.at==="view"},onMove:t=>{f(r=>{if(r.at==="card"){let m=g[r.idx],k=U(m)??N(m).length-1;return{...r,sel:Math.max(0,Math.min(k,r.sel+t))}}return r.at==="done-panel"?{...r,sel:Math.max(0,Math.min(E().length-1,r.sel+t))}:r.at==="picker"?{...r,sel:Math.max(0,Math.min(r.items.length-1,r.sel+t))}:r})},onSelect:()=>{let t=s.current;if(t.at==="card"){let r=g[t.idx],m=U(r);if(m!==null&&t.sel===m){f({...t,editor:""});return}let k=N(r)[t.sel];k&&M(t.idx,{v:k.v});return}if(t.at==="done-panel"){let r=E()[t.sel];r?.key==="finish"?o(v.current):r?.key==="evolve"?O():r?.key==="view"&&f({at:"view"});return}if(t.at==="picker"){let r=t.items[t.sel];r&&f({at:"why",item:r,text:""});return}},onDigit:t=>{let r=s.current;if(r.at==="card"){let m=N(g[r.idx])[t-1];m&&M(r.idx,{v:m.v});return}r.at==="done-panel"&&t-1<E().length&&f({...r,sel:t-1}),r.at==="picker"&&t-1<r.items.length&&f({...r,sel:t-1})},onType:t=>{f(r=>r.at!=="card"||U(g[r.idx])===null?r:{...r,editor:(r.editor??"")+t})},isMulti:()=>!1,onSpace:()=>{},onBack:()=>{let t=s.current;(t.at==="picker"||t.at==="view")&&f({at:"done-panel",sel:0})}}),[g]);(0,A.useEffect)(()=>{n.at==="done"&&o(v.current)},[n.at]);let me=n.at==="card"||n.at==="done-panel"||n.at==="picker"||n.at==="why"||n.at==="view",pe=n.at==="card"||n.at==="busy"?`${w?`${w} \xB7 `:""}item ${n.idx+1} of ${g.length}`:w,J=t=>Math.floor((Date.now()-t)/1e3);return(0,p.jsxs)(T,{flexDirection:"column",children:[(0,p.jsx)(oe,{onToggleThinking:()=>{},onCtrlC:()=>{i(),S()},panel:ue}),n.at==="card"&&I?(0,p.jsx)(le,{card:I,position:{n:n.idx+1,of:g.length},sel:n.sel,focused:n.editor===null,freeText:n.editor!==null?{value:n.editor,onChange:t=>f(r=>r.at==="card"?{...r,editor:t}:r),onSubmit:t=>{let r=s.current;r.at==="card"&&(t.trim()?M(r.idx,{v:"approve",steering:t.trim()}):f({...r,editor:null}))},onCancel:()=>f(t=>t.at==="card"?{...t,editor:null}:t)}:null}):null,n.at==="busy"?(0,p.jsxs)(c,{color:l.generateAccent,children:[`${q[$%q.length]} ${n.label} `,(0,p.jsx)(c,{color:l.dim,children:`(${J(n.startedAt)}s)`})]}):null,n.at==="evolving"?(0,p.jsxs)(c,{color:l.generateAccent,children:[`${q[$%q.length]} Evolving ${n.title}\u2026 `,(0,p.jsx)(c,{color:l.dim,children:`(${J(n.startedAt)}s)`})]}):null,n.at==="done-panel"?(0,p.jsx)(X,{headline:(()=>{let t=e.summary();return`reconcile done \u2014 ${t.applied+t.committed} applied \xB7 ${t.retired} retired \xB7 ${t.skipped} skipped \xB7 ${t.deferred} deferred${t.failed>0?` \xB7 ${t.failed} failed`:""}`})(),rows:E(),sel:n.sel,focused:!0,legend:"\u2191\u2193 \xB7 \u23CE select"}):null,n.at==="picker"?(0,p.jsx)(X,{ask:!0,headline:"evolve which use-case?",rows:n.items.map(t=>({key:t.key,label:t.title,detail:t.badge})),sel:n.sel,focused:!0,legend:"\u2191\u2193 \xB7 \u23CE select \xB7 esc back"}):null,n.at==="why"?(0,p.jsxs)(T,{flexDirection:"column",borderStyle:"round",borderColor:l.generateAccent,paddingX:1,children:[(0,p.jsxs)(T,{children:[(0,p.jsxs)(c,{children:[(0,p.jsx)(c,{color:l.generateAccent,children:"\u25B8"})," ",(0,p.jsx)(c,{color:l.dim,children:"\u270E "})]}),(0,p.jsx)(G,{value:n.text,onChange:t=>f(r=>r.at==="why"?{...r,text:t}:r),onSubmit:t=>{let r=s.current;r.at==="why"&&(t.trim()?de(r.item,t.trim()):f({at:"picker",items:[r.item],sel:0}))},onCancel:()=>{s.current.at==="why"&&O()},placeholder:`what should change about ${n.item.title}?`})]}),(0,p.jsx)(c,{color:l.muted,children:" \u23CE submit \xB7 esc back"})]}):null,n.at==="view"?(0,p.jsxs)(T,{flexDirection:"column",borderStyle:"round",borderColor:l.dim,paddingX:1,children:[(0,p.jsx)(c,{bold:!0,children:`view \xB7 this run's changes \xB7 ${R.current.length}`}),R.current.map((t,r)=>(0,p.jsx)(K,{mark:t.mark,markColor:t.color==="green"?l.green:t.color==="red"?l.red:l.dim,color:t.color==="dim"?l.dim:void 0,indent:0,reserve:4,children:t.line},`vc-${r}`)),(0,p.jsx)(c,{color:l.muted,children:" esc back"})]}):null,(0,p.jsx)(re,{verb:"maintain",subject:pe,state:me?"idle":void 0,hints:"ctrl+c exit"})]})}async function Xe(e){let g={current:null},b=a=>{g.current?.append(a)},C=null,d=async(a,u)=>{let[{runDesign:W},{resolveAgentAuthEnv:D},{runAgent:S},{preflightTurn:I}]=await Promise.all([import("./run-5DQSL5KH.js"),import("./spawner-C6B5J73J.js"),import("./bridge-V4FF5QPK.js"),import("./turn-preflight-JGYT7LXP.js")]);C??=await D();let E=C;return W({useCase:a,force:!0,mode:u.mode??"override",...u.because?{because:u.because}:{},...u.changeDelta!==void 0?{changeDelta:u.changeDelta}:{},...u.priorDesign!==void 0?{priorDesign:u.priorDesign}:{}},{contextDir:e.dir,agent:S,preflightTurn:()=>I(E),ask:async()=>[],out:()=>{},progress:()=>{},isTTY:!1,auth:E})},x=e.runDesign??d,w=se({contextDir:e.dir,held:e.held,archive:e.archive,planRows:e.rows,runDesign:x,mode:"interactive",signals:e.signals}),o=new Set(e.rows.filter(a=>a.applied!==void 0).map(a=>a.held_ref??a.ref)),i=w.cards().filter(a=>!o.has(a.ref)&&!(a.kind==="ARCHIVE"&&e.archiveState?.[a.ref]!==void 0)),h=a=>e.rows.findIndex(u=>(u.held_ref??u.ref)===a),n=(a,u)=>{try{if(i.find(S=>S.ref===a)?.kind==="ARCHIVE"){u==="retired"?e.markA?.(a,"retired"):u==="skipped"&&e.markA?.(a,"skipped");return}let D=h(a);if(D<0)return;u==="applied"||u==="committed"?e.mark?.(D,"approved"):u==="skipped"&&e.mark?.(D,"skipped")}catch{}},f=async a=>{let[{openGraph:u},{resolveParentUc:W,evolveOneUc:D}]=await Promise.all([import("./readmodel-V3DVL6NP.js"),import("./evolve-cmd-DTW4EOXM.js")]),[S,...I]=a.split(/\s+/),E=u(e.dir),O=W(E,S);if(!O.ok)return`couldn't resolve '${S}' \u2014 start with a use-case id (uc-\u2026): ${O.message}`;if(I.length===0)return`say what to change: \`${S} <your words>\` \u2014 the words become the redesign's change delta`;let P=I.join(" "),F={out:()=>{},err:()=>{},isTTY:!1,confirm:async()=>!0},M=await D(e.dir,O.target,{yes:!0,mode:"override",because:P},F,x,"batch");return M.outcome==="evolved"?(e.signals({ref:O.target.display,verdict:"gap-resolved-evolve",reason:P}),`\u2713 redesigned ${O.target.display} \u2014 "${P}"`):`\u2717 evolve ${M.outcome} for ${O.target.display} (exit ${M.code})`},v=e.listEvolveTargets??(()=>{let a=_(e.dir);return ne(a).targets.map(u=>({key:u.display,title:u.display,badge:"stale"}))});if(e.script){let a=0;for(let u of i){let W=await e.script(u),D=await w.submit(u.ref,W);D.outcome==="failed"&&a===0&&(a=1),n(u.ref,ce(D))}return a}let[{render:s},{ScrollbackProvider:R},{ScrollbackTap:$}]=await Promise.all([import("./build-JIKYOZUH.js"),import("./scrollback-JLPJR25X.js"),import("./ScrollbackTap-Q3IOKNMS.js")]);return new Promise(a=>{let u=!1,W=P=>{u||(u=!0,(async()=>{process.removeListener("SIGINT",E),await g.current?.flush();try{O.unmount()}catch{}a(P)})())},D=0,S={current:null},I=()=>{if(D+=1,D>=2){process.removeListener("SIGINT",E);try{O.unmount()}catch{}a(130)}},E=()=>{I(),S.current?.()};process.on("SIGINT",E);let O=s((0,p.jsxs)(R,{children:[(0,p.jsx)($,{into:g}),(0,p.jsx)(we,{controller:w,cards:i,note:b,markOutcome:n,routeChat:f,listEvolveTargets:v,barSubject:e.barSubject,onFinish:W,onCtrlC:I,pauseRef:S})]}),{exitOnCtrlC:!1})})}export{we as WalkSessionSurface,ce as outcomeToMark,Xe as runWalkSession};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@testmuai/kane-cli",
3
- "version": "0.6.8",
3
+ "version": "0.6.9",
4
4
  "description": "KaneAI Terminal UI — browser automation testing agent",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -30,11 +30,11 @@
30
30
  "ws": "^8.20.0"
31
31
  },
32
32
  "optionalDependencies": {
33
- "@testmuai/kane-cli-darwin-arm64": "0.6.8",
34
- "@testmuai/kane-cli-darwin-x64": "0.6.8",
35
- "@testmuai/kane-cli-linux-x64": "0.6.8",
36
- "@testmuai/kane-cli-linux-arm64": "0.6.8",
37
- "@testmuai/kane-cli-win-x64": "0.6.8",
33
+ "@testmuai/kane-cli-darwin-arm64": "0.6.9",
34
+ "@testmuai/kane-cli-darwin-x64": "0.6.9",
35
+ "@testmuai/kane-cli-linux-x64": "0.6.9",
36
+ "@testmuai/kane-cli-linux-arm64": "0.6.9",
37
+ "@testmuai/kane-cli-win-x64": "0.6.9",
38
38
  "@testmuai/kane-cli-node-darwin-arm64": "24.18.0",
39
39
  "@testmuai/kane-cli-node-darwin-x64": "24.18.0",
40
40
  "@testmuai/kane-cli-node-linux-x64": "24.18.0",
@@ -1,2 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a}from"./chunk-5VC7MBHR.js";import"./chunk-BLHCGRSK.js";import"./chunk-IQFUBT6Z.js";import"./chunk-NKCXCCPM.js";import"./chunk-NKUA3TSO.js";import"./chunk-FPFOW6BS.js";import"./chunk-WAOCHXJ5.js";import"./chunk-L5LI2JF4.js";import"./chunk-VRVSOGXH.js";import"./chunk-PV4EDQY4.js";import"./chunk-YCCUBQY4.js";import"./chunk-66LXV7NN.js";import"./chunk-M5JQXOCE.js";import"./chunk-2WVKOZ6W.js";import"./chunk-NLCCBXXV.js";import"./chunk-RZ4F3BHX.js";import"./chunk-K4ERF7GT.js";import"./chunk-VE3SUJMA.js";import"./chunk-BUVRZXO3.js";import"./chunk-MEHEGW3V.js";import"./chunk-PXPXK4Q7.js";import"./chunk-HCBYKLMW.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";export{a as SingleShotApp};
@@ -1,2 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{g as a}from"./chunk-TRXNJZSL.js";import"./chunk-TAUSKB3O.js";import"./chunk-K7P6VNLI.js";import"./chunk-NKCXCCPM.js";import"./chunk-N5YIMTGV.js";import"./chunk-5Y2G4NC7.js";import"./chunk-M5JQXOCE.js";import"./chunk-K4ERF7GT.js";import"./chunk-F4FXE466.js";import"./chunk-GO4CBUB6.js";import"./chunk-DFS4RMVP.js";import"./chunk-PXPXK4Q7.js";import"./chunk-HCBYKLMW.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";export{a as TestMdRunView};
@@ -1,2 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a}from"./chunk-3BIEIXJK.js";import"./chunk-NKUA3TSO.js";import"./chunk-RFHMDQXZ.js";import"./chunk-RZ4F3BHX.js";import"./chunk-K4ERF7GT.js";import"./chunk-BUVRZXO3.js";import"./chunk-PXPXK4Q7.js";import"./chunk-UR6MHSHU.js";export{a as LoginFlow};
@@ -1,2 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{d as a}from"./chunk-27GF2OQ7.js";import"./chunk-3MSXQU2C.js";import"./chunk-AXJIXRYF.js";import"./chunk-ATO6NM45.js";import"./chunk-K4LCN5X4.js";import"./chunk-D5IZ77YG.js";import"./chunk-GLS46X7N.js";import"./chunk-JKHQBGFY.js";import"./chunk-FCZ2YFD3.js";import"./chunk-YEMR62WY.js";import"./chunk-2YQ6TW77.js";import"./chunk-ELN3EN4K.js";import"./chunk-RHNKYNNZ.js";import"./chunk-RKWJG3WW.js";import"./chunk-BLHCGRSK.js";import"./chunk-IQFUBT6Z.js";import"./chunk-TRXNJZSL.js";import"./chunk-TAUSKB3O.js";import"./chunk-K7P6VNLI.js";import"./chunk-NKCXCCPM.js";import"./chunk-VZHXNQDO.js";import"./chunk-N5YIMTGV.js";import"./chunk-5Y2G4NC7.js";import"./chunk-EQORZ6RT.js";import"./chunk-TBXIOT6M.js";import"./chunk-C5UNZ6ZY.js";import"./chunk-S3DAAAE5.js";import"./chunk-GFKIE3AL.js";import"./chunk-3BIEIXJK.js";import"./chunk-NKUA3TSO.js";import"./chunk-FPFOW6BS.js";import"./chunk-WAOCHXJ5.js";import"./chunk-Q3WHZ26R.js";import"./chunk-RFHMDQXZ.js";import"./chunk-EYZWG32F.js";import"./chunk-FCMLIK7P.js";import"./chunk-CJJXT5DO.js";import"./chunk-QM4S2APK.js";import"./chunk-ZPDM6FO7.js";import"./chunk-BC7UVJJB.js";import"./chunk-NVGBE2DR.js";import"./chunk-EHN5HTUD.js";import"./chunk-L5LI2JF4.js";import"./chunk-LEA6IHXC.js";import"./chunk-RGDQMKNJ.js";import"./chunk-L3HG5ONB.js";import"./chunk-L4JIMNKW.js";import"./chunk-MBXWXBDM.js";import"./chunk-IAHKTEET.js";import"./chunk-5YPBPZUR.js";import"./chunk-QFD6CB4P.js";import"./chunk-VRVSOGXH.js";import"./chunk-PV4EDQY4.js";import"./chunk-YCCUBQY4.js";import"./chunk-66LXV7NN.js";import"./chunk-M5JQXOCE.js";import"./chunk-YTK3IQUB.js";import"./chunk-2WVKOZ6W.js";import"./chunk-NLCCBXXV.js";import"./chunk-RZ4F3BHX.js";import"./chunk-K4ERF7GT.js";import"./chunk-VE3SUJMA.js";import"./chunk-E47GFYXA.js";import"./chunk-BUVRZXO3.js";import"./chunk-F4FXE466.js";import"./chunk-GO4CBUB6.js";import{a as o}from"./chunk-DFS4RMVP.js";import"./chunk-OYOTWI53.js";import"./chunk-MEHEGW3V.js";import"./chunk-PXPXK4Q7.js";import{a as t}from"./chunk-HCBYKLMW.js";import{c as n}from"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import{e as r}from"./chunk-UR6MHSHU.js";var e=r(t(),1);async function p(i){let c=i.scenarioLimit!==void 0||i.perScenarioLimit!==void 0?{scenarioLimit:i.scenarioLimit,perScenarioLimit:i.perScenarioLimit}:void 0,{waitUntilExit:m}=n((0,e.jsx)(o,{children:(0,e.jsx)(a,{initialChatMode:"generate",initialObjective:i.objective,initialGenerateLimits:c})}),{exitOnCtrlC:!1});await m()}export{p as runGenerate};
@@ -1,2 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a}from"./chunk-GFKIE3AL.js";import"./chunk-NKUA3TSO.js";import"./chunk-RZ4F3BHX.js";import"./chunk-K4ERF7GT.js";import"./chunk-PXPXK4Q7.js";import"./chunk-UR6MHSHU.js";export{a as refreshOAuthToken};