@unbrained/pm-cli 2026.9.28 → 2026.9.29
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/.agents/skills/pm-developer/references/GRAPH_AND_RELATIONSHIPS.md +7 -6
- package/.agents/skills/pm-user/references/BACKLOG_SHAPING.md +1 -1
- package/.agents/skills/pm-user/references/ECOSYSTEM_PLANNING.md +26 -3
- package/.claude-plugin/marketplace.json +2 -2
- package/CHANGELOG.md +17 -0
- package/dist/cli/error-guidance.js +1 -1
- package/dist/cli/help-json-payload.js +2 -2
- package/dist/cli/main.js +2 -2
- package/dist/cli/runtime/invocation-options.d.ts +3 -1
- package/dist/cli/runtime/invocation-options.js +1 -1
- package/dist/cli-bundle/bundle-manifest.json +153 -153
- package/dist/cli-bundle/chunks/{chunk-OYCCWPBM.js → chunk-2AQKVJMW.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-UT7GRGHY.js → chunk-4DOL43PF.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-GLH2LNRH.js → chunk-5KEPG36D.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-YERBAGQD.js → chunk-D32HVIB2.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-A2G5OG6W.js → chunk-GP6QTYSD.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-CPOWTIIS.js → chunk-OTLIM22J.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-PLNNUAFZ.js → chunk-P75SO5HO.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-PR4UAMI5.js → chunk-PJSQAWWQ.js} +60 -60
- package/dist/cli-bundle/chunks/{chunk-VMJLM7P2.js → chunk-S5A2UIRV.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-ZFHJP7YD.js → chunk-SC6JHXFT.js} +31 -29
- package/dist/cli-bundle/chunks/{chunk-NBDB3SRC.js → chunk-SEJ53XDN.js} +48 -48
- package/dist/cli-bundle/chunks/{chunk-35DME35A.js → chunk-SJI55O65.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-NEUIVBFO.js → chunk-U3QJGJYN.js} +2 -2
- package/dist/cli-bundle/chunks/{register-list-query-N6RP6PSP.js → register-list-query-R3ELWWPY.js} +2 -2
- package/dist/cli-bundle/chunks/{register-mutation-CY7JGQE6.js → register-mutation-WHXJXIHJ.js} +2 -2
- package/dist/cli-bundle/chunks/{register-operations-53HAD3QP.js → register-operations-7ASWBYQG.js} +2 -2
- package/dist/cli-bundle/chunks/{register-setup-NVX6374E.js → register-setup-FDRTUG54.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-YZB7IPR6.js → chunk-2O3QFI3G.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-Y5Z3XNGY.js → chunk-4A4DO5ZT.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-K7GSZ7YZ.js → chunk-5MC57KRC.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-IWLMQLBO.js → chunk-6OXJVE74.js} +17 -17
- package/dist/cli-bundle/focused-chunks/{chunk-6IVQPNYN.js → chunk-7URX7FMY.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-5KJXX2TZ.js → chunk-AVP5C674.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-DTLRXY77.js → chunk-AZE7KUHG.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-V7OPZRL6.js → chunk-DZVOCJFY.js} +14 -14
- package/dist/cli-bundle/focused-chunks/{chunk-AZA4AEOR.js → chunk-FBIRNSYP.js} +6 -6
- package/dist/cli-bundle/focused-chunks/{chunk-A5O3VYWV.js → chunk-IFBA3ZAT.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-ONDNR3VU.js → chunk-K3AIMRIK.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-ZMQTIS3L.js → chunk-KLKKCHWM.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-BRLXKRI2.js → chunk-MRH4A542.js} +4 -4
- package/dist/cli-bundle/focused-chunks/{chunk-IJXZQE3D.js → chunk-NXQZMKW5.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-BGWF6CMP.js → chunk-NY6FLQTN.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-OVVCXTIE.js → chunk-T4H6Q44B.js} +2 -2
- package/dist/cli-bundle/main.js +22 -22
- package/dist/cli-bundle/sdk-authoring.js +1 -1
- package/dist/cli-bundle/sdk-contracts.js +1 -1
- package/dist/cli-bundle/sdk-core.js +22 -21
- package/dist/cli-bundle/sdk-governance.js +1 -1
- package/dist/cli-bundle/sdk-graph.js +1 -1
- package/dist/cli-bundle/sdk-merge.js +28 -28
- package/dist/cli-bundle/sdk-query.js +1 -1
- package/dist/cli-bundle/sdk-runtime.js +1 -1
- package/dist/cli-bundle/sdk-testing.js +1 -1
- package/dist/cli-bundle/sdk.js +2 -2
- package/dist/core/history/replay.js +1 -1
- package/dist/core/output/mutation-projection.js +1 -1
- package/dist/core/telemetry/runtime.js +2 -2
- package/dist/sdk/cli-contracts/command-aliases.js +1 -1
- package/dist/sdk/index.d.ts +1 -0
- package/dist/sdk/index.js +1 -1
- package/dist/sdk/lifecycle/plan-mutation-receipt.d.ts +53 -0
- package/dist/sdk/lifecycle/plan-mutation-receipt.js +2 -0
- package/dist/sdk/lifecycle/plan.d.ts +3 -0
- package/dist/sdk/lifecycle/plan.js +1 -1
- package/dist/sdk/linked-artifacts.js +1 -1
- package/dist/sdk/public-surface.json +1 -1
- package/dist/sdk/runtime/actions.js +1 -1
- package/dist/sdk/runtime-input.d.ts +2 -0
- package/dist/sdk/runtime-input.js +1 -1
- package/dist/sdk/runtime.js +1 -1
- package/dist/sdk/similarity-scoring.js +1 -1
- package/dist/sdk/telemetry.d.ts +2 -0
- package/dist/sdk/telemetry.js +3 -1
- package/docs/CLI_GRAMMAR.md +18 -1
- package/docs/ECOSYSTEM_PLANNING_REVIEW.md +270 -0
- package/docs/README.md +1 -0
- package/docs/SDK_EVIDENCE_TRACEABILITY.md +34 -0
- package/docs/agent-task-token-baseline.json +28 -2
- package/docs/agent-task-transcripts.json +137 -14
- package/docs/ecosystem-review-2026-09-28.json +3159 -0
- package/marketplace.json +2 -2
- package/package.json +1 -1
- package/packages/pm-beads/package.json +1 -1
- package/packages/pm-calendar/package.json +1 -1
- package/packages/pm-command-kit/package.json +1 -1
- package/packages/pm-digital-twin/package.json +1 -1
- package/packages/pm-governance-audit/package.json +1 -1
- package/packages/pm-guide-shell/package.json +1 -1
- package/packages/pm-kanban/package.json +1 -1
- package/packages/pm-lifecycle-hooks/package.json +1 -1
- package/packages/pm-linked-test-adapters/package.json +1 -1
- package/packages/pm-search-advanced/package.json +1 -1
- package/packages/pm-templates/package.json +1 -1
- package/packages/pm-todos/package.json +1 -1
- package/packages/pm-vcs/package.json +1 -1
- package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
- package/plugins/pm-claude/package.json +2 -2
- package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
- package/plugins/pm-codex/package.json +2 -2
- package/plugins/pm-codex/plugin.json +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{Ab as Le,Sa as je,Tb as Fe,U as Oe,Ua as Me,cc as G,dc as Ge,ec as $e,gc as qe,jc as $,kc as Ue,lc as Be,mc as ze,vb as Pe}from"./chunk-IWLMQLBO.js";import{n as Se}from"./chunk-Y5Z3XNGY.js";import{$ as w,Jc as Ce,Nb as I,Sa as xe,Td as Ae,Ya as Ee,_c as De,aa as k,ae as Re,cd as Te,dd as oe,fc as ie,gd as Ne,ka as we,pa as ke,va as j,wa as re,ya as Ie}from"./chunk-BRLXKRI2.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="b3394526-5a20-5881-9a03-411ada32bd49")}catch{}})();function Ut(e,t,n,r,i,o){if(e.seen.has(t))return"skip";if(e.cursorFound&&e.affected.length>=o)return"truncate";e.seen.add(t),e.parents.set(t,n.id);let s=n.depth+1;return e.queue.push({id:t,depth:s}),e.cursorFound?(e.affected.push({id:t,distance:s,path:Yt(r,t,e.parents)}),"continue"):(e.cursorFound=t===i,"skip")}function Ke(e,t,n,r){let i=Te("graph impact",{root:e,direction:n,kinds:[...t.kinds??[]].sort(),max_depth:Number.isFinite(r)?r:"unbounded"});return{fingerprint:i,after:t.after===void 0?void 0:Ne(t.after,i)}}function C(e,t,n){e.get(t).add(n)}function M(e){return new Map(e.map(t=>[t,new Set]))}function Ve(e){for(let t of e)t.sort();return e.sort((t,n)=>n.length-t.length||t[0].localeCompare(n[0]))}function q(e){if(Array.isArray(e))return e.map(n=>q(n));if(e===null||typeof e!="object")return e;let t=e.toJSON;return typeof t=="function"?q(t.call(e)):Object.fromEntries(Object.entries(e).sort(([n],[r])=>n.localeCompare(r)).map(([n,r])=>[n,q(r)]))}function He(e){return JSON.stringify(q(e))}function Bt(e,t,n,r){let i=[{id:e,expanded:!1}];for(;i.length>0;){let o=i.pop();if(o.expanded){r.push(o.id);continue}if(n.has(o.id))continue;n.add(o.id),i.push({id:o.id,expanded:!0});let s=[...t.get(o.id)].sort().reverse();for(let c of s)n.has(c)||i.push({id:c,expanded:!1})}}function zt(e,t){let n=new Set,r=[];for(let i of e)n.has(i)||Bt(i,t,n,r);return r}function Ht(e,t){let n=new Set,r=[];for(let i of[...e].reverse()){if(n.has(i))continue;let o=[],s=[i];for(n.add(i);s.length>0;){let c=s.pop();o.push(c);for(let a of t.get(c))n.has(a)||(n.add(a),s.push(a))}r.push(o)}return Ve(r)}function We(e,t){let n=M(e);for(let[r,i]of t)for(let o of i)C(n,o,r);return Ht(zt(e,t),n)}function Kt(e,t){let n=M(e.nodes());for(let r of e.edges()){let i=t.require(r.kind);if(!i.ordering)continue;let o=(i.precedence??"source_before_target")==="source_before_target";C(n,o?r.source:r.target,o?r.target:r.source)}return n}function Vt(e,t){let n=new Map(e.map(o=>[o,0]));for(let o of t.values())for(let s of o)n.set(s,n.get(s)+1);let r=e.filter(o=>n.get(o)===0).sort(),i=[];for(;r.length>0;){i.push(r);let o=[];for(let s of r)for(let c of t.get(s)){let a=n.get(c)-1;n.set(c,a),a===0&&o.push(c)}r=o.sort()}return i}function Wt(e,t){let n=new Map(e.map(s=>[s,0])),r=new Map;for(let s of e)for(let c of t.get(s)){if(!n.has(c))continue;let a=n.get(s)+1,d=r.get(c);(a>n.get(c)||a===n.get(c)&&(d===void 0||s.localeCompare(d)<0))&&(n.set(c,a),r.set(c,s))}let i=[...e].sort((s,c)=>n.get(c)-n.get(s)||s.localeCompare(c))[0],o=i===void 0?[]:[i];for(;o[0]!==void 0&&r.has(o[0]);)o.unshift(r.get(o[0]));return{depth:Object.fromEntries(n),path:o}}function Yt(e,t,n){let r=[t],i=t;for(;i!==e;)i=n.get(i),r.push(i);return r.reverse()}function B(e,t={}){let n=t.registry??we(),r=[...e.nodes()],i=Kt(e,n),o=Vt(r,i),s=o.flat(),c=s.length===r.length,a=c?[]:We(r,i).filter(l=>l.length>1||i.get(l[0]).has(l[0])),d=Wt(s,i);return{exact:!0,acyclic:c,order:s,layers:o,frontier:o[0]??[],depth:d.depth,criticalPath:d.path,criticalPathLength:Math.max(0,d.path.length-1),cycles:a,provenance:{algorithm:"kahn-longest-path",edgeFamily:"ordering"}}}function Xt(e,t,n){let r=M(e.nodes()),i=n===void 0?void 0:new Set(n.map(s=>e.registry().require(s).kind)),o=e.edges();for(let s of o){let c=e.registry().require(s.kind);i!==void 0&&!i.has(s.kind)&&(c.inverse===void 0||!i.has(c.inverse))||C(r,t==="incoming"?s.target:s.source,t==="incoming"?s.source:s.target)}return{adjacency:r,inspectedEdges:o.length}}function Jt(e,t,n,r,i,o){let s=U(e,t,{...n,after:void 0,direction:"incoming",limit:void 0}),c=U(e,t,{...n,after:void 0,direction:"outgoing",limit:void 0}),a=new Map,d=[...s.affected,...c.affected].sort((h,m)=>h.distance-m.distance||h.id.localeCompare(m.id)||h.path.join("\0").localeCompare(m.path.join("\0")));for(let h of d)a.has(h.id)||a.set(h.id,h);let l=[...a.values()].sort((h,m)=>h.distance-m.distance||h.id.localeCompare(m.id)),f=r===void 0||r===t?-1:l.findIndex(h=>h.id===r);if(r!==void 0&&r!==t&&f<0)throw new TypeError(`Unknown impact cursor item: ${r}`);let u=l.slice(f+1,f+1+i),g=f+1+u.length<l.length;return{root:t,affected:u,exact:!0,truncated:s.truncated||c.truncated||g,...g?{nextCursor:oe(o,u.at(-1)?.id??t)}:{},cost:{visitedNodes:s.cost.visitedNodes+c.cost.visitedNodes,inspectedEdges:s.cost.inspectedEdges+c.cost.inspectedEdges}}}function Qt(e,t,n){let r=n.direction,i=n.maxDepth??Number.POSITIVE_INFINITY,o=n.limit??Number.POSITIVE_INFINITY,{fingerprint:s,after:c}=Ke(t,n,r,i),{adjacency:a,inspectedEdges:d}=Xt(e,r,n.kinds),l={queue:[{id:t,depth:0}],seen:new Set([t]),parents:new Map,affected:[],cursorFound:c===void 0||c===t},f=0,u=!1,g=!1;e:for(let h=0;h<l.queue.length;h+=1){n.signal?.throwIfAborted();let m=l.queue[h];f+=1;let b=[...a.get(m.id)].sort();if(m.depth>=i){b.some(v=>!l.seen.has(v))&&(u=!0);continue}for(let v of b)if(Ut(l,v,m,t,c,o)==="truncate"){u=!0,g=!0;break e}}if(!l.cursorFound)throw new TypeError(`Unknown impact cursor item: ${c}`);return{root:t,affected:l.affected,exact:!0,truncated:u,...g?{nextCursor:oe(s,l.affected.at(-1)?.id??t)}:{},cost:{visitedNodes:f,inspectedEdges:d}}}function U(e,t,n={}){let r=n.direction??"outgoing";if(r!=="both")return Qt(e,t,{...n,direction:r});let i=n.maxDepth??Number.POSITIVE_INFINITY,o=n.limit??Number.POSITIVE_INFINITY,{fingerprint:s,after:c}=Ke(t,n,r,i);return Jt(e,t,n,c,o,s)}function Ye(e){let t=[...e.nodes()],n=M(t),r=M(t);for(let a of e.edges())C(n,a.source,a.target),C(n,a.target,a.source),C(r,a.source,a.target);let i=[],o=new Set;for(let a of t){if(o.has(a))continue;let d=[],l=[a];for(o.add(a);l.length>0;){let f=l.pop();d.push(f);for(let u of n.get(f))o.has(u)||(o.add(u),l.push(u))}i.push(d)}let s=t.map(a=>({id:a,degree:n.get(a).size})),c=Math.max(0,...s.map(({degree:a})=>a));return{components:Ve(i),stronglyConnected:We(t,r),orphans:s.filter(({degree:a})=>a===0).map(({id:a})=>a),hubs:s.filter(({degree:a})=>a>0&&a===c),exact:!0,provenance:{algorithm:"component-degree",edgeFamily:"all"}}}function Xr(e,t){let n=new Map(e.edges.map(i=>[He(i),i])),r=new Map(t.edges.map(i=>[He(i),i]));return{fromVersion:e.version,toVersion:t.version,added:[...r].filter(([i])=>!n.has(i)).map(([,i])=>i),removed:[...n].filter(([i])=>!r.has(i)).map(([,i])=>i),unchangedCount:[...n.keys()].filter(i=>r.has(i)).length,exact:!0}}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="2ca317ff-f6b3-5f36-acc4-cd740b3d65e3")}catch{}})();var Zt=I.paths,en=I.visited_paths,tn=I.path_depth;function se(e,t){if(!Number.isFinite(t)||!Number.isInteger(t)||t<0)throw new TypeError(`Invalid path ${e} bound: ${String(t)}`)}function z(e,t){return t.hierarchyDirection==="target_parent"?e.target:e.source}function P(e,t){return(t.precedence??"source_before_target")==="target_before_source"?e.target:e.source}function D(e,t){let n=P(e,t);return{predecessor:n,successor:n===e.source?e.target:e.source}}function nn(e,t,n){if(t===void 0)return;let r=e.registry(),i=new Set;for(let o of t){let s=r.require(o),c=s.traversal;if(c==="association")throw new TypeError(`Relationship kind ${s.kind} uses association traversal; use graph impact --direction both`);if(c!==n&&c!=="semantic"){let a=c==="hierarchy"?"graph ancestors or graph descendants":"graph predecessors or graph successors";throw new TypeError(`Relationship kind ${s.kind} uses ${c} traversal; use ${a}`)}i.add(s.kind)}return i}function rn(e,t,n,r,i){let o=e.registry(),s=e.neighborEdges(t,{direction:"both",...n===void 0?{}:{kinds:[...n]}}),c=[],a=new Set;for(let d of s.value){let l=o.require(d.edge.kind);n===void 0&&!l[r]||i(d,l,t)&&(a.has(d.id)||(a.add(d.id),c.push(d.id)))}return{neighbors:c,inspectedEdges:s.meta.inspectedEdges}}function on(e,t,n,r,i,o){if(t>=n)return e.neighbors.some(s=>!o.seen.has(s))&&(o.truncated=!0),!1;for(let s of e.neighbors)if(!o.seen.has(s)){if(o.seen.add(s),o.queue.push({id:s,depth:t+1}),!o.resumed){s===i&&(o.resumed=!0);continue}if(o.value.length>=r)return o.truncated=!0,!0;o.value.push(s)}return!1}function H(e,t,n,r,i){if(!e.hasNode(t))throw new TypeError(`Relationship node not found: ${t}`);let o=nn(e,n.kinds,r),s=n.limit??Number.POSITIVE_INFINITY,c=n.maxDepth??Number.POSITIVE_INFINITY,a=n.after,d={seen:new Set([t]),value:[],queue:[{id:t,depth:0}],resumed:a===void 0,truncated:!1},l=0,f=0;for(let u=0;u<d.queue.length;u+=1){n.signal?.throwIfAborted();let g=d.queue[u];l+=1;let h=rn(e,g.id,o,r,i);if(f+=h.inspectedEdges,on(h,g.depth,c,s,a,d))break}if(!d.resumed)throw new TypeError(`Traversal cursor not found in sequence: ${a}`);return{value:d.value,meta:{visitedNodes:l,inspectedEdges:f,truncated:d.truncated,nextCursor:d.value.at(-1)}}}function Xe(e,t){if(!e.hasNode(t))throw new TypeError(`Relationship node not found: ${t}`)}function Je(e,t,n,r,i){let o=e.neighborEdges(t.nodes.at(-1),{direction:r,...n.kinds===void 0?{}:{kinds:n.kinds}});return i.inspectedEdges+=o.meta.inspectedEdges,o.value.filter(s=>!t.nodeSet.has(s.id))}function sn(e,t,n,r,i,o,s){for(let c of Je(e,t,r,i,s)){let a=[...t.nodes,c.id],d=new Set(t.nodeSet).add(c.id),l=[...t.edges,c.edge];if(c.id===n){if(s.value.push({nodes:a,edges:l,length:l.length}),s.value.length>=o)return!0}else s.queue.push({nodes:a,nodeSet:d,edges:l})}return!1}function Qe(e,t,n={}){return H(e,t,n,"hierarchy",(r,i)=>z(r.edge,i)===r.id)}function Ze(e,t,n={}){return H(e,t,n,"hierarchy",(r,i,o)=>z(r.edge,i)===o)}function et(e,t,n={}){return H(e,t,n,"ordering",(r,i)=>P(r.edge,i)===r.id)}function tt(e,t,n={}){return H(e,t,n,"ordering",(r,i,o)=>P(r.edge,i)===o)}function cn(e,t,n,r,i,o,s,c){let a={value:[],queue:[{nodes:[t],nodeSet:new Set([t]),edges:[]}],inspectedEdges:0},d=0,l=!1,f=i+1;for(let u=0;u<a.queue.length;u+=1){if(r.signal?.throwIfAborted(),a.value.length>=f||d>=o){l=!0;break}let g=a.queue[u];if(d+=1,g.edges.length>=s){Je(e,g,r,c,a).length>0&&(l=!0);continue}if(sn(e,g,n,r,c,f,a)){l=!0;break}}return{value:a.value.slice(0,i),meta:{visitedNodes:d,inspectedEdges:a.inspectedEdges,truncated:l}}}function nt(e,t,n,r={}){Xe(e,t),Xe(e,n);let i=r.maxPaths??Zt,o=r.maxVisitedPaths??en,s=r.maxDepth??tn;se("maxPaths",i),se("maxVisitedPaths",o),se("maxDepth",s);let c=r.direction??"outgoing";r.signal?.throwIfAborted();for(let a of r.kinds??[])e.registry().require(a);return t===n?i===0?{value:[],meta:{visitedNodes:1,inspectedEdges:0,truncated:!0}}:{value:[{nodes:[t],edges:[],length:0}],meta:{visitedNodes:1,inspectedEdges:0,truncated:!1}}:cn(e,t,n,r,i,o,s,c)}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="2ea07760-bca8-579d-9b3a-78051461485a")}catch{}})();var an=16,dn=2,ln=8;function K(e,t){if(!Number.isInteger(t)||t<1)throw new TypeError(`Invalid ${e} bound: ${String(t)}`)}function V(e,t,n){let r=e.registry(),i=t===void 0?void 0:new Set(t.map(o=>r.require(o).kind));for(let o of e.edges()){if(o.source===o.target)continue;let s=r.require(o.kind);i!==void 0&&!(i.has(s.kind)||s.inverse!==void 0&&i.has(s.inverse))||n(o,s)}}function un(e,t){let n=new Map;V(e,t,r=>{rt(n,r.source,r.target),rt(n,r.target,r.source)});for(let r of n.values())r.sort();return n}function rt(e,t,n){let r=e.get(t);r===void 0?e.set(t,[n]):r.push(n)}function fn(e,t){let n=new Map;for(let o of e){let s=t.get(o);n.set(s,(n.get(s)??0)+1)}let r,i=0;for(let[o,s]of n)(s>i||s===i&&o<r)&&(r=o,i=s);return r}function gn(e,t){let n=new Map;for(let[i,o]of e){let s=n.get(o);s===void 0?n.set(o,[i]):s.push(i)}let r=[];for(let i of n.values())i.length<t||(i.sort(),r.push({representative:i[0],size:i.length,members:i}));return r.sort((i,o)=>o.size-i.size||i.representative.localeCompare(o.representative))}function it(e,t={}){let n=t.maxIterations??an,r=t.minSize??dn;K("maxIterations",n),K("minSize",r);let i=un(e,t.kinds),o=e.nodes(),s=new Map(o.map(f=>[f,f])),c=0,a=!1,d=0,l=0;for(;c<n&&!a;){t.signal?.throwIfAborted(),c+=1,a=!0;for(let f of o){d+=1;let u=i.get(f);if(u===void 0)continue;l+=u.length;let g=fn(u,s);g!==s.get(f)&&(s.set(f,g),a=!1)}}return{value:{communities:gn(s,r),iterations:c,converged:a},meta:{visitedNodes:d,inspectedEdges:l,truncated:!a}}}function W(e){return e.direction==="directed"&&(e.ordering||e.hierarchy)}function Y(e){return e.inverse!==void 0&&e.inverse<e.kind?e.inverse:e.kind}function ce(e,t){return(t.hierarchy?z(e,t):e.source===P(e,t)?e.target:e.source)===e.target?{from:e.source,to:e.target}:{from:e.target,to:e.source}}function hn(e,t){if(t===void 0)return;let n=e.registry(),r=new Set;for(let i of t){let o=n.require(i);if(!W(o))throw new TypeError(`Relationship kind ${o.kind} is not a directed ordering or hierarchy kind`);r.add(Y(o))}return r}function pn(e,t){let n=e.registry(),r=new Map;for(let i of e.edges()){let o=n.require(i.kind);if(!W(o))continue;let s=Y(o);if(t!==void 0&&!t.has(s))continue;let c=ce(i,o);if(c.from===c.to)continue;let a=r.get(s);a===void 0&&(a={adjacency:new Map,records:[]},r.set(s,a));let d=a.adjacency.get(c.from);d===void 0?a.adjacency.set(c.from,new Set([c.to])):d.add(c.to),a.records.push({...c,edge:i})}return r}function mn(e){let t=new Map;for(let[n,r]of e.adjacency)t.set(n,[...r].sort());return t}function _n(e,t,n,r){let i=[r];for(let o=n;o!==t;o=e.get(o))i.push(o);return i.push(t),i.reverse()}function yn(e,t,n,r,i,o){for(let s of e.get(n.id)??[])if(o.inspectedEdges+=1,!(n.depth===0&&s===t.to)&&!r.has(s)){if(r.set(s,n.id),s===t.to)return _n(r,t.from,n.id,s);i.push({id:s,depth:n.depth+1})}}function bn(e,t,n,r){let i=new Map([[t.from,t.from]]),o=[{id:t.from,depth:0}];for(let s=0;s<o.length;s+=1){let c=o[s];if(r.visitedNodes+=1,c.depth>=n)continue;let a=yn(e,t,c,i,o,r);if(a!==void 0)return a}}function T(e,t={}){let n=t.maxDepth??ln;K("maxDepth",n),t.limit!==void 0&&K("limit",t.limit);let r=t.limit??Number.POSITIVE_INFINITY,i=hn(e,t.kinds),o=pn(e,i),s=[],c={visitedNodes:0,inspectedEdges:0},a=!1;e:for(let d of[...o.keys()].sort()){let l=o.get(d),f=mn(l);for(let u of l.records){t.signal?.throwIfAborted();let g=bn(f,u,n,c);if(g!==void 0){if(s.length>=r){a=!0;break e}s.push({edge:u.edge,witness:g})}}}return{value:s,meta:{visitedNodes:c.visitedNodes,inspectedEdges:c.inspectedEdges,truncated:a}}}function vn(e,t,n,r,i){let o=new Set,s=[];for(let c of n){if(c.id===e||o.has(c.id))continue;if(!i.seen.has(c.id)){if(t>=r){i.truncated=!0;continue}i.seen.add(c.id),i.queue.push({id:c.id,depth:t+1})}o.add(c.id),s.push(c.id);let a=i.predecessors.get(c.id);a===void 0&&(a=new Set,i.predecessors.set(c.id,a)),a.add(e)}return s}function wn(e,t,n){let r=n.direction??"outgoing",i=n.maxDepth??Number.POSITIVE_INFINITY,o=[],s=new Map,c={seen:new Set([t]),queue:[{id:t,depth:0}],predecessors:new Map,truncated:!1},a=0;for(let d=0;d<c.queue.length;d+=1){n.signal?.throwIfAborted();let{id:l,depth:f}=c.queue[d];o.push(l);let u=e.neighborEdges(l,{direction:r,...n.kinds===void 0?{}:{kinds:n.kinds}});a+=u.meta.inspectedEdges,s.set(l,vn(l,f,u.value,i,c))}return{order:o,successors:s,predecessors:c.predecessors,inspectedEdges:a,truncated:c.truncated}}function kn(e,t){let n=[],r=new Set([t]),i=[{id:t,index:0}];for(;i.length>0;){let o=i.at(-1),s=e.successors.get(o.id);if(o.index<s.length){let c=s[o.index];o.index+=1,r.has(c)||(r.add(c),i.push({id:c,index:0}))}else n.push(o.id),i.pop()}return n.reverse()}function In(e,t,n,r){let i=e,o=t;for(;i!==o;){for(;r.get(i)>r.get(o);)i=n.get(i);for(;r.get(o)>r.get(i);)o=n.get(o)}return i}function xn(e,t,n){let r;for(let i of[...e].sort())t.has(i)&&(r=r===void 0?i:In(r,i,t,n));return r}function En(e,t,n,r,i){let o=new Map([[t,t]]),s=!0;for(;s;){s=!1;for(let c of n){if(i?.throwIfAborted(),c===t)continue;let a=xn(e.predecessors.get(c),o,r);a!==void 0&&o.get(c)!==a&&(o.set(c,a),s=!0)}}return o}function ot(e,t,n={}){if(!e.hasNode(t))throw new TypeError(`Relationship node not found: ${t}`);if(n.maxDepth!==void 0&&(!Number.isInteger(n.maxDepth)||n.maxDepth<0))throw new TypeError(`Invalid maxDepth bound: ${String(n.maxDepth)}`);let r=wn(e,t,n),i=kn(r,t),o=new Map(i.map((d,l)=>[d,l])),s=En(r,t,i,o,n.signal),c=new Map(i.map(d=>[d,1]));for(let d=i.length-1;d>=0;d-=1){let l=i[d];if(l===t)continue;let f=s.get(l);c.set(f,c.get(f)+c.get(l))}let a=i.filter(d=>d!==t).map(d=>({id:d,idom:s.get(d),dominatedCount:c.get(d)-1})).sort((d,l)=>l.dominatedCount-d.dominatedCount||d.id.localeCompare(l.id));return{value:{root:t,reachableCount:r.order.length,rows:a},meta:{visitedNodes:r.order.length,inspectedEdges:r.inspectedEdges,truncated:r.truncated}}}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="aa8e4dc3-250e-50eb-b770-a11cbab6ebc3")}catch{}})();function st(e){return Math.round(e*1e6)/1e6}function ct(e,t,n){let r=e.get(t);r===void 0?e.set(t,new Set([n])):r.add(n)}function at(e,t){let n=new Map(e.nodes().map(i=>[i,new Set]));V(e,t,i=>{n.get(i.source).add(i.target),n.get(i.target).add(i.source)});let r=new Map;for(let[i,o]of n)r.set(i,[...o].sort());return r}function Sn(e,t){let n=new Map,r=new Map;return V(e,t,(i,o)=>{if(!o.ordering)return;let{predecessor:s,successor:c}=D(i,o);ct(r,s,c),ct(n,c,s)}),{incoming:n,outgoing:r}}function Cn(e,t,n){let r=new Map([[e,0]]),i=new Map([[e,1]]),o=new Map,s=[],c=[e],a=0,d=0;for(let l=0;l<c.length;l+=1){let f=c[l];n.visitedNodes+=1,s.push(f);let u=r.get(f);f!==e&&(a+=1,d+=u);for(let g of t.get(f))if(n.inspectedEdges+=1,r.has(g)||(r.set(g,u+1),c.push(g)),r.get(g)===u+1){i.set(g,(i.get(g)??0)+i.get(f));let h=o.get(g);h===void 0?o.set(g,[f]):h.push(f)}}return{stack:s,sigma:i,predecessors:o,reachableCount:a,distanceSum:d}}function Dn(e,t,n){let r=new Map;for(let i=e.stack.length-1;i>=0;i-=1){let o=e.stack[i],s=(1+(r.get(o)??0))/e.sigma.get(o);for(let c of e.predecessors.get(o)??[])r.set(c,(r.get(c)??0)+e.sigma.get(c)*s);o!==t&&n.set(o,(n.get(o)??0)+(r.get(o)??0))}}function Tn(e,t){return t<=1||e.reachableCount===0?0:e.reachableCount/(t-1)*(e.reachableCount/e.distanceSum)}function Nn(e,t,n,r,i){return{id:e,degree:t.get(e).length,inDegree:n.incoming.get(e)?.size??0,outDegree:n.outgoing.get(e)?.size??0,betweenness:st((r.get(e)??0)/2),closeness:st(i.get(e))}}function dt(e,t={}){let n=at(e,t.kinds),r=Sn(e,t.kinds),i=e.nodes(),o=new Map,s=new Map,c={visitedNodes:0,inspectedEdges:0};for(let l of i){t.signal?.throwIfAborted();let f=Cn(l,n,c);s.set(l,Tn(f,i.length)),Dn(f,l,o)}let a=0;for(let l of n.values())a+=l.length;let d=i.map(l=>Nn(l,n,r,o,s)).sort((l,f)=>f.betweenness-l.betweenness||f.degree-l.degree||l.id.localeCompare(f.id));return{value:{nodeCount:i.length,edgeCount:a/2,rows:d},meta:{visitedNodes:c.visitedNodes,inspectedEdges:c.inspectedEdges,truncated:!1}}}function An(e,t){return e<=t?{source:e,target:t}:{source:t,target:e}}function Rn(e,t,n){let i=t.get(e.node)[e.neighborIndex];if(e.neighborIndex+=1,n.inspectedEdges+=1,i!==e.parent){if(n.discovery.has(i)){n.low.set(e.node,Math.min(n.low.get(e.node),n.discovery.get(i)));return}return e.children+=1,n.discovery.set(i,n.timer),n.low.set(i,n.timer),n.timer+=1,{node:i,parent:e.node,neighborIndex:0,children:0}}}function On(e,t,n){if(e.parent===null){e.children>1&&n.articulation.add(e.node);return}let r=e.parent,i=n.low.get(e.node);n.low.set(r,Math.min(n.low.get(r),i)),r!==t&&i>=n.discovery.get(r)&&n.articulation.add(r),i>n.discovery.get(r)&&n.bridges.push(An(r,e.node))}function jn(e,t,n,r){n.discovery.set(e,n.timer),n.low.set(e,n.timer),n.timer+=1;let i=[{node:e,parent:null,neighborIndex:0,children:0}];for(;i.length>0;){r?.throwIfAborted();let o=i.at(-1);if(o.neighborIndex<t.get(o.node).length){let s=Rn(o,t,n);s!==void 0&&i.push(s)}else On(o,e,n),i.pop()}}function X(e,t={}){let n=at(e,t.kinds),r={discovery:new Map,low:new Map,timer:0,articulation:new Set,bridges:[],inspectedEdges:0};for(let i of e.nodes())r.discovery.has(i)||jn(i,n,r,t.signal);return{value:{articulationPoints:[...r.articulation].sort(),bridges:r.bridges.sort((i,o)=>i.source.localeCompare(o.source)||i.target.localeCompare(o.target))},meta:{visitedNodes:r.discovery.size,inspectedEdges:r.inspectedEdges,truncated:!1}}}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="1c9d9d0c-e989-568c-a49a-202f77e94806")}catch{}})();function Mn(e){let t=e.registry(),n=new Map,r=new Set;for(let i of e.edges()){let o=t.require(i.kind);if(!o.ordering)continue;let{predecessor:s,successor:c}=D(i,o);if(r.add(s),r.add(c),s===c)continue;let a=n.get(s);a===void 0?n.set(s,new Set([c])):a.add(c)}return{forward:n,participants:r}}function Pn(e,t,n,r){if(e===void 0)return r;let i=r;for(let o of e)t.has(o)&&(i=Math.min(i,n.get(o)));return i}function Ln(e,t,n){let r=n-t;return{id:e,earliestStart:t,earliestFinish:t+1,latestStart:n,latestFinish:n+1,slack:r,critical:r===0}}function Fn(e,t,n,r,i){let o=new Map;for(let s=e.length-1;s>=0;s-=1){let c=e[s],a=Pn(t.forward.get(c),r,o,i);o.set(c,a-1)}return e.map(s=>Ln(s,n[s],o.get(s))).sort((s,c)=>s.slack-c.slack||s.earliestStart-c.earliestStart||s.id.localeCompare(c.id))}function lt(e,t={}){t.signal?.throwIfAborted();let n=B(e,{registry:e.registry()}),r=Mn(e),i=new Set(n.order),o=n.order.filter(d=>r.participants.has(d)),s=o.reduce((d,l)=>Math.max(d,n.depth[l]+1),0),c=Fn(o,r,n.depth,i,s),a=c.length>0;return{exact:!0,acyclic:n.acyclic,makespan:s,scheduledCount:c.length,criticalPath:a?n.criticalPath:[],criticalPathLength:a?n.criticalPathLength:0,cycles:n.cycles,rows:c,provenance:{algorithm:"critical-path-method",edgeFamily:"ordering",weighting:"unit"}}}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="6b2a7206-d480-51c1-9d46-4271bde24fa3")}catch{}})();function Gn(e,t,n){for(let r=e.length-1;r>=0;r-=1){n?.throwIfAborted();let i=t.get(e[r]);for(let o of i.successors){n?.throwIfAborted();let s=t.get(o);if(s.latest===void 0||s.duration===void 0)continue;let c=s.latest-s.duration;(i.latest===void 0||c<i.latest)&&(i.latest=c,i.anchor=s.anchor)}}}function $n(e,t,n,r){let i=[],o=e;for(;o!==void 0&&i.length<n;)r?.throwIfAborted(),i.push(o),o=t.get(o).predecessor;return i.reverse(),{path:i,path_truncated:o!==void 0}}function qn(e,t,n,r,i){let o=new Map(t.map(c=>[c.id,c])),s=new Map;for(let c of e){i?.throwIfAborted();let a=o.get(c),d=a?.estimated_minutes,l=typeof d=="number"&&Number.isFinite(d)&&d>=0?d:void 0,f={item:a,duration:l,pending:0,successors:new Set,earliest:0};if(a?.deadline!==void 0){let u=Date.parse(a.deadline);Number.isFinite(u)?(f.deadline=(u-n)/6e4,f.latest=f.deadline,f.anchor=c):r(c,"invalid_deadline")}s.set(c,f)}return s}function Un(e,t,n){for(let r of e.edges()){n?.throwIfAborted();let i=e.registry().require(r.kind);if(!i.ordering)continue;let{predecessor:o,successor:s}=D(r,i),c=t.get(o);c.successors.has(s)||(c.successors.add(s),t.get(s).pending+=1)}}function Bn(e,t,n){let r=e.filter(i=>t.get(i).pending===0);for(let i=0;i<r.length;i+=1){n?.throwIfAborted();let o=r[i],s=t.get(o),c=s.earliest===null||s.duration===void 0?null:s.earliest+s.duration;for(let a of s.successors){n?.throwIfAborted();let d=t.get(a);c===null?d.earliest=null:d.earliest!==null&&(c>d.earliest||c===d.earliest&&(d.predecessor===void 0||o<d.predecessor))&&(d.earliest=c,d.predecessor=o),d.pending-=1,d.pending===0&&r.push(a)}}return r}function zn(e,t,n,r,i,o,s,c){let a=t.duration;if(t.latest!==void 0){r.scheduled_count+=1;let d=t.latest-a;r.rows.length<o?r.rows.push({id:e,deadline_id:t.anchor,latest_start:new Date(i+d*6e4).toISOString(),slack_minutes:t.earliest===null?null:d-t.earliest}):r.truncated=!0}if(t.deadline!==void 0&&t.earliest!==null&&t.earliest+a>t.deadline)if(r.overcommitted_count+=1,r.overcommitted.length<o){let d=$n(e,n,Math.min(o,s.remaining),c);s.remaining-=d.path.length,d.path_truncated&&(r.truncated=!0),r.overcommitted.push({deadline_id:e,deadline:t.item.deadline,shortfall_minutes:t.earliest+a-t.deadline,...d})}else r.truncated=!0}function Hn(e,t,n,r,i,o,s,c){let a={remaining:o};for(let d of e){c?.throwIfAborted();let l=t.get(d);if(l.pending>0){s(d,"cycle_or_gated_by_cycle");continue}if(l.duration===void 0){s(d,"unknown_estimate");continue}if(l.latest!==void 0&&!Number.isFinite(new Date(r+(l.latest-l.duration)*6e4).getTime())){s(d,"date_range_exceeded");continue}l.earliest===null&&s(d,"unknown_predecessor_estimate"),zn(d,l,t,n,r,i,a,c)}}function ut(e,t,n={}){n.signal?.throwIfAborted();let r=Date.parse(n.now??new Date().toISOString());if(!Number.isFinite(r))throw new TypeError("Invalid scheduling clock");let i=n.maxWork??1e5,o=n.limit??10;for(let[u,g]of[["maxWork",i],["limit",o]])if(!Number.isSafeInteger(g)||g<1)throw new TypeError(`Invalid scheduling ${u}`);let s={as_of:new Date(r).toISOString(),basis:"derived_elapsed_minutes",complete:!0,truncated:!1,work_limit_exceeded:!1,scheduled_count:0,residual_count:0,overcommitted_count:0,rows:[],residuals:[],overcommitted:[]},c=e.nodes(),a=e.edges();if(c.length+a.length+t.length>i)return{...s,complete:!1,work_limit_exceeded:!0};let d=(u,g)=>{s.complete=!1,s.residual_count+=1,s.residuals.length<o?s.residuals.push({id:u,reason:g}):s.truncated=!0},l=qn(c,t,r,d,n.signal);Un(e,l,n.signal);let f=Bn(c,l,n.signal);return Gn(f,l,n.signal),Hn(c,l,s,r,o,i,d,n.signal),s}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="2bfc4e78-a376-5099-be50-38e339eac660")}catch{}})();function N(){return{nodes:0,isolated:0,degree_leq_one:0,semantic_nodes:0,without_semantic_edges:0,degree_histogram:{}}}function ht(e,t,n,r){let i={all:N(),active:N(),terminal:N()},o=new Map;for(let s of e.details){if(r?.throwIfAborted(),e.missingIdSet.has(s.id.toLowerCase())||s.status==="external")continue;let c=o.get(s.status)??N();o.set(s.status,c);let a=e.graph.incidentEdges(s.id),d=a.some(l=>n(l.kind));for(let l of[i.all,i[t(s.status)?"terminal":"active"],c]){l.nodes+=1,l.isolated+=+(a.length===0),a.length<=1&&(l.degree_leq_one+=1),d?l.semantic_nodes+=1:l.without_semantic_edges+=1;let f=String(a.length);l.degree_histogram[f]=(l.degree_histogram[f]??0)+1}}return{coverage_by_lifecycle:i,coverage_by_status:Object.fromEntries([...o].sort(([s],[c])=>s.localeCompare(c)))}}function ft(e){if(!J(e))return!1;let t=e;if(!["nodes","isolated","degree_leq_one","semantic_nodes","without_semantic_edges"].every(i=>Number.isSafeInteger(t[i])&&Number(t[i])>=0)||!J(t.degree_histogram))return!1;let r=Object.entries(t.degree_histogram);return r.every(([i,o])=>/^(0|[1-9]\d*)$/.test(i)&&Number.isSafeInteger(o)&&Number(o)>=0)&&r.reduce((i,[,o])=>i+Number(o),0)===t.nodes&&Number(t.isolated)<=Number(t.degree_leq_one)&&Number(t.degree_leq_one)<=Number(t.nodes)&&Number(t.semantic_nodes)+Number(t.without_semantic_edges)===t.nodes}function J(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function pt(e){for(let r of["ordering_acyclic","active_ordering_acyclic"])if(e[r]!==void 0&&typeof e[r]!="boolean")return!1;let t=e.coverage_by_lifecycle,n=e.coverage_by_status;return t===void 0&&n===void 0?!0:!J(t)||!J(n)?!1:["all","active","terminal"].every(r=>ft(t[r]))&&Object.values(n).every(ft)}function gt(e,t){return Object.fromEntries([...new Set([...Object.keys(e),...Object.keys(t)])].sort().map(n=>{let r=Object.hasOwn(e,n)?e[n]:N(),i=Object.hasOwn(t,n)?t[n]:N(),o=Object.fromEntries([...new Set([...Object.keys(r.degree_histogram),...Object.keys(i.degree_histogram)])].sort().map(s=>[s,(i.degree_histogram[s]??0)-(r.degree_histogram[s]??0)]));return[n,{nodes:i.nodes-r.nodes,isolated:i.isolated-r.isolated,degree_leq_one:i.degree_leq_one-r.degree_leq_one,semantic_nodes:i.semantic_nodes-r.semantic_nodes,without_semantic_edges:i.without_semantic_edges-r.without_semantic_edges,degree_histogram:o}]}))}function mt(e,t){return!e.coverage_by_lifecycle||!t.coverage_by_lifecycle||!e.coverage_by_status||!t.coverage_by_status?{lifecycle_comparable:!1}:{lifecycle_comparable:!0,coverage_by_lifecycle:gt(e.coverage_by_lifecycle,t.coverage_by_lifecycle),coverage_by_status:gt(e.coverage_by_status,t.coverage_by_status)}}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="896e1553-b127-532f-ac39-e0d47f29eebc")}catch{}})();var A=["missing_reference_active","missing_reference_terminal","legacy_no_blocker_sentinel","ordering_cycle","legacy_ordering_cycle","ordering_storage_contradiction","legacy_ordering_storage_contradiction","hierarchy_cycle","legacy_hierarchy_cycle","hierarchy_cardinality_violation","legacy_hierarchy_cardinality_violation","hierarchy_direction_violation","legacy_hierarchy_direction_violation","duplicate_edge","legacy_duplicate_edge","duplicate_dependency_row","legacy_duplicate_dependency_row","stale_lifecycle_block","isolated_active_node","sparse_active_node"];(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="1335acb2-0730-5934-89a4-14fe4a160288")}catch{}})();var Kn=25,Vn="milestone",Wn="outcome milestone:",Yn=new Set(["discovered_from","incident_from","recurs_from","supersedes","verifies"]);function Q(e){return Yn.has(e)}var _t={error:0,warning:1,info:2};function yt(e){return new Set((e??[]).filter(t=>typeof t=="string").map(t=>t.trim().toLowerCase()))}function R(e,t,n,r,i,o,s,c){let a=[...i].sort((d,l)=>d.localeCompare(l));return{code:e,severity:t,policy:n,message:r(a.length),count:a.length,sample:a.slice(0,o),sample_truncated:a.length>o,remediation:s,...c===void 0?{}:{evidence:[...c].sort((d,l)=>d.localeCompare(l)).slice(0,o)}}}function Xn(e,t){return e.cycles.map(n=>R(n.legacy_terminal?"legacy_hierarchy_cycle":"hierarchy_cycle",n.legacy_terminal?"info":"error","Structural hierarchy must be acyclic across scalar and registered dependency relationships.",r=>`${r} items participate in one hierarchy cycle.`,n.item_ids,t,n.legacy_terminal?"Preserve historical rows unless an explicit legacy repair is approved.":"Remove or retype one exact hierarchy relation before continuing mutation."))}function bt(e,t,n){let r=e.cardinality_violations.filter(i=>i.legacy_terminal===n);return r.length===0?[]:[R(n?"legacy_hierarchy_cardinality_violation":"hierarchy_cardinality_violation",n?"info":"error","Every structural child must resolve to at most one logical parent across all hierarchy spellings.",i=>`${i} child item${i===1?"":"s"} resolve to multiple hierarchy parents.`,r.map(i=>i.child_id),t,n?"Preserve historical rows unless an explicit legacy repair is approved.":"Remove the exact surplus hierarchy rows so each child has one parent.",r.map(i=>`${i.child_id} <- ${i.parent_ids.join(", ")}`))]}function vt(e,t,n){let r=e.divergences.filter(i=>i.legacy_terminal===n);return r.length===0?[]:[R(n?"legacy_hierarchy_direction_violation":"hierarchy_direction_violation",n?"info":"error","Scalar parent metadata and dependency-backed hierarchy rows must resolve to the same logical parent.",i=>`${i} child item${i===1?"":"s"} have divergent hierarchy storage surfaces.`,r.map(i=>i.child_id),t,n?"Preserve historical rows unless an explicit legacy repair is approved.":"Align the scalar parent and exact dependency rows to one canonical parent.",r.map(i=>`${i.child_id}: scalar=${i.scalar_parent_id} dependencies=${i.dependency_parent_ids.join(",")}`))]}function Jn(e,t){let n=G(e);return n?[...Xn(n,t),...bt(n,t,!1),...bt(n,t,!0),...vt(n,t,!1),...vt(n,t,!0)]:[]}function Qn(e){let t=e.graph.registry(),n=new Map;for(let r of e.graph.edges()){let i=t.require(r.kind);if(!i.ordering)continue;let[o,s]=(i.precedence??"source_before_target")==="target_before_source"?[r.target,r.source]:[r.source,r.target],c=n.get(o);c?c.push(s):n.set(o,[s])}for(let r of n.values())r.sort((i,o)=>i.localeCompare(o));return n}function kt(e,t){t.indexes.set(e,t.nextIndex),t.lowLinks.set(e,t.nextIndex),t.nextIndex+=1,t.stack.push(e),t.onStack.add(e)}function Zn(e,t,n,r){let i=n.get(e.node)??[];if(e.neighborIndex>=i.length)return!1;let o=i[e.neighborIndex];return e.neighborIndex+=1,r.indexes.has(o)?r.onStack.has(o)&&r.lowLinks.set(e.node,Math.min(r.lowLinks.get(e.node),r.indexes.get(o))):(kt(o,r),t.push({node:o,neighborIndex:0})),!0}function er(e,t,n,r){t.pop();let i=t.at(-1);if(i&&r.lowLinks.set(i.node,Math.min(r.lowLinks.get(i.node),r.lowLinks.get(e.node))),r.lowLinks.get(e.node)!==r.indexes.get(e.node))return;let o=[];for(;;){let s=r.stack.pop();if(r.onStack.delete(s),o.push(s),s===e.node)break}(o.length>1||o.length===1&&n.get(o[0])?.includes(o[0]))&&r.components.push(o.sort((s,c)=>s.localeCompare(c)))}function tr(e){let t={indexes:new Map,lowLinks:new Map,onStack:new Set,stack:[],components:[],nextIndex:0},n=[...e.keys()].sort((r,i)=>r.localeCompare(i));for(let r of n){if(t.indexes.has(r))continue;let i=[{node:r,neighborIndex:0}];for(kt(r,t);i.length>0;){let o=i.at(-1);Zn(o,i,e,t)||er(o,i,e,t)}}return t.components.sort((r,i)=>r[0].localeCompare(i[0]))}function ae(e){return`${e.holder_id} -> ${e.target_id} (${e.kind})`}function y(e,t,n,r,i,o,s,c){t.length!==0&&e.push(R(r,i,o,s,t,n,c))}function nr(e,t,n){let r=[],i=[...e.dangling.active,...e.dangling.legacy_terminal].filter(o=>!o.no_active_blocker_sentinel);return y(r,i.filter(o=>!t(o.holder_status)).map(ae),n,"missing_reference_active","error","Active items must not reference absent targets; missing prerequisites distort scheduling.",o=>`${o} active dangling reference(s) to absent items`,"Restore or re-create the referenced item, or remove/retype the reference on the holder."),y(r,i.filter(o=>t(o.holder_status)).map(ae),n,"missing_reference_terminal","info","Terminal items may retain historical references, but absent targets remain unexplainable context.",o=>`${o} terminal dangling reference(s) to absent items`,"Leave as history debt or clean up in a dedicated changelog-safe closed-item batch."),y(r,e.dangling.no_active_blocker_sentinels.map(ae),n,"legacy_no_blocker_sentinel","info","The pre-structured-dependency no-active-blocker sentinel is retired; real edges carry blocker state.",o=>`${o} legacy no-active-blocker sentinel reference(s)`,"Delete the sentinel reference; blocker state is derived from blocked_by edges."),r}function le(e,t){let n=t.get(e);return n?!n.terminal:!0}function It(e){return`${e.holder_id} -> ${e.target_id} (blocked_by scalar + ${e.dependency_kind} dependency)`}function rr(e,t){let n=[],r=[];for(let o of e.orderingContradictions??[])(o.legacy_terminal?r:n).push(It(o));let i=[];return y(i,n,t,"ordering_storage_contradiction","error","A scalar blocker and same-target structured ordering row must not assert opposite precedence.",o=>`${o} active scalar-versus-structured ordering contradiction(s)`,"Remove the structured dependency row that points the holder before its scalar blocker, or replace both representations with one unambiguous ordering edge."),y(i,r,t,"legacy_ordering_storage_contradiction","info","Terminal scalar-versus-structured ordering contradictions are exact historical storage defects with no live scheduling effect.",o=>`${o} terminal scalar-versus-structured ordering contradiction(s)`,"Remove the contradictory blocks dependency row in a dedicated changelog-safe closed-item batch; preserve the scalar blocker as the historical precedence record."),i}function ir(e,t,n,r){let i=[],o=Qn(e);for(let a of tr(o)){let d=a.some(u=>le(u,t)),l=new Set(a.map(u=>u.toLowerCase())),f=(e.orderingContradictions??[]).filter(u=>l.has(u.holder_id.toLowerCase())&&l.has(u.target_id.toLowerCase())).map(It);i.push(d?R("ordering_cycle","error","Order-bearing relationship kinds must stay acyclic; a cycle makes every member unschedulable.",u=>`execution-order cycle across ${u} item(s)`,a,r,"Remove or retype one ordering edge inside the cycle, or split the work so precedence is linear.",f.length===0?void 0:f):R("legacy_ordering_cycle","info","Ordering cycles between exclusively terminal items are historical contradictions with no scheduling effect.",u=>`terminal-only execution-order cycle across ${u} item(s)`,a,r,"Leave as history debt, or clean up in a dedicated changelog-safe closed-item batch; never repair closed items ad hoc.",f.length===0?void 0:f))}let s=new Map;for(let[a,d]of o)for(let l of d){let f=s.get(l);f?f.push(a):s.set(l,[a])}let c=[...t.values()].filter(a=>!a.missing&&!a.terminal&&n(a.status)&&!(s.get(a.id)??[]).some(d=>{let l=t.get(d);return l===void 0||!l.terminal})).map(a=>a.id);return y(i,c,r,"stale_lifecycle_block","warning","A blocked lifecycle status must be backed by at least one open ordering predecessor.",a=>`${a} status-blocked item(s) with no open blocker edge`,'Add a local blocker edge, declare an external blocker with --dep "id=<external-ref>,kind=blocked_by,source_kind=external", or move the item back to an active status.'),i}function Z(e){let t=e.edges.map(n=>n.kind).sort((n,r)=>n.localeCompare(r));return`${e.from} -> ${e.to} (${t.join(" + ")})`}function ue(e){let t=e.graph.registry(),n=new Map;for(let i of e.graph.edges()){let o=t.require(i.kind);if(!W(o))continue;let s=ce(i,o);if(s.from===s.to)continue;let c=`${Y(o)}::${s.from}::${s.to}`,a=n.get(c);a?a.edges.push(i):n.set(c,{...s,edges:[i]})}let r=[...n.values()].filter(i=>i.edges.length>=2);for(let i of r)i.edges.sort((o,s)=>o.kind.localeCompare(s.kind));return r.sort((i,o)=>i.from.localeCompare(o.from)||i.to.localeCompare(o.to))}function or(e,t,n){let r=[],i=[];for(let s of ue(e))(le(s.from,t)||le(s.to,t)?r:i).push(Z(s));let o=[];return y(o,r,n,"duplicate_edge","info","One semantic relationship should be stored once; parallel same-family spellings (reciprocal inverse pairs included) add no information and skew degree metrics.",s=>`${s} duplicated relationship(s) between active endpoints`,"Remove all but one stored spelling of the relationship; keep the canonical direction the holder declared first."),y(o,i,n,"legacy_duplicate_edge","info","Duplicated spellings between exclusively terminal items are historical noise with no scheduling effect.",s=>`${s} duplicated relationship(s) between terminal endpoints`,"Leave as history debt or clean up in a dedicated changelog-safe closed-item batch."),o}function sr(e,t){let n=[],r=[];for(let o of e.duplicateRows??[])(o.legacy_terminal?r:n).push(`${o.holder_id} -> ${o.target_id} (${o.kind} x${o.occurrences})`);let i=[];return y(i,n,t,"duplicate_dependency_row","warning","One dependency row must be stored once per holder; identical repeated rows are a storage-layer defect invisible to the assembled graph.",o=>`${o} exactly duplicated stored dependency row(s) on active holder(s)`,"Remove the repeated rows so the dependency is stored exactly once; graph semantics are unchanged."),y(i,r,t,"legacy_duplicate_dependency_row","info","Identical repeated dependency rows on terminal holders are historical storage noise with no scheduling effect.",o=>`${o} exactly duplicated stored dependency row(s) on terminal holder(s)`,"Leave as history debt or clean up in a dedicated changelog-safe closed-item batch."),i}function cr(e,t){let n=new Map,r={source_to_target:[],target_to_source:[],both:[]};for(let s of e.graph.registry().list())s.outcomeTraversal!==void 0&&r[s.outcomeTraversal].push(s.kind);let i={source_to_target:r.source_to_target.join(","),target_to_source:r.target_to_source.join(","),both:r.both.join(",")},o=(s,c)=>{let a=n.get(c)??new Set;a.add(s),n.set(c,a)};for(let s of e.graph.edges()){t?.throwIfAborted();let c=e.graph.registry().require(s.kind);(c.outcomeTraversal==="source_to_target"||c.outcomeTraversal==="both")&&o(s.source,s.target),(c.outcomeTraversal==="target_to_source"||c.outcomeTraversal==="both")&&o(s.target,s.source)}return{basis:i,reverse:n}}function ar(e,t,n){let r=new Set(e),i=[...e].sort();for(let o=0;o<i.length;o+=1){n?.throwIfAborted();for(let s of[...t.get(i[o])??[]].sort())r.has(s)||(r.add(s),i.push(s))}return r}function dr(e,t,n,r){let i=0,o=0,s=0,c=0;for(let g of e.values())if(r?.throwIfAborted(),!t.has(g.id)&&!(g.missing||g.status==="external")){if(g.terminal){s+=1,n.has(g.id)&&(c+=1);continue}n.has(g.id)?i+=1:o+=1}let a=i+o,d=s-c,l=i+c,f=o+d,u=l+f;return{active_outcome_reachable_nodes:i,active_outcome_unreachable_nodes:o,active_outcome_reachability_basis_points:a===0?0:Math.floor(i*1e4/a),terminal_nodes:s,terminal_outcome_reachable_nodes:c,terminal_outcome_unreachable_nodes:d,terminal_outcome_reachability_basis_points:s===0?0:Math.floor(c*1e4/s),outcome_reachable_nodes:l,outcome_unreachable_nodes:f,outcome_reachability_basis_points:u===0?0:Math.floor(l*1e4/u)}}function lr(e,t,n){let r=new Set(e.details.filter(c=>c.type?.toLowerCase()===Vn&&c.title.trim().toLowerCase().startsWith(Wn)).map(c=>c.id)),{basis:i,reverse:o}=cr(e,n),s=ar(r,o,n);return{outcome_nodes:r.size,outcome_reachability_basis:i,...dr(t,r,s,n)}}function ur(e,t,n,r,i){e.active+=1;let o=t.type??"(untyped)",s=e.byType.get(o);s||(s={active:0,isolated:0,degree_leq_one:0},e.byType.set(o,s)),s.active+=1,!(n>1)&&(e.degreeLeqOne+=1,s.degree_leq_one+=1,n===0&&(e.isolated+=1,s.isolated+=1),!(r.has(t.id.toLowerCase())||i.has(o.toLowerCase()))&&(n===0?e.isolates.push(t.id):e.sparse.push(t.id)))}function fr(e,t,n,r,i,o,s){let c={active:0,missing:0,isolated:0,degreeLeqOne:0,isolates:[],sparse:[],byType:new Map};for(let p of e.graph.nodes()){s?.throwIfAborted();let _=t.get(p);if(_){if(_.missing){c.missing+=1;continue}_.terminal||ur(c,_,e.graph.incidentEdges(p).length,n,r)}}let{isolates:a,sparse:d}=c,l=[];y(l,a,i,"isolated_active_node","warning","Active work should be reachable from the graph unless explicitly declared a valid isolate.",p=>`${p} active item(s) with no relationships`,"Link the item to its parent, prerequisite, or origin \u2014 or register it as an exempt isolate."),y(l,d,i,"sparse_active_node","info","Active items with a single edge often miss an honest semantic partner; sparse is not automatically defective.",p=>`${p} active item(s) with exactly one relationship`,"Investigate for an honest second edge (story->task, defect family, cross-epic complement); do not fabricate one.");let f=e.graph.edges().length,u=T(e.graph,{signal:s}).value,g=new Set(u.map(({edge:p})=>`${p.source.toLowerCase()}\0${p.target.toLowerCase()}\0${p.kind}`));for(let p of e.orderingContradictions??[])g.add(`${p.holder_id.toLowerCase()}\0${p.target_id.toLowerCase()}\0${p.dependency_kind}`);let h=Object.fromEntries(Object.entries(o).sort(([p],[_])=>p.localeCompare(_))),m=Object.entries(h).reduce((p,[_,E])=>p+(Q(_)?E:0),0),b=X(e.graph,{signal:s}).value,v=lr(e,t,s);return{findings:l,profile:{nodes:e.graph.nodes().length,recorded_nodes:e.details.filter(p=>p.status!=="missing"&&p.status!=="external").length,edges:f,informative_edges:f-g.size,redundant_edges:u.length,ordering_contradiction_edges:e.orderingContradictions?.length??0,edge_basis:"deduplicated_directed",edges_by_kind:h,edge_share_by_kind:Object.fromEntries(Object.entries(h).map(([p,_])=>[p,_/f])),semantic_edges:m,semantic_edge_share:f===0?0:m/f,active_nodes:c.active,missing_nodes:c.missing,isolated_active_nodes:c.isolated,degree_leq_one_active_nodes:c.degreeLeqOne,coverage_by_type:Object.fromEntries([...c.byType.entries()].sort(([p],[_])=>p<_?-1:1)),articulation_points:b.articulationPoints.length,bridge_edges:b.bridges.length,...v,finding_subjects_by_code:Object.fromEntries(A.map(p=>[p,0]))}}}function ee(e,t={}){let n=t.isTerminal??(u=>u==="closed"||u==="canceled"),r=t.isBlocked??(u=>u==="blocked"),i=t.maxSampleSize??Kn;if(!Number.isInteger(i)||i<1)throw new TypeError(`Invalid audit sample bound: ${String(t.maxSampleSize)}`);let o=yt(t.exemptIsolates),s=yt(t.isolateExemptTypes),c=new Map(e.details.map(u=>[u.id,{id:u.id,status:u.status,missing:e.missingIdSet.has(u.id.toLowerCase()),terminal:n(u.status),...u.type===void 0?{}:{type:u.type}}]));t.signal?.throwIfAborted();let a={};for(let u of e.graph.edges())a[u.kind]=(a[u.kind]??0)+1;let d=nr(e,n,i);d.push(...Jn(e,i)),t.signal?.throwIfAborted(),d.push(...rr(e,i)),t.signal?.throwIfAborted(),d.push(...ir(e,c,r,i)),t.signal?.throwIfAborted(),d.push(...or(e,c,i),...sr(e,i)),t.signal?.throwIfAborted();let l=fr(e,c,o,s,i,a,t.signal);d.push(...l.findings),d.sort((u,g)=>_t[u.severity]-_t[g.severity]||u.code.localeCompare(g.code)||u.sample[0].localeCompare(g.sample[0]));let f=l.profile.finding_subjects_by_code;for(let u of d)f[u.code]+=u.count;return{findings:d,profile:{...l.profile,...ht(e,n,Q,t.signal),ordering_acyclic:!d.some(u=>u.code==="ordering_cycle"||u.code==="legacy_ordering_cycle"),active_ordering_acyclic:!d.some(u=>u.code==="ordering_cycle"),finding_subjects_by_code:f}}}function de(e,t){let n=[...new Set([...Object.keys(e),...Object.keys(t)])].sort(),r={};for(let i of n){let o=(t[i]??0)-(e[i]??0);o!==0&&(r[i]=o)}return r}function wt(e){return e.profile.coverage_by_type??{}}function gr(e,t){let n={},r=wt(e),i=wt(t),o=[...new Set([...Object.keys(r),...Object.keys(i)])].sort();for(let s of o){let c=Object.assign({active:0,isolated:0,degree_leq_one:0},r[s]),a=Object.assign({active:0,isolated:0,degree_leq_one:0},i[s]),d={active:a.active-c.active,isolated:a.isolated-c.isolated,degree_leq_one:a.degree_leq_one-c.degree_leq_one};Object.values(d).some(l=>l!==0)&&(n[s]=d)}return n}function xt(e,t){let n=gr(e,t),{edge_share_by_kind:r={},semantic_edges:i=0,semantic_edge_share:o=0}=e.profile,{edge_share_by_kind:s={},semantic_edges:c=0,semantic_edge_share:a=0}=t.profile,d=e.profile.recorded_nodes??e.profile.nodes,l=t.profile.recorded_nodes??t.profile.nodes,f=e.profile.informative_edges??e.profile.edges,u=t.profile.informative_edges??t.profile.edges,g=e.profile.redundant_edges??0,h=t.profile.redundant_edges??0,m=e.profile.ordering_contradiction_edges??0,b=t.profile.ordering_contradiction_edges??0;return{baseline_saved_at:e.saved_at,same_snapshot:e.fingerprint===t.fingerprint,affected_subjects_by_code:de(e.affected_subjects_by_code,t.affected_subjects_by_code),profile:{nodes:t.profile.nodes-e.profile.nodes,recorded_nodes:l-d,edges:t.profile.edges-e.profile.edges,informative_edges:u-f,redundant_edges:h-g,ordering_contradiction_edges:b-m,active_nodes:t.profile.active_nodes-e.profile.active_nodes,missing_nodes:t.profile.missing_nodes-e.profile.missing_nodes,isolated_active_nodes:t.profile.isolated_active_nodes-e.profile.isolated_active_nodes,degree_leq_one_active_nodes:t.profile.degree_leq_one_active_nodes-e.profile.degree_leq_one_active_nodes,edges_by_kind:de(e.profile.edges_by_kind,t.profile.edges_by_kind),edge_share_by_kind:de(r,s),semantic_edges:c-i,semantic_edge_share:a-o,coverage_by_type:n,...mt(e.profile,t.profile)}}}import Et from"node:path";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="19264e42-25fa-5c93-9b0d-3b18a1ab9783")}catch{}})();var St=2,fe=500,hr=64,pr="graph-durable-cache";function Ct(e){return Re(e,pr,30,`graph-cache:${process.pid}`,!1,!1,3e3)}function F(e){return Et.join(e,"runtime","graph-cache.json")}function Dt(e){return Et.join(e,"runtime","graph-audit-baseline.json")}function ge(e){if(e!==null)try{let t=JSON.parse(e);return typeof t!="object"||t===null||t.version!==St||typeof t.fingerprint!="string"||typeof t.saved_at!="string"||typeof t.results!="object"||t.results===null||Array.isArray(t.results)?void 0:t}catch{return}}async function he(e,t){let n=await j(F(e)),r=ge(n),i=r?.fingerprint===t;return{exists:n!==null,fresh:i,results:i?r.results:{}}}async function pe(e,t,n,r,i){let o=await Ct(e);try{let s=ge(await j(F(e))),c=s?.fingerprint===t?s.results:{};delete c[r],c[r]=i;let a=Object.keys(c);for(let d of a.slice(0,Math.max(0,a.length-hr)))delete c[d];await re(F(e),JSON.stringify({version:St,fingerprint:t,saved_at:new Date().toISOString(),results:c})),n.results=c}finally{await o()}}async function me(e){let t=await Ct(e);try{await Ie(F(e))}finally{await t()}}async function Tt(e,t){let n=F(e),r=await j(n),i=ge(r);return i===void 0?{exists:r!==null,fresh:!1,entry_count:0}:{exists:!0,fresh:i.fingerprint===t,entry_count:Object.keys(i.results).length,fingerprint:i.fingerprint.slice(0,12),saved_at:i.saved_at,bytes:Buffer.byteLength(r,"utf8")}}function _e(e,t){return t||e>=fe}function te(e){return O(e)&&Object.values(e).every(x)}function O(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function x(e){return Number.isInteger(e)&&Number(e)>=0}function Nt(e){return typeof e=="number"&&Number.isFinite(e)&&e>=0&&e<=1}function L(e,t){return e===void 0||t(e)}function mr(e){return O(e)&&Object.values(e).every(Nt)}function _r(e){return O(e)?Object.values(e).every(t=>O(t)&&[t.active,t.isolated,t.degree_leq_one].every(x)):!1}function yr(e,t,n){let r=["recorded_nodes","informative_edges","redundant_edges","ordering_contradiction_edges"],i=r.filter(s=>e[s]!==void 0).length;if(i!==0&&i!==r.length||!r.every(s=>L(e[s],x)))return;let o={recorded_nodes:e.recorded_nodes??t,informative_edges:e.informative_edges??n,redundant_edges:e.redundant_edges??0,ordering_contradiction_edges:e.ordering_contradiction_edges??0};return o.recorded_nodes<=t&&o.informative_edges<=n&&o.redundant_edges<=n&&o.ordering_contradiction_edges<=n?o:void 0}function br(e,t,n){let r=[...t,...n,"finding_subjects_by_code"],i=r.filter(o=>e[o]!==void 0).length;return i!==0&&i!==r.length?!1:t.every(o=>L(e[o],x))&&n.every(o=>L(e[o],x)&&(e[o]===void 0||Number(e[o])<=1e4))&&L(e.finding_subjects_by_code,te)}function vr(e,t,n,r){let i=yr(e,n,r);if(i===void 0)return;let o=["articulation_points","bridge_edges","outcome_nodes","active_outcome_reachable_nodes","active_outcome_unreachable_nodes","terminal_nodes","terminal_outcome_reachable_nodes","terminal_outcome_unreachable_nodes","outcome_reachable_nodes","outcome_unreachable_nodes"],s=["active_outcome_reachability_basis_points","terminal_outcome_reachability_basis_points","outcome_reachability_basis_points"];if(!br(e,o,s)||e.edge_basis!==void 0&&e.edge_basis!=="deduplicated_directed")return;let c=te(e.finding_subjects_by_code)?e.finding_subjects_by_code:{};return{edge_basis:"deduplicated_directed",...i,...Object.fromEntries(o.map(a=>[a,e[a]??0])),...Object.fromEntries(s.map(a=>[a,e[a]??0])),finding_subjects_by_code:Object.fromEntries(A.map(a=>[a,c[a]??t[a]??0]))}}function wr(e,t,n,r,i){let o=[n,r,i],s=o.filter(d=>d!==void 0).length;if(s===0)return{edge_share_by_kind:{},semantic_edges:0,semantic_edge_share:0};if(s!==o.length||!mr(n)||!x(r)||!Nt(i))return;let c=Object.entries(t);if(c.reduce((d,[,l])=>d+l,0)!==e||Object.keys(n).length!==c.length||c.some(([d,l])=>n[d]!==(e===0?0:l/e)))return;let a=c.reduce((d,[l,f])=>d+(Q(l)?f:0),0);if(!(r!==a||i!==(e===0?0:a/e)))return{edge_share_by_kind:n,semantic_edges:r,semantic_edge_share:i}}function kr(e){if(e!==null)try{let t=JSON.parse(e);if(!O(t))return;let n=t,r=n.profile;if(typeof n.saved_at!="string"||typeof n.fingerprint!="string")return;let i=n.affected_subjects_by_code;if(!te(i)||!O(r)||!pt(r)||![r.nodes,r.edges,r.active_nodes,r.missing_nodes,r.isolated_active_nodes,r.degree_leq_one_active_nodes].every(x)||!te(r.edges_by_kind)||!L(r.coverage_by_type,_r))return;let o=wr(r.edges,r.edges_by_kind,r.edge_share_by_kind,r.semantic_edges,r.semantic_edge_share);if(o===void 0)return;let s=vr(r,i,r.nodes,r.edges);if(s===void 0)return;let{coverage_by_type:c={}}=r;return{...n,profile:{...r,...o,...s,coverage_by_type:c}}}catch{return}}async function At(e){return kr(await j(Dt(e)))}async function Rt(e,t){await re(Dt(e),JSON.stringify(t))}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="236ccc7d-6efd-57b1-8cce-6758d537f779")}catch{}})();var Ir={missing_reference_active:{op:"investigate",confidence:"medium",rationale:"Restore or re-create the referenced item, or remove/retype the reference on the active holder; the correct fix depends on why the target is absent."},missing_reference_terminal:{op:"waive",confidence:"high",rationale:"Terminal-holder reference to an absent item is historical debt; waive it or clean it up only in a dedicated changelog-safe closed-item batch."},legacy_no_blocker_sentinel:{op:"remove",confidence:"high",rationale:"The pre-structured-dependency no-active-blocker sentinel is retired and carries no information; blocker state derives from blocked_by edges."},ordering_cycle:{op:"investigate",confidence:"low",rationale:"Every cycle member is unschedulable until one ordering edge is removed or retyped; the planner never chooses which edge to cut."},legacy_ordering_cycle:{op:"waive",confidence:"high",rationale:"Terminal-only ordering cycles have no scheduling effect; repairing them would mutate closed history (changelog drag)."},ordering_storage_contradiction:{op:"remove",confidence:"high",rationale:"The structured ordering row asserts the opposite precedence from the same-target scalar blocker; remove that exact dependency row or replace both representations with one unambiguous edge."},legacy_ordering_storage_contradiction:{op:"remove",confidence:"high",rationale:"The terminal holder contains a proven contradictory structured ordering row; remove it in a dedicated changelog-safe batch while preserving the scalar blocker as history."},hierarchy_cycle:{op:"investigate",confidence:"low",rationale:"Cut or retype one exact structural relation in the cycle; the planner preserves every evidence row because intent determines the correct parent."},legacy_hierarchy_cycle:{op:"waive",confidence:"high",rationale:"Terminal-only hierarchy cycles are historical debt; waive them unless an explicit closed-history repair is approved."},hierarchy_cardinality_violation:{op:"investigate",confidence:"medium",rationale:"Choose the canonical parent and remove or retype the exact surplus hierarchy rows; the planner cannot infer ownership intent."},legacy_hierarchy_cardinality_violation:{op:"waive",confidence:"high",rationale:"Multiple parents confined to terminal items are historical debt; waive them unless a dedicated history repair is approved."},hierarchy_direction_violation:{op:"investigate",confidence:"medium",rationale:"Align the scalar parent and dependency-backed hierarchy rows to the intended canonical parent."},legacy_hierarchy_direction_violation:{op:"waive",confidence:"high",rationale:"Divergent hierarchy storage confined to terminal items is historical debt; waive it unless a dedicated history repair is approved."},duplicate_edge:{op:"remove",confidence:"high",rationale:"Parallel same-family spellings state one relationship twice; remove all but one stored spelling, keeping the holder's canonical direction."},legacy_duplicate_edge:{op:"waive",confidence:"high",rationale:"Duplicated spellings between terminal items are historical noise; waive or batch changelog-safe cleanup."},duplicate_dependency_row:{op:"remove",confidence:"high",rationale:"The identical dependency row is stored more than once on the holder; drop the repeats so the row exists exactly once \u2014 graph semantics are unchanged."},legacy_duplicate_dependency_row:{op:"waive",confidence:"high",rationale:"Repeated identical rows on terminal holders are storage noise; waive or clean up only in a changelog-safe closed-item batch."},stale_lifecycle_block:{op:"investigate",confidence:"medium",rationale:`Add a local ordering edge, declare an external blocker with --dep "id=<external-ref>,kind=blocked_by,source_kind=external", or move the item back to an active status; only the holder's owner knows which is true.`},isolated_active_node:{op:"investigate",confidence:"medium",rationale:"Link the item to its parent, prerequisite, or origin \u2014 or register it as an explicitly exempt isolate; the audit never fabricates an edge."},sparse_active_node:{op:"investigate",confidence:"low",rationale:"Investigate for an honest second edge (story-to-task, defect family, cross-epic complement); sparse is not automatically defective."}};function Ot(e){return`${e.source} -${e.kind}-> ${e.target}`}function xr(e){let[t,...n]=e.edges;return n.map(r=>({op:"remove",code:"duplicate_edge",subject:Ot(r),rationale:"This stored spelling restates the kept canonical edge of the same semantic family; removing it leaves the relationship stated exactly once.",evidence:[`keep: ${Ot(t)}`,`group: ${Z(e)}`],confidence:"high"}))}function Er(e,t){if(e.code==="duplicate_edge")return e.sample.flatMap(r=>xr(t.get(r)));let n=Ir[e.code];return e.sample.map(r=>({op:n.op,code:e.code,subject:r,rationale:n.rationale,evidence:[e.policy],confidence:n.confidence}))}function jt(e,t={}){let{redundancyLimit:n,...r}=t,i=ee(e,r),o=new Map(ue(e).map(d=>[Z(d),d])),s=i.findings.flatMap(d=>Er(d,o)),c=i.findings.some(d=>d.sample_truncated);t.signal?.throwIfAborted();let a=T(e.graph,{limit:n??t.maxSampleSize??25,...t.signal===void 0?{}:{signal:t.signal}});for(let d of a.value)s.push({op:"remove",code:"redundant_edge",subject:`${d.edge.source} -> ${d.edge.target} (${d.edge.kind})`,rationale:"The stored edge is implied by a longer same-family witness path; shortcut edges are sometimes deliberate emphasis, so confirm intent before removing.",evidence:[`witness: ${d.witness.join(" -> ")}`],confidence:"medium"});return c=c||a.meta.truncated,{steps:s,report:i,truncated:c,cost:{visitedNodes:a.meta.visitedNodes,inspectedEdges:a.meta.inspectedEdges}}}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="123fbdac-0fc7-5f02-85d9-9a7ca55e1df1")}catch{}})();var Ft=new Set(["ancestors","descendants","predecessors","successors","paths","impact","dominators"]);function Mt(e,t,n){let r=e;if(t&&e.subcommand==="audit"){let{nodes:i,recorded_nodes:o,edges:s,active_nodes:c,terminal_nodes:a,missing_nodes:d,ordering_acyclic:l,active_ordering_acyclic:f,coverage_by_lifecycle:u}=e.profile,g=Object.fromEntries(Object.entries(u).map(([h,m])=>{let{degree_histogram:b,...v}=m;return[h,v]}));r={...e,profile:{nodes:i,recorded_nodes:o,edges:s,active_nodes:c,terminal_nodes:a,missing_nodes:d,ordering_acyclic:l,active_ordering_acyclic:f,coverage_by_lifecycle:g}}}return{...r,projection:{mode:t?"summary":"full",declared_field_groups:n===void 0?[]:[{name:n,restore_with:"--full"}],included_field_groups:n===void 0||t?[]:[n]}}}function Sr(e,t,n,r){return{assembly:t,...n===void 0?{}:{kinds:n},maxDepth:Ue(r.maxDepth),limit:e==="impact"&&Number(r.limit)===0?0:$(r.limit,"limit")??(r.full===!0?Number.MAX_SAFE_INTEGER:I.rows),after:r.after?.trim()||void 0,direction:Be(r.direction),maxPaths:$(r.maxPaths,"max-paths"),sample:$(r.sample,"sample")??I.samples,exemptIsolates:Pt(r.exemptIsolate),exemptIsolateTypes:Pt(r.exemptIsolateType),saveBaseline:r.saveBaseline===!0,summary:r.summary===!0,unbounded:r.full===!0}}function Pt(e){return e===void 0?[]:(Array.isArray(e)?e:[e]).flatMap(t=>t.split(",")).map(t=>t.trim()).filter(t=>t.length>0)}function Cr(e,t,n){let r=e.trim().toLowerCase();if(!ie.includes(r))throw Me({command_path:"graph",token:r||"<empty>",allowed:ie});let i=r;if(Ft.has(i)&&!t?.trim())throw new k(`graph ${i} requires an item id.`,w.USAGE);if(i==="paths"&&!n?.trim())throw new k("graph paths requires a source and a target item id.",w.USAGE);return i}function ye(e){throw e instanceof TypeError?new k(e.message,w.USAGE):e}function be(e){return{truncated:e.truncated,cost:{visited_nodes:e.visitedNodes,inspected_edges:e.inspectedEdges}}}function Lt(e,t){let n=t.trim().toLowerCase();for(let r of e.details)if(r.id.trim().toLowerCase()===n&&!e.missingIdSet.has(r.id.toLowerCase()))return r.id;throw new k(`Item ${t} not found`,w.NOT_FOUND)}function Dr(e,t,n){let r={ancestors:Qe,descendants:Ze,predecessors:et,successors:tt}[e],i;try{i=r(n.assembly.graph,t,{...n.kinds===void 0?{}:{kinds:n.kinds},...n.maxDepth===void 0?{}:{maxDepth:n.maxDepth},limit:n.limit,...n.after===void 0?{}:{after:n.after}})}catch(s){ye(s)}let o=be(i.meta);return{subcommand:e,root:t,count:i.value.length,...o,...i.meta.nextCursor===void 0?{}:{next_cursor:i.meta.nextCursor},...n.summary?{}:{ids:i.value}}}function Tr(e,t,n){let r=nt(n.assembly.graph,e,t,{direction:n.direction,...n.kinds===void 0?{}:{kinds:n.kinds},...n.maxDepth===void 0?{}:{maxDepth:n.maxDepth},...n.maxPaths===void 0?{}:{maxPaths:n.maxPaths}});return{subcommand:"paths",root:e,target:t,direction:n.direction,count:r.value.length,...be(r.meta),...n.summary?{}:{paths:r.value.map(i=>({nodes:i.nodes,kinds:i.edges.map(o=>o.kind),length:i.length}))}}}function Nr(e,t){let n;try{n=U(t.assembly.graph,e,{direction:t.direction,...t.kinds===void 0?{}:{kinds:t.kinds},...t.maxDepth===void 0?{}:{maxDepth:t.maxDepth},...t.unbounded?{}:{limit:t.limit},...t.after===void 0?{}:{after:t.after}})}catch(r){ye(r)}return{subcommand:"impact",root:e,direction:t.direction,count:n.affected.length,truncated:n.truncated,...n.nextCursor===void 0?{}:{next_cursor:n.nextCursor},cost:{visited_nodes:n.cost.visitedNodes,inspected_edges:n.cost.inspectedEdges},...t.summary?{}:{affected:n.affected}}}function Ar(e,t,n){return{acyclic:e.acyclic,ordered_node_count:e.order.length,layer_count:e.layers.length,frontier_count:e.frontier.length,critical_path_length:e.criticalPathLength,cycle_count:e.cycles.length,...t?{}:{frontier:e.frontier.slice(0,n),critical_path:e.criticalPath.slice(0,n),cycles:e.cycles.slice(0,n)}}}function Rr(e,t,n){return{component_count:e.components.length,largest_component_size:e.components[0]?.length??0,orphan_count:e.orphans.length,...t?{}:{orphans:e.orphans.slice(0,n),hubs:e.hubs.slice(0,n)}}}function Or(e,t,n){let r=0,i=0,o=0;for(let s of e.cycles)r+=Number(s.legacy_terminal);for(let s of e.cardinality_violations)i+=Number(s.legacy_terminal);for(let s of e.divergences)o+=Number(s.legacy_terminal);return{acyclic:e.cycles.length===0,relation_count:e.relations.length,cycle_count:e.cycles.length,active_cycle_count:e.cycles.length-r,legacy_cycle_count:r,cardinality_violation_count:e.cardinality_violations.length,active_cardinality_violation_count:e.cardinality_violations.length-i,legacy_cardinality_violation_count:i,parent_divergence_count:e.divergences.length,active_parent_divergence_count:e.divergences.length-o,legacy_parent_divergence_count:o,...t?{}:{cycles:e.cycles.slice(0,n).map(s=>s.item_ids)}}}function jr(e){let t=e.assembly.graph,n=e.limit,r=B(t,{registry:t.registry()}),i=Ye(t);return{subcommand:"analyze",node_count:t.nodes().length,edge_count:t.edges().length,edge_basis:"deduplicated_directed",sample_limit:n,execution:Ar(r,e.summary,n),knowledge:Rr(i,e.summary,n),hierarchy:Or(G(e.assembly),e.summary,n)}}function Mr(e,t){let n=ee(e.assembly,{isTerminal:t,maxSampleSize:e.sample,...e.exemptIsolates.length===0?{}:{exemptIsolates:e.exemptIsolates},...e.exemptIsolateTypes.length===0?{}:{isolateExemptTypes:e.exemptIsolateTypes}}),r={},i={},o={},s={};for(let d of n.findings)r[d.severity]=(r[d.severity]??0)+1,i[d.code]=(i[d.code]??0)+1,o[d.severity]=(o[d.severity]??0)+d.count,s[d.code]=(s[d.code]??0)+d.count;let{finding_subjects_by_code:c,...a}=n.profile;return{subcommand:"audit",truncated:n.findings.length>e.limit,finding_count:n.findings.length,findings_by_severity:r,findings_by_code:i,affected_subjects_by_severity:o,affected_subjects_by_code:s,profile:e.summary?a:n.profile,legacy_alias_counts:e.assembly.legacyAliasCounts,...e.summary?{}:{findings:n.findings.slice(0,e.limit)}}}function Pr(e){let t=e.limit,n={};e.kinds!==void 0&&(n.kinds=e.kinds);let r=it(e.assembly.graph,n),i=r.value;return{subcommand:"communities",community_count:i.communities.length,largest_community_size:i.communities[0]?.size??0,iterations:i.iterations,converged:i.converged,truncated:!i.converged||i.communities.length>t,cost:{visited_nodes:r.meta.visitedNodes,inspected_edges:r.meta.inspectedEdges},...e.summary?{}:{communities:i.communities.slice(0,t).map(o=>({representative:o.representative,size:o.size,members:o.members.slice(0,t)}))}}}function Lr(e){let t;try{t=T(e.assembly.graph,{...e.kinds===void 0?{}:{kinds:e.kinds},...e.maxDepth===void 0?{}:{maxDepth:e.maxDepth},limit:e.limit})}catch(n){ye(n)}return{subcommand:"redundancy",redundant_count:t.value.length,...be(t.meta),...e.summary?{}:{redundant:t.value.map(n=>({source:n.edge.source,target:n.edge.target,kind:n.edge.kind,witness:n.witness}))}}}function Fr(e,t){let n=t.limit,r=ot(t.assembly.graph,e,{direction:t.direction,...t.kinds===void 0?{}:{kinds:t.kinds},...t.maxDepth===void 0?{}:{maxDepth:t.maxDepth}}),i=r.value.rows.filter(o=>o.dominatedCount>0);return{subcommand:"dominators",root:e,direction:t.direction,reachable_count:r.value.reachableCount,bottleneck_count:i.length,truncated:r.meta.truncated||i.length>n,cost:{visited_nodes:r.meta.visitedNodes,inspected_edges:r.meta.inspectedEdges},...t.summary?{}:{bottlenecks:i.slice(0,n).map(o=>({id:o.id,idom:o.idom,dominated_count:o.dominatedCount}))}}}function Gr(e){let t=e.limit,n=lt(e.assembly.graph),r=n.rows.filter(i=>i.critical).length;return{subcommand:"slack",acyclic:n.acyclic,makespan:n.makespan,scheduled_count:n.scheduledCount,critical_count:r,critical_path_length:n.criticalPathLength,cycle_count:n.cycles.length,truncated:n.rows.length>t,...e.summary?{}:{critical_path:n.criticalPath.slice(0,t),rows:n.rows.slice(0,t).map(i=>({id:i.id,earliest_start:i.earliestStart,latest_start:i.latestStart,slack:i.slack,critical:i.critical}))}}}function $r(e){let t=e.limit,n=dt(e.assembly.graph,e.kinds===void 0?{}:{kinds:e.kinds}),r=n.value;return{subcommand:"centrality",node_count:r.nodeCount,edge_count:r.edgeCount,edge_basis:"simple_undirected",truncated:r.rows.length>t,cost:{visited_nodes:n.meta.visitedNodes,inspected_edges:n.meta.inspectedEdges},...e.summary?{}:{rows:r.rows.slice(0,t).map(i=>({id:i.id,degree:i.degree,in_degree:i.inDegree,out_degree:i.outDegree,betweenness:i.betweenness,closeness:i.closeness}))}}}function qr(e){let t=e.limit,n=X(e.assembly.graph,e.kinds===void 0?{}:{kinds:e.kinds}),{articulationPoints:r,bridges:i}=n.value;return{subcommand:"articulation",articulation_count:r.length,bridge_count:i.length,truncated:r.length>t||i.length>t,cost:{visited_nodes:n.meta.visitedNodes,inspected_edges:n.meta.inspectedEdges},...e.summary?{}:{articulation_points:r.slice(0,t),bridges:i.slice(0,t)}}}function Ur(e,t){let n=e.limit,r=jt(e.assembly,{isTerminal:t,redundancyLimit:n,maxSampleSize:e.sample,...e.exemptIsolates.length===0?{}:{exemptIsolates:e.exemptIsolates},...e.exemptIsolateTypes.length===0?{}:{isolateExemptTypes:e.exemptIsolateTypes}}),i={},o={};for(let s of r.steps)i[s.op]=(i[s.op]??0)+1,o[s.code]=(o[s.code]??0)+1;return{subcommand:"plan",step_count:r.steps.length,steps_by_op:i,steps_by_code:o,finding_count:r.report.findings.length,truncated:r.truncated||r.steps.length>n,cost:{visited_nodes:r.cost.visitedNodes,inspected_edges:r.cost.inspectedEdges},...e.summary?{}:{steps:r.steps.slice(0,n)}}}function Gt(e,t,n,r){return JSON.stringify({projection_version:2,subcommand:e,root:t??null,target:n??null,kinds:r.kinds??null,maxDepth:r.maxDepth??null,limit:r.limit,after:r.after??null,direction:r.direction,maxPaths:r.maxPaths??null,sample:r.sample,exemptIsolates:[...new Set(r.exemptIsolates.map(i=>i.toLowerCase()))].sort(),exemptIsolateTypes:[...new Set(r.exemptIsolateTypes.map(i=>i.toLowerCase()))].sort(),summary:r.summary,unbounded:r.unbounded})}function $t(e,t,n,r,i){return e==="analyze"?jr(r):e==="audit"?Mr(r,i):e==="plan"?Ur(r,i):e==="communities"?Pr(r):e==="redundancy"?Lr(r):e==="dominators"?Fr(t,r):e==="slack"?Gr(r):e==="centrality"?$r(r):e==="articulation"?qr(r):e==="paths"?Tr(t,n,r):e==="impact"?Nr(t,r):Dr(e,t,r)}function Br(e,t){if(e!=="index"&&(t.rebuild===!0||t.clear===!0))throw new k("--rebuild and --clear apply only to graph index.",w.USAGE);if(e!=="audit"&&t.saveBaseline===!0)throw new k("--save-baseline applies only to graph audit.",w.USAGE);if(e==="slack"&&t.kind!==void 0)throw new k("graph slack analyzes every ordering kind; --kind is not supported.",w.USAGE);if(t.rebuild===!0&&t.clear===!0)throw new k("graph index accepts either --rebuild or --clear, not both.",w.USAGE);if(t.full===!0&&t.limit!==void 0)throw new k(`graph ${e} accepts either --full or --limit, not both.`,w.USAGE)}async function zr(e,t,n,r,i,o){let s="status";if(o.clear===!0&&(await me(e),s="cleared"),o.rebuild===!0){await me(e);let a=await he(e,t),d={assembly:n.assembly,direction:"both",exemptIsolates:[],exemptIsolateTypes:[],saveBaseline:!1,summary:!0,limit:I.rows,sample:I.samples,unbounded:!1};for(let l of["analyze","audit"])await pe(e,t,a,Gt(l,void 0,void 0,d),$t(l,void 0,void 0,d,i));s="rebuilt"}let c=await Tt(e,t);return{subcommand:"index",action:s,state:c.exists?c.fresh?"fresh":"stale":"absent",entry_count:c.entry_count,item_count:r,min_items_threshold:fe,persist_enabled:_e(r,c.exists),current_fingerprint:t.slice(0,12),...c.saved_at===void 0?{}:{saved_at:c.saved_at},...c.bytes===void 0?{}:{bytes:c.bytes}}}async function Hr(e,t,n,r){let i={saved_at:new Date().toISOString(),fingerprint:t,affected_subjects_by_code:n.affected_subjects_by_code,profile:{...n.profile,finding_subjects_by_code:Object.fromEntries(A.map(s=>[s,n.affected_subjects_by_code[s]??0]))}},o=await At(e);return r&&await Rt(e,i),o===void 0?n:{...n,baseline:xt(o,i)}}async function Kr(e,t,n,r,i){try{await pe(e,t,n,r,i)}catch{}}function Vr(e,t,n,r){if(e.subcommand!=="slack")return;let i=new Set(t.assembly.details.filter(u=>r(u.status)).map(u=>u.id)),o=t.assembly.graph,s=new ke(o.nodes().filter(u=>!i.has(u)),o.edges().filter(u=>!i.has(u.source)&&!i.has(u.target)),o.registry()),c=ut(s,n.filter(u=>!i.has(u.id)),{now:Ae(),limit:t.limit}),{rows:a,residuals:d,overcommitted:l,...f}=c;e.deadline_schedule={population:"active",...f,...t.summary?{}:{rows:a,residuals:d,overcommitted:l}}}async function ro(e,t,n,r,i){let o=Cr(e,t,n);De(r.summary===!0,r.full===!0,"--summary");let s=Ee(process.cwd(),i.path);await Pe(s);let c=await je(s),a=xe(c,Ce()),d=await Le(s,c.item_format,a.type_to_folder,void 0,c.schema),l=Se(c.schema),f=qt=>Oe(qt,l);Br(o,r);let u=Fe(),g=ze(r.kind,u),h=qe().lookup(s,$e(d,f,u),()=>Ge(d,f,u)),m=Sr(o,h.assembly,g,r);if(o==="index")return Mt(await zr(s,h.fingerprint,m,d.length,f,r),!1);let b=Ft.has(o)?Lt(m.assembly,t):void 0,v=o==="paths"?Lt(m.assembly,n):void 0,p=Gt(o,b,v,m),_=await he(s,h.fingerprint),E=_.results[p],S=h.memoize(p,()=>E!==void 0?structuredClone(E):$t(o,b,v,m,f)),ve=_e(d.length,_.exists);!S.reused&&E===void 0&&ve&&await Kr(s,h.fingerprint,_,p,S.value);let ne=S.value.subcommand==="audit"?await Hr(s,h.fingerprint,S.value,m.saveBaseline):S.value;return ne.cache={fingerprint:h.fingerprint.slice(0,12),assembly:h.assemblyReused?"hit":"miss",result:S.reused?"hit":"miss",durable:E!==void 0?"hit":ve?"miss":"off"},Vr(ne,m,d,f),Mt(ne,m.summary,"result_rows")}export{B as a,U as b,Ye as c,Xr as d,Qe as e,Ze as f,et as g,tt as h,nt as i,V as j,it as k,T as l,ot as m,dt as n,X as o,lt as p,ut as q,tr as r,It as s,Z as t,ue as u,ee as v,xt as w,St as x,fe as y,F as z,Dt as A,he as B,pe as C,me as D,Tt as E,_e as F,At as G,Rt as H,jt as I,Cr as J,ro as K};
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{Ab as Le,Sa as je,Tb as Fe,U as Oe,Ua as Me,cc as G,dc as Ge,ec as $e,gc as qe,jc as $,kc as Ue,lc as Be,mc as ze,vb as Pe}from"./chunk-6OXJVE74.js";import{n as Se}from"./chunk-4A4DO5ZT.js";import{$ as w,Jc as Ce,Nb as I,Sa as xe,Td as Ae,Ya as Ee,_c as De,aa as k,ae as Re,cd as Te,dd as oe,fc as ie,gd as Ne,ka as we,pa as ke,va as j,wa as re,ya as Ie}from"./chunk-MRH4A542.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="b3394526-5a20-5881-9a03-411ada32bd49")}catch{}})();function Ut(e,t,n,r,i,o){if(e.seen.has(t))return"skip";if(e.cursorFound&&e.affected.length>=o)return"truncate";e.seen.add(t),e.parents.set(t,n.id);let s=n.depth+1;return e.queue.push({id:t,depth:s}),e.cursorFound?(e.affected.push({id:t,distance:s,path:Yt(r,t,e.parents)}),"continue"):(e.cursorFound=t===i,"skip")}function Ke(e,t,n,r){let i=Te("graph impact",{root:e,direction:n,kinds:[...t.kinds??[]].sort(),max_depth:Number.isFinite(r)?r:"unbounded"});return{fingerprint:i,after:t.after===void 0?void 0:Ne(t.after,i)}}function C(e,t,n){e.get(t).add(n)}function M(e){return new Map(e.map(t=>[t,new Set]))}function Ve(e){for(let t of e)t.sort();return e.sort((t,n)=>n.length-t.length||t[0].localeCompare(n[0]))}function q(e){if(Array.isArray(e))return e.map(n=>q(n));if(e===null||typeof e!="object")return e;let t=e.toJSON;return typeof t=="function"?q(t.call(e)):Object.fromEntries(Object.entries(e).sort(([n],[r])=>n.localeCompare(r)).map(([n,r])=>[n,q(r)]))}function He(e){return JSON.stringify(q(e))}function Bt(e,t,n,r){let i=[{id:e,expanded:!1}];for(;i.length>0;){let o=i.pop();if(o.expanded){r.push(o.id);continue}if(n.has(o.id))continue;n.add(o.id),i.push({id:o.id,expanded:!0});let s=[...t.get(o.id)].sort().reverse();for(let c of s)n.has(c)||i.push({id:c,expanded:!1})}}function zt(e,t){let n=new Set,r=[];for(let i of e)n.has(i)||Bt(i,t,n,r);return r}function Ht(e,t){let n=new Set,r=[];for(let i of[...e].reverse()){if(n.has(i))continue;let o=[],s=[i];for(n.add(i);s.length>0;){let c=s.pop();o.push(c);for(let a of t.get(c))n.has(a)||(n.add(a),s.push(a))}r.push(o)}return Ve(r)}function We(e,t){let n=M(e);for(let[r,i]of t)for(let o of i)C(n,o,r);return Ht(zt(e,t),n)}function Kt(e,t){let n=M(e.nodes());for(let r of e.edges()){let i=t.require(r.kind);if(!i.ordering)continue;let o=(i.precedence??"source_before_target")==="source_before_target";C(n,o?r.source:r.target,o?r.target:r.source)}return n}function Vt(e,t){let n=new Map(e.map(o=>[o,0]));for(let o of t.values())for(let s of o)n.set(s,n.get(s)+1);let r=e.filter(o=>n.get(o)===0).sort(),i=[];for(;r.length>0;){i.push(r);let o=[];for(let s of r)for(let c of t.get(s)){let a=n.get(c)-1;n.set(c,a),a===0&&o.push(c)}r=o.sort()}return i}function Wt(e,t){let n=new Map(e.map(s=>[s,0])),r=new Map;for(let s of e)for(let c of t.get(s)){if(!n.has(c))continue;let a=n.get(s)+1,d=r.get(c);(a>n.get(c)||a===n.get(c)&&(d===void 0||s.localeCompare(d)<0))&&(n.set(c,a),r.set(c,s))}let i=[...e].sort((s,c)=>n.get(c)-n.get(s)||s.localeCompare(c))[0],o=i===void 0?[]:[i];for(;o[0]!==void 0&&r.has(o[0]);)o.unshift(r.get(o[0]));return{depth:Object.fromEntries(n),path:o}}function Yt(e,t,n){let r=[t],i=t;for(;i!==e;)i=n.get(i),r.push(i);return r.reverse()}function B(e,t={}){let n=t.registry??we(),r=[...e.nodes()],i=Kt(e,n),o=Vt(r,i),s=o.flat(),c=s.length===r.length,a=c?[]:We(r,i).filter(l=>l.length>1||i.get(l[0]).has(l[0])),d=Wt(s,i);return{exact:!0,acyclic:c,order:s,layers:o,frontier:o[0]??[],depth:d.depth,criticalPath:d.path,criticalPathLength:Math.max(0,d.path.length-1),cycles:a,provenance:{algorithm:"kahn-longest-path",edgeFamily:"ordering"}}}function Xt(e,t,n){let r=M(e.nodes()),i=n===void 0?void 0:new Set(n.map(s=>e.registry().require(s).kind)),o=e.edges();for(let s of o){let c=e.registry().require(s.kind);i!==void 0&&!i.has(s.kind)&&(c.inverse===void 0||!i.has(c.inverse))||C(r,t==="incoming"?s.target:s.source,t==="incoming"?s.source:s.target)}return{adjacency:r,inspectedEdges:o.length}}function Jt(e,t,n,r,i,o){let s=U(e,t,{...n,after:void 0,direction:"incoming",limit:void 0}),c=U(e,t,{...n,after:void 0,direction:"outgoing",limit:void 0}),a=new Map,d=[...s.affected,...c.affected].sort((h,m)=>h.distance-m.distance||h.id.localeCompare(m.id)||h.path.join("\0").localeCompare(m.path.join("\0")));for(let h of d)a.has(h.id)||a.set(h.id,h);let l=[...a.values()].sort((h,m)=>h.distance-m.distance||h.id.localeCompare(m.id)),f=r===void 0||r===t?-1:l.findIndex(h=>h.id===r);if(r!==void 0&&r!==t&&f<0)throw new TypeError(`Unknown impact cursor item: ${r}`);let u=l.slice(f+1,f+1+i),g=f+1+u.length<l.length;return{root:t,affected:u,exact:!0,truncated:s.truncated||c.truncated||g,...g?{nextCursor:oe(o,u.at(-1)?.id??t)}:{},cost:{visitedNodes:s.cost.visitedNodes+c.cost.visitedNodes,inspectedEdges:s.cost.inspectedEdges+c.cost.inspectedEdges}}}function Qt(e,t,n){let r=n.direction,i=n.maxDepth??Number.POSITIVE_INFINITY,o=n.limit??Number.POSITIVE_INFINITY,{fingerprint:s,after:c}=Ke(t,n,r,i),{adjacency:a,inspectedEdges:d}=Xt(e,r,n.kinds),l={queue:[{id:t,depth:0}],seen:new Set([t]),parents:new Map,affected:[],cursorFound:c===void 0||c===t},f=0,u=!1,g=!1;e:for(let h=0;h<l.queue.length;h+=1){n.signal?.throwIfAborted();let m=l.queue[h];f+=1;let b=[...a.get(m.id)].sort();if(m.depth>=i){b.some(v=>!l.seen.has(v))&&(u=!0);continue}for(let v of b)if(Ut(l,v,m,t,c,o)==="truncate"){u=!0,g=!0;break e}}if(!l.cursorFound)throw new TypeError(`Unknown impact cursor item: ${c}`);return{root:t,affected:l.affected,exact:!0,truncated:u,...g?{nextCursor:oe(s,l.affected.at(-1)?.id??t)}:{},cost:{visitedNodes:f,inspectedEdges:d}}}function U(e,t,n={}){let r=n.direction??"outgoing";if(r!=="both")return Qt(e,t,{...n,direction:r});let i=n.maxDepth??Number.POSITIVE_INFINITY,o=n.limit??Number.POSITIVE_INFINITY,{fingerprint:s,after:c}=Ke(t,n,r,i);return Jt(e,t,n,c,o,s)}function Ye(e){let t=[...e.nodes()],n=M(t),r=M(t);for(let a of e.edges())C(n,a.source,a.target),C(n,a.target,a.source),C(r,a.source,a.target);let i=[],o=new Set;for(let a of t){if(o.has(a))continue;let d=[],l=[a];for(o.add(a);l.length>0;){let f=l.pop();d.push(f);for(let u of n.get(f))o.has(u)||(o.add(u),l.push(u))}i.push(d)}let s=t.map(a=>({id:a,degree:n.get(a).size})),c=Math.max(0,...s.map(({degree:a})=>a));return{components:Ve(i),stronglyConnected:We(t,r),orphans:s.filter(({degree:a})=>a===0).map(({id:a})=>a),hubs:s.filter(({degree:a})=>a>0&&a===c),exact:!0,provenance:{algorithm:"component-degree",edgeFamily:"all"}}}function Xr(e,t){let n=new Map(e.edges.map(i=>[He(i),i])),r=new Map(t.edges.map(i=>[He(i),i]));return{fromVersion:e.version,toVersion:t.version,added:[...r].filter(([i])=>!n.has(i)).map(([,i])=>i),removed:[...n].filter(([i])=>!r.has(i)).map(([,i])=>i),unchangedCount:[...n.keys()].filter(i=>r.has(i)).length,exact:!0}}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="2ca317ff-f6b3-5f36-acc4-cd740b3d65e3")}catch{}})();var Zt=I.paths,en=I.visited_paths,tn=I.path_depth;function se(e,t){if(!Number.isFinite(t)||!Number.isInteger(t)||t<0)throw new TypeError(`Invalid path ${e} bound: ${String(t)}`)}function z(e,t){return t.hierarchyDirection==="target_parent"?e.target:e.source}function P(e,t){return(t.precedence??"source_before_target")==="target_before_source"?e.target:e.source}function D(e,t){let n=P(e,t);return{predecessor:n,successor:n===e.source?e.target:e.source}}function nn(e,t,n){if(t===void 0)return;let r=e.registry(),i=new Set;for(let o of t){let s=r.require(o),c=s.traversal;if(c==="association")throw new TypeError(`Relationship kind ${s.kind} uses association traversal; use graph impact --direction both`);if(c!==n&&c!=="semantic"){let a=c==="hierarchy"?"graph ancestors or graph descendants":"graph predecessors or graph successors";throw new TypeError(`Relationship kind ${s.kind} uses ${c} traversal; use ${a}`)}i.add(s.kind)}return i}function rn(e,t,n,r,i){let o=e.registry(),s=e.neighborEdges(t,{direction:"both",...n===void 0?{}:{kinds:[...n]}}),c=[],a=new Set;for(let d of s.value){let l=o.require(d.edge.kind);n===void 0&&!l[r]||i(d,l,t)&&(a.has(d.id)||(a.add(d.id),c.push(d.id)))}return{neighbors:c,inspectedEdges:s.meta.inspectedEdges}}function on(e,t,n,r,i,o){if(t>=n)return e.neighbors.some(s=>!o.seen.has(s))&&(o.truncated=!0),!1;for(let s of e.neighbors)if(!o.seen.has(s)){if(o.seen.add(s),o.queue.push({id:s,depth:t+1}),!o.resumed){s===i&&(o.resumed=!0);continue}if(o.value.length>=r)return o.truncated=!0,!0;o.value.push(s)}return!1}function H(e,t,n,r,i){if(!e.hasNode(t))throw new TypeError(`Relationship node not found: ${t}`);let o=nn(e,n.kinds,r),s=n.limit??Number.POSITIVE_INFINITY,c=n.maxDepth??Number.POSITIVE_INFINITY,a=n.after,d={seen:new Set([t]),value:[],queue:[{id:t,depth:0}],resumed:a===void 0,truncated:!1},l=0,f=0;for(let u=0;u<d.queue.length;u+=1){n.signal?.throwIfAborted();let g=d.queue[u];l+=1;let h=rn(e,g.id,o,r,i);if(f+=h.inspectedEdges,on(h,g.depth,c,s,a,d))break}if(!d.resumed)throw new TypeError(`Traversal cursor not found in sequence: ${a}`);return{value:d.value,meta:{visitedNodes:l,inspectedEdges:f,truncated:d.truncated,nextCursor:d.value.at(-1)}}}function Xe(e,t){if(!e.hasNode(t))throw new TypeError(`Relationship node not found: ${t}`)}function Je(e,t,n,r,i){let o=e.neighborEdges(t.nodes.at(-1),{direction:r,...n.kinds===void 0?{}:{kinds:n.kinds}});return i.inspectedEdges+=o.meta.inspectedEdges,o.value.filter(s=>!t.nodeSet.has(s.id))}function sn(e,t,n,r,i,o,s){for(let c of Je(e,t,r,i,s)){let a=[...t.nodes,c.id],d=new Set(t.nodeSet).add(c.id),l=[...t.edges,c.edge];if(c.id===n){if(s.value.push({nodes:a,edges:l,length:l.length}),s.value.length>=o)return!0}else s.queue.push({nodes:a,nodeSet:d,edges:l})}return!1}function Qe(e,t,n={}){return H(e,t,n,"hierarchy",(r,i)=>z(r.edge,i)===r.id)}function Ze(e,t,n={}){return H(e,t,n,"hierarchy",(r,i,o)=>z(r.edge,i)===o)}function et(e,t,n={}){return H(e,t,n,"ordering",(r,i)=>P(r.edge,i)===r.id)}function tt(e,t,n={}){return H(e,t,n,"ordering",(r,i,o)=>P(r.edge,i)===o)}function cn(e,t,n,r,i,o,s,c){let a={value:[],queue:[{nodes:[t],nodeSet:new Set([t]),edges:[]}],inspectedEdges:0},d=0,l=!1,f=i+1;for(let u=0;u<a.queue.length;u+=1){if(r.signal?.throwIfAborted(),a.value.length>=f||d>=o){l=!0;break}let g=a.queue[u];if(d+=1,g.edges.length>=s){Je(e,g,r,c,a).length>0&&(l=!0);continue}if(sn(e,g,n,r,c,f,a)){l=!0;break}}return{value:a.value.slice(0,i),meta:{visitedNodes:d,inspectedEdges:a.inspectedEdges,truncated:l}}}function nt(e,t,n,r={}){Xe(e,t),Xe(e,n);let i=r.maxPaths??Zt,o=r.maxVisitedPaths??en,s=r.maxDepth??tn;se("maxPaths",i),se("maxVisitedPaths",o),se("maxDepth",s);let c=r.direction??"outgoing";r.signal?.throwIfAborted();for(let a of r.kinds??[])e.registry().require(a);return t===n?i===0?{value:[],meta:{visitedNodes:1,inspectedEdges:0,truncated:!0}}:{value:[{nodes:[t],edges:[],length:0}],meta:{visitedNodes:1,inspectedEdges:0,truncated:!1}}:cn(e,t,n,r,i,o,s,c)}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="2ea07760-bca8-579d-9b3a-78051461485a")}catch{}})();var an=16,dn=2,ln=8;function K(e,t){if(!Number.isInteger(t)||t<1)throw new TypeError(`Invalid ${e} bound: ${String(t)}`)}function V(e,t,n){let r=e.registry(),i=t===void 0?void 0:new Set(t.map(o=>r.require(o).kind));for(let o of e.edges()){if(o.source===o.target)continue;let s=r.require(o.kind);i!==void 0&&!(i.has(s.kind)||s.inverse!==void 0&&i.has(s.inverse))||n(o,s)}}function un(e,t){let n=new Map;V(e,t,r=>{rt(n,r.source,r.target),rt(n,r.target,r.source)});for(let r of n.values())r.sort();return n}function rt(e,t,n){let r=e.get(t);r===void 0?e.set(t,[n]):r.push(n)}function fn(e,t){let n=new Map;for(let o of e){let s=t.get(o);n.set(s,(n.get(s)??0)+1)}let r,i=0;for(let[o,s]of n)(s>i||s===i&&o<r)&&(r=o,i=s);return r}function gn(e,t){let n=new Map;for(let[i,o]of e){let s=n.get(o);s===void 0?n.set(o,[i]):s.push(i)}let r=[];for(let i of n.values())i.length<t||(i.sort(),r.push({representative:i[0],size:i.length,members:i}));return r.sort((i,o)=>o.size-i.size||i.representative.localeCompare(o.representative))}function it(e,t={}){let n=t.maxIterations??an,r=t.minSize??dn;K("maxIterations",n),K("minSize",r);let i=un(e,t.kinds),o=e.nodes(),s=new Map(o.map(f=>[f,f])),c=0,a=!1,d=0,l=0;for(;c<n&&!a;){t.signal?.throwIfAborted(),c+=1,a=!0;for(let f of o){d+=1;let u=i.get(f);if(u===void 0)continue;l+=u.length;let g=fn(u,s);g!==s.get(f)&&(s.set(f,g),a=!1)}}return{value:{communities:gn(s,r),iterations:c,converged:a},meta:{visitedNodes:d,inspectedEdges:l,truncated:!a}}}function W(e){return e.direction==="directed"&&(e.ordering||e.hierarchy)}function Y(e){return e.inverse!==void 0&&e.inverse<e.kind?e.inverse:e.kind}function ce(e,t){return(t.hierarchy?z(e,t):e.source===P(e,t)?e.target:e.source)===e.target?{from:e.source,to:e.target}:{from:e.target,to:e.source}}function hn(e,t){if(t===void 0)return;let n=e.registry(),r=new Set;for(let i of t){let o=n.require(i);if(!W(o))throw new TypeError(`Relationship kind ${o.kind} is not a directed ordering or hierarchy kind`);r.add(Y(o))}return r}function pn(e,t){let n=e.registry(),r=new Map;for(let i of e.edges()){let o=n.require(i.kind);if(!W(o))continue;let s=Y(o);if(t!==void 0&&!t.has(s))continue;let c=ce(i,o);if(c.from===c.to)continue;let a=r.get(s);a===void 0&&(a={adjacency:new Map,records:[]},r.set(s,a));let d=a.adjacency.get(c.from);d===void 0?a.adjacency.set(c.from,new Set([c.to])):d.add(c.to),a.records.push({...c,edge:i})}return r}function mn(e){let t=new Map;for(let[n,r]of e.adjacency)t.set(n,[...r].sort());return t}function _n(e,t,n,r){let i=[r];for(let o=n;o!==t;o=e.get(o))i.push(o);return i.push(t),i.reverse()}function yn(e,t,n,r,i,o){for(let s of e.get(n.id)??[])if(o.inspectedEdges+=1,!(n.depth===0&&s===t.to)&&!r.has(s)){if(r.set(s,n.id),s===t.to)return _n(r,t.from,n.id,s);i.push({id:s,depth:n.depth+1})}}function bn(e,t,n,r){let i=new Map([[t.from,t.from]]),o=[{id:t.from,depth:0}];for(let s=0;s<o.length;s+=1){let c=o[s];if(r.visitedNodes+=1,c.depth>=n)continue;let a=yn(e,t,c,i,o,r);if(a!==void 0)return a}}function T(e,t={}){let n=t.maxDepth??ln;K("maxDepth",n),t.limit!==void 0&&K("limit",t.limit);let r=t.limit??Number.POSITIVE_INFINITY,i=hn(e,t.kinds),o=pn(e,i),s=[],c={visitedNodes:0,inspectedEdges:0},a=!1;e:for(let d of[...o.keys()].sort()){let l=o.get(d),f=mn(l);for(let u of l.records){t.signal?.throwIfAborted();let g=bn(f,u,n,c);if(g!==void 0){if(s.length>=r){a=!0;break e}s.push({edge:u.edge,witness:g})}}}return{value:s,meta:{visitedNodes:c.visitedNodes,inspectedEdges:c.inspectedEdges,truncated:a}}}function vn(e,t,n,r,i){let o=new Set,s=[];for(let c of n){if(c.id===e||o.has(c.id))continue;if(!i.seen.has(c.id)){if(t>=r){i.truncated=!0;continue}i.seen.add(c.id),i.queue.push({id:c.id,depth:t+1})}o.add(c.id),s.push(c.id);let a=i.predecessors.get(c.id);a===void 0&&(a=new Set,i.predecessors.set(c.id,a)),a.add(e)}return s}function wn(e,t,n){let r=n.direction??"outgoing",i=n.maxDepth??Number.POSITIVE_INFINITY,o=[],s=new Map,c={seen:new Set([t]),queue:[{id:t,depth:0}],predecessors:new Map,truncated:!1},a=0;for(let d=0;d<c.queue.length;d+=1){n.signal?.throwIfAborted();let{id:l,depth:f}=c.queue[d];o.push(l);let u=e.neighborEdges(l,{direction:r,...n.kinds===void 0?{}:{kinds:n.kinds}});a+=u.meta.inspectedEdges,s.set(l,vn(l,f,u.value,i,c))}return{order:o,successors:s,predecessors:c.predecessors,inspectedEdges:a,truncated:c.truncated}}function kn(e,t){let n=[],r=new Set([t]),i=[{id:t,index:0}];for(;i.length>0;){let o=i.at(-1),s=e.successors.get(o.id);if(o.index<s.length){let c=s[o.index];o.index+=1,r.has(c)||(r.add(c),i.push({id:c,index:0}))}else n.push(o.id),i.pop()}return n.reverse()}function In(e,t,n,r){let i=e,o=t;for(;i!==o;){for(;r.get(i)>r.get(o);)i=n.get(i);for(;r.get(o)>r.get(i);)o=n.get(o)}return i}function xn(e,t,n){let r;for(let i of[...e].sort())t.has(i)&&(r=r===void 0?i:In(r,i,t,n));return r}function En(e,t,n,r,i){let o=new Map([[t,t]]),s=!0;for(;s;){s=!1;for(let c of n){if(i?.throwIfAborted(),c===t)continue;let a=xn(e.predecessors.get(c),o,r);a!==void 0&&o.get(c)!==a&&(o.set(c,a),s=!0)}}return o}function ot(e,t,n={}){if(!e.hasNode(t))throw new TypeError(`Relationship node not found: ${t}`);if(n.maxDepth!==void 0&&(!Number.isInteger(n.maxDepth)||n.maxDepth<0))throw new TypeError(`Invalid maxDepth bound: ${String(n.maxDepth)}`);let r=wn(e,t,n),i=kn(r,t),o=new Map(i.map((d,l)=>[d,l])),s=En(r,t,i,o,n.signal),c=new Map(i.map(d=>[d,1]));for(let d=i.length-1;d>=0;d-=1){let l=i[d];if(l===t)continue;let f=s.get(l);c.set(f,c.get(f)+c.get(l))}let a=i.filter(d=>d!==t).map(d=>({id:d,idom:s.get(d),dominatedCount:c.get(d)-1})).sort((d,l)=>l.dominatedCount-d.dominatedCount||d.id.localeCompare(l.id));return{value:{root:t,reachableCount:r.order.length,rows:a},meta:{visitedNodes:r.order.length,inspectedEdges:r.inspectedEdges,truncated:r.truncated}}}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="aa8e4dc3-250e-50eb-b770-a11cbab6ebc3")}catch{}})();function st(e){return Math.round(e*1e6)/1e6}function ct(e,t,n){let r=e.get(t);r===void 0?e.set(t,new Set([n])):r.add(n)}function at(e,t){let n=new Map(e.nodes().map(i=>[i,new Set]));V(e,t,i=>{n.get(i.source).add(i.target),n.get(i.target).add(i.source)});let r=new Map;for(let[i,o]of n)r.set(i,[...o].sort());return r}function Sn(e,t){let n=new Map,r=new Map;return V(e,t,(i,o)=>{if(!o.ordering)return;let{predecessor:s,successor:c}=D(i,o);ct(r,s,c),ct(n,c,s)}),{incoming:n,outgoing:r}}function Cn(e,t,n){let r=new Map([[e,0]]),i=new Map([[e,1]]),o=new Map,s=[],c=[e],a=0,d=0;for(let l=0;l<c.length;l+=1){let f=c[l];n.visitedNodes+=1,s.push(f);let u=r.get(f);f!==e&&(a+=1,d+=u);for(let g of t.get(f))if(n.inspectedEdges+=1,r.has(g)||(r.set(g,u+1),c.push(g)),r.get(g)===u+1){i.set(g,(i.get(g)??0)+i.get(f));let h=o.get(g);h===void 0?o.set(g,[f]):h.push(f)}}return{stack:s,sigma:i,predecessors:o,reachableCount:a,distanceSum:d}}function Dn(e,t,n){let r=new Map;for(let i=e.stack.length-1;i>=0;i-=1){let o=e.stack[i],s=(1+(r.get(o)??0))/e.sigma.get(o);for(let c of e.predecessors.get(o)??[])r.set(c,(r.get(c)??0)+e.sigma.get(c)*s);o!==t&&n.set(o,(n.get(o)??0)+(r.get(o)??0))}}function Tn(e,t){return t<=1||e.reachableCount===0?0:e.reachableCount/(t-1)*(e.reachableCount/e.distanceSum)}function Nn(e,t,n,r,i){return{id:e,degree:t.get(e).length,inDegree:n.incoming.get(e)?.size??0,outDegree:n.outgoing.get(e)?.size??0,betweenness:st((r.get(e)??0)/2),closeness:st(i.get(e))}}function dt(e,t={}){let n=at(e,t.kinds),r=Sn(e,t.kinds),i=e.nodes(),o=new Map,s=new Map,c={visitedNodes:0,inspectedEdges:0};for(let l of i){t.signal?.throwIfAborted();let f=Cn(l,n,c);s.set(l,Tn(f,i.length)),Dn(f,l,o)}let a=0;for(let l of n.values())a+=l.length;let d=i.map(l=>Nn(l,n,r,o,s)).sort((l,f)=>f.betweenness-l.betweenness||f.degree-l.degree||l.id.localeCompare(f.id));return{value:{nodeCount:i.length,edgeCount:a/2,rows:d},meta:{visitedNodes:c.visitedNodes,inspectedEdges:c.inspectedEdges,truncated:!1}}}function An(e,t){return e<=t?{source:e,target:t}:{source:t,target:e}}function Rn(e,t,n){let i=t.get(e.node)[e.neighborIndex];if(e.neighborIndex+=1,n.inspectedEdges+=1,i!==e.parent){if(n.discovery.has(i)){n.low.set(e.node,Math.min(n.low.get(e.node),n.discovery.get(i)));return}return e.children+=1,n.discovery.set(i,n.timer),n.low.set(i,n.timer),n.timer+=1,{node:i,parent:e.node,neighborIndex:0,children:0}}}function On(e,t,n){if(e.parent===null){e.children>1&&n.articulation.add(e.node);return}let r=e.parent,i=n.low.get(e.node);n.low.set(r,Math.min(n.low.get(r),i)),r!==t&&i>=n.discovery.get(r)&&n.articulation.add(r),i>n.discovery.get(r)&&n.bridges.push(An(r,e.node))}function jn(e,t,n,r){n.discovery.set(e,n.timer),n.low.set(e,n.timer),n.timer+=1;let i=[{node:e,parent:null,neighborIndex:0,children:0}];for(;i.length>0;){r?.throwIfAborted();let o=i.at(-1);if(o.neighborIndex<t.get(o.node).length){let s=Rn(o,t,n);s!==void 0&&i.push(s)}else On(o,e,n),i.pop()}}function X(e,t={}){let n=at(e,t.kinds),r={discovery:new Map,low:new Map,timer:0,articulation:new Set,bridges:[],inspectedEdges:0};for(let i of e.nodes())r.discovery.has(i)||jn(i,n,r,t.signal);return{value:{articulationPoints:[...r.articulation].sort(),bridges:r.bridges.sort((i,o)=>i.source.localeCompare(o.source)||i.target.localeCompare(o.target))},meta:{visitedNodes:r.discovery.size,inspectedEdges:r.inspectedEdges,truncated:!1}}}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="1c9d9d0c-e989-568c-a49a-202f77e94806")}catch{}})();function Mn(e){let t=e.registry(),n=new Map,r=new Set;for(let i of e.edges()){let o=t.require(i.kind);if(!o.ordering)continue;let{predecessor:s,successor:c}=D(i,o);if(r.add(s),r.add(c),s===c)continue;let a=n.get(s);a===void 0?n.set(s,new Set([c])):a.add(c)}return{forward:n,participants:r}}function Pn(e,t,n,r){if(e===void 0)return r;let i=r;for(let o of e)t.has(o)&&(i=Math.min(i,n.get(o)));return i}function Ln(e,t,n){let r=n-t;return{id:e,earliestStart:t,earliestFinish:t+1,latestStart:n,latestFinish:n+1,slack:r,critical:r===0}}function Fn(e,t,n,r,i){let o=new Map;for(let s=e.length-1;s>=0;s-=1){let c=e[s],a=Pn(t.forward.get(c),r,o,i);o.set(c,a-1)}return e.map(s=>Ln(s,n[s],o.get(s))).sort((s,c)=>s.slack-c.slack||s.earliestStart-c.earliestStart||s.id.localeCompare(c.id))}function lt(e,t={}){t.signal?.throwIfAborted();let n=B(e,{registry:e.registry()}),r=Mn(e),i=new Set(n.order),o=n.order.filter(d=>r.participants.has(d)),s=o.reduce((d,l)=>Math.max(d,n.depth[l]+1),0),c=Fn(o,r,n.depth,i,s),a=c.length>0;return{exact:!0,acyclic:n.acyclic,makespan:s,scheduledCount:c.length,criticalPath:a?n.criticalPath:[],criticalPathLength:a?n.criticalPathLength:0,cycles:n.cycles,rows:c,provenance:{algorithm:"critical-path-method",edgeFamily:"ordering",weighting:"unit"}}}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="6b2a7206-d480-51c1-9d46-4271bde24fa3")}catch{}})();function Gn(e,t,n){for(let r=e.length-1;r>=0;r-=1){n?.throwIfAborted();let i=t.get(e[r]);for(let o of i.successors){n?.throwIfAborted();let s=t.get(o);if(s.latest===void 0||s.duration===void 0)continue;let c=s.latest-s.duration;(i.latest===void 0||c<i.latest)&&(i.latest=c,i.anchor=s.anchor)}}}function $n(e,t,n,r){let i=[],o=e;for(;o!==void 0&&i.length<n;)r?.throwIfAborted(),i.push(o),o=t.get(o).predecessor;return i.reverse(),{path:i,path_truncated:o!==void 0}}function qn(e,t,n,r,i){let o=new Map(t.map(c=>[c.id,c])),s=new Map;for(let c of e){i?.throwIfAborted();let a=o.get(c),d=a?.estimated_minutes,l=typeof d=="number"&&Number.isFinite(d)&&d>=0?d:void 0,f={item:a,duration:l,pending:0,successors:new Set,earliest:0};if(a?.deadline!==void 0){let u=Date.parse(a.deadline);Number.isFinite(u)?(f.deadline=(u-n)/6e4,f.latest=f.deadline,f.anchor=c):r(c,"invalid_deadline")}s.set(c,f)}return s}function Un(e,t,n){for(let r of e.edges()){n?.throwIfAborted();let i=e.registry().require(r.kind);if(!i.ordering)continue;let{predecessor:o,successor:s}=D(r,i),c=t.get(o);c.successors.has(s)||(c.successors.add(s),t.get(s).pending+=1)}}function Bn(e,t,n){let r=e.filter(i=>t.get(i).pending===0);for(let i=0;i<r.length;i+=1){n?.throwIfAborted();let o=r[i],s=t.get(o),c=s.earliest===null||s.duration===void 0?null:s.earliest+s.duration;for(let a of s.successors){n?.throwIfAborted();let d=t.get(a);c===null?d.earliest=null:d.earliest!==null&&(c>d.earliest||c===d.earliest&&(d.predecessor===void 0||o<d.predecessor))&&(d.earliest=c,d.predecessor=o),d.pending-=1,d.pending===0&&r.push(a)}}return r}function zn(e,t,n,r,i,o,s,c){let a=t.duration;if(t.latest!==void 0){r.scheduled_count+=1;let d=t.latest-a;r.rows.length<o?r.rows.push({id:e,deadline_id:t.anchor,latest_start:new Date(i+d*6e4).toISOString(),slack_minutes:t.earliest===null?null:d-t.earliest}):r.truncated=!0}if(t.deadline!==void 0&&t.earliest!==null&&t.earliest+a>t.deadline)if(r.overcommitted_count+=1,r.overcommitted.length<o){let d=$n(e,n,Math.min(o,s.remaining),c);s.remaining-=d.path.length,d.path_truncated&&(r.truncated=!0),r.overcommitted.push({deadline_id:e,deadline:t.item.deadline,shortfall_minutes:t.earliest+a-t.deadline,...d})}else r.truncated=!0}function Hn(e,t,n,r,i,o,s,c){let a={remaining:o};for(let d of e){c?.throwIfAborted();let l=t.get(d);if(l.pending>0){s(d,"cycle_or_gated_by_cycle");continue}if(l.duration===void 0){s(d,"unknown_estimate");continue}if(l.latest!==void 0&&!Number.isFinite(new Date(r+(l.latest-l.duration)*6e4).getTime())){s(d,"date_range_exceeded");continue}l.earliest===null&&s(d,"unknown_predecessor_estimate"),zn(d,l,t,n,r,i,a,c)}}function ut(e,t,n={}){n.signal?.throwIfAborted();let r=Date.parse(n.now??new Date().toISOString());if(!Number.isFinite(r))throw new TypeError("Invalid scheduling clock");let i=n.maxWork??1e5,o=n.limit??10;for(let[u,g]of[["maxWork",i],["limit",o]])if(!Number.isSafeInteger(g)||g<1)throw new TypeError(`Invalid scheduling ${u}`);let s={as_of:new Date(r).toISOString(),basis:"derived_elapsed_minutes",complete:!0,truncated:!1,work_limit_exceeded:!1,scheduled_count:0,residual_count:0,overcommitted_count:0,rows:[],residuals:[],overcommitted:[]},c=e.nodes(),a=e.edges();if(c.length+a.length+t.length>i)return{...s,complete:!1,work_limit_exceeded:!0};let d=(u,g)=>{s.complete=!1,s.residual_count+=1,s.residuals.length<o?s.residuals.push({id:u,reason:g}):s.truncated=!0},l=qn(c,t,r,d,n.signal);Un(e,l,n.signal);let f=Bn(c,l,n.signal);return Gn(f,l,n.signal),Hn(c,l,s,r,o,i,d,n.signal),s}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="2bfc4e78-a376-5099-be50-38e339eac660")}catch{}})();function N(){return{nodes:0,isolated:0,degree_leq_one:0,semantic_nodes:0,without_semantic_edges:0,degree_histogram:{}}}function ht(e,t,n,r){let i={all:N(),active:N(),terminal:N()},o=new Map;for(let s of e.details){if(r?.throwIfAborted(),e.missingIdSet.has(s.id.toLowerCase())||s.status==="external")continue;let c=o.get(s.status)??N();o.set(s.status,c);let a=e.graph.incidentEdges(s.id),d=a.some(l=>n(l.kind));for(let l of[i.all,i[t(s.status)?"terminal":"active"],c]){l.nodes+=1,l.isolated+=+(a.length===0),a.length<=1&&(l.degree_leq_one+=1),d?l.semantic_nodes+=1:l.without_semantic_edges+=1;let f=String(a.length);l.degree_histogram[f]=(l.degree_histogram[f]??0)+1}}return{coverage_by_lifecycle:i,coverage_by_status:Object.fromEntries([...o].sort(([s],[c])=>s.localeCompare(c)))}}function ft(e){if(!J(e))return!1;let t=e;if(!["nodes","isolated","degree_leq_one","semantic_nodes","without_semantic_edges"].every(i=>Number.isSafeInteger(t[i])&&Number(t[i])>=0)||!J(t.degree_histogram))return!1;let r=Object.entries(t.degree_histogram);return r.every(([i,o])=>/^(0|[1-9]\d*)$/.test(i)&&Number.isSafeInteger(o)&&Number(o)>=0)&&r.reduce((i,[,o])=>i+Number(o),0)===t.nodes&&Number(t.isolated)<=Number(t.degree_leq_one)&&Number(t.degree_leq_one)<=Number(t.nodes)&&Number(t.semantic_nodes)+Number(t.without_semantic_edges)===t.nodes}function J(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function pt(e){for(let r of["ordering_acyclic","active_ordering_acyclic"])if(e[r]!==void 0&&typeof e[r]!="boolean")return!1;let t=e.coverage_by_lifecycle,n=e.coverage_by_status;return t===void 0&&n===void 0?!0:!J(t)||!J(n)?!1:["all","active","terminal"].every(r=>ft(t[r]))&&Object.values(n).every(ft)}function gt(e,t){return Object.fromEntries([...new Set([...Object.keys(e),...Object.keys(t)])].sort().map(n=>{let r=Object.hasOwn(e,n)?e[n]:N(),i=Object.hasOwn(t,n)?t[n]:N(),o=Object.fromEntries([...new Set([...Object.keys(r.degree_histogram),...Object.keys(i.degree_histogram)])].sort().map(s=>[s,(i.degree_histogram[s]??0)-(r.degree_histogram[s]??0)]));return[n,{nodes:i.nodes-r.nodes,isolated:i.isolated-r.isolated,degree_leq_one:i.degree_leq_one-r.degree_leq_one,semantic_nodes:i.semantic_nodes-r.semantic_nodes,without_semantic_edges:i.without_semantic_edges-r.without_semantic_edges,degree_histogram:o}]}))}function mt(e,t){return!e.coverage_by_lifecycle||!t.coverage_by_lifecycle||!e.coverage_by_status||!t.coverage_by_status?{lifecycle_comparable:!1}:{lifecycle_comparable:!0,coverage_by_lifecycle:gt(e.coverage_by_lifecycle,t.coverage_by_lifecycle),coverage_by_status:gt(e.coverage_by_status,t.coverage_by_status)}}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="896e1553-b127-532f-ac39-e0d47f29eebc")}catch{}})();var A=["missing_reference_active","missing_reference_terminal","legacy_no_blocker_sentinel","ordering_cycle","legacy_ordering_cycle","ordering_storage_contradiction","legacy_ordering_storage_contradiction","hierarchy_cycle","legacy_hierarchy_cycle","hierarchy_cardinality_violation","legacy_hierarchy_cardinality_violation","hierarchy_direction_violation","legacy_hierarchy_direction_violation","duplicate_edge","legacy_duplicate_edge","duplicate_dependency_row","legacy_duplicate_dependency_row","stale_lifecycle_block","isolated_active_node","sparse_active_node"];(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="1335acb2-0730-5934-89a4-14fe4a160288")}catch{}})();var Kn=25,Vn="milestone",Wn="outcome milestone:",Yn=new Set(["discovered_from","incident_from","recurs_from","supersedes","verifies"]);function Q(e){return Yn.has(e)}var _t={error:0,warning:1,info:2};function yt(e){return new Set((e??[]).filter(t=>typeof t=="string").map(t=>t.trim().toLowerCase()))}function R(e,t,n,r,i,o,s,c){let a=[...i].sort((d,l)=>d.localeCompare(l));return{code:e,severity:t,policy:n,message:r(a.length),count:a.length,sample:a.slice(0,o),sample_truncated:a.length>o,remediation:s,...c===void 0?{}:{evidence:[...c].sort((d,l)=>d.localeCompare(l)).slice(0,o)}}}function Xn(e,t){return e.cycles.map(n=>R(n.legacy_terminal?"legacy_hierarchy_cycle":"hierarchy_cycle",n.legacy_terminal?"info":"error","Structural hierarchy must be acyclic across scalar and registered dependency relationships.",r=>`${r} items participate in one hierarchy cycle.`,n.item_ids,t,n.legacy_terminal?"Preserve historical rows unless an explicit legacy repair is approved.":"Remove or retype one exact hierarchy relation before continuing mutation."))}function bt(e,t,n){let r=e.cardinality_violations.filter(i=>i.legacy_terminal===n);return r.length===0?[]:[R(n?"legacy_hierarchy_cardinality_violation":"hierarchy_cardinality_violation",n?"info":"error","Every structural child must resolve to at most one logical parent across all hierarchy spellings.",i=>`${i} child item${i===1?"":"s"} resolve to multiple hierarchy parents.`,r.map(i=>i.child_id),t,n?"Preserve historical rows unless an explicit legacy repair is approved.":"Remove the exact surplus hierarchy rows so each child has one parent.",r.map(i=>`${i.child_id} <- ${i.parent_ids.join(", ")}`))]}function vt(e,t,n){let r=e.divergences.filter(i=>i.legacy_terminal===n);return r.length===0?[]:[R(n?"legacy_hierarchy_direction_violation":"hierarchy_direction_violation",n?"info":"error","Scalar parent metadata and dependency-backed hierarchy rows must resolve to the same logical parent.",i=>`${i} child item${i===1?"":"s"} have divergent hierarchy storage surfaces.`,r.map(i=>i.child_id),t,n?"Preserve historical rows unless an explicit legacy repair is approved.":"Align the scalar parent and exact dependency rows to one canonical parent.",r.map(i=>`${i.child_id}: scalar=${i.scalar_parent_id} dependencies=${i.dependency_parent_ids.join(",")}`))]}function Jn(e,t){let n=G(e);return n?[...Xn(n,t),...bt(n,t,!1),...bt(n,t,!0),...vt(n,t,!1),...vt(n,t,!0)]:[]}function Qn(e){let t=e.graph.registry(),n=new Map;for(let r of e.graph.edges()){let i=t.require(r.kind);if(!i.ordering)continue;let[o,s]=(i.precedence??"source_before_target")==="target_before_source"?[r.target,r.source]:[r.source,r.target],c=n.get(o);c?c.push(s):n.set(o,[s])}for(let r of n.values())r.sort((i,o)=>i.localeCompare(o));return n}function kt(e,t){t.indexes.set(e,t.nextIndex),t.lowLinks.set(e,t.nextIndex),t.nextIndex+=1,t.stack.push(e),t.onStack.add(e)}function Zn(e,t,n,r){let i=n.get(e.node)??[];if(e.neighborIndex>=i.length)return!1;let o=i[e.neighborIndex];return e.neighborIndex+=1,r.indexes.has(o)?r.onStack.has(o)&&r.lowLinks.set(e.node,Math.min(r.lowLinks.get(e.node),r.indexes.get(o))):(kt(o,r),t.push({node:o,neighborIndex:0})),!0}function er(e,t,n,r){t.pop();let i=t.at(-1);if(i&&r.lowLinks.set(i.node,Math.min(r.lowLinks.get(i.node),r.lowLinks.get(e.node))),r.lowLinks.get(e.node)!==r.indexes.get(e.node))return;let o=[];for(;;){let s=r.stack.pop();if(r.onStack.delete(s),o.push(s),s===e.node)break}(o.length>1||o.length===1&&n.get(o[0])?.includes(o[0]))&&r.components.push(o.sort((s,c)=>s.localeCompare(c)))}function tr(e){let t={indexes:new Map,lowLinks:new Map,onStack:new Set,stack:[],components:[],nextIndex:0},n=[...e.keys()].sort((r,i)=>r.localeCompare(i));for(let r of n){if(t.indexes.has(r))continue;let i=[{node:r,neighborIndex:0}];for(kt(r,t);i.length>0;){let o=i.at(-1);Zn(o,i,e,t)||er(o,i,e,t)}}return t.components.sort((r,i)=>r[0].localeCompare(i[0]))}function ae(e){return`${e.holder_id} -> ${e.target_id} (${e.kind})`}function y(e,t,n,r,i,o,s,c){t.length!==0&&e.push(R(r,i,o,s,t,n,c))}function nr(e,t,n){let r=[],i=[...e.dangling.active,...e.dangling.legacy_terminal].filter(o=>!o.no_active_blocker_sentinel);return y(r,i.filter(o=>!t(o.holder_status)).map(ae),n,"missing_reference_active","error","Active items must not reference absent targets; missing prerequisites distort scheduling.",o=>`${o} active dangling reference(s) to absent items`,"Restore or re-create the referenced item, or remove/retype the reference on the holder."),y(r,i.filter(o=>t(o.holder_status)).map(ae),n,"missing_reference_terminal","info","Terminal items may retain historical references, but absent targets remain unexplainable context.",o=>`${o} terminal dangling reference(s) to absent items`,"Leave as history debt or clean up in a dedicated changelog-safe closed-item batch."),y(r,e.dangling.no_active_blocker_sentinels.map(ae),n,"legacy_no_blocker_sentinel","info","The pre-structured-dependency no-active-blocker sentinel is retired; real edges carry blocker state.",o=>`${o} legacy no-active-blocker sentinel reference(s)`,"Delete the sentinel reference; blocker state is derived from blocked_by edges."),r}function le(e,t){let n=t.get(e);return n?!n.terminal:!0}function It(e){return`${e.holder_id} -> ${e.target_id} (blocked_by scalar + ${e.dependency_kind} dependency)`}function rr(e,t){let n=[],r=[];for(let o of e.orderingContradictions??[])(o.legacy_terminal?r:n).push(It(o));let i=[];return y(i,n,t,"ordering_storage_contradiction","error","A scalar blocker and same-target structured ordering row must not assert opposite precedence.",o=>`${o} active scalar-versus-structured ordering contradiction(s)`,"Remove the structured dependency row that points the holder before its scalar blocker, or replace both representations with one unambiguous ordering edge."),y(i,r,t,"legacy_ordering_storage_contradiction","info","Terminal scalar-versus-structured ordering contradictions are exact historical storage defects with no live scheduling effect.",o=>`${o} terminal scalar-versus-structured ordering contradiction(s)`,"Remove the contradictory blocks dependency row in a dedicated changelog-safe closed-item batch; preserve the scalar blocker as the historical precedence record."),i}function ir(e,t,n,r){let i=[],o=Qn(e);for(let a of tr(o)){let d=a.some(u=>le(u,t)),l=new Set(a.map(u=>u.toLowerCase())),f=(e.orderingContradictions??[]).filter(u=>l.has(u.holder_id.toLowerCase())&&l.has(u.target_id.toLowerCase())).map(It);i.push(d?R("ordering_cycle","error","Order-bearing relationship kinds must stay acyclic; a cycle makes every member unschedulable.",u=>`execution-order cycle across ${u} item(s)`,a,r,"Remove or retype one ordering edge inside the cycle, or split the work so precedence is linear.",f.length===0?void 0:f):R("legacy_ordering_cycle","info","Ordering cycles between exclusively terminal items are historical contradictions with no scheduling effect.",u=>`terminal-only execution-order cycle across ${u} item(s)`,a,r,"Leave as history debt, or clean up in a dedicated changelog-safe closed-item batch; never repair closed items ad hoc.",f.length===0?void 0:f))}let s=new Map;for(let[a,d]of o)for(let l of d){let f=s.get(l);f?f.push(a):s.set(l,[a])}let c=[...t.values()].filter(a=>!a.missing&&!a.terminal&&n(a.status)&&!(s.get(a.id)??[]).some(d=>{let l=t.get(d);return l===void 0||!l.terminal})).map(a=>a.id);return y(i,c,r,"stale_lifecycle_block","warning","A blocked lifecycle status must be backed by at least one open ordering predecessor.",a=>`${a} status-blocked item(s) with no open blocker edge`,'Add a local blocker edge, declare an external blocker with --dep "id=<external-ref>,kind=blocked_by,source_kind=external", or move the item back to an active status.'),i}function Z(e){let t=e.edges.map(n=>n.kind).sort((n,r)=>n.localeCompare(r));return`${e.from} -> ${e.to} (${t.join(" + ")})`}function ue(e){let t=e.graph.registry(),n=new Map;for(let i of e.graph.edges()){let o=t.require(i.kind);if(!W(o))continue;let s=ce(i,o);if(s.from===s.to)continue;let c=`${Y(o)}::${s.from}::${s.to}`,a=n.get(c);a?a.edges.push(i):n.set(c,{...s,edges:[i]})}let r=[...n.values()].filter(i=>i.edges.length>=2);for(let i of r)i.edges.sort((o,s)=>o.kind.localeCompare(s.kind));return r.sort((i,o)=>i.from.localeCompare(o.from)||i.to.localeCompare(o.to))}function or(e,t,n){let r=[],i=[];for(let s of ue(e))(le(s.from,t)||le(s.to,t)?r:i).push(Z(s));let o=[];return y(o,r,n,"duplicate_edge","info","One semantic relationship should be stored once; parallel same-family spellings (reciprocal inverse pairs included) add no information and skew degree metrics.",s=>`${s} duplicated relationship(s) between active endpoints`,"Remove all but one stored spelling of the relationship; keep the canonical direction the holder declared first."),y(o,i,n,"legacy_duplicate_edge","info","Duplicated spellings between exclusively terminal items are historical noise with no scheduling effect.",s=>`${s} duplicated relationship(s) between terminal endpoints`,"Leave as history debt or clean up in a dedicated changelog-safe closed-item batch."),o}function sr(e,t){let n=[],r=[];for(let o of e.duplicateRows??[])(o.legacy_terminal?r:n).push(`${o.holder_id} -> ${o.target_id} (${o.kind} x${o.occurrences})`);let i=[];return y(i,n,t,"duplicate_dependency_row","warning","One dependency row must be stored once per holder; identical repeated rows are a storage-layer defect invisible to the assembled graph.",o=>`${o} exactly duplicated stored dependency row(s) on active holder(s)`,"Remove the repeated rows so the dependency is stored exactly once; graph semantics are unchanged."),y(i,r,t,"legacy_duplicate_dependency_row","info","Identical repeated dependency rows on terminal holders are historical storage noise with no scheduling effect.",o=>`${o} exactly duplicated stored dependency row(s) on terminal holder(s)`,"Leave as history debt or clean up in a dedicated changelog-safe closed-item batch."),i}function cr(e,t){let n=new Map,r={source_to_target:[],target_to_source:[],both:[]};for(let s of e.graph.registry().list())s.outcomeTraversal!==void 0&&r[s.outcomeTraversal].push(s.kind);let i={source_to_target:r.source_to_target.join(","),target_to_source:r.target_to_source.join(","),both:r.both.join(",")},o=(s,c)=>{let a=n.get(c)??new Set;a.add(s),n.set(c,a)};for(let s of e.graph.edges()){t?.throwIfAborted();let c=e.graph.registry().require(s.kind);(c.outcomeTraversal==="source_to_target"||c.outcomeTraversal==="both")&&o(s.source,s.target),(c.outcomeTraversal==="target_to_source"||c.outcomeTraversal==="both")&&o(s.target,s.source)}return{basis:i,reverse:n}}function ar(e,t,n){let r=new Set(e),i=[...e].sort();for(let o=0;o<i.length;o+=1){n?.throwIfAborted();for(let s of[...t.get(i[o])??[]].sort())r.has(s)||(r.add(s),i.push(s))}return r}function dr(e,t,n,r){let i=0,o=0,s=0,c=0;for(let g of e.values())if(r?.throwIfAborted(),!t.has(g.id)&&!(g.missing||g.status==="external")){if(g.terminal){s+=1,n.has(g.id)&&(c+=1);continue}n.has(g.id)?i+=1:o+=1}let a=i+o,d=s-c,l=i+c,f=o+d,u=l+f;return{active_outcome_reachable_nodes:i,active_outcome_unreachable_nodes:o,active_outcome_reachability_basis_points:a===0?0:Math.floor(i*1e4/a),terminal_nodes:s,terminal_outcome_reachable_nodes:c,terminal_outcome_unreachable_nodes:d,terminal_outcome_reachability_basis_points:s===0?0:Math.floor(c*1e4/s),outcome_reachable_nodes:l,outcome_unreachable_nodes:f,outcome_reachability_basis_points:u===0?0:Math.floor(l*1e4/u)}}function lr(e,t,n){let r=new Set(e.details.filter(c=>c.type?.toLowerCase()===Vn&&c.title.trim().toLowerCase().startsWith(Wn)).map(c=>c.id)),{basis:i,reverse:o}=cr(e,n),s=ar(r,o,n);return{outcome_nodes:r.size,outcome_reachability_basis:i,...dr(t,r,s,n)}}function ur(e,t,n,r,i){e.active+=1;let o=t.type??"(untyped)",s=e.byType.get(o);s||(s={active:0,isolated:0,degree_leq_one:0},e.byType.set(o,s)),s.active+=1,!(n>1)&&(e.degreeLeqOne+=1,s.degree_leq_one+=1,n===0&&(e.isolated+=1,s.isolated+=1),!(r.has(t.id.toLowerCase())||i.has(o.toLowerCase()))&&(n===0?e.isolates.push(t.id):e.sparse.push(t.id)))}function fr(e,t,n,r,i,o,s){let c={active:0,missing:0,isolated:0,degreeLeqOne:0,isolates:[],sparse:[],byType:new Map};for(let p of e.graph.nodes()){s?.throwIfAborted();let _=t.get(p);if(_){if(_.missing){c.missing+=1;continue}_.terminal||ur(c,_,e.graph.incidentEdges(p).length,n,r)}}let{isolates:a,sparse:d}=c,l=[];y(l,a,i,"isolated_active_node","warning","Active work should be reachable from the graph unless explicitly declared a valid isolate.",p=>`${p} active item(s) with no relationships`,"Link the item to its parent, prerequisite, or origin \u2014 or register it as an exempt isolate."),y(l,d,i,"sparse_active_node","info","Active items with a single edge often miss an honest semantic partner; sparse is not automatically defective.",p=>`${p} active item(s) with exactly one relationship`,"Investigate for an honest second edge (story->task, defect family, cross-epic complement); do not fabricate one.");let f=e.graph.edges().length,u=T(e.graph,{signal:s}).value,g=new Set(u.map(({edge:p})=>`${p.source.toLowerCase()}\0${p.target.toLowerCase()}\0${p.kind}`));for(let p of e.orderingContradictions??[])g.add(`${p.holder_id.toLowerCase()}\0${p.target_id.toLowerCase()}\0${p.dependency_kind}`);let h=Object.fromEntries(Object.entries(o).sort(([p],[_])=>p.localeCompare(_))),m=Object.entries(h).reduce((p,[_,E])=>p+(Q(_)?E:0),0),b=X(e.graph,{signal:s}).value,v=lr(e,t,s);return{findings:l,profile:{nodes:e.graph.nodes().length,recorded_nodes:e.details.filter(p=>p.status!=="missing"&&p.status!=="external").length,edges:f,informative_edges:f-g.size,redundant_edges:u.length,ordering_contradiction_edges:e.orderingContradictions?.length??0,edge_basis:"deduplicated_directed",edges_by_kind:h,edge_share_by_kind:Object.fromEntries(Object.entries(h).map(([p,_])=>[p,_/f])),semantic_edges:m,semantic_edge_share:f===0?0:m/f,active_nodes:c.active,missing_nodes:c.missing,isolated_active_nodes:c.isolated,degree_leq_one_active_nodes:c.degreeLeqOne,coverage_by_type:Object.fromEntries([...c.byType.entries()].sort(([p],[_])=>p<_?-1:1)),articulation_points:b.articulationPoints.length,bridge_edges:b.bridges.length,...v,finding_subjects_by_code:Object.fromEntries(A.map(p=>[p,0]))}}}function ee(e,t={}){let n=t.isTerminal??(u=>u==="closed"||u==="canceled"),r=t.isBlocked??(u=>u==="blocked"),i=t.maxSampleSize??Kn;if(!Number.isInteger(i)||i<1)throw new TypeError(`Invalid audit sample bound: ${String(t.maxSampleSize)}`);let o=yt(t.exemptIsolates),s=yt(t.isolateExemptTypes),c=new Map(e.details.map(u=>[u.id,{id:u.id,status:u.status,missing:e.missingIdSet.has(u.id.toLowerCase()),terminal:n(u.status),...u.type===void 0?{}:{type:u.type}}]));t.signal?.throwIfAborted();let a={};for(let u of e.graph.edges())a[u.kind]=(a[u.kind]??0)+1;let d=nr(e,n,i);d.push(...Jn(e,i)),t.signal?.throwIfAborted(),d.push(...rr(e,i)),t.signal?.throwIfAborted(),d.push(...ir(e,c,r,i)),t.signal?.throwIfAborted(),d.push(...or(e,c,i),...sr(e,i)),t.signal?.throwIfAborted();let l=fr(e,c,o,s,i,a,t.signal);d.push(...l.findings),d.sort((u,g)=>_t[u.severity]-_t[g.severity]||u.code.localeCompare(g.code)||u.sample[0].localeCompare(g.sample[0]));let f=l.profile.finding_subjects_by_code;for(let u of d)f[u.code]+=u.count;return{findings:d,profile:{...l.profile,...ht(e,n,Q,t.signal),ordering_acyclic:!d.some(u=>u.code==="ordering_cycle"||u.code==="legacy_ordering_cycle"),active_ordering_acyclic:!d.some(u=>u.code==="ordering_cycle"),finding_subjects_by_code:f}}}function de(e,t){let n=[...new Set([...Object.keys(e),...Object.keys(t)])].sort(),r={};for(let i of n){let o=(t[i]??0)-(e[i]??0);o!==0&&(r[i]=o)}return r}function wt(e){return e.profile.coverage_by_type??{}}function gr(e,t){let n={},r=wt(e),i=wt(t),o=[...new Set([...Object.keys(r),...Object.keys(i)])].sort();for(let s of o){let c=Object.assign({active:0,isolated:0,degree_leq_one:0},r[s]),a=Object.assign({active:0,isolated:0,degree_leq_one:0},i[s]),d={active:a.active-c.active,isolated:a.isolated-c.isolated,degree_leq_one:a.degree_leq_one-c.degree_leq_one};Object.values(d).some(l=>l!==0)&&(n[s]=d)}return n}function xt(e,t){let n=gr(e,t),{edge_share_by_kind:r={},semantic_edges:i=0,semantic_edge_share:o=0}=e.profile,{edge_share_by_kind:s={},semantic_edges:c=0,semantic_edge_share:a=0}=t.profile,d=e.profile.recorded_nodes??e.profile.nodes,l=t.profile.recorded_nodes??t.profile.nodes,f=e.profile.informative_edges??e.profile.edges,u=t.profile.informative_edges??t.profile.edges,g=e.profile.redundant_edges??0,h=t.profile.redundant_edges??0,m=e.profile.ordering_contradiction_edges??0,b=t.profile.ordering_contradiction_edges??0;return{baseline_saved_at:e.saved_at,same_snapshot:e.fingerprint===t.fingerprint,affected_subjects_by_code:de(e.affected_subjects_by_code,t.affected_subjects_by_code),profile:{nodes:t.profile.nodes-e.profile.nodes,recorded_nodes:l-d,edges:t.profile.edges-e.profile.edges,informative_edges:u-f,redundant_edges:h-g,ordering_contradiction_edges:b-m,active_nodes:t.profile.active_nodes-e.profile.active_nodes,missing_nodes:t.profile.missing_nodes-e.profile.missing_nodes,isolated_active_nodes:t.profile.isolated_active_nodes-e.profile.isolated_active_nodes,degree_leq_one_active_nodes:t.profile.degree_leq_one_active_nodes-e.profile.degree_leq_one_active_nodes,edges_by_kind:de(e.profile.edges_by_kind,t.profile.edges_by_kind),edge_share_by_kind:de(r,s),semantic_edges:c-i,semantic_edge_share:a-o,coverage_by_type:n,...mt(e.profile,t.profile)}}}import Et from"node:path";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="19264e42-25fa-5c93-9b0d-3b18a1ab9783")}catch{}})();var St=2,fe=500,hr=64,pr="graph-durable-cache";function Ct(e){return Re(e,pr,30,`graph-cache:${process.pid}`,!1,!1,3e3)}function F(e){return Et.join(e,"runtime","graph-cache.json")}function Dt(e){return Et.join(e,"runtime","graph-audit-baseline.json")}function ge(e){if(e!==null)try{let t=JSON.parse(e);return typeof t!="object"||t===null||t.version!==St||typeof t.fingerprint!="string"||typeof t.saved_at!="string"||typeof t.results!="object"||t.results===null||Array.isArray(t.results)?void 0:t}catch{return}}async function he(e,t){let n=await j(F(e)),r=ge(n),i=r?.fingerprint===t;return{exists:n!==null,fresh:i,results:i?r.results:{}}}async function pe(e,t,n,r,i){let o=await Ct(e);try{let s=ge(await j(F(e))),c=s?.fingerprint===t?s.results:{};delete c[r],c[r]=i;let a=Object.keys(c);for(let d of a.slice(0,Math.max(0,a.length-hr)))delete c[d];await re(F(e),JSON.stringify({version:St,fingerprint:t,saved_at:new Date().toISOString(),results:c})),n.results=c}finally{await o()}}async function me(e){let t=await Ct(e);try{await Ie(F(e))}finally{await t()}}async function Tt(e,t){let n=F(e),r=await j(n),i=ge(r);return i===void 0?{exists:r!==null,fresh:!1,entry_count:0}:{exists:!0,fresh:i.fingerprint===t,entry_count:Object.keys(i.results).length,fingerprint:i.fingerprint.slice(0,12),saved_at:i.saved_at,bytes:Buffer.byteLength(r,"utf8")}}function _e(e,t){return t||e>=fe}function te(e){return O(e)&&Object.values(e).every(x)}function O(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function x(e){return Number.isInteger(e)&&Number(e)>=0}function Nt(e){return typeof e=="number"&&Number.isFinite(e)&&e>=0&&e<=1}function L(e,t){return e===void 0||t(e)}function mr(e){return O(e)&&Object.values(e).every(Nt)}function _r(e){return O(e)?Object.values(e).every(t=>O(t)&&[t.active,t.isolated,t.degree_leq_one].every(x)):!1}function yr(e,t,n){let r=["recorded_nodes","informative_edges","redundant_edges","ordering_contradiction_edges"],i=r.filter(s=>e[s]!==void 0).length;if(i!==0&&i!==r.length||!r.every(s=>L(e[s],x)))return;let o={recorded_nodes:e.recorded_nodes??t,informative_edges:e.informative_edges??n,redundant_edges:e.redundant_edges??0,ordering_contradiction_edges:e.ordering_contradiction_edges??0};return o.recorded_nodes<=t&&o.informative_edges<=n&&o.redundant_edges<=n&&o.ordering_contradiction_edges<=n?o:void 0}function br(e,t,n){let r=[...t,...n,"finding_subjects_by_code"],i=r.filter(o=>e[o]!==void 0).length;return i!==0&&i!==r.length?!1:t.every(o=>L(e[o],x))&&n.every(o=>L(e[o],x)&&(e[o]===void 0||Number(e[o])<=1e4))&&L(e.finding_subjects_by_code,te)}function vr(e,t,n,r){let i=yr(e,n,r);if(i===void 0)return;let o=["articulation_points","bridge_edges","outcome_nodes","active_outcome_reachable_nodes","active_outcome_unreachable_nodes","terminal_nodes","terminal_outcome_reachable_nodes","terminal_outcome_unreachable_nodes","outcome_reachable_nodes","outcome_unreachable_nodes"],s=["active_outcome_reachability_basis_points","terminal_outcome_reachability_basis_points","outcome_reachability_basis_points"];if(!br(e,o,s)||e.edge_basis!==void 0&&e.edge_basis!=="deduplicated_directed")return;let c=te(e.finding_subjects_by_code)?e.finding_subjects_by_code:{};return{edge_basis:"deduplicated_directed",...i,...Object.fromEntries(o.map(a=>[a,e[a]??0])),...Object.fromEntries(s.map(a=>[a,e[a]??0])),finding_subjects_by_code:Object.fromEntries(A.map(a=>[a,c[a]??t[a]??0]))}}function wr(e,t,n,r,i){let o=[n,r,i],s=o.filter(d=>d!==void 0).length;if(s===0)return{edge_share_by_kind:{},semantic_edges:0,semantic_edge_share:0};if(s!==o.length||!mr(n)||!x(r)||!Nt(i))return;let c=Object.entries(t);if(c.reduce((d,[,l])=>d+l,0)!==e||Object.keys(n).length!==c.length||c.some(([d,l])=>n[d]!==(e===0?0:l/e)))return;let a=c.reduce((d,[l,f])=>d+(Q(l)?f:0),0);if(!(r!==a||i!==(e===0?0:a/e)))return{edge_share_by_kind:n,semantic_edges:r,semantic_edge_share:i}}function kr(e){if(e!==null)try{let t=JSON.parse(e);if(!O(t))return;let n=t,r=n.profile;if(typeof n.saved_at!="string"||typeof n.fingerprint!="string")return;let i=n.affected_subjects_by_code;if(!te(i)||!O(r)||!pt(r)||![r.nodes,r.edges,r.active_nodes,r.missing_nodes,r.isolated_active_nodes,r.degree_leq_one_active_nodes].every(x)||!te(r.edges_by_kind)||!L(r.coverage_by_type,_r))return;let o=wr(r.edges,r.edges_by_kind,r.edge_share_by_kind,r.semantic_edges,r.semantic_edge_share);if(o===void 0)return;let s=vr(r,i,r.nodes,r.edges);if(s===void 0)return;let{coverage_by_type:c={}}=r;return{...n,profile:{...r,...o,...s,coverage_by_type:c}}}catch{return}}async function At(e){return kr(await j(Dt(e)))}async function Rt(e,t){await re(Dt(e),JSON.stringify(t))}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="236ccc7d-6efd-57b1-8cce-6758d537f779")}catch{}})();var Ir={missing_reference_active:{op:"investigate",confidence:"medium",rationale:"Restore or re-create the referenced item, or remove/retype the reference on the active holder; the correct fix depends on why the target is absent."},missing_reference_terminal:{op:"waive",confidence:"high",rationale:"Terminal-holder reference to an absent item is historical debt; waive it or clean it up only in a dedicated changelog-safe closed-item batch."},legacy_no_blocker_sentinel:{op:"remove",confidence:"high",rationale:"The pre-structured-dependency no-active-blocker sentinel is retired and carries no information; blocker state derives from blocked_by edges."},ordering_cycle:{op:"investigate",confidence:"low",rationale:"Every cycle member is unschedulable until one ordering edge is removed or retyped; the planner never chooses which edge to cut."},legacy_ordering_cycle:{op:"waive",confidence:"high",rationale:"Terminal-only ordering cycles have no scheduling effect; repairing them would mutate closed history (changelog drag)."},ordering_storage_contradiction:{op:"remove",confidence:"high",rationale:"The structured ordering row asserts the opposite precedence from the same-target scalar blocker; remove that exact dependency row or replace both representations with one unambiguous edge."},legacy_ordering_storage_contradiction:{op:"remove",confidence:"high",rationale:"The terminal holder contains a proven contradictory structured ordering row; remove it in a dedicated changelog-safe batch while preserving the scalar blocker as history."},hierarchy_cycle:{op:"investigate",confidence:"low",rationale:"Cut or retype one exact structural relation in the cycle; the planner preserves every evidence row because intent determines the correct parent."},legacy_hierarchy_cycle:{op:"waive",confidence:"high",rationale:"Terminal-only hierarchy cycles are historical debt; waive them unless an explicit closed-history repair is approved."},hierarchy_cardinality_violation:{op:"investigate",confidence:"medium",rationale:"Choose the canonical parent and remove or retype the exact surplus hierarchy rows; the planner cannot infer ownership intent."},legacy_hierarchy_cardinality_violation:{op:"waive",confidence:"high",rationale:"Multiple parents confined to terminal items are historical debt; waive them unless a dedicated history repair is approved."},hierarchy_direction_violation:{op:"investigate",confidence:"medium",rationale:"Align the scalar parent and dependency-backed hierarchy rows to the intended canonical parent."},legacy_hierarchy_direction_violation:{op:"waive",confidence:"high",rationale:"Divergent hierarchy storage confined to terminal items is historical debt; waive it unless a dedicated history repair is approved."},duplicate_edge:{op:"remove",confidence:"high",rationale:"Parallel same-family spellings state one relationship twice; remove all but one stored spelling, keeping the holder's canonical direction."},legacy_duplicate_edge:{op:"waive",confidence:"high",rationale:"Duplicated spellings between terminal items are historical noise; waive or batch changelog-safe cleanup."},duplicate_dependency_row:{op:"remove",confidence:"high",rationale:"The identical dependency row is stored more than once on the holder; drop the repeats so the row exists exactly once \u2014 graph semantics are unchanged."},legacy_duplicate_dependency_row:{op:"waive",confidence:"high",rationale:"Repeated identical rows on terminal holders are storage noise; waive or clean up only in a changelog-safe closed-item batch."},stale_lifecycle_block:{op:"investigate",confidence:"medium",rationale:`Add a local ordering edge, declare an external blocker with --dep "id=<external-ref>,kind=blocked_by,source_kind=external", or move the item back to an active status; only the holder's owner knows which is true.`},isolated_active_node:{op:"investigate",confidence:"medium",rationale:"Link the item to its parent, prerequisite, or origin \u2014 or register it as an explicitly exempt isolate; the audit never fabricates an edge."},sparse_active_node:{op:"investigate",confidence:"low",rationale:"Investigate for an honest second edge (story-to-task, defect family, cross-epic complement); sparse is not automatically defective."}};function Ot(e){return`${e.source} -${e.kind}-> ${e.target}`}function xr(e){let[t,...n]=e.edges;return n.map(r=>({op:"remove",code:"duplicate_edge",subject:Ot(r),rationale:"This stored spelling restates the kept canonical edge of the same semantic family; removing it leaves the relationship stated exactly once.",evidence:[`keep: ${Ot(t)}`,`group: ${Z(e)}`],confidence:"high"}))}function Er(e,t){if(e.code==="duplicate_edge")return e.sample.flatMap(r=>xr(t.get(r)));let n=Ir[e.code];return e.sample.map(r=>({op:n.op,code:e.code,subject:r,rationale:n.rationale,evidence:[e.policy],confidence:n.confidence}))}function jt(e,t={}){let{redundancyLimit:n,...r}=t,i=ee(e,r),o=new Map(ue(e).map(d=>[Z(d),d])),s=i.findings.flatMap(d=>Er(d,o)),c=i.findings.some(d=>d.sample_truncated);t.signal?.throwIfAborted();let a=T(e.graph,{limit:n??t.maxSampleSize??25,...t.signal===void 0?{}:{signal:t.signal}});for(let d of a.value)s.push({op:"remove",code:"redundant_edge",subject:`${d.edge.source} -> ${d.edge.target} (${d.edge.kind})`,rationale:"The stored edge is implied by a longer same-family witness path; shortcut edges are sometimes deliberate emphasis, so confirm intent before removing.",evidence:[`witness: ${d.witness.join(" -> ")}`],confidence:"medium"});return c=c||a.meta.truncated,{steps:s,report:i,truncated:c,cost:{visitedNodes:a.meta.visitedNodes,inspectedEdges:a.meta.inspectedEdges}}}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="123fbdac-0fc7-5f02-85d9-9a7ca55e1df1")}catch{}})();var Ft=new Set(["ancestors","descendants","predecessors","successors","paths","impact","dominators"]);function Mt(e,t,n){let r=e;if(t&&e.subcommand==="audit"){let{nodes:i,recorded_nodes:o,edges:s,active_nodes:c,terminal_nodes:a,missing_nodes:d,ordering_acyclic:l,active_ordering_acyclic:f,coverage_by_lifecycle:u}=e.profile,g=Object.fromEntries(Object.entries(u).map(([h,m])=>{let{degree_histogram:b,...v}=m;return[h,v]}));r={...e,profile:{nodes:i,recorded_nodes:o,edges:s,active_nodes:c,terminal_nodes:a,missing_nodes:d,ordering_acyclic:l,active_ordering_acyclic:f,coverage_by_lifecycle:g}}}return{...r,projection:{mode:t?"summary":"full",declared_field_groups:n===void 0?[]:[{name:n,restore_with:"--full"}],included_field_groups:n===void 0||t?[]:[n]}}}function Sr(e,t,n,r){return{assembly:t,...n===void 0?{}:{kinds:n},maxDepth:Ue(r.maxDepth),limit:e==="impact"&&Number(r.limit)===0?0:$(r.limit,"limit")??(r.full===!0?Number.MAX_SAFE_INTEGER:I.rows),after:r.after?.trim()||void 0,direction:Be(r.direction),maxPaths:$(r.maxPaths,"max-paths"),sample:$(r.sample,"sample")??I.samples,exemptIsolates:Pt(r.exemptIsolate),exemptIsolateTypes:Pt(r.exemptIsolateType),saveBaseline:r.saveBaseline===!0,summary:r.summary===!0,unbounded:r.full===!0}}function Pt(e){return e===void 0?[]:(Array.isArray(e)?e:[e]).flatMap(t=>t.split(",")).map(t=>t.trim()).filter(t=>t.length>0)}function Cr(e,t,n){let r=e.trim().toLowerCase();if(!ie.includes(r))throw Me({command_path:"graph",token:r||"<empty>",allowed:ie});let i=r;if(Ft.has(i)&&!t?.trim())throw new k(`graph ${i} requires an item id.`,w.USAGE);if(i==="paths"&&!n?.trim())throw new k("graph paths requires a source and a target item id.",w.USAGE);return i}function ye(e){throw e instanceof TypeError?new k(e.message,w.USAGE):e}function be(e){return{truncated:e.truncated,cost:{visited_nodes:e.visitedNodes,inspected_edges:e.inspectedEdges}}}function Lt(e,t){let n=t.trim().toLowerCase();for(let r of e.details)if(r.id.trim().toLowerCase()===n&&!e.missingIdSet.has(r.id.toLowerCase()))return r.id;throw new k(`Item ${t} not found`,w.NOT_FOUND)}function Dr(e,t,n){let r={ancestors:Qe,descendants:Ze,predecessors:et,successors:tt}[e],i;try{i=r(n.assembly.graph,t,{...n.kinds===void 0?{}:{kinds:n.kinds},...n.maxDepth===void 0?{}:{maxDepth:n.maxDepth},limit:n.limit,...n.after===void 0?{}:{after:n.after}})}catch(s){ye(s)}let o=be(i.meta);return{subcommand:e,root:t,count:i.value.length,...o,...i.meta.nextCursor===void 0?{}:{next_cursor:i.meta.nextCursor},...n.summary?{}:{ids:i.value}}}function Tr(e,t,n){let r=nt(n.assembly.graph,e,t,{direction:n.direction,...n.kinds===void 0?{}:{kinds:n.kinds},...n.maxDepth===void 0?{}:{maxDepth:n.maxDepth},...n.maxPaths===void 0?{}:{maxPaths:n.maxPaths}});return{subcommand:"paths",root:e,target:t,direction:n.direction,count:r.value.length,...be(r.meta),...n.summary?{}:{paths:r.value.map(i=>({nodes:i.nodes,kinds:i.edges.map(o=>o.kind),length:i.length}))}}}function Nr(e,t){let n;try{n=U(t.assembly.graph,e,{direction:t.direction,...t.kinds===void 0?{}:{kinds:t.kinds},...t.maxDepth===void 0?{}:{maxDepth:t.maxDepth},...t.unbounded?{}:{limit:t.limit},...t.after===void 0?{}:{after:t.after}})}catch(r){ye(r)}return{subcommand:"impact",root:e,direction:t.direction,count:n.affected.length,truncated:n.truncated,...n.nextCursor===void 0?{}:{next_cursor:n.nextCursor},cost:{visited_nodes:n.cost.visitedNodes,inspected_edges:n.cost.inspectedEdges},...t.summary?{}:{affected:n.affected}}}function Ar(e,t,n){return{acyclic:e.acyclic,ordered_node_count:e.order.length,layer_count:e.layers.length,frontier_count:e.frontier.length,critical_path_length:e.criticalPathLength,cycle_count:e.cycles.length,...t?{}:{frontier:e.frontier.slice(0,n),critical_path:e.criticalPath.slice(0,n),cycles:e.cycles.slice(0,n)}}}function Rr(e,t,n){return{component_count:e.components.length,largest_component_size:e.components[0]?.length??0,orphan_count:e.orphans.length,...t?{}:{orphans:e.orphans.slice(0,n),hubs:e.hubs.slice(0,n)}}}function Or(e,t,n){let r=0,i=0,o=0;for(let s of e.cycles)r+=Number(s.legacy_terminal);for(let s of e.cardinality_violations)i+=Number(s.legacy_terminal);for(let s of e.divergences)o+=Number(s.legacy_terminal);return{acyclic:e.cycles.length===0,relation_count:e.relations.length,cycle_count:e.cycles.length,active_cycle_count:e.cycles.length-r,legacy_cycle_count:r,cardinality_violation_count:e.cardinality_violations.length,active_cardinality_violation_count:e.cardinality_violations.length-i,legacy_cardinality_violation_count:i,parent_divergence_count:e.divergences.length,active_parent_divergence_count:e.divergences.length-o,legacy_parent_divergence_count:o,...t?{}:{cycles:e.cycles.slice(0,n).map(s=>s.item_ids)}}}function jr(e){let t=e.assembly.graph,n=e.limit,r=B(t,{registry:t.registry()}),i=Ye(t);return{subcommand:"analyze",node_count:t.nodes().length,edge_count:t.edges().length,edge_basis:"deduplicated_directed",sample_limit:n,execution:Ar(r,e.summary,n),knowledge:Rr(i,e.summary,n),hierarchy:Or(G(e.assembly),e.summary,n)}}function Mr(e,t){let n=ee(e.assembly,{isTerminal:t,maxSampleSize:e.sample,...e.exemptIsolates.length===0?{}:{exemptIsolates:e.exemptIsolates},...e.exemptIsolateTypes.length===0?{}:{isolateExemptTypes:e.exemptIsolateTypes}}),r={},i={},o={},s={};for(let d of n.findings)r[d.severity]=(r[d.severity]??0)+1,i[d.code]=(i[d.code]??0)+1,o[d.severity]=(o[d.severity]??0)+d.count,s[d.code]=(s[d.code]??0)+d.count;let{finding_subjects_by_code:c,...a}=n.profile;return{subcommand:"audit",truncated:n.findings.length>e.limit,finding_count:n.findings.length,findings_by_severity:r,findings_by_code:i,affected_subjects_by_severity:o,affected_subjects_by_code:s,profile:e.summary?a:n.profile,legacy_alias_counts:e.assembly.legacyAliasCounts,...e.summary?{}:{findings:n.findings.slice(0,e.limit)}}}function Pr(e){let t=e.limit,n={};e.kinds!==void 0&&(n.kinds=e.kinds);let r=it(e.assembly.graph,n),i=r.value;return{subcommand:"communities",community_count:i.communities.length,largest_community_size:i.communities[0]?.size??0,iterations:i.iterations,converged:i.converged,truncated:!i.converged||i.communities.length>t,cost:{visited_nodes:r.meta.visitedNodes,inspected_edges:r.meta.inspectedEdges},...e.summary?{}:{communities:i.communities.slice(0,t).map(o=>({representative:o.representative,size:o.size,members:o.members.slice(0,t)}))}}}function Lr(e){let t;try{t=T(e.assembly.graph,{...e.kinds===void 0?{}:{kinds:e.kinds},...e.maxDepth===void 0?{}:{maxDepth:e.maxDepth},limit:e.limit})}catch(n){ye(n)}return{subcommand:"redundancy",redundant_count:t.value.length,...be(t.meta),...e.summary?{}:{redundant:t.value.map(n=>({source:n.edge.source,target:n.edge.target,kind:n.edge.kind,witness:n.witness}))}}}function Fr(e,t){let n=t.limit,r=ot(t.assembly.graph,e,{direction:t.direction,...t.kinds===void 0?{}:{kinds:t.kinds},...t.maxDepth===void 0?{}:{maxDepth:t.maxDepth}}),i=r.value.rows.filter(o=>o.dominatedCount>0);return{subcommand:"dominators",root:e,direction:t.direction,reachable_count:r.value.reachableCount,bottleneck_count:i.length,truncated:r.meta.truncated||i.length>n,cost:{visited_nodes:r.meta.visitedNodes,inspected_edges:r.meta.inspectedEdges},...t.summary?{}:{bottlenecks:i.slice(0,n).map(o=>({id:o.id,idom:o.idom,dominated_count:o.dominatedCount}))}}}function Gr(e){let t=e.limit,n=lt(e.assembly.graph),r=n.rows.filter(i=>i.critical).length;return{subcommand:"slack",acyclic:n.acyclic,makespan:n.makespan,scheduled_count:n.scheduledCount,critical_count:r,critical_path_length:n.criticalPathLength,cycle_count:n.cycles.length,truncated:n.rows.length>t,...e.summary?{}:{critical_path:n.criticalPath.slice(0,t),rows:n.rows.slice(0,t).map(i=>({id:i.id,earliest_start:i.earliestStart,latest_start:i.latestStart,slack:i.slack,critical:i.critical}))}}}function $r(e){let t=e.limit,n=dt(e.assembly.graph,e.kinds===void 0?{}:{kinds:e.kinds}),r=n.value;return{subcommand:"centrality",node_count:r.nodeCount,edge_count:r.edgeCount,edge_basis:"simple_undirected",truncated:r.rows.length>t,cost:{visited_nodes:n.meta.visitedNodes,inspected_edges:n.meta.inspectedEdges},...e.summary?{}:{rows:r.rows.slice(0,t).map(i=>({id:i.id,degree:i.degree,in_degree:i.inDegree,out_degree:i.outDegree,betweenness:i.betweenness,closeness:i.closeness}))}}}function qr(e){let t=e.limit,n=X(e.assembly.graph,e.kinds===void 0?{}:{kinds:e.kinds}),{articulationPoints:r,bridges:i}=n.value;return{subcommand:"articulation",articulation_count:r.length,bridge_count:i.length,truncated:r.length>t||i.length>t,cost:{visited_nodes:n.meta.visitedNodes,inspected_edges:n.meta.inspectedEdges},...e.summary?{}:{articulation_points:r.slice(0,t),bridges:i.slice(0,t)}}}function Ur(e,t){let n=e.limit,r=jt(e.assembly,{isTerminal:t,redundancyLimit:n,maxSampleSize:e.sample,...e.exemptIsolates.length===0?{}:{exemptIsolates:e.exemptIsolates},...e.exemptIsolateTypes.length===0?{}:{isolateExemptTypes:e.exemptIsolateTypes}}),i={},o={};for(let s of r.steps)i[s.op]=(i[s.op]??0)+1,o[s.code]=(o[s.code]??0)+1;return{subcommand:"plan",step_count:r.steps.length,steps_by_op:i,steps_by_code:o,finding_count:r.report.findings.length,truncated:r.truncated||r.steps.length>n,cost:{visited_nodes:r.cost.visitedNodes,inspected_edges:r.cost.inspectedEdges},...e.summary?{}:{steps:r.steps.slice(0,n)}}}function Gt(e,t,n,r){return JSON.stringify({projection_version:2,subcommand:e,root:t??null,target:n??null,kinds:r.kinds??null,maxDepth:r.maxDepth??null,limit:r.limit,after:r.after??null,direction:r.direction,maxPaths:r.maxPaths??null,sample:r.sample,exemptIsolates:[...new Set(r.exemptIsolates.map(i=>i.toLowerCase()))].sort(),exemptIsolateTypes:[...new Set(r.exemptIsolateTypes.map(i=>i.toLowerCase()))].sort(),summary:r.summary,unbounded:r.unbounded})}function $t(e,t,n,r,i){return e==="analyze"?jr(r):e==="audit"?Mr(r,i):e==="plan"?Ur(r,i):e==="communities"?Pr(r):e==="redundancy"?Lr(r):e==="dominators"?Fr(t,r):e==="slack"?Gr(r):e==="centrality"?$r(r):e==="articulation"?qr(r):e==="paths"?Tr(t,n,r):e==="impact"?Nr(t,r):Dr(e,t,r)}function Br(e,t){if(e!=="index"&&(t.rebuild===!0||t.clear===!0))throw new k("--rebuild and --clear apply only to graph index.",w.USAGE);if(e!=="audit"&&t.saveBaseline===!0)throw new k("--save-baseline applies only to graph audit.",w.USAGE);if(e==="slack"&&t.kind!==void 0)throw new k("graph slack analyzes every ordering kind; --kind is not supported.",w.USAGE);if(t.rebuild===!0&&t.clear===!0)throw new k("graph index accepts either --rebuild or --clear, not both.",w.USAGE);if(t.full===!0&&t.limit!==void 0)throw new k(`graph ${e} accepts either --full or --limit, not both.`,w.USAGE)}async function zr(e,t,n,r,i,o){let s="status";if(o.clear===!0&&(await me(e),s="cleared"),o.rebuild===!0){await me(e);let a=await he(e,t),d={assembly:n.assembly,direction:"both",exemptIsolates:[],exemptIsolateTypes:[],saveBaseline:!1,summary:!0,limit:I.rows,sample:I.samples,unbounded:!1};for(let l of["analyze","audit"])await pe(e,t,a,Gt(l,void 0,void 0,d),$t(l,void 0,void 0,d,i));s="rebuilt"}let c=await Tt(e,t);return{subcommand:"index",action:s,state:c.exists?c.fresh?"fresh":"stale":"absent",entry_count:c.entry_count,item_count:r,min_items_threshold:fe,persist_enabled:_e(r,c.exists),current_fingerprint:t.slice(0,12),...c.saved_at===void 0?{}:{saved_at:c.saved_at},...c.bytes===void 0?{}:{bytes:c.bytes}}}async function Hr(e,t,n,r){let i={saved_at:new Date().toISOString(),fingerprint:t,affected_subjects_by_code:n.affected_subjects_by_code,profile:{...n.profile,finding_subjects_by_code:Object.fromEntries(A.map(s=>[s,n.affected_subjects_by_code[s]??0]))}},o=await At(e);return r&&await Rt(e,i),o===void 0?n:{...n,baseline:xt(o,i)}}async function Kr(e,t,n,r,i){try{await pe(e,t,n,r,i)}catch{}}function Vr(e,t,n,r){if(e.subcommand!=="slack")return;let i=new Set(t.assembly.details.filter(u=>r(u.status)).map(u=>u.id)),o=t.assembly.graph,s=new ke(o.nodes().filter(u=>!i.has(u)),o.edges().filter(u=>!i.has(u.source)&&!i.has(u.target)),o.registry()),c=ut(s,n.filter(u=>!i.has(u.id)),{now:Ae(),limit:t.limit}),{rows:a,residuals:d,overcommitted:l,...f}=c;e.deadline_schedule={population:"active",...f,...t.summary?{}:{rows:a,residuals:d,overcommitted:l}}}async function ro(e,t,n,r,i){let o=Cr(e,t,n);De(r.summary===!0,r.full===!0,"--summary");let s=Ee(process.cwd(),i.path);await Pe(s);let c=await je(s),a=xe(c,Ce()),d=await Le(s,c.item_format,a.type_to_folder,void 0,c.schema),l=Se(c.schema),f=qt=>Oe(qt,l);Br(o,r);let u=Fe(),g=ze(r.kind,u),h=qe().lookup(s,$e(d,f,u),()=>Ge(d,f,u)),m=Sr(o,h.assembly,g,r);if(o==="index")return Mt(await zr(s,h.fingerprint,m,d.length,f,r),!1);let b=Ft.has(o)?Lt(m.assembly,t):void 0,v=o==="paths"?Lt(m.assembly,n):void 0,p=Gt(o,b,v,m),_=await he(s,h.fingerprint),E=_.results[p],S=h.memoize(p,()=>E!==void 0?structuredClone(E):$t(o,b,v,m,f)),ve=_e(d.length,_.exists);!S.reused&&E===void 0&&ve&&await Kr(s,h.fingerprint,_,p,S.value);let ne=S.value.subcommand==="audit"?await Hr(s,h.fingerprint,S.value,m.saveBaseline):S.value;return ne.cache={fingerprint:h.fingerprint.slice(0,12),assembly:h.assemblyReused?"hit":"miss",result:S.reused?"hit":"miss",durable:E!==void 0?"hit":ve?"miss":"off"},Vr(ne,m,d,f),Mt(ne,m.summary,"result_rows")}export{B as a,U as b,Ye as c,Xr as d,Qe as e,Ze as f,et as g,tt as h,nt as i,V as j,it as k,T as l,ot as m,dt as n,X as o,lt as p,ut as q,tr as r,It as s,Z as t,ue as u,ee as v,xt as w,St as x,fe as y,F as z,Dt as A,he as B,pe as C,me as D,Tt as E,_e as F,At as G,Rt as H,jt as I,Cr as J,ro as K};
|
|
2
|
+
//# sourceMappingURL=chunk-NXQZMKW5.js.map
|