@testmuai/kane-cli 0.7.0 → 0.7.1
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-D66CACLX.js +8 -0
- package/dist/{ChromeProfilePicker-DK2A3NYY.js → ChromeProfilePicker-4CDSPBWL.js} +1 -1
- package/dist/{CliFeedbackPrompt-D5QDOBE2.js → CliFeedbackPrompt-TLRVBA4E.js} +1 -1
- package/dist/{CliUploadProgress-AIZL7N6Z.js → CliUploadProgress-WGGFLUSF.js} +1 -1
- package/dist/{ConfigView-SDBCTYUU.js → ConfigView-DBANTBXC.js} +1 -1
- package/dist/EvidenceViewOffer-DNCQ3A6R.js +2 -0
- package/dist/{FolderPicker-IVBHPPMW.js → FolderPicker-W7RCIFEL.js} +1 -1
- package/dist/{HelpView-YYYX4RKI.js → HelpView-FBCX32U7.js} +1 -1
- package/dist/{InfoBox-MQV3XBT4.js → InfoBox-KK2ICVS4.js} +1 -1
- package/dist/{LinksBox-NCFNBUMW.js → LinksBox-KKRANMR3.js} +1 -1
- package/dist/{ProfilesView-6GXF6CP2.js → ProfilesView-DGPXSAQN.js} +1 -1
- package/dist/{ProjectPicker-W6XDGNDJ.js → ProjectPicker-ESQSL4TT.js} +1 -1
- package/dist/{SaveSessionPrompt-QF3P7ERS.js → SaveSessionPrompt-AQGP5W6E.js} +1 -1
- package/dist/SingleShotApp-SMCAIKCE.js +2 -0
- package/dist/{SummaryBox-4SZI4XSO.js → SummaryBox-BFZJW2KK.js} +1 -1
- package/dist/TestMdRunView-FMKZJ3A3.js +2 -0
- package/dist/{WhoamiView-N3HAJ3TN.js → WhoamiView-JABY3I5Q.js} +1 -1
- package/dist/{auth-RXNBQZI2.js → auth-76LVI6B5.js} +1 -1
- package/dist/bind-AACBTSAA.js +12 -0
- package/dist/bootstrap-CNOZ5VRB.js +2 -0
- package/dist/bridge-T4HL4TG7.js +2 -0
- package/dist/{changelog-MI3IPBJS.js → changelog-PSWPPOAF.js} +1 -1
- package/dist/chat-committer-4BQBOKI4.js +2 -0
- package/dist/chat-controller-NNTMKEPG.js +2 -0
- package/dist/{chunk-GQ3NCBYR.js → chunk-2KBD6JZX.js} +1 -1
- package/dist/chunk-2SREGETM.js +4 -0
- package/dist/chunk-2XGDWUJ5.js +2 -0
- package/dist/{chunk-DFDDUMG5.js → chunk-322JEJEH.js} +1 -1
- package/dist/{chunk-4BAMZSFU.js → chunk-323MLBYA.js} +1 -1
- package/dist/{chunk-VYMCE7UR.js → chunk-33QXD75Y.js} +2 -2
- package/dist/{chunk-K7USHLVZ.js → chunk-36OC3TFE.js} +1 -1
- package/dist/{chunk-4SJC64KQ.js → chunk-3FN5VJMV.js} +1 -1
- package/dist/chunk-3LWTUMDG.js +2 -0
- package/dist/chunk-3STZLM5J.js +4 -0
- package/dist/{chunk-4GLYNAK7.js → chunk-4OPQJ7PE.js} +1 -1
- package/dist/chunk-5JTUL6XL.js +2 -0
- package/dist/{chunk-FMR2KPSK.js → chunk-5KFS3GAZ.js} +1 -1
- package/dist/{chunk-EN7NW7DU.js → chunk-6HEGD6H2.js} +1 -1
- package/dist/{chunk-AV6E6WLY.js → chunk-6UJDOAYR.js} +2 -2
- package/dist/{chunk-5WE4DHXL.js → chunk-73C4PRYU.js} +1 -1
- package/dist/chunk-AAONIIQV.js +6 -0
- package/dist/chunk-AH7ZZIZY.js +2 -0
- package/dist/chunk-AM5S4KG4.js +6 -0
- package/dist/{chunk-J3EMJ7US.js → chunk-APAIWBIH.js} +1 -1
- package/dist/{chunk-XIXR63FI.js → chunk-BAL64WSI.js} +1 -1
- package/dist/chunk-BB2W35TW.js +2 -0
- package/dist/chunk-BQHKBOSF.js +11 -0
- package/dist/{chunk-B4LLKQTK.js → chunk-C4G7RVJ6.js} +1 -1
- package/dist/{chunk-YHQFYZJ5.js → chunk-CDQX6HGJ.js} +1 -1
- package/dist/{chunk-XLKRV2JH.js → chunk-CSQ46PJ7.js} +1 -1
- package/dist/chunk-DQ54MH7F.js +13 -0
- package/dist/{chunk-T7ZPMTGS.js → chunk-DXV6MBTD.js} +1 -1
- package/dist/chunk-DYW5C6II.js +2 -0
- package/dist/{chunk-WREVEATJ.js → chunk-F6ZOJXYU.js} +1 -1
- package/dist/chunk-GVIPTX6T.js +6 -0
- package/dist/chunk-GW5DWAXY.js +2 -0
- package/dist/chunk-HJERKSBK.js +349 -0
- package/dist/{chunk-AYY7RYMK.js → chunk-HPMS5KO6.js} +2 -2
- package/dist/{chunk-3RZ63RBO.js → chunk-IBNC444G.js} +1 -1
- package/dist/{chunk-WTXHOWUP.js → chunk-IQDWBTRJ.js} +1 -1
- package/dist/{chunk-5YHVK2EO.js → chunk-IXVOXJP6.js} +1 -1
- package/dist/{chunk-IQODWB32.js → chunk-JEUA4UWK.js} +1 -1
- package/dist/{chunk-CH3VWCRZ.js → chunk-JKTFTF24.js} +1 -1
- package/dist/{chunk-A2IQRVPR.js → chunk-JRMDGLLT.js} +1 -1
- package/dist/{chunk-RQYS3KGU.js → chunk-KNDSQ4PS.js} +1 -1
- package/dist/chunk-KRXSXQBU.js +12 -0
- package/dist/{chunk-NR23HZU4.js → chunk-KT6G7AF2.js} +1 -1
- package/dist/chunk-KVQOBPAZ.js +2 -0
- package/dist/chunk-L2TV4G56.js +4 -0
- package/dist/{chunk-6HYW5RFX.js → chunk-L4JIMNKW.js} +1 -1
- package/dist/{chunk-X5P2T7MA.js → chunk-L7VREJTG.js} +1 -1
- package/dist/{chunk-QQUZF2DZ.js → chunk-LQZ2BU7Q.js} +1 -1
- package/dist/{chunk-MTHCUBDF.js → chunk-LR5XO2KD.js} +1 -1
- package/dist/chunk-M7WQM4UA.js +4 -0
- package/dist/{chunk-KHQHVSZ6.js → chunk-NAC7SFBE.js} +1 -1
- package/dist/{chunk-CSGQIY7X.js → chunk-NAE7MBR2.js} +3 -3
- package/dist/{chunk-LGVHW4ZA.js → chunk-NBKQT7LJ.js} +1 -1
- package/dist/{chunk-RODHDQU3.js → chunk-NJPTOKW5.js} +1 -1
- package/dist/{chunk-44IWSV6L.js → chunk-NOCIMJSN.js} +1 -1
- package/dist/chunk-NRC2G4Y5.js +5 -0
- package/dist/{chunk-67SSEGDO.js → chunk-NRTHYROA.js} +1 -1
- package/dist/chunk-O56PUUNL.js +9 -0
- package/dist/chunk-OHRS3H7Z.js +5 -0
- package/dist/{chunk-FCHTL74E.js → chunk-PMHJRT3A.js} +1 -1
- package/dist/{chunk-GRB66C5S.js → chunk-QROUKGKU.js} +1 -1
- package/dist/{chunk-AIMINJVP.js → chunk-R2RGSO4B.js} +1 -1
- package/dist/{chunk-77WMTCUQ.js → chunk-RNSSM2BK.js} +1 -1
- package/dist/chunk-SE6WNCYU.js +4 -0
- package/dist/{chunk-KCBS57IF.js → chunk-SRDHPKJT.js} +1 -1
- package/dist/chunk-SWESH2J7.js +10 -0
- package/dist/chunk-SY3HLQMV.js +4 -0
- package/dist/chunk-T63R6QT4.js +4 -0
- package/dist/{chunk-SBZWFULF.js → chunk-UBFKZEX3.js} +1 -1
- package/dist/{chunk-E5PWL3BG.js → chunk-UI7KULSI.js} +1 -1
- package/dist/chunk-UPPEOQJQ.js +3 -0
- package/dist/{chunk-QBCS57EO.js → chunk-URQUQWGW.js} +3 -3
- package/dist/chunk-UX2B7L6K.js +2 -0
- package/dist/{chunk-K4VIM4RM.js → chunk-V36ATG7A.js} +2 -2
- package/dist/chunk-VGFTNLQQ.js +2 -0
- package/dist/{chunk-VJFFMOUA.js → chunk-W5DOU2DV.js} +1 -1
- package/dist/chunk-W6VD2XFO.js +19 -0
- package/dist/chunk-WJ5HDEVH.js +6 -0
- package/dist/chunk-WWNSD6FA.js +6 -0
- package/dist/{chunk-MV4UYTZT.js → chunk-X3ICV5M5.js} +1 -1
- package/dist/chunk-XDHZMCTA.js +4 -0
- package/dist/{chunk-BCH3JCND.js → chunk-XVDJ423L.js} +1 -1
- package/dist/chunk-ZLCZDAEX.js +6 -0
- package/dist/{chunk-HOOXUO3X.js → chunk-ZM5PVRJK.js} +1 -1
- package/dist/committer-2EJPVVCQ.js +2 -0
- package/dist/{config-5GOFF5F4.js → config-R3GF2FZA.js} +1 -1
- package/dist/cover-cmd-TXICWHUU.js +3 -0
- package/dist/{credentials-GXDXVMXW.js → credentials-XN4ROCQ3.js} +1 -1
- package/dist/design-committer-BQUWD6AC.js +2 -0
- package/dist/docx-convert-ZBVQO2LG.js +1 -1
- package/dist/dossier-QZV74XOS.js +3 -0
- package/dist/evidence-V23FPVXQ.js +2 -0
- package/dist/evolve-cmd-PZCPXDMR.js +2 -0
- package/dist/{exit-manager-MXUD7GQ7.js → exit-manager-HNFATGSM.js} +1 -1
- package/dist/explain-UE4IACQH.js +2 -0
- package/dist/{explain-cmd-NWIYH5MI.js → explain-cmd-RZW6QJYM.js} +1 -1
- package/dist/{explain-cmd-DBUTPZHA.js → explain-cmd-X7JZLSZZ.js} +1 -1
- package/dist/extract-bind-BFY7IRL4.js +10 -0
- package/dist/extract-cmd-U3MGK2LP.js +6 -0
- package/dist/feeder-XGTFV7TZ.js +2 -0
- package/dist/gaps-cmd-BWCRLLBK.js +3 -0
- package/dist/{gate-B6C6KLFA.js → gate-YHBPWEM5.js} +1 -1
- package/dist/{generate-headless-LZ4HRSQ4.js → generate-headless-BSTDLZZY.js} +2 -2
- package/dist/{headless-io-PWW6YKH2.js → headless-io-BL3TEAX5.js} +1 -1
- package/dist/index.js +61 -62
- package/dist/ingest-AL6CABJT.js +2 -0
- package/dist/ingest-cmd-O6OWWZT4.js +2 -0
- package/dist/interactive-bind-43HGDF5K.js +24 -0
- package/dist/lifecycle-cmd-D6TVTYRK.js +2 -0
- package/dist/list-cmd-XCAV2FKA.js +3 -0
- package/dist/{list-commands-WIVODSEL.js → list-commands-747UTUSS.js} +1 -1
- package/dist/locks-cmd-QAULI5LV.js +2 -0
- package/dist/logical-ids-4G4FAHNJ.js +2 -0
- package/dist/login-flow-CV76ENHV.js +2 -0
- package/dist/maintenance-cmd-ZRB4NTGG.js +2 -0
- package/dist/next-TRSKMBO5.js +2 -0
- package/dist/paths-JCYX6UWL.js +2 -0
- package/dist/{persist-recorded-session-J6Z2SCTT.js → persist-recorded-session-MDPWWUA7.js} +1 -1
- package/dist/phase-seed-52LRE3LH.js +2 -0
- package/dist/pipeline-LM5JAK7F.js +2 -0
- package/dist/readmodel-X7L7W2BA.js +2 -0
- package/dist/reconcile-cmd-DGCSDML6.js +2 -0
- package/dist/{recording-banner-IRFMIZSJ.js → recording-banner-TALO7PUR.js} +1 -1
- package/dist/records-5SVUXJBW.js +2 -0
- package/dist/{require-project-folder-XSBJGIVF.js → require-project-folder-R347LFDQ.js} +1 -1
- package/dist/revert-DXXYXJGN.js +2 -0
- package/dist/review-cmd-2QF5HTI7.js +4 -0
- package/dist/run-52UIBPXD.js +2 -0
- package/dist/run-VRVH4VO3.js +2 -0
- package/dist/{run-test-md-QCERS7FQ.js → run-test-md-DFNIGYB7.js} +2 -2
- package/dist/sessions-BLXZVK5U.js +2 -0
- package/dist/sessions-cmd-AQWLL5ZN.js +25 -0
- package/dist/{skill-installer-WAVEVCSG.js → skill-installer-ANXTCXQV.js} +1 -1
- package/dist/spawner-AH5FTUYU.js +2 -0
- package/dist/structured-answers-QHFGZPSS.js +5 -0
- package/dist/tcg-generate-WKCBBKI5.js +2 -0
- package/dist/testmd-actions-RPYG6TJG.js +2 -0
- package/dist/token-refresh-NIDUOTRM.js +2 -0
- package/dist/trust-gate-EX7R2P4Y.js +2 -0
- package/dist/{validate-basic-IJKKRQRU.js → validate-basic-O2DP2XJL.js} +1 -1
- package/dist/verdicts-TJH3O5UW.js +2 -0
- package/dist/{version-check-O5GYZYTP.js → version-check-RNR3JCQ5.js} +1 -1
- package/dist/{view-cmd-GQBFCPDL.js → view-cmd-YSEGA5PI.js} +1 -1
- package/dist/walk-session-HXW4OSA2.js +2 -0
- package/dist/with-telemetry-PNP6CAVM.js +2 -0
- package/package.json +6 -6
- package/dist/ChatSurface-PMEOJBZG.js +0 -8
- package/dist/EvidenceViewOffer-EOKJE2B6.js +0 -2
- package/dist/SingleShotApp-T673X7BS.js +0 -2
- package/dist/TestMdRunView-SNYEO6CS.js +0 -2
- package/dist/bind-NSGW5BBZ.js +0 -6
- package/dist/bootstrap-RPT3JOGD.js +0 -2
- package/dist/bridge-BTSWCJ3B.js +0 -2
- package/dist/chat-committer-OS7ULZMH.js +0 -2
- package/dist/chat-controller-QLORQWJZ.js +0 -2
- package/dist/chunk-3C5GMAM4.js +0 -2
- package/dist/chunk-3CJIMPQK.js +0 -14
- package/dist/chunk-4XSW6WZD.js +0 -5
- package/dist/chunk-6W6AIDLJ.js +0 -4
- package/dist/chunk-7E24OCGX.js +0 -2
- package/dist/chunk-7YPK6EDR.js +0 -4
- package/dist/chunk-DGIPQINV.js +0 -12
- package/dist/chunk-FHKDTM5L.js +0 -6
- package/dist/chunk-FRBYGSGJ.js +0 -4
- package/dist/chunk-GG43HSU2.js +0 -3
- package/dist/chunk-J2KSZUOO.js +0 -4
- package/dist/chunk-J44RN3FB.js +0 -2
- package/dist/chunk-JSF5JYZC.js +0 -9
- package/dist/chunk-MAO5BAQI.js +0 -347
- package/dist/chunk-N4LMQR7C.js +0 -6
- package/dist/chunk-RCTM7NGT.js +0 -2
- package/dist/chunk-RN4OSVTG.js +0 -6
- package/dist/chunk-UXPQRALY.js +0 -13
- package/dist/chunk-V3UE6RJP.js +0 -2
- package/dist/chunk-Y5RNCJAN.js +0 -19
- package/dist/chunk-Z2JSEL3I.js +0 -4
- package/dist/cover-cmd-SV3I23UM.js +0 -2
- package/dist/dossier-KJSJPWOW.js +0 -3
- package/dist/evidence-VDNZ3K23.js +0 -2
- package/dist/evolve-cmd-BLSVVW4I.js +0 -2
- package/dist/explain-EBVIUS2X.js +0 -2
- package/dist/extract-bind-3SWPBZX6.js +0 -8
- package/dist/extract-cmd-HEX7F4IS.js +0 -6
- package/dist/gaps-cmd-CKCHH3HQ.js +0 -2
- package/dist/ingest-FIIO67ZN.js +0 -2
- package/dist/ingest-cmd-KRPZVB7W.js +0 -7
- package/dist/interactive-bind-PTAZVCE7.js +0 -10
- package/dist/lifecycle-cmd-32LG364Q.js +0 -2
- package/dist/list-cmd-UTZ2PQUK.js +0 -3
- package/dist/logical-ids-I7B3VJEH.js +0 -2
- package/dist/login-flow-GX7CTVWN.js +0 -2
- package/dist/maintenance-cmd-BZAGSYGI.js +0 -2
- package/dist/pipeline-HT7FCEXA.js +0 -2
- package/dist/readmodel-S5RAQH3F.js +0 -2
- package/dist/reconcile-cmd-2VHBKFA5.js +0 -2
- package/dist/revert-RQJE56HF.js +0 -2
- package/dist/review-cmd-7LXGYHHQ.js +0 -4
- package/dist/run-4LTYFTF2.js +0 -2
- package/dist/run-YGJZ2SXX.js +0 -2
- package/dist/sessions-cmd-DTQYDZNT.js +0 -23
- package/dist/spawner-YNYB4Z7K.js +0 -2
- package/dist/tcg-generate-D35EMRMQ.js +0 -2
- package/dist/testmd-actions-NB5Z6QJ3.js +0 -2
- package/dist/token-refresh-OY3WLAKD.js +0 -2
- package/dist/walk-session-OPAEV4WR.js +0 -2
- /package/dist/{chunk-BC7UVJJB.js → chunk-CH273NAE.js} +0 -0
package/dist/chunk-UXPQRALY.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{d as Qe,g as qe}from"./chunk-FCMLIK7P.js";import{b as w,c as Q,d as Ge,f as q,g as ee}from"./chunk-CJJXT5DO.js";import{a as Ke,e as P,f as j,g as We,h as H,i as D,j as Je}from"./chunk-ZPDM6FO7.js";import{a as G}from"./chunk-BC7UVJJB.js";import{d as et}from"./chunk-NVGBE2DR.js";import{a as F,b as L,d as Ye}from"./chunk-EHN5HTUD.js";import{a as R,b as y}from"./chunk-L5LI2JF4.js";import{a as b}from"./chunk-7E24OCGX.js";import{b as Y}from"./chunk-FRBYGSGJ.js";import{a as Ze}from"./chunk-6HYW5RFX.js";import{c as z,e as U}from"./chunk-J2KSZUOO.js";import{d as te,f as Xe}from"./chunk-5YPBPZUR.js";import{a as Ue}from"./chunk-A2IQRVPR.js";import{a as ze}from"./chunk-B4LLKQTK.js";function $(t){if(t===null)return"broken";let e=Math.floor(t/100);return e===1?"passed":e===7?"failed":e===2?"skipped":"broken"}var C={failed:3,broken:2,passed:1,skipped:0};function re(t){let e="skipped";for(let r of t)C[r]>C[e]&&(e=r);return e}import{createHash as Dt}from"crypto";import{basename as Ot}from"path";function ne(t){let e=t.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,40);return e.length>0?e:"session"}function ie(t){return Dt("sha256").update(t).digest("hex").slice(0,8)}function oe(t){let e=Ot(t).replace(/_test\.md$/i,"").replace(/\.md$/i,"");return`${ne(e)}-${ie(t)}`}function se(t,e){return`${ne(t)}-${ie(e)}`}function ae(t){let e={};for(let[r,n]of Object.entries(t))typeof n=="string"&&n.length>0&&(e[r]=n);return e}var At={darwin:"macOS",linux:"Linux",win32:"Windows"};function ce(t){return At[t]??t}function de(t,e){let r={},n=(i,o)=>{o!==void 0&&o!==""&&(r[i]=o)};return n("model",e.model),n("os",t.os),n("browser",t.browser),n("browser_version",t.browser_version),n("resolution",t.resolution),n("platform",e.platform),n("platform_type",e.platform_type),n("run_kind",e.run_kind),n("os_version",t.os_version),t.device!==void 0&&t.device!==""?r.device=t.device:e.platform_type&&e.platform_type!=="web"&&(r.device=null),r}function Ft(t,e){return{pack_test_dir:t,ordinal_offset:e}}import{promises as _}from"fs";import{join as I}from"path";function ue(t){let e={evidence:"0.1",run_id:t.execution_id,status:"running",title:t.title,started:t.started,environment:{producer:{name:"kane-cli",version:t.producerVersion},...t.surfaces?{surfaces:t.surfaces}:{},run_kind:t.run_kind,origin:t.origin,pid:t.pid},...t.credits!==void 0?{metrics:{credits:{value:t.credits,type:"count"}}}:{}};return y(e,{lineWidth:-1})}async function le(t,e,r,n=process.cwd(),i){let o=i??w(t.execution_id,n),a=I(o,"tests",e);return await _.mkdir(I(o,"coverage"),{recursive:!0}),await _.writeFile(I(o,"coverage",".keep"),""),await _.mkdir(a,{recursive:!0}),await _.writeFile(I(o,"run.yaml"),ue(t)),r&&await _.writeFile(I(a,r.path),r.content),o}async function Lt(t,e=process.cwd()){let r=w(t.execution_id,e);await _.mkdir(I(r,"coverage"),{recursive:!0}),await _.writeFile(I(r,"coverage",".keep"),"");let n=R(ue(t));return n.environment&&delete n.environment.run_kind,await _.writeFile(I(r,"run.yaml"),y(n,{lineWidth:-1})),r}async function jt(t,e=process.cwd()){return L(w(t,e),new Date().toISOString())}async function pe(t,e=process.cwd()){await _.rm(w(t,e),{recursive:!0,force:!0})}import{promises as fe}from"fs";import{join as me}from"path";function ge(t){let e={evidence:"0.1",test:t.testId,status:t.status,...t.durationMs!==void 0?{duration_ms:t.durationMs}:{},...t.definitionPath?{definition:{path:t.definitionPath}}:{},...t.definitionId?{definition_id:t.definitionId}:{},...t.assuranceId?{assurance_id:t.assuranceId}:{},...Object.keys(t.externalId).length?{external_id:t.externalId}:{},...t.tags&&t.tags.length?{tags:t.tags}:{},...Object.keys(t.environment).length?{environment:t.environment}:{},steps:t.steps};return y(e,{lineWidth:-1})}function ve(t){return y({logs:t},{lineWidth:-1})}async function he(t,e,r){await fe.writeFile(me(t,"tests",e,"result.yaml"),r)}async function we(t,e,r){let n=me(t,"tests",e,"logs");await fe.mkdir(n,{recursive:!0}),await fe.writeFile(me(n,"meta.yaml"),r)}import{promises as K}from"fs";import{join as tt}from"path";function rt(t){return tt(t,".internal","meta.json")}async function nt(t){let e;try{e=await K.readFile(rt(t),"utf8")}catch(n){if(n?.code==="ENOENT")return null;throw n}let r=JSON.parse(e);if(!r||typeof r!="object"||Array.isArray(r))throw new Error("meta.json is not a JSON object");return r}async function ye(t,e){let r;try{r=await nt(t)??{}}catch(a){console.warn(`evidence: meta.json at ${t} unreadable \u2014 skipping execution-pointer append to preserve identity`,a);return}let n=Array.isArray(r.executions)?r.executions:[];n.push(e),r.executions=n,await K.mkdir(tt(t,".internal"),{recursive:!0});let i=rt(t),o=`${i}.tmp-${process.pid}-${Date.now()}`;await K.writeFile(o,JSON.stringify(r,null,2)+`
|
|
3
|
-
`),await K.rename(o,i)}async function Tt(t){try{let e=await nt(t);return e&&Array.isArray(e.executions)?e.executions:[]}catch{return[]}}async function Nt(t,e,r=process.cwd()){let n=await q(t,r);if(!n){let o=`evidence: no pack found for "${t}"`;return e.json?console.log(JSON.stringify({valid:!1,error:"not_found",target:t})):console.error(o),2}let i=await F(n,e.profile??"L1");return e.json?console.log(JSON.stringify({valid:i.valid,status:i.status,diagnostics:i.diagnostics})):console.log(`evidence: ${i.valid?"valid":"INVALID"} (${e.profile??"L1"}, status ${i.status})`),i.valid?0:1}function _e(t){let e=[];for(let r of t){let n=r.perFlow&&r.perFlow.length?r.perFlow.map(i=>i.resultCode):[r.resultCode];for(let i of n)e.push($(i))}return re(e)}function Vt(t){let e=null;for(let r of t){let n=r.perFlow&&r.perFlow.length?r.perFlow.map(i=>i.resultCode):[r.resultCode];for(let i of n)i!=null&&(e==null||C[$(i)]>C[$(e)]||C[$(i)]===C[$(e)]&&i>e)&&(e=i)}return e}import{promises as Mt}from"fs";import{extname as it,basename as Bt}from"path";var Ht={".ndjson":"ndjson",".log":"log",".json":"json",".har":"har"};async function xe(t){let e;try{e=await Mt.readdir(t)}catch{return[]}return e.filter(r=>r!=="meta.yaml").sort().map(r=>({name:Bt(r,it(r)),file:r,format:Ht[it(r)]??"txt"}))}import{mkdirSync as zt,appendFileSync as Ut}from"fs";import{join as ot}from"path";function ke(t,e){return ot(t,"tests",e,"logs")}function be(t,e,r,n={},i){try{i?.(e,r,r,n)}catch{}if(t)try{zt(t,{recursive:!0});let o=JSON.stringify({ts:new Date().toISOString(),level:e,event:r,...n})+`
|
|
4
|
-
`;Ut(ot(t,"diagnostics.ndjson"),o)}catch{}}import{promises as E}from"fs";import{join as O}from"path";async function Yt(t){try{let e=O(t,"tests"),r=await E.readdir(e).catch(()=>[]);for(let n of r){let i=O(e,n,"steps"),o=await E.readdir(i).catch(()=>[]);for(let a of o){let s=await E.readFile(O(i,a,"failure.yaml"),"utf8").catch(()=>null);if(s!=null)try{let c=R(s);if(c&&typeof c=="object"&&c.triage)return!0}catch{}}}}catch{}return!1}async function st(t,e,r){let n=O(t,"tests",e,"logs");if(r)try{await E.mkdir(n,{recursive:!0}),await E.copyFile(r,O(n,"tui.log"))}catch{}let i=await xe(n);i.length&&await we(t,e,ve(i))}async function Ie(t){let e=t.cwd??process.cwd(),r=t.packDir??w(t.executionId,e);if(!t.saved&&!t.packDir)return await pe(t.executionId,e),{sealed:!1};await st(r,t.testId,t.tuiLogPath);let n=O(r,"run.yaml"),i=R(await E.readFile(n,"utf8"));i.environment={...i.environment??{},saved:t.saved,run_kind:t.runKind},await E.writeFile(n,y(i,{lineWidth:-1}));let o=await E.open(n,"r+");try{await o.sync()}finally{await o.close()}let a=await Yt(r);await L(r,new Date().toISOString());let s;try{let d=await F(r,"L1");s=d.valid;let p=(d.diagnostics??[]).filter(u=>String(u?.code??"").includes("failure.status_disagrees"));if(p.length>0)if(t.expectStatusDisagrees||a){let u=t.expectStatusDisagrees?"expected under --bug-detection continue":"self-explained by triaged failure record(s)";console.warn(`evidence: ${p.length} status_disagrees advisory(ies) \u2014 ${u}`)}else console.warn(`evidence: ${p.length} status_disagrees advisory(ies) \u2014 step verdicts disagree with their failure records`,p);if(!d.valid){console.warn(`evidence: sealed pack ${t.executionId} failed L1 validation`,d.diagnostics);let u=String(d.diagnostics?.[0]?.code??"");be(ke(r,t.testId),"warn","EVIDENCE_INVALID",{execution_id:t.executionId,first_code:u,surface:t.surface??"testmd"},t.log)}}catch(d){console.warn(`evidence: validation error for ${t.executionId}`,d)}let c;if(t.saved&&t.packDir)try{c=await Ge(r,t.executionId,e)}catch(d){console.warn(`evidence: store install failed for ${t.executionId}`,d)}if(t.outputStemDir)try{await ye(t.outputStemDir,{execution_id:t.executionId,run_kind:t.runKind,status:t.verdict,valid:s,at:new Date().toISOString()})}catch(d){console.warn(`evidence: execution-pointer append failed for ${t.executionId} (pack is sealed)`,d)}return{sealed:!0,valid:s,storePath:c}}import{release as at}from"os";import{execFileSync as Gt}from"child_process";var ct=!1,W;function Kt(){if(!ct)if(ct=!0,process.platform==="darwin")try{W=Gt("sw_vers",["-productVersion"],{timeout:2e3}).toString().trim()||void 0}catch{W=at()||void 0}else W=at()||void 0;return W}function Ee(t){let e={os:ce(process.platform)},r=Kt();if(r&&(e.os_version=r),t.cdpBrowser){let n=/^([A-Za-z]+)\/(\d+)/.exec(t.cdpBrowser);n&&(e.browser=n[1].replace(/^Headless/,""),e.browser_version=n[2])}return t.resolution&&(e.resolution=t.resolution),e}async function dt(t){if(t)try{let e=await fetch(`${t}/json/version`,{signal:AbortSignal.timeout(2e3)});if(!e.ok)return;let r=await e.json();return typeof r.Browser=="string"?r.Browser:void 0}catch{return}}function Wt(t){let e;return()=>(e||(e=dt(t)),e)}import{promises as Se,existsSync as Re,readFileSync as Qt}from"fs";import{basename as qt,join as S}from"path";import{readFileSync as Jt}from"fs";import{dirname as Xt,resolve as Zt}from"path";function ut(t,e){let r=Zt(t),n=Jt(r,"utf8");return P(e?j(n,H(Xt(r),e)):n)}var T=class t{constructor(e){this.opts=e}executionId;testId;definitionPath=null;definitionContent=null;accumulatedSteps=[];maxOrdinal=0;_packDirOverride;_attached=!1;get attached(){return this._attached}static async attach(e){let r=qt(e.packDir).replace(/\.evidence$/,""),n=new t({origin:"testrun",runKind:"author",pid:process.pid,title:e.testId,started:new Date().toISOString(),producerVersion:ze,cwd:e.cwd});n.executionId=r,n.testId=e.testId,n._packDirOverride=e.packDir,n._attached=!0;let i=S(e.packDir,"tests",e.testId);return await Se.mkdir(i,{recursive:!0}),e.definition&&(await Se.writeFile(S(i,e.definition.path),e.definition.content),n.definitionPath=e.definition.path,n.definitionContent=e.definition.content),n}async start(){if(this._attached)throw new Error("attach-mode session is already started");this.executionId=Q(),this.testId=this.opts.testmdRelPath?oe(this.opts.testmdRelPath):se(this.opts.objectiveOrName??"session",this.opts.sessionId??this.executionId);let e=this.opts.definition??null;return await le({execution_id:this.executionId,title:this.opts.title,started:this.opts.started,producerVersion:this.opts.producerVersion,surfaces:this.opts.surfaces,run_kind:this.opts.runKind,origin:this.opts.origin,pid:this.opts.pid,...this.opts.credits!==void 0?{credits:this.opts.credits}:{}},this.testId,e,this.opts.cwd,this.opts.packRootDir?this.pack:void 0),e&&(this.definitionPath=e.path,this.definitionContent=e.content),{executionId:this.executionId,testId:this.testId,packTestDir:this.packTestDir}}get pack(){return this._packDirOverride?this._packDirOverride:this.opts.packRootDir?S(this.opts.packRootDir,`${this.executionId}.evidence`):w(this.executionId,this.opts.cwd)}get packTestDir(){return S(this.pack,"tests",this.testId)}async writeDefinition(e,r="test.md"){await Se.writeFile(S(this.packTestDir,r),e),this.definitionPath=r,this.definitionContent=e}computeAssuranceId(){try{if(this.opts.testmdRelPath&&this.opts.cwd){let e=S(this.opts.cwd,this.opts.testmdRelPath);if(Re(e))return D(Qt(e,"utf8"))?.id}}catch{}}computeDefinitionId(){try{if(this.opts.testmdRelPath&&this.opts.cwd){let e=S(this.opts.cwd,this.opts.testmdRelPath),r=S(this.opts.cwd,".context"),n=Re(r)?b(r):void 0;if(Re(e))return ut(e,n)}if(this.definitionContent!=null)return P(this.definitionContent)}catch{}}noteSpawn(e){this.accumulatedSteps.push(...e.steps),this.maxOrdinal=Math.max(this.maxOrdinal,e.maxOrdinal)}nextOrdinalOffset(){return this.maxOrdinal}get steps(){return this.accumulatedSteps}async writeResult(e){let r=_e(e.spawns),n=this.pack;await he(n,this.testId,ge({testId:this.testId,status:r,durationMs:e.durationMs,definitionPath:this.definitionPath,definitionId:this.computeDefinitionId(),assuranceId:this.computeAssuranceId(),externalId:ae(e.externalIdInput),environment:de(e.runnerEnv,e.intentEnv),steps:e.steps,tags:e.tags}));let i=e.externalIdInput;return e.log&&(i.commit_id||i.test_id||i.testcase_id)&&e.log("info","EVIDENCE_EXTERNAL_ID","Evidence external-id mapping",{execution_id:this.executionId,commit_id:i.commit_id??null,test_id:i.test_id??null,testcase_id:i.testcase_id??null,project_id:i.project_id??null,session_id:i.session_id??null,session_name:i.session_name??null}),r}get id(){return this.executionId}get test(){return this.testId}};async function er(t,e,r=ee){try{let n=await r(t);if(n.aborted.length>0||n.removed.length>0)try{e?.("info","EVIDENCE_RECOVERY","Startup evidence recovery swept incomplete packs",{aborted:n.aborted,removed:n.removed,origin:"startup"})}catch{}return n}catch(n){return console.warn("evidence: startup recovery failed",n),{aborted:[],removed:[]}}}import{promises as _r}from"fs";import{existsSync as $e,mkdirSync as fr,readdirSync as mr,readFileSync as gr,rmSync as vr,statSync as hr,writeFileSync as wr}from"fs";import{join as A}from"path";import{mkdirSync as tr,renameSync as rr,rmSync as nr,writeFileSync as ir}from"fs";import{join as lt}from"path";var or=5e6;function pt(t,e,r){let n=lt(t,"coverage","sources"),i=new Map,o=!1;try{for(let a of r.usecases)for(let s of a.sources){if(i.has(s.id)){s.file=i.get(s.id);continue}if(!s.cid)continue;let c=et(e,s.cid);if(c===null||c.byteLength>or)continue;o||(tr(n,{recursive:!0}),o=!0);let d=lt(n,s.id),l=`${d}.tmp-${process.pid}`;ir(l,c),rr(l,d);let p=`coverage/sources/${s.id}`;i.set(s.id,p),s.file=p}}catch{for(let a of r.usecases)for(let s of a.sources)delete s.file;if(o)try{nr(n,{recursive:!0,force:!0})}catch{}}}import{existsSync as Ce,readFileSync as N,renameSync as cr,writeFileSync as dr}from"fs";import{dirname as ht,isAbsolute as wt,resolve as yt}from"path";var sr=new Set(["inline","testmd","testrun"]),ar=new Set(["inferred","authored","runtime-derived"]),Pe=new Set(["passed","failed","broken","skipped"]);function ft(t,e,r){let n=[];if(r.facts.length===0)return{record:null,errors:[{code:"EMPTY_EXECUTIONS",detail:"a run with no designed units attaches no facts \u2014 skip the call"}]};let i=z(t);if(e.latestHash!==i)return{record:null,errors:[{code:"STALE_BASIS",detail:`graph opened at ${String(e.latestHash)} but chain head is ${String(i)} \u2014 re-open and retry`}]};let o=[];for(let s of r.facts){let c=`executions[${s.ref}]`,d=e.resolve(s.ref),l=d?e.tipOf(d.cid):null;if(!d||!l||e.superseded.has(l)){n.push({code:"UNKNOWN_REF",detail:`${c}: '${s.ref}' is not a live committed node`});continue}if(e.nodeLabel.get(l)!==te.TEST){n.push({code:"ILLEGAL_TARGET",detail:`${c}: execution facts attach to tests \u2014 '${s.ref}' is a ${e.nodeLabel.get(l)}`});continue}if(!sr.has(s.mode)){n.push({code:"BAD_MODE",detail:`${c}: mode '${s.mode}' not in inline|testmd|testrun`});continue}if(!Pe.has(s.verdict)){n.push({code:"BAD_VERDICT",detail:`${c}: verdict '${s.verdict}' not in ${[...Pe].join("|")}`});continue}if(!ar.has(s.oracle_mode)){n.push({code:"BAD_ORACLE_MODE",detail:`${c}: oracle_mode '${s.oracle_mode}' not in inferred|authored|runtime-derived`});continue}if(typeof s.drift_flag!="boolean"||typeof s.stale_at_run!="boolean"){n.push({code:"MISSING_FIELD",detail:`${c}: drift_flag and stale_at_run are required booleans`});continue}if(!s.execution_id||!s.started_at||!s.definition_id_at_run){n.push({code:"MISSING_FIELD",detail:`${c}: execution_id, started_at and definition_id_at_run are required`});continue}let p=[];for(let u of s.per_ac??[]){let m=e.resolve(u.ac_ref),f=m?e.tipOf(m.cid):null;if(!m||!f||e.superseded.has(f)||e.nodeLabel.get(f)!==te.AC){n.push({code:"UNKNOWN_REF",detail:`${c}.per_ac: '${u.ac_ref}' is not a live AC`});continue}if(!Pe.has(u.verdict)){n.push({code:"BAD_VERDICT",detail:`${c}.per_ac['${u.ac_ref}']: verdict '${u.verdict}'`});continue}p.push({ac_ref:e.nameOf.get(f)??f,verdict:u.verdict})}o.push({about:l,definition_id_at_run:s.definition_id_at_run,verdict:s.verdict,...p.length?{per_ac:p}:{},drift_flag:s.drift_flag,oracle_mode:s.oracle_mode,stale_at_run:s.stale_at_run,...s.unresolved_acs?.length?{unresolved_acs:s.unresolved_acs}:{},execution_id:s.execution_id,...s.evidence_id?{evidence_id:s.evidence_id}:{},...s.duration_ms!==void 0?{duration_ms:s.duration_ms}:{},started_at:s.started_at,mode:s.mode,local:s.local,...s.via_parent?{via_parent:s.via_parent}:{}})}if(n.length>0)return{record:null,errors:n};let a=U(t,{ts:new Date().toISOString(),proposal_id:null,nodes:[],edges:[],review:[],supersessions:[],executions:o,source_head_moves:{}});return Y(t),{record:a.record,errors:null}}function _t(t){let e={failed:3,broken:2,skipped:1,passed:0},r=new Map;for(let n of t)for(let i of n.verifies??[]){let o=r.get(i);(o===void 0||(e[n.status]??0)>(e[o]??0))&&r.set(i,n.status)}return[...r.entries()].map(([n,i])=>({ref:n,verdict:i}))}function xt(t){let e=[],r=G(t.cwd);if(!Ce(r))return{synced:0,superseded:0,skipped:"no-context",warnings:e};let n=t.by??{kind:"ai",id:"exec-sync"},i=b(r),o=[],a=0,s=new Set;for(let d of t.members){let l=wt(d.path)?d.path:yt(t.cwd,d.path);for(let p of ur(l)){if(s.has(p.path))continue;s.add(p.path);let u=p.path===l?void 0:D(N(l,"utf8"))?.id,m=N(p.path,"utf8"),f=D(m);if(!f?.id)continue;let g=i.resolve(f.id),x=g?i.tipOf(g.cid):null;if(!g||!x||i.superseded.has(x)){e.push(`sync: ${f.id} does not resolve to a live test \u2014 skipped (foreign store?)`);continue}let k=P(j(m,H(ht(p.path),i))),v=String(i.getNode(x)?.content.test_md_blob??""),M=P(j(v,We(i))),B=!1,Z=x;if(k===M)f.base!==M&&vt(p.path,m,M,e);else if(f.base===M){let h=lr(r,i,x,m,k,n);h.error?(e.push(`sync: could not supersede ${f.id}: ${h.error}`),B=!0):(a++,Z=h.newCid,B=h.oracleTier,vt(p.path,N(p.path,"utf8"),k,e),i=b(r))}else B=!0,e.push(f.base?`sync: ${f.id} was edited from an older version \u2014 graph kept; reconcile via a redesign or maintain`:`sync: ${f.id} carries no base pin (hand-copied file?) \u2014 fact attached with drift flag`);let Ve=i.getNode(Z)?.content.check,Me=p.path===l?d.acs??[]:[],Be=Me.filter(h=>mt(i,h.ref)),He=Me.filter(h=>!mt(i,h.ref)).map(h=>h.ref);o.push({ref:f.id,definition_id_at_run:k,verdict:d.verdict,...Be.length?{per_ac:Be.map(h=>({ac_ref:h.ref,verdict:h.verdict}))}:{},drift_flag:B,oracle_mode:Ve?.expected_mode??(Ke(Ve?.operand)?"runtime-derived":"inferred"),stale_at_run:i.stale(Z)!=="fresh",...He.length?{unresolved_acs:He}:{},execution_id:d.executionId,...d.evidenceId?{evidence_id:d.evidenceId}:{},...d.durationMs!==void 0?{duration_ms:d.durationMs}:{},started_at:d.startedAt,mode:d.mode,local:d.local,...u?{via_parent:u}:{}})}}if(o.length===0)return{synced:0,superseded:a,warnings:e};let c=ft(r,b(r),{facts:o,by:n});return c.errors?(e.push(...c.errors.map(d=>`sync facts: ${d.code}: ${d.detail}`)),{synced:0,superseded:a,warnings:e}):{synced:o.length,superseded:a,warnings:e}}function ur(t){let e=[],r=new Set,n=i=>{if(r.has(i)||!Ce(i))return;r.add(i);let o=N(i,"utf8");for(let a of o.split(`
|
|
5
|
-
`)){let s=/^@import\s+(\S+)\s*$/.exec(a.trim());if(!s)continue;let c=wt(s[1])?s[1]:yt(ht(i),s[1]);Ce(c)&&D(N(c,"utf8"))?.id&&n(c)}e.push({path:i})};return n(t),e}function mt(t,e){let r=t.resolve(e),n=r?t.tipOf(r.cid):null;return!!(r&&n&&!t.superseded.has(n)&&t.nodeLabel.get(n)==="ac")}function lr(t,e,r,n,i,o){let a=e.getNode(r);if(!a)return{oracleTier:!1,error:"tip unreadable"};let s=Je(n),c=String(a.content.test_md_blob??""),d=/^#\s+(.+?)\s*$/m.exec(s)?.[1]??String(a.content.title??""),l={...a.content,test_md_blob:s,definitionId:i,title:d},p=Xe("test",l);if(p.length>0)return{oracleTier:!1,error:p.map(g=>g.detail).join("; ")};let u=Ze("test",l);if(u===r)return{newCid:r,oracleTier:!1};let m=gt(c)!==gt(s),f=z(t);if(e.latestHash!==f)return{oracleTier:m,error:`store advanced under the sync (basis ${String(e.latestHash)} vs head ${String(f)}) \u2014 re-run to retry`};try{U(t,{ts:new Date().toISOString(),proposal_id:null,nodes:[{cid:u,label:"test",content:l}],edges:[],review:[{id:u,kind:"review-item",resolution:"edited",edit:null,reason:"edited on disk (run sync)",by:o}],supersessions:[{kind:"node",old:r,new:u,reason:"edited on disk (run sync)",by:o}],source_head_moves:{}},{expectPrev:f})}catch(g){return{oracleTier:m,error:g instanceof Error?g.message:String(g)}}return Y(t),{newCid:u,oracleTier:m}}var pr=/\s@verifies\s+(ac-[\w.:\/-]+(?:\s*,\s*ac-[\w.:\/-]+)*)\s*$/;function gt(t){let e=[],r=t.split(`
|
|
6
|
-
`),n=!1;for(let i of r){if(/^##\s/.test(i)){n=/\bassert\b/i.test(i);let o=pr.exec(i);o&&e.push(`v:${o[1].trim()}`);continue}n&&i.trim()!==""&&e.push(i.trim())}return e.join(`
|
|
7
|
-
`)}function vt(t,e,r,n){try{let i=e.split(`
|
|
8
|
-
`),o=-1;if(i[0]?.trim()==="---"){for(let c=1;c<i.length;c++)if(i[c].trim()==="---"){o=c;break}}if(o<0)return;let a=!1;for(let c=1;c<o;c++){if(/^\s+base:\s*sha256:[0-9a-f]+\s*$/.test(i[c])){i[c]=i[c].replace(/sha256:[0-9a-f]+/,r),a=!0;break}if(/^assurance:\s*$/.test(i[c])&&!i.slice(c,Math.min(c+3,o)).some(d=>/^\s+base:/.test(d))){i.splice(c+2,0,` base: ${r}`),a=!0;break}}if(!a)return;let s=`${t}.tmp-sync`;dr(s,i.join(`
|
|
9
|
-
`)),cr(s,t)}catch(i){n.push(`sync: pin refresh failed for ${t} (${i instanceof Error?i.message:String(i)}) \u2014 next run self-heals`)}}var yr={passed:"passed",failed:"failed",broken:"blocked",skipped:"not-run"},kt=(t,e)=>{try{if(!$e(e))return{status:"skipped",reason:"no context store at the project root"};let r=A(t,"tests");if(!$e(r))return{status:"skipped",reason:"pack has no tests/"};let n=new Map;for(let s of mr(r)){let c=A(r,s,"result.yaml");if(!$e(c)||!hr(A(r,s)).isDirectory())continue;let d=R(gr(c,"utf8"));if(!d?.definition_id&&!d?.assurance_id)continue;let l=_t(d.steps??[]),p={testShortId:String(d.test??s),execution:yr[String(d.status)]??"not-run",...l.length?{acs:l}:{}};d.assurance_id&&n.set(`id:${d.assurance_id}`,p),d.definition_id&&n.set(`def:${d.definition_id}`,p)}let i=qe(b(e),n,{scope:"run"}),o=Qe(i);pt(t,e,i);let a=y({...i,rollup:o},{lineWidth:-1});return fr(A(t,"coverage"),{recursive:!0}),wr(A(t,"coverage","usecases.yaml"),a),{status:"written"}}catch(r){try{vr(A(t,"coverage","sources"),{recursive:!0,force:!0})}catch{}return{status:"skipped",reason:r instanceof Error?r.message:String(r)}}};async function xr(t){try{let e=new T({origin:"inline",runKind:"author",pid:t.pid,title:t.title,started:new Date().toISOString(),producerVersion:t.producerVersion,surfaces:t.surfaces,objectiveOrName:t.objectiveOrName,sessionId:t.sessionId,cwd:t.cwd,packRootDir:t.packRootDir}),r=await e.start();return{session:e,...r,packDir:e.pack,spawns:[],startedAtMs:Date.now(),cwd:t.cwd}}catch(e){return console.warn("evidence: inline pack creation failed",e),null}}function kr(t,e,r){if(!t)return;t.session.noteSpawn(e),e.resolution&&(t.resolution=e.resolution);let n=(r?.per_flow_metadata??[]).map(i=>({resultCode:i?.result_code!=null?Number(i.result_code):null}));t.spawns.push({resultCode:r?.result_code!=null?Number(r.result_code):null,...n.length?{perFlow:n}:{}})}function br(t){if(t)return{packTestDir:t.packTestDir,ordinalOffset:t.session.nextOrdinalOffset()}}async function Ir(t,e){if(!t)return null;if(t.finalized)return t.finalized;let r=(n,i,o)=>e.log?e.log("warn",n,i,o):console.warn(`evidence: ${i}`,o??"");try{if(e.recordedTestPath)try{await t.session.writeDefinition(await _r.readFile(e.recordedTestPath,"utf8"))}catch(a){r("EVIDENCE_DEFINITION_FAILED","could not attach synthesized test.md",{error:String(a)})}let n=e.cdpBrowserCapture?await e.cdpBrowserCapture():void 0,i=await t.session.writeResult({steps:t.session.steps,spawns:t.spawns.length?t.spawns:[{resultCode:null}],externalIdInput:{...e.externalIdInput,execution_id:t.executionId},runnerEnv:Ee({cdpBrowser:n,resolution:t.resolution}),intentEnv:{model:e.model,platform:"Desktop",platform_type:"web"},durationMs:e.durationMs??Date.now()-t.startedAtMs,log:e.log});try{if(e.recordedTestPath){let a=xt({cwd:e.cwd??t.cwd??process.cwd(),members:[{path:e.recordedTestPath,verdict:i,executionId:t.executionId,startedAt:new Date(t.startedAtMs).toISOString(),mode:"inline",local:e.local??!1}]});for(let s of a.warnings)r("EXEC_SYNC",s)}}catch(a){r("EXEC_SYNC","exec-sync failed",{error:String(a)})}try{let a=(e.coverageWriter??kt)(t.packDir,G(e.cwd??t.cwd??process.cwd()));a.status==="skipped"&&r("EVIDENCE_COVERAGE_SKIPPED",`coverage/usecases.yaml not written: ${a.reason}`)}catch(a){r("EVIDENCE_COVERAGE_SKIPPED","coverage writer threw",{error:String(a)})}let o=await Ie({executionId:t.executionId,testId:t.testId,saved:e.saved,runKind:"author",verdict:i,cwd:e.cwd??t.cwd,packDir:t.packDir,tuiLogPath:e.tuiLogPath,log:e.log,surface:"inline"});return t.finalized=o,e.log?.("info","EVIDENCE_SEALED","Inline pack sealed",{execution_id:t.executionId,verdict:i,valid:o.valid,pack:t.packDir,store_copy:o.storePath??null}),o}catch(n){return r("EVIDENCE_SEAL_FAILED","inline pack finalize failed",{error:String(n)}),null}}import{statSync as $r,openSync as Dr,readSync as Or,closeSync as Ar}from"fs";import{basename as Fr,resolve as Lr}from"path";import{createServer as Er}from"http";import{createReadStream as Sr,promises as Rr}from"fs";import{randomBytes as Pr}from"crypto";var J="127.0.0.1";function bt(t,e){if(!t)return null;let r=/^bytes=(\d*)-(\d*)$/.exec(t.trim());if(!r)return null;let[,n,i]=r;if(n===""&&i==="")return null;if(n===""){let s=Number(i);return s===0||e===0?"unsatisfiable":{start:Math.max(0,e-s),end:e-1}}let o=Number(n);if(o>=e)return"unsatisfiable";let a=i===""?e-1:Math.min(Number(i),e-1);return a<o?null:{start:o,end:a}}async function De(t){let e=Pr(16).toString("hex"),r=Er((i,o)=>{Cr(i,o,t,e).catch(()=>o.destroy())});await new Promise((i,o)=>{r.once("error",o),r.listen(t.port??0,J,()=>{r.removeListener("error",o),i()})});let n=r.address().port;return{port:n,urlFor:i=>`http://${J}:${n}/${e}/${encodeURIComponent(i)}`,close:()=>new Promise(i=>{r.close(()=>i()),r.closeAllConnections()})}}async function Cr(t,e,r,n){let i=t.url??"/",o=v=>{try{r.log?.("warn","EVIDENCE_SERVE_DENIED",{reason:v,path:i})}catch{}};if(t.headers.host!==`${J}:${t.socket.localPort}`){o("host_mismatch"),e.writeHead(403).end();return}let a=t.headers.origin;if(a!==void 0&&!r.allowedOrigins.includes(a)){o("origin_denied"),e.writeHead(403).end();return}let s=a?{"Access-Control-Allow-Origin":a,Vary:"Origin","Access-Control-Expose-Headers":"Content-Range, Content-Length"}:{};if(t.method==="OPTIONS"){let v={...s,"Access-Control-Allow-Methods":"GET, HEAD, OPTIONS","Access-Control-Allow-Headers":"range","Access-Control-Max-Age":"86400"};t.headers["access-control-request-private-network"]==="true"&&(v["Access-Control-Allow-Private-Network"]="true"),e.writeHead(204,v).end();return}if(t.method!=="GET"&&t.method!=="HEAD"){e.writeHead(405,s).end();return}let c;try{let v=new URL(t.url??"/",`http://${J}`).pathname.split("/");if(v.length!==3||v[1]!==n){o("bad_token"),e.writeHead(404,s).end();return}c=decodeURIComponent(v[2])}catch{o("not_found"),e.writeHead(404,s).end();return}let d=r.packs.get(c);if(!d){o("not_found"),e.writeHead(404,s).end();return}let l;try{let v=await Rr.stat(d);if(!v.isFile())throw new Error("not a file");l=v.size}catch{o("not_found"),e.writeHead(404,s).end();return}let p={...s,"Accept-Ranges":"bytes","Content-Type":"application/zip","Cache-Control":"no-store"};if(t.method==="HEAD"){e.writeHead(200,{...p,"Content-Length":String(l)}).end();return}let u=bt(t.headers.range,l);if(u==="unsatisfiable"){o("unsatisfiable"),e.writeHead(416,{...s,"Content-Range":`bytes */${l}`}).end();return}let[m,f,g]=u===null?[0,l-1,200]:[u.start,u.end,206],x={...p,"Content-Length":String(f-m+1)};if(g===206&&(x["Content-Range"]=`bytes ${m}-${f}/${l}`),e.writeHead(g,x),l===0){e.end();return}let k=Sr(d,{start:m,end:f});k.on("error",()=>e.destroy()),e.on("close",()=>k.destroy()),k.pipe(e)}function V(t,e){return(e??Ue(t).evidenceViewerUrl).replace(/\/+$/,"")}function Oe(t,e){return`${e}/?pack=${encodeURIComponent(t)}`}function Ae(t){return`evidence: view locally with \`kane-cli evidence serve ${t}\``}async function jr(t,e,r={}){let n=r.out??(l=>process.stdout.write(l+`
|
|
10
|
-
`)),i=l=>(n(`error: ${l}`),2);if(e.env!=="prod"&&e.env!=="stage")return i(`invalid --env: ${String(e.env)}`);if(e.port!==void 0&&(!Number.isInteger(e.port)||e.port<1||e.port>65535))return i("invalid --port: expected an integer 1-65535");let o;try{o=V(e.env,e.viewerUrl),new URL(o)}catch{return i(`invalid --viewer-url: ${e.viewerUrl}`)}if(t.length===0)return i("no pack paths given");let a=new Map;for(let l of t){let p=Lr(l),u;try{u=$r(p)}catch{return i(`${l}: not found`)}if(u.isDirectory())return i(`${l}: is a directory \u2014 packs must be sealed .evidence files (run the execution to completion, or seal it, first)`);if(!u.isFile())return i(`${l}: not a regular file`);let m=Buffer.alloc(2),f=Dr(p,"r");try{Or(f,m,0,2,0)}finally{Ar(f)}if(m.toString("latin1")!=="PK")return i(`${l}: not a sealed evidence pack (zip magic missing)`);let g=Fr(p);if(a.has(g))return i(`duplicate pack basename: ${g} (URL names collide \u2014 rename one)`);a.set(g,p)}let s=r.log??((l,p,u)=>process.stderr.write(`warn: ${p} reason=${u.reason} path=${u.path}
|
|
11
|
-
`)),c;try{c=await De({packs:a,allowedOrigins:[new URL(o).origin],port:e.port,log:s})}catch(l){return i(`could not bind 127.0.0.1${e.port?`:${e.port}`:""} \u2014 ${l.message}`)}n(`serving ${a.size} pack${a.size===1?"":"s"} on http://127.0.0.1:${c.port}`);for(let l of a.keys()){let p=c.urlFor(l);n(l),n(` pack ${p}`),n(` viewer ${Oe(p,o)}`)}return n("press Ctrl-C to stop"),await(r.hold??Tr)(),await c.close(),0}function Tr(){return new Promise(t=>{let e=process.listeners("SIGINT");process.removeAllListeners("SIGINT"),process.once("SIGINT",()=>{for(let r of e)process.on("SIGINT",r);t()})})}import{promises as X}from"fs";import{tmpdir as Br}from"os";import{join as St,resolve as Le}from"path";var Nr=["error","prefer_first","prefer_latest","discard"],Vr=["external_id.commit_id","external_id.test_id"];function It(t){let e=t.replace(/-/g,"_");return Nr.includes(e)?e:null}function Et(t){let e=t==="discard"?{on_collision:"discard"}:{on_collision:"error",identity:{keys:[...Vr],on_same:t??"nest",on_different:t?"error":"split"}};return y({packs:{require_status:"finalized",require_valid:"L1",on_ineligible:"abort"},tests:e,rules:[{file:"run.yaml",key:"run_id",must:"different",on_violation:"skip"},{file:"result.yaml",key:"external_id.project_id",must:"same",on_violation:"error"},{file:"result.yaml",key:"external_id.org_id",must:"same",on_violation:"error"}]},{lineWidth:-1})}async function Fe(t){try{if(!t.isTTY){t.log(Ae(t.packPath));return}let e=V(t.env);await(t.renderPrompt??Mr)(t.packPath,e)}catch(e){try{t.log(`evidence view failed \u2014 ${e.message}`)}catch{}}}async function Mr(t,e){let r=await import("./react-QWOAB3TB.js"),{render:n}=await import("./build-JIKYOZUH.js"),{EvidenceViewOffer:i}=await import("./EvidenceViewOffer-EOKJE2B6.js");await new Promise(o=>{let a=n(r.default.createElement(i,{packPath:t,viewerBase:e,onDone:()=>{a.unmount(),o()}}),{stdout:process.stderr,exitOnCtrlC:!1})})}async function Hr(t,e,r=process.cwd(),n={}){let i=n.out??(u=>process.stdout.write(u+`
|
|
12
|
-
`)),o=n.err??(u=>process.stderr.write(u+`
|
|
13
|
-
`)),a=u=>(o(`evidence merge: ${u}`),2);if(!e.runId)return a("--run-id is required (merged identity is the caller's fact)");if(e.rules&&e.onCollision)return a("--rules and --on-collision are mutually exclusive");let s;if(e.onCollision!==void 0){let u=It(e.onCollision);if(!u)return a(`invalid --on-collision: ${e.onCollision} (expected error | prefer-first | prefer-latest | discard)`);s=u}let c=[];for(let u of t){let m=await zr(u,r);if(!m)return a(`no pack found for "${u}"`);c.push(m)}let d=e.out?Le(r,e.out):w(e.runId,r),l=null,p;e.rules?p=Le(r,e.rules):(l=await X.mkdtemp(St(Br(),"kane-merge-rules-")),p=St(l,"merge-rules.yaml"),await X.writeFile(p,Et(s)));try{let u=await(n.mergeFn??Ye)(c,{runId:e.runId,out:d,rulesPath:p,title:e.title,finalize:e.finalize});return e.json?i(JSON.stringify(u)):Ur(i,u),u.output.finalized&&!e.json&&await(n.offer??Fe)({packPath:d,env:e.env,isTTY:n.isTTY??(!!process.stdin.isTTY&&!!process.stderr.isTTY),log:o}),0}catch(u){let m=u instanceof Error?u.message:String(u);return u?.code==="ABORT"?(o(`evidence merge: aborted \u2014 ${m}`),1):a(m)}finally{l&&await X.rm(l,{recursive:!0,force:!0}).catch(()=>{})}}async function zr(t,e){let r=Le(e,t);if(await Rt(r))return r;let n=w(t,e);return await Rt(n)?n:null}async function Rt(t){try{return await X.stat(t),!0}catch{return!1}}function Ur(t,e){let{packs:r,tests:n,output:i}=e;t(`evidence: merged ${n.merged} tests from ${r.eligible.length} packs -> ${i.path} (${i.finalized?"sealed":"live"})`);for(let o of r.skipped)t(` skipped ${o.runId}: ${o.rule} \u2014 ${o.reason}`);for(let o of n.collisions){let a;o.action==="nest"?a=`nested into ${o.folder}, latest ${o.winner}`:o.action==="split"?a=`split into ${o.folder}`:a=`winner ${o.winner}`,t(` collision ${o.test}: ${a} (${o.rule})`)}for(let o of n.discarded)t(` discarded ${o}`)}import{copyFileSync as Yr,existsSync as je,mkdirSync as Gr}from"fs";import{join as Pt}from"path";function Kr(t,e,r){try{let n=Pt(t,"auteur","execution.json");if(je(n))return!0;for(let i of e)if(!(!i||!je(i)))return Gr(Pt(t,"auteur"),{recursive:!0}),Yr(i,n),!0}catch(n){try{r?.("debug","EVIDENCE_BLOB_COPY_FAILED","auteur execution blob copy failed",{operation:"ensureAuteurExecution",source:e.find(i=>i&&je(i))??null,error:n instanceof Error?n.message:String(n)})}catch{}}return!1}import{readFileSync as Wr}from"fs";import{join as Jr}from"path";function Ne(t){let e=[],r=!0,n=o=>{if(o===null||typeof o!="object")return;let a=o;if(Array.isArray(a.operations))for(let s of a.operations){let c=s?.operation_id;typeof c=="string"&&c&&e.push(c)}if(Array.isArray(a.children)){a.content_type!=="generative_block"&&(r=!1);for(let s of a.children)n(s)}if(Array.isArray(a.branches)){r=!1;for(let s of a.branches){let c=s?.children;if(Array.isArray(c))for(let d of c)n(d)}}},i=t?.instructions;if(Array.isArray(i))for(let o of i)n(o);return{ids:e,linear:r}}function Xr(t){return Ne(t).ids}function Te(t,e){let r=new Set(e.map(s=>s.action_id).filter(Boolean)),n=-1;for(let s of r){let c=t.indexOf(s);c>n&&(n=c)}let i=e.reduce((s,c)=>Math.max(s,c.ordinal),0),o=new Set,a=[];for(let s of t.slice(n+1))r.has(s)||o.has(s)||(o.add(s),a.push({id:s,ordinal:++i,status:"skipped",action_id:s}));return a}function Ct(t,e){let r=new Set(e),n=t.filter(o=>o.action_id);if(n.some(o=>r.has(o.action_id))||n.length>e.length)return null;let i=0;return t.map(o=>o.action_id?{...o,action_id:e[i++]}:o)}function Zr(t,e){if(t.length>e.length)return!1;for(let r=0;r<t.length;r++)if(e[r]!==t[r].action_id)return!1;return!0}function Qr(t,e,r,n=!0){if(e.length===0)return{steps:t,tail:[]};let i=(r&&n?Ct(t,e):null)??t,o=i.filter(s=>s.action_id),a=new Set(e);return o.length>0&&o.every(s=>a.has(s.action_id))?{steps:i,tail:Te(e,i)}:o.length>0&&!Zr(o,e)?{steps:i,tail:[],unjoined:!0}:{steps:i,tail:Te(e,i)}}function $t(t){try{let e=Wr(Jr(t,"auteur","execution.json"),"utf8");return Ne(JSON.parse(e))}catch{return{ids:[],linear:!0}}}function qr(t){return $t(t).ids}export{$ as a,re as b,ne as c,ie as d,oe as e,se as f,ae as g,ce as h,de as i,Ft as j,ue as k,le as l,Lt as m,jt as n,pe as o,ge as p,ve as q,he as r,we as s,ye as t,Tt as u,Nt as v,_e as w,Vt as x,xe as y,ke as z,be as A,st as B,Ie as C,Ee as D,dt as E,Wt as F,T as G,er as H,_t as I,xt as J,kt as K,xr as L,kr as M,br as N,Ir as O,bt as P,De as Q,V as R,Oe as S,Ae as T,jr as U,Fe as V,Hr as W,Kr as X,Ne as Y,Xr as Z,Te as _,Ct as $,Qr as aa,$t as ba,qr as ca};
|
package/dist/chunk-V3UE6RJP.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{extname as o}from"path";var s={kind:"jira",media_type:"application/x-kane-jira-envelope",extensions:[],cite:"verbatim",maxBytes:2e6},n=[{kind:"text",media_type:"text/plain",extensions:[".txt"],cite:"verbatim",maxBytes:2e6},{kind:"markdown",media_type:"text/markdown",extensions:[".md",".markdown"],cite:"verbatim",maxBytes:2e6},{kind:"image",media_type:"image/png",extensions:[".png"],cite:"anchor-only",maxBytes:5e6},{kind:"image",media_type:"image/jpeg",extensions:[".jpg",".jpeg"],cite:"anchor-only",maxBytes:5e6},{kind:"image",media_type:"image/webp",extensions:[".webp"],cite:"anchor-only",maxBytes:5e6},{kind:"text",media_type:"application/json",extensions:[".json"],cite:"verbatim",maxBytes:2e6},{kind:"text",media_type:"application/yaml",extensions:[".yaml",".yml"],cite:"verbatim",maxBytes:2e6},{kind:"text",media_type:"application/toml",extensions:[".toml"],cite:"verbatim",maxBytes:2e6},{kind:"text",media_type:"application/xml",extensions:[".xml"],cite:"verbatim",maxBytes:2e6},{kind:"text",media_type:"text/plain",extensions:[".log"],cite:"verbatim",maxBytes:2e6},{kind:"pdf",media_type:"application/pdf",extensions:[".pdf"],cite:"verbatim",maxBytes:25e6,sniff:e=>e.subarray(0,5).toString("latin1")==="%PDF-"},{kind:"docx",media_type:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",extensions:[".docx"],cite:"verbatim",maxBytes:25e6,sniff:e=>e.length>=4&&e[0]===80&&e[1]===75&&e[2]===3&&e[3]===4,sniffFail:e=>e.length>=8&&e.subarray(0,8).equals(d)?"DOCX_ENCRYPTED_OR_LEGACY: password-protected Office file (or a legacy .doc renamed .docx) \u2014 remove the password / save as .docx and re-ingest":void 0},s],d=Buffer.from([208,207,17,224,161,177,26,225]),x={pdf:"pdf",docx:"docx",jira:"jira"},r=new Set(Object.keys(x));function p(e){let a=o(e).toLowerCase(),i=n.find(t=>t.extensions.includes(a));return i?{ok:!0,media:i}:{ok:!1,code:"UNSUPPORTED_MEDIA",allowlist:n.flatMap(t=>t.extensions)}}export{s as a,x as b,r as c,p as d};
|
package/dist/chunk-Y5RNCJAN.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{c as g}from"./chunk-5EOX4MEY.js";var h={ASR_CMD_START:"info",ASR_CMD_END:"info",ASR_AGENT_SPAWN:"info",ASR_WORK_ITEM_START:"info",ASR_WORK_ITEM_END:"info",ASR_PROPOSAL:"info",ASR_VALIDATE_FAILED:"warn",ASR_COMMIT:"info",ASR_SESSION_PAUSED:"info",ASR_SESSION_RESUMED:"info",ASR_SESSION_COMPLETE:"info",ASR_AGENT_EXIT:"warn",ASR_RECONCILE_PLAN:"info",ASR_RECONCILE_ROW_END:"info",ASR_HIGH_RISK_CI:"warn",ASR_INGEST:"info",ASR_CONTEXT_CLONED:"warn",ASR_ERROR:"error",ASR_CRASH:"error"},O={ASR_CMD_START:["source_count","resumed","applied_plan"],ASR_CMD_END:["exit_code","duration_ms","credits_total","work_items_total","work_items_failed"],ASR_AGENT_SPAWN:["tier","duration_ms"],ASR_WORK_ITEM_START:["work_item_index","work_item_count","source_kind"],ASR_WORK_ITEM_END:["work_item_index","work_item_count","outcome","duration_ms","error_domain","error_code"],ASR_PROPOSAL:["item_count","turn_index"],ASR_VALIDATE_FAILED:["error_code","count","turn_index"],ASR_COMMIT:["trusted","derived","archived","items","items_dropped","record_seq"],ASR_SESSION_PAUSED:["pending_questions","pending_proposals"],ASR_SESSION_RESUMED:["resume_count","expired_session_id"],ASR_SESSION_COMPLETE:["duration_ms","credits_total"],ASR_AGENT_EXIT:["exit_code","signal"],ASR_RECONCILE_PLAN:["row_count","add_count","modify_count","archive_count"],ASR_RECONCILE_ROW_END:["row_index","kind","outcome","duration_ms"],ASR_HIGH_RISK_CI:["count"],ASR_INGEST:["work_item_index","work_item_count","format","bytes","media_facts"],ASR_CONTEXT_CLONED:[],ASR_ERROR:["error_domain","error_code","exit_code","turn_index"],ASR_CRASH:["error_domain","error_code","error_name"]},k=[[/^(auth_expired|401|preflight_auth|AUTH)/i,"auth"],[/^(credit_denied|402|CREDIT)/i,"credit"],[/^(stream_drop|read_timeout|connect_failed|dns|E(CONN|AI_AGAIN|TIMEDOUT)|network)/i,"network"],[/^(frame_parse|post_terminal_data|eof_without_terminal|turn_id_mismatch|binding_mismatch|schema_invalid|frame_too_large|protocol)/i,"protocol"],[/^(provider_error|http_5\d\d|turn_exhausted|adapter_integrity)/i,"provider"],[/^(STALE_BASIS|R\d+|validation|criteria)/i,"validation"],[/^(BLOB_MISSING|SOURCE_UNKNOWN|SESSION_(LOCKED|EXPIRED|MISSING|LOCK_LOST)|NO_STORE|fsck|store)/i,"store"],[/^(usage|EX2|SOURCE_WITH_RESUME|HIGH_RISK_CI|bad_flag|no_tty)/i,"usage"],[/^agent_(crash|exit)/i,"agent_crash"]];function D(e){let t=(e||"unknown").slice(0,64);for(let[n,r]of k)if(n.test(t))return{error_domain:r,error_code:t};return{error_domain:"cli_crash",error_code:t}}import{randomBytes as L}from"crypto";var v=/^(uc|sc|ac|t|gap|sty)-\d+$/,$="0123456789abcdefghijklmnopqrstuvwxyz";function b(e){let t="",n=L(e);for(let r=0;r<e;r++)t+=$[n[r]%36];return t}function q(e=new Date){let t=(r,o)=>String(r).padStart(o,"0");return`as-${`${e.getUTCFullYear()}${t(e.getUTCMonth()+1,2)}${t(e.getUTCDate(),2)}T${t(e.getUTCHours(),2)}${t(e.getUTCMinutes(),2)}`}-${b(8)}`}var C=-1,S=0;function z(e=new Date){let t=e.getTime(),n=L(10);t===C?S=S+1&4095:(C=t,S=(n[0]<<8|n[1])&4095);let r=Buffer.alloc(16);r.writeUIntBE(t,0,6),r[6]=112|S>>8,r[7]=S&255,r[8]=128|n[2]&63,n.copy(r,9,3,10);let o=r.toString("hex");return`${o.slice(0,8)}-${o.slice(8,12)}-${o.slice(12,16)}-${o.slice(16,20)}-${o.slice(20)}`}var U=64,G=128,P=/^[A-Za-z0-9._:@\/-]+$/,H=0;function W(e,t){if(typeof t=="number"&&Number.isFinite(t)||typeof t=="boolean")return t;if(typeof t!="string")return;let n=e.endsWith("_id")||e==="signal"?G:U;if(!(t.length===0||t.length>n)&&P.test(t))return t}function w(e,t,n={}){let r=O[t],o={};for(let i of r){let s=n[i];if(s==null)continue;if(i==="items"){let u=Array.isArray(s)?s.filter(y=>typeof y=="string"):[],f=u.filter(y=>v.test(y));f.length>0&&(o.items=f.slice(0,50).join(","));let p=u.length-f.length;p>0&&(o.items_dropped=p);continue}let a=W(i,s);a!==void 0&&(o[i]=a)}if(typeof n.error_code=="string"&&r.includes("error_code")){let{error_domain:i,error_code:s}=D(n.error_code);o.error_code=s,r.includes("error_domain")&&(o.error_domain=i)}return{level:h[t],event:t,message:t,session_id:e.session_id,operation_id:e.operation_id,...e.parent_operation_id?{parent_operation_id:e.parent_operation_id}:{},...e.agent_session_id?{agent_session_id:e.agent_session_id}:{},context_lineage_id:e.context_lineage_id??null,context_instance_id:e.context_instance_id??null,verb:e.verb,mode:e.mode,component:"kane-cli",seq:H++,event_time:new Date().toISOString(),context:o}}import _ from"fs";import F from"path";var K=500,j=7;function M(e){if(e.length!==0)try{let t=g();_.mkdirSync(F.dirname(t),{recursive:!0});let n=e.map(r=>JSON.stringify(r)).join(`
|
|
3
|
-
`)+`
|
|
4
|
-
`;_.appendFileSync(t,n,{flag:"a",mode:384}),V()}catch{}}async function re(e){let t=g(),n=`${t}.claim-${process.pid}`,r;try{_.renameSync(t,n),r=_.readFileSync(n,"utf8")}catch{return}let o=[];for(let i of r.split(`
|
|
5
|
-
`))if(i.trim())try{o.push(JSON.parse(i))}catch{}try{(o.length===0?!0:await e(o))?_.unlinkSync(n):(_.appendFileSync(t,r,{flag:"a",mode:384}),_.unlinkSync(n))}catch{try{_.appendFileSync(t,r,{flag:"a",mode:384}),_.unlinkSync(n)}catch{}}}function V(e=K,t=j){try{let n=g(),o=_.readFileSync(n,"utf8").split(`
|
|
6
|
-
`).filter(u=>u.trim()),i=Date.now()-t*24*3600*1e3,a=o.filter(u=>{try{let f=JSON.parse(u),p=Date.parse(f.event_time??f.timestamp??"");return Number.isNaN(p)||p>=i}catch{return!1}}).slice(-e);a.length!==o.length&&_.writeFileSync(n,a.length?a.join(`
|
|
7
|
-
`)+`
|
|
8
|
-
`:"",{mode:384})}catch{}}var l=null;function _e(e){l=e}function ce(){return l}var I=()=>!!process.env.KANE_DEV_MODE,c=[],R=!1,N=null,A=null,x=null,d=null,E=[];function ae(e){if(d=e,e&&E.length>0){let t=E;E=[];for(let n of t)try{e.log(n.level,n.event,n.message,n.context)}catch{}}}function de(e,t,n,r){if(d){try{d.log(e,t,n,r)}catch{}return}E.push({level:e,event:t,message:n,context:r})}function le(){return d}function ue(){return R}function fe(e,t){c=c.filter(n=>n.name!==e),c.push({name:e,fn:t})}function pe(e){c=c.filter(t=>t.name!==e)}function Se(e,t){let n=c.find(o=>o.name===e);if(!n)return;c=c.filter(o=>o.name!==e);let r=!0;try{n.fn()}catch(o){r=!1,process.stderr.write(`[exit-manager] cleanup(${e}) failed: ${o instanceof Error?o.message:String(o)}
|
|
9
|
-
`)}t&&r&&I()&&process.stderr.write(`[exit-manager] cleanup(${e}): ${t}
|
|
10
|
-
`)}function m(e,t,n=!1,r){if(R){process.exit(N??e);return}if(R=!0,N=e,n&&d)try{d.log("error","CRASH",t),d.shutdownSync()}catch{}if(n&&l&&e!==130&&e!==143)try{let s=/Uncaught exception:\s*([A-Za-z0-9_$]+)/.exec(t)?.[1]??"crash";M([w(l,"ASR_CRASH",{error_code:"cli_crash",error_name:s})])}catch{}let o=[...c].reverse(),i=[];for(let s of o)try{s.fn(),i.push(s.name)}catch(a){process.stderr.write(`[exit-manager] cleanup(${s.name}) failed: ${a instanceof Error?a.message:String(a)}
|
|
11
|
-
`)}if(c=[],I()&&(process.stderr.write(`[exit-manager] shutdown(${e}): ${t}
|
|
12
|
-
`),i.length>0&&process.stderr.write(`[exit-manager] cleaned up: ${i.join(", ")}
|
|
13
|
-
`)),n){if(x)try{x()}catch{}e===130||e===143||(process.stderr.write(`
|
|
14
|
-
kane-cli crashed: ${t}
|
|
15
|
-
`+(i.length>0?`Resources cleaned up (${i.join(", ")}).
|
|
16
|
-
`:"")),l&&process.stderr.write(`session: ${l.session_id} \u2014 share this id with support
|
|
17
|
-
`),r&&I()?process.stderr.write(`${r}
|
|
18
|
-
`):process.stderr.write(`(re-run with KANE_DEV_MODE=1 for the full stack)
|
|
19
|
-
`)),process.exit(e);return}if(A&&!n){A();return}process.exit(e)}function Ee(e){A=e}function ge(e){x=e}var T=!1;function me(){T||(T=!0,process.on("SIGINT",()=>{m(130,"Received SIGINT",!0)}),process.on("SIGTERM",()=>{m(143,"Received SIGTERM",!0)}),process.on("uncaughtException",e=>{m(1,`Uncaught exception: ${e.name}: ${e.message}`,!0,e.stack)}),process.on("unhandledRejection",e=>{m(1,`Unhandled rejection: ${String(e)}`,!0,e instanceof Error?e.stack:void 0)}))}function Re(){c=[],R=!1,N=null,A=null,x=null,d=null,E=[],T=!1,l=null}export{h as a,q as b,z as c,w as d,M as e,re as f,_e as g,ce as h,ae as i,de as j,le as k,ue as l,fe as m,pe as n,Se as o,m as p,Ee as q,ge as r,me as s,Re as t};
|
package/dist/chunk-Z2JSEL3I.js
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{b as B,d as F}from"./chunk-V3UE6RJP.js";import{b as M}from"./chunk-DNNZ353O.js";import{a as k}from"./chunk-Q2F5QB2W.js";import{b as w,c as p}from"./chunk-NVGBE2DR.js";import{a as A}from"./chunk-7E24OCGX.js";import{a as N,c as L}from"./chunk-6HYW5RFX.js";import{e as R}from"./chunk-J2KSZUOO.js";import{a as O,d as C,f as $}from"./chunk-5YPBPZUR.js";import{existsSync as V,mkdirSync as H,readFileSync as K,writeFileSync as Z}from"fs";import{basename as X,extname as U,join as Y}from"path";var T=/^[A-Za-z0-9][A-Za-z0-9._-]*$/;function z(e){return typeof e=="string"&&e!=="."&&e!==".."&&T.test(e)}function S(e){if(!z(e))throw new Error(`unsafe logical_id: ${JSON.stringify(e)} \u2014 must match ${String(T)} (no path separators)`)}function q(e,r,t){return k({source_id:e,source_cid:"sha256:".padEnd(71,"0"),doc_kind:r,numbered_text:M(t)})}var P=2e3;function Q(e){let t=X(e,U(e)).toLowerCase().replace(/[^a-z0-9._-]+/g,"-").replace(/^[^a-z0-9]+/,"");return S(t),t}function me(e){let r=/^(.*?)[-_.]?v?\d+$/.exec(e);if(!r)return null;let t=(r[1]??"").replace(/[-_.]+$/,"");return t.length>0&&t!==e?t:null}function j(e){let r=Y(e,"meta.json");V(r)||(H(e,{recursive:!0}),Z(r,JSON.stringify({schema:O,canonicalizer:"v1"},null,2)+`
|
|
3
|
-
`))}async function fe(e){let{contextDir:r,filePath:t,asId:o,confirmSameSource:f,converters:b}=e;j(r);let n=K(t),s=F(t);if(!s.ok)throw new Error(`UNSUPPORTED_MEDIA: ${U(t)} \u2014 supported: ${s.allowlist.join(" ")}`);if(n.byteLength>s.media.maxBytes)throw new Error(`FILE_TOO_LARGE: ${n.byteLength} bytes > ${s.media.maxBytes} cap for ${s.media.media_type}`);if(s.media.sniff&&!s.media.sniff(n)){let c=s.media.sniffFail?.(n);throw new Error(c??`MEDIA_SNIFF_MISMATCH: ${t} does not look like ${s.media.media_type}`)}let d;return o!==void 0?(S(o),d=o):d=Q(t),W({contextDir:r,bytes:n,media:s.media,sourceId:d,label:t,confirmSameSource:f,converters:b})}async function W(e){let{contextDir:r,bytes:t,media:o,confirmSameSource:f,converters:b}=e,n=e.sourceId,s=e.label??n;if(j(r),t.byteLength>o.maxBytes)throw new Error(`FILE_TOO_LARGE: ${t.byteLength} bytes > ${o.maxBytes} cap for ${o.media_type}`);let d=[],c=B[o.kind];if(o.cite==="verbatim"&&!c){try{new TextDecoder("utf-8",{fatal:!0}).decode(t)}catch{throw new Error(`ENCODING_UNSUPPORTED: ${s} is not valid UTF-8 \u2014 re-save it as UTF-8 and re-ingest`)}t.toString("utf8").split(`
|
|
4
|
-
`).some(a=>a.length>P)&&d.push(`long line detected (> ${P} chars) \u2014 anchors lose granularity; consider pretty-printing before ingest`)}let l=w(t),g=A(r),u=g.heads.get(n),G=u!=null?g.getNode(u)?.content:void 0;if(u!=null&&G?.blob===l)return{status:"unchanged",source_id:n,cid:u,blob:l};if(u==null){for(let[a,i]of g.heads.entries())if(!(a===n||i==null)&&g.getNode(i)?.content.blob===l){if(f&&await f(a))return{status:"unchanged",source_id:a,cid:i,blob:l};break}}let I={},y,m=null,h=null;if(c){let a=b?.[c];if(!a)throw new Error(`${c.toUpperCase()}_CONVERTER_MISSING: ${c} ingestion requires the converter \u2014 the command layer wires it`);let i=await a(t);m=Buffer.from(i.projection,"utf8");let x=q(n,o.kind,m);if(x>4e5)throw new Error(`PROJECTION_TOO_LARGE: serialized source payload ${x} bytes > ${4e5} \u2014 split the document and re-ingest`);I={text_blob:w(m),...i.inventory.length>0?{images:i.inventory}:{},converter:i.converter},h=i.blobs,y={kind:o.kind,...i.pages!==void 0?{pages:i.pages}:{},delivered:i.delivered.length,omitted:i.inventory.length-i.delivered.length}}if(p(r,t),m!==null&&p(r,m),h!==null)for(let[,a]of h)p(r,a);let _=L(n,l),v=$("source",_);if(v.length>0)throw new Error(`source node fails ${v[0].code}: ${v[0].detail}`);let E=N("source",_);return R(r,{ts:new Date().toISOString(),proposal_id:null,nodes:[{cid:E,label:C.SOURCE,content:_}],edges:[],review:[],supersessions:[],media:{[n]:{format:o.kind,media_type:o.media_type,anchors_supported:c?["L-L","img#ref"]:o.cite==="verbatim"?["L-L"]:[],...I}},source_head_moves:{[n]:E}}),{status:u!=null?"versioned":"created",source_id:n,cid:E,blob:l,...d.length?{warnings:d}:{},...y?{composite:y}:{}}}export{S as a,q as b,Q as c,me as d,fe as e,W as f};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as d,b as w,d as x}from"./chunk-GRB66C5S.js";import"./chunk-RN4OSVTG.js";import{e as b,f as k}from"./chunk-CJJXT5DO.js";import{d as $}from"./chunk-QM4S2APK.js";import"./chunk-BC7UVJJB.js";import{e as v}from"./chunk-EHN5HTUD.js";import{a as h}from"./chunk-L5LI2JF4.js";import{a as y}from"./chunk-7E24OCGX.js";import"./chunk-FRBYGSGJ.js";import"./chunk-6W6AIDLJ.js";import"./chunk-6HYW5RFX.js";import"./chunk-J2KSZUOO.js";import"./chunk-5YPBPZUR.js";import"./chunk-IAHKTEET.js";import"./chunk-UR6MHSHU.js";import{basename as f}from"path";import{statSync as R}from"fs";function S(s,e){if(!s)return 1;let r=s.resolve(e);return!r||r.superseded?1:s.getNode(r.tip)?.content.risk==="high"?3:1}function C(s,e){return s.usecases.map(r=>{let n=r.acceptance_criteria??[],a=n.filter(o=>(o.covered_by??[]).length>0),u=n.filter(o=>o.execution==="passed"),c=n.filter(o=>o.execution==="failed"),p=n.filter(o=>o.execution==="blocked"),i=0,l=0;for(let o of n){let g=S(e,o.id);i+=g,o.execution==="passed"&&(l+=g)}let t=i===0?0:Math.round(100*l/i),m=a.length===0?"uncovered":n.length===u.length?"covered":p.length>0&&c.length===0?"blocked":"partial";return{id:r.id,title:r.title,status:m,pct:t,acs:{total:n.length,covered:a.length,passed:u.length,failed:c.length,blocked:p.length},stale:n.filter(o=>o.fresh==="stale").map(o=>o.id)}})}async function A(s){let e=await b(s);return e.length===0?null:e.map(r=>({p:r,m:R(r).mtimeMs})).sort((r,n)=>n.m-r.m)[0].p}var D={covered:"\u2714",partial:"\u25D0",uncovered:"\u2716",blocked:"\u23F8"};function G(s){let e=Math.round(s/10);return"\u2588".repeat(e)+"\u2591".repeat(10-e)}async function E(s,e=x(),r=process.cwd()){let n=w(r,e);if(!n)return 2;let a=s.from?await k(s.from,r):await A(r);if(!a)return d(e,s.from?`no evidence pack at '${s.from}'`:"no evidence pack in .testmuai/evidence \u2014 run a test first, or pass --from <pack>"),2;let u=await v(a,"coverage/usecases.yaml");if(u==null)return d(e,`${f(a)} carries no coverage/usecases.yaml \u2014 the pack predates coverage or its project had no .context at seal time`),2;let c=h(u);if(!c||!Array.isArray(c.usecases))return d(e,`${f(a)}: coverage/usecases.yaml is not a usecases document`),2;let p=y(n),i=C(c,p),l=await $(p,"design");if(s.json)return e.out(JSON.stringify({pack:a,depth:i,completeness:l},null,2)),0;e.out(`coverage \u2014 ${f(a)}`),e.out(""),e.out("depth (proven by the pack):");for(let t of i){let m=t.stale.length?` \xB7 ${t.stale.length} stale`:"";e.out(` ${D[t.status]} ${G(t.pct)} ${String(t.pct).padStart(3)}% ${t.id} \u2014 ${t.status} (${t.acs.passed}/${t.acs.total} ACs proven${t.acs.failed?`, ${t.acs.failed} failed`:""}${t.acs.blocked?`, ${t.acs.blocked} blocked`:""})${m}`)}e.out(""),e.out("completeness (live graph):"),l.length===0&&e.out(" no design gaps \u2014 every AC verified, every use-case scenarioed");for(let t of l)e.out(` [${t.risk}] ${t.tag} ${t.ref} \u2014 ${t.why}`),e.out(` \u2192 ${t.ready_command}`);return 0}export{E as coverCommand,C as depthRows};
|
package/dist/dossier-KJSJPWOW.js
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as u}from"./chunk-IQODWB32.js";import"./chunk-6W6AIDLJ.js";import"./chunk-6HYW5RFX.js";import"./chunk-J2KSZUOO.js";import"./chunk-5YPBPZUR.js";import"./chunk-IAHKTEET.js";import"./chunk-UR6MHSHU.js";var w=i=>`cite ${i.source_id??"?"} ${i.anchor??""}${i.quote?` \u2014 "${i.quote}"`:""}`;function C(i,_){let l=i.resolve(_);if(!l)return null;let c=l.tip,$=i.nodeLabel.get(c);if(!$)return null;let y=i.getNode(c);if(!y)return null;let s=y.content,f=i.displayNameOf(c)??_,d=[],r=(e,t,n=!1)=>{d.push({text:`${e.padEnd(12)} ${t}`,dim:n})},S=i.trust.get(c)??"derived";r("status",`${S}${i.superseded.has(c)?" \xB7 superseded":""}`,!0);let k=typeof s.risk=="string"?s.risk:null;k&&r("risk",k);for(let[e,t]of[["title",null],["description","description"],["value","value"],["summary","summary"],["statement","statement"],["text","text"],["intent","intent"],["case_type","case type"],["technique_notes","technique"],["kind","kind"],["change_note","change"]]){if(!t)continue;let n=s[e];typeof n=="string"&&n&&r(t,n)}let p=[];{let e=l.cid,t=new Set;for(;!t.has(e);){t.add(e),p.push(e);let n=i.superseded.get(e);if(typeof n!="string")break;e=n}}let g=p.flatMap(e=>i.edgesInto(e)).filter(e=>e.type==="DERIVES"),x=e=>{if(!e.source_cid||!e.anchor)return;let t=/^L(\d+)-L(\d+)$/.exec(e.anchor);if(!t)return;let n=i.getNode(e.source_cid)?.content?.text_blob;if(typeof n!="string")return;let o=n.split(`
|
|
3
|
-
`).slice(Number(t[1])-1,Number(t[2])).join(" ").trim();return o?o.length>120?`${o.slice(0,119)}\u2026`:o:void 0},h=new Map;for(let e of g){let t=e.props;t.claim&&h.set(t.claim,{source_id:t.source_id,anchor:t.anchor,quote:x(t)})}let L=Array.isArray(s.criteria)?s.criteria:[];for(let[e,t]of L.entries()){r(e===0?"criteria":"",`${e+1}. ${t}`);let n=h.get(t);n&&d.push({text:` ${w(n)}`,dim:!0})}let b=g.find(e=>!e.props.claim);if(b){let e=b.props;d.push({text:` ${w({...e,quote:x(e)})}`,dim:!0})}let a=s.check;a?.kind&&r("check",`${a.kind}${a.verified_against?` vs ${u(String(a.verified_against))}`:""}`);let m=s.expected_answer;m?.operator&&r("expects",`${m.operator} \xB7 ${String(m.operand??"")}`);let v=new Set,q=!0;for(let e of g){let t=e.props,n=`${t.source_id??"?"}@${t.source_cid??e.src}`;v.has(n)||(v.add(n),r(q?"provenance":"",`${t.source_id??"?"} @ ${String(t.source_cid??e.src).slice(7,15)}`,!0),q=!1)}let D=p.flatMap(e=>i.edgesFrom(e)).filter(e=>e.type==="depends_on");for(let[e,t]of D.entries()){let n=String(i.getNode(i.tipOf(t.dst))?.content?.title??""),o=i.displayNameOf(t.dst);r(e===0?"depends on":"",`${o?u(o):t.dst.slice(0,12)}${n?` ${n}`:""}`)}return{id:u(f),rawId:f,title:String(s.title??s.text??s.statement??f),label:$,lines:d}}export{C as buildDossier};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{$ as fa,A as J,B as K,C as L,D as M,E as N,F as O,G as P,H as Q,L as R,M as S,N as T,O as U,P as V,Q as W,R as X,S as Y,T as Z,U as _,V as $,W as aa,X as ba,Y as ca,Z as da,_ as ea,a,aa as ga,b,ba as ha,c,ca as ia,d,e,f,g,h,i,j,k as t,l as u,m as v,n as w,o as x,p as y,q as z,r as A,s as B,t as C,u as D,v as E,w as F,x as G,y as H,z as I}from"./chunk-UXPQRALY.js";import"./chunk-FCMLIK7P.js";import{a as n,b as o,c as p,e as q,f as r,g as s}from"./chunk-CJJXT5DO.js";import"./chunk-QM4S2APK.js";import"./chunk-ZPDM6FO7.js";import"./chunk-BC7UVJJB.js";import"./chunk-NVGBE2DR.js";import{a as k,b as l,c as m}from"./chunk-EHN5HTUD.js";import"./chunk-L5LI2JF4.js";import"./chunk-7E24OCGX.js";import"./chunk-FRBYGSGJ.js";import"./chunk-6W6AIDLJ.js";import"./chunk-6HYW5RFX.js";import"./chunk-J2KSZUOO.js";import"./chunk-5YPBPZUR.js";import"./chunk-IAHKTEET.js";import"./chunk-A2IQRVPR.js";import"./chunk-B4LLKQTK.js";import"./chunk-UR6MHSHU.js";export{P as EvidenceSession,C as appendExecutionPointer,M as assembleExecutionEnv,i as buildEnvironment,j as buildEvidenceRunConfig,g 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,da as flattenAuteurLeafIds,ca as flattenAuteurLeaves,T as inlineEvidenceBlock,q as listPacks,p as newExecutionId,h as normalizeOs,S as noteInlineSpawn,$ as offerEvidenceView,o as packPath,I as packTestLogsDir,V as parseRange,D as readExecutionPointers,ia as readPackLeafIds,ha as readPackLeaves,s as recoverStore,fa as remapReplayActionIds,r as resolvePack,ga 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,d as shortHash,c as slugify,W as startEvidenceLocalServer,R as startInlineEvidence,n as storeDir,m as sweepStore,ea as synthesizeSkippedTail,f as testIdForInline,e as testIdForTestmd,k as validatePack,a as verdictFromResultCode,X as viewerBaseFor,Y as viewerUrlFor,b as worstOf,G as worstResultCode,B as writeLogsMeta,A as writeResult};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a,b,c,d,e,f,g}from"./chunk-4XSW6WZD.js";import"./chunk-GRB66C5S.js";import"./chunk-JFAFKHDX.js";import"./chunk-3C5GMAM4.js";import"./chunk-RN4OSVTG.js";import"./chunk-DNNZ353O.js";import"./chunk-BC7UVJJB.js";import"./chunk-NVGBE2DR.js";import"./chunk-7E24OCGX.js";import"./chunk-FRBYGSGJ.js";import"./chunk-6W6AIDLJ.js";import"./chunk-6HYW5RFX.js";import"./chunk-J2KSZUOO.js";import"./chunk-5YPBPZUR.js";import"./chunk-IAHKTEET.js";import"./chunk-UR6MHSHU.js";export{b as designStateOf,g as evolveCommand,c as evolveOneUc,f as liveRunDesignForUc,a as resolveParentUc,e as runEvolveCommand,d as staleTargets};
|
package/dist/explain-EBVIUS2X.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{e as Y,f as E}from"./chunk-DGIPQINV.js";import"./chunk-K7USHLVZ.js";import"./chunk-JSF5JYZC.js";import"./chunk-J44RN3FB.js";import"./chunk-JFAFKHDX.js";import{c as V}from"./chunk-YKTYVJBN.js";import"./chunk-CVOGP253.js";import"./chunk-427OQS2N.js";import{a as x}from"./chunk-N4LMQR7C.js";import{a as z}from"./chunk-3C5GMAM4.js";import"./chunk-GG43HSU2.js";import"./chunk-FMR2KPSK.js";import{d as N}from"./chunk-RCTM7NGT.js";import{c as I}from"./chunk-RN4OSVTG.js";import"./chunk-V3UE6RJP.js";import"./chunk-DNNZ353O.js";import{a as M,b as R}from"./chunk-WTXHOWUP.js";import"./chunk-FHKDTM5L.js";import"./chunk-2XMJ6YAE.js";import"./chunk-BKM2LWU2.js";import{a as P}from"./chunk-BC7UVJJB.js";import"./chunk-NVGBE2DR.js";import"./chunk-7E24OCGX.js";import"./chunk-FRBYGSGJ.js";import"./chunk-6W6AIDLJ.js";import"./chunk-6HYW5RFX.js";import"./chunk-J2KSZUOO.js";import"./chunk-5YPBPZUR.js";import"./chunk-IAHKTEET.js";import"./chunk-Y5RNCJAN.js";import"./chunk-5EOX4MEY.js";import"./chunk-RZ4F3BHX.js";import"./chunk-B4LLKQTK.js";import"./chunk-UR6MHSHU.js";async function W(o){let[{render:e},t,{QuestionBatchPrompt:m}]=await Promise.all([import("./build-JIKYOZUH.js"),import("./react-QWOAB3TB.js"),import("./ui-JEJGTURD.js")]),p=t.default??t;return new Promise(f=>{let n=e(p.createElement(m,{questions:o,onSubmit:h=>{n.unmount(),f(h)}}))})}async function J(o,e){let[{render:t},m,{ReviewChecklist:p}]=await Promise.all([import("./build-JIKYOZUH.js"),import("./react-QWOAB3TB.js"),import("./ui-JEJGTURD.js")]),f=m.default??m;return new Promise(n=>{let h=t(f.createElement(p,{items:o.map(a=>{let g=e.get(a.temp_ref);return{uc:a,dedupWith:g&&!g.archived?g.cid:void 0,archivedMatch:g?.archived?{cid:g.cid,reason:g.reason}:void 0}}),onSubmit:a=>{h.unmount(),n(a)}}))})}async function K(o){let{createInterface:e}=await import("readline/promises"),t=e({input:process.stdin,output:process.stdout});try{let m=await t.question(`${o} [y/N] `);return/^y(es)?$/i.test(m.trim())}finally{t.close()}}async function ie(o){let e=P(process.cwd()),t=R({verb:"extract",mode:o.plan?"cli":"interactive",contextRoot:e,env:M(),resumeSid:o.resume,write:!0,longSession:!0}),p={...await N(),...t.spawnEnv()},f=await V(p);if(!f.ok)return process.stderr.write((f.message??"error: turn-endpoint preflight failed")+`
|
|
3
|
-
`),process.stderr.write(t.supportFooter()+`
|
|
4
|
-
`),t.error("preflight_auth"),await t.end({exit_code:2}),2;let n=async()=>f;if(o.plan){let s=await E(o,{contextDir:e,agent:x,preflightTurn:n,ask:W,review:J,confirmStale:K,out:u=>process.stdout.write(u+`
|
|
5
|
-
`),progress:u=>process.stderr.write(u+`
|
|
6
|
-
`),isTTY:I(),auth:p,telemetry:t});return s===1&&process.stderr.write(t.supportFooter()+`
|
|
7
|
-
`),await t.end({exit_code:s}),s}let[{render:h},a,{ScrollbackProvider:g},{ChatSurface:k},{ScrollbackTap:i},{makeChatController:S},{setInkExit:C},H]=await Promise.all([import("./build-JIKYOZUH.js"),import("./react-QWOAB3TB.js"),import("./scrollback-JLPJR25X.js"),import("./ChatSurface-PMEOJBZG.js"),import("./ScrollbackTap-Q3IOKNMS.js"),import("./chat-controller-QLORQWJZ.js"),import("./exit-manager-MXUD7GQ7.js"),Promise.all([import("./chat-committer-OS7ULZMH.js"),import("./descriptor-KXDJ4XYD.js"),import("./explain-EBVIUS2X.js"),import("./readmodel-S5RAQH3F.js")])]),[{commitChatTurn:$},{topologyDescriptor:L},{explain:O},{openGraph:y}]=H,A=a.default??a,c=S({commitChatTurn:$,descriptor:L(),contextDir:e,refreshGraph:()=>y(e),graph:y(e),explain:O,by:{kind:"human",id:"owner"},dedupFlags:s=>Y(s,y(e))}),D={current:null},j=0,_=null,v=!1,Q=()=>{if(j+=1,j>=2){try{b.unmount()}catch{}process.exit(130)}c.requestPause(),_=setTimeout(()=>{v||(v=!0,(async()=>{c.ledger({kind:"interrupted",detail:"the agent did not confirm the pause within 5s"}),await D.current?.flush();try{b.unmount()}catch{}process.exit(130)})())},5e3)},U=await import("./dossier-KJSJPWOW.js"),q=s=>{try{return U.buildDossier(y(e),s)}catch{return null}},B={listUcs:()=>{let s=y(e),u=new Set(c.state.turns.flatMap(r=>(r.items??[]).map(l=>l.title.toLowerCase()))),d={high:0,med:1,low:2};return s.byLabel("usecase").filter(r=>!s.superseded.has(r.cid)).map((r,l)=>{let w=r.content,T=String(w.title??r.cid.slice(0,12)),G=z(s,r.cid),F=G?G.designed_at_cid===r.cid?"current":"stale":void 0;return{key:r.cid,title:T,badge:F==="current"?"designed":F==="stale"?"designed \xB7 stale":u.has(T.toLowerCase())?"drafted this session":"existing",designed:F,risk:w.risk,i:l}}).sort((r,l)=>(d[r.risk??"zz"]??3)-(d[l.risk??"zz"]??3)||r.i-l.i).map(({key:r,title:l,badge:w,designed:T})=>({key:r,title:l,badge:w,designed:T}))},runDesignChild:async(s,u=!1)=>{let[{runDesign:d}]=await Promise.all([import("./run-4LTYFTF2.js")]),r="",l=await d({useCase:s,force:u,mode:"interactive"},{contextDir:e,agent:x,preflightTurn:n,ask:w=>c.ask(w),chat:c,nested:!0,out:w=>{r=w},progress:()=>{},isTTY:!0,auth:p});return l!==0&&r&&c.note(r),l}},b=h(A.createElement(g,null,A.createElement(i,{into:D}),A.createElement(k,{controller:c,verb:"extract",onCtrlC:Q,chain:B,inspect:q})),{exitOnCtrlC:!1});C(()=>b.unmount()),c.ledger({kind:"banner",text:"kane-cli context \xB7 extract \xB7 interactive"});try{let s=E(o,{contextDir:e,agent:x,preflightTurn:n,ask:d=>c.ask(d),review:async d=>new Map(d.map(r=>[r.temp_ref,{resolution:"skipped"}])),confirmStale:async()=>!0,out:d=>c.note(d),progress:()=>{},isTTY:I(),auth:p,chat:c,telemetry:t});s.finally(()=>{v=!0});let u=await s;return u===1&&process.stderr.write(t.supportFooter()+`
|
|
8
|
-
`),await t.end({exit_code:u}),u}finally{v=!0,_&&clearTimeout(_),await D.current?.flush();try{b.unmount()}catch{}}}async function ae(o){let e=R({verb:"extract",mode:o.mode,contextRoot:P(process.cwd()),env:M(),resumeSid:o.resume,write:!0,longSession:!0}),t={...await N(),...e.spawnEnv()},{makeHeadlessIO:m,resolveEncoding:p,guardedChannels:f}=await import("./headless-io-PWW6YKH2.js"),n=m(p(o.mode),"extract"),{makeInterruptGuard:h}=await import("./interrupt-guard-UREUWNRL.js"),a=h(x,i=>n.out(i)),k=f(n,()=>a.interrupted(),/^error: (agent failed|repair run failed|agent ended)/);try{let i=await E(o,{contextDir:P(process.cwd()),agent:a.agent,preflightTurn:()=>V(t),ask:async()=>[],review:async S=>new Map(S.map(C=>[C.temp_ref,{resolution:"skipped"}])),confirmStale:async()=>!1,out:k.out,emit:k.emit,progress:n.progress,isTTY:!1,auth:t,telemetry:e});return a.interrupted()&&i!==3?(n.out("interrupted \u2014 no session saved"),await e.end({exit_code:130}),n.done(130)):(i===1&&n.out(e.supportFooter()),await e.end({exit_code:i}),n.done(i))}catch(i){return n.event({type:"error",message:`error: extract failed: ${i instanceof Error?i.message:String(i)}`}),n.out(`error: extract failed: ${i instanceof Error?i.message:String(i)}`),n.out("hint: per-run trace logs live under .context/logs/ (extract-*.log)"),n.done(1)}finally{a.dispose()}}export{ae as bindExtractHeadless,ie as bindExtractInteractive};
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as s}from"./chunk-BC7UVJJB.js";import"./chunk-UR6MHSHU.js";import{existsSync as d}from"fs";async function l(e){if(e.mode!=null&&!["interactive","agent","ci","override"].includes(e.mode))return process.stderr.write(`extract: --mode must be interactive | agent | ci | override, got '${e.mode}'
|
|
3
|
-
`),2;let n=async(r,t)=>{if(process.stderr.write(r+`
|
|
4
|
-
`),e.mode!=="agent")return 2;let{makeHeadlessIO:a,agentRefusal:c}=await import("./headless-io-PWW6YKH2.js");return c(a("ndjson","extract"),r,t)};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:r}=await import("./headless-io-PWW6YKH2.js"),t=r(e,"extract");if(t)return n(t)}if(!d(s(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
|
|
5
|
-
`),2;let i=e.mode??"interactive";if(i==="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)
|
|
6
|
-
`),2;let{bindExtractInteractive:r}=await import("./extract-bind-3SWPBZX6.js");return r(e)}let{bindExtractHeadless:o}=await import("./extract-bind-3SWPBZX6.js");return o({...e,mode:i})}export{l as extractCommand};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as x,b as J,d as ie}from"./chunk-GRB66C5S.js";import{a as re,b as oe}from"./chunk-3RZ63RBO.js";import"./chunk-RN4OSVTG.js";import{a as X,b as Z,c as ee,d as te,e as ne,f as se}from"./chunk-FCMLIK7P.js";import{e as Q,f as L}from"./chunk-CJJXT5DO.js";import{a as I,b as W,c as M,d as K}from"./chunk-QM4S2APK.js";import"./chunk-ZPDM6FO7.js";import"./chunk-BC7UVJJB.js";import{e as Y}from"./chunk-EHN5HTUD.js";import{a as V}from"./chunk-L5LI2JF4.js";import{a as B}from"./chunk-7E24OCGX.js";import"./chunk-FRBYGSGJ.js";import"./chunk-6W6AIDLJ.js";import"./chunk-6HYW5RFX.js";import"./chunk-J2KSZUOO.js";import{d as R,e as U}from"./chunk-5YPBPZUR.js";import"./chunk-IAHKTEET.js";import"./chunk-UR6MHSHU.js";import{basename as j}from"path";import{statSync as Re}from"fs";function ye(e,t){return e.length===0?"not_run":ee(e,t).verified?"proven":Z(e,t).some(n=>n.verdict==="failed")?"failing":"blocked"}function ce(e,t){let s=null;for(let{cid:p}of e.byLabel(R.TEST))for(let o of e.execHistory(p))(!s||String(o.started_at)>s.started_at)&&(s={execution_id:String(o.execution_id),started_at:String(o.started_at)});if(!s)return null;let n=X[t],r=se(e),c=te(r).aspects[t],i={},d={},l=0,f=0,a=0;for(let p of r.usecases){let o=[];for(let y of p.acceptance_criteria){let u=y.executions??[],_=ye(u,n);o.push(_),_==="failing"?l++:_==="blocked"?f++:_==="not_run"&&a++;let A=[],b;if(_==="failing"){let $=null;for(let P of y.covered_by){let w=e.execHistory(P).map(k=>({verdict:String(k.per_ac?.find(E=>E.ac_ref===y.id)?.verdict??k.verdict),oracle_mode:String(k.oracle_mode),ts:String(k.started_at),execution_id:String(k.execution_id)})).filter(k=>n.counted_verdicts.includes(k.verdict)&&n.accepted_oracle_modes.includes(k.oracle_mode)),O=w[w.length-1];O?.verdict==="failed"&&(A.push(P),(!$||O.ts>$.ts)&&($={ts:O.ts,execution_id:O.execution_id}))}b=$?.execution_id}else _==="blocked"&&(b=u[u.length-1]?.execution_id);i[y.id]={state:_,viaTests:A,...b?{executionId:b}:{}}}let m=o.some(y=>y!=="not_run"),g=c.usecases[p.id],h=m?g.status==="covered"?"proven":g.status==="partial"?"partial":o.includes("failing")?"failing":o.includes("blocked")?"blocked":"not_run":"not_run";d[p.id]={pct:g.pct,status:h}}return{aspect:t,pct:c.summary.coverage_pct,acs_proven:c.summary.acs_verified,failing:l,blocked:f,not_run:a,latest_run:s,perUc:d,perAc:i,config:{...n,source:"graph_execution_facts",denominator:"current_live_acs"}}}var be=["failing","blocked","needs-refresh","needs-tests","needs-scenarios","happy-only","possible-duplicate","not-yet-run"],_e={failing:"failing",blocked:"blocked","needs-refresh":"needs refresh","needs-tests":"needs tests","needs-scenarios":"needs scenarios","happy-only":"happy path only","possible-duplicate":"possible duplicate","not-yet-run":"not yet run"},G={high:0,med:1,low:2};function q(e,t){let s=/^(.*?)(\d+)$/.exec(e),n=/^(.*?)(\d+)$/.exec(t);return s&&n&&s[1]===n[1]?Number(s[2])-Number(n[2]):e<t?-1:e>t?1:0}function F(e){if(!e||/^sha256:/.test(e))return"(unnamed)";let t=/^(uc|ac|sc|t)-(\d+)$/.exec(e);return t?`${t[1].toUpperCase()}-${t[2]}`:e}function de(e,t=5){let s=e.trim().split(/\s+/);return s.slice(0,t).join(" ")+(s.length>t?"\u2026":"")}function $e(e,t){let s=e.resolve(t),n=s?e.getNode(e.tipOf(s.cid))?.content:null;return String(n?.title??n?.text??"")}function ae(e,t){let s=e.resolve(t);return{id:s?e.displayNameOf(e.tipOf(s.cid))??e.displayNameOf(s.cid):null,title:de($e(e,t),8)}}function ke(e,t){let s=e.resolve(t);if(!s)return null;let n=e.tipOf(s.cid);if(!I(e,n))return null;let r=e.nodeLabel.get(n);if(r===R.USECASE)return n;if(r===R.AC)return M(e,n);if(r===R.TEST){let c=e.edgesFrom(n).find(d=>d.type===U.VERIFIES&&I(e,d.dst));if(c)return M(e,c.dst);let i=e.edgesFrom(n).find(d=>d.type===U.AUTOMATES&&I(e,d.dst));if(i){let d=e.edgesFrom(i.dst).find(l=>l.type===U.BELONGS_TO&&I(e,l.dst));return d?d.dst:null}}return null}function N(e){if(e.tag==="reuse-candidate"&&e.stage==="design")return"possible-duplicate";switch(e.kind){case"no-verifies":return"needs-tests";case"zero-scenario":return"needs-scenarios";case"happy-only":return"happy-only";case"stale-ac":case"stale-test":return"needs-refresh";case"execution-failed":return"failing";case"execution-blocked":return"blocked";case"covered-not-run":return"not-yet-run";default:return"other"}}function xe(e,t){let s=e.resolve(t),n=s?e.getNode(e.tipOf(s.cid))?.content.risk:null;return n==="high"||n==="med"||n==="low"?n:"med"}function pe(e,t,s,n,r){let c=r.servePaths??new Map,i=e.byLabel(R.USECASE).filter(({cid:o})=>I(e,o)),d=new Map(i.map(o=>[o.cid,o])),l=new Map(i.map(({cid:o})=>[o,[]])),f=[];for(let o of t){if(o.stage!=="design")continue;let m={...o,...ae(e,o.ref)},g=ke(e,o.ref),h=g?l.get(g):void 0;h&&N(o)!=="other"?h.push(m):f.push(m)}let a=new Map(i.map(({cid:o})=>[o,{total:0,designed:0}]));for(let{cid:o}of e.byLabel(R.AC)){if(!I(e,o))continue;let m=M(e,o),g=m?a.get(m):void 0;if(!g)continue;g.total++;let h=W(e,o);if(h&&g.designed++,!n)continue;let y=e.nameOf.get(o)??o,u=n.perAc[y];if(!u)continue;let{id:_,title:A}=ae(e,y),b={ref:e.displayNameOf(o)??o,id:_,title:A,risk:xe(e,y),stage:"cover"},$=l.get(m);u.state==="failing"?$.push({...b,kind:"execution-failed",tag:"evolve",why:"covering test failed against this AC",ready_command:u.executionId&&c.has(u.executionId)?`kane-cli evidence serve ${c.get(u.executionId)}`:"kane-cli testrun run",via_tests:u.viaTests,...u.executionId?{execution_id:u.executionId}:{},...u.executionId&&c.has(u.executionId)?{servePath:c.get(u.executionId)}:{},...r.testFiles?{viaFiles:u.viaTests.map(P=>r.testFiles.get(P)??null)}:{}}):u.state==="blocked"?$.push({...b,kind:"execution-blocked",tag:"reuse-candidate",why:"the formula could count no run \u2014 broken/skipped or an unaccepted oracle",ready_command:u.executionId&&c.has(u.executionId)?`kane-cli evidence serve ${c.get(u.executionId)}`:"kane-cli testrun run",...u.executionId?{execution_id:u.executionId}:{},...u.executionId&&c.has(u.executionId)?{servePath:c.get(u.executionId)}:{}}):u.state==="not_run"&&h&&$.push({...b,kind:"covered-not-run",tag:"reuse-candidate",why:"a covering test exists but has not run yet",ready_command:"kane-cli testrun run"})}let p=[];for(let{cid:o,content:m}of i){let g=e.displayNameOf(o)??o,h=e.nameOf.get(o)??o,y=s.perUc[g]??{pct:0,status:"undesigned",staleAcs:0},u=n?n.perUc[h]??{pct:0,status:"not_run"}:null,_=n!==null&&(u===null||u.status==="not_run"),A=a.get(o),b=l.get(o)??[],$=new Set(b.filter(v=>N(v)==="needs-refresh").map(v=>v.ref)),P=b.some(v=>N(v)==="needs-tests"&&$.has(v.ref)),w=[];for(let v of be){let T=b.filter(S=>N(S)===v);if(v==="needs-tests"&&(T=T.filter(S=>!$.has(S.ref))),T.length===0)continue;T.sort((S,H)=>(G[S.risk]??3)-(G[H.risk]??3)||q(S.ref,H.ref));let ve=v==="failing"||v==="blocked"||T.length<=2||new Set(T.map(S=>S.ready_command)).size>1;w.push({key:v,label:_e[v],...v==="needs-refresh"?{suffix:"source moved since these were designed"}:{},alsoNeedsTests:v==="needs-refresh"&&P,rows:T,...ve?{}:{rosterCommand:T[0].ready_command}})}let O=w.some(v=>v.key==="failing"),k=w.some(v=>v.key==="blocked"),E=y.pct===100&&(n===null||u?.pct===100)&&w.length===0,me=u!==null&&u.pct>0,he=O?"\u2717":k?"\u23F8":E?"\u2714":y.pct===0&&!me?"\u2716":"\u25D0";p.push({slug:g,title:String(m.title??""),risk:String(m.risk??""),des:y,prov:u,provAbsent:_,acTotal:A.total,acDesigned:A.designed,mark:he,collapse:E,groups:w})}return p.sort((o,m)=>(G[o.risk]??3)-(G[m.risk]??3)||q(o.slug,m.slug)),f.sort((o,m)=>(G[o.risk]??3)-(G[m.risk]??3)||q(o.ref,m.ref)),{stage:r.stage,aspect:r.aspect,top:r.top,dc:s,pa:n,ucs:p,other:f}}function C(e,t){let s=Math.round(e/100*t);return"\u2588".repeat(s)+"\u2591".repeat(t-s)}function z(e){return e===100?"\u2714":e>0?"\u25D0":"\u2716"}function D(e,t){return e==="all"||t.stage===e}function fe(e,t){let{dc:s,pa:n}=e,r=Math.max(80,Math.min(t.width,120)),c=l=>t.color?`\x1B[2m${l}\x1B[22m`:l,i=[];if(n){i.push(`coverage \u2014 designed \xD7 proven \xB7 live graph \xB7 aspect ${n.aspect}`),i.push("");let l=s.ucs_needing_scenarios;i.push(` designed ${z(s.pct)} ${C(s.pct,10)} ${String(s.pct).padStart(3)}% \u2014 ${s.acs_designed} ACs have verifying tests`+(l>0?` \xB7 scenario debt: ${l} UC${l>1?"s":""}`:""));let f=[n.failing>0?`${n.failing} failing`:null,n.blocked>0?`${n.blocked} blocked`:null,n.not_run>0?`${n.not_run} not yet run`:null].filter(Boolean);i.push(` proven ${z(n.pct)} ${C(n.pct,10)} ${String(n.pct).padStart(3)}% \u2014 ${n.acs_proven} proven by execution`+(f.length?` \xB7 ${f.join(" \xB7 ")}`:""))}else i.push("AC design completeness \u2014 live graph (what design owes; execution proof not shown)"),i.push(""),i.push(` designed ${z(s.pct)} ${C(s.pct,10)} ${String(s.pct).padStart(3)}% \u2014 ${s.acs_designed} ACs have verifying tests \xB7 ${s.usecases_complete} UCs complete`),s.ucs_needing_scenarios>0&&i.push(` scenario debt: ${s.ucs_needing_scenarios} use-case${s.ucs_needing_scenarios>1?"s":""} need scenarios`),i.push(" proven \u2014 no runs recorded yet \xB7 run tests, then re-run");i.push("");let d=!1;for(let l of e.ucs){if(i.push(we(l,n!==null,r)),l.collapse)continue;let f=e.top??1/0;for(let a of l.groups){let p=a.rows.filter(h=>D(e.stage,h));if(p.length===0)continue;if(d=!0,f<=0){i.push(c(` \u2026 +${p.length} more ${a.label}`));continue}let o=p.slice(0,f),m=p.length-o.length;if(f-=o.length,(a.key==="needs-scenarios"||a.key==="happy-only")&&o.length===1&&o[0].ref===l.slug){i.push(` ${a.label}${a.key==="needs-scenarios"?" \u2014 design from scratch":""}`),i.push(c(` \u2192 ${o[0].ready_command}`));continue}let g=(a.suffix?` \u2014 ${a.suffix}`:"")+(a.alsoNeedsTests?" \u2014 also needs tests":"");if(i.push(` ${a.label} (${p.length})${g}`),a.rosterCommand&&a.key!=="failing"&&a.key!=="blocked")Se(i,o,r),i.push(c(` \u2192 ${a.rosterCommand}`));else for(let h of o)Te(i,h,a.key,c);m>0&&i.push(c(` \u2026 +${m} more ${a.label}`))}}return!d&&e.ucs.every(l=>l.groups.every(f=>f.rows.filter(a=>D(e.stage,a)).length===0))&&i.push(" nothing owed \u2014 design and execution are square"),i.push(""),i.push(c(" metric: live verifies edges \xB7 high \xD73 \xB7 staleness shown, not discounted")),n?i.push(c(` proven: graph execution facts \xB7 latest run ${n.latest_run?.started_at??"\u2014"} \xB7 ${n.aspect} formula verbatim`)):i.push(c(" proof: no runs recorded yet \u2014 run tests, then re-run")),i}function we(e,t,s){let n=F(e.slug);if(!t){let l=e.acTotal===0?"no scenarios yet":e.collapse||e.des.status==="complete"?`${e.acTotal} ACs \xB7 complete`:e.des.staleAcs>0?`${e.acTotal} ACs \xB7 ${e.des.staleAcs} stale`:`${e.acTotal} ACs \xB7 ${e.acTotal-e.acDesigned} unverified`,f=` ${e.mark} ${C(e.des.pct,10)} ${String(e.des.pct).padStart(3)}% ${n} `,a=Math.max(0,s-f.length-l.length-2);return`${f}${le(e.title,a).padEnd(a)} ${l}`}let r=e.provAbsent?"prov \xB7 not run":`prov ${C(e.prov?.pct??0,8)} ${String(e.prov?.pct??0).padStart(3)}%`,c=`des ${C(e.des.pct,8)} ${String(e.des.pct).padStart(3)}% \xB7 ${r}`,i=` ${e.mark} ${n} `,d=Math.max(0,s-i.length-c.length-2);return`${i}${le(e.title,d).padEnd(d)} ${c}`}function le(e,t){return e.length<=t?e:t<=1?e.slice(0,t):e.slice(0,t-1)+"\u2026"}function Te(e,t,s,n){let r=F(t.id??t.ref);if(s==="failing"){let c=(t.via_tests??[]).map((d,l)=>`${F(d)}${t.viaFiles?.[l]?` ${t.viaFiles[l]}`:""}`).join(", ");e.push(` \u2717 ${r} ${t.title} \u2014 failed${c?` \xB7 via ${c}`:""}`),t.servePath&&e.push(n(` \u2192 kane-cli evidence serve ${t.servePath} (see why it failed)`));let i=(t.viaFiles??[]).filter(d=>d!==null);i.length===1?e.push(n(` re-run after fixing: kane-cli testmd run ${i[0]} (heals on failure \u2014 fix the app first, or the test may re-author)`)):i.length>1&&e.push(n(" re-run after fixing: kane-cli testrun run (heals on failure \u2014 fix the app first, or the tests may re-author)"));return}if(s==="blocked"){e.push(` \u23F8 ${r} ${t.title} \u2014 (blocked \u2014 see why)`),t.servePath&&e.push(n(` \u2192 kane-cli evidence serve ${t.servePath} (see why)`));return}e.push(` ${r} ${t.title} \u2014 ${t.why}`),e.push(n(` \u2192 ${t.ready_command}`))}function Se(e,t,s){let n=t.map(c=>`${F(c.id??c.ref)} ${de(c.title,4)}`),r=" ";for(let c of n){let i=r.trim().length?" \xB7 ":"";r.length+i.length+c.length>s&&r.trim().length?(e.push(r),r=" "+c):r+=i+c}r.trim().length&&e.push(r)}function ge(e){let{dc:t,pa:s}=e,n=r=>e.top!==void 0?r.slice(0,e.top):r;return{stage:e.stage,rollup_version:1,design_completeness:{pct:t.pct,acs_designed:t.acs_designed,usecases_complete:t.usecases_complete,ucs_needing_scenarios:t.ucs_needing_scenarios,config:t.config},...s?{proven:{aspect:s.aspect,pct:s.pct,acs_proven:s.acs_proven,failing:s.failing,blocked:s.blocked,not_run:s.not_run,latest_run:s.latest_run,config:s.config}}:{},usecases:e.ucs.map(r=>({id:/^sha256:/.test(r.slug)?null:r.slug,title:r.title,risk:r.risk,design_completeness:{pct:r.des.pct,status:r.des.status},stale_acs:r.des.staleAcs,...s?{proven:r.prov??{pct:0,status:"not_run"}}:{},pending:n(r.groups.flatMap(c=>c.rows).filter(c=>D(e.stage,c))).map(ue)})),other:e.other.filter(r=>D(e.stage,r)).map(ue)}}function ue(e){let{servePath:t,viaFiles:s,meta:n,...r}=e;return{...r}}async function Ae(e){let t=await Q(e);return t.length===0?null:t.map(s=>({p:s,m:Re(s).mtimeMs})).sort((s,n)=>n.m-s.m)[0].p}async function Qe(e,t=ie(),s=process.cwd()){if(e.flat)return Ie(e,t,s);let n=e.stage??"all";if(n!=="design"&&n!=="cover"&&n!=="all")return x(t,`--stage must be design | cover | all, got '${n}'`),2;if(e.top!==void 0&&(!Number.isInteger(e.top)||e.top<1))return x(t,"--top must be a positive integer"),2;let r=e.aspect??"lenient";if(r!=="lenient"&&r!=="strict")return x(t,`--aspect must be lenient | strict, got '${r}'`),2;if(e.from)return x(t,"the tree reads the live graph \u2014 for a specific run's view use: kane-cli cover --from <pack> (legacy worklist: add --flat)"),2;let c=J(s,t);if(!c)return 2;let i=B(c),d=ne(i),l=ce(i,r),f=await K(i,"design"),a=new Map;if(l)for(let g of Object.values(l.perAc)){if(!g.executionId||a.has(g.executionId))continue;let h=await L(g.executionId,s);h&&a.set(g.executionId,h)}let p=new Map;for(let[g,h]of oe(re(s)))h.length===1&&p.set(g,j(h[0]));let o=pe(i,f,d,l,{stage:n,top:e.top,aspect:r,servePaths:a,testFiles:p});if(e.json)return t.out(JSON.stringify(ge(o),null,2)),0;if(d.usecases_complete==="0/0")return t.out("nothing to measure yet \u2014 no live use-cases in the graph"),0;let m=t.isTTY&&process.stdout.columns?process.stdout.columns:100;for(let g of fe(o,{width:m,color:t.isTTY}))t.out(g);return 0}async function Ie(e,t,s){let n=e.stage??"design";if(n!=="design"&&n!=="cover"&&n!=="all")return x(t,`--stage must be design | cover | all, got '${n}'`),2;if(e.top!==void 0&&(!Number.isInteger(e.top)||e.top<1))return x(t,"--top must be a positive integer"),2;let r=J(s,t);if(!r)return 2;let c,i;if(n!=="design"){let a=e.from?await L(e.from,s):await Ae(s);if(!a)return x(t,e.from?`no evidence pack at '${e.from}'`:`--stage ${n} needs an evidence pack \u2014 run a test first, or pass --from <pack> (live view: drop --flat)`),2;let p=await Y(a,"coverage/usecases.yaml");if(p==null)return x(t,`${j(a)} carries no coverage/usecases.yaml \u2014 re-run the tests to produce a coverage-bearing pack`),2;let o=V(p);if(!o||!Array.isArray(o.usecases))return x(t,`${j(a)}: coverage/usecases.yaml is not a usecases document`),2;c=o,i=j(a)}let d=B(r),l=await K(d,n,void 0,c),f=l.length;if(e.top!==void 0&&(l=l.slice(0,e.top)),e.json){let a=l.map(p=>Pe(d,p));return t.out(JSON.stringify({stage:n,...i?{pack:i}:{},total:f,rows:a},null,2)),0}return t.out(`gaps \u2014 stage ${n}${i?` \xB7 pack ${i}`:""} (${l.length}${l.length<f?` of ${f}`:""})`),l.length===0&&t.out(" nothing owed \u2014 design and execution are square"),l.forEach((a,p)=>{t.out(` ${String(p+1).padStart(2)}. [${a.risk}] ${a.tag} ${a.ref} \u2014 ${a.why}`),t.out(` \u2192 ${a.ready_command}`)}),0}function Pe(e,t){let s=e.resolve(t.ref),n=s?e.tipOf(s.cid):null,r=n?e.getNode(n)?.content:null;return{...t,id:n?e.displayNameOf(n)??e.displayNameOf(s.cid):null,title:String(r?.title??r?.text??"")}}export{Qe as gapsCommand};
|
package/dist/ingest-FIIO67ZN.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{b as a,c as b,d as c,e as d,f as e}from"./chunk-Z2JSEL3I.js";import"./chunk-V3UE6RJP.js";import"./chunk-DNNZ353O.js";import"./chunk-Q2F5QB2W.js";import"./chunk-NVGBE2DR.js";import"./chunk-7E24OCGX.js";import"./chunk-FRBYGSGJ.js";import"./chunk-6W6AIDLJ.js";import"./chunk-6HYW5RFX.js";import"./chunk-J2KSZUOO.js";import"./chunk-5YPBPZUR.js";import"./chunk-IAHKTEET.js";import"./chunk-UR6MHSHU.js";export{a as compositePayloadBytes,e as ingestBytes,d as ingestFile,b as slugFromFilename,c as versionBaseOf};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{c as U}from"./chunk-RN4OSVTG.js";import{a as B,c as M,d as V,e as Y,f as H}from"./chunk-Z2JSEL3I.js";import{a as D}from"./chunk-V3UE6RJP.js";import"./chunk-DNNZ353O.js";import{g as z}from"./chunk-EV3EHXEI.js";import{a as G,b as K,k as q}from"./chunk-F7WKDMX7.js";import"./chunk-Q2F5QB2W.js";import{a as F}from"./chunk-VOHQA2SP.js";import{a as C}from"./chunk-BC7UVJJB.js";import{b as k}from"./chunk-NVGBE2DR.js";import{a as j}from"./chunk-7E24OCGX.js";import"./chunk-FRBYGSGJ.js";import"./chunk-6W6AIDLJ.js";import"./chunk-6HYW5RFX.js";import"./chunk-J2KSZUOO.js";import"./chunk-5YPBPZUR.js";import"./chunk-IAHKTEET.js";import{x as N}from"./chunk-B4LLKQTK.js";import"./chunk-UR6MHSHU.js";import{existsSync as ve}from"fs";import{appendFileSync as ce,mkdirSync as ue}from"fs";import{homedir as pe}from"os";import{dirname as me,join as fe}from"path";function X(t,r){let e=/^(DOCX_[A-Z_]+):/.exec(r)?.[1];if(e)try{let i=process.env.KANE_CONTEXT_REFUSAL_LOG??fe(pe(),".testmuai","kaneai","context-refusals.log");ue(me(i),{recursive:!0}),ce(i,`${new Date().toISOString()} ${e} ${t}
|
|
3
|
-
`)}catch{}}var g=class extends Error{constructor(e,i){super(i);this.code=e;this.name="LisError"}};function de(t){let r=t.TESTMUAI_ENV==="stage"?"stage":"prod";return`${N[r].shareApiBaseUrl}/lis/api/v1`}function le(t){let r=t.env??process.env,e=t.auth?.TESTMUAI_BASIC_AUTH||r.TESTMUAI_BASIC_AUTH;if(e)return{authorization:`Basic ${e}`};let i=t.auth?.TESTMUAI_API_KEY||r.TESTMUAI_API_KEY;return i?{authorization:`Bearer ${i}`}:{}}function v(t,r,e="the issue"){return t===401||t===403?new g("LIS_AUTH","credentials rejected \u2014 run `kane-cli login` and retry"):t>=500?new g("LIS_UNAVAILABLE",`the integrations service returned an error (HTTP ${t}) \u2014 retry later`):new g("JIRA_ISSUE_UNAVAILABLE",`could not fetch ${e}: ${r||`HTTP ${t}`}`)}function x(t){try{return JSON.parse(t.bytes.toString("utf8"))}catch{throw new g("LIS_UNAVAILABLE","the integrations service returned a malformed response \u2014 retry later")}}var ge=3e4;async function S(t,r,e){let i=e.env??process.env,u=e.fetchImpl??fetch,o=new AbortController,p=setTimeout(()=>o.abort(),ge);try{let a=await u(`${de(i)}${t}`,{...r,headers:{"content-type":"application/json",...le(e),...r.headers??{}},signal:o.signal}),n=await Promise.race([a.arrayBuffer(),new Promise((s,c)=>{o.signal.addEventListener("abort",()=>c(new DOMException("aborted","AbortError")),{once:!0})})]);return{status:a.status,ok:a.ok,headers:a.headers,bytes:Buffer.from(n)}}catch(a){throw o.signal.aborted?new g("LIS_UNAVAILABLE","the integrations service did not respond within 30 seconds \u2014 retry later"):new g("LIS_UNAVAILABLE",`could not reach the integrations service (${a instanceof Error?a.message:String(a)}) \u2014 check your connection and retry`)}finally{clearTimeout(p)}}function T(t){try{return JSON.parse(t.bytes.toString("utf8")).message??""}catch{return""}}async function Z(t={}){let r=await S("/jira/info",{method:"GET"},t);if(!r.ok)throw v(r.status,T(r));let e=x(r),i=(e.data?.SELECTED_PROJECTS??[]).map(u=>u?.key).filter(u=>typeof u=="string"&&u.length>0);return{installed:e.data?.INSTALLED==="YES",selectAll:e.data?.SELECT_ALL===!0,selectedProjects:i}}async function W(t,r={}){let e=await S("/jira/issue?details=true",{method:"POST",body:JSON.stringify({plugin_code:"jira",issueKey:t})},r);if(!e.ok)throw v(e.status,T(e));let i=x(e);if(i.type==="error"||!i.data)throw new g("JIRA_ISSUE_UNAVAILABLE",`could not fetch the issue: ${i.message??"issue not found or not accessible"}`);return i.data}async function Q(t,r={}){let e=await S("/jira/attachment",{method:"POST",body:JSON.stringify({attachment_id:t})},r);if(e.status===413)throw new g("ATTACHMENT_TOO_LARGE","the attachment exceeds the integrations service's size cap");if(e.status===404)throw new g("JIRA_NOT_CONNECTED","Jira is not connected for this account \u2014 connect it in the Integrations screen and retry");if(!e.ok)throw v(e.status,T(e),`attachment ${t}`);return{bytes:e.bytes,mediaType:e.headers.get("content-type")??"application/octet-stream"}}var $="kane.source.jira/1";function ee(t){if(typeof t=="string")return t;if(typeof t=="number"||typeof t=="boolean")return String(t);if(Array.isArray(t)){let r=t.map(ee).filter(e=>e!==null);return r.length===0?null:r.join(", ")}if(t!==null&&typeof t=="object"){let r=t;for(let e of["name","value","displayName"])if(typeof r[e]=="string")return r[e];return null}return null}function te(t,r){let e=[],i={},u=t.additional_fields??{};for(let n of Object.keys(u).sort()){let s=ee(u[n]);if(s===null){e.push(`field "${n}" has no stable text form \u2014 dropped from the envelope`);continue}i[n]=s}let o=[...t.attachments??[]].map(n=>({id:String(n.id),filename:n.filename??"",media_type:n.mime_type??"application/octet-stream",size:n.size??0})).sort((n,s)=>{let c=Number(n.id),m=Number(s.id);return Number.isFinite(c)&&Number.isFinite(m)?c-m:n.id<s.id?-1:n.id>s.id?1:0}),p=t.key;if(!/^[A-Za-z][A-Za-z0-9_]*-\d+$/.test(p))throw new Error(`cannot build a stable identity for issue key "${p}" \u2014 expected a PROJECT-NUMBER key`);let a={schema:$,site:r,project:p.slice(0,p.lastIndexOf("-")),issue:{id:t.id,key:p},content:{summary:t.summary??"",description:t.description??"",fields:i},attachments:o};return{bytes:Buffer.from(JSON.stringify(a),"utf8"),envelope:a,warnings:e}}var re=64,he=16,ye=6e6,be=5e7,Ee=12e6,Ie={png:"image/png",jpeg:"image/jpeg",webp:"image/webp",gif:"image/gif",bmp:"image/bmp",tiff:"image/tiff",emf:"image/emf",wmf:"image/wmf",unknown:"application/octet-stream"},Ae=new Set(["png","jpeg","webp"]);function ne(t){return async r=>{let e;try{e=JSON.parse(r.toString("utf8"))}catch{throw new Error("JIRA_ENVELOPE_SCHEMA: source bytes are not a kane jira envelope")}if(e.schema!==$)throw new Error(`JIRA_ENVELOPE_SCHEMA: unknown envelope schema "${e.schema}" \u2014 this CLI understands ${$}`);let i=[],u=new Map,o=[],p=0,a=new Map,n=[];for(let m=0;m<e.attachments.length;m++){let h=e.attachments[m],L=`i${m+1}`,R=`attachment:${h.filename}`,d=E=>`[img#${L}] ${h.filename} (${h.media_type}, ${h.size} bytes${E?"":" \u2014 not delivered"})`,f=(E,ae,w)=>{i.push({ref:L,loc:R,media_type:E,...w?.blob?{blob:w.blob}:{},...w?.appearance?{appearance:w.appearance}:{},delivery:ae,...w?.duplicate_of?{duplicate_of:w.duplicate_of}:{}})};if(!h.media_type.startsWith("image/")){f(h.media_type,"unsupported-vision-media-type"),n.push(d(!1));continue}let y;try{y=await t.fetchAttachment(h.id)}catch{f(h.media_type,"external-image-not-fetched"),n.push(d(!1));continue}let A=y.bytes,l=G(A),I=Ie[l.format],b=k(A);if(u.set(b,A),!Ae.has(l.format)){let E=l.format==="gif"||l.format==="bmp"||l.format==="tiff"?"unsupported-vision-media-type":"unsupported-image-kind";f(I,E,{blob:b}),n.push(d(!1));continue}if(l.width===void 0||l.height===void 0||l.width*l.height>be){f(I,"undecodable",{blob:b}),n.push(d(!1));continue}let _;if(l.format==="png"||l.format==="jpeg"){let E=K(A,l.format);if(E===null){f(I,"undecodable",{blob:b}),n.push(d(!1));continue}_=F(E.data,{width:E.width,height:E.height,channels:E.channels})}if(l.width<re||l.height<re){f(I,"below-dimension-floor",{blob:b,appearance:_}),n.push(d(!1));continue}let J=a.get(b);if(J!==void 0){f(I,"duplicate",{blob:b,appearance:_,duplicate_of:J}),n.push(d(!1));continue}if(A.byteLength>ye){f(I,"image-too-large",{blob:b,appearance:_}),n.push(d(!1));continue}if(p+A.byteLength>Ee){f(I,"vision-byte-budget-reached",{blob:b,appearance:_}),n.push(d(!1));continue}if(o.length>=he){f(I,"image-cap-reached",{blob:b,appearance:_}),n.push(d(!1));continue}a.set(b,L),p+=A.byteLength,o.push(L),f(I,"selected",{blob:b,appearance:_}),n.push(d(!0))}let s=[];s.push(`${e.issue.key} \xB7 ${e.site}/${e.project}`,`Summary: ${e.content.summary}`),e.content.description!==""&&s.push("",...e.content.description.split(`
|
|
4
|
-
`));let c=Object.keys(e.content.fields);return c.length>0&&s.push("","--- fields ---",...c.map(m=>`${m}: ${e.content.fields[m]}`)),n.length>0&&s.push("","--- attachments ---",...n),{projection:s.join(`
|
|
5
|
-
`)+`
|
|
6
|
-
`,inventory:i,blobs:u,delivered:o,converter:{name:"jira-convert",version:"1",policy:"v1"}}}}var _e=/^[A-Za-z][A-Za-z0-9_]*-\d+$/;function O(t){if(!/^https?:\/\/.+/i.test(t))return null;let r;try{r=new URL(t)}catch{return null}let e=r.pathname.split("/").filter(Boolean),i=e.lastIndexOf("browse");if(i===-1||i+1>=e.length)return null;let u=e[i+1];return _e.test(u)?{site:r.hostname,issueKey:u.toUpperCase()}:null}async function Le(t,r,e,i,u){let o=O(t);if(o===null)return(e.err??e.out)(`error: ${t}: unsupported remote URL \u2014 expected a Jira issue URL (https://<site>/browse/KEY-123)`),1;let p=u?.lis??{jiraInfo:Z,jiraIssue:W,jiraAttachment:Q};try{let n={auth:await(u?.authEnv??(await import("./auth-RXNBQZI2.js")).resolveLisAuthEnv)(),env:process.env},s=await p.jiraInfo(n);if(!s.installed)return(e.err??e.out)(`error: ${t}: Jira is not connected for this account \u2014 connect it in the Integrations screen (integrations.lambdatest.com) and retry`),1;let c=o.issueKey.slice(0,o.issueKey.lastIndexOf("-"));if(!s.selectAll&&s.selectedProjects.length>0&&!s.selectedProjects.includes(c))return(e.err??e.out)(`error: ${t}: project ${c} is not in the integration's selected projects (${s.selectedProjects.join(", ")}) \u2014 add it in the Integrations screen to ingest from it`),1;let m=await p.jiraIssue(o.issueKey,n),h=o.site;if(m.host)try{h=new URL(m.host).hostname}catch{h=m.host.replace(/^https?:\/\//,"").replace(/[/:].*$/,"")}let{bytes:L,warnings:R}=te(m,h),d=r??o.issueKey.toLowerCase();B(d);let f=await H({contextDir:i,bytes:L,media:D,sourceId:d,label:t,confirmSameSource:e.isTTY?y=>e.confirm(`identical content already ingested as ${y} \u2014 treat as the same source?`):void 0,converters:{jira:ne({fetchAttachment:y=>p.jiraAttachment(y,n)})}});e.out(`${f.status} ${f.source_id} source ${f.cid} blob ${f.blob}`);for(let y of R)e.out(`warning: ${y}`);for(let y of f.warnings??[])e.out(`warning: ${y}`);if(f.composite){let y=f.composite.delivered+f.composite.omitted;e.out(`${f.source_id}: jira, ${y} attachments, ${f.composite.delivered} images delivered (${f.composite.omitted} omitted)`)}return 0}catch(a){return a instanceof g?((e.err??e.out)(`error: ${t}: ${a.message}`),1):((e.err??e.out)(`error: ${t}: ${we(a instanceof Error?a.message:String(a))}`),1)}}function we(t){let r=t.match(/^FILE_TOO_LARGE: (\d+) bytes > (\d+) cap/);return r?`the issue's content is too large to ingest (${r[1]} bytes; cap ${r[2]}) \u2014 trim the description or attachments in Jira and retry`:t.startsWith("PROJECTION_TOO_LARGE:")?"the issue's text is too large to ingest \u2014 trim the description in Jira and retry":t}var se={name:"jira",hint:"Jira issue URLs (https://<site>/browse/KEY-123)",match:t=>O(t)!==null,ingest:Le};var P=[se];function ie(t){return/^https?:\/\/.+/i.test(t)}function oe(t){return P.find(r=>r.match(t))??null}async function Se(t,r,e,i=process.cwd(),u){let o=C(i);if(r.as!==void 0&&t.length>1)return(e.err??e.out)(`error: --as names ONE source identity \u2014 pass a single file (got ${t.length})`),2;for(let p of t){if(ie(p)){let s=oe(p);if(s===null)return(e.err??e.out)(`error: ${p}: unsupported remote URL \u2014 supported: ${P.map(m=>m.hint).join("; ")}`),1;let c=await s.ingest(p,r.as,e,o,u);if(c!==0)return c;continue}let a=r.as;if(e.isTTY&&a===void 0&&ve(o)){let s=M(p),c=V(s);if(c){let m=j(o);m.heads.get(c)!=null&&m.heads.get(s)==null&&await e.confirm(`${s} looks like a new version of existing source '${c}' \u2014 ingest as '${c}' (moves its head)?`)&&(a=c)}}let n;try{n=await Y({contextDir:o,filePath:p,asId:a,confirmSameSource:e.isTTY?s=>e.confirm(`identical bytes already ingested as ${s} \u2014 treat as the same source?`):void 0,converters:{pdf:z,docx:q}})}catch(s){let c=s instanceof Error?s.message:String(s);return X(p,c),e.out(`error: ${p}: ${c}`),1}e.out(`${n.status} ${n.source_id} source ${n.cid} blob ${n.blob}`);for(let s of n.warnings??[])e.out(`warning: ${s}`);if(n.composite){let s=n.composite.pages!==void 0?` ${n.composite.pages} pages,`:"";e.out(`${n.source_id}: ${n.composite.kind},${s} ${n.composite.delivered} images delivered (${n.composite.omitted} omitted)`)}if(!e.isTTY&&n.status==="created"){let s=j(o);for(let[c,m]of s.heads.entries())if(!(c===n.source_id||m==null)&&s.getNode(m)?.content.blob===n.blob){e.out(`hint: identical bytes already ingested as ${c} \u2014 merged later via review`);break}}}return 0}async function ct(t,r){let{createInterface:e}=await import("readline/promises");return Se(t,r,{out:i=>process.stdout.write(i+`
|
|
7
|
-
`),isTTY:U(),confirm:async i=>{let u=e({input:process.stdin,output:process.stdout});try{let o=await u.question(`${i} [Y/n] `);return!/^n(o)?$/i.test(o.trim())}finally{u.close()}}})}export{ct as ingestCommand,Se as runIngestCommand};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as v}from"./chunk-MAO5BAQI.js";import"./chunk-3RZ63RBO.js";import"./chunk-KHU7C6EE.js";import"./chunk-JSF5JYZC.js";import"./chunk-J44RN3FB.js";import"./chunk-JFAFKHDX.js";import"./chunk-YKTYVJBN.js";import"./chunk-CVOGP253.js";import"./chunk-427OQS2N.js";import"./chunk-3C5GMAM4.js";import"./chunk-GG43HSU2.js";import"./chunk-FMR2KPSK.js";import{c as b}from"./chunk-RN4OSVTG.js";import"./chunk-DNNZ353O.js";import{a as A,b as E}from"./chunk-WTXHOWUP.js";import"./chunk-FHKDTM5L.js";import"./chunk-2XMJ6YAE.js";import"./chunk-BKM2LWU2.js";import"./chunk-ZPDM6FO7.js";import{a as D}from"./chunk-BC7UVJJB.js";import"./chunk-NVGBE2DR.js";import"./chunk-L5LI2JF4.js";import"./chunk-7E24OCGX.js";import"./chunk-FRBYGSGJ.js";import"./chunk-6W6AIDLJ.js";import"./chunk-6HYW5RFX.js";import"./chunk-J2KSZUOO.js";import"./chunk-5YPBPZUR.js";import"./chunk-IAHKTEET.js";import"./chunk-Y5RNCJAN.js";import"./chunk-5EOX4MEY.js";import"./chunk-RZ4F3BHX.js";import"./chunk-B4LLKQTK.js";import"./chunk-UR6MHSHU.js";async function q(t){let[{render:p},a,{QuestionBatchPrompt:m}]=await Promise.all([import("./build-JIKYOZUH.js"),import("./react-QWOAB3TB.js"),import("./ui-JEJGTURD.js")]),d=a.default??a;return new Promise(e=>{let f=p(d.createElement(m,{questions:t,onSubmit:c=>{f.unmount(),e(c)}}))})}async function J(t){let[{resolveAgentAuthEnv:p},{runAgent:a},{preflightTurn:m}]=await Promise.all([import("./spawner-YNYB4Z7K.js"),import("./bridge-BTSWCJ3B.js"),import("./turn-preflight-JGYT7LXP.js")]),d=await p(),e=D(process.cwd()),{baseUrlAdvisory:f}=await import("./turn-preflight-JGYT7LXP.js"),c=f();c&&process.stderr.write(c+`
|
|
3
|
-
`);let r=E({verb:"design",mode:t.plan?"cli":"interactive",contextRoot:e,env:A(),resumeSid:t.resume,write:!0,longSession:!0}),h={...d,...r.spawnEnv()},w=await m(h);if(!w.ok)return process.stderr.write((w.message??"error: turn-endpoint preflight failed")+`
|
|
4
|
-
`),process.stderr.write(r.supportFooter()+`
|
|
5
|
-
`),r.error("preflight_auth"),await r.end({exit_code:2}),2;let T=async()=>w;if(t.plan){let n=await v(t,{contextDir:e,agent:a,preflightTurn:T,ask:q,out:o=>process.stdout.write(o+`
|
|
6
|
-
`),progress:o=>process.stderr.write(o+`
|
|
7
|
-
`),isTTY:b(),auth:h,telemetry:r});return n===1&&process.stderr.write(r.supportFooter()+`
|
|
8
|
-
`),await r.end({exit_code:n}),n}if(!t.resume){let[{openGraph:n},{designGate:o}]=await Promise.all([import("./readmodel-S5RAQH3F.js"),import("./gate-B6C6KLFA.js")]),s=o(n(e),t.useCase,!!t.force);if(!s.ok)return process.stderr.write(`design: ${s.message}
|
|
9
|
-
`),s.code}let[{render:S},P,{ScrollbackProvider:R},{ChatSurface:F},{ScrollbackTap:G},{makeChatController:_},{setInkExit:j},B]=await Promise.all([import("./build-JIKYOZUH.js"),import("./react-QWOAB3TB.js"),import("./scrollback-JLPJR25X.js"),import("./ChatSurface-PMEOJBZG.js"),import("./ScrollbackTap-Q3IOKNMS.js"),import("./chat-controller-QLORQWJZ.js"),import("./exit-manager-MXUD7GQ7.js"),Promise.all([import("./chat-committer-OS7ULZMH.js"),import("./descriptor-KXDJ4XYD.js"),import("./explain-EBVIUS2X.js"),import("./readmodel-S5RAQH3F.js")])]),[{commitChatTurn:I},{topologyDescriptor:N},{explain:O},{openGraph:g}]=B,y=P.default??P,i=_({commitChatTurn:I,descriptor:N("design"),contextDir:e,refreshGraph:()=>g(e),graph:g(e),explain:O,by:{kind:"human",id:"owner"}}),{buildDossier:Q}=await import("./dossier-KJSJPWOW.js"),Y=n=>{try{return Q(g(e),n)}catch{return null}},k={current:null},C=0,x=null,l=!1,$=()=>{if(C+=1,C>=2){try{u.unmount()}catch{}process.exit(130)}i.requestPause(),x=setTimeout(()=>{l||(l=!0,(async()=>{i.ledger({kind:"interrupted",detail:"the agent did not confirm the pause within 5s"}),await k.current?.flush();try{u.unmount()}catch{}process.exit(130)})())},5e3)},u=S(y.createElement(R,null,y.createElement(G,{into:k}),y.createElement(F,{controller:i,verb:"design",onCtrlC:$,inspect:Y})),{exitOnCtrlC:!1});j(()=>u.unmount()),i.ledger({kind:"banner",text:`kane-cli design \xB7 ${t.useCase??t.resume??""}`});try{let n=v(t,{contextDir:e,agent:a,preflightTurn:T,ask:s=>i.ask(s),out:s=>i.note(s),progress:()=>{},isTTY:b(),auth:h,chat:i,telemetry:r});n.finally(()=>{l=!0});let o=await n;return o===1&&process.stderr.write(r.supportFooter()+`
|
|
10
|
-
`),await r.end({exit_code:o}),o}finally{l=!0,x&&clearTimeout(x),await k.current?.flush();try{u.unmount()}catch{}}}export{J as bindDesignInteractive};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as l,b as a,c as f,d as m}from"./chunk-GRB66C5S.js";import"./chunk-RN4OSVTG.js";import"./chunk-BC7UVJJB.js";import{a as c}from"./chunk-7E24OCGX.js";import"./chunk-FRBYGSGJ.js";import{h as y,i as b,m as v}from"./chunk-6W6AIDLJ.js";import"./chunk-6HYW5RFX.js";import"./chunk-J2KSZUOO.js";import"./chunk-5YPBPZUR.js";import"./chunk-IAHKTEET.js";import"./chunk-UR6MHSHU.js";var g={kind:"human",id:process.env.USER??"operator"},C=/^(UNKNOWN_|BAD_|INVALID_|MALFORMED_|NOT_|SLUG_TAKEN|ALREADY_|SUPERSEDED_)/;function w(e){return e.every(r=>C.test(r.code))?2:1}function p(e,r){for(let n of r)l(e,`${n.code}: ${n.detail}`);return w(r)}async function E(e,r,n,o=process.cwd()){let t=a(o,n);if(!t||!await f(n,`retire source ${e} (head \u2192 null + tombstone record)`,r.yes))return 2;let i=c(t),s=b({contextDir:t,graph:i,sourceId:e,reason:r.reason,by:g});return s.errors?p(n,s.errors):(n.out(`retired ${e} (record ${s.record.seq}) \u2014 its use-cases stay until no live source evidences them`),0)}async function _(e,r,n,o=process.cwd()){let t=a(o,n);if(!t)return 2;if(v.test(r))return l(n,`"${r}" is in the reserved sequential-id namespace (assigned at mint) \u2014 pick a descriptive name`),2;let i=c(t),s=y({contextDir:t,graph:i,assignments:[{ref:e,slug:r}],by:g});return s.errors?p(n,s.errors):(n.out(`named ${s.record.names[0].cid} as "${r}" (record ${s.record.seq})`),0)}async function x(e,r,n,o=process.cwd()){let t=a(o,n);if(!t)return 2;let i=Number(e);if(!await f(n,`revert record ${i} via a compensation record`,r.yes))return 2;let s=c(t),{commitRevert:$}=await import("./revert-RQJE56HF.js"),d=$({contextDir:t,graph:s,seq:i,reason:r.reason,by:g});for(let h of d.warnings)n.out(`note: ${h}`);if(d.errors)return p(n,d.errors);let u=d.record;return n.out(`reverted record ${i} via compensation record ${u.seq}: ${u.supersessions.length} supersession(s), ${u.review.length} trust restoration(s), ${Object.keys(u.source_head_moves).length} head move(s) \u2014 history unchanged, effects inverted`),0}async function P(e,r){return E(e,r,m())}async function R(e,r){return _(e,r,m())}async function k(e={},r=process.cwd()){return D(e,m(),r)}async function D(e,r,n=process.cwd()){let o=a(n,r);if(!o||!await f(r,"assign logical ids to every live unnamed node (one commit record)",e.yes))return 2;let{backfillLogicalIds:t}=await import("./logical-ids-I7B3VJEH.js"),i=c(o),s=t(o,i);return s.errors?p(r,s.errors):(r.out(s.assigned===0?"backfill: every live node already has a logical id":`backfill: assigned ${s.assigned} logical id(s) (record ${s.record.seq})`),0)}async function q(e,r){return x(e,r,m())}export{k as nameBackfillCommand,R as nameCommand,P as retireCommand,q as revertCommand,D as runNameBackfillCommand,_ as runNameCommand,E as runRetireCommand,x as runRevertCommand};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{b as m}from"./chunk-GRB66C5S.js";import"./chunk-RN4OSVTG.js";import"./chunk-BC7UVJJB.js";import{a as g}from"./chunk-7E24OCGX.js";import"./chunk-FRBYGSGJ.js";import"./chunk-6W6AIDLJ.js";import"./chunk-6HYW5RFX.js";import"./chunk-J2KSZUOO.js";import{d as o}from"./chunk-5YPBPZUR.js";import"./chunk-IAHKTEET.js";import"./chunk-UR6MHSHU.js";var p=[o.SOURCE,o.USECASE,o.SCENARIO,o.AC,o.TEST,o.GAP];function h(n,e){if(n===o.SOURCE)return String(e.source_id??"");let i=e.question?.header,l=e.title??e.text??i??e.kind??"";return String(l)}function E(n,e){if(n.length<=e)return n;let i=n.slice(0,e-1),l=i.lastIndexOf(" ");return`${(l>e*.6?i.slice(0,l):i).trimEnd()}\u2026`}var b=58;async function O(n,e,i=process.cwd()){let l=m(i,e);if(!l)return 2;let a=g(l),s=[...a.nodeLabel.entries()].filter(([t])=>n.all||!a.superseded.has(t)).map(([t,r])=>{let u=a.getNode(t)?.content??{},f=a.trust.get(t)??(r===o.SOURCE?"-":"derived");return{id:r===o.SOURCE?String(u.source_id??""):a.nameOf.get(t)??t.slice(0,19),cid:t,label:r,title:h(r,u),trust:f,fresh:f==="archived"?"-":a.stale(t)}});if(n.type&&(s=s.filter(t=>t.label===n.type)),n.inferred&&(s=s.filter(t=>t.trust==="derived")),n.stale&&(s=s.filter(t=>t.fresh!=="fresh")),!n.all){let t=new Map;for(let r of s)t.set(`${r.label}:${r.id}`,r);s=[...t.values()]}let d=t=>{let r=p.indexOf(t);return r===-1?p.length:r};if(s.sort((t,r)=>d(t.label)-d(r.label)||t.title.localeCompare(r.title)),n.json){for(let t of s)e.out(JSON.stringify(t));return 0}if(s.length===0)return e.out("(no matching nodes)"),0;e.out("trust \xB7 fresh \xB7 title \xB7 id");let c=null;for(let t of s){if(t.label!==c){c=t.label;let u=s.filter(f=>f.label===t.label).length;e.out(""),e.out(`\u2500\u2500 ${t.label} \xB7 ${u} \u2500\u2500`)}let r=E(t.title||"(untitled)",b);e.out(` ${t.trust.padEnd(8)} ${t.fresh.padEnd(6)} ${r.padEnd(b)} ${t.id}`)}return 0}async function R(n){return O(n,{out:e=>process.stdout.write(e+`
|
|
3
|
-
`),confirm:async()=>!1,isTTY:!!process.stdout.isTTY})}export{E as capWord,R as listCommand,O as runListCommand,h as titleOf};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{h as d,k as f,l as m}from"./chunk-6W6AIDLJ.js";import"./chunk-6HYW5RFX.js";import"./chunk-J2KSZUOO.js";import"./chunk-5YPBPZUR.js";import"./chunk-IAHKTEET.js";import"./chunk-UR6MHSHU.js";var y=Object.keys(f).filter(n=>n!=="source");function b(n,t,u={kind:"system",id:"logical-id-backfill"}){let l=new Set(t.names.keys()),r=[];for(let c of y)for(let{cid:s,content:e}of t.byLabel(c)){if(t.superseded.has(s)||t.nameOf.has(s))continue;let a=typeof e.title=="string"&&e.title||typeof e.intent=="string"&&e.intent||typeof e.statement=="string"&&e.statement||typeof e.text=="string"&&e.text||"",i=a?m(c,a,g=>l.has(g)):null;i&&(l.add(i),r.push({ref:s,slug:i}))}if(r.length===0)return{record:null,errors:null,assigned:0};let o=d({contextDir:n,graph:t,assignments:r,by:u});return o.errors?{record:null,errors:o.errors,assigned:0}:{record:o.record,errors:null,assigned:r.length}}export{b as backfillLogicalIds};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a}from"./chunk-XIXR63FI.js";import"./chunk-NR23HZU4.js";import"./chunk-RFHMDQXZ.js";import"./chunk-RZ4F3BHX.js";import"./chunk-A2IQRVPR.js";import"./chunk-WREVEATJ.js";import"./chunk-B4LLKQTK.js";import"./chunk-UR6MHSHU.js";export{a as LoginFlow};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{b as i,c as m,d as s}from"./chunk-GRB66C5S.js";import"./chunk-RN4OSVTG.js";import{a as t}from"./chunk-BC7UVJJB.js";import{c as d,d as c}from"./chunk-FRBYGSGJ.js";import"./chunk-6HYW5RFX.js";import"./chunk-J2KSZUOO.js";import"./chunk-5YPBPZUR.js";import"./chunk-IAHKTEET.js";import"./chunk-UR6MHSHU.js";async function u(r,o=process.cwd()){if(!i(o,r))return 2;let e=c(t(o));if(e.ok)return r.out(e.pending?`ok: ${e.records} record(s) verified \u2014 ${e.pending} record(s) pending catch-up (applied automatically on the next command)`:`ok: ${e.records} record(s) verified, derived projection in parity`),0;for(let n of e.issues)r.out(`issue: ${n}`);return 1}async function p(r,o,e=process.cwd()){if(!i(e,o)||!await m(o,"wipe .context/derived and rebuild it from the verified commit chain",r.yes))return 2;let n=d(t(e));return o.out(`rebuilt: ${n.applied.seq} record(s) replayed, ${Object.keys(n.nodeLabel).length} node(s) projected`),0}async function b(){return u(s())}async function y(r={}){return p(r,s())}export{b as fsckCommand,y as rebuildCommand,u as runFsckCommand,p as runRebuildCommand};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a,b,c}from"./chunk-KHQHVSZ6.js";import"./chunk-2YQ6TW77.js";import"./chunk-WAOCHXJ5.js";import"./chunk-UXPQRALY.js";import"./chunk-FCMLIK7P.js";import"./chunk-CJJXT5DO.js";import"./chunk-QM4S2APK.js";import"./chunk-ZPDM6FO7.js";import"./chunk-BC7UVJJB.js";import"./chunk-NVGBE2DR.js";import"./chunk-EHN5HTUD.js";import"./chunk-L5LI2JF4.js";import"./chunk-7E24OCGX.js";import"./chunk-FRBYGSGJ.js";import"./chunk-6W6AIDLJ.js";import"./chunk-6HYW5RFX.js";import"./chunk-J2KSZUOO.js";import"./chunk-5YPBPZUR.js";import"./chunk-IAHKTEET.js";import"./chunk-2WVKOZ6W.js";import"./chunk-NLCCBXXV.js";import"./chunk-RZ4F3BHX.js";import"./chunk-A2IQRVPR.js";import"./chunk-B4LLKQTK.js";import"./chunk-UR6MHSHU.js";export{c as UploadPipeline,b as packPresignEntry,a as readPackForUpload};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a,b}from"./chunk-7E24OCGX.js";import"./chunk-FRBYGSGJ.js";import"./chunk-6W6AIDLJ.js";import"./chunk-6HYW5RFX.js";import"./chunk-J2KSZUOO.js";import"./chunk-5YPBPZUR.js";import"./chunk-IAHKTEET.js";import"./chunk-UR6MHSHU.js";export{a as openGraph,b as staleForEvolve};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as J,b as Q,c as X,d as ee}from"./chunk-3CJIMPQK.js";import{a as z,c as G,d as pe,f as Z}from"./chunk-4XSW6WZD.js";import{a as P,b as ue,d as fe}from"./chunk-GRB66C5S.js";import{a as L,b as V,c as N,d as j,e as de,g as O,h as q}from"./chunk-K7USHLVZ.js";import{a as le}from"./chunk-JFAFKHDX.js";import"./chunk-3C5GMAM4.js";import{a as H}from"./chunk-IQODWB32.js";import"./chunk-RN4OSVTG.js";import{c as ce}from"./chunk-Z2JSEL3I.js";import{d as ae}from"./chunk-V3UE6RJP.js";import"./chunk-DNNZ353O.js";import"./chunk-Q2F5QB2W.js";import"./chunk-QM4S2APK.js";import"./chunk-BC7UVJJB.js";import"./chunk-NVGBE2DR.js";import{a as I}from"./chunk-7E24OCGX.js";import"./chunk-FRBYGSGJ.js";import"./chunk-6W6AIDLJ.js";import"./chunk-6HYW5RFX.js";import{c as F}from"./chunk-J2KSZUOO.js";import"./chunk-5YPBPZUR.js";import"./chunk-IAHKTEET.js";import"./chunk-UR6MHSHU.js";import{existsSync as we,statSync as ye}from"fs";import{basename as Y,resolve as W}from"path";var me=new Set(["interactive","agent","ci","override"]);function Re(e,n){if(e.mode!==void 0&&!me.has(e.mode))return{error:`--mode must be interactive | agent | ci | override, got '${e.mode}'`};let r=e.mode,t="reconcile without a TTY needs an explicit mode \u2014 pass --mode agent|ci|override, or --plan for a preview";return r==="interactive"&&!n?{error:t}:r||(n?"interactive":e.plan?"override":{error:t})}function ke(e,n,r,t){let i=W(n,r);if(!we(i)||!ye(i).isFile())return{error:`--from '${r}' is not a file \u2014 pass the changed source document`};let o=ae(i);if(!o.ok)return{error:`--from '${r}' is not an ingestable document \u2014 allowed: ${o.allowlist.join(", ")}`};let c=I(e);if(!c.heads.has(t))return{error:`unknown source '${t}' \u2014 see \`kane-cli context list --type source\``};if(c.heads.get(t)==null)return{error:`source '${t}' is retired \u2014 restore it first with \`kane-cli context revert\`, then reconcile`};let l=null;try{l=ce(i)}catch{}return l!==null&&l!==t&&c.heads.get(l)!=null?{error:`'${Y(i)}' already backs live source '${l}' \u2014 did you mean --source-id ${l}? To truly move these bytes under '${t}', retire '${l}' first`}:{sourceId:t,filePath:i}}function x(e){return e==null?"(none)":e.slice(0,19)}function T(e,n,r,t=!1){if(e.out(`reconcile ${n.source_id}: head ${n.head.status} \u2014 ${x(n.head.before)} \u2192 ${x(n.head.after)}`),t||(e.out(`note: ${n.note}`),e.out(`skipped arms: ${n.skipped_arms}`)),n.changed&&e.out(n.held?`extract ran in override mode; ${r?.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; ${r?.defaultsTaken??0} default(s) auto-taken; matched-but-changed proposals auto-committed as edits`),t){let i=n.changeset??[],o=(l,h)=>{let y=i.filter(s=>s.kind===l).length;return y>0?`${y} ${h}`:null},c=[o("ADD","add"),o("MODIFY","modify"),o("ARCHIVE","archive")].filter(Boolean);n.changed&&e.out(`changeset: ${i.length} item(s)${c.length?` \u2014 ${c.join(" \xB7 ")}`:""}`),e.out(`plan: ${n.rows.length} row(s) \u2014 each gets a card below`);return}if(n.changed){let i=n.changeset??[];e.out(`changeset: ${i.length} item(s)`);for(let o of i)if(o.kind==="MODIFY")e.out(` [MODIFY] ${H(o.ref)} \u2014 ${o.summary} (${x(o.old_cid)} \u2192 ${o.new_cid===null?"(staged)":x(o.new_cid)})`);else if(o.kind==="ADD")e.out(` [ADD] ${H(o.ref)}`);else{e.out(` [ARCHIVE] ${H(o.ref)} \u2014 ${o.why}`);let c=ne(o.impact,"retiring drops");c&&e.out(` ${c}`)}}e.out(`plan: ${n.rows.length} row(s)`);for(let i of n.rows){e.out(` [${i.kind}] ${H(i.ref)} \u2014 ${i.reason}`);let o=ne(i.impact,"approving marks");o&&e.out(` ${o}`),e.out(` provenance: ${i.provenance}`),e.out(` action: ${i.action}`)}}function ne(e,n){if(!e||e.stale_refs.length===0)return null;let r=e.direct_refs??[];return`impact: ${n} ${e.stale_refs.length} item(s) stale`+(r.length>0?` \u2014 ${r.length} directly touched: ${r.join(", ")}`:"")}function E(e){return e==="interactive"?"override":e}async function A(e,n,r,t,i,o,c=[],l="override",h,y,s,f,v){let p;try{p=q(e)}catch($){return P(t,$ instanceof Error?$.message:String($)),1}try{if(!r){let{runWalkSession:$}=await import("./walk-session-OPAEV4WR.js");return await $({dir:e,rows:n,archive:c,held:h??null,childMode:l,runDesign:f??null,mark:o,markA:s,...y?{archiveState:y}:{},signals:R=>C(e,R.ref,R.verdict,R.reason),...v?{script:v}:{}})}return await _e(e,n,r,t,i,o,c,l,h,y)}finally{p()}}var M=e=>`${e} high-risk item(s) need a human \u2014 ci mode won't guess. Walk interactively or use --mode agent.`;function K(e,n,r){let t=n.rows;e({type:"reconcile_plan",source_id:n.source_id,plan_path:r,rows:t.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 re(e={}){return{type:"reconcile_summary",applied:0,skipped:0,deferred:0,plan_only:0,failed:0,paused:0,stale_created:0,...e}}var te=re();async function U(e,n,r,t,i,o,c,l,h){K(i,n,r);let y=n.changeset.filter(v=>v.kind==="ARCHIVE"&&h?.[v.ref]===void 0),s=n.rows,f;try{f=q(e)}catch(v){return i({type:"error",message:v instanceof Error?v.message:String(v)}),i(re()),2}try{return await $e(e,n,r,t,i,o,c,s,y,l)}finally{f()}}async function $e(e,n,r,t,i,o,c,l,h,y){let s=0,f=0,v=0,p=0,$=0,R=0,d=0,k=new Set,w=(u,a)=>{try{y?.(u,a)}catch{}};for(let[u,a]of l.entries()){i({type:"reconcile_row_start",kind:a.kind,ref:a.ref,...a.impact?{stale:a.impact.stale_refs.length,direct:a.impact.direct_refs?.length??0}:{}});let g=(m,D,S)=>i({type:"reconcile_row_end",kind:a.kind,ref:a.ref,outcome:m,...D!==void 0?{exit_code:D}:{},...S?{detail:S}:{}});if(a.applied){f++,g("skipped");continue}if(a.kind==="REMOVE"){$++,g("plan-only");continue}if(a.held_ref&&n.held){let m=new Set;if(a.kind==="MODIFY"&&a.impact){let S=I(e);for(let se of a.impact.stale_refs){let oe=S.resolve(se);oe&&S.stale(oe.tip)==="fresh"&&m.add(se)}}let D=J(e,n.held,a.held_ref,ie);if(!D.ok){v++,d===0&&(d=1),g("failed",1,D.message);continue}if(D.kind==="ADD"){let S=await t(D.ref,{yes:!0,mode:c});if(S!==0){S===3?(p++,d===0&&(d=3),g("paused",3)):(v++,d===0&&(d=1),g("failed",S));continue}}s++,D.kind!=="ADD"&&a.impact&&(R+=m.size),w(u,"approved"),C(e,a.ref,D.kind==="ADD"?"gap-resolved-create":"gap-resolved-evolve"),g("applied");continue}let _=z(I(e),a.ref);if(!_.ok){f++,g("skipped");continue}let b=_.target;if(k.has(b.ucTip)){f++,g("skipped");continue}if(a.kind==="ADD"){let m=await t(b.seamRef,{yes:!0,mode:c});if(m===3){p++,d===0&&(d=3),g("paused",3);continue}if(m!==0){v++,d===0&&(d=1),g("failed",m);continue}k.add(b.ucTip),s++,w(u,"approved"),C(e,a.ref,"gap-resolved-create"),g("applied")}else{let m=await G(e,b,{yes:!0,mode:c},o,t,"batch");m.outcome==="evolved"?(k.add(b.ucTip),s++,w(u,"approved"),C(e,a.ref,"gap-resolved-evolve"),g("applied")):m.outcome==="paused"?(p++,d===0&&(d=m.code),g("paused",m.code)):m.outcome==="failed"?(v++,d===0&&(d=1),g("failed",m.code)):(f++,g("skipped"))}}return h.length>0&&(i({type:"reconcile_paused",plan_path:r,pending:h.map(u=>({ref:u.ref,why:u.why}))}),p+=h.length,d===0&&(d=3)),i(re({applied:s,skipped:f,plan_only:$,failed:v,paused:p,stale_created:R})),d}var ie={kind:"human",id:process.env.USER??"operator"};function C(e,n,r,t){le(e,{ts:new Date().toISOString(),command:"reconcile-walk",id:n,verdict:r,polarity:"preference",by:ie,target:n,...t!==void 0?{reason:t}:{}})}async function _e(e,n,r,t,i,o,c=[],l="override",h,y){let s=0,f=0,v=0,p=0,$=0,R=0,d=0,k=new Set;for(let[w,u]of n.entries()){if(u.applied){t.out(`skipped ${u.ref} \u2014 already applied (${u.applied.outcome} at ${u.applied.at})`),f++;continue}let a=m=>{try{o?.(w,m)}catch(D){P(t,`could not record applied state for ${u.ref}: ${D instanceof Error?D.message:String(D)}`)}};if(u.kind==="REMOVE"){t.out(`REMOVE ${u.ref} \u2014 plan-only in this release (not executed)`),p++;continue}if(u.held_ref&&h){let m=J(e,h,u.held_ref,ie);if(!m.ok){P(t,`held ${u.ref}: ${m.message}`),$++,d===0&&(d=1);continue}if(t.out(`committed ${m.ref} (${u.kind==="ADD"?"minted":"updated \u2014 old\u2192new redirect"})`),m.kind==="ADD"){let D=await i(m.ref,{yes:r,mode:l});if(D===3){t.out(`design session for ${m.ref} paused \u2014 resume with "kane-cli design tests --resume"`),R++,d===0&&(d=3),a("approved");continue}if(D!==0){P(t,`design run for ${m.ref} ended with exit code ${D}`),$++,d===0&&(d=1),a("approved");continue}}s++,a("approved"),C(e,u.ref,u.kind==="ADD"?"gap-resolved-create":"gap-resolved-evolve");continue}let g=I(e),_=z(g,u.ref);if(!_.ok){t.out(`skipped ${u.ref} \u2014 ${_.message}`),f++;continue}let b=_.target;if(k.has(b.ucTip)){t.out(`skipped ${u.ref} \u2014 use-case ${b.display} already handled in this walk`),f++;continue}if(u.kind==="ADD"){let m=await i(b.seamRef,{yes:r,mode:l});if(m===3){t.out(`design session for ${b.display} paused \u2014 resume with "kane-cli design tests --resume"; this row lands when that session completes`),R++,d===0&&(d=3);continue}if(m!==0){P(t,`design run for ${b.display} ended with exit code ${m}`),$++,d===0&&(d=1);continue}k.add(b.ucTip),s++,a("approved"),C(e,u.ref,"gap-resolved-create")}else{let m=await G(e,b,{yes:!0,mode:l},t,i,"batch");m.outcome==="evolved"?(k.add(b.ucTip),s++,a("approved"),C(e,u.ref,"gap-resolved-evolve")):m.outcome==="paused"?(R++,d===0&&(d=m.code)):m.outcome==="failed"?($++,d===0&&(d=m.code)):f++}}for(let w of c)if(w.kind==="ARCHIVE"&&y?.[w.ref]===void 0){t.out(`[ARCHIVE] ${w.ref} \u2014 ${w.why}`);{let u=ne(w.impact,"retiring drops");u&&t.out(` ${u}`)}t.out(" plan-only \u2014 retire belongs to the interactive session (never headless)"),p++}return t.out(`reconcile walk: ${s} applied, ${f} skipped, ${v} deferred, ${p} plan-only`+($>0?`, ${$} failed`:"")+(R>0?`, ${R} paused`:"")),d}async function he(e,n,r,t,i,o=!1,c=!1){let l=i.seams??{reingest:X(e,r),reextract:ee(e,{stage:o})},h=null,y={reingest:l.reingest,reextract:async f=>h=await l.reextract(f)},s;try{t.out(`reconciling ${n}: re-reading the source and comparing against the graph\u2026`),s=await(i.buildPlan??Q)(e,n,y)}catch(f){return P(t,`reconcile failed: ${f instanceof Error?f.message:String(f)}`),null}return s.changed&&T(t,s,h,c),s}async function Pe(e,n,r,t,i){let o=V(e,n);if("error"in o)return P(t,o.error),2;let{plan:c,path:l}=o,h=r==="override"||r==="ci";if(n===void 0&&r==="interactive"&&t.isTTY&&!await t.confirm(`apply plan ${Y(l)} for ${c.source_id} (created ${c.created})?`))return t.out(`not applying ${Y(l)}`),0;let y=i.runDesignForUc??Z,s=i.runDesignForUc??null,f=i.sessionScript,v=(k,w)=>O(l,k,w),p=(k,w)=>j(l,k,w),$=F(e);if($===c.head_pin){if(r==="agent"){let w=i.emitEvent??(()=>{});return U(e,B(c),l,y,w,t,E(r),v,c.archive_state)}let k=N(c);return r==="ci"&&k.length>0?(P(t,M(k.length)),2):(t.out(`applying stored plan ${Y(l)} for ${c.source_id} (${c.rows.length} row(s))`),A(e,c.rows,h,t,y,v,c.changeset??[],E(r),c.held,c.archive_state,p,s,f))}if(t.out(`graph moved since this plan (${x(c.head_pin)} \u2192 ${x($)}) \u2014 recomputing`),c.held)return ve(e,c,t,i,r,y,!1);let R=await he(e,c.source_id,c.backing_path,t,i,!1,r==="interactive");if(!R)return 1;if(!R.changed)return T(t,R,null),0;if(r==="agent"){let k=i.emitEvent??(()=>{});return U(e,R,null,y,k,t,E(r))}let d=R.changeset.filter(k=>k.kind==="ARCHIVE");return r==="ci"&&d.length>0?(P(t,M(d.length)),2):A(e,R.rows,h,t,y,void 0,R.changeset,E(r),R.held,void 0,void 0,s,f)}function B(e,n=!1){return{source_id:e.source_id,changed:!0,head:{status:"unchanged",before:e.head_pin,after:e.head_pin},note:e.note,skipped_arms:e.skipped_arms,changeset:e.changeset??[],rows:n?e.rows.filter(r=>r.applied===void 0):e.rows,...e.held?{held:e.held}:{}}}async function be(e,n,r,t,i,o,c){let l=t.runDesignForUc??null,h=t.sessionScript,y=de(e,n);if(y===null)return null;if("error"in y)return P(r,y.error),2;let{plan:s,path:f}=y,v=s.rows.filter(d=>d.applied===void 0),p=N(s),$=t.emitEvent??(()=>{});if(v.length===0&&p.length===0){r.out(`already reconciled \u2014 plan ${s.created} applied ${s.rows.length} row(s)`);let d=pe(I(e)).staleCount;return d>0&&r.out(`${d} item(s) still stale \u2014 kane-cli maintain evolve --from-stale`),i==="agent"&&(K($,B(s),f),$({...te})),0}let R=F(e);return R!==s.head_pin?(r.out(`plan ${s.created} superseded \u2014 graph moved (${x(s.head_pin)} \u2192 ${x(R)}); recomputing`),ve(e,s,r,t,i,o,c)):(r.out(`resuming plan ${s.created} \u2014 ${v.length} pending row(s)${p.length>0?`, ${p.length} undecided archive item(s)`:""}`),c?(T(r,B(s),null),r.out(`plan stored: ${f}`),0):i==="agent"?U(e,B(s),f,o,$,r,E(i),(d,k)=>O(f,d,k),s.archive_state):i==="ci"&&p.length>0?(P(r,M(p.length)),2):A(e,s.rows,i==="override"||i==="ci",r,o,(d,k)=>O(f,d,k),s.changeset??[],E(i),s.held,s.archive_state,(d,k)=>j(f,d,k),l,h))}async function ve(e,n,r,t,i,o,c){let l=t.runDesignForUc??null,h=t.sessionScript,y;if(n.held){let u=I(e),a=new Set(n.rows.filter(_=>_.held_ref!==void 0&&_.applied!==void 0).map(_=>_.held_ref)),g=[];for(let _ of n.held.rows){if(a.has(_.temp_ref))continue;if(!_.matched_cid){g.push(_);continue}let b=u.tipOf(_.matched_cid);if(u.superseded.get(b)===null){r.out(`dropped held "${_.title}" \u2014 its use-case was retired meanwhile`);continue}g.push(b===_.matched_cid?_:{..._,matched_cid:b,uc:{..._.uc,matches_existing:{cid:b}}})}y={source_id:n.held.source_id,rows:g}}let s=t.seams??{reingest:X(e,n.backing_path),reextract:ee(e,{stage:y!==void 0})},f;try{f=await(t.buildPlan??Q)(e,n.source_id,s,{resumeHeld:y})}catch(u){return P(r,`reconcile failed: ${u instanceof Error?u.message:String(u)}`),1}T(r,f,null,i==="interactive"&&!c);let v=F(e),p=null;if(v!=null){let u={},a=new Set(f.changeset.filter(g=>g.kind==="ARCHIVE").map(g=>g.ref));for(let[g,_]of Object.entries(n.archive_state??{}))a.has(g)&&(u[g]=_);p=L(e,{version:2,source_id:f.source_id,backing_path:n.backing_path,head_pin:v,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(u).length>0?{archive_state:u}:{}}),r.out(`plan stored: ${p}`)}if(c)return 0;let $=t.emitEvent??(()=>{}),R=p?V(e,p).plan.archive_state:void 0,d=p?(u,a)=>O(p,u,a):void 0,k=p?(u,a)=>j(p,u,a):void 0;if(i==="agent")return U(e,f,p,o,$,r,E(i),d,R);let w=f.changeset.filter(u=>u.kind==="ARCHIVE"&&R?.[u.ref]===void 0);return i==="ci"&&w.length>0?(P(r,M(w.length)),2):A(e,f.rows,i==="override"||i==="ci",r,o,d,f.changeset,E(i),f.held,R,k,l,h)}async function ge(e,n,r={},t=process.cwd()){let{telemetryBootstrap:i,telemetryEnvName:o}=await import("./bootstrap-RPT3JOGD.js"),c=i({verb:"reconcile",mode:typeof e.mode=="string"?e.mode:"interactive",contextRoot:W(t,".context"),env:o(),applyPlanPath:typeof e.apply=="string"?W(t,e.apply):void 0,write:!0,longSession:!0});n.out(c.banner());let l=await De(e,n,r,t);return l===1&&n.out(c.supportFooter()),await c.end({exit_code:l}),l}async function De(e,n,r={},t=process.cwd()){let i=e.apply!==void 0&&e.apply!==!1,o=typeof e.apply=="string"?e.apply:void 0;if(e.plan&&i)return P(n,"pass --plan OR --apply, not both"),2;if((e.from!==void 0||!i)&&(!e.from||!e.sourceId))return P(n,"reconcile needs --from <file> AND --source-id <id> \u2014 see `kane-cli context list --type source` for ids"),2;if(e.from&&o!==void 0)return P(n,"pass --from OR --apply <path>, not both \u2014 a stored plan names its own source"),2;let l=ue(t,n);if(!l)return 2;if(e.mode!==void 0&&!me.has(e.mode))return P(n,`--mode must be interactive | agent | ci | override, got '${e.mode}'`),2;let h=e.mode==="agent"||e.mode==="ci"||e.mode==="override";if(i&&!h&&!n.isTTY)return P(n,"refusing to apply without a TTY to confirm \u2014 pass --mode override|ci"),2;let y=!e.plan,s="override";if(e.from){let a=Re(e,n.isTTY);if(typeof a=="object")return P(n,a.error),2;s=a}let f=s==="override"||s==="ci";if(i&&!e.from){let a=e.mode??"interactive";return Pe(l,o===void 0?void 0:W(t,o),a,n,r)}let v=ke(l,t,e.from,e.sourceId);if("error"in v)return P(n,v.error),2;let p=await he(l,v.sourceId,v.filePath,n,r,!!e.plan||s==="interactive",s==="interactive"&&!e.plan);if(!p)return 1;let $=r.runDesignForUc??Z,R=r.runDesignForUc??null,d=r.sessionScript;if(!p.changed){let a=await be(l,v.sourceId,n,r,s,$,!!e.plan);if(a!==null)return a;if(T(n,p,null),s==="agent"){let g=r.emitEvent??(()=>{});K(g,p,null),g({...te})}return 0}let k=F(l),w=null;if(k!=null?w=L(l,{version:2,source_id:p.source_id,backing_path:v.filePath,head_pin:k,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}:{}}):P(n,"no chain head after extract \u2014 plan not stored"),s==="agent"){let a=r.emitEvent??(()=>{});if(!y)return K(a,p,w),a({...te}),0;let g=w?(_,b)=>O(w,_,b):void 0;return U(l,p,w,$,a,n,E(s),g)}if(!y)return w&&n.out(`plan stored: ${w}`),0;let u=p.changeset.filter(a=>a.kind==="ARCHIVE");if(s==="ci"&&u.length>0)return w&&n.out(`plan stored: ${w}`),P(n,M(u.length)),2;if(w){n.out(`plan stored: ${w}`);let a=w;return A(l,Ee(l,a)??p.rows,f,n,$,(g,_)=>O(a,g,_),p.changeset,E(s),p.held,void 0,void 0,R,d)}return A(l,p.rows,f,n,$,void 0,p.changeset,E(s),p.held,void 0,void 0,R,d)}function Ee(e,n){let r=V(e,n);return"error"in r?null:r.plan.rows}async function Ye(e,n={},r,t=process.cwd()){if(e.mode==="agent"){let{makeHeadlessIO:i}=await import("./headless-io-PWW6YKH2.js"),o=r?i("ndjson","reconcile",r):i("ndjson","reconcile"),c={out:o.out,err:h=>o.event({type:"error",message:h}),isTTY:!1,confirm:async()=>!1,ask:async()=>""},l=2;try{l=await ge(e,c,{...n,emitEvent:h=>o.event(h)},t)}catch(h){o.event({type:"error",message:h instanceof Error?h.message:String(h)})}return o.done(l)}return ge(e,fe(),n,t)}export{E as childModeFor,Ye as reconcileCommand,Re as resolveReconcileMode,ge as runReconcileCommand,ke as validateReconcileInputs};
|
package/dist/revert-RQJE56HF.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{b as _,e as k}from"./chunk-J2KSZUOO.js";import"./chunk-5YPBPZUR.js";import"./chunk-IAHKTEET.js";import"./chunk-UR6MHSHU.js";function j(w){let{contextDir:v,graph:y,seq:r,by:d}=w,{records:l,hashes:$}=_(v);if(!Number.isInteger(r)||r<1||r>l.length)return{record:null,warnings:[],errors:[{code:"UNKNOWN_SEQ",detail:`no record ${r} (chain has ${l.length})`}]};let i=l[r-1],p=l.slice(0,r-1),c=w.reason??`revert of record ${r}`,t=[],u=[],f=[],g=[],m={},b=new Set(i.nodes.map(e=>e.cid));for(let e of i.nodes){if(y.superseded.has(e.cid)){t.push(`${e.cid} was already superseded after record ${r} \u2014 left as is`);continue}u.push({kind:"node",old:e.cid,new:null,reason:c,by:d})}for(let e of i.supersessions){if(e.kind==="edge"){t.push(`edge retraction ${e.ecid} cannot be auto-restored \u2014 re-extract to re-evidence`);continue}if(l.slice(r).some(n=>n.supersessions.some(s=>s.kind==="node"&&s.old===e.old))){t.push(`supersession of ${e.old.slice(0,19)} was changed again after record ${r} \u2014 later state kept`);continue}let o;for(let n of p)for(let s of n.supersessions)s.kind==="node"&&s.old===e.old&&(o=s.new===s.old?void 0:s.new);o===void 0?u.push({kind:"node",old:e.old,new:e.old,reason:c,by:d}):u.push({kind:"node",old:e.old,new:o,reason:c,by:d})}let h=l.slice(r);for(let e of Object.keys(i.source_head_moves)){if(h.some(n=>e in n.source_head_moves)){t.push(`head of ${e} was moved again after record ${r} \u2014 later state kept`);continue}let o=null;for(let n of p)e in n.source_head_moves&&(o=n.source_head_moves[e]);m[e]=o}let R=new Set;for(let e of i.review){if(R.has(e.id)||b.has(e.id))continue;if(R.add(e.id),h.some(s=>s.review.some(a=>a.id===e.id))){t.push(`trust of ${e.id.slice(0,19)} was reviewed again after record ${r} \u2014 later state kept`);continue}let o=null,n=null;for(let s of p)for(let a of s.review)a.id===e.id&&(o=a.resolution==="reset"?null:a.resolution,n=a.reason);o==="approved"||o==="edited"?f.push({id:e.id,kind:"review-item",resolution:"approved",edit:null,reason:c,by:d}):o==="rejected"?f.push({id:e.id,kind:"review-item",resolution:"rejected",edit:null,reason:n??c,by:d}):f.push({id:e.id,kind:"review-item",resolution:"reset",edit:null,reason:c,by:d})}for(let e of i.names??[]){if(h.some(n=>(n.names??[]).some(s=>s.slug===e.slug))){t.push(`slug "${e.slug}" was reassigned after record ${r} \u2014 later state kept`);continue}let o;for(let n of p)for(let s of n.names??[])s.slug===e.slug&&(o=s.cid);o!==void 0?g.push({cid:o,slug:e.slug,by:d}):t.push(`slug "${e.slug}" was first assigned by record ${r} \u2014 unassignment unsupported, reassign manually`)}return u.length===0&&f.length===0&&g.length===0&&Object.keys(m).length===0?{record:null,warnings:t,errors:[{code:"NOTHING_TO_REVERT",detail:`record ${r} left no compensable facts`}]}:(i.extraction_of&&t.push(`extraction cache for ${i.extraction_of.slice(0,19)} stays \u2014 re-extract with --force`),{record:k(v,{ts:new Date().toISOString(),proposal_id:null,nodes:[],edges:[],review:f,supersessions:u,...g.length>0?{names:g}:{},source_head_moves:m},{expectPrev:$[$.length-1]??null}).record,warnings:t,errors:null})}export{j as commitRevert};
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{b as j}from"./chunk-GRB66C5S.js";import"./chunk-RN4OSVTG.js";import"./chunk-BC7UVJJB.js";import{a as _}from"./chunk-7E24OCGX.js";import"./chunk-FRBYGSGJ.js";import{g as b}from"./chunk-6W6AIDLJ.js";import"./chunk-6HYW5RFX.js";import{b as V}from"./chunk-J2KSZUOO.js";import"./chunk-5YPBPZUR.js";import"./chunk-IAHKTEET.js";import"./chunk-UR6MHSHU.js";import{readFileSync as E}from"fs";var O=new Set(["derived","skipped","archived","drift"]),q={kind:"human",id:process.env.USER??"operator"};function R(d,r){return d.nameOf.get(r)??r.slice(0,19)}function N(d,r){let n=d.getNode(r)?.content??{},a=d.derivesInto(r)[0]?.props.anchor;return{cid:r,uc:{temp_ref:r,title:String(n.title??n.text??""),summary:n.summary!==void 0?String(n.summary):void 0,risk:String(n.risk??"med"),cite:{anchor:typeof a=="string"?a:"\u2014",quote:""},depends_on_hint:[],matches_existing:null}}}function T(d,r){let n=new Set,{records:a}=V(d);for(let s of a){if(s.proposal_id==null)continue;let u=new Set(s.review.map(e=>e.id));for(let e of s.nodes)u.has(e.cid)||n.add(e.cid)}for(let s of[...n])(r.trust.get(s)!=="derived"||r.superseded.has(s))&&n.delete(s);return n}var x=new Set(["approved","edited","rejected","skipped","supersede"]);function C(d){let r;try{r=JSON.parse(d)}catch(s){return{errors:[`not valid JSON: ${s instanceof Error?s.message:String(s)}`]}}if(!Array.isArray(r))return{errors:['expected a top-level array of {"ref", "resolution", ...} entries']};let n=[],a=[];return r.forEach((s,u)=>{if(s==null||typeof s!="object"||Array.isArray(s)){n.push(`[${u}]: not an object`);return}let e=s;(typeof e.ref!="string"||!e.ref.trim())&&n.push(`[${u}]: "ref" (slug or cid) is required`),(typeof e.resolution!="string"||!x.has(e.resolution))&&n.push(`[${u}]: "resolution" must be one of approved | edited | rejected | skipped | supersede`),e.resolution==="supersede"&&(typeof e.supersede_target!="string"||!e.supersede_target.trim())&&n.push(`[${u}]: resolution "supersede" requires "supersede_target" (slug or cid)`),e.edit!==void 0&&(e.edit==null||typeof e.edit!="object"||Array.isArray(e.edit))&&n.push(`[${u}]: "edit" must be an object ({title?, summary?, risk?})`),n.length===0&&a.push(e)}),n.length>0?{errors:n}:{entries:a}}async function I(d,r,n,a=process.cwd()){let s=d.queue??"derived";if(!O.has(s))return r.out(`unknown queue ${s} \u2014 one of: derived | skipped | archived | drift`),2;let u=j(a,r);if(!u)return 2;let e=_(u);if(d.verdicts){let i=t=>(r.err??r.out)(t),o;try{o=E(d.verdicts,"utf8")}catch{return i(`error: cannot read verdicts file ${d.verdicts}`),2}let l=C(o);if("errors"in l){for(let t of l.errors)i(`error: --verdicts ${d.verdicts}: ${t}`);return 2}let c=new Set([...e.trust.entries()].filter(([t,p])=>(p==="derived"||p==="archived")&&!e.superseded.has(t)).map(([t])=>t)),f=new Map,y=[];for(let t of l.entries){let p=e.resolve(t.ref),m=p&&!e.superseded.has(p.tip)?p.tip:null;if(!m){y.push(`${t.ref}: names nothing in the graph`);continue}if(!c.has(m)){y.push(`${t.ref}: not in a review queue (trust: ${e.trust.get(m)??"?"})`);continue}if(f.has(m)){y.push(`${t.ref}: duplicate \u2014 an earlier entry already resolves to this node (${R(e,m)})`);continue}f.set(m,{resolution:t.resolution,...t.reason?{reason:t.reason}:{},...t.edit?{edit:t.edit}:{},...t.supersede_target?{supersedeTarget:t.supersede_target}:{}})}if(y.length>0){for(let t of y)i(`error: --verdicts: ${t}`);return i("error: nothing committed (the verdicts file is atomic \u2014 fix every offender and re-run)"),2}let k=b({contextDir:u,graph:e,verdicts:f,by:q});if(k.errors){if(k.errors[0]?.code==="NO_VERDICTS")return i("nothing changed \u2014 every item was skipped"),0;for(let t of k.errors)i(`${t.code}: ${t.detail}`);return 1}let S=new Map;for(let t of f.values())S.set(t.resolution,(S.get(t.resolution)??0)+1);if(d.json)for(let[t,p]of f.entries())r.out(JSON.stringify({ref:R(e,t),cid:t,resolution:p.resolution}));else{let t=[...S.entries()].map(([p,m])=>`${m} ${p}`).join(", ");r.out(`review: committed record ${k.record.seq} \u2014 ${t}`)}return 0}if(s==="drift"){let i=e.staleList().filter(({state:o})=>o!=="superseded").map(({cid:o,state:l})=>({ref:R(e,o),cid:o,state:l,title:String(e.getNode(o)?.content.title??e.getNode(o)?.content.source_id??""),pinned_sources:[...new Set(e.derivesInto(o).map(c=>String(c.props.source_id)))]}));if(d.json){for(let o of i)r.out(JSON.stringify(o));return 0}if(i.length===0)return r.out("drift queue is empty \u2014 every node's evidence matches the current source snapshots"),0;r.out(`${i.length} node(s) with drifting evidence (re-extract the source to re-bless):`);for(let o of i)r.out(` [${o.state}] ${o.ref} \xB7 ${o.title} \xB7 sources: ${o.pinned_sources.join(", ")||"\u2014"}`);return 0}if(!r.isTTY)return r.out("review: verdict queues need a TTY (drift listing works anywhere, or pass --verdicts <file.json>)"),2;let g,h;if(s==="archived")g=[...e.trust.entries()].filter(([i,o])=>o==="archived"&&!e.superseded.has(i)).map(([i])=>N(e,i)),h="skipped";else{let i=T(u,e),o=[...e.trust.entries()].filter(([c,f])=>f==="derived"&&!e.superseded.has(c)).map(([c])=>c),l=s==="skipped"?o.filter(c=>i.has(c)):o;l.sort((c,f)=>Number(i.has(f))-Number(i.has(c))),g=l.map(c=>N(e,c)),h="skipped"}if(g.length===0)return r.out(`${s} queue is empty`),0;r.out(`${g.length} node(s) in the ${s} queue \u2014 approve promotes, reject ${s==="archived"?"re-archives":"archives"}, edit mints a new version, skip leaves it for later`);let v=await n(g,e,h),w=b({contextDir:u,graph:e,verdicts:v,by:q});if(w.errors){if(w.errors[0]?.code==="NO_VERDICTS")return r.out("nothing changed \u2014 every item was skipped"),0;for(let i of w.errors)r.out(`${i.code}: ${i.detail}`);return 1}let $=w.record;return r.out(`committed record ${$.seq}: ${$.review.length} review fact(s), ${$.supersessions.length} supersession(s), ${$.nodes.length} new version(s)`),0}async function P(d,r,n){let[{render:a},s,{ReviewChecklist:u}]=await Promise.all([import("./build-JIKYOZUH.js"),import("./react-QWOAB3TB.js"),import("./ui-JEJGTURD.js")]),e=s.default??s;return new Promise(g=>{let h=a(e.createElement(u,{items:d.map(v=>({uc:v.uc})),defaultResolution:n,onSubmit:v=>{h.unmount(),g(v)}}))})}async function D(d){let{bothTTY:r}=await import("./headless-io-PWW6YKH2.js");return I(d,{out:n=>process.stdout.write(n+`
|
|
3
|
-
`),err:n=>process.stderr.write(n+`
|
|
4
|
-
`),confirm:async()=>!1,isTTY:r()},P)}export{C as parseVerdictsFile,D as reviewCommand,I as runReviewCommand};
|
package/dist/run-4LTYFTF2.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a}from"./chunk-MAO5BAQI.js";import"./chunk-3RZ63RBO.js";import"./chunk-KHU7C6EE.js";import"./chunk-JSF5JYZC.js";import"./chunk-J44RN3FB.js";import"./chunk-JFAFKHDX.js";import"./chunk-YKTYVJBN.js";import"./chunk-CVOGP253.js";import"./chunk-427OQS2N.js";import"./chunk-3C5GMAM4.js";import"./chunk-GG43HSU2.js";import"./chunk-FMR2KPSK.js";import"./chunk-DNNZ353O.js";import"./chunk-FHKDTM5L.js";import"./chunk-ZPDM6FO7.js";import"./chunk-NVGBE2DR.js";import"./chunk-L5LI2JF4.js";import"./chunk-7E24OCGX.js";import"./chunk-FRBYGSGJ.js";import"./chunk-6W6AIDLJ.js";import"./chunk-6HYW5RFX.js";import"./chunk-J2KSZUOO.js";import"./chunk-5YPBPZUR.js";import"./chunk-IAHKTEET.js";import"./chunk-5EOX4MEY.js";import"./chunk-B4LLKQTK.js";import"./chunk-UR6MHSHU.js";export{a as runDesign};
|
package/dist/run-YGJZ2SXX.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as b,b as c,c as d,d as e,e as f,f as g}from"./chunk-DGIPQINV.js";import"./chunk-K7USHLVZ.js";import{f as a}from"./chunk-JSF5JYZC.js";import"./chunk-J44RN3FB.js";import"./chunk-JFAFKHDX.js";import"./chunk-YKTYVJBN.js";import"./chunk-CVOGP253.js";import"./chunk-427OQS2N.js";import"./chunk-GG43HSU2.js";import"./chunk-FMR2KPSK.js";import"./chunk-V3UE6RJP.js";import"./chunk-DNNZ353O.js";import"./chunk-FHKDTM5L.js";import"./chunk-NVGBE2DR.js";import"./chunk-7E24OCGX.js";import"./chunk-FRBYGSGJ.js";import"./chunk-6W6AIDLJ.js";import"./chunk-6HYW5RFX.js";import"./chunk-J2KSZUOO.js";import"./chunk-5YPBPZUR.js";import"./chunk-IAHKTEET.js";import"./chunk-5EOX4MEY.js";import"./chunk-B4LLKQTK.js";import"./chunk-UR6MHSHU.js";export{f as dedupPreFlags,b as deliveredImagesWire,d as displaySourceName,a as resolveAnswers,g as runExtract,c as sessionSourceRef,e as sourceBanner};
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as f}from"./chunk-J44RN3FB.js";import{d as l,e as g,f as $}from"./chunk-FHKDTM5L.js";import{a as m}from"./chunk-BC7UVJJB.js";import"./chunk-UR6MHSHU.js";function w(t,o=new Date){let n=new Date(t).getTime()-o.getTime();if(Number.isNaN(n))return"unknown";if(n<=0)return"EXPIRED";let e=Math.floor(n/36e5),r=Math.round(n%36e5/6e4);return e>0?`${e}h ${r}m`:`${r}m`}function p(t){return t.verb==="design"?`kane-cli design tests --resume ${t.sid} --mode ${t.mode==="agent"?"agent":"interactive"}`:`kane-cli context extract --resume ${t.sid}${t.mode==="agent"?" --mode agent":""}`}function _(t,o,n){let e,r,s;try{if(e=l(t,o),!e)return process.stderr.write(`error: no session ${o} (kane-cli context sessions lists them)
|
|
3
|
-
`),2;r=e.pending.questions.map(f),s=p(e)}catch{return process.stderr.write(`error: session ${o} has a corrupt state.json \u2014 remove with: kane-cli context sessions clean ${o}
|
|
4
|
-
`),2}let i=new Date(e.expires_at).getTime()<=Date.now();if(n)return process.stdout.write(JSON.stringify({sid:e.sid,verb:e.verb??"extract",use_case:e.use_case,mode:e.mode,created_at:e.created_at,expires_at:e.expires_at,...i?{expired:!0}:{resume:s},pending_questions:r,pending_proposals:e.pending.proposals.length,assumed:e.assumed,...e.force?{force:!0}:{}})+`
|
|
5
|
-
`),0;let c=e.verb==="design"?e.use_case??"?":"extract corpus";process.stdout.write(`${e.sid} ${e.verb??"extract"} \xB7 ${c} \xB7 ${e.mode} \xB7 expires in ${w(e.expires_at)}
|
|
6
|
-
`),i?process.stdout.write(` expired at ${e.expires_at} \u2014 not resumable; discard with: kane-cli context sessions clean ${e.sid}
|
|
7
|
-
`):(process.stdout.write(` resume: ${s}
|
|
8
|
-
`),process.stdout.write(` answer in words: ${s} --message "<your statement>"
|
|
9
|
-
`)),r.length===0&&process.stdout.write(` pending questions: none
|
|
10
|
-
`);for(let[a,d]of r.entries())process.stdout.write(` q${a+1} [${d.risk}] ${d.text}
|
|
11
|
-
`),d.options.forEach((u,x)=>{let h=x===d.recommended_index?" (recommended)":"";process.stdout.write(` - ${u.label}${h}${u.detail?` \u2014 ${u.detail}`:""}
|
|
12
|
-
`)});return e.assumed.length>0&&process.stdout.write(` assumed while away: ${e.assumed.map(a=>`${a.questionId}\u2192${a.optionId}`).join(", ")}
|
|
13
|
-
`),0}async function S(t,o,n){let e=m(process.cwd());if(t==="show")return n?_(e,n,!!o.json):(process.stderr.write(`error: sessions show needs a <sid> (kane-cli context sessions lists them)
|
|
14
|
-
`),2);if(t==="clean"){let{removed:s,skipped:i}=$(e,{all:o.all,sid:n});for(let c of i)process.stderr.write(`error: session ${c.sid} not removed \u2014 ${c.reason}
|
|
15
|
-
`);return n&&s.length===0?(i.length>0||process.stderr.write(`error: no session ${n}
|
|
16
|
-
`),2):(process.stdout.write(s.length?`removed: ${s.join(", ")}
|
|
17
|
-
`:`nothing to clean
|
|
18
|
-
`),i.length>0?2:0)}let r=g(e);if(o.json){for(let s of r)process.stdout.write(JSON.stringify(s.corrupt?s:{...s,resume:p(s)})+`
|
|
19
|
-
`);return 0}if(r.length===0)return process.stdout.write(`no sessions
|
|
20
|
-
`),0;for(let s of r){if(s.corrupt){process.stdout.write(`${s.sid} CORRUPT state.json \u2014 remove with: kane-cli context sessions clean ${s.sid}
|
|
21
|
-
`);continue}let i=s.verb==="design"?s.use_case??"?":"extract corpus";process.stdout.write(`${s.sid} ${s.verb??"extract"} \xB7 ${i} \xB7 pending ${s.pendingCount} \xB7 expires in ${w(s.expires_at)}
|
|
22
|
-
resume: ${p(s)}
|
|
23
|
-
`)}return 0}export{p as resumeCommandFor,S as sessionsCommand};
|
package/dist/spawner-YNYB4Z7K.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{d as a}from"./chunk-CSGQIY7X.js";import"./chunk-SBZWFULF.js";import"./chunk-3MSXQU2C.js";import"./chunk-X5P2T7MA.js";import"./chunk-67SSEGDO.js";import"./chunk-QBCS57EO.js";import"./chunk-2XMJ6YAE.js";import"./chunk-KHQHVSZ6.js";import"./chunk-AV6E6WLY.js";import"./chunk-VYMCE7UR.js";import"./chunk-HOOXUO3X.js";import"./chunk-2YQ6TW77.js";import"./chunk-RODHDQU3.js";import"./chunk-OIYGGEUL.js";import"./chunk-RKWJG3WW.js";import"./chunk-77WMTCUQ.js";import"./chunk-4SJC64KQ.js";import"./chunk-LGVHW4ZA.js";import"./chunk-5YHVK2EO.js";import"./chunk-E5PWL3BG.js";import"./chunk-TDPWFYTJ.js";import"./chunk-T7ZPMTGS.js";import"./chunk-QQUZF2DZ.js";import"./chunk-AIMINJVP.js";import"./chunk-5Y2G4NC7.js";import"./chunk-BCH3JCND.js";import"./chunk-XLKRV2JH.js";import"./chunk-C5UNZ6ZY.js";import"./chunk-S3DAAAE5.js";import"./chunk-EN7NW7DU.js";import"./chunk-XIXR63FI.js";import"./chunk-NR23HZU4.js";import"./chunk-FPFOW6BS.js";import"./chunk-WAOCHXJ5.js";import"./chunk-GQ3NCBYR.js";import"./chunk-RFHMDQXZ.js";import"./chunk-UXPQRALY.js";import"./chunk-FCMLIK7P.js";import"./chunk-CJJXT5DO.js";import"./chunk-QM4S2APK.js";import"./chunk-ZPDM6FO7.js";import"./chunk-BC7UVJJB.js";import"./chunk-NVGBE2DR.js";import"./chunk-EHN5HTUD.js";import"./chunk-L5LI2JF4.js";import"./chunk-7E24OCGX.js";import"./chunk-FRBYGSGJ.js";import"./chunk-6W6AIDLJ.js";import"./chunk-6HYW5RFX.js";import"./chunk-J2KSZUOO.js";import"./chunk-5YPBPZUR.js";import"./chunk-IAHKTEET.js";import"./chunk-MTHCUBDF.js";import"./chunk-CH3VWCRZ.js";import"./chunk-4BAMZSFU.js";import"./chunk-YCCUBQY4.js";import"./chunk-RQYS3KGU.js";import"./chunk-Y5RNCJAN.js";import"./chunk-5EOX4MEY.js";import"./chunk-AYY7RYMK.js";import"./chunk-2WVKOZ6W.js";import"./chunk-NLCCBXXV.js";import"./chunk-RZ4F3BHX.js";import"./chunk-A2IQRVPR.js";import"./chunk-VE3SUJMA.js";import"./chunk-E47GFYXA.js";import"./chunk-WREVEATJ.js";import"./chunk-J3EMJ7US.js";import"./chunk-5WE4DHXL.js";import{a as o}from"./chunk-DFS4RMVP.js";import"./chunk-YHQFYZJ5.js";import"./chunk-4GLYNAK7.js";import"./chunk-B4LLKQTK.js";import{a as t}from"./chunk-HCBYKLMW.js";import{c as n}from"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import{e as r}from"./chunk-UR6MHSHU.js";var e=r(t(),1);async function p(i){let c=i.scenarioLimit!==void 0||i.perScenarioLimit!==void 0?{scenarioLimit:i.scenarioLimit,perScenarioLimit:i.perScenarioLimit}:void 0,{waitUntilExit:m}=n((0,e.jsx)(o,{children:(0,e.jsx)(a,{initialChatMode:"generate",initialObjective:i.objective,initialGenerateLimits:c})}),{exitOnCtrlC:!1});await m()}export{p as runGenerate};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{e as a,f as b,g as c,h as d,i as e,j as f,k as g,l as h,m as i,n as j,o as k,p as l,q as m}from"./chunk-AV6E6WLY.js";import"./chunk-VYMCE7UR.js";import"./chunk-HOOXUO3X.js";import"./chunk-2YQ6TW77.js";import"./chunk-RKWJG3WW.js";import"./chunk-T7ZPMTGS.js";import"./chunk-EN7NW7DU.js";import"./chunk-NR23HZU4.js";import"./chunk-FPFOW6BS.js";import"./chunk-WAOCHXJ5.js";import"./chunk-L5LI2JF4.js";import"./chunk-RQYS3KGU.js";import"./chunk-Y5RNCJAN.js";import"./chunk-5EOX4MEY.js";import"./chunk-NLCCBXXV.js";import"./chunk-RZ4F3BHX.js";import"./chunk-A2IQRVPR.js";import"./chunk-WREVEATJ.js";import"./chunk-4GLYNAK7.js";import"./chunk-B4LLKQTK.js";import"./chunk-HCBYKLMW.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";export{i as ExportError,c as assertOrgMatchOrExit,j as exportTestmd,b as metaMatchesOrg,a as readMetaIfExists,d as resolveCurrentOrgId,l as resolveSyncAuth,h as runDeleteAction,k as runExportAction,e as runListAction,f as runListTui,g as runStatusAction,m as runSyncAction};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a}from"./chunk-EN7NW7DU.js";import"./chunk-NR23HZU4.js";import"./chunk-RZ4F3BHX.js";import"./chunk-A2IQRVPR.js";import"./chunk-B4LLKQTK.js";import"./chunk-UR6MHSHU.js";export{a as refreshOAuthToken};
|