@testmuai/kane-cli 0.8.14 → 0.8.16
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-AVL3TJA2.js → ChatSurface-5JEEFY34.js} +1 -1
- package/dist/{ChromeProfilePicker-WJZJOZ6Z.js → ChromeProfilePicker-6IVAYCWJ.js} +1 -1
- package/dist/{CliFeedbackPrompt-65BQF5G5.js → CliFeedbackPrompt-K4IN7S6J.js} +1 -1
- package/dist/{CliUploadProgress-HEBZYKGN.js → CliUploadProgress-MI4H4LKT.js} +1 -1
- package/dist/{ConfigView-JEVQ2SO4.js → ConfigView-CJY5MB6H.js} +1 -1
- package/dist/EvidenceViewOffer-ABKTGD4K.js +2 -0
- package/dist/FolderPicker-RQIVS7ZR.js +2 -0
- package/dist/{InfoBox-KM5DLBCV.js → InfoBox-RP6RDCG7.js} +1 -1
- package/dist/{LinksBox-FQA36GTV.js → LinksBox-QOQJ3S2I.js} +1 -1
- package/dist/{ProfilesView-76KGHTMK.js → ProfilesView-BZEBT6R5.js} +1 -1
- package/dist/{ProjectPicker-65YOU46H.js → ProjectPicker-J42MEJRQ.js} +1 -1
- package/dist/{SaveSessionPrompt-QD6BNTWO.js → SaveSessionPrompt-MKAIUVX7.js} +1 -1
- package/dist/SingleShotApp-TZZ2J7ZO.js +2 -0
- package/dist/{SummaryBox-N2B6DUDD.js → SummaryBox-JQJKGYDM.js} +1 -1
- package/dist/TestMdRunView-2YVGGFLU.js +2 -0
- package/dist/{TestrunEvidenceTable-3WLQVTF4.js → TestrunEvidenceTable-FYDS3ZVU.js} +1 -1
- package/dist/{WhoamiView-T26HA4ZZ.js → WhoamiView-F4PPB7SN.js} +1 -1
- package/dist/{app-download-XKZWFMEK.js → app-download-RA4CGTC5.js} +1 -1
- package/dist/{auth-PPJANIMZ.js → auth-TAT427C3.js} +1 -1
- package/dist/{binary-DKWWODT2.js → binary-OFPMBJ34.js} +1 -1
- package/dist/{bind-62AZYFAY.js → bind-LY362KX7.js} +2 -2
- package/dist/{bootstrap-6IJNZIPT.js → bootstrap-RCDB5OWA.js} +1 -1
- package/dist/bridge-E2NGMJYM.js +2 -0
- package/dist/{changelog-UTGJ7FSP.js → changelog-ZC3LHV2Z.js} +1 -1
- package/dist/{chunk-O5AS2ZIX.js → chunk-23MVD7GY.js} +1 -1
- package/dist/{chunk-X74PP5NJ.js → chunk-2GWMENG5.js} +1 -1
- package/dist/{chunk-75I46VTM.js → chunk-3AVBUEBL.js} +2 -2
- package/dist/chunk-3LXN6AV5.js +5 -0
- package/dist/{chunk-NOLYYHVG.js → chunk-3MVEGB2I.js} +1 -1
- package/dist/{chunk-42FHKRPA.js → chunk-4LVZLLTN.js} +3 -3
- package/dist/{chunk-73ULUGBM.js → chunk-4PWYSDZR.js} +1 -1
- package/dist/{chunk-7RAI77XD.js → chunk-4WEVTED6.js} +1 -1
- package/dist/{chunk-CGT4NFQN.js → chunk-5ACSALRU.js} +3 -3
- package/dist/{chunk-SX56MVUO.js → chunk-5VZAWKDF.js} +1 -1
- package/dist/{chunk-2BFXT7VQ.js → chunk-6HCY5LJO.js} +14 -14
- package/dist/{chunk-XGHMZJGI.js → chunk-7P6FSGRD.js} +2 -2
- package/dist/{chunk-UXH3RMQ7.js → chunk-7QUFOWMU.js} +1 -1
- package/dist/{chunk-O2APH6TZ.js → chunk-7XMDCGIZ.js} +1 -1
- package/dist/{chunk-LL5DQO6V.js → chunk-AAT4O22C.js} +1 -1
- package/dist/{chunk-FFFB5BXL.js → chunk-AGKE5WF3.js} +1 -1
- package/dist/{chunk-OH2NSBO6.js → chunk-BCJNIDS3.js} +1 -1
- package/dist/{chunk-3BHRGHIZ.js → chunk-BK42G6RI.js} +1 -1
- package/dist/{chunk-YHR2YAN5.js → chunk-BY2MU3ZS.js} +1 -1
- package/dist/{chunk-AC7BPO4X.js → chunk-C6JFTSIQ.js} +1 -1
- package/dist/chunk-CAOZKSQ3.js +8 -0
- package/dist/{chunk-DA57DXCF.js → chunk-CDWUZ54U.js} +1 -1
- package/dist/{chunk-3YX3RQXO.js → chunk-CR7UWQ76.js} +1 -1
- package/dist/{chunk-LR5DJ6EN.js → chunk-CVNHUDT4.js} +1 -1
- package/dist/{chunk-MLRO7OH3.js → chunk-DSWHEEHN.js} +1 -1
- package/dist/{chunk-6LGED4FC.js → chunk-E44OHYDS.js} +2 -2
- package/dist/{chunk-BJYGWXVP.js → chunk-ECIGXPLN.js} +1 -1
- package/dist/{chunk-QJ5O27SJ.js → chunk-EMAKLNDV.js} +1 -1
- package/dist/{chunk-B2ZGG7WM.js → chunk-F2XTOZTN.js} +1 -1
- package/dist/{chunk-ARG56PJG.js → chunk-FQFVAFWK.js} +1 -1
- package/dist/{chunk-SFTFHFG3.js → chunk-FWPRUGJJ.js} +1 -1
- package/dist/{chunk-4K5XTIJ6.js → chunk-FYJ62EVY.js} +1 -1
- package/dist/{chunk-N7ZRF5K3.js → chunk-G2ZMNVYN.js} +1 -1
- package/dist/{chunk-J7NRD4Q7.js → chunk-GCMJDOAE.js} +1 -1
- package/dist/{chunk-WBHSPN55.js → chunk-GGD7NKPL.js} +2 -2
- package/dist/{chunk-WOA7VCGA.js → chunk-H6S7L2I2.js} +1 -1
- package/dist/{chunk-RBHQXWR7.js → chunk-HBMNUT6E.js} +1 -1
- package/dist/{chunk-ZWHPIR2Z.js → chunk-HYCOX7AB.js} +2 -2
- package/dist/{chunk-RQLU4NDG.js → chunk-ICUTARPB.js} +1 -1
- package/dist/{chunk-YHVG7V3E.js → chunk-IJTSA34Q.js} +1 -1
- package/dist/chunk-IQDZ6YMY.js +18 -0
- package/dist/{chunk-ZA4M4O7E.js → chunk-IYOPWIG4.js} +2 -2
- package/dist/{chunk-7L25ZNNP.js → chunk-IZ5CTC6M.js} +1 -1
- package/dist/{chunk-GKZ2KVE6.js → chunk-J2LWXO55.js} +1 -1
- package/dist/{chunk-BAKJPQGU.js → chunk-KPL2XHYF.js} +1 -1
- package/dist/{chunk-WR42Q3HU.js → chunk-KYZKPNPQ.js} +1 -1
- package/dist/chunk-L45HDSJ7.js +15 -0
- package/dist/{chunk-4BBDKWM3.js → chunk-MD3S2RXN.js} +1 -1
- package/dist/{chunk-JH6E632O.js → chunk-MU3I453X.js} +1 -1
- package/dist/{chunk-C74ABM24.js → chunk-MZYPDLD3.js} +1 -1
- package/dist/{chunk-GESG672R.js → chunk-NADKZKGS.js} +1 -1
- package/dist/{chunk-2RMHDOP4.js → chunk-NMBFAIXZ.js} +1 -1
- package/dist/chunk-NN6UG2BE.js +11 -0
- package/dist/chunk-NPKB7EK3.js +7 -0
- package/dist/{chunk-MNE5VMHT.js → chunk-O3ZKP4DY.js} +1 -1
- package/dist/{chunk-KOL6ZWOQ.js → chunk-OUWOLCCS.js} +1 -1
- package/dist/{chunk-GPIXV7AV.js → chunk-OYY566GN.js} +1 -1
- package/dist/{chunk-3SPOJWRA.js → chunk-PDTFQGQF.js} +1 -1
- package/dist/{chunk-Q7XBMBMR.js → chunk-Q7LZ5QJV.js} +1 -1
- package/dist/{chunk-X5276I5H.js → chunk-QMZLIHBS.js} +2 -2
- package/dist/chunk-QXUPBIV3.js +93 -0
- package/dist/{chunk-SQDQADWD.js → chunk-RCYYE6ED.js} +1 -1
- package/dist/{chunk-6F6YI3ZG.js → chunk-SF5QPR6T.js} +1 -1
- package/dist/{chunk-22QIVSQR.js → chunk-SWTJMTBY.js} +1 -1
- package/dist/{chunk-O6U2HU5M.js → chunk-TBYYPGHF.js} +1 -1
- package/dist/{chunk-SGHP44WS.js → chunk-TGBXIV7O.js} +1 -1
- package/dist/{chunk-P3JUE2RM.js → chunk-TWZ6NZWE.js} +4 -4
- package/dist/{chunk-L6MOO4WT.js → chunk-U466V5JN.js} +1 -1
- package/dist/{chunk-OO5GMBVI.js → chunk-U7BVK5IX.js} +1 -1
- package/dist/{chunk-IQ7NGOAT.js → chunk-UAFCBZ3P.js} +1 -1
- package/dist/{chunk-JKX57HA7.js → chunk-UEG4LJD6.js} +1 -1
- package/dist/{chunk-NBMLBCJ3.js → chunk-ULGFPKC7.js} +1 -1
- package/dist/{chunk-KOPP4CJW.js → chunk-V4JR5JCK.js} +1 -1
- package/dist/{chunk-ZKEOPIQ3.js → chunk-VATOIZYG.js} +1 -1
- package/dist/{chunk-WILT62DP.js → chunk-VOTIGXQ4.js} +1 -1
- package/dist/chunk-VWOAEF7J.js +2 -0
- package/dist/{chunk-VNFCX2SH.js → chunk-W4Y3PG7F.js} +1 -1
- package/dist/{chunk-RH6KFHJB.js → chunk-WECVT7WE.js} +1 -1
- package/dist/{chunk-QPUVOVD7.js → chunk-WML5KSGQ.js} +1 -1
- package/dist/{chunk-PGU64EWQ.js → chunk-WPNNRMTP.js} +1 -1
- package/dist/{chunk-IQ7GPETF.js → chunk-XGL3RSI5.js} +1 -1
- package/dist/{chunk-JJJSDDQ2.js → chunk-Z2GDSCPS.js} +1 -1
- package/dist/chunk-Z4KRSLAM.js +2 -0
- package/dist/{chunk-EMSLJTYN.js → chunk-Z5DGFN7R.js} +1 -1
- package/dist/{chunk-NDCRJXYF.js → chunk-ZLIYWELJ.js} +1 -1
- package/dist/{chunk-K7K23DIQ.js → chunk-ZYEFWJNZ.js} +1 -1
- package/dist/{config-3AKWRTFS.js → config-WETHR632.js} +1 -1
- package/dist/{cover-cmd-ZLAWMEC2.js → cover-cmd-J3CTQT3R.js} +1 -1
- package/dist/{credentials-Q4WH5CBN.js → credentials-RQPAP5KY.js} +1 -1
- package/dist/{deps-bundle-RVZK6LZJ.js → deps-bundle-F47ZDYIM.js} +1 -1
- package/dist/{deps-resolve-6F2U4TJP.js → deps-resolve-URKD4QCB.js} +1 -1
- package/dist/{dispatch-46BETGXY.js → dispatch-KOZAJQDW.js} +1 -1
- package/dist/{doctor-WRPG56HH.js → doctor-J44UKALC.js} +1 -1
- package/dist/{evidence-XWR32HWP.js → evidence-KRNDKDCT.js} +1 -1
- package/dist/{evolve-cmd-27ZQN6YB.js → evolve-cmd-CEYGGIWA.js} +1 -1
- package/dist/{explain-cmd-JCJTXVZY.js → explain-cmd-USGRZFBY.js} +1 -1
- package/dist/{extract-bind-D5BYYGYA.js → extract-bind-X4QRQX53.js} +2 -2
- package/dist/{extract-cmd-CCYW7FIY.js → extract-cmd-RKEE32FN.js} +1 -1
- package/dist/{gaps-cmd-3VJKQ25D.js → gaps-cmd-WL6P6YKS.js} +1 -1
- package/dist/{generate-headless-2M6UT3IK.js → generate-headless-LSQHOR3G.js} +2 -2
- package/dist/index.js +147 -149
- package/dist/{ingest-cmd-HVTUK264.js → ingest-cmd-TQ4ARSDE.js} +1 -1
- package/dist/install-47CRHVU6.js +2 -0
- package/dist/{interactive-bind-OJCYNQPI.js → interactive-bind-FPC4RYEW.js} +3 -3
- package/dist/{lifecycle-cmd-GWFGUGTC.js → lifecycle-cmd-DB5EFO2O.js} +1 -1
- package/dist/{list-cmd-AXDW64OY.js → list-cmd-UWGJRGKF.js} +1 -1
- package/dist/{list-commands-YNZ6EFIF.js → list-commands-Q77CAQJ2.js} +1 -1
- package/dist/login-flow-RSNR5HY2.js +2 -0
- package/dist/{maintenance-cmd-QEMK6YNV.js → maintenance-cmd-EJ2RAMWB.js} +1 -1
- package/dist/{mobile-prompts-OXHA5GHJ.js → mobile-prompts-PPPPKRS2.js} +1 -1
- package/dist/objective-variable-gate-BCKULIFQ.js +2 -0
- package/dist/{open-provider-E5VUGFNE.js → open-provider-XIGABCD3.js} +1 -1
- package/dist/{persist-recorded-session-KWPH37HI.js → persist-recorded-session-MK4HCDOY.js} +1 -1
- package/dist/pipeline-XDWHEZ5S.js +2 -0
- package/dist/prepare-target-NR3MTLLI.js +2 -0
- package/dist/{reconcile-cmd-V7TDYETT.js → reconcile-cmd-VJPEY7YD.js} +1 -1
- package/dist/{reconcile-deps-X6IGH4CA.js → reconcile-deps-T5YX6HRG.js} +2 -2
- package/dist/{reconcile-engine-OGXSIE7O.js → reconcile-engine-GELPXSLV.js} +1 -1
- package/dist/{recording-banner-IZWN2XFY.js → recording-banner-3ET3PMSV.js} +1 -1
- package/dist/registry-3XMA4FOC.js +2 -0
- package/dist/{require-project-folder-PEEUITK6.js → require-project-folder-ZLKONKKP.js} +1 -1
- package/dist/{resolve-run-intent-JGXXE45Y.js → resolve-run-intent-3SXUS676.js} +1 -1
- package/dist/{resolver-TY7XLJBN.js → resolver-G7NGWACO.js} +1 -1
- package/dist/{review-cmd-74YTPT7E.js → review-cmd-6DNGXV5E.js} +1 -1
- package/dist/{run-DN4XARP2.js → run-MUVZVTTC.js} +1 -1
- package/dist/{run-GRYWYKIH.js → run-UJLRTKTO.js} +1 -1
- package/dist/{run-test-md-DFCKCQ4T.js → run-test-md-RI5RXVFU.js} +2 -2
- package/dist/{skill-installer-GRU3HOYF.js → skill-installer-CAO2NJZP.js} +1 -1
- package/dist/{spawner-LNMD4NJF.js → spawner-H6IDWY5U.js} +1 -1
- package/dist/{store-guard-Q4MYZQHF.js → store-guard-PIA2DYZX.js} +1 -1
- package/dist/{sync-cmd-H6Y5EB3L.js → sync-cmd-VFVTFIIJ.js} +1 -1
- package/dist/{sync-setup-THGRBKTA.js → sync-setup-R7BZDE24.js} +1 -1
- package/dist/tcg-generate-QADJKNYZ.js +2 -0
- package/dist/testmd-actions-EXSVQRHQ.js +2 -0
- package/dist/testmd-sync-2CXNIPJ7.js +2 -0
- package/dist/token-refresh-5TVNSL4U.js +2 -0
- package/dist/{validate-basic-RCBEELSB.js → validate-basic-MN5NDCT2.js} +1 -1
- package/dist/{variable-receipt-JHRW73Z6.js → variable-receipt-SIABUC74.js} +1 -1
- package/dist/{verdicts-XFXDRND4.js → verdicts-ZXXBKTOZ.js} +1 -1
- package/dist/{version-check-Z774UWW3.js → version-check-TDGK5REB.js} +1 -1
- package/dist/{view-cmd-I4LQGJ2X.js → view-cmd-RLO7AP4X.js} +1 -1
- package/dist/{walk-session-FP52IGLB.js → walk-session-ATWNUGHX.js} +1 -1
- package/dist/{with-telemetry-P6RUPWBH.js → with-telemetry-CLSDKQAG.js} +1 -1
- package/package.json +11 -11
- package/dist/EvidenceViewOffer-5MB4ZXKM.js +0 -2
- package/dist/FolderPicker-SYFXH6D5.js +0 -2
- package/dist/SingleShotApp-U54ETXS3.js +0 -2
- package/dist/TestMdRunView-WA4TC5PT.js +0 -2
- package/dist/bridge-X5DEJL6F.js +0 -2
- package/dist/chunk-53MPG2J3.js +0 -11
- package/dist/chunk-IICQ5KRD.js +0 -5
- package/dist/chunk-KN65CUNT.js +0 -15
- package/dist/chunk-L4M7753M.js +0 -2
- package/dist/chunk-LBNADEQN.js +0 -8
- package/dist/chunk-LNV7C2YO.js +0 -6
- package/dist/chunk-M7DN6FO3.js +0 -17
- package/dist/chunk-ZZTZJPT2.js +0 -88
- package/dist/install-5WJLE7XT.js +0 -2
- package/dist/login-flow-PRXFPRYZ.js +0 -2
- package/dist/objective-variable-gate-76GYUHEP.js +0 -2
- package/dist/pipeline-A2OGF4XW.js +0 -2
- package/dist/prepare-target-P6BWJZBZ.js +0 -2
- package/dist/registry-GOLIFVK5.js +0 -2
- package/dist/tcg-generate-SZZ7MJXY.js +0 -2
- package/dist/testmd-actions-MRIUOOXO.js +0 -2
- package/dist/testmd-sync-UYVJ47BN.js +0 -2
- package/dist/token-refresh-KN5JK2U4.js +0 -2
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as R,b as Y,g as _,o as N}from"./chunk-ZKEOPIQ3.js";import"./chunk-OPL2MIQG.js";import"./chunk-TU6IMGWO.js";import"./chunk-TNBF5OMZ.js";import"./chunk-HOA4VWSD.js";import"./chunk-YYYQ5MVD.js";import"./chunk-KZG4E5RM.js";import"./chunk-BZAGVBCX.js";import"./chunk-52WM3XYO.js";import"./chunk-BB2W35TW.js";import"./chunk-427OQS2N.js";import"./chunk-AHXOKBVE.js";import"./chunk-ALCE5RLK.js";import"./chunk-Q2F5QB2W.js";import{a as T,b as O,c as U,d as j}from"./chunk-YHVG7V3E.js";import{N as E,O as H,S as L,c as P,e as I}from"./chunk-6LGED4FC.js";import"./chunk-C74ABM24.js";import{c as G,h as A}from"./chunk-H6TNBKGR.js";import"./chunk-66MOZKD2.js";import"./chunk-YLQHY4A7.js";import"./chunk-WILT62DP.js";import"./chunk-22QIVSQR.js";import"./chunk-IE3OO5GI.js";import{a as f}from"./chunk-CH273NAE.js";import"./chunk-LBNADEQN.js";import"./chunk-VZ7KXRXB.js";import"./chunk-5LJRZI7S.js";import"./chunk-BKM2LWU2.js";import"./chunk-GP7WD4UY.js";import"./chunk-JQW2QFSX.js";import"./chunk-3N6IAVD5.js";import"./chunk-FQNQVC5O.js";import"./chunk-AKX4VRRR.js";import"./chunk-UD7KKHPW.js";import"./chunk-YCCUBQY4.js";import"./chunk-RSSOJ3L2.js";import"./chunk-5EOX4MEY.js";import"./chunk-RZ4F3BHX.js";import"./chunk-EYOCNMUM.js";import"./chunk-B2ZGG7WM.js";import"./chunk-DFS4RMVP.js";import"./chunk-HCBYKLMW.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";import{existsSync as y}from"fs";import{resolve as $}from"path";import{spawn as D}from"child_process";var w=class extends Error{},m=e=>{if(e===null)throw new w;return e},u=(e,t,o)=>({value:e,label:t,detail:o});async function p(e,t,o,n=!1){for(;;){let h=m(await e.input(t,o,n)).trim();if(h)return h;e.out("Enter a value, or press Esc to leave setup.")}}async function S(e,t){e.out(`Open in your browser: ${t}`);try{await e.open(t)}catch{e.out("The browser could not open automatically. Open that address yourself, then continue here.")}}async function b(e,t){let o=await e.gitRead(t);return o.ok||e.out(j(o.diagnostic,t)),o.ok}var x=u("change","Use a different address"),C=u("storage","Choose a different storage");async function z(e,t){for(;;)try{await e.checkGit();break}catch(n){e.out(n instanceof Error?n.message:"Git 2.31 or newer is required."),m(await e.choose("Install Git, then return here",[u("open","Open Git installation instructions"),u("retry","Check again")]))==="open"&&await S(e,"https://git-scm.com/downloads")}if(await b(e,t.gitUrl))return"ok";if(!/^https:\/\/github\.com\//i.test(t.gitUrl))for(e.out("Set up Git access for this repository with your server's SSH key or credential helper. kane-cli uses the same access as Git.");;){let n=m(await e.choose("Git cannot read this repository yet.",[u("retry","Check again"),x,C]));if(n==="change"||n==="storage")return n;if(await b(e,t.gitUrl))return"ok"}for(e.out("Sign in below if you have not, or ask the owner to grant your GitHub account access.");;){let n=m(await e.choose("Sign in to access this GitHub repository",[u("login","Sign in with your browser","Use or create your GitHub account."),u("retry","I've fixed my access \u2014 check again","Ask the owner to grant your account access, or check your existing Git login."),x,C]));if(n==="change"||n==="storage")return n;if(n==="login"){if((await e.gh(["--version"])).code){e.out("Browser sign-in uses GitHub CLI, a small GitHub tool. Install it once, then return to this step. GitHub CLI is optional if you already use SSH or another Git credential helper."),m(await e.choose("GitHub CLI is not installed",[u("open","Open installation instructions"),u("retry","Check again")]))==="open"&&await S(e,"https://cli.github.com/");continue}if((await e.gh(["auth","login","--hostname","github.com","--git-protocol","https","--web"],!0)).code){e.out("Sign-in did not finish. Your repository address is still saved in this setup.");continue}for(;(await e.gh(["auth","setup-git","--hostname","github.com"])).code&&(e.out("GitHub sign-in finished, but Git could not be told to use it."),m(await e.choose("Configure Git to use your GitHub sign-in",[u("retry","Try the configuration again"),u("skip","Skip; I use SSH or another credential helper")]))!=="skip"););}if(await b(e,t.gitUrl))return"ok";e.out("A browser login alone does not grant repository permission: ask the owner to grant your GitHub account access.")}}async function k(e){if(m(await e.choose("Access to the bucket",[u("existing","Use credentials already configured on this computer","Existing kane-cli credentials or KANE_SYNC_S3_ACCESS_KEY_ID and KANE_SYNC_S3_SECRET_ACCESS_KEY."),u("keys","Enter the access keys from my storage administrator","Saved in your local kane-cli configuration, never in the shared context.")]))!=="existing")return e.out("These are bucket access keys, not your cloud account password. Your administrator must grant access to the bucket and folder you selected."),{accessKeyId:await p(e,"Access key ID"),secretAccessKey:await p(e,"Secret access key (hidden)",void 0,!0)}}async function W(e,t){let o=t?.kind??m(await e.choose("Where should your team's shared context live?",[u("github","GitHub \u2014 Recommended","Guided setup for a repository: a storage space on GitHub."),u("s3","S3-compatible storage","Use your team's existing cloud bucket and access keys."),u("folder","Folder","A local folder stays on this computer. A mounted shared drive can serve your team.")]));if(o==="github"){t||(e.out("GitHub will hold the requirements, documents and test information you publish from kane-cli. Each teammate signs in with their own account."),m(await e.choose("Choose a GitHub repository",[u("existing","Use an existing repository"),u("create","Create a repository on GitHub","Use a dedicated repository. Choose Private to limit who can see your context.")]))==="create"&&(await S(e,"https://github.com/new"),e.out("On GitHub: choose the owner and repository name, choose Private, and create the repository. Return here and paste its HTTPS address. No code or Git knowledge is needed.")));let d=await p(e,"Repository address (for example https://github.com/my-team/team-context.git)",t?.address);return{location:d,journey:{kind:o,address:d}}}if(o==="folder"){t||e.out("Everyone needs access to the same mounted drive to share through a folder. Sending a local path does not share its contents. Dropbox, iCloud, OneDrive and Google Drive sync folders are not supported.");let d=await p(e,"Folder path",t?.address);return{location:d,journey:{kind:o,address:d}}}t||e.out("Ask your storage administrator for an existing bucket and access keys. kane-cli does not create buckets or cloud permissions.");let n=t?.s3,h=await p(e,"Bucket name",n?.bucket);for(;!/^[a-zA-Z0-9.-]+$/.test(h);)e.out("Use the bucket's name, not a URL."),h=await p(e,"Bucket name");let c=await p(e,"Region",n?.region??"us-east-1"),s=m(await e.input("Folder inside the bucket (optional)",n?.prefix??"")),i=[u("aws","Amazon S3"),u("compatible","Another S3-compatible service")];n&&i.sort((d,g)=>+(g.value===n.service)-+(d.value===n.service));let l=m(await e.choose("Which storage service?",i)),r=new URLSearchParams({region:c}),a=l==="compatible"?await p(e,"Service endpoint (https://host, with an optional port)",n?.service===l?n.endpoint:void 0):void 0;return a&&r.set("endpoint",a),{location:`s3://${h}/${s.split("/").map(encodeURIComponent).join("/")}?${r}`,journey:{kind:"s3",s3:{bucket:h,region:c,prefix:s,service:l,endpoint:a}}}}function K(e){return e.kind==="dir"?"A location address contains no password: everyone who can open this folder can read it; sending the path does not send its contents.":e.kind==="s3"?"A location address contains no keys and does not grant access: grant teammates access to the bucket in your storage's console.":U(e.gitUrl??"")==="github.com"?"A location address contains no password and does not grant access. Invite teammates on GitHub.":"A location address contains no password and does not grant access: grant teammates access on your Git server."}async function J(e,t){try{e.out("Share your context: the requirements, documents and test information you add to kane-cli. A location is where your team's shared copy lives.");let o=m(await e.choose("What do you want to do?",[u("share","Share my context with my team"),u("join","Join my team's context")]));if(o==="share"&&!y(f(t)))return e.out("There is no context here to share yet. Add your documents with kane-cli context ingest <files>, then run kane-cli context sync setup again."),2;let n,h=async()=>{for(;;){let r;for(;;){let a;if(o==="join")a=await p(e,"Paste the location your teammate shared",n?.address),n={kind:"join",address:a};else{let d=await W(e,n);a=d.location,n=d.journey}try{r=E(a,t);break}catch(d){e.out(d instanceof Error?d.message:"That location could not be read.")}}if(r.kind==="fake")throw new Error("This location is only available to tests.");if(r.kind==="git"){let a=await z(e,r);if(a==="storage"&&(n=void 0),a!=="ok")continue;if(/^https:\/\/github\.com\//i.test(r.gitUrl)){let d=await e.gh(["repo","view",r.gitUrl,"--json","nameWithOwner,visibility"]),g;try{let v=JSON.parse(d.text);["PUBLIC","PRIVATE","INTERNAL"].includes(v.visibility)&&(g=v.visibility)}catch{}e.out(g?`Repository visibility: ${g.toLowerCase()}.`:"Repository visibility could not be checked automatically. Check Public/Private on GitHub before publishing.")}}return r}},c=await h(),s=c.kind==="s3"?await k(e):void 0,i="origin",l;if(o==="join")for(;l=$(t,await p(e,"Download into a new folder","team-context")),!!y(l);)e.out("That folder already exists. Choose a new folder so your current context and files stay untouched.");else{let r=P(f(t)).locations;for(;r.some(a=>a.name===i)||!/^[A-Za-z0-9][A-Za-z0-9._-]*$/.test(i);)i=await p(e,"Choose a new name for this connection","team")}for(e.out(`Location: ${c.gitUrl??c.path??c.location}`),e.out(c.kind==="git"?"Connection checks add small permanent files, commits and a scratch reference to this repository. Your own context is uploaded only by a separate publish command.":"Connection checks add small permanent files to this location. Your own context is uploaded only by a separate publish command."),m(await e.choose(o==="join"?"Connect and download team context?":"Connect this location? Your context will not be uploaded.",[u("connect",o==="join"?"Connect and download":"Connect location")]));e.out(o==="join"?"Checking access and downloading verified team context\u2026":"Checking read access and safe publishing\u2026"),(o==="join"?await e.clone(c.location,l,s):await e.add(i,c.location,s))!==0;){if(o==="join"&&y(l)){e.out(`The destination ${l} now exists after the interrupted attempt. Keep it; choose a new folder for a fresh download.`);do l=$(t,await p(e,"New download folder"));while(y(l))}let a=[u("retry","Retry this connection"),...c.kind==="s3"?[u("keys","Enter different keys")]:[],x,...o==="share"?[C]:[]],d=m(await e.choose("The connection did not finish. Your choices are kept; fix the reported issue and retry.",a));d==="keys"&&(s=await k(e)),(d==="change"||d==="storage")&&(d==="storage"&&(n=void 0),c=await h(),s=c.kind==="s3"?await k(e):void 0)}if(o==="join")e.out(`Team context downloaded into ${l}. Your previous local files were not replaced.`),e.out("Next: open that folder and run kane-cli context sync status.");else{let r=e.access(i);e.out(`Connected to ${c.gitUrl??c.path??c.location}. ${r==="write"?"You can download and publish changes.":"You can download context, but cannot publish changes."}`),e.out("Your context has not been uploaded yet."),e.out(r==="write"?`When ready, publish with kane-cli context push ${i}. This shares your context records and their referenced source documents with everyone who can read the location.`:"Ask the location owner for write access before publishing, then check the connection again."),e.out(`Share this location with teammates: ${H(c)}`),e.out(K(c))}return 0}catch(o){return o instanceof w?(e.out("Setup left. Your context has not been published. Any completed connection checks remain in the location."),3):(e.out(o instanceof Error?o.message:"Setup could not finish."),2)}}async function q(e,t=!1){return new Promise(o=>{let n=D("gh",e,{stdio:t?"inherit":["ignore","pipe","pipe"],windowsHide:!0}),h="";n.stdout?.on("data",s=>{h.length<64e3&&(h+=String(s))}),n.stderr?.on("data",()=>{});let c=setTimeout(()=>n.kill("SIGKILL"),t?3e5:2e4);n.on("error",()=>{clearTimeout(c),o({code:1,text:"GitHub CLI is unavailable"})}),n.on("close",s=>{clearTimeout(c),o({code:s??1,text:h})})})}async function ie(e,t=L(),o=process.cwd()){if(e.mode&&e.mode!=="interactive"||!G())return Y(R(e,t),t,new A("TTY_REQUIRED","guided setup needs an interactive terminal; for automation use kane-cli context sync add <name> <location> or kane-cli context clone <location> <new-folder>","run kane-cli context sync setup in a terminal"),2);let{promptSetup:n}=await import("./sync-setup-ui-RC727VK6.js"),h=(s,i)=>i(s?{credentials:s}:{}),c=async s=>{let i=[],l=await s({...t,out:r=>i.push(r),err:r=>i.push(r)});if(l!==0)for(let r of i){if(r.startsWith("next: ")||r.startsWith("checking "))continue;let a=r.startsWith("error: ")?r.slice(7):r,d=/^([a-z][a-z0-9+.-]*:\/\/|[a-z0-9._-]+@[a-z0-9.-]+[:/]|[\/~.])/i.test(a);t.out(/^[a-z]/.test(a)&&!d?a.charAt(0).toUpperCase()+a.slice(1)+(/[.!?]$/.test(a)?"":"."):a)}return l};return J({out:t.out,choose:(s,i)=>n({title:s,choices:i}),input:(s,i,l)=>n({title:s,initial:i,secret:l}),open:async s=>{let{default:i}=await import("./open-MQLQKFAW.js");await i(s)},checkGit:()=>O(),gitRead:async s=>{try{let i=await T(["ls-remote",s],{timeout:2e4});return{ok:i.code===0,diagnostic:i.stderr}}catch(i){return{ok:!1,diagnostic:i instanceof Error?i.message:String(i)}}},gh:q,add:(s,i,l)=>h(l,r=>c(a=>_(s,i,r,a,o))),clone:(s,i,l)=>h(l,r=>c(a=>N(s,i,r,a,o))),access:s=>I(f(o)).entries[s]?.tier===1?"write":"read"},o)}export{J as runSetup,ie as setupCommand};
|
|
2
|
+
import{a as R,b as Y,g as _,o as N}from"./chunk-VATOIZYG.js";import"./chunk-OPL2MIQG.js";import"./chunk-TU6IMGWO.js";import"./chunk-TNBF5OMZ.js";import"./chunk-HOA4VWSD.js";import"./chunk-YYYQ5MVD.js";import"./chunk-KZG4E5RM.js";import"./chunk-BZAGVBCX.js";import"./chunk-52WM3XYO.js";import"./chunk-BB2W35TW.js";import"./chunk-427OQS2N.js";import"./chunk-AHXOKBVE.js";import"./chunk-ALCE5RLK.js";import"./chunk-Q2F5QB2W.js";import{a as T,b as O,c as U,d as j}from"./chunk-IJTSA34Q.js";import{N as E,O as H,S as L,c as P,e as I}from"./chunk-E44OHYDS.js";import"./chunk-MZYPDLD3.js";import{c as G,h as A}from"./chunk-H6TNBKGR.js";import"./chunk-66MOZKD2.js";import"./chunk-YLQHY4A7.js";import"./chunk-VOTIGXQ4.js";import"./chunk-SWTJMTBY.js";import"./chunk-IE3OO5GI.js";import{a as f}from"./chunk-CH273NAE.js";import"./chunk-CAOZKSQ3.js";import"./chunk-VZ7KXRXB.js";import"./chunk-5LJRZI7S.js";import"./chunk-BKM2LWU2.js";import"./chunk-GP7WD4UY.js";import"./chunk-JQW2QFSX.js";import"./chunk-3N6IAVD5.js";import"./chunk-FQNQVC5O.js";import"./chunk-AKX4VRRR.js";import"./chunk-UD7KKHPW.js";import"./chunk-YCCUBQY4.js";import"./chunk-RSSOJ3L2.js";import"./chunk-5EOX4MEY.js";import"./chunk-RZ4F3BHX.js";import"./chunk-EYOCNMUM.js";import"./chunk-F2XTOZTN.js";import"./chunk-DFS4RMVP.js";import"./chunk-HCBYKLMW.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";import{existsSync as y}from"fs";import{resolve as $}from"path";import{spawn as D}from"child_process";var w=class extends Error{},m=e=>{if(e===null)throw new w;return e},u=(e,t,o)=>({value:e,label:t,detail:o});async function p(e,t,o,n=!1){for(;;){let h=m(await e.input(t,o,n)).trim();if(h)return h;e.out("Enter a value, or press Esc to leave setup.")}}async function S(e,t){e.out(`Open in your browser: ${t}`);try{await e.open(t)}catch{e.out("The browser could not open automatically. Open that address yourself, then continue here.")}}async function b(e,t){let o=await e.gitRead(t);return o.ok||e.out(j(o.diagnostic,t)),o.ok}var x=u("change","Use a different address"),C=u("storage","Choose a different storage");async function z(e,t){for(;;)try{await e.checkGit();break}catch(n){e.out(n instanceof Error?n.message:"Git 2.31 or newer is required."),m(await e.choose("Install Git, then return here",[u("open","Open Git installation instructions"),u("retry","Check again")]))==="open"&&await S(e,"https://git-scm.com/downloads")}if(await b(e,t.gitUrl))return"ok";if(!/^https:\/\/github\.com\//i.test(t.gitUrl))for(e.out("Set up Git access for this repository with your server's SSH key or credential helper. kane-cli uses the same access as Git.");;){let n=m(await e.choose("Git cannot read this repository yet.",[u("retry","Check again"),x,C]));if(n==="change"||n==="storage")return n;if(await b(e,t.gitUrl))return"ok"}for(e.out("Sign in below if you have not, or ask the owner to grant your GitHub account access.");;){let n=m(await e.choose("Sign in to access this GitHub repository",[u("login","Sign in with your browser","Use or create your GitHub account."),u("retry","I've fixed my access \u2014 check again","Ask the owner to grant your account access, or check your existing Git login."),x,C]));if(n==="change"||n==="storage")return n;if(n==="login"){if((await e.gh(["--version"])).code){e.out("Browser sign-in uses GitHub CLI, a small GitHub tool. Install it once, then return to this step. GitHub CLI is optional if you already use SSH or another Git credential helper."),m(await e.choose("GitHub CLI is not installed",[u("open","Open installation instructions"),u("retry","Check again")]))==="open"&&await S(e,"https://cli.github.com/");continue}if((await e.gh(["auth","login","--hostname","github.com","--git-protocol","https","--web"],!0)).code){e.out("Sign-in did not finish. Your repository address is still saved in this setup.");continue}for(;(await e.gh(["auth","setup-git","--hostname","github.com"])).code&&(e.out("GitHub sign-in finished, but Git could not be told to use it."),m(await e.choose("Configure Git to use your GitHub sign-in",[u("retry","Try the configuration again"),u("skip","Skip; I use SSH or another credential helper")]))!=="skip"););}if(await b(e,t.gitUrl))return"ok";e.out("A browser login alone does not grant repository permission: ask the owner to grant your GitHub account access.")}}async function k(e){if(m(await e.choose("Access to the bucket",[u("existing","Use credentials already configured on this computer","Existing kane-cli credentials or KANE_SYNC_S3_ACCESS_KEY_ID and KANE_SYNC_S3_SECRET_ACCESS_KEY."),u("keys","Enter the access keys from my storage administrator","Saved in your local kane-cli configuration, never in the shared context.")]))!=="existing")return e.out("These are bucket access keys, not your cloud account password. Your administrator must grant access to the bucket and folder you selected."),{accessKeyId:await p(e,"Access key ID"),secretAccessKey:await p(e,"Secret access key (hidden)",void 0,!0)}}async function W(e,t){let o=t?.kind??m(await e.choose("Where should your team's shared context live?",[u("github","GitHub \u2014 Recommended","Guided setup for a repository: a storage space on GitHub."),u("s3","S3-compatible storage","Use your team's existing cloud bucket and access keys."),u("folder","Folder","A local folder stays on this computer. A mounted shared drive can serve your team.")]));if(o==="github"){t||(e.out("GitHub will hold the requirements, documents and test information you publish from kane-cli. Each teammate signs in with their own account."),m(await e.choose("Choose a GitHub repository",[u("existing","Use an existing repository"),u("create","Create a repository on GitHub","Use a dedicated repository. Choose Private to limit who can see your context.")]))==="create"&&(await S(e,"https://github.com/new"),e.out("On GitHub: choose the owner and repository name, choose Private, and create the repository. Return here and paste its HTTPS address. No code or Git knowledge is needed.")));let d=await p(e,"Repository address (for example https://github.com/my-team/team-context.git)",t?.address);return{location:d,journey:{kind:o,address:d}}}if(o==="folder"){t||e.out("Everyone needs access to the same mounted drive to share through a folder. Sending a local path does not share its contents. Dropbox, iCloud, OneDrive and Google Drive sync folders are not supported.");let d=await p(e,"Folder path",t?.address);return{location:d,journey:{kind:o,address:d}}}t||e.out("Ask your storage administrator for an existing bucket and access keys. kane-cli does not create buckets or cloud permissions.");let n=t?.s3,h=await p(e,"Bucket name",n?.bucket);for(;!/^[a-zA-Z0-9.-]+$/.test(h);)e.out("Use the bucket's name, not a URL."),h=await p(e,"Bucket name");let c=await p(e,"Region",n?.region??"us-east-1"),s=m(await e.input("Folder inside the bucket (optional)",n?.prefix??"")),i=[u("aws","Amazon S3"),u("compatible","Another S3-compatible service")];n&&i.sort((d,g)=>+(g.value===n.service)-+(d.value===n.service));let l=m(await e.choose("Which storage service?",i)),r=new URLSearchParams({region:c}),a=l==="compatible"?await p(e,"Service endpoint (https://host, with an optional port)",n?.service===l?n.endpoint:void 0):void 0;return a&&r.set("endpoint",a),{location:`s3://${h}/${s.split("/").map(encodeURIComponent).join("/")}?${r}`,journey:{kind:"s3",s3:{bucket:h,region:c,prefix:s,service:l,endpoint:a}}}}function K(e){return e.kind==="dir"?"A location address contains no password: everyone who can open this folder can read it; sending the path does not send its contents.":e.kind==="s3"?"A location address contains no keys and does not grant access: grant teammates access to the bucket in your storage's console.":U(e.gitUrl??"")==="github.com"?"A location address contains no password and does not grant access. Invite teammates on GitHub.":"A location address contains no password and does not grant access: grant teammates access on your Git server."}async function J(e,t){try{e.out("Share your context: the requirements, documents and test information you add to kane-cli. A location is where your team's shared copy lives.");let o=m(await e.choose("What do you want to do?",[u("share","Share my context with my team"),u("join","Join my team's context")]));if(o==="share"&&!y(f(t)))return e.out("There is no context here to share yet. Add your documents with kane-cli context ingest <files>, then run kane-cli context sync setup again."),2;let n,h=async()=>{for(;;){let r;for(;;){let a;if(o==="join")a=await p(e,"Paste the location your teammate shared",n?.address),n={kind:"join",address:a};else{let d=await W(e,n);a=d.location,n=d.journey}try{r=E(a,t);break}catch(d){e.out(d instanceof Error?d.message:"That location could not be read.")}}if(r.kind==="fake")throw new Error("This location is only available to tests.");if(r.kind==="git"){let a=await z(e,r);if(a==="storage"&&(n=void 0),a!=="ok")continue;if(/^https:\/\/github\.com\//i.test(r.gitUrl)){let d=await e.gh(["repo","view",r.gitUrl,"--json","nameWithOwner,visibility"]),g;try{let v=JSON.parse(d.text);["PUBLIC","PRIVATE","INTERNAL"].includes(v.visibility)&&(g=v.visibility)}catch{}e.out(g?`Repository visibility: ${g.toLowerCase()}.`:"Repository visibility could not be checked automatically. Check Public/Private on GitHub before publishing.")}}return r}},c=await h(),s=c.kind==="s3"?await k(e):void 0,i="origin",l;if(o==="join")for(;l=$(t,await p(e,"Download into a new folder","team-context")),!!y(l);)e.out("That folder already exists. Choose a new folder so your current context and files stay untouched.");else{let r=P(f(t)).locations;for(;r.some(a=>a.name===i)||!/^[A-Za-z0-9][A-Za-z0-9._-]*$/.test(i);)i=await p(e,"Choose a new name for this connection","team")}for(e.out(`Location: ${c.gitUrl??c.path??c.location}`),e.out(c.kind==="git"?"Connection checks add small permanent files, commits and a scratch reference to this repository. Your own context is uploaded only by a separate publish command.":"Connection checks add small permanent files to this location. Your own context is uploaded only by a separate publish command."),m(await e.choose(o==="join"?"Connect and download team context?":"Connect this location? Your context will not be uploaded.",[u("connect",o==="join"?"Connect and download":"Connect location")]));e.out(o==="join"?"Checking access and downloading verified team context\u2026":"Checking read access and safe publishing\u2026"),(o==="join"?await e.clone(c.location,l,s):await e.add(i,c.location,s))!==0;){if(o==="join"&&y(l)){e.out(`The destination ${l} now exists after the interrupted attempt. Keep it; choose a new folder for a fresh download.`);do l=$(t,await p(e,"New download folder"));while(y(l))}let a=[u("retry","Retry this connection"),...c.kind==="s3"?[u("keys","Enter different keys")]:[],x,...o==="share"?[C]:[]],d=m(await e.choose("The connection did not finish. Your choices are kept; fix the reported issue and retry.",a));d==="keys"&&(s=await k(e)),(d==="change"||d==="storage")&&(d==="storage"&&(n=void 0),c=await h(),s=c.kind==="s3"?await k(e):void 0)}if(o==="join")e.out(`Team context downloaded into ${l}. Your previous local files were not replaced.`),e.out("Next: open that folder and run kane-cli context sync status.");else{let r=e.access(i);e.out(`Connected to ${c.gitUrl??c.path??c.location}. ${r==="write"?"You can download and publish changes.":"You can download context, but cannot publish changes."}`),e.out("Your context has not been uploaded yet."),e.out(r==="write"?`When ready, publish with kane-cli context push ${i}. This shares your context records and their referenced source documents with everyone who can read the location.`:"Ask the location owner for write access before publishing, then check the connection again."),e.out(`Share this location with teammates: ${H(c)}`),e.out(K(c))}return 0}catch(o){return o instanceof w?(e.out("Setup left. Your context has not been published. Any completed connection checks remain in the location."),3):(e.out(o instanceof Error?o.message:"Setup could not finish."),2)}}async function q(e,t=!1){return new Promise(o=>{let n=D("gh",e,{stdio:t?"inherit":["ignore","pipe","pipe"],windowsHide:!0}),h="";n.stdout?.on("data",s=>{h.length<64e3&&(h+=String(s))}),n.stderr?.on("data",()=>{});let c=setTimeout(()=>n.kill("SIGKILL"),t?3e5:2e4);n.on("error",()=>{clearTimeout(c),o({code:1,text:"GitHub CLI is unavailable"})}),n.on("close",s=>{clearTimeout(c),o({code:s??1,text:h})})})}async function ie(e,t=L(),o=process.cwd()){if(e.mode&&e.mode!=="interactive"||!G())return Y(R(e,t),t,new A("TTY_REQUIRED","guided setup needs an interactive terminal; for automation use kane-cli context sync add <name> <location> or kane-cli context clone <location> <new-folder>","run kane-cli context sync setup in a terminal"),2);let{promptSetup:n}=await import("./sync-setup-ui-RC727VK6.js"),h=(s,i)=>i(s?{credentials:s}:{}),c=async s=>{let i=[],l=await s({...t,out:r=>i.push(r),err:r=>i.push(r)});if(l!==0)for(let r of i){if(r.startsWith("next: ")||r.startsWith("checking "))continue;let a=r.startsWith("error: ")?r.slice(7):r,d=/^([a-z][a-z0-9+.-]*:\/\/|[a-z0-9._-]+@[a-z0-9.-]+[:/]|[\/~.])/i.test(a);t.out(/^[a-z]/.test(a)&&!d?a.charAt(0).toUpperCase()+a.slice(1)+(/[.!?]$/.test(a)?"":"."):a)}return l};return J({out:t.out,choose:(s,i)=>n({title:s,choices:i}),input:(s,i,l)=>n({title:s,initial:i,secret:l}),open:async s=>{let{default:i}=await import("./open-MQLQKFAW.js");await i(s)},checkGit:()=>O(),gitRead:async s=>{try{let i=await T(["ls-remote",s],{timeout:2e4});return{ok:i.code===0,diagnostic:i.stderr}}catch(i){return{ok:!1,diagnostic:i instanceof Error?i.message:String(i)}}},gh:q,add:(s,i,l)=>h(l,r=>c(a=>_(s,i,r,a,o))),clone:(s,i,l)=>h(l,r=>c(a=>N(s,i,r,a,o))),access:s=>I(f(o)).entries[s]?.tier===1?"write":"read"},o)}export{J as runSetup,ie as setupCommand};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import{f as a}from"./chunk-6HCY5LJO.js";import"./chunk-3MSXQU2C.js";import"./chunk-V4JR5JCK.js";import"./chunk-ZYEFWJNZ.js";import"./chunk-KYZKPNPQ.js";import"./chunk-ULGFPKC7.js";import"./chunk-QXUPBIV3.js";import"./chunk-NPKB7EK3.js";import"./chunk-E44OHYDS.js";import"./chunk-MZYPDLD3.js";import"./chunk-H6TNBKGR.js";import"./chunk-66MOZKD2.js";import"./chunk-YLQHY4A7.js";import"./chunk-IYOPWIG4.js";import"./chunk-HYCOX7AB.js";import"./chunk-UEG4LJD6.js";import"./chunk-WD52ZNQY.js";import"./chunk-WML5KSGQ.js";import"./chunk-Q7LZ5QJV.js";import"./chunk-TBYYPGHF.js";import"./chunk-WPNNRMTP.js";import"./chunk-BHSHGWBL.js";import"./chunk-S3DAAAE5.js";import"./chunk-5VZAWKDF.js";import"./chunk-3LXN6AV5.js";import"./chunk-PDXZROJM.js";import"./chunk-NN6UG2BE.js";import"./chunk-Z4KRSLAM.js";import"./chunk-XGL3RSI5.js";import"./chunk-5ACSALRU.js";import"./chunk-W4Y3PG7F.js";import"./chunk-7O54QURK.js";import"./chunk-5GUD3CIH.js";import"./chunk-VOTIGXQ4.js";import"./chunk-YMLC55J4.js";import"./chunk-EHN5HTUD.js";import"./chunk-SWTJMTBY.js";import"./chunk-IE3OO5GI.js";import"./chunk-CH273NAE.js";import"./chunk-PDTFQGQF.js";import"./chunk-CDWUZ54U.js";import"./chunk-IQDZ6YMY.js";import"./chunk-VWOAEF7J.js";import"./chunk-WECVT7WE.js";import"./chunk-L45HDSJ7.js";import"./chunk-NBXYL2JT.js";import"./chunk-CAOZKSQ3.js";import"./chunk-VZ7KXRXB.js";import"./chunk-NADKZKGS.js";import"./chunk-OYY566GN.js";import"./chunk-OUWOLCCS.js";import"./chunk-2GWMENG5.js";import"./chunk-5Y2G4NC7.js";import"./chunk-P7YZ3PU3.js";import"./chunk-TDPWFYTJ.js";import"./chunk-23MVD7GY.js";import"./chunk-4PMZ5FCD.js";import"./chunk-2YEHV2CX.js";import"./chunk-5LJRZI7S.js";import"./chunk-BKM2LWU2.js";import"./chunk-MD3S2RXN.js";import"./chunk-GP7WD4UY.js";import"./chunk-JQW2QFSX.js";import"./chunk-3N6IAVD5.js";import"./chunk-FQNQVC5O.js";import"./chunk-AKX4VRRR.js";import"./chunk-UD7KKHPW.js";import"./chunk-SF5QPR6T.js";import"./chunk-BK42G6RI.js";import"./chunk-H6S7L2I2.js";import"./chunk-BY2MU3ZS.js";import"./chunk-YCCUBQY4.js";import"./chunk-HBMNUT6E.js";import"./chunk-TGBXIV7O.js";import"./chunk-BPMSNGXQ.js";import"./chunk-VE3SUJMA.js";import"./chunk-O3ZKP4DY.js";import"./chunk-RFHMDQXZ.js";import"./chunk-Z2GDSCPS.js";import"./chunk-ICUTARPB.js";import"./chunk-MMBBQ4OZ.js";import"./chunk-GGD7NKPL.js";import"./chunk-MSGW4JDG.js";import"./chunk-TZXXJWHA.js";import"./chunk-RSSOJ3L2.js";import"./chunk-5EOX4MEY.js";import"./chunk-C6JFTSIQ.js";import"./chunk-TAOHYWEO.js";import"./chunk-EMAKLNDV.js";import"./chunk-AAT4O22C.js";import"./chunk-U7BVK5IX.js";import"./chunk-Z7S3IWUX.js";import"./chunk-4JOD47QI.js";import"./chunk-G2ZMNVYN.js";import"./chunk-KPL2XHYF.js";import"./chunk-BCJNIDS3.js";import"./chunk-DHJSM5DT.js";import"./chunk-NLCCBXXV.js";import"./chunk-RZ4F3BHX.js";import"./chunk-E47GFYXA.js";import"./chunk-EYOCNMUM.js";import"./chunk-UAFCBZ3P.js";import"./chunk-IZ5CTC6M.js";import"./chunk-FQFVAFWK.js";import"./chunk-F2XTOZTN.js";import{a as o}from"./chunk-DFS4RMVP.js";import{a as t}from"./chunk-HCBYKLMW.js";import{c as n}from"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import{e as r}from"./chunk-UR6MHSHU.js";var e=r(t(),1);async function p(i){let c=i.scenarioLimit!==void 0||i.perScenarioLimit!==void 0?{scenarioLimit:i.scenarioLimit,perScenarioLimit:i.perScenarioLimit}:void 0,{waitUntilExit:m}=n((0,e.jsx)(o,{children:(0,e.jsx)(a,{initialChatMode:"generate",initialObjective:i.objective,initialGenerateLimits:c})}),{exitOnCtrlC:!1});await m()}export{p as runGenerate};
|
|
@@ -0,0 +1,2 @@
|
|
|
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-IYOPWIG4.js";import"./chunk-HYCOX7AB.js";import"./chunk-UEG4LJD6.js";import"./chunk-WD52ZNQY.js";import"./chunk-PDXZROJM.js";import"./chunk-WECVT7WE.js";import"./chunk-L45HDSJ7.js";import"./chunk-NBXYL2JT.js";import"./chunk-CAOZKSQ3.js";import"./chunk-VZ7KXRXB.js";import"./chunk-23MVD7GY.js";import"./chunk-MD3S2RXN.js";import"./chunk-HBMNUT6E.js";import"./chunk-RSSOJ3L2.js";import"./chunk-5EOX4MEY.js";import"./chunk-U7BVK5IX.js";import"./chunk-G2ZMNVYN.js";import"./chunk-KPL2XHYF.js";import"./chunk-BCJNIDS3.js";import"./chunk-DHJSM5DT.js";import"./chunk-NLCCBXXV.js";import"./chunk-RZ4F3BHX.js";import"./chunk-EYOCNMUM.js";import"./chunk-UAFCBZ3P.js";import"./chunk-F2XTOZTN.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};
|
|
@@ -0,0 +1,2 @@
|
|
|
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,g as f}from"./chunk-WECVT7WE.js";import"./chunk-L45HDSJ7.js";import"./chunk-NBXYL2JT.js";import"./chunk-CAOZKSQ3.js";import"./chunk-VZ7KXRXB.js";import"./chunk-DHJSM5DT.js";import"./chunk-NLCCBXXV.js";import"./chunk-RZ4F3BHX.js";import"./chunk-EYOCNMUM.js";import"./chunk-F2XTOZTN.js";import"./chunk-UR6MHSHU.js";export{a as buildBundleZip,c as runBundleSync,d as shouldSyncBundle,e as shouldSyncPersistedBundle,f as syncPersistedBundle,b as syncTestmdBundle};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import{a}from"./chunk-G2ZMNVYN.js";import"./chunk-KPL2XHYF.js";import"./chunk-BCJNIDS3.js";import"./chunk-RZ4F3BHX.js";import"./chunk-F2XTOZTN.js";import"./chunk-UR6MHSHU.js";export{a as refreshOAuthToken};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as t}from"./chunk-
|
|
2
|
+
import{a as t}from"./chunk-BCJNIDS3.js";import"./chunk-F2XTOZTN.js";import"./chunk-UR6MHSHU.js";async function l(n,o,r){let{ControllerClient:e}=await import("./controller-client-ZF5IXRUV.js");await new e(t(n).controllerBaseUrl,{username:o,accessKey:r}).getTmsCredentials()}export{l as validateBasicAuth};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a,b,c}from"./chunk-
|
|
2
|
+
import{a,b,c}from"./chunk-NN6UG2BE.js";import"./chunk-Z4KRSLAM.js";import"./chunk-F2XTOZTN.js";import"./chunk-UR6MHSHU.js";export{b as formatUnresolvedReceipt,a as suggestedVariablesFile,c as unresolvedVariablesEvent};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a,b,c}from"./chunk-
|
|
2
|
+
import{a,b,c}from"./chunk-NMBFAIXZ.js";import"./chunk-I7TIGB7K.js";import"./chunk-AGKE5WF3.js";import"./chunk-BB2W35TW.js";import"./chunk-YKTYVJBN.js";import"./chunk-ALCE5RLK.js";import"./chunk-IE3OO5GI.js";import"./chunk-GP7WD4UY.js";import"./chunk-JQW2QFSX.js";import"./chunk-3N6IAVD5.js";import"./chunk-FQNQVC5O.js";import"./chunk-AKX4VRRR.js";import"./chunk-UD7KKHPW.js";import"./chunk-F2XTOZTN.js";import"./chunk-UR6MHSHU.js";export{b as requiresBecause,a as reviewProtocolCtx,c as submitReview};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a,b,c,d}from"./chunk-
|
|
2
|
+
import{a,b,c,d}from"./chunk-Z5DGFN7R.js";import"./chunk-RZ4F3BHX.js";import"./chunk-F2XTOZTN.js";import"./chunk-UR6MHSHU.js";export{d as checkForUpdate,b as compareVersions,c as getSeverity,a as getUpdateCommand};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{Q as T}from"./chunk-6LGED4FC.js";import"./chunk-C74ABM24.js";import"./chunk-H6TNBKGR.js";import"./chunk-66MOZKD2.js";import"./chunk-YLQHY4A7.js";import"./chunk-22QIVSQR.js";import"./chunk-IE3OO5GI.js";import"./chunk-CH273NAE.js";import"./chunk-LBNADEQN.js";import"./chunk-VZ7KXRXB.js";import"./chunk-5LJRZI7S.js";import"./chunk-BKM2LWU2.js";import{C as V}from"./chunk-GP7WD4UY.js";import"./chunk-JQW2QFSX.js";import{F as I}from"./chunk-3N6IAVD5.js";import"./chunk-FQNQVC5O.js";import{d as f,e as x}from"./chunk-AKX4VRRR.js";import"./chunk-UD7KKHPW.js";import"./chunk-YCCUBQY4.js";import"./chunk-RSSOJ3L2.js";import"./chunk-5EOX4MEY.js";import"./chunk-RZ4F3BHX.js";import"./chunk-EYOCNMUM.js";import"./chunk-B2ZGG7WM.js";import"./chunk-DFS4RMVP.js";import"./chunk-HCBYKLMW.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";import{writeFileSync as ce,mkdirSync as pe}from"fs";import{tmpdir as ue}from"os";import{dirname as fe,join as ge}from"path";var F={DERIVES:"derivation",automates:"linkage",exercises:"mesh",verifies:"mesh",depends_on:"crosslink",reuses:"crosslink",belongs_to:"containment",scoped_to:"containment",annotates:"annotation"},re=(t,r)=>t===f.SOURCE?String(r.source_id??""):t===f.AC?String(r.text??""):t===f.STYLENOTE?String(r.statement??r.text??""):t===f.GAP?String(r.text??r.question??""):String(r.title??"");function H(t){let r=[];for(let[o,p]of t.nodeLabel){let g=t.getNode(o)?.content??{};r.push({cid:o,label:p,slug:p===f.SOURCE?String(g.source_id??""):t.displayNameOf?.(o)??t.nameOf.get(o)??o.slice(0,19),trust:t.trust.get(o)??"derived",fresh:t.stale(o),title:re(p,g),content:g,superseded:t.superseded.has(o)})}let e=new Map;for(let[o]of t.nodeLabel)for(let p of t.edgesFrom(o)){let g=`${p.type}|${p.src}|${p.dst}`,v=typeof p.props?.anchor=="string"?p.props.anchor:void 0,w=e.get(g);w?(w.count++,v&&w.anchors.push(v)):e.set(g,{key:g,type:p.type,family:F[p.type]??"mesh",src:p.src,dst:p.dst,count:1,anchors:v?[v]:[],container:F[p.type]==="containment"})}let s=[...e.values()],i={},l={trusted:0,derived:0,archived:0},d={fresh:0,stale:0,orphaned:0,superseded:0},a=0;for(let o of r)o.superseded||(a++,i[o.label]=(i[o.label]??0)+1,o.label!==f.SOURCE&&l[o.trust]++,d[o.fresh]++);return{nodes:r,edges:s,summary:{nodes:a,edges:s.reduce((o,p)=>o+p.count,0),byLabel:i,trust:l,fresh:d,usecases:i[f.USECASE]??0,designed:0}}}var P=/^([a-z]+)-(\d+)$/,E=(t,r)=>{let e=P.exec(t),s=P.exec(r);return e&&s&&e[1]===s[1]?Number(e[2])-Number(s[2]):t<r?-1:t>r?1:0};function se(t,r,e){let s=new Set,i=d=>{let a=e.nodeLabel.get(d);if(a===f.USECASE)s.add(d);else if(a===f.SCENARIO)for(let o of e.edgesFrom(d))o.type===x.BELONGS_TO&&s.add(o.dst)},l=e.edgesFrom(t);if(r===f.SCENARIO)for(let d of l)d.type===x.BELONGS_TO&&s.add(d.dst);if(r===f.AC)for(let d of l)d.type===x.SCOPED_TO&&i(d.dst);if(r===f.TEST)for(let d of l)d.type===x.AUTOMATES&&i(d.dst);return s}function G(t,r){let e=new Map,s=t.nodes.filter(a=>a.label===f.USECASE).map(a=>a.cid),i=s.map(a=>({ucCid:a,slug:r.nameOf.get(a)??a.slice(0,19),designed:r.designOf.has(a),nodeCids:[a]})).sort((a,o)=>E(a.slug,o.slug)),l={ucCid:"__shared__",slug:"cross-cutting",designed:!1,nodeCids:[]},d=new Map(i.map(a=>[a.ucCid,a]));for(let a of s)e.set(a,a);for(let a of t.nodes){if(a.label===f.SOURCE||a.label===f.USECASE)continue;let o=se(a.cid,a.label,r);if(o.size===1){let p=[...o][0];e.set(a.cid,p),d.get(p).nodeCids.push(a.cid)}else e.set(a.cid,"__shared__"),l.nodeCids.push(a.cid)}return{laneOf:e,lanes:[...i,l]}}var N={source:0,usecase:1,scenario:2,ac:3,test:4,stylenote:5,gap:5},ie=6,z=260,R=64,B=28;function U(t,r,e){let{lanes:s}=r,i=new Map(t.nodes.map(n=>[n.cid,n])),l=new Map,d=[],a=[],o=n=>{let m=n.map(h=>l.get(h)).filter(h=>h!==void 0);return m.length?m.reduce((h,S)=>h+S,0)/m.length:Number.MAX_SAFE_INTEGER},p=s.filter(n=>n.ucCid!=="__shared__"||n.nodeCids.length>0),g=t.nodes.filter(n=>n.label===f.SOURCE).sort((n,m)=>E(n.slug,m.slug)),v=0;for(let n of p){let m=n.nodeCids.map(c=>i.get(c)).filter(Boolean),h=c=>m.filter(u=>u.label===c),S=h(f.USECASE).sort((c,u)=>E(c.slug,u.slug));S.forEach((c,u)=>l.set(c.cid,u));let D=h(f.SCENARIO).sort((c,u)=>E(c.slug,u.slug));D.forEach((c,u)=>l.set(c.cid,u));let M=h(f.AC).sort((c,u)=>{let _=o(e.edgesInto(c.cid).filter(b=>b.type===x.EXERCISES).map(b=>b.src)),O=o(e.edgesInto(u.cid).filter(b=>b.type===x.EXERCISES).map(b=>b.src));return _-O||E(c.slug,u.slug)});M.forEach((c,u)=>l.set(c.cid,u));let j=h(f.TEST).sort((c,u)=>{let _=o(e.edgesFrom(c.cid).filter(b=>b.type===x.VERIFIES).map(b=>b.dst)),O=o(e.edgesFrom(u.cid).filter(b=>b.type===x.VERIFIES).map(b=>b.dst));return _-O||E(c.slug,u.slug)});j.forEach((c,u)=>l.set(c.cid,u));let q=m.filter(c=>N[c.label]===void 0||N[c.label]>=5).sort((c,u)=>E(c.slug,u.slug));q.forEach((c,u)=>l.set(c.cid,u));let A=Math.max(1,S.length,D.length,M.length,j.length,q.length)*R+B;for(let c of m){let u=N[c.label]??4,_=l.get(c.cid)??0;d.push({...c,lane:n.ucCid,col:u,x:u*z,y:v+B/2+_*R})}a.push({...n,y0:v,y1:v+A}),v+=A}let w=Math.max(v,R);g.forEach((n,m)=>d.push({...n,lane:"__spine__",col:0,x:0,y:w/(g.length+1)*(m+1)}));let L=ie*z;return{nodes:d,lanes:a,width:L,height:w}}function ae(t){return t.design_of?"design":t.review.length>0?"review":t.nodes.some(r=>r.label==="source")?"ingest":t.nodes.length>0?"extract":"other"}function $(t){let r=new Map,e=new Map,s=[];for(let i of t){for(let n of i.nodes)r.has(n.cid)||r.set(n.cid,i.seq);let l=new Map(e);for(let n of i.nodes)n.content?.derived===!0&&!e.has(n.cid)&&e.set(n.cid,"derived");for(let n of i.review)n.resolution==="approved"||n.resolution==="edited"?e.set(n.id,"trusted"):n.resolution==="rejected"?e.set(n.id,"archived"):n.resolution==="reset"&&e.set(n.id,"derived");let d=n=>{let m=0;for(let[h,S]of e)S===n&&l.get(h)!==n&&m++;return m},a=0;for(let[n,m]of e){let h=l.get(n);m==="derived"&&(h==="trusted"||h==="archived")&&a++}let o={trusted:d("trusted"),archived:d("archived"),reset:a},p=ae(i),g=i.nodes.map(n=>n.cid),v=i.edges.map(n=>`${n.type}|${n.src}|${n.dst}`),w=i.review.map(n=>n.id),L=p==="review"?"review \xB7 +"+o.trusted+" trusted"+(o.archived?", +"+o.archived+" archived":""):p+" \xB7 +"+g.length+" nodes";s.push({seq:i.seq,ts:i.ts,kind:p,label:L,mintedNodeCids:g,mintedEdgeKeys:v,reviewedNodeCids:w,trustDelta:o})}return{commits:s,bornSeq:r}}function Y(t,r,e){let s=[];for(let i of t){i.nodes.some(l=>l.cid===r)&&s.push({seq:i.seq,ts:i.ts,kind:"minted",detail:"minted here"});for(let l of i.review)l.id===r&&s.push({seq:i.seq,ts:i.ts,kind:"review",detail:l.resolution+(l.reason?": "+l.reason:"")})}return e.length&&s.push({seq:0,ts:"",kind:"derived_from",detail:"source lines "+e.join(", ")}),s}var oe={"&":"&","<":"<",">":">",'"':""","'":"'"};function k(t){return String(t).replace(/[&<>"']/g,r=>oe[r])}var W=t=>"\\u"+t.charCodeAt(0).toString(16).padStart(4,"0"),de=new RegExp("[\u2028\u2029]","g");function X(t){return t.replace(/[<>&]/g,W).replace(de,W)}var K=t=>t.replace("sha256:","").slice(0,12);function J(t){if(!t||typeof t!="object")return"";let r=String(t.operator??""),e=t.operand!=null?String(t.operand):"",s=t.unit!=null?" "+String(t.unit):"",i=t.baseline!=null?String(t.baseline):"",l=t.within&&typeof t.within=="object"?t.within:null,d;switch(r){case"exists":d="exists: "+e;break;case"forall":d="for all "+e;break;case"contains":d="contains "+e;break;case"gte":d=">= "+e+s;break;case"lte":d="<= "+e+s;break;case"equals":d="= "+e+s+(i?" (was "+i+")":"");break;case"changed-by":d="changed by "+e+s;break;default:d=(r+" "+e+s).trim()}if(l){let a=l.threshold!=null?String(l.threshold):"",o=l.unit!=null?String(l.unit):"";(a||o)&&(d+=" within "+a+o)}return d.trim()}var C=t=>t==null||t===""?"":`<span class="chip">${k(t)}</span>`,y=(t,r)=>r==null||r===""?"":`<div class="kv"><span class="k">${k(t)}</span><span class="v">${k(r)}</span></div>`,le=t=>Array.isArray(t)&&t.length?`<ul class="crit">${t.map(r=>`<li>${k(r)}</li>`).join("")}</ul>`:"";function Q(t,r){let e=r??{};switch(t){case"usecase":return[y("description",e.description),y("value",e.value),[C(e.risk?"risk: "+e.risk:""),...Array.isArray(e.actors)?e.actors.map(s=>C(s)):[]].join(""),le(e.criteria)].join("");case"scenario":return[y("intent",e.intent),[C(e.case_type)].join(""),e.parameters&&typeof e.parameters=="object"?Object.entries(e.parameters).map(([s,i])=>y(s,i)).join(""):"",y("techniques",e.technique_notes)].join("");case"ac":return[y("",e.text),[C(e.kind),C(e.risk?"risk: "+e.risk:"")].join(""),(()=>{let s=J(e.expected_answer);return s?`<div class="pred">${k(s)}</div>`:""})()].join("");case"test":{let s=J(e.check),i=e.test_md_blob!=null?`<pre class="md">${k(String(e.test_md_blob))}</pre>`:"";return[s?`<div class="pred">${k(s)}</div>`:"",y("definitionId",e.definitionId),i].join("")}case"source":return[y("source_id",e.source_id),y("blob",e.blob)].join("");case"stylenote":return[e.statement?`<div class="pred">${k(e.statement)}</div>`:"",[C(e.learned_from_kind?"learned from: "+e.learned_from_kind:"")].join(""),y("",e.text),Array.isArray(e.tags)?e.tags.map(s=>C(s)).join(""):""].join("");case"gap":return[y("",e.text??e.question),[C(e.kind),C(e.risk?"risk: "+e.risk:"")].join(""),y("why",e.risk_rationale),y("ref",e.ref)].join("");default:return""}}function Z(t,r,e,s){let i=H(t),l=G(i,t),d=U(i,l,t),{commits:a}=$(r);i.summary.designed=l.lanes.filter(n=>n.designed&&n.ucCid!=="__shared__").length;let o={},p={};for(let n of i.nodes){o[n.cid]=Q(n.label,n.content);let m=t.edgesInto(n.cid).filter(h=>h.type===x.DERIVES&&typeof h.props?.anchor=="string").map(h=>h.props.anchor);p[n.cid]=Y(r,n.cid,m)}let g=d.nodes.map(n=>({cid:n.cid,slug:n.slug,label:n.label,trust:n.trust,fresh:n.fresh,title:n.title,superseded:n.superseded,lane:n.lane,col:n.col,x:n.x,y:n.y})),v=d.lanes.map(n=>({ucCid:n.ucCid,slug:n.slug,designed:n.designed,y0:n.y0,y1:n.y1})),L=i.nodes.some(n=>n.label===f.SOURCE)?{}:void 0;return{meta:{fromSeq:r[0]?.seq??0,tipHash:e[e.length-1]??null,storePath:s,schema:"assurance/context@1",asOf:r[r.length-1]?.ts??null},summary:i.summary,lanes:v,nodes:g,edges:i.edges,commits:a,lineage:p,contentHtml:o,width:d.width,height:d.height,source:L}}var ee="__PAYLOAD__",te=`<!doctype html>
|
|
2
|
+
import{Q as T}from"./chunk-E44OHYDS.js";import"./chunk-MZYPDLD3.js";import"./chunk-H6TNBKGR.js";import"./chunk-66MOZKD2.js";import"./chunk-YLQHY4A7.js";import"./chunk-SWTJMTBY.js";import"./chunk-IE3OO5GI.js";import"./chunk-CH273NAE.js";import"./chunk-CAOZKSQ3.js";import"./chunk-VZ7KXRXB.js";import"./chunk-5LJRZI7S.js";import"./chunk-BKM2LWU2.js";import{C as V}from"./chunk-GP7WD4UY.js";import"./chunk-JQW2QFSX.js";import{F as I}from"./chunk-3N6IAVD5.js";import"./chunk-FQNQVC5O.js";import{d as f,e as x}from"./chunk-AKX4VRRR.js";import"./chunk-UD7KKHPW.js";import"./chunk-YCCUBQY4.js";import"./chunk-RSSOJ3L2.js";import"./chunk-5EOX4MEY.js";import"./chunk-RZ4F3BHX.js";import"./chunk-EYOCNMUM.js";import"./chunk-F2XTOZTN.js";import"./chunk-DFS4RMVP.js";import"./chunk-HCBYKLMW.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";import{writeFileSync as ce,mkdirSync as pe}from"fs";import{tmpdir as ue}from"os";import{dirname as fe,join as ge}from"path";var F={DERIVES:"derivation",automates:"linkage",exercises:"mesh",verifies:"mesh",depends_on:"crosslink",reuses:"crosslink",belongs_to:"containment",scoped_to:"containment",annotates:"annotation"},re=(t,r)=>t===f.SOURCE?String(r.source_id??""):t===f.AC?String(r.text??""):t===f.STYLENOTE?String(r.statement??r.text??""):t===f.GAP?String(r.text??r.question??""):String(r.title??"");function H(t){let r=[];for(let[o,p]of t.nodeLabel){let g=t.getNode(o)?.content??{};r.push({cid:o,label:p,slug:p===f.SOURCE?String(g.source_id??""):t.displayNameOf?.(o)??t.nameOf.get(o)??o.slice(0,19),trust:t.trust.get(o)??"derived",fresh:t.stale(o),title:re(p,g),content:g,superseded:t.superseded.has(o)})}let e=new Map;for(let[o]of t.nodeLabel)for(let p of t.edgesFrom(o)){let g=`${p.type}|${p.src}|${p.dst}`,v=typeof p.props?.anchor=="string"?p.props.anchor:void 0,w=e.get(g);w?(w.count++,v&&w.anchors.push(v)):e.set(g,{key:g,type:p.type,family:F[p.type]??"mesh",src:p.src,dst:p.dst,count:1,anchors:v?[v]:[],container:F[p.type]==="containment"})}let s=[...e.values()],i={},l={trusted:0,derived:0,archived:0},d={fresh:0,stale:0,orphaned:0,superseded:0},a=0;for(let o of r)o.superseded||(a++,i[o.label]=(i[o.label]??0)+1,o.label!==f.SOURCE&&l[o.trust]++,d[o.fresh]++);return{nodes:r,edges:s,summary:{nodes:a,edges:s.reduce((o,p)=>o+p.count,0),byLabel:i,trust:l,fresh:d,usecases:i[f.USECASE]??0,designed:0}}}var P=/^([a-z]+)-(\d+)$/,E=(t,r)=>{let e=P.exec(t),s=P.exec(r);return e&&s&&e[1]===s[1]?Number(e[2])-Number(s[2]):t<r?-1:t>r?1:0};function se(t,r,e){let s=new Set,i=d=>{let a=e.nodeLabel.get(d);if(a===f.USECASE)s.add(d);else if(a===f.SCENARIO)for(let o of e.edgesFrom(d))o.type===x.BELONGS_TO&&s.add(o.dst)},l=e.edgesFrom(t);if(r===f.SCENARIO)for(let d of l)d.type===x.BELONGS_TO&&s.add(d.dst);if(r===f.AC)for(let d of l)d.type===x.SCOPED_TO&&i(d.dst);if(r===f.TEST)for(let d of l)d.type===x.AUTOMATES&&i(d.dst);return s}function G(t,r){let e=new Map,s=t.nodes.filter(a=>a.label===f.USECASE).map(a=>a.cid),i=s.map(a=>({ucCid:a,slug:r.nameOf.get(a)??a.slice(0,19),designed:r.designOf.has(a),nodeCids:[a]})).sort((a,o)=>E(a.slug,o.slug)),l={ucCid:"__shared__",slug:"cross-cutting",designed:!1,nodeCids:[]},d=new Map(i.map(a=>[a.ucCid,a]));for(let a of s)e.set(a,a);for(let a of t.nodes){if(a.label===f.SOURCE||a.label===f.USECASE)continue;let o=se(a.cid,a.label,r);if(o.size===1){let p=[...o][0];e.set(a.cid,p),d.get(p).nodeCids.push(a.cid)}else e.set(a.cid,"__shared__"),l.nodeCids.push(a.cid)}return{laneOf:e,lanes:[...i,l]}}var N={source:0,usecase:1,scenario:2,ac:3,test:4,stylenote:5,gap:5},ie=6,z=260,R=64,B=28;function U(t,r,e){let{lanes:s}=r,i=new Map(t.nodes.map(n=>[n.cid,n])),l=new Map,d=[],a=[],o=n=>{let m=n.map(h=>l.get(h)).filter(h=>h!==void 0);return m.length?m.reduce((h,S)=>h+S,0)/m.length:Number.MAX_SAFE_INTEGER},p=s.filter(n=>n.ucCid!=="__shared__"||n.nodeCids.length>0),g=t.nodes.filter(n=>n.label===f.SOURCE).sort((n,m)=>E(n.slug,m.slug)),v=0;for(let n of p){let m=n.nodeCids.map(c=>i.get(c)).filter(Boolean),h=c=>m.filter(u=>u.label===c),S=h(f.USECASE).sort((c,u)=>E(c.slug,u.slug));S.forEach((c,u)=>l.set(c.cid,u));let D=h(f.SCENARIO).sort((c,u)=>E(c.slug,u.slug));D.forEach((c,u)=>l.set(c.cid,u));let M=h(f.AC).sort((c,u)=>{let _=o(e.edgesInto(c.cid).filter(b=>b.type===x.EXERCISES).map(b=>b.src)),O=o(e.edgesInto(u.cid).filter(b=>b.type===x.EXERCISES).map(b=>b.src));return _-O||E(c.slug,u.slug)});M.forEach((c,u)=>l.set(c.cid,u));let j=h(f.TEST).sort((c,u)=>{let _=o(e.edgesFrom(c.cid).filter(b=>b.type===x.VERIFIES).map(b=>b.dst)),O=o(e.edgesFrom(u.cid).filter(b=>b.type===x.VERIFIES).map(b=>b.dst));return _-O||E(c.slug,u.slug)});j.forEach((c,u)=>l.set(c.cid,u));let q=m.filter(c=>N[c.label]===void 0||N[c.label]>=5).sort((c,u)=>E(c.slug,u.slug));q.forEach((c,u)=>l.set(c.cid,u));let A=Math.max(1,S.length,D.length,M.length,j.length,q.length)*R+B;for(let c of m){let u=N[c.label]??4,_=l.get(c.cid)??0;d.push({...c,lane:n.ucCid,col:u,x:u*z,y:v+B/2+_*R})}a.push({...n,y0:v,y1:v+A}),v+=A}let w=Math.max(v,R);g.forEach((n,m)=>d.push({...n,lane:"__spine__",col:0,x:0,y:w/(g.length+1)*(m+1)}));let L=ie*z;return{nodes:d,lanes:a,width:L,height:w}}function ae(t){return t.design_of?"design":t.review.length>0?"review":t.nodes.some(r=>r.label==="source")?"ingest":t.nodes.length>0?"extract":"other"}function $(t){let r=new Map,e=new Map,s=[];for(let i of t){for(let n of i.nodes)r.has(n.cid)||r.set(n.cid,i.seq);let l=new Map(e);for(let n of i.nodes)n.content?.derived===!0&&!e.has(n.cid)&&e.set(n.cid,"derived");for(let n of i.review)n.resolution==="approved"||n.resolution==="edited"?e.set(n.id,"trusted"):n.resolution==="rejected"?e.set(n.id,"archived"):n.resolution==="reset"&&e.set(n.id,"derived");let d=n=>{let m=0;for(let[h,S]of e)S===n&&l.get(h)!==n&&m++;return m},a=0;for(let[n,m]of e){let h=l.get(n);m==="derived"&&(h==="trusted"||h==="archived")&&a++}let o={trusted:d("trusted"),archived:d("archived"),reset:a},p=ae(i),g=i.nodes.map(n=>n.cid),v=i.edges.map(n=>`${n.type}|${n.src}|${n.dst}`),w=i.review.map(n=>n.id),L=p==="review"?"review \xB7 +"+o.trusted+" trusted"+(o.archived?", +"+o.archived+" archived":""):p+" \xB7 +"+g.length+" nodes";s.push({seq:i.seq,ts:i.ts,kind:p,label:L,mintedNodeCids:g,mintedEdgeKeys:v,reviewedNodeCids:w,trustDelta:o})}return{commits:s,bornSeq:r}}function Y(t,r,e){let s=[];for(let i of t){i.nodes.some(l=>l.cid===r)&&s.push({seq:i.seq,ts:i.ts,kind:"minted",detail:"minted here"});for(let l of i.review)l.id===r&&s.push({seq:i.seq,ts:i.ts,kind:"review",detail:l.resolution+(l.reason?": "+l.reason:"")})}return e.length&&s.push({seq:0,ts:"",kind:"derived_from",detail:"source lines "+e.join(", ")}),s}var oe={"&":"&","<":"<",">":">",'"':""","'":"'"};function k(t){return String(t).replace(/[&<>"']/g,r=>oe[r])}var W=t=>"\\u"+t.charCodeAt(0).toString(16).padStart(4,"0"),de=new RegExp("[\u2028\u2029]","g");function X(t){return t.replace(/[<>&]/g,W).replace(de,W)}var K=t=>t.replace("sha256:","").slice(0,12);function J(t){if(!t||typeof t!="object")return"";let r=String(t.operator??""),e=t.operand!=null?String(t.operand):"",s=t.unit!=null?" "+String(t.unit):"",i=t.baseline!=null?String(t.baseline):"",l=t.within&&typeof t.within=="object"?t.within:null,d;switch(r){case"exists":d="exists: "+e;break;case"forall":d="for all "+e;break;case"contains":d="contains "+e;break;case"gte":d=">= "+e+s;break;case"lte":d="<= "+e+s;break;case"equals":d="= "+e+s+(i?" (was "+i+")":"");break;case"changed-by":d="changed by "+e+s;break;default:d=(r+" "+e+s).trim()}if(l){let a=l.threshold!=null?String(l.threshold):"",o=l.unit!=null?String(l.unit):"";(a||o)&&(d+=" within "+a+o)}return d.trim()}var C=t=>t==null||t===""?"":`<span class="chip">${k(t)}</span>`,y=(t,r)=>r==null||r===""?"":`<div class="kv"><span class="k">${k(t)}</span><span class="v">${k(r)}</span></div>`,le=t=>Array.isArray(t)&&t.length?`<ul class="crit">${t.map(r=>`<li>${k(r)}</li>`).join("")}</ul>`:"";function Q(t,r){let e=r??{};switch(t){case"usecase":return[y("description",e.description),y("value",e.value),[C(e.risk?"risk: "+e.risk:""),...Array.isArray(e.actors)?e.actors.map(s=>C(s)):[]].join(""),le(e.criteria)].join("");case"scenario":return[y("intent",e.intent),[C(e.case_type)].join(""),e.parameters&&typeof e.parameters=="object"?Object.entries(e.parameters).map(([s,i])=>y(s,i)).join(""):"",y("techniques",e.technique_notes)].join("");case"ac":return[y("",e.text),[C(e.kind),C(e.risk?"risk: "+e.risk:"")].join(""),(()=>{let s=J(e.expected_answer);return s?`<div class="pred">${k(s)}</div>`:""})()].join("");case"test":{let s=J(e.check),i=e.test_md_blob!=null?`<pre class="md">${k(String(e.test_md_blob))}</pre>`:"";return[s?`<div class="pred">${k(s)}</div>`:"",y("definitionId",e.definitionId),i].join("")}case"source":return[y("source_id",e.source_id),y("blob",e.blob)].join("");case"stylenote":return[e.statement?`<div class="pred">${k(e.statement)}</div>`:"",[C(e.learned_from_kind?"learned from: "+e.learned_from_kind:"")].join(""),y("",e.text),Array.isArray(e.tags)?e.tags.map(s=>C(s)).join(""):""].join("");case"gap":return[y("",e.text??e.question),[C(e.kind),C(e.risk?"risk: "+e.risk:"")].join(""),y("why",e.risk_rationale),y("ref",e.ref)].join("");default:return""}}function Z(t,r,e,s){let i=H(t),l=G(i,t),d=U(i,l,t),{commits:a}=$(r);i.summary.designed=l.lanes.filter(n=>n.designed&&n.ucCid!=="__shared__").length;let o={},p={};for(let n of i.nodes){o[n.cid]=Q(n.label,n.content);let m=t.edgesInto(n.cid).filter(h=>h.type===x.DERIVES&&typeof h.props?.anchor=="string").map(h=>h.props.anchor);p[n.cid]=Y(r,n.cid,m)}let g=d.nodes.map(n=>({cid:n.cid,slug:n.slug,label:n.label,trust:n.trust,fresh:n.fresh,title:n.title,superseded:n.superseded,lane:n.lane,col:n.col,x:n.x,y:n.y})),v=d.lanes.map(n=>({ucCid:n.ucCid,slug:n.slug,designed:n.designed,y0:n.y0,y1:n.y1})),L=i.nodes.some(n=>n.label===f.SOURCE)?{}:void 0;return{meta:{fromSeq:r[0]?.seq??0,tipHash:e[e.length-1]??null,storePath:s,schema:"assurance/context@1",asOf:r[r.length-1]?.ts??null},summary:i.summary,lanes:v,nodes:g,edges:i.edges,commits:a,lineage:p,contentHtml:o,width:d.width,height:d.height,source:L}}var ee="__PAYLOAD__",te=`<!doctype html>
|
|
3
3
|
<html lang="en">
|
|
4
4
|
<head>
|
|
5
5
|
<meta charset="utf-8">
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as ve}from"./chunk-TU6IMGWO.js";import{c as he}from"./chunk-FFVNISYH.js";import{a as Z}from"./chunk-A2SQD2AY.js";import{k as ge}from"./chunk-75I46VTM.js";import{a as ie,c as ne,d as pe}from"./chunk-SQDQADWD.js";import"./chunk-O3XBIURC.js";import{a as re,b as ce,c as le,d as N,f as G,g as de,i as ue,k as me,l as fe}from"./chunk-3YX3RQXO.js";import{a as ee,b as te}from"./chunk-UJZZDPDY.js";import"./chunk-RKXHVP2Z.js";import{a as Y}from"./chunk-TCAHDVII.js";import"./chunk-YYYQ5MVD.js";import"./chunk-BZAGVBCX.js";import"./chunk-CRZUBDJ3.js";import"./chunk-JUJ4SAGH.js";import"./chunk-ALCE5RLK.js";import"./chunk-6LGED4FC.js";import{b as Q}from"./chunk-C74ABM24.js";import"./chunk-H6TNBKGR.js";import"./chunk-66MOZKD2.js";import"./chunk-YLQHY4A7.js";import"./chunk-YMLC55J4.js";import"./chunk-22QIVSQR.js";import"./chunk-IE3OO5GI.js";import"./chunk-CH273NAE.js";import"./chunk-LBNADEQN.js";import"./chunk-VZ7KXRXB.js";import"./chunk-5Y2G4NC7.js";import"./chunk-5LJRZI7S.js";import"./chunk-BKM2LWU2.js";import{C as _}from"./chunk-GP7WD4UY.js";import"./chunk-JQW2QFSX.js";import"./chunk-3N6IAVD5.js";import"./chunk-FQNQVC5O.js";import"./chunk-AKX4VRRR.js";import"./chunk-UD7KKHPW.js";import{a as se}from"./chunk-YCCUBQY4.js";import"./chunk-RSSOJ3L2.js";import"./chunk-5EOX4MEY.js";import"./chunk-RZ4F3BHX.js";import"./chunk-EYOCNMUM.js";import{y as h}from"./chunk-B2ZGG7WM.js";import"./chunk-DFS4RMVP.js";import{a as K}from"./chunk-HCBYKLMW.js";import{a as F,b as x,k as ae}from"./chunk-C44QQJR4.js";import{a as Ie}from"./chunk-6YGTRKDT.js";import{e as U}from"./chunk-UR6MHSHU.js";var R=U(Ie(),1);function ke(t){let v=t.by??{kind:"human",id:process.env.USER??"operator"},k=t.mode==="interactive"?"override":t.mode,A=k==="override"?{note:"override \xB7 auto-answers, won't ask"}:{},M=(r,n)=>ee(t.onChild,{verb:"design",subject:r,...A,fixCmd:`kane-cli design tests --use-case ${r}`},n,l=>({ok:l===0,exitCode:l})),P=(r,n,l)=>ee(t.onChild,{verb:"evolve",subject:r,...A,fixCmd:`kane-cli maintain evolve ${n}`},l,a=>({ok:a.outcome==="evolved",exitCode:a.code})),S={out:()=>{},err:()=>{},isTTY:!1,confirm:async()=>!0},u={applied:0,committed:0,retired:0,skipped:0,deferred:0,failed:0},w=new Map;for(let r of t.planRows)if(r.held_ref&&t.held){let n=t.held.rows.find(a=>a.temp_ref===r.held_ref);if(!n)continue;let l={kind:n.kind,ref:n.temp_ref,title:n.title,why:n.why,origin:"content-change",...r.impact?{impact:r.impact}:{}};w.set(l.ref,{card:l,source:"held",heldRef:n.temp_ref})}else if(r.kind==="MODIFY"){let n={kind:"MODIFY",ref:r.ref,title:r.ref,why:`${r.reason}: ${r.provenance}`,origin:r.origin??"structural-stale",...r.impact?{impact:r.impact}:{}};w.set(n.ref,{card:n,source:"row",row:r})}else if(r.kind==="ADD"){let n={kind:"ADD",ref:r.ref,title:r.ref,why:r.reason,origin:r.origin??"content-change"};w.set(n.ref,{card:n,source:"row",row:r})}for(let r of t.archive){if(r.kind!=="ARCHIVE")continue;let n={kind:"ARCHIVE",ref:r.ref,title:r.ref,why:r.why,provenance:r.why,...r.impact?{impact:r.impact}:{}};w.set(n.ref,{card:n,source:"archive",row:r})}for(let r of t.reviewFeeder?.()??[]){if(w.has(r.ref))continue;let n={kind:r.kind==="MODIFY_HELD"?"MODIFY":r.kind,ref:r.ref,title:r.title,why:r.why,...r.impact?{impact:r.impact}:{},...r.pair?{pair:r.pair}:{},...r.held?{held:!0}:{},...r.kind==="MODIFY_HELD"?{heldPayload:!0}:{}};w.set(n.ref,{card:n,source:"review",reviewCard:r})}let y=r=>(u.failed++,{outcome:"failed",detail:r});return{cards:()=>[...w.values()].map(r=>r.card),async submit(r,n){let l=w.get(r);if(!l)return y(`no card ${r}`);if(l.source==="review"){if(l.reviewCard.kind==="PAIR"&&n.v==="approve")return y(`${r} is a PAIR card \u2014 approve is not in its grammar (merge / keep both / defer); words ride a defer note`);let{submitReview:s}=await import("./verdicts-XFXDRND4.js"),b=n.v==="approve"?{v:"approve"}:n.v==="archive"?{v:"archive",because:n.because??""}:n.v==="skip"&&l.reviewCard.kind==="MODIFY_HELD"?{v:"keep_current"}:n.v==="defer"||n.v==="skip"?{v:"defer"}:n.v==="merge"?{v:"merge"}:{v:"keep_both"},g=await s({contextDir:t.contextDir,signals:o=>t.signals({ref:o.ref,verdict:o.verdict,...o.reason?{reason:o.reason}:{}})},l.reviewCard,b,v);return g.outcome==="failed"?(u.failed++,g):g.outcome==="deferred"?(u.deferred++,n.v==="defer"&&n.note?(t.signals({ref:r,verdict:"deferred-with-note",reason:n.note}),{...g,detail:`steering noted: "${n.note}" \u2014 decide ${l.reviewCard.kind==="PAIR"?"merge / keep both":"the verdict"} when it re-offers`}):g):g.outcome==="retired"?(u.retired++,g):g.outcome==="committed"?(u.committed++,g):(u.applied++,g)}if(n.v==="merge"||n.v==="keep_both")return y(`${r} is a ${l.card.kind} card \u2014 ${n.v} applies to review cards only`);if(n.v==="skip")return u.skipped++,t.signals({ref:r,verdict:"gap-dismissed"}),{outcome:"skipped"};if(n.v==="defer")return u.deferred++,n.note?(t.signals({ref:r,verdict:"deferred-with-note",reason:n.note}),{outcome:"deferred",detail:`steering noted: "${n.note}"`}):{outcome:"deferred"};if(n.v==="archive"){if(l.source!=="archive")return y(`${r} is not an ARCHIVE card`);let s=_(t.contextDir),b=s.resolve(l.row.ref);if(b&&s.superseded.has(s.tipOf(b.cid)))return u.skipped++,{outcome:"skipped",detail:"already retired \u2014 nothing to do"};let g=ve(t.contextDir,_(t.contextDir),{ref:l.row.ref,reason:`reconcile retire: ${l.row.why}`,by:v});return g.errors?y(g.errors.map(o=>`${o.code}: ${o.detail}`).join("; ")):(u.retired++,t.signals({ref:r,verdict:"gap-resolved-archive",reason:l.row.why}),{outcome:"retired"})}if(l.source==="archive")return y(`${r} takes archive/skip/defer, not approve`);if(l.source==="held"){let s=ge(t.contextDir,t.held,l.heldRef,v,n.edits);if(!s.ok)return y(s.message);if(s.kind==="ADD"){let b=await M(s.ref,()=>t.runDesign(s.ref,{yes:!0,mode:k,...n.steering?{because:n.steering}:{}}));return b!==0?(u.failed++,{outcome:"failed",landed:!0,detail:`committed ${s.ref}, but its design run exited ${b} \u2014 finish with kane-cli design tests --use-case ${s.ref}`}):(u.applied++,t.signals({ref:r,verdict:"gap-resolved-create",...n.steering?{reason:n.steering}:{}}),{outcome:"applied",detail:s.ref})}if(n.steering){let b=_(t.contextDir),g=ie(b,s.ref);if(!g.ok)return u.committed++,{outcome:"committed",detail:`committed ${s.ref}, but steering could not resolve it (${g.message}) \u2014 steer via kane-cli maintain evolve ${s.ref}`};let o=await P(g.target.display,s.ref,()=>ne(t.contextDir,g.target,{yes:!0,mode:k,because:n.steering},S,t.runDesign,"batch"));if(o.outcome==="no-design"){let c=await M(g.target.seamRef,()=>t.runDesign(g.target.seamRef,{yes:!0,mode:k,because:n.steering}));return c!==0?(u.failed++,{outcome:"failed",landed:!0,detail:`committed ${s.ref}, but its steered design run exited ${c} \u2014 finish with kane-cli design tests --use-case ${g.target.seamRef}`}):(u.applied++,t.signals({ref:r,verdict:"gap-resolved-create",reason:n.steering}),{outcome:"applied",detail:s.ref})}return o.outcome==="failed"||o.outcome==="paused"?(u.failed++,{outcome:"failed",landed:!0,detail:`committed ${s.ref}, but the steering evolve ${o.outcome} (exit ${o.code}) \u2014 finish with kane-cli maintain evolve ${s.ref}`}):o.outcome==="declined"?(u.committed++,{outcome:"committed",detail:`committed ${s.ref} \u2014 the steering evolve was declined; re-run kane-cli maintain evolve ${s.ref}`}):(u.applied++,t.signals({ref:r,verdict:"gap-resolved-evolve",reason:n.steering}),{outcome:"applied",detail:s.ref})}return u.committed++,t.signals({ref:r,verdict:"gap-resolved-evolve"}),{outcome:"committed",detail:s.ref}}let a=_(t.contextDir),d=ie(a,l.row.ref);if(!d.ok)return y(d.message);if(l.card.kind==="ADD"){let s=await M(d.target.seamRef,()=>t.runDesign(d.target.seamRef,{yes:!0,mode:k}));return s!==0?y(`design run exited ${s}`):(u.applied++,t.signals({ref:r,verdict:"gap-resolved-create"}),{outcome:"applied"})}let D=await P(d.target.display,l.row.ref,()=>ne(t.contextDir,d.target,{yes:!0,mode:k,...n.steering?{because:n.steering}:{}},S,t.runDesign,"batch"));return D.outcome==="evolved"?(u.applied++,t.signals({ref:r,verdict:"gap-resolved-evolve",...n.steering?{reason:n.steering}:{}}),{outcome:"applied"}):D.outcome==="failed"||D.outcome==="paused"?y(`evolve ${D.outcome} (exit ${D.code})`):(u.skipped++,{outcome:"skipped",detail:D.outcome})},summary:()=>({...u})}}var j=U(K(),1);function q({mark:t,markColor:v,color:k,indent:A=2,reserve:M=0,children:P}){let{stdout:S}=ae(),u=(S?.columns??80)-M,w=A+t.length+1;return(0,j.jsxs)(F,{children:[(0,j.jsx)(F,{width:w,flexShrink:0,children:(0,j.jsx)(x,{color:v,children:`${" ".repeat(A)}${t}`})}),(0,j.jsx)(F,{width:Math.max(20,u-w),children:(0,j.jsx)(x,{color:k,children:P})})]})}var p=U(K(),1);function be(t){return t.landed?"committed":t.outcome}var We={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"}};function Ae(t){return t.v==="archive"?"Retiring\u2026":t.v==="approve"&&t.steering?"Approving with your changes \u2014 committing, then re-designing\u2026":"Applying \u2014 committing\u2026"}function Pe({controller:t,cards:v,note:k,markOutcome:A,routeChat:M,listEvolveTargets:P,barSubject:S,meta:u,resumeCmd:w,activeChild:y,onFinish:r,onCtrlC:n,pauseRef:l}){let[a,d]=(0,R.useState)(v.length>0?{at:"card",idx:0,sel:0,editor:null}:{at:"done-panel",sel:0}),D=(0,R.useRef)(0),s=(0,R.useRef)(a);s.current=a;let b=(0,R.useRef)([]),[,g]=(0,R.useState)(0),o=a.at==="busy"||a.at==="evolving";(0,R.useEffect)(()=>{if(!o)return;let e=setInterval(()=>g(i=>i+1),120);return()=>clearInterval(e)},[o]);let c=()=>{let e=t.summary();return`${e.applied+e.committed} applied \xB7 ${e.retired} retired \xB7 ${e.skipped} skipped \xB7 ${e.deferred} deferred`+(e.failed>0?` \xB7 ${e.failed} failed`:"")},E=()=>({state:"complete",facts:[c()]}),C=()=>({state:"walk-paused",reason:"ctrl+c",facts:[c(),"every verdict so far is committed \u2014 re-run the same reconcile command to continue"],...w?{resume:w}:{}}),$=()=>r(D.current,E()),T=(0,R.useRef)(!1),W=()=>{r(3,C())},I=()=>{if(T.current)return;T.current=!0;let e=s.current;if(e.at==="busy"||e.at==="evolving"){k((0,p.jsx)(x,{color:h.dim,children:"finishing the current item, then pausing\u2026"}));return}if(e.at==="done-panel"||e.at==="picker"||e.at==="why"||e.at==="view"){$();return}W()};l&&(l.current=I);let V=a.at==="card"||a.at==="busy"?v[a.idx]:null,O=()=>[{key:"finish",label:"finish"},...P?[{key:"evolve",label:"evolve another use-case\u2026"}]:[],...b.current.length>0?[{key:"view",label:"view what changed"}]:[]],H=()=>{let e=P?.()??[];if(e.length===0){k((0,p.jsx)(x,{color:h.dim,children:"nothing is stale \u2014 no evolve targets right now"})),d({at:"done-panel",sel:0});return}d({at:"picker",items:e,sel:0})},we=e=>{let i=e+1;i<v.length?d({at:"card",idx:i,sel:0,editor:null}):d({at:"done-panel",sel:0})},X=(0,R.useRef)(!1),L=(e,i)=>{if(X.current)return;X.current=!0;let m=v[e];d({at:"busy",idx:e,label:Ae(i),startedAt:Date.now()}),t.submit(m.ref,i).catch(f=>({outcome:"failed",detail:f instanceof Error?f.message:String(f)})).then(f=>{let B=We[f.outcome]??{mark:"\xB7",color:"dim"},Te=f.outcome!=="failed"&&f.outcome!=="skipped"&&f.outcome!=="deferred"&&m.impact&&"stale_refs"in m.impact&&m.impact.stale_refs.length>0?` \xB7 ${m.impact.stale_refs.length} item(s) now stale`:"",oe=`${f.outcome} [${m.kind}] ${Y(m.title)}${f.detail?` \u2014 ${Y(f.detail)}`:""}${Te}`;if(b.current.push({mark:B.mark,color:B.color,line:oe}),k((0,p.jsx)(q,{mark:B.mark,markColor:B.color==="green"?h.green:B.color==="red"?h.red:h.dim,color:B.color==="dim"?h.dim:void 0,children:oe})),f.outcome==="failed"&&(D.current=D.current===0?1:D.current),A(m.ref,be(f)),X.current=!1,T.current){W();return}we(e)})},ye=(e,i)=>{d({at:"evolving",title:e.title,startedAt:Date.now()}),M(`${e.key} ${i}`).catch(m=>`\u2717 evolve failed: ${m instanceof Error?m.message:String(m)}`).then(m=>{let f=m.startsWith("\u2713");if(b.current.push({mark:f?"\u2714":"\u2717",color:f?"green":"red",line:m.replace(/^[✓✗]\s*/,"")}),k((0,p.jsx)(q,{mark:f?"\u2714":"\u2717",markColor:f?h.green:h.red,children:m.replace(/^[✓✗]\s*/,"")})),T.current){$();return}d({at:"done-panel",sel:0})})},xe=(0,R.useMemo)(()=>({isFocused:()=>{let e=s.current;return e.at==="card"&&e.editor===null||e.at==="done-panel"||e.at==="picker"||e.at==="view"},onMove:e=>{d(i=>{if(i.at==="card"){let m=v[i.idx],f=G(m)??N(m).length-1;return{...i,sel:Math.max(0,Math.min(f,i.sel+e))}}return i.at==="done-panel"?{...i,sel:Math.max(0,Math.min(O().length-1,i.sel+e))}:i.at==="picker"?{...i,sel:Math.max(0,Math.min(i.items.length-1,i.sel+e))}:i})},onSelect:()=>{let e=s.current;if(e.at==="card"){let i=v[e.idx],m=G(i);if(m!==null&&e.sel===m){d({...e,editor:"",editorIntent:"steer"});return}let f=N(i)[e.sel];if(f?.v==="archive"&&i.kind==="REVIEW"){d({...e,editor:"",editorIntent:"because"});return}f&&L(e.idx,{v:f.v});return}if(e.at==="done-panel"){let i=O()[e.sel];i?.key==="finish"?$():i?.key==="evolve"?H():i?.key==="view"&&d({at:"view"});return}if(e.at==="picker"){let i=e.items[e.sel];i&&d({at:"why",item:i,text:""});return}},onDigit:e=>{let i=s.current;if(i.at==="card"){let m=v[i.idx],f=N(m)[e-1];if(f?.v==="archive"&&m.kind==="REVIEW"){d({...i,editor:"",editorIntent:"because"});return}f&&L(i.idx,{v:f.v});return}i.at==="done-panel"&&e-1<O().length&&d({...i,sel:e-1}),i.at==="picker"&&e-1<i.items.length&&d({...i,sel:e-1})},onType:e=>{d(i=>i.at!=="card"||G(v[i.idx])===null?i:{...i,editor:(i.editor??"")+e,editorIntent:i.editorIntent??"steer"})},isMulti:()=>!1,onSpace:()=>{},onBack:()=>{let e=s.current;(e.at==="picker"||e.at==="view")&&d({at:"done-panel",sel:0})}}),[v]);(0,R.useEffect)(()=>{a.at==="done"&&$()},[a.at]);let Ce=e=>Math.floor((Date.now()-e)/1e3),z=y?.current??null,$e=a.at==="card"?{kind:"card",n:a.idx+1,m:v.length}:a.at==="busy"?z?{kind:"child-working",step:re(a.label)}:{kind:"working",step:re(a.label),elapsedS:Ce(a.startedAt)}:a.at==="evolving"?{kind:"child-working",step:`evolving ${a.title}`}:{kind:"idle"},Re=a.at==="card"||a.at==="busy"?v.length-a.idx:0,Ee=a.at==="done-panel"||a.at==="picker"||a.at==="why"||a.at==="view",De=[...a.at==="card"?a.editor!==null?["\u23CE submit","esc back"]:fe(v[a.idx]).keys:a.at==="done-panel"?me(O(),{escBack:!1}).keys:a.at==="picker"?["\u2191\u2193 select","\u23CE confirm","esc back"]:a.at==="why"?["\u23CE submit","esc back"]:a.at==="view"?["esc back"]:[],"ctrl+c exit"],J=u??{verb:"reconcile",sid:"",env:""},Se=`view \xB7 this run's changes \xB7 ${b.current.length}`;return(0,p.jsxs)(F,{flexDirection:"column",children:[(0,p.jsx)(le,{onToggleThinking:()=>{},onCtrlC:()=>{n(),I()},panel:xe}),a.at==="card"&&V?(0,p.jsx)(de,{card:V,position:{n:a.idx+1,of:v.length},sel:a.sel,focused:a.editor===null,editorIntent:a.editorIntent??"steer",freeText:a.editor!==null?{value:a.editor,onChange:e=>d(i=>i.at==="card"?{...i,editor:e}:i),onSubmit:e=>{let i=s.current;if(i.at!=="card")return;let m=e.trim();if(!m){d({...i,editor:null,editorIntent:void 0});return}let f=v[i.idx];i.editorIntent==="because"?L(i.idx,{v:"archive",because:m}):f.kind==="PAIR"?L(i.idx,{v:"defer",note:m}):L(i.idx,{v:"approve",steering:m})},onCancel:()=>d(e=>e.at==="card"?{...e,editor:null,editorIntent:void 0}:e)}:null}):null,a.at==="done-panel"?(0,p.jsx)(Q,{headline:(()=>{let e=t.summary();return`reconcile done \u2014 ${e.applied+e.committed} applied \xB7 ${e.retired} retired \xB7 ${e.skipped} skipped \xB7 ${e.deferred} deferred${e.failed>0?` \xB7 ${e.failed} failed`:""}`})(),rows:O(),sel:a.sel,focused:!0}):null,a.at==="picker"?(0,p.jsx)(Q,{ask:!0,headline:"evolve which use-case?",rows:a.items.map(e=>({key:e.key,label:e.title,detail:e.badge})),sel:a.sel,focused:!0}):null,a.at==="why"?(0,p.jsxs)(F,{flexDirection:"column",borderStyle:"round",borderColor:h.assuranceAccent,paddingX:1,children:[(0,p.jsxs)(F,{children:[(0,p.jsxs)(x,{children:[(0,p.jsx)(x,{color:h.assuranceAccent,children:"\u25B8"})," ",(0,p.jsx)(x,{color:h.dim,children:"\u270E "})]}),(0,p.jsx)(se,{value:a.text,onChange:e=>d(i=>i.at==="why"?{...i,text:e}:i),onSubmit:e=>{let i=s.current;i.at==="why"&&(e.trim()?ye(i.item,e.trim()):d({at:"picker",items:[i.item],sel:0}))},onCancel:()=>{s.current.at==="why"&&H()},placeholder:`what should change about ${a.item.title}?`})]}),(0,p.jsx)(x,{color:h.muted,children:" \u23CE submit \xB7 esc back"})]}):null,a.at==="view"?(0,p.jsxs)(F,{marginTop:1,marginBottom:1,flexDirection:"column",children:[(0,p.jsx)(x,{bold:!0,color:h.assuranceAccent,children:Se}),(0,p.jsx)(x,{children:" "}),b.current.map((e,i)=>(0,p.jsx)(q,{mark:e.mark,markColor:e.color==="green"?h.green:e.color==="red"?h.red:h.dim,color:e.color==="dim"?h.dim:void 0,indent:0,reserve:0,children:e.line},`vc-${i}`))]}):null,(0,p.jsx)(ce,{status:$e,meta:{...J,...S??J.subject?{subject:S??J.subject}:{}},tallies:ue(t.summary(),Re),keys:De,child:a.at==="evolving"?{verb:"evolve"}:z?{verb:z.verb}:void 0})]})}async function at(t){let v={current:null},k=o=>{v.current?.append(o)},A=null,M=async(o,c)=>{let[{runDesign:E},{resolveAgentAuthEnv:C},{runAgent:$},{preflightTurn:T}]=await Promise.all([import("./run-DN4XARP2.js"),import("./spawner-LNMD4NJF.js"),import("./bridge-X5DEJL6F.js"),import("./turn-preflight-JGYT7LXP.js")]);A??=await C();let W=A;return E({useCase:o,force:!0,mode:c.mode??"override",...c.because?{because:c.because}:{},...c.changeDelta!==void 0?{changeDelta:c.changeDelta}:{},...c.priorDesign!==void 0?{priorDesign:c.priorDesign}:{}},{contextDir:t.dir,agent:$,preflightTurn:()=>T(W),ask:async()=>[],out:()=>{},progress:()=>{},isTTY:!1,auth:W})},P=t.runDesign??M,S={current:null},u="",w=o=>{if(o.kind==="start")S.current={verb:o.verb},u=o.subject,k((0,p.jsxs)(x,{color:h.assuranceAccent,children:[`\u25CF ${te(o.verb).ing} ${Y(o.subject)}`,o.note?(0,p.jsx)(x,{color:h.dim,children:` ${o.note}`}):null]}));else if(o.kind==="end"){let c=S.current?.verb??"design";S.current=null,k(o.ok?(0,p.jsx)(x,{color:h.green,children:`\u25CF ${te(c).ed} ${Y(u)} \u2014 ${o.durS}s`}):(0,p.jsx)(x,{color:h.red,children:`\u25CF ${c} failed \u2014 ${o.exitCode!=null?`exited ${o.exitCode}`:"error"}${o.fixCmd?` \xB7 ${o.fixCmd}`:""}`}))}},y=ke({contextDir:t.dir,held:t.held,archive:t.archive,planRows:t.rows,runDesign:P,mode:"interactive",signals:t.signals,onChild:w,reviewFeeder:()=>{try{return he({contextDir:t.dir},_(t.dir))}catch{return[]}}}),r=new Set(t.rows.filter(o=>o.applied!==void 0).map(o=>o.held_ref??o.ref)),n=y.cards().filter(o=>!r.has(o.ref)&&!(o.kind==="ARCHIVE"&&t.archiveState?.[o.ref]!==void 0)),l=o=>t.rows.findIndex(c=>(c.held_ref??c.ref)===o),a=(o,c)=>{try{if(n.find($=>$.ref===o)?.kind==="ARCHIVE"){c==="retired"?t.markA?.(o,"retired"):c==="skipped"&&t.markA?.(o,"skipped");return}let C=l(o);if(C<0)return;c==="applied"||c==="committed"?t.mark?.(C,"approved"):c==="skipped"&&t.mark?.(C,"skipped")}catch{}},d=async o=>{let[{openGraph:c},{resolveParentUc:E,evolveOneUc:C}]=await Promise.all([import("./readmodel-IBFRM6EO.js"),import("./evolve-cmd-27ZQN6YB.js")]),[$,...T]=o.split(/\s+/),W=c(t.dir),I=E(W,$);if(!I.ok)return`couldn't resolve '${$}' \u2014 start with a use-case id (uc-\u2026): ${I.message}`;if(T.length===0)return`say what to change: \`${$} <your words>\` \u2014 the words become the redesign's change delta`;let V=T.join(" "),O={out:()=>{},err:()=>{},isTTY:!1,confirm:async()=>!0},H=await C(t.dir,I.target,{yes:!0,mode:"override",because:V},O,P,"batch");return H.outcome==="evolved"?(t.signals({ref:I.target.display,verdict:"gap-resolved-evolve",reason:V}),`\u2713 redesigned ${I.target.display} \u2014 "${V}"`):`\u2717 evolve ${H.outcome} for ${I.target.display} (exit ${H.code})`},D=t.listEvolveTargets??(()=>{let o=_(t.dir);return pe(o).targets.map(c=>({key:c.display,title:c.display,badge:"stale"}))});if(t.script){let o=0;for(let c of n){let E=await t.script(c),C=await y.submit(c.ref,E);C.outcome==="failed"&&o===0&&(o=1),a(c.ref,be(C))}return o}let[{render:s},{ScrollbackProvider:b},{ScrollbackTap:g}]=await Promise.all([import("./build-JIKYOZUH.js"),import("./scrollback-JLPJR25X.js"),import("./ScrollbackTap-QHJOFYMC.js")]);return new Promise(o=>{let c=!1,E=(V,O)=>{c||(c=!0,(async()=>{process.removeListener("SIGINT",W),await v.current?.flush();try{I.unmount()}catch{}O&&Z(O),o(V)})())},C=0,$={current:null},T=()=>{if(C+=1,C>=2){if(c)return;c=!0,process.removeListener("SIGINT",W);try{I.unmount()}catch{}Z({state:"interrupted",reason:"ctrl+c \xD72",facts:["forced quit \u2014 every committed verdict is safe in the store"]}),o(130)}},W=()=>{T(),$.current?.()};process.on("SIGINT",W);let I=s((0,p.jsxs)(b,{children:[(0,p.jsx)(g,{into:v}),(0,p.jsx)(Pe,{controller:y,cards:n,note:k,markOutcome:a,routeChat:d,listEvolveTargets:D,barSubject:t.barSubject,meta:t.meta,resumeCmd:t.resumeCmd,activeChild:S,onFinish:E,onCtrlC:T,pauseRef:$})]}),{exitOnCtrlC:!1})})}export{Pe as WalkSessionSurface,be as outcomeToMark,at as runWalkSession};
|
|
2
|
+
import{a as ve}from"./chunk-TU6IMGWO.js";import{c as he}from"./chunk-FFVNISYH.js";import{a as Z}from"./chunk-A2SQD2AY.js";import{k as ge}from"./chunk-3AVBUEBL.js";import{a as ie,c as ne,d as pe}from"./chunk-RCYYE6ED.js";import"./chunk-O3XBIURC.js";import{a as re,b as ce,c as le,d as N,f as G,g as de,i as ue,k as me,l as fe}from"./chunk-CR7UWQ76.js";import{a as ee,b as te}from"./chunk-UJZZDPDY.js";import"./chunk-RKXHVP2Z.js";import{a as Y}from"./chunk-TCAHDVII.js";import"./chunk-YYYQ5MVD.js";import"./chunk-BZAGVBCX.js";import"./chunk-CRZUBDJ3.js";import"./chunk-JUJ4SAGH.js";import"./chunk-ALCE5RLK.js";import"./chunk-E44OHYDS.js";import{b as Q}from"./chunk-MZYPDLD3.js";import"./chunk-H6TNBKGR.js";import"./chunk-66MOZKD2.js";import"./chunk-YLQHY4A7.js";import"./chunk-YMLC55J4.js";import"./chunk-SWTJMTBY.js";import"./chunk-IE3OO5GI.js";import"./chunk-CH273NAE.js";import"./chunk-CAOZKSQ3.js";import"./chunk-VZ7KXRXB.js";import"./chunk-5Y2G4NC7.js";import"./chunk-5LJRZI7S.js";import"./chunk-BKM2LWU2.js";import{C as _}from"./chunk-GP7WD4UY.js";import"./chunk-JQW2QFSX.js";import"./chunk-3N6IAVD5.js";import"./chunk-FQNQVC5O.js";import"./chunk-AKX4VRRR.js";import"./chunk-UD7KKHPW.js";import{a as se}from"./chunk-YCCUBQY4.js";import"./chunk-RSSOJ3L2.js";import"./chunk-5EOX4MEY.js";import"./chunk-RZ4F3BHX.js";import"./chunk-EYOCNMUM.js";import{y as h}from"./chunk-F2XTOZTN.js";import"./chunk-DFS4RMVP.js";import{a as K}from"./chunk-HCBYKLMW.js";import{a as F,b as x,k as ae}from"./chunk-C44QQJR4.js";import{a as Ie}from"./chunk-6YGTRKDT.js";import{e as U}from"./chunk-UR6MHSHU.js";var R=U(Ie(),1);function ke(t){let v=t.by??{kind:"human",id:process.env.USER??"operator"},k=t.mode==="interactive"?"override":t.mode,A=k==="override"?{note:"override \xB7 auto-answers, won't ask"}:{},M=(r,n)=>ee(t.onChild,{verb:"design",subject:r,...A,fixCmd:`kane-cli design tests --use-case ${r}`},n,l=>({ok:l===0,exitCode:l})),P=(r,n,l)=>ee(t.onChild,{verb:"evolve",subject:r,...A,fixCmd:`kane-cli maintain evolve ${n}`},l,a=>({ok:a.outcome==="evolved",exitCode:a.code})),S={out:()=>{},err:()=>{},isTTY:!1,confirm:async()=>!0},u={applied:0,committed:0,retired:0,skipped:0,deferred:0,failed:0},w=new Map;for(let r of t.planRows)if(r.held_ref&&t.held){let n=t.held.rows.find(a=>a.temp_ref===r.held_ref);if(!n)continue;let l={kind:n.kind,ref:n.temp_ref,title:n.title,why:n.why,origin:"content-change",...r.impact?{impact:r.impact}:{}};w.set(l.ref,{card:l,source:"held",heldRef:n.temp_ref})}else if(r.kind==="MODIFY"){let n={kind:"MODIFY",ref:r.ref,title:r.ref,why:`${r.reason}: ${r.provenance}`,origin:r.origin??"structural-stale",...r.impact?{impact:r.impact}:{}};w.set(n.ref,{card:n,source:"row",row:r})}else if(r.kind==="ADD"){let n={kind:"ADD",ref:r.ref,title:r.ref,why:r.reason,origin:r.origin??"content-change"};w.set(n.ref,{card:n,source:"row",row:r})}for(let r of t.archive){if(r.kind!=="ARCHIVE")continue;let n={kind:"ARCHIVE",ref:r.ref,title:r.ref,why:r.why,provenance:r.why,...r.impact?{impact:r.impact}:{}};w.set(n.ref,{card:n,source:"archive",row:r})}for(let r of t.reviewFeeder?.()??[]){if(w.has(r.ref))continue;let n={kind:r.kind==="MODIFY_HELD"?"MODIFY":r.kind,ref:r.ref,title:r.title,why:r.why,...r.impact?{impact:r.impact}:{},...r.pair?{pair:r.pair}:{},...r.held?{held:!0}:{},...r.kind==="MODIFY_HELD"?{heldPayload:!0}:{}};w.set(n.ref,{card:n,source:"review",reviewCard:r})}let y=r=>(u.failed++,{outcome:"failed",detail:r});return{cards:()=>[...w.values()].map(r=>r.card),async submit(r,n){let l=w.get(r);if(!l)return y(`no card ${r}`);if(l.source==="review"){if(l.reviewCard.kind==="PAIR"&&n.v==="approve")return y(`${r} is a PAIR card \u2014 approve is not in its grammar (merge / keep both / defer); words ride a defer note`);let{submitReview:s}=await import("./verdicts-ZXXBKTOZ.js"),b=n.v==="approve"?{v:"approve"}:n.v==="archive"?{v:"archive",because:n.because??""}:n.v==="skip"&&l.reviewCard.kind==="MODIFY_HELD"?{v:"keep_current"}:n.v==="defer"||n.v==="skip"?{v:"defer"}:n.v==="merge"?{v:"merge"}:{v:"keep_both"},g=await s({contextDir:t.contextDir,signals:o=>t.signals({ref:o.ref,verdict:o.verdict,...o.reason?{reason:o.reason}:{}})},l.reviewCard,b,v);return g.outcome==="failed"?(u.failed++,g):g.outcome==="deferred"?(u.deferred++,n.v==="defer"&&n.note?(t.signals({ref:r,verdict:"deferred-with-note",reason:n.note}),{...g,detail:`steering noted: "${n.note}" \u2014 decide ${l.reviewCard.kind==="PAIR"?"merge / keep both":"the verdict"} when it re-offers`}):g):g.outcome==="retired"?(u.retired++,g):g.outcome==="committed"?(u.committed++,g):(u.applied++,g)}if(n.v==="merge"||n.v==="keep_both")return y(`${r} is a ${l.card.kind} card \u2014 ${n.v} applies to review cards only`);if(n.v==="skip")return u.skipped++,t.signals({ref:r,verdict:"gap-dismissed"}),{outcome:"skipped"};if(n.v==="defer")return u.deferred++,n.note?(t.signals({ref:r,verdict:"deferred-with-note",reason:n.note}),{outcome:"deferred",detail:`steering noted: "${n.note}"`}):{outcome:"deferred"};if(n.v==="archive"){if(l.source!=="archive")return y(`${r} is not an ARCHIVE card`);let s=_(t.contextDir),b=s.resolve(l.row.ref);if(b&&s.superseded.has(s.tipOf(b.cid)))return u.skipped++,{outcome:"skipped",detail:"already retired \u2014 nothing to do"};let g=ve(t.contextDir,_(t.contextDir),{ref:l.row.ref,reason:`reconcile retire: ${l.row.why}`,by:v});return g.errors?y(g.errors.map(o=>`${o.code}: ${o.detail}`).join("; ")):(u.retired++,t.signals({ref:r,verdict:"gap-resolved-archive",reason:l.row.why}),{outcome:"retired"})}if(l.source==="archive")return y(`${r} takes archive/skip/defer, not approve`);if(l.source==="held"){let s=ge(t.contextDir,t.held,l.heldRef,v,n.edits);if(!s.ok)return y(s.message);if(s.kind==="ADD"){let b=await M(s.ref,()=>t.runDesign(s.ref,{yes:!0,mode:k,...n.steering?{because:n.steering}:{}}));return b!==0?(u.failed++,{outcome:"failed",landed:!0,detail:`committed ${s.ref}, but its design run exited ${b} \u2014 finish with kane-cli design tests --use-case ${s.ref}`}):(u.applied++,t.signals({ref:r,verdict:"gap-resolved-create",...n.steering?{reason:n.steering}:{}}),{outcome:"applied",detail:s.ref})}if(n.steering){let b=_(t.contextDir),g=ie(b,s.ref);if(!g.ok)return u.committed++,{outcome:"committed",detail:`committed ${s.ref}, but steering could not resolve it (${g.message}) \u2014 steer via kane-cli maintain evolve ${s.ref}`};let o=await P(g.target.display,s.ref,()=>ne(t.contextDir,g.target,{yes:!0,mode:k,because:n.steering},S,t.runDesign,"batch"));if(o.outcome==="no-design"){let c=await M(g.target.seamRef,()=>t.runDesign(g.target.seamRef,{yes:!0,mode:k,because:n.steering}));return c!==0?(u.failed++,{outcome:"failed",landed:!0,detail:`committed ${s.ref}, but its steered design run exited ${c} \u2014 finish with kane-cli design tests --use-case ${g.target.seamRef}`}):(u.applied++,t.signals({ref:r,verdict:"gap-resolved-create",reason:n.steering}),{outcome:"applied",detail:s.ref})}return o.outcome==="failed"||o.outcome==="paused"?(u.failed++,{outcome:"failed",landed:!0,detail:`committed ${s.ref}, but the steering evolve ${o.outcome} (exit ${o.code}) \u2014 finish with kane-cli maintain evolve ${s.ref}`}):o.outcome==="declined"?(u.committed++,{outcome:"committed",detail:`committed ${s.ref} \u2014 the steering evolve was declined; re-run kane-cli maintain evolve ${s.ref}`}):(u.applied++,t.signals({ref:r,verdict:"gap-resolved-evolve",reason:n.steering}),{outcome:"applied",detail:s.ref})}return u.committed++,t.signals({ref:r,verdict:"gap-resolved-evolve"}),{outcome:"committed",detail:s.ref}}let a=_(t.contextDir),d=ie(a,l.row.ref);if(!d.ok)return y(d.message);if(l.card.kind==="ADD"){let s=await M(d.target.seamRef,()=>t.runDesign(d.target.seamRef,{yes:!0,mode:k}));return s!==0?y(`design run exited ${s}`):(u.applied++,t.signals({ref:r,verdict:"gap-resolved-create"}),{outcome:"applied"})}let D=await P(d.target.display,l.row.ref,()=>ne(t.contextDir,d.target,{yes:!0,mode:k,...n.steering?{because:n.steering}:{}},S,t.runDesign,"batch"));return D.outcome==="evolved"?(u.applied++,t.signals({ref:r,verdict:"gap-resolved-evolve",...n.steering?{reason:n.steering}:{}}),{outcome:"applied"}):D.outcome==="failed"||D.outcome==="paused"?y(`evolve ${D.outcome} (exit ${D.code})`):(u.skipped++,{outcome:"skipped",detail:D.outcome})},summary:()=>({...u})}}var j=U(K(),1);function q({mark:t,markColor:v,color:k,indent:A=2,reserve:M=0,children:P}){let{stdout:S}=ae(),u=(S?.columns??80)-M,w=A+t.length+1;return(0,j.jsxs)(F,{children:[(0,j.jsx)(F,{width:w,flexShrink:0,children:(0,j.jsx)(x,{color:v,children:`${" ".repeat(A)}${t}`})}),(0,j.jsx)(F,{width:Math.max(20,u-w),children:(0,j.jsx)(x,{color:k,children:P})})]})}var p=U(K(),1);function be(t){return t.landed?"committed":t.outcome}var We={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"}};function Ae(t){return t.v==="archive"?"Retiring\u2026":t.v==="approve"&&t.steering?"Approving with your changes \u2014 committing, then re-designing\u2026":"Applying \u2014 committing\u2026"}function Pe({controller:t,cards:v,note:k,markOutcome:A,routeChat:M,listEvolveTargets:P,barSubject:S,meta:u,resumeCmd:w,activeChild:y,onFinish:r,onCtrlC:n,pauseRef:l}){let[a,d]=(0,R.useState)(v.length>0?{at:"card",idx:0,sel:0,editor:null}:{at:"done-panel",sel:0}),D=(0,R.useRef)(0),s=(0,R.useRef)(a);s.current=a;let b=(0,R.useRef)([]),[,g]=(0,R.useState)(0),o=a.at==="busy"||a.at==="evolving";(0,R.useEffect)(()=>{if(!o)return;let e=setInterval(()=>g(i=>i+1),120);return()=>clearInterval(e)},[o]);let c=()=>{let e=t.summary();return`${e.applied+e.committed} applied \xB7 ${e.retired} retired \xB7 ${e.skipped} skipped \xB7 ${e.deferred} deferred`+(e.failed>0?` \xB7 ${e.failed} failed`:"")},E=()=>({state:"complete",facts:[c()]}),C=()=>({state:"walk-paused",reason:"ctrl+c",facts:[c(),"every verdict so far is committed \u2014 re-run the same reconcile command to continue"],...w?{resume:w}:{}}),$=()=>r(D.current,E()),T=(0,R.useRef)(!1),W=()=>{r(3,C())},I=()=>{if(T.current)return;T.current=!0;let e=s.current;if(e.at==="busy"||e.at==="evolving"){k((0,p.jsx)(x,{color:h.dim,children:"finishing the current item, then pausing\u2026"}));return}if(e.at==="done-panel"||e.at==="picker"||e.at==="why"||e.at==="view"){$();return}W()};l&&(l.current=I);let V=a.at==="card"||a.at==="busy"?v[a.idx]:null,O=()=>[{key:"finish",label:"finish"},...P?[{key:"evolve",label:"evolve another use-case\u2026"}]:[],...b.current.length>0?[{key:"view",label:"view what changed"}]:[]],H=()=>{let e=P?.()??[];if(e.length===0){k((0,p.jsx)(x,{color:h.dim,children:"nothing is stale \u2014 no evolve targets right now"})),d({at:"done-panel",sel:0});return}d({at:"picker",items:e,sel:0})},we=e=>{let i=e+1;i<v.length?d({at:"card",idx:i,sel:0,editor:null}):d({at:"done-panel",sel:0})},X=(0,R.useRef)(!1),L=(e,i)=>{if(X.current)return;X.current=!0;let m=v[e];d({at:"busy",idx:e,label:Ae(i),startedAt:Date.now()}),t.submit(m.ref,i).catch(f=>({outcome:"failed",detail:f instanceof Error?f.message:String(f)})).then(f=>{let B=We[f.outcome]??{mark:"\xB7",color:"dim"},Te=f.outcome!=="failed"&&f.outcome!=="skipped"&&f.outcome!=="deferred"&&m.impact&&"stale_refs"in m.impact&&m.impact.stale_refs.length>0?` \xB7 ${m.impact.stale_refs.length} item(s) now stale`:"",oe=`${f.outcome} [${m.kind}] ${Y(m.title)}${f.detail?` \u2014 ${Y(f.detail)}`:""}${Te}`;if(b.current.push({mark:B.mark,color:B.color,line:oe}),k((0,p.jsx)(q,{mark:B.mark,markColor:B.color==="green"?h.green:B.color==="red"?h.red:h.dim,color:B.color==="dim"?h.dim:void 0,children:oe})),f.outcome==="failed"&&(D.current=D.current===0?1:D.current),A(m.ref,be(f)),X.current=!1,T.current){W();return}we(e)})},ye=(e,i)=>{d({at:"evolving",title:e.title,startedAt:Date.now()}),M(`${e.key} ${i}`).catch(m=>`\u2717 evolve failed: ${m instanceof Error?m.message:String(m)}`).then(m=>{let f=m.startsWith("\u2713");if(b.current.push({mark:f?"\u2714":"\u2717",color:f?"green":"red",line:m.replace(/^[✓✗]\s*/,"")}),k((0,p.jsx)(q,{mark:f?"\u2714":"\u2717",markColor:f?h.green:h.red,children:m.replace(/^[✓✗]\s*/,"")})),T.current){$();return}d({at:"done-panel",sel:0})})},xe=(0,R.useMemo)(()=>({isFocused:()=>{let e=s.current;return e.at==="card"&&e.editor===null||e.at==="done-panel"||e.at==="picker"||e.at==="view"},onMove:e=>{d(i=>{if(i.at==="card"){let m=v[i.idx],f=G(m)??N(m).length-1;return{...i,sel:Math.max(0,Math.min(f,i.sel+e))}}return i.at==="done-panel"?{...i,sel:Math.max(0,Math.min(O().length-1,i.sel+e))}:i.at==="picker"?{...i,sel:Math.max(0,Math.min(i.items.length-1,i.sel+e))}:i})},onSelect:()=>{let e=s.current;if(e.at==="card"){let i=v[e.idx],m=G(i);if(m!==null&&e.sel===m){d({...e,editor:"",editorIntent:"steer"});return}let f=N(i)[e.sel];if(f?.v==="archive"&&i.kind==="REVIEW"){d({...e,editor:"",editorIntent:"because"});return}f&&L(e.idx,{v:f.v});return}if(e.at==="done-panel"){let i=O()[e.sel];i?.key==="finish"?$():i?.key==="evolve"?H():i?.key==="view"&&d({at:"view"});return}if(e.at==="picker"){let i=e.items[e.sel];i&&d({at:"why",item:i,text:""});return}},onDigit:e=>{let i=s.current;if(i.at==="card"){let m=v[i.idx],f=N(m)[e-1];if(f?.v==="archive"&&m.kind==="REVIEW"){d({...i,editor:"",editorIntent:"because"});return}f&&L(i.idx,{v:f.v});return}i.at==="done-panel"&&e-1<O().length&&d({...i,sel:e-1}),i.at==="picker"&&e-1<i.items.length&&d({...i,sel:e-1})},onType:e=>{d(i=>i.at!=="card"||G(v[i.idx])===null?i:{...i,editor:(i.editor??"")+e,editorIntent:i.editorIntent??"steer"})},isMulti:()=>!1,onSpace:()=>{},onBack:()=>{let e=s.current;(e.at==="picker"||e.at==="view")&&d({at:"done-panel",sel:0})}}),[v]);(0,R.useEffect)(()=>{a.at==="done"&&$()},[a.at]);let Ce=e=>Math.floor((Date.now()-e)/1e3),z=y?.current??null,$e=a.at==="card"?{kind:"card",n:a.idx+1,m:v.length}:a.at==="busy"?z?{kind:"child-working",step:re(a.label)}:{kind:"working",step:re(a.label),elapsedS:Ce(a.startedAt)}:a.at==="evolving"?{kind:"child-working",step:`evolving ${a.title}`}:{kind:"idle"},Re=a.at==="card"||a.at==="busy"?v.length-a.idx:0,Ee=a.at==="done-panel"||a.at==="picker"||a.at==="why"||a.at==="view",De=[...a.at==="card"?a.editor!==null?["\u23CE submit","esc back"]:fe(v[a.idx]).keys:a.at==="done-panel"?me(O(),{escBack:!1}).keys:a.at==="picker"?["\u2191\u2193 select","\u23CE confirm","esc back"]:a.at==="why"?["\u23CE submit","esc back"]:a.at==="view"?["esc back"]:[],"ctrl+c exit"],J=u??{verb:"reconcile",sid:"",env:""},Se=`view \xB7 this run's changes \xB7 ${b.current.length}`;return(0,p.jsxs)(F,{flexDirection:"column",children:[(0,p.jsx)(le,{onToggleThinking:()=>{},onCtrlC:()=>{n(),I()},panel:xe}),a.at==="card"&&V?(0,p.jsx)(de,{card:V,position:{n:a.idx+1,of:v.length},sel:a.sel,focused:a.editor===null,editorIntent:a.editorIntent??"steer",freeText:a.editor!==null?{value:a.editor,onChange:e=>d(i=>i.at==="card"?{...i,editor:e}:i),onSubmit:e=>{let i=s.current;if(i.at!=="card")return;let m=e.trim();if(!m){d({...i,editor:null,editorIntent:void 0});return}let f=v[i.idx];i.editorIntent==="because"?L(i.idx,{v:"archive",because:m}):f.kind==="PAIR"?L(i.idx,{v:"defer",note:m}):L(i.idx,{v:"approve",steering:m})},onCancel:()=>d(e=>e.at==="card"?{...e,editor:null,editorIntent:void 0}:e)}:null}):null,a.at==="done-panel"?(0,p.jsx)(Q,{headline:(()=>{let e=t.summary();return`reconcile done \u2014 ${e.applied+e.committed} applied \xB7 ${e.retired} retired \xB7 ${e.skipped} skipped \xB7 ${e.deferred} deferred${e.failed>0?` \xB7 ${e.failed} failed`:""}`})(),rows:O(),sel:a.sel,focused:!0}):null,a.at==="picker"?(0,p.jsx)(Q,{ask:!0,headline:"evolve which use-case?",rows:a.items.map(e=>({key:e.key,label:e.title,detail:e.badge})),sel:a.sel,focused:!0}):null,a.at==="why"?(0,p.jsxs)(F,{flexDirection:"column",borderStyle:"round",borderColor:h.assuranceAccent,paddingX:1,children:[(0,p.jsxs)(F,{children:[(0,p.jsxs)(x,{children:[(0,p.jsx)(x,{color:h.assuranceAccent,children:"\u25B8"})," ",(0,p.jsx)(x,{color:h.dim,children:"\u270E "})]}),(0,p.jsx)(se,{value:a.text,onChange:e=>d(i=>i.at==="why"?{...i,text:e}:i),onSubmit:e=>{let i=s.current;i.at==="why"&&(e.trim()?ye(i.item,e.trim()):d({at:"picker",items:[i.item],sel:0}))},onCancel:()=>{s.current.at==="why"&&H()},placeholder:`what should change about ${a.item.title}?`})]}),(0,p.jsx)(x,{color:h.muted,children:" \u23CE submit \xB7 esc back"})]}):null,a.at==="view"?(0,p.jsxs)(F,{marginTop:1,marginBottom:1,flexDirection:"column",children:[(0,p.jsx)(x,{bold:!0,color:h.assuranceAccent,children:Se}),(0,p.jsx)(x,{children:" "}),b.current.map((e,i)=>(0,p.jsx)(q,{mark:e.mark,markColor:e.color==="green"?h.green:e.color==="red"?h.red:h.dim,color:e.color==="dim"?h.dim:void 0,indent:0,reserve:0,children:e.line},`vc-${i}`))]}):null,(0,p.jsx)(ce,{status:$e,meta:{...J,...S??J.subject?{subject:S??J.subject}:{}},tallies:ue(t.summary(),Re),keys:De,child:a.at==="evolving"?{verb:"evolve"}:z?{verb:z.verb}:void 0})]})}async function at(t){let v={current:null},k=o=>{v.current?.append(o)},A=null,M=async(o,c)=>{let[{runDesign:E},{resolveAgentAuthEnv:C},{runAgent:$},{preflightTurn:T}]=await Promise.all([import("./run-MUVZVTTC.js"),import("./spawner-H6IDWY5U.js"),import("./bridge-E2NGMJYM.js"),import("./turn-preflight-JGYT7LXP.js")]);A??=await C();let W=A;return E({useCase:o,force:!0,mode:c.mode??"override",...c.because?{because:c.because}:{},...c.changeDelta!==void 0?{changeDelta:c.changeDelta}:{},...c.priorDesign!==void 0?{priorDesign:c.priorDesign}:{}},{contextDir:t.dir,agent:$,preflightTurn:()=>T(W),ask:async()=>[],out:()=>{},progress:()=>{},isTTY:!1,auth:W})},P=t.runDesign??M,S={current:null},u="",w=o=>{if(o.kind==="start")S.current={verb:o.verb},u=o.subject,k((0,p.jsxs)(x,{color:h.assuranceAccent,children:[`\u25CF ${te(o.verb).ing} ${Y(o.subject)}`,o.note?(0,p.jsx)(x,{color:h.dim,children:` ${o.note}`}):null]}));else if(o.kind==="end"){let c=S.current?.verb??"design";S.current=null,k(o.ok?(0,p.jsx)(x,{color:h.green,children:`\u25CF ${te(c).ed} ${Y(u)} \u2014 ${o.durS}s`}):(0,p.jsx)(x,{color:h.red,children:`\u25CF ${c} failed \u2014 ${o.exitCode!=null?`exited ${o.exitCode}`:"error"}${o.fixCmd?` \xB7 ${o.fixCmd}`:""}`}))}},y=ke({contextDir:t.dir,held:t.held,archive:t.archive,planRows:t.rows,runDesign:P,mode:"interactive",signals:t.signals,onChild:w,reviewFeeder:()=>{try{return he({contextDir:t.dir},_(t.dir))}catch{return[]}}}),r=new Set(t.rows.filter(o=>o.applied!==void 0).map(o=>o.held_ref??o.ref)),n=y.cards().filter(o=>!r.has(o.ref)&&!(o.kind==="ARCHIVE"&&t.archiveState?.[o.ref]!==void 0)),l=o=>t.rows.findIndex(c=>(c.held_ref??c.ref)===o),a=(o,c)=>{try{if(n.find($=>$.ref===o)?.kind==="ARCHIVE"){c==="retired"?t.markA?.(o,"retired"):c==="skipped"&&t.markA?.(o,"skipped");return}let C=l(o);if(C<0)return;c==="applied"||c==="committed"?t.mark?.(C,"approved"):c==="skipped"&&t.mark?.(C,"skipped")}catch{}},d=async o=>{let[{openGraph:c},{resolveParentUc:E,evolveOneUc:C}]=await Promise.all([import("./readmodel-IBFRM6EO.js"),import("./evolve-cmd-CEYGGIWA.js")]),[$,...T]=o.split(/\s+/),W=c(t.dir),I=E(W,$);if(!I.ok)return`couldn't resolve '${$}' \u2014 start with a use-case id (uc-\u2026): ${I.message}`;if(T.length===0)return`say what to change: \`${$} <your words>\` \u2014 the words become the redesign's change delta`;let V=T.join(" "),O={out:()=>{},err:()=>{},isTTY:!1,confirm:async()=>!0},H=await C(t.dir,I.target,{yes:!0,mode:"override",because:V},O,P,"batch");return H.outcome==="evolved"?(t.signals({ref:I.target.display,verdict:"gap-resolved-evolve",reason:V}),`\u2713 redesigned ${I.target.display} \u2014 "${V}"`):`\u2717 evolve ${H.outcome} for ${I.target.display} (exit ${H.code})`},D=t.listEvolveTargets??(()=>{let o=_(t.dir);return pe(o).targets.map(c=>({key:c.display,title:c.display,badge:"stale"}))});if(t.script){let o=0;for(let c of n){let E=await t.script(c),C=await y.submit(c.ref,E);C.outcome==="failed"&&o===0&&(o=1),a(c.ref,be(C))}return o}let[{render:s},{ScrollbackProvider:b},{ScrollbackTap:g}]=await Promise.all([import("./build-JIKYOZUH.js"),import("./scrollback-JLPJR25X.js"),import("./ScrollbackTap-QHJOFYMC.js")]);return new Promise(o=>{let c=!1,E=(V,O)=>{c||(c=!0,(async()=>{process.removeListener("SIGINT",W),await v.current?.flush();try{I.unmount()}catch{}O&&Z(O),o(V)})())},C=0,$={current:null},T=()=>{if(C+=1,C>=2){if(c)return;c=!0,process.removeListener("SIGINT",W);try{I.unmount()}catch{}Z({state:"interrupted",reason:"ctrl+c \xD72",facts:["forced quit \u2014 every committed verdict is safe in the store"]}),o(130)}},W=()=>{T(),$.current?.()};process.on("SIGINT",W);let I=s((0,p.jsxs)(b,{children:[(0,p.jsx)(g,{into:v}),(0,p.jsx)(Pe,{controller:y,cards:n,note:k,markOutcome:a,routeChat:d,listEvolveTargets:D,barSubject:t.barSubject,meta:t.meta,resumeCmd:t.resumeCmd,activeChild:S,onFinish:E,onCtrlC:T,pauseRef:$})]}),{exitOnCtrlC:!1})})}export{Pe as WalkSessionSurface,be as outcomeToMark,at as runWalkSession};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a}from"./chunk-
|
|
2
|
+
import{a}from"./chunk-4PWYSDZR.js";import"./chunk-H6TNBKGR.js";import"./chunk-7XMDCGIZ.js";import"./chunk-4PMZ5FCD.js";import"./chunk-KBM3XHAM.js";import"./chunk-2YEHV2CX.js";import"./chunk-5LJRZI7S.js";import"./chunk-BKM2LWU2.js";import"./chunk-3N6IAVD5.js";import"./chunk-FQNQVC5O.js";import"./chunk-AKX4VRRR.js";import"./chunk-UD7KKHPW.js";import"./chunk-RSSOJ3L2.js";import"./chunk-5EOX4MEY.js";import"./chunk-RZ4F3BHX.js";import"./chunk-F2XTOZTN.js";import"./chunk-UR6MHSHU.js";export{a as withTelemetry};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@testmuai/kane-cli",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.16",
|
|
4
4
|
"description": "KaneAI Terminal UI — browser automation testing agent",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -33,16 +33,16 @@
|
|
|
33
33
|
"ws": "^8.20.0"
|
|
34
34
|
},
|
|
35
35
|
"optionalDependencies": {
|
|
36
|
-
"@testmuai/kane-cli-assurance-darwin-arm64": "0.8.
|
|
37
|
-
"@testmuai/kane-cli-assurance-darwin-x64": "0.8.
|
|
38
|
-
"@testmuai/kane-cli-assurance-linux-arm64": "0.8.
|
|
39
|
-
"@testmuai/kane-cli-assurance-linux-x64": "0.8.
|
|
40
|
-
"@testmuai/kane-cli-assurance-win-x64": "0.8.
|
|
41
|
-
"@testmuai/kane-cli-darwin-arm64": "0.8.
|
|
42
|
-
"@testmuai/kane-cli-darwin-x64": "0.8.
|
|
43
|
-
"@testmuai/kane-cli-linux-x64": "0.8.
|
|
44
|
-
"@testmuai/kane-cli-linux-arm64": "0.8.
|
|
45
|
-
"@testmuai/kane-cli-win-x64": "0.8.
|
|
36
|
+
"@testmuai/kane-cli-assurance-darwin-arm64": "0.8.16",
|
|
37
|
+
"@testmuai/kane-cli-assurance-darwin-x64": "0.8.16",
|
|
38
|
+
"@testmuai/kane-cli-assurance-linux-arm64": "0.8.16",
|
|
39
|
+
"@testmuai/kane-cli-assurance-linux-x64": "0.8.16",
|
|
40
|
+
"@testmuai/kane-cli-assurance-win-x64": "0.8.16",
|
|
41
|
+
"@testmuai/kane-cli-darwin-arm64": "0.8.16",
|
|
42
|
+
"@testmuai/kane-cli-darwin-x64": "0.8.16",
|
|
43
|
+
"@testmuai/kane-cli-linux-x64": "0.8.16",
|
|
44
|
+
"@testmuai/kane-cli-linux-arm64": "0.8.16",
|
|
45
|
+
"@testmuai/kane-cli-win-x64": "0.8.16",
|
|
46
46
|
"@testmuai/kane-cli-node-darwin-arm64": "24.18.0",
|
|
47
47
|
"@testmuai/kane-cli-node-darwin-x64": "24.18.0",
|
|
48
48
|
"@testmuai/kane-cli-node-linux-x64": "24.18.0",
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a}from"./chunk-IQ7GPETF.js";import"./chunk-CGT4NFQN.js";import"./chunk-VNFCX2SH.js";import"./chunk-7O54QURK.js";import"./chunk-5GUD3CIH.js";import"./chunk-WILT62DP.js";import"./chunk-YMLC55J4.js";import"./chunk-EHN5HTUD.js";import"./chunk-22QIVSQR.js";import"./chunk-IE3OO5GI.js";import"./chunk-CH273NAE.js";import"./chunk-LBNADEQN.js";import"./chunk-VZ7KXRXB.js";import"./chunk-P7YZ3PU3.js";import"./chunk-GP7WD4UY.js";import"./chunk-JQW2QFSX.js";import"./chunk-3N6IAVD5.js";import"./chunk-FQNQVC5O.js";import"./chunk-AKX4VRRR.js";import"./chunk-UD7KKHPW.js";import"./chunk-3BHRGHIZ.js";import"./chunk-RFHMDQXZ.js";import"./chunk-MMBBQ4OZ.js";import"./chunk-WBHSPN55.js";import"./chunk-MSGW4JDG.js";import"./chunk-RSSOJ3L2.js";import"./chunk-5EOX4MEY.js";import"./chunk-4JOD47QI.js";import"./chunk-OH2NSBO6.js";import"./chunk-RZ4F3BHX.js";import"./chunk-EYOCNMUM.js";import"./chunk-B2ZGG7WM.js";import"./chunk-HCBYKLMW.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";export{a as EvidenceViewOffer};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a,b}from"./chunk-YHR2YAN5.js";import"./chunk-YCCUBQY4.js";import"./chunk-RBHQXWR7.js";import"./chunk-BPMSNGXQ.js";import"./chunk-OO5GMBVI.js";import"./chunk-OH2NSBO6.js";import"./chunk-NLCCBXXV.js";import"./chunk-RZ4F3BHX.js";import"./chunk-B2ZGG7WM.js";import"./chunk-HCBYKLMW.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";export{b as FolderPicker,a as formatFolderLine};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a}from"./chunk-JH6E632O.js";import"./chunk-3SPOJWRA.js";import"./chunk-DA57DXCF.js";import"./chunk-M7DN6FO3.js";import"./chunk-VZ7KXRXB.js";import"./chunk-TDPWFYTJ.js";import"./chunk-O5AS2ZIX.js";import"./chunk-4BBDKWM3.js";import"./chunk-WOA7VCGA.js";import"./chunk-YHR2YAN5.js";import"./chunk-YCCUBQY4.js";import"./chunk-RBHQXWR7.js";import"./chunk-BPMSNGXQ.js";import"./chunk-VE3SUJMA.js";import"./chunk-TZXXJWHA.js";import"./chunk-RSSOJ3L2.js";import"./chunk-5EOX4MEY.js";import"./chunk-AC7BPO4X.js";import"./chunk-TAOHYWEO.js";import"./chunk-OO5GMBVI.js";import"./chunk-Z7S3IWUX.js";import"./chunk-BAKJPQGU.js";import"./chunk-OH2NSBO6.js";import"./chunk-DHJSM5DT.js";import"./chunk-NLCCBXXV.js";import"./chunk-RZ4F3BHX.js";import"./chunk-EYOCNMUM.js";import"./chunk-IQ7NGOAT.js";import"./chunk-B2ZGG7WM.js";import"./chunk-HCBYKLMW.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";export{a as SingleShotApp};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{g as a}from"./chunk-GESG672R.js";import"./chunk-GPIXV7AV.js";import"./chunk-KOL6ZWOQ.js";import"./chunk-X74PP5NJ.js";import"./chunk-5Y2G4NC7.js";import"./chunk-P7YZ3PU3.js";import"./chunk-TDPWFYTJ.js";import"./chunk-O5AS2ZIX.js";import"./chunk-RQLU4NDG.js";import"./chunk-MMBBQ4OZ.js";import"./chunk-WBHSPN55.js";import"./chunk-MSGW4JDG.js";import"./chunk-RSSOJ3L2.js";import"./chunk-5EOX4MEY.js";import"./chunk-Z7S3IWUX.js";import"./chunk-4JOD47QI.js";import"./chunk-OH2NSBO6.js";import"./chunk-RZ4F3BHX.js";import"./chunk-EYOCNMUM.js";import"./chunk-7L25ZNNP.js";import"./chunk-ARG56PJG.js";import"./chunk-B2ZGG7WM.js";import"./chunk-DFS4RMVP.js";import"./chunk-HCBYKLMW.js";import"./chunk-C44QQJR4.js";import"./chunk-6YGTRKDT.js";import"./chunk-UR6MHSHU.js";export{a as TestMdRunView};
|
package/dist/bridge-X5DEJL6F.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a}from"./chunk-NDCRJXYF.js";import"./chunk-4K5XTIJ6.js";import"./chunk-J7NRD4Q7.js";import"./chunk-UD7KKHPW.js";import"./chunk-B2ZGG7WM.js";import"./chunk-UR6MHSHU.js";export{a as runAgent};
|
package/dist/chunk-53MPG2J3.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as d,e as g}from"./chunk-L4M7753M.js";import{existsSync as p}from"fs";import{isAbsolute as h,join as l,relative as v}from"path";function u(n){let t=p(l(n,".context"))?"assurance.json":"variables.json";return l(".testmuai","variables",t)}function f(n,t){if(!h(n))return n;let e=v(t,n);return e.startsWith("..")?n:e}function m(n,t){let e=n.used_by;if(e.length===0||e.every(r=>r.file===g))return"";if(t===void 0||!e.every(r=>r.file===t))return e.map(r=>`${r.file} step ${r.step}`).join(" \xB7 ");let a=[...new Set(e.map(r=>r.step))].sort((r,i)=>r-i);return a.length===1?`step ${a[0]}`:`steps ${a.join(", ")}`}function b(n,t){let e=new Map,a={header:"Not in any variables file",rows:[],declare:!0};for(let r of n){if(r.reason!=="value_missing"){a.rows.push(r);continue}let i=f(r.file??u(t),t),s=e.get(i);s||(s={header:i===d?"Waiting for a value passed with --variables":`Waiting for a value in ${i}`,rows:[],declare:!1},e.set(i,s)),s.rows.push(r)}return[...e.values(),...a.rows.length>0?[a]:[]]}function w(n,t){let e=u(t);if(p(l(t,e)))return["",` Add ${n.length===1?"it":"them"} to ${e}`];let a=n.map(s=>`${JSON.stringify(s.name)}:`),r=Math.max(...a.map(s=>s.length))+1,i=a.map((s,o)=>` ${s.padEnd(r)}{ "value": "" }${o<a.length-1?",":""}`);return["",` Create ${e}:`,""," {",...i," }"]}function E(n,t){let e=n.length,a=`\u2717 ${e} variable${e===1?" has":"s have"} no value \u2014 nothing was dispatched`,r=Math.max(...n.map(s=>s.name.length),8)+2,i=b(n,t.cwd).map(s=>{let o=[` ${s.header}`];for(let c of s.rows)o.push(` ${c.name.padEnd(r)}${m(c,t.entryFile)}`.trimEnd());return s.declare&&o.push(...w(s.rows,t.cwd)),o.join(`
|
|
3
|
-
`)});return`${a}
|
|
4
|
-
|
|
5
|
-
${i.join(`
|
|
6
|
-
|
|
7
|
-
`)}
|
|
8
|
-
|
|
9
|
-
If {{name}} is literal page text, write \\{{name}} to keep it as-is.
|
|
10
|
-
Fill the values and run again.
|
|
11
|
-
`}function x(n,t){return{type:"error",code:"unresolved_variables",message:`${n.length} variable(s) have no value \u2014 nothing was dispatched`,suggested_file:u(t.cwd),variables:n.map(e=>({...e,...e.file?{file:f(e.file,t.cwd)}:{}}))}}export{u as a,E as b,x as c};
|
package/dist/chunk-IICQ5KRD.js
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{b as G,c as K}from"./chunk-PDXZROJM.js";import{S as $}from"./chunk-CGT4NFQN.js";import{b as q}from"./chunk-5GUD3CIH.js";import{a as yt,b as k}from"./chunk-NBXYL2JT.js";import{a as V}from"./chunk-BPMSNGXQ.js";import{a as z}from"./chunk-DHJSM5DT.js";import{a as M}from"./chunk-NLCCBXXV.js";import{a as R}from"./chunk-RZ4F3BHX.js";import{e as Et}from"./chunk-UR6MHSHU.js";import{readFileSync as L,existsSync as U,readdirSync as te,mkdirSync as F,writeFileSync as w}from"fs";import{readFile as bt,unlink as ee}from"fs/promises";import{join as E}from"path";import{existsSync as Gt,mkdirSync as Kt,readdirSync as _t,writeFileSync as Ht}from"fs";import{join as S}from"path";import{randomUUID as v}from"crypto";var It=["children","instructions","branches","module_content","true_branch","false_branch"];function Y(e){let t=new Map,n=i=>{if(!i||typeof i!="object")return;let r=i;if(Array.isArray(r.operations))for(let o of r.operations){let s=o.operation_id;typeof s=="string"&&s&&!t.has(s)&&t.set(s,r)}for(let o of It){let s=r[o];Array.isArray(s)?s.forEach(n):s&&typeof s=="object"&&n(s)}};return e.forEach(n),t}function W(e,t){let n=new Map;for(let i of e){let r=i.action_id?t.get(i.action_id):void 0;if(!r)continue;let o=n.get(r)??[];o.push(i),n.set(r,o)}return n.size===0?null:[...n].map(([i,r])=>At(i,r))}function vt(e){if(!e.timestamp||e.duration_ms==null)return"";let t=new Date(e.timestamp);return isNaN(t.getTime())?"":new Date(t.getTime()+e.duration_ms).toISOString()}function H(e){if(e!=null)try{return JSON.parse(e)}catch{return e}}function J(e,t,n){let i=e.user_variables,r=typeof i=="string",o;try{o=r?JSON.parse(i):i??[]}catch{return}if(!Array.isArray(o)||o.length===0)return;let s=o.find(c=>t&&c.name===t)??(o.length===1?o[0]:void 0);s&&(s.value=n,e.user_variables=r?JSON.stringify(o):o)}function At(e,t){let n=structuredClone(e),i=t[0],r=t[t.length-1];switch(n.status=t.find(o=>o.status!=="success")?.status??i.status,n.start_timestamp=i.timestamp??n.start_timestamp,n.end_timestamp=vt(r)||n.end_timestamp,n.content_type){case"api":{let o=r.action_params?.api_data?.response;o&&typeof o=="object"&&(n.api_data={...n.api_data??{},response:o},J(n,r.output_variable,o));break}case"script":{r.output_value!=null&&J(n,r.output_variable??n.output_variable_name,r.output_value);break}case"db_query":{r.output_value!=null&&(n.db_details={...n.db_details??{},carried_out_query:H(r.output_value)});break}case"screenshot_command":{let o=H(r.output_value);o&&typeof o=="object"&&(n.smartui_results=o);break}case"network_assertion":case"network_query":break;default:break}return n}var kt="/home/kaneai/Downloads";function O(e){return`${kt}/${e}`}function Q(e){return"FILE__"+e.replace(/[^A-Za-z0-9]/g,"_")}function N(e){let t=e?.media;return!t||!t.name||!t.media_url?null:{media_id:t.media_id??"",name:t.name,media_url:t.media_url,type:t.type??"doc"}}function tt(e){return e?e.includes(`
|
|
3
|
-
`)?e.split(`
|
|
4
|
-
`).map(t=>t.trim()).filter(Boolean):e.split(". ").map(t=>t.trim()).filter(Boolean).map(t=>t.endsWith(".")?t:t+"."):[]}function T(e){return typeof e=="string"&&e.includes("{{secrets.")}var Rt={click:"CLICK",double_click:"CLICK",type:"TYPE",fill:"TYPE",clear:"CLEAR",select:"SELECT",hover:"HOVER",drag:"DRAG_DROP",upload_files:"UPLOAD_FILE",navigate:"OPEN",go_back:"NAVIGATE",go_forward:"NAVIGATE",refresh:"REFRESH",press_key:"SENDKEYS",scroll:"SCROLL_PIXELS",scroll_into_view:"SCROLL_UNTIL_ELEMENT",wait:"WAIT",wait_until:"WAIT_UNTIL",wait_for_load:"WAIT_FOR_LOAD",switch_tab:"SWITCH_TAB",new_tab:"NEW_TAB",close_tab:"CLOSE_TAB",api:"API",evaluate_js:"EVALUATE_JS",vision_query:"VISION_QUERY",textual_query:"TEXTUAL_QUERY",get_url:"GET_URL",get_title:"GET_TITLE",assert:"ASSERTION",math:"MATHEMATICAL_OPERATION",set_cookies:"SET_COOKIES",delete_cookies:"DELETE_COOKIES",clear_cookies:"CLEAR_COOKIES",set_local_storage:"SET_LOCAL_STORAGE",delete_local_storage:"DELETE_LOCAL_STORAGE",clear_local_storage:"CLEAR_LOCAL_STORAGE",set_clipboard:"SET_CLIPBOARD",paste_clipboard:"PASTE_CLIPBOARD",clear_clipboard:"CLEAR_CLIPBOARD",device_control:"DEVICE_CONTROL",device_control_query:"DEVICE_CONTROL_QUERY"},et={literal:"SET_VARIABLE",condition:"SET_VARIABLE",visual:"VISION_QUERY",dom:"TEXTUAL_QUERY",url:"GET_URL",title:"GET_TITLE",devtool_network:"DEVTOOLS_NETWORK_QUERY",devtool_console:"DEVTOOLS_CONSOLE_QUERY",devtool_cookies:"DEVTOOLS_COOKIES_QUERY",devtool_storage:"DEVTOOLS_STORAGE_QUERY",devtool_performance:"DEVTOOLS_PERFORMANCE",api_response:"API_CALLS_QUERY",textual_visual:"TEXTUAL_ANALYZER"},Pt=new Set(["CLICK","TYPE","FILL","HOVER","SCROLL_UNTIL_ELEMENT","UPLOAD_FILE","VISION_QUERY","DRAG_DROP","SELECT"]);function nt(e,t){if(e==="analyze"){let i=t?.action_params?.analyzer_type??"";return et[i]}if(e==="scroll"&&t?.action_params?.into_view===!0)return"SCROLL_UNTIL_ELEMENT";let n=Rt[e];return n||console.warn(`[migrator] UNKNOWN action_type "${e}" \u2014 falling back to "${e.toUpperCase()}"; explicit mapping required`),n??e.toUpperCase()}function it(e,t){if(!e||!t)return"";try{let n=new Date(e);return isNaN(n.getTime())?"":new Date(n.getTime()+t).toISOString()}catch{return""}}function ot(e){try{return JSON.parse(e.output_value??"{}")}catch{return{}}}function St(e){let t=e.output_variable??"";if(!t)return"[]";let i={...ot(e)};return delete i.body,JSON.stringify([{name:t,unique_key:(e.action_id??"").replace(/-/g,"").slice(0,8)||v().replace(/-/g,"").slice(0,8),value:i,variable_description:"API Response"}])}function wt(e,t,n){let i=e.action_params??{},r=Pt.has(t)?"Vision Agent":"Operation Agent",o={operation_type:t};if(t==="OPEN"&&(o.url=i.url??""),t==="SET_VARIABLE"&&(o.variable_name=e.output_variable??i.key??"",o.variable_value=e.output_value??""),t==="UPLOAD_FILE"){let m=N(i);m&&(o.value=O(m.name))}let s={},c={},a=e.action_instruction??"",l=i.text??"",u=i.url??"",_=[["intent",a],["value",l],["url",u]];for(let[m,h]of Object.entries(n)){let I=String(h);if(m.startsWith("secrets."))for(let[y,b]of _)b.includes(I)&&(c[y]=m);for(let[y,b]of _)b.includes(I)&&!(y in s)&&(s[y]=b)}let p=e.action_type,d={operation:e.action_instruction??"",agent:r,operation_dict:o,reasoning:p==="analyze"?i.query??"":e.intent??e.action_instruction??"",variable:s,secrets:c,params:{}};p==="analyze"&&typeof i.code=="string"&&i.code&&(d.code=i.code),p==="analyze"&&typeof i.code_js=="string"&&i.code_js&&(d.code_js=i.code_js),p==="analyze"&&typeof i.condition_expression=="string"&&i.condition_expression&&(d.condition_expression=i.condition_expression),i.uses_websocket===!0&&(d.uses_websocket=!0),i.uses_sse===!0&&(d.uses_sse=!0),p==="analyze"&&i.analyzer_type==="textual_visual"&&(typeof i.wrapped_js=="string"&&(d.wrapped_js=i.wrapped_js),Array.isArray(i.locators)&&(d.locators=i.locators),typeof i.operator=="string"&&(d.operator=i.operator),Array.isArray(i.transforms)&&(d.transforms=i.transforms),typeof i.query=="string"&&(d.query=i.query),typeof i.expected_value=="string"&&(d.expected_value=i.expected_value),typeof i.needs_unit_conversion=="boolean"&&(d.needs_unit_conversion=i.needs_unit_conversion),typeof i.condition=="string"&&(d.condition=i.condition));let f={set_cookies:"cookies",set_clipboard:"text",delete_cookies:"names",set_local_storage:"items",delete_local_storage:"keys"}[p];return f&&i[f]!==void 0&&(d[f]=i[f]),p==="set_clipboard"&&typeof i.html=="string"&&i.html&&(d.html=i.html),d}function xt(e){let t=e.assertion_tree??{};if(typeof t.passed=="boolean")return t.passed;let n=t.sub_results??[];return n.length===0?t.status==="passed":(t.composite_operator??"and")==="or"?n.some(r=>r.passed===!0):n.every(r=>r.passed===!0)}function rt(e){return e.map(t=>({description:t.description??"",store_key:t.store_key??"",expected_value:t.expected??"",extracted_value:t.extracted_value??"",operator:t.operator??"equals",transforms:t.transforms??[]}))}function Ot(e){let t=e.assertion_tree??{},n=t.sub_results??[],i=rt(n);return{operator:[],assertion_operands:[],left_operand:null,right_operand:null,operands:[],sub_results:n,sub_checks:i,composite_operator:t.composite_operator??"and",verification:t.verification??"",claim:t.description??""}}function Nt(e){let n=(e.action_params??{}).assertion_tree??{},i=n.sub_results??[],r=rt(i);return[{operation:e.action_instruction??"",agent:"Operation Agent",operation_dict:{operation_type:"ASSERTION",assertion_tree:{sub_results:i,sub_checks:r,composite_operator:n.composite_operator??"and",verification:"",claim:n.description??e.action_instruction??"",operator:[],assertion_operands:[],left_operand:null,right_operand:null,operands:[]}},variable:{},secrets:{},params:{}}]}function Lt(e,t,n,i){let r=e.visual_data;if(!r||r.x==null||r.y==null)return null;let o=t?`${t}/test_screenshots`:"";return{x:r.x,y:r.y,confidence:0,bbox:r.bbox??null,bbox_source:r.bbox?"accessibility_tree":"fallback",viewport_width:r.viewport_width??1280,viewport_height:r.viewport_height??800,scale_factor:null,raw_image_url:o?`${o}/untagged_screenshot/${n}.${i?.get(n)??"png"}`:"",raw_image_sas_url:"",annotated_image_url:"",annotated_image_sas_url:""}}function Tt(e){if(!e)return"";let t=e;return typeof e=="object"&&!Array.isArray(e)&&Array.isArray(e.frameInfo)&&(t=e.frameInfo),!Array.isArray(t)||t.length===0?"":JSON.stringify(t)}function Ct(e){return/^(android|ios)_native$/i.test(e.platform??"")}function st(e,t){return e.map(n=>({...n,type:t?n.strategy??n.type??"native":n.isXPath?"xpath":"css"}))}function jt(e,t,n){let i={selector_target:"",drag_displacement:{},hold_duration_ms:null,move_duration_ms:null,hold_at_destination_ms:null};if(e!=="drag")return i;let r=t.target_selectors,o={};typeof t.direction=="string"&&t.direction&&(o.direction=t.direction,typeof t.fraction=="number"&&(o.fraction=t.fraction));let s=c=>typeof t[c]=="number"?Math.trunc(t[c]):null;return{selector_target:Array.isArray(r)&&r.length>0?st(r,n):"",drag_displacement:o,hold_duration_ms:s("hold_duration_ms"),move_duration_ms:s("move_duration_ms"),hold_at_destination_ms:s("hold_at_destination_ms")}}function X(e,t="",n){let i=e.action_type,r=nt(i,e),o=e.action_params??{},s=e.coordinates??null,c=e.selectors??null,a=!!(c&&c.length>0),l=Ct(e),u=jt(i,o,l),_=e.timestamp??"",p=e.duration_ms??0,d=e.variables_used??{},g=e.action_id??v(),f=v(),m=it(_,p),h="",I="";if(i==="navigate")I=o.url??"",h=I;else if(i==="type"||i==="fill")h=o.text??"";else if(i==="press_key")h=o.key??"";else if(i==="wait")h=String(o.ms??o.timeout_ms??"");else if(i==="evaluate_js")h=o.script??"";else if(i==="upload_files"){let B=N(o);B&&(h=O(B.name))}else i==="analyze"&&r==="SET_VARIABLE"&&(h=e.output_value??"");let y="";i==="go_back"?y="back":i==="go_forward"&&(y="forward");let b=e.action_instruction??"",A=T(h)||T(I)||T(b),x=wt(e,r,d);return{operation_id:g,instruction_id:f,instruction:b,intent:b,operation_start:_,operation_end:m,status:e.status??"",command:r,name:"",target:"",value:h,message:"",operation_dict:"",frame:Tt(e.frame_info),error_message:e.error??"",code_snippet:"",sub_instruction_obj:JSON.stringify(x),test_id:"",test_version:"",action:"",string_to_float:!1,feedback_msg:"",time_taken:"",create_time_stamp:"",update_time_stamp:"",locator_variable:"",locator_variable_name:"",image_url:t?`${t}/test_screenshots/untagged_screenshot/${g}.${n?.get(g)??"png"}`:"",alternative_xpaths:[],attribute:"",value_description:"",url:I,navigation_direction:y,tagified_image_url:"",query_variable_name:e.output_variable??"",query_variable_value:e.output_value??"",query_variable_type:"",expected_value:"",queried_value:"",operator:"",assertion_status:r==="ASSERTION"?xt(o):"",query_info_dict:{},query_content_confidence:"none",debugging_logs:[],locator_index:0,query_html:"",user_variables:"[]",optional_flag:!1,max_retries:0,retries_delay:0,explicit_wait:0,implicit_wait:0,tab_index:String(o.tab_index??""),tab_identifier:String(o.tab_identifier??""),scroll_value:o.amount??1,scroll_direction:o.direction??"",mi_scroll_payload:{},sleep_duration:0,app_id:"",manual_interaction_tag:"",string_to_float_list:[],js_snippet:i==="evaluate_js"?o.script??"":"",code_error:"",hide:A,dismiss_dialog:!1,use_v2_mobile_tagging:l,multiple_inputs:!1,dialog_action:"",dialog_type:"",is_coordinates_used_for_interaction:s!==null&&!a,element_coordinates_ratio:[],element_bounds_ratio:[],x_coord:a?null:s?.x??null,y_coord:a?null:s?.y??null,target_x_coord:o.target_x??null,target_y_coord:o.target_y??null,source_description:o.source_description??null,target_description:o.target_description??null,use_coordinates:s!==null&&!a,kaneaiMobileTaggingImageLimit:1,clicks_order_code:"se_js_ac",selector:a?st(c,l):"",selector_target:u.selector_target,math_result_variable_name:"",math_result_variable_value:"",expression_tree:r==="ASSERTION"?Ot(o):o.expression_tree??{},assertion_tree:o.assertion_tree??{},assertion_tree_simplified:{},network_throttle:{},is_mobile_offline:!1,autoheal:!1,reprobe:e.reprobe??!1,click_modifier:(o.click_count??1)>=2?{kind:"multi_click",frequency:o.click_count}:null,db_query:"",db_details:{},db_query_decoded:"",is_global_variable:!1,is_global_variable_persist:!1,global_variable_id:"",wait_for_element_timeout:0,failure_condition:r==="ASSERTION"?"Fail test immediately":"",screenshot_command:"",smartui_contents:{},smartui_results:{},result_type:"",result_hint:"",drag_offset:{},drag_displacement:u.drag_displacement,hold_duration_ms:u.hold_duration_ms,move_duration_ms:u.move_duration_ms,hold_at_destination_ms:u.hold_at_destination_ms,start_coordinates:o.source_coordinates?{x:o.source_coordinates[0],y:o.source_coordinates[1]}:{},end_coordinates:o.target_coordinates?{x:o.target_coordinates[0],y:o.target_coordinates[1]}:{},element_rect:null,is_canvas:!1,until_condition:"",until_max_retries:0,until_settle_ms:0,api_data:i==="api"?{request:e.action_params?.api_data?.request??{}}:{},output_variables:i==="api"?e.output_variable?{[e.output_variable]:null}:{}:e.output_variable?{[e.output_variable]:e.output_value??""}:{},visual_context:Lt(e,t,g,n),reasoning:i==="analyze"?o.query??"":e.intent??e.action_instruction??""}}function Z(e,t){let n=e.action_type,i=nt(n,e),r=e.timestamp??"",o=e.duration_ms??0,s=it(r,o),c=i==="ASSERTION"||i==="MATHEMATICAL_OPERATION";return{instruction_id:t.instruction_id,instruction_class:c?"non_driver_action":"driver_action",module_id:"",instruction:e.action_instruction??"",command:i,error:null,parent_instruction_id:"",classification_layer_resp:i==="ASSERTION"?Nt(e):[],classification_error:{},operations:[t],status:e.status??"",start_timestamp:r,end_timestamp:s,type:"agent_generated",tags:[],html_paths:[],optional_flag:!1,max_retries:0,retries_delay:0,explicit_wait:0,implicit_wait:0,content_type:n==="api"?"api":n==="analyze"&&e.action_params?.analyzer_type==="api_response"?"api_calls_query":n==="analyze"&&e.action_params?.analyzer_type?.startsWith("devtool_")?e.action_params.analyzer_type.replace("devtool_","devtools_"):"instruction",js_snippet:n==="evaluate_js"?e.action_params?.script??"":"",user_variables:n==="api"?St(e):"[]",api_data:n==="api"?{request:e.action_params?.api_data?.request??{},response:ot(e)}:{},params_used:!1,hard_assertion:i==="ASSERTION"?e.action_params?.failure_condition==="hard":!1,expected_outcome:"",module_execution_index:0,module_version:null,network_throttle:{},isEdited:!1,use_query_assertion_v2:!1,db_query:"",db_details:{},network_assertion_content:{},screenshot_command:"",smartui_contents:{},generative_id:"",plan_id:"",generative_objective:"",error_message:"",error_code:"",reason:"",title:"",used_variables:[],reasoning:n==="analyze"?e.action_params?.query??"":e.intent??e.action_instruction??""}}function Dt(e,t=[]){let n=e.action_params??{},i=n.branches??[],r=n.winning_index??-1,o=n.sub_results??[],s={};for(let a of o){let l=a.sub_results;if(l)for(let u of l){let _=u.store_key;_&&(s[_]=u)}}let c=i.map((a,l)=>{let u=l===r,_=(a.sub_checks??[]).map(p=>{let d=s[p.store_key];return{description:p.description,store_key:p.store_key,expected_value:p.expected_value,stored_value:d?.extracted_value??p.stored_value,operator:p.operator??d?.operator??"equals",transforms:p.transforms??d?.transforms??[]}});if(_.length===0&&a.condition&&o.length>0){let d=o.find(g=>g.branch_index===l)?.sub_results??[];d.length>0&&(_=d.map(g=>({description:g.description??a.condition,store_key:g.store_key??"",expected_value:g.expected??"true",stored_value:g.extracted_value??void 0,operator:g.operator??"equals",transforms:g.transforms??[]})))}return{branch_index:l,condition:a.condition??null,branch_type:a.branch_type??"sub_objective",passed:u,sub_objective:null,custom_event:a.custom_event??null,children:u?t:[],sub_checks:a.condition?_:[],composite_operator:a.composite_operator??"and"}});return{content_type:"conditional_block",instruction_id:`if_else_${v().slice(0,8)}`,instruction:e.action_instruction??"",instruction_class:"driver_action",command:"",status:e.status??"success",resolved_branch_index:r,branches:c,generative_id:"",generative_objective:"",variables_used:{},classification_layer_resp:[],classification_error:{},used_variables:[],user_variables:"[]",module_id:"",module_execution_index:0,module_version:"",plan_id:"",optional_flag:!1,max_retries:0,retries_delay:0,explicit_wait:0,implicit_wait:0,error:null,error_message:"",error_code:"",reason:"",start_timestamp:e.timestamp??"",end_timestamp:"",type:"agent_generated",hook:null,hook_type:null,evaluation_context:{},query_variables:{}}}function at(e,t,n){for(let i of e)i.content_type==="instruction"&&"generative_id"in i&&(i.generative_id=t,i.generative_objective=n)}function C(e,t="",n,i){let r=[],o=0;for(;o<e.length;){let s=e[o],c=s.action_type;if(!i?.keepFailedActions&&s.status==="error"&&c!=="assert"&&c!=="if_else"&&c!=="child_agent_start"&&c!=="child_agent_end"&&!(s.until_condition&&!s.error)){o+=1;continue}if(c==="analyze"&&(!et[s.action_params?.analyzer_type??""]||s.action_params?.analyzer_type==="textual_visual"&&s.action_params?.code)){o+=1;continue}if(c==="child_agent_start"){let a=s.action_params?.child_id??"",l=s.action_params?.objective??"",u=[];o+=1;let _=1,p="error",d;for(;o<e.length&&_>0;){let A=e[o],x=A.action_type;if(x==="child_agent_start")_+=1;else if(x==="child_agent_end"&&(_-=1,_===0)){p=A.status??"success",d=A,o+=1;break}_>0&&u.push(A),o+=1}let g=C(u,t,n);at(g,a,l);let f=d?.action_params?.result_code??null,m=d?.action_params?.reason_code??null,h=d?.action_params?.error_message??null,I=d?.action_params?.summary??null,y=d?.action_params?.one_liner??null,b=p==="error";r.push({content_type:"generative_block",instruction_id:`generative_block_${a}`,generative_id:a,objective:l,status:p,children:g,error_message:b?h??null:null,error_code:b?m??null:null,result_code:f??null,bifurcation_context:[],approach_reason:tt(I),one_liner:y??null});continue}else if(c==="child_agent_end"){o+=1;continue}else if(c==="if_else"){o+=1;let a=[];for(;o<e.length&&e[o].action_type==="child_agent_start";){let l=e[o],u=l.action_params?.child_id??"",_=l.action_params?.objective??"",p=[];o+=1;let d=1,g="error";for(;o<e.length&&d>0;){let m=e[o];if(m.action_type==="child_agent_start")d+=1;else if(m.action_type==="child_agent_end"&&(d-=1,d===0)){g=m.status??"success",o+=1;break}d>0&&p.push(m),o+=1}let f=C(p,t,n);a.push(...f)}r.push(Dt(s,a));continue}else if(c==="query_tool"){o+=1;continue}else if(s.until_condition){let a=X(s,t,n),l=Z(s,a),u=typeof s.until_condition_met=="boolean"?s.until_condition_met:s.status==="success";r.push({content_type:"until_block",instruction_id:`until_${v().slice(0,8)}`,condition:s.until_condition,max_retries:s.until_max_retries??10,settle_ms:s.until_settle_ms??500,current_count:0,condition_met:u,children:[l],generative_id:"",generative_objective:"",variables_used:{},status:s.status??"success"})}else{let a=X(s,t,n),l=Z(s,a);r.push(l)}o+=1}return r}function P(e,t="",n,i){let r=[],o=[],s=i?.passthrough,c=s?Y(s.authoredInstructions):null;for(let d of e){if(s&&c&&d.flatIndex!==void 0&&s.replayOnlyFlatIndices.has(d.flatIndex)){let b=W(d.records,c);if(b){for(let A of b)r.push(A),o.push(d.flatIndex);continue}console.warn(`[migrator] replay-only passthrough: no authored operation matched step ${d.flatIndex} (action_id \u2260 any operation_id in the authored blob) \u2014 falling back to this run's records`)}let g=C(d.records,t,n,i);if(g.length===0)continue;let f=v().replace(/-/g,"");at(g,f,d.objective);let m=g.some(b=>"status"in b&&typeof b.status=="string"?b.status==="error"||b.status==="failed":!1),h=d.resultCode?parseInt(d.resultCode,10):null,I=h!==null&&!isNaN(h)&&h>=200,y=m||I?"error":"success";r.push({content_type:"generative_block",instruction_id:`generative_block_${f}`,generative_id:f,objective:d.objective,status:y,children:g,error_message:y==="error"?d.errorMessage??null:null,error_code:y==="error"?d.reasonCode??null:null,result_code:d.resultCode??null,bifurcation_context:[],approach_reason:tt(d.summary),one_liner:d.oneLiner??null}),o.push(d.flatIndex)}let a=r.map((d,g)=>({block:d,flat:o[g]})),l=i?.moduleSpans??[],u=i?.blockSpans??[],_=i?.authoredBlocks??[];l.length>0&&(a=ct(a,l,u,_));let p=dt(u,l);return p.length>0&&(a=j(a,p,_)),{instructions:a.map(d=>d.block)}}function ct(e,t,n,i){let r=[],o=c=>c===void 0?void 0:t.find(a=>c>=a.flatFrom&&c<=a.flatTo),s=0;for(;s<e.length;){let c=o(e[s].flat);if(!c){r.push(e[s]),s++;continue}let a=[];for(;s<e.length&&o(e[s].flat)===c;)a.push(e[s++]);let l=ct(a,c.children,n,i),u=dt(ut(n,c),c.children);u.length>0&&(l=j(l,u,i)),r.push({block:$t(c,l.map(_=>_.block)),flat:a[0].flat})}return r}function lt(e,t){return e.flatFrom>=t.flatFrom&&e.flatTo<=t.flatTo}function ut(e,t){let n=[];for(let i of e)lt(i,t)?n.push(i):n.push(...ut(i.children,t));return n}function dt(e,t){let n=[],i=o=>{for(let s of o)n.push(s),i(s.children)};i(t);let r=o=>o.filter(s=>!n.some(c=>lt(s,c))).map(s=>({...s,children:r(s.children)}));return n.length>0?r(e):e}function j(e,t,n){let i=[...t].sort((l,u)=>l.flatFrom-u.flatFrom),r=[],o=(l,u)=>{r.push({block:zt(l,u,n),flat:l.flatFrom})},s=(l,u)=>l!==void 0&&l>=u.flatFrom&&l<=u.flatTo,c=0,a=0;for(;a<e.length;){let l=e[a].flat;for(;c<i.length&&l!==void 0&&i[c].flatTo<l;)o(i[c++],[]);let u=c<i.length&&s(l,i[c])?i[c]:void 0;if(!u){r.push(e[a]),a++;continue}let _=[];for(;a<e.length&&s(e[a].flat,u);)_.push(e[a++]);o(u,_),c++}for(;c<i.length;)o(i[c++],[]);return r}function Ut(e){let t=new Map;for(let n of e)t.set(n.flat,n);return e.filter(n=>t.get(n.flat)===n)}var Ft=["children","instructions","branches","module_content","true_branch","false_branch"];function Bt(e,t){if(!t)return;let n=[...e];for(;n.length>0;){let i=n.pop();if(!i||typeof i!="object")continue;let r=i;if(r.instruction_id===t&&(r.content_type==="conditional_block"||r.content_type==="until_block"))return r;for(let o of Ft){let s=r[o];Array.isArray(s)?n.push(...s):s&&typeof s=="object"&&n.push(s)}}}function Mt(e,t,n){if(!e)return[];if(t==="while")return Array.isArray(e.children)?e.children:[];let r=(Array.isArray(e.branches)?e.branches:[])[n];return r&&Array.isArray(r.children)?r.children:[]}function zt(e,t,n){let i=Bt(n,e.blockId),r=e.branches.map((o,s)=>{let c=t.filter(u=>u.flat!==void 0&&u.flat>=o.flatFrom&&u.flat<=o.flatTo);e.kind==="while"&&(c=Ut(c));let a=j(c,e.children,n).map(u=>u.block);if(a.length>0)return a;let l=Mt(i,e.kind,s);return l.length===0&&!o.taken&&console.warn(`[migrator] control-flow: branch ${s} of block ${e.blockId||e.instruction} did not run and no authored block matched \u2014 emitted empty`),l});return e.kind==="if"?Vt(e,r,i):qt(e,r[0]??[],i)}function Vt(e,t,n){let i=Array.isArray(n?.branches)?n.branches:[],r=D(t.flat()),o=e.branches.map((s,c)=>{let a=i[c];return{branch_index:c,condition:s.branch_type==="else"?null:s.condition,branch_type:s.branch_type,passed:s.taken,sub_objective:null,custom_event:a?.custom_event??null,children:t[c],sub_checks:Array.isArray(a?.sub_checks)?a.sub_checks:[],composite_operator:a?.composite_operator??"and"}});return{content_type:"conditional_block",instruction_id:e.blockId||`if_else_${v().slice(0,8)}`,instruction:e.instruction,instruction_class:"driver_action",command:"",status:r?"error":"success",resolved_branch_index:e.branches.findIndex(s=>s.taken),branches:o,generative_id:"",generative_objective:"",variables_used:{},classification_layer_resp:[],classification_error:{},used_variables:[],user_variables:"[]",module_id:"",module_execution_index:0,module_version:"",plan_id:"",optional_flag:!1,max_retries:0,retries_delay:0,explicit_wait:0,implicit_wait:0,error:null,error_message:r?.message??"",error_code:r?.code??"",reason:"",start_timestamp:"",end_timestamp:"",type:"agent_generated",hook:null,hook_type:null,evaluation_context:{},query_variables:{}}}function qt(e,t,n){let i=e.whileCfg??{max_retries:5,settle_ms:500,on_exhaust:"fail",iterations:0,condition_met:!1},r=D(t),o=(s,c)=>n&&n[s]!==void 0?n[s]:c;return{content_type:"until_block",instruction_id:e.blockId||`until_${v().slice(0,8)}`,condition:e.instruction,max_retries:i.max_retries,settle_ms:i.settle_ms,current_count:i.iterations,condition_met:i.condition_met,children:t,generative_id:"",generative_objective:"",variables_used:{},status:r?"error":"success",on_exhaust:o("on_exhaust",i.on_exhaust),mode:o("mode",""),check:o("check",""),conditions:o("conditions",[]),connectors:o("connectors",[]),sub_checks:o("sub_checks",[]),composite_operator:o("composite_operator","and")}}function D(e){for(let t of e){let n="status"in t&&typeof t.status=="string"?t.status:"";if(n==="error"||n==="failed"){let i="error_message"in t?t.error_message:void 0,r="error_code"in t?t.error_code:void 0;return{message:i??null,code:r??null}}}return null}function $t(e,t){let n=e.meta,i=(l,u="")=>typeof n[l]=="string"?n[l]:u,r=(l,u=!1)=>typeof n[l]=="boolean"?n[l]:u,o=l=>Array.isArray(n[l])?n[l]:[],s=typeof n.module_version=="number"||typeof n.module_version=="string"?n.module_version:null,c=i("module_id"),a=D(t);return{content_type:$,instruction_id:`module_block_${c}`,module_id:c,module_version:s,module_instance_id:v(),module_name:i("module_name"),module_description:i("module_description"),module_platform:i("module_platform"),creation_mode:i("creation_mode","Agent"),tms_status:i("tms_status","active"),is_validated:r("is_validated"),is_dirty:e.dirty,enrichment_id:i("enrichment_id"),tags:o("tags"),project_ids:o("project_ids"),link_to_all:r("link_to_all"),status:a?"error":"success",children:t,error_message:a?.message??null,error_code:a?.code??null,update_available:!1,update_info:{}}}function pt(e,t){let n;try{n=_t(e)}catch{return 0}let i=0,r=n.filter(o=>/^\d+$/.test(o)).sort((o,s)=>Number(o)-Number(s));for(let o of r){let s=S(e,o),c=S(s,"logs");if(!Gt(c))continue;let a;try{a=_t(c)}catch{continue}let l=a.filter(p=>p.endsWith("-actions.ndjson")).sort((p,d)=>(parseInt(p,10)||0)-(parseInt(d,10)||0)),u=[];for(let p of l){let d=t.readActions(S(c,p));d.length&&u.push({objective:t.objective??"",records:d})}if(u.length===0)continue;let{instructions:_}=P(u,t.screenshotBaseUrl??"",t.extMap,{keepFailedActions:!0});if(_.length!==0)try{let p=S(s,"auteur");Kt(p,{recursive:!0}),Ht(S(p,"execution.json"),JSON.stringify(t.buildBlob(_),null,2)),i++,t.log?.("info","EVIDENCE_ARCHIVED_ATTEMPT_BLOB","Derived nested attempt blob",{attempt:o,instructions:_.length})}catch(p){t.log?.("debug","EVIDENCE_ARCHIVED_ATTEMPT_BLOB_FAILED","Nested attempt blob derivation failed",{attempt:o,error:p instanceof Error?p.message:String(p)})}}return i}var gt=Et(yt(),1);import{createWriteStream as Jt}from"fs";import{readFile as Yt}from"fs/promises";import{join as Wt,basename as Xt}from"path";import{tmpdir as Zt}from"os";var Qt=["**/screenshots/**","**/annotated/**","**/tcg/**","**/bifurcation/**"];async function ft(e){let t=Wt(Zt(),`${Xt(e)}_artifacts.zip`);return new Promise((n,i)=>{let r=Jt(t),o=(0,gt.default)("zip",{zlib:{level:6}});r.on("close",()=>n(t)),o.on("error",i),o.pipe(r),o.glob("**/*",{cwd:e,ignore:Qt}),o.finalize()})}async function mt(e){return Yt(e)}async function ne(e,t){return bt(q(e,t))}function ie(e){return{key:"artifacts",content_type:"application/zip",filename:`${e}.evidence`}}var ht=class{config;controller;testId;constructor(t){this.config=t,this.controller=new z(t.controllerBaseUrl,t.auth),this.testId=t.testId}log(t,n,i,r){this.config.log?.(t,n,i,r)}async execute(){let{onProgress:t}=this.config;try{if(!this.testId)return this.log("error","PIPELINE_ABORT","No test_id available"),{success:!1,testId:null,error:"No test_id available"};let n=this.config.evidence,i=null;if(this.config.shouldUploadArtifacts!==!1){t("convert","running");let c=this.collectNdjsonPerRun(),a=c.reduce((f,m)=>f+m.records.length,0);this.log("info","PIPELINE_CONVERT","Collected NDJSON records",{total_records:a,run_groups:c.length});let l=this.loadReplayOnlyPassthrough(),{instructions:u}=c.length>0?P(c,this.config.screenshotBaseUrl??"",this.config.screenshotExtMap,{moduleSpans:this.config.moduleSpans,...l?{passthrough:l}:{},...this.config.blockSpans?.length?{blockSpans:this.config.blockSpans,authoredBlocks:this.loadAuthoredBlocks()}:{}}):{instructions:[]};this.log("info","PIPELINE_CONVERT_INSTRUCTIONS","Auteur instructions produced",{count:u.length});let _=this.buildExecutionEnvelope(u),p=Buffer.from(JSON.stringify(_));this.log("info","PIPELINE_CONVERT_BLOB","Blob created",{size_kb:+(p.length/1024).toFixed(1)});let d=E(this.config.sessionDir,"execution.json");w(d,JSON.stringify(_,null,2)),this.log("info","PIPELINE_CONVERT_LOCAL_SAVE","Execution blob saved locally",{path:d});let g=n?.packTestDir??this.config.evidenceRead?.packTestDir;if(g){let f=E(g,"auteur");F(f,{recursive:!0}),w(E(f,"execution.json"),JSON.stringify(_,null,2)),this.log("info","PIPELINE_CONVERT_PACK_COPY","Execution blob copied into pack",{path:E(f,"execution.json")}),this.deriveArchivedAttemptBlobs(g)}if(t("convert","done"),n)i=p;else{t("zip","running"),this.log("info","PIPELINE_ZIP_START","Zipping session",{session_dir:this.config.sessionDir});let f=null,m;try{f=await ft(this.config.sessionDir),m=await mt(f),this.log("info","PIPELINE_ZIP_DONE","Zip complete",{size_mb:+(m.length/1024/1024).toFixed(1),path:f}),t("zip","done",`${(m.length/1024/1024).toFixed(1)}MB`)}finally{f&&await ee(f).catch(()=>{})}t("presign","running"),this.log("info","PIPELINE_PRESIGN_START","Requesting presigned URLs",{url:`${this.config.controllerBaseUrl}/upload/presign`,test_id:this.testId,session_id:this.config.sessionId});let h=await this.controller.getPresignedUrls(this.testId,this.config.sessionId,[{key:"artifacts",content_type:"application/zip",filename:`${this.config.sessionId}_artifacts.zip`},{key:"blob",content_type:"application/json",filename:`${this.config.commitId}.json`}]);this.log("info","PIPELINE_PRESIGN_OK","Presigned URLs received",{artifacts_url:h.urls.artifacts?.blob_url,blob_url:h.urls.blob?.blob_url}),t("presign","done"),t("upload","running"),this.log("info","PIPELINE_UPLOAD_START","Uploading artifacts and blob",{artifact_size_mb:+(m.length/1024/1024).toFixed(1),blob_size_kb:+(p.length/1024).toFixed(1)}),await Promise.all([k(h.urls.artifacts.upload_url,m,"application/zip"),k(h.urls.blob.upload_url,p,"application/json")]),this.log("info","PIPELINE_UPLOAD_OK","Upload complete"),t("upload","done")}}else{let c=this.collectNdjsonPerRun(),a=this.loadReplayOnlyPassthrough(),{instructions:l}=c.length>0?P(c,this.config.screenshotBaseUrl??"",this.config.screenshotExtMap,{keepFailedActions:!0,moduleSpans:this.config.moduleSpans,...a?{passthrough:a}:{},...this.config.blockSpans?.length?{blockSpans:this.config.blockSpans,authoredBlocks:this.loadAuthoredBlocks()}:{}}):{instructions:[]},u=this.buildExecutionEnvelope(l),_=E(this.config.sessionDir,"execution.json");w(_,JSON.stringify(u,null,2)),this.log("info","PIPELINE_LOCAL_SAVE","Execution blob saved locally (no upload)",{path:_});let p=this.config.evidence?.packTestDir??this.config.evidenceRead?.packTestDir;if(p){let d=E(p,"auteur");F(d,{recursive:!0});let g=this.readAuthoredExecution();w(E(d,"execution.json"),g??JSON.stringify(u,null,2)),this.log("info","PIPELINE_CONVERT_PACK_COPY","Execution blob copied into pack (gated)",{path:E(d,"execution.json"),source:g?"authored":"run_envelope"}),this.deriveArchivedAttemptBlobs(p)}t("convert","skipped"),t("zip","skipped"),t("presign","skipped"),t("upload","skipped"),this.log("info","PIPELINE_UPLOAD_SKIPPED","Upload steps skipped (gate disabled)")}if(this.config.shouldReplaceLocalOutput&&this.config.onAtomicReplace){t("atomic_replace","running");try{await this.config.onAtomicReplace(),this.log("info","PIPELINE_ATOMIC_REPLACE_OK","Local output replaced"),t("atomic_replace","done")}catch(c){let a=c instanceof Error?c.message:String(c);throw this.log("error","PIPELINE_ATOMIC_REPLACE_FAILED","Atomic-replace failed",{error:a}),t("atomic_replace","failed",a),c}}else t("atomic_replace","skipped");let r,o;if(this.config.shouldCommit&&!this.config.isFirstRun&&this.config.onCommitLock){t("commit_lock","running");let c=await this.config.onCommitLock();if(c.ok)r=c.testcaseId||void 0,this.log("info","PIPELINE_COMMIT_LOCK_OK","Commit lock acquired",{testcase_id:r??"none",trigger:c.trigger??null,test_instance_id:c.testInstanceId??null}),t("commit_lock","done");else return this.log("error","PIPELINE_COMMIT_LOCK_FAILED","Commit lock failed",{reason:c.reason,message:c.message}),t("commit_lock","failed",`${c.reason??"unknown"}: ${c.message??""}`),{success:!1,testId:this.testId,error:`commit-lock failed: ${c.reason??"unknown"}`}}else t("commit_lock","skipped");if(this.config.isFirstRun&&!this.config.skipTmsFinalize){t("finalize","running"),this.log("info","PIPELINE_FINALIZE_START","Finalizing test (first-run)",{test_id:this.testId,commit_id:this.config.commitId});let c=new V(this.config.tmsBaseUrl,this.config.tmsUsername,this.config.tmsAccessKey),a=this.config.runObjectives&&this.config.runObjectives.length>0?this.config.runObjectives:[this.config.firstObjective];if(r=(await c.endTest(this.testId,{commit_id:this.config.commitId,time_taken:Math.round(this.config.totalDuration),steps_count:this.config.totalSteps,commit_message:this.config.firstObjective.slice(0,255),objectives:a})).testcase_id||void 0,this.log("info","PIPELINE_FINALIZE_OK","Test finalized",{testcase_id:r??"none"}),this.config.onFinalizeSuccess)try{await this.config.onFinalizeSuccess(r)}catch(u){this.log("warn","PIPELINE_FINALIZE_META_FAILED","Meta-rewrite after endTest failed",{error:String(u)})}t("finalize","done")}else t("finalize","skipped"),this.log("info","PIPELINE_FINALIZE_SKIPPED","Finalize skipped (evolve flow or first-run disabled)");if(r&&this.config.shareApiBaseUrl)try{o=await this.generateShareLink(r),this.log("info","PIPELINE_SHARE_OK","Share link generated",{share_id:o})}catch(c){this.log("warn","PIPELINE_SHARE_FAILED","Share link failed",{error:String(c)})}if(n&&i){let c=null;t("zip","running");try{await n.sealFn({testcaseId:r,shareId:o}),c=n.sealedPackPath?await bt(n.sealedPackPath):await ne(n.executionId,n.cwd),this.log("info","PIPELINE_EVIDENCE_SEALED","Evidence pack sealed",{execution_id:n.executionId}),this.log("info","PIPELINE_PACK_READ","Sealed pack read",{size_mb:+(c.length/1024/1024).toFixed(1)})}catch(a){let l=a instanceof Error?a.message:String(a);this.log("warn","PIPELINE_EVIDENCE_UPLOAD_SKIPPED","Evidence seal/read failed \u2014 uploading blob only",{execution_id:n.executionId,error:l})}if(c){t("zip","done",`${(c.length/1024/1024).toFixed(1)}MB`),t("presign","running");let a=await this.controller.getPresignedUrls(this.testId,this.config.sessionId,[ie(n.executionId),{key:"blob",content_type:"application/json",filename:`${this.config.commitId}.json`}]);this.log("info","PIPELINE_PRESIGN_OK","Presigned URLs received",{artifacts_url:a.urls.artifacts?.blob_url,blob_url:a.urls.blob?.blob_url}),t("presign","done"),t("upload","running"),this.log("info","PIPELINE_UPLOAD_START","Uploading pack and blob",{artifact_size_mb:+(c.length/1024/1024).toFixed(1),blob_size_kb:+(i.length/1024).toFixed(1)}),await Promise.all([k(a.urls.artifacts.upload_url,c,"application/zip"),k(a.urls.blob.upload_url,i,"application/json")]),this.log("info","PIPELINE_UPLOAD_OK","Upload complete"),t("upload","done")}else{t("zip","skipped"),t("presign","running");let a=await this.controller.getPresignedUrls(this.testId,this.config.sessionId,[{key:"blob",content_type:"application/json",filename:`${this.config.commitId}.json`}]);t("presign","done"),t("upload","running"),this.log("info","PIPELINE_UPLOAD_START","Uploading blob only (evidence skipped)",{blob_size_kb:+(i.length/1024).toFixed(1)}),await k(a.urls.blob.upload_url,i,"application/json"),this.log("info","PIPELINE_UPLOAD_OK","Blob upload complete (pack skipped)"),t("upload","done")}}let s;if(this.config.codeExport?.enabled&&r){let c=!1;try{await this.triggerCodeExport(r),this.log("info","PIPELINE_CODE_EXPORT_START","Code export triggered"),c=!0}catch(a){let l=a instanceof Error?a.message:String(a);this.log("error","PIPELINE_CODE_EXPORT_FAILED","Code export trigger failed; skipping poll",{error:l}),t("code_export","failed",`trigger failed: ${l}`)}if(c){t("code_export","running","Waiting for code generation\u2026");try{s=await this.pollAndDownloadCode(r,t),this.log("info","PIPELINE_CODE_EXPORT_OK","Code export complete",{dir:s}),t("code_export","done",s)}catch(a){let l=a instanceof Error?a.message:String(a);this.log("error","PIPELINE_CODE_EXPORT_FAILED","Code export failed",{error:l}),t("code_export","failed",l)}}}else t("code_export","skipped");return this.log("info","PIPELINE_COMPLETE","Pipeline complete"),{success:!0,testId:this.testId,testcaseId:r,shareId:o,codeExportDir:s}}catch(n){return{success:!1,testId:this.testId,error:n instanceof Error?n.message:String(n)}}}async runCodeExport(t,n){let i=n??this.config.onProgress,r=!1;try{await this.triggerCodeExport(t),this.log("info","PIPELINE_CODE_EXPORT_TRIGGER","Code export triggered",{testcase_id:t}),r=!0}catch(o){let s=o instanceof Error?o.message:String(o);this.log("error","PIPELINE_CODE_EXPORT_TRIGGER_FAILED","Code export trigger failed; skipping poll",{error:s}),i("code_export","failed",`trigger failed: ${s}`)}if(r){i("code_export","running","Waiting for code generation\u2026");try{let o=await this.pollAndDownloadCode(t,i);return this.log("info","PIPELINE_CODE_EXPORT_OK","Code export complete",{dir:o}),i("code_export","done",o),o}catch(o){let s=o instanceof Error?o.message:String(o);this.log("error","PIPELINE_CODE_EXPORT_FAILED","Code export failed",{error:s}),i("code_export","failed",s);return}}}deriveArchivedAttemptBlobs(t){try{let n=pt(t,{readActions:i=>this.readNdjsonFromFile(i),buildBlob:i=>this.buildExecutionEnvelope(i),objective:this.config.firstObjective,screenshotBaseUrl:this.config.screenshotBaseUrl??"",extMap:this.config.screenshotExtMap,log:(i,r,o,s)=>this.log(i,r,o,s)});n>0&&this.log("info","PIPELINE_ARCHIVED_ATTEMPTS","Nested retry-attempt blobs derived",{count:n})}catch(n){this.log("debug","PIPELINE_ARCHIVED_ATTEMPTS_FAILED","Nested attempt blob pass failed",{error:n instanceof Error?n.message:String(n)})}}collectNdjsonPerRun(){let t=[],n=this.config.runObjectives??[],i=this.config.runMetadata??[],r=this.config.evidence??this.config.evidenceRead;for(let o=0;o<this.config.runDirs.length;o++){let s=this.config.runDirs[o],c=n[o]||this.config.firstObjective,a=i[o],l=r?this.readNdjsonFromFile(E(r.packTestDir,"logs",`${r.runIndices?.[o]??o}-actions.ndjson`)):this.readNdjsonFromDir(s);if(l.length>0){let u=r?.runIndices?.[o]??o,_=this.config.runFlatIndex?.[u];t.push({objective:c,records:l,..._!==void 0?{flatIndex:_}:{},resultCode:a?.resultCode,reasonCode:a?.reasonCode,errorMessage:a?.errorMessage,summary:a?.summary,oneLiner:a?.oneLiner})}}if(t.length===0){let o=E(this.config.sessionDir,"runs");if(U(o))try{let c=te(o,{withFileTypes:!0}).filter(a=>a.isDirectory()).map(a=>a.name).sort();for(let a of c){let l=E(o,a),u=this.readNdjsonFromDir(l);u.length>0&&t.push({objective:this.config.firstObjective,records:u})}}catch{}}return t}readNdjsonFromDir(t){let n=[E(t,"run-test","actions.ndjson"),E(t,"actions.ndjson")];for(let i of n)if(U(i))return this.readNdjsonFromFile(i);return[]}readNdjsonFromFile(t){let n=[];if(!U(t))return n;this.log("debug","PIPELINE_COLLECT_READ","Reading NDJSON file",{path:t});let i=L(t,"utf-8");for(let r of i.split(`
|
|
5
|
-
`)){let o=r.trim();if(o)try{n.push(JSON.parse(o))}catch{}}return n}async generateShareLink(t){let n=`${this.config.shareApiBaseUrl}/lshs/api/v1.0/share-item/generate-sharable-link`;this.log("info","PIPELINE_SHARE_START","Requesting share link",{url:n,testcase_id:t});let i={method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({entityIds:[t],entityType:"Test Case Details",expiresAt:7})},r=!!this.config.authResolver;this.log("debug","PIPELINE_SHARE_AUTH","Share link auth config",{resolver:r,fallback_auth_type:typeof this.config.auth=="string"?"bearer":"basic",tms_user:this.config.tmsUsername});let o=r?await this.config.authResolver.fetch(n,i):await R(n,{...i,headers:{...i.headers,Authorization:this.buildAuthHeader()}});if(!o.ok)throw new Error(`Share link API failed: ${o.status} ${await o.text()}`);let s=await o.json();if(!s.shareId)throw new Error("Share link API returned no shareId");return s.shareId}async triggerCodeExport(t){if(!this.config.codeExport)throw new Error("triggerCodeExport called without resolved codeExport config");let{url:n,body:i}=G({tmsBaseUrl:this.config.tmsBaseUrl,testcaseId:t,codeExport:this.config.codeExport,mobile:this.config.mobile});this.log("info","PIPELINE_CODE_EXPORT_POST","Triggering code export",{url:n});let r={method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(i)},o=this.config.authResolver?await this.config.authResolver.fetch(n,r):await R(n,{...r,headers:{...r.headers,Authorization:this.buildAuthHeader()}});if(!o.ok)throw new Error(`Code export failed: ${o.status} ${await o.text()}`)}async pollAndDownloadCode(t,n){let i=K({tmsBaseUrl:this.config.tmsBaseUrl,testcaseId:t}),r=this.config.exitTimeoutMs??3e5,o=5e3,s=Date.now()+r;this.log("info","PIPELINE_CODE_EXPORT_POLL","Polling for code export",{url:i,timeout_ms:r});let c=(a,l)=>this.config.authResolver?this.config.authResolver.fetch(a,l):R(a,{...l,headers:{...l?.headers,Authorization:this.buildAuthHeader()}});for(;Date.now()<s;){let a=await c(i,{method:"GET",headers:{Accept:"application/json"}});if(!a.ok){let d=await a.text().catch(()=>"");throw this.log("warn","PIPELINE_CODE_EXPORT_POLL_FAILED","Code export poll non-200; skipping",{status:a.status,body:d.slice(0,200)}),new Error(`code export poll skipped: HTTP ${a.status}`)}let u=(await a.json()).data?.find(d=>d.code_name==="kane-cli-trigger");if(!u){this.log("debug","PIPELINE_CODE_EXPORT_WAITING","No kane-cli-trigger entry yet"),n("code_export","running","Waiting for code generation\u2026"),await this.sleep(o);continue}let _=u.status.toLowerCase();if(_==="in progress"||_==="in_progress"||_==="pending"){this.log("debug","PIPELINE_CODE_EXPORT_IN_PROGRESS","Code export in progress",{status:u.status}),n("code_export","running","Generating code\u2026"),await this.sleep(o);continue}if(!u.url||u.url.length===0)throw new Error(`Code export status=${u.status} but no files returned`);let p=this.config.codeExportDir??E(this.config.sessionDir,"code-export");F(p,{recursive:!0}),this.log("info","PIPELINE_CODE_EXPORT_DOWNLOAD","Downloading code files",{file_count:u.url.length,dir:p}),n("code_export","running",`Downloading ${u.url.length} files\u2026`);for(let d of u.url){let g=E(p,d.file_name),f=await R(d.file_url);if(!f.ok){this.log("warn","PIPELINE_CODE_EXPORT_FILE_FAILED","Failed to download file",{file_name:d.file_name,status:f.status});continue}let m=await f.text();w(g,m,"utf-8"),this.log("info","PIPELINE_CODE_EXPORT_FILE_SAVED","File saved",{file_name:d.file_name,size_bytes:m.length})}return p}throw new Error("Code export timed out")}sleep(t){return new Promise(n=>setTimeout(n,t))}buildAuthHeader(){return typeof this.config.auth=="string"?`Bearer ${this.config.auth}`:M(this.config.auth.username,this.config.auth.accessKey)}readAuthoredExecution(){let t=this.config.authoredExecutionPath;if(!t)return null;try{let n=L(t,"utf8");return JSON.parse(n),n}catch{return this.log("warn","PIPELINE_AUTHORED_BLOB_UNREADABLE","Authored execution.json missing/unreadable \u2014 pack gets this run's envelope",{path:t}),null}}loadAuthoredBlocks(){let t=this.config.blockAuthoredExecutionPath;if(!t)return[];try{let n=JSON.parse(L(t,"utf8"));return Array.isArray(n.instructions)?n.instructions:[]}catch(n){return this.log("warn","PIPELINE_AUTHORED_BLOB_UNREADABLE","Authored execution.json missing/unreadable \u2014 branches that did not run this time upload empty",{path:t,error:n instanceof Error?n.message:String(n)}),[]}}loadReplayOnlyPassthrough(){let t=this.config.replayOnlyPassthrough;if(!(!t||t.flatIndices.length===0))try{let n=JSON.parse(L(t.authoredExecutionPath,"utf8"));if(!Array.isArray(n.instructions))throw new Error("no instructions array");return{authoredInstructions:n.instructions,replayOnlyFlatIndices:new Set(t.flatIndices)}}catch(n){this.log("warn","PIPELINE_PASSTHROUGH_BLOB_UNREADABLE","Authored execution.json missing/unreadable \u2014 replay-only steps convert from this run's records",{path:t.authoredExecutionPath,flat_indices:t.flatIndices,error:n instanceof Error?n.message:String(n)});return}}buildExecutionEnvelope(t){let n=this.config.runStatuses.every(l=>l==="passed")?"success":"error",i=this.config.variableIds??{},r=[];if(this.config.variables)for(let[l,u]of Object.entries(this.config.variables)){if(u.secret)continue;let _=l.startsWith("global.")?l.slice(7):l;r.push({id:i[_]??0,name:_,value:u.value,session_value:u.value,is_persist:!1,environment_id:0,environment_name:"No Env"})}let o=[],s=l=>{let u=o.find(_=>_.name===l.name);u?u.value=l.value:o.push(l)},c=[],a=new Set;for(let l of this.collectNdjsonPerRun())for(let u of l.records)if(u.output_variable&&u.output_value!=null&&s({name:u.output_variable,value:String(u.output_value),value_type:"test_level",variable_description:"ANALYZE result"}),u.action_type==="upload_files"){let _=N(u.action_params);if(_){let p=_.media_id||_.media_url;if(!a.has(p)){a.add(p),c.push({media_url:_.media_url,media_id:_.media_id,name:_.name,type:_.type});let d=O(_.name);s({name:Q(_.name),value:d,value_type:"string",variable_description:`variable for ${d}`})}}}return{test_id:this.testId,version:"v4",auto_heal_version:this.config.apMode==="v2"?"AH2":"",session_id:this.config.sessionId,org_id:String(this.config.orgId),user_id:String(this.config.userId),url:this.config.firstUrl??"",start_timestamp:this.config.startedAt,end_timestamp:this.config.endedAt,status:n,commit_id:this.config.commitId,instructions:t,modules:[],uploaded_files:c,test_params:[],test_level_variables:JSON.stringify(o),test_global_variables:r,max_network_wait:0,wait_buffer:0,network_throttle:{},secrets:this.config.secrets??[],totp:[],environment_id:0,environment:"",mobile_browser:!1,native_popups:[],smartui:{},module_index:0}}};export{ne as a,ie as b,ht as c};
|
package/dist/chunk-KN65CUNT.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as S,c as M}from"./chunk-LBNADEQN.js";import{dirname as W,basename as N,join as d}from"path";function G(t){let e=N(t);return e.endsWith("_test.md")?e.slice(0,-8):e.endsWith("_module.md")?e.slice(0,-10):e.endsWith(".md")?e.slice(0,-3):e}function f(t){return d(W(t),`output-${G(t)}`)}function rt(t){return d(f(t),"Result.md")}function _(t){return d(f(t),".internal")}function w(t){return d(_(t),"meta.json")}function ot(t){return d(_(t),"execution.json")}function st(t,e,n){return d(f(t),`${e}-${n}-code`)}function dt(t){return d(f(t),"generated-code")}function at(t){return f(t)+".staging"}function J(t){return d(_(t),"steps")}function ct(t,e,n){return d(J(t),`${e}-${n}`)}import{writeFileSync as L,mkdirSync as H,readFileSync as U}from"fs";import{dirname as k}from"path";function j(t){try{return JSON.parse(U(w(t),"utf8"))}catch{return null}}function ft(t){let e=w(t.sourcePath);try{H(k(e),{recursive:!0})}catch(r){return process.stderr.write(`
|
|
3
|
-
\u26A0 Failed to create output directory.
|
|
4
|
-
${r.message}
|
|
5
|
-
Path: ${k(e)}
|
|
6
|
-
|
|
7
|
-
`),e}let n={commit_id:t.commitId};t.testId!==void 0&&(n.test_id=t.testId),t.testcaseId!==void 0&&(n.testcase_id=t.testcaseId),t.projectId!==void 0&&(n.project_id=t.projectId),t.folderId!==void 0&&(n.folder_id=t.folderId),t.orgId!==void 0&&(n.org_id=t.orgId),t.sessionName!==void 0&&(n.session_name=t.sessionName),t.plan!==void 0&&(n.plan=t.plan);try{L(e,JSON.stringify(n,null,2)+`
|
|
8
|
-
`,"utf8")}catch(r){process.stderr.write(`
|
|
9
|
-
\u26A0 Failed to write meta.json.
|
|
10
|
-
${r.message}
|
|
11
|
-
Path: ${e}
|
|
12
|
-
|
|
13
|
-
`)}return e}import{readFileSync as z,existsSync as q}from"fs";import{basename as C,dirname as B,isAbsolute as Q,resolve as F}from"path";import{createHash as O}from"crypto";function h(t){if(t==null)return null;if(Array.isArray(t))return t.map(h);if(typeof t=="object"){let e={};for(let n of Object.keys(t).sort()){let r=t[n];r!==void 0&&(e[n]=h(r))}return e}return t}function Y(t){if(t.body.kind!=="objective")throw new Error("stepMd5: only objective steps have an md5; @import rows do not");let e={...t.config??{},optional:t.optional??!1},n=JSON.stringify(h(e));return O("md5").update(t.body.text).update(`
|
|
14
|
-
`).update(n).digest("hex")}function I(t){let e={};for(let[r,o]of Object.entries(t.bindings??{}))e[r]={value:o.value,...o.secret===!0?{secret:!0}:{},...o.syntax?{syntax:o.syntax}:{}};let n=JSON.stringify(h({bindings:e,optional:t.optional}));return O("md5").update(t.path).update(`
|
|
15
|
-
`).update(n).digest("hex")}function bt(t){return Y({index:t.trace[t.trace.length-1].stepIndex,heading:t.trace[t.trace.length-1].heading,verifies:[],body:{kind:"objective",text:t.objective},config:t.parsedConfig,headingLine:1,optional:t.optional})}var T=["target","chrome_profile","cdp_endpoint","ws_endpoint","headless"],X=["app","no_reset","os_version","device_name"],Z=["mode","on_lock_conflict","tags","target","chrome_profile","cdp_endpoint","ws_endpoint","headless","app","no_reset","os_version","device_name"],g=class extends Error{constructor(e){super(e),this.name="TestMdResolveError"}};function v(t){let e=C(t);return e.endsWith("_test.md")?"test":e.endsWith("_module.md")?"module":"helper"}function St(t){let e=F(t),n=E(e),r=tt(n.global),o=[],a=[],s=[{file:e,kind:v(e)}],c=[];return $(n,a,o,[],e,{},s,c,{}),o.forEach((u,b)=>u.flatIndex=b+1),{rootPath:e,rootTitle:n.title,rootGlobal:n.global,rootSteps:n.steps,chrome:r,steps:o,unitFiles:s,warnings:c}}function Mt(t){let e=[];for(let n of t.unitFiles){if(n.kind!=="test")continue;let r=j(n.file);r&&e.push({file:n.file,...r.project_id?{project_id:String(r.project_id)}:{},...r.org_id?{org_id:String(r.org_id)}:{}})}return e}function E(t){if(!q(t))throw new g(`@import path not found: ${t}`);let e=z(t,"utf8");return S(t,e)}function $(t,e,n,r,o,a,s,c,p){if(e.includes(t.path)){let i=[...e,t.path].map(l=>C(l)).join(" \u2192 ");throw new g(`cyclic reference: ${i}`)}e.push(t.path);let u=r.length===0,b=t.global.variables??{};for(let i of Object.keys(a))if(Object.hasOwn(b,i))throw new g(`callsite binding '${i}' collides with a declared variable in ${t.path} (frontmatter variables are pinned; parameters are its undeclared names)`);let x=t.global;if(!u){let i={...t.global};for(let l of Z)i[l]!==void 0&&(c.push(`${t.path}: '${l}' is root-governed on imported units \u2014 ignored`),delete i[l]);i.url!==void 0&&(p.pending=String(i.url),delete i.url),x=i}let P=new Map;for(let i of t.steps){let l=i.body.kind!=="objective";if(i.optional&&l&&!u)throw new g(`intermediate-ref 'optional' is not supported in v1: ${t.path}:${i.headingLine}`);if(i.body.kind==="objective"){let y={file:t.path,stepIndex:i.index,heading:i.heading,optional:i.optional??!1},K=et(x,i.config,a),R={flatIndex:0,objective:i.body.text,sourceFile:t.path,trace:[...r,y],config:K,parsedConfig:i.config,optional:i.optional??!1,verifies:i.verifies,owningFile:t.path,unitKind:v(t.path),...i.replayOnly?{replayOnly:i.replayOnly}:{},...i.controlFlow?{controlFlow:i.controlFlow}:{},...i.block?{block:{...i.block,id:nt(i,n.length+1,P)}}:{}};p.pending&&(R.unitEntryUrl=p.pending,p.pending=void 0),n.push(R);continue}let V={file:t.path,stepIndex:i.index,heading:i.heading,optional:i.optional??!1,rowMd5:I({path:i.body.path,bindings:i.body.bindings,optional:i.optional??!1})},A=B(t.path),m=Q(i.body.path)?i.body.path:F(A,i.body.path),D=E(m);s.some(y=>y.file===m)||s.push({file:m,kind:v(m)}),$(D,e,n,[...r,V],o,i.body.bindings??{},s,c,p)}u||(p.pending=void 0),e.pop()}function tt(t){let e={};for(let n of T){if(n==="target"){let r=M(t);r!==void 0&&(e.target=r);continue}t[n]!==void 0&&(e[n]=t[n])}return e}function et(t,e,n){let r={};for(let[s,c]of Object.entries(t))T.includes(s)||X.includes(s)||(r[s]=c);let o={...r,...e??{}},a={...n,...t.variables??{},...e?.variables??{}};return Object.keys(a).length>0?o.variables=a:delete o.variables,o}function nt(t,e,n){let r=t.block.id;if(t.controlFlow==="if"||t.controlFlow==="while")return n.set(r,e),e;let o=n.get(r);if(o===void 0)throw new g(`block member before its opener in ${t.heading}`);return o}export{G as a,f as b,rt as c,_ as d,w as e,ot as f,st as g,dt as h,at as i,J as j,ct as k,I as l,bt as m,j as n,ft as o,g as p,v as q,St as r,Mt as s};
|