@testmuai/kane-cli 0.8.21 → 0.8.22
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.
- package/dist/{ChatSurface-U3Y3WUMS.js → ChatSurface-PA73V3NT.js} +1 -1
- package/dist/{ChromeProfilePicker-E6I6K2HO.js → ChromeProfilePicker-XX223SYB.js} +1 -1
- package/dist/{CliFeedbackPrompt-MPQVZM6J.js → CliFeedbackPrompt-J6DW6TZL.js} +1 -1
- package/dist/{CliUploadProgress-CADDDCS6.js → CliUploadProgress-TWEL7NWG.js} +1 -1
- package/dist/{ConfigView-IFXESQBB.js → ConfigView-ROFNVFDQ.js} +1 -1
- package/dist/{EvidenceViewOffer-GW7XLM45.js → EvidenceViewOffer-XUP44BGJ.js} +1 -1
- package/dist/FolderPicker-XLAK7324.js +2 -0
- package/dist/{InfoBox-CQWRYU6P.js → InfoBox-ELZ5Q65V.js} +1 -1
- package/dist/{LinksBox-ZFXUQZ2D.js → LinksBox-2V26KLTJ.js} +1 -1
- package/dist/{ProfilesView-OBN423WX.js → ProfilesView-P4Z42LSX.js} +1 -1
- package/dist/{ProjectPicker-FG3VJ22U.js → ProjectPicker-2QNFNN7T.js} +1 -1
- package/dist/{SaveSessionPrompt-SNFSJUGW.js → SaveSessionPrompt-XMWL3P6G.js} +1 -1
- package/dist/SingleShotApp-3YZSE3AA.js +2 -0
- package/dist/{SummaryBox-V7XVROAD.js → SummaryBox-RWO4BYYD.js} +1 -1
- package/dist/TestMdRunView-QHPMG46M.js +2 -0
- package/dist/{TestrunEvidenceTable-R3UQQI67.js → TestrunEvidenceTable-MUOGF6CZ.js} +1 -1
- package/dist/{WhoamiView-IGIALZNC.js → WhoamiView-4EYWZR4N.js} +1 -1
- package/dist/{app-download-VXEW7EI7.js → app-download-KUJVMZ7L.js} +1 -1
- package/dist/{auth-CSYBNMIH.js → auth-5HAY24TN.js} +1 -1
- package/dist/{binary-QLRLXZ6K.js → binary-6UEOI7PT.js} +1 -1
- package/dist/{bind-URA64IPV.js → bind-3C2IIPML.js} +2 -2
- package/dist/{bootstrap-PYBM5YT2.js → bootstrap-DBAQWVNA.js} +1 -1
- package/dist/bridge-NHXCRSIU.js +2 -0
- package/dist/{changelog-FMT3SSEI.js → changelog-QAGRYBEZ.js} +1 -1
- package/dist/{chunk-P7URFYFG.js → chunk-26HZJJN6.js} +2 -2
- package/dist/{chunk-47MLKCMG.js → chunk-2G5CJQOR.js} +1 -1
- package/dist/{chunk-IDQYOWKL.js → chunk-2HFNP2LM.js} +1 -1
- package/dist/{chunk-KMMOJDN4.js → chunk-2OIIXLXW.js} +1 -1
- package/dist/{chunk-NPFG4T7Q.js → chunk-3BUYTNAV.js} +2 -2
- package/dist/{chunk-QXIY5WRL.js → chunk-3H3KTCL7.js} +2 -2
- package/dist/{chunk-JH5RLIAH.js → chunk-3M6OM3T4.js} +1 -1
- package/dist/{chunk-PZJJIH4T.js → chunk-3MWLFHPO.js} +1 -1
- package/dist/{chunk-FHH7AFSC.js → chunk-3NMXXTHE.js} +1 -1
- package/dist/{chunk-5LLXVZXW.js → chunk-44NNFVCJ.js} +1 -1
- package/dist/{chunk-YY6RXHIL.js → chunk-46U7TRPE.js} +64 -64
- package/dist/{chunk-QG5OZHRH.js → chunk-4VW3B7SE.js} +1 -1
- package/dist/{chunk-LEWESZ24.js → chunk-4ZBI54KE.js} +2 -2
- package/dist/{chunk-IXJ33HYF.js → chunk-5BHB5D2C.js} +1 -1
- package/dist/{chunk-H2VMZL7J.js → chunk-5D6YMG63.js} +2 -2
- package/dist/{chunk-JVQI3EVW.js → chunk-5E4JLXR5.js} +1 -1
- package/dist/{chunk-FPGSEOG6.js → chunk-5FQYB5SM.js} +1 -1
- package/dist/{chunk-K7WJFQJU.js → chunk-5ILTSBWT.js} +1 -1
- package/dist/{chunk-JW7M3ENB.js → chunk-5TQIKRKP.js} +1 -1
- package/dist/{chunk-ETFRGYOT.js → chunk-5XAX4C5N.js} +1 -1
- package/dist/{chunk-6WOGVXQV.js → chunk-6C35NKQ7.js} +1 -1
- package/dist/{chunk-HX2HTIOQ.js → chunk-6MCQ2UKE.js} +1 -1
- package/dist/{chunk-LGJ7JMCR.js → chunk-ADBOWRMW.js} +1 -1
- package/dist/chunk-BNC4DJCC.js +7 -0
- package/dist/{chunk-45GRUU6A.js → chunk-BPDFI2DC.js} +2 -2
- package/dist/{chunk-VL3NGTTK.js → chunk-BPYRVV7O.js} +1 -1
- package/dist/chunk-CBUSNWHA.js +2 -0
- package/dist/{chunk-P6PNLVNS.js → chunk-CE23VDW5.js} +1 -1
- package/dist/{chunk-UXCXU6P4.js → chunk-DF4EBXGN.js} +1 -1
- package/dist/{chunk-4HPJ4S6H.js → chunk-DZCJE77P.js} +1 -1
- package/dist/{chunk-SYKBHHAJ.js → chunk-E2KV4BQB.js} +1 -1
- package/dist/{chunk-FLGQXY65.js → chunk-EVBCKI7D.js} +1 -1
- package/dist/chunk-FBRTUEAL.js +26 -0
- package/dist/{chunk-HJBTALBX.js → chunk-FDXDFZ7J.js} +1 -1
- package/dist/{chunk-7EVSM4V7.js → chunk-FR3LVUAB.js} +1 -1
- package/dist/{chunk-FGRDGMJP.js → chunk-GF32QBCM.js} +1 -1
- package/dist/{chunk-EZKC2LFH.js → chunk-GVE5GEW2.js} +1 -1
- package/dist/{chunk-YZZJUMKN.js → chunk-GYLMH2EX.js} +1 -1
- package/dist/{chunk-Z4DH3J7O.js → chunk-HKIBJDKE.js} +1 -1
- package/dist/{chunk-RSN4EHDN.js → chunk-I4SO2FQV.js} +1 -1
- package/dist/{chunk-X3ULX7LO.js → chunk-JHBNXTG6.js} +1 -1
- package/dist/{chunk-6ZHEIBI5.js → chunk-JHYWNWS5.js} +2 -2
- package/dist/{chunk-FY7WTTDQ.js → chunk-JPOFRYTX.js} +1 -1
- package/dist/{chunk-ZIYSW2F4.js → chunk-JQ3JB5CO.js} +1 -1
- package/dist/{chunk-LO6WSBLS.js → chunk-L35DJDX7.js} +1 -1
- package/dist/{chunk-5UY2JMFC.js → chunk-LKPOOZYN.js} +2 -2
- package/dist/{chunk-X5FZCQVO.js → chunk-LSRNUBIV.js} +1 -1
- package/dist/{chunk-DGQKGGCB.js → chunk-MHMEEA4S.js} +1 -1
- package/dist/{chunk-YJUWYQIO.js → chunk-MXI5P373.js} +1 -1
- package/dist/chunk-NAWGHDA3.js +15 -0
- package/dist/{chunk-2R55Y3X4.js → chunk-NMAPNJRY.js} +1 -1
- package/dist/chunk-NUYGWRB2.js +11 -0
- package/dist/{chunk-VLBUZOGF.js → chunk-O4LJWUSJ.js} +1 -1
- package/dist/{chunk-XWUK7FDE.js → chunk-OBB57E2L.js} +1 -1
- package/dist/{chunk-WTRUUT4E.js → chunk-OT3VKXJX.js} +1 -1
- package/dist/{chunk-ASJPV3O7.js → chunk-P37ALET7.js} +1 -1
- package/dist/{chunk-JD3OZ5H7.js → chunk-PLIQ72LH.js} +1 -1
- package/dist/{chunk-X3YTLBZR.js → chunk-PUFZTE6L.js} +1 -1
- package/dist/{chunk-SRJCAJYM.js → chunk-QV445GUU.js} +1 -1
- package/dist/{chunk-VNWRMLJ2.js → chunk-R43ELADV.js} +2 -2
- package/dist/{chunk-UUV5VP5T.js → chunk-R7ZDLGMU.js} +1 -1
- package/dist/{chunk-WSHADDNC.js → chunk-REPKBN7I.js} +1 -1
- package/dist/{chunk-FQVK46L7.js → chunk-RFDL7MHI.js} +1 -1
- package/dist/{chunk-P7PDRCQR.js → chunk-RUSRN7YE.js} +1 -1
- package/dist/{chunk-J4Z34AZN.js → chunk-SB5XM4YV.js} +1 -1
- package/dist/{chunk-TEYEMBS7.js → chunk-SIXPXYCH.js} +1 -1
- package/dist/{chunk-MI6UFDRC.js → chunk-SJZJ7ASF.js} +1 -1
- package/dist/{chunk-LXRZ5SM4.js → chunk-SREUA7YQ.js} +1 -1
- package/dist/{chunk-MFOEJ2RX.js → chunk-SVJBOVI4.js} +1 -1
- package/dist/{chunk-PQ63VSMO.js → chunk-SW54RAAT.js} +1 -1
- package/dist/{chunk-EXSFOB4X.js → chunk-T6MGCP57.js} +4 -4
- package/dist/{chunk-NLEFCLLY.js → chunk-UXR57BCE.js} +1 -1
- package/dist/{chunk-RN2PEWDD.js → chunk-VCY7UNEL.js} +1 -1
- package/dist/{chunk-C3366X5X.js → chunk-VW3PFRCO.js} +1 -1
- package/dist/{chunk-ZUWU7LJ6.js → chunk-WBH5GYFM.js} +1 -1
- package/dist/{chunk-KXGZLYUF.js → chunk-WGIZQGR5.js} +1 -1
- package/dist/{chunk-MZPLTQVK.js → chunk-WHNF5SWS.js} +2 -2
- package/dist/{chunk-GGOOD6KP.js → chunk-WPBETG6U.js} +3 -3
- package/dist/{chunk-N6J2YUDC.js → chunk-WRGPMDDE.js} +1 -1
- package/dist/{chunk-RH4QTLEG.js → chunk-XFQLR6MF.js} +1 -1
- package/dist/chunk-XKYL4K4A.js +2 -0
- package/dist/{chunk-4XYPIPYO.js → chunk-XQNJSM5C.js} +1 -1
- package/dist/{chunk-ICPCU7AL.js → chunk-YFBJWIBU.js} +1 -1
- package/dist/{chunk-CP2TVGKB.js → chunk-Z2XKFYMH.js} +1 -1
- package/dist/{chunk-N5ZEI42N.js → chunk-ZUJGYHZ2.js} +1 -1
- package/dist/{config-7ZZAHUGW.js → config-HVSKN6L4.js} +1 -1
- package/dist/{cover-cmd-ASKH4ZPV.js → cover-cmd-ZZJA5C6H.js} +1 -1
- package/dist/{credentials-DAYWXKP3.js → credentials-FH6VZPJS.js} +1 -1
- package/dist/{deps-bundle-KPOXT7E7.js → deps-bundle-QUROUKJI.js} +1 -1
- package/dist/{deps-resolve-LKA4VWF2.js → deps-resolve-N2KKJ37Q.js} +1 -1
- package/dist/{device-env-CAW6YN75.js → device-env-ID7EDDOD.js} +1 -1
- package/dist/{dispatch-DCQVGUGM.js → dispatch-BYA5Q2SD.js} +1 -1
- package/dist/{doctor-4FHKGRTC.js → doctor-MGHY2M36.js} +1 -1
- package/dist/{evidence-QCDPTFG3.js → evidence-XYKLWPPY.js} +1 -1
- package/dist/{evolve-cmd-YBQCNBL6.js → evolve-cmd-BURJDLVF.js} +1 -1
- package/dist/{explain-cmd-XFMMVUKV.js → explain-cmd-53EO2IMN.js} +1 -1
- package/dist/{extract-bind-AHNYCTPX.js → extract-bind-T7GKUEJ6.js} +2 -2
- package/dist/{extract-cmd-7ZBAPANP.js → extract-cmd-WXG34RMY.js} +1 -1
- package/dist/{gaps-cmd-PITBOXQK.js → gaps-cmd-T55FFFVB.js} +1 -1
- package/dist/{generate-headless-CDOH5LDS.js → generate-headless-BSBY47K2.js} +2 -2
- package/dist/index.js +109 -109
- package/dist/{ingest-cmd-T2LTILCD.js → ingest-cmd-BYOZCTVG.js} +1 -1
- package/dist/install-OABVIXAE.js +2 -0
- package/dist/{interactive-bind-SOLR3JCP.js → interactive-bind-JAB6XUPX.js} +3 -3
- package/dist/{lifecycle-cmd-MXYNJ55S.js → lifecycle-cmd-QVGYYJSG.js} +1 -1
- package/dist/{list-cmd-SDXYRMO3.js → list-cmd-RQYRC345.js} +1 -1
- package/dist/{list-commands-S4FMWRUU.js → list-commands-VTWPMFG3.js} +1 -1
- package/dist/login-flow-HUORIV6P.js +2 -0
- package/dist/{maintenance-cmd-EGWCWSBX.js → maintenance-cmd-NC2VI5G7.js} +1 -1
- package/dist/{mobile-prompts-5XLY7R4U.js → mobile-prompts-VCA73IYP.js} +1 -1
- package/dist/objective-variable-gate-WZFN5I7Y.js +2 -0
- package/dist/{open-provider-STFAULQU.js → open-provider-YXHFPVDE.js} +1 -1
- package/dist/persist-recorded-session-SZDBBSNH.js +3 -0
- package/dist/{pipeline-SBSLJEQT.js → pipeline-FAU3PBDH.js} +1 -1
- package/dist/prepare-target-XYOTVK2I.js +2 -0
- package/dist/{reconcile-cmd-YPSGEA5W.js → reconcile-cmd-2BFK7RFL.js} +1 -1
- package/dist/{reconcile-deps-N32E7NQU.js → reconcile-deps-CYWH6GM4.js} +2 -2
- package/dist/{reconcile-engine-CEWZQPFK.js → reconcile-engine-ZWIJFYBP.js} +1 -1
- package/dist/{recording-banner-NW5J3XKA.js → recording-banner-FRH2EJBM.js} +1 -1
- package/dist/registry-QR3BDI5F.js +2 -0
- package/dist/{require-project-folder-7DEBG4MC.js → require-project-folder-A6YTVLAK.js} +1 -1
- package/dist/{resolve-run-intent-A77ZCVXW.js → resolve-run-intent-PHAXPW6C.js} +1 -1
- package/dist/{resolver-NFGCIGX5.js → resolver-U55SNASN.js} +1 -1
- package/dist/{review-cmd-ZXTE7J6C.js → review-cmd-ZKCXBMFP.js} +1 -1
- package/dist/{run-2AVVCSQ2.js → run-76I4OYXD.js} +1 -1
- package/dist/run-XJK3YOW2.js +2 -0
- package/dist/{run-test-md-QBQ5PYV4.js → run-test-md-A3QRWLCW.js} +2 -2
- package/dist/{skill-installer-IK7AVGLZ.js → skill-installer-LSDCMJ6P.js} +1 -1
- package/dist/{spawner-YSJNIMNY.js → spawner-HZXP66DS.js} +1 -1
- package/dist/{store-guard-ZNNZGLQE.js → store-guard-27XJZ7WF.js} +1 -1
- package/dist/{sync-cmd-EJL5UMHU.js → sync-cmd-JZ3MXGEU.js} +1 -1
- package/dist/{sync-setup-6MUOKQ2U.js → sync-setup-HGG7ALGA.js} +1 -1
- package/dist/tcg-generate-S77VVSVU.js +2 -0
- package/dist/testmd-actions-VQJ22WZZ.js +2 -0
- package/dist/testmd-sync-RKSGTCZA.js +2 -0
- package/dist/token-refresh-AOCGYGEC.js +2 -0
- package/dist/{validate-basic-X46S6YL2.js → validate-basic-5NYH5WYI.js} +1 -1
- package/dist/variable-receipt-C3US6X4M.js +2 -0
- package/dist/{verdicts-K7NEM446.js → verdicts-VPTU4YAS.js} +1 -1
- package/dist/{version-check-LFAPVUOE.js → version-check-YY57B2A4.js} +1 -1
- package/dist/{view-cmd-BMIT3223.js → view-cmd-KWIBYZ5S.js} +1 -1
- package/dist/{walk-session-WFINXPLQ.js → walk-session-YSKEJM2F.js} +1 -1
- package/dist/{with-telemetry-CETNH2F6.js → with-telemetry-2NY4CPL5.js} +1 -1
- package/package.json +11 -11
- package/dist/FolderPicker-XILMCQE5.js +0 -2
- package/dist/SingleShotApp-BTBHN35J.js +0 -2
- package/dist/TestMdRunView-NQMTHTK6.js +0 -2
- package/dist/bridge-Z5PPK6CD.js +0 -2
- package/dist/chunk-DRVZE2XJ.js +0 -2
- package/dist/chunk-F3BN7Z3Z.js +0 -7
- package/dist/chunk-FRSS6LMZ.js +0 -26
- package/dist/chunk-OTTGA3LT.js +0 -11
- package/dist/chunk-TI5JQZ7J.js +0 -15
- package/dist/install-XDQH2EM3.js +0 -2
- package/dist/login-flow-XJARBECG.js +0 -2
- package/dist/objective-variable-gate-L25PM6IM.js +0 -2
- package/dist/persist-recorded-session-WJCW7M5R.js +0 -3
- package/dist/prepare-target-KJ2P2BC7.js +0 -2
- package/dist/registry-RV2NWZD6.js +0 -2
- package/dist/run-DGVXRJEG.js +0 -2
- package/dist/tcg-generate-UO4I35AT.js +0 -2
- package/dist/testmd-actions-R34VVDEL.js +0 -2
- package/dist/testmd-sync-L4ZFKGFZ.js +0 -2
- package/dist/token-refresh-LS3PRAT5.js +0 -2
- package/dist/variable-receipt-KAS4JVFJ.js +0 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{j as be,k as se,l as ae,m as xe,n as De,o as ce}from"./chunk-QXIY5WRL.js";import{a as re,c as ie,d as Pe,i as oe}from"./chunk-5UY2JMFC.js";import{d as Ee}from"./chunk-6J5T5FEY.js";import{a as S}from"./chunk-RRY5IXOB.js";import{a as ee,b as W,c as ne,d as G,e as $e,g as O,h as te}from"./chunk-W5TTF7GB.js";import{a as _e}from"./chunk-BZAGVBCX.js";import{b as J,c as Q,d as X}from"./chunk-EXSFOB4X.js";import{j as ke,l as Re}from"./chunk-7N6OCHPC.js";import{P as E,Q as ge,S as he,U as ve,V as we,W as ye,X as Z}from"./chunk-H2VMZL7J.js";import{z as I}from"./chunk-IICT4VOU.js";import{H as B,t as pe}from"./chunk-RDHWNSDP.js";import{existsSync as Oe,statSync as Te}from"fs";import{basename as q,resolve as U}from"path";function Ie(e){if(!e||e.stale_refs.length===0)return"\u2014";let n=e.direct_refs??[];return`${e.stale_refs.length} stale${n.length>0?` \xB7 ${n.length} direct`:""}`}function le(e,n){let t=[...e.rows.filter(s=>s.kind!=="REMOVE").map(s=>[s.kind,S(s.ref),s.reason,Ie(s.impact)]),...e.archive.map(s=>["ARCHIVE",S(s.ref),s.why,Ie(s.impact)])],r=Math.max(40,n??100),i=[`reconcile ${e.source_id} \u2014 head ${e.head.status} \xB7 ${t.length} decision${t.length===1?"":"s"}`];return t.length>0&&i.push(...Ee(["kind","ref","why","impact"],t,r,2)),e.changed&&i.push(e.held?`extract ran in override mode; ${e.defaultsTaken??0} default(s) auto-taken; matched-but-changed and new proposals HELD for your verdict (staged \u2014 nothing committed)`:`extract ran in override mode; ${e.defaultsTaken??0} default(s) auto-taken; matched-but-changed proposals auto-committed as edits`),i.push("each row becomes a card below \u2014 verdicts commit as they land"),e.planPath&&i.push(`plan: ${e.planPath}`),i}var Ue=new Set(["interactive","agent","ci","override"]);function Be(e,n){if(e.mode!==void 0&&!Ue.has(e.mode))return{error:`--mode must be interactive | agent | ci | override, got '${e.mode}'`,code:"MODE_USAGE"};let t=e.mode,r="reconcile without a TTY needs an explicit mode \u2014 pass --mode agent|ci|override, or --plan for a preview";return t==="interactive"&&!n?{error:r}:t||(n?"interactive":e.plan?"override":{error:r})}async function Se(e){let{makeHeadlessIO:n,agentRefusal:t}=await import("./headless-io-75HUMWZB.js");return t(n("ndjson","reconcile"),e,"MODE_USAGE")}function Ve(e,n,t,r){if(Q(t)){let m=X(t),a=m?.sourceIdFor(t)??null;if(m===null||a===null)return{error:`--from '${t}' is not a supported remote URL \u2014 supported: ${J.map(f=>f.hint).join("; ")}`};if(r!==void 0&&r!==a)return{error:`--source-id '${r}' does not match this URL's own identity '${a}' \u2014 re-run without --source-id. A source adopted with --as updates by re-running context ingest with the same --as; reconcile follows only the URL's own id`};let c=I(e);if(!c.heads.has(a))return{error:`unknown source '${a}' \u2014 see \`kane-cli context list --type source\`. If this URL was ingested under a custom id, update it by re-running context ingest with the same --as`};if(c.heads.get(a)==null)return{error:`source '${a}' is retired \u2014 restore it first with \`kane-cli context revert\`, then reconcile`};let _=z(e,a,{remoteUrl:t});return _!==null?{error:_}:{sourceId:a,remoteUrl:t}}if(r===void 0)return{error:"reconcile needs --from <file> AND --source-id <id> \u2014 see `kane-cli context list --type source` for ids"};let i=U(n,t);if(!Oe(i)||!Te(i).isFile())return{error:`--from '${t}' is not a file \u2014 pass the changed source document`};let s=ke(i);if(!s.ok)return{error:`--from '${t}' is not an ingestable document \u2014 allowed: ${s.allowlist.join(", ")}`};let o=I(e);if(!o.heads.has(r))return{error:`unknown source '${r}' \u2014 see \`kane-cli context list --type source\``};if(o.heads.get(r)==null)return{error:`source '${r}' is retired \u2014 restore it first with \`kane-cli context revert\`, then reconcile`};let w=z(e,r,{filePath:i});if(w!==null)return{error:w};let d=null;try{d=Re(i)}catch{}return d!==null&&d!==r&&o.heads.get(d)!=null?{error:`'${q(i)}' already backs live source '${d}' \u2014 did you mean --source-id ${d}? To truly move these bytes under '${r}', retire '${d}' first`}:{sourceId:r,filePath:i}}function C(e){return e==null?"(none)":e.slice(0,19)}function K(e,n,t,r=!1,i){if(e.out(`reconcile ${n.source_id}: head ${n.head.status} \u2014 ${C(n.head.before)} \u2192 ${C(n.head.after)}`),r||(e.out(`note: ${n.note}`),e.out(`skipped arms: ${n.skipped_arms}`)),n.changed&&(e.out(n.held?`extract ran in override mode; ${t?.defaultsTaken??0} default(s) auto-taken; matched-but-changed and new proposals HELD for your verdict (staged \u2014 nothing committed)`:`extract ran in override mode; ${t?.defaultsTaken??0} default(s) auto-taken; matched-but-changed proposals auto-committed as edits`),i?.({type:"defaults_taken",count:t?.defaultsTaken??0})),r){let s=n.changeset??[],o=(d,m)=>{let a=s.filter(c=>c.kind===d).length;return a>0?`${a} ${m}`:null},w=[o("ADD","add"),o("MODIFY","modify"),o("ARCHIVE","archive")].filter(Boolean);n.changed&&e.out(`changeset: ${s.length} item(s)${w.length?` \u2014 ${w.join(" \xB7 ")}`:""}`),e.out(`plan: ${n.rows.length} row(s) \u2014 each gets a card below`);return}if(n.changed){let s=n.changeset??[];e.out(`changeset: ${s.length} item(s)`);for(let o of s)if(o.kind==="MODIFY")e.out(` [MODIFY] ${S(o.ref)} \u2014 ${o.summary} (${C(o.old_cid)} \u2192 ${o.new_cid===null?"(staged)":C(o.new_cid)})`);else if(o.kind==="ADD")e.out(` [ADD] ${S(o.ref)}`);else{e.out(` [ARCHIVE] ${S(o.ref)} \u2014 ${o.why}`);let w=de(o.impact,"retiring drops");w&&e.out(` ${w}`)}}e.out(`plan: ${n.rows.length} row(s)`);for(let s of n.rows){e.out(` [${s.kind}] ${S(s.ref)} \u2014 ${s.reason}`);let o=de(s.impact,"approving marks");o&&e.out(` ${o}`),e.out(` provenance: ${s.provenance}`),e.out(` action: ${s.action}`)}}function Ae(e,n){return le({source_id:e.source_id,head:{status:e.head.status},rows:e.rows,archive:(e.changeset??[]).filter(t=>t.kind==="ARCHIVE"),changed:e.changed,held:!!e.held,defaultsTaken:n?.defaultsTaken},process.stdout.columns)}function de(e,n){if(!e||e.stale_refs.length===0)return null;let t=e.direct_refs??[];return`impact: ${n} ${e.stale_refs.length} item(s) stale`+(t.length>0?` \u2014 ${t.length} directly touched: ${t.join(", ")}`:"")}function D(e){return e==="interactive"?"override":e}async function H(e,n,t,r,i,s,o=[],w="override",d,m,a,c,_,f,P){let p;try{p=te(e)}catch(u){return E(r,u instanceof Error?u.message:String(u)),1}try{if(!t){let{runWalkSession:u}=await import("./walk-session-WFINXPLQ.js"),{telemetryEnvName:R}=await import("./bootstrap-PYBM5YT2.js");return await u({dir:e,rows:n,archive:o,held:d??null,childMode:w,runDesign:c??null,mark:s,markA:a,...m?{archiveState:m}:{},...f?{meta:{verb:"reconcile",sid:f,env:R()}}:{},...P?{resumeCmd:P}:{},signals:b=>A(e,b.ref,b.verdict,b.reason),..._?{script:_}:{}})}return await Ye(e,n,t,r,i,s,o,w,d,m)}finally{p()}}var F=(e,n)=>e?`kane-cli maintain reconcile --from ${e} --source-id ${n}`:void 0,Le=e=>e===null?void 0:"filePath"in e?e.filePath:e.remoteUrl,L=e=>`${e} high-risk item(s) need a human \u2014 ci mode won't guess. Walk interactively or use --mode agent.`;function T(e,n,t){let r=n.rows;e({type:"reconcile_plan",source_id:n.source_id,plan_path:t,rows:r.map(i=>({kind:i.kind,ref:i.ref,why:i.reason})),archive:n.changeset.filter(i=>i.kind==="ARCHIVE").map(i=>({ref:i.ref,why:i.why}))})}function ue(e={}){return{type:"reconcile_summary",applied:0,skipped:0,deferred:0,plan_only:0,failed:0,paused:0,stale_created:0,...e}}var j=ue();async function Y(e,n,t,r,i,s,o,w,d){T(i,n,t);let m=n.changeset.filter(_=>_.kind==="ARCHIVE"&&d?.[_.ref]===void 0),a=n.rows,c;try{c=te(e)}catch(_){return i({type:"error",message:_ instanceof Error?_.message:String(_)}),i(ue()),2}try{return await je(e,n,t,r,i,s,o,a,m,w)}finally{c()}}async function je(e,n,t,r,i,s,o,w,d,m){let a=0,c=0,_=0,f=0,P=0,p=0,u=0,R=new Set,b=(v,g)=>{try{m?.(v,g)}catch{}};for(let[v,g]of w.entries()){i({type:"reconcile_row_start",kind:g.kind,ref:g.ref,...g.impact?{stale:g.impact.stale_refs.length,direct:g.impact.direct_refs?.length??0}:{}});let h=(l,$,x)=>i({type:"reconcile_row_end",kind:g.kind,ref:g.ref,outcome:l,...$!==void 0?{exit_code:$}:{},...x?{detail:x}:{}});if(g.applied){c++,h("skipped");continue}if(g.kind==="REMOVE"){P++,h("plan-only");continue}if(g.held_ref&&n.held){let l=new Set;if(g.kind==="MODIFY"&&g.impact){let x=I(e);for(let M of g.impact.stale_refs){let N=x.resolve(M);N&&x.stale(N.tip)==="fresh"&&l.add(M)}}let $=se(e,n.held,g.held_ref,fe);if(!$.ok){_++,u===0&&(u=1),h("failed",1,$.message);continue}if($.kind==="ADD"){let x=await r($.ref,{yes:!0,mode:o});if(x!==0){x===3?(f++,u===0&&(u=3),h("paused",3)):(_++,u===0&&(u=1),h("failed",x));continue}}a++,$.kind!=="ADD"&&g.impact&&(p+=l.size),b(v,"approved"),A(e,g.ref,$.kind==="ADD"?"gap-resolved-create":"gap-resolved-evolve"),h("applied");continue}let k=re(I(e),g.ref);if(!k.ok){c++,h("skipped");continue}let y=k.target;if(R.has(y.ucTip)){c++,h("skipped");continue}if(g.kind==="ADD"){let l=await r(y.seamRef,{yes:!0,mode:o});if(l===3){f++,u===0&&(u=3),h("paused",3);continue}if(l!==0){_++,u===0&&(u=1),h("failed",l);continue}R.add(y.ucTip),a++,b(v,"approved"),A(e,g.ref,"gap-resolved-create"),h("applied")}else{let l=await ie(e,y,{yes:!0,mode:o},s,r,"batch");l.outcome==="evolved"?(R.add(y.ucTip),a++,b(v,"approved"),A(e,g.ref,"gap-resolved-evolve"),h("applied")):l.outcome==="paused"?(f++,u===0&&(u=l.code),h("paused",l.code)):l.outcome==="failed"?(_++,u===0&&(u=1),h("failed",l.code)):(c++,h("skipped"))}}return d.length>0&&(i({type:"reconcile_paused",plan_path:t,pending:d.map(v=>({ref:v.ref,why:v.why}))}),f+=d.length,u===0&&(u=3)),i(ue({applied:a,skipped:c,plan_only:P,failed:_,paused:f,stale_created:p})),u}var fe={kind:"human",id:process.env.USER??"operator"};function A(e,n,t,r){_e(e,{ts:new Date().toISOString(),command:"reconcile-walk",id:n,verdict:t,polarity:"preference",by:fe,target:n,...r!==void 0?{reason:r}:{}})}async function Ye(e,n,t,r,i,s,o=[],w="override",d,m){let a=0,c=0,_=0,f=0,P=0,p=0,u=0,R=new Set;for(let[b,v]of n.entries()){if(v.applied){r.out(`skipped ${v.ref} \u2014 already applied (${v.applied.outcome} at ${v.applied.at})`),c++;continue}let g=l=>{try{s?.(b,l)}catch($){E(r,`could not record applied state for ${v.ref}: ${$ instanceof Error?$.message:String($)}`)}};if(v.kind==="REMOVE"){r.out(`REMOVE ${v.ref} \u2014 plan-only in this release (not executed)`),f++;continue}if(v.held_ref&&d){let l=se(e,d,v.held_ref,fe);if(!l.ok){E(r,`held ${v.ref}: ${l.message}`),P++,u===0&&(u=1);continue}if(r.out(`committed ${l.ref} (${v.kind==="ADD"?"minted":"updated \u2014 old\u2192new redirect"})`),l.kind==="ADD"){let $=await i(l.ref,{yes:t,mode:w});if($===3){r.out(`design session for ${l.ref} paused \u2014 resume with the "kane-cli design tests --resume <session>" command printed above`),p++,u===0&&(u=3),g("approved");continue}if($!==0){E(r,`design run for ${l.ref} ended with exit code ${$}`),P++,u===0&&(u=1),g("approved");continue}}a++,g("approved"),A(e,v.ref,v.kind==="ADD"?"gap-resolved-create":"gap-resolved-evolve");continue}let h=I(e),k=re(h,v.ref);if(!k.ok){r.out(`skipped ${v.ref} \u2014 ${k.message}`),c++;continue}let y=k.target;if(R.has(y.ucTip)){r.out(`skipped ${v.ref} \u2014 use-case ${y.display} already handled in this walk`),c++;continue}if(v.kind==="ADD"){let l=await i(y.seamRef,{yes:t,mode:w});if(l===3){r.out(`design session for ${y.display} paused \u2014 resume with the "kane-cli design tests --resume <session>" command printed above; this row lands when that session completes`),p++,u===0&&(u=3);continue}if(l!==0){E(r,`design run for ${y.display} ended with exit code ${l}`),P++,u===0&&(u=1);continue}R.add(y.ucTip),a++,g("approved"),A(e,v.ref,"gap-resolved-create")}else{let l=await ie(e,y,{yes:!0,mode:w},r,i,"batch");l.outcome==="evolved"?(R.add(y.ucTip),a++,g("approved"),A(e,v.ref,"gap-resolved-evolve")):l.outcome==="paused"?(p++,u===0&&(u=l.code)):l.outcome==="failed"?(P++,u===0&&(u=l.code)):c++}}for(let b of o)if(b.kind==="ARCHIVE"&&m?.[b.ref]===void 0){r.out(`[ARCHIVE] ${b.ref} \u2014 ${b.why}`);{let v=de(b.impact,"retiring drops");v&&r.out(` ${v}`)}r.out(" plan-only \u2014 retire belongs to the interactive session (never headless)"),f++}return r.out(`reconcile walk: ${a} applied, ${c} skipped, ${_} deferred, ${f} plan-only`+(P>0?`, ${P} failed`:"")+(p>0?`, ${p} paused`:"")),u}var Ke=new Set(J.map(e=>e.name));function z(e,n,t){let r=I(e),i=r.heads.get(n);if(i==null)return null;let s=r.mediaOf(i);if("remoteUrl"in t){let o=X(t.remoteUrl)?.name??"remote";return s.format!==o?`source '${n}' is backed by ${s.format} content, not a ${o} source \u2014 reconcile it with the --from it was originally ingested from`:null}return Ke.has(s.format)?`source '${n}' is a remote ${s.format} source \u2014 pass its URL to --from, not a file`:null}function me(e,n,t,r){return"remoteUrl"in n?De(e,n.remoteUrl,{out:t.out,err:t.err},r.remoteFindProvider):xe(e,n.filePath)}function Me(e){return e.remote_url!==void 0?{remoteUrl:e.remote_url}:e.backing_path!==void 0?{filePath:e.backing_path}:null}async function He(e,n,t,r,i,s=!1,o=!1){let w=i.seams??{reingest:me(e,t,r,i),reextract:ce(e,{stage:s,hostOut:c=>r.out(c),hostEmit:c=>{c.type!=="run_start"&&i.emitEvent?.(c)},...i.emitEvent?{}:{hostProgress:c=>process.stderr.write(c+`
|
|
3
|
-
`)}})},d=null,m={reingest:w.reingest,reextract:async c=>d=await w.reextract(c)},a;try{r.out(`reconciling ${n}: re-reading the source and comparing against the graph\u2026`),a=await(i.buildPlan??ae)(e,n,m)}catch(c){return E(r,`reconcile failed: ${c instanceof Error?c.message:String(c)}`),null}if(a.changed)if(o)for(let c of Ae(a,d))r.out(c);else K(r,a,d,!1,i.emitEvent);return a}async function Ne(e){let[{render:n},t,{ScrollbackProvider:r},{ChatSurface:i},{makeChatController:s},{makeReconcileDeps:o}]=await Promise.all([import("./build-JIKYOZUH.js"),import("./react-QWOAB3TB.js"),import("./scrollback-JLPJR25X.js"),import("./ChatSurface-
|
|
4
|
-
`)}})},f;try{f=await(r.buildPlan??ae)(e,n.source_id,_,{resumeHeld:m})}catch(h){return E(t,`reconcile failed: ${h instanceof Error?h.message:String(h)}`),1}if(i==="interactive"&&!o)for(let h of Ae(f,null))t.out(h);else K(t,f,null,!1,r.emitEvent);let P=B(e),p=null;if(P!=null){let h={},k=new Set(f.changeset.filter(y=>y.kind==="ARCHIVE").map(y=>y.ref));for(let[y,l]of Object.entries(n.archive_state??{}))k.has(y)&&(h[y]=l);p=ee(e,{version:2,source_id:f.source_id,...n.remote_url!==void 0?{remote_url:n.remote_url}:{backing_path:n.backing_path},head_pin:P,created:new Date().toISOString().replace(/[:.]/g,"-"),skipped_arms:f.skipped_arms,note:f.note,changeset:f.changeset,rows:f.rows,...f.held?{held:f.held}:{},...Object.keys(h).length>0?{archive_state:h}:{}}),t.out(`plan stored: ${p}`)}if(o){if(i==="agent"){let h=r.emitEvent??(()=>{});T(h,f,p),h({...j})}return 0}let u=r.emitEvent??(()=>{}),R=p?W(e,p).plan.archive_state:void 0,b=p?(h,k)=>O(p,h,k):void 0,v=p?(h,k)=>G(p,h,k):void 0;if(i==="agent")return Y(e,f,p,s,u,t,D(i),b,R);let g=f.changeset.filter(h=>h.kind==="ARCHIVE"&&R?.[h.ref]===void 0);return i==="ci"&&g.length>0?(E(t,L(g.length)),2):H(e,f.rows,i==="override"||i==="ci",t,s,b,f.changeset,D(i),f.held,R,v,w,d,f.source_id,F(n.backing_path??n.remote_url,f.source_id))}async function Ce(e,n,t={},r=process.cwd()){let{telemetryBootstrap:i,telemetryEnvName:s}=await import("./bootstrap-
|
|
2
|
+
import{j as be,k as se,l as ae,m as xe,n as De,o as ce}from"./chunk-3H3KTCL7.js";import{a as re,c as ie,d as Pe,i as oe}from"./chunk-LKPOOZYN.js";import{d as Ee}from"./chunk-6J5T5FEY.js";import{a as S}from"./chunk-RRY5IXOB.js";import{a as ee,b as W,c as ne,d as G,e as $e,g as O,h as te}from"./chunk-W5TTF7GB.js";import{a as _e}from"./chunk-BZAGVBCX.js";import{b as J,c as Q,d as X}from"./chunk-T6MGCP57.js";import{j as ke,l as Re}from"./chunk-7N6OCHPC.js";import{P as E,Q as ge,S as he,U as ve,V as we,W as ye,X as Z}from"./chunk-5D6YMG63.js";import{z as I}from"./chunk-IICT4VOU.js";import{H as B,t as pe}from"./chunk-RDHWNSDP.js";import{existsSync as Oe,statSync as Te}from"fs";import{basename as q,resolve as U}from"path";function Ie(e){if(!e||e.stale_refs.length===0)return"\u2014";let n=e.direct_refs??[];return`${e.stale_refs.length} stale${n.length>0?` \xB7 ${n.length} direct`:""}`}function le(e,n){let t=[...e.rows.filter(s=>s.kind!=="REMOVE").map(s=>[s.kind,S(s.ref),s.reason,Ie(s.impact)]),...e.archive.map(s=>["ARCHIVE",S(s.ref),s.why,Ie(s.impact)])],r=Math.max(40,n??100),i=[`reconcile ${e.source_id} \u2014 head ${e.head.status} \xB7 ${t.length} decision${t.length===1?"":"s"}`];return t.length>0&&i.push(...Ee(["kind","ref","why","impact"],t,r,2)),e.changed&&i.push(e.held?`extract ran in override mode; ${e.defaultsTaken??0} default(s) auto-taken; matched-but-changed and new proposals HELD for your verdict (staged \u2014 nothing committed)`:`extract ran in override mode; ${e.defaultsTaken??0} default(s) auto-taken; matched-but-changed proposals auto-committed as edits`),i.push("each row becomes a card below \u2014 verdicts commit as they land"),e.planPath&&i.push(`plan: ${e.planPath}`),i}var Ue=new Set(["interactive","agent","ci","override"]);function Be(e,n){if(e.mode!==void 0&&!Ue.has(e.mode))return{error:`--mode must be interactive | agent | ci | override, got '${e.mode}'`,code:"MODE_USAGE"};let t=e.mode,r="reconcile without a TTY needs an explicit mode \u2014 pass --mode agent|ci|override, or --plan for a preview";return t==="interactive"&&!n?{error:r}:t||(n?"interactive":e.plan?"override":{error:r})}async function Se(e){let{makeHeadlessIO:n,agentRefusal:t}=await import("./headless-io-75HUMWZB.js");return t(n("ndjson","reconcile"),e,"MODE_USAGE")}function Ve(e,n,t,r){if(Q(t)){let m=X(t),a=m?.sourceIdFor(t)??null;if(m===null||a===null)return{error:`--from '${t}' is not a supported remote URL \u2014 supported: ${J.map(f=>f.hint).join("; ")}`};if(r!==void 0&&r!==a)return{error:`--source-id '${r}' does not match this URL's own identity '${a}' \u2014 re-run without --source-id. A source adopted with --as updates by re-running context ingest with the same --as; reconcile follows only the URL's own id`};let c=I(e);if(!c.heads.has(a))return{error:`unknown source '${a}' \u2014 see \`kane-cli context list --type source\`. If this URL was ingested under a custom id, update it by re-running context ingest with the same --as`};if(c.heads.get(a)==null)return{error:`source '${a}' is retired \u2014 restore it first with \`kane-cli context revert\`, then reconcile`};let _=z(e,a,{remoteUrl:t});return _!==null?{error:_}:{sourceId:a,remoteUrl:t}}if(r===void 0)return{error:"reconcile needs --from <file> AND --source-id <id> \u2014 see `kane-cli context list --type source` for ids"};let i=U(n,t);if(!Oe(i)||!Te(i).isFile())return{error:`--from '${t}' is not a file \u2014 pass the changed source document`};let s=ke(i);if(!s.ok)return{error:`--from '${t}' is not an ingestable document \u2014 allowed: ${s.allowlist.join(", ")}`};let o=I(e);if(!o.heads.has(r))return{error:`unknown source '${r}' \u2014 see \`kane-cli context list --type source\``};if(o.heads.get(r)==null)return{error:`source '${r}' is retired \u2014 restore it first with \`kane-cli context revert\`, then reconcile`};let w=z(e,r,{filePath:i});if(w!==null)return{error:w};let d=null;try{d=Re(i)}catch{}return d!==null&&d!==r&&o.heads.get(d)!=null?{error:`'${q(i)}' already backs live source '${d}' \u2014 did you mean --source-id ${d}? To truly move these bytes under '${r}', retire '${d}' first`}:{sourceId:r,filePath:i}}function C(e){return e==null?"(none)":e.slice(0,19)}function K(e,n,t,r=!1,i){if(e.out(`reconcile ${n.source_id}: head ${n.head.status} \u2014 ${C(n.head.before)} \u2192 ${C(n.head.after)}`),r||(e.out(`note: ${n.note}`),e.out(`skipped arms: ${n.skipped_arms}`)),n.changed&&(e.out(n.held?`extract ran in override mode; ${t?.defaultsTaken??0} default(s) auto-taken; matched-but-changed and new proposals HELD for your verdict (staged \u2014 nothing committed)`:`extract ran in override mode; ${t?.defaultsTaken??0} default(s) auto-taken; matched-but-changed proposals auto-committed as edits`),i?.({type:"defaults_taken",count:t?.defaultsTaken??0})),r){let s=n.changeset??[],o=(d,m)=>{let a=s.filter(c=>c.kind===d).length;return a>0?`${a} ${m}`:null},w=[o("ADD","add"),o("MODIFY","modify"),o("ARCHIVE","archive")].filter(Boolean);n.changed&&e.out(`changeset: ${s.length} item(s)${w.length?` \u2014 ${w.join(" \xB7 ")}`:""}`),e.out(`plan: ${n.rows.length} row(s) \u2014 each gets a card below`);return}if(n.changed){let s=n.changeset??[];e.out(`changeset: ${s.length} item(s)`);for(let o of s)if(o.kind==="MODIFY")e.out(` [MODIFY] ${S(o.ref)} \u2014 ${o.summary} (${C(o.old_cid)} \u2192 ${o.new_cid===null?"(staged)":C(o.new_cid)})`);else if(o.kind==="ADD")e.out(` [ADD] ${S(o.ref)}`);else{e.out(` [ARCHIVE] ${S(o.ref)} \u2014 ${o.why}`);let w=de(o.impact,"retiring drops");w&&e.out(` ${w}`)}}e.out(`plan: ${n.rows.length} row(s)`);for(let s of n.rows){e.out(` [${s.kind}] ${S(s.ref)} \u2014 ${s.reason}`);let o=de(s.impact,"approving marks");o&&e.out(` ${o}`),e.out(` provenance: ${s.provenance}`),e.out(` action: ${s.action}`)}}function Ae(e,n){return le({source_id:e.source_id,head:{status:e.head.status},rows:e.rows,archive:(e.changeset??[]).filter(t=>t.kind==="ARCHIVE"),changed:e.changed,held:!!e.held,defaultsTaken:n?.defaultsTaken},process.stdout.columns)}function de(e,n){if(!e||e.stale_refs.length===0)return null;let t=e.direct_refs??[];return`impact: ${n} ${e.stale_refs.length} item(s) stale`+(t.length>0?` \u2014 ${t.length} directly touched: ${t.join(", ")}`:"")}function D(e){return e==="interactive"?"override":e}async function H(e,n,t,r,i,s,o=[],w="override",d,m,a,c,_,f,P){let p;try{p=te(e)}catch(u){return E(r,u instanceof Error?u.message:String(u)),1}try{if(!t){let{runWalkSession:u}=await import("./walk-session-YSKEJM2F.js"),{telemetryEnvName:R}=await import("./bootstrap-DBAQWVNA.js");return await u({dir:e,rows:n,archive:o,held:d??null,childMode:w,runDesign:c??null,mark:s,markA:a,...m?{archiveState:m}:{},...f?{meta:{verb:"reconcile",sid:f,env:R()}}:{},...P?{resumeCmd:P}:{},signals:b=>A(e,b.ref,b.verdict,b.reason),..._?{script:_}:{}})}return await Ye(e,n,t,r,i,s,o,w,d,m)}finally{p()}}var F=(e,n)=>e?`kane-cli maintain reconcile --from ${e} --source-id ${n}`:void 0,Le=e=>e===null?void 0:"filePath"in e?e.filePath:e.remoteUrl,L=e=>`${e} high-risk item(s) need a human \u2014 ci mode won't guess. Walk interactively or use --mode agent.`;function T(e,n,t){let r=n.rows;e({type:"reconcile_plan",source_id:n.source_id,plan_path:t,rows:r.map(i=>({kind:i.kind,ref:i.ref,why:i.reason})),archive:n.changeset.filter(i=>i.kind==="ARCHIVE").map(i=>({ref:i.ref,why:i.why}))})}function ue(e={}){return{type:"reconcile_summary",applied:0,skipped:0,deferred:0,plan_only:0,failed:0,paused:0,stale_created:0,...e}}var j=ue();async function Y(e,n,t,r,i,s,o,w,d){T(i,n,t);let m=n.changeset.filter(_=>_.kind==="ARCHIVE"&&d?.[_.ref]===void 0),a=n.rows,c;try{c=te(e)}catch(_){return i({type:"error",message:_ instanceof Error?_.message:String(_)}),i(ue()),2}try{return await je(e,n,t,r,i,s,o,a,m,w)}finally{c()}}async function je(e,n,t,r,i,s,o,w,d,m){let a=0,c=0,_=0,f=0,P=0,p=0,u=0,R=new Set,b=(v,g)=>{try{m?.(v,g)}catch{}};for(let[v,g]of w.entries()){i({type:"reconcile_row_start",kind:g.kind,ref:g.ref,...g.impact?{stale:g.impact.stale_refs.length,direct:g.impact.direct_refs?.length??0}:{}});let h=(l,$,x)=>i({type:"reconcile_row_end",kind:g.kind,ref:g.ref,outcome:l,...$!==void 0?{exit_code:$}:{},...x?{detail:x}:{}});if(g.applied){c++,h("skipped");continue}if(g.kind==="REMOVE"){P++,h("plan-only");continue}if(g.held_ref&&n.held){let l=new Set;if(g.kind==="MODIFY"&&g.impact){let x=I(e);for(let M of g.impact.stale_refs){let N=x.resolve(M);N&&x.stale(N.tip)==="fresh"&&l.add(M)}}let $=se(e,n.held,g.held_ref,fe);if(!$.ok){_++,u===0&&(u=1),h("failed",1,$.message);continue}if($.kind==="ADD"){let x=await r($.ref,{yes:!0,mode:o});if(x!==0){x===3?(f++,u===0&&(u=3),h("paused",3)):(_++,u===0&&(u=1),h("failed",x));continue}}a++,$.kind!=="ADD"&&g.impact&&(p+=l.size),b(v,"approved"),A(e,g.ref,$.kind==="ADD"?"gap-resolved-create":"gap-resolved-evolve"),h("applied");continue}let k=re(I(e),g.ref);if(!k.ok){c++,h("skipped");continue}let y=k.target;if(R.has(y.ucTip)){c++,h("skipped");continue}if(g.kind==="ADD"){let l=await r(y.seamRef,{yes:!0,mode:o});if(l===3){f++,u===0&&(u=3),h("paused",3);continue}if(l!==0){_++,u===0&&(u=1),h("failed",l);continue}R.add(y.ucTip),a++,b(v,"approved"),A(e,g.ref,"gap-resolved-create"),h("applied")}else{let l=await ie(e,y,{yes:!0,mode:o},s,r,"batch");l.outcome==="evolved"?(R.add(y.ucTip),a++,b(v,"approved"),A(e,g.ref,"gap-resolved-evolve"),h("applied")):l.outcome==="paused"?(f++,u===0&&(u=l.code),h("paused",l.code)):l.outcome==="failed"?(_++,u===0&&(u=1),h("failed",l.code)):(c++,h("skipped"))}}return d.length>0&&(i({type:"reconcile_paused",plan_path:t,pending:d.map(v=>({ref:v.ref,why:v.why}))}),f+=d.length,u===0&&(u=3)),i(ue({applied:a,skipped:c,plan_only:P,failed:_,paused:f,stale_created:p})),u}var fe={kind:"human",id:process.env.USER??"operator"};function A(e,n,t,r){_e(e,{ts:new Date().toISOString(),command:"reconcile-walk",id:n,verdict:t,polarity:"preference",by:fe,target:n,...r!==void 0?{reason:r}:{}})}async function Ye(e,n,t,r,i,s,o=[],w="override",d,m){let a=0,c=0,_=0,f=0,P=0,p=0,u=0,R=new Set;for(let[b,v]of n.entries()){if(v.applied){r.out(`skipped ${v.ref} \u2014 already applied (${v.applied.outcome} at ${v.applied.at})`),c++;continue}let g=l=>{try{s?.(b,l)}catch($){E(r,`could not record applied state for ${v.ref}: ${$ instanceof Error?$.message:String($)}`)}};if(v.kind==="REMOVE"){r.out(`REMOVE ${v.ref} \u2014 plan-only in this release (not executed)`),f++;continue}if(v.held_ref&&d){let l=se(e,d,v.held_ref,fe);if(!l.ok){E(r,`held ${v.ref}: ${l.message}`),P++,u===0&&(u=1);continue}if(r.out(`committed ${l.ref} (${v.kind==="ADD"?"minted":"updated \u2014 old\u2192new redirect"})`),l.kind==="ADD"){let $=await i(l.ref,{yes:t,mode:w});if($===3){r.out(`design session for ${l.ref} paused \u2014 resume with the "kane-cli design tests --resume <session>" command printed above`),p++,u===0&&(u=3),g("approved");continue}if($!==0){E(r,`design run for ${l.ref} ended with exit code ${$}`),P++,u===0&&(u=1),g("approved");continue}}a++,g("approved"),A(e,v.ref,v.kind==="ADD"?"gap-resolved-create":"gap-resolved-evolve");continue}let h=I(e),k=re(h,v.ref);if(!k.ok){r.out(`skipped ${v.ref} \u2014 ${k.message}`),c++;continue}let y=k.target;if(R.has(y.ucTip)){r.out(`skipped ${v.ref} \u2014 use-case ${y.display} already handled in this walk`),c++;continue}if(v.kind==="ADD"){let l=await i(y.seamRef,{yes:t,mode:w});if(l===3){r.out(`design session for ${y.display} paused \u2014 resume with the "kane-cli design tests --resume <session>" command printed above; this row lands when that session completes`),p++,u===0&&(u=3);continue}if(l!==0){E(r,`design run for ${y.display} ended with exit code ${l}`),P++,u===0&&(u=1);continue}R.add(y.ucTip),a++,g("approved"),A(e,v.ref,"gap-resolved-create")}else{let l=await ie(e,y,{yes:!0,mode:w},r,i,"batch");l.outcome==="evolved"?(R.add(y.ucTip),a++,g("approved"),A(e,v.ref,"gap-resolved-evolve")):l.outcome==="paused"?(p++,u===0&&(u=l.code)):l.outcome==="failed"?(P++,u===0&&(u=l.code)):c++}}for(let b of o)if(b.kind==="ARCHIVE"&&m?.[b.ref]===void 0){r.out(`[ARCHIVE] ${b.ref} \u2014 ${b.why}`);{let v=de(b.impact,"retiring drops");v&&r.out(` ${v}`)}r.out(" plan-only \u2014 retire belongs to the interactive session (never headless)"),f++}return r.out(`reconcile walk: ${a} applied, ${c} skipped, ${_} deferred, ${f} plan-only`+(P>0?`, ${P} failed`:"")+(p>0?`, ${p} paused`:"")),u}var Ke=new Set(J.map(e=>e.name));function z(e,n,t){let r=I(e),i=r.heads.get(n);if(i==null)return null;let s=r.mediaOf(i);if("remoteUrl"in t){let o=X(t.remoteUrl)?.name??"remote";return s.format!==o?`source '${n}' is backed by ${s.format} content, not a ${o} source \u2014 reconcile it with the --from it was originally ingested from`:null}return Ke.has(s.format)?`source '${n}' is a remote ${s.format} source \u2014 pass its URL to --from, not a file`:null}function me(e,n,t,r){return"remoteUrl"in n?De(e,n.remoteUrl,{out:t.out,err:t.err},r.remoteFindProvider):xe(e,n.filePath)}function Me(e){return e.remote_url!==void 0?{remoteUrl:e.remote_url}:e.backing_path!==void 0?{filePath:e.backing_path}:null}async function He(e,n,t,r,i,s=!1,o=!1){let w=i.seams??{reingest:me(e,t,r,i),reextract:ce(e,{stage:s,hostOut:c=>r.out(c),hostEmit:c=>{c.type!=="run_start"&&i.emitEvent?.(c)},...i.emitEvent?{}:{hostProgress:c=>process.stderr.write(c+`
|
|
3
|
+
`)}})},d=null,m={reingest:w.reingest,reextract:async c=>d=await w.reextract(c)},a;try{r.out(`reconciling ${n}: re-reading the source and comparing against the graph\u2026`),a=await(i.buildPlan??ae)(e,n,m)}catch(c){return E(r,`reconcile failed: ${c instanceof Error?c.message:String(c)}`),null}if(a.changed)if(o)for(let c of Ae(a,d))r.out(c);else K(r,a,d,!1,i.emitEvent);return a}async function Ne(e){let[{render:n},t,{ScrollbackProvider:r},{ChatSurface:i},{makeChatController:s},{makeReconcileDeps:o}]=await Promise.all([import("./build-JIKYOZUH.js"),import("./react-QWOAB3TB.js"),import("./scrollback-JLPJR25X.js"),import("./ChatSurface-PA73V3NT.js"),import("./chat-controller-UJQ6Z4RE.js"),import("./reconcile-deps-CYWH6GM4.js")]),w=t.default??t,d=s(),m=o({contextDir:e,note:a=>d.note(a)});return new Promise(a=>{let c=n(w.createElement(r,null,w.createElement(i,{controller:d,verb:"extract",reconcile:m,autoReview:!0,onReviewExit:()=>{c.unmount(),a(0)},onCtrlC:()=>{c.unmount(),a(m.pending()?3:0)}})),{exitOnCtrlC:!1})})}async function We(e,n,t,r,i){let s=W(e,n);if("error"in s)return E(r,s.error),2;let{plan:o,path:w}=s,d=t==="override"||t==="ci";if(n===void 0&&t==="interactive"&&r.isTTY&&!await r.confirm(`apply plan ${q(w)} for ${o.source_id} (created ${o.created})?`))return r.out(`not applying ${q(w)}`),0;let m=i.runDesignForUc??oe,a=i.runDesignForUc??null,c=i.sessionScript,_=(v,g)=>O(w,v,g),f=(v,g)=>G(w,v,g),P=B(e);if(P===o.head_pin){if(t==="agent"){let g=i.emitEvent??(()=>{});return Y(e,V(o),w,m,g,r,D(t),_,o.archive_state)}let v=ne(o);if(t==="ci"&&v.length>0)return E(r,L(v.length)),2;if(r.out(`applying stored plan ${q(w)} for ${o.source_id} (${o.rows.length} row(s))`),!d)for(let g of le({source_id:o.source_id,head:{status:"stored plan"},rows:o.rows,archive:(o.changeset??[]).filter(h=>h.kind==="ARCHIVE"),changed:!1,held:!!o.held},process.stdout.columns))r.out(g);return H(e,o.rows,d,r,m,_,o.changeset??[],D(t),o.held,o.archive_state,f,a,c,o.source_id,F(o.backing_path??o.remote_url,o.source_id))}if(r.out(`graph moved since this plan (${C(o.head_pin)} \u2192 ${C(P)}) \u2014 recomputing`),o.held)return Fe(e,o,r,i,t,m,!1);let p=Me(o);if(p===null)return E(r,`stored plan for ${o.source_id} names no backing file or URL \u2014 re-run reconcile --from`),2;let u=z(e,o.source_id,p);if(u!==null)return E(r,`stored plan cannot replay: ${u}`),2;let R=await He(e,o.source_id,p,r,i,!1,t==="interactive");if(!R)return 1;if(!R.changed)return K(r,R,null,!1,i.emitEvent),0;if(t==="agent"){let v=i.emitEvent??(()=>{});return Y(e,R,null,m,v,r,D(t))}let b=R.changeset.filter(v=>v.kind==="ARCHIVE");return t==="ci"&&b.length>0?(E(r,L(b.length)),2):H(e,R.rows,d,r,m,void 0,R.changeset,D(t),R.held,void 0,void 0,a,c,R.source_id,F(Le(p),R.source_id))}function V(e,n=!1){return{source_id:e.source_id,changed:!0,head:{status:"unchanged",before:e.head_pin,after:e.head_pin},note:e.note,skipped_arms:e.skipped_arms,changeset:e.changeset??[],rows:n?e.rows.filter(t=>t.applied===void 0):e.rows,...e.held?{held:e.held}:{}}}async function Ge(e,n,t,r,i,s,o){let w=r.runDesignForUc??null,d=r.sessionScript,m=$e(e,n);if(m===null)return null;if("error"in m)return E(t,m.error),2;let{plan:a,path:c}=m,_=a.rows.filter(u=>u.applied===void 0),f=ne(a),P=r.emitEvent??(()=>{});if(_.length===0&&f.length===0){t.out(`already reconciled \u2014 plan ${a.created} applied ${a.rows.length} row(s)`);let u=Pe(I(e)).staleCount;return u>0&&(t.out(`${u} item(s) still stale \u2014 kane-cli maintain evolve --from-stale`),P({type:"stale_debt",count:u})),i==="agent"&&(T(P,V(a),c),P({...j})),0}let p=B(e);return p!==a.head_pin?(t.out(`plan ${a.created} superseded \u2014 graph moved (${C(a.head_pin)} \u2192 ${C(p)}); recomputing`),Fe(e,a,t,r,i,s,o)):(t.out(`resuming plan ${a.created} \u2014 ${_.length} pending row(s)${f.length>0?`, ${f.length} undecided archive item(s)`:""}`),o?(K(t,V(a),null,!1,r.emitEvent),t.out(`plan stored: ${c}`),i==="agent"&&(T(P,V(a),c),P({...j})),0):i==="agent"?Y(e,V(a),c,s,P,t,D(i),(u,R)=>O(c,u,R),a.archive_state):i==="ci"&&f.length>0?(E(t,L(f.length)),2):H(e,a.rows,i==="override"||i==="ci",t,s,(u,R)=>O(c,u,R),a.changeset??[],D(i),a.held,a.archive_state,(u,R)=>G(c,u,R),w,d,a.source_id,F(a.backing_path??a.remote_url,a.source_id)))}async function Fe(e,n,t,r,i,s,o){let w=r.runDesignForUc??null,d=r.sessionScript,m;if(n.held){let h=I(e),k=new Set(n.rows.filter(l=>l.held_ref!==void 0&&l.applied!==void 0).map(l=>l.held_ref)),y=[];for(let l of n.held.rows){if(k.has(l.temp_ref))continue;if(!l.matched_cid){y.push(l);continue}let $=h.tipOf(l.matched_cid);if(h.superseded.get($)===null){t.out(`dropped held "${l.title}" \u2014 its use-case was retired meanwhile`),r.emitEvent?.({type:"held_dropped",ref:l.temp_ref,title:l.title,reason:"target_retired"});continue}y.push($===l.matched_cid?l:{...l,matched_cid:$,uc:{...l.uc,matches_existing:{cid:$}}})}m={source_id:n.held.source_id,rows:y}}let a=Me(n);if(a===null)return E(t,`stored plan for ${n.source_id} names no backing file or URL \u2014 re-run reconcile --from`),2;let c=z(e,n.source_id,a);if(c!==null)return E(t,`stored plan cannot replay: ${c}`),2;let _=r.seams??{reingest:me(e,a,t,r),reextract:ce(e,{stage:m!==void 0,hostOut:h=>t.out(h),hostEmit:h=>{h.type!=="run_start"&&r.emitEvent?.(h)},...r.emitEvent?{}:{hostProgress:h=>process.stderr.write(h+`
|
|
4
|
+
`)}})},f;try{f=await(r.buildPlan??ae)(e,n.source_id,_,{resumeHeld:m})}catch(h){return E(t,`reconcile failed: ${h instanceof Error?h.message:String(h)}`),1}if(i==="interactive"&&!o)for(let h of Ae(f,null))t.out(h);else K(t,f,null,!1,r.emitEvent);let P=B(e),p=null;if(P!=null){let h={},k=new Set(f.changeset.filter(y=>y.kind==="ARCHIVE").map(y=>y.ref));for(let[y,l]of Object.entries(n.archive_state??{}))k.has(y)&&(h[y]=l);p=ee(e,{version:2,source_id:f.source_id,...n.remote_url!==void 0?{remote_url:n.remote_url}:{backing_path:n.backing_path},head_pin:P,created:new Date().toISOString().replace(/[:.]/g,"-"),skipped_arms:f.skipped_arms,note:f.note,changeset:f.changeset,rows:f.rows,...f.held?{held:f.held}:{},...Object.keys(h).length>0?{archive_state:h}:{}}),t.out(`plan stored: ${p}`)}if(o){if(i==="agent"){let h=r.emitEvent??(()=>{});T(h,f,p),h({...j})}return 0}let u=r.emitEvent??(()=>{}),R=p?W(e,p).plan.archive_state:void 0,b=p?(h,k)=>O(p,h,k):void 0,v=p?(h,k)=>G(p,h,k):void 0;if(i==="agent")return Y(e,f,p,s,u,t,D(i),b,R);let g=f.changeset.filter(h=>h.kind==="ARCHIVE"&&R?.[h.ref]===void 0);return i==="ci"&&g.length>0?(E(t,L(g.length)),2):H(e,f.rows,i==="override"||i==="ci",t,s,b,f.changeset,D(i),f.held,R,v,w,d,f.source_id,F(n.backing_path??n.remote_url,f.source_id))}async function Ce(e,n,t={},r=process.cwd()){let{telemetryBootstrap:i,telemetryEnvName:s}=await import("./bootstrap-DBAQWVNA.js"),o=i({verb:"reconcile",mode:typeof e.mode=="string"?e.mode:"interactive",contextRoot:U(r,".context"),env:s(),applyPlanPath:typeof e.apply=="string"?U(r,e.apply):void 0,write:!0,longSession:!0});e.mode==="agent"&&t.emitEvent?.({type:"run_start",session:o.ids.session_id});{let m=Oe(U(r,".context"))?ye(U(r,".context")):null;if(m)return e.mode==="agent"?t.emitEvent?.(Z(m)):(E(n,m.text),(n.err??n.out)(`next: ${m.remedy}`)),await o.end({exit_code:2}),2}let w=await ve(U(r,".context"));w&&(e.mode==="agent"?t.emitEvent?.(we(w)):(n.err??n.out)(w.text));let d=await qe(e,n,t,r);return d===1&&e.mode!=="agent"&&(n.err??n.out)(o.supportFooter()),await o.end({exit_code:d}),d}async function qe(e,n,t={},r=process.cwd()){let i=e.apply!==void 0&&e.apply!==!1,s=typeof e.apply=="string"?e.apply:void 0;if(e.plan&&i)return E(n,"pass --plan OR --apply, not both"),2;let o=e.from!==void 0||!i,w=e.from!==void 0&&Q(e.from);if(o&&(!e.from||!e.sourceId&&!w))return E(n,"reconcile needs --from <file|url> AND --source-id <id> (files only \u2014 a URL derives its own id) \u2014 see `kane-cli context list --type source` for ids"),2;if(e.from&&s!==void 0)return E(n,"pass --from OR --apply <path>, not both \u2014 a stored plan names its own source"),2;let d=ge(r,n);if(!d)return 2;if(e.mode!==void 0&&!Ue.has(e.mode))return Se(`--mode must be interactive | agent | ci | override, got '${e.mode}'`);let m=e.mode==="agent"||e.mode==="ci"||e.mode==="override";if(i&&!m&&!n.isTTY)return E(n,"refusing to apply without a TTY to confirm \u2014 pass --mode override|ci"),2;let a=!e.plan,c="override";if(e.from){let k=Be(e,n.isTTY);if(typeof k=="object")return k.code==="MODE_USAGE"?Se(k.error):(E(n,k.error),2);c=k}let _=c==="override"||c==="ci";if(i&&!e.from){let{makeReconcileDeps:k}=await import("./reconcile-deps-CYWH6GM4.js"),y=s===void 0?k({contextDir:d}).pending():null;if(y?.kind==="cards"){let $=e.mode??"interactive";return!n.isTTY||$!=="interactive"?(E(n,`a held changeset for ${y.source} awaits review (${y.count} change(s)) \u2014 resume in a terminal: kane-cli maintain reconcile --apply [HELD_REVIEW]`),2):(t.cardApplyMount??Ne)(d)}let l=e.mode??"interactive";return We(d,s===void 0?void 0:U(r,s),l,n,t)}let f=Ve(d,r,e.from,e.sourceId);if("error"in f)return E(n,f.error),2;if(!i){let{sessionsHoldingSource:k}=await import("./sessions-NH7WQWMX.js"),{holders:y,corrupt:l}=k(d,f.sourceId);if(l>0)return E(n,`cannot verify review holds \u2014 ${l} session file(s) unreadable; inspect with kane-cli context sessions list, clean with kane-cli context sessions clean, then retry [SESSIONS_UNREADABLE]`),2;if(y.length>0)return E(n,`session ${y[0]} holds item(s) for review pinned to ${f.sourceId} \u2014 finish that review first: kane-cli context extract --resume ${y[0]} [SOURCE_HELD]`),2}if(c==="interactive"&&!e.plan&&!i){let k=t.seams?.reingest??me(d,f,n,t),y;try{y=await k(f.sourceId)}catch($){return E(n,$ instanceof Error?$.message:String($)),1}let l=y.status==="unchanged"?null:be(d,f.sourceId);if(y.status!=="unchanged"&&!l)return n.out(`${f.sourceId} landed for the first time \u2014 extract it: kane-cli context extract --source ${f.sourceId}`),0;if(l){let x=await(t.chatMount??(async M=>{let{bindExtractInteractive:N}=await import("./extract-bind-T7GKUEJ6.js");return N(M)}))({mode:"interactive",posture:"reconcile",source:f.sourceId,changeContext:l});if(x===3){let{sessionsHoldingSource:M}=await import("./sessions-NH7WQWMX.js");if(M(d,f.sourceId).holders.length===0)return 0}return x}}let P="remoteUrl"in f?{remoteUrl:f.remoteUrl}:{filePath:f.filePath},p=await He(d,f.sourceId,P,n,t,!!e.plan||c==="interactive",c==="interactive"&&!e.plan);if(!p)return 1;let u=t.runDesignForUc??oe,R=t.runDesignForUc??null,b=t.sessionScript;if(!p.changed){let k=await Ge(d,f.sourceId,n,t,c,u,!!e.plan);if(k!==null)return k;if(K(n,p,null,!1,t.emitEvent),c==="agent"){let y=t.emitEvent??(()=>{});T(y,p,null),y({...j})}return 0}let v=B(d),g=null;if(v!=null?g=ee(d,{version:2,source_id:p.source_id,..."remoteUrl"in P?{remote_url:P.remoteUrl}:{backing_path:P.filePath},head_pin:v,created:new Date().toISOString().replace(/[:.]/g,"-"),skipped_arms:p.skipped_arms,note:p.note,changeset:p.changeset,rows:p.rows,...p.held?{held:p.held}:{}}):E(n,"no chain head after extract \u2014 plan not stored"),c==="agent"){let k=t.emitEvent??(()=>{});if(!a)return T(k,p,g),k({...j}),0;let y=g?(l,$)=>O(g,l,$):void 0;return Y(d,p,g,u,k,n,D(c),y)}if(!a)return g&&n.out(`plan stored: ${g}`),0;let h=p.changeset.filter(k=>k.kind==="ARCHIVE");if(c==="ci"&&h.length>0)return g&&n.out(`plan stored: ${g}`),E(n,L(h.length)),2;if(g){n.out(`plan stored: ${g}`);let k=g;return H(d,ze(d,k)??p.rows,_,n,u,(y,l)=>O(k,y,l),p.changeset,D(c),p.held,void 0,void 0,R,b,p.source_id,F(e.from,p.source_id))}return H(d,p.rows,_,n,u,void 0,p.changeset,D(c),p.held,void 0,void 0,R,b,p.source_id,F(e.from,p.source_id))}function ze(e,n){let t=W(e,n);return"error"in t?null:t.plan.rows}async function hn(e,n={},t,r=process.cwd()){if(e.mode==="agent"){let{makeHeadlessIO:i}=await import("./headless-io-75HUMWZB.js"),s=t?i("ndjson","reconcile",t):i("ndjson","reconcile"),o={out:s.out,err:m=>s.event({type:"error",message:m}),isTTY:!1,confirm:async()=>!1,ask:async()=>""},{runWithChannel:w}=await import("./run-channel-RGH4WIQX.js"),d=2;try{d=await w({event:m=>s.event(m)},()=>Ce(e,o,{...n,emitEvent:m=>s.event(m)},r))}catch(m){m instanceof pe?(d=2,s.event(Z({code:m.code,text:m.message,remedy:m.remedy}))):(d=1,s.event({type:"error",message:m instanceof Error?m.message:String(m)}))}return s.done(d)}return Ce(e,he(),n,r)}export{Be as a,Ve as b,D as c,A as d,Ce as e,hn as f};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as d,g as B,k as ee}from"./chunk-YLQHY4A7.js";import{P as Z}from"./chunk-RDHWNSDP.js";import{b as A}from"./chunk-
|
|
2
|
+
import{a as d,g as B,k as ee}from"./chunk-YLQHY4A7.js";import{P as Z}from"./chunk-RDHWNSDP.js";import{b as A}from"./chunk-SJZJ7ASF.js";import{createHash as Ie,randomBytes as F}from"crypto";import{mkdirSync as xe,mkdtempSync as P,rmSync as $,existsSync as ve,renameSync as ke}from"fs";import{tmpdir as j}from"os";import{join as _,dirname as ce}from"path";import{spawn as te}from"child_process";function N(n,e=process.env){let t=n.replace(/https?:\/\/[^\s/@]+:[^\s/@]+@/gi,"https://[redacted]@").replace(/(authorization\s*[:=])[^\r\n]+/gi,"$1 [redacted]"),r=e.KANE_SYNC_GIT_TOKEN;if(r)for(let i of[r,Buffer.from(`x-access-token:${r}`).toString("base64")])t=t.split(i).join("[redacted]");return t}function be(n,e){if(n.GIT_SSH_COMMAND)return re(n.GIT_SSH_COMMAND);if(!n.GIT_SSH)return e?re(e):"ssh -o BatchMode=yes"}function re(n){return/(^|\s)-o\s*BatchMode=yes(\s|$)/.test(n)?n:`${n} -o BatchMode=yes`}var _e=/^(?:ssh:\/\/|[^/\s@:]+@[^/\s:]+:)/i,ie=new Map;function Ae(n,e){let t=[e??"",n.GIT_CONFIG_GLOBAL??"",n.HOME??""].join("\0"),r=ie.get(t);return r===void 0&&(r=se(["config","--get","core.sshCommand"],n,e,12e4).then(i=>i.code===0&&i.stdout.toString().trim()||void 0,()=>{}),ie.set(t,r)),r}var ne=new Set(["fetch","push","clone","ls-remote"]);function Ce(n,e,t){if(t!==void 0)return t;if(!n.some(i=>ne.has(i)))return 12e4;let r=e.KANE_SYNC_GIT_TRANSFER_TIMEOUT_SECONDS;if(r!==void 0){if(!/^\d+$/.test(r)||Number(r)<60||Number(r)>3600)throw new Error("KANE_SYNC_GIT_TRANSFER_TIMEOUT_SECONDS must be 60 to 3600");return Number(r)*1e3}return 9e5}function Ne(n){if(n.some(t=>/^(--force(?:-with-lease|-if-includes)?(?:=|$)|--mirror(?:=|$)|--delete(?:=|$)|-f$)/.test(t)))throw new Error("Git location cannot force, mirror or delete");let e=n.indexOf("push");if(e>=0){let t=n.slice(e+1);if(t.length!==3||t[0]!=="--porcelain"||!/^[0-9a-f]{40,64}:refs\/(heads|kane\/probe)\/[A-Za-z0-9._/-]+$/.test(t[2]))throw new Error("Git location requires an exact commit SHA and explicit ref")}}var H=async(n,e={})=>{Ne(n);let t={...process.env,...e.env};for(let h of["GIT_DIR","GIT_WORK_TREE","GIT_INDEX_FILE","GIT_OBJECT_DIRECTORY","GIT_ALTERNATE_OBJECT_DIRECTORIES","GIT_CONFIG_PARAMETERS"])delete t[h];e.env?.GIT_INDEX_FILE&&(t.GIT_INDEX_FILE=e.env.GIT_INDEX_FILE);let r=[["core.autocrlf","false"],["core.eol","lf"],["core.symlinks","false"],["core.hooksPath","/dev/null"],["gc.autoDetach","false"],["gc.pruneExpire","3.days.ago"],["maintenance.auto","false"],["push.followTags","false"],["push.gpgSign","false"],["commit.gpgSign","false"]],i=t.KANE_SYNC_GIT_HTTP_POST_BUFFER;if(i!==void 0){if(!/^\d+$/.test(i)||Number(i)<1048576||Number(i)>536870912)throw new Error("KANE_SYNC_GIT_HTTP_POST_BUFFER must be 1048576 to 536870912 bytes; use it only for a proxy that rejects chunked uploads");r.push(["http.postBuffer",i])}for(let h of Object.keys(t))h.startsWith("GIT_TRACE")&&delete t[h];let s=n.find(h=>h.startsWith("https://"));if(t.KANE_SYNC_GIT_TOKEN&&s){let h=new URL(s);r.push([`http.${h.origin}${h.pathname}.extraheader`,""],[`http.${h.origin}${h.pathname}.extraheader`,`AUTHORIZATION: basic ${Buffer.from(`x-access-token:${t.KANE_SYNC_GIT_TOKEN}`).toString("base64")}`],["credential.helper",""])}for(let h of Object.keys(t))/^GIT_CONFIG_(COUNT|KEY_\d+|VALUE_\d+)$/.test(h)&&delete t[h];let a=!t.GIT_SSH_COMMAND&&!t.GIT_SSH&&n.some(h=>ne.has(h))&&n.some(h=>_e.test(h))?await Ae({...t},e.cwd):void 0;r.forEach(([h,u],g)=>{t[`GIT_CONFIG_KEY_${g}`]=h,t[`GIT_CONFIG_VALUE_${g}`]=u}),t.GIT_CONFIG_COUNT=String(r.length),t.GIT_TERMINAL_PROMPT="0",t.GCM_INTERACTIVE="never",t.GIT_ASKPASS="",t.SSH_ASKPASS="";let c=be(t,a);return c!==void 0&&(t.GIT_SSH_COMMAND=c),t.GIT_NO_REPLACE_OBJECTS="1",se(n,t,e.cwd,Ce(n,t,e.timeout),e.input)};function se(n,e,t,r,i){return new Promise((s,o)=>{let a=te("git",n,{cwd:t,env:e,windowsHide:!0,detached:process.platform!=="win32",stdio:["pipe","pipe","pipe"]}),c=[],h=0,u="",g=!1,w=()=>{if(process.platform==="win32"&&a.pid)te("taskkill",["/pid",String(a.pid),"/t","/f"],{windowsHide:!0,stdio:"ignore"}).on("error",()=>a.kill("SIGKILL"));else try{a.pid&&process.kill(-a.pid,"SIGKILL")}catch{a.kill("SIGKILL")}},S=setTimeout(()=>{g=!0,w()},r);a.stdout.on("data",l=>{h+=l.length,h>128*1024*1024?w():c.push(l)}),a.stderr.on("data",l=>{u.length<64e3&&(u+=l.toString())}),a.stdin.on("error",()=>{}),a.on("error",l=>{clearTimeout(S),o(new d("SYNC_GIT_REQUIRED",`Git could not start: ${N(l.message,e)}`,"Install Git 2.31 or newer, then run the command again: https://git-scm.com/downloads"))}),a.on("close",l=>{clearTimeout(S),s({code:g||h>128*1024*1024?124:l??1,stdout:Buffer.concat(c),stderr:N(g?"Git operation timed out":u,e)})}),a.stdin.end(i)})}async function oe(n=H){let e=await n(["--version"],{timeout:1e4}),t=/git version (\d+)\.(\d+)/.exec(e.stdout.toString());if(e.code||!t||+t[1]<2||+t[1]==2&&+t[2]<31)throw new d("SYNC_GIT_REQUIRED","This location needs Git 2.31 or newer.","Install or update Git, then run setup again: https://git-scm.com/downloads")}function ae(n){let e=/^([^/@:]+)@([^/:]+):/.exec(n);if(e)return{user:e[1],host:e[2]};try{let t=new URL(n);return{host:t.hostname||"the server",user:t.username||"git",port:t.port||void 0}}catch{return{host:"the server",user:"git"}}}function gt(n){let e=/^[^/@:]+@([^/:]+):/.exec(n);if(e)return e[1].toLowerCase();try{return new URL(n).hostname.toLowerCase()}catch{return""}}function Y(n,e){let{host:t,user:r,port:i}=ae(e),s=N(n).trim().split(`
|
|
3
3
|
`).slice(-2).join(" ").trim();return/Host key verification failed|REMOTE HOST IDENTIFICATION HAS CHANGED/i.test(n)?{code:"SYNC_LOCATION_DENIED",message:`this computer has not accepted ${t}'s SSH host key yet`,remedy:`in a terminal run: ssh -T ${i?`-p ${i} `:""}${r}@${t} and answer yes, then run the command again`,diagnostic:s}:/Permission denied \(publickey/i.test(n)?{code:"SYNC_LOCATION_DENIED",message:`${t} did not accept your SSH key`,remedy:"load it with ssh-add, or ask the repository owner to grant your account access",diagnostic:s}:/could not read Username|Authentication failed|Access denied|Invalid username or (password|token)|returned error: 401|returned error: 403/i.test(n)?{code:"SYNC_LOCATION_DENIED",message:`sign in is needed, or your account has no access to this repository on ${t}`,remedy:"sign in through Git, or ask the owner to grant your account access",diagnostic:s}:/Could not resolve host|Connection refused|Connection timed out|timed out|Network is unreachable|Failed to connect/i.test(n)?{code:"SYNC_LOCATION_UNREACHABLE",message:`${t} could not be reached`,remedy:"check the address and your network, then run the command again",diagnostic:s}:/not found|does not appear to be a git repository|Repository not found/i.test(n)?{code:"SYNC_LOCATION_UNREACHABLE",message:"no repository answered at that address, or your account cannot see it; a private repository looks missing until access is granted",remedy:"check the address, then run the command again",diagnostic:s}:{code:"SYNC_LOCATION_UNREACHABLE",message:`git could not read the repository on ${t}`,remedy:"check the address and your access, then run the command again",...s?{diagnostic:s}:{}}}function M(n,e){return(n.startsWith(e)?n:n.charAt(0).toUpperCase()+n.slice(1))+"."}function yt(n,e){let t=Y(n,e),{host:r}=ae(e),i=t.remedy.replace(/,? ?(and )?then run the command again$/,"");return i?`${M(t.message,r)} ${M(i,r)}`:M(t.message,r)}var Oe=Buffer.from(`* -text -filter -ident -working-tree-encoding
|
|
4
4
|
`),Re="refs/kane/tip",Pe=/unexpected disconnect|hung up unexpectedly|Connection reset|Connection timed out|timed out|Could not resolve host|Failed to connect|RPC failed|Broken pipe|early EOF/i,$e={GIT_AUTHOR_NAME:"kane-cli context",GIT_AUTHOR_EMAIL:"context@kane-cli.invalid",GIT_COMMITTER_NAME:"kane-cli context",GIT_COMMITTER_EMAIL:"context@kane-cli.invalid"},G=class n{constructor(e){this.options=e;this.exec=e.exec??H,this.prefix=e.prefix?`${e.prefix}/`:"";let t=Ie("sha256").update(JSON.stringify([e.url,e.branch,this.prefix])).digest("hex");if(this.repo=_(e.cacheDir??_(A,"context-sync","mirrors"),`${t}.git`),this.ref=e.ref??`refs/heads/${e.branch}`,!/^refs\/(heads|kane\/probe)\/[A-Za-z0-9][A-Za-z0-9._/-]*$/.test(this.ref)||this.ref.includes(".."))throw new Error("Invalid Git location ref")}kind="git";contractVersion=1;ceilingTier=1;exec;repo;ref;prefix;ready;tip=null;tree=new Map;async run(e,t={}){let r=await this.exec(["--git-dir",this.repo,...e],t);if(r.code)throw new Error(`Git ${e[0]} failed: ${r.stderr||"unable to read the location"}`);return r.stdout}async transfer(e){let t=await this.exec(["--git-dir",this.repo,...e]);if(t.code){let r=Y(t.stderr||"",this.options.url);throw new d(r.code,r.message,r.remedy,r.diagnostic)}return t.stdout}get name(){return this.options.name??"<name>"}takenRemedy(e){return e===1?`${this.name} holds a different history: to work on it, clone it with kane-cli context clone <descriptor of ${this.name}> <dir>; to share this store, add an empty location`:`kane-cli context pull ${this.name} --rebase`}init(){return this.ready??=(async()=>{if(await oe(this.exec),xe(ce(this.repo),{recursive:!0}),!ve(this.repo)){let e=P(_(ce(this.repo),".init-"));try{let t=await this.exec(["init","--bare",e]);if(t.code)throw new Error(`Cannot open Git cache: ${t.stderr}`);try{ke(e,this.repo)}catch(r){if(!["EEXIST","ENOTEMPTY"].includes(r.code??""))throw r}}finally{$(e,{recursive:!0,force:!0})}}if((await this.run(["rev-parse","--is-bare-repository"])).toString().trim()!=="true")throw new Error("The Git cache must be a bare repository");await this.refresh()})()}async refresh(){let t=(await this.transfer(["ls-remote",this.options.url,this.ref])).toString().trim();if(!t){this.tip=null,this.tree=new Map;return}let r=t.split(/\s+/)[0];if(!/^[0-9a-f]{40,64}$/.test(r))throw new Error("Git returned an invalid ref");if(r===this.tip)return;let i=`refs/kane/snapshots/${F(16).toString("hex")}`;await this.transfer(["fetch","--no-tags","--no-write-fetch-head",this.options.url,`${this.ref}:${i}`]);let s=(await this.run(["rev-parse",i])).toString().trim();await this.run(["update-ref",Re,s]),await this.run(["update-ref","-d",i]);let o=await this.readTree(s);this.tip=s,this.tree=o}contextKeys(e){let t=new Map;for(let[r,i]of e)r.startsWith(`${this.prefix}kane-context/`)&&t.set(r,i);return t}async readTree(e){let t=await this.run(["ls-tree","-rz","--full-tree",e]),r=new Map;for(let i of t.toString().split("\0").filter(Boolean)){let s=/^(\d+) (\w+) ([0-9a-f]+)\t([\s\S]+)$/.exec(i);if(!s)throw new Error("Git returned an invalid tree entry");if(s[4].startsWith(`${this.prefix}kane-context/`)&&(s[1]!=="100644"||s[2]!=="blob"))throw new d("SYNC_OBJECT_CORRUPT","Context storage contains a link or non-file object.","Ask the repository owner to restore the original context files.");r.set(s[4],s[3])}return r}key(e){if(!/^[a-zA-Z0-9_~./-]+$/.test(e)||e.split("/").some(t=>!t||t==="."||t===".."||t.toLowerCase()===".git"))throw new Error("Invalid context storage key");return this.prefix+e}async head(e){return await this.init(),this.tree.has(this.key(e))}async get(e){await this.init();let t=this.tree.get(this.key(e));return t?this.run(["cat-file","blob",t]):null}async list(e){return await this.init(),e&&e.replace(/\/$/,"")&&this.key(e.replace(/\/$/,"")),[...this.tree.keys()].filter(t=>t.startsWith(this.prefix+e)).map(t=>t.slice(this.prefix.length)).sort()}async beginTransaction(){await this.init();let e=new Map(this.tree),t=this.tip,r=new Map,i=!1,s=()=>{if(i)throw new Error("Git transaction is closed")},o=async a=>{s();let c=this.key(a),h=r.get(c),u=e.get(c);return h?Buffer.from(h):u?this.run(["cat-file","blob",u]):null};return{get:o,head:async a=>await o(a)!==null,stageIfAbsent:async(a,c)=>{s();let h=this.key(a);if(e.has(h)||r.has(h))return"exists";if(c.length>1e8)throw new d("SYNC_LOCATION_REFUSED_WRITE","A context object is too large for this Git location.","Use an S3 location for this context.");return r.set(h,Buffer.from(c)),"staged"},abort:async()=>{i=!0,r.clear()},commit:async()=>{s();try{if(!r.size)return{created:[]};let a=this.prefix+"kane-context/.gitattributes";e.has(a)||r.set(a,Oe);let c=new Map;for(let[l,m]of r)c.set(l,(await this.run(["hash-object","-w","--no-filters","--stdin"],{input:m})).toString().trim());let h=this.contextKeys(e),u=()=>{this.assertUnchanged(h);for(let[l,m]of this.contextKeys(this.tree))h.set(l,m)},g=!1,w="",S=0;for(let l=0;l<4;l++){u();for(let f of this.tree.keys())if(!(!f.startsWith(this.prefix)||e.has(f)||c.has(f))&&B(f.slice(this.prefix.length))!==null)throw new d("SYNC_BEHIND","the location gained records after this batch was prepared; nothing was published","run kane-cli context pull, then push again");let m=new Map;for(let[f,T]of c){let C=this.tree.get(f);if(C&&C!==T){let R=B(f.slice(this.prefix.length));throw R?new d("SYNC_POSITION_TAKEN",g?`position ${R} on ${this.name} now holds different work; an earlier publication could not be confirmed`:`position ${R} on ${this.name} was published by another writer; this batch was not published`,this.takenRemedy(R)):new d("SYNC_OBJECT_CORRUPT",`existing context object ${f} differs from the intended bytes`,"the object needs a person to look; nothing was published")}C||m.set(f,T)}if(!m.size)return await this.verifyPublication(c),{created:[]};t=this.tip;let I=await this.build(t,m);await this.checkAttributes(I,[...r.keys()]),S++;let E=await this.exec(["--git-dir",this.repo,"push","--porcelain",this.options.url,`${I}:${this.ref}`]),y=N(E.stdout.toString()+`
|
|
5
5
|
`+E.stderr);w=y.trim();let O=E.code!==0&&/\[rejected\]|\[remote rejected\]/.test(y),p=E.code!==0&&(E.code===124||Pe.test(y));g||=p;try{await this.refresh()}catch{throw new d("SYNC_PUBLICATION_UNKNOWN","we could not confirm whether your context was uploaded; your local work is safe","check the connection and retry; kane-cli compares the published data before writing again")}if(u(),[...c].every(([f,T])=>this.tree.get(f)===T)){await this.verifyPublication(c);let f=E.code===0&&!E.stdout.toString().split(`
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{y as m}from"./chunk-
|
|
2
|
+
import{y as m}from"./chunk-SJZJ7ASF.js";import{a as x}from"./chunk-HCBYKLMW.js";import{a as u,b as a,j as g}from"./chunk-C44QQJR4.js";import{a as b}from"./chunk-6YGTRKDT.js";import{e as f}from"./chunk-UR6MHSHU.js";var T=f(b(),1);function k(i,n){if(!n)return i;let l=i.trim()||n;return`\x1B]8;;${n}\x07${l}\x1B]8;;\x07`}var r=f(x(),1);function $({shareableLink:i,testCaseLink:n,codeExportDir:l,recordedTestPath:s,outputDir:o,autoExit:p=!0}){let{exit:c}=g();(0,T.useEffect)(()=>{if(!p)return;let t=setTimeout(()=>c(),100);return()=>clearTimeout(t)},[c,p]);let e=[];return s&&e.push({label:"Test",url:s,linkUrl:`file://${s}`}),o&&e.push({label:"Output",url:o,linkUrl:`file://${o}`}),i&&e.push({label:"ShareLink",url:i}),n&&e.push({label:"TestCase",url:n}),l&&!o&&e.push({label:"CodeExport",url:l,linkUrl:`file://${l}`}),e.length===0?(0,r.jsx)(r.Fragment,{}):(0,r.jsx)(u,{flexDirection:"column",marginTop:1,marginLeft:1,children:e.map(t=>(0,r.jsxs)(u,{flexDirection:"column",marginBottom:1,children:[(0,r.jsxs)(a,{color:m.orange,children:[t.label,":"]}),(0,r.jsx)(a,{color:m.dim,children:k(t.url,t.linkUrl??t.url)})]},t.label))})}export{$ as a};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import{b as l}from"./chunk-SJZJ7ASF.js";import{existsSync as u,readdirSync as d,readFileSync as f}from"fs";import{join as o}from"path";var m="--variables",g=["global","smart","environment","secrets","totp"],p=/^[a-z][a-z0-9_]*$/;function x(r){return typeof r=="string"?r.trim().length>0:typeof r=="number"&&Number.isFinite(r)}function a(r,t,n){let e=JSON.parse(r);if(!(!e||typeof e!="object")){for(let[i,s]of Object.entries(e))if(s&&typeof s=="object"&&"value"in s){let b={has_value:x(s.value),source:t};n.set(y(i),b)}}}function c(r,t){if(!u(r))return;let n;try{n=d(r).filter(e=>e.endsWith(".json")).sort()}catch{return}for(let e of n){let i=o(r,e);try{a(f(i,"utf-8"),i,t)}catch{}}}function w(r){return{globalDir:o(l,"variables"),localDir:o(r,".testmuai","variables")}}function I(r){let t=new Map;if(c(r.globalDir,t),c(r.localDir,t),r.file&&u(r.file))try{a(f(r.file,"utf-8"),r.file,t)}catch{}if(r.inline)try{a(r.inline,m,t)}catch{}return t}function N(r){let t=r.trim();if(!t)return null;let n=t.split(/[.[]/).map(e=>e.trim()).filter(Boolean);return n.length===0||g.includes(n[0])?null:n[0]}function y(r){let t=/^(?:global|secrets\.user|environment)\.(.+)$/.exec(r);return t?t[1]:r}function V(r){if(!r||!r.trim())return"variable name is empty";let t=r.split(".")[0];return g.includes(t)?`'${r}' starts with a runtime namespace (global/secrets/smart/environment/totp) \u2014 declare the bare name`:p.test(r)?null:`'${r}' is not lower_snake_case (letters, digits, underscores; starts with a letter)`}export{m as a,w as b,I as c,N as d,y as e,V as f};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as h}from"./chunk-
|
|
2
|
+
import{a as h}from"./chunk-CE23VDW5.js";import{a as f}from"./chunk-HKIBJDKE.js";import{a as m}from"./chunk-MHMEEA4S.js";var i=class extends Error{constructor(a,l){super(a);this.code=l;this.name="AuthError"}};async function S(c){let{creds:o,env:a,usernameFlag:l,accessKeyFlag:g,log:t}=c,e=null,u=null;if(l&&g)e={username:l,access_key:g},t("info","AUTH_RESOLVE_FLAGS","Auth resolved via CLI flags",{username:l});else{let r=o.resolveAuth();r?.method==="basic"&&(e={username:r.username,access_key:r.access_key},t("info","AUTH_RESOLVE_CONFIG","Auth resolved via config",{username:r.username}))}if(!e){let{credentials:r,profile:E}=o.getActiveCredentials();if(!r)throw new i("Not authenticated \u2014 no credentials found","not_authenticated");if(u=r.access_token,r.expires_at-Date.now()/1e3<300)try{let n=await f({creds:o,profile:E,env:a,credentials:r});n&&(u=n.accessToken,t("info","AUTH_TOKEN_REFRESHED","OAuth token refreshed"))}catch(n){let d=n instanceof Error?n.message:String(n);throw t("error","TOKEN_REFRESH_FAILED","Token refresh failed",{error:d}),new i(`Token refresh failed: ${d}`,"refresh_failed")}}let v=m(a),b=async()=>u,y=e?{username:e.username,access_key:e.access_key}:null,p=new h(v.controllerBaseUrl,b,y,t),s=await p.resolve();return s&&!e&&(e={username:s.username,access_key:s.access_key},t("info","AUTH_RESOLVE_CONTROLLER","Auth resolved via controller",{username:s.username})),{basicAuth:e,token:u,resolver:p,resolvedCreds:s}}export{i as a,S as b};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as u,b as x}from"./chunk-
|
|
2
|
+
import{a as u,b as x}from"./chunk-DZCJE77P.js";import{y as m}from"./chunk-SJZJ7ASF.js";import{a as f}from"./chunk-HCBYKLMW.js";import{a as r,b as i}from"./chunk-C44QQJR4.js";import{e as n}from"./chunk-UR6MHSHU.js";var e=n(f(),1);function C({title:B,titleColor:c,borderColor:d,variant:p,rows:s,footer:t,labelWidth:l=14,marginBottom:b=1}){return(0,e.jsxs)(u,{title:B,titleColor:c,borderColor:d,variant:p,marginBottom:b,children:[s.map((o,a)=>typeof o.value=="string"?(0,e.jsx)(x,{label:o.label,value:o.value,valueColor:o.valueColor,labelWidth:l},`${o.label}-${a}`):(0,e.jsxs)(r,{children:[(0,e.jsx)(r,{width:l,children:(0,e.jsx)(i,{color:m.dim,children:o.label})}),o.value]},`${o.label}-${a}`)),t&&(0,e.jsx)(r,{marginTop:1,children:t})]})}export{C as a};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a}from"./chunk-5Y2G4NC7.js";import{y as o}from"./chunk-
|
|
2
|
+
import{a}from"./chunk-5Y2G4NC7.js";import{y as o}from"./chunk-SJZJ7ASF.js";import{a as n}from"./chunk-HCBYKLMW.js";import{b as t}from"./chunk-C44QQJR4.js";import{a as s}from"./chunk-6YGTRKDT.js";import{e as r}from"./chunk-UR6MHSHU.js";var l=r(s(),1);var m=r(n(),1),i=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"];function b({active:e=!0}){let[p,c]=(0,l.useState)(0);return a(()=>{c(f=>(f+1)%i.length)},e?80:null),(0,m.jsx)(t,{color:o.orange,children:e?i[p]:"\u25CF"})}export{b as a};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as A}from"./chunk-YCCUBQY4.js";import{a as _}from"./chunk-
|
|
2
|
+
import{a as A}from"./chunk-YCCUBQY4.js";import{a as _}from"./chunk-4VW3B7SE.js";import{a as B}from"./chunk-2KVECC36.js";import{a as R}from"./chunk-2OIIXLXW.js";import{a as k}from"./chunk-MHMEEA4S.js";import{y as c}from"./chunk-SJZJ7ASF.js";import{a as P}from"./chunk-HCBYKLMW.js";import{a as u,b as l}from"./chunk-C44QQJR4.js";import{a as J}from"./chunk-6YGTRKDT.js";import{e as L}from"./chunk-UR6MHSHU.js";var t=L(J(),1);var e=L(P(),1);function X(n,i,y,m){return{id:n,label:`${i} (${n}) \xB7 ${y} tests`,isActive:n===m}}function W({resolver:n,projectId:i,currentFolderId:y,env:m,onSelect:x,onCancel:w}){let[I,M]=(0,t.useState)([]),[$,d]=(0,t.useState)(!0),[O,g]=(0,t.useState)(!1),[U,N]=(0,t.useState)(null),[p,b]=(0,t.useState)("list"),[S,v]=(0,t.useState)(""),[E,f]=(0,t.useState)(null),h=(0,t.useRef)(!1);(0,t.useEffect)(()=>{if(!n){N("Login first to browse folders"),d(!1);return}let o=new AbortController;return d(!0),g(!0),(async()=>{try{let r=n.cached??await n.resolve();if(!r){N("Login first to browse folders"),d(!1),g(!1);return}let a=k(m),T=new B(a.tmsBaseUrl,r.username,r.access_key),F=(async function*(){if(o.signal.aborted)return;let s=await T.listFolders(i);yield{page:1,folders:s,totalLoaded:s.length,done:!0}})();for await(let s of F){if(d(!1),s.totalLoaded===0){h.current=!0,b("naming"),g(!1);return}M(s.folders.map(C=>X(C.id,C.name,C.test_cases_count,y))),s.done&&g(!1)}}catch(r){if(r?.name==="AbortError")return;N(r instanceof Error?r.message:String(r)),d(!1),g(!1)}})(),()=>o.abort()},[n,i,y,m]);let D=(0,t.useCallback)(o=>{let r=o.trim();if(!r){f("Name cannot be empty");return}if(!i){f("No project selected \u2014 pick a project first");return}f(null),b("creating"),(async()=>{try{if(!n)throw new Error("Not authenticated");let a=n.cached??await n.resolve();if(!a)throw new Error("Not authenticated");let T=k(m),s=await new B(T.tmsBaseUrl,a.username,a.access_key).createFolder(i,r);x(s.id,s.name)}catch(a){f(a instanceof Error?a.message:String(a)),b("naming")}})()},[n,i,m,x]),H=(0,t.useCallback)(()=>{v(""),f(null),h.current?w():b("list")},[w]);return p==="naming"||p==="creating"?(0,e.jsxs)(u,{flexDirection:"column",borderStyle:"round",borderColor:c.orange,paddingX:2,paddingY:1,children:[(0,e.jsx)(l,{color:c.orange,bold:!0,children:"Create new folder"}),h.current&&(0,e.jsx)(u,{marginTop:1,children:(0,e.jsx)(l,{color:c.dim,children:"No folders yet \u2014 let's create one."})}),(0,e.jsxs)(u,{marginTop:1,children:[(0,e.jsx)(l,{color:c.dim,children:"Name: "}),p==="naming"?(0,e.jsx)(A,{value:S,onChange:o=>{v(o),E&&f(null)},onSubmit:D,onCancel:H}):(0,e.jsx)(l,{children:S})]}),E&&(0,e.jsx)(u,{marginTop:1,children:(0,e.jsx)(l,{color:c.red,children:E})}),p==="creating"&&(0,e.jsx)(u,{marginTop:1,children:(0,e.jsx)(l,{color:c.dim,children:"Creating..."})}),p==="naming"&&(0,e.jsx)(R,{bindings:[{keys:"\u21B5",label:"create"}],escBackLabel:h.current?"cancel":"back"})]}):(0,e.jsx)(_,{title:"Folders",items:I,loading:$,loadingMore:O,preserveSelectionById:!0,error:U,itemNoun:"folders",onTab:()=>{h.current=!1,b("naming")},extraHint:"tab to create new",onSelect:o=>{let r=o.label.split(" (")[0];x(o.id,r)},onCancel:w})}export{X as a,W as b};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a}from"./chunk-
|
|
2
|
+
import{a}from"./chunk-MHMEEA4S.js";import"./chunk-SJZJ7ASF.js";import"./chunk-UR6MHSHU.js";export{a as getEnvironment};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{b as O}from"./chunk-LDPLJFCV.js";import{P as g,Q as S,S as G}from"./chunk-
|
|
2
|
+
import{b as O}from"./chunk-LDPLJFCV.js";import{P as g,Q as S,S as G}from"./chunk-5D6YMG63.js";import"./chunk-MXI5P373.js";import"./chunk-T2ONUKTL.js";import"./chunk-66MOZKD2.js";import"./chunk-YLQHY4A7.js";import{e as w,f as $}from"./chunk-5GUD3CIH.js";import{d as x}from"./chunk-WESMQEPO.js";import{e as k}from"./chunk-EHN5HTUD.js";import"./chunk-RGRFL7XG.js";import"./chunk-VVOKM2VO.js";import{z as R}from"./chunk-IICT4VOU.js";import"./chunk-D6E6KRVX.js";import"./chunk-3UI5VTQS.js";import"./chunk-CH273NAE.js";import"./chunk-ODU2JSMA.js";import{b}from"./chunk-VZ7KXRXB.js";import"./chunk-5LJRZI7S.js";import"./chunk-BKM2LWU2.js";import"./chunk-RDHWNSDP.js";import"./chunk-FQNQVC5O.js";import"./chunk-XLSOQLVT.js";import"./chunk-UD7KKHPW.js";import"./chunk-YCCUBQY4.js";import"./chunk-RSSOJ3L2.js";import"./chunk-5EOX4MEY.js";import"./chunk-RZ4F3BHX.js";import"./chunk-EYOCNMUM.js";import"./chunk-SJZJ7ASF.js";import"./chunk-DFS4RMVP.js";import"./chunk-HCBYKLMW.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";import{basename as h}from"path";import{statSync as A}from"fs";function C(t,e){if(!t)return 1;let o=t.resolve(e);return!o||o.superseded?1:t.getNode(o.tip)?.content.risk==="high"?3:1}function D(t,e){return t.usecases.map(o=>{let s=o.acceptance_criteria??[],a=s.filter(n=>(n.covered_by??[]).length>0),l=s.filter(n=>n.execution==="passed"),i=s.filter(n=>n.execution==="failed"),u=s.filter(n=>n.execution==="blocked"),d=0,m=0;for(let n of s){let f=C(e,n.id);d+=f,n.execution==="passed"&&(m+=f)}let r=d===0?0:Math.round(100*m/d),p=a.length===0?"uncovered":s.length===l.length?"covered":u.length>0&&i.length===0?"blocked":"partial";return{id:o.id,title:o.title,status:p,pct:r,acs:{total:s.length,covered:a.length,passed:l.length,failed:i.length,blocked:u.length},stale:s.filter(n=>n.fresh==="stale").map(n=>n.id)}})}async function P(t){let e=await w(t);return e.length===0?null:e.map(o=>({p:o,m:A(o).mtimeMs})).sort((o,s)=>s.m-o.m)[0].p}var N={covered:"\u2714",partial:"\u25D0",uncovered:"\u2716",blocked:"\u23F8"};function _(t){let e=Math.round(t/10);return"\u2588".repeat(e)+"\u2591".repeat(10-e)}async function I(t,e=G(),o=process.cwd()){if(t.mode!==void 0&&t.mode!=="agent"&&t.mode!=="ci"&&t.mode!=="interactive")return g(e,`--mode must be interactive | agent | ci, got '${t.mode}'`),2;if(t.mode==="agent"||t.mode==="ci"){let{makeHeadlessIO:r,agentRefusal:p}=await import("./headless-io-75HUMWZB.js"),n=r("ndjson","cover",{stdout:c=>e.out(c.replace(/\n$/,"")),stderr:c=>(e.err??e.out)(c.replace(/\n$/,""))}),f=[],v=[],j={out:c=>f.push(c),err:c=>v.push(c),confirm:async()=>!1,isTTY:!1};if(await I({...t,json:!0,mode:void 0},j,o)!==0)return p(n,v.join("; ")||"cover refused");let y=JSON.parse(f.join(`
|
|
3
3
|
`));return n.event({type:"coverage",...y}),n.done(0,void 0,M(y.completeness??[]))}let s=S(o,e);if(!s)return 2;let a=t.from?await $(t.from,o):await P(o);if(!a)return g(e,t.from?`no evidence pack at '${t.from}'`:"no evidence pack in .testmuai/evidence \u2014 run a test first, or pass --from <pack>"),2;let l=await k(a,"coverage/usecases.yaml");if(l==null)return g(e,`${h(a)} carries no coverage/usecases.yaml \u2014 the pack predates coverage or its project had no .context at seal time`),2;let i=b(l);if(!i||!Array.isArray(i.usecases))return g(e,`${h(a)}: coverage/usecases.yaml is not a usecases document`),2;let u=R(s),d=D(i,u),m=await x(u,"design");if(t.json)return e.out(JSON.stringify({pack:a,depth:d,completeness:m},null,2)),0;e.out(`coverage \u2014 ${h(a)}`),e.out(""),e.out("depth (proven by the pack):");for(let r of d){let p=r.stale.length?` \xB7 ${r.stale.length} stale`:"";e.out(` ${N[r.status]} ${_(r.pct)} ${String(r.pct).padStart(3)}% ${r.id} \u2014 ${r.status} (${r.acs.passed}/${r.acs.total} ACs proven${r.acs.failed?`, ${r.acs.failed} failed`:""}${r.acs.blocked?`, ${r.acs.blocked} blocked`:""})${p}`)}e.out(""),e.out("completeness (live graph):"),m.length===0&&e.out(" no design gaps \u2014 every AC verified, every use-case scenarioed");for(let r of m)e.out(` [${r.risk}] ${r.tag} ${r.ref} \u2014 ${r.why}`),e.out(` \u2192 ${r.ready_command}`);return 0}function M(t){return t.filter(e=>e.ready_command.startsWith("kane-cli ")&&O(e.ready_command)).slice(0,4).map(e=>({cmd:e.ready_command,why:e.why}))}export{I as coverCommand,M as coverNext,D as depthRows};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a}from"./chunk-
|
|
2
|
+
import{a}from"./chunk-OT3VKXJX.js";import"./chunk-SJZJ7ASF.js";import"./chunk-UR6MHSHU.js";export{a as CredentialsManager};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a,b,c,d,e,f,g,h,i,j}from"./chunk-
|
|
2
|
+
import{a,b,c,d,e,f,g,h,i,j}from"./chunk-JHYWNWS5.js";import"./chunk-MSGW4JDG.js";import"./chunk-4JOD47QI.js";import"./chunk-SJZJ7ASF.js";import"./chunk-UR6MHSHU.js";export{a as DEPS_INSTALL_SCHEMA_VERSION,i as DepsBundleResolver,c as DepsInstallRequiredError,h as NoPublishedBundleError,b as classOfTarget,g as downloadPayload,e as formatEta,d as formatRate,j as managedDeps,f as planRangeParts};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import"./chunk-UR6MHSHU.js";var c="Mobile dependencies are resolved through your KaneAI account. Run `kane-cli login` first.";function d(l,o,e=process.env){return e.KANE_MOBILE_DEPS_BASE_URL||o(l)}async function u(){let[{CredentialsManager:l},{refreshOAuthToken:o},{getEnvironment:e},{ControllerClient:n}]=await Promise.all([import("./credentials-
|
|
2
|
+
import"./chunk-UR6MHSHU.js";var c="Mobile dependencies are resolved through your KaneAI account. Run `kane-cli login` first.";function d(l,o,e=process.env){return e.KANE_MOBILE_DEPS_BASE_URL||o(l)}async function u(){let[{CredentialsManager:l},{refreshOAuthToken:o},{getEnvironment:e},{ControllerClient:n}]=await Promise.all([import("./credentials-FH6VZPJS.js"),import("./token-refresh-AOCGYGEC.js"),import("./config-HVSKN6L4.js"),import("./controller-client-ZF5IXRUV.js")]),s=new l;return{creds:s,refresh:r=>o({creds:s,profile:r.profile,env:r.env,credentials:r.credentials}),controllerBaseUrlFor:r=>d(r,t=>e(t).controllerBaseUrl),makeClient:(r,t)=>new n(r,t)}}function p(l){return async o=>{let e=l??await u(),n=e.creds.getActiveProfile();if(!n)throw new Error(c);let s=e.creds.getDefaultEnv(),r=e.controllerBaseUrlFor(s),t=e.creds.loadBasicAuth(n,s);if(t)return e.makeClient(r,{username:t.username,accessKey:t.access_key}).resolveMobileDepsBundle(o);let i=e.creds.loadCredentials(n,s);if(!i)throw new Error(c);try{await e.refresh({creds:e.creds,profile:n,env:s,credentials:i})}catch{}let a=(e.creds.loadCredentials(n,s)??i).access_token;if(typeof a!="string"||!a)throw new Error(c);return e.makeClient(r,a).resolveMobileDepsBundle(o)}}export{p as controllerResolveBundle,d as depsControllerBaseUrl};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a,b,c}from"./chunk-
|
|
2
|
+
import{a,b,c}from"./chunk-PUFZTE6L.js";import"./chunk-JPOFRYTX.js";import"./chunk-TAOHYWEO.js";import"./chunk-RZ4F3BHX.js";import"./chunk-SJZJ7ASF.js";import"./chunk-UR6MHSHU.js";export{b as deviceSlug,a as evidenceAppName,c as readFirstStepPixelWindow};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a,b,c,d}from"./chunk-
|
|
2
|
+
import{a,b,c,d}from"./chunk-T6MGCP57.js";import"./chunk-YKTYVJBN.js";import"./chunk-7N6OCHPC.js";import"./chunk-KDNNMU7Q.js";import"./chunk-2UIHS2FH.js";import"./chunk-Q2F5QB2W.js";import"./chunk-N2P4MI32.js";import"./chunk-VVOKM2VO.js";import"./chunk-IICT4VOU.js";import"./chunk-D6E6KRVX.js";import"./chunk-3UI5VTQS.js";import"./chunk-RDHWNSDP.js";import"./chunk-FQNQVC5O.js";import"./chunk-XLSOQLVT.js";import"./chunk-UD7KKHPW.js";import"./chunk-SJZJ7ASF.js";import"./chunk-UR6MHSHU.js";export{b as REMOTE_PROVIDERS,d as findProvider,a as landingReceipt,c as looksLikeUrl};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a,b,c,d}from"./chunk-
|
|
2
|
+
import{a,b,c,d}from"./chunk-SREUA7YQ.js";import"./chunk-5BHB5D2C.js";import"./chunk-MMBBQ4OZ.js";import"./chunk-JHYWNWS5.js";import"./chunk-MSGW4JDG.js";import"./chunk-TZXXJWHA.js";import"./chunk-Z7S3IWUX.js";import"./chunk-4JOD47QI.js";import"./chunk-RZ4F3BHX.js";import"./chunk-SJZJ7ASF.js";import"./chunk-UR6MHSHU.js";export{d as doctorExitCode,c as doctorPreflightBlocked,b as renderDoctorText,a as runDoctor};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{A as K,B as L,C as M,D as N,E as O,F as P,G as Q,I as R,J as S,K as T,L as U,M as _,O as $,P as aa,Q as ba,R as ca,T as da,U as ea,V as fa,W as ga,X as ha,Y as ia,Z as ja,a as c,b as d,c as e,d as f,e as g,f as h,h as i,i as j,j as t,k as u,l as v,m as w,n as x,o as y,p as z,q as A,r as B,s as C,t as D,u as E,v as F,w as G,x as H,y as I,z as J}from"./chunk-
|
|
2
|
+
import{A as K,B as L,C as M,D as N,E as O,F as P,G as Q,I as R,J as S,K as T,L as U,M as _,O as $,P as aa,Q as ba,R as ca,T as da,U as ea,V as fa,W as ga,X as ha,Y as ia,Z as ja,a as c,b as d,c as e,d as f,e as g,f as h,h as i,i as j,j as t,k as u,l as v,m as w,n as x,o as y,p as z,q as A,r as B,s as C,t as D,u as E,v as F,w as G,x as H,y as I,z as J}from"./chunk-WHNF5SWS.js";import"./chunk-AACQE24F.js";import{a as V,b as W,c as X,d as Y,e as Z}from"./chunk-5TQIKRKP.js";import{a as n,b as o,c as p,e as q,f as r,g as s}from"./chunk-5GUD3CIH.js";import"./chunk-WJR2FU7S.js";import"./chunk-WESMQEPO.js";import{a as k,b as l,c as m}from"./chunk-EHN5HTUD.js";import"./chunk-RGRFL7XG.js";import"./chunk-VVOKM2VO.js";import{a,f as b}from"./chunk-YFQGOOF7.js";import"./chunk-BL5QHONU.js";import"./chunk-IICT4VOU.js";import"./chunk-D6E6KRVX.js";import"./chunk-3UI5VTQS.js";import"./chunk-CH273NAE.js";import"./chunk-ODU2JSMA.js";import"./chunk-VZ7KXRXB.js";import"./chunk-PUFZTE6L.js";import"./chunk-RDHWNSDP.js";import"./chunk-FQNQVC5O.js";import"./chunk-XLSOQLVT.js";import"./chunk-UD7KKHPW.js";import"./chunk-RUSRN7YE.js";import"./chunk-MMBBQ4OZ.js";import"./chunk-JHYWNWS5.js";import"./chunk-MSGW4JDG.js";import"./chunk-JPOFRYTX.js";import"./chunk-TAOHYWEO.js";import"./chunk-4JOD47QI.js";import"./chunk-MHMEEA4S.js";import"./chunk-RZ4F3BHX.js";import"./chunk-EYOCNMUM.js";import"./chunk-SJZJ7ASF.js";import"./chunk-UR6MHSHU.js";export{P as EvidenceSession,C as appendExecutionPointer,M as assembleExecutionEnv,b as buildEnvironment,j as buildEvidenceRunConfig,i as buildExternalId,z as buildLogsMetaYaml,y as buildResultYaml,t as buildRunYaml,O as createCdpBrowserCapture,u as createRunningPack,v as createRunningPackRoot,H as declareLogsFromDir,J as diagnostics,x as discardPack,ba as ensureAuteurExecution,N as fetchCdpBrowserString,L as finalizeEvidencePack,U as finalizeInlineEvidence,K as finalizeMemberTestLogs,ea as flattenAuteurLeafIds,da as flattenAuteurLeaves,T as inlineEvidenceBlock,q as listPacks,p as newExecutionId,a as normalizeOs,S as noteInlineSpawn,$ as offerEvidenceView,o as packPath,I as packTestLogsDir,V as parseRange,D as readExecutionPointers,ja as readPackLeafIds,ia as readPackLeaves,s as recoverStore,ga as remapReplayActionIds,r as resolvePack,ha as resolveReplayResultSteps,F as rollupTestStatus,aa as runEvidenceMerge,_ as runEvidenceServe,E as runEvidenceValidate,Q as runStartupRecovery,l as sealPack,w as sealPackById,Z as serveHint,f as shortHash,e as slugify,W as startEvidenceLocalServer,R as startInlineEvidence,n as storeDir,m as sweepStore,fa as synthesizeSkippedTail,h as testIdForInline,g as testIdForTestmd,k as validatePack,c as verdictFromResultCode,X as viewerBaseFor,Y as viewerUrlFor,d as worstOf,G as worstResultCode,ca as writeAuteurDataset,B as writeLogsMeta,A as writeResult};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a,b,c,d,e,f,g,h,i,j,k}from"./chunk-
|
|
2
|
+
import{a,b,c,d,e,f,g,h,i,j,k}from"./chunk-LKPOOZYN.js";import"./chunk-Q6AHSGOE.js";import"./chunk-LDPLJFCV.js";import"./chunk-UJZZDPDY.js";import"./chunk-5ZFOKYFB.js";import"./chunk-BZAGVBCX.js";import"./chunk-FY7TCYPK.js";import"./chunk-LSDWPG6C.js";import"./chunk-KDNNMU7Q.js";import"./chunk-5D6YMG63.js";import"./chunk-MXI5P373.js";import"./chunk-T2ONUKTL.js";import"./chunk-66MOZKD2.js";import"./chunk-YLQHY4A7.js";import"./chunk-RGRFL7XG.js";import"./chunk-VVOKM2VO.js";import"./chunk-IICT4VOU.js";import"./chunk-D6E6KRVX.js";import"./chunk-3UI5VTQS.js";import"./chunk-CH273NAE.js";import"./chunk-ODU2JSMA.js";import"./chunk-VZ7KXRXB.js";import"./chunk-5LJRZI7S.js";import"./chunk-BKM2LWU2.js";import"./chunk-RDHWNSDP.js";import"./chunk-FQNQVC5O.js";import"./chunk-XLSOQLVT.js";import"./chunk-UD7KKHPW.js";import"./chunk-YCCUBQY4.js";import"./chunk-RSSOJ3L2.js";import"./chunk-5EOX4MEY.js";import"./chunk-RZ4F3BHX.js";import"./chunk-EYOCNMUM.js";import"./chunk-SJZJ7ASF.js";import"./chunk-DFS4RMVP.js";import"./chunk-HCBYKLMW.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";export{g as EVOLVE_SCOPE_ADVICE,h as composeEvolveStatement,b as designStateOf,k as evolveCommand,c as evolveOneUc,j as forwardChildLine,i as liveRunDesignForUc,f as namedEntityOf,a as resolveParentUc,e as runEvolveCommand,d as staleTargets};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a}from"./chunk-F2OBORCG.js";import{Q as i}from"./chunk-
|
|
2
|
+
import{a}from"./chunk-F2OBORCG.js";import{Q as i}from"./chunk-5D6YMG63.js";import"./chunk-MXI5P373.js";import"./chunk-T2ONUKTL.js";import"./chunk-66MOZKD2.js";import"./chunk-YLQHY4A7.js";import"./chunk-RGRFL7XG.js";import"./chunk-VVOKM2VO.js";import{z as n}from"./chunk-IICT4VOU.js";import"./chunk-D6E6KRVX.js";import"./chunk-3UI5VTQS.js";import"./chunk-CH273NAE.js";import"./chunk-ODU2JSMA.js";import"./chunk-VZ7KXRXB.js";import"./chunk-5LJRZI7S.js";import"./chunk-BKM2LWU2.js";import"./chunk-RDHWNSDP.js";import"./chunk-FQNQVC5O.js";import"./chunk-XLSOQLVT.js";import"./chunk-UD7KKHPW.js";import"./chunk-YCCUBQY4.js";import"./chunk-RSSOJ3L2.js";import"./chunk-5EOX4MEY.js";import"./chunk-RZ4F3BHX.js";import"./chunk-EYOCNMUM.js";import"./chunk-SJZJ7ASF.js";import"./chunk-DFS4RMVP.js";import"./chunk-HCBYKLMW.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";async function f(s,p){let o=i(process.cwd(),{out:r=>process.stdout.write(r+`
|
|
3
3
|
`),err:r=>process.stderr.write(r+`
|
|
4
4
|
`),confirm:async()=>!1,isTTY:!!process.stdout.isTTY});if(!o)return 2;let c=n(o),t=a(o,c,s);if(p.json)return process.stdout.write(JSON.stringify(t)+`
|
|
5
5
|
`),t.target?0:1;if(!t.target)return process.stdout.write(`error: ${s} names nothing in the graph
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as $}from"./chunk-A2SQD2AY.js";import{f as se,g as U}from"./chunk-
|
|
2
|
+
import{a as $}from"./chunk-A2SQD2AY.js";import{f as se,g as U}from"./chunk-L35DJDX7.js";import"./chunk-ZMNJBUAO.js";import"./chunk-W5TTF7GB.js";import"./chunk-I7TIGB7K.js";import"./chunk-GF32QBCM.js";import"./chunk-4ZBI54KE.js";import"./chunk-D7WG7SRA.js";import"./chunk-WVHMPIDQ.js";import"./chunk-E2KV4BQB.js";import"./chunk-BB2W35TW.js";import"./chunk-AXTPNZPX.js";import"./chunk-U6OTFMIT.js";import"./chunk-BZAGVBCX.js";import"./chunk-V4B5QA3U.js";import"./chunk-T6MGCP57.js";import{c as L}from"./chunk-YKTYVJBN.js";import"./chunk-FY7TCYPK.js";import"./chunk-63DYVWNX.js";import"./chunk-427OQS2N.js";import{a as A}from"./chunk-SW54RAAT.js";import{a as ie}from"./chunk-LSDWPG6C.js";import"./chunk-7N6OCHPC.js";import"./chunk-KDNNMU7Q.js";import"./chunk-Q6F23V7L.js";import"./chunk-SEEEGDVK.js";import"./chunk-2UIHS2FH.js";import"./chunk-Q2F5QB2W.js";import"./chunk-BKHXPBWN.js";import"./chunk-N2P4MI32.js";import{e as W}from"./chunk-SVJBOVI4.js";import"./chunk-2G5CJQOR.js";import{T as ee,U as te,V as re,W as Y,X as ne}from"./chunk-5D6YMG63.js";import"./chunk-MXI5P373.js";import{c as O}from"./chunk-T2ONUKTL.js";import"./chunk-66MOZKD2.js";import"./chunk-YLQHY4A7.js";import"./chunk-RGRFL7XG.js";import"./chunk-VVOKM2VO.js";import"./chunk-IICT4VOU.js";import"./chunk-D6E6KRVX.js";import"./chunk-3UI5VTQS.js";import{a as C}from"./chunk-CH273NAE.js";import"./chunk-ODU2JSMA.js";import"./chunk-VZ7KXRXB.js";import{a as B,b as H}from"./chunk-VW3PFRCO.js";import"./chunk-ZLWURCJ7.js";import"./chunk-QSCXXNC2.js";import"./chunk-KBM3XHAM.js";import"./chunk-2YEHV2CX.js";import"./chunk-5LJRZI7S.js";import"./chunk-BKM2LWU2.js";import"./chunk-RDHWNSDP.js";import"./chunk-FQNQVC5O.js";import"./chunk-XLSOQLVT.js";import"./chunk-UD7KKHPW.js";import"./chunk-YCCUBQY4.js";import"./chunk-MSGW4JDG.js";import"./chunk-RSSOJ3L2.js";import"./chunk-5EOX4MEY.js";import"./chunk-RZ4F3BHX.js";import"./chunk-EYOCNMUM.js";import"./chunk-SJZJ7ASF.js";import"./chunk-DFS4RMVP.js";import"./chunk-HCBYKLMW.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";import{existsSync as oe}from"fs";async function he(n){let[{render:s},a,{QuestionBatchPrompt:m}]=await Promise.all([import("./build-JIKYOZUH.js"),import("./react-QWOAB3TB.js"),import("./ui-JEJGTURD.js")]),h=a.default??a;return new Promise(x=>{let v=s(h.createElement(m,{questions:n,onSubmit:t=>{v.unmount(),x(t)}}))})}async function we(n,s){let[{render:a},m,{ReviewChecklist:h}]=await Promise.all([import("./build-JIKYOZUH.js"),import("./react-QWOAB3TB.js"),import("./ui-JEJGTURD.js")]),x=m.default??m;return new Promise(v=>{let t=a(x.createElement(h,{items:n.map(f=>{let w=s.get(f.temp_ref);return{uc:f,dedupWith:w&&!w.archived?w.cid:void 0,archivedMatch:w?.archived?{cid:w.cid,reason:w.reason}:void 0}}),onSubmit:f=>{t.unmount(),v(f)}}))})}async function ye(n){let{createInterface:s}=await import("readline/promises"),a=s({input:process.stdin,output:process.stdout});try{let m=await a.question(`${n} [y/N] `);return/^y(es)?$/i.test(m.trim())}finally{a.close()}}async function Ae(n){let s=C(process.cwd()),a=H({verb:"extract",mode:n.plan?"cli":"interactive",contextRoot:s,env:B(),resumeSid:n.resume,write:!0,longSession:!0});await ee(s,r=>process.stderr.write(r+`
|
|
3
3
|
`));{let r=oe(s)?Y(s):null;if(r)return process.stderr.write(`error: ${r.text}
|
|
4
4
|
next: ${r.remedy}
|
|
5
5
|
`),await a.end({exit_code:2}),2}let h={...await W(),...a.spawnEnv()},x=await L(h);if(!x.ok)return process.stderr.write((x.message??"error: turn-endpoint preflight failed")+`
|
|
@@ -7,7 +7,7 @@ next: ${r.remedy}
|
|
|
7
7
|
`),a.error("preflight_auth"),await a.end({exit_code:2}),2;let v=async()=>x;if(n.plan){let r=await U(n,{contextDir:s,agent:A,preflightTurn:v,ask:he,review:we,confirmStale:ye,out:l=>process.stdout.write(l+`
|
|
8
8
|
`),progress:l=>process.stderr.write(l+`
|
|
9
9
|
`),isTTY:O(),auth:h,telemetry:a});return r===1&&process.stderr.write(a.supportFooter()+`
|
|
10
|
-
`),await a.end({exit_code:r}),r}let[{render:t},f,{ScrollbackProvider:w},{ChatSurface:z},{ScrollbackTap:u},{makeChatController:F},{setInkExit:Q},T]=await Promise.all([import("./build-JIKYOZUH.js"),import("./react-QWOAB3TB.js"),import("./scrollback-JLPJR25X.js"),import("./ChatSurface-
|
|
10
|
+
`),await a.end({exit_code:r}),r}let[{render:t},f,{ScrollbackProvider:w},{ChatSurface:z},{ScrollbackTap:u},{makeChatController:F},{setInkExit:Q},T]=await Promise.all([import("./build-JIKYOZUH.js"),import("./react-QWOAB3TB.js"),import("./scrollback-JLPJR25X.js"),import("./ChatSurface-PA73V3NT.js"),import("./ScrollbackTap-QHJOFYMC.js"),import("./chat-controller-UJQ6Z4RE.js"),import("./exit-manager-ZLDO54S4.js"),Promise.all([import("./chat-committer-6D7AQI6Z.js"),import("./descriptor-3JJUOHBM.js"),import("./explain-NEFBUX5G.js"),import("./readmodel-FVLRQWZ7.js")])]),[{commitChatTurn:J},{topologyDescriptor:j},{explain:e},{openGraph:i}]=T,S=f.default??f,o=F({commitChatTurn:J,descriptor:j(),contextDir:s,refreshGraph:()=>i(s),graph:i(s),explain:e,by:{kind:"human",id:"owner"},dedupFlags:r=>se(r,i(s))}),q={current:null},P=null,K=0,G=null,I=!1,ae=()=>{if(K+=1,K>=2){try{M.unmount()}catch{}$({state:"interrupted",reason:"ctrl+c \xD72",facts:["forced quit \u2014 anything already committed is safe in the store"]}),process.exit(130)}o.requestPause(),G=setTimeout(()=>{I||(I=!0,(async()=>{o.finalizeForExit(),await q.current?.flush();try{M.unmount()}catch{}$({state:"interrupted",facts:["the agent did not confirm the pause within 5s \u2014 nothing new was saved"]}),process.exit(130)})())},5e3)},ce=await import("./dossier-7HVC6BNK.js"),de=r=>{try{return ce.buildDossier(i(s),r)}catch{return null}},ue={listUcs:()=>{let r=i(s),l=new Set(o.state.turns.flatMap(c=>(c.items??[]).map(p=>p.title.toLowerCase()))),d={high:0,med:1,low:2};return r.byLabel("usecase").filter(c=>!r.superseded.has(c.cid)).map((c,p)=>{let k=c.content,b=String(k.title??c.cid.slice(0,12)),V=ie(r,c.cid),E=V?V.designed_at_cid===c.cid?"current":"stale":void 0;return{key:c.cid,title:b,badge:E==="current"?"designed":E==="stale"?"designed \xB7 stale":l.has(b.toLowerCase())?"drafted this session":"existing",designed:E,risk:k.risk,i:p}}).sort((c,p)=>(d[c.risk??"zz"]??3)-(d[p.risk??"zz"]??3)||c.i-p.i).map(({key:c,title:p,badge:k,designed:b})=>({key:c,title:p,badge:k,designed:b}))},runDesignChild:async(r,l=!1,d="design")=>{try{let{designEntryCheck:g,confirmUnreviewedViaAsk:_}=await import("./trust-gate-EX7R2P4Y.js"),y=g(i(s),r);if(!y.ok&&(y.code==="UC_UNREVIEWED"||y.code==="UC_ARCHIVED")&&!await _(D=>o.ask(D),y))return o.note(`design child refused \u2014 approve it first: ${y.reviewCmd}`),2}catch{}let[{runDesign:c}]=await Promise.all([import("./run-XJK3YOW2.js")]),p="",k=(()=>{try{let g=i(s),_=g.resolve(r);return(_?g.getNode(_.cid)?.content?.title:void 0)??r}catch{return r}})(),{collectSessionItems:b}=await import("./session-items-2ATN7VXG.js"),V=b(o.state.turns).entries.length,E=o.state.credits?.total,fe=Date.now();o.ledger({kind:"childOpen",verb:d,subject:k});let ge=g=>{let _=Math.max(1,Math.round((Date.now()-fe)/1e3)),y=b(o.state.turns).entries.length-V,R=o.state.credits?.total,D=R!==void 0&&E!==void 0?R-E:R;o.ledger(g===0?{kind:"childClose",verb:d,subject:k,ok:!0,durS:_,...y>0?{results:`${y} item${y===1?"":"s"}`}:{},...D!==void 0&&D>0?{credits:D}:{}}:{kind:"childClose",verb:d,subject:k,ok:!1,durS:_,exitCode:g,fixCmd:`kane-cli design tests --use-case ${r}${l||d==="evolve"?" --force":""}`});let Z=b(o.state.turns).entries.length;o.ledger({kind:"childBack",parentVerb:"extract",context:`${Z} draft${Z===1?"":"s"} saved`})},N=1;try{N=await c({useCase:r,force:l,mode:"interactive"},{contextDir:s,agent:A,preflightTurn:v,ask:g=>o.ask(g),chat:o,nested:!0,out:g=>{p=g},progress:()=>{},isTTY:!0,auth:h})}finally{ge(N)}return N!==0&&p&&o.note(p),N}},{makeReconcileDeps:le}=await import("./reconcile-deps-CYWH6GM4.js"),me=le({contextDir:s,...n.changeContext?{changeContext:n.changeContext}:{},note:r=>o.note(r)}),pe={verb:"extract",sid:n.resume??a.ids.session_id,env:B(),...n.source?{subject:n.source}:{}},M=t(S.createElement(w,null,S.createElement(u,{into:q}),S.createElement(z,{controller:o,verb:"extract",onCtrlC:ae,chain:ue,inspect:de,reconcile:me,meta:pe})),{exitOnCtrlC:!1});Q(()=>M.unmount());let X=null;try{let r=U(n,{contextDir:s,agent:A,preflightTurn:v,onSummary:d=>{P=d},ask:d=>o.ask(d),review:async d=>new Map(d.map(c=>[c.temp_ref,{resolution:"skipped"}])),confirmStale:async()=>!0,out:d=>o.note(d),progress:()=>{},isTTY:O(),auth:h,chat:o,telemetry:a});r.finally(()=>{I=!0});let l=await r;return X=l,l===1&&process.stderr.write(a.supportFooter()+`
|
|
11
11
|
`),await a.end({exit_code:l}),l}catch(r){throw P||(P={state:"crashed",facts:[`the session ended unexpectedly \u2014 ${r instanceof Error?r.name:"error"}`]}),r}finally{I=!0,G&&clearTimeout(G),o.finalizeForExit(),await q.current?.flush();try{M.unmount()}catch{}P?$(P):X===1&&$({state:"interrupted",facts:["the session ended without saving \u2014 see the error above"]})}}async function $e(n){let s=H({verb:"extract",mode:n.mode,contextRoot:C(process.cwd()),env:B(),resumeSid:n.resume,write:!0,longSession:!0}),{makeHeadlessIO:a,resolveEncoding:m,guardedChannels:h}=await import("./headless-io-75HUMWZB.js"),{withStructuredNext:x,prepareStructuredResume:v}=await import("./structured-answers-ZI2B6JJE.js"),t=x(a(m(n.mode),"extract")),f=await te(C(process.cwd()));f&&(m(n.mode)==="ndjson"?t.event(re(f)):t.progress(f.text));let{runWithChannel:w}=await import("./run-channel-RGH4WIQX.js"),z=m(n.mode)==="ndjson"?e=>w({event:i=>t.event(i)},e):e=>e();for(let e of n.landed??[]){let i=e;t.event({type:"ingested",source_id:e.source_id,status:e.status,cid:e.source_cid,...i.warnings?.length?{warnings:i.warnings}:{},...i.media?{media:i.media}:{},...i.duplicate_of?{duplicate_of:i.duplicate_of}:{},...i.lineage_candidate?{lineage_candidate:i.lineage_candidate}:{}})}{let e=oe(C(process.cwd()))?Y(C(process.cwd())):null;if(e)return m(n.mode)==="ndjson"?t.event(ne(e)):t.progress(`error: ${e.text}
|
|
12
12
|
next: ${e.remedy}`),await s.end({exit_code:2}),t.done(2,"refused")}let u;try{u=v({opts:n,contextDir:C(process.cwd()),verb:"extract"})}catch(e){let i=e instanceof Error?e.message:String(e);return t.out(`error: ${i}`),n.mode==="agent"&&t.event({type:"error",message:i}),await s.end({exit_code:1}),n.mode==="agent"?t.done(1,"error"):1}if(u.kind==="refuse")return t.out(u.error),n.mode==="agent"&&t.event({type:"error",message:u.error,code:u.code}),await s.end({exit_code:2}),n.mode==="agent"?t.done(2,"refused"):2;let F=n;if(u.kind==="apply"){for(let e of u.notes)t.out(e);if(u.matchedQids.length>0){t.out(`applying ${u.matchedQids.length} structured answer(s) from --answer to the paused session's pending questions`);for(let e of u.matchedQids)t.event({type:"panel_resolved",id:e,by:"user",via:"flag"})}u.statement&&(F={...n,message:[n.message,u.statement].filter(Boolean).join(`
|
|
13
13
|
|
|
@@ -2,4 +2,4 @@ import { createRequire } from 'module'; const require = createRequire(import.met
|
|
|
2
2
|
import{a as i}from"./chunk-CH273NAE.js";import"./chunk-UR6MHSHU.js";import{existsSync as u}from"fs";async function g(e){if(e.mode!=null&&!["interactive","agent","ci","override"].includes(e.mode)){let{makeHeadlessIO:t,agentRefusal:r}=await import("./headless-io-75HUMWZB.js");return r(t("ndjson","extract"),`extract: --mode must be interactive | agent | ci | override, got '${e.mode}'`,"MODE_USAGE")}let n=async(t,r)=>{if(e.mode!=="agent")return process.stderr.write(t+`
|
|
3
3
|
`),2;let{makeHeadlessIO:o,agentRefusal:c}=await import("./headless-io-75HUMWZB.js");return c(o("ndjson","extract"),t,r)};if(e.apply)return n("extract: --apply is not implemented yet \u2014 coming with the plan\u2192apply workflow (run without --apply, or use --plan to preview)");{let{validateResumeMessage:t}=await import("./headless-io-75HUMWZB.js"),r=t(e,"extract");if(r)return n(r)}{let{gateStructuredFlags:t}=await import("./structured-answers-ZI2B6JJE.js"),r=t(e,"extract");if(r)return n(r,"STRUCTURED_FLAGS_USAGE")}if(e.withSource&&!e.resume)return n("extract: --with-source pairs with --resume \u2014 it lands the source and sets the resumed session's pending questions aside");if(e.queued)return n("extract: --queued is gone \u2014 extract sweeps every pending source by default (just run kane-cli context extract)");if(!u(i(process.cwd())))return n("error: no context store here (run `kane-cli context ingest <files>` first)","NO_STORE");if(!e.mode&&!process.stdin.isTTY)return process.stderr.write(`extract: no TTY \u2014 pass an explicit --mode agent|ci|override to run headless
|
|
4
4
|
`),2;let s=e.mode??"interactive";if(s==="interactive"){if(!process.stdin.isTTY||!process.stdout.isTTY)return process.stderr.write(`extract: --mode interactive needs a TTY on stdin and stdout (use --mode agent|ci|override headless)
|
|
5
|
-
`),2;let{bindExtractInteractive:t}=await import("./extract-bind-
|
|
5
|
+
`),2;let{bindExtractInteractive:t}=await import("./extract-bind-T7GKUEJ6.js");return t(e)}let{bindExtractHeadless:a}=await import("./extract-bind-T7GKUEJ6.js");return a({...e,mode:s})}export{g as extractCommand};
|