@testmuai/kane-cli 0.6.1 → 0.6.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (120) hide show
  1. package/dist/ChatSurface-J777M5WC.js +8 -0
  2. package/dist/{ChromeProfilePicker-BZKLIO2T.js → ChromeProfilePicker-UUGUMJPI.js} +1 -1
  3. package/dist/{CliFeedbackPrompt-3HYRBMXS.js → CliFeedbackPrompt-JZWESL7Z.js} +1 -1
  4. package/dist/{CliUploadProgress-OAPMO5I3.js → CliUploadProgress-62U3LAUU.js} +1 -1
  5. package/dist/{ConfigView-YIAAISLE.js → ConfigView-WHEFCVHR.js} +1 -1
  6. package/dist/EvidenceViewOffer-JQDEAE2T.js +2 -0
  7. package/dist/FolderPicker-HJUUHQEI.js +2 -0
  8. package/dist/{HelpView-HBQX64VR.js → HelpView-EWHP7LSJ.js} +1 -1
  9. package/dist/{InfoBox-DKJO73HM.js → InfoBox-GQQJVTI5.js} +1 -1
  10. package/dist/{LinksBox-44WCVBT4.js → LinksBox-EWCPAZFN.js} +1 -1
  11. package/dist/{ProfilesView-NVEDYU3H.js → ProfilesView-5FJNQMUW.js} +1 -1
  12. package/dist/{ProjectPicker-COBY7TCY.js → ProjectPicker-IN7GFN7I.js} +1 -1
  13. package/dist/{SaveSessionPrompt-O4ENMYHP.js → SaveSessionPrompt-ISODGFP7.js} +1 -1
  14. package/dist/SingleShotApp-QANGFAPO.js +2 -0
  15. package/dist/{SummaryBox-ROV7TNK4.js → SummaryBox-R6WHU7VD.js} +1 -1
  16. package/dist/TestMdRunView-74A3LCNE.js +2 -0
  17. package/dist/{WhoamiView-4QV3DPN2.js → WhoamiView-YRQNOSOH.js} +1 -1
  18. package/dist/{bind-RDTZZ6ZI.js → bind-FZ4X4SOK.js} +2 -2
  19. package/dist/{bridge-VY2Q3HQU.js → bridge-7UMWMIJJ.js} +1 -1
  20. package/dist/{changelog-JMFGVNEU.js → changelog-YQC2QDCO.js} +1 -1
  21. package/dist/{chat-committer-RTJCKQMM.js → chat-committer-GHDZY5XF.js} +1 -1
  22. package/dist/chat-controller-QXFAB2DK.js +3 -0
  23. package/dist/{chunk-N2ZW5635.js → chunk-2S4S2XJC.js} +3 -3
  24. package/dist/{chunk-BMSWIYYK.js → chunk-2TVRHXRK.js} +1 -1
  25. package/dist/{chunk-IRDMEYJB.js → chunk-326XAPMW.js} +2 -2
  26. package/dist/{chunk-47RNFG2V.js → chunk-53VDR5DN.js} +3 -3
  27. package/dist/{chunk-CP4XCWAJ.js → chunk-6RQAUK5F.js} +1 -1
  28. package/dist/{chunk-WAGJLR5X.js → chunk-7LFCSSPX.js} +10 -10
  29. package/dist/{chunk-2PDWMY2B.js → chunk-7MV5UF6O.js} +1 -1
  30. package/dist/{chunk-S74MQRDN.js → chunk-7YQW4TFI.js} +1 -1
  31. package/dist/{chunk-MMI3VSCA.js → chunk-ARS72637.js} +1 -1
  32. package/dist/{chunk-CB3TEWZJ.js → chunk-AV5SUGRY.js} +1 -1
  33. package/dist/{chunk-WRHZCHZY.js → chunk-B5LJCGAY.js} +1 -1
  34. package/dist/{chunk-FAIH2K2U.js → chunk-BFFCGEUH.js} +1 -1
  35. package/dist/{chunk-SQJWMOJQ.js → chunk-BGGNBWAJ.js} +1 -1
  36. package/dist/{chunk-Q4PUOA46.js → chunk-BO3JA2GS.js} +3 -3
  37. package/dist/{chunk-VXD5667K.js → chunk-C5POEXSX.js} +2 -2
  38. package/dist/{chunk-OBBXDBEE.js → chunk-CIW2KP4C.js} +1 -1
  39. package/dist/{chunk-R2K2SGGE.js → chunk-DEEBPSJN.js} +1 -1
  40. package/dist/{chunk-HMGNPFXP.js → chunk-E4OYR32M.js} +1 -1
  41. package/dist/{chunk-AAWRKFE4.js → chunk-EEO4XWY6.js} +1 -1
  42. package/dist/{chunk-SB6MBQKR.js → chunk-EWFFJBAM.js} +1 -1
  43. package/dist/{chunk-SUDAFBVD.js → chunk-F2K3XFFH.js} +2 -2
  44. package/dist/{chunk-FS4YJM22.js → chunk-F66SSA4C.js} +1 -1
  45. package/dist/{chunk-O4O4KL6Z.js → chunk-FFL2TQEJ.js} +1 -1
  46. package/dist/chunk-FTD3B7QA.js +2 -0
  47. package/dist/{chunk-7SUKUJO2.js → chunk-G6AF2JUA.js} +1 -1
  48. package/dist/{chunk-5UXL6RNG.js → chunk-ME5QSYWX.js} +1 -1
  49. package/dist/{chunk-MZ2PXBKK.js → chunk-NFGG5DA2.js} +1 -1
  50. package/dist/{chunk-WGG5XURS.js → chunk-OE7TVGNB.js} +3 -3
  51. package/dist/{chunk-2T4JPBB5.js → chunk-OGVIHL5G.js} +1 -1
  52. package/dist/{chunk-ISAE457F.js → chunk-P46TIMGQ.js} +1 -1
  53. package/dist/{chunk-YJ6AQ2KP.js → chunk-PJDOXRLB.js} +1 -1
  54. package/dist/{chunk-XDW2RGIL.js → chunk-Q4HLQOJI.js} +1 -1
  55. package/dist/chunk-RE3BZVGE.js +3 -0
  56. package/dist/{chunk-KGP7NSXH.js → chunk-RLG5NUTE.js} +1 -1
  57. package/dist/{chunk-Q4P2L7DY.js → chunk-RZFINU7J.js} +1 -1
  58. package/dist/{chunk-7DBQEOFL.js → chunk-SGU72YLH.js} +4 -4
  59. package/dist/{chunk-NSSKSXCT.js → chunk-SHSV64GX.js} +1 -1
  60. package/dist/{chunk-RH2OAIJI.js → chunk-SL7AJ7JQ.js} +1 -1
  61. package/dist/{chunk-ZA67EBYF.js → chunk-SQFNMZJ2.js} +1 -1
  62. package/dist/{chunk-5FD6ZXB5.js → chunk-TTSYHJLX.js} +1 -1
  63. package/dist/chunk-TY5LWU6I.js +14 -0
  64. package/dist/{chunk-4CRKK5WV.js → chunk-TZZYRDCF.js} +1 -1
  65. package/dist/{chunk-J5BUMF3G.js → chunk-UXJPCWGW.js} +1 -1
  66. package/dist/{chunk-KFAYCOTB.js → chunk-VXGOWBET.js} +1 -1
  67. package/dist/{chunk-ROPXE7TF.js → chunk-WFRL54GK.js} +1 -1
  68. package/dist/{chunk-HGL3RM7P.js → chunk-XBE7PGVY.js} +1 -1
  69. package/dist/{chunk-ZNANAARA.js → chunk-Y6LMHBLE.js} +1 -1
  70. package/dist/{chunk-QZWQCHXK.js → chunk-Y7KW5AEN.js} +1 -1
  71. package/dist/chunk-YKTYVJBN.js +3 -0
  72. package/dist/{chunk-37CI4EJX.js → chunk-YZKPZXHY.js} +1 -1
  73. package/dist/chunk-YZSYXNMB.js +2 -0
  74. package/dist/config-5OOP2BO3.js +2 -0
  75. package/dist/{credentials-L63BBW2S.js → credentials-XCP6DJZZ.js} +1 -1
  76. package/dist/{evidence-UAFPTHQX.js → evidence-AX67Q6RN.js} +1 -1
  77. package/dist/{evolve-cmd-2SPNVTT4.js → evolve-cmd-HR25DRTC.js} +1 -1
  78. package/dist/{extract-bind-DS4UP23P.js → extract-bind-ZDAXRQUS.js} +2 -2
  79. package/dist/{extract-cmd-PMZHMMU7.js → extract-cmd-5GGI6LAM.js} +1 -1
  80. package/dist/{generate-headless-C3UZKDS5.js → generate-headless-DRDE46ON.js} +2 -2
  81. package/dist/index.js +12 -12
  82. package/dist/{ingest-cmd-FJ3SLTT4.js → ingest-cmd-X7BWGIN7.js} +1 -1
  83. package/dist/{interactive-bind-SJLDJULN.js → interactive-bind-T6OBLZCT.js} +2 -2
  84. package/dist/{lifecycle-cmd-56OZT4LY.js → lifecycle-cmd-55NZL3UO.js} +1 -1
  85. package/dist/{list-commands-PGAX5HRB.js → list-commands-UDAL3SBY.js} +1 -1
  86. package/dist/{logical-ids-QRRUXV5E.js → logical-ids-ATVR6PF2.js} +1 -1
  87. package/dist/login-flow-LJ4BH3OS.js +2 -0
  88. package/dist/{persist-recorded-session-WFU4M4SQ.js → persist-recorded-session-BW3YSFMP.js} +1 -1
  89. package/dist/{pipeline-EYQUM27P.js → pipeline-TZJ652NT.js} +1 -1
  90. package/dist/{reconcile-cmd-TFFYCTCY.js → reconcile-cmd-242S7XNO.js} +2 -2
  91. package/dist/{recording-banner-PH2NND2X.js → recording-banner-6FVTCUWQ.js} +1 -1
  92. package/dist/{require-project-folder-RD2UAB7E.js → require-project-folder-AQUVEEJB.js} +1 -1
  93. package/dist/{review-cmd-SL52N4TM.js → review-cmd-RXPPC5GK.js} +1 -1
  94. package/dist/run-UGAOGR3B.js +2 -0
  95. package/dist/{run-test-md-I6O4H7B2.js → run-test-md-AUK7NGLL.js} +2 -2
  96. package/dist/{skill-installer-BJLHH3DW.js → skill-installer-2MNPCPRD.js} +1 -1
  97. package/dist/{spawner-UDCF35OA.js → spawner-XCOMTJJC.js} +1 -1
  98. package/dist/tcg-generate-E5X23RVP.js +2 -0
  99. package/dist/testmd-actions-TU4KTO32.js +2 -0
  100. package/dist/token-refresh-GGLARJV4.js +2 -0
  101. package/dist/{turn-preflight-I5SM4UIZ.js → turn-preflight-JGYT7LXP.js} +1 -1
  102. package/dist/{validate-basic-WILRWRRP.js → validate-basic-IYMPP7C7.js} +1 -1
  103. package/dist/{version-check-TXTCVX2N.js → version-check-MUPSKONS.js} +1 -1
  104. package/package.json +6 -6
  105. package/dist/ChatSurface-R55VO3VW.js +0 -9
  106. package/dist/EvidenceViewOffer-DBMZQ34Z.js +0 -2
  107. package/dist/FolderPicker-ILK4AIKL.js +0 -2
  108. package/dist/SingleShotApp-NA6A2S6I.js +0 -2
  109. package/dist/TestMdRunView-U5YTNLY6.js +0 -2
  110. package/dist/chat-controller-OTBYHB4Y.js +0 -3
  111. package/dist/chunk-5446YVGQ.js +0 -4
  112. package/dist/chunk-5ILXUQIX.js +0 -2
  113. package/dist/chunk-DM2GL24Z.js +0 -3
  114. package/dist/chunk-MJFYMMX2.js +0 -2
  115. package/dist/chunk-RY4OOGSC.js +0 -14
  116. package/dist/login-flow-4OJ34VDP.js +0 -2
  117. package/dist/run-NODOSQUL.js +0 -2
  118. package/dist/tcg-generate-E7H4LF7Y.js +0 -2
  119. package/dist/testmd-actions-FMVUXZGX.js +0 -2
  120. package/dist/token-refresh-OGBTJGZ2.js +0 -2
@@ -1,7 +1,7 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as y}from"./chunk-WAGJLR5X.js";import"./chunk-KHU7C6EE.js";import"./chunk-NNZV5RCE.js";import"./chunk-7DBQEOFL.js";import"./chunk-I2S6KNZW.js";import"./chunk-DM2GL24Z.js";import"./chunk-JFAFKHDX.js";import"./chunk-5ILXUQIX.js";import"./chunk-QPZRHAYK.js";import"./chunk-VJUIW2ES.js";import"./chunk-FXPPQL4D.js";import"./chunk-5446YVGQ.js";import"./chunk-Z56AWGVY.js";import"./chunk-427OQS2N.js";import"./chunk-6PS65QFF.js";import{c as k}from"./chunk-ZKYYZ5NO.js";import"./chunk-RGEAEAZB.js";import{a as v}from"./chunk-BC7UVJJB.js";import"./chunk-KHDUQ33H.js";import"./chunk-L5LI2JF4.js";import"./chunk-D5T4ARTB.js";import"./chunk-AE6SS34N.js";import"./chunk-GIRXJOJI.js";import"./chunk-B2PZAB7J.js";import"./chunk-IACKIGPX.js";import"./chunk-HMGNPFXP.js";import"./chunk-UR6MHSHU.js";async function j(t){let[{render:u},o,{QuestionBatchPrompt:p}]=await Promise.all([import("./build-JIKYOZUH.js"),import("./react-QWOAB3TB.js"),import("./ui-JEJGTURD.js")]),i=o.default??o;return new Promise(e=>{let m=u(i.createElement(p,{questions:t,onSubmit:a=>{m.unmount(),e(a)}}))})}async function q(t){let[{resolveAgentAuthEnv:u},{runAgent:o},{preflightTurn:p}]=await Promise.all([import("./spawner-UDCF35OA.js"),import("./bridge-VY2Q3HQU.js"),import("./turn-preflight-I5SM4UIZ.js")]),i=await u(),e=v(process.cwd()),{baseUrlAdvisory:m}=await import("./turn-preflight-I5SM4UIZ.js"),a=m();a&&process.stderr.write(a+`
2
+ import{a as y}from"./chunk-7LFCSSPX.js";import"./chunk-KHU7C6EE.js";import"./chunk-NNZV5RCE.js";import"./chunk-SGU72YLH.js";import"./chunk-I2S6KNZW.js";import"./chunk-FXPPQL4D.js";import"./chunk-RE3BZVGE.js";import"./chunk-6PS65QFF.js";import"./chunk-JFAFKHDX.js";import"./chunk-FTD3B7QA.js";import"./chunk-QPZRHAYK.js";import"./chunk-VJUIW2ES.js";import"./chunk-YKTYVJBN.js";import"./chunk-Z56AWGVY.js";import"./chunk-427OQS2N.js";import{c as k}from"./chunk-ZKYYZ5NO.js";import"./chunk-RGEAEAZB.js";import{a as v}from"./chunk-BC7UVJJB.js";import"./chunk-KHDUQ33H.js";import"./chunk-L5LI2JF4.js";import"./chunk-D5T4ARTB.js";import"./chunk-AE6SS34N.js";import"./chunk-GIRXJOJI.js";import"./chunk-B2PZAB7J.js";import"./chunk-IACKIGPX.js";import"./chunk-E4OYR32M.js";import"./chunk-UR6MHSHU.js";async function j(t){let[{render:u},o,{QuestionBatchPrompt:p}]=await Promise.all([import("./build-JIKYOZUH.js"),import("./react-QWOAB3TB.js"),import("./ui-JEJGTURD.js")]),i=o.default??o;return new Promise(e=>{let m=u(i.createElement(p,{questions:t,onSubmit:a=>{m.unmount(),e(a)}}))})}async function q(t){let[{resolveAgentAuthEnv:u},{runAgent:o},{preflightTurn:p}]=await Promise.all([import("./spawner-XCOMTJJC.js"),import("./bridge-7UMWMIJJ.js"),import("./turn-preflight-JGYT7LXP.js")]),i=await u(),e=v(process.cwd()),{baseUrlAdvisory:m}=await import("./turn-preflight-JGYT7LXP.js"),a=m();a&&process.stderr.write(a+`
3
3
  `);let d=await p(i);if(!d.ok)return process.stderr.write((d.message??"error: turn-endpoint preflight failed")+`
4
4
  `),2;let T=async()=>d;if(t.plan)return y(t,{contextDir:e,agent:o,preflightTurn:T,ask:j,out:r=>process.stdout.write(r+`
5
5
  `),progress:r=>process.stderr.write(r+`
6
6
  `),isTTY:k(),auth:i});if(!t.resume){let[{openGraph:r},{designGate:s}]=await Promise.all([import("./readmodel-MPTENJ2R.js"),import("./gate-FACZRGOC.js")]),w=s(r(e),t.useCase,!!t.force);if(!w.ok)return process.stderr.write(`design: ${w.message}
7
- `),w.code}let[{render:C},b,{ScrollbackProvider:A},{ChatSurface:D},{ScrollbackTap:E},{makeChatController:R},{setInkExit:S},G]=await Promise.all([import("./build-JIKYOZUH.js"),import("./react-QWOAB3TB.js"),import("./scrollback-JLPJR25X.js"),import("./ChatSurface-R55VO3VW.js"),import("./ScrollbackTap-Q3IOKNMS.js"),import("./chat-controller-OTBYHB4Y.js"),import("./exit-manager-VCSIUYBR.js"),Promise.all([import("./chat-committer-RTJCKQMM.js"),import("./descriptor-SL5A7RQE.js"),import("./explain-JIXUWEFJ.js"),import("./readmodel-MPTENJ2R.js")])]),[{commitChatTurn:I},{topologyDescriptor:O},{explain:Q},{openGraph:x}]=G,f=b.default??b,n=R({commitChatTurn:I,descriptor:O("design"),contextDir:e,refreshGraph:()=>x(e),graph:x(e),explain:Q,by:{kind:"human",id:"owner"}}),g={current:null},P=0,h=null,c=!1,Y=()=>{if(P+=1,P>=2){try{l.unmount()}catch{}process.exit(130)}n.requestPause(),h=setTimeout(()=>{c||(c=!0,(async()=>{n.ledger({kind:"interrupted",detail:"the agent did not confirm the pause within 5s"}),await g.current?.flush();try{l.unmount()}catch{}process.exit(130)})())},5e3)},l=C(f.createElement(A,null,f.createElement(E,{into:g}),f.createElement(D,{controller:n,verb:"design",onCtrlC:Y})),{exitOnCtrlC:!1});S(()=>l.unmount()),n.ledger({kind:"banner",text:`kane-cli design \xB7 ${t.useCase??t.resume??""}`});try{let r=y(t,{contextDir:e,agent:o,preflightTurn:T,ask:s=>n.ask(s),out:s=>n.note(s),progress:()=>{},isTTY:k(),auth:i,chat:n});return r.finally(()=>{c=!0}),await r}finally{c=!0,h&&clearTimeout(h),await g.current?.flush();try{l.unmount()}catch{}}}export{q as bindDesignInteractive};
7
+ `),w.code}let[{render:C},b,{ScrollbackProvider:A},{ChatSurface:D},{ScrollbackTap:E},{makeChatController:R},{setInkExit:S},G]=await Promise.all([import("./build-JIKYOZUH.js"),import("./react-QWOAB3TB.js"),import("./scrollback-JLPJR25X.js"),import("./ChatSurface-J777M5WC.js"),import("./ScrollbackTap-Q3IOKNMS.js"),import("./chat-controller-QXFAB2DK.js"),import("./exit-manager-VCSIUYBR.js"),Promise.all([import("./chat-committer-GHDZY5XF.js"),import("./descriptor-SL5A7RQE.js"),import("./explain-JIXUWEFJ.js"),import("./readmodel-MPTENJ2R.js")])]),[{commitChatTurn:I},{topologyDescriptor:O},{explain:Q},{openGraph:x}]=G,f=b.default??b,n=R({commitChatTurn:I,descriptor:O("design"),contextDir:e,refreshGraph:()=>x(e),graph:x(e),explain:Q,by:{kind:"human",id:"owner"}}),g={current:null},P=0,h=null,c=!1,Y=()=>{if(P+=1,P>=2){try{l.unmount()}catch{}process.exit(130)}n.requestPause(),h=setTimeout(()=>{c||(c=!0,(async()=>{n.ledger({kind:"interrupted",detail:"the agent did not confirm the pause within 5s"}),await g.current?.flush();try{l.unmount()}catch{}process.exit(130)})())},5e3)},l=C(f.createElement(A,null,f.createElement(E,{into:g}),f.createElement(D,{controller:n,verb:"design",onCtrlC:Y})),{exitOnCtrlC:!1});S(()=>l.unmount()),n.ledger({kind:"banner",text:`kane-cli design \xB7 ${t.useCase??t.resume??""}`});try{let r=y(t,{contextDir:e,agent:o,preflightTurn:T,ask:s=>n.ask(s),out:s=>n.note(s),progress:()=>{},isTTY:k(),auth:i,chat:n});return r.finally(()=>{c=!0}),await r}finally{c=!0,h&&clearTimeout(h),await g.current?.flush();try{l.unmount()}catch{}}}export{q as bindDesignInteractive};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as b,b as a,c as f,d as m}from"./chunk-AD46OCZ4.js";import{h as p,i as y}from"./chunk-5ILXUQIX.js";import"./chunk-QPZRHAYK.js";import"./chunk-ZKYYZ5NO.js";import"./chunk-BC7UVJJB.js";import{a as c}from"./chunk-D5T4ARTB.js";import"./chunk-AE6SS34N.js";import"./chunk-GIRXJOJI.js";import"./chunk-B2PZAB7J.js";import"./chunk-IACKIGPX.js";import"./chunk-UR6MHSHU.js";var g={kind:"human",id:process.env.USER??"operator"},$=/^(UNKNOWN_|BAD_|INVALID_|MALFORMED_|NOT_|SLUG_TAKEN|ALREADY_|SUPERSEDED_)/;function h(e){return e.every(r=>$.test(r.code))?2:1}function l(e,r){for(let n of r)b(e,`${n.code}: ${n.detail}`);return h(r)}async function w(e,r,n,t=process.cwd()){let s=a(t,n);if(!s||!await f(n,`retire source ${e} (head \u2192 null + tombstone record)`,r.yes))return 2;let i=c(s),o=y({contextDir:s,graph:i,sourceId:e,reason:r.reason,by:g});return o.errors?l(n,o.errors):(n.out(`retired ${e} (record ${o.record.seq}) \u2014 its use-cases stay until no live source evidences them`),0)}async function x(e,r,n,t=process.cwd()){let s=a(t,n);if(!s)return 2;let i=c(s),o=p({contextDir:s,graph:i,assignments:[{ref:e,slug:r}],by:g});return o.errors?l(n,o.errors):(n.out(`named ${o.record.names[0].cid} as "${r}" (record ${o.record.seq})`),0)}async function O(e,r,n,t=process.cwd()){let s=a(t,n);if(!s)return 2;let i=Number(e);if(!await f(n,`revert record ${i} via a compensation record`,r.yes))return 2;let o=c(s),{commitRevert:v}=await import("./revert-3TKLOYQA.js"),d=v({contextDir:s,graph:o,seq:i,reason:r.reason,by:g});for(let C of d.warnings)n.out(`note: ${C}`);if(d.errors)return l(n,d.errors);let u=d.record;return n.out(`reverted record ${i} via compensation record ${u.seq}: ${u.supersessions.length} supersession(s), ${u.review.length} trust restoration(s), ${Object.keys(u.source_head_moves).length} head move(s) \u2014 history unchanged, effects inverted`),0}async function A(e,r){return w(e,r,m())}async function P(e,r){return x(e,r,m())}async function I(e={},r=process.cwd()){return D(e,m(),r)}async function D(e,r,n=process.cwd()){let t=a(n,r);if(!t||!await f(r,"assign logical ids to every live unnamed node (one commit record)",e.yes))return 2;let{backfillLogicalIds:s}=await import("./logical-ids-QRRUXV5E.js"),i=c(t),o=s(t,i);return o.errors?l(r,o.errors):(r.out(o.assigned===0?"backfill: every live node already has a logical id":`backfill: assigned ${o.assigned} logical id(s) (record ${o.record.seq})`),0)}async function R(e,r){return O(e,r,m())}export{I as nameBackfillCommand,P as nameCommand,A as retireCommand,R as revertCommand,D as runNameBackfillCommand,x as runNameCommand,w as runRetireCommand,O as runRevertCommand};
2
+ import{a as b,b as a,c as f,d as m}from"./chunk-AD46OCZ4.js";import{h as p,i as y}from"./chunk-FTD3B7QA.js";import"./chunk-QPZRHAYK.js";import"./chunk-ZKYYZ5NO.js";import"./chunk-BC7UVJJB.js";import{a as c}from"./chunk-D5T4ARTB.js";import"./chunk-AE6SS34N.js";import"./chunk-GIRXJOJI.js";import"./chunk-B2PZAB7J.js";import"./chunk-IACKIGPX.js";import"./chunk-UR6MHSHU.js";var g={kind:"human",id:process.env.USER??"operator"},$=/^(UNKNOWN_|BAD_|INVALID_|MALFORMED_|NOT_|SLUG_TAKEN|ALREADY_|SUPERSEDED_)/;function h(e){return e.every(r=>$.test(r.code))?2:1}function l(e,r){for(let n of r)b(e,`${n.code}: ${n.detail}`);return h(r)}async function w(e,r,n,t=process.cwd()){let s=a(t,n);if(!s||!await f(n,`retire source ${e} (head \u2192 null + tombstone record)`,r.yes))return 2;let i=c(s),o=y({contextDir:s,graph:i,sourceId:e,reason:r.reason,by:g});return o.errors?l(n,o.errors):(n.out(`retired ${e} (record ${o.record.seq}) \u2014 its use-cases stay until no live source evidences them`),0)}async function x(e,r,n,t=process.cwd()){let s=a(t,n);if(!s)return 2;let i=c(s),o=p({contextDir:s,graph:i,assignments:[{ref:e,slug:r}],by:g});return o.errors?l(n,o.errors):(n.out(`named ${o.record.names[0].cid} as "${r}" (record ${o.record.seq})`),0)}async function O(e,r,n,t=process.cwd()){let s=a(t,n);if(!s)return 2;let i=Number(e);if(!await f(n,`revert record ${i} via a compensation record`,r.yes))return 2;let o=c(s),{commitRevert:v}=await import("./revert-3TKLOYQA.js"),d=v({contextDir:s,graph:o,seq:i,reason:r.reason,by:g});for(let C of d.warnings)n.out(`note: ${C}`);if(d.errors)return l(n,d.errors);let u=d.record;return n.out(`reverted record ${i} via compensation record ${u.seq}: ${u.supersessions.length} supersession(s), ${u.review.length} trust restoration(s), ${Object.keys(u.source_head_moves).length} head move(s) \u2014 history unchanged, effects inverted`),0}async function A(e,r){return w(e,r,m())}async function P(e,r){return x(e,r,m())}async function I(e={},r=process.cwd()){return D(e,m(),r)}async function D(e,r,n=process.cwd()){let t=a(n,r);if(!t||!await f(r,"assign logical ids to every live unnamed node (one commit record)",e.yes))return 2;let{backfillLogicalIds:s}=await import("./logical-ids-ATVR6PF2.js"),i=c(t),o=s(t,i);return o.errors?l(r,o.errors):(r.out(o.assigned===0?"backfill: every live node already has a logical id":`backfill: assigned ${o.assigned} logical id(s) (record ${o.record.seq})`),0)}async function R(e,r){return O(e,r,m())}export{I as nameBackfillCommand,P as nameCommand,A as retireCommand,R as revertCommand,D as runNameBackfillCommand,x as runNameCommand,w as runRetireCommand,O as runRevertCommand};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a,b,c,d,e,f,g,h,i}from"./chunk-IRDMEYJB.js";import"./chunk-FPFOW6BS.js";import"./chunk-WAOCHXJ5.js";import"./chunk-M5JQXOCE.js";import"./chunk-2WVKOZ6W.js";import"./chunk-NLCCBXXV.js";import"./chunk-KGP7NSXH.js";import"./chunk-RZ4F3BHX.js";import"./chunk-4CRKK5WV.js";import"./chunk-HMGNPFXP.js";import"./chunk-UR6MHSHU.js";export{d as emitNdjson,b as filterByName,g as formatAuthResolutionError,c as paginate,a as parsePagination,i as registerListCommands,e as renderTable,f as resolveTmsBasicAuth,h as validateCreateName};
2
+ import{a,b,c,d,e,f,g,h,i}from"./chunk-326XAPMW.js";import"./chunk-FPFOW6BS.js";import"./chunk-WAOCHXJ5.js";import"./chunk-M5JQXOCE.js";import"./chunk-2WVKOZ6W.js";import"./chunk-NLCCBXXV.js";import"./chunk-RZ4F3BHX.js";import"./chunk-RLG5NUTE.js";import"./chunk-TZZYRDCF.js";import"./chunk-E4OYR32M.js";import"./chunk-UR6MHSHU.js";export{d as emitNdjson,b as filterByName,g as formatAuthResolutionError,c as paginate,a as parsePagination,i as registerListCommands,e as renderTable,f as resolveTmsBasicAuth,h as validateCreateName};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as d,b as f,h as m}from"./chunk-5ILXUQIX.js";import"./chunk-QPZRHAYK.js";import"./chunk-GIRXJOJI.js";import"./chunk-B2PZAB7J.js";import"./chunk-IACKIGPX.js";import"./chunk-UR6MHSHU.js";var y=Object.keys(d).filter(n=>n!=="source");function b(n,t,u={kind:"system",id:"logical-id-backfill"}){let l=new Set(t.names.keys()),r=[];for(let c of y)for(let{cid:s,content:e}of t.byLabel(c)){if(t.superseded.has(s)||t.nameOf.has(s))continue;let a=typeof e.title=="string"&&e.title||typeof e.intent=="string"&&e.intent||typeof e.statement=="string"&&e.statement||typeof e.text=="string"&&e.text||"",i=a?f(c,a,g=>l.has(g)):null;i&&(l.add(i),r.push({ref:s,slug:i}))}if(r.length===0)return{record:null,errors:null,assigned:0};let o=m({contextDir:n,graph:t,assignments:r,by:u});return o.errors?{record:null,errors:o.errors,assigned:0}:{record:o.record,errors:null,assigned:r.length}}export{b as backfillLogicalIds};
2
+ import{a as d,b as f,h as m}from"./chunk-FTD3B7QA.js";import"./chunk-QPZRHAYK.js";import"./chunk-GIRXJOJI.js";import"./chunk-B2PZAB7J.js";import"./chunk-IACKIGPX.js";import"./chunk-UR6MHSHU.js";var y=Object.keys(d).filter(n=>n!=="source");function b(n,t,u={kind:"system",id:"logical-id-backfill"}){let l=new Set(t.names.keys()),r=[];for(let c of y)for(let{cid:s,content:e}of t.byLabel(c)){if(t.superseded.has(s)||t.nameOf.has(s))continue;let a=typeof e.title=="string"&&e.title||typeof e.intent=="string"&&e.intent||typeof e.statement=="string"&&e.statement||typeof e.text=="string"&&e.text||"",i=a?f(c,a,g=>l.has(g)):null;i&&(l.add(i),r.push({ref:s,slug:i}))}if(r.length===0)return{record:null,errors:null,assigned:0};let o=m({contextDir:n,graph:t,assignments:r,by:u});return o.errors?{record:null,errors:o.errors,assigned:0}:{record:o.record,errors:null,assigned:r.length}}export{b as backfillLogicalIds};
@@ -0,0 +1,2 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{a}from"./chunk-2TVRHXRK.js";import"./chunk-SL7AJ7JQ.js";import"./chunk-RFHMDQXZ.js";import"./chunk-RZ4F3BHX.js";import"./chunk-RLG5NUTE.js";import"./chunk-TZZYRDCF.js";import"./chunk-E4OYR32M.js";import"./chunk-UR6MHSHU.js";export{a as LoginFlow};
@@ -1,3 +1,3 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{g as h}from"./chunk-LMJTY32X.js";import{a as m,b as I,k as S,s as _}from"./chunk-RKWJG3WW.js";import{a as f}from"./chunk-HGL3RM7P.js";import"./chunk-NFOBDHZK.js";import"./chunk-L5LI2JF4.js";import"./chunk-HMGNPFXP.js";import"./chunk-UR6MHSHU.js";async function v(e,s={}){e.flushRecorder();let o=e.recorder?.lastWrittenPath??null;if(!o)return e.log("info","PERSIST_SKIPPED","No recorded path \u2014 recorder.flush no-op",{reason:e.sessionName?"recorder_flush_failed":"no_session_name",session_name:e.sessionName}),null;let p;try{p=_(o)}catch(t){throw e.log("error","PERSIST_RESOLVE_FAILED","resolveTestMd threw",{error:t.message,recorded_path:o}),t}let i=e.getRunsAsStepRecords(),u=e.getFlows(),a=[],c=0;for(let t=0;t<i.length;t++){let r=i[t],l=u.slice(c,c+r.totalRunDirs);c+=r.totalRunDirs;let g=l.find(n=>n.status==="failed"||n.status==="error"),T=g?"failed":l.length===0?"skipped":"passed";a.push({rootStepIndex:t+1,status:T,duration_s:l.reduce((n,E)=>n+(E.duration??0),0),reason:g?.reason})}let P=a.some(t=>t.status==="failed")?"failed":"passed",D=new f().load().code_export?.language==="javascript"?"javascript":"python",d=I(o);e.log("info","PERSIST_START","Building staging dir",{recorded_path:o,output_dir:d,session_dir:e.sessionDir,step_count:i.length,flow_count:u.length});try{await h({resolvedTest:p,sessionDir:e.sessionDir,stepRunRecords:i,outcomes:a,overallStatus:P,startedISO:e.startedAt,durationS:a.reduce((t,r)=>t+(r.duration_s??0),0),sessionId:e.sessionId,commitId:e.sessionId,tmsIds:{testId:e.testId??void 0,testcaseId:s.testcaseId,projectId:s.projectId,folderId:s.folderId,orgId:s.orgId??e.orgId??void 0,sessionName:e.sessionName??m(o)},codeExportDir:s.codeExportDir,codeExportLanguage:D,packTestDir:s.packTestDir}),e.log("info","PERSIST_STAGING_OK","Staging dir built",{output_dir:d}),S(d),e.log("info","PERSIST_OK","Persist complete",{output_dir:d})}catch(t){let r=t;e.log("error","PERSIST_FAILED","staging build / atomic replace failed",{error:r.message,stack:r.stack,output_dir:d}),process.stderr.write(`[persist] staging build / atomic replace failed: ${r.message}
2
+ import{g as h}from"./chunk-LMJTY32X.js";import{a as m,b as I,k as S,s as _}from"./chunk-RKWJG3WW.js";import{a as f}from"./chunk-XBE7PGVY.js";import"./chunk-NFOBDHZK.js";import"./chunk-L5LI2JF4.js";import"./chunk-E4OYR32M.js";import"./chunk-UR6MHSHU.js";async function v(e,s={}){e.flushRecorder();let o=e.recorder?.lastWrittenPath??null;if(!o)return e.log("info","PERSIST_SKIPPED","No recorded path \u2014 recorder.flush no-op",{reason:e.sessionName?"recorder_flush_failed":"no_session_name",session_name:e.sessionName}),null;let p;try{p=_(o)}catch(t){throw e.log("error","PERSIST_RESOLVE_FAILED","resolveTestMd threw",{error:t.message,recorded_path:o}),t}let i=e.getRunsAsStepRecords(),u=e.getFlows(),a=[],c=0;for(let t=0;t<i.length;t++){let r=i[t],l=u.slice(c,c+r.totalRunDirs);c+=r.totalRunDirs;let g=l.find(n=>n.status==="failed"||n.status==="error"),T=g?"failed":l.length===0?"skipped":"passed";a.push({rootStepIndex:t+1,status:T,duration_s:l.reduce((n,E)=>n+(E.duration??0),0),reason:g?.reason})}let P=a.some(t=>t.status==="failed")?"failed":"passed",D=new f().load().code_export?.language==="javascript"?"javascript":"python",d=I(o);e.log("info","PERSIST_START","Building staging dir",{recorded_path:o,output_dir:d,session_dir:e.sessionDir,step_count:i.length,flow_count:u.length});try{await h({resolvedTest:p,sessionDir:e.sessionDir,stepRunRecords:i,outcomes:a,overallStatus:P,startedISO:e.startedAt,durationS:a.reduce((t,r)=>t+(r.duration_s??0),0),sessionId:e.sessionId,commitId:e.sessionId,tmsIds:{testId:e.testId??void 0,testcaseId:s.testcaseId,projectId:s.projectId,folderId:s.folderId,orgId:s.orgId??e.orgId??void 0,sessionName:e.sessionName??m(o)},codeExportDir:s.codeExportDir,codeExportLanguage:D,packTestDir:s.packTestDir}),e.log("info","PERSIST_STAGING_OK","Staging dir built",{output_dir:d}),S(d),e.log("info","PERSIST_OK","Persist complete",{output_dir:d})}catch(t){let r=t;e.log("error","PERSIST_FAILED","staging build / atomic replace failed",{error:r.message,stack:r.stack,output_dir:d}),process.stderr.write(`[persist] staging build / atomic replace failed: ${r.message}
3
3
  `)}return{recordedTestPath:o,outputDir:d}}export{v as persistRecordedSession};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a,b,c}from"./chunk-GIGD4M7V.js";import"./chunk-2YQ6TW77.js";import"./chunk-WAOCHXJ5.js";import"./chunk-WGG5XURS.js";import"./chunk-FYOCF7DY.js";import"./chunk-RGEAEAZB.js";import"./chunk-BC7UVJJB.js";import"./chunk-NFOBDHZK.js";import"./chunk-KHDUQ33H.js";import"./chunk-L5LI2JF4.js";import"./chunk-D5T4ARTB.js";import"./chunk-AE6SS34N.js";import"./chunk-GIRXJOJI.js";import"./chunk-B2PZAB7J.js";import"./chunk-IACKIGPX.js";import"./chunk-2WVKOZ6W.js";import"./chunk-NLCCBXXV.js";import"./chunk-KGP7NSXH.js";import"./chunk-RZ4F3BHX.js";import"./chunk-HMGNPFXP.js";import"./chunk-UR6MHSHU.js";export{c as UploadPipeline,b as packPresignEntry,a as readPackForUpload};
2
+ import{a,b,c}from"./chunk-GIGD4M7V.js";import"./chunk-2YQ6TW77.js";import"./chunk-WAOCHXJ5.js";import"./chunk-OE7TVGNB.js";import"./chunk-FYOCF7DY.js";import"./chunk-RGEAEAZB.js";import"./chunk-BC7UVJJB.js";import"./chunk-KHDUQ33H.js";import"./chunk-NFOBDHZK.js";import"./chunk-L5LI2JF4.js";import"./chunk-D5T4ARTB.js";import"./chunk-AE6SS34N.js";import"./chunk-GIRXJOJI.js";import"./chunk-B2PZAB7J.js";import"./chunk-IACKIGPX.js";import"./chunk-2WVKOZ6W.js";import"./chunk-NLCCBXXV.js";import"./chunk-RZ4F3BHX.js";import"./chunk-RLG5NUTE.js";import"./chunk-E4OYR32M.js";import"./chunk-UR6MHSHU.js";export{c as UploadPipeline,b as packPresignEntry,a as readPackForUpload};
@@ -1,6 +1,6 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as re}from"./chunk-CE664P73.js";import{a as te,b as j,d as B}from"./chunk-CP4XCWAJ.js";import"./chunk-NNZV5RCE.js";import{a as R,b as ee,d as ne}from"./chunk-AD46OCZ4.js";import{a as Z}from"./chunk-JFAFKHDX.js";import{a as Q}from"./chunk-QPZRHAYK.js";import"./chunk-ZKYYZ5NO.js";import{a as X,b as M}from"./chunk-YANCBRER.js";import"./chunk-BC7UVJJB.js";import{d as z}from"./chunk-KHDUQ33H.js";import{a as E}from"./chunk-D5T4ARTB.js";import"./chunk-AE6SS34N.js";import"./chunk-GIRXJOJI.js";import{e as G}from"./chunk-B2PZAB7J.js";import{d as v,e as P,g as H}from"./chunk-IACKIGPX.js";import"./chunk-UR6MHSHU.js";import{existsSync as Ae,lstatSync as Le,readdirSync as Te,statSync as Ie}from"fs";import{basename as J,join as Ne,relative as Fe,resolve as ye}from"path";var oe="this release plans changes only \u2014 blast-radius impact and drift meaning-checks are not measured, and REMOVE rows are never executed automatically",Re="suite untouched; graph updated";function W(e,t){return!e.superseded.has(t)&&e.trust.get(t)!=="archived"}function O(e,t){return e.nameOf.get(t)??t}function A(e){return String(e).slice(0,19)}function C(e,t,r){let n=e.edgesFrom(t).find(o=>o.type===r);return n?e.tipOf(n.dst):null}function se(e,t){let r=e.nodeLabel.get(t);if(r===v.USECASE)return t;if(r===v.SCENARIO)return C(e,t,P.BELONGS_TO);if(r===v.AC){let n=C(e,t,P.SCOPED_TO);return n?e.nodeLabel.get(n)===v.USECASE?n:C(e,n,P.BELONGS_TO):null}if(r===v.TEST){let n=C(e,t,P.AUTOMATES);return n?C(e,n,P.BELONGS_TO):null}return null}function ie(e,t){let r=[],n=new Map;for(let o of e.derivesInto(t))n.set(String(o.props.source_id),o);for(let[o,c]of n){let s=e.heads.get(o);if(s==null){r.push(`DERIVES pin ${o} @ ${A(c.props.source_cid)} \u2014 source retired`);continue}if(s!==c.props.source_cid){let d=e.convChains.get(o)?.chain;if(d&&d.includes(String(c.props.source_cid)))continue;r.push(`DERIVES pin ${o} @ ${A(c.props.source_cid)} \u2014 source head moved to ${A(s)}`)}}for(let o of e.edgesFrom(t))H(o.type)?.pin?.comparesTo==="dst_tip"&&e.superseded.has(o.dst)&&r.push(`${o.type} pin \u2192 ${O(e,o.dst)} \u2014 target superseded`);return r.join("; ")||"structural pin broken"}var ke=new Set([v.USECASE,v.SCENARIO,v.AC,v.TEST]);function F(e,t){return e.ref<t.ref?-1:e.ref>t.ref?1:0}function ae(e,t,r){let n=t.getNode(r)?.content.blob;if(typeof n!="string")return null;let o=z(e,n);return o===null?null:o.toString("utf8")}function Se(e,t,r,n,o){let c=r.props.quote;if(typeof c=="string"&&c.length>0)return n.includes(c);let s=String(r.props.source_cid);o.has(s)||o.set(s,ae(e,t,s));let d=o.get(s);if(d===null)return!1;let i=Q(d,String(r.props.anchor));return i===null?!1:i.split(`
3
- `).some(g=>g.trim().length>0&&n.includes(g.trim()))}function Ee(e,t,r){let n=e.getNode(t)?.content??{},o=e.getNode(r)?.content??{},s=[...new Set([...Object.keys(n),...Object.keys(o)])].sort().filter(d=>JSON.stringify(n[d])!==JSON.stringify(o[d]));return s.length>0?`updated: ${s.join(", ")}`:"updated"}function be(e,t,r,n,o,c){let s=[];for(let[p,u]of r.superseded)u===null||p===u||t.superseded.has(p)||r.nodeLabel.get(p)===v.USECASE&&s.push({kind:"MODIFIED",ref:O(r,p),old_cid:p,new_cid:u,summary:Ee(r,p,u)});let d=c.map(p=>({kind:"ADDED",ref:O(r,p),cid:p})),i=[],g=ae(e,r,o),f=new Map;for(let{cid:p}of r.byLabel(v.USECASE)){if(!W(r,p))continue;let u=r.derivesInto(p),m=u.filter(a=>String(a.props.source_id)===n);m.length===0||m.some(a=>a.props.source_cid===o)||g!==null&&m.some(a=>String(a.props.anchor)!=="img#whole"&&Se(e,r,a,g,f))||u.some(a=>{let l=String(a.props.source_id);if(l===n)return!1;let $=r.heads.get(l);return $!=null})||i.push({kind:"DROPPED",ref:O(r,p),cid:p,why:`evidence decayed: no quote from ${n} relocates into @${A(o)}, no other live source, no fresh evidence this run`})}let h=(p,u)=>p.ref<u.ref?-1:p.ref>u.ref?1:0;return[...s.sort(h),...d.sort(h),...i.sort(h)]}async function ce(e,t,r){let n=E(e),o=n.heads.get(t)??null,c=new Set(n.staleList().filter(a=>a.state==="stale").map(a=>a.cid)),s=await r.reingest(t);if(s.status==="unchanged")return{source_id:t,changed:!1,head:{status:s.status,before:o,after:s.cid},note:`nothing to reconcile \u2014 ${t} is unchanged`,skipped_arms:oe,changeset:[],rows:[]};let d=await r.reextract(t),i=E(e),g=d.minted.map(a=>{let l=O(i,a);return{kind:"ADD",ref:l,reason:`new use-case extracted from ${t}`,provenance:`extraction commit \u2014 DERIVES ${t} @ ${A(s.cid)}`,action:`kane-cli design tests --use-case ${l}`}}),f=i.staleList().filter(a=>a.state==="stale"&&!c.has(a.cid)&&W(i,a.cid)).map(a=>a.cid),h=f.map(a=>{let l=O(i,a),$=ke.has(i.nodeLabel.get(a)??"");return{kind:"ENHANCE",ref:l,reason:"stale (structural)",provenance:ie(i,a),action:$?`kane-cli maintain evolve ${l}`:`kane-cli design explain ${l}`}}),p=new Set;for(let a of[...d.minted,...d.matched])p.add(i.tipOf(a));for(let a of f){let l=se(i,i.tipOf(a));l&&i.nodeLabel.get(l)===v.USECASE&&p.add(i.tipOf(l))}let u=[];for(let a of await re(i,"design")){if(a.kind!=="no-verifies")continue;let l=i.resolve(a.ref);if(!l)continue;let $=se(i,l.tip);!$||!p.has(i.tipOf($))||u.push({kind:"ADD",ref:a.ref,reason:a.why,provenance:`gaps engine (design) \u2014 uncovered AC of touched use-case ${O(i,$)}`,action:a.ready_command})}let m=[];for(let{cid:a}of i.byLabel(v.USECASE))W(i,a)&&i.stale(a)==="orphaned"&&m.push({kind:"REMOVE",ref:O(i,a),reason:"orphaned \u2014 no live source evidences this use-case",provenance:ie(i,a),action:"plan-only \u2014 REMOVE is not executed in this release"});let w=new Set,b=[...g.sort(F),...u.sort(F),...h.sort(F),...m.sort(F)].filter(a=>{let l=`${a.kind}\0${a.ref}`;return w.has(l)?!1:(w.add(l),!0)});return{source_id:t,changed:!0,head:{status:s.status,before:o,after:s.cid},note:Re,skipped_arms:oe,changeset:be(e,n,i,t,s.cid,d.minted),rows:b}}function de(e,t){return async r=>{let{ingestFile:n}=await import("./ingest-4CGBXC2L.js"),o=await n({contextDir:e,filePath:t,asId:r});return{status:o.status,cid:o.cid}}}function le(e){return async t=>{let[{runExtract:r},{resolveAgentAuthEnv:n},{runAgent:o},{preflightTurn:c}]=await Promise.all([import("./run-NODOSQUL.js"),import("./spawner-UDCF35OA.js"),import("./bridge-VY2Q3HQU.js"),import("./turn-preflight-I5SM4UIZ.js")]),s=await n(),d=new Set(E(e).byLabel(v.USECASE).map(m=>m.cid)),i=0,g=await r({mode:"override"},{contextDir:e,agent:o,preflightTurn:()=>c(s),ask:async()=>[],review:async m=>new Map(m.map(w=>[w.temp_ref,{resolution:w.matches_existing&&w.changed?"edited":"skipped"}])),confirmStale:async()=>!1,out:m=>process.stderr.write(m+`
2
+ import{a as re}from"./chunk-CE664P73.js";import{a as te,b as j,d as B}from"./chunk-6RQAUK5F.js";import"./chunk-NNZV5RCE.js";import{a as R,b as ee,d as ne}from"./chunk-AD46OCZ4.js";import{a as X,b as M}from"./chunk-YANCBRER.js";import{a as Z}from"./chunk-JFAFKHDX.js";import{a as Q}from"./chunk-QPZRHAYK.js";import"./chunk-ZKYYZ5NO.js";import"./chunk-BC7UVJJB.js";import{d as z}from"./chunk-KHDUQ33H.js";import{a as E}from"./chunk-D5T4ARTB.js";import"./chunk-AE6SS34N.js";import"./chunk-GIRXJOJI.js";import{e as G}from"./chunk-B2PZAB7J.js";import{d as v,e as P,g as H}from"./chunk-IACKIGPX.js";import"./chunk-UR6MHSHU.js";import{existsSync as Ae,lstatSync as Le,readdirSync as Te,statSync as Ie}from"fs";import{basename as J,join as Ne,relative as Fe,resolve as ye}from"path";var oe="this release plans changes only \u2014 blast-radius impact and drift meaning-checks are not measured, and REMOVE rows are never executed automatically",Re="suite untouched; graph updated";function W(e,t){return!e.superseded.has(t)&&e.trust.get(t)!=="archived"}function O(e,t){return e.nameOf.get(t)??t}function A(e){return String(e).slice(0,19)}function C(e,t,r){let n=e.edgesFrom(t).find(o=>o.type===r);return n?e.tipOf(n.dst):null}function se(e,t){let r=e.nodeLabel.get(t);if(r===v.USECASE)return t;if(r===v.SCENARIO)return C(e,t,P.BELONGS_TO);if(r===v.AC){let n=C(e,t,P.SCOPED_TO);return n?e.nodeLabel.get(n)===v.USECASE?n:C(e,n,P.BELONGS_TO):null}if(r===v.TEST){let n=C(e,t,P.AUTOMATES);return n?C(e,n,P.BELONGS_TO):null}return null}function ie(e,t){let r=[],n=new Map;for(let o of e.derivesInto(t))n.set(String(o.props.source_id),o);for(let[o,c]of n){let s=e.heads.get(o);if(s==null){r.push(`DERIVES pin ${o} @ ${A(c.props.source_cid)} \u2014 source retired`);continue}if(s!==c.props.source_cid){let d=e.convChains.get(o)?.chain;if(d&&d.includes(String(c.props.source_cid)))continue;r.push(`DERIVES pin ${o} @ ${A(c.props.source_cid)} \u2014 source head moved to ${A(s)}`)}}for(let o of e.edgesFrom(t))H(o.type)?.pin?.comparesTo==="dst_tip"&&e.superseded.has(o.dst)&&r.push(`${o.type} pin \u2192 ${O(e,o.dst)} \u2014 target superseded`);return r.join("; ")||"structural pin broken"}var ke=new Set([v.USECASE,v.SCENARIO,v.AC,v.TEST]);function F(e,t){return e.ref<t.ref?-1:e.ref>t.ref?1:0}function ae(e,t,r){let n=t.getNode(r)?.content.blob;if(typeof n!="string")return null;let o=z(e,n);return o===null?null:o.toString("utf8")}function Se(e,t,r,n,o){let c=r.props.quote;if(typeof c=="string"&&c.length>0)return n.includes(c);let s=String(r.props.source_cid);o.has(s)||o.set(s,ae(e,t,s));let d=o.get(s);if(d===null)return!1;let i=Q(d,String(r.props.anchor));return i===null?!1:i.split(`
3
+ `).some(g=>g.trim().length>0&&n.includes(g.trim()))}function Ee(e,t,r){let n=e.getNode(t)?.content??{},o=e.getNode(r)?.content??{},s=[...new Set([...Object.keys(n),...Object.keys(o)])].sort().filter(d=>JSON.stringify(n[d])!==JSON.stringify(o[d]));return s.length>0?`updated: ${s.join(", ")}`:"updated"}function be(e,t,r,n,o,c){let s=[];for(let[p,u]of r.superseded)u===null||p===u||t.superseded.has(p)||r.nodeLabel.get(p)===v.USECASE&&s.push({kind:"MODIFIED",ref:O(r,p),old_cid:p,new_cid:u,summary:Ee(r,p,u)});let d=c.map(p=>({kind:"ADDED",ref:O(r,p),cid:p})),i=[],g=ae(e,r,o),f=new Map;for(let{cid:p}of r.byLabel(v.USECASE)){if(!W(r,p))continue;let u=r.derivesInto(p),m=u.filter(a=>String(a.props.source_id)===n);m.length===0||m.some(a=>a.props.source_cid===o)||g!==null&&m.some(a=>String(a.props.anchor)!=="img#whole"&&Se(e,r,a,g,f))||u.some(a=>{let l=String(a.props.source_id);if(l===n)return!1;let $=r.heads.get(l);return $!=null})||i.push({kind:"DROPPED",ref:O(r,p),cid:p,why:`evidence decayed: no quote from ${n} relocates into @${A(o)}, no other live source, no fresh evidence this run`})}let h=(p,u)=>p.ref<u.ref?-1:p.ref>u.ref?1:0;return[...s.sort(h),...d.sort(h),...i.sort(h)]}async function ce(e,t,r){let n=E(e),o=n.heads.get(t)??null,c=new Set(n.staleList().filter(a=>a.state==="stale").map(a=>a.cid)),s=await r.reingest(t);if(s.status==="unchanged")return{source_id:t,changed:!1,head:{status:s.status,before:o,after:s.cid},note:`nothing to reconcile \u2014 ${t} is unchanged`,skipped_arms:oe,changeset:[],rows:[]};let d=await r.reextract(t),i=E(e),g=d.minted.map(a=>{let l=O(i,a);return{kind:"ADD",ref:l,reason:`new use-case extracted from ${t}`,provenance:`extraction commit \u2014 DERIVES ${t} @ ${A(s.cid)}`,action:`kane-cli design tests --use-case ${l}`}}),f=i.staleList().filter(a=>a.state==="stale"&&!c.has(a.cid)&&W(i,a.cid)).map(a=>a.cid),h=f.map(a=>{let l=O(i,a),$=ke.has(i.nodeLabel.get(a)??"");return{kind:"ENHANCE",ref:l,reason:"stale (structural)",provenance:ie(i,a),action:$?`kane-cli maintain evolve ${l}`:`kane-cli design explain ${l}`}}),p=new Set;for(let a of[...d.minted,...d.matched])p.add(i.tipOf(a));for(let a of f){let l=se(i,i.tipOf(a));l&&i.nodeLabel.get(l)===v.USECASE&&p.add(i.tipOf(l))}let u=[];for(let a of await re(i,"design")){if(a.kind!=="no-verifies")continue;let l=i.resolve(a.ref);if(!l)continue;let $=se(i,l.tip);!$||!p.has(i.tipOf($))||u.push({kind:"ADD",ref:a.ref,reason:a.why,provenance:`gaps engine (design) \u2014 uncovered AC of touched use-case ${O(i,$)}`,action:a.ready_command})}let m=[];for(let{cid:a}of i.byLabel(v.USECASE))W(i,a)&&i.stale(a)==="orphaned"&&m.push({kind:"REMOVE",ref:O(i,a),reason:"orphaned \u2014 no live source evidences this use-case",provenance:ie(i,a),action:"plan-only \u2014 REMOVE is not executed in this release"});let w=new Set,b=[...g.sort(F),...u.sort(F),...h.sort(F),...m.sort(F)].filter(a=>{let l=`${a.kind}\0${a.ref}`;return w.has(l)?!1:(w.add(l),!0)});return{source_id:t,changed:!0,head:{status:s.status,before:o,after:s.cid},note:Re,skipped_arms:oe,changeset:be(e,n,i,t,s.cid,d.minted),rows:b}}function de(e,t){return async r=>{let{ingestFile:n}=await import("./ingest-4CGBXC2L.js"),o=await n({contextDir:e,filePath:t,asId:r});return{status:o.status,cid:o.cid}}}function le(e){return async t=>{let[{runExtract:r},{resolveAgentAuthEnv:n},{runAgent:o},{preflightTurn:c}]=await Promise.all([import("./run-UGAOGR3B.js"),import("./spawner-XCOMTJJC.js"),import("./bridge-7UMWMIJJ.js"),import("./turn-preflight-JGYT7LXP.js")]),s=await n(),d=new Set(E(e).byLabel(v.USECASE).map(m=>m.cid)),i=0,g=await r({mode:"override"},{contextDir:e,agent:o,preflightTurn:()=>c(s),ask:async()=>[],review:async m=>new Map(m.map(w=>[w.temp_ref,{resolution:w.matches_existing&&w.changed?"edited":"skipped"}])),confirmStale:async()=>!1,out:m=>process.stderr.write(m+`
4
4
  `),progress:m=>process.stderr.write(m+`
5
5
  `),emit:m=>{m.type==="commit"&&typeof m.assumed=="number"&&(i+=m.assumed)},isTTY:!1,auth:s});if(g!==0)throw new Error(`reconcile: re-extract of ${t} failed (exit ${g})`);let f=E(e),h=f.heads.get(t),p=[],u=[];if(typeof h=="string"){let m=new Set;for(let w of f.edgesFrom(h))w.type!==P.DERIVES||f.nodeLabel.get(w.dst)!==v.USECASE||m.has(w.dst)||(m.add(w.dst),(d.has(w.dst)?u:p).push(w.dst))}return{minted:p,matched:u,defaultsTaken:i}}}import{closeSync as Oe,existsSync as Pe,mkdirSync as pe,openSync as De,readFileSync as V,readdirSync as _e,renameSync as xe,rmSync as ue,writeFileSync as fe}from"fs";import{join as L}from"path";var D=class extends Error{constructor(r,n){super(`${r}: ${n}`);this.code=r}},K=e=>L(e,"reconcile","plans");function ge(e,t){let r=`${e}.tmp-${process.pid}`;fe(r,t,{mode:384}),xe(r,e)}function me(e,t){let r=K(e);pe(r,{recursive:!0});let n=L(r,`${t.created}-${t.source_id}.json`);return ge(n,JSON.stringify(t,null,2)+`
6
6
  `),n}function Y(e,t){let r=t;if(r===void 0){let s=K(e),d=[];try{d=_e(s).filter(i=>i.endsWith(".json")).sort()}catch{}if(d.length===0)return{error:`no stored plans under ${s} \u2014 run reconcile --plan first`};r=L(s,d[d.length-1])}if(!Pe(r))return{error:`no such plan file: ${r}`};let n;try{n=V(r,"utf8")}catch(s){return{error:`cannot read plan ${r}: ${s instanceof Error?s.message:String(s)}`}}let o;try{o=JSON.parse(n)}catch(s){return{error:`corrupted plan ${r}: ${s instanceof Error?s.message:String(s)}`}}let c=o?.version;return c!==1?{error:`unsupported plan version ${String(c)} in ${r} (expected 1)`}:Array.isArray(o.rows)?{plan:o,path:r}:{error:`not a reconcile plan \u2014 ${r} has no rows[] (hand-edited?)`}}function q(e,t,r){let n;try{n=JSON.parse(V(e,"utf8"))}catch(c){throw new D("PLAN_UNREADABLE",`${e}: ${c instanceof Error?c.message:String(c)}`)}let o=n.rows?.[t];if(!o)throw new D("ROW_MISSING",`${e} has no row ${t}`);if(o.applied)throw new D("ROW_ALREADY_APPLIED",`row ${t} of ${e} was already applied (${o.applied.outcome} at ${o.applied.at})`);o.applied={at:new Date().toISOString(),outcome:r},ge(e,JSON.stringify(n,null,2)+`
@@ -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-DKJO73HM.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-GQQJVTI5.js"),u=t.sessionName?[{label:"session",value:t.sessionName},{label:"test",value:n(t.testPath??"")},{label:"output",value:n(t.outputPath??"")}]:[{label:"session",value:"ephemeral"},{label:"note",value:"use /name <name> to persist this session"}];function l(){let{exit:i}=a();return o(()=>{let c=setTimeout(()=>i(),50);return()=>clearTimeout(c)},[i]),s.createElement(r,{title:"Recording",titleColor:"#ff9500",rows:u})}await e(s.createElement(l),{stdout:process.stderr}).waitUntilExit()}export{p as buildRecordingStateEvent,g as printRecordingBanner};
@@ -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-OBBXDBEE.js";import"./chunk-2WVKOZ6W.js";import"./chunk-NLCCBXXV.js";import"./chunk-VE3SUJMA.js";import"./chunk-KGP7NSXH.js";import"./chunk-RZ4F3BHX.js";import"./chunk-HMGNPFXP.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-CIW2KP4C.js";import"./chunk-2WVKOZ6W.js";import"./chunk-NLCCBXXV.js";import"./chunk-RZ4F3BHX.js";import"./chunk-RLG5NUTE.js";import"./chunk-VE3SUJMA.js";import"./chunk-E4OYR32M.js";import"./chunk-UR6MHSHU.js";export{d as buildAutoDefaultAnnouncement,f as buildAutoDefaultedEvent,e as buildAutoDefaultedNdjson,c as buildRemediationMessage,b as decideGateAction,a as loadCachedIds,g as requireProjectFolder};
@@ -1,4 +1,4 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{b as j}from"./chunk-AD46OCZ4.js";import{g as b}from"./chunk-5ILXUQIX.js";import"./chunk-QPZRHAYK.js";import"./chunk-ZKYYZ5NO.js";import"./chunk-BC7UVJJB.js";import{a as _}from"./chunk-D5T4ARTB.js";import"./chunk-AE6SS34N.js";import"./chunk-GIRXJOJI.js";import{d as V}from"./chunk-B2PZAB7J.js";import"./chunk-IACKIGPX.js";import"./chunk-UR6MHSHU.js";import{readFileSync as E}from"fs";var O=new Set(["derived","skipped","archived","drift"]),q={kind:"human",id:process.env.USER??"operator"};function R(d,r){return d.nameOf.get(r)??r.slice(0,19)}function N(d,r){let n=d.getNode(r)?.content??{},a=d.derivesInto(r)[0]?.props.anchor;return{cid:r,uc:{temp_ref:r,title:String(n.title??n.text??""),summary:n.summary!==void 0?String(n.summary):void 0,risk:String(n.risk??"med"),cite:{anchor:typeof a=="string"?a:"\u2014",quote:""},depends_on_hint:[],matches_existing:null}}}function T(d,r){let n=new Set,{records:a}=V(d);for(let s of a){if(s.proposal_id==null)continue;let u=new Set(s.review.map(e=>e.id));for(let e of s.nodes)u.has(e.cid)||n.add(e.cid)}for(let s of[...n])(r.trust.get(s)!=="derived"||r.superseded.has(s))&&n.delete(s);return n}var x=new Set(["approved","edited","rejected","skipped","supersede"]);function C(d){let r;try{r=JSON.parse(d)}catch(s){return{errors:[`not valid JSON: ${s instanceof Error?s.message:String(s)}`]}}if(!Array.isArray(r))return{errors:['expected a top-level array of {"ref", "resolution", ...} entries']};let n=[],a=[];return r.forEach((s,u)=>{if(s==null||typeof s!="object"||Array.isArray(s)){n.push(`[${u}]: not an object`);return}let e=s;(typeof e.ref!="string"||!e.ref.trim())&&n.push(`[${u}]: "ref" (slug or cid) is required`),(typeof e.resolution!="string"||!x.has(e.resolution))&&n.push(`[${u}]: "resolution" must be one of approved | edited | rejected | skipped | supersede`),e.resolution==="supersede"&&(typeof e.supersede_target!="string"||!e.supersede_target.trim())&&n.push(`[${u}]: resolution "supersede" requires "supersede_target" (slug or cid)`),e.edit!==void 0&&(e.edit==null||typeof e.edit!="object"||Array.isArray(e.edit))&&n.push(`[${u}]: "edit" must be an object ({title?, summary?, risk?})`),n.length===0&&a.push(e)}),n.length>0?{errors:n}:{entries:a}}async function I(d,r,n,a=process.cwd()){let s=d.queue??"derived";if(!O.has(s))return r.out(`unknown queue ${s} \u2014 one of: derived | skipped | archived | drift`),2;let u=j(a,r);if(!u)return 2;let e=_(u);if(d.verdicts){let i=t=>(r.err??r.out)(t),o;try{o=E(d.verdicts,"utf8")}catch{return i(`error: cannot read verdicts file ${d.verdicts}`),2}let l=C(o);if("errors"in l){for(let t of l.errors)i(`error: --verdicts ${d.verdicts}: ${t}`);return 2}let c=new Set([...e.trust.entries()].filter(([t,p])=>(p==="derived"||p==="archived")&&!e.superseded.has(t)).map(([t])=>t)),f=new Map,y=[];for(let t of l.entries){let p=e.resolve(t.ref),m=p&&!e.superseded.has(p.tip)?p.tip:null;if(!m){y.push(`${t.ref}: names nothing in the graph`);continue}if(!c.has(m)){y.push(`${t.ref}: not in a review queue (trust: ${e.trust.get(m)??"?"})`);continue}if(f.has(m)){y.push(`${t.ref}: duplicate \u2014 an earlier entry already resolves to this node (${R(e,m)})`);continue}f.set(m,{resolution:t.resolution,...t.reason?{reason:t.reason}:{},...t.edit?{edit:t.edit}:{},...t.supersede_target?{supersedeTarget:t.supersede_target}:{}})}if(y.length>0){for(let t of y)i(`error: --verdicts: ${t}`);return i("error: nothing committed (the verdicts file is atomic \u2014 fix every offender and re-run)"),2}let k=b({contextDir:u,graph:e,verdicts:f,by:q});if(k.errors){if(k.errors[0]?.code==="NO_VERDICTS")return i("nothing changed \u2014 every item was skipped"),0;for(let t of k.errors)i(`${t.code}: ${t.detail}`);return 1}let S=new Map;for(let t of f.values())S.set(t.resolution,(S.get(t.resolution)??0)+1);if(d.json)for(let[t,p]of f.entries())r.out(JSON.stringify({ref:R(e,t),cid:t,resolution:p.resolution}));else{let t=[...S.entries()].map(([p,m])=>`${m} ${p}`).join(", ");r.out(`review: committed record ${k.record.seq} \u2014 ${t}`)}return 0}if(s==="drift"){let i=e.staleList().filter(({state:o})=>o!=="superseded").map(({cid:o,state:l})=>({ref:R(e,o),cid:o,state:l,title:String(e.getNode(o)?.content.title??e.getNode(o)?.content.source_id??""),pinned_sources:[...new Set(e.derivesInto(o).map(c=>String(c.props.source_id)))]}));if(d.json){for(let o of i)r.out(JSON.stringify(o));return 0}if(i.length===0)return r.out("drift queue is empty \u2014 every node's evidence matches the current source snapshots"),0;r.out(`${i.length} node(s) with drifting evidence (re-extract the source to re-bless):`);for(let o of i)r.out(` [${o.state}] ${o.ref} \xB7 ${o.title} \xB7 sources: ${o.pinned_sources.join(", ")||"\u2014"}`);return 0}if(!r.isTTY)return r.out("review: verdict queues need a TTY (drift listing works anywhere, or pass --verdicts <file.json>)"),2;let g,h;if(s==="archived")g=[...e.trust.entries()].filter(([i,o])=>o==="archived"&&!e.superseded.has(i)).map(([i])=>N(e,i)),h="skipped";else{let i=T(u,e),o=[...e.trust.entries()].filter(([c,f])=>f==="derived"&&!e.superseded.has(c)).map(([c])=>c),l=s==="skipped"?o.filter(c=>i.has(c)):o;l.sort((c,f)=>Number(i.has(f))-Number(i.has(c))),g=l.map(c=>N(e,c)),h="skipped"}if(g.length===0)return r.out(`${s} queue is empty`),0;r.out(`${g.length} node(s) in the ${s} queue \u2014 approve promotes, reject ${s==="archived"?"re-archives":"archives"}, edit mints a new version, skip leaves it for later`);let v=await n(g,e,h),w=b({contextDir:u,graph:e,verdicts:v,by:q});if(w.errors){if(w.errors[0]?.code==="NO_VERDICTS")return r.out("nothing changed \u2014 every item was skipped"),0;for(let i of w.errors)r.out(`${i.code}: ${i.detail}`);return 1}let $=w.record;return r.out(`committed record ${$.seq}: ${$.review.length} review fact(s), ${$.supersessions.length} supersession(s), ${$.nodes.length} new version(s)`),0}async function P(d,r,n){let[{render:a},s,{ReviewChecklist:u}]=await Promise.all([import("./build-JIKYOZUH.js"),import("./react-QWOAB3TB.js"),import("./ui-JEJGTURD.js")]),e=s.default??s;return new Promise(g=>{let h=a(e.createElement(u,{items:d.map(v=>({uc:v.uc})),defaultResolution:n,onSubmit:v=>{h.unmount(),g(v)}}))})}async function D(d){let{bothTTY:r}=await import("./headless-io-GXHKDPHB.js");return I(d,{out:n=>process.stdout.write(n+`
2
+ import{b as j}from"./chunk-AD46OCZ4.js";import{g as b}from"./chunk-FTD3B7QA.js";import"./chunk-QPZRHAYK.js";import"./chunk-ZKYYZ5NO.js";import"./chunk-BC7UVJJB.js";import{a as _}from"./chunk-D5T4ARTB.js";import"./chunk-AE6SS34N.js";import"./chunk-GIRXJOJI.js";import{d as V}from"./chunk-B2PZAB7J.js";import"./chunk-IACKIGPX.js";import"./chunk-UR6MHSHU.js";import{readFileSync as E}from"fs";var O=new Set(["derived","skipped","archived","drift"]),q={kind:"human",id:process.env.USER??"operator"};function R(d,r){return d.nameOf.get(r)??r.slice(0,19)}function N(d,r){let n=d.getNode(r)?.content??{},a=d.derivesInto(r)[0]?.props.anchor;return{cid:r,uc:{temp_ref:r,title:String(n.title??n.text??""),summary:n.summary!==void 0?String(n.summary):void 0,risk:String(n.risk??"med"),cite:{anchor:typeof a=="string"?a:"\u2014",quote:""},depends_on_hint:[],matches_existing:null}}}function T(d,r){let n=new Set,{records:a}=V(d);for(let s of a){if(s.proposal_id==null)continue;let u=new Set(s.review.map(e=>e.id));for(let e of s.nodes)u.has(e.cid)||n.add(e.cid)}for(let s of[...n])(r.trust.get(s)!=="derived"||r.superseded.has(s))&&n.delete(s);return n}var x=new Set(["approved","edited","rejected","skipped","supersede"]);function C(d){let r;try{r=JSON.parse(d)}catch(s){return{errors:[`not valid JSON: ${s instanceof Error?s.message:String(s)}`]}}if(!Array.isArray(r))return{errors:['expected a top-level array of {"ref", "resolution", ...} entries']};let n=[],a=[];return r.forEach((s,u)=>{if(s==null||typeof s!="object"||Array.isArray(s)){n.push(`[${u}]: not an object`);return}let e=s;(typeof e.ref!="string"||!e.ref.trim())&&n.push(`[${u}]: "ref" (slug or cid) is required`),(typeof e.resolution!="string"||!x.has(e.resolution))&&n.push(`[${u}]: "resolution" must be one of approved | edited | rejected | skipped | supersede`),e.resolution==="supersede"&&(typeof e.supersede_target!="string"||!e.supersede_target.trim())&&n.push(`[${u}]: resolution "supersede" requires "supersede_target" (slug or cid)`),e.edit!==void 0&&(e.edit==null||typeof e.edit!="object"||Array.isArray(e.edit))&&n.push(`[${u}]: "edit" must be an object ({title?, summary?, risk?})`),n.length===0&&a.push(e)}),n.length>0?{errors:n}:{entries:a}}async function I(d,r,n,a=process.cwd()){let s=d.queue??"derived";if(!O.has(s))return r.out(`unknown queue ${s} \u2014 one of: derived | skipped | archived | drift`),2;let u=j(a,r);if(!u)return 2;let e=_(u);if(d.verdicts){let i=t=>(r.err??r.out)(t),o;try{o=E(d.verdicts,"utf8")}catch{return i(`error: cannot read verdicts file ${d.verdicts}`),2}let l=C(o);if("errors"in l){for(let t of l.errors)i(`error: --verdicts ${d.verdicts}: ${t}`);return 2}let c=new Set([...e.trust.entries()].filter(([t,p])=>(p==="derived"||p==="archived")&&!e.superseded.has(t)).map(([t])=>t)),f=new Map,y=[];for(let t of l.entries){let p=e.resolve(t.ref),m=p&&!e.superseded.has(p.tip)?p.tip:null;if(!m){y.push(`${t.ref}: names nothing in the graph`);continue}if(!c.has(m)){y.push(`${t.ref}: not in a review queue (trust: ${e.trust.get(m)??"?"})`);continue}if(f.has(m)){y.push(`${t.ref}: duplicate \u2014 an earlier entry already resolves to this node (${R(e,m)})`);continue}f.set(m,{resolution:t.resolution,...t.reason?{reason:t.reason}:{},...t.edit?{edit:t.edit}:{},...t.supersede_target?{supersedeTarget:t.supersede_target}:{}})}if(y.length>0){for(let t of y)i(`error: --verdicts: ${t}`);return i("error: nothing committed (the verdicts file is atomic \u2014 fix every offender and re-run)"),2}let k=b({contextDir:u,graph:e,verdicts:f,by:q});if(k.errors){if(k.errors[0]?.code==="NO_VERDICTS")return i("nothing changed \u2014 every item was skipped"),0;for(let t of k.errors)i(`${t.code}: ${t.detail}`);return 1}let S=new Map;for(let t of f.values())S.set(t.resolution,(S.get(t.resolution)??0)+1);if(d.json)for(let[t,p]of f.entries())r.out(JSON.stringify({ref:R(e,t),cid:t,resolution:p.resolution}));else{let t=[...S.entries()].map(([p,m])=>`${m} ${p}`).join(", ");r.out(`review: committed record ${k.record.seq} \u2014 ${t}`)}return 0}if(s==="drift"){let i=e.staleList().filter(({state:o})=>o!=="superseded").map(({cid:o,state:l})=>({ref:R(e,o),cid:o,state:l,title:String(e.getNode(o)?.content.title??e.getNode(o)?.content.source_id??""),pinned_sources:[...new Set(e.derivesInto(o).map(c=>String(c.props.source_id)))]}));if(d.json){for(let o of i)r.out(JSON.stringify(o));return 0}if(i.length===0)return r.out("drift queue is empty \u2014 every node's evidence matches the current source snapshots"),0;r.out(`${i.length} node(s) with drifting evidence (re-extract the source to re-bless):`);for(let o of i)r.out(` [${o.state}] ${o.ref} \xB7 ${o.title} \xB7 sources: ${o.pinned_sources.join(", ")||"\u2014"}`);return 0}if(!r.isTTY)return r.out("review: verdict queues need a TTY (drift listing works anywhere, or pass --verdicts <file.json>)"),2;let g,h;if(s==="archived")g=[...e.trust.entries()].filter(([i,o])=>o==="archived"&&!e.superseded.has(i)).map(([i])=>N(e,i)),h="skipped";else{let i=T(u,e),o=[...e.trust.entries()].filter(([c,f])=>f==="derived"&&!e.superseded.has(c)).map(([c])=>c),l=s==="skipped"?o.filter(c=>i.has(c)):o;l.sort((c,f)=>Number(i.has(f))-Number(i.has(c))),g=l.map(c=>N(e,c)),h="skipped"}if(g.length===0)return r.out(`${s} queue is empty`),0;r.out(`${g.length} node(s) in the ${s} queue \u2014 approve promotes, reject ${s==="archived"?"re-archives":"archives"}, edit mints a new version, skip leaves it for later`);let v=await n(g,e,h),w=b({contextDir:u,graph:e,verdicts:v,by:q});if(w.errors){if(w.errors[0]?.code==="NO_VERDICTS")return r.out("nothing changed \u2014 every item was skipped"),0;for(let i of w.errors)r.out(`${i.code}: ${i.detail}`);return 1}let $=w.record;return r.out(`committed record ${$.seq}: ${$.review.length} review fact(s), ${$.supersessions.length} supersession(s), ${$.nodes.length} new version(s)`),0}async function P(d,r,n){let[{render:a},s,{ReviewChecklist:u}]=await Promise.all([import("./build-JIKYOZUH.js"),import("./react-QWOAB3TB.js"),import("./ui-JEJGTURD.js")]),e=s.default??s;return new Promise(g=>{let h=a(e.createElement(u,{items:d.map(v=>({uc:v.uc})),defaultResolution:n,onSubmit:v=>{h.unmount(),g(v)}}))})}async function D(d){let{bothTTY:r}=await import("./headless-io-GXHKDPHB.js");return I(d,{out:n=>process.stdout.write(n+`
3
3
  `),err:n=>process.stderr.write(n+`
4
4
  `),confirm:async()=>!1,isTTY:r()},P)}export{C as parseVerdictsFile,D as reviewCommand,I as runReviewCommand};
@@ -0,0 +1,2 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{a as b,b as c,c as d,d as e,e as f}from"./chunk-TY5LWU6I.js";import{f as a}from"./chunk-SGU72YLH.js";import"./chunk-I2S6KNZW.js";import"./chunk-FXPPQL4D.js";import"./chunk-RE3BZVGE.js";import"./chunk-6PS65QFF.js";import"./chunk-JFAFKHDX.js";import"./chunk-FTD3B7QA.js";import"./chunk-QPZRHAYK.js";import"./chunk-VJUIW2ES.js";import"./chunk-YKTYVJBN.js";import"./chunk-Z56AWGVY.js";import"./chunk-427OQS2N.js";import"./chunk-KHDUQ33H.js";import"./chunk-D5T4ARTB.js";import"./chunk-AE6SS34N.js";import"./chunk-GIRXJOJI.js";import"./chunk-B2PZAB7J.js";import"./chunk-IACKIGPX.js";import"./chunk-E4OYR32M.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-2T4JPBB5.js";import{E as M,F as P,G as K,H,I as U}from"./chunk-Q4PUOA46.js";import{a as _,b as E}from"./chunk-VXD5667K.js";import{a as h,b as k}from"./chunk-ZNANAARA.js";import"./chunk-LMJTY32X.js";import{s as L}from"./chunk-RKWJG3WW.js";import{c as R}from"./chunk-2PDWMY2B.js";import"./chunk-O4O4KL6Z.js";import"./chunk-XDW2RGIL.js";import{a as x}from"./chunk-HGL3RM7P.js";import"./chunk-C5UNZ6ZY.js";import"./chunk-S3DAAAE5.js";import"./chunk-GIGD4M7V.js";import"./chunk-2YQ6TW77.js";import"./chunk-FPFOW6BS.js";import"./chunk-WAOCHXJ5.js";import"./chunk-WGG5XURS.js";import"./chunk-FYOCF7DY.js";import"./chunk-RGEAEAZB.js";import"./chunk-BC7UVJJB.js";import"./chunk-NFOBDHZK.js";import"./chunk-KHDUQ33H.js";import"./chunk-L5LI2JF4.js";import"./chunk-D5T4ARTB.js";import"./chunk-AE6SS34N.js";import"./chunk-GIRXJOJI.js";import"./chunk-B2PZAB7J.js";import"./chunk-IACKIGPX.js";import{e as b,f as S,g as T}from"./chunk-M5JQXOCE.js";import"./chunk-OBBXDBEE.js";import"./chunk-2WVKOZ6W.js";import"./chunk-NLCCBXXV.js";import"./chunk-VE3SUJMA.js";import"./chunk-ISAE457F.js";import"./chunk-RH2OAIJI.js";import{a as C}from"./chunk-KGP7NSXH.js";import"./chunk-RZ4F3BHX.js";import"./chunk-E47GFYXA.js";import{a as v}from"./chunk-4CRKK5WV.js";import"./chunk-HMGNPFXP.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-OGVIHL5G.js";import{E as M,F as P,G as K,H,I as U}from"./chunk-BO3JA2GS.js";import"./chunk-GIGD4M7V.js";import{a as _,b as E}from"./chunk-C5POEXSX.js";import{a as h,b as k}from"./chunk-Y6LMHBLE.js";import"./chunk-2YQ6TW77.js";import"./chunk-LMJTY32X.js";import{s as L}from"./chunk-RKWJG3WW.js";import{c as R}from"./chunk-7MV5UF6O.js";import"./chunk-FFL2TQEJ.js";import"./chunk-Q4HLQOJI.js";import{a as x}from"./chunk-XBE7PGVY.js";import"./chunk-C5UNZ6ZY.js";import"./chunk-S3DAAAE5.js";import"./chunk-P46TIMGQ.js";import"./chunk-SL7AJ7JQ.js";import"./chunk-FPFOW6BS.js";import"./chunk-WAOCHXJ5.js";import"./chunk-OE7TVGNB.js";import"./chunk-FYOCF7DY.js";import"./chunk-RGEAEAZB.js";import"./chunk-BC7UVJJB.js";import"./chunk-KHDUQ33H.js";import"./chunk-NFOBDHZK.js";import"./chunk-L5LI2JF4.js";import"./chunk-D5T4ARTB.js";import"./chunk-AE6SS34N.js";import"./chunk-GIRXJOJI.js";import"./chunk-B2PZAB7J.js";import"./chunk-IACKIGPX.js";import{e as b,f as S,g as T}from"./chunk-M5JQXOCE.js";import"./chunk-CIW2KP4C.js";import"./chunk-2WVKOZ6W.js";import"./chunk-NLCCBXXV.js";import"./chunk-RZ4F3BHX.js";import{a as C}from"./chunk-RLG5NUTE.js";import"./chunk-VE3SUJMA.js";import"./chunk-E47GFYXA.js";import{a as v}from"./chunk-TZZYRDCF.js";import"./chunk-E4OYR32M.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";import{resolve as Y}from"path";import{existsSync as D}from"fs";function O(){return{register:(n,r)=>b(n,r),deregister:n=>S(n),cleanup:(n,r)=>T(n,r),remoteLogger:null}}async function le(n,r){let t=Y(n);if(!D(t))return process.stderr.write(`error: file not found: ${t}
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-2T4JPBB5.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-FMVUXZGX.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-TU4KTO32.js"),d=g(e(t),y);if(d!==null)return d}let w=new R,j=A({isAgent:a,log:(e,g,d,V)=>w.log(e,g,d,V)}),F={path:t,cwd:process.cwd(),opts:r,isAgent:a,disableAskUser:!0,resolved:s,resolvedAuth:p,cliOverrides:i,environment:f,envConfig:N,profile:I,model:$,creds:o,configStore:l,session:w};try{return(await M(F,j,c)).exitCode}catch(e){return process.stderr.write(`error: ${e.message}
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-7SUKUJO2.js";import{b as m}from"./chunk-5FD6ZXB5.js";import"./chunk-KGP7NSXH.js";import{a as d}from"./chunk-RZ4F3BHX.js";import"./chunk-4CRKK5WV.js";import{a as f,g as a,h as u}from"./chunk-HMGNPFXP.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-G6AF2JUA.js";import{b as m}from"./chunk-TTSYHJLX.js";import{a as d}from"./chunk-RZ4F3BHX.js";import"./chunk-RLG5NUTE.js";import"./chunk-TZZYRDCF.js";import{a as f,g as a,h as u}from"./chunk-E4OYR32M.js";import"./chunk-UR6MHSHU.js";import{mkdirSync as y,writeFileSync as w,readFileSync as S,rmSync as c,cpSync as v,createWriteStream as T,existsSync as b}from"fs";import{join as s}from"path";import{tmpdir as k}from"os";import{spawn as h}from"child_process";import{Readable as I}from"stream";import{pipeline as $}from"stream/promises";function E(t){try{return S(s(t,"VERSION"),"utf-8").trim()||null}catch{return null}}function L(t,r,l){return l?t!==r:t===null||m(t,r)>0}function C(t){let r=a.split("/").pop()??a;return`https://registry.npmjs.org/${a}/-/${r}-${t}.tgz`}var R=5e3,A=6e4;async function x(){let t=new AbortController,r=setTimeout(()=>t.abort(),R);try{let l=await d(p(),{headers:{Accept:"application/json"},signal:t.signal});if(!l.ok)throw new Error(`Controller returned ${l.status} fetching skill version map`);let i=await l.json(),n=g(i,f);if(!n)throw new Error("No compatible skill version found for this kane-cli build");return n}finally{clearTimeout(r)}}async function _(t){let r=C(t),l=new AbortController,i=setTimeout(()=>l.abort(),A);try{let n=await d(r,{headers:{Accept:"application/octet-stream"},signal:l.signal});if(!n.ok||!n.body)throw new Error(`Failed to download skill tarball (${n.status})`);let e=s(k(),`kane-cli-skill-${t}-${process.pid}.tgz`);return await $(I.fromWeb(n.body),T(e)),e}finally{clearTimeout(i)}}function M(t,r){return new Promise((l,i)=>{y(r,{recursive:!0});let n=h("tar",["-xzf",t,"-C",r,"--strip-components=2","package/skills"],{stdio:["ignore","ignore","pipe"]}),e="";n.stderr?.on("data",o=>{e+=o.toString()}),n.on("error",o=>i(o)),n.on("close",o=>{o===0?l():i(new Error(`tar exited ${o}${e?`: ${e.trim()}`:""}`))})})}async function W(t){let r;try{r=t??await x()}catch(e){return{status:"failed",version:t??"unknown",installedTargets:0,error:e instanceof Error?e.message:String(e)}}let l=u.filter(({dir:e})=>L(E(e),r,!!t));if(l.length===0)return{status:"already-installed",version:r,installedTargets:0};let i=null,n=null;try{if(n=await _(r),i=s(k(),`kane-cli-skill-${r}-stage-${process.pid}`),c(i,{recursive:!0,force:!0}),await M(n,i),!b(s(i,"SKILL.md")))throw new Error(`Unexpected skill tarball layout for v${r}: SKILL.md not at package/skills/ root`);let e=0;for(let{dir:o}of l)try{c(o,{recursive:!0,force:!0}),y(o,{recursive:!0}),v(i,o,{recursive:!0,force:!0}),w(s(o,"VERSION"),r+`
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-MJFYMMX2.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-YZSYXNMB.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-53VDR5DN.js";import"./chunk-3MSXQU2C.js";import"./chunk-SQFNMZJ2.js";import"./chunk-DEEBPSJN.js";import"./chunk-ARS72637.js";import"./chunk-BO3JA2GS.js";import"./chunk-GIGD4M7V.js";import"./chunk-F2K3XFFH.js";import"./chunk-C5POEXSX.js";import"./chunk-Y6LMHBLE.js";import"./chunk-2YQ6TW77.js";import"./chunk-EEO4XWY6.js";import"./chunk-LMJTY32X.js";import"./chunk-RKWJG3WW.js";import"./chunk-7YQW4TFI.js";import"./chunk-Y7KW5AEN.js";import"./chunk-7MV5UF6O.js";import"./chunk-UXJPCWGW.js";import"./chunk-FFL2TQEJ.js";import"./chunk-Q4HLQOJI.js";import"./chunk-XBE7PGVY.js";import"./chunk-PJDOXRLB.js";import"./chunk-F66SSA4C.js";import"./chunk-5Y2G4NC7.js";import"./chunk-ME5QSYWX.js";import"./chunk-NFGG5DA2.js";import"./chunk-C5UNZ6ZY.js";import"./chunk-S3DAAAE5.js";import"./chunk-P46TIMGQ.js";import"./chunk-2TVRHXRK.js";import"./chunk-SL7AJ7JQ.js";import"./chunk-FPFOW6BS.js";import"./chunk-WAOCHXJ5.js";import"./chunk-B5LJCGAY.js";import"./chunk-RFHMDQXZ.js";import"./chunk-OE7TVGNB.js";import"./chunk-FYOCF7DY.js";import"./chunk-RGEAEAZB.js";import"./chunk-BC7UVJJB.js";import"./chunk-KHDUQ33H.js";import"./chunk-NFOBDHZK.js";import"./chunk-L5LI2JF4.js";import"./chunk-D5T4ARTB.js";import"./chunk-AE6SS34N.js";import"./chunk-GIRXJOJI.js";import"./chunk-B2PZAB7J.js";import"./chunk-IACKIGPX.js";import"./chunk-WFRL54GK.js";import"./chunk-VXGOWBET.js";import"./chunk-BGGNBWAJ.js";import"./chunk-YCCUBQY4.js";import"./chunk-YZKPZXHY.js";import"./chunk-M5JQXOCE.js";import"./chunk-CIW2KP4C.js";import"./chunk-2WVKOZ6W.js";import"./chunk-NLCCBXXV.js";import"./chunk-RZ4F3BHX.js";import"./chunk-RLG5NUTE.js";import"./chunk-VE3SUJMA.js";import"./chunk-E47GFYXA.js";import"./chunk-TZZYRDCF.js";import"./chunk-EWFFJBAM.js";import"./chunk-SHSV64GX.js";import{a as o}from"./chunk-DFS4RMVP.js";import"./chunk-BFFCGEUH.js";import"./chunk-AV5SUGRY.js";import"./chunk-E4OYR32M.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};
@@ -0,0 +1,2 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{e as a,f as b,g as c,h as d,i as e,j as f,k as g,l as h,m as i,n as j,o as k,p as l,q as m}from"./chunk-F2K3XFFH.js";import"./chunk-C5POEXSX.js";import"./chunk-Y6LMHBLE.js";import"./chunk-2YQ6TW77.js";import"./chunk-RKWJG3WW.js";import"./chunk-XBE7PGVY.js";import"./chunk-P46TIMGQ.js";import"./chunk-SL7AJ7JQ.js";import"./chunk-FPFOW6BS.js";import"./chunk-WAOCHXJ5.js";import"./chunk-L5LI2JF4.js";import"./chunk-YZKPZXHY.js";import"./chunk-M5JQXOCE.js";import"./chunk-NLCCBXXV.js";import"./chunk-RZ4F3BHX.js";import"./chunk-RLG5NUTE.js";import"./chunk-TZZYRDCF.js";import"./chunk-AV5SUGRY.js";import"./chunk-E4OYR32M.js";import"./chunk-HCBYKLMW.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";export{i as ExportError,c as assertOrgMatchOrExit,j as exportTestmd,b as metaMatchesOrg,a as readMetaIfExists,d as resolveCurrentOrgId,l as resolveSyncAuth,h as runDeleteAction,k as runExportAction,e as runListAction,f as runListTui,g as runStatusAction,m as runSyncAction};
@@ -0,0 +1,2 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{a}from"./chunk-P46TIMGQ.js";import"./chunk-SL7AJ7JQ.js";import"./chunk-RZ4F3BHX.js";import"./chunk-RLG5NUTE.js";import"./chunk-E4OYR32M.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,b,c}from"./chunk-5446YVGQ.js";import"./chunk-UR6MHSHU.js";export{b as baseUrlAdvisory,c as preflightTurn,a as resolveTurnBase};
2
+ import{a,b,c}from"./chunk-YKTYVJBN.js";import"./chunk-UR6MHSHU.js";export{b as baseUrlAdvisory,c as preflightTurn,a as resolveTurnBase};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as t}from"./chunk-KGP7NSXH.js";import"./chunk-HMGNPFXP.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-RLG5NUTE.js";import"./chunk-E4OYR32M.js";import"./chunk-UR6MHSHU.js";async function l(n,o,r){let{ControllerClient:e}=await import("./controller-client-RD2YEMAH.js");await new e(t(n).controllerBaseUrl,{username:o,accessKey:r}).getTmsCredentials()}export{l as validateBasicAuth};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a,b,c,d}from"./chunk-5FD6ZXB5.js";import"./chunk-RZ4F3BHX.js";import"./chunk-HMGNPFXP.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-TTSYHJLX.js";import"./chunk-RZ4F3BHX.js";import"./chunk-E4OYR32M.js";import"./chunk-UR6MHSHU.js";export{d as checkForUpdate,b as compareVersions,c as getSeverity,a as getUpdateCommand};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@testmuai/kane-cli",
3
- "version": "0.6.1",
3
+ "version": "0.6.3",
4
4
  "description": "KaneAI Terminal UI — browser automation testing agent",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -26,11 +26,11 @@
26
26
  "ws": "^8.20.0"
27
27
  },
28
28
  "optionalDependencies": {
29
- "@testmuai/kane-cli-darwin-arm64": "0.6.1",
30
- "@testmuai/kane-cli-darwin-x64": "0.6.1",
31
- "@testmuai/kane-cli-linux-x64": "0.6.1",
32
- "@testmuai/kane-cli-linux-arm64": "0.6.1",
33
- "@testmuai/kane-cli-win-x64": "0.6.1",
29
+ "@testmuai/kane-cli-darwin-arm64": "0.6.3",
30
+ "@testmuai/kane-cli-darwin-x64": "0.6.3",
31
+ "@testmuai/kane-cli-linux-x64": "0.6.3",
32
+ "@testmuai/kane-cli-linux-arm64": "0.6.3",
33
+ "@testmuai/kane-cli-win-x64": "0.6.3",
34
34
  "sharp": "^0.34.5"
35
35
  },
36
36
  "publishConfig": {
@@ -1,9 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as H,b as $e}from"./chunk-6PS65QFF.js";import{a as xe,b as ye}from"./chunk-MMI3VSCA.js";import{b as de,d as he}from"./chunk-QZWQCHXK.js";import{a as pe}from"./chunk-5Y2G4NC7.js";import{a as fe}from"./chunk-NSSKSXCT.js";import{b as ge}from"./chunk-DFS4RMVP.js";import"./chunk-CB3TEWZJ.js";import{x as l}from"./chunk-HMGNPFXP.js";import{a as R}from"./chunk-HCBYKLMW.js";import{a as x,b as o,i as me,k as U}from"./chunk-C44QQJR4.js";import{a as Y}from"./chunk-6YGTRKDT.js";import{e as I}from"./chunk-UR6MHSHU.js";var L=I(Y(),1);var B=I(R(),1),Te=3,Ze=60;function et(e){let n=e.cursor>=0?e.questions[e.cursor]:void 0;if(n?.risk==="high")return"high-risk \u2014 answer explicitly, or type 'defer' to leave the rest with the agent";let t=e.resolution.findIndex(Boolean);if(t>=0){let a=e.questions[t],r=a.options.find((i,p)=>p!==e.resolution[t].selected_index)?.label??a.options[0]?.label??"\u2026";return`changed your mind? \`${t+1}: ${r}\` re-answers q${t+1}`}let s=n??e.questions[0],u=s.options[0]?.label??"\u2026",c=s.allow_free_text?" \xB7 or your own words":"";return`e.g. \`1\` or \`${u}\`${c} \xB7 Enter takes recommended defaults`}function tt(e){return`[${e}]`}function nt({batch:e,i:n}){let t=e.resolution[n],s=t.form==="deferred"?"\u2013 deferred (the agent keeps it)":`\u2713 ${t.form}: ${t.choice}${t.form==="assumed"?" (flagged)":" (you)"}`;return(0,B.jsx)(o,{color:l.dim,children:` ${s}`})}function rt({batch:e,i:n}){let t=e.questions[n],s=e.cursor===n&&!e.resolution[n],u=s?"\u203A":" ";return(0,B.jsxs)(x,{flexDirection:"column",children:[(0,B.jsx)(o,{bold:s,children:` ${n+1} ${u} ${t.text} ${tt(t.risk)}`}),(0,B.jsx)(o,{color:l.dim,children:` why: ${t.rationale}`}),e.resolution[n]?(0,B.jsx)(nt,{batch:e,i:n}):(0,B.jsxs)(x,{flexDirection:"column",children:[t.multi_select?(0,B.jsx)(o,{color:l.dim,children:" note: multi-select not yet supported \u2014 pick the best single option"}):null,t.options.map((c,a)=>(0,B.jsx)(o,{children:` ${a+1}. ${c.label}${a===t.recommended_index?" \u2605 recommended":""}`},`o-${a}`)),t.allow_free_text?(0,B.jsx)(o,{color:l.dim,children:" (free text allowed \u2014 just type your own words)"}):null]})]})}function we({batch:e}){let{stdout:n}=U(),t=n?.columns??80,s=t<Ze,u=e.resolution.filter(y=>!y).length,c=Math.max(0,Math.min(e.cursor<0?0:e.cursor,e.questions.length-Te)),a=e.questions.slice(c,c+Te),r=c,i=e.questions.length-c-a.length,p=et(e);s&&p.length>t-2&&(p=`${p.slice(0,Math.max(0,t-3))}\u2026`);let f=e.cursor>=0?`answering ${e.cursor+1} of ${e.questions.length}`:"all placed",g=(0,B.jsxs)(x,{flexDirection:"column",children:[(0,B.jsx)(o,{bold:!0,children:`questions \xB7 ${u} pending \xB7 ${f}`}),r>0?(0,B.jsx)(o,{color:l.muted,children:` \u22EE ${r} above`}):null,a.map((y,C)=>(0,B.jsx)(rt,{batch:e,i:c+C},y.id)),i>0?(0,B.jsx)(o,{color:l.muted,children:` \u22EE ${i} more`}):null,(0,B.jsx)(o,{color:l.dim,children:p})]});return s?g:(0,B.jsx)(x,{flexDirection:"column",borderStyle:"round",borderColor:l.dim,paddingX:1,children:g})}var A=I(R(),1),be=60,ot=e=>e.length<=be?e:`${e.slice(0,be-1)}\u2026`;function Z({item:e}){return(0,A.jsxs)(x,{flexDirection:"column",marginLeft:2,children:[(e.cite??[]).map((n,t)=>(0,A.jsx)(o,{dimColor:!0,children:`cite ${n.anchor??"conv"} \u2014 "${n.quote??""}"`},`cite-${t}`)),(e.depends_on_hint??[]).length>0&&(0,A.jsx)(o,{dimColor:!0,children:`depends on: ${(e.depends_on_hint??[]).join(", ")}`}),Object.entries(e.extra??{}).map(([n,t])=>(0,A.jsx)(o,{dimColor:!0,children:`${n}: ${t}`},`extra-${n}`))]})}function Q({heading:e,turn:n,items:t,expandedRef:s,total:u,compact:c,numbers:a,marks:r}){return(0,A.jsxs)(x,{flexDirection:"column",children:[(0,A.jsx)(o,{bold:!0,children:`${e} \xB7 turn ${n} \xB7 ${u??t.length} proposed`}),t.map((i,p)=>{let f=i.matches_existing,g=f?f.cid?f.archived?` \u2248 matches ARCHIVED ${f.cid.slice(0,19)} \u2014 previously rejected${f.reason?`: "${f.reason}"`:""}`:` \u2248 matches ${f.cid.slice(0,19)}`:" \u2248overlap":"",y=r?.[p]?" \xB7 updated":"",C=c?` ${a?.[p]??p+1} \xB7 ${i.title}${i.badge!==void 0?` \xB7 ${i.badge}`:""}${i.why?` \u2014 ${ot(i.why)}`:""}${g}${y}`:` ${i.title}${i.badge!==void 0?` \xB7 ${i.badge}`:""}${i.why!==void 0?` \xB7 ${i.why}`:""}${g}`;return(0,A.jsxs)(x,{flexDirection:"column",children:[(0,A.jsx)(o,{children:C}),s===i.temp_ref&&(0,A.jsx)(Z,{item:i})]},i.temp_ref)})]})}var Ce=I(R(),1),st=e=>e.summary??e.description??"";function it(e){return{temp_ref:e.temp_ref,title:e.title,badge:e.risk,why:st(e),matches_existing:e.matches_existing?e.matches_existing:null,cite:e.cite??[],depends_on_hint:e.depends_on_hint??[]}}function ve({turn:e,items:n,expandedRef:t,total:s,compact:u,numbers:c,marks:a}){return(0,Ce.jsx)(Q,{heading:"use-cases",turn:e,items:n.map(it),expandedRef:t,total:s,compact:u,numbers:c,marks:a})}var at={"use-case":"use-cases",ac:"ACs",scenario:"scenarios",test:"tests",gap:"gaps"},P=e=>at[e]??`${e}s`,ke=e=>e==="ac"?"AC":e==="use-case"?"use-case":e,ee=e=>e.kind??"use-case",Se=e=>`${ee(e)}:${e.temp_ref}`;function Ie(e){let n=e,t=n.badge??e.risk??null,s=n.why??e.summary??e.description??null;return JSON.stringify([e.title,t,s,n.extra??null,e.depends_on_hint??null])}function Be(e){return e.filter(n=>n.role==="agent"&&typeof n.turnIndex=="number"&&Array.isArray(n.items)&&n.items.length>0)}function F(e){let n=new Map,t=1;for(let c of Be(e)){let a=new Set;for(let r of c.items){let i=Se(r);if(a.has(i))continue;a.add(i);let p=n.get(i);n.set(i,{num:p?.num??t++,ref:r.temp_ref,kind:ee(r),item:r,turnIndex:c.turnIndex,fingerprint:Ie(r)})}}let s=[...n.values()].sort((c,a)=>c.num-a.num),u=[];for(let c of s){let a=u.find(r=>r.kind===c.kind);a?a.count++:u.push({kind:c.kind,label:P(c.kind),count:1})}return{entries:s,byRef:n,counts:u}}function Re(e,n){let s=Be(e).find(m=>m.turnIndex===n);if(!s)return null;let u=e.filter(m=>m.role!=="agent"||typeof m.turnIndex!="number"||m.turnIndex<=n),c=F(u),a=F(e.filter(m=>m.role!=="agent"||typeof m.turnIndex!="number"||m.turnIndex<n)),r=[],i=new Map,p=new Map,f=new Map,g=new Set;for(let m of s.items){let w=Se(m);if(g.has(w))continue;g.add(w);let q=a.byRef.get(w),O=m.changed===!0,S=c.byRef.get(w).num,D=ee(m);if(q&&!O&&q.fingerprint===Ie(m)){i.set(D,(i.get(D)??0)+1);continue}let b=!!q||O,M=b?f:p;M.set(D,(M.get(D)??0)+1),r.push({item:m,num:S,updated:b})}let y=[...i.entries()].map(([m,w])=>({label:P(m),count:w})),C=[...[...p.entries()].map(([m,w])=>`${w} new ${w===1?ke(m):P(m)}`),...[...f.entries()].map(([m,w])=>`${w} updated ${w===1?ke(m):P(m)}`)].join(" \xB7 ");return{fresh:r,unchanged:y,headerStats:C}}var E=I(R(),1);function De({turnIndex:e,fresh:n,headerStats:t,unchangedTotal:s}){let u=[];for(let a of n){let r=a.item.kind??"use-case",i=u.find(p=>p.kind===r);i?i.rows.push(a):u.push({kind:r,rows:[a]})}let c=`design \xB7 turn ${e} \u2014 ${t||"no new items"}${s>0?` (${s} unchanged)`:""}`;return(0,E.jsxs)(x,{flexDirection:"column",children:[(0,E.jsx)(o,{bold:!0,children:c}),u.map(({kind:a,rows:r})=>{let i=r.filter(g=>!g.updated).length,p=r.length-i,f=[...i>0?[`${i} new`]:[],...p>0?[`${p} updated`]:[]].join(" \xB7 ");return(0,E.jsxs)(x,{flexDirection:"column",children:[(0,E.jsx)(o,{color:l.dim,children:`${P(a).toLowerCase()} \xB7 ${f}`}),r.map(({item:g,num:y,updated:C})=>{let m=g;return(0,E.jsxs)(x,{flexDirection:"column",children:[(0,E.jsxs)(o,{children:[(0,E.jsx)(o,{children:` ${y} \xB7 ${g.title}`}),m.badge?(0,E.jsx)(o,{color:l.dim,children:` \xB7 ${m.badge}`}):null,C?(0,E.jsx)(o,{color:l.dim,children:" \xB7 updated"}):null]}),m.why?(0,E.jsx)(o,{color:l.dim,children:` ${m.why}`}):null]},`${a}:${g.temp_ref}`)})]},a)})]})}var d=I(R(),1);function ct(e){let n=e.form==="assumed"?" (flagged)":e.form==="deferred"?"":" (you)",t=e.note?` \u2014 ${e.note}`:"";return e.form==="deferred"?`\u21B3 deferred q${e.qNum} ${e.stub}${t}`:e.form==="changed"?`\u21B3 changed q${e.qNum} ${e.stub}: ${e.prev??"?"} \u2192 ${e.choice??"?"}${n}${t}`:`\u21B3 ${e.form} q${e.qNum} ${e.stub}: ${e.choice??"?"}${n}${t}`}function Ee({block:e,annotations:n}){switch(e.kind){case"banner":return(0,d.jsx)(o,{color:l.dim,children:`\u2500\u2500 ${e.text} \u2500\u2500`});case"user":return(0,d.jsxs)(x,{children:[(0,d.jsx)(o,{color:l.orange,children:"\u276F "}),(0,d.jsx)(o,{children:e.text})]});case"note":return(0,d.jsx)(o,{color:l.dim,children:e.text});case"agent":return(0,d.jsx)(xe,{text:e.text});case"thinking":return(0,d.jsx)(o,{color:l.dim,children:` thought for ${(e.tookMs/1e3).toFixed(1)}s`});case"tool":return(0,d.jsx)(o,{color:l.dim,children:` ${H({name:e.name,status:e.status==="ok"?"done":e.status,detail:e.detail})}`});case"usage":return(0,d.jsx)(o,{color:l.dim,children:` \xB7 ${e.credits.toFixed(1)} credits \u2014 total ${e.total.toFixed(1)}`});case"turn":{let t=n??null,s=t?t.fresh.map(r=>r.item):e.items,u=t?t.fresh.map(r=>r.num):void 0,c=t?t.fresh.map(r=>r.updated):void 0,a=s.some(r=>!!r.kind);return(0,d.jsxs)(x,{flexDirection:"column",marginLeft:2,children:[a?(0,d.jsx)(De,{turnIndex:e.turnIndex,fresh:t?t.fresh:s.map((r,i)=>({item:r,num:i+1,updated:!1})),headerStats:t?.headerStats??"",unchangedTotal:(t?.unchanged??[]).reduce((r,i)=>r+i.count,0)}):e.heading==="use-cases"?(0,d.jsx)(ve,{turn:e.turnIndex,items:s,expandedRef:null,compact:!0,total:s.length,numbers:u,marks:c}):(0,d.jsx)(Q,{heading:e.heading,turn:e.turnIndex,items:s,expandedRef:null,compact:!0,total:s.length,numbers:u,marks:c}),t&&t.unchanged.length>0&&(0,d.jsx)(o,{color:l.dim,children:` \u22EE unchanged: ${t.unchanged.map(r=>`${r.count} ${r.label}`).join(" \xB7 ")} \u2014 /view to browse`})]})}case"answer":return(0,d.jsx)(o,{color:l.dim,children:ct(e.receipt)});case"commit":return(0,d.jsxs)(x,{flexDirection:"column",children:[(0,d.jsx)(o,{color:e.ok?l.green:l.red,children:`${e.ok?"\u2714":"\u2717"} ${e.line}`}),(e.warnings??[]).map((t,s)=>(0,d.jsx)(o,{color:l.dim,children:` \u26A0 ${t}`},`w-${s}`))]});case"error":return(0,d.jsxs)(fe,{variant:"error",paddingX:1,children:[(0,d.jsx)(o,{color:l.red,children:e.title}),e.detail.map((t,s)=>(0,d.jsx)(o,{color:l.dim,children:t},`d-${s}`))]});case"interrupted":return(0,d.jsxs)(x,{flexDirection:"column",children:[(0,d.jsx)(o,{color:l.red,children:"interrupted \u2014 session not saved"}),e.detail?(0,d.jsx)(o,{color:l.dim,children:e.detail}):null]});case"pause":return(0,d.jsxs)(x,{flexDirection:"column",children:[(0,d.jsx)(o,{children:`paused: session ${e.sid} saved`}),e.expires_at?(0,d.jsx)(o,{color:l.dim,children:`expires: ${e.expires_at}`}):null,(0,d.jsx)(o,{children:`resume: ${e.resume}`}),e.messageForm?(0,d.jsx)(o,{children:`or say something on the way in: ${e.messageForm}`}):null]});case"summary":return(0,d.jsxs)(x,{flexDirection:"column",children:[(0,d.jsx)(o,{bold:!0,children:"session summary"}),e.lines.map((t,s)=>(0,d.jsx)(o,{children:` ${t}`},`s-${s}`))]})}}var W=I(Y(),1);var Oe=I(R(),1),Le=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"],te="ctrl+t thinking \xB7 ctrl+c pause";function Ae(e,n){if(e.length<=n)return e;if(n<=1)return"\u2026";let t=Math.ceil((n-1)/2),s=Math.floor((n-1)/2);return`${e.slice(0,t)}\u2026${s>0?e.slice(-s):""}`}function _e({streaming:e,verb:n,subject:t,turn:s,pendingCount:u,lastActivity:c,workingLabel:a,creditsTotal:r}){let{stdout:i}=U(),p=i?.columns??80,[f,g]=(0,W.useState)(0),y=(0,W.useRef)(null);(0,W.useEffect)(()=>{e&&y.current===null&&(y.current=Date.now()),e||(y.current=null)},[e]),pe(()=>g(b=>b+1),e?1e3:null);let C=[];if(e){let b=y.current?Math.floor((Date.now()-y.current)/1e3):0;C.push(`${Le[f%Le.length]} ${b}s ${a??c??"waiting for model"}`)}C.push(n),s&&C.push(`turn ${s}`),r!==void 0&&C.push(`${r.toFixed(1)} cr`);let m=u?`[${u} pending]`:null,w=" \xB7 ",O=[...C,...m?[m]:[]].join(w).length,S,D=[...C,...t?[t]:[],...m?[m]:[],te].join(w);if(D.length<=p)S=D;else{let b=p-O-(t?w.length:0)-w.length-te.length;if(t&&b>=8)S=[...C,Ae(t,b),...m?[m]:[],te].join(w);else{let M=p-O-(t?w.length:0);S=[...C,...t&&M>=4?[Ae(t,M)]:[],...m?[m]:[]].join(w)}}return(0,Oe.jsx)(o,{color:l.dim,children:S})}var V=I(Y(),1);function ne({onToggleThinking:e,onCtrlC:n,explorer:t}){let u=(0,V.useRef)(null),c=(0,V.useRef)(""),a=()=>{u.current&&clearTimeout(u.current),u.current=null,c.current=""};return(0,V.useEffect)(()=>a,[]),me((r,i)=>{if(i.ctrl&&r==="t"){e();return}if(i.ctrl&&r==="c"){n();return}if(!i.ctrl&&r.includes("")){n();return}if(!i.ctrl&&r.includes("")){e();return}if(t&&t.isOpen()){let p=()=>{u.current&&clearTimeout(u.current),u.current=setTimeout(()=>{a(),t.onBack()},150)};if(u.current){if(i.upArrow||i.downArrow||i.return){a(),i.return?t.onEnter():t.onMove(i.upArrow?-1:1);return}if(c.current+=r,c.current==="["){p();return}let f=c.current;a();let g=/^\[([AB])/.exec(f);if(g){t.onMove(g[1]==="A"?-1:1);return}t.onBack();return}if(i.upArrow){t.onMove(-1);return}if(i.downArrow){t.onMove(1);return}if(i.return){t.onEnter();return}if(i.escape){c.current="",p();return}if(r.length>=2&&!i.ctrl&&!i.meta){t.onClose();return}return}}),null}var v=I(R(),1),re=(e,n)=>Math.max(0,Math.min(n,e));function X(e,n,t){switch(n.type){case"move":return{...e,cursor:re(e.cursor+n.delta,Math.max(0,t-1))};case"enter":return e.level==="list"?{...e,level:"detail"}:e;case"back":return e.level==="detail"?{...e,level:"list"}:null}}var Pe={"use-case":"use-cases",ac:"acs",scenario:"scenarios",test:"tests",gap:"gaps"};function qe(e,n){if(e.level==="detail")return{level:"detail",cursor:re(e.num-1,Math.max(0,n.entries.length-1))};if(e.section){let t=n.entries.findIndex(s=>Pe[s.kind]===e.section);if(t>=0)return{level:"list",cursor:t}}return{level:"list",cursor:0}}function lt(e){let n=[];for(let t of e.entries){let s=n.find(u=>u.kind===t.kind);s?s.entries.push(t):n.push({kind:t.kind,entries:[t]})}return n}var Me=3;function ut({items:e,cursor:n,verb:t}){let s=`view \xB7 ${t} so far \xB7 ${e.counts.map(c=>`${c.count} ${c.count===1?c.label.replace(/s$/,""):c.label}`).join(" \xB7 ")}`,u=e.entries[n];return(0,v.jsxs)(x,{flexDirection:"column",borderStyle:"round",borderColor:l.dim,paddingX:1,children:[(0,v.jsx)(o,{bold:!0,children:s}),lt(e).map(({kind:c,entries:a})=>{let r=u?.kind===c,i=r?a.findIndex(y=>y.ref===u.ref):-1,p=r?re(i-1,Math.max(0,a.length-Me)):0,f=a.slice(p,p+(r?Me:1)),g=a.length-f.length;return(0,v.jsxs)(x,{flexDirection:"column",children:[(0,v.jsx)(o,{color:l.dim,children:`${Pe[c]??P(c)} \xB7 ${a.length}`}),f.map(y=>{let C=r&&y.ref===u.ref,m=y.item.badge;return(0,v.jsxs)(o,{children:[(0,v.jsx)(o,{color:l.generateAccent,children:C?"\u203A ":" "}),(0,v.jsx)(o,{children:`${y.num} \xB7 ${y.item.title}`}),m?(0,v.jsx)(o,{color:l.dim,children:` \xB7 ${m}`}):null]},`${y.kind}:${y.ref}`)}),g>0&&(0,v.jsx)(o,{color:l.dim,children:` \u22EE ${g} more`})]},c)}),(0,v.jsx)(o,{color:l.dim,children:"\u2191\u2193 move \xB7 \u21B5 detail \xB7 esc back to chat"})]})}function mt({items:e,cursor:n}){let t=e.entries[n];if(!t)return(0,v.jsx)(o,{color:l.dim,children:"nothing to show"});let s=t.item;return(0,v.jsxs)(x,{flexDirection:"column",borderStyle:"round",borderColor:l.dim,paddingX:1,children:[(0,v.jsx)(o,{bold:!0,children:`view \xB7 ${t.kind} ${t.num} of ${e.entries.length}`}),(0,v.jsx)(o,{children:t.item.title}),s.badge?(0,v.jsx)(o,{color:l.dim,children:`kind: ${s.badge}`}):null,s.why?(0,v.jsx)(o,{color:l.dim,children:s.why}):null,(0,v.jsx)(Z,{item:t.item}),(0,v.jsx)(o,{color:l.dim,children:"view-only \u2014 approvals happen in chat"}),(0,v.jsx)(o,{color:l.dim,children:"\u2191\u2193 prev/next \xB7 esc back to list"})]})}function Ne({items:e,state:n,verb:t}){return n.level==="list"?(0,v.jsx)(ut,{items:e,cursor:n.cursor,verb:t}):(0,v.jsx)(mt,{items:e,cursor:n.cursor})}var Ue=[{name:"view",description:"browse the proposal set"},{name:"explain",description:"why a committed item exists"},{name:"pause",description:"save + exit (resumable)"},{name:"done",description:"finish the session"}],dt={"use-cases":"use-cases",usecases:"use-cases","use-case":"use-cases",acs:"acs",ac:"acs",scenarios:"scenarios",scenario:"scenarios",tests:"tests",test:"tests",gaps:"gaps",gap:"gaps"};function We(e){let n=(e??"").trim().toLowerCase();if(!n)return{level:"list"};if(/^\d+$/.test(n)){let s=parseInt(n,10);return s>=1?{level:"detail",num:s}:{error:"items are numbered from 1 \u2014 /view 1"}}let t=dt[n];return t?{level:"list",section:t}:{error:"try /view, /view <number>, or /view acs|scenarios|tests"}}var k=I(R(),1),pt=6,Ke=12;function Fe(e,n,t){let s=Math.max(20,n),u=[];for(let a of e.split(`
3
- `)){if(a.length<=s){u.push(a);continue}let r="";for(let i of a.split(" "))r&&r.length+1+i.length>s?(u.push(r),r=i):r=r?`${r} ${i}`:i;u.push(r)}let c=Math.max(0,u.length-t);return{body:u.slice(-t).join(`
4
- `),hidden:c}}var ft='chat with the agent \u2014 "/" for commands';function un({controller:e,verb:n="extract",onCtrlC:t}){let[,s]=(0,L.useState)(0),[u,c]=(0,L.useState)(!1),[a,r]=(0,L.useState)(null),[i,p]=(0,L.useState)(null),f=(0,L.useRef)(null),g=$=>{f.current=$,p($)},y=ge(),{stdout:C}=U(),m=C?.columns??80,w=(0,L.useRef)(0),q=(0,L.useRef)(0),O=(0,L.useRef)(null);O.current||(O.current=new de(null)),(0,L.useEffect)(()=>{let $=()=>{let h=e.state.ledger;for(let _=w.current;_<h.length;_++){let N=h[_],Ye=N.kind==="turn"?Re(e.state.turns,N.turnIndex):void 0;y.append((0,k.jsx)(Ee,{block:N,annotations:Ye},`lg-${_}`))}w.current=h.length};$();let T=e.subscribe(()=>{$();let h=e.state;f.current&&(h.pending||h.status==="pausing")&&(g(null),h.pending&&r("questions arrived \u2014 back to chat")),s(_=>_+1)});return s(h=>h+1),T},[e,y]);let{thinking:S,status:D,pending:b,confirm:M,ledger:oe,activeTurn:se,stream:z,notice:j}=e.state,G=S.activity[S.activity.length-1],ie=G&&G.status==="started"?G:null,ae=z!=null&&z.text.length>0,Ve=ae?`\u2237 thinking \xB7 ${S.thinkingLog.length} block${S.thinkingLog.length===1?"":"s"} \xB7 ctrl+t to inspect`:S.liveThinking.length>0?`\u273B ${Fe(S.liveThinking,m-4,1).body}`:D==="streaming"?"\u2237 thinking\u2026 (ctrl+t to show)":"\u2237 thinking complete (ctrl+t to view)",je=S.liveThinking.length>0||u&&S.thinkingLog.length>0,He=Fe(S.liveThinking||S.thinkingLog.map($=>$.text).join(`
5
- `),m-6,Ke),ce=ae?z.text.split(`
6
- `).slice(-pt):[];se&&(q.current=se.turnIndex);let Qe=b?b.resolution.filter($=>!$).length:0,le;for(let $=oe.length-1;$>=0;$--){let T=oe[$];if(T.kind==="banner"&&!T.text.startsWith("kane")){le=T.text;break}}let K=S.activity[S.activity.length-1],Xe=K?K.status==="decision"?K.label:$e({name:K.name,status:K.status}):void 0,ze=D==="streaming"&&!b,Ge=b?`answering ${Math.max(0,b.cursor)+1} of ${b.questions.length} \u2014 option number, label, or your own words`:ft,J=t??(()=>e.requestPause()),Je=$=>{let T=We($);if("error"in T){r(T.error);return}let h=F(e.state.turns);if(h.entries.length===0){r("nothing proposed yet \u2014 the first turn is still coming");return}if(T.level==="detail"&&T.num>h.entries.length){r(`no item ${T.num} \u2014 the set has ${h.entries.length} item${h.entries.length===1?"":"s"}`);return}g(qe(T,h))},ue=(0,k.jsx)(_e,{streaming:D==="streaming"||D==="working",verb:n,subject:le,turn:q.current||void 0,pendingCount:Qe,lastActivity:Xe,workingLabel:D==="working"?e.state.workingLabel:void 0,creditsTotal:e.state.credits?.total});if(i){let $=F(e.state.turns),T=$.entries.length;return(0,k.jsxs)(x,{flexDirection:"column",children:[(0,k.jsx)(ne,{onToggleThinking:()=>c(h=>!h),onCtrlC:J,explorer:{isOpen:()=>f.current!==null,onClose:()=>{g(null),r("closed the explorer \u2014 your text didn't send, retype to chat"),setTimeout(()=>s(h=>h+1),0)},onMove:h=>g(f.current&&X(f.current,{type:"move",delta:h},T)),onEnter:()=>g(f.current&&X(f.current,{type:"enter"},T)),onBack:()=>{g(f.current&&X(f.current,{type:"back"},T)),setTimeout(()=>s(h=>h+1),0)}}}),(0,k.jsx)(Ne,{items:$,state:i,verb:n}),(j??a)&&(j??a).split(`
7
- `).map((h,_)=>(0,k.jsx)(o,{color:l.orange,children:h},`nt-${_}`)),ue]})}return(0,k.jsxs)(x,{flexDirection:"column",children:[(0,k.jsx)(ne,{onToggleThinking:()=>c($=>!$),onCtrlC:J}),je&&(u?(0,k.jsx)(ye,{thinking:He.body,expanded:!0,thinkingDone:D!=="streaming",maxLines:Ke+1}):(0,k.jsx)(o,{color:l.dim,children:Ve})),ie&&(0,k.jsx)(o,{dimColor:!0,children:`${H({name:ie.name,status:"started"})}\u2026`}),ce.length>0&&(0,k.jsx)(x,{flexDirection:"column",children:ce.map(($,T)=>(0,k.jsx)(o,{children:$},`st-${T}`))}),b&&(0,k.jsx)(we,{batch:b}),M&&(0,k.jsx)(o,{color:"yellow",children:M.prompt}),(j??a)&&(j??a).split(`
8
- `).map(($,T)=>(0,k.jsx)(o,{color:l.orange,children:$},`nt-${T}`)),D==="pausing"?(0,k.jsx)(o,{color:l.dim,children:"pausing \u2014 saving session\u2026 (ctrl+c again = force quit)"}):(0,k.jsx)(he,{history:O.current,placeholder:Ge,accent:l.generateAccent,submitVerb:b?"answer":"send",submitEmpty:!!b,inert:ze,commands:Ue,footerBindings:[{keys:"\u21B5",label:b?"answer":"send"},{keys:"\u2191\u2193",label:"history"},{keys:"ctrl+t",label:"thinking"},{keys:"ctrl+c",label:"pause"}],onSubmit:$=>{let T=$.trim();if(!T){b&&e.submit("");return}if(r(null),T.startsWith("/")){let[h="",..._]=T.slice(1).split(/\s+/),N=_.join(" ");if(!h){r('type "/" then a command \u2014 /view, /explain, /pause, /done');return}switch(h.toLowerCase()){case"view":Je(N);return;case"explain":if(!N){r("usage: /explain <ref> \u2014 e.g. /explain guest-checkout");return}e.explainRef(N);return;case"pause":J();return;case"done":case"exit":e.completeSession();return;default:r(`unknown command "/${h}" \u2014 try /view, /explain, /pause, /done${b?`
9
- to answer with a literal "/", quote it: "/api/v2"`:""}`);return}}e.submit(T)}}),ue]})}export{un as ChatSurface,Fe as tailVisualRows};
@@ -1,2 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a}from"./chunk-WRHZCHZY.js";import"./chunk-RFHMDQXZ.js";import"./chunk-WGG5XURS.js";import"./chunk-FYOCF7DY.js";import"./chunk-RGEAEAZB.js";import"./chunk-BC7UVJJB.js";import"./chunk-NFOBDHZK.js";import"./chunk-KHDUQ33H.js";import"./chunk-L5LI2JF4.js";import"./chunk-D5T4ARTB.js";import"./chunk-AE6SS34N.js";import"./chunk-GIRXJOJI.js";import"./chunk-B2PZAB7J.js";import"./chunk-IACKIGPX.js";import"./chunk-M5JQXOCE.js";import"./chunk-KGP7NSXH.js";import"./chunk-HMGNPFXP.js";import"./chunk-HCBYKLMW.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";export{a as EvidenceViewOffer};
@@ -1,2 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a,b}from"./chunk-SQJWMOJQ.js";import"./chunk-YCCUBQY4.js";import"./chunk-37CI4EJX.js";import"./chunk-2WVKOZ6W.js";import"./chunk-NLCCBXXV.js";import"./chunk-KGP7NSXH.js";import"./chunk-RZ4F3BHX.js";import"./chunk-CB3TEWZJ.js";import"./chunk-HMGNPFXP.js";import"./chunk-HCBYKLMW.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";export{b as FolderPicker,a as formatFolderLine};
@@ -1,2 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a}from"./chunk-Q4P2L7DY.js";import"./chunk-S74MQRDN.js";import"./chunk-QZWQCHXK.js";import"./chunk-2PDWMY2B.js";import"./chunk-HGL3RM7P.js";import"./chunk-FPFOW6BS.js";import"./chunk-WAOCHXJ5.js";import"./chunk-L5LI2JF4.js";import"./chunk-KFAYCOTB.js";import"./chunk-SQJWMOJQ.js";import"./chunk-YCCUBQY4.js";import"./chunk-37CI4EJX.js";import"./chunk-M5JQXOCE.js";import"./chunk-2WVKOZ6W.js";import"./chunk-NLCCBXXV.js";import"./chunk-VE3SUJMA.js";import"./chunk-RH2OAIJI.js";import"./chunk-KGP7NSXH.js";import"./chunk-RZ4F3BHX.js";import"./chunk-4CRKK5WV.js";import"./chunk-CB3TEWZJ.js";import"./chunk-HMGNPFXP.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-J5BUMF3G.js";import"./chunk-O4O4KL6Z.js";import"./chunk-XDW2RGIL.js";import"./chunk-HGL3RM7P.js";import"./chunk-FS4YJM22.js";import"./chunk-5Y2G4NC7.js";import"./chunk-M5JQXOCE.js";import"./chunk-KGP7NSXH.js";import"./chunk-SB6MBQKR.js";import"./chunk-NSSKSXCT.js";import"./chunk-DFS4RMVP.js";import"./chunk-HMGNPFXP.js";import"./chunk-HCBYKLMW.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";export{a as TestMdRunView};
@@ -1,3 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as H,b as V,c as J,d as K}from"./chunk-DM2GL24Z.js";import{b as L,d as F}from"./chunk-VJUIW2ES.js";import"./chunk-6PS65QFF.js";import{d as z}from"./chunk-KHDUQ33H.js";import"./chunk-GIRXJOJI.js";import"./chunk-B2PZAB7J.js";import"./chunk-IACKIGPX.js";import"./chunk-UR6MHSHU.js";var ee=new Set(["approve","edit","reject"]);function te(i,t){return`chatop:${t}:${i.target??"new"}:${i.op}:${i.seq}`}function ne(i,t,k,c){let a=te(i,t),m=i.payload;switch(i.op){case"approve":return{kind:"approve",target:i.target,expectedCid:i.expected_cid,eventId:a};case"edit":{let{reason:r,...h}=m;return{kind:"edit",target:i.target,expectedCid:i.expected_cid,edit:h,reason:r,eventId:a}}case"enhance":return{kind:"enhance",target:i.target,expectedCid:i.expected_cid,edges:m.edges??[],eventId:a};case"reject":return{kind:"reject",target:i.target,expectedCid:i.expected_cid,reason:m.reason??"",redirectTo:m.redirect_to,eventId:a};case"add":{let r=m.proposal_item??{},h=String(r.label??"");if(!k.mint_gate.includes(h))throw new Error(`GATED_LABEL: cannot mint "${h}" (gate: ${k.mint_gate.join(", ")})`);let d=r.cite??{},u=r.conv_source_id??c;if(!u||typeof d.turn!="number"||!d.quote)throw new Error("INVALID_ADD: a chat add requires a conversation cite {turn, quote} and conv_source_id");return{kind:"add",label:h,content:r.content??{},cite:{turn:d.turn,quote:d.quote},convSourceId:u,rationale:r.rationale,eventId:a}}}}function X(i,t,k={}){let c=k.turn??0,a=[],m=[];for(let d of i)(d.op==="add"||d.op==="enhance")&&m.push(d);let r=new Map;for(let d of i){if(!ee.has(d.op)||!d.target)continue;let u=r.get(d.target)??[];u.push(d),r.set(d.target,u)}for(let[d,u]of r){let _=Math.max(...u.map(y=>y.seq)),C=u.filter(y=>y.seq===_);if(C.length>1){a.push({target:d,seq:_,kinds:C.map(y=>y.op)});continue}m.push(C[0])}return{chatOps:m.sort((d,u)=>d.seq-u.seq).map(d=>ne(d,c,t,k.convSourceId)),ambiguous:a}}function re(i,t){let k=i.trim();if(k==="")return{kind:"defaults"};if(/^defer$/i.test(k))return{kind:"defer-all"};let c=t.cursor,a=k,m=/^(\d+):\s*(.*)$/.exec(k);if(m){let u=Number(m[1]);if(u<1||u>t.questions.length)return{kind:"invalid",target:null,message:`no question ${u} \u2014 this batch has ${t.questions.length}`};if(c=u-1,a=m[2].trim(),!a)return{kind:"invalid",target:c,message:`say what to answer \u2014 e.g. \`${u}: yes\``}}if(c<0||c>=t.questions.length)return{kind:"invalid",target:null,message:"no pending question to answer"};let r=t.questions[c],h=/^"(.*)"$/.exec(a);if(h)return r.allow_free_text?{kind:"free",target:c,text:h[1]}:{kind:"invalid",target:c,message:`question ${c+1} takes an option (1-${r.options.length}) \u2014 free text isn't allowed here`};if(r.multi_select&&/^\d+(\s+\d+)+$/.test(a)){let u=a.split(/\s+/).map(Number);if(u.every(_=>_>=1&&_<=r.options.length))return{kind:"multi",target:c,indices:u.map(_=>_-1)}}if(/^\d+$/.test(a)){let u=Number(a);if(u>=1&&u<=r.options.length)return{kind:"option",target:c,index:u-1}}let d=r.options.findIndex(u=>u.label.toLowerCase()===a.toLowerCase());return d>=0?{kind:"option",target:c,index:d}:r.allow_free_text?{kind:"free",target:c,text:a}:{kind:"invalid",target:c,message:`question ${c+1} takes an option \u2014 type 1-${r.options.length} or an option name`}}function Y(i){let t=i.text.replace(/\?+\s*$/,"");return t.length<=36?t:`${t.slice(0,33)}\u2026`}function ie(i){return i.use_cases??[]}function se(i){let t=[],k=[],c=(r,h)=>{h.length!==0&&(k.push(r),t.push(...h))},a=r=>typeof r=="string"&&/^[a-z]{1,4}\d{1,4}$/i.test(r)?r:null,m=r=>{let h=a(r.automates)??"1 scenario",d=r.verifies??[],u=d.map(a).filter(y=>y!==null).slice(0,2),_=d.length-u.length,C=u.length?`${u.join(" ")}${_>0?` +${_}`:""}`:`${d.length} ACs`;return`covers ${h} \xB7 verifies ${C}`};return c("acs",(i.acs??[]).map(r=>({temp_ref:r.temp_ref,title:r.text,kind:"ac",badge:String(r.kind),extra:{...r.expected_answer?{expects:`${String(r.expected_answer.operator??"")} \xB7 ${String(r.expected_answer.operand??"")}`}:{},"scoped to":r.scoped_to??"(use-case)"}}))),c("scenarios",(i.scenarios??[]).map(r=>({temp_ref:r.temp_ref,title:r.title,kind:"scenario",badge:r.case_type,why:r.intent,depends_on_hint:r.depends_on??[],extra:{technique:r.technique_notes}}))),c("tests",(i.tests??[]).map(r=>({temp_ref:r.temp_ref,title:r.title,kind:"test",why:m(r),depends_on_hint:r.reuses??[],extra:{automates:String(r.automates??"?"),verifies:(r.verifies??[]).join(", "),check:r.check?`${String(r.check.kind)} vs ${String(r.check.verified_against)}`:"?"}}))),c("gaps",(i.gaps??[]).map(r=>({temp_ref:r.temp_ref??r.ref??"?",title:String(r.question?.header??r.kind),kind:"gap",badge:r.kind,why:r.risk_rationale}))),{items:t,heading:k.join(" + ")||"design"}}function ge(i={}){let t={turns:[],thinking:V(),pending:null,confirm:null,status:"idle",ledger:[],activeTurn:null,stream:null},k=e=>{let n=[],o=e.minted.map(p=>p.slug).filter(Boolean);o.length&&n.push(`added ${o.join(", ")}`);let s=e.applied.length-e.minted.length;return s>0&&n.push(`${s} change${s===1?"":"s"} applied`),e.staleDelta.length&&n.push(`stales ${e.staleDelta.length}`),n.join(" \xB7 ")||"no changes"},c=[];i.onRender&&c.push(i.onRender);let a=0,m=0,r=null,h=null,d=null,u=[],_=0,C=e=>{if(!(!d||!i.contextDir||!e.trim()))try{let n=i.refreshGraph?.()??i.graph;if(!n)return;F({contextDir:i.contextDir,graph:n,sourceId:d,text:e,by:i.by??{kind:"human",id:"owner"}})}catch{}},y=e=>{if(!d||!i.contextDir)return;let n=i.refreshGraph?.()??i.graph,o=n?.heads.get(d),s=n?.convChains.get(d);if(!n||typeof o!="string"||!s)return;let p=n.getNode(o)?.content?.blob,f=typeof p=="string"?z(i.contextDir,p)?.toString("utf8")??"":"";if(f)for(let v of e){if(v.kind!=="add"||v.convSourceId!==d)continue;let T=L(f,v.cite.turn);if(!(T!==null&&T.includes(v.cite.quote)))for(let $=s.turns;$>=1;$--){let D=L(f,$);if(D!==null&&D.includes(v.cite.quote)){v.cite={...v.cite,turn:$};break}}}},M=null,j=new Map,P=new Map,E=null,x=()=>{R&&(clearTimeout(R),R=null);for(let e of c)e()},R=null,N=()=>{R||(R=setTimeout(()=>{R=null;for(let e of c)e()},80))},l=e=>{t.ledger.push(e)},I=()=>{t.activeTurn&&(t.activeTurn=null)},Q=(e,n)=>n.choice||(n.selected_index!=null?e.options[n.selected_index]?.label??"?":"?"),B=()=>{let e=t.pending;if(!e)return;if(!e.resolution.every(Boolean)){e.cursor=e.resolution.findIndex(s=>s===null);return}let n=e.questions.map((s,p)=>{let f=e.resolution[p];return f.form==="deferred"?{id:s.id,selected_index:null,free_text:null}:f.free_text!=null?{id:s.id,selected_index:null,free_text:f.free_text}:{id:s.id,selected_index:f.selected_index,free_text:null}});t.pending=null,t.status=t.status==="pausing"?"pausing":"streaming";let o=M;M=null,o?.(n)},A=(e,n)=>{let o=t.pending,s=o.questions[e],p=o.resolution[e];o.resolution[e]=n;let f=Y(s);p?l({kind:"answer",receipt:{form:"changed",qNum:e+1,stub:f,choice:Q(s,n),prev:p.choice}}):n.form==="deferred"?l({kind:"answer",receipt:{form:"deferred",qNum:e+1,stub:f}}):l({kind:"answer",receipt:{form:n.form,qNum:e+1,stub:f,choice:Q(s,n)}})},O=()=>{let e=t.pending;e&&(e.questions.forEach((n,o)=>{e.resolution[o]||A(o,{form:"deferred",selected_index:null,free_text:null,choice:""})}),B())},G=e=>({questions:e,cursor:0,resolution:e.map(()=>null)}),Z=e=>{let n=t.pending;t.notice=void 0;let o=re(e,n);switch(o.kind){case"invalid":t.notice=o.message;return;case"defaults":{let s=!1;if(n.questions.forEach((p,f)=>{if(!n.resolution[f]){if(p.risk==="high"){s=!0;return}A(f,{form:"assumed",selected_index:p.recommended_index,free_text:null,choice:p.options[p.recommended_index]?.label??"?"})}}),s){n.cursor=n.questions.findIndex((p,f)=>!n.resolution[f]),t.notice="high-risk questions need an explicit answer (or type 'defer' to leave them with the agent)";return}break}case"defer-all":O();return;case"option":{let s=n.questions[o.target];A(o.target,{form:"answered",selected_index:o.index,free_text:null,choice:s.options[o.index]?.label??String(o.index+1)});break}case"free":A(o.target,{form:"answered",selected_index:null,free_text:o.text,choice:o.text});break;case"multi":{let s=n.questions[o.target],p=o.indices[0];A(o.target,{form:"answered",selected_index:p,free_text:null,choice:s.options[p]?.label??String(p+1)}),t.notice="multi-select not yet supported end-to-end \u2014 sent your first choice";break}}B()};return{state:t,explainRef(e){if(!i.explain||!i.graph||i.contextDir===void 0){l({kind:"note",text:"explain isn't available here"}),x();return}let n=i.explain(i.contextDir,i.graph,e),o=n.target?[`${n.target.label} ${n.target.slug??n.target.cid.slice(0,19)}:`,...n.entries.map(s=>` [${s.kind}] ${s.rationale??s.detail}`)].join(`
3
- `):`unknown ref: ${e}`;l({kind:"note",text:o}),x()},subscribe(e){return c.push(e),()=>{let n=c.indexOf(e);n>=0&&c.splice(n,1)}},submit(e){if(t.confirm&&(t.confirm=null),t.pending){Z(e),x();return}if(!r){t.turns.push({role:"user",text:e}),l({kind:"user",text:e}),t.notice="the agent isn't running \u2014 nothing sent",x();return}for(t.notice=void 0,t.turns.push({role:"user",text:e}),l({kind:"user",text:e}),C(e),t.status="streaming",t.error=void 0,m+=1;u.length>0;)m+=1,r({type:"user_message",message_id:`u${m}-receipt`,text:u.shift()});r({type:"user_message",message_id:`u${m}`,text:e}),x()},attachSender(e){r=e},attachOnCommitted(e){h=e},attachConversationSource(e){d=e},holdReceipt(e){u.push(e),l({kind:"note",text:e}),x()},drainHeldReceipts(){return u.splice(0,u.length)},note(e){l({kind:"note",text:e}),x()},registerAliases(e){for(let n of e)P.set(n.ref,n.cid)},setWorking(e){if(e!=null){if(t.status!=="idle"&&t.status!=="working")return;t.status="working",t.workingLabel=e}else{if(t.status!=="working")return;t.status="idle",t.workingLabel=void 0}x()},ledger(e){(e.kind==="pause"||e.kind==="error"||e.kind==="summary")&&I(),(e.kind==="summary"||e.kind==="pause")&&(t.stream=null),l(e),x()},completeSession(){O(),r?.({type:"session_complete"}),t.status="idle",x()},requestPause(){O(),t.status="pausing";let e=r;Promise.resolve().then(()=>e?.({type:"pause"})),x()},ask(e){return t.pending=G(e),j=new Map(e.map((n,o)=>[n.id,o+1])),t.status="awaiting-input",x(),new Promise(n=>{M=n})},noteCoercion(e,n){l({kind:"answer",receipt:{form:"assumed",qNum:j.get(e.id)??0,stub:Y(e),choice:n,note:"your typed answer couldn't be used here"}}),x()},onAgentEvent(e){switch(e.type){case"reasoning_delta":case"reasoning_done":case"tool_activity":case"decision_activity":{let n=t.thinking;if(t.thinking=K(n,e),t.thinking!==n){if(e.type==="reasoning_done"&&e.present)l({kind:"thinking",tookMs:e.took_ms});else if(e.type==="tool_activity"&&e.status!=="started")l({kind:"tool",name:e.name,status:e.status==="done"?"ok":e.status,detail:e.detail});else if(e.type==="decision_activity"){let o=`\xB7 ${J(e)}`,s=t.ledger[t.ledger.length-1];s&&s.kind==="note"&&s.text===o||l({kind:"note",text:o})}}if(e.type==="reasoning_delta"){N();return}break}case"usage":t.credits={turn:e.credits,total:e.total_credits},l({kind:"usage",credits:e.credits,total:e.total_credits});break;case"text_delta":{let n=E;if(n&&(e.turn_id<n.turn_id||e.turn_id===n.turn_id&&e.attempt<n.attempt))return;(!n||n.turn_id!==e.turn_id||n.attempt!==e.attempt)&&(E={turn_id:e.turn_id,attempt:e.attempt},t.stream={text:""}),t.stream={text:(t.stream?.text??"")+e.text},N();return}case"progress":break;case"proposal":{a+=1,I(),t.stream=null;let n=ie(e.proposal),o=i.dedupFlags?.(e.proposal);if(o)for(let s of n){let p=o.get(s.temp_ref);p&&(s.matches_existing=p)}t.turns.push({role:"agent",turnIndex:a,items:n,text:e.narrative}),e.narrative&&l({kind:"agent",text:e.narrative}),t.activeTurn={turnIndex:a,heading:"use-cases",items:n},l({kind:"turn",turnIndex:a,heading:"use-cases",items:n}),(t.status==="streaming"||t.status==="working")&&(t.status="idle"),t.workingLabel=void 0;break}case"design":{a+=1,I(),t.stream=null;let{items:n,heading:o}=se(e.design);l({kind:"banner",text:`phase: ${o}`}),t.turns.push({role:"agent",turnIndex:a,items:n,itemsHeading:o,text:e.narrative}),e.narrative&&l({kind:"agent",text:e.narrative}),t.activeTurn={turnIndex:a,heading:o,items:n},l({kind:"turn",turnIndex:a,heading:o,items:n}),(t.status==="streaming"||t.status==="working")&&(t.status="idle"),t.workingLabel=void 0;break}case"ask_user":t.pending=G(e.questions),t.status="awaiting-input";break;case"chat_ops":{a+=1,I(),t.stream=null,t.status==="streaming"&&(t.status="idle");let n=e.chat_ops??e,o=Array.isArray(n.ops)?n.ops:[],s=n.text??e.text??"",p=i.refreshGraph?.()??i.graph,f=g=>P.get(g)??g,v=o.map(g=>{if(!g.target)return g;let b=f(g.target),w=g.expected_cid;if(w==null&&p){let U=p.resolve(b);U&&(w=p.tipOf(U.cid))}let q=g.payload?.redirect_to,S=q&&f(q);return b===g.target&&w===g.expected_cid&&S===q?g:{...g,target:b,expected_cid:w,...S!==q?{payload:{...g.payload,redirect_to:S}}:{}}}),T;try{if(!Array.isArray(n.ops))throw new Error("the agent sent an unreadable change set (no ops array) \u2014 say it again in different words");T=X(v,i.descriptor??{mint_gate:[]},{turn:a,...d?{convSourceId:d}:{}})}catch(g){t.error=g instanceof Error?g.message:String(g),t.turns.push({role:"agent",turnIndex:a,text:s,narration:t.error}),s&&l({kind:"agent",text:s}),l({kind:"error",title:t.error,detail:[]});break}let{chatOps:$,ambiguous:D}=T;if(D.length>0){let g=D[0];t.confirm={kind:"ambiguity-confirm",prompt:`did you mean edit or ${g.kinds.filter(b=>b!=="edit").join("/")} on ${g.target}?`},t.turns.push({role:"agent",turnIndex:a,text:s}),s&&l({kind:"agent",text:s});break}if(s&&l({kind:"agent",text:s}),y($),i.commitChatTurn&&$.length>0){let g=i.commitChatTurn({contextDir:i.contextDir??"",graph:i.refreshGraph?.()??i.graph,ops:$,by:i.by??{kind:"human",id:"owner"},...i.descriptor?.mint_gate?{mintable:i.descriptor.mint_gate}:{}});if(g.errors)t.error=g.errors.map(b=>b.detail).join("; "),t.turns.push({role:"agent",turnIndex:a,text:s}),l({kind:"commit",ok:!1,line:"commit failed \u2014 nothing landed",warnings:g.errors.map(b=>`${b.code}: ${b.detail}`)});else{g.applied.length>0&&i.session?.markApplied(g.applied);let b=k(g);t.turns.push({role:"agent",turnIndex:a,text:s,narration:b}),l({kind:"commit",ok:!0,line:`committed: ${b}`});let w=i.refreshGraph?.();if(w&&h&&h(w),w)try{_+=1;let W=i.descriptor?.mint_gate?.includes("usecase")?"extract":"design",q=H({verb:W,commitN:_,phase:"chat",committed:g.minted.map(S=>({cid:S.cid,...S.slug?{logical_id:S.slug}:{}}))},w);u.push(q.text),l({kind:"note",text:q.text})}catch{}}}else t.turns.push({role:"agent",turnIndex:a,text:s});C(s);break}case"done":case"session_complete":I(),t.status="idle",r=null;break;case"error":I(),t.stream=null,t.status="idle",t.error=e.message,r=null,l({kind:"error",title:e.message,detail:[]});break;case"session_paused":break;default:break}x()}}}export{ge as makeChatController,re as parseAnswerInput,Y as questionStub};
@@ -1,4 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- var u={prod:"https://kaneai-api.lambdatest.com/v16-controller/v1",stage:"https://auteur-stage-automind.lambdatestinternal.com/v16-controller/v1"};function T(e=process.env){return e.TESTMUAI_BASE_URL||u[e.TESTMUAI_ENV==="stage"?"stage":"prod"]}function E(e=process.env){return e.TESTMUAI_BASE_URL&&e.TESTMUAI_ENV!=="stage"?"note: TESTMUAI_BASE_URL is honored by context/design, but run/testmd ignore it unless TESTMUAI_ENV=stage":null}async function g(e,t=process.env,c=fetch){let o=T(t),a=`${o}/assurance/turn`,n={"Content-Type":"application/json"},i=e.TESTMUAI_BASIC_AUTH??t.TESTMUAI_BASIC_AUTH,l=e.TESTMUAI_API_KEY??t.TESTMUAI_API_KEY;i?n.Authorization=`Basic ${i}`:l&&(n.Authorization=`Bearer ${l}`);let s;try{s=(await c(a,{method:"POST",headers:n,body:"{}",signal:AbortSignal.timeout(8e3)})).status}catch(r){return{ok:!1,message:`error: cannot reach the controller at ${o} (${r instanceof Error?r.message:String(r)})
3
- hint: for a local run, start the controller and export TESTMUAI_BASE_URL=http://localhost:8000/v1`}}return s===404?{ok:!1,message:`error: ${a} does not exist (404) \u2014 this controller does not serve the turn endpoint yet
4
- hint: the endpoint is currently local-only. Run a local controller and export TESTMUAI_BASE_URL=http://localhost:8000/v1`}:s===401?{ok:!1,message:`error: the controller at ${o} rejected your credentials (401) \u2014 check your login/profile for TESTMUAI_ENV=${t.TESTMUAI_ENV??"prod"}`}:{ok:!0}}export{T as a,E as b,g as c};
@@ -1,2 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{b as K}from"./chunk-QPZRHAYK.js";import{a as L,b,d as B}from"./chunk-GIRXJOJI.js";import{e as W,g as A}from"./chunk-B2PZAB7J.js";import{d as O,e as R,f as P,g as j,h as q}from"./chunk-IACKIGPX.js";var V=/^[a-z0-9][a-z0-9-]{1,63}$/;function z(p,d,e,t){if(!d)return{error:{code:"SUPERSEDE_TARGET_MISSING",detail:"supersede verdict needs a target (slug or cid)"}};let n=p.resolve(d);return n?n.superseded||t.has(n.cid)?{error:{code:"ALREADY_SUPERSEDED",detail:`${d} is already superseded (tip: ${n.tip})`}}:n.cid===e?{error:{code:"SELF_SUPERSEDE",detail:"a node cannot supersede itself"}}:{targetCid:n.cid}:{error:{code:"UNKNOWN_SUPERSEDE_TARGET",detail:`${d} names nothing in the graph`}}}function X(p,d,e,t,n=[]){if(!j(d)?.acyclic)return null;if(e===t)return{code:"EDGE_CYCLE",detail:`${d} ${e} \u2192 itself`};let i=_=>[...p.edgesFrom(_).filter(h=>h.type===d).map(h=>h.dst),...n.filter(h=>h.type===d&&h.src===_).map(h=>h.dst)],a=new Set,g=[t];for(;g.length>0;){let _=g.pop();if(_===e)return{code:"EDGE_CYCLE",detail:`${d} ${e} \u2192 ${t} closes a cycle`};a.has(_)||(a.add(_),g.push(...i(_)))}return null}function de(p,d,e,t){let m=j(d)?.cardinality;if(m!=="one-live-per-src"&&m!=="one-live-per-src-and-dst")return null;let i=p.edgesFrom(e).filter(a=>a.type===d&&!p.superseded.has(a.dst));if(i.length>0)return{code:"CARDINALITY_VIOLATION",detail:`${d} from ${e} already has a live edge (${i[0].ecid}) \u2014 supersede it first`};if(m==="one-live-per-src-and-dst"&&t!==void 0){let a=p.edgesInto(t).filter(g=>g.type===d&&!p.superseded.has(g.src));if(a.length>0)return{code:"CARDINALITY_VIOLATION",detail:`${d} onto ${t} already has a live edge (${a[0].ecid}) \u2014 strict 1:1, supersede it first`}}return null}var Y=new Set(["high","med","low"]);function ce(p,d,e){let t=[],n=e.mediaOf(p.source.source_cid),m=new Set;for(let i of p.use_cases){if(m.has(i.temp_ref)&&t.push({code:"DUP_TEMP_REF",detail:`duplicate temp_ref ${i.temp_ref}`}),m.add(i.temp_ref),(!i.title||!i.title.trim())&&t.push({code:"EMPTY_TITLE",detail:`${i.temp_ref}: title is empty`}),Y.has(i.risk)||t.push({code:"BAD_RISK",detail:`${i.temp_ref}: risk ${JSON.stringify(i.risk)} not in high|med|low`}),!i.cite||!i.cite.anchor)t.push({code:"MISSING_CITE",detail:`${i.temp_ref}: every derived use-case must carry a cite`});else for(let a of K(n,i.cite,d))t.push({code:a.code,detail:`${i.temp_ref}: ${a.detail}`});i.matches_existing&&!e.hasNode(i.matches_existing.cid)&&t.push({code:"UNKNOWN_MATCH",detail:`${i.temp_ref}: matches_existing ${i.matches_existing.cid} is not in the graph`});for(let[a,g]of(i.criteria??[]).entries())if((!g.text||!g.text.trim())&&t.push({code:"EMPTY_CRITERION",detail:`${i.temp_ref}.criteria[${a}]: text is empty`}),!g.cite||!g.cite.anchor)t.push({code:"MISSING_CITE",detail:`${i.temp_ref}.criteria[${a}]: every criterion carries its own cite (D3)`});else for(let _ of K(n,g.cite,d))t.push({code:_.code,detail:`${i.temp_ref}.criteria[${a}]: ${_.detail}`})}return t}function ae(p){let{contextDir:d,graph:e,proposal:t,proposalId:n,verdicts:m,by:i,allowStaleBasis:a,extractorVersion:g,autoName:_}=p,h=W(d);if(!a&&t.read_basis!==h)return{record:null,errors:[{code:"STALE_BASIS",detail:`proposal read_basis ${String(t.read_basis)} != latest ${String(h)}`}]};if(!e.hasNode(t.source.source_cid))return{record:null,errors:[{code:"MISSING_SOURCE_NODE",detail:`source ${t.source.source_id} (${t.source.source_cid}) is not a committed node \u2014 ingest it first`}]};let l=[],f=e.mediaOf(t.source.source_cid),k=new Set,v=[],E=[],C=[],I=[],w=[],x=[],U=new Set,H=new Set,F=(r,s,T)=>{let c=z(e,s.supersedeTarget,T,U);if("error"in c){l.push({code:c.error.code,detail:`${r}: ${c.error.detail}`});return}U.add(c.targetCid),w.push({kind:"node",old:c.targetCid,new:T,reason:s.reason??`superseded via review by ${i.id}`,by:i})};for(let r of t.use_cases){let s=m.get(r.temp_ref)??{resolution:"skipped"};if(k.has(r.temp_ref)&&l.push({code:"DUP_TEMP_REF",detail:`duplicate temp_ref ${r.temp_ref}`}),k.add(r.temp_ref),(!r.title||!r.title.trim())&&l.push({code:"EMPTY_TITLE",detail:`${r.temp_ref}: title is empty`}),Y.has(r.risk)||l.push({code:"BAD_RISK",detail:`${r.temp_ref}: risk ${JSON.stringify(r.risk)} not in high|med|low`}),f.format==="image"){if(r.cite?.anchor!=="img#whole"){l.push({code:r.cite?.anchor?"CITE_ANCHOR_INVALID":"MISSING_CITE",detail:`${r.temp_ref}: image cites are anchor-only (img#whole)`});continue}}else if(!r.cite||!r.cite.anchor||!r.cite.quote){l.push({code:"MISSING_CITE",detail:`${r.temp_ref}: every derived use-case must cite anchor+quote`});continue}s.resolution==="edited"&&s.edit&&(s.edit.title!==void 0&&!s.edit.title.trim()&&l.push({code:"EMPTY_TITLE",detail:`${r.temp_ref}: edited title is empty`}),s.edit.risk!==void 0&&!Y.has(s.edit.risk)&&l.push({code:"BAD_RISK",detail:`${r.temp_ref}: edited risk ${JSON.stringify(s.edit.risk)} invalid`}));let T=B({title:s.edit?.title??r.title,description:r.description,summary:s.edit?.summary??r.summary,actors:r.actors,value:r.value,risk:s.edit?.risk??r.risk,...r.criteria&&r.criteria.length>0?{criteria:r.criteria.map(o=>o.text)}:{}}),c=L("usecase",T),$={source_id:t.source.source_id,source_cid:t.source.source_cid,anchor:r.cite.anchor,...r.cite.quote?{quote:r.cite.quote}:{}};if(r.matches_existing&&!e.hasNode(r.matches_existing.cid)){l.push({code:"UNKNOWN_MATCH",detail:`${r.temp_ref}: matches_existing ${r.matches_existing.cid} is not in the graph`});continue}let N=r.matches_existing?.cid??(e.hasNode(c)?c:null);if(N&&e.superseded.has(N)){let o=e.tipOf(N);N=e.superseded.has(o)?null:o}if(N){if(r.changed&&(s.resolution==="approved"||s.resolution==="edited")){let o=r.updated;if(!o||Object.keys(o).length===0){l.push({code:"CHANGED_NEEDS_PAYLOAD",detail:`${r.temp_ref}: changed:true needs an updated{...} payload naming the moved fields`});continue}let u=e.getNode(N)?.content??{},S=B({title:s.edit?.title??o.title??String(u.title??r.title),...o.description??u.description?{description:o.description??u.description}:{},...s.edit?.summary??o.summary??u.summary?{summary:s.edit?.summary??o.summary??u.summary}:{},...o.actors??u.actors?{actors:o.actors??u.actors}:{},...o.value??u.value?{value:o.value??u.value}:{},risk:s.edit?.risk??o.risk??String(u.risk??r.risk),...o.criteria??u.criteria?{criteria:o.criteria??u.criteria}:{}}),y=L("usecase",S);if(y!==N){for(let M of P("usecase",S))l.push({code:M.code,detail:`${r.temp_ref}: ${M.detail}`});v.push({cid:y,label:O.USECASE,content:S}),E.push({ecid:b("DERIVES",$.source_cid,y,$),type:R.DERIVES,src:$.source_cid,dst:y,props:$}),F(r.temp_ref,{resolution:"supersede",supersedeTarget:N,reason:s.reason??`matches-but-changed: ${t.source.source_id} moved (${Object.keys(o).join(", ")})`},y),I.push({id:y,kind:"review-item",resolution:s.resolution,edit:s.resolution==="edited"?{...s.edit}:null,reason:null,by:i});continue}}s.resolution!=="rejected"&&(E.push({ecid:b("DERIVES",$.source_cid,N,$),type:R.DERIVES,src:$.source_cid,dst:N,props:$}),(s.resolution==="approved"||s.resolution==="edited"||s.resolution==="supersede")&&I.push({id:N,kind:"review-item",resolution:"approved",edit:null,reason:null,by:i}),s.resolution==="supersede"&&F(r.temp_ref,s,N));continue}for(let o of P("usecase",T))l.push({code:o.code,detail:`${r.temp_ref}: ${o.detail}`});for(let o of q(R.DERIVES,"source","usecase",$))l.push({code:o.code,detail:`${r.temp_ref}: ${o.detail}`});v.push({cid:c,label:O.USECASE,content:T}),E.push({ecid:b("DERIVES",$.source_cid,c,$),type:R.DERIVES,src:$.source_cid,dst:c,props:$});for(let o of r.criteria??[]){let u={source_id:t.source.source_id,source_cid:t.source.source_cid,anchor:o.cite.anchor,...o.cite.quote?{quote:o.cite.quote}:{}};u.anchor!==$.anchor&&E.push({ecid:b("DERIVES",u.source_cid,c,u),type:R.DERIVES,src:u.source_cid,dst:c,props:u})}for(let o of r.depends_on_hint??[]){let u=D=>D.toLowerCase().trim().replace(/\s+/g," "),S=null,y=e.resolve(o);if(y&&!y.superseded&&e.nodeLabel.get(y.cid)===O.USECASE&&(S=y.cid),!S){for(let{cid:D,content:G}of e.byLabel(O.USECASE))if(!e.superseded.has(D)&&u(String(G.title??""))===u(o)){S=D;break}}if(!S){let D=v.find(G=>G.label===O.USECASE&&u(String(G.content.title??""))===u(o));D&&(S=D.cid)}!S||S===c||X(e,R.DEPENDS_ON,c,S,C)||C.some(D=>D.src===c&&D.dst===S)||(E.push({ecid:b(R.DEPENDS_ON,c,S,{reason:"extract hint"}),type:R.DEPENDS_ON,src:c,dst:S,props:{reason:"extract hint"}}),C.push({src:c,dst:S,type:R.DEPENDS_ON}))}if((s.resolution==="approved"||s.resolution==="edited"||s.resolution==="supersede")&&e.superseded.get(c)===null&&!U.has(c)&&w.push({kind:"node",old:c,new:c,reason:`re-minted after tombstone via review by ${i.id}`,by:i}),_){let o=J("usecase",s.edit?.title??r.title,u=>H.has(u)||e.names.has(u)&&!e.superseded.has(e.names.get(u)));o!==null&&!e.nameOf.has(c)&&(H.add(o),x.push({cid:c,slug:o,by:i}))}s.resolution==="approved"?I.push({id:c,kind:"review-item",resolution:"approved",edit:null,reason:null,by:i}):s.resolution==="edited"?I.push({id:c,kind:"review-item",resolution:"edited",edit:{...s.edit},reason:null,by:i}):s.resolution==="rejected"?I.push({id:c,kind:"review-item",resolution:"rejected",edit:null,reason:s.reason??null,by:i}):s.resolution==="supersede"&&(I.push({id:c,kind:"review-item",resolution:"approved",edit:null,reason:s.reason??null,by:i}),F(r.temp_ref,s,c))}return l.length?{record:null,errors:l}:{record:A(d,{ts:new Date().toISOString(),proposal_id:n,...n!=null?{extraction_of:t.source.source_cid}:{},...n!=null&&g?{extractor_version:g}:{},nodes:v,edges:E,review:I,supersessions:w,...x.length>0?{names:x}:{},...p.judgements&&p.judgements.length>0?{judgements:p.judgements}:{},source_head_moves:{}},{expectPrev:h}).record,errors:null}}function le(p){let{contextDir:d,graph:e,verdicts:t,by:n}=p,m=[],i=[],a=[],g=[],_=new Set;for(let[l,f]of t){if(f.resolution==="skipped")continue;let k=e.resolve(l);if(!k){m.push({code:"UNKNOWN_NODE",detail:`${l} names nothing in the graph`});continue}if(k.superseded){m.push({code:"SUPERSEDED_TARGET",detail:`${l} is superseded \u2014 review the tip (${k.tip})`});continue}let v=k.cid;if(f.resolution==="approved")a.push({id:v,kind:"review-item",resolution:"approved",edit:null,reason:null,by:n});else if(f.resolution==="rejected")a.push({id:v,kind:"review-item",resolution:"rejected",edit:null,reason:f.reason??null,by:n});else if(f.resolution==="edited"){let E=e.getNode(v);if(!E){m.push({code:"UNKNOWN_NODE",detail:`${l}: node file unreadable`});continue}let C={...E.content,...f.edit?.title!==void 0?{title:f.edit.title}:{},...f.edit?.summary!==void 0?{summary:f.edit.summary}:{},...f.edit?.risk!==void 0?{risk:f.edit.risk}:{}},I=P(E.label,C);if(I.length>0){for(let x of I)m.push({code:x.code,detail:`${l}: ${x.detail}`});continue}let w=L(E.label,C);if(w===v){a.push({id:v,kind:"review-item",resolution:"approved",edit:null,reason:null,by:n});continue}i.push({cid:w,label:E.label,content:C}),_.add(v),g.push({kind:"node",old:v,new:w,reason:f.reason??"edited in review",by:n}),a.push({id:w,kind:"review-item",resolution:"edited",edit:{...f.edit},reason:null,by:n})}else if(f.resolution==="supersede"){let E=z(e,f.supersedeTarget,v,_);if("error"in E){m.push({code:E.error.code,detail:`${l}: ${E.error.detail}`});continue}_.add(E.targetCid),g.push({kind:"node",old:E.targetCid,new:v,reason:f.reason??`superseded via review by ${n.id}`,by:n}),a.push({id:v,kind:"review-item",resolution:"approved",edit:null,reason:f.reason??null,by:n})}}return m.length?{record:null,errors:m}:a.length===0&&g.length===0?{record:null,errors:[{code:"NO_VERDICTS",detail:"every item was skipped \u2014 nothing to commit"}]}:{record:A(d,{ts:new Date().toISOString(),proposal_id:null,nodes:i,edges:[],review:a,supersessions:g,source_head_moves:{}},{expectPrev:e.latestHash}).record,errors:null}}function ue(p){let{contextDir:d,graph:e,assignments:t,by:n}=p,m=[],i=[],a=new Set;for(let{ref:_,slug:h}of t){if(!V.test(h)){m.push({code:"BAD_SLUG",detail:`${JSON.stringify(h)} \u2014 slugs are kebab-case ${String(V)}`});continue}let l=e.resolve(_);if(!l){m.push({code:"UNKNOWN_REF",detail:`${_} names nothing in the graph`});continue}if(l.superseded){m.push({code:"SUPERSEDED_TARGET",detail:`${_} is superseded \u2014 name the tip instead (${l.tip})`});continue}let f=e.names.get(h);if(f!==void 0&&!e.superseded.has(f)&&f!==l.cid||a.has(h)){m.push({code:"SLUG_TAKEN",detail:`${h} already names ${f??"another node in this record"}`});continue}a.add(h),i.push({cid:l.cid,slug:h,by:n})}return m.length?{record:null,errors:m}:i.length===0?{record:null,errors:[{code:"NO_ASSIGNMENTS",detail:"nothing to name"}]}:{record:A(d,{ts:new Date().toISOString(),proposal_id:null,nodes:[],edges:[],review:[],supersessions:[],names:i,source_head_moves:{}},{expectPrev:e.latestHash}).record,errors:null}}function pe(p){let{contextDir:d,graph:e,sourceId:t,reason:n,by:m}=p,i=e.heads.get(t);return i===void 0?{record:null,errors:[{code:"UNKNOWN_SOURCE",detail:`no source ${t} in the graph`}]}:i===null?{record:null,errors:[{code:"ALREADY_RETIRED",detail:`source ${t} is already retired`}]}:{record:A(d,{ts:new Date().toISOString(),proposal_id:null,nodes:[],edges:[],review:[],supersessions:[{kind:"node",old:i,new:null,reason:n??`retired source ${t}`,by:m}],source_head_moves:{[t]:null},names:[]},{expectPrev:e.latestHash}).record,errors:null}}function Q(p,d){let e=p.toLowerCase().trim().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"");if(e.length>60){let n=e.lastIndexOf("-",60);e=(n>0?e.slice(0,n):e.slice(0,60)).replace(/-+$/g,"")}if(!V.test(e))return null;let t=e;for(let n=2;d(t);n++)t=`${e}-${n}`;return V.test(t)?t:null}var Z={source:"src",usecase:"uc",scenario:"sc",ac:"ac",test:"t",gap:"gap",stylenote:"sty"};function J(p,d,e){let t=Z[p];return Q(t?`${t} ${d}`:d,e)}export{Z as a,J as b,X as c,de as d,ce as e,ae as f,le as g,ue as h,pe as i};
@@ -1,3 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{b as u}from"./chunk-6PS65QFF.js";function g(t,e){return t.byLabel(e).filter(({cid:n})=>!t.superseded.has(n)&&t.trust.get(n)!=="archived")}function f(t,e,n){for(let[a,c]of t.names)if(c===e&&!t.superseded.has(c))return a;return String(n.title??n.text??e)}function v(t,e){let n=g(t,"scenario");if(e){let i=t.resolve(e);if(i){let s=new Set([i.cid,i.tip,t.tipOf(i.cid)]);n=n.filter(({cid:o})=>t.edgesFrom(o).some(d=>d.type==="belongs_to"&&(s.has(d.dst)||s.has(t.tipOf(d.dst)))))}}let a=new Set;for(let{cid:i}of n)a.add(i),a.add(t.tipOf(i));let c=g(t,"test").filter(({cid:i})=>!e||t.edgesFrom(i).some(s=>s.type==="automates"&&(a.has(s.dst)||a.has(t.tipOf(s.dst))))),r=new Set;for(let i of c)for(let s of t.edgesFrom(i.cid))s.type==="automates"&&r.add(t.tipOf(s.dst));let m=n.filter(({cid:i})=>!r.has(i)&&!r.has(t.tipOf(i))).map(({cid:i,content:s})=>f(t,i,s));return{live_scenarios:n.length,live_tests:c.length,missing:m}}function l(t){return t.length<=12?t.join(", "):`${t.slice(0,12).join(", ")} +${t.length-12} more`}function b(t,e){let n=t.committed.length===0?"committed: nothing new":`committed: ${l(t.committed.map(o=>o.temp_ref?`${o.temp_ref} \u2192 ${o.logical_id??o.cid}`:o.logical_id??o.cid))}`,a=[];t.reused&&a.push(`reused: ${t.reused}`),t.rejected?.length&&a.push(`rejected: ${l(t.rejected.map(o=>`${o.ref} (${o.reason})`))}`),t.warnings?.length&&a.push(`warnings: ${l(t.warnings)}`);let c=[`RECEIPT (commit ${t.commitN}, ${t.phase})`,n,...a],r,m;if(t.verb==="design")r=v(e,t.ucRef),c.push(`parity: ${r.live_scenarios} scenario(s) live \xB7 ${r.live_tests} test(s) live`+(r.missing.length?` \xB7 missing tests: ${l(r.missing)}`:"")),m=r.missing.length>0?`next: emit tests for the ${r.missing.length} scenario(s) listed \u2014 1:1, strict. Never re-emit committed items; reference them by the ids above.`:"next: every live scenario has a test. Address open gaps, or finish.";else{let o=g(e,"usecase").length;c.push(`parity: ${o} use-case(s) live`),m="next: refine via chat ops using the ids above. Never re-emit committed items."}c.push(m);let i=c.join(`
3
- `);for(;Buffer.byteLength(i,"utf8")>6e3;)i=i.slice(0,Math.floor(i.length*.9))+"\u2026";let s={type:"receipt",verb:t.verb,commit_n:t.commitN,phase:t.phase,committed:t.committed,reused:t.reused??0,rejected:t.rejected??[],warnings:t.warnings??[],...r?{parity:{live_scenarios:r.live_scenarios,live_tests:r.live_tests,missing:r.missing}}:{},next:m};return{text:i,event:s}}function A(){return{currentAttempt:null,liveThinking:"",thinkingLog:[],activity:[]}}var p={dedup_candidate:"checking a possible duplicate",ambiguity:"asking to resolve an ambiguity",validation_repair:"repairing a validation failure",finalize:"finalizing the proposal"};function h(t){return p[t.reason_code]??t.reason_code.replace(/_/g," ")}function y(t){let e=u({name:t.name});return t.status==="started"?`\u2192 ${e}\u2026`:t.status==="error"||t.status==="aborted"?`\u2717 ${e}`:`\u2713 ${e}`}function _(t,e){return e.turn_id!==t.turn_id?e.turn_id<t.turn_id:e.attempt<t.attempt}function x(t,e){let n=t.currentAttempt;if(n===null||n.turn_id!==e.turn_id||n.attempt!==e.attempt){if(n!==null&&_(n,e))return t;t={...t,currentAttempt:{turn_id:e.turn_id,attempt:e.attempt},liveThinking:""}}switch(e.type){case"reasoning_delta":return{...t,liveThinking:t.liveThinking+e.text};case"reasoning_done":return e.present?{...t,thinkingLog:[...t.thinkingLog,{text:t.liveThinking,tookMs:e.took_ms}],liveThinking:""}:{...t,liveThinking:""};case"tool_activity":return{...t,activity:[...t.activity,{name:e.name,status:e.status,label:y(e)}]};case"decision_activity":return{...t,activity:[...t.activity,{name:e.action,status:"decision",label:h(e)}]}}}export{b as a,A as b,h as c,x as d};
@@ -1,2 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{existsSync as c}from"fs";import{dirname as m,resolve as i}from"path";import{fileURLToPath as d}from"url";var g=m(d(import.meta.url));function f(){return[i(g,".."),i(g,"../../..")]}function p(r){return{"darwin-arm64":"kane-cli-darwin-arm64","darwin-x64":"kane-cli-darwin-x64","linux-x64":"kane-cli-linux-x64","linux-arm64":"kane-cli-linux-arm64","win32-x64":"kane-cli-win-x64"}[r]??null}function S(){let r=p(`${process.platform}-${process.arch}`),n=process.platform==="win32"?"assurance-agent.exe":"assurance-agent";for(let e of f()){for(let t of r?["@testmuai","@lambdatestincprivate"]:[]){let a=i(e,"node_modules",t,r,"bin",n);if(c(a))return{cmd:a,args:[]}}let s=i(e,"../assurance-agent/dist",n);if(c(s))return{cmd:s,args:[]};let o=i(e,"../assurance-agent/main.py");if(c(o)){let t=i(e,"../assurance-agent/.venv/bin/python");return{cmd:c(t)?t:"python3",args:[o]}}}return null}function T(r,n={}){return{...process.env,...n,TESTMUAI_SOURCE:"kane-cli",TESTMUAI_SESSION_ID:r,ASSURANCE_LOG_LEVEL:process.env.ASSURANCE_LOG_LEVEL??"info"}}async function v(){if(process.env.TESTMUAI_API_KEY||process.env.TESTMUAI_BASIC_AUTH)return{};try{let{CredentialsManager:r}=await import("./credentials-L63BBW2S.js"),n=process.env.TESTMUAI_ENV==="stage"?"stage":"prod",e=new r,s=e.getActiveProfile()??"default",o={TESTMUAI_ENV:n},t=e.loadBasicAuth(s,n);if(t)return o.TESTMUAI_BASIC_AUTH=Buffer.from(`${t.username}:${t.access_key}`,"utf8").toString("base64"),o;let a=e.loadCredentials(s,n);if(a){try{let{refreshOAuthToken:l}=await import("./token-refresh-OGBTJGZ2.js");await l({creds:e,profile:s,env:n,credentials:a})}catch{}let u=e.loadCredentials(s,n)??a;if(typeof u.access_token=="string")return o.TESTMUAI_API_KEY=u.access_token,o}return{}}catch{return{}}}export{p as a,S as b,T as c,v as d};