@testmuai/kane-cli 0.8.5 → 0.8.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (163) hide show
  1. package/dist/{ChatSurface-HAIVTS4J.js → ChatSurface-S2P7WMBI.js} +1 -1
  2. package/dist/{ChromeProfilePicker-5ILSVC2K.js → ChromeProfilePicker-7DTJK2QW.js} +1 -1
  3. package/dist/{CliFeedbackPrompt-LFKEYMKP.js → CliFeedbackPrompt-Y3OYZX54.js} +1 -1
  4. package/dist/{CliUploadProgress-Y7ITY2I7.js → CliUploadProgress-I3N5WDNJ.js} +1 -1
  5. package/dist/{ConfigView-OECNNCXC.js → ConfigView-EOYCKYJS.js} +1 -1
  6. package/dist/{EvidenceViewOffer-FODRAS6Z.js → EvidenceViewOffer-AQ3KB3EN.js} +1 -1
  7. package/dist/FolderPicker-RCHRYYC4.js +2 -0
  8. package/dist/{InfoBox-HWMHNWPM.js → InfoBox-QBXPPMM2.js} +1 -1
  9. package/dist/{LinksBox-TAGYCFFO.js → LinksBox-L24KON4U.js} +1 -1
  10. package/dist/{ProfilesView-QJBR3RCM.js → ProfilesView-H6XCTIXI.js} +1 -1
  11. package/dist/{ProjectPicker-PP75ILZU.js → ProjectPicker-F6JGF2B3.js} +1 -1
  12. package/dist/{SaveSessionPrompt-UCRET3II.js → SaveSessionPrompt-QGO65DZN.js} +1 -1
  13. package/dist/SingleShotApp-AY3XFEYT.js +2 -0
  14. package/dist/{SummaryBox-SLM3OFS2.js → SummaryBox-OZIZQY4B.js} +1 -1
  15. package/dist/TestMdRunView-RPW4MIJA.js +2 -0
  16. package/dist/{TestrunEvidenceTable-PTIBYAXO.js → TestrunEvidenceTable-A7WTTKTV.js} +1 -1
  17. package/dist/{WhoamiView-WPHMNYUV.js → WhoamiView-EB5AV27X.js} +1 -1
  18. package/dist/{app-download-GYQYLGT3.js → app-download-SQ4RDY3E.js} +1 -1
  19. package/dist/{auth-3DLNMZC2.js → auth-TW24FZQF.js} +1 -1
  20. package/dist/{binary-XJ3RF3VO.js → binary-5LMQJ3CZ.js} +1 -1
  21. package/dist/{bind-2N4Q6YKH.js → bind-SJ6DOVQ4.js} +2 -2
  22. package/dist/{bootstrap-5IHKW5SE.js → bootstrap-BTEXO6HX.js} +1 -1
  23. package/dist/bridge-GQJ35GTL.js +2 -0
  24. package/dist/{changelog-WCCTI47M.js → changelog-JLSLSA3Y.js} +1 -1
  25. package/dist/chunk-2DCNCH32.js +4 -0
  26. package/dist/{chunk-PEI2566X.js → chunk-2R7KL7YG.js} +1 -1
  27. package/dist/{chunk-T3XDMR5B.js → chunk-3LEVCW6R.js} +1 -1
  28. package/dist/{chunk-NLECZCMZ.js → chunk-3UUPP5W3.js} +1 -1
  29. package/dist/{chunk-PCOSE5SW.js → chunk-4NSP2NPT.js} +1 -1
  30. package/dist/{chunk-FTZPWXF7.js → chunk-4ONGF4NT.js} +1 -1
  31. package/dist/{chunk-ZFZ7YXEU.js → chunk-5COGCNED.js} +1 -1
  32. package/dist/{chunk-DCUT3GJA.js → chunk-7VZCXW74.js} +1 -1
  33. package/dist/{chunk-CGYSFLM2.js → chunk-A44G533S.js} +1 -1
  34. package/dist/{chunk-ZIRMSWKS.js → chunk-AO3PBE2V.js} +1 -1
  35. package/dist/{chunk-AJPLHW4T.js → chunk-ATWDQCDA.js} +1 -1
  36. package/dist/{chunk-UX3KPYTI.js → chunk-AWD56KGX.js} +1 -1
  37. package/dist/{chunk-YFLKS4UV.js → chunk-B4Q6FMIP.js} +3 -3
  38. package/dist/chunk-B5QGIUJA.js +26 -0
  39. package/dist/chunk-BN6AHQL7.js +17 -0
  40. package/dist/chunk-BRTARADN.js +4 -0
  41. package/dist/{chunk-BAL7E4OH.js → chunk-C4WTZSX4.js} +1 -1
  42. package/dist/{chunk-TCK3QMKY.js → chunk-CLLQQPBZ.js} +1 -1
  43. package/dist/{chunk-LA2EMSHE.js → chunk-CZUOGGUK.js} +1 -1
  44. package/dist/{chunk-FRSHEJUS.js → chunk-D4SRHIJ5.js} +1 -1
  45. package/dist/{chunk-Z2T7E5HM.js → chunk-DN3E6RT6.js} +2 -2
  46. package/dist/{chunk-PUFJEU46.js → chunk-DZCG7FFP.js} +1 -1
  47. package/dist/{chunk-CNNJ4U2L.js → chunk-E5S4BASB.js} +1 -1
  48. package/dist/{chunk-HQWLSA5M.js → chunk-ESC7AOCX.js} +1 -1
  49. package/dist/{chunk-W27F2NWA.js → chunk-EXERQHXV.js} +1 -1
  50. package/dist/{chunk-PWYEOBXV.js → chunk-FJYDEWOA.js} +1 -1
  51. package/dist/{chunk-35EUIBYJ.js → chunk-FMUCZWS3.js} +1 -1
  52. package/dist/{chunk-PB3GADUD.js → chunk-FUNKVREV.js} +1 -1
  53. package/dist/{chunk-GZ4X53ZA.js → chunk-FYS5VIOG.js} +2 -2
  54. package/dist/{chunk-HFCDUFV3.js → chunk-GC5U55MW.js} +1 -1
  55. package/dist/{chunk-RY6TFVAX.js → chunk-GELPKSLC.js} +1 -1
  56. package/dist/{chunk-5S46D5AJ.js → chunk-IGJIDN4U.js} +1 -1
  57. package/dist/{chunk-K2QV7FGP.js → chunk-INK66XQS.js} +1 -1
  58. package/dist/{chunk-EFRJNPBZ.js → chunk-IWM5EZC3.js} +2 -2
  59. package/dist/chunk-JCD6FP7A.js +5 -0
  60. package/dist/{chunk-M335FQYJ.js → chunk-JN44V63O.js} +2 -2
  61. package/dist/{chunk-GYF4CH62.js → chunk-KDXQNLVV.js} +2 -2
  62. package/dist/{chunk-O3AY6JHJ.js → chunk-KLTKEGDH.js} +1 -1
  63. package/dist/{chunk-MJ56GUKS.js → chunk-KQ2MYMOS.js} +1 -1
  64. package/dist/chunk-LN7233E2.js +20 -0
  65. package/dist/{chunk-KWKUMBHS.js → chunk-MKSTP2XN.js} +2 -2
  66. package/dist/{chunk-NHOHQBIF.js → chunk-NT3UETTV.js} +1 -1
  67. package/dist/{chunk-CCUGKBIH.js → chunk-OFW3ZVTP.js} +1 -1
  68. package/dist/{chunk-WLOGO44E.js → chunk-OYJBABRV.js} +1 -1
  69. package/dist/{chunk-JJWQUQJ2.js → chunk-P3RKXL3V.js} +1 -1
  70. package/dist/{chunk-MUGMUKSZ.js → chunk-PT7V5WDQ.js} +1 -1
  71. package/dist/chunk-Q4V2GK5U.js +2 -0
  72. package/dist/{chunk-3AJ3QSF5.js → chunk-QBG7XEGQ.js} +2 -2
  73. package/dist/{chunk-E3BXNQYE.js → chunk-QISE272H.js} +1 -1
  74. package/dist/{chunk-G4AFOZKU.js → chunk-QQAAPFIR.js} +1 -1
  75. package/dist/{chunk-PQUMOFT5.js → chunk-RDNKYRKY.js} +1 -1
  76. package/dist/{chunk-5NSYHRDN.js → chunk-RX5TZZNQ.js} +1 -1
  77. package/dist/{chunk-TJZMYU2W.js → chunk-RZLD7TPG.js} +1 -1
  78. package/dist/{chunk-66BSTNLD.js → chunk-S66MCU2Y.js} +1 -1
  79. package/dist/{chunk-WYST42WI.js → chunk-SORVX3KI.js} +1 -1
  80. package/dist/{chunk-KX2GOJ4C.js → chunk-SQC4P2Q7.js} +1 -1
  81. package/dist/{chunk-JRQKUQWL.js → chunk-SQGBFCFO.js} +1 -1
  82. package/dist/{chunk-T5LKD2OB.js → chunk-SS5TOK2J.js} +1 -1
  83. package/dist/{chunk-DJ7T7BMV.js → chunk-TDS6LG6T.js} +1 -1
  84. package/dist/{chunk-7JUUNZQP.js → chunk-TKYJTXWL.js} +1 -1
  85. package/dist/{chunk-JN2DP4R2.js → chunk-TQKIE7AX.js} +1 -1
  86. package/dist/{chunk-K7UYWAZH.js → chunk-TZFT7R7B.js} +1 -1
  87. package/dist/{chunk-AMULIFC5.js → chunk-USI2WMAK.js} +1 -1
  88. package/dist/{chunk-NYSMQ7UY.js → chunk-VMCSRLRC.js} +1 -1
  89. package/dist/{chunk-7PADFQ5S.js → chunk-VOBXYDJW.js} +2 -2
  90. package/dist/{chunk-R7OGNE3W.js → chunk-WMQJBEQP.js} +1 -1
  91. package/dist/{chunk-OWTEHU6B.js → chunk-XJILZ2WN.js} +1 -1
  92. package/dist/{chunk-2K2BX23I.js → chunk-XQFITNA3.js} +1 -1
  93. package/dist/{chunk-4D3DNCQY.js → chunk-XY325HDJ.js} +1 -1
  94. package/dist/{chunk-Q6JHBDW2.js → chunk-YEQVJWEF.js} +1 -1
  95. package/dist/{chunk-6BTZ2Q4P.js → chunk-YHTYPTDD.js} +1 -1
  96. package/dist/{chunk-2WSOPZJU.js → chunk-YZ45OEH3.js} +1 -1
  97. package/dist/{chunk-BJHII5SD.js → chunk-Z35BUPZT.js} +1 -1
  98. package/dist/{chunk-4UMQDH52.js → chunk-ZLSWHCWO.js} +1 -1
  99. package/dist/{chunk-FDWEL5HR.js → chunk-ZRKPZLLG.js} +1 -1
  100. package/dist/{config-OKTAPFOT.js → config-6TQIMTNB.js} +1 -1
  101. package/dist/{credentials-SO3DSQEM.js → credentials-ZSNM4BTD.js} +1 -1
  102. package/dist/{deps-bundle-FRM65BQO.js → deps-bundle-D2ZC2SPT.js} +1 -1
  103. package/dist/{deps-resolve-RPZORKUN.js → deps-resolve-VRBMFUTX.js} +1 -1
  104. package/dist/{dispatch-OZRMWY25.js → dispatch-2PBSJ7YW.js} +1 -1
  105. package/dist/doctor-OWRRDA4Z.js +2 -0
  106. package/dist/{evidence-5AUZMKE3.js → evidence-NDAKCCHQ.js} +1 -1
  107. package/dist/{evolve-cmd-TWYJL4EG.js → evolve-cmd-DIA5EWUT.js} +1 -1
  108. package/dist/{extract-bind-EW7XUDLQ.js → extract-bind-TJ2STXV5.js} +2 -2
  109. package/dist/{extract-cmd-HOVGMBGM.js → extract-cmd-FLOYO6HL.js} +1 -1
  110. package/dist/{generate-headless-FYTJULPG.js → generate-headless-DBT4MKQT.js} +2 -2
  111. package/dist/index.js +69 -69
  112. package/dist/{ingest-4447MYLF.js → ingest-JO5NJENZ.js} +1 -1
  113. package/dist/{ingest-cmd-RJLTFNMN.js → ingest-cmd-T6HM3AHK.js} +1 -1
  114. package/dist/install-NIVU4XVS.js +2 -0
  115. package/dist/{interactive-bind-PSEYAL54.js → interactive-bind-7UDJY4CF.js} +3 -3
  116. package/dist/{list-commands-2SVSEAP6.js → list-commands-DA4ZXOPJ.js} +1 -1
  117. package/dist/login-flow-NHBJVDW6.js +2 -0
  118. package/dist/{mobile-prompts-T6HZ2YLY.js → mobile-prompts-JS7GPVKS.js} +1 -1
  119. package/dist/{persist-recorded-session-O2NCYTSD.js → persist-recorded-session-LE3LGFOS.js} +1 -1
  120. package/dist/pipeline-MTAZDCZR.js +2 -0
  121. package/dist/prepare-target-YK2DLDWB.js +2 -0
  122. package/dist/{reconcile-cmd-FU3JIHTO.js → reconcile-cmd-CYRYVS5B.js} +1 -1
  123. package/dist/{reconcile-deps-SUKZA2FL.js → reconcile-deps-FYXRAMF2.js} +2 -2
  124. package/dist/{reconcile-engine-ILL4M3NW.js → reconcile-engine-6AT6EVGS.js} +1 -1
  125. package/dist/{recording-banner-5VXVKCV4.js → recording-banner-YMKWR3M3.js} +1 -1
  126. package/dist/{registry-BKV3EDTK.js → registry-V45ZQ6Q5.js} +1 -1
  127. package/dist/{require-project-folder-2IO6IX5W.js → require-project-folder-3KS7KTME.js} +1 -1
  128. package/dist/resolve-run-intent-W32G6WM6.js +2 -0
  129. package/dist/{resolver-CBTWTZZR.js → resolver-V5VP5FLT.js} +1 -1
  130. package/dist/{run-EXIYK6PU.js → run-26IR3CKX.js} +1 -1
  131. package/dist/{run-R7GND73C.js → run-5IYI2TJI.js} +1 -1
  132. package/dist/{run-test-md-664ASWRQ.js → run-test-md-FO2RNNOD.js} +2 -2
  133. package/dist/{skill-installer-QLQK4JJE.js → skill-installer-W4TT5MST.js} +1 -1
  134. package/dist/{spawner-ANLF7OX3.js → spawner-ZSYJQGQW.js} +1 -1
  135. package/dist/tcg-generate-ONLV5GXG.js +2 -0
  136. package/dist/{testmd-actions-QZD3N4EH.js → testmd-actions-NPILETCQ.js} +1 -1
  137. package/dist/token-refresh-G2CSTY4B.js +2 -0
  138. package/dist/{types-VYEOJ6U2.js → types-O23GN2YM.js} +1 -1
  139. package/dist/{validate-basic-D7IJUFUQ.js → validate-basic-727KRHX6.js} +1 -1
  140. package/dist/{verdicts-EO5TZ5BW.js → verdicts-TDJLJJ3F.js} +1 -1
  141. package/dist/{version-check-JRLPWQ6T.js → version-check-A2JQYRI2.js} +1 -1
  142. package/dist/{walk-session-IODOH7QU.js → walk-session-HB3OOWVR.js} +1 -1
  143. package/dist/{with-telemetry-ASNQQBGP.js → with-telemetry-HSD6CXDS.js} +1 -1
  144. package/package.json +11 -11
  145. package/dist/FolderPicker-5U3RHHBE.js +0 -2
  146. package/dist/SingleShotApp-XWOPGLKZ.js +0 -2
  147. package/dist/TestMdRunView-6BY3IUH5.js +0 -2
  148. package/dist/bridge-LOBTHY3P.js +0 -2
  149. package/dist/chunk-6DTWVLSJ.js +0 -4
  150. package/dist/chunk-BG66IAO6.js +0 -19
  151. package/dist/chunk-BVKDHHPK.js +0 -5
  152. package/dist/chunk-KBMQGNKO.js +0 -26
  153. package/dist/chunk-UOMRMCMI.js +0 -2
  154. package/dist/chunk-VT2XNEOD.js +0 -10
  155. package/dist/chunk-X2FM67OM.js +0 -4
  156. package/dist/doctor-VWGEQYBB.js +0 -2
  157. package/dist/install-46S4VOZ4.js +0 -2
  158. package/dist/login-flow-U43QVFPH.js +0 -2
  159. package/dist/pipeline-BHEA7ODT.js +0 -2
  160. package/dist/prepare-target-27UN4KNO.js +0 -2
  161. package/dist/resolve-run-intent-ZML3HKG7.js +0 -2
  162. package/dist/tcg-generate-VBC5ODDI.js +0 -2
  163. package/dist/token-refresh-PIUX5OFA.js +0 -2
@@ -1,10 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as D,b as F}from"./chunk-2UIHS2FH.js";import{a as ce}from"./chunk-YKTYVJBN.js";import{a as k,b as se,c as ie,d as ae,k as P}from"./chunk-X2FM67OM.js";import{a as J}from"./chunk-N2P4MI32.js";import{b as B,d as M}from"./chunk-NVGBE2DR.js";import{A as x}from"./chunk-TH47OOBV.js";import{w as oe}from"./chunk-CCUGKBIH.js";var v="https://integrations.lambdatest.com",b=class extends Error{constructor(e,r){super(r);this.code=e;this.name="LisError"}};function Re(t){let n=t.TESTMUAI_ENV==="stage"?"stage":"prod";return`${oe[n].shareApiBaseUrl}/lis/api/v1`}function $e(t){let n=t.env??process.env,e=t.auth?.TESTMUAI_BASIC_AUTH||n.TESTMUAI_BASIC_AUTH;if(e)return{authorization:`Basic ${e}`};let r=t.auth?.TESTMUAI_API_KEY||n.TESTMUAI_API_KEY;return r?{authorization:`Bearer ${r}`}:{}}function $(t){let n=t.split(`
3
- `,1)[0].replace(/[\u0000-\u001f\u007f-\u009f]/g,"");return n.length>200?`${n.slice(0,200)}\u2026`:n}function Te(t,n,e="the issue"){return t===401||t===403?new b("LIS_AUTH","credentials rejected \u2014 run `kane-cli login` and retry"):t>=500?new b("LIS_UNAVAILABLE",`the integrations service returned an error (HTTP ${t}) \u2014 retry later`):new b("JIRA_ISSUE_UNAVAILABLE",`could not fetch ${e}: ${$(n)||`HTTP ${t}`}`)}function j(t){try{return JSON.parse(t.bytes.toString("utf8"))}catch{throw new b("LIS_UNAVAILABLE","the integrations service returned a malformed response \u2014 retry later")}}function ee(t){try{return JSON.parse(t.bytes.toString("utf8"))}catch{return{}}}function ue(t){return ee(t).code}function C(t,n="the issue"){let e=ee(t);switch(e.code){case"TOKEN_EXPIRED":return new b("LIS_SETUP",`your Atlassian connection needs a resync \u2014 reconnect at ${v} and retry`);case"NOT_INSTALLED":return new b("LIS_SETUP",`no Atlassian connection for this account \u2014 create one at ${v} and retry`);case"SCOPE_MISSING":return new b("LIS_SETUP",`the connection has no Confluence access \u2014 reconnect with Confluence at ${v} and retry`);case"FORBIDDEN":return new b("LIS_FORBIDDEN",`you don't have access to ${n}`);case"NOT_FOUND":return new b("JIRA_ISSUE_UNAVAILABLE",`could not fetch ${n}: ${$(e.message??"")||"not found"}`);case"PAYLOAD_TOO_LARGE":return new b("ATTACHMENT_TOO_LARGE","the attachment exceeds the integrations service's size cap");case"INVALID_PAYLOAD":return new b("LIS_UNAVAILABLE",`the integrations service rejected the request (${$(e.message??"")||"invalid payload"}) \u2014 retry later`);case"NOT_SUPPORTED":return new b("LIS_UNAVAILABLE","the integrations service does not support this operation yet");case"UPSTREAM_ERROR":case"UPSTREAM_TIMEOUT":return new b("LIS_UNAVAILABLE","Atlassian is not responding through the integrations service \u2014 retry later");default:return Te(t.status,e.message??"",n)}}var Ce=3e4,Oe=5;async function O(t,n,e){let r=e.env??process.env,l=e.fetchImpl??fetch;for(let o=0;;o++){let d=new AbortController,f=setTimeout(()=>d.abort(),Ce);try{let i=await l(`${Re(r)}${t}`,{...n,headers:{"content-type":"application/json",...$e(e),...n.headers??{}},signal:d.signal}),c=await Promise.race([i.arrayBuffer(),new Promise((a,s)=>{d.signal.addEventListener("abort",()=>s(new DOMException("aborted","AbortError")),{once:!0})})]),u={status:i.status,ok:i.ok,headers:i.headers,bytes:Buffer.from(c)};if(u.status===429){if(o>0)throw new b("LIS_RATE_LIMITED","the integrations service is busy \u2014 try again in a moment");let a=ee(u).data?.retry_after_sec,s=Math.min(Math.max(typeof a=="number"&&Number.isFinite(a)?a:1,0),Oe);clearTimeout(f),await new Promise(y=>setTimeout(y,s*1e3));continue}return u}catch(i){throw i instanceof b?i:d.signal.aborted?new b("LIS_UNAVAILABLE","the integrations service did not respond within 30 seconds \u2014 retry later"):new b("LIS_UNAVAILABLE",`could not reach the integrations service (${$(i instanceof Error?i.message:String(i))}) \u2014 check your connection and retry`)}finally{clearTimeout(f)}}}function K(t){let n=t.headers.get("content-type")??"application/octet-stream";if(n.includes("json"))try{let e=JSON.parse(t.bytes.toString("utf8")),r=e.content??e.data?.content;if(typeof r=="string")return{bytes:Buffer.from(r,"base64"),mediaType:e.mime_type??e.data?.mime_type??"application/octet-stream"}}catch{}return{bytes:t.bytes,mediaType:n}}async function V(t={}){let n=await O("/jira/info",{method:"GET"},t);if(!n.ok)throw C(n);let e=j(n),r=(e.data?.SELECTED_PROJECTS??[]).map(l=>l?.key).filter(l=>typeof l=="string"&&l.length>0);return{installed:e.data?.INSTALLED==="YES",selectAll:e.data?.SELECT_ALL===!0,selectedProjects:r,capabilities:{document:e.data?.capabilities?.document===!0,comments:e.data?.capabilities?.comments===!0}}}async function W(t,n={}){let e=await O("/jira/issue?details=true",{method:"POST",body:JSON.stringify({plugin_code:"jira",issueKey:t})},n);if(!e.ok)throw C(e);let r=j(e);if(r.type==="error"||!r.data)throw new b("JIRA_ISSUE_UNAVAILABLE",`could not fetch the issue: ${$(r.message??"")||"issue not found or not accessible"}`);return r.data}var le=100,Ne=5e3,ke=60;async function G(t,n={}){let e=[],r=new Set,l=null,o=0;for(let d=0;;d++){if(d>=ke)throw new b("LIS_UNAVAILABLE","the integrations service kept returning comment pages without finishing \u2014 retry later");let f=await O("/jira/issue/comments",{method:"POST",body:JSON.stringify({resource_id:t,max_results:le,cursor:l,start_at:o,order_by:"created",fetch_all:!1})},n);if(!f.ok)throw C(f,"the issue's comments");let i=j(f);if(i.type==="error"||!i.data)throw new b("JIRA_ISSUE_UNAVAILABLE",`could not fetch the issue's comments: ${$(i.message??"")||"unavailable"}`);for(let L of i.data.comments??[]){let m=String(L.id);r.has(m)||(r.add(m),e.push(L))}let c=i.data.pagination;if(!c?.has_more)return e;if(e.length>=Ne)throw new b("JIRA_ISSUE_UNAVAILABLE","the issue has more comments than can be ingested \u2014 cannot build a complete identity");let u=c.next_cursor??null,a=c.next_start_at!=null,s=a?c.next_start_at:o+le;if(!(u!=null&&u!==l||u==null&&a&&s!==o))throw new b("LIS_UNAVAILABLE","the integrations service returned a non-advancing comments page \u2014 retry later");l=u,o=s}}async function Y(t,n={}){let e=await O("/jira/attachment",{method:"POST",body:JSON.stringify({attachment_id:t})},n);if(!e.ok){if(ue(e)===void 0){if(e.status===413)throw new b("ATTACHMENT_TOO_LARGE","the attachment exceeds the integrations service's size cap");if(e.status===404)throw new b("JIRA_NOT_CONNECTED",`Jira is not connected for this account \u2014 connect it at ${v} and retry`)}throw C(e,`attachment ${t}`)}return K(e)}var H="kane.source.jira/2";function pe(t){if(typeof t=="string")return t;if(typeof t=="number"||typeof t=="boolean")return String(t);if(Array.isArray(t)){let n=t.map(pe).filter(e=>e!==null);return n.length===0?null:n.join(", ")}if(t!==null&&typeof t=="object"){let n=t;for(let e of["name","value","displayName"])if(typeof n[e]=="string")return n[e];return null}return null}function de(t,n,e){let r=[],l={},o=t.additional_fields??{};for(let u of Object.keys(o).sort()){let a=pe(o[u]);if(a===null){r.push(`field "${u}" has no stable text form \u2014 dropped from the envelope`);continue}l[u]=a}let d=[...t.attachments??[]].map(u=>({id:String(u.id),filename:u.filename??"",media_type:u.mime_type??"application/octet-stream",size:u.size??0})).sort((u,a)=>{let s=Number(u.id),y=Number(a.id);return Number.isFinite(s)&&Number.isFinite(y)?s-y:u.id<a.id?-1:u.id>a.id?1:0}),f=e.map(u=>({id:String(u.id),author:u.author?.display_name??"",body:u.body??"",created:u.created??""})).sort((u,a)=>{if(u.created!==a.created)return u.created<a.created?-1:1;let s=Number(u.id),y=Number(a.id);return Number.isFinite(s)&&Number.isFinite(y)&&s!==y?s-y:u.id<a.id?-1:u.id>a.id?1:0}),i=t.key;if(!/^[A-Za-z][A-Za-z0-9_]*-\d+$/.test(i))throw new Error(`cannot build a stable identity for issue key "${i}" \u2014 expected a PROJECT-NUMBER key`);let c={schema:H,site:n,project:i.slice(0,i.lastIndexOf("-")),issue:{id:t.id,key:i},content:{summary:t.summary??"",description:t.description??"",fields:l},attachments:d,comments:f};return{bytes:Buffer.from(JSON.stringify(c),"utf8"),envelope:c,warnings:r}}var me=64,Pe=16,je=6e6,Ue=5e7,xe=12e6,Be={png:"image/png",jpeg:"image/jpeg",webp:"image/webp",gif:"image/gif",bmp:"image/bmp",tiff:"image/tiff",emf:"image/emf",wmf:"image/wmf",unknown:"application/octet-stream"},Me=new Set(["png","jpeg","webp"]);function fe(t){return async n=>{let e;try{e=JSON.parse(n.toString("utf8"))}catch{throw new Error("JIRA_ENVELOPE_SCHEMA: source bytes are not a kane jira envelope")}if(e.schema!==H)throw new Error(`JIRA_ENVELOPE_SCHEMA: unknown envelope schema "${e.schema}" \u2014 this CLI understands ${H}`);let r=[],l=new Map,o=[],d=0,f=new Map,i=[];for(let a=0;a<e.attachments.length;a++){let s=e.attachments[a],y=`i${a+1}`,L=`attachment:${s.filename}`,m=I=>`[img#${y}] ${s.filename} (${s.media_type}, ${s.size} bytes${I?"":" \u2014 not delivered"})`,g=(I,A,T)=>{r.push({ref:y,loc:L,media_type:I,...T?.blob?{blob:T.blob}:{},...T?.appearance?{appearance:T.appearance}:{},delivery:A,...T?.duplicate_of?{duplicate_of:T.duplicate_of}:{}})};if(!s.media_type.startsWith("image/")){g(s.media_type,"unsupported-vision-media-type"),i.push(m(!1));continue}let S;try{S=await t.fetchAttachment(s.id)}catch{g(s.media_type,"external-image-not-fetched"),i.push(m(!1));continue}let h=S.bytes,p=D(h),_=Be[p.format],E=B(h);if(l.set(E,h),!Me.has(p.format)){let I=p.format==="gif"||p.format==="bmp"||p.format==="tiff"?"unsupported-vision-media-type":"unsupported-image-kind";g(_,I,{blob:E}),i.push(m(!1));continue}if(p.width===void 0||p.height===void 0||p.width*p.height>Ue){g(_,"undecodable",{blob:E}),i.push(m(!1));continue}let w;if(p.format==="png"||p.format==="jpeg"){let I=F(h,p.format);if(I===null){g(_,"undecodable",{blob:E}),i.push(m(!1));continue}w=J(I.data,{width:I.width,height:I.height,channels:I.channels})}if(p.width<me||p.height<me){g(_,"below-dimension-floor",{blob:E,appearance:w}),i.push(m(!1));continue}let R=f.get(E);if(R!==void 0){g(_,"duplicate",{blob:E,appearance:w,duplicate_of:R}),i.push(m(!1));continue}if(h.byteLength>je){g(_,"image-too-large",{blob:E,appearance:w}),i.push(m(!1));continue}if(d+h.byteLength>xe){g(_,"vision-byte-budget-reached",{blob:E,appearance:w}),i.push(m(!1));continue}if(o.length>=Pe){g(_,"image-cap-reached",{blob:E,appearance:w}),i.push(m(!1));continue}f.set(E,y),d+=h.byteLength,o.push(y),g(_,"selected",{blob:E,appearance:w}),i.push(m(!0))}let c=[];c.push(`${e.issue.key} \xB7 ${e.site}/${e.project}`,`Summary: ${e.content.summary}`),e.content.description!==""&&c.push("",...e.content.description.split(`
4
- `));let u=Object.keys(e.content.fields);return u.length>0&&c.push("","--- fields ---",...u.map(a=>`${a}: ${e.content.fields[a]}`)),i.length>0&&c.push("","--- attachments ---",...i),e.comments.length>0&&(c.push("","--- comments ---"),e.comments.forEach((a,s)=>{s>0&&c.push(""),c.push(`[${s+1}] ${a.author} \xB7 ${a.created}`,...a.body.split(`
5
- `))})),{projection:c.join(`
6
- `)+`
7
- `,inventory:r,blobs:l,delivered:o,converter:{name:"jira-convert",version:"2",policy:"v1"}}}}var Je=/^[A-Za-z][A-Za-z0-9_]*-\d+$/;function z(t){if(!/^https?:\/\/.+/i.test(t))return null;let n;try{n=new URL(t)}catch{return null}let e=n.pathname.split("/").filter(Boolean),r=e.lastIndexOf("browse");if(r===-1||r+1>=e.length)return null;let l=e[r+1];return Je.test(l)?{site:n.hostname,issueKey:l.toUpperCase()}:null}function X(t,n){let e=x(t),r=e.heads.get(n);if(r==null)return null;let l=e.getNode(r)?.content?.blob;if(typeof l!="string")return null;let o=M(t,l);if(o===null)return null;try{let d=JSON.parse(o.toString("utf8"));return typeof d.site=="string"&&d.site.length>0?d.site:null}catch{return null}}async function De(t,n,e,r,l){let o=z(t);if(o===null)return(e.err??e.out)(`error: ${t}: unsupported remote URL \u2014 expected a Jira issue URL (https://<site>/browse/KEY-123)`),{code:1};let d=l?.lis??{jiraInfo:V,jiraIssue:W,jiraAttachment:Y,jiraComments:G};try{let i={auth:await(l?.authEnv??(await import("./auth-3DLNMZC2.js")).resolveLisAuthEnv)(),env:process.env},c=await d.jiraInfo(i);if(!c.installed)return(e.err??e.out)(`error: ${t}: no Atlassian connection for this account \u2014 create one at ${v} and retry`),{code:1};if(c.capabilities.comments===!1)return(e.err??e.out)(`error: ${t}: the connection cannot read issue comments yet \u2014 resync it at ${v} and retry`),{code:1};let u=o.issueKey.slice(0,o.issueKey.lastIndexOf("-"));if(!c.selectAll&&c.selectedProjects.length>0&&!c.selectedProjects.includes(u))return(e.err??e.out)(`error: ${t}: project ${u} is not in the integration's selected projects (${c.selectedProjects.join(", ")}) \u2014 add it at ${v}`),{code:1};let a=await d.jiraIssue(o.issueKey,i),s=await d.jiraComments(o.issueKey,i),y=o.site;if(a.host)try{y=new URL(a.host).hostname}catch{y=a.host.replace(/^https?:\/\//,"").replace(/[/:].*$/,"")}let{bytes:L,warnings:m}=de(a,y,s),g=n??o.issueKey.toLowerCase();k(g);let S=X(r,g);if(S!==null&&S!==y)return(e.err??e.out)(`error: ${t}: source '${g}' was ingested from ${S}, but this read serves ${y} \u2014 retire it first (kane-cli context retire ${g}) or ingest under a different id with --as`),{code:1};let h=await P({contextDir:r,bytes:L,media:se,sourceId:g,label:t,confirmSameSource:e.isTTY?p=>e.confirm(`identical content already ingested as ${p} \u2014 treat as the same source?`):void 0,converters:{jira:fe({fetchAttachment:p=>d.jiraAttachment(p,i)})}});e.out(U(e.isTTY,h,o.issueKey));for(let p of m)e.out(`warning: ${p}`);for(let p of h.warnings??[])e.out(`warning: ${p}`);if(h.composite){let p=h.composite.delivered+h.composite.omitted;e.out(`${h.source_id}: jira, ${p} attachments, ${h.composite.delivered} images delivered (${h.composite.omitted} omitted)`)}return{code:0,result:{status:h.status,source_id:h.source_id,source_cid:h.cid}}}catch(f){return f instanceof b?((e.err??e.out)(`error: ${t}: ${f.message}`),{code:1}):((e.err??e.out)(`error: ${t}: ${Fe(f instanceof Error?f.message:String(f))}`),{code:1})}}function Fe(t){let n=t.match(/too large — ([\d.]+ [KM]B), the limit for .+ is ([\d.]+ [KM]B) \[FILE_TOO_LARGE\]/);return n?`the issue's content is too large to ingest (${n[1]}; the limit is ${n[2]}) \u2014 trim the description or attachments in Jira and retry`:t.startsWith("PROJECTION_TOO_LARGE:")?"the issue's text is too large to ingest \u2014 trim the description in Jira and retry":t}var ge={name:"jira",hint:"Jira issue URLs (https://<site>/browse/KEY-123)",match:t=>z(t)!==null,ingest:De,sourceIdFor:t=>{let n=z(t);return n?n.issueKey.toLowerCase():null}};async function he(t,n={}){let e=await O("/jira/document",{method:"POST",body:JSON.stringify({resource_id:t,format:"markdown"})},n);if(!e.ok)throw C(e,"the page");let r=j(e);if(r.type==="error"||!r.data)throw new b("JIRA_ISSUE_UNAVAILABLE",`could not fetch the page: ${$(r.message??"")||"page not found or not accessible"}`);return r.data}async function ye(t,n={}){let e=await O("/jira/attachment",{method:"POST",body:JSON.stringify({source:"confluence",download:t})},n);if(!e.ok)throw C(e,"the page's attachment");return{bytes:K(e).bytes}}var q="kane.source.confluence/1";function be(t,n){if(typeof t.id!="string"||t.id==="")throw new Error("cannot build a stable identity for this page \u2014 the integrations service returned no page id");let e=[...t.labels??[]].filter(o=>typeof o=="string").sort(),r=[...t.attachments??[]].map(o=>({id:String(o.id),filename:o.filename??"",media_type:o.mime_type??"application/octet-stream",size:o.size??0})).sort((o,d)=>o.id<d.id?-1:o.id>d.id?1:0),l={schema:q,site:n,page:{id:t.id},space:{key:t.space?.key??""},title:t.title??"",labels:e,content:{body:t.body??""},attachments:r};return{bytes:Buffer.from(JSON.stringify(l),"utf8"),envelope:l,warnings:[]}}var _e=64,Ke=16,Ve=6e6,We=5e7,Ge=12e6,Ye={png:"image/png",jpeg:"image/jpeg",webp:"image/webp",gif:"image/gif",bmp:"image/bmp",tiff:"image/tiff",emf:"image/emf",wmf:"image/wmf",unknown:"application/octet-stream"},He=new Set(["png","jpeg","webp"]);function Ee(t){let n=new Map(Object.entries(t.downloads));return async e=>{let r;try{r=JSON.parse(e.toString("utf8"))}catch{throw new Error("CONFLUENCE_ENVELOPE_SCHEMA: source bytes are not a kane confluence envelope")}if(r.schema!==q)throw new Error(`CONFLUENCE_ENVELOPE_SCHEMA: unknown envelope schema "${r.schema}" \u2014 this CLI understands ${q}`);let l=[],o=new Map,d=[],f=0,i=new Map,c=[];for(let a=0;a<r.attachments.length;a++){let s=r.attachments[a],y=`i${a+1}`,L=`attachment:${s.filename}`,m=A=>`[img#${y}] ${s.filename} (${s.media_type}, ${s.size} bytes${A?"":" \u2014 not delivered"})`,g=(A,T,N)=>{l.push({ref:y,loc:L,media_type:A,...N?.blob?{blob:N.blob}:{},...N?.appearance?{appearance:N.appearance}:{},delivery:T,...N?.duplicate_of?{duplicate_of:N.duplicate_of}:{}})};if(!s.media_type.startsWith("image/")){g(s.media_type,"unsupported-vision-media-type"),c.push(m(!1));continue}let S=n.get(s.id);if(!S){g(s.media_type,"external-image-not-fetched"),c.push(m(!1));continue}let h;try{h=await t.fetchAttachment({id:s.id,download:S})}catch{g(s.media_type,"external-image-not-fetched"),c.push(m(!1));continue}let p=h.bytes,_=D(p),E=Ye[_.format],w=B(p);if(o.set(w,p),!He.has(_.format)){let A=_.format==="gif"||_.format==="bmp"||_.format==="tiff"?"unsupported-vision-media-type":"unsupported-image-kind";g(E,A,{blob:w}),c.push(m(!1));continue}if(_.width===void 0||_.height===void 0||_.width*_.height>We){g(E,"undecodable",{blob:w}),c.push(m(!1));continue}let R;if(_.format==="png"||_.format==="jpeg"){let A=F(p,_.format);if(A===null){g(E,"undecodable",{blob:w}),c.push(m(!1));continue}R=J(A.data,{width:A.width,height:A.height,channels:A.channels})}if(_.width<_e||_.height<_e){g(E,"below-dimension-floor",{blob:w,appearance:R}),c.push(m(!1));continue}let I=i.get(w);if(I!==void 0){g(E,"duplicate",{blob:w,appearance:R,duplicate_of:I}),c.push(m(!1));continue}if(p.byteLength>Ve){g(E,"image-too-large",{blob:w,appearance:R}),c.push(m(!1));continue}if(f+p.byteLength>Ge){g(E,"vision-byte-budget-reached",{blob:w,appearance:R}),c.push(m(!1));continue}if(d.length>=Ke){g(E,"image-cap-reached",{blob:w,appearance:R}),c.push(m(!1));continue}i.set(w,y),f+=p.byteLength,d.push(y),g(E,"selected",{blob:w,appearance:R}),c.push(m(!0))}let u=[];return u.push(`${r.title} \xB7 ${r.site} \xB7 ${r.space.key}`),r.labels.length>0&&u.push(`labels: ${r.labels.join(", ")}`),r.content.body!==""&&u.push("",...r.content.body.split(`
8
- `)),c.length>0&&u.push("","--- attachments ---",...c),{projection:u.join(`
9
- `)+`
10
- `,inventory:l,blobs:o,delivered:d,converter:{name:"confluence-convert",version:"1",policy:"v1"}}}}var ze=/^[A-Za-z0-9~][A-Za-z0-9._~-]*$/;function Z(t){if(!/^https?:\/\/.+/i.test(t))return null;let n;try{n=new URL(t)}catch{return null}let e=n.pathname.split("/").filter(Boolean),r=e.indexOf("wiki");if(r===-1||e[r+1]!=="spaces"||e[r+3]!=="pages")return null;let l=e[r+2],o=e[r+4];return l===void 0||o===void 0||!ze.test(l)||!/^\d+$/.test(o)?null:{site:n.hostname,spaceKey:l,pageId:o}}async function Xe(t,n,e,r,l){let o=Z(t);if(o===null)return(e.err??e.out)(`error: ${t}: unsupported remote URL \u2014 expected a Confluence page URL (https://<site>/wiki/spaces/<KEY>/pages/<id>/\u2026)`),{code:1};let d=l?.lis??{jiraInfo:V,jiraIssue:W,jiraAttachment:Y,jiraComments:G},f=l?.confluence??{confluenceDocument:he,confluenceAttachment:ye};try{let c={auth:await(l?.authEnv??(await import("./auth-3DLNMZC2.js")).resolveLisAuthEnv)(),env:process.env},u=await d.jiraInfo(c);if(!u.installed)return(e.err??e.out)(`error: ${t}: no Atlassian connection for this account \u2014 create one at ${v} and retry`),{code:1};if(u.capabilities.document===!1)return(e.err??e.out)(`error: ${t}: the connection has no Confluence access \u2014 reconnect with Confluence at ${v} and retry`),{code:1};let a=await f.confluenceDocument(o.pageId,c),s=o.site;if(a.url)try{s=new URL(a.url).hostname}catch{}let{bytes:y,warnings:L}=be(a,s),m=n??`page-${o.pageId}`;k(m);let g=X(r,m);if(g!==null&&g!==s)return(e.err??e.out)(`error: ${t}: source '${m}' was ingested from ${g}, but this read serves ${s} \u2014 retire it first (kane-cli context retire ${m}) or ingest under a different id with --as`),{code:1};let S=Object.fromEntries((a.attachments??[]).filter(p=>typeof p.download=="string"&&p.download.length>0).map(p=>[String(p.id),p.download])),h=await P({contextDir:r,bytes:y,media:ie,sourceId:m,label:t,confirmSameSource:e.isTTY?p=>e.confirm(`identical content already ingested as ${p} \u2014 treat as the same source?`):void 0,converters:{confluence:Ee({downloads:S,fetchAttachment:p=>f.confluenceAttachment(p.download,c)})}});e.out(U(e.isTTY,h,`${o.spaceKey}/${o.pageId}`));for(let p of L)e.out(`warning: ${p}`);for(let p of h.warnings??[])e.out(`warning: ${p}`);if(h.composite){let p=h.composite.delivered+h.composite.omitted;e.out(`${h.source_id}: confluence, ${p} attachments, ${h.composite.delivered} images delivered (${h.composite.omitted} omitted)`)}return{code:0,result:{status:h.status,source_id:h.source_id,source_cid:h.cid}}}catch(i){return i instanceof b?((e.err??e.out)(`error: ${t}: ${i.message}`),{code:1}):((e.err??e.out)(`error: ${t}: ${qe(i instanceof Error?i.message:String(i))}`),{code:1})}}function qe(t){let n=t.match(/too large — ([\d.]+ [KM]B), the limit for .+ is ([\d.]+ [KM]B) \[FILE_TOO_LARGE\]/);return n?`the page's content is too large to ingest (${n[1]}; the limit is ${n[2]}) \u2014 trim the page in Confluence and retry`:t.startsWith("PROJECTION_TOO_LARGE:")?"the page's text is too large to ingest \u2014 trim the page in Confluence and retry":t}var we={name:"confluence",hint:"Confluence page URLs (https://<site>/wiki/spaces/<KEY>/pages/<id>/\u2026)",match:t=>Z(t)!==null,ingest:Xe,sourceIdFor:t=>{let n=Z(t);return n?`page-${n.pageId}`:null}};var Ze=new Set(["invalid_url","target_disallowed","page_not_found","page_access_blocked","page_paywalled","unsupported_content_type","page_too_large","page_timeout","scrape_unavailable","scrape_rate_limited","internal_error","credit_denied"]);async function Ie(t,n){let e=n.env??process.env,r=n.fetchImpl??fetch,l=ce(e),o={"Content-Type":"application/json"},d=await n.authEnv(),f=d.TESTMUAI_BASIC_AUTH??e.TESTMUAI_BASIC_AUTH,i=d.TESTMUAI_API_KEY??e.TESTMUAI_API_KEY;f?o.Authorization=`Basic ${f}`:i&&(o.Authorization=`Bearer ${i}`);let c;try{c=await r(`${l}/assurance/web/scrape`,{method:"POST",headers:o,body:JSON.stringify({url:t}),signal:AbortSignal.timeout(n.timeoutMs??55e3)})}catch{return{ok:!1,kind:"transport_unreachable"}}if(c.status===401)return{ok:!1,kind:"auth_rejected"};let u;try{u=await c.json()}catch{return{ok:!1,kind:c.status===404?"route_missing":"malformed_response"}}if(c.ok){let s=u.page;return s===void 0||typeof s.markdown!="string"||s.markdown===""||typeof s.final_url!="string"||s.final_url===""||typeof s.projection?.kind!="string"||typeof s.projection?.version!="string"?{ok:!1,kind:"malformed_response"}:{ok:!0,page:s}}let a=u.code;return typeof a=="string"&&Ze.has(a)?{ok:!1,kind:a}:c.status===404?{ok:!1,kind:"route_missing"}:c.status===403?{ok:!1,kind:"auth_rejected"}:{ok:!1,kind:"malformed_response"}}var te="kane.source.web/1";function Ae(t,n,e){if(e==="")throw new Error("cannot build a web source from an empty page projection");if(n.kind===""||n.version==="")throw new Error("cannot build a stable identity without a server-reported projection kind/version");let r={schema:te,url:t,projection:{kind:n.kind,version:n.version},content:{markdown:e}};return{bytes:Buffer.from(JSON.stringify(r),"utf8"),envelope:r}}var Qe=new Set(["markdown"]);function Le(){return async t=>{let n;try{n=JSON.parse(t.toString("utf8"))}catch{throw new Error("this web source's stored envelope is not readable \u2014 re-ingest the page")}if(n.schema!==te)throw new Error(`unknown web envelope schema '${String(n.schema)}' \u2014 re-ingest the page with this CLI version`);if(!Qe.has(n.projection?.kind??""))throw new Error(`unknown web projection kind '${String(n.projection?.kind)}' \u2014 update kane-cli to read this source`);if(typeof n.content?.markdown!="string"||n.content.markdown==="")throw new Error("this web source's stored envelope carries no content \u2014 re-ingest the page");return{projection:n.content.markdown,inventory:[],blobs:new Map,delivered:[],converter:{name:"web-convert",version:"1",policy:"markdown-passthrough"}}}}import{createHash as et}from"crypto";function ve(t){return Q(t)!==null}function Q(t){if(!/^https?:\/\//i.test(t))return null;let n;try{n=new URL(t)}catch{return null}return n.hostname===""?null:(n.hash="",n.username="",n.password="",n.toString())}function ne(t){let n=Q(t);if(n===null)return null;let e=new URL(n),r=(e.hostname+e.pathname).toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,40).replace(/-+$/,""),l=et("sha256").update(n,"utf8").digest("hex").slice(0,8);return`${r||"page"}-${l}`}function tt(t,n){let e=x(t),r=e.heads.get(n);if(r==null)return null;let l=e.getNode(r)?.content?.blob;if(typeof l!="string")return null;let o=M(t,l);if(o===null)return null;try{let d=JSON.parse(o.toString("utf8"));return d.schema!=="kane.source.web/1"?null:typeof d.url=="string"&&d.url.length>0?d.url:null}catch{return null}}function re(t){switch(t){case"invalid_url":return"this is not a valid public HTTP or HTTPS page URL \u2014 check the address and try again";case"target_disallowed":return"that address cannot be fetched because it does not point to an allowed public web page";case"page_not_found":return"the page could not be found \u2014 check that the URL is correct and that the page still exists";case"page_access_blocked":return"the page refused automated access, so its contents could not be ingested \u2014 use a publicly accessible version of the page";case"page_paywalled":return"the page is behind a paywall or sign-in screen, so its full contents could not be ingested \u2014 use a publicly accessible copy";case"unsupported_content_type":return"the URL does not point to an HTML web page \u2014 download the document and ingest the supported file instead";case"page_too_large":return"the page contains too much text to ingest as a single source \u2014 use a narrower page or trim the content first";case"page_timeout":return"the page took too long to load \u2014 try again later";case"scrape_unavailable":case"scrape_rate_limited":case"internal_error":return"the page ingest service is temporarily unavailable \u2014 try again later";case"credit_denied":return"the page could not be ingested \u2014 your organization is out of credits";case"auth_rejected":return"your credentials were rejected \u2014 run `kane-cli login` and retry";case"route_missing":return"ingesting web pages is not available in your environment yet \u2014 nothing is wrong with the URL; try again later";case"transport_unreachable":return"the page ingest service could not be reached \u2014 check your connection and try again";case"malformed_response":return"the page ingest service returned a response that could not be read safely \u2014 try again later"}}function nt(t){let n=t.match(/too large — ([\d.]+ [KM]B), the limit for .+ is ([\d.]+ [KM]B) \[FILE_TOO_LARGE\]/);return n?`the page contains too much text to ingest as a single source (${n[1]}; the limit is ${n[2]}) \u2014 use a narrower page or trim the content first`:t.startsWith("PROJECTION_TOO_LARGE:")?"the page contains too much text to ingest as a single source \u2014 use a narrower page or trim the content first":t}async function rt(t,n,e,r,l){let o=Q(t);if(o===null)return(e.err??e.out)(`error: ${t}: ${re("invalid_url")}`),{code:1};let d=ne(t),f=n??d;if(f===null)return(e.err??e.out)(`error: ${t}: ${re("invalid_url")}`),{code:1};try{k(f)}catch(s){return(e.err??e.out)(`error: ${t}: ${s instanceof Error?s.message:String(s)}`),{code:1}}let i=tt(r,f);if(i!==null&&i!==o){if(!e.isTTY)return(e.err??e.out)(`error: ${t}: source '${f}' was ingested from ${i} \u2014 re-run on a TTY to adopt the new URL as its next version, or ingest under a different id with --as`),{code:1};if(!await e.confirm(`source '${f}' was ingested from ${i} \u2014 treat ${o} as its new version (replaces the current version; items built on it go stale)?`))return e.out(`skipped ${t} \u2014 ingest under a different id with --as to keep both pages`),{code:1}}let c=l?.web?.scrape??Ie,u=l?.authEnv??(async()=>(await import("./spawner-ANLF7OX3.js")).resolveAgentAuthEnv()),a=await c(o,{authEnv:u});if(!a.ok)return(e.err??e.out)(`error: ${t}: ${re(a.kind)}`),{code:1};try{let{bytes:s}=Ae(o,a.page.projection,a.page.markdown),y=await P({contextDir:r,bytes:s,media:ae,sourceId:f,label:o,confirmSameSource:e.isTTY?m=>e.confirm(`identical content already ingested as ${m} \u2014 treat as the same source?`):void 0,converters:{web:Le()}}),L=new URL(o).hostname+new URL(o).pathname;e.out(U(e.isTTY,y,L));for(let m of y.warnings??[])e.out(`warning: ${m}`);return e.isTTY&&a.page.title&&e.out(` title: ${a.page.title}`),{code:0,result:{status:y.status,source_id:y.source_id,source_cid:y.cid}}}catch(s){return(e.err??e.out)(`error: ${t}: ${nt(s instanceof Error?s.message:String(s))}`),{code:1}}}var Se={name:"web",hint:"any public web page URL (https://\u2026)",match:ve,ingest:rt,sourceIdFor:ne};function U(t,n,e){return t?n.status==="created"?`landed ${n.source_id} (${e}) \u2014 new source`:n.status==="versioned"?`landed ${n.source_id} (${e}) \u2014 new version; dependents go stale`:`${n.source_id} unchanged \u2014 already landed`:`${n.status} ${n.source_id} source ${n.cid} blob ${n.blob}`}var ot=[ge,we,Se];function _n(t){return/^https?:\/\/.+/i.test(t)}function En(t){return ot.find(n=>n.match(t))??null}export{U as a,ot as b,_n as c,En as d};
@@ -1,4 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{b as U}from"./chunk-DNNZ353O.js";import{a as G}from"./chunk-Q2F5QB2W.js";import{b as 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,2 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a,b,c,d}from"./chunk-35EUIBYJ.js";import"./chunk-BG66IAO6.js";import"./chunk-MMBBQ4OZ.js";import"./chunk-Z2T7E5HM.js";import"./chunk-MSGW4JDG.js";import"./chunk-TZXXJWHA.js";import"./chunk-4JOD47QI.js";import"./chunk-RZ4F3BHX.js";import"./chunk-CCUGKBIH.js";import"./chunk-UR6MHSHU.js";export{d as doctorExitCode,c as doctorPreflightBlocked,b as renderDoctorText,a as runDoctor};
@@ -1,2 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{b as a}from"./chunk-JN2DP4R2.js";import"./chunk-Q6JHBDW2.js";import"./chunk-CCUGKBIH.js";import"./chunk-UR6MHSHU.js";export{a as installPlugin};
@@ -1,2 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a}from"./chunk-FDWEL5HR.js";import"./chunk-RFHMDQXZ.js";import"./chunk-PB3GADUD.js";import"./chunk-WLOGO44E.js";import"./chunk-RZ4F3BHX.js";import"./chunk-4UMQDH52.js";import"./chunk-CCUGKBIH.js";import"./chunk-UR6MHSHU.js";export{a as LoginFlow};
@@ -1,2 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a,b,c}from"./chunk-BVKDHHPK.js";import"./chunk-2YQ6TW77.js";import"./chunk-3AJ3QSF5.js";import"./chunk-5DBK6QNS.js";import"./chunk-TJZMYU2W.js";import"./chunk-5GUD3CIH.js";import"./chunk-XWKUZJCP.js";import"./chunk-ZSXDZI56.js";import"./chunk-EHN5HTUD.js";import"./chunk-NVGBE2DR.js";import"./chunk-CH273NAE.js";import"./chunk-VZ7KXRXB.js";import"./chunk-P7YZ3PU3.js";import"./chunk-TH47OOBV.js";import"./chunk-VAYBKR76.js";import"./chunk-CUM23TLF.js";import"./chunk-DUAXZYAD.js";import"./chunk-DBIBROYW.js";import"./chunk-WXHQYYD5.js";import"./chunk-IAHKTEET.js";import"./chunk-UD7KKHPW.js";import"./chunk-KX2GOJ4C.js";import"./chunk-BPMSNGXQ.js";import"./chunk-MMBBQ4OZ.js";import"./chunk-Z2T7E5HM.js";import"./chunk-MSGW4JDG.js";import"./chunk-4JOD47QI.js";import"./chunk-WLOGO44E.js";import"./chunk-DPUV6OSP.js";import"./chunk-NLCCBXXV.js";import"./chunk-RZ4F3BHX.js";import"./chunk-CCUGKBIH.js";import"./chunk-UR6MHSHU.js";export{c as UploadPipeline,b as packPresignEntry,a as readPackForUpload};
@@ -1,2 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{c as a,d as b,e as c,f as d,g as e,h as f}from"./chunk-2K2BX23I.js";import"./chunk-KX2GOJ4C.js";import"./chunk-35EUIBYJ.js";import"./chunk-BG66IAO6.js";import"./chunk-MMBBQ4OZ.js";import"./chunk-Z2T7E5HM.js";import"./chunk-MSGW4JDG.js";import"./chunk-TZXXJWHA.js";import"./chunk-56PAQAX5.js";import"./chunk-5EOX4MEY.js";import"./chunk-4D3DNCQY.js";import"./chunk-TAOHYWEO.js";import"./chunk-UOMRMCMI.js";import"./chunk-4JOD47QI.js";import"./chunk-RZ4F3BHX.js";import"./chunk-CCUGKBIH.js";import"./chunk-UR6MHSHU.js";export{a as MobileHostUnsupportedError,b as MobilePreflightError,c as PACKAGE_ID_REJECTED,e as isInstallablePath,f as prepareTarget,d as toAppSpec};
@@ -1,2 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a,b,c,d,e,f,g,h}from"./chunk-WYST42WI.js";import"./chunk-2K2BX23I.js";import"./chunk-KX2GOJ4C.js";import"./chunk-35EUIBYJ.js";import"./chunk-BG66IAO6.js";import"./chunk-MMBBQ4OZ.js";import"./chunk-Z2T7E5HM.js";import"./chunk-MSGW4JDG.js";import"./chunk-TZXXJWHA.js";import"./chunk-56PAQAX5.js";import"./chunk-5EOX4MEY.js";import"./chunk-4D3DNCQY.js";import"./chunk-TAOHYWEO.js";import"./chunk-UOMRMCMI.js";import"./chunk-4JOD47QI.js";import"./chunk-RZ4F3BHX.js";import"./chunk-EYOCNMUM.js";import"./chunk-CCUGKBIH.js";import"./chunk-UR6MHSHU.js";export{h as CHOOSE_MOBILE_KIND_MESSAGE,a as appSuitsTarget,d as formatRunningOn,e as missingPieceMessage,b as resolveRunIntent,c as resolveTestmdIntent,g as staleAppMessage,f as staleDeviceMessage};
@@ -1,2 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{f as a}from"./chunk-KBMQGNKO.js";import"./chunk-3MSXQU2C.js";import"./chunk-G4AFOZKU.js";import"./chunk-6BTZ2Q4P.js";import"./chunk-T5LKD2OB.js";import"./chunk-T3XDMR5B.js";import"./chunk-7PADFQ5S.js";import"./chunk-KWKUMBHS.js";import"./chunk-GYF4CH62.js";import"./chunk-MUGMUKSZ.js";import"./chunk-RY6TFVAX.js";import"./chunk-TYI4MLFJ.js";import"./chunk-DEZ7CXGM.js";import"./chunk-PUFJEU46.js";import"./chunk-BAL7E4OH.js";import"./chunk-EKCGZXZE.js";import"./chunk-S3DAAAE5.js";import"./chunk-WYST42WI.js";import"./chunk-BVKDHHPK.js";import"./chunk-2YQ6TW77.js";import"./chunk-5DT7PIGB.js";import"./chunk-K2QV7FGP.js";import"./chunk-3AJ3QSF5.js";import"./chunk-5DBK6QNS.js";import"./chunk-TJZMYU2W.js";import"./chunk-5GUD3CIH.js";import"./chunk-XWKUZJCP.js";import"./chunk-ZSXDZI56.js";import"./chunk-EHN5HTUD.js";import"./chunk-NVGBE2DR.js";import"./chunk-CH273NAE.js";import"./chunk-PWYEOBXV.js";import"./chunk-TCK3QMKY.js";import"./chunk-CGYSFLM2.js";import"./chunk-VZ7KXRXB.js";import"./chunk-JJWQUQJ2.js";import"./chunk-OWTEHU6B.js";import"./chunk-AMULIFC5.js";import"./chunk-P7YZ3PU3.js";import"./chunk-TDPWFYTJ.js";import"./chunk-6DTWVLSJ.js";import"./chunk-NLECZCMZ.js";import"./chunk-5NSYHRDN.js";import"./chunk-5Y2G4NC7.js";import"./chunk-R5T4RLF5.js";import"./chunk-2YEHV2CX.js";import"./chunk-JRQKUQWL.js";import"./chunk-TH47OOBV.js";import"./chunk-VAYBKR76.js";import"./chunk-CUM23TLF.js";import"./chunk-DUAXZYAD.js";import"./chunk-DBIBROYW.js";import"./chunk-WXHQYYD5.js";import"./chunk-IAHKTEET.js";import"./chunk-UD7KKHPW.js";import"./chunk-2K2BX23I.js";import"./chunk-KX2GOJ4C.js";import"./chunk-K7UYWAZH.js";import"./chunk-E3BXNQYE.js";import"./chunk-YCCUBQY4.js";import"./chunk-LA2EMSHE.js";import"./chunk-FTZPWXF7.js";import"./chunk-BPMSNGXQ.js";import"./chunk-VE3SUJMA.js";import"./chunk-FDWEL5HR.js";import"./chunk-RFHMDQXZ.js";import"./chunk-35EUIBYJ.js";import"./chunk-BG66IAO6.js";import"./chunk-MMBBQ4OZ.js";import"./chunk-Z2T7E5HM.js";import"./chunk-MSGW4JDG.js";import"./chunk-TZXXJWHA.js";import"./chunk-56PAQAX5.js";import"./chunk-5EOX4MEY.js";import"./chunk-4D3DNCQY.js";import"./chunk-TAOHYWEO.js";import"./chunk-NYSMQ7UY.js";import"./chunk-MJ56GUKS.js";import"./chunk-ZIRMSWKS.js";import"./chunk-UOMRMCMI.js";import"./chunk-4JOD47QI.js";import"./chunk-ZFZ7YXEU.js";import"./chunk-PB3GADUD.js";import"./chunk-WLOGO44E.js";import"./chunk-DPUV6OSP.js";import"./chunk-NLCCBXXV.js";import"./chunk-RZ4F3BHX.js";import"./chunk-E47GFYXA.js";import"./chunk-EYOCNMUM.js";import"./chunk-4UMQDH52.js";import"./chunk-NHOHQBIF.js";import"./chunk-PQUMOFT5.js";import"./chunk-CCUGKBIH.js";import{a as o}from"./chunk-DFS4RMVP.js";import{a as t}from"./chunk-HCBYKLMW.js";import{c as n}from"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import{e as r}from"./chunk-UR6MHSHU.js";var e=r(t(),1);async function p(i){let c=i.scenarioLimit!==void 0||i.perScenarioLimit!==void 0?{scenarioLimit:i.scenarioLimit,perScenarioLimit:i.perScenarioLimit}:void 0,{waitUntilExit:m}=n((0,e.jsx)(o,{children:(0,e.jsx)(a,{initialChatMode:"generate",initialObjective:i.objective,initialGenerateLimits:c})}),{exitOnCtrlC:!1});await m()}export{p as runGenerate};
@@ -1,2 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a}from"./chunk-ZFZ7YXEU.js";import"./chunk-PB3GADUD.js";import"./chunk-WLOGO44E.js";import"./chunk-RZ4F3BHX.js";import"./chunk-CCUGKBIH.js";import"./chunk-UR6MHSHU.js";export{a as refreshOAuthToken};