@testmuai/kane-cli 0.6.11 → 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-54CAJDUF.js → ChromeProfilePicker-4CDSPBWL.js} +1 -1
- package/dist/{CliFeedbackPrompt-TCAH4AHL.js → CliFeedbackPrompt-TLRVBA4E.js} +1 -1
- package/dist/{CliUploadProgress-UURZ63VQ.js → CliUploadProgress-WGGFLUSF.js} +1 -1
- package/dist/{ConfigView-5QGB7MUS.js → ConfigView-DBANTBXC.js} +1 -1
- package/dist/EvidenceViewOffer-DNCQ3A6R.js +2 -0
- package/dist/{FolderPicker-Y5MAYFIJ.js → FolderPicker-W7RCIFEL.js} +1 -1
- package/dist/{HelpView-S3GJGSCE.js → HelpView-FBCX32U7.js} +1 -1
- package/dist/{InfoBox-LYTNNMVJ.js → InfoBox-KK2ICVS4.js} +1 -1
- package/dist/{LinksBox-5MSEKNSV.js → LinksBox-KKRANMR3.js} +1 -1
- package/dist/{ProfilesView-LTHE5UIO.js → ProfilesView-DGPXSAQN.js} +1 -1
- package/dist/{ProjectPicker-XMXIGHSE.js → ProjectPicker-ESQSL4TT.js} +1 -1
- package/dist/{SaveSessionPrompt-VQDEA4WA.js → SaveSessionPrompt-AQGP5W6E.js} +1 -1
- package/dist/SingleShotApp-SMCAIKCE.js +2 -0
- package/dist/{SummaryBox-WWF3G263.js → SummaryBox-BFZJW2KK.js} +1 -1
- package/dist/TestMdRunView-FMKZJ3A3.js +2 -0
- package/dist/{WhoamiView-PDURYP7E.js → WhoamiView-JABY3I5Q.js} +1 -1
- package/dist/{auth-I4RB4KO3.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-OKYH4F7I.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-NUQ423YE.js → chunk-2KBD6JZX.js} +1 -1
- package/dist/chunk-2SREGETM.js +4 -0
- package/dist/chunk-2XGDWUJ5.js +2 -0
- package/dist/{chunk-MJBCBQC2.js → chunk-322JEJEH.js} +1 -1
- package/dist/{chunk-SURF5Z7Y.js → chunk-323MLBYA.js} +1 -1
- package/dist/{chunk-HOQEMPMQ.js → chunk-33QXD75Y.js} +2 -2
- package/dist/{chunk-K7USHLVZ.js → chunk-36OC3TFE.js} +1 -1
- package/dist/{chunk-ZNHXIRCM.js → chunk-3FN5VJMV.js} +2 -2
- package/dist/chunk-3LWTUMDG.js +2 -0
- package/dist/chunk-3STZLM5J.js +4 -0
- package/dist/{chunk-KXUSG5ZI.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-XZRIQ3GF.js → chunk-6HEGD6H2.js} +1 -1
- package/dist/{chunk-XWSAKVEY.js → chunk-6UJDOAYR.js} +2 -2
- package/dist/{chunk-QJIJC3KC.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-7MRBMDZ5.js → chunk-APAIWBIH.js} +1 -1
- package/dist/{chunk-HMM5FJJO.js → chunk-BAL64WSI.js} +1 -1
- package/dist/chunk-BB2W35TW.js +2 -0
- package/dist/chunk-BQHKBOSF.js +11 -0
- package/dist/chunk-C4G7RVJ6.js +2 -0
- package/dist/{chunk-NTGYFYBP.js → chunk-CDQX6HGJ.js} +1 -1
- package/dist/{chunk-KSZ72BSC.js → chunk-CSQ46PJ7.js} +1 -1
- package/dist/chunk-DQ54MH7F.js +13 -0
- package/dist/{chunk-3AZTXJY4.js → chunk-DXV6MBTD.js} +1 -1
- package/dist/chunk-DYW5C6II.js +2 -0
- package/dist/{chunk-LHDNJJGE.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-POYZ6SAI.js → chunk-HPMS5KO6.js} +2 -2
- package/dist/{chunk-3RZ63RBO.js → chunk-IBNC444G.js} +1 -1
- package/dist/{chunk-73OQDAXF.js → chunk-IQDWBTRJ.js} +1 -1
- package/dist/chunk-IXVOXJP6.js +6 -0
- package/dist/{chunk-IQODWB32.js → chunk-JEUA4UWK.js} +1 -1
- package/dist/{chunk-GLA6QL3T.js → chunk-JKTFTF24.js} +1 -1
- package/dist/{chunk-KHJXOFDM.js → chunk-JRMDGLLT.js} +1 -1
- package/dist/{chunk-GIMTSDNC.js → chunk-KNDSQ4PS.js} +1 -1
- package/dist/chunk-KRXSXQBU.js +12 -0
- package/dist/{chunk-4CJ55EUY.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-FSB3FTIQ.js → chunk-L7VREJTG.js} +1 -1
- package/dist/{chunk-MRP54NCJ.js → chunk-LQZ2BU7Q.js} +1 -1
- package/dist/{chunk-EAUUULJQ.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-DSOA6L73.js → chunk-NAE7MBR2.js} +3 -3
- package/dist/{chunk-NTNAHN25.js → chunk-NBKQT7LJ.js} +1 -1
- package/dist/{chunk-7NLQ3QQD.js → chunk-NJPTOKW5.js} +1 -1
- package/dist/{chunk-RFJAYURU.js → chunk-NOCIMJSN.js} +1 -1
- package/dist/chunk-NRC2G4Y5.js +5 -0
- package/dist/{chunk-H2W2UNTN.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-XXMNUJX4.js → chunk-R2RGSO4B.js} +1 -1
- package/dist/{chunk-MFOH7EYR.js → chunk-RNSSM2BK.js} +1 -1
- package/dist/chunk-SE6WNCYU.js +4 -0
- package/dist/{chunk-ICGHBZFZ.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-ZP4S5WGW.js → chunk-UBFKZEX3.js} +2 -2
- package/dist/chunk-UI7KULSI.js +7 -0
- package/dist/chunk-UPPEOQJQ.js +3 -0
- package/dist/chunk-URQUQWGW.js +62 -0
- package/dist/chunk-UX2B7L6K.js +2 -0
- package/dist/{chunk-XSKLH2MC.js → chunk-V36ATG7A.js} +2 -2
- package/dist/chunk-VGFTNLQQ.js +2 -0
- package/dist/{chunk-RGJIRS3B.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-ZPCU6546.js → chunk-X3ICV5M5.js} +1 -1
- package/dist/chunk-XDHZMCTA.js +4 -0
- package/dist/{chunk-2WKX3RMA.js → chunk-XVDJ423L.js} +1 -1
- package/dist/chunk-ZLCZDAEX.js +6 -0
- package/dist/{chunk-NJAHRITS.js → chunk-ZM5PVRJK.js} +1 -1
- package/dist/committer-2EJPVVCQ.js +2 -0
- package/dist/{config-QISRENF5.js → config-R3GF2FZA.js} +1 -1
- package/dist/cover-cmd-TXICWHUU.js +3 -0
- package/dist/{credentials-OGLK7MPV.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-TUA3HGRX.js → generate-headless-BSTDLZZY.js} +2 -2
- package/dist/{headless-io-PWW6YKH2.js → headless-io-BL3TEAX5.js} +1 -1
- package/dist/index.js +67 -68
- 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-F53ZNYOZ.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-5ZFS5SMZ.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-ZZUF2MGT.js → recording-banner-TALO7PUR.js} +1 -1
- package/dist/records-5SVUXJBW.js +2 -0
- package/dist/{require-project-folder-NQBZFUPF.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-XOSCYVSS.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-VYIIWAK7.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-LP3S5PK7.js → validate-basic-O2DP2XJL.js} +1 -1
- package/dist/verdicts-TJH3O5UW.js +2 -0
- package/dist/{version-check-XP62HWLJ.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-TZ554O4U.js +0 -8
- package/dist/EvidenceViewOffer-SSAM4RRP.js +0 -2
- package/dist/SingleShotApp-A6PCNPLM.js +0 -2
- package/dist/TestMdRunView-MQ7ZPFN2.js +0 -2
- package/dist/bind-QJT726NE.js +0 -6
- package/dist/bootstrap-566PPFCC.js +0 -2
- package/dist/bridge-QCMEOQDD.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-54IB6CXK.js +0 -5
- package/dist/chunk-54VQ46U2.js +0 -14
- package/dist/chunk-55Y65VPA.js +0 -347
- package/dist/chunk-6W6AIDLJ.js +0 -4
- package/dist/chunk-7E24OCGX.js +0 -2
- package/dist/chunk-7YPK6EDR.js +0 -4
- package/dist/chunk-FHKDTM5L.js +0 -6
- package/dist/chunk-FRBYGSGJ.js +0 -4
- package/dist/chunk-GG43HSU2.js +0 -3
- package/dist/chunk-HLRLP6TQ.js +0 -2
- package/dist/chunk-J2KSZUOO.js +0 -4
- package/dist/chunk-J44RN3FB.js +0 -2
- package/dist/chunk-JXKRO2ZJ.js +0 -13
- package/dist/chunk-M5PJQ5Y3.js +0 -6
- package/dist/chunk-MMPFU2YC.js +0 -2
- package/dist/chunk-MR7CX5VT.js +0 -9
- package/dist/chunk-MTNUZEO7.js +0 -12
- package/dist/chunk-OGWC3J3C.js +0 -4
- package/dist/chunk-RN4OSVTG.js +0 -6
- package/dist/chunk-RZJVQUBA.js +0 -61
- package/dist/chunk-V3UE6RJP.js +0 -2
- package/dist/chunk-Y5RNCJAN.js +0 -19
- package/dist/chunk-YSSTGJ7O.js +0 -7
- 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-HDD7T7DX.js +0 -2
- package/dist/evolve-cmd-UE2BIMXK.js +0 -2
- package/dist/explain-EBVIUS2X.js +0 -2
- package/dist/extract-bind-6MQYKN3G.js +0 -8
- package/dist/extract-cmd-2RUIWFZG.js +0 -6
- package/dist/gaps-cmd-CKCHH3HQ.js +0 -2
- package/dist/ingest-FIIO67ZN.js +0 -2
- package/dist/ingest-cmd-CRMY46YC.js +0 -7
- package/dist/interactive-bind-53FCRK34.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-D7KBR7XR.js +0 -2
- package/dist/maintenance-cmd-BZAGSYGI.js +0 -2
- package/dist/pipeline-MX3ZR5B3.js +0 -2
- package/dist/readmodel-S5RAQH3F.js +0 -2
- package/dist/reconcile-cmd-4377PWF5.js +0 -2
- package/dist/revert-RQJE56HF.js +0 -2
- package/dist/review-cmd-7LXGYHHQ.js +0 -4
- package/dist/run-2AIQUJ55.js +0 -2
- package/dist/run-YH5SCBYD.js +0 -2
- package/dist/sessions-cmd-DTQYDZNT.js +0 -23
- package/dist/spawner-7KXVKAD5.js +0 -2
- package/dist/tcg-generate-U6OCCS2E.js +0 -2
- package/dist/testmd-actions-RPALXRZK.js +0 -2
- package/dist/token-refresh-S7CYBZTE.js +0 -2
- package/dist/walk-session-YIKHE6PT.js +0 -2
- /package/dist/{chunk-BC7UVJJB.js → chunk-CH273NAE.js} +0 -0
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-YSSTGJ7O.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as O}from"./chunk-TDPWFYTJ.js";import{a as b}from"./chunk-3AZTXJY4.js";import{a as N}from"./chunk-KHJXOFDM.js";import{e as A,j as w}from"./chunk-MMPFU2YC.js";import{spawn as U,execSync as B}from"child_process";import{appendFileSync as L,existsSync as E,mkdirSync as K}from"fs";import{homedir as G}from"os";import{join as D,resolve as t,dirname as C}from"path";import{fileURLToPath as W}from"url";import{createInterface as P}from"readline";async function*T(e){let n=P({input:e,crlfDelay:1/0});for await(let l of n){let r=l.trim();if(r)try{let a=JSON.parse(r);a&&typeof a.type=="string"&&(yield a)}catch{}}}function h(e){return e==="action"?{set:{V16_AGENT_ENABLE_ALL_BLOCKERS:"true",V16_BIFURCATION_PHASES:"1"},unset:["V16_NETWORK_WS","V16_NETWORK_SSE"]}:{set:{V16_BIFURCATION_PHASES:"1"},unset:["V16_AGENT_ENABLE_ALL_BLOCKERS","V16_NETWORK_WS","V16_NETWORK_SSE"]}}function M(e){return e?{set:{},unset:["V16_AGENT_SKIP_CP_FINAL"]}:{set:{V16_AGENT_SKIP_CP_FINAL:"true"},unset:[]}}function I(e){return e==="dom"?{set:{V16_AGENT_ENABLE_TEXTUAL_VISUAL:"true"},unset:[]}:{set:{},unset:["V16_AGENT_ENABLE_TEXTUAL_VISUAL"]}}var o=C(W(import.meta.url));function j(){for(let e of["python3","python"])try{return B(`${e} --version`,{stdio:"ignore"}),e}catch{}return null}function $(){let n=process.platform==="win32"?"v16-runner.exe":"v16-runner",l={"darwin-arm64":["@testmuai/kane-cli-darwin-arm64","@lambdatestincprivate/kane-cli-darwin-arm64"],"darwin-x64":["@testmuai/kane-cli-darwin-x64","@lambdatestincprivate/kane-cli-darwin-x64"],"linux-x64":["@testmuai/kane-cli-linux-x64","@lambdatestincprivate/kane-cli-linux-x64"],"linux-arm64":["@testmuai/kane-cli-linux-arm64","@lambdatestincprivate/kane-cli-linux-arm64"],"win32-x64":["@testmuai/kane-cli-win-x64","@lambdatestincprivate/kane-cli-win-x64"]},r=`${process.platform}-${process.arch}`,a=l[r];if(a)for(let s of a){let m=[t(o,"..","node_modules",s,"bin",n),t(o,"..","..","node_modules",s,"bin",n),t(o,"..","..","..","node_modules",s,"bin",n),t(o,"..","..","..","..","node_modules",s,"bin",n)];for(let u of m)if(E(u))return{cmd:u,args:[]}}let _=[t(o,"bin",n),t(o,"..","bin",n),t(o,"..","..","..","..","v16-runner","dist",n),t(o,"..","..","..","v16-runner","dist",n),t(o,"..","..","v16-runner","dist",n),t(process.cwd(),"v16-runner","dist",n),t(process.cwd(),"..","v16-runner","dist",n)];for(let s of _)if(E(s))return{cmd:s,args:[]};let v=[t(o,"..","..","v16-runner"),t(o,"..","..","..","..","v16-runner"),t(o,"..","..","..","v16-runner"),t(process.cwd(),"v16-runner"),t(process.cwd(),"..","v16-runner")];for(let s of v)if(E(t(s,"main.py"))){for(let u of[t(s,".venv","bin","python"),t(s,"..",".venv","bin","python"),t(s,"..","browser-agent",".venv","bin","python")])if(E(u))return{cmd:u,args:["main.py"],cwd:s};let m=j();if(m)return{cmd:m,args:["main.py"],cwd:s}}return null}function ie(e,n){let l=$();if(!l)throw new Error("v16-runner not found. Build the binary with `cd v16-runner && python build.py` or ensure Python is available.");process.env.KANE_SPAWN_DEBUG&&process.stderr.write(`[spawn-debug] ${JSON.stringify(l)}
|
|
3
|
-
`);let r={...process.env};n?.environment&&(r.TESTMUAI_ENV=n.environment),r.TESTMUAI_SOURCE="kane-cli",process.platform==="win32"&&(r.PYTHONIOENCODING="utf-8");let a=N(n?.environment);r.V16_SERVER_API_HOST=a.v16ServerHost,r.ATMS_URL=a.tmsBaseUrl.replace(/\/api\/?$/,""),e.username&&e.access_key&&(r.LT_USERNAME=e.username,r.LT_ACCESS_KEY=e.access_key),e.session_id&&(r.TESTMUAI_SESSION_ID=e.session_id);let _=h(n?.mode??"testing");Object.assign(r,_.set);for(let i of _.unset)delete r[i];let v=new b().load(),s=I(n?.assertionMode??(v.assertion_mode==="visual"?"visual":"dom"));Object.assign(r,s.set);for(let i of s.unset)delete r[i];let m=n?.finalValidation??v.final_validation,u=M(m);Object.assign(r,u.set);for(let i of u.unset)delete r[i];let g=O();g!==void 0&&e.ap_mode===void 0&&(e.ap_mode=g),e.telemetry_proxy_url===void 0&&process.env.KANE_TELEMETRY!=="0"&&(e.telemetry_proxy_url=w),e.media_upload===void 0&&e.org_id&&e.username&&e.access_key&&(e.media_upload={url:a.shareApiBaseUrl.replace(/\/$/,"")+"/mfs/v1.0/media/upload",artefacts_host:a.mediaArtefactsHost,org_id:e.org_id,media_dir:A});let d=U(l.cmd,l.args,{stdio:["pipe","pipe","pipe"],env:r,cwd:l.cwd});d.stdin.on("error",()=>{}),d.stdin.write(JSON.stringify(e)+`
|
|
4
|
-
`);let p=e.session_id?D(G(),".testmuai","kaneai","sessions",e.session_id,"runner-stderr.log"):null;if(p)try{K(C(p),{recursive:!0}),L(p,`--- runner spawn ${new Date().toISOString()} run_index=${e.run_index} ---
|
|
5
|
-
`)}catch{}let S=1e5,f="";d.stderr.on("data",i=>{if(f+=i.toString(),f.length>S&&(f=f.slice(-S)),p)try{L(p,i)}catch{}}),d.on("error",i=>{n?.log?.("error","RUNNER_SPAWN_ERROR","Runner spawn error",{error:i.message})});let R=null,y=null,k=new Promise(i=>{d.on("close",(c,x)=>{R=c,y=x?String(x):null,n?.log?.("info","RUNNER_EXIT","Runner exited",{code:c,signal:y??"none"}),i({code:c,signal:y})})}),V=T(d.stdout);return{child:d,events:V,sendUserResponse(i){let c=JSON.stringify({type:"user_response",answer:i});try{d.stdin.write(c+`
|
|
6
|
-
`)}catch{}},sendCancel(i){let c=JSON.stringify({type:"cancel",reason:i});try{d.stdin.write(c+`
|
|
7
|
-
`)}catch{}},cancel(){d.kill("SIGTERM")},get stderr(){return f},get exitCode(){return R},get exitSignal(){return y},exited:k}}export{$ as a,ie as b};
|
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-JXKRO2ZJ.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-KHJXOFDM.js";import"./chunk-MMPFU2YC.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-54IB6CXK.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-MTNUZEO7.js";import"./chunk-K7USHLVZ.js";import"./chunk-MR7CX5VT.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-M5PJQ5Y3.js";import{a as z}from"./chunk-3C5GMAM4.js";import"./chunk-GG43HSU2.js";import"./chunk-FMR2KPSK.js";import{d as N}from"./chunk-HLRLP6TQ.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-73OQDAXF.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-MMPFU2YC.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-TZ554O4U.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-2AIQUJ55.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-6MQYKN3G.js");return r(e)}let{bindExtractHeadless:o}=await import("./extract-bind-6MQYKN3G.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-MMPFU2YC.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-I4RB4KO3.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-55Y65VPA.js";import"./chunk-3RZ63RBO.js";import"./chunk-KHU7C6EE.js";import"./chunk-MR7CX5VT.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-73OQDAXF.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-MMPFU2YC.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-7KXVKAD5.js"),import("./bridge-QCMEOQDD.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-TZ554O4U.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-HMM5FJJO.js";import"./chunk-4CJ55EUY.js";import"./chunk-RFHMDQXZ.js";import"./chunk-RZ4F3BHX.js";import"./chunk-KHJXOFDM.js";import"./chunk-LHDNJJGE.js";import"./chunk-MMPFU2YC.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-JXKRO2ZJ.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-KHJXOFDM.js";import"./chunk-MMPFU2YC.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-54VQ46U2.js";import{a as z,c as G,d as pe,f as Z}from"./chunk-54IB6CXK.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-YIKHE6PT.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-566PPFCC.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-2AIQUJ55.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a}from"./chunk-55Y65VPA.js";import"./chunk-3RZ63RBO.js";import"./chunk-KHU7C6EE.js";import"./chunk-MR7CX5VT.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-MMPFU2YC.js";import"./chunk-UR6MHSHU.js";export{a as runDesign};
|
package/dist/run-YH5SCBYD.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-MTNUZEO7.js";import"./chunk-K7USHLVZ.js";import{f as a}from"./chunk-MR7CX5VT.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-MMPFU2YC.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-7KXVKAD5.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{d as a}from"./chunk-DSOA6L73.js";import"./chunk-ZP4S5WGW.js";import"./chunk-3MSXQU2C.js";import"./chunk-FSB3FTIQ.js";import"./chunk-H2W2UNTN.js";import"./chunk-RZJVQUBA.js";import"./chunk-2XMJ6YAE.js";import"./chunk-KHQHVSZ6.js";import"./chunk-XWSAKVEY.js";import"./chunk-HOQEMPMQ.js";import"./chunk-NJAHRITS.js";import"./chunk-2YQ6TW77.js";import"./chunk-7NLQ3QQD.js";import"./chunk-OIYGGEUL.js";import"./chunk-RKWJG3WW.js";import"./chunk-MFOH7EYR.js";import"./chunk-ZNHXIRCM.js";import"./chunk-NTNAHN25.js";import"./chunk-OGWC3J3C.js";import"./chunk-YSSTGJ7O.js";import"./chunk-TDPWFYTJ.js";import"./chunk-3AZTXJY4.js";import"./chunk-MRP54NCJ.js";import"./chunk-XXMNUJX4.js";import"./chunk-5Y2G4NC7.js";import"./chunk-2WKX3RMA.js";import"./chunk-KSZ72BSC.js";import"./chunk-C5UNZ6ZY.js";import"./chunk-S3DAAAE5.js";import"./chunk-XZRIQ3GF.js";import"./chunk-HMM5FJJO.js";import"./chunk-4CJ55EUY.js";import"./chunk-FPFOW6BS.js";import"./chunk-WAOCHXJ5.js";import"./chunk-NUQ423YE.js";import"./chunk-RFHMDQXZ.js";import"./chunk-JXKRO2ZJ.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-EAUUULJQ.js";import"./chunk-GLA6QL3T.js";import"./chunk-SURF5Z7Y.js";import"./chunk-YCCUBQY4.js";import"./chunk-GIMTSDNC.js";import"./chunk-Y5RNCJAN.js";import"./chunk-5EOX4MEY.js";import"./chunk-POYZ6SAI.js";import"./chunk-2WVKOZ6W.js";import"./chunk-NLCCBXXV.js";import"./chunk-RZ4F3BHX.js";import"./chunk-KHJXOFDM.js";import"./chunk-VE3SUJMA.js";import"./chunk-E47GFYXA.js";import"./chunk-LHDNJJGE.js";import"./chunk-7MRBMDZ5.js";import"./chunk-QJIJC3KC.js";import{a as o}from"./chunk-DFS4RMVP.js";import"./chunk-NTGYFYBP.js";import"./chunk-KXUSG5ZI.js";import"./chunk-MMPFU2YC.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-XWSAKVEY.js";import"./chunk-HOQEMPMQ.js";import"./chunk-NJAHRITS.js";import"./chunk-2YQ6TW77.js";import"./chunk-RKWJG3WW.js";import"./chunk-3AZTXJY4.js";import"./chunk-XZRIQ3GF.js";import"./chunk-4CJ55EUY.js";import"./chunk-FPFOW6BS.js";import"./chunk-WAOCHXJ5.js";import"./chunk-L5LI2JF4.js";import"./chunk-GIMTSDNC.js";import"./chunk-Y5RNCJAN.js";import"./chunk-5EOX4MEY.js";import"./chunk-NLCCBXXV.js";import"./chunk-RZ4F3BHX.js";import"./chunk-KHJXOFDM.js";import"./chunk-LHDNJJGE.js";import"./chunk-KXUSG5ZI.js";import"./chunk-MMPFU2YC.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-XZRIQ3GF.js";import"./chunk-4CJ55EUY.js";import"./chunk-RZ4F3BHX.js";import"./chunk-KHJXOFDM.js";import"./chunk-MMPFU2YC.js";import"./chunk-UR6MHSHU.js";export{a as refreshOAuthToken};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as se}from"./chunk-54VQ46U2.js";import{a as X,c as z,d as ae}from"./chunk-54IB6CXK.js";import"./chunk-GRB66C5S.js";import"./chunk-JFAFKHDX.js";import"./chunk-3C5GMAM4.js";import{b as Q,c as ne,d as ie}from"./chunk-RGJIRS3B.js";import{a as U}from"./chunk-IQODWB32.js";import"./chunk-RN4OSVTG.js";import"./chunk-DNNZ353O.js";import"./chunk-QM4S2APK.js";import"./chunk-BC7UVJJB.js";import"./chunk-NVGBE2DR.js";import{a as V}from"./chunk-7E24OCGX.js";import{b as oe}from"./chunk-FRBYGSGJ.js";import"./chunk-6W6AIDLJ.js";import"./chunk-6HYW5RFX.js";import{e as re}from"./chunk-J2KSZUOO.js";import"./chunk-5YPBPZUR.js";import"./chunk-IAHKTEET.js";import{a as G}from"./chunk-YCCUBQY4.js";import{y as c}from"./chunk-MMPFU2YC.js";import{a as F}from"./chunk-HCBYKLMW.js";import{a as b,b as s,k as j}from"./chunk-C44QQJR4.js";import{a as we}from"./chunk-6YGTRKDT.js";import{e as B}from"./chunk-UR6MHSHU.js";var E=B(we(),1);function le(e,h,w){let{ref:A,reason:p,by:R}=w;if(!p||p.trim().length===0)return{record:null,errors:[{code:"REASON_REQUIRED",detail:"archiving a node needs a reason \u2014 it becomes the tombstone's provenance"}]};let v=h.resolve(A);if(!v)return{record:null,errors:[{code:"UNKNOWN_REF",detail:`no node '${A}' in the graph`}]};let o=h.tipOf(v.cid);if(h.superseded.has(o))return{record:null,errors:[{code:"ALREADY_ARCHIVED",detail:`${A} is already superseded at its tip (${o.slice(0,19)}\u2026)`}]};let i=re(e,{ts:new Date().toISOString(),proposal_id:null,nodes:[],edges:[],review:[],supersessions:[{kind:"node",old:o,new:null,reason:p,by:R}],source_head_moves:{}},{expectPrev:h.latestHash});return oe(e),{record:i.record,errors:null}}function ce(e){let h=e.by??{kind:"human",id:process.env.USER??"operator"},w=e.mode==="interactive"?"override":e.mode,A={out:()=>{},err:()=>{},isTTY:!1,confirm:async()=>!0},p={applied:0,committed:0,retired:0,skipped:0,deferred:0,failed:0},R=new Map;for(let o of e.planRows)if(o.held_ref&&e.held){let i=e.held.rows.find(n=>n.temp_ref===o.held_ref);if(!i)continue;let x={kind:i.kind,ref:i.temp_ref,title:i.title,why:i.why,origin:"content-change",...o.impact?{impact:o.impact}:{}};R.set(x.ref,{card:x,source:"held",heldRef:i.temp_ref})}else if(o.kind==="MODIFY"){let i={kind:"MODIFY",ref:o.ref,title:o.ref,why:`${o.reason}: ${o.provenance}`,origin:o.origin??"structural-stale",...o.impact?{impact:o.impact}:{}};R.set(i.ref,{card:i,source:"row",row:o})}else if(o.kind==="ADD"){let i={kind:"ADD",ref:o.ref,title:o.ref,why:o.reason,origin:o.origin??"content-change"};R.set(i.ref,{card:i,source:"row",row:o})}for(let o of e.archive){if(o.kind!=="ARCHIVE")continue;let i={kind:"ARCHIVE",ref:o.ref,title:o.ref,why:o.why,provenance:o.why,...o.impact?{impact:o.impact}:{}};R.set(i.ref,{card:i,source:"archive",row:o})}let v=o=>(p.failed++,{outcome:"failed",detail:o});return{cards:()=>[...R.values()].map(o=>o.card),async submit(o,i){let x=R.get(o);if(!x)return v(`no card ${o}`);if(i.v==="skip")return p.skipped++,e.signals({ref:o,verdict:"gap-dismissed"}),{outcome:"skipped"};if(i.v==="defer")return p.deferred++,{outcome:"deferred"};if(i.v==="archive"){if(x.source!=="archive")return v(`${o} is not an ARCHIVE card`);let l=V(e.contextDir),$=l.resolve(x.row.ref);if($&&l.superseded.has(l.tipOf($.cid)))return p.skipped++,{outcome:"skipped",detail:"already retired \u2014 nothing to do"};let D=le(e.contextDir,V(e.contextDir),{ref:x.row.ref,reason:`reconcile retire: ${x.row.why}`,by:h});return D.errors?v(D.errors.map(a=>`${a.code}: ${a.detail}`).join("; ")):(p.retired++,e.signals({ref:o,verdict:"gap-resolved-archive",reason:x.row.why}),{outcome:"retired"})}if(x.source==="archive")return v(`${o} takes archive/skip/defer, not approve`);if(x.source==="held"){let l=se(e.contextDir,e.held,x.heldRef,h,i.edits);if(!l.ok)return v(l.message);if(l.kind==="ADD"){let $=await e.runDesign(l.ref,{yes:!0,mode:w,...i.steering?{because:i.steering}:{}});return $!==0?(p.failed++,{outcome:"failed",landed:!0,detail:`committed ${l.ref}, but its design run exited ${$} \u2014 finish with kane-cli design tests --use-case ${l.ref}`}):(p.applied++,e.signals({ref:o,verdict:"gap-resolved-create",...i.steering?{reason:i.steering}:{}}),{outcome:"applied",detail:l.ref})}if(i.steering){let $=V(e.contextDir),D=X($,l.ref);if(!D.ok)return p.committed++,{outcome:"committed",detail:`committed ${l.ref}, but steering could not resolve it (${D.message}) \u2014 steer via kane-cli maintain evolve ${l.ref}`};let a=await z(e.contextDir,D.target,{yes:!0,mode:w,because:i.steering},A,e.runDesign,"batch");if(a.outcome==="no-design"){let d=await e.runDesign(D.target.seamRef,{yes:!0,mode:w,because:i.steering});return d!==0?(p.failed++,{outcome:"failed",landed:!0,detail:`committed ${l.ref}, but its steered design run exited ${d} \u2014 finish with kane-cli design tests --use-case ${D.target.seamRef}`}):(p.applied++,e.signals({ref:o,verdict:"gap-resolved-create",reason:i.steering}),{outcome:"applied",detail:l.ref})}return a.outcome==="failed"||a.outcome==="paused"?(p.failed++,{outcome:"failed",landed:!0,detail:`committed ${l.ref}, but the steering evolve ${a.outcome} (exit ${a.code}) \u2014 finish with kane-cli maintain evolve ${l.ref}`}):a.outcome==="declined"?(p.committed++,{outcome:"committed",detail:`committed ${l.ref} \u2014 the steering evolve was declined; re-run kane-cli maintain evolve ${l.ref}`}):(p.applied++,e.signals({ref:o,verdict:"gap-resolved-evolve",reason:i.steering}),{outcome:"applied",detail:l.ref})}return p.committed++,e.signals({ref:o,verdict:"gap-resolved-evolve"}),{outcome:"committed",detail:l.ref}}let n=V(e.contextDir),g=X(n,x.row.ref);if(!g.ok)return v(g.message);if(x.card.kind==="ADD"){let l=await e.runDesign(g.target.seamRef,{yes:!0,mode:w});return l!==0?v(`design run exited ${l}`):(p.applied++,e.signals({ref:o,verdict:"gap-resolved-create"}),{outcome:"applied"})}let y=await z(e.contextDir,g.target,{yes:!0,mode:w,...i.steering?{because:i.steering}:{}},A,e.runDesign,"batch");return y.outcome==="evolved"?(p.applied++,e.signals({ref:o,verdict:"gap-resolved-evolve",...i.steering?{reason:i.steering}:{}}),{outcome:"applied"}):y.outcome==="failed"||y.outcome==="paused"?v(`evolve ${y.outcome} (exit ${y.code})`):(p.skipped++,{outcome:"skipped",detail:y.outcome})},summary:()=>({...p})}}var m=B(F(),1);function L(e){return e.kind==="ARCHIVE"?[{v:"archive",label:"retire",detail:"tombstone it \u2014 the graph forgets forward"},{v:"skip",label:"skip",detail:"keep it \u2014 decided, never re-offered"},{v:"defer",label:"defer",detail:"not now \u2014 the plan re-offers it"}]:[{v:"approve",label:"approve",detail:e.kind==="ADD"?"commit + design it":"commit the updated version (old\u2192new redirect)"},{v:"skip",label:e.origin==="content-change"?"reject":"skip",detail:e.origin==="content-change"?"drop the staged proposal \u2014 nothing committed":"leave it as is"},{v:"defer",label:"defer",detail:"not now \u2014 the plan keeps it staged"}]}function Y(e){return e.kind==="ARCHIVE"?null:L(e).length}var ye={ADD:{color:c.green??"green"},MODIFY:{color:"yellow"},ARCHIVE:{color:c.red}},be=60,Re=100;function de({card:e,position:h,sel:w=0,focused:A=!1,freeText:p=null}){let{stdout:R}=j(),v=R?.columns??80,o=v<be,i=Math.min(v-1,Re),x=L(e),n=Y(e),g=ye[e.kind],y=T=>A&&w===T?(0,m.jsx)(s,{color:c.assuranceAccent,children:"\u276F"}):" ",l=e.impact,$=l&&l.stale_refs.length>0?`${e.kind==="ARCHIVE"?"retiring drops":"approving marks"} ${l.stale_refs.length} item(s) stale`+((l.direct_refs?.length??0)>0?` \u2014 ${l.direct_refs.length} directly touched: ${l.direct_refs.join(", ")}`:""):null,D=`? reconcile \u2014 item ${h.n} of ${h.of}`,a=n!==null?"\u2191\u2193 \xB7 \u23CE select \xB7 1-9 \xB7 type = adjust \xB7 esc \xB7 nothing to undo":"\u2191\u2193 \xB7 \u23CE select \xB7 1-9 \xB7 esc \xB7 nothing to undo",d=(0,m.jsxs)(b,{flexDirection:"column",children:[(0,m.jsx)(b,{paddingLeft:2,children:(0,m.jsxs)(s,{bold:!0,children:[(0,m.jsx)(s,{color:g.color,children:`[${e.kind}]`}),` ${U(e.title)}`]})}),(0,m.jsx)(b,{paddingLeft:2,children:(0,m.jsx)(s,{color:c.muted,children:e.why})}),$?(0,m.jsx)(b,{paddingLeft:2,children:(0,m.jsx)(s,{color:c.muted,children:`impact: ${$}`})}):null,e.kind==="ARCHIVE"&&e.provenance&&e.provenance!==e.why?(0,m.jsx)(b,{paddingLeft:2,children:(0,m.jsx)(s,{color:c.muted,children:e.provenance})}):null,(0,m.jsx)(s,{children:" "}),x.map((T,S)=>(0,m.jsxs)(s,{children:[y(S),` ${S+1}. ${T.label}`,(0,m.jsx)(s,{color:c.dim,children:` \u2014 ${T.detail}`})]},`o-${S}`)),n!==null?p?(0,m.jsxs)(b,{flexDirection:"column",children:[(0,m.jsxs)(b,{children:[(0,m.jsxs)(s,{children:[(0,m.jsx)(s,{color:c.assuranceAccent,children:"\u276F"})," ",(0,m.jsx)(s,{color:c.dim,children:"\u270E "})]}),(0,m.jsx)(G,{value:p.value,onChange:p.onChange,onSubmit:p.onSubmit,onCancel:p.onCancel,placeholder:"say what to adjust"})]}),(0,m.jsx)(s,{color:c.muted,children:" submits as: approve \xB7 your words steer the re-design"})]}):(0,m.jsxs)(s,{children:[y(n)," ",(0,m.jsx)(s,{color:c.dim,children:"\u270E approve with changes \u2014 say what to adjust"})]}):null]});if(o)return(0,m.jsxs)(b,{marginTop:1,marginBottom:1,flexDirection:"column",children:[(0,m.jsx)(s,{bold:!0,color:c.assuranceAccent,children:D}),d,(0,m.jsx)(s,{color:c.muted,children:a})]});let W=Math.max(2,i-(3+D.length+1)),C=Math.max(2,i-(3+a.length+1));return(0,m.jsxs)(b,{marginTop:1,marginBottom:1,flexDirection:"column",children:[(0,m.jsxs)(s,{color:c.assuranceAccent,children:["\u2500\u2500 ",(0,m.jsx)(s,{bold:!0,children:D}),` ${"\u2500".repeat(W)}`]}),(0,m.jsx)(s,{children:" "}),d,(0,m.jsx)(s,{children:" "}),(0,m.jsxs)(s,{color:c.assuranceAccent,children:["\u2500\u2500 ",(0,m.jsx)(s,{color:c.muted,children:a}),` ${"\u2500".repeat(C)}`]})]})}var _=B(F(),1);function K({mark:e,markColor:h,color:w,indent:A=2,reserve:p=0,children:R}){let{stdout:v}=j(),o=(v?.columns??80)-p,i=A+e.length+1;return(0,_.jsxs)(b,{children:[(0,_.jsx)(b,{width:i,flexShrink:0,children:(0,_.jsx)(s,{color:h,children:`${" ".repeat(A)}${e}`})}),(0,_.jsx)(b,{width:Math.max(20,o-i),children:(0,_.jsx)(s,{color:w,children:R})})]})}var u=B(F(),1);function ue(e){return e.landed?"committed":e.outcome}var $e={applied:{mark:"\u2714",color:"green"},committed:{mark:"\u2714",color:"green"},retired:{mark:"\u2714",color:"green"},skipped:{mark:"\xB7",color:"dim"},deferred:{mark:"\u2013",color:"dim"},failed:{mark:"\u2717",color:"red"}},q=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"];function Ce(e){return e.v==="archive"?"Retiring\u2026":e.v==="approve"&&e.steering?"Approving with your changes \u2014 committing, then re-designing\u2026":"Applying \u2014 committing\u2026"}function Te({controller:e,cards:h,note:w,markOutcome:A,routeChat:p,listEvolveTargets:R,barSubject:v,onFinish:o,onCtrlC:i,pauseRef:x}){let[n,g]=(0,E.useState)(h.length>0?{at:"card",idx:0,sel:0,editor:null}:{at:"done-panel",sel:0}),y=(0,E.useRef)(0),l=(0,E.useRef)(n);l.current=n;let $=(0,E.useRef)([]),[D,a]=(0,E.useState)(0),d=n.at==="busy"||n.at==="evolving";(0,E.useEffect)(()=>{if(!d)return;let t=setInterval(()=>a(r=>r+1),120);return()=>clearInterval(t)},[d]);let W=(0,E.useRef)(!1),C=()=>{w((0,u.jsx)(s,{color:c.dim,children:"walk paused \u2014 every verdict so far is committed; re-run the same command to continue"})),o(3)},T=()=>{if(W.current)return;W.current=!0;let t=l.current;if(t.at==="busy"||t.at==="evolving"){w((0,u.jsx)(s,{color:c.dim,children:"finishing the current item, then pausing\u2026"}));return}if(t.at==="done-panel"||t.at==="picker"||t.at==="why"||t.at==="view"){o(y.current);return}C()};x&&(x.current=T);let S=n.at==="card"||n.at==="busy"?h[n.idx]:null,O=()=>[{key:"finish",label:"finish"},...R?[{key:"evolve",label:"evolve another use-case\u2026"}]:[],...$.current.length>0?[{key:"view",label:"view what changed"}]:[]],I=()=>{let t=R?.()??[];if(t.length===0){w((0,u.jsx)(s,{color:c.dim,children:"nothing is stale \u2014 no evolve targets right now"})),g({at:"done-panel",sel:0});return}g({at:"picker",items:t,sel:0})},P=t=>{let r=t+1;if(r<h.length)g({at:"card",idx:r,sel:0,editor:null});else{let f=e.summary();w((0,u.jsx)(s,{color:c.dim,children:`reconcile walk: ${f.applied} applied, ${f.committed} committed, ${f.retired} retired, ${f.skipped} skipped, ${f.deferred} deferred`+(f.failed>0?`, ${f.failed} failed`:"")})),g({at:"done-panel",sel:0})}},N=(0,E.useRef)(!1),M=(t,r)=>{if(N.current)return;N.current=!0;let f=h[t];g({at:"busy",idx:t,label:Ce(r),startedAt:Date.now()}),e.submit(f.ref,r).catch(k=>({outcome:"failed",detail:k instanceof Error?k.message:String(k)})).then(k=>{let H=$e[k.outcome]??{mark:"\xB7",color:"dim"},xe=k.outcome!=="failed"&&k.outcome!=="skipped"&&k.outcome!=="deferred"&&f.impact&&f.impact.stale_refs.length>0?` \xB7 ${f.impact.stale_refs.length} item(s) now stale`:"",te=`${k.outcome} [${f.kind}] ${U(f.title)}${k.detail?` \u2014 ${U(k.detail)}`:""}${xe}`;if($.current.push({mark:H.mark,color:H.color,line:te}),w((0,u.jsx)(K,{mark:H.mark,markColor:H.color==="green"?c.green:H.color==="red"?c.red:c.dim,color:H.color==="dim"?c.dim:void 0,children:te})),k.outcome==="failed"&&(y.current=y.current===0?1:y.current),A(f.ref,ue(k)),N.current=!1,W.current){C();return}P(t)})},me=(t,r)=>{g({at:"evolving",title:t.title,startedAt:Date.now()}),p(`${t.key} ${r}`).catch(f=>`\u2717 evolve failed: ${f instanceof Error?f.message:String(f)}`).then(f=>{let k=f.startsWith("\u2713");if($.current.push({mark:k?"\u2714":"\u2717",color:k?"green":"red",line:f.replace(/^[✓✗]\s*/,"")}),w((0,u.jsx)(K,{mark:k?"\u2714":"\u2717",markColor:k?c.green:c.red,children:f.replace(/^[✓✗]\s*/,"")})),W.current){o(y.current);return}g({at:"done-panel",sel:0})})},pe=(0,E.useMemo)(()=>({isFocused:()=>{let t=l.current;return t.at==="card"&&t.editor===null||t.at==="done-panel"||t.at==="picker"||t.at==="view"},onMove:t=>{g(r=>{if(r.at==="card"){let f=h[r.idx],k=Y(f)??L(f).length-1;return{...r,sel:Math.max(0,Math.min(k,r.sel+t))}}return r.at==="done-panel"?{...r,sel:Math.max(0,Math.min(O().length-1,r.sel+t))}:r.at==="picker"?{...r,sel:Math.max(0,Math.min(r.items.length-1,r.sel+t))}:r})},onSelect:()=>{let t=l.current;if(t.at==="card"){let r=h[t.idx],f=Y(r);if(f!==null&&t.sel===f){g({...t,editor:""});return}let k=L(r)[t.sel];k&&M(t.idx,{v:k.v});return}if(t.at==="done-panel"){let r=O()[t.sel];r?.key==="finish"?o(y.current):r?.key==="evolve"?I():r?.key==="view"&&g({at:"view"});return}if(t.at==="picker"){let r=t.items[t.sel];r&&g({at:"why",item:r,text:""});return}},onDigit:t=>{let r=l.current;if(r.at==="card"){let f=L(h[r.idx])[t-1];f&&M(r.idx,{v:f.v});return}r.at==="done-panel"&&t-1<O().length&&g({...r,sel:t-1}),r.at==="picker"&&t-1<r.items.length&&g({...r,sel:t-1})},onType:t=>{g(r=>r.at!=="card"||Y(h[r.idx])===null?r:{...r,editor:(r.editor??"")+t})},isMulti:()=>!1,onSpace:()=>{},onBack:()=>{let t=l.current;(t.at==="picker"||t.at==="view")&&g({at:"done-panel",sel:0})}}),[h]);(0,E.useEffect)(()=>{n.at==="done"&&o(y.current)},[n.at]);let fe=n.at==="card"||n.at==="done-panel"||n.at==="picker"||n.at==="why"||n.at==="view",ge=n.at==="card"||n.at==="busy"?`${v?`${v} \xB7 `:""}item ${n.idx+1} of ${h.length}`:v,J=t=>Math.floor((Date.now()-t)/1e3),{stdout:he}=j(),Z=Math.min((he?.columns??80)-1,100),ee=`view \xB7 this run's changes \xB7 ${$.current.length}`,ve=Math.max(2,Z-(3+ee.length+1)),ke=Math.max(2,Z-12);return(0,u.jsxs)(b,{flexDirection:"column",children:[(0,u.jsx)(ie,{onToggleThinking:()=>{},onCtrlC:()=>{i(),T()},panel:pe}),n.at==="card"&&S?(0,u.jsx)(de,{card:S,position:{n:n.idx+1,of:h.length},sel:n.sel,focused:n.editor===null,freeText:n.editor!==null?{value:n.editor,onChange:t=>g(r=>r.at==="card"?{...r,editor:t}:r),onSubmit:t=>{let r=l.current;r.at==="card"&&(t.trim()?M(r.idx,{v:"approve",steering:t.trim()}):g({...r,editor:null}))},onCancel:()=>g(t=>t.at==="card"?{...t,editor:null}:t)}:null}):null,n.at==="busy"?(0,u.jsxs)(s,{color:c.assuranceAccent,children:[`${q[D%q.length]} ${n.label} `,(0,u.jsx)(s,{color:c.dim,children:`(${J(n.startedAt)}s)`})]}):null,n.at==="evolving"?(0,u.jsxs)(s,{color:c.assuranceAccent,children:[`${q[D%q.length]} Evolving ${n.title}\u2026 `,(0,u.jsx)(s,{color:c.dim,children:`(${J(n.startedAt)}s)`})]}):null,n.at==="done-panel"?(0,u.jsx)(Q,{headline:(()=>{let t=e.summary();return`reconcile done \u2014 ${t.applied+t.committed} applied \xB7 ${t.retired} retired \xB7 ${t.skipped} skipped \xB7 ${t.deferred} deferred${t.failed>0?` \xB7 ${t.failed} failed`:""}`})(),rows:O(),sel:n.sel,focused:!0,legend:"\u2191\u2193 \xB7 \u23CE select"}):null,n.at==="picker"?(0,u.jsx)(Q,{ask:!0,headline:"evolve which use-case?",rows:n.items.map(t=>({key:t.key,label:t.title,detail:t.badge})),sel:n.sel,focused:!0,legend:"\u2191\u2193 \xB7 \u23CE select \xB7 esc back"}):null,n.at==="why"?(0,u.jsxs)(b,{flexDirection:"column",borderStyle:"round",borderColor:c.assuranceAccent,paddingX:1,children:[(0,u.jsxs)(b,{children:[(0,u.jsxs)(s,{children:[(0,u.jsx)(s,{color:c.assuranceAccent,children:"\u25B8"})," ",(0,u.jsx)(s,{color:c.dim,children:"\u270E "})]}),(0,u.jsx)(G,{value:n.text,onChange:t=>g(r=>r.at==="why"?{...r,text:t}:r),onSubmit:t=>{let r=l.current;r.at==="why"&&(t.trim()?me(r.item,t.trim()):g({at:"picker",items:[r.item],sel:0}))},onCancel:()=>{l.current.at==="why"&&I()},placeholder:`what should change about ${n.item.title}?`})]}),(0,u.jsx)(s,{color:c.muted,children:" \u23CE submit \xB7 esc back"})]}):null,n.at==="view"?(0,u.jsxs)(b,{marginTop:1,marginBottom:1,flexDirection:"column",children:[(0,u.jsxs)(s,{color:c.assuranceAccent,children:["\u2500\u2500 ",(0,u.jsx)(s,{bold:!0,children:ee}),` ${"\u2500".repeat(ve)}`]}),(0,u.jsx)(s,{children:" "}),$.current.map((t,r)=>(0,u.jsx)(K,{mark:t.mark,markColor:t.color==="green"?c.green:t.color==="red"?c.red:c.dim,color:t.color==="dim"?c.dim:void 0,indent:0,reserve:0,children:t.line},`vc-${r}`)),(0,u.jsx)(s,{children:" "}),(0,u.jsxs)(s,{color:c.assuranceAccent,children:["\u2500\u2500 ",(0,u.jsx)(s,{color:c.muted,children:"esc back"}),` ${"\u2500".repeat(ke)}`]})]}):null,(0,u.jsx)(ne,{verb:"maintain",subject:ge,state:fe?"idle":void 0,hints:"ctrl+c exit"})]})}async function tt(e){let h={current:null},w=a=>{h.current?.append(a)},A=null,p=async(a,d)=>{let[{runDesign:W},{resolveAgentAuthEnv:C},{runAgent:T},{preflightTurn:S}]=await Promise.all([import("./run-2AIQUJ55.js"),import("./spawner-7KXVKAD5.js"),import("./bridge-QCMEOQDD.js"),import("./turn-preflight-JGYT7LXP.js")]);A??=await C();let O=A;return W({useCase:a,force:!0,mode:d.mode??"override",...d.because?{because:d.because}:{},...d.changeDelta!==void 0?{changeDelta:d.changeDelta}:{},...d.priorDesign!==void 0?{priorDesign:d.priorDesign}:{}},{contextDir:e.dir,agent:T,preflightTurn:()=>S(O),ask:async()=>[],out:()=>{},progress:()=>{},isTTY:!1,auth:O})},R=e.runDesign??p,v=ce({contextDir:e.dir,held:e.held,archive:e.archive,planRows:e.rows,runDesign:R,mode:"interactive",signals:e.signals}),o=new Set(e.rows.filter(a=>a.applied!==void 0).map(a=>a.held_ref??a.ref)),i=v.cards().filter(a=>!o.has(a.ref)&&!(a.kind==="ARCHIVE"&&e.archiveState?.[a.ref]!==void 0)),x=a=>e.rows.findIndex(d=>(d.held_ref??d.ref)===a),n=(a,d)=>{try{if(i.find(T=>T.ref===a)?.kind==="ARCHIVE"){d==="retired"?e.markA?.(a,"retired"):d==="skipped"&&e.markA?.(a,"skipped");return}let C=x(a);if(C<0)return;d==="applied"||d==="committed"?e.mark?.(C,"approved"):d==="skipped"&&e.mark?.(C,"skipped")}catch{}},g=async a=>{let[{openGraph:d},{resolveParentUc:W,evolveOneUc:C}]=await Promise.all([import("./readmodel-S5RAQH3F.js"),import("./evolve-cmd-UE2BIMXK.js")]),[T,...S]=a.split(/\s+/),O=d(e.dir),I=W(O,T);if(!I.ok)return`couldn't resolve '${T}' \u2014 start with a use-case id (uc-\u2026): ${I.message}`;if(S.length===0)return`say what to change: \`${T} <your words>\` \u2014 the words become the redesign's change delta`;let P=S.join(" "),N={out:()=>{},err:()=>{},isTTY:!1,confirm:async()=>!0},M=await C(e.dir,I.target,{yes:!0,mode:"override",because:P},N,R,"batch");return M.outcome==="evolved"?(e.signals({ref:I.target.display,verdict:"gap-resolved-evolve",reason:P}),`\u2713 redesigned ${I.target.display} \u2014 "${P}"`):`\u2717 evolve ${M.outcome} for ${I.target.display} (exit ${M.code})`},y=e.listEvolveTargets??(()=>{let a=V(e.dir);return ae(a).targets.map(d=>({key:d.display,title:d.display,badge:"stale"}))});if(e.script){let a=0;for(let d of i){let W=await e.script(d),C=await v.submit(d.ref,W);C.outcome==="failed"&&a===0&&(a=1),n(d.ref,ue(C))}return a}let[{render:l},{ScrollbackProvider:$},{ScrollbackTap:D}]=await Promise.all([import("./build-JIKYOZUH.js"),import("./scrollback-JLPJR25X.js"),import("./ScrollbackTap-Q3IOKNMS.js")]);return new Promise(a=>{let d=!1,W=P=>{d||(d=!0,(async()=>{process.removeListener("SIGINT",O),await h.current?.flush();try{I.unmount()}catch{}a(P)})())},C=0,T={current:null},S=()=>{if(C+=1,C>=2){process.removeListener("SIGINT",O);try{I.unmount()}catch{}a(130)}},O=()=>{S(),T.current?.()};process.on("SIGINT",O);let I=l((0,u.jsxs)($,{children:[(0,u.jsx)(D,{into:h}),(0,u.jsx)(Te,{controller:v,cards:i,note:w,markOutcome:n,routeChat:g,listEvolveTargets:y,barSubject:e.barSubject,onFinish:W,onCtrlC:S,pauseRef:T})]}),{exitOnCtrlC:!1})})}export{Te as WalkSessionSurface,ue as outcomeToMark,tt as runWalkSession};
|
|
File without changes
|