@testmuai/kane-cli 0.6.7 → 0.6.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ChatSurface-B2QJYKV4.js +8 -0
- package/dist/{ChromeProfilePicker-IW3K43VC.js → ChromeProfilePicker-FSZB4SZR.js} +1 -1
- package/dist/{CliFeedbackPrompt-ZJ4LZGPK.js → CliFeedbackPrompt-WNMDCIHZ.js} +1 -1
- package/dist/{CliUploadProgress-SMPVN7Q6.js → CliUploadProgress-H4265KXU.js} +1 -1
- package/dist/{ConfigView-RTAGKZH4.js → ConfigView-XCUZ44SP.js} +1 -1
- package/dist/EvidenceViewOffer-5TJCRM2T.js +2 -0
- package/dist/{FolderPicker-QUY7LNVZ.js → FolderPicker-S2XVCPYN.js} +1 -1
- package/dist/{HelpView-47J2NZWJ.js → HelpView-OPKRGNNM.js} +1 -1
- package/dist/{InfoBox-G63WZAMH.js → InfoBox-TW2PGJK5.js} +1 -1
- package/dist/{LinksBox-2HIHDT5K.js → LinksBox-66M7XP5Y.js} +1 -1
- package/dist/{ProfilesView-TUXQXPXJ.js → ProfilesView-T2CFQPR5.js} +1 -1
- package/dist/{ProjectPicker-VUABWG2P.js → ProjectPicker-7ALN52CY.js} +1 -1
- package/dist/{SaveSessionPrompt-PNVGNLGO.js → SaveSessionPrompt-HM3F6QML.js} +1 -1
- package/dist/SingleShotApp-YQYS6HTB.js +2 -0
- package/dist/{SummaryBox-36MDDDYQ.js → SummaryBox-BQZEGOIV.js} +1 -1
- package/dist/TestMdRunView-7CL3PM3J.js +2 -0
- package/dist/{WhoamiView-LHU6RGIY.js → WhoamiView-722MBPSG.js} +1 -1
- package/dist/{bind-E67W2DXG.js → bind-HNI5LCNK.js} +2 -2
- package/dist/{bridge-WVFTWHKP.js → bridge-V4FF5QPK.js} +1 -1
- package/dist/{changelog-D4Y5QJIZ.js → changelog-KMYZW5MI.js} +1 -1
- package/dist/chat-committer-MWZ4JQMM.js +2 -0
- package/dist/chat-controller-YX5A7R52.js +2 -0
- package/dist/{chunk-GAD6IBZ6.js → chunk-2Z5MSC23.js} +8 -8
- package/dist/{chunk-UQVKNUYO.js → chunk-345PY4SZ.js} +1 -1
- package/dist/{chunk-KVAALPTA.js → chunk-3YI4QRXF.js} +1 -1
- package/dist/{chunk-NEHF4C6X.js → chunk-4BAL4OGF.js} +1 -1
- package/dist/chunk-4CKZAGBD.js +2 -0
- package/dist/{chunk-7ZMYAXES.js → chunk-4FH2KFRT.js} +1 -1
- package/dist/{chunk-UZWOHCFX.js → chunk-4GXOBABK.js} +1 -1
- package/dist/{chunk-GLVDOR5G.js → chunk-7BCZLDNX.js} +1 -1
- package/dist/{chunk-AASBJJCU.js → chunk-AU7WQ2O5.js} +2 -2
- package/dist/{chunk-3CY3DZDH.js → chunk-CLYG26XV.js} +2 -2
- package/dist/{chunk-TADJIOHV.js → chunk-DKERZJYF.js} +1 -1
- package/dist/{chunk-Z34XRBKQ.js → chunk-DPOES6G3.js} +1 -1
- package/dist/{chunk-EDM6YACR.js → chunk-EASTDHNW.js} +1 -1
- package/dist/{chunk-G5CYSC23.js → chunk-EWLLPUP4.js} +1 -1
- package/dist/{chunk-WFQUDSKY.js → chunk-F42YVALT.js} +1 -1
- package/dist/chunk-FCMLIK7P.js +2 -0
- package/dist/{chunk-RBLZUDMZ.js → chunk-FFHBQK5N.js} +2 -2
- package/dist/{chunk-FYSWQ4K7.js → chunk-FT4G3QGO.js} +1 -1
- package/dist/{chunk-QYTMD6NM.js → chunk-FVM7TWKT.js} +1 -1
- package/dist/{chunk-BBZBXSTP.js → chunk-G6F2BOFT.js} +1 -1
- package/dist/{chunk-LVWB6TB2.js → chunk-GBYH35H5.js} +1 -1
- package/dist/chunk-GG43HSU2.js +3 -0
- package/dist/{chunk-MTG2LRGV.js → chunk-GNNMHYWE.js} +1 -1
- package/dist/{chunk-A2AZQ4PQ.js → chunk-IWBPV3VS.js} +1 -1
- package/dist/{chunk-XUHVQ5VL.js → chunk-JHAGEBKE.js} +1 -1
- package/dist/chunk-L3HG5ONB.js +4 -0
- package/dist/chunk-LEA6IHXC.js +2 -0
- package/dist/{chunk-5J3HQZNU.js → chunk-LMMOR7CR.js} +1 -1
- package/dist/{chunk-QG6LJCZG.js → chunk-LRA3V5GY.js} +1 -1
- package/dist/chunk-MXLXKHW4.js +2 -0
- package/dist/{chunk-RWIHSR4H.js → chunk-NIKA2V6B.js} +1 -1
- package/dist/chunk-O4HWPV67.js +13 -0
- package/dist/{chunk-77PBBYRZ.js → chunk-OAEZKYYQ.js} +2 -2
- package/dist/{chunk-IX34JIXK.js → chunk-OV2W7KBC.js} +1 -1
- package/dist/{chunk-JR37W7IJ.js → chunk-P4SE6YON.js} +1 -1
- package/dist/{chunk-X47VFBIV.js → chunk-QB4IOM3X.js} +1 -1
- package/dist/chunk-QM3XF5TW.js +11 -0
- package/dist/chunk-QM4S2APK.js +2 -0
- package/dist/{chunk-RGQIBS32.js → chunk-QTHITA73.js} +1 -1
- package/dist/{chunk-3NR6OTHL.js → chunk-QZJID3OZ.js} +1 -1
- package/dist/{chunk-QVJ7C4GW.js → chunk-QZNUTCSD.js} +1 -1
- package/dist/{chunk-SK2GVMTJ.js → chunk-R65HNFRB.js} +1 -1
- package/dist/{chunk-YB54MHKU.js → chunk-RLICAFFQ.js} +1 -1
- package/dist/chunk-RQM3DUSB.js +9 -0
- package/dist/chunk-SHAA6FOD.js +11 -0
- package/dist/chunk-SORKKW7B.js +6 -0
- package/dist/{chunk-TTJ4XMWP.js → chunk-T2ULEJK7.js} +1 -1
- package/dist/{chunk-OPDJD7WS.js → chunk-T4WZWKIU.js} +2 -2
- package/dist/{chunk-TSWGQKUK.js → chunk-TACPTX64.js} +2 -2
- package/dist/chunk-TFVMSEIA.js +2 -0
- package/dist/{chunk-DL5CXC64.js → chunk-U5QTE3WX.js} +1 -1
- package/dist/{chunk-6EC54ZHT.js → chunk-U6TLLYRG.js} +1 -1
- package/dist/{chunk-NMKZHHB6.js → chunk-VCYVSKPM.js} +1 -1
- package/dist/chunk-VXLOEM2U.js +347 -0
- package/dist/{chunk-I37UOX73.js → chunk-XTO236AL.js} +3 -3
- package/dist/chunk-XWIN3S7O.js +4 -0
- package/dist/{chunk-3GOZ7R4G.js → chunk-YY6WPFMT.js} +3 -3
- package/dist/{chunk-WJG4ZPUH.js → chunk-ZA4GR5R7.js} +1 -1
- package/dist/{config-BZ7C5NU5.js → config-Z4OS3HEE.js} +1 -1
- package/dist/cover-cmd-L2HSVDLH.js +2 -0
- package/dist/{credentials-BPJL6YIZ.js → credentials-TNEVAUHI.js} +1 -1
- package/dist/dossier-ZHSHATVU.js +3 -0
- package/dist/evidence-MA3LDBWG.js +2 -0
- package/dist/evolve-cmd-DTW4EOXM.js +2 -0
- package/dist/{explain-cmd-AG6ZDXV6.js → explain-cmd-327F6ESA.js} +1 -1
- package/dist/{explain-cmd-NZPC6537.js → explain-cmd-E366QTAD.js} +1 -1
- package/dist/extract-bind-DZLG4GUE.js +5 -0
- package/dist/{extract-cmd-4PGUDJMU.js → extract-cmd-LFVMG6UE.js} +1 -1
- package/dist/gaps-cmd-IAEXXESW.js +2 -0
- package/dist/{generate-headless-NZUDYIKJ.js → generate-headless-TYQRYQKJ.js} +2 -2
- package/dist/index.js +12 -12
- package/dist/ingest-CBQAXVH6.js +2 -0
- package/dist/ingest-cmd-JN6PLDE3.js +3 -0
- package/dist/interactive-bind-QEBWUJCN.js +7 -0
- package/dist/lifecycle-cmd-KZOC4WDW.js +2 -0
- package/dist/list-cmd-6X5U46RD.js +3 -0
- package/dist/{list-commands-55RCFEOL.js → list-commands-BU2MSYRH.js} +1 -1
- package/dist/logical-ids-RFGWBVML.js +2 -0
- package/dist/login-flow-4L62GWLT.js +2 -0
- package/dist/{persist-recorded-session-HK7JUONC.js → persist-recorded-session-RAL7UCQT.js} +1 -1
- package/dist/pipeline-PLI5WQKX.js +2 -0
- package/dist/readmodel-V3DVL6NP.js +2 -0
- package/dist/reconcile-cmd-UXY36ROJ.js +2 -0
- package/dist/{recording-banner-5IYX2KBV.js → recording-banner-MBR3Q7VD.js} +1 -1
- package/dist/{require-project-folder-J4Q4FRQ4.js → require-project-folder-KE7XOOFN.js} +1 -1
- package/dist/review-cmd-XVWPSWU2.js +4 -0
- package/dist/run-5DQSL5KH.js +2 -0
- package/dist/run-B7BRNC3X.js +2 -0
- package/dist/{run-test-md-WN6BH3PC.js → run-test-md-ZCAWNP35.js} +2 -2
- package/dist/{skill-installer-4HYPUBNB.js → skill-installer-H5DPJJFW.js} +1 -1
- package/dist/{spawner-VD6YFZ43.js → spawner-C6B5J73J.js} +1 -1
- package/dist/tcg-generate-DIMZXAV3.js +2 -0
- package/dist/{testmd-actions-LT5FNIR6.js → testmd-actions-X6XCV53D.js} +1 -1
- package/dist/token-refresh-7PAPCMQK.js +2 -0
- package/dist/{validate-basic-XWGKC5VF.js → validate-basic-VBPGGHES.js} +1 -1
- package/dist/{version-check-6FDTS6MK.js → version-check-YPRCQJ7E.js} +1 -1
- package/dist/{view-cmd-PCDG3FIC.js → view-cmd-G4PGJRQH.js} +3 -3
- package/dist/walk-session-GWOP27TX.js +2 -0
- package/package.json +6 -6
- package/dist/ChatSurface-Y2M6HB2R.js +0 -8
- package/dist/EvidenceViewOffer-LHPIZUGQ.js +0 -2
- package/dist/SingleShotApp-BZV5CULT.js +0 -2
- package/dist/TestMdRunView-A655PMEY.js +0 -2
- package/dist/chat-committer-WOTCC7L3.js +0 -2
- package/dist/chat-controller-MONWZKS7.js +0 -4
- package/dist/chunk-64LC36AF.js +0 -2
- package/dist/chunk-6PS65QFF.js +0 -2
- package/dist/chunk-CIFVUX3B.js +0 -4
- package/dist/chunk-DCWCANNS.js +0 -6
- package/dist/chunk-GBBVP2JW.js +0 -2
- package/dist/chunk-IYTHPCQ2.js +0 -356
- package/dist/chunk-NMZATEKQ.js +0 -9
- package/dist/chunk-QHFUDBQH.js +0 -2
- package/dist/chunk-R7NNIQMH.js +0 -11
- package/dist/chunk-RE3BZVGE.js +0 -3
- package/dist/chunk-VLC24QVT.js +0 -2
- package/dist/chunk-Y6HPW2OQ.js +0 -2
- package/dist/chunk-YTZUYCFZ.js +0 -2
- package/dist/chunk-YZBLBPOE.js +0 -13
- package/dist/cover-cmd-DN5D6A3S.js +0 -2
- package/dist/evidence-E5B24ZO6.js +0 -2
- package/dist/evolve-cmd-V7H4PLCX.js +0 -2
- package/dist/extract-bind-3QBBCWYE.js +0 -5
- package/dist/gaps-cmd-42LPHWFP.js +0 -2
- package/dist/ingest-GOKIMEP4.js +0 -2
- package/dist/ingest-cmd-BTYHVJ33.js +0 -3
- package/dist/interactive-bind-TKRWAPJU.js +0 -7
- package/dist/lifecycle-cmd-E6AXODQD.js +0 -2
- package/dist/list-cmd-RJVLH2GR.js +0 -3
- package/dist/logical-ids-QZQRQ3TV.js +0 -2
- package/dist/login-flow-WNIHDQXF.js +0 -2
- package/dist/pipeline-FTLXJQRT.js +0 -2
- package/dist/readmodel-KTNI6QDC.js +0 -2
- package/dist/reconcile-cmd-5XC4AUSJ.js +0 -2
- package/dist/review-cmd-XB2DCTMZ.js +0 -4
- package/dist/run-2RFR2ASQ.js +0 -2
- package/dist/run-3ZYJQBBC.js +0 -2
- package/dist/tcg-generate-77QKMB63.js +0 -2
- package/dist/token-refresh-PCOAZBKK.js +0 -2
- package/dist/walk-session-YS62CWX5.js +0 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as
|
|
2
|
+
import{a as S,b as A,d as P}from"./chunk-GRB66C5S.js";import{a as O}from"./chunk-3C5GMAM4.js";import{a as U}from"./chunk-JFAFKHDX.js";import{a as G}from"./chunk-DNNZ353O.js";import{a as E,b as $}from"./chunk-LEA6IHXC.js";import{b as T}from"./chunk-L3HG5ONB.js";import{d as g,e as m}from"./chunk-5YPBPZUR.js";var v=(e,t,n=new Set)=>{let o=e.nameOf.get(t);if(o!==void 0)return o;if(n.has(t))return t;n.add(t);for(let[s,r]of e.superseded){if(r!==t)continue;let c=v(e,s,n);if(c!==s)return c}return t};function M(e,t){let n=e.stale(t);if(n==="fresh")return;if(n==="orphaned")return"orphaned \u2014 no live source evidences this item";let o=[],s=new Map;for(let r of e.derivesInto(t))s.set(String(r.props.source_id),r);for(let[r,c]of s){let i=e.heads.get(r);if(i==null||i===c.props.source_cid)continue;let u=e.convChains.get(r)?.chain;u&&u.includes(String(c.props.source_cid))||o.push(`DERIVES pin ${r}@${String(c.props.source_cid).slice(0,19)} broke \u2014 the source head moved`)}for(let r of e.edgesFrom(t)){if(r.type===m.DERIVES||!e.superseded.has(r.dst))continue;let c=e.tipOf(r.dst);if(e.superseded.has(c)){o.push(`${r.type} pin \u2192 ${v(e,r.dst)} \u2014 target retired`);continue}let i=L(e,r.dst,c);o.push(i.length>0?`${v(e,r.dst)} updated: ${i.map(u=>u.field).join(", ")}`:`${r.type} pin \u2192 ${v(e,r.dst)} \u2014 target superseded`)}return o.length>0?o.join("; "):"stale \u2014 a pinned dependency moved"}function L(e,t,n){let o=e.getNode(t)?.content??{},s=e.getNode(n)?.content??{},r=i=>i===void 0?"":Array.isArray(i)?i.map(String).join(" \xB7 "):typeof i=="object"?JSON.stringify(i):String(i),c=[];for(let i of[...new Set([...Object.keys(o),...Object.keys(s)])].sort())JSON.stringify(o[i])!==JSON.stringify(s[i])&&c.push({field:i,old:r(o[i]),new:r(s[i])});return c}function V(e,t){let n=[];for(let{cid:o}of e.byLabel(g.SCENARIO))e.superseded.has(o)||e.edgesFrom(o).some(s=>s.type===m.BELONGS_TO&&e.tipOf(s.dst)===t)&&n.push(o);return n}function R(e,t){let n=[],o=[],s=[],r=V(e,t),c=new Set(r),i=(u,f)=>{let a=M(e,f);return a===void 0?u:{...u,stale:!0,stale_reason:a}};for(let u of r){let f=e.getNode(u)?.content??{};n.push(i({ref:v(e,u),title:String(f.title??""),case_type:String(f.case_type??""),intent:String(f.intent??"")},u));for(let a of e.edgesInto(u)){if(a.type!==m.AUTOMATES||e.superseded.has(a.src))continue;let d=e.getNode(a.src)?.content??{},l=e.edgesFrom(a.src).filter(p=>p.type===m.VERIFIES&&!e.superseded.has(p.dst)).map(p=>v(e,p.dst));o.push(i({ref:v(e,a.src),title:String(d.title??""),check:d.check,verifies:l},a.src))}}for(let{cid:u}of e.byLabel(g.AC)){if(e.superseded.has(u))continue;let f=e.edgesFrom(u).find(p=>p.type===m.SCOPED_TO);if(!f)continue;let a=e.tipOf(f.dst);if(!(a===t||c.has(a)))continue;let l=e.getNode(u)?.content??{};s.push(i({ref:v(e,u),text:String(l.text??""),kind:String(l.kind??""),scope:a===t?"use-case":v(e,a)},u))}return{scenarios:n,tests:o,acs:s}}function I(e,t,n){let o=G(e,t,n);return o===null?null:o.toString("utf8")}function q(e,t){let n=t.split(`
|
|
3
3
|
`).map(s=>s.replace(/^\d+\| /,"")),o=[];for(let s of e.split(`
|
|
4
4
|
`)){let r=s.trim();if(r.length===0)continue;let c=n.find(i=>i.includes(r));c!==void 0&&!o.includes(c.trim())&&o.push(c.trim())}return o.length>0?o.join(`
|
|
5
|
-
`):{removed:!0}}function J(e,t,n,o){if(o!==void 0&&o.trim().length>0)return{kind:"user-directive",text:o.trim()};let s=[n,...R(t,n).acs.map(u=>t.resolve(u.ref)?.cid??"")].filter(Boolean),r=[],c=new Set;for(let u of s){let f=new Map;for(let a of t.derivesInto(u))f.set(String(a.props.source_id),a);for(let[a,d]of f){let l=t.heads.get(a);if(l==null||l===d.props.source_cid)continue;let p=String(d.props.anchor),b=`${a}\0${p}`;if(c.has(b)||p==="img#whole")continue;c.add(b);let k=I(e,t,String(d.props.source_cid)),w=k===null?null:
|
|
5
|
+
`):{removed:!0}}function J(e,t,n,o){if(o!==void 0&&o.trim().length>0)return{kind:"user-directive",text:o.trim()};let s=[n,...R(t,n).acs.map(u=>t.resolve(u.ref)?.cid??"")].filter(Boolean),r=[],c=new Set;for(let u of s){let f=new Map;for(let a of t.derivesInto(u))f.set(String(a.props.source_id),a);for(let[a,d]of f){let l=t.heads.get(a);if(l==null||l===d.props.source_cid)continue;let p=String(d.props.anchor),b=`${a}\0${p}`;if(c.has(b)||p==="img#whole")continue;c.add(b);let k=I(e,t,String(d.props.source_cid)),w=k===null?null:T(k,p);if(w===null)continue;let x=I(e,t,l);r.push({source_id:a,anchor:p,old_anchor_text:w,new_anchor_text:x===null?{removed:!0}:q(w,x)})}}let i;for(let[u,f]of t.superseded){if(f!==n||t.nodeLabel.get(u)!==g.USECASE)continue;let a=L(t,u,n);a.length>0&&(i=a);break}return{kind:"source-change",changes:r,...i?{uc_updated:i}:{}}}function N(e,t,n,o){let s=R(t,n);if(s.scenarios.length===0&&s.tests.length===0&&s.acs.length===0)return;let r=J(e,t,n,o);if(!(r.kind==="source-change"&&r.changes.length===0&&!r.uc_updated))return{prior_design:s,change_delta:r}}var _=new Set([g.USECASE,g.SCENARIO,g.AC,g.TEST]);function h(e,t){return!e.superseded.has(t)&&e.trust.get(t)!=="archived"}function y(e,t,n){let o=e.edgesFrom(t).find(s=>s.type===n);return o?e.tipOf(o.dst):null}function D(e,t,n){if(n===g.USECASE)return t;if(n===g.SCENARIO)return y(e,t,m.BELONGS_TO);if(n===g.AC){let o=y(e,t,m.SCOPED_TO);return o?e.nodeLabel.get(o)===g.USECASE?o:y(e,o,m.BELONGS_TO):null}if(n===g.TEST){let o=y(e,t,m.AUTOMATES);return o?y(e,o,m.BELONGS_TO):null}return null}function j(e,t){let n=e.nameOf.get(t);if(n)return n;for(let[o,s]of e.names)if(e.tipOf(s)===t)return o;return t}function B(e,t){return{ucTip:t,display:j(e,t),seamRef:e.nameOf.get(t)??t}}function Y(e,t){let n=e.resolve(t);if(!n)return{ok:!1,message:`unknown ref '${t}' \u2014 no test/scenario/ac/use-case by that id or cid`};let o=n.tip,s=e.nodeLabel.get(o);if(!s||!_.has(s))return{ok:!1,message:`'${t}' is a ${s??"missing node"} \u2014 evolve takes a test, scenario, acceptance criterion, or use-case`};let r=D(e,o,s);return!r||e.nodeLabel.get(r)!==g.USECASE?{ok:!1,message:`cannot resolve '${t}' to a parent use-case \u2014 its ${s} chain is broken`}:e.superseded.has(r)?{ok:!1,message:`use-case ${j(e,r)} was removed \u2014 nothing to evolve`}:{ok:!0,target:B(e,r)}}function ae(e,t){return C(e,t)}function C(e,t){let n=[];for(let{cid:s}of e.byLabel(g.SCENARIO)){if(!h(e,s)||!e.edgesFrom(s).some(c=>c.type===m.BELONGS_TO&&e.tipOf(c.dst)===t))continue;let r=e.edgesInto(s).filter(c=>c.type===m.AUTOMATES&&h(e,c.src));if(r.length===0)n.push({scenario:s,test:null});else for(let c of r)n.push({scenario:s,test:c.src})}let o=new Map;for(let{cid:s}of e.byLabel(g.AC)){if(!h(e,s)||D(e,s,g.AC)!==t)continue;let r=e.edgesInto(s).filter(c=>c.type===m.VERIFIES&&h(e,c.src)).map(c=>c.src).sort();o.set(s,r)}return{pairs:n,verifies:o}}function H(e,t){let n=c=>`${c.scenario}\0${c.test??""}`,o=new Set(e.pairs.map(n)),s=new Set(t.pairs.map(n)),r=[];for(let[c,i]of e.verifies){let u=t.verifies.get(c);u&&(i.length===u.length&&i.every((f,a)=>f===u[a])||r.push({ac:c,before:i,after:u}))}return{superseded:e.pairs.filter(c=>!s.has(n(c))),minted:t.pairs.filter(c=>!o.has(n(c))),retained:t.pairs.filter(c=>o.has(n(c))),moves:r}}function z(e,t,n,o,s){let r=i=>t.nameOf.get(i)??i,c=i=>` - ${r(i.scenario)} \xB7 ${i.test?r(i.test):"(no test)"}`;e.out(`evolved: use-case ${n} \u2014 design record ${o.before} \u2192 ${o.after}`),e.out(`superseded: ${s.superseded.length} pair(s)`);for(let i of s.superseded)e.out(c(i));e.out(`minted: ${s.minted.length} pair(s)`);for(let i of s.minted)e.out(c(i));e.out(`retained: ${s.retained.length} pair(s)`);for(let i of s.retained)e.out(c(i));if(s.moves.length===0)e.out("verifies moves: none");else{e.out("verifies moves:");for(let i of s.moves){let u=f=>f.length>0?f.map(r).join(" + "):"(none)";e.out(` - ${r(i.ac)}: ${u(i.before)} \u2192 ${u(i.after)}`)}}}async function F(e,t,n,o,s,r){let c=E(e),i=O(c,t.ucTip);if(!i)return r==="batch"?(o.out(`note: ${t.display} has no design output \u2014 nothing to evolve; run kane-cli design tests --use-case ${t.display} first`),{code:0,outcome:"no-design"}):(S(o,`nothing to evolve \u2014 run kane-cli design tests --use-case ${t.display} first (no design output)`),{code:2,outcome:"no-design"});let u=C(c,t.ucTip),f=`evolve re-designs the parent use-case ${t.display}; ${u.pairs.length} pair(s) affected`;if(n.yes)o.out(f);else if(!await o.confirm(`${f} \u2014 proceed?`))return o.out(r==="batch"?`skipped ${t.display}`:"declined \u2014 nothing evolved"),{code:0,outcome:"declined"};let a=N(e,c,t.ucTip,n.because),d=await s(t.seamRef,{yes:!!n.yes,...n.mode?{mode:n.mode}:{},...n.because?{because:n.because}:{},...a!==void 0?{changeDelta:a.change_delta,priorDesign:a.prior_design}:{}});if(d===3)return o.out(`design session for ${t.display} paused \u2014 resume with \`kane-cli design tests --resume\`, then re-run evolve for the diff`),{code:d,outcome:"paused"};if(d!==0)return S(o,`design run for ${t.display} ended with exit code ${d} \u2014 no diff to report`),{code:d,outcome:"failed"};let l=E(e),p=l.tipOf(t.ucTip),b=O(l,p)?.seq;return z(o,l,t.display,{before:i.seq,after:b??"?"},H(u,C(l,p))),{code:0,outcome:"evolved"}}function K(e){let t=new Map,n=0;for(let{cid:s,state:r}of e.staleList()){if(r==="superseded")continue;let c=e.nodeLabel.get(s);if(!c||!_.has(c)||!h(e,s)||!$(e,s))continue;let i=D(e,s,c);!i||e.nodeLabel.get(i)!==g.USECASE||e.superseded.has(i)||(n++,t.has(i)||t.set(i,B(e,i)))}return{targets:[...t.values()].sort((s,r)=>s.display<r.display?-1:s.display>r.display?1:0),staleCount:n}}function Q(e,t){for(let{cid:n,state:o}of e.staleList()){if(o==="superseded")continue;let s=e.nodeLabel.get(n);if(!(!s||!_.has(s)||!h(e,n))&&$(e,n)&&D(e,n,s)===t)return!0}return!1}async function W(e,t,n,o={},s=process.cwd()){if(e&&t.fromStale)return S(n,"pass a <ref> OR --from-stale, not both"),2;if(!e&&!t.fromStale)return S(n,"evolve needs a <ref> or --from-stale"),2;let r=A(s,n);if(!r)return 2;let c=o.runDesignForUc??X;n.out(`evolving ${e??"stale use-cases"}: reading the graph\u2026`);let i=E(r),u,f=null;if(e){let d=Y(i,e);if(!d.ok)return S(n,d.message),2;if(!t.because&&O(i,d.target.ucTip)&&!Q(i,d.target.ucTip))return S(n,`nothing changed underneath ${e} \u2014 its sources and requirements are current; use --because "<reason>" to re-design anyway`),2;u=[d.target]}else{let{targets:d,staleCount:l}=K(i);if(d.length===0)return n.out("nothing stale \u2014 nothing to evolve"),0;f=`from-stale: ${l} stale node(s) \u2192 ${d.length} use-case(s)`,u=d}if(!t.yes&&!n.isTTY)return S(n,"evolve needs a TTY \u2014 the blast-radius confirm is the point; headless evolution rides `kane-cli maintain reconcile`"),2;if(f&&n.out(f),e){let d=await F(r,u[0],t,n,c,"single");return d.outcome==="evolved"&&t.because&&U(r,{ts:new Date().toISOString(),command:"evolve",id:e,verdict:"gap-resolved-evolve",polarity:"preference",by:{kind:"human",id:process.env.USER??"operator"},target:e,reason:t.because}),d.code}let a=0;for(let d of u){let{code:l}=await F(r,d,t,n,c,"batch");l!==0&&a===0&&(a=l)}return a}var X=async(e,t)=>{let{designTestsCommand:n}=await import("./bind-HNI5LCNK.js"),o=()=>n({useCase:e,force:!0,...t.mode?{mode:t.mode}:t.yes?{mode:"override"}:{},...t.because?{because:t.because}:{},...t.changeDelta!==void 0?{changeDelta:t.changeDelta}:{},...t.priorDesign!==void 0?{priorDesign:t.priorDesign}:{}});if(t.mode!=="agent")return o();let s=process.stdout.write;process.stdout.write=((...r)=>!0);try{return await o()}finally{process.stdout.write=s}};async function de(e,t){return W(e,t,P(),{})}export{Y as a,ae as b,F as c,K as d,W as e,X as f,de as g};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{c as H,d as z}from"./chunk-2YQ6TW77.js";import{b as p,c as E,d as j,e as y,f as M,g as C,i as A,l as D,m as F,p as T,r as $,s as O}from"./chunk-RKWJG3WW.js";import{a as B}from"./chunk-
|
|
2
|
+
import{c as H,d as z}from"./chunk-2YQ6TW77.js";import{b as p,c as E,d as j,e as y,f as M,g as C,i as A,l as D,m as F,p as T,r as $,s as O}from"./chunk-RKWJG3WW.js";import{a as B}from"./chunk-FVM7TWKT.js";import{h as R,i as k}from"./chunk-M5JQXOCE.js";import{a as P}from"./chunk-VCYVSKPM.js";import{e as q}from"./chunk-UR6MHSHU.js";import{existsSync as f,mkdirSync as V,readFileSync as Z,renameSync as N,writeFileSync as K}from"fs";import{join as Q}from"path";function fe(e){D(p(e));let t=p(e);if(!f(t))return;let n=Q(t,"meta.json"),r=y(e);if(f(n)&&!f(r))try{V(j(e),{recursive:!0}),N(n,r)}catch(o){process.stderr.write(`warn: meta.json migration failed: ${o.message}
|
|
3
3
|
`)}let i=C(e);if(f(i)){let o="python";try{let c=new B().load();c.code_export?.language&&(o=c.code_export.language)}catch{}let a=M(e,"playwright",o);if(!f(a))try{N(i,a)}catch(c){process.stderr.write(`warn: generated-code migration failed: ${c.message}
|
|
4
4
|
`)}}if(f(r))try{let o=JSON.parse(Z(r,"utf8"));"md5sum"in o&&(delete o.md5sum,K(r,JSON.stringify(o,null,2)+`
|
|
5
5
|
`,"utf8"))}catch(o){process.stderr.write(`warn: meta.json md5sum strip failed: ${o.message}
|
|
6
|
-
`)}}async function ye(e){if(!e.isInteractive)return{recovered:!1};if(W(e.creds))return{recovered:!1};let{SingleShotApp:t}=await import("./SingleShotApp-
|
|
6
|
+
`)}}async function ye(e){if(!e.isInteractive)return{recovered:!1};if(W(e.creds))return{recovered:!1};let{SingleShotApp:t}=await import("./SingleShotApp-YQYS6HTB.js"),{ScrollbackProvider:n}=await import("./scrollback-JLPJR25X.js"),{render:r}=await import("./build-JIKYOZUH.js"),i=await import("./react-QWOAB3TB.js"),o={current:null},a={current:!1},{waitUntilExit:c,unmount:l}=r(i.default.createElement(n,null,i.default.createElement(t,{resultRef:o,mode:"login",loginCompleteRef:a})),{exitOnCtrlC:!1});k(()=>l()),await c();try{process.stdin.setRawMode?.(!1)}catch{}return process.stdout.write("\x1B[?25h"),a.current?{recovered:!0}:(R(0,"Startup gate cancelled"),{recovered:!1})}function W(e){let t=e.getActiveProfile(),n=e.getDefaultEnv();if(!t||!!!(e.loadBasicAuth(t,n)||e.loadCredentials(t,n)))return!1;let i=e.loadProfileConfig(t,n)??{};return!!i.project_id&&!!i.folder_id}var J=q(H(),1);import{existsSync as v,readFileSync as U,readdirSync as X,statSync as Y}from"fs";import{dirname as ee,isAbsolute as te,join as g,relative as x,resolve as re,sep as h}from"path";import{createHash as ne}from"crypto";var S="testmd-bundle.json",d=class extends Error{constructor(t){super(t),this.name="BundleUsageError"}},_=e=>e.split(h).join("/");function I(e){if(!v(e))return[];let t=[];for(let n of X(e).sort()){let r=g(e,n);Y(r).isDirectory()?t.push(...I(r)):t.push(r)}return t}function se(e){let t=e.map(r=>ee(r).split(h)),n=t[0];for(let r of t.slice(1)){let i=0;for(;i<n.length&&i<r.length&&n[i]===r[i];)i++;n=n.slice(0,i)}return n.join(h)||h}function ie(e){for(let t of e){let n=F(t,U(t,"utf8"));for(let r of n.steps)if(r.body.kind==="import_ref"&&te(r.body.path))throw new d(`bundle sync: absolute @import is not portable after unzip: ${t} step ${r.index} (@import ${r.body.path})`)}}function G(e){let t=re(e),n=T(t);if(!n?.commit_id||!n?.test_id)throw new d(`bundle sync: ${t} is not authored \u2014 run \`kane-cli testmd run\` first (output-<stem>/.internal/meta.json needs commit_id + test_id)`);let r;try{r=O(t)}catch(s){throw s instanceof $?new d(`bundle sync: ${s.message}`):s}let i=[t];for(let s of r.steps)for(let u of s.trace.slice(1))i.includes(u.file)||i.push(u.file);ie(i);let o=[];for(let s of r.unitFiles){if(s.file===t)continue;let u=p(s.file);o.includes(u)||o.push(u)}let a=[...i],c=s=>{v(s)&&a.push(s)};c(E(t)),a.push(y(t)),c(g(p(t),".internal","execution.json")),a.push(...I(A(t)));for(let s of o)c(g(s,"Result.md")),a.push(...I(g(s,".internal","steps")));let l=se(a);if(v(g(l,S)))throw new d(`bundle sync: a real file named ${S} exists at the zip root (${l}) \u2014 it would collide with the generated manifest`);let b=a.map(s=>{let u=U(s);return{abs:s,rel:_(x(l,s)),sha256:ne("sha256").update(u).digest("hex"),bytes:u.length}}).sort((s,u)=>s.rel<u.rel?-1:1),m=_(x(l,t)),L={schema_version:2,entry:m,commit_id:n.commit_id,test_id:n.test_id,testcase_id:n.testcase_id??null,project_id:n.project_id??null,folder_id:n.folder_id??null,org_id:n.org_id??null,created_at:new Date().toISOString(),producer:{name:"kane-cli",version:P},files:b.map(s=>({path:s.rel,sha256:s.sha256,bytes:s.bytes})),units:r.unitFiles.filter(s=>s.file!==t).map(s=>({path:_(x(l,s.file)),kind:s.kind}))};return{zipRoot:l,entry:m,files:b,manifest:L}}var w=e=>e instanceof Error?e.message:String(e);function oe(e){return new Promise((t,n)=>{let r=(0,J.default)("zip",{zlib:{level:6}}),i=[];r.on("data",o=>i.push(o)),r.on("error",n),r.on("end",()=>t(Buffer.concat(i))),r.append(JSON.stringify(e.manifest,null,2)+`
|
|
7
7
|
`,{name:S});for(let o of e.files)r.file(o.abs,{name:o.rel});r.finalize()})}async function ae(e){let{plan:t,controller:n,testId:r,sessionId:i,commitId:o}=e,a;try{a=await oe(t)}catch(l){return{ok:!1,stage:"zip",error:w(l)}}let c;try{let l={key:"testmd",content_type:"application/zip",filename:`${o}-testmd.zip`},m=(await n.getPresignedUrls(r,i,[l])).urls?.testmd?.upload_url;if(!m)return{ok:!1,stage:"presign",error:"presign response missing testmd upload_url"};c=m}catch(l){return{ok:!1,stage:"presign",error:w(l)}}try{await z(c,a,"application/zip")}catch(l){return{ok:!1,stage:"upload",error:w(l)}}return{ok:!0,bytes:a.length}}async function Ee(e){let t;try{t=G(e.sourcePath)}catch(n){return n instanceof d?{ok:!1,stage:"collect",error:n.message}:{ok:!1,stage:"collect",error:w(n)}}return ae({...e,plan:t})}function je(e){return e.shouldUploadPipeline&&e.uploadSucceeded&&!!e.metaCommitId&&!!e.metaTestId}export{fe as a,ye as b,Ee as c,je as d};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as n}from"./chunk-RZ4F3BHX.js";import{a as c}from"./chunk-
|
|
2
|
+
import{a as n}from"./chunk-RZ4F3BHX.js";import{a as c}from"./chunk-QZJID3OZ.js";import{v as s,w as a}from"./chunk-VCYVSKPM.js";import{createHash as h,randomBytes as g}from"crypto";var l=class{authBaseUrl;consentUrl;constructor(t="prod"){let e=c(t);this.authBaseUrl=e.authBaseUrl,this.consentUrl=e.consentUrl}static generatePkce(){let t=g(96).toString("base64url").slice(0,128),e=h("sha256").update(t).digest("base64url");return[t,e]}buildAuthorizationUrl(t,e,r,o){let i=new URLSearchParams({response_type:"code",client_id:t,redirect_uri:o,scope:a,code_challenge:e,code_challenge_method:"S256",state:r});return`${this.consentUrl}/oauth2?${i.toString()}`}async registerClient(t){let e=await n(`${this.authBaseUrl}/oauth2/register`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({client_name:s,redirect_uris:[t],grant_types:["authorization_code"],response_types:["code"],client_type:"public",application_type:"native"})});if(!e.ok)throw new Error(`DCR failed: ${e.status} ${await e.text()}`);return e.json()}async exchangeCode(t,e,r,o){let i=await n(`${this.authBaseUrl}/oauth2/token`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({grant_type:"authorization_code",code:t,redirect_uri:o,client_id:e,code_verifier:r})});if(!i.ok)throw new Error(`Token exchange failed: ${i.status}`);return i.json()}async refreshToken(t,e){let r=await n(`${this.authBaseUrl}/oauth2/token`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({grant_type:"refresh_token",refresh_token:t,client_id:e})});if(!r.ok)throw new Error(`Token refresh failed: ${r.status}`);return r.json()}async revokeToken(t,e,r="access_token"){await n(`${this.authBaseUrl}/oauth2/revoke`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:t,token_type_hint:r,client_id:e})})}async validateToken(t){let e=new AbortController,r=setTimeout(()=>e.abort(),1e4);try{let o=await n(`${this.authBaseUrl}/api/user`,{headers:{Authorization:`Bearer ${t}`,Accept:"application/json","Content-Type":"application/json"},signal:e.signal});return clearTimeout(r),o.ok}catch{return clearTimeout(r),!1}}};export{l as a};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{b as J}from"./chunk-
|
|
2
|
+
import{b as J}from"./chunk-4BAL4OGF.js";import{e as H,g as P}from"./chunk-M5JQXOCE.js";import{a as ce}from"./chunk-6YGTRKDT.js";import{e as ue}from"./chunk-UR6MHSHU.js";var u=ue(ce(),1);function $(p,r){let f=null,R=(b,j)=>{for(let S=0;S<b.length;S++){let y=b[S],l=[...j,S];r(y)&&(f===null||l.length>f.length)&&(f=l),y.children&&y.children.length>0&&R(y.children,l)}};return R(p,[]),f}function T(p,r,f){if(r.length===0)return[...p];let R=r[0],b=[...p],j=b[R];if(r.length===1)b[R]=f(j);else{let S=r.slice(1),y=T(j.children??[],S,f);b[R]={...j,children:y}}return b}function K(){return{steps:[],maxOrdinal:0}}function le(p,r){if(r.type==="run_start"&&r.environment?.resolution)return{...p,resolution:r.environment.resolution};if(r.type==="step_end"&&typeof r.ordinal=="number"&&r.id){let f={id:r.id,ordinal:r.ordinal,status:r.status,...r.kind?{kind:r.kind}:{},...typeof r.duration=="number"?{duration_ms:Math.round(r.duration*1e3)}:{},...typeof r.action_id=="string"&&r.action_id?{action_id:r.action_id}:{}};return{...p,steps:[...p.steps,f],maxOrdinal:Math.max(p.maxOrdinal,r.ordinal)}}return p}function D(p){let r=p.indexOf(": ");return r>0&&r<15?p.slice(r+2):p}function W(p){return p.map(r=>{let f=r.children?W(r.children):r.children;return r.status==="running"?{...r,status:"stopped",phase:void 0,children:f}:f!==r.children?{...r,children:f}:r})}function Se(p,r,f,R,b){let[j,S]=(0,u.useState)(!1),[y,l]=(0,u.useState)([]),[Q,B]=(0,u.useState)(null),[X,F]=(0,u.useState)(null),[Y,w]=(0,u.useState)(null),[Z,L]=(0,u.useState)(null),[ee,q]=(0,u.useState)([]),[ne,G]=(0,u.useState)(null),[te,ie]=(0,u.useState)(void 0),m=(0,u.useRef)(null),x=(0,u.useRef)(null),_=(0,u.useRef)(0),A=(0,u.useRef)(!1),O=(0,u.useRef)(K()),re=(0,u.useCallback)(async(I,V)=>{let z=m.current;if(z){try{await z.exited}catch{}m.current=null}l([]),B(null),F(null),w(null),L(null),q([]),G(null),ie(I.max_steps),S(!0),x.current=null,_.current=0,O.current=K();let h;try{h=J(I,V)}catch(E){w(E instanceof Error?E.message:String(E)),S(!1);return}m.current=h,H("runner",()=>h.cancel()),(async()=>{A.current=!1;let E=!1;for await(let e of h.events){if(A.current)break;switch(O.current=le(O.current,e),e.type){case"run_start":if(e.child_id)break;if(x.current&&!x.current.isSingleFlow){let o=_.current;_.current++,l(d=>d.map((i,s)=>s===o?{...i,status:"running"}:i.status==="running"&&!i.children?.some(n=>n.status==="running")?{...i,status:i.children?.some(n=>n.status==="failed")?"failed":"passed"}:i))}break;case"bifurcation":{let o=e.flows??[],d=e.count??o.length,i={flows:o,isSingleFlow:e.is_single_flow??d<=1};L(i),x.current=i,_.current=0,l(o.map((s,n)=>({index:n+1,objective:s??`Flow ${n+1}`,status:"pending"})));break}case"step_start":{r?.("STEP_START",`Step ${e.index} started`,{index:e.index,objective:e.objective,child_id:e.child_id});let o=e.index,d=e.objective??`Step ${o}`,i=e.child_id,s=x.current&&!x.current.isSingleFlow;if(i)l(n=>{let t=$(n,a=>a.branchChildId===i)??$(n,a=>a.status==="running");return t?T(n,t,a=>{let c=(a.children??[]).map(g=>g.status==="running"&&g.childId===i?{...g,status:"stopped",phase:void 0}:g);return c.push({index:o,objective:d,status:"running",childId:i}),{...a,children:c}}):n});else if(s){let n=Math.max(0,_.current-1);l(t=>{let a=[...t];if(n>=a.length)return t;let c={...a[n]},k=[...c.children??[]].map(U=>U.status==="running"&&U.childId===void 0?{...U,status:"stopped",phase:void 0}:U);return k.push({index:o,objective:d,status:"running"}),c.children=k,c.status="running",a[n]=c,a})}else l(n=>{let t=W(n);return t.some(c=>c.index===o)?t.map(c=>c.index===o?{...c,status:"running",objective:d}:c):[...t,{index:o,objective:d,status:"running"}]});break}case"step_event":{r?.("STEP_EVENT",`Step ${e.index} ${e.event}`,{index:e.index,phase:e.event,action_type:e.action_type,detail:e.detail,child_id:e.child_id});let o=e.child_id,d=x.current&&!x.current.isSingleFlow;if(e.event==="cm_init"&&e.checkpoint_count!=null){q(i=>[...i,e.checkpoint_count]);break}if(e.event==="replay_started"){G({recordingLength:e.recording_length??0});break}if(e.event==="reasoning"&&e.detail&&e.detail!=="reasoning"&&f?.(e.detail),o){let i=n=>{if(n.index!==e.index||n.childId!==o)return n;let t={phase:e.event};return e.event==="reasoning"&&e.detail&&e.detail!=="reasoning"&&(t.objective=e.detail),e.action_type&&(t.actionType=e.action_type),{...n,...t}},s=n=>n.map(t=>{let a=i(t);return a!==t?a:t.children&&t.children.length>0?{...t,children:s(t.children)}:t});l(n=>n.map(t=>t.children?{...t,children:s(t.children)}:t))}else if(d){let i=Math.max(0,_.current-1);l(s=>{let n=[...s];if(i>=n.length)return s;let t={...n[i]},a=[...t.children??[]];if(!a.some(g=>g.index===e.index&&g.childId===void 0))a.push({index:e.index,objective:`Step ${e.index}`,status:"running",phase:e.event,actionType:e.action_type});else for(let g=0;g<a.length;g++){if(a[g].index!==e.index||a[g].childId!==void 0)continue;let k={phase:e.event};e.event==="reasoning"&&e.detail&&e.detail!=="reasoning"&&(k.objective=e.detail),e.action_type&&(k.actionType=e.action_type),a[g]={...a[g],...k}}return t.children=a,n[i]=t,n})}else l(i=>i.some(n=>n.index===e.index)?i.map(n=>{if(n.index!==e.index)return n;let t={phase:e.event};return e.event==="reasoning"&&e.detail&&e.detail!=="reasoning"&&(t.objective=e.detail),e.action_type&&(t.actionType=e.action_type),{...n,...t}}):[...W(i),{index:e.index,objective:`Step ${e.index}`,status:"running",phase:e.event,actionType:e.action_type}]);break}case"step_end":{r?.("STEP_END",`Step ${e.index} ${e.status}`,{index:e.index,status:e.status,duration:e.duration,summary:e.summary,child_id:e.child_id}),R?.();let o=e.child_id,d=x.current&&!x.current.isSingleFlow;if(o){let i=n=>n.index===e.index&&n.childId===o?{...n,status:e.status,duration:e.duration,phase:void 0,objective:n.objective.startsWith("Step ")?D(e.summary||n.objective):n.objective}:n,s=n=>n.map(t=>{let a=i(t);return a!==t?a:t.children&&t.children.length>0?{...t,children:s(t.children)}:t});l(n=>n.map(t=>t.children?{...t,children:s(t.children)}:t))}else if(d){let i=Math.max(0,_.current-1);l(s=>{let n=[...s];if(i>=n.length)return s;let t={...n[i]},a=(t.children??[]).map(c=>c.index===e.index&&c.childId===void 0?{...c,status:e.status,duration:e.duration,phase:void 0,objective:c.objective.startsWith("Step ")?D(e.summary||c.objective):c.objective}:c);return t.children=a,n[i]=t,n})}else l(i=>i.map(s=>s.index===e.index?{...s,status:e.status,duration:e.duration,phase:void 0,objective:s.objective.startsWith("Step ")?D(e.summary||s.objective):s.objective}:s));{let s=x.current&&!x.current.isSingleFlow?Math.max(0,_.current-1):0,n=typeof e.ordinal=="number"&&e.id?{ordinal:e.ordinal,id:e.id}:void 0;p?.(e.index,s,e.child_id,n)}break}case"child_agent_start":{let o=e.objective??"",d=e.child_id;l(i=>{let s=$(i,n=>n.status==="running");return s?T(i,s,n=>({...n,objective:`${o} (branch)`,phase:`child: ${o.slice(0,50)}`,branchObjective:o,branchChildId:d})):i});break}case"child_agent_end":{let o=e.child_id,d=`child ${e.success?"done":"failed"}`;l(i=>{let s=$(i,n=>n.branchChildId===o);return s?T(i,s,n=>({...n,phase:d})):i.map(n=>n.phase?.startsWith("child:")?{...n,phase:d}:n)});break}case"describe_trigger":b?.(e);break;case"ask_user":B(e.question??"");break;case"run_end":l(o=>o.map(d=>d.status==="running"?{...d,status:e.status,phase:void 0}:d)),S(!1),F(e),E=!0;break;case"error":S(!1),w(e.message??"Runner error"),l(o=>o.map(d=>d.status==="running"?{...d,status:"failed",phase:void 0}:d));break}}let{code:v,signal:M}=await h.exited,N=h.stderr,de=v===0&&!M,C=[];v!==null&&v!==0&&C.push(`Runner exited with code ${v}`),M&&C.push(`Runner killed by signal ${M}`),N&&(!de||!E?C.push(N):V?.log?.("debug","RUNNER_STDERR_BENIGN","Runner stderr on clean exit",{stderr:N})),m.current===h&&(C.length>0&&w(C.join(`
|
|
3
3
|
`)),S(!1),P("runner","Event stream ended"),m.current=null)})().catch(E=>{let v=[`Runner event loop error: ${E}`];h.exitCode!==null&&h.exitCode!==0&&v.push(`Exit code: ${h.exitCode}`),h.exitSignal&&v.push(`Signal: ${h.exitSignal}`),h.stderr&&v.push(h.stderr),m.current===h&&(w(v.join(`
|
|
4
4
|
`)),S(!1),P("runner","Event loop error"),m.current=null)})},[p,r,f,R,b]),se=(0,u.useCallback)(I=>{m.current?.sendUserResponse(I),B(null)},[]),ae=(0,u.useCallback)(()=>{let I=m.current;I&&(I.sendCancel("user"),S(!1),B(null),setTimeout(()=>{m.current===I&&(P("runner","User cancelled run"),m.current=null)},5e3))},[]),oe=(0,u.useCallback)(()=>{l([]),F(null),w(null)},[]);return(0,u.useEffect)(()=>()=>{A.current=!0,P("runner","Component unmounted"),m.current=null},[]),{isRunning:j,steps:y,askingUser:Q,lastRunEnd:X,runError:Y,bifurcationInfo:Z,cmInitCounts:ee,replayInfo:ne,maxSteps:te,startRun:re,sendAnswer:se,cancelRun:ae,clearLastRun:oe,getEvidenceState:()=>O.current}}export{K as a,le as b,Se as c};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{homedir as a}from"os";import{join as t}from"path";var m="0.6.
|
|
2
|
+
import{homedir as a}from"os";import{join as t}from"path";var m="0.6.9",d="kane-cli",e=t(a(),".testmuai","kaneai"),g=t(e,"profiles"),h=t(e,"tui-config.json"),_=t(e,"media"),A="https://registry.npmjs.org/@testmuai/kane-cli",L="https://api.github.com/repos/LambdaTest/kane-cli/releases",n="@testmuai/kane-cli-skill",x=`https://registry.npmjs.org/${n}`,r="kane-cli",b=[{dir:t(a(),".claude","skills",r),agent:"Claude Code"},{dir:t(a(),".agents","skills",r),agent:"Codex CLI"},{dir:t(a(),".gemini","skills",r),agent:"Gemini CLI"}],u="https://dd-proxy.lambdatest.com/intake/kane-cli",U="https://kaneai-playground.lambdatest.io",R=9222,I=9230,E=t(e,"chrome-profiles"),o=t(e,"hints"),C=t(o,"state.json");function T(s){return t(o,`catalog-${s}.json`)}var c="127.0.0.1",S=18392,N=18400,i="/callback";function P(s){return`http://${c}:${s}${i}`}var B="KANE CLI",O="*",f={prod:{authBaseUrl:"https://auth.lambdatest.com",consentUrl:"https://accounts.lambdatest.com",controllerBaseUrl:"https://kaneai-api.lambdatest.com/v16-controller/v1",tmsBaseUrl:"https://test-manager-api.lambdatest.com/api",testGeneratorBaseUrl:"https://test-manager-api.lambdatest.com",secretsBaseUrl:"https://api-hyperexecute.lambdatest.com",testManagerUiUrl:"https://test-manager.lambdatest.com",shareApiBaseUrl:"https://api.lambdatest.com",v16ServerHost:"https://kaneai-api.lambdatest.com/v16-server",evidenceViewerUrl:"https://evidence.lambdatest.com",mediaArtefactsHost:"prod-mobile-artefacts.lambdatest.com"},stage:{authBaseUrl:"https://stage-auth.lambdatestinternal.com",consentUrl:"https://stage-accounts.lambdatestinternal.com",controllerBaseUrl:"https://auteur-stage-automind.lambdatestinternal.com/v16-controller/v1",tmsBaseUrl:"https://stage-test-manager-api.lambdatestinternal.com/api",testGeneratorBaseUrl:"https://stage-test-manager-api.lambdatestinternal.com",secretsBaseUrl:"https://api-stage-hyperexecute.lambdatestinternal.com",testManagerUiUrl:"https://stage-test-manager.lambdatestinternal.com",shareApiBaseUrl:"https://stage-api.lambdatestinternal.com",v16ServerHost:"https://auteur-stage-automind.lambdatestinternal.com/v16-server",evidenceViewerUrl:"https://stage-evidence.lambdatestinternal.com",mediaArtefactsHost:"stage-mobile-artefacts.lambdatestinternal.com"}},k={orange:"#ff9500",generateAccent:"#0d9488",purple:"#b388ff",secondary:"#888888",dim:"#666666",muted:"#444444",green:"#4ade80",red:"#ef4444"};export{m as a,d as b,e as c,h as d,_ as e,A as f,L as g,n as h,b as i,u as j,U as k,R as l,I as m,E as n,C as o,T as p,c as q,S as r,N as s,i as t,P as u,B as v,O as w,f as x,k as y};
|
|
@@ -0,0 +1,347 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import{c as Fe}from"./chunk-SHAA6FOD.js";import{a as je}from"./chunk-KHU7C6EE.js";import{a as Be,b as Pe}from"./chunk-3C5GMAM4.js";import{a as de,b as Re,c as $e,d as Ce,g as Ae,h as Le}from"./chunk-RQM3DUSB.js";import{a as Te,b as Oe,g as Ne,h as qe}from"./chunk-FXPPQL4D.js";import{a as De}from"./chunk-GG43HSU2.js";import{c as Ee}from"./chunk-OSALXGD4.js";import{a as Ie}from"./chunk-CVOGP253.js";import{b as pe,c as fe,d as he,e as ae,f as ne,g as ie}from"./chunk-ZPDM6FO7.js";import{a as oe}from"./chunk-L5LI2JF4.js";import{a as Y}from"./chunk-LEA6IHXC.js";import{c as ke,n as xe}from"./chunk-L3HG5ONB.js";import{a as ve,b as ce}from"./chunk-L4JIMNKW.js";import{c as we,e as Se}from"./chunk-MBXWXBDM.js";import{d as v,e as E,f as _e,g as be,h as ye}from"./chunk-5YPBPZUR.js";import{mkdirSync as mt,appendFileSync as gt}from"fs";import{randomBytes as pt}from"crypto";import{join as st}from"path";import{existsSync as le,readFileSync as ue,readdirSync as nt}from"fs";import{join as Z}from"path";var Me=`
|
|
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 Ge={"web-form":`
|
|
86
|
+
id: web-form
|
|
87
|
+
name: "Web form"
|
|
88
|
+
version: 1
|
|
89
|
+
applies_when: >
|
|
90
|
+
The AC concerns a data-entry form: input fields, required fields, submit,
|
|
91
|
+
validation messages.
|
|
92
|
+
candidate_checks:
|
|
93
|
+
- id: field-validation
|
|
94
|
+
family: negative
|
|
95
|
+
measurable_example: "Enter 'abc' in a numeric quantity field \u2192 inline error 'must be a number', value not accepted"
|
|
96
|
+
emits: forbidden-presence
|
|
97
|
+
- id: required-fields
|
|
98
|
+
family: negative
|
|
99
|
+
measurable_example: "Submit with a required field empty \u2192 submit blocked, field flagged"
|
|
100
|
+
emits: forbidden-presence
|
|
101
|
+
- id: formats
|
|
102
|
+
family: negative
|
|
103
|
+
measurable_example: "Email without @ rejected; valid accepted"
|
|
104
|
+
emits: forbidden-presence
|
|
105
|
+
- id: empty-state
|
|
106
|
+
family: empty_state
|
|
107
|
+
measurable_example: "First load: no stale values, placeholders shown"
|
|
108
|
+
emits: presence
|
|
109
|
+
- id: error-messages
|
|
110
|
+
family: negative
|
|
111
|
+
measurable_example: "Each error is specific and tied to its field"
|
|
112
|
+
emits: presence
|
|
113
|
+
- id: a11y
|
|
114
|
+
family: a11y
|
|
115
|
+
measurable_example: "Every input has a programmatic label; keyboard-only submit works"
|
|
116
|
+
emits: presence
|
|
117
|
+
- id: responsiveness
|
|
118
|
+
family: responsiveness
|
|
119
|
+
measurable_example: "No field overlap at 1280/768/375 px"
|
|
120
|
+
emits: forbidden-presence
|
|
121
|
+
`,"rest-graphql-api":`
|
|
122
|
+
id: rest-graphql-api
|
|
123
|
+
name: "REST / GraphQL API"
|
|
124
|
+
version: 1
|
|
125
|
+
applies_when: >
|
|
126
|
+
The surface is an HTTP/GraphQL endpoint.
|
|
127
|
+
candidate_checks:
|
|
128
|
+
- id: response-shape
|
|
129
|
+
family: api_contract
|
|
130
|
+
measurable_example: "Body validates against the declared schema"
|
|
131
|
+
emits: absolute
|
|
132
|
+
- id: status-codes
|
|
133
|
+
family: api_contract
|
|
134
|
+
measurable_example: "GET 200, POST 201, missing 404, bad 400, unauth 401"
|
|
135
|
+
emits: absolute
|
|
136
|
+
- id: verbs
|
|
137
|
+
family: idempotency
|
|
138
|
+
measurable_example: "PUT is idempotent, POST is not"
|
|
139
|
+
emits: delta
|
|
140
|
+
- id: bad-payloads
|
|
141
|
+
family: negative
|
|
142
|
+
measurable_example: "Malformed JSON \u2192 400, never 500"
|
|
143
|
+
emits: absolute
|
|
144
|
+
- id: idempotency
|
|
145
|
+
family: idempotency
|
|
146
|
+
measurable_example: "Same POST with idempotency-key twice \u2192 one effect"
|
|
147
|
+
emits: delta
|
|
148
|
+
- id: pagination
|
|
149
|
+
family: pagination
|
|
150
|
+
measurable_example: "Page beyond last \u2192 empty list, not error; cursor stable"
|
|
151
|
+
emits: absolute
|
|
152
|
+
- id: versioning
|
|
153
|
+
family: api_contract
|
|
154
|
+
measurable_example: "v1 contract unchanged after v2 ships"
|
|
155
|
+
emits: absolute
|
|
156
|
+
- id: rate-limits
|
|
157
|
+
family: api_contract
|
|
158
|
+
measurable_example: "Over the limit \u2192 429 with retry-after"
|
|
159
|
+
emits: absolute
|
|
160
|
+
`,"mobile-native":`
|
|
161
|
+
id: mobile-native
|
|
162
|
+
name: "Mobile native"
|
|
163
|
+
version: 1
|
|
164
|
+
applies_when: >
|
|
165
|
+
iOS/Android native surface.
|
|
166
|
+
candidate_checks:
|
|
167
|
+
- id: interruptions
|
|
168
|
+
family: state_flow
|
|
169
|
+
measurable_example: "Incoming call mid-flow \u2192 state preserved on return"
|
|
170
|
+
emits: state-transition
|
|
171
|
+
- id: network-transitions
|
|
172
|
+
family: state_flow
|
|
173
|
+
measurable_example: "wifi\u2192cellular\u21924G drop: no data loss, graceful retry"
|
|
174
|
+
emits: state-transition
|
|
175
|
+
- id: permissions
|
|
176
|
+
family: negative
|
|
177
|
+
measurable_example: "Deny camera \u2192 feature degrades, no crash"
|
|
178
|
+
emits: forbidden-presence
|
|
179
|
+
- id: orientation
|
|
180
|
+
family: persistence
|
|
181
|
+
measurable_example: "Rotate mid-form \u2192 input preserved"
|
|
182
|
+
emits: absolute
|
|
183
|
+
- id: deep-links
|
|
184
|
+
family: state_flow
|
|
185
|
+
measurable_example: "Cold-start deep link lands on the right screen with auth"
|
|
186
|
+
emits: state-transition
|
|
187
|
+
- id: state-persistence
|
|
188
|
+
family: persistence
|
|
189
|
+
measurable_example: "Kill + relaunch \u2192 resume where left off"
|
|
190
|
+
emits: absolute
|
|
191
|
+
- id: localization
|
|
192
|
+
family: i18n
|
|
193
|
+
measurable_example: "Device locale switch reformats and re-translates"
|
|
194
|
+
emits: presence
|
|
195
|
+
`,"stateful-flow":`
|
|
196
|
+
id: stateful-flow
|
|
197
|
+
name: "Stateful flow"
|
|
198
|
+
version: 1
|
|
199
|
+
applies_when: >
|
|
200
|
+
Multi-step wizard / checkout / onboarding.
|
|
201
|
+
candidate_checks:
|
|
202
|
+
- id: valid-transitions
|
|
203
|
+
family: state_flow
|
|
204
|
+
measurable_example: "Each step advances only when its precondition is met"
|
|
205
|
+
emits: state-transition
|
|
206
|
+
- id: invalid-transitions
|
|
207
|
+
family: state_flow
|
|
208
|
+
measurable_example: "Can't jump to step 3 with step 2 incomplete"
|
|
209
|
+
emits: forbidden-presence
|
|
210
|
+
- id: back-and-abandon
|
|
211
|
+
family: state_flow
|
|
212
|
+
measurable_example: "Back from step 3, then abandon \u2192 no partial commit"
|
|
213
|
+
emits: forbidden-presence
|
|
214
|
+
- id: refresh-persistence
|
|
215
|
+
family: persistence
|
|
216
|
+
measurable_example: "Reload at step 2 \u2192 still at step 2 with data"
|
|
217
|
+
emits: absolute
|
|
218
|
+
- id: resume
|
|
219
|
+
family: persistence
|
|
220
|
+
measurable_example: "Return later \u2192 resume the saved flow"
|
|
221
|
+
emits: absolute
|
|
222
|
+
- id: double-submission
|
|
223
|
+
family: idempotency
|
|
224
|
+
measurable_example: "Double-click submit \u2192 exactly one submission"
|
|
225
|
+
emits: delta
|
|
226
|
+
`,"data-crud":`
|
|
227
|
+
id: data-crud
|
|
228
|
+
name: "Data CRUD"
|
|
229
|
+
version: 1
|
|
230
|
+
applies_when: >
|
|
231
|
+
A persisted record.
|
|
232
|
+
candidate_checks:
|
|
233
|
+
- id: crud-round-trip
|
|
234
|
+
family: crud
|
|
235
|
+
measurable_example: "Create \u2192 read shows it \u2192 update \u2192 read shows the change \u2192 delete \u2192 read 404"
|
|
236
|
+
emits: state-transition
|
|
237
|
+
- id: retry-safety
|
|
238
|
+
family: idempotency
|
|
239
|
+
measurable_example: "Retried create with same key \u2192 one row"
|
|
240
|
+
emits: delta
|
|
241
|
+
- id: concurrency-lost-update
|
|
242
|
+
family: concurrency
|
|
243
|
+
measurable_example: "Two writers, last must not silently clobber \u2192 conflict surfaced"
|
|
244
|
+
emits: forbidden-presence
|
|
245
|
+
- id: delete-cascade
|
|
246
|
+
family: crud
|
|
247
|
+
measurable_example: "Delete parent \u2192 children handled per rule"
|
|
248
|
+
emits: state-transition
|
|
249
|
+
- id: referential-consistency
|
|
250
|
+
family: crud
|
|
251
|
+
measurable_example: "Can't create a child for a missing parent"
|
|
252
|
+
emits: forbidden-presence
|
|
253
|
+
`,"auth-gated":`
|
|
254
|
+
id: auth-gated
|
|
255
|
+
name: "Auth gated"
|
|
256
|
+
version: 1
|
|
257
|
+
applies_when: >
|
|
258
|
+
Behind login/role.
|
|
259
|
+
candidate_checks:
|
|
260
|
+
- id: login-gate
|
|
261
|
+
family: auth
|
|
262
|
+
measurable_example: "Anonymous \u2192 redirected to login, not the resource"
|
|
263
|
+
emits: forbidden-presence
|
|
264
|
+
- id: role-permission-matrix
|
|
265
|
+
family: auth
|
|
266
|
+
measurable_example: "For each role \xD7 action: allowed/denied as specified"
|
|
267
|
+
emits: absolute
|
|
268
|
+
- id: cross-user-record
|
|
269
|
+
family: auth
|
|
270
|
+
measurable_example: "User A cannot read/edit user B's record by id"
|
|
271
|
+
emits: forbidden-presence
|
|
272
|
+
- id: token-session-expiry
|
|
273
|
+
family: auth
|
|
274
|
+
measurable_example: "Expired token \u2192 401/redirect, no stale access"
|
|
275
|
+
emits: forbidden-presence
|
|
276
|
+
- id: privilege-escalation
|
|
277
|
+
family: auth
|
|
278
|
+
measurable_example: "Non-admin cannot reach an admin action by direct URL/API"
|
|
279
|
+
emits: forbidden-presence
|
|
280
|
+
`,"search-list":`
|
|
281
|
+
id: search-list
|
|
282
|
+
name: "Search / list"
|
|
283
|
+
version: 1
|
|
284
|
+
applies_when: >
|
|
285
|
+
Search results / list views.
|
|
286
|
+
candidate_checks:
|
|
287
|
+
- id: pagination
|
|
288
|
+
family: pagination
|
|
289
|
+
measurable_example: "First/last/empty page correct; total accurate"
|
|
290
|
+
emits: absolute
|
|
291
|
+
- id: sorting
|
|
292
|
+
family: pagination
|
|
293
|
+
measurable_example: "Sort asc/desc actually orders; ties stable"
|
|
294
|
+
emits: absolute
|
|
295
|
+
- id: filtering
|
|
296
|
+
family: pagination
|
|
297
|
+
measurable_example: "Each filter narrows correctly; combined filters AND"
|
|
298
|
+
emits: absolute
|
|
299
|
+
- id: empty-state
|
|
300
|
+
family: empty_state
|
|
301
|
+
measurable_example: "No results \u2192 friendly empty state, not blank/error"
|
|
302
|
+
emits: presence
|
|
303
|
+
- id: invalid-input
|
|
304
|
+
family: negative
|
|
305
|
+
measurable_example: "Garbage query \u2192 no crash, sane result"
|
|
306
|
+
emits: forbidden-presence
|
|
307
|
+
- id: length-limits
|
|
308
|
+
family: bva
|
|
309
|
+
measurable_example: "Max-length query handled"
|
|
310
|
+
emits: absolute
|
|
311
|
+
- id: locale
|
|
312
|
+
family: i18n
|
|
313
|
+
measurable_example: "Locale-correct collation/casing"
|
|
314
|
+
emits: presence
|
|
315
|
+
`};var Ue=`
|
|
316
|
+
version: 1
|
|
317
|
+
principles:
|
|
318
|
+
- "Each step is one complete OBJECTIVE the browser agent achieves autonomously \u2014 state the goal and the path, never low-level actions (the agent emits its own actions)."
|
|
319
|
+
- "One objective (or tightly-related items of one goal) per step; unrelated goals split."
|
|
320
|
+
- "Verbose path: name site, page, section, panel, control, state \u2014 'On the search results page for Noida, in the filter panel's Budget section, set min to 50L and max to 1Cr'."
|
|
321
|
+
- "Self-contained: concrete values inline; never 'as defined in the scenario' \u2014 the agent cannot see the graph."
|
|
322
|
+
- "Browser-only: the agent authors/runs BROWSER tests. Direct API calls and the page's own network traffic ARE in scope; native-app-only behavior, out-of-band email/SMS, backend state with no browser surface are NOT."
|
|
323
|
+
verification:
|
|
324
|
+
- "Phrase checks against the analyzer that observes them:"
|
|
325
|
+
- "Visual \u2014 visible text, labels, counts, prices ('verify the price is 29.99', 'the Sold out label is shown')."
|
|
326
|
+
- "Textual/DOM \u2014 element states/attributes ('the Add button is disabled', 'the placeholder of the search box is \u2026')."
|
|
327
|
+
- "URL \u2014 'URL contains /checkout', 'redirected to /login'. Title \u2014 'page title contains \u2026'."
|
|
328
|
+
- "DevTools/Network \u2014 'no API calls returned 5xx', 'the POST /api/login returned 200' (covers direct API calls too)."
|
|
329
|
+
- "DevTools/Console \u2014 'no console errors'. Performance \u2014 'LCP under 2500ms'. Cookies/localStorage \u2014 'a cookie named session_id exists'."
|
|
330
|
+
- "Assertions: 'Assert/Verify/Confirm \u2026'. Extractions: 'Store \u2026 as name' \u2014 vague verbs (read/tell/report) do NOT persist values."
|
|
331
|
+
- "Baselines/deltas are EXTRACTIONS: 'store the result count as baseline_count' BEFORE the action; compare after. Never an abstract 'capture the state'."
|
|
332
|
+
variables:
|
|
333
|
+
- "Credentials and environment values are {{name}} variables; concrete domain values from the source stay literal."
|
|
334
|
+
- "A value no evidence supplies (start URL, test account, seed data) is ASKED for \u2014 actual value or a variable name \u2014 never invented."
|
|
335
|
+
pitfalls:
|
|
336
|
+
- "A test without a starting URL cannot run \u2014 the first step names it."
|
|
337
|
+
- "'Test the checkout flow' has no end state \u2014 state what done looks like."
|
|
338
|
+
- "Do not cram many unrelated operations into one step; do not reference data outside the step."
|
|
339
|
+
`;var it=["presence","forbidden-presence","count","delta","state-transition","absolute","bound","propagation","latency","graded"];function We(n,s){for(let e of n)if(!it.includes(e))throw new Error(`${s}: emits '${e}' is not an oracle kind`)}function ze(n,s){let e=oe(n);if(!e||!Array.isArray(e.techniques))throw new Error(`${s}: expected { techniques: [...] }`);for(let i of e.techniques){if(!i.id||!i.name||!i.applies_hint||!Array.isArray(i.emits))throw new Error(`${s}: technique '${i?.id??"?"}' missing id/name/applies_hint/emits`);We(i.emits,`${s}: technique '${i.id}'`)}return e.techniques}function He(n,s){let e=oe(n);if(!e||!e.id||!e.name||!e.applies_when||!Array.isArray(e.candidate_checks))throw new Error(`${s}: profile missing id/name/applies_when/candidate_checks`);for(let i of e.candidate_checks){if(!i.id||!i.family||!i.measurable_example||!i.emits)throw new Error(`${s}: candidate_check '${i?.id??"?"}' missing id/family/measurable_example/emits`);We([i.emits],`${s}: check '${i.id}'`)}return e}function Ve(n){let s=new Map(ze(Me,"packaged techniques").map(i=>[i.id,i])),e=Z(n,"design","techniques.yaml");if(le(e))for(let i of ze(ue(e,"utf8"),e))s.set(i.id,i);return[...s.values()]}function Ye(n){let s=new Map(Object.entries(Ge).map(([i,c])=>[i,He(c,`packaged profile '${i}'`)])),e=Z(n,"design","profiles");if(le(e))for(let i of nt(e).filter(c=>c.endsWith(".yaml")||c.endsWith(".yml")).sort()){let c=He(ue(Z(e,i),"utf8"),Z(e,i));s.set(c.id,c)}return[...s.values()]}function Qe(n){let s=Z(n,"design","runner-grammar.yaml");return le(s)?ue(s,"utf8"):Ue}function ee(n,s){return!n.superseded.has(s)}function me(n,s,e){return{cid:s,logical_id:n.nameOf.get(s)??null,content:e}}async function Ke(n,s,e,i,c){let l=await Re(n,"search_similar",{text:s,label:e,k:i},c);return l.ok&&Array.isArray(l.result)?l.result:[]}async function Je(n,s,e={}){let i=Y(n),c=i.resolve(s);if(!c)throw new Error(`assembleDesignContext: unknown use-case '${s}' (run designGate first)`);let l=c.tip,A=i.getNode(l);if(!A||A.label!==v.USECASE)throw new Error(`assembleDesignContext: '${s}' is not a use-case (run designGate first)`);let B=i.derivesInto(l).map(_=>({source_id:_.props.source_id??null,anchor:_.props.anchor??null})),R=[],f=new Set;for(let{cid:_,content:h}of i.byLabel(v.SCENARIO))ee(i,_)&&i.edgesFrom(_).some(o=>o.type===E.BELONGS_TO&&o.dst===l)&&(R.push(me(i,_,h)),f.add(_));let T=[];for(let{cid:_,content:h}of i.byLabel(v.AC)){if(!ee(i,_))continue;let o=i.edgesFrom(_).find(r=>r.type===E.SCOPED_TO);!o||o.dst!==l&&!f.has(o.dst)||T.push({...me(i,_,h),scoped_to:o.dst})}let w=Array.isArray(A.content.criteria)?A.content.criteria:[],S=[A.content.title,A.content.description,...w].filter(Boolean).join(`
|
|
340
|
+
`),P=(await Ke(i,S,v.SCENARIO,10,e.embedSearch)).filter(_=>!f.has(_.cid)),M=[],g=new Set,I=[],F=[l],j=new Set([l]);for(;F.length>0;){let _=F.shift();for(let h of i.edgesFrom(_)){if(h.type!==E.DEPENDS_ON||i.nodeLabel.get(h.dst)!==v.USECASE)continue;let o=i.tipOf(h.dst);j.has(o)||(j.add(o),I.push(o),F.push(o))}}for(let _ of I){let h=`depends_on ${i.nameOf.get(_)??_.slice(0,19)}`;for(let{cid:o}of i.byLabel(v.SCENARIO))if(ee(i,o)&&i.edgesFrom(o).some(r=>r.type===E.BELONGS_TO&&r.dst===_))for(let r of i.edgesInto(o)){if(r.type!==E.AUTOMATES||!ee(i,r.src)||g.has(r.src))continue;g.add(r.src);let u=String(i.getNode(r.src)?.content.title??"");M.push({cid:r.src,logical_id:i.nameOf.get(r.src)??null,title:u,via:h})}}for(let _ of await Ke(i,S,v.TEST,5,e.embedSearch)){let{cid:h,title:o}=_;g.has(h)||(g.add(h),M.push({cid:h,logical_id:i.nameOf.get(h)??null,title:o??"",via:"similar"}))}let O=i.byLabel(v.STYLENOTE).filter(_=>ee(i,_.cid)).sort((_,h)=>_.cid<h.cid?-1:1).slice(0,5).map(_=>`${String(_.content.statement)} [${String(_.content.learned_from_kind)}]`);return{usecase:me(i,l,A.content),cites:B,committed_acs:T,existing:{scenarios:R,reuse_candidates:P},import_candidates:M,style_notes:O,techniques:Ve(n),profiles:Ye(n),runner_grammar:Qe(n),budget:{...e.max!=null?{max_pairs:e.max}:{},...e.strength!=null?{strength_override:e.strength}:{}},design_of:(()=>{let _=Be(i,l);return _?{engine:_.engine,seq:_.seq}:null})()}}function Xe(n){let s=e=>{if(Array.isArray(e))return e.map(s);if(e!==null&&typeof e=="object"){let i={};for(let c of Object.keys(e).sort())i[c]=s(e[c]);return i}return e};return JSON.stringify(s(n),null,1)}var te=n=>({record:null,errors:n,minted:{},logicalIds:{},superseded:[],warnings:[],finalizedTests:{}});function se(n){return n.toLowerCase().trim().replace(/\s+/g," ")}function ge(n,s){let e=n.resolve(s);if(!e||n.nodeLabel.get(e.cid)!==v.USECASE||e.superseded)return[];let i=new Set;for(let{cid:c}of n.byLabel(v.SCENARIO))if(!n.superseded.has(c)&&n.edgesFrom(c).some(l=>l.type===E.BELONGS_TO&&n.tipOf(l.dst)===e.cid)){i.add(c);for(let l of n.edgesInto(c))l.type!==E.AUTOMATES||n.superseded.has(l.src)||i.add(l.src)}return[...i]}function Ze(n){let{contextDir:s,graph:e,sections:i,by:c}=n,l=n.engine??"design@1",A=we(s);if(e.latestHash!==A)return te([{code:"STALE_BASIS",detail:`graph opened at ${String(e.latestHash)} but chain head is ${String(A)} \u2014 re-open and retry`}]);let B=e.resolve(n.ucRef);if(!B||e.nodeLabel.get(B.cid)!==v.USECASE||B.superseded)return te([{code:"UNKNOWN_UC",detail:`${n.ucRef} is not a live use-case`}]);let R=B.cid,f=[],T=[],w=[],S=[],P=[],M=[],g={},I={},F={},j=[],O=[],_=new Set,h=[],o=new Set,r=new Set,u=[];{let t=n.forceScope??(n.force?ge(e,n.ucRef):[]),d=new Set;n.sections.scenarios?.length&&d.add(v.SCENARIO),n.sections.tests?.length&&d.add(v.TEST);for(let a of t)e.superseded.has(a)||(d.has(e.nodeLabel.get(a)??"")?r.add(a):u.push(a))}let C=new Set,x=t=>!e.superseded.has(t)&&(!r.has(t)||C.has(t)),N=(t,d,a)=>{if(g[t])return g[t];let y=e.resolve(t),p=y?x(y.cid)?y.cid:e.tipOf(y.cid):null;return!y||!p||!x(p)?(f.push({code:"UNKNOWN_REF",detail:`${d}: '${t}' is neither in this payload nor a live committed node`}),null):a&&e.nodeLabel.get(p)!==a?(f.push({code:"ILLEGAL_EDGE",detail:`${d}: '${t}' is a ${e.nodeLabel.get(p)}, expected ${a}`}),null):p},H=(t,d,a,y)=>{if(e.nameOf.has(d)){I[y]=e.nameOf.get(d);return}let p=xe(t,L=>_.has(L),e.names.keys());p!==null&&(_.add(p),P.push({cid:d,slug:p,by:c}),I[y]=p)},U=(t,d,a,y)=>{for(let L of _e(t,a))f.push({code:L.code,detail:`${d}: ${L.detail}`});let p=ve(t,a);return e.hasNode(p)&&!e.superseded.has(p)?(r.has(p)&&C.add(p),g[d]=p,p):(T.push({cid:p,label:t,content:a}),g[d]=p,H(t,p,y,d),p)},q=(t,d,a,y,p)=>{let L=ce(t,d,a,y);if(e.edgesFrom(d).some(m=>m.ecid===L&&!e.superseded.has(m.ecid))){t===E.AUTOMATES&&o.add(a);return}let Q=e.nodeLabel.get(d)??T.find(m=>m.cid===d)?.label??"(unknown)",D=e.nodeLabel.get(a)??T.find(m=>m.cid===a)?.label??"(unknown)";for(let m of ye(t,Q,D,y))f.push({code:m.code,detail:`${p}: ${m.detail}`});let $=ke(e,t,d,a,h);if($){f.push({code:$.code,detail:`${p}: ${$.detail}`});return}if(t===E.AUTOMATES){if(o.has(a)){f.push({code:"CARDINALITY_VIOLATION",detail:`${p}: two automates onto ${a} in one record (strict 1:1)`});return}if(o.add(a),!r.has(a)||C.has(a)){let m=G=>r.has(G)&&!C.has(G);if(e.edgesFrom(d).some(G=>G.type===E.AUTOMATES&&G.dst!==a&&!e.superseded.has(G.dst)&&!m(G.dst))&&e.hasNode(d)){f.push({code:"CARDINALITY_VIOLATION",detail:`${p}: automates from ${d} already has a live edge \u2014 supersede it first`});return}if(e.edgesInto(a).some(G=>G.type===E.AUTOMATES&&G.src!==d&&!e.superseded.has(G.src)&&!m(G.src))){f.push({code:"CARDINALITY_VIOLATION",detail:`${p}: automates onto ${a} already has a live edge \u2014 strict 1:1, supersede it first`});return}}}w.push({ecid:ce(t,d,a,y),type:t,src:d,dst:a,props:y}),h.push({src:d,dst:a,type:t})},W=new Set;for(let t of i.gaps??[]){let d=t.temp_ref??t.ref??"gap",a=t.question;if(!a||typeof a!="object"||!a.header||!Array.isArray(a.options)||a.options.length===0||!Number.isInteger(a.recommended_index)){f.push({code:"GAP_QUESTION_INCOMPLETE",detail:`${d}: design gaps carry a full ranked question object (header/options/recommended_index)`});continue}t.kind==="budget-evicted"&&t.ref&&W.add(t.ref);let y={kind:t.kind,question:a,derived:!0,uc:R,...t.risk?{risk:t.risk}:{},...t.risk_rationale?{risk_rationale:t.risk_rationale}:{},...t.text?{text:t.text}:{},...t.ref?{ref:t.ref}:{}};U(v.GAP,d,y,String(a.header))}let K=new Map;for(let{cid:t,content:d}of e.byLabel(v.SCENARIO))x(t)&&e.edgesFrom(t).some(a=>a.type===E.BELONGS_TO&&e.tipOf(a.dst)===R)&&K.set(se(String(d.title??"")),t);for(let t of i.scenarios??[]){let d=K.get(se(t.title));if(d){f.push({code:"DUPLICATE_SCENARIO",detail:`${t.temp_ref}: '${t.title}' duplicates live scenario ${e.nameOf.get(d)??d} \u2014 exercise/link it instead (reuse before minting)`});continue}let a={title:t.title,intent:t.intent,case_type:t.case_type,derived:!0,...t.technique_notes?{technique_notes:t.technique_notes}:{},...t.description?{description:t.description}:{},...t.parameters?{parameters:t.parameters}:{},...t.tags?{tags:t.tags}:{}};U(v.SCENARIO,t.temp_ref,a,t.title)}for(let t of i.scenarios??[]){let d=g[t.temp_ref];if(d){q(E.BELONGS_TO,d,R,{},t.temp_ref);for(let a of t.depends_on??[]){let y=N(a,`${t.temp_ref}.depends_on`,v.SCENARIO);y&&q(E.DEPENDS_ON,d,y,{},`${t.temp_ref}.depends_on`)}}}for(let t of i.acs??[]){let d={text:t.text,kind:t.kind,risk:t.risk,derived:!0,...t.expected_answer?{expected_answer:t.expected_answer}:{},...t.measurable!==void 0?{measurable:t.measurable}:{}},a=U(v.AC,t.temp_ref,d,t.text);if(!a)continue;let y=t.scope?.type==="scenario"&&t.scope.ref?N(t.scope.ref,`${t.temp_ref}.scope`,v.SCENARIO):R;y&&!e.edgesFrom(a).some(p=>p.type===E.SCOPED_TO&&!e.superseded.has(p.ecid))&&q(E.SCOPED_TO,a,y,{},`${t.temp_ref}.scope`);for(let p of t.cites??[]){let L={source_id:p.source_id,source_cid:p.source_cid,anchor:p.anchor,...p.quote?{quote:p.quote}:{}};q(E.DERIVES,p.source_cid,a,L,`${t.temp_ref}.cite`)}}for(let t of i.exercises??[]){let d=N(t.scenario,"exercises.scenario",v.SCENARIO),a=N(t.ac,"exercises.ac",v.AC);d&&a&&q(E.EXERCISES,d,a,{},`exercises ${t.scenario}\u2192${t.ac}`)}for(let t of i.scoped_to_repoints??[]){let d=N(t.ac,"scoped_to_repoints.ac",v.AC),a=N(t.to,"scoped_to_repoints.to");if(!d||!a)continue;let y=e.edgesFrom(d).find(p=>p.type===E.SCOPED_TO&&!e.superseded.has(p.ecid));y&&S.push({kind:"edge",ecid:y.ecid,reason:`re-scoped to ${t.to} by ${c.id}`,by:c}),q(E.SCOPED_TO,d,a,{},`scoped_to_repoints ${t.ac}`)}let J=new Map;if(n.finalizeTestBody)for(let[t,d]of e.nameOf)J.set(e.tipOf(t),d);let V=t=>e.nameOf.get(t)??J.get(e.tipOf(t))??null,X=t=>{let d=g[t];if(d)return I[t]??V(d);if(e.names.has(t))return e.resolve(t)?t:null;let a=e.resolve(t);return a?V(e.tipOf(a.cid)):null};for(let t of i.tests??[]){for(let D of t.reuses??[])W.has(D)&&f.push({code:"REUSES_EVICTED",detail:`${t.temp_ref}: reuses '${D}' which was budget-evicted \u2014 drop the edge; the dependent gap names the missing @import`});let d=t.test_md_blob,a=t.definitionId,y=t.objectives_blob;if(n.finalizeTestBody){let D;try{D=n.finalizeTestBody({temp_ref:t.temp_ref,test_md_blob:t.test_md_blob,verifies:t.verifies,reuses:t.reuses??[]},X)}catch($){return te([{code:"FINALIZE_BODY",detail:`${t.temp_ref}: ${$ instanceof Error?$.message:String($)}`}])}D&&(d=D.test_md_blob,a=D.definitionId,y=D.objectives_blob??y,F[t.temp_ref]=a)}let p={title:t.title,check:t.check,definitionId:a,derived:!0,...t.config?{config:t.config}:{},...d?{test_md_blob:d}:{},...y?{objectives_blob:y}:{},...t.surface_required!==void 0?{surface_required:t.surface_required}:{}},L=U(v.TEST,t.temp_ref,p,t.title);if(!L)continue;let Q=N(t.automates,`${t.temp_ref}.automates`,v.SCENARIO);Q&&q(E.AUTOMATES,L,Q,{},`${t.temp_ref}.automates`);for(let D of t.verifies){let $=N(D,`${t.temp_ref}.verifies`,v.AC);$&&q(E.VERIFIES,L,$,{},`${t.temp_ref}.verifies`)}for(let D of t.reuses??[]){if(W.has(D))continue;let $=N(D,`${t.temp_ref}.reuses`,v.TEST);$&&q(E.REUSES,L,$,{},`${t.temp_ref}.reuses`)}for(let D of t.verifies){let $=g[D]??e.resolve(D)?.cid;$&&(e.trust.get($)??"derived")==="derived"&&!T.some(m=>m.cid===$)?j.push(`${t.temp_ref}: verifies ${D} which is still DERIVED (unapproved) \u2014 committed anyway; approve it in chat or via review`):$&&g[D]===$&&(i.acs??[]).some(m=>m.temp_ref===D)&&j.push(`${t.temp_ref}: verifies ${D} minted in this same record (unapproved) \u2014 committed anyway; approve it in chat`)}if(t.verifies.length>1){let D=t.check?.verified_against;j.push(`${t.temp_ref}: verifies ${t.verifies.length} ACs but machine-asserts only 1 (check.verified_against=${D!=null?String(D):"?"}) \u2014 the rest ride prose only`)}}let re=[];{let t=(m,b)=>`${m??""}\0${se(String(b??""))}`,d=(m,b)=>n.reason?`${n.reason} \u2014 evolve by ${c.id}${b?` (${b})`:""}`:m,a=new Map;for(let m of T){if(m.label!==v.SCENARIO&&m.label!==v.TEST)continue;let b=t(m.label,m.content.title);a.set(b,[...a.get(b)??[],m.cid])}let y=new Map;for(let m of r){if(C.has(m))continue;let b=t(e.nodeLabel.get(m),e.getNode(m)?.content.title);y.set(b,[...y.get(b)??[],m])}for(let[m,b]of y){let k=a.get(m)??[],G=b.length===1&&k.length===1;for(let z of b)G?(S.push({kind:"node",old:z,new:k[0],reason:d(`--force redesign of ${n.ucRef} by ${c.id} (title-matched successor)`,"title-matched successor"),by:c}),re.push({old:z,next:k[0]})):S.push({kind:"node",old:z,new:null,reason:d(`--force redesign of ${n.ucRef} by ${c.id}`),by:c}),O.push(z)}let p=m=>e.edgesFrom(m).some(b=>b.type!==E.SCOPED_TO?!1:b.dst===R||e.tipOf(b.dst)===R?!0:e.nodeLabel.get(b.dst)===v.SCENARIO&&e.edgesFrom(b.dst).some(k=>k.type===E.BELONGS_TO&&e.tipOf(k.dst)===R)),L=new Map;for(let{cid:m,content:b}of e.byLabel(v.AC)){if(e.superseded.has(m)||!p(m))continue;let k=se(String(b.text??""));L.set(k,[...L.get(k)??[],m])}let Q=new Map;for(let m of T){if(m.label!==v.AC)continue;let b=se(String(m.content.text??""));Q.set(b,[...Q.get(b)??[],m.cid])}for(let[m,b]of L){let k=Q.get(m)??[];b.length!==1||k.length!==1||(S.push({kind:"node",old:b[0],new:k[0],reason:d(`AC re-emitted with changed content by ${c.id} (text-matched successor)`,"AC text-matched successor"),by:c}),re.push({old:b[0],next:k[0]}),O.push(b[0]))}let D=new Set(O),$=new Set;for(let m of S)m.kind==="edge"&&$.add(m.ecid);for(let{old:m,next:b}of re)for(let k of e.edgesInto(m))be(k.type)?.pin?.comparesTo!=="dst_tip"||e.superseded.has(k.src)||D.has(k.src)||$.has(k.ecid)||(S.push({kind:"edge",ecid:k.ecid,reason:`re-blessed onto ${b} (redirect successor of ${m}) by ${c.id}`,by:c}),$.add(k.ecid),w.some(z=>z.type===k.type&&z.src===k.src&&z.dst===b)||e.edgesFrom(k.src).some(z=>z.type===k.type&&z.dst===b))||k.type===E.AUTOMATES&&o.has(b)||q(k.type,k.src,b,k.props,`rebless ${k.type} from ${e.nameOf.get(k.src)??k.src}`)}return f.length>0?te(f):T.length===0&&w.length===0&&S.length===0&&M.length===0?Object.keys(g).length>0?(j.push("everything in this phase is already current \u2014 nothing re-committed"),{record:null,errors:null,minted:g,logicalIds:I,superseded:[],warnings:j,finalizedTests:F,...n.force||n.forceScope?{forceScopeRemaining:u}:{}}):te([{code:"EMPTY_DESIGN",detail:"finalize_design produced nothing to commit"}]):{record:Se(s,{ts:new Date().toISOString(),proposal_id:null,nodes:T,edges:w,review:[],supersessions:S,source_head_moves:{},...P.length>0?{names:P}:{},...(()=>{for(let t of i.judgements??[]){let d=t.target?g[t.target]??e.resolve(t.target)?.cid??R:R;M.push({about:d,rationale:`[${t.kind}] ${t.rationale}`,by:c})}return M.length>0?{judgements:M}:{}})(),design_of:{uc_cid:R,engine:l}}).record,errors:null,minted:g,logicalIds:I,superseded:O,warnings:j,finalizedTests:F,...n.force||n.forceScope?{forceScopeRemaining:u}:{}}}import{basename as rt,dirname as ot,resolve as at}from"path";var ct=new Set(["narrative","acs","scenarios","tests","exercises","gaps","scoped_to_repoints","judgements","phase"]);function dt(n){let s=/strength=(\d+)\s*(?:—|-)?\s*(.*)/.exec(n??"");return s?{strength:Number(s[1]),reason:s[2]||n||""}:{strength:2,reason:n??""}}function lt(n,s,e=new Set,i=0){return ne(s,ie(n),e,i)}function ut(n,s,e,i){let c=s.scenarios?.find(w=>w.temp_ref===e.automates)??(()=>{let w=n.resolve(e.automates),S=w?n.getNode(w.tip)?.content:void 0;return S?{title:String(S.title??""),intent:String(S.intent??""),technique_notes:String(S.technique_notes??"")}:{}})(),l=[...(s.acs??[]).map(w=>({ref:w.temp_ref,text:w.text})),...e.verifies.filter(w=>!(s.acs??[]).some(S=>S.temp_ref===w)).map(w=>{let S=n.resolve(w);return{ref:w,text:S?String(n.getNode(S.tip)?.content.text??""):""}})],{test_md:A,objectives_yaml:B}=he({title:e.title,steps:e.steps,check:e.check,check_prose:e.check_prose,reuses:e.reuses},{title:c.title,intent:c.intent},l),R=ae(lt(n,A)),f=e.check,T={technique:c.technique_notes??"",profile_family:s.judgements?.find(w=>w.kind==="profile_family"&&(w.target===e.temp_ref||w.target===e.automates))?.rationale??"unspecified",anchor:f.verified_against,expected_how:s.judgements?.find(w=>w.kind==="expected_how"&&w.target===f.verified_against)?.rationale??`expected_mode: ${f.expected_mode??"inferred"}`,combinatorial:dt(c.technique_notes),surface_state:"absent",deferred_bindings:f.expected_mode==="runtime-derived"?1:0};return i.push({definitionId:R,rationale:T,anchorRef:f.verified_against,tempRef:e.temp_ref}),{temp_ref:e.temp_ref,title:e.title,automates:e.automates,verifies:e.verifies,check:e.check,definitionId:R,test_md_blob:A,objectives_blob:B,...e.reuses?.length?{reuses:e.reuses}:{},...e.surface_required!==void 0?{surface_required:e.surface_required}:{}}}function et(n){let s=0,e=n.forceScope??null;return{terminalEventType:"design",async onProposalEvent(i){let c=r=>n.steer?(n.steer(`[auto-repair] ${r} \u2014 please re-finalize with this fixed.`),{proposal:null,error:null}):{proposal:null,error:r};if(i==null||typeof i!="object")return c("finalize_design payload is not an object");let l=i,A=Object.keys(l).filter(r=>!ct.has(r));if(A.length>0)return c(`finalize_design carries ungated/unknown section(s): ${A.join(", ")} \u2014 mintable here: acs, scenarios, tests (+gaps)`);let B=new Map;for(let r of l.tests??[]){let u=B.get(r.automates);if(u)return c(`strict 1:1 violated in-payload: ${u} and ${r.temp_ref} both automate ${r.automates}`);B.set(r.automates,r.temp_ref)}let R=Y(n.contextDir);n.force&&!n.resuming&&s===0&&e===null&&(e=ge(R,n.ucRef));let f=R.resolve(n.ucRef),T=f?String(R.getNode(f.tip)?.content.risk??"med"):"med",w=[],S=new Set([n.ucRef,f?.cid,f?.tip].filter(Boolean)),P=r=>{if(S.has(r))return!0;let u=R.resolve(r);return u!=null&&(S.has(u.cid)||S.has(u.tip))},M;try{M={...l.acs?.length?{acs:l.acs.map(r=>({temp_ref:r.temp_ref,text:r.text,kind:r.kind,risk:r.risk??T,...r.expected_answer?{expected_answer:r.expected_answer}:{},...r.scoped_to&&!P(r.scoped_to)?{scope:{type:"scenario",ref:r.scoped_to}}:{}}))}:{},...l.scenarios?.length?{scenarios:l.scenarios}:{},...l.tests?.length?{tests:l.tests.map(r=>ut(R,l,r,w))}:{},...l.exercises?.length?{exercises:l.exercises}:{},...l.gaps?.length?{gaps:l.gaps}:{},...l.scoped_to_repoints?.length?{scoped_to_repoints:l.scoped_to_repoints}:{},...l.judgements?.length?{judgements:l.judgements}:{}}}catch(r){return c(r instanceof Error?r.message:String(r))}let g=Ze({contextDir:n.contextDir,graph:R,ucRef:n.ucRef,sections:M,by:n.by,...n.engine?{engine:n.engine}:{},...e?.length?{forceScope:e}:{},...n.because?{reason:n.because}:{},finalizeTestBody:(()=>{let r=new Map((M.tests??[]).map(x=>[x.temp_ref,x])),u=new Map,C=(x,N,H)=>{let U=r.get(x);if(!U?.test_md_blob)return null;let q=u.get(x);if(q!==void 0)return q;if(H.has(x))return U.test_md_blob;H.add(x);let W=new Map;for(let V of U.reuses??[]){C(V,N,H);let X=N(V);X!==null&&X!==V&&W.set(V,X)}let K=U.verifies.map(N).filter(V=>V!==null),J=pe(fe(U.test_md_blob,W),K);return u.set(x,J),J};return(x,N)=>{if(!x.test_md_blob)return null;let H=C(x.temp_ref,N,new Set)??x.test_md_blob;if(H===x.test_md_blob)return null;let U=q=>{for(let W of r.keys())if(N(W)===q){let K=C(W,N,new Set);if(K!==null)return{body:K,cycleKey:`batch:${q}`,next:U}}return ie(R)(q)};return{test_md_blob:H,definitionId:ae(ne(H,U))}}})()});if(g.errors)return c("design commit failed: "+g.errors.map(r=>`${r.code}: ${r.detail}`).join("; "));let I=g.warnings.filter(r=>r.includes("\u2014 committed anyway; approve"));for(let r of g.warnings)(!I.includes(r)||I.length===1)&&n.note(`warning: ${r}`);I.length>1&&n.note(`warning: ${I.length} verifies edges target not-yet-approved items \u2014 committed anyway; approve them in chat or via review`);let F=(r,u)=>r?`${r} ${u}${r>1?"s":""}`:null,j=[F(l.acs?.length,"AC"),F(l.scenarios?.length,"scenario"),F(l.tests?.length,"test"),F(l.gaps?.length,"gap")].filter(Boolean);n.aliases?.(Object.entries(g.minted).map(([r,u])=>({ref:r,cid:u,...g.logicalIds[r]?{id:g.logicalIds[r]}:{}})));{let r=`saved ${j.join(" \xB7 ")||"judgements/wiring"} as drafts`;(n.commitLine??n.note)(r)}let O=Y(n.contextDir);n.onCommitted?.(O);for(let r of w){let u=g.logicalIds[r.anchorRef]??g.minted[r.anchorRef];je(n.contextDir,g.finalizedTests[r.tempRef]??r.definitionId,{...r.rationale,anchor:u??r.rationale.anchor})}try{let r=Object.values(g.minted).filter(u=>O.getNode(u)?.label==="test");if(r.length>0){let u=ot(at(n.contextDir)),C=Fe({graph:O,cids:r,cwd:u});C.wrote.length>0&&n.note(`\u2692 wrote ${C.wrote.map(x=>rt(x.path)).join(" \xB7 ")}`);for(let x of C.refused)n.note(`warning: mint refused ${x.id} \u2014 ${x.reason}`)}}catch(r){n.note(`warning: file mint failed (${r instanceof Error?r.message:String(r)}) \u2014 the design commit stands`)}n.event?.({type:"commit",acs:l.acs?.length??0,scenarios:l.scenarios?.length??0,tests:l.tests?.length??0,gaps:l.gaps?.length??0,warnings:g.warnings.length,minted:Object.entries(g.minted).map(([r,u])=>({temp_ref:r,cid:u,...g.logicalIds[r]?{logical_id:g.logicalIds[r]}:{}}))}),s+=1,e!==null&&(e=g.forceScopeRemaining??e,n.onForceScope?.(e));let _=De({verb:"design",commitN:s,ucRef:n.ucRef,phase:l.phase??(l.tests?.length?"tests":l.scenarios?.length?"scenarios":l.acs?.length?"acs":"design"),committed:Object.entries(g.minted).map(([r,u])=>({temp_ref:r,cid:u,...g.logicalIds[r]?{logical_id:g.logicalIds[r]}:{}})),warnings:g.warnings},O),h=_.event.parity?.missing??[],o=!!l.tests?.length&&h.length===0;return{proposal:g,error:null,receipt:_,...o?{sessionComplete:o}:{}}}}}function tt(n,s){return{type:"run_config",version:1,session_id:s.session_id,mode:s.mode,source:{source_id:`design:${n.usecase.logical_id??s.ucCid.slice(0,19)}`,source_cid:s.ucCid,kind:"design_context",numbered_text:Xe({...n,session_mode:s.mode})},existing_use_cases:[],read_basis:s.readBasis,max_free_text_rounds:2,graph_reads:!0,verb:"design",chat:!0,design_budget:n.budget,topology:s.topology}}function ft(n,s){return{terminalEventType:"design",async onProposalEvent(e){let i=e??{},c=["acs","scenarios","tests","gaps"].map(l=>i[l]?.length?`${i[l].length} ${l}`:null).filter(Boolean).join(" \xB7 ");return n(`plan: finalize_design \u2014 ${c||"wiring/judgements only"} (nothing committed)`),n(JSON.stringify(i,null,2)),s?.({type:"plan",payload:i}),{proposal:i,error:null}}}}async function ms(n,s){let e=Y(s.contextDir),i=null,c=n.useCase;if(n.resume){try{let u=qe(s.contextDir,n.resume,e);i=u.handle,u.staleBasis.length>0&&(s.out(`note: sources changed since the pause: ${u.staleBasis.join(", ")} \u2014 the design continues against the current versions`),s.emit?.({type:"stale_basis",sources:u.staleBasis}))}catch(u){if(u instanceof Te)return s.out(`error: ${u.message}`),s.emit?.({type:"error",message:`error: ${u.message}`}),u.code==="SESSION_MISSING"||u.code==="SESSION_EXPIRED"?2:1;throw u}let o=i.state;if(o.verb&&o.verb!=="design")return s.out(`error: session ${n.resume} is a ${o.verb} session \u2014 resume it with kane-cli context extract --resume ${n.resume}`),s.emit?.({type:"error",message:`error: session ${n.resume} is a ${o.verb} session \u2014 resume it with kane-cli context extract --resume ${n.resume}`}),i.release(),2;if(c=c??o.use_case,o.uc_tip&&c){let u=e.resolve(c)?.tip;u&&u!==o.uc_tip&&(s.out("note: the use-case changed since the pause \u2014 the design continues against the new version"),s.emit?.({type:"stale_basis",usecase:c}))}let r=i.state.held_receipts??[];if(r.length>0)if(s.chat?.holdReceipt)for(let u of r)s.chat.holdReceipt(u);else s={...s,initialMessage:[r.join(`
|
|
341
|
+
|
|
342
|
+
`),s.initialMessage].filter(Boolean).join(`
|
|
343
|
+
|
|
344
|
+
`)};if(!c)return s.out(`error: session ${n.resume} predates use-case persistence \u2014 re-supply --use-case <ref>`),s.emit?.({type:"error",message:`error: session ${n.resume} predates use-case persistence \u2014 re-supply --use-case <ref>`}),i.release(),2}let l=!!(n.force||i?.state.force),A=!!(n.resume&&i),B=Pe(e,c,l||A);if(!B.ok)return s.out(`design: ${B.message}`),s.emit?.({type:"gate_refused",message:B.message}),i?.release(),B.code;if(s.preflightTurn){let o=await s.preflightTurn();if(!o.ok)return s.out(o.message??"error: turn-endpoint preflight failed"),s.emit?.({type:"error",message:o.message??"error: turn-endpoint preflight failed",code:"PREFLIGHT"}),i?.release(),2}let R={contextDir:s.contextDir,resolveAlias:o=>$e(o,{env:process.env,auth:s.auth}),embed:(o,r)=>Ce(o,r,{env:process.env,auth:s.auth})};s.chat?.setWorking?.("assembling context\u2026");let f=await Je(s.contextDir,c,{max:n.max,strength:n.strength,embedSearch:R});n.priorDesign!==void 0&&(f.prior_design=n.priorDesign),n.changeDelta!==void 0&&(f.change_delta=n.changeDelta),n.because&&(f.because=n.because);let T=s.now?.()??new Date,w=`${T.toISOString().replace(/[-:]/g,"").slice(0,15)}-${pt(2).toString("hex")}`,S=n.mode??"interactive",P=tt(f,{session_id:n.resume??`design-${w}`,mode:S,ucCid:f.usecase.cid,readBasis:e.latestHash,topology:Ie("design")});n.plan?P.chat=!1:P.chat=!0,n.resume&&i&&(P.resume={agent_state:i.state.agent_state},s.out(`resuming design session ${n.resume}`),i.state.assumed.length>0&&s.out(`note: ${i.state.assumed.length} default(s) were assumed while you were away \u2014 kane-cli context sessions show ${n.resume} lists them`),n.message&&(s={...s,initialMessage:[s.initialMessage,n.message].filter(Boolean).join(`
|
|
345
|
+
|
|
346
|
+
`)}));let M=st(s.contextDir,"logs");mt(M,{recursive:!0});let g=st(M,`design-${w}.log`);s.out(`trace: ${de(g)}`),s.emit?.({type:"run_start",mode:S,trace:g,use_case:c});let I=(o,r,u)=>{try{gt(g,JSON.stringify({ts:new Date().toISOString(),kind:o,session_id:u,data:r})+`
|
|
347
|
+
`)}catch{}},F=null,j={current:e};s.nested||s.chat?.attachOnCommitted?.(o=>{j.current=o});let O="";if(s.chat&&!n.plan&&!s.nested){let o=Ee({contextDir:s.contextDir,graph:Y(s.contextDir),sessionStamp:P.session_id,by:s.by??{kind:"human",id:"owner"}});o.errors===null||o.errors[0]?.code==="CONV_SOURCE_EXISTS"?(O=o.sourceId,s.chat.attachConversationSource?.(O),j.current=Y(s.contextDir)):s.out(`warning: conversation source unavailable (${o.errors[0]?.detail}) \u2014 chat adds will not land this session`)}let _=n.plan?ft(s.out,s.emit):et({contextDir:s.contextDir,ucRef:c,by:{kind:"ai",id:"design-agent"},force:l,engine:"design@1",note:o=>s.chat?s.chat.note(o):s.out(o),commitLine:o=>s.chat?s.chat.ledger({kind:"commit",ok:!0,line:o}):s.out(o),steer:s.chat&&!s.nested?o=>s.chat.submit(o):void 0,event:s.emit,resuming:A,...i?.state.force_scope?.length?{forceScope:i.state.force_scope}:{},onForceScope:o=>{F=o},...n.because?{because:n.because}:{},aliases:s.chat?o=>s.chat.registerAliases?.(o):void 0,onCommitted:o=>{j.current=o}});s.chat||s.out(`designing: ${f.usecase.logical_id??c} (budget ${f.budget.max_pairs!=null?`${f.budget.max_pairs} pairs`:"no ceiling"}${f.budget.strength_override?`, strength ${f.budget.strength_override}`:""})`),s.chat?.setWorking?.(`designing ${f.usecase.logical_id??c}\u2026`);let h;try{h=await Ae(P,{...s,graphSlot:j},new Map,e,I,_)}catch(o){throw I("error",{message:o instanceof Error?o.message:String(o),stack:o instanceof Error?o.stack:void 0},P.session_id),i?.release(),o}finally{s.chat?.setWorking?.(null)}if(h.highRisk)return s.out(`error: ${h.highRisk.length} high-risk decision${h.highRisk.length===1?"":"s"} need a human \u2014 ci mode won't guess. Re-run with --mode agent to pause for review.`),s.emit?.({type:"error",message:`error: high-risk question(s) in ci mode (fail-closed): ${h.highRisk.map(o=>o.id).join(", ")}`,code:"HIGH_RISK_CI"}),i?.release(),1;if(h.paused){let o=i;o||(o=Oe(s.contextDir,{sid:P.session_id,mode:"agent",created_at:T.toISOString(),expires_at:new Date(T.getTime()+1440*60*1e3).toISOString(),agent_state:h.paused.agent_state,pending:{questions:[],proposals:[]},read_basis:Object.fromEntries((e.resolve(c)?e.edgesInto(e.resolve(c).tip):[]).filter(x=>x.type==="DERIVES"&&typeof x.props.source_id=="string").map(x=>[String(x.props.source_id),e.heads.get(String(x.props.source_id))??null])),assumed:[],corpus_cursor:{remaining:[]},conv_source:O,verb:"design",use_case:c,...e.resolve(c)?.tip?{uc_tip:e.resolve(c).tip}:{},...l?{force:!0}:{}})),l&&!o.state.force&&o.save({force:!0}),O&&o.state.conv_source!==O&&o.save({conv_source:O});let r=s.chat?.drainHeldReceipts?.()??[];(r.length>0||(o.state.held_receipts?.length??0)>0)&&o.save({held_receipts:r}),F!==null&&o.save({force_scope:F}),Ne(o,h.paused),I("session_paused",{sid:o.state.sid},P.session_id);let u=S!=="interactive"?` --mode ${S}`:"",C=`kane-cli design tests --resume ${o.state.sid}${u}`;return s.out(`paused \u2014 resume with: ${C}`),s.emit?.({type:"session_paused",sid:o.state.sid,mode:S,resume:C,expires_at:o.state.expires_at,pending_questions:h.paused.pending.questions}),s.chat?.ledger?.({kind:"pause",sid:o.state.sid,expires_at:o.state.expires_at,resume:C,messageForm:`${C} --message "<your words>"`}),3}if(h.error)return s.out(`error: design agent failed: ${h.error}`),s.emit?.({type:"error",message:`error: design agent failed: ${h.error}`}),i?.release(),1;if(h.proposal==null&&S!=="interactive")return s.out(`error: the design agent ended without a finalize event \u2014 nothing committed (trace: ${g})`),s.emit?.({type:"error",message:`error: the design agent ended without a finalize event \u2014 nothing committed (trace: ${g})`}),i?.release(),1;if(h.proposal==null&&s.out("done \u2014 nothing designed this session (no finalize before the session ended)"),h.assumedDefaults&&s.out(`assumed: ${h.assumedDefaults} default(s) auto-taken (flagged)`),i&&s.emit?.({type:"session_complete",sid:n.resume}),i?.complete(),!s.nested){let o=s.chat?.state.ledger.filter(C=>C.kind==="answer"&&C.receipt.form==="assumed").length??0,r=(h.assumedDefaults??0)+o,u=s.chat?.state.credits?.total??h.creditsTotal;s.chat?.ledger?.({kind:"summary",lines:[`designed: ${f.usecase.logical_id??c}${h.proposal==null?" (nothing committed this session)":""}`,...r>0?[`${r} assumed default(s)`]:[],...u!==void 0?[`credits used: ${u.toFixed(1)}`]:[],`trace: ${de(g)}`]})}return n.plan||Le(s.contextDir),0}export{ms as a};
|