@graphrefly/graphrefly 0.39.0 → 0.40.0
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/{cascading-g2_rhhaM.d.ts → cascading-BNfxffgc.d.ts} +1 -1
- package/dist/{cascading-BzuxW0_w.d.cts → cascading-Cxs1eztH.d.cts} +1 -1
- package/dist/{chunk-7JRF5YEK.js → chunk-2BX4NB34.js} +1 -1
- package/dist/{chunk-TFPZLQ5H.js → chunk-2DMKW2AD.js} +1 -1
- package/dist/{chunk-7NZMZJMW.js → chunk-2QXRYP7Q.js} +1 -1
- package/dist/{chunk-NQI2C36M.js → chunk-32N3JALT.js} +1 -1
- package/dist/{chunk-CGDMTXSY.js → chunk-6I726LZU.js} +1 -1
- package/dist/{chunk-S2U57TFC.js → chunk-6VWBPSSY.js} +1 -1
- package/dist/chunk-6XVD5TZV.js +1 -0
- package/dist/{chunk-VJJLIEAL.js → chunk-756D5TFD.js} +1 -1
- package/dist/{chunk-XQ55HO5N.js → chunk-7Q4ZD3YW.js} +1 -1
- package/dist/{chunk-ZOX3LBRV.js → chunk-B7LCDQEV.js} +1 -1
- package/dist/{chunk-IA7DUNGB.js → chunk-CKFQS2CJ.js} +1 -1
- package/dist/{chunk-R75BMDLA.js → chunk-ECQRP2UT.js} +1 -1
- package/dist/{chunk-L7WY6TZS.js → chunk-FHRBBHJN.js} +1 -1
- package/dist/{chunk-JNMC2WJ6.js → chunk-I2DEVPMU.js} +1 -1
- package/dist/chunk-INQFTVZA.js +61 -0
- package/dist/{chunk-N7UIBZCW.js → chunk-J63M5U46.js} +1 -1
- package/dist/{chunk-7SD73DS6.js → chunk-JKBOIJ22.js} +1 -1
- package/dist/chunk-K2Z7UENB.js +1 -0
- package/dist/{chunk-INH6FS2G.js → chunk-LCGAVGGV.js} +1 -1
- package/dist/{chunk-LQNOXGET.js → chunk-LYM4PBMV.js} +1 -1
- package/dist/{chunk-KD4NHLMU.js → chunk-MNZIKXK4.js} +1 -1
- package/dist/{chunk-RF3QZP6D.js → chunk-N43XM7BM.js} +1 -1
- package/dist/{chunk-5XRI6RM3.js → chunk-OSZ22J7O.js} +1 -1
- package/dist/{chunk-WHIZM6JV.js → chunk-PPUYQ66A.js} +1 -1
- package/dist/{chunk-SC7BQDNP.js → chunk-QSK3RRII.js} +1 -1
- package/dist/chunk-RZJDIV2G.js +1 -0
- package/dist/{chunk-HX3EGQ5Z.js → chunk-SSCGRYJ2.js} +1 -1
- package/dist/chunk-SVFKHUCW.js +1 -0
- package/dist/chunk-TSOYJ743.js +1 -0
- package/dist/{chunk-HAWKGIXM.js → chunk-UWA6D7UF.js} +1 -1
- package/dist/{chunk-GX5LSSRE.js → chunk-VMF23LGB.js} +1 -1
- package/dist/{chunk-5LK7XMEV.js → chunk-WL6LFPJB.js} +1 -1
- package/dist/{chunk-D47YVDR5.js → chunk-WUT362QV.js} +1 -1
- package/dist/{chunk-INHC33EH.js → chunk-XJLYLLIJ.js} +1 -1
- package/dist/{chunk-GEAO3TL3.js → chunk-XW4YDF6G.js} +1 -1
- package/dist/{chunk-XEUANKBO.js → chunk-YKD7WUYJ.js} +1 -1
- package/dist/{chunk-AU7YTQX7.js → chunk-YXDRGKXP.js} +1 -1
- package/dist/{chunk-7QFRK3N3.js → chunk-Z4F3DOWS.js} +1 -1
- package/dist/compat/index.d.cts +6 -6
- package/dist/compat/index.d.ts +6 -6
- package/dist/compat/index.js +1 -1
- package/dist/compat/nestjs/index.d.cts +4 -4
- package/dist/compat/nestjs/index.d.ts +4 -4
- package/dist/compat/nestjs/index.js +1 -1
- package/dist/compat/zustand/index.d.cts +2 -2
- package/dist/compat/zustand/index.d.ts +2 -2
- package/dist/compat/zustand/index.js +1 -1
- package/dist/{composite-DGatA-JK.d.ts → decay-BnrlbxSv.d.ts} +38 -2
- package/dist/{composite-CKd0e2vz.d.cts → decay-C25AyNAj.d.cts} +38 -2
- package/dist/extra/index.cjs +15 -15
- package/dist/extra/index.d.cts +6 -6
- package/dist/extra/index.d.ts +6 -6
- package/dist/extra/index.js +1 -1
- package/dist/extra/node.js +1 -1
- package/dist/extra/operators.js +1 -1
- package/dist/extra/reactive.d.cts +1 -1
- package/dist/extra/reactive.d.ts +1 -1
- package/dist/extra/reactive.js +1 -1
- package/dist/extra/render/index.d.cts +1 -1
- package/dist/extra/render/index.d.ts +1 -1
- package/dist/extra/sources.cjs +1 -1
- package/dist/extra/sources.js +1 -1
- package/dist/graph/index.d.cts +3 -3
- package/dist/graph/index.d.ts +3 -3
- package/dist/graph/index.js +1 -1
- package/dist/{graph-30XSgtVX.d.ts → graph-BkIkog4h.d.ts} +1 -1
- package/dist/{graph-BUwMAxJI.d.cts → graph-E6likq7w.d.cts} +1 -1
- package/dist/{index-BXd6OMEy.d.ts → index-3k4Gg6-n.d.ts} +2 -2
- package/dist/{index-DszPlZzK.d.ts → index-40ZT4MHj.d.ts} +1 -1
- package/dist/index-8s-Qm-gz.d.ts +218 -0
- package/dist/{index-K-vl_c6A.d.cts → index-A3U3CSve.d.cts} +1 -1
- package/dist/{index-jKLph6cu.d.ts → index-B6iTqKtJ.d.ts} +1 -1
- package/dist/{index-WyFKER-c.d.ts → index-B72TQQHd.d.cts} +3 -3
- package/dist/{index-CmqiJZKM.d.ts → index-BAQrjuZF.d.ts} +64 -6
- package/dist/{index-CusEP3Sv.d.ts → index-BQ1fR4li.d.ts} +1 -1
- package/dist/{index-xZYcDqFH.d.cts → index-BTHOTC0Q.d.cts} +2 -2
- package/dist/{index-jr6PuSBt.d.ts → index-BaA-xpSw.d.ts} +2 -2
- package/dist/{index-FVoPvhAu.d.cts → index-Bd91Nmf4.d.cts} +2 -2
- package/dist/{index-PqbnoScQ.d.ts → index-BgjS2b8N.d.ts} +2 -2
- package/dist/{index-DCbE8fFM.d.cts → index-BiHUBEKq.d.cts} +2 -2
- package/dist/{index-DlgHqQxW.d.cts → index-BilOa6AE.d.cts} +6 -32
- package/dist/{index-DoYc8BWK.d.cts → index-BmSQLAZo.d.cts} +2 -2
- package/dist/{index-DlrWu9Hs.d.cts → index-C-dkXOpB.d.cts} +1 -1
- package/dist/{index-C7VV_qOs.d.ts → index-C5cQ7Gfx.d.ts} +2 -2
- package/dist/{index-CPhBvRJU.d.ts → index-C6ZUaos7.d.ts} +1 -1
- package/dist/{index-PlJ3MraE.d.ts → index-CAP3UGsq.d.ts} +1 -1
- package/dist/{index-B41Asm7D.d.ts → index-CD2dBMet.d.ts} +2 -2
- package/dist/index-CGhMJNHb.d.cts +128 -0
- package/dist/{index-BAlaVimV.d.ts → index-CQtWm7jS.d.ts} +2 -2
- package/dist/{index-8R1vzNOx.d.cts → index-CRm0YIzC.d.cts} +2 -2
- package/dist/index-CUIkE1l9.d.cts +230 -0
- package/dist/{index-KlZ_ZUip.d.cts → index-Cczxgd2D.d.ts} +3 -3
- package/dist/{index-DIHcMLr6.d.cts → index-CgnCFhr2.d.cts} +1 -1
- package/dist/{index-BC9VybQs.d.ts → index-Ck35nA-T.d.ts} +2 -2
- package/dist/{index-BndG0cpK.d.cts → index-Cnr1WrlX.d.cts} +1 -1
- package/dist/{index-H_I66pav.d.cts → index-CtFNGe-m.d.cts} +2 -2
- package/dist/index-CuPUehFa.d.cts +218 -0
- package/dist/index-D1Gc7wV5.d.ts +230 -0
- package/dist/{index-iTX5IqSP.d.ts → index-D1IEZUsj.d.ts} +5 -5
- package/dist/{index-CWHtYmSh.d.cts → index-D4uimgee.d.cts} +1 -1
- package/dist/{index-CwP_KAMS.d.cts → index-DGTo1yka.d.cts} +64 -6
- package/dist/{index-BUPVld1w.d.ts → index-DH4fm2Ck.d.ts} +2 -2
- package/dist/{index-mNwgxC21.d.cts → index-DJ_MPOJ5.d.cts} +5 -5
- package/dist/{index-DyM4tFAe.d.cts → index-DQQCOIt8.d.cts} +2 -2
- package/dist/{index-BJ26eEjs.d.cts → index-DVAlsmEU.d.cts} +2 -2
- package/dist/{index-DINuaZlJ.d.cts → index-DVDapw2k.d.cts} +1 -1
- package/dist/{index-DTtBpuQy.d.cts → index-DgJc8Zgc.d.cts} +5 -3
- package/dist/{index-BKMdnYnk.d.ts → index-DhLyOHYZ.d.ts} +1 -1
- package/dist/{index-89FczVZ_.d.ts → index-DhnsQfa3.d.ts} +77 -51
- package/dist/{index-L8XI8Zql.d.cts → index-DktLSZOc.d.cts} +2 -2
- package/dist/{index-pVDQcbar.d.cts → index-DpiGqtrs.d.cts} +77 -51
- package/dist/{index-B9fmw5n2.d.ts → index-I1cCY3ZI.d.ts} +5 -3
- package/dist/{index-C19qqa38.d.ts → index-IUCY0OFN.d.ts} +2 -2
- package/dist/index-N2MAxt7_.d.ts +128 -0
- package/dist/{index-Br3WnqEn.d.ts → index-WSlcjhQF.d.ts} +6 -32
- package/dist/{index-DQUVq1_d.d.ts → index-bXXLSvor.d.ts} +2 -2
- package/dist/{index-BhUaMYm_.d.ts → index-da2V5vPy.d.ts} +1 -1
- package/dist/{index-PsVHpPwP.d.cts → index-t6L2qpHh.d.cts} +2 -2
- package/dist/{index-IwFqHxCs.d.cts → index-tV3AA9hI.d.cts} +1 -1
- package/dist/index.cjs +48 -48
- package/dist/index.d.cts +33 -33
- package/dist/index.d.ts +33 -33
- package/dist/index.js +1 -1
- package/dist/patterns/ai/browser.cjs +5 -5
- package/dist/patterns/ai/browser.d.cts +2 -2
- package/dist/patterns/ai/browser.d.ts +2 -2
- package/dist/patterns/ai/browser.js +1 -1
- package/dist/patterns/ai/index.cjs +14 -14
- package/dist/patterns/ai/index.d.cts +11 -11
- package/dist/patterns/ai/index.d.ts +11 -11
- package/dist/patterns/ai/index.js +1 -1
- package/dist/patterns/ai/node.js +1 -1
- package/dist/patterns/audit/index.d.cts +3 -3
- package/dist/patterns/audit/index.d.ts +3 -3
- package/dist/patterns/audit/index.js +1 -1
- package/dist/patterns/cqrs/index.d.cts +3 -3
- package/dist/patterns/cqrs/index.d.ts +3 -3
- package/dist/patterns/cqrs/index.js +1 -1
- package/dist/patterns/demo-shell/index.d.cts +3 -3
- package/dist/patterns/demo-shell/index.d.ts +3 -3
- package/dist/patterns/demo-shell/index.js +1 -1
- package/dist/patterns/domain-templates/index.d.cts +2 -2
- package/dist/patterns/domain-templates/index.d.ts +2 -2
- package/dist/patterns/domain-templates/index.js +1 -1
- package/dist/patterns/graphspec/index.d.cts +2 -2
- package/dist/patterns/graphspec/index.d.ts +2 -2
- package/dist/patterns/graphspec/index.js +1 -1
- package/dist/patterns/guarded-execution/index.cjs +3 -3
- package/dist/patterns/guarded-execution/index.d.cts +4 -4
- package/dist/patterns/guarded-execution/index.d.ts +4 -4
- package/dist/patterns/guarded-execution/index.js +1 -1
- package/dist/patterns/harness/index.cjs +1 -1
- package/dist/patterns/harness/index.d.cts +7 -7
- package/dist/patterns/harness/index.d.ts +7 -7
- package/dist/patterns/harness/index.js +1 -1
- package/dist/patterns/job-queue/index.d.cts +3 -3
- package/dist/patterns/job-queue/index.d.ts +3 -3
- package/dist/patterns/job-queue/index.js +1 -1
- package/dist/patterns/lens/index.cjs +3 -3
- package/dist/patterns/lens/index.d.cts +3 -4
- package/dist/patterns/lens/index.d.ts +3 -4
- package/dist/patterns/lens/index.js +1 -1
- package/dist/patterns/memory/index.cjs +1 -1
- package/dist/patterns/memory/index.d.cts +3 -3
- package/dist/patterns/memory/index.d.ts +3 -3
- package/dist/patterns/memory/index.js +1 -1
- package/dist/patterns/messaging/index.d.cts +2 -2
- package/dist/patterns/messaging/index.d.ts +2 -2
- package/dist/patterns/messaging/index.js +1 -1
- package/dist/patterns/orchestration/index.d.cts +3 -3
- package/dist/patterns/orchestration/index.d.ts +3 -3
- package/dist/patterns/orchestration/index.js +1 -1
- package/dist/patterns/process/index.d.cts +4 -4
- package/dist/patterns/process/index.d.ts +4 -4
- package/dist/patterns/process/index.js +1 -1
- package/dist/patterns/reactive-layout/index.d.cts +3 -3
- package/dist/patterns/reactive-layout/index.d.ts +3 -3
- package/dist/patterns/reactive-layout/index.js +1 -1
- package/dist/patterns/reduction/index.d.cts +2 -2
- package/dist/patterns/reduction/index.d.ts +2 -2
- package/dist/patterns/reduction/index.js +1 -1
- package/dist/patterns/refine-loop/index.d.cts +3 -3
- package/dist/patterns/refine-loop/index.d.ts +3 -3
- package/dist/patterns/refine-loop/index.js +1 -1
- package/dist/patterns/resilient-pipeline/index.cjs +3 -1
- package/dist/patterns/resilient-pipeline/index.d.cts +7 -3
- package/dist/patterns/resilient-pipeline/index.d.ts +7 -3
- package/dist/patterns/resilient-pipeline/index.js +1 -1
- package/dist/patterns/surface/index.d.cts +3 -3
- package/dist/patterns/surface/index.d.ts +3 -3
- package/dist/patterns/surface/index.js +1 -1
- package/dist/{pipeline-graph-D8vKcO_p.d.ts → pipeline-graph-CB4La-UW.d.ts} +2 -2
- package/dist/{pipeline-graph-BQPr2Lqs.d.cts → pipeline-graph-MWrQZXCq.d.cts} +2 -2
- package/dist/{reactive-layout-8CSc0tiA.d.cts → reactive-layout-BtZfUKuL.d.cts} +1 -1
- package/dist/{reactive-layout-DkTXxtSy.d.ts → reactive-layout-KJj4E2dT.d.ts} +1 -1
- package/dist/{reactive-map-B2qfD3hb.d.cts → reactive-map-6P_k3AQM.d.cts} +1 -1
- package/dist/{reactive-map-jFIsE6Kt.d.ts → reactive-map-CjXByDV-.d.ts} +1 -1
- package/dist/{resilience-HTF2LBRS.js → resilience-S33JV6XC.js} +1 -1
- package/dist/{topology-tree-B5Ngw3j0.d.cts → topology-tree-3LBKFsUo.d.cts} +1 -1
- package/dist/{topology-tree-BtvbgMXJ.d.ts → topology-tree-mF7Emqzm.d.ts} +1 -1
- package/package.json +1 -1
- package/dist/chunk-73PBQNST.js +0 -1
- package/dist/chunk-A6ZSKGUG.js +0 -1
- package/dist/chunk-EWF7KCDJ.js +0 -61
- package/dist/chunk-IUB4NYI2.js +0 -1
- package/dist/chunk-MC4UYY2X.js +0 -1
- package/dist/chunk-ZJ7SM3G2.js +0 -1
- package/dist/index-BEHmxORq.d.ts +0 -135
- package/dist/index-BM9szD8n.d.cts +0 -113
- package/dist/index-BskfDoZ_.d.ts +0 -113
- package/dist/index-CIRG8Hxp.d.cts +0 -135
- package/dist/index-Cey6VTnX.d.ts +0 -166
- package/dist/index-CpLpJb6A.d.cts +0 -166
|
@@ -42,5 +42,5 @@ Output JSON:
|
|
|
42
42
|
}`;function bt(r,e,t){if(typeof r=="function")return r;let n=r??e;return s=>t(n,s)}oe();Ie();Ne();ge();oe();var gn=class{_version=0;_store=new Map;_maxSize;_defaultTtl;constructor(e={}){let{maxSize:t,defaultTtl:n}=e;if(t!==void 0&&t<1)throw new RangeError("maxSize must be >= 1");if(n!==void 0&&n<=0)throw new RangeError("defaultTtl must be positive");this._maxSize=t,this._defaultTtl=n}get version(){return this._version}get size(){return this._store.size}has(e){let t=this._store.get(e);return t===void 0?!1:this._isExpired(t)?(this._store.delete(e),this._version+=1,!1):(this._touchLru(e,t),!0)}get(e){let t=this._store.get(e);if(t!==void 0){if(this._isExpired(t)){this._store.delete(e),this._version+=1;return}return this._touchLru(e,t),t.value}}set(e,t,n){let s=this._resolveExpiresAt(n);this._store.has(e)&&this._store.delete(e),this._store.set(e,{value:t,expiresAt:s}),this._evictLruWhileOver(),this._version+=1}setMany(e,t){let n=this._resolveExpiresAt(t),s=0;try{for(let[o,i]of e)this._store.has(o)&&this._store.delete(o),this._store.set(o,{value:i,expiresAt:n}),s+=1}finally{s>0&&(this._evictLruWhileOver(),this._version+=1)}}delete(e){let t=this._store.delete(e);return t&&(this._version+=1),t}deleteMany(e){let t=0;try{for(let n of e)this._store.delete(n)&&(t+=1)}finally{t>0&&(this._version+=1)}return t}clear(){let e=this._store.size;return e===0?0:(this._store.clear(),this._version+=1,e)}pruneExpired(){let e=K(),t=0;for(let[n,s]of this._store)this._isExpired(s,e)&&(this._store.delete(n),t+=1);return t>0&&(this._version+=1),t}toMap(){let e=K(),t=new Map;for(let[n,s]of this._store)this._isExpired(s,e)||t.set(n,s.value);return t}_resolveExpiresAt(e){let t=e??this._defaultTtl;if(t!==void 0){if(!Number.isFinite(t)||t<=0)throw new RangeError(`MapBackend: ttl must be a positive finite number (got ${t})`);return K()+t*1e9}}_isExpired(e,t){return e.expiresAt===void 0?!1:(t??K())>=e.expiresAt}_touchLru(e,t){this._store.delete(e),this._store.set(e,t)}_evictLruWhileOver(){if(this._maxSize!==void 0)for(;this._store.size>this._maxSize;){let e=this._store.keys().next().value;if(e===void 0)break;this._store.delete(e)}}};function it(r={}){let{name:e,maxSize:t,defaultTtl:n,versioning:s,backend:o,retention:i}=r;if(i&&t!==void 0)throw new RangeError("reactiveMap: `maxSize` (LRU) and `retention` (score-based) are mutually exclusive. Pick one eviction policy.");if(i&&i.archiveThreshold===void 0&&i.maxSize===void 0)throw new RangeError("reactiveMap: `retention` requires at least one of `archiveThreshold` or `maxSize` to trigger archival.");let a=o??new gn({maxSize:t,defaultTtl:n}),u=L(a.toMap(),{name:e,describeKind:"state",equals:(l,h)=>l===h,...s!=null?{versioning:s}:{}});function d(){let l=a.toMap();te(()=>{u.down([[ee]]),u.down([[C,l]])})}function c(){if(!i)return;let l=a.toMap(),h=i.archiveThreshold,f=i.maxSize,g=[];for(let[T,y]of l)g.push({key:T,value:y,score:i.score(T,y)});g.sort((T,y)=>T.score-y.score);let m=new Set;if(h!==void 0)for(let T of g)if(T.score<h)m.add(T.key);else break;if(f!==void 0&&g.length-m.size>f)for(let T of g){if(g.length-m.size<=f)break;m.has(T.key)||m.add(T.key)}if(m.size!==0)for(let T of g)m.has(T.key)&&(i.onArchive?.(T.key,T.value,T.score),a.delete(T.key))}function p(l,h="mutation"){let f=a.version;try{return l()}finally{a.version!==f&&(h==="mutation"&&c(),d())}}return{entries:u,has(l){return p(()=>a.has(l),"read")},get(l){return p(()=>a.get(l),"read")},set(l,h,f){p(()=>a.set(l,h,f?.ttl))},setMany(l,h){p(()=>a.setMany(l,h?.ttl))},delete(l){p(()=>a.delete(l))},deleteMany(l){p(()=>a.deleteMany(l))},clear(){p(()=>a.clear())},pruneExpired(){p(()=>a.pruneExpired())},get size(){return a.size},dispose(){}}}$e();function ko(r){let e=it({name:r?.name??"effectiveness-entries"}),t=I([e.entries],([i])=>new Map(i),{name:`${r?.name??"effectiveness"}-snapshot`,equals:(i,a)=>{let u=i,d=a;if(u.size!==d.size)return!1;for(let[c,p]of u){let l=d.get(c);if(!l||p.attempts!==l.attempts||p.successes!==l.successes)return!1}return!0}});function n(i,a){let u=e.get(i),d=(u?.attempts??0)+1,c=(u?.successes??0)+(a?1:0);e.set(i,{key:i,attempts:d,successes:c,successRate:c/d})}function s(i){return e.get(i)}let o=ye(t);return{node:t,record:n,lookup:s,dispose:()=>{o(),e.dispose()}}}oe();oe();Ie();Ne();ge();De();oe();At();Ie();Ne();et();ge();mt();De();oe();Ne();function bn(r,e){if(Object.is(r,e))return!0;if(r==null||e==null||typeof r!="object"||typeof e!="object")return!1;if(Array.isArray(r)){if(!Array.isArray(e)||r.length!==e.length)return!1;for(let o=0;o<r.length;o++)if(!bn(r[o],e[o]))return!1;return!0}if(Array.isArray(e))return!1;let t=Object.keys(r),n=Object.keys(e);if(t.length!==n.length)return!1;let s=new Set(n);for(let o of t)if(!s.has(o)||!bn(r[o],e[o]))return!1;return!0}function ir(r,e){return`${r}\0${e}`}function yn(r,e){let t=[],n=new Set(r.subgraphs),s=new Set(e.subgraphs),o=[];for(let m of s)n.has(m)||o.push(m);o.sort();for(let m of o)t.push({type:"subgraph-mounted",path:m});let i=new Set(Object.keys(r.nodes)),a=new Set(Object.keys(e.nodes)),u=[];for(let m of a)i.has(m)||u.push(m);u.sort();for(let m of u)t.push({type:"node-added",path:m,node:{...e.nodes[m]}});let d=[];for(let m of a){if(!i.has(m))continue;let T=r.nodes[m]?.meta,y=e.nodes[m]?.meta;T==null&&y==null||bn(T??{},y??{})||d.push(m)}d.sort();for(let m of d)t.push({type:"node-meta-changed",path:m,prevMeta:r.nodes[m]?.meta??{},nextMeta:e.nodes[m]?.meta??{}});let c=new Map;for(let m of r.edges)c.set(ir(m.from,m.to),m);let p=new Map;for(let m of e.edges)p.set(ir(m.from,m.to),m);let l=[];for(let[m,T]of p)c.has(m)||l.push(T);l.sort((m,T)=>m.from<T.from?-1:m.from>T.from?1:m.to<T.to?-1:m.to>T.to?1:0);for(let m of l)t.push({type:"edge-added",from:m.from,to:m.to});let h=[];for(let[m,T]of c)p.has(m)||h.push(T);h.sort((m,T)=>m.from<T.from?-1:m.from>T.from?1:m.to<T.to?-1:m.to>T.to?1:0);for(let m of h)t.push({type:"edge-removed",from:m.from,to:m.to});let f=[];for(let m of i)a.has(m)||f.push(m);f.sort();for(let m of f)t.push({type:"node-removed",path:m});let g=[];for(let m of n)s.has(m)||g.push(m);g.sort();for(let m of g)t.push({type:"subgraph-unmounted",path:m});return{events:t,flushedAt_ns:K()}}$e();ar();ur();tn();function dr(r,e,t,n={}){let s=e in r.nodes,o=t in r.nodes;if(!s)return Lt(e,t,"no-such-from");if(!o)return Lt(e,t,"no-such-to");let i=n.maxDepth;if(i!=null&&(!Number.isInteger(i)||i<0))throw new Error("explainPath: maxDepth must be an integer >= 0");if(e===t){if(n.findCycle===!0){let d=Ro(r,e,n);if(d!=null)return d}let u=Ft(e,r.nodes[e],0,n);return $t(e,t,[u])}if(i===0)return Lt(e,t,"no-path");let a=cr(r,e,t,i);return a.found?$t(e,t,lr(r,a.pathOrder,n)):Lt(e,t,a.truncated?"max-depth-exceeded":"no-path")}function cr(r,e,t,n){let s=new Map,o=[{path:t,depth:0}],i=new Set([t]),a=0,u=!1;for(;a<o.length;){let p=o[a++];if(p.path===e)break;if(n!=null&&p.depth>=n){let g=r.nodes[p.path];g?.deps&&g.deps.length>0&&(u=!0);continue}let l=r.nodes[p.path];if(l==null)continue;let h=l.deps??[],f=new Map;for(let g=0;g<h.length;g++){let m=h[g];if(!m)continue;let T=f.get(m);T==null&&(T=[],f.set(m,T)),T.push(g)}for(let[g,m]of f)i.has(g)||(i.add(g),s.set(g,{from:p.path,depIndices:m}),o.push({path:g,depth:p.depth+1}))}if(!s.has(e))return{found:!1,pathOrder:[],truncated:u};let d=[{path:e}],c=e;for(;c!==t;){let p=s.get(c);if(p==null)return{found:!1,pathOrder:[],truncated:!1};d[d.length-1].depIndices=p.depIndices,d.push({path:p.from}),c=p.from}return{found:!0,pathOrder:d,truncated:!1}}function Ro(r,e,t){let n=r.nodes[e];if(n==null)return null;let s=n.deps??[],o=[];for(let a=0;a<s.length;a++)s[a]===e&&o.push(a);if(o.length>0){let a=Ft(e,n,0,t);a.dep_index=o[0];let u=Ft(e,n,1,t);return $t(e,e,[a,u])}let i=null;for(let a=0;a<s.length;a++){let u=s[a];if(!u||u===e)continue;let d=cr(r,u,e,t.maxDepth);d.found&&(i==null||d.pathOrder.length<i.pathOrder.length)&&(i=d,i={found:!0,pathOrder:[{path:e,depIndices:[a]},...d.pathOrder],truncated:!1})}return i==null?null:$t(e,e,lr(r,i.pathOrder,t))}function lr(r,e,t){return e.map((n,s)=>{let o=r.nodes[n.path],i=Ft(n.path,o,s,t);return n.depIndices!=null&&n.depIndices.length>0&&(i.dep_index=n.depIndices[0],n.depIndices.length>1&&(i.dep_indices=[...n.depIndices])),i})}function Ft(r,e,t,n){let s={path:r,type:e.type,hop:t};e.status!==void 0&&(s.status=e.status),"value"in e&&(s.value=e.value),e.v!=null&&(s.v=e.v);let o=n.annotations?.get(r)??e.annotation;o!=null&&(s.annotation=o);let i=n.lastMutations?.get(r)??e.lastMutation;return i!=null&&(s.lastMutation=i),s}function $t(r,e,t){return fr(r,e,!0,"ok",t)}function Lt(r,e,t){return fr(r,e,!1,t,[])}function fr(r,e,t,n,s){let o=Oo(r,e,t,n,s);return{from:r,to:e,found:t,reason:n,steps:s,text:o,toJSON(){return{from:r,to:e,found:t,reason:n,steps:s}}}}function Oo(r,e,t,n,s){if(!t)switch(n){case"no-such-from":return`explainPath: no node named "${r}"`;case"no-such-to":return`explainPath: no node named "${e}"`;case"max-depth-exceeded":return`explainPath: no path from "${r}" to "${e}" within maxDepth`;default:return`explainPath: no path from "${r}" to "${e}"`}let o=[`Causal path: ${r} \u2192 ${e} (${s.length} step(s))`];for(let i of s){let u=` ${i.hop===0?"\xB7":"\u2193"} ${i.path} (${i.type}${i.status?`/${i.status}`:""})`;if(o.push(u),"value"in i&&o.push(` value: ${So(i.value)}`),i.annotation!=null&&o.push(` annotation: ${i.annotation}`),i.lastMutation!=null){let d=i.lastMutation.actor;o.push(` actor: ${d.type}${d.id?`:${d.id}`:""}`)}}return o.join(`
|
|
43
43
|
`)}function So(r){if(r===void 0)return"<sentinel>";if(r===null)return"null";if(typeof r=="string")return JSON.stringify(r);if(typeof r=="number"||typeof r=="boolean"||typeof r=="bigint")return String(r);try{let e=JSON.stringify(r);return e.length>80?`${e.slice(0,77)}...`:e}catch{return String(r)}}De();var se={object:56,array:64,string:40,number:8,boolean:4,null:0,undefined:0,symbol:40,bigint:16,function:120,map:72,set:72,mapEntry:40,setEntry:24,date:24,regexp:48,error:64,url:80,promise:48,weakmap:40,weakset:40},Ao=Symbol.for("sizeof");function pr(r){let e=new WeakSet,t=new WeakSet,n=[r],s=0;for(;n.length>0;){let o=n.pop();s+=Do(o,e,t,n)}return s}function Do(r,e,t,n){if(r==null)return 0;switch(typeof r){case"number":return se.number;case"boolean":return se.boolean;case"string":return se.string+r.length*2;case"bigint":return se.bigint+Co(r);case"symbol":return se.symbol;case"function":return e.has(r)?0:(e.add(r),se.function);case"undefined":return 0}let o=r;if(e.has(o))return 0;e.add(o);let i=o[Ao];if(typeof i=="function")try{let d=i.call(o);if(typeof d=="number"&&Number.isFinite(d))return d}catch{}if(o instanceof Date)return se.date;if(o instanceof RegExp)return se.regexp+o.source.length*2;if(o instanceof Error){let d=o.message?o.message.length*2:0,c=o.stack?o.stack.length*2:0;return se.error+d+c}if(typeof URL<"u"&&o instanceof URL)return se.url+o.href.length*2;if(typeof Promise<"u"&&o instanceof Promise)return se.promise;if(o instanceof WeakMap)return se.weakmap;if(o instanceof WeakSet)return se.weakset;if(o instanceof Map){let d=se.map;for(let[c,p]of o)d+=se.mapEntry,n.push(c),n.push(p);return d}if(o instanceof Set){let d=se.set;for(let c of o)d+=se.setEntry,n.push(c);return d}if(Array.isArray(o)){let d=se.array+o.length*8;for(let c of o)n.push(c);return d}if(o instanceof ArrayBuffer)return t.has(o)?0:(t.add(o),o.byteLength);if(ArrayBuffer.isView(o)){let d=o;return t.has(d.buffer)?48:(t.add(d.buffer),d.buffer.byteLength+48)}let a=se.object,u=Object.keys(o);for(let d of u){a+=se.string+d.length*2;try{n.push(o[d])}catch{}}return a}function Co(r){let e=r<0n?-r:r;if(e===0n)return 0;let t=e.toString(2).length;return Math.ceil(t/32)*8}function Vt(r,e){let t=e?.topN??10,n=r.describe({detail:"standard"}),s=[],o=r._collectObserveTargets;typeof o=="function"&&o.call(r,"",s);let i=new Map;for(let[l,h]of s)i.set(l,h);let a=[];for(let[l,h]of Object.entries(n.nodes)){let f=i.get(l),g=f instanceof re?f:null,m=g?pr(g.cache):0,T=g?g._sinkCount:0,y=h.deps?.length??0,v=h.type==="effect"&&T===0,_=T===0?h.type==="effect"?"orphan-effect":h.type==="derived"?"idle-derived":h.type==="producer"?"idle-producer":null:null;a.push({path:l,type:h.type,status:h.status??"unknown",valueSizeBytes:m,subscriberCount:T,depCount:y,isOrphanEffect:v,orphanKind:_})}let u=a.reduce((l,h)=>l+h.valueSizeBytes,0),d=(l,h)=>[...a].sort(h??((f,g)=>g[l]-f[l])).slice(0,t),c=a.filter(l=>l.orphanKind!=null),p=a.filter(l=>l.isOrphanEffect);return{nodeCount:a.length,edgeCount:n.edges.length,subgraphCount:n.subgraphs.length,nodes:a,totalValueSizeBytes:u,hotspots:{byValueSize:d("valueSizeBytes"),bySubscriberCount:d("subscriberCount"),byDepCount:d("depCount")},orphans:c,orphanEffects:p}}var X="::",Re="__meta__",We=1;function hr(r,e){let t=Math.max(16,r.size*4),n=0;for(;r.size>0;){if(n++>=t){console.error(`[Graph "${e}".destroy] disposer drain exceeded cap (${t}); ${r.size} disposer(s) discarded`),r.clear();return}let s=r.values().next();if(s.done)return;let o=s.value;r.delete(o);try{o()}catch(i){console.error(`[Graph "${e}".destroy] disposer threw:`,i)}}}function vr(r){return r!=null&&typeof r=="object"&&"cache"in r&&typeof r.subscribe=="function"&&typeof r.down=="function"}function Mo(r){if(r!=null)return vr(r)?r.cache:r}function Je(r){return r!=null&&typeof r=="object"&&"cache"in r&&typeof r.subscribe=="function"&&typeof r.down=="function"}function je(r){return Je(r)?r.cache??"":r}function mr(r){return Je(r)?r.cache??0:r}function gr(r){return Je(r)?r.cache??!1:r}function Io(r){let e=[];for(let t of Object.keys(r).sort()){let n=r[t].v;n!=null&&e.push(`${t} ${n.id} ${n.version}`)}return e.join(`
|
|
44
44
|
`)}function br(r){if(r.version!==We)throw new Error(`unsupported snapshot version ${String(r.version)} (expected ${We})`);for(let e of["name","nodes","edges","subgraphs"])if(!(e in r))throw new Error(`snapshot missing required key "${e}"`);if(typeof r.name!="string")throw new TypeError("snapshot 'name' must be a string");if(typeof r.nodes!="object"||r.nodes===null||Array.isArray(r.nodes))throw new TypeError("snapshot 'nodes' must be an object");if(!Array.isArray(r.edges))throw new TypeError("snapshot 'edges' must be an array");if(!Array.isArray(r.subgraphs))throw new TypeError("snapshot 'subgraphs' must be an array")}function Go(r,e){let t=new WeakMap,n=(s,o)=>{if(Object.is(s,o))return!0;if(s==null||o==null||typeof s!="object"||typeof o!="object")return!1;let i=t.get(s);if(i==null&&(i=new WeakSet,t.set(s,i)),i.has(o))return!0;i.add(o);let a=s.constructor,u=o.constructor;if(a!==u)return!1;if(s instanceof Date)return s.getTime()===o.getTime();if(s instanceof RegExp)return s.source===o.source&&s.flags===o.flags;if(Array.isArray(s)){let l=o;if(s.length!==l.length)return!1;for(let h=0;h<s.length;h++)if(!n(s[h],l[h]))return!1;return!0}if(s instanceof Map){let l=o;if(s.size!==l.size)return!1;for(let[h,f]of s)if(!l.has(h)||!n(f,l.get(h)))return!1;return!0}if(s instanceof Set){let l=o;if(s.size!==l.size)return!1;for(let h of s){let f=!1;for(let g of l)if(n(h,g)){f=!0;break}if(!f)return!1}return!0}if(ArrayBuffer.isView(s)){let l=s,h=o;if(l.length!==h.length)return!1;for(let f=0;f<l.length;f++)if(l[f]!==h[f])return!1;return!0}let d=Object.keys(s),c=Object.keys(o);if(d.length!==c.length)return!1;let p=new Set(c);for(let l of d)if(!p.has(l)||!n(s[l],o[l]))return!1;return!0};return n(r,e)}function Po(r){return r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function jt(r){let e="^";for(let t=0;t<r.length;t+=1){let n=r[t];if(n==="*"){e+=".*";continue}if(n==="?"){e+=".";continue}if(n==="["){let s=r.indexOf("]",t+1);if(s<=t+1){e+="\\[";continue}let o=r.slice(t+1,s);o.startsWith("!")&&(o=`^${o.slice(1)}`),o=o.replace(/\\/g,"\\\\"),e+=`[${o}]`,t=s;continue}e+=Po(n)}return e+="$",new RegExp(e)}var Lo={data:"\x1B[32m",dirty:"\x1B[33m",resolved:"\x1B[36m",invalidate:"\x1B[93m",pause:"\x1B[90m",resume:"\x1B[96m",complete:"\x1B[34m",error:"\x1B[31m",teardown:"\x1B[91m",derived:"\x1B[35m",path:"\x1B[90m",reset:"\x1B[0m"},Fo={data:"",dirty:"",resolved:"",invalidate:"",pause:"",resume:"",complete:"",error:"",teardown:"",derived:"",path:"",reset:""};function vn(r){if(typeof r=="string")return JSON.stringify(r);if(typeof r=="number"||typeof r=="boolean"||r==null)return String(r);try{return JSON.stringify(r)}catch{return"[unserializable]"}}function $o(r){return r==="none"?Fo:r==="ansi"||r==null?Lo:{data:r.data??"",dirty:r.dirty??"",resolved:r.resolved??"",invalidate:r.invalidate??"",pause:r.pause??"",resume:r.resume??"",complete:r.complete??"",error:r.error??"",teardown:r.teardown??"",derived:r.derived??"",path:r.path??"",reset:r.reset??""}}function yr(r){if(r==null)return{};let e=r.detail;return e==="full"?{...r,structured:r.structured??!0,timeline:r.timeline??!0,causal:r.causal??!0,derived:r.derived??!0}:e==="minimal"?{...r,structured:r.structured??!0}:r.format==="stage-log"?{...r,structured:r.structured??!0,timeline:r.timeline??!0}:r}function Vo(r,e,t){for(let n=0;n<r.length;n++){let s=r.charCodeAt(n);if(s<32||s===127)throw new Error(`Graph "${e}": ${t} "${r}" must not contain control character (U+${s.toString(16).padStart(4,"0").toUpperCase()} at index ${n})`)}}function Tn(r,e,t){if(r==="")throw new Error(`Graph "${e}": ${t} name must be non-empty`);if(r.includes(X))throw new Error(`Graph "${e}": ${t} "${r}" must not contain '${X}' (path separator)`);if(r===Re)throw new Error(`Graph "${e}": ${t} name "${Re}" is reserved for meta companion paths`);Vo(r,e,t)}function jo(r,e){if(r==="")throw new Error(`Graph "${e}": resolve path must be non-empty`);let t=r.split(X);for(let n of t)if(n==="")throw new Error(`Graph "${e}": resolve path has empty segment`);return t}function zo(r,e){let t=!1;for(let s of r)if(!e.isMetaPassthrough(s[0])){t=!0;break}return t?r.filter(s=>e.isMetaPassthrough(s[0])):r}function Tr(r){for(let e of r._mounts.values())Tr(e);for(let e of r._nodes.values())try{e.down([[ue]],{internal:!0})}catch{}}var ce=class r{name;opts;config;_nodes=new Map;_nodeToName=new WeakMap;_mounts=new Map;_parent=void 0;_storageDisposers=new Set;_disposers=new Set;_destroyed=!1;_topology;_topologyEmitters=new Set;_factory;_factoryArgs;constructor(e,t){if(e==="")throw new Error("Graph name must be non-empty");if(e.includes(X))throw new Error(`Graph name must not contain '${X}' (got "${e}")`);if(e===Re)throw new Error(`Graph name "${Re}" is reserved for meta companion paths`);this.name=e,this.opts=Object.freeze({...t??{}}),this.config=t?.config??tt,this._traceRing=new yt(t?.traceCapacity??1e3),t?.versioning!=null&&this.setVersioning(t.versioning),typeof t?.factory=="string"&&(this._factory=t.factory,t.factoryArgs!==void 0&&(this._factoryArgs=t.factoryArgs))}tagFactory(e,t){return this._factory=e,this._factoryArgs=t,this}ancestors(e=!0){let t=[],n=e?this:this._parent;for(;n!=null;)t.push(n),n=n._parent;return t}get topology(){return this._topology==null&&(this._topology=de(e=>{let t=n=>{e.emit(n)};return this._topologyEmitters.add(t),()=>{this._topologyEmitters.delete(t)}},{name:`${this.name}_topology`})),this._topology}_emitTopology(e){if(!(this._topology==null||this._topologyEmitters.size===0))for(let t of this._topologyEmitters)t(e)}nameOf(e){return this._nodeToName.get(e)}add(e,t){let n=e.name,s=t?.name??n;if(s==null||s==="")throw new Error(`Graph "${this.name}": graph.add requires a non-empty name \u2014 pass via opts.name or set it on the node (e.g. state(0, { name: "x" }))`);let o=s,i=t?.annotation;if(Tn(o,this.name,"add"),this._mounts.has(o))throw new Error(`Graph "${this.name}": name "${o}" is already a mount point`);if(this._nodes.has(o))throw new Error(`Graph "${this.name}": node "${o}" already exists`);let a=this._nodeToName.get(e);if(a!==void 0)throw new Error(`Graph "${this.name}": node instance already registered as "${a}"`);return this._nodes.set(o,e),this._nodeToName.set(e,o),this._emitTopology({kind:"added",name:o,nodeKind:"node"}),i!=null&&(this._annotations.set(o,i),this.config.inspectorEnabled&&this._traceRing.push({path:o,annotation:i,timestamp_ns:K()})),e}setVersioning(e){if(e!=null)for(let t of this._nodes.values())t instanceof re&&t._applyVersioning(e)}remove(e){Tn(e,this.name,"remove");let t=this._mounts.get(e);if(t){let o={kind:"mount",nodes:[],mounts:[]},i=[];t._collectObserveTargets("",i);for(let[a,u]of i)a.includes(`${X}${Re}${X}`)||o.nodes.push(a);return o.nodes.sort(),o.mounts.push(e),o.mounts.push(...t._collectSubgraphs(`${e}${X}`)),this._mounts.delete(e),t._parent=void 0,Tr(t),this._emitTopology({kind:"removed",name:e,nodeKind:"mount",audit:o}),o}let n=this._nodes.get(e);if(!n)throw new Error(`Graph "${this.name}": unknown node or mount "${e}"`);this._nodes.delete(e),this._nodeToName.delete(n),n.down([[ue]],{internal:!0});let s={kind:"node",nodes:[e],mounts:[]};return this._emitTopology({kind:"removed",name:e,nodeKind:"node",audit:s}),s}removeAll(e){let t=typeof e=="function"?e:(()=>{let o=jt(e);return i=>o.test(i)})(),n={kind:"mount",nodes:[],mounts:[]},s=[...this._nodes.keys(),...this._mounts.keys()].filter(o=>t(o));for(let o of s){let i=this.remove(o);n.nodes.push(...i.nodes),n.mounts.push(...i.mounts)}return n.nodes.sort(),n.mounts.sort(),n}[Symbol.iterator](){let e=[...this._nodes.keys()].sort(),t=this._nodes,n=0;return{[Symbol.iterator](){return this},next(){if(n>=e.length)return{value:void 0,done:!0};let s=e[n++];return{value:[s,t.get(s)],done:!1}}}}node(e){if(e==="")throw new Error(`Graph "${this.name}": node name must be non-empty`);if(e.includes(X))return this.resolve(e);let t=this._nodes.get(e);if(!t)throw new Error(`Graph "${this.name}": unknown node "${e}"`);return t}get(e){return this.node(e).cache}set(e,t,n){let s=n?.internal===!0;this.node(e).down([[C,t]],{actor:n?.actor,internal:s,delivery:"write"})}setAll(e,t){let n=Symbol.iterator in e?e:Object.entries(e);te(()=>{for(let[s,o]of n)this.set(s,o,t)})}invalidate(e,t){let n=t?.internal===!0;this.node(e).down([[xe]],{actor:t?.actor,internal:n,delivery:"write"})}error(e,t,n){let s=n?.internal===!0;this.node(e).down([[G,t]],{actor:n?.actor,internal:s,delivery:"write"})}complete(e,t){let n=t?.internal===!0;this.node(e).down([[j]],{actor:t?.actor,internal:n,delivery:"write"})}edges(e){let t=e?.recursive===!0,n=new Map;if(!t){for(let[u,d]of this._nodes)n.set(d,u);let a=[];for(let[u,d]of this._nodes)if(d instanceof re)for(let c of d._deps){let p=n.get(c.node);p!=null&&a.push([p,u])}return a.sort((u,d)=>u[0]<d[0]?-1:u[0]>d[0]?1:u[1]<d[1]?-1:u[1]>d[1]?1:0),a}let s=[];this._collectObserveTargets("",s);let o=new Map;for(let[a,u]of s)o.set(u,a);let i=[];for(let[a,u]of s)if(u instanceof re)for(let d of u._deps){let c=o.get(d.node);c!=null&&i.push([c,a])}return i.sort((a,u)=>a[0]<u[0]?-1:a[0]>u[0]?1:a[1]<u[1]?-1:a[1]>u[1]?1:0),i}mount(e,t){if(t===void 0){let s=new r(e);return this.mount(e,s)}if(typeof t=="function"){let s=new r(e);return t(s),this.mount(e,s)}let n=t;if(Tn(e,this.name,"mount"),this._nodes.has(e))throw new Error(`Graph "${this.name}": cannot mount at "${e}" \u2014 node with that name exists`);if(this._mounts.has(e))throw new Error(`Graph "${this.name}": mount "${e}" already exists`);if(n===this)throw new Error(`Graph "${this.name}": cannot mount a graph into itself`);if(n._parent!=null)throw new Error(`Graph "${this.name}": this child graph is already mounted on "${n._parent.name}"`);for(let s=this;s!=null;s=s._parent)if(s===n)throw new Error(`Graph "${this.name}": mount("${e}", \u2026) would create a mount cycle`);return this._mounts.set(e,n),n._parent=this,this._emitTopology({kind:"added",name:e,nodeKind:"mount"}),n}resolve(e){let t=jo(e,this.name);return this._resolveFromSegments(t)}tryResolve(e){try{return this.resolve(e)}catch{return}}_resolveFromSegments(e){let t=e;if(t[0]===this.name&&(t=t.slice(1),t.length===0))throw new Error(`Graph "${this.name}": resolve path ends at graph name only`);let n=t[0],s=t.slice(1);if(s.length===0){let a=this._nodes.get(n);if(a)return a;throw this._mounts.has(n)?new Error(`Graph "${this.name}": path ends at subgraph "${n}" \u2014 not a node (GRAPHREFLY-SPEC \xA73.5)`):new Error(`Graph "${this.name}": unknown name "${n}"`)}let o=this._nodes.get(n);if(o&&s.length>0&&s[0]===Re)return this._resolveMetaChainFromNode(o,s,t.join(X));let i=this._mounts.get(n);if(!i)throw this._nodes.has(n)?new Error(`Graph "${this.name}": "${n}" is a node; trailing path "${s.join(X)}" is invalid`):new Error(`Graph "${this.name}": unknown mount or node "${n}"`);return i.resolve(s.join(X))}_resolveMetaChainFromNode(e,t,n){let s=e,o=0,i=[...t];for(;o<i.length;){if(i[o]!==Re)throw new Error(`Graph "${this.name}": expected ${Re} segment in meta path "${n}"`);if(o+1>=i.length)throw new Error(`Graph "${this.name}": meta path requires a key after ${Re} in "${n}"`);let a=i[o+1],u=s.meta[a];if(!u)throw new Error(`Graph "${this.name}": unknown meta "${a}" in path "${n}"`);s=u,o+=2}return s}signal(e,t){if(t?.internal!==!0){for(let s of e)if(this.config.messageTier(s[0])===3)throw new Error(`Graph "${this.name}": Graph.signal() rejects tier-3 messages (DATA / RESOLVED). Broadcast is for control-plane tiers (START / DIRTY / INVALIDATE / PAUSE / RESUME / COMPLETE / ERROR / TEARDOWN). For per-node value writes, use Graph.set or graph.node(name).down(...).`)}let n=[];if(this._signalDeliver(e,t??{},new Set,n),n.length>0)throw n[0]}_signalDeliver(e,t,n,s){for(let u of this._mounts.values())u._signalDeliver(e,t,n,s);let i=t.internal===!0?{internal:!0}:{actor:t.actor,delivery:"signal"},a=zo(e,this.config);for(let u of[...this._nodes.keys()].sort()){let d=this._nodes.get(u);if(!n.has(d)){n.add(d);try{d.down(e,i)}catch(c){if(c instanceof Ee)throw c;s.push(c)}a.length!==0&&this._signalMetaSubtree(d,a,n,i,s)}}}_signalMetaSubtree(e,t,n,s,o){for(let i of Object.keys(e.meta).sort()){let a=e.meta[i];if(!n.has(a)){n.add(a);try{a.down(t,s)}catch(u){if(u instanceof Ee)throw u;o.push(u)}this._signalMetaSubtree(a,t,n,s,o)}}}describe(e){if(e?.reactive==="diff")return this._describeReactiveDiff(e);if(e?.reactive===!0)return this._describeReactive(e);let t=Mo(e?.actor),n=e?.filter;if(e?.detail!=null&&e?.fields!=null)throw new TypeError("Graph.describe(): pass either `detail` or `fields`, not both. `detail: 'spec'` is the canonical spec projection; use `fields` only when you need a custom subset.");let s=cn(e?.detail,e?.fields),o=e?.detail==="spec",i=s,a=[];this._collectObserveTargets("",a);let u=new Map;for(let[_,w]of a)u.set(w,_);let d=[];{let _=a.map(([,b])=>b),w=new Set(u.values()),R=0;for(;_.length>0;){let b=_.shift();if(b instanceof re)for(let x of b._deps){let O=x.node;if(u.has(O))continue;let S=O.name??"",N=S;if(!N||w.has(N))if(S){let P=2;for(;w.has(`${S}#${P}`);)P++;N=`${S}#${P}`}else for(N=`__internal__/${R++}`;w.has(N);)N=`__internal__/${R++}`;u.set(O,N),w.add(N),d.push([N,O]),_.push(O)}}}let c=[...a,...d],p={};for(let[_,w]of c){if(t!=null&&!w.allowsObserve(t))continue;let R=ln(w,i,o),b=w instanceof re?w._deps.map(N=>u.get(N.node)??N.node.name??""):[],{name:x,...O}=R,S={...O,deps:b};if(!o){let N=this._annotations.get(_);N!=null&&(S.annotation=N)}if(n!=null)if(typeof n=="function"){let N=n;if(!(N.length>=2?N(_,S):N(S)))continue}else{let N=!0;for(let[P,B]of Object.entries(n)){let z=P==="deps_includes"?"depsIncludes":P==="meta_has"?"metaHas":P;if(z==="depsIncludes"){if(!S.deps.includes(String(B))){N=!1;break}continue}if(z==="metaHas"){if(!Object.hasOwn(S.meta??{},String(B))){N=!1;break}continue}if(S[z]!==B){N=!1;break}}if(!N)continue}p[_]=S}let l=new Set(Object.keys(p)),h=[];for(let[_,w]of c)if(w instanceof re)for(let R of w._deps){let b=u.get(R.node);b!=null&&h.push([b,_])}h.sort((_,w)=>_[0]<w[0]?-1:_[0]>w[0]?1:_[1]<w[1]?-1:_[1]>w[1]?1:0);let f=h.map(([_,w])=>({from:_,to:w}));(t!=null||n!=null)&&(f=f.filter(_=>l.has(_.from)&&l.has(_.to)));let g=this._collectSubgraphs(""),m=t!=null||n!=null?g.filter(_=>{let w=`${_}${X}`;return[...l].some(R=>R===_||R.startsWith(w))}):g,T=this,y=e;return{name:this.name,nodes:p,edges:f,subgraphs:m,...this._factory!==void 0?{factory:this._factory}:{},...this._factoryArgs!==void 0?{factoryArgs:this._factoryArgs}:{},expand(_){let w={...y};return Array.isArray(_)?(w.fields=_,w.detail=void 0):(w.detail=_,w.fields=void 0),T.describe(w)}}}_collectSubgraphs(e){let t=[];for(let n of[...this._mounts.keys()].sort()){let s=e===""?n:`${e}${n}`;t.push(s),t.push(...this._mounts.get(n)._collectSubgraphs(`${s}${X}`))}return t}resourceProfile(e){return Vt(this,e)}reachable(e,t,n={}){return n.withDetail===!0?_n(this.describe(),e,t,{...n,withDetail:!0}):_n(this.describe(),e,t,n)}explain(e,t,n){return n?.reactive===!0?this._explainReactive(e,t,n):this._explainStatic(je(e),je(t),{...n?.maxDepth!==void 0?{maxDepth:mr(n.maxDepth)}:{},...n?.findCycle!==void 0?{findCycle:gr(n.findCycle)}:{}})}_explainStatic(e,t,n){let s=this.describe({detail:"full"}),o=new Map(this._annotations),i=new Map;for(let[a,u]of Object.entries(s.nodes))u.lastMutation!=null&&i.set(a,u.lastMutation);return dr(s,e,t,{...n?.maxDepth!=null?{maxDepth:n.maxDepth}:{},...n?.findCycle===!0?{findCycle:!0}:{},annotations:o,lastMutations:i})}_describeReactive(e){let t={...e,reactive:!1},n=e.reactiveName??"describe",s=0,o=L(s,{name:`${n}_version`}),i=this.observe({timeline:!0,structured:!0}),a=!1,u=!1,d=()=>{a||u||(a=!0,Ze(()=>{a=!1,!u&&(s+=1,o.emit(s))}))},c=i.onEvent(y=>{let v=y.type;v!=="data"&&v!=="error"&&v!=="complete"&&v!=="teardown"||d()}),p=[],l=new WeakSet,h=y=>{if(l.has(y)||u)return;l.add(y);let v=y.topology.subscribe(_=>{for(let w of _){if(w[0]!==C)continue;let R=w[1];if(d(),R.kind==="added"&&R.nodeKind==="mount"){let b=y._mounts.get(R.name);b!=null&&h(b)}}});p.push(v);for(let _ of y._mounts.keys()){let w=y._mounts.get(_);w!=null&&h(w)}};h(this);let f,g=e.actor;vr(g)&&(f=g.subscribe(y=>{let v=!1,_=!1;for(let w of y){let R=w[0];R===C?v=!0:(R===j||R===G||R===ue)&&(_=!0)}v&&d(),_&&(f?.(),f=void 0,d())}));let m;try{m=I([o],()=>this.describe(t),{name:n,describeKind:"derived",meta:{domain:"audit",kind:"describe"},equals:(y,v)=>y===v})}catch(y){c(),f?.();for(let v of p)v();throw i.dispose(),y}let T=ye(m);return{node:m,dispose(){u=!0,c(),f?.();for(let y of p)y();p.length=0,i.dispose(),T()}}}_describeReactiveDiff(e){let t={...e,reactive:!1},n=e.reactiveName??"describe-diff",s={name:this.name,nodes:{},edges:[],subgraphs:[]},o=this.describe(t),i=yn(s,o),a=L(i,{name:n,meta:{domain:"audit",kind:"describe-diff"},equals:(l,h)=>l===h}),u=this._describeReactive({...e,reactiveName:void 0}),d=!1,c=u.node.subscribe(l=>{if(!d)for(let h of l){if(h[0]!==C)continue;let f=h[1],g=yn(o,f);o=f,g.events.length!==0&&a.emit(g)}}),p=ye(a);return{node:a,dispose(){d=!0,c(),u.dispose(),a.down([[ue,"describe-diff disposed"]]),p()}}}_explainReactive(e,t,n){let s=0,o=L(s,{name:"explain_version"}),i=this.observe({timeline:!0,structured:!0}),a=!1,u=!1,d=()=>{a||u||(a=!0,Ze(()=>{a=!1,!u&&(s+=1,o.emit(s))}))},c=i.onEvent(y=>{let v=y.type;v!=="data"&&v!=="error"&&v!=="complete"&&v!=="teardown"||d()}),p=[];e!=null&&Je(e)&&p.push(e),t!=null&&Je(t)&&p.push(t),n?.maxDepth!=null&&Je(n.maxDepth)&&p.push(n.maxDepth),n?.findCycle!=null&&Je(n.findCycle)&&p.push(n.findCycle);let l=()=>{for(let y of p)if(y.cache===void 0)return!1;return!0},h=()=>{let y=je(e),v=je(t);return{from:y,to:v,found:!1,reason:"pending",steps:[],text:"(awaiting reactive args)",toJSON:()=>({from:y,to:v,found:!1,reason:"pending",steps:[]})}},f;try{f=I([o],()=>{if(!l())return h();let y=je(e),v=je(t),_={...n?.maxDepth!==void 0?{maxDepth:mr(n.maxDepth)}:{},...n?.findCycle!==void 0?{findCycle:gr(n.findCycle)}:{}};return this._explainStatic(y,v,_)},{name:n?.name??"explain",describeKind:"derived",meta:{domain:"audit",kind:"explain_path",from:je(e),to:je(t)},equals:(y,v)=>y.found===v.found&&y.reason===v.reason&&y.steps.length===v.steps.length&&Bo(y.steps,v.steps)})}catch(y){throw c(),i.dispose(),y}let g=ye(f),m=[],T=y=>{let v;return v=y.subscribe(_=>{let w=!1,R=!1;for(let b of _){let x=b[0];x===C?w=!0:(x===j||x===G||x===ue)&&(R=!0)}(w||R)&&d(),R&&v&&(v(),v=void 0)}),()=>{v&&(v(),v=void 0)}};for(let y of p)m.push(T(y));return{node:f,dispose(){u=!0,c();for(let y of m)y?.();m.length=0,i.dispose(),g()}}}_pathsMatching(e){let t=jt(e),n=[];return this._collectObserveTargets("",n),n.map(([s])=>s).filter(s=>t.test(s))}_collectObserveTargets(e,t){for(let n of[...this._mounts.keys()].sort()){let s=e===""?n:`${e}${X}${n}`;this._mounts.get(n)._collectObserveTargets(s,t)}for(let n of[...this._nodes.keys()].sort()){let s=this._nodes.get(n),o=e===""?n:`${e}${X}${n}`;t.push([o,s]),this._appendMetaObserveTargets(o,s,t)}}_appendMetaObserveTargets(e,t,n){for(let s of Object.keys(t.meta).sort()){let o=t.meta[s],i=`${e}${X}${Re}${X}${s}`;n.push([i,o]),this._appendMetaObserveTargets(i,o,n)}}observe(e,t){let n=typeof e=="string",o=yr(n?t:e);if(o.reactive===!0)return this._observeReactive(n?e:void 0,o);let i=o.structured===!0||o.timeline===!0||o.causal===!0||o.derived===!0||o.detail==="minimal"||o.detail==="full"||o.format!=null,a=o.actor;if(n){let c=e,p=this.resolve(c);if(a!=null&&!p.allowsObserve(a))throw new Ee({actor:a,action:"observe",nodeName:c});return i?this._buildStructuredObserver([[c,p]],o,"one"):{subscribe(l){return p.subscribe(l)},up(l){try{p.up?.(l)}catch(h){if(h instanceof Ee)return;throw h}}}}let u=[];this._collectObserveTargets("",u),u.sort((c,p)=>c[0]<p[0]?-1:c[0]>p[0]?1:0);let d=a==null?u:u.filter(([,c])=>c.allowsObserve(a));return i?this._buildStructuredObserver(d,o,"all"):{subscribe:c=>{let p=d.map(([l,h])=>h.subscribe(f=>{c(l,f)}));return()=>{for(let l of p)l()}},up:(c,p)=>{try{this.resolve(c).up?.(p)}catch(l){if(l instanceof Ee)return;throw l}}}}_observeReactive(e,t){let n=t.tiers,s=n!=null?new Set(n):null,o=t.reactiveName??"observe";return de(i=>{let a=[],u=!1,d=!1,c=()=>{if(a.length===0||d)return;let g={events:a.slice(),flushedAt_ns:K()};a.length=0,i.emit(g)},p={...t,reactive:!1,structured:!0,timeline:!0},l=e!=null?this.observe(e,p):this.observe(p),h=g=>{d||(a.push(g),!u&&(u=!0,Ze(()=>{u=!1,c()})))};for(let g of l.events)h(g);let f=l.onEvent(h);return()=>{d=!0,f(),l.dispose()}},{name:o,meta:{domain:"audit",kind:"observe-reactive"}})}_buildStructuredObserver(e,t,n){let s=n==="one"?e[0]?.[0]:void 0,o=i=>{if(n==="one"&&s!=null){let c=this.resolve(s);return this._buildStructuredObserver([[s,c]],i,"one")}let a=[];this._collectObserveTargets("",a),a.sort((c,p)=>c[0]<p[0]?-1:c[0]>p[0]?1:0);let u=i.actor,d=u==null?a:a.filter(([,c])=>c.allowsObserve(u));return this._buildStructuredObserver(d,i,"all")};return this._createObserveResult(e,t,o)}_createObserveResult(e,t,n){let s=t.timeline===!0,o=t.causal===!0,i=t.derived===!0,a=t.detail==="minimal",u=this.config.inspectorEnabled,d=(o||i)&&u,c=t.maxEvents,p=c!=null&&c>0?new yt(c):null,l=[],h=new Set,f=t.tiers!=null?new Set(t.tiers):null,g={},m=new Set,T=0,y=0,v=0,_=0,w=0,R=0,b=!1,x=!1,O=0,S=new Map,N=new Map,P=new Map,B=A=>{if(!(f!=null&&!f.has(A.type))){p?p.push(A):l.push(A);for(let U of h)U(A)}},z=A=>f==null||f.has(A),le=()=>s?{timestamp_ns:K(),in_batch:ft(),batch_id:O}:{},ae=(A,U)=>{if(!(!d||!(A instanceof re)))return A._setInspectorHook(pe=>{if(pe.kind==="dep_message")S.set(A,pe.depIndex);else if(pe.kind==="run"){let Se=pe.batchData.map((E,M)=>E!=null&&E.length>0?E.at(-1):pe.prevData[M]);N.set(A,Se);let he=pe.batchData.map(E=>E!=null?[...E]:void 0);P.set(A,he),i&&B({type:"derived",path:U,dep_values:Se,dep_batches:he,...le()})}})},Oe=A=>{let U=S.get(A),pe=N.get(A);if(!o||pe==null)return{};let he=(U!=null&&U>=0&&A instanceof re?A._deps[U]:void 0)?.node,E=he?.v,M=P.get(A);return{trigger_dep_index:U,trigger_dep_name:he?.name,...E!=null?{trigger_version:{id:E.id,version:E.version}}:{},dep_values:[...pe],...M!=null?{dep_batches:M}:{}}},Ce=[],$=[];for(let[A,U]of e){let pe=ae(U,A);pe&&Ce.push(pe),$.push(U.subscribe(Se=>{O++;for(let he of Se){let E=he[0],M=le();if(E===C){g[A]=he[1];let J=U instanceof re?U.lastMutation?.actor??Ye:Ye;B({type:"data",path:A,data:he[1],actor:J,...M,...Oe(U)})}else if(a)E===ee?z("dirty")&&T++:E===Q?z("resolved")&&y++:E===xe?z("invalidate")&&v++:E===Ae?z("pause")&&_++:E===Le?z("resume")&&w++:E===ue?z("teardown")&&R++:E===j&&!m.has(A)?z("complete")&&(b=!0):E===G&&z("error")&&(x=!0,m.add(A));else if(E===ee)z("dirty")&&T++,B({type:"dirty",path:A,...M});else if(E===Q)z("resolved")&&y++,B({type:"resolved",path:A,...M,...Oe(U)});else if(E===xe)z("invalidate")&&v++,B({type:"invalidate",path:A,...M});else if(E===Ae)z("pause")&&_++,B({type:"pause",path:A,lockId:he[1],...M});else if(E===Le)z("resume")&&w++,B({type:"resume",path:A,lockId:he[1],...M});else if(E===j)z("complete")&&!m.has(A)&&(b=!0),B({type:"complete",path:A,...M});else if(E===G){z("error")&&(x=!0,m.add(A));let J=U instanceof re?U.lastMutation?.actor??Ye:Ye;B({type:"error",path:A,data:he[1],actor:J,...M})}else E===ue&&(z("teardown")&&R++,B({type:"teardown",path:A,...M}))}}))}let V=!1,F=()=>{if(!V){V=!0;for(let A of $)A();for(let A of Ce)A();for(let A of Z)A({value:void 0,done:!0});Z.length=0}},ie=[],Z=[];h.add(A=>{let U=Z.shift();U?U({value:A,done:!1}):ie.push(A)});let fe={get values(){return g},get dirtyCount(){return T},get resolvedCount(){return y},get invalidateCount(){return v},get pauseCount(){return _},get resumeCount(){return w},get teardownCount(){return R},get events(){return p?p.toArray():[...l]},get anyCompletedCleanly(){return b},get anyErrored(){return x},get completedWithoutErrors(){return b&&!x},onEvent(A){return h.add(A),()=>h.delete(A)},dispose:F,expand(A){F();let U={...t};return typeof A=="string"?U.detail=A:Object.assign(U,A),n(yr(U))},[Symbol.asyncIterator](){return{next(){return ie.length>0?Promise.resolve({value:ie.shift(),done:!1}):V?Promise.resolve({value:void 0,done:!0}):new Promise(A=>Z.push(A))},return(){return F(),Promise.resolve({value:void 0,done:!0})}}}};return t.format!=null&&this._attachFormatLogger(fe,t),fe}_attachFormatLogger(e,t){let n=t.format;if(n==null)return;let s=t.logger??(f=>console.log(f)),o=t.includeTypes?new Set(t.includeTypes):null,i=t.excludeTypes?new Set(t.excludeTypes):null,a=o==null&&i==null?()=>!0:f=>(o==null||o.has(f))&&(i==null||!i.has(f)),u=$o(t.theme),d=n==="stage-log"?K():0,c=f=>f==null?"":t.stageLabels?.[f]??f,p=(f,g)=>f.length>g?`${f.slice(0,g-1)}\u2026`:f,l=f=>f.type==="data"||f.type==="error"?p(vn(f.data),120):"",h=f=>{if(n==="stage-log"){let b=(K()-d)/1e9,x=c(f.path).padEnd(9);if(f.type==="data"){let O=l(f);return`[${b.toFixed(3)}s] ${x} \u2190${O?` ${O}`:""}`}if(f.type==="error"){let O=l(f);return`[${b.toFixed(3)}s] ${x} \u2717${O?` ${O}`:""}`}return f.type==="complete"?`[${b.toFixed(3)}s] ${x} \u25A0 complete`:`[${b.toFixed(3)}s] ${x} ${f.type}`}if(n==="json")try{return JSON.stringify(f)}catch{return JSON.stringify({type:f.type,path:f.path,data:"[unserializable]"})}let g=u[f.type]??"",m=f.path?`${u.path}${f.path}${u.reset} `:"",T=f.type==="data"||f.type==="error",y=f.type==="pause"||f.type==="resume",v=T?` ${vn(f.data)}`:y?` ${vn(f.lockId)}`:"",_=f.type==="data"||f.type==="resolved"||f.type==="derived"?f:void 0,w=_?.trigger_dep_name!=null?` <- ${_.trigger_dep_name}`:_?.trigger_dep_index!=null?` <- #${_.trigger_dep_index}`:"",R=f.in_batch?" [batch]":"";return`${m}${g}${f.type.toUpperCase()}${u.reset}${v}${w}${R}`};e.onEvent(f=>{a(f.type)&&s(h(f),f)})}addDisposer(e){return this._disposers.add(e),()=>{this._disposers.delete(e)}}destroy(){hr(this._disposers,this.name),this.signal([[ue]],{internal:!0}),hr(this._storageDisposers,this.name);for(let e of[...this._mounts.values()])e._parent=void 0,e._destroyClearOnly();this._mounts.clear(),this._nodes.clear(),this._parent=void 0,this._destroyed=!0}get destroyed(){return this._destroyed}_destroyClearOnly(){for(let e of[...this._mounts.values()])e._parent=void 0,e._destroyClearOnly();this._mounts.clear(),this._nodes.clear(),this._parent=void 0,this._destroyed=!0}snapshot(e){let{expand:t,...n}=this.describe({detail:"full"}),s={};for(let a of Object.keys(n.nodes).sort()){let{lastMutation:u,guard:d,...c}=n.nodes[a];s[a]=c}let o=[...n.subgraphs].sort(),i={...n,version:1,nodes:s,subgraphs:o};if(e?.format==null)return i;if(e.format==="json-string")return JSON.stringify(i);if(e.format==="bytes"){if(e.codec==null)throw new Error("snapshot({format: 'bytes'}) requires a `codec` name");let a=this.config.lookupCodec(e.codec);if(a==null)throw new Error(`snapshot: codec "${e.codec}" is not registered on this graph's config. Call config.registerCodec(...) before creating nodes.`);return Vn(a,a.encode(i))}throw new Error(`snapshot: unknown format "${String(e.format)}"`)}static decode(e,t){let n=t?.config??tt,{codec:s,codecVersion:o,payload:i}=jn(e,n);return s.decode(i,o)}restore(e,t){if(br(e),e.name!==this.name)throw new Error(`Graph "${this.name}": restore snapshot name "${e.name}" does not match this graph`);let n=t?.only==null?null:(Array.isArray(t.only)?t.only:[t.only]).map(o=>jt(o)),s=t?.includeProducers===!0;for(let o of Object.keys(e.nodes).sort()){if(n!==null&&!n.some(a=>a.test(o)))continue;let i=e.nodes[o];if(i!==void 0){if(!("value"in i)||i.value===void 0){"value"in i&&i.value===void 0&&t?.onError?.(o,new Error(`restore: slice.value is undefined for "${o}" (undefined is the global SENTINEL; not valid DATA)`));continue}if(!(i.type==="derived"||i.type==="effect")&&!(i.type==="producer"&&!s)){if(i.v!=null){let u=this.tryResolve(o)?.v;if(u!=null&&u.id===i.v.id&&u.version===i.v.version)continue}try{this.set(o,i.value)}catch(a){t?.onError?.(o,a)}}}}}static fromSnapshot(e,t){br(e);let n=typeof t=="function"?t:t?.build,s=typeof t=="function"?void 0:t?.factories,o=new r(e.name);if(n)return n(o),o.restore(e),o;for(let h of[...e.subgraphs].sort((f,g)=>{let m=f.split(X).length,T=g.split(X).length;return m!==T?m-T:f<g?-1:f>g?1:0})){let f=h.split(X),g=o;for(let m of f)g._mounts.has(m)||g.mount(m,new r(m)),g=g._mounts.get(m)}let i=s?Object.entries(s).map(([h,f])=>({re:jt(h),factory:f})):[],a=h=>{for(let f of i)if(f.re.test(h))return f.factory},u=h=>{let f=h.split(X),g=f.pop();if(g==null||g.length===0)throw new Error(`invalid snapshot path "${h}"`);let m=o;for(let T of f){let y=m._mounts.get(T);if(!y)throw new Error(`unknown mount "${T}" in path "${h}"`);m=y}return[m,g]},d=Object.entries(e.nodes).filter(([h])=>!h.includes(`${X}${Re}${X}`)).sort((h,f)=>h[0]<f[0]?-1:h[0]>f[0]?1:0),c=new Map(d),p=new Map,l=!0;for(;c.size>0&&l;){l=!1;for(let[h,f]of[...c.entries()]){let g=f?.deps??[];if(!g.every(w=>p.has(w)))continue;let[m,T]=u(h),y={...f?.meta??{}},v=a(h),_;if(f?.type==="state")_=L(f.value,{meta:y});else{if(v==null)continue;_=v(T,{path:h,type:f.type,value:f.value,meta:y,deps:g,resolvedDeps:g.map(w=>p.get(w))})}m.add(_,{name:T}),p.set(h,_),c.delete(h),l=!0}}if(c.size>0){let h=[...c.keys()].sort().join(", ");throw new Error(`Graph.fromSnapshot could not reconstruct nodes without build callback: ${h}. Pass matching factories via fromSnapshot(data, { factories: { pattern: factoryFn } }).`)}return o.restore(e),o}toJSON(){return this.snapshot()}attachSnapshotStorage(e,t={}){let n=e.map(d=>({tier:d,debounceMs:Math.max(0,d.debounceMs??0),compactEvery:Math.max(1,d.compactEvery??10),timer:void 0,seq:0,lastSnapshot:void 0,lastFingerprint:"",disposed:!1,savePending:void 0}));t.autoRestore===!0&&this._cascadeRestore(e,t.onError);let s=(d,c)=>{if(d.disposed)return;let p=Io(c.nodes);if(d.lastSnapshot!=null&&p!==""&&p===d.lastFingerprint)return;let l=d.seq+1,h=ve(),m=d.lastSnapshot==null||l%d.compactEvery===0?{name:this.name,mode:"full",snapshot:c,seq:l,timestamp_ns:h,format_version:We}:{name:this.name,mode:"diff",diff:_r(d.lastSnapshot,c),seq:l,timestamp_ns:h,format_version:We};if(d.tier.filter&&!d.tier.filter(m))return;let T;try{T=d.tier.save(m)}catch(y){t.onError?.(y,d.tier);return}if(T&&typeof T.then=="function"){let _=(d.savePending??Promise.resolve()).then(()=>T,()=>T).then(()=>{d.disposed||(d.seq=l,d.lastSnapshot=c,d.lastFingerprint=p)},w=>{t.onError?.(w,d.tier)});d.savePending=_.finally(()=>{d.savePending===_&&(d.savePending=void 0)})}else d.seq=l,d.lastSnapshot=c,d.lastFingerprint=p},o=(d,c)=>{try{s(d,c)}catch(p){t.onError?.(p,d.tier)}},i=(d,c)=>{if(!c.some(f=>{let g=this.config.messageTier(f[0]);return g>=3&&g<5}))return;if(t.filter){let f=this.tryResolve(d);if(f==null)return;let g=ln(f,cn("standard"));if(!t.filter(d,g))return}let l,h=()=>(l==null&&(l=this.snapshot()),l);for(let f of n)f.disposed||(f.debounceMs===0?o(f,h()):(f.timer==null&&(f.timer=new Pt),f.timer.start(f.debounceMs,()=>{f.disposed||o(f,this.snapshot())})))},a;if(t.paths!=null){let c=(typeof t.paths=="string"?this._pathsMatching(t.paths):t.paths).map(p=>{let l=this.tryResolve(p);return l==null?()=>{}:l.subscribe(h=>i(p,h))});a=()=>{for(let p of c)p()}}else a=this.observe().subscribe((d,c)=>i(d,c));let u=()=>{a();for(let d of n)d.disposed=!0,d.timer?.cancel();this._storageDisposers.delete(u)};return this._storageDisposers.add(u),{dispose:u}}async _cascadeRestore(e,t){for(let n of e){let s;try{s=await n.load?.()}catch(i){t?.(i,n);continue}if(s==null||typeof s!="object"||Array.isArray(s))continue;let o=s;try{if(o.mode==="full"&&o.snapshot!=null)return this.restore(o.snapshot),!0;if(o.version===We&&o.nodes!=null)return this.restore(o),!0}catch(i){t?.(i,n)}}return!1}static async fromStorage(e,t,n){for(let s of t){let o;try{o=await s.load?.()}catch(u){n?.onError?.(u,s);continue}if(o==null||typeof o!="object"||Array.isArray(o))continue;let i=o,a=i.mode==="full"&&i.snapshot!=null?i.snapshot:i.version===We&&i.nodes!=null?i:void 0;if(a!=null)try{return r.fromSnapshot(a,n)}catch(u){n?.onError?.(u,s)}}throw new Error(`Graph.fromStorage: no tier held a restorable record for "${e}" across ${t.length} tier(s)`)}_annotations=new Map;_traceRing;trace(e,t,n){if(e!=null&&t!=null){if(this.tryResolve(e)==null)return;if(this._annotations.set(e,t),this.config.inspectorEnabled){let s={path:e,annotation:t,timestamp_ns:K(),...n?.actor!=null?{actor:n.actor}:{}};this._traceRing.push(s)}return}return e!=null?this.config.inspectorEnabled?this._annotations.get(e):void 0:this.config.inspectorEnabled?this._traceRing.toArray():[]}annotation(e){return this._annotations.get(e)}clearTrace(){this._annotations.clear(),this._traceRing.clear()}pruneTrace(e){let t=this._traceRing.toArray().filter(s=>!e(s)),n=this._traceRing.size-t.length;this._traceRing.clear();for(let s of t)this._traceRing.push(s);return n}static diff(e,t){let n=new Set(Object.keys(e.nodes)),s=new Set(Object.keys(t.nodes)),o=[...s].filter(y=>!n.has(y)).sort(),i=[...n].filter(y=>!s.has(y)).sort(),a=[],u=[];for(let y of n){if(!s.has(y))continue;let v=e.nodes[y],_=t.nodes[y],w=v.v,R=_.v;w!=null&&R!=null&&w.id===R.id&&w.version!==R.version&&u.push({path:y,id:w.id,from:w.version,to:R.version});let b=w!=null&&R!=null&&w.id===R.id&&w.version===R.version;for(let x of["type","status","sentinel"]){let O=v[x],S=_[x];O!==S&&a.push({path:y,field:x,from:O,to:S})}if(!b)for(let x of["value","meta"]){let O=v[x],S=_[x];Go(O,S)||a.push({path:y,field:x,from:O,to:S})}}let d=y=>`${y.from} ${y.to}`,c=new Set(e.edges.map(d)),p=new Set(t.edges.map(d)),l=t.edges.filter(y=>!c.has(d(y))),h=e.edges.filter(y=>!p.has(d(y))),f=new Set(e.subgraphs),g=new Set(t.subgraphs),m=[...g].filter(y=>!f.has(y)).sort(),T=[...f].filter(y=>!g.has(y)).sort();return{nodesAdded:o,nodesRemoved:i,nodesChanged:a,versionChanges:u,edgesAdded:l,edgesRemoved:h,subgraphsAdded:m,subgraphsRemoved:T}}};function _r(r,e){let t=ce.diff(r,e),n={};for(let s of t.nodesAdded){let o=e.nodes[s];o!=null&&(n[s]=o)}return{...t,nodesAddedFull:n}}function _n(r,e,t,n={}){let s={paths:[],depths:new Map,truncated:!1};if(!e)return n.withDetail?s:[];if(!n.both&&t!=="upstream"&&t!=="downstream")throw new Error('reachable: direction must be "upstream" or "downstream"');let o=n.maxDepth;if(o!=null&&(!Number.isInteger(o)||o<0))throw new Error("reachable: maxDepth must be an integer >= 0");if(o===0)return n.withDetail?s:[];let i=new Map,a=new Map,u=new Map,d=new Map,c=new Set;for(let[v,_]of Object.entries(r.nodes)){if(!v)continue;c.add(v);let w=_.deps??[];i.set(v,w);for(let R of w)R&&(c.add(R),a.has(R)||a.set(R,new Set),a.get(R).add(v))}for(let v of r.edges){if(v==null||typeof v!="object")continue;let _=typeof v.from=="string"?v.from:"",w=typeof v.to=="string"?v.to:"";!_||!w||(c.add(_),c.add(w),d.has(_)||d.set(_,new Set),d.get(_).add(w),u.has(w)||u.set(w,new Set),u.get(w).add(_))}if(!c.has(e))return n.withDetail?s:[];let p=n.both===!0,l=v=>{if(p){let b=i.get(v)??[],x=u.get(v),O=a.get(v),S=d.get(v),N=[...b];return x&&N.push(...x),O&&N.push(...O),S&&N.push(...S),N}if(t==="upstream"){let b=i.get(v)??[],x=u.get(v);return x?[...b,...x]:b}let _=a.get(v),w=d.get(v),R=_?[..._]:[];return w&&R.push(...w),R},h=new Set([e]),f=new Map,g=[{path:e,depth:0}],m=0,T=!1;for(;m<g.length;){let v=g[m++];if(o!=null&&v.depth>=o){l(v.path).length>0&&(T=!0);continue}for(let _ of l(v.path))!_||h.has(_)||(h.add(_),f.set(_,v.depth+1),g.push({path:_,depth:v.depth+1}))}let y=[...f.keys()].sort((v,_)=>v<_?-1:v>_?1:0);return n.withDetail?{paths:y,depths:f,truncated:T}:y}function Bo(r,e){if(r.length!==e.length)return!1;for(let t=0;t<r.length;t++){let n=r[t],s=e[t];if(n.path!==s.path||n.type!==s.type||n.status!==s.status||n.hop!==s.hop||n.dep_index!==s.dep_index||n.annotation!==s.annotation||n.value!==s.value||n.lastMutation!==s.lastMutation)return!1;let o=n.v,i=s.v;if(o!==i&&(o==null||i==null||o.id!==i.id||o.version!==i.version))return!1}return!0}At();Ie();et();ge();oe();De();vt();Ie();ge();De();oe();var wn=class{_version=0;_maxSize;_buf;_head=0;_size=0;constructor(e,t){if(t!==void 0&&t<1)throw new RangeError("maxSize must be >= 1");if(this._maxSize=t,t!==void 0){if(this._buf=new Array(t),e&&e.length>0){let n=Math.min(e.length,t),s=e.length-n;for(let o=0;o<n;o++)this._buf[o]=e[s+o];this._size=n}}else this._buf=e?[...e]:[],this._size=this._buf.length}get version(){return this._version}get size(){return this._size}at(e){if(!Number.isInteger(e))return;let t=e>=0?e:this._size+e;if(!(t<0||t>=this._size))return this._maxSize!==void 0?this._buf[(this._head+t)%this._maxSize]:this._buf[t]}append(e){this._rawAppend(e),this._version+=1}appendMany(e){if(e.length===0)return;let t=this._maxSize!==void 0&&e.length>this._maxSize?e.length-this._maxSize:0;for(let n=t;n<e.length;n++)this._rawAppend(e[n]);this._version+=1}clear(){if(this._size===0)return 0;let e=this._size;if(this._maxSize===void 0)this._buf.length=0;else for(let t=0;t<e;t++)this._buf[(this._head+t)%this._maxSize]=void 0;return this._head=0,this._size=0,this._version+=1,e}trimHead(e){if(!Number.isInteger(e)||e<0)throw new RangeError(`trimHead: n must be a non-negative integer (got ${e})`);if(e===0||this._size===0)return 0;let t=Math.min(e,this._size);if(this._maxSize===void 0)this._buf.splice(0,t);else{for(let n=0;n<t;n++)this._buf[(this._head+n)%this._maxSize]=void 0;this._head=(this._head+t)%this._maxSize}return this._size-=t,this._version+=1,t}slice(e,t){if(!Number.isInteger(e)||e<0)throw new RangeError(`slice: start must be a non-negative integer (got ${e})`);if(t!==void 0&&(!Number.isInteger(t)||t<0))throw new RangeError(`slice: stop must be a non-negative integer or undefined (got ${t})`);let n=t===void 0?this._size:Math.min(Math.max(t,0),this._size),s=Math.min(e,this._size);if(s>=n)return[];let o=n-s;if(this._maxSize===void 0)return this._buf.slice(s,n);let i=new Array(o);for(let a=0;a<o;a++)i[a]=this._buf[(this._head+s+a)%this._maxSize];return i}tail(e){if(!Number.isInteger(e)||e<0)throw new RangeError(`tail: n must be a non-negative integer (got ${e})`);if(e===0||this._size===0)return[];let t=Math.min(e,this._size);return this.slice(this._size-t,this._size)}toArray(){if(this._maxSize===void 0)return[...this._buf];let e=new Array(this._size);for(let t=0;t<this._size;t++)e[t]=this._buf[(this._head+t)%this._maxSize];return e}snapshot(){return this.toArray()}restore(e){if(this._maxSize===void 0){this._buf.length=0;for(let t=0;t<e.length;t++)this._buf.push(e[t]);this._size=this._buf.length}else{let t=this._maxSize;for(let o=0;o<t;o++)this._buf[o]=void 0;this._head=0;let n=Math.min(e.length,t),s=e.length-n;for(let o=0;o<n;o++)this._buf[o]=e[s+o];this._size=n}this._version+=1}_rawAppend(e){if(this._maxSize===void 0){this._buf.push(e),this._size=this._buf.length;return}this._size<this._maxSize?(this._buf[(this._head+this._size)%this._maxSize]=e,this._size+=1):(this._buf[this._head]=e,this._head=(this._head+1)%this._maxSize)}};function Tt(r){return r.subscribe(()=>{})}var qo=64;function zt(r,e={}){let{name:t,maxSize:n,versioning:s,guard:o,backend:i}=e,a=i??new wn(r,n),u=L(a.toArray(),{name:t,describeKind:"state",equals:(b,x)=>b===x,...s!=null?{versioning:s}:{},...o!=null?{guard:o}:{}});function d(){let b=a.toArray();te(()=>{u.down([[ee]],{internal:!0}),u.down([[C,b]],{internal:!0})})}let c=new Map,p=new Map,l=new Map;function h(b,x){return`${b}:${x===void 0?"END":x}`}function f(b){if(b.size<qo)return;let x=b.keys().next();if(x.done)return;let O=b.get(x.value);O!==void 0&&O.dispose(),b.delete(x.value)}function g(b){let x=a.version;try{return b()}finally{a.version!==x&&d()}}function m(b){if(!Number.isInteger(b)||b<0)throw new RangeError(`tail: n must be a non-negative integer (got ${b})`);let x=c.get(b);if(x!==void 0)return c.delete(b),c.set(b,x),x.node;f(c);let O=I([u],([N])=>{let P=N;return b===0||P.length===0?[]:P.slice(Math.max(0,P.length-b))},{initial:a.tail(b),describeKind:"derived"}),S=Tt(O);return c.set(b,{node:O,dispose:S}),O}function T(b,x){if(!Number.isInteger(b)||b<0)throw new RangeError(`slice: start must be a non-negative integer (got ${b})`);if(x!==void 0&&(!Number.isInteger(x)||x<0))throw new RangeError(`slice: stop must be a non-negative integer or undefined (got ${x})`);let O=h(b,x),S=p.get(O);if(S!==void 0)return p.delete(O),p.set(O,S),S.node;f(p);let N=I([u],([B])=>{let z=B;return x===void 0?z.slice(b):z.slice(b,x)},{initial:a.slice(b,x),describeKind:"derived"}),P=Tt(N);return p.set(O,{node:N,dispose:P}),N}function y(b){let x=l.get(b);if(x!==void 0)return x.node;let O=I([u,b],([N,P])=>{let B=N,z=Math.max(0,Math.trunc(P??0));return B.slice(z)},{initial:[],describeKind:"derived"}),S=Tt(O);return l.set(b,{node:O,dispose:S}),O}let v,_;function w(){v===void 0&&(v=ne([u],(b,x,O)=>{let S=b[0],P=S!=null&&S.length>0?S.at(-1):O.prevData[0];if(P==null||P.length===0){x.down([[Q]]);return}x.emit(P[P.length-1])},{name:t!=null?`${t}::lastValue`:"lastValue",describeKind:"derived",initial:a.size===0?void 0:a.at(a.size-1)}),_=I([u],([b])=>b.length>0,{name:t!=null?`${t}::hasLatest`:"hasLatest",describeKind:"derived",initial:a.size>0}),Tt(v),Tt(_))}let R={entries:u,get size(){return a.size},at(b){return a.at(b)},append(b){g(()=>a.append(b))},appendMany(b){b.length!==0&&g(()=>a.appendMany(b))},clear(){g(()=>a.clear())},trimHead(b){g(()=>a.trimHead(b))},withLatest(){return w(),u},get lastValue(){return w(),v},get hasLatest(){return w(),_},view(b){switch(b.kind){case"tail":return m(b.n);case"slice":return T(b.start,b.stop);case"fromCursor":return y(b.cursor)}},attach(b){let x=b.subscribe(O=>{for(let S of O)S[0]===C&&R.append(S[1])});return()=>x()},attachStorage(b){if(b.length===0)return()=>{};let x=new Map;for(let S of b)x.set(S,a.size);(async()=>{for(let S of b)if(typeof S.loadEntries=="function")try{let N=await Promise.resolve(S.loadEntries());N.entries.length>0&&a.size===0&&(a.restore(N.entries),x.set(S,N.entries.length),d());break}catch{}})();let O=u.subscribe(S=>{for(let N of S){if(N[0]!==C)continue;let P=N[1];for(let B of b){let z=x.get(B)??0;if(P.length<z){try{let ae=B.appendEntries(P);ae instanceof Promise&&ae.catch(()=>{})}catch{}x.set(B,P.length);continue}if(P.length===z)continue;let le=P.slice(z);x.set(B,P.length);try{let ae=B.appendEntries(le);ae instanceof Promise&&ae.catch(()=>{})}catch{}}}});return()=>O()},disposeAllViews(){for(let b of c.values())b.dispose();c.clear();for(let b of p.values())b.dispose();p.clear();for(let b of l.values())b.dispose();l.clear()},dispose(){for(let b of c.values())b.dispose();c.clear();for(let b of p.values())b.dispose();p.clear();for(let b of l.values())b.dispose();l.clear()}};return R}$e();var Ho=256;function at(r,e){if(!Number.isFinite(r)||!Number.isInteger(r)||r<0)throw new Error(`${e} must be a non-negative integer`);return r}function Be(r,e){return ze("messaging",r,e)}var Uo=1024,xn=class extends ce{_log;events;latest;hasLatest;constructor(e,t={}){super(e,t.graph),this._log=zt([],{name:"events",maxSize:t.retainedLimit??Uo}),this._log.withLatest(),this.events=this._log.entries,this.add(this.events,{name:"events"}),this.latest=I([this.events],([n])=>{let s=n;return s.length===0?null:s[s.length-1]},{name:"latest",describeKind:"derived",meta:Be("topic_latest")}),this.add(this.latest,{name:"latest"}),this.addDisposer(ye(this.latest)),this.hasLatest=I([this.events],([n])=>n.length>0,{name:"hasLatest",describeKind:"derived",meta:Be("topic_has_latest")}),this.add(this.hasLatest,{name:"hasLatest"}),this.addDisposer(ye(this.hasLatest)),this.addDisposer(()=>{this.events.down([[j]])}),this.addDisposer(()=>this._log.disposeAllViews())}publish(e){if(e===void 0)throw new TypeError(`TopicGraph "${this.name}": publish(undefined) is not allowed (spec \xA75.12 SENTINEL).`);this._log.append(e)}attachEventStorage(e){return this._log.attachStorage(e)}retained(){return this.events.cache}get _logBundle(){return this._log}},Bt=class extends ce{cursor;available;topic;_disposed=!1;constructor(e,t,n={}){super(e,n.graph),this.topic=t;let s;if(n.from!==void 0?n.from==="retained"?s=0:n.from==="now"?s=t.events.cache.length:s=at(n.from,"subscription from"):s=at(n.cursor??0,"subscription cursor"),this.cursor=L(s,{name:"cursor",describeKind:"state",meta:Be("subscription_cursor")}),this.add(this.cursor,{name:"cursor"}),this.available=t._logBundle.view({kind:"fromCursor",cursor:this.cursor}),this.add(this.available,{name:"available"}),this.addDisposer(ye(this.available)),n.advanceOn!==void 0){let o=n.advanceOn,i=!1,a=ne([o],()=>{if(!i){i=!0;return}if(this._disposed)return;let u=this.available.cache;if(u.length===0)return;let d=this.cursor.cache+u.length;this.cursor.emit(d)},{name:"advancePump",describeKind:"effect",meta:Be("subscription_advance_pump")});this.add(a,{name:"advancePump"}),this.addDisposer(ye(a))}}ack(e){if(this._disposed)return this.cursor.cache;let t=this.available.cache,n=e===void 0?t.length:at(e,"subscription ack count"),s=Math.min(n,t.length);if(s<=0)return this.cursor.cache;let o=this.cursor.cache+s;return this.cursor.emit(o),o}pull(e){if(this._disposed)return[];let t=this.available.cache,n=e===void 0?t.length:at(e,"subscription pull limit");return t.slice(0,n)}pullAndAck(e){if(this._disposed)return{items:[],cursor:this.cursor.cache};let t=this.available.cache,n=e===void 0?t.length:at(e,"subscription pullAndAck limit"),s=t.slice(0,n);if(s.length===0)return{items:s,cursor:this.cursor.cache};let o=this.cursor.cache+s.length;return this.cursor.emit(o),{items:s,cursor:o}}dispose(){this._disposed||(this._disposed=!0,this.cursor.down([[j]]),this.destroy())}},Nn=class extends ce{_sourceSub;bridgedCount;output;constructor(e,t,n,s={}){super(e,s.graph),this._sourceSub=Wo(`${e}-subscription`,t,{cursor:s.cursor}),this.mount("subscription",this._sourceSub);let o=Math.max(1,at(s.maxPerPump??Ho,"topic bridge maxPerPump")),i=s.map??(l=>l);this.output=I([this._sourceSub.available],([l])=>{let h=l,f=[],g=Math.min(h.length,o);for(let m=0;m<g;m++){let T=i(h[m]);T!==void 0&&f.push(T)}return f},{name:"output",describeKind:"derived",meta:Be("topic_bridge_output",{targetRef:n.name}),initial:[]}),this.add(this.output,{name:"output"}),this.addDisposer(ye(this.output)),this.bridgedCount=L(0,{name:"bridgedCount",describeKind:"state",meta:Be("topic_bridge_count")}),this.add(this.bridgedCount,{name:"bridgedCount"}),this.addDisposer(ye(this.bridgedCount));let a=this.output,u=this._sourceSub,d=this.bridgedCount,c=ne([a],()=>{let l=a.cache;if(l.length===0)return;let h=u.available.cache.length,f=Math.min(h,o);if(f>0){u.ack(f);let g=d.cache??0;d.emit(g+l.length)}},{name:"ackPump",describeKind:"effect",meta:Be("topic_bridge_ack_pump")});this.add(c,{name:"ackPump"}),this.addDisposer(ye(c));let p=Ko(this.output,n);this.addDisposer(p)}};function Ko(r,e){return r.subscribe(t=>{for(let n of t){if(n[0]!==C)continue;let s=n[1];s.length!==0&&te(()=>{for(let o of s)e.publish(o)})}})}var En=class{_map=new Map;version;constructor(e){this.version=e}get size(){return this._map.size}has(e){return this._map.has(e)}get(e){return this._map.get(e)}set(e,t){this._map.set(e,t)}delete(e){return this._map.delete(e)}keys(){return this._map.keys()}},kn=class extends ce{_registry;version;_defaultTopicOptions;constructor(e,t={}){super(e,t.graph);let n=L(0,{name:"version",describeKind:"state",meta:Be("hub_version")});this.add(n,{name:"version"}),this.version=n,this._registry=new En(n),this._defaultTopicOptions={...t.defaultTopicOptions??{}}}get size(){return this._registry.size}has(e){return this._registry.has(e)}topicNames(){return this._registry.keys()}topic(e,t){let n=this._registry.get(e);if(n===void 0){let s={...this._defaultTopicOptions,...t??{}};n=new xn(e,s),this._registry.set(e,n),this.mount(e,n);let o=this.version.cache??0;this.version.emit(o+1)}return n}publish(e,t){this.topic(e).publish(t)}publishMany(e){te(()=>{for(let[t,n]of e)this.topic(t).publish(n)})}subscribe(e,t,n){let s=this.topic(t);return new Bt(e,s,n)}removeTopic(e){if(!this._registry.has(e))return!1;try{this.remove(e)}finally{this._registry.delete(e);let t=this.version.cache??0;this.version.emit(t+1)}return!0}};function qt(r,e){return new kn(r,e)}function Wo(r,e,t){return new Bt(r,e,t)}function Rn(r,e,t,n){return new Nn(r,e,t,n)}function Jo(r){if(typeof r!="object"||r===null)return!1;let e=r;return typeof e.subscribe=="function"&&typeof e.down=="function"&&typeof e.emit=="function"}function Yo(r,e){if(r.length===0)return{best:null,bestScore:Number.NEGATIVE_INFINITY};if(r.length===1){let o=Qo(e);return{best:r[0],bestScore:o}}if(e.some(o=>typeof o.candidateIndex=="number")){let o=new Array(r.length);for(let u=0;u<r.length;u++)o[u]={sum:0,count:0};for(let u of e){let d=u.candidateIndex;typeof d=="number"&&d>=0&&d<r.length&&(o[d].sum+=u.score,o[d].count+=1)}let i=r[0],a=o[0].count>0?o[0].sum/o[0].count:Number.NEGATIVE_INFINITY;for(let u=1;u<r.length;u++){let d=o[u].count>0?o[u].sum/o[u].count:Number.NEGATIVE_INFINITY;d>a&&(a=d,i=r[u])}return{best:i,bestScore:a}}let n=r[0],s=e[0]?.score??Number.NEGATIVE_INFINITY;for(let o=1;o<r.length;o++){let i=e[o]?.score??Number.NEGATIVE_INFINITY;i>s&&(s=i,n=r[o])}return{best:n,bestScore:s}}function Qo(r){if(r.length===0)return Number.NEGATIVE_INFINITY;let e=0;for(let t of r)e+=t.score;return e/r.length}function wr(r,e,t,n){let s=n.name??"refine-loop",o=new ce(s,n.graph),i=Jo(n.dataset)?n.dataset:L(n.dataset,{name:"dataset"});o.add(i,{name:"dataset"});let a=L(0,{name:"iteration"});o.add(a,{name:"iteration"});let u=L(t,{name:"strategy",equals:()=>!1});o.add(u,{name:"strategy"});let d=L(null,{name:"lastFeedback"});o.add(d,{name:"lastFeedback"});let c=L([],{name:"prevCandidates"});o.add(c,{name:"prevCandidates"});let p=L(!1,{name:"paused"});o.add(p,{name:"paused"});let l=L("running",{name:"status"});o.add(l,{name:"status"});let h=L([],{name:"history",equals:()=>!1});o.add(h,{name:"history"});let f=L(null,{name:"best"});o.add(f,{name:"best"});let g=L(Number.NEGATIVE_INFINITY,{name:"score"});o.add(g,{name:"score"});let m=L(0,{name:"budget-used"});o.add(m,{name:"budget-used"});let T=qt("stages");o.mount("stages",T);let y=T.topic("generate"),v=T.topic("evaluate"),_=T.topic("analyze"),w=T.topic("decide"),R=t,b=null,x=[];o.addDisposer(u.subscribe(E=>{for(let M of E)M[0]===C&&(R=M[1])})),o.addDisposer(d.subscribe(E=>{for(let M of E)M[0]===C&&(b=M[1])})),o.addDisposer(c.subscribe(E=>{for(let M of E)M[0]===C&&(x=M[1])}));let O=ke(a,E=>{let M=R,J=E===0||b==null;return ne([],(q,k)=>{let D=!1;try{let H=J?M.seed(r):M.generate(b,x);if(H instanceof Promise)return H.then(W=>{D||k.emit(W)},W=>{D||k.down([[G,W]])}),()=>{D=!0};k.emit(H)}catch(H){D=!0,k.down([[G,H]])}},{describeKind:"producer"})},{name:"candidates"});o.add(O,{name:"candidates"});let S=be([O],(E,M,J)=>{let q=J.terminalDeps[0];q!==void 0&&q!==!0&&l.emit("errored")},{name:"error-watcher",errorWhenDepsError:!1});o.add(S,{name:"error-watcher"}),o.addDisposer(S.subscribe(()=>{}));let N=I([O,a],([E,M])=>({iteration:M,candidates:E,timestamp_ns:K()}),{name:"generate-event"});o.add(N,{name:"generate-event"}),o.addDisposer(N.subscribe(()=>{}));let P=be([N],([E])=>{y.publish(E)},{name:"generate-publish"});o.add(P,{name:"generate-publish"}),o.addDisposer(P.subscribe(()=>{}));let B=be([O],([E])=>{c.emit(E)},{name:"generate-mirror"});o.add(B,{name:"generate-mirror"}),o.addDisposer(B.subscribe(()=>{}));let z=e(O,i);o.add(z,{name:"scores"});let le=I([z,O,a],([E,M,J])=>({iteration:J,candidates:M,scores:E,timestamp_ns:K()}),{name:"evaluate-event"});o.add(le,{name:"evaluate-event"}),o.addDisposer(le.subscribe(()=>{}));let ae=be([le],([E])=>{v.publish(E)},{name:"evaluate-publish"});o.add(ae,{name:"evaluate-publish"}),o.addDisposer(ae.subscribe(()=>{}));let Oe=I([z,O],([E,M])=>R.analyze(E,M),{name:"feedback"});o.add(Oe,{name:"feedback"});let Ce=I([Oe,O,a],([E,M,J])=>({iteration:J,candidates:M,feedback:E,timestamp_ns:K()}),{name:"analyze-event"});o.add(Ce,{name:"analyze-event"}),o.addDisposer(Ce.subscribe(()=>{}));let $=be([Ce],([E])=>{_.publish(E)},{name:"analyze-publish"});o.add($,{name:"analyze-publish"}),o.addDisposer($.subscribe(()=>{}));let V=I([h],([E])=>{let M=E;if(n.patience==null||M.length<=n.patience)return!1;let J=M.slice(-(n.patience+1)),q=J[0].bestScore;return J.slice(1).every(k=>k.bestScore<=q)},{name:"patience-check"});o.add(V,{name:"patience-check"});let F=I([g],([E])=>n.minScore!=null&&E>=n.minScore,{name:"min-score-check"});o.add(F,{name:"min-score-check"});let ie=I([h],([E])=>{let M=E;if(n.minDelta==null||M.length<2)return!1;let J=M[M.length-2].bestScore,q=M[M.length-1].bestScore;return Math.abs(q-J)<n.minDelta},{name:"min-delta-check"});o.add(ie,{name:"min-delta-check"});let Z=I([m],([E])=>n.maxEvaluations!=null&&E>=n.maxEvaluations,{name:"max-evaluations-check"});o.add(Z,{name:"max-evaluations-check"});let fe=I([a],([E])=>n.maxIterations!=null&&E>=n.maxIterations,{name:"max-iterations-check"});o.add(fe,{name:"max-iterations-check"});let A=I([m],([E])=>n.budget!=null&&E>=n.budget,{name:"budget-exhausted-check"});o.add(A,{name:"budget-exhausted-check"}),o.addDisposer(V.subscribe(()=>{})),o.addDisposer(F.subscribe(()=>{})),o.addDisposer(ie.subscribe(()=>{})),o.addDisposer(Z.subscribe(()=>{})),o.addDisposer(fe.subscribe(()=>{})),o.addDisposer(A.subscribe(()=>{}));let U=I([V,F,ie,Z,fe],([E,M,J,q,k])=>E?{converged:!0,reason:"patience"}:M?{converged:!0,reason:"min-score"}:J?{converged:!0,reason:"min-delta"}:q?{converged:!0,reason:"max-evaluations"}:k?{converged:!0,reason:"max-iterations"}:{converged:!1},{name:"converged"});o.add(U,{name:"converged"}),o.addDisposer(U.subscribe(()=>{}));let pe=-1,Se=be([Oe,z,O],([E,M,J])=>{let q=a.cache,k=E,D=J,H=M;if(q<=pe)return;pe=q;let{best:W,bestScore:Me}=Yo(D,H),dt=h.cache,qe={n:q,candidates:D,scores:H,feedback:k,best:W,bestScore:Me,timestamp_ns:K()},Y=[...dt,qe],we=m.cache+D.length,Te="continue",Ge,In=n.budget!=null&&we>=n.budget,Gn=p.cache;if(In)Te="budget",Ge="budget";else if(n.minScore!=null&&k.score>=n.minScore)Te="converged",Ge="min-score";else if(n.maxIterations!=null&&q>=n.maxIterations)Te="converged",Ge="max-iterations";else if(n.maxEvaluations!=null&&we>=n.maxEvaluations)Te="converged",Ge="max-evaluations";else if(n.minDelta!=null&&Y.length>=2){let Nt=Y[Y.length-2].bestScore,Jt=Y[Y.length-1].bestScore;Math.abs(Jt-Nt)<n.minDelta&&(Te="converged",Ge="min-delta")}else if(n.patience!=null&&Y.length>n.patience){let Nt=Y.slice(-(n.patience+1)),Jt=Nt[0].bestScore;Nt.slice(1).every($r=>$r.bestScore<=Jt)&&(Te="converged",Ge="patience")}Te==="continue"&&Gn&&(Te="paused"),te(()=>{f.emit(W),g.emit(k.score),h.emit(Y),m.emit(we),d.emit(k),w.publish({iteration:q,decision:Te,reason:Ge,timestamp_ns:K()}),Te==="continue"?a.emit(q+1):l.emit(Te==="converged"?"converged":Te==="budget"?"budget":"paused")})},{name:"decide-bridge"});return o.add(Se,{name:"decide-bridge"}),o.addDisposer(Se.subscribe(()=>{})),Object.assign(o,{best:f,score:g,status:l,history:h,strategy:u,iteration:a,generate:y,evaluate:v,analyze:_,decide:w,setStrategy(E){u.emit(E)},pause(){p.emit(!0)},resume(){l.cache==="paused"&&te(()=>{p.emit(!1),l.emit("running"),a.emit(a.cache+1)})}})}function Xo(r){let{best:e,score:t,status:n}=r,s=Number.isFinite(t)?t.toFixed(3):String(t),o=e??void 0;return n==="converged"?{outcome:"success",detail:`refineLoop converged at score ${s}`,artifact:o}:n==="budget"?{outcome:"partial",detail:`refineLoop hit budget at score ${s}`,artifact:o}:{outcome:"failure",detail:`refineLoop errored (status=${n})`,artifact:o}}function On(r){let e=r.name??"refine-executor",t=r.toOutput??Xo;return n=>{let s=Ve(n,i=>i!=null,{name:`${e}/gate-in`}),o=ke(s,i=>{let a=wr(r.seedFrom(i),r.evaluator,r.strategy,{...r.refine,dataset:r.datasetFor(i),name:`${e}/inner`});return I([a.status,a.best,a.score],([u,d,c])=>{let p=u;return p!=="converged"&&p!=="budget"&&p!=="errored"?null:t({best:d,score:c,status:p})},{name:`${e}/output`})},{name:e});return Ve(o,i=>i!=null,{name:`${e}/gate-out`})}}function Zo(r){if(r.length===0)return Number.NEGATIVE_INFINITY;let e=0;for(let t of r)e+=t.score;return e/r.length}function es(r){let{passCount:e,total:t,meanScore:n,threshold:s,missingArtifact:o}=r,i=Number.isFinite(n)?n.toFixed(3):String(n),a=!o&&t>0&&n>=s,u=o?["EXECUTE stage did not emit an artifact; cannot verify reactively"]:a?[`${e}/${t} eval tasks passed; mean score ${i} \u2265 ${s}`]:t===0?["No eval tasks were selected for this item \u2014 cannot verify"]:[`${e}/${t} eval tasks passed; mean score ${i} < threshold ${s}`];return a?{verified:!0,findings:u}:{verified:!1,findings:u,errorClass:"structural"}}function ts(r){return r.artifact??null}function xr(r){let e=r.name??"eval-verifier",t=r.threshold??.5,n=r.toOutput??es,s=r.extractArtifact??ts;return o=>{let i=Ve(o,u=>u!=null&&u[0]!=null&&u[1]!=null,{name:`${e}/gate-in`}),a=ke(i,u=>{let[d,c]=u,p=s(d,c);if(p==null)return L(n({scores:[],meanScore:Number.NEGATIVE_INFINITY,passCount:0,total:0,threshold:t,missingArtifact:!0}));let l=L([p],{name:`${e}/candidates`}),h=L(r.datasetFor(c),{name:`${e}/dataset`}),f=r.evaluator(l,h);return I([f],([g])=>{let m=g;if(m==null)return null;let T=Zo(m),y=m.filter(v=>v.score>=t).length;return n({scores:m,meanScore:T,passCount:y,total:m.length,threshold:t})},{name:`${e}/output`})},{name:e});return Ve(a,u=>u!=null,{name:`${e}/gate-out`})}}function ns(r){let e=r.name??"harness-pair",t=On({name:`${e}-exec`,seedFrom:r.seedFrom,evaluator:r.evaluator,strategy:r.strategy,datasetFor:r.datasetFor,refine:r.refine}),n=xr({name:`${e}-verify`,evaluator:r.evaluator,datasetFor:r.datasetFor,threshold:r.threshold});return{executor:t,verifier:n}}Ne();mt();De();oe();Ie();Ne();et();ge();oe();function Sn(r,e){let t=r.cache??0;return t>=e?!1:(r.down([[ee],[C,t+1]]),!0)}var rs=Kn((r,e)=>{r("observe"),r("signal"),e("write")});function Ht(r){let e=zt([],{name:r.name,maxSize:r.retainedLimit??1024,guard:r.guard??rs,...r.versioning!=null?{versioning:r.versioning}:{}});return e.withLatest(),r.graph&&r.graph.add(e.entries,{name:r.name}),e}function Er(r){if(r===null||typeof r!="object"||Object.isFrozen(r))return r;for(let e of Object.keys(r))Er(r[e]);return Object.freeze(r)}function os(r){let e=r.cache,n=(typeof e=="number"&&Number.isFinite(e)?e:0)+1;return r.down([[ee],[C,n]]),n}function Nr(r,e,t,n,s,o){let i=e(t,n,s);if(i===void 0)return;let a=o!=null?{...i,handlerVersion:o}:i;r.append(a)}function ut(r,e){let t=e.freeze??!0;return function(...s){let o=t?s.map(Er):s,i=ve(),a,u,d=!1,c;try{te(()=>{e.seq&&(c=os(e.seq));try{a=r(...o),e.onSuccess&&Nr(e.audit,e.onSuccess,o,a,{t_ns:i,seq:c},e.handlerVersion)}catch(p){throw u=p,d=!0,p}})}catch(p){if(d&&e.onFailure){let l=u instanceof Error?u.name:typeof u;Nr(e.audit,e.onFailure,o,u,{t_ns:i,seq:c,errorType:l},e.handlerVersion)}throw d?u:p}return a}}function kr(r,e,t=0){let n=L(t,{name:e,describeKind:"state"});return r.add(n,{name:e}),n}function _t(r){return r.relatedTo?.[0]??r.summary}vt();function wt(r,e){return ze("ai",r,e)}function Rr(r){let e=r.match(/^```(?:json)?\s*([\s\S]*?)\s*```[\s\S]*$/);return e?e[1]:r}ge();oe();$e();function Or(r){return r!=null&&typeof r=="object"&&"content"in r?String(r.content):typeof r=="string"?r:String(r)}function ss(r,e=200){return r.length<=e?r:`${r.slice(0,e)}\u2026`}function Ut(r,e,t,n){let s=n?.format??"text",o=n?.name??"prompt_node";n?.tools!==void 0&&s!=="raw"&&console.warn("promptNode: `tools` is set but `format !== 'raw'`. Tool calls in the response will be silently dropped \u2014 set `format: 'raw'` to receive the full LLMResponse with `toolCalls`.");let i=I(e,u=>{if(u.some(c=>c==null))return[];let d=typeof t=="string"?t:t(...u);return d?[{role:"user",content:d}]:[]},{name:`${o}::messages`,meta:wt("prompt_node")});return ke(i,u=>!u||u.length===0?L(null):de(d=>{let c=!1,p=!1,l,h={model:n?.model,temperature:n?.temperature,maxTokens:n?.maxTokens,systemPrompt:n?.systemPrompt,...n?.tools!==void 0?{tools:n.tools}:{}};if(n?.abort){let T=nr(n.abort);h.signal=T.signal,l=T.dispose}let f;try{f=r.invoke(u,h)}catch(T){return c=!0,d.down([[G,T]]),()=>{l?.()}}let m=Fe(f).subscribe(T=>{if(!(p||c))for(let y of T){if(c)return;if(y[0]===C){let v=y[1];if(s==="raw")d.emit(v);else try{let _=Or(v),w=s==="json"?JSON.parse(Rr(_)):_;d.emit(w)}catch(_){let w=Or(v),R=new Error(`promptNode: failed to parse LLM response as JSON: ${_.message}
|
|
45
|
-
Raw content (first 200 chars): ${ss(w)}`);c=!0,d.down([[G,R]]);return}}else if(y[0]===G){c=!0,d.down([[G,y[1]]]);return}else if(y[0]===j){c=!0,d.down([[j]]);return}else d.down([y])}});return()=>{p=!0,m(),l?.()}},{name:`${o}::call`,meta:wt("prompt_node::call")}),{name:`${o}::output`,meta:n?.meta?{...wt("prompt_node::output"),...n.meta}:wt("prompt_node::output")})}Ie();Ne();ge();mt();De();oe();vt();function xt(r,e){return ze("orchestration",r,e)}var Kt=class extends ce{constructor(e,t){super(e,t)}task(e,t,n={}){let s=(n.deps??[]).map(i=>this._resolveStep(i)),o=I(s,t,{name:e,describeKind:"derived",meta:xt("task",n.meta)});return this.add(o,{name:e}),o}classify(e,t,n,s={}){let o=this._resolveStep(t),i=I([o],([a])=>{try{return{tag:n(a),value:a}}catch(u){return{tag:"error",value:a,error:u}}},{name:e,describeKind:"derived",meta:xt("classify",s.meta)});return this.add(i,{name:e}),i}combine(e,t,n={}){let s=Object.keys(t),o=s.map(a=>this._resolveStep(t[a])),i=I(o,a=>{let u={};for(let d=0;d<s.length;d++)u[s[d]]=a[d];return u},{name:e,describeKind:"derived",meta:xt("combine",n.meta)});return this.add(i,{name:e}),i}approvalGate(e,t,n={}){let s=n.maxPending??1e3;if(s<1&&s!==Number.POSITIVE_INFINITY)throw new RangeError("approvalGate: maxPending must be >= 1");let o=n.startOpen??!1;typeof t!="string"&&this.nameOf(t)===void 0&&this.add(t,{name:`${e}/source`});let i=this._resolveStep(t),a=new ce(`${e}_state`),u=L([],{name:"pending",equals:()=>!1}),d=L(o,{name:"isOpen"}),c=I([u],([$])=>$.length,{name:"count"}),p=L(0,{name:"droppedCount"}),l=Ht({name:"decisions",retainedLimit:1024,graph:a});a.add(u,{name:"pending"}),a.add(d,{name:"isOpen"}),a.add(c,{name:"count"}),a.add(p,{name:"droppedCount"}),this.mount(`${e}_state`,a);let h=[],f=!1,g=!1,m=o,T=d.subscribe($=>{for(let V of $)V[0]===C&&(m=V[1])});this.addDisposer(T);function y(){u.emit([...h])}function v($,V,F){l.append({action:$,t_ns:ve(),...V!==void 0?{items:V,count:V.length}:{},...F!==void 0?{unflushed:F}:{},...n.handlerVersion!=null?{handlerVersion:n.handlerVersion}:{}})}function _($){if(h.push($),h.length>s){let V=h.shift();p.emit(p.cache+1),v("drop",[V])}y()}function w($){let V=h.splice(0,$);return y(),V}let R=ne([i],($,V,F)=>{let ie=F.terminalDeps[0];if(ie!==void 0){f=!0;let fe=h.length;h=[],y(),v("teardown",void 0,fe),V.down(ie===!0?[[j]]:[[G,ie]]);return}let Z=$[0];if(Z==null||Z.length===0){V.down([[Q]]);return}for(let fe of Z)m?V.emit(fe):(_(fe),V.down([[Q]]))},{name:e,describeKind:"derived",meta:xt("approval_gate",n.meta)});if(this.add(R,{name:e}),n.approver!=null){n.approver.cache&&(d.emit(!0),m=!0,n.onceOnly&&(g=!0));let V=n.approver.subscribe(F=>{for(let ie of F){if(ie[0]!==C)continue;let Z=!!ie[1];if(Z&&!m){if(n.onceOnly){if(g)continue;g=!0}te(()=>{d.emit(!0);let fe=w(h.length);v("open",fe);for(let A of fe){if(f)break;R.emit(A)}})}else if(!Z&&m){if(n.onceOnly&&g)continue;te(()=>{d.emit(!1),v("close")})}}});this.addDisposer(V)}let b=$=>{if(f)throw new Error(`approvalGate: ${$}() called after the gate was torn down`)},x=($=1)=>{b("approve");let V=w($);for(let F of V){if(f)break;R.emit(F)}},O=($=1)=>{b("reject"),w($)},S=($,V=1)=>{b("modify");let F=[...h],ie=w(V);for(let Z=0;Z<ie.length&&!f;Z++)R.emit($(ie[Z],Z,F))},N=()=>{b("open"),d.emit(!0);let $=w(h.length);for(let V of $){if(f)break;R.emit(V)}},P=()=>{b("close"),!(n.onceOnly&&g)&&d.emit(!1)},B=ut(x,{audit:l,freeze:!1,onSuccess:($,V,F)=>({action:"approve",count:$[0]??1,t_ns:F.t_ns,...n.handlerVersion!=null?{handlerVersion:n.handlerVersion}:{}}),onFailure:($,V,F)=>({action:"drop",t_ns:F.t_ns,errorType:F.errorType,...n.handlerVersion!=null?{handlerVersion:n.handlerVersion}:{}})}),z=ut(O,{audit:l,freeze:!1,onSuccess:($,V,F)=>({action:"reject",count:$[0]??1,t_ns:F.t_ns,...n.handlerVersion!=null?{handlerVersion:n.handlerVersion}:{}}),onFailure:($,V,F)=>({action:"drop",t_ns:F.t_ns,errorType:F.errorType,...n.handlerVersion!=null?{handlerVersion:n.handlerVersion}:{}})}),le=ut(S,{audit:l,freeze:!1,onSuccess:($,V,F)=>({action:"modify",count:$[1]??1,t_ns:F.t_ns,...n.handlerVersion!=null?{handlerVersion:n.handlerVersion}:{}}),onFailure:($,V,F)=>({action:"drop",t_ns:F.t_ns,errorType:F.errorType,...n.handlerVersion!=null?{handlerVersion:n.handlerVersion}:{}})}),ae=ut(N,{audit:l,freeze:!1,onSuccess:($,V,F)=>({action:"open",t_ns:F.t_ns,...n.handlerVersion!=null?{handlerVersion:n.handlerVersion}:{}}),onFailure:($,V,F)=>({action:"drop",t_ns:F.t_ns,errorType:F.errorType,...n.handlerVersion!=null?{handlerVersion:n.handlerVersion}:{}})}),Oe=ut(P,{audit:l,freeze:!1,onSuccess:($,V,F)=>({action:"close",t_ns:F.t_ns,...n.handlerVersion!=null?{handlerVersion:n.handlerVersion}:{}}),onFailure:($,V,F)=>({action:"drop",t_ns:F.t_ns,errorType:F.errorType,...n.handlerVersion!=null?{handlerVersion:n.handlerVersion}:{}})});return this.addDisposer(c.subscribe(()=>{})),{node:R,pending:u,count:c,isOpen:d,droppedCount:p,decisions:l,audit:l,approve:B,reject:z,modify:le,open:ae,close:Oe}}approval(e,t,n,s={}){return this.approvalGate(e,t,{...s,approver:n,maxPending:1})}catch(e,t,n,s={}){let o=this._resolveStep(t),i=s.on??"errored",a=ne([o],(u,d,c)=>{let p=c.terminalDeps[0];if(p!==void 0){let h=p===!0?{kind:"completed"}:{kind:"errored",error:p};if(i==="terminal"||i===h.kind){d.emit(n(h,d));return}d.down(h.kind==="completed"?[[j]]:[[G,h.error]]);return}let l=u[0];if(l==null||l.length===0){d.down([[Q]]);return}for(let h of l)d.emit(h)},{name:e,describeKind:"derived",completeWhenDepsComplete:s.completeWhenDepsComplete??!(i==="completed"||i==="terminal"),errorWhenDepsError:!(i==="errored"||i==="terminal"),meta:xt("catch",s.meta)});return this.add(a,{name:e}),a}_resolveStep(e){if(typeof e=="string")return this.resolve(e);if(this.nameOf(e)===void 0)throw new Error(`PipelineGraph "${this.name}": Node dep is not registered. Pass a string path or call graph.add(node) first.`);return e}};function An(r,e){let t=new Kt(r,e),{factory:n,factoryArgs:s,...o}=e??{};return t.tagFactory("pipelineGraph",ht(o)),t}function Sr(r,e,t,n=0){if(!Number.isFinite(r))return n;if(!Number.isFinite(e)||e<=0||!Number.isFinite(t)||t<=0)return Math.max(n,r);let s=r*Math.exp(-t*e);return Math.max(n,s)}Ne();vt();Ie();ge();oe();var Dn=class{_version=0;_buf;constructor(e){this._buf=e?[...e]:[]}get version(){return this._version}get size(){return this._buf.length}at(e){if(!Number.isInteger(e))return;let t=e>=0?e:this._buf.length+e;if(!(t<0||t>=this._buf.length))return this._buf[t]}append(e){this._buf.push(e),this._version+=1}appendMany(e){if(e.length===0)return;let t=this._buf.length;this._buf.length=t+e.length;for(let n=0;n<e.length;n++)this._buf[t+n]=e[n];this._version+=1}insert(e,t){if(!Number.isInteger(e)||e<0||e>this._buf.length)throw new RangeError(`insert: index ${e} out of range [0, ${this._buf.length}]`);this._buf.splice(e,0,t),this._version+=1}insertMany(e,t){if(!Number.isInteger(e)||e<0||e>this._buf.length)throw new RangeError(`insertMany: index ${e} out of range [0, ${this._buf.length}]`);t.length!==0&&(this._buf.splice(e,0,...t),this._version+=1)}pop(e){if(this._buf.length===0)throw new RangeError("pop from empty list");if(!Number.isInteger(e))throw new RangeError(`pop: index ${e} must be an integer`);let t=e>=0?e:this._buf.length+e;if(t<0||t>=this._buf.length)throw new RangeError(`pop: index ${e} out of range`);let[n]=this._buf.splice(t,1);return this._version+=1,n}clear(){let e=this._buf.length;return e===0?0:(this._buf.length=0,this._version+=1,e)}toArray(){return[...this._buf]}};function Ar(r,e={}){let{name:t,versioning:n,backend:s}=e,o=s??new Dn(r),i=L(o.toArray(),{name:t,describeKind:"state",equals:(d,c)=>d===c,...n!=null?{versioning:n}:{}});function a(){let d=o.toArray();te(()=>{i.down([[ee]]),i.down([[C,d]])})}function u(d){let c=o.version;try{return d()}finally{o.version!==c&&a()}}return{items:i,get size(){return o.size},at(d){return o.at(d)},append(d){u(()=>o.append(d))},appendMany(d){u(()=>o.appendMany(d))},insert(d,c){u(()=>o.insert(d,c))},insertMany(d,c){u(()=>o.insertMany(d,c))},pop(d=-1){return u(()=>o.pop(d))},clear(){u(()=>o.clear())},dispose(){}}}$e();function is(r,e){if(!Number.isFinite(r)||!Number.isInteger(r)||r<0)throw new Error(`${e} must be a non-negative integer`);return r}function as(r,e){return ze("job_queue",r,e)}var Cn=class extends ce{_pending;_jobs;_seqCursor;pending;jobs;depth;events;audit;constructor(e,t={}){super(e,t.graph),this._pending=Ar([],{name:"pending"}),this._jobs=it({name:"jobs"}),this.pending=this._pending.items,this.jobs=this._jobs.entries,this.add(this.pending,{name:"pending"}),this.add(this.jobs,{name:"jobs"}),this.depth=I([this.pending],([n])=>n.length,{name:"depth",describeKind:"derived",meta:as("queue_depth"),initial:0}),this.add(this.depth,{name:"depth"}),this.addDisposer(ye(this.depth)),this.events=Ht({name:"events",retainedLimit:1024,graph:this}),this.audit=this.events,this._seqCursor=kr(this,"seq",0)}_bumpSeq(){let t=(this._seqCursor.cache??0)+1;return this._seqCursor.emit(t),t}attachEventStorage(e){return this.events.attachStorage(e)}enqueue(e,t={}){let n=this._bumpSeq(),s=t.id??`${this.name}-${n}`;if(this._jobs.get(s)!==void 0)throw new Error(`jobQueue("${this.name}"): duplicate job id "${s}"`);let o={id:s,payload:e,attempts:0,metadata:Object.freeze({...t.metadata??{}}),state:"queued"};return this._jobs.set(s,o),this._pending.append(s),this.events.append({action:"enqueue",id:s,payload:e,t_ns:ve(),seq:n}),s}claim(e=1){let t=is(e,"job queue claim limit");if(t===0)return[];let n=[];for(;n.length<t&&this.pending.cache.length!==0;){let o=this._pending.pop(0),i=this._jobs.get(o);if(!i||i.state!=="queued")continue;let a={...i,state:"inflight",attempts:i.attempts+1};this._jobs.set(o,a),n.push(a),this.events.append({action:"claim",id:o,attempts:a.attempts,t_ns:ve(),seq:this._bumpSeq()})}return n}ack(e){let t=this._jobs.get(e);return!t||t.state!=="inflight"?!1:(this._jobs.delete(e),this.events.append({action:"ack",id:e,attempts:t.attempts,t_ns:ve(),seq:this._bumpSeq()}),!0)}nack(e,t={}){let n=this._jobs.get(e);return!n||n.state!=="inflight"?!1:t.requeue??!0?(this._jobs.set(e,{...n,state:"queued"}),this._pending.append(e),this.events.append({action:"nack",id:e,attempts:n.attempts,t_ns:ve(),seq:this._bumpSeq()}),!0):(this._jobs.delete(e),this.events.append({action:"nack",id:e,attempts:n.attempts,t_ns:ve(),seq:this._bumpSeq()}),!0)}removeById(e){let t=this._jobs.get(e);if(!t)return!1;if(t.state==="queued"){let s=this.pending.cache.indexOf(e);s>=0&&this._pending.pop(s)}return this._jobs.delete(e),this.events.append({action:"remove",id:e,attempts:t.attempts,t_ns:ve(),seq:this._bumpSeq()}),!0}consumeFrom(e,t){return e.subscribe(n=>{for(let s of n){if(s[0]!==C)continue;let o=s[1];this.enqueue(o,t?{metadata:t.metadata}:void 0)}})}};function Dr(r,e){return new Cn(r,e)}Ne();oe();function Mn(){let r=it({name:"strategy-entries"}),e=I([r.entries],([i])=>{let a=i;return new Map(a)},{name:"strategy-model",equals:(i,a)=>{let u=i,d=a;if(u.size!==d.size)return!1;for(let[c,p]of u){let l=d.get(c);if(!l||p.attempts!==l.attempts||p.successes!==l.successes)return!1}return!0}});function t(i,a,u){let d=st(i,a),c=r.get(d),p=(c?.attempts??0)+1,l=(c?.successes??0)+(u?1:0);r.set(d,{rootCause:i,intervention:a,attempts:p,successes:l,successRate:l/p})}function n(i,a){return r.get(st(i,a))}let s=e.subscribe(()=>{});function o(){s()}return{node:e,record:t,lookup:n,dispose:o}}function us(r,e,t,n,s){let o={...rt,...s?.severityWeights},i=s?.decayRate??ot,a=s?.effectivenessThreshold??.7,u=s?.effectivenessBoost??15,d=[r,e,t];return n&&d.push(n),I(d,c=>{let p=c[0],l=c[1],h=c[2],f=n?c[3]:0,g=o[p.severity??"medium"],m=(K()-h)/1e9,T=Sr(g,m,i,0),y=st(p.rootCause,p.intervention),v=l.get(y);return v&&v.successRate>=a&&(T+=u),T+=f*20,T},{name:"priority-score"})}var Cr="intake",ds="triage-output",Mr="retry",Ir="verify-results",Gr="__unrouted";function Pr(r,e){let t=bt(e,hn,(n,s)=>n.replace("{{item}}",JSON.stringify(s)));return n=>Ut(r,[n],t,{name:"execute",format:"json"})}function Lr(r,e){let t=bt(e,mn,(n,s)=>{let[o,i]=s;return n.replace("{{execution}}",JSON.stringify(o)).replace("{{item}}",JSON.stringify(i))});return n=>Ut(r,[n],s=>s==null?"":t(s),{name:"verify",format:"json"})}var Wt=class extends ce{queues;jobs;gates;queueTopics;strategy;totalRetries;totalReingestions;priorityScores;constructor(e,t,n,s,o,i,a,u,d){super(e),this.queues=t,this.queueTopics=n,this.jobs=s,this.gates=o,this.strategy=i,this.totalRetries=a,this.totalReingestions=u,this.priorityScores=d}get intake(){return this.queues.topic(Cr)}get verifyResults(){return this.queues.topic(Ir)}get retry(){return this.queues.topic(Mr)}get unrouted(){return this.queues.topic(Gr)}stageNodes(){let e=this.queues,t=i=>e.has(i)?`queues::${i}::latest`:null,n=i=>i==null?[]:[i],s=_e.flatMap(i=>n(t(i))),o=[];for(let[i]of this.gates)o.push(`gates::${i}/gate`);return[{label:"INTAKE",paths:n(t("intake"))},{label:"TRIAGE",paths:["triage"]},{label:"QUEUE",paths:s},{label:"GATE",paths:o},{label:"EXECUTE",paths:["execute"]},{label:"VERIFY",paths:n(t("verify-results"))},{label:"REFLECT",paths:["reflect"]},{label:"STRATEGY",paths:["strategy"]}]}};function cs(r,e){let t=e.adapter,n=e.maxRetries??2,s=e.retainedLimit??1e3,o=e.errorClassifier??Gt,i=new Map;for(let k of _e)i.set(k,{...It[k],...e.queues?.[k]});let a=qt(`${r}/queues`,{defaultTopicOptions:{retainedLimit:s}}),u=a.topic(Cr),d=a.topic(ds),c=a.topic(Mr),p=a.topic(Ir),l=new Map;for(let k of _e)l.set(k,a.topic(k));let h=a.topic(Gr),f=Mn(),g=gt(u.latest,f.node),m=bt(e.triagePrompt,pn,(k,D)=>{let[H,W]=D;return k.replace("{{strategy}}",JSON.stringify(Array.from(W.entries()))).replace("{{item}}",JSON.stringify(H))}),T=Ut(t,[g],k=>{let D=k;return!D||!D[0]?"":m(D)},{name:"triage",format:"json"}),y=gt(T,g),_=be([y],([k])=>{if(k==null)return;let[D,H]=k;if(!D?.route)return;let W=H?.[0],Me={...D,...W};d.publish(Me)}).subscribe(()=>{}),w=new Set(_e);for(let k of _e)Rn(`bridge/${k}`,d,l.get(k),{map:D=>D.route===k?D:void 0});Rn("bridge/__unrouted",d,h,{map:k=>w.has(k.route)?void 0:k});let R=new Map,b=new Map;for(let k of _e)R.set(k,Dr(`jobs/${k}`));let x=[];for(let k of _e){let D=l.get(k),H=R.get(k),W=new WeakSet,Me=be([D.events],([dt])=>{let qe=dt??[];for(let Y of qe){if(W.has(Y))continue;W.add(Y);let we=H.enqueue(Y);b.set(_t(Y),{route:k,id:we})}},{name:`jobs/${k}-mirror`});x.push(Me.subscribe(()=>{}))}function O(k){let D=_t(k),H=b.get(D);H&&(R.get(H.route)?.removeById(H.id),b.delete(D))}let S=An("gates"),N=new Map;for(let k of _e){let D=i.get(k);if(!D.gated)continue;let H=l.get(k),W=S.approvalGate(`${k}/gate`,H.latest,{maxPending:D.maxPending,startOpen:D.startOpen});N.set(k,W)}let P=[];for(let k of _e)i.get(k).gated&&N.has(k)?P.push(N.get(k).node):P.push(l.get(k).latest);P.push(c.latest);let B=or(...P),le=(e.executor??Pr(t,e.executePrompt))(B),ae=gt(le,B),Ce=(e.verifier??Lr(t,e.verifyPrompt))(ae),$=gt(Ce,ae),V=e.maxReingestions??1,F=Math.min(e.maxTotalRetries??n*10,100),ie=Math.min(e.maxTotalReingestions??V*10,100),Z=L(0),fe=L(0);function A(k,D,H){let W={item:H,outcome:D?.outcome??"failure",detail:D?.detail??"unknown",artifact:D?.artifact};return{item:H,execution:W,verified:k.verified,findings:k.findings??[],errorClass:k.errorClass}}function U(k,D){f.record(D.rootCause,D.intervention,!0),p.publish(k),O(D)}function pe(k,D){let H=_t(D),W=D.$retries??0,Me={...D,$retries:W+1,summary:`[RETRY ${W+1}/${n}] ${H} \u2014 Previous attempt failed: ${k.findings.join("; ")}`,relatedTo:[H]};c.publish(Me)}function Se(k,D){f.record(D.rootCause,D.intervention,!1),p.publish(k),O(D);let H=_t(D),W=D.$reingestions??0;W<V&&Sn(fe,ie)&&u.publish({source:D.source,summary:`Verification failed for: ${H}`,evidence:k.findings.join(`
|
|
45
|
+
Raw content (first 200 chars): ${ss(w)}`);c=!0,d.down([[G,R]]);return}}else if(y[0]===G){c=!0,d.down([[G,y[1]]]);return}else if(y[0]===j){c=!0,d.down([[j]]);return}else d.down([y])}});return()=>{p=!0,m(),l?.()}},{name:`${o}::call`,meta:wt("prompt_node::call")}),{name:`${o}::output`,meta:n?.meta?{...wt("prompt_node::output"),...n.meta}:wt("prompt_node::output")})}Ie();Ne();ge();mt();De();oe();vt();function xt(r,e){return ze("orchestration",r,e)}var Kt=class extends ce{constructor(e,t){super(e,t)}task(e,t,n={}){let s=(n.deps??[]).map(i=>this._resolveStep(i)),o=I(s,t,{name:e,describeKind:"derived",meta:xt("task",n.meta)});return this.add(o,{name:e}),o}classify(e,t,n,s={}){let o=this._resolveStep(t),i=I([o],([a])=>{try{return{tag:n(a),value:a}}catch(u){return{tag:"error",value:a,error:u}}},{name:e,describeKind:"derived",meta:xt("classify",s.meta)});return this.add(i,{name:e}),i}combine(e,t,n={}){let s=Object.keys(t),o=s.map(a=>this._resolveStep(t[a])),i=I(o,a=>{let u={};for(let d=0;d<s.length;d++)u[s[d]]=a[d];return u},{name:e,describeKind:"derived",meta:xt("combine",n.meta)});return this.add(i,{name:e}),i}approvalGate(e,t,n={}){let s=n.maxPending??1e3;if(s<1&&s!==Number.POSITIVE_INFINITY)throw new RangeError("approvalGate: maxPending must be >= 1");let o=n.startOpen??!1;typeof t!="string"&&this.nameOf(t)===void 0&&this.add(t,{name:`${e}/source`});let i=this._resolveStep(t),a=new ce(`${e}_state`),u=L([],{name:"pending",equals:()=>!1}),d=L(o,{name:"isOpen"}),c=I([u],([$])=>$.length,{name:"count"}),p=L(0,{name:"droppedCount"}),l=Ht({name:"decisions",retainedLimit:1024,graph:a});a.add(u,{name:"pending"}),a.add(d,{name:"isOpen"}),a.add(c,{name:"count"}),a.add(p,{name:"droppedCount"}),this.mount(`${e}_state`,a);let h=[],f=!1,g=!1,m=o,T=d.subscribe($=>{for(let V of $)V[0]===C&&(m=V[1])});this.addDisposer(T);function y(){u.emit([...h])}function v($,V,F){l.append({action:$,t_ns:ve(),...V!==void 0?{items:V,count:V.length}:{},...F!==void 0?{unflushed:F}:{},...n.handlerVersion!=null?{handlerVersion:n.handlerVersion}:{}})}function _($){if(h.push($),h.length>s){let V=h.shift();p.emit(p.cache+1),v("drop",[V])}y()}function w($){let V=h.splice(0,$);return y(),V}let R=ne([i],($,V,F)=>{let ie=F.terminalDeps[0];if(ie!==void 0){f=!0;let fe=h.length;h=[],y(),v("teardown",void 0,fe),V.down(ie===!0?[[j]]:[[G,ie]]);return}let Z=$[0];if(Z==null||Z.length===0){V.down([[Q]]);return}for(let fe of Z)m?V.emit(fe):(_(fe),V.down([[Q]]))},{name:e,describeKind:"derived",meta:xt("approval_gate",n.meta)});if(this.add(R,{name:e}),n.approver!=null){n.approver.cache&&(d.emit(!0),m=!0,n.onceOnly&&(g=!0));let V=n.approver.subscribe(F=>{for(let ie of F){if(ie[0]!==C)continue;let Z=!!ie[1];if(Z&&!m){if(n.onceOnly){if(g)continue;g=!0}te(()=>{d.emit(!0);let fe=w(h.length);v("open",fe);for(let A of fe){if(f)break;R.emit(A)}})}else if(!Z&&m){if(n.onceOnly&&g)continue;te(()=>{d.emit(!1),v("close")})}}});this.addDisposer(V)}let b=$=>{if(f)throw new Error(`approvalGate: ${$}() called after the gate was torn down`)},x=($=1)=>{b("approve");let V=w($);for(let F of V){if(f)break;R.emit(F)}},O=($=1)=>{b("reject"),w($)},S=($,V=1)=>{b("modify");let F=[...h],ie=w(V);for(let Z=0;Z<ie.length&&!f;Z++)R.emit($(ie[Z],Z,F))},N=()=>{b("open"),d.emit(!0);let $=w(h.length);for(let V of $){if(f)break;R.emit(V)}},P=()=>{b("close"),!(n.onceOnly&&g)&&d.emit(!1)},B=ut(x,{audit:l,freeze:!1,onSuccess:($,V,F)=>({action:"approve",count:$[0]??1,t_ns:F.t_ns,...n.handlerVersion!=null?{handlerVersion:n.handlerVersion}:{}}),onFailure:($,V,F)=>({action:"drop",t_ns:F.t_ns,errorType:F.errorType,...n.handlerVersion!=null?{handlerVersion:n.handlerVersion}:{}})}),z=ut(O,{audit:l,freeze:!1,onSuccess:($,V,F)=>({action:"reject",count:$[0]??1,t_ns:F.t_ns,...n.handlerVersion!=null?{handlerVersion:n.handlerVersion}:{}}),onFailure:($,V,F)=>({action:"drop",t_ns:F.t_ns,errorType:F.errorType,...n.handlerVersion!=null?{handlerVersion:n.handlerVersion}:{}})}),le=ut(S,{audit:l,freeze:!1,onSuccess:($,V,F)=>({action:"modify",count:$[1]??1,t_ns:F.t_ns,...n.handlerVersion!=null?{handlerVersion:n.handlerVersion}:{}}),onFailure:($,V,F)=>({action:"drop",t_ns:F.t_ns,errorType:F.errorType,...n.handlerVersion!=null?{handlerVersion:n.handlerVersion}:{}})}),ae=ut(N,{audit:l,freeze:!1,onSuccess:($,V,F)=>({action:"open",t_ns:F.t_ns,...n.handlerVersion!=null?{handlerVersion:n.handlerVersion}:{}}),onFailure:($,V,F)=>({action:"drop",t_ns:F.t_ns,errorType:F.errorType,...n.handlerVersion!=null?{handlerVersion:n.handlerVersion}:{}})}),Oe=ut(P,{audit:l,freeze:!1,onSuccess:($,V,F)=>({action:"close",t_ns:F.t_ns,...n.handlerVersion!=null?{handlerVersion:n.handlerVersion}:{}}),onFailure:($,V,F)=>({action:"drop",t_ns:F.t_ns,errorType:F.errorType,...n.handlerVersion!=null?{handlerVersion:n.handlerVersion}:{}})});return this.addDisposer(c.subscribe(()=>{})),{node:R,pending:u,count:c,isOpen:d,droppedCount:p,decisions:l,audit:l,approve:B,reject:z,modify:le,open:ae,close:Oe}}approval(e,t,n,s={}){return this.approvalGate(e,t,{...s,approver:n,maxPending:1})}catch(e,t,n,s={}){let o=this._resolveStep(t),i=s.on??"errored",a=ne([o],(u,d,c)=>{let p=c.terminalDeps[0];if(p!==void 0){let h=p===!0?{kind:"completed"}:{kind:"errored",error:p};if(i==="terminal"||i===h.kind){d.emit(n(h,d));return}d.down(h.kind==="completed"?[[j]]:[[G,h.error]]);return}let l=u[0];if(l==null||l.length===0){d.down([[Q]]);return}for(let h of l)d.emit(h)},{name:e,describeKind:"derived",completeWhenDepsComplete:s.completeWhenDepsComplete??!(i==="completed"||i==="terminal"),errorWhenDepsError:!(i==="errored"||i==="terminal"),meta:xt("catch",s.meta)});return this.add(a,{name:e}),a}_resolveStep(e){if(typeof e=="string")return this.resolve(e);if(this.nameOf(e)===void 0)throw new Error(`PipelineGraph "${this.name}": Node dep is not registered. Pass a string path or call graph.add(node) first.`);return e}};function An(r,e){let t=new Kt(r,e),{factory:n,factoryArgs:s,...o}=e??{};return t.tagFactory("pipelineGraph",ht(o)),t}var au=Math.LN2/604800;function Sr(r,e,t,n=0){if(!Number.isFinite(r))return n;if(!Number.isFinite(e)||e<=0||!Number.isFinite(t)||t<=0)return Math.max(n,r);let s=r*Math.exp(-t*e);return Math.max(n,s)}Ne();vt();Ie();ge();oe();var Dn=class{_version=0;_buf;constructor(e){this._buf=e?[...e]:[]}get version(){return this._version}get size(){return this._buf.length}at(e){if(!Number.isInteger(e))return;let t=e>=0?e:this._buf.length+e;if(!(t<0||t>=this._buf.length))return this._buf[t]}append(e){this._buf.push(e),this._version+=1}appendMany(e){if(e.length===0)return;let t=this._buf.length;this._buf.length=t+e.length;for(let n=0;n<e.length;n++)this._buf[t+n]=e[n];this._version+=1}insert(e,t){if(!Number.isInteger(e)||e<0||e>this._buf.length)throw new RangeError(`insert: index ${e} out of range [0, ${this._buf.length}]`);this._buf.splice(e,0,t),this._version+=1}insertMany(e,t){if(!Number.isInteger(e)||e<0||e>this._buf.length)throw new RangeError(`insertMany: index ${e} out of range [0, ${this._buf.length}]`);t.length!==0&&(this._buf.splice(e,0,...t),this._version+=1)}pop(e){if(this._buf.length===0)throw new RangeError("pop from empty list");if(!Number.isInteger(e))throw new RangeError(`pop: index ${e} must be an integer`);let t=e>=0?e:this._buf.length+e;if(t<0||t>=this._buf.length)throw new RangeError(`pop: index ${e} out of range`);let[n]=this._buf.splice(t,1);return this._version+=1,n}clear(){let e=this._buf.length;return e===0?0:(this._buf.length=0,this._version+=1,e)}toArray(){return[...this._buf]}};function Ar(r,e={}){let{name:t,versioning:n,backend:s}=e,o=s??new Dn(r),i=L(o.toArray(),{name:t,describeKind:"state",equals:(d,c)=>d===c,...n!=null?{versioning:n}:{}});function a(){let d=o.toArray();te(()=>{i.down([[ee]]),i.down([[C,d]])})}function u(d){let c=o.version;try{return d()}finally{o.version!==c&&a()}}return{items:i,get size(){return o.size},at(d){return o.at(d)},append(d){u(()=>o.append(d))},appendMany(d){u(()=>o.appendMany(d))},insert(d,c){u(()=>o.insert(d,c))},insertMany(d,c){u(()=>o.insertMany(d,c))},pop(d=-1){return u(()=>o.pop(d))},clear(){u(()=>o.clear())},dispose(){}}}$e();function is(r,e){if(!Number.isFinite(r)||!Number.isInteger(r)||r<0)throw new Error(`${e} must be a non-negative integer`);return r}function as(r,e){return ze("job_queue",r,e)}var Cn=class extends ce{_pending;_jobs;_seqCursor;pending;jobs;depth;events;audit;constructor(e,t={}){super(e,t.graph),this._pending=Ar([],{name:"pending"}),this._jobs=it({name:"jobs"}),this.pending=this._pending.items,this.jobs=this._jobs.entries,this.add(this.pending,{name:"pending"}),this.add(this.jobs,{name:"jobs"}),this.depth=I([this.pending],([n])=>n.length,{name:"depth",describeKind:"derived",meta:as("queue_depth"),initial:0}),this.add(this.depth,{name:"depth"}),this.addDisposer(ye(this.depth)),this.events=Ht({name:"events",retainedLimit:1024,graph:this}),this.audit=this.events,this._seqCursor=kr(this,"seq",0)}_bumpSeq(){let t=(this._seqCursor.cache??0)+1;return this._seqCursor.emit(t),t}attachEventStorage(e){return this.events.attachStorage(e)}enqueue(e,t={}){let n=this._bumpSeq(),s=t.id??`${this.name}-${n}`;if(this._jobs.get(s)!==void 0)throw new Error(`jobQueue("${this.name}"): duplicate job id "${s}"`);let o={id:s,payload:e,attempts:0,metadata:Object.freeze({...t.metadata??{}}),state:"queued"};return this._jobs.set(s,o),this._pending.append(s),this.events.append({action:"enqueue",id:s,payload:e,t_ns:ve(),seq:n}),s}claim(e=1){let t=is(e,"job queue claim limit");if(t===0)return[];let n=[];for(;n.length<t&&this.pending.cache.length!==0;){let o=this._pending.pop(0),i=this._jobs.get(o);if(!i||i.state!=="queued")continue;let a={...i,state:"inflight",attempts:i.attempts+1};this._jobs.set(o,a),n.push(a),this.events.append({action:"claim",id:o,attempts:a.attempts,t_ns:ve(),seq:this._bumpSeq()})}return n}ack(e){let t=this._jobs.get(e);return!t||t.state!=="inflight"?!1:(this._jobs.delete(e),this.events.append({action:"ack",id:e,attempts:t.attempts,t_ns:ve(),seq:this._bumpSeq()}),!0)}nack(e,t={}){let n=this._jobs.get(e);return!n||n.state!=="inflight"?!1:t.requeue??!0?(this._jobs.set(e,{...n,state:"queued"}),this._pending.append(e),this.events.append({action:"nack",id:e,attempts:n.attempts,t_ns:ve(),seq:this._bumpSeq()}),!0):(this._jobs.delete(e),this.events.append({action:"nack",id:e,attempts:n.attempts,t_ns:ve(),seq:this._bumpSeq()}),!0)}removeById(e){let t=this._jobs.get(e);if(!t)return!1;if(t.state==="queued"){let s=this.pending.cache.indexOf(e);s>=0&&this._pending.pop(s)}return this._jobs.delete(e),this.events.append({action:"remove",id:e,attempts:t.attempts,t_ns:ve(),seq:this._bumpSeq()}),!0}consumeFrom(e,t){return e.subscribe(n=>{for(let s of n){if(s[0]!==C)continue;let o=s[1];this.enqueue(o,t?{metadata:t.metadata}:void 0)}})}};function Dr(r,e){return new Cn(r,e)}Ne();oe();function Mn(){let r=it({name:"strategy-entries"}),e=I([r.entries],([i])=>{let a=i;return new Map(a)},{name:"strategy-model",equals:(i,a)=>{let u=i,d=a;if(u.size!==d.size)return!1;for(let[c,p]of u){let l=d.get(c);if(!l||p.attempts!==l.attempts||p.successes!==l.successes)return!1}return!0}});function t(i,a,u){let d=st(i,a),c=r.get(d),p=(c?.attempts??0)+1,l=(c?.successes??0)+(u?1:0);r.set(d,{rootCause:i,intervention:a,attempts:p,successes:l,successRate:l/p})}function n(i,a){return r.get(st(i,a))}let s=e.subscribe(()=>{});function o(){s()}return{node:e,record:t,lookup:n,dispose:o}}function us(r,e,t,n,s){let o={...rt,...s?.severityWeights},i=s?.decayRate??ot,a=s?.effectivenessThreshold??.7,u=s?.effectivenessBoost??15,d=[r,e,t];return n&&d.push(n),I(d,c=>{let p=c[0],l=c[1],h=c[2],f=n?c[3]:0,g=o[p.severity??"medium"],m=(K()-h)/1e9,T=Sr(g,m,i,0),y=st(p.rootCause,p.intervention),v=l.get(y);return v&&v.successRate>=a&&(T+=u),T+=f*20,T},{name:"priority-score"})}var Cr="intake",ds="triage-output",Mr="retry",Ir="verify-results",Gr="__unrouted";function Pr(r,e){let t=bt(e,hn,(n,s)=>n.replace("{{item}}",JSON.stringify(s)));return n=>Ut(r,[n],t,{name:"execute",format:"json"})}function Lr(r,e){let t=bt(e,mn,(n,s)=>{let[o,i]=s;return n.replace("{{execution}}",JSON.stringify(o)).replace("{{item}}",JSON.stringify(i))});return n=>Ut(r,[n],s=>s==null?"":t(s),{name:"verify",format:"json"})}var Wt=class extends ce{queues;jobs;gates;queueTopics;strategy;totalRetries;totalReingestions;priorityScores;constructor(e,t,n,s,o,i,a,u,d){super(e),this.queues=t,this.queueTopics=n,this.jobs=s,this.gates=o,this.strategy=i,this.totalRetries=a,this.totalReingestions=u,this.priorityScores=d}get intake(){return this.queues.topic(Cr)}get verifyResults(){return this.queues.topic(Ir)}get retry(){return this.queues.topic(Mr)}get unrouted(){return this.queues.topic(Gr)}stageNodes(){let e=this.queues,t=i=>e.has(i)?`queues::${i}::latest`:null,n=i=>i==null?[]:[i],s=_e.flatMap(i=>n(t(i))),o=[];for(let[i]of this.gates)o.push(`gates::${i}/gate`);return[{label:"INTAKE",paths:n(t("intake"))},{label:"TRIAGE",paths:["triage"]},{label:"QUEUE",paths:s},{label:"GATE",paths:o},{label:"EXECUTE",paths:["execute"]},{label:"VERIFY",paths:n(t("verify-results"))},{label:"REFLECT",paths:["reflect"]},{label:"STRATEGY",paths:["strategy"]}]}};function cs(r,e){let t=e.adapter,n=e.maxRetries??2,s=e.retainedLimit??1e3,o=e.errorClassifier??Gt,i=new Map;for(let k of _e)i.set(k,{...It[k],...e.queues?.[k]});let a=qt(`${r}/queues`,{defaultTopicOptions:{retainedLimit:s}}),u=a.topic(Cr),d=a.topic(ds),c=a.topic(Mr),p=a.topic(Ir),l=new Map;for(let k of _e)l.set(k,a.topic(k));let h=a.topic(Gr),f=Mn(),g=gt(u.latest,f.node),m=bt(e.triagePrompt,pn,(k,D)=>{let[H,W]=D;return k.replace("{{strategy}}",JSON.stringify(Array.from(W.entries()))).replace("{{item}}",JSON.stringify(H))}),T=Ut(t,[g],k=>{let D=k;return!D||!D[0]?"":m(D)},{name:"triage",format:"json"}),y=gt(T,g),_=be([y],([k])=>{if(k==null)return;let[D,H]=k;if(!D?.route)return;let W=H?.[0],Me={...D,...W};d.publish(Me)}).subscribe(()=>{}),w=new Set(_e);for(let k of _e)Rn(`bridge/${k}`,d,l.get(k),{map:D=>D.route===k?D:void 0});Rn("bridge/__unrouted",d,h,{map:k=>w.has(k.route)?void 0:k});let R=new Map,b=new Map;for(let k of _e)R.set(k,Dr(`jobs/${k}`));let x=[];for(let k of _e){let D=l.get(k),H=R.get(k),W=new WeakSet,Me=be([D.events],([dt])=>{let qe=dt??[];for(let Y of qe){if(W.has(Y))continue;W.add(Y);let we=H.enqueue(Y);b.set(_t(Y),{route:k,id:we})}},{name:`jobs/${k}-mirror`});x.push(Me.subscribe(()=>{}))}function O(k){let D=_t(k),H=b.get(D);H&&(R.get(H.route)?.removeById(H.id),b.delete(D))}let S=An("gates"),N=new Map;for(let k of _e){let D=i.get(k);if(!D.gated)continue;let H=l.get(k),W=S.approvalGate(`${k}/gate`,H.latest,{maxPending:D.maxPending,startOpen:D.startOpen});N.set(k,W)}let P=[];for(let k of _e)i.get(k).gated&&N.has(k)?P.push(N.get(k).node):P.push(l.get(k).latest);P.push(c.latest);let B=or(...P),le=(e.executor??Pr(t,e.executePrompt))(B),ae=gt(le,B),Ce=(e.verifier??Lr(t,e.verifyPrompt))(ae),$=gt(Ce,ae),V=e.maxReingestions??1,F=Math.min(e.maxTotalRetries??n*10,100),ie=Math.min(e.maxTotalReingestions??V*10,100),Z=L(0),fe=L(0);function A(k,D,H){let W={item:H,outcome:D?.outcome??"failure",detail:D?.detail??"unknown",artifact:D?.artifact};return{item:H,execution:W,verified:k.verified,findings:k.findings??[],errorClass:k.errorClass}}function U(k,D){f.record(D.rootCause,D.intervention,!0),p.publish(k),O(D)}function pe(k,D){let H=_t(D),W=D.$retries??0,Me={...D,$retries:W+1,summary:`[RETRY ${W+1}/${n}] ${H} \u2014 Previous attempt failed: ${k.findings.join("; ")}`,relatedTo:[H]};c.publish(Me)}function Se(k,D){f.record(D.rootCause,D.intervention,!1),p.publish(k),O(D);let H=_t(D),W=D.$reingestions??0;W<V&&Sn(fe,ie)&&u.publish({source:D.source,summary:`Verification failed for: ${H}`,evidence:k.findings.join(`
|
|
46
46
|
`),affectsAreas:D.affectsAreas,affectsEvalTasks:D.affectsEvalTasks,severity:D.severity??"high",relatedTo:[H],$reingestions:W+1})}let he=ne([$],(k,D)=>{let H=k[0];if(H==null||H.length===0)return;let W=H[H.length-1];if(W==null)return;let[Me,dt]=W,[qe,Y]=dt??[null,null];if(!Me||!Y)return;if(qe==null){Se({item:Y,execution:{item:Y,outcome:"failure",detail:"executor returned null"},verified:!1,findings:["executor returned null"],errorClass:"structural"},Y);return}let we=A(Me,qe,Y);if(we.verified){U(we,Y);return}let Te=we.errorClass??o({item:Y,outcome:qe.outcome,detail:we.findings.join("; ")}),Ge=Y.$retries??0;Te==="self-correctable"&&Ge<n&&Sn(Z,F)?pe(we,Y):Se(we,Y)}),E=he.subscribe(()=>{}),M=I([he],()=>null,{name:"reflect",equals:()=>!1}),J;e.priority&&(J=ls(l,f,e));let q=new Wt(r,a,l,R,N,f,Z,fe,J);q.addDisposer(_),q.addDisposer(E),q.addDisposer(f.dispose);for(let k of x)q.addDisposer(k);if(q.add(T,{name:"triage"}),q.add(B,{name:"execute-input"}),q.add(le,{name:"execute"}),q.add(ae,{name:"execute-context"}),q.add(Ce,{name:"verify"}),q.add($,{name:"verify-context"}),q.add(he,{name:"verify-dispatch"}),q.add(M,{name:"reflect"}),q.add(f.node,{name:"strategy"}),q.addDisposer(M.subscribe(()=>{})),J)for(let[k,D]of J)q.add(D,{name:`priority/${k}`}),q.addDisposer(D.subscribe(()=>{}));q.mount("queues",a),q.mount("gates",S);for(let[k,D]of R)q.mount(`jobs/${k}`,D);return q.tagFactory("harnessLoop",ht(e)),q}function ls(r,e,t){if(!t.lastInteractionNs)throw new Error("harnessLoop: `opts.priority` requires `opts.lastInteractionNs` \u2014 pass a Node<number> (e.g. `fromTimer(60_000)` or a `state(monotonicNs())` you bump on human interaction). Priority scores only decay when this node settles; an internal default would freeze age at construction time.");let n=t.lastInteractionNs,s=t.priority??{},o={...rt,...s.severityWeights},i=s.decayRate??ot,a=s.effectivenessThreshold??.7,u=s.effectivenessBoost??15,d=new Map;for(let[c,p]of r){let l=I([p.latest,e.node,n],h=>{let f=h[0];if(f==null)return 0;let g=o[f.severity??"medium"]??40,m=(K()-h[2])/1e9,T=g*Math.exp(-i*Math.max(0,m)),y=`${f.rootCause}\u2192${f.intervention}`,_=h[1]?.get(y);return _&&_.successRate>=a&&(T+=u),T},{name:`priority/${c}`});d.set(c,l)}return d}function fs(r,e){let t=Vt(r,e),n={};for(let s of _e){let o=r.queues.has(s)?r.queues.topic(s):null;n[s]=o?.retained().length??0}return{...t,queueDepths:n,strategyEntries:r.strategy.node.cache?.size??0,totalRetries:r.totalRetries.cache??0,totalReingestions:r.totalReingestions.cache??0}}Ne();function ps(r){let e={};for(let{label:t,paths:n}of r.stageNodes())for(let s of n)e[s]=t;return e}function hs(r,e){let t=e?.logger===null?null:e?.logger??console.log,n=e?.detail??"summary",s=K(),o=[],i=[],a=ps(r);function u(){return(K()-s)/1e9}function d(c,p,l){let h={elapsed:u(),stage:c,type:p};n!=="summary"&&(h.summary=ms(l)),n==="full"&&(h.data=l),i.push(h)}for(let[c,p]of Object.entries(a))try{let l=r.observe(c,{format:"stage-log",stageLabels:a,logger:t?h=>t(h):()=>{},includeTypes:["data","error","complete"]});l.onEvent(h=>{h.type==="data"?d(p,"data",h.data):h.type==="error"?d(p,"error",h.data):h.type==="complete"&&d(p,"complete",void 0)}),o.push(l)}catch(l){let h=l instanceof Error?l.message:String(l);d(p,"error",`observe-unavailable: ${c} \u2014 ${h}`),t&&t(`[${u().toFixed(3)}s] ${p.padEnd(9)} \u2717 observe-unavailable: ${h}`)}return{get events(){return i},dispose(){for(let c of o)c.dispose();o.length=0}}}function ms(r){if(r==null)return"null";if(typeof r=="string")return Fr(r,80);if(typeof r=="number"||typeof r=="boolean"||typeof r=="bigint")return String(r);try{let e=JSON.stringify(r);return Fr(e,120)}catch{return String(r)}}function Fr(r,e){return r.length>e?`${r.slice(0,e-1)}\u2026`:r}0&&(module.exports={DEFAULT_DECAY_RATE,DEFAULT_EXECUTE_PROMPT,DEFAULT_QUEUE_CONFIGS,DEFAULT_SEVERITY_WEIGHTS,DEFAULT_TRIAGE_PROMPT,DEFAULT_VERIFY_PROMPT,HarnessGraph,QUEUE_NAMES,actuatorExecutor,affectedTaskFilter,autoSolidify,beforeAfterCompare,codeChangeBridge,createIntakeBridge,defaultErrorClassifier,defaultLlmExecutor,defaultLlmVerifier,dispatchActuator,effectivenessTracker,evalIntakeBridge,evalSource,evalVerifier,harnessEvalPair,harnessLoop,harnessProfile,harnessTrace,notifyEffect,priorityScore,refineExecutor,resolvePromptFn,strategyKey,strategyModel});
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
export { A as ActuatorApplyFn, a as ActuatorExecutorConfig, b as ActuatorResult, c as AutoSolidifyConfig, C as CodeChange, d as CodeChangeBridgeOptions, D as DEFAULT_DECAY_RATE, e as DEFAULT_EXECUTE_PROMPT, f as DEFAULT_QUEUE_CONFIGS, g as DEFAULT_SEVERITY_WEIGHTS, h as DEFAULT_TRIAGE_PROMPT, j as DEFAULT_VERIFY_PROMPT, k as DispatchActuatorConfig, E as EffectivenessEntry, l as EffectivenessSnapshot, m as EffectivenessTrackerBundle, n as EffectivenessTrackerOptions, o as ErrorClass, p as ErrorClassifier, q as EvalDelta, r as EvalIntakeBridgeOptions, s as EvalJudgeScore, t as EvalResult, u as EvalTaskDelta, v as EvalTaskResult, w as EvalVerifierConfig, x as EvalVerifierSummary, y as ExecuteOutput, z as ExecutePromptFn, B as ExecutionResult, H as HarnessEvalPairConfig, F as HarnessExecutor, G as HarnessGraph, I as HarnessLoopOptions, J as HarnessProfileResult, K as HarnessTraceHandle, L as HarnessTraceOptions, M as HarnessVerifier, N as IntakeBridgeOptions, O as IntakeItem, P as IntakeSource, Q as Intervention, R as KnownIntakeSource, S as LintError, T as NotifyEffectOptions, U as NotifyTransport, V as PrioritySignals, W as QUEUE_NAMES, X as QueueConfig, Y as QueueRoute, Z as RefineExecutorConfig, _ as RefineExecutorResult, $ as RootCause, a0 as Severity, a1 as StrategyEntry, a2 as StrategyKey, a3 as StrategyModelBundle, a4 as StrategySnapshot, a5 as TestFailure, a6 as TraceDetail, a7 as TraceEvent, a8 as TraceEventType, a9 as TriagePromptFn, aa as TriagedItem, ab as VerifyOutput, ac as VerifyPromptFn, ad as VerifyResult, ae as actuatorExecutor, af as affectedTaskFilter, ag as autoSolidify, ah as beforeAfterCompare, ai as codeChangeBridge, aj as createIntakeBridge, ak as defaultErrorClassifier, al as defaultLlmExecutor, am as defaultLlmVerifier, an as dispatchActuator, ao as effectivenessTracker, ap as evalIntakeBridge, aq as evalSource, ar as evalVerifier, as as harnessEvalPair, at as harnessLoop, au as harnessProfile, av as harnessTrace, aw as notifyEffect, ax as priorityScore, ay as refineExecutor, az as resolvePromptFn, aA as strategyKey, aB as strategyModel } from '../../index-
|
|
1
|
+
export { A as ActuatorApplyFn, a as ActuatorExecutorConfig, b as ActuatorResult, c as AutoSolidifyConfig, C as CodeChange, d as CodeChangeBridgeOptions, D as DEFAULT_DECAY_RATE, e as DEFAULT_EXECUTE_PROMPT, f as DEFAULT_QUEUE_CONFIGS, g as DEFAULT_SEVERITY_WEIGHTS, h as DEFAULT_TRIAGE_PROMPT, j as DEFAULT_VERIFY_PROMPT, k as DispatchActuatorConfig, E as EffectivenessEntry, l as EffectivenessSnapshot, m as EffectivenessTrackerBundle, n as EffectivenessTrackerOptions, o as ErrorClass, p as ErrorClassifier, q as EvalDelta, r as EvalIntakeBridgeOptions, s as EvalJudgeScore, t as EvalResult, u as EvalTaskDelta, v as EvalTaskResult, w as EvalVerifierConfig, x as EvalVerifierSummary, y as ExecuteOutput, z as ExecutePromptFn, B as ExecutionResult, H as HarnessEvalPairConfig, F as HarnessExecutor, G as HarnessGraph, I as HarnessLoopOptions, J as HarnessProfileResult, K as HarnessTraceHandle, L as HarnessTraceOptions, M as HarnessVerifier, N as IntakeBridgeOptions, O as IntakeItem, P as IntakeSource, Q as Intervention, R as KnownIntakeSource, S as LintError, T as NotifyEffectOptions, U as NotifyTransport, V as PrioritySignals, W as QUEUE_NAMES, X as QueueConfig, Y as QueueRoute, Z as RefineExecutorConfig, _ as RefineExecutorResult, $ as RootCause, a0 as Severity, a1 as StrategyEntry, a2 as StrategyKey, a3 as StrategyModelBundle, a4 as StrategySnapshot, a5 as TestFailure, a6 as TraceDetail, a7 as TraceEvent, a8 as TraceEventType, a9 as TriagePromptFn, aa as TriagedItem, ab as VerifyOutput, ac as VerifyPromptFn, ad as VerifyResult, ae as actuatorExecutor, af as affectedTaskFilter, ag as autoSolidify, ah as beforeAfterCompare, ai as codeChangeBridge, aj as createIntakeBridge, ak as defaultErrorClassifier, al as defaultLlmExecutor, am as defaultLlmVerifier, an as dispatchActuator, ao as effectivenessTracker, ap as evalIntakeBridge, aq as evalSource, ar as evalVerifier, as as harnessEvalPair, at as harnessLoop, au as harnessProfile, av as harnessTrace, aw as notifyEffect, ax as priorityScore, ay as refineExecutor, az as resolvePromptFn, aA as strategyKey, aB as strategyModel } from '../../index-DJ_MPOJ5.cjs';
|
|
2
2
|
import '../../extra/sources.cjs';
|
|
3
3
|
import '../../node-BYInONRr.cjs';
|
|
4
4
|
import '../../types-1Dhoi7HM.cjs';
|
|
5
|
-
import '../../index-
|
|
6
|
-
import '../../graph-
|
|
5
|
+
import '../../index-Cnr1WrlX.cjs';
|
|
6
|
+
import '../../graph-E6likq7w.cjs';
|
|
7
7
|
import '../../meta-Ct9nqQS5.cjs';
|
|
8
8
|
import '../../extra/storage-core.cjs';
|
|
9
9
|
import '../../extra/storage-tiers.cjs';
|
|
10
10
|
import '../../reactive-log-_zeEnB9H.cjs';
|
|
11
|
-
import '../../index-
|
|
12
|
-
import '../../pipeline-graph-
|
|
11
|
+
import '../../index-t6L2qpHh.cjs';
|
|
12
|
+
import '../../pipeline-graph-MWrQZXCq.cjs';
|
|
13
13
|
import '../../sugar-DzePN5-g.cjs';
|
|
14
|
-
import '../../index-
|
|
15
|
-
import '../../index-
|
|
14
|
+
import '../../index-DVDapw2k.cjs';
|
|
15
|
+
import '../../index-BTHOTC0Q.cjs';
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
export { A as ActuatorApplyFn, a as ActuatorExecutorConfig, b as ActuatorResult, c as AutoSolidifyConfig, C as CodeChange, d as CodeChangeBridgeOptions, D as DEFAULT_DECAY_RATE, e as DEFAULT_EXECUTE_PROMPT, f as DEFAULT_QUEUE_CONFIGS, g as DEFAULT_SEVERITY_WEIGHTS, h as DEFAULT_TRIAGE_PROMPT, j as DEFAULT_VERIFY_PROMPT, k as DispatchActuatorConfig, E as EffectivenessEntry, l as EffectivenessSnapshot, m as EffectivenessTrackerBundle, n as EffectivenessTrackerOptions, o as ErrorClass, p as ErrorClassifier, q as EvalDelta, r as EvalIntakeBridgeOptions, s as EvalJudgeScore, t as EvalResult, u as EvalTaskDelta, v as EvalTaskResult, w as EvalVerifierConfig, x as EvalVerifierSummary, y as ExecuteOutput, z as ExecutePromptFn, B as ExecutionResult, H as HarnessEvalPairConfig, F as HarnessExecutor, G as HarnessGraph, I as HarnessLoopOptions, J as HarnessProfileResult, K as HarnessTraceHandle, L as HarnessTraceOptions, M as HarnessVerifier, N as IntakeBridgeOptions, O as IntakeItem, P as IntakeSource, Q as Intervention, R as KnownIntakeSource, S as LintError, T as NotifyEffectOptions, U as NotifyTransport, V as PrioritySignals, W as QUEUE_NAMES, X as QueueConfig, Y as QueueRoute, Z as RefineExecutorConfig, _ as RefineExecutorResult, $ as RootCause, a0 as Severity, a1 as StrategyEntry, a2 as StrategyKey, a3 as StrategyModelBundle, a4 as StrategySnapshot, a5 as TestFailure, a6 as TraceDetail, a7 as TraceEvent, a8 as TraceEventType, a9 as TriagePromptFn, aa as TriagedItem, ab as VerifyOutput, ac as VerifyPromptFn, ad as VerifyResult, ae as actuatorExecutor, af as affectedTaskFilter, ag as autoSolidify, ah as beforeAfterCompare, ai as codeChangeBridge, aj as createIntakeBridge, ak as defaultErrorClassifier, al as defaultLlmExecutor, am as defaultLlmVerifier, an as dispatchActuator, ao as effectivenessTracker, ap as evalIntakeBridge, aq as evalSource, ar as evalVerifier, as as harnessEvalPair, at as harnessLoop, au as harnessProfile, av as harnessTrace, aw as notifyEffect, ax as priorityScore, ay as refineExecutor, az as resolvePromptFn, aA as strategyKey, aB as strategyModel } from '../../index-
|
|
1
|
+
export { A as ActuatorApplyFn, a as ActuatorExecutorConfig, b as ActuatorResult, c as AutoSolidifyConfig, C as CodeChange, d as CodeChangeBridgeOptions, D as DEFAULT_DECAY_RATE, e as DEFAULT_EXECUTE_PROMPT, f as DEFAULT_QUEUE_CONFIGS, g as DEFAULT_SEVERITY_WEIGHTS, h as DEFAULT_TRIAGE_PROMPT, j as DEFAULT_VERIFY_PROMPT, k as DispatchActuatorConfig, E as EffectivenessEntry, l as EffectivenessSnapshot, m as EffectivenessTrackerBundle, n as EffectivenessTrackerOptions, o as ErrorClass, p as ErrorClassifier, q as EvalDelta, r as EvalIntakeBridgeOptions, s as EvalJudgeScore, t as EvalResult, u as EvalTaskDelta, v as EvalTaskResult, w as EvalVerifierConfig, x as EvalVerifierSummary, y as ExecuteOutput, z as ExecutePromptFn, B as ExecutionResult, H as HarnessEvalPairConfig, F as HarnessExecutor, G as HarnessGraph, I as HarnessLoopOptions, J as HarnessProfileResult, K as HarnessTraceHandle, L as HarnessTraceOptions, M as HarnessVerifier, N as IntakeBridgeOptions, O as IntakeItem, P as IntakeSource, Q as Intervention, R as KnownIntakeSource, S as LintError, T as NotifyEffectOptions, U as NotifyTransport, V as PrioritySignals, W as QUEUE_NAMES, X as QueueConfig, Y as QueueRoute, Z as RefineExecutorConfig, _ as RefineExecutorResult, $ as RootCause, a0 as Severity, a1 as StrategyEntry, a2 as StrategyKey, a3 as StrategyModelBundle, a4 as StrategySnapshot, a5 as TestFailure, a6 as TraceDetail, a7 as TraceEvent, a8 as TraceEventType, a9 as TriagePromptFn, aa as TriagedItem, ab as VerifyOutput, ac as VerifyPromptFn, ad as VerifyResult, ae as actuatorExecutor, af as affectedTaskFilter, ag as autoSolidify, ah as beforeAfterCompare, ai as codeChangeBridge, aj as createIntakeBridge, ak as defaultErrorClassifier, al as defaultLlmExecutor, am as defaultLlmVerifier, an as dispatchActuator, ao as effectivenessTracker, ap as evalIntakeBridge, aq as evalSource, ar as evalVerifier, as as harnessEvalPair, at as harnessLoop, au as harnessProfile, av as harnessTrace, aw as notifyEffect, ax as priorityScore, ay as refineExecutor, az as resolvePromptFn, aA as strategyKey, aB as strategyModel } from '../../index-D1IEZUsj.js';
|
|
2
2
|
import '../../extra/sources.js';
|
|
3
3
|
import '../../node-BYInONRr.js';
|
|
4
4
|
import '../../types-39jk0kaV.js';
|
|
5
|
-
import '../../index-
|
|
6
|
-
import '../../graph-
|
|
5
|
+
import '../../index-40ZT4MHj.js';
|
|
6
|
+
import '../../graph-BkIkog4h.js';
|
|
7
7
|
import '../../meta-D8OyedKp.js';
|
|
8
8
|
import '../../extra/storage-core.js';
|
|
9
9
|
import '../../extra/storage-tiers.js';
|
|
10
10
|
import '../../reactive-log-BlAsPLl2.js';
|
|
11
|
-
import '../../index-
|
|
12
|
-
import '../../pipeline-graph-
|
|
11
|
+
import '../../index-BgjS2b8N.js';
|
|
12
|
+
import '../../pipeline-graph-CB4La-UW.js';
|
|
13
13
|
import '../../sugar-BhfjgetH.js';
|
|
14
|
-
import '../../index-
|
|
15
|
-
import '../../index-
|
|
14
|
+
import '../../index-BQ1fR4li.js';
|
|
15
|
+
import '../../index-IUCY0OFN.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{A,B,C,D,E,F,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z}from"../../chunk-
|
|
1
|
+
import{A,B,C,D,E,F,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z}from"../../chunk-YKD7WUYJ.js";import"../../chunk-UWA6D7UF.js";import"../../chunk-OSZ22J7O.js";import"../../chunk-INQFTVZA.js";import"../../chunk-Z4F3DOWS.js";import"../../chunk-SSCGRYJ2.js";import"../../chunk-32N3JALT.js";import"../../chunk-XW4YDF6G.js";import"../../chunk-2DMKW2AD.js";import"../../chunk-J63M5U46.js";import"../../chunk-D27JNOLZ.js";import"../../chunk-LYM4PBMV.js";import"../../chunk-ECQRP2UT.js";import"../../chunk-3G5U5QNE.js";import"../../chunk-C72GO4IZ.js";import"../../chunk-4I45FVQS.js";import"../../chunk-PPUYQ66A.js";import"../../chunk-TSOYJ743.js";import"../../chunk-LCGAVGGV.js";import"../../chunk-RZJDIV2G.js";import"../../chunk-6I726LZU.js";import"../../chunk-756D5TFD.js";import"../../chunk-L6NSJVJZ.js";import"../../chunk-2BX4NB34.js";import"../../chunk-SGS4OJGS.js";import"../../chunk-ESMPEKEV.js";import"../../chunk-D5RFJOZ2.js";import"../../chunk-CE72X3WO.js";import"../../chunk-FHRBBHJN.js";import"../../chunk-4VVTGLXJ.js";import"../../chunk-35JTVPOX.js";import"../../chunk-KGKJCHEK.js";import"../../chunk-TZQPPQEQ.js";import"../../chunk-YXDRGKXP.js";import"../../chunk-CKFQS2CJ.js";import"../../chunk-LYCLF26R.js";import"../../chunk-CK2E7BTU.js";import"../../chunk-QYADASLV.js";export{n as DEFAULT_DECAY_RATE,r as DEFAULT_EXECUTE_PROMPT,l as DEFAULT_QUEUE_CONFIGS,m as DEFAULT_SEVERITY_WEIGHTS,q as DEFAULT_TRIAGE_PROMPT,s as DEFAULT_VERIFY_PROMPT,C as HarnessGraph,k as QUEUE_NAMES,a as actuatorExecutor,h as affectedTaskFilter,c as autoSolidify,g as beforeAfterCompare,i as codeChangeBridge,d as createIntakeBridge,p as defaultErrorClassifier,A as defaultLlmExecutor,B as defaultLlmVerifier,b as dispatchActuator,u as effectivenessTracker,e as evalIntakeBridge,f as evalSource,w as evalVerifier,x as harnessEvalPair,D as harnessLoop,E as harnessProfile,F as harnessTrace,j as notifyEffect,z as priorityScore,v as refineExecutor,t as resolvePromptFn,o as strategyKey,y as strategyModel};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import '../../node-BYInONRr.cjs';
|
|
2
|
-
import '../../index-
|
|
2
|
+
import '../../index-DVDapw2k.cjs';
|
|
3
3
|
import '../../reactive-log-_zeEnB9H.cjs';
|
|
4
4
|
import '../../extra/sources.cjs';
|
|
5
5
|
import '../../extra/storage-tiers.cjs';
|
|
6
|
-
import '../../graph-
|
|
7
|
-
export { a as JobEnvelope, b as JobEvent, c as JobEventAction, d as JobFlowGraph, e as JobFlowOptions, J as JobQueueGraph, f as JobQueueOptions, g as JobState, S as StageDef, W as WorkFn, j as jobEventKeyOf, h as jobFlow, k as jobQueue } from '../../index-
|
|
6
|
+
import '../../graph-E6likq7w.cjs';
|
|
7
|
+
export { a as JobEnvelope, b as JobEvent, c as JobEventAction, d as JobFlowGraph, e as JobFlowOptions, J as JobQueueGraph, f as JobQueueOptions, g as JobState, S as StageDef, W as WorkFn, j as jobEventKeyOf, h as jobFlow, k as jobQueue } from '../../index-BTHOTC0Q.cjs';
|
|
8
8
|
import '../../meta-Ct9nqQS5.cjs';
|
|
9
9
|
import '../../extra/storage-core.cjs';
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import '../../node-BYInONRr.js';
|
|
2
|
-
import '../../index-
|
|
2
|
+
import '../../index-BQ1fR4li.js';
|
|
3
3
|
import '../../reactive-log-BlAsPLl2.js';
|
|
4
4
|
import '../../extra/sources.js';
|
|
5
5
|
import '../../extra/storage-tiers.js';
|
|
6
|
-
import '../../graph-
|
|
7
|
-
export { a as JobEnvelope, b as JobEvent, c as JobEventAction, d as JobFlowGraph, e as JobFlowOptions, J as JobQueueGraph, f as JobQueueOptions, g as JobState, S as StageDef, W as WorkFn, j as jobEventKeyOf, h as jobFlow, k as jobQueue } from '../../index-
|
|
6
|
+
import '../../graph-BkIkog4h.js';
|
|
7
|
+
export { a as JobEnvelope, b as JobEvent, c as JobEventAction, d as JobFlowGraph, e as JobFlowOptions, J as JobQueueGraph, f as JobQueueOptions, g as JobState, S as StageDef, W as WorkFn, j as jobEventKeyOf, h as jobFlow, k as jobQueue } from '../../index-IUCY0OFN.js';
|
|
8
8
|
import '../../meta-D8OyedKp.js';
|
|
9
9
|
import '../../extra/storage-core.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a,b,c,d,e}from"../../chunk-
|
|
1
|
+
import{a,b,c,d,e}from"../../chunk-OSZ22J7O.js";import"../../chunk-ECQRP2UT.js";import"../../chunk-3G5U5QNE.js";import"../../chunk-C72GO4IZ.js";import"../../chunk-4I45FVQS.js";import"../../chunk-756D5TFD.js";import"../../chunk-L6NSJVJZ.js";import"../../chunk-2BX4NB34.js";import"../../chunk-SGS4OJGS.js";import"../../chunk-ESMPEKEV.js";import"../../chunk-35JTVPOX.js";import"../../chunk-KGKJCHEK.js";import"../../chunk-TZQPPQEQ.js";import"../../chunk-YXDRGKXP.js";import"../../chunk-CKFQS2CJ.js";import"../../chunk-LYCLF26R.js";import"../../chunk-CK2E7BTU.js";import"../../chunk-QYADASLV.js";export{c as JobFlowGraph,b as JobQueueGraph,a as jobEventKeyOf,e as jobFlow,d as jobQueue};
|