@testmuai/kane-cli 0.8.7 → 0.8.8
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 +5 -1
- package/dist/{ChatSurface-3PEXML4X.js → ChatSurface-LS3KF7XY.js} +1 -1
- package/dist/{ChromeProfilePicker-E3CZ52RH.js → ChromeProfilePicker-UIJ5ZBLY.js} +1 -1
- package/dist/{CliFeedbackPrompt-BEVZRLQA.js → CliFeedbackPrompt-EIQQBWDY.js} +1 -1
- package/dist/{CliUploadProgress-V2FLLVR6.js → CliUploadProgress-6U77ZBAX.js} +1 -1
- package/dist/{ConfigView-ZOGKVFQT.js → ConfigView-MVFLCF5N.js} +1 -1
- package/dist/EvidenceViewOffer-ANVEOXJA.js +2 -0
- package/dist/FolderPicker-HVI6KITN.js +2 -0
- package/dist/{InfoBox-4TNE7QMG.js → InfoBox-57MRRSJI.js} +1 -1
- package/dist/{LinksBox-TXO5X5UD.js → LinksBox-RKAEQBFS.js} +1 -1
- package/dist/{ProfilesView-S4YPEZEF.js → ProfilesView-RQCQFIXH.js} +1 -1
- package/dist/{ProjectPicker-LWFX2QT2.js → ProjectPicker-5JEEHLY3.js} +1 -1
- package/dist/{SaveSessionPrompt-MJTCIQIZ.js → SaveSessionPrompt-TQROE5JM.js} +1 -1
- package/dist/SingleShotApp-VJVY3F4H.js +2 -0
- package/dist/{SummaryBox-UIVK3QDR.js → SummaryBox-C4UY6R65.js} +1 -1
- package/dist/TestMdRunView-X3CCNYV5.js +2 -0
- package/dist/{TestrunEvidenceTable-GYGVNCYW.js → TestrunEvidenceTable-LY24PK3T.js} +1 -1
- package/dist/{WhoamiView-NRGMMLL4.js → WhoamiView-2FIHHS4G.js} +1 -1
- package/dist/{app-download-HTQOD3YF.js → app-download-TO672LBR.js} +1 -1
- package/dist/{auth-5URO2XJU.js → auth-EVXJVU72.js} +1 -1
- package/dist/{binary-2U4YTTFS.js → binary-Y4DKNDQH.js} +1 -1
- package/dist/{bind-NO4TMSHJ.js → bind-FVCVYYL3.js} +3 -3
- package/dist/{bootstrap-UOEW3VZM.js → bootstrap-4XBQFKWF.js} +1 -1
- package/dist/bridge-6DCBL3GY.js +2 -0
- package/dist/{changelog-7BPYLUDK.js → changelog-LAQ2VGK6.js} +1 -1
- package/dist/{chat-committer-GUK6IBCL.js → chat-committer-K3NOTLOU.js} +1 -1
- package/dist/chat-controller-YJCNU76T.js +2 -0
- package/dist/{chunk-YGVY63PE.js → chunk-2MQP4SSF.js} +1 -1
- package/dist/{chunk-OHD4CZXT.js → chunk-36ZVMJTJ.js} +1 -1
- package/dist/{chunk-3IM5QGVV.js → chunk-3GZ4FQ4L.js} +1 -1
- package/dist/{chunk-ZFRWVWUR.js → chunk-4BIJCAR4.js} +1 -1
- package/dist/chunk-4PMZ5FCD.js +2 -0
- package/dist/{chunk-C4OVX65Q.js → chunk-54JZ6VEW.js} +1 -1
- package/dist/{chunk-GAO6ZMCT.js → chunk-5G22NOZK.js} +1 -1
- package/dist/{chunk-MROHDW4W.js → chunk-5LYPSIBC.js} +1 -1
- package/dist/{chunk-T3DVIDBA.js → chunk-5M5BG4MT.js} +1 -1
- package/dist/{chunk-Z7HUW3L4.js → chunk-5YCOYFZH.js} +1 -1
- package/dist/{chunk-ILKSL4PI.js → chunk-6FCPS2VT.js} +1 -1
- package/dist/{chunk-B27X3C2E.js → chunk-6LYQ4MJH.js} +1 -1
- package/dist/{chunk-TKQSIKMR.js → chunk-6T3DWH56.js} +1 -1
- package/dist/{chunk-DSNB7EI6.js → chunk-6TVNJDSE.js} +1 -1
- package/dist/{chunk-VMRP44MN.js → chunk-7CXIOJB3.js} +1 -1
- package/dist/{chunk-NQFAZM2D.js → chunk-7RTITBZG.js} +1 -1
- package/dist/{chunk-P4JUY54O.js → chunk-7UYSTQMI.js} +1 -1
- package/dist/{chunk-HL4UXOHV.js → chunk-7YX2HUHY.js} +1 -1
- package/dist/chunk-AKX4VRRR.js +2 -0
- package/dist/{chunk-DJC6MLO4.js → chunk-AO5QH6UU.js} +1 -1
- package/dist/{chunk-IQBKCLLR.js → chunk-AS5UKK27.js} +1 -1
- package/dist/{chunk-7VAE7WXF.js → chunk-ATIX6CVS.js} +2 -2
- package/dist/{chunk-A66ZGHO2.js → chunk-AZ73FJRK.js} +1 -1
- package/dist/{chunk-F7RR24BL.js → chunk-BAKOH2BR.js} +1 -1
- package/dist/{chunk-HO3T5LJH.js → chunk-BRE426DP.js} +1 -1
- package/dist/{chunk-SZTUZZEA.js → chunk-BYOXTXLC.js} +1 -1
- package/dist/{chunk-46HYKID6.js → chunk-CQCV2RJK.js} +2 -2
- package/dist/{chunk-IJABR5SX.js → chunk-DHPBVHED.js} +1 -1
- package/dist/{chunk-HEWWWMUN.js → chunk-EEFZXZTZ.js} +1 -1
- package/dist/{chunk-F43KOMVB.js → chunk-EV64VI66.js} +1 -1
- package/dist/{chunk-2RO2BWCZ.js → chunk-FGRTNRBS.js} +2 -2
- package/dist/{chunk-QZB7CBRO.js → chunk-FL6TCYA5.js} +1 -1
- package/dist/{chunk-IMR64OCZ.js → chunk-GX3FPJUG.js} +1 -1
- package/dist/{chunk-R2JRQD4I.js → chunk-GZLQ2AR6.js} +1 -1
- package/dist/chunk-H4WIA4IP.js +26 -0
- package/dist/{chunk-76ILJPZF.js → chunk-H6YGG3GC.js} +1 -1
- package/dist/{chunk-YKYZKBMH.js → chunk-HJOGBE23.js} +17 -17
- package/dist/{chunk-ZH2ROVHE.js → chunk-HK3FFI7Y.js} +2 -2
- package/dist/{chunk-NM6PEYED.js → chunk-HPBI3P6I.js} +3 -3
- package/dist/{chunk-U35Y7SGB.js → chunk-HZDNGNO2.js} +1 -1
- package/dist/chunk-IPEA7ZOF.js +8 -0
- package/dist/{chunk-WNHLKDOT.js → chunk-IVQX3AKL.js} +1 -1
- package/dist/{chunk-5ZV64NAG.js → chunk-IWVA37B6.js} +1 -1
- package/dist/{chunk-3BY7MX3D.js → chunk-JE6OO2Q6.js} +1 -1
- package/dist/{chunk-3YKNJIVB.js → chunk-JPGRUMCS.js} +1 -1
- package/dist/{chunk-B2KXIFZD.js → chunk-JQW2QFSX.js} +1 -1
- package/dist/{chunk-JZ26R6UL.js → chunk-JUJ4SAGH.js} +1 -1
- package/dist/{chunk-UOLERTKE.js → chunk-K5DL7CZ4.js} +1 -1
- package/dist/{chunk-44PZPNXJ.js → chunk-K6JRFRGS.js} +1 -1
- package/dist/chunk-KAZGHWGK.js +5 -0
- package/dist/{chunk-Q4CTSXDM.js → chunk-KGKJU27A.js} +1 -1
- package/dist/{chunk-4EFDEDTL.js → chunk-LI5FMAUO.js} +1 -1
- package/dist/{chunk-UFYIQ4E3.js → chunk-LMYE3M75.js} +1 -1
- package/dist/{chunk-N2N5T5JN.js → chunk-LPH4TERT.js} +1 -1
- package/dist/{chunk-EU5ZH334.js → chunk-N5I2QYFD.js} +1 -1
- package/dist/chunk-N7Z7BQYO.js +3 -0
- package/dist/{chunk-OADHU5HL.js → chunk-NAZ36RKI.js} +1 -1
- package/dist/{chunk-X7R2JWOJ.js → chunk-O4IEPE3T.js} +1 -1
- package/dist/{chunk-SWXEBLKX.js → chunk-O5U6EAL3.js} +1 -1
- package/dist/chunk-OGJR5VIG.js +363 -0
- package/dist/{chunk-QQ67Z4IW.js → chunk-OO7LFDET.js} +1 -1
- package/dist/chunk-OQAN2WYO.js +26 -0
- package/dist/{chunk-72J4V3DA.js → chunk-P67CGWD6.js} +1 -1
- package/dist/{chunk-YYSWJU6H.js → chunk-PQYBIWZH.js} +1 -1
- package/dist/{chunk-E5C3HUIY.js → chunk-PYHWCV2V.js} +1 -1
- package/dist/{chunk-YDEK2FJQ.js → chunk-Q6743UUQ.js} +1 -1
- package/dist/{chunk-5DBK6QNS.js → chunk-QQ5MHSSY.js} +1 -1
- package/dist/{chunk-C765HUXU.js → chunk-QVR2PB6Y.js} +1 -1
- package/dist/{chunk-BISBPWN3.js → chunk-QXLX6LMJ.js} +1 -1
- package/dist/{chunk-E6AF53HZ.js → chunk-R4PLEH2A.js} +40 -39
- package/dist/{chunk-DTBKKC2R.js → chunk-RHL7KZNC.js} +1 -1
- package/dist/chunk-RSSOJ3L2.js +21 -0
- package/dist/{chunk-VHA7UNDW.js → chunk-S6M36UIV.js} +1 -1
- package/dist/{chunk-HHQ67JCU.js → chunk-SQWVGI3J.js} +1 -1
- package/dist/{chunk-6YVVTYVO.js → chunk-UDW4ZZAW.js} +7 -7
- package/dist/{chunk-CUM23TLF.js → chunk-UH2ZTX4E.js} +1 -1
- package/dist/{chunk-GYTZLUFV.js → chunk-UPHF2J5E.js} +1 -1
- package/dist/{chunk-C5ZIKKIB.js → chunk-UY2ES2Z6.js} +1 -1
- package/dist/{chunk-K7VX6YIT.js → chunk-UYLNH4SH.js} +1 -1
- package/dist/{chunk-HAGJA7KG.js → chunk-V5DYLGAM.js} +1 -1
- package/dist/{chunk-LOMPRMG3.js → chunk-VCDXUUJQ.js} +1 -1
- package/dist/{chunk-LRZXVDPY.js → chunk-VQVERWC3.js} +1 -1
- package/dist/{chunk-AJXOJF2X.js → chunk-W3Z7AZNT.js} +1 -1
- package/dist/{chunk-TMFFHGCT.js → chunk-WALVOFKR.js} +4 -4
- package/dist/{chunk-7CU5EBC6.js → chunk-WDOEMLFZ.js} +1 -1
- package/dist/chunk-WHEWZR2C.js +15 -0
- package/dist/{chunk-Z3EEMIVV.js → chunk-WIAZN7G4.js} +1 -1
- package/dist/{chunk-YC6HYBLN.js → chunk-WPSQYEBP.js} +2 -2
- package/dist/{chunk-GJ6RJVXH.js → chunk-WRIPTYSN.js} +1 -1
- package/dist/{chunk-BPHQNTUD.js → chunk-WYOEOJM2.js} +1 -1
- package/dist/{chunk-T4LAHU57.js → chunk-XFTF7OOY.js} +3 -3
- package/dist/{chunk-6AUSG5SB.js → chunk-XJ4TJARR.js} +1 -1
- package/dist/{chunk-IRPAWAK7.js → chunk-XLVH4CIZ.js} +3 -3
- package/dist/{chunk-HLXOYLZV.js → chunk-XMTSHHYQ.js} +1 -1
- package/dist/{chunk-XWKUZJCP.js → chunk-YMLC55J4.js} +1 -1
- package/dist/chunk-ZDAO5D6D.js +16 -0
- package/dist/{chunk-AUERMBX5.js → chunk-ZHKBSKCB.js} +1 -1
- package/dist/{chunk-XAQ3Y63J.js → chunk-ZIJLOYXX.js} +18 -18
- package/dist/{chunk-VOXDZS4N.js → chunk-ZKRL6HMY.js} +2 -2
- package/dist/{chunk-DMOZM22N.js → chunk-ZSFOANLG.js} +1 -1
- package/dist/{committer-JC6BIBNR.js → committer-C6UCDYMC.js} +1 -1
- package/dist/{config-XNDP425N.js → config-5UNFAVY6.js} +1 -1
- package/dist/{cover-cmd-HREOYWWD.js → cover-cmd-5LPHIOSI.js} +1 -1
- package/dist/{credentials-ZTBWB3LK.js → credentials-64JYS7AQ.js} +1 -1
- package/dist/{deps-bundle-OHCYH5KL.js → deps-bundle-5JPHXHQV.js} +1 -1
- package/dist/{deps-resolve-K2NX2W3K.js → deps-resolve-WFZZ22XH.js} +1 -1
- package/dist/descriptor-PWUUNYV7.js +2 -0
- package/dist/design-committer-UPC6NZUF.js +2 -0
- package/dist/dispatch-JLMCXOSK.js +2 -0
- package/dist/{doctor-XXOGVMAI.js → doctor-KJMR7NRK.js} +1 -1
- package/dist/{dossier-2M62K2PA.js → dossier-Y6TJWFZU.js} +1 -1
- package/dist/evidence-OFTY5U4X.js +2 -0
- package/dist/{evolve-cmd-WQB7E2B5.js → evolve-cmd-LU6LPT4F.js} +1 -1
- package/dist/exit-manager-ZLDO54S4.js +2 -0
- package/dist/{explain-AOZNHWMB.js → explain-3HAZY7Q6.js} +1 -1
- package/dist/{explain-cmd-7VTWRROR.js → explain-cmd-RMJPXD4U.js} +1 -1
- package/dist/{explain-cmd-2SCD5T6U.js → explain-cmd-XCRO4AS6.js} +1 -1
- package/dist/{extract-bind-3YXY7ZU2.js → extract-bind-YYIOEAYR.js} +3 -3
- package/dist/{extract-cmd-WGXEJ54C.js → extract-cmd-Q7OG6RY6.js} +2 -2
- package/dist/{feeder-GVZSWX6Q.js → feeder-IOR3XRNF.js} +1 -1
- package/dist/gaps-cmd-JIUM5YDY.js +3 -0
- package/dist/{gate-54BRAE7N.js → gate-E3BLIUEA.js} +1 -1
- package/dist/{generate-headless-PCNAJ2LS.js → generate-headless-NCVM643E.js} +2 -2
- package/dist/index.js +91 -91
- package/dist/ingest-TTUQ7UDK.js +2 -0
- package/dist/ingest-cmd-42VRDSPV.js +2 -0
- package/dist/install-5NMP6ZV4.js +2 -0
- package/dist/{interactive-bind-ZFMG2JIX.js → interactive-bind-ZDJS7PCV.js} +4 -4
- package/dist/{lifecycle-cmd-5FRGYY3M.js → lifecycle-cmd-KSMETBPP.js} +1 -1
- package/dist/{list-cmd-DD4WYJSH.js → list-cmd-V3HJ5K4O.js} +1 -1
- package/dist/{list-commands-64THS67Y.js → list-commands-3IKFZSGB.js} +1 -1
- package/dist/{logical-ids-U2OUMYCP.js → logical-ids-MLXAH45L.js} +1 -1
- package/dist/login-flow-UXUQ7GQT.js +2 -0
- package/dist/{maintenance-cmd-7V44VGL4.js → maintenance-cmd-VFYGKY3X.js} +1 -1
- package/dist/{mobile-prompts-RITBS32L.js → mobile-prompts-XPQSRBIW.js} +1 -1
- package/dist/persist-recorded-session-MFQ7JCLJ.js +3 -0
- package/dist/{phase-seed-ATH337WF.js → phase-seed-BMOSAA74.js} +1 -1
- package/dist/pipeline-2XITQU5W.js +2 -0
- package/dist/prepare-target-CKRWHYXS.js +2 -0
- package/dist/readmodel-TDRFVDVI.js +2 -0
- package/dist/reconcile-cmd-BKIJFVQT.js +2 -0
- package/dist/{reconcile-deps-XEUZHUQX.js → reconcile-deps-Y5G456WD.js} +2 -2
- package/dist/reconcile-engine-WDC2MEOY.js +2 -0
- package/dist/{recording-banner-NLS7K2RV.js → recording-banner-P3RUW62P.js} +1 -1
- package/dist/{records-XWF6KDQH.js → records-JLS63SDI.js} +1 -1
- package/dist/registry-OEY4IXB6.js +2 -0
- package/dist/{require-project-folder-V4F74R4A.js → require-project-folder-ZGQLWZV5.js} +1 -1
- package/dist/resolve-run-intent-DHZD6A4B.js +2 -0
- package/dist/{resolver-7EAM4A6O.js → resolver-W54NOQXY.js} +1 -1
- package/dist/{revert-2UCOMQ4J.js → revert-PRR3D4XM.js} +1 -1
- package/dist/{review-cmd-VN6VGUWJ.js → review-cmd-SAGIKWEW.js} +1 -1
- package/dist/run-7TZTUTTU.js +2 -0
- package/dist/run-BGQTRIU4.js +2 -0
- package/dist/{run-test-md-CPGKD3DD.js → run-test-md-WO2UDYPM.js} +2 -2
- package/dist/{sessions-cmd-ME7NM6ES.js → sessions-cmd-VDQGRBEM.js} +1 -1
- package/dist/{skill-installer-WEV2M32J.js → skill-installer-UTVUPOTD.js} +1 -1
- package/dist/{spawner-GG6YQB4A.js → spawner-SHCGHLQS.js} +1 -1
- package/dist/{structured-answers-2WOTULBQ.js → structured-answers-YAVW65G4.js} +1 -1
- package/dist/tcg-generate-YDNE643C.js +2 -0
- package/dist/testmd-actions-UCJ4ULSX.js +2 -0
- package/dist/token-refresh-ZNV2OSZC.js +2 -0
- package/dist/{validate-basic-QJL4DCKY.js → validate-basic-XEPS5I6V.js} +1 -1
- package/dist/verdicts-SOX22V6V.js +2 -0
- package/dist/{version-check-KONSQ4M3.js → version-check-LWDLMWBJ.js} +1 -1
- package/dist/{view-cmd-ZSMU4I4J.js → view-cmd-SXXNDZIC.js} +1 -1
- package/dist/{walk-session-X2N4XHLU.js → walk-session-M3OIWR5K.js} +1 -1
- package/dist/with-telemetry-SF5RHYQE.js +2 -0
- package/package.json +11 -14
- package/dist/EvidenceViewOffer-KWX27WNZ.js +0 -2
- package/dist/FolderPicker-EIKQSSF6.js +0 -2
- package/dist/SingleShotApp-5LCIH6DQ.js +0 -2
- package/dist/TestMdRunView-RE5GX5QX.js +0 -2
- package/dist/bridge-P2EBLXPY.js +0 -2
- package/dist/chat-controller-6GUUMUVP.js +0 -2
- package/dist/chunk-56PAQAX5.js +0 -19
- package/dist/chunk-7EFG27IZ.js +0 -355
- package/dist/chunk-E5Q5CDOX.js +0 -2
- package/dist/chunk-FVKLNQ4T.js +0 -26
- package/dist/chunk-GDB2V6QA.js +0 -21
- package/dist/chunk-LWZ7EIXX.js +0 -2
- package/dist/chunk-Q3S5EKX5.js +0 -21
- package/dist/chunk-UASEGQ7B.js +0 -11
- package/dist/chunk-WXHQYYD5.js +0 -2
- package/dist/chunk-YC2TFACE.js +0 -5
- package/dist/descriptor-OEUZZCOK.js +0 -2
- package/dist/design-committer-IIHKNEYF.js +0 -2
- package/dist/dispatch-JZWIFKRB.js +0 -2
- package/dist/evidence-FN2SQB6Z.js +0 -2
- package/dist/exit-manager-3FVBTNYR.js +0 -2
- package/dist/gaps-cmd-MFZ52DC7.js +0 -3
- package/dist/ingest-TTSDUMH5.js +0 -2
- package/dist/ingest-cmd-D2MD6EAK.js +0 -2
- package/dist/install-RHINEFR5.js +0 -2
- package/dist/login-flow-B5J6JXQN.js +0 -2
- package/dist/persist-recorded-session-Z5SCYWXR.js +0 -3
- package/dist/pipeline-HMFLLUZJ.js +0 -2
- package/dist/prepare-target-HOEFIKXN.js +0 -2
- package/dist/readmodel-UZETCXV6.js +0 -2
- package/dist/reconcile-cmd-Q7CBNPRX.js +0 -2
- package/dist/reconcile-engine-ES2INERY.js +0 -2
- package/dist/registry-E5RSXYQJ.js +0 -2
- package/dist/resolve-run-intent-WSOCGJUN.js +0 -2
- package/dist/run-45ODACZR.js +0 -2
- package/dist/run-ZYARNPAS.js +0 -2
- package/dist/tcg-generate-DASCY23M.js +0 -2
- package/dist/testmd-actions-X6HEL5NH.js +0 -2
- package/dist/token-refresh-ZTQFC3Q3.js +0 -2
- package/dist/verdicts-CRNN765C.js +0 -2
- package/dist/with-telemetry-Y6MVROKX.js +0 -2
package/dist/chunk-7EFG27IZ.js
DELETED
|
@@ -1,355 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as Ke}from"./chunk-ZKSN2SJ7.js";import{a as ze,b as ue}from"./chunk-LWZ7EIXX.js";import{a as Ue,b as We}from"./chunk-JZ26R6UL.js";import{a as Z,b as Le,e as le,f as de,g as Be,h as He}from"./chunk-6YVVTYVO.js";import{a as Ne,c as je,d as Fe,e as me,f as Ge}from"./chunk-GAO6ZMCT.js";import{a as Ae,b as Ie,c as Oe}from"./chunk-OADHU5HL.js";import{a as Re,b as Ce,c as Te}from"./chunk-BB2W35TW.js";import{a as qe}from"./chunk-L2TV4G56.js";import{c as Pe}from"./chunk-WNHLKDOT.js";import{a as $e,e as Ee}from"./chunk-F43KOMVB.js";import{a as Me}from"./chunk-IMR64OCZ.js";import{c as Ve}from"./chunk-UASEGQ7B.js";import{b as ye,c as we,d as ve,e as ae,h as oe,i as ce}from"./chunk-GDB2V6QA.js";import{b as ne}from"./chunk-VZ7KXRXB.js";import{a as be,b as re}from"./chunk-IDX3TOPY.js";import{C as U}from"./chunk-AJXOJF2X.js";import{g as De}from"./chunk-HLXOYLZV.js";import{a as ke,e as xe,f as Se}from"./chunk-DBIBROYW.js";import{d as z,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: 2
|
|
164
|
-
applies_when: >
|
|
165
|
-
iOS/Android native surface.
|
|
166
|
-
candidate_checks:
|
|
167
|
-
- id: interruptions
|
|
168
|
-
family: state_flow
|
|
169
|
-
measurable_example: "Incoming call mid-flow \u2192 state preserved on return \u2014 no device control: promises here become gaps, not tests"
|
|
170
|
-
emits: state-transition
|
|
171
|
-
- id: network-transitions
|
|
172
|
-
family: state_flow
|
|
173
|
-
measurable_example: "wifi\u2192cellular\u21924G drop: no data loss, graceful retry \u2014 no connectivity control: promises here become gaps, not tests"
|
|
174
|
-
emits: state-transition
|
|
175
|
-
- id: permissions
|
|
176
|
-
family: negative
|
|
177
|
-
measurable_example: "Deny camera \u2192 feature degrades, no crash \u2014 the OS dialog is tappable UI (exercise Allow/Deny on screen); only programmatic grant/deny or pre-seeded permission state has no control"
|
|
178
|
-
emits: forbidden-presence
|
|
179
|
-
- id: orientation
|
|
180
|
-
family: persistence
|
|
181
|
-
measurable_example: "Rotate mid-form \u2192 input preserved"
|
|
182
|
-
emits: absolute
|
|
183
|
-
- id: deep-links
|
|
184
|
-
family: state_flow
|
|
185
|
-
measurable_example: "Cold-start deep link lands on the right screen with auth \u2014 legal when the test states the exact link target"
|
|
186
|
-
emits: state-transition
|
|
187
|
-
- id: state-persistence
|
|
188
|
-
family: persistence
|
|
189
|
-
measurable_example: "Kill + relaunch \u2192 resume where left off"
|
|
190
|
-
emits: absolute
|
|
191
|
-
- id: localization
|
|
192
|
-
family: i18n
|
|
193
|
-
measurable_example: "Device locale switch reformats and re-translates \u2014 no device control: promises here become gaps, not tests"
|
|
194
|
-
emits: presence
|
|
195
|
-
`,"stateful-flow":`
|
|
196
|
-
id: stateful-flow
|
|
197
|
-
name: "Stateful flow"
|
|
198
|
-
version: 1
|
|
199
|
-
applies_when: >
|
|
200
|
-
Multi-step wizard / checkout / onboarding.
|
|
201
|
-
candidate_checks:
|
|
202
|
-
- id: valid-transitions
|
|
203
|
-
family: state_flow
|
|
204
|
-
measurable_example: "Each step advances only when its precondition is met"
|
|
205
|
-
emits: state-transition
|
|
206
|
-
- id: invalid-transitions
|
|
207
|
-
family: state_flow
|
|
208
|
-
measurable_example: "Can't jump to step 3 with step 2 incomplete"
|
|
209
|
-
emits: forbidden-presence
|
|
210
|
-
- id: back-and-abandon
|
|
211
|
-
family: state_flow
|
|
212
|
-
measurable_example: "Back from step 3, then abandon \u2192 no partial commit"
|
|
213
|
-
emits: forbidden-presence
|
|
214
|
-
- id: refresh-persistence
|
|
215
|
-
family: persistence
|
|
216
|
-
measurable_example: "Reload at step 2 \u2192 still at step 2 with data"
|
|
217
|
-
emits: absolute
|
|
218
|
-
- id: resume
|
|
219
|
-
family: persistence
|
|
220
|
-
measurable_example: "Return later \u2192 resume the saved flow"
|
|
221
|
-
emits: absolute
|
|
222
|
-
- id: double-submission
|
|
223
|
-
family: idempotency
|
|
224
|
-
measurable_example: "Double-click submit \u2192 exactly one submission"
|
|
225
|
-
emits: delta
|
|
226
|
-
`,"data-crud":`
|
|
227
|
-
id: data-crud
|
|
228
|
-
name: "Data CRUD"
|
|
229
|
-
version: 1
|
|
230
|
-
applies_when: >
|
|
231
|
-
A persisted record.
|
|
232
|
-
candidate_checks:
|
|
233
|
-
- id: crud-round-trip
|
|
234
|
-
family: crud
|
|
235
|
-
measurable_example: "Create \u2192 read shows it \u2192 update \u2192 read shows the change \u2192 delete \u2192 read 404"
|
|
236
|
-
emits: state-transition
|
|
237
|
-
- id: retry-safety
|
|
238
|
-
family: idempotency
|
|
239
|
-
measurable_example: "Retried create with same key \u2192 one row"
|
|
240
|
-
emits: delta
|
|
241
|
-
- id: concurrency-lost-update
|
|
242
|
-
family: concurrency
|
|
243
|
-
measurable_example: "Two writers, last must not silently clobber \u2192 conflict surfaced"
|
|
244
|
-
emits: forbidden-presence
|
|
245
|
-
- id: delete-cascade
|
|
246
|
-
family: crud
|
|
247
|
-
measurable_example: "Delete parent \u2192 children handled per rule"
|
|
248
|
-
emits: state-transition
|
|
249
|
-
- id: referential-consistency
|
|
250
|
-
family: crud
|
|
251
|
-
measurable_example: "Can't create a child for a missing parent"
|
|
252
|
-
emits: forbidden-presence
|
|
253
|
-
`,"auth-gated":`
|
|
254
|
-
id: auth-gated
|
|
255
|
-
name: "Auth gated"
|
|
256
|
-
version: 1
|
|
257
|
-
applies_when: >
|
|
258
|
-
Behind login/role.
|
|
259
|
-
candidate_checks:
|
|
260
|
-
- id: login-gate
|
|
261
|
-
family: auth
|
|
262
|
-
measurable_example: "Anonymous \u2192 redirected to login, not the resource"
|
|
263
|
-
emits: forbidden-presence
|
|
264
|
-
- id: role-permission-matrix
|
|
265
|
-
family: auth
|
|
266
|
-
measurable_example: "For each role \xD7 action: allowed/denied as specified"
|
|
267
|
-
emits: absolute
|
|
268
|
-
- id: cross-user-record
|
|
269
|
-
family: auth
|
|
270
|
-
measurable_example: "User A cannot read/edit user B's record by id"
|
|
271
|
-
emits: forbidden-presence
|
|
272
|
-
- id: token-session-expiry
|
|
273
|
-
family: auth
|
|
274
|
-
measurable_example: "Expired token \u2192 401/redirect, no stale access"
|
|
275
|
-
emits: forbidden-presence
|
|
276
|
-
- id: privilege-escalation
|
|
277
|
-
family: auth
|
|
278
|
-
measurable_example: "Non-admin cannot reach an admin action by direct URL/API"
|
|
279
|
-
emits: forbidden-presence
|
|
280
|
-
`,"search-list":`
|
|
281
|
-
id: search-list
|
|
282
|
-
name: "Search / list"
|
|
283
|
-
version: 1
|
|
284
|
-
applies_when: >
|
|
285
|
-
Search results / list views.
|
|
286
|
-
candidate_checks:
|
|
287
|
-
- id: pagination
|
|
288
|
-
family: pagination
|
|
289
|
-
measurable_example: "First/last/empty page correct; total accurate"
|
|
290
|
-
emits: absolute
|
|
291
|
-
- id: sorting
|
|
292
|
-
family: pagination
|
|
293
|
-
measurable_example: "Sort asc/desc actually orders; ties stable"
|
|
294
|
-
emits: absolute
|
|
295
|
-
- id: filtering
|
|
296
|
-
family: pagination
|
|
297
|
-
measurable_example: "Each filter narrows correctly; combined filters AND"
|
|
298
|
-
emits: absolute
|
|
299
|
-
- id: empty-state
|
|
300
|
-
family: empty_state
|
|
301
|
-
measurable_example: "No results \u2192 friendly empty state, not blank/error"
|
|
302
|
-
emits: presence
|
|
303
|
-
- id: invalid-input
|
|
304
|
-
family: negative
|
|
305
|
-
measurable_example: "Garbage query \u2192 no crash, sane result"
|
|
306
|
-
emits: forbidden-presence
|
|
307
|
-
- id: length-limits
|
|
308
|
-
family: bva
|
|
309
|
-
measurable_example: "Max-length query handled"
|
|
310
|
-
emits: absolute
|
|
311
|
-
- id: locale
|
|
312
|
-
family: i18n
|
|
313
|
-
measurable_example: "Locale-correct collation/casing"
|
|
314
|
-
emits: presence
|
|
315
|
-
`};var Xe=`
|
|
316
|
-
version: 2
|
|
317
|
-
principles:
|
|
318
|
-
- "Each step is one complete OBJECTIVE the executing agent achieves autonomously \u2014 state the goal and the path, never low-level actions (the agent emits its own actions)."
|
|
319
|
-
- "One objective (or tightly-related items of one goal) per step; unrelated goals split."
|
|
320
|
-
- "Verbose path: name site or app, page or screen, section, panel, control, state \u2014 'On the search results page for Noida, in the filter panel's Budget section, set min to 50L and max to 1Cr'."
|
|
321
|
-
- "Self-contained: concrete values inline; never 'as defined in the scenario' \u2014 the agent cannot see the graph."
|
|
322
|
-
- "Two surfaces: WEB tests run in the kane-cli browser agent; MOBILE tests run in the kane-cli mobile agent on a local Android emulator / iOS simulator (native app). One surface per test; imports/reuse only same-surface units."
|
|
323
|
-
- "In scope: web-browser behavior, mobile emulator/simulator native-app behavior, and direct API calls. NOT in scope: out-of-band email/SMS, backend state with no web, app-screen, or API surface."
|
|
324
|
-
verification:
|
|
325
|
-
- "Phrase checks against what the test's own surface can observe:"
|
|
326
|
-
- "WEB Visual \u2014 visible text, labels, counts, prices ('verify the price is 29.99', 'the Sold out label is shown')."
|
|
327
|
-
- "WEB Textual/DOM \u2014 element states/attributes ('the Add button is disabled', 'the placeholder of the search box is \u2026')."
|
|
328
|
-
- "WEB URL \u2014 'URL contains /checkout'. Title \u2014 'page title contains \u2026'."
|
|
329
|
-
- "WEB DevTools/Network \u2014 'no API calls returned 5xx', 'the POST /api/login returned 200'. Console \u2014 'no console errors'. Performance \u2014 'LCP under 2500ms'. Cookies/localStorage \u2014 'a cookie named session_id exists'."
|
|
330
|
-
- "MOBILE Visual \u2014 on-screen text, labels, counts, states ('the Upcoming list shows 2 reservations', 'a Booking cancelled toast is shown')."
|
|
331
|
-
- "MOBILE Element \u2014 native accessibility-tree states ('the Pay button is disabled', 'the Remember me switch is on')."
|
|
332
|
-
- "MOBILE Network (environment-dependent) \u2014 the app's own captured traffic ('the POST /api/login returned 200') and direct API calls ('call GET /api/bookings and verify the cancelled booking is absent') need a capture/API-wired run environment; when the promise is observable on-screen, prefer the screen."
|
|
333
|
-
- "MOBILE Lifecycle \u2014 background/foreground, terminate/relaunch (only when the objective closes the app), orientation, deep links with a stated target ('background the app and return; the draft is preserved'). OS permission dialogs are tappable UI \u2014 exercising Allow/Deny on screen is legal."
|
|
334
|
-
- "MOBILE ILLEGAL \u2014 URL, page Title, browser console, page-performance: none exist on a native app. Cookies/localStorage: WebView-only AND write-only \u2014 never a read check. Keyboard-visibility: illegal on Android (default sessions suppress the soft keyboard); iOS renders it as ordinary elements. No control exists \u2192 gap, never a test: incoming call/SMS, posting notifications, wifi/airplane switches, locale/timezone, clipboard reads, on-device DB/file reads (the db-query tool reads a configured backend DB, never the device), geolocation, biometrics, programmatic permission pre-seeding. Platform-conditional: notification-shade observation and tab handling are Android-only \u2014 gap iOS notification promises."
|
|
335
|
-
- "Assertions: 'Assert/Verify/Confirm \u2026'. Extractions: 'Store \u2026 as name' \u2014 vague verbs (read/tell/report) do NOT persist values."
|
|
336
|
-
- "Baselines/deltas are EXTRACTIONS on both surfaces: 'store the result count as baseline_count' BEFORE the action; compare after. Never an abstract 'capture the state'."
|
|
337
|
-
variables:
|
|
338
|
-
- "Credentials and environment values are {{name}} variables; concrete domain values from the source stay literal."
|
|
339
|
-
- "A value no evidence supplies (start URL, test account, seed data) is ASKED for \u2014 actual value or a variable name \u2014 never invented."
|
|
340
|
-
pitfalls:
|
|
341
|
-
- "A WEB test without a starting URL cannot run \u2014 its first step names it."
|
|
342
|
-
- "A MOBILE test's first step BEGINS with its marker, then launches the app ('[mobile: emulator] Launch the <App> app; from its entry screen, \u2026') \u2014 never a URL. App data PERSISTS between runs (no reset): never assume first-install or signed-out state. The minted file needs target:/app: frontmatter attached before it can run on a device."
|
|
343
|
-
- "'Test the checkout flow' has no end state \u2014 state what done looks like."
|
|
344
|
-
- "Do not cram many unrelated operations into one step; do not reference data outside the step."
|
|
345
|
-
`;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 Le(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!==z.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(z.SCENARIO))se(i,u)&&i.edgesFrom(u).some(y=>y.type===X.BELONGS_TO&&y.dst===r)&&(k.push(fe(i,u,f)),T.add(u));let x=[];for(let{cid:u,content:f}of i.byLabel(z.AC)){if(!se(i,u))continue;let y=i.edgesFrom(u).find($=>$.type===X.SCOPED_TO);!y||y.dst!==r&&!T.has(y.dst)||x.push({...fe(i,u,f),scoped_to:y.dst})}let b=Array.isArray(w.content.criteria)?w.content.criteria:[],h=[w.content.title,w.content.description,...b].filter(Boolean).join(`
|
|
346
|
-
`),M=(await rt(i,h,z.SCENARIO,10,n.embedSearch)).filter(u=>!T.has(u.cid)),j=[],S=new Set,P=[],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)!==z.USECASE)continue;let y=i.tipOf(f.dst);N.has(y)||(N.add(y),P.push(y),c.push(y))}}for(let u of P){let f=`depends_on ${i.nameOf.get(u)??u.slice(0,19)}`;for(let{cid:y}of i.byLabel(z.SCENARIO))if(se(i,y)&&i.edgesFrom(y).some($=>$.type===X.BELONGS_TO&&$.dst===u))for(let $ of i.edgesInto(y)){if($.type!==X.AUTOMATES||!se(i,$.src)||S.has($.src))continue;S.add($.src);let V=String(i.getNode($.src)?.content.title??"");j.push({cid:$.src,logical_id:i.nameOf.get($.src)??null,title:V,via:f})}}for(let u of await rt(i,h,z.TEST,5,n.embedSearch)){let{cid:f,title:y}=u;S.has(f)||(S.add(f),j.push({cid:f,logical_id:i.nameOf.get(f)??null,title:y??"",via:"similar"}))}let v=i.byLabel(z.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:M},import_candidates:j,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 bt,resolve as yt}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(b=>b.temp_ref===n.automates)??(()=>{let b=t.resolve(n.automates),h=b?t.getNode(b.tip)?.content:void 0;return h?{title:String(h.title??""),intent:String(h.intent??""),technique_notes:String(h.technique_notes??"")}:{}})(),r=[...(e.acs??[]).map(b=>({ref:b.temp_ref,text:b.text})),...n.verifies.filter(b=>!(e.acs??[]).some(h=>h.temp_ref===b)).map(b=>{let h=t.resolve(b);return{ref:b,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(b=>b.kind==="profile_family"&&(b.target===n.temp_ref||b.target===n.automates))?.rationale??"unspecified",anchor:T.verified_against,expected_how:e.judgements?.find(b=>b.kind==="expected_how"&&b.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=ze(k,t.ucRef));let T=k.resolve(t.ucRef),x=T?String(k.getNode(T.tip)?.content.risk??"med"):"med",b=[],h=new Set([t.ucRef,T?.cid,T?.tip].filter(Boolean)),M=a=>{if(h.has(a))return!0;let p=k.resolve(a);return p!=null&&(h.has(p.cid)||h.has(p.tip))},j;try{j={...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&&!M(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,b))}:{},...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"),P=(a,p={})=>({contextDir:t.contextDir,graph:a,ucRef:t.ucRef,sections:j,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 E=new Map((j.tests??[]).map(A=>[A.temp_ref,A])),R=new Map,K=(A,F,O)=>{let G=E.get(A);if(!G?.test_md_blob)return null;let W=R.get(A);if(W!==void 0)return W;if(O.has(A))return G.test_md_blob;O.add(A);let Q=new Map;for(let q of G.reuses??[]){K(q,F,O);let J=F(q);J!==null&&J!==q&&Q.set(q,J)}let Y=G.verifies.map(F).filter(q=>q!==null),H=ye(we(G.test_md_blob,Q),Y);return R.set(A,H),H};return(A,F)=>{if(!A.test_md_blob)return null;let O=K(A.temp_ref,F,new Set)??A.test_md_blob;if(O===A.test_md_blob)return null;let G=W=>{for(let Q of E.keys())if(F(Q)===W){let Y=K(Q,F,new Set);if(Y!==null)return{body:Y,cycleKey:`batch:${W}`,next:G}}return ce(k)(W)};return{test_md_blob:O,definitionId:ae(oe(O,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}:{}},E=>{let R=ue(P(E.graph,{eventIds:E.eventIds("design",1),sid:E.sid,...a&&!t.generationStamped?{generationTicket:a}:{}}));return R.errors!==null?{errors:R.errors}:{result:R,record:R.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(R=>({code:"DRIFTED",detail:R.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(P(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 b){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=bt(yt(t.contextDir)),E=Ve({graph:f,cids:a,cwd:p});E.wrote.length>0&&t.note(`\u2692 wrote ${E.wrote.map(R=>_t(R.path)).join(" \xB7 ")}`);for(let R of E.refused)t.note(`warning: could not create the test file for ${R.id} \u2014 ${R.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 y=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),$=y.event.parity?.missing??[],V=!!r.tests?.length&&$.length===0;return{proposal:c,error:null,receipt:y,...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 Et(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 Es(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 be||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(`
|
|
347
|
-
|
|
348
|
-
`),e.initialMessage].filter(Boolean).join(`
|
|
349
|
-
|
|
350
|
-
`)};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-ATH337WF.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=We(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-IIHKNEYF.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 b={contextDir:e.contextDir,resolveAlias:s=>Ie(s,{env:process.env,auth:e.auth}),embed:(s,d)=>Oe(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:b});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-ATH337WF.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 M=e.now?.()??new Date,j=`${M.toISOString().replace(/[-:]/g,"").slice(0,15)}-${$t(2).toString("hex")}`,S=t.mode??"interactive",P=S==="interactive"&&!!e.chat&&!e.nested,c=g?{...g.spawnConfig,mode:S}:lt(h,{session_id:t.resume??`design-${j}`,mode:S,ucCid:h.usecase.cid,readBasis:n.latestHash,topology:Me("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-${j}.log`);St(mt(u),{recursive:!0}),P||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})+`
|
|
351
|
-
`)}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-XWF6KDQH.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(`
|
|
352
|
-
|
|
353
|
-
`)}}}catch{}t.message&&(e={...e,initialMessage:[e.initialMessage,t.message].filter(Boolean).join(`
|
|
354
|
-
|
|
355
|
-
`)})}let y=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=Be({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 L=await m({id:`attach-${l.state.sid}-${(l.state.ingest_registry??[]).length}`,ref:C,purpose:null});return L.ok?(_.deferBatch({source_id:L.result.source_id,cid:L.result.cid}),{ok:!0}):{ok:!1,error:L.error.message}}catch(L){return{ok:!1,error:L instanceof Error?L.message:String(L)}}})}return{ask:async _=>{let C=await o(_);if(Array.isArray(C)){let L=C.filter(B=>{if(B.free_text==null||B.free_text.trim()==="")return!1;let ie=_.find(gt=>gt.id===B.id);return B.selected_index!=null&&ie?.options[B.selected_index]?.input===!0}).map(B=>B.free_text.trim());if(L.length>0){let B=l.state.ingest_registry;for(let ie of L)B=de(B,ie,s.now?.()??new Date);l.save({ingest_registry:B})}}return C},ingest:m}};e.nested||e.chat?.attachOnCommitted?.(s=>{$.current=s});let E="";if(e.chat&&!t.plan&&!e.nested){let s=Pe({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"?(E=s.sourceId,e.chat.attachConversationSource?.(E),$.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 R=U(e.contextDir),K;if(!t.plan){let s=Ce(R,r);if(T&&s!==null&&s.live){let d=R.resolve(r);K={uc_root:Re(R,d.cid),next_gen:s.gen,expected_prev_gen:s.gen}}else{let d=Te(R,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),F=null,O=()=>{try{F?.release()}catch{}};if(!t.plan)try{F=A.acquire([Se(R,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:[]})}},W=!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;W&&!i&&(Y=!0,i=re(e.contextDir,{sid:c.session_id,mode:"agent",created_at:M.toISOString(),expires_at:new Date(M.getTime()+1440*60*1e3).toISOString(),agent_state:{schema:2,items:[],provider_state:""},pending:{questions:[],proposals:[]},read_basis:Q(),assumed:[],corpus_cursor:{remaining:[]},conv_source:E,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(W&&i){let{resume:s,...d}=c;Ee(e.contextDir,c.session_id,{schema:$e,kind:"base",sid:c.session_id,verb:"design",mode:S,created_at:M.toISOString(),run_config:d,conv_source:E||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=Fe({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?Et(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=>{y=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(),O(),1;if(D.paused){let s=i;s||(s=re(e.contextDir,{sid:c.session_id,mode:"agent",created_at:M.toISOString(),expires_at:new Date(M.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:E,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}),E&&s.state.conv_source!==E&&s.save({conv_source:E});let o=e.chat?.drainHeldReceipts?.()??[];(o.length>0||(s.state.held_receipts?.length??0)>0)&&s.save({held_receipts:o}),y!==null&&s.save({force_scope:y}),je(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(P||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}),P){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 O(),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),P||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}),P){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(),O(),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(),O(),1;let ee=0;if(D.proposal==null)try{let{readRecords:s}=await import("./records-XWF6KDQH.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(P){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),O(),0}export{Es as a};
|
package/dist/chunk-E5Q5CDOX.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a}from"./chunk-RZ4F3BHX.js";var c=class{config;buffer=[];stepBuffer=new Map;flushTimer=null;currentRunIndex=null;stopped=!1;_droppedBatches=0;_droppedEntries=0;constructor(t){this.config=t}start(){if(this.flushTimer)return;let t=this.config.flushIntervalMs??5e3;this.flushTimer=setInterval(()=>{this.flush().catch(()=>{})},t),this.flushTimer.unref&&this.flushTimer.unref()}setRunIndex(t){this.currentRunIndex=t}log(t,e,s,n={}){if(this.stopped)return;let i=this.buildEntry(t,e,s,n);this.buffer.push(i)}logStep(t,e,s,n={}){if(this.stopped)return;let i=this.buildEntry("debug",e,s,n);i.run_index=t,this.stepBuffer.has(t)||this.stepBuffer.set(t,[]),this.stepBuffer.get(t).push(i)}escalate(t){let e=this.stepBuffer.get(t);e&&e.length>0&&this.buffer.push(...e),this.stepBuffer.delete(t)}discardSteps(t){this.stepBuffer.delete(t)}async flush(){if(this.buffer.length===0)return;let t=this.buffer.splice(0),e=null;try{e=await this.config.getToken()}catch{this.buffer.unshift(...t);return}let s={"Content-Type":"application/json"};e&&(s.Authorization=`Bearer ${e}`);let n=JSON.stringify(t);for(let i=0;i<3;i++){try{let o=new AbortController,u=setTimeout(()=>o.abort(),1e4),f=await a(this.config.proxyUrl,{method:"POST",headers:s,body:n,signal:o.signal});if(clearTimeout(u),f.ok)return}catch{}i<2&&await new Promise(o=>setTimeout(o,1e3*Math.pow(2,i)))}this._droppedBatches++,this._droppedEntries+=t.length}async flushOnce(t){if(this.buffer.length===0)return"empty";let e=this.buffer.splice(0),s=Date.now()+t,n=!1,i,o=null;try{o=await Promise.race([this.config.getToken(),new Promise(h=>{i=setTimeout(()=>{n=!0,h(null)},t),i.unref&&i.unref()})])}catch{o=null}finally{i&&clearTimeout(i)}let u=s-Date.now();if(n||u<=0)return this.buffer.unshift(...e),"timeout";let f={"Content-Type":"application/json"};o&&(f.Authorization=`Bearer ${o}`);try{let h=new AbortController,l=setTimeout(()=>h.abort(),u);l.unref&&l.unref();let d=await a(this.config.proxyUrl,{method:"POST",headers:f,body:JSON.stringify(e),signal:h.signal});return clearTimeout(l),d.ok?"sent":(this.buffer.unshift(...e),"failed")}catch{return this.buffer.unshift(...e),Date.now()>=s?"timeout":"failed"}}drainBuffer(){return this.buffer.splice(0)}get droppedBatches(){return this._droppedBatches}get droppedEntries(){return this._droppedEntries}async shutdown(){this._droppedBatches>0&&this.log("warn","LOG_DROPS",`Dropped ${this._droppedEntries} entries in ${this._droppedBatches} batches`,{dropped_batches:this._droppedBatches,dropped_entries:this._droppedEntries}),this.stopped=!0,this.flushTimer&&(clearInterval(this.flushTimer),this.flushTimer=null),await this.flush()}shutdownSync(){this.stopped=!0,this.flushTimer&&(clearInterval(this.flushTimer),this.flushTimer=null)}get bufferSize(){return this.buffer.length}stepBufferSize(t){return this.stepBuffer.get(t)?.length??0}buildEntry(t,e,s,n){return{hostname:"kane-cli",service:"kane-cli",ddsource:"kane-cli",ddtags:`version:${this.config.device.cli_version}`,level:t,event:e,message:s,session_id:this.config.sessionId,run_index:e.startsWith("tcg_")?null:this.currentRunIndex,identity:this.config.identity,device:this.config.device,context:n,timestamp:new Date().toISOString()}}};function b(r=process.env){try{let t=r.KANE_CLI_USER_AGENT;return t&&t.trim()?p(t):r.CLAUDECODE==="1"||r.CLAUDE_CODE_ENTRYPOINT?"claude-code":r.CURSOR_TRACE_ID||r.TERM_PROGRAM==="cursor"?"cursor":r.TERM_PROGRAM==="vscode"||r.VSCODE_PID?"vscode":r.CI==="true"||r.GITHUB_ACTIONS==="true"||r.GITLAB_CI==="true"||r.CIRCLECI==="true"||r.BUILDKITE==="true"?"ci":"unknown"}catch{return"unknown"}}function p(r){return r.toLowerCase().replace(/[^a-z0-9_-]/g,"-").slice(0,40)}export{c as a,b};
|
package/dist/chunk-FVKLNQ4T.js
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as B,b as H,d as ie}from"./chunk-IRPAWAK7.js";import{a as j,b as N}from"./chunk-3YKNJIVB.js";import{a as C,b as G,e as M,f as te,m as re,n as ne}from"./chunk-Q3S5EKX5.js";import{a as oe,b as se}from"./chunk-2YQ6TW77.js";import{a as L}from"./chunk-X7R2JWOJ.js";import{a as ee}from"./chunk-E5C3HUIY.js";import{a as q}from"./chunk-HAGJA7KG.js";import{a as Z}from"./chunk-DPUV6OSP.js";import{a as A}from"./chunk-RZ4F3BHX.js";import{a as O}from"./chunk-76ILJPZF.js";import{x as h}from"./chunk-N2N5T5JN.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
|
-
Switch profiles with \`kane-cli profiles switch\` to act on it.
|
|
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
|
-
`),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
|
-
`)}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-CPGKD3DD.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
|
-
`),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
|
-
`),0}async function Qe(e,r,s){let n=z(e);if(!P(n))return process.stderr.write(`error: file not found: ${n}
|
|
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.
|
|
11
|
-
This will remove '${n}' and '${G(n)}/'.
|
|
12
|
-
`),2;let i=G(n);if(P(i))try{he(i,{recursive:!0,force:!0})}catch(c){return process.stderr.write(`error: failed to remove ${i}: ${c.message}
|
|
13
|
-
`),2}try{He(n)}catch(c){return process.stderr.write(`error: failed to remove ${n}: ${c.message}
|
|
14
|
-
`),2}return process.stderr.write(`removed ${n} and ${i}/
|
|
15
|
-
`),0}var S=class extends Error{kind;constructor(r,s){super(s),this.name="ExportError",this.kind=r}};async function Ht(e,r){let{codeDir:s}=await ke(e,r);return{codeDir:s}}async function ke(e,r){let s=$(e);if(!s?.testcase_id)throw new S("not-synced","this test has not been synced to TMS \u2014 run `kane-cli testmd run` first.");let n=new L().load(),o=r.language??n.code_export?.language;if(!o)throw new S("no-language","--language not provided and no default in tui-config.");let t=r.output??te(e,"playwright",o),i=P(t);if(i&&!r.force){let a=!1;try{let{readdirSync:g}=await import("fs");a=g(t).length>0}catch{}if(a)return{kind:"reused",codeDir:t}}i&&r.force&&he(t,{recursive:!0,force:!0});let c=new O,f=r.env??c.getDefaultEnv()??"prod",l;try{l=await N({creds:c,env:f,log:()=>{}})}catch(a){throw a instanceof j?new S("auth-fail","not authenticated. Run `kane-cli login` first."):a}if(!l.basicAuth)throw new S("auth-incomplete","TMS basic auth could not be resolved. Run `kane-cli login` again.");try{let a=q(f);await ge({tmsBaseUrl:a.tmsBaseUrl,testcaseId:s.testcase_id,auth:l.basicAuth,language:o,framework:"playwright",skipValidation:n.code_export?.skip_validation??!0,outDir:t,log:()=>{}})}catch(a){throw new S("export-fail",`code export failed: ${a.message}`)}return{kind:"exported",codeDir:t}}async function Ze(e,r,s){let n=z(e);if(!P(n))return process.stderr.write(`error: file not found: ${n}
|
|
16
|
-
`),2;let o=$(n),t=J(o,s);if(t!==null)return t;try{let i=await ke(n,r);return i.kind==="reused"?process.stderr.write(`reusing existing export at ${i.codeDir}
|
|
17
|
-
`):process.stderr.write(`exported to ${i.codeDir}
|
|
18
|
-
`),0}catch(i){if(i instanceof S)return i.kind==="not-synced"?(process.stderr.write("error: this test has not been synced to TMS \u2014 run `kane-cli testmd run` first.\n"),2):i.kind==="no-language"?(process.stderr.write(`error: --language not provided and no default in tui-config.
|
|
19
|
-
`),2):i.kind==="auth-fail"?(process.stderr.write("error: not authenticated. Run `kane-cli login` first.\n"),2):i.kind==="auth-incomplete"?(process.stderr.write("error: TMS basic auth could not be resolved. Run `kane-cli login` again.\n"),2):(process.stderr.write(`error: ${i.message}
|
|
20
|
-
`),2);throw i}}async function Vt(e={}){let r=!!process.stdin.isTTY,s=new O,n=new L;await H({isInteractive:r,creds:s,config:n});let o=e.env??s.getDefaultEnv()??"prod";try{let t=await N({creds:s,env:o,usernameFlag:e.username,accessKeyFlag:e.accessKey,log:()=>{}});return t.resolvedCreds?.org_id===void 0||!t.basicAuth?(process.stderr.write("error: could not resolve TMS credentials. Run `kane-cli login` again.\n"),{ok:!1,code:2}):{ok:!0,orgId:String(t.resolvedCreds.org_id),basicAuth:t.basicAuth,controllerBaseUrl:q(o).controllerBaseUrl}}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 Yt(e,r,s=ie){if(!P(e))return process.stderr.write(`error: file not found: ${e}
|
|
21
|
-
`),2;if(!e.endsWith("_test.md"))return process.stderr.write(`error: not a *_test.md file: ${e}
|
|
22
|
-
`),2;let n=$(e),o=J(n,r.orgId);if(o!==null)return o;if(!n?.commit_id||!n?.test_id)return process.stderr.write(`error: ${e} is not authored \u2014 run \`kane-cli testmd run ${e}\` first.
|
|
23
|
-
`),2;let t=await s({sourcePath:e,testId:n.test_id,sessionId:n.commit_id,commitId:n.commit_id,controller:new Z(r.controllerBaseUrl,{username:r.basicAuth.username,accessKey:r.basicAuth.access_key})}),i={type:"test_md_bundle_sync",status:t.ok?"ok":"failed",commit_id:n.commit_id,...t.ok?{bytes:t.bytes}:{stage:t.stage}};return process.stdout.write(JSON.stringify(i)+`
|
|
24
|
-
`),t.ok?(process.stderr.write(`synced: ${n.commit_id}-testmd.zip (${t.bytes} bytes)
|
|
25
|
-
`),0):(process.stderr.write(`error: bundle sync failed at ${t.stage}: ${t.error}
|
|
26
|
-
`),t.stage==="collect"?2:1)}export{U as a,Re as b,me as c,pe as d,$ as e,_e as f,J as g,Xt as h,qt as i,ze as j,Gt as k,Qe as l,S as m,Ht as n,Ze as o,Vt as p,Yt as q};
|
package/dist/chunk-GDB2V6QA.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{b as y,c as g}from"./chunk-VZ7KXRXB.js";import{b as S}from"./chunk-IAHKTEET.js";var w=new Set(["delta","state-transition"]),A=/^capture baseline:/i;function E(e){return typeof e=="string"?e:e.text}function $(e){return typeof e=="object"&&e.baseline===!0||A.test(E(e).trim())}function K(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&"derived"in e}function C(e,r){if(e.check_prose)return e.check_prose;let n=r.find(i=>i.ref===e.check.verified_against),t=n?.text?` \u2014 the stated promise: ${n.text}`:"",s=String(e.check.operand??e.check.within??e.check.metric??"");return e.check.kind==="forbidden-presence"?`Confirm '${s}' does NOT appear (forbidden-presence)${t}`:`Confirm ${e.check.kind} check: ${s} (${e.check.operator})${t}`}var T=/^## Step \d+ — assert\s*$/;function Q(e,r){if(r.length===0)return e;let n=e.split(`
|
|
3
|
-
`);for(let t=n.length-1;t>=0;t--){if(/^## Step \d+ — assert @verifies /.test(n[t]))return e;if(T.test(n[t]))return n[t]=`${n[t].trimEnd()} @verifies ${r.join(", ")}`,n.join(`
|
|
4
|
-
`)}return e}function U(e,r){return r.size===0?e:e.split(`
|
|
5
|
-
`).map(n=>{let t=n.match(/^@import\s+(\S+)\s*$/);if(t&&r.has(t[1]))return`@import ${r.get(t[1])}`;let s=n.match(/^## Import: (\S+)\s*$/);return s&&r.has(s[1])?`## Import: ${r.get(s[1])}`:n}).join(`
|
|
6
|
-
`)}function X(e,r,n){if(w.has(e.check.kind)&&!e.steps.some($))throw new Error(`emitTestMd: check kind '${e.check.kind}' needs a baseline-capture step before the action (a step starting 'capture baseline: <metric>' or { baseline: true }) \u2014 the validator should have caught this`);let t=[`# ${e.title}`,""];r.intent&&t.push(`> ${r.intent}`,"");for(let u of e.reuses??[])t.push(`## Import: ${u}`,"",`@import ${u}`,"");let s=[],i=0;for(let u of e.steps){i++;let a=E(u).trim();t.push(`## Step ${i}`,"",a,""),s.push({step:i,objective:a,...$(u)?{baseline:!0}:{}})}i++;let o=C(e,n),d=e.check.expected_mode??(K(e.check.operand)?"runtime-derived":"inferred");t.push(`## Step ${i} \u2014 assert`,"",o,""),s.push({step:i,objective:o,check:{kind:e.check.kind,operator:e.check.operator,...e.check.operand!==void 0?{operand:e.check.operand}:{},...w.has(e.check.kind)?{baseline:e.check.baseline??null}:{},...e.check.within!==void 0?{within:e.check.within}:{},...e.check.metric!==void 0?{metric:e.check.metric}:{},...e.check.threshold!==void 0?{threshold:e.check.threshold}:{},...e.check.unit!==void 0?{unit:e.check.unit}:{},verified_against:e.check.verified_against,expected_mode:d,review_required:e.check.review_required??d==="runtime-derived"}});let l=g({title:e.title,...r.title?{scenario:r.title}:{},objectives:s},{sortKeys:!0,lineWidth:-1});return{test_md:t.join(`
|
|
7
|
-
`),objectives_yaml:l}}function Y(e){let n=e.replace(/\r\n/g,`
|
|
8
|
-
`).split(`
|
|
9
|
-
`).map(i=>i.replace(/[ \t]+$/,""));if(n[0]?.trim()==="---"){let i=n.slice(1).findIndex(o=>o.trim()==="---");if(i>=0){let o=y(n.slice(1,i+1).join(`
|
|
10
|
-
`))??{},d="assurance"in o;delete o.assurance,Object.keys(o).length===0&&d?n=n.slice(i+2):n=["---",...g(o,{sortKeys:!0,lineWidth:-1}).trimEnd().split(`
|
|
11
|
-
`),"---",...n.slice(i+2)]}}let t=[];for(let i of n)i===""&&t[t.length-1]===""||t.push(i);for(;t[0]==="";)t.shift();for(;t[t.length-1]==="";)t.pop();let s=t.join(`
|
|
12
|
-
`)+`
|
|
13
|
-
`;return"sha256:"+S(Buffer.from("assurance.testdef\0"+s,"utf8"))}import{existsSync as B,readFileSync as N}from"fs";import{dirname as M,isAbsolute as O,resolve as W}from"path";var I=/^@import\s+(\S+)\s*$/;function D(e){let r=new Set;for(let n=0;n<e.length;n++)if(I.test(e[n].trim()))for(let t=n-1;t>=0;t--){let s=e[t].trim();if(s!==""){s==="```"&&r.add(n);break}}return r}function G(e,r,n=new Set,t=0){if(t>10)return e;let s=e.split(`
|
|
14
|
-
`),i=D(s);return s.map((o,d)=>{let l=I.exec(o.trim());if(!l||i.has(d))return o;let u=r(l[1]);if(!u||n.has(u.cycleKey))return o;let a=new Set(n);return a.add(u.cycleKey),G(u.body.trimEnd(),u.next,a,t+1)}).join(`
|
|
15
|
-
`)}function q(e){return r=>{let n=e.resolve(r);if(!n)return null;let t=e.getNode(n.tip)?.content.test_md_blob;return t?{body:t,cycleKey:n.tip,next:q(e)}:null}}function z(e,r){return n=>{let t=O(n)?n:W(e,n);if(!B(t))return null;let s=N(t,"utf8"),i=H(s);return!i||!r.resolve(i)?null:{body:P(s),cycleKey:t,next:z(M(t),r)}}}function j(e,r){let n=-1;for(let c=1;c<r;c++)if(/^assurance\s*:\s*$/.test(e[c])){n=c;break}if(n<0)return null;let t=r;for(let c=n+1;c<r;c++)if(/^[^\s#]/.test(e[c])){t=c;break}let s,i=n,o,d,l,u,a,f=!1;for(let c=n+1;c<t;c++){let p=e[c].endsWith("\r")?e[c].slice(0,-1):e[c];if(p.trim()===""||/^\s*#/.test(p))continue;i=c;let k=/^(\s+)([^\s:#][^:]*):\s*(.*)$/.exec(p);if(!k){/^\s*["']?base["']?\s*:/.test(p)&&(f=!0);continue}let[,b,R,L]=k,m=R.trimEnd();s===void 0&&(s=b);let h=b===s,x=/^([^#\s]\S*)?\s*(#.*)?$/.exec(L.trim()),v=x?.[1];m==="id"&&h&&o===void 0&&(o=c,d=v),m==="base"&&(h&&l===void 0?(l=c,u=v,a=x?.[2]):h||(f=!0)),m!=="base"&&/^["']base["']$/.test(m)&&(f=!0)}return{start:n,lastChild:i,childIndent:s,idLine:o,id:d,baseLine:l,base:u,baseComment:a,strayBase:f}}function F(e){let r=_(e);if(!r)return null;let n=e.split(`
|
|
16
|
-
`),t=j(n,r.endLine);return t?.id?{id:t.id,...t.base!==void 0?{base:t.base}:{}}:null}function H(e){return F(e)?.id??null}function _(e){let r=e.split(`
|
|
17
|
-
`);if(r[0]?.trim()!=="---")return null;for(let n=1;n<r.length;n++)if(r[n].trim()==="---")return{text:r.slice(1,n).join(`
|
|
18
|
-
`),endLine:n};return null}function P(e){let r=_(e);if(!r)return e;let n=e.split(`
|
|
19
|
-
`),t=j(n,r.endLine),s=[],i=!1;for(let d=1;d<r.endLine;d++){let l=n[d];if(t&&d>=t.start&&d<=t.lastChild){i=!1;continue}if(/^assurance\s*:\s*\{/.test(l)){i=!0;continue}i&&/^\s+\S/.test(l)||(i=!1,s.push(l))}let o=n.slice(r.endLine+1).join(`
|
|
20
|
-
`);return s.every(d=>d.trim()==="")?o:["---",...s,"---",o].join(`
|
|
21
|
-
`)}export{K as a,Q as b,U as c,X as d,Y as e,I as f,D as g,G as h,q as i,z as j,j as k,F as l,P as m};
|
package/dist/chunk-LWZ7EIXX.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as Ee}from"./chunk-Q4CTSXDM.js";import{a as me,b as he,d as _e,e as be}from"./chunk-BB2W35TW.js";import{a as le}from"./chunk-DNNZ353O.js";import{B as pe,c as ae,h as ue,o as ge}from"./chunk-AJXOJF2X.js";import{a as fe}from"./chunk-B2KXIFZD.js";import{a as re,b as K}from"./chunk-CUM23TLF.js";import{g as ce,j as de}from"./chunk-HLXOYLZV.js";import{d as g,e as p,f as se,g as ie,h as oe}from"./chunk-WXHQYYD5.js";var x=o=>({record:null,errors:o,minted:{},logicalIds:{},superseded:[],warnings:[],finalizedTests:{}});function w(o){return o.toLowerCase().trim().replace(/\s+/g," ")}function Oe(o,A){let t=o.resolve(A);if(!t||o.nodeLabel.get(t.cid)!==g.USECASE||t.superseded)return[];let h=new Set;for(let{cid:f}of o.byLabel(g.SCENARIO))if(!o.superseded.has(f)&&o.edgesFrom(f).some(T=>T.type===p.BELONGS_TO&&o.tipOf(T.dst)===t.cid)){h.add(f);for(let T of o.edgesInto(f))T.type!==p.AUTOMATES||o.superseded.has(T.src)||h.add(T.src)}return[...h]}function Fe(o){let{contextDir:A,graph:t,sections:h,by:f}=o,T=o.engine??"design@1",J=ce(A);if(t.latestHash!==J)return x([{code:"STALE_BASIS",detail:`graph opened at ${String(t.latestHash)} but chain head is ${String(J)} \u2014 re-open and retry`}]);let L=t.resolve(o.ucRef);if(!L||t.nodeLabel.get(L.cid)!==g.USECASE||L.superseded)return x([{code:"UNKNOWN_UC",detail:`${o.ucRef} is not a live use-case`}]);let E=L.cid,_=[],W=/^design@(\d+)$/.exec(o.templateVersion??""),Se=W!==null&&Number.parseInt(W[1],10)>=3,Q=new Map,$e=(e,s)=>{let n=Q.get(e.source_cid);if(n===void 0){let r=le(o.contextDir,t,e.source_cid);n=r?Ee(r.toString("utf8")):null,Q.set(e.source_cid,n)}if(n===null)return _.push({code:"CITE_UNVERIFIED",detail:`${s}: source ${e.source_id} (${e.source_cid.slice(0,19)}) has no citable text to verify against`}),!1;let d=ae(t.mediaOf(e.source_cid),e,n);if(d.length>0){for(let r of d)_.push({code:"CITE_UNVERIFIED",detail:`${s}: ${r.code}: ${r.detail}`});return!1}return!0},k=[],F=[],v=[],U=[],P=[],S={},D={},j={},R=[],q=[],X=new Set,M=[],B=new Set,I=new Set,V=[];{let e=o.forceScope??(o.force?Oe(t,o.ucRef):[]),s=new Set;o.sections.scenarios?.length&&s.add(g.SCENARIO),o.sections.tests?.length&&s.add(g.TEST);for(let n of e)t.superseded.has(n)||(s.has(t.nodeLabel.get(n)??"")?I.add(n):V.push(n))}let N=new Set,z=e=>!t.superseded.has(e)&&(!I.has(e)||N.has(e)),O=(e,s,n)=>{if(S[e])return S[e];let d=t.resolve(e),r=d?z(d.cid)?d.cid:t.tipOf(d.cid):null;return!d||!r||!z(r)?(_.push({code:"UNKNOWN_REF",detail:`${s}: '${e}' is neither in this payload nor a live committed node`}),null):n&&t.nodeLabel.get(r)!==n?(_.push({code:"ILLEGAL_EDGE",detail:`${s}: '${e}' is a ${t.nodeLabel.get(r)}, expected ${n}`}),null):r},ye=(e,s,n,d)=>{if(t.nameOf.has(s)){D[d]=t.nameOf.get(s);return}let r=pe(e,m=>X.has(m),t.names.keys());r!==null&&(X.add(r),U.push({cid:s,slug:r,by:f}),D[d]=r)},G=(e,s,n,d)=>{for(let m of se(e,n))_.push({code:m.code,detail:`${s}: ${m.detail}`});let r=re(e,n);return t.hasNode(r)&&!t.superseded.has(r)?(I.has(r)&&N.add(r),S[s]=r,r):(k.push({cid:r,label:e,content:n}),S[s]=r,ye(e,r,d,s),r)},y=(e,s,n,d,r)=>{let m=K(e,s,n,d);if(t.edgesFrom(s).some(i=>i.ecid===m&&!t.superseded.has(i.ecid))){e===p.AUTOMATES&&B.add(n);return}if(t.superseded.has(m)){_.push({code:"EDGE_RETRACTED",detail:`${r}: this ${e} edge was retracted (${m}) \u2014 retraction is terminal for commits. Add a NEW relationship (different endpoint or props), redesign, or revert the retracting record`});return}let C=t.nodeLabel.get(s)??k.find(i=>i.cid===s)?.label??"(unknown)",u=t.nodeLabel.get(n)??k.find(i=>i.cid===n)?.label??"(unknown)";for(let i of oe(e,C,u,d))_.push({code:i.code,detail:`${r}: ${i.detail}`});let l=ue(t,e,s,n,M);if(l){_.push({code:l.code,detail:`${r}: ${l.detail}`});return}if(e===p.BELONGS_TO||e===p.SCOPED_TO){let i=fe(t,{type:e,src:s,dst:n},{pending:M,retracted:new Set(v.flatMap(c=>c.kind==="edge"?[c.ecid]:[])),freed:new Set([...I].filter(c=>!N.has(c)))},r);if(i){_.push(i);return}}if(e===p.AUTOMATES){if(B.has(n)){_.push({code:"CARDINALITY_VIOLATION",detail:`${r}: two automates onto ${n} in one record (strict 1:1)`});return}if(B.add(n),!I.has(n)||N.has(n)){let i=b=>I.has(b)&&!N.has(b);if(t.edgesFrom(s).some(b=>b.type===p.AUTOMATES&&b.dst!==n&&!t.superseded.has(b.dst)&&!i(b.dst))&&t.hasNode(s)){_.push({code:"CARDINALITY_VIOLATION",detail:`${r}: automates from ${s} already has a live edge \u2014 supersede it first`});return}if(t.edgesInto(n).some(b=>b.type===p.AUTOMATES&&b.src!==s&&!t.superseded.has(b.src)&&!i(b.src))){_.push({code:"CARDINALITY_VIOLATION",detail:`${r}: automates onto ${n} already has a live edge \u2014 strict 1:1, supersede it first`});return}}}F.push({ecid:K(e,s,n,d),type:e,src:s,dst:n,props:d}),M.push({src:s,dst:n,type:e})},H=new Set;for(let e of h.gaps??[]){let s=e.temp_ref??e.ref??"gap",n=e.question;if(!n||typeof n!="object"||!n.header||!Array.isArray(n.options)||n.options.length===0||!Number.isInteger(n.recommended_index)){_.push({code:"GAP_QUESTION_INCOMPLETE",detail:`${s}: design gaps carry a full ranked question object (header/options/recommended_index)`});continue}e.kind==="budget-evicted"&&e.ref&&H.add(e.ref);let d={kind:e.kind,question:n,derived:!0,uc:E,...e.risk?{risk:e.risk}:{},...e.risk_rationale?{risk_rationale:e.risk_rationale}:{},...e.text?{text:e.text}:{},...e.ref?{ref:e.ref}:{}};G(g.GAP,s,d,String(n.header))}let Z=new Map;for(let{cid:e,content:s}of t.byLabel(g.SCENARIO))z(e)&&t.edgesFrom(e).some(n=>n.type===p.BELONGS_TO&&t.tipOf(n.dst)===E)&&Z.set(w(String(s.title??"")),e);for(let e of h.scenarios??[]){let s=Z.get(w(e.title));if(s){_.push({code:"DUPLICATE_SCENARIO",detail:`${e.temp_ref}: '${e.title}' duplicates live scenario ${t.nameOf.get(s)??s} \u2014 exercise/link it instead (reuse before minting)`});continue}let n={title:e.title,intent:e.intent,case_type:e.case_type,derived:!0,...e.technique_notes?{technique_notes:e.technique_notes}:{},...e.description?{description:e.description}:{},...e.parameters?{parameters:e.parameters}:{},...e.tags?{tags:e.tags}:{}};G(g.SCENARIO,e.temp_ref,n,e.title)}for(let e of h.scenarios??[]){let s=S[e.temp_ref];if(s){y(p.BELONGS_TO,s,E,{},e.temp_ref);for(let n of e.depends_on??[]){let d=O(n,`${e.temp_ref}.depends_on`,g.SCENARIO);d&&y(p.DEPENDS_ON,s,d,{},`${e.temp_ref}.depends_on`)}}}for(let e of h.acs??[]){let s={text:e.text,kind:e.kind,risk:e.risk,derived:!0,...e.expected_answer?{expected_answer:e.expected_answer}:{},...e.measurable!==void 0?{measurable:e.measurable}:{}},n=G(g.AC,e.temp_ref,s,e.text);if(!n)continue;let d=e.scope?.type==="scenario"&&e.scope.ref?O(e.scope.ref,`${e.temp_ref}.scope`,g.SCENARIO):E;d&&!t.edgesFrom(n).some(r=>r.type===p.SCOPED_TO&&!t.superseded.has(r.ecid))&&y(p.SCOPED_TO,n,d,{},`${e.temp_ref}.scope`);for(let r of e.cites??[]){if(Se&&!$e(r,`${e.temp_ref}.cite`))continue;let m={source_id:r.source_id,source_cid:r.source_cid,anchor:r.anchor,...r.quote?{quote:r.quote}:{}};y(p.DERIVES,r.source_cid,n,m,`${e.temp_ref}.cite`)}}for(let e of h.exercises??[]){let s=O(e.scenario,"exercises.scenario",g.SCENARIO),n=O(e.ac,"exercises.ac",g.AC);s&&n&&y(p.EXERCISES,s,n,{},`exercises ${e.scenario}\u2192${e.ac}`)}let ee=0;for(let e of h.scoped_to_repoints??[]){let s=O(e.ac,"scoped_to_repoints.ac",g.AC),n=O(e.to,"scoped_to_repoints.to");if(!s||!n)continue;let d=t.edgesFrom(s).find(r=>r.type===p.SCOPED_TO&&!t.superseded.has(r.ecid));if(d&&d.dst===n){ee+=1,R.push(`scoped_to_repoints ${e.ac}: already scoped to ${e.to} \u2014 no-op`);continue}d&&v.push({kind:"edge",ecid:d.ecid,reason:`re-scoped to ${e.to} by ${f.id}`,by:f}),y(p.SCOPED_TO,s,n,{},`scoped_to_repoints ${e.ac}`)}let te=new Map;if(o.finalizeTestBody)for(let[e,s]of t.nameOf)te.set(t.tipOf(e),s);let ne=e=>t.nameOf.get(e)??te.get(t.tipOf(e))??null,ve=e=>{let s=S[e];if(s)return D[e]??ne(s);if(t.names.has(e))return t.resolve(e)?e:null;let n=t.resolve(e);return n?ne(t.tipOf(n.cid)):null};for(let e of h.tests??[]){for(let u of e.reuses??[])H.has(u)&&_.push({code:"REUSES_EVICTED",detail:`${e.temp_ref}: reuses '${u}' which was budget-evicted \u2014 drop the edge; the dependent gap names the missing @import`});let s=e.test_md_blob,n=e.definitionId,d=e.objectives_blob;if(o.finalizeTestBody){let u;try{u=o.finalizeTestBody({temp_ref:e.temp_ref,test_md_blob:e.test_md_blob,verifies:e.verifies,reuses:e.reuses??[]},ve)}catch(l){return x([{code:"FINALIZE_BODY",detail:`${e.temp_ref}: ${l instanceof Error?l.message:String(l)}`}])}u&&(s=u.test_md_blob,n=u.definitionId,d=u.objectives_blob??d,j[e.temp_ref]=n)}let r={title:e.title,check:e.check,definitionId:n,derived:!0,...e.config?{config:e.config}:{},...s?{test_md_blob:s}:{},...d?{objectives_blob:d}:{},...e.surface_required!==void 0?{surface_required:e.surface_required}:{}},m=G(g.TEST,e.temp_ref,r,e.title);if(!m)continue;let C=O(e.automates,`${e.temp_ref}.automates`,g.SCENARIO);C&&y(p.AUTOMATES,m,C,{},`${e.temp_ref}.automates`);for(let u of e.verifies){let l=O(u,`${e.temp_ref}.verifies`,g.AC);l&&y(p.VERIFIES,m,l,{},`${e.temp_ref}.verifies`)}for(let u of e.reuses??[]){if(H.has(u))continue;let l=O(u,`${e.temp_ref}.reuses`,g.TEST);l&&y(p.REUSES,m,l,{},`${e.temp_ref}.reuses`)}for(let u of e.verifies){let l=S[u]??t.resolve(u)?.cid;l&&(t.trust.get(l)??"derived")==="derived"&&!k.some(i=>i.cid===l)?R.push(`${e.temp_ref}: verifies ${u} which is still DERIVED (unapproved) \u2014 committed anyway; approve it in chat or via review`):l&&S[u]===l&&(h.acs??[]).some(i=>i.temp_ref===u)&&R.push(`${e.temp_ref}: verifies ${u} minted in this same record (unapproved) \u2014 committed anyway; approve it in chat`)}if(e.verifies.length>1){let u=e.check?.verified_against;R.push(`${e.temp_ref}: verifies ${e.verifies.length} ACs but machine-asserts only 1 (check.verified_against=${u!=null?String(u):"?"}) \u2014 the rest ride prose only`)}}let Y=[];{let e=(i,c)=>`${i??""}\0${w(String(c??""))}`,s=(i,c)=>o.reason?`${o.reason} \u2014 evolve by ${f.id}${c?` (${c})`:""}`:i,n=new Map;for(let i of k){if(i.label!==g.SCENARIO&&i.label!==g.TEST)continue;let c=e(i.label,i.content.title);n.set(c,[...n.get(c)??[],i.cid])}let d=new Map;for(let i of I){if(N.has(i))continue;let c=e(t.nodeLabel.get(i),t.getNode(i)?.content.title);d.set(c,[...d.get(c)??[],i])}for(let[i,c]of d){let a=n.get(i)??[],b=c.length===1&&a.length===1;for(let $ of c)b?(v.push({kind:"node",old:$,new:a[0],reason:s(`--force redesign of ${o.ucRef} by ${f.id} (title-matched successor)`,"title-matched successor"),by:f}),Y.push({old:$,next:a[0]})):v.push({kind:"node",old:$,new:null,reason:s(`--force redesign of ${o.ucRef} by ${f.id}`),by:f}),q.push($)}let r=i=>t.edgesFrom(i).some(c=>c.type!==p.SCOPED_TO?!1:c.dst===E||t.tipOf(c.dst)===E?!0:t.nodeLabel.get(c.dst)===g.SCENARIO&&t.edgesFrom(c.dst).some(a=>a.type===p.BELONGS_TO&&t.tipOf(a.dst)===E)),m=new Map;for(let{cid:i,content:c}of t.byLabel(g.AC)){if(t.superseded.has(i)||!r(i))continue;let a=w(String(c.text??""));m.set(a,[...m.get(a)??[],i])}let C=new Map;for(let i of k){if(i.label!==g.AC)continue;let c=w(String(i.content.text??""));C.set(c,[...C.get(c)??[],i.cid])}for(let[i,c]of m){let a=C.get(i)??[];c.length!==1||a.length!==1||(v.push({kind:"node",old:c[0],new:a[0],reason:s(`AC re-emitted with changed content by ${f.id} (text-matched successor)`,"AC text-matched successor"),by:f}),Y.push({old:c[0],next:a[0]}),q.push(c[0]))}let u=new Set(q),l=new Set;for(let i of v)i.kind==="edge"&&l.add(i.ecid);for(let{old:i,next:c}of Y)for(let a of t.edgesInto(i))ie(a.type)?.pin?.comparesTo!=="dst_tip"||t.superseded.has(a.src)||u.has(a.src)||l.has(a.ecid)||(v.push({kind:"edge",ecid:a.ecid,reason:`re-blessed onto ${c} (redirect successor of ${i}) by ${f.id}`,by:f}),l.add(a.ecid),F.some($=>$.type===a.type&&$.src===a.src&&$.dst===c)||t.edgesFrom(a.src).some($=>$.type===a.type&&$.dst===c))||a.type===p.AUTOMATES&&B.has(c)||y(a.type,a.src,c,a.props,`rebless ${a.type} from ${t.nameOf.get(a.src)??a.src}`)}if(_.length>0)return x(_);if(k.length===0&&F.length===0&&v.length===0&&P.length===0)return Object.keys(S).length>0||ee>0?(R.push("everything in this phase is already current \u2014 nothing re-committed"),{record:null,errors:null,minted:S,logicalIds:D,superseded:[],warnings:R,finalizedTests:j,...o.force||o.forceScope?{forceScopeRemaining:V}:{}}):x([{code:"EMPTY_DESIGN",detail:"finalize_design produced nothing to commit"}]);if(o.generationTicket){let e=_e(t,o.generationTicket);if(e!==null)return x([e])}return{record:de(A,{ts:new Date().toISOString(),proposal_id:null,nodes:k,edges:F,review:[],supersessions:v,source_head_moves:{},...U.length>0?{names:U}:{},...(()=>{for(let e of h.judgements??[]){let s=e.target?S[e.target]??t.resolve(e.target)?.cid??E:E;P.push({about:s,rationale:`[${e.kind}] ${e.rationale}`,by:f})}return P.length>0?{judgements:P}:{}})(),design_of:{uc_cid:E,engine:T},...o.generationTicket?{design_generation:be(o.generationTicket,E,f)}:{},...o.eventIds&&o.eventIds.length>0?{event_ids:o.eventIds}:o.sid?{event_ids:ge(t,o.sid,"design",1)}:{},...o.sid?{sid:o.sid}:{},...o.phase?{design_phase:{uc_root:me(t,E),generation:o.generationTicket?.next_gen??he(t,o.ucRef)?.gen??1,phase:o.phase,completeness:o.phaseCompleteness??"complete"}}:{}},{expectPrev:t.latestHash}).record,errors:null,minted:S,logicalIds:D,superseded:q,warnings:R,finalizedTests:j,...o.force||o.forceScope?{forceScopeRemaining:V}:{}}}function Pe(o,A){let t=[];for(let h of o){let f=h.design_phase;!f||typeof f!="object"||f.uc_root===A&&(typeof f.phase!="string"||typeof f.generation!="number"||t.push({phase:f.phase,generation:f.generation,seq:h.seq,completeness:f.completeness==="partial"?"partial":"complete"}))}return t.sort((h,f)=>h.seq-f.seq)}export{Oe as a,Fe as b,Pe as c};
|