@unbrained/pm-cli 2026.8.14 → 2026.8.15
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/.claude-plugin/marketplace.json +2 -2
- package/CHANGELOG.md +25 -2
- package/dist/cli/commander-usage.js +17 -4
- package/dist/cli/error-guidance.d.ts +2 -0
- package/dist/cli/error-guidance.js +52 -25
- package/dist/cli/main.js +3 -2
- package/dist/cli/register-mutation.js +4 -2
- package/dist/cli/register-operations.js +5 -5
- package/dist/cli-bundle/bundle-manifest.json +150 -150
- package/dist/cli-bundle/chunks/{chunk-TXMEUUUY.js → chunk-24GAV7XL.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-TMJ7URWS.js → chunk-AIM6VT2N.js} +9 -9
- package/dist/cli-bundle/chunks/chunk-DSWDLTDR.js +197 -0
- package/dist/cli-bundle/chunks/{chunk-FIW4P64F.js → chunk-J42EGKDK.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-KIEGUBYQ.js +2 -0
- package/dist/cli-bundle/chunks/{chunk-SBRKH6OR.js → chunk-KLKYLSDX.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-G5JUB66K.js → chunk-LJHOAVGI.js} +59 -59
- package/dist/cli-bundle/chunks/{chunk-BFALV3YP.js → chunk-MEM2ZS3O.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-QHPCJWEJ.js +35 -0
- package/dist/cli-bundle/chunks/{chunk-XAVMOK6B.js → chunk-WLPDLNEZ.js} +2 -2
- package/dist/cli-bundle/chunks/{register-list-query-T3EHHNNV.js → register-list-query-CT3LFDDN.js} +2 -2
- package/dist/cli-bundle/chunks/{register-mutation-E27WCLSZ.js → register-mutation-NWEVA5YS.js} +3 -3
- package/dist/cli-bundle/chunks/register-operations-AHIAG5KM.js +2 -0
- package/dist/cli-bundle/chunks/{register-setup-3YXZ444E.js → register-setup-ZJZFVAKE.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-4X57RE4U.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-XDNAW5OI.js → chunk-6XKF3PGV.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-7NJ4QYQ2.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-WCVE2NIG.js → chunk-EXZA4257.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-ITAUHSO6.js +50 -0
- package/dist/cli-bundle/focused-chunks/{chunk-4DQ2YERC.js → chunk-KLVUMNXJ.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-K7RWWOAG.js → chunk-KT5XMYSX.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-PPFGQDSI.js → chunk-KTKH4IMG.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-M67F5AIN.js +8 -0
- package/dist/cli-bundle/focused-chunks/{chunk-KSEDUWVZ.js → chunk-NSPYTG6G.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-OKA6ELTL.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-PUISBOPP.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-QLNMCESQ.js +155 -0
- package/dist/cli-bundle/focused-chunks/{chunk-LZ4MV3RH.js → chunk-SLKC6QLJ.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-U65UC4G3.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-KFSZ3BP6.js → chunk-WTSER4WJ.js} +6 -6
- package/dist/cli-bundle/focused-chunks/{chunk-YOOI3UZX.js → chunk-ZMFXQ7VF.js} +2 -2
- package/dist/cli-bundle/main.js +13 -13
- 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 +32 -35
- 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 +32 -31
- 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/diagnostics/remediation.js +7 -2
- package/dist/core/extensions/reserved-host-flags.js +3 -2
- package/dist/core/history/replay.d.ts +14 -1
- package/dist/core/history/replay.js +45 -8
- package/dist/core/output/output.d.ts +2 -0
- package/dist/core/output/output.js +3 -2
- package/dist/core/shared/command-types.d.ts +2 -0
- package/dist/core/shared/command-types.js +2 -2
- package/dist/core/shared/errors.d.ts +12 -0
- package/dist/core/shared/errors.js +2 -2
- package/dist/mcp/tool-definitions.js +9 -5
- package/dist/sdk/agent/refusal-reachability.d.ts +61 -0
- package/dist/sdk/agent/refusal-reachability.js +91 -3
- package/dist/sdk/cli-bootstrap.d.ts +2 -0
- package/dist/sdk/cli-bootstrap.js +7 -2
- package/dist/sdk/cli-contracts/completeness.js +3 -2
- package/dist/sdk/cli-contracts/flag-contracts.js +3 -2
- package/dist/sdk/cli-contracts/registration-helpers.js +3 -2
- package/dist/sdk/cli-contracts/runtime-contracts.d.ts +5 -0
- package/dist/sdk/cli-contracts/runtime-contracts.js +23 -7
- package/dist/sdk/cli-contracts/tool-parameter-tables.js +15 -5
- package/dist/sdk/cli-contracts/tool-schema.js +10 -3
- package/dist/sdk/cli-program.js +3 -2
- package/dist/sdk/core.d.ts +2 -2
- package/dist/sdk/core.js +3 -3
- package/dist/sdk/generated/generated-error-code-catalog-part-1.js +26 -2
- package/dist/sdk/generated/generated-error-code-catalog-part-2.js +50 -26
- package/dist/sdk/governance/assurance-action.d.ts +7 -1
- package/dist/sdk/governance/assurance-action.js +7 -6
- package/dist/sdk/governance/assurance-mutation-error.d.ts +42 -1
- package/dist/sdk/governance/assurance-mutation-error.js +27 -3
- package/dist/sdk/governance/assurance-runtime.js +12 -11
- package/dist/sdk/governance/assurance.d.ts +9 -0
- package/dist/sdk/governance/assurance.js +80 -14
- package/dist/sdk/governance/extension-host-version.d.ts +25 -0
- package/dist/sdk/governance/extension-host-version.js +105 -0
- package/dist/sdk/governance/health.d.ts +32 -1
- package/dist/sdk/governance/health.js +119 -27
- package/dist/sdk/governance/provenance-health.d.ts +27 -0
- package/dist/sdk/governance/provenance-health.js +95 -3
- package/dist/sdk/governance/validate.js +7 -8
- package/dist/sdk/governance.d.ts +6 -0
- package/dist/sdk/governance.js +8 -2
- package/dist/sdk/history-repair.d.ts +13 -1
- package/dist/sdk/history-repair.js +62 -18
- package/dist/sdk/linked-artifacts.js +16 -5
- package/dist/sdk/pagination.d.ts +15 -0
- package/dist/sdk/pagination.js +9 -5
- package/dist/sdk/query/context.d.ts +5 -1
- package/dist/sdk/query/context.js +14 -5
- package/dist/sdk/read-output/continuation.d.ts +11 -0
- package/dist/sdk/read-output/continuation.js +132 -0
- package/dist/sdk/read-output-budget.d.ts +1 -1
- package/dist/sdk/read-output-budget.js +14 -10
- package/dist/sdk/read-output-contracts.d.ts +66 -2
- package/dist/sdk/read-output-contracts.js +183 -19
- package/dist/sdk/read-output-rows.d.ts +2 -0
- package/dist/sdk/read-output-rows.js +15 -2
- package/dist/sdk/runtime-input.js +4 -2
- package/docs/ASSURANCE.md +59 -2
- package/docs/COMMANDS.md +8 -2
- package/docs/READ_OUTPUT_CONTRACTS.md +49 -8
- package/docs/RELEASING.md +42 -5
- package/docs/SDK_CONTEXT_INTEGRITY.md +64 -2
- package/marketplace.json +2 -2
- package/package.json +3 -3
- 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-codex/.codex-plugin/plugin.json +1 -1
- package/sdk/public-surface.json +1133 -187
- package/dist/cli-bundle/chunks/chunk-BBOFSVAK.js +0 -197
- package/dist/cli-bundle/chunks/chunk-YAMTJL6Y.js +0 -34
- package/dist/cli-bundle/chunks/chunk-YSVSMJ2B.js +0 -2
- package/dist/cli-bundle/chunks/register-operations-4R6I7CPY.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-F43TT2QQ.js +0 -8
- package/dist/cli-bundle/focused-chunks/chunk-KYUQGTSB.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-PGXJQLCT.js +0 -155
- package/dist/cli-bundle/focused-chunks/chunk-Q4YY3XNF.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-QK753U3U.js +0 -46
- package/dist/cli-bundle/focused-chunks/chunk-QUMB2J27.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-SM7MTG27.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-ZM6TZVHC.js +0 -2
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{k as A}from"./chunk-XAVMOK6B.js";import{$ as b,$k as m,Af as E,C as f,E as h,Nd as k,Od as y,Oi as S}from"./chunk-BBOFSVAK.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]="271cf7c1-f84b-5f59-aa13-ed8cb4ee232f")}catch{}})();var F=new Set(["append","claim","close","close-task","comments","copy","delete","deps","docs","files","focus","get","history","history-compact","history-redact","history-repair","learnings","notes","pause-task","release","restore","start-task","test","update"]),x=new Map([["files","discover"],["item","complete"]]),G=new Set(["--author","--output-budget","--output-format","--output-include","--output-limit","--output-session","--path","--pm-path"]),$=new Map([["append",1],["close",1],["close-task",1],["comments",1],["item complete",1],["learnings",1],["notes",1],["restore",1]]);function R(e){let t=e?.trim().toLowerCase()??"";return F.has(t)||x.has(t)}function L(e){for(let t=0;t<e.length;t+=1){let n=e[t];if(n==="--")return;if(G.has(n)){t+=1;continue}if(!n.startsWith("-"))return t}}function O(e,t,n){let o=x.get(n);if(o===void 0)return t+1;let s=e[t+1]?.toLowerCase()===o;if(!(!s&&!F.has(n)))return t+(s?2:1)}function U(e){let t=new Map;for(let n of m(e))for(let o of[n.flag,n.short,...n.aliases??[]])o&&t.set(o,n);return t}function q(e){let t=[];for(let n=0;n<e.length;n+=1){let o=e[n];if(o==="--")break;o==="--id"?(t.push({index:n,consumed:2,value:e[n+1]}),n+=1):o.startsWith("--id=")&&t.push({index:n,consumed:1,value:o.slice(5)})}return t}function j(e,t,n){if(e.indexOf("=")>=0||t===void 0||t.startsWith("-"))return!1;let s=n.get(e);return s!==void 0&&s.value_type!=="boolean"}function K(e,t,n,o,s){let i=0;for(let r=t;r<e.length;r+=1){let a=e[r];if(a==="--")break;if(a==="--id"){r+=1;continue}if(!a.startsWith("--id=")){if(!a.startsWith("-")){if(r<o)return!0;i+=1;continue}j(a,e[r+1],s)&&(r+=1)}}return i>($.get(n)??0)}function N(e){let t=L(e),n=t===void 0?void 0:e[t]?.toLowerCase();if(!R(n))return{argv:[...e],changed:!1,conflict:!1};let o=x.get(n)===e[t+1]?.toLowerCase()?`${n} ${e[t+1]?.toLowerCase()}`:n,s=U(o),i=q(e),r=i[0];if(!r||!r.value?.trim())return{argv:[...e],changed:!1,conflict:!1};let a=O(e,t,n);if(a===void 0)return{argv:[...e],changed:!1,conflict:!1};if(i.length>1||K(e,a,o,r.index,s))return{argv:[...e],changed:!1,conflict:!0,itemId:r.value};let u=[...e.slice(0,r.index),...e.slice(r.index+r.consumed)],c=L(u),l=O(u,c,n);return u.splice(l,0,r.value),{argv:u,changed:!0,conflict:!1,itemId:r.value}}(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]="7b3209a8-8580-542c-9e80-21d04df3f61f")}catch{}})();var g=new Set(["--pm-path","--path","--author","--output-include","--output-limit","--output-budget","--output-format","--output-session"]),Y=new Set(["--output-include","--output-limit","--output-budget","--output-format","--output-session"]),V=e=>{let t=e.indexOf("=");return t>0&&g.has(e.slice(0,t))},_=(e,t)=>typeof t!="string"?!1:e==="--path"||e==="--pm-path"||!t.startsWith("-"),T=new Set(["--no-extensions","--no-pager","--json","--quiet","--lean","--token-accounting","--output-row-contract"]);function X(e,t,n){let o=e[t];if(T.has(o))return n.booleanFlags.add(o),1;let s=o.indexOf("="),i=s>0?o.slice(0,s):o;if(!g.has(i))return 1;let r=s>0?o.slice(s+1):void 0,a=r===void 0&&_(i,e[t+1]),u=r??(a?e[t+1]:void 0);return i==="--author"?n.author=u??"":typeof u=="string"&&u.length>0&&(Y.has(i)?n.outputValues:n.pathValues).set(i,u),a?2:1}function J(e){let t={booleanFlags:new Set,outputValues:new Map,pathValues:new Map},n=0;for(;n<e.length&&e[n]!=="--";)n+=X(e,n,t);return{path:t.pathValues.get("--pm-path")??t.pathValues.get("--path"),noExtensions:t.booleanFlags.has("--no-extensions"),noPager:t.booleanFlags.has("--no-pager"),json:t.booleanFlags.has("--json"),quiet:t.booleanFlags.has("--quiet"),lean:t.booleanFlags.has("--lean"),tokenAccounting:t.booleanFlags.has("--token-accounting"),...t.booleanFlags.has("--output-row-contract")?{outputRowContract:!0}:{},...t.outputValues.get("--output-include")===void 0?{}:{outputInclude:t.outputValues.get("--output-include")},...t.outputValues.get("--output-limit")===void 0?{}:{outputLimit:t.outputValues.get("--output-limit")},...t.outputValues.get("--output-budget")===void 0?{}:{outputBudget:t.outputValues.get("--output-budget")},...t.outputValues.get("--output-format")==="toon"||t.outputValues.get("--output-format")==="json"?{outputFormat:t.outputValues.get("--output-format")}:{},...t.outputValues.get("--output-session")===void 0?{}:{outputSession:t.outputValues.get("--output-session")},...t.author===""?{authorMissingValue:!0}:t.author!==void 0?{author:t.author}:{}}}function M(e){let t=[],n=0;for(;n<e.length;){let o=e[n];if(o==="--")break;if(T.has(o)||o==="--profile"||o==="--id-only"||o==="--full-changed-fields"||o==="--explain"){n+=1;continue}if(g.has(o)){n+=_(o,e[n+1])?2:1;continue}if(V(o)){n+=1;continue}t.push(o),n+=1}return t}function Z(e){let t=M(e);if(t[0]?.trim().toLowerCase()==="help"){let i=[];for(let r=1;r<t.length;r+=1){let a=t[r];if(a.startsWith("-"))break;i.push(a.trim().toLowerCase())}return{requested:!0,commandPathTokens:i}}if(t.findIndex(i=>i==="--help"||i==="-h")<0)return{requested:!1,commandPathTokens:[]};let s=[];for(let i of t){if(i.startsWith("-"))break;s.push(i.trim().toLowerCase())}return{requested:!0,commandPathTokens:s}}function I(e){for(let t=0;t<e.length;t+=1){let n=e[t];if(n==="--")return;if(g.has(n)){t+=_(n,e[t+1])?1:0;continue}if(!(V(n)||T.has(n)||n==="--profile"||n==="--id-only"||n==="--explain")&&!n.startsWith("-"))return t}}function C(e){let t=I(e);return t===void 0?void 0:e[t].trim().toLowerCase()}function H(e,t){return t.noPager?!0:process.stdout.isTTY===!0?!1:Z(e).requested}function De(e){let t=["PAGER","MANPAGER","GIT_PAGER","LESS"],n=t.map(i=>process.env[i]),o=()=>{for(let[i,r]of t.entries()){let a=n[i];a===void 0?delete process.env[r]:process.env[r]=a}},s=J(e);return H(e,s)&&(process.env.PAGER="cat",process.env.MANPAGER="cat",process.env.GIT_PAGER="cat",(typeof process.env.LESS!="string"||process.env.LESS.trim().length===0)&&(process.env.LESS="FRX")),o}var Q=new Set(["install","uninstall","explore","manage","doctor","adopt","adopt-all","activate","deactivate"]);function ee(e){let t=I(e);if(t===void 0||e[t]!=="extension")return[...e];let n=e[t+1];if(!n||n.startsWith("-"))return[...e];if(!Q.has(n))return[...e];if(e.includes("--help")||e.includes("-h"))return[...e];let o=`--${n}`;return e.includes(o)?[...e]:[...e.slice(0,t+1),o,...e.slice(t+2)]}var te=new Set(["pm","pm-cli"]);function ne(e,t){let n=I(e);if(n===void 0)return e;let o=e[n];return te.has(o.trim().toLowerCase())?(t.push({from:o,to:[],reason:"executable_alias",confidence:"high"}),[...e.slice(0,n),...e.slice(n+1)]):e}function oe(e,t){let n=I(e);if(n===void 0)return e;let o=e[n],s=S[o.trim().toLowerCase()];if(!s)return e;let i=[...e];return i[n]=s,t.push({from:o,to:[s],reason:"command_alias",confidence:"high"}),i}function w(e){return e.replace(/^--?/,"").replace(/_/g,"-").replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function P(e){return w(e).replace(/-/g,"")}function D(e,t,n){let o=e.get(t);if(o===void 0){e.set(t,n);return}o!==n&&e.set(t,null)}function se(e){let t=[],n=o=>{typeof o=="string"&&o.startsWith("--")&&t.push(o)};n(e.flag);for(let o of e.aliases??[])n(o);return t}function ie(e,t){let n=t??m(e),o=new Map,s=new Map,i=new Map,r=new Set;for(let a of n){let u=se(a);if(u.length===0)continue;let c=`--${w(u[0])}`;for(let d of u)D(o,w(d),c),D(s,P(d),c);let l=P(c);i.has(c)||i.set(c,l),a.list===!0&&r.add(c)}return{canonicalByNormalized:o,canonicalByCompact:s,canonicalComparables:[...i.entries()].map(([a,u])=>({canonicalFlag:a,comparable:u})),listCanonicalFlags:r}}function B(e,t){let n=w(e),o=t.canonicalByNormalized.get(n);if(typeof o=="string")return{flag:o,reason:"flag_alias",confidence:"high"};let s=n.replace(/-/g,""),i=t.canonicalByCompact.get(s);if(typeof i=="string")return{flag:i,reason:"flag_alias",confidence:"high"};let r=s.length>=8?2:1,a=Number.POSITIVE_INFINITY,u,c=!1;for(let l of t.canonicalComparables){let d=b(s,l.comparable,r);if(d!==null){if(d<a){a=d,u=l.canonicalFlag,c=!1;continue}d===a&&u!==l.canonicalFlag&&(c=!0)}}return!u||c||!Number.isFinite(a)||a<=0?null:{flag:u,reason:"flag_typo",confidence:a>=2?"medium":"high"}}function Ve(e){let t=[`${e}s`];return e.endsWith("y")&&e.length>1&&t.push(`${e.slice(0,-1)}ies`),t}function re(e,t=!1){if(t||e.includes("://"))return null;let n=e.match(/^([A-Za-z][A-Za-z0-9_-]{1,63})([:=])(.*)$/);if(!n)return null;let o=n[1],s=n[3];return s.length===0?null:{key:o,value:s}}function ae(e,t,n=!1){if(n||!e.startsWith("--"))return{tokens:[e]};let o=e.indexOf("="),s=o>=0?e.slice(0,o):e,i=o>=0?e.slice(o+1):void 0,r=B(s,t);if(!r)return{tokens:[e]};let a=i===void 0?r.flag:`${r.flag}=${i}`;return a===e?{tokens:[e]}:{tokens:[a],event:{from:e,to:[a],reason:r.reason,confidence:r.confidence}}}function ue(e){let t=new Set,n=!1;for(let o=0;o<e.length;o+=1){if(n){t.add(o),n=!1;continue}let s=e[o];n=s==="--path"||s==="--pm-path"}return t}function ce(e){if(!e.startsWith("--"))return null;let t=e.indexOf("=");return t<0?{flag:e}:{flag:e.slice(0,t),inlineValue:e.slice(t+1)}}function le(e,t,n){n.push(e[t]);let o=e[t+1];return typeof o=="string"&&o!=="--"?(n.push(o),t+2):t+1}function de(e,t,n,o){if(n.inlineValue!==void 0)return{originalTokens:[e[t]],value:n.inlineValue,consumed:1};let s=[],i=t+1;for(;i<e.length&&e[i]!=="--"&&!e[i].startsWith("-")&&(s.length===0||o.has(n.flag));)s.push(e[i]),i+=1;let r=s.length===0?1:1+s.length;return{originalTokens:e.slice(t,t+r),value:s.length===0?void 0:s.join(","),consumed:r}}function fe(e,t,n,o){let s=e.get(n);if(s){s.values.push(o.value),s.occurrences+=1;return}e.set(n,{outputIndex:t.length,originalTokens:o.originalTokens,values:[o.value],occurrences:1}),t.push(null)}function pe(e,t){let n=[],o=[];for(let[s,i]of e){if(!(i.occurrences>=2||t.has(s)&&i.originalTokens.length>2)){o.push({outputIndex:i.outputIndex,tokens:i.originalTokens});continue}let a=`${s}=${i.values.join(",")}`;o.push({outputIndex:i.outputIndex,tokens:[a]}),n.push({from:`${s} (x${i.occurrences})`,to:[a],reason:"list_merge",confidence:"high"})}return{events:n,splices:o}}function he(e,t){t.sort((n,o)=>o.outputIndex-n.outputIndex);for(let n of t)e.splice(n.outputIndex,1,...n.tokens)}function me(e,t,n=new Set,o=new Set){if(t.size===0)return{argv:[...e],events:[]};let s=[],i=new Map,r=0;for(;r<e.length;){let c=e[r];if(c==="--"){s.push(...e.slice(r));break}if(n.has(c)){r=le(e,r,s);continue}let l=ce(c);if(!l||!t.has(l.flag)){s.push(c),r+=1;continue}let d=de(e,r,l,o);if(d.value===void 0){s.push(c),r+=d.consumed;continue}fe(i,s,l.flag,{originalTokens:d.originalTokens,value:d.value}),r+=d.consumed}let{events:a,splices:u}=pe(i,o);return he(s,u),{argv:s,events:a}}var v=new Map([["--add",new Set(["command","cmd","path"])],["--remove",new Set(["command","path"])]]);function ge(e,t){if(e!=="test"||t.length<2)return!1;let n=t[t.length-1],o=t[t.length-2],s=v.get(o);return s!==void 0&&s.has(n)}function be(e,t){return e==="search"||ge(e,t)}function ye(e,t,n){if(t!=="test")return e;let o=[],s=0;for(;s<e.length;){let i=e[s];if(i==="--")return o.push(...e.slice(s)),o;let r=v.get(i),a=r?e[s+1]:void 0;if(!r||typeof a!="string"||!r.has(a)){o.push(i),s+=1;continue}let u=s+2;for(;u<e.length&&!e[u].startsWith("-");)u+=1;if(u-(s+2)!==1){o.push(i),s+=1;continue}let c=e[s+2],l=`${a}=${c}`;o.push(i,l),n.push({from:`${i} ${a} ${c}`,to:[i,l],reason:"bare_key_value",confidence:"high"}),s+=3}return o}function we(e,t,n,o){let s=[],i=ue(e);for(let r=0;r<e.length;r+=1){let a=e[r];if(a==="--"){s.push(...e.slice(r));break}let u=i.has(r),c=s[s.length-1];if(a.startsWith("--")){let d=ae(a,t,u);s.push(...d.tokens),d.event&&o.push(d.event);continue}let l=re(a,u);if(l&&!(typeof c=="string"&&c.startsWith("-"))&&!be(n,s)){let d=B(l.key,t);if(d){let p=[d.flag,l.value];s.push(...p),o.push({from:a,to:p,reason:"bare_key_value",confidence:d.confidence});continue}}s.push(a)}return s}function Me(e){let t=[],n=ne(e,t),o=ee(n);(o.length!==n.length||o.some((p,W)=>p!==n[W]))&&t.push({from:n.join(" "),to:[...o],reason:"legacy_extension_action",confidence:"high"});let s=oe(o,t),i=N(s);if(i.conflict)throw new h("Provide the item id either positionally or with --id, not both.",f.USAGE);i.changed&&t.push({from:`--id ${i.itemId}`,to:[i.itemId],reason:"item_id_alias",confidence:"high"});let r=C(i.argv),a=Ie(i.argv),u=ie(a??r),c=we(i.argv,u,r,t),l=ye(c,r,t),d=me(l,u.listCanonicalFlags,g,r==="create"?new Set(["--tags"]):new Set);for(let p of d.events)t.push(p);return{argv:d.argv,commandName:r,trace:t}}function Ie(e){let t=M(e),n=t[0]?.trim().toLowerCase(),o=t[1]?.trim().toLowerCase();return(n==="extension"||n==="package"||n==="packages")&&typeof o=="string"&&o.length>0&&!o.startsWith("-")?`${n} ${o}`:n}function Be(e){for(let t=0;t<e.length;t+=1){let n=e[t];if(n==="--")break;if(n==="--type"){let o=e[t+1];if(typeof o=="string"&&o.trim().length>0)return o.trim();continue}if(n.startsWith("--type=")){let o=n.slice(7).trim();if(o.length>0)return o}}}(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]="4973a995-60f0-5990-9927-371dc6716063")}catch{}})();function z(e){return e.trim().match(/--[a-z0-9][a-z0-9_-]*/i)?.[0]?.replaceAll("_","-").toLowerCase()}function $e(e){if(!(!Array.isArray(e)||e.length===0))return C(e)}function xe(e,t){let n=z(t);if(!n)return;let o=m(e).find(s=>s.flag===n||s.aliases?.includes(n));return o?o.value_type==="boolean"?null:`<${o.value_name??"value"}>`:"<value>"}function Re(e,t,n){let o=[...e],s=o.indexOf("--"),i=s<0?o.length:s;for(let r of n){let a=z(r);if(!a||o.slice(0,i).some(l=>l===a||l.startsWith(`${a}=`)))continue;let u=xe(t,a),c=u?[a,u]:[a];o.splice(i,0,...c),i+=c.length}return o.length===e.length?void 0:A(o)}(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]="d82065d1-488d-523e-9df2-a30056f29603")}catch{}})();(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]="5810cf1d-fc9a-597b-a47e-a914009fadfa")}catch{}})();function Je(e){return e instanceof h||e instanceof Error?e.message:"Unknown failure"}function _e(e){if(typeof e!="object"||e===null||!("exitCode"in e))return;let t=e.exitCode;return typeof t=="number"&&Number.isFinite(t)?t:void 0}function Te(e){let t=Math.trunc(e);return t>f.SUCCESS?t:f.GENERIC_FAILURE}function Ze(e){return typeof e=="object"&&e!==null&&"code"in e&&typeof e.code=="string"&&e.code.startsWith("commander.")}function He(e,t){if(e instanceof Error)return e;let n=new Error(t),o=_e(e);return o!==void 0&&(n.exitCode=Te(o)),n}(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]="8f7cca3d-9b19-53b4-a510-5290aaf75e12")}catch{}})();function ot(e){if(e===void 0)return()=>{};let t=e.trim();if(t.length===0)throw new h("--author requires a non-empty value.",f.USAGE,{code:"missing_required_argument",nextSteps:["Pass an explicit author identifier with --author <id>."]});let n=k();y(t);let o=!1;return()=>{o||(o=!0,n===void 0?y(void 0):y(n))}}import{Command as Ce}from"commander";(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]="304d0901-79d3-593d-a789-410e28d59948")}catch{}})();function at(e){return new Ce().name("pm").description("Universal, flexible, extensible, agent-optimized project management CLI for any project or programming language.").version(e).showHelpAfterError(!1).allowExcessArguments(!1).allowUnknownOption(!1).configureOutput({writeOut:t=>{E(t)},writeErr:()=>{}}).option("--json","Output JSON instead of TOON; mutations emit a flat receipt with top-level id/status/changed_field_count while reads use documented entity or collection envelopes").option("--lean","Omit null and empty containers from JSON output").option("--token-accounting","Attach a bounded per-section token-cost receipt to command output").option("--output-include <fields>","Retain comma-separated fields or sections in read output").option("--output-limit <count>","Bound rows in read output").option("--output-budget <tokens|unbounded>","Bound estimated tokens in read output or explicitly disable the default ceiling").option("--output-format <toon|json>","Select the read-output encoding").option("--output-session <state>","Carry a JSON session budget and served-item ledger across read calls").option("--output-row-contract","Include the machine-readable row selector and TOON encoding contract").option("--quiet","Suppress stdout output").option("--no-changed-fields","Omit the changed_fields array from mutation output (keeps changed_field_count)").option("--full-changed-fields","Restore the legacy full mutation envelope and changed_fields array").option("--id-only","Print only id and status for single-item mutation output").option("--pm-path <dir>","Explicit tracker storage path for this command (preferred over --path)").option("--path <dir>","Backward-compatible alias for --pm-path; this is the tracker storage path, not a workspace cwd").option("--no-extensions","Disable extension loading").option("--no-pager","Disable pager integration for help and long output").option("--explain","Render extended rationale and examples in help output").option("--profile","Print deterministic timing diagnostics").option("--author <id>","Override mutation author for this invocation").exitOverride()}(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]="71e5a870-f62f-5252-b4e9-e1a42e36009f")}catch{}})();var ke={add:["create","append"],fetch:["get"],inspect:["get","health"],log:["history","comments","notes"],ls:["list"],pause:["release"],read:["get"],remove:["delete"],rm:["delete"],show:["get"]};function Ee(e,t){let n=e.trim().toLowerCase(),o=t.trim().toLowerCase();if(o.length===0)return Number.POSITIVE_INFINITY;let s=n.split(" "),i=ke[o]?.indexOf(n);if(i!==void 0&&i>=0)return i;if(n===o)return 10;if(s.includes(o))return 11;if(s.some(u=>u.startsWith(o)))return 12;let r=o.length>=5?2:1,a=Number.POSITIVE_INFINITY;for(let u of s){let c=b(u,o,r);c!==null&&(a=Math.min(a,c))}return Number.isFinite(a)?20+a:n.includes(o)?30:Number.POSITIVE_INFINITY}function lt(e,t){return e.map(n=>({path:n,score:Ee(n,t)})).filter(n=>Number.isFinite(n.score)).sort((n,o)=>n.score!==o.score?n.score-o.score:n.path===o.path?0:n.path<o.path?-1:1).map(n=>n.path)}export{R as a,N as b,J as c,M as d,Z as e,I as f,C as g,De as h,ee as i,Ve as j,me as k,ye as l,Me as m,Be as n,$e as o,xe as p,Re as q,Je as r,_e as s,Te as t,Ze as u,He as v,ot as w,at as x,Ee as y,lt as z};
|
|
2
|
-
//# sourceMappingURL=chunk-YSVSMJ2B.js.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import"./chunk-QWRRFYK3.js";import{$a as $,$b as W,$c as ne,Ja as V,Na as N,Pb as x,Rb as q,Sb as H,Sc as Z,Tb as J,Tc as ee,Ub as z,Vc as te,Zb as G,_a as B,_b as j,ab as D,ac as Y,ad as ae,bc as K,bd as oe,cd as E,dc as X,ha as L,hb as U,id as re,zc as Q}from"./chunk-YAMTJL6Y.js";import"./chunk-XAVMOK6B.js";import"./chunk-TMJ7URWS.js";import"./chunk-WYRZZ5ZE.js";import{C as m,Cf as l,Df as d,E as b,Ol as p,Ra as _,Sd as O,Zc as R,ba as S,hh as I,nl as P,rl as c,ul as w,vc as C,vl as s,wl as k,yl as M,zl as F}from"./chunk-BBOFSVAK.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]="13159f49-7756-58b8-ac32-7ddd571e7d09")}catch{}})();var ie=new Map([["measurements","boolean"],["metric","string"],["measurementLimit","number"],["observe","string_array"],["direction","direction"],["measurementSource","string"],["measurementItem","string"],["measurementRevision","string"],["author","string"],["message","string"],["provenanceCoverage","boolean"],["fleetAttribution","boolean"],["since","string"],["eventLimit","number"],["minimumSample","number"]]),me=new Set(["higher","lower","target"]),fe=[...ie.keys()].sort((e,t)=>e.localeCompare(t)).join(", ");function pe(e,t){return e==="boolean"?typeof t=="boolean":e==="string"?typeof t=="string":e==="number"?typeof t=="number":e==="string_array"?Array.isArray(t)&&t.every(n=>typeof n=="string"):e==="direction"&&me.has(t)}function se(e){if(e===void 0)return{};let t;try{t=JSON.parse(e)}catch(n){throw new b(`--analytics must be valid JSON: ${String(n)}`,m.USAGE)}if(t===null||typeof t!="object"||Array.isArray(t))throw new b("--analytics must be a JSON object.",m.USAGE);for(let[n,a]of Object.entries(t)){let o=ie.get(n);if(!pe(o,a))throw new b(o===void 0?`Unknown --analytics field "${n}". Accepted fields: ${fe}.`:`--analytics field "${n}" must be ${o.replace("_"," ")}.`,m.USAGE)}return 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]="eee25545-a7e9-54be-abc0-dbccc9b41e74")}catch{}})();(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]="b0095f00-00bd-5b28-933c-b63a1711a73d")}catch{}})();(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]="99355d20-090b-503e-8079-b858291938e3")}catch{}})();(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]="35276f20-abc5-54e2-8251-35971f1fcb4f")}catch{}})();(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]="8fa4af33-ba9f-5a19-a359-c64143287b5d")}catch{}})();(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]="52c4154e-2761-5230-942c-6ac5e83a830c")}catch{}})();(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]="c3fceb32-e0b9-5690-8653-4c699f865c0f")}catch{}})();(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]="1e42a508-5568-522f-843d-61febc0bad27")}catch{}})();(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]="43769e60-ed80-521d-9375-c28ee5b0ac06")}catch{}})();(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]="3f1deb3b-e341-533a-a349-eca48f347600")}catch{}})();(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]="91a42861-f8cb-575b-8596-53870f6275c6")}catch{}})();(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]="c85956ff-383f-5482-96a9-0ef38949859c")}catch{}})();var le=(e,t)=>V(e,t,{runUpdate:(n,a,o)=>x(n,a,o)});(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]="41d01430-1e95-5f09-9a2f-7e7f8fad8184")}catch{}})();async function ye(e,t,n,a,o){let r=c(o),i=e==="run",u=e==="verdicts",g=e==="presets"||e==="apply",f=e==="promote",h=await N({action:e,...i||u||g||f?{}:{kind:t},id:i||u||f?n??t:n,preset:g?n??t:void 0,definition:s(a,"definition"),trigger:s(a,"trigger"),tree:s(a,"tree"),gate:s(a,"gate"),limit:s(a,"limit"),dry_run:a.dryRun===!0,fullChangedFields:r.fullChangedFields,idOnly:r.idOnly,author:s(a,"author"),message:s(a,"message"),owner:s(a,"owner"),apply:a.apply===!0,enforcement:s(a,"enforcement")},r);l(h,r),typeof h=="object"&&h!==null&&"exit_code"in h&&h.exit_code===1&&(process.exitCode=1)}function ce(e){e.command("assurance").argument("<action>","Action; inspect `pm contracts --command assurance`").argument("[kind]","Declaration kind or run gate id").argument("[id]","Declaration/gate id").description("Manage SDK-owned assurance contracts.").option("--definition <json>","Put declaration JSON").option("--trigger <value>","Gate trigger").option("--tree <value>","Revision identity").option("--gate <id>","Verdict gate filter").option("--limit <number>","Verdict limit").option("--dry-run","Evaluate without recording").option("--author <value>","Mutation author").option("--message <value>","Mutation rationale").option("--owner <item-id>","Preset/derivation owner").option("--apply","Persist derived proposals").option("--enforcement <level>","Promote to warn or block").action(ye)}(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]="7796ea07-0de7-5db8-a3b5-a8021ceebc69")}catch{}})();function ge(e,t){let n=e?.trim().toLowerCase(),a=t?.trim().toLowerCase();if(n===void 0||n.length===0)return a;if(n==="local-analytics")return a&&a.length>0?a:"status";if(a!==void 0&&a.length>0)throw S({command_path:"telemetry",token:`${e} ${t}`,allowed:["status","flush","stats","clear","local-analytics"],token_kind:"path",examples:["pm telemetry stats --limit 10","pm telemetry local-analytics status --json"]});return n}function he(e){return{addValues:Array.isArray(e.add)?e.add:[],addJsonValues:Array.isArray(e.addJson)?e.addJson:[],removeValues:Array.isArray(e.remove)?e.remove:[],removeIndexValues:Array.isArray(e.removeIndex)?e.removeIndex:[]}}function be(e,t){if(e.background===!0){if(e.run!==!0)throw new b("--background requires --run",m.USAGE);if(t.addValues.length>0||t.addJsonValues.length>0||t.removeValues.length>0||t.removeIndexValues.length>0)throw new b("--background does not support --add/--add-json/--remove/--remove-index; update linked tests first, then run in background",m.USAGE)}}async function we(e,t,n,a){let o=await E({kind:"test",commandArgs:M(e,{...t,add:a.addValues,addJson:a.addJsonValues,remove:a.removeValues,removeIndex:a.removeIndexValues}),targetId:e,author:typeof t.author=="string"?t.author:void 0,noExtensions:n.noExtensions===!0},n);l(o,n)}function ke(e,t){return{add:t.addValues,addJson:t.addJsonValues,remove:t.removeValues,removeIndex:t.removeIndexValues,list:!!e.list,run:!!e.run,match:typeof e.match=="string"?e.match:void 0,onlyIndex:typeof e.onlyIndex=="string"||typeof e.onlyIndex=="number"?e.onlyIndex:void 0,onlyLast:!!e.onlyLast,timeout:typeof e.timeout=="string"?e.timeout:void 0,progress:!!e.progress,envSet:Array.isArray(e.envSet)?e.envSet:[],envClear:Array.isArray(e.envClear)?e.envClear:[],sharedHostSafe:!!e.sharedHostSafe,pmContext:typeof e.pmContext=="string"?e.pmContext:void 0,overrideLinkedPmContext:!!e.overrideLinkedPmContext,failOnContextMismatch:!!e.failOnContextMismatch,failOnSkipped:!!e.failOnSkipped,failOnEmptyTestRun:!!e.failOnEmptyTestRun,requireAssertionsForPm:!!e.requireAssertionsForPm,checkContext:!!e.checkContext,autoPmContext:!!e.autoPmContext,author:typeof e.author=="string"?e.author:void 0,message:typeof e.message=="string"?e.message:void 0,force:!!e.force,measure:Array.isArray(e.measure)?e.measure:[],metricBelow:typeof e.metricBelow=="string"?e.metricBelow:void 0,metricDiff:typeof e.metricDiff=="string"?e.metricDiff:void 0}}async function ve(e,t,n,a){let o=await ne(e,ke(t,a),n);(a.addValues.length>0||a.addJsonValues.length>0||a.removeValues.length>0||t.run===!0||a.removeIndexValues.length>0)&&await p(n,o),l(o,n),(o.run_results.some(r=>r.status==="failed")||o.fail_on_skipped_triggered===!0)&&(process.exitCode=m.DEPENDENCY_FAILED)}async function xe(e,t,n){let a=c(n),o=Date.now(),r=he(t);be(t,r),t.background===!0?await we(e,t,a,r):await ve(e,t,a,r),a.profile&&d(`profile:command=test took_ms=${Date.now()-o}`)}function A(e){let t=s(e,"author"),n=s(e,"assignee");if(t!==void 0&&n!==void 0&&t!==n)throw new b("Lifecycle ownership received conflicting --author and --assignee values; use one actor value for both aliases.",m.USAGE,{code:"conflicting_lifecycle_owner",examples:["pm claim pm-123","pm start-task pm-123","pm release pm-123"]});return{author:t??n,message:s(e,"message")}}async function Ae(e,t){let n=c(t),a=Date.now();if(e.background===!0){let i=await E({kind:"test-all",commandArgs:F(e),statusFilter:s(e,"status"),noExtensions:n.noExtensions===!0},n);l(i,n),n.profile&&d(`profile:command=test-all took_ms=${Date.now()-a}`);return}let r=await ae({status:s(e,"status"),limit:s(e,"limit"),offset:s(e,"offset"),timeout:s(e,"timeout"),progress:!!e.progress,envSet:Array.isArray(e.envSet)?e.envSet:[],envClear:Array.isArray(e.envClear)?e.envClear:[],sharedHostSafe:!!e.sharedHostSafe,pmContext:s(e,"pmContext"),overrideLinkedPmContext:!!e.overrideLinkedPmContext,failOnContextMismatch:!!e.failOnContextMismatch,failOnSkipped:!!e.failOnSkipped,failOnEmptyTestRun:!!e.failOnEmptyTestRun,requireAssertionsForPm:!!e.requireAssertionsForPm,checkContext:!!e.checkContext,autoPmContext:!!e.autoPmContext},n);await p(n,{ids:r.results.map(i=>i.id)}),l(r,n),(r.failed>0||r.fail_on_skipped_triggered===!0)&&(process.exitCode=m.DEPENDENCY_FAILED),n.profile&&d(`profile:command=test-all took_ms=${Date.now()-a}`)}async function _e(e,t,n,a){let o=c(a),r=Date.now(),i=await te({subcommand:ge(e,t),limit:s(n,"limit")},o);l(i,o),o.profile&&d(`profile:command=telemetry took_ms=${Date.now()-r}`)}async function Ie(e,t){let n=c(t),a=Date.now(),o=se(s(e,"analytics")),r=await Z(n,{includeEmpty:e.includeEmpty===!0,storage:e.storage===!0,metadataCoverage:e.metadataCoverage===!0,byAssignee:e.byAssignee===!0,byTag:e.byTag===!0,byPriority:e.byPriority===!0,tagPrefix:s(e,"tagPrefix"),fieldUtilization:e.fieldUtilization===!0,...o});r.recorded_observations?.some(i=>i.changed)===!0&&await p(n,{ids:r.recorded_observations?.flatMap(i=>i.observation.item_id?[i.observation.item_id]:[])}),l(r,n),n.profile&&d(`profile:command=stats took_ms=${Date.now()-a}`)}async function De(e,t){let n=c(t),a=Date.now(),o=s(e,"threshold"),r=s(e,"limit"),i=await ee(n,{status:Array.isArray(e.status)&&e.status.length>0?e.status:void 0,since:s(e,"since"),...o===void 0?{}:{threshold:Number(o)},...r===void 0?{}:{limit:Number(r)}});l(i,n),n.profile&&d(`profile:command=duplicates took_ms=${Date.now()-a}`)}async function Se(e,t){let n=c(t),a=Date.now(),o=await L(n,{strictDirectories:!!e.strictDirectories,requireMergeDrivers:!!e.requireMergeDrivers,checkOnly:!!e.checkOnly,checkTelemetry:!!e.checkTelemetry,noRefresh:!!e.noRefresh,refreshVectors:!!e.refreshVectors,verboseStaleItems:!!e.verboseStaleItems,verboseAuthorEvents:!!e.verboseAuthorEvents,brief:!!e.brief,summary:!!e.summary,skipVectors:!!e.skipVectors,skipIntegrity:!!e.skipIntegrity,skipDrift:!!e.skipDrift,full:!!e.full});l(o,n),(e.strictExit||e.failOnWarn)&&!o.ok&&(C({...o,exit_code:m.GENERIC_FAILURE,error_code:"health_findings",error_category:"validation",command_resolution:"health_findings",resolution_stage:"execute"}),process.exitCode=m.GENERIC_FAILURE),n.profile&&d(`profile:command=health took_ms=${Date.now()-a}`)}async function Ce(e,t){let n=c(t),a=Date.now(),o=await le({checkMetadata:!!e.checkMetadata,metadataProfile:s(e,"metadataProfile"),checkResolution:!!e.checkResolution,checkLifecycle:!!e.checkLifecycle,checkStaleBlockers:!!e.checkStaleBlockers,dependencyCycleSeverity:s(e,"dependencyCycleSeverity"),parentCycleSeverity:s(e,"parentCycleSeverity"),checkFiles:!!e.checkFiles,checkCommandReferences:!!e.checkCommandReferences,scanMode:s(e,"scanMode"),includePmInternals:!!e.includePmInternals,verboseFileLists:!!e.verboseFileLists,verboseDiagnostics:!!e.verboseDiagnostics,allAffectedIds:!!e.allAffectedIds,checkHistoryDrift:!!e.checkHistoryDrift,checkStorageIntegrity:!!e.checkStorageIntegrity,fixHints:!!e.fixHints,autoFix:!!e.autoFix,dryRun:!!e.dryRun,fixScope:Array.isArray(e.fixScope)?e.fixScope:void 0,pruneMissing:!!e.pruneMissing,counts:!!e.counts,full:!!e.full},n);l(o,n),(e.strictExit||e.failOnWarn)&&(o.has_warnings||!o.ok)&&(C({...o,exit_code:m.GENERIC_FAILURE,error_code:"validation_findings",error_category:"validation",command_resolution:"validation_findings",resolution_stage:"execute"}),process.exitCode=m.GENERIC_FAILURE),n.profile&&d(`profile:command=validate took_ms=${Date.now()-a}`)}async function Re(e,t){let n=c(t),a=Date.now(),o=await q(n,{dryRun:e.dryRun===!0,scope:Array.isArray(e.scope)?e.scope:[]});l(o,n),n.profile&&d(`profile:command=gc took_ms=${Date.now()-a}`)}async function Be(e,t,n,a){let o=c(a),r=_(process.cwd(),o.path),i=e.trim().toLowerCase();if(!["create","list","inspect","restore","delete"].includes(i))throw S({command_path:"workspace snapshot",token:e,allowed:["create","list","inspect","restore","delete"],display_name:"workspace snapshot",token_kind:"action",examples:["pm workspace snapshot create before-migration","pm workspace snapshot restore before-migration"]});if(i==="list"){l(await W(r),o);return}if(i==="create"){l(await G(r,t===void 0?{}:{name:t}),o);return}if(t===void 0)throw new b(`pm workspace snapshot ${i} requires a snapshot name or fingerprint`,m.USAGE);if(i==="inspect"){l(await j(r,t),o);return}if(i==="restore"){if(n.dryRun===!0){l(await Y(r,t),o);return}let u=await I(r);l(await K(r,t,{force:n.force===!0,author:O(s(n,"author"),u.author_default),message:s(n,"message"),lockTtlSeconds:u.locks.ttl_seconds,lockWaitMs:u.locks.wait_ms}),o);return}l(await X(r,t),o)}async function Ee(e,t){let n=c(t),a=Date.now(),o=await Q({action:s(e,"action"),command:s(e,"command"),summary:!!e.summary,schemaOnly:!!e.schemaOnly,flagsOnly:!!e.flagsOnly,availabilityOnly:!!e.availabilityOnly,runtimeOnly:!!e.runtimeOnly||!!e.activeOnly,full:!!e.full},n);l(o,n),n.profile&&d(`profile:command=contracts took_ms=${Date.now()-a}`)}async function Te(e,t,n){let a=c(n),o=Date.now(),r={...A(t),ifAvailable:t.ifAvailable===!0,maxAttempts:t.maxAttempts};Oe(e,t.next===!0);let i=t.next===!0?await $(!!t.force,a,r,{type:typeof t.type=="string"?t.type:void 0,tag:typeof t.tag=="string"?t.tag:void 0,priority:t.priority,assigneeFilter:typeof t.assigneeFilter=="string"?t.assigneeFilter:void 0,parent:typeof t.parent=="string"?t.parent:void 0,sprint:typeof t.sprint=="string"?t.sprint:void 0,release:typeof t.release=="string"?t.release:void 0,includeDecisions:t.includeDecisions===!0,tokenBudget:t.tokenBudget??t.token_budget,explainRanking:t.explainRanking===!0||t.explain_ranking===!0}):await B(e,!!t.force,a,r);await p(a,i),l(i,a),a.profile&&d(`profile:command=claim took_ms=${Date.now()-o}`)}function Oe(e,t){if(!t&&!e)throw new b("Specify an item id or pass --next",m.USAGE);if(t&&e)throw new b("Specify either an item id or --next, not both",m.USAGE)}async function Pe(e,t,n){let a=c(n),o=Date.now(),r=await D(e,!!t.force,a,{...A(t),ownershipReleaseBypass:t.ownershipReleaseBypass===!0});await p(a,r),l(await P("release",[e],t,a,r),a),a.profile&&d(`profile:command=release took_ms=${Date.now()-o}`)}async function Me(e,t,n){let a=c(n),o=Date.now(),r=_(process.cwd(),a.path),i=await I(r),u=R(i.schema),g=oe(u),f=!!t.force,h=A(t),v=await B(e,f,a,h);await p(a,v);let T=await x(e,{...h,status:g,force:f},a);await p(a,T),l({id:e,action:"start_task",claim:v,update:T},a),a.profile&&d(`profile:command=start-task took_ms=${Date.now()-o}`)}async function Fe(e,t,n){let a=c(n),o=Date.now(),r=_(process.cwd(),a.path),i=await I(r),u=R(i.schema),g=!!t.force,f=A(t),h=await x(e,{...f,status:u.open_status,force:g},a);await p(a,h);let v=await D(e,g,a,f);await p(a,v),l({id:e,action:"pause_task",update:h,release:v},a),a.profile&&d(`profile:command=pause-task took_ms=${Date.now()-o}`)}async function Le(e,t,n,a){let o=c(a),r=Date.now(),i=!!n.force,u=A(n),g=await U(e,t,{...u,validateClose:s(n,"validateClose"),force:i},o);await p(o,g);let f=await D(e,i,o,u);await p(o,f),l({id:e,action:"close_task",close:g,release:f},o),o.profile&&d(`profile:command=close-task took_ms=${Date.now()-r}`)}function de(e){return e.option("--background","Run linked tests in managed background mode").option("--timeout <seconds>","Default run timeout in seconds").option("--progress","Emit linked-test progress to stderr (always shown in TTY, opt-in for non-TTY)").option("--env-set <value>","Set environment variable(s) for linked-test runs (KEY=VALUE, repeatable)",w).option("--env-clear <value>","Clear environment variable(s) for linked-test runs (NAME, repeatable)",w).option("--shared-host-safe","Apply additive shared-host-safe runtime defaults for linked-test runs").option("--pm-context <mode>","PM linked-test context mode: schema|tracker|auto (default: schema)").option("--override-linked-pm-context","Force run-level --pm-context to override per-linked-test pm_context_mode metadata").option("--fail-on-context-mismatch","Fail linked PM commands when context item counts differ").option("--fail-on-skipped","Treat skipped linked tests as dependency failures").option("--fail-on-empty-test-run","Treat successful linked-test commands that report zero executed tests as failures").option("--require-assertions-for-pm","Require assertion metadata for linked PM command tests").option("--check-context","Preflight linked PM command context diagnostics before executing commands").option("--auto-pm-context","Auto-remediate PM tracker-read context mismatches by routing those linked commands through tracker context")}function Lt(e){ce(e);let t=e.command("test").argument("<id>","Item id").option("--add <value>","Add linked test entry (CSV/markdown pairs or - for stdin)",w).option("--add-json <value>","Add linked test entry from JSON object/array (or - for stdin)",w).option("--remove <value>","Remove linked test entry by exact command/path (command=<value> and path=<value> preserve commas and equals signs; or - for stdin)",w).option("--remove-index <n>","Remove the 1-based linked-test index from --list order (repeatable)",w).option("--list","List linked tests without mutating").option("--run","Run linked test commands").option("--match <value>","Run only linked tests whose command/path contains this substring").option("--only-index <n>","Run only the 1-based linked-test index from --list order").option("--only-last","Run only the most recently added linked test");de(t).option("--measure <value>","Record name=value[,unit=...][,threshold=...] evidence; repeatable",w).option("--metric-below <value>","Return evidence below name=value").option("--metric-diff <name>","Diff the latest two values").option("--author <value>","Mutation author").option("--message <value>","History message").option("--force","Force ownership override").description("Manage tests linked to an item and optionally run them.").action(xe);let n=e.command("test-all").description("Run linked tests across matching items.").option("--status <value>","Filter items by status before running tests").option("--limit <n>","Limit matching items before running linked tests").option("--offset <n>","Skip matching items before running linked tests");de(n).action(Ae),e.command("test-runs-worker",{hidden:!0}).argument("<runId>","Background run id").description("Internal background worker command.").action(async(g,f,h)=>{let v=c(h);await re(g,v)}),e.command("telemetry").argument("[namespaceOrSubcommand]","Telemetry subcommand: status, flush, stats, clear (default: status)").argument("[subcommand]","Compatibility alias target for local-analytics: status, flush, stats, clear").option("--limit <n>","Maximum command groups returned by telemetry stats").description("Inspect and manage local telemetry queue/runtime state.").action(_e),e.command("duplicates").description("Find existing duplicate clusters across all statuses without creating an item.").option("--status <value>","Lifecycle status to include (repeatable or comma-separated)",w,[]).option("--since <value>","Only inspect items created at or after this time").option("--threshold <value>","Minimum similarity score from 0 through 1").option("--limit <n>","Maximum duplicate clusters to return").action(De),e.command("stats").description("Show project tracker statistics.").option("--include-empty","Restore zero-count registered item-type and lifecycle-status buckets").option("--storage","Include aggregate history-stream storage metrics (total streams/lines/bytes, largest + deepest streams, oldest/newest entries)").option("--metadata-coverage","Include metadata coverage % (acceptance_criteria, estimated_minutes, resolution, tags, parent) overall and by type").option("--by-assignee","Include a lifecycle-bucketed item breakdown grouped by assignee").option("--by-tag","Include a lifecycle-bucketed item breakdown grouped by tag").option("--by-priority","Include a lifecycle-bucketed item breakdown grouped by priority").option("--tag-prefix <value>","With --by-tag: only count tags starting with this prefix (e.g. domain:)").option("--field-utilization","Report content-field utilization rates (notes/learnings/files/docs/tests/comments/deps/body) for governance analysis").option("--analytics <json>","Improvement ledger/history analytics JSON").action(Ie),e.command("health").description("Show project tracker health checks.").option("--strict-directories","Treat optional item-type directories as required failures").option("--require-merge-drivers","Treat absent clone-local merge drivers as a required health failure").option("--check-only","Run read-only health diagnostics without refreshing vectors").option("--check-telemetry","Probe telemetry endpoint health and include network diagnostics").option("--no-refresh","Disable automatic vector refresh attempts during health checks").option("--refresh-vectors","Explicitly enable vector refresh attempts during health checks").option("--verbose-stale-items","Include full stale vectorization ID lists in health output").option("--verbose-author-events","Include every actionable unknown-author event coordinate for review or disposition").option("--brief","Emit compact health details for low-token agent checks").option("--summary","Emit one-line-style health status with check names and warning count").option("--skip-vectors","Skip vectorization check for a faster run").option("--skip-integrity","Skip item/history file integrity check for a faster run").option("--skip-drift","Skip history drift hash check for a faster run").option("--full","Run all checks including slow integrity, drift, and vectorization checks").option("--strict-exit","Return non-zero exit when health is not ok (advisory telemetry warnings are excluded; see warnings[])").option("--fail-on-warn","Alias for --strict-exit").action(Se),e.command("validate").description("Run standalone metadata, resolution, lifecycle, files, linked-command reference, and history drift validation checks.").option("--check-metadata","Run metadata completeness checks").option("--metadata-profile <value>","Select metadata validation profile for --check-metadata (core|strict|custom)").option("--check-resolution","Run closed-item resolution metadata checks").option("--check-lifecycle","Run active-item lifecycle governance drift checks").option("--check-stale-blockers","Include stale blocker-pattern diagnostics in lifecycle checks").option("--dependency-cycle-severity <value>","Set dependency-cycle warning policy for lifecycle checks (off|warn|error)").option("--parent-cycle-severity <value>","Set parent-hierarchy cycle warning policy for lifecycle checks (off|warn|error)").option("--check-files","Run linked-file and orphaned-file checks").option("--check-command-references","Run linked-command PM-ID reference checks").option("--scan-mode <value>","Select file candidate scan mode for --check-files (default|tracked-all|tracked-all-strict)").option("--include-pm-internals","Include PM storage internals in tracked-all candidate scans").option("--verbose-file-lists","Include full file-path lists for validate --check-files details").option("--verbose-diagnostics","Include full validate diagnostic ID lists instead of compact summaries").option("--all-affected-ids","Emit complete missing_* affected-ID lists with no truncation (implied by --json)").option("--strict-exit","Return non-zero exit when validation warnings are present").option("--fail-on-warn","Alias for --strict-exit").option("--fix-hints","Add a machine-executable fix_hints[] of pm commands to each failing check's details").option("--auto-fix","Apply the safe, deterministic subset of fix-hint remediations (field backfills) automatically").option("--dry-run","Preview planned --auto-fix/--prune-missing fixes without applying them").option("--fix-scope <scope>","Grant --auto-fix scopes (metadata, resolution, lifecycle; comma-separated or repeatable). Default: metadata, resolution; lifecycle must be named explicitly",w).option("--prune-missing","Remove stale linked-file/doc LINKS whose paths classified as deleted (never touches real files)").option("--check-history-drift","Run item/history hash drift checks").option("--check-storage-integrity","Run the post-merge storage-integrity check (unreadable items, history conflict markers, resurrected deletes, unparseable config/schema)").option("--counts","Keep validation counts and totals while omitting per-item diagnostic arrays").option("--full","Return the complete validation diagnostic projection").action(Ce),e.command("gc").option("--dry-run","Preview cleanup targets without deleting files; without this flag, pm gc deletes matched artifacts").option("--scope <value>","Limit cleanup to one or more scopes (comma-separated or repeatable): index, embeddings, runtime, locks, checkpoints, transactions",w).description("Delete optional cache artifacts by default (including expired lock debris) and show a summary.").action(Re),e.command("workspace").description("Manage portable workspace-level SDK primitives.").command("snapshot").argument("<action>","Snapshot action: create, list, inspect, restore, delete").argument("[target]","Optional name for create; name or fingerprint otherwise").description("Create, inspect, list, restore, or delete content-addressed tracker snapshots.").option("--dry-run","Preview restore file, item, stream, and history-entry impact without mutating state").option("--force","Explicitly confirm a whole-workspace snapshot restore").option("--author <value>","Actor recorded on the restore audit event").option("--message <value>","Human-readable restore rationale").action(Be),e.command("contracts").description("Show machine-readable command and schema contracts for agents.").option("--action <value>","Filter tool schema branches to a specific action").option("--command <value>","Scope contracts output to one CLI command (narrow-by-default)").option("--summary","Return one command+intent row per top-level command for cheap agent bootstrap").option("--schema-only","Return schema-focused output only").option("--flags-only","Return command flag contracts only").option("--availability-only","Return action availability surface only").option("--runtime-only","Include only actions invocable in the current runtime").option("--active-only","Alias for --runtime-only").option("--full","Include full schema and command-flag surfaces (large; default brief output omits heavy sections for unfiltered queries)").action(Ee);let a=e.command("claim").argument("[id]","Item id (omit with --next)").option("--author <value>","Mutation author").option("--message <value>","History message").option("--force","Force claim override").option("--if-available","Skip silently when the item is already claimed by another author (returns skipped=true)").option("--next","Atomically claim the next caller-available actionable item").option("--type <value>","Filter --next candidates by type").option("--tag <value>","Filter --next candidates by tag").option("--priority <value>","Filter --next candidates by priority").option("--assignee-filter <value>","Filter --next candidates: assigned|unassigned").option("--parent <id>","Scope --next candidates to a subtree").option("--sprint <value>","Filter --next candidates by sprint").option("--release <value>","Filter --next candidates by release").option("--max-attempts <n>","Bound the --next candidate walk (default 10; maximum 100)").option("--include-decisions","Allow --next to claim human-gated Decision items").option("--token-budget <n>","Bound the estimated tokens used to rank --next candidates").option("--explain-ranking","Include ranking provenance for --next selection").description("Claim an item for active work.").action(Te);k(a,"--assignee <value>","Alias for --author on lifecycle ownership commands"),k(a,"--token_budget <n>","Alias for --token-budget"),k(a,"--explain_ranking","Alias for --explain-ranking");let o=e.command("release").argument("<id>","Item id").option("--author <value>","Mutation author").option("--message <value>","History message").option("--force","Force release override").description("Release an item's active claim.").action(Pe);k(o,"--assignee <value>","Alias for --author on lifecycle ownership commands");let r=e.command("start-task").argument("<id>","Item id").option("--author <value>","Mutation author").option("--message <value>","History message").option("--force","Force ownership or terminal override when required").description("Lifecycle alias: claim an item and move it to in_progress.").action(Me);k(r,"--assignee <value>","Alias for --author on lifecycle ownership commands");let i=e.command("pause-task").argument("<id>","Item id").option("--author <value>","Mutation author").option("--message <value>","History message").option("--force","Force ownership override when required").description("Lifecycle alias: move an item to open and release its claim.").action(Fe);k(i,"--assignee <value>","Alias for --author on lifecycle ownership commands");let u=e.command("close-task").argument("<id>","Item id").argument("[reason]","Close reason text").option("--author <value>","Mutation author").option("--message <value>","History message").option("--validate-close <value>","Close-time validation mode: off|warn|strict").option("--force","Force ownership or terminal override when required").description("Lifecycle alias: close an item and release assignment metadata.").action(Le);k(u,"--assignee <value>","Alias for --author on lifecycle ownership commands"),Ve(e)}function y(e){return typeof e=="string"?e:void 0}function ue(e){return{parent:y(e.parent),allowMissingParent:e.allowMissingParent===!0?!0:void 0,tags:y(e.tags),priority:y(e.priority),body:y(e.body),description:y(e.description),author:y(e.author),message:y(e.message)}}function Ve(e){for(let{name:t,describe:n}of[{name:"meet",describe:"Shortcut: create a Meeting with a start time and duration."},{name:"event",describe:"Shortcut: create an Event with a start time and duration."}])e.command(t).argument("<title>","Item title").option("--start <when>","Start time (ISO, 'now', or relative like +1h/+2d); defaults to now").option("--duration <span>","Duration from start (relative like 1h/2d); defaults to 1h when --end is omitted").option("--end <when>","End time (ISO or relative); overrides --duration").option("--location <value>","Location").option("--timezone <value>","IANA timezone (for example America/New_York)").option("--all-day","Mark as an all-day event").option("--parent <id>","Parent item id").option("--allow-missing-parent","Permit a parent id that does not exist yet").option("--tags <list>","Comma-separated tags").option("--priority <value>","Priority").option("--body <text>","Body/markdown content").option("--description <text>","Short description").option("--author <value>","Mutation author").option("--message <value>","History message").description(n).action(async(a,o,r)=>{let i=c(r),u=Date.now(),f=await(t==="meet"?H:J)(a,{...ue(o),start:y(o.start),duration:y(o.duration),end:y(o.end),location:y(o.location),timezone:y(o.timezone),allDay:o.allDay===!0?!0:void 0},i);await p(i,f),l(f,i),i.profile&&d(`profile:command=${t} took_ms=${Date.now()-u}`)});e.command("remind").argument("<title>","Item title").option("--at <when>","Reminder time (ISO, 'now', or relative like +2d); defaults to +1d").option("--text <value>","Reminder text; defaults to the title").option("--parent <id>","Parent item id").option("--allow-missing-parent","Permit a parent id that does not exist yet").option("--tags <list>","Comma-separated tags").option("--priority <value>","Priority").option("--body <text>","Body/markdown content").option("--description <text>","Short description").option("--author <value>","Mutation author").option("--message <value>","History message").description("Shortcut: create a Reminder from a single point in time.").action(async(t,n,a)=>{let o=c(a),r=Date.now(),i=await z(t,{...ue(n),at:y(n.at),text:y(n.text)},o);await p(o,i),l(i,o),o.profile&&d(`profile:command=remind took_ms=${Date.now()-r}`)})}export{Lt as registerOperationCommands,Oe as requireClaimTarget};
|
|
2
|
-
//# sourceMappingURL=register-operations-4R6I7CPY.js.map
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import{d as kt,e as N,g as Fe,h as xt,j as $}from"./chunk-SM7MTG27.js";import{Z as de,Za as ce,ka as R,l as oe,ob as bt,pb as wt,rb as ae,ta as Pe,xb as vt}from"./chunk-PGXJQLCT.js";import{F as Q,L as Z,O as ee,Ra as ne,da as E,ia as te,p as Y,r as $e,s as q,t as B,v as gt}from"./chunk-K7RWWOAG.js";import{b as se,d as je,f as A,g as ie,h as ht,i as mt,j as yt,k as _t}from"./chunk-ZM6TZVHC.js";import{Ha as re,Y as w,Z as v,aa as U,la as Me}from"./chunk-Q4YY3XNF.js";import{constants as z}from"node:fs";import{lstat as Et,mkdir as qe,open as Tt}from"node:fs/promises";import C 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]="bb5dfa6f-b60f-55f2-ae17-3dbcaaff1b47")}catch{}})();function Ge(e,t){if(typeof e!="string"||e.trim().length===0)throw new TypeError(`Relationship event ${t} must be non-empty`);return e.trim()}function Be(e,t){let r=t.require(e.kind),n=r.direction==="undirected"?[e.source,e.target].sort().join("\0"):`${e.source}\0${e.target}`;return`${r.kind}\0${n}`}function Sn(e){return Object.freeze({...e,...e.payload===void 0?{}:{payload:Object.freeze(structuredClone(e.payload))}})}function Rn(e,t,r,n){let s=r.require(e.kind),i=n.outgoingOne.get(`${s.kind}\0${e.source}`);if(i!==void 0&&i!==t)throw new TypeError(`Relationship outgoing cardinality exceeded for ${s.kind}`);let o=n.incomingOne.get(`${s.kind}\0${e.target}`);if(o!==void 0&&o!==t)throw new TypeError(`Relationship incoming cardinality exceeded for ${s.kind}`);let d=Be(e,r),c=n.identities.get(d);if(c!==void 0&&c!==t)throw new TypeError(`Relationship edge already active: ${d}`)}function Dn(e){let t=new Map;for(let r of e)r.action==="remove"?t.delete(r.relationshipId):t.set(r.relationshipId,r.edge);return t}function On(e,t,r){if(e.expectedVersion!==void 0&&e.expectedVersion!==t)throw new TypeError(`Relationship event version conflict: expected ${e.expectedVersion}, current ${t}`);let n=Ge(e.eventId,"eventId");if(r.has(n))throw new TypeError(`Relationship event already exists: ${n}`);if(e.action!=="add"&&e.action!=="remove"&&e.action!=="supersede")throw new TypeError(`Unknown relationship event action: ${e.action}`);if(!Number.isFinite(Date.parse(e.timestamp)))throw new TypeError("Relationship event timestamp must be valid");return{eventId:n,relationshipId:Ge(e.relationshipId,"relationshipId"),author:Ge(e.author,"author"),timestamp:new Date(e.timestamp).toISOString()}}function Ln(e,t,r,n,s,i){let o=r.has(t);if(e.action==="add"&&o)throw new TypeError(`Relationship is already active: ${t}`);if(e.action!=="add"&&!o)throw new TypeError(`Relationship is not active: ${t}`);if(e.action==="remove")return;if(!e.edge)throw new TypeError(`Relationship ${e.action} event requires an edge`);let d=typeof e.edge.source=="string"?e.edge.source.trim():"",c=typeof e.edge.target=="string"?e.edge.target.trim():"";if(!n.has(d)||!n.has(c))throw new TypeError(`Relationship endpoint not found: ${d} -> ${c}`);let a=new te([d,c],[e.edge],s).edges()[0];return Rn(a,t,s,i),Sn(a)}var Ue=class{#e;#n;#r=[];#i=new Set;#t=new Map;#s={identities:new Map,outgoingOne:new Map,incomingOne:new Map};constructor(t,r={}){this.#e=new Set([...t].filter(n=>typeof n=="string").map(n=>n.trim()).filter(Boolean)),this.#n=r.registry??E()}get version(){return this.#r.length}events(){return Object.freeze([...this.#r])}*stream(t={}){let r=t.fromVersion??1,n=t.toVersion??this.version,s=t.batchSize??100;if(!Number.isInteger(r)||r<1)throw new TypeError("Relationship event stream fromVersion must be positive");if(!Number.isInteger(n)||n<0||n>this.version)throw new TypeError(`Relationship event stream toVersion out of range: ${n}`);if(!Number.isInteger(s)||s<1)throw new TypeError("Relationship event stream batchSize must be positive");if(r>n+1)throw new TypeError("Relationship event stream fromVersion exceeds the selected prefix");for(let i=r-1;i<n;i+=s)yield Object.freeze(this.#r.slice(i,Math.min(i+s,n)))}project(t,r,n={}){if(typeof r!="function")throw new TypeError("Relationship event projection requires a reducer");let s=t,i=0,o;for(let d of this.stream({...n,batchSize:256}))for(let c of d)s=r(s,c),i+=1,o=c;return Object.freeze({state:s,version:o?.sequence??Math.max(0,(n.fromVersion??1)-1),processed:i,...o===void 0?{}:{asOf:o.timestamp}})}#o(t,r){let n=this.#n.require(r.kind);this.#s.identities.set(Be(r,this.#n),t),n.outgoing==="one"&&this.#s.outgoingOne.set(`${n.kind}\0${r.source}`,t),n.incoming==="one"&&this.#s.incomingOne.set(`${n.kind}\0${r.target}`,t)}#d(t){let r=this.#n.require(t.kind);this.#s.identities.delete(Be(t,this.#n)),r.outgoing==="one"&&this.#s.outgoingOne.delete(`${r.kind}\0${t.source}`),r.incoming==="one"&&this.#s.incomingOne.delete(`${r.kind}\0${t.target}`)}append(t){let r=On(t,this.version,this.#i),n=this.#t.get(r.relationshipId),s=Ln(t,r.relationshipId,this.#t,this.#e,this.#n,this.#s),i=Object.freeze({eventId:r.eventId,relationshipId:r.relationshipId,action:t.action,...s===void 0?{}:{edge:s},author:r.author,timestamp:r.timestamp,...t.reason?.trim()?{reason:t.reason.trim()}:{},sequence:this.version+1});return this.#r.push(i),this.#i.add(r.eventId),n&&this.#d(n),t.action==="remove"?this.#t.delete(r.relationshipId):(this.#t.set(r.relationshipId,s),this.#o(r.relationshipId,s)),i}snapshot(t={}){if(t.atVersion!==void 0&&t.atTimestamp!==void 0)throw new TypeError("Relationship snapshot accepts one target");let r;if(t.atTimestamp!==void 0){let i=Date.parse(t.atTimestamp);if(!Number.isFinite(i))throw new TypeError("Relationship snapshot timestamp must be valid");r=this.#r.filter(o=>Date.parse(o.timestamp)<=i)}else{let i=t.atVersion??this.version;if(!Number.isInteger(i)||i<0||i>this.version)throw new TypeError(`Relationship snapshot version out of range: ${i}`);r=this.#r.slice(0,i)}let n=Dn(r),s=new te(this.#e,n.values(),this.#n);return Object.freeze({version:r.at(-1)?.sequence??0,...r.at(-1)?{asOf:r.at(-1).timestamp}:{},edges:s.edges(),graph:s})}page(t){if(!Number.isInteger(t.limit)||t.limit<1)throw new TypeError("Relationship event page limit must be positive");let r=A("relationship-events",{order:"append-sequence"}),n=t.cursor===void 0?this.version:Number(ht(t.cursor,r).snapshot);if(!Number.isSafeInteger(n)||n<0||n>this.version)throw new TypeError("Relationship event cursor snapshot version is invalid");let s=_t(this.#r.slice(0,n),{cursor:t.cursor,fingerprint:r,limit:t.limit,readId:i=>i.eventId,snapshot:String(n)});return{version:n,events:s.rows,hasMore:s.has_more,...s.next_cursor?{nextCursor:s.next_cursor}:{}}}},An="relationship-event-store",Ct=z.O_NOFOLLOW;function ue(e){return de(e,An,30,`relationship-store:${process.pid}`,!1,!1,3e3)}async function D(e,t="relationships/events.jsonl"){let r=C.resolve(e),n=C.resolve(r,t),s=C.relative(r,n);if(s.length===0)throw new TypeError("Relationship event path must name a file within the tracker root");if(s===".."||s.startsWith(`..${C.sep}`)||C.isAbsolute(s))throw new TypeError("Relationship event path must stay within the tracker root");if(await qe(r,{recursive:!0}),(await Et(r)).isSymbolicLink())throw new TypeError("Relationship event tracker root must not be a symbolic link");let o=r;for(let d of s.split(C.sep)){o=C.join(o,d);try{if((await Et(o)).isSymbolicLink())throw new TypeError("Relationship event path must not contain symbolic links")}catch(c){if($e(c))break;throw c}}return n}async function le(e,t,r){let n=new Ue(t,{registry:r}),s,i;try{i=await Tt(e,z.O_RDONLY|Ct),s=await i.readFile("utf8")}catch(d){if($e(d))return{log:n,raw:""};throw d}finally{await i?.close()}let o=s.split(`
|
|
2
|
-
`);for(let d=0;d<o.length;d+=1){let c=o[d].trim();if(!c)continue;let a;try{a=JSON.parse(c)}catch{throw new TypeError(`Invalid relationship event JSONL at line ${d+1}`)}if(a.sequence!==n.version+1)throw new TypeError(`Invalid relationship event sequence at line ${d+1}`);n.append({eventId:a.eventId,relationshipId:a.relationshipId,action:a.action,...a.edge===void 0?{}:{edge:a.edge},author:a.author,timestamp:a.timestamp,...a.reason===void 0?{}:{reason:a.reason},expectedVersion:n.version})}return{log:n,raw:s}}function Nn(e,t,r,n){let s=Date.parse(t.timestamp),i;return t.action!=="remove"&&t.edge!==void 0&&(i=new te(r,[t.edge],n).edges()[0]),e.eventId===t.eventId.trim()&&e.relationshipId===t.relationshipId.trim()&&e.action===t.action&&e.author===t.author.trim()&&Number.isFinite(s)&&e.timestamp===new Date(s).toISOString()&&e.reason===(t.reason?.trim()||void 0)&&U(e.edge)===U(i)}var It=class e{#e;#n;#r;#i;#t;constructor(t,r,n,s){this.#e=t.pmRoot,this.#n=r,this.#r=t.registry,this.#i=n,this.#t=s}static async open(t){let r=Object.freeze([...t.nodes]),n=await D(t.pmRoot,t.relativePath),s=await ue(t.pmRoot);try{await D(t.pmRoot,n);let{log:i}=await le(n,r,t.registry);return new e(t,r,n,i)}finally{await s()}}get path(){return this.#i}async currentVersion(){return this.#t=await this.#s(),this.#t.version}async append(t){let r=await ue(this.#e);try{let n=await D(this.#e,this.#i),{log:s}=await le(n,this.#n,this.#r),i=s.append(t);await qe(C.dirname(n),{recursive:!0}),await D(this.#e,n);let o=await Tt(n,z.O_APPEND|z.O_CREAT|z.O_WRONLY|Ct);try{await o.appendFile(`${JSON.stringify(i)}
|
|
3
|
-
`,"utf8")}finally{await o.close()}return this.#t=s,i}finally{await r()}}async appendBatch(t,r={}){let n=await ue(this.#e);try{let s=await D(this.#e,this.#i),{log:i,raw:o}=await le(s,this.#n,this.#r),d=i.version,c=new Map(i.events().map(f=>[f.eventId,f])),a=[],u=[];for(let f of t){let l=f.eventId.trim(),p=c.get(l);if(p!==void 0){if(r.existingEventPolicy==="skip_identical"&&Nn(p,f,this.#n,this.#r)){u.push(p.eventId);continue}if(r.existingEventPolicy==="skip_identical")throw new TypeError(`Relationship event id collision with different content: ${l}`)}let g=i.append(f);c.set(g.eventId,g),a.push(g)}if(a.length>0){let f=o.length===0||o.endsWith(`
|
|
4
|
-
`)?o:`${o}
|
|
5
|
-
`;await qe(C.dirname(s),{recursive:!0}),await D(this.#e,s),await B(s,`${f}${a.map(l=>JSON.stringify(l)).join(`
|
|
6
|
-
`)}
|
|
7
|
-
`)}return this.#t=i,Object.freeze({version_before:d,version_after:i.version,appended:Object.freeze(a),skipped_event_ids:Object.freeze(u)})}finally{await n()}}async snapshot(t={}){return this.#t=await this.#s(),this.#t.snapshot(t)}async page(t){return this.#t=await this.#s(),this.#t.page(t)}async*stream(t={}){this.#t=await this.#s(),yield*this.#t.stream(t)}async project(t,r,n={}){return this.#t=await this.#s(),this.#t.project(t,r,n)}async#s(){let t=await ue(this.#e);try{let r=await D(this.#e,this.#i);return(await le(r,this.#n,this.#r)).log}finally{await 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]="3a33af50-3d2c-57bb-884a-4d5394599ba2")}catch{}})();function $n(e,t,r,n,s,i){if(e.seen.has(t))return"skip";if(e.cursorFound&&e.affected.length>=i)return"truncate";e.seen.add(t),e.parents.set(t,r.id);let o=r.depth+1;return e.queue.push({id:t,depth:o}),e.cursorFound?(e.affected.push({id:t,distance:o,path:Un(n,t,e.parents)}),"continue"):(e.cursorFound=t===s,"skip")}function Mn(e,t,r,n){let s=A("graph impact",{root:e,direction:r,kinds:[...t.kinds??[]].sort(),max_depth:Number.isFinite(n)?n:"unbounded"});return{fingerprint:s,after:t.after===void 0?void 0:mt(t.after,s)}}function K(e,t,r){e.get(t).add(r)}function pe(e){return new Map(e.map(t=>[t,new Set]))}function Rt(e){for(let t of e)t.sort();return e.sort((t,r)=>r.length-t.length||t[0].localeCompare(r[0]))}function fe(e){if(Array.isArray(e))return e.map(r=>fe(r));if(e===null||typeof e!="object")return e;let t=e.toJSON;return typeof t=="function"?fe(t.call(e)):Object.fromEntries(Object.entries(e).sort(([r],[n])=>r.localeCompare(n)).map(([r,n])=>[r,fe(n)]))}function St(e){return JSON.stringify(fe(e))}function jn(e,t,r,n){let s=[{id:e,expanded:!1}];for(;s.length>0;){let i=s.pop();if(i.expanded){n.push(i.id);continue}if(r.has(i.id))continue;r.add(i.id),s.push({id:i.id,expanded:!0});let o=[...t.get(i.id)].sort().reverse();for(let d of o)r.has(d)||s.push({id:d,expanded:!1})}}function Pn(e,t){let r=new Set,n=[];for(let s of e)r.has(s)||jn(s,t,r,n);return n}function Fn(e,t){let r=new Set,n=[];for(let s of[...e].reverse()){if(r.has(s))continue;let i=[],o=[s];for(r.add(s);o.length>0;){let d=o.pop();i.push(d);for(let c of t.get(d))r.has(c)||(r.add(c),o.push(c))}n.push(i)}return Rt(n)}function Dt(e,t){let r=pe(e);for(let[n,s]of t)for(let i of s)K(r,i,n);return Fn(Pn(e,t),r)}function Gn(e,t){let r=pe(e.nodes());for(let n of e.edges()){let s=t.require(n.kind);if(!s.ordering)continue;let i=(s.precedence??"source_before_target")==="source_before_target";K(r,i?n.source:n.target,i?n.target:n.source)}return r}function qn(e,t){let r=new Map(e.map(i=>[i,0]));for(let i of t.values())for(let o of i)r.set(o,r.get(o)+1);let n=e.filter(i=>r.get(i)===0).sort(),s=[];for(;n.length>0;){s.push(n);let i=[];for(let o of n)for(let d of t.get(o)){let c=r.get(d)-1;r.set(d,c),c===0&&i.push(d)}n=i.sort()}return s}function Bn(e,t){let r=new Map(e.map(o=>[o,0])),n=new Map;for(let o of e)for(let d of t.get(o)){if(!r.has(d))continue;let c=r.get(o)+1,a=n.get(d);(c>r.get(d)||c===r.get(d)&&(a===void 0||o.localeCompare(a)<0))&&(r.set(d,c),n.set(d,o))}let s=[...e].sort((o,d)=>r.get(d)-r.get(o)||o.localeCompare(d))[0],i=s===void 0?[]:[s];for(;i[0]!==void 0&&n.has(i[0]);)i.unshift(n.get(i[0]));return{depth:Object.fromEntries(r),path:i}}function Un(e,t,r){let n=[t],s=t;for(;s!==e;)s=r.get(s),n.push(s);return n.reverse()}function ge(e,t={}){let r=t.registry??E(),n=[...e.nodes()],s=Gn(e,r),i=qn(n,s),o=i.flat(),d=o.length===n.length,c=d?[]:Dt(n,s).filter(u=>u.length>1||s.get(u[0]).has(u[0])),a=Bn(o,s);return{exact:!0,acyclic:d,order:o,layers:i,frontier:i[0]??[],depth:a.depth,criticalPath:a.path,criticalPathLength:Math.max(0,a.path.length-1),cycles:c,provenance:{algorithm:"kahn-longest-path",edgeFamily:"ordering"}}}function Ot(e,t,r={}){let n=r.direction??"outgoing",s=r.maxDepth??Number.POSITIVE_INFINITY,i=r.limit??Number.POSITIVE_INFINITY,{fingerprint:o,after:d}=Mn(t,r,n,s),c={queue:[{id:t,depth:0}],seen:new Set([t]),parents:new Map,affected:[],cursorFound:d===void 0||d===t},a=0,u=0,f=!1,l=!1;e:for(let p=0;p<c.queue.length;p+=1){r.signal?.throwIfAborted();let g=c.queue[p];a+=1;let h=e.adjacency(g.id,{direction:n,kinds:r.kinds,signal:r.signal});if(u+=h.meta.inspectedEdges,g.depth>=s){h.value.some(y=>!c.seen.has(y))&&(f=!0);continue}for(let y of h.value)if($n(c,y,g,t,d,i)==="truncate"){f=!0,l=!0;break e}}if(!c.cursorFound)throw new TypeError(`Unknown impact cursor item: ${d}`);return{root:t,affected:c.affected,exact:!0,truncated:f,...l?{nextCursor:ie(o,c.affected.at(-1)?.id??t)}:{},cost:{visitedNodes:a,inspectedEdges:u}}}function Lt(e){let t=[...e.nodes()],r=pe(t),n=pe(t);for(let c of e.edges())K(r,c.source,c.target),K(r,c.target,c.source),K(n,c.source,c.target);let s=[],i=new Set;for(let c of t){if(i.has(c))continue;let a=[],u=[c];for(i.add(c);u.length>0;){let f=u.pop();a.push(f);for(let l of r.get(f))i.has(l)||(i.add(l),u.push(l))}s.push(a)}let o=t.map(c=>({id:c,degree:r.get(c).size})),d=Math.max(0,...o.map(({degree:c})=>c));return{components:Rt(s),stronglyConnected:Dt(t,n),orphans:o.filter(({degree:c})=>c===0).map(({id:c})=>c),hubs:o.filter(({degree:c})=>c>0&&c===d),exact:!0,provenance:{algorithm:"component-degree",edgeFamily:"all"}}}function Ei(e,t){let r=new Map(e.edges.map(s=>[St(s),s])),n=new Map(t.edges.map(s=>[St(s),s]));return{fromVersion:e.version,toVersion:t.version,added:[...n].filter(([s])=>!r.has(s)).map(([,s])=>s),removed:[...r].filter(([s])=>!n.has(s)).map(([,s])=>s),unchangedCount:[...r.keys()].filter(s=>n.has(s)).length,exact:!0}}import{createHash as zn}from"node:crypto";(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]="dea35fb9-9f9f-56ce-afc0-f4dc993012c3")}catch{}})();var Kn=64,Wn=8;function Vn(e,t){let r=(e.dependencies??[]).map(n=>{if(typeof n!="object"||n===null)return"";let s=n;return`${typeof s.kind=="string"?s.kind:"related"}:${typeof s.id=="string"?s.id:""}`}).sort().join(",");return[e.id,e.title,e.status,t(e.status)?"1":"0",typeof e.type=="string"?e.type.trim():"",e.parent??"",e.blocked_by??"",r].join("\0")}function he(e,t=n=>n==="closed"||n==="canceled",r=E()){let n=e.filter(i=>typeof i?.id=="string"&&i.id.trim().length>0).map(i=>Vn(i,t)).sort(),s=r.list().map(i=>U(i)).sort();return zn("sha256").update(n.join("")).update("").update(s.join("")).digest("hex")}function At(e,t,r){let n=t??r;if(!Number.isInteger(n)||n<1)throw new TypeError(`Invalid ${e} bound: ${String(t)}`);return n}var ze=class{#e=new Map;#n;#r;constructor(t={}){this.#n=At("maxResultsPerWorkspace",t.maxResultsPerWorkspace,Kn),this.#r=At("maxWorkspaces",t.maxWorkspaces,Wn)}lookup(t,r,n){let s=this.#e.get(t),i=!0;(s===void 0||s.fingerprint!==r)&&(s={fingerprint:r,assembly:n(),results:new Map},i=!1,!this.#e.has(t)&&this.#e.size>=this.#r&&this.#e.delete(this.#e.keys().next().value)),this.#e.delete(t),this.#e.set(t,s);let o=s,d=this.#n;return{assembly:o.assembly,assemblyReused:i,fingerprint:r,memoize(c,a){let u=o.results.get(c);if(u!==void 0||o.results.has(c))return o.results.delete(c),o.results.set(c,u),{value:structuredClone(u),reused:!0};let f=a();return o.results.size>=d&&o.results.delete(o.results.keys().next().value),o.results.set(c,structuredClone(f)),{value:f,reused:!1}}}}clear(){this.#e.clear()}},Nt=new ze;function me(){return Nt}function Ri(){Nt.clear()}(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]="31a800f7-1374-5e7c-ad23-ae3d8ebcebe0")}catch{}})();var Hn=["prerequisite","dependent","ancestor","descendant","provenance","related"],Jn=new TextEncoder;function Ke(e,t,r){let n=e??t;if(!Number.isInteger(n)||n<1)throw new TypeError(`Relationship context ${r} must be positive`);return n}function ye(e){return Math.max(1,Math.ceil(Jn.encode(JSON.stringify(e)).byteLength/4))}function We(e,t,r){let n=r.resolve(e.kind);if(n?.ordering){let i=(n.precedence??"source_before_target")==="source_before_target"?e.source:e.target;return t===i?"prerequisite":"dependent"}if(n?.hierarchy){let i=(n.hierarchyDirection??"source_parent")==="source_parent"?e.source:e.target;return t===i?"ancestor":"descendant"}return e.kind==="discovered_from"||e.kind==="incident_from"?"provenance":"related"}function Xn(e,t,r,n){let s=e.filter(i=>i.source===t&&i.target===r||i.target===t&&i.source===r).map(i=>We(i,r,n));return[...new Set(s)].sort()}function Yn(e){return Hn.find(t=>e.includes(t))}function Qn(e,t,r,n){let s=n.direction??"both",i=n.maxDepth??3;if(!Number.isInteger(i)||i<0)throw new TypeError("Relationship context maxDepth must be non-negative");let o=new Set([t]),d=[{id:t,distance:0}],c=[],a=0,u=!1;for(let f=0;f<d.length;f+=1){n.signal?.throwIfAborted();let l=d[f];if(l.distance>=i&&u)continue;let p=e.neighborEdges(l.id,{direction:s,kinds:n.kinds,signal:n.signal});if(a+=p.meta.inspectedEdges,l.distance>=i){p.value.some(g=>!o.has(g.id))&&(u=!0);continue}for(let{id:g,edge:h}of p.value){if(o.has(g))continue;o.add(g);let y={id:g,distance:l.distance+1,via:l.id,role:We(h,g,r)};c.push(y),d.push(y)}}return c.sort((f,l)=>f.distance-l.distance||f.id.localeCompare(l.id)),{rows:c,visitedNodes:d.length,inspectedEdges:a,depthTruncated:u}}function Zn(e,t,r,n){let s={prerequisite:0,dependent:0,ancestor:0,descendant:0,provenance:0,related:0},i=e.neighborEdges(t,{direction:n.direction??"both",kinds:n.kinds,signal:n.signal}).value;for(let{id:o,edge:d}of i)s[We(d,o,r)]+=1;return{directEdges:s,directTotal:i.length,rootEdges:i.map(({edge:o})=>o)}}function er(e){let t=[],r=e.initialTokens;for(let n of e.candidates){if(t.length>=e.nodeLimit)break;let s=n.distance===1?Xn(e.rootEdges,e.rootId,n.id,e.registry):[],i={...e.details.get(n.id)??{id:n.id},distance:n.distance,role:s.length>0?Yn(s):n.role,via:n.via,reasons:s.length>0?s:[`${n.role} via ${n.via} (depth ${n.distance})`]},o=ye(i);if(r+o>e.tokenBudget)break;t.push(i),r+=o}if(e.candidates.length>0&&t.length===0)throw new TypeError("Relationship context tokenBudget cannot fit one node");return{nodes:t,usedTokens:r}}function tr(e){let t=e.options.kinds?new Set(e.options.kinds.map(i=>e.registry.require(i).kind)):void 0,r=e.graph.edges().filter(i=>{if(!e.included.has(i.source)||!e.included.has(i.target))return!1;if(t===void 0||t.has(i.kind))return!0;let o=e.registry.resolve(i.kind)?.inverse;return o!==void 0&&t.has(o)}),n=[],s=e.initialTokens;for(let i of r){if(n.length>=e.edgeLimit)break;let o=ye(i);if(s+o>e.tokenBudget)break;n.push(i),s+=o}return{edges:n,usedTokens:s,candidateCount:r.length}}function $t(e,t,r,n={}){if(!e.nodes().includes(t))throw new TypeError(`Relationship node not found: ${t}`);let s=Ke(n.nodeLimit,20,"nodeLimit"),i=Ke(n.edgeLimit,40,"edgeLimit"),o=Ke(n.tokenBudget,1200,"tokenBudget"),d=n.registry??E(),c=new Map(r.map(L=>[L.id,L])),a=c.get(t)??{id:t},{evidence:u=[],...f}=a,l=[...u],p=Qn(e,t,d,n),{rootEdges:g,...h}=Zn(e,t,d,n),y=A("relationship-context",{rootId:t,direction:n.direction??"both",kinds:[...n.kinds??[]].sort(),maxDepth:n.maxDepth??3}),b=yt(p.rows,n.cursor,y,({id:L})=>L),m=p.rows.slice(b),_=ye(f)+ye(l);if(_>o)throw new TypeError("Relationship context tokenBudget cannot fit root and evidence");let T=er({candidates:m,details:c,rootEdges:g,rootId:t,registry:d,nodeLimit:s,tokenBudget:o,initialTokens:_}),{nodes:k}=T,J=new Set([t,...k.map(({id:L})=>L)]),F=tr({graph:e,included:J,options:n,registry:d,edgeLimit:i,tokenBudget:o,initialTokens:T.usedTokens}),{edges:G,usedTokens:Tn}=F,X=b+k.length,Ae=X<p.rows.length,ft=k.at(-1),Ne=F.candidateCount-G.length,pt=p.depthTruncated||Ae||Ne>0,Cn={rootId:t,...f.status===void 0?{}:{rootStatus:f.status},...h,discoveredNodes:p.rows.length,returnedNodes:k.length,returnedEdges:G.length,omittedNodes:p.rows.length-X,omittedEdges:Ne,evidenceCount:l.length,hasMore:Ae};return{root:f,summary:Cn,nodes:k,edges:G,evidence:l,meta:{exact:!0,truncated:pt,completeness:pt?"truncated":"complete",nodeLimit:s,edgeLimit:i,tokenBudget:o,usedTokens:Tn,visitedNodes:p.visitedNodes,inspectedEdges:p.inspectedEdges,omittedNodes:p.rows.length-X,omittedEdges:Ne,...Ae&&ft?{nextCursor:ie(y,ft.id,X-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]="c0fb747e-1f9f-55c4-808b-b77d3a881f87")}catch{}})();var nr=5,rr=1e4,sr=8;function Ve(e,t){if(!Number.isFinite(t)||!Number.isInteger(t)||t<0)throw new TypeError(`Invalid path ${e} bound: ${String(t)}`)}function _e(e,t){return t.hierarchyDirection==="target_parent"?e.target:e.source}function W(e,t){return(t.precedence??"source_before_target")==="target_before_source"?e.target:e.source}function be(e,t){let r=W(e,t);return{predecessor:r,successor:r===e.source?e.target:e.source}}function ir(e,t,r){if(t===void 0)return;let n=e.registry(),s=new Set;for(let i of t){let o=n.require(i);if(!o[r])throw new TypeError(`Relationship kind ${o.kind} is not a ${r} kind`);s.add(o.kind)}return s}function or(e,t,r,n,s){let i=e.registry(),o=e.neighborEdges(t,{direction:"both",...r===void 0?{}:{kinds:[...r]}}),d=[],c=new Set;for(let a of o.value){let u=i.require(a.edge.kind);u[n]&&s(a,u,t)&&(c.has(a.id)||(c.add(a.id),d.push(a.id)))}return{neighbors:d,inspectedEdges:o.meta.inspectedEdges}}function dr(e,t,r,n,s,i){if(t>=r)return e.neighbors.some(o=>!i.seen.has(o))&&(i.truncated=!0),!1;for(let o of e.neighbors)if(!i.seen.has(o)){if(i.seen.add(o),i.queue.push({id:o,depth:t+1}),!i.resumed){o===s&&(i.resumed=!0);continue}if(i.value.length>=n)return i.truncated=!0,!0;i.value.push(o)}return!1}function we(e,t,r,n,s){if(!e.hasNode(t))throw new TypeError(`Relationship node not found: ${t}`);let i=ir(e,r.kinds,n),o=r.limit??Number.POSITIVE_INFINITY,d=r.maxDepth??Number.POSITIVE_INFINITY,c=r.after,a={seen:new Set([t]),value:[],queue:[{id:t,depth:0}],resumed:c===void 0,truncated:!1},u=0,f=0;for(let l=0;l<a.queue.length;l+=1){r.signal?.throwIfAborted();let p=a.queue[l];u+=1;let g=or(e,p.id,i,n,s);if(f+=g.inspectedEdges,dr(g,p.depth,d,o,c,a))break}if(!a.resumed)throw new TypeError(`Traversal cursor not found in sequence: ${c}`);return{value:a.value,meta:{visitedNodes:u,inspectedEdges:f,truncated:a.truncated,nextCursor:a.value.at(-1)}}}function Mt(e,t){if(!e.hasNode(t))throw new TypeError(`Relationship node not found: ${t}`)}function jt(e,t,r,n,s){let i=e.neighborEdges(t.nodes.at(-1),{direction:n,...r.kinds===void 0?{}:{kinds:r.kinds}});return s.inspectedEdges+=i.meta.inspectedEdges,i.value.filter(o=>!t.nodeSet.has(o.id))}function cr(e,t,r,n,s,i,o){for(let d of jt(e,t,n,s,o)){let c=[...t.nodes,d.id],a=new Set(t.nodeSet).add(d.id),u=[...t.edges,d.edge];if(d.id===r){if(o.value.push({nodes:c,edges:u,length:u.length}),o.value.length>=i)return!0}else o.queue.push({nodes:c,nodeSet:a,edges:u})}return!1}function Pt(e,t,r={}){return we(e,t,r,"hierarchy",(n,s)=>_e(n.edge,s)===n.id)}function Ft(e,t,r={}){return we(e,t,r,"hierarchy",(n,s,i)=>_e(n.edge,s)===i)}function Gt(e,t,r={}){return we(e,t,r,"ordering",(n,s)=>W(n.edge,s)===n.id)}function qt(e,t,r={}){return we(e,t,r,"ordering",(n,s,i)=>W(n.edge,s)===i)}function ar(e,t,r,n,s,i,o,d){let c={value:[],queue:[{nodes:[t],nodeSet:new Set([t]),edges:[]}],inspectedEdges:0},a=0,u=!1,f=s+1;for(let l=0;l<c.queue.length;l+=1){if(n.signal?.throwIfAborted(),c.value.length>=f||a>=i){u=!0;break}let p=c.queue[l];if(a+=1,p.edges.length>=o){jt(e,p,n,d,c).length>0&&(u=!0);continue}if(cr(e,p,r,n,d,f,c)){u=!0;break}}return{value:c.value.slice(0,s),meta:{visitedNodes:a,inspectedEdges:c.inspectedEdges,truncated:u}}}function Bt(e,t,r,n={}){Mt(e,t),Mt(e,r);let s=n.maxPaths??nr,i=n.maxVisitedPaths??rr,o=n.maxDepth??sr;Ve("maxPaths",s),Ve("maxVisitedPaths",i),Ve("maxDepth",o);let d=n.direction??"outgoing";n.signal?.throwIfAborted();for(let c of n.kinds??[])e.registry().require(c);return t===r?s===0?{value:[],meta:{visitedNodes:1,inspectedEdges:0,truncated:!0}}:{value:[{nodes:[t],edges:[],length:0}],meta:{visitedNodes:1,inspectedEdges:0,truncated:!1}}:ar(e,t,r,n,s,i,o,d)}(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]="24898402-1568-5b05-9072-f89dd91f25a6")}catch{}})();var ur=16,lr=2,fr=8;function ve(e,t){if(!Number.isInteger(t)||t<1)throw new TypeError(`Invalid ${e} bound: ${String(t)}`)}function ke(e,t,r){let n=e.registry(),s=t===void 0?void 0:new Set(t.map(i=>n.require(i).kind));for(let i of e.edges()){if(i.source===i.target)continue;let o=n.require(i.kind);s!==void 0&&!(s.has(o.kind)||o.inverse!==void 0&&s.has(o.inverse))||r(i,o)}}function pr(e,t){let r=new Map;ke(e,t,n=>{Ut(r,n.source,n.target),Ut(r,n.target,n.source)});for(let n of r.values())n.sort();return r}function Ut(e,t,r){let n=e.get(t);n===void 0?e.set(t,[r]):n.push(r)}function gr(e,t){let r=new Map;for(let i of e){let o=t.get(i);r.set(o,(r.get(o)??0)+1)}let n,s=0;for(let[i,o]of r)(o>s||o===s&&i<n)&&(n=i,s=o);return n}function hr(e,t){let r=new Map;for(let[s,i]of e){let o=r.get(i);o===void 0?r.set(i,[s]):o.push(s)}let n=[];for(let s of r.values())s.length<t||(s.sort(),n.push({representative:s[0],size:s.length,members:s}));return n.sort((s,i)=>i.size-s.size||s.representative.localeCompare(i.representative))}function zt(e,t={}){let r=t.maxIterations??ur,n=t.minSize??lr;ve("maxIterations",r),ve("minSize",n);let s=pr(e,t.kinds),i=e.nodes(),o=new Map(i.map(f=>[f,f])),d=0,c=!1,a=0,u=0;for(;d<r&&!c;){t.signal?.throwIfAborted(),d+=1,c=!0;for(let f of i){a+=1;let l=s.get(f);if(l===void 0)continue;u+=l.length;let p=gr(l,o);p!==o.get(f)&&(o.set(f,p),c=!1)}}return{value:{communities:hr(o,n),iterations:d,converged:c},meta:{visitedNodes:a,inspectedEdges:u,truncated:!c}}}function xe(e){return e.direction==="directed"&&(e.ordering||e.hierarchy)}function Ee(e){return e.inverse!==void 0&&e.inverse<e.kind?e.inverse:e.kind}function Ie(e,t){return(t.hierarchy?_e(e,t):e.source===W(e,t)?e.target:e.source)===e.target?{from:e.source,to:e.target}:{from:e.target,to:e.source}}function mr(e,t){if(t===void 0)return;let r=e.registry(),n=new Set;for(let s of t){let i=r.require(s);if(!xe(i))throw new TypeError(`Relationship kind ${i.kind} is not a directed ordering or hierarchy kind`);n.add(Ee(i))}return n}function yr(e,t){let r=e.registry(),n=new Map;for(let s of e.edges()){let i=r.require(s.kind);if(!xe(i))continue;let o=Ee(i);if(t!==void 0&&!t.has(o))continue;let d=Ie(s,i);if(d.from===d.to)continue;let c=n.get(o);c===void 0&&(c={adjacency:new Map,records:[]},n.set(o,c));let a=c.adjacency.get(d.from);a===void 0?c.adjacency.set(d.from,new Set([d.to])):a.add(d.to),c.records.push({...d,edge:s})}return n}function _r(e){let t=new Map;for(let[r,n]of e.adjacency)t.set(r,[...n].sort());return t}function br(e,t,r,n){let s=[n];for(let i=r;i!==t;i=e.get(i))s.push(i);return s.push(t),s.reverse()}function wr(e,t,r,n,s,i){for(let o of e.get(r.id)??[])if(i.inspectedEdges+=1,!(r.depth===0&&o===t.to)&&!n.has(o)){if(n.set(o,r.id),o===t.to)return br(n,t.from,r.id,o);s.push({id:o,depth:r.depth+1})}}function vr(e,t,r,n){let s=new Map([[t.from,t.from]]),i=[{id:t.from,depth:0}];for(let o=0;o<i.length;o+=1){let d=i[o];if(n.visitedNodes+=1,d.depth>=r)continue;let c=wr(e,t,d,s,i,n);if(c!==void 0)return c}}function M(e,t={}){let r=t.maxDepth??fr;ve("maxDepth",r),t.limit!==void 0&&ve("limit",t.limit);let n=t.limit??Number.POSITIVE_INFINITY,s=mr(e,t.kinds),i=yr(e,s),o=[],d={visitedNodes:0,inspectedEdges:0},c=!1;e:for(let a of[...i.keys()].sort()){let u=i.get(a),f=_r(u);for(let l of u.records){t.signal?.throwIfAborted();let p=vr(f,l,r,d);if(p!==void 0){if(o.length>=n){c=!0;break e}o.push({edge:l.edge,witness:p})}}}return{value:o,meta:{visitedNodes:d.visitedNodes,inspectedEdges:d.inspectedEdges,truncated:c}}}function kr(e,t,r,n,s){let i=new Set,o=[];for(let d of r){if(d.id===e||i.has(d.id))continue;if(!s.seen.has(d.id)){if(t>=n){s.truncated=!0;continue}s.seen.add(d.id),s.queue.push({id:d.id,depth:t+1})}i.add(d.id),o.push(d.id);let c=s.predecessors.get(d.id);c===void 0&&(c=new Set,s.predecessors.set(d.id,c)),c.add(e)}return o}function xr(e,t,r){let n=r.direction??"outgoing",s=r.maxDepth??Number.POSITIVE_INFINITY,i=[],o=new Map,d={seen:new Set([t]),queue:[{id:t,depth:0}],predecessors:new Map,truncated:!1},c=0;for(let a=0;a<d.queue.length;a+=1){r.signal?.throwIfAborted();let{id:u,depth:f}=d.queue[a];i.push(u);let l=e.neighborEdges(u,{direction:n,...r.kinds===void 0?{}:{kinds:r.kinds}});c+=l.meta.inspectedEdges,o.set(u,kr(u,f,l.value,s,d))}return{order:i,successors:o,predecessors:d.predecessors,inspectedEdges:c,truncated:d.truncated}}function Er(e,t){let r=[],n=new Set([t]),s=[{id:t,index:0}];for(;s.length>0;){let i=s.at(-1),o=e.successors.get(i.id);if(i.index<o.length){let d=o[i.index];i.index+=1,n.has(d)||(n.add(d),s.push({id:d,index:0}))}else r.push(i.id),s.pop()}return r.reverse()}function Ir(e,t,r,n){let s=e,i=t;for(;s!==i;){for(;n.get(s)>n.get(i);)s=r.get(s);for(;n.get(i)>n.get(s);)i=r.get(i)}return s}function Tr(e,t,r){let n;for(let s of[...e].sort())t.has(s)&&(n=n===void 0?s:Ir(n,s,t,r));return n}function Cr(e,t,r,n,s){let i=new Map([[t,t]]),o=!0;for(;o;){o=!1;for(let d of r){if(s?.throwIfAborted(),d===t)continue;let c=Tr(e.predecessors.get(d),i,n);c!==void 0&&i.get(d)!==c&&(i.set(d,c),o=!0)}}return i}function Kt(e,t,r={}){if(!e.hasNode(t))throw new TypeError(`Relationship node not found: ${t}`);if(r.maxDepth!==void 0&&(!Number.isInteger(r.maxDepth)||r.maxDepth<0))throw new TypeError(`Invalid maxDepth bound: ${String(r.maxDepth)}`);let n=xr(e,t,r),s=Er(n,t),i=new Map(s.map((a,u)=>[a,u])),o=Cr(n,t,s,i,r.signal),d=new Map(s.map(a=>[a,1]));for(let a=s.length-1;a>=0;a-=1){let u=s[a];if(u===t)continue;let f=o.get(u);d.set(f,d.get(f)+d.get(u))}let c=s.filter(a=>a!==t).map(a=>({id:a,idom:o.get(a),dominatedCount:d.get(a)-1})).sort((a,u)=>u.dominatedCount-a.dominatedCount||a.id.localeCompare(u.id));return{value:{root:t,reachableCount:n.order.length,rows:c},meta:{visitedNodes:n.order.length,inspectedEdges:n.inspectedEdges,truncated:n.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]="348c9246-2fb9-529e-b627-f60c901a6cf2")}catch{}})();function Wt(e){return Math.round(e*1e6)/1e6}function Vt(e,t,r){let n=e.get(t);n===void 0?e.set(t,new Set([r])):n.add(r)}function Ht(e,t){let r=new Map(e.nodes().map(s=>[s,new Set]));ke(e,t,s=>{r.get(s.source).add(s.target),r.get(s.target).add(s.source)});let n=new Map;for(let[s,i]of r)n.set(s,[...i].sort());return n}function Sr(e,t){let r=new Map,n=new Map;return ke(e,t,(s,i)=>{if(!i.ordering)return;let{predecessor:o,successor:d}=be(s,i);Vt(n,o,d),Vt(r,d,o)}),{incoming:r,outgoing:n}}function Rr(e,t,r){let n=new Map([[e,0]]),s=new Map([[e,1]]),i=new Map,o=[],d=[e],c=0,a=0;for(let u=0;u<d.length;u+=1){let f=d[u];r.visitedNodes+=1,o.push(f);let l=n.get(f);f!==e&&(c+=1,a+=l);for(let p of t.get(f))if(r.inspectedEdges+=1,n.has(p)||(n.set(p,l+1),d.push(p)),n.get(p)===l+1){s.set(p,(s.get(p)??0)+s.get(f));let g=i.get(p);g===void 0?i.set(p,[f]):g.push(f)}}return{stack:o,sigma:s,predecessors:i,reachableCount:c,distanceSum:a}}function Dr(e,t,r){let n=new Map;for(let s=e.stack.length-1;s>=0;s-=1){let i=e.stack[s],o=(1+(n.get(i)??0))/e.sigma.get(i);for(let d of e.predecessors.get(i)??[])n.set(d,(n.get(d)??0)+e.sigma.get(d)*o);i!==t&&r.set(i,(r.get(i)??0)+(n.get(i)??0))}}function Or(e,t){return t<=1||e.reachableCount===0?0:e.reachableCount/(t-1)*(e.reachableCount/e.distanceSum)}function Lr(e,t,r,n,s){return{id:e,degree:t.get(e).length,inDegree:r.incoming.get(e)?.size??0,outDegree:r.outgoing.get(e)?.size??0,betweenness:Wt((n.get(e)??0)/2),closeness:Wt(s.get(e))}}function Jt(e,t={}){let r=Ht(e,t.kinds),n=Sr(e,t.kinds),s=e.nodes(),i=new Map,o=new Map,d={visitedNodes:0,inspectedEdges:0};for(let u of s){t.signal?.throwIfAborted();let f=Rr(u,r,d);o.set(u,Or(f,s.length)),Dr(f,u,i)}let c=0;for(let u of r.values())c+=u.length;let a=s.map(u=>Lr(u,r,n,i,o)).sort((u,f)=>f.betweenness-u.betweenness||f.degree-u.degree||u.id.localeCompare(f.id));return{value:{nodeCount:s.length,edgeCount:c/2,rows:a},meta:{visitedNodes:d.visitedNodes,inspectedEdges:d.inspectedEdges,truncated:!1}}}function Ar(e,t){return e<=t?{source:e,target:t}:{source:t,target:e}}function Nr(e,t,r){let s=t.get(e.node)[e.neighborIndex];if(e.neighborIndex+=1,r.inspectedEdges+=1,s!==e.parent){if(r.discovery.has(s)){r.low.set(e.node,Math.min(r.low.get(e.node),r.discovery.get(s)));return}return e.children+=1,r.discovery.set(s,r.timer),r.low.set(s,r.timer),r.timer+=1,{node:s,parent:e.node,neighborIndex:0,children:0}}}function $r(e,t,r){if(e.parent===null){e.children>1&&r.articulation.add(e.node);return}let n=e.parent,s=r.low.get(e.node);r.low.set(n,Math.min(r.low.get(n),s)),n!==t&&s>=r.discovery.get(n)&&r.articulation.add(n),s>r.discovery.get(n)&&r.bridges.push(Ar(n,e.node))}function Mr(e,t,r,n){r.discovery.set(e,r.timer),r.low.set(e,r.timer),r.timer+=1;let s=[{node:e,parent:null,neighborIndex:0,children:0}];for(;s.length>0;){n?.throwIfAborted();let i=s.at(-1);if(i.neighborIndex<t.get(i.node).length){let o=Nr(i,t,r);o!==void 0&&s.push(o)}else $r(i,e,r),s.pop()}}function Te(e,t={}){let r=Ht(e,t.kinds),n={discovery:new Map,low:new Map,timer:0,articulation:new Set,bridges:[],inspectedEdges:0};for(let s of e.nodes())n.discovery.has(s)||Mr(s,r,n,t.signal);return{value:{articulationPoints:[...n.articulation].sort(),bridges:n.bridges.sort((s,i)=>s.source.localeCompare(i.source)||s.target.localeCompare(i.target))},meta:{visitedNodes:n.discovery.size,inspectedEdges:n.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]="f155ac72-64eb-5316-b016-954abd48c0e7")}catch{}})();function jr(e){let t=e.registry(),r=new Map,n=new Set;for(let s of e.edges()){let i=t.require(s.kind);if(!i.ordering)continue;let{predecessor:o,successor:d}=be(s,i);if(n.add(o),n.add(d),o===d)continue;let c=r.get(o);c===void 0?r.set(o,new Set([d])):c.add(d)}return{forward:r,participants:n}}function Pr(e,t,r,n){if(e===void 0)return n;let s=n;for(let i of e)t.has(i)&&(s=Math.min(s,r.get(i)));return s}function Fr(e,t,r){let n=r-t;return{id:e,earliestStart:t,earliestFinish:t+1,latestStart:r,latestFinish:r+1,slack:n,critical:n===0}}function Gr(e,t,r,n,s){let i=new Map;for(let o=e.length-1;o>=0;o-=1){let d=e[o],c=Pr(t.forward.get(d),n,i,s);i.set(d,c-1)}return e.map(o=>Fr(o,r[o],i.get(o))).sort((o,d)=>o.slack-d.slack||o.earliestStart-d.earliestStart||o.id.localeCompare(d.id))}function Xt(e,t={}){t.signal?.throwIfAborted();let r=ge(e,{registry:e.registry()}),n=jr(e),s=new Set(r.order),i=r.order.filter(a=>n.participants.has(a)),o=i.reduce((a,u)=>Math.max(a,r.depth[u]+1),0),d=Gr(i,n,r.depth,s,o),c=d.length>0;return{exact:!0,acyclic:r.acyclic,makespan:o,scheduledCount:d.length,criticalPath:c?r.criticalPath:[],criticalPathLength:c?r.criticalPathLength:0,cycles:r.cycles,rows:d,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]="bc561e73-75b8-5ea7-a18c-da70fb991b69")}catch{}})();var Ce=["missing_reference_active","missing_reference_terminal","legacy_no_blocker_sentinel","ordering_cycle","legacy_ordering_cycle","ordering_storage_contradiction","legacy_ordering_storage_contradiction","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]="1955b7a4-385d-5a5d-8856-6db9f94814aa")}catch{}})();var qr=25,Br="milestone",Ur="outcome milestone:",zr=new Set(["discovered_from","incident_from","supersedes","verifies"]);function Qe(e){return zr.has(e)}var Yt={error:0,warning:1,info:2};function Qt(e){return new Set((e??[]).filter(t=>typeof t=="string").map(t=>t.trim().toLowerCase()))}function Xe(e,t,r,n,s,i,o,d){let c=[...s].sort((a,u)=>a.localeCompare(u));return{code:e,severity:t,policy:r,message:n(c.length),count:c.length,sample:c.slice(0,i),sample_truncated:c.length>i,remediation:o,...d===void 0?{}:{evidence:[...d].sort((a,u)=>a.localeCompare(u)).slice(0,i)}}}function Kr(e){let t=e.graph.registry(),r=new Map;for(let n of e.graph.edges()){let s=t.require(n.kind);if(!s.ordering)continue;let[i,o]=(s.precedence??"source_before_target")==="target_before_source"?[n.target,n.source]:[n.source,n.target],d=r.get(i);d?d.push(o):r.set(i,[o])}for(let n of r.values())n.sort((s,i)=>s.localeCompare(i));return r}function en(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 Wr(e,t,r,n){let s=r.get(e.node)??[];if(e.neighborIndex>=s.length)return!1;let i=s[e.neighborIndex];return e.neighborIndex+=1,n.indexes.has(i)?n.onStack.has(i)&&n.lowLinks.set(e.node,Math.min(n.lowLinks.get(e.node),n.indexes.get(i))):(en(i,n),t.push({node:i,neighborIndex:0})),!0}function Vr(e,t,r,n){t.pop();let s=t.at(-1);if(s&&n.lowLinks.set(s.node,Math.min(n.lowLinks.get(s.node),n.lowLinks.get(e.node))),n.lowLinks.get(e.node)!==n.indexes.get(e.node))return;let i=[];for(;;){let o=n.stack.pop();if(n.onStack.delete(o),i.push(o),o===e.node)break}(i.length>1||i.length===1&&r.get(i[0])?.includes(i[0]))&&n.components.push(i.sort((o,d)=>o.localeCompare(d)))}function Ze(e){let t={indexes:new Map,lowLinks:new Map,onStack:new Set,stack:[],components:[],nextIndex:0},r=[...e.keys()].sort((n,s)=>n.localeCompare(s));for(let n of r){if(t.indexes.has(n))continue;let s=[{node:n,neighborIndex:0}];for(en(n,t);s.length>0;){let i=s.at(-1);Wr(i,s,e,t)||Vr(i,s,e,t)}}return t.components.sort((n,s)=>n[0].localeCompare(s[0]))}function He(e){return`${e.holder_id} -> ${e.target_id} (${e.kind})`}function x(e,t,r,n,s,i,o,d){t.length!==0&&e.push(Xe(n,s,i,o,t,r,d))}function Hr(e,t,r){let n=[],s=[...e.dangling.active,...e.dangling.legacy_terminal].filter(i=>!i.no_active_blocker_sentinel);return x(n,s.filter(i=>!t(i.holder_status)).map(He),r,"missing_reference_active","error","Active items must not reference absent targets; missing prerequisites distort scheduling.",i=>`${i} active dangling reference(s) to absent items`,"Restore or re-create the referenced item, or remove/retype the reference on the holder."),x(n,s.filter(i=>t(i.holder_status)).map(He),r,"missing_reference_terminal","info","Terminal items may retain historical references, but absent targets remain unexplainable context.",i=>`${i} terminal dangling reference(s) to absent items`,"Leave as history debt or clean up in a dedicated changelog-safe closed-item batch."),x(n,e.dangling.no_active_blocker_sentinels.map(He),r,"legacy_no_blocker_sentinel","info","The pre-structured-dependency no-active-blocker sentinel is retired; real edges carry blocker state.",i=>`${i} legacy no-active-blocker sentinel reference(s)`,"Delete the sentinel reference; blocker state is derived from blocked_by edges."),n}function Ye(e,t){let r=t.get(e);return r?!r.terminal:!0}function Se(e){return`${e.holder_id} -> ${e.target_id} (blocked_by scalar + ${e.dependency_kind} dependency)`}function Jr(e,t){let r=[],n=[];for(let i of e.orderingContradictions??[])(i.legacy_terminal?n:r).push(Se(i));let s=[];return x(s,r,t,"ordering_storage_contradiction","error","A scalar blocker and same-target structured ordering row must not assert opposite precedence.",i=>`${i} 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."),x(s,n,t,"legacy_ordering_storage_contradiction","info","Terminal scalar-versus-structured ordering contradictions are exact historical storage defects with no live scheduling effect.",i=>`${i} 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."),s}function Xr(e,t,r,n){let s=[],i=Kr(e);for(let c of Ze(i)){let a=c.some(l=>Ye(l,t)),u=new Set(c.map(l=>l.toLowerCase())),f=(e.orderingContradictions??[]).filter(l=>u.has(l.holder_id.toLowerCase())&&u.has(l.target_id.toLowerCase())).map(Se);s.push(a?Xe("ordering_cycle","error","Order-bearing relationship kinds must stay acyclic; a cycle makes every member unschedulable.",l=>`execution-order cycle across ${l} item(s)`,c,n,"Remove or retype one ordering edge inside the cycle, or split the work so precedence is linear.",f.length===0?void 0:f):Xe("legacy_ordering_cycle","info","Ordering cycles between exclusively terminal items are historical contradictions with no scheduling effect.",l=>`terminal-only execution-order cycle across ${l} item(s)`,c,n,"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 o=new Map;for(let[c,a]of i)for(let u of a){let f=o.get(u);f?f.push(c):o.set(u,[c])}let d=[...t.values()].filter(c=>!c.missing&&!c.terminal&&r(c.status)&&!(o.get(c.id)??[]).some(a=>{let u=t.get(a);return u===void 0||!u.terminal})).map(c=>c.id);return x(s,d,n,"stale_lifecycle_block","warning","A blocked lifecycle status must be backed by at least one open ordering predecessor.",c=>`${c} 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.'),s}function Re(e){let t=e.edges.map(r=>r.kind).sort((r,n)=>r.localeCompare(n));return`${e.from} -> ${e.to} (${t.join(" + ")})`}function et(e){let t=e.graph.registry(),r=new Map;for(let s of e.graph.edges()){let i=t.require(s.kind);if(!xe(i))continue;let o=Ie(s,i);if(o.from===o.to)continue;let d=`${Ee(i)}::${o.from}::${o.to}`,c=r.get(d);c?c.edges.push(s):r.set(d,{...o,edges:[s]})}let n=[...r.values()].filter(s=>s.edges.length>=2);for(let s of n)s.edges.sort((i,o)=>i.kind.localeCompare(o.kind));return n.sort((s,i)=>s.from.localeCompare(i.from)||s.to.localeCompare(i.to))}function Yr(e,t,r){let n=[],s=[];for(let o of et(e))(Ye(o.from,t)||Ye(o.to,t)?n:s).push(Re(o));let i=[];return x(i,n,r,"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.",o=>`${o} duplicated relationship(s) between active endpoints`,"Remove all but one stored spelling of the relationship; keep the canonical direction the holder declared first."),x(i,s,r,"legacy_duplicate_edge","info","Duplicated spellings between exclusively terminal items are historical noise with no scheduling effect.",o=>`${o} duplicated relationship(s) between terminal endpoints`,"Leave as history debt or clean up in a dedicated changelog-safe closed-item batch."),i}function Qr(e,t){let r=[],n=[];for(let i of e.duplicateRows??[])(i.legacy_terminal?n:r).push(`${i.holder_id} -> ${i.target_id} (${i.kind} x${i.occurrences})`);let s=[];return x(s,r,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.",i=>`${i} 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."),x(s,n,t,"legacy_duplicate_dependency_row","info","Identical repeated dependency rows on terminal holders are historical storage noise with no scheduling effect.",i=>`${i} 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."),s}function Zr(e,t){let r=new Map;for(let n of e.graph.edges()){t?.throwIfAborted();let s=e.graph.registry().require(n.kind),i;if(s.hierarchy?i=Ie(n,s):s.kind==="implements"&&(i={from:n.source,to:n.target}),i===void 0)continue;let o=r.get(i.to)??new Set;o.add(i.from),r.set(i.to,o)}return r}function es(e,t,r){let n=new Set(e),s=[...e].sort();for(let i=0;i<s.length;i+=1){r?.throwIfAborted();for(let o of[...t.get(s[i])??[]].sort())n.has(o)||(n.add(o),s.push(o))}return n}function ts(e,t,r,n){let s=0,i=0,o=0,d=0;for(let p of e.values())if(n?.throwIfAborted(),!t.has(p.id)&&!(p.missing||p.status==="external")){if(p.terminal){o+=1,r.has(p.id)&&(d+=1);continue}r.has(p.id)?s+=1:i+=1}let c=s+i,a=o-d,u=s+d,f=i+a,l=u+f;return{active_outcome_reachable_nodes:s,active_outcome_unreachable_nodes:i,active_outcome_reachability_basis_points:c===0?0:Math.floor(s*1e4/c),terminal_nodes:o,terminal_outcome_reachable_nodes:d,terminal_outcome_unreachable_nodes:a,terminal_outcome_reachability_basis_points:o===0?0:Math.floor(d*1e4/o),outcome_reachable_nodes:u,outcome_unreachable_nodes:f,outcome_reachability_basis_points:l===0?0:Math.floor(u*1e4/l)}}function ns(e,t,r){let n=new Set(e.details.filter(i=>i.type?.toLowerCase()===Br&&i.title.trim().toLowerCase().startsWith(Ur)).map(i=>i.id)),s=es(n,Zr(e,r),r);return{outcome_nodes:n.size,...ts(t,n,s,r)}}function rs(e,t,r,n,s){e.active+=1;let i=t.type??"(untyped)",o=e.byType.get(i);o||(o={active:0,isolated:0,degree_leq_one:0},e.byType.set(i,o)),o.active+=1,!(r>1)&&(e.degreeLeqOne+=1,o.degree_leq_one+=1,r===0&&(e.isolated+=1,o.isolated+=1),!(n.has(t.id.toLowerCase())||s.has(i.toLowerCase()))&&(r===0?e.isolates.push(t.id):e.sparse.push(t.id)))}function ss(e,t,r,n,s,i,o){let d={active:0,missing:0,isolated:0,degreeLeqOne:0,isolates:[],sparse:[],byType:new Map};for(let m of e.graph.nodes()){o?.throwIfAborted();let _=t.get(m);if(_){if(_.missing){d.missing+=1;continue}_.terminal||rs(d,_,e.graph.incidentEdges(m).length,r,n)}}let{isolates:c,sparse:a}=d,u=[];x(u,c,s,"isolated_active_node","warning","Active work should be reachable from the graph unless explicitly declared a valid isolate.",m=>`${m} active item(s) with no relationships`,"Link the item to its parent, prerequisite, or origin \u2014 or register it as an exempt isolate."),x(u,a,s,"sparse_active_node","info","Active items with a single edge often miss an honest semantic partner; sparse is not automatically defective.",m=>`${m} 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,l=M(e.graph,{signal:o}).value,p=new Set(l.map(({edge:m})=>`${m.source.toLowerCase()}\0${m.target.toLowerCase()}\0${m.kind}`));for(let m of e.orderingContradictions??[])p.add(`${m.holder_id.toLowerCase()}\0${m.target_id.toLowerCase()}\0${m.dependency_kind}`);let g=Object.fromEntries(Object.entries(i).sort(([m],[_])=>m.localeCompare(_))),h=Object.entries(g).reduce((m,[_,T])=>m+(Qe(_)?T:0),0),y=Te(e.graph,{signal:o}).value,b=ns(e,t,o);return{findings:u,profile:{nodes:e.graph.nodes().length,recorded_nodes:e.details.filter(m=>m.status!=="missing"&&m.status!=="external").length,edges:f,informative_edges:f-p.size,redundant_edges:l.length,ordering_contradiction_edges:e.orderingContradictions?.length??0,edge_basis:"deduplicated_directed",edges_by_kind:g,edge_share_by_kind:Object.fromEntries(Object.entries(g).map(([m,_])=>[m,_/f])),semantic_edges:h,semantic_edge_share:f===0?0:h/f,active_nodes:d.active,missing_nodes:d.missing,isolated_active_nodes:d.isolated,degree_leq_one_active_nodes:d.degreeLeqOne,coverage_by_type:Object.fromEntries([...d.byType.entries()].sort(([m],[_])=>m<_?-1:1)),articulation_points:y.articulationPoints.length,bridge_edges:y.bridges.length,...b,finding_subjects_by_code:Object.fromEntries(Ce.map(m=>[m,0]))}}}function De(e,t={}){let r=t.isTerminal??(l=>l==="closed"||l==="canceled"),n=t.isBlocked??(l=>l==="blocked"),s=t.maxSampleSize??qr;if(!Number.isInteger(s)||s<1)throw new TypeError(`Invalid audit sample bound: ${String(t.maxSampleSize)}`);let i=Qt(t.exemptIsolates),o=Qt(t.isolateExemptTypes),d=new Map(e.details.map(l=>[l.id,{id:l.id,status:l.status,missing:e.missingIdSet.has(l.id.toLowerCase()),terminal:r(l.status),...l.type===void 0?{}:{type:l.type}}]));t.signal?.throwIfAborted();let c={};for(let l of e.graph.edges())c[l.kind]=(c[l.kind]??0)+1;let a=Hr(e,r,s);t.signal?.throwIfAborted(),a.push(...Jr(e,s)),t.signal?.throwIfAborted(),a.push(...Xr(e,d,n,s)),t.signal?.throwIfAborted(),a.push(...Yr(e,d,s),...Qr(e,s)),t.signal?.throwIfAborted();let u=ss(e,d,i,o,s,c,t.signal);a.push(...u.findings),a.sort((l,p)=>Yt[l.severity]-Yt[p.severity]||l.code.localeCompare(p.code)||l.sample[0].localeCompare(p.sample[0]));let f=u.profile.finding_subjects_by_code;for(let l of a)f[l.code]+=l.count;return{findings:a,profile:{...u.profile,finding_subjects_by_code:f}}}function Je(e,t){let r=[...new Set([...Object.keys(e),...Object.keys(t)])].sort(),n={};for(let s of r){let i=(t[s]??0)-(e[s]??0);i!==0&&(n[s]=i)}return n}function Zt(e){return e.profile.coverage_by_type??{}}function is(e,t){let r={},n=Zt(e),s=Zt(t),i=[...new Set([...Object.keys(n),...Object.keys(s)])].sort();for(let o of i){let d=Object.assign({active:0,isolated:0,degree_leq_one:0},n[o]),c=Object.assign({active:0,isolated:0,degree_leq_one:0},s[o]),a={active:c.active-d.active,isolated:c.isolated-d.isolated,degree_leq_one:c.degree_leq_one-d.degree_leq_one};Object.values(a).some(u=>u!==0)&&(r[o]=a)}return r}function tn(e,t){let r=is(e,t),{edge_share_by_kind:n={},semantic_edges:s=0,semantic_edge_share:i=0}=e.profile,{edge_share_by_kind:o={},semantic_edges:d=0,semantic_edge_share:c=0}=t.profile,a=e.profile.recorded_nodes??e.profile.nodes,u=t.profile.recorded_nodes??t.profile.nodes,f=e.profile.informative_edges??e.profile.edges,l=t.profile.informative_edges??t.profile.edges,p=e.profile.redundant_edges??0,g=t.profile.redundant_edges??0,h=e.profile.ordering_contradiction_edges??0,y=t.profile.ordering_contradiction_edges??0;return{baseline_saved_at:e.saved_at,same_snapshot:e.fingerprint===t.fingerprint,affected_subjects_by_code:Je(e.affected_subjects_by_code,t.affected_subjects_by_code),profile:{nodes:t.profile.nodes-e.profile.nodes,recorded_nodes:u-a,edges:t.profile.edges-e.profile.edges,informative_edges:l-f,redundant_edges:g-p,ordering_contradiction_edges:y-h,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:Je(e.profile.edges_by_kind,t.profile.edges_by_kind),edge_share_by_kind:Je(n,o),semantic_edges:d-s,semantic_edge_share:c-i,coverage_by_type:r}}}import nn 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]="9e4aa41d-fca4-5e55-ab2b-d99f06d90ae2")}catch{}})();var rn=1,tt=500,os=64,ds="graph-durable-cache";function sn(e){return de(e,ds,30,`graph-cache:${process.pid}`,!1,!1,3e3)}function H(e){return nn.join(e,"runtime","graph-cache.json")}function on(e){return nn.join(e,"runtime","graph-audit-baseline.json")}function nt(e){if(e!==null)try{let t=JSON.parse(e);return typeof t!="object"||t===null||t.version!==rn||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 rt(e,t){let r=await q(H(e)),n=nt(r),s=n?.fingerprint===t;return{exists:r!==null,fresh:s,results:s?n.results:{}}}async function st(e,t,r,n,s){let i=await sn(e);try{let o=nt(await q(H(e))),d=o?.fingerprint===t?o.results:{};delete d[n],d[n]=s;let c=Object.keys(d);for(let a of c.slice(0,Math.max(0,c.length-os)))delete d[a];await B(H(e),JSON.stringify({version:rn,fingerprint:t,saved_at:new Date().toISOString(),results:d})),r.results=d}finally{await i()}}async function it(e){let t=await sn(e);try{await gt(H(e))}finally{await t()}}async function dn(e,t){let r=H(e),n=await q(r),s=nt(n);return s===void 0?{exists:n!==null,fresh:!1,entry_count:0}:{exists:!0,fresh:s.fingerprint===t,entry_count:Object.keys(s.results).length,fingerprint:s.fingerprint.slice(0,12),saved_at:s.saved_at,bytes:Buffer.byteLength(n,"utf8")}}function ot(e,t){return t||e>=tt}function Oe(e){return j(e)&&Object.values(e).every(O)}function j(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function O(e){return Number.isInteger(e)&&Number(e)>=0}function cn(e){return typeof e=="number"&&Number.isFinite(e)&&e>=0&&e<=1}function V(e,t){return e===void 0||t(e)}function cs(e){return j(e)&&Object.values(e).every(cn)}function as(e){return j(e)?Object.values(e).every(t=>j(t)&&[t.active,t.isolated,t.degree_leq_one].every(O)):!1}function us(e,t,r){let n=["recorded_nodes","informative_edges","redundant_edges","ordering_contradiction_edges"],s=n.filter(o=>e[o]!==void 0).length;if(s!==0&&s!==n.length||!n.every(o=>V(e[o],O)))return;let i={recorded_nodes:e.recorded_nodes??t,informative_edges:e.informative_edges??r,redundant_edges:e.redundant_edges??0,ordering_contradiction_edges:e.ordering_contradiction_edges??0};return i.recorded_nodes<=t&&i.informative_edges<=r&&i.redundant_edges<=r&&i.ordering_contradiction_edges<=r?i:void 0}function ls(e,t,r){let n=[...t,...r,"finding_subjects_by_code"],s=n.filter(i=>e[i]!==void 0).length;return s!==0&&s!==n.length?!1:t.every(i=>V(e[i],O))&&r.every(i=>V(e[i],O)&&(e[i]===void 0||Number(e[i])<=1e4))&&V(e.finding_subjects_by_code,Oe)}function fs(e,t,r,n){let s=us(e,r,n);if(s===void 0)return;let i=["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"],o=["active_outcome_reachability_basis_points","terminal_outcome_reachability_basis_points","outcome_reachability_basis_points"];if(!ls(e,i,o)||e.edge_basis!==void 0&&e.edge_basis!=="deduplicated_directed")return;let d=Oe(e.finding_subjects_by_code)?e.finding_subjects_by_code:{};return{edge_basis:"deduplicated_directed",...s,...Object.fromEntries(i.map(c=>[c,e[c]??0])),...Object.fromEntries(o.map(c=>[c,e[c]??0])),finding_subjects_by_code:Object.fromEntries(Ce.map(c=>[c,d[c]??t[c]??0]))}}function ps(e,t,r,n,s){let i=[r,n,s],o=i.filter(a=>a!==void 0).length;if(o===0)return{edge_share_by_kind:{},semantic_edges:0,semantic_edge_share:0};if(o!==i.length||!cs(r)||!O(n)||!cn(s))return;let d=Object.entries(t);if(d.reduce((a,[,u])=>a+u,0)!==e||Object.keys(r).length!==d.length||d.some(([a,u])=>r[a]!==(e===0?0:u/e)))return;let c=d.reduce((a,[u,f])=>a+(Qe(u)?f:0),0);if(!(n!==c||s!==(e===0?0:c/e)))return{edge_share_by_kind:r,semantic_edges:n,semantic_edge_share:s}}function gs(e){if(e!==null)try{let t=JSON.parse(e);if(!j(t))return;let r=t,n=r.profile;if(typeof r.saved_at!="string"||typeof r.fingerprint!="string")return;let s=r.affected_subjects_by_code;if(!Oe(s)||!j(n)||![n.nodes,n.edges,n.active_nodes,n.missing_nodes,n.isolated_active_nodes,n.degree_leq_one_active_nodes].every(O)||!Oe(n.edges_by_kind)||!V(n.coverage_by_type,as))return;let i=ps(n.edges,n.edges_by_kind,n.edge_share_by_kind,n.semantic_edges,n.semantic_edge_share);if(i===void 0)return;let o=fs(n,s,n.nodes,n.edges);if(o===void 0)return;let{coverage_by_type:d={}}=n;return{...r,profile:{...n,...i,...o,coverage_by_type:d}}}catch{return}}async function an(e){return gs(await q(on(e)))}async function un(e,t){await B(on(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]="1eb0e2cb-084a-5a54-b41c-29dfdd6d2f34")}catch{}})();var hs={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."},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 ln(e){return`${e.source} -${e.kind}-> ${e.target}`}function ms(e){let[t,...r]=e.edges;return r.map(n=>({op:"remove",code:"duplicate_edge",subject:ln(n),rationale:"This stored spelling restates the kept canonical edge of the same semantic family; removing it leaves the relationship stated exactly once.",evidence:[`keep: ${ln(t)}`,`group: ${Re(e)}`],confidence:"high"}))}function ys(e,t){if(e.code==="duplicate_edge")return e.sample.flatMap(n=>ms(t.get(n)));let r=hs[e.code];return e.sample.map(n=>({op:r.op,code:e.code,subject:n,rationale:r.rationale,evidence:[e.policy],confidence:r.confidence}))}function fn(e,t={}){let{redundancyLimit:r,...n}=t,s=De(e,n),i=new Map(et(e).map(a=>[Re(a),a])),o=s.findings.flatMap(a=>ys(a,i)),d=s.findings.some(a=>a.sample_truncated);t.signal?.throwIfAborted();let c=M(e.graph,{limit:r??t.maxSampleSize??25,...t.signal===void 0?{}:{signal:t.signal}});for(let a of c.value)o.push({op:"remove",code:"redundant_edge",subject:`${a.edge.source} -> ${a.edge.target} (${a.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: ${a.witness.join(" -> ")}`],confidence:"medium"});return d=d||c.meta.truncated,{steps:o,report:s,truncated:d,cost:{visitedNodes:c.meta.visitedNodes,inspectedEdges:c.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]="ee0547d9-ae0f-5762-8bff-e25f0a3cd4d5")}catch{}})();var _s=["tree","graph","context"],bs=["none","repeated"],ws=["outgoing","incoming","both"],vs=32,ks=200,xs=400,Es=16e3;function Is(e){let t=e?.trim().toLowerCase()??"tree";if(_s.includes(t))return t;throw new v(`Invalid --format value "${e}". Use "tree", "graph", or "context".`,w.USAGE)}function I(e,t){if(e===void 0)return;let r=typeof e=="number"?e:Number(e.trim());if(!Number.isInteger(r)||r<1)throw new v(`Invalid --${t} value "${e}". Use a positive integer.`,w.USAGE);return r}function Le(e){if(e===void 0)return;let t=typeof e=="number"?e:Number(e.trim());if(!Number.isInteger(t)||t<0)throw new v(`Invalid --max-depth value "${e}". Use a non-negative integer.`,w.USAGE);return t}function Ts(e){let t=e?.trim().toLowerCase()??"none";if(bs.includes(t))return t;throw new v(`Invalid --collapse value "${e}". Use "none" or "repeated".`,w.USAGE)}function ct(e){let t=e?.trim().toLowerCase()??"both";if(ws.includes(t))return t;throw new v(`Invalid --direction value "${e}". Use "outgoing", "incoming", or "both".`,w.USAGE)}function at(e,t=E()){if(e===void 0)return;let r=(Array.isArray(e)?e:[e]).flatMap(s=>s.split(",")).map(s=>s.trim()).filter(s=>s.length>0);if(r.length===0)return;let n=new Set;for(let s of r){let i=t.resolve(s);if(!i){let o=t.list().map(d=>d.kind).join(", ");throw new v(`Invalid --kind value "${s}". Registered kinds: ${o}.`,w.USAGE)}n.add(i.kind)}return[...n].sort()}function Cs(e){if(!e||e.length===0)return[];let t=e.map(({id:n,kind:s})=>({id:n.trim(),kind:s.trim().toLowerCase()})).sort((n,s)=>{let i=n.kind.localeCompare(s.kind);return i!==0?i:n.id.localeCompare(s.id)}),r=new Map;for(let n of t){let s=`${n.kind.toLowerCase()}::${n.id.toLowerCase()}`;r.has(s)||r.set(s,{id:n.id,kind:n.kind})}return[...r.values()]}function Ss(e){return{id:e.id,title:e.title,type:e.type,status:e.status,dependencies:Cs(e.dependencies)}}function Rs(e){return re(new TextEncoder().encode(JSON.stringify({...e,dependencies:void 0})).byteLength)}function Ds(e,t,r,n,s,i,o,d,c){for(let a of t.dependencies){let u=Math.max(1,Math.ceil(JSON.stringify({from:e.id,to:a.id,kind:a.kind}).length/3));if(d.nodes>=d.nodeLimit){e.truncated=!0,d.reasons.add("node_limit");break}if(d.edges>=d.edgeLimit){e.truncated=!0,d.reasons.add("edge_limit");break}if(d.estimatedTokens+u>=d.tokenBudget){e.truncated=!0,d.reasons.add("token_budget");break}d.edges+=1,d.estimatedTokens+=u,e.dependencies.push(gn(a.id,r,n,s,i,o,d,c+1,a.kind))}}function Os(e,t,r,n,s,i,o,d){return o.estimatedTokens>=o.tokenBudget&&t?.dependencies.length?(e.truncated=!0,o.reasons.add("token_budget"),!0):!t||e.cycle?!0:n!==void 0&&d>=n?(t.dependencies.length>0&&(e.truncated=!0,o.reasons.add("max_depth")),!0):s==="repeated"&&i.has(r)?(e.collapsed=!0,!0):!1}function gn(e,t,r,n,s,i,o,d=0,c){let a=e.trim().toLowerCase(),u=t.get(a),f={id:u?.id??e,title:u?.title,type:u?.type,status:u?.status,via:c,missing:!u,cycle:r.has(a),dependencies:[]};if(o.nodes+=1,o.estimatedTokens+=Rs(f),Os(f,u,a,n,s,i,o,d))return f;s==="repeated"&&i.add(a);let l=new Set(r);return l.add(a),Ds(f,u,t,l,n,s,i,o,d),f}function pn(e,t){return!e||e.missing&&!t.missing?t:{...e,title:e.title??t.title,type:e.type??t.type,status:e.status??t.status}}function Ls(e){let t=new Map,r=new Map,n=[e];for(;n.length>0;){let d=n.pop();t.set(d.id,pn(t.get(d.id),{id:d.id,title:d.title,type:d.type,status:d.status,missing:d.missing}));for(let c of d.dependencies){t.set(c.id,pn(t.get(c.id),{id:c.id,title:c.title,type:c.type,status:c.status,missing:c.missing}));let a=c.via??"related",u=`${d.id}::${c.id}::${a}`;r.has(u)||r.set(u,{from:d.id,to:c.id,kind:a}),c.cycle||n.push(c)}}let s=[...t.values()].sort((d,c)=>d.id.localeCompare(c.id)),i=[...r.values()].sort((d,c)=>{let a=d.from.localeCompare(c.from);if(a!==0)return a;let u=d.to.localeCompare(c.to);return u!==0?u:d.kind.localeCompare(c.kind)}),o=s.filter(d=>d.missing).map(d=>d.id);return{root_id:e.id,nodes:s,edges:i,missing_ids:o}}function hn(e,t,r){let n=new Set,s=new Set,i=new Set,o=new Set,d=[{id:e,depth:0}],c=0;for(;c<d.length;){let a=d[c++],u=a.id.trim().toLowerCase();n.add(u);let f=t.get(u);if(!f){i.add(u);continue}if(!(r!==void 0&&a.depth>=r)&&!o.has(u)){o.add(u);for(let l of f.dependencies)s.add(`${u}::${l.id.trim().toLowerCase()}::${l.kind}`),d.push({id:l.id,depth:a.depth+1})}}return{node_count:n.size,edge_count:s.size,edge_basis:"deduplicated_directed",missing_count:i.size}}function As(e,t=E()){let r=Le(e.maxDepth),n=I(e.nodeLimit,"node-limit"),s=I(e.edgeLimit,"edge-limit"),i=I(e.tokenBudget,"token-budget"),o=at(e.kind,t);return{direction:ct(e.direction),...o===void 0?{}:{kinds:o},...r===void 0?{}:{maxDepth:r},...n===void 0?{}:{nodeLimit:n},...s===void 0?{}:{edgeLimit:s},...i===void 0?{}:{tokenBudget:i},...e.cursor?.trim()?{cursor:e.cursor.trim()}:{}}}function Ns(e,t,r,n){return $t(e.graph,t,e.details.map(s=>s.id===t&&n.length>0?{...s,evidence:n}:s),r)}function dt(e,t,r,n){for(let s of r.slice(0,n)){let i=s?.trim();i&&e.push(`${t}:${i}`)}}async function $s(e,t,r,n){let s=await bt(e,t,r.id_prefix,r.item_format,n);if(!s)return[];let{document:i}=await wt(s,{schema:r.schema}),o=i.metadata,d=o.files??[],c=o.tests??[],a=o.docs??[],u=[["files",d.length],["tests",c.length],["docs",a.length],["comments",(o.comments??[]).length],["notes",(o.notes??[]).length],["learnings",(o.learnings??[]).length]];if(u.every(([,l])=>l===0))return[];let f=[`linked:${u.map(([l,p])=>`${l}=${p}`).join(",")}`];return dt(f,"file",d.map(l=>l.path),3),dt(f,"test",c.map(l=>l.command??l.path),2),dt(f,"doc",a.map(l=>l.path),2),f}function Ms(e){let{canonicalId:t,context:r,missingCount:n,missingReferences:s,referenceLimit:i,summaryOnly:o}=e;return{id:t,format:"context",node_count:r.nodes.length+1,edge_count:r.edges.length,edge_basis:"deduplicated_directed",missing_count:n,missing_scope:"traversal",missing_reference_count:s.length,...o?{}:{missing_references:s.slice(0,i),context:r}}}function js(e){let{row:t,missingReachableSet:r,packetIds:n,filteredKinds:s,registry:i}=e;if(t.no_active_blocker_sentinel||!r.has(t.target_id.trim().toLowerCase())||!n.has(t.holder_id))return!1;if(s===void 0)return!0;let o=i.resolve(t.kind);return o!==void 0&&(s.has(o.kind)||o.inverse!==void 0&&s.has(o.inverse))}function mn(e,t,r){let n;for(;;){let s=re(new TextEncoder().encode(Pe(je("deps",e),t)).byteLength);if(s===n)return s;r(s),n=s}}function Ps(e){return e instanceof TypeError&&e.message.startsWith("Relationship context tokenBudget cannot fit ")}function Fs(e){try{return Ns(e.assembly,e.canonicalId,{...e.contextOptions,...e.internalTokenBudget===void 0?{}:{tokenBudget:e.internalTokenBudget}},e.rootEvidence)}catch(t){if(e.smallestResult!==void 0&&Ps(t))return e.smallestResult;throw t}}function Gs(e){let{assembly:t,canonicalId:r,contextOptions:n,rootEvidence:s,summaryOnly:i,outputFormat:o,missingCount:d,missingReferences:c}=e,u=n.edgeLimit??40,f=n.tokenBudget,l,p;for(;;){let g=Fs({assembly:t,canonicalId:r,contextOptions:n,internalTokenBudget:f,rootEvidence:s,smallestResult:p});if("format"in g)return g;let h=g;l??=h.meta.tokenBudget,f??=l;let y=Ms({canonicalId:r,context:h,missingCount:d,missingReferences:c,referenceLimit:u,summaryOnly:i});if(p=y,i||(h.meta.tokenBudget=l,h.meta.usedTokens=mn(P(y,!1),o,_=>{h.meta.usedTokens=_}),h.meta.usedTokens<=l))return y;if(u>0){u-=1;continue}let b=f,m=b*l/h.meta.usedTokens;f=Math.min(b-1,Math.max(1,Math.floor(m*.9)))}}function qs(e){let{assembly:t,canonicalId:r,options:n,rootEvidence:s,summaryOnly:i,outputFormat:o}=e,d=As(n,t.graph.registry()),c=t.graph.closure(r,{direction:d.direction,...d.kinds===void 0?{}:{kinds:d.kinds},maxDepth:d.maxDepth??3}),a=c.value.filter(h=>t.missingIdSet.has(h.toLowerCase())),u=new Set(a.map(h=>h.toLowerCase())),f=t.graph.registry(),l=d.kinds?new Set(d.kinds.map(h=>f.require(h).kind)):void 0,p=new Set([r,...c.value]),g=[...t.dangling.active,...t.dangling.legacy_terminal].filter(h=>js({row:h,missingReachableSet:u,packetIds:p,filteredKinds:l,registry:f}));return Gs({assembly:t,canonicalId:r,contextOptions:d,rootEvidence:s,summaryOnly:i,outputFormat:o,missingCount:a.length,missingReferences:g})}function Bs(e){let t=[e],r;for(;t.length>0;){let n=t.pop();n.dependencies.length>0&&(r=n,t.push(...n.dependencies))}return r?(r.dependencies.pop(),r.truncated=!0,!0):!1}function Us(e,t,r,n,s,i,o){let d=s??vs,c=I(r.nodeLimit,"node-limit")??ks,a=I(r.edgeLimit,"edge-limit")??xs,u=I(r.tokenBudget,"token-budget")??Es,f={nodeLimit:c,edgeLimit:a,tokenBudget:u,nodes:0,edges:0,estimatedTokens:0,reasons:new Set},l=gn(e,n,new Set,d,t==="graph"?"repeated":i,new Set,f),p=hn(e,n,void 0),g;for(;;){let h=Ls(l),y=f.reasons.size===0?void 0:{reasons:[...f.reasons].sort(),limits:{max_depth:d,node_limit:c,edge_limit:a,token_budget:u},estimated_tokens:0,total_node_count:p.node_count,total_edge_count:p.edge_count,omitted_node_count:Math.max(0,p.node_count-h.nodes.length),omitted_edge_count:Math.max(0,p.edge_count-h.edges.length)},b={id:e,format:t,node_count:h.nodes.length,edge_count:h.edges.length,edge_basis:"deduplicated_directed",missing_count:h.missing_ids.length,...y?{truncation:y}:{}};if(g=t==="tree"?{...b,tree:l}:{...b,graph:h},(g.truncation===void 0?re(new TextEncoder().encode(Pe(je("deps",P(g,!1)),o)).byteLength):mn(P(g,!1),o,_=>{g.truncation.estimated_tokens=_}))<=u)return g;if(!Bs(l))return f.reasons.add("token_budget"),g;f.reasons.add("token_budget")}}function P(e,t,r={}){let n={name:e.format==="tree"?"dependency_tree":e.format==="graph"?"dependency_graph":"relationship_context",restore_with:"--full"};return{...e,legacy_alias_counts:r,projection:{mode:t?"summary":"full",declared_field_groups:[n],included_field_groups:t?[]:[n.name]}}}async function vo(e,t,r){let n=Z(process.cwd(),r.path);if(!await Y(ee(n)))throw new v(`Tracker is not initialized at ${n}. Run pm init first.`,w.NOT_FOUND);let s=Is(t.format),i=Le(t.maxDepth),o=Ts(t.collapse);se(t.summary===!0,t.full===!0,"--summary");let d=t.summary===!0,c=await ce(n),a=Q(c,oe()),u=await ae(n,c.item_format,a.type_to_folder,void 0,c.schema),f=ne(c.schema),l=new Map(u.map(g=>[g.id.trim().toLowerCase(),Ss(g)])),p=xt(u,g=>R(g,f));for(let g of[...p.active,...p.legacy_terminal]){let h=l.get(g.holder_id.trim().toLowerCase()),y=g.kind.trim().toLowerCase();h&&!h.dependencies.some(b=>b.id.trim().toLowerCase()===g.target_id.trim().toLowerCase()&&b.kind===y)&&h.dependencies.push({id:g.target_id,kind:y})}if(!l.has(e.trim().toLowerCase()))throw new v(`Item ${e} not found`,w.NOT_FOUND);if(s==="context"){let g=l.get(e.trim().toLowerCase()).id,h=d?[]:await $s(n,g,c,a.type_to_folder),y=_=>R(_,f),b=N(),m=me().lookup(n,he(u,y,b),()=>$(u,y,b));return P(qs({assembly:m.assembly,canonicalId:g,options:t,rootEvidence:h,summaryOnly:d,outputFormat:r.json===!0?"json":"toon"}),d,m.assembly.legacyAliasCounts)}return d?P({id:e,format:s,...hn(e,l,i)},!0,Object.fromEntries(Object.entries($(u,g=>R(g,f)).legacyAliasCounts))):P(Us(e,s,t,l,i,o,r.json===!0?"json":"toon"),!1,Object.fromEntries(Object.entries($(u,g=>R(g,f)).legacyAliasCounts)))}(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]="6c8bfb7a-687a-5fbb-b408-ffdbab1187a9")}catch{}})();var wn=new Set(["ancestors","descendants","predecessors","successors","paths","impact","dominators"]),S=10;function yn(e,t,r){return{...e,projection:{mode:t?"summary":"full",declared_field_groups:r===void 0?[]:[{name:r,restore_with:"--full"}],included_field_groups:r===void 0||t?[]:[r]}}}function _n(e){return e===void 0?[]:(Array.isArray(e)?e:[e]).flatMap(t=>t.split(",")).map(t=>t.trim()).filter(t=>t.length>0)}function zs(e,t,r){let n=e.trim().toLowerCase();if(!Me.includes(n))throw vt({command_path:"graph",token:n||"<empty>",allowed:Me});let s=n;if(wn.has(s)&&!t?.trim())throw new v(`graph ${s} requires an item id.`,w.USAGE);if(s==="paths"&&!r?.trim())throw new v("graph paths requires a source and a target item id.",w.USAGE);return s}function ut(e){throw e instanceof TypeError?new v(e.message,w.USAGE):e}function lt(e){return{truncated:e.truncated,cost:{visited_nodes:e.visitedNodes,inspected_edges:e.inspectedEdges}}}function bn(e,t){let r=t.trim().toLowerCase();for(let n of e.details)if(n.id.trim().toLowerCase()===r&&!e.missingIdSet.has(n.id.toLowerCase()))return n.id;throw new v(`Item ${t} not found`,w.NOT_FOUND)}function Ks(e,t,r){let n={ancestors:Pt,descendants:Ft,predecessors:Gt,successors:qt}[e],s;try{s=n(r.assembly.graph,t,{...r.kinds===void 0?{}:{kinds:r.kinds},...r.maxDepth===void 0?{}:{maxDepth:r.maxDepth},...r.limit===void 0?{}:{limit:r.limit},...r.after===void 0?{}:{after:r.after}})}catch(o){ut(o)}let i=lt(s.meta);return{subcommand:e,root:t,count:s.value.length,...i,...s.meta.nextCursor===void 0?{}:{next_cursor:s.meta.nextCursor},...r.summary?{}:{ids:s.value}}}function Ws(e,t,r){let n=Bt(r.assembly.graph,e,t,{direction:r.direction,...r.kinds===void 0?{}:{kinds:r.kinds},...r.maxDepth===void 0?{}:{maxDepth:r.maxDepth},...r.maxPaths===void 0?{}:{maxPaths:r.maxPaths}});return{subcommand:"paths",root:e,target:t,direction:r.direction,count:n.value.length,...lt(n.meta),...r.summary?{}:{paths:n.value.map(s=>({nodes:s.nodes,kinds:s.edges.map(i=>i.kind),length:s.length}))}}}function Vs(e,t){let r;try{r=Ot(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??S},...t.after===void 0?{}:{after:t.after}})}catch(n){ut(n)}return{subcommand:"impact",root:e,direction:t.direction,count:r.affected.length,truncated:r.truncated,...r.nextCursor===void 0?{}:{next_cursor:r.nextCursor},cost:{visited_nodes:r.cost.visitedNodes,inspected_edges:r.cost.inspectedEdges},...t.summary?{}:{affected:r.affected}}}function Hs(e){let t=e.assembly.graph,r=e.limit??S,n=ge(t,{registry:t.registry()}),s=Lt(t);return{subcommand:"analyze",node_count:t.nodes().length,edge_count:t.edges().length,edge_basis:"deduplicated_directed",sample_limit:r,execution:{acyclic:n.acyclic,ordered_node_count:n.order.length,layer_count:n.layers.length,frontier_count:n.frontier.length,critical_path_length:n.criticalPathLength,cycle_count:n.cycles.length,...e.summary?{}:{frontier:n.frontier.slice(0,r),critical_path:n.criticalPath.slice(0,r),cycles:n.cycles.slice(0,r)}},knowledge:{component_count:s.components.length,largest_component_size:s.components[0]?.length??0,orphan_count:s.orphans.length,...e.summary?{}:{orphans:s.orphans.slice(0,r),hubs:s.hubs.slice(0,r)}}}}function Js(e,t){let r=De(e.assembly,{isTerminal:t,...e.sample===void 0?{}:{maxSampleSize:e.sample},...e.exemptIsolates.length===0?{}:{exemptIsolates:e.exemptIsolates},...e.exemptIsolateTypes.length===0?{}:{isolateExemptTypes:e.exemptIsolateTypes}}),n={},s={},i={},o={};for(let d of r.findings)n[d.severity]=(n[d.severity]??0)+1,s[d.code]=(s[d.code]??0)+1,i[d.severity]=(i[d.severity]??0)+d.count,o[d.code]=(o[d.code]??0)+d.count;return{subcommand:"audit",finding_count:r.findings.length,findings_by_severity:n,findings_by_code:s,affected_subjects_by_severity:i,affected_subjects_by_code:o,profile:r.profile,legacy_alias_counts:e.assembly.legacyAliasCounts,...e.summary?{}:{findings:r.findings}}}function Xs(e){let t=e.limit??S,r={};e.kinds!==void 0&&(r.kinds=e.kinds);let n=zt(e.assembly.graph,r),s=n.value;return{subcommand:"communities",community_count:s.communities.length,largest_community_size:s.communities[0]?.size??0,iterations:s.iterations,converged:s.converged,truncated:!s.converged||s.communities.length>t,cost:{visited_nodes:n.meta.visitedNodes,inspected_edges:n.meta.inspectedEdges},...e.summary?{}:{communities:s.communities.slice(0,t).map(i=>({representative:i.representative,size:i.size,members:i.members.slice(0,t)}))}}}function Ys(e){let t;try{t=M(e.assembly.graph,{...e.kinds===void 0?{}:{kinds:e.kinds},...e.maxDepth===void 0?{}:{maxDepth:e.maxDepth},...e.limit===void 0?{}:{limit:e.limit}})}catch(r){ut(r)}return{subcommand:"redundancy",redundant_count:t.value.length,...lt(t.meta),...e.summary?{}:{redundant:t.value.map(r=>({source:r.edge.source,target:r.edge.target,kind:r.edge.kind,witness:r.witness}))}}}function Qs(e,t){let r=t.limit??S,n=Kt(t.assembly.graph,e,{direction:t.direction,...t.kinds===void 0?{}:{kinds:t.kinds},...t.maxDepth===void 0?{}:{maxDepth:t.maxDepth}}),s=n.value.rows.filter(i=>i.dominatedCount>0);return{subcommand:"dominators",root:e,direction:t.direction,reachable_count:n.value.reachableCount,bottleneck_count:s.length,truncated:n.meta.truncated||s.length>r,cost:{visited_nodes:n.meta.visitedNodes,inspected_edges:n.meta.inspectedEdges},...t.summary?{}:{bottlenecks:s.slice(0,r).map(i=>({id:i.id,idom:i.idom,dominated_count:i.dominatedCount}))}}}function Zs(e){let t=e.limit??S,r=Xt(e.assembly.graph),n=r.rows.filter(s=>s.critical).length;return{subcommand:"slack",acyclic:r.acyclic,makespan:r.makespan,scheduled_count:r.scheduledCount,critical_count:n,critical_path_length:r.criticalPathLength,cycle_count:r.cycles.length,truncated:r.rows.length>t,...e.summary?{}:{critical_path:r.criticalPath,rows:r.rows.slice(0,t).map(s=>({id:s.id,earliest_start:s.earliestStart,latest_start:s.latestStart,slack:s.slack,critical:s.critical}))}}}function ei(e){let t=e.limit??S,r=Jt(e.assembly.graph,e.kinds===void 0?{}:{kinds:e.kinds}),n=r.value;return{subcommand:"centrality",node_count:n.nodeCount,edge_count:n.edgeCount,edge_basis:"simple_undirected",truncated:n.rows.length>t,cost:{visited_nodes:r.meta.visitedNodes,inspected_edges:r.meta.inspectedEdges},...e.summary?{}:{rows:n.rows.slice(0,t).map(s=>({id:s.id,degree:s.degree,in_degree:s.inDegree,out_degree:s.outDegree,betweenness:s.betweenness,closeness:s.closeness}))}}}function ti(e){let t=e.limit??S,r=Te(e.assembly.graph,e.kinds===void 0?{}:{kinds:e.kinds}),{articulationPoints:n,bridges:s}=r.value;return{subcommand:"articulation",articulation_count:n.length,bridge_count:s.length,truncated:n.length>t||s.length>t,cost:{visited_nodes:r.meta.visitedNodes,inspected_edges:r.meta.inspectedEdges},...e.summary?{}:{articulation_points:n.slice(0,t),bridges:s.slice(0,t)}}}function ni(e,t){let r=e.limit??S,n=fn(e.assembly,{isTerminal:t,redundancyLimit:r,...e.sample===void 0?{}:{maxSampleSize:e.sample},...e.exemptIsolates.length===0?{}:{exemptIsolates:e.exemptIsolates},...e.exemptIsolateTypes.length===0?{}:{isolateExemptTypes:e.exemptIsolateTypes}}),s={},i={};for(let o of n.steps)s[o.op]=(s[o.op]??0)+1,i[o.code]=(i[o.code]??0)+1;return{subcommand:"plan",step_count:n.steps.length,steps_by_op:s,steps_by_code:i,finding_count:n.report.findings.length,truncated:n.truncated||n.steps.length>r,cost:{visited_nodes:n.cost.visitedNodes,inspected_edges:n.cost.inspectedEdges},...e.summary?{}:{steps:n.steps.slice(0,r)}}}function vn(e,t,r,n){return JSON.stringify({subcommand:e,root:t??null,target:r??null,kinds:n.kinds??null,maxDepth:n.maxDepth??null,limit:n.limit??null,after:n.after??null,direction:n.direction,maxPaths:n.maxPaths??null,sample:n.sample??null,exemptIsolates:[...new Set(n.exemptIsolates.map(s=>s.toLowerCase()))].sort(),exemptIsolateTypes:[...new Set(n.exemptIsolateTypes.map(s=>s.toLowerCase()))].sort(),summary:n.summary,unbounded:n.unbounded})}function kn(e,t,r,n,s){return e==="analyze"?Hs(n):e==="audit"?Js(n,s):e==="plan"?ni(n,s):e==="communities"?Xs(n):e==="redundancy"?Ys(n):e==="dominators"?Qs(t,n):e==="slack"?Zs(n):e==="centrality"?ei(n):e==="articulation"?ti(n):e==="paths"?Ws(t,r,n):e==="impact"?Vs(t,n):Ks(e,t,n)}function ri(e,t){if(e!=="index"&&(t.rebuild===!0||t.clear===!0))throw new v("--rebuild and --clear apply only to graph index.",w.USAGE);if(e!=="audit"&&t.saveBaseline===!0)throw new v("--save-baseline applies only to graph audit.",w.USAGE);if(e==="slack"&&t.kind!==void 0)throw new v("graph slack analyzes every ordering kind; --kind is not supported.",w.USAGE);if(t.rebuild===!0&&t.clear===!0)throw new v("graph index accepts either --rebuild or --clear, not both.",w.USAGE);if(e==="impact"&&t.full===!0&&t.limit!==void 0)throw new v("graph impact accepts either --full or --limit, not both.",w.USAGE)}async function si(e,t,r,n,s,i){let o="status";if(i.clear===!0&&(await it(e),o="cleared"),i.rebuild===!0){await it(e);let c=await rt(e,t),a={assembly:r.assembly,direction:"both",exemptIsolates:[],exemptIsolateTypes:[],saveBaseline:!1,summary:!0,unbounded:!1};for(let u of["analyze","audit"])await st(e,t,c,vn(u,void 0,void 0,a),kn(u,void 0,void 0,a,s));o="rebuilt"}let d=await dn(e,t);return{subcommand:"index",action:o,state:d.exists?d.fresh?"fresh":"stale":"absent",entry_count:d.entry_count,item_count:n,min_items_threshold:tt,persist_enabled:ot(n,d.exists),current_fingerprint:t.slice(0,12),...d.saved_at===void 0?{}:{saved_at:d.saved_at},...d.bytes===void 0?{}:{bytes:d.bytes}}}async function ii(e,t,r,n){let s={saved_at:new Date().toISOString(),fingerprint:t,affected_subjects_by_code:r.affected_subjects_by_code,profile:r.profile},i=await an(e);return n&&await un(e,s),i===void 0?r:{...r,baseline:tn(i,s)}}async function oi(e,t,r,n,s){try{await st(e,t,r,n,s)}catch{}}async function Vo(e,t,r,n,s){let i=zs(e,t,r);se(n.summary===!0,n.full===!0,"--summary");let o=Z(process.cwd(),s.path);if(!await Y(ee(o)))throw new v(`Tracker is not initialized at ${o}. Run pm init first.`,w.NOT_FOUND);let d=await ce(o),c=Q(d,oe()),a=await ae(o,d.item_format,c.type_to_folder,void 0,d.schema),u=ne(d.schema),f=G=>R(G,u);ri(i,n);let l=N(),p=at(n.kind,l),g=me().lookup(o,he(a,f,l),()=>$(a,f,l)),h={assembly:g.assembly,...p===void 0?{}:{kinds:p},maxDepth:Le(n.maxDepth),limit:I(n.limit,"limit"),after:n.after?.trim()||void 0,direction:ct(n.direction),maxPaths:I(n.maxPaths,"max-paths"),sample:I(n.sample,"sample"),exemptIsolates:_n(n.exemptIsolate),exemptIsolateTypes:_n(n.exemptIsolateType),saveBaseline:n.saveBaseline===!0,summary:n.summary===!0,unbounded:n.full===!0};if(i==="index")return yn(await si(o,g.fingerprint,h,a.length,f,n),!1);let y=wn.has(i)?bn(h.assembly,t):void 0,b=i==="paths"?bn(h.assembly,r):void 0,m=vn(i,y,b,h),_=await rt(o,g.fingerprint),T=_.results[m],k=g.memoize(m,()=>T!==void 0?structuredClone(T):kn(i,y,b,h,f)),J=ot(a.length,_.exists);!k.reused&&T===void 0&&J&&await oi(o,g.fingerprint,_,m,k.value);let F=k.value.subcommand==="audit"?await ii(o,g.fingerprint,k.value,h.saveBaseline):k.value;return F.cache={fingerprint:g.fingerprint.slice(0,12),assembly:g.assemblyReused?"hit":"miss",result:k.reused?"hit":"miss",durable:T!==void 0?"hit":J?"miss":"off"},yn(F,h.summary,"result_rows")}(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]="94e8b95b-35fa-5fc7-843a-481497e09b54")}catch{}})();function xn(e){return[...e].sort().join("\0")}function di(e,t,r){let n=e.successors.get(t);n?n.push(r):e.successors.set(t,[r]);let s=e.predecessors.get(r);s?s.push(t):e.predecessors.set(r,[t])}function En(e,t,r,n,s){let i=t.resolve(s);if(i?.ordering!==!0)return;let o=kt(n),d=o===void 0?void 0:e.canonicalIds.get(o.toLowerCase());if(d===void 0)return;let c=(i.precedence??"source_before_target")==="source_before_target";di(e,c?r:d,c?d:r)}function ci(e,t){let r={successors:new Map,predecessors:new Map,canonicalIds:new Map},n=e.filter(s=>typeof s?.id=="string"&&s.id.trim().length>0);for(let s of n){let i=s.id.trim();r.canonicalIds.set(i.toLowerCase(),i)}for(let s of n){let i=s.id.trim();En(r,t,i,s.blocked_by,"blocked_by");for(let o of s.dependencies??[])typeof o!="object"||o===null||En(r,t,i,o.id,typeof o.kind=="string"?o.kind:"related")}for(let s of[r.successors,r.predecessors])for(let i of s.values())i.sort();return r}function ai(e,t){let r=new Set([t]),n=[t];for(;n.length>0;){let s=n.pop();for(let i of[e.successors,e.predecessors])for(let o of i.get(s)??[])r.has(o)||(r.add(o),n.push(o))}return r}function ui(e,t){let r=new Map;for(let n of t){let s=(e.successors.get(n)??[]).filter(i=>t.has(i));s.length>0&&r.set(n,s)}return r}function In(e,t,r){let n=ci(e,t),s=n.canonicalIds.get(r.trim().toLowerCase());if(s===void 0)return{cycles:[],successors:new Map,canonical:r};let i=ui(n,ai(n,s));return{cycles:Ze(i).filter(o=>o.includes(s)),successors:i,canonical:s}}function li(e,t,r){let n=new Set(t),s=n.has(r)?r:t[0];if(e.get(s)?.includes(s))return[s,s];for(let i of e.get(s)??[]){if(!n.has(i))continue;let o=fi(e,n,s,i);if(o)return o}return[...t,t[0]]}function fi(e,t,r,n){let s=[[n]],i=new Set([r,n]);for(;s.length>0;){let o=s.shift(),d=o.at(-1);for(let c of e.get(d)??[]){if(c===r)return[r,...o,r];!t.has(c)||i.has(c)||(i.add(c),s.push([...o,c]))}}}function Yo(e,t,r){let n=N(),s=In(e,n,r),i=In(t,n,r),o=new Set(s.cycles.map(xn)),d=new Set(Fe(e,void 0,n).map(a=>`${a.holder_id.toLowerCase()}\0${a.target_id.toLowerCase()}\0${a.dependency_kind}`));return[...Fe(t,void 0,n).filter(a=>a.holder_id.toLowerCase()===r.trim().toLowerCase()&&!d.has(`${a.holder_id.toLowerCase()}\0${a.target_id.toLowerCase()}\0${a.dependency_kind}`)).map(a=>`ordering_storage_contradiction_created:${Se(a)}:remove_contradicting_dependency_row:run_pm_graph_audit`),...i.cycles.filter(a=>!o.has(xn(a))).map(a=>`ordering_cycle_created:${li(i.successors,a,i.canonical).join(" -> ")}:items_will_not_be_ready:run_pm_graph_audit`)]}export{Ue as a,It as b,ge as c,Ot as d,Lt as e,Ei as f,he as g,ze as h,me as i,Ri as j,$t as k,vo as l,Pt as m,Ft as n,Gt as o,qt as p,Bt as q,ke as r,zt as s,M as t,Kt as u,Jt as v,Te as w,Xt as x,Ze as y,Se as z,Re as A,et as B,De as C,tn as D,rn as E,tt as F,H as G,on as H,rt as I,st as J,it as K,dn as L,ot as M,an as N,un as O,fn as P,zs as Q,Vo as R,Yo as S};
|
|
8
|
-
//# sourceMappingURL=chunk-F43TT2QQ.js.map
|