@testmuai/kane-cli 0.8.10 → 0.8.12
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-OWGOCHG3.js → ChatSurface-DALSIICW.js} +1 -1
- package/dist/{ChromeProfilePicker-QIMCWPPI.js → ChromeProfilePicker-ZMVZH3AK.js} +1 -1
- package/dist/{CliFeedbackPrompt-34E2AXS4.js → CliFeedbackPrompt-K66H7YE6.js} +1 -1
- package/dist/{CliUploadProgress-TRKOSED7.js → CliUploadProgress-5DZHZY4M.js} +1 -1
- package/dist/{ConfigView-XVKR7ATN.js → ConfigView-S5KBV62S.js} +1 -1
- package/dist/EvidenceViewOffer-UACWB3YJ.js +2 -0
- package/dist/FolderPicker-YH5TKMX3.js +2 -0
- package/dist/{InfoBox-QM5YEBMH.js → InfoBox-7PAM2FQH.js} +1 -1
- package/dist/{LinksBox-CSEDEZGU.js → LinksBox-2NVZ3FHJ.js} +1 -1
- package/dist/{ProfilesView-CZVPREIS.js → ProfilesView-SIUBF7IU.js} +1 -1
- package/dist/{ProjectPicker-F6FEWNMY.js → ProjectPicker-5NI554X3.js} +1 -1
- package/dist/{SaveSessionPrompt-RUSFOLBZ.js → SaveSessionPrompt-5OULBV5N.js} +1 -1
- package/dist/SingleShotApp-LA3EMPUK.js +2 -0
- package/dist/{SummaryBox-KOJXTZVZ.js → SummaryBox-GTGF3CBO.js} +1 -1
- package/dist/TestMdRunView-5MNKJJMS.js +2 -0
- package/dist/{TestrunEvidenceTable-KGVBX76H.js → TestrunEvidenceTable-7WBCOGYW.js} +1 -1
- package/dist/{WhoamiView-IOTBOCGK.js → WhoamiView-E2SVBHLC.js} +1 -1
- package/dist/{app-download-7AF6QL2C.js → app-download-SAXSYXIV.js} +1 -1
- package/dist/{auth-2HTDCT7X.js → auth-3LLVDHOJ.js} +1 -1
- package/dist/{binary-NKX3NEK7.js → binary-WSMIRJNC.js} +1 -1
- package/dist/{bind-IMBQFRKT.js → bind-A3M4PV4V.js} +2 -2
- package/dist/{bootstrap-TNFANHSS.js → bootstrap-QTVHGL45.js} +1 -1
- package/dist/bridge-E2C5VV3H.js +2 -0
- package/dist/{changelog-SQVLSCYO.js → changelog-CNYWOB2V.js} +1 -1
- package/dist/{chat-committer-K3NOTLOU.js → chat-committer-RAOIL2T6.js} +1 -1
- package/dist/{chunk-SAFETUCL.js → chunk-24QPDHRD.js} +1 -1
- package/dist/{chunk-C33E5XQM.js → chunk-2LXJ2ZM3.js} +1 -1
- package/dist/{chunk-CSCJLGIY.js → chunk-2MTAXT2U.js} +1 -1
- package/dist/{chunk-KUAFVRSR.js → chunk-3CCD434H.js} +1 -1
- package/dist/{chunk-ESHDTCSZ.js → chunk-3G3LY6BM.js} +1 -1
- package/dist/{chunk-EH3YMGQ7.js → chunk-3N2YOHD6.js} +1 -1
- package/dist/{chunk-QJNQN6ND.js → chunk-3OU2F34I.js} +1 -1
- package/dist/{chunk-GHL2A273.js → chunk-3XWKKSIM.js} +2 -2
- package/dist/chunk-43DM2I6Q.js +2 -0
- package/dist/chunk-4ASRA7CD.js +6 -0
- package/dist/{chunk-ETIQJIDI.js → chunk-4E4GJPEM.js} +1 -1
- package/dist/chunk-4O6XBS5G.js +5 -0
- package/dist/{chunk-NYQOYOBA.js → chunk-4T35SA2O.js} +1 -1
- package/dist/{chunk-NYSFEZUR.js → chunk-4TZSEC2C.js} +1 -1
- package/dist/{chunk-EKOL4WCC.js → chunk-5A4QG7ZM.js} +1 -1
- package/dist/{chunk-LUTRUSIV.js → chunk-5AHOVOWV.js} +1 -1
- package/dist/{chunk-ZFZB4CGJ.js → chunk-5FYO3PFG.js} +1 -1
- package/dist/chunk-5KLDW3ZW.js +85 -0
- package/dist/{chunk-USUFF3S6.js → chunk-6A47PRDS.js} +1 -1
- package/dist/{chunk-WAI5UHW3.js → chunk-75HF3GPO.js} +1 -1
- package/dist/{chunk-FOP6CJAM.js → chunk-7KAPHA56.js} +1 -1
- package/dist/{chunk-LTNMOEHT.js → chunk-7NXHVC7G.js} +1 -1
- package/dist/{chunk-47OUD76M.js → chunk-7R5K4IGS.js} +1 -1
- package/dist/{chunk-LKUWEQ5M.js → chunk-7RFGO3TH.js} +1 -1
- package/dist/{chunk-BUM367KV.js → chunk-AFNDJK2A.js} +1 -1
- package/dist/{chunk-PMOUXVUC.js → chunk-AHRL4E3M.js} +1 -1
- package/dist/{chunk-2ULZVQZV.js → chunk-APZCLVZD.js} +1 -1
- package/dist/{chunk-XTUSDGAB.js → chunk-ASYWKYTQ.js} +1 -1
- package/dist/chunk-BHSHGWBL.js +2 -0
- package/dist/{chunk-BZCVLCMG.js → chunk-COVIEKZN.js} +1 -1
- package/dist/chunk-CQ3ZQ5UK.js +26 -0
- package/dist/{chunk-HNNVVK2O.js → chunk-DYXYNH6X.js} +1 -1
- package/dist/{chunk-NJQNHD5P.js → chunk-F2CET54H.js} +2 -2
- package/dist/{chunk-SAKUG4KE.js → chunk-FAREJ4P2.js} +1 -1
- package/dist/{chunk-2BIPFAGX.js → chunk-FBYB3SRE.js} +1 -1
- package/dist/{chunk-TI7MR3PB.js → chunk-FHYG3QLL.js} +1 -1
- package/dist/{chunk-WXJQDLXX.js → chunk-G2Q2TP3O.js} +1 -1
- package/dist/chunk-G52YPXKT.js +4 -0
- package/dist/{chunk-B4CYIZP5.js → chunk-GNAPBOAJ.js} +1 -1
- package/dist/chunk-GRDYYYIQ.js +2 -0
- package/dist/{chunk-BG2AZQLI.js → chunk-H6NHARB4.js} +1 -1
- package/dist/chunk-H6VS5RYO.js +11 -0
- package/dist/{chunk-HE3ZKFRC.js → chunk-HPUQJRDX.js} +1 -1
- package/dist/{chunk-HXSOZWFL.js → chunk-HWHLKBUT.js} +1 -1
- package/dist/{chunk-BQSLPF5M.js → chunk-I57TM22L.js} +1 -1
- package/dist/{chunk-GOF5PQ5T.js → chunk-IE4BCGUE.js} +1 -1
- package/dist/{chunk-ML2E3JGK.js → chunk-IGW77FMB.js} +1 -1
- package/dist/{chunk-ZDAO5D6D.js → chunk-JDGBRACP.js} +1 -1
- package/dist/{chunk-SXX7ZE6L.js → chunk-JOATASPP.js} +3 -3
- package/dist/chunk-KRL2BDI5.js +8 -0
- package/dist/{chunk-CKNVMB4E.js → chunk-L2BCQQLJ.js} +1 -1
- package/dist/{chunk-CXKWVHZK.js → chunk-L7GAZQYL.js} +1 -1
- package/dist/{chunk-RP7FW23G.js → chunk-LLY7TQSI.js} +1 -1
- package/dist/{chunk-W7PBJXLJ.js → chunk-M4WSRYRA.js} +1 -1
- package/dist/{chunk-SU3QKERU.js → chunk-MMQLVGUJ.js} +1 -1
- package/dist/{chunk-M6SFFAAQ.js → chunk-NBXYL2JT.js} +6 -6
- package/dist/{chunk-WEJA3EVI.js → chunk-NJJQL54J.js} +1 -1
- package/dist/{chunk-H4WIA4IP.js → chunk-NP3VGFZM.js} +1 -1
- package/dist/{chunk-AWEUKXZQ.js → chunk-NSD2H67E.js} +1 -1
- package/dist/{chunk-6S3Z3WPF.js → chunk-O7U5BVX5.js} +2 -2
- package/dist/chunk-OZMYKG6E.js +6 -0
- package/dist/{chunk-YUA2VDWH.js → chunk-QZRHXGNI.js} +1 -1
- package/dist/{chunk-JGZWR3CR.js → chunk-RV7Q4RUV.js} +2 -2
- package/dist/{chunk-NDKHC6KL.js → chunk-SA6EDKUF.js} +1 -1
- package/dist/chunk-SACCB44S.js +21 -0
- package/dist/chunk-T4OJX2GZ.js +15 -0
- package/dist/{chunk-5EKTQY2S.js → chunk-TLFNUXKS.js} +1 -1
- package/dist/chunk-U27OWZPW.js +368 -0
- package/dist/{chunk-5YBKKWJA.js → chunk-U2CIXGZR.js} +1 -1
- package/dist/{chunk-YHL5NA43.js → chunk-UDFDTFBL.js} +1 -1
- package/dist/{chunk-5Q3W3SX7.js → chunk-UZXCCO7V.js} +1 -1
- package/dist/{chunk-DF3DUGJS.js → chunk-VDM3TWF6.js} +4 -4
- package/dist/{chunk-YXPWGIQ2.js → chunk-VG7BTA5G.js} +1 -1
- package/dist/chunk-WD52ZNQY.js +2 -0
- package/dist/{chunk-D6566A2X.js → chunk-WHYEXCTG.js} +1 -1
- package/dist/{chunk-FH6EDP77.js → chunk-WMVPJWWA.js} +4 -4
- package/dist/{chunk-ZXTVP4WX.js → chunk-X6APRDUM.js} +2 -2
- package/dist/{chunk-KRKGZ2ZW.js → chunk-XS2LZFCH.js} +1 -1
- package/dist/{chunk-P3UGM74Z.js → chunk-XWO5MDEU.js} +1 -1
- package/dist/{chunk-RJ4YFH7K.js → chunk-YF26DH4Z.js} +1 -1
- package/dist/{chunk-OSRRMY6M.js → chunk-YTAAF62A.js} +1 -1
- package/dist/{chunk-UEANTGQS.js → chunk-ZVJGHQNG.js} +1 -1
- package/dist/chunk-ZVZHE7KH.js +27 -0
- package/dist/{chunk-WAWMIKSI.js → chunk-ZXN67F4U.js} +9 -9
- package/dist/{chunk-RSNG5PBN.js → chunk-ZZI4Y3CX.js} +1 -1
- package/dist/{config-UF635MC4.js → config-HUK7V364.js} +1 -1
- package/dist/{credentials-3KBLEVJH.js → credentials-6DP4KAMJ.js} +1 -1
- package/dist/{deps-bundle-WGF4YYGO.js → deps-bundle-PZNXSKLC.js} +1 -1
- package/dist/{deps-resolve-DVJPU4YX.js → deps-resolve-62XK3LKV.js} +1 -1
- package/dist/{dispatch-YTIJKX6C.js → dispatch-7JCKGQVC.js} +1 -1
- package/dist/{doctor-2KRK42L2.js → doctor-ZQQ4VMPY.js} +1 -1
- package/dist/{docx-convert-JMUMT5C4.js → docx-convert-BIV5T7F5.js} +1 -1
- package/dist/effective-decisions-UNE2TFVA.js +2 -0
- package/dist/{evidence-CDCFEYS7.js → evidence-YAXIWZ6A.js} +1 -1
- package/dist/{evolve-cmd-L3JIBYP5.js → evolve-cmd-5ACHYQPE.js} +1 -1
- package/dist/{extract-bind-VFQWACVO.js → extract-bind-BF2G6AS6.js} +2 -2
- package/dist/{extract-cmd-2OFQBBJ4.js → extract-cmd-IPBCCR3T.js} +1 -1
- package/dist/{gaps-cmd-JIUM5YDY.js → gaps-cmd-3WXL6PAW.js} +1 -1
- package/dist/{generate-headless-B35UUR5A.js → generate-headless-CLMSXEAS.js} +2 -2
- package/dist/index.js +130 -125
- package/dist/{ingest-cmd-LAUSXSI3.js → ingest-cmd-KP5M6XTA.js} +1 -1
- package/dist/install-5VWCH5GW.js +2 -0
- package/dist/{interactive-bind-OWASLPBQ.js → interactive-bind-MOV2VWHJ.js} +3 -3
- package/dist/{list-commands-SLQDF6AT.js → list-commands-KUDSKVP5.js} +1 -1
- package/dist/login-flow-GZ3XHVCS.js +2 -0
- package/dist/{mobile-prompts-6MGOXIKX.js → mobile-prompts-WJVFBWW5.js} +1 -1
- package/dist/objective-variable-gate-GCQYYM77.js +2 -0
- package/dist/persist-recorded-session-MHLD4A32.js +3 -0
- package/dist/pipeline-G7KWRK2G.js +2 -0
- package/dist/prepare-target-SQ5IGKXD.js +2 -0
- package/dist/{reconcile-cmd-MR2MSVZ5.js → reconcile-cmd-NI3AYU3Y.js} +1 -1
- package/dist/{reconcile-deps-RYO67ZXY.js → reconcile-deps-DCHUFIEC.js} +2 -2
- package/dist/{reconcile-engine-PRH6YIAZ.js → reconcile-engine-QXUKUKSL.js} +1 -1
- package/dist/{recording-banner-CH2SZ4IU.js → recording-banner-4H4AL6YN.js} +1 -1
- package/dist/registry-R6QNPI5E.js +2 -0
- package/dist/{replay-policy-CVQ6OJX5.js → replay-policy-A62KXE6Y.js} +1 -1
- package/dist/{require-project-folder-XY77JKAQ.js → require-project-folder-G2G4WKWW.js} +1 -1
- package/dist/{resolve-run-intent-JFIGIF72.js → resolve-run-intent-MZRPYN4V.js} +1 -1
- package/dist/{resolver-6VDNZ6KP.js → resolver-X5NHNX5O.js} +1 -1
- package/dist/run-PBS2J4N4.js +2 -0
- package/dist/run-VTUYLPSG.js +2 -0
- package/dist/{run-test-md-OLGWTC4I.js → run-test-md-4VRH7FU5.js} +2 -2
- package/dist/{skill-installer-NT7ZT6O4.js → skill-installer-WPW6NDCR.js} +1 -1
- package/dist/{spawner-YQSAPZR4.js → spawner-R3XOP3GP.js} +1 -1
- package/dist/tcg-generate-HIC5AA3L.js +2 -0
- package/dist/testmd-actions-VOSP7L74.js +2 -0
- package/dist/testmd-sync-GNCDKPQN.js +2 -0
- package/dist/token-refresh-GSFVJ6GU.js +2 -0
- package/dist/{validate-basic-OMAFYHME.js → validate-basic-YNGP5JFB.js} +1 -1
- package/dist/variable-receipt-2VCUG7NN.js +2 -0
- package/dist/{verdicts-KEBSV2NL.js → verdicts-PRXUKSDV.js} +1 -1
- package/dist/{version-check-FRVZSYNF.js → version-check-GUGRBTIH.js} +1 -1
- package/dist/{walk-session-LNFOCPJ6.js → walk-session-G3DLBR24.js} +1 -1
- package/dist/{with-telemetry-4ATZC6IR.js → with-telemetry-5Y2CVPXK.js} +1 -1
- package/package.json +11 -11
- package/dist/EvidenceViewOffer-M2TGMSNE.js +0 -2
- package/dist/FolderPicker-WZTNQ5IV.js +0 -2
- package/dist/SingleShotApp-WBFVUZFP.js +0 -2
- package/dist/TestMdRunView-BEXL7TIN.js +0 -2
- package/dist/bridge-SXYWYZDO.js +0 -2
- package/dist/chunk-724NYDMU.js +0 -27
- package/dist/chunk-CPGUTSUD.js +0 -6
- package/dist/chunk-EKCGZXZE.js +0 -2
- package/dist/chunk-I3OVXNBW.js +0 -7
- package/dist/chunk-I5KYZHJ5.js +0 -71
- package/dist/chunk-IPEA7ZOF.js +0 -8
- package/dist/chunk-PCVTSFIX.js +0 -363
- package/dist/chunk-SXUQBPQ6.js +0 -2
- package/dist/chunk-TGPI7VDR.js +0 -21
- package/dist/chunk-VIJUT5AR.js +0 -26
- package/dist/chunk-WHEWZR2C.js +0 -15
- package/dist/chunk-XIGTZTFP.js +0 -5
- package/dist/effective-decisions-DRM3JSR4.js +0 -2
- package/dist/install-ENSOEMSX.js +0 -2
- package/dist/login-flow-YKQUXP75.js +0 -2
- package/dist/persist-recorded-session-RKG7HOEW.js +0 -3
- package/dist/pipeline-M25AR7RM.js +0 -2
- package/dist/prepare-target-UGACDQEJ.js +0 -2
- package/dist/registry-ARR5ITIQ.js +0 -2
- package/dist/run-GTBYWSLW.js +0 -2
- package/dist/run-UETW72YU.js +0 -2
- package/dist/tcg-generate-D73BMKOE.js +0 -2
- package/dist/testmd-actions-XPYXS36F.js +0 -2
- package/dist/token-refresh-2XVSIFRM.js +0 -2
|
@@ -0,0 +1,368 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import{a as nt}from"./chunk-ZKSN2SJ7.js";import{a as st,b as he}from"./chunk-N7Z7BQYO.js";import{a as Z,b as We,e as pe,f as ge,g as Ke,h as Ze}from"./chunk-G2Q2TP3O.js";import{a as ze,c as Je,d as Ye,e as fe,f as Xe}from"./chunk-5G22NOZK.js";import{a as Fe,b as Ge,c as Ve}from"./chunk-2LXJ2ZM3.js";import{a as Le,b as Me,c as Be}from"./chunk-BB2W35TW.js";import{a as Qe}from"./chunk-GX3FPJUG.js";import{a as et,b as tt}from"./chunk-JUJ4SAGH.js";import{a as He}from"./chunk-L2TV4G56.js";import{c as Ue}from"./chunk-IVQX3AKL.js";import{a as je,e as qe}from"./chunk-EV64VI66.js";import{c as it}from"./chunk-JDGBRACP.js";import{b as Oe,c as Pe,d as re,f as Ne}from"./chunk-GRDYYYIQ.js";import{b as Se,c as De,e as $e,f as Ee,g as Re,h as de,k as me,l as ue}from"./chunk-NP3VGFZM.js";import{d as xe}from"./chunk-KRL2BDI5.js";import{b as ce}from"./chunk-VZ7KXRXB.js";import{a as ke,b as le}from"./chunk-IDX3TOPY.js";import{C as U}from"./chunk-W3Z7AZNT.js";import{g as Ie}from"./chunk-XMTSHHYQ.js";import{a as Ce,e as Ae,f as Te}from"./chunk-DBIBROYW.js";import{d as Q,e as Y}from"./chunk-AKX4VRRR.js";import{a as we}from"./chunk-5EOX4MEY.js";import{mkdirSync as Vt,appendFileSync as Ut,rmdirSync as St}from"fs";import{randomBytes as Ht}from"crypto";import{dirname as ae,join as ve,relative as zt}from"path";function rt(t,e){let n=[];for(let i of e??[]){let o=t.resolve(i.ref)?.tip??null;o!==i.cid&&n.push({ref:i.ref,pinned:i.cid,now:o})}return n}import{existsSync as be,readFileSync as _e,readdirSync as Et}from"fs";import{join as se}from"path";var at=`
|
|
3
|
+
version: 1
|
|
4
|
+
techniques:
|
|
5
|
+
- id: eqp
|
|
6
|
+
name: "Equivalence partitioning"
|
|
7
|
+
applies_hint: "any constrained input"
|
|
8
|
+
emits: [absolute, forbidden-presence]
|
|
9
|
+
- id: bva
|
|
10
|
+
name: "Boundary value analysis"
|
|
11
|
+
applies_hint: "input has an ordered range or length"
|
|
12
|
+
emits: [absolute, forbidden-presence]
|
|
13
|
+
- id: negative
|
|
14
|
+
name: "Negative / error"
|
|
15
|
+
applies_hint: "any input or action that can fail"
|
|
16
|
+
emits: [forbidden-presence]
|
|
17
|
+
- id: state_flow
|
|
18
|
+
name: "State / flow"
|
|
19
|
+
applies_hint: "the AC sits in a multi-step flow"
|
|
20
|
+
emits: [state-transition]
|
|
21
|
+
- id: crud
|
|
22
|
+
name: "CRUD round-trip"
|
|
23
|
+
applies_hint: "AC touches a persisted resource"
|
|
24
|
+
emits: [delta, presence, forbidden-presence]
|
|
25
|
+
- id: auth
|
|
26
|
+
name: "Auth / permission"
|
|
27
|
+
applies_hint: "AC is behind a gate or role"
|
|
28
|
+
emits: [forbidden-presence, presence]
|
|
29
|
+
- id: api_contract
|
|
30
|
+
name: "API-contract"
|
|
31
|
+
applies_hint: "surface is REST/GraphQL"
|
|
32
|
+
emits: [absolute]
|
|
33
|
+
- id: concurrency
|
|
34
|
+
name: "Concurrency / race"
|
|
35
|
+
applies_hint: "high-risk (money / data-loss) or shared-resource AC"
|
|
36
|
+
emits: [state-transition, forbidden-presence]
|
|
37
|
+
- id: idempotency
|
|
38
|
+
name: "Idempotency / retry"
|
|
39
|
+
applies_hint: "money or write operations"
|
|
40
|
+
emits: [delta]
|
|
41
|
+
- id: i18n
|
|
42
|
+
name: "i18n / l10n"
|
|
43
|
+
applies_hint: "AC renders user text or formats numbers/dates/currency"
|
|
44
|
+
emits: [presence, absolute]
|
|
45
|
+
- id: a11y
|
|
46
|
+
name: "a11y"
|
|
47
|
+
applies_hint: "any rendered surface"
|
|
48
|
+
emits: [presence, absolute]
|
|
49
|
+
- id: responsiveness
|
|
50
|
+
name: "Responsiveness / layout"
|
|
51
|
+
applies_hint: "rendered surface"
|
|
52
|
+
emits: [presence, forbidden-presence]
|
|
53
|
+
- id: empty_state
|
|
54
|
+
name: "Empty / null / zero state"
|
|
55
|
+
applies_hint: "list / search / collection AC"
|
|
56
|
+
emits: [presence]
|
|
57
|
+
- id: overflow_underflow
|
|
58
|
+
name: "Overflow / underflow"
|
|
59
|
+
applies_hint: "numeric or quantity AC (R9: explicit underflow/overflow)"
|
|
60
|
+
emits: [forbidden-presence]
|
|
61
|
+
- id: persistence
|
|
62
|
+
name: "Persistence / refresh"
|
|
63
|
+
applies_hint: "AC asserts durable state"
|
|
64
|
+
emits: [absolute]
|
|
65
|
+
- id: temporal
|
|
66
|
+
name: "Time / timezone / expiry"
|
|
67
|
+
applies_hint: "AC involves dates, TTLs, schedules"
|
|
68
|
+
emits: [state-transition, forbidden-presence]
|
|
69
|
+
- id: currency
|
|
70
|
+
name: "Currency / rounding"
|
|
71
|
+
applies_hint: "money AC"
|
|
72
|
+
emits: [absolute]
|
|
73
|
+
- id: pagination
|
|
74
|
+
name: "Pagination / sort / filter"
|
|
75
|
+
applies_hint: "list / search AC"
|
|
76
|
+
emits: [absolute, presence]
|
|
77
|
+
- id: file_media
|
|
78
|
+
name: "File / media"
|
|
79
|
+
applies_hint: "upload surface"
|
|
80
|
+
emits: [forbidden-presence]
|
|
81
|
+
- id: notification
|
|
82
|
+
name: "Notification / async-effect"
|
|
83
|
+
applies_hint: "AC produces an out-of-band effect (email/SMS/push)"
|
|
84
|
+
emits: [presence, delta]
|
|
85
|
+
`;var ot={"web-form":`
|
|
86
|
+
id: web-form
|
|
87
|
+
name: "Web form"
|
|
88
|
+
version: 1
|
|
89
|
+
applies_when: >
|
|
90
|
+
The AC concerns a data-entry form: input fields, required fields, submit,
|
|
91
|
+
validation messages.
|
|
92
|
+
candidate_checks:
|
|
93
|
+
- id: field-validation
|
|
94
|
+
family: negative
|
|
95
|
+
measurable_example: "Enter 'abc' in a numeric quantity field \u2192 inline error 'must be a number', value not accepted"
|
|
96
|
+
emits: forbidden-presence
|
|
97
|
+
- id: required-fields
|
|
98
|
+
family: negative
|
|
99
|
+
measurable_example: "Submit with a required field empty \u2192 submit blocked, field flagged"
|
|
100
|
+
emits: forbidden-presence
|
|
101
|
+
- id: formats
|
|
102
|
+
family: negative
|
|
103
|
+
measurable_example: "Email without @ rejected; valid accepted"
|
|
104
|
+
emits: forbidden-presence
|
|
105
|
+
- id: empty-state
|
|
106
|
+
family: empty_state
|
|
107
|
+
measurable_example: "First load: no stale values, placeholders shown"
|
|
108
|
+
emits: presence
|
|
109
|
+
- id: error-messages
|
|
110
|
+
family: negative
|
|
111
|
+
measurable_example: "Each error is specific and tied to its field"
|
|
112
|
+
emits: presence
|
|
113
|
+
- id: a11y
|
|
114
|
+
family: a11y
|
|
115
|
+
measurable_example: "Every input has a programmatic label; keyboard-only submit works"
|
|
116
|
+
emits: presence
|
|
117
|
+
- id: responsiveness
|
|
118
|
+
family: responsiveness
|
|
119
|
+
measurable_example: "No field overlap at 1280/768/375 px"
|
|
120
|
+
emits: forbidden-presence
|
|
121
|
+
`,"rest-graphql-api":`
|
|
122
|
+
id: rest-graphql-api
|
|
123
|
+
name: "REST / GraphQL API"
|
|
124
|
+
version: 1
|
|
125
|
+
applies_when: >
|
|
126
|
+
The surface is an HTTP/GraphQL endpoint.
|
|
127
|
+
candidate_checks:
|
|
128
|
+
- id: response-shape
|
|
129
|
+
family: api_contract
|
|
130
|
+
measurable_example: "Body validates against the declared schema"
|
|
131
|
+
emits: absolute
|
|
132
|
+
- id: status-codes
|
|
133
|
+
family: api_contract
|
|
134
|
+
measurable_example: "GET 200, POST 201, missing 404, bad 400, unauth 401"
|
|
135
|
+
emits: absolute
|
|
136
|
+
- id: verbs
|
|
137
|
+
family: idempotency
|
|
138
|
+
measurable_example: "PUT is idempotent, POST is not"
|
|
139
|
+
emits: delta
|
|
140
|
+
- id: bad-payloads
|
|
141
|
+
family: negative
|
|
142
|
+
measurable_example: "Malformed JSON \u2192 400, never 500"
|
|
143
|
+
emits: absolute
|
|
144
|
+
- id: idempotency
|
|
145
|
+
family: idempotency
|
|
146
|
+
measurable_example: "Same POST with idempotency-key twice \u2192 one effect"
|
|
147
|
+
emits: delta
|
|
148
|
+
- id: pagination
|
|
149
|
+
family: pagination
|
|
150
|
+
measurable_example: "Page beyond last \u2192 empty list, not error; cursor stable"
|
|
151
|
+
emits: absolute
|
|
152
|
+
- id: versioning
|
|
153
|
+
family: api_contract
|
|
154
|
+
measurable_example: "v1 contract unchanged after v2 ships"
|
|
155
|
+
emits: absolute
|
|
156
|
+
- id: rate-limits
|
|
157
|
+
family: api_contract
|
|
158
|
+
measurable_example: "Over the limit \u2192 429 with retry-after"
|
|
159
|
+
emits: absolute
|
|
160
|
+
`,"mobile-native":`
|
|
161
|
+
id: mobile-native
|
|
162
|
+
name: "Mobile native"
|
|
163
|
+
version: 2
|
|
164
|
+
applies_when: >
|
|
165
|
+
iOS/Android native surface.
|
|
166
|
+
candidate_checks:
|
|
167
|
+
- id: interruptions
|
|
168
|
+
family: state_flow
|
|
169
|
+
measurable_example: "Incoming call mid-flow \u2192 state preserved on return \u2014 no device control: promises here become gaps, not tests"
|
|
170
|
+
emits: state-transition
|
|
171
|
+
- id: network-transitions
|
|
172
|
+
family: state_flow
|
|
173
|
+
measurable_example: "wifi\u2192cellular\u21924G drop: no data loss, graceful retry \u2014 no connectivity control: promises here become gaps, not tests"
|
|
174
|
+
emits: state-transition
|
|
175
|
+
- id: permissions
|
|
176
|
+
family: negative
|
|
177
|
+
measurable_example: "Deny camera \u2192 feature degrades, no crash \u2014 the OS dialog is tappable UI (exercise Allow/Deny on screen); only programmatic grant/deny or pre-seeded permission state has no control"
|
|
178
|
+
emits: forbidden-presence
|
|
179
|
+
- id: orientation
|
|
180
|
+
family: persistence
|
|
181
|
+
measurable_example: "Rotate mid-form \u2192 input preserved"
|
|
182
|
+
emits: absolute
|
|
183
|
+
- id: deep-links
|
|
184
|
+
family: state_flow
|
|
185
|
+
measurable_example: "Cold-start deep link lands on the right screen with auth \u2014 legal when the test states the exact link target"
|
|
186
|
+
emits: state-transition
|
|
187
|
+
- id: state-persistence
|
|
188
|
+
family: persistence
|
|
189
|
+
measurable_example: "Kill + relaunch \u2192 resume where left off"
|
|
190
|
+
emits: absolute
|
|
191
|
+
- id: localization
|
|
192
|
+
family: i18n
|
|
193
|
+
measurable_example: "Device locale switch reformats and re-translates \u2014 no device control: promises here become gaps, not tests"
|
|
194
|
+
emits: presence
|
|
195
|
+
`,"stateful-flow":`
|
|
196
|
+
id: stateful-flow
|
|
197
|
+
name: "Stateful flow"
|
|
198
|
+
version: 1
|
|
199
|
+
applies_when: >
|
|
200
|
+
Multi-step wizard / checkout / onboarding.
|
|
201
|
+
candidate_checks:
|
|
202
|
+
- id: valid-transitions
|
|
203
|
+
family: state_flow
|
|
204
|
+
measurable_example: "Each step advances only when its precondition is met"
|
|
205
|
+
emits: state-transition
|
|
206
|
+
- id: invalid-transitions
|
|
207
|
+
family: state_flow
|
|
208
|
+
measurable_example: "Can't jump to step 3 with step 2 incomplete"
|
|
209
|
+
emits: forbidden-presence
|
|
210
|
+
- id: back-and-abandon
|
|
211
|
+
family: state_flow
|
|
212
|
+
measurable_example: "Back from step 3, then abandon \u2192 no partial commit"
|
|
213
|
+
emits: forbidden-presence
|
|
214
|
+
- id: refresh-persistence
|
|
215
|
+
family: persistence
|
|
216
|
+
measurable_example: "Reload at step 2 \u2192 still at step 2 with data"
|
|
217
|
+
emits: absolute
|
|
218
|
+
- id: resume
|
|
219
|
+
family: persistence
|
|
220
|
+
measurable_example: "Return later \u2192 resume the saved flow"
|
|
221
|
+
emits: absolute
|
|
222
|
+
- id: double-submission
|
|
223
|
+
family: idempotency
|
|
224
|
+
measurable_example: "Double-click submit \u2192 exactly one submission"
|
|
225
|
+
emits: delta
|
|
226
|
+
`,"data-crud":`
|
|
227
|
+
id: data-crud
|
|
228
|
+
name: "Data CRUD"
|
|
229
|
+
version: 1
|
|
230
|
+
applies_when: >
|
|
231
|
+
A persisted record.
|
|
232
|
+
candidate_checks:
|
|
233
|
+
- id: crud-round-trip
|
|
234
|
+
family: crud
|
|
235
|
+
measurable_example: "Create \u2192 read shows it \u2192 update \u2192 read shows the change \u2192 delete \u2192 read 404"
|
|
236
|
+
emits: state-transition
|
|
237
|
+
- id: retry-safety
|
|
238
|
+
family: idempotency
|
|
239
|
+
measurable_example: "Retried create with same key \u2192 one row"
|
|
240
|
+
emits: delta
|
|
241
|
+
- id: concurrency-lost-update
|
|
242
|
+
family: concurrency
|
|
243
|
+
measurable_example: "Two writers, last must not silently clobber \u2192 conflict surfaced"
|
|
244
|
+
emits: forbidden-presence
|
|
245
|
+
- id: delete-cascade
|
|
246
|
+
family: crud
|
|
247
|
+
measurable_example: "Delete parent \u2192 children handled per rule"
|
|
248
|
+
emits: state-transition
|
|
249
|
+
- id: referential-consistency
|
|
250
|
+
family: crud
|
|
251
|
+
measurable_example: "Can't create a child for a missing parent"
|
|
252
|
+
emits: forbidden-presence
|
|
253
|
+
`,"auth-gated":`
|
|
254
|
+
id: auth-gated
|
|
255
|
+
name: "Auth gated"
|
|
256
|
+
version: 1
|
|
257
|
+
applies_when: >
|
|
258
|
+
Behind login/role.
|
|
259
|
+
candidate_checks:
|
|
260
|
+
- id: login-gate
|
|
261
|
+
family: auth
|
|
262
|
+
measurable_example: "Anonymous \u2192 redirected to login, not the resource"
|
|
263
|
+
emits: forbidden-presence
|
|
264
|
+
- id: role-permission-matrix
|
|
265
|
+
family: auth
|
|
266
|
+
measurable_example: "For each role \xD7 action: allowed/denied as specified"
|
|
267
|
+
emits: absolute
|
|
268
|
+
- id: cross-user-record
|
|
269
|
+
family: auth
|
|
270
|
+
measurable_example: "User A cannot read/edit user B's record by id"
|
|
271
|
+
emits: forbidden-presence
|
|
272
|
+
- id: token-session-expiry
|
|
273
|
+
family: auth
|
|
274
|
+
measurable_example: "Expired token \u2192 401/redirect, no stale access"
|
|
275
|
+
emits: forbidden-presence
|
|
276
|
+
- id: privilege-escalation
|
|
277
|
+
family: auth
|
|
278
|
+
measurable_example: "Non-admin cannot reach an admin action by direct URL/API"
|
|
279
|
+
emits: forbidden-presence
|
|
280
|
+
`,"search-list":`
|
|
281
|
+
id: search-list
|
|
282
|
+
name: "Search / list"
|
|
283
|
+
version: 1
|
|
284
|
+
applies_when: >
|
|
285
|
+
Search results / list views.
|
|
286
|
+
candidate_checks:
|
|
287
|
+
- id: pagination
|
|
288
|
+
family: pagination
|
|
289
|
+
measurable_example: "First/last/empty page correct; total accurate"
|
|
290
|
+
emits: absolute
|
|
291
|
+
- id: sorting
|
|
292
|
+
family: pagination
|
|
293
|
+
measurable_example: "Sort asc/desc actually orders; ties stable"
|
|
294
|
+
emits: absolute
|
|
295
|
+
- id: filtering
|
|
296
|
+
family: pagination
|
|
297
|
+
measurable_example: "Each filter narrows correctly; combined filters AND"
|
|
298
|
+
emits: absolute
|
|
299
|
+
- id: empty-state
|
|
300
|
+
family: empty_state
|
|
301
|
+
measurable_example: "No results \u2192 friendly empty state, not blank/error"
|
|
302
|
+
emits: presence
|
|
303
|
+
- id: invalid-input
|
|
304
|
+
family: negative
|
|
305
|
+
measurable_example: "Garbage query \u2192 no crash, sane result"
|
|
306
|
+
emits: forbidden-presence
|
|
307
|
+
- id: length-limits
|
|
308
|
+
family: bva
|
|
309
|
+
measurable_example: "Max-length query handled"
|
|
310
|
+
emits: absolute
|
|
311
|
+
- id: locale
|
|
312
|
+
family: i18n
|
|
313
|
+
measurable_example: "Locale-correct collation/casing"
|
|
314
|
+
emits: presence
|
|
315
|
+
`};var ct=`
|
|
316
|
+
version: 3
|
|
317
|
+
principles:
|
|
318
|
+
- "Each step is one complete OBJECTIVE the executing agent achieves autonomously \u2014 state the goal and the path, never low-level actions (the agent emits its own actions)."
|
|
319
|
+
- "One objective (or tightly-related items of one goal) per step; unrelated goals split."
|
|
320
|
+
- "Verbose path: name site or app, page or screen, section, panel, control, state \u2014 'On the search results page for Noida, in the filter panel's Budget section, set min to 50L and max to 1Cr'."
|
|
321
|
+
- "Self-contained: concrete values inline; never 'as defined in the scenario' \u2014 the agent cannot see the graph."
|
|
322
|
+
- "Two surfaces: WEB tests run in the kane-cli browser agent; MOBILE tests run in the kane-cli mobile agent on a local Android emulator / iOS simulator (native app). One surface per test; imports/reuse only same-surface units."
|
|
323
|
+
- "In scope: web-browser behavior, mobile emulator/simulator native-app behavior, and direct API calls. NOT in scope: out-of-band email/SMS, backend state with no web, app-screen, or API surface."
|
|
324
|
+
verification:
|
|
325
|
+
- "Phrase checks against what the test's own surface can observe:"
|
|
326
|
+
- "WEB Visual \u2014 visible text, labels, counts, prices ('verify the price is 29.99', 'the Sold out label is shown')."
|
|
327
|
+
- "WEB Textual/DOM \u2014 element states/attributes ('the Add button is disabled', 'the placeholder of the search box is \u2026')."
|
|
328
|
+
- "WEB URL \u2014 'URL contains /checkout'. Title \u2014 'page title contains \u2026'."
|
|
329
|
+
- "WEB DevTools/Network \u2014 'no API calls returned 5xx', 'the POST /api/login returned 200'. Console \u2014 'no console errors'. Performance \u2014 'LCP under 2500ms'. Cookies/localStorage \u2014 'a cookie named session_id exists'."
|
|
330
|
+
- "MOBILE Visual \u2014 on-screen text, labels, counts, states ('the Upcoming list shows 2 reservations', 'a Booking cancelled toast is shown')."
|
|
331
|
+
- "MOBILE Element \u2014 native accessibility-tree states ('the Pay button is disabled', 'the Remember me switch is on')."
|
|
332
|
+
- "MOBILE Network (environment-dependent) \u2014 the app's own captured traffic ('the POST /api/login returned 200') and direct API calls ('call GET /api/bookings and verify the cancelled booking is absent') need a capture/API-wired run environment; when the promise is observable on-screen, prefer the screen."
|
|
333
|
+
- "MOBILE Lifecycle \u2014 background/foreground, terminate/relaunch (only when the objective closes the app), orientation, deep links with a stated target ('background the app and return; the draft is preserved'). OS permission dialogs are tappable UI \u2014 exercising Allow/Deny on screen is legal."
|
|
334
|
+
- "MOBILE ILLEGAL \u2014 URL, page Title, browser console, page-performance: none exist on a native app. Cookies/localStorage: WebView-only AND write-only \u2014 never a read check. Keyboard-visibility: illegal on Android (default sessions suppress the soft keyboard); iOS renders it as ordinary elements. No control exists \u2192 gap, never a test: incoming call/SMS, posting notifications, wifi/airplane switches, locale/timezone, clipboard reads, on-device DB/file reads (the db-query tool reads a configured backend DB, never the device), geolocation, biometrics, programmatic permission pre-seeding. Platform-conditional: notification-shade observation and tab handling are Android-only \u2014 gap iOS notification promises."
|
|
335
|
+
- "Assertions are the CLOSING CLAUSE of the step that performed the action \u2014 '\u2026swipe the row left, then assert a Cancel action is shown'. Say assert, not verify. Never a standalone assertion step, never a restated summary check at the end."
|
|
336
|
+
- "Setup steps stay clean: a step with no verifies tags states its goal plainly and carries NO assert clause \u2014 failing to reach the goal is signal enough."
|
|
337
|
+
- "Tag the proof: a step whose assert clause proves acceptance criteria lists them in its verifies field \u2014 every AC is proven by the step that observes it."
|
|
338
|
+
- "Assert the outcome, never the trigger: 'Verify the Submit button is visible' fails exactly when the action worked \u2014 assert what the action changed."
|
|
339
|
+
- "A UI-commit confirm is an action, not a check: 'confirm the dialog' presses a control; the check is the resulting state ('\u2026 then assert the banner reads Order placed')."
|
|
340
|
+
- "Intent for the actions, literal for the data: goals for verbs ('Log in with {{user}}'), literal or {{variable}} for values."
|
|
341
|
+
- "Extractions: 'Store \u2026 as name' \u2014 vague verbs (read/tell/report) do NOT persist values."
|
|
342
|
+
- "Baselines/deltas are EXTRACTIONS on both surfaces: 'store the result count as baseline_count' BEFORE the action; compare after. Never an abstract 'capture the state'."
|
|
343
|
+
variables:
|
|
344
|
+
- "Credentials and environment values are {{name}} variables; concrete domain values from the source stay literal."
|
|
345
|
+
- "A value no evidence supplies (start URL, test account, seed data) is ASKED for \u2014 actual value or a variable name \u2014 never invented."
|
|
346
|
+
pitfalls:
|
|
347
|
+
- "A WEB test without a starting URL cannot run \u2014 its first step names it."
|
|
348
|
+
- "A MOBILE test declares its platform as the typed target field; kane writes target:/app: frontmatter into the minted file and the run dispatches on it. Its first step launches the app \u2014 never a URL, never a [mobile:] marker. App data PERSISTS between runs (no reset): never assume first-install or signed-out state."
|
|
349
|
+
- "'Test the checkout flow' has no end state \u2014 state what done looks like."
|
|
350
|
+
- "Do not cram many unrelated operations into one step; do not reference data outside the step."
|
|
351
|
+
- "A step whose only content is an assertion is a smell \u2014 fold it into the action step before it."
|
|
352
|
+
`;var Rt=["presence","forbidden-presence","count","delta","state-transition","absolute","bound","propagation","latency","graded"];function mt(t,e){for(let n of t)if(!Rt.includes(n))throw new Error(`${e}: emits '${n}' is not an oracle kind`)}function lt(t,e){let n=ce(t);if(!n||!Array.isArray(n.techniques))throw new Error(`${e}: expected { techniques: [...] }`);for(let i of n.techniques){if(!i.id||!i.name||!i.applies_hint||!Array.isArray(i.emits))throw new Error(`${e}: technique '${i?.id??"?"}' missing id/name/applies_hint/emits`);mt(i.emits,`${e}: technique '${i.id}'`)}return n.techniques}function dt(t,e){let n=ce(t);if(!n||!n.id||!n.name||!n.applies_when||!Array.isArray(n.candidate_checks))throw new Error(`${e}: profile missing id/name/applies_when/candidate_checks`);for(let i of n.candidate_checks){if(!i.id||!i.family||!i.measurable_example||!i.emits)throw new Error(`${e}: candidate_check '${i?.id??"?"}' missing id/family/measurable_example/emits`);mt([i.emits],`${e}: check '${i.id}'`)}return n}function ut(t){let e=new Map(lt(at,"packaged techniques").map(i=>[i.id,i])),n=se(t,"design","techniques.yaml");if(be(n))for(let i of lt(_e(n,"utf8"),n))e.set(i.id,i);return[...e.values()]}function pt(t){let e=new Map(Object.entries(ot).map(([i,o])=>[i,dt(o,`packaged profile '${i}'`)])),n=se(t,"design","profiles");if(be(n))for(let i of Et(n).filter(o=>o.endsWith(".yaml")||o.endsWith(".yml")).sort()){let o=dt(_e(se(n,i),"utf8"),se(n,i));e.set(o.id,o)}return[...e.values()]}function gt(t){let e=se(t,"design","runner-grammar.yaml");return be(e)?_e(e,"utf8"):ct}function ie(t,e){return!t.superseded.has(e)}function ye(t,e,n){return{cid:e,logical_id:t.nameOf.get(e)??null,content:n}}async function ft(t,e,n,i,o){let r=await We(t,"search_similar",{text:e,label:n,k:i},o);return r.ok&&Array.isArray(r.result)?r.result:[]}async function ht(t,e,n={}){let i=U(t),o=i.resolve(e);if(!o)throw new Error(`assembleDesignContext: unknown use-case '${e}' (run designGate first)`);let r=o.tip,v=i.getNode(r);if(!v||v.label!==Q.USECASE)throw new Error(`assembleDesignContext: '${e}' is not a use-case (run designGate first)`);let N=i.derivesInto(r).map(l=>({source_id:l.props.source_id??null,anchor:l.props.anchor??null})),w=[],T=new Set;for(let{cid:l,content:g}of i.byLabel(Q.SCENARIO))ie(i,l)&&i.edgesFrom(l).some(h=>h.type===Y.BELONGS_TO&&h.dst===r)&&(w.push(ye(i,l,g)),T.add(l));let $=[];for(let{cid:l,content:g}of i.byLabel(Q.AC)){if(!ie(i,l))continue;let h=i.edgesFrom(l).find(S=>S.type===Y.SCOPED_TO);!h||h.dst!==r&&!T.has(h.dst)||$.push({...ye(i,l,g),scoped_to:h.dst})}let x=Array.isArray(v.content.criteria)?v.content.criteria:[],C=[v.content.title,v.content.description,...x].filter(Boolean).join(`
|
|
353
|
+
`),M=(await ft(i,C,Q.SCENARIO,10,n.embedSearch)).filter(l=>!T.has(l.cid)),R=[],P=new Set,X=[],E=[r],q=new Set([r]);for(;E.length>0;){let l=E.shift();for(let g of i.edgesFrom(l)){if(g.type!==Y.DEPENDS_ON||i.nodeLabel.get(g.dst)!==Q.USECASE)continue;let h=i.tipOf(g.dst);q.has(h)||(q.add(h),X.push(h),E.push(h))}}for(let l of X){let g=`depends_on ${i.nameOf.get(l)??l.slice(0,19)}`;for(let{cid:h}of i.byLabel(Q.SCENARIO))if(ie(i,h)&&i.edgesFrom(h).some(S=>S.type===Y.BELONGS_TO&&S.dst===l))for(let S of i.edgesInto(h)){if(S.type!==Y.AUTOMATES||!ie(i,S.src)||P.has(S.src))continue;P.add(S.src);let G=String(i.getNode(S.src)?.content.title??"");R.push({cid:S.src,logical_id:i.nameOf.get(S.src)??null,title:G,via:g})}}for(let l of await ft(i,C,Q.TEST,5,n.embedSearch)){let{cid:g,title:h}=l;P.has(g)||(P.add(g),R.push({cid:g,logical_id:i.nameOf.get(g)??null,title:h??"",via:"similar"}))}let f=i.byLabel(Q.STYLENOTE).filter(l=>ie(i,l.cid)).sort((l,g)=>l.cid<g.cid?-1:1).slice(0,5).map(l=>`${String(l.content.statement)} [${String(l.content.learned_from_kind)}]`);return{usecase:ye(i,r,v.content),cites:N,committed_acs:$,existing:{scenarios:w,reuse_candidates:M},import_candidates:R,style_notes:f,techniques:ut(t),profiles:pt(t),runner_grammar:gt(t),variables:[...(n.variablesIndex??new Map).entries()].map(([l,g])=>({name:l,has_value:g.has_value})).sort((l,g)=>l.name<g.name?-1:1),budget:{...n.max!=null?{max_pairs:n.max}:{},...n.strength!=null?{strength_override:n.strength}:{}},design_of:(()=>{let l=et(i,r);return l?{engine:l.engine,seq:l.seq}:null})()}}function bt(t){let e=n=>{if(Array.isArray(n))return n.map(e);if(n!==null&&typeof n=="object"){let i={};for(let o of Object.keys(n).sort())i[o]=e(n[o]);return i}return n};return JSON.stringify(e(t),null,1)}import{basename as qt,dirname as vt,resolve as wt}from"path";import{existsSync as Ct,mkdirSync as At,readFileSync as Tt,renameSync as It,writeFileSync as Ot}from"fs";import{dirname as Pt,join as Nt}from"path";function _t(t){return Nt(t,".testmuai","variables","assurance.json")}function yt(t){for(let o of t.declarations){let r=re(o.name);if(r)throw new Error(`variable declaration refused: ${r}`)}let e={};if(Ct(t.file)){let o=JSON.parse(Tt(t.file,"utf8"));o&&typeof o=="object"&&!Array.isArray(o)&&(e=o)}let n=[],i=[];for(let o of t.declarations){if(Object.hasOwn(e,o.name)||t.known?.has(o.name)){i.push(o.name);continue}e[o.name]={value:"",secret:!!o.secret,description:o.description},n.push(o.name)}if(n.length>0){At(Pt(t.file),{recursive:!0});let o=`${t.file}.tmp-${process.pid}-${Date.now()}`;Ot(o,JSON.stringify(e,null,2)+`
|
|
354
|
+
`),It(o,t.file)}return{written:n,skipped:i}}var jt=me,Lt=new Set(["narrative","acs","scenarios","tests","exercises","gaps","scoped_to_repoints","judgements","variables","phase"]);function Mt(t){let e=/strength=(\d+)\s*(?:—|-)?\s*(.*)/.exec(t??"");return e?{strength:Number(e[1]),reason:e[2]||t||""}:{strength:2,reason:t??""}}function Bt(t,e,n=new Set,i=0){return jt(e,ue(t),n,i)}function Ft(t,e,n,i){let o=e.scenarios?.find(x=>x.temp_ref===n.automates)??(()=>{let x=t.resolve(n.automates),C=x?t.getNode(x.tip)?.content:void 0;return C?{title:String(C.title??""),intent:String(C.intent??""),technique_notes:String(C.technique_notes??"")}:{}})(),r=[...(e.acs??[]).map(x=>({ref:x.temp_ref,text:x.text})),...n.verifies.filter(x=>!(e.acs??[]).some(C=>C.temp_ref===x)).map(x=>{let C=t.resolve(x);return{ref:x,text:C?String(t.getNode(C.tip)?.content.text??""):""}})],{test_md:v,objectives_yaml:N}=Re({title:n.title,steps:n.steps,check:n.check,check_prose:n.check_prose,reuses:n.reuses,...n.target?{target:n.target,...n.app?{app:n.app}:{}}:{}},{title:o.title,intent:o.intent},r),w=de(Bt(t,v)),T=n.check,$={technique:o.technique_notes??"",profile_family:e.judgements?.find(x=>x.kind==="profile_family"&&(x.target===n.temp_ref||x.target===n.automates))?.rationale??"unspecified",anchor:T.verified_against,expected_how:e.judgements?.find(x=>x.kind==="expected_how"&&x.target===T.verified_against)?.rationale??`expected_mode: ${T.expected_mode??"inferred"}`,combinatorial:Mt(o.technique_notes),surface_state:"absent",deferred_bindings:T.expected_mode==="runtime-derived"?1:0};return i.push({definitionId:w,rationale:$,anchorRef:T.verified_against,tempRef:n.temp_ref}),{temp_ref:n.temp_ref,title:n.title,automates:n.automates,verifies:n.verifies,check:n.check,definitionId:w,test_md_blob:v,objectives_blob:N,...n.reuses?.length?{reuses:n.reuses}:{},...n.surface_required!==void 0?{surface_required:n.surface_required}:{},...n.target?{target:n.target}:{},...n.target&&n.app?{app:n.app}:{}}}function Gt(t,e){try{let n=t.resolve(e.automates);if(!n)return!1;let i=t.tipOf(n.cid)??n.cid;for(let o of t.edgesInto(i)){if(o.type!==Y.AUTOMATES)continue;let r=t.getNode(t.tipOf(o.src)??o.src)?.content,v=typeof r?.test_md_blob=="string"?r.test_md_blob:"";if(!v)continue;if(!v.split(`
|
|
355
|
+
`).some(w=>/^##\s/.test(w)&&!/—\s?assert/.test(w)&&xe.test(w)))return!0}return!1}catch{return!1}}function kt(t){let e=0,n=t.forceScope??null;return{terminalEventType:"design",async onProposalEvent(i){let o=a=>t.steer?(t.steer(`[auto-repair] ${a} \u2014 please re-finalize with this fixed.`),{proposal:null,error:null}):{proposal:null,error:a};if(i==null||typeof i!="object")return o("finalize_design payload is not an object");let r=i,v=Object.keys(r).filter(a=>!Lt.has(a));if(v.length>0)return o(`finalize_design carries ungated/unknown section(s): ${v.join(", ")} \u2014 mintable here: acs, scenarios, tests (+gaps)`);let N=new Map;for(let a of r.tests??[]){let m=N.get(a.automates);if(m)return o(`strict 1:1 violated in-payload: ${m} and ${a.temp_ref} both automate ${a.automates}`);if(N.set(a.automates,a.temp_ref),typeof a.app=="string"&&!/^APP/.test(a.app)&&!/[\/]/.test(a.app)&&!/\.(apk|zip|app)$/i.test(a.app))return o(`${a.temp_ref}: app '${a.app}' is neither a build path (.apk / .zip of an .app) nor an APP\u2026 upload id \u2014 omit the field when only a bundle id exists`)}let w=U(t.contextDir),T=/^design@(\d+)$/.exec(t.templateVersion?.()??"");if(T&&Number.parseInt(T[1],10)>=6)for(let a of r.tests??[]){if(!Array.isArray(a.steps??[]))return o(`${a.temp_ref}: steps must be an array of objective strings or {text, verifies} objects`);let m=new Set;for(let k of Array.isArray(a.steps)?a.steps:[])if(typeof k=="object"&&k.verifies)for(let O of k.verifies)m.add(O);let _=new Set(a.verifies??[]),b=[..._].filter(k=>!m.has(k)),I=[...m].filter(k=>!_.has(k));if(!(m.size===0&&Gt(w,a))&&(m.size===0||b.length>0||I.length>0))return o(`${a.temp_ref}: every AC must be claimed by the step that proves it \u2014 `+(m.size===0?"no step carries verifies tags":`not claimed by any step: [${b.join(", ")}]; tagged but not in the test's verifies: [${I.join(", ")}]`))}if(r.variables!==void 0&&!Array.isArray(r.variables))return o("variables must be an array of {name, description, secret}");let $=!!T&&Number.parseInt(T[1],10)>=7;if((r.variables??[]).length>0&&!$)return o("variables[] needs design@7 \u2014 this session is bound to an older template; drop the section");let x=new Set;for(let a of r.variables??[]){if(!a||typeof a!="object"||typeof a.name!="string"||typeof a.description!="string"||typeof a.secret!="boolean")return o(`variables[]: every entry is {name, description, secret} \u2014 got ${JSON.stringify(a)}`);let m=Object.keys(a).filter(b=>!["name","description","secret"].includes(b));if(m.length>0)return o(`variables[]: '${a.name}' carries ${m.join(", ")} \u2014 a declaration has no value and no other fields`);let _=re(a.name);if(_)return o(`variables[]: ${_}`);if(!a.description.trim()||/[\r\n]/.test(a.description))return o(`variables[]: '${a.name}' needs a one-line, non-empty description`);if(x.has(a.name))return o(`variables[]: '${a.name}' is declared twice`);x.add(a.name)}if($){let a=t.variablesIndex?.()??new Map;for(let m of r.tests??[]){let _=[...(Array.isArray(m.steps)?m.steps:[]).map(b=>typeof b=="string"?b:b.text),m.check_prose??""];for(let b of _)for(let I of Ne(b))if(!(a.has(I)||x.has(I)))return o(`${m.temp_ref}: step references {{${I}}} but no variable named '${I}' exists in the pool and this payload does not declare it \u2014 reuse a name from the variables block, or declare it in \`variables\` ({name, description, secret})`)}}t.force&&!t.resuming&&e===0&&n===null&&(n=st(w,t.ucRef));let C=w.resolve(t.ucRef),M=C?String(w.getNode(C.tip)?.content.risk??"med"):"med",R=[],P=new Set([t.ucRef,C?.cid,C?.tip].filter(Boolean)),X=a=>{if(P.has(a))return!0;let m=w.resolve(a);return m!=null&&(P.has(m.cid)||P.has(m.tip))},E;try{E={...r.acs?.length?{acs:r.acs.map(a=>({temp_ref:a.temp_ref,text:a.text,kind:a.kind,risk:a.risk??M,...a.expected_answer?{expected_answer:a.expected_answer}:{},...a.scoped_to&&!X(a.scoped_to)?{scope:{type:"scenario",ref:a.scoped_to}}:{}}))}:{},...r.scenarios?.length?{scenarios:r.scenarios}:{},...r.tests?.length?{tests:r.tests.map(a=>Ft(w,r,a,R))}:{},...r.exercises?.length?{exercises:r.exercises}:{},...r.gaps?.length?{gaps:r.gaps}:{},...r.scoped_to_repoints?.length?{scoped_to_repoints:r.scoped_to_repoints}:{},...r.judgements?.length?{judgements:r.judgements}:{}}}catch(a){return o(a instanceof Error?a.message:String(a))}let q=r.phase??(r.tests?.length?"tests":r.scenarios?.length?"scenarios":r.acs?.length?"acs":"design"),f=(a,m={})=>({contextDir:t.contextDir,graph:a,ucRef:t.ucRef,sections:E,by:t.by,phase:q,...m,...t.templateVersion?{templateVersion:t.templateVersion()}:{},...t.engine?{engine:t.engine}:{},...n?.length?{forceScope:n}:{},...t.because?{reason:t.because}:{},finalizeTestBody:(()=>{let _=new Map((E.tests??[]).map(k=>[k.temp_ref,k])),b=new Map,I=(k,O,H)=>{let L=_.get(k);if(!L?.test_md_blob)return null;let z=b.get(k);if(z!==void 0)return z;if(H.has(k))return L.test_md_blob;H.add(k);let W=new Map;for(let s of L.reuses??[]){I(s,O,H);let d=O(s);d!==null&&d!==s&&W.set(s,d)}let j=L.verifies.map(O).filter(s=>s!==null),J=Ee(L.test_md_blob,W),{md:ne,tagged:D}=Se(J,O),K=D?ne:$e(J,j);return De(K,j),b.set(k,K),K};return(k,O)=>{if(!k.test_md_blob)return null;let H=I(k.temp_ref,O,new Set)??k.test_md_blob;if(H===k.test_md_blob)return null;let L=z=>{for(let W of _.keys())if(O(W)===z){let j=I(W,O,new Set);if(j!==null)return{body:j,cycleKey:`batch:${z}`,next:L}}return ue(w)(z)};return{test_md_blob:H,definitionId:de(me(H,L))}}})()}),l;if(t.protocol){let a=t.generationTicket,m=await Fe(t.protocol,{verb:"design",ucTargets:[{ref:t.ucRef}],newBuCandidates:[],sourcePins:[],readBasis:w.latestHash,...a?{generationTicket:a}:{}},_=>{let b=he(f(_.graph,{eventIds:_.eventIds("design",1),sid:_.sid,...a&&!t.generationStamped?{generationTicket:a}:{}}));return b.errors!==null?{errors:b.errors}:{result:b,record:b.record}});m.ok&&"result"in m?(l=m.result,a&&!t.generationStamped&&(t.generationStamped=!0,t.generationTicket={...a,expected_prev_gen:a.next_gen})):m.ok?l={record:null,errors:null,minted:{},logicalIds:{},superseded:[],warnings:["commit already applied (recommit)"],finalizedTests:{}}:l={record:null,errors:m.kind==="validation"?m.errors:m.kind==="contended"?[{code:m.err.code,detail:`${t.ucRef} is held by ${m.err.holder?.owner_sid??"another session"}${m.err.holder?.alive?" (live)":" (stale)"} \u2014 try another use-case or wait for it to free`}]:m.kind==="drifted"?m.asks.map(b=>({code:"DRIFTED",detail:b.detail})):[{code:"UNSETTLED",detail:`concurrent activity kept moving the store (${m.attempts} attempts) \u2014 retry when the store is quieter`}],minted:{},logicalIds:{},superseded:[],warnings:[],finalizedTests:{}}}else l=he(f(w));if(l.errors)return o("design commit failed: "+l.errors.map(a=>`${a.code}: ${a.detail}`).join("; "));let g=l.warnings.filter(a=>a.includes("\u2014 committed anyway; approve"));for(let a of l.warnings)(!g.includes(a)||g.length===1)&&t.note(`warning: ${a}`);g.length>1&&t.note(`warning: ${g.length} test link(s) refer to items still awaiting approval \u2014 saved anyway; review and approve those items in chat or via kane-cli context review`);let h=(a,m)=>a?`${a} ${m}${a>1?"s":""}`:null,S=[h(r.acs?.length,"AC"),h(r.scenarios?.length,"scenario"),h(r.tests?.length,"test"),h(r.gaps?.length,"gap")].filter(Boolean);t.aliases?.(Object.entries(l.minted).map(([a,m])=>({ref:a,cid:m,...l.logicalIds[a]?{id:l.logicalIds[a]}:{}})));{let a=`saved ${S.join(" \xB7 ")||"judgements/wiring"} as drafts`;(t.commitLine??t.note)(a)}let G=U(t.contextDir);t.onCommitted?.(G);for(let a of R){let m=l.logicalIds[a.anchorRef]??l.minted[a.anchorRef];nt(t.contextDir,l.finalizedTests[a.tempRef]??a.definitionId,{...a.rationale,anchor:m??a.rationale.anchor})}try{let a=Object.values(l.minted).filter(m=>G.getNode(m)?.label==="test");if(a.length>0){let m=vt(wt(t.contextDir)),_=it({graph:G,cids:a,cwd:m});_.wrote.length>0&&t.note(`\u2692 wrote ${_.wrote.map(b=>qt(b.path)).join(" \xB7 ")}`);for(let b of _.refused)t.note(`warning: could not create the test file for ${b.id} \u2014 ${b.reason}`)}}catch(a){t.note(`warning: the design was saved, but its test file could not be created (${a instanceof Error?a.message:String(a)})`)}try{if((r.variables??[]).length>0){let a=vt(wt(t.contextDir)),m=_t(a),{written:_}=yt({file:m,declarations:r.variables,known:t.variablesIndex?.()});if(_.sort(),_.length>0){let b=_.map(I=>({...r.variables.find(k=>k.name===I),file:m}));t.note(`\u2692 declared ${_.length} new variable${_.length===1?"":"s"} \u2014 ${_.join(" \xB7 ")} (values needed)`),t.event?.({type:"variables_declared",file:m,variables:b.map(({name:I,description:k,secret:O})=>({name:I,description:k,secret:O}))}),t.onVariablesDeclared?.(b)}}}catch(a){t.note(`warning: the design was saved, but its variable stubs could not be written (${a instanceof Error?a.message:String(a)})`)}t.event?.({type:"commit",acs:r.acs?.length??0,scenarios:r.scenarios?.length??0,tests:r.tests?.length??0,gaps:r.gaps?.length??0,warnings:l.warnings.length,minted:Object.entries(l.minted).map(([a,m])=>({temp_ref:a,cid:m,...l.logicalIds[a]?{logical_id:l.logicalIds[a]}:{}}))}),e+=1,n!==null&&(n=l.forceScopeRemaining??n,t.onForceScope?.(n));let V=He({verb:"design",commitN:e,ucRef:t.ucRef,phase:q,committed:Object.entries(l.minted).map(([a,m])=>({temp_ref:a,cid:m,...l.logicalIds[a]?{logical_id:l.logicalIds[a]}:{}})),warnings:l.warnings},G),ee=V.event.parity?.missing??[],te=!!r.tests?.length&&ee.length===0;return{proposal:l,error:null,receipt:V,...te?{sessionComplete:te}:{}}}}}function xt(t,e){return{type:"run_config",version:1,session_id:e.session_id,mode:e.mode,source:{source_id:`design:${t.usecase.logical_id??e.ucCid.slice(0,19)}`,source_cid:e.ucCid,kind:"design_context",numbered_text:bt({...t,session_mode:e.mode})},existing_use_cases:[],read_basis:e.readBasis,max_free_text_rounds:2,graph_reads:!0,verb:"design",chat:!0,design_budget:t.budget,topology:e.topology}}var Dt=Symbol("design-out-tee");function Wt(t,e,n,i){return{terminalEventType:"design",async onProposalEvent(o){let r=o??{},v=["acs","scenarios","tests","gaps"].map(N=>r[N]?.length?`${r[N].length} ${N}`:null).filter(Boolean).join(" \xB7 ");return n?.("plan_payload",{payload:r}),t(`plan: finalize_design \u2014 ${v||"wiring/judgements only"} (nothing committed${i?`; full payload: ${Z(i)}`:""})`),e?.({type:"plan",payload:r}),{proposal:r,error:null}}}}async function ii(t,e){let n=U(e.contextDir),i=null,o=null,r=t.useCase;if(t.resume){try{{let p=await Xe(e.contextDir,t.resume,n,{deps:{onWarn:y=>e.out(`note: ${y}`)}});o=p,i=p.handle,p.drift.length>0&&(e.out(`note: sources changed since the pause: ${p.drift.map(y=>y.subject).join(", ")} \u2014 the design continues against the current versions`),e.emit?.({type:"stale_basis",sources:p.drift.map(y=>y.subject)}))}}catch(p){if(p instanceof ke||p instanceof fe)return e.out(`error: ${p.message}`),e.emit?.({type:"error",message:`error: ${p.message}`}),p instanceof fe||p.code==="SESSION_MISSING"||p.code==="SESSION_EXPIRED"?2:1;throw p}let s=i.state,d=ze(s.verb,"design",t.resume);if(d)return e.out(d.message),e.emit?.({type:"error",message:d.message,code:d.code}),i.release(),2;if(r&&s.use_case&&r!==s.use_case){let p=`session ${t.resume} was designing ${s.use_case}; --use-case ${r} RETARGETS it`;if(!(t.confirmRetarget?await t.confirmRetarget(`${p} \u2014 continue with the new target?`):!1))return e.out(`error: ${p} \u2014 resume without --use-case to continue ${s.use_case}, or start a fresh session on ${r}`),e.emit?.({type:"error",code:"RETARGET_MISMATCH",message:p}),i.release(),2}if(r=r??s.use_case,s.uc_tip&&r){let p=n.resolve(r)?.tip;if(p&&p!==s.uc_tip){let y=`the use-case changed since the pause (${s.uc_tip.slice(0,19)}\u2026 \u2192 ${p.slice(0,19)}\u2026)`;if(!(t.confirmRetarget?await t.confirmRetarget(`${y} \u2014 re-ground and continue against the new version?`):!1))return e.out(`error: ${y} \u2014 resume interactively to re-ground, or abandon this session`),e.emit?.({type:"error",code:"UC_TIP_MOVED",message:y}),i.release(),2;e.emit?.({type:"stale_basis",usecase:r})}}let u=rt(n,s.target_pins);if(u.length>0){let p=`items this session pinned have changed since it paused: ${u.map(A=>`${A.ref}${A.now===null?" (now gone)":""}`).join(", ")}`;if(!(t.confirmRetarget?await t.confirmRetarget(`${p} \u2014 re-ground and continue?`):!1))return e.out(`error: ${p} \u2014 resume interactively to re-ground, or abandon`),e.emit?.({type:"error",code:"TARGET_PIN_MOVED",message:p}),i.release(),2;i.save({target_pins:(s.target_pins??[]).map(A=>({ref:A.ref,cid:n.resolve(A.ref)?.tip??A.cid}))})}let c=[...new Set([...i.state.held_receipts??[],...o?.view.kane?.held_receipts??[]])];if(c.length>0)if(e.chat?.holdReceipt)for(let p of c)e.chat.holdReceipt(p);else e={...e,initialMessage:[c.join(`
|
|
356
|
+
|
|
357
|
+
`),e.initialMessage].filter(Boolean).join(`
|
|
358
|
+
|
|
359
|
+
`)};if(!r)return e.out(`error: session ${t.resume} predates use-case persistence \u2014 re-supply --use-case <ref>`),e.emit?.({type:"error",message:`error: session ${t.resume} predates use-case persistence \u2014 re-supply --use-case <ref>`}),i.release(),2}let v=t.resume?void 0:t.phase,N=!1;if(v!==void 0){let{checkPhaseEntry:s,phaseEntryCmd:d,phaseLadderFor:u}=await import("./phase-seed-BMOSAA74.js");N=u(e.contextDir,n,r).length>0;let c=s(e.contextDir,n,r,v);if(!c.ok&&c.code==="UNKNOWN_PHASE")return e.out(`error: ${c.message}`),e.emit?.({type:"error",code:"UNKNOWN_PHASE",message:c.message}),i?.release(),2;if(!c.ok&&c.code==="PHASE_ORDER"){let p=t.askPhaseEntry?await t.askPhaseEntry({message:c.message,earliest:c.earliest}):"cancel";if(p==="earliest")e.out(`starting at ${c.earliest} instead (${c.missing.join(", ")} not committed yet)`),v=c.earliest;else if(p==="proceed")e.out(`note: entering at ${v} with ${c.missing.join(", ")} uncommitted \u2014 proceeding on your say-so`),e.emit?.({type:"phase_entry_override",phase:v,missing:c.missing});else{let y=(t.mode??"interactive")==="agent",A=d(r,c.earliest,y);return e.out(`error: ${c.message}`),e.emit?.({type:"error",code:"PHASE_ORDER",message:c.message,next:[{cmd:A,why:`${c.earliest} is the earliest uncommitted phase for ${r}`,title:`Start at ${c.earliest}`}]}),i?.release(),2}}}let w=!!(t.force||i?.state.force),T=!!(t.resume&&i),$=tt(n,r,w||T||N);if(!$.ok){let s=(t.mode??"interactive")==="interactive";if($.wall&&s&&t.askDesignEntry){let{captureForceScope:d}=await import("./design-committer-UPC6NZUF.js"),u=d(n,r).length,c=await t.askDesignEntry({wall:$.wall.kind,message:$.message,display:$.wall.display,impactPairs:u});if(c.pick==="redesign"||c.pick==="proceed"){if(!c.because.trim())return e.out("a redesign needs a reason (--because) \u2014 nothing executed"),i?.release(),2;e.out(c.pick==="redesign"?`redesigning ${$.wall.display} (${u} pair(s) superseded) \u2014 because: ${c.because.trim()}`:`proceeding against the stale design (noted) \u2014 because: ${c.because.trim()}`),t={...t,force:!0,because:t.because??c.because.trim()},w=!0}else return c.pick==="view"?(e.out(`view the existing design: kane-cli context view ${$.wall.display}`),i?.release(),0):c.pick==="refresh"?(e.out(`refresh it first: kane-cli maintain evolve ${$.wall.display}`),i?.release(),0):(e.out("nothing executed \u2014 list use-cases: kane-cli context list"),i?.release(),0)}else{e.out(`design: ${$.message}`);let d=$.wall&&t.mode==="agent"?[{cmd:`kane-cli context view ${$.wall.display}`,why:"view the existing design",title:"View the design"},...$.wall.kind==="designed-stale"?[{cmd:`kane-cli maintain evolve ${$.wall.display}`,why:"the use-case moved since the design \u2014 evolve refreshes it",title:"Evolve the design"}]:[],{cmd:`kane-cli design tests --use-case ${$.wall.display} --force --mode agent`,why:"redesign \u2014 supersedes the live scenario+test pairs",title:"Redesign"}]:void 0;return e.emit?.({type:"gate_refused",message:$.message,...d?{next:d}:{}}),i?.release(),$.code}}if(e.preflightTurn){let s=await e.preflightTurn();if(!s.ok)return e.out(s.message??"error: turn-endpoint preflight failed"),e.emit?.({type:"error",message:s.message??"error: turn-endpoint preflight failed",code:"PREFLIGHT"}),i?.release(),2}let x={contextDir:e.contextDir,resolveAlias:s=>Ge(s,{env:process.env,auth:e.auth}),embed:(s,d)=>Ve(s,d,{env:process.env,auth:e.auth})};e.chat?.setWorking?.("assembling context\u2026");let C=Pe(Oe(ae(e.contextDir))),M=[],R=await ht(e.contextDir,r,{max:t.max,strength:t.strength,embedSearch:x,variablesIndex:C});if(t.priorDesign!==void 0&&(R.prior_design=t.priorDesign),t.changeDelta!==void 0&&(R.change_delta=t.changeDelta),t.because&&(R.because=t.because),v!==void 0){let{buildPhaseSeed:s}=await import("./phase-seed-BMOSAA74.js"),d=s(e.contextDir,n,r,v);R.prior_design===void 0&&d.priorDesign!==void 0&&(R.prior_design=d.priorDesign),R.entry_phase=v,d.phaseLadder.length>0&&(R.phase_ladder=d.phaseLadder)}let P=e.now?.()??new Date,X=`${P.toISOString().replace(/[-:]/g,"").slice(0,15)}-${Ht(2).toString("hex")}`,E=t.mode??"interactive",q=E==="interactive"&&!!e.chat&&!e.nested,f=o?{...o.spawnConfig,mode:E}:xt(R,{session_id:t.resume??`design-${X}`,mode:E,ucCid:R.usecase.cid,readBasis:n.latestHash,topology:Qe("design")}),l={current:null};if(f.resume&&"schema"in f.resume){let s=f.resume.binding?.template_version;typeof s=="string"&&(l.current=s)}t.plan?f.chat=!1:f.chat=!0;let g=e.telemetry?.enabled?e.telemetry:void 0,h=g?we(g.ids.context_instance_id??null,"design",g.ids.session_id):ve(e.contextDir,"logs",`design-${X}.log`);Vt(ae(h),{recursive:!0}),q||e.out(`trace: ${Z(h)}`),e.emit?.({type:"run_start",mode:E,trace:h,use_case:r,...g?{session:g.ids.session_id}:{}});let S=(s,d,u)=>{try{Ut(h,JSON.stringify({ts:new Date().toISOString(),level:s==="error"?"error":"info",run_id:g?.ids.operation_id,...g?{user_session_id:g.ids.session_id}:{},kind:s,session_id:u,data:d})+`
|
|
360
|
+
`)}catch{}g?.wireTrace(s,d,u)};{let s=e.out;if(s[Dt]!==!0){let d=u=>{S("transcript",{line:u}),s(u)};d[Dt]=!0,e.out=d}}if(t.resume&&i){o||(f.resume={agent_state:i.state.agent_state}),e.out(`resuming design session ${t.resume}`),i.state.assumed.length>0&&e.out(`note: ${i.state.assumed.length} default(s) were assumed while you were away \u2014 kane-cli context sessions show ${t.resume} lists them`);try{let{readRecords:s}=await import("./records-JLS63SDI.js"),d=s(e.contextDir).records.filter(u=>u.sid===t.resume).map(u=>u.design_phase).filter(u=>u!=null&&typeof u.phase=="string");if(d.length>0){let u=d.map(p=>`${p.phase}${p.completeness==="partial"?" (partial)":""}`).join(" \u2192 "),c=`[kane] durable record for this session (${t.resume}) on ${r}: design phases already COMMITTED \u2014 ${u}. Those finalizes landed; do not re-send them. Continue from the next uncommitted phase, or finish if the design is complete.`;e={...e,initialMessage:[e.initialMessage,c].filter(Boolean).join(`
|
|
361
|
+
|
|
362
|
+
`)}}}catch{}t.message&&(e={...e,initialMessage:[e.initialMessage,t.message].filter(Boolean).join(`
|
|
363
|
+
|
|
364
|
+
`)})}let G=null,V={current:n},ee={detach:null},te=()=>{let s=ee.detach;ee.detach=null,s&&s()},a=(s,d)=>{let u=i;if(!u)return{};let c=s.ask,p=Ke({contextDir:s.contextDir,cwd:ae(s.contextDir),handle:u,note:y=>s.chat?s.chat.note(y):s.out(y),graphSlot:d,...s.now?{now:s.now}:{}});if(s.chat?.attachIngest){let y=s.chat;ee.detach=y.attachIngest(async A=>{try{u.save({ingest_registry:ge(u.state.ingest_registry,A,s.now?.()??new Date)});let B=await p({id:`attach-${u.state.sid}-${(u.state.ingest_registry??[]).length}`,ref:A,purpose:null});return B.ok?(y.deferBatch({source_id:B.result.source_id,cid:B.result.cid}),{ok:!0}):{ok:!1,error:B.error.message}}catch(B){return{ok:!1,error:B instanceof Error?B.message:String(B)}}})}return{ask:async y=>{let A=await c(y);if(Array.isArray(A)){let B=A.filter(F=>{if(F.free_text==null||F.free_text.trim()==="")return!1;let oe=y.find($t=>$t.id===F.id);return F.selected_index!=null&&oe?.options[F.selected_index]?.input===!0}).map(F=>F.free_text.trim());if(B.length>0){let F=u.state.ingest_registry;for(let oe of B)F=ge(F,oe,s.now?.()??new Date);u.save({ingest_registry:F})}}return A},ingest:p}};e.nested||e.chat?.attachOnCommitted?.(s=>{V.current=s});let m="";if(e.chat&&!t.plan&&!e.nested){let s=Ue({contextDir:e.contextDir,graph:U(e.contextDir),sessionStamp:f.session_id,by:e.by??{kind:"human",id:"owner"}});s.errors===null||s.errors[0]?.code==="CONV_SOURCE_EXISTS"?(m=s.sourceId,e.chat.attachConversationSource?.(m),V.current=U(e.contextDir)):e.out(`warning: notes you add in chat can't be saved to the context this session (${s.errors[0]?.detail})`)}let _=U(e.contextDir),b;if(!t.plan){let s=Me(_,r);if(T&&s!==null&&s.live){let d=_.resolve(r);b={uc_root:Le(_,d.cid),next_gen:s.gen,expected_prev_gen:s.gen}}else{let d=Be(_,r,{...w?{force:!0}:{},because:t.because??(w?"forced redesign (--force)":void 0)});if("error"in d)return e.out(`design: ${d.error.detail}`),e.emit?.({type:"gate_refused",message:d.error.detail,code:d.error.code}),i?.release(),2;b=d}}let I=Ae(e.contextDir,f.session_id),k=null,O=()=>{try{k?.release()}catch{}};if(!t.plan)try{k=I.acquire([Te(_,r).key],{hold:"session",verb:"design"})}catch(s){if(s instanceof Ce&&s.code==="UC_HELD"){let d=s.holder,u=`design: ${r} is being designed by another session${d?.alive===!1?` \u2014 that session looks stopped; resume it with kane-cli design tests --resume ${d?.owner_sid??"<session>"}`:""} \u2014 pick another use-case (kane-cli design tests) or wait for it to finish`;return e.out(u),e.emit?.({type:"error",code:"UC_HELD",message:u}),i?.release(),2}throw s}let H={contextDir:e.contextDir,rootSid:f.session_id,locks:I,probe:{batchSimilar:async()=>({hits:[],degraded:!1,probeBasis:null}),recheckLocal:()=>({hits:[],uncachedNewNodes:[]})}},L=!t.plan&&E!=="ci",z=()=>Object.fromEntries((n.resolve(r)?n.edgesInto(n.resolve(r).tip):[]).filter(s=>s.type==="DERIVES"&&typeof s.props.source_id=="string").map(s=>[String(s.props.source_id),n.heads.get(String(s.props.source_id))??null])),W=!1;L&&!i&&(W=!0,i=le(e.contextDir,{sid:f.session_id,mode:"agent",created_at:P.toISOString(),expires_at:new Date(P.getTime()+1440*60*1e3).toISOString(),agent_state:{schema:2,items:[],provider_state:""},pending:{questions:[],proposals:[]},read_basis:z(),assumed:[],corpus_cursor:{remaining:[]},conv_source:m,target_pins:n.resolve(r)?[{ref:r,cid:n.resolve(r).tip}]:[],verb:"design",use_case:r,...n.resolve(r)?.tip?{uc_tip:n.resolve(r).tip}:{},...w?{force:!0}:{},...g?{user_session_id:g.ids.session_id}:{}}));let j;if(L&&i){let{resume:s,...d}=f;qe(e.contextDir,f.session_id,{schema:je,kind:"base",sid:f.session_id,verb:"design",mode:E,created_at:P.toISOString(),run_config:d,conv_source:m||i.state.conv_source||"",...r?{use_case:r}:{},...n.resolve(r)?.tip?{uc_tip:n.resolve(r).tip}:{},store_watermark:Ie(e.contextDir)}),f.checkpoints=!0,t.resume&&S("resume_kind",{kind:o?o.view.pointer===null?"bare-base":o.view.pointer.at==="final"?"pause":"crash":"v1-shim"},f.session_id);let u=o?0:i.state.checkpoint?.seq??0,c=i;j=Ye({contextDir:e.contextDir,handle:c,seqBase:()=>u,peekHeldReceipts:()=>e.chat?.peekHeldReceipts?.()??[],readBasis:()=>z(),corpusCursor:()=>({remaining:[]}),onSoftCap:y=>e.out(y),onStat:y=>S("ckpt_stat",y,f.session_id),...e.now?{now:e.now}:{}});let p=j;j={...p,persist:y=>{let A=y.binding?.template_version;return typeof A=="string"&&A&&(l.current=A),p.persist(y)}}}!L&&!t.plan&&(f.checkpoints=!0,j={persist:s=>{let d=s.binding?.template_version;return typeof d=="string"&&d&&(l.current=d),{seq:s.seq,turn_id:s.turn_id,at:s.at,ts:new Date().toISOString(),full_seq:null}}});let J=()=>{if(!i)return;let s=i.state.checkpoint;if(s){let d=E!=="interactive"?` --mode ${E}`:"";e.out(`session ${i.state.sid} kept its last checkpoint (seq ${s.seq}, ${s.ts}) \u2014 resume with: kane-cli design tests --resume ${i.state.sid}${d}`),i.release()}else if(W){try{i.complete()}catch{i.release()}try{St(ve(e.contextDir,"sessions"))}catch{}}else i.release();i=null},ne=t.plan?Wt(e.out,e.emit,S,h):kt({templateVersion:()=>l.current,contextDir:e.contextDir,ucRef:r,by:{kind:"ai",id:"design-agent"},force:w,engine:"design@1",note:s=>e.chat?e.chat.note(s):e.out(s),commitLine:s=>e.chat?e.chat.ledger({kind:"commit",ok:!0,line:s}):e.out(s),steer:e.chat?s=>e.chat.submit(s):void 0,event:e.emit,variablesIndex:()=>C,onVariablesDeclared:s=>{M.push(...s);for(let d of s)C.set(d.name,{has_value:!1,source:d.file})},resuming:T,...i?.state.force_scope?.length?{forceScope:i.state.force_scope}:{},onForceScope:s=>{G=s},...t.because?{because:t.because}:{},aliases:e.chat?s=>e.chat.registerAliases?.(s):void 0,onCommitted:s=>{V.current=s},protocol:H,...b?{generationTicket:b}:{},...T?{generationStamped:!0}:{}});e.chat||(S("design_budget",{max_pairs:R.budget.max_pairs??null,strength:R.budget.strength_override??null}),e.out(`designing: ${R.usecase.logical_id??r}`)),e.chat?.setWorking?.(`designing ${R.usecase.logical_id??r}\u2026`);let D;try{D=await pe(f,{...e,graphSlot:V,...a(e,V),...j?{checkpoint:j}:{}},new Map,n,S,ne)}catch(s){throw S("error",{message:s instanceof Error?s.message:String(s),stack:s instanceof Error?s.stack:void 0},f.session_id),J(),s}finally{e.chat?.setWorking?.(null),te()}if(D.errorCode==="binding_mismatch"&&o){let s=await e.ask([{id:"binding-mismatch",text:"this session's saved conversation is no longer accepted by the service \u2014 start the conversation fresh (committed work is kept), or stop and keep the session?",risk:"high",rationale:"the service refused the saved conversation on the first turn after resume",options:[{label:"start fresh",detail:"continue with a fresh conversation \u2014 earlier answers may be re-asked"},{label:"stop",detail:"stop here; the session stays resumable"}],recommended_index:1,allow_free_text:!1}]);if((Array.isArray(s)?s.find(c=>c.id==="binding-mismatch"):void 0)?.selected_index!==0){let c=`resume abandoned: binding mismatch on session ${f.session_id} \u2014 the session is preserved`;return e.out(c),e.emit?.({type:"error",message:c,code:"BINDING_MISMATCH"}),i?.release(),2}S("binding_migrate",{sid:f.session_id},f.session_id);let u=f.resume&&"schema"in f.resume?{...f.resume,binding:{}}:void 0;try{D=await pe({...f,...u?{resume:u}:{}},{...e,graphSlot:V,...a(e,V),...j?{checkpoint:j}:{}},new Map,n,S,ne)}catch(c){throw S("error",{message:c instanceof Error?c.message:String(c),stack:c instanceof Error?c.stack:void 0},f.session_id),J(),c}finally{e.chat?.setWorking?.(null),te()}}if(D.highRisk)return e.out(`error: ${D.highRisk.length} high-risk decision${D.highRisk.length===1?"":"s"} need a human \u2014 ci mode won't guess. Re-run with --mode agent to pause for review.`),e.emit?.({type:"error",message:`error: high-risk question(s) in ci mode (fail-closed): ${D.highRisk.map(s=>s.id).join(", ")}`,code:"HIGH_RISK_CI"}),J(),O(),1;if(D.paused){let s=i;s||(s=le(e.contextDir,{sid:f.session_id,mode:"agent",created_at:P.toISOString(),expires_at:new Date(P.getTime()+1440*60*1e3).toISOString(),agent_state:D.paused.agent_state,pending:{questions:[],proposals:[]},read_basis:Object.fromEntries((n.resolve(r)?n.edgesInto(n.resolve(r).tip):[]).filter(c=>c.type==="DERIVES"&&typeof c.props.source_id=="string").map(c=>[String(c.props.source_id),n.heads.get(String(c.props.source_id))??null])),assumed:[],corpus_cursor:{remaining:[]},conv_source:m,target_pins:n.resolve(r)?[{ref:r,cid:n.resolve(r).tip}]:[],verb:"design",use_case:r,...n.resolve(r)?.tip?{uc_tip:n.resolve(r).tip}:{},...w?{force:!0}:{},...g?{user_session_id:g.ids.session_id}:{}}));try{w&&!s.state.force&&s.save({force:!0}),g&&s.state.user_session_id!==g.ids.session_id&&s.save({user_session_id:g.ids.session_id}),m&&s.state.conv_source!==m&&s.save({conv_source:m});let c=e.chat?.drainHeldReceipts?.()??[];(c.length>0||(s.state.held_receipts?.length??0)>0)&&s.save({held_receipts:c}),G!==null&&s.save({force_scope:G}),Je(s,D.paused)}catch(c){let p=s.state.checkpoint,y=`error: couldn't persist the pause for session ${s.state.sid}`+(p?` \u2014 last durable checkpoint: seq ${p.seq} @ ${p.ts}`:" \u2014 no durable checkpoint exists")+` (${c instanceof Error?c.message:String(c)})`;return e.out(y),e.emit?.({type:"error",message:y,code:"PAUSE_PERSIST_FAILED",sid:s.state.sid}),1}S("session_paused",{sid:s.state.sid},f.session_id);let d=E!=="interactive"?` --mode ${E}`:"",u=`kane-cli design tests --resume ${s.state.sid}${d}`;if(q||e.out(`paused \u2014 resume with: ${u}`),e.emit?.({type:"session_paused",sid:s.state.sid,mode:E,resume:u,expires_at:s.state.expires_at,pending_questions:D.paused.pending.questions}),q){let c=e.chat?.state.credits?.total;e.onSummary?.({state:"paused",reason:"ctrl+c",facts:[`session ${s.state.sid} saved \u2014 designing ${R.usecase.logical_id??r}`,...s.state.expires_at?[`expires: ${s.state.expires_at}`]:[],...c!==void 0?[`credits used: ${c.toFixed(1)}`]:[]],resume:u,resumeMessage:`${u} --message "<your words>"`,tracePath:Z(h)})}return O(),3}if(D.crashed&&i?.state.checkpoint){let s=i.state.checkpoint,d=E!=="interactive"?` --mode ${E}`:"",u=`kane-cli design tests --resume ${i.state.sid}${d}`;if(S("agent_crashed_resumable",{sid:i.state.sid,seq:s.seq},f.session_id),q||e.out(`agent crashed \u2014 session ${i.state.sid} is resumable at checkpoint seq ${s.seq} (at most the in-flight turn lost); resume with: ${u}`),e.emit?.({type:"session_paused",sid:i.state.sid,mode:E,resume:u,expires_at:i.state.expires_at,crashed:!0}),q){let c=e.chat?.state.credits?.total;e.onSummary?.({state:"crashed",facts:[`agent crashed \u2014 session ${i.state.sid} is resumable at checkpoint seq ${s.seq}`,"at most the in-flight turn was lost",...c!==void 0?[`credits used: ${c.toFixed(1)}`]:[]],resume:u,resumeMessage:`${u} --message "<your words>"`,tracePath:Z(h)})}return i.release(),i=null,3}if(D.error)return e.out(`error: design agent failed: ${D.error}`),e.emit?.({type:"error",message:`error: design agent failed: ${D.error}`}),J(),O(),1;if(D.proposal==null&&E!=="interactive")return e.out(`error: the design session stopped before saving anything \u2014 nothing committed (trace: ${h})`),e.emit?.({type:"error",message:`error: the design session stopped before saving anything \u2014 nothing committed (trace: ${h})`}),J(),O(),1;let K=0;if(D.proposal==null)try{let{readRecords:s}=await import("./records-JLS63SDI.js"),d=t.resume??f.session_id;K=s(e.contextDir).records.filter(u=>u.sid===d).reduce((u,c)=>u+c.nodes.filter(p=>p.label!=="source").length,0)}catch{}if(D.proposal==null&&e.out(K>0?`done \u2014 ${K} item(s) committed in this session (earlier legs included); nothing new since the resume`:"done \u2014 nothing designed this session (no finalize before the session ended)"),D.assumedDefaults&&e.out(`assumed: ${D.assumedDefaults} default(s) taken while unattended`),i&&e.emit?.({type:"session_complete",sid:t.resume??f.session_id}),g?.event("ASR_SESSION_COMPLETE",{}),i?.complete(),W)try{St(ve(e.contextDir,"sessions"))}catch{}if(M.length>0){let s=Kt(M,ae(e.contextDir));e.chat?e.chat.note(s):e.out(s),e.emit?.({type:"variables_summary",file:M[0].file,variables:M.map(({name:d,description:u,secret:c})=>({name:d,description:u,secret:c}))})}if(q){let s=e.chat.state.ledger.filter(c=>c.kind==="answer"&&c.receipt.form==="assumed").length??0,d=(D.assumedDefaults??0)+s,u=e.chat.state.credits?.total??D.creditsTotal;e.onSummary?.({state:"complete",facts:[`designed: ${R.usecase.logical_id??r}${D.proposal==null?K>0?` (${K} item(s) committed across this session)`:" (nothing committed this session)":""}`,...M.length>0?[`${M.length} variable(s) need values \u2014 see .testmuai/variables/assurance.json`]:[],...d>0?[`${d} assumed default(s)`]:[],...u!==void 0?[`credits used: ${u.toFixed(1)}`]:[]],tracePath:Z(h)})}return t.plan||Ze(e.contextDir),O(),0}function Kt(t,e){if(t.length===0)return"";let n=zt(e,t[0].file)||t[0].file,i=Math.max(...t.map(r=>r.name.length))+3,o=t.slice().sort((r,v)=>r.name<v.name?-1:1).map(r=>` ${r.name.padEnd(i)}${r.description}${r.secret?" (secret)":""}`);return`variables declared this session \u2014 fill their values before running:
|
|
365
|
+
${n}
|
|
366
|
+
${o.join(`
|
|
367
|
+
`)}
|
|
368
|
+
`}export{ii as a,Kt as b};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as v,b as A,d as G}from"./chunk-OS4VSIHT.js";import{b as x}from"./chunk-KAZGHWGK.js";import{a as
|
|
2
|
+
import{a as v,b as A,d as G}from"./chunk-OS4VSIHT.js";import{b as x}from"./chunk-KAZGHWGK.js";import{a as w}from"./chunk-BZAGVBCX.js";import{a as S}from"./chunk-JUJ4SAGH.js";import{a as U,b as C}from"./chunk-UJZZDPDY.js";import{C as E,D as $}from"./chunk-W3Z7AZNT.js";import{d,e as m}from"./chunk-AKX4VRRR.js";var k=new Set([d.USECASE,d.SCENARIO,d.AC,d.TEST]);function b(e,t){return!e.superseded.has(t)&&e.trust.get(t)!=="archived"}function h(e,t,n){let s=e.edgesFrom(t).find(o=>o.type===n);return s?e.tipOf(s.dst):null}function O(e,t,n){if(n===d.USECASE)return t;if(n===d.SCENARIO)return h(e,t,m.BELONGS_TO);if(n===d.AC){let s=h(e,t,m.SCOPED_TO);return s?e.nodeLabel.get(s)===d.USECASE?s:h(e,s,m.BELONGS_TO):null}if(n===d.TEST){let s=h(e,t,m.AUTOMATES);return s?h(e,s,m.BELONGS_TO):null}return null}function L(e,t){let n=e.nameOf.get(t);if(n)return n;for(let[s,o]of e.names)if(e.tipOf(o)===t)return s;return t}function F(e,t){return{ucTip:t,display:L(e,t),seamRef:e.nameOf.get(t)??t}}function N(e,t){let n=e.resolve(t);if(!n)return{ok:!1,message:`unknown ref '${t}' \u2014 no test/scenario/ac/use-case by that id or cid`};let s=n.tip,o=e.nodeLabel.get(s);if(!o||!k.has(o))return{ok:!1,message:`'${t}' is a ${o??"missing node"} \u2014 evolve takes a test, scenario, acceptance criterion, or use-case`};let a=O(e,s,o);return!a||e.nodeLabel.get(a)!==d.USECASE?{ok:!1,message:`cannot resolve '${t}' to a parent use-case \u2014 its ${o} chain is broken`}:e.superseded.has(a)?{ok:!1,message:`use-case ${L(e,a)} was removed \u2014 nothing to evolve`}:{ok:!0,target:F(e,a)}}function Z(e,t){return D(e,t)}function D(e,t){let n=[];for(let{cid:o}of e.byLabel(d.SCENARIO)){if(!b(e,o)||!e.edgesFrom(o).some(r=>r.type===m.BELONGS_TO&&e.tipOf(r.dst)===t))continue;let a=e.edgesInto(o).filter(r=>r.type===m.AUTOMATES&&b(e,r.src));if(a.length===0)n.push({scenario:o,test:null});else for(let r of a)n.push({scenario:o,test:r.src})}let s=new Map;for(let{cid:o}of e.byLabel(d.AC)){if(!b(e,o)||O(e,o,d.AC)!==t)continue;let a=e.edgesInto(o).filter(r=>r.type===m.VERIFIES&&b(e,r.src)).map(r=>r.src).sort();s.set(o,a)}return{pairs:n,verifies:s}}function B(e,t){let n=r=>`${r.scenario}\0${r.test??""}`,s=new Set(e.pairs.map(n)),o=new Set(t.pairs.map(n)),a=[];for(let[r,i]of e.verifies){let u=t.verifies.get(r);u&&(i.length===u.length&&i.every((l,g)=>l===u[g])||a.push({ac:r,before:i,after:u}))}return{superseded:e.pairs.filter(r=>!o.has(n(r))),minted:t.pairs.filter(r=>!s.has(n(r))),retained:t.pairs.filter(r=>s.has(n(r))),moves:a}}function _(e,t,n,s,o){let a=i=>t.nameOf.get(i)??i,r=i=>` - ${a(i.scenario)} \xB7 ${i.test?a(i.test):"(no test)"}`;e.out(`evolved: use-case ${n} \u2014 design record ${s.before} \u2192 ${s.after}`),e.out(` superseded ${o.superseded.length} pair(s)`);for(let i of o.superseded)e.out(r(i));e.out(` minted ${o.minted.length} pair(s)`);for(let i of o.minted)e.out(r(i));e.out(` retained ${o.retained.length} pair(s)`);for(let i of o.retained)e.out(r(i));if(o.moves.length===0)e.out(" verifies none moved");else{e.out(" verifies moved:");for(let i of o.moves){let u=l=>l.length>0?l.map(a).join(" + "):"(none)";e.out(` - ${a(i.ac)}: ${u(i.before)} \u2192 ${u(i.after)}`)}}}async function R(e,t,n,s,o,a,r){let i=E(e),u=S(i,t.ucTip);if(!u)return a==="batch"?(s.out(`note: ${t.display} has no design output \u2014 nothing to evolve; run kane-cli design tests --use-case ${t.display} first`),{code:0,outcome:"no-design"}):(v(s,`nothing to evolve \u2014 run kane-cli design tests --use-case ${t.display} first (no design output)`),{code:2,outcome:"no-design"});let l=D(i,t.ucTip),g=[`evolve ${t.display}`,` re-designs use-case ${t.display}`,` affects ${l.pairs.length} pair(s)`,...n.because?[` because ${n.because}`]:[]];if(n.yes)for(let y of g)s.out(y);else{for(let I of g)s.out(I);if(!await s.confirm(`proceed with the re-design of ${t.display}?`))return s.out(a==="batch"?`skipped ${t.display}`:"declined \u2014 nothing evolved"),{code:0,outcome:"declined"}}let p=x(e,i,t.ucTip,n.because),c=await U(r,{verb:"evolve",subject:t.display},()=>o(t.seamRef,{yes:!!n.yes,...n.mode?{mode:n.mode}:{},...n.because?{because:n.because}:{},...p!==void 0?{changeDelta:p.change_delta,priorDesign:p.prior_design}:{}}),y=>({ok:y===0,exitCode:y}));if(c===3)return s.out(`design session for ${t.display} paused \u2014 resume with \`kane-cli design tests --resume\`, then re-run evolve for the diff`),{code:c,outcome:"paused"};if(c!==0)return v(s,`design run for ${t.display} ended with exit code ${c} \u2014 no diff to report`),{code:c,outcome:"failed"};let f=E(e),T=f.tipOf(t.ucTip),P=S(f,T)?.seq;return _(s,f,t.display,{before:u.seq,after:P??"?"},B(l,D(f,T))),{code:0,outcome:"evolved"}}function j(e){let t=new Map,n=0;for(let{cid:o,state:a}of e.staleList()){if(a==="superseded")continue;let r=e.nodeLabel.get(o);if(!r||!k.has(r)||!b(e,o)||!$(e,o))continue;let i=O(e,o,r);!i||e.nodeLabel.get(i)!==d.USECASE||e.superseded.has(i)||(n++,t.has(i)||t.set(i,F(e,i)))}return{targets:[...t.values()].sort((o,a)=>o.display<a.display?-1:o.display>a.display?1:0),staleCount:n}}function M(e,t){for(let{cid:n,state:s}of e.staleList()){if(s==="superseded")continue;let o=e.nodeLabel.get(n);if(!(!o||!k.has(o)||!b(e,n))&&$(e,n)&&O(e,n,o)===t)return!0}return!1}async function q(e,t,n,s={},o=process.cwd()){if(e&&t.fromStale)return v(n,"pass a <ref> OR --from-stale, not both"),2;if(!e&&!t.fromStale)return v(n,"evolve needs a <ref> or --from-stale"),2;let a=A(o,n);if(!a)return 2;let r=s.runDesignForUc??Y,i=s.onChild??(n.isTTY?V(n):void 0);n.out(`evolving ${e??"stale use-cases"}: reading the graph\u2026`);let u=E(a),l,g=null;if(e){let c=N(u,e);if(!c.ok)return v(n,c.message),2;if(!t.because&&S(u,c.target.ucTip)&&!M(u,c.target.ucTip))return v(n,`nothing changed underneath ${e} \u2014 its sources and requirements are current; use --because "<reason>" to re-design anyway`),2;l=[c.target]}else{let{targets:c,staleCount:f}=j(u);if(c.length===0)return n.out("nothing stale \u2014 nothing to evolve"),0;g=`from-stale: ${f} stale node(s) \u2192 ${c.length} use-case(s)`,l=c}if(!t.yes&&!n.isTTY)return v(n,"evolve needs a TTY \u2014 the blast-radius confirm is the point; headless evolution rides `kane-cli maintain reconcile`"),2;if(g&&n.out(g),e){let c=await R(a,l[0],t,n,r,"single",i);return c.outcome==="evolved"&&t.because&&w(a,{ts:new Date().toISOString(),command:"evolve",id:e,verdict:"gap-resolved-evolve",polarity:"preference",by:{kind:"human",id:process.env.USER??"operator"},target:e,reason:t.because}),c.code}let p=0;for(let c of l){let{code:f}=await R(a,c,t,n,r,"batch",i);f!==0&&p===0&&(p=f)}return p}function V(e){let t="",n="evolve";return s=>{s.kind==="start"?(t=s.subject,n=s.verb,e.out(`\u25CF ${C(s.verb).ing} ${s.subject}`)):s.kind==="end"&&e.out(s.ok?`\u25CF ${C(n).ed} ${t} \u2014 ${s.durS}s`:`\u25CF ${n} failed \u2014 ${s.exitCode!=null?`exited ${s.exitCode}`:"error"}${s.fixCmd?` \xB7 ${s.fixCmd}`:""}`)}}var Y=async(e,t)=>{let{designTestsCommand:n}=await import("./bind-A3M4PV4V.js"),s=()=>n({useCase:e,force:!0,...t.mode?{mode:t.mode}:t.yes?{mode:"override"}:{},...t.because?{because:t.because}:{},...t.changeDelta!==void 0?{changeDelta:t.changeDelta}:{},...t.priorDesign!==void 0?{priorDesign:t.priorDesign}:{}});if(t.mode!=="agent")return s();let o=process.stdout.write;process.stdout.write=((...a)=>!0);try{return await s()}finally{process.stdout.write=o}};async function ee(e,t){return q(e,t,G(),{})}export{N as a,Z as b,R as c,j as d,q as e,Y as f,ee as g};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{b as f}from"./chunk-
|
|
2
|
+
import{b as f}from"./chunk-F2CET54H.js";import{c as g}from"./chunk-UD7KKHPW.js";import{existsSync as u}from"fs";import{dirname as A,resolve as l}from"path";import{fileURLToPath as E}from"url";var p=A(E(import.meta.url));function _(){return[l(p,".."),l(p,"../../..")]}function x(s){return{"darwin-arm64":"kane-cli-darwin-arm64","darwin-x64":"kane-cli-darwin-x64","linux-x64":"kane-cli-linux-x64","linux-arm64":"kane-cli-linux-arm64","win32-x64":"kane-cli-win-x64"}[s]??null}function T(s){return{"darwin-arm64":"kane-cli-assurance-darwin-arm64","darwin-x64":"kane-cli-assurance-darwin-x64","linux-x64":"kane-cli-assurance-linux-x64","linux-arm64":"kane-cli-assurance-linux-arm64","win32-x64":"kane-cli-assurance-win-x64"}[s]??null}function I(s=_()){let n=x(`${process.platform}-${process.arch}`),i=T(`${process.platform}-${process.arch}`),a=process.platform==="win32"?"assurance-agent.exe":"assurance-agent";for(let e of s){for(let t of i?["@testmuai","@lambdatestincprivate"]:[]){let m=l(e,"node_modules",t,i,"bin",a);if(u(m))return{cmd:m,args:[],tier:"platform"}}for(let t of n?["@testmuai","@lambdatestincprivate"]:[]){let m=l(e,"node_modules",t,n,"bin",a);if(u(m))return{cmd:m,args:[],tier:"platform"}}let c=l(e,"dist","bin",a);if(u(c))return{cmd:c,args:[],tier:"embedded"};let r=l(e,"../assurance-agent/dist",a);if(u(r))return{cmd:r,args:[],tier:"sibling"};let o=l(e,"../assurance-agent/main.py");if(u(o)){let t=l(e,"../assurance-agent/.venv/bin/python");return{cmd:u(t)?t:"python3",args:[o],tier:"dev-python"}}}return null}function U(s,n={}){return{...process.env,...n,...f(),TESTMUAI_SOURCE:"kane-cli",TESTMUAI_SESSION_ID:s,ASSURANCE_LOG_LEVEL:process.env.ASSURANCE_LOG_LEVEL??"info"}}async function P(){if(process.env.TESTMUAI_API_KEY||process.env.TESTMUAI_BASIC_AUTH)return{};try{let{CredentialsManager:s}=await import("./credentials-6DP4KAMJ.js"),n=process.env.TESTMUAI_ENV==="stage"?"stage":"prod",i=new s,a=i.getActiveProfile()??"default",e={TESTMUAI_ENV:n},c=i.loadBasicAuth(a,n);if(c)return e.TESTMUAI_BASIC_AUTH=Buffer.from(`${c.username}:${c.access_key}`,"utf8").toString("base64"),e;let r=i.loadCredentials(a,n);if(r){try{let{refreshOAuthToken:t}=await import("./token-refresh-GSFVJ6GU.js");await t({creds:i,profile:a,env:n,credentials:r})}catch{}let o=i.loadCredentials(a,n)??r;if(typeof o.access_token=="string"){let t=await w(n,o.access_token);return t?(e.TESTMUAI_BASIC_AUTH=t,e):(e.TESTMUAI_API_KEY=o.access_token,e)}}return{}}catch{return{}}}var h=8e3;function d(){return g("warn: session auth may expire during long runs \u2014 if that happens, run `kane-cli login` and retry","AUTH_EXCHANGE_FAILED"),null}async function w(s,n){try{let[{getEnvironment:i},{ControllerClient:a}]=await Promise.all([import("./config-HUK7V364.js"),import("./controller-client-OB4WD2C4.js")]),e=new a(i(s).controllerBaseUrl,n),c;try{let r=await Promise.race([e.getTmsCredentials().catch(()=>null),new Promise(o=>{c=setTimeout(()=>o(null),h)})]);if(typeof r?.username!="string"||!r.username||typeof r.access_key!="string"||!r.access_key)return d();try{let[{refreshIdentitySnapshot:o},{telemetryEnvName:t}]=await Promise.all([import("./identity-ADZ4PAJF.js"),import("./bootstrap-QTVHGL45.js")]);await o(t(),r)}catch{}return Buffer.from(`${r.username}:${r.access_key}`,"utf8").toString("base64")}finally{clearTimeout(c)}}catch{return d()}}export{x as a,T as b,I as c,U as d,P as e};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as l}from"./chunk-RZ4F3BHX.js";import{a,b as c,e as o}from"./chunk-
|
|
2
|
+
import{a as l}from"./chunk-RZ4F3BHX.js";import{a,b as c,e as o}from"./chunk-NJJQL54J.js";import{readFileSync as f,writeFileSync as d,mkdirSync as h,realpathSync as g}from"fs";import{join as y}from"path";var C="npm install -g @testmuai/kane-cli@latest",b="brew upgrade lambdatest/kane/kane-cli";function w(){try{let t=process.argv[1];if(t&&g(t).includes("/Cellar/"))return b}catch{}return C}var m=y(c,"version-check.json"),S=1440*60*1e3;function k(){try{let t=JSON.parse(f(m,"utf-8"));if(Date.now()-t.checkedAt<S)return t}catch{}return null}function A(t){try{h(c,{recursive:!0}),d(m,JSON.stringify({latest:t,checkedAt:Date.now()}))}catch{}}function u(t,r){let i=t.split(".").map(Number),n=r.split(".").map(Number);for(let s=0;s<3;s++){let e=(n[s]??0)-(i[s]??0);if(e!==0)return e}return 0}function p(t,r){let i=t.split(".").map(Number),n=r.split(".").map(Number);return(n[0]??0)!==(i[0]??0)?"major":(n[1]??0)!==(i[1]??0)?"minor":"patch"}async function j(){try{let t=k();if(t)return u(a,t.latest)>0?{current:a,latest:t.latest,severity:p(a,t.latest)}:null;let r=new AbortController,i=setTimeout(()=>r.abort(),5e3),n=await l(o,{headers:{Accept:"application/json"},signal:r.signal});if(clearTimeout(i),!n.ok)return null;let e=(await n.json())["dist-tags"]?.latest;return e?(A(e),u(a,e)>0?{current:a,latest:e,severity:p(a,e)}:null):null}catch{return null}}export{w as a,u as b,p as c,j as d};
|