@testmuai/kane-cli 0.8.1 → 0.8.3
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/bin/kane-cli.cjs +1 -1
- package/bin/resolve-runtime.cjs +8 -0
- package/dist/ChatSurface-FJSO3IKR.js +8 -0
- package/dist/{ChromeProfilePicker-AUU7JF6F.js → ChromeProfilePicker-NTZ2RN3L.js} +1 -1
- package/dist/{CliFeedbackPrompt-4W74Y3UF.js → CliFeedbackPrompt-BCHUH24C.js} +1 -1
- package/dist/{CliUploadProgress-6HL7WTEX.js → CliUploadProgress-QVAJJRUW.js} +1 -1
- package/dist/{ConfigView-6BSCZP5Y.js → ConfigView-LAKAQN7O.js} +1 -1
- package/dist/EvidenceViewOffer-POKUWAPS.js +2 -0
- package/dist/FolderPicker-GR6FZMUJ.js +2 -0
- package/dist/{HelpView-TU7ED43J.js → HelpView-JFFVHQAW.js} +1 -1
- package/dist/{InfoBox-JLTMKVDE.js → InfoBox-46C7AHDE.js} +1 -1
- package/dist/{LinksBox-LREUUJDV.js → LinksBox-KFJXZDUJ.js} +1 -1
- package/dist/{ProfilesView-W3GX2N2E.js → ProfilesView-FV3KFVBX.js} +1 -1
- package/dist/{ProjectPicker-SYQUJK2J.js → ProjectPicker-MCH35VEF.js} +1 -1
- package/dist/{SaveSessionPrompt-MR5NJMRP.js → SaveSessionPrompt-RXHP3YW6.js} +1 -1
- package/dist/SingleShotApp-BK5QNXGG.js +2 -0
- package/dist/{SummaryBox-UAYSVFB7.js → SummaryBox-33K2MMUW.js} +1 -1
- package/dist/TestMdRunView-AT26LOSG.js +2 -0
- package/dist/{WhoamiView-2YU76ASQ.js → WhoamiView-HUPBB5AQ.js} +1 -1
- package/dist/app-client-ZCCNE3RV.js +2 -0
- package/dist/{app-download-AEEFQ63M.js → app-download-3O7NJNGG.js} +1 -1
- package/dist/{auth-HET3TBRI.js → auth-OMWFVDL2.js} +1 -1
- package/dist/{bind-STKXOUYI.js → bind-NXXKFJMA.js} +2 -2
- package/dist/bootstrap-MMRPAHWE.js +2 -0
- package/dist/bridge-UH32UGR5.js +2 -0
- package/dist/{changelog-7OWRHFHZ.js → changelog-VZ5HFHYM.js} +1 -1
- package/dist/{chat-controller-T2FAI55V.js → chat-controller-R4THYYPU.js} +1 -1
- package/dist/{chunk-HMYMSRA4.js → chunk-2ERQYYSJ.js} +1 -1
- package/dist/{chunk-DCY6R5DP.js → chunk-2N4SZOWN.js} +1 -1
- package/dist/{chunk-FMRSMN34.js → chunk-2ZDXNTZT.js} +1 -1
- package/dist/{chunk-OTTGS2TE.js → chunk-37ZWKLEN.js} +1 -1
- package/dist/{chunk-UV462FZR.js → chunk-3MFTTLOF.js} +1 -1
- package/dist/{chunk-DO5HAO3H.js → chunk-3S5DDQLP.js} +1 -1
- package/dist/{chunk-BRHNRCEZ.js → chunk-4FQI643D.js} +1 -1
- package/dist/chunk-4G4RWARU.js +2 -0
- package/dist/{chunk-GZPK6FRP.js → chunk-5BVOF4UW.js} +1 -1
- package/dist/{chunk-C7HSWZP6.js → chunk-5CKQTZMG.js} +1 -1
- package/dist/{chunk-ZVHCQMJ6.js → chunk-5NQ3TI4S.js} +2 -2
- package/dist/{chunk-6O3DDOP2.js → chunk-5OVEBP4D.js} +1 -1
- package/dist/{chunk-FQLIW3LM.js → chunk-6G5YKTVN.js} +1 -1
- package/dist/chunk-6J5T5FEY.js +2 -0
- package/dist/{chunk-QRZRSAZH.js → chunk-7YZMUTJA.js} +1 -1
- package/dist/chunk-A2SQD2AY.js +4 -0
- package/dist/chunk-A5FFLJVL.js +26 -0
- package/dist/{chunk-RFR4ZKIC.js → chunk-AF572MQG.js} +2 -2
- package/dist/{chunk-HCKH44I2.js → chunk-APETOVZK.js} +1 -1
- package/dist/{chunk-AW2XUHH4.js → chunk-AVH3BEEU.js} +1 -1
- package/dist/chunk-AXTPNZPX.js +2 -0
- package/dist/{chunk-2WVKOZ6W.js → chunk-BPMSNGXQ.js} +1 -1
- package/dist/{chunk-EDSZJZFG.js → chunk-CDB3SYZG.js} +1 -1
- package/dist/{chunk-T5Y6MOLM.js → chunk-CJP7RX3E.js} +1 -1
- package/dist/{chunk-G7VQCS4J.js → chunk-CVCVBQP6.js} +1 -1
- package/dist/{chunk-YFYCCTSL.js → chunk-D5VYMHSO.js} +1 -1
- package/dist/chunk-D6FYCAIA.js +2 -0
- package/dist/{chunk-ZIUAOEUC.js → chunk-DJR3M7XO.js} +1 -1
- package/dist/{chunk-65ZTD5SJ.js → chunk-DN42IM2Z.js} +2 -2
- package/dist/{chunk-TKGUT425.js → chunk-DOG7S7R6.js} +1 -1
- package/dist/chunk-DSXSU5MH.js +10 -0
- package/dist/{chunk-QSDH5P7C.js → chunk-DVYO4CR2.js} +1 -1
- package/dist/chunk-DXI5TXNL.js +19 -0
- package/dist/{chunk-JJHG3BWO.js → chunk-EBJD2V4Z.js} +1 -1
- package/dist/chunk-FPAJURPL.js +2 -0
- package/dist/{chunk-3LJWYRAA.js → chunk-GIQURCTO.js} +1 -1
- package/dist/{chunk-2BGUUWNF.js → chunk-GR35ZFM2.js} +2 -2
- package/dist/chunk-HJ6AXOCR.js +2 -0
- package/dist/{chunk-6XX4LEVJ.js → chunk-IEOHAHZO.js} +1 -1
- package/dist/{chunk-QW6EZC53.js → chunk-IFIXY3YG.js} +1 -1
- package/dist/{chunk-XO5ZH3ZR.js → chunk-IHAHCFFG.js} +1 -1
- package/dist/chunk-ITTZYA2G.js +4 -0
- package/dist/chunk-IVYXXZEE.js +6 -0
- package/dist/chunk-IWWQTXGK.js +11 -0
- package/dist/{chunk-GCBKDX2J.js → chunk-JANVTG62.js} +1 -1
- package/dist/{chunk-IOFZSQAA.js → chunk-KGSVOTLG.js} +1 -1
- package/dist/{chunk-L7MXYCD7.js → chunk-KOMKHFC4.js} +1 -1
- package/dist/{chunk-EWCAFKLX.js → chunk-KZVEFBH5.js} +1 -1
- package/dist/{chunk-FEJXWJ3L.js → chunk-LCU2P3CH.js} +1 -1
- package/dist/{chunk-RC52N7PC.js → chunk-LNQCZ5DS.js} +1 -1
- package/dist/{chunk-IP2O264K.js → chunk-LP3BSP74.js} +1 -1
- package/dist/chunk-LQQXPY5B.js +4 -0
- package/dist/{chunk-3POR47RC.js → chunk-LSZVSYAP.js} +2 -2
- package/dist/chunk-MMBBQ4OZ.js +2 -0
- package/dist/chunk-NNCMMV6P.js +349 -0
- package/dist/{chunk-YJELGSKJ.js → chunk-NVGM5ISX.js} +1 -1
- package/dist/{chunk-GKYPNSQP.js → chunk-NWJOPZ7P.js} +2 -2
- package/dist/{chunk-ELM6MXGJ.js → chunk-NXXJ56QA.js} +1 -1
- package/dist/{chunk-NX7TM662.js → chunk-QJTXNQV5.js} +1 -1
- package/dist/chunk-RKXHVP2Z.js +2 -0
- package/dist/chunk-RUCSRS4C.js +5 -0
- package/dist/{chunk-TFPPEOAK.js → chunk-SA2LQSYP.js} +1 -1
- package/dist/chunk-SPQPOUUR.js +11 -0
- package/dist/chunk-SQDKYSWT.js +12 -0
- package/dist/chunk-TAOHYWEO.js +2 -0
- package/dist/{chunk-UXDL4XDL.js → chunk-TRVB7RSW.js} +1 -1
- package/dist/{chunk-SDPRO2LE.js → chunk-TUTDSX7T.js} +1 -1
- package/dist/{chunk-766WGMBU.js → chunk-UBTNWAKK.js} +1 -1
- package/dist/chunk-UJZZDPDY.js +2 -0
- package/dist/chunk-VK3NU742.js +21 -0
- package/dist/{chunk-DZGCXKKI.js → chunk-WCF2Z4SE.js} +1 -1
- package/dist/{chunk-KU6IXFGZ.js → chunk-WMMJXI5O.js} +1 -1
- package/dist/chunk-X2FM67OM.js +4 -0
- package/dist/chunk-XMYCRE5K.js +4 -0
- package/dist/chunk-XO45NGSN.js +2 -0
- package/dist/chunk-YJNGBZ42.js +4 -0
- package/dist/{chunk-7JWKHKFU.js → chunk-ZH64GOBG.js} +1 -1
- package/dist/{chunk-UDIQOJEL.js → chunk-ZNNRCUHH.js} +1 -1
- package/dist/{chunk-KFSUPQAG.js → chunk-ZUYPPPC5.js} +43 -43
- package/dist/{config-RS47F5SC.js → config-OTUKOTHM.js} +1 -1
- package/dist/{credentials-OH6AVI6N.js → credentials-A3RU25MJ.js} +1 -1
- package/dist/deps-bundle-RIBEQC2R.js +2 -0
- package/dist/{deps-resolve-XC5S53DG.js → deps-resolve-7SWSUDRX.js} +1 -1
- package/dist/dispatch-RHSWJJLC.js +2 -0
- package/dist/doctor-XP7YDE3J.js +2 -0
- package/dist/evidence-K7R7OG2K.js +2 -0
- package/dist/evolve-cmd-FFF3F3HO.js +2 -0
- package/dist/extract-bind-VIPNGK2H.js +10 -0
- package/dist/{extract-cmd-UZMEZMGP.js → extract-cmd-5J47Q4XU.js} +1 -1
- package/dist/gaps-cmd-WPCJPLGB.js +3 -0
- package/dist/{generate-headless-D3SVQ2AI.js → generate-headless-AJI2OVRG.js} +2 -2
- package/dist/index.js +61 -60
- package/dist/{ingest-EX72IEQT.js → ingest-4447MYLF.js} +1 -1
- package/dist/ingest-cmd-2LK7DWDW.js +2 -0
- package/dist/interactive-bind-PI3HY623.js +25 -0
- package/dist/{list-commands-MRXL5HGS.js → list-commands-7Y5XV5FK.js} +1 -1
- package/dist/login-flow-Z45G34DM.js +2 -0
- package/dist/mobile-prompts-O5ALU3QU.js +2 -0
- package/dist/{persist-recorded-session-TLDQ5HKP.js → persist-recorded-session-TKSU4HOA.js} +1 -1
- package/dist/{phase-seed-VFHIH6FL.js → phase-seed-DIRETNU6.js} +1 -1
- package/dist/{pipeline-UOM4LNAI.js → pipeline-HZUV7IMT.js} +1 -1
- package/dist/prepare-target-DBYKQ7HW.js +2 -0
- package/dist/reconcile-cmd-VHEW2DY5.js +2 -0
- package/dist/reconcile-deps-UJ6KVUIS.js +4 -0
- package/dist/reconcile-engine-NUQJSIFX.js +2 -0
- package/dist/{recording-banner-4M7XHVGI.js → recording-banner-GO2PP53Y.js} +1 -1
- package/dist/registry-KYPVINS2.js +2 -0
- package/dist/{require-project-folder-4UPQNEBJ.js → require-project-folder-NUQMH224.js} +1 -1
- package/dist/resolve-run-intent-H3HX5KUC.js +7 -0
- package/dist/{resolver-UBOZLFFE.js → resolver-HHLYRR5W.js} +1 -1
- package/dist/run-67ONKMGR.js +2 -0
- package/dist/{run-URPGHOQM.js → run-OPLOL3PZ.js} +1 -1
- package/dist/{run-test-md-76ZPKXO6.js → run-test-md-3BA56ZYF.js} +2 -2
- package/dist/session-items-2ATN7VXG.js +2 -0
- package/dist/{skill-installer-CIS6GAYF.js → skill-installer-O7JYVZXD.js} +1 -1
- package/dist/{spawner-J67QR4QP.js → spawner-OZ4OE44T.js} +1 -1
- package/dist/tcg-generate-EG2MXRJ7.js +2 -0
- package/dist/{testmd-actions-77ELR5UU.js → testmd-actions-YJ7O43Z6.js} +1 -1
- package/dist/{tms-client-VD3B3SMU.js → tms-client-V3TR4QW3.js} +1 -1
- package/dist/token-refresh-K7CANKFQ.js +2 -0
- package/dist/{validate-basic-2GVSQ2R5.js → validate-basic-HWYK3CU6.js} +1 -1
- package/dist/{verdicts-TRSTJLCL.js → verdicts-KFPMRADV.js} +1 -1
- package/dist/{version-check-O6PYTI4T.js → version-check-3ECNG5V2.js} +1 -1
- package/dist/walk-session-MZCMXVZB.js +2 -0
- package/dist/with-telemetry-Q6V6THIF.js +2 -0
- package/package.json +12 -12
- package/dist/ChatSurface-U37VZDCW.js +0 -8
- package/dist/EvidenceViewOffer-62XHEEGW.js +0 -2
- package/dist/FolderPicker-S7U2EN2M.js +0 -2
- package/dist/SingleShotApp-XOKVOM7C.js +0 -2
- package/dist/TestMdRunView-7UVSDAF4.js +0 -2
- package/dist/app-client-OEXESV4U.js +0 -2
- package/dist/bootstrap-44YKVWWE.js +0 -2
- package/dist/bridge-5Z3BIB77.js +0 -2
- package/dist/chunk-27U4PLPX.js +0 -2
- package/dist/chunk-2KDGIZED.js +0 -4
- package/dist/chunk-3PECJD6S.js +0 -11
- package/dist/chunk-7BZSCUPP.js +0 -10
- package/dist/chunk-7Q6M6P4X.js +0 -26
- package/dist/chunk-CTW2VQKS.js +0 -6
- package/dist/chunk-FNH55WSR.js +0 -19
- package/dist/chunk-GPG3FIN3.js +0 -21
- package/dist/chunk-HEAIJCGZ.js +0 -2
- package/dist/chunk-KCCSWEGA.js +0 -4
- package/dist/chunk-MA34UWKX.js +0 -4
- package/dist/chunk-MBF3FP5P.js +0 -5
- package/dist/chunk-MXHHMIO2.js +0 -349
- package/dist/chunk-OMQCD3KR.js +0 -2
- package/dist/chunk-QGKPLOUI.js +0 -2
- package/dist/chunk-RLRNLIRS.js +0 -2
- package/dist/chunk-TYLYFERW.js +0 -10
- package/dist/chunk-V2R3LCA3.js +0 -12
- package/dist/chunk-VGFTNLQQ.js +0 -2
- package/dist/chunk-W2JFDDIB.js +0 -2
- package/dist/chunk-W4B5LOEX.js +0 -4
- package/dist/chunk-YRFMPIU2.js +0 -4
- package/dist/dispatch-SE5GY3Z2.js +0 -2
- package/dist/doctor-FSECFZUU.js +0 -2
- package/dist/evidence-OYPHZUKI.js +0 -2
- package/dist/evolve-cmd-BCPNXAMV.js +0 -2
- package/dist/extract-bind-LLEASZAK.js +0 -10
- package/dist/gaps-cmd-IVXFPFAQ.js +0 -3
- package/dist/ingest-cmd-EAE7N5RC.js +0 -2
- package/dist/interactive-bind-ORMN2REX.js +0 -25
- package/dist/login-flow-QJQM3RHT.js +0 -2
- package/dist/mobile-prompts-TOX35ER6.js +0 -2
- package/dist/prepare-target-QYWIJIVQ.js +0 -2
- package/dist/reconcile-cmd-3H34KVVD.js +0 -2
- package/dist/reconcile-deps-XIH75ZLY.js +0 -4
- package/dist/reconcile-engine-UKWPG2LV.js +0 -2
- package/dist/registry-PYOTKZYZ.js +0 -2
- package/dist/resolve-run-intent-X72V3KJA.js +0 -7
- package/dist/run-2COODVX2.js +0 -2
- package/dist/tcg-generate-BDTRKY2A.js +0 -2
- package/dist/token-refresh-4BPAPXKK.js +0 -2
- package/dist/walk-session-CHJXHZMO.js +0 -2
- package/dist/with-telemetry-CQCWLVOC.js +0 -2
- /package/dist/{lifecycle-cmd-O2324GN6.js → lifecycle-cmd-HO5VL7AM.js} +0 -0
|
@@ -0,0 +1,349 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import{a as Ke}from"./chunk-KHU7C6EE.js";import{c as Ve}from"./chunk-IOD3HQVW.js";import{a as We,b as ue}from"./chunk-3Q6WAK6P.js";import{a as Ue,b as ze}from"./chunk-JZ26R6UL.js";import{a as Z,b as je,e as le,f as de,g as Me,h as He}from"./chunk-WMMJXI5O.js";import{a as Ne,c as Le,d as Be,e as me,f as Ge}from"./chunk-ZGBSGZZM.js";import{a as Ae,b as Ie,c as Pe}from"./chunk-4FQI643D.js";import{a as Ee,b as Ce,c as Te}from"./chunk-BB2W35TW.js";import{a as qe}from"./chunk-L2TV4G56.js";import{c as Oe}from"./chunk-6KPPGMO2.js";import{a as $e,e as Re}from"./chunk-GFKCTYCA.js";import{a as Fe}from"./chunk-IMR64OCZ.js";import{b as be,c as we,d as ve,e as ae,f as oe,g as ce}from"./chunk-ZPDM6FO7.js";import{a as ne}from"./chunk-L5LI2JF4.js";import{a as ye,b as re}from"./chunk-IDX3TOPY.js";import{A as U}from"./chunk-TH47OOBV.js";import{f as De}from"./chunk-DUAXZYAD.js";import{a as ke,e as xe,f as Se}from"./chunk-DBIBROYW.js";import{d as W,e as X}from"./chunk-WXHQYYD5.js";import{a as _e}from"./chunk-5EOX4MEY.js";import{mkdirSync as St,appendFileSync as Dt,rmdirSync as dt}from"fs";import{randomBytes as $t}from"crypto";import{dirname as mt,join as he}from"path";function Qe(t,e){let n=[];for(let i of e??[]){let g=t.resolve(i.ref)?.tip??null;g!==i.cid&&n.push({ref:i.ref,pinned:i.cid,now:g})}return n}import{existsSync as ge,readFileSync as pe,readdirSync as pt}from"fs";import{join as te}from"path";var Ye=`
|
|
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 Je={"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: 1
|
|
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"
|
|
170
|
+
emits: state-transition
|
|
171
|
+
- id: network-transitions
|
|
172
|
+
family: state_flow
|
|
173
|
+
measurable_example: "wifi\u2192cellular\u21924G drop: no data loss, graceful retry"
|
|
174
|
+
emits: state-transition
|
|
175
|
+
- id: permissions
|
|
176
|
+
family: negative
|
|
177
|
+
measurable_example: "Deny camera \u2192 feature degrades, no crash"
|
|
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"
|
|
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"
|
|
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 Xe=`
|
|
316
|
+
version: 1
|
|
317
|
+
principles:
|
|
318
|
+
- "Each step is one complete OBJECTIVE the browser 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, page, 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
|
+
- "Browser-only: the agent authors/runs BROWSER tests. Direct API calls and the page's own network traffic ARE in scope; native-app-only behavior, out-of-band email/SMS, backend state with no browser surface are NOT."
|
|
323
|
+
verification:
|
|
324
|
+
- "Phrase checks against the analyzer that observes them:"
|
|
325
|
+
- "Visual \u2014 visible text, labels, counts, prices ('verify the price is 29.99', 'the Sold out label is shown')."
|
|
326
|
+
- "Textual/DOM \u2014 element states/attributes ('the Add button is disabled', 'the placeholder of the search box is \u2026')."
|
|
327
|
+
- "URL \u2014 'URL contains /checkout', 'redirected to /login'. Title \u2014 'page title contains \u2026'."
|
|
328
|
+
- "DevTools/Network \u2014 'no API calls returned 5xx', 'the POST /api/login returned 200' (covers direct API calls too)."
|
|
329
|
+
- "DevTools/Console \u2014 'no console errors'. Performance \u2014 'LCP under 2500ms'. Cookies/localStorage \u2014 'a cookie named session_id exists'."
|
|
330
|
+
- "Assertions: 'Assert/Verify/Confirm \u2026'. Extractions: 'Store \u2026 as name' \u2014 vague verbs (read/tell/report) do NOT persist values."
|
|
331
|
+
- "Baselines/deltas are EXTRACTIONS: 'store the result count as baseline_count' BEFORE the action; compare after. Never an abstract 'capture the state'."
|
|
332
|
+
variables:
|
|
333
|
+
- "Credentials and environment values are {{name}} variables; concrete domain values from the source stay literal."
|
|
334
|
+
- "A value no evidence supplies (start URL, test account, seed data) is ASKED for \u2014 actual value or a variable name \u2014 never invented."
|
|
335
|
+
pitfalls:
|
|
336
|
+
- "A test without a starting URL cannot run \u2014 the first step names it."
|
|
337
|
+
- "'Test the checkout flow' has no end state \u2014 state what done looks like."
|
|
338
|
+
- "Do not cram many unrelated operations into one step; do not reference data outside the step."
|
|
339
|
+
`;var ft=["presence","forbidden-presence","count","delta","state-transition","absolute","bound","propagation","latency","graded"];function tt(t,e){for(let n of t)if(!ft.includes(n))throw new Error(`${e}: emits '${n}' is not an oracle kind`)}function Ze(t,e){let n=ne(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`);tt(i.emits,`${e}: technique '${i.id}'`)}return n.techniques}function et(t,e){let n=ne(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`);tt([i.emits],`${e}: check '${i.id}'`)}return n}function st(t){let e=new Map(Ze(Ye,"packaged techniques").map(i=>[i.id,i])),n=te(t,"design","techniques.yaml");if(ge(n))for(let i of Ze(pe(n,"utf8"),n))e.set(i.id,i);return[...e.values()]}function it(t){let e=new Map(Object.entries(Je).map(([i,g])=>[i,et(g,`packaged profile '${i}'`)])),n=te(t,"design","profiles");if(ge(n))for(let i of pt(n).filter(g=>g.endsWith(".yaml")||g.endsWith(".yml")).sort()){let g=et(pe(te(n,i),"utf8"),te(n,i));e.set(g.id,g)}return[...e.values()]}function nt(t){let e=te(t,"design","runner-grammar.yaml");return ge(e)?pe(e,"utf8"):Xe}function se(t,e){return!t.superseded.has(e)}function fe(t,e,n){return{cid:e,logical_id:t.nameOf.get(e)??null,content:n}}async function rt(t,e,n,i,g){let r=await je(t,"search_similar",{text:e,label:n,k:i},g);return r.ok&&Array.isArray(r.result)?r.result:[]}async function at(t,e,n={}){let i=U(t),g=i.resolve(e);if(!g)throw new Error(`assembleDesignContext: unknown use-case '${e}' (run designGate first)`);let r=g.tip,w=i.getNode(r);if(!w||w.label!==W.USECASE)throw new Error(`assembleDesignContext: '${e}' is not a use-case (run designGate first)`);let I=i.derivesInto(r).map(u=>({source_id:u.props.source_id??null,anchor:u.props.anchor??null})),k=[],T=new Set;for(let{cid:u,content:f}of i.byLabel(W.SCENARIO))se(i,u)&&i.edgesFrom(u).some(b=>b.type===X.BELONGS_TO&&b.dst===r)&&(k.push(fe(i,u,f)),T.add(u));let x=[];for(let{cid:u,content:f}of i.byLabel(W.AC)){if(!se(i,u))continue;let b=i.edgesFrom(u).find($=>$.type===X.SCOPED_TO);!b||b.dst!==r&&!T.has(b.dst)||x.push({...fe(i,u,f),scoped_to:b.dst})}let y=Array.isArray(w.content.criteria)?w.content.criteria:[],h=[w.content.title,w.content.description,...y].filter(Boolean).join(`
|
|
340
|
+
`),F=(await rt(i,h,W.SCENARIO,10,n.embedSearch)).filter(u=>!T.has(u.cid)),L=[],S=new Set,O=[],c=[r],N=new Set([r]);for(;c.length>0;){let u=c.shift();for(let f of i.edgesFrom(u)){if(f.type!==X.DEPENDS_ON||i.nodeLabel.get(f.dst)!==W.USECASE)continue;let b=i.tipOf(f.dst);N.has(b)||(N.add(b),O.push(b),c.push(b))}}for(let u of O){let f=`depends_on ${i.nameOf.get(u)??u.slice(0,19)}`;for(let{cid:b}of i.byLabel(W.SCENARIO))if(se(i,b)&&i.edgesFrom(b).some($=>$.type===X.BELONGS_TO&&$.dst===u))for(let $ of i.edgesInto(b)){if($.type!==X.AUTOMATES||!se(i,$.src)||S.has($.src))continue;S.add($.src);let V=String(i.getNode($.src)?.content.title??"");L.push({cid:$.src,logical_id:i.nameOf.get($.src)??null,title:V,via:f})}}for(let u of await rt(i,h,W.TEST,5,n.embedSearch)){let{cid:f,title:b}=u;S.has(f)||(S.add(f),L.push({cid:f,logical_id:i.nameOf.get(f)??null,title:b??"",via:"similar"}))}let v=i.byLabel(W.STYLENOTE).filter(u=>se(i,u.cid)).sort((u,f)=>u.cid<f.cid?-1:1).slice(0,5).map(u=>`${String(u.content.statement)} [${String(u.content.learned_from_kind)}]`);return{usecase:fe(i,r,w.content),cites:I,committed_acs:x,existing:{scenarios:k,reuse_candidates:F},import_candidates:L,style_notes:v,techniques:st(t),profiles:it(t),runner_grammar:nt(t),budget:{...n.max!=null?{max_pairs:n.max}:{},...n.strength!=null?{strength_override:n.strength}:{}},design_of:(()=>{let u=Ue(i,r);return u?{engine:u.engine,seq:u.seq}:null})()}}function ot(t){let e=n=>{if(Array.isArray(n))return n.map(e);if(n!==null&&typeof n=="object"){let i={};for(let g of Object.keys(n).sort())i[g]=e(n[g]);return i}return n};return JSON.stringify(e(t),null,1)}import{basename as _t,dirname as yt,resolve as bt}from"path";var ht=oe,wt=new Set(["narrative","acs","scenarios","tests","exercises","gaps","scoped_to_repoints","judgements","phase"]);function vt(t){let e=/strength=(\d+)\s*(?:—|-)?\s*(.*)/.exec(t??"");return e?{strength:Number(e[1]),reason:e[2]||t||""}:{strength:2,reason:t??""}}function kt(t,e,n=new Set,i=0){return ht(e,ce(t),n,i)}function xt(t,e,n,i){let g=e.scenarios?.find(y=>y.temp_ref===n.automates)??(()=>{let y=t.resolve(n.automates),h=y?t.getNode(y.tip)?.content:void 0;return h?{title:String(h.title??""),intent:String(h.intent??""),technique_notes:String(h.technique_notes??"")}:{}})(),r=[...(e.acs??[]).map(y=>({ref:y.temp_ref,text:y.text})),...n.verifies.filter(y=>!(e.acs??[]).some(h=>h.temp_ref===y)).map(y=>{let h=t.resolve(y);return{ref:y,text:h?String(t.getNode(h.tip)?.content.text??""):""}})],{test_md:w,objectives_yaml:I}=ve({title:n.title,steps:n.steps,check:n.check,check_prose:n.check_prose,reuses:n.reuses},{title:g.title,intent:g.intent},r),k=ae(kt(t,w)),T=n.check,x={technique:g.technique_notes??"",profile_family:e.judgements?.find(y=>y.kind==="profile_family"&&(y.target===n.temp_ref||y.target===n.automates))?.rationale??"unspecified",anchor:T.verified_against,expected_how:e.judgements?.find(y=>y.kind==="expected_how"&&y.target===T.verified_against)?.rationale??`expected_mode: ${T.expected_mode??"inferred"}`,combinatorial:vt(g.technique_notes),surface_state:"absent",deferred_bindings:T.expected_mode==="runtime-derived"?1:0};return i.push({definitionId:k,rationale:x,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:k,test_md_blob:w,objectives_blob:I,...n.reuses?.length?{reuses:n.reuses}:{},...n.surface_required!==void 0?{surface_required:n.surface_required}:{}}}function ct(t){let e=0,n=t.forceScope??null;return{terminalEventType:"design",async onProposalEvent(i){let g=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 g("finalize_design payload is not an object");let r=i,w=Object.keys(r).filter(a=>!wt.has(a));if(w.length>0)return g(`finalize_design carries ungated/unknown section(s): ${w.join(", ")} \u2014 mintable here: acs, scenarios, tests (+gaps)`);let I=new Map;for(let a of r.tests??[]){let p=I.get(a.automates);if(p)return g(`strict 1:1 violated in-payload: ${p} and ${a.temp_ref} both automate ${a.automates}`);I.set(a.automates,a.temp_ref)}let k=U(t.contextDir);t.force&&!t.resuming&&e===0&&n===null&&(n=We(k,t.ucRef));let T=k.resolve(t.ucRef),x=T?String(k.getNode(T.tip)?.content.risk??"med"):"med",y=[],h=new Set([t.ucRef,T?.cid,T?.tip].filter(Boolean)),F=a=>{if(h.has(a))return!0;let p=k.resolve(a);return p!=null&&(h.has(p.cid)||h.has(p.tip))},L;try{L={...r.acs?.length?{acs:r.acs.map(a=>({temp_ref:a.temp_ref,text:a.text,kind:a.kind,risk:a.risk??x,...a.expected_answer?{expected_answer:a.expected_answer}:{},...a.scoped_to&&!F(a.scoped_to)?{scope:{type:"scenario",ref:a.scoped_to}}:{}}))}:{},...r.scenarios?.length?{scenarios:r.scenarios}:{},...r.tests?.length?{tests:r.tests.map(a=>xt(k,r,a,y))}:{},...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 g(a instanceof Error?a.message:String(a))}let S=r.phase??(r.tests?.length?"tests":r.scenarios?.length?"scenarios":r.acs?.length?"acs":"design"),O=(a,p={})=>({contextDir:t.contextDir,graph:a,ucRef:t.ucRef,sections:L,by:t.by,phase:S,...p,...t.templateVersion?{templateVersion:t.templateVersion()}:{},...t.engine?{engine:t.engine}:{},...n?.length?{forceScope:n}:{},...t.because?{reason:t.because}:{},finalizeTestBody:(()=>{let R=new Map((L.tests??[]).map(A=>[A.temp_ref,A])),E=new Map,K=(A,B,P)=>{let G=R.get(A);if(!G?.test_md_blob)return null;let z=E.get(A);if(z!==void 0)return z;if(P.has(A))return G.test_md_blob;P.add(A);let Q=new Map;for(let q of G.reuses??[]){K(q,B,P);let J=B(q);J!==null&&J!==q&&Q.set(q,J)}let Y=G.verifies.map(B).filter(q=>q!==null),H=be(we(G.test_md_blob,Q),Y);return E.set(A,H),H};return(A,B)=>{if(!A.test_md_blob)return null;let P=K(A.temp_ref,B,new Set)??A.test_md_blob;if(P===A.test_md_blob)return null;let G=z=>{for(let Q of R.keys())if(B(Q)===z){let Y=K(Q,B,new Set);if(Y!==null)return{body:Y,cycleKey:`batch:${z}`,next:G}}return ce(k)(z)};return{test_md_blob:P,definitionId:ae(oe(P,G))}}})()}),c;if(t.protocol){let a=t.generationTicket,p=await Ae(t.protocol,{verb:"design",ucTargets:[{ref:t.ucRef}],newBuCandidates:[],sourcePins:[],readBasis:k.latestHash,...a?{generationTicket:a}:{}},R=>{let E=ue(O(R.graph,{eventIds:R.eventIds("design",1),sid:R.sid,...a&&!t.generationStamped?{generationTicket:a}:{}}));return E.errors!==null?{errors:E.errors}:{result:E,record:E.record}});p.ok&&"result"in p?(c=p.result,a&&!t.generationStamped&&(t.generationStamped=!0,t.generationTicket={...a,expected_prev_gen:a.next_gen})):p.ok?c={record:null,errors:null,minted:{},logicalIds:{},superseded:[],warnings:["commit already applied (recommit)"],finalizedTests:{}}:c={record:null,errors:p.kind==="validation"?p.errors:p.kind==="contended"?[{code:p.err.code,detail:`${t.ucRef} is held by ${p.err.holder?.owner_sid??"another session"}${p.err.holder?.alive?" (live)":" (stale)"} \u2014 try another use-case or wait for it to free`}]:p.kind==="drifted"?p.asks.map(E=>({code:"DRIFTED",detail:E.detail})):[{code:"UNSETTLED",detail:`concurrent activity kept moving the store (${p.attempts} attempts) \u2014 retry when the store is quieter`}],minted:{},logicalIds:{},superseded:[],warnings:[],finalizedTests:{}}}else c=ue(O(k));if(c.errors)return g("design commit failed: "+c.errors.map(a=>`${a.code}: ${a.detail}`).join("; "));let N=c.warnings.filter(a=>a.includes("\u2014 committed anyway; approve"));for(let a of c.warnings)(!N.includes(a)||N.length===1)&&t.note(`warning: ${a}`);N.length>1&&t.note(`warning: ${N.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 v=(a,p)=>a?`${a} ${p}${a>1?"s":""}`:null,u=[v(r.acs?.length,"AC"),v(r.scenarios?.length,"scenario"),v(r.tests?.length,"test"),v(r.gaps?.length,"gap")].filter(Boolean);t.aliases?.(Object.entries(c.minted).map(([a,p])=>({ref:a,cid:p,...c.logicalIds[a]?{id:c.logicalIds[a]}:{}})));{let a=`saved ${u.join(" \xB7 ")||"judgements/wiring"} as drafts`;(t.commitLine??t.note)(a)}let f=U(t.contextDir);t.onCommitted?.(f);for(let a of y){let p=c.logicalIds[a.anchorRef]??c.minted[a.anchorRef];Ke(t.contextDir,c.finalizedTests[a.tempRef]??a.definitionId,{...a.rationale,anchor:p??a.rationale.anchor})}try{let a=Object.values(c.minted).filter(p=>f.getNode(p)?.label==="test");if(a.length>0){let p=yt(bt(t.contextDir)),R=Ve({graph:f,cids:a,cwd:p});R.wrote.length>0&&t.note(`\u2692 wrote ${R.wrote.map(E=>_t(E.path)).join(" \xB7 ")}`);for(let E of R.refused)t.note(`warning: could not create the test file for ${E.id} \u2014 ${E.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)})`)}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:c.warnings.length,minted:Object.entries(c.minted).map(([a,p])=>({temp_ref:a,cid:p,...c.logicalIds[a]?{logical_id:c.logicalIds[a]}:{}}))}),e+=1,n!==null&&(n=c.forceScopeRemaining??n,t.onForceScope?.(n));let b=qe({verb:"design",commitN:e,ucRef:t.ucRef,phase:S,committed:Object.entries(c.minted).map(([a,p])=>({temp_ref:a,cid:p,...c.logicalIds[a]?{logical_id:c.logicalIds[a]}:{}})),warnings:c.warnings},f),$=b.event.parity?.missing??[],V=!!r.tests?.length&&$.length===0;return{proposal:c,error:null,receipt:b,...V?{sessionComplete:V}:{}}}}}function lt(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:ot({...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 ut=Symbol("design-out-tee");function Rt(t,e,n,i){return{terminalEventType:"design",async onProposalEvent(g){let r=g??{},w=["acs","scenarios","tests","gaps"].map(I=>r[I]?.length?`${r[I].length} ${I}`:null).filter(Boolean).join(" \xB7 ");return n?.("plan_payload",{payload:r}),t(`plan: finalize_design \u2014 ${w||"wiring/judgements only"} (nothing committed${i?`; full payload: ${Z(i)}`:""})`),e?.({type:"plan",payload:r}),{proposal:r,error:null}}}}async function Rs(t,e){let n=U(e.contextDir),i=null,g=null,r=t.useCase;if(t.resume){try{{let m=await Ge(e.contextDir,t.resume,n,{deps:{onWarn:_=>e.out(`note: ${_}`)}});g=m,i=m.handle,m.drift.length>0&&(e.out(`note: sources changed since the pause: ${m.drift.map(_=>_.subject).join(", ")} \u2014 the design continues against the current versions`),e.emit?.({type:"stale_basis",sources:m.drift.map(_=>_.subject)}))}}catch(m){if(m instanceof ye||m instanceof me)return e.out(`error: ${m.message}`),e.emit?.({type:"error",message:`error: ${m.message}`}),m instanceof me||m.code==="SESSION_MISSING"||m.code==="SESSION_EXPIRED"?2:1;throw m}let s=i.state,d=Ne(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 m=`session ${t.resume} was designing ${s.use_case}; --use-case ${r} RETARGETS it`;if(!(t.confirmRetarget?await t.confirmRetarget(`${m} \u2014 continue with the new target?`):!1))return e.out(`error: ${m} \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:m}),i.release(),2}if(r=r??s.use_case,s.uc_tip&&r){let m=n.resolve(r)?.tip;if(m&&m!==s.uc_tip){let _=`the use-case changed since the pause (${s.uc_tip.slice(0,19)}\u2026 \u2192 ${m.slice(0,19)}\u2026)`;if(!(t.confirmRetarget?await t.confirmRetarget(`${_} \u2014 re-ground and continue against the new version?`):!1))return e.out(`error: ${_} \u2014 resume interactively to re-ground, or abandon this session`),e.emit?.({type:"error",code:"UC_TIP_MOVED",message:_}),i.release(),2;e.emit?.({type:"stale_basis",usecase:r})}}let l=Qe(n,s.target_pins);if(l.length>0){let m=`items this session pinned have changed since it paused: ${l.map(C=>`${C.ref}${C.now===null?" (now gone)":""}`).join(", ")}`;if(!(t.confirmRetarget?await t.confirmRetarget(`${m} \u2014 re-ground and continue?`):!1))return e.out(`error: ${m} \u2014 resume interactively to re-ground, or abandon`),e.emit?.({type:"error",code:"TARGET_PIN_MOVED",message:m}),i.release(),2;i.save({target_pins:(s.target_pins??[]).map(C=>({ref:C.ref,cid:n.resolve(C.ref)?.tip??C.cid}))})}let o=[...new Set([...i.state.held_receipts??[],...g?.view.kane?.held_receipts??[]])];if(o.length>0)if(e.chat?.holdReceipt)for(let m of o)e.chat.holdReceipt(m);else e={...e,initialMessage:[o.join(`
|
|
341
|
+
|
|
342
|
+
`),e.initialMessage].filter(Boolean).join(`
|
|
343
|
+
|
|
344
|
+
`)};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 w=t.resume?void 0:t.phase,I=!1;if(w!==void 0){let{checkPhaseEntry:s,phaseEntryCmd:d,phaseLadderFor:l}=await import("./phase-seed-DIRETNU6.js");I=l(e.contextDir,n,r).length>0;let o=s(e.contextDir,n,r,w);if(!o.ok&&o.code==="UNKNOWN_PHASE")return e.out(`error: ${o.message}`),e.emit?.({type:"error",code:"UNKNOWN_PHASE",message:o.message}),i?.release(),2;if(!o.ok&&o.code==="PHASE_ORDER"){let m=t.askPhaseEntry?await t.askPhaseEntry({message:o.message,earliest:o.earliest}):"cancel";if(m==="earliest")e.out(`starting at ${o.earliest} instead (${o.missing.join(", ")} not committed yet)`),w=o.earliest;else if(m==="proceed")e.out(`note: entering at ${w} with ${o.missing.join(", ")} uncommitted \u2014 proceeding on your say-so`),e.emit?.({type:"phase_entry_override",phase:w,missing:o.missing});else{let _=(t.mode??"interactive")==="agent",C=d(r,o.earliest,_);return e.out(`error: ${o.message}`),e.emit?.({type:"error",code:"PHASE_ORDER",message:o.message,next:[{cmd:C,why:`${o.earliest} is the earliest uncommitted phase for ${r}`,title:`Start at ${o.earliest}`}]}),i?.release(),2}}}let k=!!(t.force||i?.state.force),T=!!(t.resume&&i),x=ze(n,r,k||T||I);if(!x.ok){let s=(t.mode??"interactive")==="interactive";if(x.wall&&s&&t.askDesignEntry){let{captureForceScope:d}=await import("./design-committer-VYT6NU3T.js"),l=d(n,r).length,o=await t.askDesignEntry({wall:x.wall.kind,message:x.message,display:x.wall.display,impactPairs:l});if(o.pick==="redesign"||o.pick==="proceed"){if(!o.because.trim())return e.out("a redesign needs a reason (--because) \u2014 nothing executed"),i?.release(),2;e.out(o.pick==="redesign"?`redesigning ${x.wall.display} (${l} pair(s) superseded) \u2014 because: ${o.because.trim()}`:`proceeding against the stale design (noted) \u2014 because: ${o.because.trim()}`),t={...t,force:!0,because:t.because??o.because.trim()},k=!0}else return o.pick==="view"?(e.out(`view the existing design: kane-cli context view ${x.wall.display}`),i?.release(),0):o.pick==="refresh"?(e.out(`refresh it first: kane-cli maintain evolve ${x.wall.display}`),i?.release(),0):(e.out("nothing executed \u2014 list use-cases: kane-cli context list"),i?.release(),0)}else{e.out(`design: ${x.message}`);let d=x.wall&&t.mode==="agent"?[{cmd:`kane-cli context view ${x.wall.display}`,why:"view the existing design",title:"View the design"},...x.wall.kind==="designed-stale"?[{cmd:`kane-cli maintain evolve ${x.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 ${x.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:x.message,...d?{next:d}:{}}),i?.release(),x.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 y={contextDir:e.contextDir,resolveAlias:s=>Ie(s,{env:process.env,auth:e.auth}),embed:(s,d)=>Pe(s,d,{env:process.env,auth:e.auth})};e.chat?.setWorking?.("assembling context\u2026");let h=await at(e.contextDir,r,{max:t.max,strength:t.strength,embedSearch:y});if(t.priorDesign!==void 0&&(h.prior_design=t.priorDesign),t.changeDelta!==void 0&&(h.change_delta=t.changeDelta),t.because&&(h.because=t.because),w!==void 0){let{buildPhaseSeed:s}=await import("./phase-seed-DIRETNU6.js"),d=s(e.contextDir,n,r,w);h.prior_design===void 0&&d.priorDesign!==void 0&&(h.prior_design=d.priorDesign),h.entry_phase=w,d.phaseLadder.length>0&&(h.phase_ladder=d.phaseLadder)}let F=e.now?.()??new Date,L=`${F.toISOString().replace(/[-:]/g,"").slice(0,15)}-${$t(2).toString("hex")}`,S=t.mode??"interactive",O=S==="interactive"&&!!e.chat&&!e.nested,c=g?{...g.spawnConfig,mode:S}:lt(h,{session_id:t.resume??`design-${L}`,mode:S,ucCid:h.usecase.cid,readBasis:n.latestHash,topology:Fe("design")}),N={current:null};if(c.resume&&"schema"in c.resume){let s=c.resume.binding?.template_version;typeof s=="string"&&(N.current=s)}t.plan?c.chat=!1:c.chat=!0;let v=e.telemetry?.enabled?e.telemetry:void 0,u=v?_e(v.ids.context_instance_id??null,"design",v.ids.session_id):he(e.contextDir,"logs",`design-${L}.log`);St(mt(u),{recursive:!0}),O||e.out(`trace: ${Z(u)}`),e.emit?.({type:"run_start",mode:S,trace:u,use_case:r,...v?{session:v.ids.session_id}:{}});let f=(s,d,l)=>{try{Dt(u,JSON.stringify({ts:new Date().toISOString(),level:s==="error"?"error":"info",run_id:v?.ids.operation_id,...v?{user_session_id:v.ids.session_id}:{},kind:s,session_id:l,data:d})+`
|
|
345
|
+
`)}catch{}v?.wireTrace(s,d,l)};{let s=e.out;if(s[ut]!==!0){let d=l=>{f("transcript",{line:l}),s(l)};d[ut]=!0,e.out=d}}if(t.resume&&i){g||(c.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-IOZTZUZV.js"),d=s(e.contextDir).records.filter(l=>l.sid===t.resume).map(l=>l.design_phase).filter(l=>l!=null&&typeof l.phase=="string");if(d.length>0){let l=d.map(m=>`${m.phase}${m.completeness==="partial"?" (partial)":""}`).join(" \u2192 "),o=`[kane] durable record for this session (${t.resume}) on ${r}: design phases already COMMITTED \u2014 ${l}. 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,o].filter(Boolean).join(`
|
|
346
|
+
|
|
347
|
+
`)}}}catch{}t.message&&(e={...e,initialMessage:[e.initialMessage,t.message].filter(Boolean).join(`
|
|
348
|
+
|
|
349
|
+
`)})}let b=null,$={current:n},V={detach:null},a=()=>{let s=V.detach;V.detach=null,s&&s()},p=(s,d)=>{let l=i;if(!l)return{};let o=s.ask,m=Me({contextDir:s.contextDir,cwd:mt(s.contextDir),handle:l,note:_=>s.chat?s.chat.note(_):s.out(_),graphSlot:d,...s.now?{now:s.now}:{}});if(s.chat?.attachIngest){let _=s.chat;V.detach=_.attachIngest(async C=>{try{l.save({ingest_registry:de(l.state.ingest_registry,C,s.now?.()??new Date)});let j=await m({id:`attach-${l.state.sid}-${(l.state.ingest_registry??[]).length}`,ref:C,purpose:null});return j.ok?(_.deferBatch({source_id:j.result.source_id,cid:j.result.cid}),{ok:!0}):{ok:!1,error:j.error.message}}catch(j){return{ok:!1,error:j instanceof Error?j.message:String(j)}}})}return{ask:async _=>{let C=await o(_);if(Array.isArray(C)){let j=C.filter(M=>{if(M.free_text==null||M.free_text.trim()==="")return!1;let ie=_.find(gt=>gt.id===M.id);return M.selected_index!=null&&ie?.options[M.selected_index]?.input===!0}).map(M=>M.free_text.trim());if(j.length>0){let M=l.state.ingest_registry;for(let ie of j)M=de(M,ie,s.now?.()??new Date);l.save({ingest_registry:M})}}return C},ingest:m}};e.nested||e.chat?.attachOnCommitted?.(s=>{$.current=s});let R="";if(e.chat&&!t.plan&&!e.nested){let s=Oe({contextDir:e.contextDir,graph:U(e.contextDir),sessionStamp:c.session_id,by:e.by??{kind:"human",id:"owner"}});s.errors===null||s.errors[0]?.code==="CONV_SOURCE_EXISTS"?(R=s.sourceId,e.chat.attachConversationSource?.(R),$.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 E=U(e.contextDir),K;if(!t.plan){let s=Ce(E,r);if(T&&s!==null&&s.live){let d=E.resolve(r);K={uc_root:Ee(E,d.cid),next_gen:s.gen,expected_prev_gen:s.gen}}else{let d=Te(E,r,{...k?{force:!0}:{},because:t.because??(k?"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;K=d}}let A=xe(e.contextDir,c.session_id),B=null,P=()=>{try{B?.release()}catch{}};if(!t.plan)try{B=A.acquire([Se(E,r).key],{hold:"session",verb:"design"})}catch(s){if(s instanceof ke&&s.code==="UC_HELD"){let d=s.holder,l=`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(l),e.emit?.({type:"error",code:"UC_HELD",message:l}),i?.release(),2}throw s}let G={contextDir:e.contextDir,rootSid:c.session_id,locks:A,probe:{batchSimilar:async()=>({hits:[],degraded:!1,probeBasis:null}),recheckLocal:()=>({hits:[],uncachedNewNodes:[]})}},z=!t.plan&&S!=="ci",Q=()=>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])),Y=!1;z&&!i&&(Y=!0,i=re(e.contextDir,{sid:c.session_id,mode:"agent",created_at:F.toISOString(),expires_at:new Date(F.getTime()+1440*60*1e3).toISOString(),agent_state:{schema:2,items:[],provider_state:""},pending:{questions:[],proposals:[]},read_basis:Q(),assumed:[],corpus_cursor:{remaining:[]},conv_source:R,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}:{},...k?{force:!0}:{},...v?{user_session_id:v.ids.session_id}:{}}));let H;if(z&&i){let{resume:s,...d}=c;Re(e.contextDir,c.session_id,{schema:$e,kind:"base",sid:c.session_id,verb:"design",mode:S,created_at:F.toISOString(),run_config:d,conv_source:R||i.state.conv_source||"",...r?{use_case:r}:{},...n.resolve(r)?.tip?{uc_tip:n.resolve(r).tip}:{},store_watermark:De(e.contextDir)}),c.checkpoints=!0,t.resume&&f("resume_kind",{kind:g?g.view.pointer===null?"bare-base":g.view.pointer.at==="final"?"pause":"crash":"v1-shim"},c.session_id);let l=g?0:i.state.checkpoint?.seq??0,o=i;H=Be({contextDir:e.contextDir,handle:o,seqBase:()=>l,peekHeldReceipts:()=>e.chat?.peekHeldReceipts?.()??[],readBasis:()=>Q(),corpusCursor:()=>({remaining:[]}),onSoftCap:_=>e.out(_),onStat:_=>f("ckpt_stat",_,c.session_id),...e.now?{now:e.now}:{}});let m=H;H={...m,persist:_=>{let C=_.binding?.template_version;return typeof C=="string"&&C&&(N.current=C),m.persist(_)}}}let q=()=>{if(!i)return;let s=i.state.checkpoint;if(s){let d=S!=="interactive"?` --mode ${S}`:"";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(Y){try{i.complete()}catch{i.release()}try{dt(he(e.contextDir,"sessions"))}catch{}}else i.release();i=null},J=t.plan?Rt(e.out,e.emit,f,u):ct({templateVersion:()=>N.current,contextDir:e.contextDir,ucRef:r,by:{kind:"ai",id:"design-agent"},force:k,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,resuming:T,...i?.state.force_scope?.length?{forceScope:i.state.force_scope}:{},onForceScope:s=>{b=s},...t.because?{because:t.because}:{},aliases:e.chat?s=>e.chat.registerAliases?.(s):void 0,onCommitted:s=>{$.current=s},protocol:G,...K?{generationTicket:K}:{},...T?{generationStamped:!0}:{}});e.chat||(f("design_budget",{max_pairs:h.budget.max_pairs??null,strength:h.budget.strength_override??null}),e.out(`designing: ${h.usecase.logical_id??r}`)),e.chat?.setWorking?.(`designing ${h.usecase.logical_id??r}\u2026`);let D;try{D=await le(c,{...e,graphSlot:$,...p(e,$),...H?{checkpoint:H}:{}},new Map,n,f,J)}catch(s){throw f("error",{message:s instanceof Error?s.message:String(s),stack:s instanceof Error?s.stack:void 0},c.session_id),q(),s}finally{e.chat?.setWorking?.(null),a()}if(D.errorCode==="binding_mismatch"&&g){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(o=>o.id==="binding-mismatch"):void 0)?.selected_index!==0){let o=`resume abandoned: binding mismatch on session ${c.session_id} \u2014 the session is preserved`;return e.out(o),e.emit?.({type:"error",message:o,code:"BINDING_MISMATCH"}),i?.release(),2}f("binding_migrate",{sid:c.session_id},c.session_id);let l=c.resume&&"schema"in c.resume?{...c.resume,binding:{}}:void 0;try{D=await le({...c,...l?{resume:l}:{}},{...e,graphSlot:$,...p(e,$),...H?{checkpoint:H}:{}},new Map,n,f,J)}catch(o){throw f("error",{message:o instanceof Error?o.message:String(o),stack:o instanceof Error?o.stack:void 0},c.session_id),q(),o}finally{e.chat?.setWorking?.(null),a()}}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"}),q(),P(),1;if(D.paused){let s=i;s||(s=re(e.contextDir,{sid:c.session_id,mode:"agent",created_at:F.toISOString(),expires_at:new Date(F.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(o=>o.type==="DERIVES"&&typeof o.props.source_id=="string").map(o=>[String(o.props.source_id),n.heads.get(String(o.props.source_id))??null])),assumed:[],corpus_cursor:{remaining:[]},conv_source:R,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}:{},...k?{force:!0}:{},...v?{user_session_id:v.ids.session_id}:{}}));try{k&&!s.state.force&&s.save({force:!0}),v&&s.state.user_session_id!==v.ids.session_id&&s.save({user_session_id:v.ids.session_id}),R&&s.state.conv_source!==R&&s.save({conv_source:R});let o=e.chat?.drainHeldReceipts?.()??[];(o.length>0||(s.state.held_receipts?.length??0)>0)&&s.save({held_receipts:o}),b!==null&&s.save({force_scope:b}),Le(s,D.paused)}catch(o){let m=s.state.checkpoint,_=`error: couldn't persist the pause for session ${s.state.sid}`+(m?` \u2014 last durable checkpoint: seq ${m.seq} @ ${m.ts}`:" \u2014 no durable checkpoint exists")+` (${o instanceof Error?o.message:String(o)})`;return e.out(_),e.emit?.({type:"error",message:_,code:"PAUSE_PERSIST_FAILED",sid:s.state.sid}),1}f("session_paused",{sid:s.state.sid},c.session_id);let d=S!=="interactive"?` --mode ${S}`:"",l=`kane-cli design tests --resume ${s.state.sid}${d}`;if(O||e.out(`paused \u2014 resume with: ${l}`),e.emit?.({type:"session_paused",sid:s.state.sid,mode:S,resume:l,expires_at:s.state.expires_at,pending_questions:D.paused.pending.questions}),O){let o=e.chat?.state.credits?.total;e.onSummary?.({state:"paused",reason:"ctrl+c",facts:[`session ${s.state.sid} saved \u2014 designing ${h.usecase.logical_id??r}`,...s.state.expires_at?[`expires: ${s.state.expires_at}`]:[],...o!==void 0?[`credits used: ${o.toFixed(1)}`]:[]],resume:l,resumeMessage:`${l} --message "<your words>"`,tracePath:Z(u)})}return P(),3}if(D.crashed&&i?.state.checkpoint){let s=i.state.checkpoint,d=S!=="interactive"?` --mode ${S}`:"",l=`kane-cli design tests --resume ${i.state.sid}${d}`;if(f("agent_crashed_resumable",{sid:i.state.sid,seq:s.seq},c.session_id),O||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: ${l}`),e.emit?.({type:"session_paused",sid:i.state.sid,mode:S,resume:l,expires_at:i.state.expires_at,crashed:!0}),O){let o=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",...o!==void 0?[`credits used: ${o.toFixed(1)}`]:[]],resume:l,resumeMessage:`${l} --message "<your words>"`,tracePath:Z(u)})}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}`}),q(),P(),1;if(D.proposal==null&&S!=="interactive")return e.out(`error: the design session stopped before saving anything \u2014 nothing committed (trace: ${u})`),e.emit?.({type:"error",message:`error: the design session stopped before saving anything \u2014 nothing committed (trace: ${u})`}),q(),P(),1;let ee=0;if(D.proposal==null)try{let{readRecords:s}=await import("./records-IOZTZUZV.js"),d=t.resume??c.session_id;ee=s(e.contextDir).records.filter(l=>l.sid===d).reduce((l,o)=>l+o.nodes.filter(m=>m.label!=="source").length,0)}catch{}if(D.proposal==null&&e.out(ee>0?`done \u2014 ${ee} 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??c.session_id}),v?.event("ASR_SESSION_COMPLETE",{}),i?.complete(),Y)try{dt(he(e.contextDir,"sessions"))}catch{}if(O){let s=e.chat.state.ledger.filter(o=>o.kind==="answer"&&o.receipt.form==="assumed").length??0,d=(D.assumedDefaults??0)+s,l=e.chat.state.credits?.total??D.creditsTotal;e.onSummary?.({state:"complete",facts:[`designed: ${h.usecase.logical_id??r}${D.proposal==null?ee>0?` (${ee} item(s) committed across this session)`:" (nothing committed this session)":""}`,...d>0?[`${d} assumed default(s)`]:[],...l!==void 0?[`credits used: ${l.toFixed(1)}`]:[]],tracePath:Z(u)})}return t.plan||He(e.contextDir),P(),0}export{Rs as a};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as h}from"./chunk-
|
|
2
|
+
import{a as h}from"./chunk-37ZWKLEN.js";import{a as f}from"./chunk-IHAHCFFG.js";import{a as m}from"./chunk-CVCVBQP6.js";var o=class extends Error{constructor(a,l){super(a);this.code=l;this.name="AuthError"}};async function k(c){let{creds:i,env:a,usernameFlag:l,accessKeyFlag:g,log:t}=c,e=null,u=null;if(l&&g)e={username:l,access_key:g},t("info","AUTH_RESOLVE_FLAGS","Auth resolved via CLI flags",{username:l});else{let r=i.resolveAuth();r?.method==="basic"&&(e={username:r.username,access_key:r.access_key},t("info","AUTH_RESOLVE_CONFIG","Auth resolved via config",{username:r.username}))}if(!e){let{credentials:r,profile:E}=i.getActiveCredentials();if(!r)throw new o("Not authenticated \u2014 no credentials found","not_authenticated");if(u=r.access_token,r.expires_at-Date.now()/1e3<300)try{let n=await f({creds:i,profile:E,env:a,credentials:r});n&&(u=n.accessToken,t("info","AUTH_TOKEN_REFRESHED","OAuth token refreshed"))}catch(n){let d=n instanceof Error?n.message:String(n);throw t("error","TOKEN_REFRESH_FAILED","Token refresh failed",{error:d}),new o(`Token refresh failed: ${d}`,"refresh_failed")}}let v=m(a),b=async()=>u,y=e?{username:e.username,access_key:e.access_key}:null,p=new h(v.controllerBaseUrl,b,y,t),s=await p.resolve();return s&&!e&&(e={username:s.username,access_key:s.access_key},t("info","AUTH_RESOLVE_CONTROLLER","Auth resolved via controller",{username:s.username})),{basicAuth:e,token:u,resolver:p,resolvedCreds:s}}export{o as a,k as b};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as B,b as H,c as ie}from"./chunk-
|
|
2
|
+
import{a as B,b as H,c as ie}from"./chunk-AF572MQG.js";import{a as j,b as N}from"./chunk-NVGM5ISX.js";import{a as C,b as G,e as M,f as te,m as re,n as ne}from"./chunk-VK3NU742.js";import{a as oe,b as se}from"./chunk-2YQ6TW77.js";import{a as L}from"./chunk-CJP7RX3E.js";import{a as ee}from"./chunk-KOMKHFC4.js";import{a as q}from"./chunk-CVCVBQP6.js";import{a as Z}from"./chunk-DPUV6OSP.js";import{a as A}from"./chunk-RZ4F3BHX.js";import{a as O}from"./chunk-5OVEBP4D.js";import{y as h}from"./chunk-D6FYCAIA.js";import{a as F}from"./chunk-HCBYKLMW.js";import{a as k,b as m,i as Q}from"./chunk-C44QQJR4.js";import{a as X}from"./chunk-6YGTRKDT.js";import{e as v}from"./chunk-UR6MHSHU.js";var D=v(X(),1);import{existsSync as P,readFileSync as Ge,rmSync as he,unlinkSync as He}from"fs";import{resolve as z}from"path";import{promises as ae,realpathSync as be}from"fs";import{homedir as Te}from"os";import{join as V,parse as Ee,relative as ce,resolve as le}from"path";var ue=new Set(["node_modules",".git","dist","build",".next",".venv","venv","target","__pycache__"]),R=class extends Error{constructor(s){super(`refusing to scan '${s}'. Run from your project root, or pass --root <dir>.`);this.cwd=s;this.name="HomeRefusedError"}};function de(e){try{return be(le(e))}catch{return le(e)}}function Se(e){let r=de(e),s=de(Te()),n=Ee(r).root;if(process.platform==="win32"){let o=t=>t.toLowerCase();return o(r)===o(s)||o(r)===o(n)}return r===s||r===n}async function U(e){if(Se(e.root))throw new R(e.root);let r=e.maxEntries??5e4,s=e.maxResults??5e3,n=new Set(e.ignore??[]),o=[],t=0,i=0,c=!1,f,l=[e.root];for(;l.length>0&&!c;){let a=l.shift(),g;try{g=await ae.readdir(a,{withFileTypes:!0})}catch{continue}i++;for(let b of g){if(t++,t>r){c=!0,f="max_entries";break}let x=b.name,E=V(a,x);if(b.isDirectory()){if(ue.has(x)||x.startsWith(".")||x.startsWith("output-")||n.has(x))continue;l.push(E)}else if(b.isFile()&&x.endsWith("_test.md")&&(o.push({path:E,relPath:ce(e.root,E),source:"cwd"}),o.length>=s)){c=!0,f="max_results";break}}e.onProgress?.(i,o.length)}if(!c){let g=[{dir:V(e.root,".testmuai","tests"),depth:0}];for(;g.length>0&&!c;){let{dir:b,depth:x}=g.shift(),E;try{E=await ae.readdir(b,{withFileTypes:!0})}catch{continue}i++;for(let u of E){if(t++,t>r){c=!0,f="max_entries";break}let w=u.name,y=V(b,w);if(u.isDirectory()){if(x>=20||w.startsWith(".")||w.startsWith("output-")||ue.has(w))continue;g.push({dir:y,depth:x+1})}else if(u.isFile()&&w.endsWith("_test.md")&&(o.push({path:y,relPath:ce(e.root,y),source:"tests-dir"}),o.length>=s)){c=!0,f="max_results";break}}}}return{results:o,aborted:c,abortReason:f,dirsScanned:i}}import{readFileSync as ve}from"fs";function Re(e){let r;try{r=ve(e,"utf8")}catch{return{tags:[]}}try{let{global:s}=re(e,r),n=ne(s);return{tags:s.tags??[],...n?{mobileTarget:n}:{}}}catch{return{tags:[],...Me(r)?{mobileTarget:Pe}:{}}}}var Pe={platform:"",app:""};function Me(e){let r=/^---\r?\n([\s\S]*?)\r?\n---/.exec(e);if(!r)return!1;let s=r[1].split(/\r?\n/);if(s.some(o=>/^target:\s*['"]?(emulator|simulator)['"]?\s*$/.test(o)))return!0;let n=s.findIndex(o=>/^target:\s*$/.test(o));return n<0?!1:s.slice(n+1).some(o=>/^\s+\S/.test(o))}function W(e){return Re(e).tags}import{mkdirSync as De,writeFileSync as $e}from"fs";import{join as Ce}from"path";function fe(e,r){return`Basic ${Buffer.from(`${e}:${r}`).toString("base64")}`}async function Ie(e){let r=oe({tmsBaseUrl:e.tmsBaseUrl,testcaseId:e.testcaseId,codeExport:{enabled:!0,language:e.language,skipValidation:e.skipValidation}}),s=await A(r.url,{method:"POST",headers:{"content-type":"application/json",authorization:fe(e.auth.username,e.auth.access_key)},body:JSON.stringify(r.body)});if(!s.ok)throw new Error(`code-export trigger failed: ${s.status} ${await s.text()}`);e.log("info","CODE_EXPORT_TRIGGERED","Code export triggered",{testcase_id:e.testcaseId})}async function Fe(e){let r=se({tmsBaseUrl:e.tmsBaseUrl,testcaseId:e.testcaseId}),s=e.pollIntervalMs??5e3,n=e.timeoutMs??3e5,o=Date.now()+n;for(;Date.now()<o;){let t=await A(r,{headers:{authorization:fe(e.auth.username,e.auth.access_key),accept:"application/json"}});if(!t.ok){await new Promise(l=>setTimeout(l,s));continue}let c=(await t.json()).data?.find(l=>l.code_name==="kane-cli-trigger");if(!c){await new Promise(l=>setTimeout(l,s));continue}let f=(c.status??"").toLowerCase();if(f==="in progress"||f==="in_progress"||f==="pending"){await new Promise(l=>setTimeout(l,s));continue}if(!c.url||c.url.length===0)throw new Error(`code-export status=${c.status} but no files returned`);De(e.outDir,{recursive:!0});for(let l of c.url){let a=Ce(e.outDir,l.file_name),g=await A(l.file_url);if(!g.ok){e.log("warn","CODE_EXPORT_FILE_FAILED","Failed to download file",{file_name:l.file_name,status:g.status});continue}let b=await g.text();$e(a,b,"utf-8")}return e.log("info","CODE_EXPORT_DOWNLOADED","Code export saved",{out_dir:e.outDir,file_count:c.url.length}),e.outDir}throw new Error("code-export polling timed out")}async function ge(e){return await Ie(e),await Fe(e)}var T=v(X(),1);import{existsSync as Oe,readFileSync as Ae}from"fs";var p=v(F(),1);function Le(e){B(e);let r=M(e);if(!Oe(r))return null;try{return JSON.parse(Ae(r,"utf8"))}catch{return{}}}function Be(e){return e===null?"never_run":e.testcase_id?"synced":"local_only"}function je(e){return e==="synced"?"\u2601":e==="local_only"?"\u25A3":"\u25CB"}function Ne(e){return e==="tests-dir"?"\u2726":" "}function Ue(e,r){return r==="all"?!0:r==="synced"?e.status==="synced":r==="local"?e.status==="local_only":r==="never_run"?e.status==="never_run":r==="cli"?e.source==="tests-dir":r==="hand"?e.source==="cwd":!0}var Y=["all","synced","local","never_run","cli","hand"];function We(e){let r=Y.indexOf(e);return Y[(r+1)%Y.length]}function me({root:e,currentOrgId:r,onSelect:s,onCancel:n}){let[o,t]=(0,T.useState)([]),[i,c]=(0,T.useState)(null),[f,l]=(0,T.useState)(!0),[a,g]=(0,T.useState)("all");(0,T.useEffect)(()=>{(async()=>{try{let u=await U({root:e}),w=[];for(let y of u.results){let K=Le(y.path);K?.org_id!==void 0&&K.org_id!==r||w.push({path:y.path,relPath:y.relPath,name:C(y.path),status:Be(K),source:y.source,tags:W(y.path)})}t(w),l(!1)}catch(u){u instanceof R,c(u.message),l(!1)}})()},[e,r]);let b=(0,T.useMemo)(()=>o.filter(u=>Ue(u,a)).map(u=>({id:u.path,label:`${je(u.status)} ${Ne(u.source)} ${u.relPath}${u.tags.length>0?` [${u.tags.join(", ")}]`:""}`})),[o,a]),x=(0,T.useMemo)(()=>Ke(a,o),[a,o]);if(i)return(0,p.jsxs)(k,{flexDirection:"column",borderStyle:"round",borderColor:h.red,paddingX:2,paddingY:1,children:[(0,p.jsx)(m,{color:h.red,bold:!0,children:"testmd"}),(0,p.jsx)(k,{marginTop:1,children:(0,p.jsx)(m,{color:h.red,children:i})})]});let E=a==="all"?"all":Je(a);return(0,p.jsx)(ee,{title:`testmd \xB7 filter: ${E}`,items:b,loading:f,itemNoun:"tests",onSelect:u=>{let w=o.find(y=>y.path===u.id);w&&s(w)},onCancel:n,onTab:()=>g(u=>We(u)),extraHint:"cycle filter",footer:x})}function Je(e){return e==="synced"?"synced (\u2601)":e==="local"?"local (\u25A3)":e==="never_run"?"never run (\u25CB)":e==="cli"?"cli-generated (\u2726)":e==="hand"?"hand-written":"all"}function Ke(e,r){let s={synced:r.filter(o=>o.status==="synced").length,local:r.filter(o=>o.status==="local_only").length,never:r.filter(o=>o.status==="never_run").length,cli:r.filter(o=>o.source==="tests-dir").length,hand:r.filter(o=>o.source==="cwd").length},n=o=>o?h.orange:h.dim;return(0,p.jsxs)(k,{flexDirection:"column",children:[(0,p.jsx)(m,{color:h.dim,children:"legend:"}),(0,p.jsxs)(k,{children:[(0,p.jsx)(m,{color:n(e==="synced"),children:` \u2601 synced (${s.synced}) `}),(0,p.jsx)(m,{color:n(e==="local"),children:`\u25A3 local (${s.local}) `}),(0,p.jsx)(m,{color:n(e==="never_run"),children:`\u25CB never run (${s.never})`})]}),(0,p.jsxs)(k,{children:[(0,p.jsx)(m,{color:n(e==="cli"),children:` \u2726 cli-generated (${s.cli}) `}),(0,p.jsx)(m,{color:n(e==="hand"),children:` hand-written (${s.hand})`})]})]})}var I=v(X(),1);import{existsSync as Xe,readFileSync as qe}from"fs";var d=v(F(),1);function pe({path:e,relPath:r,onAction:s,onBack:n,onView:o}){let[t,i]=(0,I.useState)(null),[c,f]=(0,I.useState)(!1);(0,I.useEffect)(()=>{let a=M(e);if(Xe(a))try{i(JSON.parse(qe(a,"utf8")))}catch{i(null)}},[e]),Q((a,g)=>{if(g.escape){if(c){f(!1);return}n();return}if(c){a==="y"||a==="Y"?(f(!1),s("delete")):(a==="n"||a==="N")&&f(!1);return}a==="r"&&s("run"),a==="e"&&t?.testcase_id&&s("export"),a==="d"&&f(!0),a==="v"&&o&&o()});let l=({k:a,v:g})=>g?(0,d.jsxs)(m,{children:[(0,d.jsx)(m,{color:h.dim,children:a.padEnd(14)}),g]}):null;return(0,d.jsxs)(k,{flexDirection:"column",borderStyle:"round",borderColor:h.orange,paddingX:2,paddingY:1,children:[(0,d.jsx)(m,{color:h.orange,bold:!0,children:r}),(0,d.jsx)(k,{marginTop:1,flexDirection:"column",children:t?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(l,{k:"test_id",v:t.test_id}),(0,d.jsx)(l,{k:"testcase_id",v:t.testcase_id}),(0,d.jsx)(l,{k:"project_id",v:t.project_id}),(0,d.jsx)(l,{k:"folder_id",v:t.folder_id}),(0,d.jsx)(l,{k:"org_id",v:t.org_id}),(0,d.jsx)(l,{k:"session_name",v:t.session_name}),(0,d.jsx)(l,{k:"commit_id",v:t.commit_id})]}):(0,d.jsx)(m,{color:h.dim,children:"(never run \u2014 no meta.json)"})}),c?(0,d.jsx)(k,{marginTop:1,children:(0,d.jsxs)(m,{color:h.red,bold:!0,children:["Delete ",r," and its output dir? [y/n]"]})}):(0,d.jsx)(k,{marginTop:1,children:(0,d.jsxs)(m,{color:h.dim,children:["[r] run [e] export",t?.testcase_id?"":" (need testcase_id)"," [d] delete",o?" [v] view":""," [Esc] back"]})})]})}function $(e){B(e);let r=M(e);if(!P(r))return null;try{return JSON.parse(Ge(r,"utf8"))}catch{return null}}function _e(e,r){return!e||e.org_id===void 0?!0:e.org_id===r}function J(e,r){return _e(e,r)?null:(process.stderr.write(`error: this test belongs to org ${e.org_id}; you are logged in as org ${r}.
|
|
3
3
|
Switch profiles with \`kane-cli profiles switch\` to act on it.
|
|
4
4
|
`),2)}async function Xt(e={}){let r=!!process.stdin.isTTY&&!e.json,s=new O,n=new L;await H({isInteractive:r,creds:s,config:n});let o=s.getDefaultEnv()??"prod";try{let t=await N({creds:s,env:o,log:()=>{}});return t.resolvedCreds?.org_id===void 0?(process.stderr.write("error: TMS did not return an org_id. Run `kane-cli login` again.\n"),{ok:!1,code:2}):{ok:!0,orgId:String(t.resolvedCreds.org_id)}}catch(t){if(t instanceof j)return process.stderr.write("error: not authenticated. Run `kane-cli login` first.\n"),{ok:!1,code:2};throw t}}async function qt(e,r){if(process.stdin.isTTY&&!e.json)return await ze(r,e.root);let s=e.root??process.cwd(),n;try{n=await U({root:s,ignore:e.ignore})}catch(o){if(o instanceof R)return process.stderr.write(`error: ${o.message}
|
|
5
5
|
`),2;throw o}for(let o of n.results){let t=$(o.path);if(!_e(t,r))continue;let i={path:o.relPath.startsWith(".")?o.relPath:`./${o.relPath}`,name:C(o.path),has_meta:t!==null,source:o.source,synced:!!t?.testcase_id,tags:W(o.path)};t&&(t.test_id&&(i.test_id=t.test_id),t.testcase_id&&(i.testcase_id=t.testcase_id),t.org_id&&(i.org_id=t.org_id),t.project_id&&(i.project_id=t.project_id),t.folder_id&&(i.folder_id=t.folder_id)),process.stdout.write(JSON.stringify(i)+`
|
|
6
6
|
`)}return n.aborted&&process.stderr.write(`warn: walk aborted (${n.abortReason}). Pass --root or --ignore to narrow.
|
|
7
|
-
`),0}var ye=-1001,xe=-1002,we=-1003,_={action:null,path:null};function Ve(e,r){return _.action=e,_.path=r,e==="run"?ye:e==="export"?xe:we}function Ye({root:e,currentOrgId:r,onComplete:s}){let[n,o]=D.default.useState({kind:"list"});return D.default.useEffect(()=>{n.kind==="exiting"&&s(n.code)},[n,s]),n.kind==="list"?D.default.createElement(me,{root:e,currentOrgId:r,onSelect:t=>o({kind:"inspect",path:t.path,relPath:t.relPath}),onCancel:()=>o({kind:"exiting",code:0})}):n.kind==="inspect"?D.default.createElement(pe,{path:n.path,relPath:n.relPath,onAction:async t=>{o({kind:"exiting",code:Ve(t,n.path)})},onBack:()=>o({kind:"list"})}):null}async function ze(e,r){let s=r??process.cwd(),{render:n}=await import("./build-JIKYOZUH.js"),o=await new Promise(t=>{let{unmount:i,waitUntilExit:c}=n(D.default.createElement(Ye,{root:s,currentOrgId:e,onComplete:f=>{i(),t(f)}}),{stdout:process.stderr,exitOnCtrlC:!0});c().then(()=>t(0)).catch(()=>t(0))});if(o===ye&&_.path){let{runTestMdFile:t}=await import("./run-test-md-
|
|
7
|
+
`),0}var ye=-1001,xe=-1002,we=-1003,_={action:null,path:null};function Ve(e,r){return _.action=e,_.path=r,e==="run"?ye:e==="export"?xe:we}function Ye({root:e,currentOrgId:r,onComplete:s}){let[n,o]=D.default.useState({kind:"list"});return D.default.useEffect(()=>{n.kind==="exiting"&&s(n.code)},[n,s]),n.kind==="list"?D.default.createElement(me,{root:e,currentOrgId:r,onSelect:t=>o({kind:"inspect",path:t.path,relPath:t.relPath}),onCancel:()=>o({kind:"exiting",code:0})}):n.kind==="inspect"?D.default.createElement(pe,{path:n.path,relPath:n.relPath,onAction:async t=>{o({kind:"exiting",code:Ve(t,n.path)})},onBack:()=>o({kind:"list"})}):null}async function ze(e,r){let s=r??process.cwd(),{render:n}=await import("./build-JIKYOZUH.js"),o=await new Promise(t=>{let{unmount:i,waitUntilExit:c}=n(D.default.createElement(Ye,{root:s,currentOrgId:e,onComplete:f=>{i(),t(f)}}),{stdout:process.stderr,exitOnCtrlC:!0});c().then(()=>t(0)).catch(()=>t(0))});if(o===ye&&_.path){let{runTestMdFile:t}=await import("./run-test-md-3BA56ZYF.js"),i=await t(_.path,{});return _.action=null,_.path=null,i}if(o===xe&&_.path){let t=await Ze(_.path,{},e);return _.action=null,_.path=null,t}if(o===we&&_.path){let t=await Qe(_.path,!0,e);return _.action=null,_.path=null,t}return o}async function Gt(e,r){let s=z(e);if(!P(s))return process.stderr.write(`error: file not found: ${s}
|
|
8
8
|
`),2;let n=$(s),o=J(n,r);if(o!==null)return o;let t={path:s,name:C(s),has_meta:n!==null};return n&&(n.commit_id&&(t.commit_id=n.commit_id),n.test_id&&(t.test_id=n.test_id),n.testcase_id&&(t.testcase_id=n.testcase_id),n.project_id&&(t.project_id=n.project_id),n.folder_id&&(t.folder_id=n.folder_id),n.org_id&&(t.org_id=n.org_id),n.session_name&&(t.session_name=n.session_name)),process.stdout.write(JSON.stringify(t)+`
|
|
9
9
|
`),0}async function Qe(e,r,s){let n=z(e);if(!P(n))return process.stderr.write(`error: file not found: ${n}
|
|
10
10
|
`),2;let o=$(n),t=J(o,s);if(t!==null)return t;if(!r)return process.stderr.write(`error: refusing to delete without --yes.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{b as G,c as P,e as J,h as q,i as z,j as Q,m as V,o as X,p as T}from"./chunk-
|
|
2
|
+
import{b as G,c as P,e as J,h as q,i as z,j as Q,m as V,o as X,p as T}from"./chunk-VK3NU742.js";import{e as U}from"./chunk-EHN5HTUD.js";import{copyFileSync as ae,cpSync as le,existsSync as w,mkdirSync as ue,readFileSync as Oe,readdirSync as pe,rmSync as Te,writeFileSync as _e}from"fs";import{dirname as Ae,isAbsolute as Le,join as R,relative as Ee,resolve as Ne}from"path";import{writeFileSync as ge,mkdirSync as Se,readFileSync as Re}from"fs";import{dirname as Ie,basename as Y}from"path";function ee(e){let t=e.outPath??P(e.sourcePath);Se(Ie(t),{recursive:!0});let s=[];s.push("---"),s.push(`test: ../${Y(e.sourcePath)}`),s.push(`status: ${e.overallStatus}`),s.push(`started: ${e.startedISO}`),s.push(`duration_s: ${e.durationS}`),s.push(`session_id: ${e.sessionId}`),s.push("---",""),s.push(`# ${e.title??Y(e.sourcePath)} \u2014 Result`,"");for(let l=0;l<e.rootSteps.length;l++){let a=e.rootSteps[l],i=e.outcomes.find(p=>p.rootStepIndex===l+1);if(s.push(ye(a,i)),i?.stepMd5&&s.push(`md5: ${i.stepMd5}`),i?.status==="failed"&&i.reason&&s.push(`Reason: ${i.reason}`),i?.softFailures?.length)for(let p of i.softFailures){let o=p.reason?`: ${p.reason}`:"";s.push(`\u26A0 optional sub-step ${p.subStepIndex} failed${o}`)}a.body.kind==="objective"&&i?.status!=="skipped"&&s.push(a.body.text),s.push("")}return ge(t,s.join(`
|
|
3
3
|
`),"utf8"),t}function ye(e,t){if(!t)return`## ${e.heading} (no outcome)`;let s=t.duration_s!=null?`${t.duration_s}s`:"\u2014";if(t.status==="skipped")return`## ${e.heading} \u23ED skipped`;let l=t.softFailed?" (optional)":"";if(t.refKind&&t.status==="passed"){let a=t.helperResultRelPath?` \u2192 ${t.helperResultRelPath}`:"";return`## ${e.heading} \u2713 passed (via @${t.refKind} ${t.refLabel} \u2014 ${t.inlinedCount} inlined steps, ${s}${a})`}if(t.refKind&&t.status==="failed"){let a=t.failedSubStepIndex&&t.failedSubStepIndex.length>0?` \u2014 at sub-step ${t.failedSubStepIndex.join(" \u2192 sub-step ")}`:"",i=t.helperResultRelPath?` \u2192 ${t.helperResultRelPath}`:"";return`## ${e.heading} \u2717 failed${l} (via @${t.refKind} ${t.refLabel}${a}, ${s}${i})`}return t.status==="passed"?`## ${e.heading} \u2713 passed (${s})`:`## ${e.heading} \u2717 failed${l} (${s})`}var xe=/^##\s+(.+?)\s+(✓ passed|✗ failed(?:\s+\(optional\))?|⏭ skipped)(?:\s+\((.*)\))?\s*$/,be=/via\s+@\w+\s+(\S+).*?(?:→\s+(\S+))?\s*$/,ke=/^md5:\s+([a-f0-9]{32})\s*$/;function Z(e,t){for(let s=t;s<e.length&&!/^##\s/.test(e[s]);s++){if(e[s].trim()==="")continue;let l=ke.exec(e[s]);return l?l[1]:null}return null}function $(e){let s=Re(e,"utf8").split(`
|
|
4
4
|
`),l="passed";if(s[0]?.trim()==="---")for(let i=1;i<s.length&&s[i].trim()!=="---";i++){let p=/^status:\s+(passed|failed|interrupted)\s*$/.exec(s[i]);p&&(l=p[1])}let a=[];for(let i=0;i<s.length;i++){let p=xe.exec(s[i]);if(!p)continue;let o=p[1],r=p[2],c=p[3]??"",m=r.startsWith("\u2713")?"passed":r.startsWith("\u23ED")?"skipped":"failed";if(/via\s+@/.test(c)){let f=be.exec(c),b=f?.[1]??"",g=f?.[2]??null;a.push({kind:"import",heading:o,status:m,md5:Z(s,i+1),importPath:b,helperResultRelPath:g})}else a.push({kind:"objective",heading:o,status:m,md5:Z(s,i+1)})}return{overallStatus:l,steps:a}}import{copyFileSync as te,existsSync as K,mkdirSync as ve,writeFileSync as se,promises as Ge}from"fs";import{join as D,dirname as re,basename as Pe}from"path";async function ne(e){for(let t=0;t<e.totalRunDirs;t++){let s=e.runIndex+t,l=D(e.sessionDir,"runs",String(s)),a=D(e.stagingStepDir,"flows",String(t));ve(a,{recursive:!0});let i=D(a,"actions.ndjson");if(e.packTestDir){let r=D(e.packTestDir,"logs",`${s}-actions.ndjson`);if(K(r)){te(r,i);continue}let c=re(re(e.packTestDir)),m=Pe(e.packTestDir),I=K(c)?await U(c,`tests/${m}/logs/${s}-actions.ndjson`).catch(()=>null):null;se(i,I??"");continue}let p=[D(l,"run-test","actions.ndjson"),D(l,"actions.ndjson")],o=!1;for(let r of p)if(K(r)){te(r,i),o=!0;break}o||se(i,"")}}import{existsSync as _,readdirSync as we}from"fs";import{dirname as $e,join as M,basename as C}from"path";function et(e){let t=[],s=new Set,l=new Map;function a(r){if(l.has(r))return l.get(r);let c=P(r),m=_(c)?$(c):null;return l.set(r,m),m}let i=new Map;function p(r){if(i.has(r))return i.get(r);let c=M(r,"Result.md"),m=_(c)?$(c):null;return i.set(r,m),m}function o(r){for(let c=1;c<r.trace.length;c++){let m=r.trace[c-1],I=a(m.file);if(!I)continue;let f=I.steps[m.stepIndex-1];if(f){if(f.kind!=="import")return{kind:"author",reason:"structure-mismatch"};if(C(f.importPath)!==C(r.trace[c].file))return{kind:"author",reason:"structure-mismatch"};if(f.md5!=null&&f.md5!==m.rowMd5)return{kind:"author",reason:"structure-mismatch"}}}return null}for(let r of e.steps){let c=r.trace[r.trace.length-1].stepIndex,m=s.has(r.owningFile);for(let g=0;g<r.trace.length-1&&!m;g++)s.has(r.trace[g].file)&&(m=!0);if(m){t.push({kind:"author",reason:a(r.owningFile)===null?"no-result-md":"downstream-of-divergence"});continue}let I=o(r);if(I){t.push(I);for(let g=0;g<r.trace.length;g++)s.add(r.trace[g].file);continue}let f=a(r.owningFile),b;if(f===null&&r.trace.length>1){let g=H(r.trace);b=ie(r,p(g),c,g)}else b=ie(r,f,c);if(t.push(b),b.kind==="author"){s.add(r.owningFile);for(let g=0;g<r.trace.length-1;g++)s.add(r.trace[g].file)}}return t}function ie(e,t,s,l=null){if(!t)return{kind:"author",reason:"no-result-md"};let a=t.steps[s-1];if(!a)return{kind:"author",reason:"no-result-md"};if(a.kind!=="objective")return{kind:"author",reason:"structure-mismatch"};if(a.status!=="passed")return{kind:"author",reason:"recorded-failed"};let i=T(e);if(i!==a.md5)return{kind:"author",reason:"md5-mismatch"};let p=l===null?Q(e.owningFile,s,i.slice(0,8)):M(l,".internal","steps",`${s}-${i.slice(0,8)}`),o=De(p);return o===0?{kind:"author",reason:"missing-recording"}:{kind:"replay",recordingDir:p,flowCount:o}}function De(e){let t=M(e,"flows");if(!_(t))return 0;let s;try{s=we(t,{withFileTypes:!0}).filter(a=>a.isDirectory()&&/^\d+$/.test(a.name)).map(a=>parseInt(a.name,10))}catch{return 0}if(s.length===0)return 0;let l=Math.max(...s);for(let a=0;a<=l;a++)if(!_(M(t,String(a),"actions.ndjson")))return 0;return l+1}function tt(e){return e.some(t=>t.kind==="author")}function st(e){for(let t=0;t<e.length;t++)if(e[t].kind==="author")return t;return e.length}function H(e){let t=i=>{let p=C(i);return p.endsWith("_test.md")?p.slice(0,-8):p.endsWith(".md")?p.slice(0,-3):p},s=t(e[0].file),l=t(e[e.length-1].file),a=e.slice(0,-1).map(i=>String(i.stepIndex));return M($e(e[e.length-1].file),`helper-output-${l}-${s}-${a.join("-")}`)}function rt(e){return Array.from({length:e.flowCount},(t,s)=>M(e.recordingDir,"flows",String(s),"actions.ndjson"))}import{existsSync as oe,mkdirSync as Me,rmSync as je,cpSync as Fe}from"fs";function de(e,t){oe(e)&&(oe(t)&&je(t,{recursive:!0,force:!0}),Me(t,{recursive:!0}),Fe(e,t,{recursive:!0}))}async function gt(e){let t=new Map;for(let o of e.stepRunRecords)t.set(o.testmdStepIndex,o);let s=e.authoredFlatIdx??new Set,l=[],a=[],i=new Map,p=o=>{if(i.has(o))return i.get(o);let r=R(o,"Result.md"),c=w(r)?$(r):null;return i.set(o,c),c};for(let o of e.resolvedTest.unitFiles){let r=o.file===e.resolvedTest.rootPath,c=V(o.file,Oe(o.file,"utf8")),m=P(o.file),I=w(m)?$(m):null,f=[],b=[],g=[],j=[];if(!r)for(let d of e.resolvedTest.steps){if(d.owningFile!==o.file||d.trace.length<2)continue;let n=H(d.trace);j.includes(n)||j.push(n)}let F=d=>{if(I!==null)return null;for(let n of j){let v=p(n)?.steps[d-1];if(v)return{row:v,dir:n}}return null},W=[],A=!1,B=!1,L=!1,E=!1;for(let d of c.steps){let n=d.index,u=I?.steps[n-1];if(d.body.kind==="objective"){let h=e.resolvedTest.steps.filter(S=>S.owningFile===o.file&&S.trace[S.trace.length-1].stepIndex===n&&t.has(S.flatIndex)),y=h.length>0?h[h.length-1]:null;if(y){A=!0,s.has(y.flatIndex)&&(B=!0);let S=T(y),x;r?x=e.outcomes.find(he=>he.rootStepIndex===n)??{rootStepIndex:n,status:"skipped"}:x={rootStepIndex:n,status:ce(y,e.outcomes)},x.status==="failed"&&(L=!0),x.stepMd5==null&&(x.stepMd5=S),f.push(x),b.push({stepIndex:n,md5:S,rec:t.get(y.flatIndex)}),(!u||u.kind!=="objective"||u.status!==x.status||x.status==="passed"&&u.md5!==S)&&(E=!0)}else if(u&&u.kind==="objective")f.push({rootStepIndex:n,status:u.status,...u.md5?{stepMd5:u.md5}:{}}),g.push(n);else if(!r&&F(n)?.row.kind==="objective"){let S=F(n),x=S.row;f.push({rootStepIndex:n,status:x.status,...x.md5?{stepMd5:x.md5}:{}}),W.push({psIdx:n,dir:S.dir})}else r?f.push(e.outcomes.find(S=>S.rootStepIndex===n)??{rootStepIndex:n,status:"skipped"}):f.push({rootStepIndex:n,status:"skipped"});continue}let v=Le(d.body.path)?d.body.path:Ne(Ae(o.file),d.body.path),O=X({path:d.body.path,bindings:d.body.bindings,optional:d.optional??!1}),me=Ee(G(o.file),P(v)),N=e.resolvedTest.steps.filter(h=>h.trace.some((y,S)=>S<h.trace.length-1&&y.file===o.file&&y.stepIndex===n)&&t.has(h.flatIndex));if(N.length>0){A=!0;let h;if(r)h=e.outcomes.find(y=>y.rootStepIndex===n)??{rootStepIndex:n,status:"passed",refKind:"import",refLabel:d.body.path};else{let y=N.some(S=>ce(S,e.outcomes)==="failed");h={rootStepIndex:n,status:y?"failed":"passed",refKind:"import",refLabel:d.body.path,inlinedCount:N.length}}h.status==="failed"&&(L=!0),h.stepMd5==null&&(h.stepMd5=O),h.helperResultRelPath==null&&(h.helperResultRelPath=me),f.push(h),(!u||u.kind!=="import"||u.status!==h.status||u.md5!==O)&&(E=!0)}else if(u&&u.kind==="import")f.push({rootStepIndex:n,status:u.status,refKind:"import",refLabel:u.importPath,...u.md5?{stepMd5:u.md5}:{},...u.helperResultRelPath?{helperResultRelPath:u.helperResultRelPath}:{}});else if(!r&&F(n)?.row.kind==="import"){let h=F(n).row;f.push({rootStepIndex:n,status:h.status,refKind:"import",refLabel:d.body.path})}else r?f.push(e.outcomes.find(h=>h.rootStepIndex===n)??{rootStepIndex:n,status:"skipped",refKind:"import",refLabel:d.body.path}):f.push({rootStepIndex:n,status:"skipped",refKind:"import",refLabel:d.body.path})}if(!(r||A&&(B||L||I===null||E)))continue;l.push(o.file);let k=q(o.file);ue(R(k,".internal"),{recursive:!0});for(let d of b){let n=R(k,".internal","steps",`${d.stepIndex}-${d.md5.slice(0,8)}`);ue(n,{recursive:!0}),await ne({sessionDir:e.sessionDir,runIndex:d.rec.runIndex,totalRunDirs:d.rec.totalRunDirs,stagingStepDir:n,packTestDir:e.packTestDir})}if(g.length>0){let d=z(o.file);if(w(d))for(let n of pe(d)){let u=parseInt(n.split("-")[0]??"",10);!Number.isNaN(u)&&g.includes(u)&&le(R(d,n),R(k,".internal","steps",n),{recursive:!0})}}for(let d of W){let n=R(d.dir,".internal","steps");if(w(n))for(let u of pe(n))parseInt(u.split("-")[0]??"",10)===d.psIdx&&le(R(n,u),R(k,".internal","steps",u),{recursive:!0})}let fe=f.some(d=>d.status==="failed");if(ee({sourcePath:o.file,title:c.title,rootSteps:c.steps,outcomes:f,overallStatus:r?e.overallStatus:fe?"failed":"passed",startedISO:e.startedISO,durationS:r?e.durationS:0,sessionId:e.sessionId,outPath:R(k,"Result.md")}),r){let d={};e.commitId&&(d.commit_id=e.commitId),e.tmsIds.testId&&(d.test_id=e.tmsIds.testId),e.tmsIds.testcaseId&&(d.testcase_id=e.tmsIds.testcaseId),e.tmsIds.projectId&&(d.project_id=e.tmsIds.projectId),e.tmsIds.folderId&&(d.folder_id=e.tmsIds.folderId),e.tmsIds.orgId&&(d.org_id=e.tmsIds.orgId),e.tmsIds.sessionName&&(d.session_name=e.tmsIds.sessionName),_e(R(k,".internal","meta.json"),JSON.stringify(d,null,2)+`
|
|
5
5
|
`,"utf8");let n=R(e.sessionDir,"execution.json");if(w(n))try{ae(n,R(k,".internal","execution.json"))}catch{}if(e.codeExportDir){let u=e.codeExportLanguage??"python",v=R(k,`playwright-${u}-code`);try{de(e.codeExportDir,v)}catch(O){process.stderr.write(`warn: codegen copy failed: ${O.message}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as h}from"./chunk-
|
|
2
|
+
import{a as h}from"./chunk-SA2LQSYP.js";import{y as l}from"./chunk-D6FYCAIA.js";import{a as A}from"./chunk-HCBYKLMW.js";import{a as c,b as f,i as P}from"./chunk-C44QQJR4.js";import{a as B}from"./chunk-6YGTRKDT.js";import{e as x}from"./chunk-UR6MHSHU.js";var L=x(B(),1);var n=x(A(),1);function S(r,d,s,u,m){let p=s==="basic"&&u?`basic (${u})`:s,i=20,a=`${r} [${d}]`,g="\xB7".repeat(Math.max(2,i-a.length+3));return{label:`${a} ${g} ${p}`,profile:r,env:d,isActive:m}}function M({creds:r,onSwitch:d,onCancel:s}){let u=r.listProfiles(),m=r.getActiveProfile(),p=r.getDefaultEnv(),i=u.map(e=>{let o=r.loadBasicAuth(e.profile,e.env),t=r.loadCredentials(e.profile,e.env)!==null,v=o?"basic":t?"oauth":"none",b=o?o.username:null,w=e.profile===m&&e.env===p;return S(e.profile,e.env,v,b,w)}),[a,g]=(0,L.useState)(()=>{let e=i.findIndex(o=>o.isActive);return e>=0?e:0});return P((e,o)=>{if(o.escape){s();return}if(o.upArrow){g(t=>Math.max(0,t-1));return}if(o.downArrow){g(t=>Math.min(i.length-1,t+1));return}if(o.return&&i[a]){let t=i[a];t.isActive||d(t.profile,t.env),s();return}}),i.length===0?(0,n.jsxs)(c,{flexDirection:"column",borderStyle:"round",borderColor:l.orange,paddingX:2,paddingY:1,children:[(0,n.jsx)(f,{color:l.orange,bold:!0,children:"Profiles"}),(0,n.jsx)(c,{marginTop:1,children:(0,n.jsx)(f,{color:l.dim,children:"No profiles \u2014 use Login to create one"})}),(0,n.jsx)(h,{bindings:[],escBackLabel:"back"})]}):(0,n.jsxs)(c,{flexDirection:"column",borderStyle:"round",borderColor:l.orange,paddingX:2,paddingY:1,children:[(0,n.jsx)(f,{color:l.orange,bold:!0,children:"Profiles"}),(0,n.jsx)(c,{flexDirection:"column",marginTop:1,children:i.map((e,o)=>{let t=o===a,v=t?"\u276F ":" ",b=e.isActive?l.green:t?l.orange:void 0;return(0,n.jsxs)(f,{color:b,children:[v,e.label,e.isActive?" \u25CF active":""]},`${e.profile}-${e.env}`)})}),(0,n.jsx)(h,{bindings:[{keys:"\u2191\u2193",label:"navigate"},{keys:"\u21B5",label:"switch"}],escBackLabel:"back"})]})}export{S as a,M as b};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
var R={"use-case":"use-cases",ac:"ACs",scenario:"scenarios",test:"tests",gap:"gaps"},l=n=>R[n]??`${n}s`,k=n=>n==="ac"?"AC":n==="use-case"?"use-case":n,p=n=>n.kind??"use-case",C=n=>`${p(n)}:${n.temp_ref}`;function T(n){let t=n,a=t.badge??n.risk??null,u=t.why??n.summary??n.description??null;return JSON.stringify([n.title,a,u,t.extra??null,n.depends_on_hint??null])}function w(n){return n.filter(t=>t.role==="agent"&&typeof t.turnIndex=="number"&&Array.isArray(t.items)&&t.items.length>0)}function S(n){let t=new Map,a=1;for(let s of w(n)){let r=new Set;for(let o of s.items){let d=C(o);if(r.has(d))continue;r.add(d);let f=t.get(d);t.set(d,{num:f?.num??a++,ref:o.temp_ref,kind:p(o),item:o,turnIndex:s.turnIndex,fingerprint:T(o)})}}let u=[...t.values()].sort((s,r)=>s.num-r.num),c=[];for(let s of u){let r=c.find(o=>o.kind===s.kind);r?r.count++:c.push({kind:s.kind,label:l(s.kind),count:1})}return{entries:u,byRef:t,counts:c}}function $(n,t){let u=w(n).find(e=>e.turnIndex===t);if(!u)return null;let c=n.filter(e=>e.role!=="agent"||typeof e.turnIndex!="number"||e.turnIndex<=t),s=S(c),r=S(n.filter(e=>e.role!=="agent"||typeof e.turnIndex!="number"||e.turnIndex<t)),o=[],d=new Map,f=new Map,y=new Map,b=new Set;for(let e of u.items){let i=C(e);if(b.has(i))continue;b.add(i);let m=r.byRef.get(i),h=e.changed===!0,U=s.byRef.get(i).num,g=p(e);if(m&&!h&&m.fingerprint===T(e)){d.set(g,(d.get(g)??0)+1);continue}let x=!!m||h,I=x?y:f;I.set(g,(I.get(g)??0)+1),o.push({item:e,num:U,updated:x})}let A=[...d.entries()].map(([e,i])=>({label:l(e),count:i})),D=[...[...f.entries()].map(([e,i])=>`${i} new ${i===1?k(e):l(e)}`),...[...y.entries()].map(([e,i])=>`${i} updated ${i===1?k(e):l(e)}`)].join(" \xB7 ");return{fresh:o,unchanged:A,headerStats:D}}function M(n,t){let a=n.entries.filter(s=>s.turnIndex===t);if(a.length===0)return n;let u=new Map(a.map(s=>[s.ref,s])),c=[];for(let s of a){let r=c.find(o=>o.kind===s.kind);r?r.count+=1:c.push({kind:s.kind,label:l(s.kind),count:1})}return{entries:a,byRef:u,counts:c}}export{l as a,C as b,T as c,S as d,$ as e,M as f};
|