@unbrained/pm-cli 2026.10.21 → 2026.10.22

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.
Files changed (138) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/CHANGELOG.md +117 -77
  3. package/dist/cli/error-guidance.js +2 -2
  4. package/dist/cli-bundle/bundle-manifest.json +1 -1
  5. package/dist/cli-bundle/chunks/{chunk-KBSVPUFD.js → chunk-35ISFIPC.js} +35 -35
  6. package/dist/cli-bundle/chunks/{chunk-DIR3YEFD.js → chunk-5LSN7K4N.js} +2 -2
  7. package/dist/cli-bundle/chunks/{chunk-DR6DUBTU.js → chunk-7OTYULIJ.js} +3 -3
  8. package/dist/cli-bundle/chunks/{chunk-TMXWWOPJ.js → chunk-AOAQDCXX.js} +2 -2
  9. package/dist/cli-bundle/chunks/{chunk-ZNKFMIVA.js → chunk-BAIVTLJM.js} +2 -2
  10. package/dist/cli-bundle/chunks/{chunk-NNB65OOO.js → chunk-C37RDYZI.js} +2 -2
  11. package/dist/cli-bundle/chunks/{chunk-EMGMLKRV.js → chunk-E3JC3WQL.js} +4 -4
  12. package/dist/cli-bundle/chunks/{chunk-5PZ7JNMI.js → chunk-HC2DCGFA.js} +2 -2
  13. package/dist/cli-bundle/chunks/{chunk-V5GJTXYW.js → chunk-J444ZX23.js} +26 -26
  14. package/dist/cli-bundle/chunks/{chunk-V3XONSVC.js → chunk-LIC5EUQS.js} +2 -2
  15. package/dist/cli-bundle/chunks/{chunk-DJQVNDXO.js → chunk-MV3KYY2A.js} +6 -6
  16. package/dist/cli-bundle/chunks/chunk-O67N62DT.js +2 -0
  17. package/dist/cli-bundle/chunks/{chunk-C6SAXKBO.js → chunk-PCPOTFJP.js} +2 -2
  18. package/dist/cli-bundle/chunks/chunk-TNU3XVPC.js +20 -0
  19. package/dist/cli-bundle/chunks/{chunk-MOC5BJHW.js → chunk-URV4VHQ4.js} +2 -2
  20. package/dist/cli-bundle/chunks/{chunk-QPV6UD55.js → chunk-UYYTV2TX.js} +2 -2
  21. package/dist/cli-bundle/chunks/chunk-VO3KDIU7.js +9 -0
  22. package/dist/cli-bundle/chunks/{indexed-receipt-blobs-65XXSPPR.js → indexed-receipt-blobs-L3BOTMZN.js} +2 -2
  23. package/dist/cli-bundle/chunks/{mutation-admission-FNWOVJLN.js → mutation-admission-TATOFEXF.js} +2 -2
  24. package/dist/cli-bundle/chunks/{register-list-query-6PT5Y2EZ.js → register-list-query-GULR2IYO.js} +2 -2
  25. package/dist/cli-bundle/chunks/{register-mutation-TAIQV46L.js → register-mutation-HLSQ4WVW.js} +2 -2
  26. package/dist/cli-bundle/chunks/{register-operations-ONIRO22G.js → register-operations-FE3GGA7O.js} +2 -2
  27. package/dist/cli-bundle/chunks/{register-setup-OQMUZBJV.js → register-setup-XUIKAIZA.js} +2 -2
  28. package/dist/cli-bundle/chunks/{stage-FCPVFO3B.js → stage-QCPZBZRC.js} +2 -2
  29. package/dist/cli-bundle/focused-chunks/chunk-25L3L2PF.js +2 -0
  30. package/dist/cli-bundle/focused-chunks/{chunk-PDOWLRHC.js → chunk-25NQRZ7J.js} +2 -2
  31. package/dist/cli-bundle/focused-chunks/{chunk-XE7P7N5X.js → chunk-2GFTVXKZ.js} +6 -6
  32. package/dist/cli-bundle/focused-chunks/chunk-46HBJC6J.js +2 -0
  33. package/dist/cli-bundle/focused-chunks/{chunk-32ZKLRWM.js → chunk-A52W6GLA.js} +2 -2
  34. package/dist/cli-bundle/focused-chunks/chunk-CB7TSZ7P.js +3 -0
  35. package/dist/cli-bundle/focused-chunks/{chunk-5IMM7GOF.js → chunk-CX5FNEFC.js} +2 -2
  36. package/dist/cli-bundle/focused-chunks/chunk-DVNUHTVK.js +9 -0
  37. package/dist/cli-bundle/focused-chunks/{chunk-VD64TPXI.js → chunk-EHPRSWJE.js} +2 -2
  38. package/dist/cli-bundle/focused-chunks/{chunk-P5D7MHDS.js → chunk-GC4VMLXL.js} +15 -15
  39. package/dist/cli-bundle/focused-chunks/{chunk-CUWNNU4N.js → chunk-GVKYTDOH.js} +2 -2
  40. package/dist/cli-bundle/focused-chunks/{chunk-HNCMYF2W.js → chunk-KM77WU5U.js} +2 -2
  41. package/dist/cli-bundle/focused-chunks/chunk-QGDKWULS.js +2 -0
  42. package/dist/cli-bundle/focused-chunks/{chunk-YIWDX6KO.js → chunk-QWKCQ5PW.js} +2 -2
  43. package/dist/cli-bundle/focused-chunks/chunk-SOVXHW6Z.js +2 -0
  44. package/dist/cli-bundle/focused-chunks/{chunk-4HJVAUFX.js → chunk-SXVJRLLP.js} +2 -2
  45. package/dist/cli-bundle/focused-chunks/{chunk-KVYUQS6Y.js → chunk-TMN3RAXZ.js} +2 -2
  46. package/dist/cli-bundle/focused-chunks/{chunk-7UD7XTOE.js → chunk-UQ5JPBY2.js} +11 -11
  47. package/dist/cli-bundle/focused-chunks/{chunk-JMZPZQHR.js → chunk-UUPJ6OZL.js} +13 -13
  48. package/dist/cli-bundle/focused-chunks/{chunk-JI3RXXRN.js → chunk-VYAZND5Q.js} +2 -2
  49. package/dist/cli-bundle/focused-chunks/{chunk-T27TLSEU.js → chunk-W2CND3BD.js} +3 -3
  50. package/dist/cli-bundle/focused-chunks/{chunk-44353U27.js → chunk-XX5JQCLF.js} +2 -2
  51. package/dist/cli-bundle/focused-chunks/{indexed-receipt-blobs-CRP6HAZY.js → indexed-receipt-blobs-AAQOKO5B.js} +2 -2
  52. package/dist/cli-bundle/focused-chunks/{mutation-admission-KM57KDDF.js → mutation-admission-TBKR4KRM.js} +2 -2
  53. package/dist/cli-bundle/focused-chunks/{stage-UJYGWNZ7.js → stage-RM6MJIMT.js} +2 -2
  54. package/dist/cli-bundle/main.js +21 -21
  55. package/dist/cli-bundle/sdk-authoring.js +1 -1
  56. package/dist/cli-bundle/sdk-contracts.js +2 -2
  57. package/dist/cli-bundle/sdk-core.js +21 -21
  58. package/dist/cli-bundle/sdk-governance.js +1 -1
  59. package/dist/cli-bundle/sdk-graph.js +1 -1
  60. package/dist/cli-bundle/sdk-merge.js +58 -58
  61. package/dist/cli-bundle/sdk-query.js +1 -1
  62. package/dist/cli-bundle/sdk-runtime.js +1 -1
  63. package/dist/cli-bundle/sdk-testing.js +1 -1
  64. package/dist/cli-bundle/sdk.js +7 -7
  65. package/dist/mcp/server.d.ts +2 -2
  66. package/dist/mcp/server.js +1 -1
  67. package/dist/sdk/agent/command-recovery.d.ts +2 -0
  68. package/dist/sdk/agent/command-recovery.js +1 -1
  69. package/dist/sdk/cli-contracts/tool-option-contracts.d.ts +6 -0
  70. package/dist/sdk/cli-contracts/tool-option-contracts.js +1 -1
  71. package/dist/sdk/cli-contracts/tool-schema.js +1 -1
  72. package/dist/sdk/context-intent-contracts.d.ts +13 -0
  73. package/dist/sdk/context-intent-contracts.js +1 -1
  74. package/dist/sdk/contracts.d.ts +1 -1
  75. package/dist/sdk/contracts.js +1 -1
  76. package/dist/sdk/core.d.ts +2 -2
  77. package/dist/sdk/core.js +1 -1
  78. package/dist/sdk/define.d.ts +15 -16
  79. package/dist/sdk/define.js +1 -1
  80. package/dist/sdk/dependencies.js +1 -1
  81. package/dist/sdk/generated/generated-error-code-catalog-part-1.js +1 -1
  82. package/dist/sdk/merge/install.js +2 -2
  83. package/dist/sdk/public-surface.json +1 -1
  84. package/dist/sdk/query/context.d.ts +5 -0
  85. package/dist/sdk/query/context.js +2 -2
  86. package/dist/sdk/read-output/session-result.d.ts +39 -0
  87. package/dist/sdk/read-output/session-result.js +2 -0
  88. package/dist/sdk/read-output-contracts.d.ts +18 -5
  89. package/dist/sdk/read-output-contracts.js +1 -1
  90. package/dist/sdk/read-output-session.d.ts +2 -0
  91. package/dist/sdk/read-output-session.js +1 -1
  92. package/dist/sdk/relationship-context.js +1 -1
  93. package/dist/sdk/runtime-input.js +1 -1
  94. package/dist/sdk/runtime-primitives.d.ts +6 -0
  95. package/dist/sdk/runtime-primitives.js +1 -1
  96. package/dist/sdk/runtime.d.ts +10 -8
  97. package/dist/sdk/runtime.js +1 -1
  98. package/dist/sdk/workspace.d.ts +3 -1
  99. package/dist/sdk/workspace.js +8 -5
  100. package/docs/CONFIGURATION.md +9 -0
  101. package/docs/DEVELOPMENT_DEPENDENCY_SECURITY.md +30 -0
  102. package/docs/MCP_OPTION_CONFORMANCE.md +27 -1
  103. package/docs/MERGE_SAFETY.md +8 -0
  104. package/docs/READ_OUTPUT_CONTRACTS.md +79 -0
  105. package/docs/RELATIONSHIP_GRAPH.md +15 -0
  106. package/docs/RELEASING.md +8 -0
  107. package/docs/SDK.md +37 -7
  108. package/docs/TESTING.md +5 -0
  109. package/marketplace.json +1 -1
  110. package/package.json +1 -1
  111. package/packages/pm-beads/package.json +1 -1
  112. package/packages/pm-calendar/package.json +1 -1
  113. package/packages/pm-command-kit/package.json +1 -1
  114. package/packages/pm-digital-twin/package.json +1 -1
  115. package/packages/pm-governance-audit/package.json +1 -1
  116. package/packages/pm-guide-shell/package.json +1 -1
  117. package/packages/pm-kanban/package.json +1 -1
  118. package/packages/pm-lifecycle-hooks/package.json +1 -1
  119. package/packages/pm-linked-test-adapters/package.json +1 -1
  120. package/packages/pm-search-advanced/package.json +1 -1
  121. package/packages/pm-templates/package.json +1 -1
  122. package/packages/pm-todos/package.json +1 -1
  123. package/packages/pm-vcs/package.json +1 -1
  124. package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
  125. package/plugins/pm-claude/package.json +1 -1
  126. package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
  127. package/plugins/pm-codex/package.json +1 -1
  128. package/plugins/pm-codex/plugin.json +1 -1
  129. package/runtime-dependencies.json +1 -1
  130. package/dist/cli-bundle/chunks/chunk-4OYU5OXQ.js +0 -6
  131. package/dist/cli-bundle/chunks/chunk-DIKQ2AL5.js +0 -2
  132. package/dist/cli-bundle/chunks/chunk-MZZIAC6S.js +0 -20
  133. package/dist/cli-bundle/focused-chunks/chunk-6QSZHRM7.js +0 -6
  134. package/dist/cli-bundle/focused-chunks/chunk-E2S42XCT.js +0 -2
  135. package/dist/cli-bundle/focused-chunks/chunk-GRSQGMRR.js +0 -2
  136. package/dist/cli-bundle/focused-chunks/chunk-IAGFXKMZ.js +0 -3
  137. package/dist/cli-bundle/focused-chunks/chunk-O3M6YWVL.js +0 -2
  138. package/dist/cli-bundle/focused-chunks/chunk-VE6MTRH5.js +0 -2
@@ -1,4 +1,4 @@
1
- import{c as ze,e as Fe,f as $e,h as Ln,i as Hn,j as zn,k as Fn,l as $n,m as Mn}from"./chunk-KVYUQS6Y.js";import{h as Jn}from"./chunk-YLVHHWHN.js";import{Ad as G,B as Tn,Dc as Wn,Dd as qn,Ea as jn,Ed as Gn,Fa as A,Ga as M,Gd as Bn,Ha as ot,Ia as y,Jd as V,ea as Dn,i as Qe,j as kn,ja as Pn,k as Sn,l as In,m as On,mc as Vn,me as Kt,oc as it,q as et,r as tt,s as An,sc as Un,wd as Me,x as rt,xd as q,y as nt,yd as st,z as Bt,za as Ee,zd as ke}from"./chunk-JMZPZQHR.js";import{B as Cn,C as se,D as ae,E as J,F as Nn,G as Jt,H as He,I as Rn,l as B,t as xn,w as p,x as Le,y as w,z as b}from"./chunk-3LWH2RJC.js";import{createHash as _s}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]="ca5b60a5-80a7-5e7d-917f-4c7649bcbab6")}catch{}})();var Vl=["sha256","sha512"],fs="sha256",Kn="sha256";function ce(e){if(e===void 0)return fs;if(e==="sha256"||e==="sha512")return e;throw new TypeError(`unsupported_history_hash_algorithm:${String(e)}`)}function K(e,t){return _s(ce(t)).update(e,"utf8").digest("hex")}(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]="4d5692ce-ec33-5eb4-bd9b-7497ffe25b0e")}catch{}})();var ms=16;function Xt(e){let t=e.trim().replaceAll(/[^A-Za-z0-9]+/g," ").split(/\s+/).filter(o=>o.length>0).map(o=>o.toLowerCase());if(t.length===0)return e;let[r,...n]=t;return`${r}${n.map(o=>`${o.slice(0,1).toUpperCase()}${o.slice(1)}`).join("")}`}function ps(e){return[...new Set([Mn(e),Xt(e.key),Xt(e.cli_flag),...e.cli_aliases.map(t=>Xt(t))])]}function Zn(e,t){for(let r of ps(t)){if(!Object.hasOwn(e,r))continue;let n=e[r];if(n!==void 0)return n}}function Qn(e){return Array.isArray(e)?e.flatMap(t=>Qn(t)).map(t=>t.trim()).filter(t=>t.length>0):typeof e=="string"?e.split(/[,\n|]/).map(t=>t.trim()).filter(t=>t.length>0):e==null?[]:[String(e).trim()].filter(t=>t.length>0)}function Xn(e,t){if(typeof e=="boolean")return e;if(typeof e=="number"){if(e===1)return!0;if(e===0)return!1}if(typeof e=="string"){let r=e.trim().toLowerCase();if(r==="true"||r==="1"||r==="yes")return!0;if(r==="false"||r==="0"||r==="no")return!1}throw new b(`${t} must be one of true|false|1|0|yes|no`,w.USAGE)}function Yn(e,t){if(typeof e=="number"&&Number.isFinite(e))return e;let r=typeof e=="string"?e.trim():String(e),n=Number(r);if(!Number.isFinite(n))throw new b(`${t} must be a number`,w.USAGE);return n}function hs(e,t,r){let n=typeof e=="string"?(()=>{try{return JSON.parse(e)}catch{return}})():e;if(r==="array"&&Array.isArray(n)||r==="object"&&typeof n=="object"&&n!==null&&!Array.isArray(n))return n;throw new b(`${t} must be valid JSON ${r}`,w.USAGE)}function ys(e,t){return t===void 0?!0:t==="array"?Array.isArray(e):t==="object"?typeof e=="object"&&e!==null&&!Array.isArray(e):typeof e===t}function gs(e,t,r){if(t.const!==void 0&&A(e)!==A(t.const))return`${r} must equal ${A(t.const)}`;if(t.enum!==void 0&&!t.enum.some(n=>A(n)===A(e)))return`${r} must be one of ${t.enum.map(n=>A(n)).join("|")}`;if(!ys(e,t.type))return`${r} must match configured type ${String(t.type)}`;if(typeof e=="string"){if(t.min_length!==void 0&&e.length<t.min_length)return`${r} must contain at least ${t.min_length} characters`;if(t.format==="date-time"&&!st(e))return`${r} must be an RFC 3339 date-time`}}function vs(e,t,r,n){if(Array.isArray(e)){if(t.min_items!==void 0&&e.length<t.min_items)return`${r} must contain at least ${t.min_items} items`;if(t.items)for(let[o,i]of e.entries()){let s=at(i,t.items,`${r}[${o}]`,n+1);if(s)return s}}}function bs(e,t,r,n){if(typeof e!="object"||e===null||Array.isArray(e))return;let o=e;for(let i of t.required??[])if(!Object.hasOwn(o,i))return`${r}.${i} is required`;for(let[i,s]of Object.entries(o)){let a=t.properties?.[i];if(!a){if(t.additional_properties===!1)return`${r}.${i} is not allowed`;continue}let d=at(s,a,`${r}.${i}`,n+1);if(d)return d}}function at(e,t,r,n=0){if(n>ms)return`${r} value schema exceeds maximum depth`;let o=gs(e,t,r);if(o)return o;let i=vs(e,t,r,n);if(i)return i;let s=bs(e,t,r,n);if(s)return s;if(!t.one_of)return;let a=0;for(let d of t.one_of)if(at(e,d,r,n+1)===void 0&&(a+=1,a>1))break;return a===1?void 0:`${r} must match exactly one configured schema variant`}function de(e,t,r){if(!e.value_schema||t===void 0)return t;let n=at(t,e.value_schema,r);if(n)throw new b(n,w.USAGE);return t}function ws(e,t,r,n){let o=n==="option"&&Array.isArray(t)?t[t.length-1]:t;if(o!==void 0)return de(e,hs(o,r,e.type),r)}function Ve(e,t,r,n="option"){let o=r??`--${e.cli_flag}`;if(e.type==="array"||e.type==="object")return ws(e,t,o,n);if(e.repeatable||e.type==="string_array"){let s=Qn(t);return e.type==="number"?de(e,s.map(a=>Yn(a,o)),o):e.type==="boolean"?de(e,s.map(a=>Xn(a,o)),o):de(e,s,o)}let i=Array.isArray(t)?t[t.length-1]:t;if(i!==void 0)return e.type==="number"?de(e,Yn(i,o),o):e.type==="boolean"?de(e,Xn(i,o),o):de(e,typeof i=="string"?i:String(i),o)}function Es(e,t){return!e.required&&!e.required_on_create?!1:e.required_types.length===0?!0:t?e.required_types.map(r=>r.toLowerCase()).includes(t.trim().toLowerCase()):!1}function Kl(e,t,r){let n={},o=[];for(let i of t.command_to_fields.get("create")??[]){let s=Zn(e,i);if(s===void 0){Es(i,r)&&o.push(`--${i.cli_flag}`);continue}n[i.metadata_key]=Ve(i,s)}return{values:n,missing_required_flags:[...new Set(o)].sort((i,s)=>i.localeCompare(s))}}function Xl(e,t,r=["update"]){let n={},o=(r??["update"]).flatMap(s=>t.command_to_fields.get(s)??[]),i=new Set;for(let s of o){let a=Zn(e,s);a!==void 0&&(i.has(s.metadata_key)||(i.add(s.metadata_key),n[s.metadata_key]=Ve(s,a)))}return 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]="c35d4830-d7d1-5ee4-99bc-ab52cc3e4e09")}catch{}})();var Yt=1,Zt=2;function Zl(e){return Math.max(Qt(e),e.tests?.some(t=>t.updated_by!==void 0||t.updated_at!==void 0)?2:1)}function Qt(e){let t=e.pm_format_version;return typeof t=="number"&&Number.isInteger(t)&&t>=1?t:1}function eo(e){if(!(typeof e!="number"||!Number.isInteger(e)||e<=1))return e}function ks(e,t=2,r=t){return e<r?"outdated":e>t?"ahead":"current"}function Ql(e,t=2,r=t){let n=[],o=[];for(let i of e){let s=ks(i.version,t,r);s==="outdated"?n.push(i.ref):s==="ahead"&&o.push(i.ref)}return{outdated:n.sort((i,s)=>i.localeCompare(s)),ahead:o.sort((i,s)=>i.localeCompare(s))}}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="515840b7-cf86-5d71-8ac1-beac7fd7c8a8")}catch{}})();var Ss={"in-progress":"in_progress",cancelled:"canceled"};function ct(e,t){if(t){let o=Fn(e,t);if(o)return o}if(typeof e!="string")return;let r=e.trim().toLowerCase();if(!r)return;let n=Ss[r]??r;if(Qe.includes(n))return n}function Is(e,t){return ct(e,t)??e}function nu(e,t){return t.terminal_statuses.has(Is(e,t))}import{encode as xs}from"@toon-format/toon";import{isDeepStrictEqual as to}from"node:util";import{decode as Os}from"@toon-format/toon";(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]="aaa2be03-9478-5fbe-82e6-e4fc86e3735b")}catch{}})();function er(e){return{value:Os(e),usedScalarBracketEscape:!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]="79626299-17a8-573a-9b66-ce37c65e2f5d")}catch{}})();var As=/^\s*(<<<<<<<|=======|>>>>>>>)(?:\s.*)?$/;function Ts(e){if(e.length===0)return[];let t=e.split(/\r?\n/),r=[];for(let n=0;n<t.length;n+=1){let o=t[n]??"",i=o.match(As);if(!i)continue;let s=i[1];r.push({line:n+1,marker:s,text:o})}return r}function dt(e){return Ts(e)[0]}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="2789e87f-0706-52e8-8f4c-3855c65c618c")}catch{}})();var or=new Set(["schema","tracker","auto","none"]),so=new Set(["source","isolated","snapshot"]),Cs=new Set(["legacy","local_mutation","local_source_ref","acknowledged","invalid_provenance","foreign_source_ref"]),Ns=new Set(["passed","failed","stopped","canceled"]),Rs=new Set(Tn);function Oe(e){return e.replaceAll("\\","/")}function ao(e){for(let t of e)if(t!==0)return t;return 0}function ut(e){for(let[t,r]of Object.entries(e))r===void 0&&delete e[t]}var co=["id","title","description","created_at","updated_at"],Ds=new Set(B);function lo(e){if(e?.schema)return{statusRegistry:zn(e.schema),fieldRegistry:$n(e.schema),unknownFieldPolicy:e.schema.unknown_field_policy??"allow",extensionFieldNames:new Set(e.extensionFieldNames??[]),onWarning:e.onWarning}}function Ps(e,t){return e.required?e.required_types.length===0?!0:e.required_types.map(r=>r.toLowerCase()).includes(t.trim().toLowerCase()):!1}function X(e){let t=e.match(/^([a-z_][\w.]*)\s/u)?.[1];throw new b(`Invalid item metadata: ${e}`,w.GENERIC_FAILURE,{code:"item_document_invalid",reason:e.includes("required")?"missing_required_field":"schema_validation_error",...t?{field:t}:{},required:"Provide an item document whose metadata satisfies the active runtime schema.",why:e})}function qe(e,t){throw new b(t,w.GENERIC_FAILURE,{code:"item_document_invalid",reason:"syntax_error",format:e,required:`Provide a syntactically valid ${e==="toon"?"TOON":"JSON Markdown"} item document.`,why:"The document could not be decoded far enough to validate item metadata."})}function uo(e,t){if(!t||typeof e!="object"||e===null)return;let r=Qt(e);if(!(r<=Zt))throw new b(`Stored item uses format version ${r}; this runtime supports up to ${Zt}. Upgrade pm before reading or changing this item.`,w.CONFLICT,{code:"item_format_version_unsupported",format_version:r,required:"Upgrade to a pm runtime supporting the stored item format.",nextSteps:["Preserve the original item and history; do not lower pm_format_version to bypass compatibility checks."]})}function _o(e){let t=new Set(Ds);for(let r of e.fieldRegistry?.definitions??[])t.add(r.metadata_key);for(let r of e.extensionFieldNames)t.add(r);return t}function h(e,t){e||X(t)}function Ge(e,t){return(typeof e!="object"||e===null||Array.isArray(e))&&X(t),e}function tr(e,t){let r=e[t];h(typeof r=="string",`${t} must be a string`),h(q(r),`${t} must be a valid ISO timestamp`)}function ro(e,t,r){let n=e[t];n!==void 0&&h(typeof n=="number"&&Number.isInteger(n)&&n>=1,`${r} must be an integer >= 1`)}function ir(e,t,r){let n=e[t];n!==void 0&&(h(typeof n=="string",`${r} must be a string`),h(q(n),`${r} must be a valid ISO timestamp`))}function js(e){if(e!==void 0){h(Array.isArray(e),"event.recurrence.by_weekday must be an array");for(let t of e){h(typeof t=="string","event.recurrence.by_weekday entries must be strings");let r=t.trim().toLowerCase();h(nt.includes(r),`event.recurrence.by_weekday entries must be one of: ${nt.join(", ")}`)}}}function Ls(e){if(e!==void 0){h(Array.isArray(e),"event.recurrence.by_month_day must be an array");for(let t of e)h(typeof t=="number"&&Number.isInteger(t)&&t>=1&&t<=31,"event.recurrence.by_month_day entries must be integers 1..31")}}function Hs(e){if(e!==void 0){h(Array.isArray(e),"event.recurrence.exdates must be an array");for(let t of e)h(typeof t=="string","event.recurrence.exdates entries must be strings"),h(q(t),"event.recurrence.exdates entries must be valid ISO timestamps")}}function zs(e){let t=Ge(e,"event.recurrence must be an object");h(typeof t.freq=="string","event.recurrence.freq must be a string");let r=t.freq.trim().toLowerCase();h(rt.includes(r),`event.recurrence.freq must be one of: ${rt.join(", ")}`),ro(t,"interval","event.recurrence.interval"),ro(t,"count","event.recurrence.count"),ir(t,"until","event.recurrence.until"),js(t.by_weekday),Ls(t.by_month_day),Hs(t.exdates)}function Fs(e){for(let n of co)h(typeof e[n]=="string",`${n} is required and must be a string`);let t=e.type;h(typeof t=="string"&&t.trim().length>0,"type must be a non-empty string");let r=e.pm_format_version;return r!==void 0&&h(typeof r=="number"&&Number.isInteger(r)&&r>=Yt,`pm_format_version must be an integer >= ${Yt}`),t}function $s(e,t){let r=e.status;h(typeof r=="string"&&r.trim().length>0,"status must be a non-empty string");let n=t?.statusRegistry,o=ct(r,n),i=n?n.definitions.map(s=>s.id):[...Qe];h(o!==void 0,`status must be one of: ${i.join(", ")}`)}function Ms(e){let t=e.priority;h(typeof t=="number"&&Number.isInteger(t)&&[0,1,2,3,4].includes(t),"priority must be an integer 0..4");let r=e.tags;h(Array.isArray(r),"tags must be an array");for(let n of r)h(typeof n=="string","tags entries must be strings")}function Vs(e){let t=e.confidence;if(t!==void 0){if(typeof t=="number"){h(Number.isInteger(t)&&t>=0&&t<=100,"confidence number value must be an integer 0..100");return}if(typeof t=="string"){let r=t.trim().toLowerCase(),n=r==="med"||tt.includes(r);h(n,`confidence string value must be one of: ${[...tt,"med"].join(", ")}`);return}h(!1,"confidence must be a number or string")}}function Us(e){let t=e.severity;if(t===void 0)return;typeof t!="string"&&X("severity must be a string");let r=t.trim().toLowerCase(),n=r==="med"||et.includes(r);h(n,`severity value must be one of: ${[...et,"med"].join(", ")}`)}function Ws(e){e.regression!==void 0&&typeof e.regression!="boolean"&&X("regression must be a boolean")}function qs(e){let t=e.reminders;if(t!==void 0){h(Array.isArray(t),"reminders must be an array");for(let r of t){let n=Ge(r,"reminders entries must be objects");h(typeof n.at=="string","reminder.at must be a string"),h(q(n.at),"reminder.at must be a valid ISO timestamp"),h(typeof n.text=="string","reminder.text must be a string"),h(n.text.trim().length>0,"reminder.text must not be empty")}}}function Gs(e){for(let t of["title","description","location","timezone"])e[t]!==void 0&&(h(typeof e[t]=="string",`event.${t} must be a string`),h(e[t].trim().length>0,`event.${t} must not be empty`))}function Bs(e){e.recurrence!==void 0&&(zs(e.recurrence),e.recurrence.until!==void 0&&h(G(e.recurrence.until,e.start_at)>=0,"event.recurrence.until must be at or after event.start_at"))}function Js(e){let t=Ge(e,"events entries must be objects");h(typeof t.start_at=="string","event.start_at must be a string"),h(q(t.start_at),"event.start_at must be a valid ISO timestamp"),t.end_at!==void 0&&(h(typeof t.end_at=="string","event.end_at must be a string"),h(q(t.end_at),"event.end_at must be a valid ISO timestamp"),h(G(t.end_at,t.start_at)>0,"event.end_at must be after event.start_at")),Gs(t),t.all_day!==void 0&&h(typeof t.all_day=="boolean","event.all_day must be a boolean"),Bs(t)}function Ks(e){let t=e.events;if(t!==void 0){h(Array.isArray(t),"events must be an array");for(let r of t)Js(r)}}function Xs(e){for(let t of["source_type","source_owner","design","external_ref"]){let r=e[t];r!==void 0&&h(typeof r=="string",`${t} must be a string`)}}function Ys(e){let t=e.type_options;if(t===void 0)return;let r=Ge(t,"type_options must be an object");for(let[n,o]of Object.entries(r))h(n.trim().length>0,"type_options keys must be non-empty"),h(typeof o=="string","type_options values must be strings"),h(o.trim().length>0,"type_options values must be non-empty strings")}function Zs(e,t,r){if(r?.fieldRegistry)for(let n of r.fieldRegistry.definitions){let o=e[n.metadata_key];if(o===void 0){Ps(n,t)&&X(`missing required schema field: ${n.metadata_key}`);continue}try{e[n.metadata_key]=Ve(n,o,`metadata field "${n.metadata_key}"`,"metadata")}catch(i){X(String(i?.message).replace(/^Invalid\s+/u,""))}}}function Qs(e,t){if(!t||t.unknownFieldPolicy==="allow")return;let r=_o(t),n=Object.keys(e).filter(o=>!r.has(o)).sort((o,i)=>o.localeCompare(i));n.length!==0&&(t.unknownFieldPolicy==="reject"?X(`unknown schema fields are not allowed: ${n.join(", ")}`):t.onWarning?.(`item_unknown_schema_fields:${n.join(",")}`))}function sr(e,t){let r=Ge(e,"item metadata must be an object"),n=Fs(r);$s(r,t),Ms(r),Vs(r),Us(r),Ws(r),tr(r,"created_at"),tr(r,"updated_at"),r.deadline!==void 0&&tr(r,"deadline"),qs(r),Ks(r),ir(r,"closed_at","closed_at"),ir(r,"completed_at","completed_at"),Xs(r),Ys(r),Zs(r,n,t),Qs(r,t)}function ea(e){if(!(!e||e.length===0))return[...e].map((t,r)=>(h(t.created_at===void 0||typeof t.created_at=="string"&&st(t.created_at),`dependencies.${r}.created_at requires a valid timestamp; restore the dependency timestamp from its source record`),{id:t.id.trim(),kind:t.kind,created_at:t.created_at,author:t.author?.trim()||void 0,source_kind:t.source_kind?.trim()||void 0,author_source:t.author_source})).sort((t,r)=>{let n=G(t.created_at??"",r.created_at??"");if(n!==0)return n;let o=t.id.localeCompare(r.id);if(o!==0)return o;let i=t.kind.localeCompare(r.kind);return i!==0?i:(t.source_kind??"").localeCompare(r.source_kind??"")})}function rr(e){if(!(!e||e.length===0))return[...e].sort((t,r)=>{let n=G(t.created_at,r.created_at);if(n!==0)return n;let o=t.text.localeCompare(r.text);return o!==0?o:t.author.localeCompare(r.author)})}function ta(e){if(!e||e.length===0)return;let t=[...e].map(r=>({at:r.at,text:r.text.trim()})).filter(r=>r.text.length>0).sort((r,n)=>{let o=G(r.at,n.at);return o!==0?o:r.text.localeCompare(n.text)});return t.length===0?void 0:t}function ra(e){if(!e)return;let t=e.freq.trim().toLowerCase();if(!rt.includes(t))return;let r=Array.from(new Set((e.by_weekday??[]).map(s=>s.trim().toLowerCase()).filter(s=>nt.includes(s)))).sort((s,a)=>Bt(s)-Bt(a)),n=Array.from(new Set((e.by_month_day??[]).filter(s=>Number.isInteger(s)&&s>=1&&s<=31).map(s=>s))).sort((s,a)=>s-a),o=Array.from(new Set((e.exdates??[]).map(s=>s.trim()).filter(s=>q(s)))).sort((s,a)=>G(s,a)),i={freq:t,interval:e.interval!==void 0&&e.interval>1?e.interval:void 0,count:e.count,until:e.until?.trim()||void 0,by_weekday:r.length>0?r:void 0,by_month_day:n.length>0?n:void 0,exdates:o.length>0?o:void 0};for(let[s,a]of Object.entries(i))a===void 0&&delete i[s];return i}function na(e){return!Array.isArray(e)||e.length===0?void 0:[...e].map(oa).sort(ia)}function oa(e){let t={start_at:e.start_at,end_at:e.end_at||void 0,title:e.title?.trim()||void 0,description:e.description?.trim()||void 0,location:e.location?.trim()||void 0,all_day:e.all_day,timezone:e.timezone?.trim()||void 0,recurrence:ra(e.recurrence)};return ut(t),t}function ia(e,t){return ao([G(e.start_at,t.start_at),(e.end_at??"").localeCompare(t.end_at??""),(e.title??"").localeCompare(t.title??""),+!!e.all_day-+!!t.all_day,(e.timezone??"").localeCompare(t.timezone??""),(e.location??"").localeCompare(t.location??""),(e.description??"").localeCompare(t.description??""),JSON.stringify(e.recurrence??{}).localeCompare(JSON.stringify(t.recurrence??{}))])}function sa(e){if(!(!e||e.length===0))return e.map(t=>({path:Oe(t.path),scope:t.scope,note:t.note?.trim()||void 0}))}function aa(e){if(!e||e.length===0)return;let t=e.map(ua).filter(r=>r.run_id.length>0&&r.started_at.length>0&&r.finished_at.length>0&&r.recorded_at.length>0).sort((r,n)=>ao([G(r.recorded_at,n.recorded_at),r.run_id.localeCompare(n.run_id),r.kind.localeCompare(n.kind)]));return t.length>0?t:void 0}function Se(e){return typeof e=="number"&&Number.isFinite(e)&&e>=0?Math.floor(e):void 0}function ca(e){return typeof e=="number"&&Number.isFinite(e)&&e>=1?Math.floor(e):void 0}function nr(e){return typeof e=="string"?e:""}function da(e){if(!Array.isArray(e))return;let t=e.filter(n=>n!==null&&typeof n=="object"&&typeof n.name=="string"&&n.name.trim().length>0&&typeof n.value=="number"&&Number.isFinite(n.value)&&typeof n.recorded_at=="string"&&n.recorded_at.trim().length>0).map(n=>({name:n.name.trim(),value:n.value,unit:typeof n.unit=="string"&&n.unit.trim()||void 0,threshold:typeof n.threshold=="number"&&Number.isFinite(n.threshold)?n.threshold:void 0,recorded_at:n.recorded_at.trim()})),r=[...new Map(t.map(n=>[n.name,n])).values()].sort((n,o)=>n.name.localeCompare(o.name)).slice(0,32);return r.length>0?r:void 0}function lt(e,t){return typeof e=="string"&&t.has(e)?e:void 0}function la(e){if(!Array.isArray(e))return;let t=e.filter(r=>r&&typeof r.command=="string"&&r.command.trim().length>0).slice(0,32).map(r=>({command:r.command.trim(),requested_pm_context_mode:lt(r.requested_pm_context_mode,or),pm_context_mode:lt(r.pm_context_mode,or),workspace_context_mode:lt(r.workspace_context_mode,so),trust_reason:lt(r.trust_reason,Cs)}));return t.length>0?t:void 0}function ua(e){let t=typeof e.run_id=="string"?e.run_id.trim():"",r=e.kind==="test"||e.kind==="test-all"?e.kind:"test",n=Ns.has(e.status)?e.status:"failed",o={run_id:t,kind:r,status:n,started_at:nr(e.started_at),finished_at:nr(e.finished_at),recorded_at:nr(e.recorded_at),attempt:ca(e.attempt),resumed_from:e.resumed_from?.trim()||void 0,passed:Se(e.passed)??0,failed:Se(e.failed)??0,skipped:Se(e.skipped)??0,items:Se(e.items),linked_tests:Se(e.linked_tests),fail_on_skipped_triggered:e.fail_on_skipped_triggered===!0?!0:void 0,measurements:da(e.measurements),executions:la(e.executions)};return ut(o),o}function _a(e){if(!(!Array.isArray(e)||e.length===0))return e.map(ya)}function Ue(e){if(!Array.isArray(e))return;let t=[...new Set(e.filter(r=>typeof r=="string").map(r=>r.trim()).filter(r=>r.length>0))].sort((r,n)=>r.localeCompare(n));return t.length>0?t:void 0}function lr(e){if(!e||typeof e!="object"||Array.isArray(e))return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}function ur(e){return e==="__proto__"||e==="constructor"||e==="prototype"}function no(e){if(!lr(e))return;let t=Object.entries(e).map(([r,n])=>[r.trim(),String(n).trim()]).filter(([r,n])=>r.length>0&&!ur(r)&&n.length>0).sort(([r],[n])=>r.localeCompare(n));return t.length>0?Object.fromEntries(t):void 0}function fa(e){if(!lr(e))return;let t=Object.entries(e).map(([r,n])=>[r.trim(),Number(n)]).filter(([r,n])=>r.length>0&&!ur(r)&&Number.isFinite(n)).sort(([r],[n])=>r.localeCompare(n));return t.length>0?Object.fromEntries(t):void 0}function ma(e){let t=e?.trim().toLowerCase();if(!(!t||!or.has(t)))return t}function pa(e){let t=e?.trim().toLowerCase();if(!(!t||!so.has(t)))return t}function ha(e,t){if(t===!0)return{provenance_invalid:!0};if(e===void 0)return{};if(!lr(e))return{provenance_invalid:!0};let r=f(e.author),n=f(e.created_at),o=e.source_kind;return!r||!n||!q(n)||o!=="local_mutation"&&o!=="merge_union"?{provenance_invalid:!0}:{provenance:{author:r,created_at:n,source_kind:o,source_ref:f(e.source_ref)}}}function ya(e){let t={command:e.command?.trim()||void 0,path:e.path?Oe(e.path):void 0,scope:e.scope,timeout_seconds:typeof e.timeout_seconds=="number"&&Number.isFinite(e.timeout_seconds)&&e.timeout_seconds>0?e.timeout_seconds:void 0,pm_context_mode:ma(e.pm_context_mode),workspace_context_mode:pa(e.workspace_context_mode),...ha(e.provenance,e.provenance_invalid),updated_by:f(e.updated_by),updated_at:f(e.updated_at),env_set:no(e.env_set),env_clear:Ue(e.env_clear),shared_host_safe:e.shared_host_safe===!0?!0:void 0,assert_stdout_contains:Ue(e.assert_stdout_contains),assert_stdout_regex:Ue(e.assert_stdout_regex),assert_stderr_contains:Ue(e.assert_stderr_contains),assert_stderr_regex:Ue(e.assert_stderr_regex),assert_stdout_min_lines:Se(e.assert_stdout_min_lines),assert_json_field_equals:no(e.assert_json_field_equals),assert_json_field_gte:fa(e.assert_json_field_gte),note:e.note?.trim()||void 0};return ut(t),t}function ga(e){if(!(!e||e.length===0))return[...e].map(t=>({path:Oe(t.path),scope:t.scope,note:t.note?.trim()||void 0})).sort((t,r)=>{let n=t.scope.localeCompare(r.scope);if(n!==0)return n;let o=t.path.localeCompare(r.path);return o!==0?o:(t.note??"").localeCompare(r.note??"")})}function f(e){if(typeof e!="string")return;let t=e.trim();return t.length>0?t:void 0}function va(e){if(!Array.isArray(e))return;let t=[];for(let r of e){if(r===null||typeof r!="object")continue;let n=r,o=f(n.id),i=f(n.kind);if(!o||!i)continue;let s={id:o,kind:i},a=f(n.note);a&&(s.note=a),n.required_before_step===!0&&(s.required_before_step=!0),t.push(s)}return t.length>0?t:void 0}function ba(e){if(!Array.isArray(e))return;let t=[];for(let r of e){if(r===null||typeof r!="object")continue;let n=r,o=f(n.path);if(!o)continue;let i={path:Oe(o)};(n.scope==="project"||n.scope==="global")&&(i.scope=n.scope);let s=f(n.note);s&&(i.note=s),t.push(i)}return t.length>0?t:void 0}function wa(e){if(!Array.isArray(e))return;let t=[];for(let r of e){if(r===null||typeof r!="object")continue;let n=r,o=f(n.command),i=f(n.path);if(!o&&!i)continue;let s={};o&&(s.command=o),i&&(s.path=Oe(i));let a=f(n.note);a&&(s.note=a),t.push(s)}return t.length>0?t:void 0}function Ea(e){if(!Array.isArray(e))return;let t=[];for(let r of e){if(r===null||typeof r!="object")continue;let n=r,o=f(n.path);if(!o)continue;let i={path:Oe(o)};(n.scope==="project"||n.scope==="global")&&(i.scope=n.scope);let s=f(n.note);s&&(i.note=s),t.push(i)}return t.length>0?t:void 0}function ka(e){if(e===null||typeof e!="object")return;let t=e,r=f(t.id),n=f(t.title),o=f(t.status),i=o&&Rs.has(o)?o:void 0,s=Dn(t.order)??Number.NaN,a=typeof t.created_at=="string"?t.created_at:"",d=typeof t.updated_at=="string"?t.updated_at:"";if(!r||!n||!i||!Number.isFinite(s)||!a||!d)return;let l={id:r,order:s,title:n,status:i,created_at:a,updated_at:d};return Sa(l,t),l}function Sa(e,t){let r=[["body","body"],["owner","owner"],["evidence","evidence"],["blocked_reason","blocked_reason"],["superseded_by","superseded_by"]];for(let[i,s]of r){let a=f(t[s]);a&&(e[i]=a)}let n=typeof t.completed_at=="string"?t.completed_at:void 0;n&&n.length>0&&(e.completed_at=n);let o=[["linked_items","linked_items",va],["files","files",ba],["tests","tests",wa],["docs","docs",Ea]];for(let[i,s,a]of o){let d=a(t[s]);d&&(e[i]=d)}}function Ia(e){if(!Array.isArray(e))return;let t=e.flatMap(r=>{let n=ka(r);return n?[n]:[]});return t.sort((r,n)=>r.order-n.order),t.length>0?t:void 0}function Oa(e){if(!Array.isArray(e))return;let t=[];for(let r of e){if(r===null||typeof r!="object")continue;let n=r,o=typeof n.ts=="string"?n.ts:"",i=typeof n.author=="string"?n.author:"",s=f(n.decision);if(!o||!i||!s)continue;let a={ts:o,author:i,decision:s},d=f(n.rationale);d&&(a.rationale=d);let l=f(n.evidence);l&&(a.evidence=l);let _=f(n.step_id);_&&(a.step_id=_),t.push(a)}return t.length>0?t:void 0}function Aa(e){if(!Array.isArray(e))return;let t=[];for(let r of e){if(r===null||typeof r!="object")continue;let n=r,o=typeof n.ts=="string"?n.ts:"",i=typeof n.author=="string"?n.author:"",s=f(n.text);if(!o||!i||!s)continue;let a={ts:o,author:i,text:s},d=f(n.step_id);d&&(a.step_id=d),t.push(a)}return t.length>0?t:void 0}function Ta(e){if(!Array.isArray(e))return;let t=[];for(let r of e){if(r===null||typeof r!="object")continue;let n=r,o=f(n.text);if(!o)continue;let i={text:o},s=f(n.command);s&&(i.command=s);let a=f(n.expected);a&&(i.expected=a),t.push(i)}return t.length>0?t:void 0}function xa(e){if(!e)return;let t=Object.entries(e).map(([r,n])=>[r.trim(),n.trim()]).filter(([r,n])=>r.length>0&&n.length>0).sort((r,n)=>r[0].localeCompare(n[0]));if(t.length!==0)return Object.fromEntries(t)}function Ie(e){let t=0;for(;t<e.length&&e[t]===`
1
+ import{c as ze,e as Fe,f as $e,h as Ln,i as Hn,j as zn,k as Fn,l as $n,m as Mn}from"./chunk-TMN3RAXZ.js";import{h as Jn}from"./chunk-YLVHHWHN.js";import{Ad as G,B as Tn,Dc as Wn,Dd as qn,Ea as jn,Ed as Gn,Fa as A,Ga as M,Gd as Bn,Ha as ot,Ia as y,Jd as V,ea as Dn,i as Qe,j as kn,ja as Pn,k as Sn,l as In,m as On,mc as Vn,me as Kt,oc as it,q as et,r as tt,s as An,sc as Un,wd as Me,x as rt,xd as q,y as nt,yd as st,z as Bt,za as Ee,zd as ke}from"./chunk-UUPJ6OZL.js";import{B as Cn,C as se,D as ae,E as J,F as Nn,G as Jt,H as He,I as Rn,l as B,t as xn,w as p,x as Le,y as w,z as b}from"./chunk-3LWH2RJC.js";import{createHash as _s}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]="ca5b60a5-80a7-5e7d-917f-4c7649bcbab6")}catch{}})();var Vl=["sha256","sha512"],fs="sha256",Kn="sha256";function ce(e){if(e===void 0)return fs;if(e==="sha256"||e==="sha512")return e;throw new TypeError(`unsupported_history_hash_algorithm:${String(e)}`)}function K(e,t){return _s(ce(t)).update(e,"utf8").digest("hex")}(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]="4d5692ce-ec33-5eb4-bd9b-7497ffe25b0e")}catch{}})();var ms=16;function Xt(e){let t=e.trim().replaceAll(/[^A-Za-z0-9]+/g," ").split(/\s+/).filter(o=>o.length>0).map(o=>o.toLowerCase());if(t.length===0)return e;let[r,...n]=t;return`${r}${n.map(o=>`${o.slice(0,1).toUpperCase()}${o.slice(1)}`).join("")}`}function ps(e){return[...new Set([Mn(e),Xt(e.key),Xt(e.cli_flag),...e.cli_aliases.map(t=>Xt(t))])]}function Zn(e,t){for(let r of ps(t)){if(!Object.hasOwn(e,r))continue;let n=e[r];if(n!==void 0)return n}}function Qn(e){return Array.isArray(e)?e.flatMap(t=>Qn(t)).map(t=>t.trim()).filter(t=>t.length>0):typeof e=="string"?e.split(/[,\n|]/).map(t=>t.trim()).filter(t=>t.length>0):e==null?[]:[String(e).trim()].filter(t=>t.length>0)}function Xn(e,t){if(typeof e=="boolean")return e;if(typeof e=="number"){if(e===1)return!0;if(e===0)return!1}if(typeof e=="string"){let r=e.trim().toLowerCase();if(r==="true"||r==="1"||r==="yes")return!0;if(r==="false"||r==="0"||r==="no")return!1}throw new b(`${t} must be one of true|false|1|0|yes|no`,w.USAGE)}function Yn(e,t){if(typeof e=="number"&&Number.isFinite(e))return e;let r=typeof e=="string"?e.trim():String(e),n=Number(r);if(!Number.isFinite(n))throw new b(`${t} must be a number`,w.USAGE);return n}function hs(e,t,r){let n=typeof e=="string"?(()=>{try{return JSON.parse(e)}catch{return}})():e;if(r==="array"&&Array.isArray(n)||r==="object"&&typeof n=="object"&&n!==null&&!Array.isArray(n))return n;throw new b(`${t} must be valid JSON ${r}`,w.USAGE)}function ys(e,t){return t===void 0?!0:t==="array"?Array.isArray(e):t==="object"?typeof e=="object"&&e!==null&&!Array.isArray(e):typeof e===t}function gs(e,t,r){if(t.const!==void 0&&A(e)!==A(t.const))return`${r} must equal ${A(t.const)}`;if(t.enum!==void 0&&!t.enum.some(n=>A(n)===A(e)))return`${r} must be one of ${t.enum.map(n=>A(n)).join("|")}`;if(!ys(e,t.type))return`${r} must match configured type ${String(t.type)}`;if(typeof e=="string"){if(t.min_length!==void 0&&e.length<t.min_length)return`${r} must contain at least ${t.min_length} characters`;if(t.format==="date-time"&&!st(e))return`${r} must be an RFC 3339 date-time`}}function vs(e,t,r,n){if(Array.isArray(e)){if(t.min_items!==void 0&&e.length<t.min_items)return`${r} must contain at least ${t.min_items} items`;if(t.items)for(let[o,i]of e.entries()){let s=at(i,t.items,`${r}[${o}]`,n+1);if(s)return s}}}function bs(e,t,r,n){if(typeof e!="object"||e===null||Array.isArray(e))return;let o=e;for(let i of t.required??[])if(!Object.hasOwn(o,i))return`${r}.${i} is required`;for(let[i,s]of Object.entries(o)){let a=t.properties?.[i];if(!a){if(t.additional_properties===!1)return`${r}.${i} is not allowed`;continue}let d=at(s,a,`${r}.${i}`,n+1);if(d)return d}}function at(e,t,r,n=0){if(n>ms)return`${r} value schema exceeds maximum depth`;let o=gs(e,t,r);if(o)return o;let i=vs(e,t,r,n);if(i)return i;let s=bs(e,t,r,n);if(s)return s;if(!t.one_of)return;let a=0;for(let d of t.one_of)if(at(e,d,r,n+1)===void 0&&(a+=1,a>1))break;return a===1?void 0:`${r} must match exactly one configured schema variant`}function de(e,t,r){if(!e.value_schema||t===void 0)return t;let n=at(t,e.value_schema,r);if(n)throw new b(n,w.USAGE);return t}function ws(e,t,r,n){let o=n==="option"&&Array.isArray(t)?t[t.length-1]:t;if(o!==void 0)return de(e,hs(o,r,e.type),r)}function Ve(e,t,r,n="option"){let o=r??`--${e.cli_flag}`;if(e.type==="array"||e.type==="object")return ws(e,t,o,n);if(e.repeatable||e.type==="string_array"){let s=Qn(t);return e.type==="number"?de(e,s.map(a=>Yn(a,o)),o):e.type==="boolean"?de(e,s.map(a=>Xn(a,o)),o):de(e,s,o)}let i=Array.isArray(t)?t[t.length-1]:t;if(i!==void 0)return e.type==="number"?de(e,Yn(i,o),o):e.type==="boolean"?de(e,Xn(i,o),o):de(e,typeof i=="string"?i:String(i),o)}function Es(e,t){return!e.required&&!e.required_on_create?!1:e.required_types.length===0?!0:t?e.required_types.map(r=>r.toLowerCase()).includes(t.trim().toLowerCase()):!1}function Kl(e,t,r){let n={},o=[];for(let i of t.command_to_fields.get("create")??[]){let s=Zn(e,i);if(s===void 0){Es(i,r)&&o.push(`--${i.cli_flag}`);continue}n[i.metadata_key]=Ve(i,s)}return{values:n,missing_required_flags:[...new Set(o)].sort((i,s)=>i.localeCompare(s))}}function Xl(e,t,r=["update"]){let n={},o=(r??["update"]).flatMap(s=>t.command_to_fields.get(s)??[]),i=new Set;for(let s of o){let a=Zn(e,s);a!==void 0&&(i.has(s.metadata_key)||(i.add(s.metadata_key),n[s.metadata_key]=Ve(s,a)))}return 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]="c35d4830-d7d1-5ee4-99bc-ab52cc3e4e09")}catch{}})();var Yt=1,Zt=2;function Zl(e){return Math.max(Qt(e),e.tests?.some(t=>t.updated_by!==void 0||t.updated_at!==void 0)?2:1)}function Qt(e){let t=e.pm_format_version;return typeof t=="number"&&Number.isInteger(t)&&t>=1?t:1}function eo(e){if(!(typeof e!="number"||!Number.isInteger(e)||e<=1))return e}function ks(e,t=2,r=t){return e<r?"outdated":e>t?"ahead":"current"}function Ql(e,t=2,r=t){let n=[],o=[];for(let i of e){let s=ks(i.version,t,r);s==="outdated"?n.push(i.ref):s==="ahead"&&o.push(i.ref)}return{outdated:n.sort((i,s)=>i.localeCompare(s)),ahead:o.sort((i,s)=>i.localeCompare(s))}}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="515840b7-cf86-5d71-8ac1-beac7fd7c8a8")}catch{}})();var Ss={"in-progress":"in_progress",cancelled:"canceled"};function ct(e,t){if(t){let o=Fn(e,t);if(o)return o}if(typeof e!="string")return;let r=e.trim().toLowerCase();if(!r)return;let n=Ss[r]??r;if(Qe.includes(n))return n}function Is(e,t){return ct(e,t)??e}function nu(e,t){return t.terminal_statuses.has(Is(e,t))}import{encode as xs}from"@toon-format/toon";import{isDeepStrictEqual as to}from"node:util";import{decode as Os}from"@toon-format/toon";(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]="aaa2be03-9478-5fbe-82e6-e4fc86e3735b")}catch{}})();function er(e){return{value:Os(e),usedScalarBracketEscape:!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]="79626299-17a8-573a-9b66-ce37c65e2f5d")}catch{}})();var As=/^\s*(<<<<<<<|=======|>>>>>>>)(?:\s.*)?$/;function Ts(e){if(e.length===0)return[];let t=e.split(/\r?\n/),r=[];for(let n=0;n<t.length;n+=1){let o=t[n]??"",i=o.match(As);if(!i)continue;let s=i[1];r.push({line:n+1,marker:s,text:o})}return r}function dt(e){return Ts(e)[0]}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="2789e87f-0706-52e8-8f4c-3855c65c618c")}catch{}})();var or=new Set(["schema","tracker","auto","none"]),so=new Set(["source","isolated","snapshot"]),Cs=new Set(["legacy","local_mutation","local_source_ref","acknowledged","invalid_provenance","foreign_source_ref"]),Ns=new Set(["passed","failed","stopped","canceled"]),Rs=new Set(Tn);function Oe(e){return e.replaceAll("\\","/")}function ao(e){for(let t of e)if(t!==0)return t;return 0}function ut(e){for(let[t,r]of Object.entries(e))r===void 0&&delete e[t]}var co=["id","title","description","created_at","updated_at"],Ds=new Set(B);function lo(e){if(e?.schema)return{statusRegistry:zn(e.schema),fieldRegistry:$n(e.schema),unknownFieldPolicy:e.schema.unknown_field_policy??"allow",extensionFieldNames:new Set(e.extensionFieldNames??[]),onWarning:e.onWarning}}function Ps(e,t){return e.required?e.required_types.length===0?!0:e.required_types.map(r=>r.toLowerCase()).includes(t.trim().toLowerCase()):!1}function X(e){let t=e.match(/^([a-z_][\w.]*)\s/u)?.[1];throw new b(`Invalid item metadata: ${e}`,w.GENERIC_FAILURE,{code:"item_document_invalid",reason:e.includes("required")?"missing_required_field":"schema_validation_error",...t?{field:t}:{},required:"Provide an item document whose metadata satisfies the active runtime schema.",why:e})}function qe(e,t){throw new b(t,w.GENERIC_FAILURE,{code:"item_document_invalid",reason:"syntax_error",format:e,required:`Provide a syntactically valid ${e==="toon"?"TOON":"JSON Markdown"} item document.`,why:"The document could not be decoded far enough to validate item metadata."})}function uo(e,t){if(!t||typeof e!="object"||e===null)return;let r=Qt(e);if(!(r<=Zt))throw new b(`Stored item uses format version ${r}; this runtime supports up to ${Zt}. Upgrade pm before reading or changing this item.`,w.CONFLICT,{code:"item_format_version_unsupported",format_version:r,required:"Upgrade to a pm runtime supporting the stored item format.",nextSteps:["Preserve the original item and history; do not lower pm_format_version to bypass compatibility checks."]})}function _o(e){let t=new Set(Ds);for(let r of e.fieldRegistry?.definitions??[])t.add(r.metadata_key);for(let r of e.extensionFieldNames)t.add(r);return t}function h(e,t){e||X(t)}function Ge(e,t){return(typeof e!="object"||e===null||Array.isArray(e))&&X(t),e}function tr(e,t){let r=e[t];h(typeof r=="string",`${t} must be a string`),h(q(r),`${t} must be a valid ISO timestamp`)}function ro(e,t,r){let n=e[t];n!==void 0&&h(typeof n=="number"&&Number.isInteger(n)&&n>=1,`${r} must be an integer >= 1`)}function ir(e,t,r){let n=e[t];n!==void 0&&(h(typeof n=="string",`${r} must be a string`),h(q(n),`${r} must be a valid ISO timestamp`))}function js(e){if(e!==void 0){h(Array.isArray(e),"event.recurrence.by_weekday must be an array");for(let t of e){h(typeof t=="string","event.recurrence.by_weekday entries must be strings");let r=t.trim().toLowerCase();h(nt.includes(r),`event.recurrence.by_weekday entries must be one of: ${nt.join(", ")}`)}}}function Ls(e){if(e!==void 0){h(Array.isArray(e),"event.recurrence.by_month_day must be an array");for(let t of e)h(typeof t=="number"&&Number.isInteger(t)&&t>=1&&t<=31,"event.recurrence.by_month_day entries must be integers 1..31")}}function Hs(e){if(e!==void 0){h(Array.isArray(e),"event.recurrence.exdates must be an array");for(let t of e)h(typeof t=="string","event.recurrence.exdates entries must be strings"),h(q(t),"event.recurrence.exdates entries must be valid ISO timestamps")}}function zs(e){let t=Ge(e,"event.recurrence must be an object");h(typeof t.freq=="string","event.recurrence.freq must be a string");let r=t.freq.trim().toLowerCase();h(rt.includes(r),`event.recurrence.freq must be one of: ${rt.join(", ")}`),ro(t,"interval","event.recurrence.interval"),ro(t,"count","event.recurrence.count"),ir(t,"until","event.recurrence.until"),js(t.by_weekday),Ls(t.by_month_day),Hs(t.exdates)}function Fs(e){for(let n of co)h(typeof e[n]=="string",`${n} is required and must be a string`);let t=e.type;h(typeof t=="string"&&t.trim().length>0,"type must be a non-empty string");let r=e.pm_format_version;return r!==void 0&&h(typeof r=="number"&&Number.isInteger(r)&&r>=Yt,`pm_format_version must be an integer >= ${Yt}`),t}function $s(e,t){let r=e.status;h(typeof r=="string"&&r.trim().length>0,"status must be a non-empty string");let n=t?.statusRegistry,o=ct(r,n),i=n?n.definitions.map(s=>s.id):[...Qe];h(o!==void 0,`status must be one of: ${i.join(", ")}`)}function Ms(e){let t=e.priority;h(typeof t=="number"&&Number.isInteger(t)&&[0,1,2,3,4].includes(t),"priority must be an integer 0..4");let r=e.tags;h(Array.isArray(r),"tags must be an array");for(let n of r)h(typeof n=="string","tags entries must be strings")}function Vs(e){let t=e.confidence;if(t!==void 0){if(typeof t=="number"){h(Number.isInteger(t)&&t>=0&&t<=100,"confidence number value must be an integer 0..100");return}if(typeof t=="string"){let r=t.trim().toLowerCase(),n=r==="med"||tt.includes(r);h(n,`confidence string value must be one of: ${[...tt,"med"].join(", ")}`);return}h(!1,"confidence must be a number or string")}}function Us(e){let t=e.severity;if(t===void 0)return;typeof t!="string"&&X("severity must be a string");let r=t.trim().toLowerCase(),n=r==="med"||et.includes(r);h(n,`severity value must be one of: ${[...et,"med"].join(", ")}`)}function Ws(e){e.regression!==void 0&&typeof e.regression!="boolean"&&X("regression must be a boolean")}function qs(e){let t=e.reminders;if(t!==void 0){h(Array.isArray(t),"reminders must be an array");for(let r of t){let n=Ge(r,"reminders entries must be objects");h(typeof n.at=="string","reminder.at must be a string"),h(q(n.at),"reminder.at must be a valid ISO timestamp"),h(typeof n.text=="string","reminder.text must be a string"),h(n.text.trim().length>0,"reminder.text must not be empty")}}}function Gs(e){for(let t of["title","description","location","timezone"])e[t]!==void 0&&(h(typeof e[t]=="string",`event.${t} must be a string`),h(e[t].trim().length>0,`event.${t} must not be empty`))}function Bs(e){e.recurrence!==void 0&&(zs(e.recurrence),e.recurrence.until!==void 0&&h(G(e.recurrence.until,e.start_at)>=0,"event.recurrence.until must be at or after event.start_at"))}function Js(e){let t=Ge(e,"events entries must be objects");h(typeof t.start_at=="string","event.start_at must be a string"),h(q(t.start_at),"event.start_at must be a valid ISO timestamp"),t.end_at!==void 0&&(h(typeof t.end_at=="string","event.end_at must be a string"),h(q(t.end_at),"event.end_at must be a valid ISO timestamp"),h(G(t.end_at,t.start_at)>0,"event.end_at must be after event.start_at")),Gs(t),t.all_day!==void 0&&h(typeof t.all_day=="boolean","event.all_day must be a boolean"),Bs(t)}function Ks(e){let t=e.events;if(t!==void 0){h(Array.isArray(t),"events must be an array");for(let r of t)Js(r)}}function Xs(e){for(let t of["source_type","source_owner","design","external_ref"]){let r=e[t];r!==void 0&&h(typeof r=="string",`${t} must be a string`)}}function Ys(e){let t=e.type_options;if(t===void 0)return;let r=Ge(t,"type_options must be an object");for(let[n,o]of Object.entries(r))h(n.trim().length>0,"type_options keys must be non-empty"),h(typeof o=="string","type_options values must be strings"),h(o.trim().length>0,"type_options values must be non-empty strings")}function Zs(e,t,r){if(r?.fieldRegistry)for(let n of r.fieldRegistry.definitions){let o=e[n.metadata_key];if(o===void 0){Ps(n,t)&&X(`missing required schema field: ${n.metadata_key}`);continue}try{e[n.metadata_key]=Ve(n,o,`metadata field "${n.metadata_key}"`,"metadata")}catch(i){X(String(i?.message).replace(/^Invalid\s+/u,""))}}}function Qs(e,t){if(!t||t.unknownFieldPolicy==="allow")return;let r=_o(t),n=Object.keys(e).filter(o=>!r.has(o)).sort((o,i)=>o.localeCompare(i));n.length!==0&&(t.unknownFieldPolicy==="reject"?X(`unknown schema fields are not allowed: ${n.join(", ")}`):t.onWarning?.(`item_unknown_schema_fields:${n.join(",")}`))}function sr(e,t){let r=Ge(e,"item metadata must be an object"),n=Fs(r);$s(r,t),Ms(r),Vs(r),Us(r),Ws(r),tr(r,"created_at"),tr(r,"updated_at"),r.deadline!==void 0&&tr(r,"deadline"),qs(r),Ks(r),ir(r,"closed_at","closed_at"),ir(r,"completed_at","completed_at"),Xs(r),Ys(r),Zs(r,n,t),Qs(r,t)}function ea(e){if(!(!e||e.length===0))return[...e].map((t,r)=>(h(t.created_at===void 0||typeof t.created_at=="string"&&st(t.created_at),`dependencies.${r}.created_at requires a valid timestamp; restore the dependency timestamp from its source record`),{id:t.id.trim(),kind:t.kind,created_at:t.created_at,author:t.author?.trim()||void 0,source_kind:t.source_kind?.trim()||void 0,author_source:t.author_source})).sort((t,r)=>{let n=G(t.created_at??"",r.created_at??"");if(n!==0)return n;let o=t.id.localeCompare(r.id);if(o!==0)return o;let i=t.kind.localeCompare(r.kind);return i!==0?i:(t.source_kind??"").localeCompare(r.source_kind??"")})}function rr(e){if(!(!e||e.length===0))return[...e].sort((t,r)=>{let n=G(t.created_at,r.created_at);if(n!==0)return n;let o=t.text.localeCompare(r.text);return o!==0?o:t.author.localeCompare(r.author)})}function ta(e){if(!e||e.length===0)return;let t=[...e].map(r=>({at:r.at,text:r.text.trim()})).filter(r=>r.text.length>0).sort((r,n)=>{let o=G(r.at,n.at);return o!==0?o:r.text.localeCompare(n.text)});return t.length===0?void 0:t}function ra(e){if(!e)return;let t=e.freq.trim().toLowerCase();if(!rt.includes(t))return;let r=Array.from(new Set((e.by_weekday??[]).map(s=>s.trim().toLowerCase()).filter(s=>nt.includes(s)))).sort((s,a)=>Bt(s)-Bt(a)),n=Array.from(new Set((e.by_month_day??[]).filter(s=>Number.isInteger(s)&&s>=1&&s<=31).map(s=>s))).sort((s,a)=>s-a),o=Array.from(new Set((e.exdates??[]).map(s=>s.trim()).filter(s=>q(s)))).sort((s,a)=>G(s,a)),i={freq:t,interval:e.interval!==void 0&&e.interval>1?e.interval:void 0,count:e.count,until:e.until?.trim()||void 0,by_weekday:r.length>0?r:void 0,by_month_day:n.length>0?n:void 0,exdates:o.length>0?o:void 0};for(let[s,a]of Object.entries(i))a===void 0&&delete i[s];return i}function na(e){return!Array.isArray(e)||e.length===0?void 0:[...e].map(oa).sort(ia)}function oa(e){let t={start_at:e.start_at,end_at:e.end_at||void 0,title:e.title?.trim()||void 0,description:e.description?.trim()||void 0,location:e.location?.trim()||void 0,all_day:e.all_day,timezone:e.timezone?.trim()||void 0,recurrence:ra(e.recurrence)};return ut(t),t}function ia(e,t){return ao([G(e.start_at,t.start_at),(e.end_at??"").localeCompare(t.end_at??""),(e.title??"").localeCompare(t.title??""),+!!e.all_day-+!!t.all_day,(e.timezone??"").localeCompare(t.timezone??""),(e.location??"").localeCompare(t.location??""),(e.description??"").localeCompare(t.description??""),JSON.stringify(e.recurrence??{}).localeCompare(JSON.stringify(t.recurrence??{}))])}function sa(e){if(!(!e||e.length===0))return e.map(t=>({path:Oe(t.path),scope:t.scope,note:t.note?.trim()||void 0}))}function aa(e){if(!e||e.length===0)return;let t=e.map(ua).filter(r=>r.run_id.length>0&&r.started_at.length>0&&r.finished_at.length>0&&r.recorded_at.length>0).sort((r,n)=>ao([G(r.recorded_at,n.recorded_at),r.run_id.localeCompare(n.run_id),r.kind.localeCompare(n.kind)]));return t.length>0?t:void 0}function Se(e){return typeof e=="number"&&Number.isFinite(e)&&e>=0?Math.floor(e):void 0}function ca(e){return typeof e=="number"&&Number.isFinite(e)&&e>=1?Math.floor(e):void 0}function nr(e){return typeof e=="string"?e:""}function da(e){if(!Array.isArray(e))return;let t=e.filter(n=>n!==null&&typeof n=="object"&&typeof n.name=="string"&&n.name.trim().length>0&&typeof n.value=="number"&&Number.isFinite(n.value)&&typeof n.recorded_at=="string"&&n.recorded_at.trim().length>0).map(n=>({name:n.name.trim(),value:n.value,unit:typeof n.unit=="string"&&n.unit.trim()||void 0,threshold:typeof n.threshold=="number"&&Number.isFinite(n.threshold)?n.threshold:void 0,recorded_at:n.recorded_at.trim()})),r=[...new Map(t.map(n=>[n.name,n])).values()].sort((n,o)=>n.name.localeCompare(o.name)).slice(0,32);return r.length>0?r:void 0}function lt(e,t){return typeof e=="string"&&t.has(e)?e:void 0}function la(e){if(!Array.isArray(e))return;let t=e.filter(r=>r&&typeof r.command=="string"&&r.command.trim().length>0).slice(0,32).map(r=>({command:r.command.trim(),requested_pm_context_mode:lt(r.requested_pm_context_mode,or),pm_context_mode:lt(r.pm_context_mode,or),workspace_context_mode:lt(r.workspace_context_mode,so),trust_reason:lt(r.trust_reason,Cs)}));return t.length>0?t:void 0}function ua(e){let t=typeof e.run_id=="string"?e.run_id.trim():"",r=e.kind==="test"||e.kind==="test-all"?e.kind:"test",n=Ns.has(e.status)?e.status:"failed",o={run_id:t,kind:r,status:n,started_at:nr(e.started_at),finished_at:nr(e.finished_at),recorded_at:nr(e.recorded_at),attempt:ca(e.attempt),resumed_from:e.resumed_from?.trim()||void 0,passed:Se(e.passed)??0,failed:Se(e.failed)??0,skipped:Se(e.skipped)??0,items:Se(e.items),linked_tests:Se(e.linked_tests),fail_on_skipped_triggered:e.fail_on_skipped_triggered===!0?!0:void 0,measurements:da(e.measurements),executions:la(e.executions)};return ut(o),o}function _a(e){if(!(!Array.isArray(e)||e.length===0))return e.map(ya)}function Ue(e){if(!Array.isArray(e))return;let t=[...new Set(e.filter(r=>typeof r=="string").map(r=>r.trim()).filter(r=>r.length>0))].sort((r,n)=>r.localeCompare(n));return t.length>0?t:void 0}function lr(e){if(!e||typeof e!="object"||Array.isArray(e))return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}function ur(e){return e==="__proto__"||e==="constructor"||e==="prototype"}function no(e){if(!lr(e))return;let t=Object.entries(e).map(([r,n])=>[r.trim(),String(n).trim()]).filter(([r,n])=>r.length>0&&!ur(r)&&n.length>0).sort(([r],[n])=>r.localeCompare(n));return t.length>0?Object.fromEntries(t):void 0}function fa(e){if(!lr(e))return;let t=Object.entries(e).map(([r,n])=>[r.trim(),Number(n)]).filter(([r,n])=>r.length>0&&!ur(r)&&Number.isFinite(n)).sort(([r],[n])=>r.localeCompare(n));return t.length>0?Object.fromEntries(t):void 0}function ma(e){let t=e?.trim().toLowerCase();if(!(!t||!or.has(t)))return t}function pa(e){let t=e?.trim().toLowerCase();if(!(!t||!so.has(t)))return t}function ha(e,t){if(t===!0)return{provenance_invalid:!0};if(e===void 0)return{};if(!lr(e))return{provenance_invalid:!0};let r=f(e.author),n=f(e.created_at),o=e.source_kind;return!r||!n||!q(n)||o!=="local_mutation"&&o!=="merge_union"?{provenance_invalid:!0}:{provenance:{author:r,created_at:n,source_kind:o,source_ref:f(e.source_ref)}}}function ya(e){let t={command:e.command?.trim()||void 0,path:e.path?Oe(e.path):void 0,scope:e.scope,timeout_seconds:typeof e.timeout_seconds=="number"&&Number.isFinite(e.timeout_seconds)&&e.timeout_seconds>0?e.timeout_seconds:void 0,pm_context_mode:ma(e.pm_context_mode),workspace_context_mode:pa(e.workspace_context_mode),...ha(e.provenance,e.provenance_invalid),updated_by:f(e.updated_by),updated_at:f(e.updated_at),env_set:no(e.env_set),env_clear:Ue(e.env_clear),shared_host_safe:e.shared_host_safe===!0?!0:void 0,assert_stdout_contains:Ue(e.assert_stdout_contains),assert_stdout_regex:Ue(e.assert_stdout_regex),assert_stderr_contains:Ue(e.assert_stderr_contains),assert_stderr_regex:Ue(e.assert_stderr_regex),assert_stdout_min_lines:Se(e.assert_stdout_min_lines),assert_json_field_equals:no(e.assert_json_field_equals),assert_json_field_gte:fa(e.assert_json_field_gte),note:e.note?.trim()||void 0};return ut(t),t}function ga(e){if(!(!e||e.length===0))return[...e].map(t=>({path:Oe(t.path),scope:t.scope,note:t.note?.trim()||void 0})).sort((t,r)=>{let n=t.scope.localeCompare(r.scope);if(n!==0)return n;let o=t.path.localeCompare(r.path);return o!==0?o:(t.note??"").localeCompare(r.note??"")})}function f(e){if(typeof e!="string")return;let t=e.trim();return t.length>0?t:void 0}function va(e){if(!Array.isArray(e))return;let t=[];for(let r of e){if(r===null||typeof r!="object")continue;let n=r,o=f(n.id),i=f(n.kind);if(!o||!i)continue;let s={id:o,kind:i},a=f(n.note);a&&(s.note=a),n.required_before_step===!0&&(s.required_before_step=!0),t.push(s)}return t.length>0?t:void 0}function ba(e){if(!Array.isArray(e))return;let t=[];for(let r of e){if(r===null||typeof r!="object")continue;let n=r,o=f(n.path);if(!o)continue;let i={path:Oe(o)};(n.scope==="project"||n.scope==="global")&&(i.scope=n.scope);let s=f(n.note);s&&(i.note=s),t.push(i)}return t.length>0?t:void 0}function wa(e){if(!Array.isArray(e))return;let t=[];for(let r of e){if(r===null||typeof r!="object")continue;let n=r,o=f(n.command),i=f(n.path);if(!o&&!i)continue;let s={};o&&(s.command=o),i&&(s.path=Oe(i));let a=f(n.note);a&&(s.note=a),t.push(s)}return t.length>0?t:void 0}function Ea(e){if(!Array.isArray(e))return;let t=[];for(let r of e){if(r===null||typeof r!="object")continue;let n=r,o=f(n.path);if(!o)continue;let i={path:Oe(o)};(n.scope==="project"||n.scope==="global")&&(i.scope=n.scope);let s=f(n.note);s&&(i.note=s),t.push(i)}return t.length>0?t:void 0}function ka(e){if(e===null||typeof e!="object")return;let t=e,r=f(t.id),n=f(t.title),o=f(t.status),i=o&&Rs.has(o)?o:void 0,s=Dn(t.order)??Number.NaN,a=typeof t.created_at=="string"?t.created_at:"",d=typeof t.updated_at=="string"?t.updated_at:"";if(!r||!n||!i||!Number.isFinite(s)||!a||!d)return;let l={id:r,order:s,title:n,status:i,created_at:a,updated_at:d};return Sa(l,t),l}function Sa(e,t){let r=[["body","body"],["owner","owner"],["evidence","evidence"],["blocked_reason","blocked_reason"],["superseded_by","superseded_by"]];for(let[i,s]of r){let a=f(t[s]);a&&(e[i]=a)}let n=typeof t.completed_at=="string"?t.completed_at:void 0;n&&n.length>0&&(e.completed_at=n);let o=[["linked_items","linked_items",va],["files","files",ba],["tests","tests",wa],["docs","docs",Ea]];for(let[i,s,a]of o){let d=a(t[s]);d&&(e[i]=d)}}function Ia(e){if(!Array.isArray(e))return;let t=e.flatMap(r=>{let n=ka(r);return n?[n]:[]});return t.sort((r,n)=>r.order-n.order),t.length>0?t:void 0}function Oa(e){if(!Array.isArray(e))return;let t=[];for(let r of e){if(r===null||typeof r!="object")continue;let n=r,o=typeof n.ts=="string"?n.ts:"",i=typeof n.author=="string"?n.author:"",s=f(n.decision);if(!o||!i||!s)continue;let a={ts:o,author:i,decision:s},d=f(n.rationale);d&&(a.rationale=d);let l=f(n.evidence);l&&(a.evidence=l);let _=f(n.step_id);_&&(a.step_id=_),t.push(a)}return t.length>0?t:void 0}function Aa(e){if(!Array.isArray(e))return;let t=[];for(let r of e){if(r===null||typeof r!="object")continue;let n=r,o=typeof n.ts=="string"?n.ts:"",i=typeof n.author=="string"?n.author:"",s=f(n.text);if(!o||!i||!s)continue;let a={ts:o,author:i,text:s},d=f(n.step_id);d&&(a.step_id=d),t.push(a)}return t.length>0?t:void 0}function Ta(e){if(!Array.isArray(e))return;let t=[];for(let r of e){if(r===null||typeof r!="object")continue;let n=r,o=f(n.text);if(!o)continue;let i={text:o},s=f(n.command);s&&(i.command=s);let a=f(n.expected);a&&(i.expected=a),t.push(i)}return t.length>0?t:void 0}function xa(e){if(!e)return;let t=Object.entries(e).map(([r,n])=>[r.trim(),n.trim()]).filter(([r,n])=>r.length>0&&n.length>0).sort((r,n)=>r[0].localeCompare(n[0]));if(t.length!==0)return Object.fromEntries(t)}function Ie(e){let t=0;for(;t<e.length&&e[t]===`
2
2
  `;)t+=1;return e.slice(t).trimEnd()}function Ca(e){if(e===void 0)return;if(typeof e=="number")return e;let t=e.trim().toLowerCase();if(t==="med")return"medium";if(tt.includes(t))return t}function Na(e){if(e===void 0)return;let t=e.trim().toLowerCase();if(t==="med")return"medium";if(et.includes(t))return t}function We(e){return e||void 0}function Ra(e,t){let r=e,n=t;for(let[o,i]of Object.entries(n))ur(o)||Object.prototype.hasOwnProperty.call(r,o)||i===void 0||(r[o]=i)}function Da(e,t){if(!t?.fieldRegistry)return;let r=e;for(let n of t.fieldRegistry.definitions){let o=r[n.metadata_key];o!==void 0&&(r[n.metadata_key]=Ve(n,o,`metadata field "${n.metadata_key}"`,"metadata"))}}function Pa(e,t){if(!t||t.unknownFieldPolicy==="allow")return;let r=_o(t),n=Object.keys(e).filter(o=>!r.has(o)).sort((o,i)=>o.localeCompare(i));n.length>0&&t.unknownFieldPolicy==="reject"&&X(`unknown schema fields are not allowed: ${n.join(", ")}`),n.length>0&&t.onWarning?.(`item_unknown_schema_fields:${n.join(",")}`)}function _t(e,t={}){let r=lo(t),n=ct(e.status,r?.statusRegistry)??e.status,o=Array.from(new Set((Array.isArray(e.tags)?e.tags:[]).filter(s=>typeof s=="string").map(s=>s.trim().toLowerCase()).filter(Boolean))).sort((s,a)=>s.localeCompare(a)),i={id:e.id,title:e.title,description:e.description,type:e.type,pm_format_version:eo(e.pm_format_version),source_type:f(e.source_type),type_options:xa(e.type_options),status:n,priority:e.priority,tags:o,created_at:e.created_at,updated_at:e.updated_at,dependencies:ea(e.dependencies),comments:rr(e.comments),notes:rr(e.notes),learnings:rr(e.learnings),files:sa(e.files),tests:_a(e.tests),test_runs:aa(e.test_runs),docs:ga(e.docs),deadline:We(e.deadline),reminders:ta(e.reminders),events:na(e.events),closed_at:We(e.closed_at),completed_at:We(e.completed_at),assignee:f(e.assignee),claim_principal:f(e.claim_principal),source_owner:f(e.source_owner),author:We(e.author),estimated_minutes:e.estimated_minutes,acceptance_criteria:e.acceptance_criteria??void 0,design:e.design??void 0,external_ref:e.external_ref??void 0,definition_of_ready:f(e.definition_of_ready),order:e.order,goal:f(e.goal),objective:f(e.objective),value:f(e.value),impact:f(e.impact),outcome:f(e.outcome),why_now:f(e.why_now),parent:f(e.parent),reviewer:f(e.reviewer),risk:e.risk??void 0,confidence:Ca(e.confidence),sprint:f(e.sprint),release:f(e.release),blocked_by:f(e.blocked_by),blocked_reason:f(e.blocked_reason),unblock_note:f(e.unblock_note),reporter:f(e.reporter),severity:Na(e.severity),environment:f(e.environment),repro_steps:f(e.repro_steps),resolution:f(e.resolution),expected_result:f(e.expected_result),actual_result:f(e.actual_result),affected_version:f(e.affected_version),fixed_version:f(e.fixed_version),component:f(e.component),regression:e.regression,customer_impact:f(e.customer_impact),close_reason:We(e.close_reason),plan_mode:f(e.plan_mode),plan_scope:f(e.plan_scope),plan_harness:f(e.plan_harness),plan_resume_context:f(e.plan_resume_context),plan_steps:Ia(e.plan_steps),plan_decisions:Oa(e.plan_decisions),plan_discoveries:Aa(e.plan_discoveries),plan_validation:Ta(e.plan_validation)};return Ra(i,e),Da(i,r),Pa(i,r),ut(i),i}function fo(e){return y(e,B)}function ja(e){let t=0,r=!1,n=!1;for(let o=0;o<e.length;o+=1){let i=e[o];if(r){if(n){n=!1;continue}if(i==="\\"){n=!0;continue}i==='"'&&(r=!1);continue}if(i==='"'){r=!0;continue}if(i==="{"){t+=1;continue}if(i==="}"&&(t-=1,t===0))return o}return-1}function La(e){if(!e.startsWith("{"))return{frontMatter:"",body:e};let t=ja(e);if(t<0)return{frontMatter:"",body:e};let r=e.slice(0,t+1),n=e.slice(t+1).replace(/^\r?\n+/,"");return{frontMatter:r,body:n}}function Ha(e){let t=e.charCodeAt(0)===65279?e.slice(1):e,r=t.match(/^[ \t]*---[ \t]*(?:\r?\n|$)/);if(!r)return{content:t,stripped:!1};let n=r[0].length;for(;n<t.length;){let o=t.indexOf(`
3
3
  `,n),i=o===-1?t.length:o,s=t.slice(n,i).replace(/\r$/,""),a=o===-1?i:i+1;if(s.trim()==="---")return{content:t.slice(a).replace(/^\s+/,""),stripped:!0};n=a}return{content:t,stripped:!1}}function ar(e,t){return _t(e,{...t,onWarning:void 0})}function za(e,t,r={}){let n=Ha(e);n.stripped&&r.onWarning?.("json_markdown_leading_yaml_frontmatter_ignored");let{frontMatter:o,body:i}=La(n.content);o||(e.trimStart().startsWith("{")&&qe("json_markdown","JSON front matter is not valid JSON"),qe("json_markdown","JSON Markdown item document is missing JSON front matter"));let s;try{s=JSON.parse(o)}catch{qe("json_markdown","JSON front matter is not valid JSON")}return uo(s,r.requireSupportedFormat),sr(s,t),{metadata:ar(s,r),body:Ie(i)}}function Fa(e,t,r={}){let n;try{n=er(e).value}catch{qe("toon","TOON item document is not valid TOON")}h(typeof n=="object"&&n!==null&&!Array.isArray(n),"TOON item document must be an object");let o=n;if(uo(Object.prototype.hasOwnProperty.call(o,"front_matter")?o.front_matter:o,r.requireSupportedFormat),!co.some(a=>Object.prototype.hasOwnProperty.call(o,a))&&!Object.prototype.hasOwnProperty.call(o,"front_matter")&&qe("toon","TOON input does not have the shape of an item document"),Object.prototype.hasOwnProperty.call(o,"front_matter"))return sr(o.front_matter,t),h(o.body===void 0||typeof o.body=="string","TOON item document body must be a string"),{metadata:ar(o.front_matter,r),body:Ie(typeof o.body=="string"?o.body:"")};let{body:i,...s}=o;return h(i===void 0||typeof i=="string","TOON item document body must be a string"),sr(s,t),{metadata:ar(s,r),body:Ie(typeof i=="string"?i:"")}}function $a(e,t={}){let r=_t(e.metadata,t),n=fo(r),o=Ie(e.body??"");dr(JSON.parse(JSON.stringify(n))),dr({body:o});let i=JSON.stringify(n,null,2);return o?`${i}
4
4
 
@@ -75,4 +75,4 @@ ${o}
75
75
  `}async function Nl(e){let t;try{t=await Hi(e)}catch(a){if(se(a))return W();throw a}let r=Ee(t),n;try{n=await Zd(r)}catch(a){if(se(a))return W();throw a}if(!n.isFile())throw Jt("settings.json");let o;try{o=await Nn(r,Jt("settings.json"))}catch(a){if(se(a))return W();throw a}let i;try{i=JSON.parse(o)}catch{return W("settings_read_invalid_json")}let s=en(i);return s.success?{settings:$t(s.data),metadata:{has_explicit_item_format:Zi(i)},warnings:s.data.item_format==="json_markdown"?["settings_item_format_legacy_json_markdown_coerced_to_toon"]:[]}:W("settings_read_invalid_schema")}async function is(e){if(Qd(e))return Nl(e);let t=Ee(e),r=[t];await it({path:t,scope:"project"});let n=Ri(e);if(n){let l=await te(n.tracked_paths);if(Xe(l,n.signatures))return Ft(n.value)}let o=await te([t]),i;try{i=await J(t)}catch{return W("settings_read_fs_error")}if(i===null){let l=W();return await an(e,[t],l,o,[t]),l}let s=await te([t]);if(!Xe(o,s))return re(e),is(e);let a;try{a=JSON.parse(i)}catch{let l=W("settings_read_invalid_json");return await an(e,[t],l,s,[t]),l}let d=en(a);if(!d.success){let l=W("settings_read_invalid_schema");return await an(e,[t],l,s,[t]),l}try{let l=$t(d.data),_=sl(e,l.schema,t);r=_;let v=await te(_),O=await Ln(e,l.schema),S=await Hn(e,l.schema),I=await te(_),z={...l,item_types:{definitions:je([...l.item_types.definitions,...un(S.type_definitions_from_file)])},schema:S.schema};_n(z,Xi(d.data,z));let D={settings:z,metadata:{has_explicit_item_format:Zi(a)},warnings:[...d.data.item_format==="json_markdown"?["settings_item_format_legacy_json_markdown_coerced_to_toon"]:[],...O.created_paths.map($=>`runtime_schema_bootstrap_created:${$}`),...S.warnings]};return O.created_paths.length===0?Xe(v,I)?zt(e,{tracked_paths:_,signatures:I,value:Ft(D)}):re(e):re(e),D}catch{let l=W("settings_read_merge_failed");return await cl(e,r,l),l}}async function _m(e){return(await is(e)).settings}async function fm(e,t,r=el){let n=Ee(e),o=Yi(t),i=Cl(t,{persist_source:o}),s=JSON.parse(i);try{await Ai({pmRoot:e,filePath:n,mutate:a=>{let d=null;if(a!==null)try{d=JSON.parse(a)}catch{throw new b("Existing settings.json is malformed; the settings write was refused.",w.USAGE,{code:"settings_write_invalid_existing_json",reason:"existing_settings_json_malformed",why:"Writing defaults over malformed settings could destroy intended project configuration.",nextSteps:["Repair the syntax in .agents/pm/settings.json, then retry the original command.","Run pm health to confirm the settings warning has cleared."]})}return{raw:o?`${JSON.stringify(y(rn(o.persisted_settings,s,d),fn),null,2)}
76
76
  `:i,result:void 0}},op:r,author:Po(void 0,t.author_default),lockTtlSeconds:t.locks.ttl_seconds,lockWaitMs:t.locks.wait_ms,recordCreation:!1}),o&&_n(t,{...o,persisted_settings:structuredClone(s)}),await Vn({path:n,scope:"project",op:r})}finally{re(e)}}import ss from"node:fs";import Ye from"node:path";import{createRequire as Rl}from"node:module";(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]="19d9b802-1efa-5716-8176-ecbf5b153ff0")}catch{}})();var as="@unbrained/pm-cli";var pn=/\b(\d{4})\.(\d{1,2})\.(\d{1,2})(?:-(\d+))?\b/u,hn="2026.8.31";function Mt(e){let t=e.match(pn);return t?[Number(t[1]),Number(t[2]),Number(t[3]),Number(t[4]??0)]:null}function Ut(e,t){let r=Mt(e),n=Mt(t);if(!r||!n)return null;for(let o=0;o<r.length;o+=1){let i=r[o]-n[o];if(i!==0)return Math.sign(i)}return 0}function mn(e){return Ut(e,hn)!==-1?3:2}function Vt(e){try{let t=JSON.parse(ss.readFileSync(e,"utf8"));return typeof t=="object"&&t!==null&&!Array.isArray(t)?t:null}catch{return null}}function Dl(e){let t=[...e.matchAll(/(<=|<)\s*v?(\d{4}\.\d{1,2}\.\d{1,2}(?:-\d+)?)/gu)].map(n=>({inclusive:n[1]==="<=",version:n[2]})),r=e.match(/\b\d{4}\.\d{1,2}\.\d{1,2}(?:-\d+)?\s+-\s+v?(\d{4}\.\d{1,2}\.\d{1,2}(?:-\d+)?)/u);return r?[...t,{inclusive:!0,version:r[1]}]:t}function Pl(e){let t=e.split("||").map(r=>Dl(r));return{bounded:t.some(r=>r.length>0),compatible:t.some(r=>r.every(n=>{let o=Ut(hn,n.version);return o!==null&&(n.inclusive?o!==1:o===-1)}))}}function cs(e){return["dependencies","devDependencies","optionalDependencies","peerDependencies"].flatMap(t=>{let r=e[t];if(typeof r!="object"||r===null)return[];let n=r[as];return typeof n=="string"?[n.trim()]:[]})}function jl(e){return cs(e).flatMap(t=>{let r=/^[<!]/u.test(t)?void 0:t.match(pn)?.[0];if(!r)return[];let n=/^(?:=|v)?\d{4}\.\d{1,2}\.\d{1,2}(?:-\d+)?$/u.test(t),o=Pl(t);return[{version:r,constraint:n?"exact":o.bounded?"range":"minimum",...n?{}:{declaration:t},history_epoch_compatible:n?Ut(r,hn)!==-1:o.compatible}]})}function Ll(e){let t=Vt(Ye.join(e,"package-lock.json"))?.packages;if(typeof t!="object"||t===null)return;let r=t["node_modules/@unbrained/pm-cli"];if(typeof r!="object"||r===null)return;let n=r.version;return typeof n=="string"?n:void 0}function Hl(e,t){try{let r=ss.readFileSync(Ye.join(e,t),"utf8").split(/\r?\n/u),n=r.findIndex(s=>s.includes(as));if(n<0)return;let o=r[n].match(/^\s*/u)[0].length,i=[r[n]];for(let s=n+1;s<r.length;s+=1){let a=r[s],d=a.trim(),l=a.match(/^\s*/u)[0].length;if(d.length>0&&l<=o)break;i.push(a)}return i.join(`
77
77
  `).match(/^\s*version(?::\s*|\s+)["']?(\d{4}\.\d{1,2}\.\d{1,2}(?:-\d+)?)/mu)?.[1]??i[0].match(pn)?.[0]}catch{return}}function zl(e){let t=[],r=Vt(Ye.join(e,"package.json"));r&&t.push(...jl(r).map(i=>({...i,source:"package.json"})));let n=Vt(Ye.join(e,"node_modules","@unbrained","pm-cli","package.json"))?.version;typeof n=="string"&&Mt(n)&&t.push({version:n,source:"installed-package",constraint:"exact",history_epoch_compatible:mn(n)===3});let o=Ll(e);o&&Mt(o)&&t.push({version:o,source:"package-lock.json",constraint:"exact",history_epoch_compatible:mn(o)===3});for(let i of["pnpm-lock.yaml","yarn.lock"]){let s=Hl(e,i);s&&t.push({version:s,source:i,constraint:"exact",history_epoch_compatible:mn(s)===3})}return t}function bm(e,t){if(t<=1)return;let{minVersion:r,lt:n}=Rl(import.meta.url)("semver"),o=cs(Vt(Ye.join(e,"package.json"))??{}).find(s=>{try{let a=r(s);return a!==null&&n(a,"2026.10.10")}catch{return!1}}),i=o===void 0?zl(e).find(s=>Ut(s.version,"2026.10.10")===-1):{version:o,source:"package.json"};if(i)throw new b(`The project selects pm ${i.version}, which cannot safely refuse item format ${t}.`,w.CONFLICT,{code:"project_runtime_item_format_incompatible",reason:i.source,required:"Upgrade project pins, installed SDKs, CI hosts and Git merge drivers before writing guarded item formats.",nextSteps:["Use a pm runtime supporting the required item format throughout the project; preserve original item and history bytes, and never re-anchor history to satisfy an older host."]})}import gn from"node:fs/promises";import Wt 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]="658ab1c3-da92-5af6-a170-85ed7befaad6")}catch{}})();function oe(e,t){return typeof e=="object"&&e!==null&&"code"in e&&e.code===t}function ds(e){let t=["--pm-path",e,"init","--defaults","--agent-guidance","skip"];return{suggested_retry:Wn(t),suggested_retry_args:t}}function qt(e){return new b(`Tracker root is not a directory at ${e}.`,w.USAGE,{code:"tracker_root_not_directory",reason:"not_a_directory",resolved_path:e,nextSteps:["Pass a tracker directory, usually <workspace>/.agents/pm, rather than a file path."]})}function yn(e){return new b(`Tracker root is not readable at ${e}.`,w.GENERIC_FAILURE,{code:"tracker_root_unreadable",reason:"unreadable",resolved_path:e,nextSteps:["Grant read and directory-search permission to the tracker root, then retry."]})}async function Fl(e){let t=Wt.resolve(e),r=Wt.parse(t).root,n=Wt.dirname(t);for(;n!==r;){let o;try{o=await gn.stat(n)}catch(i){if(oe(i,"ENOTDIR"))throw qt(e);if(!oe(i,"ENOENT"))throw i;n=Wt.dirname(n);continue}if(!o.isDirectory())throw qt(e);return}}async function $l(e){let t;try{t=await gn.stat(e)}catch(r){throw oe(r,"ENOENT")?(await Fl(e),new b(`Tracker is not initialized at ${e}. Tracker root does not exist. Run pm init first.`,w.NOT_FOUND,{code:"tracker_root_missing",reason:"missing",resolved_path:e,nextSteps:["Confirm the tracker root path or initialize it with the emitted retry."],recovery:ds(e)})):oe(r,"ENOTDIR")?qt(e):oe(r,"EACCES")||oe(r,"EPERM")?yn(e):r}if(!t.isDirectory())throw qt(e);if(process.platform!=="win32"&&((t.mode&292)===0||(t.mode&73)===0))throw yn(e);try{await(await gn.opendir(e)).close()}catch(r){throw oe(r,"EACCES")||oe(r,"EPERM")?yn(e):r}}async function xm(e){if(await $l(e),!await Cn(Ee(e)))throw new b(`Tracker is not initialized at ${e}. Run pm init first.`,w.NOT_FOUND,{code:"tracker_not_initialized",reason:"settings_missing",resolved_path:e,nextSteps:["Initialize the selected tracker root with the emitted retry."],recovery:ds(e)})}export{Vl as a,fs as b,Kn as c,ce as d,K as e,jo as f,Zn as g,Ve as h,Kl as i,Xl as j,Yt as k,Zt as l,Zl as m,Qt as n,eo as o,ks as p,Ql as q,ct as r,Is as s,nu as t,dt as u,ya as v,_t as w,Eu as x,ku as y,Ae as z,le as A,fr as B,Ou as C,Au as D,go as E,gr as F,Lu as G,Hu as H,zu as I,Fu as J,$u as K,Mu as L,Ar as M,Tr as N,Oo as O,Yu as P,Zu as Q,Qu as R,e_ as S,t_ as T,r_ as U,Rr as V,No as W,n_ as X,o_ as Y,i_ as Z,wc as _,s_ as $,Po as aa,Ec as ba,me as ca,Ce as da,Ho as ea,Mc as fa,N_ as ga,R_ as ha,D_ as ia,ed as ja,It as ka,ge as la,Je as ma,nf as na,Gr as oa,Tt as pa,_i as qa,of as ra,pi as sa,sf as ta,Jr as ua,Kr as va,gd as wa,xt as xa,hf as ya,Xr as za,Ct as Aa,yf as Ba,gf as Ca,bi as Da,Nt as Ea,ki as Fa,Ke as Ga,Ad as Ha,vf as Ia,bf as Ja,Pe as Ka,Dt as La,jf as Ma,Lf as Na,Hf as Oa,Ai as Pa,zf as Qa,en as Ra,Wf as Sa,re as Ta,um as Ua,Qd as Va,$i as Wa,$t as Xa,Cl as Ya,is as Za,_m as _a,fm as $a,zl as ab,bm as bb,$l as cb,xm as db};
78
- //# sourceMappingURL=chunk-JI3RXXRN.js.map
78
+ //# sourceMappingURL=chunk-VYAZND5Q.js.map