@testmuai/kane-cli 0.8.2 → 0.8.4

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 (188) hide show
  1. package/bin/kane-cli.cjs +1 -1
  2. package/bin/resolve-runtime.cjs +8 -0
  3. package/dist/{ChatSurface-B3ULYDYC.js → ChatSurface-H26E7DM6.js} +1 -1
  4. package/dist/{ChromeProfilePicker-T77E7ZSC.js → ChromeProfilePicker-USUPENU2.js} +1 -1
  5. package/dist/{CliFeedbackPrompt-FQ2XV5DZ.js → CliFeedbackPrompt-ZIAZ2M2U.js} +1 -1
  6. package/dist/{CliUploadProgress-TZ55LONO.js → CliUploadProgress-LEOJTXHT.js} +1 -1
  7. package/dist/{ConfigView-WWQMH36G.js → ConfigView-JBIQPG7O.js} +1 -1
  8. package/dist/EvidenceViewOffer-IWQ6Q2CI.js +2 -0
  9. package/dist/FolderPicker-G4DT3OEZ.js +2 -0
  10. package/dist/{HelpView-XXPCPJNF.js → HelpView-I27LWSL5.js} +1 -1
  11. package/dist/{InfoBox-SHBRHQX5.js → InfoBox-ORHNXPET.js} +1 -1
  12. package/dist/{LinksBox-ENNF7TDJ.js → LinksBox-6SKDUB5T.js} +1 -1
  13. package/dist/{ProfilesView-CNF2FXF3.js → ProfilesView-Y5GTLDJY.js} +1 -1
  14. package/dist/{ProjectPicker-PVPLS642.js → ProjectPicker-WDCMKWNQ.js} +1 -1
  15. package/dist/{SaveSessionPrompt-4QP4GNGO.js → SaveSessionPrompt-I4KLFESC.js} +1 -1
  16. package/dist/SingleShotApp-Y77CNTSO.js +2 -0
  17. package/dist/{SummaryBox-HYNINDNN.js → SummaryBox-QWKW5FHK.js} +1 -1
  18. package/dist/TestMdRunView-PPM6LD3I.js +2 -0
  19. package/dist/TestrunEvidenceTable-ENJJ2GIW.js +2 -0
  20. package/dist/{WhoamiView-NN2HOK6H.js → WhoamiView-H6M536AY.js} +1 -1
  21. package/dist/{app-download-5UJMXPF3.js → app-download-PSRQWDVW.js} +1 -1
  22. package/dist/{auth-QKBTOWQX.js → auth-JVH2EHK2.js} +1 -1
  23. package/dist/binary-YTQJP2FG.js +2 -0
  24. package/dist/{bind-LVGP5KHO.js → bind-OUXCFLSE.js} +2 -2
  25. package/dist/{bootstrap-RUJBMB2P.js → bootstrap-3NEI7O6I.js} +1 -1
  26. package/dist/bridge-AFQTFWCU.js +2 -0
  27. package/dist/{changelog-HBPBPR2O.js → changelog-WDKG4WCV.js} +1 -1
  28. package/dist/chunk-2HT3RYKJ.js +2 -0
  29. package/dist/chunk-2PH43Z3P.js +69 -0
  30. package/dist/{chunk-NXFAEDHV.js → chunk-35L2QXWP.js} +2 -2
  31. package/dist/{chunk-JEDLXUO5.js → chunk-3JLWPEQW.js} +1 -1
  32. package/dist/{chunk-ZI6UIJUN.js → chunk-4CHO7SAT.js} +1 -1
  33. package/dist/{chunk-NHBYZCSX.js → chunk-52GWEKFD.js} +1 -1
  34. package/dist/chunk-55NSNWM5.js +26 -0
  35. package/dist/{chunk-CJJXT5DO.js → chunk-5GUD3CIH.js} +1 -1
  36. package/dist/{chunk-UODLRQQ4.js → chunk-5HYXTFGB.js} +1 -1
  37. package/dist/{chunk-AN2ZPHCE.js → chunk-62WYSEAT.js} +1 -1
  38. package/dist/{chunk-AJQT4IWZ.js → chunk-66RJPH73.js} +1 -1
  39. package/dist/chunk-6CR2HTIM.js +7 -0
  40. package/dist/{chunk-WOEQDUJ6.js → chunk-7HPEHQHH.js} +1 -1
  41. package/dist/chunk-7HXZZ3VA.js +19 -0
  42. package/dist/{chunk-LDCLZR2U.js → chunk-7LP4X25A.js} +1 -1
  43. package/dist/{chunk-U5GHOGLM.js → chunk-7VTYRTEJ.js} +1 -1
  44. package/dist/{chunk-J7KT44IC.js → chunk-A3PGLDQY.js} +1 -1
  45. package/dist/{chunk-R4UCBA5R.js → chunk-A4XJUWAQ.js} +1 -1
  46. package/dist/{chunk-O3AHFP3K.js → chunk-A6TJUSOS.js} +1 -1
  47. package/dist/{chunk-5SNT2MK5.js → chunk-BCCWICSS.js} +1 -1
  48. package/dist/{chunk-HRZOFTV7.js → chunk-BDUCWZYO.js} +1 -1
  49. package/dist/{chunk-LVCY5IYI.js → chunk-BGMI5PH4.js} +1 -1
  50. package/dist/chunk-BSCMUMSV.js +10 -0
  51. package/dist/{chunk-MTIC65NK.js → chunk-BWSL2KQQ.js} +1 -1
  52. package/dist/{chunk-GUVM6SZF.js → chunk-BXRZGISN.js} +1 -1
  53. package/dist/{chunk-VK3NU742.js → chunk-DEZ7CXGM.js} +1 -1
  54. package/dist/{chunk-HFFPPCZO.js → chunk-DWWAIXVZ.js} +2 -2
  55. package/dist/{chunk-6N726QLP.js → chunk-DXJKMZEC.js} +29 -23
  56. package/dist/{chunk-NRUD56FY.js → chunk-DYGUHGZ6.js} +1 -1
  57. package/dist/{chunk-4U4OSOA4.js → chunk-DZJQNL66.js} +1 -1
  58. package/dist/{chunk-RUCSRS4C.js → chunk-EQSE6NIB.js} +1 -1
  59. package/dist/{chunk-OJTCIZDK.js → chunk-GJED4QGF.js} +1 -1
  60. package/dist/chunk-GSYJUHRK.js +2 -0
  61. package/dist/{chunk-BKVDAZEJ.js → chunk-HHHNQW5Z.js} +1 -1
  62. package/dist/{chunk-YSSYT5F5.js → chunk-HXSEA7JS.js} +1 -1
  63. package/dist/chunk-IXTFWIQ6.js +2 -0
  64. package/dist/{chunk-7S3JZ6FQ.js → chunk-J27JJWMT.js} +1 -1
  65. package/dist/{chunk-IUEEFGEW.js → chunk-JCILRPOM.js} +2 -2
  66. package/dist/chunk-JR46A564.js +2 -0
  67. package/dist/{chunk-JHKM7W5X.js → chunk-JRADU3PO.js} +1 -1
  68. package/dist/{chunk-LVN6VHFN.js → chunk-JT7I6OST.js} +1 -1
  69. package/dist/{chunk-2TYCUPCN.js → chunk-KAMJ7U4M.js} +1 -1
  70. package/dist/{chunk-BSYX225I.js → chunk-KUYJ6FEN.js} +1 -1
  71. package/dist/{chunk-3NHO5R4P.js → chunk-L4EDLDLZ.js} +3 -3
  72. package/dist/{chunk-JJN76EXE.js → chunk-L77ZOU4N.js} +1 -1
  73. package/dist/{chunk-YCLG3T5E.js → chunk-N5JHMCRU.js} +1 -1
  74. package/dist/{chunk-ATGRRKEV.js → chunk-N7N222VC.js} +2 -2
  75. package/dist/chunk-NDAAY2RL.js +2 -0
  76. package/dist/{chunk-OOEPLMKA.js → chunk-NEAMQMYH.js} +1 -1
  77. package/dist/chunk-NEHX45NQ.js +15 -0
  78. package/dist/{chunk-KKRNTSLL.js → chunk-OSB32HJE.js} +1 -1
  79. package/dist/chunk-OVLCJ2VX.js +37 -0
  80. package/dist/{chunk-6IA6QMPH.js → chunk-P7YZ3PU3.js} +1 -1
  81. package/dist/{chunk-7F2ZV46B.js → chunk-PH22FRN5.js} +1 -1
  82. package/dist/{chunk-WVCH66YH.js → chunk-PQWSHTSH.js} +1 -1
  83. package/dist/{chunk-IZ2FJYHG.js → chunk-PRLTUEKP.js} +1 -1
  84. package/dist/{chunk-2ZZDNPFN.js → chunk-PSWB3BWQ.js} +1 -1
  85. package/dist/{chunk-I7RQS65W.js → chunk-PWFZZWYU.js} +1 -1
  86. package/dist/{chunk-IV76ZXCY.js → chunk-QBF5FJVL.js} +1 -1
  87. package/dist/{chunk-YHYTCENI.js → chunk-QDIZQ3ZF.js} +1 -1
  88. package/dist/{chunk-JGOZUAMC.js → chunk-QWDFFEEJ.js} +1 -1
  89. package/dist/{chunk-RN4PKQFR.js → chunk-RN3YHD4S.js} +1 -1
  90. package/dist/{chunk-CAMO26QU.js → chunk-SFXQFUM6.js} +1 -1
  91. package/dist/{chunk-4J6DQFPC.js → chunk-SIH6JG7S.js} +3 -3
  92. package/dist/{chunk-HWH3UYD6.js → chunk-TXH2KG7U.js} +1 -1
  93. package/dist/{chunk-NXXJ56QA.js → chunk-TYI4MLFJ.js} +1 -1
  94. package/dist/{chunk-FNS2EAA5.js → chunk-U55NUF4E.js} +2 -2
  95. package/dist/chunk-ULGZPRKU.js +2 -0
  96. package/dist/{chunk-BRIEBB2U.js → chunk-UOMRMCMI.js} +1 -1
  97. package/dist/{chunk-WV27D55O.js → chunk-UONRTWLU.js} +1 -1
  98. package/dist/{chunk-VPRNGWIY.js → chunk-UTIGOLON.js} +1 -1
  99. package/dist/chunk-V444REBC.js +11 -0
  100. package/dist/chunk-VBCIDWSK.js +2 -0
  101. package/dist/{chunk-YTDSQAYN.js → chunk-VYYTENPY.js} +1 -1
  102. package/dist/{chunk-L5LI2JF4.js → chunk-VZ7KXRXB.js} +11 -11
  103. package/dist/{chunk-2E3ZWGIK.js → chunk-W75AVBFG.js} +5 -5
  104. package/dist/chunk-X2FM67OM.js +4 -0
  105. package/dist/{chunk-PXCMEI73.js → chunk-XHNPNYJP.js} +1 -1
  106. package/dist/{chunk-OAVPM6YJ.js → chunk-YB73T7QH.js} +1 -1
  107. package/dist/{chunk-ZEDAPY7M.js → chunk-YBX2SQ5R.js} +1 -1
  108. package/dist/{chunk-5NIYYD7O.js → chunk-ZI6W65E3.js} +1 -1
  109. package/dist/{chunk-4II6VDXG.js → chunk-ZK57J37M.js} +1 -1
  110. package/dist/{chunk-KHU7C6EE.js → chunk-ZKSN2SJ7.js} +1 -1
  111. package/dist/{chunk-ZPDM6FO7.js → chunk-ZSXDZI56.js} +2 -2
  112. package/dist/{config-RLDXM5ZH.js → config-SFM45WCV.js} +1 -1
  113. package/dist/cover-cmd-7JILZJUK.js +3 -0
  114. package/dist/{credentials-CALNKQMN.js → credentials-3CENDBPH.js} +1 -1
  115. package/dist/{deps-bundle-GVHIMZ5E.js → deps-bundle-P37ZJDXC.js} +1 -1
  116. package/dist/{deps-resolve-T6P4EACP.js → deps-resolve-VSICFRWU.js} +1 -1
  117. package/dist/dispatch-HDGQAEWN.js +2 -0
  118. package/dist/doctor-CPMWU5TL.js +2 -0
  119. package/dist/evidence-ABYJOIV2.js +2 -0
  120. package/dist/evidence-presentation-XF23B7F2.js +2 -0
  121. package/dist/{evolve-cmd-JGCFTXWA.js → evolve-cmd-MROTNJIV.js} +1 -1
  122. package/dist/{explain-cmd-3GEKR7O5.js → explain-cmd-2TKO7GRW.js} +1 -1
  123. package/dist/{extract-bind-EXW32RUY.js → extract-bind-LBZMEDUK.js} +2 -2
  124. package/dist/{extract-cmd-7IOLJJCL.js → extract-cmd-K4KBPMB7.js} +1 -1
  125. package/dist/{gaps-cmd-WPCJPLGB.js → gaps-cmd-3ZX3PZF4.js} +1 -1
  126. package/dist/{generate-headless-U4GTG234.js → generate-headless-EBMWSLTR.js} +2 -2
  127. package/dist/index.js +147 -85
  128. package/dist/{ingest-EX72IEQT.js → ingest-4447MYLF.js} +1 -1
  129. package/dist/ingest-cmd-ULEWNGCI.js +2 -0
  130. package/dist/install-YDH2CORO.js +2 -0
  131. package/dist/{interactive-bind-Y65XV4Y5.js → interactive-bind-IYAJN45L.js} +3 -3
  132. package/dist/{list-commands-3EROWJWV.js → list-commands-YPBJNGCE.js} +1 -1
  133. package/dist/login-flow-W5SAB7NN.js +2 -0
  134. package/dist/{mobile-prompts-TP3ODM5M.js → mobile-prompts-LHUYRSV7.js} +1 -1
  135. package/dist/{persist-recorded-session-EHYT3PVN.js → persist-recorded-session-KCXYXSQG.js} +1 -1
  136. package/dist/pipeline-ELIXCTFZ.js +2 -0
  137. package/dist/prepare-target-OU2DQXSW.js +2 -0
  138. package/dist/reconcile-cmd-TSQDYEUT.js +2 -0
  139. package/dist/{reconcile-deps-6KTJHBMJ.js → reconcile-deps-ETMGIQNM.js} +2 -2
  140. package/dist/{reconcile-engine-O7QEZVX6.js → reconcile-engine-TLFTAOTZ.js} +1 -1
  141. package/dist/{recording-banner-BWWFOJCR.js → recording-banner-ACOLKL4K.js} +1 -1
  142. package/dist/{registry-KXEDLM6X.js → registry-3Q6PNWCK.js} +1 -1
  143. package/dist/{require-project-folder-CXDRRWEQ.js → require-project-folder-5KWTJAXN.js} +1 -1
  144. package/dist/resolve-run-intent-L2I7G55O.js +2 -0
  145. package/dist/{resolver-FTU5KO7H.js → resolver-NRU6HGTL.js} +1 -1
  146. package/dist/run-RHLRZCV5.js +2 -0
  147. package/dist/{run-CMFBSYWF.js → run-T53Z5TCY.js} +1 -1
  148. package/dist/{run-test-md-7HGOZJSU.js → run-test-md-JYDYT3XF.js} +2 -2
  149. package/dist/{skill-installer-QNUDLGPD.js → skill-installer-NWF53JAB.js} +1 -1
  150. package/dist/{spawner-DQZRJIE6.js → spawner-LKYUMXSO.js} +1 -1
  151. package/dist/tcg-generate-2PHA7VNL.js +2 -0
  152. package/dist/{testmd-actions-IFRW7NGG.js → testmd-actions-CRRUXYOP.js} +1 -1
  153. package/dist/token-refresh-XKXPM6H3.js +2 -0
  154. package/dist/{types-6E2HTDKJ.js → types-VYEOJ6U2.js} +1 -1
  155. package/dist/{validate-basic-3CNUDDH7.js → validate-basic-X2XPEBFD.js} +1 -1
  156. package/dist/{verdicts-NYCSBWUC.js → verdicts-J2SDU4MW.js} +1 -1
  157. package/dist/{version-check-7TSAVA6V.js → version-check-DAWGRSJ5.js} +1 -1
  158. package/dist/{walk-session-AINBHZKB.js → walk-session-D6TCM33V.js} +1 -1
  159. package/dist/{with-telemetry-3DL7ZEZL.js → with-telemetry-RXLIXUMR.js} +1 -1
  160. package/package.json +12 -12
  161. package/dist/EvidenceViewOffer-L5FVBQNK.js +0 -2
  162. package/dist/FolderPicker-6Z3CYSHF.js +0 -2
  163. package/dist/SingleShotApp-M3HNSUMZ.js +0 -2
  164. package/dist/TestMdRunView-ISOVQ7YP.js +0 -2
  165. package/dist/bridge-QDPBIIOW.js +0 -2
  166. package/dist/chunk-2KH2JUGL.js +0 -13
  167. package/dist/chunk-3654GK6O.js +0 -66
  168. package/dist/chunk-ECZMYPLJ.js +0 -19
  169. package/dist/chunk-GNIFMQNK.js +0 -10
  170. package/dist/chunk-IOD3HQVW.js +0 -11
  171. package/dist/chunk-JUVQQP42.js +0 -2
  172. package/dist/chunk-W4B5LOEX.js +0 -4
  173. package/dist/chunk-WQPQNL4S.js +0 -2
  174. package/dist/chunk-YGMC3FGJ.js +0 -26
  175. package/dist/cover-cmd-HDZZWJXG.js +0 -3
  176. package/dist/dispatch-ECUEAMXS.js +0 -2
  177. package/dist/doctor-SIBHJVGC.js +0 -2
  178. package/dist/evidence-ZVQHPELX.js +0 -2
  179. package/dist/ingest-cmd-YYNAKI2U.js +0 -2
  180. package/dist/login-flow-TRINUSBB.js +0 -2
  181. package/dist/pipeline-5GOS2KV2.js +0 -2
  182. package/dist/prepare-target-BUEOZVJV.js +0 -2
  183. package/dist/reconcile-cmd-TY3MWZL3.js +0 -2
  184. package/dist/resolve-run-intent-PZXEQTHC.js +0 -7
  185. package/dist/run-WKHPVWUN.js +0 -2
  186. package/dist/tcg-generate-XKSTMCOG.js +0 -2
  187. package/dist/token-refresh-FP6JFLXB.js +0 -2
  188. /package/dist/{lifecycle-cmd-HO5VL7AM.js → lifecycle-cmd-O2324GN6.js} +0 -0
@@ -1,24 +1,24 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- function Ce(e){return typeof e>"u"||e===null}function $e(e){return typeof e=="object"&&e!==null}function Qe(e){return Array.isArray(e)?e:Ce(e)?[]:[e]}function Ve(e,n){var i,l,r,u;if(n)for(u=Object.keys(n),i=0,l=u.length;i<l;i+=1)r=u[i],e[r]=n[r];return e}function Xe(e,n){var i="",l;for(l=0;l<n;l+=1)i+=e;return i}function Ze(e){return e===0&&Number.NEGATIVE_INFINITY===1/e}var ze=Ce,Je=$e,en=Qe,nn=Xe,rn=Ze,ln=Ve,y={isNothing:ze,isObject:Je,toArray:en,repeat:nn,isNegativeZero:rn,extend:ln};function _e(e,n){var i="",l=e.reason||"(unknown reason)";return e.mark?(e.mark.name&&(i+='in "'+e.mark.name+'" '),i+="("+(e.mark.line+1)+":"+(e.mark.column+1)+")",!n&&e.mark.snippet&&(i+=`
2
+ function Ce(e){return typeof e>"u"||e===null}function Qe(e){return typeof e=="object"&&e!==null}function Ve(e){return Array.isArray(e)?e:Ce(e)?[]:[e]}function Xe(e,n){var i,l,r,u;if(n)for(u=Object.keys(n),i=0,l=u.length;i<l;i+=1)r=u[i],e[r]=n[r];return e}function Ze(e,n){var i="",l;for(l=0;l<n;l+=1)i+=e;return i}function ze(e){return e===0&&Number.NEGATIVE_INFINITY===1/e}var Je=Ce,en=Qe,nn=Ve,rn=Ze,ln=ze,on=Xe,y={isNothing:Je,isObject:en,toArray:nn,repeat:rn,isNegativeZero:ln,extend:on};function _e(e,n){var i="",l=e.reason||"(unknown reason)";return e.mark?(e.mark.name&&(i+='in "'+e.mark.name+'" '),i+="("+(e.mark.line+1)+":"+(e.mark.column+1)+")",!n&&e.mark.snippet&&(i+=`
3
3
 
4
- `+e.mark.snippet),l+" "+i):l}function Y(e,n){Error.call(this),this.name="YAMLException",this.reason=e,this.mark=n,this.message=_e(this,!1),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack||""}Y.prototype=Object.create(Error.prototype);Y.prototype.constructor=Y;Y.prototype.toString=function(n){return this.name+": "+_e(this,n)};var w=Y;function $(e,n,i,l,r){var u="",o="",f=Math.floor(r/2)-1;return l-n>f&&(u=" ... ",n=l-f+u.length),i-l>f&&(o=" ...",i=l+f-o.length),{str:u+e.slice(n,i).replace(/\t/g,"\u2192")+o,pos:l-n+u.length}}function Q(e,n){return y.repeat(" ",n-e.length)+e}function on(e,n){if(n=Object.create(n||null),!e.buffer)return null;n.maxLength||(n.maxLength=79),typeof n.indent!="number"&&(n.indent=1),typeof n.linesBefore!="number"&&(n.linesBefore=3),typeof n.linesAfter!="number"&&(n.linesAfter=2);for(var i=/\r?\n|\r|\0/g,l=[0],r=[],u,o=-1;u=i.exec(e.buffer);)r.push(u.index),l.push(u.index+u[0].length),e.position<=u.index&&o<0&&(o=l.length-2);o<0&&(o=l.length-1);var f="",c,a,t=Math.min(e.line+n.linesAfter,r.length).toString().length,p=n.maxLength-(n.indent+t+3);for(c=1;c<=n.linesBefore&&!(o-c<0);c++)a=$(e.buffer,l[o-c],r[o-c],e.position-(l[o]-l[o-c]),p),f=y.repeat(" ",n.indent)+Q((e.line-c+1).toString(),t)+" | "+a.str+`
4
+ `+e.mark.snippet),l+" "+i):l}function Y(e,n){Error.call(this),this.name="YAMLException",this.reason=e,this.mark=n,this.message=_e(this,!1),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack||""}Y.prototype=Object.create(Error.prototype);Y.prototype.constructor=Y;Y.prototype.toString=function(n){return this.name+": "+_e(this,n)};var w=Y;function $(e,n,i,l,r){var u="",o="",f=Math.floor(r/2)-1;return l-n>f&&(u=" ... ",n=l-f+u.length),i-l>f&&(o=" ...",i=l+f-o.length),{str:u+e.slice(n,i).replace(/\t/g,"\u2192")+o,pos:l-n+u.length}}function Q(e,n){return y.repeat(" ",n-e.length)+e}function un(e,n){if(n=Object.create(n||null),!e.buffer)return null;n.maxLength||(n.maxLength=79),typeof n.indent!="number"&&(n.indent=1),typeof n.linesBefore!="number"&&(n.linesBefore=3),typeof n.linesAfter!="number"&&(n.linesAfter=2);for(var i=/\r?\n|\r|\0/g,l=[0],r=[],u,o=-1;u=i.exec(e.buffer);)r.push(u.index),l.push(u.index+u[0].length),e.position<=u.index&&o<0&&(o=l.length-2);o<0&&(o=l.length-1);var f="",c,a,t=Math.min(e.line+n.linesAfter,r.length).toString().length,p=n.maxLength-(n.indent+t+3);for(c=1;c<=n.linesBefore&&!(o-c<0);c++)a=$(e.buffer,l[o-c],r[o-c],e.position-(l[o]-l[o-c]),p),f=y.repeat(" ",n.indent)+Q((e.line-c+1).toString(),t)+" | "+a.str+`
5
5
  `+f;for(a=$(e.buffer,l[o],r[o],e.position,p),f+=y.repeat(" ",n.indent)+Q((e.line+1).toString(),t)+" | "+a.str+`
6
6
  `,f+=y.repeat("-",n.indent+t+3+a.pos)+`^
7
7
  `,c=1;c<=n.linesAfter&&!(o+c>=r.length);c++)a=$(e.buffer,l[o+c],r[o+c],e.position-(l[o]-l[o+c]),p),f+=y.repeat(" ",n.indent)+Q((e.line+c+1).toString(),t)+" | "+a.str+`
8
- `;return f.replace(/\n$/,"")}var un=on,fn=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],cn=["scalar","sequence","mapping"];function an(e){var n={};return e!==null&&Object.keys(e).forEach(function(i){e[i].forEach(function(l){n[String(l)]=i})}),n}function pn(e,n){if(n=n||{},Object.keys(n).forEach(function(i){if(fn.indexOf(i)===-1)throw new w('Unknown option "'+i+'" is met in definition of "'+e+'" YAML type.')}),this.options=n,this.tag=e,this.kind=n.kind||null,this.resolve=n.resolve||function(){return!0},this.construct=n.construct||function(i){return i},this.instanceOf=n.instanceOf||null,this.predicate=n.predicate||null,this.represent=n.represent||null,this.representName=n.representName||null,this.defaultStyle=n.defaultStyle||null,this.multi=n.multi||!1,this.styleAliases=an(n.styleAliases||null),cn.indexOf(this.kind)===-1)throw new w('Unknown kind "'+this.kind+'" is specified for "'+e+'" YAML type.')}var C=pn;function ue(e,n){var i=[];return e[n].forEach(function(l){var r=i.length;i.forEach(function(u,o){u.tag===l.tag&&u.kind===l.kind&&u.multi===l.multi&&(r=o)}),i[r]=l}),i}function tn(){var e={scalar:{},sequence:{},mapping:{},fallback:{},multi:{scalar:[],sequence:[],mapping:[],fallback:[]}},n,i;function l(r){r.multi?(e.multi[r.kind].push(r),e.multi.fallback.push(r)):e[r.kind][r.tag]=e.fallback[r.tag]=r}for(n=0,i=arguments.length;n<i;n+=1)arguments[n].forEach(l);return e}function X(e){return this.extend(e)}X.prototype.extend=function(n){var i=[],l=[];if(n instanceof C)l.push(n);else if(Array.isArray(n))l=l.concat(n);else if(n&&(Array.isArray(n.implicit)||Array.isArray(n.explicit)))n.implicit&&(i=i.concat(n.implicit)),n.explicit&&(l=l.concat(n.explicit));else throw new w("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");i.forEach(function(u){if(!(u instanceof C))throw new w("Specified list of YAML types (or a single Type object) contains a non-Type object.");if(u.loadKind&&u.loadKind!=="scalar")throw new w("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");if(u.multi)throw new w("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.")}),l.forEach(function(u){if(!(u instanceof C))throw new w("Specified list of YAML types (or a single Type object) contains a non-Type object.")});var r=Object.create(X.prototype);return r.implicit=(this.implicit||[]).concat(i),r.explicit=(this.explicit||[]).concat(l),r.compiledImplicit=ue(r,"implicit"),r.compiledExplicit=ue(r,"explicit"),r.compiledTypeMap=tn(r.compiledImplicit,r.compiledExplicit),r};var hn=X,dn=new C("tag:yaml.org,2002:str",{kind:"scalar",construct:function(e){return e!==null?e:""}}),sn=new C("tag:yaml.org,2002:seq",{kind:"sequence",construct:function(e){return e!==null?e:[]}}),mn=new C("tag:yaml.org,2002:map",{kind:"mapping",construct:function(e){return e!==null?e:{}}}),xn=new hn({explicit:[dn,sn,mn]});function gn(e){if(e===null)return!0;var n=e.length;return n===1&&e==="~"||n===4&&(e==="null"||e==="Null"||e==="NULL")}function An(){return null}function vn(e){return e===null}var yn=new C("tag:yaml.org,2002:null",{kind:"scalar",resolve:gn,construct:An,predicate:vn,represent:{canonical:function(){return"~"},lowercase:function(){return"null"},uppercase:function(){return"NULL"},camelcase:function(){return"Null"},empty:function(){return""}},defaultStyle:"lowercase"});function Cn(e){if(e===null)return!1;var n=e.length;return n===4&&(e==="true"||e==="True"||e==="TRUE")||n===5&&(e==="false"||e==="False"||e==="FALSE")}function _n(e){return e==="true"||e==="True"||e==="TRUE"}function wn(e){return Object.prototype.toString.call(e)==="[object Boolean]"}var En=new C("tag:yaml.org,2002:bool",{kind:"scalar",resolve:Cn,construct:_n,predicate:wn,represent:{lowercase:function(e){return e?"true":"false"},uppercase:function(e){return e?"TRUE":"FALSE"},camelcase:function(e){return e?"True":"False"}},defaultStyle:"lowercase"});function Sn(e){return 48<=e&&e<=57||65<=e&&e<=70||97<=e&&e<=102}function Fn(e){return 48<=e&&e<=55}function bn(e){return 48<=e&&e<=57}function Tn(e){if(e===null)return!1;var n=e.length,i=0,l=!1,r;if(!n)return!1;if(r=e[i],(r==="-"||r==="+")&&(r=e[++i]),r==="0"){if(i+1===n)return!0;if(r=e[++i],r==="b"){for(i++;i<n;i++)if(r=e[i],r!=="_"){if(r!=="0"&&r!=="1")return!1;l=!0}return l&&r!=="_"}if(r==="x"){for(i++;i<n;i++)if(r=e[i],r!=="_"){if(!Sn(e.charCodeAt(i)))return!1;l=!0}return l&&r!=="_"}if(r==="o"){for(i++;i<n;i++)if(r=e[i],r!=="_"){if(!Fn(e.charCodeAt(i)))return!1;l=!0}return l&&r!=="_"}}if(r==="_")return!1;for(;i<n;i++)if(r=e[i],r!=="_"){if(!bn(e.charCodeAt(i)))return!1;l=!0}return!(!l||r==="_")}function On(e){var n=e,i=1,l;if(n.indexOf("_")!==-1&&(n=n.replace(/_/g,"")),l=n[0],(l==="-"||l==="+")&&(l==="-"&&(i=-1),n=n.slice(1),l=n[0]),n==="0")return 0;if(l==="0"){if(n[1]==="b")return i*parseInt(n.slice(2),2);if(n[1]==="x")return i*parseInt(n.slice(2),16);if(n[1]==="o")return i*parseInt(n.slice(2),8)}return i*parseInt(n,10)}function In(e){return Object.prototype.toString.call(e)==="[object Number]"&&e%1===0&&!y.isNegativeZero(e)}var Ln=new C("tag:yaml.org,2002:int",{kind:"scalar",resolve:Tn,construct:On,predicate:In,represent:{binary:function(e){return e>=0?"0b"+e.toString(2):"-0b"+e.toString(2).slice(1)},octal:function(e){return e>=0?"0o"+e.toString(8):"-0o"+e.toString(8).slice(1)},decimal:function(e){return e.toString(10)},hexadecimal:function(e){return e>=0?"0x"+e.toString(16).toUpperCase():"-0x"+e.toString(16).toUpperCase().slice(1)}},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}}),kn=new RegExp("^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");function Nn(e){return!(e===null||!kn.test(e)||e[e.length-1]==="_")}function Rn(e){var n,i;return n=e.replace(/_/g,"").toLowerCase(),i=n[0]==="-"?-1:1,"+-".indexOf(n[0])>=0&&(n=n.slice(1)),n===".inf"?i===1?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:n===".nan"?NaN:i*parseFloat(n,10)}var Dn=/^[-+]?[0-9]+e/;function Mn(e,n){var i;if(isNaN(e))switch(n){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===e)switch(n){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===e)switch(n){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(y.isNegativeZero(e))return"-0.0";return i=e.toString(10),Dn.test(i)?i.replace("e",".e"):i}function Yn(e){return Object.prototype.toString.call(e)==="[object Number]"&&(e%1!==0||y.isNegativeZero(e))}var Bn=new C("tag:yaml.org,2002:float",{kind:"scalar",resolve:Nn,construct:Rn,predicate:Yn,represent:Mn,defaultStyle:"lowercase"}),Pn=xn.extend({implicit:[yn,En,Ln,Bn]}),Hn=Pn,we=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),Ee=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");function jn(e){return e===null?!1:we.exec(e)!==null||Ee.exec(e)!==null}function Un(e){var n,i,l,r,u,o,f,c=0,a=null,t,p,d;if(n=we.exec(e),n===null&&(n=Ee.exec(e)),n===null)throw new Error("Date resolve error");if(i=+n[1],l=+n[2]-1,r=+n[3],!n[4])return new Date(Date.UTC(i,l,r));if(u=+n[4],o=+n[5],f=+n[6],n[7]){for(c=n[7].slice(0,3);c.length<3;)c+="0";c=+c}return n[9]&&(t=+n[10],p=+(n[11]||0),a=(t*60+p)*6e4,n[9]==="-"&&(a=-a)),d=new Date(Date.UTC(i,l,r,u,o,f,c)),a&&d.setTime(d.getTime()-a),d}function Kn(e){return e.toISOString()}var qn=new C("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:jn,construct:Un,instanceOf:Date,represent:Kn});function Gn(e){return e==="<<"||e===null}var Wn=new C("tag:yaml.org,2002:merge",{kind:"scalar",resolve:Gn}),ne=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=
9
- \r`;function $n(e){if(e===null)return!1;var n,i,l=0,r=e.length,u=ne;for(i=0;i<r;i++)if(n=u.indexOf(e.charAt(i)),!(n>64)){if(n<0)return!1;l+=6}return l%8===0}function Qn(e){var n,i,l=e.replace(/[\r\n=]/g,""),r=l.length,u=ne,o=0,f=[];for(n=0;n<r;n++)n%4===0&&n&&(f.push(o>>16&255),f.push(o>>8&255),f.push(o&255)),o=o<<6|u.indexOf(l.charAt(n));return i=r%4*6,i===0?(f.push(o>>16&255),f.push(o>>8&255),f.push(o&255)):i===18?(f.push(o>>10&255),f.push(o>>2&255)):i===12&&f.push(o>>4&255),new Uint8Array(f)}function Vn(e){var n="",i=0,l,r,u=e.length,o=ne;for(l=0;l<u;l++)l%3===0&&l&&(n+=o[i>>18&63],n+=o[i>>12&63],n+=o[i>>6&63],n+=o[i&63]),i=(i<<8)+e[l];return r=u%3,r===0?(n+=o[i>>18&63],n+=o[i>>12&63],n+=o[i>>6&63],n+=o[i&63]):r===2?(n+=o[i>>10&63],n+=o[i>>4&63],n+=o[i<<2&63],n+=o[64]):r===1&&(n+=o[i>>2&63],n+=o[i<<4&63],n+=o[64],n+=o[64]),n}function Xn(e){return Object.prototype.toString.call(e)==="[object Uint8Array]"}var Zn=new C("tag:yaml.org,2002:binary",{kind:"scalar",resolve:$n,construct:Qn,predicate:Xn,represent:Vn}),zn=Object.prototype.hasOwnProperty,Jn=Object.prototype.toString;function ei(e){if(e===null)return!0;var n=[],i,l,r,u,o,f=e;for(i=0,l=f.length;i<l;i+=1){if(r=f[i],o=!1,Jn.call(r)!=="[object Object]")return!1;for(u in r)if(zn.call(r,u))if(!o)o=!0;else return!1;if(!o)return!1;if(n.indexOf(u)===-1)n.push(u);else return!1}return!0}function ni(e){return e!==null?e:[]}var ii=new C("tag:yaml.org,2002:omap",{kind:"sequence",resolve:ei,construct:ni}),ri=Object.prototype.toString;function li(e){if(e===null)return!0;var n,i,l,r,u,o=e;for(u=new Array(o.length),n=0,i=o.length;n<i;n+=1){if(l=o[n],ri.call(l)!=="[object Object]"||(r=Object.keys(l),r.length!==1))return!1;u[n]=[r[0],l[r[0]]]}return!0}function oi(e){if(e===null)return[];var n,i,l,r,u,o=e;for(u=new Array(o.length),n=0,i=o.length;n<i;n+=1)l=o[n],r=Object.keys(l),u[n]=[r[0],l[r[0]]];return u}var ui=new C("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:li,construct:oi}),fi=Object.prototype.hasOwnProperty;function ci(e){if(e===null)return!0;var n,i=e;for(n in i)if(fi.call(i,n)&&i[n]!==null)return!1;return!0}function ai(e){return e!==null?e:{}}var pi=new C("tag:yaml.org,2002:set",{kind:"mapping",resolve:ci,construct:ai}),Se=Hn.extend({implicit:[qn,Wn],explicit:[Zn,ii,ui,pi]}),O=Object.prototype.hasOwnProperty,j=1,Fe=2,be=3,U=4,V=1,ti=2,fe=3,hi=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,di=/[\x85\u2028\u2029]/,si=/[,\[\]\{\}]/,Te=/^(?:!|!!|![a-z\-]+!)$/i,Oe=/^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;function ce(e){return Object.prototype.toString.call(e)}function F(e){return e===10||e===13}function L(e){return e===9||e===32}function E(e){return e===9||e===32||e===10||e===13}function N(e){return e===44||e===91||e===93||e===123||e===125}function mi(e){var n;return 48<=e&&e<=57?e-48:(n=e|32,97<=n&&n<=102?n-97+10:-1)}function xi(e){return e===120?2:e===117?4:e===85?8:0}function gi(e){return 48<=e&&e<=57?e-48:-1}function ae(e){return e===48?"\0":e===97?"\x07":e===98?"\b":e===116||e===9?" ":e===110?`
10
- `:e===118?"\v":e===102?"\f":e===114?"\r":e===101?"\x1B":e===32?" ":e===34?'"':e===47?"/":e===92?"\\":e===78?"\x85":e===95?"\xA0":e===76?"\u2028":e===80?"\u2029":""}function Ai(e){return e<=65535?String.fromCharCode(e):String.fromCharCode((e-65536>>10)+55296,(e-65536&1023)+56320)}function Ie(e,n,i){n==="__proto__"?Object.defineProperty(e,n,{configurable:!0,enumerable:!0,writable:!0,value:i}):e[n]=i}var Le=new Array(256),ke=new Array(256);for(I=0;I<256;I++)Le[I]=ae(I)?1:0,ke[I]=ae(I);var I;function vi(e,n){this.input=e,this.filename=n.filename||null,this.schema=n.schema||Se,this.onWarning=n.onWarning||null,this.legacy=n.legacy||!1,this.json=n.json||!1,this.listener=n.listener||null,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=e.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.firstTabInLine=-1,this.documents=[]}function Ne(e,n){var i={name:e.filename,buffer:e.input.slice(0,-1),position:e.position,line:e.line,column:e.position-e.lineStart};return i.snippet=un(i),new w(n,i)}function h(e,n){throw Ne(e,n)}function K(e,n){e.onWarning&&e.onWarning.call(null,Ne(e,n))}var pe={YAML:function(n,i,l){var r,u,o;n.version!==null&&h(n,"duplication of %YAML directive"),l.length!==1&&h(n,"YAML directive accepts exactly one argument"),r=/^([0-9]+)\.([0-9]+)$/.exec(l[0]),r===null&&h(n,"ill-formed argument of the YAML directive"),u=parseInt(r[1],10),o=parseInt(r[2],10),u!==1&&h(n,"unacceptable YAML version of the document"),n.version=l[0],n.checkLineBreaks=o<2,o!==1&&o!==2&&K(n,"unsupported YAML version of the document")},TAG:function(n,i,l){var r,u;l.length!==2&&h(n,"TAG directive accepts exactly two arguments"),r=l[0],u=l[1],Te.test(r)||h(n,"ill-formed tag handle (first argument) of the TAG directive"),O.call(n.tagMap,r)&&h(n,'there is a previously declared suffix for "'+r+'" tag handle'),Oe.test(u)||h(n,"ill-formed tag prefix (second argument) of the TAG directive");try{u=decodeURIComponent(u)}catch{h(n,"tag prefix is malformed: "+u)}n.tagMap[r]=u}};function T(e,n,i,l){var r,u,o,f;if(n<i){if(f=e.input.slice(n,i),l)for(r=0,u=f.length;r<u;r+=1)o=f.charCodeAt(r),o===9||32<=o&&o<=1114111||h(e,"expected valid JSON character");else hi.test(f)&&h(e,"the stream contains non-printable characters");e.result+=f}}function te(e,n,i,l){var r,u,o,f;for(y.isObject(i)||h(e,"cannot merge mappings; the provided source object is unacceptable"),r=Object.keys(i),o=0,f=r.length;o<f;o+=1)u=r[o],O.call(n,u)||(Ie(n,u,i[u]),l[u]=!0)}function R(e,n,i,l,r,u,o,f,c){var a,t;if(Array.isArray(r))for(r=Array.prototype.slice.call(r),a=0,t=r.length;a<t;a+=1)Array.isArray(r[a])&&h(e,"nested arrays are not supported inside keys"),typeof r=="object"&&ce(r[a])==="[object Object]"&&(r[a]="[object Object]");if(typeof r=="object"&&ce(r)==="[object Object]"&&(r="[object Object]"),r=String(r),n===null&&(n={}),l==="tag:yaml.org,2002:merge")if(Array.isArray(u))for(a=0,t=u.length;a<t;a+=1)te(e,n,u[a],i);else te(e,n,u,i);else!e.json&&!O.call(i,r)&&O.call(n,r)&&(e.line=o||e.line,e.lineStart=f||e.lineStart,e.position=c||e.position,h(e,"duplicated mapping key")),Ie(n,r,u),delete i[r];return n}function ie(e){var n;n=e.input.charCodeAt(e.position),n===10?e.position++:n===13?(e.position++,e.input.charCodeAt(e.position)===10&&e.position++):h(e,"a line break is expected"),e.line+=1,e.lineStart=e.position,e.firstTabInLine=-1}function v(e,n,i){for(var l=0,r=e.input.charCodeAt(e.position);r!==0;){for(;L(r);)r===9&&e.firstTabInLine===-1&&(e.firstTabInLine=e.position),r=e.input.charCodeAt(++e.position);if(n&&r===35)do r=e.input.charCodeAt(++e.position);while(r!==10&&r!==13&&r!==0);if(F(r))for(ie(e),r=e.input.charCodeAt(e.position),l++,e.lineIndent=0;r===32;)e.lineIndent++,r=e.input.charCodeAt(++e.position);else break}return i!==-1&&l!==0&&e.lineIndent<i&&K(e,"deficient indentation"),l}function W(e){var n=e.position,i;return i=e.input.charCodeAt(n),!!((i===45||i===46)&&i===e.input.charCodeAt(n+1)&&i===e.input.charCodeAt(n+2)&&(n+=3,i=e.input.charCodeAt(n),i===0||E(i)))}function re(e,n){n===1?e.result+=" ":n>1&&(e.result+=y.repeat(`
11
- `,n-1))}function yi(e,n,i){var l,r,u,o,f,c,a,t,p=e.kind,d=e.result,s;if(s=e.input.charCodeAt(e.position),E(s)||N(s)||s===35||s===38||s===42||s===33||s===124||s===62||s===39||s===34||s===37||s===64||s===96||(s===63||s===45)&&(r=e.input.charCodeAt(e.position+1),E(r)||i&&N(r)))return!1;for(e.kind="scalar",e.result="",u=o=e.position,f=!1;s!==0;){if(s===58){if(r=e.input.charCodeAt(e.position+1),E(r)||i&&N(r))break}else if(s===35){if(l=e.input.charCodeAt(e.position-1),E(l))break}else{if(e.position===e.lineStart&&W(e)||i&&N(s))break;if(F(s))if(c=e.line,a=e.lineStart,t=e.lineIndent,v(e,!1,-1),e.lineIndent>=n){f=!0,s=e.input.charCodeAt(e.position);continue}else{e.position=o,e.line=c,e.lineStart=a,e.lineIndent=t;break}}f&&(T(e,u,o,!1),re(e,e.line-c),u=o=e.position,f=!1),L(s)||(o=e.position+1),s=e.input.charCodeAt(++e.position)}return T(e,u,o,!1),e.result?!0:(e.kind=p,e.result=d,!1)}function Ci(e,n){var i,l,r;if(i=e.input.charCodeAt(e.position),i!==39)return!1;for(e.kind="scalar",e.result="",e.position++,l=r=e.position;(i=e.input.charCodeAt(e.position))!==0;)if(i===39)if(T(e,l,e.position,!0),i=e.input.charCodeAt(++e.position),i===39)l=e.position,e.position++,r=e.position;else return!0;else F(i)?(T(e,l,r,!0),re(e,v(e,!1,n)),l=r=e.position):e.position===e.lineStart&&W(e)?h(e,"unexpected end of the document within a single quoted scalar"):(e.position++,r=e.position);h(e,"unexpected end of the stream within a single quoted scalar")}function _i(e,n){var i,l,r,u,o,f;if(f=e.input.charCodeAt(e.position),f!==34)return!1;for(e.kind="scalar",e.result="",e.position++,i=l=e.position;(f=e.input.charCodeAt(e.position))!==0;){if(f===34)return T(e,i,e.position,!0),e.position++,!0;if(f===92){if(T(e,i,e.position,!0),f=e.input.charCodeAt(++e.position),F(f))v(e,!1,n);else if(f<256&&Le[f])e.result+=ke[f],e.position++;else if((o=xi(f))>0){for(r=o,u=0;r>0;r--)f=e.input.charCodeAt(++e.position),(o=mi(f))>=0?u=(u<<4)+o:h(e,"expected hexadecimal character");e.result+=Ai(u),e.position++}else h(e,"unknown escape sequence");i=l=e.position}else F(f)?(T(e,i,l,!0),re(e,v(e,!1,n)),i=l=e.position):e.position===e.lineStart&&W(e)?h(e,"unexpected end of the document within a double quoted scalar"):(e.position++,l=e.position)}h(e,"unexpected end of the stream within a double quoted scalar")}function wi(e,n){var i=!0,l,r,u,o=e.tag,f,c=e.anchor,a,t,p,d,s,m=Object.create(null),g,A,S,x;if(x=e.input.charCodeAt(e.position),x===91)t=93,s=!1,f=[];else if(x===123)t=125,s=!0,f={};else return!1;for(e.anchor!==null&&(e.anchorMap[e.anchor]=f),x=e.input.charCodeAt(++e.position);x!==0;){if(v(e,!0,n),x=e.input.charCodeAt(e.position),x===t)return e.position++,e.tag=o,e.anchor=c,e.kind=s?"mapping":"sequence",e.result=f,!0;i?x===44&&h(e,"expected the node content, but found ','"):h(e,"missed comma between flow collection entries"),A=g=S=null,p=d=!1,x===63&&(a=e.input.charCodeAt(e.position+1),E(a)&&(p=d=!0,e.position++,v(e,!0,n))),l=e.line,r=e.lineStart,u=e.position,D(e,n,j,!1,!0),A=e.tag,g=e.result,v(e,!0,n),x=e.input.charCodeAt(e.position),(d||e.line===l)&&x===58&&(p=!0,x=e.input.charCodeAt(++e.position),v(e,!0,n),D(e,n,j,!1,!0),S=e.result),s?R(e,f,m,A,g,S,l,r,u):p?f.push(R(e,null,m,A,g,S,l,r,u)):f.push(g),v(e,!0,n),x=e.input.charCodeAt(e.position),x===44?(i=!0,x=e.input.charCodeAt(++e.position)):i=!1}h(e,"unexpected end of the stream within a flow collection")}function Ei(e,n){var i,l,r=V,u=!1,o=!1,f=n,c=0,a=!1,t,p;if(p=e.input.charCodeAt(e.position),p===124)l=!1;else if(p===62)l=!0;else return!1;for(e.kind="scalar",e.result="";p!==0;)if(p=e.input.charCodeAt(++e.position),p===43||p===45)V===r?r=p===43?fe:ti:h(e,"repeat of a chomping mode identifier");else if((t=gi(p))>=0)t===0?h(e,"bad explicit indentation width of a block scalar; it cannot be less than one"):o?h(e,"repeat of an indentation width identifier"):(f=n+t-1,o=!0);else break;if(L(p)){do p=e.input.charCodeAt(++e.position);while(L(p));if(p===35)do p=e.input.charCodeAt(++e.position);while(!F(p)&&p!==0)}for(;p!==0;){for(ie(e),e.lineIndent=0,p=e.input.charCodeAt(e.position);(!o||e.lineIndent<f)&&p===32;)e.lineIndent++,p=e.input.charCodeAt(++e.position);if(!o&&e.lineIndent>f&&(f=e.lineIndent),F(p)){c++;continue}if(e.lineIndent<f){r===fe?e.result+=y.repeat(`
8
+ `;return f.replace(/\n$/,"")}var fn=un,cn=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],an=["scalar","sequence","mapping"];function pn(e){var n={};return e!==null&&Object.keys(e).forEach(function(i){e[i].forEach(function(l){n[String(l)]=i})}),n}function tn(e,n){if(n=n||{},Object.keys(n).forEach(function(i){if(cn.indexOf(i)===-1)throw new w('Unknown option "'+i+'" is met in definition of "'+e+'" YAML type.')}),this.options=n,this.tag=e,this.kind=n.kind||null,this.resolve=n.resolve||function(){return!0},this.construct=n.construct||function(i){return i},this.instanceOf=n.instanceOf||null,this.predicate=n.predicate||null,this.represent=n.represent||null,this.representName=n.representName||null,this.defaultStyle=n.defaultStyle||null,this.multi=n.multi||!1,this.styleAliases=pn(n.styleAliases||null),an.indexOf(this.kind)===-1)throw new w('Unknown kind "'+this.kind+'" is specified for "'+e+'" YAML type.')}var C=tn;function ue(e,n){var i=[];return e[n].forEach(function(l){var r=i.length;i.forEach(function(u,o){u.tag===l.tag&&u.kind===l.kind&&u.multi===l.multi&&(r=o)}),i[r]=l}),i}function hn(){var e={scalar:{},sequence:{},mapping:{},fallback:{},multi:{scalar:[],sequence:[],mapping:[],fallback:[]}},n,i;function l(r){r.multi?(e.multi[r.kind].push(r),e.multi.fallback.push(r)):e[r.kind][r.tag]=e.fallback[r.tag]=r}for(n=0,i=arguments.length;n<i;n+=1)arguments[n].forEach(l);return e}function X(e){return this.extend(e)}X.prototype.extend=function(n){var i=[],l=[];if(n instanceof C)l.push(n);else if(Array.isArray(n))l=l.concat(n);else if(n&&(Array.isArray(n.implicit)||Array.isArray(n.explicit)))n.implicit&&(i=i.concat(n.implicit)),n.explicit&&(l=l.concat(n.explicit));else throw new w("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");i.forEach(function(u){if(!(u instanceof C))throw new w("Specified list of YAML types (or a single Type object) contains a non-Type object.");if(u.loadKind&&u.loadKind!=="scalar")throw new w("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");if(u.multi)throw new w("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.")}),l.forEach(function(u){if(!(u instanceof C))throw new w("Specified list of YAML types (or a single Type object) contains a non-Type object.")});var r=Object.create(X.prototype);return r.implicit=(this.implicit||[]).concat(i),r.explicit=(this.explicit||[]).concat(l),r.compiledImplicit=ue(r,"implicit"),r.compiledExplicit=ue(r,"explicit"),r.compiledTypeMap=hn(r.compiledImplicit,r.compiledExplicit),r};var dn=X,sn=new C("tag:yaml.org,2002:str",{kind:"scalar",construct:function(e){return e!==null?e:""}}),mn=new C("tag:yaml.org,2002:seq",{kind:"sequence",construct:function(e){return e!==null?e:[]}}),xn=new C("tag:yaml.org,2002:map",{kind:"mapping",construct:function(e){return e!==null?e:{}}}),gn=new dn({explicit:[sn,mn,xn]});function An(e){if(e===null)return!0;var n=e.length;return n===1&&e==="~"||n===4&&(e==="null"||e==="Null"||e==="NULL")}function vn(){return null}function yn(e){return e===null}var Cn=new C("tag:yaml.org,2002:null",{kind:"scalar",resolve:An,construct:vn,predicate:yn,represent:{canonical:function(){return"~"},lowercase:function(){return"null"},uppercase:function(){return"NULL"},camelcase:function(){return"Null"},empty:function(){return""}},defaultStyle:"lowercase"});function _n(e){if(e===null)return!1;var n=e.length;return n===4&&(e==="true"||e==="True"||e==="TRUE")||n===5&&(e==="false"||e==="False"||e==="FALSE")}function wn(e){return e==="true"||e==="True"||e==="TRUE"}function En(e){return Object.prototype.toString.call(e)==="[object Boolean]"}var Sn=new C("tag:yaml.org,2002:bool",{kind:"scalar",resolve:_n,construct:wn,predicate:En,represent:{lowercase:function(e){return e?"true":"false"},uppercase:function(e){return e?"TRUE":"FALSE"},camelcase:function(e){return e?"True":"False"}},defaultStyle:"lowercase"});function Fn(e){return 48<=e&&e<=57||65<=e&&e<=70||97<=e&&e<=102}function bn(e){return 48<=e&&e<=55}function Tn(e){return 48<=e&&e<=57}function On(e){if(e===null)return!1;var n=e.length,i=0,l=!1,r;if(!n)return!1;if(r=e[i],(r==="-"||r==="+")&&(r=e[++i]),r==="0"){if(i+1===n)return!0;if(r=e[++i],r==="b"){for(i++;i<n;i++)if(r=e[i],r!=="_"){if(r!=="0"&&r!=="1")return!1;l=!0}return l&&r!=="_"}if(r==="x"){for(i++;i<n;i++)if(r=e[i],r!=="_"){if(!Fn(e.charCodeAt(i)))return!1;l=!0}return l&&r!=="_"}if(r==="o"){for(i++;i<n;i++)if(r=e[i],r!=="_"){if(!bn(e.charCodeAt(i)))return!1;l=!0}return l&&r!=="_"}}if(r==="_")return!1;for(;i<n;i++)if(r=e[i],r!=="_"){if(!Tn(e.charCodeAt(i)))return!1;l=!0}return!(!l||r==="_")}function In(e){var n=e,i=1,l;if(n.indexOf("_")!==-1&&(n=n.replace(/_/g,"")),l=n[0],(l==="-"||l==="+")&&(l==="-"&&(i=-1),n=n.slice(1),l=n[0]),n==="0")return 0;if(l==="0"){if(n[1]==="b")return i*parseInt(n.slice(2),2);if(n[1]==="x")return i*parseInt(n.slice(2),16);if(n[1]==="o")return i*parseInt(n.slice(2),8)}return i*parseInt(n,10)}function Ln(e){return Object.prototype.toString.call(e)==="[object Number]"&&e%1===0&&!y.isNegativeZero(e)}var kn=new C("tag:yaml.org,2002:int",{kind:"scalar",resolve:On,construct:In,predicate:Ln,represent:{binary:function(e){return e>=0?"0b"+e.toString(2):"-0b"+e.toString(2).slice(1)},octal:function(e){return e>=0?"0o"+e.toString(8):"-0o"+e.toString(8).slice(1)},decimal:function(e){return e.toString(10)},hexadecimal:function(e){return e>=0?"0x"+e.toString(16).toUpperCase():"-0x"+e.toString(16).toUpperCase().slice(1)}},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}}),Nn=new RegExp("^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");function Rn(e){return!(e===null||!Nn.test(e)||e[e.length-1]==="_")}function Dn(e){var n,i;return n=e.replace(/_/g,"").toLowerCase(),i=n[0]==="-"?-1:1,"+-".indexOf(n[0])>=0&&(n=n.slice(1)),n===".inf"?i===1?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:n===".nan"?NaN:i*parseFloat(n,10)}var Mn=/^[-+]?[0-9]+e/;function Yn(e,n){var i;if(isNaN(e))switch(n){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===e)switch(n){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===e)switch(n){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(y.isNegativeZero(e))return"-0.0";return i=e.toString(10),Mn.test(i)?i.replace("e",".e"):i}function Bn(e){return Object.prototype.toString.call(e)==="[object Number]"&&(e%1!==0||y.isNegativeZero(e))}var Pn=new C("tag:yaml.org,2002:float",{kind:"scalar",resolve:Rn,construct:Dn,predicate:Bn,represent:Yn,defaultStyle:"lowercase"}),Hn=gn.extend({implicit:[Cn,Sn,kn,Pn]}),we=Hn,Ee=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),Se=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");function jn(e){return e===null?!1:Ee.exec(e)!==null||Se.exec(e)!==null}function Un(e){var n,i,l,r,u,o,f,c=0,a=null,t,p,d;if(n=Ee.exec(e),n===null&&(n=Se.exec(e)),n===null)throw new Error("Date resolve error");if(i=+n[1],l=+n[2]-1,r=+n[3],!n[4])return new Date(Date.UTC(i,l,r));if(u=+n[4],o=+n[5],f=+n[6],n[7]){for(c=n[7].slice(0,3);c.length<3;)c+="0";c=+c}return n[9]&&(t=+n[10],p=+(n[11]||0),a=(t*60+p)*6e4,n[9]==="-"&&(a=-a)),d=new Date(Date.UTC(i,l,r,u,o,f,c)),a&&d.setTime(d.getTime()-a),d}function Kn(e){return e.toISOString()}var qn=new C("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:jn,construct:Un,instanceOf:Date,represent:Kn});function Gn(e){return e==="<<"||e===null}var Wn=new C("tag:yaml.org,2002:merge",{kind:"scalar",resolve:Gn}),ne=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=
9
+ \r`;function $n(e){if(e===null)return!1;var n,i,l=0,r=e.length,u=ne;for(i=0;i<r;i++)if(n=u.indexOf(e.charAt(i)),!(n>64)){if(n<0)return!1;l+=6}return l%8===0}function Qn(e){var n,i,l=e.replace(/[\r\n=]/g,""),r=l.length,u=ne,o=0,f=[];for(n=0;n<r;n++)n%4===0&&n&&(f.push(o>>16&255),f.push(o>>8&255),f.push(o&255)),o=o<<6|u.indexOf(l.charAt(n));return i=r%4*6,i===0?(f.push(o>>16&255),f.push(o>>8&255),f.push(o&255)):i===18?(f.push(o>>10&255),f.push(o>>2&255)):i===12&&f.push(o>>4&255),new Uint8Array(f)}function Vn(e){var n="",i=0,l,r,u=e.length,o=ne;for(l=0;l<u;l++)l%3===0&&l&&(n+=o[i>>18&63],n+=o[i>>12&63],n+=o[i>>6&63],n+=o[i&63]),i=(i<<8)+e[l];return r=u%3,r===0?(n+=o[i>>18&63],n+=o[i>>12&63],n+=o[i>>6&63],n+=o[i&63]):r===2?(n+=o[i>>10&63],n+=o[i>>4&63],n+=o[i<<2&63],n+=o[64]):r===1&&(n+=o[i>>2&63],n+=o[i<<4&63],n+=o[64],n+=o[64]),n}function Xn(e){return Object.prototype.toString.call(e)==="[object Uint8Array]"}var Zn=new C("tag:yaml.org,2002:binary",{kind:"scalar",resolve:$n,construct:Qn,predicate:Xn,represent:Vn}),zn=Object.prototype.hasOwnProperty,Jn=Object.prototype.toString;function ei(e){if(e===null)return!0;var n=[],i,l,r,u,o,f=e;for(i=0,l=f.length;i<l;i+=1){if(r=f[i],o=!1,Jn.call(r)!=="[object Object]")return!1;for(u in r)if(zn.call(r,u))if(!o)o=!0;else return!1;if(!o)return!1;if(n.indexOf(u)===-1)n.push(u);else return!1}return!0}function ni(e){return e!==null?e:[]}var ii=new C("tag:yaml.org,2002:omap",{kind:"sequence",resolve:ei,construct:ni}),ri=Object.prototype.toString;function li(e){if(e===null)return!0;var n,i,l,r,u,o=e;for(u=new Array(o.length),n=0,i=o.length;n<i;n+=1){if(l=o[n],ri.call(l)!=="[object Object]"||(r=Object.keys(l),r.length!==1))return!1;u[n]=[r[0],l[r[0]]]}return!0}function oi(e){if(e===null)return[];var n,i,l,r,u,o=e;for(u=new Array(o.length),n=0,i=o.length;n<i;n+=1)l=o[n],r=Object.keys(l),u[n]=[r[0],l[r[0]]];return u}var ui=new C("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:li,construct:oi}),fi=Object.prototype.hasOwnProperty;function ci(e){if(e===null)return!0;var n,i=e;for(n in i)if(fi.call(i,n)&&i[n]!==null)return!1;return!0}function ai(e){return e!==null?e:{}}var pi=new C("tag:yaml.org,2002:set",{kind:"mapping",resolve:ci,construct:ai}),Fe=we.extend({implicit:[qn,Wn],explicit:[Zn,ii,ui,pi]}),O=Object.prototype.hasOwnProperty,j=1,be=2,Te=3,U=4,V=1,ti=2,fe=3,hi=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,di=/[\x85\u2028\u2029]/,si=/[,\[\]\{\}]/,Oe=/^(?:!|!!|![a-z\-]+!)$/i,Ie=/^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;function ce(e){return Object.prototype.toString.call(e)}function F(e){return e===10||e===13}function L(e){return e===9||e===32}function E(e){return e===9||e===32||e===10||e===13}function N(e){return e===44||e===91||e===93||e===123||e===125}function mi(e){var n;return 48<=e&&e<=57?e-48:(n=e|32,97<=n&&n<=102?n-97+10:-1)}function xi(e){return e===120?2:e===117?4:e===85?8:0}function gi(e){return 48<=e&&e<=57?e-48:-1}function ae(e){return e===48?"\0":e===97?"\x07":e===98?"\b":e===116||e===9?" ":e===110?`
10
+ `:e===118?"\v":e===102?"\f":e===114?"\r":e===101?"\x1B":e===32?" ":e===34?'"':e===47?"/":e===92?"\\":e===78?"\x85":e===95?"\xA0":e===76?"\u2028":e===80?"\u2029":""}function Ai(e){return e<=65535?String.fromCharCode(e):String.fromCharCode((e-65536>>10)+55296,(e-65536&1023)+56320)}function Le(e,n,i){n==="__proto__"?Object.defineProperty(e,n,{configurable:!0,enumerable:!0,writable:!0,value:i}):e[n]=i}var ke=new Array(256),Ne=new Array(256);for(I=0;I<256;I++)ke[I]=ae(I)?1:0,Ne[I]=ae(I);var I;function vi(e,n){this.input=e,this.filename=n.filename||null,this.schema=n.schema||Fe,this.onWarning=n.onWarning||null,this.legacy=n.legacy||!1,this.json=n.json||!1,this.listener=n.listener||null,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=e.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.firstTabInLine=-1,this.documents=[]}function Re(e,n){var i={name:e.filename,buffer:e.input.slice(0,-1),position:e.position,line:e.line,column:e.position-e.lineStart};return i.snippet=fn(i),new w(n,i)}function h(e,n){throw Re(e,n)}function K(e,n){e.onWarning&&e.onWarning.call(null,Re(e,n))}var pe={YAML:function(n,i,l){var r,u,o;n.version!==null&&h(n,"duplication of %YAML directive"),l.length!==1&&h(n,"YAML directive accepts exactly one argument"),r=/^([0-9]+)\.([0-9]+)$/.exec(l[0]),r===null&&h(n,"ill-formed argument of the YAML directive"),u=parseInt(r[1],10),o=parseInt(r[2],10),u!==1&&h(n,"unacceptable YAML version of the document"),n.version=l[0],n.checkLineBreaks=o<2,o!==1&&o!==2&&K(n,"unsupported YAML version of the document")},TAG:function(n,i,l){var r,u;l.length!==2&&h(n,"TAG directive accepts exactly two arguments"),r=l[0],u=l[1],Oe.test(r)||h(n,"ill-formed tag handle (first argument) of the TAG directive"),O.call(n.tagMap,r)&&h(n,'there is a previously declared suffix for "'+r+'" tag handle'),Ie.test(u)||h(n,"ill-formed tag prefix (second argument) of the TAG directive");try{u=decodeURIComponent(u)}catch{h(n,"tag prefix is malformed: "+u)}n.tagMap[r]=u}};function T(e,n,i,l){var r,u,o,f;if(n<i){if(f=e.input.slice(n,i),l)for(r=0,u=f.length;r<u;r+=1)o=f.charCodeAt(r),o===9||32<=o&&o<=1114111||h(e,"expected valid JSON character");else hi.test(f)&&h(e,"the stream contains non-printable characters");e.result+=f}}function te(e,n,i,l){var r,u,o,f;for(y.isObject(i)||h(e,"cannot merge mappings; the provided source object is unacceptable"),r=Object.keys(i),o=0,f=r.length;o<f;o+=1)u=r[o],O.call(n,u)||(Le(n,u,i[u]),l[u]=!0)}function R(e,n,i,l,r,u,o,f,c){var a,t;if(Array.isArray(r))for(r=Array.prototype.slice.call(r),a=0,t=r.length;a<t;a+=1)Array.isArray(r[a])&&h(e,"nested arrays are not supported inside keys"),typeof r=="object"&&ce(r[a])==="[object Object]"&&(r[a]="[object Object]");if(typeof r=="object"&&ce(r)==="[object Object]"&&(r="[object Object]"),r=String(r),n===null&&(n={}),l==="tag:yaml.org,2002:merge")if(Array.isArray(u))for(a=0,t=u.length;a<t;a+=1)te(e,n,u[a],i);else te(e,n,u,i);else!e.json&&!O.call(i,r)&&O.call(n,r)&&(e.line=o||e.line,e.lineStart=f||e.lineStart,e.position=c||e.position,h(e,"duplicated mapping key")),Le(n,r,u),delete i[r];return n}function ie(e){var n;n=e.input.charCodeAt(e.position),n===10?e.position++:n===13?(e.position++,e.input.charCodeAt(e.position)===10&&e.position++):h(e,"a line break is expected"),e.line+=1,e.lineStart=e.position,e.firstTabInLine=-1}function v(e,n,i){for(var l=0,r=e.input.charCodeAt(e.position);r!==0;){for(;L(r);)r===9&&e.firstTabInLine===-1&&(e.firstTabInLine=e.position),r=e.input.charCodeAt(++e.position);if(n&&r===35)do r=e.input.charCodeAt(++e.position);while(r!==10&&r!==13&&r!==0);if(F(r))for(ie(e),r=e.input.charCodeAt(e.position),l++,e.lineIndent=0;r===32;)e.lineIndent++,r=e.input.charCodeAt(++e.position);else break}return i!==-1&&l!==0&&e.lineIndent<i&&K(e,"deficient indentation"),l}function W(e){var n=e.position,i;return i=e.input.charCodeAt(n),!!((i===45||i===46)&&i===e.input.charCodeAt(n+1)&&i===e.input.charCodeAt(n+2)&&(n+=3,i=e.input.charCodeAt(n),i===0||E(i)))}function re(e,n){n===1?e.result+=" ":n>1&&(e.result+=y.repeat(`
11
+ `,n-1))}function yi(e,n,i){var l,r,u,o,f,c,a,t,p=e.kind,d=e.result,s;if(s=e.input.charCodeAt(e.position),E(s)||N(s)||s===35||s===38||s===42||s===33||s===124||s===62||s===39||s===34||s===37||s===64||s===96||(s===63||s===45)&&(r=e.input.charCodeAt(e.position+1),E(r)||i&&N(r)))return!1;for(e.kind="scalar",e.result="",u=o=e.position,f=!1;s!==0;){if(s===58){if(r=e.input.charCodeAt(e.position+1),E(r)||i&&N(r))break}else if(s===35){if(l=e.input.charCodeAt(e.position-1),E(l))break}else{if(e.position===e.lineStart&&W(e)||i&&N(s))break;if(F(s))if(c=e.line,a=e.lineStart,t=e.lineIndent,v(e,!1,-1),e.lineIndent>=n){f=!0,s=e.input.charCodeAt(e.position);continue}else{e.position=o,e.line=c,e.lineStart=a,e.lineIndent=t;break}}f&&(T(e,u,o,!1),re(e,e.line-c),u=o=e.position,f=!1),L(s)||(o=e.position+1),s=e.input.charCodeAt(++e.position)}return T(e,u,o,!1),e.result?!0:(e.kind=p,e.result=d,!1)}function Ci(e,n){var i,l,r;if(i=e.input.charCodeAt(e.position),i!==39)return!1;for(e.kind="scalar",e.result="",e.position++,l=r=e.position;(i=e.input.charCodeAt(e.position))!==0;)if(i===39)if(T(e,l,e.position,!0),i=e.input.charCodeAt(++e.position),i===39)l=e.position,e.position++,r=e.position;else return!0;else F(i)?(T(e,l,r,!0),re(e,v(e,!1,n)),l=r=e.position):e.position===e.lineStart&&W(e)?h(e,"unexpected end of the document within a single quoted scalar"):(e.position++,r=e.position);h(e,"unexpected end of the stream within a single quoted scalar")}function _i(e,n){var i,l,r,u,o,f;if(f=e.input.charCodeAt(e.position),f!==34)return!1;for(e.kind="scalar",e.result="",e.position++,i=l=e.position;(f=e.input.charCodeAt(e.position))!==0;){if(f===34)return T(e,i,e.position,!0),e.position++,!0;if(f===92){if(T(e,i,e.position,!0),f=e.input.charCodeAt(++e.position),F(f))v(e,!1,n);else if(f<256&&ke[f])e.result+=Ne[f],e.position++;else if((o=xi(f))>0){for(r=o,u=0;r>0;r--)f=e.input.charCodeAt(++e.position),(o=mi(f))>=0?u=(u<<4)+o:h(e,"expected hexadecimal character");e.result+=Ai(u),e.position++}else h(e,"unknown escape sequence");i=l=e.position}else F(f)?(T(e,i,l,!0),re(e,v(e,!1,n)),i=l=e.position):e.position===e.lineStart&&W(e)?h(e,"unexpected end of the document within a double quoted scalar"):(e.position++,l=e.position)}h(e,"unexpected end of the stream within a double quoted scalar")}function wi(e,n){var i=!0,l,r,u,o=e.tag,f,c=e.anchor,a,t,p,d,s,m=Object.create(null),g,A,S,x;if(x=e.input.charCodeAt(e.position),x===91)t=93,s=!1,f=[];else if(x===123)t=125,s=!0,f={};else return!1;for(e.anchor!==null&&(e.anchorMap[e.anchor]=f),x=e.input.charCodeAt(++e.position);x!==0;){if(v(e,!0,n),x=e.input.charCodeAt(e.position),x===t)return e.position++,e.tag=o,e.anchor=c,e.kind=s?"mapping":"sequence",e.result=f,!0;i?x===44&&h(e,"expected the node content, but found ','"):h(e,"missed comma between flow collection entries"),A=g=S=null,p=d=!1,x===63&&(a=e.input.charCodeAt(e.position+1),E(a)&&(p=d=!0,e.position++,v(e,!0,n))),l=e.line,r=e.lineStart,u=e.position,D(e,n,j,!1,!0),A=e.tag,g=e.result,v(e,!0,n),x=e.input.charCodeAt(e.position),(d||e.line===l)&&x===58&&(p=!0,x=e.input.charCodeAt(++e.position),v(e,!0,n),D(e,n,j,!1,!0),S=e.result),s?R(e,f,m,A,g,S,l,r,u):p?f.push(R(e,null,m,A,g,S,l,r,u)):f.push(g),v(e,!0,n),x=e.input.charCodeAt(e.position),x===44?(i=!0,x=e.input.charCodeAt(++e.position)):i=!1}h(e,"unexpected end of the stream within a flow collection")}function Ei(e,n){var i,l,r=V,u=!1,o=!1,f=n,c=0,a=!1,t,p;if(p=e.input.charCodeAt(e.position),p===124)l=!1;else if(p===62)l=!0;else return!1;for(e.kind="scalar",e.result="";p!==0;)if(p=e.input.charCodeAt(++e.position),p===43||p===45)V===r?r=p===43?fe:ti:h(e,"repeat of a chomping mode identifier");else if((t=gi(p))>=0)t===0?h(e,"bad explicit indentation width of a block scalar; it cannot be less than one"):o?h(e,"repeat of an indentation width identifier"):(f=n+t-1,o=!0);else break;if(L(p)){do p=e.input.charCodeAt(++e.position);while(L(p));if(p===35)do p=e.input.charCodeAt(++e.position);while(!F(p)&&p!==0)}for(;p!==0;){for(ie(e),e.lineIndent=0,p=e.input.charCodeAt(e.position);(!o||e.lineIndent<f)&&p===32;)e.lineIndent++,p=e.input.charCodeAt(++e.position);if(!o&&e.lineIndent>f&&(f=e.lineIndent),F(p)){c++;continue}if(e.lineIndent<f){r===fe?e.result+=y.repeat(`
12
12
  `,u?1+c:c):r===V&&u&&(e.result+=`
13
13
  `);break}for(l?L(p)?(a=!0,e.result+=y.repeat(`
14
14
  `,u?1+c:c)):a?(a=!1,e.result+=y.repeat(`
15
15
  `,c+1)):c===0?u&&(e.result+=" "):e.result+=y.repeat(`
16
16
  `,c):e.result+=y.repeat(`
17
- `,u?1+c:c),u=!0,o=!0,c=0,i=e.position;!F(p)&&p!==0;)p=e.input.charCodeAt(++e.position);T(e,i,e.position,!1)}return!0}function he(e,n){var i,l=e.tag,r=e.anchor,u=[],o,f=!1,c;if(e.firstTabInLine!==-1)return!1;for(e.anchor!==null&&(e.anchorMap[e.anchor]=u),c=e.input.charCodeAt(e.position);c!==0&&(e.firstTabInLine!==-1&&(e.position=e.firstTabInLine,h(e,"tab characters must not be used in indentation")),!(c!==45||(o=e.input.charCodeAt(e.position+1),!E(o))));){if(f=!0,e.position++,v(e,!0,-1)&&e.lineIndent<=n){u.push(null),c=e.input.charCodeAt(e.position);continue}if(i=e.line,D(e,n,be,!1,!0),u.push(e.result),v(e,!0,-1),c=e.input.charCodeAt(e.position),(e.line===i||e.lineIndent>n)&&c!==0)h(e,"bad indentation of a sequence entry");else if(e.lineIndent<n)break}return f?(e.tag=l,e.anchor=r,e.kind="sequence",e.result=u,!0):!1}function Si(e,n,i){var l,r,u,o,f,c,a=e.tag,t=e.anchor,p={},d=Object.create(null),s=null,m=null,g=null,A=!1,S=!1,x;if(e.firstTabInLine!==-1)return!1;for(e.anchor!==null&&(e.anchorMap[e.anchor]=p),x=e.input.charCodeAt(e.position);x!==0;){if(!A&&e.firstTabInLine!==-1&&(e.position=e.firstTabInLine,h(e,"tab characters must not be used in indentation")),l=e.input.charCodeAt(e.position+1),u=e.line,(x===63||x===58)&&E(l))x===63?(A&&(R(e,p,d,s,m,null,o,f,c),s=m=g=null),S=!0,A=!0,r=!0):A?(A=!1,r=!0):h(e,"incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line"),e.position+=1,x=l;else{if(o=e.line,f=e.lineStart,c=e.position,!D(e,i,Fe,!1,!0))break;if(e.line===u){for(x=e.input.charCodeAt(e.position);L(x);)x=e.input.charCodeAt(++e.position);if(x===58)x=e.input.charCodeAt(++e.position),E(x)||h(e,"a whitespace character is expected after the key-value separator within a block mapping"),A&&(R(e,p,d,s,m,null,o,f,c),s=m=g=null),S=!0,A=!1,r=!1,s=e.tag,m=e.result;else if(S)h(e,"can not read an implicit mapping pair; a colon is missed");else return e.tag=a,e.anchor=t,!0}else if(S)h(e,"can not read a block mapping entry; a multiline key may not be an implicit key");else return e.tag=a,e.anchor=t,!0}if((e.line===u||e.lineIndent>n)&&(A&&(o=e.line,f=e.lineStart,c=e.position),D(e,n,U,!0,r)&&(A?m=e.result:g=e.result),A||(R(e,p,d,s,m,g,o,f,c),s=m=g=null),v(e,!0,-1),x=e.input.charCodeAt(e.position)),(e.line===u||e.lineIndent>n)&&x!==0)h(e,"bad indentation of a mapping entry");else if(e.lineIndent<n)break}return A&&R(e,p,d,s,m,null,o,f,c),S&&(e.tag=a,e.anchor=t,e.kind="mapping",e.result=p),S}function Fi(e){var n,i=!1,l=!1,r,u,o;if(o=e.input.charCodeAt(e.position),o!==33)return!1;if(e.tag!==null&&h(e,"duplication of a tag property"),o=e.input.charCodeAt(++e.position),o===60?(i=!0,o=e.input.charCodeAt(++e.position)):o===33?(l=!0,r="!!",o=e.input.charCodeAt(++e.position)):r="!",n=e.position,i){do o=e.input.charCodeAt(++e.position);while(o!==0&&o!==62);e.position<e.length?(u=e.input.slice(n,e.position),o=e.input.charCodeAt(++e.position)):h(e,"unexpected end of the stream within a verbatim tag")}else{for(;o!==0&&!E(o);)o===33&&(l?h(e,"tag suffix cannot contain exclamation marks"):(r=e.input.slice(n-1,e.position+1),Te.test(r)||h(e,"named tag handle cannot contain such characters"),l=!0,n=e.position+1)),o=e.input.charCodeAt(++e.position);u=e.input.slice(n,e.position),si.test(u)&&h(e,"tag suffix cannot contain flow indicator characters")}u&&!Oe.test(u)&&h(e,"tag name cannot contain such characters: "+u);try{u=decodeURIComponent(u)}catch{h(e,"tag name is malformed: "+u)}return i?e.tag=u:O.call(e.tagMap,r)?e.tag=e.tagMap[r]+u:r==="!"?e.tag="!"+u:r==="!!"?e.tag="tag:yaml.org,2002:"+u:h(e,'undeclared tag handle "'+r+'"'),!0}function bi(e){var n,i;if(i=e.input.charCodeAt(e.position),i!==38)return!1;for(e.anchor!==null&&h(e,"duplication of an anchor property"),i=e.input.charCodeAt(++e.position),n=e.position;i!==0&&!E(i)&&!N(i);)i=e.input.charCodeAt(++e.position);return e.position===n&&h(e,"name of an anchor node must contain at least one character"),e.anchor=e.input.slice(n,e.position),!0}function Ti(e){var n,i,l;if(l=e.input.charCodeAt(e.position),l!==42)return!1;for(l=e.input.charCodeAt(++e.position),n=e.position;l!==0&&!E(l)&&!N(l);)l=e.input.charCodeAt(++e.position);return e.position===n&&h(e,"name of an alias node must contain at least one character"),i=e.input.slice(n,e.position),O.call(e.anchorMap,i)||h(e,'unidentified alias "'+i+'"'),e.result=e.anchorMap[i],v(e,!0,-1),!0}function D(e,n,i,l,r){var u,o,f,c=1,a=!1,t=!1,p,d,s,m,g,A;if(e.listener!==null&&e.listener("open",e),e.tag=null,e.anchor=null,e.kind=null,e.result=null,u=o=f=U===i||be===i,l&&v(e,!0,-1)&&(a=!0,e.lineIndent>n?c=1:e.lineIndent===n?c=0:e.lineIndent<n&&(c=-1)),c===1)for(;Fi(e)||bi(e);)v(e,!0,-1)?(a=!0,f=u,e.lineIndent>n?c=1:e.lineIndent===n?c=0:e.lineIndent<n&&(c=-1)):f=!1;if(f&&(f=a||r),(c===1||U===i)&&(j===i||Fe===i?g=n:g=n+1,A=e.position-e.lineStart,c===1?f&&(he(e,A)||Si(e,A,g))||wi(e,g)?t=!0:(o&&Ei(e,g)||Ci(e,g)||_i(e,g)?t=!0:Ti(e)?(t=!0,(e.tag!==null||e.anchor!==null)&&h(e,"alias node should not have any properties")):yi(e,g,j===i)&&(t=!0,e.tag===null&&(e.tag="?")),e.anchor!==null&&(e.anchorMap[e.anchor]=e.result)):c===0&&(t=f&&he(e,A))),e.tag===null)e.anchor!==null&&(e.anchorMap[e.anchor]=e.result);else if(e.tag==="?"){for(e.result!==null&&e.kind!=="scalar"&&h(e,'unacceptable node kind for !<?> tag; it should be "scalar", not "'+e.kind+'"'),p=0,d=e.implicitTypes.length;p<d;p+=1)if(m=e.implicitTypes[p],m.resolve(e.result)){e.result=m.construct(e.result),e.tag=m.tag,e.anchor!==null&&(e.anchorMap[e.anchor]=e.result);break}}else if(e.tag!=="!"){if(O.call(e.typeMap[e.kind||"fallback"],e.tag))m=e.typeMap[e.kind||"fallback"][e.tag];else for(m=null,s=e.typeMap.multi[e.kind||"fallback"],p=0,d=s.length;p<d;p+=1)if(e.tag.slice(0,s[p].tag.length)===s[p].tag){m=s[p];break}m||h(e,"unknown tag !<"+e.tag+">"),e.result!==null&&m.kind!==e.kind&&h(e,"unacceptable node kind for !<"+e.tag+'> tag; it should be "'+m.kind+'", not "'+e.kind+'"'),m.resolve(e.result,e.tag)?(e.result=m.construct(e.result,e.tag),e.anchor!==null&&(e.anchorMap[e.anchor]=e.result)):h(e,"cannot resolve a node with !<"+e.tag+"> explicit tag")}return e.listener!==null&&e.listener("close",e),e.tag!==null||e.anchor!==null||t}function Oi(e){var n=e.position,i,l,r,u=!1,o;for(e.version=null,e.checkLineBreaks=e.legacy,e.tagMap=Object.create(null),e.anchorMap=Object.create(null);(o=e.input.charCodeAt(e.position))!==0&&(v(e,!0,-1),o=e.input.charCodeAt(e.position),!(e.lineIndent>0||o!==37));){for(u=!0,o=e.input.charCodeAt(++e.position),i=e.position;o!==0&&!E(o);)o=e.input.charCodeAt(++e.position);for(l=e.input.slice(i,e.position),r=[],l.length<1&&h(e,"directive name must not be less than one character in length");o!==0;){for(;L(o);)o=e.input.charCodeAt(++e.position);if(o===35){do o=e.input.charCodeAt(++e.position);while(o!==0&&!F(o));break}if(F(o))break;for(i=e.position;o!==0&&!E(o);)o=e.input.charCodeAt(++e.position);r.push(e.input.slice(i,e.position))}o!==0&&ie(e),O.call(pe,l)?pe[l](e,l,r):K(e,'unknown document directive "'+l+'"')}if(v(e,!0,-1),e.lineIndent===0&&e.input.charCodeAt(e.position)===45&&e.input.charCodeAt(e.position+1)===45&&e.input.charCodeAt(e.position+2)===45?(e.position+=3,v(e,!0,-1)):u&&h(e,"directives end mark is expected"),D(e,e.lineIndent-1,U,!1,!0),v(e,!0,-1),e.checkLineBreaks&&di.test(e.input.slice(n,e.position))&&K(e,"non-ASCII line breaks are interpreted as content"),e.documents.push(e.result),e.position===e.lineStart&&W(e)){e.input.charCodeAt(e.position)===46&&(e.position+=3,v(e,!0,-1));return}if(e.position<e.length-1)h(e,"end of the stream or a document separator is expected");else return}function Re(e,n){e=String(e),n=n||{},e.length!==0&&(e.charCodeAt(e.length-1)!==10&&e.charCodeAt(e.length-1)!==13&&(e+=`
18
- `),e.charCodeAt(0)===65279&&(e=e.slice(1)));var i=new vi(e,n),l=e.indexOf("\0");for(l!==-1&&(i.position=l,h(i,"null byte is not allowed in input")),i.input+="\0";i.input.charCodeAt(i.position)===32;)i.lineIndent+=1,i.position+=1;for(;i.position<i.length-1;)Oi(i);return i.documents}function Ii(e,n,i){n!==null&&typeof n=="object"&&typeof i>"u"&&(i=n,n=null);var l=Re(e,i);if(typeof n!="function")return l;for(var r=0,u=l.length;r<u;r+=1)n(l[r])}function Li(e,n){var i=Re(e,n);if(i.length!==0){if(i.length===1)return i[0];throw new w("expected a single document in the stream, but found more")}}var ki=Ii,Ni=Li,De={loadAll:ki,load:Ni},Me=Object.prototype.toString,Ye=Object.prototype.hasOwnProperty,le=65279,Ri=9,B=10,Di=13,Mi=32,Yi=33,Bi=34,Z=35,Pi=37,Hi=38,ji=39,Ui=42,Be=44,Ki=45,q=58,qi=61,Gi=62,Wi=63,$i=64,Pe=91,He=93,Qi=96,je=123,Vi=124,Ue=125,_={};_[0]="\\0";_[7]="\\a";_[8]="\\b";_[9]="\\t";_[10]="\\n";_[11]="\\v";_[12]="\\f";_[13]="\\r";_[27]="\\e";_[34]='\\"';_[92]="\\\\";_[133]="\\N";_[160]="\\_";_[8232]="\\L";_[8233]="\\P";var Xi=["y","Y","yes","Yes","YES","on","On","ON","n","N","no","No","NO","off","Off","OFF"],Zi=/^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;function zi(e,n){var i,l,r,u,o,f,c;if(n===null)return{};for(i={},l=Object.keys(n),r=0,u=l.length;r<u;r+=1)o=l[r],f=String(n[o]),o.slice(0,2)==="!!"&&(o="tag:yaml.org,2002:"+o.slice(2)),c=e.compiledTypeMap.fallback[o],c&&Ye.call(c.styleAliases,f)&&(f=c.styleAliases[f]),i[o]=f;return i}function Ji(e){var n,i,l;if(n=e.toString(16).toUpperCase(),e<=255)i="x",l=2;else if(e<=65535)i="u",l=4;else if(e<=4294967295)i="U",l=8;else throw new w("code point within a string may not be greater than 0xFFFFFFFF");return"\\"+i+y.repeat("0",l-n.length)+n}var er=1,P=2;function nr(e){this.schema=e.schema||Se,this.indent=Math.max(1,e.indent||2),this.noArrayIndent=e.noArrayIndent||!1,this.skipInvalid=e.skipInvalid||!1,this.flowLevel=y.isNothing(e.flowLevel)?-1:e.flowLevel,this.styleMap=zi(this.schema,e.styles||null),this.sortKeys=e.sortKeys||!1,this.lineWidth=e.lineWidth||80,this.noRefs=e.noRefs||!1,this.noCompatMode=e.noCompatMode||!1,this.condenseFlow=e.condenseFlow||!1,this.quotingType=e.quotingType==='"'?P:er,this.forceQuotes=e.forceQuotes||!1,this.replacer=typeof e.replacer=="function"?e.replacer:null,this.implicitTypes=this.schema.compiledImplicit,this.explicitTypes=this.schema.compiledExplicit,this.tag=null,this.result="",this.duplicates=[],this.usedDuplicates=null}function de(e,n){for(var i=y.repeat(" ",n),l=0,r=-1,u="",o,f=e.length;l<f;)r=e.indexOf(`
17
+ `,u?1+c:c),u=!0,o=!0,c=0,i=e.position;!F(p)&&p!==0;)p=e.input.charCodeAt(++e.position);T(e,i,e.position,!1)}return!0}function he(e,n){var i,l=e.tag,r=e.anchor,u=[],o,f=!1,c;if(e.firstTabInLine!==-1)return!1;for(e.anchor!==null&&(e.anchorMap[e.anchor]=u),c=e.input.charCodeAt(e.position);c!==0&&(e.firstTabInLine!==-1&&(e.position=e.firstTabInLine,h(e,"tab characters must not be used in indentation")),!(c!==45||(o=e.input.charCodeAt(e.position+1),!E(o))));){if(f=!0,e.position++,v(e,!0,-1)&&e.lineIndent<=n){u.push(null),c=e.input.charCodeAt(e.position);continue}if(i=e.line,D(e,n,Te,!1,!0),u.push(e.result),v(e,!0,-1),c=e.input.charCodeAt(e.position),(e.line===i||e.lineIndent>n)&&c!==0)h(e,"bad indentation of a sequence entry");else if(e.lineIndent<n)break}return f?(e.tag=l,e.anchor=r,e.kind="sequence",e.result=u,!0):!1}function Si(e,n,i){var l,r,u,o,f,c,a=e.tag,t=e.anchor,p={},d=Object.create(null),s=null,m=null,g=null,A=!1,S=!1,x;if(e.firstTabInLine!==-1)return!1;for(e.anchor!==null&&(e.anchorMap[e.anchor]=p),x=e.input.charCodeAt(e.position);x!==0;){if(!A&&e.firstTabInLine!==-1&&(e.position=e.firstTabInLine,h(e,"tab characters must not be used in indentation")),l=e.input.charCodeAt(e.position+1),u=e.line,(x===63||x===58)&&E(l))x===63?(A&&(R(e,p,d,s,m,null,o,f,c),s=m=g=null),S=!0,A=!0,r=!0):A?(A=!1,r=!0):h(e,"incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line"),e.position+=1,x=l;else{if(o=e.line,f=e.lineStart,c=e.position,!D(e,i,be,!1,!0))break;if(e.line===u){for(x=e.input.charCodeAt(e.position);L(x);)x=e.input.charCodeAt(++e.position);if(x===58)x=e.input.charCodeAt(++e.position),E(x)||h(e,"a whitespace character is expected after the key-value separator within a block mapping"),A&&(R(e,p,d,s,m,null,o,f,c),s=m=g=null),S=!0,A=!1,r=!1,s=e.tag,m=e.result;else if(S)h(e,"can not read an implicit mapping pair; a colon is missed");else return e.tag=a,e.anchor=t,!0}else if(S)h(e,"can not read a block mapping entry; a multiline key may not be an implicit key");else return e.tag=a,e.anchor=t,!0}if((e.line===u||e.lineIndent>n)&&(A&&(o=e.line,f=e.lineStart,c=e.position),D(e,n,U,!0,r)&&(A?m=e.result:g=e.result),A||(R(e,p,d,s,m,g,o,f,c),s=m=g=null),v(e,!0,-1),x=e.input.charCodeAt(e.position)),(e.line===u||e.lineIndent>n)&&x!==0)h(e,"bad indentation of a mapping entry");else if(e.lineIndent<n)break}return A&&R(e,p,d,s,m,null,o,f,c),S&&(e.tag=a,e.anchor=t,e.kind="mapping",e.result=p),S}function Fi(e){var n,i=!1,l=!1,r,u,o;if(o=e.input.charCodeAt(e.position),o!==33)return!1;if(e.tag!==null&&h(e,"duplication of a tag property"),o=e.input.charCodeAt(++e.position),o===60?(i=!0,o=e.input.charCodeAt(++e.position)):o===33?(l=!0,r="!!",o=e.input.charCodeAt(++e.position)):r="!",n=e.position,i){do o=e.input.charCodeAt(++e.position);while(o!==0&&o!==62);e.position<e.length?(u=e.input.slice(n,e.position),o=e.input.charCodeAt(++e.position)):h(e,"unexpected end of the stream within a verbatim tag")}else{for(;o!==0&&!E(o);)o===33&&(l?h(e,"tag suffix cannot contain exclamation marks"):(r=e.input.slice(n-1,e.position+1),Oe.test(r)||h(e,"named tag handle cannot contain such characters"),l=!0,n=e.position+1)),o=e.input.charCodeAt(++e.position);u=e.input.slice(n,e.position),si.test(u)&&h(e,"tag suffix cannot contain flow indicator characters")}u&&!Ie.test(u)&&h(e,"tag name cannot contain such characters: "+u);try{u=decodeURIComponent(u)}catch{h(e,"tag name is malformed: "+u)}return i?e.tag=u:O.call(e.tagMap,r)?e.tag=e.tagMap[r]+u:r==="!"?e.tag="!"+u:r==="!!"?e.tag="tag:yaml.org,2002:"+u:h(e,'undeclared tag handle "'+r+'"'),!0}function bi(e){var n,i;if(i=e.input.charCodeAt(e.position),i!==38)return!1;for(e.anchor!==null&&h(e,"duplication of an anchor property"),i=e.input.charCodeAt(++e.position),n=e.position;i!==0&&!E(i)&&!N(i);)i=e.input.charCodeAt(++e.position);return e.position===n&&h(e,"name of an anchor node must contain at least one character"),e.anchor=e.input.slice(n,e.position),!0}function Ti(e){var n,i,l;if(l=e.input.charCodeAt(e.position),l!==42)return!1;for(l=e.input.charCodeAt(++e.position),n=e.position;l!==0&&!E(l)&&!N(l);)l=e.input.charCodeAt(++e.position);return e.position===n&&h(e,"name of an alias node must contain at least one character"),i=e.input.slice(n,e.position),O.call(e.anchorMap,i)||h(e,'unidentified alias "'+i+'"'),e.result=e.anchorMap[i],v(e,!0,-1),!0}function D(e,n,i,l,r){var u,o,f,c=1,a=!1,t=!1,p,d,s,m,g,A;if(e.listener!==null&&e.listener("open",e),e.tag=null,e.anchor=null,e.kind=null,e.result=null,u=o=f=U===i||Te===i,l&&v(e,!0,-1)&&(a=!0,e.lineIndent>n?c=1:e.lineIndent===n?c=0:e.lineIndent<n&&(c=-1)),c===1)for(;Fi(e)||bi(e);)v(e,!0,-1)?(a=!0,f=u,e.lineIndent>n?c=1:e.lineIndent===n?c=0:e.lineIndent<n&&(c=-1)):f=!1;if(f&&(f=a||r),(c===1||U===i)&&(j===i||be===i?g=n:g=n+1,A=e.position-e.lineStart,c===1?f&&(he(e,A)||Si(e,A,g))||wi(e,g)?t=!0:(o&&Ei(e,g)||Ci(e,g)||_i(e,g)?t=!0:Ti(e)?(t=!0,(e.tag!==null||e.anchor!==null)&&h(e,"alias node should not have any properties")):yi(e,g,j===i)&&(t=!0,e.tag===null&&(e.tag="?")),e.anchor!==null&&(e.anchorMap[e.anchor]=e.result)):c===0&&(t=f&&he(e,A))),e.tag===null)e.anchor!==null&&(e.anchorMap[e.anchor]=e.result);else if(e.tag==="?"){for(e.result!==null&&e.kind!=="scalar"&&h(e,'unacceptable node kind for !<?> tag; it should be "scalar", not "'+e.kind+'"'),p=0,d=e.implicitTypes.length;p<d;p+=1)if(m=e.implicitTypes[p],m.resolve(e.result)){e.result=m.construct(e.result),e.tag=m.tag,e.anchor!==null&&(e.anchorMap[e.anchor]=e.result);break}}else if(e.tag!=="!"){if(O.call(e.typeMap[e.kind||"fallback"],e.tag))m=e.typeMap[e.kind||"fallback"][e.tag];else for(m=null,s=e.typeMap.multi[e.kind||"fallback"],p=0,d=s.length;p<d;p+=1)if(e.tag.slice(0,s[p].tag.length)===s[p].tag){m=s[p];break}m||h(e,"unknown tag !<"+e.tag+">"),e.result!==null&&m.kind!==e.kind&&h(e,"unacceptable node kind for !<"+e.tag+'> tag; it should be "'+m.kind+'", not "'+e.kind+'"'),m.resolve(e.result,e.tag)?(e.result=m.construct(e.result,e.tag),e.anchor!==null&&(e.anchorMap[e.anchor]=e.result)):h(e,"cannot resolve a node with !<"+e.tag+"> explicit tag")}return e.listener!==null&&e.listener("close",e),e.tag!==null||e.anchor!==null||t}function Oi(e){var n=e.position,i,l,r,u=!1,o;for(e.version=null,e.checkLineBreaks=e.legacy,e.tagMap=Object.create(null),e.anchorMap=Object.create(null);(o=e.input.charCodeAt(e.position))!==0&&(v(e,!0,-1),o=e.input.charCodeAt(e.position),!(e.lineIndent>0||o!==37));){for(u=!0,o=e.input.charCodeAt(++e.position),i=e.position;o!==0&&!E(o);)o=e.input.charCodeAt(++e.position);for(l=e.input.slice(i,e.position),r=[],l.length<1&&h(e,"directive name must not be less than one character in length");o!==0;){for(;L(o);)o=e.input.charCodeAt(++e.position);if(o===35){do o=e.input.charCodeAt(++e.position);while(o!==0&&!F(o));break}if(F(o))break;for(i=e.position;o!==0&&!E(o);)o=e.input.charCodeAt(++e.position);r.push(e.input.slice(i,e.position))}o!==0&&ie(e),O.call(pe,l)?pe[l](e,l,r):K(e,'unknown document directive "'+l+'"')}if(v(e,!0,-1),e.lineIndent===0&&e.input.charCodeAt(e.position)===45&&e.input.charCodeAt(e.position+1)===45&&e.input.charCodeAt(e.position+2)===45?(e.position+=3,v(e,!0,-1)):u&&h(e,"directives end mark is expected"),D(e,e.lineIndent-1,U,!1,!0),v(e,!0,-1),e.checkLineBreaks&&di.test(e.input.slice(n,e.position))&&K(e,"non-ASCII line breaks are interpreted as content"),e.documents.push(e.result),e.position===e.lineStart&&W(e)){e.input.charCodeAt(e.position)===46&&(e.position+=3,v(e,!0,-1));return}if(e.position<e.length-1)h(e,"end of the stream or a document separator is expected");else return}function De(e,n){e=String(e),n=n||{},e.length!==0&&(e.charCodeAt(e.length-1)!==10&&e.charCodeAt(e.length-1)!==13&&(e+=`
18
+ `),e.charCodeAt(0)===65279&&(e=e.slice(1)));var i=new vi(e,n),l=e.indexOf("\0");for(l!==-1&&(i.position=l,h(i,"null byte is not allowed in input")),i.input+="\0";i.input.charCodeAt(i.position)===32;)i.lineIndent+=1,i.position+=1;for(;i.position<i.length-1;)Oi(i);return i.documents}function Ii(e,n,i){n!==null&&typeof n=="object"&&typeof i>"u"&&(i=n,n=null);var l=De(e,i);if(typeof n!="function")return l;for(var r=0,u=l.length;r<u;r+=1)n(l[r])}function Li(e,n){var i=De(e,n);if(i.length!==0){if(i.length===1)return i[0];throw new w("expected a single document in the stream, but found more")}}var ki=Ii,Ni=Li,Me={loadAll:ki,load:Ni},Ye=Object.prototype.toString,Be=Object.prototype.hasOwnProperty,le=65279,Ri=9,B=10,Di=13,Mi=32,Yi=33,Bi=34,Z=35,Pi=37,Hi=38,ji=39,Ui=42,Pe=44,Ki=45,q=58,qi=61,Gi=62,Wi=63,$i=64,He=91,je=93,Qi=96,Ue=123,Vi=124,Ke=125,_={};_[0]="\\0";_[7]="\\a";_[8]="\\b";_[9]="\\t";_[10]="\\n";_[11]="\\v";_[12]="\\f";_[13]="\\r";_[27]="\\e";_[34]='\\"';_[92]="\\\\";_[133]="\\N";_[160]="\\_";_[8232]="\\L";_[8233]="\\P";var Xi=["y","Y","yes","Yes","YES","on","On","ON","n","N","no","No","NO","off","Off","OFF"],Zi=/^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;function zi(e,n){var i,l,r,u,o,f,c;if(n===null)return{};for(i={},l=Object.keys(n),r=0,u=l.length;r<u;r+=1)o=l[r],f=String(n[o]),o.slice(0,2)==="!!"&&(o="tag:yaml.org,2002:"+o.slice(2)),c=e.compiledTypeMap.fallback[o],c&&Be.call(c.styleAliases,f)&&(f=c.styleAliases[f]),i[o]=f;return i}function Ji(e){var n,i,l;if(n=e.toString(16).toUpperCase(),e<=255)i="x",l=2;else if(e<=65535)i="u",l=4;else if(e<=4294967295)i="U",l=8;else throw new w("code point within a string may not be greater than 0xFFFFFFFF");return"\\"+i+y.repeat("0",l-n.length)+n}var er=1,P=2;function nr(e){this.schema=e.schema||Fe,this.indent=Math.max(1,e.indent||2),this.noArrayIndent=e.noArrayIndent||!1,this.skipInvalid=e.skipInvalid||!1,this.flowLevel=y.isNothing(e.flowLevel)?-1:e.flowLevel,this.styleMap=zi(this.schema,e.styles||null),this.sortKeys=e.sortKeys||!1,this.lineWidth=e.lineWidth||80,this.noRefs=e.noRefs||!1,this.noCompatMode=e.noCompatMode||!1,this.condenseFlow=e.condenseFlow||!1,this.quotingType=e.quotingType==='"'?P:er,this.forceQuotes=e.forceQuotes||!1,this.replacer=typeof e.replacer=="function"?e.replacer:null,this.implicitTypes=this.schema.compiledImplicit,this.explicitTypes=this.schema.compiledExplicit,this.tag=null,this.result="",this.duplicates=[],this.usedDuplicates=null}function de(e,n){for(var i=y.repeat(" ",n),l=0,r=-1,u="",o,f=e.length;l<f;)r=e.indexOf(`
19
19
  `,l),r===-1?(o=e.slice(l),l=f):(o=e.slice(l,r+1),l=r+1),o.length&&o!==`
20
20
  `&&(u+=i),u+=o;return u}function z(e,n){return`
21
- `+y.repeat(" ",e.indent*n)}function ir(e,n){var i,l,r;for(i=0,l=e.implicitTypes.length;i<l;i+=1)if(r=e.implicitTypes[i],r.resolve(n))return!0;return!1}function G(e){return e===Mi||e===Ri}function H(e){return 32<=e&&e<=126||161<=e&&e<=55295&&e!==8232&&e!==8233||57344<=e&&e<=65533&&e!==le||65536<=e&&e<=1114111}function se(e){return H(e)&&e!==le&&e!==Di&&e!==B}function me(e,n,i){var l=se(e),r=l&&!G(e);return(i?l:l&&e!==Be&&e!==Pe&&e!==He&&e!==je&&e!==Ue)&&e!==Z&&!(n===q&&!r)||se(n)&&!G(n)&&e===Z||n===q&&r}function rr(e){return H(e)&&e!==le&&!G(e)&&e!==Ki&&e!==Wi&&e!==q&&e!==Be&&e!==Pe&&e!==He&&e!==je&&e!==Ue&&e!==Z&&e!==Hi&&e!==Ui&&e!==Yi&&e!==Vi&&e!==qi&&e!==Gi&&e!==ji&&e!==Bi&&e!==Pi&&e!==$i&&e!==Qi}function lr(e){return!G(e)&&e!==q}function M(e,n){var i=e.charCodeAt(n),l;return i>=55296&&i<=56319&&n+1<e.length&&(l=e.charCodeAt(n+1),l>=56320&&l<=57343)?(i-55296)*1024+l-56320+65536:i}function Ke(e){var n=/^\n* /;return n.test(e)}var qe=1,J=2,Ge=3,We=4,k=5;function or(e,n,i,l,r,u,o,f){var c,a=0,t=null,p=!1,d=!1,s=l!==-1,m=-1,g=rr(M(e,0))&&lr(M(e,e.length-1));if(n||o)for(c=0;c<e.length;a>=65536?c+=2:c++){if(a=M(e,c),!H(a))return k;g=g&&me(a,t,f),t=a}else{for(c=0;c<e.length;a>=65536?c+=2:c++){if(a=M(e,c),a===B)p=!0,s&&(d=d||c-m-1>l&&e[m+1]!==" ",m=c);else if(!H(a))return k;g=g&&me(a,t,f),t=a}d=d||s&&c-m-1>l&&e[m+1]!==" "}return!p&&!d?g&&!o&&!r(e)?qe:u===P?k:J:i>9&&Ke(e)?k:o?u===P?k:J:d?We:Ge}function ur(e,n,i,l,r){e.dump=(function(){if(n.length===0)return e.quotingType===P?'""':"''";if(!e.noCompatMode&&(Xi.indexOf(n)!==-1||Zi.test(n)))return e.quotingType===P?'"'+n+'"':"'"+n+"'";var u=e.indent*Math.max(1,i),o=e.lineWidth===-1?-1:Math.max(Math.min(e.lineWidth,40),e.lineWidth-u),f=l||e.flowLevel>-1&&i>=e.flowLevel;function c(a){return ir(e,a)}switch(or(n,f,e.indent,o,c,e.quotingType,e.forceQuotes&&!l,r)){case qe:return n;case J:return"'"+n.replace(/'/g,"''")+"'";case Ge:return"|"+xe(n,e.indent)+ge(de(n,u));case We:return">"+xe(n,e.indent)+ge(de(fr(n,o),u));case k:return'"'+cr(n)+'"';default:throw new w("impossible error: invalid scalar style")}})()}function xe(e,n){var i=Ke(e)?String(n):"",l=e[e.length-1]===`
21
+ `+y.repeat(" ",e.indent*n)}function ir(e,n){var i,l,r;for(i=0,l=e.implicitTypes.length;i<l;i+=1)if(r=e.implicitTypes[i],r.resolve(n))return!0;return!1}function G(e){return e===Mi||e===Ri}function H(e){return 32<=e&&e<=126||161<=e&&e<=55295&&e!==8232&&e!==8233||57344<=e&&e<=65533&&e!==le||65536<=e&&e<=1114111}function se(e){return H(e)&&e!==le&&e!==Di&&e!==B}function me(e,n,i){var l=se(e),r=l&&!G(e);return(i?l:l&&e!==Pe&&e!==He&&e!==je&&e!==Ue&&e!==Ke)&&e!==Z&&!(n===q&&!r)||se(n)&&!G(n)&&e===Z||n===q&&r}function rr(e){return H(e)&&e!==le&&!G(e)&&e!==Ki&&e!==Wi&&e!==q&&e!==Pe&&e!==He&&e!==je&&e!==Ue&&e!==Ke&&e!==Z&&e!==Hi&&e!==Ui&&e!==Yi&&e!==Vi&&e!==qi&&e!==Gi&&e!==ji&&e!==Bi&&e!==Pi&&e!==$i&&e!==Qi}function lr(e){return!G(e)&&e!==q}function M(e,n){var i=e.charCodeAt(n),l;return i>=55296&&i<=56319&&n+1<e.length&&(l=e.charCodeAt(n+1),l>=56320&&l<=57343)?(i-55296)*1024+l-56320+65536:i}function qe(e){var n=/^\n* /;return n.test(e)}var Ge=1,J=2,We=3,$e=4,k=5;function or(e,n,i,l,r,u,o,f){var c,a=0,t=null,p=!1,d=!1,s=l!==-1,m=-1,g=rr(M(e,0))&&lr(M(e,e.length-1));if(n||o)for(c=0;c<e.length;a>=65536?c+=2:c++){if(a=M(e,c),!H(a))return k;g=g&&me(a,t,f),t=a}else{for(c=0;c<e.length;a>=65536?c+=2:c++){if(a=M(e,c),a===B)p=!0,s&&(d=d||c-m-1>l&&e[m+1]!==" ",m=c);else if(!H(a))return k;g=g&&me(a,t,f),t=a}d=d||s&&c-m-1>l&&e[m+1]!==" "}return!p&&!d?g&&!o&&!r(e)?Ge:u===P?k:J:i>9&&qe(e)?k:o?u===P?k:J:d?$e:We}function ur(e,n,i,l,r){e.dump=(function(){if(n.length===0)return e.quotingType===P?'""':"''";if(!e.noCompatMode&&(Xi.indexOf(n)!==-1||Zi.test(n)))return e.quotingType===P?'"'+n+'"':"'"+n+"'";var u=e.indent*Math.max(1,i),o=e.lineWidth===-1?-1:Math.max(Math.min(e.lineWidth,40),e.lineWidth-u),f=l||e.flowLevel>-1&&i>=e.flowLevel;function c(a){return ir(e,a)}switch(or(n,f,e.indent,o,c,e.quotingType,e.forceQuotes&&!l,r)){case Ge:return n;case J:return"'"+n.replace(/'/g,"''")+"'";case We:return"|"+xe(n,e.indent)+ge(de(n,u));case $e:return">"+xe(n,e.indent)+ge(de(fr(n,o),u));case k:return'"'+cr(n)+'"';default:throw new w("impossible error: invalid scalar style")}})()}function xe(e,n){var i=qe(e)?String(n):"",l=e[e.length-1]===`
22
22
  `,r=l&&(e[e.length-2]===`
23
23
  `||e===`
24
24
  `),u=r?"+":l?"":"-";return i+u+`
@@ -29,8 +29,8 @@ function Ce(e){return typeof e>"u"||e===null}function $e(e){return typeof e=="ob
29
29
  `:"")+Ae(c,n),r=u}return l}function Ae(e,n){if(e===""||e[0]===" ")return e;for(var i=/ [^ ]/g,l,r=0,u,o=0,f=0,c="";l=i.exec(e);)f=l.index,f-r>n&&(u=o>r?o:f,c+=`
30
30
  `+e.slice(r,u),r=u+1),o=f;return c+=`
31
31
  `,e.length-r>n&&o>r?c+=e.slice(r,o)+`
32
- `+e.slice(o+1):c+=e.slice(r),c.slice(1)}function cr(e){for(var n="",i=0,l,r=0;r<e.length;i>=65536?r+=2:r++)i=M(e,r),l=_[i],!l&&H(i)?(n+=e[r],i>=65536&&(n+=e[r+1])):n+=l||Ji(i);return n}function ar(e,n,i){var l="",r=e.tag,u,o,f;for(u=0,o=i.length;u<o;u+=1)f=i[u],e.replacer&&(f=e.replacer.call(i,String(u),f)),(b(e,n,f,!1,!1)||typeof f>"u"&&b(e,n,null,!1,!1))&&(l!==""&&(l+=","+(e.condenseFlow?"":" ")),l+=e.dump);e.tag=r,e.dump="["+l+"]"}function ve(e,n,i,l){var r="",u=e.tag,o,f,c;for(o=0,f=i.length;o<f;o+=1)c=i[o],e.replacer&&(c=e.replacer.call(i,String(o),c)),(b(e,n+1,c,!0,!0,!1,!0)||typeof c>"u"&&b(e,n+1,null,!0,!0,!1,!0))&&((!l||r!=="")&&(r+=z(e,n)),e.dump&&B===e.dump.charCodeAt(0)?r+="-":r+="- ",r+=e.dump);e.tag=u,e.dump=r||"[]"}function pr(e,n,i){var l="",r=e.tag,u=Object.keys(i),o,f,c,a,t;for(o=0,f=u.length;o<f;o+=1)t="",l!==""&&(t+=", "),e.condenseFlow&&(t+='"'),c=u[o],a=i[c],e.replacer&&(a=e.replacer.call(i,c,a)),b(e,n,c,!1,!1)&&(e.dump.length>1024&&(t+="? "),t+=e.dump+(e.condenseFlow?'"':"")+":"+(e.condenseFlow?"":" "),b(e,n,a,!1,!1)&&(t+=e.dump,l+=t));e.tag=r,e.dump="{"+l+"}"}function tr(e,n,i,l){var r="",u=e.tag,o=Object.keys(i),f,c,a,t,p,d;if(e.sortKeys===!0)o.sort();else if(typeof e.sortKeys=="function")o.sort(e.sortKeys);else if(e.sortKeys)throw new w("sortKeys must be a boolean or a function");for(f=0,c=o.length;f<c;f+=1)d="",(!l||r!=="")&&(d+=z(e,n)),a=o[f],t=i[a],e.replacer&&(t=e.replacer.call(i,a,t)),b(e,n+1,a,!0,!0,!0)&&(p=e.tag!==null&&e.tag!=="?"||e.dump&&e.dump.length>1024,p&&(e.dump&&B===e.dump.charCodeAt(0)?d+="?":d+="? "),d+=e.dump,p&&(d+=z(e,n)),b(e,n+1,t,!0,p)&&(e.dump&&B===e.dump.charCodeAt(0)?d+=":":d+=": ",d+=e.dump,r+=d));e.tag=u,e.dump=r||"{}"}function ye(e,n,i){var l,r,u,o,f,c;for(r=i?e.explicitTypes:e.implicitTypes,u=0,o=r.length;u<o;u+=1)if(f=r[u],(f.instanceOf||f.predicate)&&(!f.instanceOf||typeof n=="object"&&n instanceof f.instanceOf)&&(!f.predicate||f.predicate(n))){if(i?f.multi&&f.representName?e.tag=f.representName(n):e.tag=f.tag:e.tag="?",f.represent){if(c=e.styleMap[f.tag]||f.defaultStyle,Me.call(f.represent)==="[object Function]")l=f.represent(n,c);else if(Ye.call(f.represent,c))l=f.represent[c](n,c);else throw new w("!<"+f.tag+'> tag resolver accepts not "'+c+'" style');e.dump=l}return!0}return!1}function b(e,n,i,l,r,u,o){e.tag=null,e.dump=i,ye(e,i,!1)||ye(e,i,!0);var f=Me.call(e.dump),c=l,a;l&&(l=e.flowLevel<0||e.flowLevel>n);var t=f==="[object Object]"||f==="[object Array]",p,d;if(t&&(p=e.duplicates.indexOf(i),d=p!==-1),(e.tag!==null&&e.tag!=="?"||d||e.indent!==2&&n>0)&&(r=!1),d&&e.usedDuplicates[p])e.dump="*ref_"+p;else{if(t&&d&&!e.usedDuplicates[p]&&(e.usedDuplicates[p]=!0),f==="[object Object]")l&&Object.keys(e.dump).length!==0?(tr(e,n,e.dump,r),d&&(e.dump="&ref_"+p+e.dump)):(pr(e,n,e.dump),d&&(e.dump="&ref_"+p+" "+e.dump));else if(f==="[object Array]")l&&e.dump.length!==0?(e.noArrayIndent&&!o&&n>0?ve(e,n-1,e.dump,r):ve(e,n,e.dump,r),d&&(e.dump="&ref_"+p+e.dump)):(ar(e,n,e.dump),d&&(e.dump="&ref_"+p+" "+e.dump));else if(f==="[object String]")e.tag!=="?"&&ur(e,e.dump,n,u,c);else{if(f==="[object Undefined]")return!1;if(e.skipInvalid)return!1;throw new w("unacceptable kind of an object to dump "+f)}e.tag!==null&&e.tag!=="?"&&(a=encodeURI(e.tag[0]==="!"?e.tag.slice(1):e.tag).replace(/!/g,"%21"),e.tag[0]==="!"?a="!"+a:a.slice(0,18)==="tag:yaml.org,2002:"?a="!!"+a.slice(18):a="!<"+a+">",e.dump=a+" "+e.dump)}return!0}function hr(e,n){var i=[],l=[],r,u;for(ee(e,i,l),r=0,u=l.length;r<u;r+=1)n.duplicates.push(i[l[r]]);n.usedDuplicates=new Array(u)}function ee(e,n,i){var l,r,u;if(e!==null&&typeof e=="object")if(r=n.indexOf(e),r!==-1)i.indexOf(r)===-1&&i.push(r);else if(n.push(e),Array.isArray(e))for(r=0,u=e.length;r<u;r+=1)ee(e[r],n,i);else for(l=Object.keys(e),r=0,u=l.length;r<u;r+=1)ee(e[l[r]],n,i)}function dr(e,n){n=n||{};var i=new nr(n);i.noRefs||hr(e,i);var l=e;return i.replacer&&(l=i.replacer.call({"":l},"",l)),b(i,0,l,!0,!0)?i.dump+`
33
- `:""}var sr=dr,mr={dump:sr};function oe(e,n){return function(){throw new Error("Function yaml."+e+" is removed in js-yaml 4. Use yaml."+n+" instead, which is now safe by default.")}}var xr=De.load,gr=De.loadAll,Ar=mr.dump;var vr=oe("safeLoad","load"),yr=oe("safeLoadAll","loadAll"),Cr=oe("safeDump","dump");export{xr as a,Ar as b};
32
+ `+e.slice(o+1):c+=e.slice(r),c.slice(1)}function cr(e){for(var n="",i=0,l,r=0;r<e.length;i>=65536?r+=2:r++)i=M(e,r),l=_[i],!l&&H(i)?(n+=e[r],i>=65536&&(n+=e[r+1])):n+=l||Ji(i);return n}function ar(e,n,i){var l="",r=e.tag,u,o,f;for(u=0,o=i.length;u<o;u+=1)f=i[u],e.replacer&&(f=e.replacer.call(i,String(u),f)),(b(e,n,f,!1,!1)||typeof f>"u"&&b(e,n,null,!1,!1))&&(l!==""&&(l+=","+(e.condenseFlow?"":" ")),l+=e.dump);e.tag=r,e.dump="["+l+"]"}function ve(e,n,i,l){var r="",u=e.tag,o,f,c;for(o=0,f=i.length;o<f;o+=1)c=i[o],e.replacer&&(c=e.replacer.call(i,String(o),c)),(b(e,n+1,c,!0,!0,!1,!0)||typeof c>"u"&&b(e,n+1,null,!0,!0,!1,!0))&&((!l||r!=="")&&(r+=z(e,n)),e.dump&&B===e.dump.charCodeAt(0)?r+="-":r+="- ",r+=e.dump);e.tag=u,e.dump=r||"[]"}function pr(e,n,i){var l="",r=e.tag,u=Object.keys(i),o,f,c,a,t;for(o=0,f=u.length;o<f;o+=1)t="",l!==""&&(t+=", "),e.condenseFlow&&(t+='"'),c=u[o],a=i[c],e.replacer&&(a=e.replacer.call(i,c,a)),b(e,n,c,!1,!1)&&(e.dump.length>1024&&(t+="? "),t+=e.dump+(e.condenseFlow?'"':"")+":"+(e.condenseFlow?"":" "),b(e,n,a,!1,!1)&&(t+=e.dump,l+=t));e.tag=r,e.dump="{"+l+"}"}function tr(e,n,i,l){var r="",u=e.tag,o=Object.keys(i),f,c,a,t,p,d;if(e.sortKeys===!0)o.sort();else if(typeof e.sortKeys=="function")o.sort(e.sortKeys);else if(e.sortKeys)throw new w("sortKeys must be a boolean or a function");for(f=0,c=o.length;f<c;f+=1)d="",(!l||r!=="")&&(d+=z(e,n)),a=o[f],t=i[a],e.replacer&&(t=e.replacer.call(i,a,t)),b(e,n+1,a,!0,!0,!0)&&(p=e.tag!==null&&e.tag!=="?"||e.dump&&e.dump.length>1024,p&&(e.dump&&B===e.dump.charCodeAt(0)?d+="?":d+="? "),d+=e.dump,p&&(d+=z(e,n)),b(e,n+1,t,!0,p)&&(e.dump&&B===e.dump.charCodeAt(0)?d+=":":d+=": ",d+=e.dump,r+=d));e.tag=u,e.dump=r||"{}"}function ye(e,n,i){var l,r,u,o,f,c;for(r=i?e.explicitTypes:e.implicitTypes,u=0,o=r.length;u<o;u+=1)if(f=r[u],(f.instanceOf||f.predicate)&&(!f.instanceOf||typeof n=="object"&&n instanceof f.instanceOf)&&(!f.predicate||f.predicate(n))){if(i?f.multi&&f.representName?e.tag=f.representName(n):e.tag=f.tag:e.tag="?",f.represent){if(c=e.styleMap[f.tag]||f.defaultStyle,Ye.call(f.represent)==="[object Function]")l=f.represent(n,c);else if(Be.call(f.represent,c))l=f.represent[c](n,c);else throw new w("!<"+f.tag+'> tag resolver accepts not "'+c+'" style');e.dump=l}return!0}return!1}function b(e,n,i,l,r,u,o){e.tag=null,e.dump=i,ye(e,i,!1)||ye(e,i,!0);var f=Ye.call(e.dump),c=l,a;l&&(l=e.flowLevel<0||e.flowLevel>n);var t=f==="[object Object]"||f==="[object Array]",p,d;if(t&&(p=e.duplicates.indexOf(i),d=p!==-1),(e.tag!==null&&e.tag!=="?"||d||e.indent!==2&&n>0)&&(r=!1),d&&e.usedDuplicates[p])e.dump="*ref_"+p;else{if(t&&d&&!e.usedDuplicates[p]&&(e.usedDuplicates[p]=!0),f==="[object Object]")l&&Object.keys(e.dump).length!==0?(tr(e,n,e.dump,r),d&&(e.dump="&ref_"+p+e.dump)):(pr(e,n,e.dump),d&&(e.dump="&ref_"+p+" "+e.dump));else if(f==="[object Array]")l&&e.dump.length!==0?(e.noArrayIndent&&!o&&n>0?ve(e,n-1,e.dump,r):ve(e,n,e.dump,r),d&&(e.dump="&ref_"+p+e.dump)):(ar(e,n,e.dump),d&&(e.dump="&ref_"+p+" "+e.dump));else if(f==="[object String]")e.tag!=="?"&&ur(e,e.dump,n,u,c);else{if(f==="[object Undefined]")return!1;if(e.skipInvalid)return!1;throw new w("unacceptable kind of an object to dump "+f)}e.tag!==null&&e.tag!=="?"&&(a=encodeURI(e.tag[0]==="!"?e.tag.slice(1):e.tag).replace(/!/g,"%21"),e.tag[0]==="!"?a="!"+a:a.slice(0,18)==="tag:yaml.org,2002:"?a="!!"+a.slice(18):a="!<"+a+">",e.dump=a+" "+e.dump)}return!0}function hr(e,n){var i=[],l=[],r,u;for(ee(e,i,l),r=0,u=l.length;r<u;r+=1)n.duplicates.push(i[l[r]]);n.usedDuplicates=new Array(u)}function ee(e,n,i){var l,r,u;if(e!==null&&typeof e=="object")if(r=n.indexOf(e),r!==-1)i.indexOf(r)===-1&&i.push(r);else if(n.push(e),Array.isArray(e))for(r=0,u=e.length;r<u;r+=1)ee(e[r],n,i);else for(l=Object.keys(e),r=0,u=l.length;r<u;r+=1)ee(e[l[r]],n,i)}function dr(e,n){n=n||{};var i=new nr(n);i.noRefs||hr(e,i);var l=e;return i.replacer&&(l=i.replacer.call({"":l},"",l)),b(i,0,l,!0,!0)?i.dump+`
33
+ `:""}var sr=dr,mr={dump:sr};function oe(e,n){return function(){throw new Error("Function yaml."+e+" is removed in js-yaml 4. Use yaml."+n+" instead, which is now safe by default.")}}var xr=we;var gr=Me.load,Ar=Me.loadAll,vr=mr.dump;var yr=oe("safeLoad","load"),Cr=oe("safeLoadAll","loadAll"),_r=oe("safeDump","dump");export{xr as a,gr as b,vr as c};
34
34
  /*! Bundled license information:
35
35
 
36
36
  js-yaml/dist/js-yaml.mjs:
@@ -1,12 +1,12 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{b as jt}from"./chunk-ZMNJBUAO.js";import{f as tr}from"./chunk-W5TTF7GB.js";import{a as Bt}from"./chunk-I7TIGB7K.js";import{a as te,c as Yt,e as Zt,f as qe,g as Qt,h as nr}from"./chunk-RN4PKQFR.js";import{a as Xt,b as rr,c as sr,d as ir,e as dt,f as or}from"./chunk-ZGBSGZZM.js";import{a as ke,b as qt,c as Gt,d as Lt,e as Vt}from"./chunk-7S3JZ6FQ.js";import{a as zt}from"./chunk-L2TV4G56.js";import{a as Kt,b as Jt}from"./chunk-JFAFKHDX.js";import{c as Wt}from"./chunk-6KPPGMO2.js";import{a as Nt,e as Ht}from"./chunk-GFKCTYCA.js";import{b as Ft}from"./chunk-YKTYVJBN.js";import{a as er}from"./chunk-IMR64OCZ.js";import{e as Ut}from"./chunk-WQPQNL4S.js";import{a as Fe}from"./chunk-4U4OSOA4.js";import{d as Mt}from"./chunk-W4B5LOEX.js";import{a as $e,b as ct}from"./chunk-DNNZ353O.js";import{a as Se}from"./chunk-NVGBE2DR.js";import{b as nt}from"./chunk-IDX3TOPY.js";import{A as ee,k as be,o as Be}from"./chunk-TH47OOBV.js";import{f as It}from"./chunk-DUAXZYAD.js";import{e as at}from"./chunk-DBIBROYW.js";import{d as me}from"./chunk-WXHQYYD5.js";import{b as Ot}from"./chunk-IAHKTEET.js";import{a as At}from"./chunk-5EOX4MEY.js";import{appendFileSync as wr,mkdirSync as ut,rmdirSync as br,writeFileSync as lt}from"fs";import{dirname as mr,extname as Sr,join as ce}from"path";var X=class extends Error{code;constructor(e,a){super(`${e}: ${a}`),this.name="ProposalAdapterError",this.code=e}};function cr(r){return r.version===2}var ar=8;function vr(r){let e=/^extract@(\d+)$/.exec(r??"");return e?Number.parseInt(e[1],10):null}var yr=r=>typeof r=="object"&&r!==null&&"op"in r;function Ge(r,e,a){return{anchor:r.anchor,quote:r.quote,...a||r.source_id!==e?{source_id:r.source_id}:{}}}function dr(r,e,a={}){let m=vr(a.templateVersion),x=m!==null&&m>=5,_=m!==null&&m<5,y=r.archived!=null&&r.archived.length>0&&m!==null&&m<5;if(y&&a.warn?.(`dropped ${r.archived.length} archive op(s): the bound extract template @${m} never described archiving \u2014 nothing was archived; the use-cases still land`),!x&&r.read_basis.length!==1)throw new X("READ_BASIS_COUNT",`read_basis must have exactly 1 element, got ${r.read_basis.length}`);if(r.read_basis.length===0)throw new X("READ_BASIS_COUNT","read_basis must not be empty");let v=r.read_basis[0],h=r.read_basis.length>1,$=r.use_cases.map(i=>{if(_&&i.cite.length!==1)throw new X("CITE_COUNT",`${i.temp_ref}: cite must have exactly 1 element, got ${i.cite.length}`);if(i.cite.length<1||i.cite.length>ar)throw new X("CITE_COUNT",`${i.temp_ref}: 1..${ar} cites allowed, got ${i.cite.length}`);let M=(f,re)=>{if(!x&&f!==v.source_id)throw new X("SOURCE_MISMATCH",`${re}: cite source ${f} != read_basis source ${v.source_id} (single-source)`)};M(i.cite[0].source_id,i.temp_ref);let P=i.cite.map(f=>(M(f.source_id,i.temp_ref),Ge(f,v.source_id,x&&(h||f.source_id!==v.source_id)))),l=(i.updated?.criteria??[]).some(yr);if(!x&&l)throw new X("CRITERIA_OPS_UNSUPPORTED",`${i.temp_ref}: op-union updated.criteria (keep/set/remove) needs an extract@5+ binding \u2014 this session is bound to ${a.templateVersion??"an unversioned template"}`);return{temp_ref:i.temp_ref,title:i.title,...i.description!==void 0?{description:i.description}:{},...i.summary!==void 0?{summary:i.summary}:{},...i.actors!==void 0?{actors:i.actors}:{},...i.value!==void 0?{value:i.value}:{},risk:i.risk,cite:P[0],...P.length>1?{cites:P}:{},...i.criteria!=null&&i.criteria.length>0?{criteria:i.criteria.map((f,re)=>(M(f.cite.source_id,`${i.temp_ref}.criteria[${re}]`),{text:f.text,cite:Ge(f.cite,v.source_id,x&&f.cite.source_id!==v.source_id)}))}:{},depends_on_hint:i.depends_on_hint,matches_existing:i.matches_existing,...i.conflicts_with!=null?{conflicts_with:i.conflicts_with}:{},...i.changed?{changed:!0}:{},...i.updated!=null?{updated:{...i.updated.title!=null?{title:i.updated.title}:{},...i.updated.description!=null?{description:i.updated.description}:{},...i.updated.summary!=null?{summary:i.updated.summary}:{},...i.updated.actors!=null?{actors:i.updated.actors}:{},...i.updated.value!=null?{value:i.updated.value}:{},...i.updated.risk!=null?{risk:i.updated.risk}:{},...i.updated.criteria!=null?{criteria:l?i.updated.criteria.map(f=>f.op==="set"?{op:"set",text:f.text,cite:Ge(f.cite,v.source_id,x&&f.cite.source_id!==v.source_id)}:f.op==="keep"?{op:"keep",ref:f.ref,text:f.text}:{op:"remove",ref:f.ref,text:f.text,reason:f.reason}):i.updated.criteria.map((f,re)=>(M(f.cite.source_id,`${i.temp_ref}.updated.criteria[${re}]`),{text:f.text,cite:Ge(f.cite,v.source_id,x&&f.cite.source_id!==v.source_id)}))}:{}}}:{},...i.change_note!=null?{change_note:i.change_note}:{}}});return{version:1,read_basis:e,source:{source_id:v.source_id,source_cid:v.source_cid},use_cases:$,...h?{sources:r.read_basis.map(i=>({source_id:i.source_id,source_cid:i.source_cid}))}:{},...r.extraction_of!=null&&r.extraction_of.length>0?{extraction_claims:r.extraction_of.map(i=>({source_id:i.source_id,completeness:i.completeness}))}:{},...r.archived!=null&&r.archived.length>0&&!y?{archived:r.archived.map(i=>({target:i.target,reason:i.reason,basis:i.basis}))}:{}}}function ur(r){let{contextDir:e,graph:a}=r,m=r.maxDigestBytes??4096,x={},_=[];for(let[h,$]of a.heads){if(x[h]=$,typeof $!="string")continue;let i=a.mediaOf($),M=a.getNode($)?.content?.blob;if(typeof M=="string")if(i.format==="image")_.push({source_id:h,cid:$,format:"image",blobRef:{path:Se(e,M),cid:M}});else{let P=$e(e,a,$)?.toString("utf8")??"";_.push({source_id:h,cid:$,format:i.format,text:P})}}_.sort((h,$)=>h.source_id<$.source_id?-1:1);let y=[];for(let h of a.byLabel(me.STYLENOTE).sort(($,i)=>$.cid<i.cid?-1:1))a.superseded.has(h.cid)||y.push(`\u2022 ${String(h.content.statement)} [${String(h.content.learned_from_kind)}]`);let v="";for(let h of y){if(Buffer.byteLength(v+h+`
2
+ import{b as Bt}from"./chunk-ZMNJBUAO.js";import{f as tr}from"./chunk-W5TTF7GB.js";import{a as Ft}from"./chunk-I7TIGB7K.js";import{a as te,c as Yt,e as Zt,f as qe,g as Qt,h as nr}from"./chunk-RN3YHD4S.js";import{a as Xt,b as rr,c as sr,d as ir,e as dt,f as or}from"./chunk-ZGBSGZZM.js";import{a as ke,b as qt,c as Gt,d as Lt,e as Vt}from"./chunk-J27JJWMT.js";import{a as zt}from"./chunk-L2TV4G56.js";import{a as Kt,b as Jt}from"./chunk-JFAFKHDX.js";import{c as Wt}from"./chunk-6KPPGMO2.js";import{e as Ut}from"./chunk-NDAAY2RL.js";import{a as Fe}from"./chunk-DZJQNL66.js";import{b as Nt}from"./chunk-YKTYVJBN.js";import{a as Ht,e as jt}from"./chunk-GFKCTYCA.js";import{a as er}from"./chunk-IMR64OCZ.js";import{e as Mt}from"./chunk-X2FM67OM.js";import{a as $e,b as ct}from"./chunk-DNNZ353O.js";import{a as Se}from"./chunk-NVGBE2DR.js";import{b as nt}from"./chunk-IDX3TOPY.js";import{A as ee,k as be,o as Be}from"./chunk-TH47OOBV.js";import{f as It}from"./chunk-DUAXZYAD.js";import{e as at}from"./chunk-DBIBROYW.js";import{d as me}from"./chunk-WXHQYYD5.js";import{b as Ot}from"./chunk-IAHKTEET.js";import{a as At}from"./chunk-5EOX4MEY.js";import{appendFileSync as wr,mkdirSync as ut,rmdirSync as br,writeFileSync as lt}from"fs";import{dirname as mr,extname as Sr,join as ce}from"path";var X=class extends Error{code;constructor(e,a){super(`${e}: ${a}`),this.name="ProposalAdapterError",this.code=e}};function cr(r){return r.version===2}var ar=8;function vr(r){let e=/^extract@(\d+)$/.exec(r??"");return e?Number.parseInt(e[1],10):null}var yr=r=>typeof r=="object"&&r!==null&&"op"in r;function Ge(r,e,a){return{anchor:r.anchor,quote:r.quote,...a||r.source_id!==e?{source_id:r.source_id}:{}}}function dr(r,e,a={}){let m=vr(a.templateVersion),x=m!==null&&m>=5,_=m!==null&&m<5,y=r.archived!=null&&r.archived.length>0&&m!==null&&m<5;if(y&&a.warn?.(`dropped ${r.archived.length} archive op(s): the bound extract template @${m} never described archiving \u2014 nothing was archived; the use-cases still land`),!x&&r.read_basis.length!==1)throw new X("READ_BASIS_COUNT",`read_basis must have exactly 1 element, got ${r.read_basis.length}`);if(r.read_basis.length===0)throw new X("READ_BASIS_COUNT","read_basis must not be empty");let v=r.read_basis[0],h=r.read_basis.length>1,$=r.use_cases.map(i=>{if(_&&i.cite.length!==1)throw new X("CITE_COUNT",`${i.temp_ref}: cite must have exactly 1 element, got ${i.cite.length}`);if(i.cite.length<1||i.cite.length>ar)throw new X("CITE_COUNT",`${i.temp_ref}: 1..${ar} cites allowed, got ${i.cite.length}`);let M=(f,re)=>{if(!x&&f!==v.source_id)throw new X("SOURCE_MISMATCH",`${re}: cite source ${f} != read_basis source ${v.source_id} (single-source)`)};M(i.cite[0].source_id,i.temp_ref);let P=i.cite.map(f=>(M(f.source_id,i.temp_ref),Ge(f,v.source_id,x&&(h||f.source_id!==v.source_id)))),l=(i.updated?.criteria??[]).some(yr);if(!x&&l)throw new X("CRITERIA_OPS_UNSUPPORTED",`${i.temp_ref}: op-union updated.criteria (keep/set/remove) needs an extract@5+ binding \u2014 this session is bound to ${a.templateVersion??"an unversioned template"}`);return{temp_ref:i.temp_ref,title:i.title,...i.description!==void 0?{description:i.description}:{},...i.summary!==void 0?{summary:i.summary}:{},...i.actors!==void 0?{actors:i.actors}:{},...i.value!==void 0?{value:i.value}:{},risk:i.risk,cite:P[0],...P.length>1?{cites:P}:{},...i.criteria!=null&&i.criteria.length>0?{criteria:i.criteria.map((f,re)=>(M(f.cite.source_id,`${i.temp_ref}.criteria[${re}]`),{text:f.text,cite:Ge(f.cite,v.source_id,x&&f.cite.source_id!==v.source_id)}))}:{},depends_on_hint:i.depends_on_hint,matches_existing:i.matches_existing,...i.conflicts_with!=null?{conflicts_with:i.conflicts_with}:{},...i.changed?{changed:!0}:{},...i.updated!=null?{updated:{...i.updated.title!=null?{title:i.updated.title}:{},...i.updated.description!=null?{description:i.updated.description}:{},...i.updated.summary!=null?{summary:i.updated.summary}:{},...i.updated.actors!=null?{actors:i.updated.actors}:{},...i.updated.value!=null?{value:i.updated.value}:{},...i.updated.risk!=null?{risk:i.updated.risk}:{},...i.updated.criteria!=null?{criteria:l?i.updated.criteria.map(f=>f.op==="set"?{op:"set",text:f.text,cite:Ge(f.cite,v.source_id,x&&f.cite.source_id!==v.source_id)}:f.op==="keep"?{op:"keep",ref:f.ref,text:f.text}:{op:"remove",ref:f.ref,text:f.text,reason:f.reason}):i.updated.criteria.map((f,re)=>(M(f.cite.source_id,`${i.temp_ref}.updated.criteria[${re}]`),{text:f.text,cite:Ge(f.cite,v.source_id,x&&f.cite.source_id!==v.source_id)}))}:{}}}:{},...i.change_note!=null?{change_note:i.change_note}:{}}});return{version:1,read_basis:e,source:{source_id:v.source_id,source_cid:v.source_cid},use_cases:$,...h?{sources:r.read_basis.map(i=>({source_id:i.source_id,source_cid:i.source_cid}))}:{},...r.extraction_of!=null&&r.extraction_of.length>0?{extraction_claims:r.extraction_of.map(i=>({source_id:i.source_id,completeness:i.completeness}))}:{},...r.archived!=null&&r.archived.length>0&&!y?{archived:r.archived.map(i=>({target:i.target,reason:i.reason,basis:i.basis}))}:{}}}function ur(r){let{contextDir:e,graph:a}=r,m=r.maxDigestBytes??4096,x={},_=[];for(let[h,$]of a.heads){if(x[h]=$,typeof $!="string")continue;let i=a.mediaOf($),M=a.getNode($)?.content?.blob;if(typeof M=="string")if(i.format==="image")_.push({source_id:h,cid:$,format:"image",blobRef:{path:Se(e,M),cid:M}});else{let P=$e(e,a,$)?.toString("utf8")??"";_.push({source_id:h,cid:$,format:i.format,text:P})}}_.sort((h,$)=>h.source_id<$.source_id?-1:1);let y=[];for(let h of a.byLabel(me.STYLENOTE).sort(($,i)=>$.cid<i.cid?-1:1))a.superseded.has(h.cid)||y.push(`\u2022 ${String(h.content.statement)} [${String(h.content.learned_from_kind)}]`);let v="";for(let h of y){if(Buffer.byteLength(v+h+`
3
3
  `,"utf8")>m)break;v+=h+`
4
- `}return{read_basis:x,sources:_,styleNoteDigest:v}}function lr(r,e){let a=ur({contextDir:r,graph:e}).styleNoteDigest;return a.length>0?a:void 0}function mt(r,e,a,m,x){let _=null,y=()=>_??=x&&Object.keys(x).length>0?Promise.resolve(x):Ut().catch(()=>({}));return{contextDir:r,rootSid:e,locks:at(r,e),probe:m??Bt(r,{resolveAlias:async v=>qt(v,{env:process.env,auth:await y()}),embed:async(v,h)=>Gt(v,h,{env:process.env,auth:await y()}),readVector:(v,h)=>Lt(r,v,h),writeVector:(v,h,$)=>Vt(r,v,h,$)}),...a?.length?{reservedEventIds:a}:{}}}function ht(r,e){let a=[],m=[];for(let x of r.use_cases){let _=x.matches_existing;_?.cid&&e.hasNode(_.cid)?a.push({ref:_.cid,expectedTip:e.tipOf(_.cid)}):m.push({tempRef:x.temp_ref,title:String(x.title??""),probeText:String(x.title??"")})}return{verb:"extract",ucTargets:a,newBuCandidates:m,sourcePins:[{source_id:r.source.source_id,source_cid:r.source.source_cid}],readBasis:r.read_basis??null}}function $r(r,e){let a=(r.images??[]).filter(m=>m.delivery==="selected");if(a.length!==0)return a.map(m=>({ref:m.ref,...m.page!==void 0?{page:m.page}:{},...m.loc!==void 0?{loc:m.loc}:{},media_type:m.media_type,blob_ref:{path:Se(e,m.blob),cid:m.blob}}))}function kr(r){return r.length>8&&r[0]===137&&r[1]===80&&r[2]===78&&r[3]===71?"image/png":r.length>3&&r[0]===255&&r[1]===216&&r[2]===255?"image/jpeg":r.length>12&&r.toString("ascii",0,4)==="RIFF"&&r.toString("ascii",8,12)==="WEBP"?"image/webp":null}function Le(r){return r.toISOString().replace(/[-:]/g,"").slice(0,15)}function hr(r){return r.startsWith("su-conv-")?`conv-${Ot(Buffer.from(r,"utf8")).slice(0,8)}`:r}function pr(r){return r.source_id.startsWith("su-conv-")?"the conversation":r.source_id}function Rr(r,e,a){return`reading ${pr(r)}${a>1?` (source ${e} of ${a})`:""}`}function Re(r){return r.toLowerCase().trim().replace(/\s+/g," ")}function gr(r,e){let a=new Map,m=new Map,x=new Map;for(let{cid:y,content:v}of e.byLabel(me.USECASE)){if(e.superseded.has(y))continue;(e.trust.get(y)==="archived"?x:m).set(Re(String(v.title??"")),y)}let _=y=>e.trust.get(y)==="archived"?{cid:y,archived:!0,reason:e.archivedReason.get(y)}:{cid:y};for(let y of r.use_cases){if(y.matches_existing){let $=y.matches_existing.cid;if(e.superseded.has($)){let i=e.tipOf($);$=e.superseded.has(i)?null:i}if($!==null){a.set(y.temp_ref,_($));continue}}let v=m.get(Re(y.title));if(v){a.set(y.temp_ref,{cid:v});continue}let h=x.get(Re(y.title));h&&a.set(y.temp_ref,_(h))}return a}var fr=/^(\S+)\.criteria\[(\d+)\]/;function Cr(r,e,a){if(e.length===0||!e.every(x=>fr.test(x.detail)))return!1;let m=new Map;for(let x of e){let _=fr.exec(x.detail),y=m.get(_[1])??new Set;y.add(Number(_[2])),m.set(_[1],y)}for(let x of r.use_cases){let _=m.get(x.temp_ref);_?.size&&(x.criteria=(x.criteria??[]).filter((y,v)=>!_.has(v)),a(`${x.temp_ref}: dropped ${_.size} criteria with unverifiable cites \u2014 committed without them (criteria are hints, not oracles)`))}return!0}async function gt(r,e,a,m,x=()=>{},_,y){let v=(h,$)=>x(h,$,r.session_id);return Zt(r,e,a,m,x,{async onProposalEvent(h){let $=h,i=null,M=null;if(cr($))try{i=dr($,r.read_basis,{templateVersion:y?.()??null,warn:P=>{e.out(`warning: ${P}`),v("adapter",{warn:P})}}),v("adapter",{ok:!0,use_cases:i.use_cases.length})}catch(P){M=P instanceof X?P.message:String(P),v("adapter",{ok:!1,error:M})}else i=$;return i&&i.use_cases.length===0&&(e.out("warning: the agent proposed ZERO use-cases for this source"),e.emit?.({type:"warning",code:"ZERO_USE_CASES",message:"the agent proposed ZERO use-cases for this source"})),i&&_&&await _(i),{proposal:i,error:M}}})}var Dr=new Set(["agent","ci","override"]);async function Ss(r,e){let a=`ext-${Le(e.now?.()??new Date)}-lk${Math.random().toString(36).slice(2,8)}`,x=at(e.contextDir,a,e.now?{now:e.now}:void 0).tryAcquire([{kind:"extract"}],{hold:"session",verb:"extract"});if("contended"in x){let _=x.contended.holder,y=`another extraction is running on this context${_?` (pid ${_.pid})`:""} \u2014 retry when it finishes`;return e.out(y),e.emit?.({type:"error",message:y,code:"EXTRACT_LOCKED"}),2}try{return await Er(r,e)}finally{x.release()}}async function Er(r,e){let a=r.mode??"interactive";if(r.posture==="reconcile"){if(r.trust==="hold"){let o="error: --trust hold has no meaning here \u2014 a reconcile IS the review; drop the flag";return e.out(`${o} [TRUST_USAGE]`),e.emit?.({type:"error",message:o,code:"TRUST_USAGE"}),2}if(!r.source||!r.changeContext){let o="reconcile posture needs a pinned source and its change context \u2014 internal wiring fault";return e.out(`error: ${o}`),e.emit?.({type:"error",message:o,code:"POSTURE_USAGE"}),2}if(a==="ci"){let o="reconcile posture is not available under --mode ci \u2014 a held changeset needs a durable session; use --mode agent";return e.out(`error: ${o}`),e.emit?.({type:"error",message:o,code:"POSTURE_USAGE"}),2}}if(r.trust==="hold"&&a==="interactive")return e.out("error: --trust hold only applies to headless runs \u2014 in interactive chat you review items in-session anyway; use --mode agent to hold everything for review"),e.emit?.({type:"error",message:"error: --trust hold only applies to headless runs \u2014 use --mode agent",code:"TRUST_USAGE"}),2;if(a==="interactive"){if(!e.isTTY)return e.out("extract: --mode interactive needs a TTY (use --mode agent|ci|override headless)"),2}else if(!Dr.has(a))return e.out(`extract: unknown mode "${a}" \u2014 interactive | agent | ci | override`),2;if(r.trust!==void 0){if(a==="ci")return e.out("error: --trust is not available under --mode ci (ci is fail-closed \u2014 no trust dials)"),e.emit?.({type:"error",message:"error: --trust is not available under --mode ci",code:"TRUST_UNDER_CI"}),2;if(r.trust!=="auto"&&r.trust!=="hold")return e.out(`error: --trust must be auto | hold, got '${r.trust}'`),e.emit?.({type:"error",message:`error: --trust must be auto | hold, got '${r.trust}'`,code:"TRUST_USAGE"}),2}let m=e.telemetry?.enabled?e.telemetry:void 0,x=Le(e.now?.()??new Date),_=m?At(m.ids.context_instance_id??null,"extract",m.ids.session_id):ce(e.contextDir,"logs",`extract-${x}.log`);ut(mr(_),{recursive:!0});let y=`run-${x}-${Math.random().toString(36).slice(2,8)}`,v=o=>o==="error"||o==="failed_proposal"?"error":o==="repair_respawn"?"warn":"info",h=(o,u,s)=>{try{wr(_,JSON.stringify({ts:new Date().toISOString(),level:v(o),run_id:y,...m?{user_session_id:m.ids.session_id}:{},...s?{session_id:s}:{},kind:o,data:u})+`
5
- `)}catch{}m?.wireTrace(o,u,s)};{let o=e.out;e.out=u=>{h("transcript",{line:u}),o(u)}}e.chat||e.out(`trace: ${te(_)}`),e.emit?.({type:"run_start",mode:a,trace:_,...m?{session:m.ids.session_id}:{}});let $=Ft();if($&&e.out($),e.preflightTurn){let o=await e.preflightTurn();if(h("preflight",o),!o.ok)return e.out(o.message??"error: turn-endpoint preflight failed"),e.emit?.({type:"error",message:o.message??"error: turn-endpoint preflight failed",code:"PREFLIGHT"}),2}let i=ee(e.contextDir),M=lr(e.contextDir,i),P=r.sources?.length?r.sources:r.source?[r.source]:[];if(P.length>0){if(r.resume){let o="error: --source cannot be combined with --resume (the resumed session already has its scope)";return e.out(o),e.emit?.({type:"error",message:o,code:"SOURCE_WITH_RESUME"}),2}for(let o of P){let u=i.heads.get(o);if(typeof u!="string"){let s=u===null?`error: --source ${o} was ingested but is retired \u2014 re-ingest it to extract again`:`error: --source ${o} is not an ingested source (kane-cli context list shows them)`;return e.out(s),e.emit?.({type:"error",message:s,code:"SOURCE_UNKNOWN"}),2}}}let l=null,f=null;if(r.resume){try{{let c=await or(e.contextDir,r.resume,i,{verb:"extract",deps:{onWarn:C=>e.out(`note: ${C}`)}});{let C=Object.keys(c.handle.state.read_basis??{});if(C.length>1){let B=`error: session ${r.resume} spans ${C.length} sources \u2014 multi-source resume isn't supported yet; committed work is preserved (re-run kane-cli context extract for anything remaining)`;return e.out(B),e.emit?.({type:"error",message:B,code:"MULTI_SOURCE_RESUME"}),c.handle.release(),2}f=c,h("resume_kind",{kind:c.view.pointer===null?"bare-base":c.view.pointer.at==="final"?"pause":"crash"}),l={handle:c.handle,represent:c.represent,questions:c.questions,staleBasis:c.drift.map(B=>B.subject)}}}}catch(c){let C=c instanceof Error?c.message:String(c);return e.out(`error: ${C}`),e.emit?.({type:"error",message:`error: ${C}`,...c instanceof dt?{code:c.code}:{}}),c instanceof dt?2:1}let o=f?null:Xt(l.handle.state.verb,"extract",r.resume);if(o)return e.out(o.message),e.emit?.({type:"error",message:o.message,code:o.code}),l.handle.release(),2;let u=l.handle.state.change_basis;if(u&&(i.heads.get(u.source_id)??null)!==u.new_head){let c=`error: ${u.source_id} moved while this reconcile extraction was paused \u2014 its recorded change context no longer matches; re-run kane-cli maintain reconcile against the current file (session ${r.resume} is defunct and can be ignored)`;return e.out(c),e.emit?.({type:"error",message:c,code:"CHANGE_BASIS_MOVED"}),l.handle.release(),2}if(f&&f.view.pointer!==null&&f.drift.length>0){if(!await e.confirmStale(`changed since the pause: ${f.drift.map(C=>C.subject).join(", ")} \u2014 re-ground and continue against the current versions?`)){let C=`resume aborted: the context moved since the pause (${f.drift.map(B=>B.subject).join(", ")}) \u2014 session ${r.resume} is preserved`;return e.out(C),e.emit?.({type:"error",message:C,code:"RESUME_DRIFT"}),l.handle.release(),2}}else l.staleBasis.length>0&&e.out(`note: changed since the pause: ${l.staleBasis.join(", ")} \u2014 re-presented items may be stale`);let s=[...new Set([...l.handle.state.held_receipts??[],...f?.view.kane?.held_receipts??[]])];if(s.length>0)if(e.chat?.holdReceipt)for(let c of s)e.chat.holdReceipt(c);else e={...e,initialMessage:[s.join(`
4
+ `}return{read_basis:x,sources:_,styleNoteDigest:v}}function lr(r,e){let a=ur({contextDir:r,graph:e}).styleNoteDigest;return a.length>0?a:void 0}function mt(r,e,a,m,x){let _=null,y=()=>_??=x&&Object.keys(x).length>0?Promise.resolve(x):Ut().catch(()=>({}));return{contextDir:r,rootSid:e,locks:at(r,e),probe:m??Ft(r,{resolveAlias:async v=>qt(v,{env:process.env,auth:await y()}),embed:async(v,h)=>Gt(v,h,{env:process.env,auth:await y()}),readVector:(v,h)=>Lt(r,v,h),writeVector:(v,h,$)=>Vt(r,v,h,$)}),...a?.length?{reservedEventIds:a}:{}}}function ht(r,e){let a=[],m=[];for(let x of r.use_cases){let _=x.matches_existing;_?.cid&&e.hasNode(_.cid)?a.push({ref:_.cid,expectedTip:e.tipOf(_.cid)}):m.push({tempRef:x.temp_ref,title:String(x.title??""),probeText:String(x.title??"")})}return{verb:"extract",ucTargets:a,newBuCandidates:m,sourcePins:[{source_id:r.source.source_id,source_cid:r.source.source_cid}],readBasis:r.read_basis??null}}function $r(r,e){let a=(r.images??[]).filter(m=>m.delivery==="selected");if(a.length!==0)return a.map(m=>({ref:m.ref,...m.page!==void 0?{page:m.page}:{},...m.loc!==void 0?{loc:m.loc}:{},media_type:m.media_type,blob_ref:{path:Se(e,m.blob),cid:m.blob}}))}function kr(r){return r.length>8&&r[0]===137&&r[1]===80&&r[2]===78&&r[3]===71?"image/png":r.length>3&&r[0]===255&&r[1]===216&&r[2]===255?"image/jpeg":r.length>12&&r.toString("ascii",0,4)==="RIFF"&&r.toString("ascii",8,12)==="WEBP"?"image/webp":null}function Le(r){return r.toISOString().replace(/[-:]/g,"").slice(0,15)}function hr(r){return r.startsWith("su-conv-")?`conv-${Ot(Buffer.from(r,"utf8")).slice(0,8)}`:r}function pr(r){return r.source_id.startsWith("su-conv-")?"the conversation":r.source_id}function Rr(r,e,a){return`reading ${pr(r)}${a>1?` (source ${e} of ${a})`:""}`}function Re(r){return r.toLowerCase().trim().replace(/\s+/g," ")}function gr(r,e){let a=new Map,m=new Map,x=new Map;for(let{cid:y,content:v}of e.byLabel(me.USECASE)){if(e.superseded.has(y))continue;(e.trust.get(y)==="archived"?x:m).set(Re(String(v.title??"")),y)}let _=y=>e.trust.get(y)==="archived"?{cid:y,archived:!0,reason:e.archivedReason.get(y)}:{cid:y};for(let y of r.use_cases){if(y.matches_existing){let $=y.matches_existing.cid;if(e.superseded.has($)){let i=e.tipOf($);$=e.superseded.has(i)?null:i}if($!==null){a.set(y.temp_ref,_($));continue}}let v=m.get(Re(y.title));if(v){a.set(y.temp_ref,{cid:v});continue}let h=x.get(Re(y.title));h&&a.set(y.temp_ref,_(h))}return a}var fr=/^(\S+)\.criteria\[(\d+)\]/;function Cr(r,e,a){if(e.length===0||!e.every(x=>fr.test(x.detail)))return!1;let m=new Map;for(let x of e){let _=fr.exec(x.detail),y=m.get(_[1])??new Set;y.add(Number(_[2])),m.set(_[1],y)}for(let x of r.use_cases){let _=m.get(x.temp_ref);_?.size&&(x.criteria=(x.criteria??[]).filter((y,v)=>!_.has(v)),a(`${x.temp_ref}: dropped ${_.size} criteria with unverifiable cites \u2014 committed without them (criteria are hints, not oracles)`))}return!0}async function gt(r,e,a,m,x=()=>{},_,y){let v=(h,$)=>x(h,$,r.session_id);return Zt(r,e,a,m,x,{async onProposalEvent(h){let $=h,i=null,M=null;if(cr($))try{i=dr($,r.read_basis,{templateVersion:y?.()??null,warn:P=>{e.out(`warning: ${P}`),v("adapter",{warn:P})}}),v("adapter",{ok:!0,use_cases:i.use_cases.length})}catch(P){M=P instanceof X?P.message:String(P),v("adapter",{ok:!1,error:M})}else i=$;return i&&i.use_cases.length===0&&(e.out("warning: the agent proposed ZERO use-cases for this source"),e.emit?.({type:"warning",code:"ZERO_USE_CASES",message:"the agent proposed ZERO use-cases for this source"})),i&&_&&await _(i),{proposal:i,error:M}}})}var Dr=new Set(["agent","ci","override"]);async function Ss(r,e){let a=`ext-${Le(e.now?.()??new Date)}-lk${Math.random().toString(36).slice(2,8)}`,x=at(e.contextDir,a,e.now?{now:e.now}:void 0).tryAcquire([{kind:"extract"}],{hold:"session",verb:"extract"});if("contended"in x){let _=x.contended.holder,y=`another extraction is running on this context${_?` (pid ${_.pid})`:""} \u2014 retry when it finishes`;return e.out(y),e.emit?.({type:"error",message:y,code:"EXTRACT_LOCKED"}),2}try{return await Er(r,e)}finally{x.release()}}async function Er(r,e){let a=r.mode??"interactive";if(r.posture==="reconcile"){if(r.trust==="hold"){let o="error: --trust hold has no meaning here \u2014 a reconcile IS the review; drop the flag";return e.out(`${o} [TRUST_USAGE]`),e.emit?.({type:"error",message:o,code:"TRUST_USAGE"}),2}if(!r.source||!r.changeContext){let o="reconcile posture needs a pinned source and its change context \u2014 internal wiring fault";return e.out(`error: ${o}`),e.emit?.({type:"error",message:o,code:"POSTURE_USAGE"}),2}if(a==="ci"){let o="reconcile posture is not available under --mode ci \u2014 a held changeset needs a durable session; use --mode agent";return e.out(`error: ${o}`),e.emit?.({type:"error",message:o,code:"POSTURE_USAGE"}),2}}if(r.trust==="hold"&&a==="interactive")return e.out("error: --trust hold only applies to headless runs \u2014 in interactive chat you review items in-session anyway; use --mode agent to hold everything for review"),e.emit?.({type:"error",message:"error: --trust hold only applies to headless runs \u2014 use --mode agent",code:"TRUST_USAGE"}),2;if(a==="interactive"){if(!e.isTTY)return e.out("extract: --mode interactive needs a TTY (use --mode agent|ci|override headless)"),2}else if(!Dr.has(a))return e.out(`extract: unknown mode "${a}" \u2014 interactive | agent | ci | override`),2;if(r.trust!==void 0){if(a==="ci")return e.out("error: --trust is not available under --mode ci (ci is fail-closed \u2014 no trust dials)"),e.emit?.({type:"error",message:"error: --trust is not available under --mode ci",code:"TRUST_UNDER_CI"}),2;if(r.trust!=="auto"&&r.trust!=="hold")return e.out(`error: --trust must be auto | hold, got '${r.trust}'`),e.emit?.({type:"error",message:`error: --trust must be auto | hold, got '${r.trust}'`,code:"TRUST_USAGE"}),2}let m=e.telemetry?.enabled?e.telemetry:void 0,x=Le(e.now?.()??new Date),_=m?At(m.ids.context_instance_id??null,"extract",m.ids.session_id):ce(e.contextDir,"logs",`extract-${x}.log`);ut(mr(_),{recursive:!0});let y=`run-${x}-${Math.random().toString(36).slice(2,8)}`,v=o=>o==="error"||o==="failed_proposal"?"error":o==="repair_respawn"?"warn":"info",h=(o,u,s)=>{try{wr(_,JSON.stringify({ts:new Date().toISOString(),level:v(o),run_id:y,...m?{user_session_id:m.ids.session_id}:{},...s?{session_id:s}:{},kind:o,data:u})+`
5
+ `)}catch{}m?.wireTrace(o,u,s)};{let o=e.out;e.out=u=>{h("transcript",{line:u}),o(u)}}e.chat||e.out(`trace: ${te(_)}`),e.emit?.({type:"run_start",mode:a,trace:_,...m?{session:m.ids.session_id}:{}});let $=Nt();if($&&e.out($),e.preflightTurn){let o=await e.preflightTurn();if(h("preflight",o),!o.ok)return e.out(o.message??"error: turn-endpoint preflight failed"),e.emit?.({type:"error",message:o.message??"error: turn-endpoint preflight failed",code:"PREFLIGHT"}),2}let i=ee(e.contextDir),M=lr(e.contextDir,i),P=r.sources?.length?r.sources:r.source?[r.source]:[];if(P.length>0){if(r.resume){let o="error: --source cannot be combined with --resume (the resumed session already has its scope)";return e.out(o),e.emit?.({type:"error",message:o,code:"SOURCE_WITH_RESUME"}),2}for(let o of P){let u=i.heads.get(o);if(typeof u!="string"){let s=u===null?`error: --source ${o} was ingested but is retired \u2014 re-ingest it to extract again`:`error: --source ${o} is not an ingested source (kane-cli context list shows them)`;return e.out(s),e.emit?.({type:"error",message:s,code:"SOURCE_UNKNOWN"}),2}}}let l=null,f=null;if(r.resume){try{{let c=await or(e.contextDir,r.resume,i,{verb:"extract",deps:{onWarn:C=>e.out(`note: ${C}`)}});{let C=Object.keys(c.handle.state.read_basis??{});if(C.length>1){let B=`error: session ${r.resume} spans ${C.length} sources \u2014 multi-source resume isn't supported yet; committed work is preserved (re-run kane-cli context extract for anything remaining)`;return e.out(B),e.emit?.({type:"error",message:B,code:"MULTI_SOURCE_RESUME"}),c.handle.release(),2}f=c,h("resume_kind",{kind:c.view.pointer===null?"bare-base":c.view.pointer.at==="final"?"pause":"crash"}),l={handle:c.handle,represent:c.represent,questions:c.questions,staleBasis:c.drift.map(B=>B.subject)}}}}catch(c){let C=c instanceof Error?c.message:String(c);return e.out(`error: ${C}`),e.emit?.({type:"error",message:`error: ${C}`,...c instanceof dt?{code:c.code}:{}}),c instanceof dt?2:1}let o=f?null:Xt(l.handle.state.verb,"extract",r.resume);if(o)return e.out(o.message),e.emit?.({type:"error",message:o.message,code:o.code}),l.handle.release(),2;let u=l.handle.state.change_basis;if(u&&(i.heads.get(u.source_id)??null)!==u.new_head){let c=`error: ${u.source_id} moved while this reconcile extraction was paused \u2014 its recorded change context no longer matches; re-run kane-cli maintain reconcile against the current file (session ${r.resume} is defunct and can be ignored)`;return e.out(c),e.emit?.({type:"error",message:c,code:"CHANGE_BASIS_MOVED"}),l.handle.release(),2}if(f&&f.view.pointer!==null&&f.drift.length>0){if(!await e.confirmStale(`changed since the pause: ${f.drift.map(C=>C.subject).join(", ")} \u2014 re-ground and continue against the current versions?`)){let C=`resume aborted: the context moved since the pause (${f.drift.map(B=>B.subject).join(", ")}) \u2014 session ${r.resume} is preserved`;return e.out(C),e.emit?.({type:"error",message:C,code:"RESUME_DRIFT"}),l.handle.release(),2}}else l.staleBasis.length>0&&e.out(`note: changed since the pause: ${l.staleBasis.join(", ")} \u2014 re-presented items may be stale`);let s=[...new Set([...l.handle.state.held_receipts??[],...f?.view.kane?.held_receipts??[]])];if(s.length>0)if(e.chat?.holdReceipt)for(let c of s)e.chat.holdReceipt(c);else e={...e,initialMessage:[s.join(`
6
6
 
7
7
  `),e.initialMessage].filter(Boolean).join(`
8
8
 
9
- `)};l.handle.state.assumed.length>0&&e.out(`note: ${l.handle.state.assumed.length} default(s) were assumed while you were away \u2014 kane-cli context sessions show ${r.resume} lists them`)}let re=i.extractedSourceCids,he=!!(r.force||l?.handle.state.force),se=[],oe=[],Ce=P.length>0?new Set(P):null;for(let[o,u]of i.heads.entries())if(u!=null&&!(Ce&&!Ce.has(o))){if(!Ce&&!l&&o.startsWith("su-conv-")){e.out(`skipped ${o} \u2014 conversation source; extract it explicitly with --source ${o}`),oe.push({source_id:o,reason:"conversation"});continue}if(l){let s=o in l.handle.state.read_basis,c=l.handle.state.corpus_cursor.remaining.includes(o);if(!s&&!c)continue;if(c&&!he&&re.has(u)){e.out(`${o} already extracted \u2014 skipped (--force re-runs it)`),oe.push({source_id:o,reason:"cached"});continue}}else if(!he&&re.has(u)){e.out(`${o} already extracted \u2014 skipped (--force re-runs it)`),oe.push({source_id:o,reason:"cached"});continue}se.push({source_id:o,cid:u})}let _r=o=>{let u=tr(e.contextDir,o);u&&e.out(`note: a reconcile plan for ${o} is pending (${u.pending} item(s)) \u2014 resume with \`kane-cli maintain reconcile --apply ${u.path}\``)};for(let o of oe)o.reason==="cached"&&_r(o.source_id);if(e.emit?.({type:"corpus",sources:se,skipped:oe}),se.length===0){if(l){let s=`error: resumed session's paused source (${Object.keys(l.handle.state.read_basis).join(", ")||"unknown"}) is no longer in the corpus \u2014 restore/re-ingest it and re-run --resume ${r.resume}, or discard with: kane-cli context sessions clean ${r.resume}`;return e.out(s),e.emit?.({type:"error",message:s,code:"SOURCE_MISSING"}),l.handle.release(),2}let o=oe.length>0&&oe.every(u=>u.reason==="conversation");return e.out(Ce?`extract: nothing to do \u2014 ${P.join(", ")} ${P.length===1?"is":"are all"} already extracted at the current snapshot (--force to re-run)`:o?"extract: nothing to do \u2014 only conversation sources here (extract one explicitly with --source <id>)":"extract: nothing to do \u2014 every ingested source is already extracted"),0}let ie=!r.plan&&a!=="ci",De=e.now?.()??new Date,Ee=r.resume??`ext-${Le(De)}-${hr(se[0].source_id)}`,T=null,Pe=!1;ie&&!l&&(T=nt(e.contextDir,{sid:Ee,mode:"agent",created_at:De.toISOString(),expires_at:new Date(De.getTime()+1440*60*1e3).toISOString(),agent_state:{schema:2,items:[],provider_state:""},pending:{questions:[],proposals:[]},assumed:[],read_basis:{[se[0].source_id]:se[0].cid},corpus_cursor:{remaining:se.slice(1).map(o=>o.source_id)},conv_source:"",verb:"extract",...he?{force:!0}:{},...r.changeContext?{change_basis:{source_id:r.changeContext.source_id,new_head:r.changeContext.new_head}}:{},...m?{user_session_id:m.ids.session_id}:{}}));let Ve=f?f.represent.map(o=>o.event_id).filter(o=>typeof o=="string"):[],S=l?.handle??T,ft=!1,pt=()=>{try{br(ce(e.contextDir,"sessions"))}catch{}},_t=()=>{if(T){try{T.complete()}catch{T.release()}T=null,S=null,pt()}},Te=new Map;if(l&&l.questions.length>0&&!r.message&&!r.withSource){e.out(`re-presenting ${l.questions.length} unanswered question(s) from the paused session`);let o=await e.ask(l.questions.map(rr));if(Array.isArray(o))for(let u of o)Te.set(u.id,u)}let ge=e.by??{kind:"human",id:"owner"},I=a==="interactive"&&!r.plan&&!!e.chat,Y=0,xt=0,Ae=!1,de=0,We=()=>{Ae||(Ae=!0,e.out("note: duplicate detection is running in a reduced mode this run \u2014 new items will be held for your review instead of committed"),m?.event("ASR_EMBED_DEGRADED",{}),e.emit?.({type:"degraded",reason:"embed_fallback"}))},Oe=null,fe=()=>S??T,ze=(o,u,s)=>{let c=fe();if(!c)return;let C=u.map(w=>({label:"usecase",content:{title:w.title,...w.summary!==void 0?{summary:w.summary}:{},...w.risk!==void 0?{risk:w.risk}:{},derived:!0,_held:{source_id:o.source_id,source_cid:o.cid,anchor:w.cite?.anchor??"L1-L1",quote:w.cite?.quote??""}},rationale:`held (${s==="degraded"?"embed degraded \u2014 lexical dedup only":"--trust hold"}): ${o.source_id} @ ${o.cid.slice(0,19)} ${w.cite?.anchor??""}`,edges:[],tempRef:w.temp_ref})),B=c.state.pending;c.save({pending:{questions:B.questions,proposals:[...B.proposals,...C]}}),de+=C.length,Oe=c.state.sid,e.emit?.({type:"held",source_id:o.source_id,count:C.length,reason:s==="degraded"?"embed_degraded":"trust_hold"})},q=[],vt=!1,U=[...se];try{let o=u=>{let s=S;if(!s)return;let c=s.state.ingest_schedule??[];if(!c.some(w=>w.status==="pending"))return;let C=ee(e.contextDir),B=c.map(w=>w.status!=="pending"?w:(C.heads.get(w.source_id)??null)!==w.cid?(e.out(`note: ${w.source_id} changed after it was added \u2014 skipping its extraction this run; re-run kane-cli context extract to pick up the newer version`),{...w,status:"skipped",note:"head moved since landing"}):C.extractedSourceCids.has(w.cid)||U.some(W=>W.source_id===w.source_id&&W.cid===w.cid)?{...w,status:"done"}:U.some(W=>W.source_id===w.source_id)?(e.out(`note: an older version of ${w.source_id} is already queued this run \u2014 the newly landed version is not extracted; re-run kane-cli context extract to pick it up`),{...w,status:"skipped",note:"an older version of the source was already queued this run"}):(U.push({source_id:w.source_id,cid:w.cid}),e.out(`queued ${w.source_id} for extraction in this run (landed mid-run)`),{...w,status:"done"}));s.save({ingest_schedule:B,corpus_cursor:{remaining:U.slice(u+1).map(w=>w.source_id)}})};for(let u=0;u<U.length;o(u),u++){let s=U[u],c=ee(e.contextDir),C={current:c};e.chat?.attachOnCommitted?.(t=>{C.current=t});let B=c.getNode(s.cid),w=String(B?.content.blob??""),Ie=$e(e.contextDir,c,s.cid);if(!Ie){e.out(`error: ${s.source_id}: its stored content is missing \u2014 re-ingest the file (kane-cli context ingest <file>) [BLOB_MISSING]`),e.emit?.({type:"error",source_id:s.source_id,message:`error: ${s.source_id}: blob ${w} missing from .context/blobs`,code:"BLOB_MISSING"}),q.push(s.source_id);continue}let W=c.mediaOf(s.cid),Ke=W.media_type.startsWith("image/");if(!Ke){let t=kr(Ie);if(t){e.out(`skipping ${s.source_id}: binary ${t} ingested before image support \u2014 re-ingest it (kane-cli context ingest) to extract from it`),e.emit?.({type:"source_skipped",source_id:s.source_id,reason:"binary_pre_media"});continue}}let yt=Ke?`0001| (image source ${s.source_id} \u2014 the content is attached as an image; cite it with anchor img#whole)`:ct(Ie),Me=(t,n)=>{let d=new Map;d.set(s.source_id,{media:W,numberedText:yt});for(let g of n.sources??[]){if(d.has(g.source_id))continue;let D=$e(e.contextDir,t,g.source_cid);if(!D)continue;let k=t.mediaOf(g.source_cid),E=k.media_type.startsWith("image/")?`0001| (image source ${g.source_id} \u2014 the content is attached as an image; cite it with anchor img#whole)`:ct(D);d.set(g.source_id,{media:k,numberedText:E})}return d},wt=Le(e.now?.()??new Date),ne=`${wt}-${s.source_id}`,pe=!!(l&&s.source_id in l.handle.state.read_basis),Ue=S?Ee:`ext-${wt}-${hr(s.source_id)}`,Je=U.slice(u+1).map(t=>t.source_id);S&&ie&&!pe&&S.save({read_basis:{[s.source_id]:s.cid},corpus_cursor:{remaining:Je}});let ae="";if(I){let t=Wt({contextDir:e.contextDir,graph:ee(e.contextDir),sessionStamp:Ue,by:ge});t.errors===null||t.errors[0]?.code==="CONV_SOURCE_EXISTS"?(ae=t.sourceId,e.chat.attachConversationSource?.(ae),C.current=ee(e.contextDir)):e.out(`warning: notes you add in chat can't be saved to the context this session (${t.errors[0]?.detail})`)}let bt={type:"run_config",version:1,session_id:Ue,mode:a,source:{source_id:s.source_id,source_cid:s.cid,kind:Mt.has(W.format)?W.format:Sr(s.source_id)||"md",numbered_text:yt,...(()=>{let t=$r(W,e.contextDir);return t?{images:t}:{}})()},existing_use_cases:c.byLabel(me.USECASE).filter(({cid:t})=>c.trust.get(t)!=="archived"&&!c.superseded.has(t)).map(({cid:t,content:n})=>({id:t,title:String(n.title??""),summary:String(n.summary??"")})),read_basis:C.current.latestHash,max_free_text_rounds:Yt,graph_reads:!0,verb:"extract",...M!==void 0?{style_note_digest:M}:{},...r.changeContext&&r.changeContext.source_id===s.source_id?{change_context:r.changeContext}:{},topology:er(),...I?{chat:!0}:{},...Ke?{image_sources:[{source_id:s.source_id,source_cid:s.cid,media_type:W.media_type,blob_ref:{path:Se(e.contextDir,w),cid:w}}]}:{},...l&&!f&&s.source_id in l.handle.state.read_basis?{resume:{agent_state:l.handle.state.agent_state}}:{},...ie&&S?{checkpoints:!0}:{}},R=f&&pe?{...f.spawnConfig,mode:a}:bt;if(ie&&S&&!ft){ft=!0;let{resume:t,...n}=bt;Ht(e.contextDir,Ee,{schema:Nt,kind:"base",sid:Ee,verb:"extract",mode:a,created_at:De.toISOString(),run_config:n,conv_source:ae||S.state.conv_source||"",store_watermark:It(e.contextDir)})}let St=f&&pe?0:S?.state.checkpoint?.seq??0,_e={current:null};if(R.resume&&"schema"in R.resume){let t=R.resume.binding?.template_version;typeof t=="string"&&(_e.current=t)}let Xe=ie&&S?ir({contextDir:e.contextDir,handle:S,seqBase:()=>St,peekHeldReceipts:()=>e.chat?.peekHeldReceipts?.()??[],readBasis:()=>({[s.source_id]:s.cid}),corpusCursor:()=>({remaining:Je}),onSoftCap:t=>e.out(t),onStat:t=>h("ckpt_stat",t,R.session_id),...e.now?{now:e.now}:{}}):void 0,ue=Xe?{...Xe,persist:t=>{let n=t.binding?.template_version;return typeof n=="string"&&n&&(_e.current=n),Xe.persist(t)}}:void 0;I||e.out(l&&s.source_id in l.handle.state.read_basis?`resuming: ${s.source_id} (session ${r.resume})`:`reading ${s.source_id} (source ${u+1} of ${U.length})`),e.emit?.({type:"source_start",source_id:s.source_id,cid:s.cid,index:u+1,total:U.length,resumed:!!(l&&s.source_id in l.handle.state.read_basis)}),e.chat?.ledger?.({kind:"banner",text:Rr(s,u+1,U.length)}),e.chat?.setWorking?.(`Reading ${pr(s)}\u2026`);let Ye=new Map;h("spawn",{source_id:s.source_id,source_cid:s.cid,resume:!!l,chat:I},R.session_id);let $t=!1,kt=!1,Ze=!1,Rt=async t=>{let n=ee(e.contextDir),d=be(t,Me(n,t),n);if(h("kane_validate",{errors:d.map(p=>p.code)},R.session_id),d.length>0){if(e.nested){e.chat?.ledger?.({kind:"commit",ok:!1,line:"proposal failed validation \u2014 nothing landed",warnings:d.map(p=>`${p.code}: ${p.detail}`)}),kt=!0;return}e.chat.submit("[auto-repair] the proposal failed validation: "+d.map(p=>`${p.code}: ${p.detail}`).join("; ")+" \u2014 please re-finalize with these fixed.");return}let g=ee(e.contextDir),D=gr(t,g),k=ce(e.contextDir,"proposals",ne);ut(k,{recursive:!0}),lt(ce(k,"proposal.json"),JSON.stringify(t,null,2)+`
9
+ `)};l.handle.state.assumed.length>0&&e.out(`note: ${l.handle.state.assumed.length} default(s) were assumed while you were away \u2014 kane-cli context sessions show ${r.resume} lists them`)}let re=i.extractedSourceCids,he=!!(r.force||l?.handle.state.force),se=[],oe=[],Ce=P.length>0?new Set(P):null;for(let[o,u]of i.heads.entries())if(u!=null&&!(Ce&&!Ce.has(o))){if(!Ce&&!l&&o.startsWith("su-conv-")){e.out(`skipped ${o} \u2014 conversation source; extract it explicitly with --source ${o}`),oe.push({source_id:o,reason:"conversation"});continue}if(l){let s=o in l.handle.state.read_basis,c=l.handle.state.corpus_cursor.remaining.includes(o);if(!s&&!c)continue;if(c&&!he&&re.has(u)){e.out(`${o} already extracted \u2014 skipped (--force re-runs it)`),oe.push({source_id:o,reason:"cached"});continue}}else if(!he&&re.has(u)){e.out(`${o} already extracted \u2014 skipped (--force re-runs it)`),oe.push({source_id:o,reason:"cached"});continue}se.push({source_id:o,cid:u})}let _r=o=>{let u=tr(e.contextDir,o);u&&e.out(`note: a reconcile plan for ${o} is pending (${u.pending} item(s)) \u2014 resume with \`kane-cli maintain reconcile --apply ${u.path}\``)};for(let o of oe)o.reason==="cached"&&_r(o.source_id);if(e.emit?.({type:"corpus",sources:se,skipped:oe}),se.length===0){if(l){let s=`error: resumed session's paused source (${Object.keys(l.handle.state.read_basis).join(", ")||"unknown"}) is no longer in the corpus \u2014 restore/re-ingest it and re-run --resume ${r.resume}, or discard with: kane-cli context sessions clean ${r.resume}`;return e.out(s),e.emit?.({type:"error",message:s,code:"SOURCE_MISSING"}),l.handle.release(),2}let o=oe.length>0&&oe.every(u=>u.reason==="conversation");return e.out(Ce?`extract: nothing to do \u2014 ${P.join(", ")} ${P.length===1?"is":"are all"} already extracted at the current snapshot (--force to re-run)`:o?"extract: nothing to do \u2014 only conversation sources here (extract one explicitly with --source <id>)":"extract: nothing to do \u2014 every ingested source is already extracted"),0}let ie=!r.plan&&a!=="ci",De=e.now?.()??new Date,Ee=r.resume??`ext-${Le(De)}-${hr(se[0].source_id)}`,T=null,Pe=!1;ie&&!l&&(T=nt(e.contextDir,{sid:Ee,mode:"agent",created_at:De.toISOString(),expires_at:new Date(De.getTime()+1440*60*1e3).toISOString(),agent_state:{schema:2,items:[],provider_state:""},pending:{questions:[],proposals:[]},assumed:[],read_basis:{[se[0].source_id]:se[0].cid},corpus_cursor:{remaining:se.slice(1).map(o=>o.source_id)},conv_source:"",verb:"extract",...he?{force:!0}:{},...r.changeContext?{change_basis:{source_id:r.changeContext.source_id,new_head:r.changeContext.new_head}}:{},...m?{user_session_id:m.ids.session_id}:{}}));let Ve=f?f.represent.map(o=>o.event_id).filter(o=>typeof o=="string"):[],S=l?.handle??T,ft=!1,pt=()=>{try{br(ce(e.contextDir,"sessions"))}catch{}},_t=()=>{if(T){try{T.complete()}catch{T.release()}T=null,S=null,pt()}},Te=new Map;if(l&&l.questions.length>0&&!r.message&&!r.withSource){e.out(`re-presenting ${l.questions.length} unanswered question(s) from the paused session`);let o=await e.ask(l.questions.map(rr));if(Array.isArray(o))for(let u of o)Te.set(u.id,u)}let ge=e.by??{kind:"human",id:"owner"},I=a==="interactive"&&!r.plan&&!!e.chat,Y=0,xt=0,Ae=!1,de=0,We=()=>{Ae||(Ae=!0,e.out("note: duplicate detection is running in a reduced mode this run \u2014 new items will be held for your review instead of committed"),m?.event("ASR_EMBED_DEGRADED",{}),e.emit?.({type:"degraded",reason:"embed_fallback"}))},Oe=null,fe=()=>S??T,ze=(o,u,s)=>{let c=fe();if(!c)return;let C=u.map(w=>({label:"usecase",content:{title:w.title,...w.summary!==void 0?{summary:w.summary}:{},...w.risk!==void 0?{risk:w.risk}:{},derived:!0,_held:{source_id:o.source_id,source_cid:o.cid,anchor:w.cite?.anchor??"L1-L1",quote:w.cite?.quote??""}},rationale:`held (${s==="degraded"?"embed degraded \u2014 lexical dedup only":"--trust hold"}): ${o.source_id} @ ${o.cid.slice(0,19)} ${w.cite?.anchor??""}`,edges:[],tempRef:w.temp_ref})),B=c.state.pending;c.save({pending:{questions:B.questions,proposals:[...B.proposals,...C]}}),de+=C.length,Oe=c.state.sid,e.emit?.({type:"held",source_id:o.source_id,count:C.length,reason:s==="degraded"?"embed_degraded":"trust_hold"})},q=[],vt=!1,U=[...se];try{let o=u=>{let s=S;if(!s)return;let c=s.state.ingest_schedule??[];if(!c.some(w=>w.status==="pending"))return;let C=ee(e.contextDir),B=c.map(w=>w.status!=="pending"?w:(C.heads.get(w.source_id)??null)!==w.cid?(e.out(`note: ${w.source_id} changed after it was added \u2014 skipping its extraction this run; re-run kane-cli context extract to pick up the newer version`),{...w,status:"skipped",note:"head moved since landing"}):C.extractedSourceCids.has(w.cid)||U.some(W=>W.source_id===w.source_id&&W.cid===w.cid)?{...w,status:"done"}:U.some(W=>W.source_id===w.source_id)?(e.out(`note: an older version of ${w.source_id} is already queued this run \u2014 the newly landed version is not extracted; re-run kane-cli context extract to pick it up`),{...w,status:"skipped",note:"an older version of the source was already queued this run"}):(U.push({source_id:w.source_id,cid:w.cid}),e.out(`queued ${w.source_id} for extraction in this run (landed mid-run)`),{...w,status:"done"}));s.save({ingest_schedule:B,corpus_cursor:{remaining:U.slice(u+1).map(w=>w.source_id)}})};for(let u=0;u<U.length;o(u),u++){let s=U[u],c=ee(e.contextDir),C={current:c};e.chat?.attachOnCommitted?.(t=>{C.current=t});let B=c.getNode(s.cid),w=String(B?.content.blob??""),Ie=$e(e.contextDir,c,s.cid);if(!Ie){e.out(`error: ${s.source_id}: its stored content is missing \u2014 re-ingest the file (kane-cli context ingest <file>) [BLOB_MISSING]`),e.emit?.({type:"error",source_id:s.source_id,message:`error: ${s.source_id}: blob ${w} missing from .context/blobs`,code:"BLOB_MISSING"}),q.push(s.source_id);continue}let W=c.mediaOf(s.cid),Ke=W.media_type.startsWith("image/");if(!Ke){let t=kr(Ie);if(t){e.out(`skipping ${s.source_id}: binary ${t} ingested before image support \u2014 re-ingest it (kane-cli context ingest) to extract from it`),e.emit?.({type:"source_skipped",source_id:s.source_id,reason:"binary_pre_media"});continue}}let yt=Ke?`0001| (image source ${s.source_id} \u2014 the content is attached as an image; cite it with anchor img#whole)`:ct(Ie),Me=(t,n)=>{let d=new Map;d.set(s.source_id,{media:W,numberedText:yt});for(let g of n.sources??[]){if(d.has(g.source_id))continue;let D=$e(e.contextDir,t,g.source_cid);if(!D)continue;let k=t.mediaOf(g.source_cid),E=k.media_type.startsWith("image/")?`0001| (image source ${g.source_id} \u2014 the content is attached as an image; cite it with anchor img#whole)`:ct(D);d.set(g.source_id,{media:k,numberedText:E})}return d},wt=Le(e.now?.()??new Date),ne=`${wt}-${s.source_id}`,pe=!!(l&&s.source_id in l.handle.state.read_basis),Ue=S?Ee:`ext-${wt}-${hr(s.source_id)}`,Je=U.slice(u+1).map(t=>t.source_id);S&&ie&&!pe&&S.save({read_basis:{[s.source_id]:s.cid},corpus_cursor:{remaining:Je}});let ae="";if(I){let t=Wt({contextDir:e.contextDir,graph:ee(e.contextDir),sessionStamp:Ue,by:ge});t.errors===null||t.errors[0]?.code==="CONV_SOURCE_EXISTS"?(ae=t.sourceId,e.chat.attachConversationSource?.(ae),C.current=ee(e.contextDir)):e.out(`warning: notes you add in chat can't be saved to the context this session (${t.errors[0]?.detail})`)}let bt={type:"run_config",version:1,session_id:Ue,mode:a,source:{source_id:s.source_id,source_cid:s.cid,kind:Mt.has(W.format)?W.format:Sr(s.source_id)||"md",numbered_text:yt,...(()=>{let t=$r(W,e.contextDir);return t?{images:t}:{}})()},existing_use_cases:c.byLabel(me.USECASE).filter(({cid:t})=>c.trust.get(t)!=="archived"&&!c.superseded.has(t)).map(({cid:t,content:n})=>({id:t,title:String(n.title??""),summary:String(n.summary??"")})),read_basis:C.current.latestHash,max_free_text_rounds:Yt,graph_reads:!0,verb:"extract",...M!==void 0?{style_note_digest:M}:{},...r.changeContext&&r.changeContext.source_id===s.source_id?{change_context:r.changeContext}:{},topology:er(),...I?{chat:!0}:{},...Ke?{image_sources:[{source_id:s.source_id,source_cid:s.cid,media_type:W.media_type,blob_ref:{path:Se(e.contextDir,w),cid:w}}]}:{},...l&&!f&&s.source_id in l.handle.state.read_basis?{resume:{agent_state:l.handle.state.agent_state}}:{},...ie&&S?{checkpoints:!0}:{}},R=f&&pe?{...f.spawnConfig,mode:a}:bt;if(ie&&S&&!ft){ft=!0;let{resume:t,...n}=bt;jt(e.contextDir,Ee,{schema:Ht,kind:"base",sid:Ee,verb:"extract",mode:a,created_at:De.toISOString(),run_config:n,conv_source:ae||S.state.conv_source||"",store_watermark:It(e.contextDir)})}let St=f&&pe?0:S?.state.checkpoint?.seq??0,_e={current:null};if(R.resume&&"schema"in R.resume){let t=R.resume.binding?.template_version;typeof t=="string"&&(_e.current=t)}let Xe=ie&&S?ir({contextDir:e.contextDir,handle:S,seqBase:()=>St,peekHeldReceipts:()=>e.chat?.peekHeldReceipts?.()??[],readBasis:()=>({[s.source_id]:s.cid}),corpusCursor:()=>({remaining:Je}),onSoftCap:t=>e.out(t),onStat:t=>h("ckpt_stat",t,R.session_id),...e.now?{now:e.now}:{}}):void 0,ue=Xe?{...Xe,persist:t=>{let n=t.binding?.template_version;return typeof n=="string"&&n&&(_e.current=n),Xe.persist(t)}}:void 0;I||e.out(l&&s.source_id in l.handle.state.read_basis?`resuming: ${s.source_id} (session ${r.resume})`:`reading ${s.source_id} (source ${u+1} of ${U.length})`),e.emit?.({type:"source_start",source_id:s.source_id,cid:s.cid,index:u+1,total:U.length,resumed:!!(l&&s.source_id in l.handle.state.read_basis)}),e.chat?.ledger?.({kind:"banner",text:Rr(s,u+1,U.length)}),e.chat?.setWorking?.(`Reading ${pr(s)}\u2026`);let Ye=new Map;h("spawn",{source_id:s.source_id,source_cid:s.cid,resume:!!l,chat:I},R.session_id);let $t=!1,kt=!1,Ze=!1,Rt=async t=>{let n=ee(e.contextDir),d=be(t,Me(n,t),n);if(h("kane_validate",{errors:d.map(p=>p.code)},R.session_id),d.length>0){if(e.nested){e.chat?.ledger?.({kind:"commit",ok:!1,line:"proposal failed validation \u2014 nothing landed",warnings:d.map(p=>`${p.code}: ${p.detail}`)}),kt=!0;return}e.chat.submit("[auto-repair] the proposal failed validation: "+d.map(p=>`${p.code}: ${p.detail}`).join("; ")+" \u2014 please re-finalize with these fixed.");return}let g=ee(e.contextDir),D=gr(t,g),k=ce(e.contextDir,"proposals",ne);ut(k,{recursive:!0}),lt(ce(k,"proposal.json"),JSON.stringify(t,null,2)+`
10
10
  `);let E=new Map(t.use_cases.map(p=>[p.temp_ref,{resolution:"skipped"}])),Q=mt(e.contextDir,R.session_id,Ve,e.probe,e.auth),O=await ke(Q,ht(t,g),p=>{if(p.degradedProbe&&fe()!==null&&t.use_cases.some(ye=>ye.matches_existing==null))return{result:{degradedHold:!0},record:null};let K=Be({contextDir:e.contextDir,graph:p.graph,proposal:t,proposalId:ne,verdicts:E,by:{kind:"ai",id:"extract-agent"},autoName:!0,allowStaleBasis:!0,eventIds:p.eventIds("extract",1),...ie?{sid:p.sid}:{},probeHits:p.probeHits});return K.errors!==null?{errors:K.errors}:{result:K,record:K.record}}),N=O.ok&&"result"in O?O.result:null;if(N!==null&&"degradedHold"in N){We(),ze(s,t.use_cases,"degraded"),Ze=!0,e.chat.ledger?.({kind:"commit",ok:!1,line:`held ${t.use_cases.length} item(s) for review \u2014 semantic dedup ran degraded (embeddings unavailable); nothing saved this turn`});return}let V=N??{record:null,errors:O.ok?null:O.kind==="validation"?O.errors:[{code:O.kind==="contended"?O.err.code:"UNSETTLED",detail:O.kind==="contended"?`held by ${O.err.holder?.owner_sid??"another session"}`:"concurrent activity kept moving the store"}]};if(V.errors){e.chat.ledger?.({kind:"commit",ok:!1,line:"commit failed \u2014 nothing landed",warnings:V.errors.map(p=>`${p.code}: ${p.detail}`)});return}$t=!0,V.record?.event_ids?.length&&S?.markApplied(V.record.event_ids);{let p=V.record.review.filter(K=>K.kind==="pending_update");p.length>0&&(I||e.out(`${p.length} update(s) held for review`),e.emit?.({type:"update_held",count:p.length,targets:p.map(K=>K.id)}),e.chat?.ledger?.({kind:"commit",ok:!0,line:`${p.length} update(s) held for review`}))}let z=V.record.nodes.length;Y+=z;let H=t.use_cases.length-z;{let p=ee(e.contextDir),K=new Map;for(let{cid:j,content:J}of p.byLabel(me.USECASE))p.superseded.has(j)||K.set(Re(String(J.title??"")),j);let ye=[];for(let j of t.use_cases){let J=null;if(j.matches_existing?.cid&&p.hasNode(j.matches_existing.cid)){let we=p.tipOf(j.matches_existing.cid);J=p.superseded.has(we)?null:we}J=J??K.get(Re(j.title))??null,J&&ye.push({ref:j.temp_ref,cid:J,...p.displayNameOf(J)?{id:p.displayNameOf(J)}:{}})}ye.length>0&&e.chat.registerAliases?.(ye),C.current=p;let Pt=j=>{for(let[J,we]of p.names)if(we===j&&!p.superseded.has(we))return J},Tt=zt({verb:"extract",commitN:1,phase:"proposal",committed:V.record.nodes.map(j=>({cid:j.cid,...Pt(j.cid)?{logical_id:Pt(j.cid)}:{}})),reused:H},p);e.emit?.(Tt.event),e.chat.holdReceipt?.(Tt.text)}h("commit",{derived:z,evidence_matched:H,chat:!0},R.session_id),e.chat.ledger?.({kind:"commit",ok:!0,line:z===0&&H>0?`all ${H} matched existing \u2014 nothing new to save`:`saved ${z} use-case${z===1?"":"s"} as drafts`+(H>0?` \xB7 ${H} matched existing`:"")})},Qe=!!(l&&s.source_id in l.handle.state.read_basis),G=Qe&&Te.size>0?{...e,ask:async t=>t.every(n=>Te.has(n.id))?(l.handle.markApplied(t.map(n=>`resolveq:${r.resume}:${n.id}`)),e.out(`answered ${t.length} re-asked question(s) from the held resume answers`),t.map(n=>Te.get(n.id))):e.ask(t)}:e;Qe&&r.message&&(G={...G,initialMessage:r.message}),G={...G,onEmbedDegraded:We};let le,et;if(S){let t=S,n=G.ask,d=Qt({contextDir:e.contextDir,cwd:mr(e.contextDir),handle:t,note:g=>e.chat?e.chat.note(g):e.out(g),schedule:r.trust!=="hold",...r.trust==="hold"?{scheduleRefused:"this run holds items for review, so its extraction is not scheduled \u2014 kane-cli context extract runs it after the review"}:{},graphSlot:C,...e.now?{now:e.now}:{}});if(G={...G,ask:async g=>{let D=await n(g);if(Array.isArray(D)){let k=D.filter(E=>{if(E.free_text==null||E.free_text.trim()==="")return!1;let Q=g.find(O=>O.id===E.id);return E.selected_index!=null&&Q?.options[E.selected_index]?.input===!0}).map(E=>E.free_text.trim());if(k.length>0){let E=t.state.ingest_registry;for(let Q of k)E=qe(E,Q,e.now?.()??new Date);t.save({ingest_registry:E})}}return D},ingest:d},Qe&&r.withSource){let g=(t.state.pending?.proposals??[]).filter(E=>E.content?._held!=null).length;if(r.trust==="hold"||g>0){let E=g>0?`error: --with-source can't add a source to a session holding ${g} item(s) for review \u2014 resume without --with-source to finish the review first, then land it with kane-cli context ingest [HOLD_MULTI_SOURCE]`:"error: --with-source is not available with --trust hold \u2014 held work from a multi-source run can't be resumed yet; drop --trust hold, or land the source separately with kane-cli context ingest [HOLD_MULTI_SOURCE]";return e.out(E),e.emit?.({type:"error",code:"HOLD_MULTI_SOURCE",message:E}),2}let D=r.withSource;t.save({ingest_registry:qe(t.state.ingest_registry,D,e.now?.()??new Date)});let k=await d({id:`withsource-${t.state.sid}`,ref:D,purpose:null});if(!k.ok)return e.out(`error: --with-source: ${k.error.message}`),e.emit?.({type:"error",code:k.error.code,message:`--with-source: ${k.error.message}`}),2;G={...G,pendingDeferral:{ingested:{source_id:k.result.source_id,cid:k.result.cid}}}}et=()=>{if(!e.chat?.attachIngest)return;let g=e.chat;le=g.attachIngest(async D=>{try{t.save({ingest_registry:qe(t.state.ingest_registry,D,e.now?.()??new Date)});let k=await d({id:`attach-${t.state.sid}-${(t.state.ingest_registry??[]).length}`,ref:D,purpose:null});return k.ok?(g.deferBatch({source_id:k.result.source_id,cid:k.result.cid}),{ok:!0}):{ok:!1,error:k.error.message}}catch(k){return{ok:!1,error:k instanceof Error?k.message:String(k)}}})},et()}let b;try{b=await gt(R,{...G,graphSlot:C,...ue?{checkpoint:ue}:{}},Ye,c,h,I?Rt:void 0,()=>_e.current)}catch(t){if(t instanceof Fe)return le?.(),e.chat?.setWorking?.(null),e.out(`error: ${t.message}`),e.emit?.({type:"error",code:"PAIR_MISMATCH",message:t.message}),2;throw t}if(le?.(),e.chat?.setWorking?.(null),b.errorCode==="binding_mismatch"&&f&&pe){let t=await e.ask([{id:"binding-mismatch",text:"this session's saved conversation is no longer accepted by the service \u2014 start the conversation fresh (committed work is kept), or stop and keep the session?",risk:"high",rationale:"the service refused the saved conversation on the first turn after resume",options:[{label:"start fresh",detail:"continue with a fresh conversation \u2014 earlier answers may be re-asked"},{label:"stop",detail:"stop here; the session stays resumable"}],recommended_index:1,allow_free_text:!1}]);if((Array.isArray(t)?t.find(g=>g.id==="binding-mismatch"):void 0)?.selected_index!==0){let g=`resume abandoned: binding mismatch on session ${Ue} \u2014 the session is preserved`;return e.out(g),e.emit?.({type:"error",message:g,code:"BINDING_MISMATCH"}),2}h("binding_migrate",{sid:Ue},R.session_id),et?.();let d=R.resume&&"schema"in R.resume?{...R.resume,binding:{}}:void 0;try{b=await gt({...R,...d?{resume:d}:{}},{...G,graphSlot:C,...ue?{checkpoint:ue}:{}},Ye,c,h,I?Rt:void 0,()=>_e.current)}catch(g){if(g instanceof Fe)return le?.(),e.chat?.setWorking?.(null),e.out(`error: ${g.message}`),e.emit?.({type:"error",code:"PAIR_MISMATCH",message:g.message}),2;throw le?.(),g}le?.(),e.chat?.setWorking?.(null)}if(b.error){let t=b.error.startsWith("proposal failed validation after repair:");t&&h("agent_error_detail",{error:b.error},R.session_id);let n=t?`error: the agent could not produce a valid proposal for ${s.source_id} \u2014 re-run kane-cli context extract to retry`:`error: agent failed for ${s.source_id}: ${b.error}`;e.out(n),e.emit?.({type:"error",source_id:s.source_id,message:n}),q.push(s.source_id);continue}if(b.highRisk)return e.out(`error: ${b.highRisk.length} high-risk decision${b.highRisk.length===1?"":"s"} need a human \u2014 ci mode won't guess. Re-run with --mode agent to pause for review.`),e.emit?.({type:"error",source_id:s.source_id,message:`error: high-risk question(s) in ci mode (fail-closed): ${b.highRisk.map(t=>t.id).join(", ")}`,code:"HIGH_RISK_CI"}),1;if(b.paused){let t=U.slice(u+1).map(D=>D.source_id),n=l?.handle??T,d=n??nt(e.contextDir,{sid:R.session_id,mode:"agent",created_at:(e.now?.()??new Date).toISOString(),expires_at:new Date((e.now?.()??new Date).getTime()+1440*60*1e3).toISOString(),agent_state:b.paused.agent_state,pending:{questions:[],proposals:[]},assumed:[],read_basis:{[s.source_id]:s.cid},corpus_cursor:{remaining:t},conv_source:ae,verb:"extract",...he?{force:!0}:{},...r.changeContext?{change_basis:{source_id:r.changeContext.source_id,new_head:r.changeContext.new_head}}:{},...m?{user_session_id:m.ids.session_id}:{}});Pe=!0;try{ae&&d.state.conv_source!==ae&&d.save({conv_source:ae});let D=e.chat?.drainHeldReceipts?.()??[];(D.length>0||(d.state.held_receipts?.length??0)>0)&&d.save({held_receipts:D}),n&&d.save({read_basis:{[s.source_id]:s.cid},corpus_cursor:{remaining:t},...he&&!d.state.force?{force:!0}:{},...m&&d.state.user_session_id!==m.ids.session_id?{user_session_id:m.ids.session_id}:{}}),sr(d,b.paused)}catch(D){let k=d.state.checkpoint,E=`error: couldn't persist the pause for session ${d.state.sid}`+(k?` \u2014 last durable checkpoint: seq ${k.seq} @ ${k.ts}`:" \u2014 no durable checkpoint exists")+` (${D instanceof Error?D.message:String(D)})`;return e.out(E),e.emit?.({type:"error",message:E,code:"PAUSE_PERSIST_FAILED",sid:d.state.sid}),1}h("session_paused",{sid:d.state.sid},R.session_id);let g=`kane-cli context extract --resume ${d.state.sid} --mode ${a}`;if(I||e.out(`paused: session ${d.state.sid} saved \u2014 resume with: ${g}`),e.emit?.({type:"session_paused",sid:d.state.sid,source_id:s.source_id,mode:a,resume:g,expires_at:d.state.expires_at,pending_questions:b.paused.pending.questions}),I){let D=e.chat?.state.credits?.total;e.onSummary?.({state:"paused",reason:"ctrl+c",facts:[`session ${d.state.sid} saved`+(Y>0?` \u2014 ${Y} use-case${Y===1?"":"s"} committed so far`:""),...d.state.expires_at?[`expires: ${d.state.expires_at}`]:[],...D!==void 0?[`credits used: ${D.toFixed(1)}`]:[]],resume:g,resumeMessage:`${g} --message "<your words>"`,tracePath:te(_)})}return 3}if(b.crashed){let t=S?.state.checkpoint;if(S&&t){let n=`kane-cli context extract --resume ${S.state.sid} --mode ${a}`;try{S.save({read_basis:{[s.source_id]:s.cid},corpus_cursor:{remaining:Je}})}catch{}if(h("agent_crashed_resumable",{sid:S.state.sid,seq:t.seq},R.session_id),I||e.out(`agent crashed \u2014 session ${S.state.sid} is resumable at checkpoint seq ${t.seq} (at most the in-flight turn lost); resume with: ${n}`),e.emit?.({type:"session_paused",sid:S.state.sid,source_id:s.source_id,mode:a,resume:n,expires_at:S.state.expires_at,crashed:!0}),I){let d=e.chat?.state.credits?.total;e.onSummary?.({state:"crashed",facts:[`agent crashed \u2014 session ${S.state.sid} is resumable at checkpoint seq ${t.seq}`,"at most the in-flight turn was lost",...d!==void 0?[`credits used: ${d.toFixed(1)}`]:[]],resume:n,resumeMessage:`${n} --message "<your words>"`,tracePath:te(_)})}return Pe=!0,S.release(),3}e.out(`error: agent crashed for ${s.source_id} with no durable checkpoint`),e.emit?.({type:"error",source_id:s.source_id,message:`error: agent crashed for ${s.source_id} with no durable checkpoint`,code:"AGENT_CRASHED"}),q.push(s.source_id);continue}if(I){if(xt+=b.assumedDefaults??0,b.error||kt)return 1;if(!$t&&!Ze){let t=U.length-u-1,n=`done \u2014 nothing committed for ${s.source_id} (no finalize before the session ended)`+(t>0?`; stopping here \u2014 ${t} remaining source(s) not extracted (re-run kane-cli context extract to continue)`:"");I||e.out(n),e.onSummary?.({state:"complete",facts:[n,...Y>0?[`${Y} use-case${Y===1?"":"s"} saved earlier in this run`]:[]],tracePath:te(_)});{let d=(S?.state.ingest_schedule??[]).filter(g=>g.status==="pending");d.length>0&&e.out(`note: ${d.length} source(s) landed this session (${d.map(g=>g.source_id).join(", ")}) were not extracted \u2014 the session ended first; kane-cli context extract runs them`)}return l&&s.source_id in l.handle.state.read_basis&&(l.handle.complete(),l=null,S=null),_t(),0}l&&s.source_id in l.handle.state.read_basis&&!Ze&&(o(u),l.handle.complete(),l=null,S=null);continue}if(!b.proposal){e.out(`error: agent ended without a proposal for ${s.source_id}`),e.emit?.({type:"error",source_id:s.source_id,message:`error: agent ended without a proposal for ${s.source_id}`}),q.push(s.source_id);continue}let L=be(b.proposal,Me(c,b.proposal),c);if(h("kane_validate",{errors:L.map(t=>t.code)},R.session_id),L.length>0&&Cr(b.proposal,L,t=>e.out(t))&&(h("criteria_dropped",{source_id:s.source_id},R.session_id),L=be(b.proposal,Me(c,b.proposal),c)),L.length>0){e.out("the agent's proposal didn't validate \u2014 retrying once"),e.emit?.({type:"validate_failed",source_id:s.source_id,codes:L.map(t=>t.code),repairing:!0}),h("repair_respawn",{source_id:s.source_id},R.session_id),f&&pe||(St=S?.state.checkpoint?.seq??0);try{b=await gt(R,{...G,graphSlot:C,...ue?{checkpoint:ue}:{}},Ye,c,h,void 0,()=>_e.current)}catch(t){if(t instanceof Fe)return e.out(`error: ${t.message}`),e.emit?.({type:"error",code:"PAIR_MISMATCH",message:t.message}),2;throw t}if(b.error||!b.proposal){e.out(`error: repair run failed for ${s.source_id}`),e.emit?.({type:"error",source_id:s.source_id,message:`error: repair run failed for ${s.source_id}`}),q.push(s.source_id);continue}if(L=be(b.proposal,Me(c,b.proposal),c),L.length>0){h("validation_details",{errors:L.map(t=>({code:t.code,detail:t.detail}))},R.session_id),e.out(`\u2717 validation failed \u2014 ${L.map(t=>t.code).join(", ")} (details: ${te(_)})`),e.emit?.({type:"validate_failed",source_id:s.source_id,codes:L.map(t=>t.code),repairing:!1}),e.emit?.({type:"error",source_id:s.source_id,message:`error: proposal failed validation after repair (${L.map(t=>t.code).join(", ")})`}),q.push(s.source_id);continue}}let A=b.proposal,Ne=gr(A,c),tt=ce(e.contextDir,"proposals",ne);if(ut(tt,{recursive:!0}),lt(ce(tt,"proposal.json"),JSON.stringify(A,null,2)+`
11
11
  `),r.plan){e.out(`plan: ${A.use_cases.length} use-case(s) proposed from ${s.source_id} (nothing committed)`);for(let t of A.use_cases){let n=Ne.get(t.temp_ref),d=n?n.archived?` \u2248 matches ARCHIVED ${n.cid.slice(0,19)}${n.reason?` \u2014 previously rejected: "${n.reason}"`:" \u2014 previously rejected"}`:` \u2248 matches ${n.cid.slice(0,19)}`:"";e.out(` [${t.risk}] ${t.title} \u2014 cite ${t.cite.anchor}${d}`)}e.emit?.({type:"plan",source_id:s.source_id,use_cases:A.use_cases.map(t=>{let n=Ne.get(t.temp_ref);return{risk:t.risk,title:t.title,anchor:t.cite.anchor,...n?{match:n.cid,match_archived:!!n.archived}:{}}})}),b.assumedDefaults&&e.out(`assumed: ${b.assumedDefaults} default(s) auto-taken (assumed)`);continue}for(let t of A.use_cases){if(!t.conflicts_with?.length)continue;let n=t.conflicts_with.filter(g=>c.resolve(g)!==null),d=t.conflicts_with.filter(g=>c.resolve(g)===null);d.length>0&&(e.out(`note: ${t.temp_ref}: dropped unresolvable conflict hint(s): ${d.join(", ")}`),t.conflicts_with=n.length>0?n:void 0)}h("review_start",{use_cases:A.use_cases.length,flags:Ne.size},R.session_id);let He=await e.review(A.use_cases,Ne);if(h("review_verdicts",[...He.entries()].map(([t,n])=>({ref:t,resolution:n.resolution})),R.session_id),lt(ce(tt,"review.json"),JSON.stringify(A.use_cases.map(t=>{let n=He.get(t.temp_ref)??{resolution:"skipped"};return{id:t.temp_ref,kind:"review-item",resolution:n.resolution,edit:n.edit??null,reason:n.reason??null,...n.supersedeTarget?{supersede_target:n.supersedeTarget}:{},by:ge}}),null,2)+`
12
- `),r.posture==="reconcile"){let t=jt(A),n=N=>t.passthrough.use_cases.filter(V=>{let z=V.matches_existing?.cid,H=z?N.resolve(z):null,p=H?N.tipOf(H.cid):null;return p!=null&&(N.trust.get(p)??null)!=="derived"}),d=n(c),g=t.passthrough.use_cases.length-d.length,D=mt(e.contextDir,R.session_id,Ve,e.probe,e.auth),k=new Set(d.map(N=>N.temp_ref));(await ke(D,ht({...t.passthrough,use_cases:d},c),N=>{let V={...t.passthrough,use_cases:n(N.graph).filter(p=>k.has(p.temp_ref))},z=new Map(V.use_cases.map(p=>[p.temp_ref,{resolution:"approved"}])),H=Be({contextDir:e.contextDir,graph:N.graph,proposal:V,proposalId:ne,verdicts:z,by:ge,autoName:!0,allowStaleBasis:!0,eventIds:N.eventIds("extract",1),...ie?{sid:N.sid}:{},probeHits:N.probeHits});return H.errors!==null?{errors:H.errors}:{result:H,record:H.record}})).ok||e.out("note: the unchanged-match evidence attach did not land this run \u2014 the held changeset is unaffected; re-run reconcile to refresh it"),g>0&&e.out(`note: ${g} unchanged match(es) target unreviewed (or no-longer-resolving) item(s) \u2014 evidence not attached (bless them with kane-cli context review; a later reconcile attaches)`);let Q=fe(),O=t.adds.length+t.updates.length+t.archives.length;Q&&O>0&&(Q.save({reconcile:{proposal_id:ne,verdicts:{}}}),de+=O,Oe=Q.state.sid,e.out(`held: ${O} change(s) from ${s.source_id} await your verdicts \u2014 nothing from the changeset committed`),e.emit?.({type:"held",source_id:s.source_id,count:O,reason:"reconcile"}));continue}if((Ae||r.trust==="hold")&&fe()&&A.use_cases.some(t=>t.matches_existing==null)){ze(s,A.use_cases,Ae?"degraded":"trust_hold");continue}let Ct=mt(e.contextDir,R.session_id,Ve,e.probe,e.auth),Dt=t=>{if(t.degradedProbe&&fe()!==null&&A.use_cases.some(d=>d.matches_existing==null))return{result:{degradedHold:!0},record:null};let n=Be({contextDir:e.contextDir,graph:t.graph,proposal:A,proposalId:ne,verdicts:He,by:ge,autoName:!0,allowStaleBasis:!0,eventIds:t.eventIds("extract",1),...ie?{sid:t.sid}:{},probeHits:t.probeHits});return n.errors!==null?{errors:n.errors}:{result:n,record:n.record}},Et=ht(A,c),F=await ke(Ct,Et,Dt);if(!F.ok&&F.kind==="drifted"){if(!await e.confirmStale(`the context changed while you reviewed (${F.asks.map(n=>n.detail).join("; ")}) \u2014 commit against the new head anyway?`)){e.out("aborted: proposal not committed"),e.emit?.({type:"error",source_id:s.source_id,message:"aborted: proposal not committed",code:"STALE_BASIS"}),q.push(s.source_id);continue}F=await ke(Ct,{...Et,sourcePins:[]},Dt)}let rt=F.ok&&"result"in F?F.result:null;if(rt!==null&&"degradedHold"in rt){We(),ze(s,A.use_cases,"degraded");continue}let xe=rt??(F.ok?{record:null,errors:null}:{record:null,errors:F.kind==="validation"?F.errors:F.kind==="contended"?[{code:F.err.code,detail:`a use-case this proposal touches is held by ${F.err.holder?.owner_sid??"another session"} \u2014 try again when it frees`}]:[{code:"UNSETTLED",detail:"concurrent activity kept moving the store \u2014 retry when quieter"}]});if(xe.errors){h("commit_error_details",{errors:xe.errors.map(t=>({code:t.code,detail:t.detail}))},R.session_id),e.out(`\u2717 commit failed \u2014 ${xe.errors.map(t=>t.code).join(", ")} (details: ${te(_)})`),e.emit?.({type:"error",source_id:s.source_id,message:`error: commit failed: ${xe.errors.map(t=>`${t.code}: ${t.detail}`).join("; ")}`}),q.push(s.source_id);continue}let xr=new Date().toISOString();for(let t of A.use_cases){let n=He.get(t.temp_ref)??{resolution:"skipped"};for(let d of Jt({ts:xr,command:"context extract",id:t.temp_ref,by:ge},n.resolution))Kt(e.contextDir,d)}let Z=xe.record;Z.event_ids?.length&&S?.markApplied(Z.event_ids);let st=new Map(Z.review.map(t=>[t.id,t.resolution])),it=[...st.values()].filter(t=>t==="approved"||t==="edited").length,je=[...st.values()].filter(t=>t==="rejected").length,ve=Z.nodes.filter(t=>!st.has(t.cid)).length,ot=Z.supersessions.filter(t=>t.kind==="node"&&t.new!==t.old).length;h("commit",{trusted:it,derived:ve,archived:je},R.session_id),e.out(`saved ${it+ve} use-case(s)`+(ve>0?` \xB7 ${ve} awaiting review`:"")+(je>0?` \xB7 ${je} archived`:"")+(ot>0?` \xB7 ${ot} superseded`:""));{let t=Z.review.filter(n=>n.kind==="pending_update");t.length>0&&(e.out(`${t.length} update(s) held for review`),e.emit?.({type:"update_held",count:t.length,targets:t.map(n=>n.id)}))}b.assumedDefaults&&e.out(`assumed: ${b.assumedDefaults} default(s) auto-taken (assumed)`),e.emit?.({type:"commit",source_id:s.source_id,proposal_id:ne,trusted:it,derived:ve,archived:je,superseded:ot,assumed:b.assumedDefaults??0,evidence_matched:Math.max(0,A.use_cases.length-Z.nodes.length),minted:Z.nodes.map(t=>{let n=Z.names?.find(d=>d.cid===t.cid)?.slug;return{cid:t.cid,...n?{logical_id:n}:{}}})}),l&&s.source_id in l.handle.state.read_basis&&(o(u),l.handle.complete(),e.out(`session ${r.resume} complete`),e.emit?.({type:"session_complete",sid:r.resume,source_id:s.source_id}),m?.event("ASR_SESSION_COMPLETE",{}),l=null,S=null)}if(S){let u=S.state.ingest_schedule??[];u.some(s=>s.status==="pending")&&S.save({ingest_schedule:u.map(s=>s.status==="pending"?{...s,status:"skipped",note:"run ended before its turn \u2014 kane-cli context extract runs it"}:s)})}vt=!0}finally{if(l?.handle.release(),T&&!Pe&&!vt){let o=T.state.checkpoint;if(o){let u=`kane-cli context extract --resume ${T.state.sid} --mode ${a}`;e.out(`session ${T.state.sid} kept its last checkpoint (seq ${o.seq}, ${o.ts}) \u2014 resume with: ${u}`),T.release()}else{try{T.complete()}catch{T.release()}pt()}T=null}}if(I){let o=e.chat?.state.ledger.filter(c=>c.kind==="answer"&&c.receipt.form==="assumed").length??0,u=xt+o,s=e.chat?.state.credits?.total;e.onSummary?.({state:"complete",facts:[`saved ${Y} use-case${Y===1?"":"s"} across ${U.length} source${U.length===1?"":"s"}`,...u>0?[`${u} assumed default(s)`]:[],...s!==void 0?[`credits used: ${s.toFixed(1)}`]:[]],tracePath:te(_)})}if(r.plan||nr(e.contextDir),de>0&&(T||Oe)){Pe=!0;let o=T?.state.sid??Oe,u=`kane-cli context extract --resume ${o} --mode ${a}`;if(I||e.out(`paused: ${de} held item(s) await review \u2014 resume with: ${u}`),e.emit?.({type:"session_paused",sid:o,resume:u,held:de}),I){let s=e.chat?.state.credits?.total;e.onSummary?.({state:"paused",reason:"held for review",facts:[`${de} held item(s) await your review`,...s!==void 0?[`credits used: ${s.toFixed(1)}`]:[]],resume:u,tracePath:te(_)})}return T?.release(),3}return q.length>0&&e.out(`${q.length} of ${U.length} source(s) failed \u2014 re-run kane-cli context extract to retry (${q.join(", ")})`),_t(),q.length>0?1:0}export{mt as a,$r as b,hr as c,pr as d,Rr as e,gr as f,Ss as g};
12
+ `),r.posture==="reconcile"){let t=Bt(A),n=N=>t.passthrough.use_cases.filter(V=>{let z=V.matches_existing?.cid,H=z?N.resolve(z):null,p=H?N.tipOf(H.cid):null;return p!=null&&(N.trust.get(p)??null)!=="derived"}),d=n(c),g=t.passthrough.use_cases.length-d.length,D=mt(e.contextDir,R.session_id,Ve,e.probe,e.auth),k=new Set(d.map(N=>N.temp_ref));(await ke(D,ht({...t.passthrough,use_cases:d},c),N=>{let V={...t.passthrough,use_cases:n(N.graph).filter(p=>k.has(p.temp_ref))},z=new Map(V.use_cases.map(p=>[p.temp_ref,{resolution:"approved"}])),H=Be({contextDir:e.contextDir,graph:N.graph,proposal:V,proposalId:ne,verdicts:z,by:ge,autoName:!0,allowStaleBasis:!0,eventIds:N.eventIds("extract",1),...ie?{sid:N.sid}:{},probeHits:N.probeHits});return H.errors!==null?{errors:H.errors}:{result:H,record:H.record}})).ok||e.out("note: the unchanged-match evidence attach did not land this run \u2014 the held changeset is unaffected; re-run reconcile to refresh it"),g>0&&e.out(`note: ${g} unchanged match(es) target unreviewed (or no-longer-resolving) item(s) \u2014 evidence not attached (bless them with kane-cli context review; a later reconcile attaches)`);let Q=fe(),O=t.adds.length+t.updates.length+t.archives.length;Q&&O>0&&(Q.save({reconcile:{proposal_id:ne,verdicts:{}}}),de+=O,Oe=Q.state.sid,e.out(`held: ${O} change(s) from ${s.source_id} await your verdicts \u2014 nothing from the changeset committed`),e.emit?.({type:"held",source_id:s.source_id,count:O,reason:"reconcile"}));continue}if((Ae||r.trust==="hold")&&fe()&&A.use_cases.some(t=>t.matches_existing==null)){ze(s,A.use_cases,Ae?"degraded":"trust_hold");continue}let Ct=mt(e.contextDir,R.session_id,Ve,e.probe,e.auth),Dt=t=>{if(t.degradedProbe&&fe()!==null&&A.use_cases.some(d=>d.matches_existing==null))return{result:{degradedHold:!0},record:null};let n=Be({contextDir:e.contextDir,graph:t.graph,proposal:A,proposalId:ne,verdicts:He,by:ge,autoName:!0,allowStaleBasis:!0,eventIds:t.eventIds("extract",1),...ie?{sid:t.sid}:{},probeHits:t.probeHits});return n.errors!==null?{errors:n.errors}:{result:n,record:n.record}},Et=ht(A,c),F=await ke(Ct,Et,Dt);if(!F.ok&&F.kind==="drifted"){if(!await e.confirmStale(`the context changed while you reviewed (${F.asks.map(n=>n.detail).join("; ")}) \u2014 commit against the new head anyway?`)){e.out("aborted: proposal not committed"),e.emit?.({type:"error",source_id:s.source_id,message:"aborted: proposal not committed",code:"STALE_BASIS"}),q.push(s.source_id);continue}F=await ke(Ct,{...Et,sourcePins:[]},Dt)}let rt=F.ok&&"result"in F?F.result:null;if(rt!==null&&"degradedHold"in rt){We(),ze(s,A.use_cases,"degraded");continue}let xe=rt??(F.ok?{record:null,errors:null}:{record:null,errors:F.kind==="validation"?F.errors:F.kind==="contended"?[{code:F.err.code,detail:`a use-case this proposal touches is held by ${F.err.holder?.owner_sid??"another session"} \u2014 try again when it frees`}]:[{code:"UNSETTLED",detail:"concurrent activity kept moving the store \u2014 retry when quieter"}]});if(xe.errors){h("commit_error_details",{errors:xe.errors.map(t=>({code:t.code,detail:t.detail}))},R.session_id),e.out(`\u2717 commit failed \u2014 ${xe.errors.map(t=>t.code).join(", ")} (details: ${te(_)})`),e.emit?.({type:"error",source_id:s.source_id,message:`error: commit failed: ${xe.errors.map(t=>`${t.code}: ${t.detail}`).join("; ")}`}),q.push(s.source_id);continue}let xr=new Date().toISOString();for(let t of A.use_cases){let n=He.get(t.temp_ref)??{resolution:"skipped"};for(let d of Jt({ts:xr,command:"context extract",id:t.temp_ref,by:ge},n.resolution))Kt(e.contextDir,d)}let Z=xe.record;Z.event_ids?.length&&S?.markApplied(Z.event_ids);let st=new Map(Z.review.map(t=>[t.id,t.resolution])),it=[...st.values()].filter(t=>t==="approved"||t==="edited").length,je=[...st.values()].filter(t=>t==="rejected").length,ve=Z.nodes.filter(t=>!st.has(t.cid)).length,ot=Z.supersessions.filter(t=>t.kind==="node"&&t.new!==t.old).length;h("commit",{trusted:it,derived:ve,archived:je},R.session_id),e.out(`saved ${it+ve} use-case(s)`+(ve>0?` \xB7 ${ve} awaiting review`:"")+(je>0?` \xB7 ${je} archived`:"")+(ot>0?` \xB7 ${ot} superseded`:""));{let t=Z.review.filter(n=>n.kind==="pending_update");t.length>0&&(e.out(`${t.length} update(s) held for review`),e.emit?.({type:"update_held",count:t.length,targets:t.map(n=>n.id)}))}b.assumedDefaults&&e.out(`assumed: ${b.assumedDefaults} default(s) auto-taken (assumed)`),e.emit?.({type:"commit",source_id:s.source_id,proposal_id:ne,trusted:it,derived:ve,archived:je,superseded:ot,assumed:b.assumedDefaults??0,evidence_matched:Math.max(0,A.use_cases.length-Z.nodes.length),minted:Z.nodes.map(t=>{let n=Z.names?.find(d=>d.cid===t.cid)?.slug;return{cid:t.cid,...n?{logical_id:n}:{}}})}),l&&s.source_id in l.handle.state.read_basis&&(o(u),l.handle.complete(),e.out(`session ${r.resume} complete`),e.emit?.({type:"session_complete",sid:r.resume,source_id:s.source_id}),m?.event("ASR_SESSION_COMPLETE",{}),l=null,S=null)}if(S){let u=S.state.ingest_schedule??[];u.some(s=>s.status==="pending")&&S.save({ingest_schedule:u.map(s=>s.status==="pending"?{...s,status:"skipped",note:"run ended before its turn \u2014 kane-cli context extract runs it"}:s)})}vt=!0}finally{if(l?.handle.release(),T&&!Pe&&!vt){let o=T.state.checkpoint;if(o){let u=`kane-cli context extract --resume ${T.state.sid} --mode ${a}`;e.out(`session ${T.state.sid} kept its last checkpoint (seq ${o.seq}, ${o.ts}) \u2014 resume with: ${u}`),T.release()}else{try{T.complete()}catch{T.release()}pt()}T=null}}if(I){let o=e.chat?.state.ledger.filter(c=>c.kind==="answer"&&c.receipt.form==="assumed").length??0,u=xt+o,s=e.chat?.state.credits?.total;e.onSummary?.({state:"complete",facts:[`saved ${Y} use-case${Y===1?"":"s"} across ${U.length} source${U.length===1?"":"s"}`,...u>0?[`${u} assumed default(s)`]:[],...s!==void 0?[`credits used: ${s.toFixed(1)}`]:[]],tracePath:te(_)})}if(r.plan||nr(e.contextDir),de>0&&(T||Oe)){Pe=!0;let o=T?.state.sid??Oe,u=`kane-cli context extract --resume ${o} --mode ${a}`;if(I||e.out(`paused: ${de} held item(s) await review \u2014 resume with: ${u}`),e.emit?.({type:"session_paused",sid:o,resume:u,held:de}),I){let s=e.chat?.state.credits?.total;e.onSummary?.({state:"paused",reason:"held for review",facts:[`${de} held item(s) await your review`,...s!==void 0?[`credits used: ${s.toFixed(1)}`]:[]],resume:u,tracePath:te(_)})}return T?.release(),3}return q.length>0&&e.out(`${q.length} of ${U.length} source(s) failed \u2014 re-run kane-cli context extract to retry (${q.join(", ")})`),_t(),q.length>0?1:0}export{mt as a,$r as b,hr as c,pr as d,Rr as e,gr as f,Ss as g};
@@ -0,0 +1,4 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{b as U}from"./chunk-DNNZ353O.js";import{a as G}from"./chunk-Q2F5QB2W.js";import{b as I,c as b}from"./chunk-NVGBE2DR.js";import{A as T}from"./chunk-TH47OOBV.js";import{a as L,c as F}from"./chunk-CUM23TLF.js";import{b as P,i as j}from"./chunk-DUAXZYAD.js";import{a as R,d as $,f as D}from"./chunk-WXHQYYD5.js";import{existsSync as ie,mkdirSync as oe,readFileSync as re,writeFileSync as se}from"fs";import{basename as S,extname as H,join as ae}from"path";var K=/^[A-Za-z0-9][A-Za-z0-9._-]*$/;function Z(e){return typeof e=="string"&&e!=="."&&e!==".."&&K.test(e)}function k(e){if(!Z(e))throw new Error(`unsafe logical_id: ${JSON.stringify(e)} \u2014 must match ${String(K)} (no path separators)`)}import{extname as q}from"path";var Q={kind:"jira",media_type:"application/x-kane-jira-envelope",extensions:[],cite:"verbatim",maxBytes:2e6},ee={kind:"confluence",media_type:"application/x-kane-confluence-envelope",extensions:[],cite:"verbatim",maxBytes:2e6},fe={kind:"web",media_type:"application/x-kane-web-envelope",extensions:[],cite:"verbatim",maxBytes:2e6},z=[{kind:"text",media_type:"text/plain",extensions:[".txt"],cite:"verbatim",maxBytes:2e6},{kind:"markdown",media_type:"text/markdown",extensions:[".md",".markdown"],cite:"verbatim",maxBytes:2e6},{kind:"image",media_type:"image/png",extensions:[".png"],cite:"anchor-only",maxBytes:5e6},{kind:"image",media_type:"image/jpeg",extensions:[".jpg",".jpeg"],cite:"anchor-only",maxBytes:5e6},{kind:"image",media_type:"image/webp",extensions:[".webp"],cite:"anchor-only",maxBytes:5e6},{kind:"text",media_type:"application/json",extensions:[".json"],cite:"verbatim",maxBytes:2e6},{kind:"text",media_type:"application/yaml",extensions:[".yaml",".yml"],cite:"verbatim",maxBytes:2e6},{kind:"text",media_type:"application/toml",extensions:[".toml"],cite:"verbatim",maxBytes:2e6},{kind:"text",media_type:"application/xml",extensions:[".xml"],cite:"verbatim",maxBytes:2e6},{kind:"text",media_type:"text/plain",extensions:[".log"],cite:"verbatim",maxBytes:2e6},{kind:"pdf",media_type:"application/pdf",extensions:[".pdf"],cite:"verbatim",maxBytes:25e6,sniff:e=>e.subarray(0,5).toString("latin1")==="%PDF-"},{kind:"docx",media_type:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",extensions:[".docx"],cite:"verbatim",maxBytes:25e6,sniff:e=>e.length>=4&&e[0]===80&&e[1]===75&&e[2]===3&&e[3]===4,sniffFail:e=>e.length>=8&&e.subarray(0,8).equals(te)?"DOCX_ENCRYPTED_OR_LEGACY: password-protected Office file (or a legacy .doc renamed .docx) \u2014 remove the password / save as .docx and re-ingest":void 0},Q,ee],te=Buffer.from([208,207,17,224,161,177,26,225]),M={pdf:"pdf",docx:"docx",jira:"jira",confluence:"confluence",web:"web"},ue=new Set(Object.keys(M));function J(e){let n=q(e).toLowerCase(),t=z.find(i=>i.extensions.includes(n));return t?{ok:!0,media:t}:{ok:!1,code:"UNSUPPORTED_MEDIA",allowlist:z.flatMap(i=>i.extensions)}}function v(e){return e>=1024*1024?`${(e/(1024*1024)).toFixed(1)} MB`:`${Math.max(1,Math.round(e/1024))} KB`}function de(e,n,t){return G({source_id:e,source_cid:"sha256:".padEnd(71,"0"),doc_kind:n,numbered_text:U(t)})}var Y=2e3;function ce(e){let t=S(e,H(e)).toLowerCase().replace(/[^a-z0-9._-]+/g,"-").replace(/^[^a-z0-9]+/,"");return k(t),t}function Me(e){let n=/^(.*?)[-_.]?v?\d+$/.exec(e);if(!n)return null;let t=(n[1]??"").replace(/[-_.]+$/,"");return t.length>0&&t!==e?t:null}function W(e){let n=ae(e,"meta.json");ie(n)||(oe(e,{recursive:!0}),se(n,JSON.stringify({schema:R,canonicalizer:"v1"},null,2)+`
3
+ `))}async function Se(e){let{contextDir:n,filePath:t,asId:i,confirmSameSource:_,converters:h}=e;W(n);let o=re(t),s=J(t);if(!s.ok)throw new Error(`${S(t)} is a file type kane can't ingest (${H(t)||"no extension"}) \u2014 supported: ${s.allowlist.join(" ")} [UNSUPPORTED_MEDIA]`);if(o.byteLength>s.media.maxBytes)throw new Error(`${S(t)} is too large \u2014 ${v(o.byteLength)}, the limit for ${s.media.media_type} is ${v(s.media.maxBytes)} [FILE_TOO_LARGE]`);if(s.media.sniff&&!s.media.sniff(o)){let m=s.media.sniffFail?.(o);throw new Error(m??`MEDIA_SNIFF_MISMATCH: ${t} does not look like ${s.media.media_type}`)}let l;return i!==void 0?(k(i),l=i):l=ce(t),le({contextDir:n,bytes:o,media:s.media,sourceId:l,label:t,confirmSameSource:_,converters:h})}async function le(e){let{contextDir:n,bytes:t,media:i,confirmSameSource:_,converters:h}=e,o=e.sourceId,s=e.label??o;if(W(n),t.byteLength>i.maxBytes)throw new Error(`the content is too large \u2014 ${v(t.byteLength)}, the limit for ${i.media_type} is ${v(i.maxBytes)} [FILE_TOO_LARGE]`);let l=[],m=M[i.kind];if(i.cite==="verbatim"&&!m){try{new TextDecoder("utf-8",{fatal:!0}).decode(t)}catch{throw new Error(`ENCODING_UNSUPPORTED: ${s} is not valid UTF-8 \u2014 re-save it as UTF-8 and re-ingest`)}t.toString("utf8").split(`
4
+ `).some(f=>f.length>Y)&&l.push(`long line detected (> ${Y} chars) \u2014 anchors lose granularity; consider pretty-printing before ingest`)}let p=I(t),y=new Map,c=null,C=!1;for(let f=0;;f++){let x=T(n),u=x.heads.get(o),X=u!=null?x.getNode(u)?.content:void 0;if(u!=null&&X?.blob===p)return{status:"unchanged",source_id:o,cid:u,blob:p};if(u==null){for(let[r,g]of x.heads.entries())if(!(r===o||g==null)&&x.getNode(g)?.content.blob===p){let a;if(y.has(r)?a=y.get(r):f===0&&_?(a=await _(r),y.set(r,a)):(a=!1,y.set(r,a),f>0&&l.push(`same bytes already ingested as '${r}' \u2014 minted under '${o}' anyway (the twin appeared mid-commit; not prompted)`)),a)return{status:"unchanged",source_id:r,cid:g,blob:p};break}}if(c===null){let r={},g,a=null,A=null;if(m){let O=h?.[m];if(!O)throw new Error(`${m.toUpperCase()}_CONVERTER_MISSING: ${m} ingestion requires the converter \u2014 the command layer wires it`);let d=await O(t);a=Buffer.from(d.projection,"utf8");let N=de(o,i.kind,a);if(N>4e5)throw new Error(`PROJECTION_TOO_LARGE: serialized source payload ${N} bytes > ${4e5} \u2014 split the document and re-ingest`);r={text_blob:I(a),...d.inventory.length>0?{images:d.inventory}:{},converter:d.converter},A=d.blobs,g={kind:i.kind,...d.pages!==void 0?{pages:d.pages}:{},delivered:d.delivered.length,omitted:d.inventory.length-d.delivered.length}}c={derived:r,composite:g,projBytes:a,derivedBlobs:A}}if(!C){if(b(n,t),c.projBytes!==null&&b(n,c.projBytes),c.derivedBlobs!==null)for(let[,r]of c.derivedBlobs)b(n,r);C=!0}let w=F(o,p),E=D("source",w);if(E.length>0)throw new Error(`source node fails ${E[0].code}: ${E[0].detail}`);let B=L("source",w);try{j(n,{ts:new Date().toISOString(),proposal_id:null,nodes:[{cid:B,label:$.SOURCE,content:w}],edges:[],review:[],supersessions:[],media:{[o]:{format:i.kind,media_type:i.media_type,anchors_supported:m?["L-L","img#ref"]:i.cite==="verbatim"?["L-L"]:[],...c.derived}},...e.eventIds&&e.eventIds.length>0?{event_ids:e.eventIds}:{},source_head_moves:{[o]:B}},{expectPrev:x.latestHash})}catch(r){if(r instanceof P&&f<3)continue;throw r}return{status:u!=null?"versioned":"created",source_id:o,cid:B,blob:p,...l.length?{warnings:l}:{},...c.composite?{composite:c.composite}:{}}}}export{k as a,Q as b,ee as c,fe as d,ue as e,J as f,de as g,ce as h,Me as i,Se as j,le as k};
@@ -1,5 +1,5 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{c as g}from"./chunk-7F2ZV46B.js";import{readFileSync as o,writeFileSync as h,mkdirSync as u,readdirSync as a,unlinkSync as s,existsSync as l,chmodSync as f}from"fs";import{join as n,dirname as P}from"path";var d=class{baseDir;profilesDir;configFile;constructor(t=g){this.baseDir=t,this.profilesDir=n(t,"profiles"),this.configFile=n(t,"config.json")}readConfig(){try{return JSON.parse(o(this.configFile,"utf-8"))}catch{return{}}}writeConfig(t){u(this.baseDir,{recursive:!0,mode:448}),h(this.configFile,JSON.stringify(t,null,2)+`
2
+ import{c as g}from"./chunk-PH22FRN5.js";import{readFileSync as o,writeFileSync as h,mkdirSync as u,readdirSync as a,unlinkSync as s,existsSync as l,chmodSync as f}from"fs";import{join as n,dirname as P}from"path";var d=class{baseDir;profilesDir;configFile;constructor(t=g){this.baseDir=t,this.profilesDir=n(t,"profiles"),this.configFile=n(t,"config.json")}readConfig(){try{return JSON.parse(o(this.configFile,"utf-8"))}catch{return{}}}writeConfig(t){u(this.baseDir,{recursive:!0,mode:448}),h(this.configFile,JSON.stringify(t,null,2)+`
3
3
  `),f(this.configFile,384)}getActiveProfile(){return this.readConfig().active_profile??null}setActiveProfile(t){let i=this.readConfig();i.active_profile=t,this.writeConfig(i)}getDefaultEnv(){return this.readConfig().default_env??"prod"}setDefaultEnv(t){let i=this.readConfig();i.default_env=t,this.writeConfig(i)}credentialsPath(t,i){return n(this.profilesDir,t,i,"credentials")}clientPath(t,i){return n(this.profilesDir,t,i,"client.json")}basicAuthPath(t,i){return n(this.profilesDir,t,i,"basic-auth")}profileConfigPath(t,i){return n(this.profilesDir,t,i,"profile-config.json")}saveProfileConfig(t,i,r){let e=this.loadProfileConfig(t,i)??{};this.writeSecure(this.profileConfigPath(t,i),{...e,...r})}loadProfileConfig(t,i){try{return JSON.parse(o(this.profileConfigPath(t,i),"utf-8"))}catch{return null}}writeSecure(t,i){try{u(P(t),{recursive:!0,mode:448}),h(t,JSON.stringify(i,null,2)+`
4
4
  `),f(t,384)}catch(r){let e=r instanceof Error?r.message:String(r);process.stderr.write(`[auth] Failed to save credentials: ${e}
5
5
  `)}}saveCredentials(t,i,r){this.writeSecure(this.credentialsPath(t,i),r)}loadCredentials(t,i){try{return JSON.parse(o(this.credentialsPath(t,i),"utf-8"))}catch{return null}}saveClient(t,i,r){this.writeSecure(this.clientPath(t,i),r)}loadClient(t,i){try{return JSON.parse(o(this.clientPath(t,i),"utf-8"))}catch{return null}}getActiveCredentials(){let t=this.getActiveProfile();if(!t)return{credentials:null,profile:null,env:null};let i=this.getDefaultEnv();return{credentials:this.loadCredentials(t,i),profile:t,env:i}}saveBasicAuth(t,i,r){this.writeSecure(this.basicAuthPath(t,i),r)}loadBasicAuth(t,i){try{return JSON.parse(o(this.basicAuthPath(t,i),"utf-8"))}catch{return null}}deleteBasicAuth(t,i){try{s(this.basicAuthPath(t,i))}catch{}}resolveAuth(){let t=this.getActiveProfile();if(!t)return null;let i=this.getDefaultEnv(),r=this.loadBasicAuth(t,i);return r?{method:"basic",...r,profile:t,env:i}:this.loadCredentials(t,i)?{method:"oauth",profile:t,env:i}:null}listProfiles(){let t=[];try{for(let i of a(this.profilesDir)){let r=n(this.profilesDir,i);try{for(let e of a(r)){let c=n(r,e),v=l(n(c,"credentials")),p=l(n(c,"client.json")),y=l(n(c,"basic-auth"));(v||p||y)&&t.push({profile:i,env:e})}}catch{}}}catch{}return t}deleteProfile(t,i){try{s(this.credentialsPath(t,i))}catch{}if(this.getActiveProfile()===t){let r=this.readConfig();delete r.active_profile,this.writeConfig(r)}}deleteProfileFull(t,i){if(i){try{s(this.credentialsPath(t,i))}catch{}try{s(this.clientPath(t,i))}catch{}try{s(this.basicAuthPath(t,i))}catch{}try{s(this.profileConfigPath(t,i))}catch{}}else try{let r=n(this.profilesDir,t);for(let e of a(r)){try{s(n(r,e,"credentials"))}catch{}try{s(n(r,e,"client.json"))}catch{}try{s(n(r,e,"basic-auth"))}catch{}try{s(n(r,e,"profile-config.json"))}catch{}}}catch{}}};export{d as a};
@@ -1,2 +1,2 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{b as V,c as H,d as W,e as re,f as ie}from"./chunk-ZI6UIJUN.js";import{a as se}from"./chunk-JJN76EXE.js";import{c as ee}from"./chunk-WV27D55O.js";import{a as te}from"./chunk-HRZOFTV7.js";import{a as oe}from"./chunk-YTDSQAYN.js";import{b as Y}from"./chunk-OJTCIZDK.js";import{b as Z}from"./chunk-IZ2FJYHG.js";import{a as L}from"./chunk-BPMSNGXQ.js";import{a as T,b as j,d as ne}from"./chunk-VE3SUJMA.js";import{b as J}from"./chunk-TZXXJWHA.js";import{p as b}from"./chunk-56PAQAX5.js";import{b as Q}from"./chunk-AJQT4IWZ.js";import{a as D}from"./chunk-LVN6VHFN.js";import{a as B,e as K}from"./chunk-EYOCNMUM.js";import{a as z}from"./chunk-PXCMEI73.js";import{a as q}from"./chunk-HCBYKLMW.js";import{a as c,b as u,i as I,j as G}from"./chunk-C44QQJR4.js";import{a as me}from"./chunk-6YGTRKDT.js";import{e as F}from"./chunk-UR6MHSHU.js";var s=F(me(),1);import{basename as ve}from"path";var o=F(q(),1);function Ne({resultRef:x,mode:g="singleshot",loginCompleteRef:d}){let{exit:m}=G(),A=(0,s.useRef)(new z),E=(0,s.useRef)(new te),v=(0,s.useRef)(new ee),n=A.current,l=E.current,O=v.current,le=V(),[h,f]=(0,s.useState)(g==="login"?"login":"gate"),[M,ae]=(0,s.useState)(null),[xe,R]=(0,s.useState)(null),[Pe,$]=(0,s.useState)(null),[X,ce]=(0,s.useState)(null),[N,_]=(0,s.useState)([]),P=(0,s.useCallback)((e,t,i,r)=>O.log(e,t,i,r),[O]),we=(0,s.useCallback)((e,t)=>{e?T(n,l,e,t):l.save({project_id:null,project_name:null,folder_id:null,folder_name:null})},[n,l]),C=(0,s.useCallback)(()=>{if(g==="login")d&&(d.current=!0),m();else{let e=l.load().mobile,t=B(e?.tui_target,e?.default_target?.kind),i=(t.kind==="unset"||t.kind==="choose-mobile")&&J();f(i?"target":"input")}},[g,m,d,l]),S=(0,s.useCallback)((e,t)=>{let i=T(n,l,e,t);if(g==="login"){f("ensure-project");return}ne(i)?C():i.projectId?f("ensure-folder"):f("ensure-project")},[n,l,C,g]);I((e,t)=>{t.ctrl&&e==="c"&&b(0,"Ctrl+C exit")});let U=(0,s.useRef)(!1);s.default.useEffect(()=>{U.current||(U.current=!0,g!=="login"&&ie(n,P).then(e=>{ae(e),e.status==="authenticated"?S(e.result.profile,e.result.env):e.status==="needs_pick"?f("pick"):(R(e.profile??null),$(e.env??null),f("login"))}).catch(e=>{ce(`Auth check failed: ${e instanceof Error?e.message:String(e)}`)}))},[n,P]);let ue=(0,s.useCallback)(e=>{x.current={objective:e},m()},[x,m]),fe=(0,s.useCallback)(async(e,t)=>{n.setActiveProfile(e),n.setDefaultEnv(t),(await re(n,e,t,P)).status==="authenticated"?S(e,t):(R(e),$(t),f("login"))},[n,P,S]),w=(0,s.useCallback)(()=>{let e=n.getActiveProfile(),t=n.getDefaultEnv();if(!e)return null;let i=D(t),r=n.loadBasicAuth(e,t);return new oe(i.controllerBaseUrl,async()=>n.loadCredentials(e,t)?.access_token??null,r,P)},[n,P]),de=(0,s.useCallback)(async()=>{let e=w();if(!e)return null;let t=e.cached??await e.resolve();if(!t)return null;let i=D(n.getDefaultEnv()),r=new L(i.tmsBaseUrl,t.username,t.access_key);try{let p=(await r.listProjects()).find(k=>k.name==="KaneAI Generated");if(p)return{id:p.project_id,name:p.name};let y=await r.createProject("KaneAI Generated");return{id:y.id,name:y.name}}catch{return null}},[w,n]),ge=(0,s.useCallback)(async e=>{let t=w();if(!t)return null;let i=t.cached??await t.resolve();if(!i)return null;let r=D(n.getDefaultEnv()),a=new L(r.tmsBaseUrl,i.username,i.access_key);try{let y=(await a.listFolders(e)).find(pe=>pe.name==="Untitled");if(y)return{id:y.id,name:y.name};let k=await a.createFolder(e,"Untitled");return{id:k.id,name:k.name}}catch{return null}},[w,n]);if(h==="gate")return(0,o.jsx)(c,{paddingX:1,children:(0,o.jsx)(u,{color:"yellow",children:"Checking authentication..."})});if(X)return(0,o.jsxs)(c,{flexDirection:"column",paddingX:1,children:[(0,o.jsx)(u,{color:"red",children:X}),(0,o.jsx)(u,{color:"gray",children:"Press Ctrl+C to exit."})]});if(h==="pick"&&M?.status==="needs_pick")return(0,o.jsx)(he,{profiles:M.profiles,onSelect:fe});if(h==="login")return(0,o.jsx)(W,{devMode:process.env.KANE_DEV_MODE==="1",profiles:n.listProfiles(),onBasicLogin:async(e,t,i,r)=>{let{validateBasicAuth:a}=await import("./validate-basic-3CNUDDH7.js");await a(t,i,r),n.saveBasicAuth(e,t,{username:i,access_key:r}),n.setActiveProfile(e),n.setDefaultEnv(t)},onOAuthLogin:async(e,t)=>{let{LoginFlow:i}=await import("./login-flow-TRINUSBB.js");n.setDefaultEnv(t),n.setActiveProfile(e),await new i(e,t,n).login()},onComplete:(e,t)=>{R(e),$(t),n.setActiveProfile(e),n.setDefaultEnv(t),S(e,t)},onCancel:()=>{b(0,"Login cancelled")}});if(h==="ensure-project"){let e=n.getActiveProfile()??"default",t=n.getDefaultEnv(),i=()=>{if(g==="login"){f("ensure-folder");return}T(n,l,e,t).folderId?C():f("ensure-folder")};return(0,o.jsxs)(c,{flexDirection:"column",children:[(0,o.jsx)(c,{paddingX:1,marginBottom:1,children:(0,o.jsx)(u,{color:"yellow",children:"Project & folder are required to save tests \xB7 Esc to use defaults \xB7 Ctrl+C to exit"})}),(0,o.jsx)(Y,{resolver:w(),currentProjectId:l.load().project_id,env:t,onSelect:(r,a)=>{j(n,l,e,t,{projectId:r,projectName:a}),_(p=>[...p,`\u2713 Project: ${a} (${r})`]),i()},onCancel:async()=>{let r=await de();r&&(j(n,l,e,t,{projectId:r.id,projectName:r.name}),_(a=>[...a,`\u2713 Default project: ${r.name} (${r.id})`]),i())}})]})}if(h==="ensure-folder"){let e=n.getActiveProfile()??"default",t=n.getDefaultEnv(),i=n.loadProfileConfig(e,t);return(0,o.jsxs)(c,{flexDirection:"column",children:[(0,o.jsx)(c,{paddingX:1,marginBottom:1,children:(0,o.jsx)(u,{color:"yellow",children:"Project & folder are required to save tests \xB7 Esc to use defaults \xB7 Ctrl+C to exit"})}),(0,o.jsx)(Z,{resolver:w(),projectId:i?.project_id??"",currentFolderId:l.load().folder_id,env:t,onSelect:(r,a)=>{j(n,l,e,t,{folderId:r,folderName:a}),_(p=>[...p,`\u2713 Folder: ${a} (${r})`]),C()},onCancel:async()=>{if(!i?.project_id)return;let r=await ge(i.project_id);r&&(j(n,l,e,t,{folderId:r.id,folderName:r.name}),_(a=>[...a,`\u2713 Default folder: ${r.name} (${r.id})`]),C())}})]})}if(h==="target"){let e=B(l.load().mobile?.tui_target,l.load().mobile?.default_target?.kind).kind==="choose-mobile";return(0,o.jsx)(c,{paddingX:1,children:(0,o.jsx)(se,{mode:e?"mobile-only":"all",onSelect:t=>{l.setMobile({tui_target:t}),f("input")},onCancel:()=>f("input")})})}if(h==="input"){let e=l.load().mobile,t=B(e?.tui_target,e?.default_target?.kind),i=(()=>{if(t.kind==="emulator"||t.kind==="simulator"){let r=e?.default_target?.id??"(no device)",a=e?.default_app?Q(e.default_app)?e.default_app:ve(e.default_app):"(no app)";return`Config: ${K(t.kind)} \xB7 ${r} \xB7 ${a}`}return"Config: Desktop \xB7 Chrome"})();return(0,o.jsxs)(c,{flexDirection:"column",children:[N.length>0&&(0,o.jsx)(c,{flexDirection:"column",paddingX:1,marginBottom:1,children:N.map((r,a)=>(0,o.jsx)(u,{color:"green",children:r},a))}),(0,o.jsx)(c,{paddingX:1,children:(0,o.jsx)(u,{color:"gray",children:i})}),(0,o.jsx)(H,{onSubmit:ue,onEscape:()=>b(0,"User pressed Escape"),history:le,placeholder:"Type an objective..."})]})}return(0,o.jsx)(o.Fragment,{})}function he({profiles:x,onSelect:g}){let[d,m]=(0,s.useState)(0),[A,E]=(0,s.useState)(!1);return I((v,n)=>{if(!A){if(n.escape){b(0,"Profile picker cancelled");return}if(n.upArrow&&d>0&&m(l=>l-1),n.downArrow&&d<x.length-1&&m(l=>l+1),n.return){E(!0);let l=x[d];g(l.profile,l.env).catch(()=>E(!1))}}}),(0,o.jsxs)(c,{flexDirection:"column",paddingX:1,children:[(0,o.jsx)(u,{color:"#ff9500",bold:!0,children:"Select a profile:"}),(0,o.jsx)(c,{marginTop:1,flexDirection:"column",children:x.map((v,n)=>(0,o.jsxs)(u,{children:[n===d?"\u276F ":" ",(0,o.jsx)(u,{color:n===d?"#ff9500":"white",bold:n===d,children:v.profile}),(0,o.jsxs)(u,{color:"gray",children:[" [",v.env,"]"]})]},`${v.profile}-${v.env}`))}),A&&(0,o.jsx)(c,{marginTop:1,children:(0,o.jsx)(u,{color:"yellow",children:"Validating credentials..."})})]})}export{Ne as a};
2
+ import{b as V,c as H,d as W,e as re,f as ie}from"./chunk-4CHO7SAT.js";import{a as se}from"./chunk-L77ZOU4N.js";import{c as ee}from"./chunk-UONRTWLU.js";import{a as te}from"./chunk-BDUCWZYO.js";import{a as oe}from"./chunk-VYYTENPY.js";import{b as Y}from"./chunk-GJED4QGF.js";import{b as Z}from"./chunk-PRLTUEKP.js";import{a as L}from"./chunk-BPMSNGXQ.js";import{a as T,b as j,d as ne}from"./chunk-VE3SUJMA.js";import{b as J}from"./chunk-TZXXJWHA.js";import{p as b}from"./chunk-56PAQAX5.js";import{b as Q}from"./chunk-66RJPH73.js";import{a as D}from"./chunk-JT7I6OST.js";import{a as B,e as K}from"./chunk-EYOCNMUM.js";import{a as z}from"./chunk-XHNPNYJP.js";import{a as q}from"./chunk-HCBYKLMW.js";import{a as c,b as u,i as I,j as G}from"./chunk-C44QQJR4.js";import{a as me}from"./chunk-6YGTRKDT.js";import{e as F}from"./chunk-UR6MHSHU.js";var s=F(me(),1);import{basename as ve}from"path";var o=F(q(),1);function Ne({resultRef:x,mode:g="singleshot",loginCompleteRef:d}){let{exit:m}=G(),A=(0,s.useRef)(new z),E=(0,s.useRef)(new te),v=(0,s.useRef)(new ee),n=A.current,l=E.current,O=v.current,le=V(),[h,f]=(0,s.useState)(g==="login"?"login":"gate"),[M,ae]=(0,s.useState)(null),[xe,R]=(0,s.useState)(null),[Pe,$]=(0,s.useState)(null),[X,ce]=(0,s.useState)(null),[N,_]=(0,s.useState)([]),P=(0,s.useCallback)((e,t,i,r)=>O.log(e,t,i,r),[O]),we=(0,s.useCallback)((e,t)=>{e?T(n,l,e,t):l.save({project_id:null,project_name:null,folder_id:null,folder_name:null})},[n,l]),C=(0,s.useCallback)(()=>{if(g==="login")d&&(d.current=!0),m();else{let e=l.load().mobile,t=B(e?.tui_target,e?.default_target?.kind),i=(t.kind==="unset"||t.kind==="choose-mobile")&&J();f(i?"target":"input")}},[g,m,d,l]),S=(0,s.useCallback)((e,t)=>{let i=T(n,l,e,t);if(g==="login"){f("ensure-project");return}ne(i)?C():i.projectId?f("ensure-folder"):f("ensure-project")},[n,l,C,g]);I((e,t)=>{t.ctrl&&e==="c"&&b(0,"Ctrl+C exit")});let U=(0,s.useRef)(!1);s.default.useEffect(()=>{U.current||(U.current=!0,g!=="login"&&ie(n,P).then(e=>{ae(e),e.status==="authenticated"?S(e.result.profile,e.result.env):e.status==="needs_pick"?f("pick"):(R(e.profile??null),$(e.env??null),f("login"))}).catch(e=>{ce(`Auth check failed: ${e instanceof Error?e.message:String(e)}`)}))},[n,P]);let ue=(0,s.useCallback)(e=>{x.current={objective:e},m()},[x,m]),fe=(0,s.useCallback)(async(e,t)=>{n.setActiveProfile(e),n.setDefaultEnv(t),(await re(n,e,t,P)).status==="authenticated"?S(e,t):(R(e),$(t),f("login"))},[n,P,S]),w=(0,s.useCallback)(()=>{let e=n.getActiveProfile(),t=n.getDefaultEnv();if(!e)return null;let i=D(t),r=n.loadBasicAuth(e,t);return new oe(i.controllerBaseUrl,async()=>n.loadCredentials(e,t)?.access_token??null,r,P)},[n,P]),de=(0,s.useCallback)(async()=>{let e=w();if(!e)return null;let t=e.cached??await e.resolve();if(!t)return null;let i=D(n.getDefaultEnv()),r=new L(i.tmsBaseUrl,t.username,t.access_key);try{let p=(await r.listProjects()).find(k=>k.name==="KaneAI Generated");if(p)return{id:p.project_id,name:p.name};let y=await r.createProject("KaneAI Generated");return{id:y.id,name:y.name}}catch{return null}},[w,n]),ge=(0,s.useCallback)(async e=>{let t=w();if(!t)return null;let i=t.cached??await t.resolve();if(!i)return null;let r=D(n.getDefaultEnv()),a=new L(r.tmsBaseUrl,i.username,i.access_key);try{let y=(await a.listFolders(e)).find(pe=>pe.name==="Untitled");if(y)return{id:y.id,name:y.name};let k=await a.createFolder(e,"Untitled");return{id:k.id,name:k.name}}catch{return null}},[w,n]);if(h==="gate")return(0,o.jsx)(c,{paddingX:1,children:(0,o.jsx)(u,{color:"yellow",children:"Checking authentication..."})});if(X)return(0,o.jsxs)(c,{flexDirection:"column",paddingX:1,children:[(0,o.jsx)(u,{color:"red",children:X}),(0,o.jsx)(u,{color:"gray",children:"Press Ctrl+C to exit."})]});if(h==="pick"&&M?.status==="needs_pick")return(0,o.jsx)(he,{profiles:M.profiles,onSelect:fe});if(h==="login")return(0,o.jsx)(W,{devMode:process.env.KANE_DEV_MODE==="1",profiles:n.listProfiles(),onBasicLogin:async(e,t,i,r)=>{let{validateBasicAuth:a}=await import("./validate-basic-X2XPEBFD.js");await a(t,i,r),n.saveBasicAuth(e,t,{username:i,access_key:r}),n.setActiveProfile(e),n.setDefaultEnv(t)},onOAuthLogin:async(e,t)=>{let{LoginFlow:i}=await import("./login-flow-W5SAB7NN.js");n.setDefaultEnv(t),n.setActiveProfile(e),await new i(e,t,n).login()},onComplete:(e,t)=>{R(e),$(t),n.setActiveProfile(e),n.setDefaultEnv(t),S(e,t)},onCancel:()=>{b(0,"Login cancelled")}});if(h==="ensure-project"){let e=n.getActiveProfile()??"default",t=n.getDefaultEnv(),i=()=>{if(g==="login"){f("ensure-folder");return}T(n,l,e,t).folderId?C():f("ensure-folder")};return(0,o.jsxs)(c,{flexDirection:"column",children:[(0,o.jsx)(c,{paddingX:1,marginBottom:1,children:(0,o.jsx)(u,{color:"yellow",children:"Project & folder are required to save tests \xB7 Esc to use defaults \xB7 Ctrl+C to exit"})}),(0,o.jsx)(Y,{resolver:w(),currentProjectId:l.load().project_id,env:t,onSelect:(r,a)=>{j(n,l,e,t,{projectId:r,projectName:a}),_(p=>[...p,`\u2713 Project: ${a} (${r})`]),i()},onCancel:async()=>{let r=await de();r&&(j(n,l,e,t,{projectId:r.id,projectName:r.name}),_(a=>[...a,`\u2713 Default project: ${r.name} (${r.id})`]),i())}})]})}if(h==="ensure-folder"){let e=n.getActiveProfile()??"default",t=n.getDefaultEnv(),i=n.loadProfileConfig(e,t);return(0,o.jsxs)(c,{flexDirection:"column",children:[(0,o.jsx)(c,{paddingX:1,marginBottom:1,children:(0,o.jsx)(u,{color:"yellow",children:"Project & folder are required to save tests \xB7 Esc to use defaults \xB7 Ctrl+C to exit"})}),(0,o.jsx)(Z,{resolver:w(),projectId:i?.project_id??"",currentFolderId:l.load().folder_id,env:t,onSelect:(r,a)=>{j(n,l,e,t,{folderId:r,folderName:a}),_(p=>[...p,`\u2713 Folder: ${a} (${r})`]),C()},onCancel:async()=>{if(!i?.project_id)return;let r=await ge(i.project_id);r&&(j(n,l,e,t,{folderId:r.id,folderName:r.name}),_(a=>[...a,`\u2713 Default folder: ${r.name} (${r.id})`]),C())}})]})}if(h==="target"){let e=B(l.load().mobile?.tui_target,l.load().mobile?.default_target?.kind).kind==="choose-mobile";return(0,o.jsx)(c,{paddingX:1,children:(0,o.jsx)(se,{mode:e?"mobile-only":"all",onSelect:t=>{l.setMobile({tui_target:t}),f("input")},onCancel:()=>f("input")})})}if(h==="input"){let e=l.load().mobile,t=B(e?.tui_target,e?.default_target?.kind),i=(()=>{if(t.kind==="emulator"||t.kind==="simulator"){let r=e?.default_target?.id??"(no device)",a=e?.default_app?Q(e.default_app)?e.default_app:ve(e.default_app):"(no app)";return`Config: ${K(t.kind)} \xB7 ${r} \xB7 ${a}`}return"Config: Desktop \xB7 Chrome"})();return(0,o.jsxs)(c,{flexDirection:"column",children:[N.length>0&&(0,o.jsx)(c,{flexDirection:"column",paddingX:1,marginBottom:1,children:N.map((r,a)=>(0,o.jsx)(u,{color:"green",children:r},a))}),(0,o.jsx)(c,{paddingX:1,children:(0,o.jsx)(u,{color:"gray",children:i})}),(0,o.jsx)(H,{onSubmit:ue,onEscape:()=>b(0,"User pressed Escape"),history:le,placeholder:"Type an objective..."})]})}return(0,o.jsx)(o.Fragment,{})}function he({profiles:x,onSelect:g}){let[d,m]=(0,s.useState)(0),[A,E]=(0,s.useState)(!1);return I((v,n)=>{if(!A){if(n.escape){b(0,"Profile picker cancelled");return}if(n.upArrow&&d>0&&m(l=>l-1),n.downArrow&&d<x.length-1&&m(l=>l+1),n.return){E(!0);let l=x[d];g(l.profile,l.env).catch(()=>E(!1))}}}),(0,o.jsxs)(c,{flexDirection:"column",paddingX:1,children:[(0,o.jsx)(u,{color:"#ff9500",bold:!0,children:"Select a profile:"}),(0,o.jsx)(c,{marginTop:1,flexDirection:"column",children:x.map((v,n)=>(0,o.jsxs)(u,{children:[n===d?"\u276F ":" ",(0,o.jsx)(u,{color:n===d?"#ff9500":"white",bold:n===d,children:v.profile}),(0,o.jsxs)(u,{color:"gray",children:[" [",v.env,"]"]})]},`${v.profile}-${v.env}`))}),A&&(0,o.jsx)(c,{marginTop:1,children:(0,o.jsx)(u,{color:"yellow",children:"Validating credentials..."})})]})}export{Ne as a};
@@ -1,3 +1,3 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
2
  function l(r){let{isAgent:c,log:m}=r,a=r.stdout??process.stderr,s=r.stdin??process.stdin,p=t=>{c&&process.stdout.write(JSON.stringify(t)+`
3
- `)};return{async runSteps(t){let{default:e}=await import("./react-QWOAB3TB.js"),{render:o}=await import("./build-JIKYOZUH.js"),{TestMdRunView:i}=await import("./TestMdRunView-ISOVQ7YP.js"),{ScrollbackProvider:n}=await import("./scrollback-JLPJR25X.js"),{waitUntilExit:d}=o(e.createElement(n,null,e.createElement(i,t)),{stdout:a,stdin:s,exitOnCtrlC:!1});await d()},async runUpload(t,e){let{renderUploadProgress:o}=await import("./CliUploadProgress-TZ55LONO.js");return await o(t,e)},async onSummary(t){try{let{default:e}=await import("./react-QWOAB3TB.js"),{render:o}=await import("./build-JIKYOZUH.js"),{AutoExitSummaryBox:i}=await import("./SummaryBox-HYNINDNN.js"),{waitUntilExit:n}=o(e.createElement(i,{data:t}),{stdout:a,stdin:s});await n()}catch(e){m("warn","TEST_MD_SUMMARY_RENDER_FAILED","Summary box render failed",{error:String(e)})}},async onLinks(t){try{let{default:e}=await import("./react-QWOAB3TB.js"),{render:o}=await import("./build-JIKYOZUH.js"),{LinksBox:i}=await import("./LinksBox-ENNF7TDJ.js"),{waitUntilExit:n}=o(e.createElement(i,t),{stdout:a,stdin:s});await n()}catch(e){m("warn","TEST_MD_LINKS_RENDER_FAILED","LinksBox render failed",{error:String(e)})}},onLockState(t){p({type:"test_md_lock_state",...t})},onRetryAttempt(t){p({type:"test_md_retry_attempt",...t})},onAgentEvent(t){p(t)}}}export{l as a};
3
+ `)};return{async runSteps(t){let{default:e}=await import("./react-QWOAB3TB.js"),{render:o}=await import("./build-JIKYOZUH.js"),{TestMdRunView:i}=await import("./TestMdRunView-PPM6LD3I.js"),{ScrollbackProvider:n}=await import("./scrollback-JLPJR25X.js"),{waitUntilExit:d}=o(e.createElement(n,null,e.createElement(i,t)),{stdout:a,stdin:s,exitOnCtrlC:!1});await d()},async runUpload(t,e){let{renderUploadProgress:o}=await import("./CliUploadProgress-LEOJTXHT.js");return await o(t,e)},async onSummary(t){try{let{default:e}=await import("./react-QWOAB3TB.js"),{render:o}=await import("./build-JIKYOZUH.js"),{AutoExitSummaryBox:i}=await import("./SummaryBox-QWKW5FHK.js"),{waitUntilExit:n}=o(e.createElement(i,{data:t}),{stdout:a,stdin:s});await n()}catch(e){m("warn","TEST_MD_SUMMARY_RENDER_FAILED","Summary box render failed",{error:String(e)})}},async onLinks(t){try{let{default:e}=await import("./react-QWOAB3TB.js"),{render:o}=await import("./build-JIKYOZUH.js"),{LinksBox:i}=await import("./LinksBox-6SKDUB5T.js"),{waitUntilExit:n}=o(e.createElement(i,t),{stdout:a,stdin:s});await n()}catch(e){m("warn","TEST_MD_LINKS_RENDER_FAILED","LinksBox render failed",{error:String(e)})}},onLockState(t){p({type:"test_md_lock_state",...t})},onRetryAttempt(t){p({type:"test_md_retry_attempt",...t})},onAgentEvent(t){p(t)}}}export{l as a};